@project-sunbird/collection-editor-react 0.1.26 → 0.1.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- (function(pe,h){typeof exports=="object"&&typeof module<"u"?h(exports,require("react"),require("react-dom"),require("react/jsx-runtime")):typeof define=="function"&&define.amd?define(["exports","react","react-dom","react/jsx-runtime"],h):(pe=typeof globalThis<"u"?globalThis:pe||self,h(pe.CollectionEditorReact={},pe.React,pe.ReactDOM,pe.jsxRuntime))})(this,function(pe,h,Pe,l){"use strict";var TI=Object.defineProperty;var up=pe=>{throw TypeError(pe)};var NI=(pe,h,Pe)=>h in pe?TI(pe,h,{enumerable:!0,configurable:!0,writable:!0,value:Pe}):pe[h]=Pe;var Ks=(pe,h,Pe)=>NI(pe,typeof h!="symbol"?h+"":h,Pe),bl=(pe,h,Pe)=>h.has(pe)||up("Cannot "+Pe);var O=(pe,h,Pe)=>(bl(pe,h,"read from private field"),Pe?Pe.call(pe):h.get(pe)),ie=(pe,h,Pe)=>h.has(pe)?up("Cannot add the same private member more than once"):h instanceof WeakSet?h.add(pe):h.set(pe,Pe),R=(pe,h,Pe,l)=>(bl(pe,h,"write to private field"),l?l.call(pe,Pe):h.set(pe,Pe),Pe),_e=(pe,h,Pe)=>(bl(pe,h,"access private method"),Pe);var fo=(pe,h,Pe,l)=>({set _(ho){R(pe,h,ho,Pe)},get _(){return O(pe,h,l)}});var rn,Ar,jn,ep,ar,nn,tp,Bn,Pr,Un,rp,sn,np,Vn,on,qn,Ht,an,it,js,ln,$t,dp,wr,sp,kt,Se,Bs,Et,cn,zn,yr,Mr,Us,Hn,Wn,un,dn,Lr,Qn,ke,Gs,_l,wl,Sl,Cl,El,Ol,Il,fp,ip,Vs,lr,wt,fn,cr,Vr,op,vr,er,qs,ap,ur,lp,Ke,Fr,$r,Kn,Gn,jr,Rn,Yn,cp;function ho(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const Te=ho(h);var Zn=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(){}},gp=(ep=class extends Zn{constructor(){super();ie(this,rn);ie(this,Ar);ie(this,jn);R(this,jn,t=>{if(typeof window<"u"&&window.addEventListener){const r=()=>t();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){O(this,Ar)||this.setEventListener(O(this,jn))}onUnsubscribe(){var t;this.hasListeners()||((t=O(this,Ar))==null||t.call(this),R(this,Ar,void 0))}setEventListener(t){var r;R(this,jn,t),(r=O(this,Ar))==null||r.call(this),R(this,Ar,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){O(this,rn)!==t&&(R(this,rn,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(r=>{r(t)})}isFocused(){var t;return typeof O(this,rn)=="boolean"?O(this,rn):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},rn=new WeakMap,Ar=new WeakMap,jn=new WeakMap,ep),po=new gp,yp={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},vp=(tp=class{constructor(){ie(this,ar,yp);ie(this,nn,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&O(this,nn)&&e!==O(this,ar)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:O(this,ar),provider:e}),R(this,ar,e),process.env.NODE_ENV!=="production"&&R(this,nn,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&R(this,nn,!0),O(this,ar).setTimeout(e,t)}clearTimeout(e){O(this,ar).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&R(this,nn,!0),O(this,ar).setInterval(e,t)}clearInterval(e){O(this,ar).clearInterval(e)}},ar=new WeakMap,nn=new WeakMap,tp),qr=new vp;function mp(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 go(e){return typeof e=="number"&&e>=0&&e!==1/0}function Dl(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Sr(e,t){return typeof e=="function"?e(t):e}function Pt(e,t){return typeof e=="function"?e(t):e}function Tl(e,t){const{type:r="all",exact:n,fetchStatus:s,predicate:i,queryKey:o,stale:a}=e;if(o){if(n){if(t.queryHash!==yo(o,t.options))return!1}else if(!es(t.queryKey,o))return!1}if(r!=="all"){const c=t.isActive();if(r==="active"&&!c||r==="inactive"&&c)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||s&&s!==t.state.fetchStatus||i&&!i(t))}function Nl(e,t){const{exact:r,status:n,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(r){if(Jn(t.options.mutationKey)!==Jn(i))return!1}else if(!es(t.options.mutationKey,i))return!1}return!(n&&t.state.status!==n||s&&!s(t))}function yo(e,t){return((t==null?void 0:t.queryKeyHashFn)||Jn)(e)}function Jn(e){return JSON.stringify(e,(t,r)=>bo(r)?Object.keys(r).sort().reduce((n,s)=>(n[s]=r[s],n),{}):r)}function es(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>es(e[r],t[r])):!1}var wp=Object.prototype.hasOwnProperty;function vo(e,t,r=0){if(e===t)return e;if(r>500)return t;const n=kl(e)&&kl(t);if(!n&&!(bo(e)&&bo(t)))return t;const i=(n?e:Object.keys(e)).length,o=n?t:Object.keys(t),a=o.length,c=n?new Array(a):{};let d=0;for(let u=0;u<a;u++){const f=n?u:o[u],g=e[f],y=t[f];if(g===y){c[f]=g,(n?u<i:wp.call(e,f))&&d++;continue}if(g===null||y===null||typeof g!="object"||typeof y!="object"){c[f]=y;continue}const _=vo(g,y,r+1);c[f]=_,_===g&&d++}return i===a&&d===i?e:c}function mo(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function kl(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function bo(e){if(!xl(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!xl(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function xl(e){return Object.prototype.toString.call(e)==="[object Object]"}function Sp(e){return new Promise(t=>{qr.setTimeout(t,e)})}function _o(e,t,r){if(typeof r.structuralSharing=="function")return r.structuralSharing(e,t);if(r.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return vo(e,t)}catch(n){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${r.queryHash}]: ${n}`),n}return vo(e,t)}return t}function 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 Rs=Symbol();function Al(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Rs&&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===Rs?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Pl(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 ts=(()=>{let e=()=>bp;return{isServer(){return e()},setIsServer(t){e=t}}})();function wo(){let e,t;const r=new Promise((s,i)=>{e=s,t=i});r.status="pending",r.catch(()=>{});function n(s){Object.assign(r,s),delete r.resolve,delete r.reject}return r.resolve=s=>{n({status:"fulfilled",value:s}),e(s)},r.reject=s=>{n({status:"rejected",reason:s}),t(s)},r}var Ip=mp;function Dp(){let e=[],t=0,r=a=>{a()},n=a=>{a()},s=Ip;const i=a=>{t?e.push(a):s(()=>{r(a)})},o=()=>{const a=e;e=[],a.length&&s(()=>{n(()=>{a.forEach(c=>{r(c)})})})};return{batch:a=>{let c;t++;try{c=a()}finally{t--,t||o()}return c},batchCalls:a=>(...c)=>{i(()=>{a(...c)})},schedule:i,setNotifyFunction:a=>{r=a},setBatchNotifyFunction:a=>{n=a},setScheduler:a=>{s=a}}}var lt=Dp(),Tp=(rp=class extends Zn{constructor(){super();ie(this,Bn,!0);ie(this,Pr);ie(this,Un);R(this,Un,t=>{if(typeof window<"u"&&window.addEventListener){const r=()=>t(!0),n=()=>t(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",n)}}})}onSubscribe(){O(this,Pr)||this.setEventListener(O(this,Un))}onUnsubscribe(){var t;this.hasListeners()||((t=O(this,Pr))==null||t.call(this),R(this,Pr,void 0))}setEventListener(t){var r;R(this,Un,t),(r=O(this,Pr))==null||r.call(this),R(this,Pr,t(this.setOnline.bind(this)))}setOnline(t){O(this,Bn)!==t&&(R(this,Bn,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return O(this,Bn)}},Bn=new WeakMap,Pr=new WeakMap,Un=new WeakMap,rp),Ys=new Tp;function Np(e){return Math.min(1e3*2**e,3e4)}function Ml(e){return(e??"online")==="online"?Ys.isOnline():!0}var So=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Ll(e){let t=!1,r=0,n;const s=wo(),i=()=>s.status!=="pending",o=p=>{var v;if(!i()){const m=new So(p);g(m),(v=e.onCancel)==null||v.call(e,m)}},a=()=>{t=!0},c=()=>{t=!1},d=()=>po.isFocused()&&(e.networkMode==="always"||Ys.isOnline())&&e.canRun(),u=()=>Ml(e.networkMode)&&e.canRun(),f=p=>{i()||(n==null||n(),s.resolve(p))},g=p=>{i()||(n==null||n(),s.reject(p))},y=()=>new Promise(p=>{var v;n=m=>{(i()||d())&&p(m)},(v=e.onPause)==null||v.call(e)}).then(()=>{var p;n=void 0,i()||(p=e.onContinue)==null||p.call(e)}),_=()=>{if(i())return;let p;const v=r===0?e.initialPromise:void 0;try{p=v??e.fn()}catch(m){p=Promise.reject(m)}Promise.resolve(p).then(f).catch(m=>{var D;if(i())return;const b=e.retry??(ts.isServer()?0:3),S=e.retryDelay??Np,w=typeof S=="function"?S(r,m):S,E=b===!0||typeof b=="number"&&r<b||typeof b=="function"&&b(r,m);if(t||!E){g(m);return}r++,(D=e.onFail)==null||D.call(e,r,m),Sp(w).then(()=>d()?void 0:y()).then(()=>{t?g(m):_()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(n==null||n(),s),cancelRetry:a,continueRetry:c,canStart:u,start:()=>(u()?_():y().then(_),s)}}var Fl=(np=class{constructor(){ie(this,sn)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),go(this.gcTime)&&R(this,sn,qr.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(ts.isServer()?1/0:5*60*1e3))}clearGcTimeout(){O(this,sn)!==void 0&&(qr.clearTimeout(O(this,sn)),R(this,sn,void 0))}},sn=new WeakMap,np);function kp(e){return{onFetch:(t,r)=>{var u,f,g,y,_;const n=t.options,s=(g=(f=(u=t.fetchOptions)==null?void 0:u.meta)==null?void 0:f.fetchMore)==null?void 0:g.direction,i=((y=t.state.data)==null?void 0:y.pages)||[],o=((_=t.state.data)==null?void 0:_.pageParams)||[];let a={pages:[],pageParams:[]},c=0;const d=async()=>{let p=!1;const v=S=>{Op(S,()=>t.signal,()=>p=!0)},m=Al(t.options,t.fetchOptions),b=async(S,w,E)=>{if(p)return Promise.reject(t.signal.reason);if(w==null&&S.pages.length)return Promise.resolve(S);const x=(()=>{const M={client:t.client,queryKey:t.queryKey,pageParam:w,direction:E?"backward":"forward",meta:t.options.meta};return v(M),M})(),A=await m(x),{maxPages:$}=t.options,N=E?Ep:Cp;return{pages:N(S.pages,A,$),pageParams:N(S.pageParams,w,$)}};if(s&&i.length){const S=s==="backward",w=S?xp:$l,E={pages:i,pageParams:o},D=w(n,E);a=await b(E,D,S)}else{const S=e??i.length;do{const w=c===0?o[0]??n.initialPageParam:$l(n,a);if(c>0&&w==null)break;a=await b(a,w),c++}while(c<S)}return a};t.options.persister?t.fetchFn=()=>{var p,v;return(v=(p=t.options).persister)==null?void 0:v.call(p,d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r)}:t.fetchFn=d}}}function $l(e,{pages:t,pageParams:r}){const n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}function xp(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 Ap=(sp=class extends Fl{constructor(t){super();ie(this,$t);ie(this,Vn);ie(this,on);ie(this,qn);ie(this,Ht);ie(this,an);ie(this,it);ie(this,js);ie(this,ln);R(this,ln,!1),R(this,js,t.defaultOptions),this.setOptions(t.options),this.observers=[],R(this,an,t.client),R(this,Ht,O(this,an).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,R(this,on,Ul(this.options)),this.state=t.state??O(this,on),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return O(this,Vn)}get promise(){var t;return(t=O(this,it))==null?void 0:t.promise}setOptions(t){if(this.options={...O(this,js),...t},t!=null&&t._type&&R(this,Vn,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=Ul(this.options);r.data!==void 0&&(this.setState(Bl(r.data,r.dataUpdatedAt)),R(this,on,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&O(this,Ht).remove(this)}setData(t,r){const n=_o(this.state.data,t,this.options);return _e(this,$t,wr).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,$t,wr).call(this,{type:"setState",state:t})}cancel(t){var n,s;const r=(n=O(this,it))==null?void 0:n.promise;return(s=O(this,it))==null||s.cancel(t),r?r.then(It).catch(It):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return O(this,on)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>Pt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Rs||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Sr(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:!Dl(this.state.dataUpdatedAt,t)}onFocus(){var r;const t=this.observers.find(n=>n.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(r=O(this,it))==null||r.continue()}onOnline(){var r;const t=this.observers.find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(r=O(this,it))==null||r.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),O(this,Ht).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(O(this,it)&&(O(this,ln)||_e(this,$t,dp).call(this)?O(this,it).cancel({revert:!0}):O(this,it).cancelRetry()),this.scheduleGc()),O(this,Ht).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||_e(this,$t,wr).call(this,{type:"invalidate"})}async fetch(t,r){var d,u,f,g,y,_,p,v,m,b,S;if(this.state.fetchStatus!=="idle"&&((d=O(this,it))==null?void 0:d.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(O(this,it))return O(this,it).continueRetry(),O(this,it).promise}if(t&&this.setOptions(t),!this.options.queryFn){const w=this.observers.find(E=>E.options.queryFn);w&&this.setOptions(w.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const n=new AbortController,s=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(R(this,ln,!0),n.signal)})},i=()=>{const w=Al(this.options,r),D=(()=>{const x={client:O(this,an),queryKey:this.queryKey,meta:this.meta};return s(x),x})();return R(this,ln,!1),this.options.persister?this.options.persister(w,D,this):w(D)},a=(()=>{const w={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:O(this,an),state:this.state,fetchFn:i};return s(w),w})(),c=O(this,Vn)==="infinite"?kp(this.options.pages):this.options.behavior;c==null||c.onFetch(a,this),R(this,qn,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=a.fetchOptions)==null?void 0:u.meta))&&_e(this,$t,wr).call(this,{type:"fetch",meta:(f=a.fetchOptions)==null?void 0:f.meta}),R(this,it,Ll({initialPromise:r==null?void 0:r.initialPromise,fn:a.fetchFn,onCancel:w=>{w instanceof So&&w.revert&&this.setState({...O(this,qn),fetchStatus:"idle"}),n.abort()},onFail:(w,E)=>{_e(this,$t,wr).call(this,{type:"failed",failureCount:w,error:E})},onPause:()=>{_e(this,$t,wr).call(this,{type:"pause"})},onContinue:()=>{_e(this,$t,wr).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const w=await O(this,it).start();if(w===void 0)throw process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(w),(y=(g=O(this,Ht).config).onSuccess)==null||y.call(g,w,this),(p=(_=O(this,Ht).config).onSettled)==null||p.call(_,w,this.state.error,this),w}catch(w){if(w instanceof So){if(w.silent)return O(this,it).promise;if(w.revert){if(this.state.data===void 0)throw w;return this.state.data}}throw _e(this,$t,wr).call(this,{type:"error",error:w}),(m=(v=O(this,Ht).config).onError)==null||m.call(v,w,this),(S=(b=O(this,Ht).config).onSettled)==null||S.call(b,this.state.data,w,this),w}finally{this.scheduleGc()}}},Vn=new WeakMap,on=new WeakMap,qn=new WeakMap,Ht=new WeakMap,an=new WeakMap,it=new WeakMap,js=new WeakMap,ln=new WeakMap,$t=new WeakSet,dp=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},wr=function(t){const r=n=>{switch(t.type){case"failed":return{...n,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...jl(n.data,this.options),fetchMeta:t.meta??null};case"success":const s={...n,...Bl(t.data,t.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return R(this,qn,t.manual?s:void 0),s;case"error":const i=t.error;return{...n,error:i,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...t.state}}};this.state=r(this.state),lt.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),O(this,Ht).notify({query:this,type:"updated",action:t})})},sp);function jl(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ml(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Bl(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Ul(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,r=t!==void 0,n=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var Pp=(ip=class extends Zn{constructor(t,r){super();ie(this,ke);ie(this,kt);ie(this,Se);ie(this,Bs);ie(this,Et);ie(this,cn);ie(this,zn);ie(this,yr);ie(this,Mr);ie(this,Us);ie(this,Hn);ie(this,Wn);ie(this,un);ie(this,dn);ie(this,Lr);ie(this,Qn,new Set);this.options=r,R(this,kt,t),R(this,Mr,null),R(this,yr,wo()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(O(this,Se).addObserver(this),Vl(O(this,Se),this.options)?_e(this,ke,Gs).call(this):this.updateResult(),_e(this,ke,Cl).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Co(O(this,Se),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Co(O(this,Se),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,_e(this,ke,El).call(this),_e(this,ke,Ol).call(this),O(this,Se).removeObserver(this)}setOptions(t){const r=this.options,n=O(this,Se);if(this.options=O(this,kt).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Pt(this.options.enabled,O(this,Se))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");_e(this,ke,Il).call(this),O(this,Se).setOptions(this.options),r._defaulted&&!mo(this.options,r)&&O(this,kt).getQueryCache().notify({type:"observerOptionsUpdated",query:O(this,Se),observer:this});const s=this.hasListeners();s&&ql(O(this,Se),n,this.options,r)&&_e(this,ke,Gs).call(this),this.updateResult(),s&&(O(this,Se)!==n||Pt(this.options.enabled,O(this,Se))!==Pt(r.enabled,O(this,Se))||Sr(this.options.staleTime,O(this,Se))!==Sr(r.staleTime,O(this,Se)))&&_e(this,ke,_l).call(this);const i=_e(this,ke,wl).call(this);s&&(O(this,Se)!==n||Pt(this.options.enabled,O(this,Se))!==Pt(r.enabled,O(this,Se))||i!==O(this,Lr))&&_e(this,ke,Sl).call(this,i)}getOptimisticResult(t){const r=O(this,kt).getQueryCache().build(O(this,kt),t),n=this.createResult(r,t);return Lp(this,n)&&(R(this,Et,n),R(this,zn,this.options),R(this,cn,O(this,Se).state)),n}getCurrentResult(){return O(this,Et)}trackResult(t,r){return new Proxy(t,{get:(n,s)=>(this.trackProp(s),r==null||r(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&O(this,yr).status==="pending"&&O(this,yr).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,s))})}trackProp(t){O(this,Qn).add(t)}getCurrentQuery(){return O(this,Se)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const r=O(this,kt).defaultQueryOptions(t),n=O(this,kt).getQueryCache().build(O(this,kt),r);return n.fetch().then(()=>this.createResult(n,r))}fetch(t){return _e(this,ke,Gs).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),O(this,Et)))}createResult(t,r){var $;const n=O(this,Se),s=this.options,i=O(this,Et),o=O(this,cn),a=O(this,zn),d=t!==n?t.state:O(this,Bs),{state:u}=t;let f={...u},g=!1,y;if(r._optimisticResults){const N=this.hasListeners(),M=!N&&Vl(t,r),U=N&&ql(t,n,r,s);(M||U)&&(f={...f,...jl(u.data,t.options)}),r._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:_,errorUpdatedAt:p,status:v}=f;y=f.data;let m=!1;if(r.placeholderData!==void 0&&y===void 0&&v==="pending"){let N;i!=null&&i.isPlaceholderData&&r.placeholderData===(a==null?void 0:a.placeholderData)?(N=i.data,m=!0):N=typeof r.placeholderData=="function"?r.placeholderData(($=O(this,Wn))==null?void 0:$.state.data,O(this,Wn)):r.placeholderData,N!==void 0&&(v="success",y=_o(i==null?void 0:i.data,N,r),g=!0)}if(r.select&&y!==void 0&&!m)if(i&&y===(o==null?void 0:o.data)&&r.select===O(this,Us))y=O(this,Hn);else try{R(this,Us,r.select),y=r.select(y),y=_o(i==null?void 0:i.data,y,r),R(this,Hn,y),R(this,Mr,null)}catch(N){R(this,Mr,N)}O(this,Mr)&&(_=O(this,Mr),y=O(this,Hn),p=Date.now(),v="error");const b=f.fetchStatus==="fetching",S=v==="pending",w=v==="error",E=S&&b,D=y!==void 0,A={status:v,fetchStatus:f.fetchStatus,isPending:S,isSuccess:v==="success",isError:w,isInitialLoading:E,isLoading:E,data:y,dataUpdatedAt:f.dataUpdatedAt,error:_,errorUpdatedAt:p,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:Eo(t,r),refetch:this.refetch,promise:O(this,yr),isEnabled:Pt(r.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const N=A.data!==void 0,M=A.status==="error"&&!N,U=j=>{M?j.reject(A.error):N&&j.resolve(A.data)},P=()=>{const j=R(this,yr,A.promise=wo());U(j)},L=O(this,yr);switch(L.status){case"pending":t.queryHash===n.queryHash&&U(L);break;case"fulfilled":(M||A.data!==L.value)&&P();break;case"rejected":(!M||A.error!==L.reason)&&P();break}}return A}updateResult(){const t=O(this,Et),r=this.createResult(O(this,Se),this.options);if(R(this,cn,O(this,Se).state),R(this,zn,this.options),O(this,cn).data!==void 0&&R(this,Wn,O(this,Se)),mo(r,t))return;R(this,Et,r);const n=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,i=typeof s=="function"?s():s;if(i==="all"||!i&&!O(this,Qn).size)return!0;const o=new Set(i??O(this,Qn));return this.options.throwOnError&&o.add("error"),Object.keys(O(this,Et)).some(a=>{const c=a;return O(this,Et)[c]!==t[c]&&o.has(c)})};_e(this,ke,fp).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&_e(this,ke,Cl).call(this)}},kt=new WeakMap,Se=new WeakMap,Bs=new WeakMap,Et=new WeakMap,cn=new WeakMap,zn=new WeakMap,yr=new WeakMap,Mr=new WeakMap,Us=new WeakMap,Hn=new WeakMap,Wn=new WeakMap,un=new WeakMap,dn=new WeakMap,Lr=new WeakMap,Qn=new WeakMap,ke=new WeakSet,Gs=function(t){_e(this,ke,Il).call(this);let r=O(this,Se).fetch(this.options,t);return t!=null&&t.throwOnError||(r=r.catch(It)),r},_l=function(){_e(this,ke,El).call(this);const t=Sr(this.options.staleTime,O(this,Se));if(ts.isServer()||O(this,Et).isStale||!go(t))return;const n=Dl(O(this,Et).dataUpdatedAt,t)+1;R(this,un,qr.setTimeout(()=>{O(this,Et).isStale||this.updateResult()},n))},wl=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(O(this,Se)):this.options.refetchInterval)??!1},Sl=function(t){_e(this,ke,Ol).call(this),R(this,Lr,t),!(ts.isServer()||Pt(this.options.enabled,O(this,Se))===!1||!go(O(this,Lr))||O(this,Lr)===0)&&R(this,dn,qr.setInterval(()=>{(this.options.refetchIntervalInBackground||po.isFocused())&&_e(this,ke,Gs).call(this)},O(this,Lr)))},Cl=function(){_e(this,ke,_l).call(this),_e(this,ke,Sl).call(this,_e(this,ke,wl).call(this))},El=function(){O(this,un)!==void 0&&(qr.clearTimeout(O(this,un)),R(this,un,void 0))},Ol=function(){O(this,dn)!==void 0&&(qr.clearInterval(O(this,dn)),R(this,dn,void 0))},Il=function(){const t=O(this,kt).getQueryCache().build(O(this,kt),this.options);if(t===O(this,Se))return;const r=O(this,Se);R(this,Se,t),R(this,Bs,t.state),this.hasListeners()&&(r==null||r.removeObserver(this),t.addObserver(this))},fp=function(t){lt.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(O(this,Et))}),O(this,kt).getQueryCache().notify({query:O(this,Se),type:"observerResultsUpdated"})})},ip);function Mp(e,t){return Pt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&Pt(t.retryOnMount,e)===!1)}function Vl(e,t){return Mp(e,t)||e.state.data!==void 0&&Co(e,t,t.refetchOnMount)}function Co(e,t,r){if(Pt(t.enabled,e)!==!1&&Sr(t.staleTime,e)!=="static"){const n=typeof r=="function"?r(e):r;return n==="always"||n!==!1&&Eo(e,t)}return!1}function ql(e,t,r,n){return(e!==t||Pt(n.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&Eo(e,r)}function Eo(e,t){return Pt(t.enabled,e)!==!1&&e.isStaleByTime(Sr(t.staleTime,e))}function Lp(e,t){return!mo(e.getCurrentResult(),t)}var Fp=(op=class extends Fl{constructor(t){super();ie(this,cr);ie(this,Vs);ie(this,lr);ie(this,wt);ie(this,fn);R(this,Vs,t.client),this.mutationId=t.mutationId,R(this,wt,t.mutationCache),R(this,lr,[]),this.state=t.state||$p(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){O(this,lr).includes(t)||(O(this,lr).push(t),this.clearGcTimeout(),O(this,wt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){R(this,lr,O(this,lr).filter(r=>r!==t)),this.scheduleGc(),O(this,wt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){O(this,lr).length||(this.state.status==="pending"?this.scheduleGc():O(this,wt).remove(this))}continue(){var t;return((t=O(this,fn))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,a,c,d,u,f,g,y,_,p,v,m,b,S,w,E,D,x;const r=()=>{_e(this,cr,Vr).call(this,{type:"continue"})},n={client:O(this,Vs),meta:this.options.meta,mutationKey:this.options.mutationKey};R(this,fn,Ll({fn:()=>this.options.mutationFn?this.options.mutationFn(t,n):Promise.reject(new Error("No mutationFn found")),onFail:(A,$)=>{_e(this,cr,Vr).call(this,{type:"failed",failureCount:A,error:$})},onPause:()=>{_e(this,cr,Vr).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>O(this,wt).canRun(this)}));const s=this.state.status==="pending",i=!O(this,fn).canStart();try{if(s)r();else{_e(this,cr,Vr).call(this,{type:"pending",variables:t,isPaused:i}),O(this,wt).config.onMutate&&await O(this,wt).config.onMutate(t,this,n);const $=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,t,n));$!==this.state.context&&_e(this,cr,Vr).call(this,{type:"pending",context:$,variables:t,isPaused:i})}const A=await O(this,fn).start();return await((d=(c=O(this,wt).config).onSuccess)==null?void 0:d.call(c,A,t,this.state.context,this,n)),await((f=(u=this.options).onSuccess)==null?void 0:f.call(u,A,t,this.state.context,n)),await((y=(g=O(this,wt).config).onSettled)==null?void 0:y.call(g,A,null,this.state.variables,this.state.context,this,n)),await((p=(_=this.options).onSettled)==null?void 0:p.call(_,A,null,t,this.state.context,n)),_e(this,cr,Vr).call(this,{type:"success",data:A}),A}catch(A){try{await((m=(v=O(this,wt).config).onError)==null?void 0:m.call(v,A,t,this.state.context,this,n))}catch($){Promise.reject($)}try{await((S=(b=this.options).onError)==null?void 0:S.call(b,A,t,this.state.context,n))}catch($){Promise.reject($)}try{await((E=(w=O(this,wt).config).onSettled)==null?void 0:E.call(w,void 0,A,this.state.variables,this.state.context,this,n))}catch($){Promise.reject($)}try{await((x=(D=this.options).onSettled)==null?void 0:x.call(D,void 0,A,t,this.state.context,n))}catch($){Promise.reject($)}throw _e(this,cr,Vr).call(this,{type:"error",error:A}),A}finally{O(this,wt).runNext(this)}}},Vs=new WeakMap,lr=new WeakMap,wt=new WeakMap,fn=new WeakMap,cr=new WeakSet,Vr=function(t){const r=n=>{switch(t.type){case"failed":return{...n,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...n,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:t.error,failureCount:n.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=r(this.state),lt.batch(()=>{O(this,lr).forEach(n=>{n.onMutationUpdate(t)}),O(this,wt).notify({mutation:this,type:"updated",action:t})})},op);function $p(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var jp=(ap=class extends Zn{constructor(t={}){super();ie(this,vr);ie(this,er);ie(this,qs);this.config=t,R(this,vr,new Set),R(this,er,new Map),R(this,qs,0)}build(t,r,n){const s=new Fp({client:t,mutationCache:this,mutationId:++fo(this,qs)._,options:t.defaultMutationOptions(r),state:n});return this.add(s),s}add(t){O(this,vr).add(t);const r=Xs(t);if(typeof r=="string"){const n=O(this,er).get(r);n?n.push(t):O(this,er).set(r,[t])}this.notify({type:"added",mutation:t})}remove(t){if(O(this,vr).delete(t)){const r=Xs(t);if(typeof r=="string"){const n=O(this,er).get(r);if(n)if(n.length>1){const s=n.indexOf(t);s!==-1&&n.splice(s,1)}else n[0]===t&&O(this,er).delete(r)}}this.notify({type:"removed",mutation:t})}canRun(t){const r=Xs(t);if(typeof r=="string"){const n=O(this,er).get(r),s=n==null?void 0:n.find(i=>i.state.status==="pending");return!s||s===t}else return!0}runNext(t){var n;const r=Xs(t);if(typeof r=="string"){const s=(n=O(this,er).get(r))==null?void 0:n.find(i=>i!==t&&i.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){lt.batch(()=>{O(this,vr).forEach(t=>{this.notify({type:"removed",mutation:t})}),O(this,vr).clear(),O(this,er).clear()})}getAll(){return Array.from(O(this,vr))}find(t){const r={exact:!0,...t};return this.getAll().find(n=>Nl(r,n))}findAll(t={}){return this.getAll().filter(r=>Nl(t,r))}notify(t){lt.batch(()=>{this.listeners.forEach(r=>{r(t)})})}resumePausedMutations(){const t=this.getAll().filter(r=>r.state.isPaused);return lt.batch(()=>Promise.all(t.map(r=>r.continue().catch(It))))}},vr=new WeakMap,er=new WeakMap,qs=new WeakMap,ap);function Xs(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Bp=(lp=class extends Zn{constructor(t={}){super();ie(this,ur);this.config=t,R(this,ur,new Map)}build(t,r,n){const s=r.queryKey,i=r.queryHash??yo(s,r);let o=this.get(i);return o||(o=new Ap({client:t,queryKey:s,queryHash:i,options:t.defaultQueryOptions(r),state:n,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){O(this,ur).has(t.queryHash)||(O(this,ur).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const r=O(this,ur).get(t.queryHash);r&&(t.destroy(),r===t&&O(this,ur).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){lt.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return O(this,ur).get(t)}getAll(){return[...O(this,ur).values()]}find(t){const r={exact:!0,...t};return this.getAll().find(n=>Tl(r,n))}findAll(t={}){const r=this.getAll();return Object.keys(t).length>0?r.filter(n=>Tl(t,n)):r}notify(t){lt.batch(()=>{this.listeners.forEach(r=>{r(t)})})}onFocus(){lt.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){lt.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},ur=new WeakMap,lp),Up=(cp=class{constructor(e={}){ie(this,Ke);ie(this,Fr);ie(this,$r);ie(this,Kn);ie(this,Gn);ie(this,jr);ie(this,Rn);ie(this,Yn);R(this,Ke,e.queryCache||new Bp),R(this,Fr,e.mutationCache||new jp),R(this,$r,e.defaultOptions||{}),R(this,Kn,new Map),R(this,Gn,new Map),R(this,jr,0)}mount(){fo(this,jr)._++,O(this,jr)===1&&(R(this,Rn,po.subscribe(async e=>{e&&(await this.resumePausedMutations(),O(this,Ke).onFocus())})),R(this,Yn,Ys.subscribe(async e=>{e&&(await this.resumePausedMutations(),O(this,Ke).onOnline())})))}unmount(){var e,t;fo(this,jr)._--,O(this,jr)===0&&((e=O(this,Rn))==null||e.call(this),R(this,Rn,void 0),(t=O(this,Yn))==null||t.call(this),R(this,Yn,void 0))}isFetching(e){return O(this,Ke).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return O(this,Fr).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=O(this,Ke).get(t.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=O(this,Ke).build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(Sr(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return O(this,Ke).findAll(e).map(({queryKey:t,state:r})=>{const n=r.data;return[t,n]})}setQueryData(e,t,r){const n=this.defaultQueryOptions({queryKey:e}),s=O(this,Ke).get(n.queryHash),i=s==null?void 0:s.state.data,o=_p(t,i);if(o!==void 0)return O(this,Ke).build(this,n).setData(o,{...r,manual:!0})}setQueriesData(e,t,r){return lt.batch(()=>O(this,Ke).findAll(e).map(({queryKey:n})=>[n,this.setQueryData(n,t,r)]))}getQueryState(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=O(this,Ke).get(t.queryHash))==null?void 0:r.state}removeQueries(e){const t=O(this,Ke);lt.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=O(this,Ke);return lt.batch(()=>(r.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=lt.batch(()=>O(this,Ke).findAll(e).map(s=>s.cancel(r)));return Promise.all(n).then(It).catch(It)}invalidateQueries(e,t={}){return lt.batch(()=>(O(this,Ke).findAll(e).forEach(r=>{r.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const r={...t,cancelRefetch:t.cancelRefetch??!0},n=lt.batch(()=>O(this,Ke).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=O(this,Ke).build(this,t);return r.isStaleByTime(Sr(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 Ys.isOnline()?O(this,Fr).resumePausedMutations():Promise.resolve()}getQueryCache(){return O(this,Ke)}getMutationCache(){return O(this,Fr)}getDefaultOptions(){return O(this,$r)}setDefaultOptions(e){R(this,$r,e)}setQueryDefaults(e,t){O(this,Kn).set(Jn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...O(this,Kn).values()],r={};return t.forEach(n=>{es(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){O(this,Gn).set(Jn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...O(this,Gn).values()],r={};return t.forEach(n=>{es(e,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...O(this,$r).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=yo(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Rs&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...O(this,$r).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){O(this,Ke).clear(),O(this,Fr).clear()}},Ke=new WeakMap,Fr=new WeakMap,$r=new WeakMap,Kn=new WeakMap,Gn=new WeakMap,jr=new WeakMap,Rn=new WeakMap,Yn=new WeakMap,cp),zl=Te.createContext(void 0),Vp=e=>{const t=Te.useContext(zl);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},qp=({client:e,children:t})=>(Te.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),l.jsx(zl.Provider,{value:e,children:t})),Hl=Te.createContext(!1),zp=()=>Te.useContext(Hl);Hl.Provider;function Hp(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Wp=Te.createContext(Hp()),Qp=()=>Te.useContext(Wp),Kp=(e,t,r)=>{const n=r!=null&&r.state.error&&typeof e.throwOnError=="function"?Pl(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||n)&&(t.isReset()||(e.retryOnMount=!1))},Gp=e=>{Te.useEffect(()=>{e.clearReset()},[e])},Rp=({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(s&&e.data===void 0||Pl(r,[e.error,n])),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,Wl=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function Jp(e,t,r){var y,_,p,v;if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const n=zp(),s=Qp(),i=Vp(),o=i.defaultQueryOptions(e);(_=(y=i.getDefaultOptions().queries)==null?void 0:y._experimental_beforeQuery)==null||_.call(y,o);const a=i.getQueryCache().get(o.queryHash);process.env.NODE_ENV!=="production"&&(o.queryFn||console.error(`[${o.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`));const c=e.subscribed!==!1;o._optimisticResults=n?"isRestoring":c?"optimistic":void 0,Yp(o),Kp(o,s,a),Gp(s);const d=!i.getQueryCache().get(o.queryHash),[u]=Te.useState(()=>new t(i,o)),f=u.getOptimisticResult(o),g=!n&&c;if(Te.useSyncExternalStore(Te.useCallback(m=>{const b=g?u.subscribe(lt.batchCalls(m)):It;return u.updateResult(),b},[u,g]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),Te.useEffect(()=>{u.setOptions(o)},[o,u]),Zp(o,f))throw Wl(o,u,s);if(Rp({result:f,errorResetBoundary:s,throwOnError:o.throwOnError,query:a,suspense:o.suspense}))throw f.error;if((v=(p=i.getDefaultOptions().queries)==null?void 0:p._experimental_afterQuery)==null||v.call(p,o,f),o.experimental_prefetchInRender&&!ts.isServer()&&Xp(f,n)){const m=d?Wl(o,u,s):a==null?void 0:a.promise;m==null||m.catch(It).finally(()=>{u.updateResult()})}return o.notifyOnChangeProps?f:u.trackResult(f)}function pn(e,t){return Jp(e,Pp)}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,Ql=/\n+/g,Cr=(e,t)=>{let r="",n="",s="";for(let i in e){let o=e[i];i[0]=="@"?i[1]=="i"?r=i+" "+o+";":n+=i[1]=="f"?Cr(o,i):i+"{"+Cr(o,i[1]=="k"?"":t)+"}":typeof o=="object"?n+=Cr(o,t?t.replace(/([^,])+/g,a=>i.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,c=>/&/.test(c)?c.replace(/&/g,a):a?a+" "+c:c)):i):o!=null&&(i=i[1]=="-"?i:i.replace(/[A-Z]/g,"-$&").toLowerCase(),s+=Cr.p?Cr.p(i,o):i+":"+o+";")}return r+(t&&s?t+"{"+s+"}":s)+n},Er={},Kl=e=>{if(typeof e=="object"){let t="";for(let r in e)t+=r+Kl(e[r]);return t}return e},sg=(e,t,r,n,s)=>{let i=Kl(e),o=Er[i]||(Er[i]=(c=>{let d=0,u=11;for(;d<c.length;)u=101*u+c.charCodeAt(d++)>>>0;return"go"+u})(i));if(!Er[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(Ql," ").trim(),g.unshift(g[0][f]=g[0][f]||{})):g[0][u[1]]=u[2].replace(Ql," ").trim();return g[0]})(e);Er[o]=Cr(s?{["@keyframes "+o]:c}:c,r?"":"."+o)}let a=r&&Er.g;return r&&(Er.g=Er[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)})(Er[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?"":Cr(a,""):a===!1?"":a}return n+s+(o??"")},"");function Zs(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 Gl,Oo,Io;Zs.bind({g:1});let pr=Zs.bind({k:1});function og(e,t,r,n){Cr.p=t,Gl=e,Oo=r,Io=n}function Or(e,t){let r=this||{};return function(){let n=arguments;function s(i,o){let a=Object.assign({},i),c=a.className||s.className;r.p=Object.assign({theme:Oo&&Oo()},a),r.o=/go\d/.test(c),a.className=Zs.apply(r,n)+(c?" "+c:"");let d=e;return e[0]&&(d=a.as||e,delete a.as),Io&&d[0]&&Io(a),Gl(d,a)}return s}}var ag=e=>typeof e=="function",Js=(e,t)=>ag(e)?e(t):e,lg=(()=>{let e=0;return()=>(++e).toString()})(),Rl=(()=>{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,Do="default",Yl=(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 Yl(e,{type:e.toasts.find(o=>o.id===n.id)?1:0,toast:n});case 3:let{toastId:s}=t;return{...e,toasts:e.toasts.map(o=>o.id===s||s===void 0?{...o,dismissed:!0,visible:!1}:o)};case 4:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(o=>o.id!==t.toastId)};case 5:return{...e,pausedAt:t.time};case 6:let i=t.time-(e.pausedAt||0);return{...e,pausedAt:void 0,toasts:e.toasts.map(o=>({...o,pauseDuration:o.pauseDuration+i}))}}},ei=[],Xl={toasts:[],pausedAt:void 0,settings:{toastLimit:cg}},rr={},Zl=(e,t=Do)=>{rr[t]=Yl(rr[t]||Xl,e),ei.forEach(([r,n])=>{r===t&&n(rr[t])})},Jl=e=>Object.keys(rr).forEach(t=>Zl(e,t)),ug=e=>Object.keys(rr).find(t=>rr[t].toasts.some(r=>r.id===e)),ti=(e=Do)=>t=>{Zl(t,e)},dg={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},fg=(e={},t=Do)=>{let[r,n]=h.useState(rr[t]||Xl),s=h.useRef(rr[t]);h.useEffect(()=>(s.current!==rr[t]&&n(rr[t]),ei.push([t,n]),()=>{let o=ei.findIndex(([a])=>a===t);o>-1&&ei.splice(o,1)}),[t]);let i=r.toasts.map(o=>{var a,c,d;return{...e,...e[o.type],...o,removeDelay:o.removeDelay||((a=e[o.type])==null?void 0:a.removeDelay)||(e==null?void 0:e.removeDelay),duration:o.duration||((c=e[o.type])==null?void 0:c.duration)||(e==null?void 0:e.duration)||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()}),rs=e=>(t,r)=>{let n=hg(t,e,r);return ti(n.toasterId||ug(n.id))({type:2,toast:n}),n.id},et=(e,t)=>rs("blank")(e,t);et.error=rs("error"),et.success=rs("success"),et.loading=rs("loading"),et.custom=rs("custom"),et.dismiss=(e,t)=>{let r={type:3,toastId:e};t?ti(t)(r):Jl(r)},et.dismissAll=e=>et.dismiss(void 0,e),et.remove=(e,t)=>{let r={type:4,toastId:e};t?ti(t)(r):Jl(r)},et.removeAll=e=>et.remove(void 0,e),et.promise=(e,t,r)=>{let n=et.loading(t.loading,{...r,...r==null?void 0:r.loading});return typeof e=="function"&&(e=e()),e.then(s=>{let i=t.success?Js(t.success,s):void 0;return i?et.success(i,{id:n,...r,...r==null?void 0:r.success}):et.dismiss(n),s}).catch(s=>{let i=t.error?Js(t.error,s):void 0;i?et.error(i,{id:n,...r,...r==null?void 0:r.error}):et.dismiss(n)}),e};var pg=1e3,gg=(e,t="default")=>{let{toasts:r,pausedAt:n}=fg(e,t),s=h.useRef(new Map).current,i=h.useCallback((f,g=pg)=>{if(s.has(f))return;let y=setTimeout(()=>{s.delete(f),o({type:4,toastId:f})},g);s.set(f,y)},[]);h.useEffect(()=>{if(n)return;let f=Date.now(),g=r.map(y=>{if(y.duration===1/0)return;let _=(y.duration||0)+y.pauseDuration-(f-y.createdAt);if(_<0){y.visible&&et.dismiss(y.id);return}return setTimeout(()=>et.dismiss(y.id,t),_)});return()=>{g.forEach(y=>y&&clearTimeout(y))}},[r,n,t]);let o=h.useCallback(ti(t),[t]),a=h.useCallback(()=>{o({type:5,time:Date.now()})},[o]),c=h.useCallback((f,g)=>{o({type:1,toast:{id:f,height:g}})},[o]),d=h.useCallback(()=>{n&&o({type:6,time:Date.now()})},[n,o]),u=h.useCallback((f,g)=>{let{reverseOrder:y=!1,gutter:_=8,defaultPosition:p}=g||{},v=r.filter(S=>(S.position||p)===(f.position||p)&&S.height),m=v.findIndex(S=>S.id===f.id),b=v.filter((S,w)=>w<m&&S.visible).length;return v.filter(S=>S.visible).slice(...y?[b+1]:[0,b]).reduce((S,w)=>S+(w.height||0)+_,0)},[r]);return h.useEffect(()=>{r.forEach(f=>{if(f.dismissed)i(f.id,f.removeDelay);else{let 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=pr`
1
+ (function(me,h){typeof exports=="object"&&typeof module<"u"?h(exports,require("react"),require("react-dom"),require("react/jsx-runtime")):typeof define=="function"&&define.amd?define(["exports","react","react-dom","react/jsx-runtime"],h):(me=typeof globalThis<"u"?globalThis:me||self,h(me.CollectionEditorReact={},me.React,me.ReactDOM,me.jsxRuntime))})(this,function(me,h,Pe,c){"use strict";var rO=Object.defineProperty;var vp=me=>{throw TypeError(me)};var nO=(me,h,Pe)=>h in me?rO(me,h,{enumerable:!0,configurable:!0,writable:!0,value:Pe}):me[h]=Pe;var Yo=(me,h,Pe)=>nO(me,typeof h!="symbol"?h+"":h,Pe),Ol=(me,h,Pe)=>h.has(me)||vp("Cannot "+Pe);var E=(me,h,Pe)=>(Ol(me,h,"read from private field"),Pe?Pe.call(me):h.get(me)),ie=(me,h,Pe)=>h.has(me)?vp("Cannot add the same private member more than once"):h instanceof WeakSet?h.add(me):h.set(me,Pe),Y=(me,h,Pe,c)=>(Ol(me,h,"write to private field"),c?c.call(me,Pe):h.set(me,Pe),Pe),Se=(me,h,Pe)=>(Ol(me,h,"access private method"),Pe);var gi=(me,h,Pe,c)=>({set _(mi){Y(me,h,mi,Pe)},get _(){return E(me,h,c)}});var nn,Pr,qn,lp,dr,on,cp,Un,Fr,zn,dp,an,up,Vn,sn,Hn,Qt,ln,st,Uo,cn,jt,bp,_r,fp,xt,Te,zo,Et,dn,Rn,br,Mr,Vo,Qn,Gn,un,fn,$r,Wn,xe,Zo,Al,Dl,Nl,kl,xl,Ll,Pl,wp,hp,Ho,ur,St,hn,fr,Vr,pp,wr,nr,Ro,gp,hr,mp,Xe,Br,jr,Kn,Yn,qr,Zn,Xn,yp;function mi(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 Ne=mi(h);var eo=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(){}},_p=(lp=class extends eo{constructor(){super();ie(this,nn);ie(this,Pr);ie(this,qn);Y(this,qn,t=>{if(typeof window<"u"&&window.addEventListener){const r=()=>t();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){E(this,Pr)||this.setEventListener(E(this,qn))}onUnsubscribe(){var t;this.hasListeners()||((t=E(this,Pr))==null||t.call(this),Y(this,Pr,void 0))}setEventListener(t){var r;Y(this,qn,t),(r=E(this,Pr))==null||r.call(this),Y(this,Pr,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){E(this,nn)!==t&&(Y(this,nn,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(r=>{r(t)})}isFocused(){var t;return typeof E(this,nn)=="boolean"?E(this,nn):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},nn=new WeakMap,Pr=new WeakMap,qn=new WeakMap,lp),yi=new _p,Tp={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Ep=(cp=class{constructor(){ie(this,dr,Tp);ie(this,on,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&E(this,on)&&e!==E(this,dr)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:E(this,dr),provider:e}),Y(this,dr,e),process.env.NODE_ENV!=="production"&&Y(this,on,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&Y(this,on,!0),E(this,dr).setTimeout(e,t)}clearTimeout(e){E(this,dr).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&Y(this,on,!0),E(this,dr).setInterval(e,t)}clearInterval(e){E(this,dr).clearInterval(e)}},dr=new WeakMap,on=new WeakMap,cp),Hr=new Ep;function Ip(e){setTimeout(e,0)}var Op=typeof window>"u"||"Deno"in globalThis;function At(){}function Ap(e,t){return typeof e=="function"?e(t):e}function vi(e){return typeof e=="number"&&e>=0&&e!==1/0}function Fl(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Tr(e,t){return typeof e=="function"?e(t):e}function Ft(e,t){return typeof e=="function"?e(t):e}function Ml(e,t){const{type:r="all",exact:n,fetchStatus:o,predicate:a,queryKey:i,stale:s}=e;if(i){if(n){if(t.queryHash!==bi(i,t.options))return!1}else if(!ro(t.queryKey,i))return!1}if(r!=="all"){const l=t.isActive();if(r==="active"&&!l||r==="inactive"&&l)return!1}return!(typeof s=="boolean"&&t.isStale()!==s||o&&o!==t.state.fetchStatus||a&&!a(t))}function $l(e,t){const{exact:r,status:n,predicate:o,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(r){if(to(t.options.mutationKey)!==to(a))return!1}else if(!ro(t.options.mutationKey,a))return!1}return!(n&&t.state.status!==n||o&&!o(t))}function bi(e,t){return((t==null?void 0:t.queryKeyHashFn)||to)(e)}function to(e){return JSON.stringify(e,(t,r)=>Si(r)?Object.keys(r).sort().reduce((n,o)=>(n[o]=r[o],n),{}):r)}function ro(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>ro(e[r],t[r])):!1}var Dp=Object.prototype.hasOwnProperty;function wi(e,t,r=0){if(e===t)return e;if(r>500)return t;const n=Bl(e)&&Bl(t);if(!n&&!(Si(e)&&Si(t)))return t;const a=(n?e:Object.keys(e)).length,i=n?t:Object.keys(t),s=i.length,l=n?new Array(s):{};let d=0;for(let f=0;f<s;f++){const u=n?f:i[f],m=e[u],g=t[u];if(m===g){l[u]=m,(n?f<a:Dp.call(e,u))&&d++;continue}if(m===null||g===null||typeof m!="object"||typeof g!="object"){l[u]=g;continue}const w=wi(m,g,r+1);l[u]=w,w===m&&d++}return a===s&&d===a?e:l}function Ci(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function Bl(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Si(e){if(!jl(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!jl(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function jl(e){return Object.prototype.toString.call(e)==="[object Object]"}function Np(e){return new Promise(t=>{Hr.setTimeout(t,e)})}function _i(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 wi(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 wi(e,t)}return t}function kp(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function xp(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var Xo=Symbol();function ql(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Xo&&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===Xo?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Ul(e,t){return typeof e=="function"?e(...t):!!e}function Lp(e,t,r){let n=!1,o;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(o??(o=t()),n||(n=!0,o.aborted?r():o.addEventListener("abort",r,{once:!0})),o)}),e}var no=(()=>{let e=()=>Op;return{isServer(){return e()},setIsServer(t){e=t}}})();function Ti(){let e,t;const r=new Promise((o,a)=>{e=o,t=a});r.status="pending",r.catch(()=>{});function n(o){Object.assign(r,o),delete r.resolve,delete r.reject}return r.resolve=o=>{n({status:"fulfilled",value:o}),e(o)},r.reject=o=>{n({status:"rejected",reason:o}),t(o)},r}var Pp=Ip;function Fp(){let e=[],t=0,r=s=>{s()},n=s=>{s()},o=Pp;const a=s=>{t?e.push(s):o(()=>{r(s)})},i=()=>{const s=e;e=[],s.length&&o(()=>{n(()=>{s.forEach(l=>{r(l)})})})};return{batch:s=>{let l;t++;try{l=s()}finally{t--,t||i()}return l},batchCalls:s=>(...l)=>{a(()=>{s(...l)})},schedule:a,setNotifyFunction:s=>{r=s},setBatchNotifyFunction:s=>{n=s},setScheduler:s=>{o=s}}}var dt=Fp(),Mp=(dp=class extends eo{constructor(){super();ie(this,Un,!0);ie(this,Fr);ie(this,zn);Y(this,zn,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,Fr)||this.setEventListener(E(this,zn))}onUnsubscribe(){var t;this.hasListeners()||((t=E(this,Fr))==null||t.call(this),Y(this,Fr,void 0))}setEventListener(t){var r;Y(this,zn,t),(r=E(this,Fr))==null||r.call(this),Y(this,Fr,t(this.setOnline.bind(this)))}setOnline(t){E(this,Un)!==t&&(Y(this,Un,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return E(this,Un)}},Un=new WeakMap,Fr=new WeakMap,zn=new WeakMap,dp),Jo=new Mp;function $p(e){return Math.min(1e3*2**e,3e4)}function zl(e){return(e??"online")==="online"?Jo.isOnline():!0}var Ei=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Vl(e){let t=!1,r=0,n;const o=Ti(),a=()=>o.status!=="pending",i=p=>{var y;if(!a()){const v=new Ei(p);m(v),(y=e.onCancel)==null||y.call(e,v)}},s=()=>{t=!0},l=()=>{t=!1},d=()=>yi.isFocused()&&(e.networkMode==="always"||Jo.isOnline())&&e.canRun(),f=()=>zl(e.networkMode)&&e.canRun(),u=p=>{a()||(n==null||n(),o.resolve(p))},m=p=>{a()||(n==null||n(),o.reject(p))},g=()=>new Promise(p=>{var y;n=v=>{(a()||d())&&p(v)},(y=e.onPause)==null||y.call(e)}).then(()=>{var p;n=void 0,a()||(p=e.onContinue)==null||p.call(e)}),w=()=>{if(a())return;let p;const y=r===0?e.initialPromise:void 0;try{p=y??e.fn()}catch(v){p=Promise.reject(v)}Promise.resolve(p).then(u).catch(v=>{var I;if(a())return;const b=e.retry??(no.isServer()?0:3),C=e.retryDelay??$p,S=typeof C=="function"?C(r,v):C,T=b===!0||typeof b=="number"&&r<b||typeof b=="function"&&b(r,v);if(t||!T){m(v);return}r++,(I=e.onFail)==null||I.call(e,r,v),Np(S).then(()=>d()?void 0:g()).then(()=>{t?m(v):w()})})};return{promise:o,status:()=>o.status,cancel:i,continue:()=>(n==null||n(),o),cancelRetry:s,continueRetry:l,canStart:f,start:()=>(f()?w():g().then(w),o)}}var Hl=(up=class{constructor(){ie(this,an)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),vi(this.gcTime)&&Y(this,an,Hr.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(no.isServer()?1/0:5*60*1e3))}clearGcTimeout(){E(this,an)!==void 0&&(Hr.clearTimeout(E(this,an)),Y(this,an,void 0))}},an=new WeakMap,up);function Bp(e){return{onFetch:(t,r)=>{var f,u,m,g,w;const n=t.options,o=(m=(u=(f=t.fetchOptions)==null?void 0:f.meta)==null?void 0:u.fetchMore)==null?void 0:m.direction,a=((g=t.state.data)==null?void 0:g.pages)||[],i=((w=t.state.data)==null?void 0:w.pageParams)||[];let s={pages:[],pageParams:[]},l=0;const d=async()=>{let p=!1;const y=C=>{Lp(C,()=>t.signal,()=>p=!0)},v=ql(t.options,t.fetchOptions),b=async(C,S,T)=>{if(p)return Promise.reject(t.signal.reason);if(S==null&&C.pages.length)return Promise.resolve(C);const k=(()=>{const N={client:t.client,queryKey:t.queryKey,pageParam:S,direction:T?"backward":"forward",meta:t.options.meta};return y(N),N})(),x=await v(k),{maxPages:$}=t.options,j=T?xp:kp;return{pages:j(C.pages,x,$),pageParams:j(C.pageParams,S,$)}};if(o&&a.length){const C=o==="backward",S=C?jp:Rl,T={pages:a,pageParams:i},I=S(n,T);s=await b(T,I,C)}else{const C=e??a.length;do{const S=l===0?i[0]??n.initialPageParam:Rl(n,s);if(l>0&&S==null)break;s=await b(s,S),l++}while(l<C)}return s};t.options.persister?t.fetchFn=()=>{var p,y;return(y=(p=t.options).persister)==null?void 0:y.call(p,d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r)}:t.fetchFn=d}}}function Rl(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 qp=(fp=class extends Hl{constructor(t){super();ie(this,jt);ie(this,Vn);ie(this,sn);ie(this,Hn);ie(this,Qt);ie(this,ln);ie(this,st);ie(this,Uo);ie(this,cn);Y(this,cn,!1),Y(this,Uo,t.defaultOptions),this.setOptions(t.options),this.observers=[],Y(this,ln,t.client),Y(this,Qt,E(this,ln).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Y(this,sn,Wl(this.options)),this.state=t.state??E(this,sn),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return E(this,Vn)}get promise(){var t;return(t=E(this,st))==null?void 0:t.promise}setOptions(t){if(this.options={...E(this,Uo),...t},t!=null&&t._type&&Y(this,Vn,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=Wl(this.options);r.data!==void 0&&(this.setState(Gl(r.data,r.dataUpdatedAt)),Y(this,sn,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&E(this,Qt).remove(this)}setData(t,r){const n=_i(this.state.data,t,this.options);return Se(this,jt,_r).call(this,{data:n,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),n}setState(t){Se(this,jt,_r).call(this,{type:"setState",state:t})}cancel(t){var n,o;const r=(n=E(this,st))==null?void 0:n.promise;return(o=E(this,st))==null||o.cancel(t),r?r.then(At).catch(At):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return E(this,sn)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>Ft(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Xo||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Tr(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:!Fl(this.state.dataUpdatedAt,t)}onFocus(){var r;const t=this.observers.find(n=>n.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(r=E(this,st))==null||r.continue()}onOnline(){var r;const t=this.observers.find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(r=E(this,st))==null||r.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),E(this,Qt).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(E(this,st)&&(E(this,cn)||Se(this,jt,bp).call(this)?E(this,st).cancel({revert:!0}):E(this,st).cancelRetry()),this.scheduleGc()),E(this,Qt).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Se(this,jt,_r).call(this,{type:"invalidate"})}async fetch(t,r){var d,f,u,m,g,w,p,y,v,b,C;if(this.state.fetchStatus!=="idle"&&((d=E(this,st))==null?void 0:d.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(E(this,st))return E(this,st).continueRetry(),E(this,st).promise}if(t&&this.setOptions(t),!this.options.queryFn){const S=this.observers.find(T=>T.options.queryFn);S&&this.setOptions(S.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,o=S=>{Object.defineProperty(S,"signal",{enumerable:!0,get:()=>(Y(this,cn,!0),n.signal)})},a=()=>{const S=ql(this.options,r),I=(()=>{const k={client:E(this,ln),queryKey:this.queryKey,meta:this.meta};return o(k),k})();return Y(this,cn,!1),this.options.persister?this.options.persister(S,I,this):S(I)},s=(()=>{const S={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:E(this,ln),state:this.state,fetchFn:a};return o(S),S})(),l=E(this,Vn)==="infinite"?Bp(this.options.pages):this.options.behavior;l==null||l.onFetch(s,this),Y(this,Hn,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((f=s.fetchOptions)==null?void 0:f.meta))&&Se(this,jt,_r).call(this,{type:"fetch",meta:(u=s.fetchOptions)==null?void 0:u.meta}),Y(this,st,Vl({initialPromise:r==null?void 0:r.initialPromise,fn:s.fetchFn,onCancel:S=>{S instanceof Ei&&S.revert&&this.setState({...E(this,Hn),fetchStatus:"idle"}),n.abort()},onFail:(S,T)=>{Se(this,jt,_r).call(this,{type:"failed",failureCount:S,error:T})},onPause:()=>{Se(this,jt,_r).call(this,{type:"pause"})},onContinue:()=>{Se(this,jt,_r).call(this,{type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0}));try{const S=await E(this,st).start();if(S===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(S),(g=(m=E(this,Qt).config).onSuccess)==null||g.call(m,S,this),(p=(w=E(this,Qt).config).onSettled)==null||p.call(w,S,this.state.error,this),S}catch(S){if(S instanceof Ei){if(S.silent)return E(this,st).promise;if(S.revert){if(this.state.data===void 0)throw S;return this.state.data}}throw Se(this,jt,_r).call(this,{type:"error",error:S}),(v=(y=E(this,Qt).config).onError)==null||v.call(y,S,this),(C=(b=E(this,Qt).config).onSettled)==null||C.call(b,this.state.data,S,this),S}finally{this.scheduleGc()}}},Vn=new WeakMap,sn=new WeakMap,Hn=new WeakMap,Qt=new WeakMap,ln=new WeakMap,st=new WeakMap,Uo=new WeakMap,cn=new WeakMap,jt=new WeakSet,bp=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},_r=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,...Ql(n.data,this.options),fetchMeta:t.meta??null};case"success":const o={...n,...Gl(t.data,t.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Y(this,Hn,t.manual?o:void 0),o;case"error":const a=t.error;return{...n,error:a,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...t.state}}};this.state=r(this.state),dt.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),E(this,Qt).notify({query:this,type:"updated",action:t})})},fp);function Ql(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:zl(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Gl(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Wl(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 Up=(hp=class extends eo{constructor(t,r){super();ie(this,xe);ie(this,xt);ie(this,Te);ie(this,zo);ie(this,Et);ie(this,dn);ie(this,Rn);ie(this,br);ie(this,Mr);ie(this,Vo);ie(this,Qn);ie(this,Gn);ie(this,un);ie(this,fn);ie(this,$r);ie(this,Wn,new Set);this.options=r,Y(this,xt,t),Y(this,Mr,null),Y(this,br,Ti()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(E(this,Te).addObserver(this),Kl(E(this,Te),this.options)?Se(this,xe,Zo).call(this):this.updateResult(),Se(this,xe,kl).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Ii(E(this,Te),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ii(E(this,Te),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Se(this,xe,xl).call(this),Se(this,xe,Ll).call(this),E(this,Te).removeObserver(this)}setOptions(t){const r=this.options,n=E(this,Te);if(this.options=E(this,xt).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Ft(this.options.enabled,E(this,Te))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Se(this,xe,Pl).call(this),E(this,Te).setOptions(this.options),r._defaulted&&!Ci(this.options,r)&&E(this,xt).getQueryCache().notify({type:"observerOptionsUpdated",query:E(this,Te),observer:this});const o=this.hasListeners();o&&Yl(E(this,Te),n,this.options,r)&&Se(this,xe,Zo).call(this),this.updateResult(),o&&(E(this,Te)!==n||Ft(this.options.enabled,E(this,Te))!==Ft(r.enabled,E(this,Te))||Tr(this.options.staleTime,E(this,Te))!==Tr(r.staleTime,E(this,Te)))&&Se(this,xe,Al).call(this);const a=Se(this,xe,Dl).call(this);o&&(E(this,Te)!==n||Ft(this.options.enabled,E(this,Te))!==Ft(r.enabled,E(this,Te))||a!==E(this,$r))&&Se(this,xe,Nl).call(this,a)}getOptimisticResult(t){const r=E(this,xt).getQueryCache().build(E(this,xt),t),n=this.createResult(r,t);return Vp(this,n)&&(Y(this,Et,n),Y(this,Rn,this.options),Y(this,dn,E(this,Te).state)),n}getCurrentResult(){return E(this,Et)}trackResult(t,r){return new Proxy(t,{get:(n,o)=>(this.trackProp(o),r==null||r(o),o==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&E(this,br).status==="pending"&&E(this,br).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,o))})}trackProp(t){E(this,Wn).add(t)}getCurrentQuery(){return E(this,Te)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const r=E(this,xt).defaultQueryOptions(t),n=E(this,xt).getQueryCache().build(E(this,xt),r);return n.fetch().then(()=>this.createResult(n,r))}fetch(t){return Se(this,xe,Zo).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),E(this,Et)))}createResult(t,r){var $;const n=E(this,Te),o=this.options,a=E(this,Et),i=E(this,dn),s=E(this,Rn),d=t!==n?t.state:E(this,zo),{state:f}=t;let u={...f},m=!1,g;if(r._optimisticResults){const j=this.hasListeners(),N=!j&&Kl(t,r),L=j&&Yl(t,n,r,o);(N||L)&&(u={...u,...Ql(f.data,t.options)}),r._optimisticResults==="isRestoring"&&(u.fetchStatus="idle")}let{error:w,errorUpdatedAt:p,status:y}=u;g=u.data;let v=!1;if(r.placeholderData!==void 0&&g===void 0&&y==="pending"){let j;a!=null&&a.isPlaceholderData&&r.placeholderData===(s==null?void 0:s.placeholderData)?(j=a.data,v=!0):j=typeof r.placeholderData=="function"?r.placeholderData(($=E(this,Gn))==null?void 0:$.state.data,E(this,Gn)):r.placeholderData,j!==void 0&&(y="success",g=_i(a==null?void 0:a.data,j,r),m=!0)}if(r.select&&g!==void 0&&!v)if(a&&g===(i==null?void 0:i.data)&&r.select===E(this,Vo))g=E(this,Qn);else try{Y(this,Vo,r.select),g=r.select(g),g=_i(a==null?void 0:a.data,g,r),Y(this,Qn,g),Y(this,Mr,null)}catch(j){Y(this,Mr,j)}E(this,Mr)&&(w=E(this,Mr),g=E(this,Qn),p=Date.now(),y="error");const b=u.fetchStatus==="fetching",C=y==="pending",S=y==="error",T=C&&b,I=g!==void 0,x={status:y,fetchStatus:u.fetchStatus,isPending:C,isSuccess:y==="success",isError:S,isInitialLoading:T,isLoading:T,data:g,dataUpdatedAt:u.dataUpdatedAt,error:w,errorUpdatedAt:p,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:u.dataUpdateCount>d.dataUpdateCount||u.errorUpdateCount>d.errorUpdateCount,isFetching:b,isRefetching:b&&!C,isLoadingError:S&&!I,isPaused:u.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:S&&I,isStale:Oi(t,r),refetch:this.refetch,promise:E(this,br),isEnabled:Ft(r.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const j=x.data!==void 0,N=x.status==="error"&&!j,L=F=>{N?F.reject(x.error):j&&F.resolve(x.data)},B=()=>{const F=Y(this,br,x.promise=Ti());L(F)},P=E(this,br);switch(P.status){case"pending":t.queryHash===n.queryHash&&L(P);break;case"fulfilled":(N||x.data!==P.value)&&B();break;case"rejected":(!N||x.error!==P.reason)&&B();break}}return x}updateResult(){const t=E(this,Et),r=this.createResult(E(this,Te),this.options);if(Y(this,dn,E(this,Te).state),Y(this,Rn,this.options),E(this,dn).data!==void 0&&Y(this,Gn,E(this,Te)),Ci(r,t))return;Y(this,Et,r);const n=()=>{if(!t)return!0;const{notifyOnChangeProps:o}=this.options,a=typeof o=="function"?o():o;if(a==="all"||!a&&!E(this,Wn).size)return!0;const i=new Set(a??E(this,Wn));return this.options.throwOnError&&i.add("error"),Object.keys(E(this,Et)).some(s=>{const l=s;return E(this,Et)[l]!==t[l]&&i.has(l)})};Se(this,xe,wp).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Se(this,xe,kl).call(this)}},xt=new WeakMap,Te=new WeakMap,zo=new WeakMap,Et=new WeakMap,dn=new WeakMap,Rn=new WeakMap,br=new WeakMap,Mr=new WeakMap,Vo=new WeakMap,Qn=new WeakMap,Gn=new WeakMap,un=new WeakMap,fn=new WeakMap,$r=new WeakMap,Wn=new WeakMap,xe=new WeakSet,Zo=function(t){Se(this,xe,Pl).call(this);let r=E(this,Te).fetch(this.options,t);return t!=null&&t.throwOnError||(r=r.catch(At)),r},Al=function(){Se(this,xe,xl).call(this);const t=Tr(this.options.staleTime,E(this,Te));if(no.isServer()||E(this,Et).isStale||!vi(t))return;const n=Fl(E(this,Et).dataUpdatedAt,t)+1;Y(this,un,Hr.setTimeout(()=>{E(this,Et).isStale||this.updateResult()},n))},Dl=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(E(this,Te)):this.options.refetchInterval)??!1},Nl=function(t){Se(this,xe,Ll).call(this),Y(this,$r,t),!(no.isServer()||Ft(this.options.enabled,E(this,Te))===!1||!vi(E(this,$r))||E(this,$r)===0)&&Y(this,fn,Hr.setInterval(()=>{(this.options.refetchIntervalInBackground||yi.isFocused())&&Se(this,xe,Zo).call(this)},E(this,$r)))},kl=function(){Se(this,xe,Al).call(this),Se(this,xe,Nl).call(this,Se(this,xe,Dl).call(this))},xl=function(){E(this,un)!==void 0&&(Hr.clearTimeout(E(this,un)),Y(this,un,void 0))},Ll=function(){E(this,fn)!==void 0&&(Hr.clearInterval(E(this,fn)),Y(this,fn,void 0))},Pl=function(){const t=E(this,xt).getQueryCache().build(E(this,xt),this.options);if(t===E(this,Te))return;const r=E(this,Te);Y(this,Te,t),Y(this,zo,t.state),this.hasListeners()&&(r==null||r.removeObserver(this),t.addObserver(this))},wp=function(t){dt.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(E(this,Et))}),E(this,xt).getQueryCache().notify({query:E(this,Te),type:"observerResultsUpdated"})})},hp);function zp(e,t){return Ft(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&Ft(t.retryOnMount,e)===!1)}function Kl(e,t){return zp(e,t)||e.state.data!==void 0&&Ii(e,t,t.refetchOnMount)}function Ii(e,t,r){if(Ft(t.enabled,e)!==!1&&Tr(t.staleTime,e)!=="static"){const n=typeof r=="function"?r(e):r;return n==="always"||n!==!1&&Oi(e,t)}return!1}function Yl(e,t,r,n){return(e!==t||Ft(n.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&Oi(e,r)}function Oi(e,t){return Ft(t.enabled,e)!==!1&&e.isStaleByTime(Tr(t.staleTime,e))}function Vp(e,t){return!Ci(e.getCurrentResult(),t)}var Hp=(pp=class extends Hl{constructor(t){super();ie(this,fr);ie(this,Ho);ie(this,ur);ie(this,St);ie(this,hn);Y(this,Ho,t.client),this.mutationId=t.mutationId,Y(this,St,t.mutationCache),Y(this,ur,[]),this.state=t.state||Rp(),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,ur).includes(t)||(E(this,ur).push(t),this.clearGcTimeout(),E(this,St).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Y(this,ur,E(this,ur).filter(r=>r!==t)),this.scheduleGc(),E(this,St).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){E(this,ur).length||(this.state.status==="pending"?this.scheduleGc():E(this,St).remove(this))}continue(){var t;return((t=E(this,hn))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var i,s,l,d,f,u,m,g,w,p,y,v,b,C,S,T,I,k;const r=()=>{Se(this,fr,Vr).call(this,{type:"continue"})},n={client:E(this,Ho),meta:this.options.meta,mutationKey:this.options.mutationKey};Y(this,hn,Vl({fn:()=>this.options.mutationFn?this.options.mutationFn(t,n):Promise.reject(new Error("No mutationFn found")),onFail:(x,$)=>{Se(this,fr,Vr).call(this,{type:"failed",failureCount:x,error:$})},onPause:()=>{Se(this,fr,Vr).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>E(this,St).canRun(this)}));const o=this.state.status==="pending",a=!E(this,hn).canStart();try{if(o)r();else{Se(this,fr,Vr).call(this,{type:"pending",variables:t,isPaused:a}),E(this,St).config.onMutate&&await E(this,St).config.onMutate(t,this,n);const $=await((s=(i=this.options).onMutate)==null?void 0:s.call(i,t,n));$!==this.state.context&&Se(this,fr,Vr).call(this,{type:"pending",context:$,variables:t,isPaused:a})}const x=await E(this,hn).start();return await((d=(l=E(this,St).config).onSuccess)==null?void 0:d.call(l,x,t,this.state.context,this,n)),await((u=(f=this.options).onSuccess)==null?void 0:u.call(f,x,t,this.state.context,n)),await((g=(m=E(this,St).config).onSettled)==null?void 0:g.call(m,x,null,this.state.variables,this.state.context,this,n)),await((p=(w=this.options).onSettled)==null?void 0:p.call(w,x,null,t,this.state.context,n)),Se(this,fr,Vr).call(this,{type:"success",data:x}),x}catch(x){try{await((v=(y=E(this,St).config).onError)==null?void 0:v.call(y,x,t,this.state.context,this,n))}catch($){Promise.reject($)}try{await((C=(b=this.options).onError)==null?void 0:C.call(b,x,t,this.state.context,n))}catch($){Promise.reject($)}try{await((T=(S=E(this,St).config).onSettled)==null?void 0:T.call(S,void 0,x,this.state.variables,this.state.context,this,n))}catch($){Promise.reject($)}try{await((k=(I=this.options).onSettled)==null?void 0:k.call(I,void 0,x,t,this.state.context,n))}catch($){Promise.reject($)}throw Se(this,fr,Vr).call(this,{type:"error",error:x}),x}finally{E(this,St).runNext(this)}}},Ho=new WeakMap,ur=new WeakMap,St=new WeakMap,hn=new WeakMap,fr=new WeakSet,Vr=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),dt.batch(()=>{E(this,ur).forEach(n=>{n.onMutationUpdate(t)}),E(this,St).notify({mutation:this,type:"updated",action:t})})},pp);function Rp(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Qp=(gp=class extends eo{constructor(t={}){super();ie(this,wr);ie(this,nr);ie(this,Ro);this.config=t,Y(this,wr,new Set),Y(this,nr,new Map),Y(this,Ro,0)}build(t,r,n){const o=new Hp({client:t,mutationCache:this,mutationId:++gi(this,Ro)._,options:t.defaultMutationOptions(r),state:n});return this.add(o),o}add(t){E(this,wr).add(t);const r=ea(t);if(typeof r=="string"){const n=E(this,nr).get(r);n?n.push(t):E(this,nr).set(r,[t])}this.notify({type:"added",mutation:t})}remove(t){if(E(this,wr).delete(t)){const r=ea(t);if(typeof r=="string"){const n=E(this,nr).get(r);if(n)if(n.length>1){const o=n.indexOf(t);o!==-1&&n.splice(o,1)}else n[0]===t&&E(this,nr).delete(r)}}this.notify({type:"removed",mutation:t})}canRun(t){const r=ea(t);if(typeof r=="string"){const n=E(this,nr).get(r),o=n==null?void 0:n.find(a=>a.state.status==="pending");return!o||o===t}else return!0}runNext(t){var n;const r=ea(t);if(typeof r=="string"){const o=(n=E(this,nr).get(r))==null?void 0:n.find(a=>a!==t&&a.state.isPaused);return(o==null?void 0:o.continue())??Promise.resolve()}else return Promise.resolve()}clear(){dt.batch(()=>{E(this,wr).forEach(t=>{this.notify({type:"removed",mutation:t})}),E(this,wr).clear(),E(this,nr).clear()})}getAll(){return Array.from(E(this,wr))}find(t){const r={exact:!0,...t};return this.getAll().find(n=>$l(r,n))}findAll(t={}){return this.getAll().filter(r=>$l(t,r))}notify(t){dt.batch(()=>{this.listeners.forEach(r=>{r(t)})})}resumePausedMutations(){const t=this.getAll().filter(r=>r.state.isPaused);return dt.batch(()=>Promise.all(t.map(r=>r.continue().catch(At))))}},wr=new WeakMap,nr=new WeakMap,Ro=new WeakMap,gp);function ea(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Gp=(mp=class extends eo{constructor(t={}){super();ie(this,hr);this.config=t,Y(this,hr,new Map)}build(t,r,n){const o=r.queryKey,a=r.queryHash??bi(o,r);let i=this.get(a);return i||(i=new qp({client:t,queryKey:o,queryHash:a,options:t.defaultQueryOptions(r),state:n,defaultOptions:t.getQueryDefaults(o)}),this.add(i)),i}add(t){E(this,hr).has(t.queryHash)||(E(this,hr).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const r=E(this,hr).get(t.queryHash);r&&(t.destroy(),r===t&&E(this,hr).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){dt.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return E(this,hr).get(t)}getAll(){return[...E(this,hr).values()]}find(t){const r={exact:!0,...t};return this.getAll().find(n=>Ml(r,n))}findAll(t={}){const r=this.getAll();return Object.keys(t).length>0?r.filter(n=>Ml(t,n)):r}notify(t){dt.batch(()=>{this.listeners.forEach(r=>{r(t)})})}onFocus(){dt.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){dt.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},hr=new WeakMap,mp),Wp=(yp=class{constructor(e={}){ie(this,Xe);ie(this,Br);ie(this,jr);ie(this,Kn);ie(this,Yn);ie(this,qr);ie(this,Zn);ie(this,Xn);Y(this,Xe,e.queryCache||new Gp),Y(this,Br,e.mutationCache||new Qp),Y(this,jr,e.defaultOptions||{}),Y(this,Kn,new Map),Y(this,Yn,new Map),Y(this,qr,0)}mount(){gi(this,qr)._++,E(this,qr)===1&&(Y(this,Zn,yi.subscribe(async e=>{e&&(await this.resumePausedMutations(),E(this,Xe).onFocus())})),Y(this,Xn,Jo.subscribe(async e=>{e&&(await this.resumePausedMutations(),E(this,Xe).onOnline())})))}unmount(){var e,t;gi(this,qr)._--,E(this,qr)===0&&((e=E(this,Zn))==null||e.call(this),Y(this,Zn,void 0),(t=E(this,Xn))==null||t.call(this),Y(this,Xn,void 0))}isFetching(e){return E(this,Xe).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return E(this,Br).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=E(this,Xe).get(t.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=E(this,Xe).build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(Tr(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return E(this,Xe).findAll(e).map(({queryKey:t,state:r})=>{const n=r.data;return[t,n]})}setQueryData(e,t,r){const n=this.defaultQueryOptions({queryKey:e}),o=E(this,Xe).get(n.queryHash),a=o==null?void 0:o.state.data,i=Ap(t,a);if(i!==void 0)return E(this,Xe).build(this,n).setData(i,{...r,manual:!0})}setQueriesData(e,t,r){return dt.batch(()=>E(this,Xe).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,Xe).get(t.queryHash))==null?void 0:r.state}removeQueries(e){const t=E(this,Xe);dt.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=E(this,Xe);return dt.batch(()=>(r.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=dt.batch(()=>E(this,Xe).findAll(e).map(o=>o.cancel(r)));return Promise.all(n).then(At).catch(At)}invalidateQueries(e,t={}){return dt.batch(()=>(E(this,Xe).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=dt.batch(()=>E(this,Xe).findAll(e).filter(o=>!o.isDisabled()&&!o.isStatic()).map(o=>{let a=o.fetch(void 0,r);return r.throwOnError||(a=a.catch(At)),o.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(n).then(At)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=E(this,Xe).build(this,t);return r.isStaleByTime(Tr(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(At).catch(At)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(At).catch(At)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return Jo.isOnline()?E(this,Br).resumePausedMutations():Promise.resolve()}getQueryCache(){return E(this,Xe)}getMutationCache(){return E(this,Br)}getDefaultOptions(){return E(this,jr)}setDefaultOptions(e){Y(this,jr,e)}setQueryDefaults(e,t){E(this,Kn).set(to(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...E(this,Kn).values()],r={};return t.forEach(n=>{ro(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){E(this,Yn).set(to(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...E(this,Yn).values()],r={};return t.forEach(n=>{ro(e,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...E(this,jr).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=bi(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===Xo&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...E(this,jr).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){E(this,Xe).clear(),E(this,Br).clear()}},Xe=new WeakMap,Br=new WeakMap,jr=new WeakMap,Kn=new WeakMap,Yn=new WeakMap,qr=new WeakMap,Zn=new WeakMap,Xn=new WeakMap,yp),Zl=Ne.createContext(void 0),Kp=e=>{const t=Ne.useContext(Zl);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Yp=({client:e,children:t})=>(Ne.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),c.jsx(Zl.Provider,{value:e,children:t})),Xl=Ne.createContext(!1),Zp=()=>Ne.useContext(Xl);Xl.Provider;function Xp(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Jp=Ne.createContext(Xp()),eg=()=>Ne.useContext(Jp),tg=(e,t,r)=>{const n=r!=null&&r.state.error&&typeof e.throwOnError=="function"?Ul(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||n)&&(t.isReset()||(e.retryOnMount=!1))},rg=e=>{Ne.useEffect(()=>{e.clearReset()},[e])},ng=({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(o&&e.data===void 0||Ul(r,[e.error,n])),og=e=>{if(e.suspense){const r=o=>o==="static"?o:Math.max(o??1e3,1e3),n=e.staleTime;e.staleTime=typeof n=="function"?(...o)=>r(n(...o)):r(n),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},ag=(e,t)=>e.isLoading&&e.isFetching&&!t,ig=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Jl=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function sg(e,t,r){var g,w,p,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(),o=eg(),a=Kp(),i=a.defaultQueryOptions(e);(w=(g=a.getDefaultOptions().queries)==null?void 0:g._experimental_beforeQuery)==null||w.call(g,i);const s=a.getQueryCache().get(i.queryHash);process.env.NODE_ENV!=="production"&&(i.queryFn||console.error(`[${i.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 l=e.subscribed!==!1;i._optimisticResults=n?"isRestoring":l?"optimistic":void 0,og(i),tg(i,o,s),rg(o);const d=!a.getQueryCache().get(i.queryHash),[f]=Ne.useState(()=>new t(a,i)),u=f.getOptimisticResult(i),m=!n&&l;if(Ne.useSyncExternalStore(Ne.useCallback(v=>{const b=m?f.subscribe(dt.batchCalls(v)):At;return f.updateResult(),b},[f,m]),()=>f.getCurrentResult(),()=>f.getCurrentResult()),Ne.useEffect(()=>{f.setOptions(i)},[i,f]),ig(i,u))throw Jl(i,f,o);if(ng({result:u,errorResetBoundary:o,throwOnError:i.throwOnError,query:s,suspense:i.suspense}))throw u.error;if((y=(p=a.getDefaultOptions().queries)==null?void 0:p._experimental_afterQuery)==null||y.call(p,i,u),i.experimental_prefetchInRender&&!no.isServer()&&ag(u,n)){const v=d?Jl(i,f,o):s==null?void 0:s.promise;v==null||v.catch(At).finally(()=>{f.updateResult()})}return i.notifyOnChangeProps?u:f.trackResult(u)}function gn(e,t){return sg(e,Up)}let lg={data:""},cg=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||lg},dg=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,ug=/\/\*[^]*?\*\/| +/g,ec=/\n+/g,Er=(e,t)=>{let r="",n="",o="";for(let a in e){let i=e[a];a[0]=="@"?a[1]=="i"?r=a+" "+i+";":n+=a[1]=="f"?Er(i,a):a+"{"+Er(i,a[1]=="k"?"":t)+"}":typeof i=="object"?n+=Er(i,t?t.replace(/([^,])+/g,s=>a.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,l=>/&/.test(l)?l.replace(/&/g,s):s?s+" "+l:l)):a):i!=null&&(a=a[1]=="-"?a:a.replace(/[A-Z]/g,"-$&").toLowerCase(),o+=Er.p?Er.p(a,i):a+":"+i+";")}return r+(t&&o?t+"{"+o+"}":o)+n},Ir={},tc=e=>{if(typeof e=="object"){let t="";for(let r in e)t+=r+tc(e[r]);return t}return e},fg=(e,t,r,n,o)=>{let a=tc(e),i=Ir[a]||(Ir[a]=(l=>{let d=0,f=11;for(;d<l.length;)f=101*f+l.charCodeAt(d++)>>>0;return"go"+f})(a));if(!Ir[i]){let l=a!==e?e:(d=>{let f,u,m=[{}];for(;f=dg.exec(d.replace(ug,""));)f[4]?m.shift():f[3]?(u=f[3].replace(ec," ").trim(),m.unshift(m[0][u]=m[0][u]||{})):m[0][f[1]]=f[2].replace(ec," ").trim();return m[0]})(e);Ir[i]=Er(o?{["@keyframes "+i]:l}:l,r?"":"."+i)}let s=r&&Ir.g;return r&&(Ir.g=Ir[i]),((l,d,f,u)=>{u?d.data=d.data.replace(u,l):d.data.indexOf(l)===-1&&(d.data=f?l+d.data:d.data+l)})(Ir[i],t,n,s),i},hg=(e,t,r)=>e.reduce((n,o,a)=>{let i=t[a];if(i&&i.call){let s=i(r),l=s&&s.props&&s.props.className||/^go/.test(s)&&s;i=l?"."+l:s&&typeof s=="object"?s.props?"":Er(s,""):s===!1?"":s}return n+o+(i??"")},"");function ta(e){let t=this||{},r=e.call?e(t.p):e;return fg(r.unshift?r.raw?hg(r,[].slice.call(arguments,1),t.p):r.reduce((n,o)=>Object.assign(n,o&&o.call?o(t.p):o),{}):r,cg(t.target),t.g,t.o,t.k)}let rc,Ai,Di;ta.bind({g:1});let mr=ta.bind({k:1});function pg(e,t,r,n){Er.p=t,rc=e,Ai=r,Di=n}function Or(e,t){let r=this||{};return function(){let n=arguments;function o(a,i){let s=Object.assign({},a),l=s.className||o.className;r.p=Object.assign({theme:Ai&&Ai()},s),r.o=/go\d/.test(l),s.className=ta.apply(r,n)+(l?" "+l:"");let d=e;return e[0]&&(d=s.as||e,delete s.as),Di&&d[0]&&Di(s),rc(d,s)}return o}}var gg=e=>typeof e=="function",ra=(e,t)=>gg(e)?e(t):e,mg=(()=>{let e=0;return()=>(++e).toString()})(),nc=(()=>{let e;return()=>{if(e===void 0&&typeof window<"u"){let t=matchMedia("(prefers-reduced-motion: reduce)");e=!t||t.matches}return e}})(),yg=20,Ni="default",oc=(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(i=>i.id===t.toast.id?{...i,...t.toast}:i)};case 2:let{toast:n}=t;return oc(e,{type:e.toasts.find(i=>i.id===n.id)?1:0,toast:n});case 3:let{toastId:o}=t;return{...e,toasts:e.toasts.map(i=>i.id===o||o===void 0?{...i,dismissed:!0,visible:!1}:i)};case 4:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(i=>i.id!==t.toastId)};case 5:return{...e,pausedAt:t.time};case 6:let a=t.time-(e.pausedAt||0);return{...e,pausedAt:void 0,toasts:e.toasts.map(i=>({...i,pauseDuration:i.pauseDuration+a}))}}},na=[],ac={toasts:[],pausedAt:void 0,settings:{toastLimit:yg}},ar={},ic=(e,t=Ni)=>{ar[t]=oc(ar[t]||ac,e),na.forEach(([r,n])=>{r===t&&n(ar[t])})},sc=e=>Object.keys(ar).forEach(t=>ic(e,t)),vg=e=>Object.keys(ar).find(t=>ar[t].toasts.some(r=>r.id===e)),oa=(e=Ni)=>t=>{ic(t,e)},bg={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},wg=(e={},t=Ni)=>{let[r,n]=h.useState(ar[t]||ac),o=h.useRef(ar[t]);h.useEffect(()=>(o.current!==ar[t]&&n(ar[t]),na.push([t,n]),()=>{let i=na.findIndex(([s])=>s===t);i>-1&&na.splice(i,1)}),[t]);let a=r.toasts.map(i=>{var s,l,d;return{...e,...e[i.type],...i,removeDelay:i.removeDelay||((s=e[i.type])==null?void 0:s.removeDelay)||(e==null?void 0:e.removeDelay),duration:i.duration||((l=e[i.type])==null?void 0:l.duration)||(e==null?void 0:e.duration)||bg[i.type],style:{...e.style,...(d=e[i.type])==null?void 0:d.style,...i.style}}});return{...r,toasts:a}},Cg=(e,t="blank",r)=>({createdAt:Date.now(),visible:!0,dismissed:!1,type:t,ariaProps:{role:"status","aria-live":"polite"},message:e,pauseDuration:0,...r,id:(r==null?void 0:r.id)||mg()}),oo=e=>(t,r)=>{let n=Cg(t,e,r);return oa(n.toasterId||vg(n.id))({type:2,toast:n}),n.id},rt=(e,t)=>oo("blank")(e,t);rt.error=oo("error"),rt.success=oo("success"),rt.loading=oo("loading"),rt.custom=oo("custom"),rt.dismiss=(e,t)=>{let r={type:3,toastId:e};t?oa(t)(r):sc(r)},rt.dismissAll=e=>rt.dismiss(void 0,e),rt.remove=(e,t)=>{let r={type:4,toastId:e};t?oa(t)(r):sc(r)},rt.removeAll=e=>rt.remove(void 0,e),rt.promise=(e,t,r)=>{let n=rt.loading(t.loading,{...r,...r==null?void 0:r.loading});return typeof e=="function"&&(e=e()),e.then(o=>{let a=t.success?ra(t.success,o):void 0;return a?rt.success(a,{id:n,...r,...r==null?void 0:r.success}):rt.dismiss(n),o}).catch(o=>{let a=t.error?ra(t.error,o):void 0;a?rt.error(a,{id:n,...r,...r==null?void 0:r.error}):rt.dismiss(n)}),e};var Sg=1e3,_g=(e,t="default")=>{let{toasts:r,pausedAt:n}=wg(e,t),o=h.useRef(new Map).current,a=h.useCallback((u,m=Sg)=>{if(o.has(u))return;let g=setTimeout(()=>{o.delete(u),i({type:4,toastId:u})},m);o.set(u,g)},[]);h.useEffect(()=>{if(n)return;let u=Date.now(),m=r.map(g=>{if(g.duration===1/0)return;let w=(g.duration||0)+g.pauseDuration-(u-g.createdAt);if(w<0){g.visible&&rt.dismiss(g.id);return}return setTimeout(()=>rt.dismiss(g.id,t),w)});return()=>{m.forEach(g=>g&&clearTimeout(g))}},[r,n,t]);let i=h.useCallback(oa(t),[t]),s=h.useCallback(()=>{i({type:5,time:Date.now()})},[i]),l=h.useCallback((u,m)=>{i({type:1,toast:{id:u,height:m}})},[i]),d=h.useCallback(()=>{n&&i({type:6,time:Date.now()})},[n,i]),f=h.useCallback((u,m)=>{let{reverseOrder:g=!1,gutter:w=8,defaultPosition:p}=m||{},y=r.filter(C=>(C.position||p)===(u.position||p)&&C.height),v=y.findIndex(C=>C.id===u.id),b=y.filter((C,S)=>S<v&&C.visible).length;return y.filter(C=>C.visible).slice(...g?[b+1]:[0,b]).reduce((C,S)=>C+(S.height||0)+w,0)},[r]);return h.useEffect(()=>{r.forEach(u=>{if(u.dismissed)a(u.id,u.removeDelay);else{let m=o.get(u.id);m&&(clearTimeout(m),o.delete(u.id))}})},[r,a]),{toasts:r,handlers:{updateHeight:l,startPause:s,endPause:d,calculateOffset:f}}},Tg=mr`
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
- }`,vg=pr`
9
+ }`,Eg=mr`
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
- }`,mg=pr`
17
+ }`,Ig=mr`
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
- }`,bg=Or("div")`
25
+ }`,Og=Or("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: ${yg} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)
34
+ animation: ${Tg} 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: ${vg} 0.15s ease-out forwards;
41
+ animation: ${Eg} 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: ${mg} 0.15s ease-out forwards;
54
+ animation: ${Ig} 0.15s ease-out forwards;
55
55
  animation-delay: 180ms;
56
56
  transform: rotate(90deg);
57
57
  }
58
- `,_g=pr`
58
+ `,Ag=mr`
59
59
  from {
60
60
  transform: rotate(0deg);
61
61
  }
62
62
  to {
63
63
  transform: rotate(360deg);
64
64
  }
65
- `,wg=Or("div")`
65
+ `,Dg=Or("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: ${_g} 1s linear infinite;
74
- `,Sg=pr`
73
+ animation: ${Ag} 1s linear infinite;
74
+ `,Ng=mr`
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
- }`,Cg=pr`
82
+ }`,kg=mr`
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
- }`,Eg=Or("div")`
96
+ }`,xg=Or("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: ${Sg} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)
105
+ animation: ${Ng} 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: ${Cg} 0.2s ease-out forwards;
111
+ animation: ${kg} 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
- `,Og=Or("div")`
123
+ `,Lg=Or("div")`
124
124
  position: absolute;
125
- `,Ig=Or("div")`
125
+ `,Pg=Or("div")`
126
126
  position: relative;
127
127
  display: flex;
128
128
  justify-content: center;
129
129
  align-items: center;
130
130
  min-width: 20px;
131
131
  min-height: 20px;
132
- `,Dg=pr`
132
+ `,Fg=mr`
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
- }`,Tg=Or("div")`
140
+ }`,Mg=Or("div")`
141
141
  position: relative;
142
142
  transform: scale(0.6);
143
143
  opacity: 0.4;
144
144
  min-width: 20px;
145
- animation: ${Dg} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275)
145
+ animation: ${Fg} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275)
146
146
  forwards;
147
- `,Ng=({toast:e})=>{let{icon:t,type:r,iconTheme:n}=e;return t!==void 0?typeof t=="string"?Te.createElement(Tg,null,t):t:r==="blank"?null:Te.createElement(Ig,null,Te.createElement(wg,{...n}),r!=="loading"&&Te.createElement(Og,null,r==="error"?Te.createElement(bg,{...n}):Te.createElement(Eg,{...n})))},kg=e=>`
147
+ `,$g=({toast:e})=>{let{icon:t,type:r,iconTheme:n}=e;return t!==void 0?typeof t=="string"?Ne.createElement(Mg,null,t):t:r==="blank"?null:Ne.createElement(Pg,null,Ne.createElement(Dg,{...n}),r!=="loading"&&Ne.createElement(Lg,null,r==="error"?Ne.createElement(Og,{...n}):Ne.createElement(xg,{...n})))},Bg=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
- `,xg=e=>`
150
+ `,jg=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
- `,Ag="0%{opacity:0;} 100%{opacity:1;}",Pg="0%{opacity:1;} 100%{opacity:0;}",Mg=Or("div")`
153
+ `,qg="0%{opacity:0;} 100%{opacity:1;}",Ug="0%{opacity:1;} 100%{opacity:0;}",zg=Or("div")`
154
154
  display: flex;
155
155
  align-items: center;
156
156
  background: #fff;
@@ -162,258 +162,298 @@ to {
162
162
  pointer-events: auto;
163
163
  padding: 8px 10px;
164
164
  border-radius: 8px;
165
- `,Lg=Or("div")`
165
+ `,Vg=Or("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
- `,Fg=(e,t)=>{let r=e.includes("top")?1:-1,[n,s]=Rl()?[Ag,Pg]:[kg(r),xg(r)];return{animation:t?`${pr(n)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`:`${pr(s)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`}},$g=Te.memo(({toast:e,position:t,style:r,children:n})=>{let s=e.height?Fg(e.position||t||"top-center",e.visible):{opacity:0},i=Te.createElement(Ng,{toast:e}),o=Te.createElement(Lg,{...e.ariaProps},Js(e.message,e));return Te.createElement(Mg,{className:e.className,style:{...s,...r,...e.style}},typeof n=="function"?n({icon:i,message:o}):Te.createElement(Te.Fragment,null,i,o))});og(Te.createElement);var jg=({id:e,className:t,style:r,onHeightUpdate:n,children:s})=>{let i=Te.useCallback(o=>{if(o){let a=()=>{let c=o.getBoundingClientRect().height;n(e,c)};a(),new MutationObserver(a).observe(o,{subtree:!0,childList:!0,characterData:!0})}},[e,n]);return Te.createElement("div",{ref:i,className:t,style:r},s)},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:Rl()?void 0:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${t*(r?1:-1)}px)`,...n,...s}},Ug=Zs`
172
+ `,Hg=(e,t)=>{let r=e.includes("top")?1:-1,[n,o]=nc()?[qg,Ug]:[Bg(r),jg(r)];return{animation:t?`${mr(n)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`:`${mr(o)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`}},Rg=Ne.memo(({toast:e,position:t,style:r,children:n})=>{let o=e.height?Hg(e.position||t||"top-center",e.visible):{opacity:0},a=Ne.createElement($g,{toast:e}),i=Ne.createElement(Vg,{...e.ariaProps},ra(e.message,e));return Ne.createElement(zg,{className:e.className,style:{...o,...r,...e.style}},typeof n=="function"?n({icon:a,message:i}):Ne.createElement(Ne.Fragment,null,a,i))});pg(Ne.createElement);var Qg=({id:e,className:t,style:r,onHeightUpdate:n,children:o})=>{let a=Ne.useCallback(i=>{if(i){let s=()=>{let l=i.getBoundingClientRect().height;n(e,l)};s(),new MutationObserver(s).observe(i,{subtree:!0,childList:!0,characterData:!0})}},[e,n]);return Ne.createElement("div",{ref:a,className:t,style:r},o)},Gg=(e,t)=>{let r=e.includes("top"),n=r?{top:0}:{bottom:0},o=e.includes("center")?{justifyContent:"center"}:e.includes("right")?{justifyContent:"flex-end"}:{};return{left:0,right:0,display:"flex",position:"absolute",transition:nc()?void 0:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${t*(r?1:-1)}px)`,...n,...o}},Wg=ta`
173
173
  z-index: 9999;
174
174
  > * {
175
175
  pointer-events: auto;
176
176
  }
177
- `,ri=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}=gg(r,i);return Te.createElement("div",{"data-rht-toaster":i||"",style:{position:"fixed",zIndex:9999,top:ri,left:ri,right:ri,bottom:ri,pointerEvents:"none",...o},className:a,onMouseEnter:d.startPause,onMouseLeave:d.endPause},c.map(u=>{let f=u.position||t,g=d.calculateOffset(u,{reverseOrder:e,gutter:n,defaultPosition:t}),y=Bg(f,g);return Te.createElement(jg,{id:u.id,key:u.id,onHeightUpdate:d.updateHeight,className:u.visible?Ug:"",style:y},u.type==="custom"?Js(u.message,u):s?s(u):Te.createElement($g,{toast:u,position:f}))}))},Oe=et;function qg(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return h.useMemo(()=>n=>{t.forEach(s=>s(n))},t)}const ni=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function gn(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function To(e){return"nodeType"in e}function Ct(e){var t,r;return e?gn(e)?e:To(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function No(e){const{Document:t}=Ct(e);return e instanceof t}function ns(e){return gn(e)?!1:e instanceof Ct(e).HTMLElement}function ec(e){return e instanceof Ct(e).SVGElement}function yn(e){return e?gn(e)?e.document:To(e)?No(e)?e:ns(e)||ec(e)?e.ownerDocument:document:document:document}const Kt=ni?h.useLayoutEffect:h.useEffect;function si(e){const t=h.useRef(e);return Kt(()=>{t.current=e}),h.useCallback(function(){for(var r=arguments.length,n=new Array(r),s=0;s<r;s++)n[s]=arguments[s];return t.current==null?void 0:t.current(...n)},[])}function zg(){const e=h.useRef(null),t=h.useCallback((n,s)=>{e.current=setInterval(n,s)},[]),r=h.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,r]}function ss(e,t){t===void 0&&(t=[e]);const r=h.useRef(e);return Kt(()=>{r.current!==e&&(r.current=e)},t),r}function is(e,t){const r=h.useRef();return h.useMemo(()=>{const n=e(r.current);return r.current=n,n},[...t])}function ii(e){const t=si(e),r=h.useRef(null),n=h.useCallback(s=>{s!==r.current&&(t==null||t(s,r.current)),r.current=s},[]);return[r,n]}function oi(e){const t=h.useRef();return h.useEffect(()=>{t.current=e},[e]),t.current}let ko={};function os(e,t){return h.useMemo(()=>{if(t)return t;const r=ko[e]==null?0:ko[e]+1;return ko[e]=r,e+"-"+r},[e,t])}function tc(e){return function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),s=1;s<r;s++)n[s-1]=arguments[s];return n.reduce((i,o)=>{const a=Object.entries(o);for(const[c,d]of a){const u=i[c];u!=null&&(i[c]=u+e*d)}return i},{...t})}}const vn=tc(1),as=tc(-1);function Hg(e){return"clientX"in e&&"clientY"in e}function ai(e){if(!e)return!1;const{KeyboardEvent:t}=Ct(e.target);return t&&e instanceof t}function Wg(e){if(!e)return!1;const{TouchEvent:t}=Ct(e.target);return t&&e instanceof t}function li(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 Ir=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[Ir.Translate.toString(e),Ir.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:n}=e;return t+" "+r+"ms "+n}}}),rc="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Qg(e){return e.matches(rc)?e:e.querySelector(rc)}const Kg={display:"none"};function Gg(e){let{id:t,value:r}=e;return h.createElement("div",{id:t,style:Kg},r)}function Rg(e){let{id:t,announcement:r,ariaLiveType:n="assertive"}=e;const s={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return h.createElement("div",{id:t,style:s,role:"status","aria-live":n,"aria-atomic":!0},r)}function Yg(){const[e,t]=h.useState("");return{announce:h.useCallback(n=>{n!=null&&t(n)},[]),announcement:e}}const nc=h.createContext(null);function Xg(e){const t=h.useContext(nc);h.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Zg(){const[e]=h.useState(()=>new Set),t=h.useCallback(n=>(e.add(n),()=>e.delete(n)),[e]);return[h.useCallback(n=>{let{type:s,event:i}=n;e.forEach(o=>{var a;return(a=o[s])==null?void 0:a.call(o,i)})},[e]),t]}const Jg={draggable:`
177
+ `,aa=16,Kg=({reverseOrder:e,position:t="top-center",toastOptions:r,gutter:n,children:o,toasterId:a,containerStyle:i,containerClassName:s})=>{let{toasts:l,handlers:d}=_g(r,a);return Ne.createElement("div",{"data-rht-toaster":a||"",style:{position:"fixed",zIndex:9999,top:aa,left:aa,right:aa,bottom:aa,pointerEvents:"none",...i},className:s,onMouseEnter:d.startPause,onMouseLeave:d.endPause},l.map(f=>{let u=f.position||t,m=d.calculateOffset(f,{reverseOrder:e,gutter:n,defaultPosition:t}),g=Gg(u,m);return Ne.createElement(Qg,{id:f.id,key:f.id,onHeightUpdate:d.updateHeight,className:f.visible?Wg:"",style:g},f.type==="custom"?ra(f.message,f):o?o(f):Ne.createElement(Rg,{toast:f,position:u}))}))},Ie=rt;function Yg(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return h.useMemo(()=>n=>{t.forEach(o=>o(n))},t)}const ia=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function mn(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function ki(e){return"nodeType"in e}function Tt(e){var t,r;return e?mn(e)?e:ki(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function xi(e){const{Document:t}=Tt(e);return e instanceof t}function ao(e){return mn(e)?!1:e instanceof Tt(e).HTMLElement}function lc(e){return e instanceof Tt(e).SVGElement}function yn(e){return e?mn(e)?e.document:ki(e)?xi(e)?e:ao(e)||lc(e)?e.ownerDocument:document:document:document}const Yt=ia?h.useLayoutEffect:h.useEffect;function sa(e){const t=h.useRef(e);return Yt(()=>{t.current=e}),h.useCallback(function(){for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return t.current==null?void 0:t.current(...n)},[])}function Zg(){const e=h.useRef(null),t=h.useCallback((n,o)=>{e.current=setInterval(n,o)},[]),r=h.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,r]}function io(e,t){t===void 0&&(t=[e]);const r=h.useRef(e);return Yt(()=>{r.current!==e&&(r.current=e)},t),r}function so(e,t){const r=h.useRef();return h.useMemo(()=>{const n=e(r.current);return r.current=n,n},[...t])}function la(e){const t=sa(e),r=h.useRef(null),n=h.useCallback(o=>{o!==r.current&&(t==null||t(o,r.current)),r.current=o},[]);return[r,n]}function ca(e){const t=h.useRef();return h.useEffect(()=>{t.current=e},[e]),t.current}let Li={};function lo(e,t){return h.useMemo(()=>{if(t)return t;const r=Li[e]==null?0:Li[e]+1;return Li[e]=r,e+"-"+r},[e,t])}function cc(e){return function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return n.reduce((a,i)=>{const s=Object.entries(i);for(const[l,d]of s){const f=a[l];f!=null&&(a[l]=f+e*d)}return a},{...t})}}const vn=cc(1),co=cc(-1);function Xg(e){return"clientX"in e&&"clientY"in e}function da(e){if(!e)return!1;const{KeyboardEvent:t}=Tt(e.target);return t&&e instanceof t}function Jg(e){if(!e)return!1;const{TouchEvent:t}=Tt(e.target);return t&&e instanceof t}function ua(e){if(Jg(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 Xg(e)?{x:e.clientX,y:e.clientY}:null}const Ar=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:r}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:r}=e;return"scaleX("+t+") scaleY("+r+")"}},Transform:{toString(e){if(e)return[Ar.Translate.toString(e),Ar.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:n}=e;return t+" "+r+"ms "+n}}}),dc="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function em(e){return e.matches(dc)?e:e.querySelector(dc)}const tm={display:"none"};function rm(e){let{id:t,value:r}=e;return h.createElement("div",{id:t,style:tm},r)}function nm(e){let{id:t,announcement:r,ariaLiveType:n="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return h.createElement("div",{id:t,style:o,role:"status","aria-live":n,"aria-atomic":!0},r)}function om(){const[e,t]=h.useState("");return{announce:h.useCallback(n=>{n!=null&&t(n)},[]),announcement:e}}const uc=h.createContext(null);function am(e){const t=h.useContext(uc);h.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function im(){const[e]=h.useState(()=>new Set),t=h.useCallback(n=>(e.add(n),()=>e.delete(n)),[e]);return[h.useCallback(n=>{let{type:o,event:a}=n;e.forEach(i=>{var s;return(s=i[o])==null?void 0:s.call(i,a)})},[e]),t]}const sm={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
- `},ey={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 ty(e){let{announcements:t=ey,container:r,hiddenTextDescribedById:n,screenReaderInstructions:s=Jg}=e;const{announce:i,announcement:o}=Yg(),a=os("DndLiveRegion"),[c,d]=h.useState(!1);if(h.useEffect(()=>{d(!0)},[]),Xg(h.useMemo(()=>({onDragStart(f){let{active:g}=f;i(t.onDragStart({active:g}))},onDragMove(f){let{active:g,over:y}=f;t.onDragMove&&i(t.onDragMove({active:g,over:y}))},onDragOver(f){let{active:g,over:y}=f;i(t.onDragOver({active:g,over:y}))},onDragEnd(f){let{active:g,over:y}=f;i(t.onDragEnd({active:g,over:y}))},onDragCancel(f){let{active:g,over:y}=f;i(t.onDragCancel({active:g,over:y}))}}),[i,t])),!c)return null;const u=h.createElement(h.Fragment,null,h.createElement(Gg,{id:n,value:s.draggable}),h.createElement(Rg,{id:a,announcement:o}));return r?Pe.createPortal(u,r):u}var tt;(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"})(tt||(tt={}));function ci(){}function xo(e,t){return h.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function sc(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return h.useMemo(()=>[...t].filter(n=>n!=null),[...t])}const Gt=Object.freeze({x:0,y:0});function ic(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function ry(e,t){const r=li(e);if(!r)return"0 0";const n={x:(r.x-t.left)/t.width*100,y:(r.y-t.top)/t.height*100};return n.x+"% "+n.y+"%"}function oc(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return r-n}function ny(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return n-r}function ac(e){let{left:t,top:r,height:n,width:s}=e;return[{x:t,y:r},{x:t+s,y:r},{x:t,y:r+n},{x:t+s,y:r+n}]}function lc(e,t){if(!e||e.length===0)return null;const[r]=e;return r[t]}function cc(e,t,r){return t===void 0&&(t=e.left),r===void 0&&(r=e.top),{x:t+e.width*.5,y:r+e.height*.5}}const sy=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=cc(t,t.left,t.top),i=[];for(const o of n){const{id:a}=o,c=r.get(a);if(c){const d=ic(cc(c),s);i.push({id:a,data:{droppableContainer:o,value:d}})}}return i.sort(oc)},iy=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=ac(t),i=[];for(const o of n){const{id:a}=o,c=r.get(a);if(c){const d=ac(c),u=s.reduce((g,y,_)=>g+ic(d[_],y),0),f=Number((u/4).toFixed(4));i.push({id:a,data:{droppableContainer:o,value:f}})}}return i.sort(oc)};function oy(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 ay=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=oy(a,t);c>0&&s.push({id:o,data:{droppableContainer:i,value:c}})}}return s.sort(ny)};function ly(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function uc(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Gt}function cy(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 uy=cy(1);function dc(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function dy(e,t,r){const n=dc(t);if(!n)return e;const{scaleX:s,scaleY:i,x:o,y:a}=n,c=e.left-o-(1-s)*parseFloat(r),d=e.top-a-(1-i)*parseFloat(r.slice(r.indexOf(" ")+1)),u=s?e.width/s:e.width,f=i?e.height/i:e.height;return{width:u,height:f,top:d,right:c+u,bottom:d+f,left:c}}const fy={ignoreTransform:!1};function mn(e,t){t===void 0&&(t=fy);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:u}=Ct(e).getComputedStyle(e);d&&(r=dy(r,d,u))}const{top:n,left:s,width:i,height:o,bottom:a,right:c}=r;return{top:n,left:s,width:i,height:o,bottom:a,right:c}}function fc(e){return mn(e,{ignoreTransform:!0})}function hy(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function py(e,t){return t===void 0&&(t=Ct(e).getComputedStyle(e)),t.position==="fixed"}function gy(e,t){t===void 0&&(t=Ct(e).getComputedStyle(e));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const i=t[s];return typeof i=="string"?r.test(i):!1})}function ui(e,t){const r=[];function n(s){if(t!=null&&r.length>=t||!s)return r;if(No(s)&&s.scrollingElement!=null&&!r.includes(s.scrollingElement))return r.push(s.scrollingElement),r;if(!ns(s)||ec(s)||r.includes(s))return r;const i=Ct(e).getComputedStyle(s);return s!==e&&gy(s,i)&&r.push(s),py(s,i)?r:n(s.parentNode)}return e?n(e):r}function hc(e){const[t]=ui(e,1);return t??null}function Ao(e){return!ni||!e?null:gn(e)?e:To(e)?No(e)||e===yn(e).scrollingElement?window:ns(e)?e:null:null}function pc(e){return gn(e)?e.scrollX:e.scrollLeft}function gc(e){return gn(e)?e.scrollY:e.scrollTop}function Po(e){return{x:pc(e),y:gc(e)}}var rt;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(rt||(rt={}));function yc(e){return!ni||!e?!1:e===document.scrollingElement}function vc(e){const t={x:0,y:0},r=yc(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},n={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height},s=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,o=e.scrollTop>=n.y,a=e.scrollLeft>=n.x;return{isTop:s,isLeft:i,isBottom:o,isRight:a,maxScroll:n,minScroll:t}}const yy={x:.2,y:.2};function vy(e,t,r,n,s){let{top:i,left:o,right:a,bottom:c}=r;n===void 0&&(n=10),s===void 0&&(s=yy);const{isTop:d,isBottom:u,isLeft:f,isRight:g}=vc(e),y={x:0,y:0},_={x:0,y:0},p={height:t.height*s.y,width:t.width*s.x};return!d&&i<=t.top+p.height?(y.y=rt.Backward,_.y=n*Math.abs((t.top+p.height-i)/p.height)):!u&&c>=t.bottom-p.height&&(y.y=rt.Forward,_.y=n*Math.abs((t.bottom-p.height-c)/p.height)),!g&&a>=t.right-p.width?(y.x=rt.Forward,_.x=n*Math.abs((t.right-p.width-a)/p.width)):!f&&o<=t.left+p.width&&(y.x=rt.Backward,_.x=n*Math.abs((t.left+p.width-o)/p.width)),{direction:y,speed:_}}function my(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:o}=window;return{top:0,left:0,right:i,bottom:o,width:i,height:o}}const{top:t,left:r,right:n,bottom:s}=e.getBoundingClientRect();return{top:t,left:r,right:n,bottom:s,width:e.clientWidth,height:e.clientHeight}}function mc(e){return e.reduce((t,r)=>vn(t,Po(r)),Gt)}function by(e){return e.reduce((t,r)=>t+pc(r),0)}function _y(e){return e.reduce((t,r)=>t+gc(r),0)}function bc(e,t){if(t===void 0&&(t=mn),!e)return;const{top:r,left:n,bottom:s,right:i}=t(e);hc(e)&&(s<=0||i<=0||r>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const wy=[["x",["left","right"],by],["y",["top","bottom"],_y]];class Mo{constructor(t,r){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=ui(r),s=mc(n);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,o,a]of wy)for(const c of o)Object.defineProperty(this,c,{get:()=>{const d=a(n),u=s[i]-d;return this.rect[c]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class ls{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var n;return(n=this.target)==null?void 0:n.removeEventListener(...r)})},this.target=t}add(t,r,n){var s;(s=this.target)==null||s.addEventListener(t,r,n),this.listeners.push([t,r,n])}}function Sy(e){const{EventTarget:t}=Ct(e);return e instanceof t?e:yn(e)}function Lo(e,t){const r=Math.abs(e.x),n=Math.abs(e.y);return typeof t=="number"?Math.sqrt(r**2+n**2)>t:"x"in t&&"y"in t?r>t.x&&n>t.y:"x"in t?r>t.x:"y"in t?n>t.y:!1}var Bt;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Bt||(Bt={}));function _c(e){e.preventDefault()}function Cy(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 wc={start:[we.Space,we.Enter],cancel:[we.Esc],end:[we.Space,we.Enter,we.Tab]},Ey=(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 Fo{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:r}}=t;this.props=t,this.listeners=new ls(yn(r)),this.windowListeners=new ls(Ct(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Bt.Resize,this.handleCancel),this.windowListeners.add(Bt.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Bt.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,n=t.node.current;n&&bc(n),r(Gt)}handleKeyDown(t){if(ai(t)){const{active:r,context:n,options:s}=this.props,{keyboardCodes:i=wc,coordinateGetter:o=Ey,scrollBehavior:a="smooth"}=s,{code:c}=t;if(i.end.includes(c)){this.handleEnd(t);return}if(i.cancel.includes(c)){this.handleCancel(t);return}const{collisionRect:d}=n.current,u=d?{x:d.left,y:d.top}:Gt;this.referenceCoordinates||(this.referenceCoordinates=u);const f=o(t,{active:r,context:n.current,currentCoordinates:u});if(f){const g=as(f,u),y={x:0,y:0},{scrollableAncestors:_}=n.current;for(const p of _){const v=t.code,{isTop:m,isRight:b,isLeft:S,isBottom:w,maxScroll:E,minScroll:D}=vc(p),x=my(p),A={x:Math.min(v===we.Right?x.right-x.width/2:x.right,Math.max(v===we.Right?x.left:x.left+x.width/2,f.x)),y:Math.min(v===we.Down?x.bottom-x.height/2:x.bottom,Math.max(v===we.Down?x.top:x.top+x.height/2,f.y))},$=v===we.Right&&!b||v===we.Left&&!S,N=v===we.Down&&!w||v===we.Up&&!m;if($&&A.x!==f.x){const M=p.scrollLeft+g.x,U=v===we.Right&&M<=E.x||v===we.Left&&M>=D.x;if(U&&!g.y){p.scrollTo({left:M,behavior:a});return}U?y.x=p.scrollLeft-M:y.x=v===we.Right?p.scrollLeft-E.x:p.scrollLeft-D.x,y.x&&p.scrollBy({left:-y.x,behavior:a});break}else if(N&&A.y!==f.y){const M=p.scrollTop+g.y,U=v===we.Down&&M<=E.y||v===we.Up&&M>=D.y;if(U&&!g.x){p.scrollTo({top:M,behavior:a});return}U?y.y=p.scrollTop-M:y.y=v===we.Down?p.scrollTop-E.y:p.scrollTop-D.y,y.y&&p.scrollBy({top:-y.y,behavior:a});break}}this.handleMove(t,vn(as(f,this.referenceCoordinates),y))}}}handleMove(t,r){const{onMove:n}=this.props;t.preventDefault(),n(r)}handleEnd(t){const{onEnd:r}=this.props;t.preventDefault(),this.detach(),r()}handleCancel(t){const{onCancel:r}=this.props;t.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Fo.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:n=wc,onActivation:s}=t,{active:i}=r;const{code:o}=e.nativeEvent;if(n.start.includes(o)){const a=i.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),s==null||s({event:e.nativeEvent}),!0)}return!1}}];function Sc(e){return!!(e&&"distance"in e)}function Cc(e){return!!(e&&"delay"in e)}class $o{constructor(t,r,n){var s;n===void 0&&(n=Sy(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=yn(o),this.documentListeners=new ls(this.document),this.listeners=new ls(n),this.windowListeners=new ls(Ct(o)),this.initialCoordinates=(s=li(i))!=null?s:Gt,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:r,bypassActivationConstraint:n}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Bt.Resize,this.handleCancel),this.windowListeners.add(Bt.DragStart,_c),this.windowListeners.add(Bt.VisibilityChange,this.handleCancel),this.windowListeners.add(Bt.ContextMenu,_c),this.documentListeners.add(Bt.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Cc(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(Sc(r)){this.handlePending(r);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,r){const{active:n,onPending:s}=this.props;s(n,t,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:t}=this,{onStart:r}=this.props;t&&(this.activated=!0,this.documentListeners.add(Bt.Click,Cy,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Bt.SelectionChange,this.removeTextSelection),r(t))}handleMove(t){var r;const{activated:n,initialCoordinates:s,props:i}=this,{onMove:o,options:{activationConstraint:a}}=i;if(!s)return;const c=(r=li(t))!=null?r:Gt,d=as(s,c);if(!n&&a){if(Sc(a)){if(a.tolerance!=null&&Lo(d,a.tolerance))return this.handleCancel();if(Lo(d,a.distance))return this.handleStart()}if(Cc(a)&&Lo(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 Oy={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class di extends $o{constructor(t){const{event:r}=t,n=yn(r.target);super(t,Oy,n)}}di.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return!r.isPrimary||r.button!==0?!1:(n==null||n({event:r}),!0)}}];const Iy={move:{name:"mousemove"},end:{name:"mouseup"}};var jo;(function(e){e[e.RightClick=2]="RightClick"})(jo||(jo={}));class Dy extends $o{constructor(t){super(t,Iy,yn(t.event.target))}}Dy.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return r.button===jo.RightClick?!1:(n==null||n({event:r}),!0)}}];const Bo={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Ty extends $o{constructor(t){super(t,Bo)}static setup(){return window.addEventListener(Bo.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Bo.move.name,t)};function t(){}}}Ty.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;const{touches:s}=r;return s.length>1?!1:(n==null||n({event:r}),!0)}}];var cs;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(cs||(cs={}));var fi;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(fi||(fi={}));function Ny(e){let{acceleration:t,activator:r=cs.Pointer,canScroll:n,draggingRect:s,enabled:i,interval:o=5,order:a=fi.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:u,delta:f,threshold:g}=e;const y=xy({delta:f,disabled:!i}),[_,p]=zg(),v=h.useRef({x:0,y:0}),m=h.useRef({x:0,y:0}),b=h.useMemo(()=>{switch(r){case cs.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case cs.DraggableRect:return s}},[r,s,c]),S=h.useRef(null),w=h.useCallback(()=>{const D=S.current;if(!D)return;const x=v.current.x*m.current.x,A=v.current.y*m.current.y;D.scrollBy(x,A)},[]),E=h.useMemo(()=>a===fi.TreeOrder?[...d].reverse():d,[a,d]);h.useEffect(()=>{if(!i||!d.length||!b){p();return}for(const D of E){if((n==null?void 0:n(D))===!1)continue;const x=d.indexOf(D),A=u[x];if(!A)continue;const{direction:$,speed:N}=vy(D,A,b,t,g);for(const M of["x","y"])y[M][$[M]]||(N[M]=0,$[M]=0);if(N.x>0||N.y>0){p(),S.current=D,_(w,o),v.current=N,m.current=$;return}}v.current={x:0,y:0},m.current={x:0,y:0},p()},[t,w,n,p,i,o,JSON.stringify(b),JSON.stringify(y),_,d,E,u,JSON.stringify(g)])}const ky={x:{[rt.Backward]:!1,[rt.Forward]:!1},y:{[rt.Backward]:!1,[rt.Forward]:!1}};function xy(e){let{delta:t,disabled:r}=e;const n=oi(t);return is(s=>{if(r||!n||!s)return ky;const i={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[rt.Backward]:s.x[rt.Backward]||i.x===-1,[rt.Forward]:s.x[rt.Forward]||i.x===1},y:{[rt.Backward]:s.y[rt.Backward]||i.y===-1,[rt.Forward]:s.y[rt.Forward]||i.y===1}}},[r,t,n])}function Ay(e,t){const r=t!=null?e.get(t):void 0,n=r?r.node.current:null;return is(s=>{var i;return t==null?null:(i=n??s)!=null?i:null},[n,t])}function Py(e,t){return h.useMemo(()=>e.reduce((r,n)=>{const{sensor:s}=n,i=s.activators.map(o=>({eventName:o.eventName,handler:t(o.handler,n)}));return[...r,...i]},[]),[e,t])}var us;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(us||(us={}));var Uo;(function(e){e.Optimized="optimized"})(Uo||(Uo={}));const Ec=new Map;function My(e,t){let{dragging:r,dependencies:n,config:s}=t;const[i,o]=h.useState(null),{frequency:a,measure:c,strategy:d}=s,u=h.useRef(e),f=v(),g=ss(f),y=h.useCallback(function(m){m===void 0&&(m=[]),!g.current&&o(b=>b===null?m:b.concat(m.filter(S=>!b.includes(S))))},[g]),_=h.useRef(null),p=is(m=>{if(f&&!r)return Ec;if(!m||m===Ec||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,E=w?new Mo(c(w),w):null;S.rect.current=E,E&&b.set(S.id,E)}return b}return m},[e,i,r,f,c]);return h.useEffect(()=>{u.current=e},[e]),h.useEffect(()=>{f||y()},[r,f]),h.useEffect(()=>{i&&i.length>0&&o(null)},[JSON.stringify(i)]),h.useEffect(()=>{f||typeof a!="number"||_.current!==null||(_.current=setTimeout(()=>{y(),_.current=null},a))},[a,f,y,...n]),{droppableRects:p,measureDroppableContainers:y,measuringScheduled:i!=null};function v(){switch(d){case us.Always:return!1;case us.BeforeDragging:return r;default:return!r}}}function Vo(e,t){return is(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function Ly(e,t){return Vo(e,t)}function Fy(e){let{callback:t,disabled:r}=e;const n=si(t),s=h.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(n)},[n,r]);return h.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function hi(e){let{callback:t,disabled:r}=e;const n=si(t),s=h.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(n)},[r]);return h.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function $y(e){return new Mo(mn(e),e)}function Oc(e,t,r){t===void 0&&(t=$y);const[n,s]=h.useState(null);function i(){s(c=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=c??r)!=null?d:null}const u=t(e);return JSON.stringify(c)===JSON.stringify(u)?c:u})}const o=Fy({callback(c){if(e)for(const d of c){const{type:u,target:f}=d;if(u==="childList"&&f instanceof HTMLElement&&f.contains(e)){i();break}}}}),a=hi({callback:i});return Kt(()=>{i(),e?(a==null||a.observe(e),o==null||o.observe(document.body,{childList:!0,subtree:!0})):(a==null||a.disconnect(),o==null||o.disconnect())},[e]),n}function jy(e){const t=Vo(e);return uc(e,t)}const Ic=[];function By(e){const t=h.useRef(e),r=is(n=>e?n&&n!==Ic&&e&&t.current&&e.parentNode===t.current.parentNode?n:ui(e):Ic,[e]);return h.useEffect(()=>{t.current=e},[e]),r}function Uy(e){const[t,r]=h.useState(null),n=h.useRef(e),s=h.useCallback(i=>{const o=Ao(i.target);o&&r(a=>a?(a.set(o,Po(o)),new Map(a)):null)},[]);return h.useEffect(()=>{const i=n.current;if(e!==i){o(i);const a=e.map(c=>{const d=Ao(c);return d?(d.addEventListener("scroll",s,{passive:!0}),[d,Po(d)]):null}).filter(c=>c!=null);r(a.length?new Map(a):null),n.current=e}return()=>{o(e),o(i)};function o(a){a.forEach(c=>{const d=Ao(c);d==null||d.removeEventListener("scroll",s)})}},[s,e]),h.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,o)=>vn(i,o),Gt):mc(e):Gt,[e,t])}function Dc(e,t){t===void 0&&(t=[]);const r=h.useRef(null);return h.useEffect(()=>{r.current=null},t),h.useEffect(()=>{const n=e!==Gt;n&&!r.current&&(r.current=e),!n&&r.current&&(r.current=null)},[e]),r.current?as(e,r.current):Gt}function Vy(e){h.useEffect(()=>{if(!ni)return;const t=e.map(r=>{let{sensor:n}=r;return n.setup==null?void 0:n.setup()});return()=>{for(const r of t)r==null||r()}},e.map(t=>{let{sensor:r}=t;return r}))}function qy(e,t){return h.useMemo(()=>e.reduce((r,n)=>{let{eventName:s,handler:i}=n;return r[s]=o=>{i(o,t)},r},{}),[e,t])}function Tc(e){return h.useMemo(()=>e?hy(e):null,[e])}const Nc=[];function zy(e,t){t===void 0&&(t=mn);const[r]=e,n=Tc(r?Ct(r):null),[s,i]=h.useState(Nc);function o(){i(()=>e.length?e.map(c=>yc(c)?n:new Mo(t(c),c)):Nc)}const a=hi({callback:o});return Kt(()=>{a==null||a.disconnect(),o(),e.forEach(c=>a==null?void 0:a.observe(c))},[e]),s}function kc(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return ns(t)?t:e}function Hy(e){let{measure:t}=e;const[r,n]=h.useState(null),s=h.useCallback(d=>{for(const{target:u}of d)if(ns(u)){n(f=>{const g=t(u);return f?{...f,width:g.width,height:g.height}:g});break}},[t]),i=hi({callback:s}),o=h.useCallback(d=>{const u=kc(d);i==null||i.disconnect(),u&&(i==null||i.observe(u)),n(u?t(u):null)},[t,i]),[a,c]=ii(o);return h.useMemo(()=>({nodeRef:a,rect:r,setRef:c}),[r,a,c])}const Wy=[{sensor:di,options:{}},{sensor:Fo,options:{}}],Qy={current:{}},pi={draggable:{measure:fc},droppable:{measure:fc,strategy:us.WhileDragging,frequency:Uo.Optimized},dragOverlay:{measure:mn}};class ds extends Map{get(t){var r;return t!=null&&(r=super.get(t))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:r}=t;return!r})}getNodeFor(t){var r,n;return(r=(n=this.get(t))==null?void 0:n.node.current)!=null?r:void 0}}const Ky={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new ds,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:ci},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:pi,measureDroppableContainers:ci,windowRect:null,measuringScheduled:!1},xc={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:ci,draggableNodes:new Map,over:null,measureDroppableContainers:ci},fs=h.createContext(xc),Ac=h.createContext(Ky);function Gy(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new ds}}}function Ry(e,t){switch(t.type){case tt.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case tt.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 tt.DragEnd:case tt.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case tt.RegisterDroppable:{const{element:r}=t,{id:n}=r,s=new ds(e.droppable.containers);return s.set(n,r),{...e,droppable:{...e.droppable,containers:s}}}case tt.SetDroppableDisabled:{const{id:r,key:n,disabled:s}=t,i=e.droppable.containers.get(r);if(!i||n!==i.key)return e;const o=new ds(e.droppable.containers);return o.set(r,{...i,disabled:s}),{...e,droppable:{...e.droppable,containers:o}}}case tt.UnregisterDroppable:{const{id:r,key:n}=t,s=e.droppable.containers.get(r);if(!s||n!==s.key)return e;const i=new ds(e.droppable.containers);return i.delete(r),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function Yy(e){let{disabled:t}=e;const{active:r,activatorEvent:n,draggableNodes:s}=h.useContext(fs),i=oi(n),o=oi(r==null?void 0:r.id);return h.useEffect(()=>{if(!t&&!n&&i&&o!=null){if(!ai(i)||document.activeElement===i.target)return;const a=s.get(o);if(!a)return;const{activatorNode:c,node:d}=a;if(!c.current&&!d.current)return;requestAnimationFrame(()=>{for(const u of[c.current,d.current]){if(!u)continue;const f=Qg(u);if(f){f.focus();break}}})}},[n,t,s,o,i]),null}function Pc(e,t){let{transform:r,...n}=t;return e!=null&&e.length?e.reduce((s,i)=>i({transform:s,...n}),r):r}function Xy(e){return h.useMemo(()=>({draggable:{...pi.draggable,...e==null?void 0:e.draggable},droppable:{...pi.droppable,...e==null?void 0:e.droppable},dragOverlay:{...pi.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function Zy(e){let{activeNode:t,measure:r,initialRect:n,config:s=!0}=e;const i=h.useRef(!1),{x:o,y:a}=typeof s=="boolean"?{x:s,y:s}:s;Kt(()=>{if(!o&&!a||!t){i.current=!1;return}if(i.current||!n)return;const d=t==null?void 0:t.node.current;if(!d||d.isConnected===!1)return;const u=r(d),f=uc(u,n);if(o||(f.x=0),a||(f.y=0),i.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const g=hc(d);g&&g.scrollBy({top:f.y,left:f.x})}},[t,o,a,n,r])}const gi=h.createContext({...Gt,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 Mc=h.memo(function(t){var r,n,s,i;let{id:o,accessibility:a,autoScroll:c=!0,children:d,sensors:u=Wy,collisionDetection:f=ay,measuring:g,modifiers:y,..._}=t;const p=h.useReducer(Ry,void 0,Gy),[v,m]=p,[b,S]=Zg(),[w,E]=h.useState(Dr.Uninitialized),D=w===Dr.Initialized,{draggable:{active:x,nodes:A,translate:$},droppable:{containers:N}}=v,M=x!=null?A.get(x):null,U=h.useRef({initial:null,translated:null}),P=h.useMemo(()=>{var at;return x!=null?{id:x,data:(at=M==null?void 0:M.data)!=null?at:Qy,rect:U}:null},[x,M]),L=h.useRef(null),[j,X]=h.useState(null),[se,xe]=h.useState(null),Ce=ss(_,Object.values(_)),be=os("DndDescribedBy",o),z=h.useMemo(()=>N.getEnabled(),[N]),J=Xy(g),{droppableRects:te,measureDroppableContainers:V,measuringScheduled:Z}=My(z,{dragging:D,dependencies:[$.x,$.y],config:J.droppable}),G=Ay(A,x),ce=h.useMemo(()=>se?li(se):null,[se]),ee=hn(),ge=Ly(G,J.draggable.measure);Zy({activeNode:x!=null?A.get(x):null,config:ee.layoutShiftCompensation,initialRect:ge,measure:J.draggable.measure});const ae=Oc(G,J.draggable.measure,ge),Re=Oc(G?G.parentElement:null),Ee=h.useRef({activatorEvent:null,active:null,activeNode:G,collisionRect:null,collisions:null,droppableRects:te,draggableNodes:A,draggingNode:null,draggingNodeRect:null,droppableContainers:N,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ze=N.getNodeFor((r=Ee.current.over)==null?void 0:r.id),Ye=Hy({measure:J.dragOverlay.measure}),qe=(n=Ye.nodeRef.current)!=null?n:G,re=D?(s=Ye.rect)!=null?s:ae:null,Le=!!(Ye.nodeRef.current&&Ye.rect),Ve=jy(Le?null:ae),Je=Tc(qe?Ct(qe):null),ft=By(D?Ze??G:null),Wt=zy(ft),W=Pc(y,{transform:{x:$.x-Ve.x,y:$.y-Ve.y,scaleX:1,scaleY:1},activatorEvent:se,active:P,activeNodeRect:ae,containerNodeRect:Re,draggingNodeRect:re,over:Ee.current.over,overlayNodeRect:Ye.rect,scrollableAncestors:ft,scrollableAncestorRects:Wt,windowRect:Je}),fe=ce?vn(ce,$):null,ve=Uy(ft),dr=Dc(ve),mr=Dc(ve,[ae]),C=vn(W,dr),T=re?uy(re,W):null,k=P&&T?f({active:P,collisionRect:T,droppableRects:te,droppableContainers:z,pointerCoordinates:fe}):null,B=lc(k,"id"),[q,Q]=h.useState(null),H=Le?W:vn(W,mr),ne=ly(H,(i=q==null?void 0:q.rect)!=null?i:null,ae),ye=h.useRef(null),We=h.useCallback((at,St)=>{let{sensor:Ot,options:tr}=St;if(L.current==null)return;const Qt=A.get(L.current);if(!Qt)return;const jt=at.nativeEvent,fr=new Ot({active:L.current,activeNode:Qt,event:jt,options:tr,context:Ee,onAbort(ht){if(!A.get(ht))return;const{onDragAbort:hr}=Ce.current,_r={id:ht};hr==null||hr(_r),b({type:"onDragAbort",event:_r})},onPending(ht,Br,hr,_r){if(!A.get(ht))return;const{onDragPending:Ws}=Ce.current,Ur={id:ht,constraint:Br,initialCoordinates:hr,offset:_r};Ws==null||Ws(Ur),b({type:"onDragPending",event:Ur})},onStart(ht){const Br=L.current;if(Br==null)return;const hr=A.get(Br);if(!hr)return;const{onDragStart:_r}=Ce.current,Hs={activatorEvent:jt,active:{id:Br,data:hr.data,rect:U}};Pe.unstable_batchedUpdates(()=>{_r==null||_r(Hs),E(Dr.Initializing),m({type:tt.DragStart,initialCoordinates:ht,active:Br}),b({type:"onDragStart",event:Hs}),X(ye.current),xe(jt)})},onMove(ht){m({type:tt.DragMove,coordinates:ht})},onEnd:Xn(tt.DragEnd),onCancel:Xn(tt.DragCancel)});ye.current=fr;function Xn(ht){return async function(){const{active:hr,collisions:_r,over:Hs,scrollAdjustedTranslate:Ws}=Ee.current;let Ur=null;if(hr&&Ws){const{cancelDrop:Qs}=Ce.current;Ur={activatorEvent:jt,active:hr,collisions:_r,delta:Ws,over:Hs},ht===tt.DragEnd&&typeof Qs=="function"&&await Promise.resolve(Qs(Ur))&&(ht=tt.DragCancel)}L.current=null,Pe.unstable_batchedUpdates(()=>{m({type:ht}),E(Dr.Uninitialized),Q(null),X(null),xe(null),ye.current=null;const Qs=ht===tt.DragEnd?"onDragEnd":"onDragCancel";if(Ur){const ml=Ce.current[Qs];ml==null||ml(Ur),b({type:Qs,event:Ur})}})}}},[A]),xt=h.useCallback((at,St)=>(Ot,tr)=>{const Qt=Ot.nativeEvent,jt=A.get(tr);if(L.current!==null||!jt||Qt.dndKit||Qt.defaultPrevented)return;const fr={active:jt};at(Ot,St.options,fr)===!0&&(Qt.dndKit={capturedBy:St.sensor},L.current=tr,We(Ot,St))},[A,We]),At=Py(u,xt);Vy(u),Kt(()=>{ae&&w===Dr.Initializing&&E(Dr.Initialized)},[ae,w]),h.useEffect(()=>{const{onDragMove:at}=Ce.current,{active:St,activatorEvent:Ot,collisions:tr,over:Qt}=Ee.current;if(!St||!Ot)return;const jt={active:St,activatorEvent:Ot,collisions:tr,delta:{x:C.x,y:C.y},over:Qt};Pe.unstable_batchedUpdates(()=>{at==null||at(jt),b({type:"onDragMove",event:jt})})},[C.x,C.y]),h.useEffect(()=>{const{active:at,activatorEvent:St,collisions:Ot,droppableContainers:tr,scrollAdjustedTranslate:Qt}=Ee.current;if(!at||L.current==null||!St||!Qt)return;const{onDragOver:jt}=Ce.current,fr=tr.get(B),Xn=fr&&fr.rect.current?{id:fr.id,rect:fr.rect.current,data:fr.data,disabled:fr.disabled}:null,ht={active:at,activatorEvent:St,collisions:Ot,delta:{x:Qt.x,y:Qt.y},over:Xn};Pe.unstable_batchedUpdates(()=>{Q(Xn),jt==null||jt(ht),b({type:"onDragOver",event:ht})})},[B]),Kt(()=>{Ee.current={activatorEvent:se,active:P,activeNode:G,collisionRect:T,collisions:k,droppableRects:te,draggableNodes:A,draggingNode:qe,draggingNodeRect:re,droppableContainers:N,over:q,scrollableAncestors:ft,scrollAdjustedTranslate:C},U.current={initial:re,translated:T}},[P,G,k,T,A,qe,re,te,N,q,ft,C]),Ny({...ee,delta:$,draggingRect:T,pointerCoordinates:fe,scrollableAncestors:ft,scrollableAncestorRects:Wt});const br=h.useMemo(()=>({active:P,activeNode:G,activeNodeRect:ae,activatorEvent:se,collisions:k,containerNodeRect:Re,dragOverlay:Ye,draggableNodes:A,droppableContainers:N,droppableRects:te,over:q,measureDroppableContainers:V,scrollableAncestors:ft,scrollableAncestorRects:Wt,measuringConfiguration:J,measuringScheduled:Z,windowRect:Je}),[P,G,ae,se,k,Re,Ye,A,N,te,q,V,ft,Wt,J,Z,Je]),zs=h.useMemo(()=>({activatorEvent:se,activators:At,active:P,activeNodeRect:ae,ariaDescribedById:{draggable:be},dispatch:m,draggableNodes:A,over:q,measureDroppableContainers:V}),[se,At,P,ae,m,be,A,q,V]);return h.createElement(nc.Provider,{value:S},h.createElement(fs.Provider,{value:zs},h.createElement(Ac.Provider,{value:br},h.createElement(gi.Provider,{value:ne},d)),h.createElement(Yy,{disabled:(a==null?void 0:a.restoreFocus)===!1})),h.createElement(ty,{...a,hiddenTextDescribedById:be}));function hn(){const at=(j==null?void 0:j.autoScrollEnabled)===!1,St=typeof c=="object"?c.enabled===!1:c===!1,Ot=D&&!at&&!St;return typeof c=="object"?{...c,enabled:Ot}:{enabled:Ot}}}),Jy=h.createContext(null),Lc="button",ev="Draggable";function Fc(e){let{id:t,data:r,disabled:n=!1,attributes:s}=e;const i=os(ev),{activators:o,activatorEvent:a,active:c,activeNodeRect:d,ariaDescribedById:u,draggableNodes:f,over:g}=h.useContext(fs),{role:y=Lc,roleDescription:_="draggable",tabIndex:p=0}=s??{},v=(c==null?void 0:c.id)===t,m=h.useContext(v?gi:Jy),[b,S]=ii(),[w,E]=ii(),D=qy(o,t),x=ss(r);Kt(()=>(f.set(t,{id:t,key:i,node:b,activatorNode:w,data:x}),()=>{const $=f.get(t);$&&$.key===i&&f.delete(t)}),[f,t]);const A=h.useMemo(()=>({role:y,tabIndex:p,"aria-disabled":n,"aria-pressed":v&&y===Lc?!0:void 0,"aria-roledescription":_,"aria-describedby":u.draggable}),[n,y,p,v,_,u.draggable]);return{active:c,activatorEvent:a,activeNodeRect:d,attributes:A,isDragging:v,listeners:n?void 0:D,node:b,over:g,setNodeRef:S,setActivatorNodeRef:E,transform:m}}function $c(){return h.useContext(Ac)}const tv="Droppable",rv={timeout:25};function nv(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:s}=e;const i=os(tv),{active:o,dispatch:a,over:c,measureDroppableContainers:d}=h.useContext(fs),u=h.useRef({disabled:r}),f=h.useRef(!1),g=h.useRef(null),y=h.useRef(null),{disabled:_,updateMeasurementsFor:p,timeout:v}={...rv,...s},m=ss(p??n),b=h.useCallback(()=>{if(!f.current){f.current=!0;return}y.current!=null&&clearTimeout(y.current),y.current=setTimeout(()=>{d(Array.isArray(m.current)?m.current:[m.current]),y.current=null},v)},[v]),S=hi({callback:b,disabled:_||!o}),w=h.useCallback((A,$)=>{S&&($&&(S.unobserve($),f.current=!1),A&&S.observe(A))},[S]),[E,D]=ii(w),x=ss(t);return h.useEffect(()=>{!S||!E.current||(S.disconnect(),f.current=!1,S.observe(E.current))},[E,S]),h.useEffect(()=>(a({type:tt.RegisterDroppable,element:{id:n,key:i,disabled:r,node:E,rect:g,data:x}}),()=>a({type:tt.UnregisterDroppable,key:i,id:n})),[n]),h.useEffect(()=>{r!==u.current.disabled&&(a({type:tt.SetDroppableDisabled,id:n,key:i,disabled:r}),u.current.disabled=r)},[n,i,r,a]),{active:o,rect:g,isOver:(c==null?void 0:c.id)===n,node:E,over:c,setNodeRef:D}}function sv(e){let{animation:t,children:r}=e;const[n,s]=h.useState(null),[i,o]=h.useState(null),a=oi(r);return!r&&!n&&a&&s(a),Kt(()=>{if(!i)return;const c=n==null?void 0:n.key,d=n==null?void 0:n.props.id;if(c==null||d==null){s(null);return}Promise.resolve(t(d,i)).then(()=>{s(null)})},[t,n,i]),h.createElement(h.Fragment,null,r,n?h.cloneElement(n,{ref:o}):null)}const iv={x:0,y:0,scaleX:1,scaleY:1};function ov(e){let{children:t}=e;return h.createElement(fs.Provider,{value:xc},h.createElement(gi.Provider,{value:iv},t))}const av={position:"fixed",touchAction:"none"},lv=e=>ai(e)?"transform 250ms ease":void 0,cv=h.forwardRef((e,t)=>{let{as:r,activatorEvent:n,adjustScale:s,children:i,className:o,rect:a,style:c,transform:d,transition:u=lv}=e;if(!a)return null;const f=s?d:{...d,scaleX:1,scaleY:1},g={...av,width:a.width,height:a.height,top:a.top,left:a.left,transform:Ir.Transform.toString(f),transformOrigin:s&&n?ry(n,a):void 0,transition:typeof u=="function"?u(n):u,...c};return h.createElement(r,{className:o,style:g,ref:t},i)}),uv={duration:250,easing:"ease",keyframes:e=>{let{transform:{initial:t,final:r}}=e;return[{transform:Ir.Transform.toString(t)},{transform:Ir.Transform.toString(r)}]},sideEffects:(e=>t=>{let{active:r,dragOverlay:n}=t;const s={},{styles:i,className:o}=e;if(i!=null&&i.active)for(const[a,c]of Object.entries(i.active))c!==void 0&&(s[a]=r.node.style.getPropertyValue(a),r.node.style.setProperty(a,c));if(i!=null&&i.dragOverlay)for(const[a,c]of Object.entries(i.dragOverlay))c!==void 0&&n.node.style.setProperty(a,c);return o!=null&&o.active&&r.node.classList.add(o.active),o!=null&&o.dragOverlay&&n.node.classList.add(o.dragOverlay),function(){for(const[c,d]of Object.entries(s))r.node.style.setProperty(c,d);o!=null&&o.active&&r.node.classList.remove(o.active)}})({styles:{active:{opacity:"0"}}})};function dv(e){let{config:t,draggableNodes:r,droppableContainers:n,measuringConfiguration:s}=e;return si((i,o)=>{if(t===null)return;const a=r.get(i);if(!a)return;const c=a.node.current;if(!c)return;const d=kc(o);if(!d)return;const{transform:u}=Ct(o).getComputedStyle(o),f=dc(u);if(!f)return;const g=typeof t=="function"?t:fv(t);return bc(c,s.draggable.measure),g({active:{id:i,data:a.data,node:c,rect:s.draggable.measure(c)},draggableNodes:r,dragOverlay:{node:o,rect:s.dragOverlay.measure(d)},droppableContainers:n,measuringConfiguration:s,transform:f})})}function fv(e){const{duration:t,easing:r,sideEffects:n,keyframes:s}={...uv,...e};return i=>{let{active:o,dragOverlay:a,transform:c,...d}=i;if(!t)return;const u={x:a.rect.left-o.rect.left,y:a.rect.top-o.rect.top},f={scaleX:c.scaleX!==1?o.rect.width*c.scaleX/a.rect.width:1,scaleY:c.scaleY!==1?o.rect.height*c.scaleY/a.rect.height:1},g={x:c.x-u.x,y:c.y-u.y,...f},y=s({...d,active:o,dragOverlay:a,transform:{initial:c,final:g}}),[_]=y,p=y[y.length-1];if(JSON.stringify(_)===JSON.stringify(p))return;const v=n==null?void 0:n({active:o,dragOverlay:a,...d}),m=a.node.animate(y,{duration:t,easing:r,fill:"forwards"});return new Promise(b=>{m.onfinish=()=>{v==null||v(),b()}})}}let jc=0;function hv(e){return h.useMemo(()=>{if(e!=null)return jc++,jc},[e])}const pv=h.memo(e=>{let{adjustScale:t=!1,children:r,dropAnimation:n,style:s,transition:i,modifiers:o,wrapperElement:a="div",className:c,zIndex:d=999}=e;const{activatorEvent:u,active:f,activeNodeRect:g,containerNodeRect:y,draggableNodes:_,droppableContainers:p,dragOverlay:v,over:m,measuringConfiguration:b,scrollableAncestors:S,scrollableAncestorRects:w,windowRect:E}=$c(),D=h.useContext(gi),x=hv(f==null?void 0:f.id),A=Pc(o,{activatorEvent:u,active:f,activeNodeRect:g,containerNodeRect:y,draggingNodeRect:v.rect,over:m,overlayNodeRect:v.rect,scrollableAncestors:S,scrollableAncestorRects:w,transform:D,windowRect:E}),$=Vo(g),N=dv({config:n,draggableNodes:_,droppableContainers:p,measuringConfiguration:b}),M=$?v.setRef:void 0;return h.createElement(ov,null,h.createElement(sv,{animation:N},f&&x?h.createElement(cv,{key:x,id:f.id,ref:M,as:a,activatorEvent:u,adjustScale:t,className:c,transition:i,rect:$,style:{zIndex:d,...s},transform:A},r):null))});/**
181
+ `},lm={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 cm(e){let{announcements:t=lm,container:r,hiddenTextDescribedById:n,screenReaderInstructions:o=sm}=e;const{announce:a,announcement:i}=om(),s=lo("DndLiveRegion"),[l,d]=h.useState(!1);if(h.useEffect(()=>{d(!0)},[]),am(h.useMemo(()=>({onDragStart(u){let{active:m}=u;a(t.onDragStart({active:m}))},onDragMove(u){let{active:m,over:g}=u;t.onDragMove&&a(t.onDragMove({active:m,over:g}))},onDragOver(u){let{active:m,over:g}=u;a(t.onDragOver({active:m,over:g}))},onDragEnd(u){let{active:m,over:g}=u;a(t.onDragEnd({active:m,over:g}))},onDragCancel(u){let{active:m,over:g}=u;a(t.onDragCancel({active:m,over:g}))}}),[a,t])),!l)return null;const f=h.createElement(h.Fragment,null,h.createElement(rm,{id:n,value:o.draggable}),h.createElement(nm,{id:s,announcement:i}));return r?Pe.createPortal(f,r):f}var nt;(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"})(nt||(nt={}));function fa(){}function Pi(e,t){return h.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function fc(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return h.useMemo(()=>[...t].filter(n=>n!=null),[...t])}const Zt=Object.freeze({x:0,y:0});function hc(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function dm(e,t){const r=ua(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 pc(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return r-n}function um(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return n-r}function gc(e){let{left:t,top:r,height:n,width:o}=e;return[{x:t,y:r},{x:t+o,y:r},{x:t,y:r+n},{x:t+o,y:r+n}]}function mc(e,t){if(!e||e.length===0)return null;const[r]=e;return r[t]}function yc(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 fm=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const o=yc(t,t.left,t.top),a=[];for(const i of n){const{id:s}=i,l=r.get(s);if(l){const d=hc(yc(l),o);a.push({id:s,data:{droppableContainer:i,value:d}})}}return a.sort(pc)},hm=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const o=gc(t),a=[];for(const i of n){const{id:s}=i,l=r.get(s);if(l){const d=gc(l),f=o.reduce((m,g,w)=>m+hc(d[w],g),0),u=Number((f/4).toFixed(4));a.push({id:s,data:{droppableContainer:i,value:u}})}}return a.sort(pc)};function pm(e,t){const r=Math.max(t.top,e.top),n=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),i=o-n,s=a-r;if(n<o&&r<a){const l=t.width*t.height,d=e.width*e.height,f=i*s,u=f/(l+d-f);return Number(u.toFixed(4))}return 0}const gm=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const o=[];for(const a of n){const{id:i}=a,s=r.get(i);if(s){const l=pm(s,t);l>0&&o.push({id:i,data:{droppableContainer:a,value:l}})}}return o.sort(um)};function mm(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function vc(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Zt}function ym(e){return function(r){for(var n=arguments.length,o=new Array(n>1?n-1:0),a=1;a<n;a++)o[a-1]=arguments[a];return o.reduce((i,s)=>({...i,top:i.top+e*s.y,bottom:i.bottom+e*s.y,left:i.left+e*s.x,right:i.right+e*s.x}),{...r})}}const vm=ym(1);function bc(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 bm(e,t,r){const n=bc(t);if(!n)return e;const{scaleX:o,scaleY:a,x:i,y:s}=n,l=e.left-i-(1-o)*parseFloat(r),d=e.top-s-(1-a)*parseFloat(r.slice(r.indexOf(" ")+1)),f=o?e.width/o:e.width,u=a?e.height/a:e.height;return{width:f,height:u,top:d,right:l+f,bottom:d+u,left:l}}const wm={ignoreTransform:!1};function bn(e,t){t===void 0&&(t=wm);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:f}=Tt(e).getComputedStyle(e);d&&(r=bm(r,d,f))}const{top:n,left:o,width:a,height:i,bottom:s,right:l}=r;return{top:n,left:o,width:a,height:i,bottom:s,right:l}}function wc(e){return bn(e,{ignoreTransform:!0})}function Cm(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function Sm(e,t){return t===void 0&&(t=Tt(e).getComputedStyle(e)),t.position==="fixed"}function _m(e,t){t===void 0&&(t=Tt(e).getComputedStyle(e));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const a=t[o];return typeof a=="string"?r.test(a):!1})}function ha(e,t){const r=[];function n(o){if(t!=null&&r.length>=t||!o)return r;if(xi(o)&&o.scrollingElement!=null&&!r.includes(o.scrollingElement))return r.push(o.scrollingElement),r;if(!ao(o)||lc(o)||r.includes(o))return r;const a=Tt(e).getComputedStyle(o);return o!==e&&_m(o,a)&&r.push(o),Sm(o,a)?r:n(o.parentNode)}return e?n(e):r}function Cc(e){const[t]=ha(e,1);return t??null}function Fi(e){return!ia||!e?null:mn(e)?e:ki(e)?xi(e)||e===yn(e).scrollingElement?window:ao(e)?e:null:null}function Sc(e){return mn(e)?e.scrollX:e.scrollLeft}function _c(e){return mn(e)?e.scrollY:e.scrollTop}function Mi(e){return{x:Sc(e),y:_c(e)}}var ot;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(ot||(ot={}));function Tc(e){return!ia||!e?!1:e===document.scrollingElement}function Ec(e){const t={x:0,y:0},r=Tc(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},n={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height},o=e.scrollTop<=t.y,a=e.scrollLeft<=t.x,i=e.scrollTop>=n.y,s=e.scrollLeft>=n.x;return{isTop:o,isLeft:a,isBottom:i,isRight:s,maxScroll:n,minScroll:t}}const Tm={x:.2,y:.2};function Em(e,t,r,n,o){let{top:a,left:i,right:s,bottom:l}=r;n===void 0&&(n=10),o===void 0&&(o=Tm);const{isTop:d,isBottom:f,isLeft:u,isRight:m}=Ec(e),g={x:0,y:0},w={x:0,y:0},p={height:t.height*o.y,width:t.width*o.x};return!d&&a<=t.top+p.height?(g.y=ot.Backward,w.y=n*Math.abs((t.top+p.height-a)/p.height)):!f&&l>=t.bottom-p.height&&(g.y=ot.Forward,w.y=n*Math.abs((t.bottom-p.height-l)/p.height)),!m&&s>=t.right-p.width?(g.x=ot.Forward,w.x=n*Math.abs((t.right-p.width-s)/p.width)):!u&&i<=t.left+p.width&&(g.x=ot.Backward,w.x=n*Math.abs((t.left+p.width-i)/p.width)),{direction:g,speed:w}}function Im(e){if(e===document.scrollingElement){const{innerWidth:a,innerHeight:i}=window;return{top:0,left:0,right:a,bottom:i,width:a,height:i}}const{top:t,left:r,right:n,bottom:o}=e.getBoundingClientRect();return{top:t,left:r,right:n,bottom:o,width:e.clientWidth,height:e.clientHeight}}function Ic(e){return e.reduce((t,r)=>vn(t,Mi(r)),Zt)}function Om(e){return e.reduce((t,r)=>t+Sc(r),0)}function Am(e){return e.reduce((t,r)=>t+_c(r),0)}function Oc(e,t){if(t===void 0&&(t=bn),!e)return;const{top:r,left:n,bottom:o,right:a}=t(e);Cc(e)&&(o<=0||a<=0||r>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Dm=[["x",["left","right"],Om],["y",["top","bottom"],Am]];class $i{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=ha(r),o=Ic(n);this.rect={...t},this.width=t.width,this.height=t.height;for(const[a,i,s]of Dm)for(const l of i)Object.defineProperty(this,l,{get:()=>{const d=s(n),f=o[a]-d;return this.rect[l]+f},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class uo{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 o;(o=this.target)==null||o.addEventListener(t,r,n),this.listeners.push([t,r,n])}}function Nm(e){const{EventTarget:t}=Tt(e);return e instanceof t?e:yn(e)}function Bi(e,t){const r=Math.abs(e.x),n=Math.abs(e.y);return typeof t=="number"?Math.sqrt(r**2+n**2)>t:"x"in t&&"y"in t?r>t.x&&n>t.y:"x"in t?r>t.x:"y"in t?n>t.y:!1}var Ut;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Ut||(Ut={}));function Ac(e){e.preventDefault()}function km(e){e.stopPropagation()}var _e;(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"})(_e||(_e={}));const Dc={start:[_e.Space,_e.Enter],cancel:[_e.Esc],end:[_e.Space,_e.Enter,_e.Tab]},xm=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case _e.Right:return{...r,x:r.x+25};case _e.Left:return{...r,x:r.x-25};case _e.Down:return{...r,y:r.y+25};case _e.Up:return{...r,y:r.y-25}}};class ji{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 uo(yn(r)),this.windowListeners=new uo(Tt(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Ut.Resize,this.handleCancel),this.windowListeners.add(Ut.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Ut.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,n=t.node.current;n&&Oc(n),r(Zt)}handleKeyDown(t){if(da(t)){const{active:r,context:n,options:o}=this.props,{keyboardCodes:a=Dc,coordinateGetter:i=xm,scrollBehavior:s="smooth"}=o,{code:l}=t;if(a.end.includes(l)){this.handleEnd(t);return}if(a.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:d}=n.current,f=d?{x:d.left,y:d.top}:Zt;this.referenceCoordinates||(this.referenceCoordinates=f);const u=i(t,{active:r,context:n.current,currentCoordinates:f});if(u){const m=co(u,f),g={x:0,y:0},{scrollableAncestors:w}=n.current;for(const p of w){const y=t.code,{isTop:v,isRight:b,isLeft:C,isBottom:S,maxScroll:T,minScroll:I}=Ec(p),k=Im(p),x={x:Math.min(y===_e.Right?k.right-k.width/2:k.right,Math.max(y===_e.Right?k.left:k.left+k.width/2,u.x)),y:Math.min(y===_e.Down?k.bottom-k.height/2:k.bottom,Math.max(y===_e.Down?k.top:k.top+k.height/2,u.y))},$=y===_e.Right&&!b||y===_e.Left&&!C,j=y===_e.Down&&!S||y===_e.Up&&!v;if($&&x.x!==u.x){const N=p.scrollLeft+m.x,L=y===_e.Right&&N<=T.x||y===_e.Left&&N>=I.x;if(L&&!m.y){p.scrollTo({left:N,behavior:s});return}L?g.x=p.scrollLeft-N:g.x=y===_e.Right?p.scrollLeft-T.x:p.scrollLeft-I.x,g.x&&p.scrollBy({left:-g.x,behavior:s});break}else if(j&&x.y!==u.y){const N=p.scrollTop+m.y,L=y===_e.Down&&N<=T.y||y===_e.Up&&N>=I.y;if(L&&!m.x){p.scrollTo({top:N,behavior:s});return}L?g.y=p.scrollTop-N:g.y=y===_e.Down?p.scrollTop-T.y:p.scrollTop-I.y,g.y&&p.scrollBy({top:-g.y,behavior:s});break}}this.handleMove(t,vn(co(u,this.referenceCoordinates),g))}}}handleMove(t,r){const{onMove:n}=this.props;t.preventDefault(),n(r)}handleEnd(t){const{onEnd:r}=this.props;t.preventDefault(),this.detach(),r()}handleCancel(t){const{onCancel:r}=this.props;t.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}ji.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:n=Dc,onActivation:o}=t,{active:a}=r;const{code:i}=e.nativeEvent;if(n.start.includes(i)){const s=a.activatorNode.current;return s&&e.target!==s?!1:(e.preventDefault(),o==null||o({event:e.nativeEvent}),!0)}return!1}}];function Nc(e){return!!(e&&"distance"in e)}function kc(e){return!!(e&&"delay"in e)}class qi{constructor(t,r,n){var o;n===void 0&&(n=Nm(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:a}=t,{target:i}=a;this.props=t,this.events=r,this.document=yn(i),this.documentListeners=new uo(this.document),this.listeners=new uo(n),this.windowListeners=new uo(Tt(i)),this.initialCoordinates=(o=ua(a))!=null?o:Zt,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:r,bypassActivationConstraint:n}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Ut.Resize,this.handleCancel),this.windowListeners.add(Ut.DragStart,Ac),this.windowListeners.add(Ut.VisibilityChange,this.handleCancel),this.windowListeners.add(Ut.ContextMenu,Ac),this.documentListeners.add(Ut.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(kc(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(Nc(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:o}=this.props;o(n,t,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:t}=this,{onStart:r}=this.props;t&&(this.activated=!0,this.documentListeners.add(Ut.Click,km,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Ut.SelectionChange,this.removeTextSelection),r(t))}handleMove(t){var r;const{activated:n,initialCoordinates:o,props:a}=this,{onMove:i,options:{activationConstraint:s}}=a;if(!o)return;const l=(r=ua(t))!=null?r:Zt,d=co(o,l);if(!n&&s){if(Nc(s)){if(s.tolerance!=null&&Bi(d,s.tolerance))return this.handleCancel();if(Bi(d,s.distance))return this.handleStart()}if(kc(s)&&Bi(d,s.tolerance))return this.handleCancel();this.handlePending(s,d);return}t.cancelable&&t.preventDefault(),i(l)}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===_e.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Lm={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class pa extends qi{constructor(t){const{event:r}=t,n=yn(r.target);super(t,Lm,n)}}pa.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 Pm={move:{name:"mousemove"},end:{name:"mouseup"}};var Ui;(function(e){e[e.RightClick=2]="RightClick"})(Ui||(Ui={}));class Fm extends qi{constructor(t){super(t,Pm,yn(t.event.target))}}Fm.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return r.button===Ui.RightClick?!1:(n==null||n({event:r}),!0)}}];const zi={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Mm extends qi{constructor(t){super(t,zi)}static setup(){return window.addEventListener(zi.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(zi.move.name,t)};function t(){}}}Mm.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;const{touches:o}=r;return o.length>1?!1:(n==null||n({event:r}),!0)}}];var fo;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(fo||(fo={}));var ga;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(ga||(ga={}));function $m(e){let{acceleration:t,activator:r=fo.Pointer,canScroll:n,draggingRect:o,enabled:a,interval:i=5,order:s=ga.TreeOrder,pointerCoordinates:l,scrollableAncestors:d,scrollableAncestorRects:f,delta:u,threshold:m}=e;const g=jm({delta:u,disabled:!a}),[w,p]=Zg(),y=h.useRef({x:0,y:0}),v=h.useRef({x:0,y:0}),b=h.useMemo(()=>{switch(r){case fo.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case fo.DraggableRect:return o}},[r,o,l]),C=h.useRef(null),S=h.useCallback(()=>{const I=C.current;if(!I)return;const k=y.current.x*v.current.x,x=y.current.y*v.current.y;I.scrollBy(k,x)},[]),T=h.useMemo(()=>s===ga.TreeOrder?[...d].reverse():d,[s,d]);h.useEffect(()=>{if(!a||!d.length||!b){p();return}for(const I of T){if((n==null?void 0:n(I))===!1)continue;const k=d.indexOf(I),x=f[k];if(!x)continue;const{direction:$,speed:j}=Em(I,x,b,t,m);for(const N of["x","y"])g[N][$[N]]||(j[N]=0,$[N]=0);if(j.x>0||j.y>0){p(),C.current=I,w(S,i),y.current=j,v.current=$;return}}y.current={x:0,y:0},v.current={x:0,y:0},p()},[t,S,n,p,a,i,JSON.stringify(b),JSON.stringify(g),w,d,T,f,JSON.stringify(m)])}const Bm={x:{[ot.Backward]:!1,[ot.Forward]:!1},y:{[ot.Backward]:!1,[ot.Forward]:!1}};function jm(e){let{delta:t,disabled:r}=e;const n=ca(t);return so(o=>{if(r||!n||!o)return Bm;const a={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[ot.Backward]:o.x[ot.Backward]||a.x===-1,[ot.Forward]:o.x[ot.Forward]||a.x===1},y:{[ot.Backward]:o.y[ot.Backward]||a.y===-1,[ot.Forward]:o.y[ot.Forward]||a.y===1}}},[r,t,n])}function qm(e,t){const r=t!=null?e.get(t):void 0,n=r?r.node.current:null;return so(o=>{var a;return t==null?null:(a=n??o)!=null?a:null},[n,t])}function Um(e,t){return h.useMemo(()=>e.reduce((r,n)=>{const{sensor:o}=n,a=o.activators.map(i=>({eventName:i.eventName,handler:t(i.handler,n)}));return[...r,...a]},[]),[e,t])}var ho;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(ho||(ho={}));var Vi;(function(e){e.Optimized="optimized"})(Vi||(Vi={}));const xc=new Map;function zm(e,t){let{dragging:r,dependencies:n,config:o}=t;const[a,i]=h.useState(null),{frequency:s,measure:l,strategy:d}=o,f=h.useRef(e),u=y(),m=io(u),g=h.useCallback(function(v){v===void 0&&(v=[]),!m.current&&i(b=>b===null?v:b.concat(v.filter(C=>!b.includes(C))))},[m]),w=h.useRef(null),p=so(v=>{if(u&&!r)return xc;if(!v||v===xc||f.current!==e||a!=null){const b=new Map;for(let C of e){if(!C)continue;if(a&&a.length>0&&!a.includes(C.id)&&C.rect.current){b.set(C.id,C.rect.current);continue}const S=C.node.current,T=S?new $i(l(S),S):null;C.rect.current=T,T&&b.set(C.id,T)}return b}return v},[e,a,r,u,l]);return h.useEffect(()=>{f.current=e},[e]),h.useEffect(()=>{u||g()},[r,u]),h.useEffect(()=>{a&&a.length>0&&i(null)},[JSON.stringify(a)]),h.useEffect(()=>{u||typeof s!="number"||w.current!==null||(w.current=setTimeout(()=>{g(),w.current=null},s))},[s,u,g,...n]),{droppableRects:p,measureDroppableContainers:g,measuringScheduled:a!=null};function y(){switch(d){case ho.Always:return!1;case ho.BeforeDragging:return r;default:return!r}}}function Hi(e,t){return so(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function Vm(e,t){return Hi(e,t)}function Hm(e){let{callback:t,disabled:r}=e;const n=sa(t),o=h.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:a}=window;return new a(n)},[n,r]);return h.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function ma(e){let{callback:t,disabled:r}=e;const n=sa(t),o=h.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:a}=window;return new a(n)},[r]);return h.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function Rm(e){return new $i(bn(e),e)}function Lc(e,t,r){t===void 0&&(t=Rm);const[n,o]=h.useState(null);function a(){o(l=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=l??r)!=null?d:null}const f=t(e);return JSON.stringify(l)===JSON.stringify(f)?l:f})}const i=Hm({callback(l){if(e)for(const d of l){const{type:f,target:u}=d;if(f==="childList"&&u instanceof HTMLElement&&u.contains(e)){a();break}}}}),s=ma({callback:a});return Yt(()=>{a(),e?(s==null||s.observe(e),i==null||i.observe(document.body,{childList:!0,subtree:!0})):(s==null||s.disconnect(),i==null||i.disconnect())},[e]),n}function Qm(e){const t=Hi(e);return vc(e,t)}const Pc=[];function Gm(e){const t=h.useRef(e),r=so(n=>e?n&&n!==Pc&&e&&t.current&&e.parentNode===t.current.parentNode?n:ha(e):Pc,[e]);return h.useEffect(()=>{t.current=e},[e]),r}function Wm(e){const[t,r]=h.useState(null),n=h.useRef(e),o=h.useCallback(a=>{const i=Fi(a.target);i&&r(s=>s?(s.set(i,Mi(i)),new Map(s)):null)},[]);return h.useEffect(()=>{const a=n.current;if(e!==a){i(a);const s=e.map(l=>{const d=Fi(l);return d?(d.addEventListener("scroll",o,{passive:!0}),[d,Mi(d)]):null}).filter(l=>l!=null);r(s.length?new Map(s):null),n.current=e}return()=>{i(e),i(a)};function i(s){s.forEach(l=>{const d=Fi(l);d==null||d.removeEventListener("scroll",o)})}},[o,e]),h.useMemo(()=>e.length?t?Array.from(t.values()).reduce((a,i)=>vn(a,i),Zt):Ic(e):Zt,[e,t])}function Fc(e,t){t===void 0&&(t=[]);const r=h.useRef(null);return h.useEffect(()=>{r.current=null},t),h.useEffect(()=>{const n=e!==Zt;n&&!r.current&&(r.current=e),!n&&r.current&&(r.current=null)},[e]),r.current?co(e,r.current):Zt}function Km(e){h.useEffect(()=>{if(!ia)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 Ym(e,t){return h.useMemo(()=>e.reduce((r,n)=>{let{eventName:o,handler:a}=n;return r[o]=i=>{a(i,t)},r},{}),[e,t])}function Mc(e){return h.useMemo(()=>e?Cm(e):null,[e])}const $c=[];function Zm(e,t){t===void 0&&(t=bn);const[r]=e,n=Mc(r?Tt(r):null),[o,a]=h.useState($c);function i(){a(()=>e.length?e.map(l=>Tc(l)?n:new $i(t(l),l)):$c)}const s=ma({callback:i});return Yt(()=>{s==null||s.disconnect(),i(),e.forEach(l=>s==null?void 0:s.observe(l))},[e]),o}function Bc(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return ao(t)?t:e}function Xm(e){let{measure:t}=e;const[r,n]=h.useState(null),o=h.useCallback(d=>{for(const{target:f}of d)if(ao(f)){n(u=>{const m=t(f);return u?{...u,width:m.width,height:m.height}:m});break}},[t]),a=ma({callback:o}),i=h.useCallback(d=>{const f=Bc(d);a==null||a.disconnect(),f&&(a==null||a.observe(f)),n(f?t(f):null)},[t,a]),[s,l]=la(i);return h.useMemo(()=>({nodeRef:s,rect:r,setRef:l}),[r,s,l])}const Jm=[{sensor:pa,options:{}},{sensor:ji,options:{}}],ey={current:{}},ya={draggable:{measure:wc},droppable:{measure:wc,strategy:ho.WhileDragging,frequency:Vi.Optimized},dragOverlay:{measure:bn}};class po 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 ty={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new po,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:fa},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ya,measureDroppableContainers:fa,windowRect:null,measuringScheduled:!1},jc={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:fa,draggableNodes:new Map,over:null,measureDroppableContainers:fa},go=h.createContext(jc),qc=h.createContext(ty);function ry(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new po}}}function ny(e,t){switch(t.type){case nt.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case nt.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 nt.DragEnd:case nt.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case nt.RegisterDroppable:{const{element:r}=t,{id:n}=r,o=new po(e.droppable.containers);return o.set(n,r),{...e,droppable:{...e.droppable,containers:o}}}case nt.SetDroppableDisabled:{const{id:r,key:n,disabled:o}=t,a=e.droppable.containers.get(r);if(!a||n!==a.key)return e;const i=new po(e.droppable.containers);return i.set(r,{...a,disabled:o}),{...e,droppable:{...e.droppable,containers:i}}}case nt.UnregisterDroppable:{const{id:r,key:n}=t,o=e.droppable.containers.get(r);if(!o||n!==o.key)return e;const a=new po(e.droppable.containers);return a.delete(r),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function oy(e){let{disabled:t}=e;const{active:r,activatorEvent:n,draggableNodes:o}=h.useContext(go),a=ca(n),i=ca(r==null?void 0:r.id);return h.useEffect(()=>{if(!t&&!n&&a&&i!=null){if(!da(a)||document.activeElement===a.target)return;const s=o.get(i);if(!s)return;const{activatorNode:l,node:d}=s;if(!l.current&&!d.current)return;requestAnimationFrame(()=>{for(const f of[l.current,d.current]){if(!f)continue;const u=em(f);if(u){u.focus();break}}})}},[n,t,o,i,a]),null}function Uc(e,t){let{transform:r,...n}=t;return e!=null&&e.length?e.reduce((o,a)=>a({transform:o,...n}),r):r}function ay(e){return h.useMemo(()=>({draggable:{...ya.draggable,...e==null?void 0:e.draggable},droppable:{...ya.droppable,...e==null?void 0:e.droppable},dragOverlay:{...ya.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 iy(e){let{activeNode:t,measure:r,initialRect:n,config:o=!0}=e;const a=h.useRef(!1),{x:i,y:s}=typeof o=="boolean"?{x:o,y:o}:o;Yt(()=>{if(!i&&!s||!t){a.current=!1;return}if(a.current||!n)return;const d=t==null?void 0:t.node.current;if(!d||d.isConnected===!1)return;const f=r(d),u=vc(f,n);if(i||(u.x=0),s||(u.y=0),a.current=!0,Math.abs(u.x)>0||Math.abs(u.y)>0){const m=Cc(d);m&&m.scrollBy({top:u.y,left:u.x})}},[t,i,s,n,r])}const va=h.createContext({...Zt,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 zc=h.memo(function(t){var r,n,o,a;let{id:i,accessibility:s,autoScroll:l=!0,children:d,sensors:f=Jm,collisionDetection:u=gm,measuring:m,modifiers:g,...w}=t;const p=h.useReducer(ny,void 0,ry),[y,v]=p,[b,C]=im(),[S,T]=h.useState(Dr.Uninitialized),I=S===Dr.Initialized,{draggable:{active:k,nodes:x,translate:$},droppable:{containers:j}}=y,N=k!=null?x.get(k):null,L=h.useRef({initial:null,translated:null}),B=h.useMemo(()=>{var ct;return k!=null?{id:k,data:(ct=N==null?void 0:N.data)!=null?ct:ey,rect:L}:null},[k,N]),P=h.useRef(null),[F,V]=h.useState(null),[X,ve]=h.useState(null),Ee=io(w,Object.values(w)),Ce=lo("DndDescribedBy",i),ue=h.useMemo(()=>j.getEnabled(),[j]),Q=ay(m),{droppableRects:ne,measureDroppableContainers:te,measuringScheduled:U}=zm(ue,{dragging:I,dependencies:[$.x,$.y],config:Q.droppable}),H=qm(x,k),ae=h.useMemo(()=>X?ua(X):null,[X]),fe=pn(),J=Vm(H,Q.draggable.measure);iy({activeNode:k!=null?x.get(k):null,config:fe.layoutShiftCompensation,initialRect:J,measure:Q.draggable.measure});const oe=Lc(H,Q.draggable.measure,J),Me=Lc(H?H.parentElement:null),Oe=h.useRef({activatorEvent:null,active:null,activeNode:H,collisionRect:null,collisions:null,droppableRects:ne,draggableNodes:x,draggingNode:null,draggingNodeRect:null,droppableContainers:j,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ze=j.getNodeFor((r=Oe.current.over)==null?void 0:r.id),We=Xm({measure:Q.dragOverlay.measure}),Ve=(n=We.nodeRef.current)!=null?n:H,re=I?(o=We.rect)!=null?o:oe:null,Ke=!!(We.nodeRef.current&&We.rect),Re=Qm(Ke?null:oe),He=Mc(Ve?Tt(Ve):null),et=Gm(I?ze??H:null),Gt=Zm(et),It=Uc(g,{transform:{x:$.x-Re.x,y:$.y-Re.y,scaleX:1,scaleY:1},activatorEvent:X,active:B,activeNodeRect:oe,containerNodeRect:Me,draggingNodeRect:re,over:Oe.current.over,overlayNodeRect:We.rect,scrollableAncestors:et,scrollableAncestorRects:Gt,windowRect:He}),K=ae?vn(ae,$):null,ge=Wm(et),we=Fc(ge),Wt=Fc(ge,[oe]),_=vn(It,we),A=re?vm(re,It):null,D=B&&A?u({active:B,collisionRect:A,droppableRects:ne,droppableContainers:ue,pointerCoordinates:K}):null,z=mc(D,"id"),[q,G]=h.useState(null),R=Ke?It:vn(It,Wt),ee=mm(R,(a=q==null?void 0:q.rect)!=null?a:null,oe),ye=h.useRef(null),Ye=h.useCallback((ct,_t)=>{let{sensor:Ot,options:or}=_t;if(P.current==null)return;const Kt=x.get(P.current);if(!Kt)return;const qt=ct.nativeEvent,pr=new Ot({active:P.current,activeNode:Kt,event:qt,options:or,context:Oe,onAbort(pt){if(!x.get(pt))return;const{onDragAbort:gr}=Ee.current,Sr={id:pt};gr==null||gr(Sr),b({type:"onDragAbort",event:Sr})},onPending(pt,Ur,gr,Sr){if(!x.get(pt))return;const{onDragPending:Wo}=Ee.current,zr={id:pt,constraint:Ur,initialCoordinates:gr,offset:Sr};Wo==null||Wo(zr),b({type:"onDragPending",event:zr})},onStart(pt){const Ur=P.current;if(Ur==null)return;const gr=x.get(Ur);if(!gr)return;const{onDragStart:Sr}=Ee.current,Go={activatorEvent:qt,active:{id:Ur,data:gr.data,rect:L}};Pe.unstable_batchedUpdates(()=>{Sr==null||Sr(Go),T(Dr.Initializing),v({type:nt.DragStart,initialCoordinates:pt,active:Ur}),b({type:"onDragStart",event:Go}),V(ye.current),ve(qt)})},onMove(pt){v({type:nt.DragMove,coordinates:pt})},onEnd:Jn(nt.DragEnd),onCancel:Jn(nt.DragCancel)});ye.current=pr;function Jn(pt){return async function(){const{active:gr,collisions:Sr,over:Go,scrollAdjustedTranslate:Wo}=Oe.current;let zr=null;if(gr&&Wo){const{cancelDrop:Ko}=Ee.current;zr={activatorEvent:qt,active:gr,collisions:Sr,delta:Wo,over:Go},pt===nt.DragEnd&&typeof Ko=="function"&&await Promise.resolve(Ko(zr))&&(pt=nt.DragCancel)}P.current=null,Pe.unstable_batchedUpdates(()=>{v({type:pt}),T(Dr.Uninitialized),G(null),V(null),ve(null),ye.current=null;const Ko=pt===nt.DragEnd?"onDragEnd":"onDragCancel";if(zr){const Il=Ee.current[Ko];Il==null||Il(zr),b({type:Ko,event:zr})}})}}},[x]),Lt=h.useCallback((ct,_t)=>(Ot,or)=>{const Kt=Ot.nativeEvent,qt=x.get(or);if(P.current!==null||!qt||Kt.dndKit||Kt.defaultPrevented)return;const pr={active:qt};ct(Ot,_t.options,pr)===!0&&(Kt.dndKit={capturedBy:_t.sensor},P.current=or,Ye(Ot,_t))},[x,Ye]),Pt=Um(f,Lt);Km(f),Yt(()=>{oe&&S===Dr.Initializing&&T(Dr.Initialized)},[oe,S]),h.useEffect(()=>{const{onDragMove:ct}=Ee.current,{active:_t,activatorEvent:Ot,collisions:or,over:Kt}=Oe.current;if(!_t||!Ot)return;const qt={active:_t,activatorEvent:Ot,collisions:or,delta:{x:_.x,y:_.y},over:Kt};Pe.unstable_batchedUpdates(()=>{ct==null||ct(qt),b({type:"onDragMove",event:qt})})},[_.x,_.y]),h.useEffect(()=>{const{active:ct,activatorEvent:_t,collisions:Ot,droppableContainers:or,scrollAdjustedTranslate:Kt}=Oe.current;if(!ct||P.current==null||!_t||!Kt)return;const{onDragOver:qt}=Ee.current,pr=or.get(z),Jn=pr&&pr.rect.current?{id:pr.id,rect:pr.rect.current,data:pr.data,disabled:pr.disabled}:null,pt={active:ct,activatorEvent:_t,collisions:Ot,delta:{x:Kt.x,y:Kt.y},over:Jn};Pe.unstable_batchedUpdates(()=>{G(Jn),qt==null||qt(pt),b({type:"onDragOver",event:pt})})},[z]),Yt(()=>{Oe.current={activatorEvent:X,active:B,activeNode:H,collisionRect:A,collisions:D,droppableRects:ne,draggableNodes:x,draggingNode:Ve,draggingNodeRect:re,droppableContainers:j,over:q,scrollableAncestors:et,scrollAdjustedTranslate:_},L.current={initial:re,translated:A}},[B,H,D,A,x,Ve,re,ne,j,q,et,_]),$m({...fe,delta:$,draggingRect:A,pointerCoordinates:K,scrollableAncestors:et,scrollableAncestorRects:Gt});const Cr=h.useMemo(()=>({active:B,activeNode:H,activeNodeRect:oe,activatorEvent:X,collisions:D,containerNodeRect:Me,dragOverlay:We,draggableNodes:x,droppableContainers:j,droppableRects:ne,over:q,measureDroppableContainers:te,scrollableAncestors:et,scrollableAncestorRects:Gt,measuringConfiguration:Q,measuringScheduled:U,windowRect:He}),[B,H,oe,X,D,Me,We,x,j,ne,q,te,et,Gt,Q,U,He]),Qo=h.useMemo(()=>({activatorEvent:X,activators:Pt,active:B,activeNodeRect:oe,ariaDescribedById:{draggable:Ce},dispatch:v,draggableNodes:x,over:q,measureDroppableContainers:te}),[X,Pt,B,oe,v,Ce,x,q,te]);return h.createElement(uc.Provider,{value:C},h.createElement(go.Provider,{value:Qo},h.createElement(qc.Provider,{value:Cr},h.createElement(va.Provider,{value:ee},d)),h.createElement(oy,{disabled:(s==null?void 0:s.restoreFocus)===!1})),h.createElement(cm,{...s,hiddenTextDescribedById:Ce}));function pn(){const ct=(F==null?void 0:F.autoScrollEnabled)===!1,_t=typeof l=="object"?l.enabled===!1:l===!1,Ot=I&&!ct&&!_t;return typeof l=="object"?{...l,enabled:Ot}:{enabled:Ot}}}),sy=h.createContext(null),Vc="button",ly="Draggable";function Hc(e){let{id:t,data:r,disabled:n=!1,attributes:o}=e;const a=lo(ly),{activators:i,activatorEvent:s,active:l,activeNodeRect:d,ariaDescribedById:f,draggableNodes:u,over:m}=h.useContext(go),{role:g=Vc,roleDescription:w="draggable",tabIndex:p=0}=o??{},y=(l==null?void 0:l.id)===t,v=h.useContext(y?va:sy),[b,C]=la(),[S,T]=la(),I=Ym(i,t),k=io(r);Yt(()=>(u.set(t,{id:t,key:a,node:b,activatorNode:S,data:k}),()=>{const $=u.get(t);$&&$.key===a&&u.delete(t)}),[u,t]);const x=h.useMemo(()=>({role:g,tabIndex:p,"aria-disabled":n,"aria-pressed":y&&g===Vc?!0:void 0,"aria-roledescription":w,"aria-describedby":f.draggable}),[n,g,p,y,w,f.draggable]);return{active:l,activatorEvent:s,activeNodeRect:d,attributes:x,isDragging:y,listeners:n?void 0:I,node:b,over:m,setNodeRef:C,setActivatorNodeRef:T,transform:v}}function Rc(){return h.useContext(qc)}const cy="Droppable",dy={timeout:25};function uy(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:o}=e;const a=lo(cy),{active:i,dispatch:s,over:l,measureDroppableContainers:d}=h.useContext(go),f=h.useRef({disabled:r}),u=h.useRef(!1),m=h.useRef(null),g=h.useRef(null),{disabled:w,updateMeasurementsFor:p,timeout:y}={...dy,...o},v=io(p??n),b=h.useCallback(()=>{if(!u.current){u.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{d(Array.isArray(v.current)?v.current:[v.current]),g.current=null},y)},[y]),C=ma({callback:b,disabled:w||!i}),S=h.useCallback((x,$)=>{C&&($&&(C.unobserve($),u.current=!1),x&&C.observe(x))},[C]),[T,I]=la(S),k=io(t);return h.useEffect(()=>{!C||!T.current||(C.disconnect(),u.current=!1,C.observe(T.current))},[T,C]),h.useEffect(()=>(s({type:nt.RegisterDroppable,element:{id:n,key:a,disabled:r,node:T,rect:m,data:k}}),()=>s({type:nt.UnregisterDroppable,key:a,id:n})),[n]),h.useEffect(()=>{r!==f.current.disabled&&(s({type:nt.SetDroppableDisabled,id:n,key:a,disabled:r}),f.current.disabled=r)},[n,a,r,s]),{active:i,rect:m,isOver:(l==null?void 0:l.id)===n,node:T,over:l,setNodeRef:I}}function fy(e){let{animation:t,children:r}=e;const[n,o]=h.useState(null),[a,i]=h.useState(null),s=ca(r);return!r&&!n&&s&&o(s),Yt(()=>{if(!a)return;const l=n==null?void 0:n.key,d=n==null?void 0:n.props.id;if(l==null||d==null){o(null);return}Promise.resolve(t(d,a)).then(()=>{o(null)})},[t,n,a]),h.createElement(h.Fragment,null,r,n?h.cloneElement(n,{ref:i}):null)}const hy={x:0,y:0,scaleX:1,scaleY:1};function py(e){let{children:t}=e;return h.createElement(go.Provider,{value:jc},h.createElement(va.Provider,{value:hy},t))}const gy={position:"fixed",touchAction:"none"},my=e=>da(e)?"transform 250ms ease":void 0,yy=h.forwardRef((e,t)=>{let{as:r,activatorEvent:n,adjustScale:o,children:a,className:i,rect:s,style:l,transform:d,transition:f=my}=e;if(!s)return null;const u=o?d:{...d,scaleX:1,scaleY:1},m={...gy,width:s.width,height:s.height,top:s.top,left:s.left,transform:Ar.Transform.toString(u),transformOrigin:o&&n?dm(n,s):void 0,transition:typeof f=="function"?f(n):f,...l};return h.createElement(r,{className:i,style:m,ref:t},a)}),vy={duration:250,easing:"ease",keyframes:e=>{let{transform:{initial:t,final:r}}=e;return[{transform:Ar.Transform.toString(t)},{transform:Ar.Transform.toString(r)}]},sideEffects:(e=>t=>{let{active:r,dragOverlay:n}=t;const o={},{styles:a,className:i}=e;if(a!=null&&a.active)for(const[s,l]of Object.entries(a.active))l!==void 0&&(o[s]=r.node.style.getPropertyValue(s),r.node.style.setProperty(s,l));if(a!=null&&a.dragOverlay)for(const[s,l]of Object.entries(a.dragOverlay))l!==void 0&&n.node.style.setProperty(s,l);return i!=null&&i.active&&r.node.classList.add(i.active),i!=null&&i.dragOverlay&&n.node.classList.add(i.dragOverlay),function(){for(const[l,d]of Object.entries(o))r.node.style.setProperty(l,d);i!=null&&i.active&&r.node.classList.remove(i.active)}})({styles:{active:{opacity:"0"}}})};function by(e){let{config:t,draggableNodes:r,droppableContainers:n,measuringConfiguration:o}=e;return sa((a,i)=>{if(t===null)return;const s=r.get(a);if(!s)return;const l=s.node.current;if(!l)return;const d=Bc(i);if(!d)return;const{transform:f}=Tt(i).getComputedStyle(i),u=bc(f);if(!u)return;const m=typeof t=="function"?t:wy(t);return Oc(l,o.draggable.measure),m({active:{id:a,data:s.data,node:l,rect:o.draggable.measure(l)},draggableNodes:r,dragOverlay:{node:i,rect:o.dragOverlay.measure(d)},droppableContainers:n,measuringConfiguration:o,transform:u})})}function wy(e){const{duration:t,easing:r,sideEffects:n,keyframes:o}={...vy,...e};return a=>{let{active:i,dragOverlay:s,transform:l,...d}=a;if(!t)return;const f={x:s.rect.left-i.rect.left,y:s.rect.top-i.rect.top},u={scaleX:l.scaleX!==1?i.rect.width*l.scaleX/s.rect.width:1,scaleY:l.scaleY!==1?i.rect.height*l.scaleY/s.rect.height:1},m={x:l.x-f.x,y:l.y-f.y,...u},g=o({...d,active:i,dragOverlay:s,transform:{initial:l,final:m}}),[w]=g,p=g[g.length-1];if(JSON.stringify(w)===JSON.stringify(p))return;const y=n==null?void 0:n({active:i,dragOverlay:s,...d}),v=s.node.animate(g,{duration:t,easing:r,fill:"forwards"});return new Promise(b=>{v.onfinish=()=>{y==null||y(),b()}})}}let Qc=0;function Cy(e){return h.useMemo(()=>{if(e!=null)return Qc++,Qc},[e])}const Sy=h.memo(e=>{let{adjustScale:t=!1,children:r,dropAnimation:n,style:o,transition:a,modifiers:i,wrapperElement:s="div",className:l,zIndex:d=999}=e;const{activatorEvent:f,active:u,activeNodeRect:m,containerNodeRect:g,draggableNodes:w,droppableContainers:p,dragOverlay:y,over:v,measuringConfiguration:b,scrollableAncestors:C,scrollableAncestorRects:S,windowRect:T}=Rc(),I=h.useContext(va),k=Cy(u==null?void 0:u.id),x=Uc(i,{activatorEvent:f,active:u,activeNodeRect:m,containerNodeRect:g,draggingNodeRect:y.rect,over:v,overlayNodeRect:y.rect,scrollableAncestors:C,scrollableAncestorRects:S,transform:I,windowRect:T}),$=Hi(m),j=by({config:n,draggableNodes:w,droppableContainers:p,measuringConfiguration:b}),N=$?y.setRef:void 0;return h.createElement(py,null,h.createElement(fy,{animation:j},u&&k?h.createElement(yy,{key:k,id:u.id,ref:N,as:s,activatorEvent:f,adjustScale:t,className:l,transition:a,rect:$,style:{zIndex:d,...o},transform:x},r):null))});/**
182
+ * @license lucide-react v0.400.0 - ISC
183
+ *
184
+ * This source code is licensed under the ISC license.
185
+ * See the LICENSE file in the root directory of this source tree.
186
+ */const _y=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Gc=(...e)=>e.filter((t,r,n)=>!!t&&n.indexOf(t)===r).join(" ");/**
187
+ * @license lucide-react v0.400.0 - ISC
188
+ *
189
+ * This source code is licensed under the ISC license.
190
+ * See the LICENSE file in the root directory of this source tree.
191
+ */var Ty={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
+ * @license lucide-react v0.400.0 - ISC
193
+ *
194
+ * This source code is licensed under the ISC license.
195
+ * See the LICENSE file in the root directory of this source tree.
196
+ */const Ey=h.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:o="",children:a,iconNode:i,...s},l)=>h.createElement("svg",{ref:l,...Ty,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:Gc("lucide",o),...s},[...i.map(([d,f])=>h.createElement(d,f)),...Array.isArray(a)?a:[a]]));/**
197
+ * @license lucide-react v0.400.0 - ISC
198
+ *
199
+ * This source code is licensed under the ISC license.
200
+ * See the LICENSE file in the root directory of this source tree.
201
+ */const se=(e,t)=>{const r=h.forwardRef(({className:n,...o},a)=>h.createElement(Ey,{ref:a,iconNode:t,className:Gc(`lucide-${_y(e)}`,n),...o}));return r.displayName=`${e}`,r};/**
202
+ * @license lucide-react v0.400.0 - ISC
203
+ *
204
+ * This source code is licensed under the ISC license.
205
+ * See the LICENSE file in the root directory of this source tree.
206
+ */const Iy=se("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
207
+ * @license lucide-react v0.400.0 - ISC
208
+ *
209
+ * This source code is licensed under the ISC license.
210
+ * See the LICENSE file in the root directory of this source tree.
211
+ */const Oy=se("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
+ * @license lucide-react v0.400.0 - ISC
213
+ *
214
+ * This source code is licensed under the ISC license.
215
+ * See the LICENSE file in the root directory of this source tree.
216
+ */const Ay=se("BookOpen",[["path",{d:"M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z",key:"vv98re"}],["path",{d:"M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z",key:"1cyq3y"}]]);/**
217
+ * @license lucide-react v0.400.0 - ISC
218
+ *
219
+ * This source code is licensed under the ISC license.
220
+ * See the LICENSE file in the root directory of this source tree.
221
+ */const Dy=se("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"}]]);/**
182
222
  * @license lucide-react v0.400.0 - ISC
183
223
  *
184
224
  * This source code is licensed under the ISC license.
185
225
  * See the LICENSE file in the root directory of this source tree.
186
- */const gv=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Bc=(...e)=>e.filter((t,r,n)=>!!t&&n.indexOf(t)===r).join(" ");/**
226
+ */const wn=se("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
187
227
  * @license lucide-react v0.400.0 - ISC
188
228
  *
189
229
  * This source code is licensed under the ISC license.
190
230
  * See the LICENSE file in the root directory of this source tree.
191
- */var yv={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"};/**
231
+ */const Cn=se("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
192
232
  * @license lucide-react v0.400.0 - ISC
193
233
  *
194
234
  * This source code is licensed under the ISC license.
195
235
  * See the LICENSE file in the root directory of this source tree.
196
- */const vv=h.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:s="",children:i,iconNode:o,...a},c)=>h.createElement("svg",{ref:c,...yv,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:Bc("lucide",s),...a},[...o.map(([d,u])=>h.createElement(d,u)),...Array.isArray(i)?i:[i]]));/**
236
+ */const Wc=se("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
197
237
  * @license lucide-react v0.400.0 - ISC
198
238
  *
199
239
  * This source code is licensed under the ISC license.
200
240
  * See the LICENSE file in the root directory of this source tree.
201
- */const ue=(e,t)=>{const r=h.forwardRef(({className:n,...s},i)=>h.createElement(vv,{ref:i,iconNode:t,className:Bc(`lucide-${gv(e)}`,n),...s}));return r.displayName=`${e}`,r};/**
241
+ */const Ny=se("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
202
242
  * @license lucide-react v0.400.0 - ISC
203
243
  *
204
244
  * This source code is licensed under the ISC license.
205
245
  * See the LICENSE file in the root directory of this source tree.
206
- */const mv=ue("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
246
+ */const Kc=se("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"}]]);/**
207
247
  * @license lucide-react v0.400.0 - ISC
208
248
  *
209
249
  * This source code is licensed under the ISC license.
210
250
  * See the LICENSE file in the root directory of this source tree.
211
- */const bv=ue("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"}]]);/**
251
+ */const Ri=se("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
212
252
  * @license lucide-react v0.400.0 - ISC
213
253
  *
214
254
  * This source code is licensed under the ISC license.
215
255
  * See the LICENSE file in the root directory of this source tree.
216
- */const _v=ue("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"}]]);/**
256
+ */const ky=se("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"}]]);/**
217
257
  * @license lucide-react v0.400.0 - ISC
218
258
  *
219
259
  * This source code is licensed under the ISC license.
220
260
  * See the LICENSE file in the root directory of this source tree.
221
- */const bn=ue("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
261
+ */const xy=se("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
222
262
  * @license lucide-react v0.400.0 - ISC
223
263
  *
224
264
  * This source code is licensed under the ISC license.
225
265
  * See the LICENSE file in the root directory of this source tree.
226
- */const hs=ue("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
266
+ */const Ly=se("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"}]]);/**
227
267
  * @license lucide-react v0.400.0 - ISC
228
268
  *
229
269
  * This source code is licensed under the ISC license.
230
270
  * See the LICENSE file in the root directory of this source tree.
231
- */const Uc=ue("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
271
+ */const Yc=se("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"}]]);/**
232
272
  * @license lucide-react v0.400.0 - ISC
233
273
  *
234
274
  * This source code is licensed under the ISC license.
235
275
  * See the LICENSE file in the root directory of this source tree.
236
- */const wv=ue("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
276
+ */const ba=se("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
237
277
  * @license lucide-react v0.400.0 - ISC
238
278
  *
239
279
  * This source code is licensed under the ISC license.
240
280
  * See the LICENSE file in the root directory of this source tree.
241
- */const Vc=ue("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"}]]);/**
281
+ */const Sn=se("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);/**
242
282
  * @license lucide-react v0.400.0 - ISC
243
283
  *
244
284
  * This source code is licensed under the ISC license.
245
285
  * See the LICENSE file in the root directory of this source tree.
246
- */const qo=ue("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
286
+ */const Py=se("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"}]]);/**
247
287
  * @license lucide-react v0.400.0 - ISC
248
288
  *
249
289
  * This source code is licensed under the ISC license.
250
290
  * See the LICENSE file in the root directory of this source tree.
251
- */const Sv=ue("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"}]]);/**
291
+ */const Zc=se("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"}]]);/**
252
292
  * @license lucide-react v0.400.0 - ISC
253
293
  *
254
294
  * This source code is licensed under the ISC license.
255
295
  * See the LICENSE file in the root directory of this source tree.
256
- */const Cv=ue("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
296
+ */const Fy=se("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"}]]);/**
257
297
  * @license lucide-react v0.400.0 - ISC
258
298
  *
259
299
  * This source code is licensed under the ISC license.
260
300
  * See the LICENSE file in the root directory of this source tree.
261
- */const Ev=ue("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"}]]);/**
301
+ */const My=se("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/**
262
302
  * @license lucide-react v0.400.0 - ISC
263
303
  *
264
304
  * This source code is licensed under the ISC license.
265
305
  * See the LICENSE file in the root directory of this source tree.
266
- */const qc=ue("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"}]]);/**
306
+ */const Xc=se("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"}]]);/**
267
307
  * @license lucide-react v0.400.0 - ISC
268
308
  *
269
309
  * This source code is licensed under the ISC license.
270
310
  * See the LICENSE file in the root directory of this source tree.
271
- */const zo=ue("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
311
+ */const $y=se("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"}]]);/**
272
312
  * @license lucide-react v0.400.0 - ISC
273
313
  *
274
314
  * This source code is licensed under the ISC license.
275
315
  * See the LICENSE file in the root directory of this source tree.
276
- */const _n=ue("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);/**
316
+ */const Jc=se("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"}]]);/**
277
317
  * @license lucide-react v0.400.0 - ISC
278
318
  *
279
319
  * This source code is licensed under the ISC license.
280
320
  * See the LICENSE file in the root directory of this source tree.
281
- */const Ov=ue("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"}]]);/**
321
+ */const Qi=se("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
282
322
  * @license lucide-react v0.400.0 - ISC
283
323
  *
284
324
  * This source code is licensed under the ISC license.
285
325
  * See the LICENSE file in the root directory of this source tree.
286
- */const zc=ue("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"}]]);/**
326
+ */const Gi=se("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/**
287
327
  * @license lucide-react v0.400.0 - ISC
288
328
  *
289
329
  * This source code is licensed under the ISC license.
290
330
  * See the LICENSE file in the root directory of this source tree.
291
- */const Iv=ue("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"}]]);/**
331
+ */const By=se("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"}]]);/**
292
332
  * @license lucide-react v0.400.0 - ISC
293
333
  *
294
334
  * This source code is licensed under the ISC license.
295
335
  * See the LICENSE file in the root directory of this source tree.
296
- */const Hc=ue("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"}]]);/**
336
+ */const wa=se("Loader",[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]]);/**
297
337
  * @license lucide-react v0.400.0 - ISC
298
338
  *
299
339
  * This source code is licensed under the ISC license.
300
340
  * See the LICENSE file in the root directory of this source tree.
301
- */const Dv=ue("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"}]]);/**
341
+ */const Wi=se("Music",[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]]);/**
302
342
  * @license lucide-react v0.400.0 - ISC
303
343
  *
304
344
  * This source code is licensed under the ISC license.
305
345
  * See the LICENSE file in the root directory of this source tree.
306
- */const Wc=ue("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"}]]);/**
346
+ */const Ki=se("Package",[["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);/**
307
347
  * @license lucide-react v0.400.0 - ISC
308
348
  *
309
349
  * This source code is licensed under the ISC license.
310
350
  * See the LICENSE file in the root directory of this source tree.
311
- */const Ho=ue("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/**
351
+ */const jy=se("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"}]]);/**
312
352
  * @license lucide-react v0.400.0 - ISC
313
353
  *
314
354
  * This source code is licensed under the ISC license.
315
355
  * See the LICENSE file in the root directory of this source tree.
316
- */const Tv=ue("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"}]]);/**
356
+ */const qy=se("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"}]]);/**
317
357
  * @license lucide-react v0.400.0 - ISC
318
358
  *
319
359
  * This source code is licensed under the ISC license.
320
360
  * See the LICENSE file in the root directory of this source tree.
321
- */const yi=ue("Loader",[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]]);/**
361
+ */const Uy=se("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"}]]);/**
322
362
  * @license lucide-react v0.400.0 - ISC
323
363
  *
324
364
  * This source code is licensed under the ISC license.
325
365
  * See the LICENSE file in the root directory of this source tree.
326
- */const Wo=ue("Music",[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]]);/**
366
+ */const zy=se("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"}]]);/**
327
367
  * @license lucide-react v0.400.0 - ISC
328
368
  *
329
369
  * This source code is licensed under the ISC license.
330
370
  * See the LICENSE file in the root directory of this source tree.
331
- */const Qo=ue("Package",[["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);/**
371
+ */const mo=se("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
332
372
  * @license lucide-react v0.400.0 - ISC
333
373
  *
334
374
  * This source code is licensed under the ISC license.
335
375
  * See the LICENSE file in the root directory of this source tree.
336
- */const Nv=ue("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"}]]);/**
376
+ */const ed=se("QrCode",[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]]);/**
337
377
  * @license lucide-react v0.400.0 - ISC
338
378
  *
339
379
  * This source code is licensed under the ISC license.
340
380
  * See the LICENSE file in the root directory of this source tree.
341
- */const kv=ue("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"}]]);/**
381
+ */const td=se("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
342
382
  * @license lucide-react v0.400.0 - ISC
343
383
  *
344
384
  * This source code is licensed under the ISC license.
345
385
  * See the LICENSE file in the root directory of this source tree.
346
- */const xv=ue("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"}]]);/**
386
+ */const Vy=se("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"}]]);/**
347
387
  * @license lucide-react v0.400.0 - ISC
348
388
  *
349
389
  * This source code is licensed under the ISC license.
350
390
  * See the LICENSE file in the root directory of this source tree.
351
- */const Av=ue("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"}]]);/**
391
+ */const Hy=se("Scale",[["path",{d:"m16 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z",key:"7g6ntu"}],["path",{d:"m2 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z",key:"ijws7r"}],["path",{d:"M7 21h10",key:"1b0cd5"}],["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M3 7h2c2 0 5-1 7-2 2 1 5 2 7 2h2",key:"3gwbw2"}]]);/**
352
392
  * @license lucide-react v0.400.0 - ISC
353
393
  *
354
394
  * This source code is licensed under the ISC license.
355
395
  * See the LICENSE file in the root directory of this source tree.
356
- */const ps=ue("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
396
+ */const Ry=se("School",[["path",{d:"M14 22v-4a2 2 0 1 0-4 0v4",key:"hhkicm"}],["path",{d:"m18 10 4 2v8a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-8l4-2",key:"1vwozw"}],["path",{d:"M18 5v17",key:"1sw6gf"}],["path",{d:"m4 6 8-4 8 4",key:"1q0ilc"}],["path",{d:"M6 5v17",key:"1xfsm0"}],["circle",{cx:"12",cy:"9",r:"2",key:"1092wv"}]]);/**
357
397
  * @license lucide-react v0.400.0 - ISC
358
398
  *
359
399
  * This source code is licensed under the ISC license.
360
400
  * See the LICENSE file in the root directory of this source tree.
361
- */const Qc=ue("QrCode",[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]]);/**
401
+ */const Yi=se("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
362
402
  * @license lucide-react v0.400.0 - ISC
363
403
  *
364
404
  * This source code is licensed under the ISC license.
365
405
  * See the LICENSE file in the root directory of this source tree.
366
- */const Kc=ue("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
406
+ */const Qy=se("Send",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]]);/**
367
407
  * @license lucide-react v0.400.0 - ISC
368
408
  *
369
409
  * This source code is licensed under the ISC license.
370
410
  * See the LICENSE file in the root directory of this source tree.
371
- */const Pv=ue("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"}]]);/**
411
+ */const Gy=se("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"}]]);/**
372
412
  * @license lucide-react v0.400.0 - ISC
373
413
  *
374
414
  * This source code is licensed under the ISC license.
375
415
  * See the LICENSE file in the root directory of this source tree.
376
- */const Ko=ue("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
416
+ */const Wy=se("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"}]]);/**
377
417
  * @license lucide-react v0.400.0 - ISC
378
418
  *
379
419
  * This source code is licensed under the ISC license.
380
420
  * See the LICENSE file in the root directory of this source tree.
381
- */const Mv=ue("Send",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]]);/**
421
+ */const Ky=se("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/**
382
422
  * @license lucide-react v0.400.0 - ISC
383
423
  *
384
424
  * This source code is licensed under the ISC license.
385
425
  * See the LICENSE file in the root directory of this source tree.
386
- */const Lv=ue("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"}]]);/**
426
+ */const Zi=se("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
387
427
  * @license lucide-react v0.400.0 - ISC
388
428
  *
389
429
  * This source code is licensed under the ISC license.
390
430
  * See the LICENSE file in the root directory of this source tree.
391
- */const Fv=ue("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"}]]);/**
431
+ */const Yy=se("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
392
432
  * @license lucide-react v0.400.0 - ISC
393
433
  *
394
434
  * This source code is licensed under the ISC license.
395
435
  * See the LICENSE file in the root directory of this source tree.
396
- */const Go=ue("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
436
+ */const Xi=se("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
397
437
  * @license lucide-react v0.400.0 - ISC
398
438
  *
399
439
  * This source code is licensed under the ISC license.
400
440
  * See the LICENSE file in the root directory of this source tree.
401
- */const Gc=ue("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
441
+ */const Zy=se("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
402
442
  * @license lucide-react v0.400.0 - ISC
403
443
  *
404
444
  * This source code is licensed under the ISC license.
405
445
  * See the LICENSE file in the root directory of this source tree.
406
- */const $v=ue("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"}]]);/**
446
+ */const Xy=se("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
447
  * @license lucide-react v0.400.0 - ISC
408
448
  *
409
449
  * This source code is licensed under the ISC license.
410
450
  * See the LICENSE file in the root directory of this source tree.
411
- */const Ro=ue("Video",[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]]);/**
451
+ */const Ji=se("Video",[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]]);/**
412
452
  * @license lucide-react v0.400.0 - ISC
413
453
  *
414
454
  * This source code is licensed under the ISC license.
415
455
  * See the LICENSE file in the root directory of this source tree.
416
- */const zr=ue("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),jv={},Rc=e=>{let t;const r=new Set,n=(u,f)=>{const g=typeof u=="function"?u(t):u;if(!Object.is(g,t)){const y=t;t=f??(typeof g!="object"||g===null)?g:Object.assign({},t,g),r.forEach(_=>_(t,y))}},s=()=>t,c={setState:n,getState:s,getInitialState:()=>d,subscribe:u=>(r.add(u),()=>r.delete(u)),destroy:()=>{(jv?"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},Bv=e=>e?Rc(e):Rc;function Yc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Yo={exports:{}},Xo={},vi={exports:{}},Zo={};/**
456
+ */const yr=se("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Jy={},rd=e=>{let t;const r=new Set,n=(f,u)=>{const m=typeof f=="function"?f(t):f;if(!Object.is(m,t)){const g=t;t=u??(typeof m!="object"||m===null)?m:Object.assign({},t,m),r.forEach(w=>w(t,g))}},o=()=>t,l={setState:n,getState:o,getInitialState:()=>d,subscribe:f=>(r.add(f),()=>r.delete(f)),destroy:()=>{(Jy?"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,o,l);return l},ev=e=>e?rd(e):rd;function nd(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var es={exports:{}},ts={},Ca={exports:{}},rs={};/**
417
457
  * @license React
418
458
  * use-sync-external-store-shim.production.js
419
459
  *
@@ -421,7 +461,7 @@ to {
421
461
  *
422
462
  * This source code is licensed under the MIT license found in the
423
463
  * LICENSE file in the root directory of this source tree.
424
- */var Xc;function Uv(){if(Xc)return Zo;Xc=1;var e=h;function t(f,g){return f===g&&(f!==0||1/f===1/g)||f!==f&&g!==g}var r=typeof Object.is=="function"?Object.is:t,n=e.useState,s=e.useEffect,i=e.useLayoutEffect,o=e.useDebugValue;function a(f,g){var y=g(),_=n({inst:{value:y,getSnapshot:g}}),p=_[0].inst,v=_[1];return i(function(){p.value=y,p.getSnapshot=g,c(p)&&v({inst:p})},[f,y,g]),s(function(){return c(p)&&v({inst:p}),f(function(){c(p)&&v({inst:p})})},[f]),o(y),y}function c(f){var g=f.getSnapshot;f=f.value;try{var y=g();return!r(f,y)}catch{return!0}}function d(f,g){return g()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:a;return Zo.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,Zo}var Jo={};/**
464
+ */var od;function tv(){if(od)return rs;od=1;var e=h;function t(u,m){return u===m&&(u!==0||1/u===1/m)||u!==u&&m!==m}var r=typeof Object.is=="function"?Object.is:t,n=e.useState,o=e.useEffect,a=e.useLayoutEffect,i=e.useDebugValue;function s(u,m){var g=m(),w=n({inst:{value:g,getSnapshot:m}}),p=w[0].inst,y=w[1];return a(function(){p.value=g,p.getSnapshot=m,l(p)&&y({inst:p})},[u,g,m]),o(function(){return l(p)&&y({inst:p}),u(function(){l(p)&&y({inst:p})})},[u]),i(g),g}function l(u){var m=u.getSnapshot;u=u.value;try{var g=m();return!r(u,g)}catch{return!0}}function d(u,m){return m()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:s;return rs.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:f,rs}var ns={};/**
425
465
  * @license React
426
466
  * use-sync-external-store-shim.development.js
427
467
  *
@@ -429,7 +469,7 @@ to {
429
469
  *
430
470
  * This source code is licensed under the MIT license found in the
431
471
  * LICENSE file in the root directory of this source tree.
432
- */var Zc;function Vv(){return Zc||(Zc=1,process.env.NODE_ENV!=="production"&&function(){function e(y,_){return y===_&&(y!==0||1/y===1/_)||y!==y&&_!==_}function t(y,_){u||s.startTransition===void 0||(u=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var p=_();if(!f){var v=_();i(p,v)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),f=!0)}v=o({inst:{value:p,getSnapshot:_}});var m=v[0].inst,b=v[1];return c(function(){m.value=p,m.getSnapshot=_,r(m)&&b({inst:m})},[y,p,_]),a(function(){return r(m)&&b({inst:m}),y(function(){r(m)&&b({inst:m})})},[y]),d(p),p}function r(y){var _=y.getSnapshot;y=y.value;try{var p=_();return!i(y,p)}catch{return!0}}function n(y,_){return _()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var s=h,i=typeof Object.is=="function"?Object.is:e,o=s.useState,a=s.useEffect,c=s.useLayoutEffect,d=s.useDebugValue,u=!1,f=!1,g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?n:t;Jo.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())}()),Jo}var Jc;function ea(){return Jc||(Jc=1,process.env.NODE_ENV==="production"?vi.exports=Uv():vi.exports=Vv()),vi.exports}/**
472
+ */var ad;function rv(){return ad||(ad=1,process.env.NODE_ENV!=="production"&&function(){function e(g,w){return g===w&&(g!==0||1/g===1/w)||g!==g&&w!==w}function t(g,w){f||o.startTransition===void 0||(f=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var p=w();if(!u){var y=w();a(p,y)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),u=!0)}y=i({inst:{value:p,getSnapshot:w}});var v=y[0].inst,b=y[1];return l(function(){v.value=p,v.getSnapshot=w,r(v)&&b({inst:v})},[g,p,w]),s(function(){return r(v)&&b({inst:v}),g(function(){r(v)&&b({inst:v})})},[g]),d(p),p}function r(g){var w=g.getSnapshot;g=g.value;try{var p=w();return!a(g,p)}catch{return!0}}function n(g,w){return w()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var o=h,a=typeof Object.is=="function"?Object.is:e,i=o.useState,s=o.useEffect,l=o.useLayoutEffect,d=o.useDebugValue,f=!1,u=!1,m=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?n:t;ns.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:m,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),ns}var id;function os(){return id||(id=1,process.env.NODE_ENV==="production"?Ca.exports=tv():Ca.exports=rv()),Ca.exports}/**
433
473
  * @license React
434
474
  * use-sync-external-store-shim/with-selector.production.js
435
475
  *
@@ -437,7 +477,7 @@ to {
437
477
  *
438
478
  * This source code is licensed under the MIT license found in the
439
479
  * LICENSE file in the root directory of this source tree.
440
- */var eu;function qv(){if(eu)return Xo;eu=1;var e=h,t=ea();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 Xo.useSyncExternalStoreWithSelector=function(d,u,f,g,y){var _=i(null);if(_.current===null){var p={hasValue:!1,value:null};_.current=p}else p=_.current;_=a(function(){function m(D){if(!b){if(b=!0,S=D,D=g(D),y!==void 0&&p.hasValue){var x=p.value;if(y(x,D))return w=x}return w=D}if(x=w,n(S,D))return x;var A=g(D);return y!==void 0&&y(x,A)?(S=D,x):(S=D,w=A)}var b=!1,S,w,E=f===void 0?null:f;return[function(){return m(u())},E===null?void 0:function(){return m(E())}]},[u,f,g,y]);var v=s(d,_[0],_[1]);return o(function(){p.hasValue=!0,p.value=v},[v]),c(v),v},Xo}var ta={};/**
480
+ */var sd;function nv(){if(sd)return ts;sd=1;var e=h,t=os();function r(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var n=typeof Object.is=="function"?Object.is:r,o=t.useSyncExternalStore,a=e.useRef,i=e.useEffect,s=e.useMemo,l=e.useDebugValue;return ts.useSyncExternalStoreWithSelector=function(d,f,u,m,g){var w=a(null);if(w.current===null){var p={hasValue:!1,value:null};w.current=p}else p=w.current;w=s(function(){function v(I){if(!b){if(b=!0,C=I,I=m(I),g!==void 0&&p.hasValue){var k=p.value;if(g(k,I))return S=k}return S=I}if(k=S,n(C,I))return k;var x=m(I);return g!==void 0&&g(k,x)?(C=I,k):(C=I,S=x)}var b=!1,C,S,T=u===void 0?null:u;return[function(){return v(f())},T===null?void 0:function(){return v(T())}]},[f,u,m,g]);var y=o(d,w[0],w[1]);return i(function(){p.hasValue=!0,p.value=y},[y]),l(y),y},ts}var as={};/**
441
481
  * @license React
442
482
  * use-sync-external-store-shim/with-selector.development.js
443
483
  *
@@ -445,22 +485,22 @@ to {
445
485
  *
446
486
  * This source code is licensed under the MIT license found in the
447
487
  * LICENSE file in the root directory of this source tree.
448
- */var tu;function zv(){return tu||(tu=1,process.env.NODE_ENV!=="production"&&function(){function e(d,u){return d===u&&(d!==0||1/d===1/u)||d!==d&&u!==u}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=h,r=ea(),n=typeof Object.is=="function"?Object.is:e,s=r.useSyncExternalStore,i=t.useRef,o=t.useEffect,a=t.useMemo,c=t.useDebugValue;ta.useSyncExternalStoreWithSelector=function(d,u,f,g,y){var _=i(null);if(_.current===null){var p={hasValue:!1,value:null};_.current=p}else p=_.current;_=a(function(){function m(D){if(!b){if(b=!0,S=D,D=g(D),y!==void 0&&p.hasValue){var x=p.value;if(y(x,D))return w=x}return w=D}if(x=w,n(S,D))return x;var A=g(D);return y!==void 0&&y(x,A)?(S=D,x):(S=D,w=A)}var b=!1,S,w,E=f===void 0?null:f;return[function(){return m(u())},E===null?void 0:function(){return m(E())}]},[u,f,g,y]);var v=s(d,_[0],_[1]);return o(function(){p.hasValue=!0,p.value=v},[v]),c(v),v},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),ta}process.env.NODE_ENV==="production"?Yo.exports=qv():Yo.exports=zv();var Hv=Yo.exports;const Wv=Yc(Hv),ru={},{useDebugValue:Qv}=h,{useSyncExternalStoreWithSelector:Kv}=Wv;let nu=!1;const Gv=e=>e;function Rv(e,t=Gv,r){(ru?"production":void 0)!=="production"&&r&&!nu&&(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"),nu=!0);const n=Kv(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,r);return Qv(n),n}const su=e=>{(ru?"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"?Bv(e):e,r=(n,s)=>Rv(t,n,s);return Object.assign(r,t),r},mi=e=>e?su(e):su,oe=mi(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=oe.getState().formStatusMapper,n=[...t];for(;n.length>0;){const s=n.shift();if(r[s.id]===!1)return!1;s.children&&n.push(...s.children)}return!0},setCategoryDefinition:t=>e({rootFormConfig:t.rootForm,unitFormConfig:t.unitForm,childFormConfig:t.childForm,searchFormConfig:t.searchForm,relationalFormConfig:t.relationalForm,publishChecklist:t.publishChecklist,reviewChecklist:t.reviewChecklist,rfcChecklist:t.rfcChecklist,categoryMeta:{schemaDefaults:t.schemaDefaults,frameworkMetadata:t.frameworkMetadata,sourcingSettings:t.sourcingSettings}})})),Yv=Object.freeze(Object.defineProperty({__proto__:null,useEditorStore:oe},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 iu(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=iu(s.children,t,r+1);if(i>=0)return i}}return-1}const Xv=new Set(["name","appIcon","description","keywords","trackable","qrCodeProcessId","reservedDialcodes"]);function ou(e,t,r){return e.map(n=>{if(n.id===t){const s=r.metadata??{},i={};for(const o of Xv)o in r&&(i[o]=r[o]);return{...n,...r,metadata:{...n.metadata??{},...i,...s}}}return n.children&&n.children.length>0?{...n,children:ou(n.children,t,r)}:n})}function bi(e,t,r){return e.map(n=>n.id===t?{...n,children:[...n.children??[],r]}:n.children&&n.children.length>0?{...n,children:bi(n.children,t,r)}:n)}function ra(e,t){return e.filter(r=>r.id!==t).map(r=>({...r,children:r.children?ra(r.children,t):[]}))}function au(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:au(s.children,t,r,n)}:s})}function lu(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?lu(r.children,t):[]}})}function Zv(e){let t=0;const r=[...e];for(;r.length>0;){const n=r.shift();n.isFolder||t++,n.children&&r.push(...n.children)}return t}function Jv(e,t){const r=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 Ie=mi((e,t)=>({treeData:[],selectedNodeId:null,treeCache:{},breadcrumb:[],activeNodeMeta:{},setTreeData:r=>{var s;const n=((s=r[0])==null?void 0:s.id)??null;e({treeData:r,selectedNodeId:n}),n&&setTimeout(()=>t().selectNode(n),0)},selectNode:r=>{const{treeData:n,treeCache:s,getBreadcrumb:i}=t(),o=Hr(n,r),a=i(r),c={...(o==null?void 0:o.metadata)??{},...s[r]??{}};oe.getState().setNodeFlags({isFolder:(o==null?void 0:o.isFolder)??!1,isRoot:!(o!=null&&o.parent),isQuml:!1}),e({selectedNodeId:r,breadcrumb:a,activeNodeMeta:c})},updateNode:(r,n)=>{e(s=>({treeData:ou(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=oe.getState().editorConfig)==null?void 0:d.config)==null?void 0:u.maxDepth)??4,o=iu(s.treeData,r);if(o>=i)return console.warn(`[tree.store] addNode: depth would exceed maxDepth (${i}). parentDepth=${o}`),"";const a="temp-"+Math.random().toString(36).slice(2),c={id:a,identifier:a,name:"Untitled Unit",isFolder:!0,children:[],parent:r,metadata:{mimeType:"application/vnd.ekstep.content-collection",code:a,name:"Untitled Unit",visibility:"Parent"}};return e(f=>({treeData:bi(f.treeData,r,c),treeCache:{...f.treeCache,[a]:{...c.metadata,isNew:!0}}})),setTimeout(()=>t().selectNode(a),0),a},deleteNode:r=>{e(n=>({treeData:ra(n.treeData,r),selectedNodeId:n.selectedNodeId===r?null:n.selectedNodeId}))},reorderChildren:(r,n,s)=>{e(i=>({treeData:au(i.treeData,r,n,s)}))},moveNode:(r,n,s)=>{e(i=>{const o=Hr(i.treeData,r);if(!o)return i;let a=ra(i.treeData,r);return a=bi(a,s,{...o,parent:s}),{treeData:a}}),t().markDirty()},addResource:(r,n)=>{var u,f,g;const s=oe.getState().editorConfig,i=((u=s==null?void 0:s.config)==null?void 0:u.allowContentUnderRoot)??!1,o=(f=t().treeData[0])==null?void 0:f.id;if(!i&&n===o||Hr(t().treeData,r.identifier))return!1;const a=((g=s==null?void 0:s.config)==null?void 0:g.maxContentsLimit)??1200;if(Zv(t().treeData)>=a)return!1;const d={id:r.identifier,identifier:r.identifier,name:r.name,isFolder:!1,children:[],parent:n,mimeType:r.mimeType,primaryCategory:r.primaryCategory,contentType:r.contentType,appIcon:r.appIcon,status:r.status,metadata:r};return e(y=>({treeData:bi(y.treeData,n,d)})),t().markDirty(),!0},markDirty:()=>{const{editorMode:r,setIsDirty:n}=oe.getState();r==="edit"&&n(!0)},replaceNodeIds:r=>{!r||Object.keys(r).length===0||e(n=>{const s=lu(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=>Jv(t().treeData,r)})),em=mi(e=>({activeModal:null,modalData:{},openModal:(t,r={})=>e({activeModal:t,modalData:r}),closeModal:()=>e({activeModal:null,modalData:{}})})),tm={spin:"_spin_1ah4d_9"},rm=({size:e=16,color:t="currentColor"})=>l.jsx("svg",{className:tm.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"})}),Fe=({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(rm,{size:14}):null,i]}),Me={overlay:"_overlay_w9xez_1",modal:"_modal_w9xez_11",modalHeader:"_modalHeader_w9xez_23",modalHeaderClose:"_modalHeaderClose_w9xez_33",modalBody:"_modalBody_w9xez_51",modalFooter:"_modalFooter_w9xez_58",checkRow:"_checkRow_w9xez_65",formGroup:"_formGroup_w9xez_108",textarea:"_textarea_w9xez_119",sliderGroup:"_sliderGroup_w9xez_140",sliderValue:"_sliderValue_w9xez_152",sliderLabels:"_sliderLabels_w9xez_160",sectionTitle:"_sectionTitle_w9xez_168"},nm=({contentId:e,onConfirm:t,onCancel:r})=>{const n=oe(u=>{var f,g;return(g=(f=u.editorConfig)==null?void 0:f.config)==null?void 0:g.objectType})||"Content",s=oe(u=>u.publishChecklist)??[],[i,o]=h.useState({}),a=s.every(u=>i[u.code]),c=s.length===0||a,d=()=>{t()};return l.jsx("div",{className:Me.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"publish-modal-title",children:l.jsxs("div",{className:Me.modal,children:[l.jsxs("div",{className:Me.modalHeader,children:[l.jsxs("span",{id:"publish-modal-title",children:["Publish ",n]}),l.jsx("button",{className:Me.modalHeaderClose,onClick:r,"aria-label":"Close",children:"×"})]}),l.jsx("div",{className:Me.modalBody,children:s.length===0?l.jsxs("p",{style:{margin:0,fontSize:14,lineHeight:1.5},children:["Are you sure you want to publish this ",n,"?"]}):l.jsxs(l.Fragment,{children:[l.jsx("p",{className:Me.sectionTitle,children:"Please confirm that ALL the following items are verified (by ticking the check-boxes) before you can publish:"}),s.map(u=>l.jsxs("label",{className:Me.checkRow,children:[l.jsx("input",{type:"checkbox",checked:!!i[u.code],onChange:f=>o(g=>({...g,[u.code]:f.target.checked}))}),l.jsx("span",{children:u.label})]},u.code))]})}),l.jsxs("div",{className:Me.modalFooter,children:[l.jsx(Fe,{variant:"ghost",onClick:r,children:"No"}),l.jsx(Fe,{variant:"primary",onClick:d,disabled:!c,children:"Yes"})]})]})})},sm=({contentId:e,action:t,onConfirm:r,onCancel:n})=>{const[s,i]=h.useState(""),[o,a]=h.useState(7),c=t==="approve",d=c?"Review Quality":"Reject Content",u=!c&&s.trim().length===0,f=()=>{c?r(s.trim(),o):r(s.trim())};return l.jsx("div",{className:Me.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"quality-modal-title",children:l.jsxs("div",{className:Me.modal,children:[l.jsxs("div",{className:Me.modalHeader,children:[l.jsx("span",{id:"quality-modal-title",children:d}),l.jsx("button",{className:Me.modalHeaderClose,onClick:n,"aria-label":"Close",children:"×"})]}),l.jsx("div",{className:Me.modalBody,children:c?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:Me.formGroup,children:[l.jsx("label",{htmlFor:"quality-score",children:"Quality Score"}),l.jsxs("div",{className:Me.sliderGroup,children:[l.jsx("input",{id:"quality-score",type:"range",min:0,max:10,step:1,value:o,onChange:g=>a(Number(g.target.value)),"aria-valuemin":0,"aria-valuemax":10,"aria-valuenow":o}),l.jsx("span",{className:Me.sliderValue,children:o})]}),l.jsxs("div",{className:Me.sliderLabels,children:[l.jsx("span",{children:"0 — Poor"}),l.jsx("span",{children:"10 — Excellent"})]})]}),l.jsxs("div",{className:Me.formGroup,children:[l.jsxs("label",{htmlFor:"quality-comment",children:["Comment"," ",l.jsx("span",{style:{fontWeight:400,color:"var(--sbx-gray-400, #9CA3AF)"},children:"(optional)"})]}),l.jsx("textarea",{id:"quality-comment",className:Me.textarea,placeholder:"Add any notes for the content creator…",value:s,onChange:g=>i(g.target.value),rows:4})]})]}):l.jsxs("div",{className:Me.formGroup,children:[l.jsxs("label",{htmlFor:"reject-reason",children:["Rejection Reason"," ",l.jsx("span",{style:{color:"var(--sbx-error, #DC2626)"},children:"*"})]}),l.jsx("textarea",{id:"reject-reason",className:Me.textarea,placeholder:"Describe why this content is being rejected…",value:s,onChange:g=>i(g.target.value),rows:5,required:!0,"aria-required":"true"}),s.trim().length===0&&l.jsx("p",{style:{fontSize:12,color:"var(--sbx-error, #DC2626)",marginTop:4},children:"A rejection reason is required."})]})}),l.jsxs("div",{className:Me.modalFooter,children:[l.jsx(Fe,{variant:"ghost",onClick:n,children:"Cancel"}),l.jsx(Fe,{variant:c?"primary":"danger",onClick:f,disabled:u,children:c?"Approve":"Reject"})]})]})})};function cu(e,t){return function(){return e.apply(t,arguments)}}const{toString:im}=Object.prototype,{getPrototypeOf:wn}=Object,{iterator:gs,toStringTag:uu}=Symbol,_i=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),ys=(e,t)=>{let r=e;const n=[];for(;r!=null&&r!==Object.prototype;){if(n.indexOf(r)!==-1)return!1;if(n.push(r),_i(r,t))return!0;r=wn(r)}return!1},om=(e,t)=>e!=null&&ys(e,t)?e[t]:void 0,na=(e=>t=>{const r=im.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Rt=e=>(e=e.toLowerCase(),t=>na(t)===e),wi=e=>t=>typeof t===e,{isArray:Wr}=Array,Sn=wi("undefined");function Cn(e){return e!==null&&!Sn(e)&&e.constructor!==null&&!Sn(e.constructor)&&Dt(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const du=Rt("ArrayBuffer");function am(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&du(e.buffer),t}const lm=wi("string"),Dt=wi("function"),fu=wi("number"),En=e=>e!==null&&typeof e=="object",cm=e=>e===!0||e===!1,Si=e=>{if(!En(e))return!1;const t=wn(e);return(t===null||t===Object.prototype||wn(t)===null)&&!ys(e,uu)&&!ys(e,gs)},um=e=>{if(!En(e)||Cn(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},dm=Rt("Date"),fm=Rt("File"),hm=e=>!!(e&&typeof e.uri<"u"),pm=e=>e&&typeof e.getParts<"u",gm=Rt("Blob"),ym=Rt("FileList"),vm=e=>En(e)&&Dt(e.pipe);function mm(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const hu=mm(),pu=typeof hu.FormData<"u"?hu.FormData:void 0,bm=e=>{if(!e)return!1;if(pu&&e instanceof pu)return!0;const t=wn(e);if(!t||t===Object.prototype||!Dt(e.append))return!1;const r=na(e);return r==="formdata"||r==="object"&&Dt(e.toString)&&e.toString()==="[object FormData]"},_m=Rt("URLSearchParams"),[wm,Sm,Cm,Em]=["ReadableStream","Request","Response","Headers"].map(Rt),Om=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function vs(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,s;if(typeof e!="object"&&(e=[e]),Wr(e))for(n=0,s=e.length;n<s;n++)t.call(null,e[n],n,e);else{if(Cn(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 gu(e,t){if(Cn(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,yu=e=>!Sn(e)&&e!==Qr;function sa(...e){const{caseless:t,skipUndefined:r}=yu(this)&&this||{},n={},s=(i,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const a=t&&typeof o=="string"&&gu(n,o)||o,c=_i(n,a)?n[a]:void 0;Si(c)&&Si(i)?n[a]=sa(c,i):Si(i)?n[a]=sa({},i):Wr(i)?n[a]=i.slice():(!r||!Sn(i))&&(n[a]=i)};for(let i=0,o=e.length;i<o;i++){const a=e[i];if(!a||Cn(a)||(vs(a,s),typeof a!="object"||Wr(a)))continue;const c=Object.getOwnPropertySymbols(a);for(let d=0;d<c.length;d++){const u=c[d];$m.call(a,u)&&s(a[u],u)}}return n}const Im=(e,t,r,{allOwnKeys:n}={})=>(vs(t,(s,i)=>{r&&Dt(s)?Object.defineProperty(e,i,{__proto__:null,value:cu(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),Dm=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Tm=(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)},Nm=(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&&wn(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},km=(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},xm=e=>{if(!e)return null;if(Wr(e))return e;let t=e.length;if(!fu(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},Am=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&wn(Uint8Array)),Pm=(e,t)=>{const n=(e&&e[gs]).call(e);let s;for(;(s=n.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},Mm=(e,t)=>{let r;const n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},Lm=Rt("HTMLFormElement"),Fm=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,s){return n.toUpperCase()+s}),{propertyIsEnumerable:$m}=Object.prototype,jm=Rt("RegExp"),vu=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};vs(r,(s,i)=>{let o;(o=t(s,i,e))!==!1&&(n[i]=o||s)}),Object.defineProperties(e,n)},Bm=e=>{vu(e,(t,r)=>{if(Dt(e)&&["arguments","caller","callee"].includes(r))return!1;const n=e[r];if(Dt(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},Um=(e,t)=>{const r={},n=s=>{s.forEach(i=>{r[i]=!0})};return Wr(e)?n(e):n(String(e).split(t)),r},Vm=()=>{},qm=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function zm(e){return!!(e&&Dt(e.append)&&e[uu]==="FormData"&&e[gs])}const Hm=e=>{const t=new WeakSet,r=n=>{if(En(n)){if(t.has(n))return;if(Cn(n))return n;if(!("toJSON"in n)){t.add(n);const s=Wr(n)?[]:{};return vs(n,(i,o)=>{const a=r(i);!Sn(a)&&(s[o]=a)}),t.delete(n),s}}return n};return r(e)},Wm=Rt("AsyncFunction"),Qm=e=>e&&(En(e)||Dt(e))&&Dt(e.then)&&Dt(e.catch),mu=((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",Dt(Qr.postMessage)),Km=typeof queueMicrotask<"u"?queueMicrotask.bind(Qr):typeof process<"u"&&process.nextTick||mu,bu=e=>e!=null&&Dt(e[gs]),I={isArray:Wr,isArrayBuffer:du,isBuffer:Cn,isFormData:bm,isArrayBufferView:am,isString:lm,isNumber:fu,isBoolean:cm,isObject:En,isPlainObject:Si,isEmptyObject:um,isReadableStream:wm,isRequest:Sm,isResponse:Cm,isHeaders:Em,isUndefined:Sn,isDate:dm,isFile:fm,isReactNativeBlob:hm,isReactNative:pm,isBlob:gm,isRegExp:jm,isFunction:Dt,isStream:vm,isURLSearchParams:_m,isTypedArray:Am,isFileList:ym,forEach:vs,merge:sa,extend:Im,trim:Om,stripBOM:Dm,inherits:Tm,toFlatObject:Nm,kindOf:na,kindOfTest:Rt,endsWith:km,toArray:xm,forEachEntry:Pm,matchAll:Mm,isHTMLForm:Lm,hasOwnProperty:_i,hasOwnProp:_i,hasOwnInPrototypeChain:ys,getSafeProp:om,reduceDescriptors:vu,freezeMethods:Bm,toObjectSet:Um,toCamelCase:Fm,noop:Vm,toFiniteNumber:qm,findKey:gu,global:Qr,isContextDefined:yu,isSpecCompliantForm:zm,toJSONObject:Hm,isAsyncFn:Wm,isThenable:Qm,setImmediate:mu,asap:Km,isIterable:bu,isSafeIterable:e=>e!=null&&ys(e,gs)&&bu(e)},Gm=I.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Rm=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]&&Gm[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t};function Ym(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 Xm=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),Zm=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function ia(e,t){return I.isArray(e)?e.map(r=>ia(r,t)):Ym(String(e).replace(t,""))}const Jm=e=>ia(e,Xm),eb=e=>ia(e,Zm);function _u(e){const t=Object.create(null);return I.forEach(e.toJSON(),(r,n)=>{t[n]=eb(r)}),t}const wu=Symbol("internals");function ms(e){return e&&String(e).trim().toLowerCase()}function Ci(e){return e===!1||e==null?e:I.isArray(e)?e.map(Ci):Jm(String(e))}function tb(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 rb=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function oa(e,t,r,n,s){if(I.isFunction(n))return n.call(this,t,r);if(s&&(t=r),!!I.isString(t)){if(I.isString(n))return t.indexOf(n)!==-1;if(I.isRegExp(n))return n.test(t)}}function nb(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function sb(e,t){const r=I.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{__proto__:null,value:function(s,i,o){return this[n].call(this,t,s,i,o)},configurable:!0})})}let pt=class{constructor(t){t&&this.set(t)}set(t,r,n){const s=this;function i(a,c,d){const u=ms(c);if(!u)return;const f=I.findKey(s,u);(!f||s[f]===void 0||d===!0||d===void 0&&s[f]!==!1)&&(s[f||c]=Ci(a))}const o=(a,c)=>I.forEach(a,(d,u)=>i(d,u,c));if(I.isPlainObject(t)||t instanceof this.constructor)o(t,r);else if(I.isString(t)&&(t=t.trim())&&!rb(t))o(Rm(t),r);else if(I.isObject(t)&&I.isSafeIterable(t)){let a=Object.create(null),c,d;for(const u of t){if(!I.isArray(u))throw new TypeError("Object iterator must return a key-value pair");d=u[0],I.hasOwnProp(a,d)?(c=a[d],a[d]=I.isArray(c)?[...c,u[1]]:[c,u[1]]):a[d]=u[1]}o(a,r)}else t!=null&&i(r,t,n);return this}get(t,r){if(t=ms(t),t){const n=I.findKey(this,t);if(n){const s=this[n];if(!r)return s;if(r===!0)return tb(s);if(I.isFunction(r))return r.call(this,s,n);if(I.isRegExp(r))return r.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=ms(t),t){const n=I.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||oa(this,this[n],n,r)))}return!1}delete(t,r){const n=this;let s=!1;function i(o){if(o=ms(o),o){const a=I.findKey(n,o);a&&(!r||oa(n,n[a],a,r))&&(delete n[a],s=!0)}}return I.isArray(t)?t.forEach(i):i(t),s}clear(t){const r=Object.keys(this);let n=r.length,s=!1;for(;n--;){const i=r[n];(!t||oa(this,this[i],i,t,!0))&&(delete this[i],s=!0)}return s}normalize(t){const r=this,n={};return I.forEach(this,(s,i)=>{const o=I.findKey(n,i);if(o){r[o]=Ci(s),delete r[i];return}const a=t?nb(i):String(i).trim();a!==i&&delete r[i],r[a]=Ci(s),n[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const r=Object.create(null);return I.forEach(this,(n,s)=>{n!=null&&n!==!1&&(r[s]=t&&I.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(`
450
- `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){const n=new this(t);return r.forEach(s=>n.set(s)),n}static accessor(t){const n=(this[wu]=this[wu]={accessors:{}}).accessors,s=this.prototype;function i(o){const a=ms(o);n[a]||(sb(s,o),n[a]=!0)}return I.isArray(t)?t.forEach(i):i(t),this}};pt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),I.reduceDescriptors(pt.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}}),I.freezeMethods(pt);const ib="[REDACTED ****]";function ob(e){if(I.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(I.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}function ab(e,t){const r=new Set(t.map(i=>String(i).toLowerCase())),n=[],s=i=>{if(i===null||typeof i!="object"||I.isBuffer(i))return i;if(n.indexOf(i)!==-1)return;i instanceof pt&&(i=i.toJSON()),n.push(i);let o;if(I.isArray(i))o=[],i.forEach((a,c)=>{const d=s(a);I.isUndefined(d)||(o[c]=d)});else{if(!I.isPlainObject(i)&&ob(i))return n.pop(),i;o=Object.create(null);for(const[a,c]of Object.entries(i)){const d=r.has(a.toLowerCase())?ib:s(c);I.isUndefined(d)||(o[a]=d)}}return n.pop(),o};return s(e)}let Y=class hp extends Error{static from(t,r,n,s,i,o){const a=new hp(t.message,r||t.code,n,s,i);return a.cause=t,a.name=t.name,t.status!=null&&a.status==null&&(a.status=t.status),o&&Object.assign(a,o),a}constructor(t,r,n,s,i){super(t),Object.defineProperty(this,"message",{__proto__:null,value:t,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,r&&(this.code=r),n&&(this.config=n),s&&(this.request=s),i&&(this.response=i,this.status=i.status)}toJSON(){const t=this.config,r=t&&I.hasOwnProp(t,"redact")?t.redact:void 0,n=I.isArray(r)&&r.length>0?ab(t,r):I.toJSONObject(t);return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:n,code:this.code,status:this.status}}};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 lb=null,Su=100;function aa(e){return I.isPlainObject(e)||I.isArray(e)}function Cu(e){return I.endsWith(e,"[]")?e.slice(0,-2):e}function la(e,t,r){return e?e.concat(t).map(function(s,i){return s=Cu(s),!r&&i?"["+s+"]":s}).join(r?".":""):t}function cb(e){return I.isArray(e)&&!e.some(aa)}const ub=I.toFlatObject(I,{},null,function(t){return/^is[A-Z]/.test(t)});function Ei(e,t,r){if(!I.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,r=I.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(b,S){return!I.isUndefined(S[b])});const n=r.metaTokens,s=r.visitor||_,i=r.dots,o=r.indexes,a=r.Blob||typeof Blob<"u"&&Blob,c=r.maxDepth===void 0?Su:r.maxDepth,d=a&&I.isSpecCompliantForm(t),u=[];if(!I.isFunction(s))throw new TypeError("visitor must be a function");function f(m){if(m===null)return"";if(I.isDate(m))return m.toISOString();if(I.isBoolean(m))return m.toString();if(!d&&I.isBlob(m))throw new Y("Blob is not supported. Use a Buffer instead.");return I.isArrayBuffer(m)||I.isTypedArray(m)?d&&typeof Blob=="function"?new Blob([m]):Buffer.from(m):m}function g(m){if(m>c)throw new Y("Object is too deeply nested ("+m+" levels). Max depth: "+c,Y.ERR_FORM_DATA_DEPTH_EXCEEDED)}function y(m,b){if(c===1/0)return JSON.stringify(m);const S=[];return JSON.stringify(m,function(E,D){if(!I.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 _(m,b,S){let w=m;if(I.isReactNative(t)&&I.isReactNativeBlob(m))return t.append(la(S,b,i),f(m)),!1;if(m&&!S&&typeof m=="object"){if(I.endsWith(b,"{}"))b=n?b:b.slice(0,-2),m=y(m,1);else if(I.isArray(m)&&cb(m)||(I.isFileList(m)||I.endsWith(b,"[]"))&&(w=I.toArray(m)))return b=Cu(b),w.forEach(function(D,x){!(I.isUndefined(D)||D===null)&&t.append(o===!0?la([b],x,i):o===null?b:b+"[]",f(D))}),!1}return aa(m)?!0:(t.append(la(S,b,i),f(m)),!1)}const p=Object.assign(ub,{defaultVisitor:_,convertValue:f,isVisitable:aa});function v(m,b,S=0){if(!I.isUndefined(m)){if(g(S),u.indexOf(m)!==-1)throw new Error("Circular reference detected in "+b.join("."));u.push(m),I.forEach(m,function(E,D){(!(I.isUndefined(E)||E===null)&&s.call(t,E,I.isString(D)?D.trim():D,b,p))===!0&&v(E,b?b.concat(D):[D],S+1)}),u.pop()}}if(!I.isObject(e))throw new TypeError("data must be an object");return v(e),t}function Eu(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(n){return t[n]})}function ca(e,t){this._pairs=[],e&&Ei(e,this,t)}const Ou=ca.prototype;Ou.append=function(t,r){this._pairs.push([t,r])},Ou.toString=function(t){const r=t?function(n){return t.call(this,n,Eu)}:Eu;return this._pairs.map(function(s){return r(s[0])+"="+r(s[1])},"").join("&")};function db(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Iu(e,t,r){if(!t)return e;const n=I.isFunction(r)?{serialize:r}:r,s=I.getSafeProp(n,"encode")||db,i=I.getSafeProp(n,"serialize");let o;if(i?o=i(t,n):o=I.isURLSearchParams(t)?t.toString():new ca(t,n).toString(s),o){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class Du{constructor(){this.handlers=[]}use(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){I.forEach(this.handlers,function(n){n!==null&&t(n)})}}const ua={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},fb={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:ca,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},da=typeof window<"u"&&typeof document<"u",fa=typeof navigator=="object"&&navigator||void 0,hb=da&&(!fa||["ReactNative","NativeScript","NS"].indexOf(fa.product)<0),pb=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",gb=da&&window.location.href||"http://localhost",ct={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:da,hasStandardBrowserEnv:hb,hasStandardBrowserWebWorkerEnv:pb,navigator:fa,origin:gb},Symbol.toStringTag,{value:"Module"})),...fb};function yb(e,t){return Ei(e,new ct.classes.URLSearchParams,{visitor:function(r,n,s,i){return ct.isNode&&I.isBuffer(r)?(this.append(n,r.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}const Tu=Su;function Nu(e){if(e>Tu)throw new Y("FormData field is too deeply nested ("+e+" levels). Max depth: "+Tu,Y.ERR_FORM_DATA_DEPTH_EXCEEDED)}function vb(e){const t=[],r=/\w+|\[(\w*)]/g;let n;for(;(n=r.exec(e))!==null;)Nu(t.length),t.push(n[0]==="[]"?"":n[1]||n[0]);return t}function mb(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 ku(e){function t(r,n,s,i){Nu(i);let o=r[i++];if(o==="__proto__")return!0;const a=Number.isFinite(+o),c=i>=r.length;return o=!o&&I.isArray(s)?s.length:o,c?(I.hasOwnProp(s,o)?s[o]=I.isArray(s[o])?s[o].concat(n):[s[o],n]:s[o]=n,!a):((!I.hasOwnProp(s,o)||!I.isObject(s[o]))&&(s[o]=[]),t(r,n,s[o],i)&&I.isArray(s[o])&&(s[o]=mb(s[o])),!a)}if(I.isFormData(e)&&I.isFunction(e.entries)){const r={};return I.forEachEntry(e,(n,s)=>{t(vb(n),s,r,0)}),r}return null}const On=(e,t)=>e!=null&&I.hasOwnProp(e,t)?e[t]:void 0;function bb(e,t,r){if(I.isString(e))try{return(t||JSON.parse)(e),I.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}const bs={transitional:ua,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){const n=r.getContentType()||"",s=n.indexOf("application/json")>-1,i=I.isObject(t);if(i&&I.isHTMLForm(t)&&(t=new FormData(t)),I.isFormData(t))return s?JSON.stringify(ku(t)):t;if(I.isArrayBuffer(t)||I.isBuffer(t)||I.isStream(t)||I.isFile(t)||I.isBlob(t)||I.isReadableStream(t))return t;if(I.isArrayBufferView(t))return t.buffer;if(I.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(i){const c=On(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return yb(t,c).toString();if((a=I.isFileList(t))||n.indexOf("multipart/form-data")>-1){const d=On(this,"env"),u=d&&d.FormData;return Ei(a?{"files[]":t}:t,u&&new u,c)}}return i||s?(r.setContentType("application/json",!1),bb(t)):t}],transformResponse:[function(t){const r=On(this,"transitional")||bs.transitional,n=r&&r.forcedJSONParsing,s=On(this,"responseType"),i=s==="json";if(I.isResponse(t)||I.isReadableStream(t))return t;if(t&&I.isString(t)&&(n&&!s||i)){const a=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(t,On(this,"parseReviver"))}catch(c){if(a)throw c.name==="SyntaxError"?Y.from(c,Y.ERR_BAD_RESPONSE,this,null,On(this,"response")):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ct.classes.FormData,Blob:ct.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};I.forEach(["delete","get","head","post","put","patch","query"],e=>{bs.headers[e]={}});function ha(e,t){const r=this||bs,n=t||r,s=pt.from(n.headers);let i=n.data;return I.forEach(e,function(a){i=a.call(r,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function xu(e){return!!(e&&e.__CANCEL__)}let _s=class extends Y{constructor(t,r,n){super(t??"canceled",Y.ERR_CANCELED,r,n),this.name="CanceledError",this.__CANCEL__=!0}};function Au(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 _b(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}function wb(e,t){e=e||10;const r=new Array(e),n=new Array(e);let s=0,i=0,o;return t=t!==void 0?t:1e3,function(c){const d=Date.now(),u=n[i];o||(o=d),r[s]=c,n[s]=d;let f=i,g=0;for(;f!==s;)g+=r[f++],f=f%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),d-o<t)return;const y=u&&d-u;return y?Math.round(g*1e3/y):void 0}}function Sb(e,t){let r=0,n=1e3/t,s,i;const o=(d,u=Date.now())=>{r=u,s=null,i&&(clearTimeout(i),i=null),e(...d)};return[(...d)=>{const u=Date.now(),f=u-r;f>=n?o(d,u):(s=d,i||(i=setTimeout(()=>{i=null,o(s)},n-f)))},()=>s&&o(s)]}const Oi=(e,t,r=3)=>{let n=0;const s=wb(50,250);return Sb(i=>{if(!i||typeof i.loaded!="number")return;const o=i.loaded,a=i.lengthComputable?i.total:void 0,c=a!=null?Math.min(o,a):o,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)},Pu=(e,t)=>{const r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},Mu=e=>(...t)=>I.asap(()=>e(...t)),Cb=ct.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,ct.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(ct.origin),ct.navigator&&/(msie|trident)/i.test(ct.navigator.userAgent)):()=>!0,Eb=ct.hasStandardBrowserEnv?{write(e,t,r,n,s,i,o){if(typeof document>"u")return;const a=[`${e}=${encodeURIComponent(t)}`];I.isNumber(r)&&a.push(`expires=${new Date(r).toUTCString()}`),I.isString(n)&&a.push(`path=${n}`),I.isString(s)&&a.push(`domain=${s}`),i===!0&&a.push("secure"),I.isString(o)&&a.push(`SameSite=${o}`),document.cookie=a.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.split(";");for(let r=0;r<t.length;r++){const n=t[r].replace(/^\s+/,""),s=n.indexOf("=");if(s!==-1&&n.slice(0,s)===e)return decodeURIComponent(n.slice(s+1))}return null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Ob(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Ib(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}const Db=/^https?:(?!\/\/)/i,Tb=/[\t\n\r]/g;function Nb(e){let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t)}function kb(e){return Nb(e).replace(Tb,"")}function Lu(e,t){if(typeof e=="string"&&Db.test(kb(e)))throw new Y('Invalid URL: missing "//" after protocol',Y.ERR_INVALID_URL,t)}function Fu(e,t,r,n){Lu(t,n);let s=!Ob(t);return e&&(s||r===!1)?(Lu(e,n),Ib(e,t)):t}const $u=e=>e instanceof pt?{...e}:e;function Kr(e,t){t=t||{};const r=Object.create(null);Object.defineProperty(r,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function n(u,f,g,y){return I.isPlainObject(u)&&I.isPlainObject(f)?I.merge.call({caseless:y},u,f):I.isPlainObject(f)?I.merge({},f):I.isArray(f)?f.slice():f}function s(u,f,g,y){if(I.isUndefined(f)){if(!I.isUndefined(u))return n(void 0,u,g,y)}else return n(u,f,g,y)}function i(u,f){if(!I.isUndefined(f))return n(void 0,f)}function o(u,f){if(I.isUndefined(f)){if(!I.isUndefined(u))return n(void 0,u)}else return n(void 0,f)}function a(u){const f=I.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!I.isUndefined(f))if(I.isPlainObject(f)){if(I.hasOwnProp(f,u))return f[u]}else return;const g=I.hasOwnProp(e,"transitional")?e.transitional:void 0;if(I.isPlainObject(g)&&I.hasOwnProp(g,u))return g[u]}function c(u,f,g){if(I.hasOwnProp(t,g))return n(u,f);if(I.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($u(u),$u(f),g,!0)};return I.forEach(Object.keys({...e,...t}),function(f){if(f==="__proto__"||f==="constructor"||f==="prototype")return;const g=I.hasOwnProp(d,f)?d[f]:s,y=I.hasOwnProp(e,f)?e[f]:void 0,_=I.hasOwnProp(t,f)?t[f]:void 0,p=g(y,_,f);I.isUndefined(p)&&g!==c||(r[f]=p)}),I.hasOwnProp(t,"validateStatus")&&I.isUndefined(t.validateStatus)&&a("validateStatusUndefinedResolves")===!1&&(I.hasOwnProp(e,"validateStatus")?r.validateStatus=n(void 0,e.validateStatus):delete r.validateStatus),r}const xb=["content-type","content-length"];function Ab(e,t,r){if(r!=="content-only"){e.set(t);return}Object.entries(t).forEach(([n,s])=>{xb.includes(n.toLowerCase())&&e.set(n,s)})}const Pb=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,r)=>String.fromCharCode(parseInt(r,16)));function ju(e){const t=Kr({},e),r=g=>I.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=pt.from(a),t.url=Iu(Fu(d,f,u,t),r("params"),r("paramsSerializer")),c){const g=I.getSafeProp(c,"username")||"",y=I.getSafeProp(c,"password")||"";a.set("Authorization","Basic "+btoa(g+":"+(y?Pb(y):"")))}if(I.isFormData(n)&&(ct.hasStandardBrowserEnv||ct.hasStandardBrowserWebWorkerEnv||I.isReactNative(n)?a.setContentType(void 0):I.isFunction(n.getHeaders)&&Ab(a,n.getHeaders(),r("formDataHeaderPolicy"))),ct.hasStandardBrowserEnv&&(I.isFunction(s)&&(s=s(t)),s===!0||s==null&&Cb(t.url))){const y=i&&o&&Eb.read(o);y&&a.set(i,y)}return t}const Mb=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(r,n){const s=ju(e);let i=s.data;const o=pt.from(s.headers).normalize();let{responseType:a,onUploadProgress:c,onDownloadProgress:d}=s,u,f,g,y,_;function p(){y&&y(),_&&_(),s.cancelToken&&s.cancelToken.unsubscribe(u),s.signal&&s.signal.removeEventListener("abort",u)}let v=new XMLHttpRequest;v.open(s.method.toUpperCase(),s.url,!0),v.timeout=s.timeout;function m(){if(!v)return;const S=pt.from("getAllResponseHeaders"in v&&v.getAllResponseHeaders()),E={data:!a||a==="text"||a==="json"?v.responseText:v.response,status:v.status,statusText:v.statusText,headers:S,config:e,request:v};Au(function(x){r(x),p()},function(x){n(x),p()},E),v=null}"onloadend"in v?v.onloadend=m:v.onreadystatechange=function(){!v||v.readyState!==4||v.status===0&&!(v.responseURL&&v.responseURL.startsWith("file:"))||setTimeout(m)},v.onabort=function(){v&&(n(new Y("Request aborted",Y.ECONNABORTED,e,v)),p(),v=null)},v.onerror=function(w){const E=w&&w.message?w.message:"Network Error",D=new Y(E,Y.ERR_NETWORK,e,v);D.event=w||null,n(D),p(),v=null},v.ontimeout=function(){let w=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const E=s.transitional||ua;s.timeoutErrorMessage&&(w=s.timeoutErrorMessage),n(new Y(w,E.clarifyTimeoutError?Y.ETIMEDOUT:Y.ECONNABORTED,e,v)),p(),v=null},i===void 0&&o.setContentType(null),"setRequestHeader"in v&&I.forEach(_u(o),function(w,E){v.setRequestHeader(E,w)}),I.isUndefined(s.withCredentials)||(v.withCredentials=!!s.withCredentials),a&&a!=="json"&&(v.responseType=s.responseType),d&&([g,_]=Oi(d,!0),v.addEventListener("progress",g)),c&&v.upload&&([f,y]=Oi(c),v.upload.addEventListener("progress",f),v.upload.addEventListener("loadend",y)),(s.cancelToken||s.signal)&&(u=S=>{v&&(n(!S||S.type?new _s(null,e,v):S),v.abort(),p(),v=null)},s.cancelToken&&s.cancelToken.subscribe(u),s.signal&&(s.signal.aborted?u():s.signal.addEventListener("abort",u)));const b=_b(s.url);if(b&&!ct.protocols.includes(b)){n(new Y("Unsupported protocol "+b+":",Y.ERR_BAD_REQUEST,e));return}v.send(i||null)})},Lb=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;const r=new AbortController;let n=!1;const s=function(c){if(!n){n=!0,o();const d=c instanceof Error?c:this.reason;r.abort(d instanceof Y?d:new _s(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=()=>I.asap(o),a},Fb=function*(e,t){let r=e.byteLength;if(r<t){yield e;return}let n=0,s;for(;n<r;)s=n+t,yield e.slice(n,s),n=s},$b=async function*(e,t){for await(const r of jb(e))yield*Fb(r,t)},jb=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()}},Bu=(e,t,r,n)=>{const s=$b(e,t);let i=0,o,a=c=>{o||(o=!0,n&&n(c))};return new ReadableStream({async pull(c){try{const{done: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})},Ii=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,Bb=(e,t,r)=>t+2<r&&Ii(e.charCodeAt(t+1))&&Ii(e.charCodeAt(t+2));function Ub(e){if(!e||typeof e!="string"||!e.startsWith("data:"))return 0;const t=e.indexOf(",");if(t<0)return 0;const r=e.slice(5,t),n=e.slice(t+1);if(/;base64/i.test(r)){let o=n.length;const a=n.length;for(let y=0;y<a;y++)if(n.charCodeAt(y)===37&&y+2<a){const _=n.charCodeAt(y+1),p=n.charCodeAt(y+2);Ii(_)&&Ii(p)&&(o-=2,y+=2)}let c=0,d=a-1;const u=y=>y>=2&&n.charCodeAt(y-2)===37&&n.charCodeAt(y-1)===51&&(n.charCodeAt(y)===68||n.charCodeAt(y)===100);d>=0&&(n.charCodeAt(d)===61?(c++,d--):u(d)&&(c++,d-=3)),c===1&&d>=0&&(n.charCodeAt(d)===61||u(d))&&c++;const g=Math.floor(o/4)*3-(c||0);return g>0?g:0}let i=0;for(let o=0,a=n.length;o<a;o++){const c=n.charCodeAt(o);if(c===37&&Bb(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 pa="1.18.0",Uu=64*1024,{isFunction:Di}=I,Vb=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,r)=>String.fromCharCode(parseInt(r,16))),Vu=e=>{if(!I.isString(e))return e;try{return decodeURIComponent(e)}catch{return e}},qu=(e,...t)=>{try{return!!e(...t)}catch{return!1}},qb=e=>{const t=e.indexOf("://");let r=e;return t!==-1&&(r=r.slice(t+3)),r.includes("@")||r.includes(":")},zb=e=>{const t=I.global!==void 0&&I.global!==null?I.global:globalThis,{ReadableStream:r,TextEncoder:n}=t;e=I.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:s,Request:i,Response:o}=e,a=s?Di(s):typeof fetch=="function",c=Di(i),d=Di(o);if(!a)return!1;const u=a&&Di(r),f=a&&(typeof n=="function"?(m=>b=>m.encode(b))(new n):async m=>new Uint8Array(await new i(m).arrayBuffer())),g=c&&u&&qu(()=>{let m=!1;const b=new i(ct.origin,{body:new r,method:"POST",get duplex(){return m=!0,"half"}}),S=b.headers.has("Content-Type");return b.body!=null&&b.body.cancel(),m&&!S}),y=d&&u&&qu(()=>I.isReadableStream(new o("").body)),_={stream:y&&(m=>m.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(m=>{!_[m]&&(_[m]=(b,S)=>{let w=b&&b[m];if(w)return w.call(b);throw new Y(`Response type '${m}' is not supported`,Y.ERR_NOT_SUPPORT,S)})});const p=async m=>{if(m==null)return 0;if(I.isBlob(m))return m.size;if(I.isSpecCompliantForm(m))return(await new i(ct.origin,{method:"POST",body:m}).arrayBuffer()).byteLength;if(I.isArrayBufferView(m)||I.isArrayBuffer(m))return m.byteLength;if(I.isURLSearchParams(m)&&(m=m+""),I.isString(m))return(await f(m)).byteLength},v=async(m,b)=>{const S=I.toFiniteNumber(m.getContentLength());return S??p(b)};return async m=>{let{url:b,method:S,data:w,signal:E,cancelToken:D,timeout:x,onDownloadProgress:A,onUploadProgress:$,responseType:N,headers:M,withCredentials:U="same-origin",fetchOptions:P,maxContentLength:L,maxBodyLength:j}=ju(m);const X=I.isNumber(L)&&L>-1,se=I.isNumber(j)&&j>-1,xe=G=>I.hasOwnProp(m,G)?m[G]:void 0;let Ce=s||fetch;N=N?(N+"").toLowerCase():"text";let be=Lb([E,D&&D.toAbortSignal()],x),z=null;const J=be&&be.unsubscribe&&(()=>{be.unsubscribe()});let te,V=null;const Z=()=>new Y("Request body larger than maxBodyLength limit",Y.ERR_BAD_REQUEST,m,z);try{let G;const ce=xe("auth");if(ce){const re=I.getSafeProp(ce,"username")||"",Le=I.getSafeProp(ce,"password")||"";G={username:re,password:Le}}if(qb(b)){const re=new URL(b,ct.origin);if(!G&&(re.username||re.password)){const Le=Vu(re.username),Ve=Vu(re.password);G={username:Le,password:Ve}}(re.username||re.password)&&(re.username="",re.password="",b=re.href)}if(G&&(M.delete("authorization"),M.set("Authorization","Basic "+btoa(Vb((G.username||"")+":"+(G.password||""))))),X&&typeof b=="string"&&b.startsWith("data:")&&Ub(b)>L)throw new Y("maxContentLength size of "+L+" exceeded",Y.ERR_BAD_RESPONSE,m,z);if(se&&S!=="get"&&S!=="head"){const re=await p(w);if(typeof re=="number"&&isFinite(re)&&(te=re,re>j))throw Z()}const ee=se&&(I.isReadableStream(w)||I.isStream(w)),ge=(re,Le,Ve)=>Bu(re,Uu,Je=>{if(se&&Je>j)throw V=Z();Le&&Le(Je)},Ve);if(g&&S!=="get"&&S!=="head"&&($||ee)){if(te=te??await v(M,w),te!==0||ee){let re=new i(b,{method:"POST",body:w,duplex:"half"}),Le;if(I.isFormData(w)&&(Le=re.headers.get("content-type"))&&M.setContentType(Le),re.body){const[Ve,Je]=$&&Pu(te,Oi(Mu($)))||[];w=ge(re.body,Ve,Je)}}}else if(ee&&!c&&u&&S!=="get"&&S!=="head")w=ge(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,m,z);I.isString(U)||(U=U?"include":"omit");const ae=c&&"credentials"in i.prototype;if(I.isFormData(w)){const re=M.getContentType();re&&/^multipart\/form-data/i.test(re)&&!/boundary=/i.test(re)&&M.delete("content-type")}M.set("User-Agent","axios/"+pa,!1);const Re={...P,signal:be,method:S.toUpperCase(),headers:_u(M.normalize()),body:w,duplex:"half",credentials:ae?U:void 0};z=c&&new i(b,Re);let Ee=await(c?Ce(z,P):Ce(b,Re));const Ze=pt.from(Ee.headers);if(X){const re=I.toFiniteNumber(Ze.getContentLength());if(re!=null&&re>L)throw new Y("maxContentLength size of "+L+" exceeded",Y.ERR_BAD_RESPONSE,m,z)}const Ye=y&&(N==="stream"||N==="response");if(y&&Ee.body&&(A||X||Ye&&J)){const re={};["status","statusText","headers"].forEach(W=>{re[W]=Ee[W]});const Le=I.toFiniteNumber(Ze.getContentLength()),[Ve,Je]=A&&Pu(Le,Oi(Mu(A),!0))||[];let ft=0;const Wt=W=>{if(X&&(ft=W,ft>L))throw new Y("maxContentLength size of "+L+" exceeded",Y.ERR_BAD_RESPONSE,m,z);Ve&&Ve(W)};Ee=new o(Bu(Ee.body,Uu,Wt,()=>{Je&&Je(),J&&J()}),re)}N=N||"text";let qe=await _[I.findKey(_,N)||"text"](Ee,m);if(X&&!y&&!Ye){let re;if(qe!=null&&(typeof qe.byteLength=="number"?re=qe.byteLength:typeof qe.size=="number"?re=qe.size:typeof qe=="string"&&(re=typeof n=="function"?new n().encode(qe).byteLength:qe.length)),typeof re=="number"&&re>L)throw new Y("maxContentLength size of "+L+" exceeded",Y.ERR_BAD_RESPONSE,m,z)}return!Ye&&J&&J(),await new Promise((re,Le)=>{Au(re,Le,{data:qe,headers:pt.from(Ee.headers),status:Ee.status,statusText:Ee.statusText,config:m,request:z})})}catch(G){if(J&&J(),be&&be.aborted&&be.reason instanceof Y){const ce=be.reason;throw ce.config=m,z&&(ce.request=z),G!==ce&&(ce.cause=G),ce}throw V?(z&&!V.request&&(V.request=z),V):G instanceof Y?(z&&!G.request&&(G.request=z),G):G&&G.name==="TypeError"&&/Load failed|fetch/i.test(G.message)?Object.assign(new Y("Network Error",Y.ERR_NETWORK,m,z,G&&G.response),{cause:G.cause||G}):Y.from(G,G&&G.code,m,z,G&&G.response)}}},Hb=new Map,zu=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=Hb;for(;a--;)c=i[a],d=u.get(c),d===void 0&&u.set(c,d=a?new Map:zb(t)),u=d;return d};zu();const ga={http:lb,xhr:Mb,fetch:{get:zu}};I.forEach(ga,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch{}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const Hu=e=>`- ${e}`,Wb=e=>I.isFunction(e)||e===null||e===!1;function Qb(e,t){e=I.isArray(e)?e:[e];const{length:r}=e;let n,s;const i={};for(let o=0;o<r;o++){n=e[o];let a;if(s=n,!Wb(n)&&(s=ga[(a=String(n)).toLowerCase()],s===void 0))throw new Y(`Unknown adapter '${a}'`);if(s&&(I.isFunction(s)||(s=s.get(t))))break;i[a||"#"+o]=s}if(!s){const o=Object.entries(i).map(([c,d])=>`adapter ${c} `+(d===!1?"is not supported by the environment":"is not available in the build"));let a=r?o.length>1?`since :
451
- `+o.map(Hu).join(`
452
- `):" "+Hu(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 Wu={getAdapter:Qb,adapters:ga};function ya(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new _s(null,e)}function Qu(e){return ya(e),e.headers=pt.from(e.headers),e.data=ha.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Wu.getAdapter(e.adapter||bs.adapter,e)(e).then(function(n){ya(e),e.response=n;try{n.data=ha.call(e,e.transformResponse,n)}finally{delete e.response}return n.headers=pt.from(n.headers),n},function(n){if(!xu(n)&&(ya(e),n&&n.response)){e.response=n.response;try{n.response.data=ha.call(e,e.transformResponse,n.response)}finally{delete e.response}n.response.headers=pt.from(n.response.headers)}return Promise.reject(n)})}const Ti={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Ti[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const Ku={};Ti.transitional=function(t,r,n){function s(i,o){return"[Axios v"+pa+"] 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&&!Ku[o]&&(Ku[o]=!0,console.warn(s(o," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(i,o,a):!0}},Ti.spelling=function(t){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${t}`),!0)};function Kb(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 Ni={assertOptions:Kb,validators:Ti},gt=Ni.validators;let Gr=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Du,response:new Du}}async request(t,r){try{return await this._request(t,r)}catch(n){if(n instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const i=(()=>{if(!s.stack)return"";const o=s.stack.indexOf(`
453
- `);return o===-1?"":s.stack.slice(o+1)})();try{if(!n.stack)n.stack=i;else if(i){const o=i.indexOf(`
454
- `),a=o===-1?-1:i.indexOf(`
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=Kr(this.defaults,r);const{transitional:n,paramsSerializer:s,headers:i}=r;n!==void 0&&Ni.assertOptions(n,{silentJSONParsing:gt.transitional(gt.boolean),forcedJSONParsing:gt.transitional(gt.boolean),clarifyTimeoutError:gt.transitional(gt.boolean),legacyInterceptorReqResOrdering:gt.transitional(gt.boolean),advertiseZstdAcceptEncoding:gt.transitional(gt.boolean),validateStatusUndefinedResolves:gt.transitional(gt.boolean)},!1),s!=null&&(I.isFunction(s)?r.paramsSerializer={serialize:s}:Ni.assertOptions(s,{encode:gt.function,serialize:gt.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),Ni.assertOptions(r,{baseUrl:gt.spelling("baseURL"),withXsrfToken:gt.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=i&&I.merge(i.common,i[r.method]);i&&I.forEach(["delete","get","head","post","put","patch","query","common"],_=>{delete i[_]}),r.headers=pt.concat(o,i);const a=[];let c=!0;this.interceptors.request.forEach(function(p){if(typeof p.runWhen=="function"&&p.runWhen(r)===!1)return;c=c&&p.synchronous;const v=r.transitional||ua;v&&v.legacyInterceptorReqResOrdering?a.unshift(p.fulfilled,p.rejected):a.push(p.fulfilled,p.rejected)});const d=[];this.interceptors.response.forEach(function(p){d.push(p.fulfilled,p.rejected)});let u,f=0,g;if(!c){const _=[Qu.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 y=r;for(;f<g;){const _=a[f++],p=a[f++];try{y=_(y)}catch(v){p.call(this,v);break}}try{u=Qu.call(this,y)}catch(_){return Promise.reject(_)}for(f=0,g=d.length;f<g;)u=u.then(d[f++],d[f++]);return u}getUri(t){t=Kr(this.defaults,t);const r=Fu(t.baseURL,t.url,t.allowAbsoluteUrls,t);return Iu(r,t.params,t.paramsSerializer)}};I.forEach(["delete","get","head","options"],function(t){Gr.prototype[t]=function(r,n){return this.request(Kr(n||{},{method:t,url:r,data:n&&I.hasOwnProp(n,"data")?n.data:void 0}))}}),I.forEach(["post","put","patch","query"],function(t){function r(n){return function(i,o,a){return this.request(Kr(a||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}Gr.prototype[t]=r(),t!=="query"&&(Gr.prototype[t+"Form"]=r(!0))});let Gb=class pp{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(i){r=i});const n=this;this.promise.then(s=>{if(!n._listeners)return;let i=n._listeners.length;for(;i-- >0;)n._listeners[i](s);n._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(a=>{n.subscribe(a),i=a}).then(s);return o.cancel=function(){n.unsubscribe(i)},o},t(function(i,o,a){n.reason||(n.reason=new _s(i,o,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const t=new AbortController,r=n=>{t.abort(n)};return this.subscribe(r),t.signal.unsubscribe=()=>this.unsubscribe(r),t.signal}static source(){let t;return{token:new pp(function(s){t=s}),cancel:t}}};function Rb(e){return function(r){return e.apply(null,r)}}function Yb(e){return I.isObject(e)&&e.isAxiosError===!0}const va={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(va).forEach(([e,t])=>{va[t]=e});function Gu(e){const t=new Gr(e),r=cu(Gr.prototype.request,t);return I.extend(r,Gr.prototype,t,{allOwnKeys:!0}),I.extend(r,t,null,{allOwnKeys:!0}),r.create=function(s){return Gu(Kr(e,s))},r}const Ge=Gu(bs);Ge.Axios=Gr,Ge.CanceledError=_s,Ge.CancelToken=Gb,Ge.isCancel=xu,Ge.VERSION=pa,Ge.toFormData=Ei,Ge.AxiosError=Y,Ge.Cancel=Ge.CanceledError,Ge.all=function(t){return Promise.all(t)},Ge.spread=Rb,Ge.isAxiosError=Yb,Ge.mergeConfig=Kr,Ge.AxiosHeaders=pt,Ge.formToJSON=e=>ku(I.isHTMLForm(e)?new FormData(e):e),Ge.getAdapter=Wu.getAdapter,Ge.HttpStatusCode=va,Ge.default=Ge;const{Axios:ZI,AxiosError:JI,CanceledError:eD,isCancel:tD,CancelToken:rD,VERSION:nD,all:sD,Cancel:iD,isAxiosError:oD,spread:aD,toFormData:lD,AxiosHeaders:cD,HttpStatusCode:uD,formToJSON:dD,getAdapter:fD,mergeConfig:hD,create:pD}=Ge;let ma="";function Ru(e){ma=e}const Ne=Ge.create({timeout:3e4});Ne.interceptors.request.use(async e=>{var s;const{useEditorStore:t}=await Promise.resolve().then(()=>Yv),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),ma&&(e.baseURL=ma),e});const Yu=["email","firstName","lastName","identifier","organisations","rootOrgName","phone"];async function Xb(e,t={}){var c,d,u,f;const n={"organisations.roles":[((c=t.objectType)==null?void 0:c.toLowerCase())==="textbook"?"BOOK_CREATOR":"CONTENT_CREATOR"]};t.rootOrgId&&(n.rootOrgId=[t.rootOrgId]);const s=e.includes("@"),i=/^\d{10,}$/.test(e.trim()),o={filters:n,fields:Yu,offset:0,limit:t.limit??200};return s?n.email=e.trim():i?n.phone=e.trim():o.query=e,((f=(u=(d=(await 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 Zb(e){var r,n,s;return e.length?((s=(n=(r=(await Ne.post("/action/user/v1/search",{request:{filters:{userId:e},fields:Yu,limit:e.length}},{headers:{"X-Source":"web","X-msgid":Math.random().toString(36).slice(2)}})).data)==null?void 0:r.result)==null?void 0:n.response)==null?void 0:s.content)??[]:[]}async function Jb(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 Xu="/portal";async function Zu(e){var n,s,i,o,a,c,d;const t=await Ne.get(`${Xu}/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 e_(e){var r,n;return e.length?((n=(r=(await Ne.post(`${Xu}/question/v2/list`,{request:{search:{identifier:e}}})).data)==null?void 0:r.result)==null?void 0:n.questions)??[]:[]}function ba(e,t){const r=e??{},n=r.identifier??"",s=r.objectType??"",i=r.mimeType??"",o=r.children,a=Array.isArray(o)?o.map(d=>ba(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 Ju(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=ba(r);return{content:r,rootNode:n}}async function t_(e){const t=await Zu(e),r=ba(t);return{content:t,rootNode:r}}async function r_(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 n_(e,t=""){await Ne.post(`/action/content/v3/publish/${e}`,{request:{content:{lastPublishedBy:t}}})}async function s_(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 o_(e,t){await Ne.post(`/action/content/v3/reject/${e}`,{request:{content:{rejectComment:t}}})}async function a_(e,t){await Ne.patch(`/action/content/v1/collaborator/update/${e}`,{request:{content:{collaborators:t}}})}const De={container:"_container_r27rp_1",header:"_header_r27rp_13",title:"_title_r27rp_22",closeBtn:"_closeBtn_r27rp_29",body:"_body_r27rp_45",label:"_label_r27rp_54",searchSection:"_searchSection_r27rp_62",searchRow:"_searchRow_r27rp_68",searchInput:"_searchInput_r27rp_74",searchSpinner:"_searchSpinner_r27rp_89",resultsList:"_resultsList_r27rp_105",resultItem:"_resultItem_r27rp_118",userInfo:"_userInfo_r27rp_133",userName:"_userName_r27rp_141",userEmail:"_userEmail_r27rp_150",userOrg:"_userOrg_r27rp_158",noResults:"_noResults_r27rp_167",collabSection:"_collabSection_r27rp_174",sectionTitle:"_sectionTitle_r27rp_179",badge:"_badge_r27rp_189",emptyCollab:"_emptyCollab_r27rp_203",collabList:"_collabList_r27rp_214",collabItem:"_collabItem_r27rp_223",userAvatar:"_userAvatar_r27rp_237",error:"_error_r27rp_251",success:"_success_r27rp_257",footer:"_footer_r27rp_263"},l_=({contentId:e,onClose:t})=>{var A,$;const r=oe(N=>N.editorConfig),n=(A=r==null?void 0:r.context)==null?void 0:A.channel,s=($=r==null?void 0:r.config)==null?void 0:$.objectType,[i,o]=h.useState(""),[a,c]=h.useState([]),[d,u]=h.useState(!1),[f,g]=h.useState([]),[y,_]=h.useState(!1),[p,v]=h.useState(""),[m,b]=h.useState(!1),S=h.useRef(null);h.useEffect(()=>{let N=!1;return(async()=>{try{const M=await s_(e),U=(M==null?void 0:M.collaborators)??[];if(!U.length)return;const P=await Zb(U);if(N)return;const L=U.map(j=>P.find(X=>X.identifier===j)??{identifier:j,firstName:j});g(L)}catch{}})(),()=>{N=!0}},[e]),h.useEffect(()=>{S.current&&clearTimeout(S.current);const N=i.trim();if(N.length<2){c([]);return}return S.current=setTimeout(async()=>{u(!0);try{const M=await Xb(N,{rootOrgId:n,objectType:s}),U=new Set(f.map(P=>P.identifier));c(M.filter(P=>!U.has(P.identifier)))}catch{c([])}finally{u(!1)}},300),()=>{S.current&&clearTimeout(S.current)}},[i,f,n,s]);const w=h.useCallback(N=>{g(M=>M.find(U=>U.identifier===N.identifier)?M:[...M,N]),c(M=>M.filter(U=>U.identifier!==N.identifier)),b(!1)},[]),E=h.useCallback(N=>{g(M=>M.filter(U=>U.identifier!==N)),b(!1)},[]),D=h.useCallback(async()=>{_(!0),v(""),b(!1);try{await a_(e,f.map(N=>N.identifier)),b(!0)}catch{v("Failed to save collaborators. Please try again.")}finally{_(!1)}},[e,f]),x=N=>`${N.firstName}${N.lastName?` ${N.lastName}`:""}`;return l.jsxs("div",{className:De.container,children:[l.jsxs("div",{className:De.header,children:[l.jsx("h2",{className:De.title,children:"Manage Collaborators"}),l.jsx("button",{className:De.closeBtn,onClick:t,"aria-label":"Close",children:"✕"})]}),l.jsxs("div",{className:De.body,children:[l.jsxs("div",{className:De.searchSection,children:[l.jsx("label",{className:De.label,htmlFor:"collab-search",children:"Search users"}),l.jsxs("div",{className:De.searchRow,children:[l.jsx("input",{id:"collab-search",type:"text",className:De.searchInput,placeholder:"Search by name or email...",value:i,onChange:N=>o(N.target.value)}),d&&l.jsx("span",{className:De.searchSpinner,"aria-label":"Searching..."})]}),a.length>0&&l.jsx("ul",{className:De.resultsList,role:"listbox","aria-label":"Search results",children:a.map(N=>{var M,U,P,L;return l.jsxs("li",{className:De.resultItem,role:"option","aria-selected":"false",children:[l.jsxs("div",{className:De.userInfo,children:[l.jsx("span",{className:De.userName,children:x(N)}),N.email&&l.jsx("span",{className:De.userEmail,children:N.email}),(((U=(M=N.organisations)==null?void 0:M[0])==null?void 0:U.orgName)??N.rootOrgName)&&l.jsx("span",{className:De.userOrg,children:((L=(P=N.organisations)==null?void 0:P[0])==null?void 0:L.orgName)??N.rootOrgName})]}),l.jsx(Fe,{variant:"primary",size:"sm",onClick:()=>w(N),children:"Add"})]},N.identifier)})}),i.trim().length>=2&&!d&&a.length===0&&l.jsx("p",{className:De.noResults,children:"No users found."})]}),l.jsxs("div",{className:De.collabSection,children:[l.jsxs("h3",{className:De.sectionTitle,children:["Current Collaborators",f.length>0&&l.jsx("span",{className:De.badge,children:f.length})]}),f.length===0?l.jsx("p",{className:De.emptyCollab,children:"No collaborators added yet."}):l.jsx("ul",{className:De.collabList,children:f.map(N=>{var M,U,P,L;return l.jsxs("li",{className:De.collabItem,children:[l.jsx("div",{className:De.userAvatar,"aria-hidden":"true",children:x(N).charAt(0).toUpperCase()}),l.jsxs("div",{className:De.userInfo,children:[l.jsx("span",{className:De.userName,children:x(N)}),N.email&&l.jsx("span",{className:De.userEmail,children:N.email}),(((U=(M=N.organisations)==null?void 0:M[0])==null?void 0:U.orgName)??N.rootOrgName)&&l.jsx("span",{className:De.userOrg,children:((L=(P=N.organisations)==null?void 0:P[0])==null?void 0:L.orgName)??N.rootOrgName})]}),l.jsx(Fe,{variant:"danger",size:"sm",onClick:()=>E(N.identifier),children:"Remove"})]},N.identifier)})})]}),p&&l.jsx("p",{className:De.error,role:"alert",children:p}),m&&l.jsx("p",{className:De.success,role:"status",children:"Collaborators saved successfully."})]}),l.jsxs("div",{className:De.footer,children:[l.jsx(Fe,{variant:"ghost",onClick:t,disabled:y,children:"Cancel"}),l.jsx(Fe,{variant:"primary",isLoading:y,onClick:D,children:"Save"})]})]})};async function c_(e){return(await Ne.post("/api/dialcode/v1/read",{request:{dialcodes:[e]}})).data}async function u_(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 d_(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 le={topbar:"_topbar_zj8wk_1",left:"_left_zj8wk_15",right:"_right_zj8wk_23",backBtn:"_backBtn_zj8wk_30",title:"_title_zj8wk_49",statusChip:"_statusChip_zj8wk_61",savedIndicator:"_savedIndicator_zj8wk_73",unsaved:"_unsaved_zj8wk_83",iconBtn:"_iconBtn_zj8wk_88",iconBtnLabel:"_iconBtnLabel_zj8wk_115",qrDropdown:"_qrDropdown_zj8wk_119",qrMenu:"_qrMenu_zj8wk_123",reviewBtns:"_reviewBtns_zj8wk_158",sourcingBtns:"_sourcingBtns_zj8wk_167",modalOverlay:"_modalOverlay_zj8wk_176",sbOverlay:"_sbOverlay_zj8wk_186",sbModal:"_sbModal_zj8wk_196",sbModalHeader:"_sbModalHeader_zj8wk_207",sbModalTitle:"_sbModalTitle_zj8wk_215",sbModalClose:"_sbModalClose_zj8wk_222",sbModalBody:"_sbModalBody_zj8wk_235",sbLabel:"_sbLabel_zj8wk_242",sbTextarea:"_sbTextarea_zj8wk_249",sbError:"_sbError_zj8wk_266",sbModalFooter:"_sbModalFooter_zj8wk_273"};function f_(e){return e?new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):""}function h_(e){return typeof e=="string"&&e.trim().length>0?e.trim():"Draft"}const p_=({titleText:e,labelText:t,placeholderText:r,submitLabel:n,submitVariant:s="primary",onConfirm:i,onCancel:o})=>{const[a,c]=h.useState(""),d=e.toLowerCase().replace(/\s+/g,"-");return l.jsx("div",{className:le.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":`${d}-title`,children:l.jsxs("div",{className:le.sbModal,children:[l.jsxs("div",{className:le.sbModalHeader,children:[l.jsx("span",{id:`${d}-title`,className:le.sbModalTitle,children:e}),l.jsx("button",{className:le.sbModalClose,onClick:o,"aria-label":"Close",type:"button",children:"×"})]}),l.jsxs("div",{className:le.sbModalBody,children:[l.jsxs("label",{className:le.sbLabel,htmlFor:`${d}-comment`,children:[t," ",l.jsx("span",{"aria-hidden":"true",style:{color:"var(--sbx-error, #DC2626)"},children:"*"})]}),l.jsx("textarea",{id:`${d}-comment`,className:le.sbTextarea,placeholder:r,value:a,onChange:u=>c(u.target.value),rows:4,required:!0,"aria-required":"true"}),a.trim().length===0&&l.jsx("p",{className:le.sbError,children:"Fill comments"})]}),l.jsxs("div",{className:le.sbModalFooter,children:[l.jsx(Fe,{variant:"ghost",onClick:o,children:"Cancel"}),l.jsx(Fe,{variant:s,onClick:()=>i(a.trim()),disabled:a.trim().length===0,children:n})]})]})})},g_=({onConfirm:e,onCancel:t})=>{const[r,n]=h.useState(!1);return l.jsx("div",{className:le.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":"review-confirm-title",children:l.jsxs("div",{className:le.sbModal,children:[l.jsxs("div",{className:le.sbModalHeader,children:[l.jsx("span",{id:"review-confirm-title",className:le.sbModalTitle,children:"Accepting Terms & Conditions"}),l.jsx("button",{className:le.sbModalClose,onClick:t,"aria-label":"Close",type:"button",children:"×"})]}),l.jsx("div",{className:le.sbModalBody,children:l.jsxs("label",{style:{display:"flex",gap:8,alignItems:"flex-start",fontSize:13,lineHeight:1.55},children:[l.jsx("input",{type:"checkbox",checked:r,onChange:s=>n(s.target.checked),style:{marginTop:2}}),l.jsxs("span",{children:["I agree that by submitting / publishing this Content, I confirm that this Content complies with prescribed guidelines, including the Terms of Use and Content Policy and that I consent to publish it under the"," ",l.jsx("a",{className:"sb-color-primary",style:{fontWeight:600},href:"https://creativecommons.org/licenses",target:"_blank",rel:"noreferrer",children:"Creative Commons Framework"})," ","in accordance with the ",l.jsx("strong",{children:"Content Policy"}),". I have made sure that I do not violate others’ copyright or privacy rights."]})]})}),l.jsxs("div",{className:le.sbModalFooter,children:[l.jsx(Fe,{variant:"ghost",onClick:t,children:"Cancel"}),l.jsx(Fe,{variant:"primary",onClick:e,disabled:!r,children:"Submit"})]})]})})},y_=({onConfirm:e,onCancel:t})=>{const[r,n]=h.useState(""),s=parseInt(r,10),i=!isNaN(s)&&s>=2&&s<=250;return l.jsx("div",{className:le.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":"genqr-title",children:l.jsxs("div",{className:le.sbModal,children:[l.jsxs("div",{className:le.sbModalHeader,children:[l.jsx("span",{id:"genqr-title",className:le.sbModalTitle,children:"Generate QR Codes"}),l.jsx("button",{className:le.sbModalClose,onClick:t,"aria-label":"Close",type:"button",children:"×"})]}),l.jsxs("div",{className:le.sbModalBody,children:[l.jsxs("label",{className:le.sbLabel,htmlFor:"qr-count",children:["Number of QR Codes ",l.jsx("span",{"aria-hidden":"true",style:{color:"var(--sbx-error, #DC2626)"},children:"*"})]}),l.jsx("input",{id:"qr-count",type:"number",min:2,max:250,className:le.sbTextarea,style:{resize:"none",height:"40px"},placeholder:"Enter number (2–250)",value:r,onChange:o=>n(o.target.value)}),r&&!i&&l.jsx("p",{className:le.sbError,children:"Enter a number between 2 and 250."})]}),l.jsxs("div",{className:le.sbModalFooter,children:[l.jsx(Fe,{variant:"ghost",onClick:t,children:"Cancel"}),l.jsx(Fe,{variant:"primary",onClick:()=>e(s),disabled:!i,children:"Generate"})]})]})})},v_=({editorMode:e,isSaving:t,isDirty:r,lastSaved:n,isFormValid:s=!0,onToolbarEvent:i})=>{var G,ce;const a=Ie(ee=>ee.treeData)[0],c=(a==null?void 0:a.name)??"Untitled",d=h_(((G=a==null?void 0:a.metadata)==null?void 0:G.status)??(a==null?void 0:a.status)),u=oe(ee=>{var ge,ae,Re,Ee;return((ae=(ge=ee.editorConfig)==null?void 0:ge.context)==null?void 0:ae.contentId)??((Ee=(Re=ee.editorConfig)==null?void 0:Re.context)==null?void 0:Ee.identifier)??""}),{activeModal:f,modalData:g,closeModal:y,openModal:_}=em(),p=oe(ee=>ee.buttonLoaders),v=oe(ee=>ee.categoryMeta),m=!v||v.schemaDefaults.generateDIALCodes!=="No",[b,S]=h.useState(!1),[w,E]=h.useState(!1),[D,x]=h.useState(!1),A=h.useRef(null),[$,N]=h.useState(!1);h.useEffect(()=>{if(!D)return;const ee=ge=>{var ae;(ae=A.current)!=null&&ae.contains(ge.target)||x(!1)};return document.addEventListener("mousedown",ee),()=>document.removeEventListener("mousedown",ee)},[D]);const[M,U]=h.useState(!1),[P,L]=h.useState(!1),{updateNode:j}=Ie(),X=(ce=a==null?void 0:a.metadata)==null?void 0:ce.qrCodeProcessId,se=h.useCallback(async ee=>{if(u){N(!1),U(!0);try{const{processId:ge,reservedDialcodes:ae}=await u_(u,ee);ge&&a&&j(a.id,{qrCodeProcessId:ge,reservedDialcodes:ae}),Oe.success('QR Codes generation started. Use "Download QR Codes" once ready.')}catch{Oe.error("Failed to generate QR Codes. Please try again.")}finally{U(!1)}}},[u,a,j]),xe=h.useCallback(async()=>{if(!X){Oe.error("No QR codes generated yet. Generate QR Codes first.");return}L(!0);try{const ee=await d_(X);if(ee.status==="in-process"){Oe("QR code image generation is in progress. Please try downloading after some time.",{icon:"ℹ️"});return}const ge=ee.url;if(!ge){Oe.error("QR Codes not ready yet. Please wait and try again.");return}const ae=await fetch(ge).then(Ve=>Ve.blob()),Re=await new Promise(Ve=>{const Je=new FileReader;Je.onloadend=()=>Ve(Je.result),Je.readAsDataURL(ae)}),Ee=(a==null?void 0:a.metadata)??{},Ze=Ve=>Array.isArray(Ve)?Ve.join("_"):typeof Ve=="string"?Ve:"",Ye=[u,Ze(Ee.medium),Ze(Ee.gradeLevel),Ze(Ee.subject)].filter(Boolean),qe=new Date().toISOString().replace(/[:.]/g,"-"),re=`${Ye.join("_")}_${qe}.zip`,Le=document.createElement("a");Le.href=Re,Le.download=re,Le.style.display="none",document.body.appendChild(Le),Le.click(),document.body.removeChild(Le),Oe.success("QR codes downloaded.")}catch{Oe.error("Failed to download QR Codes.")}finally{L(!1)}},[X,a,u]),Ce=e==="edit",be=e==="review",z=e==="sourcingreview",J=e==="read",te=h.useCallback((ee,ge)=>{i({action:ee,data:ge})},[i]),V=h.useCallback(()=>{y(),te("publish")},[y,te]),Z=h.useCallback((ee,ge)=>{const ae=g==null?void 0:g.action;y(),ae==="approve"?te("sourcingApprove",{comment:ee,score:ge}):te("reject",{comment:ee})},[y,te,g]);return l.jsxs(l.Fragment,{children:[l.jsxs("header",{className:le.topbar,role:"banner",children:[l.jsxs("div",{className:le.left,children:[l.jsx("button",{className:le.backBtn,onClick:()=>te("back"),"aria-label":"Go back",type:"button",children:l.jsx(mv,{size:18})}),l.jsx("h1",{className:le.title,title:c,children:c}),l.jsx("span",{className:`sbx-chip ${le.statusChip}`,"aria-label":`Status: ${d}`,children:d})]}),l.jsxs("div",{className:le.right,children:[t?l.jsx("span",{className:le.savedIndicator,"aria-live":"polite",children:"Saving…"}):r&&Ce?l.jsx("span",{className:`${le.savedIndicator} ${le.unsaved}`,"aria-live":"polite",children:"Unsaved"}):n?l.jsxs("span",{className:le.savedIndicator,"aria-live":"polite",children:[l.jsx(bn,{size:14,"aria-hidden":"true"}),"Saved ",f_(n)]}):null,!J&&!be&&!z&&d!=="Review"&&l.jsx("span",{title:s?void 0:"Fill all required fields before saving",children:l.jsx(Fe,{variant:"ghost",size:"sm",onClick:()=>te("saveCollection"),disabled:!s,children:"Save as Draft"})}),Ce&&l.jsxs(l.Fragment,{children:[l.jsxs(Fe,{variant:"primary",size:"sm",onClick:()=>E(!0),disabled:p.saveCollection,isLoading:p.saveCollection,children:[l.jsx(Mv,{size:14,"aria-hidden":"true"})," Send for review"]}),l.jsx("button",{className:le.iconBtn,onClick:()=>_("manageCollaborators"),"aria-label":"Collaborators",title:"Collaborators",type:"button",children:l.jsx($v,{size:16,"aria-hidden":"true"})}),m&&l.jsxs("div",{className:le.qrDropdown,ref:A,children:[l.jsxs("button",{className:le.iconBtn,onClick:()=>x(ee=>!ee),"aria-label":"QR Codes",title:"QR Codes",type:"button","aria-haspopup":"true","aria-expanded":D,children:[l.jsx(Qc,{size:16,"aria-hidden":"true"}),l.jsx("span",{className:le.iconBtnLabel,children:"QR Codes"}),l.jsx("span",{style:{fontSize:10,marginLeft:2},children:"▾"})]}),D&&l.jsxs("div",{className:le.qrMenu,role:"menu",children:[l.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{x(!1),N(!0)},disabled:M,children:[l.jsx(Qc,{size:14}),M?"Generating…":"Generate QR Codes"]}),l.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{x(!1),xe()},disabled:P||!X,children:[l.jsx(Ev,{size:14}),P?"Downloading…":"Download QR Codes"]})]})]})]}),be&&l.jsxs("div",{className:le.reviewBtns,children:[l.jsxs(Fe,{variant:"primary",size:"sm",onClick:()=>_("publishChecklist"),disabled:p.publishCollection,isLoading:p.publishCollection,children:[l.jsx(Vc,{size:14,"aria-hidden":"true"})," Publish"]}),l.jsxs(Fe,{variant:"primary",size:"sm",onClick:()=>S(!0),disabled:p.rejectCollection,isLoading:p.rejectCollection,children:[l.jsx(Kc,{size:14,"aria-hidden":"true"})," Request for Changes"]})]}),z&&l.jsxs("div",{className:le.sourcingBtns,children:[l.jsxs(Fe,{variant:"primary",size:"sm",onClick:()=>_("qualityParams",{action:"approve"}),children:[l.jsx(Lv,{size:14,"aria-hidden":"true"})," Approve"]}),l.jsxs(Fe,{variant:"primary",size:"sm",onClick:()=>_("qualityParams",{action:"reject"}),children:[l.jsx(Kc,{size:14,"aria-hidden":"true"})," Request for Changes"]})]})]})]}),f==="publishChecklist"&&l.jsx(nm,{contentId:u,onConfirm:V,onCancel:y}),f==="qualityParams"&&l.jsx(sm,{contentId:u,action:(g==null?void 0:g.action)??"reject",onConfirm:Z,onCancel:y}),f==="manageCollaborators"&&l.jsx("div",{className:le.modalOverlay,role:"dialog","aria-modal":"true",children:l.jsx(l_,{contentId:u,onClose:y})}),w&&l.jsx(g_,{onConfirm:()=>{E(!1),te("sendForReview")},onCancel:()=>E(!1)}),b&&l.jsx(p_,{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.jsx(y_,{onConfirm:se,onCancel:()=>N(!1)})]})},m_=({onSave:e,onDiscard:t,onCancel:r,isSaving:n})=>Pe.createPortal(l.jsx("div",{className:Me.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"unsaved-title",children:l.jsxs("div",{className:Me.modal,children:[l.jsxs("div",{className:Me.modalHeader,children:[l.jsx("span",{id:"unsaved-title",children:"Unsaved changes"}),l.jsx("button",{className:Me.modalHeaderClose,onClick:r,"aria-label":"Close",disabled:n,children:"×"})]}),l.jsx("div",{className:Me.modalBody,children:l.jsx("p",{style:{margin:0,fontSize:14,lineHeight:1.5},children:"You have unsaved changes. Would you like to save them before leaving?"})}),l.jsxs("div",{className:Me.modalFooter,children:[l.jsx(Fe,{variant:"ghost",onClick:r,disabled:n,children:"Cancel"}),l.jsx(Fe,{variant:"danger",onClick:t,disabled:n,children:"Discard"}),l.jsx(Fe,{variant:"primary",onClick:e,isLoading:n,disabled:n,children:"Save"})]})]})}),document.body);var b_=ea();const ed=h.createContext(null);function Tt(){const e=h.useContext(ed);if(e===null)throw new Error("No Tree Api Provided");return e}const td=h.createContext(null);function __(){const e=h.useContext(td);if(e===null)throw new Error("Provide a NodesContext");return e}const rd=h.createContext(null);function w_(){const e=h.useContext(rd);if(e===null)throw new Error("Provide a DnDContext");return e}const nd=h.createContext(0);function sd(){h.useContext(nd)}function ki(e,t,r){return Math.max(Math.min(e,r),t)}function id(e){return e&&e.isLeaf}function od(e){return e&&e.isInternal&&!e.isOpen}function ad(e){var t;return e&&e.isOpen&&!(!((t=e.children)===null||t===void 0)&&t.length)}const ld=(e,t)=>{let r=e;for(;r;){if(r.id===t.id)return!0;r=r.parent}return!1},cd=e=>{if(!e.parent)throw Error("Node does not have a parent");return e.parent.children.findIndex(t=>t.id===e.id)};function _a(e,t){if(!e)return null;if(e.id===t)return e;if(e.children)for(let r of e.children){const n=_a(r,t);if(n)return n}return null}function xi(e,t){if(t(e),e.children)for(let r of e.children)xi(r,t)}function ud(e){const t=fd(e);let r;for(let n=0;n<t.length;++n)if(t[n]===e){r=S_(t,n);break}r==null||r.focus()}function dd(e){const t=fd(e);let r;for(let n=0;n<t.length;++n)if(t[n]===e){r=C_(t,n);break}r==null||r.focus()}function S_(e,t){return t+1<e.length?e[t+1]:e[0]}function C_(e,t){return t-1>=0?e[t-1]:e[e.length-1]}function fd(e){return Array.from(document.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled]), details:not([disabled]), summary:not(:disabled)')).filter(t=>t===e||!e.contains(t))}function ws(e,t){return typeof t=="boolean"?t:typeof t=="string"?e[t]:t(e)}function In(e){return typeof e=="string"?e:e.id}function E_(e,...t){if(e)return e(...t)}function hd(e){return new Promise((t,r)=>{let n=0;function s(){n+=1,n===100&&r(),e()?t():setTimeout(s,10)}s()})}function pd(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 gd(e){const t=e.focusedNode;return t?t.isOpen?t.id:t.parent&&!t.parent.isRoot?t.parent.id:null:null}const O_=Object.freeze(Object.defineProperty({__proto__:null,access:ws,bound:ki,dfs:_a,focusNextElement:ud,focusPrevElement:dd,getInsertIndex:pd,getInsertParentId:gd,identify:In,indexOf:cd,isClosed:od,isDescendant:ld,isItem:id,isOpenWithEmptyChildren:ad,safeRun:E_,waitFor:hd,walk:xi},Symbol.toStringTag,{value:"Module"})),I_={display:"flex",alignItems:"center",zIndex:1},D_={flex:1,height:"2px",background:"#4B91E2",borderRadius:"1px"},T_={width:"4px",height:"4px",boxShadow:"0 0 0 3px #4B91E2",borderRadius:"50%"},N_=h.memo(function({top:t,left:r,indent:n}){const s={position:"absolute",pointerEvents:"none",top:t-2+"px",left:r+"px",right:n+"px"};return l.jsxs("div",{style:Object.assign(Object.assign({},I_),s),children:[l.jsx("div",{style:Object.assign({},T_)}),l.jsx("div",{style:Object.assign({},D_)})]})});function k_({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 x_(e){return l.jsxs("div",{ref:e.dragHandle,style:e.style,children:[l.jsx("span",{onClick:t=>{t.stopPropagation(),e.node.toggle()},children:e.node.isLeaf?"🌳":e.node.isOpen?"🗁":"🗀"})," ",e.node.isEditing?l.jsx(P_,Object.assign({},e)):l.jsx(A_,Object.assign({},e))]})}function A_(e){return l.jsx(l.Fragment,{children:l.jsx("span",{children:e.node.data.name})})}function P_({node:e}){const t=h.useRef();return h.useEffect(()=>{var r,n;(r=t.current)===null||r===void 0||r.focus(),(n=t.current)===null||n===void 0||n.select()},[]),l.jsx("input",{ref:t,defaultValue:e.data.name,onBlur:()=>e.reset(),onKeyDown:r=>{var n;r.key==="Escape"&&e.reset(),r.key==="Enter"&&e.submit(((n=t.current)===null||n===void 0?void 0:n.value)||"")}})}const Ss="__REACT_ARBORIST_INTERNAL_ROOT__";function yd(e){var t;function r(i,o,a){const c=e.accessId(i),d=new Cs({tree:e,data:i,level:o,parent:a,id:c,children:null,isDraggable:e.isDraggable(i),rowIndex:null}),u=e.accessChildren(i);return u&&(d.children=u.map(f=>r(f,o+1,d))),d}const n=new Cs({tree:e,id:Ss,data:{id:Ss},level:-1,parent:null,children:null,isDraggable:!0,rowIndex:null}),s=(t=e.props.data)!==null&&t!==void 0?t:[];return n.children=s.map(i=>r(i,0,n)),n}class Cs{constructor(t){this.handleClick=r=>{(r.metaKey||r.ctrlKey)&&!this.tree.props.disableMultiSelection?this.isSelected?this.deselect():this.selectMulti():r.shiftKey&&!this.tree.props.disableMultiSelection?this.selectContiguous():(this.select(),this.activate())},this.tree=t.tree,this.id=t.id,this.data=t.data,this.level=t.level,this.children=t.children,this.parent=t.parent,this.isDraggable=t.isDraggable,this.rowIndex=t.rowIndex}get isRoot(){return this.id===Ss}get isLeaf(){return!Array.isArray(this.children)}get isInternal(){return!this.isLeaf}get isOpen(){return this.isLeaf?!1:this.tree.isOpen(this.id)}get isClosed(){return this.isLeaf?!1:!this.tree.isOpen(this.id)}get isEditable(){return this.tree.isEditable(this.data)}get isSelectable(){return this.tree.isSelectable(this.data)}get isEditing(){return this.tree.editingId===this.id}get isSelected(){return this.tree.isSelected(this.id)}get isOnlySelection(){return this.isSelected&&this.tree.hasOneSelection}get isSelectedStart(){var t;return this.isSelected&&!(!((t=this.prev)===null||t===void 0)&&t.isSelected)}get isSelectedEnd(){var t;return this.isSelected&&!(!((t=this.next)===null||t===void 0)&&t.isSelected)}get isFocused(){return this.tree.isFocused(this.id)}get isDragging(){return this.tree.isDragging(this.id)}get willReceiveDrop(){return this.tree.willReceiveDrop(this.id)}get state(){return{isClosed:this.isClosed,isDragging:this.isDragging,isEditing:this.isEditing,isFocused:this.isFocused,isInternal:this.isInternal,isLeaf:this.isLeaf,isOpen:this.isOpen,isSelected:this.isSelected,isSelectedEnd:this.isSelectedEnd,isSelectedStart:this.isSelectedStart,willReceiveDrop:this.willReceiveDrop}}get childIndex(){return this.parent&&this.parent.children?this.parent.children.findIndex(t=>t.id===this.id):-1}get next(){return this.rowIndex===null?null:this.tree.at(this.rowIndex+1)}get prev(){return this.rowIndex===null?null:this.tree.at(this.rowIndex-1)}get nextSibling(){var t,r;const n=this.childIndex;return(r=(t=this.parent)===null||t===void 0?void 0:t.children[n+1])!==null&&r!==void 0?r:null}isAncestorOf(t){if(!t)return!1;let r=t;for(;r;){if(r.id===this.id)return!0;r=r.parent}return!1}select(){this.tree.select(this)}deselect(){this.tree.deselect(this)}selectMulti(){this.tree.selectMulti(this)}selectContiguous(){this.tree.selectContiguous(this)}activate(){this.tree.activate(this)}focus(){this.tree.focus(this)}toggle(){this.tree.toggle(this)}open(){this.tree.open(this)}openParents(){this.tree.openParents(this)}close(){this.tree.close(this)}submit(t){this.tree.submit(this,t)}reset(){this.tree.reset()}clone(){return new Cs(Object.assign({},this))}edit(){return this.tree.edit(this)}}function wa(e){return{type:"EDIT",id:e}}function M_(e={id:null},t){return t.type==="EDIT"?Object.assign(Object.assign({},e),{id:t.id}):e}function Dn(e){return{type:"FOCUS",id:e}}function L_(){return{type:"TREE_BLUR"}}function F_(e={id:null,treeFocused:!1},t){return t.type==="FOCUS"?Object.assign(Object.assign({},e),{id:t.id,treeFocused:!0}):t.type==="TREE_BLUR"?Object.assign(Object.assign({},e),{treeFocused:!1}):e}const Sa={open(e,t){return{type:"VISIBILITY_OPEN",id:e,filtered:t}},close(e,t){return{type:"VISIBILITY_CLOSE",id:e,filtered:t}},toggle(e,t){return{type:"VISIBILITY_TOGGLE",id:e,filtered:t}},clear(e){return{type:"VISIBILITY_CLEAR",filtered:e}}};function vd(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 $_(e={filtered:{},unfiltered:{}},t){return t.type.startsWith("VISIBILITY")?t.filtered?Object.assign(Object.assign({},e),{filtered:vd(e.filtered,t)}):Object.assign(Object.assign({},e),{unfiltered:vd(e.unfiltered,t)}):e}const Tn=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}}},Tr={clear:()=>({type:"SELECTION_CLEAR"}),only:e=>({type:"SELECTION_ONLY",id:In(e)}),add:e=>({type:"SELECTION_ADD",ids:(Array.isArray(e)?e:[e]).map(In)}),remove:e=>({type:"SELECTION_REMOVE",ids:(Array.isArray(e)?e:[e]).map(In)}),set:e=>Object.assign({type:"SELECTION_SET"},e),mostRecent:e=>({type:"SELECTION_MOST_RECENT",id:e===null?null:In(e)}),anchor:e=>({type:"SELECTION_ANCHOR",id:e===null?null:In(e)})};function j_(e=Tn().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 Nn={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 B_(e=Tn().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 Tn().dnd;case"DND_HOVERING":return Object.assign(Object.assign({},e),{parentId:t.parentId,index:t.index});default:return e}}const U_={position:"fixed",pointerEvents:"none",zIndex:100,left:0,top:0,width:"100%",height:"100%"},V_=e=>{if(!e)return{display:"none"};const{x:t,y:r}=e;return{transform:`translate(${t}px, ${r}px)`}},q_=e=>{if(!e)return{display:"none"};const{x:t,y:r}=e;return{transform:`translate(${t+10}px, ${r+10}px)`}};function md({offset:e,mouse:t,id:r,dragIds:n,isDragging:s}){return l.jsxs(z_,{isDragging:s,children:[l.jsx(H_,{offset:e,children:l.jsx(Q_,{id:r,dragIds:n})}),l.jsx(W_,{mouse:t,count:n.length})]})}const z_=h.memo(function(t){return t.isDragging?l.jsx("div",{style:U_,children:t.children}):null});function H_(e){return l.jsx("div",{className:"row preview",style:V_(e.offset),children:e.children})}function W_(e){const{count:t,mouse:r}=e;return t>1?l.jsx("div",{className:"selected-count",style:q_(r),children:t}):null}const Q_=h.memo(function(t){const r=Tt(),n=r.get(t.id);return n?l.jsx(r.renderNode,{preview:!0,node:n,style:{paddingLeft:n.level*r.indent,opacity:.2,background:"transparent"},tree:r}):null});function Ca(){return Ca=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ca.apply(null,arguments)}function bd(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ea(e,t){return Ea=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Ea(e,t)}function K_(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Ea(e,t)}var _d=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function G_(e,t){return!!(e===t||_d(e)&&_d(t))}function R_(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!G_(e[r],t[r]))return!1;return!0}function Oa(e,t){t===void 0&&(t=R_);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 Y_=typeof performance=="object"&&typeof performance.now=="function",wd=Y_?function(){return performance.now()}:function(){return Date.now()};function Sd(e){cancelAnimationFrame(e.id)}function X_(e,t){var r=wd();function n(){wd()-r>=t?e.call(null):s.id=requestAnimationFrame(n)}var s={id:requestAnimationFrame(n)};return s}var Ia=-1;function Cd(e){if(e===void 0&&(e=!1),Ia===-1||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",document.body.appendChild(t),Ia=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return Ia}var kn=null;function Ed(e){if(e===void 0&&(e=!1),kn===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?kn="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?kn="negative":kn="positive-ascending"),document.body.removeChild(t),kn}return kn}process.env.NODE_ENV;var Z_=150,J_=function(t,r){return t},Ai=null,Pi=null;process.env.NODE_ENV!=="production"&&typeof window<"u"&&typeof window.WeakSet<"u"&&(Ai=new WeakSet,Pi=new WeakSet);function Od(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){K_(g,f);function g(_){var p;return p=f.call(this,_)||this,p._instanceProps=c(p.props,bd(p)),p._outerRef=void 0,p._resetIsScrollingTimeoutId=null,p.state={instance:bd(p),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof p.props.initialScrollOffset=="number"?p.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},p._callOnItemsRendered=void 0,p._callOnItemsRendered=Oa(function(v,m,b,S){return p.props.onItemsRendered({overscanStartIndex:v,overscanStopIndex:m,visibleStartIndex:b,visibleStopIndex:S})}),p._callOnScroll=void 0,p._callOnScroll=Oa(function(v,m,b){return p.props.onScroll({scrollDirection:v,scrollOffset:m,scrollUpdateWasRequested:b})}),p._getItemStyle=void 0,p._getItemStyle=function(v){var m=p.props,b=m.direction,S=m.itemSize,w=m.layout,E=p._getItemStyleCache(d&&S,d&&w,d&&b),D;if(E.hasOwnProperty(v))D=E[v];else{var x=r(p.props,v,p._instanceProps),A=s(p.props,v,p._instanceProps),$=b==="horizontal"||w==="horizontal",N=b==="rtl",M=$?x:0;E[v]=D={position:"absolute",left:N?void 0:M,right:N?M:void 0,top:$?0:x,height:$?"100%":A,width:$?A:"100%"}}return D},p._getItemStyleCache=void 0,p._getItemStyleCache=Oa(function(v,m,b){return{}}),p._onScrollHorizontal=function(v){var m=v.currentTarget,b=m.clientWidth,S=m.scrollLeft,w=m.scrollWidth;p.setState(function(E){if(E.scrollOffset===S)return null;var D=p.props.direction,x=S;if(D==="rtl")switch(Ed()){case"negative":x=-S;break;case"positive-descending":x=w-b-S;break}return x=Math.max(0,Math.min(x,w-b)),{isScrolling:!0,scrollDirection:E.scrollOffset<x?"forward":"backward",scrollOffset:x,scrollUpdateWasRequested:!1}},p._resetIsScrollingDebounced)},p._onScrollVertical=function(v){var m=v.currentTarget,b=m.clientHeight,S=m.scrollHeight,w=m.scrollTop;p.setState(function(E){if(E.scrollOffset===w)return null;var D=Math.max(0,Math.min(w,S-b));return{isScrolling:!0,scrollDirection:E.scrollOffset<D?"forward":"backward",scrollOffset:D,scrollUpdateWasRequested:!1}},p._resetIsScrollingDebounced)},p._outerRefSetter=function(v){var m=p.props.outerRef;p._outerRef=v,typeof m=="function"?m(v):m!=null&&typeof m=="object"&&m.hasOwnProperty("current")&&(m.current=v)},p._resetIsScrollingDebounced=function(){p._resetIsScrollingTimeoutId!==null&&Sd(p._resetIsScrollingTimeoutId),p._resetIsScrollingTimeoutId=X_(p._resetIsScrolling,Z_)},p._resetIsScrolling=function(){p._resetIsScrollingTimeoutId=null,p.setState({isScrolling:!1},function(){p._getItemStyleCache(-1,null)})},p}g.getDerivedStateFromProps=function(p,v){return ew(p,v),u(p),null};var y=g.prototype;return y.scrollTo=function(p){p=Math.max(0,p),this.setState(function(v){return v.scrollOffset===p?null:{scrollDirection:v.scrollOffset<p?"forward":"backward",scrollOffset:p,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},y.scrollToItem=function(p,v){v===void 0&&(v="auto");var m=this.props,b=m.itemCount,S=m.layout,w=this.state.scrollOffset;p=Math.max(0,Math.min(p,b-1));var E=0;if(this._outerRef){var D=this._outerRef;S==="vertical"?E=D.scrollWidth>D.clientWidth?Cd():0:E=D.scrollHeight>D.clientHeight?Cd():0}this.scrollTo(i(this.props,p,v,w,this._instanceProps,E))},y.componentDidMount=function(){var p=this.props,v=p.direction,m=p.initialScrollOffset,b=p.layout;if(typeof m=="number"&&this._outerRef!=null){var S=this._outerRef;v==="horizontal"||b==="horizontal"?S.scrollLeft=m:S.scrollTop=m}this._callPropsCallbacks()},y.componentDidUpdate=function(){var p=this.props,v=p.direction,m=p.layout,b=this.state,S=b.scrollOffset,w=b.scrollUpdateWasRequested;if(w&&this._outerRef!=null){var E=this._outerRef;if(v==="horizontal"||m==="horizontal")if(v==="rtl")switch(Ed()){case"negative":E.scrollLeft=-S;break;case"positive-ascending":E.scrollLeft=S;break;default:var D=E.clientWidth,x=E.scrollWidth;E.scrollLeft=x-D-S;break}else E.scrollLeft=S;else E.scrollTop=S}this._callPropsCallbacks()},y.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&Sd(this._resetIsScrollingTimeoutId)},y.render=function(){var p=this.props,v=p.children,m=p.className,b=p.direction,S=p.height,w=p.innerRef,E=p.innerElementType,D=p.innerTagName,x=p.itemCount,A=p.itemData,$=p.itemKey,N=$===void 0?J_:$,M=p.layout,U=p.outerElementType,P=p.outerTagName,L=p.style,j=p.useIsScrolling,X=p.width,se=this.state.isScrolling,xe=b==="horizontal"||M==="horizontal",Ce=xe?this._onScrollHorizontal:this._onScrollVertical,be=this._getRangeToRender(),z=be[0],J=be[1],te=[];if(x>0)for(var V=z;V<=J;V++)te.push(h.createElement(v,{data:A,key:N(V,A),index:V,isScrolling:j?se:void 0,style:this._getItemStyle(V)}));var Z=n(this.props,this._instanceProps);return h.createElement(U||P||"div",{className:m,onScroll:Ce,ref:this._outerRefSetter,style:Ca({position:"relative",height:S,width:X,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:b},L)},h.createElement(E||D||"div",{children:te,ref:w,style:{height:xe?"100%":Z,pointerEvents:se?"none":void 0,width:xe?Z:"100%"}}))},y._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var p=this.props.itemCount;if(p>0){var v=this._getRangeToRender(),m=v[0],b=v[1],S=v[2],w=v[3];this._callOnItemsRendered(m,b,S,w)}}if(typeof this.props.onScroll=="function"){var E=this.state,D=E.scrollDirection,x=E.scrollOffset,A=E.scrollUpdateWasRequested;this._callOnScroll(D,x,A)}},y._getRangeToRender=function(){var p=this.props,v=p.itemCount,m=p.overscanCount,b=this.state,S=b.isScrolling,w=b.scrollDirection,E=b.scrollOffset;if(v===0)return[0,0,0,0];var D=o(this.props,E,this._instanceProps),x=a(this.props,D,E,this._instanceProps),A=!S||w==="backward"?Math.max(1,m):1,$=!S||w==="forward"?Math.max(1,m):1;return[Math.max(0,D-A),Math.max(0,Math.min(v-1,x+$)),D,x]},g}(h.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var ew=function(t,r){var n=t.children,s=t.direction,i=t.height,o=t.layout,a=t.innerTagName,c=t.outerTagName,d=t.width,u=r.instance;if(process.env.NODE_ENV!=="production"){(a!=null||c!=null)&&Pi&&!Pi.has(u)&&(Pi.add(u),console.warn("The innerTagName and outerTagName props have been deprecated. Please use the innerElementType and outerElementType props instead."));var f=s==="horizontal"||o==="horizontal";switch(s){case"horizontal":case"vertical":Ai&&!Ai.has(u)&&(Ai.add(u),console.warn('The direction prop should be either "ltr" (default) or "rtl". Please use the layout prop to specify "vertical" (default) or "horizontal" orientation.'));break;case"ltr":case"rtl":break;default:throw Error('An invalid "direction" prop has been specified. Value should be either "ltr" or "rtl". '+('"'+s+'" was specified.'))}switch(o){case"horizontal":case"vertical":break;default:throw Error('An invalid "layout" prop has been specified. Value should be either "horizontal" or "vertical". '+('"'+o+'" was specified.'))}if(n==null)throw Error('An invalid "children" prop has been specified. Value should be a React component. '+('"'+(n===null?"null":typeof n)+'" was specified.'));if(f&&typeof d!="number")throw Error('An invalid "width" prop has been specified. Horizontal lists must specify a number for width. '+('"'+(d===null?"null":typeof d)+'" was specified.'));if(!f&&typeof i!="number")throw Error('An invalid "height" prop has been specified. Vertical lists must specify a number for height. '+('"'+(i===null?"null":typeof i)+'" was specified.'))}},tw=50,xn=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]},rw=function(t,r,n){var s=r.itemMetadataMap,i=r.lastMeasuredIndex,o=i>0?s[i].offset:0;return o>=n?Id(t,r,i,0,n):nw(t,r,Math.max(0,i),n)},Id=function(t,r,n,s,i){for(;s<=n;){var o=s+Math.floor((n-s)/2),a=xn(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},nw=function(t,r,n,s){for(var i=t.itemCount,o=1;n<i&&xn(t,n,r).offset<s;)n+=o,o*=2;return Id(t,r,Math.min(n,i-1),Math.floor(n/2),s)},Dd=function(t,r){var n=t.itemCount,s=r.itemMetadataMap,i=r.estimatedItemSize,o=r.lastMeasuredIndex,a=0;if(o>=n&&(o=n-1),o>=0){var c=s[o];a=c.offset+c.size}var d=n-o-1,u=d*i;return a+u},sw=Od({getItemOffset:function(t,r,n){return xn(t,r,n).offset},getItemSize:function(t,r,n){return n.itemMetadataMap[r].size},getEstimatedTotalSize:Dd,getOffsetForIndexAndAlignment:function(t,r,n,s,i,o){var a=t.direction,c=t.height,d=t.layout,u=t.width,f=a==="horizontal"||d==="horizontal",g=f?u:c,y=xn(t,r,i),_=Dd(t,i),p=Math.max(0,Math.min(_-g,y.offset)),v=Math.max(0,y.offset-g+y.size+o);switch(n==="smart"&&(s>=v-g&&s<=p+g?n="auto":n="center"),n){case"start":return p;case"end":return v;case"center":return Math.round(v+(p-v)/2);case"auto":default:return s>=v&&s<=p?s:s<v?v:p}},getStartIndexForOffset:function(t,r,n){return rw(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=xn(t,r,s),y=n+f,_=g.offset+g.size,p=r;p<a-1&&_<y;)p++,_+=xn(t,p,s).size;return p},initInstanceProps:function(t,r){var n=t,s=n.estimatedItemSize,i={itemMetadataMap:{},estimatedItemSize:s||tw,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.'))}}),iw=Od({getItemOffset:function(t,r){var n=t.itemSize;return r*n},getItemSize:function(t,r){var n=t.itemSize;return n},getEstimatedTotalSize:function(t){var r=t.itemCount,n=t.itemSize;return n*r},getOffsetForIndexAndAlignment:function(t,r,n,s,i,o){var a=t.direction,c=t.height,d=t.itemCount,u=t.itemSize,f=t.layout,g=t.width,y=a==="horizontal"||f==="horizontal",_=y?g:c,p=Math.max(0,d*u-_),v=Math.min(p,r*u),m=Math.max(0,r*u-_+u+o);switch(n==="smart"&&(s>=m-_&&s<=v+_?n="auto":n="center"),n){case"start":return v;case"end":return m;case"center":{var b=Math.round(m+(v-m)/2);return b<Math.ceil(_/2)?0:b>p+Math.floor(_/2)?p:b}case"auto":default:return s>=m&&s<=v?s:s<m?m:v}},getStartIndexForOffset:function(t,r){var n=t.itemCount,s=t.itemSize;return Math.max(0,Math.min(n-1,Math.floor(r/s)))},getStopIndexForStartIndex:function(t,r,n){var s=t.direction,i=t.height,o=t.itemCount,a=t.itemSize,c=t.layout,d=t.width,u=s==="horizontal"||c==="horizontal",f=r*a,g=u?d:i,y=Math.ceil((g+n-f)/a);return Math.max(0,Math.min(o-1,r+y-1))},initInstanceProps:function(t){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(t){var r=t.itemSize;if(process.env.NODE_ENV!=="production"&&typeof r!="number")throw Error('An invalid "itemSize" prop has been specified. Value should be a number. '+('"'+(r===null?"null":typeof r)+'" was specified.'))}});function ow(){var e,t;const r=Tt(),s=w_().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 aw=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 lw=h.forwardRef(function(t,r){const{children:n}=t,s=aw(t,["children"]),i=Tt();return l.jsxs("div",Object.assign({ref:r},s,{onClick:o=>{o.currentTarget===o.target&&i.deselectAll()},children:[l.jsx(cw,{}),n]}))}),cw=()=>{const e=Tt();return l.jsx("div",{style:{height:e.rowTopPosition(e.visibleNodes.length),width:"100%",position:"absolute",left:"0",right:"0"},children:l.jsx(ow,{})})};var uw=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 dw=h.forwardRef(function(t,r){var n,s,i,o,{style:a}=t,c=uw(t,["style"]);const d=Tt(),u=(s=(n=d.props.padding)!==null&&n!==void 0?n:d.props.paddingTop)!==null&&s!==void 0?s:0,f=(o=(i=d.props.padding)!==null&&i!==void 0?i:d.props.paddingBottom)!==null&&o!==void 0?o:0;return l.jsx("div",Object.assign({ref:r,style:Object.assign(Object.assign({},a),{height:`${parseFloat(a.height)+u+f}px`})},c))});var Td=h.createContext({dragDropManager:void 0}),Ut;(function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"})(Ut||(Ut={}));function de(e,t){for(var r=arguments.length,n=new Array(r>2?r-2:0),s=2;s<r;s++)n[s-2]=arguments[s];if(process.env.NODE_ENV!=="production"&&t===void 0)throw new Error("invariant requires an error message argument");if(!e){var i;if(t===void 0)i=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var o=0;i=new Error(t.replace(/%s/g,function(){return n[o++]})),i.name="Invariant Violation"}throw i.framesToPop=1,i}}var Da="dnd-core/INIT_COORDS",Mi="dnd-core/BEGIN_DRAG",Ta="dnd-core/PUBLISH_DRAG_SOURCE",Li="dnd-core/HOVER",Fi="dnd-core/DROP",$i="dnd-core/END_DRAG";function Nd(e,t){return{type:Da,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}function ji(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ji=function(r){return typeof r}:ji=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},ji(e)}function fw(e,t,r){return t.split(".").reduce(function(n,s){return n&&n[s]?n[s]:r||null},e)}function hw(e,t){return e.filter(function(r){return r!==t})}function kd(e){return ji(e)==="object"}function pw(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 gw(e,t){return e.filter(function(r){return t.indexOf(r)>-1})}var yw={type:Da,payload:{clientOffset:null,sourceClientOffset:null}};function vw(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(Nd(o)),mw(r,c,d);var u=ww(r,c);if(u===null){e.dispatch(yw);return}var f=null;if(o){if(!a)throw new Error("getSourceClientOffset must be defined");bw(a),f=a(u)}e.dispatch(Nd(o,f));var g=d.getSource(u),y=g.beginDrag(c,u);if(y!=null){_w(y),d.pinSource(u);var _=d.getSourceType(u);return{type:Mi,payload:{itemType:_,item:y,sourceId:u,clientOffset:o||null,sourceClientOffset:f||null,isSourcePublic:!!i}}}}}function mw(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 bw(e){de(typeof e=="function","When clientOffset is provided, getSourceClientOffset must be a function.")}function _w(e){de(kd(e),"Item must be an object.")}function ww(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 Sw(e){return function(){var r=e.getMonitor();if(r.isDragging())return{type:Ta}}}function Na(e,t){return t===null?e===null:Array.isArray(e)?e.some(function(r){return r===t}):e===t}function Cw(e){return function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=n.clientOffset;Ew(r);var i=r.slice(0),o=e.getMonitor(),a=e.getRegistry();Ow(i,o,a);var c=o.getItemType();return Iw(i,a,c),Dw(i,o,a),{type:Li,payload:{targetIds:i,clientOffset:s||null}}}}function Ew(e){de(Array.isArray(e),"Expected targetIds to be an array.")}function Ow(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 Iw(e,t,r){for(var n=e.length-1;n>=0;n--){var s=e[n],i=t.getTargetType(s);Na(i,r)||e.splice(n,1)}}function Dw(e,t,r){e.forEach(function(n){var s=r.getTarget(n);s.hover(t,n)})}function xd(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Ad(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?xd(Object(r),!0).forEach(function(n){Tw(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):xd(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Tw(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Nw(e){return function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.getMonitor(),s=e.getRegistry();kw(n);var i=Pw(n);i.forEach(function(o,a){var c=xw(o,a,s,n),d={type:Fi,payload:{dropResult:Ad(Ad({},r),c)}};e.dispatch(d)})}}function kw(e){de(e.isDragging(),"Cannot call drop while not dragging."),de(!e.didDrop(),"Cannot call drop twice during one drag operation.")}function xw(e,t,r,n){var s=r.getTarget(e),i=s?s.drop(n,e):void 0;return Aw(i),typeof i>"u"&&(i=t===0?{}:n.getDropResult()),i}function Aw(e){de(typeof e>"u"||kd(e),"Drop result must either be an object or undefined.")}function Pw(e){var t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function Mw(e){return function(){var r=e.getMonitor(),n=e.getRegistry();Lw(r);var s=r.getSourceId();if(s!=null){var i=n.getSource(s,!0);i.endDrag(r,s),n.unpinSource()}return{type:$i}}}function Lw(e){de(e.isDragging(),"Cannot call endDrag while not dragging.")}function Fw(e){return{beginDrag:vw(e),publishDragSource:Sw(e),hover:Cw(e),drop:Nw(e),endDrag:Mw(e)}}function $w(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function jw(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 Bw(e,t,r){return t&&jw(e.prototype,t),e}function Es(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Uw=function(){function e(t,r){var n=this;$w(this,e),Es(this,"store",void 0),Es(this,"monitor",void 0),Es(this,"backend",void 0),Es(this,"isSetUp",!1),Es(this,"handleRefCountChange",function(){var s=n.store.getState().refCount>0;n.backend&&(s&&!n.isSetUp?(n.backend.setup(),n.isSetUp=!0):!s&&n.isSetUp&&(n.backend.teardown(),n.isSetUp=!1))}),this.store=t,this.monitor=r,t.subscribe(this.handleRefCountChange)}return Bw(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=Fw(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 Vt(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var Pd=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),Md=function(){return Math.random().toString(36).substring(7).split("").join(".")},Ld={INIT:"@@redux/INIT"+Md(),REPLACE:"@@redux/REPLACE"+Md()};function Vw(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 qw(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(Ww(e))return"date";if(Hw(e))return"error";var r=zw(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 zw(e){return typeof e.constructor=="function"?e.constructor.name:null}function Hw(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function Ww(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function An(e){var t=typeof e;return process.env.NODE_ENV!=="production"&&(t=qw(e)),t}function Fd(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"?Vt(0):"It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.");if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(process.env.NODE_ENV==="production"?Vt(1):"Expected the enhancer to be a function. Instead, received: '"+An(r)+"'");return r(Fd)(e,t)}if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?Vt(2):"Expected the root reducer to be a function. Instead, received: '"+An(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"?Vt(3):"You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return i}function f(p){if(typeof p!="function")throw new Error(process.env.NODE_ENV==="production"?Vt(4):"Expected the listener to be a function. Instead, received: '"+An(p)+"'");if(c)throw new Error(process.env.NODE_ENV==="production"?Vt(5):"You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api/store#subscribelistener for more details.");var v=!0;return d(),a.push(p),function(){if(v){if(c)throw new Error(process.env.NODE_ENV==="production"?Vt(6):"You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api/store#subscribelistener for more details.");v=!1,d();var b=a.indexOf(p);a.splice(b,1),o=null}}}function g(p){if(!Vw(p))throw new Error(process.env.NODE_ENV==="production"?Vt(7):"Actions must be plain objects. Instead, the actual type was: '"+An(p)+"'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.");if(typeof p.type>"u")throw new Error(process.env.NODE_ENV==="production"?Vt(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"?Vt(9):"Reducers may not dispatch actions.");try{c=!0,i=s(i,p)}finally{c=!1}for(var v=o=a,m=0;m<v.length;m++){var b=v[m];b()}return p}function y(p){if(typeof p!="function")throw new Error(process.env.NODE_ENV==="production"?Vt(10):"Expected the nextReducer to be a function. Instead, received: '"+An(p));s=p,g({type:Ld.REPLACE})}function _(){var p,v=f;return p={subscribe:function(b){if(typeof b!="object"||b===null)throw new Error(process.env.NODE_ENV==="production"?Vt(11):"Expected the observer to be an object. Instead, received: '"+An(b)+"'");function S(){b.next&&b.next(u())}S();var w=v(S);return{unsubscribe:w}}},p[Pd]=function(){return this},p}return g({type:Ld.INIT}),n={dispatch:g,subscribe:f,getState:u,replaceReducer:y},n[Pd]=_,n}var Qw=function(t,r){return t===r};function Kw(e,t){return!e&&!t?!0:!e||!t?!1:e.x===t.x&&e.y===t.y}function Gw(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Qw;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 $d(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 jd(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?$d(Object(r),!0).forEach(function(n){Rw(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$d(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Rw(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Bd={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function Yw(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Bd,t=arguments.length>1?arguments[1]:void 0,r=t.payload;switch(t.type){case Da:case Mi:return{initialSourceClientOffset:r.sourceClientOffset,initialClientOffset:r.clientOffset,clientOffset:r.clientOffset};case Li:return Kw(e.clientOffset,r.clientOffset)?e:jd(jd({},e),{},{clientOffset:r.clientOffset});case $i:case Fi:return Bd;default:return e}}var ka="dnd-core/ADD_SOURCE",xa="dnd-core/ADD_TARGET",Aa="dnd-core/REMOVE_SOURCE",Bi="dnd-core/REMOVE_TARGET";function Xw(e){return{type:ka,payload:{sourceId:e}}}function Zw(e){return{type:xa,payload:{targetId:e}}}function Jw(e){return{type:Aa,payload:{sourceId:e}}}function eS(e){return{type:Bi,payload:{targetId:e}}}function Ud(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function qt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ud(Object(r),!0).forEach(function(n){tS(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ud(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function tS(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var rS={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function nS(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:rS,t=arguments.length>1?arguments[1]:void 0,r=t.payload;switch(t.type){case Mi:return qt(qt({},e),{},{itemType:r.itemType,item:r.item,sourceId:r.sourceId,isSourcePublic:r.isSourcePublic,dropResult:null,didDrop:!1});case Ta:return qt(qt({},e),{},{isSourcePublic:!0});case Li:return qt(qt({},e),{},{targetIds:r.targetIds});case Bi:return e.targetIds.indexOf(r.targetId)===-1?e:qt(qt({},e),{},{targetIds:hw(e.targetIds,r.targetId)});case Fi:return qt(qt({},e),{},{dropResult:r.dropResult,didDrop:!0,targetIds:[]});case $i:return qt(qt({},e),{},{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}}function sS(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case ka:case xa:return e+1;case Aa:case Bi:return e-1;default:return e}}var Ui=[],Pa=[];Ui.__IS_NONE__=!0,Pa.__IS_ALL__=!0;function iS(e,t){if(e===Ui)return!1;if(e===Pa||typeof t>"u")return!0;var r=gw(t,e);return r.length>0}function oS(){var e=arguments.length>1?arguments[1]:void 0;switch(e.type){case Li:break;case ka:case xa:case Bi:case Aa:return Ui;case Mi:case Ta:case $i:case Fi:default:return Pa}var t=e.payload,r=t.targetIds,n=r===void 0?[]:r,s=t.prevTargetIds,i=s===void 0?[]:s,o=pw(n,i),a=o.length>0||!Gw(n,i);if(!a)return Ui;var c=i[i.length-1],d=n[n.length-1];return c!==d&&(c&&o.push(c),d&&o.push(d)),o}function aS(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return e+1}function Vd(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 qd(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Vd(Object(r),!0).forEach(function(n){lS(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Vd(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function lS(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function cS(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return{dirtyHandlerIds:oS(e.dirtyHandlerIds,{type:t.type,payload:qd(qd({},t.payload),{},{prevTargetIds:fw(e,"dragOperation.targetIds",[])})}),dragOffset:Yw(e.dragOffset,t),refCount:sS(e.refCount,t),dragOperation:nS(e.dragOperation,t),stateId:aS(e.stateId)}}function uS(e,t){return{x:e.x+t.x,y:e.y+t.y}}function zd(e,t){return{x:e.x-t.x,y:e.y-t.y}}function dS(e){var t=e.clientOffset,r=e.initialClientOffset,n=e.initialSourceClientOffset;return!t||!r||!n?null:zd(uS(t,n),r)}function fS(e){var t=e.clientOffset,r=e.initialClientOffset;return!t||!r?null:zd(t,r)}function hS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function pS(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function gS(e,t,r){return t&&pS(e.prototype,t),e}function Hd(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var yS=function(){function e(t,r){hS(this,e),Hd(this,"store",void 0),Hd(this,"registry",void 0),this.store=t,this.registry=r}return gS(e,[{key:"subscribeToStateChange",value:function(r){var n=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{handlerIds:void 0},i=s.handlerIds;de(typeof r=="function","listener must be a function."),de(typeof i>"u"||Array.isArray(i),"handlerIds, when specified, must be an array of strings.");var o=this.store.getState().stateId,a=function(){var d=n.store.getState(),u=d.stateId;try{var f=u===o||u===o+1&&!iS(d.dirtyHandlerIds,i);f||r()}finally{o=u}};return this.store.subscribe(a)}},{key:"subscribeToOffsetChange",value:function(r){var n=this;de(typeof r=="function","listener must be a function.");var s=this.store.getState().dragOffset,i=function(){var a=n.store.getState().dragOffset;a!==s&&(s=a,r())};return this.store.subscribe(i)}},{key:"canDragSource",value:function(r){if(!r)return!1;var n=this.registry.getSource(r);return de(n,"Expected to find a valid source. sourceId=".concat(r)),this.isDragging()?!1:n.canDrag(this,r)}},{key:"canDropOnTarget",value:function(r){if(!r)return!1;var n=this.registry.getTarget(r);if(de(n,"Expected to find a valid target. targetId=".concat(r)),!this.isDragging()||this.didDrop())return!1;var s=this.registry.getTargetType(r),i=this.getItemType();return Na(s,i)&&n.canDrop(this,r)}},{key:"isDragging",value:function(){return!!this.getItemType()}},{key:"isDraggingSource",value:function(r){if(!r)return!1;var n=this.registry.getSource(r,!0);if(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&&!Na(i,o))return!1;var a=this.getTargetIds();if(!a.length)return!1;var c=a.indexOf(r);return s?c===a.length-1:c>-1}},{key:"getItemType",value:function(){return this.store.getState().dragOperation.itemType}},{key:"getItem",value:function(){return this.store.getState().dragOperation.item}},{key:"getSourceId",value:function(){return this.store.getState().dragOperation.sourceId}},{key:"getTargetIds",value:function(){return this.store.getState().dragOperation.targetIds}},{key:"getDropResult",value:function(){return this.store.getState().dragOperation.dropResult}},{key:"didDrop",value:function(){return this.store.getState().dragOperation.didDrop}},{key:"isSourcePublic",value:function(){return!!this.store.getState().dragOperation.isSourcePublic}},{key:"getInitialClientOffset",value:function(){return this.store.getState().dragOffset.initialClientOffset}},{key:"getInitialSourceClientOffset",value:function(){return this.store.getState().dragOffset.initialSourceClientOffset}},{key:"getClientOffset",value:function(){return this.store.getState().dragOffset.clientOffset}},{key:"getSourceClientOffset",value:function(){return dS(this.store.getState().dragOffset)}},{key:"getDifferenceFromInitialOffset",value:function(){return fS(this.store.getState().dragOffset)}}]),e}(),vS=0;function mS(){return vS++}function Vi(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Vi=function(r){return typeof r}:Vi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Vi(e)}function bS(e){de(typeof e.canDrag=="function","Expected canDrag to be a function."),de(typeof e.beginDrag=="function","Expected beginDrag to be a function."),de(typeof e.endDrag=="function","Expected endDrag to be a function.")}function _S(e){de(typeof e.canDrop=="function","Expected canDrop to be a function."),de(typeof e.hover=="function","Expected hover to be a function."),de(typeof e.drop=="function","Expected beginDrag to be a function.")}function Ma(e,t){if(t&&Array.isArray(e)){e.forEach(function(r){return Ma(r,!1)});return}de(typeof e=="string"||Vi(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 Wd=typeof global<"u"?global:self,Qd=Wd.MutationObserver||Wd.WebKitMutationObserver;function Kd(e){return function(){const r=setTimeout(s,0),n=setInterval(s,50);function s(){clearTimeout(r),clearInterval(n),e()}}}function wS(e){let t=1;const r=new Qd(e),n=document.createTextNode("");return r.observe(n,{characterData:!0}),function(){t=-t,n.data=t}}const SS=typeof Qd=="function"?wS:Kd;class CS{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=SS(this.flush),this.requestErrorThrow=Kd(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}}class ES{call(){try{this.task&&this.task()}catch(t){this.onError(t)}finally{this.task=null,this.release(this)}}constructor(t,r){this.onError=t,this.release=r,this.task=null}}class OS{create(t){const r=this.freeTasks,n=r.length?r.pop():new ES(this.onError,s=>r[r.length]=s);return n.task=t,n}constructor(t){this.onError=t,this.freeTasks=[]}}const Gd=new CS,IS=new OS(Gd.registerPendingError);function DS(e){Gd.enqueueTask(IS.create(e))}function TS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function NS(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function kS(e,t,r){return t&&NS(e.prototype,t),e}function Pn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function xS(e,t){return LS(e)||MS(e,t)||PS(e,t)||AS()}function AS(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
457
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function PS(e,t){if(e){if(typeof e=="string")return Rd(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 Rd(e,t)}}function Rd(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function MS(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(e);!(s=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function LS(e){if(Array.isArray(e))return e}function FS(e){var t=mS().toString();switch(e){case Ut.SOURCE:return"S".concat(t);case Ut.TARGET:return"T".concat(t);default:throw new Error("Unknown Handler Role: ".concat(e))}}function Yd(e){switch(e[0]){case"S":return Ut.SOURCE;case"T":return Ut.TARGET;default:de(!1,"Cannot parse handler ID: ".concat(e))}}function Xd(e,t){var r=e.entries(),n=!1;do{var s=r.next(),i=s.done,o=xS(s.value,2),a=o[1];if(a===t)return!0;n=!!i}while(!n);return!1}var $S=function(){function e(t){TS(this,e),Pn(this,"types",new Map),Pn(this,"dragSources",new Map),Pn(this,"dropTargets",new Map),Pn(this,"pinnedSourceId",null),Pn(this,"pinnedSource",null),Pn(this,"store",void 0),this.store=t}return kS(e,[{key:"addSource",value:function(r,n){Ma(r),bS(n);var s=this.addHandler(Ut.SOURCE,r,n);return this.store.dispatch(Xw(s)),s}},{key:"addTarget",value:function(r,n){Ma(r,!0),_S(n);var s=this.addHandler(Ut.TARGET,r,n);return this.store.dispatch(Zw(s)),s}},{key:"containsHandler",value:function(r){return Xd(this.dragSources,r)||Xd(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=Yd(r);return n===Ut.SOURCE}},{key:"isTargetId",value:function(r){var n=Yd(r);return n===Ut.TARGET}},{key:"removeSource",value:function(r){var n=this;de(this.getSource(r),"Expected an existing source."),this.store.dispatch(Jw(r)),DS(function(){n.dragSources.delete(r),n.types.delete(r)})}},{key:"removeTarget",value:function(r){de(this.getTarget(r),"Expected an existing target."),this.store.dispatch(eS(r)),this.dropTargets.delete(r),this.types.delete(r)}},{key:"pinSource",value:function(r){var n=this.getSource(r);de(n,"Expected an existing source."),this.pinnedSourceId=r,this.pinnedSource=n}},{key:"unpinSource",value:function(){de(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}},{key:"addHandler",value:function(r,n,s){var i=FS(r);return this.types.set(i,n),r===Ut.SOURCE?this.dragSources.set(i,s):r===Ut.TARGET&&this.dropTargets.set(i,s),i}}]),e}();function jS(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=BS(n),i=new yS(s,new $S(s)),o=new Uw(s,i),a=e(o,t,r);return o.receiveBackend(a),o}function BS(e){var t=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__;return Fd(cS,e&&t&&t({name:"dnd-core",instanceId:"dnd-core"}))}var US=["children"];function VS(e,t){return WS(e)||HS(e,t)||zS(e,t)||qS()}function qS(){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 zS(e,t){if(e){if(typeof e=="string")return Zd(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Zd(e,t)}}function Zd(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function HS(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 WS(e){if(Array.isArray(e))return e}function QS(e,t){if(e==null)return{};var r=KS(e,t),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)n=i[s],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function KS(e,t){if(e==null)return{};var r={},n=Object.keys(e),s,i;for(i=0;i<n.length;i++)s=n[i],!(t.indexOf(s)>=0)&&(r[s]=e[s]);return r}var Jd=0,qi=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__"),GS=h.memo(function(t){var r=t.children,n=QS(t,US),s=RS(n),i=VS(s,2),o=i[0],a=i[1];return h.useEffect(function(){if(a){var c=ef();return++Jd,function(){--Jd===0&&(c[qi]=null)}}},[]),l.jsx(Td.Provider,Object.assign({value:o},{children:r}),void 0)});function RS(e){if("manager"in e){var t={dragDropManager:e.manager};return[t,!1]}var r=YS(e.backend,e.context,e.options,e.debugMode),n=!e.context;return[r,n]}function YS(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ef(),r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0,s=t;return s[qi]||(s[qi]={dragDropManager:jS(e,t,r,n)}),s[qi]}function ef(){return typeof global<"u"?global:window}function XS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ZS(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function JS(e,t,r){return t&&ZS(e.prototype,t),e}function tf(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var La=!1,Fa=!1,eC=function(){function e(t){XS(this,e),tf(this,"internalMonitor",void 0),tf(this,"sourceId",null),this.internalMonitor=t.getMonitor()}return JS(e,[{key:"receiveHandlerId",value:function(r){this.sourceId=r}},{key:"getHandlerId",value:function(){return this.sourceId}},{key:"canDrag",value:function(){de(!La,"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 La=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{La=!1}}},{key:"isDragging",value:function(){if(!this.sourceId)return!1;de(!Fa,"You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return Fa=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{Fa=!1}}},{key:"subscribeToStateChange",value:function(r,n){return this.internalMonitor.subscribeToStateChange(r,n)}},{key:"isDraggingSource",value:function(r){return this.internalMonitor.isDraggingSource(r)}},{key:"isOverTarget",value:function(r,n){return this.internalMonitor.isOverTarget(r,n)}},{key:"getTargetIds",value:function(){return this.internalMonitor.getTargetIds()}},{key:"isSourcePublic",value:function(){return this.internalMonitor.isSourcePublic()}},{key:"getSourceId",value:function(){return this.internalMonitor.getSourceId()}},{key:"subscribeToOffsetChange",value:function(r){return this.internalMonitor.subscribeToOffsetChange(r)}},{key:"canDragSource",value:function(r){return this.internalMonitor.canDragSource(r)}},{key:"canDropOnTarget",value:function(r){return this.internalMonitor.canDropOnTarget(r)}},{key:"getItemType",value:function(){return this.internalMonitor.getItemType()}},{key:"getItem",value:function(){return this.internalMonitor.getItem()}},{key:"getDropResult",value:function(){return this.internalMonitor.getDropResult()}},{key:"didDrop",value:function(){return this.internalMonitor.didDrop()}},{key:"getInitialClientOffset",value:function(){return this.internalMonitor.getInitialClientOffset()}},{key:"getInitialSourceClientOffset",value:function(){return this.internalMonitor.getInitialSourceClientOffset()}},{key:"getSourceClientOffset",value:function(){return this.internalMonitor.getSourceClientOffset()}},{key:"getClientOffset",value:function(){return this.internalMonitor.getClientOffset()}},{key:"getDifferenceFromInitialOffset",value:function(){return this.internalMonitor.getDifferenceFromInitialOffset()}}]),e}();function tC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function rC(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function nC(e,t,r){return t&&rC(e.prototype,t),e}function rf(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var $a=!1,sC=function(){function e(t){tC(this,e),rf(this,"internalMonitor",void 0),rf(this,"targetId",null),this.internalMonitor=t.getMonitor()}return nC(e,[{key:"receiveHandlerId",value:function(r){this.targetId=r}},{key:"getHandlerId",value:function(){return this.targetId}},{key:"subscribeToStateChange",value:function(r,n){return this.internalMonitor.subscribeToStateChange(r,n)}},{key:"canDrop",value:function(){if(!this.targetId)return!1;de(!$a,"You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor");try{return $a=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{$a=!1}}},{key:"isOver",value:function(r){return this.targetId?this.internalMonitor.isOverTarget(this.targetId,r):!1}},{key:"getItemType",value:function(){return this.internalMonitor.getItemType()}},{key:"getItem",value:function(){return this.internalMonitor.getItem()}},{key:"getDropResult",value:function(){return this.internalMonitor.getDropResult()}},{key:"didDrop",value:function(){return this.internalMonitor.didDrop()}},{key:"getInitialClientOffset",value:function(){return this.internalMonitor.getInitialClientOffset()}},{key:"getInitialSourceClientOffset",value:function(){return this.internalMonitor.getInitialSourceClientOffset()}},{key:"getSourceClientOffset",value:function(){return this.internalMonitor.getSourceClientOffset()}},{key:"getClientOffset",value:function(){return this.internalMonitor.getClientOffset()}},{key:"getDifferenceFromInitialOffset",value:function(){return this.internalMonitor.getDifferenceFromInitialOffset()}}]),e}();function iC(e){if(typeof e.type!="string"){var t=e.type.displayName||e.type.name||"the component";throw new Error("Only native element nodes can now be passed to React DnD connectors."+"You can either wrap ".concat(t," into a <div>, or turn it into a ")+"drag source or a drop target itself.")}}function oC(e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(!h.isValidElement(t)){var n=t;return e(n,r),n}var s=t;iC(s);var i=r?function(o){return e(o,r)}:e;return aC(s,i)}}function nf(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 sf(e,t){typeof e=="function"?e(t):e.current=t}function aC(e,t){var r=e.ref;return de(typeof r!="string","Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),r?h.cloneElement(e,{ref:function(s){sf(r,s),sf(t,s)}}):h.cloneElement(e,{ref:t})}function zi(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?zi=function(r){return typeof r}:zi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},zi(e)}function ja(e){return e!==null&&zi(e)==="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function Ba(e,t,r,n){var s=void 0;if(s!==void 0)return!!s;if(e===t)return!0;if(typeof e!="object"||!e||typeof t!="object"||!t)return!1;var i=Object.keys(e),o=Object.keys(t);if(i.length!==o.length)return!1;for(var a=Object.prototype.hasOwnProperty.bind(t),c=0;c<i.length;c++){var d=i[c];if(!a(d))return!1;var u=e[d],f=t[d];if(s=void 0,s===!1||s===void 0&&u!==f)return!1}return!0}function lC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function cC(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function uC(e,t,r){return t&&cC(e.prototype,t),e}function yt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var dC=function(){function e(t){var r=this;lC(this,e),yt(this,"hooks",nf({dragSource:function(s,i){r.clearDragSource(),r.dragSourceOptions=i||null,ja(s)?r.dragSourceRef=s:r.dragSourceNode=s,r.reconnectDragSource()},dragPreview:function(s,i){r.clearDragPreview(),r.dragPreviewOptions=i||null,ja(s)?r.dragPreviewRef=s:r.dragPreviewNode=s,r.reconnectDragPreview()}})),yt(this,"handlerId",null),yt(this,"dragSourceRef",null),yt(this,"dragSourceNode",void 0),yt(this,"dragSourceOptionsInternal",null),yt(this,"dragSourceUnsubscribe",void 0),yt(this,"dragPreviewRef",null),yt(this,"dragPreviewNode",void 0),yt(this,"dragPreviewOptionsInternal",null),yt(this,"dragPreviewUnsubscribe",void 0),yt(this,"lastConnectedHandlerId",null),yt(this,"lastConnectedDragSource",null),yt(this,"lastConnectedDragSourceOptions",null),yt(this,"lastConnectedDragPreview",null),yt(this,"lastConnectedDragPreviewOptions",null),yt(this,"backend",void 0),this.backend=t}return uC(e,[{key:"receiveHandlerId",value:function(r){this.handlerId!==r&&(this.handlerId=r,this.reconnect())}},{key:"connectTarget",get:function(){return this.dragSource}},{key:"dragSourceOptions",get:function(){return this.dragSourceOptionsInternal},set:function(r){this.dragSourceOptionsInternal=r}},{key:"dragPreviewOptions",get:function(){return this.dragPreviewOptionsInternal},set:function(r){this.dragPreviewOptionsInternal=r}},{key:"reconnect",value:function(){this.reconnectDragSource(),this.reconnectDragPreview()}},{key:"reconnectDragSource",value:function(){var r=this.dragSource,n=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();if(n&&this.disconnectDragSource(),!!this.handlerId){if(!r){this.lastConnectedDragSource=r;return}n&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=r,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,r,this.dragSourceOptions))}}},{key:"reconnectDragPreview",value:function(){var r=this.dragPreview,n=this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();if(n&&this.disconnectDragPreview(),!!this.handlerId){if(!r){this.lastConnectedDragPreview=r;return}n&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=r,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,r,this.dragPreviewOptions))}}},{key:"didHandlerIdChange",value:function(){return this.lastConnectedHandlerId!==this.handlerId}},{key:"didConnectedDragSourceChange",value:function(){return this.lastConnectedDragSource!==this.dragSource}},{key:"didConnectedDragPreviewChange",value:function(){return this.lastConnectedDragPreview!==this.dragPreview}},{key:"didDragSourceOptionsChange",value:function(){return!Ba(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}},{key:"didDragPreviewOptionsChange",value:function(){return!Ba(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}},{key:"disconnectDragSource",value:function(){this.dragSourceUnsubscribe&&(this.dragSourceUnsubscribe(),this.dragSourceUnsubscribe=void 0)}},{key:"disconnectDragPreview",value:function(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}},{key:"dragSource",get:function(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}},{key:"dragPreview",get:function(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}},{key:"clearDragSource",value:function(){this.dragSourceNode=null,this.dragSourceRef=null}},{key:"clearDragPreview",value:function(){this.dragPreviewNode=null,this.dragPreviewRef=null}}]),e}();function fC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function hC(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function pC(e,t,r){return t&&hC(e.prototype,t),e}function 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 gC=function(){function e(t){var r=this;fC(this,e),nr(this,"hooks",nf({dropTarget:function(s,i){r.clearDropTarget(),r.dropTargetOptions=i,ja(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!Ba(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}},{key:"disconnectDropTarget",value:function(){this.unsubscribeDropTarget&&(this.unsubscribeDropTarget(),this.unsubscribeDropTarget=void 0)}},{key:"dropTarget",get:function(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}},{key:"clearDropTarget",value:function(){this.dropTargetRef=null,this.dropTargetNode=null}}]),e}();function yC(e,t,r){var n=r.getRegistry(),s=n.addTarget(e,t);return[s,function(){return n.removeTarget(s)}]}function vC(e,t,r){var n=r.getRegistry(),s=n.addSource(e,t);return[s,function(){return n.removeSource(s)}]}var Rr=typeof window<"u"?h.useLayoutEffect:h.useEffect;function Hi(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Hi=function(r){return typeof r}:Hi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Hi(e)}function mC(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 Ua(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var wC=function(){function e(t,r,n){mC(this,e),Ua(this,"spec",void 0),Ua(this,"monitor",void 0),Ua(this,"connector",void 0),this.spec=t,this.monitor=r,this.connector=n}return _C(e,[{key:"beginDrag",value:function(){var r,n=this.spec,s=this.monitor,i=null;return Hi(n.item)==="object"?i=n.item:typeof n.item=="function"?i=n.item(s):i={},(r=i)!==null&&r!==void 0?r:null}},{key:"canDrag",value:function(){var r=this.spec,n=this.monitor;return typeof r.canDrag=="boolean"?r.canDrag:typeof r.canDrag=="function"?r.canDrag(n):!0}},{key:"isDragging",value:function(r,n){var s=this.spec,i=this.monitor,o=s.isDragging;return o?o(i):n===r.getSourceId()}},{key:"endDrag",value:function(){var r=this.spec,n=this.monitor,s=this.connector,i=r.end;i&&i(n.getItem(),n),s.reconnect()}}]),e}();function SC(e,t,r){var n=h.useMemo(function(){return new wC(e,t,r)},[t,r]);return h.useEffect(function(){n.spec=e},[e]),n}function Yr(){var e=h.useContext(Td),t=e.dragDropManager;return de(t!=null,"Expected drag drop context"),t}function CC(e){return h.useMemo(function(){var t=e.type;return de(t!=null,"spec.type must be defined"),t},[e])}function EC(e,t){return TC(e)||DC(e,t)||IC(e,t)||OC()}function OC(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
459
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function IC(e,t){if(e){if(typeof e=="string")return of(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 of(e,t)}}function of(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 TC(e){if(Array.isArray(e))return e}function NC(e,t,r){var n=Yr(),s=SC(e,t,r),i=CC(e);Rr(function(){if(i!=null){var a=vC(i,s,n),c=EC(a,2),d=c[0],u=c[1];return t.receiveHandlerId(d),r.receiveHandlerId(d),u}},[n,t,r,s,i])}function kC(e){return MC(e)||PC(e)||AC(e)||xC()}function xC(){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 AC(e,t){if(e){if(typeof e=="string")return Va(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 Va(e,t)}}function PC(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function MC(e){if(Array.isArray(e))return Va(e)}function Va(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 af(e,t){var r=kC(t||[]);return t==null&&typeof e!="function"&&r.push(e),h.useMemo(function(){return typeof e=="function"?e():e},r)}function LC(){var e=Yr();return h.useMemo(function(){return new eC(e)},[e])}function FC(e,t){var r=Yr(),n=h.useMemo(function(){return new dC(r.getBackend())},[r]);return Rr(function(){return n.dragSourceOptions=e||null,n.reconnect(),function(){return n.disconnectDragSource()}},[n,e]),Rr(function(){return n.dragPreviewOptions=t||null,n.reconnect(),function(){return n.disconnectDragPreview()}},[n,t]),n}var $C=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 jC=Yc($C);function BC(e,t){return zC(e)||qC(e,t)||VC(e,t)||UC()}function UC(){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 VC(e,t){if(e){if(typeof e=="string")return lf(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return lf(e,t)}}function lf(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function qC(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(e);!(s=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function zC(e){if(Array.isArray(e))return e}function cf(e,t,r){var n=h.useState(function(){return t(e)}),s=BC(n,2),i=s[0],o=s[1],a=h.useCallback(function(){var c=t(e);jC(i,c)||(o(c),r&&r())},[i,e,r]);return Rr(a),[i,a]}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.
462
- 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 uf(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return uf(e,t)}}function uf(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function 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 RC(e,t,r){var n=cf(e,t,r),s=HC(n,2),i=s[0],o=s[1];return Rr(function(){var c=e.getHandlerId();if(c!=null)return e.subscribeToStateChange(o,{handlerIds:[c]})},[e,o]),i}function df(e,t,r){return RC(t,e||function(){return{}},function(){return r.reconnect()})}function YC(e){return h.useMemo(function(){return e.hooks.dragSource()},[e])}function XC(e){return h.useMemo(function(){return e.hooks.dragPreview()},[e])}function ZC(e,t){var r=af(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=LC(),s=FC(r.options,r.previewOptions);return NC(r,n,s),[df(r.collect,n,s),YC(s),XC(s)]}function JC(e){var t=e.accept;return h.useMemo(function(){return de(e.accept!=null,"accept must be defined"),Array.isArray(t)?t:[t]},[t])}function e0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t0(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function r0(e,t,r){return t&&t0(e.prototype,t),e}function ff(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var n0=function(){function e(t,r){e0(this,e),ff(this,"spec",void 0),ff(this,"monitor",void 0),this.spec=t,this.monitor=r}return r0(e,[{key:"canDrop",value:function(){var r=this.spec,n=this.monitor;return r.canDrop?r.canDrop(n.getItem(),n):!0}},{key:"hover",value:function(){var r=this.spec,n=this.monitor;r.hover&&r.hover(n.getItem(),n)}},{key:"drop",value:function(){var r=this.spec,n=this.monitor;if(r.drop)return r.drop(n.getItem(),n)}}]),e}();function s0(e,t){var r=h.useMemo(function(){return new n0(e,t)},[t]);return h.useEffect(function(){r.spec=e},[e]),r}function i0(e,t){return c0(e)||l0(e,t)||a0(e,t)||o0()}function o0(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
463
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function a0(e,t){if(e){if(typeof e=="string")return hf(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 hf(e,t)}}function hf(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function l0(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(e);!(s=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function c0(e){if(Array.isArray(e))return e}function u0(e,t,r){var n=Yr(),s=s0(e,t),i=JC(e);Rr(function(){var a=yC(i,s,n),c=i0(a,2),d=c[0],u=c[1];return t.receiveHandlerId(d),r.receiveHandlerId(d),u},[n,t,s,r,i.map(function(o){return o.toString()}).join("|")])}function d0(){var e=Yr();return h.useMemo(function(){return new sC(e)},[e])}function f0(e){var t=Yr(),r=h.useMemo(function(){return new gC(t.getBackend())},[t]);return Rr(function(){return r.dropTargetOptions=e||null,r.reconnect(),function(){return r.disconnectDropTarget()}},[e]),r}function h0(e){return h.useMemo(function(){return e.hooks.dropTarget()},[e])}function pf(e,t){var r=af(e,t),n=d0(),s=f0(r.options);return u0(r,n,s),[df(r.collect,n,s),h0(s)]}function p0(e,t){return m0(e)||v0(e,t)||y0(e,t)||g0()}function g0(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
464
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function y0(e,t){if(e){if(typeof e=="string")return gf(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 gf(e,t)}}function gf(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 v0(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 m0(e){if(Array.isArray(e))return e}function b0(e){var t=Yr(),r=t.getMonitor(),n=cf(r,e),s=p0(n,2),i=s[0],o=s[1];return h.useEffect(function(){return r.subscribeToOffsetChange(o)}),h.useEffect(function(){return r.subscribeToStateChange(o)}),i}function yf(e){var t=null,r=function(){return t==null&&(t=e()),t};return r}function _0(e,t){return e.filter(function(r){return r!==t})}function w0(e,t){var r=new Set,n=function(o){return r.add(o)};e.forEach(n),t.forEach(n);var s=[];return r.forEach(function(i){return s.push(i)}),s}function S0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function C0(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function E0(e,t,r){return t&&C0(e.prototype,t),e}function vf(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var O0=function(){function e(t){S0(this,e),vf(this,"entered",[]),vf(this,"isNodeInDocument",void 0),this.isNodeInDocument=t}return E0(e,[{key:"enter",value:function(r){var n=this,s=this.entered.length,i=function(a){return n.isNodeInDocument(a)&&(!a.contains||a.contains(r))};return this.entered=w0(this.entered.filter(i),[r]),s===0&&this.entered.length>0}},{key:"leave",value:function(r){var n=this.entered.length;return this.entered=_0(this.entered.filter(this.isNodeInDocument),r),n>0&&this.entered.length===0}},{key:"reset",value:function(){this.entered=[]}}]),e}(),I0=yf(function(){return/firefox/i.test(navigator.userAgent)}),mf=yf(function(){return!!window.safari});function D0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function T0(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function N0(e,t,r){return t&&T0(e.prototype,t),e}function Os(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var bf=function(){function e(t,r){D0(this,e),Os(this,"xs",void 0),Os(this,"ys",void 0),Os(this,"c1s",void 0),Os(this,"c2s",void 0),Os(this,"c3s",void 0);for(var n=t.length,s=[],i=0;i<n;i++)s.push(i);s.sort(function(A,$){return t[A]<t[$]?-1:1});for(var o=[],a=[],c,d,u=0;u<n-1;u++)c=t[u+1]-t[u],d=r[u+1]-r[u],o.push(c),a.push(d/c);for(var f=[a[0]],g=0;g<o.length-1;g++){var y=a[g],_=a[g+1];if(y*_<=0)f.push(0);else{c=o[g];var p=o[g+1],v=c+p;f.push(3*v/((v+p)/y+(v+c)/_))}}f.push(a[a.length-1]);for(var m=[],b=[],S,w=0;w<f.length-1;w++){S=a[w];var E=f[w],D=1/o[w],x=E+f[w+1]-S-S;m.push((S-E-x)*D),b.push(x*D*D)}this.xs=t,this.ys=r,this.c1s=f,this.c2s=m,this.c3s=b}return N0(e,[{key:"interpolate",value:function(r){var n=this.xs,s=this.ys,i=this.c1s,o=this.c2s,a=this.c3s,c=n.length-1;if(r===n[c])return s[c];for(var d=0,u=a.length-1,f;d<=u;){f=Math.floor(.5*(d+u));var g=n[f];if(g<r)d=f+1;else if(g>r)u=f-1;else return s[f]}c=Math.max(0,u);var y=r-n[c],_=y*y;return s[c]+i[c]*y+o[c]*_+a[c]*y*_}}]),e}(),k0=1;function _f(e){var t=e.nodeType===k0?e:e.parentElement;if(!t)return null;var r=t.getBoundingClientRect(),n=r.top,s=r.left;return{x:s,y:n}}function Wi(e){return{x:e.clientX,y:e.clientY}}function x0(e){var t;return e.nodeName==="IMG"&&(I0()||!((t=document.documentElement)!==null&&t!==void 0&&t.contains(e)))}function A0(e,t,r,n){var s=e?t.width:r,i=e?t.height:n;return mf()&&e&&(i/=window.devicePixelRatio,s/=window.devicePixelRatio),{dragPreviewWidth:s,dragPreviewHeight:i}}function P0(e,t,r,n,s){var i=x0(t),o=i?e:t,a=_f(o),c={x:r.x-a.x,y:r.y-a.y},d=e.offsetWidth,u=e.offsetHeight,f=n.anchorX,g=n.anchorY,y=A0(i,t,d,u),_=y.dragPreviewWidth,p=y.dragPreviewHeight,v=function(){var x=new bf([0,.5,1],[c.y,c.y/u*p,c.y+p-u]),A=x.interpolate(g);return mf()&&i&&(A+=(window.devicePixelRatio-1)*p),A},m=function(){var x=new bf([0,.5,1],[c.x,c.x/d*_,c.x+_-d]);return x.interpolate(f)},b=s.offsetX,S=s.offsetY,w=b===0||b,E=S===0||S;return{x:w?b:m(),y:E?S:v()}}var wf="__NATIVE_FILE__",Sf="__NATIVE_URL__",Cf="__NATIVE_TEXT__",Ef="__NATIVE_HTML__";const Of=Object.freeze(Object.defineProperty({__proto__:null,FILE:wf,HTML:Ef,TEXT:Cf,URL:Sf},Symbol.toStringTag,{value:"Module"}));function qa(e,t,r){var n=t.reduce(function(s,i){return s||e.getData(i)},"");return n??r}var Mn;function Qi(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var za=(Mn={},Qi(Mn,wf,{exposeProperties:{files:function(t){return Array.prototype.slice.call(t.files)},items:function(t){return t.items},dataTransfer:function(t){return t}},matchesTypes:["Files"]}),Qi(Mn,Ef,{exposeProperties:{html:function(t,r){return qa(t,r,"")},dataTransfer:function(t){return t}},matchesTypes:["Html","text/html"]}),Qi(Mn,Sf,{exposeProperties:{urls:function(t,r){return qa(t,r,"").split(`
465
- `)},dataTransfer:function(t){return t}},matchesTypes:["Url","text/uri-list"]}),Qi(Mn,Cf,{exposeProperties:{text:function(t,r){return qa(t,r,"")},dataTransfer:function(t){return t}},matchesTypes:["Text","text/plain"]}),Mn);function M0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function L0(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function F0(e,t,r){return t&&L0(e.prototype,t),e}function If(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var $0=function(){function e(t){M0(this,e),If(this,"item",void 0),If(this,"config",void 0),this.config=t,this.item={},this.initializeExposedProperties()}return F0(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 j0(e,t){var r=new $0(za[e]);return r.loadDataTransfer(t),r}function Ha(e){if(!e)return null;var t=Array.prototype.slice.call(e.types||[]);return Object.keys(za).filter(function(r){var n=za[r].matchesTypes;return n.some(function(s){return t.indexOf(s)>-1})})[0]||null}function B0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function U0(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function V0(e,t,r){return t&&U0(e.prototype,t),e}function Wa(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var q0=function(){function e(t,r){B0(this,e),Wa(this,"ownerDocument",null),Wa(this,"globalContext",void 0),Wa(this,"optionsArgs",void 0),this.globalContext=t,this.optionsArgs=r}return V0(e,[{key:"window",get:function(){if(this.globalContext)return this.globalContext;if(typeof window<"u")return window}},{key:"document",get:function(){var r;return(r=this.globalContext)!==null&&r!==void 0&&r.document?this.globalContext.document:this.window?this.window.document:void 0}},{key:"rootElement",get:function(){var r;return((r=this.optionsArgs)===null||r===void 0?void 0:r.rootElement)||this.window}}]),e}();function Df(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Tf(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Df(Object(r),!0).forEach(function(n){me(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Df(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function z0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function H0(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function W0(e,t,r){return t&&H0(e.prototype,t),e}function me(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Q0=function(){function e(t,r,n){var s=this;z0(this,e),me(this,"options",void 0),me(this,"actions",void 0),me(this,"monitor",void 0),me(this,"registry",void 0),me(this,"enterLeaveCounter",void 0),me(this,"sourcePreviewNodes",new Map),me(this,"sourcePreviewNodeOptions",new Map),me(this,"sourceNodes",new Map),me(this,"sourceNodeOptions",new Map),me(this,"dragStartSourceIds",null),me(this,"dropTargetIds",[]),me(this,"dragEnterTargetIds",[]),me(this,"currentNativeSource",null),me(this,"currentNativeHandle",null),me(this,"currentDragSourceNode",null),me(this,"altKeyPressed",!1),me(this,"mouseMoveTimeoutTimer",null),me(this,"asyncEndDragFrameId",null),me(this,"dragOverTargetIds",null),me(this,"lastClientOffset",null),me(this,"hoverRafId",null),me(this,"getSourceClientOffset",function(i){var o=s.sourceNodes.get(i);return o&&_f(o)||null}),me(this,"endDragNativeItem",function(){s.isDraggingNativeItem()&&(s.actions.endDrag(),s.currentNativeHandle&&s.registry.removeSource(s.currentNativeHandle),s.currentNativeHandle=null,s.currentNativeSource=null)}),me(this,"isNodeInDocument",function(i){return!!(i&&s.document&&s.document.body&&s.document.body.contains(i))}),me(this,"endDragIfSourceWasRemovedFromDOM",function(){var i=s.currentDragSourceNode;i==null||s.isNodeInDocument(i)||s.clearCurrentDragSourceNode()&&s.monitor.isDragging()&&s.actions.endDrag()}),me(this,"handleTopDragStartCapture",function(){s.clearCurrentDragSourceNode(),s.dragStartSourceIds=[]}),me(this,"handleTopDragStart",function(i){if(!i.defaultPrevented){var o=s.dragStartSourceIds;s.dragStartSourceIds=null;var a=Wi(i);s.monitor.isDragging()&&s.actions.endDrag(),s.actions.beginDrag(o||[],{publishSource:!1,getSourceClientOffset:s.getSourceClientOffset,clientOffset:a});var c=i.dataTransfer,d=Ha(c);if(s.monitor.isDragging()){if(c&&typeof c.setDragImage=="function"){var u=s.monitor.getSourceId(),f=s.sourceNodes.get(u),g=s.sourcePreviewNodes.get(u)||f;if(g){var y=s.getCurrentSourcePreviewNodeOptions(),_=y.anchorX,p=y.anchorY,v=y.offsetX,m=y.offsetY,b={anchorX:_,anchorY:p},S={offsetX:v,offsetY:m},w=P0(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 E=s.getCurrentSourcePreviewNodeOptions(),D=E.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()}}}),me(this,"handleTopDragEndCapture",function(){s.clearCurrentDragSourceNode()&&s.monitor.isDragging()&&s.actions.endDrag()}),me(this,"handleTopDragEnterCapture",function(i){s.dragEnterTargetIds=[];var o=s.enterLeaveCounter.enter(i.target);if(!(!o||s.monitor.isDragging())){var a=i.dataTransfer,c=Ha(a);c&&s.beginDragNativeItem(c,a)}}),me(this,"handleTopDragEnter",function(i){var o=s.dragEnterTargetIds;if(s.dragEnterTargetIds=[],!!s.monitor.isDragging()){s.altKeyPressed=i.altKey,o.length>0&&s.actions.hover(o,{clientOffset:Wi(i)});var a=o.some(function(c){return s.monitor.canDropOnTarget(c)});a&&(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect=s.getCurrentDropEffect()))}}),me(this,"handleTopDragOverCapture",function(){s.dragOverTargetIds=[]}),me(this,"handleTopDragOver",function(i){var o=s.dragOverTargetIds;if(s.dragOverTargetIds=[],!s.monitor.isDragging()){i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect="none");return}s.altKeyPressed=i.altKey,s.lastClientOffset=Wi(i),s.hoverRafId===null&&typeof requestAnimationFrame<"u"&&(s.hoverRafId=requestAnimationFrame(function(){s.monitor.isDragging()&&s.actions.hover(o||[],{clientOffset:s.lastClientOffset}),s.hoverRafId=null}));var a=(o||[]).some(function(c){return s.monitor.canDropOnTarget(c)});a?(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect=s.getCurrentDropEffect())):s.isDraggingNativeItem()?i.preventDefault():(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect="none"))}),me(this,"handleTopDragLeaveCapture",function(i){s.isDraggingNativeItem()&&i.preventDefault();var o=s.enterLeaveCounter.leave(i.target);o&&s.isDraggingNativeItem()&&setTimeout(function(){return s.endDragNativeItem()},0)}),me(this,"handleTopDropCapture",function(i){if(s.dropTargetIds=[],s.isDraggingNativeItem()){var o;i.preventDefault(),(o=s.currentNativeSource)===null||o===void 0||o.loadDataTransfer(i.dataTransfer)}else Ha(i.dataTransfer)&&i.preventDefault();s.enterLeaveCounter.reset()}),me(this,"handleTopDrop",function(i){var o=s.dropTargetIds;s.dropTargetIds=[],s.actions.hover(o,{clientOffset:Wi(i)}),s.actions.drop({dropEffect:s.getCurrentDropEffect()}),s.isDraggingNativeItem()?s.endDragNativeItem():s.monitor.isDragging()&&s.actions.endDrag()}),me(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 q0(r,n),this.actions=t.getActions(),this.monitor=t.getMonitor(),this.registry=t.getRegistry(),this.enterLeaveCounter=new O0(this.isNodeInDocument)}return W0(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 Tf({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 Tf({anchorX:.5,anchorY:.5,captureDraggingState:!1},n||{})}},{key:"isDraggingNativeItem",value:function(){var r=this.monitor.getItemType();return Object.keys(Of).some(function(n){return Of[n]===r})}},{key:"beginDragNativeItem",value:function(r,n){this.clearCurrentDragSourceNode(),this.currentNativeSource=j0(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}(),Ki;function K0(){return Ki||(Ki=new Image,Ki.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="),Ki}var G0=function(t,r,n){return new Q0(t,r,n)};function R0(e,t){return typeof e=="function"?e(t):e??"NODE"}function Y0(e){return e.isDraggable&&!e.isEditing}function X0(e){const t=Tt(),r=t.selectedIds,[n,s,i]=ZC(()=>({canDrag:()=>Y0(e),type:R0(t.props.dragType,e),item:()=>{const o=t.isSelected(e.id)?Array.from(r):[e.id];return t.dispatch(Nn.dragStart(e.id,o)),{id:e.id,dragIds:o,data:e.data}},end:()=>{t.hideCursor(),t.redrawList(),t.dispatch(Nn.dragEnd())}}),[r,e,t.props.dragType]);return h.useEffect(()=>{i(K0())},[i]),s}function Z0(e,t){const r=e.getBoundingClientRect(),n=t.x-Math.round(r.x),s=t.y-Math.round(r.y),i=r.height,o=s<i/2,a=!o,c=i/4,d=s>c&&s<i-c;return{x:n,inTopHalf:o,inBottomHalf:a,inMiddle:d,atTop:!d&&o,atBottom:!d&&a}}function J0(e,t,r,n){return e?e.isInternal?n.atTop?[t,e]:n.inMiddle?[e,e]:[e,r]:n.inTopHalf?[t,e]:[e,r]:[t,null]}function Gi(e,t){return{parentId:e||null,index:t}}function Ln(e,t){return{type:"line",index:e,level:t}}function e1(e){return{type:"highlight",id:e}}function Qa(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=cd(n)+1;return{parentId:s,index:i}}function Nf(e){var t;const r=Z0(e.element,e.offset),n=e.indent,s=Math.round(Math.max(0,r.x-n)/n),{node:i,nextNode:o,prevNode:a}=e,[c,d]=J0(i,a,o,r);if(i&&i.isInternal&&r.inMiddle)return{drop:Gi(i.id,null),cursor:e1(i.id)};if(!c)return{drop:Gi((t=d==null?void 0:d.parent)===null||t===void 0?void 0:t.id,0),cursor:Ln(0,0)};if(id(c)){const u=ki(s,(d==null?void 0:d.level)||0,c.level);return{drop:Qa(c,u),cursor:Ln(c.rowIndex+1,u)}}if(od(c)){const u=ki(s,(d==null?void 0:d.level)||0,c.level);return{drop:Qa(c,u),cursor:Ln(c.rowIndex+1,u)}}if(ad(c)){const u=ki(s,0,c.level+1);return u>c.level?{drop:Gi(c.id,0),cursor:Ln(c.rowIndex+1,u)}:{drop:Qa(c,u),cursor:Ln(c.rowIndex+1,u)}}return{drop:Gi(c==null?void 0:c.id,0),cursor:Ln(c.rowIndex+1,c.level+1)}}function t1(e,t){const r=Tt(),[n,s]=pf(()=>({accept:"NODE",canDrop:()=>r.canDrop(),hover:(i,o)=>{const a=o.getClientOffset();if(!e.current||!a)return;const{cursor:c,drop:d}=Nf({element:e.current,offset:a,indent:r.indent,node:t,prevNode:t.prev,nextNode:t.next});d&&r.dispatch(Nn.hovering(d.parentId,d.index)),o.canDrop()?c&&r.showCursor(c):r.hideCursor()},drop:(i,o)=>{if(!o.canDrop())return null;r.drop()}}),[t,e.current,r.props]);return s}function r1(e){const t=Tt(),r=t.at(e);if(!r)throw new Error(`Could not find node for index: ${e}`);return h.useMemo(()=>{const n=r.clone();return t.visibleNodes[e]=n,n},[...Object.values(r.state),r])}const kf=h.memo(function({index:t,style:r}){sd(),__();const n=Tt(),s=r1(t),i=h.useRef(null),o=X0(s),a=t1(i,s),c=h.useCallback(p=>{i.current=p,a(p)},[a]),d=n.indent*s.level,u=h.useMemo(()=>({paddingLeft:d}),[d]),f=h.useMemo(()=>{var p,v;return Object.assign(Object.assign({},r),{top:parseFloat(r.top)+((v=(p=n.props.padding)!==null&&p!==void 0?p:n.props.paddingTop)!==null&&v!==void 0?v:0),minWidth:"max-content"})},[r,n.props.padding,n.props.paddingTop]),g={role:"treeitem","aria-level":s.level+1,"aria-selected":s.isSelected,"aria-expanded":s.isOpen,style:f,tabIndex:-1,className:n.props.rowClassName};h.useEffect(()=>{var p;!s.isEditing&&s.isFocused&&((p=i.current)===null||p===void 0||p.focus({preventScroll:!0}))},[s.isEditing,s.isFocused,i.current]);const y=n.renderNode,_=n.renderRow;return l.jsx(_,{node:s,innerRef:c,attrs:g,children:l.jsx(y,{node:s,tree:n,style:u,dragHandle:o})})});let Ka="",xf=null;function Af(){sd();const e=Tt();return l.jsx("div",{role:"tree","aria-label":e.props["aria-label"],"aria-labelledby":e.props["aria-labelledby"],"aria-multiselectable":!e.props.disableMultiSelection||void 0,style:{height:e.height,width:e.width,minHeight:0,minWidth:0},onContextMenu:e.props.onContextMenu,onClick:e.props.onClick,tabIndex:0,onFocus:t=>{t.currentTarget.contains(t.relatedTarget)||e.onFocus()},onBlur:t=>{t.currentTarget.contains(t.relatedTarget)||e.onBlur()},onKeyDown:t=>{var r;if(e.isEditing)return;if(t.key==="Backspace"){if(!e.props.onDelete)return;const s=Array.from(e.selectedIds);if(s.length>1){let i=e.mostRecentNode;for(;i&&i.isSelected;)i=i.nextSibling;i||(i=e.lastNode),e.focus(i,{scroll:!1}),e.delete(Array.from(s))}else{const i=e.focusedNode;if(i){const o=i.nextSibling,a=i.parent;e.focus(o||a,{scroll:!1}),e.delete(i)}}return}if(t.key==="Tab"&&!t.shiftKey){t.preventDefault(),ud(t.currentTarget);return}if(t.key==="Tab"&&t.shiftKey){t.preventDefault(),dd(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(xf),Ka+=t.key,xf=setTimeout(()=>{Ka=""},600);const n=e.visibleNodes.find(s=>{const i=s.data.name;return typeof i=="string"?i.toLowerCase().startsWith(Ka):!1});n&&e.focus(n.id)},children:l.jsx(n1,{})})}function n1(){var e,t;const r=Tt(),n={className:r.props.className,outerRef:r.listEl,itemCount:r.visibleNodes.length,height:r.height,width:r.width,overscanCount:r.overscanCount,itemKey:s=>{var i;return((i=r.visibleNodes[s])===null||i===void 0?void 0:i.id)||s},outerElementType:(e=r.props.outerElementType)!==null&&e!==void 0?e:lw,innerElementType:(t=r.props.innerElementType)!==null&&t!==void 0?t:dw,onScroll:r.props.onScroll,onItemsRendered:r.onItemsRendered.bind(r)};return typeof r.props.rowHeight=="function"?l.jsx(sw,Object.assign({},n,{itemSize:r.rowHeightAt,ref:r.list,children:kf})):l.jsx(iw,Object.assign({},n,{itemSize:r.rowHeight,ref:r.list,children:kf}))}function Pf(e){return e.isFiltered?i1(e.root,e.isMatch.bind(e)):s1(e.root)}function s1(e){const t=[];function r(n){var s;n.level>=0&&t.push(n),n.isOpen&&((s=n.children)===null||s===void 0||s.forEach(r))}return r(e),t.forEach(Mf),t}function i1(e,t){const r={},n=[];function s(o){if(!o.isRoot&&t(o)){r[o.id]=!0;let c=o.parent;for(;c;)r[c.id]=!0,c=c.parent}if(o.children)for(let c of o.children)s(c)}function i(o){var a;o.level>=0&&r[o.id]&&n.push(o),o.isOpen&&((a=o.children)===null||a===void 0||a.forEach(i))}return s(e),i(e),n.forEach(Mf),n}function Mf(e,t){e.rowIndex=t}const Lf=e=>e.reduce((t,r,n)=>(t[r.id]=n,t),{});var Ga=function(e,t,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function a(u){try{d(n.next(u))}catch(f){o(f)}}function c(u){try{d(n.throw(u))}catch(f){o(f)}}function d(u){u.done?i(u.value):s(u.value).then(a,c)}d((n=n.apply(e,t||[])).next())})};const{safeRun:vt}=O_;class Is{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=yd(this),this.visibleNodes=Pf(this),this.idToIndex=Lf(this.visibleNodes)}update(t){this.props=t,this.root=yd(this),this.visibleNodes=Pf(this),this.idToIndex=Lf(this.visibleNodes),this.rowOffsets=null;const r=this.list.current;r&&"resetAfterIndex"in r&&r.resetAfterIndex(0,!1)}dispatch(t){return this.store.dispatch(t)}get state(){return this.store.getState()}get openState(){return this.state.nodes.open.unfiltered}get width(){var t;return(t=this.props.width)!==null&&t!==void 0?t:300}get height(){var t;return(t=this.props.height)!==null&&t!==void 0?t:500}get indent(){var t;return(t=this.props.indent)!==null&&t!==void 0?t:24}get rowHeight(){return typeof this.props.rowHeight=="number"?this.props.rowHeight:24}getRowOffsets(){if(this.rowOffsets)return this.rowOffsets;const t=[0];for(let r=0;r<this.visibleNodes.length;r++)t.push(t[r]+this.rowHeightAt(r));return this.rowOffsets=t,t}get overscanCount(){var t;return(t=this.props.overscanCount)!==null&&t!==void 0?t:1}get searchTerm(){return(this.props.searchTerm||"").trim()}get matchFn(){var t;const r=(t=this.props.searchMatch)!==null&&t!==void 0?t:(n,s)=>JSON.stringify(Object.values(n.data)).toLocaleLowerCase().includes(s.toLocaleLowerCase());return n=>r(n,this.searchTerm)}accessChildren(t){var r;const n=this.props.childrenAccessor||"children";return(r=ws(t,n))!==null&&r!==void 0?r:null}accessId(t){const r=this.props.idAccessor||"id",n=ws(t,r);if(!n)throw new Error("Data must contain an 'id' property or props.idAccessor must return a string");return n}identify(t){if(typeof t=="string")return t;if(t instanceof Cs)return t.id;const r=this.props.idAccessor||"id";return ws(t,r)}identifyNull(t){return t==null?null:this.identify(t)}get firstNode(){var t;return(t=this.visibleNodes[0])!==null&&t!==void 0?t:null}get lastNode(){var t;return(t=this.visibleNodes[this.visibleNodes.length-1])!==null&&t!==void 0?t:null}get focusedNode(){var t;return(t=this.get(this.state.nodes.focus.id))!==null&&t!==void 0?t:null}get mostRecentNode(){var t;return(t=this.get(this.state.nodes.selection.mostRecent))!==null&&t!==void 0?t:null}get nextNode(){const t=this.indexOf(this.focusedNode);return t===null?null:this.at(t+1)}get prevNode(){const t=this.indexOf(this.focusedNode);return t===null?null:this.at(t-1)}get(t){return t&&t in this.idToIndex&&this.visibleNodes[this.idToIndex[t]]||null}at(t){return this.visibleNodes[t]||null}nodesBetween(t,r){var n;if(t===null||r===null)return[];const s=(n=this.indexOf(t))!==null&&n!==void 0?n:0,i=this.indexOf(r);if(i===null)return[];const o=Math.min(s,i),a=Math.max(s,i);return this.visibleNodes.slice(o,a+1)}indexOf(t){const r=this.identifyNull(t);return r?this.idToIndex[r]:null}get editingId(){return this.state.nodes.edit.id}createInternal(){return this.create({type:"internal"})}createLeaf(){return this.create({type:"leaf"})}create(){return Ga(this,arguments,void 0,function*(t={}){var r,n;const s=t.parentId===void 0?gd(this):t.parentId,i=(r=t.index)!==null&&r!==void 0?r:pd(this),o=(n=t.type)!==null&&n!==void 0?n:"leaf",a=yield vt(this.props.onCreate,{type:o,parentId:s,index:i,parentNode:this.get(s)});a&&(this.focus(a),setTimeout(()=>{this.edit(a).then(()=>{this.select(a),this.activate(a)})}))})}delete(t){return Ga(this,void 0,void 0,function*(){if(!t)return;const n=(Array.isArray(t)?t:[t]).map(o=>this.identify(o)),s=n.map(o=>this.get(o)).filter(o=>!!o),i=s.length?Math.min(...s.map(o=>{var a;return(a=o.rowIndex)!==null&&a!==void 0?a:0})):0;yield vt(this.props.onDelete,{nodes:s,ids:n}),this.redrawList(i)})}edit(t){var r,n;const s=this.identify(t);return this.resolveEdit({cancelled:!0}),this.scrollTo(s),this.dispatch(wa(s)),this.redrawList((n=(r=this.get(s))===null||r===void 0?void 0:r.rowIndex)!==null&&n!==void 0?n:0),new Promise(i=>{Is.editPromise=i})}submit(t,r){return Ga(this,void 0,void 0,function*(){var n,s;if(!t)return;const i=this.identify(t);yield vt(this.props.onRename,{id:i,name:r,node:this.get(i)}),this.dispatch(wa(null)),this.resolveEdit({cancelled:!1,value:r}),this.redrawList((s=(n=this.get(i))===null||n===void 0?void 0:n.rowIndex)!==null&&s!==void 0?s:0),setTimeout(()=>this.onFocus())})}reset(){this.dispatch(wa(null)),this.resolveEdit({cancelled:!0}),this.redrawList(),setTimeout(()=>this.onFocus())}activate(t){const r=this.get(this.identifyNull(t));r&&vt(this.props.onActivate,r)}resolveEdit(t){const r=Is.editPromise;r&&r(t),Is.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(Dn(this.identify(t))),r.scroll!==!1&&this.scrollTo(t),this.focusedNode&&vt(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(Dn(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&&vt(this.props.onFocus,this.focusedNode)}deselect(t){if(!t)return;const r=this.identify(t);this.dispatch(Tr.remove(r)),vt(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(Dn(n.id)),n.isSelectable&&(this.dispatch(Tr.add(n.id)),this.dispatch(Tr.anchor(n.id)),this.dispatch(Tr.mostRecent(n.id))),this.scrollTo(n,r.align),this.focusedNode&&s&&vt(this.props.onFocus,this.focusedNode),vt(this.props.onSelect,this.selectedNodes)}selectContiguous(t){var r;if(!t)return;const n=this.identify(t);if(this.dispatch(Dn(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(Tr.remove(this.nodesBetween(s,i))),this.dispatch(Tr.add(o)),this.dispatch(Tr.mostRecent(n))}this.scrollTo(n),this.focusedNode&&vt(this.props.onFocus,this.focusedNode),vt(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(Dn((n=this.lastNode)===null||n===void 0?void 0:n.id)),this.focusedNode&&vt(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(Tr.set({ids:n,anchor:s,mostRecent:i})),vt(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&&ld(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;vt(this.props.onMove,{dragIds:n,parentId:t===Ss?null:t,index:r===null?0:r,dragNodes:this.dragNodes,parentNode:this.get(t)}),this.open(t)}hideCursor(){this.dispatch(Nn.cursor({type:"none"}))}showCursor(t){this.dispatch(Nn.cursor(t))}open(t,r=!0){var n,s;const i=this.identifyNull(t);i&&(this.isOpen(i)||(this.dispatch(Sa.open(i,this.isFiltered)),r&&this.redrawList((s=(n=this.get(i))===null||n===void 0?void 0:n.rowIndex)!==null&&s!==void 0?s:0),vt(this.props.onToggle,i)))}close(t,r=!0){var n,s;const i=this.identifyNull(t);i&&this.isOpen(i)&&(this.dispatch(Sa.close(i,this.isFiltered)),r&&this.redrawList((s=(n=this.get(i))===null||n===void 0?void 0:n.rowIndex)!==null&&s!==void 0?s:0),vt(this.props.onToggle,i))}toggle(t){const r=this.identifyNull(t);if(r)return this.isOpen(r)?this.close(r):this.open(r)}openParents(t){const r=this.identifyNull(t);if(!r)return;const n=_a(this.root,r);let s=n==null?void 0:n.parent;for(;s;)this.open(s.id,!1),s=s.parent;this.redrawList()}openSiblings(t){const r=t.parent;if(!r)this.toggle(t.id);else if(r.children){const n=t.isOpen;for(let s of r.children)s.isInternal&&(n?this.close(s.id,!1):this.open(s.id,!1));this.redrawList(),this.scrollTo(this.focusedNode)}}openAll(){xi(this.root,t=>{t.isInternal&&this.open(t.id,!1)}),this.redrawList()}closeAll(){xi(this.root,t=>{t.isInternal&&this.close(t.id,!1)}),this.redrawList()}scrollTo(t,r="smart"){if(!t)return;const n=this.identify(t);return this.openParents(n),hd(()=>n in this.idToIndex).then(()=>{var s;const i=this.idToIndex[n];i!==void 0&&((s=this.list.current)===null||s===void 0||s.scrollToItem(i,r))}).catch(()=>{})}get isEditing(){return this.state.nodes.edit.id!==null}get isFiltered(){var t;return!!(!((t=this.props.searchTerm)===null||t===void 0)&&t.trim())}get hasFocus(){return this.state.nodes.focus.treeFocused}get hasNoSelection(){return this.state.nodes.selection.ids.size===0}get hasOneSelection(){return this.state.nodes.selection.ids.size===1}get hasMultipleSelections(){return this.state.nodes.selection.ids.size>1}isSelected(t){return t?this.state.nodes.selection.ids.has(t):!1}isOpen(t){var r,n,s;if(!t)return!1;if(t===Ss)return!0;const i=(r=this.props.openByDefault)!==null&&r!==void 0?r:!0;return this.isFiltered?(n=this.state.nodes.open.filtered[t])!==null&&n!==void 0?n:!0:(s=this.state.nodes.open.unfiltered[t])!==null&&s!==void 0?s:i}isEditable(t){return this.isActionPossible(t,this.props.disableEdit)}isDraggable(t){return this.isActionPossible(t,this.props.disableDrag)}isSelectable(t){return this.isActionPossible(t,this.props.disableSelect)}isActionPossible(t,r=()=>!1){return!ws(t,r)}isDragging(t){const r=this.identifyNull(t);return r?this.state.nodes.drag.id===r:!1}isFocused(t){return this.hasFocus&&this.state.nodes.focus.id===t}isMatch(t){return this.matchFn(t)}willReceiveDrop(t){const r=this.identifyNull(t);if(!r)return!1;const{destinationParentId:n,destinationIndex:s}=this.state.nodes.drag;return r===n&&s===null}onFocus(){const t=this.focusedNode||this.firstNode;t&&this.dispatch(Dn(t.id))}onBlur(){this.dispatch(L_())}onItemsRendered(t){this.visibleStartIndex=t.visibleStartIndex,this.visibleStopIndex=t.visibleStopIndex}get renderContainer(){return this.props.renderContainer||Af}get renderRow(){return this.props.renderRow||k_}get renderNode(){return this.props.children||x_}get renderDragPreview(){return this.props.renderDragPreview||md}get renderCursor(){return this.props.renderCursor||N_}}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",Ff=o1,Ra=()=>Math.random().toString(36).substring(7).split("").join("."),a1={INIT:`@@redux/INIT${Ra()}`,REPLACE:`@@redux/REPLACE${Ra()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Ra()}`},Xr=a1;function $f(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function l1(e){if(e===void 0)return"undefined";if(e===null)return"null";const t=typeof e;switch(t){case"boolean":case"string":case"number":case"symbol":case"function":return t}if(Array.isArray(e))return"array";if(d1(e))return"date";if(u1(e))return"error";const r=c1(e);switch(r){case"Symbol":case"Promise":case"WeakMap":case"WeakSet":case"Map":case"Set":return r}return Object.prototype.toString.call(e).slice(8,-1).toLowerCase().replace(/\s/g,"")}function c1(e){return typeof e.constructor=="function"?e.constructor.name:null}function u1(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function d1(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function Nr(e){let t=typeof e;return process.env.NODE_ENV!=="production"&&(t=l1(e)),t}function jf(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: '${Nr(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: '${Nr(r)}'`);return r(jf)(e,t)}let n=e,s=t,i=new Map,o=i,a=0,c=!1;function d(){o===i&&(o=new Map,i.forEach((v,m)=>{o.set(m,v)}))}function u(){if(c)throw new Error(process.env.NODE_ENV==="production"?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(v){if(typeof v!="function")throw new Error(process.env.NODE_ENV==="production"?mt(4):`Expected the listener to be a function. Instead, received: '${Nr(v)}'`);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 m=!0;d();const b=a++;return o.set(b,v),function(){if(m){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.");m=!1,d(),o.delete(b),i=null}}}function g(v){if(!$f(v))throw new Error(process.env.NODE_ENV==="production"?mt(7):`Actions must be plain objects. Instead, the actual type was: '${Nr(v)}'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.`);if(typeof v.type>"u")throw new Error(process.env.NODE_ENV==="production"?mt(8):'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');if(typeof v.type!="string")throw new Error(process.env.NODE_ENV==="production"?mt(17):`Action "type" property must be a string. Instead, the actual type was: '${Nr(v.type)}'. Value was: '${v.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,v)}finally{c=!1}return(i=o).forEach(b=>{b()}),v}function y(v){if(typeof v!="function")throw new Error(process.env.NODE_ENV==="production"?mt(10):`Expected the nextReducer to be a function. Instead, received: '${Nr(v)}`);n=v,g({type:Xr.REPLACE})}function _(){const v=f;return{subscribe(m){if(typeof m!="object"||m===null)throw new Error(process.env.NODE_ENV==="production"?mt(11):`Expected the observer to be an object. Instead, received: '${Nr(m)}'`);function b(){const w=m;w.next&&w.next(u())}return b(),{unsubscribe:v(b)}},[Ff](){return this}}}return g({type:Xr.INIT}),{dispatch:g,subscribe:f,getState:u,replaceReducer:y,[Ff]:_}}function Bf(e){typeof console<"u"&&typeof console.error=="function"&&console.error(e);try{throw new Error(e)}catch{}}function f1(e,t,r,n){const s=Object.keys(t),i=r&&r.type===Xr.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(!$f(e))return`The ${i} has unexpected type of "${Nr(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===Xr.REPLACE)&&o.length>0)return`Unexpected ${o.length>1?"keys":"key"} "${o.join('", "')}" found in ${i}. Expected to find one of the known reducer keys instead: "${s.join('", "')}". Unexpected keys will be ignored.`}function h1(e){Object.keys(e).forEach(t=>{const r=e[t];if(typeof r(void 0,{type:Xr.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:Xr.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 '${Xr.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 Uf(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"&&Bf(`No reducer provided for key "${a}"`),typeof e[a]=="function"&&(r[a]=e[a])}const n=Object.keys(r);let s;process.env.NODE_ENV!=="production"&&(s={});let i;try{h1(r)}catch(o){i=o}return function(a={},c){if(i)throw i;if(process.env.NODE_ENV!=="production"){const f=f1(a,r,c,s);f&&Bf(f)}let d=!1;const u={};for(let f=0;f<n.length;f++){const g=n[f],y=r[g],_=a[g],p=y(_,c);if(typeof p>"u"){const v=c&&c.type;throw new Error(process.env.NODE_ENV==="production"?mt(14):`When called with an action of type ${v?`"${String(v)}"`:"(unknown type)"}, the slice reducer for key "${g}" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.`)}u[g]=p,d=d||p!==_}return d=d||n.length!==Object.keys(a).length,d?u:a}}function p1(e=Tn().nodes.drag,t){switch(t.type){case"DND_DRAG_START":return Object.assign(Object.assign({},e),{id:t.id,selectedIds:t.dragIds});case"DND_DRAG_END":return Object.assign(Object.assign({},e),{id:null,destinationParentId:null,destinationIndex:null,selectedIds:[]});case"DND_HOVERING":return t.parentId!==e.destinationParentId||t.index!=e.destinationIndex?Object.assign(Object.assign({},e),{destinationParentId:t.parentId,destinationIndex:t.index}):e;default:return e}}const g1=Uf({nodes:Uf({focus:F_,edit:M_,open:$_,selection:j_,drag:p1}),dnd:B_}),y1=Tn();function v1({treeProps:e,imperativeHandle:t,children:r}){const n=h.useRef(null),s=h.useRef(null),i=h.useRef(jf(g1,Tn(e))),o=b_.useSyncExternalStore(i.current.subscribe,i.current.getState,()=>y1),a=h.useMemo(()=>new Is(i.current,e,n,s),[]),c=h.useRef(0);return h.useMemo(()=>{c.current+=1,a.update(e)},Object.values(e)),h.useMemo(()=>{c.current+=1,a.update(a.props)},[o.nodes.open]),h.useImperativeHandle(t,()=>a),h.useEffect(()=>{a.props.selection?a.select(a.props.selection,{focus:!1}):a.deselectAll()},[a.props.selection]),h.useEffect(()=>{a.props.searchTerm||i.current.dispatch(Sa.clear(!0))},[a.props.searchTerm]),l.jsx(ed.Provider,{value:a,children:l.jsx(nd.Provider,{value:c.current,children:l.jsx(td.Provider,{value:o.nodes,children:l.jsx(rd.Provider,{value:o.dnd,children:l.jsx(GS,Object.assign({},e.dndManager?{manager:e.dndManager}:{backend:e.dndBackend||G0,options:{rootElement:a.props.dndRootElement||void 0}},{children:r}))})})})})}function m1(){const e=Tt(),[,t]=pf(()=>({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}=Nf({element:e.listEl.current,offset:s,indent:e.indent,node:null,prevNode:e.visibleNodes[e.visibleNodes.length-1],nextNode:null});o&&e.dispatch(Nn.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 m1(),e.children}function _1(){const t=Tt().props.renderContainer||Af;return l.jsx(l.Fragment,{children:l.jsx(t,{})})}function w1(){const e=Tt(),{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||md;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 S1(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 C1{constructor(t,r={}){this.accessors=S1(r),this.root=E1(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 E1(e,t){const r=new Vf({},null,t,"ROOT");return r.children=e.map(n=>Ya(n,r,t)),r}function Ya(e,t,r){const n=new Vf(e,t,r),s=r.getChildren(e);return s&&(n.children=s.map(i=>Ya(i,n,r))),n}class Vf{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=Ya(t,this,this.accessors);this.children=(n=this.children)!==null&&n!==void 0?n:[],this.children.splice(r,0,i);const o=this.accessors.childrenKey,a=this.data;a[o]=(s=a[o])!==null&&s!==void 0?s:[],a[o].splice(r,0,t)}removeChild(t){var r,n;(r=this.children)===null||r===void 0||r.splice(t,1),(n=this.data[this.accessors.childrenKey])===null||n===void 0||n.splice(t,1)}update(t){if(this.hasParent()){const r=this.childIndex;this.parent.addChild(Object.assign(Object.assign({},this.data),t),r),this.drop()}}drop(){this.hasParent()&&this.parent.removeChild(this.childIndex)}}let O1=0;function I1(e,t={}){const[r,n]=h.useState(e),s=t.idAccessor,i=t.childrenAccessor,o=h.useMemo(()=>new C1(r,{idAccessor:s,childrenAccessor:i}),[r,s,i]),a=_=>{for(const p of _.dragIds)o.move({id:p,parentId:_.parentId,index:_.index});n(o.data)},c=({name:_,id:p})=>{o.update({id:p,changes:{name:_}}),n(o.data)},d=typeof s=="string"?s:"id",u=typeof i=="string"?i:"children";return[r,{onMove:a,onRename:c,onCreate:({parentId:_,index:p,type:v})=>{if(typeof s=="function")throw new Error("React Arborist => initialData can't create nodes when idAccessor is a function: the generated id can't be written under a key the accessor reads. Use a string idAccessor, or the controlled `data` prop with your own onCreate.");if(v==="internal"&&typeof i=="function")throw new Error("React Arborist => initialData can't create folder nodes when childrenAccessor is a function: the new children array can't be written under a key the accessor reads. Use a string childrenAccessor, or the controlled `data` prop with your own onCreate.");const m={[d]:`simple-tree-id-${O1++}`,name:""};return v==="internal"&&(m[u]=[]),o.create({parentId:_,index:p,data:m}),n(o.data),m},onDelete:_=>{_.ids.forEach(p=>o.drop({id:p})),n(o.data)}}]}function D1(e){if(e.initialData&&e.data)throw new Error("React Arborist Tree => Provide either a data or initialData prop, but not both.");if(e.initialData&&(e.onCreate||e.onDelete||e.onMove||e.onRename))throw new Error(`React Arborist Tree => You passed the initialData prop along with a data handler.
466
- Use the data prop if you want to provide your own handlers.`);if(e.initialData){const[t,r]=I1(e.initialData,{idAccessor:e.idAccessor,childrenAccessor:e.childrenAccessor});return Object.assign(Object.assign(Object.assign({},e),r),{data:t})}else return e}function T1(e,t){const r=D1(e);return l.jsxs(v1,{treeProps:r,imperativeHandle:t,children:[l.jsx(b1,{children:l.jsx(_1,{})}),l.jsx(w1,{})]})}const N1=h.forwardRef(T1);function Xa(){return Ie(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 k1(){return Ie(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 qf={video:"#EA580C",pdf:"#DC2626",h5p:"#0D9488",scorm:"#7C3AED",audio:"#DB2777",quiz:"#16A34A",default:"#6B7280"},zf={video:"Video",pdf:"FileText",h5p:"Layers",scorm:"Package",audio:"Music",quiz:"HelpCircle",default:"File"},Hf=["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 A1(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 Ri(e){const t=A1(e);return{key:t,color:qf[t]??qf.default,bgClass:`sbx-ct-sq--${t}`,badgeClass:`sbx-ct-badge--${t}`,tintClass:`sbx-ct-tint--${t}`,iconName:zf[t]??zf.default,label:t.charAt(0).toUpperCase()+t.slice(1)}}const Nt={row:"_row_i3qt2_1",grip:"_grip_i3qt2_16",menuBtn:"_menuBtn_i3qt2_19",selected:"_selected_i3qt2_23",title:"_title_i3qt2_28",dropTarget:"_dropTarget_i3qt2_33",toggle:"_toggle_i3qt2_50",ctIcon:"_ctIcon_i3qt2_65",folderIcon:"_folderIcon_i3qt2_77",renameInput:"_renameInput_i3qt2_92",dropHere:"_dropHere_i3qt2_101",menuWrap:"_menuWrap_i3qt2_111",menu:"_menu_i3qt2_19",dangerItem:"_dangerItem_i3qt2_163"},P1={video:Ro,pdf:zo,h5p:Ho,scorm:Qo,audio:Wo,quiz:qo,default:_n},M1=({node:e,style:t,dragHandle:r,editorMode:n})=>{const[s,i]=h.useState(!1),[o,a]=h.useState(!1),[c,d]=h.useState(e.data.name),u=h.useRef(null),f=n==="edit",g=Xa(),y=Ri(e.data),_=P1[y.key]??_n,p=e.isSelected,v=e.level===0,m=e.data.isFolder??(e.children&&e.children.length>0),b=v?_v:m?Iv:_;h.useEffect(()=>{if(!s)return;const E=D=>{var x;(x=u.current)!=null&&x.contains(D.target)||i(!1)};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[s]);const S=h.useCallback(()=>{c.trim()&&e.submit(c.trim()),a(!1)},[c,e]),w=h.useCallback(E=>{E.key==="Enter"&&S(),E.key==="Escape"&&(d(e.data.name),a(!1))},[S,e.data.name]);return l.jsxs("div",{className:[Nt.row,p?Nt.selected:"",e.state.isOver&&m?Nt.dropTarget:""].filter(Boolean).join(" "),style:t,onClick:()=>e.select(),"data-node-id":e.data.id,"data-droppable":m?"true":void 0,role:"treeitem","aria-selected":p,"aria-expanded":m?!e.isClosed:void 0,children:[f&&l.jsx("span",{ref:r,className:Nt.grip,"aria-hidden":"true",children:l.jsx(Hc,{size:14})}),l.jsx("button",{className:Nt.toggle,onClick:E=>{E.stopPropagation(),e.toggle()},"aria-label":e.isClosed?"Expand":"Collapse",style:{visibility:m?"visible":"hidden"},children:e.isClosed?l.jsx(Uc,{size:14}):l.jsx(hs,{size:14})}),l.jsx("span",{className:`${Nt.ctIcon} ${v||m?Nt.folderIcon:y.bgClass}`,"aria-hidden":"true",children:l.jsx(b,{size:12})}),o?l.jsx("input",{className:Nt.renameInput,value:c,autoFocus:!0,onChange:E=>d(E.target.value),onBlur:S,onKeyDown:w,onClick:E=>E.stopPropagation()}):l.jsx("span",{className:Nt.title,title:e.data.name,onDoubleClick:()=>f&&a(!0),children:e.data.name.length>25?`${e.data.name.slice(0,25)}...`:e.data.name}),e.state.isOver&&m&&l.jsx("span",{className:Nt.dropHere,"aria-hidden":"true",children:"Drop here"}),f&&l.jsxs("div",{className:Nt.menuWrap,ref:u,children:[l.jsx("button",{className:Nt.menuBtn,onClick:E=>{E.stopPropagation(),i(D=>!D)},"aria-label":"Node options",children:l.jsx(qc,{size:14})}),s&&l.jsxs("div",{className:Nt.menu,role:"menu",children:[l.jsxs("button",{role:"menuitem",onClick:()=>{a(!0),i(!1)},children:[l.jsx(Av,{size:13})," Rename"]}),m&&g&&l.jsxs("button",{role:"menuitem",onClick:()=>{e.tree.create({parentId:e.id}),i(!1)},children:[l.jsx(zc,{size:13})," Add sub-unit"]}),e.data.parent&&g&&l.jsxs("button",{role:"menuitem",onClick:()=>{e.tree.create({parentId:e.data.parent}),i(!1)},children:[l.jsx(ps,{size:13})," Add Sibling"]}),l.jsxs("button",{role:"menuitem",className:Nt.dangerItem,onClick:()=>{e.tree.delete(e.id),i(!1)},children:[l.jsx(Go,{size:13})," Delete"]})]})]})]})};async function L1(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 F1(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 $1(e,t){var a;const r=await L1(e,t.name),n=await F1(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 j1(e){var r;return((r=(await Ne.get(`/action/collection/v1/import/status/${e}`)).data)==null?void 0:r.result)??{status:"PENDING"}}async function Wf(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 B1(e){return Wf(e)}const Ae={container:"_container_jr3ij_1",header:"_header_jr3ij_13",title:"_title_jr3ij_22",closeBtn:"_closeBtn_jr3ij_29",body:"_body_jr3ij_45",dropZone:"_dropZone_jr3ij_54",dragOver:"_dragOver_jr3ij_67",hasFile:"_hasFile_jr3ij_72",hiddenInput:"_hiddenInput_jr3ij_78",fileInfo:"_fileInfo_jr3ij_82",fileIcon:"_fileIcon_jr3ij_89",fileName:"_fileName_jr3ij_93",fileSize:"_fileSize_jr3ij_100",dropHint:"_dropHint_jr3ij_105",dropIcon:"_dropIcon_jr3ij_112",dropText:"_dropText_jr3ij_117",dropSubtext:"_dropSubtext_jr3ij_124",sampleLink:"_sampleLink_jr3ij_130",statusBar:"_statusBar_jr3ij_145",status_uploading:"_status_uploading_jr3ij_154",status_processing:"_status_processing_jr3ij_154",status_done:"_status_done_jr3ij_159",status_error:"_status_error_jr3ij_164",successDetail:"_successDetail_jr3ij_170",spinner:"_spinner_jr3ij_175",spin:"_spin_jr3ij_175",errorMsg:"_errorMsg_jr3ij_191",failedSection:"_failedSection_jr3ij_197",failedTitle:"_failedTitle_jr3ij_203",tableWrap:"_tableWrap_jr3ij_213",failedTable:"_failedTable_jr3ij_219",reasonCell:"_reasonCell_jr3ij_244",footer:"_footer_jr3ij_248"},U1=({contentId:e,onComplete:t,onClose:r,mode:n="create"})=>{const[s,i]=h.useState(null),[o,a]=h.useState(!1),[c,d]=h.useState("idle"),[u,f]=h.useState(""),[g,y]=h.useState([]),[_,p]=h.useState(null),v=h.useRef(null),m=h.useRef(null),b=h.useCallback(()=>{m.current!==null&&(clearInterval(m.current),m.current=null)},[]);h.useEffect(()=>()=>b(),[b]);const S=N=>N.name.toLowerCase().endsWith(".csv")?N.size>50*1024*1024?(f("File size must not exceed 50 MB."),!1):!0:(f("Only .csv files are accepted."),!1),w=h.useCallback(N=>{f(""),y([]),p(null),d("idle"),S(N)&&i(N)},[]),E=h.useCallback(N=>{N.preventDefault(),a(!1);const M=N.dataTransfer.files[0];M&&w(M)},[w]),D=h.useCallback(N=>{var U;const M=(U=N.target.files)==null?void 0:U[0];M&&w(M),N.target.value=""},[w]),x=h.useCallback(async()=>{try{const N=await B1(e),M=document.createElement("a");M.href=N,M.download="sample_hierarchy.csv",M.target="_blank",M.click()}catch{f("Failed to download sample CSV.")}},[e]),A=h.useCallback(async()=>{if(s){d("uploading"),f(""),y([]);try{const{processId:N}=await $1(e,s);if(!N){d("done"),p(null),setTimeout(t,1500);return}d("processing"),m.current=setInterval(async()=>{try{const M=await j1(N);M.status==="COMPLETED"?(b(),d("done"),p(M.successCount??null),M.failedRecords&&M.failedRecords.length>0?y(M.failedRecords):setTimeout(t,1500)):M.status==="FAILED"&&(b(),d("error"),f("Upload processing failed. Please check the error rows below."),M.failedRecords&&y(M.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]),$={idle:"",uploading:"Uploading...",processing:"Processing...",done:"Done!",error:"Error"};return l.jsxs("div",{className:Ae.container,children:[l.jsxs("div",{className:Ae.header,children:[l.jsx("h2",{className:Ae.title,children:n==="update"?"Update Folder Metadata via CSV":"Create Folders via CSV"}),l.jsx("button",{className:Ae.closeBtn,onClick:r,"aria-label":"Close",children:"✕"})]}),l.jsxs("div",{className:Ae.body,children:[l.jsxs("div",{className:`${Ae.dropZone} ${o?Ae.dragOver:""} ${s?Ae.hasFile:""}`,onDragEnter:N=>{N.preventDefault(),a(!0)},onDragOver:N=>{N.preventDefault(),a(!0)},onDragLeave:N=>{N.preventDefault(),a(!1)},onDrop:E,onClick:()=>{var N;return(N=v.current)==null?void 0:N.click()},role:"button",tabIndex:0,"aria-label":"Drop CSV file here or click to browse",onKeyDown:N=>{var M;return N.key==="Enter"&&((M=v.current)==null?void 0:M.click())},children:[l.jsx("input",{ref:v,type:"file",accept:".csv",className:Ae.hiddenInput,onChange:D,"aria-hidden":"true"}),s?l.jsxs("div",{className:Ae.fileInfo,children:[l.jsx("span",{className:Ae.fileIcon,children:"📄"}),l.jsx("span",{className:Ae.fileName,children:s.name}),l.jsxs("span",{className:Ae.fileSize,children:["(",(s.size/1024).toFixed(1)," KB)"]})]}):l.jsxs("div",{className:Ae.dropHint,children:[l.jsx("span",{className:Ae.dropIcon,children:"⬆️"}),l.jsx("p",{className:Ae.dropText,children:"Drag & drop your CSV here"}),l.jsx("p",{className:Ae.dropSubtext,children:"or click to browse"})]})]}),l.jsx("button",{className:Ae.sampleLink,onClick:x,type:"button",children:"Download Sample CSV"}),c!=="idle"&&l.jsxs("div",{className:`${Ae.statusBar} ${Ae[`status_${c}`]}`,role:"status","aria-live":"polite",children:[c==="processing"&&l.jsx("span",{className:Ae.spinner,"aria-hidden":"true"}),$[c],c==="done"&&_!==null&&l.jsxs("span",{className:Ae.successDetail,children:[" — ",_," item(s) imported"]})]}),u&&l.jsx("p",{className:Ae.errorMsg,role:"alert",children:u}),g.length>0&&l.jsxs("div",{className:Ae.failedSection,children:[l.jsxs("h4",{className:Ae.failedTitle,children:["Failed Rows (",g.length,")"]}),l.jsx("div",{className:Ae.tableWrap,children:l.jsxs("table",{className:Ae.failedTable,children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{children:"Row"}),l.jsx("th",{children:"Name"}),l.jsx("th",{children:"Reason"})]})}),l.jsx("tbody",{children:g.map((N,M)=>l.jsxs("tr",{children:[l.jsx("td",{children:N.rowNumber??M+1}),l.jsx("td",{children:N.name??"—"}),l.jsx("td",{className:Ae.reasonCell,children:N.reason??"Unknown error"})]},M))})]})})]})]}),l.jsxs("div",{className:Ae.footer,children:[l.jsx(Fe,{variant:"ghost",onClick:r,disabled:c==="uploading"||c==="processing",children:"Cancel"}),l.jsx(Fe,{variant:"primary",isLoading:c==="uploading"||c==="processing",disabled:!s||c==="done",onClick:A,children:c==="done"?"Uploaded":"Upload"})]})]})},sr={container:"_container_1y30m_1",header:"_header_1y30m_8",headerActions:"_headerActions_1y30m_19",iconBtn:"_iconBtn_1y30m_25",menuWrap:"_menuWrap_1y30m_43",dropdownMenu:"_dropdownMenu_1y30m_47",treeWrapper:"_treeWrapper_1y30m_79",csvModal:"_csvModal_1y30m_95",footer:"_footer_1y30m_105"},V1=({editorMode:e,collapsed:t=!1,onToggleCollapse:r})=>{var be;const n=h.useRef(null),s=h.useRef(null),i=h.useRef(null),[o,a]=h.useState(400),[c,d]=h.useState(!1),[u,f]=h.useState(!1),[g,y]=h.useState("create"),{treeData:_,selectedNodeId:p,selectNode:v,addNode:m,deleteNode:b,reorderChildren:S,moveNode:w,setTreeData:E}=Ie(),D=e==="edit",x=Xa(),A=D&&x,$=(((be=_[0])==null?void 0:be.children)??[]).some(z=>z.isFolder),N=oe(z=>{var J,te,V,Z;return((te=(J=z.editorConfig)==null?void 0:J.context)==null?void 0:te.contentId)??((Z=(V=z.editorConfig)==null?void 0:V.context)==null?void 0:Z.identifier)??""}),M=oe(z=>{var te,V;const J=(V=(te=z.categoryMeta)==null?void 0:te.sourcingSettings)==null?void 0:V.collection;return(J==null?void 0:J.enableBulkUpload)!==!1});h.useEffect(()=>{const z=s.current;if(!z)return;const J=new ResizeObserver(()=>{a(z.clientHeight||400)});return J.observe(z),a(z.clientHeight||400),()=>J.disconnect()},[]),h.useEffect(()=>{if(!c)return;const z=J=>{var te;(te=i.current)!=null&&te.contains(J.target)||d(!1)};return document.addEventListener("mousedown",z),()=>document.removeEventListener("mousedown",z)},[c]);const U=h.useCallback(z=>{z.length>0&&v(z[0].data.id)},[v]),P=h.useCallback(({parentId:z,index:J,dragIds:te})=>{if(!z)return;const V=te[0],Z=Za(_,V);if(!Z)return;const G=Z.parent;if(G===z){const ce=Za(_,z);if(!(ce!=null&&ce.children))return;const ee=ce.children.findIndex(ge=>ge.id===V);if(ee<0)return;S(z,ee,J>ee?J-1:J)}else w(V,G??"",z)},[_,S,w]),L=h.useCallback(({ids:z})=>{z.forEach(J=>b(J))},[b]),j=h.useCallback(({parentId:z})=>{var V;const J=z??((V=_[0])==null?void 0:V.id)??"";if(!J)return{id:crypto.randomUUID()};const te=m(J,"unit");return te?{id:te}:(Oe.error("Maximum depth reached"),{id:crypto.randomUUID()})},[m,_]),X=h.useCallback(()=>{var J;const z=(J=_[0])==null?void 0:J.id;z&&(m(z,"unit")||Oe.error("Maximum depth reached"))},[_,m]),se=h.useCallback(()=>{p&&(m(p,"subunit")||Oe.error("Maximum depth reached"))},[p,m]),xe=h.useCallback(async()=>{if(d(!1),!!N)try{const z=await Wf(N),J=await fetch(z).then(Z=>Z.blob()),te=URL.createObjectURL(J),V=document.createElement("a");V.href=te,V.download=`${N}-folders.csv`,V.style.display="none",document.body.appendChild(V),V.click(),document.body.removeChild(V),URL.revokeObjectURL(te)}catch{Oe.error("Failed to download CSV")}},[N]),Ce=h.useCallback(async()=>{if(f(!1),!!N)try{const{rootNode:z}=await Ju(N);E([z]),Oe.success("Course outline refreshed.")}catch{Oe.error("Outline could not be refreshed automatically. Please reload the page.")}},[N,E]);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(z=>!z),"aria-label":"More options",title:"More options","aria-haspopup":"true","aria-expanded":c,children:l.jsx(qc,{size:15})}),c&&l.jsx("div",{className:sr.dropdownMenu,role:"menu",children:M&&l.jsxs(l.Fragment,{children:[l.jsx("button",{role:"menuitem",type:"button",disabled:$,title:$?'Folders already exist — use "Update" instead':void 0,onClick:()=>{d(!1),y("create"),f(!0)},children:"Create folders using csv file"}),l.jsx("button",{role:"menuitem",type:"button",disabled:!$,title:$?void 0:'No folders yet — use "Create" first',onClick:xe,children:"Download folders as csv file"}),l.jsx("button",{role:"menuitem",type:"button",disabled:!$,title:$?void 0:'No folders yet — use "Create" first',onClick:()=>{d(!1),y("update"),f(!0)},children:"Update folder metadata using csv file"})]})})]}),r&&l.jsx("button",{type:"button",className:sr.iconBtn,onClick:r,"aria-label":t?"Expand outline":"Collapse outline",title:t?"Expand outline":"Collapse outline",children:t?l.jsx(kv,{size:15}):l.jsx(Nv,{size:15})})]})}),l.jsx("div",{className:sr.treeWrapper,ref:s,children:l.jsx(N1,{ref:n,data:_,idAccessor:"id",childrenAccessor:"children",onSelect:U,onMove:D?P:void 0,onDelete:D?L:void 0,onCreate:D?j:void 0,disableEdit:!D,disableDrop:!D,selection:p??void 0,rowHeight:40,indent:20,paddingBottom:16,height:o,width:"100%",children:z=>l.jsx(M1,{...z,editorMode:e})})}),D&&l.jsxs("div",{className:sr.footer,children:[l.jsxs(Fe,{variant:"ghost",size:"sm",onClick:X,disabled:!A,children:[l.jsx(ps,{size:14})," Add Unit"]}),l.jsxs(Fe,{variant:"ghost",size:"sm",onClick:se,disabled:!A||!p,children:[l.jsx(zc,{size:14})," Add Sub-unit"]})]}),u&&l.jsx("div",{className:sr.csvModal,children:l.jsx(U1,{contentId:N,mode:g,onComplete:Ce,onClose:()=>f(!1)})})]})};function Za(e,t){for(const r of e){if(r.id===t)return r;if(r.children){const n=Za(r.children,t);if(n)return n}}}const Ds={breadcrumb:"_breadcrumb_zd1aj_1",crumb:"_crumb_zd1aj_10",sep:"_sep_zd1aj_26",current:"_current_zd1aj_31"},q1=({crumbs:e})=>{const t=Ie(r=>r.selectNode);return e.length?l.jsxs("nav",{className:Ds.breadcrumb,"aria-label":"Node path",children:[l.jsx("button",{className:Ds.crumb,onClick:()=>t(e[0].id),"aria-label":"Home",children:l.jsx(Dv,{size:13})}),e.map((r,n)=>l.jsxs(h.Fragment,{children:[l.jsx(Uc,{size:13,className:Ds.sep}),n<e.length-1?l.jsx("button",{className:Ds.crumb,onClick:()=>t(r.id),children:r.name}):l.jsx("span",{className:Ds.current,children:r.name})]},r.id))]}):null},Ts={tabBar:"_tabBar_qhks1_1",tab:"_tab_qhks1_1",active:"_active_qhks1_29",error:"_error_qhks1_35",errorDot:"_errorDot_qhks1_39"},Qf=[{id:"details",label:"Details"},{id:"audience",label:"Audience & Curriculum"},{id:"licensing",label:"Licensing"}],z1=({activeTab:e,onChange:t,errorTabs:r=[],visibleTabs:n})=>{const s=n?Qf.filter(i=>n.includes(i.id)):Qf;return l.jsx("div",{className:Ts.tabBar,role:"tablist","aria-label":"Metadata sections",children:s.map(i=>l.jsxs("button",{role:"tab","aria-selected":e===i.id,"aria-controls":`panel-${i.id}`,className:[Ts.tab,e===i.id?Ts.active:"",r.includes(i.id)?Ts.error:""].join(" "),onClick:()=>t(i.id),children:[i.label,r.includes(i.id)&&l.jsx("span",{className:Ts.errorDot,"aria-label":"Has errors"})]},i.id))})};var Ns=e=>e.type==="checkbox",Zr=e=>e instanceof Date,ut=e=>e==null;const Kf=e=>typeof e=="object";var ze=e=>!ut(e)&&!Array.isArray(e)&&Kf(e)&&!Zr(e),Ja=e=>ze(e)&&e.target?Ns(e.target)?e.target.checked:e.target.value:e,Gf=(e,t)=>t.split(".").some((r,n,s)=>!isNaN(Number(r))&&e.has(s.slice(0,n).join("."))),Rf=e=>{const t=e.constructor&&e.constructor.prototype;return ze(t)&&t.hasOwnProperty("isPrototypeOf")},Yi=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Qe(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(Yi&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!r&&!(ze(e)&&Rf(e)))return e;const n=r?[]:Object.create(Object.getPrototypeOf(e));for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[s]=Qe(e[s]));return n}const kr={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change",SUBMIT:"submit",TRIGGER:"trigger",VALID:"valid"},Yt={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Xt={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},el="form",Yf="root",Xf=["__proto__","constructor","prototype"];var ks=e=>/^\w*$/.test(e),Be=e=>e===void 0,Xi=e=>e.split(/[.[\]'"]/g).filter(Boolean),K=(e,t,r)=>{if(!t||!ze(e))return r;const n=ks(t)?[t]:Xi(t);if(n.some(i=>Xf.includes(i)))return r;const s=n.reduce((i,o)=>ut(i)?void 0:i[o],e);return Be(s)||s===e?Be(e[t])?r:e[t]:s},Mt=e=>typeof e=="boolean",bt=e=>typeof e=="function",$e=(e,t,r)=>{let n=-1;const s=ks(t)?[t]:Xi(t),i=s.length,o=i-1;for(;++n<i;){const a=s[n];let c=r;if(n!==o){const d=e[a];c=ze(d)||Array.isArray(d)?d:isNaN(+s[n+1])?{}:[]}if(Xf.includes(a))return;e[a]=c,e=e[a]}};const tl=h.createContext(null);tl.displayName="HookFormControlContext";const rl=()=>h.useContext(tl);var Zf=(e,t,r,n=!0)=>{const s={};for(const i in e)Object.defineProperty(s,i,{get:()=>{const o=i;return t._proxyFormState[o]!==Yt.all&&(t._proxyFormState[o]=!n||Yt.all),r&&(r[o]=!0),e[o]}});return s};const nl=Yi?h.useLayoutEffect:h.useEffect;function H1(e){const t=rl(),{control:r=t,disabled:n,name:s,exact:i}=e||{},[o,a]=h.useState(()=>({...r._formState,defaultValues:r._defaultValues})),c=h.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return nl(()=>r._subscribe({name:s,formState:c.current,exact:i,callback:d=>{!n&&a({...r._formState,...d,defaultValues:r._defaultValues})}}),[s,n,i]),h.useEffect(()=>{c.current.isValid&&r._setValid(!0)},[r]),h.useMemo(()=>Zf(o,r,c.current,!1),[o,r])}var _t=e=>typeof e=="string",sl=(e,t,r,n,s)=>_t(e)?(n&&t.watch.add(e),K(r,e,s)):Array.isArray(e)?e.map(i=>(n&&t.watch.add(i),K(r,i))):(n&&(t.watchAll=!0),r),il=e=>ut(e)||!Kf(e);const Jf=(e,t)=>t.length===0&&!Array.isArray(e)&&!Rf(e);function Lt(e,t,r=new WeakMap){if(e===t)return!0;if(il(e)||il(t))return Object.is(e,t);if(Zr(e)&&Zr(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(Jf(e,n)||Jf(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(Zr(a)&&Zr(c)||(ze(a)||Array.isArray(a))&&(ze(c)||Array.isArray(c))?!Lt(a,c,r):!Object.is(a,c))return!1}}return!0}function W1(e){const t=rl(),{control:r=t,name:n,defaultValue:s,disabled:i,exact:o,compute:a}=e||{},c=h.useRef(s),d=h.useRef(a),u=h.useRef(void 0),f=h.useRef(r),g=h.useRef(n);d.current=a;const[y,_]=h.useState(()=>{const w=r._getWatch(n,c.current);return d.current?d.current(w):w}),p=h.useCallback(w=>{const E=sl(n,r._names,w||r._formValues,!1,c.current);return d.current?d.current(E):E},[r._formValues,r._names,n]),v=h.useCallback(w=>{if(!i){const E=sl(n,r._names,w||r._formValues,!1,c.current);if(d.current){const D=d.current(E);Lt(D,u.current)||(_(D),u.current=D)}else _(E)}},[r._formValues,r._names,i,n]);nl(()=>((f.current!==r||!Lt(g.current,n))&&(f.current=r,g.current=n,v()),r._subscribe({name:n,formState:{values:!0},exact:o,callback:w=>{v(w.values)}})),[r,o,n,v]),h.useEffect(()=>r._removeUnmounted());const m=f.current!==r,b=g.current,S=h.useMemo(()=>{if(i)return null;const w=!m&&!Lt(b,n);return m||w?p():null},[i,m,n,b,p]);return S!==null?S:y}function Zi(e){const t=rl(),{name:r,disabled:n,control:s=t,shouldUnregister:i,defaultValue:o,exact:a=!0}=e,c=Gf(s._names.array,r),d=h.useMemo(()=>K(s._formValues,r,K(s._defaultValues,r,o)),[s,r,o]),u=W1({control:s,name:r,defaultValue:d,exact:a}),f=H1({control:s,name:r,exact:a}),g=h.useRef(e),y=h.useRef(null),_=h.useRef(s.register(r,{...e.rules,value:u,...Mt(e.disabled)?{disabled:e.disabled}:{}}));g.current=e;const p=h.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!K(f.errors,r)},isDirty:{enumerable:!0,get:()=>!!K(f.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!K(f.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!K(f.validatingFields,r)},error:{enumerable:!0,get:()=>K(f.errors,r)}}),[f,r]),v=h.useCallback(w=>{const E=Ja(w);return K(s._fields,r)||(_.current=s.register(r,{...g.current.rules,value:E})),_.current.onChange({target:{value:Ja(w),name:r},type:kr.CHANGE})},[r,s]),m=h.useCallback(()=>_.current.onBlur({target:{value:K(s._formValues,r),name:r},type:kr.BLUR}),[r,s._formValues]),b=h.useCallback(w=>{w&&(y.current={focus:()=>bt(w.focus)&&w.focus(),select:()=>bt(w.select)&&w.select(),setCustomValidity:D=>bt(w.setCustomValidity)&&w.setCustomValidity(D),reportValidity:()=>bt(w.reportValidity)&&w.reportValidity()});const E=K(s._fields,r);E&&E._f&&w&&(E._f.ref=y.current)},[s._fields,r]),S=h.useMemo(()=>({name:r,value:u,...Mt(n)||f.disabled?{disabled:f.disabled||n}:{},onChange:v,onBlur:m,ref:b}),[r,n,f.disabled,v,m,b,u]);return h.useEffect(()=>{const w=s._options.shouldUnregister||i;s.register(r,{...g.current.rules,...Mt(g.current.disabled)?{disabled:g.current.disabled}:{}});const E=(D,x)=>{const A=K(s._fields,D);A&&A._f&&(A._f.mount=x)};if(E(r,!0),w){const D=Qe(K(i?s._defaultValues:s._options.values||s._defaultValues,r,K(s._options.defaultValues,r,g.current.defaultValue)));$e(s._defaultValues,r,D),Be(K(s._formValues,r))&&$e(s._formValues,r,D)}if(!c&&s.register(r),y.current){const D=K(s._fields,r);D&&D._f&&(D._f.ref=y.current)}return()=>{(c?w&&!s._state.action:w)?s.unregister(r):E(r,!1)}},[r,s,c,i]),h.useEffect(()=>{s._setDisabledField({disabled:n,name:r})},[n,r,s]),h.useMemo(()=>({field:S,formState:f,fieldState:p}),[S,f,p])}const ol=h.createContext(null);ol.displayName="HookFormContext";const Zt=()=>h.useContext(ol),Q1=({children:e,watch:t,getValues:r,getFieldState:n,setError:s,clearErrors:i,setValue:o,setValues:a,trigger:c,formState:d,resetField:u,reset:f,handleSubmit:g,unregister:y,control:_,register:p,setFocus:v,subscribe:m})=>{const b=h.useMemo(()=>({watch:t,getValues:r,getFieldState:n,setError:s,clearErrors:i,setValue:o,setValues:a,trigger:c,formState:d,resetField:u,reset:f,handleSubmit:g,unregister:y,control:_,register:p,setFocus:v,subscribe:m}),[i,_,d,n,r,g,p,f,u,s,v,o,a,m,c,y,t]);return h.createElement(ol.Provider,{value:b},h.createElement(tl.Provider,{value:b.control},e))};var K1=(e,t,r,n,s)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:s||!0}}:{},eh=e=>Array.isArray(e)?e.filter(Boolean):[],Ji=e=>Array.isArray(e)?e:[e],th=()=>{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 rh(e,t){const r={};for(const n in e)if(e.hasOwnProperty(n)){const s=e[n],i=t[n];if(s&&ze(s)&&i){const o=rh(s,i);ze(o)&&(r[n]=o)}else e[n]&&(r[n]=i)}return r}var nt=e=>ze(e)&&!Object.keys(e).length,al=e=>e.type==="file",eo=e=>{if(!Yi)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},nh=e=>e.type==="select-multiple",ll=e=>e.type==="radio",G1=e=>ll(e)||Ns(e),cl=e=>eo(e)&&e.isConnected;function R1(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;){if(ut(e)){e=void 0;break}e=e[t[n]],n++}return e}function Y1(e){for(const t in e)if(e.hasOwnProperty(t)&&!Be(e[t]))return!1;return!0}function Xe(e,t){if(_t(t)&&Object.prototype.hasOwnProperty.call(e,t))return delete e[t],e;const r=Array.isArray(t)?t:ks(t)?[t]:Xi(t),n=r.length===1?e:R1(e,r),s=r.length-1,i=r[s];return n&&delete n[i],s!==0&&(ze(n)&&nt(n)||Array.isArray(n)&&Y1(n))&&Xe(e,r.slice(0,-1)),e}var X1=e=>{for(const t in e)if(bt(e[t]))return!0;return!1};function sh(e){return Array.isArray(e)||ze(e)&&!X1(e)}function ul(e,t={}){for(const r in e){const n=e[r];sh(n)?(t[r]=Array.isArray(n)?[]:{},ul(n,t[r])):Be(n)||(t[r]=!0)}return t}function dl(e){if(e!==!1){if(e===!0)return!0;if(Array.isArray(e)){const t=e.map(r=>dl(r));return t.some(r=>r!==void 0)?t:void 0}if(ze(e)){const t={};for(const r in e){const n=dl(e[r]);Be(n)||(t[r]=n)}return Object.keys(t).length?t:void 0}}}function Jr(e,t,r){r||(r=ul(t));for(const n in e){const s=e[n];if(sh(s))Be(t)||il(r[n])?r[n]=ul(s,Array.isArray(s)?[]:{}):Jr(s,ut(t)?{}:t[n],r[n]);else{const i=t[n];r[n]=!Lt(s,i)}}return dl(r)||{}}const ih={value:!1,isValid:!1},oh={value:!0,isValid:!0};var ah=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Be(e[0].attributes.value)?Be(e[0].value)||e[0].value===""?oh:{value:e[0].value,isValid:!0}:oh:ih}return ih},lh=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>Be(e)?e:t?e===""?NaN:e&&+e:r&&_t(e)?new Date(e):n?n(e):e;const ch={isValid:!1,value:null};var uh=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,ch):ch;function dh(e){const t=e.ref;return al(t)?t.files:ll(t)?uh(e.refs).value:nh(t)?[...t.selectedOptions].map(({value:r})=>r):Ns(t)?ah(e.refs).value:lh(Be(t.value)?e.ref.value:t.value,e)}var Z1=(e,t,r,n)=>{const s={};for(const i of e){const o=K(t,i);o&&$e(s,i,o._f)}return{criteriaMode:r,names:[...e],fields:s,shouldUseNativeValidation:n}},to=e=>e instanceof RegExp,xs=e=>Be(e)?e:to(e)?e.source:ze(e)?to(e.value)?e.value.source:e.value:e,fh=e=>({isOnSubmit:!e||e===Yt.onSubmit,isOnBlur:e===Yt.onBlur,isOnChange:e===Yt.onChange,isOnAll:e===Yt.all,isOnTouch:e===Yt.onTouched});const hh="AsyncFunction";var J1=e=>!!e&&!!e.validate&&!!(bt(e.validate)&&e.validate.constructor.name===hh||ze(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===hh)),eE=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),fl=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(`${n}.`)));const As=(e,t,r,n)=>{for(const s of r||Object.keys(e)){const i=K(e,s);if(i){const{_f:o,...a}=i;if(o){if(o.refs&&o.refs[0]&&t(o.refs[0],s)&&!n)return!0;if(o.ref&&t(o.ref,o.name)&&!n)return!0;if(As(a,t))break}else if(ze(a)&&As(a,t))break}}};function ph(e,t,r){const n=K(e,r);if(n||ks(r))return{error:n,name:r};const s=r.split(".");for(;s.length;){const i=s.join("."),o=K(t,i),a=K(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 tE=(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||Yt.all))},rE=(e,t,r)=>!e||!t||e===t||Ji(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n))),nE=(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,sE=(e,t)=>!eh(K(e,t)).length&&Xe(e,t),gh=(e,t,r)=>{const n=K(e,r),s=Array.isArray(n)?n:[];return $e(s,Yf,t[r]),$e(e,r,s),e};function yh(e,t,r="validate"){if(_t(e)||Array.isArray(e)&&e.every(_t)||Mt(e)&&!e)return{type:r,message:_t(e)?e:"",ref:t}}var Fn=e=>ze(e)&&!to(e)?e:{value:e,message:""},vh=async(e,t,r,n,s,i)=>{const{ref:o,refs:a,required:c,maxLength:d,minLength:u,min:f,max:g,pattern:y,validate:_,name:p,valueAsNumber:v,mount:m}=e._f,b=K(r,p);if(!m||t.has(p))return{};const S=a?a[0]:o,w=U=>{if(s&&S.reportValidity){const P=Mt(U)?"":U||"";a?a.forEach(L=>L.setCustomValidity(P)):S.setCustomValidity(P),S.reportValidity()}},E={},D=ll(o),x=Ns(o),A=D||x,$=(v||al(o))&&Be(o.value)&&Be(b)||eo(o)&&o.value===""||b===""||Array.isArray(b)&&!b.length,N=K1.bind(null,p,n,E),M=(U,P,L,j=Xt.maxLength,X=Xt.minLength)=>{const se=U?P:L;E[p]={type:U?j:X,message:se,ref:o,...N(U?j:X,se)}};if(i?!Array.isArray(b)||!b.length:c&&(!A&&($||ut(b))||Mt(b)&&!b||x&&!ah(a).isValid||D&&!uh(a).isValid)){const{value:U,message:P}=_t(c)?{value:!!c,message:c}:Fn(c);if(U&&(E[p]={type:Xt.required,message:P,ref:S,...N(Xt.required,P)},!n))return w(P),E}if(!$&&(!ut(f)||!ut(g))){let U,P;const L=Fn(g),j=Fn(f);if(!ut(b)&&!isNaN(b)){const X=o.valueAsNumber||b&&+b;ut(L.value)||(U=X>L.value),ut(j.value)||(P=X<j.value)}else{const X=o.valueAsDate||new Date(b),se=be=>new Date(new Date().toDateString()+" "+be),xe=o.type=="time",Ce=o.type=="week";_t(L.value)&&b&&(U=xe?se(b)>se(L.value):Ce?b>L.value:X>new Date(L.value)),_t(j.value)&&b&&(P=xe?se(b)<se(j.value):Ce?b<j.value:X<new Date(j.value))}if((U||P)&&(M(!!U,L.message,j.message,Xt.max,Xt.min),!n))return w(E[p].message),E}if((d||u)&&!$&&(_t(b)||i&&Array.isArray(b))){const U=Fn(d),P=Fn(u),L=!ut(U.value)&&b.length>+U.value,j=!ut(P.value)&&b.length<+P.value;if((L||j)&&(M(L,U.message,P.message),!n))return w(E[p].message),E}if(y&&!$&&_t(b)){const{value:U,message:P}=Fn(y);if(to(U)&&!b.match(U)&&(E[p]={type:Xt.pattern,message:P,ref:o,...N(Xt.pattern,P)},!n))return w(P),E}if(_){if(bt(_)){const U=await _(b,r),P=yh(U,S);if(P&&(E[p]={...P,...N(Xt.validate,P.message)},!n))return w(P.message),E}else if(ze(_)){let U={};for(const P in _){if(!nt(U)&&!n)break;const L=yh(await _[P](b,r),S,P);L&&(U={...L,...N(P,L.message)},w(L.message),n&&(E[p]=U))}if(!nt(U)&&(E[p]={ref:S,...U},!n))return E}}return w(!0),E};const iE={mode:Yt.onSubmit,reValidateMode:Yt.onChange,shouldFocusError:!0},mh={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function oE(e={}){let t={...iE,...e},r={...Qe(mh),isLoading:bt(t.defaultValues),errors:t.errors||{},disabled:t.disabled||!1},n={},s=ze(t.defaultValues)||ze(t.values)?Qe(t.defaultValues||t.values)||{}:{},i=t.shouldUnregister?{}:Qe(s),o={action:!1,mount:!1,watch:!1,keepIsValid:!1},a={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set,registerName:new Set},c,d=0;const u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},f={...u};let g={...f};const y={array:th(),state:th()},_=t.criteriaMode===Yt.all,p=C=>T=>{clearTimeout(d),d=setTimeout(C,T)},v=async C=>{if(!o.keepIsValid&&!t.disabled&&(f.isValid||g.isValid||C)){let T;t.resolver?(T=nt((await N()).errors),m()):T=await P({fields:n,onlyCheckValid:!0,eventType:kr.VALID}),T!==r.isValid&&y.state.next({isValid:T})}},m=(C,T)=>{!t.disabled&&(f.isValidating||f.validatingFields||g.isValidating||g.validatingFields)&&((C||Array.from(a.mount)).forEach(k=>{k&&(T?$e(r.validatingFields,k,T):Xe(r.validatingFields,k))}),y.state.next({validatingFields:r.validatingFields,isValidating:!nt(r.validatingFields)}))},b=()=>{r.dirtyFields=Jr(s,i)},S=(C,T=[],k,B,q=!0,Q=!0)=>{if(B&&k&&!t.disabled){if(o.action=!0,Q&&Array.isArray(K(n,C))){const H=k(K(n,C),B.argA,B.argB);q&&$e(n,C,H)}if(Q&&Array.isArray(K(r.errors,C))){const H=k(K(r.errors,C),B.argA,B.argB);q&&$e(r.errors,C,H),sE(r.errors,C)}if((f.touchedFields||g.touchedFields)&&Q&&Array.isArray(K(r.touchedFields,C))){const H=k(K(r.touchedFields,C),B.argA,B.argB);q&&$e(r.touchedFields,C,H)}(f.dirtyFields||g.dirtyFields)&&b(),y.state.next({name:C,isDirty:j(C,T),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else $e(i,C,T)},w=(C,T)=>{$e(r.errors,C,T),r.errors={...r.errors},y.state.next({errors:r.errors})},E=C=>{r.errors=C,y.state.next({errors:r.errors,isValid:!1})},D=C=>{const T=ks(C)?[C]:Xi(C);let k=i,B=s;for(let q=0;q<T.length-1;q++){const Q=T[q];if(k=ut(k)?k:k[Q],B=ut(B)?B:B[Q],k===null&&B!==null)return!0}return!1},x=(C,T,k,B)=>{const q=K(n,C);if(q){if(D(C))return;const Q=Be(K(i,C)),H=K(i,C,Be(k)?K(s,C):k);Be(H)||B&&B.defaultChecked||T?$e(i,C,T?H:dh(q._f)):xe(C,H),o.mount&&!o.action&&(v(),Q&&r.isDirty&&(f.isDirty||g.isDirty)&&(j()||(r.isDirty=!1,y.state.next({...r}))),e.shouldUnregister&&Q&&!Be(K(i,C))&&fl(C,a)&&(o.watch=!0))}},A=(C,T,k,B,q)=>{let Q=!1,H=!1;const ne={name:C};if(!t.disabled){if(!k||B){(f.isDirty||g.isDirty)&&(H=r.isDirty,r.isDirty=ne.isDirty=j(),Q=H!==ne.isDirty);const ye=Lt(K(s,C),T);H=!!K(r.dirtyFields,C),ye!==r.isDirty?r.dirtyFields=Jr(s,i):ye?Xe(r.dirtyFields,C):$e(r.dirtyFields,C,!0),ne.dirtyFields=r.dirtyFields,Q=Q||(f.dirtyFields||g.dirtyFields)&&H!==!ye}if(k){const ye=K(r.touchedFields,C);ye||($e(r.touchedFields,C,k),ne.touchedFields=r.touchedFields,Q=Q||(f.touchedFields||g.touchedFields)&&ye!==k)}Q&&q&&y.state.next(ne)}return Q?ne:{}},$=(C,T,k,B)=>{const q=K(r.errors,C),Q=(f.isValid||g.isValid)&&Mt(T)&&r.isValid!==T;if(t.delayError&&k?(c=p(()=>w(C,k)),c(t.delayError)):(clearTimeout(d),c=null,k?$e(r.errors,C,k):Xe(r.errors,C),r.errors={...r.errors}),(k?!Lt(q,k):q)||!nt(B)||Q){const H={...B,...Q&&Mt(T)?{isValid:T}:{},errors:r.errors,name:C};r={...r,...H},y.state.next(H)}},N=async C=>(m(C,!0),await t.resolver(i,t.context,Z1(C||a.mount,n,t.criteriaMode,t.shouldUseNativeValidation))),M=async C=>{const{errors:T}=await N(C);if(m(C),C){for(const k of C){const B=K(T,k);B?a.array.has(k)&&ze(B)&&!Object.keys(B).some(q=>!Number.isNaN(Number(q)))?gh(r.errors,{[k]:B},k):$e(r.errors,k,B):Xe(r.errors,k)}r.errors={...r.errors}}else r.errors=T;return T},U=async({name:C,eventType:T})=>{if(e.validate){const k=await e.validate({formValues:i,formState:r,name:C,eventType:T});if(ze(k))for(const B in k){const q=k[B];q&&ge(`${el}.${B}`,{message:_t(q.message)?q.message:"",type:q.type||Xt.validate})}else _t(k)||!k?ge(el,{message:k||"",type:Xt.validate}):ee(el);return k}return!0},P=async({fields:C,onlyCheckValid:T,name:k,eventType:B,context:q={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(q.runRootValidation=!0,!await U({name:k,eventType:B})&&(q.valid=!1,T)))return q.valid;for(const Q in C){const H=C[Q];if(H){const{_f:ne,...ye}=H;if(ne){const We=a.array.has(ne.name),xt=H._f&&J1(H._f),At=f.validatingFields||f.isValidating||g.validatingFields||g.isValidating;xt&&At&&m([ne.name],!0);const br=await vh(H,a.disabled,i,_,t.shouldUseNativeValidation&&!T,We);if(xt&&At&&m([ne.name]),br[ne.name]&&(q.valid=!1,T)||(!T&&(K(br,ne.name)?We?gh(r.errors,br,ne.name):$e(r.errors,ne.name,br[ne.name]):Xe(r.errors,ne.name)),e.shouldUseNativeValidation&&br[ne.name]))break}!nt(ye)&&await P({context:q,onlyCheckValid:T,fields:ye,name:Q,eventType:B})}}return q.valid},L=()=>{for(const C of a.unMount){const T=K(n,C);T&&(T._f.refs?T._f.refs.every(k=>!cl(k)):!cl(T._f.ref))&&Ze(C)}a.unMount=new Set},j=(C,T)=>!t.disabled&&(C&&T&&$e(i,C,T),!Lt(G(),s)),X=(C,T,k)=>sl(C,a,{...o.mount?i:Be(T)?s:_t(C)?{[C]:T}:T},k,T),se=C=>eh(K(o.mount?i:s,C,t.shouldUnregister?K(s,C,[]):[])),xe=(C,T,k={},B=!1)=>{const q=K(n,C);let Q=T;if(q){const H=q._f;H&&(!H.disabled&&$e(i,C,lh(T,H)),Q=eo(H.ref)&&ut(T)?"":T,nh(H.ref)?[...H.ref.options].forEach(ne=>ne.selected=Q.includes(ne.value)):H.refs?Ns(H.ref)?H.refs.forEach(ne=>{(!ne.defaultChecked||!ne.disabled)&&(Array.isArray(Q)?ne.checked=!!Q.find(ye=>ye===ne.value):ne.checked=Q===ne.value||!!Q)}):H.refs.forEach(ne=>ne.checked=ne.value===Q):al(H.ref)?H.ref.value="":(H.ref.value=Q,H.ref.type||y.state.next({name:C,values:B?i:Qe(i)})))}(k.shouldDirty||k.shouldTouch)&&A(C,Q,k.shouldTouch,k.shouldDirty,!0),k.shouldValidate&&Z(C)},Ce=(C,T,k,B=!1)=>{for(const q in T){if(!T.hasOwnProperty(q))return;const Q=T[q],H=C+"."+q,ne=K(n,H);(a.array.has(C)||ze(Q)||ne&&!ne._f)&&!Zr(Q)?Ce(H,Q,k,B):xe(H,Q,k,B)}},be=(C,T,k,B)=>{const q=K(n,C),Q=a.array.has(C),H=B?T:Qe(T),ne=K(i,C),ye=Lt(ne,H);if(ye||$e(i,C,H),Q)y.array.next({name:C,values:B?i:Qe(i)}),(f.isDirty||f.dirtyFields||g.isDirty||g.dirtyFields)&&k.shouldDirty&&(b(),y.state.next({name:C,dirtyFields:r.dirtyFields,isDirty:j(C,H)}));else{const We=Array.isArray(H)&&!H.length||nt(H);!q||q._f||ut(H)||We?xe(C,H,k,B):Ce(C,H,k,B)}if(!ye){const We=fl(C,a),xt=B?i:Qe(i);y.state.next({...We&&r,name:o.mount||We?C:void 0,values:xt})}},z=(C,T,k={})=>be(C,T,k,!1),J=(C,T={})=>{const k=bt(C)?C(i):C;if(!Lt(i,k)){i={...i,...k};for(const B of a.mount)be(B,K(k,B),T,!0);y.state.next({...r,name:void 0,type:void 0,values:i}),T.shouldValidate&&v()}},te=async C=>{o.mount=!0;const T=C.target;let k=T.name,B=!0;const q=K(n,k),Q=ye=>{B=Number.isNaN(ye)||Zr(ye)&&isNaN(ye.getTime())||Lt(ye,K(i,k,ye))},H=fh(t.mode),ne=fh(t.reValidateMode);if(q){let ye,We;const xt=T.type?dh(q._f):Ja(C),At=C.type===kr.BLUR||C.type===kr.FOCUS_OUT,br=!eE(q._f)&&!e.validate&&!t.resolver&&!K(r.errors,k)&&!q._f.deps||nE(At,K(r.touchedFields,k),r.isSubmitted,ne,H),zs=fl(k,a,At);$e(i,k,xt),At?(!T||!T.readOnly)&&(q._f.onBlur&&q._f.onBlur(C),c&&c(0)):q._f.onChange&&q._f.onChange(C);const hn=A(k,xt,At),at=!nt(hn)||zs;if(!At&&y.state.next({name:k,type:C.type,values:Qe(i)}),br)return(f.isValid||g.isValid)&&(t.mode==="onBlur"?At&&v():At||v()),at&&y.state.next({name:k,...zs?{}:hn});if(!t.resolver&&e.validate&&await U({name:k,eventType:C.type}),!At&&zs&&y.state.next({...r}),t.resolver){const{errors:St}=await N([k]);if(m([k]),Q(xt),!B){!nt(hn)&&y.state.next(hn);return}const Ot=ph(r.errors,n,k),tr=ph(St,n,Ot.name||k);ye=tr.error,k=tr.name,We=nt(St)}else m([k],!0),ye=(await vh(q,a.disabled,i,_,t.shouldUseNativeValidation))[k],m([k]),Q(xt),B&&(ye?We=!1:(f.isValid||g.isValid)&&(We=await P({fields:n,onlyCheckValid:!0,name:k,eventType:C.type})));B&&(q._f.deps&&(!Array.isArray(q._f.deps)||q._f.deps.length>0)&&Z(q._f.deps),$(k,We,ye,hn))}},V=(C,T)=>{if(K(r.errors,T)&&C.focus)return C.focus(),1},Z=async(C,T={})=>{let k,B;const q=Ji(C);if(t.resolver){const Q=await M(Be(C)?C:q);k=nt(Q),B=C?!q.some(H=>K(Q,H)):k}else C?(B=(await Promise.all(q.map(async Q=>{const H=K(n,Q);return await P({fields:H&&H._f?{[Q]:H}:H,eventType:kr.TRIGGER})}))).every(Boolean),!(!B&&!r.isValid)&&v()):B=k=await P({fields:n,name:C,eventType:kr.TRIGGER});return y.state.next({...!_t(C)||(f.isValid||g.isValid)&&k!==r.isValid?{}:{name:C},...t.resolver||!C?{isValid:k}:{},errors:r.errors}),T.shouldFocus&&!B&&As(n,V,C?q:a.mount),B},G=(C,T)=>{let k={...o.mount?i:s};return T&&(k=rh(T.dirtyFields?r.dirtyFields:r.touchedFields,k)),Be(C)?k:_t(C)?K(k,C):C.map(B=>K(k,B))},ce=(C,T)=>({invalid:!!K((T||r).errors,C),isDirty:!!K((T||r).dirtyFields,C),error:K((T||r).errors,C),isValidating:!!K(r.validatingFields,C),isTouched:!!K((T||r).touchedFields,C)}),ee=C=>{const T=C?Ji(C):void 0;T==null||T.forEach(k=>Xe(r.errors,k)),T?T.forEach(k=>{y.state.next({name:k,errors:r.errors})}):y.state.next({errors:{}})},ge=(C,T,k)=>{const B=(K(n,C,{_f:{}})._f||{}).ref,q=K(r.errors,C)||{},{ref:Q,message:H,type:ne,...ye}=q;$e(r.errors,C,{...ye,...T,ref:B}),y.state.next({name:C,errors:r.errors,isValid:!1}),k&&k.shouldFocus&&B&&B.focus&&B.focus()},ae=(C,T)=>bt(C)?y.state.subscribe({next:k=>"values"in k&&C(k.values||X(void 0,T),k)}):X(C,T,!0),Re=C=>y.state.subscribe({next:T=>{if(rE(C.name,T.name,C.exact)&&tE(T,C.formState||f,fe,C.reRenderRoot)){const k={...i};C.callback({values:k,...r,...T,defaultValues:s})}}}).unsubscribe,Ee=C=>(o.mount=!0,g={...g,...C.formState},Re({...C,formState:{...u,...C.formState}})),Ze=(C,T={})=>{for(const k of C?Ji(C):a.mount)a.mount.delete(k),a.array.delete(k),T.keepValue||(Xe(n,k),Xe(i,k)),!T.keepError&&Xe(r.errors,k),!T.keepDirty&&Xe(r.dirtyFields,k),!T.keepTouched&&Xe(r.touchedFields,k),!T.keepIsValidating&&Xe(r.validatingFields,k),!t.shouldUnregister&&!T.keepDefaultValue&&Xe(s,k);y.state.next({values:Qe(i)}),y.state.next({...r,...T.keepDirty?{isDirty:j()}:{}}),!T.keepIsValid&&v()},Ye=({disabled:C,name:T})=>{if(Mt(C)&&o.mount||C||a.disabled.has(T)){const q=a.disabled.has(T)!==!!C;C?a.disabled.add(T):a.disabled.delete(T),q&&o.mount&&!o.action&&v()}},qe=(C,T={})=>{let k=K(n,C);const B=Mt(T.disabled)||Mt(t.disabled),q=!a.registerName.has(C)&&k&&k._f&&!k._f.mount;return $e(n,C,{...k||{},_f:{...k&&k._f?k._f:{ref:{name:C}},name:C,mount:!0,...T}}),a.mount.add(C),k&&!q?Ye({disabled:Mt(T.disabled)?T.disabled:t.disabled,name:C}):x(C,!0,T.value),{...B?{disabled:T.disabled||t.disabled}:{},...t.progressive?{required:!!T.required,min:xs(T.min),max:xs(T.max),minLength:xs(T.minLength),maxLength:xs(T.maxLength),pattern:xs(T.pattern)}:{},name:C,onChange:te,onBlur:te,ref:Q=>{if(Q){a.registerName.add(C),qe(C,T),a.registerName.delete(C),k=K(n,C);const H=Be(Q.value)&&Q.querySelectorAll&&Q.querySelectorAll("input,select,textarea")[0]||Q,ne=G1(H),ye=k._f.refs||[];if(ne?ye.find(We=>We===H):H===k._f.ref)return;$e(n,C,{_f:{...k._f,...ne?{refs:[...ye.filter(cl),H,...Array.isArray(K(s,C))?[{}]:[]],ref:{type:H.type,name:C}}:{ref:H}}}),x(C,!1,void 0,H)}else k=K(n,C,{}),k._f&&(k._f.mount=!1),(t.shouldUnregister||T.shouldUnregister)&&!(Gf(a.array,C)&&o.action)&&a.unMount.add(C)}}},re=()=>t.shouldFocusError&&!t.shouldUseNativeValidation&&As(n,V,a.mount),Le=C=>{Mt(C)&&(y.state.next({disabled:C}),As(n,(T,k)=>{const B=K(n,k);B&&(T.disabled=B._f.disabled||C,Array.isArray(B._f.refs)&&B._f.refs.forEach(q=>{q.disabled=B._f.disabled||C}))},0,!1))},Ve=(C,T)=>async k=>{let B;k&&(k.preventDefault&&k.preventDefault(),k.persist&&k.persist());let q=Qe(i);if(y.state.next({isSubmitting:!0}),t.resolver){const{errors:Q,values:H}=await N();m(),r.errors=Q,q=Qe(H)}else await P({fields:n,eventType:kr.SUBMIT});if(a.disabled.size)for(const Q of a.disabled)Xe(q,Q);if(Xe(r.errors,Yf),nt(r.errors)){y.state.next({errors:{}});try{await C(q,k)}catch(Q){B=Q}}else T&&await T({...r.errors},k),re(),setTimeout(re);if(y.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:nt(r.errors)&&!B,submitCount:r.submitCount+1,errors:r.errors}),B)throw B},Je=(C,T={})=>{K(n,C)&&(Be(T.defaultValue)?z(C,Qe(K(s,C))):(z(C,T.defaultValue),$e(s,C,Qe(T.defaultValue))),T.keepTouched||Xe(r.touchedFields,C),T.keepDirty||(Xe(r.dirtyFields,C),r.isDirty=T.defaultValue?j(C,Qe(K(s,C))):j()),T.keepError||(Xe(r.errors,C),f.isValid&&v()),y.state.next({...r}))},ft=(C,T={})=>{const k=C?Qe(C):s,B=Qe(k),q=nt(C),Q=B;if(T.keepDefaultValues||(s=k),!T.keepValues){if(T.keepDirtyValues){const H=new Set([...a.mount,...Object.keys(Jr(s,i))]);for(const ne of Array.from(H)){const ye=K(r.dirtyFields,ne),We=K(i,ne),xt=K(Q,ne);ye&&!Be(We)?$e(Q,ne,We):!ye&&!Be(xt)&&z(ne,xt)}}else{if(Yi&&Be(C))for(const H of a.mount){const ne=K(n,H);if(ne&&ne._f){const ye=Array.isArray(ne._f.refs)?ne._f.refs[0]:ne._f.ref;if(eo(ye)){const We=ye.closest("form");if(We){We.reset();break}}}}if(T.keepFieldsRef)for(const H of a.mount)z(H,K(Q,H));else n={}}if(t.shouldUnregister){if(i=T.keepDefaultValues?Qe(s):{},T.keepFieldsRef)for(const H of a.mount)$e(i,H,K(Q,H))}else i=Qe(Q);y.array.next({values:{...Q}}),y.state.next({values:{...Q}})}a={mount:T.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!f.isValid||!!T.keepIsValid||!!T.keepDirtyValues||!t.shouldUnregister&&!nt(Q),o.watch=!!t.shouldUnregister,o.keepIsValid=!!T.keepIsValid,o.action=!1,T.keepErrors||(r.errors={}),y.state.next({submitCount:T.keepSubmitCount?r.submitCount:0,isDirty:q?!1:T.keepDirty?r.isDirty:T.keepValues?j():!!(T.keepDefaultValues&&!Lt(C,s)),isSubmitted:T.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:q?{}:T.keepDirtyValues?T.keepDefaultValues&&i?Jr(s,i):r.dirtyFields:T.keepDefaultValues&&C?Jr(s,C):T.keepDirty?r.dirtyFields:{},touchedFields:T.keepTouched?r.touchedFields:{},errors:T.keepErrors?r.errors:{},isSubmitSuccessful:T.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:s})},Wt=(C,T)=>ft(bt(C)?C(i):C,{...t.resetOptions,...T}),W=(C,T={})=>{const k=K(n,C),B=k&&k._f;if(B){const q=B.refs?B.refs[0]:B.ref;q.focus&&setTimeout(()=>{q.focus(),T.shouldSelect&&bt(q.select)&&q.select()})}},fe=C=>{r={...r,...C}},mr={control:{register:qe,unregister:Ze,getFieldState:ce,handleSubmit:Ve,setError:ge,_subscribe:Re,_runSchema:N,_updateIsValidating:m,_focusError:re,_getWatch:X,_getDirty:j,_setValid:v,_setFieldArray:S,_setDisabledField:Ye,_setErrors:E,_getFieldArray:se,_reset:ft,_resetDefaultValues:()=>bt(t.defaultValues)&&t.defaultValues().then(C=>{Wt(C,t.resetOptions),y.state.next({isLoading:!1})}),_removeUnmounted:L,_disableForm:Le,_subjects:y,_proxyFormState:f,get _fields(){return n},get _formValues(){return i},get _state(){return o},set _state(C){o=C},get _defaultValues(){return s},get _names(){return a},set _names(C){a=C},get _formState(){return r},get _options(){return t},set _options(C){t={...t,...C}}},subscribe:Ee,trigger:Z,register:qe,handleSubmit:Ve,watch:ae,setValue:z,setValues:J,getValues:G,reset:Wt,resetField:Je,resetDefaultValues:(C,T={})=>{if(s=Qe(C),!T.keepDirty){const k=Jr(s,i);r.dirtyFields=k,r.isDirty=!nt(k)}T.keepIsValid||v(),y.state.next({...r,defaultValues:s})},clearErrors:ee,unregister:Ze,setError:ge,setFocus:W,getFieldState:ce};return{...mr,formControl:mr}}function aE(e={}){const t=h.useRef(void 0),r=h.useRef(void 0),n=h.useRef(e.formControl),[s,i]=h.useState(()=>({...Qe(mh),isLoading:bt(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1,defaultValues:bt(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&&!bt(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:a,...c}=oE(e);t.current={...c,formState:s}}const o=t.current.control;return o._options=e,nl(()=>{const a=o._subscribe({formState:o._proxyFormState,callback:()=>i({...o._formState,defaultValues:o._defaultValues}),reRenderRoot:!0});return i(c=>({...c,isReady:!0})),o._formState.isReady=!0,a},[o]),h.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),h.useEffect(()=>{e.mode&&(o._options.mode=e.mode),e.reValidateMode&&(o._options.reValidateMode=e.reValidateMode)},[o,e.mode,e.reValidateMode]),h.useEffect(()=>{e.errors&&(o._setErrors(e.errors),o._focusError())},[o,e.errors]),h.useEffect(()=>{e.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,e.shouldUnregister]),h.useEffect(()=>{if(o._proxyFormState.isDirty){const a=o._getDirty();a!==s.isDirty&&o._subjects.state.next({isDirty:a})}},[o,s.isDirty]),h.useEffect(()=>{var a;e.values&&!Lt(e.values,r.current)?(o._reset(e.values,{keepFieldsRef:!0,...o._options.resetOptions}),!((a=o._options.resetOptions)===null||a===void 0)&&a.keepIsValid||o._setValid(),r.current=e.values,i(c=>({...c}))):o._resetDefaultValues()},[o,e.values]),h.useEffect(()=>{o._state.mount||(o._setValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),t.current.formState=h.useMemo(()=>Zf(s,o),[o,s]),t.current}async function bh(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 lE(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 _h(e,t){const r=pn({queryKey:["framework",e],queryFn:()=>bh(e),enabled:!!e,staleTime:3e5}),n=t==null?void 0:t[0],s=pn({queryKey:["framework",n],queryFn:()=>bh(n),enabled:!!n,staleTime:5*60*1e3}),i=s.data?[s.data]:[];return{organisationFramework:r.data,targetFrameworks:i,isLoading:r.isLoading||s.isLoading}}function cE(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}=pn({queryKey:["framework-search",i.sort().join(","),r],queryFn:()=>lE({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 uE(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 dE(e){var r,n,s,i,o,a;const t=pn({queryKey:["channel",e],queryFn:()=>uE(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 fE(e){const{data:t}=pn({queryKey:["user","read",e],enabled:!!e,staleTime:1/0,queryFn:()=>Jb(e)});return t&&([t.firstName,t.lastName].filter(Boolean).join(" ").trim()||t.userName)||void 0}const hE={"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."}},pE=new Set(["review","read","sourcingreview","orgreview"]),ro={"First Section":"details","Second Section":"details","Third Section":"details","Organisation Framework Terms":"details","Target Framework Terms":"audience","Fourth Section":"licensing","Sixth Section":"licensing"},gE={Categorisation:"Second Section","Basic Information":"First Section","Licensing & Attribution":"Fourth Section",Curriculum:"Organisation Framework Terms","Target Audience":"Target Framework Terms"},yE={name:"details",description:"details",keywords:"details",appIcon:"details",primaryCategory:"details",additionalCategories:"details",board:"details",boardIds:"details",subject:"details",subjectIds:"details",medium:"details",framework:"details",topicsIds:"details",topic:"details",dialcodeRequired:"details",dialcodes:"details",audience:"audience",targetBoardIds:"audience",targetMediumIds:"audience",targetGradeLevelIds:"audience",targetSubjectIds:"audience",gradeLevel:"audience",creator:"licensing",author:"licensing",attributions:"licensing",license:"licensing",copyright:"licensing",copyrightYear:"licensing"},hl={board:"board",boardIds:"board",medium:"medium",gradeLevel:"gradeLevel",subject:"subject",subjectIds:"subject",topicsIds:"topic",topic:"topic",targetBoardIds:"board",targetMediumIds:"medium",targetGradeLevelIds:"gradeLevel",targetSubjectIds:"subject"},wh=new Set(["targetBoardIds","targetMediumIds","targetGradeLevelIds","targetSubjectIds"]);function Sh(e,t,r,n,s={}){if(!(e!=null&&e.length))return kE(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=CE(a),u=EE(a,r,t,i,s),f=t[c],g=mE(c,Ch(f,d),d,t,s),y={code:c,label:a.label??c,inputType:d,required:!!(a.required===!0||Array.isArray(a.validations)&&a.validations.some(_=>_.type==="required")),editable:vE(c,a.editable!==!1,s),placeholder:a.placeholder,maxLength:a.maxLength,options:wE(u,g,d,r),depends:a.depends,tab:SE(a),section:a.section,defaultValue:a.defaultValue??a.default,currentValue:g};if(c==="dialcodes"){const _=t.dialcodeRequired==="Yes";return{...y,required:_,visible:_}}return y})}function vE(e,t,r){var i;const n=r.editorMode??"edit";if(!pE.has(n))return t!==!1;const s=(i=r.editableFields)==null?void 0:i[n];return!!(s&&s.includes(e))}function mE(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!==""?bE(Number(a)):t}default:return t}}function bE(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 _E(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 wE(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=_E(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 SE(e){const t=e.section;if(t){if(ro[t])return ro[t];const n=gE[t];if(n&&ro[n])return ro[n]}const r=e.code??"";return yE[r]??"details"}function Ch(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 CE(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 EE(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?TE(f).map(g=>({label:g,value:g})):void 0}const c=e.sourceCategory??hl[i];if(c)return Eh(i,c,e,t,r,n)}function OE(e,t){return wh.has(e)||t.output==="identifier"||typeof t.section=="string"&&t.section.includes("Target")}function IE(e,t){return wh.has(e)||typeof t.section=="string"&&t.section.includes("Target")}function pl(e,t,r){var i,o,a,c,d;const n=(o=(i=e.organisationFramework)==null?void 0:i.categories)==null?void 0:o.find(u=>u.code===t),s=(d=(c=(a=e.targetFrameworks)==null?void 0:a[0])==null?void 0:c.categories)==null?void 0:d.find(u=>u.code===t);return r?(s==null?void 0:s.terms)??(n==null?void 0:n.terms)??[]:(n==null?void 0:n.terms)??(s==null?void 0:s.terms)??[]}function DE(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 TE(e){return Array.from(new Set(e))}function NE(e){return Array.isArray(e)?e:e!=null&&e!==""?[e]:[]}function Eh(e,t,r,n,s,i){const o=OE(e,r),a=IE(e,r),c=p=>({label:p.name,value:o?p.identifier:p.name}),d=r.depends;if(!(d!=null&&d.length))return pl(n,t,a).map(c);const u=d.flatMap(p=>NE(s[p])).map(String);if(!u.length)return[];const f=[];for(const p of d){const v=i.get(p),m=(v==null?void 0:v.sourceCategory)??hl[p]??p;f.push(...pl(n,m,a))}const y=f.filter(p=>u.includes(String(p.name))||u.includes(String(p.identifier))||u.includes(String(p.code))).flatMap(p=>p.associations??[]).filter(p=>String(p.category??"").toLowerCase()===t.toLowerCase()),_=DE(y);return _.length?_.map(c):pl(n,t,a).map(c)}function Ps(e,t){const r=hl[e];if(r)return Eh(e,r,{},t,{},new Map)}function dt(e,t,r){return Ch(e[t],r)}function kE(e,t,r){var s;const n=[{code:"name",label:"Title",inputType:"text",required:!0,editable:!0,tab:"details",section:"First Section",maxLength:200,currentValue:dt(e,"name","text")},{code:"description",label:"Description",inputType:"textarea",editable:!0,tab:"details",section:"First Section",maxLength:2e3,currentValue:dt(e,"description","textarea")},{code:"keywords",label:"Keywords",inputType:"chips",editable:!0,tab:"details",section:"First Section",currentValue:dt(e,"keywords","chips")}];return t&&(n.push({code:"primaryCategory",label:"Category",inputType:"select",editable:!1,tab:"details",section:"Second Section",currentValue:dt(e,"primaryCategory","select")},{code:"additionalCategories",label:"Additional Category",inputType:"multiselect",editable:!0,tab:"details",section:"Second Section",currentValue:dt(e,"additionalCategories","multiselect"),options:(s=r.channelAdditionalCategories)==null?void 0:s.map(i=>({label:i,value:i}))},{code:"framework",label:"Course Type",inputType:"select",required:!0,editable:!0,tab:"details",section:"Organisation Framework Terms",options:r.orgFrameworks,currentValue:dt(e,"framework","select")},{code:"subjectIds",label:"Subjects covered",inputType:"multiselect",required:!0,editable:!0,tab:"details",section:"Organisation Framework Terms",options:Ps("subjectIds",r),currentValue:dt(e,"subjectIds","multiselect")}),n.push({code:"audience",label:"Audience Type",inputType:"multiselect",editable:!0,tab:"audience",section:"Target Framework Terms",currentValue:dt(e,"audience","multiselect")},{code:"targetBoardIds",label:"Board/Syllabus of the audience",inputType:"select",required:!0,editable:!0,tab:"audience",section:"Target Framework Terms",options:Ps("targetBoardIds",r),currentValue:dt(e,"targetBoardIds","select")},{code:"targetMediumIds",label:"Medium(s) of the audience",inputType:"multiselect",required:!0,editable:!0,tab:"audience",section:"Target Framework Terms",depends:["targetBoardIds"],options:Ps("targetMediumIds",r),currentValue:dt(e,"targetMediumIds","multiselect")},{code:"targetGradeLevelIds",label:"Class(es) of the audience",inputType:"multiselect",required:!0,editable:!0,tab:"audience",section:"Target Framework Terms",depends:["targetMediumIds"],options:Ps("targetGradeLevelIds",r),currentValue:dt(e,"targetGradeLevelIds","multiselect")},{code:"targetSubjectIds",label:"Subject(s) of the audience",inputType:"multiselect",required:!0,editable:!0,tab:"audience",section:"Target Framework Terms",depends:["targetGradeLevelIds"],options:Ps("targetSubjectIds",r),currentValue:dt(e,"targetSubjectIds","multiselect")}),n.push({code:"creator",label:"Author",inputType:"text",editable:!0,tab:"licensing",section:"Fourth Section",currentValue:dt(e,"creator","text")},{code:"attributions",label:"Attributions",inputType:"text",editable:!0,tab:"licensing",section:"Fourth Section",currentValue:dt(e,"attributions","text")},{code:"copyright",label:"Copyright",inputType:"text",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",currentValue:dt(e,"copyright","text")},{code:"copyrightYear",label:"Copyright Year",inputType:"text",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",currentValue:dt(e,"copyrightYear","text")},{code:"license",label:"License",inputType:"select",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",currentValue:dt(e,"license","select")})),n}const xE=["allowECM","levels","setPeriod","instances"];function Oh(e){const t={};return e.forEach((r,n)=>{t[`L${n+1}`]={label:r}}),t}function AE(e,t={}){const r={...e};for(const i of xE)delete r[i];const n=e.levels;Array.isArray(n)&&n.length&&(r.outcomeDeclaration={levels:Oh(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 PE(e,t){return e==="allowECM"||e==="setPeriod"?null:e==="levels"?{outcomeDeclaration:{levels:Array.isArray(t)?Oh(t):{}}}:e==="instances"?{instances:t!=null&&t!==""?{label:t}:""}:{[e]:t}}function ME(e,t){const{watch:r,setValue:n}=e,s=h.useRef(!1);h.useEffect(()=>{const i=r((o,{name:a})=>{var c;if(!(!a||s.current)){s.current=!0;try{const d=new Set([a]);let u=!0;for(;u;){u=!1;for(const f of t)d.has(f.code)||(c=f.depends)!=null&&c.some(g=>d.has(g))&&(n(f.code,f.inputType==="multiselect"||f.inputType==="chips"?[]:"",{shouldDirty:!0}),d.add(f.code),u=!0)}}finally{s.current=!1}}});return()=>i.unsubscribe()},[r,n,t])}const $n={section:"_section_ylgu8_1",header:"_header_ylgu8_11",title:"_title_ylgu8_17",description:"_description_ylgu8_24",divider:"_divider_ylgu8_30",fields:"_fields_ylgu8_36"},LE=({title:e,description:t,children:r})=>l.jsxs("div",{className:$n.section,children:[l.jsxs("div",{className:$n.header,children:[l.jsx("h3",{className:$n.title,children:e}),t&&l.jsx("p",{className:$n.description,children:t})]}),l.jsx("hr",{className:$n.divider}),l.jsx("div",{className:$n.fields,children:r})]}),F={field:"_field_1s288_1",fullWidth:"_fullWidth_1s288_7",label:"_label_1s288_11",required:"_required_1s288_19",input:"_input_1s288_24",textarea:"_textarea_1s288_45",inputError:"_inputError_1s288_50",error:"_error_1s288_54",selectBtn:"_selectBtn_1s288_59",selectOpen:"_selectOpen_1s288_83",placeholder:"_placeholder_1s288_87",selectedVal:"_selectedVal_1s288_91",chevronUp:"_chevronUp_1s288_95",dropdown:"_dropdown_1s288_100",option:"_option_1s288_116",optionSelected:"_optionSelected_1s288_134",noOpts:"_noOpts_1s288_139",chipGroup:"_chipGroup_1s288_146",chipInput:"_chipInput_1s288_158",addChipBtn:"_addChipBtn_1s288_167",radioGroup:"_radioGroup_1s288_184",radioLabel:"_radioLabel_1s288_191",iconWrap:"_iconWrap_1s288_199",iconPreview:"_iconPreview_1s288_214",iconPlaceholder:"_iconPlaceholder_1s288_220",removeIconBtn:"_removeIconBtn_1s288_233",tagChip:"_tagChip_1s288_252",tagChipRemove:"_tagChipRemove_1s288_264",nestedSelectRow:"_nestedSelectRow_1s288_278",dialcodeRow:"_dialcodeRow_1s288_287",validateBtn:"_validateBtn_1s288_293",dialcodeValid:"_dialcodeValid_1s288_315",dialcodeSpinner:"_dialcodeSpinner_1s288_325"},Ih=({name:e,label:t,required:r,disabled:n,multiline:s,maxLength:i,placeholder:o})=>{const{register:a,formState:{errors:c}}=Zt(),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:[F.field,s?F.fullWidth:""].join(" "),children:[l.jsxs("label",{className:F.label,htmlFor:e,children:[t,r&&l.jsx("span",{className:F.required,children:"*"})]}),s?l.jsx("textarea",{id:e,className:[F.input,F.textarea,d?F.inputError:""].join(" "),disabled:n,placeholder:o,rows:3,...a(e,u)}):l.jsx("input",{id:e,type:"text",className:[F.input,d?F.inputError:""].join(" "),disabled:n,placeholder:o,...a(e,u)}),d&&l.jsx("span",{className:F.error,children:String(d.message)})]})},FE=({name:e,label:t,options:r,required:n,disabled:s})=>{var p;const[i,o]=h.useState(!1),a=h.useRef(null),{register:c,watch:d,setValue:u,formState:{errors:f}}=Zt(),g=d(e),y=((p=r.find(v=>v.value===g))==null?void 0:p.label)??"Select…",_=f[e];return h.useEffect(()=>{if(!i)return;const v=m=>{var b;(b=a.current)!=null&&b.contains(m.target)||o(!1)};return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[i]),l.jsxs("div",{className:F.field,ref:a,style:{position:"relative"},children:[l.jsxs("label",{className:F.label,children:[t,n&&l.jsx("span",{className:F.required,children:"*"})]}),l.jsx("input",{type:"hidden",...c(e,{required:n?`${t} is required`:!1})}),l.jsxs("button",{type:"button",disabled:s,className:[F.selectBtn,_?F.inputError:"",i?F.selectOpen:""].join(" "),onClick:()=>o(v=>!v),children:[l.jsx("span",{className:g?F.selectedVal:F.placeholder,children:y}),l.jsx(hs,{size:14,className:i?F.chevronUp:""})]}),i&&l.jsxs("div",{className:F.dropdown,children:[r.map(v=>l.jsxs("button",{type:"button",className:[F.option,g===v.value?F.optionSelected:""].join(" "),onClick:()=>{u(e,v.value,{shouldDirty:!0,shouldValidate:!0}),o(!1)},children:[l.jsx("span",{children:v.label}),g===v.value&&l.jsx(bn,{size:13})]},v.value)),!r.length&&l.jsx("span",{className:F.noOpts,children:"No options"})]}),_&&l.jsx("span",{className:F.error,children:String(_.message)})]})},$E=({name:e,label:t,options:r,required:n,disabled:s})=>{const[i,o]=h.useState(!1),a=h.useRef(null),{register:c,watch:d,setValue:u,formState:{errors:f}}=Zt(),g=d(e)??[],y=f[e],_=g.length?`${g.length} selected`:"Select…";h.useEffect(()=>{if(!i)return;const v=m=>{var b;(b=a.current)!=null&&b.contains(m.target)||o(!1)};return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[i]);const p=v=>{const m=g.includes(v)?g.filter(b=>b!==v):[...g,v];u(e,m,{shouldDirty:!0,shouldValidate:!0})};return l.jsxs("div",{className:F.field,ref:a,style:{position:"relative"},children:[l.jsxs("label",{className:F.label,children:[t,n&&l.jsx("span",{className:F.required,children:"*"})]}),l.jsx("input",{type:"hidden",...c(e,{required:n?`${t} is required`:!1})}),l.jsxs("button",{type:"button",disabled:s,className:[F.selectBtn,y?F.inputError:"",i?F.selectOpen:""].join(" "),onClick:()=>o(v=>!v),children:[l.jsx("span",{className:g.length?F.selectedVal:F.placeholder,children:_}),l.jsx(hs,{size:14,className:i?F.chevronUp:""})]}),i&&l.jsxs("div",{className:F.dropdown,children:[r.map(v=>l.jsxs("button",{type:"button",className:[F.option,g.includes(v.value)?F.optionSelected:""].join(" "),onClick:()=>p(v.value),children:[l.jsx(bn,{size:13,style:{opacity:g.includes(v.value)?1:0}}),l.jsx("span",{children:v.label})]},v.value)),!r.length&&l.jsx("span",{className:F.noOpts,children:"No options"})]}),y&&l.jsx("span",{className:F.error,children:String(y.message)})]})},jE=({name:e,label:t,required:r,disabled:n,placeholder:s="Add…"})=>{const[i,o]=h.useState(""),[a,c]=h.useState(!1),d=h.useRef(null),{watch:u,setValue:f,formState:{errors:g}}=Zt(),y=u(e)??[],_=g[e],p=()=>{const m=i.trim();m&&!y.includes(m)&&f(e,[...y,m],{shouldDirty:!0}),o(""),c(!1)},v=m=>f(e,y.filter(b=>b!==m),{shouldDirty:!0});return l.jsxs("div",{className:[F.field,F.fullWidth].join(" "),children:[l.jsxs("label",{className:F.label,children:[t,r&&l.jsx("span",{className:F.required,children:"*"})]}),l.jsxs("div",{className:F.chipGroup,children:[y.map(m=>l.jsxs("span",{className:"sbx-chip filled",children:[m,!n&&l.jsx("button",{type:"button",className:"sbx-chip-remove",onClick:()=>v(m),"aria-label":`Remove ${m}`,children:"×"})]},m)),!n&&(a?l.jsx("input",{ref:d,autoFocus:!0,className:F.chipInput,value:i,onChange:m=>o(m.target.value),onKeyDown:m=>{m.key==="Enter"&&(m.preventDefault(),p()),m.key==="Escape"&&(o(""),c(!1))},onBlur:p,placeholder:s}):l.jsxs("button",{type:"button",className:F.addChipBtn,onClick:()=>{c(!0),setTimeout(()=>{var m;return(m=d.current)==null?void 0:m.focus()},50)},children:[l.jsx(ps,{size:12})," Add"]}))]}),_&&l.jsx("span",{className:F.error,children:String(_.message)})]})},BE=({name:e,label:t,options:r,required:n,disabled:s})=>{const{register:i,formState:{errors:o}}=Zt(),a=o[e];return l.jsxs("div",{className:F.field,children:[l.jsxs("label",{className:F.label,children:[t,n&&l.jsx("span",{className:F.required,children:"*"})]}),l.jsx("div",{className:F.radioGroup,children:r.map(c=>l.jsxs("label",{className:F.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:F.error,children:String(a.message)})]})};async function UE(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 VE(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 qE(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 zE(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 he={overlay:"_overlay_ga6eh_1",modal:"_modal_ga6eh_12",header:"_header_ga6eh_24",title:"_title_ga6eh_33",closeBtn:"_closeBtn_ga6eh_39",tabs:"_tabs_ga6eh_57",tab:"_tab_ga6eh_57",activeTab:"_activeTab_ga6eh_83",body:"_body_ga6eh_88",searchWrap:"_searchWrap_ga6eh_99",searchIcon:"_searchIcon_ga6eh_104",searchInput:"_searchInput_ga6eh_113",grid:"_grid_ga6eh_132",imgCell:"_imgCell_ga6eh_148",imgCellSelected:"_imgCellSelected_ga6eh_166",thumb:"_thumb_ga6eh_171",noThumb:"_noThumb_ga6eh_177",checkBadge:"_checkBadge_ga6eh_183",loadMoreBtn:"_loadMoreBtn_ga6eh_198",loadingRow:"_loadingRow_ga6eh_220",empty:"_empty_ga6eh_230",spinner:"_spinner_ga6eh_237",uploadArea:"_uploadArea_ga6eh_247",dropZone:"_dropZone_ga6eh_256",uploadIcon:"_uploadIcon_ga6eh_277",dropText:"_dropText_ga6eh_281",dropSubtext:"_dropSubtext_ga6eh_288",uploadPreview:"_uploadPreview_ga6eh_294",hiddenInput:"_hiddenInput_ga6eh_301",fileName:"_fileName_ga6eh_305",errorText:"_errorText_ga6eh_311",footer:"_footer_ga6eh_318",cancelBtn:"_cancelBtn_ga6eh_328",confirmBtn:"_confirmBtn_ga6eh_345"},Dh=18,Th=({nodeId:e,currentValue:t,onSelect:r,onClose:n})=>{const[s,i]=h.useState("my"),[o,a]=h.useState(""),[c,d]=h.useState([]),[u,f]=h.useState(0),[g,y]=h.useState(!1),[_,p]=h.useState(null),[v,m]=h.useState(0),[b,S]=h.useState(null),[w,E]=h.useState(""),[D,x]=h.useState(!1),[A,$]=h.useState(""),N=h.useRef(null),M=oe(V=>{var Z,G;return((G=(Z=V.editorConfig)==null?void 0:Z.context)==null?void 0:G.channel)??""}),U=oe(V=>{var Z,G;return((G=(Z=V.editorConfig)==null?void 0:Z.context)==null?void 0:G.uid)??""}),P=oe(V=>{var Z,G,ce;return((ce=(G=(Z=V.editorConfig)==null?void 0:Z.context)==null?void 0:G.cloudStorage)==null?void 0:ce.presigned_headers)??{}}),L=oe(V=>{var Z,G,ce;return((ce=(G=(Z=V.editorConfig)==null?void 0:Z.config)==null?void 0:G.assetConfig)==null?void 0:ce.size)??1*1024*1024}),j=oe(V=>{var Z,G,ce;return((ce=(G=(Z=V.editorConfig)==null?void 0:Z.config)==null?void 0:G.assetConfig)==null?void 0:ce.accepted)??"image/png,image/jpeg"}),X=h.useCallback(async(V,Z,G=!1)=>{var ce;y(!0);try{const ee={status:["Live"],mediaType:["image"],mimeType:["image/png","image/jpeg","image/jpg","image/gif","image/svg+xml"]};s==="my"&&U&&(ee.createdBy=U),M&&(ee.channel=M);const ae=((ce=(await Ne.post("/action/composite/v3/search",{request:{filters:ee,query:V,limit:Dh,offset:Z,sort_by:{createdOn:"desc"},fields:["identifier","name","appIcon","artifactUrl","downloadUrl"]}},{headers:{"X-Source":"web"}})).data)==null?void 0:ce.result)??{},Re=ae.content??[];f(ae.count??0),d(Ee=>G?[...Ee,...Re]:Re)}catch{}finally{y(!1)}},[s,U,M]);h.useEffect(()=>{s!=="upload"&&(d([]),m(0),X(o,0))},[s]);const se=h.useRef(),xe=V=>{a(V),clearTimeout(se.current),se.current=setTimeout(()=>{d([]),m(0),X(V,0)},400)},Ce=()=>{const V=v+Dh;m(V),X(o,V,!0)},be=()=>{const V=(_==null?void 0:_.artifactUrl)??(_==null?void 0:_.appIcon)??(_==null?void 0:_.downloadUrl)??"";V&&r(V)};h.useEffect(()=>()=>{w&&URL.revokeObjectURL(w)},[w]);const z=V=>{var ce;const Z=(ce=V.target.files)==null?void 0:ce[0];if(V.target.value="",!Z)return;const G=j.split(",").map(ee=>ee.trim());if(!G.includes(Z.type)){const ee=G.map(ge=>ge.replace("image/","").toUpperCase()).join(", ");$(`Only ${ee} files are accepted.`);return}if(Z.size>L){const ee=(L/1048576).toFixed(0);$(`Image must be under ${ee} MB.`);return}w&&URL.revokeObjectURL(w),S(Z),E(URL.createObjectURL(Z)),$("")},J=async()=>{if(b){x(!0),$("");try{const V=await UE(b.name.split(".").slice(0,-1).join(".")||b.name,b.type,U,M),Z=await VE(V,b.name);await qE(Z,b,P);const G=Z.split("?")[0],ce=await zE(V,G,b.type);r(ce)}catch(V){$(V instanceof Error?V.message:"Upload failed.")}finally{x(!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(zr,{size:18})})]}),l.jsxs("div",{className:he.tabs,role:"tablist",children:[l.jsx("button",{role:"tab","aria-selected":s==="my",className:`${he.tab} ${s==="my"?he.activeTab:""}`,onClick:()=>i("my"),children:"My Images"}),l.jsx("button",{role:"tab","aria-selected":s==="all",className:`${he.tab} ${s==="all"?he.activeTab:""}`,onClick:()=>i("all"),children:"All Images"}),l.jsxs("button",{role:"tab","aria-selected":s==="upload",className:`${he.tab} ${s==="upload"?he.activeTab:""}`,onClick:()=>i("upload"),children:[l.jsx(Gc,{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(Ko,{size:14,className:he.searchIcon}),l.jsx("input",{type:"search",className:he.searchInput,placeholder:"Search images…",value:o,onChange:V=>xe(V.target.value)})]}),g&&c.length===0?l.jsxs("div",{className:he.loadingRow,children:[l.jsx(yi,{size:20,className:he.spinner}),l.jsx("span",{children:"Loading…"})]}):c.length===0?l.jsx("div",{className:he.empty,children:"No images found"}):l.jsx("div",{className:he.grid,children:c.map(V=>{const Z=V.appIcon??V.artifactUrl??V.downloadUrl??"",G=(_==null?void 0:_.identifier)===V.identifier;return l.jsxs("button",{type:"button",className:`${he.imgCell} ${G?he.imgCellSelected:""}`,onClick:()=>p(V),title:V.name,children:[Z?l.jsx("img",{src:Z,alt:V.name,className:he.thumb}):l.jsx("div",{className:he.noThumb,children:"IMG"}),G&&l.jsx("div",{className:he.checkBadge,children:l.jsx(bn,{size:12})})]},V.identifier)})}),te&&!g&&l.jsx("button",{className:he.loadMoreBtn,onClick:Ce,children:"Load More"}),g&&c.length>0&&l.jsx("div",{className:he.loadingRow,children:l.jsx(yi,{size:16,className:he.spinner})})]}):l.jsxs("div",{className:he.uploadArea,children:[l.jsx("div",{className:he.dropZone,onClick:()=>{var V;return(V=N.current)==null?void 0:V.click()},onDragOver:V=>V.preventDefault(),onDrop:V=>{V.preventDefault();const Z=V.dataTransfer.files[0];Z&&z({target:{files:[Z],value:""}})},children:w?l.jsx("img",{src:w,alt:"Preview",className:he.uploadPreview}):l.jsxs(l.Fragment,{children:[l.jsx(Gc,{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:[j.split(",").map(V=>V.replace("image/","").toUpperCase()).join(", ")," · max ",(L/(1024*1024)).toFixed(0)," MB"]})]})}),l.jsx("input",{ref:N,type:"file",accept:j,className:he.hiddenInput,onChange:z}),b&&l.jsx("p",{className:he.fileName,children:b.name}),A&&l.jsx("p",{className:he.errorText,children:A})]})}),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(yi,{size:14,className:he.spinner})," Uploading…"]}):"Upload & Use"}):l.jsx("button",{className:he.confirmBtn,disabled:!_,onClick:be,children:"Use Selected"})]})]})})},HE=({name:e,label:t,nodeId:r,required:n,disabled:s})=>{const[i,o]=h.useState(!1),{watch:a,setValue:c,register:d,formState:{errors:u}}=Zt(),f=a(e),g=u[e],y=p=>{c(e,p,{shouldDirty:!0,shouldValidate:!0}),o(!1)},_=()=>{c(e,"",{shouldDirty:!0,shouldValidate:!0})};return l.jsxs("div",{className:F.field,children:[l.jsxs("label",{className:F.label,children:[t,n&&l.jsx("span",{className:F.required,children:"*"})]}),l.jsx("input",{type:"hidden",...d(e,{required:n?`${t} is required`:!1})}),l.jsx("div",{className:F.iconWrap,role:"button",tabIndex:s?-1:0,"aria-label":"Select app icon",onClick:()=>!s&&o(!0),onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&!s&&o(!0)},children:f?l.jsx("img",{src:f,alt:"App icon",className:F.iconPreview}):l.jsxs("div",{className:F.iconPlaceholder,children:[l.jsx(Wc,{size:20}),l.jsx("span",{children:"Select icon"})]})}),f&&!s&&l.jsxs("button",{type:"button",className:F.removeIconBtn,onClick:_,"aria-label":"Remove app icon",children:[l.jsx(Go,{size:13}),l.jsx("span",{children:"Remove"})]}),g&&l.jsx("span",{className:F.error,children:String(g.message)}),i&&l.jsx(Th,{nodeId:r,currentValue:f,onSelect:y,onClose:()=>o(!1)})]})},WE=({name:e,label:t,required:r,disabled:n})=>{const{control:s}=Zt(),{field:i,fieldState:{error:o}}=Zi({name:e,control:s,rules:{required:r?`${t} is required`:!1}});return l.jsxs("div",{className:F.field,children:[l.jsxs("label",{className:F.label,htmlFor:e,children:[t,r&&l.jsx("span",{className:F.required,children:"*"})]}),l.jsx("input",{id:e,type:"datetime-local",className:[F.input,o?F.inputError:""].join(" "),disabled:n,value:i.value??"",onChange:i.onChange,onBlur:i.onBlur,ref:i.ref}),o&&l.jsx("span",{className:F.error,children:String(o.message)})]})},QE=({name:e,label:t,required:r,disabled:n})=>{const{control:s}=Zt(),{field:i,fieldState:{error:o}}=Zi({name:e,control:s,rules:{required:r?`${t} is required`:!1},defaultValue:[]}),[a,c]=h.useState(""),d=h.useRef(null),u=i.value??[],f=p=>{const v=p.trim();!v||u.includes(v)||i.onChange([...u,v])},g=p=>{i.onChange(u.filter(v=>v!==p))},y=p=>{p.key==="Enter"||p.key===","?(p.preventDefault(),f(a),c("")):p.key==="Backspace"&&a===""&&u.length>0&&g(u[u.length-1])},_=()=>{a.trim()&&(f(a),c("")),i.onBlur()};return l.jsxs("div",{className:[F.field,F.fullWidth].join(" "),children:[l.jsxs("label",{className:F.label,children:[t,r&&l.jsx("span",{className:F.required,children:"*"})]}),l.jsxs("div",{className:[F.chipGroup,o?F.inputError:""].join(" "),onClick:()=>{var p;return!n&&((p=d.current)==null?void 0:p.focus())},style:{cursor:n?"not-allowed":"text"},children:[u.map(p=>l.jsxs("span",{className:F.tagChip,children:[p,!n&&l.jsx("button",{type:"button",className:F.tagChipRemove,onClick:v=>{v.stopPropagation(),g(p)},"aria-label":`Remove ${p}`,children:l.jsx(zr,{size:11})})]},p)),!n&&l.jsx("input",{ref:d,className:F.chipInput,value:a,onChange:p=>c(p.target.value),onKeyDown:y,onBlur:_,placeholder:u.length===0?"Type and press Enter or comma…":"",style:{flexGrow:1,minWidth:120}})]}),o&&l.jsx("span",{className:F.error,children:String(o.message)})]})},KE=({name:e,label:t,levels:r,required:n,disabled:s})=>{const{control:i}=Zt(),{field:o,fieldState:{error:a}}=Zi({name:e,control:i,rules:{required:n?`${t} is required`:!1},defaultValue:{}}),c=o.value??{},d=(u,f,g)=>{const y={};for(let _=0;_<f;_++)y[r[_].code]=c[r[_].code]??"";y[u]=g;for(let _=f+1;_<r.length;_++)y[r[_].code]="";o.onChange(y)};return l.jsxs("div",{className:[F.field,F.fullWidth].join(" "),children:[l.jsxs("label",{className:F.label,children:[t,n&&l.jsx("span",{className:F.required,children:"*"})]}),l.jsx("div",{className:F.nestedSelectRow,children:r.map((u,f)=>{const g=f>0&&!c[r[f-1].code];return l.jsxs("div",{className:F.field,style:{flex:1},children:[l.jsx("label",{className:F.label,htmlFor:`${e}_${u.code}`,children:u.label}),l.jsxs("select",{id:`${e}_${u.code}`,className:[F.input,a?F.inputError:""].join(" "),disabled:s||g,value:c[u.code]??"",onChange:y=>d(u.code,f,y.target.value),onBlur:o.onBlur,children:[l.jsx("option",{value:"",children:"Select…"}),u.options.map(y=>l.jsx("option",{value:y.value,children:y.label},y.value))]})]},u.code)})}),a&&l.jsx("span",{className:F.error,children:String(a.message)})]})},Nh=[{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"}],GE=({name:e,label:t,required:r,disabled:n})=>{const[s,i]=h.useState(!1),o=h.useRef(null),{register:a,watch:c,setValue:d,formState:{errors:u}}=Zt(),f=c(e),g=Nh.find(p=>p.value===f),y=(g==null?void 0:g.label)??"Select license…",_=u[e];return h.useEffect(()=>{if(!s)return;const p=v=>{var m;(m=o.current)!=null&&m.contains(v.target)||i(!1)};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]),l.jsxs("div",{className:F.field,ref:o,style:{position:"relative"},children:[l.jsxs("label",{className:F.label,children:[t,r&&l.jsx("span",{className:F.required,children:"*"})]}),l.jsx("input",{type:"hidden",...a(e,{required:r?`${t} is required`:!1})}),l.jsxs("button",{type:"button",disabled:n,className:[F.selectBtn,_?F.inputError:"",s?F.selectOpen:""].join(" "),onClick:()=>i(p=>!p),"aria-haspopup":"listbox","aria-expanded":s,children:[l.jsx("span",{className:f?F.selectedVal:F.placeholder,children:y}),l.jsx(hs,{size:14,className:s?F.chevronUp:""})]}),s&&l.jsx("div",{className:F.dropdown,role:"listbox",children:Nh.map(p=>l.jsxs("button",{type:"button",role:"option","aria-selected":f===p.value,className:[F.option,f===p.value?F.optionSelected:""].join(" "),onClick:()=>{d(e,p.value,{shouldDirty:!0,shouldValidate:!0}),i(!1)},children:[l.jsx("span",{children:p.label}),f===p.value&&l.jsx(bn,{size:13})]},p.value))}),_&&l.jsx("span",{className:F.error,children:String(_.message)})]})},RE=({name:e,label:t,required:r,disabled:n})=>{const{control:s}=Zt(),{field:i,fieldState:{error:o}}=Zi({name:e,control:s,rules:{required:r?`${t} is required`:!1},defaultValue:""}),[a,c]=h.useState("idle"),[d,u]=h.useState(""),f=async()=>{const y=(i.value??"").trim();if(!y){c("invalid"),u("Enter a dial code to validate.");return}c("loading"),u("");try{const _=await c_(y),p=_==null?void 0:_.result,v=p==null?void 0:p.dialcodes;Array.isArray(v)&&v.length>0?(c("valid"),u("Dial code is valid.")):(c("invalid"),u("Dial code not found."))}catch{c("invalid"),u("Validation failed. Please try again.")}},g=()=>a==="loading"?l.jsx(yi,{size:16,className:F.dialcodeSpinner}):a==="valid"?l.jsx(Vc,{size:16,color:"var(--sbx-success, #2e7d32)"}):a==="invalid"?l.jsx(Sv,{size:16,color:"var(--sbx-error)"}):null;return l.jsxs("div",{className:F.field,children:[l.jsxs("label",{className:F.label,htmlFor:e,children:[t,r&&l.jsx("span",{className:F.required,children:"*"})]}),l.jsxs("div",{className:F.dialcodeRow,children:[l.jsx("input",{id:e,type:"text",className:[F.input,o?F.inputError:""].join(" "),disabled:n,value:i.value??"",onChange:y=>{i.onChange(y),c("idle"),u("")},onBlur:i.onBlur,ref:i.ref,placeholder:"e.g. A1B2C3",style:{flex:1}}),l.jsx("button",{type:"button",className:F.validateBtn,onClick:f,disabled:n||a==="loading","aria-label":"Validate dial code",children:a==="loading"?"Validating…":"Validate"}),g()]}),o&&l.jsx("span",{className:F.error,children:String(o.message)}),!o&&d&&l.jsx("span",{className:a==="valid"?F.dialcodeValid:F.error,children:d})]})},gl={form:"_form_szqex_1",ungrouped:"_ungrouped_szqex_7",noFields:"_noFields_szqex_18"},YE=({nodeMetadata:e,activeTab:t,isRoot:r,isFolder:n,editorMode:s,onFormValueChange:i,onFormStatusChange:o})=>{var Ze,Ye,qe,re,Le,Ve,Je,ft,Wt;const a=oe(W=>W.editorConfig),c=oe(W=>W.rootFormConfig),d=oe(W=>W.unitFormConfig),u=oe(W=>W.categoryMeta),f=oe(W=>W.contentFramework),g=oe(W=>W.contentTargetFWIds),{organisationFramework:y,targetFrameworks:_,isLoading:p}=_h(f??((Ze=a==null?void 0:a.context)==null?void 0:Ze.framework),g??((Ye=a==null?void 0:a.context)==null?void 0:Ye.targetFWIds)),{frameworks:v,collectionAdditionalCategories:m,contentAdditionalCategories:b,defaultLicense:S,name:w}=dE((qe=a==null?void 0:a.context)==null?void 0:qe.channel),E=fE(((re=a==null?void 0:a.context)==null?void 0:re.userId)??((Le=a==null?void 0:a.context)==null?void 0:Le.uid)),D=cE(v,(Ve=u==null?void 0:u.frameworkMetadata)==null?void 0:Ve.orgFWType,(Je=a==null?void 0:a.context)==null?void 0:Je.channel),x={organisationFramework:y,targetFrameworks:_,orgFrameworks:D,channelAdditionalCategories:m},A=Ie(W=>W.selectedNodeId),$=Ie(W=>W.treeData),N=Ie(W=>W.treeCache),M=A?N[A]??{}:{},U={...e,...M},P=h.useMemo(()=>{var fe;if(!A)return 0;const W=[...$];for(;W.length;){const ve=W.shift();if(ve.id===A)return((fe=ve.children)==null?void 0:fe.length)??0;ve.children&&W.push(...ve.children)}return 0},[$,A]),L=(a==null?void 0:a.config)??{},j=(a==null?void 0:a.context)??{},X={editorMode:s,editableFields:L.editableFields,objectType:L.objectType,setDefaultCopyRight:L.setDefaultCopyRight===!0,defaultLicense:j.defaultLicense??S,contextAdditionalCategories:j.additionalCategories,userFullName:((ft=j.user)==null?void 0:ft.fullName)??E,channelName:w,collectionAdditionalCategories:m,contentAdditionalCategories:b,childCount:P},se=r?c:d,xe=se||(((Wt=a==null?void 0:a.config.hierarchy)==null?void 0:Wt.formConfig)??[]),Ce=Sh(xe,U,x,r,X),be=Ce.filter(W=>W.tab===t&&W.inputType!=="appIcon"&&W.visible!==!1),z=aE({mode:"onChange",defaultValues:Object.fromEntries(Ce.map(W=>{const fe=["multiselect","chips","keywords","tagsinput"],ve=["nestedselect"];return fe.includes(W.inputType)?[W.code,W.currentValue??W.defaultValue??[]]:ve.includes(W.inputType)?[W.code,W.currentValue??W.defaultValue??{}]:[W.code,W.currentValue??W.defaultValue??""]}))});ME(z,Ce);const{updateNode:J}=Ie(),te=h.useRef(Ce);te.current=Ce;const V=h.useRef(A);V.current=A;const Z=h.useRef(i);Z.current=i;const G=h.useRef(o);G.current=o;const ce=h.useRef(typeof U.shuffle=="boolean"?U.shuffle:void 0),ee=h.useRef(U.name??"");ee.current=U.name??"";const ge=h.useRef(s);ge.current=s;const ae=["review","read","sourcingreview","orgreview"];h.useEffect(()=>{const W=V.current;if(W){const fe=Object.fromEntries(te.current.filter(ve=>ve.currentValue!==void 0&&ve.currentValue!==null).map(ve=>[ve.code,ve.currentValue]));Object.keys(fe).length>0&&J(W,fe)}z.trigger().then(()=>{const fe=z.formState.errors,ve=te.current,dr=Array.from(new Set(Object.keys(fe).map(mr=>{var C;return(C=ve.find(T=>T.code===mr))==null?void 0:C.tab}).filter(Boolean)));G.current(Object.keys(fe).length===0,dr)})},[]),h.useEffect(()=>{const W=z.watch((fe,{name:ve})=>{const dr=V.current;if(!dr)return;const mr=te.current,C=new Set(mr.map(B=>B.code));if(ve&&C.has(ve)){let B=z.getValues(ve);ve==="dialcodes"&&(B=Array.isArray(B)?B:B?[B]:[]),ve==="shuffle"&&(B===!0&&ce.current===!1&&Oe("Shuffling is enabled for this question set.",{icon:"ℹ️"}),ce.current=B);const q=PE(ve,B);q&&(J(dr,q),Z.current(q))}else if(!ve){const B=z.getValues(),q=Object.fromEntries(Object.entries(B).filter(([H])=>C.has(H))),Q=AE(q,{isReview:ae.includes(ge.current),nodeTitle:ee.current});Object.keys(Q).length>0&&(J(dr,Q),Z.current(Q))}const T=z.formState.errors,k=Array.from(new Set(Object.keys(T).map(B=>{var q;return(q=mr.find(Q=>Q.code===B))==null?void 0:q.tab}).filter(Boolean)));G.current(Object.keys(T).length===0,k)});return()=>W.unsubscribe()},[z]),h.useEffect(()=>{for(const W of["author","creator","copyright","copyrightYear","license"]){const fe=te.current.find(dr=>dr.code===W);if(!fe||fe.currentValue===void 0||fe.currentValue===null||fe.currentValue==="")continue;const ve=z.getValues(W);(ve==null||ve==="")&&z.setValue(W,fe.currentValue,{shouldDirty:!1})}},[E,w,z]);const Re=be.reduce((W,fe)=>{const ve=W[W.length-1];return ve&&ve.section===fe.section?ve.fields.push(fe):W.push({section:fe.section,fields:[fe]}),W},[]),Ee=W=>{const fe={key:W.code,name:W.code,label:W.label,required:W.required,disabled:W.editable===!1};switch(W.inputType){case"textarea":return l.jsx(Ih,{...fe,multiline:!0,maxLength:W.maxLength});case"select":return l.jsx(FE,{...fe,options:W.options??[]});case"multiselect":return l.jsx($E,{...fe,options:W.options??[]});case"chips":return l.jsx(jE,{...fe});case"radio":return l.jsx(BE,{...fe,options:W.options??[]});case"appIcon":return l.jsx(HE,{...fe,nodeId:A??""});case"datepicker":case"datetime":return l.jsx(WE,{...fe});case"keywords":case"tagsinput":return l.jsx(QE,{...fe});case"nestedselect":return l.jsx(KE,{...fe,levels:W.levels??[]});case"license":return l.jsx(GE,{...fe});case"dialcode":return l.jsx(RE,{...fe});default:return l.jsx(Ih,{...fe,maxLength:W.maxLength})}};return l.jsx(Q1,{...z,children:l.jsxs("div",{className:gl.form,children:[Re.map((W,fe)=>{const ve=W.section?hE[W.section]:void 0;return ve?l.jsx(LE,{title:ve.title,description:ve.description,children:W.fields.map(Ee)},W.section??fe):l.jsx("div",{className:gl.ungrouped,children:W.fields.map(Ee)},fe)}),be.length===0&&!p&&l.jsx("p",{className:gl.noFields,children:"No fields configured for this tab."})]})})};function kh(e,t,r){const n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function XE(e,t){return e.reduce((r,n,s)=>{const i=t.get(n);return i&&(r[s]=i),r},Array(e.length))}function no(e){return e!==null&&e>=0}function ZE(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 JE(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const xh=e=>{let{rects:t,activeIndex:r,overIndex:n,index:s}=e;const i=kh(t,n,r),o=t[s],a=i[s];return!a||!o?null:{x:a.left-o.left,y:a.top-o.top,scaleX:a.width/o.width,scaleY:a.height/o.height}},so={scaleX:1,scaleY:1},eO=e=>{var t;let{activeIndex:r,activeNodeRect:n,index:s,rects:i,overIndex:o}=e;const a=(t=i[r])!=null?t:n;if(!a)return null;if(s===r){const d=i[o];return d?{x:0,y:r<o?d.top+d.height-(a.top+a.height):d.top-a.top,...so}:null}const c=tO(i,s,r);return s>r&&s<=o?{x:0,y:-a.height-c,...so}:s<r&&s>=o?{x:0,y:a.height+c,...so}:{x:0,y:0,...so}};function tO(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 Ah="Sortable",Ph=h.createContext({activeIndex:-1,containerId:Ah,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:xh,disabled:{draggable:!1,droppable:!1}});function rO(e){let{children:t,id:r,items:n,strategy:s=xh,disabled:i=!1}=e;const{active:o,dragOverlay:a,droppableRects:c,over:d,measureDroppableContainers:u}=$c(),f=os(Ah,r),g=a.rect!==null,y=h.useMemo(()=>n.map(D=>typeof D=="object"&&"id"in D?D.id:D),[n]),_=o!=null,p=o?y.indexOf(o.id):-1,v=d?y.indexOf(d.id):-1,m=h.useRef(y),b=!ZE(y,m.current),S=v!==-1&&p===-1||b,w=JE(i);Kt(()=>{b&&_&&u(y)},[b,y,_,u]),h.useEffect(()=>{m.current=y},[y]);const E=h.useMemo(()=>({activeIndex:p,containerId:f,disabled:w,disableTransforms:S,items:y,overIndex:v,useDragOverlay:g,sortedRects:XE(y,c),strategy:s}),[p,f,w.draggable,w.droppable,S,y,v,c,g,s]);return h.createElement(Ph.Provider,{value:E},t)}const nO=e=>{let{id:t,items:r,activeIndex:n,overIndex:s}=e;return kh(r,n,s).indexOf(t)},sO=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},iO={duration:200,easing:"ease"},Mh="transform",oO=Ir.Transition.toString({property:Mh,duration:0,easing:"linear"}),aO={roleDescription:"sortable"};function lO(e){let{disabled:t,index:r,node:n,rect:s}=e;const[i,o]=h.useState(null),a=h.useRef(r);return Kt(()=>{if(!t&&r!==a.current&&n.current){const c=s.current;if(c){const d=mn(n.current,{ignoreTransform:!0}),u={x:c.left-d.left,y:c.top-d.top,scaleX:c.width/d.width,scaleY:c.height/d.height};(u.x||u.y)&&o(u)}}r!==a.current&&(a.current=r)},[t,r,n,s]),h.useEffect(()=>{i&&o(null)},[i]),i}function cO(e){let{animateLayoutChanges:t=sO,attributes:r,disabled:n,data:s,getNewIndex:i=nO,id:o,strategy:a,resizeObserverConfig:c,transition:d=iO}=e;const{items:u,containerId:f,activeIndex:g,disabled:y,disableTransforms:_,sortedRects:p,overIndex:v,useDragOverlay:m,strategy:b}=h.useContext(Ph),S=uO(n,y),w=u.indexOf(o),E=h.useMemo(()=>({sortable:{containerId:f,index:w,items:u},...s}),[f,s,w,u]),D=h.useMemo(()=>u.slice(u.indexOf(o)),[u,o]),{rect:x,node:A,isOver:$,setNodeRef:N}=nv({id:o,data:E,disabled:S.droppable,resizeObserverConfig:{updateMeasurementsFor:D,...c}}),{active:M,activatorEvent:U,activeNodeRect:P,attributes:L,setNodeRef:j,listeners:X,isDragging:se,over:xe,setActivatorNodeRef:Ce,transform:be}=Fc({id:o,data:E,attributes:{...aO,...r},disabled:S.draggable}),z=qg(N,j),J=!!M,te=J&&!_&&no(g)&&no(v),V=!m&&se,Z=V&&te?be:null,ce=te?Z??(a??b)({rects:p,activeNodeRect:P,activeIndex:g,overIndex:v,index:w}):null,ee=no(g)&&no(v)?i({id:o,items:u,activeIndex:g,overIndex:v}):w,ge=M==null?void 0:M.id,ae=h.useRef({activeId:ge,items:u,newIndex:ee,containerId:f}),Re=u!==ae.current.items,Ee=t({active:M,containerId:f,isDragging:se,isSorting:J,id:o,index:w,items:u,newIndex:ae.current.newIndex,previousItems:ae.current.items,previousContainerId:ae.current.containerId,transition:d,wasDragging:ae.current.activeId!=null}),Ze=lO({disabled:!Ee,index:w,node:A,rect:x});return h.useEffect(()=>{J&&ae.current.newIndex!==ee&&(ae.current.newIndex=ee),f!==ae.current.containerId&&(ae.current.containerId=f),u!==ae.current.items&&(ae.current.items=u)},[J,ee,f,u]),h.useEffect(()=>{if(ge===ae.current.activeId)return;if(ge&&!ae.current.activeId){ae.current.activeId=ge;return}const qe=setTimeout(()=>{ae.current.activeId=ge},50);return()=>clearTimeout(qe)},[ge]),{active:M,activeIndex:g,attributes:L,data:E,rect:x,index:w,newIndex:ee,items:u,isOver:$,isSorting:J,isDragging:se,listeners:X,node:A,overIndex:v,over:xe,setNodeRef:z,setActivatorNodeRef:Ce,setDroppableNodeRef:N,setDraggableNodeRef:j,transform:Ze??ce,transition:Ye()};function Ye(){if(Ze||Re&&ae.current.newIndex===w)return oO;if(!(V&&!ai(U)||!d)&&(J||Ee))return Ir.Transition.toString({...d,property:Mh})}}function uO(e,t){var r,n;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(r=e==null?void 0:e.draggable)!=null?r:t.draggable,droppable:(n=e==null?void 0:e.droppable)!=null?n:t.droppable}}function io(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const dO=[we.Down,we.Right,we.Up,we.Left],fO=(e,t)=>{let{context:{active:r,collisionRect:n,droppableRects:s,droppableContainers:i,over:o,scrollableAncestors:a}}=t;if(dO.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=iy({collisionRect:n,droppableRects:s,droppableContainers:c});let u=lc(d,"id");if(u===(o==null?void 0:o.id)&&d.length>1&&(u=d[1].id),u!=null){const f=i.get(r.id),g=i.get(u),y=g?s.get(g.id):null,_=g==null?void 0:g.node.current;if(_&&y&&f&&g){const v=ui(_).some((D,x)=>a[x]!==D),m=Lh(f,g),b=hO(f,g),S=v||!m?{x:0,y:0}:{x:b?n.width-y.width:0,y:b?n.height-y.height:0},w={x:y.left,y:y.top};return S.x&&S.y?w:as(w,S)}}}};function Lh(e,t){return!io(e)||!io(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function hO(e,t){return!io(e)||!io(t)||!Lh(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const en={row:"_row_11nth_1",removeBtn:"_removeBtn_11nth_14",grip:"_grip_11nth_17",ctIcon:"_ctIcon_11nth_34",info:"_info_11nth_38",name:"_name_11nth_46",meta:"_meta_11nth_55"},pO={video:Ro,pdf:zo,h5p:Ho,scorm:Qo,audio:Wo,quiz:qo,default:_n},gO=({item:e,onRemove:t,isEditable:r})=>{const n=Ri(e),s=pO[n.key]??_n,{attributes:i,listeners:o,setNodeRef:a,transform:c,transition:d,isDragging:u}=cO({id:e.id,disabled:!r}),f={transform:Ir.Transform.toString(c),transition:d,opacity:u?.5:1};return l.jsxs("div",{ref:a,style:f,className:en.row,role:"listitem",children:[r&&l.jsx("span",{className:en.grip,...i,...o,"aria-label":"Drag to reorder",children:l.jsx(Hc,{size:15})}),l.jsx("span",{className:[`sbx-ct-sq--${n.key}`,en.ctIcon].join(" "),"aria-hidden":"true",children:l.jsx(s,{size:14})}),l.jsxs("div",{className:en.info,children:[l.jsx("span",{className:en.name,title:e.name,children:e.name}),l.jsx("span",{className:en.meta,children:n.label})]}),l.jsx("span",{className:`sbx-ct-badge--${n.key}`,children:n.label}),r&&l.jsx("button",{type:"button",className:en.removeBtn,onClick:()=>t(e.id),"aria-label":`Remove ${e.name}`,children:l.jsx(zr,{size:14})})]})},tn={container:"_container_lzvke_1",header:"_header_lzvke_7",heading:"_heading_lzvke_13",count:"_count_lzvke_21",list:"_list_lzvke_30",emptyState:"_emptyState_lzvke_36",addRow:"_addRow_lzvke_52"},yO=({editorMode:e})=>{const{selectedNodeId:t,getChildrenOf:r,reorderChildren:n,deleteNode:s}=Ie(),i=t?r(t):[],o=e==="edit",a=sc(xo(di,{activationConstraint:{distance:5}}),xo(Fo,{coordinateGetter:fO})),c=h.useCallback(u=>{const{active:f,over:g}=u;if(!g||f.id===g.id||!t)return;const y=Ie.getState().getChildrenOf(t),_=y.findIndex(v=>v.id===f.id),p=y.findIndex(v=>v.id===g.id);_<0||p<0||n(t,_,p)},[t,n]),d=h.useCallback(u=>{window.confirm("Remove this content from the unit?")&&s(u)},[s]);return t?l.jsxs("div",{className:tn.container,children:[l.jsxs("div",{className:tn.header,children:[l.jsx("span",{className:tn.heading,children:"Content in this unit"}),l.jsx("span",{className:tn.count,children:i.length})]}),i.length>0?l.jsx(Mc,{sensors:a,collisionDetection:sy,onDragEnd:c,children:l.jsx(rO,{items:i.map(u=>u.id),strategy:eO,children:l.jsx("div",{className:tn.list,role:"list",children:i.map(u=>l.jsx(gO,{item:u,onRemove:d,isEditable:o},u.id))})})}):l.jsxs("div",{className:tn.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:tn.addRow,type:"button","aria-label":"Add content to unit",children:[l.jsx(ps,{size:14})," Add content"]})]}):null},Fh={dropZone:"_dropZone_ijo5w_1",active:"_active_ijo5w_14"},vO=({isActive:e,label:t="Drop here",nodeId:r,className:n})=>l.jsx("div",{className:`${Fh.dropZone} ${e?Fh.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 mO(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 bO(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 $h="application/vnd.sunbird.question";function jh(e){return{cardinality:"single",type:"integer",defaultValue:e.maxScore??1}}function Bh(e,t,r){if(!e)return null;if(e.identifier===t)return{question:e,parent:r};for(const n of e.children??[]){const s=Bh(n,t,e);if(s)return s}return null}function _O(e,t){const r=Bh(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 wO(e,t){const r=((t==null?void 0:t.enabled)??!0)&&!!e;return pn({queryKey:["quml","questionset",e],enabled:r,queryFn:async()=>{const n=await Zu(e),s=u=>{if(!u)return[];const f=u.mimeType===$h&&u.identifier?[u.identifier]:[],g=(u.children??[]).flatMap(s);return[...f,...g]},i=s(n),o=new Map;i.length&&(await e_(i)).forEach(f=>{const g=f.identifier;g&&o.set(g,f)});const a=u=>{if(!u)return u;if(u.mimeType===$h&&u.identifier){const f=o.get(u.identifier)??u,g=f.outcomeDeclaration;return g!=null&&g.maxScore||(f.outcomeDeclaration={...g??{},maxScore:jh(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:jh(c)}),c}})}const Uh="/assets/quml-player/sunbird-quml-player.js",SO="/assets/quml-player/styles.css",Vh="sunbird-quml-player";function CO(e){const t=e.children??[];return t.length?t.every(n=>n.objectType==="Question")?[e]:t:[]}const ot=class ot{constructor(){Ks(this,"eventHandlers",new WeakMap)}loadScript(){return ot.scriptLoaded||customElements.get(Vh)?(ot.scriptLoaded=!0,Promise.resolve()):(ot.scriptLoading||(ot.scriptLoading=new Promise((t,r)=>{const n=document.createElement("script");n.src=Uh,n.setAttribute("data-quml-player-script","true"),n.onload=()=>{ot.scriptLoaded=!0,ot.scriptLoading=void 0,t()},n.onerror=()=>{ot.scriptLoading=void 0,r(new Error(`Failed to load QuML player script: ${Uh}`))},document.body.appendChild(n)})),ot.scriptLoading)}loadStyles(){if(ot.stylesLoaded||document.querySelector('[data-quml-player-styles="true"]')){ot.stylesLoaded=!0;return}const t=document.createElement("link");t.rel="stylesheet",t.href=SO,t.setAttribute("data-quml-player-styles","true"),document.head.appendChild(t),ot.stylesLoaded=!0}static unloadStyles(){var t;(t=document.querySelector('[data-quml-player-styles="true"]'))==null||t.remove(),ot.stylesLoaded=!1}async createConfig(t,r,n){var i,o,a;return await this.loadScript(),{context:{mode:(n==null?void 0:n.mode)??"play",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:CO(t),identifier:t.identifier??""},metadata:t}}createElement(t){this.loadStyles();const r=document.createElement(Vh);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))}};Ks(ot,"scriptLoaded",!1),Ks(ot,"scriptLoading"),Ks(ot,"stylesLoaded",!1);let oo=ot;const ao=new oo,je={contentPlayerRoot:"_contentPlayerRoot_r6xk8_1",flowLayout:"_flowLayout_r6xk8_9",stage:"_stage_r6xk8_13",aspectRatio:"_aspectRatio_r6xk8_16",playerHeader:"_playerHeader_r6xk8_32",playerHeaderThumb:"_playerHeaderThumb_r6xk8_46",playerHeaderTitle:"_playerHeaderTitle_r6xk8_56",typeBadge:"_typeBadge_r6xk8_66",typeDot:"_typeDot_r6xk8_105",playerFrame:"_playerFrame_r6xk8_125",coverOverlay:"_coverOverlay_r6xk8_133",coverHidden:"_coverHidden_r6xk8_145",coverThumb:"_coverThumb_r6xk8_150",coverPlayRing:"_coverPlayRing_r6xk8_159",coverPlayIcon:"_coverPlayIcon_r6xk8_172",coverLabel:"_coverLabel_r6xk8_181",coverSkeleton:"_coverSkeleton_r6xk8_187",playerWrapper:"_playerWrapper_r6xk8_213",infoStrip:"_infoStrip_r6xk8_223",infoChip:"_infoChip_r6xk8_239",infoChipLabel:"_infoChipLabel_r6xk8_258",infoChipIcon:"_infoChipIcon_r6xk8_267",playerError:"_playerError_r6xk8_273",playerErrorIcon:"_playerErrorIcon_r6xk8_287",playerErrorMsg:"_playerErrorMsg_r6xk8_292",qumlRoot:"_qumlRoot_r6xk8_299"},EO="application/vnd.sunbird.questionset";function OO(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===EO)return s.identifier;s=s.parent?r.get(s.parent):void 0}return null}const IO=[{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 DO(e){return IO.find(t=>t.mimes.includes(e))??{key:"other",label:"Content",icon:"📱"}}const TO={"pdf-player":["application/pdf"],"video-player":["video/mp4","video/webm"],"epub-player":["application/epub"]},NO={"pdf-player":"/assets/sunbird-pdf-player.js","video-player":"/assets/sunbird-video-player.js","epub-player":"/assets/sunbird-epub-player.js"},kO={"pdf-player":"sunbird-pdf-player","video-player":"sunbird-video-player","epub-player":"sunbird-epub-player"},xO="/content/preview/preview.html?webview=true&build_number=2.8.0.e552fcd";function yl(e){for(const[t,r]of Object.entries(TO))if(r.includes(e))return t;return"default-player"}function AO(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 PO(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 MO(e,t,r=100){await PO(NO[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 LO=[{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 FO({node:e}){const t=e.metadata??{},r=LO.flatMap(n=>{const s=t[n.key];if(!s)return[];const i=Array.isArray(s)?s.join(", "):String(s);return i?[{...n,val:i}]:[]});return r.length?l.jsx("div",{className:je.infoStrip,children:r.map(n=>l.jsxs("div",{className:je.infoChip,children:[n.icon&&l.jsx("span",{className:je.infoChipIcon,children:n.icon}),l.jsx("span",{className:je.infoChipLabel,children:n.label}),n.val]},n.key))}):null}function qh({node:e,hidden:t}){var n;const r=e.appIcon??((n=e.metadata)==null?void 0:n.appIcon);return l.jsx("div",{className:`${je.coverOverlay} ${t?je.coverHidden:""}`,children:r?l.jsxs(l.Fragment,{children:[l.jsx("img",{src:r,alt:e.name,className:je.coverThumb}),l.jsx("div",{className:je.coverPlayRing,children:l.jsx("div",{className:je.coverPlayIcon})}),l.jsx("span",{className:je.coverLabel,children:"Loading preview…"})]}):l.jsx("div",{className:je.coverSkeleton})})}function zh({message:e}){return l.jsxs("div",{className:je.playerError,children:[l.jsx("span",{className:je.playerErrorIcon,children:"⚠"}),l.jsx("span",{className:je.playerErrorMsg,children:e})]})}function $O({mimeType:e}){const t=DO(e);return l.jsxs("span",{className:je.typeBadge,"data-type":t.key,children:[l.jsx("span",{className:je.typeDot}),t.label]})}const vl=({node:e,editorMode:t,type:r,singleQuestion:n,layout:s="fill"})=>{var o;if(r==="quml")return l.jsx(BO,{node:e,editorMode:t,singleQuestion:!!n});const i=e.appIcon??((o=e.metadata)==null?void 0:o.appIcon);return l.jsxs("div",{className:`${je.contentPlayerRoot} ${s==="flow"?je.flowLayout:""}`,children:[l.jsxs("div",{className:je.stage,children:[l.jsxs("div",{className:je.playerHeader,children:[i&&l.jsx("img",{src:i,alt:"",className:je.playerHeaderThumb}),l.jsx("span",{className:je.playerHeaderTitle,children:e.name}),l.jsx($O,{mimeType:e.mimeType??""})]}),l.jsx(jO,{node:e})]}),l.jsx(FO,{node:e})]})};function jO({node:e}){var v;const t=oe(m=>m.editorConfig),[r,n]=h.useState(()=>yl(e.mimeType??"")),[s,i]=h.useState(!1),[o,a]=h.useState(null),[c,d]=h.useState(e.metadata??{}),[u,f]=h.useState(!1),g=h.useRef(null),y=h.useRef(null),_=((v=t==null?void 0:t.config)==null?void 0:v.previewCdnUrl)??xO;h.useEffect(()=>{let m=!1;return f(!1),i(!1),a(null),d(e.metadata??{}),n(yl(e.mimeType??"")),bO(e.identifier).then(b=>{if(m)return;const S={...e.metadata??{},...b};d(S);const w=b.mimeType??e.mimeType??"";n(yl(w)),f(!0)}).catch(()=>{m||f(!0)}),()=>{m=!0}},[e.identifier]);const p=AO(e,c,t);return h.useEffect(()=>{if(!u||r!=="default-player")return;const m=g.current;if(!m)return;m.src=_;const b=()=>{try{const w=m.contentWindow;if(typeof(w==null?void 0:w.initializePreview)!="function"){a("Preview player unavailable. Check that /content/preview is reachable.");return}w.initializePreview(p),setTimeout(()=>i(!0),300)}catch(w){console.error("[ContentPlayer] initializePreview failed",w),a("Failed to initialize the content player.")}},S=()=>a("Preview player could not be loaded.");return m.addEventListener("load",b),m.addEventListener("error",S),()=>{m.removeEventListener("load",b),m.removeEventListener("error",S),m.src=""}},[e.identifier,r,_,u]),h.useEffect(()=>{if(!u||r==="default-player")return;const m=y.current;if(!m)return;const b=kO[r];if(!b)return;const S=p;MO(b,r).then(()=>{if(!y.current)return;if(!customElements.get(b)){n("default-player");return}const w=document.createElement(b);w.setAttribute("player-config",JSON.stringify(S)),w.addEventListener("playerEvent",()=>{}),w.addEventListener("telemetryEvent",()=>{}),m.innerHTML="",m.appendChild(w),setTimeout(()=>{try{w.playerConfig=S}catch{}i(!0)},200)}).catch(()=>{console.warn(`[ContentPlayer] ${r} script unavailable, falling back to iframe`),n("default-player")})},[e.identifier,r,u]),l.jsxs("div",{className:je.aspectRatio,children:[o?l.jsx(zh,{message:o}):l.jsx(qh,{node:e,hidden:s}),r==="default-player"?l.jsx("iframe",{ref:g,id:"contentPlayer",title:e.name,className:je.playerFrame,name:"contentPlayer",allowFullScreen:!0}):l.jsx("div",{ref:y,className:je.playerFrame})]})}function BO({node:e,editorMode:t,singleQuestion:r}){const n=oe(g=>g.editorConfig),s=Ie(g=>g.treeData),i=h.useRef(null),o=r?OO(s,e.id):e.identifier,{data:a,isLoading:c,error:d}=wO(o??"",{enabled:!!o}),u=h.useMemo(()=>a?r?_O(a,e.identifier):a:null,[a,r,e.identifier]);h.useEffect(()=>{const g=i.current;if(!g||!u)return;let y=null,_=!1;return(async()=>{try{const p=await ao.createConfig(u,n==null?void 0:n.context,{mode:t==="edit"?"edit":"play"});if(_||!i.current)return;const v=ao.createElement(p);y=v,ao.attachEventListeners(v,m=>console.debug("[QumlPlayer] playerEvent",m.detail),m=>console.debug("[QumlPlayer] telemetryEvent",m)),g.innerHTML="",g.appendChild(v)}catch(p){console.error("[QumlPlayer] failed to initialize",p)}})(),()=>{_=!0,y&&(ao.removeEventListeners(y),y.remove()),oo.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:je.qumlRoot,children:[f?l.jsx(zh,{message:f}):c||!u?l.jsx(qh,{node:e,hidden:!1}):null,l.jsx("div",{ref:i,className:je.playerWrapper})]})}const zt={overlay:"_overlay_ifddx_1",modal:"_modal_ifddx_11",header:"_header_ifddx_21",body:"_body_ifddx_37",hint:"_hint_ifddx_43",list:"_list_ifddx_49",item:"_item_ifddx_55",selected:"_selected_ifddx_68",empty:"_empty_ifddx_73",footer:"_footer_ifddx_79",cancelBtn:"_cancelBtn_ifddx_87",moveBtn:"_moveBtn_ifddx_95"};function UO(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 VO=({resourceId:e,resourceName:t,currentUnitId:r,onClose:n})=>{var u;const{treeData:s,moveNode:i}=Ie(),o=UO(s,((u=s[0])==null?void 0:u.id)??"",r),[a,c]=h.useState(null),d=()=>{a&&(i(e,r,a),n())};return l.jsx("div",{className:zt.overlay,role:"dialog","aria-label":"Move resource",children:l.jsxs("div",{className:zt.modal,children:[l.jsxs("div",{className:zt.header,children:[l.jsxs("span",{children:['Move "',t,'"']}),l.jsx("button",{onClick:n,"aria-label":"Close",children:l.jsx(zr,{size:16})})]}),l.jsxs("div",{className:zt.body,children:[l.jsx("p",{className:zt.hint,children:"Select a unit to move this content to:"}),l.jsxs("ul",{className:zt.list,children:[o.map(f=>l.jsxs("li",{className:`${zt.item} ${a===f.id?zt.selected:""}`,onClick:()=>c(f.id),children:[l.jsx(Ov,{size:14}),l.jsx("span",{children:f.name})]},f.id)),o.length===0&&l.jsx("li",{className:zt.empty,children:"No other units available"})]})]}),l.jsxs("div",{className:zt.footer,children:[l.jsx("button",{className:zt.cancelBtn,onClick:n,children:"Cancel"}),l.jsx("button",{className:zt.moveBtn,onClick:d,disabled:!a,children:"Move here"})]})]})})},ir={overlay:"_overlay_16at9_1",modal:"_modal_16at9_11",header:"_header_16at9_21",body:"_body_16at9_37",table:"_table_16at9_43",pageInput:"_pageInput_16at9_61",empty:"_empty_16at9_68",footer:"_footer_16at9_74",cancelBtn:"_cancelBtn_16at9_82",saveBtn:"_saveBtn_16at9_90"};function qO(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 zO=({onClose:e})=>{const{treeData:t,updateNode:r}=Ie(),n=qO(t),[s,i]=h.useState(()=>Object.fromEntries(n.map(a=>{var c;return[a.id,String(((c=a.metadata)==null?void 0:c.pageNumber)??"")]}))),o=h.useCallback(()=>{for(const[a,c]of Object.entries(s))c!==""&&r(a,{pageNumber:parseInt(c,10)||void 0});e()},[s,r,e]);return l.jsx("div",{className: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(zr,{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(Pv,{size:14})," Save"]})]})]})})},He={container:"_container_1a7t2_1",panelHeader:"_panelHeader_1a7t2_10",panelHeaderLeft:"_panelHeaderLeft_1a7t2_19",panelCollapseBtn:"_panelCollapseBtn_1a7t2_27",titleRow:"_titleRow_1a7t2_46",field:"_field_1a7t2_47",moveBtn:"_moveBtn_1a7t2_64",icon:"_icon_1a7t2_84",nameInput:"_nameInput_1a7t2_93",fieldHeader:"_fieldHeader_1a7t2_118",label:"_label_1a7t2_124",fieldCount:"_fieldCount_1a7t2_133",chips:"_chips_1a7t2_170",chip:"_chip_1a7t2_170",chipRemove:"_chipRemove_1a7t2_188",keywordInput:"_keywordInput_1a7t2_202",input:"_input_1a7t2_207",addBtn:"_addBtn_1a7t2_220",radioGroup:"_radioGroup_1a7t2_234",radioLabel:"_radioLabel_1a7t2_239"},HO=({node:e,editorMode:t,onMoveClick:r,reorderDialog:n})=>{var M,U;const{updateNode:s,markDirty:i}=Ie(),o=t==="edit",a=Ri(e),c=oe(P=>P.relationalFormConfig),d=P=>c==null?void 0:c.find(L=>L.code===P),u=P=>!c||!!d(P),f=(P,L)=>{var j;return((j=d(P))==null?void 0:j.label)||L},[g,y]=h.useState(!0),_=((M=e.metadata)==null?void 0:M.relationalMetadata)??{},[p,v]=h.useState(_.name??e.name??""),[m,b]=h.useState(""),[S,w]=h.useState(Array.isArray(_.keywords)?_.keywords:Array.isArray((U=e.metadata)==null?void 0:U.keywords)?e.metadata.keywords:[]),[E,D]=h.useState(!!_.optional);h.useEffect(()=>{var L,j;const P=((L=e.metadata)==null?void 0:L.relationalMetadata)??{};v(P.name??e.name??""),w(Array.isArray(P.keywords)?P.keywords:Array.isArray((j=e.metadata)==null?void 0:j.keywords)?e.metadata.keywords:[]),D(!!P.optional)},[e.id]);const x=()=>{p.trim()&&p!==e.name&&(s(e.id,{name:p.trim()}),i())},A=()=>{const P=m.trim();if(P&&!S.includes(P)){const L=[...S,P];w(L),s(e.id,{keywords:L}),i()}b("")},$=P=>{const L=S.filter(j=>j!==P);w(L),s(e.id,{keywords:L}),i()},N=P=>{D(P),s(e.id,{optional:P}),i()};return l.jsxs("div",{className:He.container,children:[l.jsxs("div",{className:He.panelHeader,children:[l.jsxs("div",{className:He.panelHeaderLeft,children:[l.jsx("span",{className:`sbx-ct-badge--${a.key}`,children:a.label}),o&&l.jsx("button",{type:"button",className:He.moveBtn,onClick:r,children:"Move to another unit"})]}),l.jsx("button",{type:"button",className:He.panelCollapseBtn,onClick:()=>y(P=>!P),"aria-expanded":g,"aria-label":g?"Collapse metadata panel":"Expand metadata panel",title:g?"Collapse":"Expand",children:g?l.jsx(hs,{size:15}):l.jsx(wv,{size:15})})]}),g&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:He.titleRow,children:[e.appIcon&&l.jsx("img",{src:e.appIcon,alt:"icon",className:He.icon}),l.jsx("input",{type:"text",className:He.nameInput,value:p,disabled:!o,onChange:P=>v(P.target.value),onBlur:x,placeholder:"Content name"})]}),u("keywords")&&l.jsxs("div",{className:He.field,children:[l.jsx("div",{className:He.fieldHeader,children:l.jsxs("label",{className:He.label,children:[f("keywords","Keywords"),S.length>0&&l.jsx("span",{className:He.fieldCount,children:S.length})]})}),S.length>0&&l.jsx("div",{className:He.chips,children:S.map(P=>l.jsxs("span",{className:He.chip,children:[P,o&&l.jsx("button",{type:"button",className:He.chipRemove,onClick:()=>$(P),children:"×"})]},P))}),o&&l.jsxs("div",{className:He.keywordInput,children:[l.jsx("input",{type:"text",className:He.input,value:m,placeholder:"Add keyword and press Enter",onChange:P=>b(P.target.value),onKeyDown:P=>{P.key==="Enter"&&(P.preventDefault(),A())}}),l.jsx("button",{type:"button",className:He.addBtn,onClick:A,children:"Add"})]})]}),u("optional")&&l.jsxs("div",{className:He.field,children:[l.jsx("label",{className:He.label,children:f("optional","Optional in Collection")}),l.jsxs("div",{className:He.radioGroup,children:[l.jsxs("label",{className:He.radioLabel,children:[l.jsx("input",{type:"radio",name:`optional-${e.id}`,checked:E===!0,onChange:()=>N(!0),disabled:!o}),"Yes"]}),l.jsxs("label",{className:He.radioLabel,children:[l.jsx("input",{type:"radio",name:`optional-${e.id}`,checked:E===!1,onChange:()=>N(!1),disabled:!o}),"No"]})]})]})]}),n]})},Ms={iconBtn:"_iconBtn_vl14u_1",editable:"_editable_vl14u_14",iconImg:"_iconImg_vl14u_26",placeholder:"_placeholder_vl14u_34",removeBtn:"_removeBtn_vl14u_41"},WO=({nodeId:e,value:t,editable:r})=>{const[n,s]=h.useState(!1),{updateNode:i,markDirty:o}=Ie(),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:[Ms.iconBtn,r?Ms.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:Ms.iconImg}):l.jsx("div",{className:Ms.placeholder,children:l.jsx(Wc,{size:18})}),t&&r&&l.jsx("button",{type:"button",className:Ms.removeBtn,onClick:c,"aria-label":"Remove icon",children:l.jsx(Go,{size:11})})]}),n&&l.jsx(Th,{nodeId:e,currentValue:t,onSelect:a,onClose:()=>s(!1)})]})},Jt={leafContentLayout:"_leafContentLayout_1lchu_1",container:"_container_1lchu_15",emptyState:"_emptyState_1lchu_24",titleRow:"_titleRow_1lchu_34",nodeTitle:"_nodeTitle_1lchu_50",formArea:"_formArea_1lchu_72",contentListArea:"_contentListArea_1lchu_76",dropZone:"_dropZone_1lchu_81",reviewComment:"_reviewComment_1lchu_88",reviewCommentLabel:"_reviewCommentLabel_1lchu_101",reviewCommentText:"_reviewCommentText_1lchu_107"},QO="application/vnd.sunbird.questionset",Hh="application/vnd.sunbird.question",KO=[QO,Hh];function Wh(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 GO=({editorMode:e,onToolbarEvent:t})=>{var U;const[r,n]=h.useState("details"),[s,i]=h.useState([]),[o,a]=h.useState(null),[c,d]=h.useState(!1),u=h.useRef(null),f=h.useRef(),{selectedNodeId:g,breadcrumb:y,activeNodeMeta:_,updateNode:p,treeData:v}=Ie(),m=oe(P=>{var L,j,X,se;return((j=(L=P.editorConfig)==null?void 0:L.context)==null?void 0:j.contentId)??((se=(X=P.editorConfig)==null?void 0:X.context)==null?void 0:se.identifier)??""}),b=g?Qh(v,g):null,S=!!b&&!b.parent,w=!!(b!=null&&b.isFolder),E=b&&KO.includes(b.mimeType??""),D=(b==null?void 0:b.mimeType)===Hh,x=b&&!b.isFolder&&!E&&!S,A=Wh(b)??(S?Wh(v[0]):void 0),$=h.useCallback(()=>{const P=u.current;if(!P||!g)return;const L=P.innerText.trim();clearTimeout(f.current),f.current=setTimeout(()=>{p(g,{name:L})},600)},[g,p]),N=h.useCallback(P=>{t({action:"onFormValueChange",data:P})},[t]),M=h.useCallback((P,L)=>{i(L),t({action:"onFormStatusChange",data:{isValid:P,nodeId:g}})},[t,g]);return b?E?l.jsx(vl,{node:b,editorMode:e,type:"quml",singleQuestion:D}):x?l.jsxs("div",{className:Jt.leafContentLayout,children:[l.jsx(vl,{node:b,editorMode:e,type:"content",layout:"flow"}),l.jsx(HO,{node:b,editorMode:e,onMoveClick:()=>a(b.identifier),reorderDialog:o?l.jsx(VO,{resourceId:o,resourceName:b.name,currentUnitId:b.parent??"",onClose:()=>a(null)}):null})]}):l.jsxs("div",{className:Jt.container,children:[l.jsx(q1,{crumbs:y}),A&&l.jsxs("div",{className:Jt.reviewComment,role:"alert",children:[l.jsx("span",{className:Jt.reviewCommentLabel,children:"Reviewer comment:"}),l.jsx("span",{className:Jt.reviewCommentText,children:A})]}),l.jsxs("div",{className:Jt.titleRow,children:[S&&g&&l.jsx(WO,{nodeId:g,value:String(b.appIcon??((U=b.metadata)==null?void 0:U.appIcon)??""),editable:e==="edit"}),l.jsx("div",{ref:u,className:Jt.nodeTitle,contentEditable:e==="edit",suppressContentEditableWarning:!0,onInput:$,onBlur:$,"data-placeholder":"Untitled","aria-label":"Node title",children:b.name})]}),l.jsx(z1,{activeTab:r,onChange:P=>n(P),errorTabs:s,visibleTabs:S?void 0:["details"]}),l.jsx("div",{className:Jt.formArea,children:l.jsx(YE,{nodeMetadata:_,activeTab:r,isRoot:S,isFolder:w,editorMode:e,onFormValueChange:N,onFormStatusChange:M},`${g??"none"}:${S?"root":"node"}`)}),(w||S)&&r==="details"&&l.jsx("div",{className:Jt.contentListArea,children:l.jsx(yO,{editorMode:e})}),l.jsx(vO,{isActive:!1,label:"Drop to add content to this unit",nodeId:g??void 0,className:Jt.dropZone}),c&&l.jsx(zO,{contentId:m,onClose:()=>d(!1)})]}):l.jsx("div",{className:Jt.emptyState,children:l.jsx("p",{children:"Select a unit from the outline to edit its details"})})};function Qh(e,t){for(const r of e){if(r.id===t)return r;if(r.children){const n=Qh(r.children,t);if(n)return n}}}const Kh=mi((e,t)=>({allContent:[],filteredContent:[],searchQuery:"",activeFilter:"all",advancedFilters:{},isLoading:!1,totalCount:0,offset:0,sortAZ:!1,setContent:(r,n)=>{e({allContent:r,totalCount:n,offset:r.length}),t().applyFilter()},appendContent:(r,n)=>{const i=[...t().allContent,...r];e({allContent:i,totalCount:n,offset:i.length}),t().applyFilter()},setFilter:r=>{e({activeFilter:r}),t().applyFilter()},setSearch:r=>{e({searchQuery:r}),t().applyFilter()},setLoading:r=>e({isLoading:r}),setAdvancedFilters:r=>e({advancedFilters:r}),setOffset:r=>e({offset:r}),setSortAZ:r=>e({sortAZ:r}),applyFilter:()=>{const{allContent:r,activeFilter:n,searchQuery:s}=t();let i=r;if(n&&n!=="all"){const o=n.toLowerCase();i=i.filter(a=>[a.mimeType??"",a.primaryCategory??"",a.contentType??""].join(" ").toLowerCase().includes(o))}if(s&&s.trim()!==""){const o=s.toLowerCase().trim();i=i.filter(a=>(a.name??"").toLowerCase().includes(o))}e({filteredContent:i})}})),RO=20;function Gh(){var d;const e=oe(u=>u.editorConfig),t=Ie(u=>u.selectedNodeId),r=Ie(u=>u.treeData),n=h.useCallback(()=>{if(!t||!r.length)return 0;function u(f,g,y=0){var _;for(const p of f){if(p.id===g)return y;if((_=p.children)!=null&&_.length){const v=u(p.children,g,y+1);if(v>=0)return v}}return-1}return Math.max(0,u(r,t))},[t,r])(),s=(d=e==null?void 0:e.config)==null?void 0:d.hierarchy;if(!s)return[...Hf];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:[...Hf]}function YO(){const e=Kh(),t=oe(f=>{var g,y;return((y=(g=f.editorConfig)==null?void 0:g.context)==null?void 0:y.channel)??""}),r=Gh(),n=h.useRef(),s=h.useCallback(async(f="",g="all",y={},_=!0,p=!1)=>{var v,m,b,S,w;e.setLoading(!0);try{const E={status:["Live"],primaryCategory:g&&g!=="all"?[g]:r};(v=y==null?void 0:y.board)!=null&&v.length&&(E.board=y.board),(m=y==null?void 0:y.medium)!=null&&m.length&&(E.medium=y.medium),(b=y==null?void 0:y.gradeLevel)!=null&&b.length&&(E.gradeLevel=y.gradeLevel),(S=y==null?void 0:y.subject)!=null&&S.length&&(E.subject=y.subject),(w=y==null?void 0:y.primaryCategory)!=null&&w.length&&(E.primaryCategory=y.primaryCategory);const D=_?0:e.offset,{content:x,count:A}=await mO({filters:E,query:f,limit:f?50:RO,offset:D,channel:t||void 0,sortBy:p?{name:"asc"}:{lastUpdatedOn:"desc"}});_?e.setContent(x,A):e.appendContent(x,A)}catch(E){console.error("[useLibrary] load error:",E)}finally{e.setLoading(!1)}},[r,t]);h.useEffect(()=>{s()},[t]);const i=h.useCallback(f=>{e.setSearch(f),clearTimeout(n.current),n.current=setTimeout(()=>s(f,e.activeFilter,e.advancedFilters,!0,e.sortAZ),300)},[e.activeFilter,e.advancedFilters,e.sortAZ,s]),o=h.useCallback(f=>{e.setFilter(f),s(e.searchQuery,f,e.advancedFilters,!0,e.sortAZ)},[e.searchQuery,e.advancedFilters,e.sortAZ,s]),a=h.useCallback(f=>{e.setAdvancedFilters(f),s(e.searchQuery,e.activeFilter,f,!0,e.sortAZ)},[e.searchQuery,e.activeFilter,e.sortAZ,s]),c=h.useCallback(()=>{const f=!e.sortAZ;e.setSortAZ(f),s(e.searchQuery,e.activeFilter,e.advancedFilters,!0,f)},[e.sortAZ,e.searchQuery,e.activeFilter,e.advancedFilters,s]),d=h.useCallback(()=>{e.isLoading||s(e.searchQuery,e.activeFilter,e.advancedFilters,!1,e.sortAZ)},[e.isLoading,e.searchQuery,e.activeFilter,e.advancedFilters,e.sortAZ,s]),u=e.allContent.length<e.totalCount;return{content:e.filteredContent,isLoading:e.isLoading,totalCount:e.totalCount,activeFilter:e.activeFilter,advancedFilters:e.advancedFilters,searchQuery:e.searchQuery,sortAZ:e.sortAZ,hasMore:u,search:i,setFilter:o,applyAdvancedFilters:a,toggleSort:c,loadMore:d,refetch:()=>s(e.searchQuery,e.activeFilter,e.advancedFilters,!0,e.sortAZ)}}const or={card:"_card_jzciw_1",addBtn:"_addBtn_jzciw_17",dragging:"_dragging_jzciw_24",ctIcon:"_ctIcon_jzciw_29",info:"_info_jzciw_33",name:"_name_jzciw_41",meta:"_meta_jzciw_50",addBtnMuted:"_addBtnMuted_jzciw_78",added:"_added_jzciw_87",addedBadge:"_addedBadge_jzciw_96"},XO={video:Ro,pdf:zo,h5p:Ho,scorm:Qo,audio:Wo,quiz:qo,default:_n},ZO=({item:e,onAdd:t,onPreview:r,isDraggable:n,isAdded:s})=>{var p,v;const i=Ri(e),o=XO[i.key]??_n,a=Xa(),c=k1(),d=a&&!s&&c,{attributes:u,listeners:f,setNodeRef:g,isDragging:y}=Fc({id:e.identifier,disabled:!n||!a||!c,data:{type:"library-item",item:e}}),_=()=>{r&&r(e)};return l.jsxs("div",{ref:g,className:[or.card,y?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:[((p=e.organisation)==null?void 0:p[0])??e.channel??"",(v=e.organisation)!=null&&v[0]&&e.primaryCategory?" · ":"",e.primaryCategory??""]})]}),s&&l.jsx("span",{className:or.addedBadge,"aria-label":"Already added",title:"Already added to this collection",children:l.jsx(bn,{size:12})}),!s&&l.jsx("button",{type:"button",className:[or.addBtn,!d&&a?or.addBtnMuted:""].join(" "),onClick:m=>{m.stopPropagation(),t(e)},disabled:!a,"aria-disabled":!d,"aria-label":`Add ${e.name} to unit`,title:a?c?"Add to unit":"Select a unit to add":"Only Draft content can be added",children:l.jsx(ps,{size:14})})]})},Rh={chips:"_chips_xhhaq_1",chip:"_chip_xhhaq_1"},JO=({filters:e,active:t,onChange:r})=>l.jsx("div",{className:Rh.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",Rh.chip].join(" "),onClick:()=>r(n.value),children:n.label},n.value))}),st={panel:"_panel_1cl11_1",header:"_header_1cl11_10",headerTitle:"_headerTitle_1cl11_19",closeBtn:"_closeBtn_1cl11_25",body:"_body_1cl11_43",section:"_section_1cl11_59",sectionLabel:"_sectionLabel_1cl11_65",chips:"_chips_1cl11_73",chip:"_chip_1cl11_73",active:"_active_1cl11_96",footer:"_footer_1cl11_102",resetBtn:"_resetBtn_1cl11_112",applyBtn:"_applyBtn_1cl11_129"},eI=[{key:"board",label:"Board"},{key:"medium",label:"Medium"},{key:"gradeLevel",label:"Class"},{key:"subject",label:"Subject"}],tI=new Set(["board","medium","gradeLevel","subject","topic"]),rI=({local:e,toggle:t})=>{const r=Gh();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},nI=({isOpen:e,filters:t,onApply:r,onClose:n})=>{var p,v;const s=oe(m=>m.editorConfig),i=oe(m=>m.searchFormConfig),o=oe(m=>m.contentFramework),a=oe(m=>m.contentTargetFWIds),{organisationFramework:c}=_h(o??((p=s==null?void 0:s.context)==null?void 0:p.framework),a??((v=s==null?void 0:s.context)==null?void 0:v.targetFWIds)),[d,u]=h.useState(t),f=i!=null&&i.length?i.filter(m=>tI.has(m.code)).map(m=>({key:m.code,label:m.label||m.code})):eI;h.useEffect(()=>{u(t)},[t]);const g=(m,b)=>{u(S=>{const w=S[m]??[],E=w.includes(b)?w.filter(D=>D!==b):[...w,b];return{...S,[m]:E}})},y=(c==null?void 0:c.categories)??[],_=m=>{var b;return((b=y.find(S=>S.code===m))==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(zr,{size:16})})]}),l.jsxs("div",{className:st.body,children:[f.map(({key:m,label:b})=>{const S=_(m);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[m]??[]).includes(w.name)?st.active:""].join(" "),onClick:()=>g(m,w.name),children:w.name},w.identifier))})]},m):null}),l.jsx(rI,{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},gr={header:"_header_6qdpu_10",title:"_title_6qdpu_20",headerActions:"_headerActions_6qdpu_31",iconBtn:"_iconBtn_6qdpu_38",playerArea:"_playerArea_6qdpu_56",footer:"_footer_6qdpu_64",addBtn:"_addBtn_6qdpu_73",modalOverlay:"_modalOverlay_6qdpu_92",modalPanel:"_modalPanel_6qdpu_103"},sI="application/vnd.sunbird.questionset",iI=({content:e,onAdd:t,onClose:r})=>{if(!e)return null;const n={id:e.identifier,identifier:e.identifier,name:e.name??"",mimeType:e.mimeType,primaryCategory:e.primaryCategory,contentType:e.contentType,appIcon:e.appIcon,status:e.status,isFolder:!1,children:[],metadata:e};return Pe.createPortal(l.jsx("div",{className: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(zr,{size:16})})})]}),l.jsx("div",{className:gr.playerArea,children:l.jsx(vl,{node:n,editorMode:"read",type:e.mimeType===sI?"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)},Ue={dock:"_dock_1lpg0_1",header:"_header_1lpg0_8",headerLeft:"_headerLeft_1lpg0_17",headerTitle:"_headerTitle_1lpg0_24",count:"_count_1lpg0_30",searchRow:"_searchRow_1lpg0_39",searchWrap:"_searchWrap_1lpg0_47",searchIcon:"_searchIcon_1lpg0_53",searchInput:"_searchInput_1lpg0_62",filterToggleBtn:"_filterToggleBtn_1lpg0_80",filterToggleBtnActive:"_filterToggleBtnActive_1lpg0_99",filterBadge:"_filterBadge_1lpg0_105",filters:"_filters_1lpg0_124",mainArea:"_mainArea_1lpg0_134",sidePanelOverlay:"_sidePanelOverlay_1lpg0_143",cardList:"_cardList_1lpg0_152",skeleton:"_skeleton_1lpg0_168",skeletonIcon:"_skeletonIcon_1lpg0_178",skeletonText:"_skeletonText_1lpg0_186",skeletonLine:"_skeletonLine_1lpg0_193",skeletonLineSm:"_skeletonLineSm_1lpg0_200",loadMoreBtn:"_loadMoreBtn_1lpg0_215",emptyState:"_emptyState_1lpg0_240",collapseBtn:"_collapseBtn_1lpg0_260"};function oI(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 aI=({editorMode:e,collapsed:t=!1,onToggleCollapse:r})=>{const{content:n,isLoading:s,totalCount:i,activeFilter:o,searchQuery:a,sortAZ:c,hasMore:d,search:u,setFilter:f,applyAdvancedFilters:g,toggleSort:y,loadMore:_}=YO(),{addResource:p,selectedNodeId:v,treeData:m}=Ie(),b=e==="edit",[S,w]=h.useState(!1),[E,D]=h.useState({}),[x,A]=h.useState(null),$=h.useMemo(()=>oI(m),[m]),N=h.useCallback(j=>{var xe;if(!v){Oe.error("Select a unit first");return}const X=(xe=m[0])==null?void 0:xe.id;if(v===X){Oe("Select a unit from the outline to add content — resources cannot be added directly to the course.",{icon:"ℹ️",duration:4e3});return}if(p(j,v)===!1){Oe.error(`"${j.name}" is already in this collection`);return}Oe.success(`Added "${j.name}"`)},[v,p,m]),M=h.useCallback(j=>{D(j),g(j)},[g]),U=h.useCallback(j=>{A(j)},[]),P=h.useCallback(j=>{N(j),A(null)},[N]),L=h.useMemo(()=>Object.values(E).reduce((j,X)=>j+((X==null?void 0:X.length)??0),0),[E]);return l.jsxs("div",{className:Ue.dock,children:[l.jsx("div",{className:Ue.header,children:l.jsxs("div",{className:Ue.headerLeft,children:[l.jsx("button",{type:"button",className:Ue.collapseBtn,onClick:r,"aria-label":"Collapse library panel",title:"Collapse library",children:l.jsx(xv,{size:15})}),l.jsx(Tv,{size:16}),l.jsx("span",{className:Ue.headerTitle,children:"Library"}),i>0&&l.jsx("span",{className:Ue.count,children:i})]})}),l.jsxs("div",{className:Ue.searchRow,children:[l.jsxs("div",{className:Ue.searchWrap,children:[l.jsx(Ko,{size:14,className:Ue.searchIcon}),l.jsx("input",{type:"search",className:Ue.searchInput,placeholder:"Search content…",value:a,onChange:j=>u(j.target.value),"aria-label":"Search library"})]}),l.jsx("button",{type:"button",className:[Ue.filterToggleBtn,c?Ue.filterToggleBtnActive:""].join(" "),onClick:y,"aria-label":c?"Sort: A–Z (click for Recent)":"Sort: Recent (click for A–Z)",title:c?"A–Z":"Recent",children:c?l.jsx(bv,{size:15}):l.jsx(Cv,{size:15})}),l.jsxs("button",{type:"button",className:[Ue.filterToggleBtn,S?Ue.filterToggleBtnActive:""].join(" "),onClick:()=>w(j=>!j),"aria-label":"Toggle advanced filters","aria-pressed":S,title:"Advanced filters",children:[l.jsx(Fv,{size:15}),L>0&&l.jsx("span",{className:Ue.filterBadge,children:L})]})]}),l.jsx("div",{className:Ue.filters,children:l.jsx(JO,{filters:x1,active:o,onChange:f})}),l.jsxs("div",{className:Ue.mainArea,children:[l.jsx("div",{className:Ue.cardList,role:"list","aria-label":"Library content",children:s&&n.length===0?Array.from({length:4}).map((j,X)=>l.jsxs("div",{className:Ue.skeleton,"aria-hidden":"true",children:[l.jsx("div",{className:Ue.skeletonIcon}),l.jsxs("div",{className:Ue.skeletonText,children:[l.jsx("div",{className:Ue.skeletonLine}),l.jsx("div",{className:Ue.skeletonLineSm})]})]},X)):n.length>0?l.jsxs(l.Fragment,{children:[n.map(j=>l.jsx(ZO,{item:j,onAdd:N,onPreview:U,isDraggable:b,isAdded:$.has(j.identifier)},j.identifier)),d&&l.jsx("button",{type:"button",className:Ue.loadMoreBtn,onClick:_,disabled:s,"aria-label":"Load more content",children:s?"Loading…":"Load More"})]}):l.jsxs("div",{className:Ue.emptyState,children:[l.jsx(Ko,{size:24}),l.jsx("p",{children:"No content found"}),l.jsx("span",{children:"Try a different search or filter"})]})}),S&&l.jsx("div",{className:Ue.sidePanelOverlay,children:l.jsx(nI,{isOpen:S,filters:E,onApply:M,onClose:()=>w(!1)})}),x&&l.jsx(iI,{content:x,onAdd:P,onClose:()=>A(null)})]})]})};function lI(e,t,r){const n={},s={},i=new Set(["id","isFolder","children","parent","isNew","breadcrumb","title","relationalMetadata","optional"]),o=new Set(["targetBoardIds","targetMediumIds","targetGradeLevelIds","targetSubjectIds","targetFWIds","targetTopicIds","topic","topicsIds"]),a=new Set(["audience","attributions","keywords","language","additionalCategories","medium","gradeLevel","subject","boardIds","mediumIds","gradeLevelIds","subjectIds","targetBoardIds","targetMediumIds","targetGradeLevelIds","targetSubjectIds","dialcodes"]),c=new Set(["copyrightYear","compatibilityLevel","version"]);function d(g,y=!1){const _={};for(const[p,v]of Object.entries(g))if(!i.has(p)&&!(y&&o.has(p)))if(a.has(p))Array.isArray(v)?_[p]=v:v!=null&&v!==""?_[p]=[v]:_[p]=[];else if(c.has(p)){const m=Number(v);isNaN(m)||(_[p]=m)}else _[p]=v;return _}function u(g){var _;const y={};for(const p of g.children??[]){if(p.isFolder)continue;const v=t[p.identifier];if(!v)continue;const{isNew:m,...b}=v;if(Object.keys(b).length===0)continue;const S=((_=p.metadata)==null?void 0:_.relationalMetadata)??{};y[p.identifier]={name:p.name,...S,...b}}return y}function f(g,y){var S,w;const _=g.identifier,p=t[_],v=_.startsWith("temp-")||!!(p!=null&&p.isNew),m=!g.isFolder&&!y;if(y||v||p&&!m){let E;if(v)E={mimeType:"application/vnd.ekstep.content-collection",code:_,contentType:((S=g.metadata)==null?void 0:S.contentType)??"CourseUnit",primaryCategory:((w=g.metadata)==null?void 0:w.primaryCategory)??"Course Unit",name:g.name,visibility:"Parent",channel:r,...d(g.metadata??{})};else if(y){const{isNew:D,...x}=p??{};E={...d(g.metadata??{},!0),...d(x,!1),name:g.name}}else{const{isNew:D,...x}=p??{};E={name:g.name,visibility:"Parent",...d(x,!0)}}n[_]={metadata:E,objectType:g.objectType||(g.isFolder?"Collection":"Content"),root:y,isNew:v}}const b=g.isFolder?u(g):{};s[_]={name:g.name,children:(g.children??[]).map(E=>E.identifier),...Object.keys(b).length>0?{relationalMetadata:b}:{},root:y},(g.children??[]).forEach(E=>f(E,!1))}return e.forEach((g,y)=>f(g,y===0)),{nodesModified:n,hierarchy:s}}function cI(){const[e,t]=h.useState(!1),r=Ie(u=>u.treeCache),n=Ie(u=>u.treeData),s=oe(u=>u.isDirty),i=oe(u=>u.lastSaved),{setIsDirty:o,setLastSaved:a}=oe(),c=oe(u=>u.editorConfig);return{save:h.useCallback(async()=>{if(!c||e)return;const u=c.context.contentId??c.context.identifier??"";if(!u)return;const f=c.context.channel??"",g=c.context.userId??c.context.uid??"";t(!0);try{const{nodesModified:y,hierarchy:_}=lI(n,r,f),{identifiers:p}=await r_(u,y,_,g);p&&Object.keys(p).length>0&&Ie.getState().replaceNodeIds(p);const v=new Date().toISOString();a(v),o(!1)}catch(y){console.error("[useSaveHierarchy] save failed:",y),Oe.error("Failed to save. Please try again.")}finally{t(!1)}},[c,e,n,r,o,a]),isSaving:e,isDirty:s,lastSaved:i}}const uI={};function dI(e){return e==null||e===""||Array.isArray(e)&&e.length===0}function fI(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 y={...u.metadata??{},...t[u.id]??{}},p=Sh(g,y,uI,f,s).filter(v=>v.required&&v.visible!==!1&&v.inputType!=="appIcon"&&dI(v.currentValue)).map(v=>v.label);p.length>0&&i.push({nodeId:u.id,nodeName:u.name||"Untitled",missing:p})}(d=u.children)!=null&&d.length&&o(u.children,!1)}};return o(e,!0),i}function hI(e){const t=oe(f=>f.editorConfig),r=oe(f=>f.setButtonLoader),n=oe(f=>f.validateAllForms),s=oe(f=>f.rootFormConfig),i=oe(f=>f.unitFormConfig),o=Ie(f=>f.treeData),a=Ie(f=>f.treeCache),c=Ie(f=>f.selectNode),d=h.useCallback(()=>{var p,v,m;const f={editorMode:"edit",objectType:(p=t==null?void 0:t.config)==null?void 0:p.objectType,userFullName:(m=(v=t==null?void 0:t.context)==null?void 0:v.user)==null?void 0:m.fullName},g=fI(o,a,s,i,f);if(g.length===0)return!0;const y=g[0];Oe.error(`"${y.nodeName}": please fill required field${y.missing.length>1?"s":""} — ${y.missing.join(", ")}`);const{setFormStatus:_}=oe.getState();return g.forEach(b=>_(b.nodeId,!1)),c(y.nodeId),!1},[o,a,s,i,t,c]);return{runAction:h.useCallback(async(f,g)=>{var p,v,m,b;const y=((p=t==null?void 0:t.context)==null?void 0:p.contentId)??((v=t==null?void 0:t.context)==null?void 0:v.identifier)??"";if(!y)return Oe.error("No content identifier found."),!1;const _=((m=t==null?void 0:t.context)==null?void 0:m.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_(y),Oe.success("Content sent for review"),!0):(Oe.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 o_(y,S),Oe.success("Content rejected and sent back to the author"),!0}case"publish":return d()?n(o)?(r("publishCollection",!0),await e(),await n_(y,_),Oe.success("Content published successfully"),!0):(Oe.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 Oe.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 Ft={shell:"_shell_90fon_1",workspace:"_workspace_90fon_8",sidebarCollapsed:"_sidebarCollapsed_90fon_16",dockCollapsed:"_dockCollapsed_90fon_19",dock:"_dock_90fon_19",outline:"_outline_90fon_40",reopenTab:"_reopenTab_90fon_45",outlineHidden:"_outlineHidden_90fon_79",editor:"_editor_90fon_86",dockHidden:"_dockHidden_90fon_101",dockReopenTab:"_dockReopenTab_90fon_108",dragChip:"_dragChip_90fon_133",dragChipLabel:"_dragChipLabel_90fon_148"},pI=({editorMode:e,onToolbarEvent:t,onContentAdded:r,onHierarchySaved:n})=>{const[s,i]=h.useState(null),[o,a]=h.useState(!1),[c,d]=h.useState(!1),[u,f]=h.useState(!1),{addResource:g,treeData:y}=Ie(),_=oe(L=>L.setFormStatus),[p,v]=h.useState(!0),m=Ie(L=>L.selectedNodeId),{save:b,isSaving:S,isDirty:w,lastSaved:E}=cI(),{runAction:D,checkRequiredFields:x}=hI(b);h.useEffect(()=>{if(!w)return;const L=j=>{j.preventDefault(),j.returnValue=""};return window.addEventListener("beforeunload",L),()=>window.removeEventListener("beforeunload",L)},[w]);const A=sc(xo(di,{activationConstraint:{distance:8}})),$=h.useCallback(L=>{var X;const j=(X=L.active.data.current)==null?void 0:X.item;j&&i(j)},[]),N=h.useCallback(L=>{var be,z;i(null);const j=(be=L.active.data.current)==null?void 0:be.item;if(!j)return;const X=L.over,se=(X==null?void 0:X.id)??m??void 0;if(!se){Oe.error("Drop onto a unit to add content");return}const xe=(z=y[0])==null?void 0:z.id;if(se===xe){Oe.error("Drop content onto a unit, not directly on the course.");return}if(!g(j,se)){Oe.error(`"${j.name}" is already in this collection`);return}r==null||r(j,se),Oe.success(`Added "${j.name}" to unit`)},[m,g,r]),M=h.useCallback(async L=>{if(L.action==="onFormStatusChange"){const{isValid:j,nodeId:X}=L.data??{},se=j!==!1;v(se),X&&_(X,se);return}if(L.action==="back"&&w&&e==="edit"){f(!0);return}if(L.action==="saveCollection"){if(!p){Oe.error("Please fill the required metadata");return}if(!x())return;await b(),n==null||n(y),t==null||t(L);return}if(L.action==="sendForReview"||L.action==="reject"||L.action==="publish"){await D(L.action,L.data)&&(t==null||t(L));return}t==null||t(L)},[b,D,x,t,n,y,w,p,e]),U=h.useCallback(async()=>{if(!x()){f(!1);return}await b(),f(!1),n==null||n(y),t==null||t({action:"back"})},[b,x,n,t,y]),P=h.useCallback(()=>{f(!1),t==null||t({action:"back"})},[t]);return l.jsxs(Mc,{sensors:A,onDragStart:$,onDragEnd:N,children:[l.jsxs("div",{className:Ft.shell,children:[l.jsx(v_,{editorMode:e,isSaving:S,isDirty:w,lastSaved:E,isFormValid:p,onToolbarEvent:M}),l.jsxs("div",{className:[Ft.workspace,o?Ft.sidebarCollapsed:"",c?Ft.dockCollapsed:""].filter(Boolean).join(" "),children:[l.jsx("aside",{className:[Ft.outline,o?Ft.outlineHidden:""].join(" "),"aria-label":"Course outline","aria-hidden":o,children:l.jsx(V1,{editorMode:e,collapsed:o,onToggleCollapse:()=>a(L=>!L)})}),o&&l.jsx("button",{className:Ft.reopenTab,onClick:()=>a(!1),title:"Show outline",type:"button",children:"›"}),l.jsx("main",{className:Ft.editor,role:"main","aria-label":"Content editor",children:l.jsx(GO,{editorMode:e,onToolbarEvent:M})}),l.jsx("aside",{className:[Ft.dock,c?Ft.dockHidden:""].filter(Boolean).join(" "),"aria-label":"Content library","aria-hidden":c,children:l.jsx(aI,{editorMode:e,collapsed:c,onToggleCollapse:()=>d(L=>!L)})}),c&&l.jsx("button",{className:Ft.dockReopenTab,onClick:()=>d(!1),title:"Show library",type:"button",children:"‹"})]})]}),l.jsx(pv,{dropAnimation:null,children:s?l.jsx("div",{className:Ft.dragChip,children:l.jsx("span",{className:Ft.dragChipLabel,children:s.name})}):null}),u&&l.jsx(m_,{onSave:U,onDiscard:P,onCancel:()=>f(!1),isSaving:S})]})},gI="v1";function yI(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 Yh(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:yI(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 xr(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(Yh(o,s))}else n.code&&r.push(Yh(n));return r}function vI(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 mI(e,t,r="Collection",n=gI){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:xr(o.create),unitForm:xr(o.unitMetadata),childForm:xr(o.childMetadata),searchForm:xr(o.search??o.searchConfig),relationalForm:xr(o.relationalMetadata),publishChecklist:xr(o.publishchecklist),reviewChecklist:xr(o.review),rfcChecklist:xr(o.requestforchangeschecklist),schemaDefaults:vI(a.schema),frameworkMetadata:c.frameworkMetadata??{},sourcingSettings:c.sourcingSettings??{}}}function bI({config:e,onError:t}){const[r,n]=h.useState(!0),[s,i]=h.useState(null),[o,a]=h.useState(!1),{setEditorConfig:c,setEditorMode:d,setCategoryDefinition:u,setContentFramework:f}=oe(),{setTreeData:g,selectNode:y}=Ie();return h.useEffect(()=>{let _=!1;async function p(){var v,m;try{n(!0),i(null),e.apiBaseUrl&&Ru(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 t_(b):await Ju(b);if(!_&&(g(w?[w]:[]),w)){y(w.id);const $=w.metadata??{},N=$.framework??e.context.framework??null,M=$.targetFWIds??e.context.targetFWIds??null;f(N,M)}const E=e.config.primaryCategory??"Course",D=e.context.channel??"",x=e.config.categoryDefinitionApiVersion??"v1";try{const A=await mI(E,D,e.config.objectType??"Collection",x);if(!_){u(A);const $=((v=A.sourcingSettings)==null?void 0:v.collection)??{},N={};$.maxDepth&&!e.config.maxDepth&&(N.maxDepth=$.maxDepth),$.children&&!e.config.children&&(N.children=$.children),$.hierarchy&&!((m=e.config.hierarchy)!=null&&m.level1)&&(N.hierarchy={...e.config.hierarchy??{},...$.hierarchy}),Object.keys(N).length>0&&c({...e,config:{...e.config,...N}})}}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 p(),()=>{_=!0}},[e.context.contentId,e.context.identifier]),{isLoading:r,error:s,isReady:o}}const Ls={root:"_root_qcpw6_1",loadingState:"_loadingState_qcpw6_10",loadingSpinner:"_loadingSpinner_qcpw6_20",errorState:"_errorState_qcpw6_34"},_I=new Up({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}});class wI extends h.Component{constructor(t){super(t),this.state={error:null}}static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t){var r,n;(n=(r=this.props).onError)==null||n.call(r,t)}render(){return this.state.error?l.jsxs("div",{className:Ls.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 SI(e){const{isLoading:t,error:r}=bI({config:e,onError:e.onError}),n=oe(s=>s.editorMode);return t?l.jsxs("div",{className:Ls.loadingState,children:[l.jsx("div",{className:Ls.loadingSpinner}),l.jsx("p",{children:"Loading editor..."})]}):r?l.jsxs("div",{className:Ls.errorState,children:[l.jsx("h3",{children:"Failed to load editor"}),l.jsx("p",{children:r.message})]}):l.jsx("div",{className:`sb-split-builder ${Ls.root}`,children:l.jsx(pI,{editorMode:n,onToolbarEvent:e.onToolbarEvent,onContentAdded:e.onContentAdded,onHierarchySaved:e.onHierarchySaved})})}const Xh=e=>l.jsx(wI,{onError:e.onError,children:l.jsxs(qp,{client:_I,children:[l.jsx(SI,{...e}),l.jsx(Vg,{position:"top-right",toastOptions:{duration:3e3}})]})}),lo=Symbol.for("r2wc.reactRender"),Zh=Symbol.for("r2wc.shouldRender"),co=Symbol.for("r2wc.root");function CI(e=""){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function EI(e=""){return e.replace(/-([a-z0-9])/g,function(t){return t[1].toUpperCase()})}var Jh={expando:function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:function(){return r},set:function(n){r=n,this[lo]()}}),e[lo]()}};function OI(e,t,r,n={}){var s={isConnected:"isConnected"in HTMLElement.prototype},i=!1,o=function(){var d=Reflect.construct(HTMLElement,arguments,this.constructor);return typeof n.shadow=="string"?d.attachShadow({mode:n.shadow}):n.shadow&&(console.warn('Specifying the "shadow" option as a boolean is deprecated and will be removed in a future version.'),d.attachShadow({mode:"open"})),d},a=Object.create(HTMLElement.prototype);a.constructor=o;var c=new Proxy(a,{has:function(d,u){return u in e.propTypes||u in a},set:function(d,u,f,g){return i&&(s[u]=!0),typeof u=="symbol"||s[u]||u in d?(e.propTypes&&u in e.propTypes&&Jh.expando(g,u,f),Reflect.set(d,u,f,g)):(Jh.expando(g,u,f),!0)},getOwnPropertyDescriptor:function(d,u){var f=Reflect.getOwnPropertyDescriptor(d,u);if(f)return f;if(u in e.propTypes)return{configurable:!0,enumerable:!0,writable:!0,value:void 0}}});return o.prototype=c,a.connectedCallback=function(){this[Zh]=!0,this[lo]()},a.disconnectedCallback=function(){typeof r.createRoot=="function"?this[co].unmount():r.unmountComponentAtNode(this)},a[lo]=function(){if(this[Zh]===!0){var d={};Object.keys(this).forEach(function(g){s[g]!==!1&&(d[g]=this[g])},this),i=!0;const u=n.shadow?this.shadowRoot:this,f=t.createElement(e,d);typeof r.createRoot=="function"?(this[co]||(this[co]=r.createRoot(u)),this[co].render(f)):r.render(f,u),i=!1}},e.propTypes&&(o.observedAttributes=n.dashStyleAttributes?Object.keys(e.propTypes).map(function(d){return CI(d)}):Object.keys(e.propTypes),a.attributeChangedCallback=function(d,u,f){var g=n.dashStyleAttributes?EI(d):d;this[g]=f}),o}var Fs={},$s=Pe;if(process.env.NODE_ENV==="production")Fs.createRoot=$s.createRoot,Fs.hydrateRoot=$s.hydrateRoot;else{var uo=$s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;Fs.createRoot=function(e,t){uo.usingClientEntryPoint=!0;try{return $s.createRoot(e,t)}finally{uo.usingClientEntryPoint=!1}},Fs.hydrateRoot=function(e,t,r){uo.usingClientEntryPoint=!0;try{return $s.hydrateRoot(e,t,r)}finally{uo.usingClientEntryPoint=!1}}}function II(){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 DI(e="sb-collection-editor"){if(II(),typeof customElements>"u"||customElements.get(e))return;const t=OI(Xh,h,Fs,{});customElements.define(e,t)}pe.CollectionEditor=Xh,pe.registerCollectionEditor=DI,pe.setApiBaseUrl=Ru,pe.useEditorStore=oe,pe.useLibraryStore=Kh,pe.useTreeStore=Ie,Object.defineProperty(pe,Symbol.toStringTag,{value:"Module"})});
488
+ */var ld;function ov(){return ld||(ld=1,process.env.NODE_ENV!=="production"&&function(){function e(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=h,r=os(),n=typeof Object.is=="function"?Object.is:e,o=r.useSyncExternalStore,a=t.useRef,i=t.useEffect,s=t.useMemo,l=t.useDebugValue;as.useSyncExternalStoreWithSelector=function(d,f,u,m,g){var w=a(null);if(w.current===null){var p={hasValue:!1,value:null};w.current=p}else p=w.current;w=s(function(){function v(I){if(!b){if(b=!0,C=I,I=m(I),g!==void 0&&p.hasValue){var k=p.value;if(g(k,I))return S=k}return S=I}if(k=S,n(C,I))return k;var x=m(I);return g!==void 0&&g(k,x)?(C=I,k):(C=I,S=x)}var b=!1,C,S,T=u===void 0?null:u;return[function(){return v(f())},T===null?void 0:function(){return v(T())}]},[f,u,m,g]);var y=o(d,w[0],w[1]);return i(function(){p.hasValue=!0,p.value=y},[y]),l(y),y},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),as}process.env.NODE_ENV==="production"?es.exports=nv():es.exports=ov();var av=es.exports;const iv=nd(av),cd={},{useDebugValue:sv}=h,{useSyncExternalStoreWithSelector:lv}=iv;let dd=!1;const cv=e=>e;function dv(e,t=cv,r){(cd?"production":void 0)!=="production"&&r&&!dd&&(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"),dd=!0);const n=lv(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,r);return sv(n),n}const ud=e=>{(cd?"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"?ev(e):e,r=(n,o)=>dv(t,n,o);return Object.assign(r,t),r},yo=e=>e?ud(e):ud,ce=yo(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=ce.getState().formStatusMapper,n=[...t];for(;n.length>0;){const o=n.shift();if(r[o.id]===!1)return!1;o.children&&n.push(...o.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}})})),uv=Object.freeze(Object.defineProperty({__proto__:null,useEditorStore:ce},Symbol.toStringTag,{value:"Module"}));function Rr(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 fd(e,t,r=0){var n;for(const o of e){if(o.id===t)return r;if((n=o.children)!=null&&n.length){const a=fd(o.children,t,r+1);if(a>=0)return a}}return-1}const fv=new Set(["name","appIcon","description","keywords","trackable","qrCodeProcessId","reservedDialcodes"]);function hd(e,t,r){return e.map(n=>{if(n.id===t){const o=r.metadata??{},a={};for(const i of fv)i in r&&(a[i]=r[i]);return{...n,...r,metadata:{...n.metadata??{},...a,...o}}}return n.children&&n.children.length>0?{...n,children:hd(n.children,t,r)}:n})}function Sa(e,t,r){return e.map(n=>n.id===t?{...n,children:[...n.children??[],r]}:n.children&&n.children.length>0?{...n,children:Sa(n.children,t,r)}:n)}function is(e,t){return e.filter(r=>r.id!==t).map(r=>({...r,children:r.children?is(r.children,t):[]}))}function pd(e,t,r,n){return e.map(o=>{if(o.id===t){const a=[...o.children??[]],[i]=a.splice(r,1);return a.splice(n,0,i),{...o,children:a}}return o.children&&o.children.length>0?{...o,children:pd(o.children,t,r,n)}:o})}function gd(e,t){return e.map(r=>{const n=t[r.id]??r.id,o=r.parent?t[r.parent]??r.parent:r.parent;return{...r,id:n,identifier:n,parent:o,children:r.children?gd(r.children,t):[]}})}function hv(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 pv(e,t){const r=Rr(e,t);if(!r)return[];const n=[];let o=r;for(;o;)n.unshift({id:o.id,name:o.name}),o=o.parent?Rr(e,o.parent):void 0;return n}const Ae=yo((e,t)=>({treeData:[],selectedNodeId:null,treeCache:{},breadcrumb:[],activeNodeMeta:{},setTreeData:r=>{var o;const n=((o=r[0])==null?void 0:o.id)??null;e({treeData:r,selectedNodeId:n}),n&&setTimeout(()=>t().selectNode(n),0)},selectNode:r=>{const{treeData:n,treeCache:o,getBreadcrumb:a}=t(),i=Rr(n,r),s=a(r),l={...(i==null?void 0:i.metadata)??{},...o[r]??{}};ce.getState().setNodeFlags({isFolder:(i==null?void 0:i.isFolder)??!1,isRoot:!(i!=null&&i.parent),isQuml:!1}),e({selectedNodeId:r,breadcrumb:s,activeNodeMeta:l})},updateNode:(r,n)=>{e(o=>({treeData:hd(o.treeData,r,n),treeCache:{...o.treeCache,[r]:{...o.treeCache[r]??{},...n}}})),t().markDirty()},addNode:(r,n)=>{var d,f;const o=t(),a=((f=(d=ce.getState().editorConfig)==null?void 0:d.config)==null?void 0:f.maxDepth)??4,i=fd(o.treeData,r);if(i>=a)return console.warn(`[tree.store] addNode: depth would exceed maxDepth (${a}). parentDepth=${i}`),"";const s="temp-"+Math.random().toString(36).slice(2),l={id:s,identifier:s,name:"Untitled Unit",isFolder:!0,children:[],parent:r,metadata:{mimeType:"application/vnd.ekstep.content-collection",code:s,name:"Untitled Unit",visibility:"Parent"}};return e(u=>({treeData:Sa(u.treeData,r,l),treeCache:{...u.treeCache,[s]:{...l.metadata,isNew:!0}}})),setTimeout(()=>t().selectNode(s),0),s},deleteNode:r=>{e(n=>({treeData:is(n.treeData,r),selectedNodeId:n.selectedNodeId===r?null:n.selectedNodeId}))},reorderChildren:(r,n,o)=>{e(a=>({treeData:pd(a.treeData,r,n,o)}))},moveNode:(r,n,o)=>{e(a=>{const i=Rr(a.treeData,r);if(!i)return a;let s=is(a.treeData,r);return s=Sa(s,o,{...i,parent:o}),{treeData:s}}),t().markDirty()},addResource:(r,n)=>{var f,u,m;const o=ce.getState().editorConfig,a=((f=o==null?void 0:o.config)==null?void 0:f.allowContentUnderRoot)??!1,i=(u=t().treeData[0])==null?void 0:u.id;if(!a&&n===i||Rr(t().treeData,r.identifier))return!1;const s=((m=o==null?void 0:o.config)==null?void 0:m.maxContentsLimit)??1200;if(hv(t().treeData)>=s)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(g=>({treeData:Sa(g.treeData,n,d)})),t().markDirty(),!0},markDirty:()=>{const{editorMode:r,setIsDirty:n}=ce.getState();r==="edit"&&n(!0)},replaceNodeIds:r=>{!r||Object.keys(r).length===0||e(n=>{const o=gd(n.treeData,r),a={};for(const[s,l]of Object.entries(n.treeCache)){const d=r[s]??s,{isNew:f,...u}=l;a[d]=u}const i=n.selectedNodeId?r[n.selectedNodeId]??n.selectedNodeId:null;return{treeData:o,treeCache:a,selectedNodeId:i}})},getNodeById:r=>Rr(t().treeData,r),getChildrenOf:r=>{const n=Rr(t().treeData,r);return(n==null?void 0:n.children)??[]},getBreadcrumb:r=>pv(t().treeData,r)})),gv=yo(e=>({activeModal:null,modalData:{},openModal:(t,r={})=>e({activeModal:t,modalData:r}),closeModal:()=>e({activeModal:null,modalData:{}})})),mv={spin:"_spin_1ah4d_9"},ss={contextualEditor:{emptyStateMessage:"Select a unit from the outline to edit its details",reviewCommentLabel:"Reviewer comment:",untitledPlaceholder:"Untitled",nodeTitleAriaLabel:"Node title",dropZoneLabel:"Drop to add content to this unit"},languageSelector:{ariaLabel:"Select language"},collectionEditor:{errorBoundaryTitle:"Something went wrong",retryButton:"Retry",loadingMessage:"Loading editor...",loadErrorTitle:"Failed to load editor"},breadcrumb:{nodePathAriaLabel:"Node path",homeAriaLabel:"Home"},tabBar:{detailsTab:"Details",audienceCurriculumTab:"Audience & Curriculum",licensingTab:"Licensing",metadataSectionsAriaLabel:"Metadata sections",hasErrorsAriaLabel:"Has errors"},contentEditForm:{moveToAnotherUnitButton:"Move to another unit",collapseMetadataPanelAriaLabel:"Collapse metadata panel",expandMetadataPanelAriaLabel:"Expand metadata panel",collapseTitle:"Collapse",expandTitle:"Expand",iconAlt:"icon",contentNamePlaceholder:"Content name",keywordsLabel:"Keywords",addKeywordPlaceholder:"Add keyword and press Enter",addButton:"Add",optionalInCollectionLabel:"Optional in Collection",yesOption:"Yes",noOption:"No"},titleAppIcon:{selectAppIconAriaLabel:"Select app icon",appIconAriaLabel:"App icon",appIconAlt:"App icon",removeIconAriaLabel:"Remove icon"},unitContentList:{removeConfirm:"Remove this content from the unit?",heading:"Content in this unit",emptyTitle:"No content yet",emptyHint:"Drag from the library or click Add content",addContentAriaLabel:"Add content to unit",addContent:"Add content"},contentRow:{dragToReorderAriaLabel:"Drag to reorder",removeAriaLabel:"Remove {name}"},csvUpload:{invalidFileType:"Only .csv files are accepted.",fileTooLarge:"File size must not exceed 50 MB.",downloadSampleFailed:"Failed to download sample CSV.",processingFailed:"Upload processing failed. Please check the error rows below.",connectionLost:"Lost connection while checking status. Please try again.",uploadFailed:"Upload failed. Please check your file and try again.",statusUploading:"Uploading...",statusProcessing:"Processing...",statusDone:"Done!",statusError:"Error",titleUpdate:"Update Folder Metadata via CSV",titleCreate:"Create Folders via CSV",closeAriaLabel:"Close",dropZoneAriaLabel:"Drop CSV file here or click to browse",dropText:"Drag & drop your CSV here",dropSubtext:"or click to browse",downloadSample:"Download Sample CSV",itemsImportedSuffix:"— {count} item(s) imported",failedRowsTitle:"Failed Rows ({count})",rowHeader:"Row",nameHeader:"Name",reasonHeader:"Reason",unknownError:"Unknown error",cancel:"Cancel",uploaded:"Uploaded",upload:"Upload"},manageCollaborators:{saveFailed:"Failed to save collaborators. Please try again.",title:"Manage Collaborators",closeAriaLabel:"Close",searchUsersLabel:"Search users",searchPlaceholder:"Search by name or email...",searchingAriaLabel:"Searching...",searchResultsAriaLabel:"Search results",add:"Add",noUsersFound:"No users found.",currentCollaborators:"Current Collaborators",noCollaboratorsYet:"No collaborators added yet.",remove:"Remove",saveSuccess:"Collaborators saved successfully.",cancel:"Cancel",save:"Save"},sparkMetaForm:{shuffleEnabledMessage:"Shuffling is enabled for this question set.",noFieldsMessage:"No fields configured for this tab."},appIconField:{requiredError:"{field} is required",selectIconAriaLabel:"Select app icon",iconAlt:"App icon",selectIconLabel:"Select icon",removeIconAriaLabel:"Remove app icon",removeLabel:"Remove"},appIconPickerModal:{dialogAriaLabel:"Select App Icon",title:"Select App Icon",closeAriaLabel:"Close",myImagesTab:"My Images",allImagesTab:"All Images",uploadTab:"Upload",searchPlaceholder:"Search images…",loadingText:"Loading…",noImagesFound:"No images found",noThumbnailText:"IMG",loadMoreButton:"Load More",previewAlt:"Preview",dropZoneText:"Drag & drop or click to browse",acceptedTypesInfo:"{types} · max {size} MB",cancelButton:"Cancel",uploadingText:"Uploading…",uploadAndUseButton:"Upload & Use",useSelectedButton:"Use Selected",invalidFileTypeError:"Only {types} files are accepted.",fileTooLargeError:"Image must be under {size} MB.",uploadFailedError:"Upload failed."},chipGroupField:{addPlaceholder:"Add…",addButtonLabel:"Add"},dateTimeField:{requiredError:"{field} is required"},dialcodeInputField:{requiredError:"{field} is required",enterCodeMessage:"Enter a dial code to validate.",validMessage:"Dial code is valid.",notFoundMessage:"Dial code not found.",validationFailedMessage:"Validation failed. Please try again.",placeholderExample:"e.g. A1B2C3",validateAriaLabel:"Validate dial code",validatingLabel:"Validating…",validateButtonLabel:"Validate"},keywordSuggestField:{requiredError:"{field} is required",inputPlaceholder:"Type and press Enter or comma…"},licenseSelectField:{requiredError:"{field} is required",selectPlaceholder:"Select license…"},multiSelectField:{requiredError:"{field} is required",selectedCountSuffix:"selected",selectPlaceholder:"Select…",noOptionsMessage:"No options"},nestedSelectField:{requiredError:"{field} is required",selectPlaceholder:"Select…"},radioField:{requiredError:"{field} is required"},selectField:{requiredError:"{field} is required",selectPlaceholder:"Select…",noOptionsMessage:"No options"},textField:{requiredError:"{field} is required",maxLengthError:"Max {max} characters"},assetBrowser:{dialogAriaLabel:"Asset Browser",title:"Asset Browser",closeAriaLabel:"Close",browseTab:"Browse",uploadTab:"Upload",searchPlaceholder:"Search assets...",searchButton:"Search",loadingMessage:"Loading...",uploadingMessage:"Uploading...",chooseFileButton:"Choose file to upload"},resourceReorderDialog:{dialogAriaLabel:"Move resource",moveHeaderPrefix:"Move",closeAriaLabel:"Close",selectUnitHint:"Select a unit to move this content to:",noUnitsAvailable:"No other units available",cancelButton:"Cancel",moveButton:"Move here"},assignPageNumber:{dialogAriaLabel:"Assign Page Numbers",title:"Assign Page Numbers",closeAriaLabel:"Close",emptyState:"No content items found in this collection.",contentColumnHeader:"Content",pageNumberColumnHeader:"Page Number",cancelButton:"Cancel",saveButton:"Save"},confirmDialog:{confirmButton:"Confirm",cancelButton:"Cancel",closeAriaLabel:"Close"},publishChecklist:{publishTitlePrefix:"Publish",closeAriaLabel:"Close",confirmPublishPrefix:"Are you sure you want to publish this",checklistInstructions:"Please confirm that ALL the following items are verified (by ticking the check-boxes) before you can publish:",noButton:"No",yesButton:"Yes"},qualityParamsModal:{reviewQualityTitle:"Review Quality",rejectContentTitle:"Reject Content",closeAriaLabel:"Close",qualityScoreLabel:"Quality Score",scorePoorLabel:"0 — Poor",scoreExcellentLabel:"10 — Excellent",commentLabel:"Comment",optionalLabel:"(optional)",commentPlaceholder:"Add any notes for the content creator…",rejectionReasonLabel:"Rejection Reason",rejectReasonPlaceholder:"Describe why this content is being rejected…",rejectionRequiredMessage:"A rejection reason is required.",cancelButton:"Cancel",approveButton:"Approve",rejectButton:"Reject"},unsavedChangesModal:{title:"Unsaved changes",closeAriaLabel:"Close",bodyMessage:"You have unsaved changes. Would you like to save them before leaving?",cancelButton:"Cancel",discardButton:"Discard",saveButton:"Save"},filterChips:{contentTypeFiltersAriaLabel:"Content type filters"},libraryCard:{alreadyAddedAriaLabel:"Already added",alreadyAddedTitle:"Already added to this collection",addItemAriaLabel:"Add {name} to unit",addToUnitTitle:"Add to unit",selectUnitToAddTitle:"Select a unit to add",draftOnlyTitle:"Only Draft content can be added"},libraryDock:{selectUnitFirstToast:"Select a unit first",selectUnitFromOutlineToast:"Select a unit from the outline to add content — resources cannot be added directly to the course.",itemAlreadyAddedToast:'"{name}" is already in this collection',itemAddedToast:'Added "{name}"',collapseLibraryPanelAriaLabel:"Collapse library panel",collapseLibraryTitle:"Collapse library",headerTitle:"Library",searchPlaceholder:"Search content…",searchAriaLabel:"Search library",sortAZAriaLabel:"Sort: A–Z (click for Recent)",sortRecentAriaLabel:"Sort: Recent (click for A–Z)",sortAZTitle:"A–Z",sortRecentTitle:"Recent",toggleAdvancedFiltersAriaLabel:"Toggle advanced filters",advancedFiltersTitle:"Advanced filters",libraryContentAriaLabel:"Library content",loadMoreAriaLabel:"Load more content",loadingText:"Loading…",loadMoreText:"Load More",noContentFound:"No content found",tryDifferentSearch:"Try a different search or filter"},libraryFilterPanel:{boardLabel:"Board",mediumLabel:"Medium",classLabel:"Class",subjectLabel:"Subject",primaryCategoryLabel:"Primary Category",filterLibraryAriaLabel:"Filter library",filtersHeaderTitle:"Filters",closeFiltersAriaLabel:"Close filters",resetButton:"Reset",applyButton:"Apply"},libraryPreviewPanel:{contentPreviewAriaLabel:"Content preview",closePreviewAriaLabel:"Close preview",addToUnitButton:"+ Add to Unit"},outlineTree:{maxDepthReachedToast:"Maximum depth reached",downloadCsvFailedToast:"Failed to download CSV",outlineRefreshedToast:"Course outline refreshed.",outlineRefreshFailedToast:"Outline could not be refreshed automatically. Please reload the page.",moreOptionsAriaLabel:"More options",moreOptionsTitle:"More options",foldersExistTitle:'Folders already exist — use "Update" instead',createFoldersCsvButton:"Create folders using csv file",noFoldersYetTitle:'No folders yet — use "Create" first',downloadFoldersCsvButton:"Download folders as csv file",updateFoldersCsvButton:"Update folder metadata using csv file",expandOutlineAriaLabel:"Expand outline",collapseOutlineAriaLabel:"Collapse outline",addUnitButton:"Add Unit",addSubunitButton:"Add Sub-unit"},treeNode:{expandAriaLabel:"Expand",collapseAriaLabel:"Collapse",dropHereLabel:"Drop here",nodeOptionsAriaLabel:"Node options",renameMenuItem:"Rename",addSubunitMenuItem:"Add sub-unit",addSiblingMenuItem:"Add Sibling",deleteMenuItem:"Delete"},contentPlayer:{mimeLabelVideo:"Video",mimeLabelAudio:"Audio",mimeLabelPdf:"PDF",mimeLabelEpub:"ePub",mimeLabelEcml:"ECML",mimeLabelH5p:"H5P",mimeLabelScorm:"SCORM",mimeLabelOther:"Content",infoFieldAuthor:"Author",infoFieldLicense:"License",infoFieldLanguage:"Language",infoFieldClass:"Class",infoFieldSubject:"Subject",infoFieldType:"Type",loadingPreview:"Loading preview…",previewPlayerUnavailable:"Preview player unavailable. Check that /content/preview is reachable.",failedToInitializePlayer:"Failed to initialize the content player.",previewPlayerLoadFailed:"Preview player could not be loaded.",unableToLoadQuestionset:"Unable to load questionset:",parentQuestionsetNotResolved:"Could not resolve the parent questionset for this question.",questionNotFoundInQuestionset:"Question not found in the questionset."},dialcodePanel:{title:"QR Code (Dialcode)",invalidFormatError:"Invalid DIAL code format. Use uppercase letters and digits only (e.g. A1B2C3).",duplicateDialcodeError:'DIAL code "{code}" is already linked to another node in this collection.',dialcodeNotFoundError:"Dialcode not found. Please enter a valid code.",linkFailedError:"Failed to link dialcode. Please try again.",unlinkFailedError:"Failed to remove dialcode. Please try again.",qrCodeAltPrefix:"QR code for",linkedCodeLabel:"Linked code:",removeButton:"Remove",noCodeLinkedMessage:"No QR code linked to this content.",linkManuallyLabel:"Link manually",dialcodeInputPlaceholder:"Enter dialcode (e.g. A1B2C3)",dialcodeInputAriaLabel:"Dialcode input",linkButton:"Link",linkedSuccessMessage:"Dialcode linked successfully."},progressStatus:{unitsAddedLabel:"Units added",contentItemsLabel:"Content items",progressLabel:"Progress"},splitBuilderShell:{dropOntoUnitError:"Drop onto a unit to add content",dropOntoCourseError:"Drop content onto a unit, not directly on the course.",alreadyInCollectionError:'"{name}" is already in this collection',addedToUnitSuccess:'Added "{name}" to unit',fillRequiredMetadataError:"Please fill the required metadata",outlineAriaLabel:"Course outline",showOutlineTitle:"Show outline",editorAriaLabel:"Content editor",libraryAriaLabel:"Content library",showLibraryTitle:"Show library"},topbar:{draftStatusFallback:"Draft",backAriaLabel:"Go back",statusAriaLabelPrefix:"Status:",savingIndicator:"Saving…",unsavedIndicator:"Unsaved",savedIndicatorPrefix:"Saved",fillRequiredFieldsTooltip:"Fill all required fields before saving",saveAsDraftButton:"Save as Draft",sendForReviewButton:"Send for review",collaboratorsLabel:"Collaborators",qrCodesLabel:"QR Codes",generatingEllipsis:"Generating…",generateQrCodesMenuItem:"Generate QR Codes",downloadingEllipsis:"Downloading…",downloadQrCodesMenuItem:"Download QR Codes",publishButton:"Publish",requestForChangesButton:"Request for Changes",approveButton:"Approve",qrGenerationStartedToast:'QR Codes generation started. Use "Download QR Codes" once ready.',qrGenerationFailedToast:"Failed to generate QR Codes. Please try again.",qrCodesNotGeneratedToast:"No QR codes generated yet. Generate QR Codes first.",qrGenerationInProgressToast:"QR code image generation is in progress. Please try downloading after some time.",qrCodesNotReadyToast:"QR Codes not ready yet. Please wait and try again.",qrCodesDownloadedToast:"QR codes downloaded.",qrCodesDownloadFailedToast:"Failed to download QR Codes.",requestChangesTitle:"Request Changes",changesRequestedLabel:"Changes requested",describeChangesPlaceholder:"Describe the changes the author needs to make"},reviewCommentModal:{closeAriaLabel:"Close",fillCommentsError:"Fill comments",cancelButton:"Cancel"},confirmReviewModal:{closeAriaLabel:"Close",title:"Accepting Terms & Conditions",agreementTextPart1:"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",creativeCommonsLinkText:"Creative Commons Framework",agreementTextPart2:"in accordance with the",contentPolicyText:"Content Policy",agreementTextPart3:". I have made sure that I do not violate others' copyright or privacy rights.",cancelButton:"Cancel",submitButton:"Submit"},generateQRModal:{closeAriaLabel:"Close",title:"Generate QR Codes",numberOfCodesLabel:"Number of QR Codes",countPlaceholder:"Enter number (2–250)",countRangeError:"Enter a number between 2 and 250.",cancelButton:"Cancel",generateButton:"Generate"},chip:{remove:"Remove"},dropZone:{dropHere:"Drop here"},spinner:{loading:"Loading"}},yv={contextualEditor:{emptyStateMessage:"اختر وحدة من المخطط التفصيلي لتحرير تفاصيلها",reviewCommentLabel:"تعليق المراجع:",untitledPlaceholder:"بدون عنوان",nodeTitleAriaLabel:"عنوان العنصر",dropZoneLabel:"أفلت هنا لإضافة محتوى إلى هذه الوحدة"},languageSelector:{ariaLabel:"اختيار اللغة"},collectionEditor:{errorBoundaryTitle:"حدث خطأ ما",retryButton:"إعادة المحاولة",loadingMessage:"جارٍ تحميل المحرر...",loadErrorTitle:"فشل تحميل المحرر"},breadcrumb:{nodePathAriaLabel:"مسار العنصر",homeAriaLabel:"الصفحة الرئيسية"},tabBar:{detailsTab:"التفاصيل",audienceCurriculumTab:"الجمهور والمنهج",licensingTab:"الترخيص",metadataSectionsAriaLabel:"أقسام البيانات الوصفية",hasErrorsAriaLabel:"يحتوي على أخطاء"},contentEditForm:{moveToAnotherUnitButton:"نقل إلى وحدة أخرى",collapseMetadataPanelAriaLabel:"طي لوحة البيانات الوصفية",expandMetadataPanelAriaLabel:"توسيع لوحة البيانات الوصفية",collapseTitle:"طي",expandTitle:"توسيع",iconAlt:"أيقونة",contentNamePlaceholder:"اسم المحتوى",keywordsLabel:"الكلمات المفتاحية",addKeywordPlaceholder:"أضف كلمة مفتاحية واضغط Enter",addButton:"إضافة",optionalInCollectionLabel:"اختياري في المجموعة",yesOption:"نعم",noOption:"لا"},titleAppIcon:{selectAppIconAriaLabel:"اختيار أيقونة التطبيق",appIconAriaLabel:"أيقونة التطبيق",appIconAlt:"أيقونة التطبيق",removeIconAriaLabel:"إزالة الأيقونة"},unitContentList:{removeConfirm:"هل تريد إزالة هذا المحتوى من الوحدة؟",heading:"المحتوى في هذه الوحدة",emptyTitle:"لا يوجد محتوى بعد",emptyHint:"اسحب من المكتبة أو انقر فوق إضافة محتوى",addContentAriaLabel:"إضافة محتوى إلى الوحدة",addContent:"إضافة محتوى"},contentRow:{dragToReorderAriaLabel:"اسحب لإعادة الترتيب",removeAriaLabel:"إزالة {name}"},csvUpload:{invalidFileType:"يُقبل فقط ملفات .csv.",fileTooLarge:"يجب ألا يتجاوز حجم الملف 50 ميجابايت.",downloadSampleFailed:"فشل تنزيل نموذج ملف CSV.",processingFailed:"فشلت معالجة التحميل. يرجى التحقق من صفوف الأخطاء أدناه.",connectionLost:"انقطع الاتصال أثناء التحقق من الحالة. يرجى المحاولة مرة أخرى.",uploadFailed:"فشل التحميل. يرجى التحقق من الملف والمحاولة مرة أخرى.",statusUploading:"جارٍ التحميل...",statusProcessing:"جارٍ المعالجة...",statusDone:"تم!",statusError:"خطأ",titleUpdate:"تحديث بيانات المجلدات الوصفية عبر CSV",titleCreate:"إنشاء مجلدات عبر CSV",closeAriaLabel:"إغلاق",dropZoneAriaLabel:"أفلت ملف CSV هنا أو انقر للتصفح",dropText:"اسحب وأفلت ملف CSV هنا",dropSubtext:"أو انقر للتصفح",downloadSample:"تنزيل نموذج CSV",itemsImportedSuffix:"— تم استيراد {count} عنصر (عناصر)",failedRowsTitle:"الصفوف الفاشلة ({count})",rowHeader:"الصف",nameHeader:"الاسم",reasonHeader:"السبب",unknownError:"خطأ غير معروف",cancel:"إلغاء",uploaded:"تم التحميل",upload:"تحميل"},manageCollaborators:{saveFailed:"فشل حفظ المتعاونين. يرجى المحاولة مرة أخرى.",title:"إدارة المتعاونين",closeAriaLabel:"إغلاق",searchUsersLabel:"البحث عن المستخدمين",searchPlaceholder:"البحث بالاسم أو البريد الإلكتروني...",searchingAriaLabel:"جارٍ البحث...",searchResultsAriaLabel:"نتائج البحث",add:"إضافة",noUsersFound:"لم يتم العثور على مستخدمين.",currentCollaborators:"المتعاونون الحاليون",noCollaboratorsYet:"لم تتم إضافة أي متعاونين بعد.",remove:"إزالة",saveSuccess:"تم حفظ المتعاونين بنجاح.",cancel:"إلغاء",save:"حفظ"},sparkMetaForm:{shuffleEnabledMessage:"تم تفعيل الترتيب العشوائي لهذه المجموعة من الأسئلة.",noFieldsMessage:"لا توجد حقول مُهيَّأة لهذا التبويب."},appIconField:{requiredError:"{field} مطلوب",selectIconAriaLabel:"اختيار أيقونة التطبيق",iconAlt:"أيقونة التطبيق",selectIconLabel:"اختيار أيقونة",removeIconAriaLabel:"إزالة أيقونة التطبيق",removeLabel:"إزالة"},appIconPickerModal:{dialogAriaLabel:"اختيار أيقونة التطبيق",title:"اختيار أيقونة التطبيق",closeAriaLabel:"إغلاق",myImagesTab:"صوري",allImagesTab:"جميع الصور",uploadTab:"تحميل",searchPlaceholder:"البحث في الصور…",loadingText:"جارٍ التحميل…",noImagesFound:"لم يتم العثور على صور",noThumbnailText:"صورة",loadMoreButton:"تحميل المزيد",previewAlt:"معاينة",dropZoneText:"اسحب وأفلت أو انقر للتصفح",acceptedTypesInfo:"{types} · بحد أقصى {size} ميجابايت",cancelButton:"إلغاء",uploadingText:"جارٍ التحميل…",uploadAndUseButton:"تحميل واستخدام",useSelectedButton:"استخدام المحدد",invalidFileTypeError:"يُقبل فقط ملفات {types}.",fileTooLargeError:"يجب أن يكون حجم الصورة أقل من {size} ميجابايت.",uploadFailedError:"فشل التحميل."},chipGroupField:{addPlaceholder:"إضافة…",addButtonLabel:"إضافة"},dateTimeField:{requiredError:"{field} مطلوب"},dialcodeInputField:{requiredError:"{field} مطلوب",enterCodeMessage:"أدخل رمز الطلب للتحقق منه.",validMessage:"رمز الطلب صالح.",notFoundMessage:"رمز الطلب غير موجود.",validationFailedMessage:"فشل التحقق. يرجى المحاولة مرة أخرى.",placeholderExample:"مثال: A1B2C3",validateAriaLabel:"التحقق من رمز الطلب",validatingLabel:"جارٍ التحقق…",validateButtonLabel:"تحقق"},keywordSuggestField:{requiredError:"{field} مطلوب",inputPlaceholder:"اكتب واضغط Enter أو فاصلة…"},licenseSelectField:{requiredError:"{field} مطلوب",selectPlaceholder:"اختر ترخيصًا…"},multiSelectField:{requiredError:"{field} مطلوب",selectedCountSuffix:"محدد",selectPlaceholder:"اختر…",noOptionsMessage:"لا توجد خيارات"},nestedSelectField:{requiredError:"{field} مطلوب",selectPlaceholder:"اختر…"},radioField:{requiredError:"{field} مطلوب"},selectField:{requiredError:"{field} مطلوب",selectPlaceholder:"اختر…",noOptionsMessage:"لا توجد خيارات"},textField:{requiredError:"{field} مطلوب",maxLengthError:"الحد الأقصى {max} حرفًا"},assetBrowser:{dialogAriaLabel:"متصفح الأصول",title:"متصفح الأصول",closeAriaLabel:"إغلاق",browseTab:"تصفح",uploadTab:"تحميل",searchPlaceholder:"البحث في الأصول...",searchButton:"بحث",loadingMessage:"جارٍ التحميل...",uploadingMessage:"جارٍ التحميل...",chooseFileButton:"اختر ملفًا للتحميل"},resourceReorderDialog:{dialogAriaLabel:"نقل المورد",moveHeaderPrefix:"نقل",closeAriaLabel:"إغلاق",selectUnitHint:"اختر وحدة لنقل هذا المحتوى إليها:",noUnitsAvailable:"لا توجد وحدات أخرى متاحة",cancelButton:"إلغاء",moveButton:"نقل إلى هنا"},assignPageNumber:{dialogAriaLabel:"تعيين أرقام الصفحات",title:"تعيين أرقام الصفحات",closeAriaLabel:"إغلاق",emptyState:"لم يتم العثور على عناصر محتوى في هذه المجموعة.",contentColumnHeader:"المحتوى",pageNumberColumnHeader:"رقم الصفحة",cancelButton:"إلغاء",saveButton:"حفظ"},confirmDialog:{confirmButton:"تأكيد",cancelButton:"إلغاء",closeAriaLabel:"إغلاق"},publishChecklist:{publishTitlePrefix:"نشر",closeAriaLabel:"إغلاق",confirmPublishPrefix:"هل أنت متأكد من رغبتك في نشر هذا",checklistInstructions:"يرجى تأكيد التحقق من جميع العناصر التالية (بتحديد مربعات الاختيار) قبل أن تتمكن من النشر:",noButton:"لا",yesButton:"نعم"},qualityParamsModal:{reviewQualityTitle:"مراجعة الجودة",rejectContentTitle:"رفض المحتوى",closeAriaLabel:"إغلاق",qualityScoreLabel:"درجة الجودة",scorePoorLabel:"0 — ضعيف",scoreExcellentLabel:"10 — ممتاز",commentLabel:"تعليق",optionalLabel:"(اختياري)",commentPlaceholder:"أضف أي ملاحظات لمنشئ المحتوى…",rejectionReasonLabel:"سبب الرفض",rejectReasonPlaceholder:"اذكر سبب رفض هذا المحتوى…",rejectionRequiredMessage:"سبب الرفض مطلوب.",cancelButton:"إلغاء",approveButton:"قبول",rejectButton:"رفض"},unsavedChangesModal:{title:"تغييرات غير محفوظة",closeAriaLabel:"إغلاق",bodyMessage:"لديك تغييرات غير محفوظة. هل تريد حفظها قبل المغادرة؟",cancelButton:"إلغاء",discardButton:"تجاهل",saveButton:"حفظ"},filterChips:{contentTypeFiltersAriaLabel:"مرشحات نوع المحتوى"},libraryCard:{alreadyAddedAriaLabel:"تمت إضافته مسبقًا",alreadyAddedTitle:"تمت إضافته مسبقًا إلى هذه المجموعة",addItemAriaLabel:"إضافة {name} إلى الوحدة",addToUnitTitle:"إضافة إلى الوحدة",selectUnitToAddTitle:"اختر وحدة للإضافة إليها",draftOnlyTitle:"يمكن إضافة المحتوى المسودة فقط"},libraryDock:{selectUnitFirstToast:"اختر وحدة أولاً",selectUnitFromOutlineToast:"اختر وحدة من المخطط التفصيلي لإضافة محتوى — لا يمكن إضافة الموارد مباشرة إلى الدورة.",itemAlreadyAddedToast:'"{name}" موجود مسبقًا في هذه المجموعة',itemAddedToast:'تمت إضافة "{name}"',collapseLibraryPanelAriaLabel:"طي لوحة المكتبة",collapseLibraryTitle:"طي المكتبة",headerTitle:"المكتبة",searchPlaceholder:"البحث في المحتوى…",searchAriaLabel:"البحث في المكتبة",sortAZAriaLabel:"الترتيب: أ–ي (انقر للأحدث)",sortRecentAriaLabel:"الترتيب: الأحدث (انقر لـ أ–ي)",sortAZTitle:"أ–ي",sortRecentTitle:"الأحدث",toggleAdvancedFiltersAriaLabel:"تبديل المرشحات المتقدمة",advancedFiltersTitle:"المرشحات المتقدمة",libraryContentAriaLabel:"محتوى المكتبة",loadMoreAriaLabel:"تحميل المزيد من المحتوى",loadingText:"جارٍ التحميل…",loadMoreText:"تحميل المزيد",noContentFound:"لم يتم العثور على محتوى",tryDifferentSearch:"جرّب بحثًا أو مرشحًا مختلفًا"},libraryFilterPanel:{boardLabel:"المجلس التعليمي",mediumLabel:"لغة التدريس",classLabel:"الصف",subjectLabel:"المادة",primaryCategoryLabel:"الفئة الأساسية",filterLibraryAriaLabel:"تصفية المكتبة",filtersHeaderTitle:"المرشحات",closeFiltersAriaLabel:"إغلاق المرشحات",resetButton:"إعادة تعيين",applyButton:"تطبيق"},libraryPreviewPanel:{contentPreviewAriaLabel:"معاينة المحتوى",closePreviewAriaLabel:"إغلاق المعاينة",addToUnitButton:"+ إضافة إلى الوحدة"},outlineTree:{maxDepthReachedToast:"تم الوصول إلى الحد الأقصى للعمق",downloadCsvFailedToast:"فشل تنزيل ملف CSV",outlineRefreshedToast:"تم تحديث مخطط الدورة.",outlineRefreshFailedToast:"تعذّر تحديث المخطط التفصيلي تلقائيًا. يرجى إعادة تحميل الصفحة.",moreOptionsAriaLabel:"خيارات إضافية",moreOptionsTitle:"خيارات إضافية",foldersExistTitle:'المجلدات موجودة مسبقًا — استخدم "تحديث" بدلاً من ذلك',createFoldersCsvButton:"إنشاء مجلدات باستخدام ملف csv",noFoldersYetTitle:'لا توجد مجلدات بعد — استخدم "إنشاء" أولاً',downloadFoldersCsvButton:"تنزيل المجلدات كملف csv",updateFoldersCsvButton:"تحديث بيانات المجلدات الوصفية باستخدام ملف csv",expandOutlineAriaLabel:"توسيع المخطط التفصيلي",collapseOutlineAriaLabel:"طي المخطط التفصيلي",addUnitButton:"إضافة وحدة",addSubunitButton:"إضافة وحدة فرعية"},treeNode:{expandAriaLabel:"توسيع",collapseAriaLabel:"طي",dropHereLabel:"أفلت هنا",nodeOptionsAriaLabel:"خيارات العنصر",renameMenuItem:"إعادة تسمية",addSubunitMenuItem:"إضافة وحدة فرعية",addSiblingMenuItem:"إضافة عنصر مماثل",deleteMenuItem:"حذف"},contentPlayer:{mimeLabelVideo:"فيديو",mimeLabelAudio:"صوت",mimeLabelPdf:"PDF",mimeLabelEpub:"ePub",mimeLabelEcml:"ECML",mimeLabelH5p:"H5P",mimeLabelScorm:"SCORM",mimeLabelOther:"محتوى",infoFieldAuthor:"المؤلف",infoFieldLicense:"الترخيص",infoFieldLanguage:"اللغة",infoFieldClass:"الصف",infoFieldSubject:"المادة",infoFieldType:"النوع",loadingPreview:"جارٍ تحميل المعاينة…",previewPlayerUnavailable:"مشغّل المعاينة غير متاح. تحقق من إمكانية الوصول إلى /content/preview.",failedToInitializePlayer:"فشل تهيئة مشغّل المحتوى.",previewPlayerLoadFailed:"تعذّر تحميل مشغّل المعاينة.",unableToLoadQuestionset:"تعذّر تحميل مجموعة الأسئلة:",parentQuestionsetNotResolved:"تعذّر تحديد مجموعة الأسئلة الرئيسية لهذا السؤال.",questionNotFoundInQuestionset:"لم يتم العثور على السؤال في مجموعة الأسئلة."},dialcodePanel:{title:"رمز الاستجابة السريعة (رمز الطلب)",invalidFormatError:"تنسيق رمز DIAL غير صالح. استخدم الأحرف الكبيرة والأرقام فقط (مثال: A1B2C3).",duplicateDialcodeError:'رمز DIAL "{code}" مرتبط مسبقًا بعنصر آخر في هذه المجموعة.',dialcodeNotFoundError:"رمز الطلب غير موجود. يرجى إدخال رمز صالح.",linkFailedError:"فشل ربط رمز الطلب. يرجى المحاولة مرة أخرى.",unlinkFailedError:"فشلت إزالة رمز الطلب. يرجى المحاولة مرة أخرى.",qrCodeAltPrefix:"رمز الاستجابة السريعة لـ",linkedCodeLabel:"الرمز المرتبط:",removeButton:"إزالة",noCodeLinkedMessage:"لا يوجد رمز استجابة سريعة مرتبط بهذا المحتوى.",linkManuallyLabel:"الربط يدويًا",dialcodeInputPlaceholder:"أدخل رمز الطلب (مثال: A1B2C3)",dialcodeInputAriaLabel:"إدخال رمز الطلب",linkButton:"ربط",linkedSuccessMessage:"تم ربط رمز الطلب بنجاح."},progressStatus:{unitsAddedLabel:"الوحدات المضافة",contentItemsLabel:"عناصر المحتوى",progressLabel:"التقدّم"},splitBuilderShell:{dropOntoUnitError:"أفلت على وحدة لإضافة محتوى",dropOntoCourseError:"أفلت المحتوى على وحدة، وليس مباشرة على الدورة.",alreadyInCollectionError:'"{name}" موجود مسبقًا في هذه المجموعة',addedToUnitSuccess:'تمت إضافة "{name}" إلى الوحدة',fillRequiredMetadataError:"يرجى تعبئة البيانات الوصفية المطلوبة",outlineAriaLabel:"مخطط الدورة",showOutlineTitle:"إظهار المخطط التفصيلي",editorAriaLabel:"محرر المحتوى",libraryAriaLabel:"مكتبة المحتوى",showLibraryTitle:"إظهار المكتبة"},topbar:{draftStatusFallback:"مسودة",backAriaLabel:"رجوع",statusAriaLabelPrefix:"الحالة:",savingIndicator:"جارٍ الحفظ…",unsavedIndicator:"غير محفوظ",savedIndicatorPrefix:"تم الحفظ",fillRequiredFieldsTooltip:"عبّئ جميع الحقول المطلوبة قبل الحفظ",saveAsDraftButton:"حفظ كمسودة",sendForReviewButton:"إرسال للمراجعة",collaboratorsLabel:"المتعاونون",qrCodesLabel:"رموز الاستجابة السريعة",generatingEllipsis:"جارٍ الإنشاء…",generateQrCodesMenuItem:"إنشاء رموز استجابة سريعة",downloadingEllipsis:"جارٍ التنزيل…",downloadQrCodesMenuItem:"تنزيل رموز الاستجابة السريعة",publishButton:"نشر",requestForChangesButton:"طلب إجراء تغييرات",approveButton:"قبول",qrGenerationStartedToast:'بدأ إنشاء رموز الاستجابة السريعة. استخدم "تنزيل رموز الاستجابة السريعة" عند الجهوز.',qrGenerationFailedToast:"فشل إنشاء رموز الاستجابة السريعة. يرجى المحاولة مرة أخرى.",qrCodesNotGeneratedToast:"لم يتم إنشاء أي رموز استجابة سريعة بعد. قم بإنشاء رموز الاستجابة السريعة أولاً.",qrGenerationInProgressToast:"إنشاء صور رموز الاستجابة السريعة قيد التنفيذ. يرجى المحاولة بالتنزيل بعد قليل.",qrCodesNotReadyToast:"رموز الاستجابة السريعة ليست جاهزة بعد. يرجى الانتظار والمحاولة مرة أخرى.",qrCodesDownloadedToast:"تم تنزيل رموز الاستجابة السريعة.",qrCodesDownloadFailedToast:"فشل تنزيل رموز الاستجابة السريعة.",requestChangesTitle:"طلب إجراء تغييرات",changesRequestedLabel:"تم طلب تغييرات",describeChangesPlaceholder:"اذكر التغييرات التي يجب على المؤلف إجراؤها"},reviewCommentModal:{closeAriaLabel:"إغلاق",fillCommentsError:"أضف تعليقات",cancelButton:"إلغاء"},confirmReviewModal:{closeAriaLabel:"إغلاق",title:"قبول الشروط والأحكام",agreementTextPart1:"أوافق على أنه بإرسال / نشر هذا المحتوى، فإنني أؤكد أن هذا المحتوى يتوافق مع الإرشادات المعتمدة، بما في ذلك شروط الاستخدام وسياسة المحتوى، وأني أوافق على نشره بموجب",creativeCommonsLinkText:"إطار عمل Creative Commons",agreementTextPart2:"وفقًا لـ",contentPolicyText:"سياسة المحتوى",agreementTextPart3:". وقد تحققت من أنني لا أنتهك حقوق النشر أو الخصوصية الخاصة بالآخرين.",cancelButton:"إلغاء",submitButton:"إرسال"},generateQRModal:{closeAriaLabel:"إغلاق",title:"إنشاء رموز الاستجابة السريعة",numberOfCodesLabel:"عدد رموز الاستجابة السريعة",countPlaceholder:"أدخل رقمًا (2–250)",countRangeError:"أدخل رقمًا بين 2 و 250.",cancelButton:"إلغاء",generateButton:"إنشاء"},chip:{remove:"إزالة"},dropZone:{dropHere:"أفلت هنا"},spinner:{loading:"جارٍ التحميل"}},vv={contextualEditor:{emptyStateMessage:"Sélectionnez une unité dans le plan pour modifier ses détails",reviewCommentLabel:"Commentaire du réviseur :",untitledPlaceholder:"Sans titre",nodeTitleAriaLabel:"Titre du nœud",dropZoneLabel:"Déposez ici pour ajouter du contenu à cette unité"},languageSelector:{ariaLabel:"Sélectionner la langue"},collectionEditor:{errorBoundaryTitle:"Une erreur s'est produite",retryButton:"Réessayer",loadingMessage:"Chargement de l'éditeur...",loadErrorTitle:"Échec du chargement de l'éditeur"},breadcrumb:{nodePathAriaLabel:"Chemin du nœud",homeAriaLabel:"Accueil"},tabBar:{detailsTab:"Détails",audienceCurriculumTab:"Public et programme",licensingTab:"Licence",metadataSectionsAriaLabel:"Sections de métadonnées",hasErrorsAriaLabel:"Contient des erreurs"},contentEditForm:{moveToAnotherUnitButton:"Déplacer vers une autre unité",collapseMetadataPanelAriaLabel:"Réduire le panneau de métadonnées",expandMetadataPanelAriaLabel:"Développer le panneau de métadonnées",collapseTitle:"Réduire",expandTitle:"Développer",iconAlt:"icône",contentNamePlaceholder:"Nom du contenu",keywordsLabel:"Mots-clés",addKeywordPlaceholder:"Ajoutez un mot-clé et appuyez sur Entrée",addButton:"Ajouter",optionalInCollectionLabel:"Facultatif dans la collection",yesOption:"Oui",noOption:"Non"},titleAppIcon:{selectAppIconAriaLabel:"Sélectionner l'icône de l'application",appIconAriaLabel:"Icône de l'application",appIconAlt:"Icône de l'application",removeIconAriaLabel:"Supprimer l'icône"},unitContentList:{removeConfirm:"Retirer ce contenu de l'unité ?",heading:"Contenu de cette unité",emptyTitle:"Aucun contenu pour le moment",emptyHint:"Faites glisser depuis la bibliothèque ou cliquez sur Ajouter du contenu",addContentAriaLabel:"Ajouter du contenu à l'unité",addContent:"Ajouter du contenu"},contentRow:{dragToReorderAriaLabel:"Faire glisser pour réorganiser",removeAriaLabel:"Supprimer {name}"},csvUpload:{invalidFileType:"Seuls les fichiers .csv sont acceptés.",fileTooLarge:"La taille du fichier ne doit pas dépasser 50 Mo.",downloadSampleFailed:"Échec du téléchargement de l'exemple de CSV.",processingFailed:"Le traitement du téléversement a échoué. Veuillez vérifier les lignes en erreur ci-dessous.",connectionLost:"Connexion perdue pendant la vérification du statut. Veuillez réessayer.",uploadFailed:"Le téléversement a échoué. Veuillez vérifier votre fichier et réessayer.",statusUploading:"Téléversement en cours...",statusProcessing:"Traitement en cours...",statusDone:"Terminé !",statusError:"Erreur",titleUpdate:"Mettre à jour les métadonnées des dossiers via CSV",titleCreate:"Créer des dossiers via CSV",closeAriaLabel:"Fermer",dropZoneAriaLabel:"Déposez le fichier CSV ici ou cliquez pour parcourir",dropText:"Faites glisser et déposez votre CSV ici",dropSubtext:"ou cliquez pour parcourir",downloadSample:"Télécharger l'exemple de CSV",itemsImportedSuffix:"— {count} élément(s) importé(s)",failedRowsTitle:"Lignes en échec ({count})",rowHeader:"Ligne",nameHeader:"Nom",reasonHeader:"Raison",unknownError:"Erreur inconnue",cancel:"Annuler",uploaded:"Téléversé",upload:"Téléverser"},manageCollaborators:{saveFailed:"Échec de l'enregistrement des collaborateurs. Veuillez réessayer.",title:"Gérer les collaborateurs",closeAriaLabel:"Fermer",searchUsersLabel:"Rechercher des utilisateurs",searchPlaceholder:"Rechercher par nom ou e-mail...",searchingAriaLabel:"Recherche en cours...",searchResultsAriaLabel:"Résultats de recherche",add:"Ajouter",noUsersFound:"Aucun utilisateur trouvé.",currentCollaborators:"Collaborateurs actuels",noCollaboratorsYet:"Aucun collaborateur ajouté pour le moment.",remove:"Retirer",saveSuccess:"Collaborateurs enregistrés avec succès.",cancel:"Annuler",save:"Enregistrer"},sparkMetaForm:{shuffleEnabledMessage:"La lecture aléatoire est activée pour cet ensemble de questions.",noFieldsMessage:"Aucun champ configuré pour cet onglet."},appIconField:{requiredError:"{field} est requis",selectIconAriaLabel:"Sélectionner l'icône de l'application",iconAlt:"Icône de l'application",selectIconLabel:"Sélectionner l'icône",removeIconAriaLabel:"Supprimer l'icône de l'application",removeLabel:"Supprimer"},appIconPickerModal:{dialogAriaLabel:"Sélectionner l'icône de l'application",title:"Sélectionner l'icône de l'application",closeAriaLabel:"Fermer",myImagesTab:"Mes images",allImagesTab:"Toutes les images",uploadTab:"Téléverser",searchPlaceholder:"Rechercher des images…",loadingText:"Chargement…",noImagesFound:"Aucune image trouvée",noThumbnailText:"IMG",loadMoreButton:"Charger plus",previewAlt:"Aperçu",dropZoneText:"Faites glisser et déposez ou cliquez pour parcourir",acceptedTypesInfo:"{types} · max {size} Mo",cancelButton:"Annuler",uploadingText:"Téléversement…",uploadAndUseButton:"Téléverser et utiliser",useSelectedButton:"Utiliser la sélection",invalidFileTypeError:"Seuls les fichiers {types} sont acceptés.",fileTooLargeError:"L'image doit faire moins de {size} Mo.",uploadFailedError:"Le téléversement a échoué."},chipGroupField:{addPlaceholder:"Ajouter…",addButtonLabel:"Ajouter"},dateTimeField:{requiredError:"{field} est requis"},dialcodeInputField:{requiredError:"{field} est requis",enterCodeMessage:"Saisissez un code d'appel à valider.",validMessage:"Le code d'appel est valide.",notFoundMessage:"Code d'appel introuvable.",validationFailedMessage:"La validation a échoué. Veuillez réessayer.",placeholderExample:"ex. A1B2C3",validateAriaLabel:"Valider le code d'appel",validatingLabel:"Validation en cours…",validateButtonLabel:"Valider"},keywordSuggestField:{requiredError:"{field} est requis",inputPlaceholder:"Saisissez et appuyez sur Entrée ou virgule…"},licenseSelectField:{requiredError:"{field} est requis",selectPlaceholder:"Sélectionner une licence…"},multiSelectField:{requiredError:"{field} est requis",selectedCountSuffix:"sélectionné(s)",selectPlaceholder:"Sélectionner…",noOptionsMessage:"Aucune option"},nestedSelectField:{requiredError:"{field} est requis",selectPlaceholder:"Sélectionner…"},radioField:{requiredError:"{field} est requis"},selectField:{requiredError:"{field} est requis",selectPlaceholder:"Sélectionner…",noOptionsMessage:"Aucune option"},textField:{requiredError:"{field} est requis",maxLengthError:"Maximum {max} caractères"},assetBrowser:{dialogAriaLabel:"Navigateur de ressources",title:"Navigateur de ressources",closeAriaLabel:"Fermer",browseTab:"Parcourir",uploadTab:"Téléverser",searchPlaceholder:"Rechercher des ressources...",searchButton:"Rechercher",loadingMessage:"Chargement...",uploadingMessage:"Téléversement...",chooseFileButton:"Choisir un fichier à téléverser"},resourceReorderDialog:{dialogAriaLabel:"Déplacer la ressource",moveHeaderPrefix:"Déplacer",closeAriaLabel:"Fermer",selectUnitHint:"Sélectionnez une unité vers laquelle déplacer ce contenu :",noUnitsAvailable:"Aucune autre unité disponible",cancelButton:"Annuler",moveButton:"Déplacer ici"},assignPageNumber:{dialogAriaLabel:"Attribuer des numéros de page",title:"Attribuer des numéros de page",closeAriaLabel:"Fermer",emptyState:"Aucun élément de contenu trouvé dans cette collection.",contentColumnHeader:"Contenu",pageNumberColumnHeader:"Numéro de page",cancelButton:"Annuler",saveButton:"Enregistrer"},confirmDialog:{confirmButton:"Confirmer",cancelButton:"Annuler",closeAriaLabel:"Fermer"},publishChecklist:{publishTitlePrefix:"Publier",closeAriaLabel:"Fermer",confirmPublishPrefix:"Êtes-vous sûr de vouloir publier ce",checklistInstructions:"Veuillez confirmer que TOUS les éléments suivants sont vérifiés (en cochant les cases) avant de pouvoir publier :",noButton:"Non",yesButton:"Oui"},qualityParamsModal:{reviewQualityTitle:"Évaluer la qualité",rejectContentTitle:"Rejeter le contenu",closeAriaLabel:"Fermer",qualityScoreLabel:"Score de qualité",scorePoorLabel:"0 — Faible",scoreExcellentLabel:"10 — Excellent",commentLabel:"Commentaire",optionalLabel:"(facultatif)",commentPlaceholder:"Ajoutez des remarques pour le créateur du contenu…",rejectionReasonLabel:"Motif du rejet",rejectReasonPlaceholder:"Décrivez pourquoi ce contenu est rejeté…",rejectionRequiredMessage:"Un motif de rejet est requis.",cancelButton:"Annuler",approveButton:"Approuver",rejectButton:"Rejeter"},unsavedChangesModal:{title:"Modifications non enregistrées",closeAriaLabel:"Fermer",bodyMessage:"Vous avez des modifications non enregistrées. Souhaitez-vous les enregistrer avant de quitter ?",cancelButton:"Annuler",discardButton:"Ignorer",saveButton:"Enregistrer"},filterChips:{contentTypeFiltersAriaLabel:"Filtres par type de contenu"},libraryCard:{alreadyAddedAriaLabel:"Déjà ajouté",alreadyAddedTitle:"Déjà ajouté à cette collection",addItemAriaLabel:"Ajouter {name} à l'unité",addToUnitTitle:"Ajouter à l'unité",selectUnitToAddTitle:"Sélectionner une unité pour ajouter",draftOnlyTitle:"Seul le contenu à l'état de brouillon peut être ajouté"},libraryDock:{selectUnitFirstToast:"Sélectionnez d'abord une unité",selectUnitFromOutlineToast:"Sélectionnez une unité dans le plan pour ajouter du contenu — les ressources ne peuvent pas être ajoutées directement au cours.",itemAlreadyAddedToast:"« {name} » est déjà dans cette collection",itemAddedToast:"« {name} » ajouté",collapseLibraryPanelAriaLabel:"Réduire le panneau de la bibliothèque",collapseLibraryTitle:"Réduire la bibliothèque",headerTitle:"Bibliothèque",searchPlaceholder:"Rechercher du contenu…",searchAriaLabel:"Rechercher dans la bibliothèque",sortAZAriaLabel:"Trier : A–Z (cliquer pour Récent)",sortRecentAriaLabel:"Trier : Récent (cliquer pour A–Z)",sortAZTitle:"A–Z",sortRecentTitle:"Récent",toggleAdvancedFiltersAriaLabel:"Afficher/masquer les filtres avancés",advancedFiltersTitle:"Filtres avancés",libraryContentAriaLabel:"Contenu de la bibliothèque",loadMoreAriaLabel:"Charger plus de contenu",loadingText:"Chargement…",loadMoreText:"Charger plus",noContentFound:"Aucun contenu trouvé",tryDifferentSearch:"Essayez une autre recherche ou un autre filtre"},libraryFilterPanel:{boardLabel:"Conseil",mediumLabel:"Médium",classLabel:"Classe",subjectLabel:"Matière",primaryCategoryLabel:"Catégorie principale",filterLibraryAriaLabel:"Filtrer la bibliothèque",filtersHeaderTitle:"Filtres",closeFiltersAriaLabel:"Fermer les filtres",resetButton:"Réinitialiser",applyButton:"Appliquer"},libraryPreviewPanel:{contentPreviewAriaLabel:"Aperçu du contenu",closePreviewAriaLabel:"Fermer l'aperçu",addToUnitButton:"+ Ajouter à l'unité"},outlineTree:{maxDepthReachedToast:"Profondeur maximale atteinte",downloadCsvFailedToast:"Échec du téléchargement du CSV",outlineRefreshedToast:"Plan du cours actualisé.",outlineRefreshFailedToast:"Le plan n'a pas pu être actualisé automatiquement. Veuillez recharger la page.",moreOptionsAriaLabel:"Plus d'options",moreOptionsTitle:"Plus d'options",foldersExistTitle:"Des dossiers existent déjà — utilisez « Mettre à jour » à la place",createFoldersCsvButton:"Créer des dossiers à partir d'un fichier CSV",noFoldersYetTitle:"Aucun dossier pour le moment — utilisez d'abord « Créer »",downloadFoldersCsvButton:"Télécharger les dossiers en fichier CSV",updateFoldersCsvButton:"Mettre à jour les métadonnées des dossiers à partir d'un fichier CSV",expandOutlineAriaLabel:"Développer le plan",collapseOutlineAriaLabel:"Réduire le plan",addUnitButton:"Ajouter une unité",addSubunitButton:"Ajouter une sous-unité"},treeNode:{expandAriaLabel:"Développer",collapseAriaLabel:"Réduire",dropHereLabel:"Déposer ici",nodeOptionsAriaLabel:"Options du nœud",renameMenuItem:"Renommer",addSubunitMenuItem:"Ajouter une sous-unité",addSiblingMenuItem:"Ajouter un élément au même niveau",deleteMenuItem:"Supprimer"},contentPlayer:{mimeLabelVideo:"Vidéo",mimeLabelAudio:"Audio",mimeLabelPdf:"PDF",mimeLabelEpub:"ePub",mimeLabelEcml:"ECML",mimeLabelH5p:"H5P",mimeLabelScorm:"SCORM",mimeLabelOther:"Contenu",infoFieldAuthor:"Auteur",infoFieldLicense:"Licence",infoFieldLanguage:"Langue",infoFieldClass:"Classe",infoFieldSubject:"Matière",infoFieldType:"Type",loadingPreview:"Chargement de l'aperçu…",previewPlayerUnavailable:"Lecteur d'aperçu indisponible. Vérifiez que /content/preview est accessible.",failedToInitializePlayer:"Échec de l'initialisation du lecteur de contenu.",previewPlayerLoadFailed:"Le lecteur d'aperçu n'a pas pu être chargé.",unableToLoadQuestionset:"Impossible de charger l'ensemble de questions :",parentQuestionsetNotResolved:"Impossible de résoudre l'ensemble de questions parent pour cette question.",questionNotFoundInQuestionset:"Question introuvable dans l'ensemble de questions."},dialcodePanel:{title:"Code QR (Dialcode)",invalidFormatError:"Format de code DIAL invalide. Utilisez uniquement des lettres majuscules et des chiffres (ex. A1B2C3).",duplicateDialcodeError:"Le code DIAL « {code} » est déjà associé à un autre nœud de cette collection.",dialcodeNotFoundError:"Code d'appel introuvable. Veuillez saisir un code valide.",linkFailedError:"Échec de l'association du code d'appel. Veuillez réessayer.",unlinkFailedError:"Échec de la suppression du code d'appel. Veuillez réessayer.",qrCodeAltPrefix:"Code QR pour",linkedCodeLabel:"Code associé :",removeButton:"Supprimer",noCodeLinkedMessage:"Aucun code QR associé à ce contenu.",linkManuallyLabel:"Associer manuellement",dialcodeInputPlaceholder:"Saisissez le code d'appel (ex. A1B2C3)",dialcodeInputAriaLabel:"Champ de saisie du code d'appel",linkButton:"Associer",linkedSuccessMessage:"Code d'appel associé avec succès."},progressStatus:{unitsAddedLabel:"Unités ajoutées",contentItemsLabel:"Éléments de contenu",progressLabel:"Progression"},splitBuilderShell:{dropOntoUnitError:"Déposez sur une unité pour ajouter du contenu",dropOntoCourseError:"Déposez le contenu sur une unité, pas directement sur le cours.",alreadyInCollectionError:"« {name} » est déjà dans cette collection",addedToUnitSuccess:"« {name} » ajouté à l'unité",fillRequiredMetadataError:"Veuillez renseigner les métadonnées requises",outlineAriaLabel:"Plan du cours",showOutlineTitle:"Afficher le plan",editorAriaLabel:"Éditeur de contenu",libraryAriaLabel:"Bibliothèque de contenu",showLibraryTitle:"Afficher la bibliothèque"},topbar:{draftStatusFallback:"Brouillon",backAriaLabel:"Retour",statusAriaLabelPrefix:"Statut :",savingIndicator:"Enregistrement…",unsavedIndicator:"Non enregistré",savedIndicatorPrefix:"Enregistré",fillRequiredFieldsTooltip:"Renseignez tous les champs requis avant d'enregistrer",saveAsDraftButton:"Enregistrer comme brouillon",sendForReviewButton:"Envoyer pour révision",collaboratorsLabel:"Collaborateurs",qrCodesLabel:"Codes QR",generatingEllipsis:"Génération en cours…",generateQrCodesMenuItem:"Générer des codes QR",downloadingEllipsis:"Téléchargement…",downloadQrCodesMenuItem:"Télécharger les codes QR",publishButton:"Publier",requestForChangesButton:"Demander des modifications",approveButton:"Approuver",qrGenerationStartedToast:"La génération des codes QR a démarré. Utilisez « Télécharger les codes QR » une fois prêts.",qrGenerationFailedToast:"Échec de la génération des codes QR. Veuillez réessayer.",qrCodesNotGeneratedToast:"Aucun code QR généré pour le moment. Générez d'abord des codes QR.",qrGenerationInProgressToast:"La génération des images de codes QR est en cours. Veuillez réessayer le téléchargement dans quelques instants.",qrCodesNotReadyToast:"Les codes QR ne sont pas encore prêts. Veuillez patienter et réessayer.",qrCodesDownloadedToast:"Codes QR téléchargés.",qrCodesDownloadFailedToast:"Échec du téléchargement des codes QR.",requestChangesTitle:"Demander des modifications",changesRequestedLabel:"Modifications demandées",describeChangesPlaceholder:"Décrivez les modifications que l'auteur doit apporter"},reviewCommentModal:{closeAriaLabel:"Fermer",fillCommentsError:"Renseignez les commentaires",cancelButton:"Annuler"},confirmReviewModal:{closeAriaLabel:"Fermer",title:"Acceptation des conditions générales",agreementTextPart1:"J'accepte qu'en soumettant / publiant ce contenu, je confirme qu'il est conforme aux directives prescrites, y compris les conditions d'utilisation et la politique de contenu, et que je consens à le publier selon le",creativeCommonsLinkText:"cadre Creative Commons",agreementTextPart2:"conformément à la",contentPolicyText:"politique de contenu",agreementTextPart3:". Je me suis assuré(e) de ne pas porter atteinte aux droits d'auteur ou à la vie privée d'autrui.",cancelButton:"Annuler",submitButton:"Soumettre"},generateQRModal:{closeAriaLabel:"Fermer",title:"Générer des codes QR",numberOfCodesLabel:"Nombre de codes QR",countPlaceholder:"Saisissez un nombre (2–250)",countRangeError:"Saisissez un nombre entre 2 et 250.",cancelButton:"Annuler",generateButton:"Générer"},chip:{remove:"Supprimer"},dropZone:{dropHere:"Déposer ici"},spinner:{loading:"Chargement"}},bv={contextualEditor:{emptyStateMessage:"Selecione uma unidade no esquema para editar seus detalhes",reviewCommentLabel:"Comentário do revisor:",untitledPlaceholder:"Sem título",nodeTitleAriaLabel:"Título do nó",dropZoneLabel:"Solte para adicionar conteúdo a esta unidade"},languageSelector:{ariaLabel:"Selecionar idioma"},collectionEditor:{errorBoundaryTitle:"Algo deu errado",retryButton:"Tentar novamente",loadingMessage:"Carregando editor...",loadErrorTitle:"Falha ao carregar o editor"},breadcrumb:{nodePathAriaLabel:"Caminho do nó",homeAriaLabel:"Início"},tabBar:{detailsTab:"Detalhes",audienceCurriculumTab:"Público e Currículo",licensingTab:"Licenciamento",metadataSectionsAriaLabel:"Seções de metadados",hasErrorsAriaLabel:"Contém erros"},contentEditForm:{moveToAnotherUnitButton:"Mover para outra unidade",collapseMetadataPanelAriaLabel:"Recolher painel de metadados",expandMetadataPanelAriaLabel:"Expandir painel de metadados",collapseTitle:"Recolher",expandTitle:"Expandir",iconAlt:"ícone",contentNamePlaceholder:"Nome do conteúdo",keywordsLabel:"Palavras-chave",addKeywordPlaceholder:"Adicione uma palavra-chave e pressione Enter",addButton:"Adicionar",optionalInCollectionLabel:"Opcional na coleção",yesOption:"Sim",noOption:"Não"},titleAppIcon:{selectAppIconAriaLabel:"Selecionar ícone do aplicativo",appIconAriaLabel:"Ícone do aplicativo",appIconAlt:"Ícone do aplicativo",removeIconAriaLabel:"Remover ícone"},unitContentList:{removeConfirm:"Remover este conteúdo da unidade?",heading:"Conteúdo nesta unidade",emptyTitle:"Ainda não há conteúdo",emptyHint:"Arraste da biblioteca ou clique em Adicionar conteúdo",addContentAriaLabel:"Adicionar conteúdo à unidade",addContent:"Adicionar conteúdo"},contentRow:{dragToReorderAriaLabel:"Arrastar para reordenar",removeAriaLabel:"Remover {name}"},csvUpload:{invalidFileType:"Somente arquivos .csv são aceitos.",fileTooLarge:"O tamanho do arquivo não deve exceder 50 MB.",downloadSampleFailed:"Falha ao baixar o CSV de exemplo.",processingFailed:"Falha no processamento do upload. Verifique as linhas com erro abaixo.",connectionLost:"Conexão perdida ao verificar o status. Tente novamente.",uploadFailed:"Falha no envio. Verifique seu arquivo e tente novamente.",statusUploading:"Enviando...",statusProcessing:"Processando...",statusDone:"Concluído!",statusError:"Erro",titleUpdate:"Atualizar metadados das pastas via CSV",titleCreate:"Criar pastas via CSV",closeAriaLabel:"Fechar",dropZoneAriaLabel:"Solte o arquivo CSV aqui ou clique para procurar",dropText:"Arraste e solte seu CSV aqui",dropSubtext:"ou clique para procurar",downloadSample:"Baixar CSV de exemplo",itemsImportedSuffix:"— {count} item(ns) importado(s)",failedRowsTitle:"Linhas com falha ({count})",rowHeader:"Linha",nameHeader:"Nome",reasonHeader:"Motivo",unknownError:"Erro desconhecido",cancel:"Cancelar",uploaded:"Enviado",upload:"Enviar"},manageCollaborators:{saveFailed:"Falha ao salvar colaboradores. Tente novamente.",title:"Gerenciar colaboradores",closeAriaLabel:"Fechar",searchUsersLabel:"Buscar usuários",searchPlaceholder:"Buscar por nome ou e-mail...",searchingAriaLabel:"Buscando...",searchResultsAriaLabel:"Resultados da busca",add:"Adicionar",noUsersFound:"Nenhum usuário encontrado.",currentCollaborators:"Colaboradores atuais",noCollaboratorsYet:"Nenhum colaborador adicionado ainda.",remove:"Remover",saveSuccess:"Colaboradores salvos com sucesso.",cancel:"Cancelar",save:"Salvar"},sparkMetaForm:{shuffleEnabledMessage:"A ordem aleatória está ativada para este conjunto de questões.",noFieldsMessage:"Nenhum campo configurado para esta aba."},appIconField:{requiredError:"{field} é obrigatório",selectIconAriaLabel:"Selecionar ícone do aplicativo",iconAlt:"Ícone do aplicativo",selectIconLabel:"Selecionar ícone",removeIconAriaLabel:"Remover ícone do aplicativo",removeLabel:"Remover"},appIconPickerModal:{dialogAriaLabel:"Selecionar ícone do aplicativo",title:"Selecionar ícone do aplicativo",closeAriaLabel:"Fechar",myImagesTab:"Minhas imagens",allImagesTab:"Todas as imagens",uploadTab:"Enviar",searchPlaceholder:"Buscar imagens…",loadingText:"Carregando…",noImagesFound:"Nenhuma imagem encontrada",noThumbnailText:"IMG",loadMoreButton:"Carregar mais",previewAlt:"Pré-visualização",dropZoneText:"Arraste e solte ou clique para procurar",acceptedTypesInfo:"{types} · máx. {size} MB",cancelButton:"Cancelar",uploadingText:"Enviando…",uploadAndUseButton:"Enviar e usar",useSelectedButton:"Usar selecionado",invalidFileTypeError:"Somente arquivos {types} são aceitos.",fileTooLargeError:"A imagem deve ter menos de {size} MB.",uploadFailedError:"Falha no envio."},chipGroupField:{addPlaceholder:"Adicionar…",addButtonLabel:"Adicionar"},dateTimeField:{requiredError:"{field} é obrigatório"},dialcodeInputField:{requiredError:"{field} é obrigatório",enterCodeMessage:"Insira um código dial para validar.",validMessage:"O código dial é válido.",notFoundMessage:"Código dial não encontrado.",validationFailedMessage:"Falha na validação. Tente novamente.",placeholderExample:"ex. A1B2C3",validateAriaLabel:"Validar código dial",validatingLabel:"Validando…",validateButtonLabel:"Validar"},keywordSuggestField:{requiredError:"{field} é obrigatório",inputPlaceholder:"Digite e pressione Enter ou vírgula…"},licenseSelectField:{requiredError:"{field} é obrigatório",selectPlaceholder:"Selecionar licença…"},multiSelectField:{requiredError:"{field} é obrigatório",selectedCountSuffix:"selecionado(s)",selectPlaceholder:"Selecionar…",noOptionsMessage:"Sem opções"},nestedSelectField:{requiredError:"{field} é obrigatório",selectPlaceholder:"Selecionar…"},radioField:{requiredError:"{field} é obrigatório"},selectField:{requiredError:"{field} é obrigatório",selectPlaceholder:"Selecionar…",noOptionsMessage:"Sem opções"},textField:{requiredError:"{field} é obrigatório",maxLengthError:"Máx. {max} caracteres"},assetBrowser:{dialogAriaLabel:"Navegador de recursos",title:"Navegador de recursos",closeAriaLabel:"Fechar",browseTab:"Procurar",uploadTab:"Enviar",searchPlaceholder:"Buscar recursos...",searchButton:"Buscar",loadingMessage:"Carregando...",uploadingMessage:"Enviando...",chooseFileButton:"Escolher arquivo para enviar"},resourceReorderDialog:{dialogAriaLabel:"Mover recurso",moveHeaderPrefix:"Mover",closeAriaLabel:"Fechar",selectUnitHint:"Selecione uma unidade para mover este conteúdo:",noUnitsAvailable:"Nenhuma outra unidade disponível",cancelButton:"Cancelar",moveButton:"Mover para aqui"},assignPageNumber:{dialogAriaLabel:"Atribuir números de página",title:"Atribuir números de página",closeAriaLabel:"Fechar",emptyState:"Nenhum item de conteúdo encontrado nesta coleção.",contentColumnHeader:"Conteúdo",pageNumberColumnHeader:"Número da página",cancelButton:"Cancelar",saveButton:"Salvar"},confirmDialog:{confirmButton:"Confirmar",cancelButton:"Cancelar",closeAriaLabel:"Fechar"},publishChecklist:{publishTitlePrefix:"Publicar",closeAriaLabel:"Fechar",confirmPublishPrefix:"Tem certeza de que deseja publicar este(a)",checklistInstructions:"Confirme que TODOS os itens a seguir foram verificados (marcando as caixas de seleção) antes de publicar:",noButton:"Não",yesButton:"Sim"},qualityParamsModal:{reviewQualityTitle:"Revisar qualidade",rejectContentTitle:"Rejeitar conteúdo",closeAriaLabel:"Fechar",qualityScoreLabel:"Nota de qualidade",scorePoorLabel:"0 — Ruim",scoreExcellentLabel:"10 — Excelente",commentLabel:"Comentário",optionalLabel:"(opcional)",commentPlaceholder:"Adicione observações para o criador do conteúdo…",rejectionReasonLabel:"Motivo da rejeição",rejectReasonPlaceholder:"Descreva por que este conteúdo está sendo rejeitado…",rejectionRequiredMessage:"É necessário informar um motivo de rejeição.",cancelButton:"Cancelar",approveButton:"Aprovar",rejectButton:"Rejeitar"},unsavedChangesModal:{title:"Alterações não salvas",closeAriaLabel:"Fechar",bodyMessage:"Você tem alterações não salvas. Deseja salvá-las antes de sair?",cancelButton:"Cancelar",discardButton:"Descartar",saveButton:"Salvar"},filterChips:{contentTypeFiltersAriaLabel:"Filtros de tipo de conteúdo"},libraryCard:{alreadyAddedAriaLabel:"Já adicionado",alreadyAddedTitle:"Já adicionado a esta coleção",addItemAriaLabel:"Adicionar {name} à unidade",addToUnitTitle:"Adicionar à unidade",selectUnitToAddTitle:"Selecione uma unidade para adicionar",draftOnlyTitle:"Somente conteúdo em rascunho pode ser adicionado"},libraryDock:{selectUnitFirstToast:"Selecione uma unidade primeiro",selectUnitFromOutlineToast:"Selecione uma unidade no esquema para adicionar conteúdo — recursos não podem ser adicionados diretamente ao curso.",itemAlreadyAddedToast:'"{name}" já está nesta coleção',itemAddedToast:'"{name}" adicionado',collapseLibraryPanelAriaLabel:"Recolher painel da biblioteca",collapseLibraryTitle:"Recolher biblioteca",headerTitle:"Biblioteca",searchPlaceholder:"Buscar conteúdo…",searchAriaLabel:"Buscar na biblioteca",sortAZAriaLabel:"Ordenar: A–Z (clique para Recentes)",sortRecentAriaLabel:"Ordenar: Recentes (clique para A–Z)",sortAZTitle:"A–Z",sortRecentTitle:"Recentes",toggleAdvancedFiltersAriaLabel:"Alternar filtros avançados",advancedFiltersTitle:"Filtros avançados",libraryContentAriaLabel:"Conteúdo da biblioteca",loadMoreAriaLabel:"Carregar mais conteúdo",loadingText:"Carregando…",loadMoreText:"Carregar mais",noContentFound:"Nenhum conteúdo encontrado",tryDifferentSearch:"Tente uma busca ou filtro diferente"},libraryFilterPanel:{boardLabel:"Conselho",mediumLabel:"Idioma de Instrução",classLabel:"Série",subjectLabel:"Disciplina",primaryCategoryLabel:"Categoria principal",filterLibraryAriaLabel:"Filtrar biblioteca",filtersHeaderTitle:"Filtros",closeFiltersAriaLabel:"Fechar filtros",resetButton:"Redefinir",applyButton:"Aplicar"},libraryPreviewPanel:{contentPreviewAriaLabel:"Pré-visualização do conteúdo",closePreviewAriaLabel:"Fechar pré-visualização",addToUnitButton:"+ Adicionar à unidade"},outlineTree:{maxDepthReachedToast:"Profundidade máxima atingida",downloadCsvFailedToast:"Falha ao baixar o CSV",outlineRefreshedToast:"Esquema do curso atualizado.",outlineRefreshFailedToast:"Não foi possível atualizar o esquema automaticamente. Recarregue a página.",moreOptionsAriaLabel:"Mais opções",moreOptionsTitle:"Mais opções",foldersExistTitle:'As pastas já existem — use "Atualizar"',createFoldersCsvButton:"Criar pastas usando arquivo csv",noFoldersYetTitle:'Ainda não há pastas — use "Criar" primeiro',downloadFoldersCsvButton:"Baixar pastas como arquivo csv",updateFoldersCsvButton:"Atualizar metadados das pastas usando arquivo csv",expandOutlineAriaLabel:"Expandir esquema",collapseOutlineAriaLabel:"Recolher esquema",addUnitButton:"Adicionar unidade",addSubunitButton:"Adicionar subunidade"},treeNode:{expandAriaLabel:"Expandir",collapseAriaLabel:"Recolher",dropHereLabel:"Solte aqui",nodeOptionsAriaLabel:"Opções do nó",renameMenuItem:"Renomear",addSubunitMenuItem:"Adicionar subunidade",addSiblingMenuItem:"Adicionar item no mesmo nível",deleteMenuItem:"Excluir"},contentPlayer:{mimeLabelVideo:"Vídeo",mimeLabelAudio:"Áudio",mimeLabelPdf:"PDF",mimeLabelEpub:"ePub",mimeLabelEcml:"ECML",mimeLabelH5p:"H5P",mimeLabelScorm:"SCORM",mimeLabelOther:"Conteúdo",infoFieldAuthor:"Autor",infoFieldLicense:"Licença",infoFieldLanguage:"Idioma",infoFieldClass:"Série",infoFieldSubject:"Disciplina",infoFieldType:"Tipo",loadingPreview:"Carregando pré-visualização…",previewPlayerUnavailable:"Player de pré-visualização indisponível. Verifique se /content/preview está acessível.",failedToInitializePlayer:"Falha ao inicializar o player de conteúdo.",previewPlayerLoadFailed:"Não foi possível carregar o player de pré-visualização.",unableToLoadQuestionset:"Não foi possível carregar o conjunto de questões:",parentQuestionsetNotResolved:"Não foi possível identificar o conjunto de questões principal desta questão.",questionNotFoundInQuestionset:"Questão não encontrada no conjunto de questões."},dialcodePanel:{title:"Código QR (Dialcode)",invalidFormatError:"Formato de código DIAL inválido. Use apenas letras maiúsculas e números (ex. A1B2C3).",duplicateDialcodeError:'O código DIAL "{code}" já está vinculado a outro nó nesta coleção.',dialcodeNotFoundError:"Dialcode não encontrado. Insira um código válido.",linkFailedError:"Falha ao vincular o dialcode. Tente novamente.",unlinkFailedError:"Falha ao remover o dialcode. Tente novamente.",qrCodeAltPrefix:"Código QR para",linkedCodeLabel:"Código vinculado:",removeButton:"Remover",noCodeLinkedMessage:"Nenhum código QR vinculado a este conteúdo.",linkManuallyLabel:"Vincular manualmente",dialcodeInputPlaceholder:"Insira o dialcode (ex. A1B2C3)",dialcodeInputAriaLabel:"Campo de dialcode",linkButton:"Vincular",linkedSuccessMessage:"Dialcode vinculado com sucesso."},progressStatus:{unitsAddedLabel:"Unidades adicionadas",contentItemsLabel:"Itens de conteúdo",progressLabel:"Progresso"},splitBuilderShell:{dropOntoUnitError:"Solte sobre uma unidade para adicionar conteúdo",dropOntoCourseError:"Solte o conteúdo sobre uma unidade, não diretamente sobre o curso.",alreadyInCollectionError:'"{name}" já está nesta coleção',addedToUnitSuccess:'"{name}" adicionado à unidade',fillRequiredMetadataError:"Preencha os metadados obrigatórios",outlineAriaLabel:"Esquema do curso",showOutlineTitle:"Mostrar esquema",editorAriaLabel:"Editor de conteúdo",libraryAriaLabel:"Biblioteca de conteúdo",showLibraryTitle:"Mostrar biblioteca"},topbar:{draftStatusFallback:"Rascunho",backAriaLabel:"Voltar",statusAriaLabelPrefix:"Status:",savingIndicator:"Salvando…",unsavedIndicator:"Não salvo",savedIndicatorPrefix:"Salvo",fillRequiredFieldsTooltip:"Preencha todos os campos obrigatórios antes de salvar",saveAsDraftButton:"Salvar como rascunho",sendForReviewButton:"Enviar para revisão",collaboratorsLabel:"Colaboradores",qrCodesLabel:"Códigos QR",generatingEllipsis:"Gerando…",generateQrCodesMenuItem:"Gerar códigos QR",downloadingEllipsis:"Baixando…",downloadQrCodesMenuItem:"Baixar códigos QR",publishButton:"Publicar",requestForChangesButton:"Solicitar alterações",approveButton:"Aprovar",qrGenerationStartedToast:'Geração dos códigos QR iniciada. Use "Baixar códigos QR" quando estiverem prontos.',qrGenerationFailedToast:"Falha ao gerar os códigos QR. Tente novamente.",qrCodesNotGeneratedToast:"Nenhum código QR gerado ainda. Gere os códigos QR primeiro.",qrGenerationInProgressToast:"A geração das imagens dos códigos QR está em andamento. Tente baixar novamente mais tarde.",qrCodesNotReadyToast:"Os códigos QR ainda não estão prontos. Aguarde e tente novamente.",qrCodesDownloadedToast:"Códigos QR baixados.",qrCodesDownloadFailedToast:"Falha ao baixar os códigos QR.",requestChangesTitle:"Solicitar alterações",changesRequestedLabel:"Alterações solicitadas",describeChangesPlaceholder:"Descreva as alterações que o autor precisa fazer"},reviewCommentModal:{closeAriaLabel:"Fechar",fillCommentsError:"Preencha os comentários",cancelButton:"Cancelar"},confirmReviewModal:{closeAriaLabel:"Fechar",title:"Aceitar Termos e Condições",agreementTextPart1:"Concordo que, ao enviar/publicar este Conteúdo, confirmo que ele está em conformidade com as diretrizes estabelecidas, incluindo os Termos de Uso e a Política de Conteúdo, e que consinto em publicá-lo sob a",creativeCommonsLinkText:"Estrutura Creative Commons",agreementTextPart2:"de acordo com a",contentPolicyText:"Política de Conteúdo",agreementTextPart3:". Certifiquei-me de que não violo direitos de autor ou de privacidade de terceiros.",cancelButton:"Cancelar",submitButton:"Enviar"},generateQRModal:{closeAriaLabel:"Fechar",title:"Gerar códigos QR",numberOfCodesLabel:"Número de códigos QR",countPlaceholder:"Insira um número (2–250)",countRangeError:"Insira um número entre 2 e 250.",cancelButton:"Cancelar",generateButton:"Gerar"},chip:{remove:"Remover"},dropZone:{dropHere:"Solte aqui"},spinner:{loading:"Carregando"}},wv=["en","ar","fr","pt"],Cv=["ar"],Sv={en:ss,ar:yv,fr:vv,pt:bv};function md(e,t){const r={...e};for(const n of Object.keys(t)){const o=e[n],a=t[n];o&&a&&typeof o=="object"&&typeof a=="object"&&!Array.isArray(o)&&!Array.isArray(a)?r[n]=md(o,a):a!==void 0&&(r[n]=a)}return r}function yd(e){const t=Sv[e];return!t||e==="en"?ss:md(ss,t)}function _v(e){return Cv.includes(e)}const ls="app-language",cs="app-language-change",_a=yo(e=>({lang:"en",labelConfig:yd("en"),setLanguage:(t,r={})=>{e({lang:t,labelConfig:yd(t)}),localStorage.setItem(ls,t),document.documentElement.setAttribute("dir",_v(t)?"rtl":"ltr"),document.documentElement.setAttribute("lang",t),r.broadcast!==!1&&window.dispatchEvent(new CustomEvent(cs,{detail:{lang:t}}))}}));function le(){return _a(e=>e.labelConfig)}const Tv=({size:e=16,color:t="currentColor"})=>{const r=le();return c.jsx("svg",{className:mv.spin,width:e,height:e,viewBox:"0 0 24 24",fill:"none","aria-label":r.spinner.loading,role:"status",children:c.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:"3",strokeDasharray:"31.4",strokeDashoffset:"10",strokeLinecap:"round"})})},$e=({variant:e="ghost",size:t="md",isLoading:r,disabled:n,onClick:o,children:a,className:i,type:s="button"})=>c.jsxs("button",{type:s,className:`sbx-btn-${e} ${t==="sm"?"sbx-btn-sm":""} ${i??""}`,onClick:o,disabled:r||n,"aria-busy":r?!0:void 0,children:[r?c.jsx(Tv,{size:14}):null,a]}),ds={languageSelector:"_languageSelector_vmwcn_1",languageBtn:"_languageBtn_vmwcn_10",active:"_active_vmwcn_24"},Ev={en:"EN",ar:"AR",fr:"FR",pt:"PT"},Iv=()=>{const e=le(),t=_a(n=>n.lang),r=_a(n=>n.setLanguage);return c.jsx("div",{className:ds.languageSelector,role:"group","aria-label":e.languageSelector.ariaLabel,children:wv.map(n=>c.jsx("button",{type:"button",className:`${ds.languageBtn} ${t===n?ds.active:""}`,onClick:()=>r(n),"aria-pressed":t===n,children:Ev[n]},n))})},Fe={overlay:"_overlay_w9xez_1",modal:"_modal_w9xez_11",modalHeader:"_modalHeader_w9xez_23",modalHeaderClose:"_modalHeaderClose_w9xez_33",modalBody:"_modalBody_w9xez_51",modalFooter:"_modalFooter_w9xez_58",checkRow:"_checkRow_w9xez_65",formGroup:"_formGroup_w9xez_108",textarea:"_textarea_w9xez_119",sliderGroup:"_sliderGroup_w9xez_140",sliderValue:"_sliderValue_w9xez_152",sliderLabels:"_sliderLabels_w9xez_160",sectionTitle:"_sectionTitle_w9xez_168"},Ov=({contentId:e,onConfirm:t,onCancel:r})=>{const n=le(),o=ce(u=>{var m,g;return(g=(m=u.editorConfig)==null?void 0:m.config)==null?void 0:g.objectType})||"Content",a=ce(u=>u.publishChecklist)??[],[i,s]=h.useState({}),l=a.every(u=>i[u.code]),d=a.length===0||l,f=()=>{t()};return c.jsx("div",{className:Fe.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"publish-modal-title",children:c.jsxs("div",{className:Fe.modal,children:[c.jsxs("div",{className:Fe.modalHeader,children:[c.jsxs("span",{id:"publish-modal-title",children:[n.publishChecklist.publishTitlePrefix," ",o]}),c.jsx("button",{className:Fe.modalHeaderClose,onClick:r,"aria-label":n.publishChecklist.closeAriaLabel,children:"×"})]}),c.jsx("div",{className:Fe.modalBody,children:a.length===0?c.jsxs("p",{style:{margin:0,fontSize:14,lineHeight:1.5},children:[n.publishChecklist.confirmPublishPrefix," ",o,"?"]}):c.jsxs(c.Fragment,{children:[c.jsx("p",{className:Fe.sectionTitle,children:n.publishChecklist.checklistInstructions}),a.map(u=>c.jsxs("label",{className:Fe.checkRow,children:[c.jsx("input",{type:"checkbox",checked:!!i[u.code],onChange:m=>s(g=>({...g,[u.code]:m.target.checked}))}),c.jsx("span",{children:u.label})]},u.code))]})}),c.jsxs("div",{className:Fe.modalFooter,children:[c.jsx($e,{variant:"ghost",onClick:r,children:n.publishChecklist.noButton}),c.jsx($e,{variant:"primary",onClick:f,disabled:!d,children:n.publishChecklist.yesButton})]})]})})},Av=({contentId:e,action:t,onConfirm:r,onCancel:n})=>{const o=le(),[a,i]=h.useState(""),[s,l]=h.useState(7),d=t==="approve",f=d?o.qualityParamsModal.reviewQualityTitle:o.qualityParamsModal.rejectContentTitle,u=!d&&a.trim().length===0,m=()=>{d?r(a.trim(),s):r(a.trim())};return c.jsx("div",{className:Fe.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"quality-modal-title",children:c.jsxs("div",{className:Fe.modal,children:[c.jsxs("div",{className:Fe.modalHeader,children:[c.jsx("span",{id:"quality-modal-title",children:f}),c.jsx("button",{className:Fe.modalHeaderClose,onClick:n,"aria-label":o.qualityParamsModal.closeAriaLabel,children:"×"})]}),c.jsx("div",{className:Fe.modalBody,children:d?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:Fe.formGroup,children:[c.jsx("label",{htmlFor:"quality-score",children:o.qualityParamsModal.qualityScoreLabel}),c.jsxs("div",{className:Fe.sliderGroup,children:[c.jsx("input",{id:"quality-score",type:"range",min:0,max:10,step:1,value:s,onChange:g=>l(Number(g.target.value)),"aria-valuemin":0,"aria-valuemax":10,"aria-valuenow":s}),c.jsx("span",{className:Fe.sliderValue,children:s})]}),c.jsxs("div",{className:Fe.sliderLabels,children:[c.jsx("span",{children:o.qualityParamsModal.scorePoorLabel}),c.jsx("span",{children:o.qualityParamsModal.scoreExcellentLabel})]})]}),c.jsxs("div",{className:Fe.formGroup,children:[c.jsxs("label",{htmlFor:"quality-comment",children:[o.qualityParamsModal.commentLabel," ",c.jsx("span",{style:{fontWeight:400,color:"var(--sbx-gray-400, #9CA3AF)"},children:o.qualityParamsModal.optionalLabel})]}),c.jsx("textarea",{id:"quality-comment",className:Fe.textarea,placeholder:o.qualityParamsModal.commentPlaceholder,value:a,onChange:g=>i(g.target.value),rows:4})]})]}):c.jsxs("div",{className:Fe.formGroup,children:[c.jsxs("label",{htmlFor:"reject-reason",children:[o.qualityParamsModal.rejectionReasonLabel," ",c.jsx("span",{style:{color:"var(--sbx-error, #DC2626)"},children:"*"})]}),c.jsx("textarea",{id:"reject-reason",className:Fe.textarea,placeholder:o.qualityParamsModal.rejectReasonPlaceholder,value:a,onChange:g=>i(g.target.value),rows:5,required:!0,"aria-required":"true"}),a.trim().length===0&&c.jsx("p",{style:{fontSize:12,color:"var(--sbx-error, #DC2626)",marginTop:4},children:o.qualityParamsModal.rejectionRequiredMessage})]})}),c.jsxs("div",{className:Fe.modalFooter,children:[c.jsx($e,{variant:"ghost",onClick:n,children:o.qualityParamsModal.cancelButton}),c.jsx($e,{variant:d?"primary":"danger",onClick:m,disabled:u,children:d?o.qualityParamsModal.approveButton:o.qualityParamsModal.rejectButton})]})]})})};function vd(e,t){return function(){return e.apply(t,arguments)}}const{toString:Dv}=Object.prototype,{getPrototypeOf:_n}=Object,{iterator:vo,toStringTag:bd}=Symbol,Ta=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),bo=(e,t)=>{let r=e;const n=[];for(;r!=null&&r!==Object.prototype;){if(n.indexOf(r)!==-1)return!1;if(n.push(r),Ta(r,t))return!0;r=_n(r)}return!1},Nv=(e,t)=>e!=null&&bo(e,t)?e[t]:void 0,us=(e=>t=>{const r=Dv.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Xt=e=>(e=e.toLowerCase(),t=>us(t)===e),Ea=e=>t=>typeof t===e,{isArray:Qr}=Array,Tn=Ea("undefined");function En(e){return e!==null&&!Tn(e)&&e.constructor!==null&&!Tn(e.constructor)&&Dt(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const wd=Xt("ArrayBuffer");function kv(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&wd(e.buffer),t}const xv=Ea("string"),Dt=Ea("function"),Cd=Ea("number"),In=e=>e!==null&&typeof e=="object",Lv=e=>e===!0||e===!1,Ia=e=>{if(!In(e))return!1;const t=_n(e);return(t===null||t===Object.prototype||_n(t)===null)&&!bo(e,bd)&&!bo(e,vo)},Pv=e=>{if(!In(e)||En(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Fv=Xt("Date"),Mv=Xt("File"),$v=e=>!!(e&&typeof e.uri<"u"),Bv=e=>e&&typeof e.getParts<"u",jv=Xt("Blob"),qv=Xt("FileList"),Uv=e=>In(e)&&Dt(e.pipe);function zv(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const Sd=zv(),_d=typeof Sd.FormData<"u"?Sd.FormData:void 0,Vv=e=>{if(!e)return!1;if(_d&&e instanceof _d)return!0;const t=_n(e);if(!t||t===Object.prototype||!Dt(e.append))return!1;const r=us(e);return r==="formdata"||r==="object"&&Dt(e.toString)&&e.toString()==="[object FormData]"},Hv=Xt("URLSearchParams"),[Rv,Qv,Gv,Wv]=["ReadableStream","Request","Response","Headers"].map(Xt),Kv=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function wo(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,o;if(typeof e!="object"&&(e=[e]),Qr(e))for(n=0,o=e.length;n<o;n++)t.call(null,e[n],n,e);else{if(En(e))return;const a=r?Object.getOwnPropertyNames(e):Object.keys(e),i=a.length;let s;for(n=0;n<i;n++)s=a[n],t.call(null,e[s],s,e)}}function Td(e,t){if(En(e))return null;t=t.toLowerCase();const r=Object.keys(e);let n=r.length,o;for(;n-- >0;)if(o=r[n],t===o.toLowerCase())return o;return null}const Gr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Ed=e=>!Tn(e)&&e!==Gr;function fs(...e){const{caseless:t,skipUndefined:r}=Ed(this)&&this||{},n={},o=(a,i)=>{if(i==="__proto__"||i==="constructor"||i==="prototype")return;const s=t&&typeof i=="string"&&Td(n,i)||i,l=Ta(n,s)?n[s]:void 0;Ia(l)&&Ia(a)?n[s]=fs(l,a):Ia(a)?n[s]=fs({},a):Qr(a)?n[s]=a.slice():(!r||!Tn(a))&&(n[s]=a)};for(let a=0,i=e.length;a<i;a++){const s=e[a];if(!s||En(s)||(wo(s,o),typeof s!="object"||Qr(s)))continue;const l=Object.getOwnPropertySymbols(s);for(let d=0;d<l.length;d++){const f=l[d];sb.call(s,f)&&o(s[f],f)}}return n}const Yv=(e,t,r,{allOwnKeys:n}={})=>(wo(t,(o,a)=>{r&&Dt(o)?Object.defineProperty(e,a,{__proto__:null,value:vd(o,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,a,{__proto__:null,value:o,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:n}),e),Zv=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Xv=(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)},Jv=(e,t,r,n)=>{let o,a,i;const s={};if(t=t||{},e==null)return t;do{for(o=Object.getOwnPropertyNames(e),a=o.length;a-- >0;)i=o[a],(!n||n(i,e,t))&&!s[i]&&(t[i]=e[i],s[i]=!0);e=r!==!1&&_n(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},eb=(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},tb=e=>{if(!e)return null;if(Qr(e))return e;let t=e.length;if(!Cd(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},rb=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&_n(Uint8Array)),nb=(e,t)=>{const n=(e&&e[vo]).call(e);let o;for(;(o=n.next())&&!o.done;){const a=o.value;t.call(e,a[0],a[1])}},ob=(e,t)=>{let r;const n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},ab=Xt("HTMLFormElement"),ib=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,o){return n.toUpperCase()+o}),{propertyIsEnumerable:sb}=Object.prototype,lb=Xt("RegExp"),Id=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};wo(r,(o,a)=>{let i;(i=t(o,a,e))!==!1&&(n[a]=i||o)}),Object.defineProperties(e,n)},cb=e=>{Id(e,(t,r)=>{if(Dt(e)&&["arguments","caller","callee"].includes(r))return!1;const n=e[r];if(Dt(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},db=(e,t)=>{const r={},n=o=>{o.forEach(a=>{r[a]=!0})};return Qr(e)?n(e):n(String(e).split(t)),r},ub=()=>{},fb=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function hb(e){return!!(e&&Dt(e.append)&&e[bd]==="FormData"&&e[vo])}const pb=e=>{const t=new WeakSet,r=n=>{if(In(n)){if(t.has(n))return;if(En(n))return n;if(!("toJSON"in n)){t.add(n);const o=Qr(n)?[]:{};return wo(n,(a,i)=>{const s=r(a);!Tn(s)&&(o[i]=s)}),t.delete(n),o}}return n};return r(e)},gb=Xt("AsyncFunction"),mb=e=>e&&(In(e)||Dt(e))&&Dt(e.then)&&Dt(e.catch),Od=((e,t)=>e?setImmediate:t?((r,n)=>(Gr.addEventListener("message",({source:o,data:a})=>{o===Gr&&a===r&&n.length&&n.shift()()},!1),o=>{n.push(o),Gr.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Dt(Gr.postMessage)),yb=typeof queueMicrotask<"u"?queueMicrotask.bind(Gr):typeof process<"u"&&process.nextTick||Od,Ad=e=>e!=null&&Dt(e[vo]),O={isArray:Qr,isArrayBuffer:wd,isBuffer:En,isFormData:Vv,isArrayBufferView:kv,isString:xv,isNumber:Cd,isBoolean:Lv,isObject:In,isPlainObject:Ia,isEmptyObject:Pv,isReadableStream:Rv,isRequest:Qv,isResponse:Gv,isHeaders:Wv,isUndefined:Tn,isDate:Fv,isFile:Mv,isReactNativeBlob:$v,isReactNative:Bv,isBlob:jv,isRegExp:lb,isFunction:Dt,isStream:Uv,isURLSearchParams:Hv,isTypedArray:rb,isFileList:qv,forEach:wo,merge:fs,extend:Yv,trim:Kv,stripBOM:Zv,inherits:Xv,toFlatObject:Jv,kindOf:us,kindOfTest:Xt,endsWith:eb,toArray:tb,forEachEntry:nb,matchAll:ob,isHTMLForm:ab,hasOwnProperty:Ta,hasOwnProp:Ta,hasOwnInPrototypeChain:bo,getSafeProp:Nv,reduceDescriptors:Id,freezeMethods:cb,toObjectSet:db,toCamelCase:ib,noop:ub,toFiniteNumber:fb,findKey:Td,global:Gr,isContextDefined:Ed,isSpecCompliantForm:hb,toJSONObject:pb,isAsyncFn:gb,isThenable:mb,setImmediate:Od,asap:yb,isIterable:Ad,isSafeIterable:e=>e!=null&&bo(e,vo)&&Ad(e)},vb=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"]),bb=e=>{const t={};let r,n,o;return e&&e.split(`
489
+ `).forEach(function(i){o=i.indexOf(":"),r=i.substring(0,o).trim().toLowerCase(),n=i.substring(o+1).trim(),!(!r||t[r]&&vb[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t};function wb(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 Cb=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),Sb=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function hs(e,t){return O.isArray(e)?e.map(r=>hs(r,t)):wb(String(e).replace(t,""))}const _b=e=>hs(e,Cb),Tb=e=>hs(e,Sb);function Dd(e){const t=Object.create(null);return O.forEach(e.toJSON(),(r,n)=>{t[n]=Tb(r)}),t}const Nd=Symbol("internals");function Co(e){return e&&String(e).trim().toLowerCase()}function Oa(e){return e===!1||e==null?e:O.isArray(e)?e.map(Oa):_b(String(e))}function Eb(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 Ib=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function ps(e,t,r,n,o){if(O.isFunction(n))return n.call(this,t,r);if(o&&(t=r),!!O.isString(t)){if(O.isString(n))return t.indexOf(n)!==-1;if(O.isRegExp(n))return n.test(t)}}function Ob(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function Ab(e,t){const r=O.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{__proto__:null,value:function(o,a,i){return this[n].call(this,t,o,a,i)},configurable:!0})})}let gt=class{constructor(t){t&&this.set(t)}set(t,r,n){const o=this;function a(s,l,d){const f=Co(l);if(!f)return;const u=O.findKey(o,f);(!u||o[u]===void 0||d===!0||d===void 0&&o[u]!==!1)&&(o[u||l]=Oa(s))}const i=(s,l)=>O.forEach(s,(d,f)=>a(d,f,l));if(O.isPlainObject(t)||t instanceof this.constructor)i(t,r);else if(O.isString(t)&&(t=t.trim())&&!Ib(t))i(bb(t),r);else if(O.isObject(t)&&O.isSafeIterable(t)){let s=Object.create(null),l,d;for(const f of t){if(!O.isArray(f))throw new TypeError("Object iterator must return a key-value pair");d=f[0],O.hasOwnProp(s,d)?(l=s[d],s[d]=O.isArray(l)?[...l,f[1]]:[l,f[1]]):s[d]=f[1]}i(s,r)}else t!=null&&a(r,t,n);return this}get(t,r){if(t=Co(t),t){const n=O.findKey(this,t);if(n){const o=this[n];if(!r)return o;if(r===!0)return Eb(o);if(O.isFunction(r))return r.call(this,o,n);if(O.isRegExp(r))return r.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=Co(t),t){const n=O.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||ps(this,this[n],n,r)))}return!1}delete(t,r){const n=this;let o=!1;function a(i){if(i=Co(i),i){const s=O.findKey(n,i);s&&(!r||ps(n,n[s],s,r))&&(delete n[s],o=!0)}}return O.isArray(t)?t.forEach(a):a(t),o}clear(t){const r=Object.keys(this);let n=r.length,o=!1;for(;n--;){const a=r[n];(!t||ps(this,this[a],a,t,!0))&&(delete this[a],o=!0)}return o}normalize(t){const r=this,n={};return O.forEach(this,(o,a)=>{const i=O.findKey(n,a);if(i){r[i]=Oa(o),delete r[a];return}const s=t?Ob(a):String(a).trim();s!==a&&delete r[a],r[s]=Oa(o),n[s]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const r=Object.create(null);return O.forEach(this,(n,o)=>{n!=null&&n!==!1&&(r[o]=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(`
490
+ `)}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(o=>n.set(o)),n}static accessor(t){const n=(this[Nd]=this[Nd]={accessors:{}}).accessors,o=this.prototype;function a(i){const s=Co(i);n[s]||(Ab(o,i),n[s]=!0)}return O.isArray(t)?t.forEach(a):a(t),this}};gt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),O.reduceDescriptors(gt.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}}),O.freezeMethods(gt);const Db="[REDACTED ****]";function Nb(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 kb(e,t){const r=new Set(t.map(a=>String(a).toLowerCase())),n=[],o=a=>{if(a===null||typeof a!="object"||O.isBuffer(a))return a;if(n.indexOf(a)!==-1)return;a instanceof gt&&(a=a.toJSON()),n.push(a);let i;if(O.isArray(a))i=[],a.forEach((s,l)=>{const d=o(s);O.isUndefined(d)||(i[l]=d)});else{if(!O.isPlainObject(a)&&Nb(a))return n.pop(),a;i=Object.create(null);for(const[s,l]of Object.entries(a)){const d=r.has(s.toLowerCase())?Db:o(l);O.isUndefined(d)||(i[s]=d)}}return n.pop(),i};return o(e)}let Z=class Cp extends Error{static from(t,r,n,o,a,i){const s=new Cp(t.message,r||t.code,n,o,a);return s.cause=t,s.name=t.name,t.status!=null&&s.status==null&&(s.status=t.status),i&&Object.assign(s,i),s}constructor(t,r,n,o,a){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),o&&(this.request=o),a&&(this.response=a,this.status=a.status)}toJSON(){const t=this.config,r=t&&O.hasOwnProp(t,"redact")?t.redact:void 0,n=O.isArray(r)&&r.length>0?kb(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}}};Z.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",Z.ERR_BAD_OPTION="ERR_BAD_OPTION",Z.ECONNABORTED="ECONNABORTED",Z.ETIMEDOUT="ETIMEDOUT",Z.ECONNREFUSED="ECONNREFUSED",Z.ERR_NETWORK="ERR_NETWORK",Z.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",Z.ERR_DEPRECATED="ERR_DEPRECATED",Z.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",Z.ERR_BAD_REQUEST="ERR_BAD_REQUEST",Z.ERR_CANCELED="ERR_CANCELED",Z.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",Z.ERR_INVALID_URL="ERR_INVALID_URL",Z.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const xb=null,kd=100;function gs(e){return O.isPlainObject(e)||O.isArray(e)}function xd(e){return O.endsWith(e,"[]")?e.slice(0,-2):e}function ms(e,t,r){return e?e.concat(t).map(function(o,a){return o=xd(o),!r&&a?"["+o+"]":o}).join(r?".":""):t}function Lb(e){return O.isArray(e)&&!e.some(gs)}const Pb=O.toFlatObject(O,{},null,function(t){return/^is[A-Z]/.test(t)});function Aa(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,C){return!O.isUndefined(C[b])});const n=r.metaTokens,o=r.visitor||w,a=r.dots,i=r.indexes,s=r.Blob||typeof Blob<"u"&&Blob,l=r.maxDepth===void 0?kd:r.maxDepth,d=s&&O.isSpecCompliantForm(t),f=[];if(!O.isFunction(o))throw new TypeError("visitor must be a function");function u(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 Z("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 m(v){if(v>l)throw new Z("Object is too deeply nested ("+v+" levels). Max depth: "+l,Z.ERR_FORM_DATA_DEPTH_EXCEEDED)}function g(v,b){if(l===1/0)return JSON.stringify(v);const C=[];return JSON.stringify(v,function(T,I){if(!O.isObject(I))return I;for(;C.length&&C[C.length-1]!==this;)C.pop();return C.push(I),m(b+C.length-1),I})}function w(v,b,C){let S=v;if(O.isReactNative(t)&&O.isReactNativeBlob(v))return t.append(ms(C,b,a),u(v)),!1;if(v&&!C&&typeof v=="object"){if(O.endsWith(b,"{}"))b=n?b:b.slice(0,-2),v=g(v,1);else if(O.isArray(v)&&Lb(v)||(O.isFileList(v)||O.endsWith(b,"[]"))&&(S=O.toArray(v)))return b=xd(b),S.forEach(function(I,k){!(O.isUndefined(I)||I===null)&&t.append(i===!0?ms([b],k,a):i===null?b:b+"[]",u(I))}),!1}return gs(v)?!0:(t.append(ms(C,b,a),u(v)),!1)}const p=Object.assign(Pb,{defaultVisitor:w,convertValue:u,isVisitable:gs});function y(v,b,C=0){if(!O.isUndefined(v)){if(m(C),f.indexOf(v)!==-1)throw new Error("Circular reference detected in "+b.join("."));f.push(v),O.forEach(v,function(T,I){(!(O.isUndefined(T)||T===null)&&o.call(t,T,O.isString(I)?I.trim():I,b,p))===!0&&y(T,b?b.concat(I):[I],C+1)}),f.pop()}}if(!O.isObject(e))throw new TypeError("data must be an object");return y(e),t}function Ld(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(n){return t[n]})}function ys(e,t){this._pairs=[],e&&Aa(e,this,t)}const Pd=ys.prototype;Pd.append=function(t,r){this._pairs.push([t,r])},Pd.toString=function(t){const r=t?function(n){return t.call(this,n,Ld)}:Ld;return this._pairs.map(function(o){return r(o[0])+"="+r(o[1])},"").join("&")};function Fb(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Fd(e,t,r){if(!t)return e;const n=O.isFunction(r)?{serialize:r}:r,o=O.getSafeProp(n,"encode")||Fb,a=O.getSafeProp(n,"serialize");let i;if(a?i=a(t,n):i=O.isURLSearchParams(t)?t.toString():new ys(t,n).toString(o),i){const s=e.indexOf("#");s!==-1&&(e=e.slice(0,s)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class Md{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 vs={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},Mb={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:ys,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},bs=typeof window<"u"&&typeof document<"u",ws=typeof navigator=="object"&&navigator||void 0,$b=bs&&(!ws||["ReactNative","NativeScript","NS"].indexOf(ws.product)<0),Bb=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",jb=bs&&window.location.href||"http://localhost",ut={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:bs,hasStandardBrowserEnv:$b,hasStandardBrowserWebWorkerEnv:Bb,navigator:ws,origin:jb},Symbol.toStringTag,{value:"Module"})),...Mb};function qb(e,t){return Aa(e,new ut.classes.URLSearchParams,{visitor:function(r,n,o,a){return ut.isNode&&O.isBuffer(r)?(this.append(n,r.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)},...t})}const $d=kd;function Bd(e){if(e>$d)throw new Z("FormData field is too deeply nested ("+e+" levels). Max depth: "+$d,Z.ERR_FORM_DATA_DEPTH_EXCEEDED)}function Ub(e){const t=[],r=/\w+|\[(\w*)]/g;let n;for(;(n=r.exec(e))!==null;)Bd(t.length),t.push(n[0]==="[]"?"":n[1]||n[0]);return t}function zb(e){const t={},r=Object.keys(e);let n;const o=r.length;let a;for(n=0;n<o;n++)a=r[n],t[a]=e[a];return t}function jd(e){function t(r,n,o,a){Bd(a);let i=r[a++];if(i==="__proto__")return!0;const s=Number.isFinite(+i),l=a>=r.length;return i=!i&&O.isArray(o)?o.length:i,l?(O.hasOwnProp(o,i)?o[i]=O.isArray(o[i])?o[i].concat(n):[o[i],n]:o[i]=n,!s):((!O.hasOwnProp(o,i)||!O.isObject(o[i]))&&(o[i]=[]),t(r,n,o[i],a)&&O.isArray(o[i])&&(o[i]=zb(o[i])),!s)}if(O.isFormData(e)&&O.isFunction(e.entries)){const r={};return O.forEachEntry(e,(n,o)=>{t(Ub(n),o,r,0)}),r}return null}const On=(e,t)=>e!=null&&O.hasOwnProp(e,t)?e[t]:void 0;function Vb(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 So={transitional:vs,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){const n=r.getContentType()||"",o=n.indexOf("application/json")>-1,a=O.isObject(t);if(a&&O.isHTMLForm(t)&&(t=new FormData(t)),O.isFormData(t))return o?JSON.stringify(jd(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 s;if(a){const l=On(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return qb(t,l).toString();if((s=O.isFileList(t))||n.indexOf("multipart/form-data")>-1){const d=On(this,"env"),f=d&&d.FormData;return Aa(s?{"files[]":t}:t,f&&new f,l)}}return a||o?(r.setContentType("application/json",!1),Vb(t)):t}],transformResponse:[function(t){const r=On(this,"transitional")||So.transitional,n=r&&r.forcedJSONParsing,o=On(this,"responseType"),a=o==="json";if(O.isResponse(t)||O.isReadableStream(t))return t;if(t&&O.isString(t)&&(n&&!o||a)){const s=!(r&&r.silentJSONParsing)&&a;try{return JSON.parse(t,On(this,"parseReviver"))}catch(l){if(s)throw l.name==="SyntaxError"?Z.from(l,Z.ERR_BAD_RESPONSE,this,null,On(this,"response")):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ut.classes.FormData,Blob:ut.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};O.forEach(["delete","get","head","post","put","patch","query"],e=>{So.headers[e]={}});function Cs(e,t){const r=this||So,n=t||r,o=gt.from(n.headers);let a=n.data;return O.forEach(e,function(s){a=s.call(r,a,o.normalize(),t?t.status:void 0)}),o.normalize(),a}function qd(e){return!!(e&&e.__CANCEL__)}let _o=class extends Z{constructor(t,r,n){super(t??"canceled",Z.ERR_CANCELED,r,n),this.name="CanceledError",this.__CANCEL__=!0}};function Ud(e,t,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new Z("Request failed with status code "+r.status,r.status>=400&&r.status<500?Z.ERR_BAD_REQUEST:Z.ERR_BAD_RESPONSE,r.config,r.request,r))}function Hb(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}function Rb(e,t){e=e||10;const r=new Array(e),n=new Array(e);let o=0,a=0,i;return t=t!==void 0?t:1e3,function(l){const d=Date.now(),f=n[a];i||(i=d),r[o]=l,n[o]=d;let u=a,m=0;for(;u!==o;)m+=r[u++],u=u%e;if(o=(o+1)%e,o===a&&(a=(a+1)%e),d-i<t)return;const g=f&&d-f;return g?Math.round(m*1e3/g):void 0}}function Qb(e,t){let r=0,n=1e3/t,o,a;const i=(d,f=Date.now())=>{r=f,o=null,a&&(clearTimeout(a),a=null),e(...d)};return[(...d)=>{const f=Date.now(),u=f-r;u>=n?i(d,f):(o=d,a||(a=setTimeout(()=>{a=null,i(o)},n-u)))},()=>o&&i(o)]}const Da=(e,t,r=3)=>{let n=0;const o=Rb(50,250);return Qb(a=>{if(!a||typeof a.loaded!="number")return;const i=a.loaded,s=a.lengthComputable?a.total:void 0,l=s!=null?Math.min(i,s):i,d=Math.max(0,l-n),f=o(d);n=Math.max(n,l);const u={loaded:l,total:s,progress:s?l/s:void 0,bytes:d,rate:f||void 0,estimated:f&&s?(s-l)/f:void 0,event:a,lengthComputable:s!=null,[t?"download":"upload"]:!0};e(u)},r)},zd=(e,t)=>{const r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},Vd=e=>(...t)=>O.asap(()=>e(...t)),Gb=ut.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,ut.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(ut.origin),ut.navigator&&/(msie|trident)/i.test(ut.navigator.userAgent)):()=>!0,Wb=ut.hasStandardBrowserEnv?{write(e,t,r,n,o,a,i){if(typeof document>"u")return;const s=[`${e}=${encodeURIComponent(t)}`];O.isNumber(r)&&s.push(`expires=${new Date(r).toUTCString()}`),O.isString(n)&&s.push(`path=${n}`),O.isString(o)&&s.push(`domain=${o}`),a===!0&&s.push("secure"),O.isString(i)&&s.push(`SameSite=${i}`),document.cookie=s.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+/,""),o=n.indexOf("=");if(o!==-1&&n.slice(0,o)===e)return decodeURIComponent(n.slice(o+1))}return null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Kb(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Yb(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}const Zb=/^https?:(?!\/\/)/i,Xb=/[\t\n\r]/g;function Jb(e){let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t)}function ew(e){return Jb(e).replace(Xb,"")}function Hd(e,t){if(typeof e=="string"&&Zb.test(ew(e)))throw new Z('Invalid URL: missing "//" after protocol',Z.ERR_INVALID_URL,t)}function Rd(e,t,r,n){Hd(t,n);let o=!Kb(t);return e&&(o||r===!1)?(Hd(e,n),Yb(e,t)):t}const Qd=e=>e instanceof gt?{...e}:e;function Wr(e,t){t=t||{};const r=Object.create(null);Object.defineProperty(r,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function n(f,u,m,g){return O.isPlainObject(f)&&O.isPlainObject(u)?O.merge.call({caseless:g},f,u):O.isPlainObject(u)?O.merge({},u):O.isArray(u)?u.slice():u}function o(f,u,m,g){if(O.isUndefined(u)){if(!O.isUndefined(f))return n(void 0,f,m,g)}else return n(f,u,m,g)}function a(f,u){if(!O.isUndefined(u))return n(void 0,u)}function i(f,u){if(O.isUndefined(u)){if(!O.isUndefined(f))return n(void 0,f)}else return n(void 0,u)}function s(f){const u=O.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!O.isUndefined(u))if(O.isPlainObject(u)){if(O.hasOwnProp(u,f))return u[f]}else return;const m=O.hasOwnProp(e,"transitional")?e.transitional:void 0;if(O.isPlainObject(m)&&O.hasOwnProp(m,f))return m[f]}function l(f,u,m){if(O.hasOwnProp(t,m))return n(f,u);if(O.hasOwnProp(e,m))return n(void 0,f)}const d={url:a,method:a,data:a,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,allowedSocketPaths:i,responseEncoding:i,validateStatus:l,headers:(f,u,m)=>o(Qd(f),Qd(u),m,!0)};return O.forEach(Object.keys({...e,...t}),function(u){if(u==="__proto__"||u==="constructor"||u==="prototype")return;const m=O.hasOwnProp(d,u)?d[u]:o,g=O.hasOwnProp(e,u)?e[u]:void 0,w=O.hasOwnProp(t,u)?t[u]:void 0,p=m(g,w,u);O.isUndefined(p)&&m!==l||(r[u]=p)}),O.hasOwnProp(t,"validateStatus")&&O.isUndefined(t.validateStatus)&&s("validateStatusUndefinedResolves")===!1&&(O.hasOwnProp(e,"validateStatus")?r.validateStatus=n(void 0,e.validateStatus):delete r.validateStatus),r}const tw=["content-type","content-length"];function rw(e,t,r){if(r!=="content-only"){e.set(t);return}Object.entries(t).forEach(([n,o])=>{tw.includes(n.toLowerCase())&&e.set(n,o)})}const nw=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,r)=>String.fromCharCode(parseInt(r,16)));function Gd(e){const t=Wr({},e),r=m=>O.hasOwnProp(t,m)?t[m]:void 0,n=r("data");let o=r("withXSRFToken");const a=r("xsrfHeaderName"),i=r("xsrfCookieName");let s=r("headers");const l=r("auth"),d=r("baseURL"),f=r("allowAbsoluteUrls"),u=r("url");if(t.headers=s=gt.from(s),t.url=Fd(Rd(d,u,f,t),r("params"),r("paramsSerializer")),l){const m=O.getSafeProp(l,"username")||"",g=O.getSafeProp(l,"password")||"";s.set("Authorization","Basic "+btoa(m+":"+(g?nw(g):"")))}if(O.isFormData(n)&&(ut.hasStandardBrowserEnv||ut.hasStandardBrowserWebWorkerEnv||O.isReactNative(n)?s.setContentType(void 0):O.isFunction(n.getHeaders)&&rw(s,n.getHeaders(),r("formDataHeaderPolicy"))),ut.hasStandardBrowserEnv&&(O.isFunction(o)&&(o=o(t)),o===!0||o==null&&Gb(t.url))){const g=a&&i&&Wb.read(i);g&&s.set(a,g)}return t}const ow=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(r,n){const o=Gd(e);let a=o.data;const i=gt.from(o.headers).normalize();let{responseType:s,onUploadProgress:l,onDownloadProgress:d}=o,f,u,m,g,w;function p(){g&&g(),w&&w(),o.cancelToken&&o.cancelToken.unsubscribe(f),o.signal&&o.signal.removeEventListener("abort",f)}let y=new XMLHttpRequest;y.open(o.method.toUpperCase(),o.url,!0),y.timeout=o.timeout;function v(){if(!y)return;const C=gt.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),T={data:!s||s==="text"||s==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:C,config:e,request:y};Ud(function(k){r(k),p()},function(k){n(k),p()},T),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 Z("Request aborted",Z.ECONNABORTED,e,y)),p(),y=null)},y.onerror=function(S){const T=S&&S.message?S.message:"Network Error",I=new Z(T,Z.ERR_NETWORK,e,y);I.event=S||null,n(I),p(),y=null},y.ontimeout=function(){let S=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const T=o.transitional||vs;o.timeoutErrorMessage&&(S=o.timeoutErrorMessage),n(new Z(S,T.clarifyTimeoutError?Z.ETIMEDOUT:Z.ECONNABORTED,e,y)),p(),y=null},a===void 0&&i.setContentType(null),"setRequestHeader"in y&&O.forEach(Dd(i),function(S,T){y.setRequestHeader(T,S)}),O.isUndefined(o.withCredentials)||(y.withCredentials=!!o.withCredentials),s&&s!=="json"&&(y.responseType=o.responseType),d&&([m,w]=Da(d,!0),y.addEventListener("progress",m)),l&&y.upload&&([u,g]=Da(l),y.upload.addEventListener("progress",u),y.upload.addEventListener("loadend",g)),(o.cancelToken||o.signal)&&(f=C=>{y&&(n(!C||C.type?new _o(null,e,y):C),y.abort(),p(),y=null)},o.cancelToken&&o.cancelToken.subscribe(f),o.signal&&(o.signal.aborted?f():o.signal.addEventListener("abort",f)));const b=Hb(o.url);if(b&&!ut.protocols.includes(b)){n(new Z("Unsupported protocol "+b+":",Z.ERR_BAD_REQUEST,e));return}y.send(a||null)})},aw=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;const r=new AbortController;let n=!1;const o=function(l){if(!n){n=!0,i();const d=l instanceof Error?l:this.reason;r.abort(d instanceof Z?d:new _o(d instanceof Error?d.message:d))}};let a=t&&setTimeout(()=>{a=null,o(new Z(`timeout of ${t}ms exceeded`,Z.ETIMEDOUT))},t);const i=()=>{e&&(a&&clearTimeout(a),a=null,e.forEach(l=>{l.unsubscribe?l.unsubscribe(o):l.removeEventListener("abort",o)}),e=null)};e.forEach(l=>l.addEventListener("abort",o));const{signal:s}=r;return s.unsubscribe=()=>O.asap(i),s},iw=function*(e,t){let r=e.byteLength;if(r<t){yield e;return}let n=0,o;for(;n<r;)o=n+t,yield e.slice(n,o),n=o},sw=async function*(e,t){for await(const r of lw(e))yield*iw(r,t)},lw=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()}},Wd=(e,t,r,n)=>{const o=sw(e,t);let a=0,i,s=l=>{i||(i=!0,n&&n(l))};return new ReadableStream({async pull(l){try{const{done:d,value:f}=await o.next();if(d){s(),l.close();return}let u=f.byteLength;if(r){let m=a+=u;r(m)}l.enqueue(new Uint8Array(f))}catch(d){throw s(d),d}},cancel(l){return s(l),o.return()}},{highWaterMark:2})},Na=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,cw=(e,t,r)=>t+2<r&&Na(e.charCodeAt(t+1))&&Na(e.charCodeAt(t+2));function dw(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 i=n.length;const s=n.length;for(let g=0;g<s;g++)if(n.charCodeAt(g)===37&&g+2<s){const w=n.charCodeAt(g+1),p=n.charCodeAt(g+2);Na(w)&&Na(p)&&(i-=2,g+=2)}let l=0,d=s-1;const f=g=>g>=2&&n.charCodeAt(g-2)===37&&n.charCodeAt(g-1)===51&&(n.charCodeAt(g)===68||n.charCodeAt(g)===100);d>=0&&(n.charCodeAt(d)===61?(l++,d--):f(d)&&(l++,d-=3)),l===1&&d>=0&&(n.charCodeAt(d)===61||f(d))&&l++;const m=Math.floor(i/4)*3-(l||0);return m>0?m:0}let a=0;for(let i=0,s=n.length;i<s;i++){const l=n.charCodeAt(i);if(l===37&&cw(n,i,s))a+=1,i+=2;else if(l<128)a+=1;else if(l<2048)a+=2;else if(l>=55296&&l<=56319&&i+1<s){const d=n.charCodeAt(i+1);d>=56320&&d<=57343?(a+=4,i++):a+=3}else a+=3}return a}const Ss="1.18.0",Kd=64*1024,{isFunction:ka}=O,uw=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,r)=>String.fromCharCode(parseInt(r,16))),Yd=e=>{if(!O.isString(e))return e;try{return decodeURIComponent(e)}catch{return e}},Zd=(e,...t)=>{try{return!!e(...t)}catch{return!1}},fw=e=>{const t=e.indexOf("://");let r=e;return t!==-1&&(r=r.slice(t+3)),r.includes("@")||r.includes(":")},hw=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:o,Request:a,Response:i}=e,s=o?ka(o):typeof fetch=="function",l=ka(a),d=ka(i);if(!s)return!1;const f=s&&ka(r),u=s&&(typeof n=="function"?(v=>b=>v.encode(b))(new n):async v=>new Uint8Array(await new a(v).arrayBuffer())),m=l&&f&&Zd(()=>{let v=!1;const b=new a(ut.origin,{body:new r,method:"POST",get duplex(){return v=!0,"half"}}),C=b.headers.has("Content-Type");return b.body!=null&&b.body.cancel(),v&&!C}),g=d&&f&&Zd(()=>O.isReadableStream(new i("").body)),w={stream:g&&(v=>v.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(v=>{!w[v]&&(w[v]=(b,C)=>{let S=b&&b[v];if(S)return S.call(b);throw new Z(`Response type '${v}' is not supported`,Z.ERR_NOT_SUPPORT,C)})});const p=async v=>{if(v==null)return 0;if(O.isBlob(v))return v.size;if(O.isSpecCompliantForm(v))return(await new a(ut.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 u(v)).byteLength},y=async(v,b)=>{const C=O.toFiniteNumber(v.getContentLength());return C??p(b)};return async v=>{let{url:b,method:C,data:S,signal:T,cancelToken:I,timeout:k,onDownloadProgress:x,onUploadProgress:$,responseType:j,headers:N,withCredentials:L="same-origin",fetchOptions:B,maxContentLength:P,maxBodyLength:F}=Gd(v);const V=O.isNumber(P)&&P>-1,X=O.isNumber(F)&&F>-1,ve=H=>O.hasOwnProp(v,H)?v[H]:void 0;let Ee=o||fetch;j=j?(j+"").toLowerCase():"text";let Ce=aw([T,I&&I.toAbortSignal()],k),ue=null;const Q=Ce&&Ce.unsubscribe&&(()=>{Ce.unsubscribe()});let ne,te=null;const U=()=>new Z("Request body larger than maxBodyLength limit",Z.ERR_BAD_REQUEST,v,ue);try{let H;const ae=ve("auth");if(ae){const re=O.getSafeProp(ae,"username")||"",Ke=O.getSafeProp(ae,"password")||"";H={username:re,password:Ke}}if(fw(b)){const re=new URL(b,ut.origin);if(!H&&(re.username||re.password)){const Ke=Yd(re.username),Re=Yd(re.password);H={username:Ke,password:Re}}(re.username||re.password)&&(re.username="",re.password="",b=re.href)}if(H&&(N.delete("authorization"),N.set("Authorization","Basic "+btoa(uw((H.username||"")+":"+(H.password||""))))),V&&typeof b=="string"&&b.startsWith("data:")&&dw(b)>P)throw new Z("maxContentLength size of "+P+" exceeded",Z.ERR_BAD_RESPONSE,v,ue);if(X&&C!=="get"&&C!=="head"){const re=await p(S);if(typeof re=="number"&&isFinite(re)&&(ne=re,re>F))throw U()}const fe=X&&(O.isReadableStream(S)||O.isStream(S)),J=(re,Ke,Re)=>Wd(re,Kd,He=>{if(X&&He>F)throw te=U();Ke&&Ke(He)},Re);if(m&&C!=="get"&&C!=="head"&&($||fe)){if(ne=ne??await y(N,S),ne!==0||fe){let re=new a(b,{method:"POST",body:S,duplex:"half"}),Ke;if(O.isFormData(S)&&(Ke=re.headers.get("content-type"))&&N.setContentType(Ke),re.body){const[Re,He]=$&&zd(ne,Da(Vd($)))||[];S=J(re.body,Re,He)}}}else if(fe&&!l&&f&&C!=="get"&&C!=="head")S=J(S);else if(fe&&l&&!m&&C!=="get"&&C!=="head")throw new Z("Stream request bodies are not supported by the current fetch implementation",Z.ERR_NOT_SUPPORT,v,ue);O.isString(L)||(L=L?"include":"omit");const oe=l&&"credentials"in a.prototype;if(O.isFormData(S)){const re=N.getContentType();re&&/^multipart\/form-data/i.test(re)&&!/boundary=/i.test(re)&&N.delete("content-type")}N.set("User-Agent","axios/"+Ss,!1);const Me={...B,signal:Ce,method:C.toUpperCase(),headers:Dd(N.normalize()),body:S,duplex:"half",credentials:oe?L:void 0};ue=l&&new a(b,Me);let Oe=await(l?Ee(ue,B):Ee(b,Me));const ze=gt.from(Oe.headers);if(V){const re=O.toFiniteNumber(ze.getContentLength());if(re!=null&&re>P)throw new Z("maxContentLength size of "+P+" exceeded",Z.ERR_BAD_RESPONSE,v,ue)}const We=g&&(j==="stream"||j==="response");if(g&&Oe.body&&(x||V||We&&Q)){const re={};["status","statusText","headers"].forEach(It=>{re[It]=Oe[It]});const Ke=O.toFiniteNumber(ze.getContentLength()),[Re,He]=x&&zd(Ke,Da(Vd(x),!0))||[];let et=0;const Gt=It=>{if(V&&(et=It,et>P))throw new Z("maxContentLength size of "+P+" exceeded",Z.ERR_BAD_RESPONSE,v,ue);Re&&Re(It)};Oe=new i(Wd(Oe.body,Kd,Gt,()=>{He&&He(),Q&&Q()}),re)}j=j||"text";let Ve=await w[O.findKey(w,j)||"text"](Oe,v);if(V&&!g&&!We){let re;if(Ve!=null&&(typeof Ve.byteLength=="number"?re=Ve.byteLength:typeof Ve.size=="number"?re=Ve.size:typeof Ve=="string"&&(re=typeof n=="function"?new n().encode(Ve).byteLength:Ve.length)),typeof re=="number"&&re>P)throw new Z("maxContentLength size of "+P+" exceeded",Z.ERR_BAD_RESPONSE,v,ue)}return!We&&Q&&Q(),await new Promise((re,Ke)=>{Ud(re,Ke,{data:Ve,headers:gt.from(Oe.headers),status:Oe.status,statusText:Oe.statusText,config:v,request:ue})})}catch(H){if(Q&&Q(),Ce&&Ce.aborted&&Ce.reason instanceof Z){const ae=Ce.reason;throw ae.config=v,ue&&(ae.request=ue),H!==ae&&(ae.cause=H),ae}throw te?(ue&&!te.request&&(te.request=ue),te):H instanceof Z?(ue&&!H.request&&(H.request=ue),H):H&&H.name==="TypeError"&&/Load failed|fetch/i.test(H.message)?Object.assign(new Z("Network Error",Z.ERR_NETWORK,v,ue,H&&H.response),{cause:H.cause||H}):Z.from(H,H&&H.code,v,ue,H&&H.response)}}},pw=new Map,Xd=e=>{let t=e&&e.env||{};const{fetch:r,Request:n,Response:o}=t,a=[n,o,r];let i=a.length,s=i,l,d,f=pw;for(;s--;)l=a[s],d=f.get(l),d===void 0&&f.set(l,d=s?new Map:hw(t)),f=d;return d};Xd();const _s={http:xb,xhr:ow,fetch:{get:Xd}};O.forEach(_s,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch{}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const Jd=e=>`- ${e}`,gw=e=>O.isFunction(e)||e===null||e===!1;function mw(e,t){e=O.isArray(e)?e:[e];const{length:r}=e;let n,o;const a={};for(let i=0;i<r;i++){n=e[i];let s;if(o=n,!gw(n)&&(o=_s[(s=String(n)).toLowerCase()],o===void 0))throw new Z(`Unknown adapter '${s}'`);if(o&&(O.isFunction(o)||(o=o.get(t))))break;a[s||"#"+i]=o}if(!o){const i=Object.entries(a).map(([l,d])=>`adapter ${l} `+(d===!1?"is not supported by the environment":"is not available in the build"));let s=r?i.length>1?`since :
491
+ `+i.map(Jd).join(`
492
+ `):" "+Jd(i[0]):"as no adapter specified";throw new Z("There is no suitable adapter to dispatch the request "+s,"ERR_NOT_SUPPORT")}return o}const eu={getAdapter:mw,adapters:_s};function Ts(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new _o(null,e)}function tu(e){return Ts(e),e.headers=gt.from(e.headers),e.data=Cs.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),eu.getAdapter(e.adapter||So.adapter,e)(e).then(function(n){Ts(e),e.response=n;try{n.data=Cs.call(e,e.transformResponse,n)}finally{delete e.response}return n.headers=gt.from(n.headers),n},function(n){if(!qd(n)&&(Ts(e),n&&n.response)){e.response=n.response;try{n.response.data=Cs.call(e,e.transformResponse,n.response)}finally{delete e.response}n.response.headers=gt.from(n.response.headers)}return Promise.reject(n)})}const xa={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{xa[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const ru={};xa.transitional=function(t,r,n){function o(a,i){return"[Axios v"+Ss+"] Transitional option '"+a+"'"+i+(n?". "+n:"")}return(a,i,s)=>{if(t===!1)throw new Z(o(i," has been removed"+(r?" in "+r:"")),Z.ERR_DEPRECATED);return r&&!ru[i]&&(ru[i]=!0,console.warn(o(i," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(a,i,s):!0}},xa.spelling=function(t){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${t}`),!0)};function yw(e,t,r){if(typeof e!="object")throw new Z("options must be an object",Z.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let o=n.length;for(;o-- >0;){const a=n[o],i=Object.prototype.hasOwnProperty.call(t,a)?t[a]:void 0;if(i){const s=e[a],l=s===void 0||i(s,a,e);if(l!==!0)throw new Z("option "+a+" must be "+l,Z.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new Z("Unknown option "+a,Z.ERR_BAD_OPTION)}}const La={assertOptions:yw,validators:xa},mt=La.validators;let Kr=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Md,response:new Md}}async request(t,r){try{return await this._request(t,r)}catch(n){if(n instanceof Error){let o={};Error.captureStackTrace?Error.captureStackTrace(o):o=new Error;const a=(()=>{if(!o.stack)return"";const i=o.stack.indexOf(`
493
+ `);return i===-1?"":o.stack.slice(i+1)})();try{if(!n.stack)n.stack=a;else if(a){const i=a.indexOf(`
494
+ `),s=i===-1?-1:a.indexOf(`
495
+ `,i+1),l=s===-1?"":a.slice(s+1);String(n.stack).endsWith(l)||(n.stack+=`
496
+ `+a)}}catch{}}throw n}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=Wr(this.defaults,r);const{transitional:n,paramsSerializer:o,headers:a}=r;n!==void 0&&La.assertOptions(n,{silentJSONParsing:mt.transitional(mt.boolean),forcedJSONParsing:mt.transitional(mt.boolean),clarifyTimeoutError:mt.transitional(mt.boolean),legacyInterceptorReqResOrdering:mt.transitional(mt.boolean),advertiseZstdAcceptEncoding:mt.transitional(mt.boolean),validateStatusUndefinedResolves:mt.transitional(mt.boolean)},!1),o!=null&&(O.isFunction(o)?r.paramsSerializer={serialize:o}:La.assertOptions(o,{encode:mt.function,serialize:mt.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),La.assertOptions(r,{baseUrl:mt.spelling("baseURL"),withXsrfToken:mt.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let i=a&&O.merge(a.common,a[r.method]);a&&O.forEach(["delete","get","head","post","put","patch","query","common"],w=>{delete a[w]}),r.headers=gt.concat(i,a);const s=[];let l=!0;this.interceptors.request.forEach(function(p){if(typeof p.runWhen=="function"&&p.runWhen(r)===!1)return;l=l&&p.synchronous;const y=r.transitional||vs;y&&y.legacyInterceptorReqResOrdering?s.unshift(p.fulfilled,p.rejected):s.push(p.fulfilled,p.rejected)});const d=[];this.interceptors.response.forEach(function(p){d.push(p.fulfilled,p.rejected)});let f,u=0,m;if(!l){const w=[tu.bind(this),void 0];for(w.unshift(...s),w.push(...d),m=w.length,f=Promise.resolve(r);u<m;)f=f.then(w[u++],w[u++]);return f}m=s.length;let g=r;for(;u<m;){const w=s[u++],p=s[u++];try{g=w(g)}catch(y){p.call(this,y);break}}try{f=tu.call(this,g)}catch(w){return Promise.reject(w)}for(u=0,m=d.length;u<m;)f=f.then(d[u++],d[u++]);return f}getUri(t){t=Wr(this.defaults,t);const r=Rd(t.baseURL,t.url,t.allowAbsoluteUrls,t);return Fd(r,t.params,t.paramsSerializer)}};O.forEach(["delete","get","head","options"],function(t){Kr.prototype[t]=function(r,n){return this.request(Wr(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(a,i,s){return this.request(Wr(s||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:a,data:i}))}}Kr.prototype[t]=r(),t!=="query"&&(Kr.prototype[t+"Form"]=r(!0))});let vw=class Sp{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(a){r=a});const n=this;this.promise.then(o=>{if(!n._listeners)return;let a=n._listeners.length;for(;a-- >0;)n._listeners[a](o);n._listeners=null}),this.promise.then=o=>{let a;const i=new Promise(s=>{n.subscribe(s),a=s}).then(o);return i.cancel=function(){n.unsubscribe(a)},i},t(function(a,i,s){n.reason||(n.reason=new _o(a,i,s),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 Sp(function(o){t=o}),cancel:t}}};function bw(e){return function(r){return e.apply(null,r)}}function ww(e){return O.isObject(e)&&e.isAxiosError===!0}const Es={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(Es).forEach(([e,t])=>{Es[t]=e});function nu(e){const t=new Kr(e),r=vd(Kr.prototype.request,t);return O.extend(r,Kr.prototype,t,{allOwnKeys:!0}),O.extend(r,t,null,{allOwnKeys:!0}),r.create=function(o){return nu(Wr(e,o))},r}const Je=nu(So);Je.Axios=Kr,Je.CanceledError=_o,Je.CancelToken=vw,Je.isCancel=qd,Je.VERSION=Ss,Je.toFormData=Aa,Je.AxiosError=Z,Je.Cancel=Je.CanceledError,Je.all=function(t){return Promise.all(t)},Je.spread=bw,Je.isAxiosError=ww,Je.mergeConfig=Wr,Je.AxiosHeaders=gt,Je.formToJSON=e=>jd(O.isHTMLForm(e)?new FormData(e):e),Je.getAdapter=eu.getAdapter,Je.HttpStatusCode=Es,Je.default=Je;const{Axios:ck,AxiosError:dk,CanceledError:uk,isCancel:fk,CancelToken:hk,VERSION:pk,all:gk,Cancel:mk,isAxiosError:yk,spread:vk,toFormData:bk,AxiosHeaders:wk,HttpStatusCode:Ck,formToJSON:Sk,getAdapter:_k,mergeConfig:Tk,create:Ek}=Je;let Is="";function ou(e){Is=e}const ke=Je.create({timeout:3e4});ke.interceptors.request.use(async e=>{var o;const{useEditorStore:t}=await Promise.resolve().then(()=>uv),n=(o=t.getState().editorConfig)==null?void 0:o.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),Is&&(e.baseURL=Is),e});const au=["email","firstName","lastName","identifier","organisations","rootOrgName","phone"];async function Cw(e,t={}){var l,d,f,u;const n={"organisations.roles":[((l=t.objectType)==null?void 0:l.toLowerCase())==="textbook"?"BOOK_CREATOR":"CONTENT_CREATOR"]};t.rootOrgId&&(n.rootOrgId=[t.rootOrgId]);const o=e.includes("@"),a=/^\d{10,}$/.test(e.trim()),i={filters:n,fields:au,offset:0,limit:t.limit??200};return o?n.email=e.trim():a?n.phone=e.trim():i.query=e,((u=(f=(d=(await ke.post("/action/user/v1/search",{request:i},{params:{fields:"orgName"},headers:{"X-Source":"web","X-msgid":Math.random().toString(36).slice(2)}})).data)==null?void 0:d.result)==null?void 0:f.response)==null?void 0:u.content)??[]}async function Sw(e){var r,n,o;return e.length?((o=(n=(r=(await ke.post("/action/user/v1/search",{request:{filters:{userId:e},fields:au,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:o.content)??[]:[]}async function _w(e){var r,n;return((n=(r=(await ke.get(`/portal/user/v5/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.response)??{}}const iu="/portal";async function su(e){var n,o,a,i,s,l,d;const t=await ke.get(`${iu}/questionset/v2/hierarchy/${e}`,{params:{mode:"edit"}}),r=(o=(n=t.data)==null?void 0:n.result)==null?void 0:o.questionset;if(!r||!r.identifier){const f=((i=(a=t.data)==null?void 0:a.params)==null?void 0:i.errmsg)||((l=(s=t.data)==null?void 0:s.params)==null?void 0:l.err)||((d=t.data)==null?void 0:d.responseCode)||`No questionset returned for "${e}"`;throw new Error(`Unable to load questionset hierarchy: ${f}`)}return r}async function Tw(e){var r,n;return e.length?((n=(r=(await ke.post(`${iu}/question/v2/list`,{request:{search:{identifier:e}}})).data)==null?void 0:r.result)==null?void 0:n.questions)??[]:[]}function Os(e,t){const r=e??{},n=r.identifier??"",o=r.objectType??"",a=r.mimeType??"",i=r.children,s=Array.isArray(i)?i.map(d=>Os(d,n)):[],l=a==="application/vnd.ekstep.content-collection"||o.toLowerCase().includes("unit")||o.toLowerCase().includes("textbook")||o.toLowerCase().includes("collection")||o.toLowerCase().includes("course")||o.toLowerCase().includes("lesson")||r.visibility==="Parent"||a==="application/vnd.sunbird.questionset"&&s.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:o,contentType:r.contentType,visibility:r.visibility,status:r.status,appIcon:r.appIcon,isFolder:l,children:s,metadata:r,parent:t}}async function lu(e){var o,a,i,s,l,d,f;const t=await ke.get(`/action/content/v3/hierarchy/${e}`,{params:{mode:"edit"}}),r=(a=(o=t.data)==null?void 0:o.result)==null?void 0:a.content;if(!r||!r.identifier){const u=((s=(i=t.data)==null?void 0:i.params)==null?void 0:s.errmsg)||((d=(l=t.data)==null?void 0:l.params)==null?void 0:d.err)||((f=t.data)==null?void 0:f.responseCode)||`No content returned for "${e}"`;throw new Error(`Unable to load hierarchy: ${u}`)}const n=Os(r);return{content:r,rootNode:n}}async function Ew(e){const t=await su(e),r=Os(t);return{content:t,rootNode:r}}async function Iw(e,t,r,n){var a;return((a=(await ke.patch("/action/content/v3/hierarchy/update",{request:{data:{nodesModified:t,hierarchy:r,...n?{lastUpdatedBy:n}:{}}}})).data)==null?void 0:a.result)??{}}async function Ow(e,t=""){await ke.post(`/action/content/v3/publish/${e}`,{request:{content:{lastPublishedBy:t}}})}async function Aw(e){var r,n;return(n=(r=(await ke.get(`/action/content/v3/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.content}async function Dw(e){await ke.post(`/action/content/v3/review/${e}`,{request:{content:{}}})}async function Nw(e,t){await ke.post(`/action/content/v3/reject/${e}`,{request:{content:{rejectComment:t}}})}async function kw(e,t){await ke.patch(`/action/content/v1/collaborator/update/${e}`,{request:{content:{collaborators:t}}})}const De={container:"_container_r27rp_1",header:"_header_r27rp_13",title:"_title_r27rp_22",closeBtn:"_closeBtn_r27rp_29",body:"_body_r27rp_45",label:"_label_r27rp_54",searchSection:"_searchSection_r27rp_62",searchRow:"_searchRow_r27rp_68",searchInput:"_searchInput_r27rp_74",searchSpinner:"_searchSpinner_r27rp_89",resultsList:"_resultsList_r27rp_105",resultItem:"_resultItem_r27rp_118",userInfo:"_userInfo_r27rp_133",userName:"_userName_r27rp_141",userEmail:"_userEmail_r27rp_150",userOrg:"_userOrg_r27rp_158",noResults:"_noResults_r27rp_167",collabSection:"_collabSection_r27rp_174",sectionTitle:"_sectionTitle_r27rp_179",badge:"_badge_r27rp_189",emptyCollab:"_emptyCollab_r27rp_203",collabList:"_collabList_r27rp_214",collabItem:"_collabItem_r27rp_223",userAvatar:"_userAvatar_r27rp_237",error:"_error_r27rp_251",success:"_success_r27rp_257",footer:"_footer_r27rp_263"},xw=({contentId:e,onClose:t})=>{var $,j;const r=le(),n=ce(N=>N.editorConfig),o=($=n==null?void 0:n.context)==null?void 0:$.channel,a=(j=n==null?void 0:n.config)==null?void 0:j.objectType,[i,s]=h.useState(""),[l,d]=h.useState([]),[f,u]=h.useState(!1),[m,g]=h.useState([]),[w,p]=h.useState(!1),[y,v]=h.useState(""),[b,C]=h.useState(!1),S=h.useRef(null);h.useEffect(()=>{let N=!1;return(async()=>{try{const L=await Aw(e),B=(L==null?void 0:L.collaborators)??[];if(!B.length)return;const P=await Sw(B);if(N)return;const F=B.map(V=>P.find(X=>X.identifier===V)??{identifier:V,firstName:V});g(F)}catch{}})(),()=>{N=!0}},[e]),h.useEffect(()=>{S.current&&clearTimeout(S.current);const N=i.trim();if(N.length<2){d([]);return}return S.current=setTimeout(async()=>{u(!0);try{const L=await Cw(N,{rootOrgId:o,objectType:a}),B=new Set(m.map(P=>P.identifier));d(L.filter(P=>!B.has(P.identifier)))}catch{d([])}finally{u(!1)}},300),()=>{S.current&&clearTimeout(S.current)}},[i,m,o,a]);const T=h.useCallback(N=>{g(L=>L.find(B=>B.identifier===N.identifier)?L:[...L,N]),d(L=>L.filter(B=>B.identifier!==N.identifier)),C(!1)},[]),I=h.useCallback(N=>{g(L=>L.filter(B=>B.identifier!==N)),C(!1)},[]),k=h.useCallback(async()=>{p(!0),v(""),C(!1);try{await kw(e,m.map(N=>N.identifier)),C(!0)}catch{v(r.manageCollaborators.saveFailed)}finally{p(!1)}},[e,m,r.manageCollaborators.saveFailed]),x=N=>`${N.firstName}${N.lastName?` ${N.lastName}`:""}`;return c.jsxs("div",{className:De.container,children:[c.jsxs("div",{className:De.header,children:[c.jsx("h2",{className:De.title,children:r.manageCollaborators.title}),c.jsx("button",{className:De.closeBtn,onClick:t,"aria-label":r.manageCollaborators.closeAriaLabel,children:c.jsx(yr,{size:18})})]}),c.jsxs("div",{className:De.body,children:[c.jsxs("div",{className:De.searchSection,children:[c.jsx("label",{className:De.label,htmlFor:"collab-search",children:r.manageCollaborators.searchUsersLabel}),c.jsxs("div",{className:De.searchRow,children:[c.jsx("input",{id:"collab-search",type:"text",className:De.searchInput,placeholder:r.manageCollaborators.searchPlaceholder,value:i,onChange:N=>s(N.target.value)}),f&&c.jsx("span",{className:De.searchSpinner,"aria-label":r.manageCollaborators.searchingAriaLabel})]}),l.length>0&&c.jsx("ul",{className:De.resultsList,role:"listbox","aria-label":r.manageCollaborators.searchResultsAriaLabel,children:l.map(N=>{var L,B,P,F;return c.jsxs("li",{className:De.resultItem,role:"option","aria-selected":"false",children:[c.jsxs("div",{className:De.userInfo,children:[c.jsx("span",{className:De.userName,children:x(N)}),N.email&&c.jsx("span",{className:De.userEmail,children:N.email}),(((B=(L=N.organisations)==null?void 0:L[0])==null?void 0:B.orgName)??N.rootOrgName)&&c.jsx("span",{className:De.userOrg,children:((F=(P=N.organisations)==null?void 0:P[0])==null?void 0:F.orgName)??N.rootOrgName})]}),c.jsx($e,{variant:"primary",size:"sm",onClick:()=>T(N),children:r.manageCollaborators.add})]},N.identifier)})}),i.trim().length>=2&&!f&&l.length===0&&c.jsx("p",{className:De.noResults,children:r.manageCollaborators.noUsersFound})]}),c.jsxs("div",{className:De.collabSection,children:[c.jsxs("h3",{className:De.sectionTitle,children:[r.manageCollaborators.currentCollaborators,m.length>0&&c.jsx("span",{className:De.badge,children:m.length})]}),m.length===0?c.jsx("p",{className:De.emptyCollab,children:r.manageCollaborators.noCollaboratorsYet}):c.jsx("ul",{className:De.collabList,children:m.map(N=>{var L,B,P,F;return c.jsxs("li",{className:De.collabItem,children:[c.jsx("div",{className:De.userAvatar,"aria-hidden":"true",children:x(N).charAt(0).toUpperCase()}),c.jsxs("div",{className:De.userInfo,children:[c.jsx("span",{className:De.userName,children:x(N)}),N.email&&c.jsx("span",{className:De.userEmail,children:N.email}),(((B=(L=N.organisations)==null?void 0:L[0])==null?void 0:B.orgName)??N.rootOrgName)&&c.jsx("span",{className:De.userOrg,children:((F=(P=N.organisations)==null?void 0:P[0])==null?void 0:F.orgName)??N.rootOrgName})]}),c.jsx($e,{variant:"danger",size:"sm",onClick:()=>I(N.identifier),children:r.manageCollaborators.remove})]},N.identifier)})})]}),y&&c.jsx("p",{className:De.error,role:"alert",children:y}),b&&c.jsx("p",{className:De.success,role:"status",children:r.manageCollaborators.saveSuccess})]}),c.jsxs("div",{className:De.footer,children:[c.jsx($e,{variant:"ghost",onClick:t,disabled:w,children:r.manageCollaborators.cancel}),c.jsx($e,{variant:"primary",isLoading:w,onClick:k,children:r.manageCollaborators.save})]})]})};async function Lw(e){return(await ke.post("/api/dialcode/v1/read",{request:{dialcodes:[e]}})).data}async function Pw(e,t){var o;const n=((o=(await ke.post(`/action/dialcode/v1/reserve/${e}`,{request:{dialcodes:{count:t,qrCodeSpec:{errorCorrectionLevel:"H"}}}})).data)==null?void 0:o.result)??{};return{processId:n.processId??"",reservedDialcodes:n.reservedDialcodes??{}}}async function Fw(e){var n;const r=((n=(await ke.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 de={topbar:"_topbar_zj8wk_1",left:"_left_zj8wk_15",right:"_right_zj8wk_23",backBtn:"_backBtn_zj8wk_30",title:"_title_zj8wk_49",statusChip:"_statusChip_zj8wk_61",savedIndicator:"_savedIndicator_zj8wk_73",unsaved:"_unsaved_zj8wk_83",iconBtn:"_iconBtn_zj8wk_88",iconBtnLabel:"_iconBtnLabel_zj8wk_115",qrDropdown:"_qrDropdown_zj8wk_119",qrMenu:"_qrMenu_zj8wk_123",reviewBtns:"_reviewBtns_zj8wk_158",sourcingBtns:"_sourcingBtns_zj8wk_167",modalOverlay:"_modalOverlay_zj8wk_176",sbOverlay:"_sbOverlay_zj8wk_186",sbModal:"_sbModal_zj8wk_196",sbModalHeader:"_sbModalHeader_zj8wk_207",sbModalTitle:"_sbModalTitle_zj8wk_215",sbModalClose:"_sbModalClose_zj8wk_222",sbModalBody:"_sbModalBody_zj8wk_235",sbLabel:"_sbLabel_zj8wk_242",sbTextarea:"_sbTextarea_zj8wk_249",sbError:"_sbError_zj8wk_266",sbModalFooter:"_sbModalFooter_zj8wk_273"};function Mw(e){return e?new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):""}function $w(e,t){return typeof e=="string"&&e.trim().length>0?e.trim():t}const Bw=({titleText:e,labelText:t,placeholderText:r,submitLabel:n,submitVariant:o="primary",onConfirm:a,onCancel:i})=>{const s=le(),[l,d]=h.useState(""),f=e.toLowerCase().replace(/\s+/g,"-");return c.jsx("div",{className:de.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":`${f}-title`,children:c.jsxs("div",{className:de.sbModal,children:[c.jsxs("div",{className:de.sbModalHeader,children:[c.jsx("span",{id:`${f}-title`,className:de.sbModalTitle,children:e}),c.jsx("button",{className:de.sbModalClose,onClick:i,"aria-label":s.reviewCommentModal.closeAriaLabel,type:"button",children:"×"})]}),c.jsxs("div",{className:de.sbModalBody,children:[c.jsxs("label",{className:de.sbLabel,htmlFor:`${f}-comment`,children:[t," ",c.jsx("span",{"aria-hidden":"true",style:{color:"var(--sbx-error, #DC2626)"},children:"*"})]}),c.jsx("textarea",{id:`${f}-comment`,className:de.sbTextarea,placeholder:r,value:l,onChange:u=>d(u.target.value),rows:4,required:!0,"aria-required":"true"}),l.trim().length===0&&c.jsx("p",{className:de.sbError,children:s.reviewCommentModal.fillCommentsError})]}),c.jsxs("div",{className:de.sbModalFooter,children:[c.jsx($e,{variant:"ghost",onClick:i,children:s.reviewCommentModal.cancelButton}),c.jsx($e,{variant:o,onClick:()=>a(l.trim()),disabled:l.trim().length===0,children:n})]})]})})},jw=({onConfirm:e,onCancel:t})=>{const r=le(),[n,o]=h.useState(!1);return c.jsx("div",{className:de.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":"review-confirm-title",children:c.jsxs("div",{className:de.sbModal,children:[c.jsxs("div",{className:de.sbModalHeader,children:[c.jsx("span",{id:"review-confirm-title",className:de.sbModalTitle,children:r.confirmReviewModal.title}),c.jsx("button",{className:de.sbModalClose,onClick:t,"aria-label":r.confirmReviewModal.closeAriaLabel,type:"button",children:"×"})]}),c.jsx("div",{className:de.sbModalBody,children:c.jsxs("label",{style:{display:"flex",gap:8,alignItems:"flex-start",fontSize:13,lineHeight:1.55},children:[c.jsx("input",{type:"checkbox",checked:n,onChange:a=>o(a.target.checked),style:{marginTop:2}}),c.jsxs("span",{children:[r.confirmReviewModal.agreementTextPart1," ",c.jsx("a",{className:"sb-color-primary",style:{fontWeight:600},href:"https://creativecommons.org/licenses",target:"_blank",rel:"noreferrer",children:r.confirmReviewModal.creativeCommonsLinkText})," ",r.confirmReviewModal.agreementTextPart2," ",c.jsx("strong",{children:r.confirmReviewModal.contentPolicyText}),r.confirmReviewModal.agreementTextPart3]})]})}),c.jsxs("div",{className:de.sbModalFooter,children:[c.jsx($e,{variant:"ghost",onClick:t,children:r.confirmReviewModal.cancelButton}),c.jsx($e,{variant:"primary",onClick:e,disabled:!n,children:r.confirmReviewModal.submitButton})]})]})})},qw=({onConfirm:e,onCancel:t})=>{const r=le(),[n,o]=h.useState(""),a=parseInt(n,10),i=!isNaN(a)&&a>=2&&a<=250;return c.jsx("div",{className:de.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":"genqr-title",children:c.jsxs("div",{className:de.sbModal,children:[c.jsxs("div",{className:de.sbModalHeader,children:[c.jsx("span",{id:"genqr-title",className:de.sbModalTitle,children:r.generateQRModal.title}),c.jsx("button",{className:de.sbModalClose,onClick:t,"aria-label":r.generateQRModal.closeAriaLabel,type:"button",children:"×"})]}),c.jsxs("div",{className:de.sbModalBody,children:[c.jsxs("label",{className:de.sbLabel,htmlFor:"qr-count",children:[r.generateQRModal.numberOfCodesLabel," ",c.jsx("span",{"aria-hidden":"true",style:{color:"var(--sbx-error, #DC2626)"},children:"*"})]}),c.jsx("input",{id:"qr-count",type:"number",min:2,max:250,className:de.sbTextarea,style:{resize:"none",height:"40px"},placeholder:r.generateQRModal.countPlaceholder,value:n,onChange:s=>o(s.target.value)}),n&&!i&&c.jsx("p",{className:de.sbError,children:r.generateQRModal.countRangeError})]}),c.jsxs("div",{className:de.sbModalFooter,children:[c.jsx($e,{variant:"ghost",onClick:t,children:r.generateQRModal.cancelButton}),c.jsx($e,{variant:"primary",onClick:()=>e(a),disabled:!i,children:r.generateQRModal.generateButton})]})]})})},Uw=({editorMode:e,isSaving:t,isDirty:r,lastSaved:n,isFormValid:o=!0,onToolbarEvent:a})=>{var ae,fe;const i=le(),l=Ae(J=>J.treeData)[0],d=(l==null?void 0:l.name)??i.contextualEditor.untitledPlaceholder,f=$w(((ae=l==null?void 0:l.metadata)==null?void 0:ae.status)??(l==null?void 0:l.status),i.topbar.draftStatusFallback),u=ce(J=>{var oe,Me,Oe,ze;return((Me=(oe=J.editorConfig)==null?void 0:oe.context)==null?void 0:Me.contentId)??((ze=(Oe=J.editorConfig)==null?void 0:Oe.context)==null?void 0:ze.identifier)??""}),{activeModal:m,modalData:g,closeModal:w,openModal:p}=gv(),y=ce(J=>J.buttonLoaders),v=ce(J=>J.categoryMeta),b=!v||v.schemaDefaults.generateDIALCodes!=="No",[C,S]=h.useState(!1),[T,I]=h.useState(!1),[k,x]=h.useState(!1),$=h.useRef(null),[j,N]=h.useState(!1);h.useEffect(()=>{if(!k)return;const J=oe=>{var Me;(Me=$.current)!=null&&Me.contains(oe.target)||x(!1)};return document.addEventListener("mousedown",J),()=>document.removeEventListener("mousedown",J)},[k]);const[L,B]=h.useState(!1),[P,F]=h.useState(!1),{updateNode:V}=Ae(),X=(fe=l==null?void 0:l.metadata)==null?void 0:fe.qrCodeProcessId,ve=h.useCallback(async J=>{if(u){N(!1),B(!0);try{const{processId:oe,reservedDialcodes:Me}=await Pw(u,J);oe&&l&&V(l.id,{qrCodeProcessId:oe,reservedDialcodes:Me}),Ie.success(i.topbar.qrGenerationStartedToast)}catch{Ie.error(i.topbar.qrGenerationFailedToast)}finally{B(!1)}}},[u,l,V,i]),Ee=h.useCallback(async()=>{if(!X){Ie.error(i.topbar.qrCodesNotGeneratedToast);return}F(!0);try{const J=await Fw(X);if(J.status==="in-process"){Ie(i.topbar.qrGenerationInProgressToast,{icon:c.jsx(Qi,{size:16})});return}const oe=J.url;if(!oe){Ie.error(i.topbar.qrCodesNotReadyToast);return}const Me=await fetch(oe).then(He=>He.blob()),Oe=await new Promise(He=>{const et=new FileReader;et.onloadend=()=>He(et.result),et.readAsDataURL(Me)}),ze=(l==null?void 0:l.metadata)??{},We=He=>Array.isArray(He)?He.join("_"):typeof He=="string"?He:"",Ve=[u,We(ze.medium),We(ze.gradeLevel),We(ze.subject)].filter(Boolean),re=new Date().toISOString().replace(/[:.]/g,"-"),Ke=`${Ve.join("_")}_${re}.zip`,Re=document.createElement("a");Re.href=Oe,Re.download=Ke,Re.style.display="none",document.body.appendChild(Re),Re.click(),document.body.removeChild(Re),Ie.success(i.topbar.qrCodesDownloadedToast)}catch{Ie.error(i.topbar.qrCodesDownloadFailedToast)}finally{F(!1)}},[X,l,u,i]),Ce=e==="edit",ue=e==="review",Q=e==="sourcingreview",ne=e==="read",te=h.useCallback((J,oe)=>{a({action:J,data:oe})},[a]),U=h.useCallback(()=>{w(),te("publish")},[w,te]),H=h.useCallback((J,oe)=>{const Me=g==null?void 0:g.action;w(),Me==="approve"?te("sourcingApprove",{comment:J,score:oe}):te("reject",{comment:J})},[w,te,g]);return c.jsxs(c.Fragment,{children:[c.jsxs("header",{className:de.topbar,role:"banner",children:[c.jsxs("div",{className:de.left,children:[c.jsx("button",{className:de.backBtn,onClick:()=>te("back"),"aria-label":i.topbar.backAriaLabel,type:"button",children:c.jsx(Iy,{size:18})}),c.jsx("h1",{className:de.title,title:d,children:d}),c.jsx("span",{className:`sbx-chip ${de.statusChip}`,"aria-label":`${i.topbar.statusAriaLabelPrefix} ${f}`,children:f})]}),c.jsxs("div",{className:de.right,children:[c.jsx(Iv,{}),t?c.jsx("span",{className:de.savedIndicator,"aria-live":"polite",children:i.topbar.savingIndicator}):r&&Ce?c.jsx("span",{className:`${de.savedIndicator} ${de.unsaved}`,"aria-live":"polite",children:i.topbar.unsavedIndicator}):n?c.jsxs("span",{className:de.savedIndicator,"aria-live":"polite",children:[c.jsx(wn,{size:14,"aria-hidden":"true"}),i.topbar.savedIndicatorPrefix," ",Mw(n)]}):null,!ne&&!ue&&!Q&&f!=="Review"&&c.jsx("span",{title:o?void 0:i.topbar.fillRequiredFieldsTooltip,children:c.jsx($e,{variant:"ghost",size:"sm",onClick:()=>te("saveCollection"),disabled:!o,children:i.topbar.saveAsDraftButton})}),Ce&&c.jsxs(c.Fragment,{children:[c.jsxs($e,{variant:"primary",size:"sm",onClick:()=>I(!0),disabled:y.saveCollection,isLoading:y.saveCollection,children:[c.jsx(Qy,{size:14,"aria-hidden":"true"})," ",i.topbar.sendForReviewButton]}),c.jsx("button",{className:de.iconBtn,onClick:()=>p("manageCollaborators"),"aria-label":i.topbar.collaboratorsLabel,title:i.topbar.collaboratorsLabel,type:"button",children:c.jsx(Xy,{size:16,"aria-hidden":"true"})}),b&&c.jsxs("div",{className:de.qrDropdown,ref:$,children:[c.jsxs("button",{className:de.iconBtn,onClick:()=>x(J=>!J),"aria-label":i.topbar.qrCodesLabel,title:i.topbar.qrCodesLabel,type:"button","aria-haspopup":"true","aria-expanded":k,children:[c.jsx(ed,{size:16,"aria-hidden":"true"}),c.jsx("span",{className:de.iconBtnLabel,children:i.topbar.qrCodesLabel}),c.jsx(Cn,{size:14,style:{marginLeft:2},"aria-hidden":"true"})]}),k&&c.jsxs("div",{className:de.qrMenu,role:"menu",children:[c.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{x(!1),N(!0)},disabled:L,children:[c.jsx(ed,{size:14}),L?i.topbar.generatingEllipsis:i.topbar.generateQrCodesMenuItem]}),c.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{x(!1),Ee()},disabled:P||!X,children:[c.jsx(Ly,{size:14}),P?i.topbar.downloadingEllipsis:i.topbar.downloadQrCodesMenuItem]})]})]})]}),ue&&c.jsxs("div",{className:de.reviewBtns,children:[c.jsxs($e,{variant:"primary",size:"sm",onClick:()=>p("publishChecklist"),disabled:y.publishCollection,isLoading:y.publishCollection,children:[c.jsx(Kc,{size:14,"aria-hidden":"true"})," ",i.topbar.publishButton]}),c.jsxs($e,{variant:"primary",size:"sm",onClick:()=>S(!0),disabled:y.rejectCollection,isLoading:y.rejectCollection,children:[c.jsx(td,{size:14,"aria-hidden":"true"})," ",i.topbar.requestForChangesButton]})]}),Q&&c.jsxs("div",{className:de.sourcingBtns,children:[c.jsxs($e,{variant:"primary",size:"sm",onClick:()=>p("qualityParams",{action:"approve"}),children:[c.jsx(Gy,{size:14,"aria-hidden":"true"})," ",i.topbar.approveButton]}),c.jsxs($e,{variant:"primary",size:"sm",onClick:()=>p("qualityParams",{action:"reject"}),children:[c.jsx(td,{size:14,"aria-hidden":"true"})," ",i.topbar.requestForChangesButton]})]})]})]}),m==="publishChecklist"&&c.jsx(Ov,{contentId:u,onConfirm:U,onCancel:w}),m==="qualityParams"&&c.jsx(Av,{contentId:u,action:(g==null?void 0:g.action)??"reject",onConfirm:H,onCancel:w}),m==="manageCollaborators"&&c.jsx("div",{className:de.modalOverlay,role:"dialog","aria-modal":"true",children:c.jsx(xw,{contentId:u,onClose:w})}),T&&c.jsx(jw,{onConfirm:()=>{I(!1),te("sendForReview")},onCancel:()=>I(!1)}),C&&c.jsx(Bw,{titleText:i.topbar.requestChangesTitle,labelText:i.topbar.changesRequestedLabel,placeholderText:i.topbar.describeChangesPlaceholder,submitLabel:i.topbar.requestForChangesButton,submitVariant:"primary",onConfirm:J=>{S(!1),te("reject",{comment:J})},onCancel:()=>S(!1)}),j&&c.jsx(qw,{onConfirm:ve,onCancel:()=>N(!1)})]})},zw=({onSave:e,onDiscard:t,onCancel:r,isSaving:n})=>{const o=le();return Pe.createPortal(c.jsx("div",{className:Fe.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"unsaved-title",children:c.jsxs("div",{className:Fe.modal,children:[c.jsxs("div",{className:Fe.modalHeader,children:[c.jsx("span",{id:"unsaved-title",children:o.unsavedChangesModal.title}),c.jsx("button",{className:Fe.modalHeaderClose,onClick:r,"aria-label":o.unsavedChangesModal.closeAriaLabel,disabled:n,children:"×"})]}),c.jsx("div",{className:Fe.modalBody,children:c.jsx("p",{style:{margin:0,fontSize:14,lineHeight:1.5},children:o.unsavedChangesModal.bodyMessage})}),c.jsxs("div",{className:Fe.modalFooter,children:[c.jsx($e,{variant:"ghost",onClick:r,disabled:n,children:o.unsavedChangesModal.cancelButton}),c.jsx($e,{variant:"danger",onClick:t,disabled:n,children:o.unsavedChangesModal.discardButton}),c.jsx($e,{variant:"primary",onClick:e,isLoading:n,disabled:n,children:o.unsavedChangesModal.saveButton})]})]})}),document.body)};var Vw=os();const cu=h.createContext(null);function Nt(){const e=h.useContext(cu);if(e===null)throw new Error("No Tree Api Provided");return e}const du=h.createContext(null);function Hw(){const e=h.useContext(du);if(e===null)throw new Error("Provide a NodesContext");return e}const uu=h.createContext(null);function Rw(){const e=h.useContext(uu);if(e===null)throw new Error("Provide a DnDContext");return e}const fu=h.createContext(0);function hu(){h.useContext(fu)}function Pa(e,t,r){return Math.max(Math.min(e,r),t)}function pu(e){return e&&e.isLeaf}function gu(e){return e&&e.isInternal&&!e.isOpen}function mu(e){var t;return e&&e.isOpen&&!(!((t=e.children)===null||t===void 0)&&t.length)}const yu=(e,t)=>{let r=e;for(;r;){if(r.id===t.id)return!0;r=r.parent}return!1},vu=e=>{if(!e.parent)throw Error("Node does not have a parent");return e.parent.children.findIndex(t=>t.id===e.id)};function As(e,t){if(!e)return null;if(e.id===t)return e;if(e.children)for(let r of e.children){const n=As(r,t);if(n)return n}return null}function Fa(e,t){if(t(e),e.children)for(let r of e.children)Fa(r,t)}function bu(e){const t=Cu(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 wu(e){const t=Cu(e);let r;for(let n=0;n<t.length;++n)if(t[n]===e){r=Gw(t,n);break}r==null||r.focus()}function Qw(e,t){return t+1<e.length?e[t+1]:e[0]}function Gw(e,t){return t-1>=0?e[t-1]:e[e.length-1]}function Cu(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 To(e,t){return typeof t=="boolean"?t:typeof t=="string"?e[t]:t(e)}function An(e){return typeof e=="string"?e:e.id}function Ww(e,...t){if(e)return e(...t)}function Su(e){return new Promise((t,r)=>{let n=0;function o(){n+=1,n===100&&r(),e()?t():setTimeout(o,10)}o()})}function _u(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 Tu(e){const t=e.focusedNode;return t?t.isOpen?t.id:t.parent&&!t.parent.isRoot?t.parent.id:null:null}const Kw=Object.freeze(Object.defineProperty({__proto__:null,access:To,bound:Pa,dfs:As,focusNextElement:bu,focusPrevElement:wu,getInsertIndex:_u,getInsertParentId:Tu,identify:An,indexOf:vu,isClosed:gu,isDescendant:yu,isItem:pu,isOpenWithEmptyChildren:mu,safeRun:Ww,waitFor:Su,walk:Fa},Symbol.toStringTag,{value:"Module"})),Yw={display:"flex",alignItems:"center",zIndex:1},Zw={flex:1,height:"2px",background:"#4B91E2",borderRadius:"1px"},Xw={width:"4px",height:"4px",boxShadow:"0 0 0 3px #4B91E2",borderRadius:"50%"},Jw=h.memo(function({top:t,left:r,indent:n}){const o={position:"absolute",pointerEvents:"none",top:t-2+"px",left:r+"px",right:n+"px"};return c.jsxs("div",{style:Object.assign(Object.assign({},Yw),o),children:[c.jsx("div",{style:Object.assign({},Xw)}),c.jsx("div",{style:Object.assign({},Zw)})]})});function eC({node:e,attrs:t,innerRef:r,children:n}){return c.jsx("div",Object.assign({},t,{ref:r,onFocus:o=>o.stopPropagation(),onClick:e.handleClick,children:n}))}function tC(e){return c.jsxs("div",{ref:e.dragHandle,style:e.style,children:[c.jsx("span",{onClick:t=>{t.stopPropagation(),e.node.toggle()},children:e.node.isLeaf?"🌳":e.node.isOpen?"🗁":"🗀"})," ",e.node.isEditing?c.jsx(nC,Object.assign({},e)):c.jsx(rC,Object.assign({},e))]})}function rC(e){return c.jsx(c.Fragment,{children:c.jsx("span",{children:e.node.data.name})})}function nC({node:e}){const t=h.useRef();return h.useEffect(()=>{var r,n;(r=t.current)===null||r===void 0||r.focus(),(n=t.current)===null||n===void 0||n.select()},[]),c.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 Eo="__REACT_ARBORIST_INTERNAL_ROOT__";function Eu(e){var t;function r(a,i,s){const l=e.accessId(a),d=new Io({tree:e,data:a,level:i,parent:s,id:l,children:null,isDraggable:e.isDraggable(a),rowIndex:null}),f=e.accessChildren(a);return f&&(d.children=f.map(u=>r(u,i+1,d))),d}const n=new Io({tree:e,id:Eo,data:{id:Eo},level:-1,parent:null,children:null,isDraggable:!0,rowIndex:null}),o=(t=e.props.data)!==null&&t!==void 0?t:[];return n.children=o.map(a=>r(a,0,n)),n}class Io{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===Eo}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 Io(Object.assign({},this))}edit(){return this.tree.edit(this)}}function Ds(e){return{type:"EDIT",id:e}}function oC(e={id:null},t){return t.type==="EDIT"?Object.assign(Object.assign({},e),{id:t.id}):e}function Dn(e){return{type:"FOCUS",id:e}}function aC(){return{type:"TREE_BLUR"}}function iC(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 Ns={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 Iu(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 sC(e={filtered:{},unfiltered:{}},t){return t.type.startsWith("VISIBILITY")?t.filtered?Object.assign(Object.assign({},e),{filtered:Iu(e.filtered,t)}):Object.assign(Object.assign({},e),{unfiltered:Iu(e.unfiltered,t)}):e}const Nn=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}}},Nr={clear:()=>({type:"SELECTION_CLEAR"}),only:e=>({type:"SELECTION_ONLY",id:An(e)}),add:e=>({type:"SELECTION_ADD",ids:(Array.isArray(e)?e:[e]).map(An)}),remove:e=>({type:"SELECTION_REMOVE",ids:(Array.isArray(e)?e:[e]).map(An)}),set:e=>Object.assign({type:"SELECTION_SET"},e),mostRecent:e=>({type:"SELECTION_MOST_RECENT",id:e===null?null:An(e)}),anchor:e=>({type:"SELECTION_ANCHOR",id:e===null?null:An(e)})};function lC(e=Nn().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 kn={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 cC(e=Nn().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 Nn().dnd;case"DND_HOVERING":return Object.assign(Object.assign({},e),{parentId:t.parentId,index:t.index});default:return e}}const dC={position:"fixed",pointerEvents:"none",zIndex:100,left:0,top:0,width:"100%",height:"100%"},uC=e=>{if(!e)return{display:"none"};const{x:t,y:r}=e;return{transform:`translate(${t}px, ${r}px)`}},fC=e=>{if(!e)return{display:"none"};const{x:t,y:r}=e;return{transform:`translate(${t+10}px, ${r+10}px)`}};function Ou({offset:e,mouse:t,id:r,dragIds:n,isDragging:o}){return c.jsxs(hC,{isDragging:o,children:[c.jsx(pC,{offset:e,children:c.jsx(mC,{id:r,dragIds:n})}),c.jsx(gC,{mouse:t,count:n.length})]})}const hC=h.memo(function(t){return t.isDragging?c.jsx("div",{style:dC,children:t.children}):null});function pC(e){return c.jsx("div",{className:"row preview",style:uC(e.offset),children:e.children})}function gC(e){const{count:t,mouse:r}=e;return t>1?c.jsx("div",{className:"selected-count",style:fC(r),children:t}):null}const mC=h.memo(function(t){const r=Nt(),n=r.get(t.id);return n?c.jsx(r.renderNode,{preview:!0,node:n,style:{paddingLeft:n.level*r.indent,opacity:.2,background:"transparent"},tree:r}):null});function ks(){return ks=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},ks.apply(null,arguments)}function Au(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function xs(e,t){return xs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},xs(e,t)}function yC(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,xs(e,t)}var Du=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function vC(e,t){return!!(e===t||Du(e)&&Du(t))}function bC(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!vC(e[r],t[r]))return!1;return!0}function Ls(e,t){t===void 0&&(t=bC);var r,n=[],o,a=!1;function i(){for(var s=[],l=0;l<arguments.length;l++)s[l]=arguments[l];return a&&r===this&&t(s,n)||(o=e.apply(this,s),a=!0,r=this,n=s),o}return i}var wC=typeof performance=="object"&&typeof performance.now=="function",Nu=wC?function(){return performance.now()}:function(){return Date.now()};function ku(e){cancelAnimationFrame(e.id)}function CC(e,t){var r=Nu();function n(){Nu()-r>=t?e.call(null):o.id=requestAnimationFrame(n)}var o={id:requestAnimationFrame(n)};return o}var Ps=-1;function xu(e){if(e===void 0&&(e=!1),Ps===-1||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",document.body.appendChild(t),Ps=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return Ps}var xn=null;function Lu(e){if(e===void 0&&(e=!1),xn===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"),o=n.style;return o.width="100px",o.height="100px",t.appendChild(n),document.body.appendChild(t),t.scrollLeft>0?xn="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?xn="negative":xn="positive-ascending"),document.body.removeChild(t),xn}return xn}process.env.NODE_ENV;var SC=150,_C=function(t,r){return t},Ma=null,$a=null;process.env.NODE_ENV!=="production"&&typeof window<"u"&&typeof window.WeakSet<"u"&&(Ma=new WeakSet,$a=new WeakSet);function Pu(e){var t,r=e.getItemOffset,n=e.getEstimatedTotalSize,o=e.getItemSize,a=e.getOffsetForIndexAndAlignment,i=e.getStartIndexForOffset,s=e.getStopIndexForStartIndex,l=e.initInstanceProps,d=e.shouldResetStyleCacheOnItemSizeChange,f=e.validateProps;return t=function(u){yC(m,u);function m(w){var p;return p=u.call(this,w)||this,p._instanceProps=l(p.props,Au(p)),p._outerRef=void 0,p._resetIsScrollingTimeoutId=null,p.state={instance:Au(p),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof p.props.initialScrollOffset=="number"?p.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},p._callOnItemsRendered=void 0,p._callOnItemsRendered=Ls(function(y,v,b,C){return p.props.onItemsRendered({overscanStartIndex:y,overscanStopIndex:v,visibleStartIndex:b,visibleStopIndex:C})}),p._callOnScroll=void 0,p._callOnScroll=Ls(function(y,v,b){return p.props.onScroll({scrollDirection:y,scrollOffset:v,scrollUpdateWasRequested:b})}),p._getItemStyle=void 0,p._getItemStyle=function(y){var v=p.props,b=v.direction,C=v.itemSize,S=v.layout,T=p._getItemStyleCache(d&&C,d&&S,d&&b),I;if(T.hasOwnProperty(y))I=T[y];else{var k=r(p.props,y,p._instanceProps),x=o(p.props,y,p._instanceProps),$=b==="horizontal"||S==="horizontal",j=b==="rtl",N=$?k:0;T[y]=I={position:"absolute",left:j?void 0:N,right:j?N:void 0,top:$?0:k,height:$?"100%":x,width:$?x:"100%"}}return I},p._getItemStyleCache=void 0,p._getItemStyleCache=Ls(function(y,v,b){return{}}),p._onScrollHorizontal=function(y){var v=y.currentTarget,b=v.clientWidth,C=v.scrollLeft,S=v.scrollWidth;p.setState(function(T){if(T.scrollOffset===C)return null;var I=p.props.direction,k=C;if(I==="rtl")switch(Lu()){case"negative":k=-C;break;case"positive-descending":k=S-b-C;break}return k=Math.max(0,Math.min(k,S-b)),{isScrolling:!0,scrollDirection:T.scrollOffset<k?"forward":"backward",scrollOffset:k,scrollUpdateWasRequested:!1}},p._resetIsScrollingDebounced)},p._onScrollVertical=function(y){var v=y.currentTarget,b=v.clientHeight,C=v.scrollHeight,S=v.scrollTop;p.setState(function(T){if(T.scrollOffset===S)return null;var I=Math.max(0,Math.min(S,C-b));return{isScrolling:!0,scrollDirection:T.scrollOffset<I?"forward":"backward",scrollOffset:I,scrollUpdateWasRequested:!1}},p._resetIsScrollingDebounced)},p._outerRefSetter=function(y){var v=p.props.outerRef;p._outerRef=y,typeof v=="function"?v(y):v!=null&&typeof v=="object"&&v.hasOwnProperty("current")&&(v.current=y)},p._resetIsScrollingDebounced=function(){p._resetIsScrollingTimeoutId!==null&&ku(p._resetIsScrollingTimeoutId),p._resetIsScrollingTimeoutId=CC(p._resetIsScrolling,SC)},p._resetIsScrolling=function(){p._resetIsScrollingTimeoutId=null,p.setState({isScrolling:!1},function(){p._getItemStyleCache(-1,null)})},p}m.getDerivedStateFromProps=function(p,y){return TC(p,y),f(p),null};var g=m.prototype;return g.scrollTo=function(p){p=Math.max(0,p),this.setState(function(y){return y.scrollOffset===p?null:{scrollDirection:y.scrollOffset<p?"forward":"backward",scrollOffset:p,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},g.scrollToItem=function(p,y){y===void 0&&(y="auto");var v=this.props,b=v.itemCount,C=v.layout,S=this.state.scrollOffset;p=Math.max(0,Math.min(p,b-1));var T=0;if(this._outerRef){var I=this._outerRef;C==="vertical"?T=I.scrollWidth>I.clientWidth?xu():0:T=I.scrollHeight>I.clientHeight?xu():0}this.scrollTo(a(this.props,p,y,S,this._instanceProps,T))},g.componentDidMount=function(){var p=this.props,y=p.direction,v=p.initialScrollOffset,b=p.layout;if(typeof v=="number"&&this._outerRef!=null){var C=this._outerRef;y==="horizontal"||b==="horizontal"?C.scrollLeft=v:C.scrollTop=v}this._callPropsCallbacks()},g.componentDidUpdate=function(){var p=this.props,y=p.direction,v=p.layout,b=this.state,C=b.scrollOffset,S=b.scrollUpdateWasRequested;if(S&&this._outerRef!=null){var T=this._outerRef;if(y==="horizontal"||v==="horizontal")if(y==="rtl")switch(Lu()){case"negative":T.scrollLeft=-C;break;case"positive-ascending":T.scrollLeft=C;break;default:var I=T.clientWidth,k=T.scrollWidth;T.scrollLeft=k-I-C;break}else T.scrollLeft=C;else T.scrollTop=C}this._callPropsCallbacks()},g.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&ku(this._resetIsScrollingTimeoutId)},g.render=function(){var p=this.props,y=p.children,v=p.className,b=p.direction,C=p.height,S=p.innerRef,T=p.innerElementType,I=p.innerTagName,k=p.itemCount,x=p.itemData,$=p.itemKey,j=$===void 0?_C:$,N=p.layout,L=p.outerElementType,B=p.outerTagName,P=p.style,F=p.useIsScrolling,V=p.width,X=this.state.isScrolling,ve=b==="horizontal"||N==="horizontal",Ee=ve?this._onScrollHorizontal:this._onScrollVertical,Ce=this._getRangeToRender(),ue=Ce[0],Q=Ce[1],ne=[];if(k>0)for(var te=ue;te<=Q;te++)ne.push(h.createElement(y,{data:x,key:j(te,x),index:te,isScrolling:F?X:void 0,style:this._getItemStyle(te)}));var U=n(this.props,this._instanceProps);return h.createElement(L||B||"div",{className:v,onScroll:Ee,ref:this._outerRefSetter,style:ks({position:"relative",height:C,width:V,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:b},P)},h.createElement(T||I||"div",{children:ne,ref:S,style:{height:ve?"100%":U,pointerEvents:X?"none":void 0,width:ve?U:"100%"}}))},g._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var p=this.props.itemCount;if(p>0){var y=this._getRangeToRender(),v=y[0],b=y[1],C=y[2],S=y[3];this._callOnItemsRendered(v,b,C,S)}}if(typeof this.props.onScroll=="function"){var T=this.state,I=T.scrollDirection,k=T.scrollOffset,x=T.scrollUpdateWasRequested;this._callOnScroll(I,k,x)}},g._getRangeToRender=function(){var p=this.props,y=p.itemCount,v=p.overscanCount,b=this.state,C=b.isScrolling,S=b.scrollDirection,T=b.scrollOffset;if(y===0)return[0,0,0,0];var I=i(this.props,T,this._instanceProps),k=s(this.props,I,T,this._instanceProps),x=!C||S==="backward"?Math.max(1,v):1,$=!C||S==="forward"?Math.max(1,v):1;return[Math.max(0,I-x),Math.max(0,Math.min(y-1,k+$)),I,k]},m}(h.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var TC=function(t,r){var n=t.children,o=t.direction,a=t.height,i=t.layout,s=t.innerTagName,l=t.outerTagName,d=t.width,f=r.instance;if(process.env.NODE_ENV!=="production"){(s!=null||l!=null)&&$a&&!$a.has(f)&&($a.add(f),console.warn("The innerTagName and outerTagName props have been deprecated. Please use the innerElementType and outerElementType props instead."));var u=o==="horizontal"||i==="horizontal";switch(o){case"horizontal":case"vertical":Ma&&!Ma.has(f)&&(Ma.add(f),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". '+('"'+o+'" was specified.'))}switch(i){case"horizontal":case"vertical":break;default:throw Error('An invalid "layout" prop has been specified. Value should be either "horizontal" or "vertical". '+('"'+i+'" 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(u&&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(!u&&typeof a!="number")throw Error('An invalid "height" prop has been specified. Vertical lists must specify a number for height. '+('"'+(a===null?"null":typeof a)+'" was specified.'))}},EC=50,Ln=function(t,r,n){var o=t,a=o.itemSize,i=n.itemMetadataMap,s=n.lastMeasuredIndex;if(r>s){var l=0;if(s>=0){var d=i[s];l=d.offset+d.size}for(var f=s+1;f<=r;f++){var u=a(f);i[f]={offset:l,size:u},l+=u}n.lastMeasuredIndex=r}return i[r]},IC=function(t,r,n){var o=r.itemMetadataMap,a=r.lastMeasuredIndex,i=a>0?o[a].offset:0;return i>=n?Fu(t,r,a,0,n):OC(t,r,Math.max(0,a),n)},Fu=function(t,r,n,o,a){for(;o<=n;){var i=o+Math.floor((n-o)/2),s=Ln(t,i,r).offset;if(s===a)return i;s<a?o=i+1:s>a&&(n=i-1)}return o>0?o-1:0},OC=function(t,r,n,o){for(var a=t.itemCount,i=1;n<a&&Ln(t,n,r).offset<o;)n+=i,i*=2;return Fu(t,r,Math.min(n,a-1),Math.floor(n/2),o)},Mu=function(t,r){var n=t.itemCount,o=r.itemMetadataMap,a=r.estimatedItemSize,i=r.lastMeasuredIndex,s=0;if(i>=n&&(i=n-1),i>=0){var l=o[i];s=l.offset+l.size}var d=n-i-1,f=d*a;return s+f},AC=Pu({getItemOffset:function(t,r,n){return Ln(t,r,n).offset},getItemSize:function(t,r,n){return n.itemMetadataMap[r].size},getEstimatedTotalSize:Mu,getOffsetForIndexAndAlignment:function(t,r,n,o,a,i){var s=t.direction,l=t.height,d=t.layout,f=t.width,u=s==="horizontal"||d==="horizontal",m=u?f:l,g=Ln(t,r,a),w=Mu(t,a),p=Math.max(0,Math.min(w-m,g.offset)),y=Math.max(0,g.offset-m+g.size+i);switch(n==="smart"&&(o>=y-m&&o<=p+m?n="auto":n="center"),n){case"start":return p;case"end":return y;case"center":return Math.round(y+(p-y)/2);case"auto":default:return o>=y&&o<=p?o:o<y?y:p}},getStartIndexForOffset:function(t,r,n){return IC(t,n,r)},getStopIndexForStartIndex:function(t,r,n,o){for(var a=t.direction,i=t.height,s=t.itemCount,l=t.layout,d=t.width,f=a==="horizontal"||l==="horizontal",u=f?d:i,m=Ln(t,r,o),g=n+u,w=m.offset+m.size,p=r;p<s-1&&w<g;)p++,w+=Ln(t,p,o).size;return p},initInstanceProps:function(t,r){var n=t,o=n.estimatedItemSize,a={itemMetadataMap:{},estimatedItemSize:o||EC,lastMeasuredIndex:-1};return r.resetAfterIndex=function(i,s){s===void 0&&(s=!0),a.lastMeasuredIndex=Math.min(a.lastMeasuredIndex,i-1),r._getItemStyleCache(-1),s&&r.forceUpdate()},a},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.'))}}),DC=Pu({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,o,a,i){var s=t.direction,l=t.height,d=t.itemCount,f=t.itemSize,u=t.layout,m=t.width,g=s==="horizontal"||u==="horizontal",w=g?m:l,p=Math.max(0,d*f-w),y=Math.min(p,r*f),v=Math.max(0,r*f-w+f+i);switch(n==="smart"&&(o>=v-w&&o<=y+w?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(w/2)?0:b>p+Math.floor(w/2)?p:b}case"auto":default:return o>=v&&o<=y?o:o<v?v:y}},getStartIndexForOffset:function(t,r){var n=t.itemCount,o=t.itemSize;return Math.max(0,Math.min(n-1,Math.floor(r/o)))},getStopIndexForStartIndex:function(t,r,n){var o=t.direction,a=t.height,i=t.itemCount,s=t.itemSize,l=t.layout,d=t.width,f=o==="horizontal"||l==="horizontal",u=r*s,m=f?d:a,g=Math.ceil((m+n-u)/s);return Math.max(0,Math.min(i-1,r+g-1))},initInstanceProps:function(t){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(t){var r=t.itemSize;if(process.env.NODE_ENV!=="production"&&typeof r!="number")throw Error('An invalid "itemSize" prop has been specified. Value should be a number. '+('"'+(r===null?"null":typeof r)+'" was specified.'))}});function NC(){var e,t;const r=Nt(),o=Rw().cursor;if(!o||o.type!=="line")return null;const a=r.indent,i=r.rowTopPosition(o.index)+((t=(e=r.props.padding)!==null&&e!==void 0?e:r.props.paddingTop)!==null&&t!==void 0?t:0),s=a*o.level,l=r.renderCursor;return c.jsx(l,{top:i,left:s,indent:a})}var kC=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 o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r};const xC=h.forwardRef(function(t,r){const{children:n}=t,o=kC(t,["children"]),a=Nt();return c.jsxs("div",Object.assign({ref:r},o,{onClick:i=>{i.currentTarget===i.target&&a.deselectAll()},children:[c.jsx(LC,{}),n]}))}),LC=()=>{const e=Nt();return c.jsx("div",{style:{height:e.rowTopPosition(e.visibleNodes.length),width:"100%",position:"absolute",left:"0",right:"0"},children:c.jsx(NC,{})})};var PC=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 o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r};const FC=h.forwardRef(function(t,r){var n,o,a,i,{style:s}=t,l=PC(t,["style"]);const d=Nt(),f=(o=(n=d.props.padding)!==null&&n!==void 0?n:d.props.paddingTop)!==null&&o!==void 0?o:0,u=(i=(a=d.props.padding)!==null&&a!==void 0?a:d.props.paddingBottom)!==null&&i!==void 0?i:0;return c.jsx("div",Object.assign({ref:r,style:Object.assign(Object.assign({},s),{height:`${parseFloat(s.height)+f+u}px`})},l))});var $u=h.createContext({dragDropManager:void 0}),zt;(function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"})(zt||(zt={}));function he(e,t){for(var r=arguments.length,n=new Array(r>2?r-2:0),o=2;o<r;o++)n[o-2]=arguments[o];if(process.env.NODE_ENV!=="production"&&t===void 0)throw new Error("invariant requires an error message argument");if(!e){var a;if(t===void 0)a=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var i=0;a=new Error(t.replace(/%s/g,function(){return n[i++]})),a.name="Invariant Violation"}throw a.framesToPop=1,a}}var Fs="dnd-core/INIT_COORDS",Ba="dnd-core/BEGIN_DRAG",Ms="dnd-core/PUBLISH_DRAG_SOURCE",ja="dnd-core/HOVER",qa="dnd-core/DROP",Ua="dnd-core/END_DRAG";function Bu(e,t){return{type:Fs,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}function za(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?za=function(r){return typeof r}:za=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},za(e)}function MC(e,t,r){return t.split(".").reduce(function(n,o){return n&&n[o]?n[o]:r||null},e)}function $C(e,t){return e.filter(function(r){return r!==t})}function ju(e){return za(e)==="object"}function BC(e,t){var r=new Map,n=function(i){r.set(i,r.has(i)?r.get(i)+1:1)};e.forEach(n),t.forEach(n);var o=[];return r.forEach(function(a,i){a===1&&o.push(i)}),o}function jC(e,t){return e.filter(function(r){return t.indexOf(r)>-1})}var qC={type:Fs,payload:{clientOffset:null,sourceClientOffset:null}};function UC(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},o=n.publishSource,a=o===void 0?!0:o,i=n.clientOffset,s=n.getSourceClientOffset,l=e.getMonitor(),d=e.getRegistry();e.dispatch(Bu(i)),zC(r,l,d);var f=RC(r,l);if(f===null){e.dispatch(qC);return}var u=null;if(i){if(!s)throw new Error("getSourceClientOffset must be defined");VC(s),u=s(f)}e.dispatch(Bu(i,u));var m=d.getSource(f),g=m.beginDrag(l,f);if(g!=null){HC(g),d.pinSource(f);var w=d.getSourceType(f);return{type:Ba,payload:{itemType:w,item:g,sourceId:f,clientOffset:i||null,sourceClientOffset:u||null,isSourcePublic:!!a}}}}}function zC(e,t,r){he(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach(function(n){he(r.getSource(n),"Expected sourceIds to be registered.")})}function VC(e){he(typeof e=="function","When clientOffset is provided, getSourceClientOffset must be a function.")}function HC(e){he(ju(e),"Item must be an object.")}function RC(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 QC(e){return function(){var r=e.getMonitor();if(r.isDragging())return{type:Ms}}}function $s(e,t){return t===null?e===null:Array.isArray(e)?e.some(function(r){return r===t}):e===t}function GC(e){return function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=n.clientOffset;WC(r);var a=r.slice(0),i=e.getMonitor(),s=e.getRegistry();KC(a,i,s);var l=i.getItemType();return YC(a,s,l),ZC(a,i,s),{type:ja,payload:{targetIds:a,clientOffset:o||null}}}}function WC(e){he(Array.isArray(e),"Expected targetIds to be an array.")}function KC(e,t,r){he(t.isDragging(),"Cannot call hover while not dragging."),he(!t.didDrop(),"Cannot call hover after drop.");for(var n=0;n<e.length;n++){var o=e[n];he(e.lastIndexOf(o)===n,"Expected targetIds to be unique in the passed array.");var a=r.getTarget(o);he(a,"Expected targetIds to be registered.")}}function YC(e,t,r){for(var n=e.length-1;n>=0;n--){var o=e[n],a=t.getTargetType(o);$s(a,r)||e.splice(n,1)}}function ZC(e,t,r){e.forEach(function(n){var o=r.getTarget(n);o.hover(t,n)})}function qu(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Uu(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?qu(Object(r),!0).forEach(function(n){XC(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):qu(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function XC(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function JC(e){return function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.getMonitor(),o=e.getRegistry();eS(n);var a=nS(n);a.forEach(function(i,s){var l=tS(i,s,o,n),d={type:qa,payload:{dropResult:Uu(Uu({},r),l)}};e.dispatch(d)})}}function eS(e){he(e.isDragging(),"Cannot call drop while not dragging."),he(!e.didDrop(),"Cannot call drop twice during one drag operation.")}function tS(e,t,r,n){var o=r.getTarget(e),a=o?o.drop(n,e):void 0;return rS(a),typeof a>"u"&&(a=t===0?{}:n.getDropResult()),a}function rS(e){he(typeof e>"u"||ju(e),"Drop result must either be an object or undefined.")}function nS(e){var t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function oS(e){return function(){var r=e.getMonitor(),n=e.getRegistry();aS(r);var o=r.getSourceId();if(o!=null){var a=n.getSource(o,!0);a.endDrag(r,o),n.unpinSource()}return{type:Ua}}}function aS(e){he(e.isDragging(),"Cannot call endDrag while not dragging.")}function iS(e){return{beginDrag:UC(e),publishDragSource:QC(e),hover:GC(e),drop:JC(e),endDrag:oS(e)}}function sS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function lS(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 cS(e,t,r){return t&&lS(e.prototype,t),e}function Oo(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var dS=function(){function e(t,r){var n=this;sS(this,e),Oo(this,"store",void 0),Oo(this,"monitor",void 0),Oo(this,"backend",void 0),Oo(this,"isSetUp",!1),Oo(this,"handleRefCountChange",function(){var o=n.store.getState().refCount>0;n.backend&&(o&&!n.isSetUp?(n.backend.setup(),n.isSetUp=!0):!o&&n.isSetUp&&(n.backend.teardown(),n.isSetUp=!1))}),this.store=t,this.monitor=r,t.subscribe(this.handleRefCountChange)}return cS(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 o(i){return function(){for(var s=arguments.length,l=new Array(s),d=0;d<s;d++)l[d]=arguments[d];var f=i.apply(r,l);typeof f<"u"&&n(f)}}var a=iS(this);return Object.keys(a).reduce(function(i,s){var l=a[s];return i[s]=o(l),i},{})}},{key:"dispatch",value:function(r){this.store.dispatch(r)}}]),e}();function Vt(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var zu=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),Vu=function(){return Math.random().toString(36).substring(7).split("").join(".")},Hu={INIT:"@@redux/INIT"+Vu(),REPLACE:"@@redux/REPLACE"+Vu()};function uS(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 fS(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(gS(e))return"date";if(pS(e))return"error";var r=hS(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 hS(e){return typeof e.constructor=="function"?e.constructor.name:null}function pS(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function gS(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function Pn(e){var t=typeof e;return process.env.NODE_ENV!=="production"&&(t=fS(e)),t}function Ru(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"?Vt(0):"It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.");if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(process.env.NODE_ENV==="production"?Vt(1):"Expected the enhancer to be a function. Instead, received: '"+Pn(r)+"'");return r(Ru)(e,t)}if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?Vt(2):"Expected the root reducer to be a function. Instead, received: '"+Pn(e)+"'");var o=e,a=t,i=[],s=i,l=!1;function d(){s===i&&(s=i.slice())}function f(){if(l)throw new Error(process.env.NODE_ENV==="production"?Vt(3):"You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return a}function u(p){if(typeof p!="function")throw new Error(process.env.NODE_ENV==="production"?Vt(4):"Expected the listener to be a function. Instead, received: '"+Pn(p)+"'");if(l)throw new Error(process.env.NODE_ENV==="production"?Vt(5):"You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api/store#subscribelistener for more details.");var y=!0;return d(),s.push(p),function(){if(y){if(l)throw new Error(process.env.NODE_ENV==="production"?Vt(6):"You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api/store#subscribelistener for more details.");y=!1,d();var b=s.indexOf(p);s.splice(b,1),i=null}}}function m(p){if(!uS(p))throw new Error(process.env.NODE_ENV==="production"?Vt(7):"Actions must be plain objects. Instead, the actual type was: '"+Pn(p)+"'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.");if(typeof p.type>"u")throw new Error(process.env.NODE_ENV==="production"?Vt(8):'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');if(l)throw new Error(process.env.NODE_ENV==="production"?Vt(9):"Reducers may not dispatch actions.");try{l=!0,a=o(a,p)}finally{l=!1}for(var y=i=s,v=0;v<y.length;v++){var b=y[v];b()}return p}function g(p){if(typeof p!="function")throw new Error(process.env.NODE_ENV==="production"?Vt(10):"Expected the nextReducer to be a function. Instead, received: '"+Pn(p));o=p,m({type:Hu.REPLACE})}function w(){var p,y=u;return p={subscribe:function(b){if(typeof b!="object"||b===null)throw new Error(process.env.NODE_ENV==="production"?Vt(11):"Expected the observer to be an object. Instead, received: '"+Pn(b)+"'");function C(){b.next&&b.next(f())}C();var S=y(C);return{unsubscribe:S}}},p[zu]=function(){return this},p}return m({type:Hu.INIT}),n={dispatch:m,subscribe:u,getState:f,replaceReducer:g},n[zu]=w,n}var mS=function(t,r){return t===r};function yS(e,t){return!e&&!t?!0:!e||!t?!1:e.x===t.x&&e.y===t.y}function vS(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:mS;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 Qu(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Gu(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Qu(Object(r),!0).forEach(function(n){bS(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Qu(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function bS(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Wu={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function wS(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Wu,t=arguments.length>1?arguments[1]:void 0,r=t.payload;switch(t.type){case Fs:case Ba:return{initialSourceClientOffset:r.sourceClientOffset,initialClientOffset:r.clientOffset,clientOffset:r.clientOffset};case ja:return yS(e.clientOffset,r.clientOffset)?e:Gu(Gu({},e),{},{clientOffset:r.clientOffset});case Ua:case qa:return Wu;default:return e}}var Bs="dnd-core/ADD_SOURCE",js="dnd-core/ADD_TARGET",qs="dnd-core/REMOVE_SOURCE",Va="dnd-core/REMOVE_TARGET";function CS(e){return{type:Bs,payload:{sourceId:e}}}function SS(e){return{type:js,payload:{targetId:e}}}function _S(e){return{type:qs,payload:{sourceId:e}}}function TS(e){return{type:Va,payload:{targetId:e}}}function Ku(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Ht(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ku(Object(r),!0).forEach(function(n){ES(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ku(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ES(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var IS={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function OS(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:IS,t=arguments.length>1?arguments[1]:void 0,r=t.payload;switch(t.type){case Ba:return Ht(Ht({},e),{},{itemType:r.itemType,item:r.item,sourceId:r.sourceId,isSourcePublic:r.isSourcePublic,dropResult:null,didDrop:!1});case Ms:return Ht(Ht({},e),{},{isSourcePublic:!0});case ja:return Ht(Ht({},e),{},{targetIds:r.targetIds});case Va:return e.targetIds.indexOf(r.targetId)===-1?e:Ht(Ht({},e),{},{targetIds:$C(e.targetIds,r.targetId)});case qa:return Ht(Ht({},e),{},{dropResult:r.dropResult,didDrop:!0,targetIds:[]});case Ua:return Ht(Ht({},e),{},{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}}function AS(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case Bs:case js:return e+1;case qs:case Va:return e-1;default:return e}}var Ha=[],Us=[];Ha.__IS_NONE__=!0,Us.__IS_ALL__=!0;function DS(e,t){if(e===Ha)return!1;if(e===Us||typeof t>"u")return!0;var r=jC(t,e);return r.length>0}function NS(){var e=arguments.length>1?arguments[1]:void 0;switch(e.type){case ja:break;case Bs:case js:case Va:case qs:return Ha;case Ba:case Ms:case Ua:case qa:default:return Us}var t=e.payload,r=t.targetIds,n=r===void 0?[]:r,o=t.prevTargetIds,a=o===void 0?[]:o,i=BC(n,a),s=i.length>0||!vS(n,a);if(!s)return Ha;var l=a[a.length-1],d=n[n.length-1];return l!==d&&(l&&i.push(l),d&&i.push(d)),i}function kS(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return e+1}function Yu(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Zu(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Yu(Object(r),!0).forEach(function(n){xS(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Yu(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function xS(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function LS(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return{dirtyHandlerIds:NS(e.dirtyHandlerIds,{type:t.type,payload:Zu(Zu({},t.payload),{},{prevTargetIds:MC(e,"dragOperation.targetIds",[])})}),dragOffset:wS(e.dragOffset,t),refCount:AS(e.refCount,t),dragOperation:OS(e.dragOperation,t),stateId:kS(e.stateId)}}function PS(e,t){return{x:e.x+t.x,y:e.y+t.y}}function Xu(e,t){return{x:e.x-t.x,y:e.y-t.y}}function FS(e){var t=e.clientOffset,r=e.initialClientOffset,n=e.initialSourceClientOffset;return!t||!r||!n?null:Xu(PS(t,n),r)}function MS(e){var t=e.clientOffset,r=e.initialClientOffset;return!t||!r?null:Xu(t,r)}function $S(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function BS(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function jS(e,t,r){return t&&BS(e.prototype,t),e}function Ju(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var qS=function(){function e(t,r){$S(this,e),Ju(this,"store",void 0),Ju(this,"registry",void 0),this.store=t,this.registry=r}return jS(e,[{key:"subscribeToStateChange",value:function(r){var n=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{handlerIds:void 0},a=o.handlerIds;he(typeof r=="function","listener must be a function."),he(typeof a>"u"||Array.isArray(a),"handlerIds, when specified, must be an array of strings.");var i=this.store.getState().stateId,s=function(){var d=n.store.getState(),f=d.stateId;try{var u=f===i||f===i+1&&!DS(d.dirtyHandlerIds,a);u||r()}finally{i=f}};return this.store.subscribe(s)}},{key:"subscribeToOffsetChange",value:function(r){var n=this;he(typeof r=="function","listener must be a function.");var o=this.store.getState().dragOffset,a=function(){var s=n.store.getState().dragOffset;s!==o&&(o=s,r())};return this.store.subscribe(a)}},{key:"canDragSource",value:function(r){if(!r)return!1;var n=this.registry.getSource(r);return he(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(he(n,"Expected to find a valid target. targetId=".concat(r)),!this.isDragging()||this.didDrop())return!1;var o=this.registry.getTargetType(r),a=this.getItemType();return $s(o,a)&&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(he(n,"Expected to find a valid source. sourceId=".concat(r)),!this.isDragging()||!this.isSourcePublic())return!1;var o=this.registry.getSourceType(r),a=this.getItemType();return o!==a?!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 o=n.shallow;if(!this.isDragging())return!1;var a=this.registry.getTargetType(r),i=this.getItemType();if(i&&!$s(a,i))return!1;var s=this.getTargetIds();if(!s.length)return!1;var l=s.indexOf(r);return o?l===s.length-1:l>-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 FS(this.store.getState().dragOffset)}},{key:"getDifferenceFromInitialOffset",value:function(){return MS(this.store.getState().dragOffset)}}]),e}(),US=0;function zS(){return US++}function Ra(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ra=function(r){return typeof r}:Ra=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Ra(e)}function VS(e){he(typeof e.canDrag=="function","Expected canDrag to be a function."),he(typeof e.beginDrag=="function","Expected beginDrag to be a function."),he(typeof e.endDrag=="function","Expected endDrag to be a function.")}function HS(e){he(typeof e.canDrop=="function","Expected canDrop to be a function."),he(typeof e.hover=="function","Expected hover to be a function."),he(typeof e.drop=="function","Expected beginDrag to be a function.")}function zs(e,t){if(t&&Array.isArray(e)){e.forEach(function(r){return zs(r,!1)});return}he(typeof e=="string"||Ra(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 ef=typeof global<"u"?global:self,tf=ef.MutationObserver||ef.WebKitMutationObserver;function rf(e){return function(){const r=setTimeout(o,0),n=setInterval(o,50);function o(){clearTimeout(r),clearInterval(n),e()}}}function RS(e){let t=1;const r=new tf(e),n=document.createTextNode("");return r.observe(n,{characterData:!0}),function(){t=-t,n.data=t}}const QS=typeof tf=="function"?RS:rf;class GS{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,o=t.length-this.index;n<o;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=QS(this.flush),this.requestErrorThrow=rf(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}}class WS{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 KS{create(t){const r=this.freeTasks,n=r.length?r.pop():new WS(this.onError,o=>r[r.length]=o);return n.task=t,n}constructor(t){this.onError=t,this.freeTasks=[]}}const nf=new GS,YS=new KS(nf.registerPendingError);function ZS(e){nf.enqueueTask(YS.create(e))}function XS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function JS(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 e_(e,t,r){return t&&JS(e.prototype,t),e}function Fn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function t_(e,t){return a_(e)||o_(e,t)||n_(e,t)||r_()}function r_(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
497
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function n_(e,t){if(e){if(typeof e=="string")return of(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 of(e,t)}}function of(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 o_(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],o=!0,a=!1,i,s;try{for(r=r.call(e);!(o=(i=r.next()).done)&&(n.push(i.value),!(t&&n.length===t));o=!0);}catch(l){a=!0,s=l}finally{try{!o&&r.return!=null&&r.return()}finally{if(a)throw s}}return n}}function a_(e){if(Array.isArray(e))return e}function i_(e){var t=zS().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 af(e){switch(e[0]){case"S":return zt.SOURCE;case"T":return zt.TARGET;default:he(!1,"Cannot parse handler ID: ".concat(e))}}function sf(e,t){var r=e.entries(),n=!1;do{var o=r.next(),a=o.done,i=t_(o.value,2),s=i[1];if(s===t)return!0;n=!!a}while(!n);return!1}var s_=function(){function e(t){XS(this,e),Fn(this,"types",new Map),Fn(this,"dragSources",new Map),Fn(this,"dropTargets",new Map),Fn(this,"pinnedSourceId",null),Fn(this,"pinnedSource",null),Fn(this,"store",void 0),this.store=t}return e_(e,[{key:"addSource",value:function(r,n){zs(r),VS(n);var o=this.addHandler(zt.SOURCE,r,n);return this.store.dispatch(CS(o)),o}},{key:"addTarget",value:function(r,n){zs(r,!0),HS(n);var o=this.addHandler(zt.TARGET,r,n);return this.store.dispatch(SS(o)),o}},{key:"containsHandler",value:function(r){return sf(this.dragSources,r)||sf(this.dropTargets,r)}},{key:"getSource",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;he(this.isSourceId(r),"Expected a valid source ID.");var o=n&&r===this.pinnedSourceId,a=o?this.pinnedSource:this.dragSources.get(r);return a}},{key:"getTarget",value:function(r){return he(this.isTargetId(r),"Expected a valid target ID."),this.dropTargets.get(r)}},{key:"getSourceType",value:function(r){return he(this.isSourceId(r),"Expected a valid source ID."),this.types.get(r)}},{key:"getTargetType",value:function(r){return he(this.isTargetId(r),"Expected a valid target ID."),this.types.get(r)}},{key:"isSourceId",value:function(r){var n=af(r);return n===zt.SOURCE}},{key:"isTargetId",value:function(r){var n=af(r);return n===zt.TARGET}},{key:"removeSource",value:function(r){var n=this;he(this.getSource(r),"Expected an existing source."),this.store.dispatch(_S(r)),ZS(function(){n.dragSources.delete(r),n.types.delete(r)})}},{key:"removeTarget",value:function(r){he(this.getTarget(r),"Expected an existing target."),this.store.dispatch(TS(r)),this.dropTargets.delete(r),this.types.delete(r)}},{key:"pinSource",value:function(r){var n=this.getSource(r);he(n,"Expected an existing source."),this.pinnedSourceId=r,this.pinnedSource=n}},{key:"unpinSource",value:function(){he(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}},{key:"addHandler",value:function(r,n,o){var a=i_(r);return this.types.set(a,n),r===zt.SOURCE?this.dragSources.set(a,o):r===zt.TARGET&&this.dropTargets.set(a,o),a}}]),e}();function l_(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,o=c_(n),a=new qS(o,new s_(o)),i=new dS(o,a),s=e(i,t,r);return i.receiveBackend(s),i}function c_(e){var t=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__;return Ru(LS,e&&t&&t({name:"dnd-core",instanceId:"dnd-core"}))}var d_=["children"];function u_(e,t){return g_(e)||p_(e,t)||h_(e,t)||f_()}function f_(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
498
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function h_(e,t){if(e){if(typeof e=="string")return lf(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return lf(e,t)}}function lf(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function p_(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],o=!0,a=!1,i,s;try{for(r=r.call(e);!(o=(i=r.next()).done)&&(n.push(i.value),!(t&&n.length===t));o=!0);}catch(l){a=!0,s=l}finally{try{!o&&r.return!=null&&r.return()}finally{if(a)throw s}}return n}}function g_(e){if(Array.isArray(e))return e}function m_(e,t){if(e==null)return{};var r=y_(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function y_(e,t){if(e==null)return{};var r={},n=Object.keys(e),o,a;for(a=0;a<n.length;a++)o=n[a],!(t.indexOf(o)>=0)&&(r[o]=e[o]);return r}var cf=0,Qa=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__"),v_=h.memo(function(t){var r=t.children,n=m_(t,d_),o=b_(n),a=u_(o,2),i=a[0],s=a[1];return h.useEffect(function(){if(s){var l=df();return++cf,function(){--cf===0&&(l[Qa]=null)}}},[]),c.jsx($u.Provider,Object.assign({value:i},{children:r}),void 0)});function b_(e){if("manager"in e){var t={dragDropManager:e.manager};return[t,!1]}var r=w_(e.backend,e.context,e.options,e.debugMode),n=!e.context;return[r,n]}function w_(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:df(),r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0,o=t;return o[Qa]||(o[Qa]={dragDropManager:l_(e,t,r,n)}),o[Qa]}function df(){return typeof global<"u"?global:window}function C_(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function S_(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function __(e,t,r){return t&&S_(e.prototype,t),e}function uf(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Vs=!1,Hs=!1,T_=function(){function e(t){C_(this,e),uf(this,"internalMonitor",void 0),uf(this,"sourceId",null),this.internalMonitor=t.getMonitor()}return __(e,[{key:"receiveHandlerId",value:function(r){this.sourceId=r}},{key:"getHandlerId",value:function(){return this.sourceId}},{key:"canDrag",value:function(){he(!Vs,"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 Vs=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{Vs=!1}}},{key:"isDragging",value:function(){if(!this.sourceId)return!1;he(!Hs,"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 Hs=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{Hs=!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 E_(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function I_(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 O_(e,t,r){return t&&I_(e.prototype,t),e}function ff(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Rs=!1,A_=function(){function e(t){E_(this,e),ff(this,"internalMonitor",void 0),ff(this,"targetId",null),this.internalMonitor=t.getMonitor()}return O_(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;he(!Rs,"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 Rs=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{Rs=!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 D_(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 N_(e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(!h.isValidElement(t)){var n=t;return e(n,r),n}var o=t;D_(o);var a=r?function(i){return e(i,r)}:e;return k_(o,a)}}function hf(e){var t={};return Object.keys(e).forEach(function(r){var n=e[r];if(r.endsWith("Ref"))t[r]=e[r];else{var o=N_(n);t[r]=function(){return o}}}),t}function pf(e,t){typeof e=="function"?e(t):e.current=t}function k_(e,t){var r=e.ref;return he(typeof r!="string","Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),r?h.cloneElement(e,{ref:function(o){pf(r,o),pf(t,o)}}):h.cloneElement(e,{ref:t})}function Ga(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ga=function(r){return typeof r}:Ga=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Ga(e)}function Qs(e){return e!==null&&Ga(e)==="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function Gs(e,t,r,n){var o=void 0;if(o!==void 0)return!!o;if(e===t)return!0;if(typeof e!="object"||!e||typeof t!="object"||!t)return!1;var a=Object.keys(e),i=Object.keys(t);if(a.length!==i.length)return!1;for(var s=Object.prototype.hasOwnProperty.bind(t),l=0;l<a.length;l++){var d=a[l];if(!s(d))return!1;var f=e[d],u=t[d];if(o=void 0,o===!1||o===void 0&&f!==u)return!1}return!0}function x_(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function L_(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 P_(e,t,r){return t&&L_(e.prototype,t),e}function yt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var F_=function(){function e(t){var r=this;x_(this,e),yt(this,"hooks",hf({dragSource:function(o,a){r.clearDragSource(),r.dragSourceOptions=a||null,Qs(o)?r.dragSourceRef=o:r.dragSourceNode=o,r.reconnectDragSource()},dragPreview:function(o,a){r.clearDragPreview(),r.dragPreviewOptions=a||null,Qs(o)?r.dragPreviewRef=o:r.dragPreviewNode=o,r.reconnectDragPreview()}})),yt(this,"handlerId",null),yt(this,"dragSourceRef",null),yt(this,"dragSourceNode",void 0),yt(this,"dragSourceOptionsInternal",null),yt(this,"dragSourceUnsubscribe",void 0),yt(this,"dragPreviewRef",null),yt(this,"dragPreviewNode",void 0),yt(this,"dragPreviewOptionsInternal",null),yt(this,"dragPreviewUnsubscribe",void 0),yt(this,"lastConnectedHandlerId",null),yt(this,"lastConnectedDragSource",null),yt(this,"lastConnectedDragSourceOptions",null),yt(this,"lastConnectedDragPreview",null),yt(this,"lastConnectedDragPreviewOptions",null),yt(this,"backend",void 0),this.backend=t}return P_(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!Gs(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}},{key:"didDragPreviewOptionsChange",value:function(){return!Gs(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 M_(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function $_(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 B_(e,t,r){return t&&$_(e.prototype,t),e}function ir(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var j_=function(){function e(t){var r=this;M_(this,e),ir(this,"hooks",hf({dropTarget:function(o,a){r.clearDropTarget(),r.dropTargetOptions=a,Qs(o)?r.dropTargetRef=o:r.dropTargetNode=o,r.reconnect()}})),ir(this,"handlerId",null),ir(this,"dropTargetRef",null),ir(this,"dropTargetNode",void 0),ir(this,"dropTargetOptionsInternal",null),ir(this,"unsubscribeDropTarget",void 0),ir(this,"lastConnectedHandlerId",null),ir(this,"lastConnectedDropTarget",null),ir(this,"lastConnectedDropTargetOptions",null),ir(this,"backend",void 0),this.backend=t}return B_(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!Gs(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 q_(e,t,r){var n=r.getRegistry(),o=n.addTarget(e,t);return[o,function(){return n.removeTarget(o)}]}function U_(e,t,r){var n=r.getRegistry(),o=n.addSource(e,t);return[o,function(){return n.removeSource(o)}]}var Yr=typeof window<"u"?h.useLayoutEffect:h.useEffect;function Wa(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Wa=function(r){return typeof r}:Wa=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Wa(e)}function z_(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function V_(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 H_(e,t,r){return t&&V_(e.prototype,t),e}function Ws(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var R_=function(){function e(t,r,n){z_(this,e),Ws(this,"spec",void 0),Ws(this,"monitor",void 0),Ws(this,"connector",void 0),this.spec=t,this.monitor=r,this.connector=n}return H_(e,[{key:"beginDrag",value:function(){var r,n=this.spec,o=this.monitor,a=null;return Wa(n.item)==="object"?a=n.item:typeof n.item=="function"?a=n.item(o):a={},(r=a)!==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 o=this.spec,a=this.monitor,i=o.isDragging;return i?i(a):n===r.getSourceId()}},{key:"endDrag",value:function(){var r=this.spec,n=this.monitor,o=this.connector,a=r.end;a&&a(n.getItem(),n),o.reconnect()}}]),e}();function Q_(e,t,r){var n=h.useMemo(function(){return new R_(e,t,r)},[t,r]);return h.useEffect(function(){n.spec=e},[e]),n}function Zr(){var e=h.useContext($u),t=e.dragDropManager;return he(t!=null,"Expected drag drop context"),t}function G_(e){return h.useMemo(function(){var t=e.type;return he(t!=null,"spec.type must be defined"),t},[e])}function W_(e,t){return X_(e)||Z_(e,t)||Y_(e,t)||K_()}function K_(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
499
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Y_(e,t){if(e){if(typeof e=="string")return gf(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 gf(e,t)}}function gf(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 Z_(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],o=!0,a=!1,i,s;try{for(r=r.call(e);!(o=(i=r.next()).done)&&(n.push(i.value),!(t&&n.length===t));o=!0);}catch(l){a=!0,s=l}finally{try{!o&&r.return!=null&&r.return()}finally{if(a)throw s}}return n}}function X_(e){if(Array.isArray(e))return e}function J_(e,t,r){var n=Zr(),o=Q_(e,t,r),a=G_(e);Yr(function(){if(a!=null){var s=U_(a,o,n),l=W_(s,2),d=l[0],f=l[1];return t.receiveHandlerId(d),r.receiveHandlerId(d),f}},[n,t,r,o,a])}function e0(e){return o0(e)||n0(e)||r0(e)||t0()}function t0(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
500
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function r0(e,t){if(e){if(typeof e=="string")return Ks(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 Ks(e,t)}}function n0(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function o0(e){if(Array.isArray(e))return Ks(e)}function Ks(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 mf(e,t){var r=e0(t||[]);return t==null&&typeof e!="function"&&r.push(e),h.useMemo(function(){return typeof e=="function"?e():e},r)}function a0(){var e=Zr();return h.useMemo(function(){return new T_(e)},[e])}function i0(e,t){var r=Zr(),n=h.useMemo(function(){return new F_(r.getBackend())},[r]);return Yr(function(){return n.dragSourceOptions=e||null,n.reconnect(),function(){return n.disconnectDragSource()}},[n,e]),Yr(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,o,a;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(o=n;o--!==0;)if(!e(t[o],r[o]))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(a=Object.keys(t),n=a.length,n!==Object.keys(r).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,a[o]))return!1;for(o=n;o--!==0;){var i=a[o];if(!e(t[i],r[i]))return!1}return!0}return t!==t&&r!==r};const l0=nd(s0);function c0(e,t){return h0(e)||f0(e,t)||u0(e,t)||d0()}function d0(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
501
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function u0(e,t){if(e){if(typeof e=="string")return yf(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 yf(e,t)}}function yf(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=[],o=!0,a=!1,i,s;try{for(r=r.call(e);!(o=(i=r.next()).done)&&(n.push(i.value),!(t&&n.length===t));o=!0);}catch(l){a=!0,s=l}finally{try{!o&&r.return!=null&&r.return()}finally{if(a)throw s}}return n}}function h0(e){if(Array.isArray(e))return e}function vf(e,t,r){var n=h.useState(function(){return t(e)}),o=c0(n,2),a=o[0],i=o[1],s=h.useCallback(function(){var l=t(e);l0(a,l)||(i(l),r&&r())},[a,e,r]);return Yr(s),[a,s]}function p0(e,t){return v0(e)||y0(e,t)||m0(e,t)||g0()}function g0(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
502
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function m0(e,t){if(e){if(typeof e=="string")return bf(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 bf(e,t)}}function bf(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function y0(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],o=!0,a=!1,i,s;try{for(r=r.call(e);!(o=(i=r.next()).done)&&(n.push(i.value),!(t&&n.length===t));o=!0);}catch(l){a=!0,s=l}finally{try{!o&&r.return!=null&&r.return()}finally{if(a)throw s}}return n}}function v0(e){if(Array.isArray(e))return e}function b0(e,t,r){var n=vf(e,t,r),o=p0(n,2),a=o[0],i=o[1];return Yr(function(){var l=e.getHandlerId();if(l!=null)return e.subscribeToStateChange(i,{handlerIds:[l]})},[e,i]),a}function wf(e,t,r){return b0(t,e||function(){return{}},function(){return r.reconnect()})}function w0(e){return h.useMemo(function(){return e.hooks.dragSource()},[e])}function C0(e){return h.useMemo(function(){return e.hooks.dragPreview()},[e])}function S0(e,t){var r=mf(e,t);he(!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=a0(),o=i0(r.options,r.previewOptions);return J_(r,n,o),[wf(r.collect,n,o),w0(o),C0(o)]}function _0(e){var t=e.accept;return h.useMemo(function(){return he(e.accept!=null,"accept must be defined"),Array.isArray(t)?t:[t]},[t])}function T0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function E0(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function I0(e,t,r){return t&&E0(e.prototype,t),e}function Cf(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var O0=function(){function e(t,r){T0(this,e),Cf(this,"spec",void 0),Cf(this,"monitor",void 0),this.spec=t,this.monitor=r}return I0(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 A0(e,t){var r=h.useMemo(function(){return new O0(e,t)},[t]);return h.useEffect(function(){r.spec=e},[e]),r}function D0(e,t){return L0(e)||x0(e,t)||k0(e,t)||N0()}function N0(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
503
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function k0(e,t){if(e){if(typeof e=="string")return Sf(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Sf(e,t)}}function Sf(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function x0(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],o=!0,a=!1,i,s;try{for(r=r.call(e);!(o=(i=r.next()).done)&&(n.push(i.value),!(t&&n.length===t));o=!0);}catch(l){a=!0,s=l}finally{try{!o&&r.return!=null&&r.return()}finally{if(a)throw s}}return n}}function L0(e){if(Array.isArray(e))return e}function P0(e,t,r){var n=Zr(),o=A0(e,t),a=_0(e);Yr(function(){var s=q_(a,o,n),l=D0(s,2),d=l[0],f=l[1];return t.receiveHandlerId(d),r.receiveHandlerId(d),f},[n,t,o,r,a.map(function(i){return i.toString()}).join("|")])}function F0(){var e=Zr();return h.useMemo(function(){return new A_(e)},[e])}function M0(e){var t=Zr(),r=h.useMemo(function(){return new j_(t.getBackend())},[t]);return Yr(function(){return r.dropTargetOptions=e||null,r.reconnect(),function(){return r.disconnectDropTarget()}},[e]),r}function $0(e){return h.useMemo(function(){return e.hooks.dropTarget()},[e])}function _f(e,t){var r=mf(e,t),n=F0(),o=M0(r.options);return P0(r,n,o),[wf(r.collect,n,o),$0(o)]}function B0(e,t){return z0(e)||U0(e,t)||q0(e,t)||j0()}function j0(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
504
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function q0(e,t){if(e){if(typeof e=="string")return Tf(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 Tf(e,t)}}function Tf(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 U0(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],o=!0,a=!1,i,s;try{for(r=r.call(e);!(o=(i=r.next()).done)&&(n.push(i.value),!(t&&n.length===t));o=!0);}catch(l){a=!0,s=l}finally{try{!o&&r.return!=null&&r.return()}finally{if(a)throw s}}return n}}function z0(e){if(Array.isArray(e))return e}function V0(e){var t=Zr(),r=t.getMonitor(),n=vf(r,e),o=B0(n,2),a=o[0],i=o[1];return h.useEffect(function(){return r.subscribeToOffsetChange(i)}),h.useEffect(function(){return r.subscribeToStateChange(i)}),a}function Ef(e){var t=null,r=function(){return t==null&&(t=e()),t};return r}function H0(e,t){return e.filter(function(r){return r!==t})}function R0(e,t){var r=new Set,n=function(i){return r.add(i)};e.forEach(n),t.forEach(n);var o=[];return r.forEach(function(a){return o.push(a)}),o}function Q0(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 W0(e,t,r){return t&&G0(e.prototype,t),e}function If(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var K0=function(){function e(t){Q0(this,e),If(this,"entered",[]),If(this,"isNodeInDocument",void 0),this.isNodeInDocument=t}return W0(e,[{key:"enter",value:function(r){var n=this,o=this.entered.length,a=function(s){return n.isNodeInDocument(s)&&(!s.contains||s.contains(r))};return this.entered=R0(this.entered.filter(a),[r]),o===0&&this.entered.length>0}},{key:"leave",value:function(r){var n=this.entered.length;return this.entered=H0(this.entered.filter(this.isNodeInDocument),r),n>0&&this.entered.length===0}},{key:"reset",value:function(){this.entered=[]}}]),e}(),Y0=Ef(function(){return/firefox/i.test(navigator.userAgent)}),Of=Ef(function(){return!!window.safari});function Z0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function X0(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function J0(e,t,r){return t&&X0(e.prototype,t),e}function Ao(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Af=function(){function e(t,r){Z0(this,e),Ao(this,"xs",void 0),Ao(this,"ys",void 0),Ao(this,"c1s",void 0),Ao(this,"c2s",void 0),Ao(this,"c3s",void 0);for(var n=t.length,o=[],a=0;a<n;a++)o.push(a);o.sort(function(x,$){return t[x]<t[$]?-1:1});for(var i=[],s=[],l,d,f=0;f<n-1;f++)l=t[f+1]-t[f],d=r[f+1]-r[f],i.push(l),s.push(d/l);for(var u=[s[0]],m=0;m<i.length-1;m++){var g=s[m],w=s[m+1];if(g*w<=0)u.push(0);else{l=i[m];var p=i[m+1],y=l+p;u.push(3*y/((y+p)/g+(y+l)/w))}}u.push(s[s.length-1]);for(var v=[],b=[],C,S=0;S<u.length-1;S++){C=s[S];var T=u[S],I=1/i[S],k=T+u[S+1]-C-C;v.push((C-T-k)*I),b.push(k*I*I)}this.xs=t,this.ys=r,this.c1s=u,this.c2s=v,this.c3s=b}return J0(e,[{key:"interpolate",value:function(r){var n=this.xs,o=this.ys,a=this.c1s,i=this.c2s,s=this.c3s,l=n.length-1;if(r===n[l])return o[l];for(var d=0,f=s.length-1,u;d<=f;){u=Math.floor(.5*(d+f));var m=n[u];if(m<r)d=u+1;else if(m>r)f=u-1;else return o[u]}l=Math.max(0,f);var g=r-n[l],w=g*g;return o[l]+a[l]*g+i[l]*w+s[l]*g*w}}]),e}(),eT=1;function Df(e){var t=e.nodeType===eT?e:e.parentElement;if(!t)return null;var r=t.getBoundingClientRect(),n=r.top,o=r.left;return{x:o,y:n}}function Ka(e){return{x:e.clientX,y:e.clientY}}function tT(e){var t;return e.nodeName==="IMG"&&(Y0()||!((t=document.documentElement)!==null&&t!==void 0&&t.contains(e)))}function rT(e,t,r,n){var o=e?t.width:r,a=e?t.height:n;return Of()&&e&&(a/=window.devicePixelRatio,o/=window.devicePixelRatio),{dragPreviewWidth:o,dragPreviewHeight:a}}function nT(e,t,r,n,o){var a=tT(t),i=a?e:t,s=Df(i),l={x:r.x-s.x,y:r.y-s.y},d=e.offsetWidth,f=e.offsetHeight,u=n.anchorX,m=n.anchorY,g=rT(a,t,d,f),w=g.dragPreviewWidth,p=g.dragPreviewHeight,y=function(){var k=new Af([0,.5,1],[l.y,l.y/f*p,l.y+p-f]),x=k.interpolate(m);return Of()&&a&&(x+=(window.devicePixelRatio-1)*p),x},v=function(){var k=new Af([0,.5,1],[l.x,l.x/d*w,l.x+w-d]);return k.interpolate(u)},b=o.offsetX,C=o.offsetY,S=b===0||b,T=C===0||C;return{x:S?b:v(),y:T?C:y()}}var Nf="__NATIVE_FILE__",kf="__NATIVE_URL__",xf="__NATIVE_TEXT__",Lf="__NATIVE_HTML__";const Pf=Object.freeze(Object.defineProperty({__proto__:null,FILE:Nf,HTML:Lf,TEXT:xf,URL:kf},Symbol.toStringTag,{value:"Module"}));function Ys(e,t,r){var n=t.reduce(function(o,a){return o||e.getData(a)},"");return n??r}var Mn;function Ya(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Zs=(Mn={},Ya(Mn,Nf,{exposeProperties:{files:function(t){return Array.prototype.slice.call(t.files)},items:function(t){return t.items},dataTransfer:function(t){return t}},matchesTypes:["Files"]}),Ya(Mn,Lf,{exposeProperties:{html:function(t,r){return Ys(t,r,"")},dataTransfer:function(t){return t}},matchesTypes:["Html","text/html"]}),Ya(Mn,kf,{exposeProperties:{urls:function(t,r){return Ys(t,r,"").split(`
505
+ `)},dataTransfer:function(t){return t}},matchesTypes:["Url","text/uri-list"]}),Ya(Mn,xf,{exposeProperties:{text:function(t,r){return Ys(t,r,"")},dataTransfer:function(t){return t}},matchesTypes:["Text","text/plain"]}),Mn);function oT(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function aT(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 iT(e,t,r){return t&&aT(e.prototype,t),e}function Ff(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var sT=function(){function e(t){oT(this,e),Ff(this,"item",void 0),Ff(this,"config",void 0),this.config=t,this.item={},this.initializeExposedProperties()}return iT(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 o={};Object.keys(this.config.exposeProperties).forEach(function(a){o[a]={value:n.config.exposeProperties[a](r,n.config.matchesTypes),configurable:!0,enumerable:!0}}),Object.defineProperties(this.item,o)}}},{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 lT(e,t){var r=new sT(Zs[e]);return r.loadDataTransfer(t),r}function Xs(e){if(!e)return null;var t=Array.prototype.slice.call(e.types||[]);return Object.keys(Zs).filter(function(r){var n=Zs[r].matchesTypes;return n.some(function(o){return t.indexOf(o)>-1})})[0]||null}function cT(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function dT(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 uT(e,t,r){return t&&dT(e.prototype,t),e}function Js(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var fT=function(){function e(t,r){cT(this,e),Js(this,"ownerDocument",null),Js(this,"globalContext",void 0),Js(this,"optionsArgs",void 0),this.globalContext=t,this.optionsArgs=r}return uT(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 Mf(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function $f(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Mf(Object(r),!0).forEach(function(n){be(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Mf(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function hT(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function pT(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 gT(e,t,r){return t&&pT(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 mT=function(){function e(t,r,n){var o=this;hT(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(a){var i=o.sourceNodes.get(a);return i&&Df(i)||null}),be(this,"endDragNativeItem",function(){o.isDraggingNativeItem()&&(o.actions.endDrag(),o.currentNativeHandle&&o.registry.removeSource(o.currentNativeHandle),o.currentNativeHandle=null,o.currentNativeSource=null)}),be(this,"isNodeInDocument",function(a){return!!(a&&o.document&&o.document.body&&o.document.body.contains(a))}),be(this,"endDragIfSourceWasRemovedFromDOM",function(){var a=o.currentDragSourceNode;a==null||o.isNodeInDocument(a)||o.clearCurrentDragSourceNode()&&o.monitor.isDragging()&&o.actions.endDrag()}),be(this,"handleTopDragStartCapture",function(){o.clearCurrentDragSourceNode(),o.dragStartSourceIds=[]}),be(this,"handleTopDragStart",function(a){if(!a.defaultPrevented){var i=o.dragStartSourceIds;o.dragStartSourceIds=null;var s=Ka(a);o.monitor.isDragging()&&o.actions.endDrag(),o.actions.beginDrag(i||[],{publishSource:!1,getSourceClientOffset:o.getSourceClientOffset,clientOffset:s});var l=a.dataTransfer,d=Xs(l);if(o.monitor.isDragging()){if(l&&typeof l.setDragImage=="function"){var f=o.monitor.getSourceId(),u=o.sourceNodes.get(f),m=o.sourcePreviewNodes.get(f)||u;if(m){var g=o.getCurrentSourcePreviewNodeOptions(),w=g.anchorX,p=g.anchorY,y=g.offsetX,v=g.offsetY,b={anchorX:w,anchorY:p},C={offsetX:y,offsetY:v},S=nT(u,m,s,b,C);l.setDragImage(m,S.x,S.y)}}try{l==null||l.setData("application/json",{})}catch{}o.setCurrentDragSourceNode(a.target);var T=o.getCurrentSourcePreviewNodeOptions(),I=T.captureDraggingState;I?o.actions.publishDragSource():setTimeout(function(){return o.actions.publishDragSource()},0)}else if(d)o.beginDragNativeItem(d);else{if(l&&!l.types&&(a.target&&!a.target.hasAttribute||!a.target.hasAttribute("draggable")))return;a.preventDefault()}}}),be(this,"handleTopDragEndCapture",function(){o.clearCurrentDragSourceNode()&&o.monitor.isDragging()&&o.actions.endDrag()}),be(this,"handleTopDragEnterCapture",function(a){o.dragEnterTargetIds=[];var i=o.enterLeaveCounter.enter(a.target);if(!(!i||o.monitor.isDragging())){var s=a.dataTransfer,l=Xs(s);l&&o.beginDragNativeItem(l,s)}}),be(this,"handleTopDragEnter",function(a){var i=o.dragEnterTargetIds;if(o.dragEnterTargetIds=[],!!o.monitor.isDragging()){o.altKeyPressed=a.altKey,i.length>0&&o.actions.hover(i,{clientOffset:Ka(a)});var s=i.some(function(l){return o.monitor.canDropOnTarget(l)});s&&(a.preventDefault(),a.dataTransfer&&(a.dataTransfer.dropEffect=o.getCurrentDropEffect()))}}),be(this,"handleTopDragOverCapture",function(){o.dragOverTargetIds=[]}),be(this,"handleTopDragOver",function(a){var i=o.dragOverTargetIds;if(o.dragOverTargetIds=[],!o.monitor.isDragging()){a.preventDefault(),a.dataTransfer&&(a.dataTransfer.dropEffect="none");return}o.altKeyPressed=a.altKey,o.lastClientOffset=Ka(a),o.hoverRafId===null&&typeof requestAnimationFrame<"u"&&(o.hoverRafId=requestAnimationFrame(function(){o.monitor.isDragging()&&o.actions.hover(i||[],{clientOffset:o.lastClientOffset}),o.hoverRafId=null}));var s=(i||[]).some(function(l){return o.monitor.canDropOnTarget(l)});s?(a.preventDefault(),a.dataTransfer&&(a.dataTransfer.dropEffect=o.getCurrentDropEffect())):o.isDraggingNativeItem()?a.preventDefault():(a.preventDefault(),a.dataTransfer&&(a.dataTransfer.dropEffect="none"))}),be(this,"handleTopDragLeaveCapture",function(a){o.isDraggingNativeItem()&&a.preventDefault();var i=o.enterLeaveCounter.leave(a.target);i&&o.isDraggingNativeItem()&&setTimeout(function(){return o.endDragNativeItem()},0)}),be(this,"handleTopDropCapture",function(a){if(o.dropTargetIds=[],o.isDraggingNativeItem()){var i;a.preventDefault(),(i=o.currentNativeSource)===null||i===void 0||i.loadDataTransfer(a.dataTransfer)}else Xs(a.dataTransfer)&&a.preventDefault();o.enterLeaveCounter.reset()}),be(this,"handleTopDrop",function(a){var i=o.dropTargetIds;o.dropTargetIds=[],o.actions.hover(i,{clientOffset:Ka(a)}),o.actions.drop({dropEffect:o.getCurrentDropEffect()}),o.isDraggingNativeItem()?o.endDragNativeItem():o.monitor.isDragging()&&o.actions.endDrag()}),be(this,"handleSelectStart",function(a){var i=a.target;typeof i.dragDrop=="function"&&(i.tagName==="INPUT"||i.tagName==="SELECT"||i.tagName==="TEXTAREA"||i.isContentEditable||(a.preventDefault(),i.dragDrop()))}),this.options=new fT(r,n),this.actions=t.getActions(),this.monitor=t.getMonitor(),this.registry=t.getRegistry(),this.enterLeaveCounter=new K0(this.isNodeInDocument)}return gT(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,o){var a=this;return this.sourcePreviewNodeOptions.set(r,o),this.sourcePreviewNodes.set(r,n),function(){a.sourcePreviewNodes.delete(r),a.sourcePreviewNodeOptions.delete(r)}}},{key:"connectDragSource",value:function(r,n,o){var a=this;this.sourceNodes.set(r,n),this.sourceNodeOptions.set(r,o);var i=function(d){return a.handleDragStart(d,r)},s=function(d){return a.handleSelectStart(d)};return n.setAttribute("draggable","true"),n.addEventListener("dragstart",i),n.addEventListener("selectstart",s),function(){a.sourceNodes.delete(r),a.sourceNodeOptions.delete(r),n.removeEventListener("dragstart",i),n.removeEventListener("selectstart",s),n.setAttribute("draggable","false")}}},{key:"connectDropTarget",value:function(r,n){var o=this,a=function(d){return o.handleDragEnter(d,r)},i=function(d){return o.handleDragOver(d,r)},s=function(d){return o.handleDrop(d,r)};return n.addEventListener("dragenter",a),n.addEventListener("dragover",i),n.addEventListener("drop",s),function(){n.removeEventListener("dragenter",a),n.removeEventListener("dragover",i),n.removeEventListener("drop",s)}}},{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 $f({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 $f({anchorX:.5,anchorY:.5,captureDraggingState:!1},n||{})}},{key:"isDraggingNativeItem",value:function(){var r=this.monitor.getItemType();return Object.keys(Pf).some(function(n){return Pf[n]===r})}},{key:"beginDragNativeItem",value:function(r,n){this.clearCurrentDragSourceNode(),this.currentNativeSource=lT(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 o=1e3;this.mouseMoveTimeoutTimer=setTimeout(function(){var a;return(a=n.rootElement)===null||a===void 0?void 0:a.addEventListener("mousemove",n.endDragIfSourceWasRemovedFromDOM,!0)},o)}},{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}(),Za;function yT(){return Za||(Za=new Image,Za.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="),Za}var vT=function(t,r,n){return new mT(t,r,n)};function bT(e,t){return typeof e=="function"?e(t):e??"NODE"}function wT(e){return e.isDraggable&&!e.isEditing}function CT(e){const t=Nt(),r=t.selectedIds,[n,o,a]=S0(()=>({canDrag:()=>wT(e),type:bT(t.props.dragType,e),item:()=>{const i=t.isSelected(e.id)?Array.from(r):[e.id];return t.dispatch(kn.dragStart(e.id,i)),{id:e.id,dragIds:i,data:e.data}},end:()=>{t.hideCursor(),t.redrawList(),t.dispatch(kn.dragEnd())}}),[r,e,t.props.dragType]);return h.useEffect(()=>{a(yT())},[a]),o}function ST(e,t){const r=e.getBoundingClientRect(),n=t.x-Math.round(r.x),o=t.y-Math.round(r.y),a=r.height,i=o<a/2,s=!i,l=a/4,d=o>l&&o<a-l;return{x:n,inTopHalf:i,inBottomHalf:s,inMiddle:d,atTop:!d&&i,atBottom:!d&&s}}function _T(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 Xa(e,t){return{parentId:e||null,index:t}}function $n(e,t){return{type:"line",index:e,level:t}}function TT(e){return{type:"highlight",id:e}}function el(e,t){var r;let n=e;for(;n.parent&&n.level>t;)n=n.parent;const o=((r=n.parent)===null||r===void 0?void 0:r.id)||null,a=vu(n)+1;return{parentId:o,index:a}}function Bf(e){var t;const r=ST(e.element,e.offset),n=e.indent,o=Math.round(Math.max(0,r.x-n)/n),{node:a,nextNode:i,prevNode:s}=e,[l,d]=_T(a,s,i,r);if(a&&a.isInternal&&r.inMiddle)return{drop:Xa(a.id,null),cursor:TT(a.id)};if(!l)return{drop:Xa((t=d==null?void 0:d.parent)===null||t===void 0?void 0:t.id,0),cursor:$n(0,0)};if(pu(l)){const f=Pa(o,(d==null?void 0:d.level)||0,l.level);return{drop:el(l,f),cursor:$n(l.rowIndex+1,f)}}if(gu(l)){const f=Pa(o,(d==null?void 0:d.level)||0,l.level);return{drop:el(l,f),cursor:$n(l.rowIndex+1,f)}}if(mu(l)){const f=Pa(o,0,l.level+1);return f>l.level?{drop:Xa(l.id,0),cursor:$n(l.rowIndex+1,f)}:{drop:el(l,f),cursor:$n(l.rowIndex+1,f)}}return{drop:Xa(l==null?void 0:l.id,0),cursor:$n(l.rowIndex+1,l.level+1)}}function ET(e,t){const r=Nt(),[n,o]=_f(()=>({accept:"NODE",canDrop:()=>r.canDrop(),hover:(a,i)=>{const s=i.getClientOffset();if(!e.current||!s)return;const{cursor:l,drop:d}=Bf({element:e.current,offset:s,indent:r.indent,node:t,prevNode:t.prev,nextNode:t.next});d&&r.dispatch(kn.hovering(d.parentId,d.index)),i.canDrop()?l&&r.showCursor(l):r.hideCursor()},drop:(a,i)=>{if(!i.canDrop())return null;r.drop()}}),[t,e.current,r.props]);return o}function IT(e){const t=Nt(),r=t.at(e);if(!r)throw new Error(`Could not find node for index: ${e}`);return h.useMemo(()=>{const n=r.clone();return t.visibleNodes[e]=n,n},[...Object.values(r.state),r])}const jf=h.memo(function({index:t,style:r}){hu(),Hw();const n=Nt(),o=IT(t),a=h.useRef(null),i=CT(o),s=ET(a,o),l=h.useCallback(p=>{a.current=p,s(p)},[s]),d=n.indent*o.level,f=h.useMemo(()=>({paddingLeft:d}),[d]),u=h.useMemo(()=>{var p,y;return Object.assign(Object.assign({},r),{top:parseFloat(r.top)+((y=(p=n.props.padding)!==null&&p!==void 0?p:n.props.paddingTop)!==null&&y!==void 0?y:0),minWidth:"max-content"})},[r,n.props.padding,n.props.paddingTop]),m={role:"treeitem","aria-level":o.level+1,"aria-selected":o.isSelected,"aria-expanded":o.isOpen,style:u,tabIndex:-1,className:n.props.rowClassName};h.useEffect(()=>{var p;!o.isEditing&&o.isFocused&&((p=a.current)===null||p===void 0||p.focus({preventScroll:!0}))},[o.isEditing,o.isFocused,a.current]);const g=n.renderNode,w=n.renderRow;return c.jsx(w,{node:o,innerRef:l,attrs:m,children:c.jsx(g,{node:o,tree:n,style:f,dragHandle:i})})});let tl="",qf=null;function Uf(){hu();const e=Nt();return c.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 o=Array.from(e.selectedIds);if(o.length>1){let a=e.mostRecentNode;for(;a&&a.isSelected;)a=a.nextSibling;a||(a=e.lastNode),e.focus(a,{scroll:!1}),e.delete(Array.from(o))}else{const a=e.focusedNode;if(a){const i=a.nextSibling,s=a.parent;e.focus(i||s,{scroll:!1}),e.delete(a)}}return}if(t.key==="Tab"&&!t.shiftKey){t.preventDefault(),bu(t.currentTarget);return}if(t.key==="Tab"&&t.shiftKey){t.preventDefault(),wu(t.currentTarget);return}if(t.key==="ArrowDown"){t.preventDefault();const o=e.nextNode;if(t.metaKey){e.select(e.focusedNode),e.activate(e.focusedNode);return}else if(!t.shiftKey||e.props.disableMultiSelection){e.focus(o);return}else{if(!o)return;const a=e.focusedNode;a?a.isSelected?e.selectContiguous(o):e.selectMulti(o):e.focus(e.firstNode);return}}if(t.key==="ArrowUp"){t.preventDefault();const o=e.prevNode;if(!t.shiftKey||e.props.disableMultiSelection){e.focus(o);return}else{if(!o)return;const a=e.focusedNode;a?a.isSelected?e.selectContiguous(o):e.selectMulti(o):e.focus(e.lastNode);return}}if(t.key==="ArrowRight"){const o=e.focusedNode;if(!o)return;o.isInternal&&o.isOpen?e.focus(e.nextNode):o.isInternal&&e.open(o.id);return}if(t.key==="ArrowLeft"){const o=e.focusedNode;if(!o||o.isRoot)return;o.isInternal&&o.isOpen?e.close(o.id):!((r=o.parent)===null||r===void 0)&&r.isRoot||e.focus(o.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 o=e.focusedNode;if(!o||!o.isEditable||!e.props.onRename)return;setTimeout(()=>{o&&e.edit(o)});return}if(t.key===" "){t.preventDefault();const o=e.focusedNode;if(!o)return;o.isLeaf?(o.select(),o.activate()):o.toggle();return}if(t.key==="*"){const o=e.focusedNode;if(!o)return;e.openSiblings(o);return}if(t.key==="PageUp"){t.preventDefault(),e.pageUp();return}t.key==="PageDown"&&(t.preventDefault(),e.pageDown()),clearTimeout(qf),tl+=t.key,qf=setTimeout(()=>{tl=""},600);const n=e.visibleNodes.find(o=>{const a=o.data.name;return typeof a=="string"?a.toLowerCase().startsWith(tl):!1});n&&e.focus(n.id)},children:c.jsx(OT,{})})}function OT(){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:o=>{var a;return((a=r.visibleNodes[o])===null||a===void 0?void 0:a.id)||o},outerElementType:(e=r.props.outerElementType)!==null&&e!==void 0?e:xC,innerElementType:(t=r.props.innerElementType)!==null&&t!==void 0?t:FC,onScroll:r.props.onScroll,onItemsRendered:r.onItemsRendered.bind(r)};return typeof r.props.rowHeight=="function"?c.jsx(AC,Object.assign({},n,{itemSize:r.rowHeightAt,ref:r.list,children:jf})):c.jsx(DC,Object.assign({},n,{itemSize:r.rowHeight,ref:r.list,children:jf}))}function zf(e){return e.isFiltered?DT(e.root,e.isMatch.bind(e)):AT(e.root)}function AT(e){const t=[];function r(n){var o;n.level>=0&&t.push(n),n.isOpen&&((o=n.children)===null||o===void 0||o.forEach(r))}return r(e),t.forEach(Vf),t}function DT(e,t){const r={},n=[];function o(i){if(!i.isRoot&&t(i)){r[i.id]=!0;let l=i.parent;for(;l;)r[l.id]=!0,l=l.parent}if(i.children)for(let l of i.children)o(l)}function a(i){var s;i.level>=0&&r[i.id]&&n.push(i),i.isOpen&&((s=i.children)===null||s===void 0||s.forEach(a))}return o(e),a(e),n.forEach(Vf),n}function Vf(e,t){e.rowIndex=t}const Hf=e=>e.reduce((t,r,n)=>(t[r.id]=n,t),{});var rl=function(e,t,r,n){function o(a){return a instanceof r?a:new r(function(i){i(a)})}return new(r||(r=Promise))(function(a,i){function s(f){try{d(n.next(f))}catch(u){i(u)}}function l(f){try{d(n.throw(f))}catch(u){i(u)}}function d(f){f.done?a(f.value):o(f.value).then(s,l)}d((n=n.apply(e,t||[])).next())})};const{safeRun:vt}=Kw;class Do{constructor(t,r,n,o){this.store=t,this.props=r,this.list=n,this.listEl=o,this.visibleStartIndex=0,this.visibleStopIndex=0,this.rowOffsets=null,this.rowHeightAt=a=>{const i=this.props.rowHeight;if(typeof i=="function"){const s=this.at(a);return s?i(s):this.rowHeight}return i??24},this.rowTopPosition=a=>{if(typeof this.props.rowHeight!="function")return a*this.rowHeight;const i=this.getRowOffsets(),s=Math.max(0,Math.min(a,i.length-1));return i[s]},this.redrawList=(a=0)=>{this.rowOffsets=null;const i=this.list.current;i&&"resetAfterIndex"in i&&i.resetAfterIndex(Math.max(0,a))},this.root=Eu(this),this.visibleNodes=zf(this),this.idToIndex=Hf(this.visibleNodes)}update(t){this.props=t,this.root=Eu(this),this.visibleNodes=zf(this),this.idToIndex=Hf(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,o)=>JSON.stringify(Object.values(n.data)).toLocaleLowerCase().includes(o.toLocaleLowerCase());return n=>r(n,this.searchTerm)}accessChildren(t){var r;const n=this.props.childrenAccessor||"children";return(r=To(t,n))!==null&&r!==void 0?r:null}accessId(t){const r=this.props.idAccessor||"id",n=To(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 Io)return t.id;const r=this.props.idAccessor||"id";return To(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 o=(n=this.indexOf(t))!==null&&n!==void 0?n:0,a=this.indexOf(r);if(a===null)return[];const i=Math.min(o,a),s=Math.max(o,a);return this.visibleNodes.slice(i,s+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 rl(this,arguments,void 0,function*(t={}){var r,n;const o=t.parentId===void 0?Tu(this):t.parentId,a=(r=t.index)!==null&&r!==void 0?r:_u(this),i=(n=t.type)!==null&&n!==void 0?n:"leaf",s=yield vt(this.props.onCreate,{type:i,parentId:o,index:a,parentNode:this.get(o)});s&&(this.focus(s),setTimeout(()=>{this.edit(s).then(()=>{this.select(s),this.activate(s)})}))})}delete(t){return rl(this,void 0,void 0,function*(){if(!t)return;const n=(Array.isArray(t)?t:[t]).map(i=>this.identify(i)),o=n.map(i=>this.get(i)).filter(i=>!!i),a=o.length?Math.min(...o.map(i=>{var s;return(s=i.rowIndex)!==null&&s!==void 0?s:0})):0;yield vt(this.props.onDelete,{nodes:o,ids:n}),this.redrawList(a)})}edit(t){var r,n;const o=this.identify(t);return this.resolveEdit({cancelled:!0}),this.scrollTo(o),this.dispatch(Ds(o)),this.redrawList((n=(r=this.get(o))===null||r===void 0?void 0:r.rowIndex)!==null&&n!==void 0?n:0),new Promise(a=>{Do.editPromise=a})}submit(t,r){return rl(this,void 0,void 0,function*(){var n,o;if(!t)return;const a=this.identify(t);yield vt(this.props.onRename,{id:a,name:r,node:this.get(a)}),this.dispatch(Ds(null)),this.resolveEdit({cancelled:!1,value:r}),this.redrawList((o=(n=this.get(a))===null||n===void 0?void 0:n.rowIndex)!==null&&o!==void 0?o:0),setTimeout(()=>this.onFocus())})}reset(){this.dispatch(Ds(null)),this.resolveEdit({cancelled:!0}),this.redrawList(),setTimeout(()=>this.onFocus())}activate(t){const r=this.get(this.identifyNull(t));r&&vt(this.props.onActivate,r)}resolveEdit(t){const r=Do.editPromise;r&&r(t),Do.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(Dn(this.identify(t))),r.scroll!==!1&&this.scrollTo(t),this.focusedNode&&vt(this.props.onFocus,this.focusedNode)))}pageUp(){var t,r;const n=this.visibleStartIndex,a=this.visibleStopIndex-n;let i=(r=(t=this.focusedNode)===null||t===void 0?void 0:t.rowIndex)!==null&&r!==void 0?r:0;i>n?i=n:i=Math.max(n-a,0),this.focus(this.at(i))}pageDown(){var t,r;const n=this.visibleStartIndex,o=this.visibleStopIndex,a=o-n;let i=(r=(t=this.focusedNode)===null||t===void 0?void 0:t.rowIndex)!==null&&r!==void 0?r:0;i<o?i=o:i=Math.min(i+a,this.visibleNodes.length-1),this.focus(this.at(i))}select(t,r={}){var n;if(!t)return;const o=r.focus!==!1,a=this.identify(t);o&&this.dispatch(Dn(a)),!((n=this.get(a))===null||n===void 0)&&n.isSelectable&&this.setSelection({ids:[a],anchor:a,mostRecent:a}),this.scrollTo(a,r.align),this.focusedNode&&o&&vt(this.props.onFocus,this.focusedNode)}deselect(t){if(!t)return;const r=this.identify(t);this.dispatch(Nr.remove(r)),vt(this.props.onSelect,this.selectedNodes)}selectMulti(t,r={}){const n=this.get(this.identifyNull(t));if(!n)return;const o=r.focus!==!1;o&&this.dispatch(Dn(n.id)),n.isSelectable&&(this.dispatch(Nr.add(n.id)),this.dispatch(Nr.anchor(n.id)),this.dispatch(Nr.mostRecent(n.id))),this.scrollTo(n,r.align),this.focusedNode&&o&&vt(this.props.onFocus,this.focusedNode),vt(this.props.onSelect,this.selectedNodes)}selectContiguous(t){var r;if(!t)return;const n=this.identify(t);if(this.dispatch(Dn(n)),!((r=this.get(n))===null||r===void 0)&&r.isSelectable){const{anchor:o,mostRecent:a}=this.state.nodes.selection,i=this.filterSelectableNodes(this.nodesBetween(o,this.identifyNull(n)));this.dispatch(Nr.remove(this.nodesBetween(o,a))),this.dispatch(Nr.add(i)),this.dispatch(Nr.mostRecent(n))}this.scrollTo(n),this.focusedNode&&vt(this.props.onFocus,this.focusedNode),vt(this.props.onSelect,this.selectedNodes)}deselectAll(){this.setSelection({ids:[],anchor:null,mostRecent:null})}selectAll(){var t,r,n;const o=this.filterSelectableNodes(Object.keys(this.idToIndex));this.setSelection({ids:o,anchor:(t=o[0])!==null&&t!==void 0?t:null,mostRecent:(r=o[o.length-1])!==null&&r!==void 0?r:null}),this.dispatch(Dn((n=this.lastNode)===null||n===void 0?void 0:n.id)),this.focusedNode&&vt(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(i=>this.identify(i))),o=this.identifyNull(t.anchor),a=this.identifyNull(t.mostRecent);this.dispatch(Nr.set({ids:n,anchor:o,mostRecent:a})),vt(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,o=this.props.disableDrop;for(const a of n)if(!a||!r||a.isInternal&&yu(r,a))return!1;return typeof o=="function"?!o({parentNode:r,dragNodes:this.dragNodes,index:this.state.dnd.index||0}):typeof o=="string"?!r.data[o]:typeof o=="boolean"?!o:!0}drop(){const{parentId:t,index:r,dragIds:n}=this.state.dnd;vt(this.props.onMove,{dragIds:n,parentId:t===Eo?null:t,index:r===null?0:r,dragNodes:this.dragNodes,parentNode:this.get(t)}),this.open(t)}hideCursor(){this.dispatch(kn.cursor({type:"none"}))}showCursor(t){this.dispatch(kn.cursor(t))}open(t,r=!0){var n,o;const a=this.identifyNull(t);a&&(this.isOpen(a)||(this.dispatch(Ns.open(a,this.isFiltered)),r&&this.redrawList((o=(n=this.get(a))===null||n===void 0?void 0:n.rowIndex)!==null&&o!==void 0?o:0),vt(this.props.onToggle,a)))}close(t,r=!0){var n,o;const a=this.identifyNull(t);a&&this.isOpen(a)&&(this.dispatch(Ns.close(a,this.isFiltered)),r&&this.redrawList((o=(n=this.get(a))===null||n===void 0?void 0:n.rowIndex)!==null&&o!==void 0?o:0),vt(this.props.onToggle,a))}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=As(this.root,r);let o=n==null?void 0:n.parent;for(;o;)this.open(o.id,!1),o=o.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 o of r.children)o.isInternal&&(n?this.close(o.id,!1):this.open(o.id,!1));this.redrawList(),this.scrollTo(this.focusedNode)}}openAll(){Fa(this.root,t=>{t.isInternal&&this.open(t.id,!1)}),this.redrawList()}closeAll(){Fa(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),Su(()=>n in this.idToIndex).then(()=>{var o;const a=this.idToIndex[n];a!==void 0&&((o=this.list.current)===null||o===void 0||o.scrollToItem(a,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,o;if(!t)return!1;if(t===Eo)return!0;const a=(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:(o=this.state.nodes.open.unfiltered[t])!==null&&o!==void 0?o:a}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!To(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:o}=this.state.nodes.drag;return r===n&&o===null}onFocus(){const t=this.focusedNode||this.firstNode;t&&this.dispatch(Dn(t.id))}onBlur(){this.dispatch(aC())}onItemsRendered(t){this.visibleStartIndex=t.visibleStartIndex,this.visibleStopIndex=t.visibleStopIndex}get renderContainer(){return this.props.renderContainer||Uf}get renderRow(){return this.props.renderRow||eC}get renderNode(){return this.props.children||tC}get renderDragPreview(){return this.props.renderDragPreview||Ou}get renderCursor(){return this.props.renderCursor||Jw}}function bt(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var NT=typeof Symbol=="function"&&Symbol.observable||"@@observable",Rf=NT,nl=()=>Math.random().toString(36).substring(7).split("").join("."),kT={INIT:`@@redux/INIT${nl()}`,REPLACE:`@@redux/REPLACE${nl()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${nl()}`},Xr=kT;function Qf(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 xT(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(FT(e))return"date";if(PT(e))return"error";const r=LT(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 LT(e){return typeof e.constructor=="function"?e.constructor.name:null}function PT(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function FT(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function kr(e){let t=typeof e;return process.env.NODE_ENV!=="production"&&(t=xT(e)),t}function Gf(e,t,r){if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?bt(2):`Expected the root reducer to be a function. Instead, received: '${kr(e)}'`);if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(process.env.NODE_ENV==="production"?bt(0):"It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.");if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(process.env.NODE_ENV==="production"?bt(1):`Expected the enhancer to be a function. Instead, received: '${kr(r)}'`);return r(Gf)(e,t)}let n=e,o=t,a=new Map,i=a,s=0,l=!1;function d(){i===a&&(i=new Map,a.forEach((y,v)=>{i.set(v,y)}))}function f(){if(l)throw new Error(process.env.NODE_ENV==="production"?bt(3):"You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return o}function u(y){if(typeof y!="function")throw new Error(process.env.NODE_ENV==="production"?bt(4):`Expected the listener to be a function. Instead, received: '${kr(y)}'`);if(l)throw new Error(process.env.NODE_ENV==="production"?bt(5):"You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api/store#subscribelistener for more details.");let v=!0;d();const b=s++;return i.set(b,y),function(){if(v){if(l)throw new Error(process.env.NODE_ENV==="production"?bt(6):"You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api/store#subscribelistener for more details.");v=!1,d(),i.delete(b),a=null}}}function m(y){if(!Qf(y))throw new Error(process.env.NODE_ENV==="production"?bt(7):`Actions must be plain objects. Instead, the actual type was: '${kr(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"?bt(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"?bt(17):`Action "type" property must be a string. Instead, the actual type was: '${kr(y.type)}'. Value was: '${y.type}' (stringified)`);if(l)throw new Error(process.env.NODE_ENV==="production"?bt(9):"Reducers may not dispatch actions.");try{l=!0,o=n(o,y)}finally{l=!1}return(a=i).forEach(b=>{b()}),y}function g(y){if(typeof y!="function")throw new Error(process.env.NODE_ENV==="production"?bt(10):`Expected the nextReducer to be a function. Instead, received: '${kr(y)}`);n=y,m({type:Xr.REPLACE})}function w(){const y=u;return{subscribe(v){if(typeof v!="object"||v===null)throw new Error(process.env.NODE_ENV==="production"?bt(11):`Expected the observer to be an object. Instead, received: '${kr(v)}'`);function b(){const S=v;S.next&&S.next(f())}return b(),{unsubscribe:y(b)}},[Rf](){return this}}}return m({type:Xr.INIT}),{dispatch:m,subscribe:u,getState:f,replaceReducer:g,[Rf]:w}}function Wf(e){typeof console<"u"&&typeof console.error=="function"&&console.error(e);try{throw new Error(e)}catch{}}function MT(e,t,r,n){const o=Object.keys(t),a=r&&r.type===Xr.INIT?"preloadedState argument passed to createStore":"previous state received by the reducer";if(o.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(!Qf(e))return`The ${a} has unexpected type of "${kr(e)}". Expected argument to be an object with the following keys: "${o.join('", "')}"`;const i=Object.keys(e).filter(s=>!t.hasOwnProperty(s)&&!n[s]);if(i.forEach(s=>{n[s]=!0}),!(r&&r.type===Xr.REPLACE)&&i.length>0)return`Unexpected ${i.length>1?"keys":"key"} "${i.join('", "')}" found in ${a}. Expected to find one of the known reducer keys instead: "${o.join('", "')}". Unexpected keys will be ignored.`}function $T(e){Object.keys(e).forEach(t=>{const r=e[t];if(typeof r(void 0,{type:Xr.INIT})>"u")throw new Error(process.env.NODE_ENV==="production"?bt(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:Xr.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(process.env.NODE_ENV==="production"?bt(13):`The slice reducer for key "${t}" returned undefined when probed with a random type. Don't try to handle '${Xr.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 Kf(e){const t=Object.keys(e),r={};for(let i=0;i<t.length;i++){const s=t[i];process.env.NODE_ENV!=="production"&&typeof e[s]>"u"&&Wf(`No reducer provided for key "${s}"`),typeof e[s]=="function"&&(r[s]=e[s])}const n=Object.keys(r);let o;process.env.NODE_ENV!=="production"&&(o={});let a;try{$T(r)}catch(i){a=i}return function(s={},l){if(a)throw a;if(process.env.NODE_ENV!=="production"){const u=MT(s,r,l,o);u&&Wf(u)}let d=!1;const f={};for(let u=0;u<n.length;u++){const m=n[u],g=r[m],w=s[m],p=g(w,l);if(typeof p>"u"){const y=l&&l.type;throw new Error(process.env.NODE_ENV==="production"?bt(14):`When called with an action of type ${y?`"${String(y)}"`:"(unknown type)"}, the slice reducer for key "${m}" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.`)}f[m]=p,d=d||p!==w}return d=d||n.length!==Object.keys(s).length,d?f:s}}function BT(e=Nn().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 jT=Kf({nodes:Kf({focus:iC,edit:oC,open:sC,selection:lC,drag:BT}),dnd:cC}),qT=Nn();function UT({treeProps:e,imperativeHandle:t,children:r}){const n=h.useRef(null),o=h.useRef(null),a=h.useRef(Gf(jT,Nn(e))),i=Vw.useSyncExternalStore(a.current.subscribe,a.current.getState,()=>qT),s=h.useMemo(()=>new Do(a.current,e,n,o),[]),l=h.useRef(0);return h.useMemo(()=>{l.current+=1,s.update(e)},Object.values(e)),h.useMemo(()=>{l.current+=1,s.update(s.props)},[i.nodes.open]),h.useImperativeHandle(t,()=>s),h.useEffect(()=>{s.props.selection?s.select(s.props.selection,{focus:!1}):s.deselectAll()},[s.props.selection]),h.useEffect(()=>{s.props.searchTerm||a.current.dispatch(Ns.clear(!0))},[s.props.searchTerm]),c.jsx(cu.Provider,{value:s,children:c.jsx(fu.Provider,{value:l.current,children:c.jsx(du.Provider,{value:i.nodes,children:c.jsx(uu.Provider,{value:i.dnd,children:c.jsx(v_,Object.assign({},e.dndManager?{manager:e.dndManager}:{backend:e.dndBackend||vT,options:{rootElement:s.props.dndRootElement||void 0}},{children:r}))})})})})}function zT(){const e=Nt(),[,t]=_f(()=>({accept:"NODE",canDrop:(r,n)=>n.isOver({shallow:!0})?e.canDrop():!1,hover:(r,n)=>{if(!n.isOver({shallow:!0}))return;const o=n.getClientOffset();if(!e.listEl.current||!o)return;const{cursor:a,drop:i}=Bf({element:e.listEl.current,offset:o,indent:e.indent,node:null,prevNode:e.visibleNodes[e.visibleNodes.length-1],nextNode:null});i&&e.dispatch(kn.hovering(i.parentId,i.index)),n.canDrop()?a&&e.showCursor(a):e.hideCursor()},drop:(r,n)=>{if(!n.isOver({shallow:!0})||!n.canDrop())return null;e.drop()}}),[e]);t(e.listEl)}function VT(e){return zT(),e.children}function HT(){const t=Nt().props.renderContainer||Uf;return c.jsx(c.Fragment,{children:c.jsx(t,{})})}function RT(){const e=Nt(),{offset:t,mouse:r,item:n,isDragging:o}=V0(i=>({offset:i.getSourceClientOffset(),mouse:i.getClientOffset(),item:i.getItem(),isDragging:i.isDragging()})),a=e.props.renderDragPreview||Ou;return c.jsx(a,{offset:t,mouse:r,id:(n==null?void 0:n.id)||null,dragIds:(n==null?void 0:n.dragIds)||[],isDragging:o})}function QT(e={}){var t,r;const n=(t=e.idAccessor)!==null&&t!==void 0?t:"id",o=(r=e.childrenAccessor)!==null&&r!==void 0?r:"children";return{getId:typeof n=="function"?n:a=>a[n],getChildren:typeof o=="function"?o:a=>a[o],childrenKey:typeof o=="string"?o:"children"}}class GT{constructor(t,r={}){this.accessors=QT(r),this.root=WT(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 o=this.find(t,n);if(o)return o}return null}return null}}function WT(e,t){const r=new Yf({},null,t,"ROOT");return r.children=e.map(n=>ol(n,r,t)),r}function ol(e,t,r){const n=new Yf(e,t,r),o=r.getChildren(e);return o&&(n.children=o.map(a=>ol(a,n,r))),n}class Yf{constructor(t,r,n,o){this.data=t,this.parent=r,this.accessors=n,this.id=o??n.getId(t)}hasParent(){return!!this.parent}get childIndex(){return this.hasParent()?this.parent.children.indexOf(this):-1}addChild(t,r){var n,o;const a=ol(t,this,this.accessors);this.children=(n=this.children)!==null&&n!==void 0?n:[],this.children.splice(r,0,a);const i=this.accessors.childrenKey,s=this.data;s[i]=(o=s[i])!==null&&o!==void 0?o:[],s[i].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 KT=0;function YT(e,t={}){const[r,n]=h.useState(e),o=t.idAccessor,a=t.childrenAccessor,i=h.useMemo(()=>new GT(r,{idAccessor:o,childrenAccessor:a}),[r,o,a]),s=w=>{for(const p of w.dragIds)i.move({id:p,parentId:w.parentId,index:w.index});n(i.data)},l=({name:w,id:p})=>{i.update({id:p,changes:{name:w}}),n(i.data)},d=typeof o=="string"?o:"id",f=typeof a=="string"?a:"children";return[r,{onMove:s,onRename:l,onCreate:({parentId:w,index:p,type:y})=>{if(typeof o=="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 a=="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-${KT++}`,name:""};return y==="internal"&&(v[f]=[]),i.create({parentId:w,index:p,data:v}),n(i.data),v},onDelete:w=>{w.ids.forEach(p=>i.drop({id:p})),n(i.data)}}]}function ZT(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.
506
+ Use the data prop if you want to provide your own handlers.`);if(e.initialData){const[t,r]=YT(e.initialData,{idAccessor:e.idAccessor,childrenAccessor:e.childrenAccessor});return Object.assign(Object.assign(Object.assign({},e),r),{data:t})}else return e}function XT(e,t){const r=ZT(e);return c.jsxs(UT,{treeProps:r,imperativeHandle:t,children:[c.jsx(VT,{children:c.jsx(HT,{})}),c.jsx(RT,{})]})}const JT=h.forwardRef(XT);function al(){return Ae(e=>{var n;const t=e.treeData[0];return(((n=t==null?void 0:t.metadata)==null?void 0:n.status)??(t==null?void 0:t.status)??"Draft").toLowerCase()==="draft"})}function e1(){return Ae(e=>{var o;if(!e.selectedNodeId)return!1;const t=(o=e.treeData[0])==null?void 0:o.id,r=a=>{var i;for(const s of a){if(s.id===e.selectedNodeId)return s;if((i=s.children)!=null&&i.length){const l=r(s.children);if(l)return l}}},n=r(e.treeData);return!!(n!=null&&n.isFolder)&&n.id!==t})}const Zf={video:"#EA580C",pdf:"#DC2626",h5p:"#0D9488",scorm:"#7C3AED",audio:"#DB2777",quiz:"#16A34A",default:"#6B7280"},Xf={video:"Video",pdf:"FileText",h5p:"Layers",scorm:"Package",audio:"Music",quiz:"HelpCircle",default:"File"},Jf=["Course Assessment","eTextbook","Exam Question","Explanation Content","Learning Resource","Practice Question Set","SCORM Content","Teacher Resource"],t1=[{label:"All",value:"all"},{label:"Course Assessment",value:"Course Assessment"},{label:"eTextbook",value:"eTextbook"},{label:"Exam Question",value:"Exam Question"},{label:"Explanation Content",value:"Explanation Content"},{label:"Learning Resource",value:"Learning Resource"},{label:"Practice Question Set",value:"Practice Question Set"},{label:"SCORM Content",value:"SCORM Content"},{label:"Teacher Resource",value:"Teacher Resource"}];function r1(e){const t=[e.mimeType??"",e.primaryCategory??"",e.contentType??""].join(" ").toLowerCase();return t.includes("video")?"video":t.includes("pdf")||t.includes("epub")?"pdf":t.includes("h5p")?"h5p":t.includes("scorm")?"scorm":t.includes("audio")||t.includes("mp3")?"audio":t.includes("quiz")||t.includes("question")||t.includes("ecml")?"quiz":"default"}function Ja(e){const t=r1(e);return{key:t,color:Zf[t]??Zf.default,bgClass:`sbx-ct-sq--${t}`,badgeClass:`sbx-ct-badge--${t}`,tintClass:`sbx-ct-tint--${t}`,iconName:Xf[t]??Xf.default,label:t.charAt(0).toUpperCase()+t.slice(1)}}const kt={row:"_row_i3qt2_1",grip:"_grip_i3qt2_16",menuBtn:"_menuBtn_i3qt2_19",selected:"_selected_i3qt2_23",title:"_title_i3qt2_28",dropTarget:"_dropTarget_i3qt2_33",toggle:"_toggle_i3qt2_50",ctIcon:"_ctIcon_i3qt2_65",folderIcon:"_folderIcon_i3qt2_77",renameInput:"_renameInput_i3qt2_92",dropHere:"_dropHere_i3qt2_101",menuWrap:"_menuWrap_i3qt2_111",menu:"_menu_i3qt2_19",dangerItem:"_dangerItem_i3qt2_163"},n1={video:Ji,pdf:ba,h5p:Gi,scorm:Ki,audio:Wi,quiz:Ri,default:Sn},o1=({node:e,style:t,dragHandle:r,editorMode:n})=>{const[o,a]=h.useState(!1),[i,s]=h.useState(!1),[l,d]=h.useState(e.data.name),f=h.useRef(null),u=le(),m=n==="edit",g=al(),w=Ja(e.data),p=n1[w.key]??Sn,y=e.isSelected,v=e.level===0,b=e.data.isFolder??(e.children&&e.children.length>0),C=v?Dy:b?Fy:p;h.useEffect(()=>{if(!o)return;const I=k=>{var x;(x=f.current)!=null&&x.contains(k.target)||a(!1)};return document.addEventListener("mousedown",I),()=>document.removeEventListener("mousedown",I)},[o]);const S=h.useCallback(()=>{l.trim()&&e.submit(l.trim()),s(!1)},[l,e]),T=h.useCallback(I=>{I.key==="Enter"&&S(),I.key==="Escape"&&(d(e.data.name),s(!1))},[S,e.data.name]);return c.jsxs("div",{className:[kt.row,y?kt.selected:"",e.state.isOver&&b?kt.dropTarget:""].filter(Boolean).join(" "),style:t,onClick:()=>e.select(),"data-node-id":e.data.id,"data-droppable":b?"true":void 0,role:"treeitem","aria-selected":y,"aria-expanded":b?!e.isClosed:void 0,children:[m&&c.jsx("span",{ref:r,className:kt.grip,"aria-hidden":"true",children:c.jsx(Xc,{size:14})}),c.jsx("button",{className:kt.toggle,onClick:I=>{I.stopPropagation(),e.toggle()},"aria-label":e.isClosed?u.treeNode.expandAriaLabel:u.treeNode.collapseAriaLabel,style:{visibility:b?"visible":"hidden"},children:e.isClosed?c.jsx(Wc,{size:14}):c.jsx(Cn,{size:14})}),c.jsx("span",{className:`${kt.ctIcon} ${v||b?kt.folderIcon:w.bgClass}`,"aria-hidden":"true",children:c.jsx(C,{size:12})}),i?c.jsx("input",{className:kt.renameInput,value:l,autoFocus:!0,onChange:I=>d(I.target.value),onBlur:S,onKeyDown:T,onClick:I=>I.stopPropagation()}):c.jsx("span",{className:kt.title,title:e.data.name,onDoubleClick:()=>m&&s(!0),children:e.data.name.length>25?`${e.data.name.slice(0,25)}...`:e.data.name}),e.state.isOver&&b&&c.jsx("span",{className:kt.dropHere,"aria-hidden":"true",children:u.treeNode.dropHereLabel}),m&&c.jsxs("div",{className:kt.menuWrap,ref:f,children:[c.jsx("button",{className:kt.menuBtn,onClick:I=>{I.stopPropagation(),a(k=>!k)},"aria-label":u.treeNode.nodeOptionsAriaLabel,children:c.jsx(Yc,{size:14})}),o&&c.jsxs("div",{className:kt.menu,role:"menu",children:[c.jsxs("button",{role:"menuitem",onClick:()=>{s(!0),a(!1)},children:[c.jsx(zy,{size:13})," ",u.treeNode.renameMenuItem]}),b&&g&&c.jsxs("button",{role:"menuitem",onClick:()=>{e.tree.create({parentId:e.id}),a(!1)},children:[c.jsx(Zc,{size:13})," ",u.treeNode.addSubunitMenuItem]}),e.data.parent&&g&&c.jsxs("button",{role:"menuitem",onClick:()=>{e.tree.create({parentId:e.data.parent}),a(!1)},children:[c.jsx(mo,{size:13})," ",u.treeNode.addSiblingMenuItem]}),c.jsxs("button",{role:"menuitem",className:kt.dangerItem,onClick:()=>{e.tree.delete(e.id),a(!1)},children:[c.jsx(Zi,{size:13})," ",u.treeNode.deleteMenuItem]})]})]})]})};async function a1(e,t){var a,i;const n=((a=(await ke.post(`/action/content/v3/upload/url/${e}?type=hierarchy`,{request:{content:{fileName:t}}})).data)==null?void 0:a.result)??{},o=((i=n.content)==null?void 0:i.preSignedURL)??n.pre_signed_url??n.preSignedUrl;if(!o)throw new Error("Could not obtain an upload URL");return o}async function i1(e,t){const r=await fetch(e,{method:"PUT",headers:{"x-ms-blob-type":"BlockBlob","Content-Type":"text/csv"},body:t});if(!r.ok)throw new Error(`Blob upload failed (${r.status})`);return e.split("?")[0]}async function s1(e,t){var s;const r=await a1(e,t.name),n=await i1(r,t),o=new FormData;return o.append("fileUrl",n),o.append("mimeType",t.type||"text/csv"),{processId:(((s=(await ke.post(`/action/collection/v1/import/${e}`,o)).data)==null?void 0:s.result)??{}).processId??""}}async function l1(e){var r;return((r=(await ke.get(`/action/collection/v1/import/status/${e}`)).data)==null?void 0:r.result)??{status:"PENDING"}}async function eh(e){var n,o,a;const r=(a=(o=(n=(await ke.get(`/action/collection/v1/export/${e}`)).data)==null?void 0:n.result)==null?void 0:o.collection)==null?void 0:a.tocUrl;if(!r)throw new Error("No export URL returned");return r}async function c1(e){return eh(e)}const Le={container:"_container_jr3ij_1",header:"_header_jr3ij_13",title:"_title_jr3ij_22",closeBtn:"_closeBtn_jr3ij_29",body:"_body_jr3ij_45",dropZone:"_dropZone_jr3ij_54",dragOver:"_dragOver_jr3ij_67",hasFile:"_hasFile_jr3ij_72",hiddenInput:"_hiddenInput_jr3ij_78",fileInfo:"_fileInfo_jr3ij_82",fileIcon:"_fileIcon_jr3ij_89",fileName:"_fileName_jr3ij_93",fileSize:"_fileSize_jr3ij_100",dropHint:"_dropHint_jr3ij_105",dropIcon:"_dropIcon_jr3ij_112",dropText:"_dropText_jr3ij_117",dropSubtext:"_dropSubtext_jr3ij_124",sampleLink:"_sampleLink_jr3ij_130",statusBar:"_statusBar_jr3ij_145",status_uploading:"_status_uploading_jr3ij_154",status_processing:"_status_processing_jr3ij_154",status_done:"_status_done_jr3ij_159",status_error:"_status_error_jr3ij_164",successDetail:"_successDetail_jr3ij_170",spinner:"_spinner_jr3ij_175",spin:"_spin_jr3ij_175",errorMsg:"_errorMsg_jr3ij_191",failedSection:"_failedSection_jr3ij_197",failedTitle:"_failedTitle_jr3ij_203",tableWrap:"_tableWrap_jr3ij_213",failedTable:"_failedTable_jr3ij_219",reasonCell:"_reasonCell_jr3ij_244",footer:"_footer_jr3ij_248"},d1=({contentId:e,onComplete:t,onClose:r,mode:n="create"})=>{const o=le(),[a,i]=h.useState(null),[s,l]=h.useState(!1),[d,f]=h.useState("idle"),[u,m]=h.useState(""),[g,w]=h.useState([]),[p,y]=h.useState(null),v=h.useRef(null),b=h.useRef(null),C=h.useCallback(()=>{b.current!==null&&(clearInterval(b.current),b.current=null)},[]);h.useEffect(()=>()=>C(),[C]);const S=N=>N.name.toLowerCase().endsWith(".csv")?N.size>50*1024*1024?(m(o.csvUpload.fileTooLarge),!1):!0:(m(o.csvUpload.invalidFileType),!1),T=h.useCallback(N=>{m(""),w([]),y(null),f("idle"),S(N)&&i(N)},[]),I=h.useCallback(N=>{N.preventDefault(),l(!1);const L=N.dataTransfer.files[0];L&&T(L)},[T]),k=h.useCallback(N=>{var B;const L=(B=N.target.files)==null?void 0:B[0];L&&T(L),N.target.value=""},[T]),x=h.useCallback(async()=>{try{const N=await c1(e),L=document.createElement("a");L.href=N,L.download="sample_hierarchy.csv",L.target="_blank",L.click()}catch{m(o.csvUpload.downloadSampleFailed)}},[e,o.csvUpload.downloadSampleFailed]),$=h.useCallback(async()=>{if(a){f("uploading"),m(""),w([]);try{const{processId:N}=await s1(e,a);if(!N){f("done"),y(null),setTimeout(t,1500);return}f("processing"),b.current=setInterval(async()=>{try{const L=await l1(N);L.status==="COMPLETED"?(C(),f("done"),y(L.successCount??null),L.failedRecords&&L.failedRecords.length>0?w(L.failedRecords):setTimeout(t,1500)):L.status==="FAILED"&&(C(),f("error"),m(o.csvUpload.processingFailed),L.failedRecords&&w(L.failedRecords))}catch{C(),f("error"),m(o.csvUpload.connectionLost)}},2e3)}catch{f("error"),m(o.csvUpload.uploadFailed)}}},[e,a,t,C,o.csvUpload.processingFailed,o.csvUpload.connectionLost,o.csvUpload.uploadFailed]),j={idle:"",uploading:o.csvUpload.statusUploading,processing:o.csvUpload.statusProcessing,done:o.csvUpload.statusDone,error:o.csvUpload.statusError};return c.jsxs("div",{className:Le.container,children:[c.jsxs("div",{className:Le.header,children:[c.jsx("h2",{className:Le.title,children:n==="update"?o.csvUpload.titleUpdate:o.csvUpload.titleCreate}),c.jsx("button",{className:Le.closeBtn,onClick:r,"aria-label":o.csvUpload.closeAriaLabel,children:c.jsx(yr,{size:18})})]}),c.jsxs("div",{className:Le.body,children:[c.jsxs("div",{className:`${Le.dropZone} ${s?Le.dragOver:""} ${a?Le.hasFile:""}`,onDragEnter:N=>{N.preventDefault(),l(!0)},onDragOver:N=>{N.preventDefault(),l(!0)},onDragLeave:N=>{N.preventDefault(),l(!1)},onDrop:I,onClick:()=>{var N;return(N=v.current)==null?void 0:N.click()},role:"button",tabIndex:0,"aria-label":o.csvUpload.dropZoneAriaLabel,onKeyDown:N=>{var L;return N.key==="Enter"&&((L=v.current)==null?void 0:L.click())},children:[c.jsx("input",{ref:v,type:"file",accept:".csv",className:Le.hiddenInput,onChange:k,"aria-hidden":"true"}),a?c.jsxs("div",{className:Le.fileInfo,children:[c.jsx(ba,{size:24,className:Le.fileIcon}),c.jsx("span",{className:Le.fileName,children:a.name}),c.jsxs("span",{className:Le.fileSize,children:["(",(a.size/1024).toFixed(1)," KB)"]})]}):c.jsxs("div",{className:Le.dropHint,children:[c.jsx(Xi,{size:32,className:Le.dropIcon}),c.jsx("p",{className:Le.dropText,children:o.csvUpload.dropText}),c.jsx("p",{className:Le.dropSubtext,children:o.csvUpload.dropSubtext})]})]}),c.jsx("button",{className:Le.sampleLink,onClick:x,type:"button",children:o.csvUpload.downloadSample}),d!=="idle"&&c.jsxs("div",{className:`${Le.statusBar} ${Le[`status_${d}`]}`,role:"status","aria-live":"polite",children:[d==="processing"&&c.jsx("span",{className:Le.spinner,"aria-hidden":"true"}),j[d],d==="done"&&p!==null&&c.jsx("span",{className:Le.successDetail,children:o.csvUpload.itemsImportedSuffix.replace("{count}",String(p))})]}),u&&c.jsx("p",{className:Le.errorMsg,role:"alert",children:u}),g.length>0&&c.jsxs("div",{className:Le.failedSection,children:[c.jsx("h4",{className:Le.failedTitle,children:o.csvUpload.failedRowsTitle.replace("{count}",String(g.length))}),c.jsx("div",{className:Le.tableWrap,children:c.jsxs("table",{className:Le.failedTable,children:[c.jsx("thead",{children:c.jsxs("tr",{children:[c.jsx("th",{children:o.csvUpload.rowHeader}),c.jsx("th",{children:o.csvUpload.nameHeader}),c.jsx("th",{children:o.csvUpload.reasonHeader})]})}),c.jsx("tbody",{children:g.map((N,L)=>c.jsxs("tr",{children:[c.jsx("td",{children:N.rowNumber??L+1}),c.jsx("td",{children:N.name??"—"}),c.jsx("td",{className:Le.reasonCell,children:N.reason??o.csvUpload.unknownError})]},L))})]})})]})]}),c.jsxs("div",{className:Le.footer,children:[c.jsx($e,{variant:"ghost",onClick:r,disabled:d==="uploading"||d==="processing",children:o.csvUpload.cancel}),c.jsx($e,{variant:"primary",isLoading:d==="uploading"||d==="processing",disabled:!a||d==="done",onClick:$,children:d==="done"?o.csvUpload.uploaded:o.csvUpload.upload})]})]})},sr={container:"_container_1y30m_1",header:"_header_1y30m_8",headerActions:"_headerActions_1y30m_19",iconBtn:"_iconBtn_1y30m_25",menuWrap:"_menuWrap_1y30m_43",dropdownMenu:"_dropdownMenu_1y30m_47",treeWrapper:"_treeWrapper_1y30m_79",csvModal:"_csvModal_1y30m_95",footer:"_footer_1y30m_105"},u1=({editorMode:e,collapsed:t=!1,onToggleCollapse:r})=>{var ue;const n=le(),o=h.useRef(null),a=h.useRef(null),i=h.useRef(null),[s,l]=h.useState(400),[d,f]=h.useState(!1),[u,m]=h.useState(!1),[g,w]=h.useState("create"),{treeData:p,selectedNodeId:y,selectNode:v,addNode:b,deleteNode:C,reorderChildren:S,moveNode:T,setTreeData:I}=Ae(),k=e==="edit",x=al(),$=k&&x,j=(((ue=p[0])==null?void 0:ue.children)??[]).some(Q=>Q.isFolder),N=ce(Q=>{var ne,te,U,H;return((te=(ne=Q.editorConfig)==null?void 0:ne.context)==null?void 0:te.contentId)??((H=(U=Q.editorConfig)==null?void 0:U.context)==null?void 0:H.identifier)??""}),L=ce(Q=>{var te,U;const ne=(U=(te=Q.categoryMeta)==null?void 0:te.sourcingSettings)==null?void 0:U.collection;return(ne==null?void 0:ne.enableBulkUpload)!==!1});h.useEffect(()=>{const Q=a.current;if(!Q)return;const ne=new ResizeObserver(()=>{l(Q.clientHeight||400)});return ne.observe(Q),l(Q.clientHeight||400),()=>ne.disconnect()},[]),h.useEffect(()=>{if(!d)return;const Q=ne=>{var te;(te=i.current)!=null&&te.contains(ne.target)||f(!1)};return document.addEventListener("mousedown",Q),()=>document.removeEventListener("mousedown",Q)},[d]);const B=h.useCallback(Q=>{Q.length>0&&v(Q[0].data.id)},[v]),P=h.useCallback(({parentId:Q,index:ne,dragIds:te})=>{if(!Q)return;const U=te[0],H=il(p,U);if(!H)return;const ae=H.parent;if(ae===Q){const fe=il(p,Q);if(!(fe!=null&&fe.children))return;const J=fe.children.findIndex(oe=>oe.id===U);if(J<0)return;S(Q,J,ne>J?ne-1:ne)}else T(U,ae??"",Q)},[p,S,T]),F=h.useCallback(({ids:Q})=>{Q.forEach(ne=>C(ne))},[C]),V=h.useCallback(({parentId:Q})=>{var U;const ne=Q??((U=p[0])==null?void 0:U.id)??"";if(!ne)return{id:crypto.randomUUID()};const te=b(ne,"unit");return te?{id:te}:(Ie.error(n.outlineTree.maxDepthReachedToast),{id:crypto.randomUUID()})},[b,p,n]),X=h.useCallback(()=>{var ne;const Q=(ne=p[0])==null?void 0:ne.id;Q&&(b(Q,"unit")||Ie.error(n.outlineTree.maxDepthReachedToast))},[p,b,n]),ve=h.useCallback(()=>{y&&(b(y,"subunit")||Ie.error(n.outlineTree.maxDepthReachedToast))},[y,b,n]),Ee=h.useCallback(async()=>{if(f(!1),!!N)try{const Q=await eh(N),ne=await fetch(Q).then(H=>H.blob()),te=URL.createObjectURL(ne),U=document.createElement("a");U.href=te,U.download=`${N}-folders.csv`,U.style.display="none",document.body.appendChild(U),U.click(),document.body.removeChild(U),URL.revokeObjectURL(te)}catch{Ie.error(n.outlineTree.downloadCsvFailedToast)}},[N,n]),Ce=h.useCallback(async()=>{if(m(!1),!!N)try{const{rootNode:Q}=await lu(N);I([Q]),Ie.success(n.outlineTree.outlineRefreshedToast)}catch{Ie.error(n.outlineTree.outlineRefreshFailedToast)}},[N,I,n]);return c.jsxs("div",{className:sr.container,children:[c.jsx("div",{className:sr.header,children:c.jsxs("div",{className:sr.headerActions,children:[k&&c.jsxs("div",{className:sr.menuWrap,ref:i,children:[c.jsx("button",{type:"button",className:sr.iconBtn,onClick:()=>f(Q=>!Q),"aria-label":n.outlineTree.moreOptionsAriaLabel,title:n.outlineTree.moreOptionsTitle,"aria-haspopup":"true","aria-expanded":d,children:c.jsx(Yc,{size:15})}),d&&c.jsx("div",{className:sr.dropdownMenu,role:"menu",children:L&&c.jsxs(c.Fragment,{children:[c.jsx("button",{role:"menuitem",type:"button",disabled:j,title:j?n.outlineTree.foldersExistTitle:void 0,onClick:()=>{f(!1),w("create"),m(!0)},children:n.outlineTree.createFoldersCsvButton}),c.jsx("button",{role:"menuitem",type:"button",disabled:!j,title:j?void 0:n.outlineTree.noFoldersYetTitle,onClick:Ee,children:n.outlineTree.downloadFoldersCsvButton}),c.jsx("button",{role:"menuitem",type:"button",disabled:!j,title:j?void 0:n.outlineTree.noFoldersYetTitle,onClick:()=>{f(!1),w("update"),m(!0)},children:n.outlineTree.updateFoldersCsvButton})]})})]}),r&&c.jsx("button",{type:"button",className:sr.iconBtn,onClick:r,"aria-label":t?n.outlineTree.expandOutlineAriaLabel:n.outlineTree.collapseOutlineAriaLabel,title:t?n.outlineTree.expandOutlineAriaLabel:n.outlineTree.collapseOutlineAriaLabel,children:t?c.jsx(qy,{size:15}):c.jsx(jy,{size:15})})]})}),c.jsx("div",{className:sr.treeWrapper,ref:a,children:c.jsx(JT,{ref:o,data:p,idAccessor:"id",childrenAccessor:"children",onSelect:B,onMove:k?P:void 0,onDelete:k?F:void 0,onCreate:k?V:void 0,disableEdit:!k,disableDrop:!k,selection:y??void 0,rowHeight:40,indent:20,paddingBottom:16,height:s,width:"100%",children:Q=>c.jsx(o1,{...Q,editorMode:e})})}),k&&c.jsxs("div",{className:sr.footer,children:[c.jsxs($e,{variant:"ghost",size:"sm",onClick:X,disabled:!$,children:[c.jsx(mo,{size:14})," ",n.outlineTree.addUnitButton]}),c.jsxs($e,{variant:"ghost",size:"sm",onClick:ve,disabled:!$||!y,children:[c.jsx(Zc,{size:14})," ",n.outlineTree.addSubunitButton]})]}),u&&c.jsx("div",{className:sr.csvModal,children:c.jsx(d1,{contentId:N,mode:g,onComplete:Ce,onClose:()=>m(!1)})})]})};function il(e,t){for(const r of e){if(r.id===t)return r;if(r.children){const n=il(r.children,t);if(n)return n}}}const No={breadcrumb:"_breadcrumb_zd1aj_1",crumb:"_crumb_zd1aj_10",sep:"_sep_zd1aj_26",current:"_current_zd1aj_31"},f1=({crumbs:e})=>{const t=Ae(n=>n.selectNode),r=le();return e.length?c.jsxs("nav",{className:No.breadcrumb,"aria-label":r.breadcrumb.nodePathAriaLabel,children:[c.jsx("button",{className:No.crumb,onClick:()=>t(e[0].id),"aria-label":r.breadcrumb.homeAriaLabel,children:c.jsx($y,{size:13})}),e.map((n,o)=>c.jsxs(h.Fragment,{children:[c.jsx(Wc,{size:13,className:No.sep}),o<e.length-1?c.jsx("button",{className:No.crumb,onClick:()=>t(n.id),children:n.name}):c.jsx("span",{className:No.current,children:n.name})]},n.id))]}):null},ko={tabBar:"_tabBar_qhks1_1",tab:"_tab_qhks1_1",active:"_active_qhks1_29",error:"_error_qhks1_35",errorDot:"_errorDot_qhks1_39"},h1=({activeTab:e,onChange:t,errorTabs:r=[],visibleTabs:n})=>{const o=le(),a=[{id:"details",label:o.tabBar.detailsTab},{id:"audience",label:o.tabBar.audienceCurriculumTab},{id:"licensing",label:o.tabBar.licensingTab}],i=n?a.filter(s=>n.includes(s.id)):a;return c.jsx("div",{className:ko.tabBar,role:"tablist","aria-label":o.tabBar.metadataSectionsAriaLabel,children:i.map(s=>c.jsxs("button",{role:"tab","aria-selected":e===s.id,"aria-controls":`panel-${s.id}`,className:[ko.tab,e===s.id?ko.active:"",r.includes(s.id)?ko.error:""].join(" "),onClick:()=>t(s.id),children:[s.label,r.includes(s.id)&&c.jsx("span",{className:ko.errorDot,"aria-label":o.tabBar.hasErrorsAriaLabel})]},s.id))})};var xo=e=>e.type==="checkbox",Jr=e=>e instanceof Date,ft=e=>e==null;const th=e=>typeof e=="object";var Qe=e=>!ft(e)&&!Array.isArray(e)&&th(e)&&!Jr(e),sl=e=>Qe(e)&&e.target?xo(e.target)?e.target.checked:e.target.value:e,rh=(e,t)=>t.split(".").some((r,n,o)=>!isNaN(Number(r))&&e.has(o.slice(0,n).join("."))),nh=e=>{const t=e.constructor&&e.constructor.prototype;return Qe(t)&&t.hasOwnProperty("isPrototypeOf")},ei=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(ei&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!r&&!(Qe(e)&&nh(e)))return e;const n=r?[]:Object.create(Object.getPrototypeOf(e));for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=Ze(e[o]));return n}const xr={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change",SUBMIT:"submit",TRIGGER:"trigger",VALID:"valid"},Jt={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},er={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},ll="form",oh="root",ah=["__proto__","constructor","prototype"];var Lo=e=>/^\w*$/.test(e),qe=e=>e===void 0,ti=e=>e.split(/[.[\]'"]/g).filter(Boolean),W=(e,t,r)=>{if(!t||!Qe(e))return r;const n=Lo(t)?[t]:ti(t);if(n.some(a=>ah.includes(a)))return r;const o=n.reduce((a,i)=>ft(a)?void 0:a[i],e);return qe(o)||o===e?qe(e[t])?r:e[t]:o},Mt=e=>typeof e=="boolean",wt=e=>typeof e=="function",Be=(e,t,r)=>{let n=-1;const o=Lo(t)?[t]:ti(t),a=o.length,i=a-1;for(;++n<a;){const s=o[n];let l=r;if(n!==i){const d=e[s];l=Qe(d)||Array.isArray(d)?d:isNaN(+o[n+1])?{}:[]}if(ah.includes(s))return;e[s]=l,e=e[s]}};const cl=h.createContext(null);cl.displayName="HookFormControlContext";const dl=()=>h.useContext(cl);var ih=(e,t,r,n=!0)=>{const o={};for(const a in e)Object.defineProperty(o,a,{get:()=>{const i=a;return t._proxyFormState[i]!==Jt.all&&(t._proxyFormState[i]=!n||Jt.all),r&&(r[i]=!0),e[i]}});return o};const ul=ei?h.useLayoutEffect:h.useEffect;function p1(e){const t=dl(),{control:r=t,disabled:n,name:o,exact:a}=e||{},[i,s]=h.useState(()=>({...r._formState,defaultValues:r._defaultValues})),l=h.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return ul(()=>r._subscribe({name:o,formState:l.current,exact:a,callback:d=>{!n&&s({...r._formState,...d,defaultValues:r._defaultValues})}}),[o,n,a]),h.useEffect(()=>{l.current.isValid&&r._setValid(!0)},[r]),h.useMemo(()=>ih(i,r,l.current,!1),[i,r])}var Ct=e=>typeof e=="string",fl=(e,t,r,n,o)=>Ct(e)?(n&&t.watch.add(e),W(r,e,o)):Array.isArray(e)?e.map(a=>(n&&t.watch.add(a),W(r,a))):(n&&(t.watchAll=!0),r),hl=e=>ft(e)||!th(e);const sh=(e,t)=>t.length===0&&!Array.isArray(e)&&!nh(e);function $t(e,t,r=new WeakMap){if(e===t)return!0;if(hl(e)||hl(t))return Object.is(e,t);if(Jr(e)&&Jr(t))return Object.is(e.getTime(),t.getTime());const n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;if(sh(e,n)||sh(t,o))return Object.is(e,t);const a=r.get(e);if(a&&a.has(t))return!0;a?a.add(t):r.set(e,new WeakSet([t]));for(const i of n){const s=e[i];if(!(i in t))return!1;if(i!=="ref"){const l=t[i];if(Jr(s)&&Jr(l)||(Qe(s)||Array.isArray(s))&&(Qe(l)||Array.isArray(l))?!$t(s,l,r):!Object.is(s,l))return!1}}return!0}function g1(e){const t=dl(),{control:r=t,name:n,defaultValue:o,disabled:a,exact:i,compute:s}=e||{},l=h.useRef(o),d=h.useRef(s),f=h.useRef(void 0),u=h.useRef(r),m=h.useRef(n);d.current=s;const[g,w]=h.useState(()=>{const S=r._getWatch(n,l.current);return d.current?d.current(S):S}),p=h.useCallback(S=>{const T=fl(n,r._names,S||r._formValues,!1,l.current);return d.current?d.current(T):T},[r._formValues,r._names,n]),y=h.useCallback(S=>{if(!a){const T=fl(n,r._names,S||r._formValues,!1,l.current);if(d.current){const I=d.current(T);$t(I,f.current)||(w(I),f.current=I)}else w(T)}},[r._formValues,r._names,a,n]);ul(()=>((u.current!==r||!$t(m.current,n))&&(u.current=r,m.current=n,y()),r._subscribe({name:n,formState:{values:!0},exact:i,callback:S=>{y(S.values)}})),[r,i,n,y]),h.useEffect(()=>r._removeUnmounted());const v=u.current!==r,b=m.current,C=h.useMemo(()=>{if(a)return null;const S=!v&&!$t(b,n);return v||S?p():null},[a,v,n,b,p]);return C!==null?C:g}function ri(e){const t=dl(),{name:r,disabled:n,control:o=t,shouldUnregister:a,defaultValue:i,exact:s=!0}=e,l=rh(o._names.array,r),d=h.useMemo(()=>W(o._formValues,r,W(o._defaultValues,r,i)),[o,r,i]),f=g1({control:o,name:r,defaultValue:d,exact:s}),u=p1({control:o,name:r,exact:s}),m=h.useRef(e),g=h.useRef(null),w=h.useRef(o.register(r,{...e.rules,value:f,...Mt(e.disabled)?{disabled:e.disabled}:{}}));m.current=e;const p=h.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!W(u.errors,r)},isDirty:{enumerable:!0,get:()=>!!W(u.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!W(u.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!W(u.validatingFields,r)},error:{enumerable:!0,get:()=>W(u.errors,r)}}),[u,r]),y=h.useCallback(S=>{const T=sl(S);return W(o._fields,r)||(w.current=o.register(r,{...m.current.rules,value:T})),w.current.onChange({target:{value:sl(S),name:r},type:xr.CHANGE})},[r,o]),v=h.useCallback(()=>w.current.onBlur({target:{value:W(o._formValues,r),name:r},type:xr.BLUR}),[r,o._formValues]),b=h.useCallback(S=>{S&&(g.current={focus:()=>wt(S.focus)&&S.focus(),select:()=>wt(S.select)&&S.select(),setCustomValidity:I=>wt(S.setCustomValidity)&&S.setCustomValidity(I),reportValidity:()=>wt(S.reportValidity)&&S.reportValidity()});const T=W(o._fields,r);T&&T._f&&S&&(T._f.ref=g.current)},[o._fields,r]),C=h.useMemo(()=>({name:r,value:f,...Mt(n)||u.disabled?{disabled:u.disabled||n}:{},onChange:y,onBlur:v,ref:b}),[r,n,u.disabled,y,v,b,f]);return h.useEffect(()=>{const S=o._options.shouldUnregister||a;o.register(r,{...m.current.rules,...Mt(m.current.disabled)?{disabled:m.current.disabled}:{}});const T=(I,k)=>{const x=W(o._fields,I);x&&x._f&&(x._f.mount=k)};if(T(r,!0),S){const I=Ze(W(a?o._defaultValues:o._options.values||o._defaultValues,r,W(o._options.defaultValues,r,m.current.defaultValue)));Be(o._defaultValues,r,I),qe(W(o._formValues,r))&&Be(o._formValues,r,I)}if(!l&&o.register(r),g.current){const I=W(o._fields,r);I&&I._f&&(I._f.ref=g.current)}return()=>{(l?S&&!o._state.action:S)?o.unregister(r):T(r,!1)}},[r,o,l,a]),h.useEffect(()=>{o._setDisabledField({disabled:n,name:r})},[n,r,o]),h.useMemo(()=>({field:C,formState:u,fieldState:p}),[C,u,p])}const pl=h.createContext(null);pl.displayName="HookFormContext";const tr=()=>h.useContext(pl),m1=({children:e,watch:t,getValues:r,getFieldState:n,setError:o,clearErrors:a,setValue:i,setValues:s,trigger:l,formState:d,resetField:f,reset:u,handleSubmit:m,unregister:g,control:w,register:p,setFocus:y,subscribe:v})=>{const b=h.useMemo(()=>({watch:t,getValues:r,getFieldState:n,setError:o,clearErrors:a,setValue:i,setValues:s,trigger:l,formState:d,resetField:f,reset:u,handleSubmit:m,unregister:g,control:w,register:p,setFocus:y,subscribe:v}),[a,w,d,n,r,m,p,u,f,o,y,i,s,v,l,g,t]);return h.createElement(pl.Provider,{value:b},h.createElement(cl.Provider,{value:b.control},e))};var y1=(e,t,r,n,o)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:o||!0}}:{},lh=e=>Array.isArray(e)?e.filter(Boolean):[],ni=e=>Array.isArray(e)?e:[e],ch=()=>{let e=[];return{get observers(){return e},next:o=>{for(const a of e)a.next&&a.next(o)},subscribe:o=>(e.push(o),{unsubscribe:()=>{e=e.filter(a=>a!==o)}}),unsubscribe:()=>{e=[]}}};function dh(e,t){const r={};for(const n in e)if(e.hasOwnProperty(n)){const o=e[n],a=t[n];if(o&&Qe(o)&&a){const i=dh(o,a);Qe(i)&&(r[n]=i)}else e[n]&&(r[n]=a)}return r}var at=e=>Qe(e)&&!Object.keys(e).length,gl=e=>e.type==="file",oi=e=>{if(!ei)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},uh=e=>e.type==="select-multiple",ml=e=>e.type==="radio",v1=e=>ml(e)||xo(e),yl=e=>oi(e)&&e.isConnected;function b1(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;){if(ft(e)){e=void 0;break}e=e[t[n]],n++}return e}function w1(e){for(const t in e)if(e.hasOwnProperty(t)&&!qe(e[t]))return!1;return!0}function tt(e,t){if(Ct(t)&&Object.prototype.hasOwnProperty.call(e,t))return delete e[t],e;const r=Array.isArray(t)?t:Lo(t)?[t]:ti(t),n=r.length===1?e:b1(e,r),o=r.length-1,a=r[o];return n&&delete n[a],o!==0&&(Qe(n)&&at(n)||Array.isArray(n)&&w1(n))&&tt(e,r.slice(0,-1)),e}var C1=e=>{for(const t in e)if(wt(e[t]))return!0;return!1};function fh(e){return Array.isArray(e)||Qe(e)&&!C1(e)}function vl(e,t={}){for(const r in e){const n=e[r];fh(n)?(t[r]=Array.isArray(n)?[]:{},vl(n,t[r])):qe(n)||(t[r]=!0)}return t}function bl(e){if(e!==!1){if(e===!0)return!0;if(Array.isArray(e)){const t=e.map(r=>bl(r));return t.some(r=>r!==void 0)?t:void 0}if(Qe(e)){const t={};for(const r in e){const n=bl(e[r]);qe(n)||(t[r]=n)}return Object.keys(t).length?t:void 0}}}function en(e,t,r){r||(r=vl(t));for(const n in e){const o=e[n];if(fh(o))qe(t)||hl(r[n])?r[n]=vl(o,Array.isArray(o)?[]:{}):en(o,ft(t)?{}:t[n],r[n]);else{const a=t[n];r[n]=!$t(o,a)}}return bl(r)||{}}const hh={value:!1,isValid:!1},ph={value:!0,isValid:!0};var gh=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&&!qe(e[0].attributes.value)?qe(e[0].value)||e[0].value===""?ph:{value:e[0].value,isValid:!0}:ph:hh}return hh},mh=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>qe(e)?e:t?e===""?NaN:e&&+e:r&&Ct(e)?new Date(e):n?n(e):e;const yh={isValid:!1,value:null};var vh=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,yh):yh;function bh(e){const t=e.ref;return gl(t)?t.files:ml(t)?vh(e.refs).value:uh(t)?[...t.selectedOptions].map(({value:r})=>r):xo(t)?gh(e.refs).value:mh(qe(t.value)?e.ref.value:t.value,e)}var S1=(e,t,r,n)=>{const o={};for(const a of e){const i=W(t,a);i&&Be(o,a,i._f)}return{criteriaMode:r,names:[...e],fields:o,shouldUseNativeValidation:n}},ai=e=>e instanceof RegExp,Po=e=>qe(e)?e:ai(e)?e.source:Qe(e)?ai(e.value)?e.value.source:e.value:e,wh=e=>({isOnSubmit:!e||e===Jt.onSubmit,isOnBlur:e===Jt.onBlur,isOnChange:e===Jt.onChange,isOnAll:e===Jt.all,isOnTouch:e===Jt.onTouched});const Ch="AsyncFunction";var _1=e=>!!e&&!!e.validate&&!!(wt(e.validate)&&e.validate.constructor.name===Ch||Qe(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===Ch)),T1=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),wl=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(`${n}.`)));const Fo=(e,t,r,n)=>{for(const o of r||Object.keys(e)){const a=W(e,o);if(a){const{_f:i,...s}=a;if(i){if(i.refs&&i.refs[0]&&t(i.refs[0],o)&&!n)return!0;if(i.ref&&t(i.ref,i.name)&&!n)return!0;if(Fo(s,t))break}else if(Qe(s)&&Fo(s,t))break}}};function Sh(e,t,r){const n=W(e,r);if(n||Lo(r))return{error:n,name:r};const o=r.split(".");for(;o.length;){const a=o.join("."),i=W(t,a),s=W(e,a);if(i&&!Array.isArray(i)&&r!==a)return{name:r};if(s&&s.type)return{name:a,error:s};if(s&&s.root&&s.root.type)return{name:`${a}.root`,error:s.root};o.pop()}return{name:r}}var E1=(e,t,r,n)=>{r(e);const{name:o,...a}=e;return at(a)||n&&Object.keys(a).length>=Object.keys(t).length||Object.keys(a).find(i=>t[i]===(!n||Jt.all))},I1=(e,t,r)=>!e||!t||e===t||ni(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n))),O1=(e,t,r,n,o)=>o.isOnAll?!1:!r&&o.isOnTouch?!(t||e):(r?n.isOnBlur:o.isOnBlur)?!e:(r?n.isOnChange:o.isOnChange)?e:!0,A1=(e,t)=>!lh(W(e,t)).length&&tt(e,t),_h=(e,t,r)=>{const n=W(e,r),o=Array.isArray(n)?n:[];return Be(o,oh,t[r]),Be(e,r,o),e};function Th(e,t,r="validate"){if(Ct(e)||Array.isArray(e)&&e.every(Ct)||Mt(e)&&!e)return{type:r,message:Ct(e)?e:"",ref:t}}var Bn=e=>Qe(e)&&!ai(e)?e:{value:e,message:""},Eh=async(e,t,r,n,o,a)=>{const{ref:i,refs:s,required:l,maxLength:d,minLength:f,min:u,max:m,pattern:g,validate:w,name:p,valueAsNumber:y,mount:v}=e._f,b=W(r,p);if(!v||t.has(p))return{};const C=s?s[0]:i,S=L=>{if(o&&C.reportValidity){const B=Mt(L)?"":L||"";s?s.forEach(P=>P.setCustomValidity(B)):C.setCustomValidity(B),C.reportValidity()}},T={},I=ml(i),k=xo(i),x=I||k,$=(y||gl(i))&&qe(i.value)&&qe(b)||oi(i)&&i.value===""||b===""||Array.isArray(b)&&!b.length,j=y1.bind(null,p,n,T),N=(L,B,P,F=er.maxLength,V=er.minLength)=>{const X=L?B:P;T[p]={type:L?F:V,message:X,ref:i,...j(L?F:V,X)}};if(a?!Array.isArray(b)||!b.length:l&&(!x&&($||ft(b))||Mt(b)&&!b||k&&!gh(s).isValid||I&&!vh(s).isValid)){const{value:L,message:B}=Ct(l)?{value:!!l,message:l}:Bn(l);if(L&&(T[p]={type:er.required,message:B,ref:C,...j(er.required,B)},!n))return S(B),T}if(!$&&(!ft(u)||!ft(m))){let L,B;const P=Bn(m),F=Bn(u);if(!ft(b)&&!isNaN(b)){const V=i.valueAsNumber||b&&+b;ft(P.value)||(L=V>P.value),ft(F.value)||(B=V<F.value)}else{const V=i.valueAsDate||new Date(b),X=Ce=>new Date(new Date().toDateString()+" "+Ce),ve=i.type=="time",Ee=i.type=="week";Ct(P.value)&&b&&(L=ve?X(b)>X(P.value):Ee?b>P.value:V>new Date(P.value)),Ct(F.value)&&b&&(B=ve?X(b)<X(F.value):Ee?b<F.value:V<new Date(F.value))}if((L||B)&&(N(!!L,P.message,F.message,er.max,er.min),!n))return S(T[p].message),T}if((d||f)&&!$&&(Ct(b)||a&&Array.isArray(b))){const L=Bn(d),B=Bn(f),P=!ft(L.value)&&b.length>+L.value,F=!ft(B.value)&&b.length<+B.value;if((P||F)&&(N(P,L.message,B.message),!n))return S(T[p].message),T}if(g&&!$&&Ct(b)){const{value:L,message:B}=Bn(g);if(ai(L)&&!b.match(L)&&(T[p]={type:er.pattern,message:B,ref:i,...j(er.pattern,B)},!n))return S(B),T}if(w){if(wt(w)){const L=await w(b,r),B=Th(L,C);if(B&&(T[p]={...B,...j(er.validate,B.message)},!n))return S(B.message),T}else if(Qe(w)){let L={};for(const B in w){if(!at(L)&&!n)break;const P=Th(await w[B](b,r),C,B);P&&(L={...P,...j(B,P.message)},S(P.message),n&&(T[p]=L))}if(!at(L)&&(T[p]={ref:C,...L},!n))return T}}return S(!0),T};const D1={mode:Jt.onSubmit,reValidateMode:Jt.onChange,shouldFocusError:!0},Ih={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function N1(e={}){let t={...D1,...e},r={...Ze(Ih),isLoading:wt(t.defaultValues),errors:t.errors||{},disabled:t.disabled||!1},n={},o=Qe(t.defaultValues)||Qe(t.values)?Ze(t.defaultValues||t.values)||{}:{},a=t.shouldUnregister?{}:Ze(o),i={action:!1,mount:!1,watch:!1,keepIsValid:!1},s={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set,registerName:new Set},l,d=0;const f={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},u={...f};let m={...u};const g={array:ch(),state:ch()},w=t.criteriaMode===Jt.all,p=_=>A=>{clearTimeout(d),d=setTimeout(_,A)},y=async _=>{if(!i.keepIsValid&&!t.disabled&&(u.isValid||m.isValid||_)){let A;t.resolver?(A=at((await j()).errors),v()):A=await B({fields:n,onlyCheckValid:!0,eventType:xr.VALID}),A!==r.isValid&&g.state.next({isValid:A})}},v=(_,A)=>{!t.disabled&&(u.isValidating||u.validatingFields||m.isValidating||m.validatingFields)&&((_||Array.from(s.mount)).forEach(D=>{D&&(A?Be(r.validatingFields,D,A):tt(r.validatingFields,D))}),g.state.next({validatingFields:r.validatingFields,isValidating:!at(r.validatingFields)}))},b=()=>{r.dirtyFields=en(o,a)},C=(_,A=[],D,z,q=!0,G=!0)=>{if(z&&D&&!t.disabled){if(i.action=!0,G&&Array.isArray(W(n,_))){const R=D(W(n,_),z.argA,z.argB);q&&Be(n,_,R)}if(G&&Array.isArray(W(r.errors,_))){const R=D(W(r.errors,_),z.argA,z.argB);q&&Be(r.errors,_,R),A1(r.errors,_)}if((u.touchedFields||m.touchedFields)&&G&&Array.isArray(W(r.touchedFields,_))){const R=D(W(r.touchedFields,_),z.argA,z.argB);q&&Be(r.touchedFields,_,R)}(u.dirtyFields||m.dirtyFields)&&b(),g.state.next({name:_,isDirty:F(_,A),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else Be(a,_,A)},S=(_,A)=>{Be(r.errors,_,A),r.errors={...r.errors},g.state.next({errors:r.errors})},T=_=>{r.errors=_,g.state.next({errors:r.errors,isValid:!1})},I=_=>{const A=Lo(_)?[_]:ti(_);let D=a,z=o;for(let q=0;q<A.length-1;q++){const G=A[q];if(D=ft(D)?D:D[G],z=ft(z)?z:z[G],D===null&&z!==null)return!0}return!1},k=(_,A,D,z)=>{const q=W(n,_);if(q){if(I(_))return;const G=qe(W(a,_)),R=W(a,_,qe(D)?W(o,_):D);qe(R)||z&&z.defaultChecked||A?Be(a,_,A?R:bh(q._f)):ve(_,R),i.mount&&!i.action&&(y(),G&&r.isDirty&&(u.isDirty||m.isDirty)&&(F()||(r.isDirty=!1,g.state.next({...r}))),e.shouldUnregister&&G&&!qe(W(a,_))&&wl(_,s)&&(i.watch=!0))}},x=(_,A,D,z,q)=>{let G=!1,R=!1;const ee={name:_};if(!t.disabled){if(!D||z){(u.isDirty||m.isDirty)&&(R=r.isDirty,r.isDirty=ee.isDirty=F(),G=R!==ee.isDirty);const ye=$t(W(o,_),A);R=!!W(r.dirtyFields,_),ye!==r.isDirty?r.dirtyFields=en(o,a):ye?tt(r.dirtyFields,_):Be(r.dirtyFields,_,!0),ee.dirtyFields=r.dirtyFields,G=G||(u.dirtyFields||m.dirtyFields)&&R!==!ye}if(D){const ye=W(r.touchedFields,_);ye||(Be(r.touchedFields,_,D),ee.touchedFields=r.touchedFields,G=G||(u.touchedFields||m.touchedFields)&&ye!==D)}G&&q&&g.state.next(ee)}return G?ee:{}},$=(_,A,D,z)=>{const q=W(r.errors,_),G=(u.isValid||m.isValid)&&Mt(A)&&r.isValid!==A;if(t.delayError&&D?(l=p(()=>S(_,D)),l(t.delayError)):(clearTimeout(d),l=null,D?Be(r.errors,_,D):tt(r.errors,_),r.errors={...r.errors}),(D?!$t(q,D):q)||!at(z)||G){const R={...z,...G&&Mt(A)?{isValid:A}:{},errors:r.errors,name:_};r={...r,...R},g.state.next(R)}},j=async _=>(v(_,!0),await t.resolver(a,t.context,S1(_||s.mount,n,t.criteriaMode,t.shouldUseNativeValidation))),N=async _=>{const{errors:A}=await j(_);if(v(_),_){for(const D of _){const z=W(A,D);z?s.array.has(D)&&Qe(z)&&!Object.keys(z).some(q=>!Number.isNaN(Number(q)))?_h(r.errors,{[D]:z},D):Be(r.errors,D,z):tt(r.errors,D)}r.errors={...r.errors}}else r.errors=A;return A},L=async({name:_,eventType:A})=>{if(e.validate){const D=await e.validate({formValues:a,formState:r,name:_,eventType:A});if(Qe(D))for(const z in D){const q=D[z];q&&J(`${ll}.${z}`,{message:Ct(q.message)?q.message:"",type:q.type||er.validate})}else Ct(D)||!D?J(ll,{message:D||"",type:er.validate}):fe(ll);return D}return!0},B=async({fields:_,onlyCheckValid:A,name:D,eventType:z,context:q={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(q.runRootValidation=!0,!await L({name:D,eventType:z})&&(q.valid=!1,A)))return q.valid;for(const G in _){const R=_[G];if(R){const{_f:ee,...ye}=R;if(ee){const Ye=s.array.has(ee.name),Lt=R._f&&_1(R._f),Pt=u.validatingFields||u.isValidating||m.validatingFields||m.isValidating;Lt&&Pt&&v([ee.name],!0);const Cr=await Eh(R,s.disabled,a,w,t.shouldUseNativeValidation&&!A,Ye);if(Lt&&Pt&&v([ee.name]),Cr[ee.name]&&(q.valid=!1,A)||(!A&&(W(Cr,ee.name)?Ye?_h(r.errors,Cr,ee.name):Be(r.errors,ee.name,Cr[ee.name]):tt(r.errors,ee.name)),e.shouldUseNativeValidation&&Cr[ee.name]))break}!at(ye)&&await B({context:q,onlyCheckValid:A,fields:ye,name:G,eventType:z})}}return q.valid},P=()=>{for(const _ of s.unMount){const A=W(n,_);A&&(A._f.refs?A._f.refs.every(D=>!yl(D)):!yl(A._f.ref))&&ze(_)}s.unMount=new Set},F=(_,A)=>!t.disabled&&(_&&A&&Be(a,_,A),!$t(H(),o)),V=(_,A,D)=>fl(_,s,{...i.mount?a:qe(A)?o:Ct(_)?{[_]:A}:A},D,A),X=_=>lh(W(i.mount?a:o,_,t.shouldUnregister?W(o,_,[]):[])),ve=(_,A,D={},z=!1)=>{const q=W(n,_);let G=A;if(q){const R=q._f;R&&(!R.disabled&&Be(a,_,mh(A,R)),G=oi(R.ref)&&ft(A)?"":A,uh(R.ref)?[...R.ref.options].forEach(ee=>ee.selected=G.includes(ee.value)):R.refs?xo(R.ref)?R.refs.forEach(ee=>{(!ee.defaultChecked||!ee.disabled)&&(Array.isArray(G)?ee.checked=!!G.find(ye=>ye===ee.value):ee.checked=G===ee.value||!!G)}):R.refs.forEach(ee=>ee.checked=ee.value===G):gl(R.ref)?R.ref.value="":(R.ref.value=G,R.ref.type||g.state.next({name:_,values:z?a:Ze(a)})))}(D.shouldDirty||D.shouldTouch)&&x(_,G,D.shouldTouch,D.shouldDirty,!0),D.shouldValidate&&U(_)},Ee=(_,A,D,z=!1)=>{for(const q in A){if(!A.hasOwnProperty(q))return;const G=A[q],R=_+"."+q,ee=W(n,R);(s.array.has(_)||Qe(G)||ee&&!ee._f)&&!Jr(G)?Ee(R,G,D,z):ve(R,G,D,z)}},Ce=(_,A,D,z)=>{const q=W(n,_),G=s.array.has(_),R=z?A:Ze(A),ee=W(a,_),ye=$t(ee,R);if(ye||Be(a,_,R),G)g.array.next({name:_,values:z?a:Ze(a)}),(u.isDirty||u.dirtyFields||m.isDirty||m.dirtyFields)&&D.shouldDirty&&(b(),g.state.next({name:_,dirtyFields:r.dirtyFields,isDirty:F(_,R)}));else{const Ye=Array.isArray(R)&&!R.length||at(R);!q||q._f||ft(R)||Ye?ve(_,R,D,z):Ee(_,R,D,z)}if(!ye){const Ye=wl(_,s),Lt=z?a:Ze(a);g.state.next({...Ye&&r,name:i.mount||Ye?_:void 0,values:Lt})}},ue=(_,A,D={})=>Ce(_,A,D,!1),Q=(_,A={})=>{const D=wt(_)?_(a):_;if(!$t(a,D)){a={...a,...D};for(const z of s.mount)Ce(z,W(D,z),A,!0);g.state.next({...r,name:void 0,type:void 0,values:a}),A.shouldValidate&&y()}},ne=async _=>{i.mount=!0;const A=_.target;let D=A.name,z=!0;const q=W(n,D),G=ye=>{z=Number.isNaN(ye)||Jr(ye)&&isNaN(ye.getTime())||$t(ye,W(a,D,ye))},R=wh(t.mode),ee=wh(t.reValidateMode);if(q){let ye,Ye;const Lt=A.type?bh(q._f):sl(_),Pt=_.type===xr.BLUR||_.type===xr.FOCUS_OUT,Cr=!T1(q._f)&&!e.validate&&!t.resolver&&!W(r.errors,D)&&!q._f.deps||O1(Pt,W(r.touchedFields,D),r.isSubmitted,ee,R),Qo=wl(D,s,Pt);Be(a,D,Lt),Pt?(!A||!A.readOnly)&&(q._f.onBlur&&q._f.onBlur(_),l&&l(0)):q._f.onChange&&q._f.onChange(_);const pn=x(D,Lt,Pt),ct=!at(pn)||Qo;if(!Pt&&g.state.next({name:D,type:_.type,values:Ze(a)}),Cr)return(u.isValid||m.isValid)&&(t.mode==="onBlur"?Pt&&y():Pt||y()),ct&&g.state.next({name:D,...Qo?{}:pn});if(!t.resolver&&e.validate&&await L({name:D,eventType:_.type}),!Pt&&Qo&&g.state.next({...r}),t.resolver){const{errors:_t}=await j([D]);if(v([D]),G(Lt),!z){!at(pn)&&g.state.next(pn);return}const Ot=Sh(r.errors,n,D),or=Sh(_t,n,Ot.name||D);ye=or.error,D=or.name,Ye=at(_t)}else v([D],!0),ye=(await Eh(q,s.disabled,a,w,t.shouldUseNativeValidation))[D],v([D]),G(Lt),z&&(ye?Ye=!1:(u.isValid||m.isValid)&&(Ye=await B({fields:n,onlyCheckValid:!0,name:D,eventType:_.type})));z&&(q._f.deps&&(!Array.isArray(q._f.deps)||q._f.deps.length>0)&&U(q._f.deps),$(D,Ye,ye,pn))}},te=(_,A)=>{if(W(r.errors,A)&&_.focus)return _.focus(),1},U=async(_,A={})=>{let D,z;const q=ni(_);if(t.resolver){const G=await N(qe(_)?_:q);D=at(G),z=_?!q.some(R=>W(G,R)):D}else _?(z=(await Promise.all(q.map(async G=>{const R=W(n,G);return await B({fields:R&&R._f?{[G]:R}:R,eventType:xr.TRIGGER})}))).every(Boolean),!(!z&&!r.isValid)&&y()):z=D=await B({fields:n,name:_,eventType:xr.TRIGGER});return g.state.next({...!Ct(_)||(u.isValid||m.isValid)&&D!==r.isValid?{}:{name:_},...t.resolver||!_?{isValid:D}:{},errors:r.errors}),A.shouldFocus&&!z&&Fo(n,te,_?q:s.mount),z},H=(_,A)=>{let D={...i.mount?a:o};return A&&(D=dh(A.dirtyFields?r.dirtyFields:r.touchedFields,D)),qe(_)?D:Ct(_)?W(D,_):_.map(z=>W(D,z))},ae=(_,A)=>({invalid:!!W((A||r).errors,_),isDirty:!!W((A||r).dirtyFields,_),error:W((A||r).errors,_),isValidating:!!W(r.validatingFields,_),isTouched:!!W((A||r).touchedFields,_)}),fe=_=>{const A=_?ni(_):void 0;A==null||A.forEach(D=>tt(r.errors,D)),A?A.forEach(D=>{g.state.next({name:D,errors:r.errors})}):g.state.next({errors:{}})},J=(_,A,D)=>{const z=(W(n,_,{_f:{}})._f||{}).ref,q=W(r.errors,_)||{},{ref:G,message:R,type:ee,...ye}=q;Be(r.errors,_,{...ye,...A,ref:z}),g.state.next({name:_,errors:r.errors,isValid:!1}),D&&D.shouldFocus&&z&&z.focus&&z.focus()},oe=(_,A)=>wt(_)?g.state.subscribe({next:D=>"values"in D&&_(D.values||V(void 0,A),D)}):V(_,A,!0),Me=_=>g.state.subscribe({next:A=>{if(I1(_.name,A.name,_.exact)&&E1(A,_.formState||u,K,_.reRenderRoot)){const D={...a};_.callback({values:D,...r,...A,defaultValues:o})}}}).unsubscribe,Oe=_=>(i.mount=!0,m={...m,..._.formState},Me({..._,formState:{...f,..._.formState}})),ze=(_,A={})=>{for(const D of _?ni(_):s.mount)s.mount.delete(D),s.array.delete(D),A.keepValue||(tt(n,D),tt(a,D)),!A.keepError&&tt(r.errors,D),!A.keepDirty&&tt(r.dirtyFields,D),!A.keepTouched&&tt(r.touchedFields,D),!A.keepIsValidating&&tt(r.validatingFields,D),!t.shouldUnregister&&!A.keepDefaultValue&&tt(o,D);g.state.next({values:Ze(a)}),g.state.next({...r,...A.keepDirty?{isDirty:F()}:{}}),!A.keepIsValid&&y()},We=({disabled:_,name:A})=>{if(Mt(_)&&i.mount||_||s.disabled.has(A)){const q=s.disabled.has(A)!==!!_;_?s.disabled.add(A):s.disabled.delete(A),q&&i.mount&&!i.action&&y()}},Ve=(_,A={})=>{let D=W(n,_);const z=Mt(A.disabled)||Mt(t.disabled),q=!s.registerName.has(_)&&D&&D._f&&!D._f.mount;return Be(n,_,{...D||{},_f:{...D&&D._f?D._f:{ref:{name:_}},name:_,mount:!0,...A}}),s.mount.add(_),D&&!q?We({disabled:Mt(A.disabled)?A.disabled:t.disabled,name:_}):k(_,!0,A.value),{...z?{disabled:A.disabled||t.disabled}:{},...t.progressive?{required:!!A.required,min:Po(A.min),max:Po(A.max),minLength:Po(A.minLength),maxLength:Po(A.maxLength),pattern:Po(A.pattern)}:{},name:_,onChange:ne,onBlur:ne,ref:G=>{if(G){s.registerName.add(_),Ve(_,A),s.registerName.delete(_),D=W(n,_);const R=qe(G.value)&&G.querySelectorAll&&G.querySelectorAll("input,select,textarea")[0]||G,ee=v1(R),ye=D._f.refs||[];if(ee?ye.find(Ye=>Ye===R):R===D._f.ref)return;Be(n,_,{_f:{...D._f,...ee?{refs:[...ye.filter(yl),R,...Array.isArray(W(o,_))?[{}]:[]],ref:{type:R.type,name:_}}:{ref:R}}}),k(_,!1,void 0,R)}else D=W(n,_,{}),D._f&&(D._f.mount=!1),(t.shouldUnregister||A.shouldUnregister)&&!(rh(s.array,_)&&i.action)&&s.unMount.add(_)}}},re=()=>t.shouldFocusError&&!t.shouldUseNativeValidation&&Fo(n,te,s.mount),Ke=_=>{Mt(_)&&(g.state.next({disabled:_}),Fo(n,(A,D)=>{const z=W(n,D);z&&(A.disabled=z._f.disabled||_,Array.isArray(z._f.refs)&&z._f.refs.forEach(q=>{q.disabled=z._f.disabled||_}))},0,!1))},Re=(_,A)=>async D=>{let z;D&&(D.preventDefault&&D.preventDefault(),D.persist&&D.persist());let q=Ze(a);if(g.state.next({isSubmitting:!0}),t.resolver){const{errors:G,values:R}=await j();v(),r.errors=G,q=Ze(R)}else await B({fields:n,eventType:xr.SUBMIT});if(s.disabled.size)for(const G of s.disabled)tt(q,G);if(tt(r.errors,oh),at(r.errors)){g.state.next({errors:{}});try{await _(q,D)}catch(G){z=G}}else A&&await A({...r.errors},D),re(),setTimeout(re);if(g.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:at(r.errors)&&!z,submitCount:r.submitCount+1,errors:r.errors}),z)throw z},He=(_,A={})=>{W(n,_)&&(qe(A.defaultValue)?ue(_,Ze(W(o,_))):(ue(_,A.defaultValue),Be(o,_,Ze(A.defaultValue))),A.keepTouched||tt(r.touchedFields,_),A.keepDirty||(tt(r.dirtyFields,_),r.isDirty=A.defaultValue?F(_,Ze(W(o,_))):F()),A.keepError||(tt(r.errors,_),u.isValid&&y()),g.state.next({...r}))},et=(_,A={})=>{const D=_?Ze(_):o,z=Ze(D),q=at(_),G=z;if(A.keepDefaultValues||(o=D),!A.keepValues){if(A.keepDirtyValues){const R=new Set([...s.mount,...Object.keys(en(o,a))]);for(const ee of Array.from(R)){const ye=W(r.dirtyFields,ee),Ye=W(a,ee),Lt=W(G,ee);ye&&!qe(Ye)?Be(G,ee,Ye):!ye&&!qe(Lt)&&ue(ee,Lt)}}else{if(ei&&qe(_))for(const R of s.mount){const ee=W(n,R);if(ee&&ee._f){const ye=Array.isArray(ee._f.refs)?ee._f.refs[0]:ee._f.ref;if(oi(ye)){const Ye=ye.closest("form");if(Ye){Ye.reset();break}}}}if(A.keepFieldsRef)for(const R of s.mount)ue(R,W(G,R));else n={}}if(t.shouldUnregister){if(a=A.keepDefaultValues?Ze(o):{},A.keepFieldsRef)for(const R of s.mount)Be(a,R,W(G,R))}else a=Ze(G);g.array.next({values:{...G}}),g.state.next({values:{...G}})}s={mount:A.keepDirtyValues?s.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!u.isValid||!!A.keepIsValid||!!A.keepDirtyValues||!t.shouldUnregister&&!at(G),i.watch=!!t.shouldUnregister,i.keepIsValid=!!A.keepIsValid,i.action=!1,A.keepErrors||(r.errors={}),g.state.next({submitCount:A.keepSubmitCount?r.submitCount:0,isDirty:q?!1:A.keepDirty?r.isDirty:A.keepValues?F():!!(A.keepDefaultValues&&!$t(_,o)),isSubmitted:A.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:q?{}:A.keepDirtyValues?A.keepDefaultValues&&a?en(o,a):r.dirtyFields:A.keepDefaultValues&&_?en(o,_):A.keepDirty?r.dirtyFields:{},touchedFields:A.keepTouched?r.touchedFields:{},errors:A.keepErrors?r.errors:{},isSubmitSuccessful:A.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:o})},Gt=(_,A)=>et(wt(_)?_(a):_,{...t.resetOptions,...A}),It=(_,A={})=>{const D=W(n,_),z=D&&D._f;if(z){const q=z.refs?z.refs[0]:z.ref;q.focus&&setTimeout(()=>{q.focus(),A.shouldSelect&&wt(q.select)&&q.select()})}},K=_=>{r={...r,..._}},Wt={control:{register:Ve,unregister:ze,getFieldState:ae,handleSubmit:Re,setError:J,_subscribe:Me,_runSchema:j,_updateIsValidating:v,_focusError:re,_getWatch:V,_getDirty:F,_setValid:y,_setFieldArray:C,_setDisabledField:We,_setErrors:T,_getFieldArray:X,_reset:et,_resetDefaultValues:()=>wt(t.defaultValues)&&t.defaultValues().then(_=>{Gt(_,t.resetOptions),g.state.next({isLoading:!1})}),_removeUnmounted:P,_disableForm:Ke,_subjects:g,_proxyFormState:u,get _fields(){return n},get _formValues(){return a},get _state(){return i},set _state(_){i=_},get _defaultValues(){return o},get _names(){return s},set _names(_){s=_},get _formState(){return r},get _options(){return t},set _options(_){t={...t,..._}}},subscribe:Oe,trigger:U,register:Ve,handleSubmit:Re,watch:oe,setValue:ue,setValues:Q,getValues:H,reset:Gt,resetField:He,resetDefaultValues:(_,A={})=>{if(o=Ze(_),!A.keepDirty){const D=en(o,a);r.dirtyFields=D,r.isDirty=!at(D)}A.keepIsValid||y(),g.state.next({...r,defaultValues:o})},clearErrors:fe,unregister:ze,setError:J,setFocus:It,getFieldState:ae};return{...Wt,formControl:Wt}}function k1(e={}){const t=h.useRef(void 0),r=h.useRef(void 0),n=h.useRef(e.formControl),[o,a]=h.useState(()=>({...Ze(Ih),isLoading:wt(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1,defaultValues:wt(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:o},e.defaultValues&&!wt(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:s,...l}=N1(e);t.current={...l,formState:o}}const i=t.current.control;return i._options=e,ul(()=>{const s=i._subscribe({formState:i._proxyFormState,callback:()=>a({...i._formState,defaultValues:i._defaultValues}),reRenderRoot:!0});return a(l=>({...l,isReady:!0})),i._formState.isReady=!0,s},[i]),h.useEffect(()=>i._disableForm(e.disabled),[i,e.disabled]),h.useEffect(()=>{e.mode&&(i._options.mode=e.mode),e.reValidateMode&&(i._options.reValidateMode=e.reValidateMode)},[i,e.mode,e.reValidateMode]),h.useEffect(()=>{e.errors&&(i._setErrors(e.errors),i._focusError())},[i,e.errors]),h.useEffect(()=>{e.shouldUnregister&&i._subjects.state.next({values:i._getWatch()})},[i,e.shouldUnregister]),h.useEffect(()=>{if(i._proxyFormState.isDirty){const s=i._getDirty();s!==o.isDirty&&i._subjects.state.next({isDirty:s})}},[i,o.isDirty]),h.useEffect(()=>{var s;e.values&&!$t(e.values,r.current)?(i._reset(e.values,{keepFieldsRef:!0,...i._options.resetOptions}),!((s=i._options.resetOptions)===null||s===void 0)&&s.keepIsValid||i._setValid(),r.current=e.values,a(l=>({...l}))):i._resetDefaultValues()},[i,e.values]),h.useEffect(()=>{i._state.mount||(i._setValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),t.current.formState=h.useMemo(()=>ih(o,i),[i,o]),t.current}async function Oh(e){var r,n;return(n=(r=(await ke.get(`/api/framework/v1/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.framework}async function x1(e){var r,n;return((n=(r=(await ke.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 Ah(e,t){const r=gn({queryKey:["framework",e],queryFn:()=>Oh(e),enabled:!!e,staleTime:3e5}),n=t==null?void 0:t[0],o=gn({queryKey:["framework",n],queryFn:()=>Oh(n),enabled:!!n,staleTime:5*60*1e3}),a=o.data?[o.data]:[];return{organisationFramework:r.data,targetFrameworks:a,isLoading:r.isLoading||o.isLoading}}function L1(e,t,r){const n=e??[],o=new Set(n.map(f=>f.type).filter(Boolean)),a=(t??[]).filter(f=>!o.has(f)),{data:i}=gn({queryKey:["framework-search",a.sort().join(","),r],queryFn:()=>x1({type:a,systemDefault:"Yes"}),enabled:a.length>0,staleTime:10*60*1e3}),s=t&&t.length?n.filter(f=>f.type&&t.includes(f.type)):n,l=[...(i??[]).map(f=>({label:f.name,value:f.identifier})),...s.map(f=>({label:f.name,value:f.identifier}))],d=new Set;return l.filter(f=>d.has(f.value)?!1:(d.add(f.value),!0))}async function P1(e){var r,n;return(n=(r=(await ke.get(`/api/channel/v1/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.channel}function F1(e){var r,n,o,a,i,s;const t=gn({queryKey:["channel",e],queryFn:()=>P1(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:(o=t.data)==null?void 0:o.frameworks,collectionAdditionalCategories:(a=t.data)==null?void 0:a.collectionAdditionalCategories,contentAdditionalCategories:(i=t.data)==null?void 0:i.contentAdditionalCategories,defaultLicense:(s=t.data)==null?void 0:s.defaultLicense,isLoading:t.isLoading}}function M1(e){const{data:t}=gn({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 $1={"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."}},B1=new Set(["review","read","sourcingreview","orgreview"]),ii={"First Section":"details","Second Section":"details","Third Section":"details","Organisation Framework Terms":"details","Target Framework Terms":"audience","Fourth Section":"licensing","Sixth Section":"licensing"},j1={Categorisation:"Second Section","Basic Information":"First Section","Licensing & Attribution":"Fourth Section",Curriculum:"Organisation Framework Terms","Target Audience":"Target Framework Terms"},q1={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"},Dh=new Set(["targetBoardIds","targetMediumIds","targetGradeLevelIds","targetSubjectIds"]);function Nh(e,t,r,n,o={}){if(!(e!=null&&e.length))return eE(t,n,r);const a=new Map;for(const s of e){const l=s.code;l&&!a.has(l)&&a.set(l,s)}const i=new Set;return e.filter(s=>{if(n&&(s.code==="dialCode"||s.code==="dialcode")||s.visible===!1)return!1;const l=s.code;return i.has(l)?!1:(i.add(l),!0)}).map(s=>{const l=s.code??"",d=G1(s),f=W1(s,r,t,a,o),u=t[l],m=z1(l,kh(u,d),d,t,o),g={code:l,label:s.label??l,inputType:d,required:!!(s.required===!0||Array.isArray(s.validations)&&s.validations.some(w=>w.type==="required")),editable:U1(l,s.editable!==!1,o),placeholder:s.placeholder,maxLength:s.maxLength,options:R1(f,m,d,r),depends:s.depends,tab:Q1(s),section:s.section,defaultValue:s.defaultValue??s.default,currentValue:m};if(l==="dialcodes"){const w=t.dialcodeRequired==="Yes";return{...g,required:w,visible:w}}return g})}function U1(e,t,r){var a;const n=r.editorMode??"edit";if(!B1.has(n))return t!==!1;const o=(a=r.editableFields)==null?void 0:a[n];return!!(o&&o.includes(e))}function z1(e,t,r,n,o){const a=t==null||t===""||Array.isArray(t)&&t.length===0;switch(e){case"license":return a?o.defaultLicense??"":t;case"copyright":return a&&o.channelName?o.channelName:t;case"copyrightYear":return a?String(new Date().getFullYear()):t;case"author":case"creator":return a&&o.userFullName?o.userFullName:t;case"instructions":{const i=n.instructions;return i&&typeof i=="object"&&!Array.isArray(i)?i.default??"":typeof t=="object"&&t!==null?"":t}case"maxTime":case"warningTime":{if(!a)return t;const i=n.timeLimits,s=i==null?void 0:i[e];return s!=null&&s!==""?V1(Number(s)):t}default:return t}}function V1(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),o=a=>String(a).padStart(2,"0");return n>0?`${o(n)}:${o(r)}:${o(t)}`:`${o(r)}:${o(t)}`}function H1(e){var n,o,a;const t=new Map,r=i=>i==null?void 0:i.forEach(s=>{s.identifier&&t.set(s.identifier,s.name),s.name&&t.set(s.name,s.name)});return(o=(n=e.organisationFramework)==null?void 0:n.categories)==null||o.forEach(i=>r(i.terms)),(a=e.targetFrameworks)==null||a.forEach(i=>{var s;return(s=i.categories)==null?void 0:s.forEach(l=>r(l.terms))}),t}function R1(e,t,r,n){if(r!=="select"&&r!=="multiselect"&&r!=="radio")return e;const o=Array.isArray(t)?t:t!=null&&t!==""?[t]:[];if(!o.length)return e;const a=e?[...e]:[],i=new Set(a.map(l=>l.value)),s=H1(n);for(const l of o){const d=String(l);i.has(d)||(a.push({label:s.get(d)??d,value:d}),i.add(d))}return a}function Q1(e){const t=e.section;if(t){if(ii[t])return ii[t];const n=j1[t];if(n&&ii[n])return ii[n]}const r=e.code??"";return q1[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 G1(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 W1(e,t,r,n,o){const a=e.code??"";if(a==="maxQuestions"){const d=o.childCount??0;if(d>0)return Array.from({length:d},(f,u)=>({label:String(u+1),value:String(u+1)}))}const i=e.range;if(Array.isArray(i)&&i.length)return typeof i[0]=="string"?i.map(d=>({label:d,value:d})):i.map(d=>({label:d.name,value:d.identifier}));const s=e.enum;if(s!=null&&s.length)return s.map(d=>({label:d,value:d}));if(a==="framework")return t.orgFrameworks;if(a==="additionalCategories"){const f=(o.objectType??"")==="QuestionSet"?o.contentAdditionalCategories??o.collectionAdditionalCategories:o.collectionAdditionalCategories??o.contentAdditionalCategories,u=(f&&f.length?f:o.contextAdditionalCategories)??t.channelAdditionalCategories;return u!=null&&u.length?X1(u).map(m=>({label:m,value:m})):void 0}const l=e.sourceCategory??Cl[a];if(l)return xh(a,l,e,t,r,n)}function K1(e,t){return Dh.has(e)||t.output==="identifier"||typeof t.section=="string"&&t.section.includes("Target")}function Y1(e,t){return Dh.has(e)||typeof t.section=="string"&&t.section.includes("Target")}function Sl(e,t,r){var a,i,s,l,d;const n=(i=(a=e.organisationFramework)==null?void 0:a.categories)==null?void 0:i.find(f=>f.code===t),o=(d=(l=(s=e.targetFrameworks)==null?void 0:s[0])==null?void 0:l.categories)==null?void 0:d.find(f=>f.code===t);return r?(o==null?void 0:o.terms)??(n==null?void 0:n.terms)??[]:(n==null?void 0:n.terms)??(o==null?void 0:o.terms)??[]}function Z1(e){const t=new Set,r=[];for(const n of e){const o=n.identifier??n.name;o&&!t.has(o)&&(t.add(o),r.push(n))}return r}function X1(e){return Array.from(new Set(e))}function J1(e){return Array.isArray(e)?e:e!=null&&e!==""?[e]:[]}function xh(e,t,r,n,o,a){const i=K1(e,r),s=Y1(e,r),l=p=>({label:p.name,value:i?p.identifier:p.name}),d=r.depends;if(!(d!=null&&d.length))return Sl(n,t,s).map(l);const f=d.flatMap(p=>J1(o[p])).map(String);if(!f.length)return[];const u=[];for(const p of d){const y=a.get(p),v=(y==null?void 0:y.sourceCategory)??Cl[p]??p;u.push(...Sl(n,v,s))}const g=u.filter(p=>f.includes(String(p.name))||f.includes(String(p.identifier))||f.includes(String(p.code))).flatMap(p=>p.associations??[]).filter(p=>String(p.category??"").toLowerCase()===t.toLowerCase()),w=Z1(g);return w.length?w.map(l):Sl(n,t,s).map(l)}function Mo(e,t){const r=Cl[e];if(r)return xh(e,r,{},t,{},new Map)}function ht(e,t,r){return kh(e[t],r)}function eE(e,t,r){var o;const n=[{code:"name",label:"Title",inputType:"text",required:!0,editable:!0,tab:"details",section:"First Section",maxLength:200,currentValue:ht(e,"name","text")},{code:"description",label:"Description",inputType:"textarea",editable:!0,tab:"details",section:"First Section",maxLength:2e3,currentValue:ht(e,"description","textarea")},{code:"keywords",label:"Keywords",inputType:"chips",editable:!0,tab:"details",section:"First Section",currentValue:ht(e,"keywords","chips")}];return t&&(n.push({code:"primaryCategory",label:"Category",inputType:"select",editable:!1,tab:"details",section:"Second Section",currentValue:ht(e,"primaryCategory","select")},{code:"additionalCategories",label:"Additional Category",inputType:"multiselect",editable:!0,tab:"details",section:"Second Section",currentValue:ht(e,"additionalCategories","multiselect"),options:(o=r.channelAdditionalCategories)==null?void 0:o.map(a=>({label:a,value:a}))},{code:"framework",label:"Course Type",inputType:"select",required:!0,editable:!0,tab:"details",section:"Organisation Framework Terms",options:r.orgFrameworks,currentValue:ht(e,"framework","select")},{code:"subjectIds",label:"Subjects covered",inputType:"multiselect",required:!0,editable:!0,tab:"details",section:"Organisation Framework Terms",options:Mo("subjectIds",r),currentValue:ht(e,"subjectIds","multiselect")}),n.push({code:"audience",label:"Audience Type",inputType:"multiselect",editable:!0,tab:"audience",section:"Target Framework Terms",currentValue:ht(e,"audience","multiselect")},{code:"targetBoardIds",label:"Board/Syllabus of the audience",inputType:"select",required:!0,editable:!0,tab:"audience",section:"Target Framework Terms",options:Mo("targetBoardIds",r),currentValue:ht(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:Mo("targetMediumIds",r),currentValue:ht(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:Mo("targetGradeLevelIds",r),currentValue:ht(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:Mo("targetSubjectIds",r),currentValue:ht(e,"targetSubjectIds","multiselect")}),n.push({code:"creator",label:"Author",inputType:"text",editable:!0,tab:"licensing",section:"Fourth Section",currentValue:ht(e,"creator","text")},{code:"attributions",label:"Attributions",inputType:"text",editable:!0,tab:"licensing",section:"Fourth Section",currentValue:ht(e,"attributions","text")},{code:"copyright",label:"Copyright",inputType:"text",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",currentValue:ht(e,"copyright","text")},{code:"copyrightYear",label:"Copyright Year",inputType:"text",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",currentValue:ht(e,"copyrightYear","text")},{code:"license",label:"License",inputType:"select",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",currentValue:ht(e,"license","select")})),n}const tE=["allowECM","levels","setPeriod","instances"];function Lh(e){const t={};return e.forEach((r,n)=>{t[`L${n+1}`]={label:r}}),t}function rE(e,t={}){const r={...e};for(const a of tE)delete r[a];const n=e.levels;Array.isArray(n)&&n.length&&(r.outcomeDeclaration={levels:Lh(n)});const o=e.instances;return o!=null&&o!==""&&(r.instances={label:o}),t.isReview&&(r.name===void 0||r.name===null||r.name==="")&&t.nodeTitle&&(r.name=t.nodeTitle),r}function nE(e,t){return e==="allowECM"||e==="setPeriod"?null:e==="levels"?{outcomeDeclaration:{levels:Array.isArray(t)?Lh(t):{}}}:e==="instances"?{instances:t!=null&&t!==""?{label:t}:""}:{[e]:t}}function oE(e,t){const{watch:r,setValue:n}=e,o=h.useRef(!1);h.useEffect(()=>{const a=r((i,{name:s})=>{var l;if(!(!s||o.current)){o.current=!0;try{const d=new Set([s]);let f=!0;for(;f;){f=!1;for(const u of t)d.has(u.code)||(l=u.depends)!=null&&l.some(m=>d.has(m))&&(n(u.code,u.inputType==="multiselect"||u.inputType==="chips"?[]:"",{shouldDirty:!0}),d.add(u.code),f=!0)}}finally{o.current=!1}}});return()=>a.unsubscribe()},[r,n,t])}const jn={section:"_section_ylgu8_1",header:"_header_ylgu8_11",title:"_title_ylgu8_17",description:"_description_ylgu8_24",divider:"_divider_ylgu8_30",fields:"_fields_ylgu8_36"},aE=({title:e,description:t,children:r})=>c.jsxs("div",{className:jn.section,children:[c.jsxs("div",{className:jn.header,children:[c.jsx("h3",{className:jn.title,children:e}),t&&c.jsx("p",{className:jn.description,children:t})]}),c.jsx("hr",{className:jn.divider}),c.jsx("div",{className:jn.fields,children:r})]}),M={field:"_field_1s288_1",fullWidth:"_fullWidth_1s288_7",label:"_label_1s288_11",required:"_required_1s288_19",input:"_input_1s288_24",textarea:"_textarea_1s288_45",inputError:"_inputError_1s288_50",error:"_error_1s288_54",selectBtn:"_selectBtn_1s288_59",selectOpen:"_selectOpen_1s288_83",placeholder:"_placeholder_1s288_87",selectedVal:"_selectedVal_1s288_91",chevronUp:"_chevronUp_1s288_95",dropdown:"_dropdown_1s288_100",option:"_option_1s288_116",optionSelected:"_optionSelected_1s288_134",noOpts:"_noOpts_1s288_139",chipGroup:"_chipGroup_1s288_146",chipInput:"_chipInput_1s288_158",addChipBtn:"_addChipBtn_1s288_167",radioGroup:"_radioGroup_1s288_184",radioLabel:"_radioLabel_1s288_191",iconWrap:"_iconWrap_1s288_199",iconPreview:"_iconPreview_1s288_214",iconPlaceholder:"_iconPlaceholder_1s288_220",removeIconBtn:"_removeIconBtn_1s288_233",tagChip:"_tagChip_1s288_252",tagChipRemove:"_tagChipRemove_1s288_264",nestedSelectRow:"_nestedSelectRow_1s288_278",dialcodeRow:"_dialcodeRow_1s288_287",validateBtn:"_validateBtn_1s288_293",dialcodeValid:"_dialcodeValid_1s288_315",dialcodeSpinner:"_dialcodeSpinner_1s288_325"},Ph=({name:e,label:t,required:r,disabled:n,multiline:o,maxLength:a,placeholder:i})=>{const s=le(),{register:l,formState:{errors:d}}=tr(),f=d[e],u={required:r?s.textField.requiredError.replace("{field}",t):!1,maxLength:a?{value:a,message:s.textField.maxLengthError.replace("{max}",String(a))}:void 0};return c.jsxs("div",{className:[M.field,o?M.fullWidth:""].join(" "),children:[c.jsxs("label",{className:M.label,htmlFor:e,children:[t,r&&c.jsx("span",{className:M.required,children:"*"})]}),o?c.jsx("textarea",{id:e,className:[M.input,M.textarea,f?M.inputError:""].join(" "),disabled:n,placeholder:i,rows:3,...l(e,u)}):c.jsx("input",{id:e,type:"text",className:[M.input,f?M.inputError:""].join(" "),disabled:n,placeholder:i,...l(e,u)}),f&&c.jsx("span",{className:M.error,children:String(f.message)})]})},iE=({name:e,label:t,options:r,required:n,disabled:o})=>{var y;const a=le(),[i,s]=h.useState(!1),l=h.useRef(null),{register:d,watch:f,setValue:u,formState:{errors:m}}=tr(),g=f(e),w=((y=r.find(v=>v.value===g))==null?void 0:y.label)??a.selectField.selectPlaceholder,p=m[e];return h.useEffect(()=>{if(!i)return;const v=b=>{var C;(C=l.current)!=null&&C.contains(b.target)||s(!1)};return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[i]),c.jsxs("div",{className:M.field,ref:l,style:{position:"relative"},children:[c.jsxs("label",{className:M.label,children:[t,n&&c.jsx("span",{className:M.required,children:"*"})]}),c.jsx("input",{type:"hidden",...d(e,{required:n?a.selectField.requiredError.replace("{field}",t):!1})}),c.jsxs("button",{type:"button",disabled:o,className:[M.selectBtn,p?M.inputError:"",i?M.selectOpen:""].join(" "),onClick:()=>s(v=>!v),children:[c.jsx("span",{className:g?M.selectedVal:M.placeholder,children:w}),c.jsx(Cn,{size:14,className:i?M.chevronUp:""})]}),i&&c.jsxs("div",{className:M.dropdown,children:[r.map(v=>c.jsxs("button",{type:"button",className:[M.option,g===v.value?M.optionSelected:""].join(" "),onClick:()=>{u(e,v.value,{shouldDirty:!0,shouldValidate:!0}),s(!1)},children:[c.jsx("span",{children:v.label}),g===v.value&&c.jsx(wn,{size:13})]},v.value)),!r.length&&c.jsx("span",{className:M.noOpts,children:a.selectField.noOptionsMessage})]}),p&&c.jsx("span",{className:M.error,children:String(p.message)})]})},sE=({name:e,label:t,options:r,required:n,disabled:o})=>{const a=le(),[i,s]=h.useState(!1),l=h.useRef(null),{register:d,watch:f,setValue:u,formState:{errors:m}}=tr(),g=f(e)??[],w=m[e],p=g.length?`${g.length} ${a.multiSelectField.selectedCountSuffix}`:a.multiSelectField.selectPlaceholder;h.useEffect(()=>{if(!i)return;const v=b=>{var C;(C=l.current)!=null&&C.contains(b.target)||s(!1)};return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[i]);const y=v=>{const b=g.includes(v)?g.filter(C=>C!==v):[...g,v];u(e,b,{shouldDirty:!0,shouldValidate:!0})};return c.jsxs("div",{className:M.field,ref:l,style:{position:"relative"},children:[c.jsxs("label",{className:M.label,children:[t,n&&c.jsx("span",{className:M.required,children:"*"})]}),c.jsx("input",{type:"hidden",...d(e,{required:n?a.multiSelectField.requiredError.replace("{field}",t):!1})}),c.jsxs("button",{type:"button",disabled:o,className:[M.selectBtn,w?M.inputError:"",i?M.selectOpen:""].join(" "),onClick:()=>s(v=>!v),children:[c.jsx("span",{className:g.length?M.selectedVal:M.placeholder,children:p}),c.jsx(Cn,{size:14,className:i?M.chevronUp:""})]}),i&&c.jsxs("div",{className:M.dropdown,children:[r.map(v=>c.jsxs("button",{type:"button",className:[M.option,g.includes(v.value)?M.optionSelected:""].join(" "),onClick:()=>y(v.value),children:[c.jsx(wn,{size:13,style:{opacity:g.includes(v.value)?1:0}}),c.jsx("span",{children:v.label})]},v.value)),!r.length&&c.jsx("span",{className:M.noOpts,children:a.multiSelectField.noOptionsMessage})]}),w&&c.jsx("span",{className:M.error,children:String(w.message)})]})},lE=({name:e,label:t,required:r,disabled:n,placeholder:o})=>{const a=le(),i=o??a.chipGroupField.addPlaceholder,[s,l]=h.useState(""),[d,f]=h.useState(!1),u=h.useRef(null),{watch:m,setValue:g,formState:{errors:w}}=tr(),p=m(e)??[],y=w[e],v=()=>{const C=s.trim();C&&!p.includes(C)&&g(e,[...p,C],{shouldDirty:!0}),l(""),f(!1)},b=C=>g(e,p.filter(S=>S!==C),{shouldDirty:!0});return c.jsxs("div",{className:[M.field,M.fullWidth].join(" "),children:[c.jsxs("label",{className:M.label,children:[t,r&&c.jsx("span",{className:M.required,children:"*"})]}),c.jsxs("div",{className:M.chipGroup,children:[p.map(C=>c.jsxs("span",{className:"sbx-chip filled",children:[C,!n&&c.jsx("button",{type:"button",className:"sbx-chip-remove",onClick:()=>b(C),"aria-label":`Remove ${C}`,children:"×"})]},C)),!n&&(d?c.jsx("input",{ref:u,autoFocus:!0,className:M.chipInput,value:s,onChange:C=>l(C.target.value),onKeyDown:C=>{C.key==="Enter"&&(C.preventDefault(),v()),C.key==="Escape"&&(l(""),f(!1))},onBlur:v,placeholder:i}):c.jsxs("button",{type:"button",className:M.addChipBtn,onClick:()=>{f(!0),setTimeout(()=>{var C;return(C=u.current)==null?void 0:C.focus()},50)},children:[c.jsx(mo,{size:12})," ",a.chipGroupField.addButtonLabel]}))]}),y&&c.jsx("span",{className:M.error,children:String(y.message)})]})},cE=({name:e,label:t,options:r,required:n,disabled:o})=>{const a=le(),{register:i,formState:{errors:s}}=tr(),l=s[e];return c.jsxs("div",{className:M.field,children:[c.jsxs("label",{className:M.label,children:[t,n&&c.jsx("span",{className:M.required,children:"*"})]}),c.jsx("div",{className:M.radioGroup,children:r.map(d=>c.jsxs("label",{className:M.radioLabel,children:[c.jsx("input",{type:"radio",value:d.value,disabled:o,...i(e,{required:n?a.radioField.requiredError.replace("{field}",t):!1})}),d.label]},d.value))}),l&&c.jsx("span",{className:M.error,children:String(l.message)})]})};async function dE(e,t,r,n){var i,s;const a=(s=(i=(await ke.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:i.result)==null?void 0:s.node_id;if(!a)throw new Error("Asset creation failed: no node_id returned");return a}async function uE(e,t){var o,a;const n=(a=(o=(await ke.post(`/action/content/v3/upload/url/${e}`,{request:{content:{fileName:t}}})).data)==null?void 0:o.result)==null?void 0:a.pre_signed_url;if(!n)throw new Error("Pre-signed URL fetch failed");return n}async function fE(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 hE(e,t,r){var i,s;const n=new FormData;n.append("fileUrl",t),n.append("mimeType",r);const a=(s=(i=(await ke.post(`/action/asset/v1/upload/${e}`,n,{params:{enctype:"multipart/form-data",processData:!1,contentType:!1,cache:!1}})).data)==null?void 0:i.result)==null?void 0:s.content_url;if(!a)throw new Error("Asset finalize failed: no content_url returned");return a}const pe={overlay:"_overlay_ga6eh_1",modal:"_modal_ga6eh_12",header:"_header_ga6eh_24",title:"_title_ga6eh_33",closeBtn:"_closeBtn_ga6eh_39",tabs:"_tabs_ga6eh_57",tab:"_tab_ga6eh_57",activeTab:"_activeTab_ga6eh_83",body:"_body_ga6eh_88",searchWrap:"_searchWrap_ga6eh_99",searchIcon:"_searchIcon_ga6eh_104",searchInput:"_searchInput_ga6eh_113",grid:"_grid_ga6eh_132",imgCell:"_imgCell_ga6eh_148",imgCellSelected:"_imgCellSelected_ga6eh_166",thumb:"_thumb_ga6eh_171",noThumb:"_noThumb_ga6eh_177",checkBadge:"_checkBadge_ga6eh_183",loadMoreBtn:"_loadMoreBtn_ga6eh_198",loadingRow:"_loadingRow_ga6eh_220",empty:"_empty_ga6eh_230",spinner:"_spinner_ga6eh_237",uploadArea:"_uploadArea_ga6eh_247",dropZone:"_dropZone_ga6eh_256",uploadIcon:"_uploadIcon_ga6eh_277",dropText:"_dropText_ga6eh_281",dropSubtext:"_dropSubtext_ga6eh_288",uploadPreview:"_uploadPreview_ga6eh_294",hiddenInput:"_hiddenInput_ga6eh_301",fileName:"_fileName_ga6eh_305",errorText:"_errorText_ga6eh_311",footer:"_footer_ga6eh_318",cancelBtn:"_cancelBtn_ga6eh_328",confirmBtn:"_confirmBtn_ga6eh_345"},Fh=18,Mh=({nodeId:e,currentValue:t,onSelect:r,onClose:n})=>{const o=le(),[a,i]=h.useState("my"),[s,l]=h.useState(""),[d,f]=h.useState([]),[u,m]=h.useState(0),[g,w]=h.useState(!1),[p,y]=h.useState(null),[v,b]=h.useState(0),[C,S]=h.useState(null),[T,I]=h.useState(""),[k,x]=h.useState(!1),[$,j]=h.useState(""),N=h.useRef(null),L=ce(U=>{var H,ae;return((ae=(H=U.editorConfig)==null?void 0:H.context)==null?void 0:ae.channel)??""}),B=ce(U=>{var H,ae;return((ae=(H=U.editorConfig)==null?void 0:H.context)==null?void 0:ae.uid)??""}),P=ce(U=>{var H,ae,fe;return((fe=(ae=(H=U.editorConfig)==null?void 0:H.context)==null?void 0:ae.cloudStorage)==null?void 0:fe.presigned_headers)??{}}),F=ce(U=>{var H,ae,fe;return((fe=(ae=(H=U.editorConfig)==null?void 0:H.config)==null?void 0:ae.assetConfig)==null?void 0:fe.size)??1*1024*1024}),V=ce(U=>{var H,ae,fe;return((fe=(ae=(H=U.editorConfig)==null?void 0:H.config)==null?void 0:ae.assetConfig)==null?void 0:fe.accepted)??"image/png,image/jpeg"}),X=h.useCallback(async(U,H,ae=!1)=>{var fe;w(!0);try{const J={status:["Live"],mediaType:["image"],mimeType:["image/png","image/jpeg","image/jpg","image/gif","image/svg+xml"]};a==="my"&&B&&(J.createdBy=B),L&&(J.channel=L);const Me=((fe=(await ke.post("/action/composite/v3/search",{request:{filters:J,query:U,limit:Fh,offset:H,sort_by:{createdOn:"desc"},fields:["identifier","name","appIcon","artifactUrl","downloadUrl"]}},{headers:{"X-Source":"web"}})).data)==null?void 0:fe.result)??{},Oe=Me.content??[];m(Me.count??0),f(ze=>ae?[...ze,...Oe]:Oe)}catch{}finally{w(!1)}},[a,B,L]);h.useEffect(()=>{a!=="upload"&&(f([]),b(0),X(s,0))},[a]);const ve=h.useRef(),Ee=U=>{l(U),clearTimeout(ve.current),ve.current=setTimeout(()=>{f([]),b(0),X(U,0)},400)},Ce=()=>{const U=v+Fh;b(U),X(s,U,!0)},ue=()=>{const U=(p==null?void 0:p.artifactUrl)??(p==null?void 0:p.appIcon)??(p==null?void 0:p.downloadUrl)??"";U&&r(U)};h.useEffect(()=>()=>{T&&URL.revokeObjectURL(T)},[T]);const Q=U=>{var fe;const H=(fe=U.target.files)==null?void 0:fe[0];if(U.target.value="",!H)return;const ae=V.split(",").map(J=>J.trim());if(!ae.includes(H.type)){const J=ae.map(oe=>oe.replace("image/","").toUpperCase()).join(", ");j(o.appIconPickerModal.invalidFileTypeError.replace("{types}",J));return}if(H.size>F){const J=(F/1048576).toFixed(0);j(o.appIconPickerModal.fileTooLargeError.replace("{size}",J));return}T&&URL.revokeObjectURL(T),S(H),I(URL.createObjectURL(H)),j("")},ne=async()=>{if(C){x(!0),j("");try{const U=await dE(C.name.split(".").slice(0,-1).join(".")||C.name,C.type,B,L),H=await uE(U,C.name);await fE(H,C,P);const ae=H.split("?")[0],fe=await hE(U,ae,C.type);r(fe)}catch(U){j(U instanceof Error?U.message:o.appIconPickerModal.uploadFailedError)}finally{x(!1)}}},te=d.length<u;return c.jsx("div",{className:pe.overlay,role:"dialog","aria-modal":"true","aria-label":o.appIconPickerModal.dialogAriaLabel,children:c.jsxs("div",{className:pe.modal,children:[c.jsxs("div",{className:pe.header,children:[c.jsx("span",{className:pe.title,children:o.appIconPickerModal.title}),c.jsx("button",{className:pe.closeBtn,onClick:n,"aria-label":o.appIconPickerModal.closeAriaLabel,children:c.jsx(yr,{size:18})})]}),c.jsxs("div",{className:pe.tabs,role:"tablist",children:[c.jsx("button",{role:"tab","aria-selected":a==="my",className:`${pe.tab} ${a==="my"?pe.activeTab:""}`,onClick:()=>i("my"),children:o.appIconPickerModal.myImagesTab}),c.jsx("button",{role:"tab","aria-selected":a==="all",className:`${pe.tab} ${a==="all"?pe.activeTab:""}`,onClick:()=>i("all"),children:o.appIconPickerModal.allImagesTab}),c.jsxs("button",{role:"tab","aria-selected":a==="upload",className:`${pe.tab} ${a==="upload"?pe.activeTab:""}`,onClick:()=>i("upload"),children:[c.jsx(Xi,{size:13,style:{marginRight:4}}),o.appIconPickerModal.uploadTab]})]}),c.jsx("div",{className:pe.body,children:a!=="upload"?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:pe.searchWrap,children:[c.jsx(Yi,{size:14,className:pe.searchIcon}),c.jsx("input",{type:"search",className:pe.searchInput,placeholder:o.appIconPickerModal.searchPlaceholder,value:s,onChange:U=>Ee(U.target.value)})]}),g&&d.length===0?c.jsxs("div",{className:pe.loadingRow,children:[c.jsx(wa,{size:20,className:pe.spinner}),c.jsx("span",{children:o.appIconPickerModal.loadingText})]}):d.length===0?c.jsx("div",{className:pe.empty,children:o.appIconPickerModal.noImagesFound}):c.jsx("div",{className:pe.grid,children:d.map(U=>{const H=U.appIcon??U.artifactUrl??U.downloadUrl??"",ae=(p==null?void 0:p.identifier)===U.identifier;return c.jsxs("button",{type:"button",className:`${pe.imgCell} ${ae?pe.imgCellSelected:""}`,onClick:()=>y(U),title:U.name,children:[H?c.jsx("img",{src:H,alt:U.name,className:pe.thumb}):c.jsx("div",{className:pe.noThumb,children:o.appIconPickerModal.noThumbnailText}),ae&&c.jsx("div",{className:pe.checkBadge,children:c.jsx(wn,{size:12})})]},U.identifier)})}),te&&!g&&c.jsx("button",{className:pe.loadMoreBtn,onClick:Ce,children:o.appIconPickerModal.loadMoreButton}),g&&d.length>0&&c.jsx("div",{className:pe.loadingRow,children:c.jsx(wa,{size:16,className:pe.spinner})})]}):c.jsxs("div",{className:pe.uploadArea,children:[c.jsx("div",{className:pe.dropZone,onClick:()=>{var U;return(U=N.current)==null?void 0:U.click()},onDragOver:U=>U.preventDefault(),onDrop:U=>{U.preventDefault();const H=U.dataTransfer.files[0];H&&Q({target:{files:[H],value:""}})},children:T?c.jsx("img",{src:T,alt:o.appIconPickerModal.previewAlt,className:pe.uploadPreview}):c.jsxs(c.Fragment,{children:[c.jsx(Xi,{size:32,className:pe.uploadIcon}),c.jsx("p",{className:pe.dropText,children:o.appIconPickerModal.dropZoneText}),c.jsx("p",{className:pe.dropSubtext,children:o.appIconPickerModal.acceptedTypesInfo.replace("{types}",V.split(",").map(U=>U.replace("image/","").toUpperCase()).join(", ")).replace("{size}",(F/(1024*1024)).toFixed(0))})]})}),c.jsx("input",{ref:N,type:"file",accept:V,className:pe.hiddenInput,onChange:Q}),C&&c.jsx("p",{className:pe.fileName,children:C.name}),$&&c.jsx("p",{className:pe.errorText,children:$})]})}),c.jsxs("div",{className:pe.footer,children:[c.jsx("button",{className:pe.cancelBtn,onClick:n,children:o.appIconPickerModal.cancelButton}),a==="upload"?c.jsx("button",{className:pe.confirmBtn,disabled:!C||k,onClick:ne,children:k?c.jsxs(c.Fragment,{children:[c.jsx(wa,{size:14,className:pe.spinner})," ",o.appIconPickerModal.uploadingText]}):o.appIconPickerModal.uploadAndUseButton}):c.jsx("button",{className:pe.confirmBtn,disabled:!p,onClick:ue,children:o.appIconPickerModal.useSelectedButton})]})]})})},pE=({name:e,label:t,nodeId:r,required:n,disabled:o})=>{const a=le(),[i,s]=h.useState(!1),{watch:l,setValue:d,register:f,formState:{errors:u}}=tr(),m=l(e),g=u[e],w=y=>{d(e,y,{shouldDirty:!0,shouldValidate:!0}),s(!1)},p=()=>{d(e,"",{shouldDirty:!0,shouldValidate:!0})};return c.jsxs("div",{className:M.field,children:[c.jsxs("label",{className:M.label,children:[t,n&&c.jsx("span",{className:M.required,children:"*"})]}),c.jsx("input",{type:"hidden",...f(e,{required:n?a.appIconField.requiredError.replace("{field}",t):!1})}),c.jsx("div",{className:M.iconWrap,role:"button",tabIndex:o?-1:0,"aria-label":a.appIconField.selectIconAriaLabel,onClick:()=>!o&&s(!0),onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&!o&&s(!0)},children:m?c.jsx("img",{src:m,alt:a.appIconField.iconAlt,className:M.iconPreview}):c.jsxs("div",{className:M.iconPlaceholder,children:[c.jsx(Jc,{size:20}),c.jsx("span",{children:a.appIconField.selectIconLabel})]})}),m&&!o&&c.jsxs("button",{type:"button",className:M.removeIconBtn,onClick:p,"aria-label":a.appIconField.removeIconAriaLabel,children:[c.jsx(Zi,{size:13}),c.jsx("span",{children:a.appIconField.removeLabel})]}),g&&c.jsx("span",{className:M.error,children:String(g.message)}),i&&c.jsx(Mh,{nodeId:r,currentValue:m,onSelect:w,onClose:()=>s(!1)})]})},gE=({name:e,label:t,required:r,disabled:n})=>{const o=le(),{control:a}=tr(),{field:i,fieldState:{error:s}}=ri({name:e,control:a,rules:{required:r?o.dateTimeField.requiredError.replace("{field}",t):!1}});return c.jsxs("div",{className:M.field,children:[c.jsxs("label",{className:M.label,htmlFor:e,children:[t,r&&c.jsx("span",{className:M.required,children:"*"})]}),c.jsx("input",{id:e,type:"datetime-local",className:[M.input,s?M.inputError:""].join(" "),disabled:n,value:i.value??"",onChange:i.onChange,onBlur:i.onBlur,ref:i.ref}),s&&c.jsx("span",{className:M.error,children:String(s.message)})]})},mE=({name:e,label:t,required:r,disabled:n})=>{const o=le(),{control:a}=tr(),{field:i,fieldState:{error:s}}=ri({name:e,control:a,rules:{required:r?o.keywordSuggestField.requiredError.replace("{field}",t):!1},defaultValue:[]}),[l,d]=h.useState(""),f=h.useRef(null),u=i.value??[],m=y=>{const v=y.trim();!v||u.includes(v)||i.onChange([...u,v])},g=y=>{i.onChange(u.filter(v=>v!==y))},w=y=>{y.key==="Enter"||y.key===","?(y.preventDefault(),m(l),d("")):y.key==="Backspace"&&l===""&&u.length>0&&g(u[u.length-1])},p=()=>{l.trim()&&(m(l),d("")),i.onBlur()};return c.jsxs("div",{className:[M.field,M.fullWidth].join(" "),children:[c.jsxs("label",{className:M.label,children:[t,r&&c.jsx("span",{className:M.required,children:"*"})]}),c.jsxs("div",{className:[M.chipGroup,s?M.inputError:""].join(" "),onClick:()=>{var y;return!n&&((y=f.current)==null?void 0:y.focus())},style:{cursor:n?"not-allowed":"text"},children:[u.map(y=>c.jsxs("span",{className:M.tagChip,children:[y,!n&&c.jsx("button",{type:"button",className:M.tagChipRemove,onClick:v=>{v.stopPropagation(),g(y)},"aria-label":`Remove ${y}`,children:c.jsx(yr,{size:11})})]},y)),!n&&c.jsx("input",{ref:f,className:M.chipInput,value:l,onChange:y=>d(y.target.value),onKeyDown:w,onBlur:p,placeholder:u.length===0?o.keywordSuggestField.inputPlaceholder:"",style:{flexGrow:1,minWidth:120}})]}),s&&c.jsx("span",{className:M.error,children:String(s.message)})]})},yE=({name:e,label:t,levels:r,required:n,disabled:o})=>{const a=le(),{control:i}=tr(),{field:s,fieldState:{error:l}}=ri({name:e,control:i,rules:{required:n?a.nestedSelectField.requiredError.replace("{field}",t):!1},defaultValue:{}}),d=s.value??{},f=(u,m,g)=>{const w={};for(let p=0;p<m;p++)w[r[p].code]=d[r[p].code]??"";w[u]=g;for(let p=m+1;p<r.length;p++)w[r[p].code]="";s.onChange(w)};return c.jsxs("div",{className:[M.field,M.fullWidth].join(" "),children:[c.jsxs("label",{className:M.label,children:[t,n&&c.jsx("span",{className:M.required,children:"*"})]}),c.jsx("div",{className:M.nestedSelectRow,children:r.map((u,m)=>{const g=m>0&&!d[r[m-1].code];return c.jsxs("div",{className:M.field,style:{flex:1},children:[c.jsx("label",{className:M.label,htmlFor:`${e}_${u.code}`,children:u.label}),c.jsxs("select",{id:`${e}_${u.code}`,className:[M.input,l?M.inputError:""].join(" "),disabled:o||g,value:d[u.code]??"",onChange:w=>f(u.code,m,w.target.value),onBlur:s.onBlur,children:[c.jsx("option",{value:"",children:a.nestedSelectField.selectPlaceholder}),u.options.map(w=>c.jsx("option",{value:w.value,children:w.label},w.value))]})]},u.code)})}),l&&c.jsx("span",{className:M.error,children:String(l.message)})]})},$h=[{label:"CC BY 4.0",value:"CC BY 4.0"},{label:"CC BY-SA 4.0",value:"CC BY-SA 4.0"},{label:"CC BY-NC 4.0",value:"CC BY-NC 4.0"},{label:"CC BY-NC-SA 4.0",value:"CC BY-NC-SA 4.0"},{label:"CC BY-ND 4.0",value:"CC BY-ND 4.0"},{label:"CC0 1.0 (Public Domain)",value:"CC0 1.0"}],vE=({name:e,label:t,required:r,disabled:n})=>{const o=le(),[a,i]=h.useState(!1),s=h.useRef(null),{register:l,watch:d,setValue:f,formState:{errors:u}}=tr(),m=d(e),g=$h.find(y=>y.value===m),w=(g==null?void 0:g.label)??o.licenseSelectField.selectPlaceholder,p=u[e];return h.useEffect(()=>{if(!a)return;const y=v=>{var b;(b=s.current)!=null&&b.contains(v.target)||i(!1)};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[a]),c.jsxs("div",{className:M.field,ref:s,style:{position:"relative"},children:[c.jsxs("label",{className:M.label,children:[t,r&&c.jsx("span",{className:M.required,children:"*"})]}),c.jsx("input",{type:"hidden",...l(e,{required:r?o.licenseSelectField.requiredError.replace("{field}",t):!1})}),c.jsxs("button",{type:"button",disabled:n,className:[M.selectBtn,p?M.inputError:"",a?M.selectOpen:""].join(" "),onClick:()=>i(y=>!y),"aria-haspopup":"listbox","aria-expanded":a,children:[c.jsx("span",{className:m?M.selectedVal:M.placeholder,children:w}),c.jsx(Cn,{size:14,className:a?M.chevronUp:""})]}),a&&c.jsx("div",{className:M.dropdown,role:"listbox",children:$h.map(y=>c.jsxs("button",{type:"button",role:"option","aria-selected":m===y.value,className:[M.option,m===y.value?M.optionSelected:""].join(" "),onClick:()=>{f(e,y.value,{shouldDirty:!0,shouldValidate:!0}),i(!1)},children:[c.jsx("span",{children:y.label}),m===y.value&&c.jsx(wn,{size:13})]},y.value))}),p&&c.jsx("span",{className:M.error,children:String(p.message)})]})},bE=({name:e,label:t,required:r,disabled:n})=>{const o=le(),{control:a}=tr(),{field:i,fieldState:{error:s}}=ri({name:e,control:a,rules:{required:r?o.dialcodeInputField.requiredError.replace("{field}",t):!1},defaultValue:""}),[l,d]=h.useState("idle"),[f,u]=h.useState(""),m=async()=>{const w=(i.value??"").trim();if(!w){d("invalid"),u(o.dialcodeInputField.enterCodeMessage);return}d("loading"),u("");try{const p=await Lw(w),y=p==null?void 0:p.result,v=y==null?void 0:y.dialcodes;Array.isArray(v)&&v.length>0?(d("valid"),u(o.dialcodeInputField.validMessage)):(d("invalid"),u(o.dialcodeInputField.notFoundMessage))}catch{d("invalid"),u(o.dialcodeInputField.validationFailedMessage)}},g=()=>l==="loading"?c.jsx(wa,{size:16,className:M.dialcodeSpinner}):l==="valid"?c.jsx(Kc,{size:16,color:"var(--sbx-success, #2e7d32)"}):l==="invalid"?c.jsx(ky,{size:16,color:"var(--sbx-error)"}):null;return c.jsxs("div",{className:M.field,children:[c.jsxs("label",{className:M.label,htmlFor:e,children:[t,r&&c.jsx("span",{className:M.required,children:"*"})]}),c.jsxs("div",{className:M.dialcodeRow,children:[c.jsx("input",{id:e,type:"text",className:[M.input,s?M.inputError:""].join(" "),disabled:n,value:i.value??"",onChange:w=>{i.onChange(w),d("idle"),u("")},onBlur:i.onBlur,ref:i.ref,placeholder:o.dialcodeInputField.placeholderExample,style:{flex:1}}),c.jsx("button",{type:"button",className:M.validateBtn,onClick:m,disabled:n||l==="loading","aria-label":o.dialcodeInputField.validateAriaLabel,children:l==="loading"?o.dialcodeInputField.validatingLabel:o.dialcodeInputField.validateButtonLabel}),g()]}),s&&c.jsx("span",{className:M.error,children:String(s.message)}),!s&&f&&c.jsx("span",{className:l==="valid"?M.dialcodeValid:M.error,children:f})]})},_l={form:"_form_szqex_1",ungrouped:"_ungrouped_szqex_7",noFields:"_noFields_szqex_18"},wE=({nodeMetadata:e,activeTab:t,isRoot:r,isFolder:n,editorMode:o,onFormValueChange:a,onFormStatusChange:i})=>{var We,Ve,re,Ke,Re,He,et,Gt,It;const s=le(),l=ce(K=>K.editorConfig),d=ce(K=>K.rootFormConfig),f=ce(K=>K.unitFormConfig),u=ce(K=>K.categoryMeta),m=ce(K=>K.contentFramework),g=ce(K=>K.contentTargetFWIds),{organisationFramework:w,targetFrameworks:p,isLoading:y}=Ah(m??((We=l==null?void 0:l.context)==null?void 0:We.framework),g??((Ve=l==null?void 0:l.context)==null?void 0:Ve.targetFWIds)),{frameworks:v,collectionAdditionalCategories:b,contentAdditionalCategories:C,defaultLicense:S,name:T}=F1((re=l==null?void 0:l.context)==null?void 0:re.channel),I=M1(((Ke=l==null?void 0:l.context)==null?void 0:Ke.userId)??((Re=l==null?void 0:l.context)==null?void 0:Re.uid)),k=L1(v,(He=u==null?void 0:u.frameworkMetadata)==null?void 0:He.orgFWType,(et=l==null?void 0:l.context)==null?void 0:et.channel),x={organisationFramework:w,targetFrameworks:p,orgFrameworks:k,channelAdditionalCategories:b},$=Ae(K=>K.selectedNodeId),j=Ae(K=>K.treeData),N=Ae(K=>K.treeCache),L=$?N[$]??{}:{},B={...e,...L},P=h.useMemo(()=>{var ge;if(!$)return 0;const K=[...j];for(;K.length;){const we=K.shift();if(we.id===$)return((ge=we.children)==null?void 0:ge.length)??0;we.children&&K.push(...we.children)}return 0},[j,$]),F=(l==null?void 0:l.config)??{},V=(l==null?void 0:l.context)??{},X={editorMode:o,editableFields:F.editableFields,objectType:F.objectType,setDefaultCopyRight:F.setDefaultCopyRight===!0,defaultLicense:V.defaultLicense??S,contextAdditionalCategories:V.additionalCategories,userFullName:((Gt=V.user)==null?void 0:Gt.fullName)??I,channelName:T,collectionAdditionalCategories:b,contentAdditionalCategories:C,childCount:P},ve=r?d:f,Ee=ve||(((It=l==null?void 0:l.config.hierarchy)==null?void 0:It.formConfig)??[]),Ce=Nh(Ee,B,x,r,X),ue=Ce.filter(K=>K.tab===t&&K.inputType!=="appIcon"&&K.visible!==!1),Q=k1({mode:"onChange",defaultValues:Object.fromEntries(Ce.map(K=>{const ge=["multiselect","chips","keywords","tagsinput"],we=["nestedselect"];return ge.includes(K.inputType)?[K.code,K.currentValue??K.defaultValue??[]]:we.includes(K.inputType)?[K.code,K.currentValue??K.defaultValue??{}]:[K.code,K.currentValue??K.defaultValue??""]}))});oE(Q,Ce);const{updateNode:ne}=Ae(),te=h.useRef(Ce);te.current=Ce;const U=h.useRef($);U.current=$;const H=h.useRef(a);H.current=a;const ae=h.useRef(i);ae.current=i;const fe=h.useRef(typeof B.shuffle=="boolean"?B.shuffle:void 0),J=h.useRef(B.name??"");J.current=B.name??"";const oe=h.useRef(o);oe.current=o;const Me=["review","read","sourcingreview","orgreview"];h.useEffect(()=>{const K=U.current;if(K){const ge=Object.fromEntries(te.current.filter(we=>we.currentValue!==void 0&&we.currentValue!==null).map(we=>[we.code,we.currentValue]));Object.keys(ge).length>0&&ne(K,ge)}Q.trigger().then(()=>{const ge=Q.formState.errors,we=te.current,Wt=Array.from(new Set(Object.keys(ge).map(_=>{var A;return(A=we.find(D=>D.code===_))==null?void 0:A.tab}).filter(Boolean)));ae.current(Object.keys(ge).length===0,Wt)})},[]),h.useEffect(()=>{const K=Q.watch((ge,{name:we})=>{const Wt=U.current;if(!Wt)return;const _=te.current,A=new Set(_.map(q=>q.code));if(we&&A.has(we)){let q=Q.getValues(we);we==="dialcodes"&&(q=Array.isArray(q)?q:q?[q]:[]),we==="shuffle"&&(q===!0&&fe.current===!1&&Ie(s.sparkMetaForm.shuffleEnabledMessage,{icon:c.jsx(Qi,{size:16})}),fe.current=q);const G=nE(we,q);G&&(ne(Wt,G),H.current(G))}else if(!we){const q=Q.getValues(),G=Object.fromEntries(Object.entries(q).filter(([ee])=>A.has(ee))),R=rE(G,{isReview:Me.includes(oe.current),nodeTitle:J.current});Object.keys(R).length>0&&(ne(Wt,R),H.current(R))}const D=Q.formState.errors,z=Array.from(new Set(Object.keys(D).map(q=>{var G;return(G=_.find(R=>R.code===q))==null?void 0:G.tab}).filter(Boolean)));ae.current(Object.keys(D).length===0,z)});return()=>K.unsubscribe()},[Q]),h.useEffect(()=>{for(const K of["author","creator","copyright","copyrightYear","license"]){const ge=te.current.find(Wt=>Wt.code===K);if(!ge||ge.currentValue===void 0||ge.currentValue===null||ge.currentValue==="")continue;const we=Q.getValues(K);(we==null||we==="")&&Q.setValue(K,ge.currentValue,{shouldDirty:!1})}},[I,T,Q]);const Oe=ue.reduce((K,ge)=>{const we=K[K.length-1];return we&&we.section===ge.section?we.fields.push(ge):K.push({section:ge.section,fields:[ge]}),K},[]),ze=K=>{const ge={key:K.code,name:K.code,label:K.label,required:K.required,disabled:K.editable===!1};switch(K.inputType){case"textarea":return c.jsx(Ph,{...ge,multiline:!0,maxLength:K.maxLength});case"select":return c.jsx(iE,{...ge,options:K.options??[]});case"multiselect":return c.jsx(sE,{...ge,options:K.options??[]});case"chips":return c.jsx(lE,{...ge});case"radio":return c.jsx(cE,{...ge,options:K.options??[]});case"appIcon":return c.jsx(pE,{...ge,nodeId:$??""});case"datepicker":case"datetime":return c.jsx(gE,{...ge});case"keywords":case"tagsinput":return c.jsx(mE,{...ge});case"nestedselect":return c.jsx(yE,{...ge,levels:K.levels??[]});case"license":return c.jsx(vE,{...ge});case"dialcode":return c.jsx(bE,{...ge});default:return c.jsx(Ph,{...ge,maxLength:K.maxLength})}};return c.jsx(m1,{...Q,children:c.jsxs("div",{className:_l.form,children:[Oe.map((K,ge)=>{const we=K.section?$1[K.section]:void 0;return we?c.jsx(aE,{title:we.title,description:we.description,children:K.fields.map(ze)},K.section??ge):c.jsx("div",{className:_l.ungrouped,children:K.fields.map(ze)},ge)}),ue.length===0&&!y&&c.jsx("p",{className:_l.noFields,children:s.sparkMetaForm.noFieldsMessage})]})})};function Bh(e,t,r){const n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function CE(e,t){return e.reduce((r,n,o)=>{const a=t.get(n);return a&&(r[o]=a),r},Array(e.length))}function si(e){return e!==null&&e>=0}function SE(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 _E(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const jh=e=>{let{rects:t,activeIndex:r,overIndex:n,index:o}=e;const a=Bh(t,n,r),i=t[o],s=a[o];return!s||!i?null:{x:s.left-i.left,y:s.top-i.top,scaleX:s.width/i.width,scaleY:s.height/i.height}},li={scaleX:1,scaleY:1},TE=e=>{var t;let{activeIndex:r,activeNodeRect:n,index:o,rects:a,overIndex:i}=e;const s=(t=a[r])!=null?t:n;if(!s)return null;if(o===r){const d=a[i];return d?{x:0,y:r<i?d.top+d.height-(s.top+s.height):d.top-s.top,...li}:null}const l=EE(a,o,r);return o>r&&o<=i?{x:0,y:-s.height-l,...li}:o<r&&o>=i?{x:0,y:s.height+l,...li}:{x:0,y:0,...li}};function EE(e,t,r){const n=e[t],o=e[t-1],a=e[t+1];return n?r<t?o?n.top-(o.top+o.height):a?a.top-(n.top+n.height):0:a?a.top-(n.top+n.height):o?n.top-(o.top+o.height):0:0}const qh="Sortable",Uh=h.createContext({activeIndex:-1,containerId:qh,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:jh,disabled:{draggable:!1,droppable:!1}});function IE(e){let{children:t,id:r,items:n,strategy:o=jh,disabled:a=!1}=e;const{active:i,dragOverlay:s,droppableRects:l,over:d,measureDroppableContainers:f}=Rc(),u=lo(qh,r),m=s.rect!==null,g=h.useMemo(()=>n.map(I=>typeof I=="object"&&"id"in I?I.id:I),[n]),w=i!=null,p=i?g.indexOf(i.id):-1,y=d?g.indexOf(d.id):-1,v=h.useRef(g),b=!SE(g,v.current),C=y!==-1&&p===-1||b,S=_E(a);Yt(()=>{b&&w&&f(g)},[b,g,w,f]),h.useEffect(()=>{v.current=g},[g]);const T=h.useMemo(()=>({activeIndex:p,containerId:u,disabled:S,disableTransforms:C,items:g,overIndex:y,useDragOverlay:m,sortedRects:CE(g,l),strategy:o}),[p,u,S.draggable,S.droppable,C,g,y,l,m,o]);return h.createElement(Uh.Provider,{value:T},t)}const OE=e=>{let{id:t,items:r,activeIndex:n,overIndex:o}=e;return Bh(r,n,o).indexOf(t)},AE=e=>{let{containerId:t,isSorting:r,wasDragging:n,index:o,items:a,newIndex:i,previousItems:s,previousContainerId:l,transition:d}=e;return!d||!n||s!==a&&o===i?!1:r?!0:i!==o&&t===l},DE={duration:200,easing:"ease"},zh="transform",NE=Ar.Transition.toString({property:zh,duration:0,easing:"linear"}),kE={roleDescription:"sortable"};function xE(e){let{disabled:t,index:r,node:n,rect:o}=e;const[a,i]=h.useState(null),s=h.useRef(r);return Yt(()=>{if(!t&&r!==s.current&&n.current){const l=o.current;if(l){const d=bn(n.current,{ignoreTransform:!0}),f={x:l.left-d.left,y:l.top-d.top,scaleX:l.width/d.width,scaleY:l.height/d.height};(f.x||f.y)&&i(f)}}r!==s.current&&(s.current=r)},[t,r,n,o]),h.useEffect(()=>{a&&i(null)},[a]),a}function LE(e){let{animateLayoutChanges:t=AE,attributes:r,disabled:n,data:o,getNewIndex:a=OE,id:i,strategy:s,resizeObserverConfig:l,transition:d=DE}=e;const{items:f,containerId:u,activeIndex:m,disabled:g,disableTransforms:w,sortedRects:p,overIndex:y,useDragOverlay:v,strategy:b}=h.useContext(Uh),C=PE(n,g),S=f.indexOf(i),T=h.useMemo(()=>({sortable:{containerId:u,index:S,items:f},...o}),[u,o,S,f]),I=h.useMemo(()=>f.slice(f.indexOf(i)),[f,i]),{rect:k,node:x,isOver:$,setNodeRef:j}=uy({id:i,data:T,disabled:C.droppable,resizeObserverConfig:{updateMeasurementsFor:I,...l}}),{active:N,activatorEvent:L,activeNodeRect:B,attributes:P,setNodeRef:F,listeners:V,isDragging:X,over:ve,setActivatorNodeRef:Ee,transform:Ce}=Hc({id:i,data:T,attributes:{...kE,...r},disabled:C.draggable}),ue=Yg(j,F),Q=!!N,ne=Q&&!w&&si(m)&&si(y),te=!v&&X,U=te&&ne?Ce:null,ae=ne?U??(s??b)({rects:p,activeNodeRect:B,activeIndex:m,overIndex:y,index:S}):null,fe=si(m)&&si(y)?a({id:i,items:f,activeIndex:m,overIndex:y}):S,J=N==null?void 0:N.id,oe=h.useRef({activeId:J,items:f,newIndex:fe,containerId:u}),Me=f!==oe.current.items,Oe=t({active:N,containerId:u,isDragging:X,isSorting:Q,id:i,index:S,items:f,newIndex:oe.current.newIndex,previousItems:oe.current.items,previousContainerId:oe.current.containerId,transition:d,wasDragging:oe.current.activeId!=null}),ze=xE({disabled:!Oe,index:S,node:x,rect:k});return h.useEffect(()=>{Q&&oe.current.newIndex!==fe&&(oe.current.newIndex=fe),u!==oe.current.containerId&&(oe.current.containerId=u),f!==oe.current.items&&(oe.current.items=f)},[Q,fe,u,f]),h.useEffect(()=>{if(J===oe.current.activeId)return;if(J&&!oe.current.activeId){oe.current.activeId=J;return}const Ve=setTimeout(()=>{oe.current.activeId=J},50);return()=>clearTimeout(Ve)},[J]),{active:N,activeIndex:m,attributes:P,data:T,rect:k,index:S,newIndex:fe,items:f,isOver:$,isSorting:Q,isDragging:X,listeners:V,node:x,overIndex:y,over:ve,setNodeRef:ue,setActivatorNodeRef:Ee,setDroppableNodeRef:j,setDraggableNodeRef:F,transform:ze??ae,transition:We()};function We(){if(ze||Me&&oe.current.newIndex===S)return NE;if(!(te&&!da(L)||!d)&&(Q||Oe))return Ar.Transition.toString({...d,property:zh})}}function PE(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 ci(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 FE=[_e.Down,_e.Right,_e.Up,_e.Left],ME=(e,t)=>{let{context:{active:r,collisionRect:n,droppableRects:o,droppableContainers:a,over:i,scrollableAncestors:s}}=t;if(FE.includes(e.code)){if(e.preventDefault(),!r||!n)return;const l=[];a.getEnabled().forEach(u=>{if(!u||u!=null&&u.disabled)return;const m=o.get(u.id);if(m)switch(e.code){case _e.Down:n.top<m.top&&l.push(u);break;case _e.Up:n.top>m.top&&l.push(u);break;case _e.Left:n.left>m.left&&l.push(u);break;case _e.Right:n.left<m.left&&l.push(u);break}});const d=hm({collisionRect:n,droppableRects:o,droppableContainers:l});let f=mc(d,"id");if(f===(i==null?void 0:i.id)&&d.length>1&&(f=d[1].id),f!=null){const u=a.get(r.id),m=a.get(f),g=m?o.get(m.id):null,w=m==null?void 0:m.node.current;if(w&&g&&u&&m){const y=ha(w).some((I,k)=>s[k]!==I),v=Vh(u,m),b=$E(u,m),C=y||!v?{x:0,y:0}:{x:b?n.width-g.width:0,y:b?n.height-g.height:0},S={x:g.left,y:g.top};return C.x&&C.y?S:co(S,C)}}}};function Vh(e,t){return!ci(e)||!ci(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function $E(e,t){return!ci(e)||!ci(t)||!Vh(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const tn={row:"_row_11nth_1",removeBtn:"_removeBtn_11nth_14",grip:"_grip_11nth_17",ctIcon:"_ctIcon_11nth_34",info:"_info_11nth_38",name:"_name_11nth_46",meta:"_meta_11nth_55"},BE={video:Ji,pdf:ba,h5p:Gi,scorm:Ki,audio:Wi,quiz:Ri,default:Sn},jE=({item:e,onRemove:t,isEditable:r})=>{const n=le(),o=Ja(e),a=BE[o.key]??Sn,{attributes:i,listeners:s,setNodeRef:l,transform:d,transition:f,isDragging:u}=LE({id:e.id,disabled:!r}),m={transform:Ar.Transform.toString(d),transition:f,opacity:u?.5:1};return c.jsxs("div",{ref:l,style:m,className:tn.row,role:"listitem",children:[r&&c.jsx("span",{className:tn.grip,...i,...s,"aria-label":n.contentRow.dragToReorderAriaLabel,children:c.jsx(Xc,{size:15})}),c.jsx("span",{className:[`sbx-ct-sq--${o.key}`,tn.ctIcon].join(" "),"aria-hidden":"true",children:c.jsx(a,{size:14})}),c.jsxs("div",{className:tn.info,children:[c.jsx("span",{className:tn.name,title:e.name,children:e.name}),c.jsx("span",{className:tn.meta,children:o.label})]}),c.jsx("span",{className:`sbx-ct-badge--${o.key}`,children:o.label}),r&&c.jsx("button",{type:"button",className:tn.removeBtn,onClick:()=>t(e.id),"aria-label":n.contentRow.removeAriaLabel.replace("{name}",e.name),children:c.jsx(yr,{size:14})})]})},rn={container:"_container_lzvke_1",header:"_header_lzvke_7",heading:"_heading_lzvke_13",count:"_count_lzvke_21",list:"_list_lzvke_30",emptyState:"_emptyState_lzvke_36",addRow:"_addRow_lzvke_52"},qE=({editorMode:e})=>{const t=le(),{selectedNodeId:r,getChildrenOf:n,reorderChildren:o,deleteNode:a}=Ae(),i=r?n(r):[],s=e==="edit",l=fc(Pi(pa,{activationConstraint:{distance:5}}),Pi(ji,{coordinateGetter:ME})),d=h.useCallback(u=>{const{active:m,over:g}=u;if(!g||m.id===g.id||!r)return;const w=Ae.getState().getChildrenOf(r),p=w.findIndex(v=>v.id===m.id),y=w.findIndex(v=>v.id===g.id);p<0||y<0||o(r,p,y)},[r,o]),f=h.useCallback(u=>{window.confirm(t.unitContentList.removeConfirm)&&a(u)},[a,t.unitContentList.removeConfirm]);return r?c.jsxs("div",{className:rn.container,children:[c.jsxs("div",{className:rn.header,children:[c.jsx("span",{className:rn.heading,children:t.unitContentList.heading}),c.jsx("span",{className:rn.count,children:i.length})]}),i.length>0?c.jsx(zc,{sensors:l,collisionDetection:fm,onDragEnd:d,children:c.jsx(IE,{items:i.map(u=>u.id),strategy:TE,children:c.jsx("div",{className:rn.list,role:"list",children:i.map(u=>c.jsx(jE,{item:u,onRemove:f,isEditable:s},u.id))})})}):c.jsxs("div",{className:rn.emptyState,children:[c.jsx("p",{children:t.unitContentList.emptyTitle}),c.jsx("span",{children:t.unitContentList.emptyHint})]}),s&&c.jsxs("button",{className:rn.addRow,type:"button","aria-label":t.unitContentList.addContentAriaLabel,children:[c.jsx(mo,{size:14})," ",t.unitContentList.addContent]})]}):null},Hh={dropZone:"_dropZone_ijo5w_1",active:"_active_ijo5w_14"},UE=({isActive:e,label:t,nodeId:r,className:n})=>{const o=le(),a=t??o.dropZone.dropHere;return c.jsx("div",{className:`${Hh.dropZone} ${e?Hh.active:""} ${n??""}`,"data-droppable":e?"true":void 0,"data-node-id":r,"aria-label":a,role:"region",children:c.jsx("span",{children:a})})};async function zE(e){var i;const t={status:["Live"],...e.filters??{}};e.channel&&(t.channel=e.channel);const n=((i=(await ke.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:i.result)??{},o=new Set(["count","facets"]);return{content:Object.entries(n).filter(([s])=>!o.has(s)).flatMap(([,s])=>Array.isArray(s)?s:[]),count:n.count??0}}async function VE(e){var r,n;return(n=(r=(await ke.get(`/action/content/v3/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.content}const Rh="application/vnd.sunbird.question";function Qh(e){return{cardinality:"single",type:"integer",defaultValue:e.maxScore??1}}function Gh(e,t,r){if(!e)return null;if(e.identifier===t)return{question:e,parent:r};for(const n of e.children??[]){const o=Gh(n,t,e);if(o)return o}return null}function HE(e,t){const r=Gh(e,t);if(!r)return null;const{question:n,parent:o}=r,a={...e,children:[n],childNodes:[t],shuffle:o==null?void 0:o.shuffle,showSolutions:(o==null?void 0:o.showSolutions)??"No",showFeedback:(o==null?void 0:o.showFeedback)??"No"};return(o==null?void 0:o.shuffle)===!0?a.maxScore=1:n.qType==="SA"?delete a.maxScore:n.maxScore!=null&&(a.maxScore=n.maxScore),a}function RE(e,t){const r=((t==null?void 0:t.enabled)??!0)&&!!e;return gn({queryKey:["quml","questionset",e],enabled:r,queryFn:async()=>{const n=await su(e),o=f=>{if(!f)return[];const u=f.mimeType===Rh&&f.identifier?[f.identifier]:[],m=(f.children??[]).flatMap(o);return[...u,...m]},a=o(n),i=new Map;a.length&&(await Tw(a)).forEach(u=>{const m=u.identifier;m&&i.set(m,u)});const s=f=>{if(!f)return f;if(f.mimeType===Rh&&f.identifier){const u=i.get(f.identifier)??f,m=u.outcomeDeclaration;return m!=null&&m.maxScore||(u.outcomeDeclaration={...m??{},maxScore:Qh(u)}),u}return Array.isArray(f.children)&&(f.children=f.children.map(u=>s(u))),f},l=s(n),d=l.outcomeDeclaration;return d!=null&&d.maxScore||(l.outcomeDeclaration={...d??{},maxScore:Qh(l)}),l}})}const Wh="/assets/quml-player/sunbird-quml-player.js",QE="/assets/quml-player/styles.css",Kh="sunbird-quml-player";function GE(e){const t=e.children??[];return t.length?t.every(n=>n.objectType==="Question")?[e]:t:[]}const lt=class lt{constructor(){Yo(this,"eventHandlers",new WeakMap)}loadScript(){return lt.scriptLoaded||customElements.get(Kh)?(lt.scriptLoaded=!0,Promise.resolve()):(lt.scriptLoading||(lt.scriptLoading=new Promise((t,r)=>{const n=document.createElement("script");n.src=Wh,n.setAttribute("data-quml-player-script","true"),n.onload=()=>{lt.scriptLoaded=!0,lt.scriptLoading=void 0,t()},n.onerror=()=>{lt.scriptLoading=void 0,r(new Error(`Failed to load QuML player script: ${Wh}`))},document.body.appendChild(n)})),lt.scriptLoading)}loadStyles(){if(lt.stylesLoaded||document.querySelector('[data-quml-player-styles="true"]')){lt.stylesLoaded=!0;return}const t=document.createElement("link");t.rel="stylesheet",t.href=QE,t.setAttribute("data-quml-player-styles","true"),document.head.appendChild(t),lt.stylesLoaded=!0}static unloadStyles(){var t;(t=document.querySelector('[data-quml-player-styles="true"]'))==null||t.remove(),lt.stylesLoaded=!1}async createConfig(t,r,n){var a,i,s;return await this.loadScript(),{context:{mode:(n==null?void 0:n.mode)??"play",host:"",pdata:{id:((a=r==null?void 0:r.pdata)==null?void 0:a.id)??"sunbird.portal",ver:((i=r==null?void 0:r.pdata)==null?void 0:i.ver)??"1.0",pid:((s=r==null?void 0:r.pdata)==null?void 0:s.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:GE(t),identifier:t.identifier??""},metadata:t}}createElement(t){this.loadStyles();const r=document.createElement(Kh);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 o=i=>r==null?void 0:r(i),a=i=>n==null?void 0:n(i.detail);t.addEventListener("playerEvent",o),t.addEventListener("telemetryEvent",a),this.eventHandlers.set(t,{player:o,telemetry:a})}removeEventListeners(t){const r=this.eventHandlers.get(t);r&&(t.removeEventListener("playerEvent",r.player),t.removeEventListener("telemetryEvent",r.telemetry),this.eventHandlers.delete(t))}};Yo(lt,"scriptLoaded",!1),Yo(lt,"scriptLoading"),Yo(lt,"stylesLoaded",!1);let di=lt;const ui=new di,je={contentPlayerRoot:"_contentPlayerRoot_r6xk8_1",flowLayout:"_flowLayout_r6xk8_9",stage:"_stage_r6xk8_13",aspectRatio:"_aspectRatio_r6xk8_16",playerHeader:"_playerHeader_r6xk8_32",playerHeaderThumb:"_playerHeaderThumb_r6xk8_46",playerHeaderTitle:"_playerHeaderTitle_r6xk8_56",typeBadge:"_typeBadge_r6xk8_66",typeDot:"_typeDot_r6xk8_105",playerFrame:"_playerFrame_r6xk8_125",coverOverlay:"_coverOverlay_r6xk8_133",coverHidden:"_coverHidden_r6xk8_145",coverThumb:"_coverThumb_r6xk8_150",coverPlayRing:"_coverPlayRing_r6xk8_159",coverPlayIcon:"_coverPlayIcon_r6xk8_172",coverLabel:"_coverLabel_r6xk8_181",coverSkeleton:"_coverSkeleton_r6xk8_187",playerWrapper:"_playerWrapper_r6xk8_213",infoStrip:"_infoStrip_r6xk8_223",infoChip:"_infoChip_r6xk8_239",infoChipLabel:"_infoChipLabel_r6xk8_258",infoChipIcon:"_infoChipIcon_r6xk8_267",playerError:"_playerError_r6xk8_273",playerErrorIcon:"_playerErrorIcon_r6xk8_287",playerErrorMsg:"_playerErrorMsg_r6xk8_292",qumlRoot:"_qumlRoot_r6xk8_299"},WE="application/vnd.sunbird.questionset";function KE(e,t){const r=new Map,n=a=>{for(const i of a)r.set(i.id,i),i.children&&n(i.children)};n(e);let o=r.get(t);for(;o;){if(o.mimeType===WE)return o.identifier;o=o.parent?r.get(o.parent):void 0}return null}const YE=[{key:"video",mimes:["video/mp4","video/webm","video/ogg"]},{key:"audio",mimes:["audio/mp3","audio/mpeg","audio/ogg","audio/wav"]},{key:"pdf",mimes:["application/pdf"]},{key:"epub",mimes:["application/epub"]},{key:"ecml",mimes:["application/vnd.ekstep.ecml-archive"]},{key:"h5p",mimes:["application/vnd.ekstep.h5p-archive"]},{key:"scorm",mimes:["application/vnd.ekstep.content-collection"]}];function ZE(e){return YE.find(t=>t.mimes.includes(e))??{key:"other"}}function XE(e,t){switch(e){case"video":return t.contentPlayer.mimeLabelVideo;case"audio":return t.contentPlayer.mimeLabelAudio;case"pdf":return t.contentPlayer.mimeLabelPdf;case"epub":return t.contentPlayer.mimeLabelEpub;case"ecml":return t.contentPlayer.mimeLabelEcml;case"h5p":return t.contentPlayer.mimeLabelH5p;case"scorm":return t.contentPlayer.mimeLabelScorm;default:return t.contentPlayer.mimeLabelOther}}const JE={"pdf-player":["application/pdf"],"video-player":["video/mp4","video/webm"],"epub-player":["application/epub"]},eI={"pdf-player":"/assets/sunbird-pdf-player.js","video-player":"/assets/sunbird-video-player.js","epub-player":"/assets/sunbird-epub-player.js"},tI={"pdf-player":"sunbird-pdf-player","video-player":"sunbird-video-player","epub-player":"sunbird-epub-player"},rI="/content/preview/preview.html?webview=true&build_number=2.8.0.e552fcd";function Tl(e){for(const[t,r]of Object.entries(JE))if(r.includes(e))return t;return"default-player"}function nI(e,t,r){var a;const n=r==null?void 0:r.context,o=t.mimeType??e.mimeType??"";return{context:{mode:"play",partner:[],pdata:{id:((a=n==null?void 0:n.pdata)==null?void 0:a.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:o==="application/vnd.ekstep.ecml-archive"?t.body??{}:{}}}function oI(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 aI(e,t,r=100){await oI(eI[t]??""),!customElements.get(e)&&await new Promise((n,o)=>{let a=0;const i=setInterval(()=>{a++,customElements.get(e)?(clearInterval(i),n()):a>=r&&(clearInterval(i),o(new Error(`Custom element <${e}> did not register`)))},100)})}const iI=[{key:"author",icon:Zy},{key:"license",icon:Hy},{key:"language",icon:My},{key:"gradeLevel",icon:Ry},{key:"subject",icon:Ay},{key:"contentType",icon:Ky}];function sI(e,t){switch(e){case"author":return t.contentPlayer.infoFieldAuthor;case"license":return t.contentPlayer.infoFieldLicense;case"language":return t.contentPlayer.infoFieldLanguage;case"gradeLevel":return t.contentPlayer.infoFieldClass;case"subject":return t.contentPlayer.infoFieldSubject;case"contentType":return t.contentPlayer.infoFieldType;default:return e}}function lI({node:e}){const t=le(),r=e.metadata??{},n=iI.flatMap(o=>{const a=r[o.key];if(!a)return[];const i=Array.isArray(a)?a.join(", "):String(a);return i?[{...o,label:sI(o.key,t),val:i}]:[]});return n.length?c.jsx("div",{className:je.infoStrip,children:n.map(o=>c.jsxs("div",{className:je.infoChip,children:[o.icon&&c.jsx(o.icon,{size:13,className:je.infoChipIcon}),c.jsx("span",{className:je.infoChipLabel,children:o.label}),o.val]},o.key))}):null}function Yh({node:e,hidden:t}){var o;const r=le(),n=e.appIcon??((o=e.metadata)==null?void 0:o.appIcon);return c.jsx("div",{className:`${je.coverOverlay} ${t?je.coverHidden:""}`,children:n?c.jsxs(c.Fragment,{children:[c.jsx("img",{src:n,alt:e.name,className:je.coverThumb}),c.jsx("div",{className:je.coverPlayRing,children:c.jsx("div",{className:je.coverPlayIcon})}),c.jsx("span",{className:je.coverLabel,children:r.contentPlayer.loadingPreview})]}):c.jsx("div",{className:je.coverSkeleton})})}function Zh({message:e}){return c.jsxs("div",{className:je.playerError,children:[c.jsx(Yy,{size:28,className:je.playerErrorIcon}),c.jsx("span",{className:je.playerErrorMsg,children:e})]})}function cI({mimeType:e}){const t=le(),r=ZE(e);return c.jsxs("span",{className:je.typeBadge,"data-type":r.key,children:[c.jsx("span",{className:je.typeDot}),XE(r.key,t)]})}const El=({node:e,editorMode:t,type:r,singleQuestion:n,layout:o="fill"})=>{var i;if(r==="quml")return c.jsx(uI,{node:e,editorMode:t,singleQuestion:!!n});const a=e.appIcon??((i=e.metadata)==null?void 0:i.appIcon);return c.jsxs("div",{className:`${je.contentPlayerRoot} ${o==="flow"?je.flowLayout:""}`,children:[c.jsxs("div",{className:je.stage,children:[c.jsxs("div",{className:je.playerHeader,children:[a&&c.jsx("img",{src:a,alt:"",className:je.playerHeaderThumb}),c.jsx("span",{className:je.playerHeaderTitle,children:e.name}),c.jsx(cI,{mimeType:e.mimeType??""})]}),c.jsx(dI,{node:e})]}),c.jsx(lI,{node:e})]})};function dI({node:e}){var v;const t=le(),r=ce(b=>b.editorConfig),[n,o]=h.useState(()=>Tl(e.mimeType??"")),[a,i]=h.useState(!1),[s,l]=h.useState(null),[d,f]=h.useState(e.metadata??{}),[u,m]=h.useState(!1),g=h.useRef(null),w=h.useRef(null),p=((v=r==null?void 0:r.config)==null?void 0:v.previewCdnUrl)??rI;h.useEffect(()=>{let b=!1;return m(!1),i(!1),l(null),f(e.metadata??{}),o(Tl(e.mimeType??"")),VE(e.identifier).then(C=>{if(b)return;const S={...e.metadata??{},...C};f(S);const T=C.mimeType??e.mimeType??"";o(Tl(T)),m(!0)}).catch(()=>{b||m(!0)}),()=>{b=!0}},[e.identifier]);const y=nI(e,d,r);return h.useEffect(()=>{if(!u||n!=="default-player")return;const b=g.current;if(!b)return;b.src=p;const C=()=>{try{const T=b.contentWindow;if(typeof(T==null?void 0:T.initializePreview)!="function"){l(t.contentPlayer.previewPlayerUnavailable);return}T.initializePreview(y),setTimeout(()=>i(!0),300)}catch(T){console.error("[ContentPlayer] initializePreview failed",T),l(t.contentPlayer.failedToInitializePlayer)}},S=()=>l(t.contentPlayer.previewPlayerLoadFailed);return b.addEventListener("load",C),b.addEventListener("error",S),()=>{b.removeEventListener("load",C),b.removeEventListener("error",S),b.src=""}},[e.identifier,n,p,u,t]),h.useEffect(()=>{if(!u||n==="default-player")return;const b=w.current;if(!b)return;const C=tI[n];if(!C)return;const S=y;aI(C,n).then(()=>{if(!w.current)return;if(!customElements.get(C)){o("default-player");return}const T=document.createElement(C);T.setAttribute("player-config",JSON.stringify(S)),T.addEventListener("playerEvent",()=>{}),T.addEventListener("telemetryEvent",()=>{}),b.innerHTML="",b.appendChild(T),setTimeout(()=>{try{T.playerConfig=S}catch{}i(!0)},200)}).catch(()=>{console.warn(`[ContentPlayer] ${n} script unavailable, falling back to iframe`),o("default-player")})},[e.identifier,n,u]),c.jsxs("div",{className:je.aspectRatio,children:[s?c.jsx(Zh,{message:s}):c.jsx(Yh,{node:e,hidden:a}),n==="default-player"?c.jsx("iframe",{ref:g,id:"contentPlayer",title:e.name,className:je.playerFrame,name:"contentPlayer",allowFullScreen:!0}):c.jsx("div",{ref:w,className:je.playerFrame})]})}function uI({node:e,editorMode:t,singleQuestion:r}){const n=le(),o=ce(g=>g.editorConfig),a=Ae(g=>g.treeData),i=h.useRef(null),s=r?KE(a,e.id):e.identifier,{data:l,isLoading:d,error:f}=RE(s??"",{enabled:!!s}),u=h.useMemo(()=>l?r?HE(l,e.identifier):l:null,[l,r,e.identifier]);h.useEffect(()=>{const g=i.current;if(!g||!u)return;let w=null,p=!1;return(async()=>{try{const y=await ui.createConfig(u,o==null?void 0:o.context,{mode:t==="edit"?"edit":"play"});if(p||!i.current)return;const v=ui.createElement(y);w=v,ui.attachEventListeners(v,b=>console.debug("[QumlPlayer] playerEvent",b.detail),b=>console.debug("[QumlPlayer] telemetryEvent",b)),g.innerHTML="",g.appendChild(v)}catch(y){console.error("[QumlPlayer] failed to initialize",y)}})(),()=>{p=!0,w&&(ui.removeEventListeners(w),w.remove()),di.unloadStyles()}},[u,o,t,r]);const m=f?`${n.contentPlayer.unableToLoadQuestionset} ${f.message}`:r&&!s?n.contentPlayer.parentQuestionsetNotResolved:r&&l&&!u?n.contentPlayer.questionNotFoundInQuestionset:null;return c.jsxs("div",{className:je.qumlRoot,children:[m?c.jsx(Zh,{message:m}):d||!u?c.jsx(Yh,{node:e,hidden:!1}):null,c.jsx("div",{ref:i,className:je.playerWrapper})]})}const Rt={overlay:"_overlay_ifddx_1",modal:"_modal_ifddx_11",header:"_header_ifddx_21",body:"_body_ifddx_37",hint:"_hint_ifddx_43",list:"_list_ifddx_49",item:"_item_ifddx_55",selected:"_selected_ifddx_68",empty:"_empty_ifddx_73",footer:"_footer_ifddx_79",cancelBtn:"_cancelBtn_ifddx_87",moveBtn:"_moveBtn_ifddx_95"};function fI(e,t,r){const n=[],o=a=>{var i;for(const s of a)s.isFolder&&s.id!==r&&s.id!==t&&n.push(s),(i=s.children)!=null&&i.length&&o(s.children)};return o(e),n}const hI=({resourceId:e,resourceName:t,currentUnitId:r,onClose:n})=>{var u;const o=le(),{treeData:a,moveNode:i}=Ae(),s=fI(a,((u=a[0])==null?void 0:u.id)??"",r),[l,d]=h.useState(null),f=()=>{l&&(i(e,r,l),n())};return c.jsx("div",{className:Rt.overlay,role:"dialog","aria-label":o.resourceReorderDialog.dialogAriaLabel,children:c.jsxs("div",{className:Rt.modal,children:[c.jsxs("div",{className:Rt.header,children:[c.jsxs("span",{children:[o.resourceReorderDialog.moveHeaderPrefix,' "',t,'"']}),c.jsx("button",{onClick:n,"aria-label":o.resourceReorderDialog.closeAriaLabel,children:c.jsx(yr,{size:16})})]}),c.jsxs("div",{className:Rt.body,children:[c.jsx("p",{className:Rt.hint,children:o.resourceReorderDialog.selectUnitHint}),c.jsxs("ul",{className:Rt.list,children:[s.map(m=>c.jsxs("li",{className:`${Rt.item} ${l===m.id?Rt.selected:""}`,onClick:()=>d(m.id),children:[c.jsx(Py,{size:14}),c.jsx("span",{children:m.name})]},m.id)),s.length===0&&c.jsx("li",{className:Rt.empty,children:o.resourceReorderDialog.noUnitsAvailable})]})]}),c.jsxs("div",{className:Rt.footer,children:[c.jsx("button",{className:Rt.cancelBtn,onClick:n,children:o.resourceReorderDialog.cancelButton}),c.jsx("button",{className:Rt.moveBtn,onClick:f,disabled:!l,children:o.resourceReorderDialog.moveButton})]})]})})},lr={overlay:"_overlay_16at9_1",modal:"_modal_16at9_11",header:"_header_16at9_21",body:"_body_16at9_37",table:"_table_16at9_43",pageInput:"_pageInput_16at9_61",empty:"_empty_16at9_68",footer:"_footer_16at9_74",cancelBtn:"_cancelBtn_16at9_82",saveBtn:"_saveBtn_16at9_90"};function pI(e){const t=[],r=n=>{var o;for(const a of n)!a.isFolder&&(!a.children||a.children.length===0)?t.push(a):(o=a.children)!=null&&o.length&&r(a.children)};return r(e),t}const gI=({onClose:e})=>{const t=le(),{treeData:r,updateNode:n}=Ae(),o=pI(r),[a,i]=h.useState(()=>Object.fromEntries(o.map(l=>{var d;return[l.id,String(((d=l.metadata)==null?void 0:d.pageNumber)??"")]}))),s=h.useCallback(()=>{for(const[l,d]of Object.entries(a))d!==""&&n(l,{pageNumber:parseInt(d,10)||void 0});e()},[a,n,e]);return c.jsx("div",{className:lr.overlay,role:"dialog","aria-label":t.assignPageNumber.dialogAriaLabel,children:c.jsxs("div",{className:lr.modal,children:[c.jsxs("div",{className:lr.header,children:[c.jsx("span",{children:t.assignPageNumber.title}),c.jsx("button",{onClick:e,"aria-label":t.assignPageNumber.closeAriaLabel,children:c.jsx(yr,{size:16})})]}),c.jsx("div",{className:lr.body,children:o.length===0?c.jsx("p",{className:lr.empty,children:t.assignPageNumber.emptyState}):c.jsxs("table",{className:lr.table,children:[c.jsx("thead",{children:c.jsxs("tr",{children:[c.jsx("th",{children:t.assignPageNumber.contentColumnHeader}),c.jsx("th",{children:t.assignPageNumber.pageNumberColumnHeader})]})}),c.jsx("tbody",{children:o.map(l=>c.jsxs("tr",{children:[c.jsx("td",{children:l.name}),c.jsx("td",{children:c.jsx("input",{type:"number",min:1,value:a[l.id]??"",onChange:d=>i(f=>({...f,[l.id]:d.target.value})),className:lr.pageInput})})]},l.id))})]})}),c.jsxs("div",{className:lr.footer,children:[c.jsx("button",{className:lr.cancelBtn,onClick:e,children:t.assignPageNumber.cancelButton}),c.jsxs("button",{className:lr.saveBtn,onClick:s,children:[c.jsx(Vy,{size:14})," ",t.assignPageNumber.saveButton]})]})]})})},Ge={container:"_container_1a7t2_1",panelHeader:"_panelHeader_1a7t2_10",panelHeaderLeft:"_panelHeaderLeft_1a7t2_19",panelCollapseBtn:"_panelCollapseBtn_1a7t2_27",titleRow:"_titleRow_1a7t2_46",field:"_field_1a7t2_47",moveBtn:"_moveBtn_1a7t2_64",icon:"_icon_1a7t2_84",nameInput:"_nameInput_1a7t2_93",fieldHeader:"_fieldHeader_1a7t2_118",label:"_label_1a7t2_124",fieldCount:"_fieldCount_1a7t2_133",chips:"_chips_1a7t2_170",chip:"_chip_1a7t2_170",chipRemove:"_chipRemove_1a7t2_188",keywordInput:"_keywordInput_1a7t2_202",input:"_input_1a7t2_207",addBtn:"_addBtn_1a7t2_220",radioGroup:"_radioGroup_1a7t2_234",radioLabel:"_radioLabel_1a7t2_239"},mI=({node:e,editorMode:t,onMoveClick:r,reorderDialog:n})=>{var L,B;const{updateNode:o,markDirty:a}=Ae(),i=t==="edit",s=Ja(e),l=le(),d=ce(P=>P.relationalFormConfig),f=P=>d==null?void 0:d.find(F=>F.code===P),u=P=>!d||!!f(P),m=(P,F)=>{var V;return((V=f(P))==null?void 0:V.label)||F},[g,w]=h.useState(!0),p=((L=e.metadata)==null?void 0:L.relationalMetadata)??{},[y,v]=h.useState(p.name??e.name??""),[b,C]=h.useState(""),[S,T]=h.useState(Array.isArray(p.keywords)?p.keywords:Array.isArray((B=e.metadata)==null?void 0:B.keywords)?e.metadata.keywords:[]),[I,k]=h.useState(!!p.optional);h.useEffect(()=>{var F,V;const P=((F=e.metadata)==null?void 0:F.relationalMetadata)??{};v(P.name??e.name??""),T(Array.isArray(P.keywords)?P.keywords:Array.isArray((V=e.metadata)==null?void 0:V.keywords)?e.metadata.keywords:[]),k(!!P.optional)},[e.id]);const x=()=>{y.trim()&&y!==e.name&&(o(e.id,{name:y.trim()}),a())},$=()=>{const P=b.trim();if(P&&!S.includes(P)){const F=[...S,P];T(F),o(e.id,{keywords:F}),a()}C("")},j=P=>{const F=S.filter(V=>V!==P);T(F),o(e.id,{keywords:F}),a()},N=P=>{k(P),o(e.id,{optional:P}),a()};return c.jsxs("div",{className:Ge.container,children:[c.jsxs("div",{className:Ge.panelHeader,children:[c.jsxs("div",{className:Ge.panelHeaderLeft,children:[c.jsx("span",{className:`sbx-ct-badge--${s.key}`,children:s.label}),i&&c.jsx("button",{type:"button",className:Ge.moveBtn,onClick:r,children:l.contentEditForm.moveToAnotherUnitButton})]}),c.jsx("button",{type:"button",className:Ge.panelCollapseBtn,onClick:()=>w(P=>!P),"aria-expanded":g,"aria-label":g?l.contentEditForm.collapseMetadataPanelAriaLabel:l.contentEditForm.expandMetadataPanelAriaLabel,title:g?l.contentEditForm.collapseTitle:l.contentEditForm.expandTitle,children:g?c.jsx(Cn,{size:15}):c.jsx(Ny,{size:15})})]}),g&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:Ge.titleRow,children:[e.appIcon&&c.jsx("img",{src:e.appIcon,alt:l.contentEditForm.iconAlt,className:Ge.icon}),c.jsx("input",{type:"text",className:Ge.nameInput,value:y,disabled:!i,onChange:P=>v(P.target.value),onBlur:x,placeholder:l.contentEditForm.contentNamePlaceholder})]}),u("keywords")&&c.jsxs("div",{className:Ge.field,children:[c.jsx("div",{className:Ge.fieldHeader,children:c.jsxs("label",{className:Ge.label,children:[m("keywords",l.contentEditForm.keywordsLabel),S.length>0&&c.jsx("span",{className:Ge.fieldCount,children:S.length})]})}),S.length>0&&c.jsx("div",{className:Ge.chips,children:S.map(P=>c.jsxs("span",{className:Ge.chip,children:[P,i&&c.jsx("button",{type:"button",className:Ge.chipRemove,onClick:()=>j(P),children:"×"})]},P))}),i&&c.jsxs("div",{className:Ge.keywordInput,children:[c.jsx("input",{type:"text",className:Ge.input,value:b,placeholder:l.contentEditForm.addKeywordPlaceholder,onChange:P=>C(P.target.value),onKeyDown:P=>{P.key==="Enter"&&(P.preventDefault(),$())}}),c.jsx("button",{type:"button",className:Ge.addBtn,onClick:$,children:l.contentEditForm.addButton})]})]}),u("optional")&&c.jsxs("div",{className:Ge.field,children:[c.jsx("label",{className:Ge.label,children:m("optional",l.contentEditForm.optionalInCollectionLabel)}),c.jsxs("div",{className:Ge.radioGroup,children:[c.jsxs("label",{className:Ge.radioLabel,children:[c.jsx("input",{type:"radio",name:`optional-${e.id}`,checked:I===!0,onChange:()=>N(!0),disabled:!i}),l.contentEditForm.yesOption]}),c.jsxs("label",{className:Ge.radioLabel,children:[c.jsx("input",{type:"radio",name:`optional-${e.id}`,checked:I===!1,onChange:()=>N(!1),disabled:!i}),l.contentEditForm.noOption]})]})]})]}),n]})},$o={iconBtn:"_iconBtn_vl14u_1",editable:"_editable_vl14u_14",iconImg:"_iconImg_vl14u_26",placeholder:"_placeholder_vl14u_34",removeBtn:"_removeBtn_vl14u_41"},yI=({nodeId:e,value:t,editable:r})=>{const[n,o]=h.useState(!1),{updateNode:a,markDirty:i}=Ae(),s=le(),l=f=>{a(e,{appIcon:f}),i(),o(!1)},d=f=>{f.stopPropagation(),a(e,{appIcon:""}),i()};return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:[$o.iconBtn,r?$o.editable:""].filter(Boolean).join(" "),role:r?"button":void 0,tabIndex:r?0:-1,"aria-label":r?s.titleAppIcon.selectAppIconAriaLabel:s.titleAppIcon.appIconAriaLabel,onClick:()=>r&&o(!0),onKeyDown:f=>{r&&(f.key==="Enter"||f.key===" ")&&o(!0)},children:[t?c.jsx("img",{src:t,alt:s.titleAppIcon.appIconAlt,className:$o.iconImg}):c.jsx("div",{className:$o.placeholder,children:c.jsx(Jc,{size:18})}),t&&r&&c.jsx("button",{type:"button",className:$o.removeBtn,onClick:d,"aria-label":s.titleAppIcon.removeIconAriaLabel,children:c.jsx(Zi,{size:11})})]}),n&&c.jsx(Mh,{nodeId:e,currentValue:t,onSelect:l,onClose:()=>o(!1)})]})},rr={leafContentLayout:"_leafContentLayout_1lchu_1",container:"_container_1lchu_15",emptyState:"_emptyState_1lchu_24",titleRow:"_titleRow_1lchu_34",nodeTitle:"_nodeTitle_1lchu_50",formArea:"_formArea_1lchu_72",contentListArea:"_contentListArea_1lchu_76",dropZone:"_dropZone_1lchu_81",reviewComment:"_reviewComment_1lchu_88",reviewCommentLabel:"_reviewCommentLabel_1lchu_101",reviewCommentText:"_reviewCommentText_1lchu_107"},vI="application/vnd.sunbird.questionset",Xh="application/vnd.sunbird.question",bI=[vI,Xh];function Jh(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 wI=({editorMode:e,onToolbarEvent:t})=>{var B;const r=le(),[n,o]=h.useState("details"),[a,i]=h.useState([]),[s,l]=h.useState(null),[d,f]=h.useState(!1),u=h.useRef(null),m=h.useRef(),{selectedNodeId:g,breadcrumb:w,activeNodeMeta:p,updateNode:y,treeData:v}=Ae(),b=ce(P=>{var F,V,X,ve;return((V=(F=P.editorConfig)==null?void 0:F.context)==null?void 0:V.contentId)??((ve=(X=P.editorConfig)==null?void 0:X.context)==null?void 0:ve.identifier)??""}),C=g?ep(v,g):null,S=!!C&&!C.parent,T=!!(C!=null&&C.isFolder),I=C&&bI.includes(C.mimeType??""),k=(C==null?void 0:C.mimeType)===Xh,x=C&&!C.isFolder&&!I&&!S,$=Jh(C)??(S?Jh(v[0]):void 0),j=h.useCallback(()=>{const P=u.current;if(!P||!g)return;const F=P.innerText.trim();clearTimeout(m.current),m.current=setTimeout(()=>{y(g,{name:F})},600)},[g,y]),N=h.useCallback(P=>{t({action:"onFormValueChange",data:P})},[t]),L=h.useCallback((P,F)=>{i(F),t({action:"onFormStatusChange",data:{isValid:P,nodeId:g}})},[t,g]);return C?I?c.jsx(El,{node:C,editorMode:e,type:"quml",singleQuestion:k}):x?c.jsxs("div",{className:rr.leafContentLayout,children:[c.jsx(El,{node:C,editorMode:e,type:"content",layout:"flow"}),c.jsx(mI,{node:C,editorMode:e,onMoveClick:()=>l(C.identifier),reorderDialog:s?c.jsx(hI,{resourceId:s,resourceName:C.name,currentUnitId:C.parent??"",onClose:()=>l(null)}):null})]}):c.jsxs("div",{className:rr.container,children:[c.jsx(f1,{crumbs:w}),$&&c.jsxs("div",{className:rr.reviewComment,role:"alert",children:[c.jsx("span",{className:rr.reviewCommentLabel,children:r.contextualEditor.reviewCommentLabel}),c.jsx("span",{className:rr.reviewCommentText,children:$})]}),c.jsxs("div",{className:rr.titleRow,children:[S&&g&&c.jsx(yI,{nodeId:g,value:String(C.appIcon??((B=C.metadata)==null?void 0:B.appIcon)??""),editable:e==="edit"}),c.jsx("div",{ref:u,className:rr.nodeTitle,contentEditable:e==="edit",suppressContentEditableWarning:!0,onInput:j,onBlur:j,"data-placeholder":r.contextualEditor.untitledPlaceholder,"aria-label":r.contextualEditor.nodeTitleAriaLabel,children:C.name})]}),c.jsx(h1,{activeTab:n,onChange:P=>o(P),errorTabs:a,visibleTabs:S?void 0:["details"]}),c.jsx("div",{className:rr.formArea,children:c.jsx(wE,{nodeMetadata:p,activeTab:n,isRoot:S,isFolder:T,editorMode:e,onFormValueChange:N,onFormStatusChange:L},`${g??"none"}:${S?"root":"node"}`)}),(T||S)&&n==="details"&&c.jsx("div",{className:rr.contentListArea,children:c.jsx(qE,{editorMode:e})}),c.jsx(UE,{isActive:!1,label:r.contextualEditor.dropZoneLabel,nodeId:g??void 0,className:rr.dropZone}),d&&c.jsx(gI,{contentId:b,onClose:()=>f(!1)})]}):c.jsx("div",{className:rr.emptyState,children:c.jsx("p",{children:r.contextualEditor.emptyStateMessage})})};function ep(e,t){for(const r of e){if(r.id===t)return r;if(r.children){const n=ep(r.children,t);if(n)return n}}}const tp=yo((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 a=[...t().allContent,...r];e({allContent:a,totalCount:n,offset:a.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:o}=t();let a=r;if(n&&n!=="all"){const i=n.toLowerCase();a=a.filter(s=>[s.mimeType??"",s.primaryCategory??"",s.contentType??""].join(" ").toLowerCase().includes(i))}if(o&&o.trim()!==""){const i=o.toLowerCase().trim();a=a.filter(s=>(s.name??"").toLowerCase().includes(i))}e({filteredContent:a})}})),CI=20;function rp(){var d;const e=ce(f=>f.editorConfig),t=Ae(f=>f.selectedNodeId),r=Ae(f=>f.treeData),n=h.useCallback(()=>{if(!t||!r.length)return 0;function f(u,m,g=0){var w;for(const p of u){if(p.id===m)return g;if((w=p.children)!=null&&w.length){const y=f(p.children,m,g+1);if(y>=0)return y}}return-1}return Math.max(0,f(r,t))},[t,r])(),o=(d=e==null?void 0:e.config)==null?void 0:d.hierarchy;if(!o)return[...Jf];const a=`level${n}`,i=o[a],s=i==null?void 0:i.children,l=s==null?void 0:s.Content;return l!=null&&l.length?l:[...Jf]}function SI(){const e=tp(),t=ce(u=>{var m,g;return((g=(m=u.editorConfig)==null?void 0:m.context)==null?void 0:g.channel)??""}),r=rp(),n=h.useRef(),o=h.useCallback(async(u="",m="all",g={},w=!0,p=!1)=>{var y,v,b,C,S;e.setLoading(!0);try{const T={status:["Live"],primaryCategory:m&&m!=="all"?[m]:r};(y=g==null?void 0:g.board)!=null&&y.length&&(T.board=g.board),(v=g==null?void 0:g.medium)!=null&&v.length&&(T.medium=g.medium),(b=g==null?void 0:g.gradeLevel)!=null&&b.length&&(T.gradeLevel=g.gradeLevel),(C=g==null?void 0:g.subject)!=null&&C.length&&(T.subject=g.subject),(S=g==null?void 0:g.primaryCategory)!=null&&S.length&&(T.primaryCategory=g.primaryCategory);const I=w?0:e.offset,{content:k,count:x}=await zE({filters:T,query:u,limit:u?50:CI,offset:I,channel:t||void 0,sortBy:p?{name:"asc"}:{lastUpdatedOn:"desc"}});w?e.setContent(k,x):e.appendContent(k,x)}catch(T){console.error("[useLibrary] load error:",T)}finally{e.setLoading(!1)}},[r,t]);h.useEffect(()=>{o()},[t]);const a=h.useCallback(u=>{e.setSearch(u),clearTimeout(n.current),n.current=setTimeout(()=>o(u,e.activeFilter,e.advancedFilters,!0,e.sortAZ),300)},[e.activeFilter,e.advancedFilters,e.sortAZ,o]),i=h.useCallback(u=>{e.setFilter(u),o(e.searchQuery,u,e.advancedFilters,!0,e.sortAZ)},[e.searchQuery,e.advancedFilters,e.sortAZ,o]),s=h.useCallback(u=>{e.setAdvancedFilters(u),o(e.searchQuery,e.activeFilter,u,!0,e.sortAZ)},[e.searchQuery,e.activeFilter,e.sortAZ,o]),l=h.useCallback(()=>{const u=!e.sortAZ;e.setSortAZ(u),o(e.searchQuery,e.activeFilter,e.advancedFilters,!0,u)},[e.sortAZ,e.searchQuery,e.activeFilter,e.advancedFilters,o]),d=h.useCallback(()=>{e.isLoading||o(e.searchQuery,e.activeFilter,e.advancedFilters,!1,e.sortAZ)},[e.isLoading,e.searchQuery,e.activeFilter,e.advancedFilters,e.sortAZ,o]),f=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:f,search:a,setFilter:i,applyAdvancedFilters:s,toggleSort:l,loadMore:d,refetch:()=>o(e.searchQuery,e.activeFilter,e.advancedFilters,!0,e.sortAZ)}}const cr={card:"_card_jzciw_1",addBtn:"_addBtn_jzciw_17",dragging:"_dragging_jzciw_24",ctIcon:"_ctIcon_jzciw_29",info:"_info_jzciw_33",name:"_name_jzciw_41",meta:"_meta_jzciw_50",addBtnMuted:"_addBtnMuted_jzciw_78",added:"_added_jzciw_87",addedBadge:"_addedBadge_jzciw_96"},_I={video:Ji,pdf:ba,h5p:Gi,scorm:Ki,audio:Wi,quiz:Ri,default:Sn},TI=({item:e,onAdd:t,onPreview:r,isDraggable:n,isAdded:o})=>{var y,v;const a=le(),i=Ja(e),s=_I[i.key]??Sn,l=al(),d=e1(),f=l&&!o&&d,{attributes:u,listeners:m,setNodeRef:g,isDragging:w}=Hc({id:e.identifier,disabled:!n||!l||!d,data:{type:"library-item",item:e}}),p=()=>{r&&r(e)};return c.jsxs("div",{ref:g,className:[cr.card,w?cr.dragging:"",o?cr.added:""].join(" "),"aria-label":e.name,...n?{...u,...m}:{},role:"listitem",onClick:p,children:[c.jsx("span",{className:[`sbx-ct-sq--${i.key}`,cr.ctIcon].join(" "),"aria-hidden":"true",children:c.jsx(s,{size:14})}),c.jsxs("div",{className:cr.info,children:[c.jsx("span",{className:cr.name,title:e.name,children:e.name}),c.jsxs("span",{className:cr.meta,children:[((y=e.organisation)==null?void 0:y[0])??e.channel??"",(v=e.organisation)!=null&&v[0]&&e.primaryCategory?" · ":"",e.primaryCategory??""]})]}),o&&c.jsx("span",{className:cr.addedBadge,"aria-label":a.libraryCard.alreadyAddedAriaLabel,title:a.libraryCard.alreadyAddedTitle,children:c.jsx(wn,{size:12})}),!o&&n&&c.jsx("button",{type:"button",className:[cr.addBtn,!f&&l?cr.addBtnMuted:""].join(" "),onClick:b=>{b.stopPropagation(),t(e)},disabled:!l,"aria-disabled":!f,"aria-label":a.libraryCard.addItemAriaLabel.replace("{name}",e.name),title:l?d?a.libraryCard.addToUnitTitle:a.libraryCard.selectUnitToAddTitle:a.libraryCard.draftOnlyTitle,children:c.jsx(mo,{size:14})})]})},np={chips:"_chips_xhhaq_1",chip:"_chip_xhhaq_1"},EI=({filters:e,active:t,onChange:r})=>{const n=le();return c.jsx("div",{className:np.chips,role:"group","aria-label":n.filterChips.contentTypeFiltersAriaLabel,children:e.map(o=>c.jsx("button",{type:"button",role:"radio","aria-checked":t===o.value,className:["sbx-chip",t===o.value?"filled":"outline",np.chip].join(" "),onClick:()=>r(o.value),children:o.label},o.value))})},it={panel:"_panel_1cl11_1",header:"_header_1cl11_10",headerTitle:"_headerTitle_1cl11_19",closeBtn:"_closeBtn_1cl11_25",body:"_body_1cl11_43",section:"_section_1cl11_59",sectionLabel:"_sectionLabel_1cl11_65",chips:"_chips_1cl11_73",chip:"_chip_1cl11_73",active:"_active_1cl11_96",footer:"_footer_1cl11_102",resetBtn:"_resetBtn_1cl11_112",applyBtn:"_applyBtn_1cl11_129"},II=e=>[{key:"board",label:e.libraryFilterPanel.boardLabel},{key:"medium",label:e.libraryFilterPanel.mediumLabel},{key:"gradeLevel",label:e.libraryFilterPanel.classLabel},{key:"subject",label:e.libraryFilterPanel.subjectLabel}],OI=new Set(["board","medium","gradeLevel","subject","topic"]),AI=({local:e,toggle:t})=>{const r=le(),n=rp();return n.length?c.jsxs("div",{className:it.section,children:[c.jsx("div",{className:it.sectionLabel,children:r.libraryFilterPanel.primaryCategoryLabel}),c.jsx("div",{className:it.chips,children:n.map(o=>c.jsx("button",{type:"button",className:[it.chip,(e.primaryCategory??[]).includes(o)?it.active:""].join(" "),onClick:()=>t("primaryCategory",o),children:o},o))})]}):null},DI=({isOpen:e,filters:t,onApply:r,onClose:n})=>{var y,v;const o=le(),a=ce(b=>b.editorConfig),i=ce(b=>b.searchFormConfig),s=ce(b=>b.contentFramework),l=ce(b=>b.contentTargetFWIds),{organisationFramework:d}=Ah(s??((y=a==null?void 0:a.context)==null?void 0:y.framework),l??((v=a==null?void 0:a.context)==null?void 0:v.targetFWIds)),[f,u]=h.useState(t),m=i!=null&&i.length?i.filter(b=>OI.has(b.code)).map(b=>({key:b.code,label:b.label||b.code})):II(o);h.useEffect(()=>{u(t)},[t]);const g=(b,C)=>{u(S=>{const T=S[b]??[],I=T.includes(C)?T.filter(k=>k!==C):[...T,C];return{...S,[b]:I}})},w=(d==null?void 0:d.categories)??[],p=b=>{var C;return((C=w.find(S=>S.code===b))==null?void 0:C.terms)??[]};return e?c.jsxs("div",{className:it.panel,role:"dialog","aria-label":o.libraryFilterPanel.filterLibraryAriaLabel,"aria-modal":"true",children:[c.jsxs("div",{className:it.header,children:[c.jsx("span",{className:it.headerTitle,children:o.libraryFilterPanel.filtersHeaderTitle}),c.jsx("button",{type:"button",className:it.closeBtn,onClick:n,"aria-label":o.libraryFilterPanel.closeFiltersAriaLabel,children:c.jsx(yr,{size:16})})]}),c.jsxs("div",{className:it.body,children:[m.map(({key:b,label:C})=>{const S=p(b);return S.length?c.jsxs("div",{className:it.section,children:[c.jsx("div",{className:it.sectionLabel,children:C}),c.jsx("div",{className:it.chips,children:S.slice(0,20).map(T=>c.jsx("button",{type:"button",className:[it.chip,(f[b]??[]).includes(T.name)?it.active:""].join(" "),onClick:()=>g(b,T.name),children:T.name},T.identifier))})]},b):null}),c.jsx(AI,{local:f,toggle:g})]}),c.jsxs("div",{className:it.footer,children:[c.jsx("button",{type:"button",className:it.resetBtn,onClick:()=>u({}),children:o.libraryFilterPanel.resetButton}),c.jsx("button",{type:"button",className:it.applyBtn,onClick:()=>{r(f),n()},children:o.libraryFilterPanel.applyButton})]})]}):null},vr={header:"_header_6qdpu_10",title:"_title_6qdpu_20",headerActions:"_headerActions_6qdpu_31",iconBtn:"_iconBtn_6qdpu_38",playerArea:"_playerArea_6qdpu_56",footer:"_footer_6qdpu_64",addBtn:"_addBtn_6qdpu_73",modalOverlay:"_modalOverlay_6qdpu_92",modalPanel:"_modalPanel_6qdpu_103"},NI="application/vnd.sunbird.questionset",kI=({content:e,editorMode:t,onAdd:r,onClose:n})=>{const o=le(),a=t==="edit";if(!e)return null;const i={id:e.identifier,identifier:e.identifier,name:e.name??"",mimeType:e.mimeType,primaryCategory:e.primaryCategory,contentType:e.contentType,appIcon:e.appIcon,status:e.status,isFolder:!1,children:[],metadata:e};return Pe.createPortal(c.jsx("div",{className:vr.modalOverlay,role:"dialog","aria-modal":"true","aria-label":o.libraryPreviewPanel.contentPreviewAriaLabel,onClick:n,children:c.jsxs("div",{className:vr.modalPanel,onClick:s=>s.stopPropagation(),children:[c.jsxs("div",{className:vr.header,children:[c.jsx("span",{className:vr.title,title:e.name,children:e.name}),c.jsx("div",{className:vr.headerActions,children:c.jsx("button",{type:"button",className:vr.iconBtn,onClick:n,"aria-label":o.libraryPreviewPanel.closePreviewAriaLabel,children:c.jsx(yr,{size:16})})})]}),c.jsx("div",{className:vr.playerArea,children:c.jsx(El,{node:i,editorMode:"read",type:e.mimeType===NI?"quml":"content"})}),a&&c.jsx("div",{className:vr.footer,children:c.jsx("button",{type:"button",className:vr.addBtn,onClick:()=>r(e),children:o.libraryPreviewPanel.addToUnitButton})})]})}),document.body)},Ue={dock:"_dock_1lpg0_1",header:"_header_1lpg0_8",headerLeft:"_headerLeft_1lpg0_17",headerTitle:"_headerTitle_1lpg0_24",count:"_count_1lpg0_30",searchRow:"_searchRow_1lpg0_39",searchWrap:"_searchWrap_1lpg0_47",searchIcon:"_searchIcon_1lpg0_53",searchInput:"_searchInput_1lpg0_62",filterToggleBtn:"_filterToggleBtn_1lpg0_80",filterToggleBtnActive:"_filterToggleBtnActive_1lpg0_99",filterBadge:"_filterBadge_1lpg0_105",filters:"_filters_1lpg0_124",mainArea:"_mainArea_1lpg0_134",sidePanelOverlay:"_sidePanelOverlay_1lpg0_143",cardList:"_cardList_1lpg0_152",skeleton:"_skeleton_1lpg0_168",skeletonIcon:"_skeletonIcon_1lpg0_178",skeletonText:"_skeletonText_1lpg0_186",skeletonLine:"_skeletonLine_1lpg0_193",skeletonLineSm:"_skeletonLineSm_1lpg0_200",loadMoreBtn:"_loadMoreBtn_1lpg0_215",emptyState:"_emptyState_1lpg0_240",collapseBtn:"_collapseBtn_1lpg0_260"};function xI(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 LI=({editorMode:e,collapsed:t=!1,onToggleCollapse:r})=>{const n=le(),{content:o,isLoading:a,totalCount:i,activeFilter:s,searchQuery:l,sortAZ:d,hasMore:f,search:u,setFilter:m,applyAdvancedFilters:g,toggleSort:w,loadMore:p}=SI(),{addResource:y,selectedNodeId:v,treeData:b}=Ae(),C=e==="edit",[S,T]=h.useState(!1),[I,k]=h.useState({}),[x,$]=h.useState(null),j=h.useMemo(()=>xI(b),[b]),N=h.useCallback(V=>{var Ee;if(!v){Ie.error(n.libraryDock.selectUnitFirstToast);return}const X=(Ee=b[0])==null?void 0:Ee.id;if(v===X){Ie(n.libraryDock.selectUnitFromOutlineToast,{icon:c.jsx(Qi,{size:16}),duration:4e3});return}if(y(V,v)===!1){Ie.error(n.libraryDock.itemAlreadyAddedToast.replace("{name}",V.name));return}Ie.success(n.libraryDock.itemAddedToast.replace("{name}",V.name))},[v,y,b,n]),L=h.useCallback(V=>{k(V),g(V)},[g]),B=h.useCallback(V=>{$(V)},[]),P=h.useCallback(V=>{N(V),$(null)},[N]),F=h.useMemo(()=>Object.values(I).reduce((V,X)=>V+((X==null?void 0:X.length)??0),0),[I]);return c.jsxs("div",{className:Ue.dock,children:[c.jsx("div",{className:Ue.header,children:c.jsxs("div",{className:Ue.headerLeft,children:[c.jsx("button",{type:"button",className:Ue.collapseBtn,onClick:r,"aria-label":n.libraryDock.collapseLibraryPanelAriaLabel,title:n.libraryDock.collapseLibraryTitle,children:c.jsx(Uy,{size:15})}),c.jsx(By,{size:16}),c.jsx("span",{className:Ue.headerTitle,children:n.libraryDock.headerTitle}),i>0&&c.jsx("span",{className:Ue.count,children:i})]})}),c.jsxs("div",{className:Ue.searchRow,children:[c.jsxs("div",{className:Ue.searchWrap,children:[c.jsx(Yi,{size:14,className:Ue.searchIcon}),c.jsx("input",{type:"search",className:Ue.searchInput,placeholder:n.libraryDock.searchPlaceholder,value:l,onChange:V=>u(V.target.value),"aria-label":n.libraryDock.searchAriaLabel})]}),c.jsx("button",{type:"button",className:[Ue.filterToggleBtn,d?Ue.filterToggleBtnActive:""].join(" "),onClick:w,"aria-label":d?n.libraryDock.sortAZAriaLabel:n.libraryDock.sortRecentAriaLabel,title:d?n.libraryDock.sortAZTitle:n.libraryDock.sortRecentTitle,children:d?c.jsx(Oy,{size:15}):c.jsx(xy,{size:15})}),c.jsxs("button",{type:"button",className:[Ue.filterToggleBtn,S?Ue.filterToggleBtnActive:""].join(" "),onClick:()=>T(V=>!V),"aria-label":n.libraryDock.toggleAdvancedFiltersAriaLabel,"aria-pressed":S,title:n.libraryDock.advancedFiltersTitle,children:[c.jsx(Wy,{size:15}),F>0&&c.jsx("span",{className:Ue.filterBadge,children:F})]})]}),c.jsx("div",{className:Ue.filters,children:c.jsx(EI,{filters:t1,active:s,onChange:m})}),c.jsxs("div",{className:Ue.mainArea,children:[c.jsx("div",{className:Ue.cardList,role:"list","aria-label":n.libraryDock.libraryContentAriaLabel,children:a&&o.length===0?Array.from({length:4}).map((V,X)=>c.jsxs("div",{className:Ue.skeleton,"aria-hidden":"true",children:[c.jsx("div",{className:Ue.skeletonIcon}),c.jsxs("div",{className:Ue.skeletonText,children:[c.jsx("div",{className:Ue.skeletonLine}),c.jsx("div",{className:Ue.skeletonLineSm})]})]},X)):o.length>0?c.jsxs(c.Fragment,{children:[o.map(V=>c.jsx(TI,{item:V,onAdd:N,onPreview:B,isDraggable:C,isAdded:j.has(V.identifier)},V.identifier)),f&&c.jsx("button",{type:"button",className:Ue.loadMoreBtn,onClick:p,disabled:a,"aria-label":n.libraryDock.loadMoreAriaLabel,children:a?n.libraryDock.loadingText:n.libraryDock.loadMoreText})]}):c.jsxs("div",{className:Ue.emptyState,children:[c.jsx(Yi,{size:24}),c.jsx("p",{children:n.libraryDock.noContentFound}),c.jsx("span",{children:n.libraryDock.tryDifferentSearch})]})}),S&&c.jsx("div",{className:Ue.sidePanelOverlay,children:c.jsx(DI,{isOpen:S,filters:I,onApply:L,onClose:()=>T(!1)})}),x&&c.jsx(kI,{content:x,editorMode:e,onAdd:P,onClose:()=>$(null)})]})]})};function PI(e,t,r){const n={},o={},a=new Set(["id","isFolder","children","parent","isNew","breadcrumb","title","relationalMetadata","optional"]),i=new Set(["targetBoardIds","targetMediumIds","targetGradeLevelIds","targetSubjectIds","targetFWIds","targetTopicIds","topic","topicsIds"]),s=new Set(["audience","attributions","keywords","language","additionalCategories","medium","gradeLevel","subject","boardIds","mediumIds","gradeLevelIds","subjectIds","targetBoardIds","targetMediumIds","targetGradeLevelIds","targetSubjectIds","dialcodes"]),l=new Set(["copyrightYear","compatibilityLevel","version"]);function d(m,g=!1){const w={};for(const[p,y]of Object.entries(m))if(!a.has(p)&&!(g&&i.has(p)))if(s.has(p))Array.isArray(y)?w[p]=y:y!=null&&y!==""?w[p]=[y]:w[p]=[];else if(l.has(p)){const v=Number(y);isNaN(v)||(w[p]=v)}else w[p]=y;return w}function f(m){var w;const g={};for(const p of m.children??[]){if(p.isFolder)continue;const y=t[p.identifier];if(!y)continue;const{isNew:v,...b}=y;if(Object.keys(b).length===0)continue;const C=((w=p.metadata)==null?void 0:w.relationalMetadata)??{};g[p.identifier]={name:p.name,...C,...b}}return g}function u(m,g){var C,S;const w=m.identifier,p=t[w],y=w.startsWith("temp-")||!!(p!=null&&p.isNew),v=!m.isFolder&&!g;if(g||y||p&&!v){let T;if(y)T={mimeType:"application/vnd.ekstep.content-collection",code:w,contentType:((C=m.metadata)==null?void 0:C.contentType)??"CourseUnit",primaryCategory:((S=m.metadata)==null?void 0:S.primaryCategory)??"Course Unit",name:m.name,visibility:"Parent",channel:r,...d(m.metadata??{})};else if(g){const{isNew:I,...k}=p??{};T={...d(m.metadata??{},!0),...d(k,!1),name:m.name}}else{const{isNew:I,...k}=p??{};T={name:m.name,visibility:"Parent",...d(k,!0)}}n[w]={metadata:T,objectType:m.objectType||(m.isFolder?"Collection":"Content"),root:g,isNew:y}}const b=m.isFolder?f(m):{};o[w]={name:m.name,children:(m.children??[]).map(T=>T.identifier),...Object.keys(b).length>0?{relationalMetadata:b}:{},root:g},(m.children??[]).forEach(T=>u(T,!1))}return e.forEach((m,g)=>u(m,g===0)),{nodesModified:n,hierarchy:o}}function FI(){const[e,t]=h.useState(!1),r=Ae(f=>f.treeCache),n=Ae(f=>f.treeData),o=ce(f=>f.isDirty),a=ce(f=>f.lastSaved),{setIsDirty:i,setLastSaved:s}=ce(),l=ce(f=>f.editorConfig);return{save:h.useCallback(async()=>{if(!l||e)return;const f=l.context.contentId??l.context.identifier??"";if(!f)return;const u=l.context.channel??"",m=l.context.userId??l.context.uid??"";t(!0);try{const{nodesModified:g,hierarchy:w}=PI(n,r,u),{identifiers:p}=await Iw(f,g,w,m);p&&Object.keys(p).length>0&&Ae.getState().replaceNodeIds(p);const y=new Date().toISOString();s(y),i(!1)}catch(g){console.error("[useSaveHierarchy] save failed:",g),Ie.error("Failed to save. Please try again.")}finally{t(!1)}},[l,e,n,r,i,s]),isSaving:e,isDirty:o,lastSaved:a}}const MI={};function $I(e){return e==null||e===""||Array.isArray(e)&&e.length===0}function BI(e,t,r,n,o){const a=[],i=(s,l)=>{var d;for(const f of s){const u=l&&!f.parent,m=u?r:f.isFolder?n:null;if(m&&m.length>0){const g={...f.metadata??{},...t[f.id]??{}},p=Nh(m,g,MI,u,o).filter(y=>y.required&&y.visible!==!1&&y.inputType!=="appIcon"&&$I(y.currentValue)).map(y=>y.label);p.length>0&&a.push({nodeId:f.id,nodeName:f.name||"Untitled",missing:p})}(d=f.children)!=null&&d.length&&i(f.children,!1)}};return i(e,!0),a}function jI(e){const t=ce(u=>u.editorConfig),r=ce(u=>u.setButtonLoader),n=ce(u=>u.validateAllForms),o=ce(u=>u.rootFormConfig),a=ce(u=>u.unitFormConfig),i=Ae(u=>u.treeData),s=Ae(u=>u.treeCache),l=Ae(u=>u.selectNode),d=h.useCallback(()=>{var p,y,v;const u={editorMode:"edit",objectType:(p=t==null?void 0:t.config)==null?void 0:p.objectType,userFullName:(v=(y=t==null?void 0:t.context)==null?void 0:y.user)==null?void 0:v.fullName},m=BI(i,s,o,a,u);if(m.length===0)return!0;const g=m[0];Ie.error(`"${g.nodeName}": please fill required field${g.missing.length>1?"s":""} — ${g.missing.join(", ")}`);const{setFormStatus:w}=ce.getState();return m.forEach(b=>w(b.nodeId,!1)),l(g.nodeId),!1},[i,s,o,a,t,l]);return{runAction:h.useCallback(async(u,m)=>{var p,y,v,b;const g=((p=t==null?void 0:t.context)==null?void 0:p.contentId)??((y=t==null?void 0:t.context)==null?void 0:y.identifier)??"";if(!g)return Ie.error("No content identifier found."),!1;const w=((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(u){case"sendForReview":return d()?n(i)?(r("saveCollection",!0),await e(),await Dw(g),Ie.success("Content sent for review"),!0):(Ie.error("Some units have missing required fields. Please fill them before sending for review."),!1):!1;case"reject":{r("rejectCollection",!0);const C=(m==null?void 0:m.comment)??"";return await Nw(g,C),Ie.success("Content rejected and sent back to the author"),!0}case"publish":return d()?n(i)?(r("publishCollection",!0),await e(),await Ow(g,w),Ie.success("Content published successfully"),!0):(Ie.error("Some units have missing required fields. Please fill them before publishing."),!1):!1;default:return!1}}catch(C){console.error(`[useToolbarActions] ${u} failed`,C);const S=u==="sendForReview"?"send for review":u==="reject"?"reject":"publish";return Ie.error(`Failed to ${S}. Please try again.`),!1}finally{r("saveCollection",!1),r("rejectCollection",!1),r("publishCollection",!1)}},[t,e,r,d,n,i]),checkRequiredFields:d}}const Bt={shell:"_shell_90fon_1",workspace:"_workspace_90fon_8",sidebarCollapsed:"_sidebarCollapsed_90fon_16",dockCollapsed:"_dockCollapsed_90fon_19",dock:"_dock_90fon_19",outline:"_outline_90fon_40",reopenTab:"_reopenTab_90fon_45",outlineHidden:"_outlineHidden_90fon_79",editor:"_editor_90fon_86",dockHidden:"_dockHidden_90fon_101",dockReopenTab:"_dockReopenTab_90fon_108",dragChip:"_dragChip_90fon_133",dragChipLabel:"_dragChipLabel_90fon_148"},qI=({editorMode:e,onToolbarEvent:t,onContentAdded:r,onHierarchySaved:n})=>{const o=le(),[a,i]=h.useState(null),[s,l]=h.useState(!1),[d,f]=h.useState(!1),[u,m]=h.useState(!1),{addResource:g,treeData:w}=Ae(),p=ce(F=>F.setFormStatus),[y,v]=h.useState(!0),b=Ae(F=>F.selectedNodeId),{save:C,isSaving:S,isDirty:T,lastSaved:I}=FI(),{runAction:k,checkRequiredFields:x}=jI(C);h.useEffect(()=>{if(!T)return;const F=V=>{V.preventDefault(),V.returnValue=""};return window.addEventListener("beforeunload",F),()=>window.removeEventListener("beforeunload",F)},[T]);const $=fc(Pi(pa,{activationConstraint:{distance:8}})),j=h.useCallback(F=>{var X;const V=(X=F.active.data.current)==null?void 0:X.item;V&&i(V)},[]),N=h.useCallback(F=>{var ue,Q;i(null);const V=(ue=F.active.data.current)==null?void 0:ue.item;if(!V)return;const X=F.over,ve=(X==null?void 0:X.id)??b??void 0;if(!ve){Ie.error(o.splitBuilderShell.dropOntoUnitError);return}const Ee=(Q=w[0])==null?void 0:Q.id;if(ve===Ee){Ie.error(o.splitBuilderShell.dropOntoCourseError);return}if(!g(V,ve)){Ie.error(o.splitBuilderShell.alreadyInCollectionError.replace("{name}",V.name));return}r==null||r(V,ve),Ie.success(o.splitBuilderShell.addedToUnitSuccess.replace("{name}",V.name))},[b,g,r,o]),L=h.useCallback(async F=>{if(F.action==="onFormStatusChange"){const{isValid:V,nodeId:X}=F.data??{},ve=V!==!1;v(ve),X&&p(X,ve);return}if(F.action==="back"&&T&&e==="edit"){m(!0);return}if(F.action==="saveCollection"){if(!y){Ie.error(o.splitBuilderShell.fillRequiredMetadataError);return}if(!x())return;await C(),n==null||n(w),t==null||t(F);return}if(F.action==="sendForReview"||F.action==="reject"||F.action==="publish"){await k(F.action,F.data)&&(t==null||t(F));return}t==null||t(F)},[C,k,x,t,n,w,T,y,e,o]),B=h.useCallback(async()=>{if(!x()){m(!1);return}await C(),m(!1),n==null||n(w),t==null||t({action:"back"})},[C,x,n,t,w]),P=h.useCallback(()=>{m(!1),t==null||t({action:"back"})},[t]);return c.jsxs(zc,{sensors:$,onDragStart:j,onDragEnd:N,children:[c.jsxs("div",{className:Bt.shell,children:[c.jsx(Uw,{editorMode:e,isSaving:S,isDirty:T,lastSaved:I,isFormValid:y,onToolbarEvent:L}),c.jsxs("div",{className:[Bt.workspace,s?Bt.sidebarCollapsed:"",d?Bt.dockCollapsed:""].filter(Boolean).join(" "),children:[c.jsx("aside",{className:[Bt.outline,s?Bt.outlineHidden:""].join(" "),"aria-label":o.splitBuilderShell.outlineAriaLabel,"aria-hidden":s,children:c.jsx(u1,{editorMode:e,collapsed:s,onToggleCollapse:()=>l(F=>!F)})}),s&&c.jsx("button",{className:Bt.reopenTab,onClick:()=>l(!1),title:o.splitBuilderShell.showOutlineTitle,type:"button",children:"›"}),c.jsx("main",{className:Bt.editor,role:"main","aria-label":o.splitBuilderShell.editorAriaLabel,children:c.jsx(wI,{editorMode:e,onToolbarEvent:L})}),c.jsx("aside",{className:[Bt.dock,d?Bt.dockHidden:""].filter(Boolean).join(" "),"aria-label":o.splitBuilderShell.libraryAriaLabel,"aria-hidden":d,children:c.jsx(LI,{editorMode:e,collapsed:d,onToggleCollapse:()=>f(F=>!F)})}),d&&c.jsx("button",{className:Bt.dockReopenTab,onClick:()=>f(!1),title:o.splitBuilderShell.showLibraryTitle,type:"button",children:"‹"})]})]}),c.jsx(Sy,{dropAnimation:null,children:a?c.jsx("div",{className:Bt.dragChip,children:c.jsx("span",{className:Bt.dragChipLabel,children:a.name})}):null}),u&&c.jsx(zw,{onSave:B,onDiscard:P,onCancel:()=>m(!1),isSaving:S})]})},UI="v1";function zI(e){const t=e.validations,r=t==null?void 0:t.find(o=>o.type==="maxlength"||o.type==="maxLength");if(!r)return e.maxLength;const n=Number(r.value);return Number.isFinite(n)?n:void 0}function op(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:zI(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 Lr(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 o=n.name??void 0,a=n.fields.filter(i=>!!i.code).sort((i,s)=>(i.index??0)-(s.index??0));for(const i of a)r.push(op(i,o))}else n.code&&r.push(op(n));return r}function VI(e){const t=e==null?void 0:e.properties;if(!t)return{};const r={};for(const[n,o]of Object.entries(t))o&&"default"in o&&(r[n]=o.default);return r}async function HI(e,t,r="Collection",n=UI){var d,f;const a=(f=(d=(await ke.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:f.objectCategoryDefinition,i=(a==null?void 0:a.forms)??{},s=(a==null?void 0:a.objectMetadata)??{},l=s.config??{};return{rootForm:Lr(i.create),unitForm:Lr(i.unitMetadata),childForm:Lr(i.childMetadata),searchForm:Lr(i.search??i.searchConfig),relationalForm:Lr(i.relationalMetadata),publishChecklist:Lr(i.publishchecklist),reviewChecklist:Lr(i.review),rfcChecklist:Lr(i.requestforchangeschecklist),schemaDefaults:VI(s.schema),frameworkMetadata:l.frameworkMetadata??{},sourcingSettings:l.sourcingSettings??{}}}function RI({config:e,onError:t}){const[r,n]=h.useState(!0),[o,a]=h.useState(null),[i,s]=h.useState(!1),{setEditorConfig:l,setEditorMode:d,setCategoryDefinition:f,setContentFramework:u}=ce(),{setTreeData:m,selectNode:g}=Ae();return h.useEffect(()=>{let w=!1;async function p(){var y,v;try{n(!0),a(null),e.apiBaseUrl&&ou(e.apiBaseUrl),l(e),d(e.config.mode);const b=e.context.contentId??e.context.identifier??"";if(b){const C=e.config.objectType==="QuestionSet",{rootNode:S}=C?await Ew(b):await lu(b);if(!w&&(m(S?[S]:[]),S)){g(S.id);const $=S.metadata??{},j=$.framework??e.context.framework??null,N=$.targetFWIds??e.context.targetFWIds??null;u(j,N)}const T=e.config.primaryCategory??"Course",I=e.context.channel??"",k=e.config.categoryDefinitionApiVersion??"v1";try{const x=await HI(T,I,e.config.objectType??"Collection",k);if(!w){f(x);const $=((y=x.sourcingSettings)==null?void 0:y.collection)??{},j={};$.maxDepth&&!e.config.maxDepth&&(j.maxDepth=$.maxDepth),$.children&&!e.config.children&&(j.children=$.children),$.hierarchy&&!((v=e.config.hierarchy)!=null&&v.level1)&&(j.hierarchy={...e.config.hierarchy??{},...$.hierarchy}),Object.keys(j).length>0&&l({...e,config:{...e.config,...j}})}}catch{}}w||s(!0)}catch(b){if(!w){const C=b instanceof Error?b:new Error(String(b));a(C),t==null||t(C)}}finally{w||n(!1)}}return p(),()=>{w=!0}},[e.context.contentId,e.context.identifier]),{isLoading:r,error:o,isReady:i}}function QI(){const e=_a(t=>t.setLanguage);h.useEffect(()=>{e(localStorage.getItem(ls)||"en",{broadcast:!1});const t=n=>{n.key===ls&&n.newValue&&e(n.newValue,{broadcast:!1})},r=n=>{var a;const o=(a=n.detail)==null?void 0:a.lang;o&&e(o,{broadcast:!1})};return window.addEventListener("storage",t),window.addEventListener(cs,r),()=>{window.removeEventListener("storage",t),window.removeEventListener(cs,r)}},[e])}const Bo={root:"_root_qcpw6_1",loadingState:"_loadingState_qcpw6_10",loadingSpinner:"_loadingSpinner_qcpw6_20",errorState:"_errorState_qcpw6_34"},GI=new Wp({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}});function WI({error:e,onRetry:t}){const r=le();return c.jsxs("div",{className:Bo.errorState,children:[c.jsx("h3",{children:r.collectionEditor.errorBoundaryTitle}),c.jsx("p",{children:e.message}),c.jsx("button",{onClick:t,children:r.collectionEditor.retryButton})]})}class KI extends h.Component{constructor(t){super(t),this.state={error:null}}static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t){var r,n;(n=(r=this.props).onError)==null||n.call(r,t)}render(){return this.state.error?c.jsx(WI,{error:this.state.error,onRetry:()=>this.setState({error:null})}):this.props.children}}function YI(e){QI();const t=le(),{isLoading:r,error:n}=RI({config:e,onError:e.onError}),o=ce(a=>a.editorMode);return r?c.jsxs("div",{className:Bo.loadingState,children:[c.jsx("div",{className:Bo.loadingSpinner}),c.jsx("p",{children:t.collectionEditor.loadingMessage})]}):n?c.jsxs("div",{className:Bo.errorState,children:[c.jsx("h3",{children:t.collectionEditor.loadErrorTitle}),c.jsx("p",{children:n.message})]}):c.jsx("div",{className:`sb-split-builder ${Bo.root}`,children:c.jsx(qI,{editorMode:o,onToolbarEvent:e.onToolbarEvent,onContentAdded:e.onContentAdded,onHierarchySaved:e.onHierarchySaved})})}const ap=e=>c.jsx(KI,{onError:e.onError,children:c.jsxs(Yp,{client:GI,children:[c.jsx(YI,{...e}),c.jsx(Kg,{position:"top-right",toastOptions:{duration:3e3}})]})}),fi=Symbol.for("r2wc.reactRender"),ip=Symbol.for("r2wc.shouldRender"),hi=Symbol.for("r2wc.root");function ZI(e=""){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function XI(e=""){return e.replace(/-([a-z0-9])/g,function(t){return t[1].toUpperCase()})}var sp={expando:function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:function(){return r},set:function(n){r=n,this[fi]()}}),e[fi]()}};function JI(e,t,r,n={}){var o={isConnected:"isConnected"in HTMLElement.prototype},a=!1,i=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},s=Object.create(HTMLElement.prototype);s.constructor=i;var l=new Proxy(s,{has:function(d,f){return f in e.propTypes||f in s},set:function(d,f,u,m){return a&&(o[f]=!0),typeof f=="symbol"||o[f]||f in d?(e.propTypes&&f in e.propTypes&&sp.expando(m,f,u),Reflect.set(d,f,u,m)):(sp.expando(m,f,u),!0)},getOwnPropertyDescriptor:function(d,f){var u=Reflect.getOwnPropertyDescriptor(d,f);if(u)return u;if(f in e.propTypes)return{configurable:!0,enumerable:!0,writable:!0,value:void 0}}});return i.prototype=l,s.connectedCallback=function(){this[ip]=!0,this[fi]()},s.disconnectedCallback=function(){typeof r.createRoot=="function"?this[hi].unmount():r.unmountComponentAtNode(this)},s[fi]=function(){if(this[ip]===!0){var d={};Object.keys(this).forEach(function(m){o[m]!==!1&&(d[m]=this[m])},this),a=!0;const f=n.shadow?this.shadowRoot:this,u=t.createElement(e,d);typeof r.createRoot=="function"?(this[hi]||(this[hi]=r.createRoot(f)),this[hi].render(u)):r.render(u,f),a=!1}},e.propTypes&&(i.observedAttributes=n.dashStyleAttributes?Object.keys(e.propTypes).map(function(d){return ZI(d)}):Object.keys(e.propTypes),s.attributeChangedCallback=function(d,f,u){var m=n.dashStyleAttributes?XI(d):d;this[m]=u}),i}var jo={},qo=Pe;if(process.env.NODE_ENV==="production")jo.createRoot=qo.createRoot,jo.hydrateRoot=qo.hydrateRoot;else{var pi=qo.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;jo.createRoot=function(e,t){pi.usingClientEntryPoint=!0;try{return qo.createRoot(e,t)}finally{pi.usingClientEntryPoint=!1}},jo.hydrateRoot=function(e,t,r){pi.usingClientEntryPoint=!0;try{return qo.hydrateRoot(e,t,r)}finally{pi.usingClientEntryPoint=!1}}}function eO(){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 tO(e="sb-collection-editor"){if(eO(),typeof customElements>"u"||customElements.get(e))return;const t=JI(ap,h,jo,{});customElements.define(e,t)}me.CollectionEditor=ap,me.registerCollectionEditor=tO,me.setApiBaseUrl=ou,me.useEditorStore=ce,me.useLibraryStore=tp,me.useTreeStore=Ae,Object.defineProperty(me,Symbol.toStringTag,{value:"Module"})});