@project-sunbird/collection-editor-react 0.1.24 → 0.1.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/collection-editor.umd.js +92 -92
- package/dist/components/ContentPlayer/ContentPlayer.d.ts +6 -0
- package/dist/index.cjs +92 -92
- package/dist/index.js +3707 -3736
- package/dist/style.css +1 -1
- package/dist/types/editor.d.ts +1 -2
- package/package.json +2 -2
|
@@ -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,Me,l){"use strict";var DI=Object.defineProperty;var up=pe=>{throw TypeError(pe)};var TI=(pe,h,Me)=>h in pe?DI(pe,h,{enumerable:!0,configurable:!0,writable:!0,value:Me}):pe[h]=Me;var Ks=(pe,h,Me)=>TI(pe,typeof h!="symbol"?h+"":h,Me),_l=(pe,h,Me)=>h.has(pe)||up("Cannot "+Me);var O=(pe,h,Me)=>(_l(pe,h,"read from private field"),Me?Me.call(pe):h.get(pe)),ne=(pe,h,Me)=>h.has(pe)?up("Cannot add the same private member more than once"):h instanceof WeakSet?h.add(pe):h.set(pe,Me),Y=(pe,h,Me,l)=>(_l(pe,h,"write to private field"),l?l.call(pe,Me):h.set(pe,Me),Me),Se=(pe,h,Me)=>(_l(pe,h,"access private method"),Me);var fo=(pe,h,Me,l)=>({set _(ho){Y(pe,h,ho,Me)},get _(){return O(pe,h,l)}});var rn,Ar,jn,ep,ar,nn,tp,Bn,Pr,Un,rp,sn,np,Vn,on,qn,Wt,an,ot,js,ln,jt,dp,wr,sp,xt,Ee,Bs,Ot,cn,zn,yr,Mr,Us,Hn,Wn,un,dn,Lr,Qn,xe,Gs,wl,Sl,Cl,El,Ol,Il,Dl,fp,ip,Vs,lr,St,fn,cr,Vr,op,vr,er,qs,ap,ur,lp,Re,Fr,$r,Kn,Gn,jr,Yn,Rn,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 Ne=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();ne(this,rn);ne(this,Ar);ne(this,jn);Y(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),Y(this,Ar,void 0))}setEventListener(t){var r;Y(this,jn,t),(r=O(this,Ar))==null||r.call(this),Y(this,Ar,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){O(this,rn)!==t&&(Y(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(){ne(this,ar,yp);ne(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}),Y(this,ar,e),process.env.NODE_ENV!=="production"&&Y(this,nn,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&Y(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"&&Y(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 Dt(){}function _p(e,t){return typeof e=="function"?e(t):e}function go(e){return typeof e=="number"&&e>=0&&e!==1/0}function Tl(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Sr(e,t){return typeof e=="function"?e(t):e}function Mt(e,t){return typeof e=="function"?e(t):e}function Nl(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 kl(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=xl(e)&&xl(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 xl(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function bo(e){if(!Al(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!Al(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Al(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 Ys=Symbol();function Pl(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Ys&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Ys?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Ml(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 ut=Dp(),Tp=(rp=class extends Zn{constructor(){super();ne(this,Bn,!0);ne(this,Pr);ne(this,Un);Y(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),Y(this,Pr,void 0))}setEventListener(t){var r;Y(this,Un,t),(r=O(this,Pr))==null||r.call(this),Y(this,Pr,t(this.setOnline.bind(this)))}setOnline(t){O(this,Bn)!==t&&(Y(this,Bn,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return O(this,Bn)}},Bn=new WeakMap,Pr=new WeakMap,Un=new WeakMap,rp),Rs=new Tp;function Np(e){return Math.min(1e3*2**e,3e4)}function Ll(e){return(e??"online")==="online"?Rs.isOnline():!0}var So=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Fl(e){let t=!1,r=0,n;const s=wo(),i=()=>s.status!=="pending",o=p=>{var v;if(!i()){const m=new So(p);g(m),(v=e.onCancel)==null||v.call(e,m)}},a=()=>{t=!0},c=()=>{t=!1},d=()=>po.isFocused()&&(e.networkMode==="always"||Rs.isOnline())&&e.canRun(),u=()=>Ll(e.networkMode)&&e.canRun(),f=p=>{i()||(n==null||n(),s.resolve(p))},g=p=>{i()||(n==null||n(),s.reject(p))},y=()=>new Promise(p=>{var v;n=m=>{(i()||d())&&p(m)},(v=e.onPause)==null||v.call(e)}).then(()=>{var p;n=void 0,i()||(p=e.onContinue)==null||p.call(e)}),_=()=>{if(i())return;let p;const v=r===0?e.initialPromise:void 0;try{p=v??e.fn()}catch(m){p=Promise.reject(m)}Promise.resolve(p).then(f).catch(m=>{var T;if(i())return;const 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++,(T=e.onFail)==null||T.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 $l=(np=class{constructor(){ne(this,sn)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),go(this.gcTime)&&Y(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)),Y(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=Pl(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 P={client:t.client,queryKey:t.queryKey,pageParam:w,direction:E?"backward":"forward",meta:t.options.meta};return v(P),P})(),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:jl,E={pages:i,pageParams:o},T=w(n,E);a=await b(E,T,S)}else{const S=e??i.length;do{const w=c===0?o[0]??n.initialPageParam:jl(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 jl(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 $l{constructor(t){super();ne(this,jt);ne(this,Vn);ne(this,on);ne(this,qn);ne(this,Wt);ne(this,an);ne(this,ot);ne(this,js);ne(this,ln);Y(this,ln,!1),Y(this,js,t.defaultOptions),this.setOptions(t.options),this.observers=[],Y(this,an,t.client),Y(this,Wt,O(this,an).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Y(this,on,Vl(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,ot))==null?void 0:t.promise}setOptions(t){if(this.options={...O(this,js),...t},t!=null&&t._type&&Y(this,Vn,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=Vl(this.options);r.data!==void 0&&(this.setState(Ul(r.data,r.dataUpdatedAt)),Y(this,on,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&O(this,Wt).remove(this)}setData(t,r){const n=_o(this.state.data,t,this.options);return Se(this,jt,wr).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,wr).call(this,{type:"setState",state:t})}cancel(t){var n,s;const r=(n=O(this,ot))==null?void 0:n.promise;return(s=O(this,ot))==null||s.cancel(t),r?r.then(Dt).catch(Dt):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=>Mt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Ys||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>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:!Tl(this.state.dataUpdatedAt,t)}onFocus(){var r;const t=this.observers.find(n=>n.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(r=O(this,ot))==null||r.continue()}onOnline(){var r;const t=this.observers.find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(r=O(this,ot))==null||r.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),O(this,Wt).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,ot)&&(O(this,ln)||Se(this,jt,dp).call(this)?O(this,ot).cancel({revert:!0}):O(this,ot).cancelRetry()),this.scheduleGc()),O(this,Wt).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Se(this,jt,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,ot))==null?void 0:d.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(O(this,ot))return O(this,ot).continueRetry(),O(this,ot).promise}if(t&&this.setOptions(t),!this.options.queryFn){const w=this.observers.find(E=>E.options.queryFn);w&&this.setOptions(w.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const n=new AbortController,s=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(Y(this,ln,!0),n.signal)})},i=()=>{const w=Pl(this.options,r),T=(()=>{const x={client:O(this,an),queryKey:this.queryKey,meta:this.meta};return s(x),x})();return Y(this,ln,!1),this.options.persister?this.options.persister(w,T,this):w(T)},a=(()=>{const w={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:O(this,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),Y(this,qn,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=a.fetchOptions)==null?void 0:u.meta))&&Se(this,jt,wr).call(this,{type:"fetch",meta:(f=a.fetchOptions)==null?void 0:f.meta}),Y(this,ot,Fl({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)=>{Se(this,jt,wr).call(this,{type:"failed",failureCount:w,error:E})},onPause:()=>{Se(this,jt,wr).call(this,{type:"pause"})},onContinue:()=>{Se(this,jt,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,ot).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,Wt).config).onSuccess)==null||y.call(g,w,this),(p=(_=O(this,Wt).config).onSettled)==null||p.call(_,w,this.state.error,this),w}catch(w){if(w instanceof So){if(w.silent)return O(this,ot).promise;if(w.revert){if(this.state.data===void 0)throw w;return this.state.data}}throw Se(this,jt,wr).call(this,{type:"error",error:w}),(m=(v=O(this,Wt).config).onError)==null||m.call(v,w,this),(S=(b=O(this,Wt).config).onSettled)==null||S.call(b,this.state.data,w,this),w}finally{this.scheduleGc()}}},Vn=new WeakMap,on=new WeakMap,qn=new WeakMap,Wt=new WeakMap,an=new WeakMap,ot=new WeakMap,js=new WeakMap,ln=new WeakMap,jt=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,...Bl(n.data,this.options),fetchMeta:t.meta??null};case"success":const s={...n,...Ul(t.data,t.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Y(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),ut.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),O(this,Wt).notify({query:this,type:"updated",action:t})})},sp);function Bl(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ll(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Ul(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Vl(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();ne(this,xe);ne(this,xt);ne(this,Ee);ne(this,Bs);ne(this,Ot);ne(this,cn);ne(this,zn);ne(this,yr);ne(this,Mr);ne(this,Us);ne(this,Hn);ne(this,Wn);ne(this,un);ne(this,dn);ne(this,Lr);ne(this,Qn,new Set);this.options=r,Y(this,xt,t),Y(this,Mr,null),Y(this,yr,wo()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(O(this,Ee).addObserver(this),ql(O(this,Ee),this.options)?Se(this,xe,Gs).call(this):this.updateResult(),Se(this,xe,El).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Co(O(this,Ee),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Co(O(this,Ee),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Se(this,xe,Ol).call(this),Se(this,xe,Il).call(this),O(this,Ee).removeObserver(this)}setOptions(t){const r=this.options,n=O(this,Ee);if(this.options=O(this,xt).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Mt(this.options.enabled,O(this,Ee))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Se(this,xe,Dl).call(this),O(this,Ee).setOptions(this.options),r._defaulted&&!mo(this.options,r)&&O(this,xt).getQueryCache().notify({type:"observerOptionsUpdated",query:O(this,Ee),observer:this});const s=this.hasListeners();s&&zl(O(this,Ee),n,this.options,r)&&Se(this,xe,Gs).call(this),this.updateResult(),s&&(O(this,Ee)!==n||Mt(this.options.enabled,O(this,Ee))!==Mt(r.enabled,O(this,Ee))||Sr(this.options.staleTime,O(this,Ee))!==Sr(r.staleTime,O(this,Ee)))&&Se(this,xe,wl).call(this);const i=Se(this,xe,Sl).call(this);s&&(O(this,Ee)!==n||Mt(this.options.enabled,O(this,Ee))!==Mt(r.enabled,O(this,Ee))||i!==O(this,Lr))&&Se(this,xe,Cl).call(this,i)}getOptimisticResult(t){const r=O(this,xt).getQueryCache().build(O(this,xt),t),n=this.createResult(r,t);return Lp(this,n)&&(Y(this,Ot,n),Y(this,zn,this.options),Y(this,cn,O(this,Ee).state)),n}getCurrentResult(){return O(this,Ot)}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,Ee)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const r=O(this,xt).defaultQueryOptions(t),n=O(this,xt).getQueryCache().build(O(this,xt),r);return n.fetch().then(()=>this.createResult(n,r))}fetch(t){return Se(this,xe,Gs).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),O(this,Ot)))}createResult(t,r){var $;const n=O(this,Ee),s=this.options,i=O(this,Ot),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(),P=!N&&ql(t,r),U=N&&zl(t,n,r,s);(P||U)&&(f={...f,...Bl(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{Y(this,Us,r.select),y=r.select(y),y=_o(i==null?void 0:i.data,y,r),Y(this,Hn,y),Y(this,Mr,null)}catch(N){Y(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,T=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&&!T,isPaused:f.fetchStatus==="paused",isPlaceholderData:g,isRefetchError:w&&T,isStale:Eo(t,r),refetch:this.refetch,promise:O(this,yr),isEnabled:Mt(r.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const N=A.data!==void 0,P=A.status==="error"&&!N,U=j=>{P?j.reject(A.error):N&&j.resolve(A.data)},M=()=>{const j=Y(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":(P||A.data!==L.value)&&M();break;case"rejected":(!P||A.error!==L.reason)&&M();break}}return A}updateResult(){const t=O(this,Ot),r=this.createResult(O(this,Ee),this.options);if(Y(this,cn,O(this,Ee).state),Y(this,zn,this.options),O(this,cn).data!==void 0&&Y(this,Wn,O(this,Ee)),mo(r,t))return;Y(this,Ot,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,Ot)).some(a=>{const c=a;return O(this,Ot)[c]!==t[c]&&o.has(c)})};Se(this,xe,fp).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Se(this,xe,El).call(this)}},xt=new WeakMap,Ee=new WeakMap,Bs=new WeakMap,Ot=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,xe=new WeakSet,Gs=function(t){Se(this,xe,Dl).call(this);let r=O(this,Ee).fetch(this.options,t);return t!=null&&t.throwOnError||(r=r.catch(Dt)),r},wl=function(){Se(this,xe,Ol).call(this);const t=Sr(this.options.staleTime,O(this,Ee));if(ts.isServer()||O(this,Ot).isStale||!go(t))return;const n=Tl(O(this,Ot).dataUpdatedAt,t)+1;Y(this,un,qr.setTimeout(()=>{O(this,Ot).isStale||this.updateResult()},n))},Sl=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(O(this,Ee)):this.options.refetchInterval)??!1},Cl=function(t){Se(this,xe,Il).call(this),Y(this,Lr,t),!(ts.isServer()||Mt(this.options.enabled,O(this,Ee))===!1||!go(O(this,Lr))||O(this,Lr)===0)&&Y(this,dn,qr.setInterval(()=>{(this.options.refetchIntervalInBackground||po.isFocused())&&Se(this,xe,Gs).call(this)},O(this,Lr)))},El=function(){Se(this,xe,wl).call(this),Se(this,xe,Cl).call(this,Se(this,xe,Sl).call(this))},Ol=function(){O(this,un)!==void 0&&(qr.clearTimeout(O(this,un)),Y(this,un,void 0))},Il=function(){O(this,dn)!==void 0&&(qr.clearInterval(O(this,dn)),Y(this,dn,void 0))},Dl=function(){const t=O(this,xt).getQueryCache().build(O(this,xt),this.options);if(t===O(this,Ee))return;const r=O(this,Ee);Y(this,Ee,t),Y(this,Bs,t.state),this.hasListeners()&&(r==null||r.removeObserver(this),t.addObserver(this))},fp=function(t){ut.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(O(this,Ot))}),O(this,xt).getQueryCache().notify({query:O(this,Ee),type:"observerResultsUpdated"})})},ip);function Mp(e,t){return Mt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&Mt(t.retryOnMount,e)===!1)}function ql(e,t){return Mp(e,t)||e.state.data!==void 0&&Co(e,t,t.refetchOnMount)}function Co(e,t,r){if(Mt(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 zl(e,t,r,n){return(e!==t||Mt(n.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&Eo(e,r)}function Eo(e,t){return Mt(t.enabled,e)!==!1&&e.isStaleByTime(Sr(t.staleTime,e))}function Lp(e,t){return!mo(e.getCurrentResult(),t)}var Fp=(op=class extends $l{constructor(t){super();ne(this,cr);ne(this,Vs);ne(this,lr);ne(this,St);ne(this,fn);Y(this,Vs,t.client),this.mutationId=t.mutationId,Y(this,St,t.mutationCache),Y(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,St).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Y(this,lr,O(this,lr).filter(r=>r!==t)),this.scheduleGc(),O(this,St).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){O(this,lr).length||(this.state.status==="pending"?this.scheduleGc():O(this,St).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,T,x;const r=()=>{Se(this,cr,Vr).call(this,{type:"continue"})},n={client:O(this,Vs),meta:this.options.meta,mutationKey:this.options.mutationKey};Y(this,fn,Fl({fn:()=>this.options.mutationFn?this.options.mutationFn(t,n):Promise.reject(new Error("No mutationFn found")),onFail:(A,$)=>{Se(this,cr,Vr).call(this,{type:"failed",failureCount:A,error:$})},onPause:()=>{Se(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,St).canRun(this)}));const s=this.state.status==="pending",i=!O(this,fn).canStart();try{if(s)r();else{Se(this,cr,Vr).call(this,{type:"pending",variables:t,isPaused:i}),O(this,St).config.onMutate&&await O(this,St).config.onMutate(t,this,n);const $=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,t,n));$!==this.state.context&&Se(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,St).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,St).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)),Se(this,cr,Vr).call(this,{type:"success",data:A}),A}catch(A){try{await((m=(v=O(this,St).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,St).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=(T=this.options).onSettled)==null?void 0:x.call(T,void 0,A,t,this.state.context,n))}catch($){Promise.reject($)}throw Se(this,cr,Vr).call(this,{type:"error",error:A}),A}finally{O(this,St).runNext(this)}}},Vs=new WeakMap,lr=new WeakMap,St=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),ut.batch(()=>{O(this,lr).forEach(n=>{n.onMutationUpdate(t)}),O(this,St).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();ne(this,vr);ne(this,er);ne(this,qs);this.config=t,Y(this,vr,new Set),Y(this,er,new Map),Y(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(){ut.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=>kl(r,n))}findAll(t={}){return this.getAll().filter(r=>kl(t,r))}notify(t){ut.batch(()=>{this.listeners.forEach(r=>{r(t)})})}resumePausedMutations(){const t=this.getAll().filter(r=>r.state.isPaused);return ut.batch(()=>Promise.all(t.map(r=>r.continue().catch(Dt))))}},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();ne(this,ur);this.config=t,Y(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(){ut.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=>Nl(r,n))}findAll(t={}){const r=this.getAll();return Object.keys(t).length>0?r.filter(n=>Nl(t,n)):r}notify(t){ut.batch(()=>{this.listeners.forEach(r=>{r(t)})})}onFocus(){ut.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){ut.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},ur=new WeakMap,lp),Up=(cp=class{constructor(e={}){ne(this,Re);ne(this,Fr);ne(this,$r);ne(this,Kn);ne(this,Gn);ne(this,jr);ne(this,Yn);ne(this,Rn);Y(this,Re,e.queryCache||new Bp),Y(this,Fr,e.mutationCache||new jp),Y(this,$r,e.defaultOptions||{}),Y(this,Kn,new Map),Y(this,Gn,new Map),Y(this,jr,0)}mount(){fo(this,jr)._++,O(this,jr)===1&&(Y(this,Yn,po.subscribe(async e=>{e&&(await this.resumePausedMutations(),O(this,Re).onFocus())})),Y(this,Rn,Rs.subscribe(async e=>{e&&(await this.resumePausedMutations(),O(this,Re).onOnline())})))}unmount(){var e,t;fo(this,jr)._--,O(this,jr)===0&&((e=O(this,Yn))==null||e.call(this),Y(this,Yn,void 0),(t=O(this,Rn))==null||t.call(this),Y(this,Rn,void 0))}isFetching(e){return O(this,Re).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,Re).get(t.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=O(this,Re).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,Re).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,Re).get(n.queryHash),i=s==null?void 0:s.state.data,o=_p(t,i);if(o!==void 0)return O(this,Re).build(this,n).setData(o,{...r,manual:!0})}setQueriesData(e,t,r){return ut.batch(()=>O(this,Re).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,Re).get(t.queryHash))==null?void 0:r.state}removeQueries(e){const t=O(this,Re);ut.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=O(this,Re);return ut.batch(()=>(r.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=ut.batch(()=>O(this,Re).findAll(e).map(s=>s.cancel(r)));return Promise.all(n).then(Dt).catch(Dt)}invalidateQueries(e,t={}){return ut.batch(()=>(O(this,Re).findAll(e).forEach(r=>{r.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const r={...t,cancelRefetch:t.cancelRefetch??!0},n=ut.batch(()=>O(this,Re).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,r);return r.throwOnError||(i=i.catch(Dt)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(n).then(Dt)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=O(this,Re).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(Dt).catch(Dt)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Dt).catch(Dt)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return Rs.isOnline()?O(this,Fr).resumePausedMutations():Promise.resolve()}getQueryCache(){return O(this,Re)}getMutationCache(){return O(this,Fr)}getDefaultOptions(){return O(this,$r)}setDefaultOptions(e){Y(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===Ys&&(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,Re).clear(),O(this,Fr).clear()}},Re=new WeakMap,Fr=new WeakMap,$r=new WeakMap,Kn=new WeakMap,Gn=new WeakMap,jr=new WeakMap,Yn=new WeakMap,Rn=new WeakMap,cp),Hl=Ne.createContext(void 0),Vp=e=>{const t=Ne.useContext(Hl);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},qp=({client:e,children:t})=>(Ne.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),l.jsx(Hl.Provider,{value:e,children:t})),Wl=Ne.createContext(!1),zp=()=>Ne.useContext(Wl);Wl.Provider;function Hp(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Wp=Ne.createContext(Hp()),Qp=()=>Ne.useContext(Wp),Kp=(e,t,r)=>{const n=r!=null&&r.state.error&&typeof e.throwOnError=="function"?Ml(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||n)&&(t.isReset()||(e.retryOnMount=!1))},Gp=e=>{Ne.useEffect(()=>{e.clearReset()},[e])},Yp=({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(s&&e.data===void 0||Ml(r,[e.error,n])),Rp=e=>{if(e.suspense){const r=s=>s==="static"?s:Math.max(s??1e3,1e3),n=e.staleTime;e.staleTime=typeof n=="function"?(...s)=>r(n(...s)):r(n),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},Xp=(e,t)=>e.isLoading&&e.isFetching&&!t,Zp=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Ql=(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,Rp(o),Kp(o,s,a),Gp(s);const d=!i.getQueryCache().get(o.queryHash),[u]=Ne.useState(()=>new t(i,o)),f=u.getOptimisticResult(o),g=!n&&c;if(Ne.useSyncExternalStore(Ne.useCallback(m=>{const b=g?u.subscribe(ut.batchCalls(m)):Dt;return u.updateResult(),b},[u,g]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),Ne.useEffect(()=>{u.setOptions(o)},[o,u]),Zp(o,f))throw Ql(o,u,s);if(Yp({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?Ql(o,u,s):a==null?void 0:a.promise;m==null||m.catch(Dt).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,Kl=/\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={},Gl=e=>{if(typeof e=="object"){let t="";for(let r in e)t+=r+Gl(e[r]);return t}return e},sg=(e,t,r,n,s)=>{let i=Gl(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(Kl," ").trim(),g.unshift(g[0][f]=g[0][f]||{})):g[0][u[1]]=u[2].replace(Kl," ").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 Yl,Oo,Io;Zs.bind({g:1});let pr=Zs.bind({k:1});function og(e,t,r,n){Cr.p=t,Yl=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),Yl(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",Xl=(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 Xl(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=[],Zl={toasts:[],pausedAt:void 0,settings:{toastLimit:cg}},rr={},Jl=(e,t=Do)=>{rr[t]=Xl(rr[t]||Zl,e),ei.forEach(([r,n])=>{r===t&&n(rr[t])})},ec=e=>Object.keys(rr).forEach(t=>Jl(e,t)),ug=e=>Object.keys(rr).find(t=>rr[t].toasts.some(r=>r.id===e)),ti=(e=Do)=>t=>{Jl(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]||Zl),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):ec(r)},et.dismissAll=e=>et.dismiss(void 0,e),et.remove=(e,t)=>{let r={type:4,toastId:e};t?ti(t)(r):ec(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(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 DI=Object.defineProperty;var cp=pe=>{throw TypeError(pe)};var TI=(pe,h,Pe)=>h in pe?DI(pe,h,{enumerable:!0,configurable:!0,writable:!0,value:Pe}):pe[h]=Pe;var Ks=(pe,h,Pe)=>TI(pe,typeof h!="symbol"?h+"":h,Pe),bl=(pe,h,Pe)=>h.has(pe)||cp("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)?cp("Cannot add the same private member more than once"):h instanceof WeakSet?h.add(pe):h.set(pe,Pe),Y=(pe,h,Pe,l)=>(bl(pe,h,"write to private field"),l?l.call(pe,Pe):h.set(pe,Pe),Pe),we=(pe,h,Pe)=>(bl(pe,h,"access private method"),Pe);var fo=(pe,h,Pe,l)=>({set _(ho){Y(pe,h,ho,Pe)},get _(){return O(pe,h,l)}});var rn,Ar,jn,Jh,ar,nn,ep,Bn,Pr,Un,tp,sn,rp,Vn,on,qn,Ht,an,it,js,ln,$t,up,wr,np,kt,Ce,Bs,Et,cn,zn,yr,Mr,Us,Hn,Wn,un,dn,Lr,Qn,xe,Gs,_l,wl,Sl,Cl,El,Ol,Il,dp,sp,Vs,lr,wt,fn,cr,Vr,ip,vr,er,qs,op,ur,ap,Ke,Fr,$r,Kn,Gn,jr,Yn,Rn,lp;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 Ne=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(){}},pp=(Jh=class extends Zn{constructor(){super();ie(this,rn);ie(this,Ar);ie(this,jn);Y(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),Y(this,Ar,void 0))}setEventListener(t){var r;Y(this,jn,t),(r=O(this,Ar))==null||r.call(this),Y(this,Ar,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){O(this,rn)!==t&&(Y(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,Jh),po=new pp,gp={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},yp=(ep=class{constructor(){ie(this,ar,gp);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}),Y(this,ar,e),process.env.NODE_ENV!=="production"&&Y(this,nn,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&Y(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"&&Y(this,nn,!0),O(this,ar).setInterval(e,t)}clearInterval(e){O(this,ar).clearInterval(e)}},ar=new WeakMap,nn=new WeakMap,ep),qr=new yp;function vp(e){setTimeout(e,0)}var mp=typeof window>"u"||"Deno"in globalThis;function It(){}function bp(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 _p=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:_p.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 wp(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 Sp(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function Cp(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var Ys=Symbol();function Al(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Ys&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Ys?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Pl(e,t){return typeof e=="function"?e(...t):!!e}function Ep(e,t,r){let n=!1,s;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(s??(s=t()),n||(n=!0,s.aborted?r():s.addEventListener("abort",r,{once:!0})),s)}),e}var ts=(()=>{let e=()=>mp;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 Op=vp;function Ip(){let e=[],t=0,r=a=>{a()},n=a=>{a()},s=Op;const i=a=>{t?e.push(a):s(()=>{r(a)})},o=()=>{const a=e;e=[],a.length&&s(()=>{n(()=>{a.forEach(c=>{r(c)})})})};return{batch:a=>{let c;t++;try{c=a()}finally{t--,t||o()}return c},batchCalls:a=>(...c)=>{i(()=>{a(...c)})},schedule:i,setNotifyFunction:a=>{r=a},setBatchNotifyFunction:a=>{n=a},setScheduler:a=>{s=a}}}var lt=Ip(),Dp=(tp=class extends Zn{constructor(){super();ie(this,Bn,!0);ie(this,Pr);ie(this,Un);Y(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),Y(this,Pr,void 0))}setEventListener(t){var r;Y(this,Un,t),(r=O(this,Pr))==null||r.call(this),Y(this,Pr,t(this.setOnline.bind(this)))}setOnline(t){O(this,Bn)!==t&&(Y(this,Bn,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return O(this,Bn)}},Bn=new WeakMap,Pr=new WeakMap,Un=new WeakMap,tp),Rs=new Dp;function Tp(e){return Math.min(1e3*2**e,3e4)}function Ml(e){return(e??"online")==="online"?Rs.isOnline():!0}var So=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function 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"||Rs.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??Tp,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),wp(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=(rp=class{constructor(){ie(this,sn)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),go(this.gcTime)&&Y(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)),Y(this,sn,void 0))}},sn=new WeakMap,rp);function Np(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=>{Ep(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 P={client:t.client,queryKey:t.queryKey,pageParam:w,direction:E?"backward":"forward",meta:t.options.meta};return v(P),P})(),A=await m(x),{maxPages:$}=t.options,N=E?Cp:Sp;return{pages:N(S.pages,A,$),pageParams:N(S.pageParams,w,$)}};if(s&&i.length){const S=s==="backward",w=S?kp:$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 kp(e,{pages:t,pageParams:r}){var n;return t.length>0?(n=e.getPreviousPageParam)==null?void 0:n.call(e,t[0],t,r[0],r):void 0}var xp=(np=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);Y(this,ln,!1),Y(this,js,t.defaultOptions),this.setOptions(t.options),this.observers=[],Y(this,an,t.client),Y(this,Ht,O(this,an).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Y(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&&Y(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)),Y(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 we(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){we(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===Ys||!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)||we(this,$t,up).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||we(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:()=>(Y(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 Y(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"?Np(this.options.pages):this.options.behavior;c==null||c.onFetch(a,this),Y(this,qn,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=a.fetchOptions)==null?void 0:u.meta))&&we(this,$t,wr).call(this,{type:"fetch",meta:(f=a.fetchOptions)==null?void 0:f.meta}),Y(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)=>{we(this,$t,wr).call(this,{type:"failed",failureCount:w,error:E})},onPause:()=>{we(this,$t,wr).call(this,{type:"pause"})},onContinue:()=>{we(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 we(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,up=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 Y(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})})},np);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 Ap=(sp=class extends Zn{constructor(t,r){super();ie(this,xe);ie(this,kt);ie(this,Ce);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,Y(this,kt,t),Y(this,Mr,null),Y(this,yr,wo()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(O(this,Ce).addObserver(this),Vl(O(this,Ce),this.options)?we(this,xe,Gs).call(this):this.updateResult(),we(this,xe,Cl).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Co(O(this,Ce),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Co(O(this,Ce),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,we(this,xe,El).call(this),we(this,xe,Ol).call(this),O(this,Ce).removeObserver(this)}setOptions(t){const r=this.options,n=O(this,Ce);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,Ce))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");we(this,xe,Il).call(this),O(this,Ce).setOptions(this.options),r._defaulted&&!mo(this.options,r)&&O(this,kt).getQueryCache().notify({type:"observerOptionsUpdated",query:O(this,Ce),observer:this});const s=this.hasListeners();s&&ql(O(this,Ce),n,this.options,r)&&we(this,xe,Gs).call(this),this.updateResult(),s&&(O(this,Ce)!==n||Pt(this.options.enabled,O(this,Ce))!==Pt(r.enabled,O(this,Ce))||Sr(this.options.staleTime,O(this,Ce))!==Sr(r.staleTime,O(this,Ce)))&&we(this,xe,_l).call(this);const i=we(this,xe,wl).call(this);s&&(O(this,Ce)!==n||Pt(this.options.enabled,O(this,Ce))!==Pt(r.enabled,O(this,Ce))||i!==O(this,Lr))&&we(this,xe,Sl).call(this,i)}getOptimisticResult(t){const r=O(this,kt).getQueryCache().build(O(this,kt),t),n=this.createResult(r,t);return Mp(this,n)&&(Y(this,Et,n),Y(this,zn,this.options),Y(this,cn,O(this,Ce).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,Ce)}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 we(this,xe,Gs).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),O(this,Et)))}createResult(t,r){var $;const n=O(this,Ce),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(),P=!N&&Vl(t,r),U=N&&ql(t,n,r,s);(P||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{Y(this,Us,r.select),y=r.select(y),y=_o(i==null?void 0:i.data,y,r),Y(this,Hn,y),Y(this,Mr,null)}catch(N){Y(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,P=A.status==="error"&&!N,U=j=>{P?j.reject(A.error):N&&j.resolve(A.data)},M=()=>{const j=Y(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":(P||A.data!==L.value)&&M();break;case"rejected":(!P||A.error!==L.reason)&&M();break}}return A}updateResult(){const t=O(this,Et),r=this.createResult(O(this,Ce),this.options);if(Y(this,cn,O(this,Ce).state),Y(this,zn,this.options),O(this,cn).data!==void 0&&Y(this,Wn,O(this,Ce)),mo(r,t))return;Y(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)})};we(this,xe,dp).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&we(this,xe,Cl).call(this)}},kt=new WeakMap,Ce=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,xe=new WeakSet,Gs=function(t){we(this,xe,Il).call(this);let r=O(this,Ce).fetch(this.options,t);return t!=null&&t.throwOnError||(r=r.catch(It)),r},_l=function(){we(this,xe,El).call(this);const t=Sr(this.options.staleTime,O(this,Ce));if(ts.isServer()||O(this,Et).isStale||!go(t))return;const n=Dl(O(this,Et).dataUpdatedAt,t)+1;Y(this,un,qr.setTimeout(()=>{O(this,Et).isStale||this.updateResult()},n))},wl=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(O(this,Ce)):this.options.refetchInterval)??!1},Sl=function(t){we(this,xe,Ol).call(this),Y(this,Lr,t),!(ts.isServer()||Pt(this.options.enabled,O(this,Ce))===!1||!go(O(this,Lr))||O(this,Lr)===0)&&Y(this,dn,qr.setInterval(()=>{(this.options.refetchIntervalInBackground||po.isFocused())&&we(this,xe,Gs).call(this)},O(this,Lr)))},Cl=function(){we(this,xe,_l).call(this),we(this,xe,Sl).call(this,we(this,xe,wl).call(this))},El=function(){O(this,un)!==void 0&&(qr.clearTimeout(O(this,un)),Y(this,un,void 0))},Ol=function(){O(this,dn)!==void 0&&(qr.clearInterval(O(this,dn)),Y(this,dn,void 0))},Il=function(){const t=O(this,kt).getQueryCache().build(O(this,kt),this.options);if(t===O(this,Ce))return;const r=O(this,Ce);Y(this,Ce,t),Y(this,Bs,t.state),this.hasListeners()&&(r==null||r.removeObserver(this),t.addObserver(this))},dp=function(t){lt.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(O(this,Et))}),O(this,kt).getQueryCache().notify({query:O(this,Ce),type:"observerResultsUpdated"})})},sp);function Pp(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 Pp(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 Mp(e,t){return!mo(e.getCurrentResult(),t)}var Lp=(ip=class extends Fl{constructor(t){super();ie(this,cr);ie(this,Vs);ie(this,lr);ie(this,wt);ie(this,fn);Y(this,Vs,t.client),this.mutationId=t.mutationId,Y(this,wt,t.mutationCache),Y(this,lr,[]),this.state=t.state||Fp(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){O(this,lr).includes(t)||(O(this,lr).push(t),this.clearGcTimeout(),O(this,wt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Y(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=()=>{we(this,cr,Vr).call(this,{type:"continue"})},n={client:O(this,Vs),meta:this.options.meta,mutationKey:this.options.mutationKey};Y(this,fn,Ll({fn:()=>this.options.mutationFn?this.options.mutationFn(t,n):Promise.reject(new Error("No mutationFn found")),onFail:(A,$)=>{we(this,cr,Vr).call(this,{type:"failed",failureCount:A,error:$})},onPause:()=>{we(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{we(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&&we(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)),we(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 we(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})})},ip);function Fp(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var $p=(op=class extends Zn{constructor(t={}){super();ie(this,vr);ie(this,er);ie(this,qs);this.config=t,Y(this,vr,new Set),Y(this,er,new Map),Y(this,qs,0)}build(t,r,n){const s=new Lp({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,op);function Xs(e){var t;return(t=e.options.scope)==null?void 0:t.id}var jp=(ap=class extends Zn{constructor(t={}){super();ie(this,ur);this.config=t,Y(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 xp({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,ap),Bp=(lp=class{constructor(e={}){ie(this,Ke);ie(this,Fr);ie(this,$r);ie(this,Kn);ie(this,Gn);ie(this,jr);ie(this,Yn);ie(this,Rn);Y(this,Ke,e.queryCache||new jp),Y(this,Fr,e.mutationCache||new $p),Y(this,$r,e.defaultOptions||{}),Y(this,Kn,new Map),Y(this,Gn,new Map),Y(this,jr,0)}mount(){fo(this,jr)._++,O(this,jr)===1&&(Y(this,Yn,po.subscribe(async e=>{e&&(await this.resumePausedMutations(),O(this,Ke).onFocus())})),Y(this,Rn,Rs.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,Yn))==null||e.call(this),Y(this,Yn,void 0),(t=O(this,Rn))==null||t.call(this),Y(this,Rn,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=bp(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 Rs.isOnline()?O(this,Fr).resumePausedMutations():Promise.resolve()}getQueryCache(){return O(this,Ke)}getMutationCache(){return O(this,Fr)}getDefaultOptions(){return O(this,$r)}setDefaultOptions(e){Y(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===Ys&&(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,Yn=new WeakMap,Rn=new WeakMap,lp),zl=Ne.createContext(void 0),Up=e=>{const t=Ne.useContext(zl);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Vp=({client:e,children:t})=>(Ne.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),l.jsx(zl.Provider,{value:e,children:t})),Hl=Ne.createContext(!1),qp=()=>Ne.useContext(Hl);Hl.Provider;function zp(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Hp=Ne.createContext(zp()),Wp=()=>Ne.useContext(Hp),Qp=(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))},Kp=e=>{Ne.useEffect(()=>{e.clearReset()},[e])},Gp=({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(s&&e.data===void 0||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))}},Rp=(e,t)=>e.isLoading&&e.isFetching&&!t,Xp=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Wl=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function Zp(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=qp(),s=Wp(),i=Up(),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),Qp(o,s,a),Kp(s);const d=!i.getQueryCache().get(o.queryHash),[u]=Ne.useState(()=>new t(i,o)),f=u.getOptimisticResult(o),g=!n&&c;if(Ne.useSyncExternalStore(Ne.useCallback(m=>{const b=g?u.subscribe(lt.batchCalls(m)):It;return u.updateResult(),b},[u,g]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),Ne.useEffect(()=>{u.setOptions(o)},[o,u]),Xp(o,f))throw Wl(o,u,s);if(Gp({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()&&Rp(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 Zp(e,Ap)}let Jp={data:""},eg=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||Jp},tg=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,rg=/\/\*[^]*?\*\/| +/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},ng=(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=tg.exec(d.replace(rg,""));)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},sg=(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 ng(r.unshift?r.raw?sg(r,[].slice.call(arguments,1),t.p):r.reduce((n,s)=>Object.assign(n,s&&s.call?s(t.p):s),{}):r,eg(t.target),t.g,t.o,t.k)}let Gl,Oo,Io;Zs.bind({g:1});let pr=Zs.bind({k:1});function ig(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 og=e=>typeof e=="function",Js=(e,t)=>og(e)?e(t):e,ag=(()=>{let e=0;return()=>(++e).toString()})(),Yl=(()=>{let e;return()=>{if(e===void 0&&typeof window<"u"){let t=matchMedia("(prefers-reduced-motion: reduce)");e=!t||t.matches}return e}})(),lg=20,Do="default",Rl=(e,t)=>{let{toastLimit:r}=e.settings;switch(t.type){case 0:return{...e,toasts:[t.toast,...e.toasts].slice(0,r)};case 1:return{...e,toasts:e.toasts.map(o=>o.id===t.toast.id?{...o,...t.toast}:o)};case 2:let{toast:n}=t;return Rl(e,{type:e.toasts.find(o=>o.id===n.id)?1:0,toast:n});case 3:let{toastId:s}=t;return{...e,toasts:e.toasts.map(o=>o.id===s||s===void 0?{...o,dismissed:!0,visible:!1}:o)};case 4:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(o=>o.id!==t.toastId)};case 5:return{...e,pausedAt:t.time};case 6:let i=t.time-(e.pausedAt||0);return{...e,pausedAt:void 0,toasts:e.toasts.map(o=>({...o,pauseDuration:o.pauseDuration+i}))}}},ei=[],Xl={toasts:[],pausedAt:void 0,settings:{toastLimit:lg}},rr={},Zl=(e,t=Do)=>{rr[t]=Rl(rr[t]||Xl,e),ei.forEach(([r,n])=>{r===t&&n(rr[t])})},Jl=e=>Object.keys(rr).forEach(t=>Zl(e,t)),cg=e=>Object.keys(rr).find(t=>rr[t].toasts.some(r=>r.id===e)),ti=(e=Do)=>t=>{Zl(t,e)},ug={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},dg=(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)||ug[o.type],style:{...e.style,...(d=e[o.type])==null?void 0:d.style,...o.style}}});return{...r,toasts:i}},fg=(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)||ag()}),rs=e=>(t,r)=>{let n=fg(t,e,r);return ti(n.toasterId||cg(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 hg=1e3,pg=(e,t="default")=>{let{toasts:r,pausedAt:n}=dg(e,t),s=h.useRef(new Map).current,i=h.useCallback((f,g=hg)=>{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}}},gg=pr`
|
|
2
2
|
from {
|
|
3
3
|
transform: scale(0) rotate(45deg);
|
|
4
4
|
opacity: 0;
|
|
@@ -6,7 +6,7 @@ from {
|
|
|
6
6
|
to {
|
|
7
7
|
transform: scale(1) rotate(45deg);
|
|
8
8
|
opacity: 1;
|
|
9
|
-
}`,
|
|
9
|
+
}`,yg=pr`
|
|
10
10
|
from {
|
|
11
11
|
transform: scale(0);
|
|
12
12
|
opacity: 0;
|
|
@@ -14,7 +14,7 @@ from {
|
|
|
14
14
|
to {
|
|
15
15
|
transform: scale(1);
|
|
16
16
|
opacity: 1;
|
|
17
|
-
}`,
|
|
17
|
+
}`,vg=pr`
|
|
18
18
|
from {
|
|
19
19
|
transform: scale(0) rotate(90deg);
|
|
20
20
|
opacity: 0;
|
|
@@ -22,7 +22,7 @@ from {
|
|
|
22
22
|
to {
|
|
23
23
|
transform: scale(1) rotate(90deg);
|
|
24
24
|
opacity: 1;
|
|
25
|
-
}`,
|
|
25
|
+
}`,mg=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: ${
|
|
34
|
+
animation: ${gg} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)
|
|
35
35
|
forwards;
|
|
36
36
|
animation-delay: 100ms;
|
|
37
37
|
|
|
38
38
|
&:after,
|
|
39
39
|
&:before {
|
|
40
40
|
content: '';
|
|
41
|
-
animation: ${
|
|
41
|
+
animation: ${yg} 0.15s ease-out forwards;
|
|
42
42
|
animation-delay: 150ms;
|
|
43
43
|
position: absolute;
|
|
44
44
|
border-radius: 3px;
|
|
@@ -51,18 +51,18 @@ to {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
&:before {
|
|
54
|
-
animation: ${
|
|
54
|
+
animation: ${vg} 0.15s ease-out forwards;
|
|
55
55
|
animation-delay: 180ms;
|
|
56
56
|
transform: rotate(90deg);
|
|
57
57
|
}
|
|
58
|
-
`,
|
|
58
|
+
`,bg=pr`
|
|
59
59
|
from {
|
|
60
60
|
transform: rotate(0deg);
|
|
61
61
|
}
|
|
62
62
|
to {
|
|
63
63
|
transform: rotate(360deg);
|
|
64
64
|
}
|
|
65
|
-
`,
|
|
65
|
+
`,_g=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: ${
|
|
74
|
-
`,
|
|
73
|
+
animation: ${bg} 1s linear infinite;
|
|
74
|
+
`,wg=pr`
|
|
75
75
|
from {
|
|
76
76
|
transform: scale(0) rotate(45deg);
|
|
77
77
|
opacity: 0;
|
|
@@ -79,7 +79,7 @@ from {
|
|
|
79
79
|
to {
|
|
80
80
|
transform: scale(1) rotate(45deg);
|
|
81
81
|
opacity: 1;
|
|
82
|
-
}`,
|
|
82
|
+
}`,Sg=pr`
|
|
83
83
|
0% {
|
|
84
84
|
height: 0;
|
|
85
85
|
width: 0;
|
|
@@ -93,7 +93,7 @@ to {
|
|
|
93
93
|
100% {
|
|
94
94
|
opacity: 1;
|
|
95
95
|
height: 10px;
|
|
96
|
-
}`,
|
|
96
|
+
}`,Cg=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: ${
|
|
105
|
+
animation: ${wg} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)
|
|
106
106
|
forwards;
|
|
107
107
|
animation-delay: 100ms;
|
|
108
108
|
&:after {
|
|
109
109
|
content: '';
|
|
110
110
|
box-sizing: border-box;
|
|
111
|
-
animation: ${
|
|
111
|
+
animation: ${Sg} 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
|
-
`,
|
|
123
|
+
`,Eg=Or("div")`
|
|
124
124
|
position: absolute;
|
|
125
|
-
`,
|
|
125
|
+
`,Og=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
|
-
`,
|
|
132
|
+
`,Ig=pr`
|
|
133
133
|
from {
|
|
134
134
|
transform: scale(0.6);
|
|
135
135
|
opacity: 0.4;
|
|
@@ -137,20 +137,20 @@ from {
|
|
|
137
137
|
to {
|
|
138
138
|
transform: scale(1);
|
|
139
139
|
opacity: 1;
|
|
140
|
-
}`,
|
|
140
|
+
}`,Dg=Or("div")`
|
|
141
141
|
position: relative;
|
|
142
142
|
transform: scale(0.6);
|
|
143
143
|
opacity: 0.4;
|
|
144
144
|
min-width: 20px;
|
|
145
|
-
animation: ${
|
|
145
|
+
animation: ${Ig} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275)
|
|
146
146
|
forwards;
|
|
147
|
-
`,
|
|
147
|
+
`,Tg=({toast:e})=>{let{icon:t,type:r,iconTheme:n}=e;return t!==void 0?typeof t=="string"?Ne.createElement(Dg,null,t):t:r==="blank"?null:Ne.createElement(Og,null,Ne.createElement(_g,{...n}),r!=="loading"&&Ne.createElement(Eg,null,r==="error"?Ne.createElement(mg,{...n}):Ne.createElement(Cg,{...n})))},Ng=e=>`
|
|
148
148
|
0% {transform: translate3d(0,${e*-200}%,0) scale(.6); opacity:.5;}
|
|
149
149
|
100% {transform: translate3d(0,0,0) scale(1); opacity:1;}
|
|
150
|
-
`,
|
|
150
|
+
`,kg=e=>`
|
|
151
151
|
0% {transform: translate3d(0,0,-1px) scale(1); opacity:1;}
|
|
152
152
|
100% {transform: translate3d(0,${e*-150}%,-1px) scale(.6); opacity:0;}
|
|
153
|
-
`,
|
|
153
|
+
`,xg="0%{opacity:0;} 100%{opacity:1;}",Ag="0%{opacity:1;} 100%{opacity:0;}",Pg=Or("div")`
|
|
154
154
|
display: flex;
|
|
155
155
|
align-items: center;
|
|
156
156
|
background: #fff;
|
|
@@ -162,258 +162,258 @@ to {
|
|
|
162
162
|
pointer-events: auto;
|
|
163
163
|
padding: 8px 10px;
|
|
164
164
|
border-radius: 8px;
|
|
165
|
-
`,
|
|
165
|
+
`,Mg=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
|
-
`,
|
|
172
|
+
`,Lg=(e,t)=>{let r=e.includes("top")?1:-1,[n,s]=Yl()?[xg,Ag]:[Ng(r),kg(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)`}},Fg=Ne.memo(({toast:e,position:t,style:r,children:n})=>{let s=e.height?Lg(e.position||t||"top-center",e.visible):{opacity:0},i=Ne.createElement(Tg,{toast:e}),o=Ne.createElement(Mg,{...e.ariaProps},Js(e.message,e));return Ne.createElement(Pg,{className:e.className,style:{...s,...r,...e.style}},typeof n=="function"?n({icon:i,message:o}):Ne.createElement(Ne.Fragment,null,i,o))});ig(Ne.createElement);var $g=({id:e,className:t,style:r,onHeightUpdate:n,children:s})=>{let i=Ne.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 Ne.createElement("div",{ref:i,className:t,style:r},s)},jg=(e,t)=>{let r=e.includes("top"),n=r?{top:0}:{bottom:0},s=e.includes("center")?{justifyContent:"center"}:e.includes("right")?{justifyContent:"flex-end"}:{};return{left:0,right:0,display:"flex",position:"absolute",transition:Yl()?void 0:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${t*(r?1:-1)}px)`,...n,...s}},Bg=Zs`
|
|
173
173
|
z-index: 9999;
|
|
174
174
|
> * {
|
|
175
175
|
pointer-events: auto;
|
|
176
176
|
}
|
|
177
|
-
`,ri=16,
|
|
177
|
+
`,ri=16,Ug=({reverseOrder:e,position:t="top-center",toastOptions:r,gutter:n,children:s,toasterId:i,containerStyle:o,containerClassName:a})=>{let{toasts:c,handlers:d}=pg(r,i);return Ne.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=jg(f,g);return Ne.createElement($g,{id:u.id,key:u.id,onHeightUpdate:d.updateHeight,className:u.visible?Bg:"",style:y},u.type==="custom"?Js(u.message,u):s?s(u):Ne.createElement(Fg,{toast:u,position:f}))}))},Ie=et;function Vg(){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 qg(){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 zg(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 Hg(e){if(!e)return!1;const{TouchEvent:t}=Ct(e.target);return t&&e instanceof t}function li(e){if(Hg(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 zg(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 Wg(e){return e.matches(rc)?e:e.querySelector(rc)}const Qg={display:"none"};function Kg(e){let{id:t,value:r}=e;return h.createElement("div",{id:t,style:Qg},r)}function Gg(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 Rg(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 Xg(){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 Zg={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}=Rg(),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(Yg,{id:a,announcement:o}));return r?Me.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 ic(){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 oc(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 ac(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 lc(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 cc(e,t){if(!e||e.length===0)return null;const[r]=e;return r[t]}function uc(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=uc(t,t.left,t.top),i=[];for(const o of n){const{id:a}=o,c=r.get(a);if(c){const d=oc(uc(c),s);i.push({id:a,data:{droppableContainer:o,value:d}})}}return i.sort(ac)},iy=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=lc(t),i=[];for(const o of n){const{id:a}=o,c=r.get(a);if(c){const d=lc(c),u=s.reduce((g,y,_)=>g+oc(d[_],y),0),f=Number((u/4).toFixed(4));i.push({id:a,data:{droppableContainer:o,value:f}})}}return i.sort(ac)};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 dc(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 fc(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=fc(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}=Et(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 hc(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=Et(e).getComputedStyle(e)),t.position==="fixed"}function gy(e,t){t===void 0&&(t=Et(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)||tc(s)||r.includes(s))return r;const i=Et(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 pc(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 gc(e){return gn(e)?e.scrollX:e.scrollLeft}function yc(e){return gn(e)?e.scrollY:e.scrollTop}function Po(e){return{x:gc(e),y:yc(e)}}var nt;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(nt||(nt={}));function vc(e){return!ni||!e?!1:e===document.scrollingElement}function mc(e){const t={x:0,y:0},r=vc(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}=mc(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=nt.Backward,_.y=n*Math.abs((t.top+p.height-i)/p.height)):!u&&c>=t.bottom-p.height&&(y.y=nt.Forward,_.y=n*Math.abs((t.bottom-p.height-c)/p.height)),!g&&a>=t.right-p.width?(y.x=nt.Forward,_.x=n*Math.abs((t.right-p.width-a)/p.width)):!f&&o<=t.left+p.width&&(y.x=nt.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 bc(e){return e.reduce((t,r)=>vn(t,Po(r)),Gt)}function by(e){return e.reduce((t,r)=>t+gc(r),0)}function _y(e){return e.reduce((t,r)=>t+yc(r),0)}function _c(e,t){if(t===void 0&&(t=mn),!e)return;const{top:r,left:n,bottom:s,right:i}=t(e);pc(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=bc(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}=Et(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 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 wc(e){e.preventDefault()}function Cy(e){e.stopPropagation()}var Ce;(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"})(Ce||(Ce={}));const Sc={start:[Ce.Space,Ce.Enter],cancel:[Ce.Esc],end:[Ce.Space,Ce.Enter,Ce.Tab]},Ey=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case Ce.Right:return{...r,x:r.x+25};case Ce.Left:return{...r,x:r.x-25};case Ce.Down:return{...r,y:r.y+25};case Ce.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(Et(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&&_c(n),r(Gt)}handleKeyDown(t){if(ai(t)){const{active:r,context:n,options:s}=this.props,{keyboardCodes:i=Sc,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:T}=mc(p),x=my(p),A={x:Math.min(v===Ce.Right?x.right-x.width/2:x.right,Math.max(v===Ce.Right?x.left:x.left+x.width/2,f.x)),y:Math.min(v===Ce.Down?x.bottom-x.height/2:x.bottom,Math.max(v===Ce.Down?x.top:x.top+x.height/2,f.y))},$=v===Ce.Right&&!b||v===Ce.Left&&!S,N=v===Ce.Down&&!w||v===Ce.Up&&!m;if($&&A.x!==f.x){const P=p.scrollLeft+g.x,U=v===Ce.Right&&P<=E.x||v===Ce.Left&&P>=T.x;if(U&&!g.y){p.scrollTo({left:P,behavior:a});return}U?y.x=p.scrollLeft-P:y.x=v===Ce.Right?p.scrollLeft-E.x:p.scrollLeft-T.x,y.x&&p.scrollBy({left:-y.x,behavior:a});break}else if(N&&A.y!==f.y){const P=p.scrollTop+g.y,U=v===Ce.Down&&P<=E.y||v===Ce.Up&&P>=T.y;if(U&&!g.x){p.scrollTo({top:P,behavior:a});return}U?y.y=p.scrollTop-P:y.y=v===Ce.Down?p.scrollTop-E.y:p.scrollTop-T.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=Sc,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 Cc(e){return!!(e&&"distance"in e)}function Ec(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(Et(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(Ut.Resize,this.handleCancel),this.windowListeners.add(Ut.DragStart,wc),this.windowListeners.add(Ut.VisibilityChange,this.handleCancel),this.windowListeners.add(Ut.ContextMenu,wc),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(Ec(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(Cc(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(Ut.Click,Cy,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Ut.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(Cc(a)){if(a.tolerance!=null&&Lo(d,a.tolerance))return this.handleCancel();if(Lo(d,a.distance))return this.handleStart()}if(Ec(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===Ce.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 T=S.current;if(!T)return;const x=v.current.x*m.current.x,A=v.current.y*m.current.y;T.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 T of E){if((n==null?void 0:n(T))===!1)continue;const x=d.indexOf(T),A=u[x];if(!A)continue;const{direction:$,speed:N}=vy(T,A,b,t,g);for(const P of["x","y"])y[P][$[P]]||(N[P]=0,$[P]=0);if(N.x>0||N.y>0){p(),S.current=T,_(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:{[nt.Backward]:!1,[nt.Forward]:!1},y:{[nt.Backward]:!1,[nt.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:{[nt.Backward]:s.x[nt.Backward]||i.x===-1,[nt.Forward]:s.x[nt.Forward]||i.x===1},y:{[nt.Backward]:s.y[nt.Backward]||i.y===-1,[nt.Forward]:s.y[nt.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 Oc=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 Oc;if(!m||m===Oc||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 Ic(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 dc(e,t)}const Dc=[];function By(e){const t=h.useRef(e),r=is(n=>e?n&&n!==Dc&&e&&t.current&&e.parentNode===t.current.parentNode?n:ui(e):Dc,[e]);return h.useEffect(()=>{t.current=e},[e]),r}function 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):bc(e):Gt,[e,t])}function Tc(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 Nc(e){return h.useMemo(()=>e?hy(e):null,[e])}const kc=[];function zy(e,t){t===void 0&&(t=mn);const[r]=e,n=Nc(r?Et(r):null),[s,i]=h.useState(kc);function o(){i(()=>e.length?e.map(c=>vc(c)?n:new Mo(t(c),c)):kc)}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 xc(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=xc(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:hc},droppable:{measure:hc,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},Ac={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:ci,draggableNodes:new Map,over:null,measureDroppableContainers:ci},fs=h.createContext(Ac),Pc=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 Yy(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 Ry(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 Mc(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=dc(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=pc(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 Lc=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(Yy,void 0,Gy),[v,m]=p,[b,S]=Zg(),[w,E]=h.useState(Dr.Uninitialized),T=w===Dr.Initialized,{draggable:{active:x,nodes:A,translate:$},droppable:{containers:N}}=v,P=x!=null?A.get(x):null,U=h.useRef({initial:null,translated:null}),M=h.useMemo(()=>{var ct;return x!=null?{id:x,data:(ct=P==null?void 0:P.data)!=null?ct:Qy,rect:U}:null},[x,P]),L=h.useRef(null),[j,Z]=h.useState(null),[te,_e]=h.useState(null),we=ss(_,Object.values(_)),ve=os("DndDescribedBy",o),z=h.useMemo(()=>N.getEnabled(),[N]),J=Xy(g),{droppableRects:se,measureDroppableContainers:V,measuringScheduled:R}=My(z,{dragging:T,dependencies:[$.x,$.y],config:J.droppable}),G=Ay(A,x),ae=h.useMemo(()=>te?li(te):null,[te]),Oe=hn(),$e=Ly(G,J.draggable.measure);Zy({activeNode:x!=null?A.get(x):null,config:Oe.layoutShiftCompensation,initialRect:$e,measure:J.draggable.measure});const ge=Ic(G,J.draggable.measure,$e),le=Ic(G?G.parentElement:null),he=h.useRef({activatorEvent:null,active:null,activeNode:G,collisionRect:null,collisions:null,droppableRects:se,draggableNodes:A,draggingNode:null,draggingNodeRect:null,droppableContainers:N,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),je=N.getNodeFor((r=he.current.over)==null?void 0:r.id),ze=Hy({measure:J.dragOverlay.measure}),Ae=(n=ze.nodeRef.current)!=null?n:G,ee=T?(s=ze.rect)!=null?s:ge:null,Ke=!!(ze.nodeRef.current&&ze.rect),rt=jy(Ke?null:ge),lt=Nc(Ae?Et(Ae):null),He=By(T?je??G:null),Ze=zy(He),H=Mc(y,{transform:{x:$.x-rt.x,y:$.y-rt.y,scaleX:1,scaleY:1},activatorEvent:te,active:M,activeNodeRect:ge,containerNodeRect:le,draggingNodeRect:ee,over:he.current.over,overlayNodeRect:ze.rect,scrollableAncestors:He,scrollableAncestorRects:Ze,windowRect:lt}),de=ae?vn(ae,$):null,me=Uy(He),dr=Tc(me),mr=Tc(me,[ge]),C=vn(H,dr),D=ee?uy(ee,H):null,k=M&&D?f({active:M,collisionRect:D,droppableRects:se,droppableContainers:z,pointerCoordinates:de}):null,B=cc(k,"id"),[q,Q]=h.useState(null),W=Ke?H:vn(H,mr),re=ly(W,(i=q==null?void 0:q.rect)!=null?i:null,ge),ye=h.useRef(null),Ge=h.useCallback((ct,Ct)=>{let{sensor:It,options:tr}=Ct;if(L.current==null)return;const Qt=A.get(L.current);if(!Qt)return;const Bt=ct.nativeEvent,fr=new It({active:L.current,activeNode:Qt,event:Bt,options:tr,context:he,onAbort(pt){if(!A.get(pt))return;const{onDragAbort:hr}=we.current,_r={id:pt};hr==null||hr(_r),b({type:"onDragAbort",event:_r})},onPending(pt,Br,hr,_r){if(!A.get(pt))return;const{onDragPending:Ws}=we.current,Ur={id:pt,constraint:Br,initialCoordinates:hr,offset:_r};Ws==null||Ws(Ur),b({type:"onDragPending",event:Ur})},onStart(pt){const Br=L.current;if(Br==null)return;const hr=A.get(Br);if(!hr)return;const{onDragStart:_r}=we.current,Hs={activatorEvent:Bt,active:{id:Br,data:hr.data,rect:U}};Me.unstable_batchedUpdates(()=>{_r==null||_r(Hs),E(Dr.Initializing),m({type:tt.DragStart,initialCoordinates:pt,active:Br}),b({type:"onDragStart",event:Hs}),Z(ye.current),_e(Bt)})},onMove(pt){m({type:tt.DragMove,coordinates:pt})},onEnd:Xn(tt.DragEnd),onCancel:Xn(tt.DragCancel)});ye.current=fr;function Xn(pt){return async function(){const{active:hr,collisions:_r,over:Hs,scrollAdjustedTranslate:Ws}=he.current;let Ur=null;if(hr&&Ws){const{cancelDrop:Qs}=we.current;Ur={activatorEvent:Bt,active:hr,collisions:_r,delta:Ws,over:Hs},pt===tt.DragEnd&&typeof Qs=="function"&&await Promise.resolve(Qs(Ur))&&(pt=tt.DragCancel)}L.current=null,Me.unstable_batchedUpdates(()=>{m({type:pt}),E(Dr.Uninitialized),Q(null),Z(null),_e(null),ye.current=null;const Qs=pt===tt.DragEnd?"onDragEnd":"onDragCancel";if(Ur){const bl=we.current[Qs];bl==null||bl(Ur),b({type:Qs,event:Ur})}})}}},[A]),At=h.useCallback((ct,Ct)=>(It,tr)=>{const Qt=It.nativeEvent,Bt=A.get(tr);if(L.current!==null||!Bt||Qt.dndKit||Qt.defaultPrevented)return;const fr={active:Bt};ct(It,Ct.options,fr)===!0&&(Qt.dndKit={capturedBy:Ct.sensor},L.current=tr,Ge(It,Ct))},[A,Ge]),Pt=Py(u,At);Vy(u),Kt(()=>{ge&&w===Dr.Initializing&&E(Dr.Initialized)},[ge,w]),h.useEffect(()=>{const{onDragMove:ct}=we.current,{active:Ct,activatorEvent:It,collisions:tr,over:Qt}=he.current;if(!Ct||!It)return;const Bt={active:Ct,activatorEvent:It,collisions:tr,delta:{x:C.x,y:C.y},over:Qt};Me.unstable_batchedUpdates(()=>{ct==null||ct(Bt),b({type:"onDragMove",event:Bt})})},[C.x,C.y]),h.useEffect(()=>{const{active:ct,activatorEvent:Ct,collisions:It,droppableContainers:tr,scrollAdjustedTranslate:Qt}=he.current;if(!ct||L.current==null||!Ct||!Qt)return;const{onDragOver:Bt}=we.current,fr=tr.get(B),Xn=fr&&fr.rect.current?{id:fr.id,rect:fr.rect.current,data:fr.data,disabled:fr.disabled}:null,pt={active:ct,activatorEvent:Ct,collisions:It,delta:{x:Qt.x,y:Qt.y},over:Xn};Me.unstable_batchedUpdates(()=>{Q(Xn),Bt==null||Bt(pt),b({type:"onDragOver",event:pt})})},[B]),Kt(()=>{he.current={activatorEvent:te,active:M,activeNode:G,collisionRect:D,collisions:k,droppableRects:se,draggableNodes:A,draggingNode:Ae,draggingNodeRect:ee,droppableContainers:N,over:q,scrollableAncestors:He,scrollAdjustedTranslate:C},U.current={initial:ee,translated:D}},[M,G,k,D,A,Ae,ee,se,N,q,He,C]),Ny({...Oe,delta:$,draggingRect:D,pointerCoordinates:de,scrollableAncestors:He,scrollableAncestorRects:Ze});const br=h.useMemo(()=>({active:M,activeNode:G,activeNodeRect:ge,activatorEvent:te,collisions:k,containerNodeRect:le,dragOverlay:ze,draggableNodes:A,droppableContainers:N,droppableRects:se,over:q,measureDroppableContainers:V,scrollableAncestors:He,scrollableAncestorRects:Ze,measuringConfiguration:J,measuringScheduled:R,windowRect:lt}),[M,G,ge,te,k,le,ze,A,N,se,q,V,He,Ze,J,R,lt]),zs=h.useMemo(()=>({activatorEvent:te,activators:Pt,active:M,activeNodeRect:ge,ariaDescribedById:{draggable:ve},dispatch:m,draggableNodes:A,over:q,measureDroppableContainers:V}),[te,Pt,M,ge,m,ve,A,q,V]);return h.createElement(sc.Provider,{value:S},h.createElement(fs.Provider,{value:zs},h.createElement(Pc.Provider,{value:br},h.createElement(gi.Provider,{value:re},d)),h.createElement(Ry,{disabled:(a==null?void 0:a.restoreFocus)===!1})),h.createElement(ty,{...a,hiddenTextDescribedById:ve}));function hn(){const ct=(j==null?void 0:j.autoScrollEnabled)===!1,Ct=typeof c=="object"?c.enabled===!1:c===!1,It=T&&!ct&&!Ct;return typeof c=="object"?{...c,enabled:It}:{enabled:It}}}),Jy=h.createContext(null),Fc="button",ev="Draggable";function $c(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=Fc,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(),T=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===Fc?!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:T,node:b,over:g,setNodeRef:S,setActivatorNodeRef:E,transform:m}}function jc(){return h.useContext(Pc)}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,T]=ii(w),x=ss(t);return h.useEffect(()=>{!S||!E.current||(S.disconnect(),f.current=!1,S.observe(E.current))},[E,S]),h.useEffect(()=>(a({type: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:T}}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:Ac},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=xc(o);if(!d)return;const{transform:u}=Et(o).getComputedStyle(o),f=fc(u);if(!f)return;const g=typeof t=="function"?t:fv(t);return _c(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 Bc=0;function hv(e){return h.useMemo(()=>{if(e!=null)return Bc++,Bc},[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}=jc(),T=h.useContext(gi),x=hv(f==null?void 0:f.id),A=Mc(o,{activatorEvent:u,active:f,activeNodeRect:g,containerNodeRect:y,draggingNodeRect:v.rect,over:m,overlayNodeRect:v.rect,scrollableAncestors:S,scrollableAncestorRects:w,transform:T,windowRect:E}),$=Vo(g),N=dv({config:n,draggableNodes:_,droppableContainers:p,measuringConfiguration:b}),P=$?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:P,as:a,activatorEvent:u,adjustScale:t,className:c,transition:i,rect:$,style:{zIndex:d,...s},transform:A},r):null))});/**
|
|
181
|
+
`},Jg={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 ey(e){let{announcements:t=Jg,container:r,hiddenTextDescribedById:n,screenReaderInstructions:s=Zg}=e;const{announce:i,announcement:o}=Yg(),a=os("DndLiveRegion"),[c,d]=h.useState(!1);if(h.useEffect(()=>{d(!0)},[]),Rg(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(Kg,{id:n,value:s.draggable}),h.createElement(Gg,{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 ty(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 ry(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 ny=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)},sy=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 iy(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 oy=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=iy(a,t);c>0&&s.push({id:o,data:{droppableContainer:i,value:c}})}}return s.sort(ry)};function ay(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 ly(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 cy=ly(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 uy(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 dy={ignoreTransform:!1};function mn(e,t){t===void 0&&(t=dy);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:u}=Ct(e).getComputedStyle(e);d&&(r=uy(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 fy(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function hy(e,t){return t===void 0&&(t=Ct(e).getComputedStyle(e)),t.position==="fixed"}function py(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&&py(s,i)&&r.push(s),hy(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 gy={x:.2,y:.2};function yy(e,t,r,n,s){let{top:i,left:o,right:a,bottom:c}=r;n===void 0&&(n=10),s===void 0&&(s=gy);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 vy(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 my(e){return e.reduce((t,r)=>t+pc(r),0)}function by(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 _y=[["x",["left","right"],my],["y",["top","bottom"],by]];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 _y)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 wy(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 Sy(e){e.stopPropagation()}var Se;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(Se||(Se={}));const wc={start:[Se.Space,Se.Enter],cancel:[Se.Esc],end:[Se.Space,Se.Enter,Se.Tab]},Cy=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case Se.Right:return{...r,x:r.x+25};case Se.Left:return{...r,x:r.x-25};case Se.Down:return{...r,y:r.y+25};case Se.Up:return{...r,y:r.y-25}}};class 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=Cy,scrollBehavior:a="smooth"}=s,{code:c}=t;if(i.end.includes(c)){this.handleEnd(t);return}if(i.cancel.includes(c)){this.handleCancel(t);return}const{collisionRect:d}=n.current,u=d?{x:d.left,y:d.top}: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=vy(p),A={x:Math.min(v===Se.Right?x.right-x.width/2:x.right,Math.max(v===Se.Right?x.left:x.left+x.width/2,f.x)),y:Math.min(v===Se.Down?x.bottom-x.height/2:x.bottom,Math.max(v===Se.Down?x.top:x.top+x.height/2,f.y))},$=v===Se.Right&&!b||v===Se.Left&&!S,N=v===Se.Down&&!w||v===Se.Up&&!m;if($&&A.x!==f.x){const P=p.scrollLeft+g.x,U=v===Se.Right&&P<=E.x||v===Se.Left&&P>=D.x;if(U&&!g.y){p.scrollTo({left:P,behavior:a});return}U?y.x=p.scrollLeft-P:y.x=v===Se.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 P=p.scrollTop+g.y,U=v===Se.Down&&P<=E.y||v===Se.Up&&P>=D.y;if(U&&!g.x){p.scrollTo({top:P,behavior:a});return}U?y.y=p.scrollTop-P:y.y=v===Se.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=wy(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,Sy,{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===Se.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Ey={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,Ey,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 Oy={move:{name:"mousemove"},end:{name:"mouseup"}};var jo;(function(e){e[e.RightClick=2]="RightClick"})(jo||(jo={}));class Iy extends $o{constructor(t){super(t,Oy,yn(t.event.target))}}Iy.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 Dy 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(){}}}Dy.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;const{touches:s}=r;return s.length>1?!1:(n==null||n({event:r}),!0)}}];var 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 Ty(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=ky({delta:f,disabled:!i}),[_,p]=qg(),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}=yy(D,A,b,t,g);for(const P of["x","y"])y[P][$[P]]||(N[P]=0,$[P]=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 Ny={x:{[rt.Backward]:!1,[rt.Forward]:!1},y:{[rt.Backward]:!1,[rt.Forward]:!1}};function ky(e){let{delta:t,disabled:r}=e;const n=oi(t);return is(s=>{if(r||!n||!s)return Ny;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 xy(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 Ay(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 Py(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 My(e,t){return Vo(e,t)}function Ly(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 Fy(e){return new Mo(mn(e),e)}function Oc(e,t,r){t===void 0&&(t=Fy);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=Ly({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 $y(e){const t=Vo(e);return uc(e,t)}const Ic=[];function jy(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 By(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 Uy(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 Vy(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?fy(e):null,[e])}const Nc=[];function qy(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 zy(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 Hy=[{sensor:di,options:{}},{sensor:Fo,options:{}}],Wy={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 Qy={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(Qy);function Ky(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new ds}}}function Gy(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=Wg(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 Ry(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 Xy(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=Hy,collisionDetection:f=oy,measuring:g,modifiers:y,..._}=t;const p=h.useReducer(Gy,void 0,Ky),[v,m]=p,[b,S]=Xg(),[w,E]=h.useState(Dr.Uninitialized),D=w===Dr.Initialized,{draggable:{active:x,nodes:A,translate:$},droppable:{containers:N}}=v,P=x!=null?A.get(x):null,U=h.useRef({initial:null,translated:null}),M=h.useMemo(()=>{var at;return x!=null?{id:x,data:(at=P==null?void 0:P.data)!=null?at:Wy,rect:U}:null},[x,P]),L=h.useRef(null),[j,X]=h.useState(null),[se,Oe]=h.useState(null),_e=ss(_,Object.values(_)),ve=os("DndDescribedBy",o),z=h.useMemo(()=>N.getEnabled(),[N]),J=Ry(g),{droppableRects:te,measureDroppableContainers:V,measuringScheduled:Z}=Py(z,{dragging:D,dependencies:[$.x,$.y],config:J.droppable}),G=xy(A,x),ce=h.useMemo(()=>se?li(se):null,[se]),ee=hn(),ge=My(G,J.draggable.measure);Xy({activeNode:x!=null?A.get(x):null,config:ee.layoutShiftCompensation,initialRect:ge,measure:J.draggable.measure});const ae=Oc(G,J.draggable.measure,ge),Ye=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),Re=zy({measure:J.dragOverlay.measure}),qe=(n=Re.nodeRef.current)!=null?n:G,re=D?(s=Re.rect)!=null?s:ae:null,Le=!!(Re.nodeRef.current&&Re.rect),Ve=$y(Le?null:ae),Je=Tc(qe?Ct(qe):null),ft=jy(D?Ze??G:null),Wt=qy(ft),W=Pc(y,{transform:{x:$.x-Ve.x,y:$.y-Ve.y,scaleX:1,scaleY:1},activatorEvent:se,active:M,activeNodeRect:ae,containerNodeRect:Ye,draggingNodeRect:re,over:Ee.current.over,overlayNodeRect:Re.rect,scrollableAncestors:ft,scrollableAncestorRects:Wt,windowRect:Je}),fe=ce?vn(ce,$):null,me=By(ft),dr=Dc(me),mr=Dc(me,[ae]),C=vn(W,dr),T=re?cy(re,W):null,k=M&&T?f({active:M,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=ay(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}=_e.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}=_e.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}=_e.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),Oe(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}=_e.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),Oe(null),ye.current=null;const Qs=ht===tt.DragEnd?"onDragEnd":"onDragCancel";if(Ur){const ml=_e.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=Ay(u,xt);Uy(u),Kt(()=>{ae&&w===Dr.Initializing&&E(Dr.Initialized)},[ae,w]),h.useEffect(()=>{const{onDragMove:at}=_e.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}=_e.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:M,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}},[M,G,k,T,A,qe,re,te,N,q,ft,C]),Ty({...ee,delta:$,draggingRect:T,pointerCoordinates:fe,scrollableAncestors:ft,scrollableAncestorRects:Wt});const br=h.useMemo(()=>({active:M,activeNode:G,activeNodeRect:ae,activatorEvent:se,collisions:k,containerNodeRect:Ye,dragOverlay:Re,draggableNodes:A,droppableContainers:N,droppableRects:te,over:q,measureDroppableContainers:V,scrollableAncestors:ft,scrollableAncestorRects:Wt,measuringConfiguration:J,measuringScheduled:Z,windowRect:Je}),[M,G,ae,se,k,Ye,Re,A,N,te,q,V,ft,Wt,J,Z,Je]),zs=h.useMemo(()=>({activatorEvent:se,activators:At,active:M,activeNodeRect:ae,ariaDescribedById:{draggable:ve},dispatch:m,draggableNodes:A,over:q,measureDroppableContainers:V}),[se,At,M,ae,m,ve,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(ey,{...a,hiddenTextDescribedById:ve}));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}}}),Zy=h.createContext(null),Lc="button",Jy="Draggable";function Fc(e){let{id:t,data:r,disabled:n=!1,attributes:s}=e;const i=os(Jy),{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:Zy),[b,S]=ii(),[w,E]=ii(),D=Vy(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 ev="Droppable",tv={timeout:25};function rv(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:s}=e;const i=os(ev),{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}={...tv,...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 nv(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 sv={x:0,y:0,scaleX:1,scaleY:1};function iv(e){let{children:t}=e;return h.createElement(fs.Provider,{value:xc},h.createElement(gi.Provider,{value:sv},t))}const ov={position:"fixed",touchAction:"none"},av=e=>ai(e)?"transform 250ms ease":void 0,lv=h.forwardRef((e,t)=>{let{as:r,activatorEvent:n,adjustScale:s,children:i,className:o,rect:a,style:c,transform:d,transition:u=av}=e;if(!a)return null;const f=s?d:{...d,scaleX:1,scaleY:1},g={...ov,width:a.width,height:a.height,top:a.top,left:a.left,transform:Ir.Transform.toString(f),transformOrigin:s&&n?ty(n,a):void 0,transition:typeof u=="function"?u(n):u,...c};return h.createElement(r,{className:o,style:g,ref:t},i)}),cv={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 uv(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:dv(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 dv(e){const{duration:t,easing:r,sideEffects:n,keyframes:s}={...cv,...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 fv(e){return h.useMemo(()=>{if(e!=null)return jc++,jc},[e])}const hv=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=fv(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=uv({config:n,draggableNodes:_,droppableContainers:p,measuringConfiguration:b}),P=$?v.setRef:void 0;return h.createElement(iv,null,h.createElement(nv,{animation:N},f&&x?h.createElement(lv,{key:x,id:f.id,ref:P,as:a,activatorEvent:u,adjustScale:t,className:c,transition:i,rect:$,style:{zIndex:d,...s},transform:A},r):null))});/**
|
|
182
182
|
* @license lucide-react v0.400.0 - ISC
|
|
183
183
|
*
|
|
184
184
|
* This source code is licensed under the ISC license.
|
|
185
185
|
* See the LICENSE file in the root directory of this source tree.
|
|
186
|
-
*/const
|
|
186
|
+
*/const pv=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Bc=(...e)=>e.filter((t,r,n)=>!!t&&n.indexOf(t)===r).join(" ");/**
|
|
187
187
|
* @license lucide-react v0.400.0 - ISC
|
|
188
188
|
*
|
|
189
189
|
* This source code is licensed under the ISC license.
|
|
190
190
|
* See the LICENSE file in the root directory of this source tree.
|
|
191
|
-
*/var
|
|
191
|
+
*/var gv={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
192
192
|
* @license lucide-react v0.400.0 - ISC
|
|
193
193
|
*
|
|
194
194
|
* This source code is licensed under the ISC license.
|
|
195
195
|
* See the LICENSE file in the root directory of this source tree.
|
|
196
|
-
*/const
|
|
196
|
+
*/const yv=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,...gv,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:Bc("lucide",s),...a},[...o.map(([d,u])=>h.createElement(d,u)),...Array.isArray(i)?i:[i]]));/**
|
|
197
197
|
* @license lucide-react v0.400.0 - ISC
|
|
198
198
|
*
|
|
199
199
|
* This source code is licensed under the ISC license.
|
|
200
200
|
* See the LICENSE file in the root directory of this source tree.
|
|
201
|
-
*/const
|
|
201
|
+
*/const ue=(e,t)=>{const r=h.forwardRef(({className:n,...s},i)=>h.createElement(yv,{ref:i,iconNode:t,className:Bc(`lucide-${pv(e)}`,n),...s}));return r.displayName=`${e}`,r};/**
|
|
202
202
|
* @license lucide-react v0.400.0 - ISC
|
|
203
203
|
*
|
|
204
204
|
* This source code is licensed under the ISC license.
|
|
205
205
|
* See the LICENSE file in the root directory of this source tree.
|
|
206
|
-
*/const
|
|
206
|
+
*/const vv=ue("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
|
|
207
207
|
* @license lucide-react v0.400.0 - ISC
|
|
208
208
|
*
|
|
209
209
|
* This source code is licensed under the ISC license.
|
|
210
210
|
* See the LICENSE file in the root directory of this source tree.
|
|
211
|
-
*/const
|
|
211
|
+
*/const mv=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"}]]);/**
|
|
212
212
|
* @license lucide-react v0.400.0 - ISC
|
|
213
213
|
*
|
|
214
214
|
* This source code is licensed under the ISC license.
|
|
215
215
|
* See the LICENSE file in the root directory of this source tree.
|
|
216
|
-
*/const
|
|
216
|
+
*/const bv=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"}]]);/**
|
|
217
217
|
* @license lucide-react v0.400.0 - ISC
|
|
218
218
|
*
|
|
219
219
|
* This source code is licensed under the ISC license.
|
|
220
220
|
* See the LICENSE file in the root directory of this source tree.
|
|
221
|
-
*/const bn=
|
|
221
|
+
*/const bn=ue("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
|
|
222
222
|
* @license lucide-react v0.400.0 - ISC
|
|
223
223
|
*
|
|
224
224
|
* This source code is licensed under the ISC license.
|
|
225
225
|
* See the LICENSE file in the root directory of this source tree.
|
|
226
|
-
*/const hs=
|
|
226
|
+
*/const hs=ue("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
|
|
227
227
|
* @license lucide-react v0.400.0 - ISC
|
|
228
228
|
*
|
|
229
229
|
* This source code is licensed under the ISC license.
|
|
230
230
|
* See the LICENSE file in the root directory of this source tree.
|
|
231
|
-
*/const
|
|
231
|
+
*/const Uc=ue("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
|
|
232
232
|
* @license lucide-react v0.400.0 - ISC
|
|
233
233
|
*
|
|
234
234
|
* This source code is licensed under the ISC license.
|
|
235
235
|
* See the LICENSE file in the root directory of this source tree.
|
|
236
|
-
*/const
|
|
236
|
+
*/const _v=ue("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
|
|
237
237
|
* @license lucide-react v0.400.0 - ISC
|
|
238
238
|
*
|
|
239
239
|
* This source code is licensed under the ISC license.
|
|
240
240
|
* See the LICENSE file in the root directory of this source tree.
|
|
241
|
-
*/const
|
|
241
|
+
*/const 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"}]]);/**
|
|
242
242
|
* @license lucide-react v0.400.0 - ISC
|
|
243
243
|
*
|
|
244
244
|
* This source code is licensed under the ISC license.
|
|
245
245
|
* See the LICENSE file in the root directory of this source tree.
|
|
246
|
-
*/const qo=
|
|
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"}]]);/**
|
|
247
247
|
* @license lucide-react v0.400.0 - ISC
|
|
248
248
|
*
|
|
249
249
|
* This source code is licensed under the ISC license.
|
|
250
250
|
* See the LICENSE file in the root directory of this source tree.
|
|
251
|
-
*/const
|
|
251
|
+
*/const wv=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"}]]);/**
|
|
252
252
|
* @license lucide-react v0.400.0 - ISC
|
|
253
253
|
*
|
|
254
254
|
* This source code is licensed under the ISC license.
|
|
255
255
|
* See the LICENSE file in the root directory of this source tree.
|
|
256
|
-
*/const Sv=
|
|
256
|
+
*/const Sv=ue("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
|
|
257
257
|
* @license lucide-react v0.400.0 - ISC
|
|
258
258
|
*
|
|
259
259
|
* This source code is licensed under the ISC license.
|
|
260
260
|
* See the LICENSE file in the root directory of this source tree.
|
|
261
|
-
*/const Cv=
|
|
261
|
+
*/const Cv=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"}]]);/**
|
|
262
262
|
* @license lucide-react v0.400.0 - ISC
|
|
263
263
|
*
|
|
264
264
|
* This source code is licensed under the ISC license.
|
|
265
265
|
* See the LICENSE file in the root directory of this source tree.
|
|
266
|
-
*/const
|
|
266
|
+
*/const 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"}]]);/**
|
|
267
267
|
* @license lucide-react v0.400.0 - ISC
|
|
268
268
|
*
|
|
269
269
|
* This source code is licensed under the ISC license.
|
|
270
270
|
* See the LICENSE file in the root directory of this source tree.
|
|
271
|
-
*/const
|
|
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"}]]);/**
|
|
272
272
|
* @license lucide-react v0.400.0 - ISC
|
|
273
273
|
*
|
|
274
274
|
* This source code is licensed under the ISC license.
|
|
275
275
|
* See the LICENSE file in the root directory of this source tree.
|
|
276
|
-
*/const _n=
|
|
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"}]]);/**
|
|
277
277
|
* @license lucide-react v0.400.0 - ISC
|
|
278
278
|
*
|
|
279
279
|
* This source code is licensed under the ISC license.
|
|
280
280
|
* See the LICENSE file in the root directory of this source tree.
|
|
281
|
-
*/const Ev=
|
|
281
|
+
*/const Ev=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"}]]);/**
|
|
282
282
|
* @license lucide-react v0.400.0 - ISC
|
|
283
283
|
*
|
|
284
284
|
* This source code is licensed under the ISC license.
|
|
285
285
|
* See the LICENSE file in the root directory of this source tree.
|
|
286
|
-
*/const
|
|
286
|
+
*/const 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"}]]);/**
|
|
287
287
|
* @license lucide-react v0.400.0 - ISC
|
|
288
288
|
*
|
|
289
289
|
* This source code is licensed under the ISC license.
|
|
290
290
|
* See the LICENSE file in the root directory of this source tree.
|
|
291
|
-
*/const Ov=
|
|
291
|
+
*/const Ov=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"}]]);/**
|
|
292
292
|
* @license lucide-react v0.400.0 - ISC
|
|
293
293
|
*
|
|
294
294
|
* This source code is licensed under the ISC license.
|
|
295
295
|
* See the LICENSE file in the root directory of this source tree.
|
|
296
|
-
*/const
|
|
296
|
+
*/const 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"}]]);/**
|
|
297
297
|
* @license lucide-react v0.400.0 - ISC
|
|
298
298
|
*
|
|
299
299
|
* This source code is licensed under the ISC license.
|
|
300
300
|
* See the LICENSE file in the root directory of this source tree.
|
|
301
|
-
*/const Iv=
|
|
301
|
+
*/const Iv=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"}]]);/**
|
|
302
302
|
* @license lucide-react v0.400.0 - ISC
|
|
303
303
|
*
|
|
304
304
|
* This source code is licensed under the ISC license.
|
|
305
305
|
* See the LICENSE file in the root directory of this source tree.
|
|
306
|
-
*/const
|
|
306
|
+
*/const 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"}]]);/**
|
|
307
307
|
* @license lucide-react v0.400.0 - ISC
|
|
308
308
|
*
|
|
309
309
|
* This source code is licensed under the ISC license.
|
|
310
310
|
* See the LICENSE file in the root directory of this source tree.
|
|
311
|
-
*/const
|
|
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"}]]);/**
|
|
312
312
|
* @license lucide-react v0.400.0 - ISC
|
|
313
313
|
*
|
|
314
314
|
* This source code is licensed under the ISC license.
|
|
315
315
|
* See the LICENSE file in the root directory of this source tree.
|
|
316
|
-
*/const Dv=
|
|
316
|
+
*/const Dv=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"}]]);/**
|
|
317
317
|
* @license lucide-react v0.400.0 - ISC
|
|
318
318
|
*
|
|
319
319
|
* This source code is licensed under the ISC license.
|
|
320
320
|
* See the LICENSE file in the root directory of this source tree.
|
|
321
|
-
*/const yi=
|
|
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"}]]);/**
|
|
322
322
|
* @license lucide-react v0.400.0 - ISC
|
|
323
323
|
*
|
|
324
324
|
* This source code is licensed under the ISC license.
|
|
325
325
|
* See the LICENSE file in the root directory of this source tree.
|
|
326
|
-
*/const
|
|
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"}]]);/**
|
|
327
327
|
* @license lucide-react v0.400.0 - ISC
|
|
328
328
|
*
|
|
329
329
|
* This source code is licensed under the ISC license.
|
|
330
330
|
* See the LICENSE file in the root directory of this source tree.
|
|
331
|
-
*/const
|
|
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"}]]);/**
|
|
332
332
|
* @license lucide-react v0.400.0 - ISC
|
|
333
333
|
*
|
|
334
334
|
* This source code is licensed under the ISC license.
|
|
335
335
|
* See the LICENSE file in the root directory of this source tree.
|
|
336
|
-
*/const Tv=
|
|
336
|
+
*/const Tv=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"}]]);/**
|
|
337
337
|
* @license lucide-react v0.400.0 - ISC
|
|
338
338
|
*
|
|
339
339
|
* This source code is licensed under the ISC license.
|
|
340
340
|
* See the LICENSE file in the root directory of this source tree.
|
|
341
|
-
*/const Nv=
|
|
341
|
+
*/const Nv=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"}]]);/**
|
|
342
342
|
* @license lucide-react v0.400.0 - ISC
|
|
343
343
|
*
|
|
344
344
|
* This source code is licensed under the ISC license.
|
|
345
345
|
* See the LICENSE file in the root directory of this source tree.
|
|
346
|
-
*/const kv=
|
|
346
|
+
*/const kv=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"}]]);/**
|
|
347
347
|
* @license lucide-react v0.400.0 - ISC
|
|
348
348
|
*
|
|
349
349
|
* This source code is licensed under the ISC license.
|
|
350
350
|
* See the LICENSE file in the root directory of this source tree.
|
|
351
|
-
*/const xv=
|
|
351
|
+
*/const xv=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"}]]);/**
|
|
352
352
|
* @license lucide-react v0.400.0 - ISC
|
|
353
353
|
*
|
|
354
354
|
* This source code is licensed under the ISC license.
|
|
355
355
|
* See the LICENSE file in the root directory of this source tree.
|
|
356
|
-
*/const ps=
|
|
356
|
+
*/const ps=ue("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
|
|
357
357
|
* @license lucide-react v0.400.0 - ISC
|
|
358
358
|
*
|
|
359
359
|
* This source code is licensed under the ISC license.
|
|
360
360
|
* See the LICENSE file in the root directory of this source tree.
|
|
361
|
-
*/const
|
|
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"}]]);/**
|
|
362
362
|
* @license lucide-react v0.400.0 - ISC
|
|
363
363
|
*
|
|
364
364
|
* This source code is licensed under the ISC license.
|
|
365
365
|
* See the LICENSE file in the root directory of this source tree.
|
|
366
|
-
*/const
|
|
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"}]]);/**
|
|
367
367
|
* @license lucide-react v0.400.0 - ISC
|
|
368
368
|
*
|
|
369
369
|
* This source code is licensed under the ISC license.
|
|
370
370
|
* See the LICENSE file in the root directory of this source tree.
|
|
371
|
-
*/const
|
|
371
|
+
*/const Av=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"}]]);/**
|
|
372
372
|
* @license lucide-react v0.400.0 - ISC
|
|
373
373
|
*
|
|
374
374
|
* This source code is licensed under the ISC license.
|
|
375
375
|
* See the LICENSE file in the root directory of this source tree.
|
|
376
|
-
*/const
|
|
376
|
+
*/const Ko=ue("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
|
|
377
377
|
* @license lucide-react v0.400.0 - ISC
|
|
378
378
|
*
|
|
379
379
|
* This source code is licensed under the ISC license.
|
|
380
380
|
* See the LICENSE file in the root directory of this source tree.
|
|
381
|
-
*/const
|
|
381
|
+
*/const Pv=ue("Send",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]]);/**
|
|
382
382
|
* @license lucide-react v0.400.0 - ISC
|
|
383
383
|
*
|
|
384
384
|
* This source code is licensed under the ISC license.
|
|
385
385
|
* See the LICENSE file in the root directory of this source tree.
|
|
386
|
-
*/const
|
|
386
|
+
*/const Mv=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"}]]);/**
|
|
387
387
|
* @license lucide-react v0.400.0 - ISC
|
|
388
388
|
*
|
|
389
389
|
* This source code is licensed under the ISC license.
|
|
390
390
|
* See the LICENSE file in the root directory of this source tree.
|
|
391
|
-
*/const
|
|
391
|
+
*/const Lv=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"}]]);/**
|
|
392
392
|
* @license lucide-react v0.400.0 - ISC
|
|
393
393
|
*
|
|
394
394
|
* This source code is licensed under the ISC license.
|
|
395
395
|
* See the LICENSE file in the root directory of this source tree.
|
|
396
|
-
*/const
|
|
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"}]]);/**
|
|
397
397
|
* @license lucide-react v0.400.0 - ISC
|
|
398
398
|
*
|
|
399
399
|
* This source code is licensed under the ISC license.
|
|
400
400
|
* See the LICENSE file in the root directory of this source tree.
|
|
401
|
-
*/const Gc=
|
|
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"}]]);/**
|
|
402
402
|
* @license lucide-react v0.400.0 - ISC
|
|
403
403
|
*
|
|
404
404
|
* This source code is licensed under the ISC license.
|
|
405
405
|
* See the LICENSE file in the root directory of this source tree.
|
|
406
|
-
*/const
|
|
406
|
+
*/const Fv=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"}]]);/**
|
|
407
407
|
* @license lucide-react v0.400.0 - ISC
|
|
408
408
|
*
|
|
409
409
|
* This source code is licensed under the ISC license.
|
|
410
410
|
* See the LICENSE file in the root directory of this source tree.
|
|
411
|
-
*/const
|
|
411
|
+
*/const Yo=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"}]]);/**
|
|
412
412
|
* @license lucide-react v0.400.0 - ISC
|
|
413
413
|
*
|
|
414
414
|
* This source code is licensed under the ISC license.
|
|
415
415
|
* See the LICENSE file in the root directory of this source tree.
|
|
416
|
-
*/const zr=
|
|
416
|
+
*/const zr=ue("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),$v={},Yc=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:()=>{($v?"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},jv=e=>e?Yc(e):Yc;function Rc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ro={exports:{}},Xo={},vi={exports:{}},Zo={};/**
|
|
417
417
|
* @license React
|
|
418
418
|
* use-sync-external-store-shim.production.js
|
|
419
419
|
*
|
|
@@ -421,7 +421,7 @@ to {
|
|
|
421
421
|
*
|
|
422
422
|
* This source code is licensed under the MIT license found in the
|
|
423
423
|
* LICENSE file in the root directory of this source tree.
|
|
424
|
-
*/var Xc;function
|
|
424
|
+
*/var Xc;function Bv(){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={};/**
|
|
425
425
|
* @license React
|
|
426
426
|
* use-sync-external-store-shim.development.js
|
|
427
427
|
*
|
|
@@ -429,7 +429,7 @@ to {
|
|
|
429
429
|
*
|
|
430
430
|
* This source code is licensed under the MIT license found in the
|
|
431
431
|
* LICENSE file in the root directory of this source tree.
|
|
432
|
-
*/var Zc;function
|
|
432
|
+
*/var Zc;function Uv(){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=Bv():vi.exports=Uv()),vi.exports}/**
|
|
433
433
|
* @license React
|
|
434
434
|
* use-sync-external-store-shim/with-selector.production.js
|
|
435
435
|
*
|
|
@@ -437,7 +437,7 @@ to {
|
|
|
437
437
|
*
|
|
438
438
|
* This source code is licensed under the MIT license found in the
|
|
439
439
|
* LICENSE file in the root directory of this source tree.
|
|
440
|
-
*/var eu;function
|
|
440
|
+
*/var eu;function Vv(){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={};/**
|
|
441
441
|
* @license React
|
|
442
442
|
* use-sync-external-store-shim/with-selector.development.js
|
|
443
443
|
*
|
|
@@ -445,22 +445,22 @@ to {
|
|
|
445
445
|
*
|
|
446
446
|
* This source code is licensed under the MIT license found in the
|
|
447
447
|
* LICENSE file in the root directory of this source tree.
|
|
448
|
-
*/var 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=ta(),n=typeof Object.is=="function"?Object.is:e,s=r.useSyncExternalStore,i=t.useRef,o=t.useEffect,a=t.useMemo,c=t.useDebugValue;ra.useSyncExternalStoreWithSelector=function(d,u,f,g,y){var _=i(null);if(_.current===null){var p={hasValue:!1,value:null};_.current=p}else p=_.current;_=a(function(){function m(T){if(!b){if(b=!0,S=T,T=g(T),y!==void 0&&p.hasValue){var x=p.value;if(y(x,T))return w=x}return w=T}if(x=w,n(S,T))return x;var A=g(T);return y!==void 0&&y(x,A)?(S=T,x):(S=T,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())}()),ra}process.env.NODE_ENV==="production"?Xo.exports=qv():Xo.exports=zv();var Hv=Xo.exports;const Wv=Rc(Hv),ru={},{useDebugValue:Qv}=h,{useSyncExternalStoreWithSelector:Kv}=Wv;let nu=!1;const Gv=e=>e;function Yv(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)=>Yv(t,n,s);return Object.assign(r,t),r},mi=e=>e?su(e):su,ie=mi(e=>({editorConfig:null,editorMode:"edit",buttonLoaders:{saveCollection:!1,publishCollection:!1,addFromLibrary:!1,rejectCollection:!1,sendBackCollection:!1,sourcingApproveCollection:!1,sourcingRejectCollection:!1},showPreview:!1,pageId:"collection_editor",isCurrentNodeFolder:!1,isCurrentNodeRoot:!1,isQumlPlayer:!1,isDirty:!1,lastSaved:null,formStatusMapper:{},contentFramework:null,contentTargetFWIds:null,rootFormConfig:null,unitFormConfig:null,childFormConfig:null,searchFormConfig:null,relationalFormConfig:null,publishChecklist:null,reviewChecklist:null,rfcChecklist:null,categoryMeta:null,setEditorConfig:t=>e({editorConfig:t}),setEditorMode:t=>e({editorMode:t}),setButtonLoader:(t,r)=>e(n=>({buttonLoaders:{...n.buttonLoaders,[t]:r}})),setShowPreview:t=>e({showPreview:t}),setPageId:t=>e({pageId:t}),setNodeFlags:t=>e({...t.isFolder!==void 0&&{isCurrentNodeFolder:t.isFolder},...t.isRoot!==void 0&&{isCurrentNodeRoot:t.isRoot},...t.isQuml!==void 0&&{isQumlPlayer:t.isQuml}}),setLastSaved:t=>e({lastSaved:t}),setIsDirty:t=>e({isDirty:t}),setContentFramework:(t,r)=>e({contentFramework:t,contentTargetFWIds:r}),setFormStatus:(t,r)=>e(n=>({formStatusMapper:{...n.formStatusMapper,[t]:r}})),validateAllForms:t=>{const r=ie.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}})})),Rv=Object.freeze(Object.defineProperty({__proto__:null,useEditorStore:ie},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 na(e,t){return e.filter(r=>r.id!==t).map(r=>({...r,children:r.children?na(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 De=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]??{}};ie.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=ie.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:na(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=na(i.treeData,r);return a=bi(a,s,{...o,parent:s}),{treeData:a}}),t().markDirty()},addResource:(r,n)=>{var u,f,g;const s=ie.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}=ie.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"})}),Le=({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]}),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"},nm=({contentId:e,onConfirm:t,onCancel:r})=>{const n=ie(u=>{var f,g;return(g=(f=u.editorConfig)==null?void 0:f.config)==null?void 0:g.objectType})||"Content",s=ie(u=>u.publishChecklist)??[],[i,o]=h.useState({}),a=s.every(u=>i[u.code]),c=s.length===0||a,d=()=>{t()};return l.jsx("div",{className:Fe.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"publish-modal-title",children:l.jsxs("div",{className:Fe.modal,children:[l.jsxs("div",{className:Fe.modalHeader,children:[l.jsxs("span",{id:"publish-modal-title",children:["Publish ",n]}),l.jsx("button",{className:Fe.modalHeaderClose,onClick:r,"aria-label":"Close",children:"×"})]}),l.jsx("div",{className:Fe.modalBody,children:s.length===0?l.jsxs("p",{style:{margin:0,fontSize:14,lineHeight:1.5},children:["Are you sure you want to publish this ",n,"?"]}):l.jsxs(l.Fragment,{children:[l.jsx("p",{className:Fe.sectionTitle,children:"Please confirm that ALL the following items are verified (by ticking the check-boxes) before you can publish:"}),s.map(u=>l.jsxs("label",{className:Fe.checkRow,children:[l.jsx("input",{type:"checkbox",checked:!!i[u.code],onChange:f=>o(g=>({...g,[u.code]:f.target.checked}))}),l.jsx("span",{children:u.label})]},u.code))]})}),l.jsxs("div",{className:Fe.modalFooter,children:[l.jsx(Le,{variant:"ghost",onClick:r,children:"No"}),l.jsx(Le,{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:Fe.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"quality-modal-title",children:l.jsxs("div",{className:Fe.modal,children:[l.jsxs("div",{className:Fe.modalHeader,children:[l.jsx("span",{id:"quality-modal-title",children:d}),l.jsx("button",{className:Fe.modalHeaderClose,onClick:n,"aria-label":"Close",children:"×"})]}),l.jsx("div",{className:Fe.modalBody,children:c?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:Fe.formGroup,children:[l.jsx("label",{htmlFor:"quality-score",children:"Quality Score"}),l.jsxs("div",{className:Fe.sliderGroup,children:[l.jsx("input",{id:"quality-score",type:"range",min:0,max:10,step:1,value:o,onChange:g=>a(Number(g.target.value)),"aria-valuemin":0,"aria-valuemax":10,"aria-valuenow":o}),l.jsx("span",{className:Fe.sliderValue,children:o})]}),l.jsxs("div",{className:Fe.sliderLabels,children:[l.jsx("span",{children:"0 — Poor"}),l.jsx("span",{children:"10 — Excellent"})]})]}),l.jsxs("div",{className:Fe.formGroup,children:[l.jsxs("label",{htmlFor:"quality-comment",children:["Comment"," ",l.jsx("span",{style:{fontWeight:400,color:"var(--sbx-gray-400, #9CA3AF)"},children:"(optional)"})]}),l.jsx("textarea",{id:"quality-comment",className:Fe.textarea,placeholder:"Add any notes for the content creator…",value:s,onChange:g=>i(g.target.value),rows:4})]})]}):l.jsxs("div",{className:Fe.formGroup,children:[l.jsxs("label",{htmlFor:"reject-reason",children:["Rejection Reason"," ",l.jsx("span",{style:{color:"var(--sbx-error, #DC2626)"},children:"*"})]}),l.jsx("textarea",{id:"reject-reason",className:Fe.textarea,placeholder:"Describe why this content is being rejected…",value:s,onChange:g=>i(g.target.value),rows:5,required:!0,"aria-required":"true"}),s.trim().length===0&&l.jsx("p",{style:{fontSize:12,color:"var(--sbx-error, #DC2626)",marginTop:4},children:"A rejection reason is required."})]})}),l.jsxs("div",{className:Fe.modalFooter,children:[l.jsx(Le,{variant:"ghost",onClick:n,children:"Cancel"}),l.jsx(Le,{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,sa=(e=>t=>{const r=im.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Yt=e=>(e=e.toLowerCase(),t=>sa(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)&&Tt(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const du=Yt("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"),Tt=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=Yt("Date"),fm=Yt("File"),hm=e=>!!(e&&typeof e.uri<"u"),pm=e=>e&&typeof e.getParts<"u",gm=Yt("Blob"),ym=Yt("FileList"),vm=e=>En(e)&&Tt(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||!Tt(e.append))return!1;const r=sa(e);return r==="formdata"||r==="object"&&Tt(e.toString)&&e.toString()==="[object FormData]"},_m=Yt("URLSearchParams"),[wm,Sm,Cm,Em]=["ReadableStream","Request","Response","Headers"].map(Yt),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 ia(...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]=ia(c,i):Si(i)?n[a]=ia({},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&&Tt(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=Yt("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=Yt("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(Tt(e)&&["arguments","caller","callee"].includes(r))return!1;const n=e[r];if(Tt(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},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&&Tt(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=Yt("AsyncFunction"),Qm=e=>e&&(En(e)||Tt(e))&&Tt(e.then)&&Tt(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",Tt(Qr.postMessage)),Km=typeof queueMicrotask<"u"?queueMicrotask.bind(Qr):typeof process<"u"&&process.nextTick||mu,bu=e=>e!=null&&Tt(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:Tt,isStream:vm,isURLSearchParams:_m,isTypedArray:Am,isFileList:ym,forEach:vs,merge:ia,extend:Im,trim:Om,stripBOM:Dm,inherits:Tm,toFlatObject:Nm,kindOf:sa,kindOfTest:Yt,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"]),Ym=e=>{const t={};let r,n,s;return e&&e.split(`
|
|
449
|
-
`).forEach(function(o){s=o.indexOf(":"),r=o.substring(0,s).trim().toLowerCase(),n=o.substring(s+1).trim(),!(!r||t[r]&&
|
|
450
|
-
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){const n=new this(t);return r.forEach(s=>n.set(s)),n}static accessor(t){const n=(this[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}};gt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),I.reduceDescriptors(gt.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}}),I.freezeMethods(gt);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 gt&&(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 X=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}}};X.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",X.ERR_BAD_OPTION="ERR_BAD_OPTION",X.ECONNABORTED="ECONNABORTED",X.ETIMEDOUT="ETIMEDOUT",X.ECONNREFUSED="ECONNREFUSED",X.ERR_NETWORK="ERR_NETWORK",X.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",X.ERR_DEPRECATED="ERR_DEPRECATED",X.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",X.ERR_BAD_REQUEST="ERR_BAD_REQUEST",X.ERR_CANCELED="ERR_CANCELED",X.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",X.ERR_INVALID_URL="ERR_INVALID_URL",X.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const lb=null,Su=100;function la(e){return I.isPlainObject(e)||I.isArray(e)}function Cu(e){return I.endsWith(e,"[]")?e.slice(0,-2):e}function ca(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(la)}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 X("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 X("Object is too deeply nested ("+m+" levels). Max depth: "+c,X.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,T){if(!I.isObject(T))return T;for(;S.length&&S[S.length-1]!==this;)S.pop();return S.push(T),g(b+S.length-1),T})}function _(m,b,S){let w=m;if(I.isReactNative(t)&&I.isReactNativeBlob(m))return t.append(ca(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(T,x){!(I.isUndefined(T)||T===null)&&t.append(o===!0?ca([b],x,i):o===null?b:b+"[]",f(T))}),!1}return la(m)?!0:(t.append(ca(S,b,i),f(m)),!1)}const p=Object.assign(ub,{defaultVisitor:_,convertValue:f,isVisitable:la});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,T){(!(I.isUndefined(E)||E===null)&&s.call(t,E,I.isString(T)?T.trim():T,b,p))===!0&&v(E,b?b.concat(T):[T],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 ua(e,t){this._pairs=[],e&&Ei(e,this,t)}const Ou=ua.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 ua(t,n).toString(s),o){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class Du{constructor(){this.handlers=[]}use(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){I.forEach(this.handlers,function(n){n!==null&&t(n)})}}const da={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},fb={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:ua,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},fa=typeof window<"u"&&typeof document<"u",ha=typeof navigator=="object"&&navigator||void 0,hb=fa&&(!ha||["ReactNative","NativeScript","NS"].indexOf(ha.product)<0),pb=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",gb=fa&&window.location.href||"http://localhost",dt={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:fa,hasStandardBrowserEnv:hb,hasStandardBrowserWebWorkerEnv:pb,navigator:ha,origin:gb},Symbol.toStringTag,{value:"Module"})),...fb};function yb(e,t){return Ei(e,new dt.classes.URLSearchParams,{visitor:function(r,n,s,i){return dt.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 X("FormData field is too deeply nested ("+e+" levels). Max depth: "+Tu,X.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:da,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"?X.from(c,X.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:dt.classes.FormData,Blob:dt.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};I.forEach(["delete","get","head","post","put","patch","query"],e=>{bs.headers[e]={}});function pa(e,t){const r=this||bs,n=t||r,s=gt.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 X{constructor(t,r,n){super(t??"canceled",X.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 X("Request failed with status code "+r.status,r.status>=400&&r.status<500?X.ERR_BAD_REQUEST:X.ERR_BAD_RESPONSE,r.config,r.request,r))}function _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=dt.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,dt.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(dt.origin),dt.navigator&&/(msie|trident)/i.test(dt.navigator.userAgent)):()=>!0,Eb=dt.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 X('Invalid URL: missing "//" after protocol',X.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 gt?{...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=gt.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)&&(dt.hasStandardBrowserEnv||dt.hasStandardBrowserWebWorkerEnv||I.isReactNative(n)?a.setContentType(void 0):I.isFunction(n.getHeaders)&&Ab(a,n.getHeaders(),r("formDataHeaderPolicy"))),dt.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=gt.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=gt.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 X("Request aborted",X.ECONNABORTED,e,v)),p(),v=null)},v.onerror=function(w){const E=w&&w.message?w.message:"Network Error",T=new X(E,X.ERR_NETWORK,e,v);T.event=w||null,n(T),p(),v=null},v.ontimeout=function(){let w=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const E=s.transitional||da;s.timeoutErrorMessage&&(w=s.timeoutErrorMessage),n(new X(w,E.clarifyTimeoutError?X.ETIMEDOUT:X.ECONNABORTED,e,v)),p(),v=null},i===void 0&&o.setContentType(null),"setRequestHeader"in v&&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&&!dt.protocols.includes(b)){n(new X("Unsupported protocol "+b+":",X.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 X?d:new _s(d instanceof Error?d.message:d))}};let i=t&&setTimeout(()=>{i=null,s(new X(`timeout of ${t}ms exceeded`,X.ETIMEDOUT))},t);const o=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(c=>{c.unsubscribe?c.unsubscribe(s):c.removeEventListener("abort",s)}),e=null)};e.forEach(c=>c.addEventListener("abort",s));const{signal:a}=r;return a.unsubscribe=()=>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 ga="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(dt.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 X(`Response type '${m}' is not supported`,X.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(dt.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:T,timeout:x,onDownloadProgress:A,onUploadProgress:$,responseType:N,headers:P,withCredentials:U="same-origin",fetchOptions:M,maxContentLength:L,maxBodyLength:j}=ju(m);const Z=I.isNumber(L)&&L>-1,te=I.isNumber(j)&&j>-1,_e=G=>I.hasOwnProp(m,G)?m[G]:void 0;let we=s||fetch;N=N?(N+"").toLowerCase():"text";let ve=Lb([E,T&&T.toAbortSignal()],x),z=null;const J=ve&&ve.unsubscribe&&(()=>{ve.unsubscribe()});let se,V=null;const R=()=>new X("Request body larger than maxBodyLength limit",X.ERR_BAD_REQUEST,m,z);try{let G;const ae=_e("auth");if(ae){const ee=I.getSafeProp(ae,"username")||"",Ke=I.getSafeProp(ae,"password")||"";G={username:ee,password:Ke}}if(qb(b)){const ee=new URL(b,dt.origin);if(!G&&(ee.username||ee.password)){const Ke=Vu(ee.username),rt=Vu(ee.password);G={username:Ke,password:rt}}(ee.username||ee.password)&&(ee.username="",ee.password="",b=ee.href)}if(G&&(P.delete("authorization"),P.set("Authorization","Basic "+btoa(Vb((G.username||"")+":"+(G.password||""))))),Z&&typeof b=="string"&&b.startsWith("data:")&&Ub(b)>L)throw new X("maxContentLength size of "+L+" exceeded",X.ERR_BAD_RESPONSE,m,z);if(te&&S!=="get"&&S!=="head"){const ee=await p(w);if(typeof ee=="number"&&isFinite(ee)&&(se=ee,ee>j))throw R()}const Oe=te&&(I.isReadableStream(w)||I.isStream(w)),$e=(ee,Ke,rt)=>Bu(ee,Uu,lt=>{if(te&<>j)throw V=R();Ke&&Ke(lt)},rt);if(g&&S!=="get"&&S!=="head"&&($||Oe)){if(se=se??await v(P,w),se!==0||Oe){let ee=new i(b,{method:"POST",body:w,duplex:"half"}),Ke;if(I.isFormData(w)&&(Ke=ee.headers.get("content-type"))&&P.setContentType(Ke),ee.body){const[rt,lt]=$&&Pu(se,Oi(Mu($)))||[];w=$e(ee.body,rt,lt)}}}else if(Oe&&!c&&u&&S!=="get"&&S!=="head")w=$e(w);else if(Oe&&c&&!g&&S!=="get"&&S!=="head")throw new X("Stream request bodies are not supported by the current fetch implementation",X.ERR_NOT_SUPPORT,m,z);I.isString(U)||(U=U?"include":"omit");const ge=c&&"credentials"in i.prototype;if(I.isFormData(w)){const ee=P.getContentType();ee&&/^multipart\/form-data/i.test(ee)&&!/boundary=/i.test(ee)&&P.delete("content-type")}P.set("User-Agent","axios/"+ga,!1);const le={...M,signal:ve,method:S.toUpperCase(),headers:_u(P.normalize()),body:w,duplex:"half",credentials:ge?U:void 0};z=c&&new i(b,le);let he=await(c?we(z,M):we(b,le));const je=gt.from(he.headers);if(Z){const ee=I.toFiniteNumber(je.getContentLength());if(ee!=null&&ee>L)throw new X("maxContentLength size of "+L+" exceeded",X.ERR_BAD_RESPONSE,m,z)}const ze=y&&(N==="stream"||N==="response");if(y&&he.body&&(A||Z||ze&&J)){const ee={};["status","statusText","headers"].forEach(H=>{ee[H]=he[H]});const Ke=I.toFiniteNumber(je.getContentLength()),[rt,lt]=A&&Pu(Ke,Oi(Mu(A),!0))||[];let He=0;const Ze=H=>{if(Z&&(He=H,He>L))throw new X("maxContentLength size of "+L+" exceeded",X.ERR_BAD_RESPONSE,m,z);rt&&rt(H)};he=new o(Bu(he.body,Uu,Ze,()=>{lt&<(),J&&J()}),ee)}N=N||"text";let Ae=await _[I.findKey(_,N)||"text"](he,m);if(Z&&!y&&!ze){let ee;if(Ae!=null&&(typeof Ae.byteLength=="number"?ee=Ae.byteLength:typeof Ae.size=="number"?ee=Ae.size:typeof Ae=="string"&&(ee=typeof n=="function"?new n().encode(Ae).byteLength:Ae.length)),typeof ee=="number"&&ee>L)throw new X("maxContentLength size of "+L+" exceeded",X.ERR_BAD_RESPONSE,m,z)}return!ze&&J&&J(),await new Promise((ee,Ke)=>{Au(ee,Ke,{data:Ae,headers:gt.from(he.headers),status:he.status,statusText:he.statusText,config:m,request:z})})}catch(G){if(J&&J(),ve&&ve.aborted&&ve.reason instanceof X){const ae=ve.reason;throw ae.config=m,z&&(ae.request=z),G!==ae&&(ae.cause=G),ae}throw V?(z&&!V.request&&(V.request=z),V):G instanceof X?(z&&!G.request&&(G.request=z),G):G&&G.name==="TypeError"&&/Load failed|fetch/i.test(G.message)?Object.assign(new X("Network Error",X.ERR_NETWORK,m,z,G&&G.response),{cause:G.cause||G}):X.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 ya={http:lb,xhr:Mb,fetch:{get:zu}};I.forEach(ya,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch{}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const 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=ya[(a=String(n)).toLowerCase()],s===void 0))throw new X(`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 :
|
|
448
|
+
*/var tu;function qv(){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"?Ro.exports=Vv():Ro.exports=qv();var zv=Ro.exports;const Hv=Rc(zv),ru={},{useDebugValue:Wv}=h,{useSyncExternalStoreWithSelector:Qv}=Hv;let nu=!1;const Kv=e=>e;function Gv(e,t=Kv,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=Qv(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,r);return Wv(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"?jv(e):e,r=(n,s)=>Gv(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 Rv=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 Rv)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 Xv(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 Zv(e,t){const r=Hr(e,t);if(!r)return[];const n=[];let s=r;for(;s;)n.unshift({id:s.id,name:s.name}),s=s.parent?Hr(e,s.parent):void 0;return n}const De=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(Xv(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=>Zv(t().treeData,r)})),Jv=mi(e=>({activeModal:null,modalData:{},openModal:(t,r={})=>e({activeModal:t,modalData:r}),closeModal:()=>e({activeModal:null,modalData:{}})})),em={spin:"_spin_1ah4d_9"},tm=({size:e=16,color:t="currentColor"})=>l.jsx("svg",{className:em.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(tm,{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"},rm=({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"})]})]})})},nm=({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:sm}=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},im=(e,t)=>e!=null&&ys(e,t)?e[t]:void 0,na=(e=>t=>{const r=sm.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Yt=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=Yt("ArrayBuffer");function om(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&du(e.buffer),t}const am=wi("string"),Dt=wi("function"),fu=wi("number"),En=e=>e!==null&&typeof e=="object",lm=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)},cm=e=>{if(!En(e)||Cn(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},um=Yt("Date"),dm=Yt("File"),fm=e=>!!(e&&typeof e.uri<"u"),hm=e=>e&&typeof e.getParts<"u",pm=Yt("Blob"),gm=Yt("FileList"),ym=e=>En(e)&&Dt(e.pipe);function vm(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const hu=vm(),pu=typeof hu.FormData<"u"?hu.FormData:void 0,mm=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]"},bm=Yt("URLSearchParams"),[_m,wm,Sm,Cm]=["ReadableStream","Request","Response","Headers"].map(Yt),Em=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];Fm.call(a,u)&&s(a[u],u)}}return n}const Om=(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),Im=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Dm=(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)},Tm=(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},Nm=(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},km=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},xm=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&wn(Uint8Array)),Am=(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])}},Pm=(e,t)=>{let r;const n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},Mm=Yt("HTMLFormElement"),Lm=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,s){return n.toUpperCase()+s}),{propertyIsEnumerable:Fm}=Object.prototype,$m=Yt("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)},jm=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+"'")})}})},Bm=(e,t)=>{const r={},n=s=>{s.forEach(i=>{r[i]=!0})};return Wr(e)?n(e):n(String(e).split(t)),r},Um=()=>{},Vm=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function qm(e){return!!(e&&Dt(e.append)&&e[uu]==="FormData"&&e[gs])}const zm=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)},Hm=Yt("AsyncFunction"),Wm=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)),Qm=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:mm,isArrayBufferView:om,isString:am,isNumber:fu,isBoolean:lm,isObject:En,isPlainObject:Si,isEmptyObject:cm,isReadableStream:_m,isRequest:wm,isResponse:Sm,isHeaders:Cm,isUndefined:Sn,isDate:um,isFile:dm,isReactNativeBlob:fm,isReactNative:hm,isBlob:pm,isRegExp:$m,isFunction:Dt,isStream:ym,isURLSearchParams:bm,isTypedArray:xm,isFileList:gm,forEach:vs,merge:sa,extend:Om,trim:Em,stripBOM:Im,inherits:Dm,toFlatObject:Tm,kindOf:na,kindOfTest:Yt,endsWith:Nm,toArray:km,forEachEntry:Am,matchAll:Pm,isHTMLForm:Mm,hasOwnProperty:_i,hasOwnProp:_i,hasOwnInPrototypeChain:ys,getSafeProp:im,reduceDescriptors:vu,freezeMethods:jm,toObjectSet:Bm,toCamelCase:Lm,noop:Um,toFiniteNumber:Vm,findKey:gu,global:Qr,isContextDefined:yu,isSpecCompliantForm:qm,toJSONObject:zm,isAsyncFn:Hm,isThenable:Wm,setImmediate:mu,asap:Qm,isIterable:bu,isSafeIterable:e=>e!=null&&ys(e,gs)&&bu(e)},Km=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"]),Gm=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]&&Km[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 Rm=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),Xm=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 Zm=e=>ia(e,Rm),Jm=e=>ia(e,Xm);function _u(e){const t=Object.create(null);return I.forEach(e.toJSON(),(r,n)=>{t[n]=Jm(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):Zm(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 tb=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 rb(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function nb(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())&&!tb(t))o(Gm(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 eb(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?rb(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]||(nb(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 sb="[REDACTED ****]";function ib(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 ob(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)&&ib(i))return n.pop(),i;o=Object.create(null);for(const[a,c]of Object.entries(i)){const d=r.has(a.toLowerCase())?sb:s(c);I.isUndefined(d)||(o[a]=d)}}return n.pop(),o};return s(e)}let R=class fp extends Error{static from(t,r,n,s,i,o){const a=new fp(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?ob(t,r):I.toJSONObject(t);return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:n,code:this.code,status:this.status}}};R.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",R.ERR_BAD_OPTION="ERR_BAD_OPTION",R.ECONNABORTED="ECONNABORTED",R.ETIMEDOUT="ETIMEDOUT",R.ECONNREFUSED="ECONNREFUSED",R.ERR_NETWORK="ERR_NETWORK",R.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",R.ERR_DEPRECATED="ERR_DEPRECATED",R.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",R.ERR_BAD_REQUEST="ERR_BAD_REQUEST",R.ERR_CANCELED="ERR_CANCELED",R.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",R.ERR_INVALID_URL="ERR_INVALID_URL",R.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const ab=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 lb(e){return I.isArray(e)&&!e.some(aa)}const cb=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 R("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 R("Object is too deeply nested ("+m+" levels). Max depth: "+c,R.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)&&lb(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(cb,{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 ub(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")||ub,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},db={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,fb=da&&(!fa||["ReactNative","NativeScript","NS"].indexOf(fa.product)<0),hb=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",pb=da&&window.location.href||"http://localhost",ct={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:da,hasStandardBrowserEnv:fb,hasStandardBrowserWebWorkerEnv:hb,navigator:fa,origin:pb},Symbol.toStringTag,{value:"Module"})),...db};function gb(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 R("FormData field is too deeply nested ("+e+" levels). Max depth: "+Tu,R.ERR_FORM_DATA_DEPTH_EXCEEDED)}function yb(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 vb(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]=vb(s[o])),!a)}if(I.isFormData(e)&&I.isFunction(e.entries)){const r={};return I.forEachEntry(e,(n,s)=>{t(yb(n),s,r,0)}),r}return null}const On=(e,t)=>e!=null&&I.hasOwnProp(e,t)?e[t]:void 0;function mb(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 gb(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),mb(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"?R.from(c,R.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 R{constructor(t,r,n){super(t??"canceled",R.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 R("Request failed with status code "+r.status,r.status>=400&&r.status<500?R.ERR_BAD_REQUEST:R.ERR_BAD_RESPONSE,r.config,r.request,r))}function bb(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}function _b(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 wb(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=_b(50,250);return wb(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)),Sb=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,Cb=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 Eb(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Ob(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}const Ib=/^https?:(?!\/\/)/i,Db=/[\t\n\r]/g;function Tb(e){let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t)}function Nb(e){return Tb(e).replace(Db,"")}function Lu(e,t){if(typeof e=="string"&&Ib.test(Nb(e)))throw new R('Invalid URL: missing "//" after protocol',R.ERR_INVALID_URL,t)}function Fu(e,t,r,n){Lu(t,n);let s=!Eb(t);return e&&(s||r===!1)?(Lu(e,n),Ob(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 kb=["content-type","content-length"];function xb(e,t,r){if(r!=="content-only"){e.set(t);return}Object.entries(t).forEach(([n,s])=>{kb.includes(n.toLowerCase())&&e.set(n,s)})}const Ab=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,r)=>String.fromCharCode(parseInt(r,16)));function 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?Ab(y):"")))}if(I.isFormData(n)&&(ct.hasStandardBrowserEnv||ct.hasStandardBrowserWebWorkerEnv||I.isReactNative(n)?a.setContentType(void 0):I.isFunction(n.getHeaders)&&xb(a,n.getHeaders(),r("formDataHeaderPolicy"))),ct.hasStandardBrowserEnv&&(I.isFunction(s)&&(s=s(t)),s===!0||s==null&&Sb(t.url))){const y=i&&o&&Cb.read(o);y&&a.set(i,y)}return t}const Pb=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 R("Request aborted",R.ECONNABORTED,e,v)),p(),v=null)},v.onerror=function(w){const E=w&&w.message?w.message:"Network Error",D=new R(E,R.ERR_NETWORK,e,v);D.event=w||null,n(D),p(),v=null},v.ontimeout=function(){let w=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const E=s.transitional||ua;s.timeoutErrorMessage&&(w=s.timeoutErrorMessage),n(new R(w,E.clarifyTimeoutError?R.ETIMEDOUT:R.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=bb(s.url);if(b&&!ct.protocols.includes(b)){n(new R("Unsupported protocol "+b+":",R.ERR_BAD_REQUEST,e));return}v.send(i||null)})},Mb=(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 R?d:new _s(d instanceof Error?d.message:d))}};let i=t&&setTimeout(()=>{i=null,s(new R(`timeout of ${t}ms exceeded`,R.ETIMEDOUT))},t);const o=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(c=>{c.unsubscribe?c.unsubscribe(s):c.removeEventListener("abort",s)}),e=null)};e.forEach(c=>c.addEventListener("abort",s));const{signal:a}=r;return a.unsubscribe=()=>I.asap(o),a},Lb=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},Fb=async function*(e,t){for await(const r of $b(e))yield*Lb(r,t)},$b=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=Fb(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,jb=(e,t,r)=>t+2<r&&Ii(e.charCodeAt(t+1))&&Ii(e.charCodeAt(t+2));function Bb(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&&jb(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,Ub=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}},Vb=e=>{const t=e.indexOf("://");let r=e;return t!==-1&&(r=r.slice(t+3)),r.includes("@")||r.includes(":")},qb=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 R(`Response type '${m}' is not supported`,R.ERR_NOT_SUPPORT,S)})});const p=async m=>{if(m==null)return 0;if(I.isBlob(m))return m.size;if(I.isSpecCompliantForm(m))return(await new i(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:P,withCredentials:U="same-origin",fetchOptions:M,maxContentLength:L,maxBodyLength:j}=ju(m);const X=I.isNumber(L)&&L>-1,se=I.isNumber(j)&&j>-1,Oe=G=>I.hasOwnProp(m,G)?m[G]:void 0;let _e=s||fetch;N=N?(N+"").toLowerCase():"text";let ve=Mb([E,D&&D.toAbortSignal()],x),z=null;const J=ve&&ve.unsubscribe&&(()=>{ve.unsubscribe()});let te,V=null;const Z=()=>new R("Request body larger than maxBodyLength limit",R.ERR_BAD_REQUEST,m,z);try{let G;const ce=Oe("auth");if(ce){const re=I.getSafeProp(ce,"username")||"",Le=I.getSafeProp(ce,"password")||"";G={username:re,password:Le}}if(Vb(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&&(P.delete("authorization"),P.set("Authorization","Basic "+btoa(Ub((G.username||"")+":"+(G.password||""))))),X&&typeof b=="string"&&b.startsWith("data:")&&Bb(b)>L)throw new R("maxContentLength size of "+L+" exceeded",R.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(P,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"))&&P.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 R("Stream request bodies are not supported by the current fetch implementation",R.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=P.getContentType();re&&/^multipart\/form-data/i.test(re)&&!/boundary=/i.test(re)&&P.delete("content-type")}P.set("User-Agent","axios/"+pa,!1);const Ye={...M,signal:ve,method:S.toUpperCase(),headers:_u(P.normalize()),body:w,duplex:"half",credentials:ae?U:void 0};z=c&&new i(b,Ye);let Ee=await(c?_e(z,M):_e(b,Ye));const Ze=pt.from(Ee.headers);if(X){const re=I.toFiniteNumber(Ze.getContentLength());if(re!=null&&re>L)throw new R("maxContentLength size of "+L+" exceeded",R.ERR_BAD_RESPONSE,m,z)}const Re=y&&(N==="stream"||N==="response");if(y&&Ee.body&&(A||X||Re&&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 R("maxContentLength size of "+L+" exceeded",R.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&&!Re){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 R("maxContentLength size of "+L+" exceeded",R.ERR_BAD_RESPONSE,m,z)}return!Re&&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(),ve&&ve.aborted&&ve.reason instanceof R){const ce=ve.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 R?(z&&!G.request&&(G.request=z),G):G&&G.name==="TypeError"&&/Load failed|fetch/i.test(G.message)?Object.assign(new R("Network Error",R.ERR_NETWORK,m,z,G&&G.response),{cause:G.cause||G}):R.from(G,G&&G.code,m,z,G&&G.response)}}},zb=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=zb;for(;a--;)c=i[a],d=u.get(c),d===void 0&&u.set(c,d=a?new Map:qb(t)),u=d;return d};zu();const ga={http:ab,xhr:Pb,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}`,Hb=e=>I.isFunction(e)||e===null||e===!1;function Wb(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,!Hb(n)&&(s=ga[(a=String(n)).toLowerCase()],s===void 0))throw new R(`Unknown adapter '${a}'`);if(s&&(I.isFunction(s)||(s=s.get(t))))break;i[a||"#"+o]=s}if(!s){const o=Object.entries(i).map(([c,d])=>`adapter ${c} `+(d===!1?"is not supported by the environment":"is not available in the build"));let a=r?o.length>1?`since :
|
|
451
451
|
`+o.map(Hu).join(`
|
|
452
|
-
`):" "+Hu(o[0]):"as no adapter specified";throw new
|
|
452
|
+
`):" "+Hu(o[0]):"as no adapter specified";throw new R("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return s}const Wu={getAdapter:Wb,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 R(s(o," has been removed"+(r?" in "+r:"")),R.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 Qb(e,t,r){if(typeof e!="object")throw new R("options must be an object",R.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let s=n.length;for(;s-- >0;){const i=n[s],o=Object.prototype.hasOwnProperty.call(t,i)?t[i]:void 0;if(o){const a=e[i],c=a===void 0||o(a,i,e);if(c!==!0)throw new R("option "+i+" must be "+c,R.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new R("Unknown option "+i,R.ERR_BAD_OPTION)}}const Ni={assertOptions:Qb,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
453
|
`);return o===-1?"":s.stack.slice(o+1)})();try{if(!n.stack)n.stack=i;else if(i){const o=i.indexOf(`
|
|
454
454
|
`),a=o===-1?-1:i.indexOf(`
|
|
455
455
|
`,o+1),c=a===-1?"":i.slice(a+1);String(n.stack).endsWith(c)||(n.stack+=`
|
|
456
|
-
`+i)}}catch{}}throw n}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=Kr(this.defaults,r);const{transitional:n,paramsSerializer:s,headers:i}=r;n!==void 0&&Ni.assertOptions(n,{silentJSONParsing:yt.transitional(yt.boolean),forcedJSONParsing:yt.transitional(yt.boolean),clarifyTimeoutError:yt.transitional(yt.boolean),legacyInterceptorReqResOrdering:yt.transitional(yt.boolean),advertiseZstdAcceptEncoding:yt.transitional(yt.boolean),validateStatusUndefinedResolves:yt.transitional(yt.boolean)},!1),s!=null&&(I.isFunction(s)?r.paramsSerializer={serialize:s}:Ni.assertOptions(s,{encode:yt.function,serialize:yt.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),Ni.assertOptions(r,{baseUrl:yt.spelling("baseURL"),withXsrfToken:yt.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=gt.concat(o,i);const a=[];let c=!0;this.interceptors.request.forEach(function(p){if(typeof p.runWhen=="function"&&p.runWhen(r)===!1)return;c=c&&p.synchronous;const v=r.transitional||da;v&&v.legacyInterceptorReqResOrdering?a.unshift(p.fulfilled,p.rejected):a.push(p.fulfilled,p.rejected)});const d=[];this.interceptors.response.forEach(function(p){d.push(p.fulfilled,p.rejected)});let u,f=0,g;if(!c){const _=[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 Yb(e){return function(r){return e.apply(null,r)}}function Rb(e){return I.isObject(e)&&e.isAxiosError===!0}const ma={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(ma).forEach(([e,t])=>{ma[t]=e});function 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 Xe=Gu(bs);Xe.Axios=Gr,Xe.CanceledError=_s,Xe.CancelToken=Gb,Xe.isCancel=xu,Xe.VERSION=ga,Xe.toFormData=Ei,Xe.AxiosError=X,Xe.Cancel=Xe.CanceledError,Xe.all=function(t){return Promise.all(t)},Xe.spread=Yb,Xe.isAxiosError=Rb,Xe.mergeConfig=Kr,Xe.AxiosHeaders=gt,Xe.formToJSON=e=>ku(I.isHTMLForm(e)?new FormData(e):e),Xe.getAdapter=Wu.getAdapter,Xe.HttpStatusCode=ma,Xe.default=Xe;const{Axios:XI,AxiosError:ZI,CanceledError:JI,isCancel:eD,CancelToken:tD,VERSION:rD,all:nD,Cancel:sD,isAxiosError:iD,spread:oD,toFormData:aD,AxiosHeaders:lD,HttpStatusCode:cD,formToJSON:uD,getAdapter:dD,mergeConfig:fD,create:hD}=Xe;let ba="";function Yu(e){ba=e}const ke=Xe.create({timeout:3e4});ke.interceptors.request.use(async e=>{var s;const{useEditorStore:t}=await Promise.resolve().then(()=>Rv),n=(s=t.getState().editorConfig)==null?void 0:s.context;return e.headers=e.headers??{},n!=null&&n.authToken&&(e.headers.Authorization=`Bearer ${n.authToken}`),n!=null&&n.userToken&&(e.headers["X-Authenticated-User-Token"]=n.userToken),n!=null&&n.channel&&(e.headers["X-Channel-Id"]=n.channel),ba&&(e.baseURL=ba),e});const Ru=["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:Ru,offset:0,limit:t.limit??200};return s?n.email=e.trim():i?n.phone=e.trim():o.query=e,((f=(u=(d=(await ke.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 ke.post("/action/user/v1/search",{request:{filters:{userId:e},fields:Ru,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 ke.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 ke.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 ke.post(`${Xu}/question/v2/list`,{request:{search:{identifier:e}}})).data)==null?void 0:r.result)==null?void 0:n.questions)??[]:[]}function _a(e,t){const r=e??{},n=r.identifier??"",s=r.objectType??"",i=r.mimeType??"",o=r.children,a=Array.isArray(o)?o.map(d=>_a(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 ke.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=_a(r);return{content:r,rootNode:n}}async function t_(e){const t=await Zu(e),r=_a(t);return{content:t,rootNode:r}}async function r_(e,t,r,n){var i;return((i=(await ke.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 ke.post(`/action/content/v3/publish/${e}`,{request:{content:{lastPublishedBy:t}}})}async function s_(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 i_(e){await ke.post(`/action/content/v3/review/${e}`,{request:{content:{}}})}async function o_(e,t){await ke.post(`/action/content/v3/reject/${e}`,{request:{content:{rejectComment:t}}})}async function a_(e,t){await ke.patch(`/action/content/v1/collaborator/update/${e}`,{request:{content:{collaborators:t}}})}const Te={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=ie(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 P=await s_(e),U=(P==null?void 0:P.collaborators)??[];if(!U.length)return;const M=await Zb(U);if(N)return;const L=U.map(j=>M.find(Z=>Z.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 P=await Xb(N,{rootOrgId:n,objectType:s}),U=new Set(f.map(M=>M.identifier));c(P.filter(M=>!U.has(M.identifier)))}catch{c([])}finally{u(!1)}},300),()=>{S.current&&clearTimeout(S.current)}},[i,f,n,s]);const w=h.useCallback(N=>{g(P=>P.find(U=>U.identifier===N.identifier)?P:[...P,N]),c(P=>P.filter(U=>U.identifier!==N.identifier)),b(!1)},[]),E=h.useCallback(N=>{g(P=>P.filter(U=>U.identifier!==N)),b(!1)},[]),T=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:Te.container,children:[l.jsxs("div",{className:Te.header,children:[l.jsx("h2",{className:Te.title,children:"Manage Collaborators"}),l.jsx("button",{className:Te.closeBtn,onClick:t,"aria-label":"Close",children:"✕"})]}),l.jsxs("div",{className:Te.body,children:[l.jsxs("div",{className:Te.searchSection,children:[l.jsx("label",{className:Te.label,htmlFor:"collab-search",children:"Search users"}),l.jsxs("div",{className:Te.searchRow,children:[l.jsx("input",{id:"collab-search",type:"text",className:Te.searchInput,placeholder:"Search by name or email...",value:i,onChange:N=>o(N.target.value)}),d&&l.jsx("span",{className:Te.searchSpinner,"aria-label":"Searching..."})]}),a.length>0&&l.jsx("ul",{className:Te.resultsList,role:"listbox","aria-label":"Search results",children:a.map(N=>{var P,U,M,L;return l.jsxs("li",{className:Te.resultItem,role:"option","aria-selected":"false",children:[l.jsxs("div",{className:Te.userInfo,children:[l.jsx("span",{className:Te.userName,children:x(N)}),N.email&&l.jsx("span",{className:Te.userEmail,children:N.email}),(((U=(P=N.organisations)==null?void 0:P[0])==null?void 0:U.orgName)??N.rootOrgName)&&l.jsx("span",{className:Te.userOrg,children:((L=(M=N.organisations)==null?void 0:M[0])==null?void 0:L.orgName)??N.rootOrgName})]}),l.jsx(Le,{variant:"primary",size:"sm",onClick:()=>w(N),children:"Add"})]},N.identifier)})}),i.trim().length>=2&&!d&&a.length===0&&l.jsx("p",{className:Te.noResults,children:"No users found."})]}),l.jsxs("div",{className:Te.collabSection,children:[l.jsxs("h3",{className:Te.sectionTitle,children:["Current Collaborators",f.length>0&&l.jsx("span",{className:Te.badge,children:f.length})]}),f.length===0?l.jsx("p",{className:Te.emptyCollab,children:"No collaborators added yet."}):l.jsx("ul",{className:Te.collabList,children:f.map(N=>{var P,U,M,L;return l.jsxs("li",{className:Te.collabItem,children:[l.jsx("div",{className:Te.userAvatar,"aria-hidden":"true",children:x(N).charAt(0).toUpperCase()}),l.jsxs("div",{className:Te.userInfo,children:[l.jsx("span",{className:Te.userName,children:x(N)}),N.email&&l.jsx("span",{className:Te.userEmail,children:N.email}),(((U=(P=N.organisations)==null?void 0:P[0])==null?void 0:U.orgName)??N.rootOrgName)&&l.jsx("span",{className:Te.userOrg,children:((L=(M=N.organisations)==null?void 0:M[0])==null?void 0:L.orgName)??N.rootOrgName})]}),l.jsx(Le,{variant:"danger",size:"sm",onClick:()=>E(N.identifier),children:"Remove"})]},N.identifier)})})]}),p&&l.jsx("p",{className:Te.error,role:"alert",children:p}),m&&l.jsx("p",{className:Te.success,role:"status",children:"Collaborators saved successfully."})]}),l.jsxs("div",{className:Te.footer,children:[l.jsx(Le,{variant:"ghost",onClick:t,disabled:y,children:"Cancel"}),l.jsx(Le,{variant:"primary",isLoading:y,onClick:T,children:"Save"})]})]})};async function c_(e){return(await ke.post("/api/dialcode/v1/read",{request:{dialcodes:[e]}})).data}async function u_(e,t){var s;const n=((s=(await ke.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 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 oe={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 ed=({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:oe.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":`${d}-title`,children:l.jsxs("div",{className:oe.sbModal,children:[l.jsxs("div",{className:oe.sbModalHeader,children:[l.jsx("span",{id:`${d}-title`,className:oe.sbModalTitle,children:e}),l.jsx("button",{className:oe.sbModalClose,onClick:o,"aria-label":"Close",type:"button",children:"×"})]}),l.jsxs("div",{className:oe.sbModalBody,children:[l.jsxs("label",{className:oe.sbLabel,htmlFor:`${d}-comment`,children:[t," ",l.jsx("span",{"aria-hidden":"true",style:{color:"var(--sbx-error, #DC2626)"},children:"*"})]}),l.jsx("textarea",{id:`${d}-comment`,className:oe.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:oe.sbError,children:"Fill comments"})]}),l.jsxs("div",{className:oe.sbModalFooter,children:[l.jsx(Le,{variant:"ghost",onClick:o,children:"Cancel"}),l.jsx(Le,{variant:s,onClick:()=>i(a.trim()),disabled:a.trim().length===0,children:n})]})]})})},p_=({onConfirm:e,onCancel:t})=>{const[r,n]=h.useState(!1);return l.jsx("div",{className:oe.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":"review-confirm-title",children:l.jsxs("div",{className:oe.sbModal,children:[l.jsxs("div",{className:oe.sbModalHeader,children:[l.jsx("span",{id:"review-confirm-title",className:oe.sbModalTitle,children:"Accepting Terms & Conditions"}),l.jsx("button",{className:oe.sbModalClose,onClick:t,"aria-label":"Close",type:"button",children:"×"})]}),l.jsx("div",{className:oe.sbModalBody,children:l.jsxs("label",{style:{display:"flex",gap:8,alignItems:"flex-start",fontSize:13,lineHeight:1.55},children:[l.jsx("input",{type:"checkbox",checked:r,onChange:s=>n(s.target.checked),style:{marginTop:2}}),l.jsxs("span",{children:["I agree that by submitting / publishing this Content, I confirm that this Content complies with prescribed guidelines, including the Terms of Use and Content Policy and that I consent to publish it under the"," ",l.jsx("a",{className:"sb-color-primary",style:{fontWeight:600},href:"https://creativecommons.org/licenses",target:"_blank",rel:"noreferrer",children:"Creative Commons Framework"})," ","in accordance with the ",l.jsx("strong",{children:"Content Policy"}),". I have made sure that I do not violate others’ copyright or privacy rights."]})]})}),l.jsxs("div",{className:oe.sbModalFooter,children:[l.jsx(Le,{variant:"ghost",onClick:t,children:"Cancel"}),l.jsx(Le,{variant:"primary",onClick:e,disabled:!r,children:"Submit"})]})]})})},g_=({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:oe.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":"genqr-title",children:l.jsxs("div",{className:oe.sbModal,children:[l.jsxs("div",{className:oe.sbModalHeader,children:[l.jsx("span",{id:"genqr-title",className:oe.sbModalTitle,children:"Generate QR Codes"}),l.jsx("button",{className:oe.sbModalClose,onClick:t,"aria-label":"Close",type:"button",children:"×"})]}),l.jsxs("div",{className:oe.sbModalBody,children:[l.jsxs("label",{className:oe.sbLabel,htmlFor:"qr-count",children:["Number of QR Codes ",l.jsx("span",{"aria-hidden":"true",style:{color:"var(--sbx-error, #DC2626)"},children:"*"})]}),l.jsx("input",{id:"qr-count",type:"number",min:2,max:250,className:oe.sbTextarea,style:{resize:"none",height:"40px"},placeholder:"Enter number (2–250)",value:r,onChange:o=>n(o.target.value)}),r&&!i&&l.jsx("p",{className:oe.sbError,children:"Enter a number between 2 and 250."})]}),l.jsxs("div",{className:oe.sbModalFooter,children:[l.jsx(Le,{variant:"ghost",onClick:t,children:"Cancel"}),l.jsx(Le,{variant:"primary",onClick:()=>e(s),disabled:!i,children:"Generate"})]})]})})},y_=({editorMode:e,isSaving:t,isDirty:r,lastSaved:n,isFormValid:s=!0,onToolbarEvent:i})=>{var $e,ge;const a=De(le=>le.treeData)[0],c=(a==null?void 0:a.name)??"Untitled",d=h_((($e=a==null?void 0:a.metadata)==null?void 0:$e.status)??(a==null?void 0:a.status)),u=ie(le=>{var he,je,ze,Ae;return((je=(he=le.editorConfig)==null?void 0:he.context)==null?void 0:je.contentId)??((Ae=(ze=le.editorConfig)==null?void 0:ze.context)==null?void 0:Ae.identifier)??""}),{activeModal:f,modalData:g,closeModal:y,openModal:_}=em(),p=ie(le=>le.buttonLoaders),v=ie(le=>le.categoryMeta),m=!v||v.schemaDefaults.generateDIALCodes!=="No",[b,S]=h.useState(!1),[w,E]=h.useState(!1),[T,x]=h.useState(!1),[A,$]=h.useState(!1),N=h.useRef(null),[P,U]=h.useState(!1);h.useEffect(()=>{if(!A)return;const le=he=>{var je;(je=N.current)!=null&&je.contains(he.target)||$(!1)};return document.addEventListener("mousedown",le),()=>document.removeEventListener("mousedown",le)},[A]);const[M,L]=h.useState(!1),[j,Z]=h.useState(!1),{updateNode:te}=De(),_e=(ge=a==null?void 0:a.metadata)==null?void 0:ge.qrCodeProcessId,we=h.useCallback(async le=>{if(u){U(!1),L(!0);try{const{processId:he,reservedDialcodes:je}=await u_(u,le);he&&a&&te(a.id,{qrCodeProcessId:he,reservedDialcodes:je}),Ie.success('QR Codes generation started. Use "Download QR Codes" once ready.')}catch{Ie.error("Failed to generate QR Codes. Please try again.")}finally{L(!1)}}},[u,a,te]),ve=h.useCallback(async()=>{if(!_e){Ie.error("No QR codes generated yet. Generate QR Codes first.");return}Z(!0);try{const le=await d_(_e);if(le.status==="in-process"){Ie("QR code image generation is in progress. Please try downloading after some time.",{icon:"ℹ️"});return}const he=le.url;if(!he){Ie.error("QR Codes not ready yet. Please wait and try again.");return}const je=await fetch(he).then(Ze=>Ze.blob()),ze=await new Promise(Ze=>{const H=new FileReader;H.onloadend=()=>Ze(H.result),H.readAsDataURL(je)}),Ae=(a==null?void 0:a.metadata)??{},ee=Ze=>Array.isArray(Ze)?Ze.join("_"):typeof Ze=="string"?Ze:"",Ke=[u,ee(Ae.medium),ee(Ae.gradeLevel),ee(Ae.subject)].filter(Boolean),rt=new Date().toISOString().replace(/[:.]/g,"-"),lt=`${Ke.join("_")}_${rt}.zip`,He=document.createElement("a");He.href=ze,He.download=lt,He.style.display="none",document.body.appendChild(He),He.click(),document.body.removeChild(He),Ie.success("QR codes downloaded.")}catch{Ie.error("Failed to download QR Codes.")}finally{Z(!1)}},[_e,a,u]),z=e==="edit",J=e==="review",se=e==="sourcingreview",V=e==="read",R=h.useCallback((le,he)=>{i({action:le,data:he})},[i]),G=h.useCallback(()=>{y(),R("publish")},[y,R]),ae=h.useCallback((le,he)=>{const je=g==null?void 0:g.action;y(),je==="approve"?R("sourcingApprove",{comment:le,score:he}):R("reject",{comment:le})},[y,R,g]),Oe=h.useCallback(le=>{S(!1),R("sendBackForCorrections",{comment:le})},[R]);return l.jsxs(l.Fragment,{children:[l.jsxs("header",{className:oe.topbar,role:"banner",children:[l.jsxs("div",{className:oe.left,children:[l.jsx("button",{className:oe.backBtn,onClick:()=>R("back"),"aria-label":"Go back",type:"button",children:l.jsx(mv,{size:18})}),l.jsx("h1",{className:oe.title,title:c,children:c}),l.jsx("span",{className:`sbx-chip ${oe.statusChip}`,"aria-label":`Status: ${d}`,children:d})]}),l.jsxs("div",{className:oe.right,children:[t?l.jsx("span",{className:oe.savedIndicator,"aria-live":"polite",children:"Saving…"}):r&&z?l.jsx("span",{className:`${oe.savedIndicator} ${oe.unsaved}`,"aria-live":"polite",children:"Unsaved"}):n?l.jsxs("span",{className:oe.savedIndicator,"aria-live":"polite",children:[l.jsx(bn,{size:14,"aria-hidden":"true"}),"Saved ",f_(n)]}):null,!V&&!J&&!se&&d!=="Review"&&l.jsx("span",{title:s?void 0:"Fill all required fields before saving",children:l.jsx(Le,{variant:"ghost",size:"sm",onClick:()=>R("saveCollection"),disabled:!s,children:"Save as Draft"})}),z&&l.jsxs(l.Fragment,{children:[l.jsxs(Le,{variant:"primary",size:"sm",onClick:()=>x(!0),disabled:p.saveCollection,isLoading:p.saveCollection,children:[l.jsx(Mv,{size:14,"aria-hidden":"true"})," Send for review"]}),l.jsx("button",{className:oe.iconBtn,onClick:()=>_("manageCollaborators"),"aria-label":"Collaborators",title:"Collaborators",type:"button",children:l.jsx($v,{size:16,"aria-hidden":"true"})}),m&&l.jsxs("div",{className:oe.qrDropdown,ref:N,children:[l.jsxs("button",{className:oe.iconBtn,onClick:()=>$(le=>!le),"aria-label":"QR Codes",title:"QR Codes",type:"button","aria-haspopup":"true","aria-expanded":A,children:[l.jsx(Kc,{size:16,"aria-hidden":"true"}),l.jsx("span",{className:oe.iconBtnLabel,children:"QR Codes"}),l.jsx("span",{style:{fontSize:10,marginLeft:2},children:"▾"})]}),A&&l.jsxs("div",{className:oe.qrMenu,role:"menu",children:[l.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{$(!1),U(!0)},disabled:M,children:[l.jsx(Kc,{size:14}),M?"Generating…":"Generate QR Codes"]}),l.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{$(!1),ve()},disabled:j||!_e,children:[l.jsx(Cv,{size:14}),j?"Downloading…":"Download QR Codes"]})]})]})]}),J&&l.jsxs("div",{className:oe.reviewBtns,children:[l.jsxs(Le,{variant:"primary",size:"sm",onClick:()=>_("publishChecklist"),disabled:p.publishCollection,isLoading:p.publishCollection,children:[l.jsx(qc,{size:14,"aria-hidden":"true"})," Publish"]}),l.jsxs(Le,{variant:"danger",size:"sm",onClick:()=>E(!0),disabled:p.rejectCollection,isLoading:p.rejectCollection,children:[l.jsx(zo,{size:14,"aria-hidden":"true"})," Reject"]}),l.jsxs(Le,{variant:"ghost",size:"sm",onClick:()=>S(!0),children:[l.jsx(Av,{size:14,"aria-hidden":"true"})," Send Back"]})]}),se&&l.jsxs("div",{className:oe.sourcingBtns,children:[l.jsxs(Le,{variant:"primary",size:"sm",onClick:()=>_("qualityParams",{action:"approve"}),children:[l.jsx(Lv,{size:14,"aria-hidden":"true"})," Approve"]}),l.jsxs(Le,{variant:"danger",size:"sm",onClick:()=>_("qualityParams",{action:"reject"}),children:[l.jsx(zo,{size:14,"aria-hidden":"true"})," Reject"]})]})]})]}),f==="publishChecklist"&&l.jsx(nm,{contentId:u,onConfirm:G,onCancel:y}),f==="qualityParams"&&l.jsx(sm,{contentId:u,action:(g==null?void 0:g.action)??"reject",onConfirm:ae,onCancel:y}),f==="manageCollaborators"&&l.jsx("div",{className:oe.modalOverlay,role:"dialog","aria-modal":"true",children:l.jsx(l_,{contentId:u,onClose:y})}),T&&l.jsx(p_,{onConfirm:()=>{x(!1),R("sendForReview")},onCancel:()=>x(!1)}),w&&l.jsx(ed,{titleText:"Reject Content",labelText:"Reason for rejection",placeholderText:"Explain why this content is being rejected",submitLabel:"Reject",submitVariant:"danger",onConfirm:le=>{E(!1),R("reject",{comment:le})},onCancel:()=>E(!1)}),b&&l.jsx(ed,{titleText:"Send Back for Corrections",labelText:"Corrections needed",placeholderText:"Describe the corrections the author needs to make",submitLabel:"Send Back",submitVariant:"primary",onConfirm:Oe,onCancel:()=>S(!1)}),P&&l.jsx(g_,{onConfirm:we,onCancel:()=>U(!1)})]})},v_=({onSave:e,onDiscard:t,onCancel:r,isSaving:n})=>Me.createPortal(l.jsx("div",{className:Fe.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"unsaved-title",children:l.jsxs("div",{className:Fe.modal,children:[l.jsxs("div",{className:Fe.modalHeader,children:[l.jsx("span",{id:"unsaved-title",children:"Unsaved changes"}),l.jsx("button",{className:Fe.modalHeaderClose,onClick:r,"aria-label":"Close",disabled:n,children:"×"})]}),l.jsx("div",{className:Fe.modalBody,children:l.jsx("p",{style:{margin:0,fontSize:14,lineHeight:1.5},children:"You have unsaved changes. Would you like to save them before leaving?"})}),l.jsxs("div",{className:Fe.modalFooter,children:[l.jsx(Le,{variant:"ghost",onClick:r,disabled:n,children:"Cancel"}),l.jsx(Le,{variant:"danger",onClick:t,disabled:n,children:"Discard"}),l.jsx(Le,{variant:"primary",onClick:e,isLoading:n,disabled:n,children:"Save"})]})]})}),document.body);var m_=ta();const td=h.createContext(null);function Nt(){const e=h.useContext(td);if(e===null)throw new Error("No Tree Api Provided");return e}const rd=h.createContext(null);function b_(){const e=h.useContext(rd);if(e===null)throw new Error("Provide a NodesContext");return e}const nd=h.createContext(null);function __(){const e=h.useContext(nd);if(e===null)throw new Error("Provide a DnDContext");return e}const sd=h.createContext(0);function id(){h.useContext(sd)}function ki(e,t,r){return Math.max(Math.min(e,r),t)}function od(e){return e&&e.isLeaf}function ad(e){return e&&e.isInternal&&!e.isOpen}function ld(e){var t;return e&&e.isOpen&&!(!((t=e.children)===null||t===void 0)&&t.length)}const cd=(e,t)=>{let r=e;for(;r;){if(r.id===t.id)return!0;r=r.parent}return!1},ud=e=>{if(!e.parent)throw Error("Node does not have a parent");return e.parent.children.findIndex(t=>t.id===e.id)};function wa(e,t){if(!e)return null;if(e.id===t)return e;if(e.children)for(let r of e.children){const n=wa(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 dd(e){const t=hd(e);let r;for(let n=0;n<t.length;++n)if(t[n]===e){r=w_(t,n);break}r==null||r.focus()}function fd(e){const t=hd(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 w_(e,t){return t+1<e.length?e[t+1]:e[0]}function S_(e,t){return t-1>=0?e[t-1]:e[e.length-1]}function hd(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 C_(e,...t){if(e)return e(...t)}function pd(e){return new Promise((t,r)=>{let n=0;function s(){n+=1,n===100&&r(),e()?t():setTimeout(s,10)}s()})}function gd(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 yd(e){const t=e.focusedNode;return t?t.isOpen?t.id:t.parent&&!t.parent.isRoot?t.parent.id:null:null}const E_=Object.freeze(Object.defineProperty({__proto__:null,access:ws,bound:ki,dfs:wa,focusNextElement:dd,focusPrevElement:fd,getInsertIndex:gd,getInsertParentId:yd,identify:In,indexOf:ud,isClosed:ad,isDescendant:cd,isItem:od,isOpenWithEmptyChildren:ld,safeRun:C_,waitFor:pd,walk:xi},Symbol.toStringTag,{value:"Module"})),O_={display:"flex",alignItems:"center",zIndex:1},I_={flex:1,height:"2px",background:"#4B91E2",borderRadius:"1px"},D_={width:"4px",height:"4px",boxShadow:"0 0 0 3px #4B91E2",borderRadius:"50%"},T_=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({},O_),s),children:[l.jsx("div",{style:Object.assign({},D_)}),l.jsx("div",{style:Object.assign({},I_)})]})});function N_({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 k_(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(A_,Object.assign({},e)):l.jsx(x_,Object.assign({},e))]})}function x_(e){return l.jsx(l.Fragment,{children:l.jsx("span",{children:e.node.data.name})})}function A_({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 vd(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 Sa(e){return{type:"EDIT",id:e}}function P_(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 M_(){return{type:"TREE_BLUR"}}function L_(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 Ca={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 md(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 F_(e={filtered:{},unfiltered:{}},t){return t.type.startsWith("VISIBILITY")?t.filtered?Object.assign(Object.assign({},e),{filtered:md(e.filtered,t)}):Object.assign(Object.assign({},e),{unfiltered:md(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 $_(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 j_(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 B_={position:"fixed",pointerEvents:"none",zIndex:100,left:0,top:0,width:"100%",height:"100%"},U_=e=>{if(!e)return{display:"none"};const{x:t,y:r}=e;return{transform:`translate(${t}px, ${r}px)`}},V_=e=>{if(!e)return{display:"none"};const{x:t,y:r}=e;return{transform:`translate(${t+10}px, ${r+10}px)`}};function bd({offset:e,mouse:t,id:r,dragIds:n,isDragging:s}){return l.jsxs(q_,{isDragging:s,children:[l.jsx(z_,{offset:e,children:l.jsx(W_,{id:r,dragIds:n})}),l.jsx(H_,{mouse:t,count:n.length})]})}const q_=h.memo(function(t){return t.isDragging?l.jsx("div",{style:B_,children:t.children}):null});function z_(e){return l.jsx("div",{className:"row preview",style:U_(e.offset),children:e.children})}function H_(e){const{count:t,mouse:r}=e;return t>1?l.jsx("div",{className:"selected-count",style:V_(r),children:t}):null}const W_=h.memo(function(t){const r=Nt(),n=r.get(t.id);return n?l.jsx(r.renderNode,{preview:!0,node:n,style:{paddingLeft:n.level*r.indent,opacity:.2,background:"transparent"},tree:r}):null});function Ea(){return Ea=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},Ea.apply(null,arguments)}function _d(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Oa(e,t){return Oa=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Oa(e,t)}function Q_(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Oa(e,t)}var wd=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function K_(e,t){return!!(e===t||wd(e)&&wd(t))}function G_(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!K_(e[r],t[r]))return!1;return!0}function Ia(e,t){t===void 0&&(t=G_);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",Sd=Y_?function(){return performance.now()}:function(){return Date.now()};function Cd(e){cancelAnimationFrame(e.id)}function R_(e,t){var r=Sd();function n(){Sd()-r>=t?e.call(null):s.id=requestAnimationFrame(n)}var s={id:requestAnimationFrame(n)};return s}var Da=-1;function Ed(e){if(e===void 0&&(e=!1),Da===-1||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",document.body.appendChild(t),Da=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return Da}var kn=null;function Od(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 X_=150,Z_=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 Id(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){Q_(g,f);function g(_){var p;return p=f.call(this,_)||this,p._instanceProps=c(p.props,_d(p)),p._outerRef=void 0,p._resetIsScrollingTimeoutId=null,p.state={instance:_d(p),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof p.props.initialScrollOffset=="number"?p.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},p._callOnItemsRendered=void 0,p._callOnItemsRendered=Ia(function(v,m,b,S){return p.props.onItemsRendered({overscanStartIndex:v,overscanStopIndex:m,visibleStartIndex:b,visibleStopIndex:S})}),p._callOnScroll=void 0,p._callOnScroll=Ia(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),T;if(E.hasOwnProperty(v))T=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",P=$?x:0;E[v]=T={position:"absolute",left:N?void 0:P,right:N?P:void 0,top:$?0:x,height:$?"100%":A,width:$?A:"100%"}}return T},p._getItemStyleCache=void 0,p._getItemStyleCache=Ia(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 T=p.props.direction,x=S;if(T==="rtl")switch(Od()){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 T=Math.max(0,Math.min(w,S-b));return{isScrolling:!0,scrollDirection:E.scrollOffset<T?"forward":"backward",scrollOffset:T,scrollUpdateWasRequested:!1}},p._resetIsScrollingDebounced)},p._outerRefSetter=function(v){var m=p.props.outerRef;p._outerRef=v,typeof m=="function"?m(v):m!=null&&typeof m=="object"&&m.hasOwnProperty("current")&&(m.current=v)},p._resetIsScrollingDebounced=function(){p._resetIsScrollingTimeoutId!==null&&Cd(p._resetIsScrollingTimeoutId),p._resetIsScrollingTimeoutId=R_(p._resetIsScrolling,X_)},p._resetIsScrolling=function(){p._resetIsScrollingTimeoutId=null,p.setState({isScrolling:!1},function(){p._getItemStyleCache(-1,null)})},p}g.getDerivedStateFromProps=function(p,v){return J_(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 T=this._outerRef;S==="vertical"?E=T.scrollWidth>T.clientWidth?Ed():0:E=T.scrollHeight>T.clientHeight?Ed():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(Od()){case"negative":E.scrollLeft=-S;break;case"positive-ascending":E.scrollLeft=S;break;default:var T=E.clientWidth,x=E.scrollWidth;E.scrollLeft=x-T-S;break}else E.scrollLeft=S;else E.scrollTop=S}this._callPropsCallbacks()},y.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&Cd(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,T=p.innerTagName,x=p.itemCount,A=p.itemData,$=p.itemKey,N=$===void 0?Z_:$,P=p.layout,U=p.outerElementType,M=p.outerTagName,L=p.style,j=p.useIsScrolling,Z=p.width,te=this.state.isScrolling,_e=b==="horizontal"||P==="horizontal",we=_e?this._onScrollHorizontal:this._onScrollVertical,ve=this._getRangeToRender(),z=ve[0],J=ve[1],se=[];if(x>0)for(var V=z;V<=J;V++)se.push(h.createElement(v,{data:A,key:N(V,A),index:V,isScrolling:j?te:void 0,style:this._getItemStyle(V)}));var R=n(this.props,this._instanceProps);return h.createElement(U||M||"div",{className:m,onScroll:we,ref:this._outerRefSetter,style:Ea({position:"relative",height:S,width:Z,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:b},L)},h.createElement(E||T||"div",{children:se,ref:w,style:{height:_e?"100%":R,pointerEvents:te?"none":void 0,width:_e?R:"100%"}}))},y._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var p=this.props.itemCount;if(p>0){var v=this._getRangeToRender(),m=v[0],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,T=E.scrollDirection,x=E.scrollOffset,A=E.scrollUpdateWasRequested;this._callOnScroll(T,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 T=o(this.props,E,this._instanceProps),x=a(this.props,T,E,this._instanceProps),A=!S||w==="backward"?Math.max(1,m):1,$=!S||w==="forward"?Math.max(1,m):1;return[Math.max(0,T-A),Math.max(0,Math.min(v-1,x+$)),T,x]},g}(h.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var J_=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.'))}},ew=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]},tw=function(t,r,n){var s=r.itemMetadataMap,i=r.lastMeasuredIndex,o=i>0?s[i].offset:0;return o>=n?Dd(t,r,i,0,n):rw(t,r,Math.max(0,i),n)},Dd=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},rw=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 Dd(t,r,Math.min(n,i-1),Math.floor(n/2),s)},Td=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},nw=Id({getItemOffset:function(t,r,n){return xn(t,r,n).offset},getItemSize:function(t,r,n){return n.itemMetadataMap[r].size},getEstimatedTotalSize:Td,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),_=Td(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 tw(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||ew,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.'))}}),sw=Id({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 iw(){var e,t;const r=Nt(),s=__().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 ow=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 aw=h.forwardRef(function(t,r){const{children:n}=t,s=ow(t,["children"]),i=Nt();return l.jsxs("div",Object.assign({ref:r},s,{onClick:o=>{o.currentTarget===o.target&&i.deselectAll()},children:[l.jsx(lw,{}),n]}))}),lw=()=>{const e=Nt();return l.jsx("div",{style:{height:e.rowTopPosition(e.visibleNodes.length),width:"100%",position:"absolute",left:"0",right:"0"},children:l.jsx(iw,{})})};var cw=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 uw=h.forwardRef(function(t,r){var n,s,i,o,{style:a}=t,c=cw(t,["style"]);const d=Nt(),u=(s=(n=d.props.padding)!==null&&n!==void 0?n:d.props.paddingTop)!==null&&s!==void 0?s:0,f=(o=(i=d.props.padding)!==null&&i!==void 0?i:d.props.paddingBottom)!==null&&o!==void 0?o:0;return l.jsx("div",Object.assign({ref:r,style:Object.assign(Object.assign({},a),{height:`${parseFloat(a.height)+u+f}px`})},c))});var Nd=h.createContext({dragDropManager:void 0}),Vt;(function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"})(Vt||(Vt={}));function ue(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 Ta="dnd-core/INIT_COORDS",Mi="dnd-core/BEGIN_DRAG",Na="dnd-core/PUBLISH_DRAG_SOURCE",Li="dnd-core/HOVER",Fi="dnd-core/DROP",$i="dnd-core/END_DRAG";function kd(e,t){return{type:Ta,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 dw(e,t,r){return t.split(".").reduce(function(n,s){return n&&n[s]?n[s]:r||null},e)}function fw(e,t){return e.filter(function(r){return r!==t})}function xd(e){return ji(e)==="object"}function hw(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 pw(e,t){return e.filter(function(r){return t.indexOf(r)>-1})}var gw={type:Ta,payload:{clientOffset:null,sourceClientOffset:null}};function yw(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(kd(o)),vw(r,c,d);var u=_w(r,c);if(u===null){e.dispatch(gw);return}var f=null;if(o){if(!a)throw new Error("getSourceClientOffset must be defined");mw(a),f=a(u)}e.dispatch(kd(o,f));var g=d.getSource(u),y=g.beginDrag(c,u);if(y!=null){bw(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 vw(e,t,r){ue(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach(function(n){ue(r.getSource(n),"Expected sourceIds to be registered.")})}function mw(e){ue(typeof e=="function","When clientOffset is provided, getSourceClientOffset must be a function.")}function bw(e){ue(xd(e),"Item must be an object.")}function _w(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 ww(e){return function(){var r=e.getMonitor();if(r.isDragging())return{type:Na}}}function ka(e,t){return t===null?e===null:Array.isArray(e)?e.some(function(r){return r===t}):e===t}function Sw(e){return function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=n.clientOffset;Cw(r);var i=r.slice(0),o=e.getMonitor(),a=e.getRegistry();Ew(i,o,a);var c=o.getItemType();return Ow(i,a,c),Iw(i,o,a),{type:Li,payload:{targetIds:i,clientOffset:s||null}}}}function Cw(e){ue(Array.isArray(e),"Expected targetIds to be an array.")}function Ew(e,t,r){ue(t.isDragging(),"Cannot call hover while not dragging."),ue(!t.didDrop(),"Cannot call hover after drop.");for(var n=0;n<e.length;n++){var s=e[n];ue(e.lastIndexOf(s)===n,"Expected targetIds to be unique in the passed array.");var i=r.getTarget(s);ue(i,"Expected targetIds to be registered.")}}function Ow(e,t,r){for(var n=e.length-1;n>=0;n--){var s=e[n],i=t.getTargetType(s);ka(i,r)||e.splice(n,1)}}function Iw(e,t,r){e.forEach(function(n){var s=r.getTarget(n);s.hover(t,n)})}function Ad(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Pd(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ad(Object(r),!0).forEach(function(n){Dw(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ad(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Dw(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Tw(e){return function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.getMonitor(),s=e.getRegistry();Nw(n);var i=Aw(n);i.forEach(function(o,a){var c=kw(o,a,s,n),d={type:Fi,payload:{dropResult:Pd(Pd({},r),c)}};e.dispatch(d)})}}function Nw(e){ue(e.isDragging(),"Cannot call drop while not dragging."),ue(!e.didDrop(),"Cannot call drop twice during one drag operation.")}function kw(e,t,r,n){var s=r.getTarget(e),i=s?s.drop(n,e):void 0;return xw(i),typeof i>"u"&&(i=t===0?{}:n.getDropResult()),i}function xw(e){ue(typeof e>"u"||xd(e),"Drop result must either be an object or undefined.")}function Aw(e){var t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function Pw(e){return function(){var r=e.getMonitor(),n=e.getRegistry();Mw(r);var s=r.getSourceId();if(s!=null){var i=n.getSource(s,!0);i.endDrag(r,s),n.unpinSource()}return{type:$i}}}function Mw(e){ue(e.isDragging(),"Cannot call endDrag while not dragging.")}function Lw(e){return{beginDrag:yw(e),publishDragSource:ww(e),hover:Sw(e),drop:Tw(e),endDrag:Pw(e)}}function Fw(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function $w(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 jw(e,t,r){return t&&$w(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 Bw=function(){function e(t,r){var n=this;Fw(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 jw(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=Lw(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 qt(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 Md=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),Ld=function(){return Math.random().toString(36).substring(7).split("").join(".")},Fd={INIT:"@@redux/INIT"+Ld(),REPLACE:"@@redux/REPLACE"+Ld()};function Uw(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 Vw(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(Hw(e))return"date";if(zw(e))return"error";var r=qw(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 qw(e){return typeof e.constructor=="function"?e.constructor.name:null}function zw(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function Hw(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=Vw(e)),t}function $d(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"?qt(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"?qt(1):"Expected the enhancer to be a function. Instead, received: '"+An(r)+"'");return r($d)(e,t)}if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?qt(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"?qt(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"?qt(4):"Expected the listener to be a function. Instead, received: '"+An(p)+"'");if(c)throw new Error(process.env.NODE_ENV==="production"?qt(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"?qt(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(!Uw(p))throw new Error(process.env.NODE_ENV==="production"?qt(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"?qt(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"?qt(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"?qt(10):"Expected the nextReducer to be a function. Instead, received: '"+An(p));s=p,g({type:Fd.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"?qt(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[Md]=function(){return this},p}return g({type:Fd.INIT}),n={dispatch:g,subscribe:f,getState:u,replaceReducer:y},n[Md]=_,n}var Ww=function(t,r){return t===r};function Qw(e,t){return!e&&!t?!0:!e||!t?!1:e.x===t.x&&e.y===t.y}function Kw(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ww;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 jd(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 Bd(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?jd(Object(r),!0).forEach(function(n){Gw(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):jd(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Gw(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Ud={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function Yw(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ud,t=arguments.length>1?arguments[1]:void 0,r=t.payload;switch(t.type){case Ta:case Mi:return{initialSourceClientOffset:r.sourceClientOffset,initialClientOffset:r.clientOffset,clientOffset:r.clientOffset};case Li:return Qw(e.clientOffset,r.clientOffset)?e:Bd(Bd({},e),{},{clientOffset:r.clientOffset});case $i:case Fi:return Ud;default:return e}}var xa="dnd-core/ADD_SOURCE",Aa="dnd-core/ADD_TARGET",Pa="dnd-core/REMOVE_SOURCE",Bi="dnd-core/REMOVE_TARGET";function Rw(e){return{type:xa,payload:{sourceId:e}}}function Xw(e){return{type:Aa,payload:{targetId:e}}}function Zw(e){return{type:Pa,payload:{sourceId:e}}}function Jw(e){return{type:Bi,payload:{targetId:e}}}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 zt(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){eS(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 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 tS={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function rS(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:tS,t=arguments.length>1?arguments[1]:void 0,r=t.payload;switch(t.type){case Mi:return zt(zt({},e),{},{itemType:r.itemType,item:r.item,sourceId:r.sourceId,isSourcePublic:r.isSourcePublic,dropResult:null,didDrop:!1});case Na:return zt(zt({},e),{},{isSourcePublic:!0});case Li:return zt(zt({},e),{},{targetIds:r.targetIds});case Bi:return e.targetIds.indexOf(r.targetId)===-1?e:zt(zt({},e),{},{targetIds:fw(e.targetIds,r.targetId)});case Fi:return zt(zt({},e),{},{dropResult:r.dropResult,didDrop:!0,targetIds:[]});case $i:return zt(zt({},e),{},{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}}function nS(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case xa:case Aa:return e+1;case Pa:case Bi:return e-1;default:return e}}var Ui=[],Ma=[];Ui.__IS_NONE__=!0,Ma.__IS_ALL__=!0;function sS(e,t){if(e===Ui)return!1;if(e===Ma||typeof t>"u")return!0;var r=pw(t,e);return r.length>0}function iS(){var e=arguments.length>1?arguments[1]:void 0;switch(e.type){case Li:break;case xa:case Aa:case Bi:case Pa:return Ui;case Mi:case Na:case $i:case Fi:default:return Ma}var t=e.payload,r=t.targetIds,n=r===void 0?[]:r,s=t.prevTargetIds,i=s===void 0?[]:s,o=hw(n,i),a=o.length>0||!Kw(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 oS(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return e+1}function qd(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function zd(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?qd(Object(r),!0).forEach(function(n){aS(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):qd(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function aS(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:iS(e.dirtyHandlerIds,{type:t.type,payload:zd(zd({},t.payload),{},{prevTargetIds:dw(e,"dragOperation.targetIds",[])})}),dragOffset:Yw(e.dragOffset,t),refCount:nS(e.refCount,t),dragOperation:rS(e.dragOperation,t),stateId:oS(e.stateId)}}function cS(e,t){return{x:e.x+t.x,y:e.y+t.y}}function Hd(e,t){return{x:e.x-t.x,y:e.y-t.y}}function uS(e){var t=e.clientOffset,r=e.initialClientOffset,n=e.initialSourceClientOffset;return!t||!r||!n?null:Hd(cS(t,n),r)}function dS(e){var t=e.clientOffset,r=e.initialClientOffset;return!t||!r?null:Hd(t,r)}function fS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function hS(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function pS(e,t,r){return t&&hS(e.prototype,t),e}function Wd(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var gS=function(){function e(t,r){fS(this,e),Wd(this,"store",void 0),Wd(this,"registry",void 0),this.store=t,this.registry=r}return pS(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;ue(typeof r=="function","listener must be a function."),ue(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&&!sS(d.dirtyHandlerIds,i);f||r()}finally{o=u}};return this.store.subscribe(a)}},{key:"subscribeToOffsetChange",value:function(r){var n=this;ue(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 ue(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(ue(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 ka(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(ue(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&&!ka(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 uS(this.store.getState().dragOffset)}},{key:"getDifferenceFromInitialOffset",value:function(){return dS(this.store.getState().dragOffset)}}]),e}(),yS=0;function vS(){return yS++}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 mS(e){ue(typeof e.canDrag=="function","Expected canDrag to be a function."),ue(typeof e.beginDrag=="function","Expected beginDrag to be a function."),ue(typeof e.endDrag=="function","Expected endDrag to be a function.")}function bS(e){ue(typeof e.canDrop=="function","Expected canDrop to be a function."),ue(typeof e.hover=="function","Expected hover to be a function."),ue(typeof e.drop=="function","Expected beginDrag to be a function.")}function La(e,t){if(t&&Array.isArray(e)){e.forEach(function(r){return La(r,!1)});return}ue(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 Qd=typeof global<"u"?global:self,Kd=Qd.MutationObserver||Qd.WebKitMutationObserver;function Gd(e){return function(){const r=setTimeout(s,0),n=setInterval(s,50);function s(){clearTimeout(r),clearInterval(n),e()}}}function _S(e){let t=1;const r=new Kd(e),n=document.createTextNode("");return r.observe(n,{characterData:!0}),function(){t=-t,n.data=t}}const wS=typeof Kd=="function"?_S:Gd;class SS{enqueueTask(t){const{queue:r,requestFlush:n}=this;r.length||(n(),this.flushing=!0),r[r.length]=t}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{const{queue:t}=this;for(;this.index<t.length;){const r=this.index;if(this.index++,t[r].call(),this.index>this.capacity){for(let n=0,s=t.length-this.index;n<s;n++)t[n]=t[n+this.index];t.length-=this.index,this.index=0}}t.length=0,this.index=0,this.flushing=!1},this.registerPendingError=t=>{this.pendingErrors.push(t),this.requestErrorThrow()},this.requestFlush=wS(this.flush),this.requestErrorThrow=Gd(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}}class CS{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 ES{create(t){const r=this.freeTasks,n=r.length?r.pop():new CS(this.onError,s=>r[r.length]=s);return n.task=t,n}constructor(t){this.onError=t,this.freeTasks=[]}}const Yd=new SS,OS=new ES(Yd.registerPendingError);function IS(e){Yd.enqueueTask(OS.create(e))}function DS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function TS(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 NS(e,t,r){return t&&TS(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 kS(e,t){return MS(e)||PS(e,t)||AS(e,t)||xS()}function xS(){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 AS(e,t){if(e){if(typeof e=="string")return
|
|
458
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function qS(e,t){if(e){if(typeof e=="string")return Jd(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Jd(e,t)}}function Jd(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function zS(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 HS(e){if(Array.isArray(e))return e}function WS(e,t){if(e==null)return{};var r=QS(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 QS(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 ef=0,qi=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__"),KS=h.memo(function(t){var r=t.children,n=WS(t,BS),s=GS(n),i=US(s,2),o=i[0],a=i[1];return h.useEffect(function(){if(a){var c=tf();return++ef,function(){--ef===0&&(c[qi]=null)}}},[]),l.jsx(Nd.Provider,Object.assign({value:o},{children:r}),void 0)});function GS(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]:tf(),r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0,s=t;return s[qi]||(s[qi]={dragDropManager:$S(e,t,r,n)}),s[qi]}function tf(){return typeof global<"u"?global:window}function RS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function XS(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ZS(e,t,r){return t&&XS(e.prototype,t),e}function 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 Fa=!1,$a=!1,JS=function(){function e(t){RS(this,e),rf(this,"internalMonitor",void 0),rf(this,"sourceId",null),this.internalMonitor=t.getMonitor()}return ZS(e,[{key:"receiveHandlerId",value:function(r){this.sourceId=r}},{key:"getHandlerId",value:function(){return this.sourceId}},{key:"canDrag",value:function(){ue(!Fa,"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 Fa=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{Fa=!1}}},{key:"isDragging",value:function(){if(!this.sourceId)return!1;ue(!$a,"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 $a=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{$a=!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 eC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function tC(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function rC(e,t,r){return t&&tC(e.prototype,t),e}function nf(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ja=!1,nC=function(){function e(t){eC(this,e),nf(this,"internalMonitor",void 0),nf(this,"targetId",null),this.internalMonitor=t.getMonitor()}return rC(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;ue(!ja,"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 ja=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{ja=!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 sC(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 iC(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;sC(s);var i=r?function(o){return e(o,r)}:e;return oC(s,i)}}function sf(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=iC(n);t[r]=function(){return s}}}),t}function of(e,t){typeof e=="function"?e(t):e.current=t}function oC(e,t){var r=e.ref;return ue(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){of(r,s),of(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 Ba(e){return e!==null&&zi(e)==="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function Ua(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 aC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function lC(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function cC(e,t,r){return t&&lC(e.prototype,t),e}function vt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var uC=function(){function e(t){var r=this;aC(this,e),vt(this,"hooks",sf({dragSource:function(s,i){r.clearDragSource(),r.dragSourceOptions=i||null,Ba(s)?r.dragSourceRef=s:r.dragSourceNode=s,r.reconnectDragSource()},dragPreview:function(s,i){r.clearDragPreview(),r.dragPreviewOptions=i||null,Ba(s)?r.dragPreviewRef=s:r.dragPreviewNode=s,r.reconnectDragPreview()}})),vt(this,"handlerId",null),vt(this,"dragSourceRef",null),vt(this,"dragSourceNode",void 0),vt(this,"dragSourceOptionsInternal",null),vt(this,"dragSourceUnsubscribe",void 0),vt(this,"dragPreviewRef",null),vt(this,"dragPreviewNode",void 0),vt(this,"dragPreviewOptionsInternal",null),vt(this,"dragPreviewUnsubscribe",void 0),vt(this,"lastConnectedHandlerId",null),vt(this,"lastConnectedDragSource",null),vt(this,"lastConnectedDragSourceOptions",null),vt(this,"lastConnectedDragPreview",null),vt(this,"lastConnectedDragPreviewOptions",null),vt(this,"backend",void 0),this.backend=t}return cC(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!Ua(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}},{key:"didDragPreviewOptionsChange",value:function(){return!Ua(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 dC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function fC(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function hC(e,t,r){return t&&fC(e.prototype,t),e}function nr(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var pC=function(){function e(t){var r=this;dC(this,e),nr(this,"hooks",sf({dropTarget:function(s,i){r.clearDropTarget(),r.dropTargetOptions=i,Ba(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 hC(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!Ua(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 gC(e,t,r){var n=r.getRegistry(),s=n.addTarget(e,t);return[s,function(){return n.removeTarget(s)}]}function yC(e,t,r){var n=r.getRegistry(),s=n.addSource(e,t);return[s,function(){return n.removeSource(s)}]}var Yr=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 vC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function mC(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function bC(e,t,r){return t&&mC(e.prototype,t),e}function Va(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var _C=function(){function e(t,r,n){vC(this,e),Va(this,"spec",void 0),Va(this,"monitor",void 0),Va(this,"connector",void 0),this.spec=t,this.monitor=r,this.connector=n}return bC(e,[{key:"beginDrag",value:function(){var r,n=this.spec,s=this.monitor,i=null;return 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 wC(e,t,r){var n=h.useMemo(function(){return new _C(e,t,r)},[t,r]);return h.useEffect(function(){n.spec=e},[e]),n}function Rr(){var e=h.useContext(Nd),t=e.dragDropManager;return ue(t!=null,"Expected drag drop context"),t}function SC(e){return h.useMemo(function(){var t=e.type;return ue(t!=null,"spec.type must be defined"),t},[e])}function CC(e,t){return DC(e)||IC(e,t)||OC(e,t)||EC()}function EC(){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 OC(e,t){if(e){if(typeof e=="string")return
|
|
460
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function xC(e,t){if(e){if(typeof e=="string")return
|
|
461
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function UC(e,t){if(e){if(typeof e=="string")return
|
|
462
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function WC(e,t){if(e){if(typeof e=="string")return
|
|
463
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function o0(e,t){if(e){if(typeof e=="string")return
|
|
464
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function g0(e,t){if(e){if(typeof e=="string")return
|
|
465
|
-
`)},dataTransfer:function(t){return t}},matchesTypes:["Url","text/uri-list"]}),Qi(Mn,Ef,{exposeProperties:{text:function(t,r){return za(t,r,"")},dataTransfer:function(t){return t}},matchesTypes:["Text","text/plain"]}),Mn);function P0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function M0(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function L0(e,t,r){return t&&M0(e.prototype,t),e}function Df(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var F0=function(){function e(t){P0(this,e),Df(this,"item",void 0),Df(this,"config",void 0),this.config=t,this.item={},this.initializeExposedProperties()}return L0(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 $0(e,t){var r=new F0(Ha[e]);return r.loadDataTransfer(t),r}function Wa(e){if(!e)return null;var t=Array.prototype.slice.call(e.types||[]);return Object.keys(Ha).filter(function(r){var n=Ha[r].matchesTypes;return n.some(function(s){return t.indexOf(s)>-1})})[0]||null}function j0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function B0(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function U0(e,t,r){return t&&B0(e.prototype,t),e}function Qa(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var V0=function(){function e(t,r){j0(this,e),Qa(this,"ownerDocument",null),Qa(this,"globalContext",void 0),Qa(this,"optionsArgs",void 0),this.globalContext=t,this.optionsArgs=r}return U0(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 Tf(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 Nf(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Tf(Object(r),!0).forEach(function(n){be(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Tf(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function q0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function z0(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function H0(e,t,r){return t&&z0(e.prototype,t),e}function 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 W0=function(){function e(t,r,n){var s=this;q0(this,e),be(this,"options",void 0),be(this,"actions",void 0),be(this,"monitor",void 0),be(this,"registry",void 0),be(this,"enterLeaveCounter",void 0),be(this,"sourcePreviewNodes",new Map),be(this,"sourcePreviewNodeOptions",new Map),be(this,"sourceNodes",new Map),be(this,"sourceNodeOptions",new Map),be(this,"dragStartSourceIds",null),be(this,"dropTargetIds",[]),be(this,"dragEnterTargetIds",[]),be(this,"currentNativeSource",null),be(this,"currentNativeHandle",null),be(this,"currentDragSourceNode",null),be(this,"altKeyPressed",!1),be(this,"mouseMoveTimeoutTimer",null),be(this,"asyncEndDragFrameId",null),be(this,"dragOverTargetIds",null),be(this,"lastClientOffset",null),be(this,"hoverRafId",null),be(this,"getSourceClientOffset",function(i){var o=s.sourceNodes.get(i);return o&&wf(o)||null}),be(this,"endDragNativeItem",function(){s.isDraggingNativeItem()&&(s.actions.endDrag(),s.currentNativeHandle&&s.registry.removeSource(s.currentNativeHandle),s.currentNativeHandle=null,s.currentNativeSource=null)}),be(this,"isNodeInDocument",function(i){return!!(i&&s.document&&s.document.body&&s.document.body.contains(i))}),be(this,"endDragIfSourceWasRemovedFromDOM",function(){var i=s.currentDragSourceNode;i==null||s.isNodeInDocument(i)||s.clearCurrentDragSourceNode()&&s.monitor.isDragging()&&s.actions.endDrag()}),be(this,"handleTopDragStartCapture",function(){s.clearCurrentDragSourceNode(),s.dragStartSourceIds=[]}),be(this,"handleTopDragStart",function(i){if(!i.defaultPrevented){var o=s.dragStartSourceIds;s.dragStartSourceIds=null;var a=Wi(i);s.monitor.isDragging()&&s.actions.endDrag(),s.actions.beginDrag(o||[],{publishSource:!1,getSourceClientOffset:s.getSourceClientOffset,clientOffset:a});var c=i.dataTransfer,d=Wa(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=A0(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(),T=E.captureDraggingState;T?s.actions.publishDragSource():setTimeout(function(){return s.actions.publishDragSource()},0)}else if(d)s.beginDragNativeItem(d);else{if(c&&!c.types&&(i.target&&!i.target.hasAttribute||!i.target.hasAttribute("draggable")))return;i.preventDefault()}}}),be(this,"handleTopDragEndCapture",function(){s.clearCurrentDragSourceNode()&&s.monitor.isDragging()&&s.actions.endDrag()}),be(this,"handleTopDragEnterCapture",function(i){s.dragEnterTargetIds=[];var o=s.enterLeaveCounter.enter(i.target);if(!(!o||s.monitor.isDragging())){var a=i.dataTransfer,c=Wa(a);c&&s.beginDragNativeItem(c,a)}}),be(this,"handleTopDragEnter",function(i){var o=s.dragEnterTargetIds;if(s.dragEnterTargetIds=[],!!s.monitor.isDragging()){s.altKeyPressed=i.altKey,o.length>0&&s.actions.hover(o,{clientOffset:Wi(i)});var a=o.some(function(c){return s.monitor.canDropOnTarget(c)});a&&(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect=s.getCurrentDropEffect()))}}),be(this,"handleTopDragOverCapture",function(){s.dragOverTargetIds=[]}),be(this,"handleTopDragOver",function(i){var o=s.dragOverTargetIds;if(s.dragOverTargetIds=[],!s.monitor.isDragging()){i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect="none");return}s.altKeyPressed=i.altKey,s.lastClientOffset=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"))}),be(this,"handleTopDragLeaveCapture",function(i){s.isDraggingNativeItem()&&i.preventDefault();var o=s.enterLeaveCounter.leave(i.target);o&&s.isDraggingNativeItem()&&setTimeout(function(){return s.endDragNativeItem()},0)}),be(this,"handleTopDropCapture",function(i){if(s.dropTargetIds=[],s.isDraggingNativeItem()){var o;i.preventDefault(),(o=s.currentNativeSource)===null||o===void 0||o.loadDataTransfer(i.dataTransfer)}else Wa(i.dataTransfer)&&i.preventDefault();s.enterLeaveCounter.reset()}),be(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()}),be(this,"handleSelectStart",function(i){var o=i.target;typeof o.dragDrop=="function"&&(o.tagName==="INPUT"||o.tagName==="SELECT"||o.tagName==="TEXTAREA"||o.isContentEditable||(i.preventDefault(),o.dragDrop()))}),this.options=new V0(r,n),this.actions=t.getActions(),this.monitor=t.getMonitor(),this.registry=t.getRegistry(),this.enterLeaveCounter=new E0(this.isNodeInDocument)}return H0(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 Nf({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 Nf({anchorX:.5,anchorY:.5,captureDraggingState:!1},n||{})}},{key:"isDraggingNativeItem",value:function(){var r=this.monitor.getItemType();return Object.keys(If).some(function(n){return If[n]===r})}},{key:"beginDragNativeItem",value:function(r,n){this.clearCurrentDragSourceNode(),this.currentNativeSource=$0(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 Q0(){return Ki||(Ki=new Image,Ki.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="),Ki}var K0=function(t,r,n){return new W0(t,r,n)};function G0(e,t){return typeof e=="function"?e(t):e??"NODE"}function Y0(e){return e.isDraggable&&!e.isEditing}function R0(e){const t=Nt(),r=t.selectedIds,[n,s,i]=XC(()=>({canDrag:()=>Y0(e),type:G0(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(Q0())},[i]),s}function X0(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 Z0(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 J0(e){return{type:"highlight",id:e}}function Ka(e,t){var r;let n=e;for(;n.parent&&n.level>t;)n=n.parent;const s=((r=n.parent)===null||r===void 0?void 0:r.id)||null,i=ud(n)+1;return{parentId:s,index:i}}function kf(e){var t;const r=X0(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]=Z0(i,a,o,r);if(i&&i.isInternal&&r.inMiddle)return{drop:Gi(i.id,null),cursor:J0(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(od(c)){const u=ki(s,(d==null?void 0:d.level)||0,c.level);return{drop:Ka(c,u),cursor:Ln(c.rowIndex+1,u)}}if(ad(c)){const u=ki(s,(d==null?void 0:d.level)||0,c.level);return{drop:Ka(c,u),cursor:Ln(c.rowIndex+1,u)}}if(ld(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:Ka(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 e1(e,t){const r=Nt(),[n,s]=gf(()=>({accept:"NODE",canDrop:()=>r.canDrop(),hover:(i,o)=>{const a=o.getClientOffset();if(!e.current||!a)return;const{cursor:c,drop:d}=kf({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 t1(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 xf=h.memo(function({index:t,style:r}){id(),b_();const n=Nt(),s=t1(t),i=h.useRef(null),o=R0(s),a=e1(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 Ga="",Af=null;function Pf(){id();const e=Nt();return l.jsx("div",{role:"tree","aria-label":e.props["aria-label"],"aria-labelledby":e.props["aria-labelledby"],"aria-multiselectable":!e.props.disableMultiSelection||void 0,style:{height:e.height,width:e.width,minHeight:0,minWidth:0},onContextMenu:e.props.onContextMenu,onClick:e.props.onClick,tabIndex:0,onFocus:t=>{t.currentTarget.contains(t.relatedTarget)||e.onFocus()},onBlur:t=>{t.currentTarget.contains(t.relatedTarget)||e.onBlur()},onKeyDown:t=>{var r;if(e.isEditing)return;if(t.key==="Backspace"){if(!e.props.onDelete)return;const s=Array.from(e.selectedIds);if(s.length>1){let i=e.mostRecentNode;for(;i&&i.isSelected;)i=i.nextSibling;i||(i=e.lastNode),e.focus(i,{scroll:!1}),e.delete(Array.from(s))}else{const i=e.focusedNode;if(i){const o=i.nextSibling,a=i.parent;e.focus(o||a,{scroll:!1}),e.delete(i)}}return}if(t.key==="Tab"&&!t.shiftKey){t.preventDefault(),dd(t.currentTarget);return}if(t.key==="Tab"&&t.shiftKey){t.preventDefault(),fd(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(Af),Ga+=t.key,Af=setTimeout(()=>{Ga=""},600);const n=e.visibleNodes.find(s=>{const i=s.data.name;return typeof i=="string"?i.toLowerCase().startsWith(Ga):!1});n&&e.focus(n.id)},children:l.jsx(r1,{})})}function r1(){var e,t;const r=Nt(),n={className:r.props.className,outerRef:r.listEl,itemCount:r.visibleNodes.length,height:r.height,width:r.width,overscanCount:r.overscanCount,itemKey:s=>{var i;return((i=r.visibleNodes[s])===null||i===void 0?void 0:i.id)||s},outerElementType:(e=r.props.outerElementType)!==null&&e!==void 0?e:aw,innerElementType:(t=r.props.innerElementType)!==null&&t!==void 0?t:uw,onScroll:r.props.onScroll,onItemsRendered:r.onItemsRendered.bind(r)};return typeof r.props.rowHeight=="function"?l.jsx(nw,Object.assign({},n,{itemSize:r.rowHeightAt,ref:r.list,children:xf})):l.jsx(sw,Object.assign({},n,{itemSize:r.rowHeight,ref:r.list,children:xf}))}function Mf(e){return e.isFiltered?s1(e.root,e.isMatch.bind(e)):n1(e.root)}function n1(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(Lf),t}function s1(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(Lf),n}function Lf(e,t){e.rowIndex=t}const Ff=e=>e.reduce((t,r,n)=>(t[r.id]=n,t),{});var Ya=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:mt}=E_;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=vd(this),this.visibleNodes=Mf(this),this.idToIndex=Ff(this.visibleNodes)}update(t){this.props=t,this.root=vd(this),this.visibleNodes=Mf(this),this.idToIndex=Ff(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 Ya(this,arguments,void 0,function*(t={}){var r,n;const s=t.parentId===void 0?yd(this):t.parentId,i=(r=t.index)!==null&&r!==void 0?r:gd(this),o=(n=t.type)!==null&&n!==void 0?n:"leaf",a=yield mt(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 Ya(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 mt(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(Sa(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 Ya(this,void 0,void 0,function*(){var n,s;if(!t)return;const i=this.identify(t);yield mt(this.props.onRename,{id:i,name:r,node:this.get(i)}),this.dispatch(Sa(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(Sa(null)),this.resolveEdit({cancelled:!0}),this.redrawList(),setTimeout(()=>this.onFocus())}activate(t){const r=this.get(this.identifyNull(t));r&&mt(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&&mt(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&&mt(this.props.onFocus,this.focusedNode)}deselect(t){if(!t)return;const r=this.identify(t);this.dispatch(Tr.remove(r)),mt(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&&mt(this.props.onFocus,this.focusedNode),mt(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&&mt(this.props.onFocus,this.focusedNode),mt(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&&mt(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})),mt(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&&cd(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;mt(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(Ca.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),mt(this.props.onToggle,i)))}close(t,r=!0){var n,s;const i=this.identifyNull(t);i&&this.isOpen(i)&&(this.dispatch(Ca.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),mt(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=wa(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),pd(()=>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(M_())}onItemsRendered(t){this.visibleStartIndex=t.visibleStartIndex,this.visibleStopIndex=t.visibleStopIndex}get renderContainer(){return this.props.renderContainer||Pf}get renderRow(){return this.props.renderRow||N_}get renderNode(){return this.props.children||k_}get renderDragPreview(){return this.props.renderDragPreview||bd}get renderCursor(){return this.props.renderCursor||T_}}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 i1=typeof Symbol=="function"&&Symbol.observable||"@@observable",$f=i1,Ra=()=>Math.random().toString(36).substring(7).split("").join("."),o1={INIT:`@@redux/INIT${Ra()}`,REPLACE:`@@redux/REPLACE${Ra()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Ra()}`},Xr=o1;function jf(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 a1(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(u1(e))return"date";if(c1(e))return"error";const r=l1(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 l1(e){return typeof e.constructor=="function"?e.constructor.name:null}function c1(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function u1(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=a1(e)),t}function Bf(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: '${Nr(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: '${Nr(r)}'`);return r(Bf)(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"?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 s}function f(v){if(typeof v!="function")throw new Error(process.env.NODE_ENV==="production"?bt(4):`Expected the listener to be a function. Instead, received: '${Nr(v)}'`);if(c)throw new Error(process.env.NODE_ENV==="production"?bt(5):"You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api/store#subscribelistener for more details.");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"?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.");m=!1,d(),o.delete(b),i=null}}}function g(v){if(!jf(v))throw new Error(process.env.NODE_ENV==="production"?bt(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"?bt(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"?bt(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"?bt(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"?bt(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"?bt(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)}},[$f](){return this}}}return g({type:Xr.INIT}),{dispatch:g,subscribe:f,getState:u,replaceReducer:y,[$f]:_}}function Uf(e){typeof console<"u"&&typeof console.error=="function"&&console.error(e);try{throw new Error(e)}catch{}}function d1(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(!jf(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 f1(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 Vf(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"&&Uf(`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{f1(r)}catch(o){i=o}return function(a={},c){if(i)throw i;if(process.env.NODE_ENV!=="production"){const f=d1(a,r,c,s);f&&Uf(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"?bt(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 h1(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 p1=Vf({nodes:Vf({focus:L_,edit:P_,open:F_,selection:$_,drag:h1}),dnd:j_}),g1=Tn();function y1({treeProps:e,imperativeHandle:t,children:r}){const n=h.useRef(null),s=h.useRef(null),i=h.useRef(Bf(p1,Tn(e))),o=m_.useSyncExternalStore(i.current.subscribe,i.current.getState,()=>g1),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(Ca.clear(!0))},[a.props.searchTerm]),l.jsx(td.Provider,{value:a,children:l.jsx(sd.Provider,{value:c.current,children:l.jsx(rd.Provider,{value:o.nodes,children:l.jsx(nd.Provider,{value:o.dnd,children:l.jsx(KS,Object.assign({},e.dndManager?{manager:e.dndManager}:{backend:e.dndBackend||K0,options:{rootElement:a.props.dndRootElement||void 0}},{children:r}))})})})})}function v1(){const e=Nt(),[,t]=gf(()=>({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}=kf({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 m1(e){return v1(),e.children}function b1(){const t=Nt().props.renderContainer||Pf;return l.jsx(l.Fragment,{children:l.jsx(t,{})})}function _1(){const e=Nt(),{offset:t,mouse:r,item:n,isDragging:s}=m0(o=>({offset:o.getSourceClientOffset(),mouse:o.getClientOffset(),item:o.getItem(),isDragging:o.isDragging()})),i=e.props.renderDragPreview||bd;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 w1(e={}){var t,r;const n=(t=e.idAccessor)!==null&&t!==void 0?t:"id",s=(r=e.childrenAccessor)!==null&&r!==void 0?r:"children";return{getId:typeof n=="function"?n:i=>i[n],getChildren:typeof s=="function"?s:i=>i[s],childrenKey:typeof s=="string"?s:"children"}}class S1{constructor(t,r={}){this.accessors=w1(r),this.root=C1(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 C1(e,t){const r=new qf({},null,t,"ROOT");return r.children=e.map(n=>Xa(n,r,t)),r}function Xa(e,t,r){const n=new qf(e,t,r),s=r.getChildren(e);return s&&(n.children=s.map(i=>Xa(i,n,r))),n}class qf{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=Xa(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 E1=0;function O1(e,t={}){const[r,n]=h.useState(e),s=t.idAccessor,i=t.childrenAccessor,o=h.useMemo(()=>new S1(r,{idAccessor:s,childrenAccessor:i}),[r,s,i]),a=_=>{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-${E1++}`,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 I1(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]=O1(e.initialData,{idAccessor:e.idAccessor,childrenAccessor:e.childrenAccessor});return Object.assign(Object.assign(Object.assign({},e),r),{data:t})}else return e}function D1(e,t){const r=I1(e);return l.jsxs(y1,{treeProps:r,imperativeHandle:t,children:[l.jsx(m1,{children:l.jsx(b1,{})}),l.jsx(_1,{})]})}const T1=h.forwardRef(D1);function Za(){return De(e=>{var n;const t=e.treeData[0];return(((n=t==null?void 0:t.metadata)==null?void 0:n.status)??(t==null?void 0:t.status)??"Draft").toLowerCase()==="draft"})}function N1(){return De(e=>{var s;if(!e.selectedNodeId)return!1;const t=(s=e.treeData[0])==null?void 0:s.id,r=i=>{var o;for(const a of i){if(a.id===e.selectedNodeId)return a;if((o=a.children)!=null&&o.length){const c=r(a.children);if(c)return c}}},n=r(e.treeData);return!!(n!=null&&n.isFolder)&&n.id!==t})}const zf={video:"#EA580C",pdf:"#DC2626",h5p:"#0D9488",scorm:"#7C3AED",audio:"#DB2777",quiz:"#16A34A",default:"#6B7280"},Hf={video:"Video",pdf:"FileText",h5p:"Layers",scorm:"Package",audio:"Music",quiz:"HelpCircle",default:"File"},Wf=["Course Assessment","eTextbook","Exam Question","Explanation Content","Learning Resource","Practice Question Set","SCORM Content","Teacher Resource"],k1=[{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 x1(e){const t=[e.mimeType??"",e.primaryCategory??"",e.contentType??""].join(" ").toLowerCase();return t.includes("video")?"video":t.includes("pdf")||t.includes("epub")?"pdf":t.includes("h5p")?"h5p":t.includes("scorm")?"scorm":t.includes("audio")||t.includes("mp3")?"audio":t.includes("quiz")||t.includes("question")||t.includes("ecml")?"quiz":"default"}function Yi(e){const t=x1(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:Hf[t]??Hf.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"},A1={video:Ro,pdf:Ho,h5p:Wo,scorm:Ko,audio:Qo,quiz:qo,default:_n},P1=({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=Za(),y=Yi(e.data),_=A1[y.key]??_n,p=e.isSelected,v=e.level===0,m=e.data.isFolder??(e.children&&e.children.length>0),b=v?_v:m?Ov:_;h.useEffect(()=>{if(!s)return;const E=T=>{var x;(x=u.current)!=null&&x.contains(T.target)||i(!1)};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[s]);const S=h.useCallback(()=>{c.trim()&&e.submit(c.trim()),a(!1)},[c,e]),w=h.useCallback(E=>{E.key==="Enter"&&S(),E.key==="Escape"&&(d(e.data.name),a(!1))},[S,e.data.name]);return l.jsxs("div",{className:[kt.row,p?kt.selected:"",e.state.isOver&&m?kt.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:kt.grip,"aria-hidden":"true",children:l.jsx(Wc,{size:14})}),l.jsx("button",{className:kt.toggle,onClick:E=>{E.stopPropagation(),e.toggle()},"aria-label":e.isClosed?"Expand":"Collapse",style:{visibility:m?"visible":"hidden"},children:e.isClosed?l.jsx(Vc,{size:14}):l.jsx(hs,{size:14})}),l.jsx("span",{className:`${kt.ctIcon} ${v||m?kt.folderIcon:y.bgClass}`,"aria-hidden":"true",children:l.jsx(b,{size:12})}),o?l.jsx("input",{className:kt.renameInput,value:c,autoFocus:!0,onChange:E=>d(E.target.value),onBlur:S,onKeyDown:w,onClick:E=>E.stopPropagation()}):l.jsx("span",{className:kt.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:kt.dropHere,"aria-hidden":"true",children:"Drop here"}),f&&l.jsxs("div",{className:kt.menuWrap,ref:u,children:[l.jsx("button",{className:kt.menuBtn,onClick:E=>{E.stopPropagation(),i(T=>!T)},"aria-label":"Node options",children:l.jsx(zc,{size:14})}),s&&l.jsxs("div",{className:kt.menu,role:"menu",children:[l.jsxs("button",{role:"menuitem",onClick:()=>{a(!0),i(!1)},children:[l.jsx(xv,{size:13})," Rename"]}),m&&g&&l.jsxs("button",{role:"menuitem",onClick:()=>{e.tree.create({parentId:e.id}),i(!1)},children:[l.jsx(Hc,{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:kt.dangerItem,onClick:()=>{e.tree.delete(e.id),i(!1)},children:[l.jsx(Yo,{size:13})," Delete"]})]})]})]})};async function M1(e,t){var i,o;const n=((i=(await ke.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 L1(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 F1(e,t){var a;const r=await M1(e,t.name),n=await L1(r,t),s=new FormData;return s.append("fileUrl",n),s.append("mimeType",t.type||"text/csv"),{processId:(((a=(await ke.post(`/action/collection/v1/import/${e}`,s)).data)==null?void 0:a.result)??{}).processId??""}}async function $1(e){var r;return((r=(await ke.get(`/action/collection/v1/import/status/${e}`)).data)==null?void 0:r.result)??{status:"PENDING"}}async function Qf(e){var n,s,i;const r=(i=(s=(n=(await ke.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 j1(e){return Qf(e)}const Pe={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"},B1=({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 P=N.dataTransfer.files[0];P&&w(P)},[w]),T=h.useCallback(N=>{var U;const P=(U=N.target.files)==null?void 0:U[0];P&&w(P),N.target.value=""},[w]),x=h.useCallback(async()=>{try{const N=await j1(e),P=document.createElement("a");P.href=N,P.download="sample_hierarchy.csv",P.target="_blank",P.click()}catch{f("Failed to download sample CSV.")}},[e]),A=h.useCallback(async()=>{if(s){d("uploading"),f(""),y([]);try{const{processId:N}=await F1(e,s);if(!N){d("done"),p(null),setTimeout(t,1500);return}d("processing"),m.current=setInterval(async()=>{try{const P=await $1(N);P.status==="COMPLETED"?(b(),d("done"),p(P.successCount??null),P.failedRecords&&P.failedRecords.length>0?y(P.failedRecords):setTimeout(t,1500)):P.status==="FAILED"&&(b(),d("error"),f("Upload processing failed. Please check the error rows below."),P.failedRecords&&y(P.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:Pe.container,children:[l.jsxs("div",{className:Pe.header,children:[l.jsx("h2",{className:Pe.title,children:n==="update"?"Update Folder Metadata via CSV":"Create Folders via CSV"}),l.jsx("button",{className:Pe.closeBtn,onClick:r,"aria-label":"Close",children:"✕"})]}),l.jsxs("div",{className:Pe.body,children:[l.jsxs("div",{className:`${Pe.dropZone} ${o?Pe.dragOver:""} ${s?Pe.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 P;return N.key==="Enter"&&((P=v.current)==null?void 0:P.click())},children:[l.jsx("input",{ref:v,type:"file",accept:".csv",className:Pe.hiddenInput,onChange:T,"aria-hidden":"true"}),s?l.jsxs("div",{className:Pe.fileInfo,children:[l.jsx("span",{className:Pe.fileIcon,children:"📄"}),l.jsx("span",{className:Pe.fileName,children:s.name}),l.jsxs("span",{className:Pe.fileSize,children:["(",(s.size/1024).toFixed(1)," KB)"]})]}):l.jsxs("div",{className:Pe.dropHint,children:[l.jsx("span",{className:Pe.dropIcon,children:"⬆️"}),l.jsx("p",{className:Pe.dropText,children:"Drag & drop your CSV here"}),l.jsx("p",{className:Pe.dropSubtext,children:"or click to browse"})]})]}),l.jsx("button",{className:Pe.sampleLink,onClick:x,type:"button",children:"Download Sample CSV"}),c!=="idle"&&l.jsxs("div",{className:`${Pe.statusBar} ${Pe[`status_${c}`]}`,role:"status","aria-live":"polite",children:[c==="processing"&&l.jsx("span",{className:Pe.spinner,"aria-hidden":"true"}),$[c],c==="done"&&_!==null&&l.jsxs("span",{className:Pe.successDetail,children:[" — ",_," item(s) imported"]})]}),u&&l.jsx("p",{className:Pe.errorMsg,role:"alert",children:u}),g.length>0&&l.jsxs("div",{className:Pe.failedSection,children:[l.jsxs("h4",{className:Pe.failedTitle,children:["Failed Rows (",g.length,")"]}),l.jsx("div",{className:Pe.tableWrap,children:l.jsxs("table",{className:Pe.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,P)=>l.jsxs("tr",{children:[l.jsx("td",{children:N.rowNumber??P+1}),l.jsx("td",{children:N.name??"—"}),l.jsx("td",{className:Pe.reasonCell,children:N.reason??"Unknown error"})]},P))})]})})]})]}),l.jsxs("div",{className:Pe.footer,children:[l.jsx(Le,{variant:"ghost",onClick:r,disabled:c==="uploading"||c==="processing",children:"Cancel"}),l.jsx(Le,{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"},U1=({editorMode:e,collapsed:t=!1,onToggleCollapse:r})=>{var ve;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}=De(),T=e==="edit",x=Za(),A=T&&x,$=(((ve=_[0])==null?void 0:ve.children)??[]).some(z=>z.isFolder),N=ie(z=>{var J,se,V,R;return((se=(J=z.editorConfig)==null?void 0:J.context)==null?void 0:se.contentId)??((R=(V=z.editorConfig)==null?void 0:V.context)==null?void 0:R.identifier)??""}),P=ie(z=>{var se,V;const J=(V=(se=z.categoryMeta)==null?void 0:se.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 se;(se=i.current)!=null&&se.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]),M=h.useCallback(({parentId:z,index:J,dragIds:se})=>{if(!z)return;const V=se[0],R=Ja(_,V);if(!R)return;const G=R.parent;if(G===z){const ae=Ja(_,z);if(!(ae!=null&&ae.children))return;const Oe=ae.children.findIndex($e=>$e.id===V);if(Oe<0)return;S(z,Oe,J>Oe?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 se=m(J,"unit");return se?{id:se}:(Ie.error("Maximum depth reached"),{id:crypto.randomUUID()})},[m,_]),Z=h.useCallback(()=>{var J;const z=(J=_[0])==null?void 0:J.id;z&&(m(z,"unit")||Ie.error("Maximum depth reached"))},[_,m]),te=h.useCallback(()=>{p&&(m(p,"subunit")||Ie.error("Maximum depth reached"))},[p,m]),_e=h.useCallback(async()=>{if(d(!1),!!N)try{const z=await Qf(N),J=await fetch(z).then(R=>R.blob()),se=URL.createObjectURL(J),V=document.createElement("a");V.href=se,V.download=`${N}-folders.csv`,V.style.display="none",document.body.appendChild(V),V.click(),document.body.removeChild(V),URL.revokeObjectURL(se)}catch{Ie.error("Failed to download CSV")}},[N]),we=h.useCallback(async()=>{if(f(!1),!!N)try{const{rootNode:z}=await Ju(N);E([z]),Ie.success("Course outline refreshed.")}catch{Ie.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:[T&&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(zc,{size:15})}),c&&l.jsx("div",{className:sr.dropdownMenu,role:"menu",children:P&&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:_e,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(Nv,{size:15}):l.jsx(Tv,{size:15})})]})}),l.jsx("div",{className:sr.treeWrapper,ref:s,children:l.jsx(T1,{ref:n,data:_,idAccessor:"id",childrenAccessor:"children",onSelect:U,onMove:T?M:void 0,onDelete:T?L:void 0,onCreate:T?j:void 0,disableEdit:!T,disableDrop:!T,selection:p??void 0,rowHeight:40,indent:20,paddingBottom:16,height:o,width:"100%",children:z=>l.jsx(P1,{...z,editorMode:e})})}),T&&l.jsxs("div",{className:sr.footer,children:[l.jsxs(Le,{variant:"ghost",size:"sm",onClick:Z,disabled:!A,children:[l.jsx(ps,{size:14})," Add Unit"]}),l.jsxs(Le,{variant:"ghost",size:"sm",onClick:te,disabled:!A||!p,children:[l.jsx(Hc,{size:14})," Add Sub-unit"]})]}),u&&l.jsx("div",{className:sr.csvModal,children:l.jsx(B1,{contentId:N,mode:g,onComplete:we,onClose:()=>f(!1)})})]})};function Ja(e,t){for(const r of e){if(r.id===t)return r;if(r.children){const n=Ja(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"},V1=({crumbs:e})=>{const t=De(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(Iv,{size:13})}),e.map((r,n)=>l.jsxs(h.Fragment,{children:[l.jsx(Vc,{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"},Kf=[{id:"details",label:"Details"},{id:"audience",label:"Audience & Curriculum"},{id:"licensing",label:"Licensing"}],q1=({activeTab:e,onChange:t,errorTabs:r=[],visibleTabs:n})=>{const s=n?Kf.filter(i=>n.includes(i.id)):Kf;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,ft=e=>e==null;const Gf=e=>typeof e=="object";var We=e=>!ft(e)&&!Array.isArray(e)&&Gf(e)&&!Zr(e),el=e=>We(e)&&e.target?Ns(e.target)?e.target.checked:e.target.value:e,Yf=(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 We(t)&&t.hasOwnProperty("isPrototypeOf")},Ri=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Ye(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(Ri&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!r&&!(We(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]=Ye(e[s]));return n}const kr={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change",SUBMIT:"submit",TRIGGER:"trigger",VALID:"valid"},Rt={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"},tl="form",Xf="root",Zf=["__proto__","constructor","prototype"];var ks=e=>/^\w*$/.test(e),Ue=e=>e===void 0,Xi=e=>e.split(/[.[\]'"]/g).filter(Boolean),K=(e,t,r)=>{if(!t||!We(e))return r;const n=ks(t)?[t]:Xi(t);if(n.some(i=>Zf.includes(i)))return r;const s=n.reduce((i,o)=>ft(i)?void 0:i[o],e);return Ue(s)||s===e?Ue(e[t])?r:e[t]:s},Lt=e=>typeof e=="boolean",_t=e=>typeof e=="function",Be=(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=We(d)||Array.isArray(d)?d:isNaN(+s[n+1])?{}:[]}if(Zf.includes(a))return;e[a]=c,e=e[a]}};const rl=h.createContext(null);rl.displayName="HookFormControlContext";const nl=()=>h.useContext(rl);var Jf=(e,t,r,n=!0)=>{const s={};for(const i in e)Object.defineProperty(s,i,{get:()=>{const o=i;return t._proxyFormState[o]!==Rt.all&&(t._proxyFormState[o]=!n||Rt.all),r&&(r[o]=!0),e[o]}});return s};const sl=Ri?h.useLayoutEffect:h.useEffect;function z1(e){const t=nl(),{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 sl(()=>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(()=>Jf(o,r,c.current,!1),[o,r])}var wt=e=>typeof e=="string",il=(e,t,r,n,s)=>wt(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),ol=e=>ft(e)||!Gf(e);const eh=(e,t)=>t.length===0&&!Array.isArray(e)&&!Rf(e);function Ft(e,t,r=new WeakMap){if(e===t)return!0;if(ol(e)||ol(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(eh(e,n)||eh(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)||(We(a)||Array.isArray(a))&&(We(c)||Array.isArray(c))?!Ft(a,c,r):!Object.is(a,c))return!1}}return!0}function H1(e){const t=nl(),{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=il(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=il(n,r._names,w||r._formValues,!1,c.current);if(d.current){const T=d.current(E);Ft(T,u.current)||(_(T),u.current=T)}else _(E)}},[r._formValues,r._names,i,n]);sl(()=>((f.current!==r||!Ft(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&&!Ft(b,n);return m||w?p():null},[i,m,n,b,p]);return S!==null?S:y}function Zi(e){const t=nl(),{name:r,disabled:n,control:s=t,shouldUnregister:i,defaultValue:o,exact:a=!0}=e,c=Yf(s._names.array,r),d=h.useMemo(()=>K(s._formValues,r,K(s._defaultValues,r,o)),[s,r,o]),u=H1({control:s,name:r,defaultValue:d,exact:a}),f=z1({control:s,name:r,exact:a}),g=h.useRef(e),y=h.useRef(null),_=h.useRef(s.register(r,{...e.rules,value:u,...Lt(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=el(w);return K(s._fields,r)||(_.current=s.register(r,{...g.current.rules,value:E})),_.current.onChange({target:{value:el(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:()=>_t(w.focus)&&w.focus(),select:()=>_t(w.select)&&w.select(),setCustomValidity:T=>_t(w.setCustomValidity)&&w.setCustomValidity(T),reportValidity:()=>_t(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,...Lt(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,...Lt(g.current.disabled)?{disabled:g.current.disabled}:{}});const E=(T,x)=>{const A=K(s._fields,T);A&&A._f&&(A._f.mount=x)};if(E(r,!0),w){const T=Ye(K(i?s._defaultValues:s._options.values||s._defaultValues,r,K(s._options.defaultValues,r,g.current.defaultValue)));Be(s._defaultValues,r,T),Ue(K(s._formValues,r))&&Be(s._formValues,r,T)}if(!c&&s.register(r),y.current){const T=K(s._fields,r);T&&T._f&&(T._f.ref=y.current)}return()=>{(c?w&&!s._state.action:w)?s.unregister(r):E(r,!1)}},[r,s,c,i]),h.useEffect(()=>{s._setDisabledField({disabled:n,name:r})},[n,r,s]),h.useMemo(()=>({field:S,formState:f,fieldState:p}),[S,f,p])}const al=h.createContext(null);al.displayName="HookFormContext";const Zt=()=>h.useContext(al),W1=({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(al.Provider,{value:b},h.createElement(rl.Provider,{value:b.control},e))};var Q1=(e,t,r,n,s)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:s||!0}}:{},th=e=>Array.isArray(e)?e.filter(Boolean):[],Ji=e=>Array.isArray(e)?e:[e],rh=()=>{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 nh(e,t){const r={};for(const n in e)if(e.hasOwnProperty(n)){const s=e[n],i=t[n];if(s&&We(s)&&i){const o=nh(s,i);We(o)&&(r[n]=o)}else e[n]&&(r[n]=i)}return r}var st=e=>We(e)&&!Object.keys(e).length,ll=e=>e.type==="file",eo=e=>{if(!Ri)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},sh=e=>e.type==="select-multiple",cl=e=>e.type==="radio",K1=e=>cl(e)||Ns(e),ul=e=>eo(e)&&e.isConnected;function G1(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 Y1(e){for(const t in e)if(e.hasOwnProperty(t)&&!Ue(e[t]))return!1;return!0}function Je(e,t){if(wt(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:G1(e,r),s=r.length-1,i=r[s];return n&&delete n[i],s!==0&&(We(n)&&st(n)||Array.isArray(n)&&Y1(n))&&Je(e,r.slice(0,-1)),e}var R1=e=>{for(const t in e)if(_t(e[t]))return!0;return!1};function ih(e){return Array.isArray(e)||We(e)&&!R1(e)}function dl(e,t={}){for(const r in e){const n=e[r];ih(n)?(t[r]=Array.isArray(n)?[]:{},dl(n,t[r])):Ue(n)||(t[r]=!0)}return t}function fl(e){if(e!==!1){if(e===!0)return!0;if(Array.isArray(e)){const t=e.map(r=>fl(r));return t.some(r=>r!==void 0)?t:void 0}if(We(e)){const t={};for(const r in e){const n=fl(e[r]);Ue(n)||(t[r]=n)}return Object.keys(t).length?t:void 0}}}function Jr(e,t,r){r||(r=dl(t));for(const n in e){const s=e[n];if(ih(s))Ue(t)||ol(r[n])?r[n]=dl(s,Array.isArray(s)?[]:{}):Jr(s,ft(t)?{}:t[n],r[n]);else{const i=t[n];r[n]=!Ft(s,i)}}return fl(r)||{}}const oh={value:!1,isValid:!1},ah={value:!0,isValid:!0};var lh=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Ue(e[0].attributes.value)?Ue(e[0].value)||e[0].value===""?ah:{value:e[0].value,isValid:!0}:ah:oh}return oh},ch=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>Ue(e)?e:t?e===""?NaN:e&&+e:r&&wt(e)?new Date(e):n?n(e):e;const uh={isValid:!1,value:null};var dh=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,uh):uh;function fh(e){const t=e.ref;return ll(t)?t.files:cl(t)?dh(e.refs).value:sh(t)?[...t.selectedOptions].map(({value:r})=>r):Ns(t)?lh(e.refs).value:ch(Ue(t.value)?e.ref.value:t.value,e)}var X1=(e,t,r,n)=>{const s={};for(const i of e){const o=K(t,i);o&&Be(s,i,o._f)}return{criteriaMode:r,names:[...e],fields:s,shouldUseNativeValidation:n}},to=e=>e instanceof RegExp,xs=e=>Ue(e)?e:to(e)?e.source:We(e)?to(e.value)?e.value.source:e.value:e,hh=e=>({isOnSubmit:!e||e===Rt.onSubmit,isOnBlur:e===Rt.onBlur,isOnChange:e===Rt.onChange,isOnAll:e===Rt.all,isOnTouch:e===Rt.onTouched});const ph="AsyncFunction";var Z1=e=>!!e&&!!e.validate&&!!(_t(e.validate)&&e.validate.constructor.name===ph||We(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===ph)),J1=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),hl=(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(We(a)&&As(a,t))break}}};function gh(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 eE=(e,t,r,n)=>{r(e);const{name:s,...i}=e;return st(i)||n&&Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find(o=>t[o]===(!n||Rt.all))},tE=(e,t,r)=>!e||!t||e===t||Ji(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n))),rE=(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,nE=(e,t)=>!th(K(e,t)).length&&Je(e,t),yh=(e,t,r)=>{const n=K(e,r),s=Array.isArray(n)?n:[];return Be(s,Xf,t[r]),Be(e,r,s),e};function vh(e,t,r="validate"){if(wt(e)||Array.isArray(e)&&e.every(wt)||Lt(e)&&!e)return{type:r,message:wt(e)?e:"",ref:t}}var Fn=e=>We(e)&&!to(e)?e:{value:e,message:""},mh=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 M=Lt(U)?"":U||"";a?a.forEach(L=>L.setCustomValidity(M)):S.setCustomValidity(M),S.reportValidity()}},E={},T=cl(o),x=Ns(o),A=T||x,$=(v||ll(o))&&Ue(o.value)&&Ue(b)||eo(o)&&o.value===""||b===""||Array.isArray(b)&&!b.length,N=Q1.bind(null,p,n,E),P=(U,M,L,j=Xt.maxLength,Z=Xt.minLength)=>{const te=U?M:L;E[p]={type:U?j:Z,message:te,ref:o,...N(U?j:Z,te)}};if(i?!Array.isArray(b)||!b.length:c&&(!A&&($||ft(b))||Lt(b)&&!b||x&&!lh(a).isValid||T&&!dh(a).isValid)){const{value:U,message:M}=wt(c)?{value:!!c,message:c}:Fn(c);if(U&&(E[p]={type:Xt.required,message:M,ref:S,...N(Xt.required,M)},!n))return w(M),E}if(!$&&(!ft(f)||!ft(g))){let U,M;const L=Fn(g),j=Fn(f);if(!ft(b)&&!isNaN(b)){const Z=o.valueAsNumber||b&&+b;ft(L.value)||(U=Z>L.value),ft(j.value)||(M=Z<j.value)}else{const Z=o.valueAsDate||new Date(b),te=ve=>new Date(new Date().toDateString()+" "+ve),_e=o.type=="time",we=o.type=="week";wt(L.value)&&b&&(U=_e?te(b)>te(L.value):we?b>L.value:Z>new Date(L.value)),wt(j.value)&&b&&(M=_e?te(b)<te(j.value):we?b<j.value:Z<new Date(j.value))}if((U||M)&&(P(!!U,L.message,j.message,Xt.max,Xt.min),!n))return w(E[p].message),E}if((d||u)&&!$&&(wt(b)||i&&Array.isArray(b))){const U=Fn(d),M=Fn(u),L=!ft(U.value)&&b.length>+U.value,j=!ft(M.value)&&b.length<+M.value;if((L||j)&&(P(L,U.message,M.message),!n))return w(E[p].message),E}if(y&&!$&&wt(b)){const{value:U,message:M}=Fn(y);if(to(U)&&!b.match(U)&&(E[p]={type:Xt.pattern,message:M,ref:o,...N(Xt.pattern,M)},!n))return w(M),E}if(_){if(_t(_)){const U=await _(b,r),M=vh(U,S);if(M&&(E[p]={...M,...N(Xt.validate,M.message)},!n))return w(M.message),E}else if(We(_)){let U={};for(const M in _){if(!st(U)&&!n)break;const L=vh(await _[M](b,r),S,M);L&&(U={...L,...N(M,L.message)},w(L.message),n&&(E[p]=U))}if(!st(U)&&(E[p]={ref:S,...U},!n))return E}}return w(!0),E};const sE={mode:Rt.onSubmit,reValidateMode:Rt.onChange,shouldFocusError:!0},bh={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function iE(e={}){let t={...sE,...e},r={...Ye(bh),isLoading:_t(t.defaultValues),errors:t.errors||{},disabled:t.disabled||!1},n={},s=We(t.defaultValues)||We(t.values)?Ye(t.defaultValues||t.values)||{}:{},i=t.shouldUnregister?{}:Ye(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:rh(),state:rh()},_=t.criteriaMode===Rt.all,p=C=>D=>{clearTimeout(d),d=setTimeout(C,D)},v=async C=>{if(!o.keepIsValid&&!t.disabled&&(f.isValid||g.isValid||C)){let D;t.resolver?(D=st((await N()).errors),m()):D=await M({fields:n,onlyCheckValid:!0,eventType:kr.VALID}),D!==r.isValid&&y.state.next({isValid:D})}},m=(C,D)=>{!t.disabled&&(f.isValidating||f.validatingFields||g.isValidating||g.validatingFields)&&((C||Array.from(a.mount)).forEach(k=>{k&&(D?Be(r.validatingFields,k,D):Je(r.validatingFields,k))}),y.state.next({validatingFields:r.validatingFields,isValidating:!st(r.validatingFields)}))},b=()=>{r.dirtyFields=Jr(s,i)},S=(C,D=[],k,B,q=!0,Q=!0)=>{if(B&&k&&!t.disabled){if(o.action=!0,Q&&Array.isArray(K(n,C))){const W=k(K(n,C),B.argA,B.argB);q&&Be(n,C,W)}if(Q&&Array.isArray(K(r.errors,C))){const W=k(K(r.errors,C),B.argA,B.argB);q&&Be(r.errors,C,W),nE(r.errors,C)}if((f.touchedFields||g.touchedFields)&&Q&&Array.isArray(K(r.touchedFields,C))){const W=k(K(r.touchedFields,C),B.argA,B.argB);q&&Be(r.touchedFields,C,W)}(f.dirtyFields||g.dirtyFields)&&b(),y.state.next({name:C,isDirty:j(C,D),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else Be(i,C,D)},w=(C,D)=>{Be(r.errors,C,D),r.errors={...r.errors},y.state.next({errors:r.errors})},E=C=>{r.errors=C,y.state.next({errors:r.errors,isValid:!1})},T=C=>{const D=ks(C)?[C]:Xi(C);let k=i,B=s;for(let q=0;q<D.length-1;q++){const Q=D[q];if(k=ft(k)?k:k[Q],B=ft(B)?B:B[Q],k===null&&B!==null)return!0}return!1},x=(C,D,k,B)=>{const q=K(n,C);if(q){if(T(C))return;const Q=Ue(K(i,C)),W=K(i,C,Ue(k)?K(s,C):k);Ue(W)||B&&B.defaultChecked||D?Be(i,C,D?W:fh(q._f)):_e(C,W),o.mount&&!o.action&&(v(),Q&&r.isDirty&&(f.isDirty||g.isDirty)&&(j()||(r.isDirty=!1,y.state.next({...r}))),e.shouldUnregister&&Q&&!Ue(K(i,C))&&hl(C,a)&&(o.watch=!0))}},A=(C,D,k,B,q)=>{let Q=!1,W=!1;const re={name:C};if(!t.disabled){if(!k||B){(f.isDirty||g.isDirty)&&(W=r.isDirty,r.isDirty=re.isDirty=j(),Q=W!==re.isDirty);const ye=Ft(K(s,C),D);W=!!K(r.dirtyFields,C),ye!==r.isDirty?r.dirtyFields=Jr(s,i):ye?Je(r.dirtyFields,C):Be(r.dirtyFields,C,!0),re.dirtyFields=r.dirtyFields,Q=Q||(f.dirtyFields||g.dirtyFields)&&W!==!ye}if(k){const ye=K(r.touchedFields,C);ye||(Be(r.touchedFields,C,k),re.touchedFields=r.touchedFields,Q=Q||(f.touchedFields||g.touchedFields)&&ye!==k)}Q&&q&&y.state.next(re)}return Q?re:{}},$=(C,D,k,B)=>{const q=K(r.errors,C),Q=(f.isValid||g.isValid)&&Lt(D)&&r.isValid!==D;if(t.delayError&&k?(c=p(()=>w(C,k)),c(t.delayError)):(clearTimeout(d),c=null,k?Be(r.errors,C,k):Je(r.errors,C),r.errors={...r.errors}),(k?!Ft(q,k):q)||!st(B)||Q){const W={...B,...Q&&Lt(D)?{isValid:D}:{},errors:r.errors,name:C};r={...r,...W},y.state.next(W)}},N=async C=>(m(C,!0),await t.resolver(i,t.context,X1(C||a.mount,n,t.criteriaMode,t.shouldUseNativeValidation))),P=async C=>{const{errors:D}=await N(C);if(m(C),C){for(const k of C){const B=K(D,k);B?a.array.has(k)&&We(B)&&!Object.keys(B).some(q=>!Number.isNaN(Number(q)))?yh(r.errors,{[k]:B},k):Be(r.errors,k,B):Je(r.errors,k)}r.errors={...r.errors}}else r.errors=D;return D},U=async({name:C,eventType:D})=>{if(e.validate){const k=await e.validate({formValues:i,formState:r,name:C,eventType:D});if(We(k))for(const B in k){const q=k[B];q&&$e(`${tl}.${B}`,{message:wt(q.message)?q.message:"",type:q.type||Xt.validate})}else wt(k)||!k?$e(tl,{message:k||"",type:Xt.validate}):Oe(tl);return k}return!0},M=async({fields:C,onlyCheckValid:D,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,D)))return q.valid;for(const Q in C){const W=C[Q];if(W){const{_f:re,...ye}=W;if(re){const Ge=a.array.has(re.name),At=W._f&&Z1(W._f),Pt=f.validatingFields||f.isValidating||g.validatingFields||g.isValidating;At&&Pt&&m([re.name],!0);const br=await mh(W,a.disabled,i,_,t.shouldUseNativeValidation&&!D,Ge);if(At&&Pt&&m([re.name]),br[re.name]&&(q.valid=!1,D)||(!D&&(K(br,re.name)?Ge?yh(r.errors,br,re.name):Be(r.errors,re.name,br[re.name]):Je(r.errors,re.name)),e.shouldUseNativeValidation&&br[re.name]))break}!st(ye)&&await M({context:q,onlyCheckValid:D,fields:ye,name:Q,eventType:B})}}return q.valid},L=()=>{for(const C of a.unMount){const D=K(n,C);D&&(D._f.refs?D._f.refs.every(k=>!ul(k)):!ul(D._f.ref))&&je(C)}a.unMount=new Set},j=(C,D)=>!t.disabled&&(C&&D&&Be(i,C,D),!Ft(G(),s)),Z=(C,D,k)=>il(C,a,{...o.mount?i:Ue(D)?s:wt(C)?{[C]:D}:D},k,D),te=C=>th(K(o.mount?i:s,C,t.shouldUnregister?K(s,C,[]):[])),_e=(C,D,k={},B=!1)=>{const q=K(n,C);let Q=D;if(q){const W=q._f;W&&(!W.disabled&&Be(i,C,ch(D,W)),Q=eo(W.ref)&&ft(D)?"":D,sh(W.ref)?[...W.ref.options].forEach(re=>re.selected=Q.includes(re.value)):W.refs?Ns(W.ref)?W.refs.forEach(re=>{(!re.defaultChecked||!re.disabled)&&(Array.isArray(Q)?re.checked=!!Q.find(ye=>ye===re.value):re.checked=Q===re.value||!!Q)}):W.refs.forEach(re=>re.checked=re.value===Q):ll(W.ref)?W.ref.value="":(W.ref.value=Q,W.ref.type||y.state.next({name:C,values:B?i:Ye(i)})))}(k.shouldDirty||k.shouldTouch)&&A(C,Q,k.shouldTouch,k.shouldDirty,!0),k.shouldValidate&&R(C)},we=(C,D,k,B=!1)=>{for(const q in D){if(!D.hasOwnProperty(q))return;const Q=D[q],W=C+"."+q,re=K(n,W);(a.array.has(C)||We(Q)||re&&!re._f)&&!Zr(Q)?we(W,Q,k,B):_e(W,Q,k,B)}},ve=(C,D,k,B)=>{const q=K(n,C),Q=a.array.has(C),W=B?D:Ye(D),re=K(i,C),ye=Ft(re,W);if(ye||Be(i,C,W),Q)y.array.next({name:C,values:B?i:Ye(i)}),(f.isDirty||f.dirtyFields||g.isDirty||g.dirtyFields)&&k.shouldDirty&&(b(),y.state.next({name:C,dirtyFields:r.dirtyFields,isDirty:j(C,W)}));else{const Ge=Array.isArray(W)&&!W.length||st(W);!q||q._f||ft(W)||Ge?_e(C,W,k,B):we(C,W,k,B)}if(!ye){const Ge=hl(C,a),At=B?i:Ye(i);y.state.next({...Ge&&r,name:o.mount||Ge?C:void 0,values:At})}},z=(C,D,k={})=>ve(C,D,k,!1),J=(C,D={})=>{const k=_t(C)?C(i):C;if(!Ft(i,k)){i={...i,...k};for(const B of a.mount)ve(B,K(k,B),D,!0);y.state.next({...r,name:void 0,type:void 0,values:i}),D.shouldValidate&&v()}},se=async C=>{o.mount=!0;const D=C.target;let k=D.name,B=!0;const q=K(n,k),Q=ye=>{B=Number.isNaN(ye)||Zr(ye)&&isNaN(ye.getTime())||Ft(ye,K(i,k,ye))},W=hh(t.mode),re=hh(t.reValidateMode);if(q){let ye,Ge;const At=D.type?fh(q._f):el(C),Pt=C.type===kr.BLUR||C.type===kr.FOCUS_OUT,br=!J1(q._f)&&!e.validate&&!t.resolver&&!K(r.errors,k)&&!q._f.deps||rE(Pt,K(r.touchedFields,k),r.isSubmitted,re,W),zs=hl(k,a,Pt);Be(i,k,At),Pt?(!D||!D.readOnly)&&(q._f.onBlur&&q._f.onBlur(C),c&&c(0)):q._f.onChange&&q._f.onChange(C);const hn=A(k,At,Pt),ct=!st(hn)||zs;if(!Pt&&y.state.next({name:k,type:C.type,values:Ye(i)}),br)return(f.isValid||g.isValid)&&(t.mode==="onBlur"?Pt&&v():Pt||v()),ct&&y.state.next({name:k,...zs?{}:hn});if(!t.resolver&&e.validate&&await U({name:k,eventType:C.type}),!Pt&&zs&&y.state.next({...r}),t.resolver){const{errors:Ct}=await N([k]);if(m([k]),Q(At),!B){!st(hn)&&y.state.next(hn);return}const It=gh(r.errors,n,k),tr=gh(Ct,n,It.name||k);ye=tr.error,k=tr.name,Ge=st(Ct)}else m([k],!0),ye=(await mh(q,a.disabled,i,_,t.shouldUseNativeValidation))[k],m([k]),Q(At),B&&(ye?Ge=!1:(f.isValid||g.isValid)&&(Ge=await M({fields:n,onlyCheckValid:!0,name:k,eventType:C.type})));B&&(q._f.deps&&(!Array.isArray(q._f.deps)||q._f.deps.length>0)&&R(q._f.deps),$(k,Ge,ye,hn))}},V=(C,D)=>{if(K(r.errors,D)&&C.focus)return C.focus(),1},R=async(C,D={})=>{let k,B;const q=Ji(C);if(t.resolver){const Q=await P(Ue(C)?C:q);k=st(Q),B=C?!q.some(W=>K(Q,W)):k}else C?(B=(await Promise.all(q.map(async Q=>{const W=K(n,Q);return await M({fields:W&&W._f?{[Q]:W}:W,eventType:kr.TRIGGER})}))).every(Boolean),!(!B&&!r.isValid)&&v()):B=k=await M({fields:n,name:C,eventType:kr.TRIGGER});return y.state.next({...!wt(C)||(f.isValid||g.isValid)&&k!==r.isValid?{}:{name:C},...t.resolver||!C?{isValid:k}:{},errors:r.errors}),D.shouldFocus&&!B&&As(n,V,C?q:a.mount),B},G=(C,D)=>{let k={...o.mount?i:s};return D&&(k=nh(D.dirtyFields?r.dirtyFields:r.touchedFields,k)),Ue(C)?k:wt(C)?K(k,C):C.map(B=>K(k,B))},ae=(C,D)=>({invalid:!!K((D||r).errors,C),isDirty:!!K((D||r).dirtyFields,C),error:K((D||r).errors,C),isValidating:!!K(r.validatingFields,C),isTouched:!!K((D||r).touchedFields,C)}),Oe=C=>{const D=C?Ji(C):void 0;D==null||D.forEach(k=>Je(r.errors,k)),D?D.forEach(k=>{y.state.next({name:k,errors:r.errors})}):y.state.next({errors:{}})},$e=(C,D,k)=>{const B=(K(n,C,{_f:{}})._f||{}).ref,q=K(r.errors,C)||{},{ref:Q,message:W,type:re,...ye}=q;Be(r.errors,C,{...ye,...D,ref:B}),y.state.next({name:C,errors:r.errors,isValid:!1}),k&&k.shouldFocus&&B&&B.focus&&B.focus()},ge=(C,D)=>_t(C)?y.state.subscribe({next:k=>"values"in k&&C(k.values||Z(void 0,D),k)}):Z(C,D,!0),le=C=>y.state.subscribe({next:D=>{if(tE(C.name,D.name,C.exact)&&eE(D,C.formState||f,de,C.reRenderRoot)){const k={...i};C.callback({values:k,...r,...D,defaultValues:s})}}}).unsubscribe,he=C=>(o.mount=!0,g={...g,...C.formState},le({...C,formState:{...u,...C.formState}})),je=(C,D={})=>{for(const k of C?Ji(C):a.mount)a.mount.delete(k),a.array.delete(k),D.keepValue||(Je(n,k),Je(i,k)),!D.keepError&&Je(r.errors,k),!D.keepDirty&&Je(r.dirtyFields,k),!D.keepTouched&&Je(r.touchedFields,k),!D.keepIsValidating&&Je(r.validatingFields,k),!t.shouldUnregister&&!D.keepDefaultValue&&Je(s,k);y.state.next({values:Ye(i)}),y.state.next({...r,...D.keepDirty?{isDirty:j()}:{}}),!D.keepIsValid&&v()},ze=({disabled:C,name:D})=>{if(Lt(C)&&o.mount||C||a.disabled.has(D)){const q=a.disabled.has(D)!==!!C;C?a.disabled.add(D):a.disabled.delete(D),q&&o.mount&&!o.action&&v()}},Ae=(C,D={})=>{let k=K(n,C);const B=Lt(D.disabled)||Lt(t.disabled),q=!a.registerName.has(C)&&k&&k._f&&!k._f.mount;return Be(n,C,{...k||{},_f:{...k&&k._f?k._f:{ref:{name:C}},name:C,mount:!0,...D}}),a.mount.add(C),k&&!q?ze({disabled:Lt(D.disabled)?D.disabled:t.disabled,name:C}):x(C,!0,D.value),{...B?{disabled:D.disabled||t.disabled}:{},...t.progressive?{required:!!D.required,min:xs(D.min),max:xs(D.max),minLength:xs(D.minLength),maxLength:xs(D.maxLength),pattern:xs(D.pattern)}:{},name:C,onChange:se,onBlur:se,ref:Q=>{if(Q){a.registerName.add(C),Ae(C,D),a.registerName.delete(C),k=K(n,C);const W=Ue(Q.value)&&Q.querySelectorAll&&Q.querySelectorAll("input,select,textarea")[0]||Q,re=K1(W),ye=k._f.refs||[];if(re?ye.find(Ge=>Ge===W):W===k._f.ref)return;Be(n,C,{_f:{...k._f,...re?{refs:[...ye.filter(ul),W,...Array.isArray(K(s,C))?[{}]:[]],ref:{type:W.type,name:C}}:{ref:W}}}),x(C,!1,void 0,W)}else k=K(n,C,{}),k._f&&(k._f.mount=!1),(t.shouldUnregister||D.shouldUnregister)&&!(Yf(a.array,C)&&o.action)&&a.unMount.add(C)}}},ee=()=>t.shouldFocusError&&!t.shouldUseNativeValidation&&As(n,V,a.mount),Ke=C=>{Lt(C)&&(y.state.next({disabled:C}),As(n,(D,k)=>{const B=K(n,k);B&&(D.disabled=B._f.disabled||C,Array.isArray(B._f.refs)&&B._f.refs.forEach(q=>{q.disabled=B._f.disabled||C}))},0,!1))},rt=(C,D)=>async k=>{let B;k&&(k.preventDefault&&k.preventDefault(),k.persist&&k.persist());let q=Ye(i);if(y.state.next({isSubmitting:!0}),t.resolver){const{errors:Q,values:W}=await N();m(),r.errors=Q,q=Ye(W)}else await M({fields:n,eventType:kr.SUBMIT});if(a.disabled.size)for(const Q of a.disabled)Je(q,Q);if(Je(r.errors,Xf),st(r.errors)){y.state.next({errors:{}});try{await C(q,k)}catch(Q){B=Q}}else D&&await D({...r.errors},k),ee(),setTimeout(ee);if(y.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:st(r.errors)&&!B,submitCount:r.submitCount+1,errors:r.errors}),B)throw B},lt=(C,D={})=>{K(n,C)&&(Ue(D.defaultValue)?z(C,Ye(K(s,C))):(z(C,D.defaultValue),Be(s,C,Ye(D.defaultValue))),D.keepTouched||Je(r.touchedFields,C),D.keepDirty||(Je(r.dirtyFields,C),r.isDirty=D.defaultValue?j(C,Ye(K(s,C))):j()),D.keepError||(Je(r.errors,C),f.isValid&&v()),y.state.next({...r}))},He=(C,D={})=>{const k=C?Ye(C):s,B=Ye(k),q=st(C),Q=B;if(D.keepDefaultValues||(s=k),!D.keepValues){if(D.keepDirtyValues){const W=new Set([...a.mount,...Object.keys(Jr(s,i))]);for(const re of Array.from(W)){const ye=K(r.dirtyFields,re),Ge=K(i,re),At=K(Q,re);ye&&!Ue(Ge)?Be(Q,re,Ge):!ye&&!Ue(At)&&z(re,At)}}else{if(Ri&&Ue(C))for(const W of a.mount){const re=K(n,W);if(re&&re._f){const ye=Array.isArray(re._f.refs)?re._f.refs[0]:re._f.ref;if(eo(ye)){const Ge=ye.closest("form");if(Ge){Ge.reset();break}}}}if(D.keepFieldsRef)for(const W of a.mount)z(W,K(Q,W));else n={}}if(t.shouldUnregister){if(i=D.keepDefaultValues?Ye(s):{},D.keepFieldsRef)for(const W of a.mount)Be(i,W,K(Q,W))}else i=Ye(Q);y.array.next({values:{...Q}}),y.state.next({values:{...Q}})}a={mount:D.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||!!D.keepIsValid||!!D.keepDirtyValues||!t.shouldUnregister&&!st(Q),o.watch=!!t.shouldUnregister,o.keepIsValid=!!D.keepIsValid,o.action=!1,D.keepErrors||(r.errors={}),y.state.next({submitCount:D.keepSubmitCount?r.submitCount:0,isDirty:q?!1:D.keepDirty?r.isDirty:D.keepValues?j():!!(D.keepDefaultValues&&!Ft(C,s)),isSubmitted:D.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:q?{}:D.keepDirtyValues?D.keepDefaultValues&&i?Jr(s,i):r.dirtyFields:D.keepDefaultValues&&C?Jr(s,C):D.keepDirty?r.dirtyFields:{},touchedFields:D.keepTouched?r.touchedFields:{},errors:D.keepErrors?r.errors:{},isSubmitSuccessful:D.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:s})},Ze=(C,D)=>He(_t(C)?C(i):C,{...t.resetOptions,...D}),H=(C,D={})=>{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(),D.shouldSelect&&_t(q.select)&&q.select()})}},de=C=>{r={...r,...C}},mr={control:{register:Ae,unregister:je,getFieldState:ae,handleSubmit:rt,setError:$e,_subscribe:le,_runSchema:N,_updateIsValidating:m,_focusError:ee,_getWatch:Z,_getDirty:j,_setValid:v,_setFieldArray:S,_setDisabledField:ze,_setErrors:E,_getFieldArray:te,_reset:He,_resetDefaultValues:()=>_t(t.defaultValues)&&t.defaultValues().then(C=>{Ze(C,t.resetOptions),y.state.next({isLoading:!1})}),_removeUnmounted:L,_disableForm:Ke,_subjects:y,_proxyFormState:f,get _fields(){return n},get _formValues(){return i},get _state(){return o},set _state(C){o=C},get _defaultValues(){return s},get _names(){return a},set _names(C){a=C},get _formState(){return r},get _options(){return t},set _options(C){t={...t,...C}}},subscribe:he,trigger:R,register:Ae,handleSubmit:rt,watch:ge,setValue:z,setValues:J,getValues:G,reset:Ze,resetField:lt,resetDefaultValues:(C,D={})=>{if(s=Ye(C),!D.keepDirty){const k=Jr(s,i);r.dirtyFields=k,r.isDirty=!st(k)}D.keepIsValid||v(),y.state.next({...r,defaultValues:s})},clearErrors:Oe,unregister:je,setError:$e,setFocus:H,getFieldState:ae};return{...mr,formControl:mr}}function oE(e={}){const t=h.useRef(void 0),r=h.useRef(void 0),n=h.useRef(e.formControl),[s,i]=h.useState(()=>({...Ye(bh),isLoading:_t(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1,defaultValues:_t(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&&!_t(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:a,...c}=iE(e);t.current={...c,formState:s}}const o=t.current.control;return o._options=e,sl(()=>{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&&!Ft(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(()=>Jf(s,o),[o,s]),t.current}async function _h(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 aE(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 wh(e,t){const r=pn({queryKey:["framework",e],queryFn:()=>_h(e),enabled:!!e,staleTime:3e5}),n=t==null?void 0:t[0],s=pn({queryKey:["framework",n],queryFn:()=>_h(n),enabled:!!n,staleTime:5*60*1e3}),i=s.data?[s.data]:[];return{organisationFramework:r.data,targetFrameworks:i,isLoading:r.isLoading||s.isLoading}}function lE(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:()=>aE({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 cE(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 uE(e){var r,n,s,i,o,a;const t=pn({queryKey:["channel",e],queryFn:()=>cE(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 dE(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 fE={"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."}},hE=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"},pE={Categorisation:"Second Section","Basic Information":"First Section","Licensing & Attribution":"Fourth Section",Curriculum:"Organisation Framework Terms","Target Audience":"Target Framework Terms"},gE={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"},pl={board:"board",boardIds:"board",medium:"medium",gradeLevel:"gradeLevel",subject:"subject",subjectIds:"subject",topicsIds:"topic",topic:"topic",targetBoardIds:"board",targetMediumIds:"medium",targetGradeLevelIds:"gradeLevel",targetSubjectIds:"subject"},Sh=new Set(["targetBoardIds","targetMediumIds","targetGradeLevelIds","targetSubjectIds"]);function Ch(e,t,r,n,s={}){if(!(e!=null&&e.length))return NE(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=SE(a),u=CE(a,r,t,i,s),f=t[c],g=vE(c,Eh(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:yE(c,a.editable!==!1,s),placeholder:a.placeholder,maxLength:a.maxLength,options:_E(u,g,d,r),depends:a.depends,tab:wE(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 yE(e,t,r){var i;const n=r.editorMode??"edit";if(!hE.has(n))return t!==!1;const s=(i=r.editableFields)==null?void 0:i[n];return!!(s&&s.includes(e))}function vE(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!==""?mE(Number(a)):t}default:return t}}function mE(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 bE(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 _E(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=bE(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 wE(e){const t=e.section;if(t){if(ro[t])return ro[t];const n=pE[t];if(n&&ro[n])return ro[n]}const r=e.code??"";return gE[r]??"details"}function Eh(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 SE(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 CE(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?DE(f).map(g=>({label:g,value:g})):void 0}const c=e.sourceCategory??pl[i];if(c)return Oh(i,c,e,t,r,n)}function EE(e,t){return Sh.has(e)||t.output==="identifier"||typeof t.section=="string"&&t.section.includes("Target")}function OE(e,t){return Sh.has(e)||typeof t.section=="string"&&t.section.includes("Target")}function gl(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 IE(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 DE(e){return Array.from(new Set(e))}function TE(e){return Array.isArray(e)?e:e!=null&&e!==""?[e]:[]}function Oh(e,t,r,n,s,i){const o=EE(e,r),a=OE(e,r),c=p=>({label:p.name,value:o?p.identifier:p.name}),d=r.depends;if(!(d!=null&&d.length))return gl(n,t,a).map(c);const u=d.flatMap(p=>TE(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)??pl[p]??p;f.push(...gl(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()),_=IE(y);return _.length?_.map(c):gl(n,t,a).map(c)}function Ps(e,t){const r=pl[e];if(r)return Oh(e,r,{},t,{},new Map)}function ht(e,t,r){return Eh(e[t],r)}function NE(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: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:(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:ht(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: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:Ps("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:Ps("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:Ps("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:Ps("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 kE=["allowECM","levels","setPeriod","instances"];function Ih(e){const t={};return e.forEach((r,n)=>{t[`L${n+1}`]={label:r}}),t}function xE(e,t={}){const r={...e};for(const i of kE)delete r[i];const n=e.levels;Array.isArray(n)&&n.length&&(r.outcomeDeclaration={levels:Ih(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 AE(e,t){return e==="allowECM"||e==="setPeriod"?null:e==="levels"?{outcomeDeclaration:{levels:Array.isArray(t)?Ih(t):{}}}:e==="instances"?{instances:t!=null&&t!==""?{label:t}:""}:{[e]:t}}function PE(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"},ME=({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"},Dh=({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)})]})},LE=({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)})]})},FE=({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)})]})},$E=({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)})]})},jE=({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 BE(e,t,r,n){var o,a;const i=(a=(o=(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:o.result)==null?void 0:a.node_id;if(!i)throw new Error("Asset creation failed: no node_id returned");return i}async function UE(e,t){var s,i;const n=(i=(s=(await ke.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 VE(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 qE(e,t,r){var o,a;const n=new FormData;n.append("fileUrl",t),n.append("mimeType",r);const i=(a=(o=(await ke.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 fe={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"},Th=18,Nh=({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(""),[T,x]=h.useState(!1),[A,$]=h.useState(""),N=h.useRef(null),P=ie(V=>{var R,G;return((G=(R=V.editorConfig)==null?void 0:R.context)==null?void 0:G.channel)??""}),U=ie(V=>{var R,G;return((G=(R=V.editorConfig)==null?void 0:R.context)==null?void 0:G.uid)??""}),M=ie(V=>{var R,G,ae;return((ae=(G=(R=V.editorConfig)==null?void 0:R.context)==null?void 0:G.cloudStorage)==null?void 0:ae.presigned_headers)??{}}),L=ie(V=>{var R,G,ae;return((ae=(G=(R=V.editorConfig)==null?void 0:R.config)==null?void 0:G.assetConfig)==null?void 0:ae.size)??1*1024*1024}),j=ie(V=>{var R,G,ae;return((ae=(G=(R=V.editorConfig)==null?void 0:R.config)==null?void 0:G.assetConfig)==null?void 0:ae.accepted)??"image/png,image/jpeg"}),Z=h.useCallback(async(V,R,G=!1)=>{var ae;y(!0);try{const Oe={status:["Live"],mediaType:["image"],mimeType:["image/png","image/jpeg","image/jpg","image/gif","image/svg+xml"]};s==="my"&&U&&(Oe.createdBy=U),P&&(Oe.channel=P);const ge=((ae=(await ke.post("/action/composite/v3/search",{request:{filters:Oe,query:V,limit:Th,offset:R,sort_by:{createdOn:"desc"},fields:["identifier","name","appIcon","artifactUrl","downloadUrl"]}},{headers:{"X-Source":"web"}})).data)==null?void 0:ae.result)??{},le=ge.content??[];f(ge.count??0),d(he=>G?[...he,...le]:le)}catch{}finally{y(!1)}},[s,U,P]);h.useEffect(()=>{s!=="upload"&&(d([]),m(0),Z(o,0))},[s]);const te=h.useRef(),_e=V=>{a(V),clearTimeout(te.current),te.current=setTimeout(()=>{d([]),m(0),Z(V,0)},400)},we=()=>{const V=v+Th;m(V),Z(o,V,!0)},ve=()=>{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 ae;const R=(ae=V.target.files)==null?void 0:ae[0];if(V.target.value="",!R)return;const G=j.split(",").map(Oe=>Oe.trim());if(!G.includes(R.type)){const Oe=G.map($e=>$e.replace("image/","").toUpperCase()).join(", ");$(`Only ${Oe} files are accepted.`);return}if(R.size>L){const Oe=(L/1048576).toFixed(0);$(`Image must be under ${Oe} MB.`);return}w&&URL.revokeObjectURL(w),S(R),E(URL.createObjectURL(R)),$("")},J=async()=>{if(b){x(!0),$("");try{const V=await BE(b.name.split(".").slice(0,-1).join(".")||b.name,b.type,U,P),R=await UE(V,b.name);await VE(R,b,M);const G=R.split("?")[0],ae=await qE(V,G,b.type);r(ae)}catch(V){$(V instanceof Error?V.message:"Upload failed.")}finally{x(!1)}}},se=c.length<u;return l.jsx("div",{className:fe.overlay,role:"dialog","aria-modal":"true","aria-label":"Select App Icon",children:l.jsxs("div",{className:fe.modal,children:[l.jsxs("div",{className:fe.header,children:[l.jsx("span",{className:fe.title,children:"Select App Icon"}),l.jsx("button",{className:fe.closeBtn,onClick:n,"aria-label":"Close",children:l.jsx(zr,{size:18})})]}),l.jsxs("div",{className:fe.tabs,role:"tablist",children:[l.jsx("button",{role:"tab","aria-selected":s==="my",className:`${fe.tab} ${s==="my"?fe.activeTab:""}`,onClick:()=>i("my"),children:"My Images"}),l.jsx("button",{role:"tab","aria-selected":s==="all",className:`${fe.tab} ${s==="all"?fe.activeTab:""}`,onClick:()=>i("all"),children:"All Images"}),l.jsxs("button",{role:"tab","aria-selected":s==="upload",className:`${fe.tab} ${s==="upload"?fe.activeTab:""}`,onClick:()=>i("upload"),children:[l.jsx(Gc,{size:13,style:{marginRight:4}}),"Upload"]})]}),l.jsx("div",{className:fe.body,children:s!=="upload"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:fe.searchWrap,children:[l.jsx(Go,{size:14,className:fe.searchIcon}),l.jsx("input",{type:"search",className:fe.searchInput,placeholder:"Search images…",value:o,onChange:V=>_e(V.target.value)})]}),g&&c.length===0?l.jsxs("div",{className:fe.loadingRow,children:[l.jsx(yi,{size:20,className:fe.spinner}),l.jsx("span",{children:"Loading…"})]}):c.length===0?l.jsx("div",{className:fe.empty,children:"No images found"}):l.jsx("div",{className:fe.grid,children:c.map(V=>{const R=V.appIcon??V.artifactUrl??V.downloadUrl??"",G=(_==null?void 0:_.identifier)===V.identifier;return l.jsxs("button",{type:"button",className:`${fe.imgCell} ${G?fe.imgCellSelected:""}`,onClick:()=>p(V),title:V.name,children:[R?l.jsx("img",{src:R,alt:V.name,className:fe.thumb}):l.jsx("div",{className:fe.noThumb,children:"IMG"}),G&&l.jsx("div",{className:fe.checkBadge,children:l.jsx(bn,{size:12})})]},V.identifier)})}),se&&!g&&l.jsx("button",{className:fe.loadMoreBtn,onClick:we,children:"Load More"}),g&&c.length>0&&l.jsx("div",{className:fe.loadingRow,children:l.jsx(yi,{size:16,className:fe.spinner})})]}):l.jsxs("div",{className:fe.uploadArea,children:[l.jsx("div",{className:fe.dropZone,onClick:()=>{var V;return(V=N.current)==null?void 0:V.click()},onDragOver:V=>V.preventDefault(),onDrop:V=>{V.preventDefault();const R=V.dataTransfer.files[0];R&&z({target:{files:[R],value:""}})},children:w?l.jsx("img",{src:w,alt:"Preview",className:fe.uploadPreview}):l.jsxs(l.Fragment,{children:[l.jsx(Gc,{size:32,className:fe.uploadIcon}),l.jsx("p",{className:fe.dropText,children:"Drag & drop or click to browse"}),l.jsxs("p",{className:fe.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:fe.hiddenInput,onChange:z}),b&&l.jsx("p",{className:fe.fileName,children:b.name}),A&&l.jsx("p",{className:fe.errorText,children:A})]})}),l.jsxs("div",{className:fe.footer,children:[l.jsx("button",{className:fe.cancelBtn,onClick:n,children:"Cancel"}),s==="upload"?l.jsx("button",{className:fe.confirmBtn,disabled:!b||T,onClick:J,children:T?l.jsxs(l.Fragment,{children:[l.jsx(yi,{size:14,className:fe.spinner})," Uploading…"]}):"Upload & Use"}):l.jsx("button",{className:fe.confirmBtn,disabled:!_,onClick:ve,children:"Use Selected"})]})]})})},zE=({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(Qc,{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(Yo,{size:13}),l.jsx("span",{children:"Remove"})]}),g&&l.jsx("span",{className:F.error,children:String(g.message)}),i&&l.jsx(Nh,{nodeId:r,currentValue:f,onSelect:y,onClose:()=>o(!1)})]})},HE=({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)})]})},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},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)})]})},QE=({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)})]})},kh=[{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"}],KE=({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=kh.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:kh.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)})]})},GE=({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(qc,{size:16,color:"var(--sbx-success, #2e7d32)"}):a==="invalid"?l.jsx(zo,{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})]})},yl={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 je,ze,Ae,ee,Ke,rt,lt,He,Ze;const a=ie(H=>H.editorConfig),c=ie(H=>H.rootFormConfig),d=ie(H=>H.unitFormConfig),u=ie(H=>H.categoryMeta),f=ie(H=>H.contentFramework),g=ie(H=>H.contentTargetFWIds),{organisationFramework:y,targetFrameworks:_,isLoading:p}=wh(f??((je=a==null?void 0:a.context)==null?void 0:je.framework),g??((ze=a==null?void 0:a.context)==null?void 0:ze.targetFWIds)),{frameworks:v,collectionAdditionalCategories:m,contentAdditionalCategories:b,defaultLicense:S,name:w}=uE((Ae=a==null?void 0:a.context)==null?void 0:Ae.channel),E=dE(((ee=a==null?void 0:a.context)==null?void 0:ee.userId)??((Ke=a==null?void 0:a.context)==null?void 0:Ke.uid)),T=lE(v,(rt=u==null?void 0:u.frameworkMetadata)==null?void 0:rt.orgFWType,(lt=a==null?void 0:a.context)==null?void 0:lt.channel),x={organisationFramework:y,targetFrameworks:_,orgFrameworks:T,channelAdditionalCategories:m},A=De(H=>H.selectedNodeId),$=De(H=>H.treeData),N=De(H=>H.treeCache),P=A?N[A]??{}:{},U={...e,...P},M=h.useMemo(()=>{var de;if(!A)return 0;const H=[...$];for(;H.length;){const me=H.shift();if(me.id===A)return((de=me.children)==null?void 0:de.length)??0;me.children&&H.push(...me.children)}return 0},[$,A]),L=(a==null?void 0:a.config)??{},j=(a==null?void 0:a.context)??{},Z={editorMode:s,editableFields:L.editableFields,objectType:L.objectType,setDefaultCopyRight:L.setDefaultCopyRight===!0,defaultLicense:j.defaultLicense??S,contextAdditionalCategories:j.additionalCategories,userFullName:((He=j.user)==null?void 0:He.fullName)??E,channelName:w,collectionAdditionalCategories:m,contentAdditionalCategories:b,childCount:M},te=r?c:d,_e=te||(((Ze=a==null?void 0:a.config.hierarchy)==null?void 0:Ze.formConfig)??[]),we=Ch(_e,U,x,r,Z),ve=we.filter(H=>H.tab===t&&H.inputType!=="appIcon"&&H.visible!==!1),z=oE({mode:"onChange",defaultValues:Object.fromEntries(we.map(H=>{const de=["multiselect","chips","keywords","tagsinput"],me=["nestedselect"];return de.includes(H.inputType)?[H.code,H.currentValue??H.defaultValue??[]]:me.includes(H.inputType)?[H.code,H.currentValue??H.defaultValue??{}]:[H.code,H.currentValue??H.defaultValue??""]}))});PE(z,we);const{updateNode:J}=De(),se=h.useRef(we);se.current=we;const V=h.useRef(A);V.current=A;const R=h.useRef(i);R.current=i;const G=h.useRef(o);G.current=o;const ae=h.useRef(typeof U.shuffle=="boolean"?U.shuffle:void 0),Oe=h.useRef(U.name??"");Oe.current=U.name??"";const $e=h.useRef(s);$e.current=s;const ge=["review","read","sourcingreview","orgreview"];h.useEffect(()=>{const H=V.current;if(H){const de=Object.fromEntries(se.current.filter(me=>me.currentValue!==void 0&&me.currentValue!==null).map(me=>[me.code,me.currentValue]));Object.keys(de).length>0&&J(H,de)}z.trigger().then(()=>{const de=z.formState.errors,me=se.current,dr=Array.from(new Set(Object.keys(de).map(mr=>{var C;return(C=me.find(D=>D.code===mr))==null?void 0:C.tab}).filter(Boolean)));G.current(Object.keys(de).length===0,dr)})},[]),h.useEffect(()=>{const H=z.watch((de,{name:me})=>{const dr=V.current;if(!dr)return;const mr=se.current,C=new Set(mr.map(B=>B.code));if(me&&C.has(me)){let B=z.getValues(me);me==="dialcodes"&&(B=Array.isArray(B)?B:B?[B]:[]),me==="shuffle"&&(B===!0&&ae.current===!1&&Ie("Shuffling is enabled for this question set.",{icon:"ℹ️"}),ae.current=B);const q=AE(me,B);q&&(J(dr,q),R.current(q))}else if(!me){const B=z.getValues(),q=Object.fromEntries(Object.entries(B).filter(([W])=>C.has(W))),Q=xE(q,{isReview:ge.includes($e.current),nodeTitle:Oe.current});Object.keys(Q).length>0&&(J(dr,Q),R.current(Q))}const D=z.formState.errors,k=Array.from(new Set(Object.keys(D).map(B=>{var q;return(q=mr.find(Q=>Q.code===B))==null?void 0:q.tab}).filter(Boolean)));G.current(Object.keys(D).length===0,k)});return()=>H.unsubscribe()},[z]),h.useEffect(()=>{for(const H of["author","creator","copyright","copyrightYear","license"]){const de=se.current.find(dr=>dr.code===H);if(!de||de.currentValue===void 0||de.currentValue===null||de.currentValue==="")continue;const me=z.getValues(H);(me==null||me==="")&&z.setValue(H,de.currentValue,{shouldDirty:!1})}},[E,w,z]);const le=ve.reduce((H,de)=>{const me=H[H.length-1];return me&&me.section===de.section?me.fields.push(de):H.push({section:de.section,fields:[de]}),H},[]),he=H=>{const de={key:H.code,name:H.code,label:H.label,required:H.required,disabled:H.editable===!1};switch(H.inputType){case"textarea":return l.jsx(Dh,{...de,multiline:!0,maxLength:H.maxLength});case"select":return l.jsx(LE,{...de,options:H.options??[]});case"multiselect":return l.jsx(FE,{...de,options:H.options??[]});case"chips":return l.jsx($E,{...de});case"radio":return l.jsx(jE,{...de,options:H.options??[]});case"appIcon":return l.jsx(zE,{...de,nodeId:A??""});case"datepicker":case"datetime":return l.jsx(HE,{...de});case"keywords":case"tagsinput":return l.jsx(WE,{...de});case"nestedselect":return l.jsx(QE,{...de,levels:H.levels??[]});case"license":return l.jsx(KE,{...de});case"dialcode":return l.jsx(GE,{...de});default:return l.jsx(Dh,{...de,maxLength:H.maxLength})}};return l.jsx(W1,{...z,children:l.jsxs("div",{className:yl.form,children:[le.map((H,de)=>{const me=H.section?fE[H.section]:void 0;return me?l.jsx(ME,{title:me.title,description:me.description,children:H.fields.map(he)},H.section??de):l.jsx("div",{className:yl.ungrouped,children:H.fields.map(he)},de)}),ve.length===0&&!p&&l.jsx("p",{className:yl.noFields,children:"No fields configured for this tab."})]})})};function xh(e,t,r){const n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function RE(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 XE(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 ZE(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Ah=e=>{let{rects:t,activeIndex:r,overIndex:n,index:s}=e;const i=xh(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},JE=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=eO(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 eO(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 Ph="Sortable",Mh=h.createContext({activeIndex:-1,containerId:Ph,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Ah,disabled:{draggable:!1,droppable:!1}});function tO(e){let{children:t,id:r,items:n,strategy:s=Ah,disabled:i=!1}=e;const{active:o,dragOverlay:a,droppableRects:c,over:d,measureDroppableContainers:u}=jc(),f=os(Ph,r),g=a.rect!==null,y=h.useMemo(()=>n.map(T=>typeof T=="object"&&"id"in T?T.id:T),[n]),_=o!=null,p=o?y.indexOf(o.id):-1,v=d?y.indexOf(d.id):-1,m=h.useRef(y),b=!XE(y,m.current),S=v!==-1&&p===-1||b,w=ZE(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:RE(y,c),strategy:s}),[p,f,w.draggable,w.droppable,S,y,v,c,g,s]);return h.createElement(Mh.Provider,{value:E},t)}const rO=e=>{let{id:t,items:r,activeIndex:n,overIndex:s}=e;return xh(r,n,s).indexOf(t)},nO=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},sO={duration:200,easing:"ease"},Lh="transform",iO=Ir.Transition.toString({property:Lh,duration:0,easing:"linear"}),oO={roleDescription:"sortable"};function aO(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 lO(e){let{animateLayoutChanges:t=nO,attributes:r,disabled:n,data:s,getNewIndex:i=rO,id:o,strategy:a,resizeObserverConfig:c,transition:d=sO}=e;const{items:u,containerId:f,activeIndex:g,disabled:y,disableTransforms:_,sortedRects:p,overIndex:v,useDragOverlay:m,strategy:b}=h.useContext(Mh),S=cO(n,y),w=u.indexOf(o),E=h.useMemo(()=>({sortable:{containerId:f,index:w,items:u},...s}),[f,s,w,u]),T=h.useMemo(()=>u.slice(u.indexOf(o)),[u,o]),{rect:x,node:A,isOver:$,setNodeRef:N}=nv({id:o,data:E,disabled:S.droppable,resizeObserverConfig:{updateMeasurementsFor:T,...c}}),{active:P,activatorEvent:U,activeNodeRect:M,attributes:L,setNodeRef:j,listeners:Z,isDragging:te,over:_e,setActivatorNodeRef:we,transform:ve}=$c({id:o,data:E,attributes:{...oO,...r},disabled:S.draggable}),z=qg(N,j),J=!!P,se=J&&!_&&no(g)&&no(v),V=!m&&te,R=V&&se?ve:null,ae=se?R??(a??b)({rects:p,activeNodeRect:M,activeIndex:g,overIndex:v,index:w}):null,Oe=no(g)&&no(v)?i({id:o,items:u,activeIndex:g,overIndex:v}):w,$e=P==null?void 0:P.id,ge=h.useRef({activeId:$e,items:u,newIndex:Oe,containerId:f}),le=u!==ge.current.items,he=t({active:P,containerId:f,isDragging:te,isSorting:J,id:o,index:w,items:u,newIndex:ge.current.newIndex,previousItems:ge.current.items,previousContainerId:ge.current.containerId,transition:d,wasDragging:ge.current.activeId!=null}),je=aO({disabled:!he,index:w,node:A,rect:x});return h.useEffect(()=>{J&&ge.current.newIndex!==Oe&&(ge.current.newIndex=Oe),f!==ge.current.containerId&&(ge.current.containerId=f),u!==ge.current.items&&(ge.current.items=u)},[J,Oe,f,u]),h.useEffect(()=>{if($e===ge.current.activeId)return;if($e&&!ge.current.activeId){ge.current.activeId=$e;return}const Ae=setTimeout(()=>{ge.current.activeId=$e},50);return()=>clearTimeout(Ae)},[$e]),{active:P,activeIndex:g,attributes:L,data:E,rect:x,index:w,newIndex:Oe,items:u,isOver:$,isSorting:J,isDragging:te,listeners:Z,node:A,overIndex:v,over:_e,setNodeRef:z,setActivatorNodeRef:we,setDroppableNodeRef:N,setDraggableNodeRef:j,transform:je??ae,transition:ze()};function ze(){if(je||le&&ge.current.newIndex===w)return iO;if(!(V&&!ai(U)||!d)&&(J||he))return Ir.Transition.toString({...d,property:Lh})}}function cO(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 uO=[Ce.Down,Ce.Right,Ce.Up,Ce.Left],dO=(e,t)=>{let{context:{active:r,collisionRect:n,droppableRects:s,droppableContainers:i,over:o,scrollableAncestors:a}}=t;if(uO.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 Ce.Down:n.top<g.top&&c.push(f);break;case Ce.Up:n.top>g.top&&c.push(f);break;case Ce.Left:n.left>g.left&&c.push(f);break;case Ce.Right:n.left<g.left&&c.push(f);break}});const d=iy({collisionRect:n,droppableRects:s,droppableContainers:c});let u=cc(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((T,x)=>a[x]!==T),m=Fh(f,g),b=fO(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 Fh(e,t){return!io(e)||!io(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function fO(e,t){return!io(e)||!io(t)||!Fh(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"},hO={video:Ro,pdf:Ho,h5p:Wo,scorm:Ko,audio:Qo,quiz:qo,default:_n},pO=({item:e,onRemove:t,isEditable:r})=>{const n=Yi(e),s=hO[n.key]??_n,{attributes:i,listeners:o,setNodeRef:a,transform:c,transition:d,isDragging:u}=lO({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(Wc,{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"},gO=({editorMode:e})=>{const{selectedNodeId:t,getChildrenOf:r,reorderChildren:n,deleteNode:s}=De(),i=t?r(t):[],o=e==="edit",a=ic(xo(di,{activationConstraint:{distance:5}}),xo(Fo,{coordinateGetter:dO})),c=h.useCallback(u=>{const{active:f,over:g}=u;if(!g||f.id===g.id||!t)return;const y=De.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(Lc,{sensors:a,collisionDetection:sy,onDragEnd:c,children:l.jsx(tO,{items:i.map(u=>u.id),strategy:JE,children:l.jsx("div",{className:tn.list,role:"list",children:i.map(u=>l.jsx(pO,{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},$h={dropZone:"_dropZone_ijo5w_1",active:"_active_ijo5w_14"},yO=({isActive:e,label:t="Drop here",nodeId:r,className:n})=>l.jsx("div",{className:`${$h.dropZone} ${e?$h.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 vO(e){var o;const t={status:["Live"],...e.filters??{}};e.channel&&(t.channel=e.channel);const n=((o=(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: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 mO(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 jh="application/vnd.sunbird.question";function Bh(e){return{cardinality:"single",type:"integer",defaultValue:e.maxScore??1}}function Uh(e,t,r){if(!e)return null;if(e.identifier===t)return{question:e,parent:r};for(const n of e.children??[]){const s=Uh(n,t,e);if(s)return s}return null}function bO(e,t){const r=Uh(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 _O(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===jh&&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===jh&&u.identifier){const f=o.get(u.identifier)??u,g=f.outcomeDeclaration;return g!=null&&g.maxScore||(f.outcomeDeclaration={...g??{},maxScore:Bh(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:Bh(c)}),c}})}const Vh="/assets/quml-player/sunbird-quml-player.js",wO="/assets/quml-player/styles.css",qh="sunbird-quml-player";function SO(e){const t=e.children??[];return t.length?t.every(n=>n.objectType==="Question")?[e]:t:[]}const at=class at{constructor(){Ks(this,"eventHandlers",new WeakMap)}loadScript(){return at.scriptLoaded||customElements.get(qh)?(at.scriptLoaded=!0,Promise.resolve()):(at.scriptLoading||(at.scriptLoading=new Promise((t,r)=>{const n=document.createElement("script");n.src=Vh,n.setAttribute("data-quml-player-script","true"),n.onload=()=>{at.scriptLoaded=!0,at.scriptLoading=void 0,t()},n.onerror=()=>{at.scriptLoading=void 0,r(new Error(`Failed to load QuML player script: ${Vh}`))},document.body.appendChild(n)})),at.scriptLoading)}loadStyles(){if(at.stylesLoaded||document.querySelector('[data-quml-player-styles="true"]')){at.stylesLoaded=!0;return}const t=document.createElement("link");t.rel="stylesheet",t.href=wO,t.setAttribute("data-quml-player-styles","true"),document.head.appendChild(t),at.stylesLoaded=!0}static unloadStyles(){var t;(t=document.querySelector('[data-quml-player-styles="true"]'))==null||t.remove(),at.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:SO(t),identifier:t.identifier??""},metadata:t}}createElement(t){this.loadStyles();const r=document.createElement(qh);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(at,"scriptLoaded",!1),Ks(at,"scriptLoading"),Ks(at,"stylesLoaded",!1);let oo=at;const ao=new oo,Ve={contentPlayerRoot:"_contentPlayerRoot_b5r97_1",stage:"_stage_b5r97_9",playerHeader:"_playerHeader_b5r97_19",playerHeaderThumb:"_playerHeaderThumb_b5r97_33",playerHeaderTitle:"_playerHeaderTitle_b5r97_43",typeBadge:"_typeBadge_b5r97_53",typeDot:"_typeDot_b5r97_92",aspectRatio:"_aspectRatio_b5r97_99",playerFrame:"_playerFrame_b5r97_112",coverOverlay:"_coverOverlay_b5r97_120",coverHidden:"_coverHidden_b5r97_132",coverThumb:"_coverThumb_b5r97_137",coverPlayRing:"_coverPlayRing_b5r97_146",coverPlayIcon:"_coverPlayIcon_b5r97_159",coverLabel:"_coverLabel_b5r97_168",coverSkeleton:"_coverSkeleton_b5r97_174",playerWrapper:"_playerWrapper_b5r97_200",infoStrip:"_infoStrip_b5r97_210",infoChip:"_infoChip_b5r97_226",infoChipLabel:"_infoChipLabel_b5r97_245",infoChipIcon:"_infoChipIcon_b5r97_254",playerError:"_playerError_b5r97_260",playerErrorIcon:"_playerErrorIcon_b5r97_274",playerErrorMsg:"_playerErrorMsg_b5r97_279",qumlRoot:"_qumlRoot_b5r97_286"},CO="application/vnd.sunbird.questionset";function EO(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===CO)return s.identifier;s=s.parent?r.get(s.parent):void 0}return null}const OO=[{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 IO(e){return OO.find(t=>t.mimes.includes(e))??{key:"other",label:"Content",icon:"📱"}}const DO={"pdf-player":["application/pdf"],"video-player":["video/mp4","video/webm"],"epub-player":["application/epub"]},TO={"pdf-player":"/assets/sunbird-pdf-player.js","video-player":"/assets/sunbird-video-player.js","epub-player":"/assets/sunbird-epub-player.js"},NO={"pdf-player":"sunbird-pdf-player","video-player":"sunbird-video-player","epub-player":"sunbird-epub-player"},kO="/content/preview/preview.html?webview=true&build_number=2.8.0.e552fcd";function vl(e){for(const[t,r]of Object.entries(DO))if(r.includes(e))return t;return"default-player"}function xO(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 AO(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 PO(e,t,r=100){await AO(TO[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 MO=[{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 LO({node:e}){const t=e.metadata??{},r=MO.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:Ve.infoStrip,children:r.map(n=>l.jsxs("div",{className:Ve.infoChip,children:[n.icon&&l.jsx("span",{className:Ve.infoChipIcon,children:n.icon}),l.jsx("span",{className:Ve.infoChipLabel,children:n.label}),n.val]},n.key))}):null}function zh({node:e,hidden:t}){var n;const r=e.appIcon??((n=e.metadata)==null?void 0:n.appIcon);return l.jsx("div",{className:`${Ve.coverOverlay} ${t?Ve.coverHidden:""}`,children:r?l.jsxs(l.Fragment,{children:[l.jsx("img",{src:r,alt:e.name,className:Ve.coverThumb}),l.jsx("div",{className:Ve.coverPlayRing,children:l.jsx("div",{className:Ve.coverPlayIcon})}),l.jsx("span",{className:Ve.coverLabel,children:"Loading preview…"})]}):l.jsx("div",{className:Ve.coverSkeleton})})}function Hh({message:e}){return l.jsxs("div",{className:Ve.playerError,children:[l.jsx("span",{className:Ve.playerErrorIcon,children:"⚠"}),l.jsx("span",{className:Ve.playerErrorMsg,children:e})]})}function FO({mimeType:e}){const t=IO(e);return l.jsxs("span",{className:Ve.typeBadge,"data-type":t.key,children:[l.jsx("span",{className:Ve.typeDot}),t.label]})}const ml=({node:e,editorMode:t,type:r,singleQuestion:n})=>{var i;if(r==="quml")return l.jsx(jO,{node:e,editorMode:t,singleQuestion:!!n});const s=e.appIcon??((i=e.metadata)==null?void 0:i.appIcon);return l.jsxs("div",{className:Ve.contentPlayerRoot,children:[l.jsxs("div",{className:Ve.stage,children:[l.jsxs("div",{className:Ve.playerHeader,children:[s&&l.jsx("img",{src:s,alt:"",className:Ve.playerHeaderThumb}),l.jsx("span",{className:Ve.playerHeaderTitle,children:e.name}),l.jsx(FO,{mimeType:e.mimeType??""})]}),l.jsx($O,{node:e})]}),l.jsx(LO,{node:e})]})};function $O({node:e}){var v;const t=ie(m=>m.editorConfig),[r,n]=h.useState(()=>vl(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)??kO;h.useEffect(()=>{let m=!1;return f(!1),i(!1),a(null),d(e.metadata??{}),n(vl(e.mimeType??"")),mO(e.identifier).then(b=>{if(m)return;const S={...e.metadata??{},...b};d(S);const w=b.mimeType??e.mimeType??"";n(vl(w)),f(!0)}).catch(()=>{m||f(!0)}),()=>{m=!0}},[e.identifier]);const p=xO(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=NO[r];if(!b)return;const S=p;PO(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:Ve.aspectRatio,children:[o?l.jsx(Hh,{message:o}):l.jsx(zh,{node:e,hidden:s}),r==="default-player"?l.jsx("iframe",{ref:g,id:"contentPlayer",title:e.name,className:Ve.playerFrame,name:"contentPlayer",allowFullScreen:!0}):l.jsx("div",{ref:y,className:Ve.playerFrame})]})}function jO({node:e,editorMode:t,singleQuestion:r}){const n=ie(g=>g.editorConfig),s=De(g=>g.treeData),i=h.useRef(null),o=r?EO(s,e.id):e.identifier,{data:a,isLoading:c,error:d}=_O(o??"",{enabled:!!o}),u=h.useMemo(()=>a?r?bO(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:Ve.qumlRoot,children:[f?l.jsx(Hh,{message:f}):c||!u?l.jsx(zh,{node:e,hidden:!1}):null,l.jsx("div",{ref:i,className:Ve.playerWrapper})]})}const Ht={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 BO(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 UO=({resourceId:e,resourceName:t,currentUnitId:r,onClose:n})=>{var u;const{treeData:s,moveNode:i}=De(),o=BO(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:Ht.overlay,role:"dialog","aria-label":"Move resource",children:l.jsxs("div",{className:Ht.modal,children:[l.jsxs("div",{className:Ht.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:Ht.body,children:[l.jsx("p",{className:Ht.hint,children:"Select a unit to move this content to:"}),l.jsxs("ul",{className:Ht.list,children:[o.map(f=>l.jsxs("li",{className:`${Ht.item} ${a===f.id?Ht.selected:""}`,onClick:()=>c(f.id),children:[l.jsx(Ev,{size:14}),l.jsx("span",{children:f.name})]},f.id)),o.length===0&&l.jsx("li",{className:Ht.empty,children:"No other units available"})]})]}),l.jsxs("div",{className:Ht.footer,children:[l.jsx("button",{className:Ht.cancelBtn,onClick:n,children:"Cancel"}),l.jsx("button",{className:Ht.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 VO(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 qO=({onClose:e})=>{const{treeData:t,updateNode:r}=De(),n=VO(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"]})]})]})})},Qe={container:"_container_1a7t2_1",panelHeader:"_panelHeader_1a7t2_10",panelHeaderLeft:"_panelHeaderLeft_1a7t2_19",panelCollapseBtn:"_panelCollapseBtn_1a7t2_27",titleRow:"_titleRow_1a7t2_46",field:"_field_1a7t2_47",moveBtn:"_moveBtn_1a7t2_64",icon:"_icon_1a7t2_84",nameInput:"_nameInput_1a7t2_93",fieldHeader:"_fieldHeader_1a7t2_118",label:"_label_1a7t2_124",fieldCount:"_fieldCount_1a7t2_133",chips:"_chips_1a7t2_170",chip:"_chip_1a7t2_170",chipRemove:"_chipRemove_1a7t2_188",keywordInput:"_keywordInput_1a7t2_202",input:"_input_1a7t2_207",addBtn:"_addBtn_1a7t2_220",radioGroup:"_radioGroup_1a7t2_234",radioLabel:"_radioLabel_1a7t2_239"},zO=({node:e,editorMode:t,onMoveClick:r,reorderDialog:n})=>{var P,U;const{updateNode:s,markDirty:i}=De(),o=t==="edit",a=Yi(e),c=ie(M=>M.relationalFormConfig),d=M=>c==null?void 0:c.find(L=>L.code===M),u=M=>!c||!!d(M),f=(M,L)=>{var j;return((j=d(M))==null?void 0:j.label)||L},[g,y]=h.useState(!0),_=((P=e.metadata)==null?void 0:P.relationalMetadata)??{},[p,v]=h.useState(_.name??e.name??""),[m,b]=h.useState(""),[S,w]=h.useState(Array.isArray(_.keywords)?_.keywords:Array.isArray((U=e.metadata)==null?void 0:U.keywords)?e.metadata.keywords:[]),[E,T]=h.useState(!!_.optional);h.useEffect(()=>{var L,j;const M=((L=e.metadata)==null?void 0:L.relationalMetadata)??{};v(M.name??e.name??""),w(Array.isArray(M.keywords)?M.keywords:Array.isArray((j=e.metadata)==null?void 0:j.keywords)?e.metadata.keywords:[]),T(!!M.optional)},[e.id]);const x=()=>{p.trim()&&p!==e.name&&(s(e.id,{name:p.trim()}),i())},A=()=>{const M=m.trim();if(M&&!S.includes(M)){const L=[...S,M];w(L),s(e.id,{keywords:L}),i()}b("")},$=M=>{const L=S.filter(j=>j!==M);w(L),s(e.id,{keywords:L}),i()},N=M=>{T(M),s(e.id,{optional:M}),i()};return l.jsxs("div",{className:Qe.container,children:[l.jsxs("div",{className:Qe.panelHeader,children:[l.jsxs("div",{className:Qe.panelHeaderLeft,children:[l.jsx("span",{className:`sbx-ct-badge--${a.key}`,children:a.label}),o&&l.jsx("button",{type:"button",className:Qe.moveBtn,onClick:r,children:"Move to another unit"})]}),l.jsx("button",{type:"button",className:Qe.panelCollapseBtn,onClick:()=>y(M=>!M),"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:Qe.titleRow,children:[e.appIcon&&l.jsx("img",{src:e.appIcon,alt:"icon",className:Qe.icon}),l.jsx("input",{type:"text",className:Qe.nameInput,value:p,disabled:!o,onChange:M=>v(M.target.value),onBlur:x,placeholder:"Content name"})]}),u("keywords")&&l.jsxs("div",{className:Qe.field,children:[l.jsx("div",{className:Qe.fieldHeader,children:l.jsxs("label",{className:Qe.label,children:[f("keywords","Keywords"),S.length>0&&l.jsx("span",{className:Qe.fieldCount,children:S.length})]})}),S.length>0&&l.jsx("div",{className:Qe.chips,children:S.map(M=>l.jsxs("span",{className:Qe.chip,children:[M,o&&l.jsx("button",{type:"button",className:Qe.chipRemove,onClick:()=>$(M),children:"×"})]},M))}),o&&l.jsxs("div",{className:Qe.keywordInput,children:[l.jsx("input",{type:"text",className:Qe.input,value:m,placeholder:"Add keyword and press Enter",onChange:M=>b(M.target.value),onKeyDown:M=>{M.key==="Enter"&&(M.preventDefault(),A())}}),l.jsx("button",{type:"button",className:Qe.addBtn,onClick:A,children:"Add"})]})]}),u("optional")&&l.jsxs("div",{className:Qe.field,children:[l.jsx("label",{className:Qe.label,children:f("optional","Optional in Collection")}),l.jsxs("div",{className:Qe.radioGroup,children:[l.jsxs("label",{className:Qe.radioLabel,children:[l.jsx("input",{type:"radio",name:`optional-${e.id}`,checked:E===!0,onChange:()=>N(!0),disabled:!o}),"Yes"]}),l.jsxs("label",{className:Qe.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"},HO=({nodeId:e,value:t,editable:r})=>{const[n,s]=h.useState(!1),{updateNode:i,markDirty:o}=De(),a=d=>{i(e,{appIcon:d}),o(),s(!1)},c=d=>{d.stopPropagation(),i(e,{appIcon:""}),o()};return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:[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(Qc,{size:18})}),t&&r&&l.jsx("button",{type:"button",className:Ms.removeBtn,onClick:c,"aria-label":"Remove icon",children:l.jsx(Yo,{size:11})})]}),n&&l.jsx(Nh,{nodeId:e,currentValue:t,onSelect:a,onClose:()=>s(!1)})]})},Jt={leafContentLayout:"_leafContentLayout_1osey_1",container:"_container_1osey_17",emptyState:"_emptyState_1osey_26",titleRow:"_titleRow_1osey_36",nodeTitle:"_nodeTitle_1osey_52",formArea:"_formArea_1osey_74",contentListArea:"_contentListArea_1osey_78",dropZone:"_dropZone_1osey_83",reviewComment:"_reviewComment_1osey_90",reviewCommentLabel:"_reviewCommentLabel_1osey_103",reviewCommentText:"_reviewCommentText_1osey_109"},WO="application/vnd.sunbird.questionset",Wh="application/vnd.sunbird.question",QO=[WO,Wh],KO=({editorMode:e,onToolbarEvent:t})=>{var U,M,L,j;const[r,n]=h.useState("details"),[s,i]=h.useState([]),[o,a]=h.useState(null),[c,d]=h.useState(!1),u=h.useRef(null),f=h.useRef(),{selectedNodeId:g,breadcrumb:y,activeNodeMeta:_,updateNode:p,treeData:v}=De(),m=ie(Z=>{var te,_e,we,ve;return((_e=(te=Z.editorConfig)==null?void 0:te.context)==null?void 0:_e.contentId)??((ve=(we=Z.editorConfig)==null?void 0:we.context)==null?void 0:ve.identifier)??""}),b=g?Qh(v,g):null,S=!!b&&!b.parent,w=!!(b!=null&&b.isFolder),E=b&&QO.includes(b.mimeType??""),T=(b==null?void 0:b.mimeType)===Wh,x=b&&!b.isFolder&&!E&&!S,A=((U=b==null?void 0:b.metadata)==null?void 0:U.rejectComment)??(S?(L=(M=v[0])==null?void 0:M.metadata)==null?void 0:L.rejectComment:void 0),$=h.useCallback(()=>{const Z=u.current;if(!Z||!g)return;const te=Z.innerText.trim();clearTimeout(f.current),f.current=setTimeout(()=>{p(g,{name:te})},600)},[g,p]),N=h.useCallback(Z=>{t({action:"onFormValueChange",data:Z})},[t]),P=h.useCallback((Z,te)=>{i(te),t({action:"onFormStatusChange",data:{isValid:Z,nodeId:g}})},[t,g]);return b?E?l.jsx(ml,{node:b,editorMode:e,type:"quml",singleQuestion:T}):x?l.jsxs("div",{className:Jt.leafContentLayout,children:[l.jsx(ml,{node:b,editorMode:e,type:"content"}),l.jsx(zO,{node:b,editorMode:e,onMoveClick:()=>a(b.identifier),reorderDialog:o?l.jsx(UO,{resourceId:o,resourceName:b.name,currentUnitId:b.parent??"",onClose:()=>a(null)}):null})]}):l.jsxs("div",{className:Jt.container,children:[l.jsx(V1,{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(HO,{nodeId:g,value:String(b.appIcon??((j=b.metadata)==null?void 0:j.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(q1,{activeTab:r,onChange:Z=>n(Z),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:P},`${g??"none"}:${S?"root":"node"}`)}),(w||S)&&r==="details"&&l.jsx("div",{className:Jt.contentListArea,children:l.jsx(gO,{editorMode:e})}),l.jsx(yO,{isActive:!1,label:"Drop to add content to this unit",nodeId:g??void 0,className:Jt.dropZone}),c&&l.jsx(qO,{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})}})),GO=20;function Gh(){var d;const e=ie(u=>u.editorConfig),t=De(u=>u.selectedNodeId),r=De(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[...Wf];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:[...Wf]}function YO(){const e=Kh(),t=ie(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 T=_?0:e.offset,{content:x,count:A}=await vO({filters:E,query:f,limit:f?50:GO,offset:T,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"},RO={video:Ro,pdf:Ho,h5p:Wo,scorm:Ko,audio:Qo,quiz:qo,default:_n},XO=({item:e,onAdd:t,onPreview:r,isDraggable:n,isAdded:s})=>{var p,v;const i=Yi(e),o=RO[i.key]??_n,a=Za(),c=N1(),d=a&&!s&&c,{attributes:u,listeners:f,setNodeRef:g,isDragging:y}=$c({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})})]})},Yh={chips:"_chips_xhhaq_1",chip:"_chip_xhhaq_1"},ZO=({filters:e,active:t,onChange:r})=>l.jsx("div",{className:Yh.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",Yh.chip].join(" "),onClick:()=>r(n.value),children:n.label},n.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"},JO=[{key:"board",label:"Board"},{key:"medium",label:"Medium"},{key:"gradeLevel",label:"Class"},{key:"subject",label:"Subject"}],eI=new Set(["board","medium","gradeLevel","subject","topic"]),tI=({local:e,toggle:t})=>{const r=Gh();return r.length?l.jsxs("div",{className:it.section,children:[l.jsx("div",{className:it.sectionLabel,children:"Primary Category"}),l.jsx("div",{className:it.chips,children:r.map(n=>l.jsx("button",{type:"button",className:[it.chip,(e.primaryCategory??[]).includes(n)?it.active:""].join(" "),onClick:()=>t("primaryCategory",n),children:n},n))})]}):null},rI=({isOpen:e,filters:t,onApply:r,onClose:n})=>{var p,v;const s=ie(m=>m.editorConfig),i=ie(m=>m.searchFormConfig),o=ie(m=>m.contentFramework),a=ie(m=>m.contentTargetFWIds),{organisationFramework:c}=wh(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=>eI.has(m.code)).map(m=>({key:m.code,label:m.label||m.code})):JO;h.useEffect(()=>{u(t)},[t]);const g=(m,b)=>{u(S=>{const w=S[m]??[],E=w.includes(b)?w.filter(T=>T!==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:it.panel,role:"dialog","aria-label":"Filter library","aria-modal":"true",children:[l.jsxs("div",{className:it.header,children:[l.jsx("span",{className:it.headerTitle,children:"Filters"}),l.jsx("button",{type:"button",className:it.closeBtn,onClick:n,"aria-label":"Close filters",children:l.jsx(zr,{size:16})})]}),l.jsxs("div",{className:it.body,children:[f.map(({key:m,label:b})=>{const S=_(m);return S.length?l.jsxs("div",{className:it.section,children:[l.jsx("div",{className:it.sectionLabel,children:b}),l.jsx("div",{className:it.chips,children:S.slice(0,20).map(w=>l.jsx("button",{type:"button",className:[it.chip,(d[m]??[]).includes(w.name)?it.active:""].join(" "),onClick:()=>g(m,w.name),children:w.name},w.identifier))})]},m):null}),l.jsx(tI,{local:d,toggle:g})]}),l.jsxs("div",{className:it.footer,children:[l.jsx("button",{type:"button",className:it.resetBtn,onClick:()=>u({}),children:"Reset"}),l.jsx("button",{type:"button",className:it.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"},nI="application/vnd.sunbird.questionset",sI=({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 Me.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(ml,{node:n,editorMode:"read",type:e.mimeType===nI?"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)},qe={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 iI(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 oI=({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}=De(),b=e==="edit",[S,w]=h.useState(!1),[E,T]=h.useState({}),[x,A]=h.useState(null),$=h.useMemo(()=>iI(m),[m]),N=h.useCallback(j=>{var _e;if(!v){Ie.error("Select a unit first");return}const Z=(_e=m[0])==null?void 0:_e.id;if(v===Z){Ie("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){Ie.error(`"${j.name}" is already in this collection`);return}Ie.success(`Added "${j.name}"`)},[v,p,m]),P=h.useCallback(j=>{T(j),g(j)},[g]),U=h.useCallback(j=>{A(j)},[]),M=h.useCallback(j=>{N(j),A(null)},[N]),L=h.useMemo(()=>Object.values(E).reduce((j,Z)=>j+((Z==null?void 0:Z.length)??0),0),[E]);return l.jsxs("div",{className:qe.dock,children:[l.jsx("div",{className:qe.header,children:l.jsxs("div",{className:qe.headerLeft,children:[l.jsx("button",{type:"button",className:qe.collapseBtn,onClick:r,"aria-label":"Collapse library panel",title:"Collapse library",children:l.jsx(kv,{size:15})}),l.jsx(Dv,{size:16}),l.jsx("span",{className:qe.headerTitle,children:"Library"}),i>0&&l.jsx("span",{className:qe.count,children:i})]})}),l.jsxs("div",{className:qe.searchRow,children:[l.jsxs("div",{className:qe.searchWrap,children:[l.jsx(Go,{size:14,className:qe.searchIcon}),l.jsx("input",{type:"search",className:qe.searchInput,placeholder:"Search content…",value:a,onChange:j=>u(j.target.value),"aria-label":"Search library"})]}),l.jsx("button",{type:"button",className:[qe.filterToggleBtn,c?qe.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(Sv,{size:15})}),l.jsxs("button",{type:"button",className:[qe.filterToggleBtn,S?qe.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:qe.filterBadge,children:L})]})]}),l.jsx("div",{className:qe.filters,children:l.jsx(ZO,{filters:k1,active:o,onChange:f})}),l.jsxs("div",{className:qe.mainArea,children:[l.jsx("div",{className:qe.cardList,role:"list","aria-label":"Library content",children:s&&n.length===0?Array.from({length:4}).map((j,Z)=>l.jsxs("div",{className:qe.skeleton,"aria-hidden":"true",children:[l.jsx("div",{className:qe.skeletonIcon}),l.jsxs("div",{className:qe.skeletonText,children:[l.jsx("div",{className:qe.skeletonLine}),l.jsx("div",{className:qe.skeletonLineSm})]})]},Z)):n.length>0?l.jsxs(l.Fragment,{children:[n.map(j=>l.jsx(XO,{item:j,onAdd:N,onPreview:U,isDraggable:b,isAdded:$.has(j.identifier)},j.identifier)),d&&l.jsx("button",{type:"button",className:qe.loadMoreBtn,onClick:_,disabled:s,"aria-label":"Load more content",children:s?"Loading…":"Load More"})]}):l.jsxs("div",{className:qe.emptyState,children:[l.jsx(Go,{size:24}),l.jsx("p",{children:"No content found"}),l.jsx("span",{children:"Try a different search or filter"})]})}),S&&l.jsx("div",{className:qe.sidePanelOverlay,children:l.jsx(rI,{isOpen:S,filters:E,onApply:P,onClose:()=>w(!1)})}),x&&l.jsx(sI,{content:x,onAdd:M,onClose:()=>A(null)})]})]})};function aI(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:T,...x}=p??{};E={...d(g.metadata??{},!0),...d(x,!1),name:g.name}}else{const{isNew:T,...x}=p??{};E={name:g.name,visibility:"Parent",...d(x,!0)}}n[_]={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 lI(){const[e,t]=h.useState(!1),r=De(u=>u.treeCache),n=De(u=>u.treeData),s=ie(u=>u.isDirty),i=ie(u=>u.lastSaved),{setIsDirty:o,setLastSaved:a}=ie(),c=ie(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:_}=aI(n,r,f),{identifiers:p}=await r_(u,y,_,g);p&&Object.keys(p).length>0&&De.getState().replaceNodeIds(p);const v=new Date().toISOString();a(v),o(!1)}catch(y){console.error("[useSaveHierarchy] save failed:",y),Ie.error("Failed to save. Please try again.")}finally{t(!1)}},[c,e,n,r,o,a]),isSaving:e,isDirty:s,lastSaved:i}}const cI={};function uI(e){return e==null||e===""||Array.isArray(e)&&e.length===0}function dI(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=Ch(g,y,cI,f,s).filter(v=>v.required&&v.visible!==!1&&v.inputType!=="appIcon"&&uI(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 fI(e){const t=ie(f=>f.editorConfig),r=ie(f=>f.setButtonLoader),n=ie(f=>f.validateAllForms),s=ie(f=>f.rootFormConfig),i=ie(f=>f.unitFormConfig),o=De(f=>f.treeData),a=De(f=>f.treeCache),c=De(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=dI(o,a,s,i,f);if(g.length===0)return!0;const y=g[0];Ie.error(`"${y.nodeName}": please fill required field${y.missing.length>1?"s":""} — ${y.missing.join(", ")}`);const{setFormStatus:_}=ie.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 Ie.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),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 S=(g==null?void 0:g.comment)??"";return await o_(y,S),Ie.success("Content rejected and sent back to the author"),!0}case"publish":return d()?n(o)?(r("publishCollection",!0),await e(),await n_(y,_),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(S){console.error(`[useToolbarActions] ${f} failed`,S);const w=f==="sendForReview"?"send for review":f==="reject"?"reject":"publish";return Ie.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 $t={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"},hI=({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}=De(),_=ie(L=>L.setFormStatus),[p,v]=h.useState(!0),m=De(L=>L.selectedNodeId),{save:b,isSaving:S,isDirty:w,lastSaved:E}=lI(),{runAction:T,checkRequiredFields:x}=fI(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=ic(xo(di,{activationConstraint:{distance:8}})),$=h.useCallback(L=>{var Z;const j=(Z=L.active.data.current)==null?void 0:Z.item;j&&i(j)},[]),N=h.useCallback(L=>{var ve,z;i(null);const j=(ve=L.active.data.current)==null?void 0:ve.item;if(!j)return;const Z=L.over,te=(Z==null?void 0:Z.id)??m??void 0;if(!te){Ie.error("Drop onto a unit to add content");return}const _e=(z=y[0])==null?void 0:z.id;if(te===_e){Ie.error("Drop content onto a unit, not directly on the course.");return}if(!g(j,te)){Ie.error(`"${j.name}" is already in this collection`);return}r==null||r(j,te),Ie.success(`Added "${j.name}" to unit`)},[m,g,r]),P=h.useCallback(async L=>{if(L.action==="onFormStatusChange"){const{isValid:j,nodeId:Z}=L.data??{},te=j!==!1;v(te),Z&&_(Z,te);return}if(L.action==="back"&&w&&e==="edit"){f(!0);return}if(L.action==="saveCollection"){if(!p){Ie.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 T(L.action,L.data)&&(t==null||t(L));return}t==null||t(L)},[b,T,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]),M=h.useCallback(()=>{f(!1),t==null||t({action:"back"})},[t]);return l.jsxs(Lc,{sensors:A,onDragStart:$,onDragEnd:N,children:[l.jsxs("div",{className:$t.shell,children:[l.jsx(y_,{editorMode:e,isSaving:S,isDirty:w,lastSaved:E,isFormValid:p,onToolbarEvent:P}),l.jsxs("div",{className:[$t.workspace,o?$t.sidebarCollapsed:"",c?$t.dockCollapsed:""].filter(Boolean).join(" "),children:[l.jsx("aside",{className:[$t.outline,o?$t.outlineHidden:""].join(" "),"aria-label":"Course outline","aria-hidden":o,children:l.jsx(U1,{editorMode:e,collapsed:o,onToggleCollapse:()=>a(L=>!L)})}),o&&l.jsx("button",{className:$t.reopenTab,onClick:()=>a(!1),title:"Show outline",type:"button",children:"›"}),l.jsx("main",{className:$t.editor,role:"main","aria-label":"Content editor",children:l.jsx(KO,{editorMode:e,onToolbarEvent:P})}),l.jsx("aside",{className:[$t.dock,c?$t.dockHidden:""].filter(Boolean).join(" "),"aria-label":"Content library","aria-hidden":c,children:l.jsx(oI,{editorMode:e,collapsed:c,onToggleCollapse:()=>d(L=>!L)})}),c&&l.jsx("button",{className:$t.dockReopenTab,onClick:()=>d(!1),title:"Show library",type:"button",children:"‹"})]})]}),l.jsx(pv,{dropAnimation:null,children:s?l.jsx("div",{className:$t.dragChip,children:l.jsx("span",{className:$t.dragChipLabel,children:s.name})}):null}),u&&l.jsx(v_,{onSave:U,onDiscard:M,onCancel:()=>f(!1),isSaving:S})]})},pI="v1";function gI(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 Rh(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:gI(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(Rh(o,s))}else n.code&&r.push(Rh(n));return r}function yI(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 vI(e,t,r="Collection",n=pI){var d,u;const i=(u=(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: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:yI(a.schema),frameworkMetadata:c.frameworkMetadata??{},sourcingSettings:c.sourcingSettings??{}}}function mI({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}=ie(),{setTreeData:g,selectNode:y}=De();return h.useEffect(()=>{let _=!1;async function p(){var v,m;try{n(!0),i(null),e.apiBaseUrl&&Yu(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,P=$.targetFWIds??e.context.targetFWIds??null;f(N,P)}const E=e.config.primaryCategory??"Course",T=e.context.channel??"",x=e.config.categoryDefinitionApiVersion??"v1";try{const A=await vI(E,T,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"},bI=new Up({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}});class _I 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 wI(e){const{isLoading:t,error:r}=mI({config:e,onError:e.onError}),n=ie(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(hI,{editorMode:n,onToolbarEvent:e.onToolbarEvent,onContentAdded:e.onContentAdded,onHierarchySaved:e.onHierarchySaved})})}const Xh=e=>l.jsx(_I,{onError:e.onError,children:l.jsxs(qp,{client:bI,children:[l.jsx(wI,{...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 SI(e=""){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function CI(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 EI(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 SI(d)}):Object.keys(e.propTypes),a.attributeChangedCallback=function(d,u,f){var g=n.dashStyleAttributes?CI(d):d;this[g]=f}),o}var Fs={},$s=Me;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 OI(){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 II(e="sb-collection-editor"){if(OI(),typeof customElements>"u"||customElements.get(e))return;const t=EI(Xh,h,Fs,{});customElements.define(e,t)}pe.CollectionEditor=Xh,pe.registerCollectionEditor=II,pe.setApiBaseUrl=Yu,pe.useEditorStore=ie,pe.useLibraryStore=Kh,pe.useTreeStore=De,Object.defineProperty(pe,Symbol.toStringTag,{value:"Module"})});
|
|
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 Kb=class hp{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 hp(function(s){t=s}),cancel:t}}};function Gb(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=Kb,Ge.isCancel=xu,Ge.VERSION=pa,Ge.toFormData=Ei,Ge.AxiosError=R,Ge.Cancel=Ge.CanceledError,Ge.all=function(t){return Promise.all(t)},Ge.spread=Gb,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:XI,AxiosError:ZI,CanceledError:JI,isCancel:eD,CancelToken:tD,VERSION:rD,all:nD,Cancel:sD,isAxiosError:iD,spread:oD,toFormData:aD,AxiosHeaders:lD,HttpStatusCode:cD,formToJSON:uD,getAdapter:dD,mergeConfig:fD,create:hD}=Ge;let ma="";function Yu(e){ma=e}const ke=Ge.create({timeout:3e4});ke.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 Ru=["email","firstName","lastName","identifier","organisations","rootOrgName","phone"];async function Rb(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:Ru,offset:0,limit:t.limit??200};return s?n.email=e.trim():i?n.phone=e.trim():o.query=e,((f=(u=(d=(await ke.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 Xb(e){var r,n,s;return e.length?((s=(n=(r=(await ke.post("/action/user/v1/search",{request:{filters:{userId:e},fields:Ru,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 Zb(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 Xu="/portal";async function Zu(e){var n,s,i,o,a,c,d;const t=await ke.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 Jb(e){var r,n;return e.length?((n=(r=(await ke.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 ke.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 e_(e){const t=await Zu(e),r=ba(t);return{content:t,rootNode:r}}async function t_(e,t,r,n){var i;return((i=(await ke.patch("/action/content/v3/hierarchy/update",{request:{data:{nodesModified:t,hierarchy:r,...n?{lastUpdatedBy:n}:{}}}})).data)==null?void 0:i.result)??{}}async function r_(e,t=""){await ke.post(`/action/content/v3/publish/${e}`,{request:{content:{lastPublishedBy:t}}})}async function n_(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 s_(e){await ke.post(`/action/content/v3/review/${e}`,{request:{content:{}}})}async function i_(e,t){await ke.post(`/action/content/v3/reject/${e}`,{request:{content:{rejectComment:t}}})}async function o_(e,t){await ke.patch(`/action/content/v1/collaborator/update/${e}`,{request:{content:{collaborators:t}}})}const Te={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"},a_=({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 P=await n_(e),U=(P==null?void 0:P.collaborators)??[];if(!U.length)return;const M=await Xb(U);if(N)return;const L=U.map(j=>M.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 P=await Rb(N,{rootOrgId:n,objectType:s}),U=new Set(f.map(M=>M.identifier));c(P.filter(M=>!U.has(M.identifier)))}catch{c([])}finally{u(!1)}},300),()=>{S.current&&clearTimeout(S.current)}},[i,f,n,s]);const w=h.useCallback(N=>{g(P=>P.find(U=>U.identifier===N.identifier)?P:[...P,N]),c(P=>P.filter(U=>U.identifier!==N.identifier)),b(!1)},[]),E=h.useCallback(N=>{g(P=>P.filter(U=>U.identifier!==N)),b(!1)},[]),D=h.useCallback(async()=>{_(!0),v(""),b(!1);try{await o_(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:Te.container,children:[l.jsxs("div",{className:Te.header,children:[l.jsx("h2",{className:Te.title,children:"Manage Collaborators"}),l.jsx("button",{className:Te.closeBtn,onClick:t,"aria-label":"Close",children:"✕"})]}),l.jsxs("div",{className:Te.body,children:[l.jsxs("div",{className:Te.searchSection,children:[l.jsx("label",{className:Te.label,htmlFor:"collab-search",children:"Search users"}),l.jsxs("div",{className:Te.searchRow,children:[l.jsx("input",{id:"collab-search",type:"text",className:Te.searchInput,placeholder:"Search by name or email...",value:i,onChange:N=>o(N.target.value)}),d&&l.jsx("span",{className:Te.searchSpinner,"aria-label":"Searching..."})]}),a.length>0&&l.jsx("ul",{className:Te.resultsList,role:"listbox","aria-label":"Search results",children:a.map(N=>{var P,U,M,L;return l.jsxs("li",{className:Te.resultItem,role:"option","aria-selected":"false",children:[l.jsxs("div",{className:Te.userInfo,children:[l.jsx("span",{className:Te.userName,children:x(N)}),N.email&&l.jsx("span",{className:Te.userEmail,children:N.email}),(((U=(P=N.organisations)==null?void 0:P[0])==null?void 0:U.orgName)??N.rootOrgName)&&l.jsx("span",{className:Te.userOrg,children:((L=(M=N.organisations)==null?void 0:M[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:Te.noResults,children:"No users found."})]}),l.jsxs("div",{className:Te.collabSection,children:[l.jsxs("h3",{className:Te.sectionTitle,children:["Current Collaborators",f.length>0&&l.jsx("span",{className:Te.badge,children:f.length})]}),f.length===0?l.jsx("p",{className:Te.emptyCollab,children:"No collaborators added yet."}):l.jsx("ul",{className:Te.collabList,children:f.map(N=>{var P,U,M,L;return l.jsxs("li",{className:Te.collabItem,children:[l.jsx("div",{className:Te.userAvatar,"aria-hidden":"true",children:x(N).charAt(0).toUpperCase()}),l.jsxs("div",{className:Te.userInfo,children:[l.jsx("span",{className:Te.userName,children:x(N)}),N.email&&l.jsx("span",{className:Te.userEmail,children:N.email}),(((U=(P=N.organisations)==null?void 0:P[0])==null?void 0:U.orgName)??N.rootOrgName)&&l.jsx("span",{className:Te.userOrg,children:((L=(M=N.organisations)==null?void 0:M[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:Te.error,role:"alert",children:p}),m&&l.jsx("p",{className:Te.success,role:"status",children:"Collaborators saved successfully."})]}),l.jsxs("div",{className:Te.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 l_(e){return(await ke.post("/api/dialcode/v1/read",{request:{dialcodes:[e]}})).data}async function c_(e,t){var s;const n=((s=(await ke.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 u_(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 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 d_(e){return e?new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):""}function f_(e){return typeof e=="string"&&e.trim().length>0?e.trim():"Draft"}const h_=({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})]})]})})},p_=({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"})]})]})})},g_=({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"})]})]})})},y_=({editorMode:e,isSaving:t,isDirty:r,lastSaved:n,isFormValid:s=!0,onToolbarEvent:i})=>{var G,ce;const a=De(ee=>ee.treeData)[0],c=(a==null?void 0:a.name)??"Untitled",d=f_(((G=a==null?void 0:a.metadata)==null?void 0:G.status)??(a==null?void 0:a.status)),u=oe(ee=>{var ge,ae,Ye,Ee;return((ae=(ge=ee.editorConfig)==null?void 0:ge.context)==null?void 0:ae.contentId)??((Ee=(Ye=ee.editorConfig)==null?void 0:Ye.context)==null?void 0:Ee.identifier)??""}),{activeModal:f,modalData:g,closeModal:y,openModal:_}=Jv(),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[P,U]=h.useState(!1),[M,L]=h.useState(!1),{updateNode:j}=De(),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 c_(u,ee);ge&&a&&j(a.id,{qrCodeProcessId:ge,reservedDialcodes:ae}),Ie.success('QR Codes generation started. Use "Download QR Codes" once ready.')}catch{Ie.error("Failed to generate QR Codes. Please try again.")}finally{U(!1)}}},[u,a,j]),Oe=h.useCallback(async()=>{if(!X){Ie.error("No QR codes generated yet. Generate QR Codes first.");return}L(!0);try{const ee=await u_(X);if(ee.status==="in-process"){Ie("QR code image generation is in progress. Please try downloading after some time.",{icon:"ℹ️"});return}const ge=ee.url;if(!ge){Ie.error("QR Codes not ready yet. Please wait and try again.");return}const ae=await fetch(ge).then(Ve=>Ve.blob()),Ye=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:"",Re=[u,Ze(Ee.medium),Ze(Ee.gradeLevel),Ze(Ee.subject)].filter(Boolean),qe=new Date().toISOString().replace(/[:.]/g,"-"),re=`${Re.join("_")}_${qe}.zip`,Le=document.createElement("a");Le.href=Ye,Le.download=re,Le.style.display="none",document.body.appendChild(Le),Le.click(),document.body.removeChild(Le),Ie.success("QR codes downloaded.")}catch{Ie.error("Failed to download QR Codes.")}finally{L(!1)}},[X,a,u]),_e=e==="edit",ve=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(vv,{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&&_e?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 ",d_(n)]}):null,!J&&!ve&&!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"})}),_e&&l.jsxs(l.Fragment,{children:[l.jsxs(Fe,{variant:"primary",size:"sm",onClick:()=>E(!0),disabled:p.saveCollection,isLoading:p.saveCollection,children:[l.jsx(Pv,{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(Fv,{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:P,children:[l.jsx(Qc,{size:14}),P?"Generating…":"Generate QR Codes"]}),l.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{x(!1),Oe()},disabled:M||!X,children:[l.jsx(Cv,{size:14}),M?"Downloading…":"Download QR Codes"]})]})]})]}),ve&&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(Mv,{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(rm,{contentId:u,onConfirm:V,onCancel:y}),f==="qualityParams"&&l.jsx(nm,{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(a_,{contentId:u,onClose:y})}),w&&l.jsx(p_,{onConfirm:()=>{E(!1),te("sendForReview")},onCancel:()=>E(!1)}),b&&l.jsx(h_,{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(g_,{onConfirm:se,onCancel:()=>N(!1)})]})},v_=({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 m_=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 b_(){const e=h.useContext(td);if(e===null)throw new Error("Provide a NodesContext");return e}const rd=h.createContext(null);function __(){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=w_(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=S_(t,n);break}r==null||r.focus()}function w_(e,t){return t+1<e.length?e[t+1]:e[0]}function S_(e,t){return t-1>=0?e[t-1]:e[e.length-1]}function 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 C_(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 E_=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:C_,waitFor:hd,walk:xi},Symbol.toStringTag,{value:"Module"})),O_={display:"flex",alignItems:"center",zIndex:1},I_={flex:1,height:"2px",background:"#4B91E2",borderRadius:"1px"},D_={width:"4px",height:"4px",boxShadow:"0 0 0 3px #4B91E2",borderRadius:"50%"},T_=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({},O_),s),children:[l.jsx("div",{style:Object.assign({},D_)}),l.jsx("div",{style:Object.assign({},I_)})]})});function N_({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 k_(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(A_,Object.assign({},e)):l.jsx(x_,Object.assign({},e))]})}function x_(e){return l.jsx(l.Fragment,{children:l.jsx("span",{children:e.node.data.name})})}function A_({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 P_(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 M_(){return{type:"TREE_BLUR"}}function L_(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 F_(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 $_(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 j_(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 B_={position:"fixed",pointerEvents:"none",zIndex:100,left:0,top:0,width:"100%",height:"100%"},U_=e=>{if(!e)return{display:"none"};const{x:t,y:r}=e;return{transform:`translate(${t}px, ${r}px)`}},V_=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(q_,{isDragging:s,children:[l.jsx(z_,{offset:e,children:l.jsx(W_,{id:r,dragIds:n})}),l.jsx(H_,{mouse:t,count:n.length})]})}const q_=h.memo(function(t){return t.isDragging?l.jsx("div",{style:B_,children:t.children}):null});function z_(e){return l.jsx("div",{className:"row preview",style:U_(e.offset),children:e.children})}function H_(e){const{count:t,mouse:r}=e;return t>1?l.jsx("div",{className:"selected-count",style:V_(r),children:t}):null}const W_=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 Q_(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 K_(e,t){return!!(e===t||_d(e)&&_d(t))}function G_(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!K_(e[r],t[r]))return!1;return!0}function Oa(e,t){t===void 0&&(t=G_);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 R_(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 X_=150,Z_=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){Q_(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",P=$?x:0;E[v]=D={position:"absolute",left:N?void 0:P,right:N?P: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=R_(p._resetIsScrolling,X_)},p._resetIsScrolling=function(){p._resetIsScrollingTimeoutId=null,p.setState({isScrolling:!1},function(){p._getItemStyleCache(-1,null)})},p}g.getDerivedStateFromProps=function(p,v){return J_(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?Z_:$,P=p.layout,U=p.outerElementType,M=p.outerTagName,L=p.style,j=p.useIsScrolling,X=p.width,se=this.state.isScrolling,Oe=b==="horizontal"||P==="horizontal",_e=Oe?this._onScrollHorizontal:this._onScrollVertical,ve=this._getRangeToRender(),z=ve[0],J=ve[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||M||"div",{className:m,onScroll:_e,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:Oe?"100%":Z,pointerEvents:se?"none":void 0,width:Oe?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 J_=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.'))}},ew=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]},tw=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):rw(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},rw=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},nw=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 tw(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||ew,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.'))}}),sw=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 iw(){var e,t;const r=Tt(),s=__().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 ow=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 aw=h.forwardRef(function(t,r){const{children:n}=t,s=ow(t,["children"]),i=Tt();return l.jsxs("div",Object.assign({ref:r},s,{onClick:o=>{o.currentTarget===o.target&&i.deselectAll()},children:[l.jsx(lw,{}),n]}))}),lw=()=>{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(iw,{})})};var cw=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 uw=h.forwardRef(function(t,r){var n,s,i,o,{style:a}=t,c=cw(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 dw(e,t,r){return t.split(".").reduce(function(n,s){return n&&n[s]?n[s]:r||null},e)}function fw(e,t){return e.filter(function(r){return r!==t})}function kd(e){return ji(e)==="object"}function hw(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 pw(e,t){return e.filter(function(r){return t.indexOf(r)>-1})}var gw={type:Da,payload:{clientOffset:null,sourceClientOffset:null}};function yw(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)),vw(r,c,d);var u=_w(r,c);if(u===null){e.dispatch(gw);return}var f=null;if(o){if(!a)throw new Error("getSourceClientOffset must be defined");mw(a),f=a(u)}e.dispatch(Nd(o,f));var g=d.getSource(u),y=g.beginDrag(c,u);if(y!=null){bw(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 vw(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 mw(e){de(typeof e=="function","When clientOffset is provided, getSourceClientOffset must be a function.")}function bw(e){de(kd(e),"Item must be an object.")}function _w(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 ww(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 Sw(e){return function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=n.clientOffset;Cw(r);var i=r.slice(0),o=e.getMonitor(),a=e.getRegistry();Ew(i,o,a);var c=o.getItemType();return Ow(i,a,c),Iw(i,o,a),{type:Li,payload:{targetIds:i,clientOffset:s||null}}}}function Cw(e){de(Array.isArray(e),"Expected targetIds to be an array.")}function Ew(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 Ow(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 Iw(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){Dw(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 Dw(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Tw(e){return function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.getMonitor(),s=e.getRegistry();Nw(n);var i=Aw(n);i.forEach(function(o,a){var c=kw(o,a,s,n),d={type:Fi,payload:{dropResult:Ad(Ad({},r),c)}};e.dispatch(d)})}}function Nw(e){de(e.isDragging(),"Cannot call drop while not dragging."),de(!e.didDrop(),"Cannot call drop twice during one drag operation.")}function kw(e,t,r,n){var s=r.getTarget(e),i=s?s.drop(n,e):void 0;return xw(i),typeof i>"u"&&(i=t===0?{}:n.getDropResult()),i}function xw(e){de(typeof e>"u"||kd(e),"Drop result must either be an object or undefined.")}function Aw(e){var t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function Pw(e){return function(){var r=e.getMonitor(),n=e.getRegistry();Mw(r);var s=r.getSourceId();if(s!=null){var i=n.getSource(s,!0);i.endDrag(r,s),n.unpinSource()}return{type:$i}}}function Mw(e){de(e.isDragging(),"Cannot call endDrag while not dragging.")}function Lw(e){return{beginDrag:yw(e),publishDragSource:ww(e),hover:Sw(e),drop:Tw(e),endDrag:Pw(e)}}function Fw(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function $w(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 jw(e,t,r){return t&&$w(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 Bw=function(){function e(t,r){var n=this;Fw(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 jw(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=Lw(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 Uw(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 Vw(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(Hw(e))return"date";if(zw(e))return"error";var r=qw(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 qw(e){return typeof e.constructor=="function"?e.constructor.name:null}function zw(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function Hw(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=Vw(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(!Uw(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 Ww=function(t,r){return t===r};function Qw(e,t){return!e&&!t?!0:!e||!t?!1:e.x===t.x&&e.y===t.y}function Kw(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ww;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){Gw(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 Gw(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 Qw(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 Rw(e){return{type:ka,payload:{sourceId:e}}}function Xw(e){return{type:xa,payload:{targetId:e}}}function Zw(e){return{type:Aa,payload:{sourceId:e}}}function Jw(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){eS(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 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 tS={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function rS(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:tS,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:fw(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 nS(){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 sS(e,t){if(e===Ui)return!1;if(e===Pa||typeof t>"u")return!0;var r=pw(t,e);return r.length>0}function iS(){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=hw(n,i),a=o.length>0||!Kw(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 oS(){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){aS(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 aS(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:iS(e.dirtyHandlerIds,{type:t.type,payload:qd(qd({},t.payload),{},{prevTargetIds:dw(e,"dragOperation.targetIds",[])})}),dragOffset:Yw(e.dragOffset,t),refCount:nS(e.refCount,t),dragOperation:rS(e.dragOperation,t),stateId:oS(e.stateId)}}function cS(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 uS(e){var t=e.clientOffset,r=e.initialClientOffset,n=e.initialSourceClientOffset;return!t||!r||!n?null:zd(cS(t,n),r)}function dS(e){var t=e.clientOffset,r=e.initialClientOffset;return!t||!r?null:zd(t,r)}function fS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function hS(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function pS(e,t,r){return t&&hS(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 gS=function(){function e(t,r){fS(this,e),Hd(this,"store",void 0),Hd(this,"registry",void 0),this.store=t,this.registry=r}return pS(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&&!sS(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 uS(this.store.getState().dragOffset)}},{key:"getDifferenceFromInitialOffset",value:function(){return dS(this.store.getState().dragOffset)}}]),e}(),yS=0;function vS(){return yS++}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 mS(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 bS(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 _S(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 wS=typeof Qd=="function"?_S:Kd;class SS{enqueueTask(t){const{queue:r,requestFlush:n}=this;r.length||(n(),this.flushing=!0),r[r.length]=t}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{const{queue:t}=this;for(;this.index<t.length;){const r=this.index;if(this.index++,t[r].call(),this.index>this.capacity){for(let n=0,s=t.length-this.index;n<s;n++)t[n]=t[n+this.index];t.length-=this.index,this.index=0}}t.length=0,this.index=0,this.flushing=!1},this.registerPendingError=t=>{this.pendingErrors.push(t),this.requestErrorThrow()},this.requestFlush=wS(this.flush),this.requestErrorThrow=Kd(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}}class CS{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 ES{create(t){const r=this.freeTasks,n=r.length?r.pop():new CS(this.onError,s=>r[r.length]=s);return n.task=t,n}constructor(t){this.onError=t,this.freeTasks=[]}}const Gd=new SS,OS=new ES(Gd.registerPendingError);function IS(e){Gd.enqueueTask(OS.create(e))}function DS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function TS(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 NS(e,t,r){return t&&TS(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 kS(e,t){return MS(e)||PS(e,t)||AS(e,t)||xS()}function xS(){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 AS(e,t){if(e){if(typeof e=="string")return Yd(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Yd(e,t)}}function Yd(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function PS(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 MS(e){if(Array.isArray(e))return e}function LS(e){var t=vS().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 Rd(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=kS(s.value,2),a=o[1];if(a===t)return!0;n=!!i}while(!n);return!1}var FS=function(){function e(t){DS(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 NS(e,[{key:"addSource",value:function(r,n){Ma(r),mS(n);var s=this.addHandler(Ut.SOURCE,r,n);return this.store.dispatch(Rw(s)),s}},{key:"addTarget",value:function(r,n){Ma(r,!0),bS(n);var s=this.addHandler(Ut.TARGET,r,n);return this.store.dispatch(Xw(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=Rd(r);return n===Ut.SOURCE}},{key:"isTargetId",value:function(r){var n=Rd(r);return n===Ut.TARGET}},{key:"removeSource",value:function(r){var n=this;de(this.getSource(r),"Expected an existing source."),this.store.dispatch(Zw(r)),IS(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(Jw(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=LS(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 $S(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=jS(n),i=new gS(s,new FS(s)),o=new Bw(s,i),a=e(o,t,r);return o.receiveBackend(a),o}function jS(e){var t=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__;return Fd(lS,e&&t&&t({name:"dnd-core",instanceId:"dnd-core"}))}var BS=["children"];function US(e,t){return HS(e)||zS(e,t)||qS(e,t)||VS()}function VS(){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 qS(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 zS(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 HS(e){if(Array.isArray(e))return e}function WS(e,t){if(e==null)return{};var r=QS(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 QS(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__"),KS=h.memo(function(t){var r=t.children,n=WS(t,BS),s=GS(n),i=US(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 GS(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:$S(e,t,r,n)}),s[qi]}function ef(){return typeof global<"u"?global:window}function RS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function XS(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ZS(e,t,r){return t&&XS(e.prototype,t),e}function 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,JS=function(){function e(t){RS(this,e),tf(this,"internalMonitor",void 0),tf(this,"sourceId",null),this.internalMonitor=t.getMonitor()}return ZS(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 eC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function tC(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function rC(e,t,r){return t&&tC(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,nC=function(){function e(t){eC(this,e),rf(this,"internalMonitor",void 0),rf(this,"targetId",null),this.internalMonitor=t.getMonitor()}return rC(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 sC(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 iC(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;sC(s);var i=r?function(o){return e(o,r)}:e;return oC(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=iC(n);t[r]=function(){return s}}}),t}function sf(e,t){typeof e=="function"?e(t):e.current=t}function oC(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 aC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function lC(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function cC(e,t,r){return t&&lC(e.prototype,t),e}function 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 uC=function(){function e(t){var r=this;aC(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 cC(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 dC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function fC(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function hC(e,t,r){return t&&fC(e.prototype,t),e}function nr(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var pC=function(){function e(t){var r=this;dC(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 hC(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 gC(e,t,r){var n=r.getRegistry(),s=n.addTarget(e,t);return[s,function(){return n.removeTarget(s)}]}function yC(e,t,r){var n=r.getRegistry(),s=n.addSource(e,t);return[s,function(){return n.removeSource(s)}]}var Yr=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 vC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function mC(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function bC(e,t,r){return t&&mC(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 _C=function(){function e(t,r,n){vC(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 bC(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 wC(e,t,r){var n=h.useMemo(function(){return new _C(e,t,r)},[t,r]);return h.useEffect(function(){n.spec=e},[e]),n}function Rr(){var e=h.useContext(Td),t=e.dragDropManager;return de(t!=null,"Expected drag drop context"),t}function SC(e){return h.useMemo(function(){var t=e.type;return de(t!=null,"spec.type must be defined"),t},[e])}function CC(e,t){return DC(e)||IC(e,t)||OC(e,t)||EC()}function EC(){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 OC(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 IC(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(e);!(s=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function DC(e){if(Array.isArray(e))return e}function TC(e,t,r){var n=Rr(),s=wC(e,t,r),i=SC(e);Yr(function(){if(i!=null){var a=yC(i,s,n),c=CC(a,2),d=c[0],u=c[1];return t.receiveHandlerId(d),r.receiveHandlerId(d),u}},[n,t,r,s,i])}function NC(e){return PC(e)||AC(e)||xC(e)||kC()}function kC(){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 xC(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 AC(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function PC(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=NC(t||[]);return t==null&&typeof e!="function"&&r.push(e),h.useMemo(function(){return typeof e=="function"?e():e},r)}function MC(){var e=Rr();return h.useMemo(function(){return new JS(e)},[e])}function LC(e,t){var r=Rr(),n=h.useMemo(function(){return new uC(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 FC=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 $C=Rc(FC);function jC(e,t){return qC(e)||VC(e,t)||UC(e,t)||BC()}function BC(){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 UC(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 VC(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(e);!(s=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function qC(e){if(Array.isArray(e))return e}function cf(e,t,r){var n=h.useState(function(){return t(e)}),s=jC(n,2),i=s[0],o=s[1],a=h.useCallback(function(){var c=t(e);$C(i,c)||(o(c),r&&r())},[i,e,r]);return Yr(a),[i,a]}function zC(e,t){return KC(e)||QC(e,t)||WC(e,t)||HC()}function HC(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
462
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function WC(e,t){if(e){if(typeof e=="string")return 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 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 KC(e){if(Array.isArray(e))return e}function GC(e,t,r){var n=cf(e,t,r),s=zC(n,2),i=s[0],o=s[1];return Yr(function(){var c=e.getHandlerId();if(c!=null)return e.subscribeToStateChange(o,{handlerIds:[c]})},[e,o]),i}function df(e,t,r){return GC(t,e||function(){return{}},function(){return r.reconnect()})}function YC(e){return h.useMemo(function(){return e.hooks.dragSource()},[e])}function RC(e){return h.useMemo(function(){return e.hooks.dragPreview()},[e])}function XC(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=MC(),s=LC(r.options,r.previewOptions);return TC(r,n,s),[df(r.collect,n,s),YC(s),RC(s)]}function ZC(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 JC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function e0(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function t0(e,t,r){return t&&e0(e.prototype,t),e}function 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 r0=function(){function e(t,r){JC(this,e),ff(this,"spec",void 0),ff(this,"monitor",void 0),this.spec=t,this.monitor=r}return t0(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 n0(e,t){var r=h.useMemo(function(){return new r0(e,t)},[t]);return h.useEffect(function(){r.spec=e},[e]),r}function s0(e,t){return l0(e)||a0(e,t)||o0(e,t)||i0()}function i0(){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 o0(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 a0(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 l0(e){if(Array.isArray(e))return e}function c0(e,t,r){var n=Rr(),s=n0(e,t),i=ZC(e);Yr(function(){var a=gC(i,s,n),c=s0(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 u0(){var e=Rr();return h.useMemo(function(){return new nC(e)},[e])}function d0(e){var t=Rr(),r=h.useMemo(function(){return new pC(t.getBackend())},[t]);return Yr(function(){return r.dropTargetOptions=e||null,r.reconnect(),function(){return r.disconnectDropTarget()}},[e]),r}function f0(e){return h.useMemo(function(){return e.hooks.dropTarget()},[e])}function pf(e,t){var r=af(e,t),n=u0(),s=d0(r.options);return c0(r,n,s),[df(r.collect,n,s),f0(s)]}function h0(e,t){return v0(e)||y0(e,t)||g0(e,t)||p0()}function p0(){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 g0(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 y0(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 v0(e){if(Array.isArray(e))return e}function m0(e){var t=Rr(),r=t.getMonitor(),n=cf(r,e),s=h0(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 b0(e,t){return e.filter(function(r){return r!==t})}function _0(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 w0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function S0(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function C0(e,t,r){return t&&S0(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 E0=function(){function e(t){w0(this,e),vf(this,"entered",[]),vf(this,"isNodeInDocument",void 0),this.isNodeInDocument=t}return C0(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=_0(this.entered.filter(i),[r]),s===0&&this.entered.length>0}},{key:"leave",value:function(r){var n=this.entered.length;return this.entered=b0(this.entered.filter(this.isNodeInDocument),r),n>0&&this.entered.length===0}},{key:"reset",value:function(){this.entered=[]}}]),e}(),O0=yf(function(){return/firefox/i.test(navigator.userAgent)}),mf=yf(function(){return!!window.safari});function I0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function D0(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function T0(e,t,r){return t&&D0(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){I0(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 T0(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}(),N0=1;function _f(e){var t=e.nodeType===N0?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 k0(e){var t;return e.nodeName==="IMG"&&(O0()||!((t=document.documentElement)!==null&&t!==void 0&&t.contains(e)))}function x0(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 A0(e,t,r,n,s){var i=k0(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=x0(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 P0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function M0(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function L0(e,t,r){return t&&M0(e.prototype,t),e}function 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 F0=function(){function e(t){P0(this,e),If(this,"item",void 0),If(this,"config",void 0),this.config=t,this.item={},this.initializeExposedProperties()}return L0(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 $0(e,t){var r=new F0(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 j0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function B0(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function U0(e,t,r){return t&&B0(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 V0=function(){function e(t,r){j0(this,e),Wa(this,"ownerDocument",null),Wa(this,"globalContext",void 0),Wa(this,"optionsArgs",void 0),this.globalContext=t,this.optionsArgs=r}return U0(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){be(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 q0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function z0(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function H0(e,t,r){return t&&z0(e.prototype,t),e}function 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 W0=function(){function e(t,r,n){var s=this;q0(this,e),be(this,"options",void 0),be(this,"actions",void 0),be(this,"monitor",void 0),be(this,"registry",void 0),be(this,"enterLeaveCounter",void 0),be(this,"sourcePreviewNodes",new Map),be(this,"sourcePreviewNodeOptions",new Map),be(this,"sourceNodes",new Map),be(this,"sourceNodeOptions",new Map),be(this,"dragStartSourceIds",null),be(this,"dropTargetIds",[]),be(this,"dragEnterTargetIds",[]),be(this,"currentNativeSource",null),be(this,"currentNativeHandle",null),be(this,"currentDragSourceNode",null),be(this,"altKeyPressed",!1),be(this,"mouseMoveTimeoutTimer",null),be(this,"asyncEndDragFrameId",null),be(this,"dragOverTargetIds",null),be(this,"lastClientOffset",null),be(this,"hoverRafId",null),be(this,"getSourceClientOffset",function(i){var o=s.sourceNodes.get(i);return o&&_f(o)||null}),be(this,"endDragNativeItem",function(){s.isDraggingNativeItem()&&(s.actions.endDrag(),s.currentNativeHandle&&s.registry.removeSource(s.currentNativeHandle),s.currentNativeHandle=null,s.currentNativeSource=null)}),be(this,"isNodeInDocument",function(i){return!!(i&&s.document&&s.document.body&&s.document.body.contains(i))}),be(this,"endDragIfSourceWasRemovedFromDOM",function(){var i=s.currentDragSourceNode;i==null||s.isNodeInDocument(i)||s.clearCurrentDragSourceNode()&&s.monitor.isDragging()&&s.actions.endDrag()}),be(this,"handleTopDragStartCapture",function(){s.clearCurrentDragSourceNode(),s.dragStartSourceIds=[]}),be(this,"handleTopDragStart",function(i){if(!i.defaultPrevented){var o=s.dragStartSourceIds;s.dragStartSourceIds=null;var a=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=A0(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()}}}),be(this,"handleTopDragEndCapture",function(){s.clearCurrentDragSourceNode()&&s.monitor.isDragging()&&s.actions.endDrag()}),be(this,"handleTopDragEnterCapture",function(i){s.dragEnterTargetIds=[];var o=s.enterLeaveCounter.enter(i.target);if(!(!o||s.monitor.isDragging())){var a=i.dataTransfer,c=Ha(a);c&&s.beginDragNativeItem(c,a)}}),be(this,"handleTopDragEnter",function(i){var o=s.dragEnterTargetIds;if(s.dragEnterTargetIds=[],!!s.monitor.isDragging()){s.altKeyPressed=i.altKey,o.length>0&&s.actions.hover(o,{clientOffset:Wi(i)});var a=o.some(function(c){return s.monitor.canDropOnTarget(c)});a&&(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect=s.getCurrentDropEffect()))}}),be(this,"handleTopDragOverCapture",function(){s.dragOverTargetIds=[]}),be(this,"handleTopDragOver",function(i){var o=s.dragOverTargetIds;if(s.dragOverTargetIds=[],!s.monitor.isDragging()){i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect="none");return}s.altKeyPressed=i.altKey,s.lastClientOffset=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"))}),be(this,"handleTopDragLeaveCapture",function(i){s.isDraggingNativeItem()&&i.preventDefault();var o=s.enterLeaveCounter.leave(i.target);o&&s.isDraggingNativeItem()&&setTimeout(function(){return s.endDragNativeItem()},0)}),be(this,"handleTopDropCapture",function(i){if(s.dropTargetIds=[],s.isDraggingNativeItem()){var o;i.preventDefault(),(o=s.currentNativeSource)===null||o===void 0||o.loadDataTransfer(i.dataTransfer)}else Ha(i.dataTransfer)&&i.preventDefault();s.enterLeaveCounter.reset()}),be(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()}),be(this,"handleSelectStart",function(i){var o=i.target;typeof o.dragDrop=="function"&&(o.tagName==="INPUT"||o.tagName==="SELECT"||o.tagName==="TEXTAREA"||o.isContentEditable||(i.preventDefault(),o.dragDrop()))}),this.options=new V0(r,n),this.actions=t.getActions(),this.monitor=t.getMonitor(),this.registry=t.getRegistry(),this.enterLeaveCounter=new E0(this.isNodeInDocument)}return H0(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=$0(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 Q0(){return Ki||(Ki=new Image,Ki.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="),Ki}var K0=function(t,r,n){return new W0(t,r,n)};function G0(e,t){return typeof e=="function"?e(t):e??"NODE"}function Y0(e){return e.isDraggable&&!e.isEditing}function R0(e){const t=Tt(),r=t.selectedIds,[n,s,i]=XC(()=>({canDrag:()=>Y0(e),type:G0(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(Q0())},[i]),s}function X0(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 Z0(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 J0(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=X0(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]=Z0(i,a,o,r);if(i&&i.isInternal&&r.inMiddle)return{drop:Gi(i.id,null),cursor:J0(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 e1(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 t1(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(),b_();const n=Tt(),s=t1(t),i=h.useRef(null),o=R0(s),a=e1(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(r1,{})})}function r1(){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:aw,innerElementType:(t=r.props.innerElementType)!==null&&t!==void 0?t:uw,onScroll:r.props.onScroll,onItemsRendered:r.onItemsRendered.bind(r)};return typeof r.props.rowHeight=="function"?l.jsx(nw,Object.assign({},n,{itemSize:r.rowHeightAt,ref:r.list,children:kf})):l.jsx(sw,Object.assign({},n,{itemSize:r.rowHeight,ref:r.list,children:kf}))}function Pf(e){return e.isFiltered?s1(e.root,e.isMatch.bind(e)):n1(e.root)}function n1(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 s1(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}=E_;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(M_())}onItemsRendered(t){this.visibleStartIndex=t.visibleStartIndex,this.visibleStopIndex=t.visibleStopIndex}get renderContainer(){return this.props.renderContainer||Af}get renderRow(){return this.props.renderRow||N_}get renderNode(){return this.props.children||k_}get renderDragPreview(){return this.props.renderDragPreview||md}get renderCursor(){return this.props.renderCursor||T_}}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 i1=typeof Symbol=="function"&&Symbol.observable||"@@observable",Ff=i1,Ya=()=>Math.random().toString(36).substring(7).split("").join("."),o1={INIT:`@@redux/INIT${Ya()}`,REPLACE:`@@redux/REPLACE${Ya()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Ya()}`},Xr=o1;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 a1(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(u1(e))return"date";if(c1(e))return"error";const r=l1(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 l1(e){return typeof e.constructor=="function"?e.constructor.name:null}function c1(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function u1(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=a1(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 d1(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 f1(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{f1(r)}catch(o){i=o}return function(a={},c){if(i)throw i;if(process.env.NODE_ENV!=="production"){const f=d1(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 h1(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 p1=Uf({nodes:Uf({focus:L_,edit:P_,open:F_,selection:$_,drag:h1}),dnd:j_}),g1=Tn();function y1({treeProps:e,imperativeHandle:t,children:r}){const n=h.useRef(null),s=h.useRef(null),i=h.useRef(jf(p1,Tn(e))),o=m_.useSyncExternalStore(i.current.subscribe,i.current.getState,()=>g1),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(KS,Object.assign({},e.dndManager?{manager:e.dndManager}:{backend:e.dndBackend||K0,options:{rootElement:a.props.dndRootElement||void 0}},{children:r}))})})})})}function v1(){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 m1(e){return v1(),e.children}function b1(){const t=Tt().props.renderContainer||Af;return l.jsx(l.Fragment,{children:l.jsx(t,{})})}function _1(){const e=Tt(),{offset:t,mouse:r,item:n,isDragging:s}=m0(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 w1(e={}){var t,r;const n=(t=e.idAccessor)!==null&&t!==void 0?t:"id",s=(r=e.childrenAccessor)!==null&&r!==void 0?r:"children";return{getId:typeof n=="function"?n:i=>i[n],getChildren:typeof s=="function"?s:i=>i[s],childrenKey:typeof s=="string"?s:"children"}}class S1{constructor(t,r={}){this.accessors=w1(r),this.root=C1(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 C1(e,t){const r=new Vf({},null,t,"ROOT");return r.children=e.map(n=>Ra(n,r,t)),r}function Ra(e,t,r){const n=new Vf(e,t,r),s=r.getChildren(e);return s&&(n.children=s.map(i=>Ra(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=Ra(t,this,this.accessors);this.children=(n=this.children)!==null&&n!==void 0?n:[],this.children.splice(r,0,i);const o=this.accessors.childrenKey,a=this.data;a[o]=(s=a[o])!==null&&s!==void 0?s:[],a[o].splice(r,0,t)}removeChild(t){var r,n;(r=this.children)===null||r===void 0||r.splice(t,1),(n=this.data[this.accessors.childrenKey])===null||n===void 0||n.splice(t,1)}update(t){if(this.hasParent()){const r=this.childIndex;this.parent.addChild(Object.assign(Object.assign({},this.data),t),r),this.drop()}}drop(){this.hasParent()&&this.parent.removeChild(this.childIndex)}}let E1=0;function O1(e,t={}){const[r,n]=h.useState(e),s=t.idAccessor,i=t.childrenAccessor,o=h.useMemo(()=>new S1(r,{idAccessor:s,childrenAccessor:i}),[r,s,i]),a=_=>{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-${E1++}`,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 I1(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]=O1(e.initialData,{idAccessor:e.idAccessor,childrenAccessor:e.childrenAccessor});return Object.assign(Object.assign(Object.assign({},e),r),{data:t})}else return e}function D1(e,t){const r=I1(e);return l.jsxs(y1,{treeProps:r,imperativeHandle:t,children:[l.jsx(m1,{children:l.jsx(b1,{})}),l.jsx(_1,{})]})}const T1=h.forwardRef(D1);function Xa(){return De(e=>{var n;const t=e.treeData[0];return(((n=t==null?void 0:t.metadata)==null?void 0:n.status)??(t==null?void 0:t.status)??"Draft").toLowerCase()==="draft"})}function N1(){return De(e=>{var s;if(!e.selectedNodeId)return!1;const t=(s=e.treeData[0])==null?void 0:s.id,r=i=>{var o;for(const a of i){if(a.id===e.selectedNodeId)return a;if((o=a.children)!=null&&o.length){const c=r(a.children);if(c)return c}}},n=r(e.treeData);return!!(n!=null&&n.isFolder)&&n.id!==t})}const 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"],k1=[{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 x1(e){const t=[e.mimeType??"",e.primaryCategory??"",e.contentType??""].join(" ").toLowerCase();return t.includes("video")?"video":t.includes("pdf")||t.includes("epub")?"pdf":t.includes("h5p")?"h5p":t.includes("scorm")?"scorm":t.includes("audio")||t.includes("mp3")?"audio":t.includes("quiz")||t.includes("question")||t.includes("ecml")?"quiz":"default"}function Yi(e){const t=x1(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"},A1={video:Yo,pdf:zo,h5p:Ho,scorm:Qo,audio:Wo,quiz:qo,default:_n},P1=({node:e,style:t,dragHandle:r,editorMode:n})=>{const[s,i]=h.useState(!1),[o,a]=h.useState(!1),[c,d]=h.useState(e.data.name),u=h.useRef(null),f=n==="edit",g=Xa(),y=Yi(e.data),_=A1[y.key]??_n,p=e.isSelected,v=e.level===0,m=e.data.isFolder??(e.children&&e.children.length>0),b=v?bv:m?Ov:_;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(xv,{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 M1(e,t){var i,o;const n=((i=(await ke.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 L1(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 F1(e,t){var a;const r=await M1(e,t.name),n=await L1(r,t),s=new FormData;return s.append("fileUrl",n),s.append("mimeType",t.type||"text/csv"),{processId:(((a=(await ke.post(`/action/collection/v1/import/${e}`,s)).data)==null?void 0:a.result)??{}).processId??""}}async function $1(e){var r;return((r=(await ke.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 ke.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 j1(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"},B1=({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 P=N.dataTransfer.files[0];P&&w(P)},[w]),D=h.useCallback(N=>{var U;const P=(U=N.target.files)==null?void 0:U[0];P&&w(P),N.target.value=""},[w]),x=h.useCallback(async()=>{try{const N=await j1(e),P=document.createElement("a");P.href=N,P.download="sample_hierarchy.csv",P.target="_blank",P.click()}catch{f("Failed to download sample CSV.")}},[e]),A=h.useCallback(async()=>{if(s){d("uploading"),f(""),y([]);try{const{processId:N}=await F1(e,s);if(!N){d("done"),p(null),setTimeout(t,1500);return}d("processing"),m.current=setInterval(async()=>{try{const P=await $1(N);P.status==="COMPLETED"?(b(),d("done"),p(P.successCount??null),P.failedRecords&&P.failedRecords.length>0?y(P.failedRecords):setTimeout(t,1500)):P.status==="FAILED"&&(b(),d("error"),f("Upload processing failed. Please check the error rows below."),P.failedRecords&&y(P.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 P;return N.key==="Enter"&&((P=v.current)==null?void 0:P.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,P)=>l.jsxs("tr",{children:[l.jsx("td",{children:N.rowNumber??P+1}),l.jsx("td",{children:N.name??"—"}),l.jsx("td",{className:Ae.reasonCell,children:N.reason??"Unknown error"})]},P))})]})})]})]}),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"},U1=({editorMode:e,collapsed:t=!1,onToggleCollapse:r})=>{var ve;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}=De(),D=e==="edit",x=Xa(),A=D&&x,$=(((ve=_[0])==null?void 0:ve.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)??""}),P=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]),M=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}:(Ie.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")||Ie.error("Maximum depth reached"))},[_,m]),se=h.useCallback(()=>{p&&(m(p,"subunit")||Ie.error("Maximum depth reached"))},[p,m]),Oe=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{Ie.error("Failed to download CSV")}},[N]),_e=h.useCallback(async()=>{if(f(!1),!!N)try{const{rootNode:z}=await Ju(N);E([z]),Ie.success("Course outline refreshed.")}catch{Ie.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:P&&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:Oe,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(Nv,{size:15}):l.jsx(Tv,{size:15})})]})}),l.jsx("div",{className:sr.treeWrapper,ref:s,children:l.jsx(T1,{ref:n,data:_,idAccessor:"id",childrenAccessor:"children",onSelect:U,onMove:D?M: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(P1,{...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(B1,{contentId:N,mode:g,onComplete:_e,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"},V1=({crumbs:e})=>{const t=De(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(Iv,{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"}],q1=({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("."))),Yf=e=>{const t=e.constructor&&e.constructor.prototype;return ze(t)&&t.hasOwnProperty("isPrototypeOf")},Ri=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(Ri&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!r&&!(ze(e)&&Yf(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"},Rt={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",Rf="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]!==Rt.all&&(t._proxyFormState[o]=!n||Rt.all),r&&(r[o]=!0),e[o]}});return s};const nl=Ri?h.useLayoutEffect:h.useEffect;function z1(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)&&!Yf(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 H1(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=H1({control:s,name:r,defaultValue:d,exact:a}),f=z1({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),W1=({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 Q1=(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(!Ri)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",K1=e=>ll(e)||Ns(e),cl=e=>eo(e)&&e.isConnected;function G1(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:G1(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 R1=e=>{for(const t in e)if(bt(e[t]))return!0;return!1};function sh(e){return Array.isArray(e)||ze(e)&&!R1(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 X1=(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===Rt.onSubmit,isOnBlur:e===Rt.onBlur,isOnChange:e===Rt.onChange,isOnAll:e===Rt.all,isOnTouch:e===Rt.onTouched});const hh="AsyncFunction";var Z1=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)),J1=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 eE=(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||Rt.all))},tE=(e,t,r)=>!e||!t||e===t||Ji(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n))),rE=(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,nE=(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,Rf,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 M=Mt(U)?"":U||"";a?a.forEach(L=>L.setCustomValidity(M)):S.setCustomValidity(M),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=Q1.bind(null,p,n,E),P=(U,M,L,j=Xt.maxLength,X=Xt.minLength)=>{const se=U?M: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:M}=_t(c)?{value:!!c,message:c}:Fn(c);if(U&&(E[p]={type:Xt.required,message:M,ref:S,...N(Xt.required,M)},!n))return w(M),E}if(!$&&(!ut(f)||!ut(g))){let U,M;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)||(M=X<j.value)}else{const X=o.valueAsDate||new Date(b),se=ve=>new Date(new Date().toDateString()+" "+ve),Oe=o.type=="time",_e=o.type=="week";_t(L.value)&&b&&(U=Oe?se(b)>se(L.value):_e?b>L.value:X>new Date(L.value)),_t(j.value)&&b&&(M=Oe?se(b)<se(j.value):_e?b<j.value:X<new Date(j.value))}if((U||M)&&(P(!!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),M=Fn(u),L=!ut(U.value)&&b.length>+U.value,j=!ut(M.value)&&b.length<+M.value;if((L||j)&&(P(L,U.message,M.message),!n))return w(E[p].message),E}if(y&&!$&&_t(b)){const{value:U,message:M}=Fn(y);if(to(U)&&!b.match(U)&&(E[p]={type:Xt.pattern,message:M,ref:o,...N(Xt.pattern,M)},!n))return w(M),E}if(_){if(bt(_)){const U=await _(b,r),M=yh(U,S);if(M&&(E[p]={...M,...N(Xt.validate,M.message)},!n))return w(M.message),E}else if(ze(_)){let U={};for(const M in _){if(!nt(U)&&!n)break;const L=yh(await _[M](b,r),S,M);L&&(U={...L,...N(M,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 sE={mode:Rt.onSubmit,reValidateMode:Rt.onChange,shouldFocusError:!0},mh={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function iE(e={}){let t={...sE,...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===Rt.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 M({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),nE(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)):Oe(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,X1(C||a.mount,n,t.criteriaMode,t.shouldUseNativeValidation))),P=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},M=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&&Z1(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 M({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,[]):[])),Oe=(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)},_e=(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)?_e(H,Q,k,B):Oe(H,Q,k,B)}},ve=(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?Oe(C,H,k,B):_e(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={})=>ve(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)ve(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=!J1(q._f)&&!e.validate&&!t.resolver&&!K(r.errors,k)&&!q._f.deps||rE(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 M({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 P(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 M({fields:H&&H._f?{[Q]:H}:H,eventType:kr.TRIGGER})}))).every(Boolean),!(!B&&!r.isValid)&&v()):B=k=await M({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),Ye=C=>y.state.subscribe({next:T=>{if(tE(C.name,T.name,C.exact)&&eE(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},Ye({...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()},Re=({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?Re({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=K1(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 M({fields:n,eventType:kr.SUBMIT});if(a.disabled.size)for(const Q of a.disabled)Xe(q,Q);if(Xe(r.errors,Rf),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(Ri&&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:Ye,_runSchema:N,_updateIsValidating:m,_focusError:re,_getWatch:X,_getDirty:j,_setValid:v,_setFieldArray:S,_setDisabledField:Re,_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 oE(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}=iE(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 ke.get(`/api/framework/v1/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.framework}async function aE(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 _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 lE(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:()=>aE({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 cE(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 uE(e){var r,n,s,i,o,a;const t=pn({queryKey:["channel",e],queryFn:()=>cE(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 dE(e){const{data:t}=pn({queryKey:["user","read",e],enabled:!!e,staleTime:1/0,queryFn:()=>Zb(e)});return t&&([t.firstName,t.lastName].filter(Boolean).join(" ").trim()||t.userName)||void 0}const fE={"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."}},hE=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"},pE={Categorisation:"Second Section","Basic Information":"First Section","Licensing & Attribution":"Fourth Section",Curriculum:"Organisation Framework Terms","Target Audience":"Target Framework Terms"},gE={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 NE(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=SE(a),u=CE(a,r,t,i,s),f=t[c],g=vE(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:yE(c,a.editable!==!1,s),placeholder:a.placeholder,maxLength:a.maxLength,options:_E(u,g,d,r),depends:a.depends,tab:wE(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 yE(e,t,r){var i;const n=r.editorMode??"edit";if(!hE.has(n))return t!==!1;const s=(i=r.editableFields)==null?void 0:i[n];return!!(s&&s.includes(e))}function vE(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!==""?mE(Number(a)):t}default:return t}}function mE(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 bE(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 _E(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=bE(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 wE(e){const t=e.section;if(t){if(ro[t])return ro[t];const n=pE[t];if(n&&ro[n])return ro[n]}const r=e.code??"";return gE[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 SE(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 CE(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?DE(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 EE(e,t){return wh.has(e)||t.output==="identifier"||typeof t.section=="string"&&t.section.includes("Target")}function OE(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 IE(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 DE(e){return Array.from(new Set(e))}function TE(e){return Array.isArray(e)?e:e!=null&&e!==""?[e]:[]}function Eh(e,t,r,n,s,i){const o=EE(e,r),a=OE(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=>TE(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()),_=IE(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 NE(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 kE=["allowECM","levels","setPeriod","instances"];function Oh(e){const t={};return e.forEach((r,n)=>{t[`L${n+1}`]={label:r}}),t}function xE(e,t={}){const r={...e};for(const i of kE)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 AE(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 PE(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"},ME=({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)})]})},LE=({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)})]})},FE=({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)})]})},$E=({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)})]})},jE=({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 BE(e,t,r,n){var o,a;const i=(a=(o=(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:o.result)==null?void 0:a.node_id;if(!i)throw new Error("Asset creation failed: no node_id returned");return i}async function UE(e,t){var s,i;const n=(i=(s=(await ke.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 VE(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 qE(e,t,r){var o,a;const n=new FormData;n.append("fileUrl",t),n.append("mimeType",r);const i=(a=(o=(await ke.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),P=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)??""}),M=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),P&&(ee.channel=P);const ae=((ce=(await ke.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)??{},Ye=ae.content??[];f(ae.count??0),d(Ee=>G?[...Ee,...Ye]:Ye)}catch{}finally{y(!1)}},[s,U,P]);h.useEffect(()=>{s!=="upload"&&(d([]),m(0),X(o,0))},[s]);const se=h.useRef(),Oe=V=>{a(V),clearTimeout(se.current),se.current=setTimeout(()=>{d([]),m(0),X(V,0)},400)},_e=()=>{const V=v+Dh;m(V),X(o,V,!0)},ve=()=>{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 BE(b.name.split(".").slice(0,-1).join(".")||b.name,b.type,U,P),Z=await UE(V,b.name);await VE(Z,b,M);const G=Z.split("?")[0],ce=await qE(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=>Oe(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:_e,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:ve,children:"Use Selected"})]})]})})},zE=({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)})]})},HE=({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)})]})},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},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)})]})},QE=({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"}],KE=({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)})]})},GE=({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 l_(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(wv,{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,Re,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??((Re=a==null?void 0:a.context)==null?void 0:Re.targetFWIds)),{frameworks:v,collectionAdditionalCategories:m,contentAdditionalCategories:b,defaultLicense:S,name:w}=uE((qe=a==null?void 0:a.context)==null?void 0:qe.channel),E=dE(((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=lE(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=De(W=>W.selectedNodeId),$=De(W=>W.treeData),N=De(W=>W.treeCache),P=A?N[A]??{}:{},U={...e,...P},M=h.useMemo(()=>{var fe;if(!A)return 0;const W=[...$];for(;W.length;){const me=W.shift();if(me.id===A)return((fe=me.children)==null?void 0:fe.length)??0;me.children&&W.push(...me.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:M},se=r?c:d,Oe=se||(((Wt=a==null?void 0:a.config.hierarchy)==null?void 0:Wt.formConfig)??[]),_e=Sh(Oe,U,x,r,X),ve=_e.filter(W=>W.tab===t&&W.inputType!=="appIcon"&&W.visible!==!1),z=oE({mode:"onChange",defaultValues:Object.fromEntries(_e.map(W=>{const fe=["multiselect","chips","keywords","tagsinput"],me=["nestedselect"];return fe.includes(W.inputType)?[W.code,W.currentValue??W.defaultValue??[]]:me.includes(W.inputType)?[W.code,W.currentValue??W.defaultValue??{}]:[W.code,W.currentValue??W.defaultValue??""]}))});PE(z,_e);const{updateNode:J}=De(),te=h.useRef(_e);te.current=_e;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(me=>me.currentValue!==void 0&&me.currentValue!==null).map(me=>[me.code,me.currentValue]));Object.keys(fe).length>0&&J(W,fe)}z.trigger().then(()=>{const fe=z.formState.errors,me=te.current,dr=Array.from(new Set(Object.keys(fe).map(mr=>{var C;return(C=me.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:me})=>{const dr=V.current;if(!dr)return;const mr=te.current,C=new Set(mr.map(B=>B.code));if(me&&C.has(me)){let B=z.getValues(me);me==="dialcodes"&&(B=Array.isArray(B)?B:B?[B]:[]),me==="shuffle"&&(B===!0&&ce.current===!1&&Ie("Shuffling is enabled for this question set.",{icon:"ℹ️"}),ce.current=B);const q=AE(me,B);q&&(J(dr,q),Z.current(q))}else if(!me){const B=z.getValues(),q=Object.fromEntries(Object.entries(B).filter(([H])=>C.has(H))),Q=xE(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 me=z.getValues(W);(me==null||me==="")&&z.setValue(W,fe.currentValue,{shouldDirty:!1})}},[E,w,z]);const Ye=ve.reduce((W,fe)=>{const me=W[W.length-1];return me&&me.section===fe.section?me.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(LE,{...fe,options:W.options??[]});case"multiselect":return l.jsx(FE,{...fe,options:W.options??[]});case"chips":return l.jsx($E,{...fe});case"radio":return l.jsx(jE,{...fe,options:W.options??[]});case"appIcon":return l.jsx(zE,{...fe,nodeId:A??""});case"datepicker":case"datetime":return l.jsx(HE,{...fe});case"keywords":case"tagsinput":return l.jsx(WE,{...fe});case"nestedselect":return l.jsx(QE,{...fe,levels:W.levels??[]});case"license":return l.jsx(KE,{...fe});case"dialcode":return l.jsx(GE,{...fe});default:return l.jsx(Ih,{...fe,maxLength:W.maxLength})}};return l.jsx(W1,{...z,children:l.jsxs("div",{className:gl.form,children:[Ye.map((W,fe)=>{const me=W.section?fE[W.section]:void 0;return me?l.jsx(ME,{title:me.title,description:me.description,children:W.fields.map(Ee)},W.section??fe):l.jsx("div",{className:gl.ungrouped,children:W.fields.map(Ee)},fe)}),ve.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 RE(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 XE(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 ZE(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},JE=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=eO(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 eO(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 tO(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=!XE(y,m.current),S=v!==-1&&p===-1||b,w=ZE(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:RE(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 rO=e=>{let{id:t,items:r,activeIndex:n,overIndex:s}=e;return kh(r,n,s).indexOf(t)},nO=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},sO={duration:200,easing:"ease"},Mh="transform",iO=Ir.Transition.toString({property:Mh,duration:0,easing:"linear"}),oO={roleDescription:"sortable"};function aO(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 lO(e){let{animateLayoutChanges:t=nO,attributes:r,disabled:n,data:s,getNewIndex:i=rO,id:o,strategy:a,resizeObserverConfig:c,transition:d=sO}=e;const{items:u,containerId:f,activeIndex:g,disabled:y,disableTransforms:_,sortedRects:p,overIndex:v,useDragOverlay:m,strategy:b}=h.useContext(Ph),S=cO(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}=rv({id:o,data:E,disabled:S.droppable,resizeObserverConfig:{updateMeasurementsFor:D,...c}}),{active:P,activatorEvent:U,activeNodeRect:M,attributes:L,setNodeRef:j,listeners:X,isDragging:se,over:Oe,setActivatorNodeRef:_e,transform:ve}=Fc({id:o,data:E,attributes:{...oO,...r},disabled:S.draggable}),z=Vg(N,j),J=!!P,te=J&&!_&&no(g)&&no(v),V=!m&&se,Z=V&&te?ve:null,ce=te?Z??(a??b)({rects:p,activeNodeRect:M,activeIndex:g,overIndex:v,index:w}):null,ee=no(g)&&no(v)?i({id:o,items:u,activeIndex:g,overIndex:v}):w,ge=P==null?void 0:P.id,ae=h.useRef({activeId:ge,items:u,newIndex:ee,containerId:f}),Ye=u!==ae.current.items,Ee=t({active:P,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=aO({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:P,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:Oe,setNodeRef:z,setActivatorNodeRef:_e,setDroppableNodeRef:N,setDraggableNodeRef:j,transform:Ze??ce,transition:Re()};function Re(){if(Ze||Ye&&ae.current.newIndex===w)return iO;if(!(V&&!ai(U)||!d)&&(J||Ee))return Ir.Transition.toString({...d,property:Mh})}}function cO(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 uO=[Se.Down,Se.Right,Se.Up,Se.Left],dO=(e,t)=>{let{context:{active:r,collisionRect:n,droppableRects:s,droppableContainers:i,over:o,scrollableAncestors:a}}=t;if(uO.includes(e.code)){if(e.preventDefault(),!r||!n)return;const c=[];i.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;const g=s.get(f.id);if(g)switch(e.code){case Se.Down:n.top<g.top&&c.push(f);break;case Se.Up:n.top>g.top&&c.push(f);break;case Se.Left:n.left>g.left&&c.push(f);break;case Se.Right:n.left<g.left&&c.push(f);break}});const d=sy({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=fO(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 fO(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"},hO={video:Yo,pdf:zo,h5p:Ho,scorm:Qo,audio:Wo,quiz:qo,default:_n},pO=({item:e,onRemove:t,isEditable:r})=>{const n=Yi(e),s=hO[n.key]??_n,{attributes:i,listeners:o,setNodeRef:a,transform:c,transition:d,isDragging:u}=lO({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"},gO=({editorMode:e})=>{const{selectedNodeId:t,getChildrenOf:r,reorderChildren:n,deleteNode:s}=De(),i=t?r(t):[],o=e==="edit",a=sc(xo(di,{activationConstraint:{distance:5}}),xo(Fo,{coordinateGetter:dO})),c=h.useCallback(u=>{const{active:f,over:g}=u;if(!g||f.id===g.id||!t)return;const y=De.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:ny,onDragEnd:c,children:l.jsx(tO,{items:i.map(u=>u.id),strategy:JE,children:l.jsx("div",{className:tn.list,role:"list",children:i.map(u=>l.jsx(pO,{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"},yO=({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 vO(e){var o;const t={status:["Live"],...e.filters??{}};e.channel&&(t.channel=e.channel);const n=((o=(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: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 mO(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 $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 bO(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 _O(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 Jb(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",wO="/assets/quml-player/styles.css",Vh="sunbird-quml-player";function SO(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=wO,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:SO(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"},CO="application/vnd.sunbird.questionset";function EO(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===CO)return s.identifier;s=s.parent?r.get(s.parent):void 0}return null}const OO=[{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 IO(e){return OO.find(t=>t.mimes.includes(e))??{key:"other",label:"Content",icon:"📱"}}const DO={"pdf-player":["application/pdf"],"video-player":["video/mp4","video/webm"],"epub-player":["application/epub"]},TO={"pdf-player":"/assets/sunbird-pdf-player.js","video-player":"/assets/sunbird-video-player.js","epub-player":"/assets/sunbird-epub-player.js"},NO={"pdf-player":"sunbird-pdf-player","video-player":"sunbird-video-player","epub-player":"sunbird-epub-player"},kO="/content/preview/preview.html?webview=true&build_number=2.8.0.e552fcd";function yl(e){for(const[t,r]of Object.entries(DO))if(r.includes(e))return t;return"default-player"}function xO(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 AO(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 PO(e,t,r=100){await AO(TO[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 MO=[{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 LO({node:e}){const t=e.metadata??{},r=MO.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 FO({mimeType:e}){const t=IO(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(jO,{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(FO,{mimeType:e.mimeType??""})]}),l.jsx($O,{node:e})]}),l.jsx(LO,{node:e})]})};function $O({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)??kO;h.useEffect(()=>{let m=!1;return f(!1),i(!1),a(null),d(e.metadata??{}),n(yl(e.mimeType??"")),mO(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=xO(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=NO[r];if(!b)return;const S=p;PO(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 jO({node:e,editorMode:t,singleQuestion:r}){const n=oe(g=>g.editorConfig),s=De(g=>g.treeData),i=h.useRef(null),o=r?EO(s,e.id):e.identifier,{data:a,isLoading:c,error:d}=_O(o??"",{enabled:!!o}),u=h.useMemo(()=>a?r?bO(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 BO(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 UO=({resourceId:e,resourceName:t,currentUnitId:r,onClose:n})=>{var u;const{treeData:s,moveNode:i}=De(),o=BO(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(Ev,{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 VO(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 qO=({onClose:e})=>{const{treeData:t,updateNode:r}=De(),n=VO(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(Av,{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"},zO=({node:e,editorMode:t,onMoveClick:r,reorderDialog:n})=>{var P,U;const{updateNode:s,markDirty:i}=De(),o=t==="edit",a=Yi(e),c=oe(M=>M.relationalFormConfig),d=M=>c==null?void 0:c.find(L=>L.code===M),u=M=>!c||!!d(M),f=(M,L)=>{var j;return((j=d(M))==null?void 0:j.label)||L},[g,y]=h.useState(!0),_=((P=e.metadata)==null?void 0:P.relationalMetadata)??{},[p,v]=h.useState(_.name??e.name??""),[m,b]=h.useState(""),[S,w]=h.useState(Array.isArray(_.keywords)?_.keywords:Array.isArray((U=e.metadata)==null?void 0:U.keywords)?e.metadata.keywords:[]),[E,D]=h.useState(!!_.optional);h.useEffect(()=>{var L,j;const M=((L=e.metadata)==null?void 0:L.relationalMetadata)??{};v(M.name??e.name??""),w(Array.isArray(M.keywords)?M.keywords:Array.isArray((j=e.metadata)==null?void 0:j.keywords)?e.metadata.keywords:[]),D(!!M.optional)},[e.id]);const x=()=>{p.trim()&&p!==e.name&&(s(e.id,{name:p.trim()}),i())},A=()=>{const M=m.trim();if(M&&!S.includes(M)){const L=[...S,M];w(L),s(e.id,{keywords:L}),i()}b("")},$=M=>{const L=S.filter(j=>j!==M);w(L),s(e.id,{keywords:L}),i()},N=M=>{D(M),s(e.id,{optional:M}),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(M=>!M),"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(_v,{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:M=>v(M.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(M=>l.jsxs("span",{className:He.chip,children:[M,o&&l.jsx("button",{type:"button",className:He.chipRemove,onClick:()=>$(M),children:"×"})]},M))}),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:M=>b(M.target.value),onKeyDown:M=>{M.key==="Enter"&&(M.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"},HO=({nodeId:e,value:t,editable:r})=>{const[n,s]=h.useState(!1),{updateNode:i,markDirty:o}=De(),a=d=>{i(e,{appIcon:d}),o(),s(!1)},c=d=>{d.stopPropagation(),i(e,{appIcon:""}),o()};return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:[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"},WO="application/vnd.sunbird.questionset",Hh="application/vnd.sunbird.question",QO=[WO,Hh],KO=({editorMode:e,onToolbarEvent:t})=>{var U,M,L,j;const[r,n]=h.useState("details"),[s,i]=h.useState([]),[o,a]=h.useState(null),[c,d]=h.useState(!1),u=h.useRef(null),f=h.useRef(),{selectedNodeId:g,breadcrumb:y,activeNodeMeta:_,updateNode:p,treeData:v}=De(),m=oe(X=>{var se,Oe,_e,ve;return((Oe=(se=X.editorConfig)==null?void 0:se.context)==null?void 0:Oe.contentId)??((ve=(_e=X.editorConfig)==null?void 0:_e.context)==null?void 0:ve.identifier)??""}),b=g?Wh(v,g):null,S=!!b&&!b.parent,w=!!(b!=null&&b.isFolder),E=b&&QO.includes(b.mimeType??""),D=(b==null?void 0:b.mimeType)===Hh,x=b&&!b.isFolder&&!E&&!S,A=((U=b==null?void 0:b.metadata)==null?void 0:U.rejectComment)??(S?(L=(M=v[0])==null?void 0:M.metadata)==null?void 0:L.rejectComment:void 0),$=h.useCallback(()=>{const X=u.current;if(!X||!g)return;const se=X.innerText.trim();clearTimeout(f.current),f.current=setTimeout(()=>{p(g,{name:se})},600)},[g,p]),N=h.useCallback(X=>{t({action:"onFormValueChange",data:X})},[t]),P=h.useCallback((X,se)=>{i(se),t({action:"onFormStatusChange",data:{isValid:X,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(zO,{node:b,editorMode:e,onMoveClick:()=>a(b.identifier),reorderDialog:o?l.jsx(UO,{resourceId:o,resourceName:b.name,currentUnitId:b.parent??"",onClose:()=>a(null)}):null})]}):l.jsxs("div",{className:Jt.container,children:[l.jsx(V1,{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(HO,{nodeId:g,value:String(b.appIcon??((j=b.metadata)==null?void 0:j.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(q1,{activeTab:r,onChange:X=>n(X),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:P},`${g??"none"}:${S?"root":"node"}`)}),(w||S)&&r==="details"&&l.jsx("div",{className:Jt.contentListArea,children:l.jsx(gO,{editorMode:e})}),l.jsx(yO,{isActive:!1,label:"Drop to add content to this unit",nodeId:g??void 0,className:Jt.dropZone}),c&&l.jsx(qO,{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 Wh(e,t){for(const r of e){if(r.id===t)return r;if(r.children){const n=Wh(r.children,t);if(n)return n}}}const Qh=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})}})),GO=20;function Kh(){var d;const e=oe(u=>u.editorConfig),t=De(u=>u.selectedNodeId),r=De(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=Qh(),t=oe(f=>{var g,y;return((y=(g=f.editorConfig)==null?void 0:g.context)==null?void 0:y.channel)??""}),r=Kh(),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 vO({filters:E,query:f,limit:f?50:GO,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"},RO={video:Yo,pdf:zo,h5p:Ho,scorm:Qo,audio:Wo,quiz:qo,default:_n},XO=({item:e,onAdd:t,onPreview:r,isDraggable:n,isAdded:s})=>{var p,v;const i=Yi(e),o=RO[i.key]??_n,a=Xa(),c=N1(),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})})]})},Gh={chips:"_chips_xhhaq_1",chip:"_chip_xhhaq_1"},ZO=({filters:e,active:t,onChange:r})=>l.jsx("div",{className:Gh.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",Gh.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"},JO=[{key:"board",label:"Board"},{key:"medium",label:"Medium"},{key:"gradeLevel",label:"Class"},{key:"subject",label:"Subject"}],eI=new Set(["board","medium","gradeLevel","subject","topic"]),tI=({local:e,toggle:t})=>{const r=Kh();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},rI=({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=>eI.has(m.code)).map(m=>({key:m.code,label:m.label||m.code})):JO;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(tI,{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"},nI="application/vnd.sunbird.questionset",sI=({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===nI?"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 iI(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 oI=({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}=De(),b=e==="edit",[S,w]=h.useState(!1),[E,D]=h.useState({}),[x,A]=h.useState(null),$=h.useMemo(()=>iI(m),[m]),N=h.useCallback(j=>{var Oe;if(!v){Ie.error("Select a unit first");return}const X=(Oe=m[0])==null?void 0:Oe.id;if(v===X){Ie("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){Ie.error(`"${j.name}" is already in this collection`);return}Ie.success(`Added "${j.name}"`)},[v,p,m]),P=h.useCallback(j=>{D(j),g(j)},[g]),U=h.useCallback(j=>{A(j)},[]),M=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(kv,{size:15})}),l.jsx(Dv,{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(mv,{size:15}):l.jsx(Sv,{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(Lv,{size:15}),L>0&&l.jsx("span",{className:Ue.filterBadge,children:L})]})]}),l.jsx("div",{className:Ue.filters,children:l.jsx(ZO,{filters:k1,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(XO,{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(rI,{isOpen:S,filters:E,onApply:P,onClose:()=>w(!1)})}),x&&l.jsx(sI,{content:x,onAdd:M,onClose:()=>A(null)})]})]})};function aI(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 lI(){const[e,t]=h.useState(!1),r=De(u=>u.treeCache),n=De(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:_}=aI(n,r,f),{identifiers:p}=await t_(u,y,_,g);p&&Object.keys(p).length>0&&De.getState().replaceNodeIds(p);const v=new Date().toISOString();a(v),o(!1)}catch(y){console.error("[useSaveHierarchy] save failed:",y),Ie.error("Failed to save. Please try again.")}finally{t(!1)}},[c,e,n,r,o,a]),isSaving:e,isDirty:s,lastSaved:i}}const cI={};function uI(e){return e==null||e===""||Array.isArray(e)&&e.length===0}function dI(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,cI,f,s).filter(v=>v.required&&v.visible!==!1&&v.inputType!=="appIcon"&&uI(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 fI(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=De(f=>f.treeData),a=De(f=>f.treeCache),c=De(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=dI(o,a,s,i,f);if(g.length===0)return!0;const y=g[0];Ie.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 Ie.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 s_(y),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 S=(g==null?void 0:g.comment)??"";return await i_(y,S),Ie.success("Content rejected and sent back to the author"),!0}case"publish":return d()?n(o)?(r("publishCollection",!0),await e(),await r_(y,_),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(S){console.error(`[useToolbarActions] ${f} failed`,S);const w=f==="sendForReview"?"send for review":f==="reject"?"reject":"publish";return Ie.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"},hI=({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}=De(),_=oe(L=>L.setFormStatus),[p,v]=h.useState(!0),m=De(L=>L.selectedNodeId),{save:b,isSaving:S,isDirty:w,lastSaved:E}=lI(),{runAction:D,checkRequiredFields:x}=fI(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 ve,z;i(null);const j=(ve=L.active.data.current)==null?void 0:ve.item;if(!j)return;const X=L.over,se=(X==null?void 0:X.id)??m??void 0;if(!se){Ie.error("Drop onto a unit to add content");return}const Oe=(z=y[0])==null?void 0:z.id;if(se===Oe){Ie.error("Drop content onto a unit, not directly on the course.");return}if(!g(j,se)){Ie.error(`"${j.name}" is already in this collection`);return}r==null||r(j,se),Ie.success(`Added "${j.name}" to unit`)},[m,g,r]),P=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){Ie.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]),M=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(y_,{editorMode:e,isSaving:S,isDirty:w,lastSaved:E,isFormValid:p,onToolbarEvent:P}),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(U1,{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(KO,{editorMode:e,onToolbarEvent:P})}),l.jsx("aside",{className:[Ft.dock,c?Ft.dockHidden:""].filter(Boolean).join(" "),"aria-label":"Content library","aria-hidden":c,children:l.jsx(oI,{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(hv,{dropAnimation:null,children:s?l.jsx("div",{className:Ft.dragChip,children:l.jsx("span",{className:Ft.dragChipLabel,children:s.name})}):null}),u&&l.jsx(v_,{onSave:U,onDiscard:M,onCancel:()=>f(!1),isSaving:S})]})},pI="v1";function gI(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:gI(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 yI(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 vI(e,t,r="Collection",n=pI){var d,u;const i=(u=(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: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:yI(a.schema),frameworkMetadata:c.frameworkMetadata??{},sourcingSettings:c.sourcingSettings??{}}}function mI({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}=De();return h.useEffect(()=>{let _=!1;async function p(){var v,m;try{n(!0),i(null),e.apiBaseUrl&&Yu(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 e_(b):await Ju(b);if(!_&&(g(w?[w]:[]),w)){y(w.id);const $=w.metadata??{},N=$.framework??e.context.framework??null,P=$.targetFWIds??e.context.targetFWIds??null;f(N,P)}const E=e.config.primaryCategory??"Course",D=e.context.channel??"",x=e.config.categoryDefinitionApiVersion??"v1";try{const A=await vI(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"},bI=new Bp({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}});class _I 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 wI(e){const{isLoading:t,error:r}=mI({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(hI,{editorMode:n,onToolbarEvent:e.onToolbarEvent,onContentAdded:e.onContentAdded,onHierarchySaved:e.onHierarchySaved})})}const Rh=e=>l.jsx(_I,{onError:e.onError,children:l.jsxs(Vp,{client:bI,children:[l.jsx(wI,{...e}),l.jsx(Ug,{position:"top-right",toastOptions:{duration:3e3}})]})}),lo=Symbol.for("r2wc.reactRender"),Xh=Symbol.for("r2wc.shouldRender"),co=Symbol.for("r2wc.root");function SI(e=""){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function CI(e=""){return e.replace(/-([a-z0-9])/g,function(t){return t[1].toUpperCase()})}var Zh={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 EI(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&&Zh.expando(g,u,f),Reflect.set(d,u,f,g)):(Zh.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[Xh]=!0,this[lo]()},a.disconnectedCallback=function(){typeof r.createRoot=="function"?this[co].unmount():r.unmountComponentAtNode(this)},a[lo]=function(){if(this[Xh]===!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 SI(d)}):Object.keys(e.propTypes),a.attributeChangedCallback=function(d,u,f){var g=n.dashStyleAttributes?CI(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 OI(){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 II(e="sb-collection-editor"){if(OI(),typeof customElements>"u"||customElements.get(e))return;const t=EI(Rh,h,Fs,{});customElements.define(e,t)}pe.CollectionEditor=Rh,pe.registerCollectionEditor=II,pe.setApiBaseUrl=Yu,pe.useEditorStore=oe,pe.useLibraryStore=Qh,pe.useTreeStore=De,Object.defineProperty(pe,Symbol.toStringTag,{value:"Module"})});
|