diff --git a/dist/release/chunks/create-react-widget-x2d1v5cz.js b/dist/release/chunks/create-react-widget-5z94rw5h.js similarity index 88% rename from dist/release/chunks/create-react-widget-x2d1v5cz.js rename to dist/release/chunks/create-react-widget-5z94rw5h.js index 41d09fe..2431cd6 100644 --- a/dist/release/chunks/create-react-widget-x2d1v5cz.js +++ b/dist/release/chunks/create-react-widget-5z94rw5h.js @@ -1 +1 @@ -import{a as b}from"./index-3wva2e3j.js";import{Aa as T,Ca as D}from"./index-2femq7pq.js";import{rc as z}from"./index-w8y4mejn.js";var E=z(T(),1),G=z(b(),1);function k(){let q=globalThis.LiteGraph;return Boolean(q?.vueNodesMode)}function x(q){let j=q.width;if(Object.defineProperty(q,"width",{configurable:!0,enumerable:!0,get:()=>j,set:(X)=>{if(k())j=X}}),!k())j=void 0}function U(q,j={}){return function(Y,Z,A,L){let B=j.defaultValue??"",$=null,F=document.createElement("div");if(F.classList.add("comfyui-react-widget",D),j.height!==void 0)F.style.height=`${j.height}px`;let K=Y;function P(){try{return JSON.parse(B)}catch{return B}}function Q(){$?.render(E.default.createElement(q,{value:P(),onChange:(J)=>{B=typeof J==="string"?J:JSON.stringify(J),K.setDirtyCanvas(!0,!0),Q()},inputName:Z,widget:H,node:K,app:L}))}let H=K.addDOMWidget(Z,"react-widget",F,{getValue:()=>B,setValue:(J)=>{B=J,Q()},getMinHeight:()=>30,getMaxHeight:()=>Y.size[1],hideOnZoom:!0,serialize:!0,...j.domWidgetOptions});if(j.keepResponsiveWidthInLiteGraph)x(H);return H.inputEl=F,H.serializeValue=()=>B,$=G.createRoot(F),Q(),{widget:H}}}export{U as createReactWidget}; +import{a as b}from"./index-xk3sxqv7.js";import{Aa as T,Ca as D}from"./index-1wrhp8dx.js";import{sc as z}from"./index-xcg45zk8.js";var E=z(T(),1),G=z(b(),1);function k(){let q=globalThis.LiteGraph;return Boolean(q?.vueNodesMode)}function x(q){let j=q.width;if(Object.defineProperty(q,"width",{configurable:!0,enumerable:!0,get:()=>j,set:(X)=>{if(k())j=X}}),!k())j=void 0}function U(q,j={}){return function(Y,Z,A,L){let B=j.defaultValue??"",$=null,F=document.createElement("div");if(F.classList.add("comfyui-react-widget",D),j.height!==void 0)F.style.height=`${j.height}px`;let K=Y;function P(){try{return JSON.parse(B)}catch{return B}}function Q(){$?.render(E.default.createElement(q,{value:P(),onChange:(J)=>{B=typeof J==="string"?J:JSON.stringify(J),K.setDirtyCanvas(!0,!0),Q()},inputName:Z,widget:H,node:K,app:L}))}let H=K.addDOMWidget(Z,"react-widget",F,{getValue:()=>B,setValue:(J)=>{B=J,Q()},getMinHeight:()=>30,getMaxHeight:()=>Y.size[1],hideOnZoom:!0,serialize:!0,...j.domWidgetOptions});if(j.keepResponsiveWidthInLiteGraph)x(H);return H.inputEl=F,H.serializeValue=()=>B,$=G.createRoot(F),Q(),{widget:H}}}export{U as createReactWidget}; diff --git a/dist/release/chunks/index-2femq7pq.js b/dist/release/chunks/index-1wrhp8dx.js similarity index 99% rename from dist/release/chunks/index-2femq7pq.js rename to dist/release/chunks/index-1wrhp8dx.js index bc30b7a..a9b618c 100644 --- a/dist/release/chunks/index-2femq7pq.js +++ b/dist/release/chunks/index-1wrhp8dx.js @@ -1,2 +1,2 @@ -import{rc as ft,sc as N,tc as ct,uc as at}from"./index-w8y4mejn.js";var U=N((me)=>{var m=Symbol.for("react.transitional.element"),ne=Symbol.for("react.portal"),oe=Symbol.for("react.fragment"),se=Symbol.for("react.strict_mode"),ue=Symbol.for("react.profiler"),ie=Symbol.for("react.consumer"),fe=Symbol.for("react.context"),ce=Symbol.for("react.forward_ref"),ae=Symbol.for("react.suspense"),pe=Symbol.for("react.memo"),w=Symbol.for("react.lazy"),le=Symbol.for("react.activity"),h=Symbol.iterator;function ye(e){if(e===null||typeof e!=="object")return null;return e=h&&e[h]||e["@@iterator"],typeof e==="function"?e:null}var M={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},H=Object.assign,I={};function y(e,t,r){this.props=e,this.context=t,this.refs=I,this.updater=r||M}y.prototype.isReactComponent={};y.prototype.setState=function(e,t){if(typeof e!=="object"&&typeof e!=="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};y.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function j(){}j.prototype=y.prototype;function T(e,t,r){this.props=e,this.context=t,this.refs=I,this.updater=r||M}var R=T.prototype=new j;R.constructor=T;H(R,y.prototype);R.isPureReactComponent=!0;var O=Array.isArray;function v(){}var i={H:null,A:null,T:null,S:null},L=Object.prototype.hasOwnProperty;function S(e,t,r){var n=r.ref;return{$$typeof:m,type:e,key:t,ref:n!==void 0?n:null,props:r}}function de(e,t){return S(e.type,t,e.props)}function x(e){return typeof e==="object"&&e!==null&&e.$$typeof===m}function _e(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(r){return t[r]})}var A=/\/+/g;function E(e,t){return typeof e==="object"&&e!==null&&e.key!=null?_e(""+e.key):t.toString(36)}function ge(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status==="string"?e.then(v,v):(e.status="pending",e.then(function(t){e.status==="pending"&&(e.status="fulfilled",e.value=t)},function(t){e.status==="pending"&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function l(e,t,r,n,o){var s=typeof e;if(s==="undefined"||s==="boolean")e=null;var u=!1;if(e===null)u=!0;else switch(s){case"bigint":case"string":case"number":u=!0;break;case"object":switch(e.$$typeof){case m:case ne:u=!0;break;case w:return u=e._init,l(u(e._payload),t,r,n,o)}}if(u)return o=o(e),u=n===""?"."+E(e,0):n,O(o)?(r="",u!=null&&(r=u.replace(A,"$&/")+"/"),l(o,t,r,"",function(re){return re})):o!=null&&(x(o)&&(o=de(o,r+(o.key==null||e&&e.key===o.key?"":(""+o.key).replace(A,"$&/")+"/")+u)),t.push(o)),1;u=0;var a=n===""?".":n+":";if(O(e))for(var c=0;cF,useFormStatus:()=>Z,useFormState:()=>Q,unstable_batchedUpdates:()=>J,requestFormReset:()=>X,preloadModule:()=>K,preload:()=>B,preinitModule:()=>W,preinit:()=>G,prefetchDNS:()=>z,preconnect:()=>q,flushSync:()=>k,createPortal:()=>D,__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:()=>b});function Y(e){var t="https://react.dev/errors/"+e;if(1{$=ft(U(),1);f={d:{f:p,r:function(){throw Error(Y(522))},D:p,C:p,L:p,m:p,X:p,S:p,M:p},p:0,findDOMNode:null},pt=Symbol.for("react.portal");d=$.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;b=f});var yt=N((Et,te)=>{V();function ee(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=="function")return;try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(ee)}catch(e){console.error(e)}}ee(),te.exports=C});var _t="MMnode".toLowerCase(); +import{sc as ft,tc as N,uc as ct,vc as at}from"./index-xcg45zk8.js";var U=N((me)=>{var m=Symbol.for("react.transitional.element"),ne=Symbol.for("react.portal"),oe=Symbol.for("react.fragment"),se=Symbol.for("react.strict_mode"),ue=Symbol.for("react.profiler"),ie=Symbol.for("react.consumer"),fe=Symbol.for("react.context"),ce=Symbol.for("react.forward_ref"),ae=Symbol.for("react.suspense"),pe=Symbol.for("react.memo"),w=Symbol.for("react.lazy"),le=Symbol.for("react.activity"),h=Symbol.iterator;function ye(e){if(e===null||typeof e!=="object")return null;return e=h&&e[h]||e["@@iterator"],typeof e==="function"?e:null}var M={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},H=Object.assign,I={};function y(e,t,r){this.props=e,this.context=t,this.refs=I,this.updater=r||M}y.prototype.isReactComponent={};y.prototype.setState=function(e,t){if(typeof e!=="object"&&typeof e!=="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};y.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function j(){}j.prototype=y.prototype;function T(e,t,r){this.props=e,this.context=t,this.refs=I,this.updater=r||M}var R=T.prototype=new j;R.constructor=T;H(R,y.prototype);R.isPureReactComponent=!0;var O=Array.isArray;function v(){}var i={H:null,A:null,T:null,S:null},L=Object.prototype.hasOwnProperty;function S(e,t,r){var n=r.ref;return{$$typeof:m,type:e,key:t,ref:n!==void 0?n:null,props:r}}function de(e,t){return S(e.type,t,e.props)}function x(e){return typeof e==="object"&&e!==null&&e.$$typeof===m}function _e(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(r){return t[r]})}var A=/\/+/g;function E(e,t){return typeof e==="object"&&e!==null&&e.key!=null?_e(""+e.key):t.toString(36)}function ge(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status==="string"?e.then(v,v):(e.status="pending",e.then(function(t){e.status==="pending"&&(e.status="fulfilled",e.value=t)},function(t){e.status==="pending"&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function l(e,t,r,n,o){var s=typeof e;if(s==="undefined"||s==="boolean")e=null;var u=!1;if(e===null)u=!0;else switch(s){case"bigint":case"string":case"number":u=!0;break;case"object":switch(e.$$typeof){case m:case ne:u=!0;break;case w:return u=e._init,l(u(e._payload),t,r,n,o)}}if(u)return o=o(e),u=n===""?"."+E(e,0):n,O(o)?(r="",u!=null&&(r=u.replace(A,"$&/")+"/"),l(o,t,r,"",function(re){return re})):o!=null&&(x(o)&&(o=de(o,r+(o.key==null||e&&e.key===o.key?"":(""+o.key).replace(A,"$&/")+"/")+u)),t.push(o)),1;u=0;var a=n===""?".":n+":";if(O(e))for(var c=0;cF,useFormStatus:()=>Z,useFormState:()=>Q,unstable_batchedUpdates:()=>J,requestFormReset:()=>X,preloadModule:()=>K,preload:()=>B,preinitModule:()=>W,preinit:()=>G,prefetchDNS:()=>z,preconnect:()=>q,flushSync:()=>k,createPortal:()=>D,__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:()=>b});function Y(e){var t="https://react.dev/errors/"+e;if(1{$=ft(U(),1);f={d:{f:p,r:function(){throw Error(Y(522))},D:p,C:p,L:p,m:p,X:p,S:p,M:p},p:0,findDOMNode:null},pt=Symbol.for("react.portal");d=$.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;b=f});var yt=N((Et,te)=>{V();function ee(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=="function")return;try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(ee)}catch(e){console.error(e)}}ee(),te.exports=C});var _t="MMnode".toLowerCase(); export{U as Aa,yt as Ba,_t as Ca}; diff --git a/dist/release/chunks/index-6mdy4n0q.js b/dist/release/chunks/index-6mdy4n0q.js deleted file mode 100644 index ee2b65c..0000000 --- a/dist/release/chunks/index-6mdy4n0q.js +++ /dev/null @@ -1,2 +0,0 @@ -import{qc as q}from"./index-3jazyhrg.js";function G_(_){let $=Math.max(_.lastIndexOf("/"),_.lastIndexOf("\\"));return{filename:$>=0?_.slice($+1):_,subfolder:$>=0?_.slice(0,$):""}}function K_(_,$){let{filename:U,subfolder:A}=G_(_);return`/view?filename=${encodeURIComponent(U)}&type=${$}&subfolder=${encodeURIComponent(A)}`}function i_(_,$){if($===void 0||$==="")return _;let U=_.includes("?")?"&":"?";return`${_}${U}v=${encodeURIComponent(String($))}`}function O_(_){if(_.url)return _.url;if(_.local_path)return`file://${_.local_path}`;if(_.source_type!=="input"&&_.source_type!=="output")return null;if(!_.file_path)return null;let $=_.source_type==="output"?"output":"input";return K_(_.file_path,$)}function r(_,$=0){let U=_?.match(/(\d+)$/)?.[1];return U?Number(U):$+1}function k_(_){return O_(_)}var u=9,W_="|MULTIPLE|";function w(_){return Array.isArray(_)?_:[]}function a(_){return w(_).filter(($)=>$.muted!==!0)}function n_(_,$,U=0){let A=_.findIndex((M)=>M.id===$);if(A<0||_[A].muted===!0)return null;return U+_.slice(0,A+1).filter((M)=>M.muted!==!0).length-1}function m_(_,$){return r(_.slot_name,$)}function B(_){let $=_.source_type??"input",U=$==="slot"?_.slot_name:_.file_path??_.local_path??_.url??_.file_name;return`${$}:${U??_.id}`}function s_(_,$){let U=B($);return _.every((A)=>{let M=w(A.content.images);return M.some((j)=>B(j)===U)||M.length{let j=w(M.content.images),G=j.find((O)=>B(O)===A);if(U){let O=G?{...G,shared_reference:!0}:{...$,id:q(),shared_reference:!0,shared_reference_copy:!0};return{segmentId:M.id,images:[...j.filter((W)=>W.shared_reference===!0&&B(W)!==A),O,...j.filter((W)=>W.shared_reference!==!0&&B(W)!==A)].slice(0,u)}}return{segmentId:M.id,images:j.flatMap((O)=>{if(B(O)!==A)return[O];if(O.shared_reference_copy===!0)return[];let W={...O,shared_reference:!1};return delete W.shared_reference_copy,[W]})}})}function t(_){let $=_.filter((A)=>A.type==="task").flatMap((A)=>A.segments),U=new Map;for(let A of $)for(let M of w(A.content.images)){if(M.shared_reference!==!0)continue;let j=B(M);if(!U.has(j))U.set(j,M)}if(U.size===0)return _;return _.map((A)=>{if(A.type!=="task")return A;return{...A,segments:A.segments.map((M)=>{let j=w(M.content.images),G=Array.from(U.entries()).map(([W,X])=>{let Q=j.find((Y)=>B(Y)===W);return Q?{...Q,shared_reference:!0}:{...X,id:q(),shared_reference:!0,shared_reference_copy:!0}}),O=j.filter((W)=>!U.has(B(W)));return{...M,content:{...M.content,images:[...G,...O].slice(0,u)}}})}})}function a_(_,$){let U=_.startsWith("__slot__:")?"slot":$,A=U==="slot"?_.replace(/^__slot__:/,""):void 0,M=A??_.split(/[\\/]/).pop()??_;return{id:q(),source_type:U,file_path:U==="input"||U==="output"?_:void 0,local_path:U==="local"?_:void 0,url:U==="url"?_:void 0,slot_name:A,file_name:M}}function t_(_){return _.split(W_).filter(($)=>$.length>0)}async function e_(_){let $=new FormData;$.append("image",_);let U=await fetch("/upload/image",{method:"POST",body:$});if(!U.ok)throw Error(`Failed to upload image: ${_.name}`);let A=await U.json(),M=A.name??_.name,j=A.subfolder??"";return{id:q(),source_type:"input",file_path:j?`${j}/${M}`:M,file_name:M}}var V=24,X_=120,H_=5,J_=["default","ref","edit","l2v"],I="default",Q_=["shot","context","context_swap"],$_="shot",Y_=["match","max"],U_="match",D=0,Z_=-20,C_=6,A$=3,M$=[16,20,24,25,30,50,60],E_="Moxie Multimedia",N_="MiniMax";function q_(_){return _===E_?N_:_}function j$(_,$=!1){if(_==="task")return $?64:30;if(_==="subtitle")return 30;return 64}function G$(_,$){let U=_.startsWith("__slot__:")?"slot":$==="input"&&/^https?:\/\//i.test(_)?"url":$,A=U==="slot"?_.replace(/^__slot__:/,""):void 0;return{media_type:"video",source_type:U,file_path:U==="input"||U==="output"?_:void 0,local_path:U==="local"?_:void 0,url:U==="url"?_:void 0,...A?{slot_name:A}:{},file_name:A??_.split(/[\\/]/).pop()??_}}function K$(_,$){let U=_.startsWith("__slot__:")?"slot":$==="input"&&/^https?:\/\//i.test(_)?"url":$;return{media_type:"audio",source_type:U,file_path:U==="input"||U==="output"?_:void 0,local_path:U==="local"?_:void 0,url:U==="url"?_:void 0,slot_name:U==="slot"?_.replace(/^__slot__:/,""):void 0,file_name:U==="slot"?_.replace(/^__slot__:/,""):_.split(/[\\/]/).pop()??_,muted:!1,volume_db:D}}function O$(_,$,U){let A=Math.max(1,_.end_frame-_.start_frame),M=Math.max(1,c($,U));return _.start_frame+Math.min(A,M)}var p={task:"var(--multitrack-task-bg)",video:"var(--primary)",audio:"var(--highlight)",subtitle:"var(--accent)"};function W$(_,$){return $(`multitrackTaskModes.${_}`)}function X$(_,$,U){if(_==="l2v")return"l2v";if(_==="ref")return U?"rv2v":"r2v";if(_==="edit")return $>0?"vi2v":"v2v";if($<=0)return"r2v";if($===1)return"i2v";if($===2)return"fl2v";return"fmlf2v"}function H$(_,$){if($.size<2)return null;let U=_.filter((H)=>H.type==="task"&&H.segments.some((Z)=>$.has(Z.id)));if(U.length!==1)return null;let A=U[0],M=[...A.segments].sort((H,Z)=>H.start_frame-Z.start_frame),j=M.flatMap((H,Z)=>$.has(H.id)?[Z]:[]);if(j.length!==$.size||j.length<2)return null;let G=j[0],O=j[j.length-1];if(O-G+1!==j.length)return null;let W=M.slice(G,O+1),X=W[0],Q=W.find((H)=>z_(H.content).trim().length>0||a(H.content.images).length>0)??X,Y={...X,start_frame:X.start_frame,end_frame:W[W.length-1].end_frame,content:{...Q.content}},J=new Set(W.map((H)=>H.id)),K=M.flatMap((H)=>{if(H.id===X.id)return[Y];return J.has(H.id)?[]:[H]});return{tracks:_.map((H)=>H.id===A.id?{...H,segments:K}:H),mergedSegmentId:Y.id}}function B_(_,$){if($<=0)return 0;return Math.round(_*$)}function R(_,$){if($<=0)return 0;return _/$}function b_(_){if(!Number.isFinite(_))return D;return Math.max(Z_,Math.min(C_,_))}function J$(_){return 10**((Number.isFinite(_)?_:D)/20)}function o(_){let $=m(_);return $===null?D:b_($)}function Q$(_,$){let U=$>0?$:V,A=Math.max(0,Math.round(_*U)),M=Math.floor(A/U),j=Math.floor(M/60),G=M%60,O=A%U;return[j,G,O].map((W)=>W.toString().padStart(2,"0")).join(":")}function Y$(_,$){if(!Number.isInteger($)||$<=0)return null;let U=/^(\d{2,}):([0-5]\d):(\d{2})$/.exec(_.trim());if(!U)return null;let A=Number.parseInt(U[1],10),M=Number.parseInt(U[2],10),j=Number.parseInt(U[3],10);if(j>=$)return null;let G=A*60+M+j/$;return G>0?G:null}function Z$(_,$={}){let U=$.frameRate&&$.frameRate>0?$.frameRate:0,A=Math.max(0,$.showFrames?Math.round(_):Math.floor(_)),M=$.showFrames&&U>0?Math.floor(A/U):U>0?Math.floor(A/U):Math.floor(A),j=Math.floor(M/3600),G=Math.floor(M%3600/60),O=M%60,X=($.showHours===!1?Math.floor(M/60):G).toString().padStart(2,"0"),Q=O.toString().padStart(2,"0");if($.showFrames&&U>0){let Y=(A%U).toString().padStart(2,"0");if($.showHours!==!1&&j>0)return`${j.toString().padStart(2,"0")}:${X}:${Q}:${Y}`;return`${X}:${Q}:${Y}`}if($.showHours!==!1&&j>0)return`${j.toString().padStart(2,"0")}:${X}:${Q}`;return`${X}:${Q}`}function b(_,$){return Math.max(0,Math.round(_))}function C$(_,$,U,A,M,j){let G=_.tracks.flatMap((K)=>K.segments).find((K)=>K.id===$);if(!G)return A;let O=b(A,_.frame_rate),W=Math.max(0,Math.round(M));if(W<=0)return O;let X=new Set([0,_.total_length]);if(typeof j==="number"&&Number.isFinite(j))X.add(b(j,_.frame_rate));for(let K of _.tracks)for(let H of K.segments){if(H.id===$)continue;X.add(H.start_frame),X.add(H.end_frame)}let Q=U==="start"?G.end_frame:G.start_frame,Y=O,J=W+1;for(let K of X){if(U==="start"&&K>=Q)continue;if(U==="end"&&K<=Q)continue;let H=Math.abs(O-K);if(H>W||H>=J)continue;Y=K,J=H}return Y}function E$(_,$,U,A,M){let j=_.tracks.flatMap((K)=>K.segments).find((K)=>K.id===$);if(!j)return U;let G=b(U,_.frame_rate),O=Math.max(0,Math.round(A));if(O<=0)return G;let W=N(j),X=G+W,Q=new Set([0,_.total_length]);if(typeof M==="number"&&Number.isFinite(M))Q.add(b(M,_.frame_rate));for(let K of _.tracks)for(let H of K.segments){if(H.id===$)continue;Q.add(H.start_frame)}let Y=G,J=O+1;for(let K of Q){let H=Math.abs(G-K);if(H<=O&&HO||Z>=J)continue;Y=C,J=Z}return Y}function c(_,$){return Math.max(0,B_(_,$))}function S(_,$,U){return c(R(_,$),U)}function N(_){return Math.max(0,_.end_frame-_.start_frame)}function v(_,$=V){let U=Math.max(1,Math.round($)),A=H_*U,M=L_(_);return M>0?M:A}var N$=v;function L_(_){return _.flatMap(($)=>$.segments).reduce(($,U)=>Math.max($,U.end_frame),0)}function y_(_,$,U,A){return _U}function V_(_){return typeof _==="string"&&J_.includes(_)}function A_(_){return V_(_)?_:I}function D_(_){return typeof _==="string"&&Q_.includes(_)?_:$_}function w_(_){return typeof _==="string"&&Y_.includes(_)?_:U_}function M_(_,$,U=I){let A=_.filter((j)=>j.start_frame<$).sort((j,G)=>G.start_frame-j.start_frame)[0],M=A?.content.system_prompt;return{task_mode:A?.content.task_mode??U,continuity_mode:A?.content.continuity_mode??$_,ref_image_size:A?.content.ref_image_size??U_,...M?{system_prompt:M}:{}}}function p_(_,$){return _.filter((U)=>{return U.start_frame+N(U)/2<$}).length}function f(_,$,U){let A=[..._].sort((j,G)=>j.start_frame-G.start_frame),M=Math.max(0,Math.round($));return p_(A,M)}function z(_,$,U){let A=$-_.start_frame;return{..._,start_frame:$,end_frame:U,origin_start_frame:_.origin_start_frame===void 0?void 0:_.origin_start_frame+A}}function P(_,$){let U=0;return _.map((A)=>{let M=N(A),j=Math.round(U),G=Math.round(j+M);return U=G,z(A,j,G)})}function n(_,$,U,A){let M=f(_,U,A),j=N($),G=b(U,A),O=_[M-1]?.end_frame??0,W=Math.max(G,O),X=[..._.slice(0,M),z($,W,W+j),..._.slice(M)],Q=0;return{insertIndex:M,segments:X.map((Y,J)=>{if(Jj.type==="video");if(!U)return $;let A=$.filter((j)=>j.type==="video").flatMap((j)=>j.segments),M=U.segments.flatMap((j)=>{let G=A.find((O)=>O.id===j.id);return G?[{originalSegment:j,updatedSegment:G}]:[]});return $.map((j)=>{if(j.type!=="task")return j;return{...j,segments:j.segments.map((G)=>{let O=M.find(({originalSegment:W})=>G.start_frame===W.start_frame&&G.end_frame===W.end_frame);return O?{...G,start_frame:O.updatedSegment.start_frame,end_frame:O.updatedSegment.end_frame}:G})}})}function q$(_,$,U){let A=b($,V),M=Math.max(A+1,b(U,V)),j=_.find((W)=>W.type==="task");if(!j)return _;if(j.segments.some((W)=>y_(W.start_frame,W.end_frame,A,M)))return _;let O={id:q(),start_frame:A,end_frame:M,color:p.task,content:{media_type:"none",...M_(j.segments,A,j.task_mode??I)}};return _.map((W)=>{if(W.id!==j.id)return W;return{...W,segments:[...W.segments,O].sort((X,Q)=>X.start_frame-Q.start_frame)}})}function B$(_,$,U,A){let M=_.length>0?_:[""];if(M.length===$.length)return $.map((Y,J)=>({...Y,content:e(Y.content,M[J])}));let j=M.length,G=Math.max(j,Math.round(U)),O=Math.floor(G/j),W=G%j,X=0,Q=[];return M.forEach((Y,J)=>{let K=$[J],H=O+(JG.start_frame-O.start_frame).map((G,O)=>{let W=A+(OQ.start_frame-Y.start_frame),M=A.findIndex((Q)=>Q.id===$);if(M<0)return null;let j=A[M],G=N(j),O=Math.round(U);if(G<=1||O<1||O>=G)return null;let W=j.start_frame,X=[];while(WQ.id)}}function y$(_,$){let U=[..._].sort((J,K)=>J.start_frame-K.start_frame),A=U.findIndex((J)=>J.id===$);if(A<0)return null;let M=U[A],j=N(M);if(j<=0)return null;let G=q(),O=M.end_frame,W=O-M.start_frame,X={...structuredClone(M),id:G,start_frame:O,end_frame:O+j,...M.origin_start_frame===void 0?{}:{origin_start_frame:M.origin_start_frame+W}},Q=X.end_frame,Y=U.slice(A+1).map((J)=>{let K=N(J),H=Q-J.start_frame,Z={...J,start_frame:Q,end_frame:Q+K,...J.origin_start_frame===void 0?{}:{origin_start_frame:J.origin_start_frame+H}};return Q=Z.end_frame,Z});return{segments:[...U.slice(0,A+1),X,...Y],clonedSegmentId:G,addedDuration:j}}function V$(_,$,U=V){return I_(_,[$],U)}function I_(_,$,U=V){let A=new Set($);if(A.size===0)return _;return _.map((M)=>({...M,segments:M.segments.filter((j)=>!A.has(j.id))}))}function F_(_,$,U,A,M){let j=_.find((K)=>K.segments.some((H)=>H.id===$)),G=_.find((K)=>K.id===U);if(!j||!G||j.type!==G.type)return _;let O=j.segments.find((K)=>K.id===$);if(!O)return _;if(N(O)<=0)return _;let X=G.segments.filter((K)=>K.id!==$).sort((K,H)=>K.start_frame-H.start_frame),Q=f(X,A,M);if(T(G.type)){let K=n(X,O,A,M),H=_.map((Z)=>{if(Z.id===j.id&&Z.id!==G.id)return{...Z,segments:Z.segments.filter((C)=>C.id!==$)};if(Z.id!==G.id)return Z;return{...Z,segments:K.segments}});return G.type==="video"?x(_,H):H}let Y=P([...X.slice(0,Q),O,...X.slice(Q)],M),J=_.map((K)=>{if(K.id===j.id&&K.id!==G.id)return{...K,segments:P(K.segments.filter((H)=>H.id!==$),M)};if(K.id!==G.id)return K;return{...K,segments:Y}});return x(_,J)}function R_(_,$,U,A,M){let j=_.flatMap((W)=>W.segments).find((W)=>W.id===U);if(!j)return _;let G=b(A-j.start_frame,M);if(G===0)return _;let O=_.map((W)=>{let X=W.segments.filter((H)=>$.has(H.id)).sort((H,Z)=>H.start_frame-Z.start_frame);if(X.length===0)return W;let Q=W.segments.filter((H)=>!$.has(H.id)).sort((H,Z)=>H.start_frame-Z.start_frame),Y=X.map((H)=>{let Z=N(H),C=Math.max(0,H.start_frame+G);return z(H,C,C+Z)});if(T(W.type)){let H=[...Q,...Y].sort((C,L)=>C.start_frame-L.start_frame),Z=0;return{...W,segments:H.map((C)=>{let L=$.has(C.id)?Math.max(C.start_frame,Z):C.start_frame,s=L===C.start_frame?C:z(C,L,L+N(C));return Z=Math.max(Z,s.end_frame),s})}}let J=Y.reduce((H,Z)=>Math.min(H,Z.start_frame),Number.POSITIVE_INFINITY),K=f(Q,J,M);return{...W,segments:P([...Q.slice(0,K),...Y,...Q.slice(K)],M)}});return x(_,O)}function D$(_,$,U,A,M,j){let G=new Set($);if(G.size<=1||!G.has(U))return F_(_,U,A,M,j);return R_(_,G,U,M,j)}function w$(_,$,U,A,M){let j=_.find((K)=>K.segments.some((H)=>H.id===$)),G=_.find((K)=>K.id===U);if(!j||!G||j.type!==G.type)return null;let O=j.segments.find((K)=>K.id===$);if(!O)return null;if(N(O)<=0)return null;let X=G.segments.filter((K)=>K.id!==$).sort((K,H)=>K.start_frame-H.start_frame),Q=f(X,A,M);if(T(G.type)){let K=n(X,O,A,M),H=K.segments[K.insertIndex];return{segmentId:$,targetTrackId:U,insertIndex:K.insertIndex,start_frame:H.start_frame,end_frame:H.end_frame}}let J=P([...X.slice(0,Q),O,...X.slice(Q)],M)[Q];if(!J)return null;return{segmentId:$,targetTrackId:U,insertIndex:Q,start_frame:J.start_frame,end_frame:J.end_frame}}function p$(_,$,U){let A=_.find((K)=>K.id===$.targetTrackId),M=_.flatMap((K)=>K.segments).find((K)=>K.id===$.segmentId);if(!A||!M)return null;if(N(M)<=0)return null;let G=A.segments.filter((K)=>K.id!==$.segmentId).sort((K,H)=>K.start_frame-H.start_frame),O=T(A.type)?n(G,M,$.start_frame,U).segments:P([...G.slice(0,$.insertIndex),M,...G.slice($.insertIndex)],U),W=O.filter((K)=>K.id!==$.segmentId);if(A.type!=="video")return W;let X=_.map((K)=>K.id===A.id?{...K,segments:O}:K),Q=x(_,X),Y=new Map(_.filter((K)=>K.type==="task").flatMap((K)=>K.segments).map((K)=>[K.id,K])),J=Q.filter((K)=>K.type==="task").flatMap((K)=>K.segments).filter((K)=>{let H=Y.get(K.id);return H&&(H.start_frame!==K.start_frame||H.end_frame!==K.end_frame)});return[...W,...J]}function l(_,$){return $>=_.start_frame&&$<_.end_frame}function j_(_,$){let U=b($,_.frame_rate);if(_.total_length>0&&U===_.total_length)return _.total_length-1;return U}function i(_,$){return Math.max(0,$-(_.origin_start_frame??_.start_frame))}function z$(_,$,U){let A=j_(_,$),M=_.tracks.filter((j)=>j.type==="video");if(U){for(let j of M){let G=j.segments.find((O)=>O.id===U);if(!G||G.content.media_type!=="video"||!l(G,A))continue;return{trackId:j.id,segment:G,localTime:R(i(G,A),_.frame_rate)}}return null}for(let j of M){let G=j.segments.find((O)=>O.content.media_type==="video"&&l(O,A));if(!G)continue;return{trackId:j.id,segment:G,localTime:R(i(G,A),_.frame_rate)}}return null}function P$(_,$,U){if(_.muted===!0||U!==null&&U.trackType!=="video"&&U.trackType!=="audio")return[];let A=j_(_,$),M=_.tracks.filter((O)=>O.type==="video"||O.type==="audio"),j=M.some((O)=>O.solo===!0),G=U&&(U.trackType==="video"||U.trackType==="audio")?U.segment.id:null;return M.flatMap((O)=>{if(O.muted||j&&O.solo!==!0)return[];return O.segments.flatMap((W)=>{if(G&&W.id!==G)return[];if(!l(W,A)||W.content.muted===!0)return[];if(W.content.media_type!=="video"&&W.content.media_type!=="audio")return[];return[{trackId:O.id,segment:W,localTime:R(i(W,A),_.frame_rate),volumeDb:(_.volume_db??0)+(O.volume_db??0)+(W.content.volume_db??0)}]})})}function I$(_,$){if(!$)return null;for(let U of _.tracks){let A=U.segments.find((M)=>M.id===$);if(!A)continue;return{trackId:U.id,trackType:U.type,segment:A}}return null}function F$(_,$,U){return{..._,tracks:_.tracks.map((A)=>({...A,segments:A.segments.map((M)=>M.id===$?{...M,content:{...M.content,...U}}:M)}))}}function x_(_,$,U){let A=_.find((G)=>G.type==="video"),M=A?.segments.find((G)=>G.id===U);if(!A||!M)return $;let j=$.find((G)=>G.id===A.id)?.segments.find((G)=>G.id===U);if(!j)return $;return $.map((G)=>{if(G.type!=="task")return G;return{...G,segments:G.segments.map((O)=>O.start_frame===M.start_frame&&O.end_frame===M.end_frame?{...O,start_frame:j.start_frame,end_frame:j.end_frame}:O)}})}function h_(_,$,U){let A=[..._].sort((Y,J)=>Y.start_frame-J.start_frame),M=A.findIndex((Y)=>Y.id===$);if(M<0)return _;let j=A[M],G=Math.max(j.start_frame+1,Math.round(U)),O=G-j.end_frame;if(O===0)return A;let W=A[M+1],X=W?Math.max(0,W.start_frame-j.end_frame):0,Q=O>0?Math.max(0,O-X):O;return A.map((Y,J)=>{if(J{let W=O.segments.find((J)=>J.id===$);if(!W)return O;let X=b(W.start_frame+M,A);if(O.type==="task")return{...O,segments:h_(O.segments,$,X)};let Q=O.segments.filter((J)=>J.id!==$&&J.start_frame>W.start_frame).reduce((J,K)=>Math.min(J,K.start_frame),Number.POSITIVE_INFINITY),Y=Math.max(W.start_frame+1,Math.min(X,Q));return{...O,segments:O.segments.map((J)=>J.id===$?{...J,end_frame:Y}:J)}}),G=x_(_.tracks,j,$);return{..._,tracks:G,total_length:v(G,A)}}function x$(_,$){let U=Math.max(1,Math.round($));if(U===_.frame_rate)return _;let A=_.tracks.map((M)=>({...M,segments:M.segments.map((j)=>{let G=S(j.start_frame,_.frame_rate,U),O=Math.max(G+1,S(j.end_frame,_.frame_rate,U));return{...j,start_frame:G,end_frame:O,origin_start_frame:j.origin_start_frame===void 0?void 0:Math.round(j.origin_start_frame*U/_.frame_rate)}})}));return{..._,frame_rate:U,task_markers:(_.task_markers??[]).map((M)=>({...M,frame:S(M.frame,_.frame_rate,U)})),tracks:A,total_length:v(A,U)}}var F={width:544,height:960};function E(_){let $=Number(_);return Number.isFinite($)&&$>0?$:null}function k(_){return typeof _==="string"&&["stretch","resize","pad","pad (white)","pad_edge","pad_edge_pixel","crop","pillarbox_blur"].includes(_)?_:"stretch"}function h$(_,$,U){let A=_.tracks.find((M)=>M.id===$);if(!A||A.type!=="audio"&&A.type!=="video")return _;return{..._,tracks:_.tracks.map((M)=>M.type===A.type?{...M,audio_locked:U&&M.id===$}:M)}}function v_(_){let $=new Set;return _.map((U)=>{if(U.type!=="audio"&&U.type!=="video"||U.audio_locked!==!0)return U;if(!$.has(U.type))return $.add(U.type),U;return{...U,audio_locked:!1}})}function d(_){if(Array.isArray(_))return _.length>0?d(_[0]):void 0;return _}function y(_){if(!_)return;if(_.value!==void 0)return d(_.value);if(!_.serializeValue)return;try{return d(_.serializeValue())}catch($){console.error("[multitrack-utils] failed to read resolution widget value:",$);return}}function v$(_){let $=_?.widgets??[],U=new Map($.map((J)=>[J.name,J])),A=y(U.get("resolution")),M={};if(typeof A==="string")M.resolution=A;else if(A&&typeof A==="object"){let J=A;if(typeof J.resolution==="string")M.resolution=J.resolution;let K=k(J.resize_method);if(J.resize_method!==void 0)M.resize_method=K;let H=E(J.resize_to_pixel);if(H!==null)M.resize_to_pixel=H;let Z=E(J.width);if(Z!==null)M.width=Z;let C=E(J.height);if(C!==null)M.height=C;if(typeof J.aspect_ratio==="string")M.aspect_ratio=J.aspect_ratio;let L=E(J.megapixels);if(L!==null)M.megapixels=L}let j=y(U.get("resolution.resize_method"));if(j!==void 0)M.resize_method=k(j);let G=E(y(U.get("resolution.resize_to_pixel")));if(G!==null)M.resize_to_pixel=G;let O=E(y(U.get("resolution.width")));if(O!==null)M.width=O;let W=E(y(U.get("resolution.height")));if(W!==null)M.height=W;let X=y(U.get("resolution.aspect_ratio"));if(typeof X==="string")M.aspect_ratio=X;let Q=E(y(U.get("resolution.megapixels")));if(Q!==null)M.megapixels=Q;let Y=y(U.get("format"));if(typeof Y==="string")M.format=q_(Y);return M}function f_(_,$,U){if(!_||_.width<=0||_.height<=0)return F;let A=_.width/_.height;if($==="longest"){if(_.width>=_.height)return{width:U,height:Math.round(U/A)};return{width:Math.round(U*A),height:U}}if(_.width<=_.height)return{width:U,height:Math.round(U/A)};return{width:Math.round(U*A),height:U}}function f$(_,$){let U=typeof _==="string"?{resolution:_}:_&&typeof _==="object"?_:{},A=typeof U.resolution==="string"?U.resolution:"",M=A.toLowerCase(),j=k(U.resize_method),G=A.match(/(\d+)\s*x\s*(\d+)/i);if(M.includes("megapixels")){let O=typeof U.aspect_ratio==="string"?U.aspect_ratio.match(/(\d+)\s*:\s*(\d+)/):null,W=E(O?.[1])??1,X=E(O?.[2])??1,Q=E(U.megapixels)??1,Y={AnimateDiff:8,Mochi:16,LTXV:32,Hunyuan:16,Cosmos:16,Wan:8,MiniMax:32},J=typeof U.format==="string"?Y[U.format]??1:1,K=Math.sqrt(Q*1024*1024/(W*X));return{width:Math.round(W*K/J)*J,height:Math.round(X*K/J)*J,resizeMethod:j,mode:"megapixels"}}if(M.includes("custom"))return{width:E(U.width)??F.width,height:E(U.height)??F.height,resizeMethod:j,mode:"custom"};if(M.includes("longest")||M.includes("shortest")){let O=M.includes("longest")?"longest":"shortest";return{...f_($,O,E(U.resize_to_pixel)??960),resizeMethod:j,mode:O}}if(G)return{width:Number(G[1]),height:Number(G[2]),resizeMethod:j,mode:"fixed"};if(M.includes("auto")&&$&&$.width>0&&$.height>0)return{width:$.width,height:$.height,resizeMethod:j,mode:"auto"};return{...F,resizeMethod:j,mode:"auto"}}function m(_){let $=Number(_);return Number.isFinite($)?$:null}function g(_){let $=m(_);return $===null?null:Math.max(0,Math.round($))}function T_(_){let $=m(_);return $===null?null:Math.round($)}function h(_){let $={..._};return delete $.volume,$}function u_(_){let $=g(_.start_frame)??0,U=g(_.end_frame)??$+1,A={...h(_.content),muted:_.content.muted===!0,volume_db:o(_.content.volume_db)};if(delete A.audio_locked,A.media_type==="audio"||A.media_type==="video")A.shared_reference=A.shared_reference===!0||A.speaker_reference===!0;return delete A.speaker_reference,{...h(_),start_frame:$,end_frame:Math.max($+1,U),origin_start_frame:T_(_.origin_start_frame)??void 0,content:A}}function S_(_){let $=_.segments.map((A)=>u_(A)).sort((A,M)=>A.start_frame-M.start_frame);if(_.type!=="audio"&&_.type!=="video")return $;let U=!1;return $.map((A)=>{if(A.content.shared_reference!==!0)return A;if(!U)return U=!0,A;return{...A,content:{...A.content,shared_reference:!1}}})}function __(_){let $={..._,task_mode:A_(_.task_mode),continuity_mode:D_(_.continuity_mode),ref_image_size:w_(_.ref_image_size),images:Array.isArray(_.images)?_.images:[]};if($.user_prompt===void 0&&typeof $.text==="string")$.user_prompt=$.text;return delete $.text,$}function o_(_,$){return v(_,$)}function T$(){return{muted:!1,volume_db:D,task_markers:[],task_overview:!1,tracks:[{id:q(),name:"Task 0",type:"task",task_mode:I,color:p.task,muted:!1,solo:!1,volume_db:D,locked:!1,segments:[]},{id:q(),name:"Video 0",type:"video",color:p.video,muted:!1,solo:!1,volume_db:D,locked:!1,segments:[]}],total_length:X_,frame_rate:V}}function u$(_){let $=Math.max(1,Math.round(_.frame_rate??V)),U=_.tracks.map((X)=>{let Q=h(X),Y=(X.type==="audio"||X.type==="video")&&X.segments.some((H)=>H.content.audio_locked===!0),J=S_(X),K={muted:X.muted===!0,solo:X.solo===!0,volume_db:o(X.volume_db)};if(X.type!=="segment"){if(X.type==="task")return{...Q,...K,type:"task",task_mode:A_(X.task_mode),color:X.color==="var(--muted)"?p.task:X.color,segments:J.map((H)=>({...H,content:__(H.content)}))};return{...Q,...K,type:X.type,audio_locked:X.type==="audio"||X.type==="video"?X.audio_locked===!0||Y:void 0,visible:X.type==="subtitle"?X.visible!==!1:X.visible,segments:J}}return{...Q,...K,name:X.name,type:"task",task_mode:I,color:p.task,segments:J.map((H)=>({...H,content:__(H.content)}))}}),A={task:0,video:0,audio:0,subtitle:0},M=U.map((X)=>{let Q=A[X.type];A[X.type]+=1;let Y=X.type.charAt(0).toUpperCase()+X.type.slice(1);return{...X,name:`${Y} ${Q}`}}),j=v_(M),G=t(j),O=o_(G,$),W=l_(_.task_markers,O);return{...h(_),muted:_.muted??!1,volume_db:o(_.volume_db),frame_rate:$,total_length:O,task_markers:W,task_overview:_.task_overview===!0,tracks:G}}function l_(_,$){if(!Array.isArray(_))return[];let U=_.flatMap((M)=>{if(!M||typeof M!=="object")return[];let j=M,G=g(j.frame);if(typeof j.id!=="string"||j.id.length===0)return[];if(G===null||G<=0||G>$)return[];return[{id:j.id,frame:G}]}).sort((M,j)=>M.frame-j.frame),A=new Set;return U.filter((M)=>{if(A.has(M.frame))return!1;return A.add(M.frame),!0})} -export{K_ as Na,i_ as Oa,O_ as Pa,r as Qa,k_ as Ra,u as Sa,w as Ta,a as Ua,n_ as Va,m_ as Wa,B as Xa,s_ as Ya,r_ as Za,a_ as _a,t_ as $a,e_ as ab,V as bb,X_ as cb,H_ as db,J_ as eb,I as fb,Q_ as gb,$_ as hb,Y_ as ib,U_ as jb,D as kb,Z_ as lb,C_ as mb,A$ as nb,M$ as ob,E_ as pb,N_ as qb,q_ as rb,j$ as sb,G$ as tb,K$ as ub,O$ as vb,p as wb,W$ as xb,X$ as yb,H$ as zb,B_ as Ab,R as Bb,b_ as Cb,J$ as Db,Q$ as Eb,Y$ as Fb,Z$ as Gb,b as Hb,C$ as Ib,E$ as Jb,c as Kb,S as Lb,N as Mb,v as Nb,N$ as Ob,M_ as Pb,x as Qb,q$ as Rb,B$ as Sb,z_ as Tb,P_ as Ub,b$ as Vb,L$ as Wb,y$ as Xb,V$ as Yb,I_ as Zb,F_ as _b,D$ as $b,w$ as ac,p$ as bc,j_ as cc,z$ as dc,P$ as ec,I$ as fc,F$ as gc,x_ as hc,h_ as ic,R$ as jc,x$ as kc,h$ as lc,v$ as mc,f$ as nc,T$ as oc,u$ as pc}; diff --git a/dist/release/chunks/index-3jazyhrg.js b/dist/release/chunks/index-6y5pqcvv.js similarity index 95% rename from dist/release/chunks/index-3jazyhrg.js rename to dist/release/chunks/index-6y5pqcvv.js index d047ec2..468ed1b 100644 --- a/dist/release/chunks/index-3jazyhrg.js +++ b/dist/release/chunks/index-6y5pqcvv.js @@ -1,2 +1,2 @@ var B=()=>{if(typeof crypto<"u"&&typeof crypto.randomUUID==="function")return crypto.randomUUID();let c=crypto.getRandomValues(new Uint8Array(16));c[6]=c[6]&15|64,c[8]=c[8]&63|128;let j=Array.from(c,(z)=>z.toString(16).padStart(2,"0")).join("");return`${j.slice(0,8)}-${j.slice(8,12)}-${j.slice(12,16)}-${j.slice(16,20)}-${j.slice(20)}`}; -export{B as qc}; +export{B as rc}; diff --git a/dist/release/chunks/index-93keyn9s.js b/dist/release/chunks/index-93keyn9s.js deleted file mode 100644 index 3786565..0000000 --- a/dist/release/chunks/index-93keyn9s.js +++ /dev/null @@ -1,58 +0,0 @@ -import{$ as VS,A as IA,B as Q4,C as hW,D as lS,E as PS,F as T7,G as Gk,H as hS,I as Nh,J as zB,K as eY,L as PI,M as UT,N as Oh,O as LJ,P as yh,Q as xS,R as Wk,S as Hk,T as Bk,U as KB,V as jW,W as bS,X as kI,Y as $z,Z as Jz,_ as NJ,aa as M7,b as y6,ba as yT,c as SW,ca as eC,d as X1,da as E4,e as pS,ea as z5,fa as II,g as WX,ga as PY,h as bZ,ha as PT,i as R$,ia as kS,j as yY,ja as Uk,k as Vz,ka as Ah,l as Dh,la as hJ,m as UJ,ma as M5,n as _J,na as BS,o as X6,oa as TI,p as TS,pa as t9,q as DF,qa as TJ,r as FS,ra as o9,s as bW,sa as t$,t as Kk,ta as W1,u as eB,ua as G,v as HS,va as b,w as T9,wa as jI,x as T4,xa as b0,y as BY,ya as k0,z as pX,za as _e}from"./index-8qxfph9w.js";import{Aa as v,Ba as $5,Ca as M8}from"./index-2femq7pq.js";import{Da as Y9,Ea as MZ,Fa as mN,Ha as JZ,La as XI}from"./index-fpdytcvw.js";import{$a as fJ,$b as qh,Ab as P9,Bb as m2,Cb as SB,Eb as IJ,Fb as Zz,Gb as M6,Hb as b8,Ib as rS,Jb as fS,Kb as CW,Lb as sS,Mb as vJ,Na as X9,Nb as U8,Oa as xF,Pa as Q5,Pb as oS,Qa as fT,Qb as nS,Ra as cY,Rb as aS,Sa as Z4,Sb as CT,Ta as Mz,Tb as SZ,Ua as xZ,Ub as hZ,Va as RT,Vb as tS,Wa as Dz,Wb as eS,Xa as k7,Xb as $h,Ya as SJ,Yb as Jh,Za as I7,Zb as Qh,_a as xJ,_b as Zh,ab as b7,ac as vS,bb as S2,bc as gS,cc as yW,db as OF,dc as MS,eb as Nz,ec as DS,fc as IF,gb as Oz,gc as Xh,hb as CZ,hc as Yh,ib as Az,ic as zh,jb as wz,jc as Kh,kb as P2,kc as Gh,lb as RB,lc as Wh,mb as CB,mc as iY,nb as SQ,nc as NS,ob as a9,oc as Hh,pc as TF,sb as hQ,tb as AF,ub as wF,vb as iS,wb as kZ,xb as EW,yb as QU,zb as kF}from"./index-6mdy4n0q.js";import{qc as x1}from"./index-3jazyhrg.js";import{rc as R,sc as lo,tc as n4,vc as QE}from"./index-w8y4mejn.js";var KL=lo((Jn)=>{var f9=R(v());function io($,J){return $===J&&($!==0||1/$===1/J)||$!==$&&J!==J}var ro=typeof Object.is==="function"?Object.is:io,so=f9.useState,oo=f9.useEffect,no=f9.useLayoutEffect,ao=f9.useDebugValue;function to($,J){var Q=J(),Z=so({inst:{value:Q,getSnapshot:J}}),q=Z[0].inst,X=Z[1];return no(function(){q.value=Q,q.getSnapshot=J,zL(q)&&X({inst:q})},[$,Q,J]),oo(function(){return zL(q)&&X({inst:q}),$(function(){zL(q)&&X({inst:q})})},[$]),ao(Q),Q}function zL($){var J=$.getSnapshot;$=$.value;try{var Q=J();return!ro($,Q)}catch(Z){return!0}}function eo($,J){return J()}var $n=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?eo:to;Jn.useSyncExternalStore=f9.useSyncExternalStore!==void 0?f9.useSyncExternalStore:$n});var B8=R(v(),1);var cN=R(v(),1);var D8=R(v(),1);var m0=R(v(),1),gH=R($5(),1);function f$($,[J,Q]){return Math.min(Q,Math.max(J,$))}var Fe=!!(typeof window<"u"&&window.document&&window.document.createElement);function V8($,J,{checkForDefaultPrevented:Q=!0}={}){return function(q){if($?.(q),Q===!1||!q.defaultPrevented)return J?.(q)}}var z7=R(v(),1);var D4=R(v(),1);function uF($,J=[]){let Q=[];function Z(X,Y){let z=D4.createContext(Y),K=Q.length;Q=[...Q,Y];let W=(B)=>{let{scope:U,children:_,...L}=B,F=U?.[$]?.[K]||z,V=D4.useMemo(()=>L,Object.values(L));return G(F.Provider,{value:V,children:_})};W.displayName=X+"Provider";function H(B,U){let _=U?.[$]?.[K]||z,L=D4.useContext(_);if(L)return L;if(Y!==void 0)return Y;throw Error(`\`${B}\` must be used within \`${X}\``)}return[W,H]}let q=()=>{let X=Q.map((Y)=>{return D4.createContext(Y)});return function(z){let K=z?.[$]||X;return D4.useMemo(()=>({[`__scope${$}`]:{...z,[$]:K}}),[z,K])}};return q.scopeName=$,[Z,dh(q,...J)]}function dh(...$){let J=$[0];if($.length===1)return J;let Q=()=>{let Z=$.map((q)=>({useScope:q(),scopeName:q.scopeName}));return function(X){let Y=Z.reduce((z,{useScope:K,scopeName:W})=>{let B=K(X)[`__scope${W}`];return{...z,...B}},{});return D4.useMemo(()=>({[`__scope${J.scopeName}`]:Y}),[Y])}};return Q.scopeName=J.scopeName,Q}var cF=R(v(),1);function mF($,J){if(typeof $==="function")return $(J);else if($!==null&&$!==void 0)$.current=J}function iW(...$){return(J)=>{let Q=!1,Z=$.map((q)=>{let X=mF(q,J);if(!Q&&typeof X=="function")Q=!0;return X});if(Q)return()=>{for(let q=0;q{let{children:X,...Y}=Z,z=s5.Children.toArray(X),K=z.find(ih);if(K){let W=K.props.children,H=z.map((B)=>{if(B===K){if(s5.Children.count(W)>1)return s5.Children.only(null);return s5.isValidElement(W)?W.props.children:null}else return B});return G(J,{...Y,ref:q,children:s5.isValidElement(W)?s5.cloneElement(W,void 0,H):null})}return G(J,{...Y,ref:q,children:X})});return Q.displayName=`${$}.Slot`,Q}function ph($){let J=s5.forwardRef((Q,Z)=>{let{children:q,...X}=Q;if(s5.isValidElement(q)){let Y=sh(q),z=rh(X,q.props);if(q.type!==s5.Fragment)z.ref=Z?iW(Z,Y):Y;return s5.cloneElement(q,z)}return s5.Children.count(q)>1?s5.Children.only(null):null});return J.displayName=`${$}.SlotClone`,J}var lh=Symbol("radix.slottable");function ih($){return s5.isValidElement($)&&typeof $.type==="function"&&"__radixId"in $.type&&$.type.__radixId===lh}function rh($,J){let Q={...J};for(let Z in J){let q=$[Z],X=J[Z];if(/^on[A-Z]/.test(Z)){if(q&&X)Q[Z]=(...z)=>{let K=X(...z);return q(...z),K};else if(q)Q[Z]=q}else if(Z==="style")Q[Z]={...q,...X};else if(Z==="className")Q[Z]=[q,X].filter(Boolean).join(" ")}return{...$,...Q}}function sh($){let J=Object.getOwnPropertyDescriptor($.props,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning;if(Q)return $.ref;if(J=Object.getOwnPropertyDescriptor($,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning,Q)return $.props.ref;return $.props.ref||$.ref}var oh=R(v(),1);function K7($){let J=$+"CollectionProvider",[Q,Z]=uF(J),[q,X]=Q(J,{collectionRef:{current:null},itemMap:new Map}),Y=(F)=>{let{scope:V,children:M}=F,D=z7.default.useRef(null),N=z7.default.useRef(new Map).current;return G(q,{scope:V,itemMap:N,collectionRef:D,children:M})};Y.displayName=J;let z=$+"CollectionSlot",K=sW(z),W=z7.default.forwardRef((F,V)=>{let{scope:M,children:D}=F,N=X(z,M),O=rW(V,N.collectionRef);return G(K,{ref:O,children:D})});W.displayName=z;let H=$+"CollectionItemSlot",B="data-radix-collection-item",U=sW(H),_=z7.default.forwardRef((F,V)=>{let{scope:M,children:D,...N}=F,O=z7.default.useRef(null),I=rW(V,O),k=X(H,M);return z7.default.useEffect(()=>{return k.itemMap.set(O,{ref:O,...N}),()=>void k.itemMap.delete(O)}),G(U,{...{[B]:""},ref:I,children:D})});_.displayName=H;function L(F){let V=X($+"CollectionConsumer",F);return z7.default.useCallback(()=>{let D=V.collectionRef.current;if(!D)return[];let N=Array.from(D.querySelectorAll(`[${B}]`));return Array.from(V.itemMap.values()).sort((k,T)=>N.indexOf(k.ref.current)-N.indexOf(T.ref.current))},[V.collectionRef,V.itemMap])}return[{Provider:Y,Slot:W,ItemSlot:_},L,Z]}var dF=new WeakMap,je=class $ extends Map{#$;constructor(J){super(J);this.#$=[...super.keys()],dF.set(this,!0)}set(J,Q){if(dF.get(this))if(this.has(J))this.#$[this.#$.indexOf(J)]=J;else this.#$.push(J);return super.set(J,Q),this}insert(J,Q,Z){let q=this.has(Q),X=this.#$.length,Y=pF(J),z=Y>=0?Y:X+Y,K=z<0||z>=X?-1:z;if(K===this.size||q&&K===this.size-1||K===-1)return this.set(Q,Z),this;let W=this.size+(q?0:1);if(Y<0)z++;let H=[...this.#$],B,U=!1;for(let _=z;_=this.size)q=this.size-1;return this.at(q)}keyFrom(J,Q){let Z=this.indexOf(J);if(Z===-1)return;let q=Z+Q;if(q<0)q=0;if(q>=this.size)q=this.size-1;return this.keyAt(q)}find(J,Q){let Z=0;for(let q of this){if(Reflect.apply(J,Q,[q,Z,this]))return q;Z++}return}findIndex(J,Q){let Z=0;for(let q of this){if(Reflect.apply(J,Q,[q,Z,this]))return Z;Z++}return-1}filter(J,Q){let Z=[],q=0;for(let X of this){if(Reflect.apply(J,Q,[X,q,this]))Z.push(X);q++}return new $(Z)}map(J,Q){let Z=[],q=0;for(let X of this)Z.push([X[0],Reflect.apply(J,Q,[X,q,this])]),q++;return new $(Z)}reduce(...J){let[Q,Z]=J,q=0,X=Z??this.at(0);for(let Y of this){if(q===0&&J.length===1)X=Y;else X=Reflect.apply(Q,this,[X,Y,q,this]);q++}return X}reduceRight(...J){let[Q,Z]=J,q=Z??this.at(-1);for(let X=this.size-1;X>=0;X--){let Y=this.at(X);if(X===this.size-1&&J.length===1)q=Y;else q=Reflect.apply(Q,this,[q,Y,X,this])}return q}toSorted(J){let Q=[...this.entries()].sort(J);return new $(Q)}toReversed(){let J=new $;for(let Q=this.size-1;Q>=0;Q--){let Z=this.keyAt(Q),q=this.get(Z);J.set(Z,q)}return J}toSpliced(...J){let Q=[...this.entries()];return Q.splice(...J),new $(Q)}slice(J,Q){let Z=new $,q=this.size-1;if(J===void 0)return Z;if(J<0)J=J+this.size;if(Q!==void 0&&Q>0)q=Q-1;for(let X=J;X<=q;X++){let Y=this.keyAt(X),z=this.get(Y);Z.set(Y,z)}return Z}every(J,Q){let Z=0;for(let q of this){if(!Reflect.apply(J,Q,[q,Z,this]))return!1;Z++}return!0}some(J,Q){let Z=0;for(let q of this){if(Reflect.apply(J,Q,[q,Z,this]))return!0;Z++}return!1}};function oW($,J){if("at"in Array.prototype)return Array.prototype.at.call($,J);let Q=nh($,J);return Q===-1?void 0:$[Q]}function nh($,J){let Q=$.length,Z=pF(J),q=Z>=0?Z:Q+Z;return q<0||q>=Q?-1:q}function pF($){return $!==$||$===0?0:Math.trunc($)}var iF=R(v(),1);function lF($,J){if(typeof $==="function")return $(J);else if($!==null&&$!==void 0)$.current=J}function nW(...$){return(J)=>{let Q=!1,Z=$.map((q)=>{let X=lF(q,J);if(!Q&&typeof X=="function")Q=!0;return X});if(Q)return()=>{for(let q=0;q{let{scope:U,children:_,...L}=B,F=U?.[$]?.[K]||z,V=N4.useMemo(()=>L,Object.values(L));return G(F.Provider,{value:V,children:_})};W.displayName=X+"Provider";function H(B,U){let _=U?.[$]?.[K]||z,L=N4.useContext(_);if(L)return L;if(Y!==void 0)return Y;throw Error(`\`${B}\` must be used within \`${X}\``)}return[W,H]}let q=()=>{let X=Q.map((Y)=>{return N4.createContext(Y)});return function(z){let K=z?.[$]||X;return N4.useMemo(()=>({[`__scope${$}`]:{...z,[$]:K}}),[z,K])}};return q.scopeName=$,[Z,ah(q,...J)]}function ah(...$){let J=$[0];if($.length===1)return J;let Q=()=>{let Z=$.map((q)=>({useScope:q(),scopeName:q.scopeName}));return function(X){let Y=Z.reduce((z,{useScope:K,scopeName:W})=>{let B=K(X)[`__scope${W}`];return{...z,...B}},{});return N4.useMemo(()=>({[`__scope${J.scopeName}`]:Y}),[Y])}};return Q.scopeName=J.scopeName,Q}var BX=R(v(),1);var th=BX.createContext(void 0);function d9($){let J=BX.useContext(th);return $||J||"ltr"}var I5=R(v(),1);var xe=!!(typeof window<"u"&&window.document&&window.document.createElement);function UX($,J,{checkForDefaultPrevented:Q=!0}={}){return function(q){if($?.(q),Q===!1||!q.defaultPrevented)return J?.(q)}}var aF=R(v(),1),tF=R($5(),1);var o5=R(v(),1);var oF=R(v(),1);function sF($,J){if(typeof $==="function")return $(J);else if($!==null&&$!==void 0)$.current=J}function aW(...$){return(J)=>{let Q=!1,Z=$.map((q)=>{let X=sF(q,J);if(!Q&&typeof X=="function")Q=!0;return X});if(Q)return()=>{for(let q=0;q{let{children:X,...Y}=Z,z=o5.Children.toArray(X),K=z.find(Jx);if(K){let W=K.props.children,H=z.map((B)=>{if(B===K){if(o5.Children.count(W)>1)return o5.Children.only(null);return o5.isValidElement(W)?W.props.children:null}else return B});return G(J,{...Y,ref:q,children:o5.isValidElement(W)?o5.cloneElement(W,void 0,H):null})}return G(J,{...Y,ref:q,children:X})});return Q.displayName=`${$}.Slot`,Q}function eh($){let J=o5.forwardRef((Q,Z)=>{let{children:q,...X}=Q;if(o5.isValidElement(q)){let Y=Zx(q),z=Qx(X,q.props);if(q.type!==o5.Fragment)z.ref=Z?aW(Z,Y):Y;return o5.cloneElement(q,z)}return o5.Children.count(q)>1?o5.Children.only(null):null});return J.displayName=`${$}.SlotClone`,J}var $x=Symbol("radix.slottable");function Jx($){return o5.isValidElement($)&&typeof $.type==="function"&&"__radixId"in $.type&&$.type.__radixId===$x}function Qx($,J){let Q={...J};for(let Z in J){let q=$[Z],X=J[Z];if(/^on[A-Z]/.test(Z)){if(q&&X)Q[Z]=(...z)=>{let K=X(...z);return q(...z),K};else if(q)Q[Z]=q}else if(Z==="style")Q[Z]={...q,...X};else if(Z==="className")Q[Z]=[q,X].filter(Boolean).join(" ")}return{...$,...Q}}function Zx($){let J=Object.getOwnPropertyDescriptor($.props,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning;if(Q)return $.ref;if(J=Object.getOwnPropertyDescriptor($,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning,Q)return $.props.ref;return $.props.ref||$.ref}var qx=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],eW=qx.reduce(($,J)=>{let Q=nF(`Primitive.${J}`),Z=aF.forwardRef((q,X)=>{let{asChild:Y,...z}=q,K=Y?Q:J;if(typeof window<"u")window[Symbol.for("radix-ui")]=!0;return G(K,{...z,ref:X})});return Z.displayName=`Primitive.${J}`,{...$,[J]:Z}},{});function eF($,J){if($)tF.flushSync(()=>$.dispatchEvent(J))}var v$=R(v(),1);function c5($){let J=v$.useRef($);return v$.useEffect(()=>{J.current=$}),v$.useMemo(()=>(...Q)=>J.current?.(...Q),[])}var $V=R(v(),1);function JV($,J=globalThis?.document){let Q=c5($);$V.useEffect(()=>{let Z=(q)=>{if(q.key==="Escape")Q(q)};return J.addEventListener("keydown",Z,{capture:!0}),()=>J.removeEventListener("keydown",Z,{capture:!0})},[Q,J])}var Xx="DismissableLayer",$H="dismissableLayer.update",Yx="dismissableLayer.pointerDownOutside",zx="dismissableLayer.focusOutside",QV,qV=I5.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),O9=I5.forwardRef(($,J)=>{let{disableOutsidePointerEvents:Q=!1,onEscapeKeyDown:Z,onPointerDownOutside:q,onFocusOutside:X,onInteractOutside:Y,onDismiss:z,...K}=$,W=I5.useContext(qV),[H,B]=I5.useState(null),U=H?.ownerDocument??globalThis?.document,[,_]=I5.useState({}),L=tW(J,(T)=>B(T)),F=Array.from(W.layers),[V]=[...W.layersWithOutsidePointerEventsDisabled].slice(-1),M=F.indexOf(V),D=H?F.indexOf(H):-1,N=W.layersWithOutsidePointerEventsDisabled.size>0,O=D>=M,I=Wx((T)=>{let A=T.target,w=[...W.branches].some((C)=>C.contains(A));if(!O||w)return;if(q?.(T),Y?.(T),!T.defaultPrevented)z?.()},U),k=Hx((T)=>{let A=T.target;if([...W.branches].some((C)=>C.contains(A)))return;if(X?.(T),Y?.(T),!T.defaultPrevented)z?.()},U);return JV((T)=>{if(D!==W.layers.size-1)return;if(Z?.(T),!T.defaultPrevented&&z)T.preventDefault(),z()},U),I5.useEffect(()=>{if(!H)return;if(Q){if(W.layersWithOutsidePointerEventsDisabled.size===0)QV=U.body.style.pointerEvents,U.body.style.pointerEvents="none";W.layersWithOutsidePointerEventsDisabled.add(H)}return W.layers.add(H),ZV(),()=>{if(Q&&W.layersWithOutsidePointerEventsDisabled.size===1)U.body.style.pointerEvents=QV}},[H,U,Q,W]),I5.useEffect(()=>{return()=>{if(!H)return;W.layers.delete(H),W.layersWithOutsidePointerEventsDisabled.delete(H),ZV()}},[H,W]),I5.useEffect(()=>{let T=()=>_({});return document.addEventListener($H,T),()=>document.removeEventListener($H,T)},[]),G(eW.div,{...K,ref:L,style:{pointerEvents:N?O?"auto":"none":void 0,...$.style},onFocusCapture:UX($.onFocusCapture,k.onFocusCapture),onBlurCapture:UX($.onBlurCapture,k.onBlurCapture),onPointerDownCapture:UX($.onPointerDownCapture,I.onPointerDownCapture)})});O9.displayName=Xx;var Kx="DismissableLayerBranch",Gx=I5.forwardRef(($,J)=>{let Q=I5.useContext(qV),Z=I5.useRef(null),q=tW(J,Z);return I5.useEffect(()=>{let X=Z.current;if(X)return Q.branches.add(X),()=>{Q.branches.delete(X)}},[Q.branches]),G(eW.div,{...$,ref:q})});Gx.displayName=Kx;function Wx($,J=globalThis?.document){let Q=c5($),Z=I5.useRef(!1),q=I5.useRef(()=>{});return I5.useEffect(()=>{let X=(z)=>{if(z.target&&!Z.current){let W=function(){XV(Yx,Q,H,{discrete:!0})};var K=W;let H={originalEvent:z};if(z.pointerType==="touch")J.removeEventListener("click",q.current),q.current=W,J.addEventListener("click",q.current,{once:!0});else W()}else J.removeEventListener("click",q.current);Z.current=!1},Y=window.setTimeout(()=>{J.addEventListener("pointerdown",X)},0);return()=>{window.clearTimeout(Y),J.removeEventListener("pointerdown",X),J.removeEventListener("click",q.current)}},[J,Q]),{onPointerDownCapture:()=>Z.current=!0}}function Hx($,J=globalThis?.document){let Q=c5($),Z=I5.useRef(!1);return I5.useEffect(()=>{let q=(X)=>{if(X.target&&!Z.current)XV(zx,Q,{originalEvent:X},{discrete:!1})};return J.addEventListener("focusin",q),()=>J.removeEventListener("focusin",q)},[J,Q]),{onFocusCapture:()=>Z.current=!0,onBlurCapture:()=>Z.current=!1}}function ZV(){let $=new CustomEvent($H);document.dispatchEvent($)}function XV($,J,Q,{discrete:Z}){let q=Q.originalEvent.target,X=new CustomEvent($,{bubbles:!1,cancelable:!0,detail:Q});if(J)q.addEventListener($,J,{once:!0});if(Z)eF(q,X);else q.dispatchEvent(X)}var zV=R(v(),1),JH=0;function G7(){zV.useEffect(()=>{let $=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",$[0]??YV()),document.body.insertAdjacentElement("beforeend",$[1]??YV()),JH++,()=>{if(JH===1)document.querySelectorAll("[data-radix-focus-guard]").forEach((J)=>J.remove());JH--}},[])}function YV(){let $=document.createElement("span");return $.setAttribute("data-radix-focus-guard",""),$.tabIndex=0,$.style.outline="none",$.style.opacity="0",$.style.position="fixed",$.style.pointerEvents="none",$}var g6=R(v(),1);var GV=R(v(),1);function KV($,J){if(typeof $==="function")return $(J);else if($!==null&&$!==void 0)$.current=J}function QH(...$){return(J)=>{let Q=!1,Z=$.map((q)=>{let X=KV(q,J);if(!Q&&typeof X=="function")Q=!0;return X});if(Q)return()=>{for(let q=0;q{let{children:X,...Y}=Z,z=n5.Children.toArray(X),K=z.find(_x);if(K){let W=K.props.children,H=z.map((B)=>{if(B===K){if(n5.Children.count(W)>1)return n5.Children.only(null);return n5.isValidElement(W)?W.props.children:null}else return B});return G(J,{...Y,ref:q,children:n5.isValidElement(W)?n5.cloneElement(W,void 0,H):null})}return G(J,{...Y,ref:q,children:X})});return Q.displayName=`${$}.Slot`,Q}function Bx($){let J=n5.forwardRef((Q,Z)=>{let{children:q,...X}=Q;if(n5.isValidElement(q)){let Y=Fx(q),z=Lx(X,q.props);if(q.type!==n5.Fragment)z.ref=Z?QH(Z,Y):Y;return n5.cloneElement(q,z)}return n5.Children.count(q)>1?n5.Children.only(null):null});return J.displayName=`${$}.SlotClone`,J}var Ux=Symbol("radix.slottable");function _x($){return n5.isValidElement($)&&typeof $.type==="function"&&"__radixId"in $.type&&$.type.__radixId===Ux}function Lx($,J){let Q={...J};for(let Z in J){let q=$[Z],X=J[Z];if(/^on[A-Z]/.test(Z)){if(q&&X)Q[Z]=(...z)=>{let K=X(...z);return q(...z),K};else if(q)Q[Z]=q}else if(Z==="style")Q[Z]={...q,...X};else if(Z==="className")Q[Z]=[q,X].filter(Boolean).join(" ")}return{...$,...Q}}function Fx($){let J=Object.getOwnPropertyDescriptor($.props,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning;if(Q)return $.ref;if(J=Object.getOwnPropertyDescriptor($,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning,Q)return $.props.ref;return $.props.ref||$.ref}var Mx=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],UV=Mx.reduce(($,J)=>{let Q=HV(`Primitive.${J}`),Z=BV.forwardRef((q,X)=>{let{asChild:Y,...z}=q,K=Y?Q:J;if(typeof window<"u")window[Symbol.for("radix-ui")]=!0;return G(K,{...z,ref:X})});return Z.displayName=`Primitive.${J}`,{...$,[J]:Z}},{});var ZH="focusScope.autoFocusOnMount",qH="focusScope.autoFocusOnUnmount",_V={bubbles:!1,cancelable:!0},Dx="FocusScope",O4=g6.forwardRef(($,J)=>{let{loop:Q=!1,trapped:Z=!1,onMountAutoFocus:q,onUnmountAutoFocus:X,...Y}=$,[z,K]=g6.useState(null),W=c5(q),H=c5(X),B=g6.useRef(null),U=WV(J,(F)=>K(F)),_=g6.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;g6.useEffect(()=>{if(Z){let D=function(k){if(_.paused||!z)return;let T=k.target;if(z.contains(T))B.current=T;else W7(B.current,{select:!0})},N=function(k){if(_.paused||!z)return;let T=k.relatedTarget;if(T===null)return;if(!z.contains(T))W7(B.current,{select:!0})},O=function(k){if(document.activeElement!==document.body)return;for(let A of k)if(A.removedNodes.length>0)W7(z)};var F=D,V=N,M=O;document.addEventListener("focusin",D),document.addEventListener("focusout",N);let I=new MutationObserver(O);if(z)I.observe(z,{childList:!0,subtree:!0});return()=>{document.removeEventListener("focusin",D),document.removeEventListener("focusout",N),I.disconnect()}}},[Z,z,_.paused]),g6.useEffect(()=>{if(z){FV.add(_);let F=document.activeElement;if(!z.contains(F)){let M=new CustomEvent(ZH,_V);if(z.addEventListener(ZH,W),z.dispatchEvent(M),!M.defaultPrevented){if(Nx(Ix(MV(z)),{select:!0}),document.activeElement===F)W7(z)}}return()=>{z.removeEventListener(ZH,W),setTimeout(()=>{let M=new CustomEvent(qH,_V);if(z.addEventListener(qH,H),z.dispatchEvent(M),!M.defaultPrevented)W7(F??document.body,{select:!0});z.removeEventListener(qH,H),FV.remove(_)},0)}}},[z,W,H,_]);let L=g6.useCallback((F)=>{if(!Q&&!Z)return;if(_.paused)return;let V=F.key==="Tab"&&!F.altKey&&!F.ctrlKey&&!F.metaKey,M=document.activeElement;if(V&&M){let D=F.currentTarget,[N,O]=Ox(D);if(!(N&&O)){if(M===D)F.preventDefault()}else if(!F.shiftKey&&M===O){if(F.preventDefault(),Q)W7(N,{select:!0})}else if(F.shiftKey&&M===N){if(F.preventDefault(),Q)W7(O,{select:!0})}}},[Q,Z,_.paused]);return G(UV.div,{tabIndex:-1,...Y,ref:U,onKeyDown:L})});O4.displayName=Dx;function Nx($,{select:J=!1}={}){let Q=document.activeElement;for(let Z of $)if(W7(Z,{select:J}),document.activeElement!==Q)return}function Ox($){let J=MV($),Q=LV(J,$),Z=LV(J.reverse(),$);return[Q,Z]}function MV($){let J=[],Q=document.createTreeWalker($,NodeFilter.SHOW_ELEMENT,{acceptNode:(Z)=>{let q=Z.tagName==="INPUT"&&Z.type==="hidden";if(Z.disabled||Z.hidden||q)return NodeFilter.FILTER_SKIP;return Z.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});while(Q.nextNode())J.push(Q.currentNode);return J}function LV($,J){for(let Q of $)if(!Ax(Q,{upTo:J}))return Q}function Ax($,{upTo:J}){if(getComputedStyle($).visibility==="hidden")return!0;while($){if(J!==void 0&&$===J)return!1;if(getComputedStyle($).display==="none")return!0;$=$.parentElement}return!1}function wx($){return $ instanceof HTMLInputElement&&"select"in $}function W7($,{select:J=!1}={}){if($&&$.focus){let Q=document.activeElement;if($.focus({preventScroll:!0}),$!==Q&&wx($)&&J)$.select()}}var FV=kx();function kx(){let $=[];return{add(J){let Q=$[0];if(J!==Q)Q?.pause();$=VV($,J),$.unshift(J)},remove(J){$=VV($,J),$[0]?.resume()}}}function VV($,J){let Q=[...$],Z=Q.indexOf(J);if(Z!==-1)Q.splice(Z,1);return Q}function Ix($){return $.filter((J)=>J.tagName!=="A")}var XH=R(v(),1);var DV=R(v(),1),L1=globalThis?.document?DV.useLayoutEffect:()=>{};var Tx=XH[" useId ".trim().toString()]||(()=>{return}),bx=0;function a5($){let[J,Q]=XH.useState(Tx());return L1(()=>{if(!$)Q((Z)=>Z??String(bx++))},[$]),$||(J?`radix-${J}`:"")}var K6=R(v(),1);var AV=["top","right","bottom","left"];var{min:p9,max:n8,round:H7,floor:vQ}=Math,A9=($)=>({x:$,y:$}),jx={left:"right",right:"left",bottom:"top",top:"bottom"};function g$($,J,Q){return n8($,p9(J,Q))}function u6($,J){return typeof $==="function"?$(J):$}function j8($){return $.split("-")[0]}function m6($){return $.split("-")[1]}function LX($){return $==="x"?"y":"x"}function u$($){return $==="y"?"height":"width"}function z6($){let J=$[0];return J==="t"||J==="b"?"y":"x"}function m$($){return LX(z6($))}function wV($,J,Q){if(Q===void 0)Q=!1;let Z=m6($),q=m$($),X=u$(q),Y=q==="x"?Z===(Q?"end":"start")?"right":"left":Z==="start"?"bottom":"top";if(J.reference[X]>J.floating[X])Y=fQ(Y);return[Y,fQ(Y)]}function kV($){let J=fQ($);return[_X($),J,_X(J)]}function _X($){return $.includes("start")?$.replace("start","end"):$.replace("end","start")}var NV=["left","right"],OV=["right","left"],Ex=["top","bottom"],yx=["bottom","top"];function Px($,J,Q){switch($){case"top":case"bottom":if(Q)return J?OV:NV;return J?NV:OV;case"left":case"right":return J?Ex:yx;default:return[]}}function IV($,J,Q,Z){let q=m6($),X=Px(j8($),Q==="start",Z);if(q){if(X=X.map((Y)=>Y+"-"+q),J)X=X.concat(X.map(_X))}return X}function fQ($){let J=j8($);return jx[J]+$.slice(J.length)}function Rx($){return{top:0,right:0,bottom:0,left:0,...$}}function gQ($){return typeof $!=="number"?Rx($):{top:$,right:$,bottom:$,left:$}}function H2($){let{x:J,y:Q,width:Z,height:q}=$;return{width:Z,height:q,top:Q,left:J,right:J+Z,bottom:Q+q,x:J,y:Q}}function TV($,J,Q){let{reference:Z,floating:q}=$,X=z6(J),Y=m$(J),z=u$(Y),K=j8(J),W=X==="y",H=Z.x+Z.width/2-q.width/2,B=Z.y+Z.height/2-q.height/2,U=Z[z]/2-q[z]/2,_;switch(K){case"top":_={x:H,y:Z.y-q.height};break;case"bottom":_={x:H,y:Z.y+Z.height};break;case"right":_={x:Z.x+Z.width,y:B};break;case"left":_={x:Z.x-q.width,y:B};break;default:_={x:Z.x,y:Z.y}}switch(m6(J)){case"start":_[Y]-=U*(Q&&W?-1:1);break;case"end":_[Y]+=U*(Q&&W?-1:1);break}return _}async function EV($,J){var Q;if(J===void 0)J={};let{x:Z,y:q,platform:X,rects:Y,elements:z,strategy:K}=$,{boundary:W="clippingAncestors",rootBoundary:H="viewport",elementContext:B="floating",altBoundary:U=!1,padding:_=0}=u6(J,$),L=gQ(_),V=z[U?B==="floating"?"reference":"floating":B],M=H2(await X.getClippingRect({element:((Q=await(X.isElement==null?void 0:X.isElement(V)))!=null?Q:!0)?V:V.contextElement||await(X.getDocumentElement==null?void 0:X.getDocumentElement(z.floating)),boundary:W,rootBoundary:H,strategy:K})),D=B==="floating"?{x:Z,y:q,width:Y.floating.width,height:Y.floating.height}:Y.reference,N=await(X.getOffsetParent==null?void 0:X.getOffsetParent(z.floating)),O=await(X.isElement==null?void 0:X.isElement(N))?await(X.getScale==null?void 0:X.getScale(N))||{x:1,y:1}:{x:1,y:1},I=H2(X.convertOffsetParentRelativeRectToViewportRelativeRect?await X.convertOffsetParentRelativeRectToViewportRelativeRect({elements:z,rect:D,offsetParent:N,strategy:K}):D);return{top:(M.top-I.top+L.top)/O.y,bottom:(I.bottom-M.bottom+L.bottom)/O.y,left:(M.left-I.left+L.left)/O.x,right:(I.right-M.right+L.right)/O.x}}var Cx=50,yV=async($,J,Q)=>{let{placement:Z="bottom",strategy:q="absolute",middleware:X=[],platform:Y}=Q,z=Y.detectOverflow?Y:{...Y,detectOverflow:EV},K=await(Y.isRTL==null?void 0:Y.isRTL(J)),W=await Y.getElementRects({reference:$,floating:J,strategy:q}),{x:H,y:B}=TV(W,Z,K),U=Z,_=0,L={};for(let F=0;F({name:"arrow",options:$,async fn(J){let{x:Q,y:Z,placement:q,rects:X,platform:Y,elements:z,middlewareData:K}=J,{element:W,padding:H=0}=u6($,J)||{};if(W==null)return{};let B=gQ(H),U={x:Q,y:Z},_=m$(q),L=u$(_),F=await Y.getDimensions(W),V=_==="y",M=V?"top":"left",D=V?"bottom":"right",N=V?"clientHeight":"clientWidth",O=X.reference[L]+X.reference[_]-U[_]-X.floating[L],I=U[_]-X.reference[_],k=await(Y.getOffsetParent==null?void 0:Y.getOffsetParent(W)),T=k?k[N]:0;if(!T||!await(Y.isElement==null?void 0:Y.isElement(k)))T=z.floating[N]||X.floating[L];let A=O/2-I/2,w=T/2-F[L]/2-1,C=p9(B[M],w),y=p9(B[D],w),x=C,j=T-F[L]-y,P=T/2-F[L]/2+A,h=g$(x,P,j),l=!K.arrow&&m6(q)!=null&&P!==h&&X.reference[L]/2-(PP<=0)){var y,x;let P=(((y=X.flip)==null?void 0:y.index)||0)+1,h=T[P];if(h){if(!(B==="alignment"?D!==z6(h):!1)||C.every((S)=>z6(S.placement)===D?S.overflows[0]>0:!0))return{data:{index:P,overflows:C},reset:{placement:h}}}let l=(x=C.filter((t)=>t.overflows[0]<=0).sort((t,S)=>t.overflows[1]-S.overflows[1])[0])==null?void 0:x.placement;if(!l)switch(_){case"bestFit":{var j;let t=(j=C.filter((S)=>{if(k){let i=z6(S.placement);return i===D||i==="y"}return!0}).map((S)=>[S.placement,S.overflows.filter((i)=>i>0).reduce((i,J0)=>i+J0,0)]).sort((S,i)=>S[1]-i[1])[0])==null?void 0:j[0];if(t)l=t;break}case"initialPlacement":l=z;break}if(q!==l)return{reset:{placement:l}}}return{}}}};function bV($,J){return{top:$.top-J.height,right:$.right-J.width,bottom:$.bottom-J.height,left:$.left-J.width}}function jV($){return AV.some((J)=>$[J]>=0)}var CV=function($){if($===void 0)$={};return{name:"hide",options:$,async fn(J){let{rects:Q,platform:Z}=J,{strategy:q="referenceHidden",...X}=u6($,J);switch(q){case"referenceHidden":{let Y=await Z.detectOverflow(J,{...X,elementContext:"reference"}),z=bV(Y,Q.reference);return{data:{referenceHiddenOffsets:z,referenceHidden:jV(z)}}}case"escaped":{let Y=await Z.detectOverflow(J,{...X,altBoundary:!0}),z=bV(Y,Q.floating);return{data:{escapedOffsets:z,escaped:jV(z)}}}default:return{}}}}};var SV=new Set(["left","top"]);async function Sx($,J){let{placement:Q,platform:Z,elements:q}=$,X=await(Z.isRTL==null?void 0:Z.isRTL(q.floating)),Y=j8(Q),z=m6(Q),K=z6(Q)==="y",W=SV.has(Y)?-1:1,H=X&&K?-1:1,B=u6(J,$),{mainAxis:U,crossAxis:_,alignmentAxis:L}=typeof B==="number"?{mainAxis:B,crossAxis:0,alignmentAxis:null}:{mainAxis:B.mainAxis||0,crossAxis:B.crossAxis||0,alignmentAxis:B.alignmentAxis};if(z&&typeof L==="number")_=z==="end"?L*-1:L;return K?{x:_*H,y:U*W}:{x:U*W,y:_*H}}var hV=function($){if($===void 0)$=0;return{name:"offset",options:$,async fn(J){var Q,Z;let{x:q,y:X,placement:Y,middlewareData:z}=J,K=await Sx(J,$);if(Y===((Q=z.offset)==null?void 0:Q.placement)&&(Z=z.arrow)!=null&&Z.alignmentOffset)return{};return{x:q+K.x,y:X+K.y,data:{...K,placement:Y}}}}},xV=function($){if($===void 0)$={};return{name:"shift",options:$,async fn(J){let{x:Q,y:Z,placement:q,platform:X}=J,{mainAxis:Y=!0,crossAxis:z=!1,limiter:K={fn:(M)=>{let{x:D,y:N}=M;return{x:D,y:N}}},...W}=u6($,J),H={x:Q,y:Z},B=await X.detectOverflow(J,W),U=z6(j8(q)),_=LX(U),L=H[_],F=H[U];if(Y){let M=_==="y"?"top":"left",D=_==="y"?"bottom":"right",N=L+B[M],O=L-B[D];L=g$(N,L,O)}if(z){let M=U==="y"?"top":"left",D=U==="y"?"bottom":"right",N=F+B[M],O=F-B[D];F=g$(N,F,O)}let V=K.fn({...J,[_]:L,[U]:F});return{...V,data:{x:V.x-Q,y:V.y-Z,enabled:{[_]:Y,[U]:z}}}}}},fV=function($){if($===void 0)$={};return{options:$,fn(J){let{x:Q,y:Z,placement:q,rects:X,middlewareData:Y}=J,{offset:z=0,mainAxis:K=!0,crossAxis:W=!0}=u6($,J),H={x:Q,y:Z},B=z6(q),U=LX(B),_=H[U],L=H[B],F=u6(z,J),V=typeof F==="number"?{mainAxis:F,crossAxis:0}:{mainAxis:0,crossAxis:0,...F};if(K){let N=U==="y"?"height":"width",O=X.reference[U]-X.floating[N]+V.mainAxis,I=X.reference[U]+X.reference[N]-V.mainAxis;if(_I)_=I}if(W){var M,D;let N=U==="y"?"width":"height",O=SV.has(j8(q)),I=X.reference[B]-X.floating[N]+(O?((M=Y.offset)==null?void 0:M[B])||0:0)+(O?0:V.crossAxis),k=X.reference[B]+X.reference[N]+(O?0:((D=Y.offset)==null?void 0:D[B])||0)-(O?V.crossAxis:0);if(Lk)L=k}return{[U]:_,[B]:L}}}},vV=function($){if($===void 0)$={};return{name:"size",options:$,async fn(J){var Q,Z;let{placement:q,rects:X,platform:Y,elements:z}=J,{apply:K=()=>{},...W}=u6($,J),H=await Y.detectOverflow(J,W),B=j8(q),U=m6(q),_=z6(q)==="y",{width:L,height:F}=X.floating,V,M;if(B==="top"||B==="bottom")V=B,M=U===(await(Y.isRTL==null?void 0:Y.isRTL(z.floating))?"start":"end")?"left":"right";else M=B,V=U==="end"?"top":"bottom";let D=F-H.top-H.bottom,N=L-H.left-H.right,O=p9(F-H[V],D),I=p9(L-H[M],N),k=!J.middlewareData.shift,T=O,A=I;if((Q=J.middlewareData.shift)!=null&&Q.enabled.x)A=N;if((Z=J.middlewareData.shift)!=null&&Z.enabled.y)T=D;if(k&&!U){let C=n8(H.left,0),y=n8(H.right,0),x=n8(H.top,0),j=n8(H.bottom,0);if(_)A=L-2*(C!==0||y!==0?C+y:n8(H.left,H.right));else T=F-2*(x!==0||j!==0?x+j:n8(H.top,H.bottom))}await K({...J,availableWidth:A,availableHeight:T});let w=await Y.getDimensions(z.floating);if(L!==w.width||F!==w.height)return{reset:{rects:!0}};return{}}}};function FX(){return typeof window<"u"}function x5($){if(VX($))return($.nodeName||"").toLowerCase();return"#document"}function S1($){var J;return($==null||(J=$.ownerDocument)==null?void 0:J.defaultView)||window}function w9($){var J;return(J=(VX($)?$.ownerDocument:$.document)||window.document)==null?void 0:J.documentElement}function VX($){if(!FX())return!1;return $ instanceof Node||$ instanceof S1($).Node}function V1($){if(!FX())return!1;return $ instanceof Element||$ instanceof S1($).Element}function R1($){if(!FX())return!1;return $ instanceof HTMLElement||$ instanceof S1($).HTMLElement}function l9($){if(!FX()||typeof ShadowRoot>"u")return!1;return $ instanceof ShadowRoot||$ instanceof S1($).ShadowRoot}function i9($){let{overflow:J,overflowX:Q,overflowY:Z,display:q}=d5($);return/auto|scroll|overlay|hidden|clip/.test(J+Z+Q)&&q!=="inline"&&q!=="contents"}function gV($){return/^(table|td|th)$/.test(x5($))}function uQ($){try{if($.matches(":popover-open"))return!0}catch(J){}try{return $.matches(":modal")}catch(J){return!1}}var hx=/transform|translate|scale|rotate|perspective|filter/,xx=/paint|layout|strict|content/,B2=($)=>!!$&&$!=="none",YH;function MX($){let J=V1($)?d5($):$;return B2(J.transform)||B2(J.translate)||B2(J.scale)||B2(J.rotate)||B2(J.perspective)||!DX()&&(B2(J.backdropFilter)||B2(J.filter))||hx.test(J.willChange||"")||xx.test(J.contain||"")}function uV($){let J=b6($);while(R1(J)&&!j6(J)){if(MX(J))return J;else if(uQ(J))return null;J=b6(J)}return null}function DX(){if(YH==null)YH=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none");return YH}function j6($){return/^(html|body|#document)$/.test(x5($))}function d5($){return S1($).getComputedStyle($)}function mQ($){if(V1($))return{scrollLeft:$.scrollLeft,scrollTop:$.scrollTop};return{scrollLeft:$.scrollX,scrollTop:$.scrollY}}function b6($){if(x5($)==="html")return $;let J=$.assignedSlot||$.parentNode||l9($)&&$.host||w9($);return l9(J)?J.host:J}function mV($){let J=b6($);if(j6(J))return $.ownerDocument?$.ownerDocument.body:$.body;if(R1(J)&&i9(J))return J;return mV(J)}function B7($,J,Q){var Z;if(J===void 0)J=[];if(Q===void 0)Q=!0;let q=mV($),X=q===((Z=$.ownerDocument)==null?void 0:Z.body),Y=S1(q);if(X){let z=NX(Y);return J.concat(Y,Y.visualViewport||[],i9(q)?q:[],z&&Q?B7(z):[])}else return J.concat(q,B7(q,[],Q))}function NX($){return $.parent&&Object.getPrototypeOf($.parent)?$.frameElement:null}function lV($){let J=d5($),Q=parseFloat(J.width)||0,Z=parseFloat(J.height)||0,q=R1($),X=q?$.offsetWidth:Q,Y=q?$.offsetHeight:Z,z=H7(Q)!==X||H7(Z)!==Y;if(z)Q=X,Z=Y;return{width:Q,height:Z,$:z}}function KH($){return!V1($)?$.contextElement:$}function c$($){let J=KH($);if(!R1(J))return A9(1);let Q=J.getBoundingClientRect(),{width:Z,height:q,$:X}=lV(J),Y=(X?H7(Q.width):Q.width)/Z,z=(X?H7(Q.height):Q.height)/q;if(!Y||!Number.isFinite(Y))Y=1;if(!z||!Number.isFinite(z))z=1;return{x:Y,y:z}}var fx=A9(0);function iV($){let J=S1($);if(!DX()||!J.visualViewport)return fx;return{x:J.visualViewport.offsetLeft,y:J.visualViewport.offsetTop}}function vx($,J,Q){if(J===void 0)J=!1;if(!Q||J&&Q!==S1($))return!1;return J}function U2($,J,Q,Z){if(J===void 0)J=!1;if(Q===void 0)Q=!1;let q=$.getBoundingClientRect(),X=KH($),Y=A9(1);if(J)if(Z){if(V1(Z))Y=c$(Z)}else Y=c$($);let z=vx(X,Q,Z)?iV(X):A9(0),K=(q.left+z.x)/Y.x,W=(q.top+z.y)/Y.y,H=q.width/Y.x,B=q.height/Y.y;if(X){let U=S1(X),_=Z&&V1(Z)?S1(Z):Z,L=U,F=NX(L);while(F&&Z&&_!==L){let V=c$(F),M=F.getBoundingClientRect(),D=d5(F),N=M.left+(F.clientLeft+parseFloat(D.paddingLeft))*V.x,O=M.top+(F.clientTop+parseFloat(D.paddingTop))*V.y;K*=V.x,W*=V.y,H*=V.x,B*=V.y,K+=N,W+=O,L=S1(F),F=NX(L)}}return H2({width:H,height:B,x:K,y:W})}function OX($,J){let Q=mQ($).scrollLeft;if(!J)return U2(w9($)).left+Q;return J.left+Q}function rV($,J){let Q=$.getBoundingClientRect(),Z=Q.left+J.scrollLeft-OX($,Q),q=Q.top+J.scrollTop;return{x:Z,y:q}}function gx($){let{elements:J,rect:Q,offsetParent:Z,strategy:q}=$,X=q==="fixed",Y=w9(Z),z=J?uQ(J.floating):!1;if(Z===Y||z&&X)return Q;let K={scrollLeft:0,scrollTop:0},W=A9(1),H=A9(0),B=R1(Z);if(B||!B&&!X){if(x5(Z)!=="body"||i9(Y))K=mQ(Z);if(B){let _=U2(Z);W=c$(Z),H.x=_.x+Z.clientLeft,H.y=_.y+Z.clientTop}}let U=Y&&!B&&!X?rV(Y,K):A9(0);return{width:Q.width*W.x,height:Q.height*W.y,x:Q.x*W.x-K.scrollLeft*W.x+H.x+U.x,y:Q.y*W.y-K.scrollTop*W.y+H.y+U.y}}function ux($){return Array.from($.getClientRects())}function mx($){let J=w9($),Q=mQ($),Z=$.ownerDocument.body,q=n8(J.scrollWidth,J.clientWidth,Z.scrollWidth,Z.clientWidth),X=n8(J.scrollHeight,J.clientHeight,Z.scrollHeight,Z.clientHeight),Y=-Q.scrollLeft+OX($),z=-Q.scrollTop;if(d5(Z).direction==="rtl")Y+=n8(J.clientWidth,Z.clientWidth)-q;return{width:q,height:X,x:Y,y:z}}var cV=25;function cx($,J){let Q=S1($),Z=w9($),q=Q.visualViewport,X=Z.clientWidth,Y=Z.clientHeight,z=0,K=0;if(q){X=q.width,Y=q.height;let H=DX();if(!H||H&&J==="fixed")z=q.offsetLeft,K=q.offsetTop}let W=OX(Z);if(W<=0){let H=Z.ownerDocument,B=H.body,U=getComputedStyle(B),_=H.compatMode==="CSS1Compat"?parseFloat(U.marginLeft)+parseFloat(U.marginRight)||0:0,L=Math.abs(Z.clientWidth-B.clientWidth-_);if(L<=cV)X-=L}else if(W<=cV)X+=W;return{width:X,height:Y,x:z,y:K}}function dx($,J){let Q=U2($,!0,J==="fixed"),Z=Q.top+$.clientTop,q=Q.left+$.clientLeft,X=R1($)?c$($):A9(1),Y=$.clientWidth*X.x,z=$.clientHeight*X.y,K=q*X.x,W=Z*X.y;return{width:Y,height:z,x:K,y:W}}function dV($,J,Q){let Z;if(J==="viewport")Z=cx($,Q);else if(J==="document")Z=mx(w9($));else if(V1(J))Z=dx(J,Q);else{let q=iV($);Z={x:J.x-q.x,y:J.y-q.y,width:J.width,height:J.height}}return H2(Z)}function sV($,J){let Q=b6($);if(Q===J||!V1(Q)||j6(Q))return!1;return d5(Q).position==="fixed"||sV(Q,J)}function px($,J){let Q=J.get($);if(Q)return Q;let Z=B7($,[],!1).filter((z)=>V1(z)&&x5(z)!=="body"),q=null,X=d5($).position==="fixed",Y=X?b6($):$;while(V1(Y)&&!j6(Y)){let z=d5(Y),K=MX(Y);if(!K&&z.position==="fixed")q=null;if(X?!K&&!q:!K&&z.position==="static"&&!!q&&(q.position==="absolute"||q.position==="fixed")||i9(Y)&&!K&&sV($,Y))Z=Z.filter((H)=>H!==Y);else q=z;Y=b6(Y)}return J.set($,Z),Z}function lx($){let{element:J,boundary:Q,rootBoundary:Z,strategy:q}=$,Y=[...Q==="clippingAncestors"?uQ(J)?[]:px(J,this._c):[].concat(Q),Z],z=dV(J,Y[0],q),K=z.top,W=z.right,H=z.bottom,B=z.left;for(let U=1;U{Y(!1,0.0000001)},1000);else Y(!1,T)}if(T===1&&!nV(W,$.getBoundingClientRect()))Y();O=!1}try{Q=new IntersectionObserver(I,{...N,root:q.ownerDocument})}catch(k){Q=new IntersectionObserver(I,N)}Q.observe($)}return Y(!0),X}function _2($,J,Q,Z){if(Z===void 0)Z={};let{ancestorScroll:q=!0,ancestorResize:X=!0,elementResize:Y=typeof ResizeObserver==="function",layoutShift:z=typeof IntersectionObserver==="function",animationFrame:K=!1}=Z,W=KH($),H=q||X?[...W?B7(W):[],...J?B7(J):[]]:[];H.forEach((M)=>{q&&M.addEventListener("scroll",Q,{passive:!0}),X&&M.addEventListener("resize",Q)});let B=W&&z?nx(W,Q):null,U=-1,_=null;if(Y){if(_=new ResizeObserver((M)=>{let[D]=M;if(D&&D.target===W&&_&&J)_.unobserve(J),cancelAnimationFrame(U),U=requestAnimationFrame(()=>{var N;(N=_)==null||N.observe(J)});Q()}),W&&!K)_.observe(W);if(J)_.observe(J)}let L,F=K?U2($):null;if(K)V();function V(){let M=U2($);if(F&&!nV(F,M))Q();F=M,L=requestAnimationFrame(V)}return Q(),()=>{var M;if(H.forEach((D)=>{q&&D.removeEventListener("scroll",Q),X&&D.removeEventListener("resize",Q)}),B==null||B(),(M=_)==null||M.disconnect(),_=null,K)cancelAnimationFrame(L)}}var aV=hV;var tV=xV,eV=RV,$M=vV,JM=CV,WH=PV;var QM=fV,AX=($,J,Q)=>{let Z=new Map,q={platform:GH,...Q},X={...q.platform,_c:Z};return yV($,J,{...q,platform:X})};var p5=R(v(),1),qM=R(v(),1),XM=R($5(),1),tx=typeof document<"u",ex=function(){},wX=tx?qM.useLayoutEffect:ex;function kX($,J){if($===J)return!0;if(typeof $!==typeof J)return!1;if(typeof $==="function"&&$.toString()===J.toString())return!0;let Q,Z,q;if($&&J&&typeof $==="object"){if(Array.isArray($)){if(Q=$.length,Q!==J.length)return!1;for(Z=Q;Z--!==0;)if(!kX($[Z],J[Z]))return!1;return!0}if(q=Object.keys($),Q=q.length,Q!==Object.keys(J).length)return!1;for(Z=Q;Z--!==0;)if(!{}.hasOwnProperty.call(J,q[Z]))return!1;for(Z=Q;Z--!==0;){let X=q[Z];if(X==="_owner"&&$.$$typeof)continue;if(!kX($[X],J[X]))return!1}return!0}return $!==$&&J!==J}function YM($){if(typeof window>"u")return 1;return($.ownerDocument.defaultView||window).devicePixelRatio||1}function ZM($,J){let Q=YM($);return Math.round(J*Q)/Q}function HH($){let J=p5.useRef($);return wX(()=>{J.current=$}),J}function IX($){if($===void 0)$={};let{placement:J="bottom",strategy:Q="absolute",middleware:Z=[],platform:q,elements:{reference:X,floating:Y}={},transform:z=!0,whileElementsMounted:K,open:W}=$,[H,B]=p5.useState({x:0,y:0,strategy:Q,placement:J,middlewareData:{},isPositioned:!1}),[U,_]=p5.useState(Z);if(!kX(U,Z))_(Z);let[L,F]=p5.useState(null),[V,M]=p5.useState(null),D=p5.useCallback((S)=>{if(S!==k.current)k.current=S,F(S)},[]),N=p5.useCallback((S)=>{if(S!==T.current)T.current=S,M(S)},[]),O=X||L,I=Y||V,k=p5.useRef(null),T=p5.useRef(null),A=p5.useRef(H),w=K!=null,C=HH(K),y=HH(q),x=HH(W),j=p5.useCallback(()=>{if(!k.current||!T.current)return;let S={placement:J,strategy:Q,middleware:U};if(y.current)S.platform=y.current;AX(k.current,T.current,S).then((i)=>{let J0={...i,isPositioned:x.current!==!1};if(P.current&&!kX(A.current,J0))A.current=J0,XM.flushSync(()=>{B(J0)})})},[U,J,Q,y,x]);wX(()=>{if(W===!1&&A.current.isPositioned)A.current.isPositioned=!1,B((S)=>({...S,isPositioned:!1}))},[W]);let P=p5.useRef(!1);wX(()=>{return P.current=!0,()=>{P.current=!1}},[]),wX(()=>{if(O)k.current=O;if(I)T.current=I;if(O&&I){if(C.current)return C.current(O,I,j);j()}},[O,I,j,C,w]);let h=p5.useMemo(()=>({reference:k,floating:T,setReference:D,setFloating:N}),[D,N]),l=p5.useMemo(()=>({reference:O,floating:I}),[O,I]),t=p5.useMemo(()=>{let S={position:Q,left:0,top:0};if(!l.floating)return S;let i=ZM(l.floating,H.x),J0=ZM(l.floating,H.y);if(z)return{...S,transform:"translate("+i+"px, "+J0+"px)",...YM(l.floating)>=1.5&&{willChange:"transform"}};return{position:Q,left:i,top:J0}},[Q,z,l.floating,H.x,H.y]);return p5.useMemo(()=>({...H,update:j,refs:h,elements:l,floatingStyles:t}),[H,j,h,l,t])}var $f=($)=>{function J(Q){return{}.hasOwnProperty.call(Q,"current")}return{name:"arrow",options:$,fn(Q){let{element:Z,padding:q}=typeof $==="function"?$(Q):$;if(Z&&J(Z)){if(Z.current!=null)return WH({element:Z.current,padding:q}).fn(Q);return{}}if(Z)return WH({element:Z,padding:q}).fn(Q);return{}}}},cQ=($,J)=>{let Q=aV($);return{name:Q.name,fn:Q.fn,options:[$,J]}},dQ=($,J)=>{let Q=tV($);return{name:Q.name,fn:Q.fn,options:[$,J]}},pQ=($,J)=>{return{fn:QM($).fn,options:[$,J]}},lQ=($,J)=>{let Q=eV($);return{name:Q.name,fn:Q.fn,options:[$,J]}},iQ=($,J)=>{let Q=$M($);return{name:Q.name,fn:Q.fn,options:[$,J]}};var rQ=($,J)=>{let Q=JM($);return{name:Q.name,fn:Q.fn,options:[$,J]}};var BH=($,J)=>{let Q=$f($);return{name:Q.name,fn:Q.fn,options:[$,J]}};var BM=R(v(),1);var WM=R(v(),1),zf=R($5(),1);var t5=R(v(),1);var Jf=R(v(),1);function zM($,J){if(typeof $==="function")return $(J);else if($!==null&&$!==void 0)$.current=J}function KM(...$){return(J)=>{let Q=!1,Z=$.map((q)=>{let X=zM(q,J);if(!Q&&typeof X=="function")Q=!0;return X});if(Q)return()=>{for(let q=0;q{let{children:X,...Y}=Z,z=t5.Children.toArray(X),K=z.find(qf);if(K){let W=K.props.children,H=z.map((B)=>{if(B===K){if(t5.Children.count(W)>1)return t5.Children.only(null);return t5.isValidElement(W)?W.props.children:null}else return B});return G(J,{...Y,ref:q,children:t5.isValidElement(W)?t5.cloneElement(W,void 0,H):null})}return G(J,{...Y,ref:q,children:X})});return Q.displayName=`${$}.Slot`,Q}function Qf($){let J=t5.forwardRef((Q,Z)=>{let{children:q,...X}=Q;if(t5.isValidElement(q)){let Y=Yf(q),z=Xf(X,q.props);if(q.type!==t5.Fragment)z.ref=Z?KM(Z,Y):Y;return t5.cloneElement(q,z)}return t5.Children.count(q)>1?t5.Children.only(null):null});return J.displayName=`${$}.SlotClone`,J}var Zf=Symbol("radix.slottable");function qf($){return t5.isValidElement($)&&typeof $.type==="function"&&"__radixId"in $.type&&$.type.__radixId===Zf}function Xf($,J){let Q={...J};for(let Z in J){let q=$[Z],X=J[Z];if(/^on[A-Z]/.test(Z)){if(q&&X)Q[Z]=(...z)=>{let K=X(...z);return q(...z),K};else if(q)Q[Z]=q}else if(Z==="style")Q[Z]={...q,...X};else if(Z==="className")Q[Z]=[q,X].filter(Boolean).join(" ")}return{...$,...Q}}function Yf($){let J=Object.getOwnPropertyDescriptor($.props,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning;if(Q)return $.ref;if(J=Object.getOwnPropertyDescriptor($,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning,Q)return $.props.ref;return $.props.ref||$.ref}var Kf=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],HM=Kf.reduce(($,J)=>{let Q=GM(`Primitive.${J}`),Z=WM.forwardRef((q,X)=>{let{asChild:Y,...z}=q,K=Y?Q:J;if(typeof window<"u")window[Symbol.for("radix-ui")]=!0;return G(K,{...z,ref:X})});return Z.displayName=`Primitive.${J}`,{...$,[J]:Z}},{});var Gf="Arrow",UM=BM.forwardRef(($,J)=>{let{children:Q,width:Z=10,height:q=5,...X}=$;return G(HM.svg,{...X,ref:J,width:Z,height:q,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:$.asChild?Q:G("polygon",{points:"0,0 30,0 15,10"})})});UM.displayName=Gf;var _M=UM;var FM=R(v(),1);function LM($,J){if(typeof $==="function")return $(J);else if($!==null&&$!==void 0)$.current=J}function UH(...$){return(J)=>{let Q=!1,Z=$.map((q)=>{let X=LM(q,J);if(!Q&&typeof X=="function")Q=!0;return X});if(Q)return()=>{for(let q=0;q{let{scope:U,children:_,...L}=B,F=U?.[$]?.[K]||z,V=A4.useMemo(()=>L,Object.values(L));return G(F.Provider,{value:V,children:_})};W.displayName=X+"Provider";function H(B,U){let _=U?.[$]?.[K]||z,L=A4.useContext(_);if(L)return L;if(Y!==void 0)return Y;throw Error(`\`${B}\` must be used within \`${X}\``)}return[W,H]}let q=()=>{let X=Q.map((Y)=>{return A4.createContext(Y)});return function(z){let K=z?.[$]||X;return A4.useMemo(()=>({[`__scope${$}`]:{...z,[$]:K}}),[z,K])}};return q.scopeName=$,[Z,Hf(q,...J)]}function Hf(...$){let J=$[0];if($.length===1)return J;let Q=()=>{let Z=$.map((q)=>({useScope:q(),scopeName:q.scopeName}));return function(X){let Y=Z.reduce((z,{useScope:K,scopeName:W})=>{let B=K(X)[`__scope${W}`];return{...z,...B}},{});return A4.useMemo(()=>({[`__scope${J.scopeName}`]:Y}),[Y])}};return Q.scopeName=J.scopeName,Q}var DM=R(v(),1),Vf=R($5(),1);var e5=R(v(),1);function MM($){let J=Bf($),Q=e5.forwardRef((Z,q)=>{let{children:X,...Y}=Z,z=e5.Children.toArray(X),K=z.find(_f);if(K){let W=K.props.children,H=z.map((B)=>{if(B===K){if(e5.Children.count(W)>1)return e5.Children.only(null);return e5.isValidElement(W)?W.props.children:null}else return B});return G(J,{...Y,ref:q,children:e5.isValidElement(W)?e5.cloneElement(W,void 0,H):null})}return G(J,{...Y,ref:q,children:X})});return Q.displayName=`${$}.Slot`,Q}function Bf($){let J=e5.forwardRef((Q,Z)=>{let{children:q,...X}=Q;if(e5.isValidElement(q)){let Y=Ff(q),z=Lf(X,q.props);if(q.type!==e5.Fragment)z.ref=Z?UH(Z,Y):Y;return e5.cloneElement(q,z)}return e5.Children.count(q)>1?e5.Children.only(null):null});return J.displayName=`${$}.SlotClone`,J}var Uf=Symbol("radix.slottable");function _f($){return e5.isValidElement($)&&typeof $.type==="function"&&"__radixId"in $.type&&$.type.__radixId===Uf}function Lf($,J){let Q={...J};for(let Z in J){let q=$[Z],X=J[Z];if(/^on[A-Z]/.test(Z)){if(q&&X)Q[Z]=(...z)=>{let K=X(...z);return q(...z),K};else if(q)Q[Z]=q}else if(Z==="style")Q[Z]={...q,...X};else if(Z==="className")Q[Z]=[q,X].filter(Boolean).join(" ")}return{...$,...Q}}function Ff($){let J=Object.getOwnPropertyDescriptor($.props,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning;if(Q)return $.ref;if(J=Object.getOwnPropertyDescriptor($,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning,Q)return $.props.ref;return $.props.ref||$.ref}var Mf=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],LH=Mf.reduce(($,J)=>{let Q=MM(`Primitive.${J}`),Z=DM.forwardRef((q,X)=>{let{asChild:Y,...z}=q,K=Y?Q:J;if(typeof window<"u")window[Symbol.for("radix-ui")]=!0;return G(K,{...z,ref:X})});return Z.displayName=`Primitive.${J}`,{...$,[J]:Z}},{});var NM=R(v(),1);function OM($){let[J,Q]=NM.useState(void 0);return L1(()=>{if($){Q({width:$.offsetWidth,height:$.offsetHeight});let Z=new ResizeObserver((q)=>{if(!Array.isArray(q))return;if(!q.length)return;let X=q[0],Y,z;if("borderBoxSize"in X){let K=X.borderBoxSize,W=Array.isArray(K)?K[0]:K;Y=W.inlineSize,z=W.blockSize}else Y=$.offsetWidth,z=$.offsetHeight;Q({width:Y,height:z})});return Z.observe($,{box:"border-box"}),()=>Z.unobserve($)}else Q(void 0)},[$]),J}var FH="Popper",[AM,c6]=VM(FH),[Df,wM]=AM(FH),kM=($)=>{let{__scopePopper:J,children:Q}=$,[Z,q]=K6.useState(null);return G(Df,{scope:J,anchor:Z,onAnchorChange:q,children:Q})};kM.displayName=FH;var IM="PopperAnchor",TM=K6.forwardRef(($,J)=>{let{__scopePopper:Q,virtualRef:Z,...q}=$,X=wM(IM,Q),Y=K6.useRef(null),z=_H(J,Y),K=K6.useRef(null);return K6.useEffect(()=>{let W=K.current;if(K.current=Z?.current||Y.current,W!==K.current)X.onAnchorChange(K.current)}),Z?null:G(LH.div,{...q,ref:z})});TM.displayName=IM;var VH="PopperContent",[Nf,Of]=AM(VH),bM=K6.forwardRef(($,J)=>{let{__scopePopper:Q,side:Z="bottom",sideOffset:q=0,align:X="center",alignOffset:Y=0,arrowPadding:z=0,avoidCollisions:K=!0,collisionBoundary:W=[],collisionPadding:H=0,sticky:B="partial",hideWhenDetached:U=!1,updatePositionStrategy:_="optimized",onPlaced:L,...F}=$,V=wM(VH,Q),[M,D]=K6.useState(null),N=_H(J,(c)=>D(c)),[O,I]=K6.useState(null),k=OM(O),T=k?.width??0,A=k?.height??0,w=Z+(X!=="center"?"-"+X:""),C=typeof H==="number"?H:{top:0,right:0,bottom:0,left:0,...H},y=Array.isArray(W)?W:[W],x=y.length>0,j={padding:C,boundary:y.filter(wf),altBoundary:x},{refs:P,floatingStyles:h,placement:l,isPositioned:t,middlewareData:S}=IX({strategy:"fixed",placement:w,whileElementsMounted:(...c)=>{return _2(...c,{animationFrame:_==="always"})},elements:{reference:V.anchor},middleware:[cQ({mainAxis:q+A,alignmentAxis:Y}),K&&dQ({mainAxis:!0,crossAxis:!1,limiter:B==="partial"?pQ():void 0,...j}),K&&lQ({...j}),iQ({...j,apply:({elements:c,rects:r,availableWidth:u,availableHeight:m})=>{let{width:s,height:f}=r.reference,o=c.floating.style;o.setProperty("--radix-popper-available-width",`${u}px`),o.setProperty("--radix-popper-available-height",`${m}px`),o.setProperty("--radix-popper-anchor-width",`${s}px`),o.setProperty("--radix-popper-anchor-height",`${f}px`)}}),O&&BH({element:O,padding:z}),kf({arrowWidth:T,arrowHeight:A}),U&&rQ({strategy:"referenceHidden",...j})]}),[i,J0]=yM(l),K0=c5(L);L1(()=>{if(t)K0?.()},[t,K0]);let e=S.arrow?.x,H0=S.arrow?.y,q0=S.arrow?.centerOffset!==0,[E,d]=K6.useState();return L1(()=>{if(M)d(window.getComputedStyle(M).zIndex)},[M]),G("div",{ref:P.setFloating,"data-radix-popper-content-wrapper":"",style:{...h,transform:t?h.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:E,["--radix-popper-transform-origin"]:[S.transformOrigin?.x,S.transformOrigin?.y].join(" "),...S.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:$.dir,children:G(Nf,{scope:Q,placedSide:i,onArrowChange:I,arrowX:e,arrowY:H0,shouldHideArrow:q0,children:G(LH.div,{"data-side":i,"data-align":J0,...F,ref:N,style:{...F.style,animation:!t?"none":void 0}})})})});bM.displayName=VH;var jM="PopperArrow",Af={top:"bottom",right:"left",bottom:"top",left:"right"},EM=K6.forwardRef(function(J,Q){let{__scopePopper:Z,...q}=J,X=Of(jM,Z),Y=Af[X.placedSide];return G("span",{ref:X.onArrowChange,style:{position:"absolute",left:X.arrowX,top:X.arrowY,[Y]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[X.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[X.placedSide],visibility:X.shouldHideArrow?"hidden":void 0},children:G(_M,{...q,ref:Q,style:{...q.style,display:"block"}})})});EM.displayName=jM;function wf($){return $!==null}var kf=($)=>({name:"transformOrigin",options:$,fn(J){let{placement:Q,rects:Z,middlewareData:q}=J,Y=q.arrow?.centerOffset!==0,z=Y?0:$.arrowWidth,K=Y?0:$.arrowHeight,[W,H]=yM(Q),B={start:"0%",center:"50%",end:"100%"}[H],U=(q.arrow?.x??0)+z/2,_=(q.arrow?.y??0)+K/2,L="",F="";if(W==="bottom")L=Y?B:`${U}px`,F=`${-K}px`;else if(W==="top")L=Y?B:`${U}px`,F=`${Z.floating.height+K}px`;else if(W==="right")L=`${-K}px`,F=Y?B:`${_}px`;else if(W==="left")L=`${Z.floating.width+K}px`,F=Y?B:`${_}px`;return{data:{x:L,y:F}}}});function yM($){let[J,Q="center"]=$.split("-");return[J,Q]}var w4=kM,k4=TM,U7=bM,_7=EM;var bX=R(v(),1),xM=R($5(),1);var SM=R(v(),1),Pf=R($5(),1);var $8=R(v(),1);var If=R(v(),1);function PM($,J){if(typeof $==="function")return $(J);else if($!==null&&$!==void 0)$.current=J}function RM(...$){return(J)=>{let Q=!1,Z=$.map((q)=>{let X=PM(q,J);if(!Q&&typeof X=="function")Q=!0;return X});if(Q)return()=>{for(let q=0;q{let{children:X,...Y}=Z,z=$8.Children.toArray(X),K=z.find(jf);if(K){let W=K.props.children,H=z.map((B)=>{if(B===K){if($8.Children.count(W)>1)return $8.Children.only(null);return $8.isValidElement(W)?W.props.children:null}else return B});return G(J,{...Y,ref:q,children:$8.isValidElement(W)?$8.cloneElement(W,void 0,H):null})}return G(J,{...Y,ref:q,children:X})});return Q.displayName=`${$}.Slot`,Q}function Tf($){let J=$8.forwardRef((Q,Z)=>{let{children:q,...X}=Q;if($8.isValidElement(q)){let Y=yf(q),z=Ef(X,q.props);if(q.type!==$8.Fragment)z.ref=Z?RM(Z,Y):Y;return $8.cloneElement(q,z)}return $8.Children.count(q)>1?$8.Children.only(null):null});return J.displayName=`${$}.SlotClone`,J}var bf=Symbol("radix.slottable");function jf($){return $8.isValidElement($)&&typeof $.type==="function"&&"__radixId"in $.type&&$.type.__radixId===bf}function Ef($,J){let Q={...J};for(let Z in J){let q=$[Z],X=J[Z];if(/^on[A-Z]/.test(Z)){if(q&&X)Q[Z]=(...z)=>{let K=X(...z);return q(...z),K};else if(q)Q[Z]=q}else if(Z==="style")Q[Z]={...q,...X};else if(Z==="className")Q[Z]=[q,X].filter(Boolean).join(" ")}return{...$,...Q}}function yf($){let J=Object.getOwnPropertyDescriptor($.props,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning;if(Q)return $.ref;if(J=Object.getOwnPropertyDescriptor($,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning,Q)return $.props.ref;return $.props.ref||$.ref}var Rf=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],hM=Rf.reduce(($,J)=>{let Q=CM(`Primitive.${J}`),Z=SM.forwardRef((q,X)=>{let{asChild:Y,...z}=q,K=Y?Q:J;if(typeof window<"u")window[Symbol.for("radix-ui")]=!0;return G(K,{...z,ref:X})});return Z.displayName=`Primitive.${J}`,{...$,[J]:Z}},{});var Cf="Portal",k9=bX.forwardRef(($,J)=>{let{container:Q,...Z}=$,[q,X]=bX.useState(!1);L1(()=>X(!0),[]);let Y=Q||q&&globalThis?.document?.body;return Y?xM.default.createPortal(G(hM.div,{...Z,ref:J}),Y):null});k9.displayName=Cf;var fM=R(v(),1),gf=R($5(),1);var J8=R(v(),1);function jX($){let J=Sf($),Q=J8.forwardRef((Z,q)=>{let{children:X,...Y}=Z,z=J8.Children.toArray(X),K=z.find(xf);if(K){let W=K.props.children,H=z.map((B)=>{if(B===K){if(J8.Children.count(W)>1)return J8.Children.only(null);return J8.isValidElement(W)?W.props.children:null}else return B});return G(J,{...Y,ref:q,children:J8.isValidElement(W)?J8.cloneElement(W,void 0,H):null})}return G(J,{...Y,ref:q,children:X})});return Q.displayName=`${$}.Slot`,Q}function Sf($){let J=J8.forwardRef((Q,Z)=>{let{children:q,...X}=Q;if(J8.isValidElement(q)){let Y=vf(q),z=ff(X,q.props);if(q.type!==J8.Fragment)z.ref=Z?nW(Z,Y):Y;return J8.cloneElement(q,z)}return J8.Children.count(q)>1?J8.Children.only(null):null});return J.displayName=`${$}.SlotClone`,J}var hf=Symbol("radix.slottable");function xf($){return J8.isValidElement($)&&typeof $.type==="function"&&"__radixId"in $.type&&$.type.__radixId===hf}function ff($,J){let Q={...J};for(let Z in J){let q=$[Z],X=J[Z];if(/^on[A-Z]/.test(Z)){if(q&&X)Q[Z]=(...z)=>{let K=X(...z);return q(...z),K};else if(q)Q[Z]=q}else if(Z==="style")Q[Z]={...q,...X};else if(Z==="className")Q[Z]=[q,X].filter(Boolean).join(" ")}return{...$,...Q}}function vf($){let J=Object.getOwnPropertyDescriptor($.props,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning;if(Q)return $.ref;if(J=Object.getOwnPropertyDescriptor($,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning,Q)return $.props.ref;return $.props.ref||$.ref}var uf=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],a8=uf.reduce(($,J)=>{let Q=jX(`Primitive.${J}`),Z=fM.forwardRef((q,X)=>{let{asChild:Y,...z}=q,K=Y?Q:J;if(typeof window<"u")window[Symbol.for("radix-ui")]=!0;return G(K,{...z,ref:X})});return Z.displayName=`Primitive.${J}`,{...$,[J]:Z}},{});var d6=R(v(),1);var EX=R(v(),1);var mf=d6[" useInsertionEffect ".trim().toString()]||L1;function MH({prop:$,defaultProp:J,onChange:Q=()=>{},caller:Z}){let[q,X,Y]=cf({defaultProp:J,onChange:Q}),z=$!==void 0,K=z?$:q;{let H=d6.useRef($!==void 0);d6.useEffect(()=>{let B=H.current;if(B!==z)console.warn(`${Z} is changing from ${B?"controlled":"uncontrolled"} to ${z?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`);H.current=z},[z,Z])}let W=d6.useCallback((H)=>{if(z){let B=df(H)?H($):H;if(B!==$)Y.current?.(B)}else X(H)},[z,$,X,Y]);return[K,W]}function cf({defaultProp:$,onChange:J}){let[Q,Z]=d6.useState($),q=d6.useRef(Q),X=d6.useRef(J);return mf(()=>{X.current=J},[J]),d6.useEffect(()=>{if(q.current!==Q)X.current?.(Q),q.current=Q},[Q,q]),[Q,Z,X]}function df($){return typeof $==="function"}var T10=Symbol("RADIX:SYNC_STATE");var yX=R(v(),1);function PX($){let J=yX.useRef({value:$,previous:$});return yX.useMemo(()=>{if(J.current.value!==$)J.current.previous=J.current.value,J.current.value=$;return J.current.previous},[$])}var dM=R(v(),1);var mM=R(v(),1),af=R($5(),1);var Q8=R(v(),1);var pf=R(v(),1);function vM($,J){if(typeof $==="function")return $(J);else if($!==null&&$!==void 0)$.current=J}function gM(...$){return(J)=>{let Q=!1,Z=$.map((q)=>{let X=vM(q,J);if(!Q&&typeof X=="function")Q=!0;return X});if(Q)return()=>{for(let q=0;q{let{children:X,...Y}=Z,z=Q8.Children.toArray(X),K=z.find(sf);if(K){let W=K.props.children,H=z.map((B)=>{if(B===K){if(Q8.Children.count(W)>1)return Q8.Children.only(null);return Q8.isValidElement(W)?W.props.children:null}else return B});return G(J,{...Y,ref:q,children:Q8.isValidElement(W)?Q8.cloneElement(W,void 0,H):null})}return G(J,{...Y,ref:q,children:X})});return Q.displayName=`${$}.Slot`,Q}function lf($){let J=Q8.forwardRef((Q,Z)=>{let{children:q,...X}=Q;if(Q8.isValidElement(q)){let Y=nf(q),z=of(X,q.props);if(q.type!==Q8.Fragment)z.ref=Z?gM(Z,Y):Y;return Q8.cloneElement(q,z)}return Q8.Children.count(q)>1?Q8.Children.only(null):null});return J.displayName=`${$}.SlotClone`,J}var rf=Symbol("radix.slottable");function sf($){return Q8.isValidElement($)&&typeof $.type==="function"&&"__radixId"in $.type&&$.type.__radixId===rf}function of($,J){let Q={...J};for(let Z in J){let q=$[Z],X=J[Z];if(/^on[A-Z]/.test(Z)){if(q&&X)Q[Z]=(...z)=>{let K=X(...z);return q(...z),K};else if(q)Q[Z]=q}else if(Z==="style")Q[Z]={...q,...X};else if(Z==="className")Q[Z]=[q,X].filter(Boolean).join(" ")}return{...$,...Q}}function nf($){let J=Object.getOwnPropertyDescriptor($.props,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning;if(Q)return $.ref;if(J=Object.getOwnPropertyDescriptor($,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning,Q)return $.props.ref;return $.props.ref||$.ref}var tf=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],cM=tf.reduce(($,J)=>{let Q=uM(`Primitive.${J}`),Z=mM.forwardRef((q,X)=>{let{asChild:Y,...z}=q,K=Y?Q:J;if(typeof window<"u")window[Symbol.for("radix-ui")]=!0;return G(K,{...z,ref:X})});return Z.displayName=`Primitive.${J}`,{...$,[J]:Z}},{});var DH=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),ef="VisuallyHidden",pM=dM.forwardRef(($,J)=>{return G(cM.span,{...$,ref:J,style:{...DH,...$.style}})});pM.displayName=ef;var lM=pM;var Jv=function($){if(typeof document>"u")return null;var J=Array.isArray($)?$[0]:$;return J.ownerDocument.body},d$=new WeakMap,RX=new WeakMap,CX={},NH=0,iM=function($){return $&&($.host||iM($.parentNode))},Qv=function($,J){return J.map(function(Q){if($.contains(Q))return Q;var Z=iM(Q);if(Z&&$.contains(Z))return Z;return console.error("aria-hidden",Q,"in not contained inside",$,". Doing nothing"),null}).filter(function(Q){return Boolean(Q)})},Zv=function($,J,Q,Z){var q=Qv(J,Array.isArray($)?$:[$]);if(!CX[Q])CX[Q]=new WeakMap;var X=CX[Q],Y=[],z=new Set,K=new Set(q),W=function(B){if(!B||z.has(B))return;z.add(B),W(B.parentNode)};q.forEach(W);var H=function(B){if(!B||K.has(B))return;Array.prototype.forEach.call(B.children,function(U){if(z.has(U))H(U);else try{var _=U.getAttribute(Z),L=_!==null&&_!=="false",F=(d$.get(U)||0)+1,V=(X.get(U)||0)+1;if(d$.set(U,F),X.set(U,V),Y.push(U),F===1&&L)RX.set(U,!0);if(V===1)U.setAttribute(Q,"true");if(!L)U.setAttribute(Z,"true")}catch(M){console.error("aria-hidden: cannot operate on ",U,M)}})};return H(J),z.clear(),NH++,function(){if(Y.forEach(function(B){var U=d$.get(B)-1,_=X.get(B)-1;if(d$.set(B,U),X.set(B,_),!U){if(!RX.has(B))B.removeAttribute(Z);RX.delete(B)}if(!_)B.removeAttribute(Q)}),NH--,!NH)d$=new WeakMap,d$=new WeakMap,RX=new WeakMap,CX={}}},L7=function($,J,Q){if(Q===void 0)Q="data-aria-hidden";var Z=Array.from(Array.isArray($)?$:[$]),q=J||Jv($);if(!q)return function(){return null};return Z.push.apply(Z,Array.from(q.querySelectorAll("[aria-live], script"))),Zv(Z,q,Q,"aria-hidden")};var G6=function(){return G6=Object.assign||function(J){for(var Q,Z=1,q=arguments.length;Z"u")return Wv;var J=Hv($),Q=document.documentElement.clientWidth,Z=window.innerWidth;return{left:J[0],top:J[1],right:J[2],gap:Math.max(0,Z-Q+J[2]-J[0])}};var Bv=oQ(),p$="data-scroll-locked",Uv=function($,J,Q,Z){var{left:q,top:X,right:Y,gap:z}=$;if(Q===void 0)Q="margin";return` - .`.concat(OH,` { - overflow: hidden `).concat(Z,`; - padding-right: `).concat(z,"px ").concat(Z,`; - } - body[`).concat(p$,`] { - overflow: hidden `).concat(Z,`; - overscroll-behavior: contain; - `).concat([J&&"position: relative ".concat(Z,";"),Q==="margin"&&` - padding-left: `.concat(q,`px; - padding-top: `).concat(X,`px; - padding-right: `).concat(Y,`px; - margin-left:0; - margin-top:0; - margin-right: `).concat(z,"px ").concat(Z,`; - `),Q==="padding"&&"padding-right: ".concat(z,"px ").concat(Z,";")].filter(Boolean).join(""),` - } - - .`).concat(L2,` { - right: `).concat(z,"px ").concat(Z,`; - } - - .`).concat(F2,` { - margin-right: `).concat(z,"px ").concat(Z,`; - } - - .`).concat(L2," .").concat(L2,` { - right: 0 `).concat(Z,`; - } - - .`).concat(F2," .").concat(F2,` { - margin-right: 0 `).concat(Z,`; - } - - body[`).concat(p$,`] { - `).concat(AH,": ").concat(z,`px; - } -`)},QD=function(){var $=parseInt(document.body.getAttribute(p$)||"0",10);return isFinite($)?$:0},_v=function(){l$.useEffect(function(){return document.body.setAttribute(p$,(QD()+1).toString()),function(){var $=QD()-1;if($<=0)document.body.removeAttribute(p$);else document.body.setAttribute(p$,$.toString())}},[])},PH=function($){var{noRelative:J,noImportant:Q,gapMode:Z}=$,q=Z===void 0?"margin":Z;_v();var X=l$.useMemo(function(){return yH(q)},[q]);return l$.createElement(Bv,{styles:Uv(X,!J,q,!Q?"!important":"")})};var RH=!1;if(typeof window<"u")try{i$=Object.defineProperty({},"passive",{get:function(){return RH=!0,!0}}),window.addEventListener("test",i$,i$),window.removeEventListener("test",i$,i$)}catch($){RH=!1}var i$,V2=RH?{passive:!1}:!1;var Lv=function($){return $.tagName==="TEXTAREA"},ZD=function($,J){if(!($ instanceof Element))return!1;var Q=window.getComputedStyle($);return Q[J]!=="hidden"&&!(Q.overflowY===Q.overflowX&&!Lv($)&&Q[J]==="visible")},Fv=function($){return ZD($,"overflowY")},Vv=function($){return ZD($,"overflowX")},CH=function($,J){var Q=J.ownerDocument,Z=J;do{if(typeof ShadowRoot<"u"&&Z instanceof ShadowRoot)Z=Z.host;var q=qD($,Z);if(q){var X=XD($,Z),Y=X[1],z=X[2];if(Y>z)return!0}Z=Z.parentNode}while(Z&&Z!==Q.body);return!1},Mv=function($){var{scrollTop:J,scrollHeight:Q,clientHeight:Z}=$;return[J,Q,Z]},Dv=function($){var{scrollLeft:J,scrollWidth:Q,clientWidth:Z}=$;return[J,Q,Z]},qD=function($,J){return $==="v"?Fv(J):Vv(J)},XD=function($,J){return $==="v"?Mv(J):Dv(J)},Nv=function($,J){return $==="h"&&J==="rtl"?-1:1},YD=function($,J,Q,Z,q){var X=Nv($,window.getComputedStyle(J).direction),Y=X*Z,z=Q.target,K=J.contains(z),W=!1,H=Y>0,B=0,U=0;do{if(!z)break;var _=XD($,z),L=_[0],F=_[1],V=_[2],M=F-V-X*L;if(L||M){if(qD($,z))B+=M,U+=L}var D=z.parentNode;z=D&&D.nodeType===Node.DOCUMENT_FRAGMENT_NODE?D.host:D}while(!K&&z!==document.body||K&&(J.contains(z)||J===z));if(H&&(q&&Math.abs(B)<1||!q&&Y>B))W=!0;else if(!H&&(q&&Math.abs(U)<1||!q&&-Y>U))W=!0;return W};var vX=function($){return"changedTouches"in $?[$.changedTouches[0].clientX,$.changedTouches[0].clientY]:[0,0]},zD=function($){return[$.deltaX,$.deltaY]},KD=function($){return $&&"current"in $?$.current:$},Ov=function($,J){return $[0]===J[0]&&$[1]===J[1]},Av=function($){return` - .block-interactivity-`.concat($,` {pointer-events: none;} - .allow-interactivity-`).concat($,` {pointer-events: all;} -`)},wv=0,r$=[];function GD($){var J=F5.useRef([]),Q=F5.useRef([0,0]),Z=F5.useRef(),q=F5.useState(wv++)[0],X=F5.useState(oQ)[0],Y=F5.useRef($);F5.useEffect(function(){Y.current=$},[$]),F5.useEffect(function(){if($.inert){document.body.classList.add("block-interactivity-".concat(q));var F=rM([$.lockRef.current],($.shards||[]).map(KD),!0).filter(Boolean);return F.forEach(function(V){return V.classList.add("allow-interactivity-".concat(q))}),function(){document.body.classList.remove("block-interactivity-".concat(q)),F.forEach(function(V){return V.classList.remove("allow-interactivity-".concat(q))})}}return},[$.inert,$.lockRef.current,$.shards]);var z=F5.useCallback(function(F,V){if("touches"in F&&F.touches.length===2||F.type==="wheel"&&F.ctrlKey)return!Y.current.allowPinchZoom;var M=vX(F),D=Q.current,N="deltaX"in F?F.deltaX:D[0]-M[0],O="deltaY"in F?F.deltaY:D[1]-M[1],I,k=F.target,T=Math.abs(N)>Math.abs(O)?"h":"v";if("touches"in F&&T==="h"&&k.type==="range")return!1;var A=window.getSelection(),w=A&&A.anchorNode,C=w?w===k||w.contains(k):!1;if(C)return!1;var y=CH(T,k);if(!y)return!0;if(y)I=T;else I=T==="v"?"h":"v",y=CH(T,k);if(!y)return!1;if(!Z.current&&"changedTouches"in F&&(N||O))Z.current=I;if(!I)return!0;var x=Z.current||I;return YD(x,V,F,x==="h"?N:O,!0)},[]),K=F5.useCallback(function(F){var V=F;if(!r$.length||r$[r$.length-1]!==X)return;var M="deltaY"in V?zD(V):vX(V),D=J.current.filter(function(I){return I.name===V.type&&(I.target===V.target||V.target===I.shadowParent)&&Ov(I.delta,M)})[0];if(D&&D.should){if(V.cancelable)V.preventDefault();return}if(!D){var N=(Y.current.shards||[]).map(KD).filter(Boolean).filter(function(I){return I.contains(V.target)}),O=N.length>0?z(V,N[0]):!Y.current.noIsolation;if(O){if(V.cancelable)V.preventDefault()}}},[]),W=F5.useCallback(function(F,V,M,D){var N={name:F,delta:V,target:M,should:D,shadowParent:kv(M)};J.current.push(N),setTimeout(function(){J.current=J.current.filter(function(O){return O!==N})},1)},[]),H=F5.useCallback(function(F){Q.current=vX(F),Z.current=void 0},[]),B=F5.useCallback(function(F){W(F.type,zD(F),F.target,z(F,$.lockRef.current))},[]),U=F5.useCallback(function(F){W(F.type,vX(F),F.target,z(F,$.lockRef.current))},[]);F5.useEffect(function(){return r$.push(X),$.setCallbacks({onScrollCapture:B,onWheelCapture:B,onTouchMoveCapture:U}),document.addEventListener("wheel",K,V2),document.addEventListener("touchmove",K,V2),document.addEventListener("touchstart",H,V2),function(){r$=r$.filter(function(F){return F!==X}),document.removeEventListener("wheel",K,V2),document.removeEventListener("touchmove",K,V2),document.removeEventListener("touchstart",H,V2)}},[]);var{removeScrollBar:_,inert:L}=$;return F5.createElement(F5.Fragment,null,L?F5.createElement(X,{styles:Av(q)}):null,_?F5.createElement(PH,{noRelative:$.noRelative,gapMode:$.gapMode}):null)}function kv($){var J=null;while($!==null){if($ instanceof ShadowRoot)J=$.host,$=$.host;$=$.parentNode}return J}var WD=IH(fX,GD);var HD=gX.forwardRef(function($,J){return gX.createElement(sQ,G6({},$,{ref:J,sideCar:WD}))});HD.classNames=sQ.classNames;var I4=HD;var Iv=[" ","Enter","ArrowUp","ArrowDown"],Tv=[" ","Enter"],M2="Select",[mX,cX,bv]=K7(M2),[s$,v80]=rF(M2,[bv,c6]),dX=c6(),[jv,F7]=s$(M2),[Ev,yv]=s$(M2),BD=($)=>{let{__scopeSelect:J,children:Q,open:Z,defaultOpen:q,onOpenChange:X,value:Y,defaultValue:z,onValueChange:K,dir:W,name:H,autoComplete:B,disabled:U,required:_,form:L}=$,F=dX(J),[V,M]=m0.useState(null),[D,N]=m0.useState(null),[O,I]=m0.useState(!1),k=d9(W),[T,A]=MH({prop:Z,defaultProp:q??!1,onChange:X,caller:M2}),[w,C]=MH({prop:Y,defaultProp:z,onChange:K,caller:M2}),y=m0.useRef(null),x=V?L||!!V.closest("form"):!0,[j,P]=m0.useState(new Set),h=Array.from(j).map((l)=>l.props.value).join(";");return G(w4,{...F,children:b(jv,{required:_,scope:J,trigger:V,onTriggerChange:M,valueNode:D,onValueNodeChange:N,valueNodeHasChildren:O,onValueNodeHasChildrenChange:I,contentId:a5(),value:w,onValueChange:C,open:T,onOpenChange:A,dir:k,triggerPointerDownPosRef:y,disabled:U,children:[G(mX.Provider,{scope:J,children:G(Ev,{scope:$.__scopeSelect,onNativeOptionAdd:m0.useCallback((l)=>{P((t)=>new Set(t).add(l))},[]),onNativeOptionRemove:m0.useCallback((l)=>{P((t)=>{let S=new Set(t);return S.delete(l),S})},[]),children:Q})}),x?b(xD,{"aria-hidden":!0,required:_,tabIndex:-1,name:H,autoComplete:B,value:w,onChange:(l)=>C(l.target.value),disabled:U,form:L,children:[w===void 0?G("option",{value:""}):null,Array.from(j)]},h):null]})})};BD.displayName=M2;var UD="SelectTrigger",_D=m0.forwardRef(($,J)=>{let{__scopeSelect:Q,disabled:Z=!1,...q}=$,X=dX(Q),Y=F7(UD,Q),z=Y.disabled||Z,K=N9(J,Y.onTriggerChange),W=cX(Q),H=m0.useRef("touch"),[B,U,_]=vD((F)=>{let V=W().filter((N)=>!N.disabled),M=V.find((N)=>N.value===Y.value),D=gD(V,F,M);if(D!==void 0)Y.onValueChange(D.value)}),L=(F)=>{if(!z)Y.onOpenChange(!0),_();if(F)Y.triggerPointerDownPosRef.current={x:Math.round(F.pageX),y:Math.round(F.pageY)}};return G(k4,{asChild:!0,...X,children:G(a8.button,{type:"button",role:"combobox","aria-controls":Y.contentId,"aria-expanded":Y.open,"aria-required":Y.required,"aria-autocomplete":"none",dir:Y.dir,"data-state":Y.open?"open":"closed",disabled:z,"data-disabled":z?"":void 0,"data-placeholder":fD(Y.value)?"":void 0,...q,ref:K,onClick:V8(q.onClick,(F)=>{if(F.currentTarget.focus(),H.current!=="mouse")L(F)}),onPointerDown:V8(q.onPointerDown,(F)=>{H.current=F.pointerType;let V=F.target;if(V.hasPointerCapture(F.pointerId))V.releasePointerCapture(F.pointerId);if(F.button===0&&F.ctrlKey===!1&&F.pointerType==="mouse")L(F),F.preventDefault()}),onKeyDown:V8(q.onKeyDown,(F)=>{let V=B.current!=="";if(!(F.ctrlKey||F.altKey||F.metaKey)&&F.key.length===1)U(F.key);if(V&&F.key===" ")return;if(Iv.includes(F.key))L(),F.preventDefault()})})})});_D.displayName=UD;var LD="SelectValue",FD=m0.forwardRef(($,J)=>{let{__scopeSelect:Q,className:Z,style:q,children:X,placeholder:Y="",...z}=$,K=F7(LD,Q),{onValueNodeHasChildrenChange:W}=K,H=X!==void 0,B=N9(J,K.onValueNodeChange);return L1(()=>{W(H)},[W,H]),G(a8.span,{...z,ref:B,style:{pointerEvents:"none"},children:fD(K.value)?G(W1,{children:Y}):X})});FD.displayName=LD;var Pv="SelectIcon",VD=m0.forwardRef(($,J)=>{let{__scopeSelect:Q,children:Z,...q}=$;return G(a8.span,{"aria-hidden":!0,...q,ref:J,children:Z||"▼"})});VD.displayName=Pv;var Rv="SelectPortal",MD=($)=>{return G(k9,{asChild:!0,...$})};MD.displayName=Rv;var D2="SelectContent",DD=m0.forwardRef(($,J)=>{let Q=F7(D2,$.__scopeSelect),[Z,q]=m0.useState();if(L1(()=>{q(new DocumentFragment)},[]),!Q.open){let X=Z;return X?gH.createPortal(G(ND,{scope:$.__scopeSelect,children:G(mX.Slot,{scope:$.__scopeSelect,children:G("div",{children:$.children})})}),X):null}return G(OD,{...$,ref:J})});DD.displayName=D2;var I9=10,[ND,V7]=s$(D2),Cv="SelectContentImpl",Sv=jX("SelectContent.RemoveScroll"),OD=m0.forwardRef(($,J)=>{let{__scopeSelect:Q,position:Z="item-aligned",onCloseAutoFocus:q,onEscapeKeyDown:X,onPointerDownOutside:Y,side:z,sideOffset:K,align:W,alignOffset:H,arrowPadding:B,collisionBoundary:U,collisionPadding:_,sticky:L,hideWhenDetached:F,avoidCollisions:V,...M}=$,D=F7(D2,Q),[N,O]=m0.useState(null),[I,k]=m0.useState(null),T=N9(J,(c)=>O(c)),[A,w]=m0.useState(null),[C,y]=m0.useState(null),x=cX(Q),[j,P]=m0.useState(!1),h=m0.useRef(!1);m0.useEffect(()=>{if(N)return L7(N)},[N]),G7();let l=m0.useCallback((c)=>{let[r,...u]=x().map((f)=>f.ref.current),[m]=u.slice(-1),s=document.activeElement;for(let f of c){if(f===s)return;if(f?.scrollIntoView({block:"nearest"}),f===r&&I)I.scrollTop=0;if(f===m&&I)I.scrollTop=I.scrollHeight;if(f?.focus(),document.activeElement!==s)return}},[x,I]),t=m0.useCallback(()=>l([A,N]),[l,A,N]);m0.useEffect(()=>{if(j)t()},[j,t]);let{onOpenChange:S,triggerPointerDownPosRef:i}=D;m0.useEffect(()=>{if(N){let c={x:0,y:0},r=(m)=>{c={x:Math.abs(Math.round(m.pageX)-(i.current?.x??0)),y:Math.abs(Math.round(m.pageY)-(i.current?.y??0))}},u=(m)=>{if(c.x<=10&&c.y<=10)m.preventDefault();else if(!N.contains(m.target))S(!1);document.removeEventListener("pointermove",r),i.current=null};if(i.current!==null)document.addEventListener("pointermove",r),document.addEventListener("pointerup",u,{capture:!0,once:!0});return()=>{document.removeEventListener("pointermove",r),document.removeEventListener("pointerup",u,{capture:!0})}}},[N,S,i]),m0.useEffect(()=>{let c=()=>S(!1);return window.addEventListener("blur",c),window.addEventListener("resize",c),()=>{window.removeEventListener("blur",c),window.removeEventListener("resize",c)}},[S]);let[J0,K0]=vD((c)=>{let r=x().filter((s)=>!s.disabled),u=r.find((s)=>s.ref.current===document.activeElement),m=gD(r,c,u);if(m)setTimeout(()=>m.ref.current.focus())}),e=m0.useCallback((c,r,u)=>{let m=!h.current&&!u;if(D.value!==void 0&&D.value===r||m){if(w(c),m)h.current=!0}},[D.value]),H0=m0.useCallback(()=>N?.focus(),[N]),q0=m0.useCallback((c,r,u)=>{let m=!h.current&&!u;if(D.value!==void 0&&D.value===r||m)y(c)},[D.value]),E=Z==="popper"?SH:AD,d=E===SH?{side:z,sideOffset:K,align:W,alignOffset:H,arrowPadding:B,collisionBoundary:U,collisionPadding:_,sticky:L,hideWhenDetached:F,avoidCollisions:V}:{};return G(ND,{scope:Q,content:N,viewport:I,onViewportChange:k,itemRefCallback:e,selectedItem:A,onItemLeave:H0,itemTextRefCallback:q0,focusSelectedItem:t,selectedItemText:C,position:Z,isPositioned:j,searchRef:J0,children:G(I4,{as:Sv,allowPinchZoom:!0,children:G(O4,{asChild:!0,trapped:D.open,onMountAutoFocus:(c)=>{c.preventDefault()},onUnmountAutoFocus:V8(q,(c)=>{D.trigger?.focus({preventScroll:!0}),c.preventDefault()}),children:G(O9,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:X,onPointerDownOutside:Y,onFocusOutside:(c)=>c.preventDefault(),onDismiss:()=>D.onOpenChange(!1),children:G(E,{role:"listbox",id:D.contentId,"data-state":D.open?"open":"closed",dir:D.dir,onContextMenu:(c)=>c.preventDefault(),...M,...d,onPlaced:()=>P(!0),ref:T,style:{display:"flex",flexDirection:"column",outline:"none",...M.style},onKeyDown:V8(M.onKeyDown,(c)=>{let r=c.ctrlKey||c.altKey||c.metaKey;if(c.key==="Tab")c.preventDefault();if(!r&&c.key.length===1)K0(c.key);if(["ArrowUp","ArrowDown","Home","End"].includes(c.key)){let m=x().filter((s)=>!s.disabled).map((s)=>s.ref.current);if(["ArrowUp","End"].includes(c.key))m=m.slice().reverse();if(["ArrowUp","ArrowDown"].includes(c.key)){let s=c.target,f=m.indexOf(s);m=m.slice(f+1)}setTimeout(()=>l(m)),c.preventDefault()}})})})})})})});OD.displayName=Cv;var hv="SelectItemAlignedPosition",AD=m0.forwardRef(($,J)=>{let{__scopeSelect:Q,onPlaced:Z,...q}=$,X=F7(D2,Q),Y=V7(D2,Q),[z,K]=m0.useState(null),[W,H]=m0.useState(null),B=N9(J,(T)=>H(T)),U=cX(Q),_=m0.useRef(!1),L=m0.useRef(!0),{viewport:F,selectedItem:V,selectedItemText:M,focusSelectedItem:D}=Y,N=m0.useCallback(()=>{if(X.trigger&&X.valueNode&&z&&W&&F&&V&&M){let T=X.trigger.getBoundingClientRect(),A=W.getBoundingClientRect(),w=X.valueNode.getBoundingClientRect(),C=M.getBoundingClientRect();if(X.dir!=="rtl"){let s=C.left-A.left,f=w.left-s,o=T.left-f,G0=T.width+o,p=Math.max(G0,A.width),Z0=window.innerWidth-I9,Q0=f$(f,[I9,Math.max(I9,Z0-p)]);z.style.minWidth=G0+"px",z.style.left=Q0+"px"}else{let s=A.right-C.right,f=window.innerWidth-w.right-s,o=window.innerWidth-T.right-f,G0=T.width+o,p=Math.max(G0,A.width),Z0=window.innerWidth-I9,Q0=f$(f,[I9,Math.max(I9,Z0-p)]);z.style.minWidth=G0+"px",z.style.right=Q0+"px"}let y=U(),x=window.innerHeight-I9*2,j=F.scrollHeight,P=window.getComputedStyle(W),h=parseInt(P.borderTopWidth,10),l=parseInt(P.paddingTop,10),t=parseInt(P.borderBottomWidth,10),S=parseInt(P.paddingBottom,10),i=h+l+j+S+t,J0=Math.min(V.offsetHeight*5,i),K0=window.getComputedStyle(F),e=parseInt(K0.paddingTop,10),H0=parseInt(K0.paddingBottom,10),q0=T.top+T.height/2-I9,E=x-q0,d=V.offsetHeight/2,c=V.offsetTop+d,r=h+l+c,u=i-r;if(r<=q0){let s=y.length>0&&V===y[y.length-1].ref.current;z.style.bottom="0px";let f=W.clientHeight-F.offsetTop-F.offsetHeight,o=Math.max(E,d+(s?H0:0)+f+t),G0=r+o;z.style.height=G0+"px"}else{let s=y.length>0&&V===y[0].ref.current;z.style.top="0px";let o=Math.max(q0,h+F.offsetTop+(s?e:0)+d)+u;z.style.height=o+"px",F.scrollTop=r-q0+F.offsetTop}z.style.margin=`${I9}px 0`,z.style.minHeight=J0+"px",z.style.maxHeight=x+"px",Z?.(),requestAnimationFrame(()=>_.current=!0)}},[U,X.trigger,X.valueNode,z,W,F,V,M,X.dir,Z]);L1(()=>N(),[N]);let[O,I]=m0.useState();L1(()=>{if(W)I(window.getComputedStyle(W).zIndex)},[W]);let k=m0.useCallback((T)=>{if(T&&L.current===!0)N(),D?.(),L.current=!1},[N,D]);return G(fv,{scope:Q,contentWrapper:z,shouldExpandOnScrollRef:_,onScrollButtonChange:k,children:G("div",{ref:K,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:O},children:G(a8.div,{...q,ref:B,style:{boxSizing:"border-box",maxHeight:"100%",...q.style}})})})});AD.displayName=hv;var xv="SelectPopperPosition",SH=m0.forwardRef(($,J)=>{let{__scopeSelect:Q,align:Z="start",collisionPadding:q=I9,...X}=$,Y=dX(Q);return G(U7,{...Y,...X,ref:J,align:Z,collisionPadding:q,style:{boxSizing:"border-box",...X.style,...{"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}}})});SH.displayName=xv;var[fv,uH]=s$(D2,{}),hH="SelectViewport",wD=m0.forwardRef(($,J)=>{let{__scopeSelect:Q,nonce:Z,...q}=$,X=V7(hH,Q),Y=uH(hH,Q),z=N9(J,X.onViewportChange),K=m0.useRef(0);return b(W1,{children:[G("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:Z}),G(mX.Slot,{scope:Q,children:G(a8.div,{"data-radix-select-viewport":"",role:"presentation",...q,ref:z,style:{position:"relative",flex:1,overflow:"hidden auto",...q.style},onScroll:V8(q.onScroll,(W)=>{let H=W.currentTarget,{contentWrapper:B,shouldExpandOnScrollRef:U}=Y;if(U?.current&&B){let _=Math.abs(K.current-H.scrollTop);if(_>0){let L=window.innerHeight-I9*2,F=parseFloat(B.style.minHeight),V=parseFloat(B.style.height),M=Math.max(F,V);if(M0?O:0,B.style.justifyContent="flex-end"}}}K.current=H.scrollTop})})})]})});wD.displayName=hH;var kD="SelectGroup",[vv,gv]=s$(kD),uv=m0.forwardRef(($,J)=>{let{__scopeSelect:Q,...Z}=$,q=a5();return G(vv,{scope:Q,id:q,children:G(a8.div,{role:"group","aria-labelledby":q,...Z,ref:J})})});uv.displayName=kD;var ID="SelectLabel",TD=m0.forwardRef(($,J)=>{let{__scopeSelect:Q,...Z}=$,q=gv(ID,Q);return G(a8.div,{id:q.id,...Z,ref:J})});TD.displayName=ID;var uX="SelectItem",[mv,bD]=s$(uX),jD=m0.forwardRef(($,J)=>{let{__scopeSelect:Q,value:Z,disabled:q=!1,textValue:X,...Y}=$,z=F7(uX,Q),K=V7(uX,Q),W=z.value===Z,[H,B]=m0.useState(X??""),[U,_]=m0.useState(!1),L=N9(J,(D)=>K.itemRefCallback?.(D,Z,q)),F=a5(),V=m0.useRef("touch"),M=()=>{if(!q)z.onValueChange(Z),z.onOpenChange(!1)};if(Z==="")throw Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return G(mv,{scope:Q,value:Z,disabled:q,textId:F,isSelected:W,onItemTextChange:m0.useCallback((D)=>{B((N)=>N||(D?.textContent??"").trim())},[]),children:G(mX.ItemSlot,{scope:Q,value:Z,disabled:q,textValue:H,children:G(a8.div,{role:"option","aria-labelledby":F,"data-highlighted":U?"":void 0,"aria-selected":W&&U,"data-state":W?"checked":"unchecked","aria-disabled":q||void 0,"data-disabled":q?"":void 0,tabIndex:q?void 0:-1,...Y,ref:L,onFocus:V8(Y.onFocus,()=>_(!0)),onBlur:V8(Y.onBlur,()=>_(!1)),onClick:V8(Y.onClick,()=>{if(V.current!=="mouse")M()}),onPointerUp:V8(Y.onPointerUp,()=>{if(V.current==="mouse")M()}),onPointerDown:V8(Y.onPointerDown,(D)=>{V.current=D.pointerType}),onPointerMove:V8(Y.onPointerMove,(D)=>{if(V.current=D.pointerType,q)K.onItemLeave?.();else if(V.current==="mouse")D.currentTarget.focus({preventScroll:!0})}),onPointerLeave:V8(Y.onPointerLeave,(D)=>{if(D.currentTarget===document.activeElement)K.onItemLeave?.()}),onKeyDown:V8(Y.onKeyDown,(D)=>{if(K.searchRef?.current!==""&&D.key===" ")return;if(Tv.includes(D.key))M();if(D.key===" ")D.preventDefault()})})})})});jD.displayName=uX;var nQ="SelectItemText",ED=m0.forwardRef(($,J)=>{let{__scopeSelect:Q,className:Z,style:q,...X}=$,Y=F7(nQ,Q),z=V7(nQ,Q),K=bD(nQ,Q),W=yv(nQ,Q),[H,B]=m0.useState(null),U=N9(J,(M)=>B(M),K.onItemTextChange,(M)=>z.itemTextRefCallback?.(M,K.value,K.disabled)),_=H?.textContent,L=m0.useMemo(()=>G("option",{value:K.value,disabled:K.disabled,children:_},K.value),[K.disabled,K.value,_]),{onNativeOptionAdd:F,onNativeOptionRemove:V}=W;return L1(()=>{return F(L),()=>V(L)},[F,V,L]),b(W1,{children:[G(a8.span,{id:K.textId,...X,ref:U}),K.isSelected&&Y.valueNode&&!Y.valueNodeHasChildren?gH.createPortal(X.children,Y.valueNode):null]})});ED.displayName=nQ;var yD="SelectItemIndicator",PD=m0.forwardRef(($,J)=>{let{__scopeSelect:Q,...Z}=$;return bD(yD,Q).isSelected?G(a8.span,{"aria-hidden":!0,...Z,ref:J}):null});PD.displayName=yD;var xH="SelectScrollUpButton",RD=m0.forwardRef(($,J)=>{let Q=V7(xH,$.__scopeSelect),Z=uH(xH,$.__scopeSelect),[q,X]=m0.useState(!1),Y=N9(J,Z.onScrollButtonChange);return L1(()=>{if(Q.viewport&&Q.isPositioned){let K=function(){let H=W.scrollTop>0;X(H)};var z=K;let W=Q.viewport;return K(),W.addEventListener("scroll",K),()=>W.removeEventListener("scroll",K)}},[Q.viewport,Q.isPositioned]),q?G(SD,{...$,ref:Y,onAutoScroll:()=>{let{viewport:z,selectedItem:K}=Q;if(z&&K)z.scrollTop=z.scrollTop-K.offsetHeight}}):null});RD.displayName=xH;var fH="SelectScrollDownButton",CD=m0.forwardRef(($,J)=>{let Q=V7(fH,$.__scopeSelect),Z=uH(fH,$.__scopeSelect),[q,X]=m0.useState(!1),Y=N9(J,Z.onScrollButtonChange);return L1(()=>{if(Q.viewport&&Q.isPositioned){let K=function(){let H=W.scrollHeight-W.clientHeight,B=Math.ceil(W.scrollTop)W.removeEventListener("scroll",K)}},[Q.viewport,Q.isPositioned]),q?G(SD,{...$,ref:Y,onAutoScroll:()=>{let{viewport:z,selectedItem:K}=Q;if(z&&K)z.scrollTop=z.scrollTop+K.offsetHeight}}):null});CD.displayName=fH;var SD=m0.forwardRef(($,J)=>{let{__scopeSelect:Q,onAutoScroll:Z,...q}=$,X=V7("SelectScrollButton",Q),Y=m0.useRef(null),z=cX(Q),K=m0.useCallback(()=>{if(Y.current!==null)window.clearInterval(Y.current),Y.current=null},[]);return m0.useEffect(()=>{return()=>K()},[K]),L1(()=>{z().find((H)=>H.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[z]),G(a8.div,{"aria-hidden":!0,...q,ref:J,style:{flexShrink:0,...q.style},onPointerDown:V8(q.onPointerDown,()=>{if(Y.current===null)Y.current=window.setInterval(Z,50)}),onPointerMove:V8(q.onPointerMove,()=>{if(X.onItemLeave?.(),Y.current===null)Y.current=window.setInterval(Z,50)}),onPointerLeave:V8(q.onPointerLeave,()=>{K()})})}),cv="SelectSeparator",hD=m0.forwardRef(($,J)=>{let{__scopeSelect:Q,...Z}=$;return G(a8.div,{"aria-hidden":!0,...Z,ref:J})});hD.displayName=cv;var vH="SelectArrow",dv=m0.forwardRef(($,J)=>{let{__scopeSelect:Q,...Z}=$,q=dX(Q),X=F7(vH,Q),Y=V7(vH,Q);return X.open&&Y.position==="popper"?G(_7,{...q,...Z,ref:J}):null});dv.displayName=vH;var pv="SelectBubbleInput",xD=m0.forwardRef(({__scopeSelect:$,value:J,...Q},Z)=>{let q=m0.useRef(null),X=N9(Z,q),Y=PX(J);return m0.useEffect(()=>{let z=q.current;if(!z)return;let K=window.HTMLSelectElement.prototype,H=Object.getOwnPropertyDescriptor(K,"value").set;if(Y!==J&&H){let B=new Event("change",{bubbles:!0});H.call(z,J),z.dispatchEvent(B)}},[Y,J]),G(a8.select,{...Q,style:{...DH,...Q.style},ref:X,defaultValue:J})});xD.displayName=pv;function fD($){return $===""||$===void 0}function vD($){let J=c5($),Q=m0.useRef(""),Z=m0.useRef(0),q=m0.useCallback((Y)=>{let z=Q.current+Y;J(z),function K(W){if(Q.current=W,window.clearTimeout(Z.current),W!=="")Z.current=window.setTimeout(()=>K(""),1000)}(z)},[J]),X=m0.useCallback(()=>{Q.current="",window.clearTimeout(Z.current)},[]);return m0.useEffect(()=>{return()=>window.clearTimeout(Z.current)},[]),[Q,q,X]}function gD($,J,Q){let q=J.length>1&&Array.from(J).every((W)=>W===J[0])?J[0]:J,X=Q?$.indexOf(Q):-1,Y=lv($,Math.max(X,0));if(q.length===1)Y=Y.filter((W)=>W!==Q);let K=Y.find((W)=>W.textValue.toLowerCase().startsWith(q.toLowerCase()));return K!==Q?K:void 0}function lv($,J){return $.map((Q,Z)=>$[(J+Z)%$.length])}var mH=BD,cH=_D,uD=FD,mD=VD,cD=MD,dH=DD,dD=wD;var pH=TD,lH=jD,pD=ED,lD=PD,iH=RD,rH=CD,sH=hD;var iD=D8.createContext({open:!1,close:()=>{}}),E8=({open:$,defaultOpen:J=!1,onOpenChange:Q,...Z})=>{let[q,X]=D8.useState(J),Y=$??q,z=D8.useCallback((W)=>{if($===void 0)X(W);Q?.(W)},[$,Q]),K=D8.useMemo(()=>({open:Y,close:()=>z(!1)}),[z,Y]);return G(iD.Provider,{value:K,children:G(mH,{...Z,open:Y,onOpenChange:z})})};E8.displayName=mH.displayName;var W6=uD,y8=D8.forwardRef(({className:$,children:J,...Q},Z)=>b(cH,{ref:Z,className:b0("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-border bg-muted pl-2 py-2 text-sm text-foreground shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",$),...Q,children:[J,G(mD,{asChild:!0,children:G(T4,{className:"h-4 w-4 opacity-50"})})]}));y8.displayName=cH.displayName;var rD=D8.forwardRef(({className:$,...J},Q)=>G(iH,{ref:Q,className:b0("flex cursor-default items-center justify-center py-1",$),...J,children:G(pX,{className:"h-4 w-4"})}));rD.displayName=iH.displayName;var sD=D8.forwardRef(({className:$,...J},Q)=>G(rH,{ref:Q,className:b0("flex cursor-default items-center justify-center py-1",$),...J,children:G(T4,{className:"h-4 w-4"})}));sD.displayName=rH.displayName;var P8=D8.forwardRef(({className:$,children:J,position:Q="popper",...Z},q)=>{let X=D8.useContext(iD);return G(cD,{children:b("div",{className:`${M8}`,children:[X.open?G("div",{"aria-hidden":"true","data-easy-media-select-backdrop":"",className:"fixed inset-0 z-[9997]",onPointerDown:X.close}):null,b(dH,{ref:q,className:b0("relative z-[9999] max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",Q==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",$),position:Q,...Z,children:[G(rD,{}),G(dD,{className:b0("p-1",Q==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:J}),G(sD,{})]})]})})});P8.displayName=dH.displayName;var rv=D8.forwardRef(({className:$,...J},Q)=>G(pH,{ref:Q,className:b0("px-2 py-1.5 text-sm font-semibold",$),...J}));rv.displayName=pH.displayName;var l5=D8.forwardRef(({className:$,children:J,...Q},Z)=>b(lH,{ref:Z,className:b0("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",$),...Q,children:[G("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:G(lD,{children:G(T9,{className:"h-4 w-4"})})}),G(pD,{children:J})]}));l5.displayName=lH.displayName;var sv=D8.forwardRef(({className:$,...J},Q)=>G(sH,{ref:Q,className:b0("-mx-1 my-1 h-px bg-muted",$),...J}));sv.displayName=sH.displayName;var t8=R(v(),1);function e8({value:$,onChange:J,min:Q=0,max:Z=1/0,step:q=1,className:X,disabled:Y,commitOnBlur:z=!1,formatValue:K,"aria-label":W}){let H=t8.useRef(null),B=t8.useRef(!1),[U,_]=t8.useState(String($));t8.useEffect(()=>{if(!z)return;_(String($))},[$,z]);let L=t8.useCallback((I)=>{return Math.min(Z,Math.max(Q,I))},[Q,Z]),F=t8.useCallback((I)=>{if(I===""){J(L(0));return}let k=Number.parseFloat(I);if(!Number.isNaN(k))J(L(k))},[J,L]),V=t8.useCallback(()=>{let I=Math.min(Z,$+q);if(J(I),z)_(String(I))},[z,$,q,Z,J]),M=t8.useCallback(()=>{let I=Math.max(Q,$-q);if(J(I),z)_(String(I))},[z,$,q,Q,J]),D=t8.useCallback((I)=>{let k=I.currentTarget.value;if(z)_(k);else{if(k===""){J(0);return}let T=Number.parseFloat(k);if(!Number.isNaN(T))J(L(T))}},[z,J,L]),N=t8.useCallback(()=>{if(z&&!B.current)F(U),_(String($));B.current=!1},[z,F,U,$]),O=t8.useCallback((I)=>{if(I.key==="ArrowUp"){I.preventDefault();let k=Math.min(Z,$+q);if(J(k),z)_(String(k))}else if(I.key==="ArrowDown"){I.preventDefault();let k=Math.max(Q,$-q);if(J(k),z)_(String(k))}else if(z&&I.key==="Enter")I.preventDefault(),B.current=!0,F(U),H.current?.blur()},[z,$,q,Q,Z,J,F,U]);return b("div",{className:b0("flex h-7 items-center rounded-md border border-node-input-border bg-node-input overflow-hidden",X),children:[G("input",{type:"number",value:z?U:K?.($)??$,onChange:D,onKeyDown:O,onBlur:N,ref:H,min:Q,max:Z,step:q,disabled:Y,"aria-label":W,className:b0("w-14 h-full flex-1 bg-muted text-node-foreground text-xs text-center border-0 focus:outline-none focus:ring-0 [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none")}),b("div",{className:"flex flex-col h-full border-l ",children:[G("button",{type:"button",onClick:V,disabled:Y||$>=Z,"aria-label":"Increment",className:b0("flex-1 flex items-center justify-center px-1 hover:bg-card cursor-pointer transition-colors disabled:opacity-40 disabled:cursor-not-allowed bg-muted"),children:G(pX,{className:"size-3 text-node-foreground"})}),G("div",{className:"h-px bg-border"}),G("button",{type:"button",onClick:M,disabled:Y||$<=Q,"aria-label":"Decrement",className:b0("flex-1 flex items-center justify-center px-1 hover:bg-card cursor-pointer transition-colors disabled:opacity-40 disabled:cursor-not-allowed bg-muted"),children:G(T4,{className:"size-3 text-node-foreground"})})]})]})}var MN=R(v(),1);var Y5=R(v(),1);var o80=!!(typeof window<"u"&&window.document&&window.document.createElement);function N2($,J,{checkForDefaultPrevented:Q=!0}={}){return function(q){if($?.(q),Q===!1||!q.defaultPrevented)return J?.(q)}}var nD=R(v(),1);function oD($,J){if(typeof $==="function")return $(J);else if($!==null&&$!==void 0)$.current=J}function oH(...$){return(J)=>{let Q=!1,Z=$.map((q)=>{let X=oD(q,J);if(!Q&&typeof X=="function")Q=!0;return X});if(Q)return()=>{for(let q=0;q{let{scope:U,children:_,...L}=B,F=U?.[$]?.[K]||z,V=b4.useMemo(()=>L,Object.values(L));return G(F.Provider,{value:V,children:_})};W.displayName=X+"Provider";function H(B,U){let _=U?.[$]?.[K]||z,L=b4.useContext(_);if(L)return L;if(Y!==void 0)return Y;throw Error(`\`${B}\` must be used within \`${X}\``)}return[W,H]}let q=()=>{let X=Q.map((Y)=>{return b4.createContext(Y)});return function(z){let K=z?.[$]||X;return b4.useMemo(()=>({[`__scope${$}`]:{...z,[$]:K}}),[z,K])}};return q.scopeName=$,[Z,ov(q,...J)]}function ov(...$){let J=$[0];if($.length===1)return J;let Q=()=>{let Z=$.map((q)=>({useScope:q(),scopeName:q.scopeName}));return function(X){let Y=Z.reduce((z,{useScope:K,scopeName:W})=>{let B=K(X)[`__scope${W}`];return{...z,...B}},{});return b4.useMemo(()=>({[`__scope${J.scopeName}`]:Y}),[Y])}};return Q.scopeName=J.scopeName,Q}var p6=R(v(),1);var lX=R(v(),1);var nv=p6[" useInsertionEffect ".trim().toString()]||L1;function tD({prop:$,defaultProp:J,onChange:Q=()=>{},caller:Z}){let[q,X,Y]=av({defaultProp:J,onChange:Q}),z=$!==void 0,K=z?$:q;{let H=p6.useRef($!==void 0);p6.useEffect(()=>{let B=H.current;if(B!==z)console.warn(`${Z} is changing from ${B?"controlled":"uncontrolled"} to ${z?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`);H.current=z},[z,Z])}let W=p6.useCallback((H)=>{if(z){let B=tv(H)?H($):H;if(B!==$)Y.current?.(B)}else X(H)},[z,$,X,Y]);return[K,W]}function av({defaultProp:$,onChange:J}){let[Q,Z]=p6.useState($),q=p6.useRef(Q),X=p6.useRef(J);return nv(()=>{X.current=J},[J]),p6.useEffect(()=>{if(q.current!==Q)X.current?.(Q),q.current=Q},[Q,q]),[Q,Z,X]}function tv($){return typeof $==="function"}var J60=Symbol("RADIX:SYNC_STATE");var eD=R(v(),1);function $N($){let[J,Q]=eD.useState(void 0);return L1(()=>{if($){Q({width:$.offsetWidth,height:$.offsetHeight});let Z=new ResizeObserver((q)=>{if(!Array.isArray(q))return;if(!q.length)return;let X=q[0],Y,z;if("borderBoxSize"in X){let K=X.borderBoxSize,W=Array.isArray(K)?K[0]:K;Y=W.inlineSize,z=W.blockSize}else Y=$.offsetWidth,z=$.offsetHeight;Q({width:Y,height:z})});return Z.observe($,{box:"border-box"}),()=>Z.unobserve($)}else Q(void 0)},[$]),J}var QN=R(v(),1),qg=R($5(),1);var Z8=R(v(),1);function JN($){let J=ev($),Q=Z8.forwardRef((Z,q)=>{let{children:X,...Y}=Z,z=Z8.Children.toArray(X),K=z.find(Jg);if(K){let W=K.props.children,H=z.map((B)=>{if(B===K){if(Z8.Children.count(W)>1)return Z8.Children.only(null);return Z8.isValidElement(W)?W.props.children:null}else return B});return G(J,{...Y,ref:q,children:Z8.isValidElement(W)?Z8.cloneElement(W,void 0,H):null})}return G(J,{...Y,ref:q,children:X})});return Q.displayName=`${$}.Slot`,Q}function ev($){let J=Z8.forwardRef((Q,Z)=>{let{children:q,...X}=Q;if(Z8.isValidElement(q)){let Y=Zg(q),z=Qg(X,q.props);if(q.type!==Z8.Fragment)z.ref=Z?oH(Z,Y):Y;return Z8.cloneElement(q,z)}return Z8.Children.count(q)>1?Z8.Children.only(null):null});return J.displayName=`${$}.SlotClone`,J}var $g=Symbol("radix.slottable");function Jg($){return Z8.isValidElement($)&&typeof $.type==="function"&&"__radixId"in $.type&&$.type.__radixId===$g}function Qg($,J){let Q={...J};for(let Z in J){let q=$[Z],X=J[Z];if(/^on[A-Z]/.test(Z)){if(q&&X)Q[Z]=(...z)=>{let K=X(...z);return q(...z),K};else if(q)Q[Z]=q}else if(Z==="style")Q[Z]={...q,...X};else if(Z==="className")Q[Z]=[q,X].filter(Boolean).join(" ")}return{...$,...Q}}function Zg($){let J=Object.getOwnPropertyDescriptor($.props,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning;if(Q)return $.ref;if(J=Object.getOwnPropertyDescriptor($,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning,Q)return $.props.ref;return $.props.ref||$.ref}var Xg=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],o$=Xg.reduce(($,J)=>{let Q=JN(`Primitive.${J}`),Z=QN.forwardRef((q,X)=>{let{asChild:Y,...z}=q,K=Y?Q:J;if(typeof window<"u")window[Symbol.for("radix-ui")]=!0;return G(K,{...z,ref:X})});return Z.displayName=`Primitive.${J}`,{...$,[J]:Z}},{});var ZN=["PageUp","PageDown"],qN=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],XN={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},n$="Slider",[nH,Yg,zg]=K7(n$),[YN,A60]=aD(n$,[zg]),[Kg,iX]=YN(n$),zN=Y5.forwardRef(($,J)=>{let{name:Q,min:Z=0,max:q=100,step:X=1,orientation:Y="horizontal",disabled:z=!1,minStepsBetweenThumbs:K=0,defaultValue:W=[Z],value:H,onValueChange:B=()=>{},onValueCommit:U=()=>{},inverted:_=!1,form:L,...F}=$,V=Y5.useRef(new Set),M=Y5.useRef(0),N=Y==="horizontal"?Gg:Wg,[O=[],I]=tD({prop:H,defaultProp:W,onChange:(y)=>{[...V.current][M.current]?.focus(),B(y)}}),k=Y5.useRef(O);function T(y){let x=Lg(O,y);C(y,x)}function A(y){C(y,M.current)}function w(){let y=k.current[M.current];if(O[M.current]!==y)U(O)}function C(y,x,{commit:j}={commit:!1}){let P=Dg(X),h=Ng(Math.round((y-Z)/X)*X+Z,P),l=f$(h,[Z,q]);I((t=[])=>{let S=Ug(t,l,x);if(Mg(S,K*X)){M.current=S.indexOf(l);let i=String(S)!==String(t);if(i&&j)U(S);return i?S:t}else return t})}return G(Kg,{scope:$.__scopeSlider,name:Q,disabled:z,min:Z,max:q,valueIndexToChangeRef:M,thumbs:V.current,values:O,orientation:Y,form:L,children:G(nH.Provider,{scope:$.__scopeSlider,children:G(nH.Slot,{scope:$.__scopeSlider,children:G(N,{"aria-disabled":z,"data-disabled":z?"":void 0,...F,ref:J,onPointerDown:N2(F.onPointerDown,()=>{if(!z)k.current=O}),min:Z,max:q,inverted:_,onSlideStart:z?void 0:T,onSlideMove:z?void 0:A,onSlideEnd:z?void 0:w,onHomeKeyDown:()=>!z&&C(Z,0,{commit:!0}),onEndKeyDown:()=>!z&&C(q,O.length-1,{commit:!0}),onStepKeyDown:({event:y,direction:x})=>{if(!z){let h=ZN.includes(y.key)||y.shiftKey&&qN.includes(y.key)?10:1,l=M.current,t=O[l],S=X*h*x;C(t+S,l,{commit:!0})}}})})})})});zN.displayName=n$;var[KN,GN]=YN(n$,{startEdge:"left",endEdge:"right",size:"width",direction:1}),Gg=Y5.forwardRef(($,J)=>{let{min:Q,max:Z,dir:q,inverted:X,onSlideStart:Y,onSlideMove:z,onSlideEnd:K,onStepKeyDown:W,...H}=$,[B,U]=Y5.useState(null),_=O2(J,(N)=>U(N)),L=Y5.useRef(void 0),F=d9(q),V=F==="ltr",M=V&&!X||!V&&X;function D(N){let O=L.current||B.getBoundingClientRect(),I=[0,O.width],T=eH(I,M?[Q,Z]:[Z,Q]);return L.current=O,T(N-O.left)}return G(KN,{scope:$.__scopeSlider,startEdge:M?"left":"right",endEdge:M?"right":"left",direction:M?1:-1,size:"width",children:G(WN,{dir:F,"data-orientation":"horizontal",...H,ref:_,style:{...H.style,["--radix-slider-thumb-transform"]:"translateX(-50%)"},onSlideStart:(N)=>{let O=D(N.clientX);Y?.(O)},onSlideMove:(N)=>{let O=D(N.clientX);z?.(O)},onSlideEnd:()=>{L.current=void 0,K?.()},onStepKeyDown:(N)=>{let I=XN[M?"from-left":"from-right"].includes(N.key);W?.({event:N,direction:I?-1:1})}})})}),Wg=Y5.forwardRef(($,J)=>{let{min:Q,max:Z,inverted:q,onSlideStart:X,onSlideMove:Y,onSlideEnd:z,onStepKeyDown:K,...W}=$,H=Y5.useRef(null),B=O2(J,H),U=Y5.useRef(void 0),_=!q;function L(F){let V=U.current||H.current.getBoundingClientRect(),M=[0,V.height],N=eH(M,_?[Z,Q]:[Q,Z]);return U.current=V,N(F-V.top)}return G(KN,{scope:$.__scopeSlider,startEdge:_?"bottom":"top",endEdge:_?"top":"bottom",size:"height",direction:_?1:-1,children:G(WN,{"data-orientation":"vertical",...W,ref:B,style:{...W.style,["--radix-slider-thumb-transform"]:"translateY(50%)"},onSlideStart:(F)=>{let V=L(F.clientY);X?.(V)},onSlideMove:(F)=>{let V=L(F.clientY);Y?.(V)},onSlideEnd:()=>{U.current=void 0,z?.()},onStepKeyDown:(F)=>{let M=XN[_?"from-bottom":"from-top"].includes(F.key);K?.({event:F,direction:M?-1:1})}})})}),WN=Y5.forwardRef(($,J)=>{let{__scopeSlider:Q,onSlideStart:Z,onSlideMove:q,onSlideEnd:X,onHomeKeyDown:Y,onEndKeyDown:z,onStepKeyDown:K,...W}=$,H=iX(n$,Q);return G(o$.span,{...W,ref:J,onKeyDown:N2($.onKeyDown,(B)=>{if(B.key==="Home")Y(B),B.preventDefault();else if(B.key==="End")z(B),B.preventDefault();else if(ZN.concat(qN).includes(B.key))K(B),B.preventDefault()}),onPointerDown:N2($.onPointerDown,(B)=>{let U=B.target;if(U.setPointerCapture(B.pointerId),B.preventDefault(),H.thumbs.has(U))U.focus();else Z(B)}),onPointerMove:N2($.onPointerMove,(B)=>{if(B.target.hasPointerCapture(B.pointerId))q(B)}),onPointerUp:N2($.onPointerUp,(B)=>{let U=B.target;if(U.hasPointerCapture(B.pointerId))U.releasePointerCapture(B.pointerId),X(B)})})}),HN="SliderTrack",BN=Y5.forwardRef(($,J)=>{let{__scopeSlider:Q,...Z}=$,q=iX(HN,Q);return G(o$.span,{"data-disabled":q.disabled?"":void 0,"data-orientation":q.orientation,...Z,ref:J})});BN.displayName=HN;var aH="SliderRange",UN=Y5.forwardRef(($,J)=>{let{__scopeSlider:Q,...Z}=$,q=iX(aH,Q),X=GN(aH,Q),Y=Y5.useRef(null),z=O2(J,Y),K=q.values.length,W=q.values.map((U)=>FN(U,q.min,q.max)),H=K>1?Math.min(...W):0,B=100-Math.max(...W);return G(o$.span,{"data-orientation":q.orientation,"data-disabled":q.disabled?"":void 0,...Z,ref:z,style:{...$.style,[X.startEdge]:H+"%",[X.endEdge]:B+"%"}})});UN.displayName=aH;var tH="SliderThumb",_N=Y5.forwardRef(($,J)=>{let Q=Yg($.__scopeSlider),[Z,q]=Y5.useState(null),X=O2(J,(z)=>q(z)),Y=Y5.useMemo(()=>Z?Q().findIndex((z)=>z.ref.current===Z):-1,[Q,Z]);return G(Hg,{...$,ref:X,index:Y})}),Hg=Y5.forwardRef(($,J)=>{let{__scopeSlider:Q,index:Z,name:q,...X}=$,Y=iX(tH,Q),z=GN(tH,Q),[K,W]=Y5.useState(null),H=O2(J,(D)=>W(D)),B=K?Y.form||!!K.closest("form"):!0,U=$N(K),_=Y.values[Z],L=_===void 0?0:FN(_,Y.min,Y.max),F=_g(Z,Y.values.length),V=U?.[z.size],M=V?Fg(V,L,z.direction):0;return Y5.useEffect(()=>{if(K)return Y.thumbs.add(K),()=>{Y.thumbs.delete(K)}},[K,Y.thumbs]),b("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[z.startEdge]:`calc(${L}% + ${M}px)`},children:[G(nH.ItemSlot,{scope:$.__scopeSlider,children:G(o$.span,{role:"slider","aria-label":$["aria-label"]||F,"aria-valuemin":Y.min,"aria-valuenow":_,"aria-valuemax":Y.max,"aria-orientation":Y.orientation,"data-orientation":Y.orientation,"data-disabled":Y.disabled?"":void 0,tabIndex:Y.disabled?void 0:0,...X,ref:H,style:_===void 0?{display:"none"}:$.style,onFocus:N2($.onFocus,()=>{Y.valueIndexToChangeRef.current=Z})})}),B&&G(LN,{name:q??(Y.name?Y.name+(Y.values.length>1?"[]":""):void 0),form:Y.form,value:_},Z)]})});_N.displayName=tH;var Bg="RadioBubbleInput",LN=Y5.forwardRef(({__scopeSlider:$,value:J,...Q},Z)=>{let q=Y5.useRef(null),X=O2(q,Z),Y=PX(J);return Y5.useEffect(()=>{let z=q.current;if(!z)return;let K=window.HTMLInputElement.prototype,H=Object.getOwnPropertyDescriptor(K,"value").set;if(Y!==J&&H){let B=new Event("input",{bubbles:!0});H.call(z,J),z.dispatchEvent(B)}},[Y,J]),G(o$.input,{style:{display:"none"},...Q,ref:X,defaultValue:J})});LN.displayName=Bg;function Ug($=[],J,Q){let Z=[...$];return Z[Q]=J,Z.sort((q,X)=>q-X)}function FN($,J,Q){let X=100/(Q-J)*($-J);return f$(X,[0,100])}function _g($,J){if(J>2)return`Value ${$+1} of ${J}`;else if(J===2)return["Minimum","Maximum"][$];else return}function Lg($,J){if($.length===1)return 0;let Q=$.map((q)=>Math.abs(q-J)),Z=Math.min(...Q);return Q.indexOf(Z)}function Fg($,J,Q){let Z=$/2,q=50,X=eH([0,50],[0,Z]);return(Z-X(J)*Q)*Q}function Vg($){return $.slice(0,-1).map((J,Q)=>$[Q+1]-J)}function Mg($,J){if(J>0){let Q=Vg($);return Math.min(...Q)>=J}return!0}function eH($,J){return(Q)=>{if($[0]===$[1]||J[0]===J[1])return J[0];let Z=(J[1]-J[0])/($[1]-$[0]);return J[0]+Z*(Q-$[0])}}function Dg($){return(String($).split(".")[1]||"").length}function Ng($,J){let Q=Math.pow(10,J);return Math.round($*Q)/Q}var aQ=zN,rX=BN,sX=UN,oX=_N;var N8=MN.forwardRef(({className:$,"aria-label":J,"aria-labelledby":Q,ticks:Z,...q},X)=>{let Y=q.value?.[0]??q.defaultValue?.[0];return G("div",{className:b0("relative",Z&&Z.length>0&&"pb-4"),children:b(aQ,{ref:X,className:b0("relative flex w-full touch-none select-none items-center",$),"aria-label":J,"aria-labelledby":Q,...q,children:[G(rX,{className:"relative h-1.5 w-full grow overflow-hidden rounded-full bg-muted",children:G(sX,{className:"absolute h-full bg-primary"})}),G(oX,{"aria-label":J,"aria-labelledby":Q,className:"block h-3 w-3 rounded-full border border-primary/50 bg-primary shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"}),Z&&Z.length>0&&G("div",{className:"absolute left-0 top-full flex w-full justify-between",children:Z.map((z)=>{let K=z.value===Y;return b("div",{className:"flex flex-col items-center gap-0.5",children:[G("div",{className:b0("h-1.5 w-px bg-muted-foreground/40",K&&"bg-primary")}),G("span",{className:b0("text-[10px] tabular-nums leading-none text-muted-foreground",K&&"font-medium text-foreground"),children:z.label})]},z.value)})})]})})});N8.displayName=aQ.displayName;var uN=R(v(),1);var w1=R(v(),1);var T60=!!(typeof window<"u"&&window.document&&window.document.createElement);function A2($,J,{checkForDefaultPrevented:Q=!0}={}){return function(q){if($?.(q),Q===!1||!q.defaultPrevented)return J?.(q)}}var NN=R(v(),1);function DN($,J){if(typeof $==="function")return $(J);else if($!==null&&$!==void 0)$.current=J}function $3(...$){return(J)=>{let Q=!1,Z=$.map((q)=>{let X=DN(q,J);if(!Q&&typeof X=="function")Q=!0;return X});if(Q)return()=>{for(let q=0;q{let{scope:U,children:_,...L}=B,F=U?.[$]?.[K]||z,V=j4.useMemo(()=>L,Object.values(L));return G(F.Provider,{value:V,children:_})};W.displayName=X+"Provider";function H(B,U){let _=U?.[$]?.[K]||z,L=j4.useContext(_);if(L)return L;if(Y!==void 0)return Y;throw Error(`\`${B}\` must be used within \`${X}\``)}return[W,H]}let q=()=>{let X=Q.map((Y)=>{return j4.createContext(Y)});return function(z){let K=z?.[$]||X;return j4.useMemo(()=>({[`__scope${$}`]:{...z,[$]:K}}),[z,K])}};return q.scopeName=$,[Z,Og(q,...J)]}function Og(...$){let J=$[0];if($.length===1)return J;let Q=()=>{let Z=$.map((q)=>({useScope:q(),scopeName:q.scopeName}));return function(X){let Y=Z.reduce((z,{useScope:K,scopeName:W})=>{let B=K(X)[`__scope${W}`];return{...z,...B}},{});return j4.useMemo(()=>({[`__scope${J.scopeName}`]:Y}),[Y])}};return Q.scopeName=J.scopeName,Q}var H6=R(v(),1);var AN=R(v(),1);function Ag($,J){return AN.useReducer((Q,Z)=>{return J[Q][Z]??Q},$)}var aX=($)=>{let{present:J,children:Q}=$,Z=wg(J),q=typeof Q==="function"?Q({present:Z.isPresent}):H6.Children.only(Q),X=tQ(Z.ref,kg(q));return typeof Q==="function"||Z.isPresent?H6.cloneElement(q,{ref:X}):null};aX.displayName="Presence";function wg($){let[J,Q]=H6.useState(),Z=H6.useRef(null),q=H6.useRef($),X=H6.useRef("none"),Y=$?"mounted":"unmounted",[z,K]=Ag(Y,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return H6.useEffect(()=>{let W=nX(Z.current);X.current=z==="mounted"?W:"none"},[z]),L1(()=>{let W=Z.current,H=q.current;if(H!==$){let U=X.current,_=nX(W);if($)K("MOUNT");else if(_==="none"||W?.display==="none")K("UNMOUNT");else if(H&&U!==_)K("ANIMATION_OUT");else K("UNMOUNT");q.current=$}},[$,K]),L1(()=>{if(J){let W,H=J.ownerDocument.defaultView??window,B=(_)=>{let F=nX(Z.current).includes(CSS.escape(_.animationName));if(_.target===J&&F){if(K("ANIMATION_END"),!q.current){let V=J.style.animationFillMode;J.style.animationFillMode="forwards",W=H.setTimeout(()=>{if(J.style.animationFillMode==="forwards")J.style.animationFillMode=V})}}},U=(_)=>{if(_.target===J)X.current=nX(Z.current)};return J.addEventListener("animationstart",U),J.addEventListener("animationcancel",B),J.addEventListener("animationend",B),()=>{H.clearTimeout(W),J.removeEventListener("animationstart",U),J.removeEventListener("animationcancel",B),J.removeEventListener("animationend",B)}}else K("ANIMATION_END")},[J,K]),{isPresent:["mounted","unmountSuspended"].includes(z),ref:H6.useCallback((W)=>{Z.current=W?getComputedStyle(W):null,Q(W)},[])}}function nX($){return $?.animationName||"none"}function kg($){let J=Object.getOwnPropertyDescriptor($.props,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning;if(Q)return $.ref;if(J=Object.getOwnPropertyDescriptor($,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning,Q)return $.props.ref;return $.props.ref||$.ref}var TN=R(v(),1),Eg=R($5(),1);var q8=R(v(),1);function wN($){let J=Ig($),Q=q8.forwardRef((Z,q)=>{let{children:X,...Y}=Z,z=q8.Children.toArray(X),K=z.find(Tg);if(K){let W=K.props.children,H=z.map((B)=>{if(B===K){if(q8.Children.count(W)>1)return q8.Children.only(null);return q8.isValidElement(W)?W.props.children:null}else return B});return G(J,{...Y,ref:q,children:q8.isValidElement(W)?q8.cloneElement(W,void 0,H):null})}return G(J,{...Y,ref:q,children:X})});return Q.displayName=`${$}.Slot`,Q}function Ig($){let J=q8.forwardRef((Q,Z)=>{let{children:q,...X}=Q;if(q8.isValidElement(q)){let Y=jg(q),z=bg(X,q.props);if(q.type!==q8.Fragment)z.ref=Z?$3(Z,Y):Y;return q8.cloneElement(q,z)}return q8.Children.count(q)>1?q8.Children.only(null):null});return J.displayName=`${$}.SlotClone`,J}var kN=Symbol("radix.slottable");function IN($){let J=({children:Q})=>{return G(W1,{children:Q})};return J.displayName=`${$}.Slottable`,J.__radixId=kN,J}function Tg($){return q8.isValidElement($)&&typeof $.type==="function"&&"__radixId"in $.type&&$.type.__radixId===kN}function bg($,J){let Q={...J};for(let Z in J){let q=$[Z],X=J[Z];if(/^on[A-Z]/.test(Z)){if(q&&X)Q[Z]=(...z)=>{let K=X(...z);return q(...z),K};else if(q)Q[Z]=q}else if(Z==="style")Q[Z]={...q,...X};else if(Z==="className")Q[Z]=[q,X].filter(Boolean).join(" ")}return{...$,...Q}}function jg($){let J=Object.getOwnPropertyDescriptor($.props,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning;if(Q)return $.ref;if(J=Object.getOwnPropertyDescriptor($,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning,Q)return $.props.ref;return $.props.ref||$.ref}var yg=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],bN=yg.reduce(($,J)=>{let Q=wN(`Primitive.${J}`),Z=TN.forwardRef((q,X)=>{let{asChild:Y,...z}=q,K=Y?Q:J;if(typeof window<"u")window[Symbol.for("radix-ui")]=!0;return G(K,{...z,ref:X})});return Z.displayName=`Primitive.${J}`,{...$,[J]:Z}},{});var l6=R(v(),1);var tX=R(v(),1);var Pg=l6[" useInsertionEffect ".trim().toString()]||L1;function jN({prop:$,defaultProp:J,onChange:Q=()=>{},caller:Z}){let[q,X,Y]=Rg({defaultProp:J,onChange:Q}),z=$!==void 0,K=z?$:q;{let H=l6.useRef($!==void 0);l6.useEffect(()=>{let B=H.current;if(B!==z)console.warn(`${Z} is changing from ${B?"controlled":"uncontrolled"} to ${z?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`);H.current=z},[z,Z])}let W=l6.useCallback((H)=>{if(z){let B=Cg(H)?H($):H;if(B!==$)Y.current?.(B)}else X(H)},[z,$,X,Y]);return[K,W]}function Rg({defaultProp:$,onChange:J}){let[Q,Z]=l6.useState($),q=l6.useRef(Q),X=l6.useRef(J);return Pg(()=>{X.current=J},[J]),l6.useEffect(()=>{if(q.current!==Q)X.current?.(Q),q.current=Q},[Q,q]),[Q,Z,X]}function Cg($){return typeof $==="function"}var m60=Symbol("RADIX:SYNC_STATE");var[eX,J90]=ON("Tooltip",[c6]),$Y=c6(),EN="TooltipProvider",Sg=700,J3="tooltip.open",[hg,Z3]=eX(EN),yN=($)=>{let{__scopeTooltip:J,delayDuration:Q=Sg,skipDelayDuration:Z=300,disableHoverableContent:q=!1,children:X}=$,Y=w1.useRef(!0),z=w1.useRef(!1),K=w1.useRef(0);return w1.useEffect(()=>{let W=K.current;return()=>window.clearTimeout(W)},[]),G(hg,{scope:J,isOpenDelayedRef:Y,delayDuration:Q,onOpen:w1.useCallback(()=>{window.clearTimeout(K.current),Y.current=!1},[]),onClose:w1.useCallback(()=>{window.clearTimeout(K.current),K.current=window.setTimeout(()=>Y.current=!0,Z)},[Z]),isPointerInTransitRef:z,onPointerInTransitChange:w1.useCallback((W)=>{z.current=W},[]),disableHoverableContent:q,children:X})};yN.displayName=EN;var eQ="Tooltip",[xg,$Z]=eX(eQ),PN=($)=>{let{__scopeTooltip:J,children:Q,open:Z,defaultOpen:q,onOpenChange:X,disableHoverableContent:Y,delayDuration:z}=$,K=Z3(eQ,$.__scopeTooltip),W=$Y(J),[H,B]=w1.useState(null),U=a5(),_=w1.useRef(0),L=Y??K.disableHoverableContent,F=z??K.delayDuration,V=w1.useRef(!1),[M,D]=jN({prop:Z,defaultProp:q??!1,onChange:(T)=>{if(T)K.onOpen(),document.dispatchEvent(new CustomEvent(J3));else K.onClose();X?.(T)},caller:eQ}),N=w1.useMemo(()=>{return M?V.current?"delayed-open":"instant-open":"closed"},[M]),O=w1.useCallback(()=>{window.clearTimeout(_.current),_.current=0,V.current=!1,D(!0)},[D]),I=w1.useCallback(()=>{window.clearTimeout(_.current),_.current=0,D(!1)},[D]),k=w1.useCallback(()=>{window.clearTimeout(_.current),_.current=window.setTimeout(()=>{V.current=!0,D(!0),_.current=0},F)},[F,D]);return w1.useEffect(()=>{return()=>{if(_.current)window.clearTimeout(_.current),_.current=0}},[]),G(w4,{...W,children:G(xg,{scope:J,contentId:U,open:M,stateAttribute:N,trigger:H,onTriggerChange:B,onTriggerEnter:w1.useCallback(()=>{if(K.isOpenDelayedRef.current)k();else O()},[K.isOpenDelayedRef,k,O]),onTriggerLeave:w1.useCallback(()=>{if(L)I();else window.clearTimeout(_.current),_.current=0},[I,L]),onOpen:O,onClose:I,disableHoverableContent:L,children:Q})})};PN.displayName=eQ;var Q3="TooltipTrigger",RN=w1.forwardRef(($,J)=>{let{__scopeTooltip:Q,...Z}=$,q=$Z(Q3,Q),X=Z3(Q3,Q),Y=$Y(Q),z=w1.useRef(null),K=tQ(J,z,q.onTriggerChange),W=w1.useRef(!1),H=w1.useRef(!1),B=w1.useCallback(()=>W.current=!1,[]);return w1.useEffect(()=>{return()=>document.removeEventListener("pointerup",B)},[B]),G(k4,{asChild:!0,...Y,children:G(bN.button,{"aria-describedby":q.open?q.contentId:void 0,"data-state":q.stateAttribute,...Z,ref:K,onPointerMove:A2($.onPointerMove,(U)=>{if(U.pointerType==="touch")return;if(!H.current&&!X.isPointerInTransitRef.current)q.onTriggerEnter(),H.current=!0}),onPointerLeave:A2($.onPointerLeave,()=>{q.onTriggerLeave(),H.current=!1}),onPointerDown:A2($.onPointerDown,()=>{if(q.open)q.onClose();W.current=!0,document.addEventListener("pointerup",B,{once:!0})}),onFocus:A2($.onFocus,()=>{if(!W.current)q.onOpen()}),onBlur:A2($.onBlur,q.onClose),onClick:A2($.onClick,q.onClose)})})});RN.displayName=Q3;var q3="TooltipPortal",[fg,vg]=eX(q3,{forceMount:void 0}),CN=($)=>{let{__scopeTooltip:J,forceMount:Q,children:Z,container:q}=$,X=$Z(q3,J);return G(fg,{scope:J,forceMount:Q,children:G(aX,{present:Q||X.open,children:G(k9,{asChild:!0,container:q,children:Z})})})};CN.displayName=q3;var a$="TooltipContent",SN=w1.forwardRef(($,J)=>{let Q=vg(a$,$.__scopeTooltip),{forceMount:Z=Q.forceMount,side:q="top",...X}=$,Y=$Z(a$,$.__scopeTooltip);return G(aX,{present:Z||Y.open,children:Y.disableHoverableContent?G(hN,{side:q,...X,ref:J}):G(gg,{side:q,...X,ref:J})})}),gg=w1.forwardRef(($,J)=>{let Q=$Z(a$,$.__scopeTooltip),Z=Z3(a$,$.__scopeTooltip),q=w1.useRef(null),X=tQ(J,q),[Y,z]=w1.useState(null),{trigger:K,onClose:W}=Q,H=q.current,{onPointerInTransitChange:B}=Z,U=w1.useCallback(()=>{z(null),B(!1)},[B]),_=w1.useCallback((L,F)=>{let V=L.currentTarget,M={x:L.clientX,y:L.clientY},D=pg(M,V.getBoundingClientRect()),N=lg(M,D),O=ig(F.getBoundingClientRect()),I=sg([...N,...O]);z(I),B(!0)},[B]);return w1.useEffect(()=>{return()=>U()},[U]),w1.useEffect(()=>{if(K&&H){let L=(V)=>_(V,H),F=(V)=>_(V,K);return K.addEventListener("pointerleave",L),H.addEventListener("pointerleave",F),()=>{K.removeEventListener("pointerleave",L),H.removeEventListener("pointerleave",F)}}},[K,H,_,U]),w1.useEffect(()=>{if(Y){let L=(F)=>{let V=F.target,M={x:F.clientX,y:F.clientY},D=K?.contains(V)||H?.contains(V),N=!rg(M,Y);if(D)U();else if(N)U(),W()};return document.addEventListener("pointermove",L),()=>document.removeEventListener("pointermove",L)}},[K,H,Y,W,U]),G(hN,{...$,ref:X})}),[ug,mg]=eX(eQ,{isInside:!1}),cg=IN("TooltipContent"),hN=w1.forwardRef(($,J)=>{let{__scopeTooltip:Q,children:Z,"aria-label":q,onEscapeKeyDown:X,onPointerDownOutside:Y,...z}=$,K=$Z(a$,Q),W=$Y(Q),{onClose:H}=K;return w1.useEffect(()=>{return document.addEventListener(J3,H),()=>document.removeEventListener(J3,H)},[H]),w1.useEffect(()=>{if(K.trigger){let B=(U)=>{if(U.target?.contains(K.trigger))H()};return window.addEventListener("scroll",B,{capture:!0}),()=>window.removeEventListener("scroll",B,{capture:!0})}},[K.trigger,H]),G(O9,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:X,onPointerDownOutside:Y,onFocusOutside:(B)=>B.preventDefault(),onDismiss:H,children:b(U7,{"data-state":K.stateAttribute,...W,...z,ref:J,style:{...z.style,...{"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"}},children:[G(cg,{children:Z}),G(ug,{scope:Q,isInside:!0,children:G(lM,{id:K.contentId,role:"tooltip",children:q||Z})})]})})});SN.displayName=a$;var xN="TooltipArrow",dg=w1.forwardRef(($,J)=>{let{__scopeTooltip:Q,...Z}=$,q=$Y(Q);return mg(xN,Q).isInside?null:G(_7,{...q,...Z,ref:J})});dg.displayName=xN;function pg($,J){let Q=Math.abs(J.top-$.y),Z=Math.abs(J.bottom-$.y),q=Math.abs(J.right-$.x),X=Math.abs(J.left-$.x);switch(Math.min(Q,Z,q,X)){case X:return"left";case q:return"right";case Q:return"top";case Z:return"bottom";default:throw Error("unreachable")}}function lg($,J,Q=5){let Z=[];switch(J){case"top":Z.push({x:$.x-Q,y:$.y+Q},{x:$.x+Q,y:$.y+Q});break;case"bottom":Z.push({x:$.x-Q,y:$.y-Q},{x:$.x+Q,y:$.y-Q});break;case"left":Z.push({x:$.x+Q,y:$.y-Q},{x:$.x+Q,y:$.y+Q});break;case"right":Z.push({x:$.x-Q,y:$.y-Q},{x:$.x-Q,y:$.y+Q});break}return Z}function ig($){let{top:J,right:Q,bottom:Z,left:q}=$;return[{x:q,y:J},{x:Q,y:J},{x:Q,y:Z},{x:q,y:Z}]}function rg($,J){let{x:Q,y:Z}=$,q=!1;for(let X=0,Y=J.length-1;XZ!==U>Z&&Q<(B-W)*(Z-H)/(U-H)+W)q=!q}return q}function sg($){let J=$.slice();return J.sort((Q,Z)=>{if(Q.xZ.x)return 1;else if(Q.yZ.y)return 1;else return 0}),og(J)}function og($){if($.length<=1)return $.slice();let J=[];for(let Z=0;Z<$.length;Z++){let q=$[Z];while(J.length>=2){let X=J[J.length-1],Y=J[J.length-2];if((X.x-Y.x)*(q.y-Y.y)>=(X.y-Y.y)*(q.x-Y.x))J.pop();else break}J.push(q)}J.pop();let Q=[];for(let Z=$.length-1;Z>=0;Z--){let q=$[Z];while(Q.length>=2){let X=Q[Q.length-1],Y=Q[Q.length-2];if((X.x-Y.x)*(q.y-Y.y)>=(X.y-Y.y)*(q.x-Y.x))Q.pop();else break}Q.push(q)}if(Q.pop(),J.length===1&&Q.length===1&&J[0].x===Q[0].x&&J[0].y===Q[0].y)return J;else return J.concat(Q)}var X3=yN,fN=PN,vN=RN,gN=CN,Y3=SN;var n1=({disableHoverableContent:$=!0,...J})=>G(X3,{disableHoverableContent:$,...J});n1.displayName=X3.displayName;var B1=fN,U1=vN,H1=uN.forwardRef(({className:$,sideOffset:J=4,...Q},Z)=>G(gN,{children:G("div",{className:`${M8}`,children:G(Y3,{ref:Z,sideOffset:J,className:b0("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",$),...Q})})}));H1.displayName=Y3.displayName;function ag($,J){let Q=JZ(Math.max($,1),Math.max(J,1));if(Q<=10)return{max:2,step:0.05};if(Q<=30)return{max:3,step:0.05};if(Q<=60)return{max:4,step:0.1};if(Q<=120)return{max:6,step:0.1};if(Q<=300)return{max:8,step:0.2};return{max:10,step:0.25}}function dN({totalLength:$,frameRate:J,displayFormat:Q,onTotalLengthChange:Z,onFrameRateChange:q,onDisplayFormatChange:X,isPlaying:Y,onPlayPause:z,hasSelection:K,canDelete:W=K,onDeleteSelected:H,zoom:B,onZoomChange:U,selectedSegment:_,onSelectedSegmentDurationChange:L}){let F=X1(),V=ag($,J);cN.useEffect(()=>{if(B>V.max)U(V.max)},[B,V.max,U]);let M=_?_.end_frame-_.start_frame+1:0,D;if(_)D=Q==="seconds"?Math.round(JZ(M,J)*100)/100:M;else D=Q==="seconds"?Math.round(JZ($,J)*100)/100:$;function N(I){if(I<=0)return;let k=Q==="seconds"?mN(I,J):Math.round(I);if(Q==="seconds"){let T=_?_.end_frame-_.start_frame+1:$;if(k===T){let A=JZ(T,J);if(IA)k=T+4;else return}}if(_){let T=_.end_frame-_.start_frame+1;if(k-T===0)return;L(_.id,k)}else Z(k)}function O(I){if(I>0)q(Math.round(I))}return b("div",{className:"flex justify-between items-center gap-2 py-1 border-b border-border text-xs shrink-0",children:[b("div",{className:"flex items-center gap-0.5",children:[b(B1,{children:[G(U1,{asChild:!0,children:G(k0,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:z,"aria-label":Y?F("toolbar.pause"):F("toolbar.play"),children:Y?G(M7,{className:"w-2 h-2"}):G(E4,{className:"w-2 h-2"})})}),G(H1,{side:"bottom",children:Y?F("toolbar.pause"):F("toolbar.play")})]}),b(B1,{children:[G(U1,{asChild:!0,children:G(k0,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:H,disabled:!W,"aria-label":F("toolbar.deleteSegment"),children:G(M5,{className:"w-2 h-2"})})}),G(H1,{side:"bottom",children:F("toolbar.deleteSegment")})]})]}),b("div",{className:"flex items-center gap-2","data-time-toolbar":!0,children:[b("div",{className:"flex items-center gap-1",children:[G(e8,{value:D,onChange:N,min:1,max:2000,step:Q==="seconds"?1:4,commitOnBlur:!0,className:"h-6 w-18"}),b(E8,{value:Q,onValueChange:(I)=>X(I),children:[G(y8,{className:"h-6 w-10 text-xs",children:(Q==="frames"?F("toolbar.frames"):F("toolbar.seconds")).substring(0,1)}),b(P8,{children:[G(l5,{value:"frames",children:F("toolbar.frames")}),G(l5,{value:"seconds",children:F("toolbar.seconds")})]})]})]}),b("div",{className:"flex items-center gap-1",children:[G(e8,{value:J,onChange:O,min:1,max:60,step:1,commitOnBlur:!0,className:"h-6 w-14"}),G("span",{className:"text-muted-foreground",children:F("toolbar.fps")})]})]}),G("div",{className:"flex items-center gap-1 pr-1",children:b("div",{className:"flex items-center gap-1",children:[b(B1,{children:[G(U1,{asChild:!0,children:G(t$,{className:"w-4 h-4 text-muted-foreground shrink-0"})}),G(H1,{side:"bottom",children:F("toolbar.zoom")})]}),G(N8,{min:1,max:V.max,step:V.step,value:[Math.min(B,V.max)],onValueChange:([I])=>U(I),className:"w-12 h-3","aria-label":F("toolbar.zoom")})]})})]})}var e$=R(v(),1);function tg($,J,Q,Z){if(Z==="seconds"){let z=($-1)/Q/J,K=[0.1,0.25,0.5,1,2,5,10,15,30,60,120,300],W=K.reduce((H,B)=>Math.abs(B-z)Math.abs(z-q){return()=>{W.current=!1}},[]);function H(F){return Math.max(0,Math.min($-1,Math.round(F/Z*($-1))))}function B(F){if(!z)return;F.preventDefault(),W.current=!0;let V=F.currentTarget.getBoundingClientRect(),M=(F.clientX-V.left)/q;z(H(M));function D(O){if(!W.current)return;let I=(O.clientX-V.left)/q;z(H(I))}function N(){W.current=!1,globalThis.removeEventListener("mousemove",D),globalThis.removeEventListener("mouseup",N)}globalThis.addEventListener("mousemove",D),globalThis.addEventListener("mouseup",N)}let U=X===void 0?void 0:X/Math.max($-1,1)*Z,_=e$.useMemo(()=>{let F=Math.max(5,Math.floor(Z/60)),V=tg($,F,J,Q),M=[];for(let N=0;N<$;N+=V){let O=Q==="seconds"?`${Math.max(0,N/J).toFixed(1)}s`:`${N}f`;M.push({frame:N,label:O,major:!0})}let D=$-1;if(!M.some((N)=>N.frame===D)){let N=Q==="seconds"?`${Math.max(0,D/J).toFixed(1)}s`:`${D}f`;M.push({frame:D,label:N,major:!1})}return M},[$,J,Q,Z]);function L(F){return F/Math.max($-1,1)*Z}return b("div",{role:"slider","aria-label":"Playhead position","aria-valuenow":X??0,"aria-valuemin":0,"aria-valuemax":$-1,tabIndex:z?0:-1,className:"relative h-6 shrink-0 select-none border-b border-border overflow-hidden cursor-col-resize",style:{width:Z},onMouseDown:B,onWheel:K,onKeyDown:(F)=>{if(!z)return;let V=F.shiftKey?10:1;if(F.key==="ArrowLeft")z(Math.max(0,(X??0)-V));else if(F.key==="ArrowRight")z(Math.min($-1,(X??0)+V))},children:[_.map(({frame:F,label:V,major:M})=>b("div",{className:"absolute top-0 flex flex-col items-start pointer-events-none",style:{left:L(F)},children:[G("div",{className:`w-px ${M?"h-2 bg-border":"h-1.5 bg-border"}`}),M&&G("span",{className:"text-[9px] text-muted-foreground/70 whitespace-nowrap translate-x-1",children:V})]},F)),U!==void 0&&G("div",{className:"absolute top-0 h-full w-px bg-red-400 pointer-events-none z-10",style:{left:U},children:G("div",{className:"absolute top-0 -translate-x-1/2 w-0 h-0 pointer-events-none",style:{borderLeft:"4px solid transparent",borderRight:"4px solid transparent",borderTop:"6px solid rgb(248 113 113)"}})}),Y&&U!==void 0&&G("div",{className:"absolute top-0 -translate-x-1/2 z-20 pointer-events-none",style:{left:U,top:"-2px"},children:G("div",{className:"bg-red-400 text-white text-[8px] font-medium px-1.5 py-0.5 rounded whitespace-nowrap shadow",children:Q==="seconds"?`${Math.max(0,(X??0)/J).toFixed(1)}s`:`${X??0}f`})})]})}var m4=R(v(),1);var C4=R(v(),1);var H5=R(v(),1);var M90=!!(typeof window<"u"&&window.document&&window.document.createElement);function $J($,J,{checkForDefaultPrevented:Q=!0}={}){return function(q){if($?.(q),Q===!1||!q.defaultPrevented)return J?.(q)}}var y4=R(v(),1);function pN($,J=[]){let Q=[];function Z(X,Y){let z=y4.createContext(Y),K=Q.length;Q=[...Q,Y];let W=(B)=>{let{scope:U,children:_,...L}=B,F=U?.[$]?.[K]||z,V=y4.useMemo(()=>L,Object.values(L));return G(F.Provider,{value:V,children:_})};W.displayName=X+"Provider";function H(B,U){let _=U?.[$]?.[K]||z,L=y4.useContext(_);if(L)return L;if(Y!==void 0)return Y;throw Error(`\`${B}\` must be used within \`${X}\``)}return[W,H]}let q=()=>{let X=Q.map((Y)=>{return y4.createContext(Y)});return function(z){let K=z?.[$]||X;return y4.useMemo(()=>({[`__scope${$}`]:{...z,[$]:K}}),[z,K])}};return q.scopeName=$,[Z,eg(q,...J)]}function eg(...$){let J=$[0];if($.length===1)return J;let Q=()=>{let Z=$.map((q)=>({useScope:q(),scopeName:q.scopeName}));return function(X){let Y=Z.reduce((z,{useScope:K,scopeName:W})=>{let B=K(X)[`__scope${W}`];return{...z,...B}},{});return y4.useMemo(()=>({[`__scope${J.scopeName}`]:Y}),[Y])}};return Q.scopeName=J.scopeName,Q}var sN=R(v(),1),Yu=R($5(),1);var X8=R(v(),1);var $u=R(v(),1);function lN($,J){if(typeof $==="function")return $(J);else if($!==null&&$!==void 0)$.current=J}function iN(...$){return(J)=>{let Q=!1,Z=$.map((q)=>{let X=lN(q,J);if(!Q&&typeof X=="function")Q=!0;return X});if(Q)return()=>{for(let q=0;q{let{children:X,...Y}=Z,z=X8.Children.toArray(X),K=z.find(Zu);if(K){let W=K.props.children,H=z.map((B)=>{if(B===K){if(X8.Children.count(W)>1)return X8.Children.only(null);return X8.isValidElement(W)?W.props.children:null}else return B});return G(J,{...Y,ref:q,children:X8.isValidElement(W)?X8.cloneElement(W,void 0,H):null})}return G(J,{...Y,ref:q,children:X})});return Q.displayName=`${$}.Slot`,Q}function Ju($){let J=X8.forwardRef((Q,Z)=>{let{children:q,...X}=Q;if(X8.isValidElement(q)){let Y=Xu(q),z=qu(X,q.props);if(q.type!==X8.Fragment)z.ref=Z?iN(Z,Y):Y;return X8.cloneElement(q,z)}return X8.Children.count(q)>1?X8.Children.only(null):null});return J.displayName=`${$}.SlotClone`,J}var Qu=Symbol("radix.slottable");function Zu($){return X8.isValidElement($)&&typeof $.type==="function"&&"__radixId"in $.type&&$.type.__radixId===Qu}function qu($,J){let Q={...J};for(let Z in J){let q=$[Z],X=J[Z];if(/^on[A-Z]/.test(Z)){if(q&&X)Q[Z]=(...z)=>{let K=X(...z);return q(...z),K};else if(q)Q[Z]=q}else if(Z==="style")Q[Z]={...q,...X};else if(Z==="className")Q[Z]=[q,X].filter(Boolean).join(" ")}return{...$,...Q}}function Xu($){let J=Object.getOwnPropertyDescriptor($.props,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning;if(Q)return $.ref;if(J=Object.getOwnPropertyDescriptor($,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning,Q)return $.props.ref;return $.props.ref||$.ref}var zu=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],oN=zu.reduce(($,J)=>{let Q=rN(`Primitive.${J}`),Z=sN.forwardRef((q,X)=>{let{asChild:Y,...z}=q,K=Y?Q:J;if(typeof window<"u")window[Symbol.for("radix-ui")]=!0;return G(K,{...z,ref:X})});return Z.displayName=`Primitive.${J}`,{...$,[J]:Z}},{});var Y1=R(v(),1);var E90=!!(typeof window<"u"&&window.document&&window.document.createElement);function P5($,J,{checkForDefaultPrevented:Q=!0}={}){return function(q){if($?.(q),Q===!1||!q.defaultPrevented)return J?.(q)}}var aN=R(v(),1);function nN($,J){if(typeof $==="function")return $(J);else if($!==null&&$!==void 0)$.current=J}function QZ(...$){return(J)=>{let Q=!1,Z=$.map((q)=>{let X=nN(q,J);if(!Q&&typeof X=="function")Q=!0;return X});if(Q)return()=>{for(let q=0;q{let{scope:U,children:_,...L}=B,F=U?.[$]?.[K]||z,V=P4.useMemo(()=>L,Object.values(L));return G(F.Provider,{value:V,children:_})};W.displayName=X+"Provider";function H(B,U){let _=U?.[$]?.[K]||z,L=P4.useContext(_);if(L)return L;if(Y!==void 0)return Y;throw Error(`\`${B}\` must be used within \`${X}\``)}return[W,H]}let q=()=>{let X=Q.map((Y)=>{return P4.createContext(Y)});return function(z){let K=z?.[$]||X;return P4.useMemo(()=>({[`__scope${$}`]:{...z,[$]:K}}),[z,K])}};return q.scopeName=$,[Z,Ku(q,...J)]}function Ku(...$){let J=$[0];if($.length===1)return J;let Q=()=>{let Z=$.map((q)=>({useScope:q(),scopeName:q.scopeName}));return function(X){let Y=Z.reduce((z,{useScope:K,scopeName:W})=>{let B=K(X)[`__scope${W}`];return{...z,...B}},{});return P4.useMemo(()=>({[`__scope${J.scopeName}`]:Y}),[Y])}};return Q.scopeName=J.scopeName,Q}var B6=R(v(),1);var eN=R(v(),1);function Gu($,J){return eN.useReducer((Q,Z)=>{return J[Q][Z]??Q},$)}var JJ=($)=>{let{present:J,children:Q}=$,Z=Wu(J),q=typeof Q==="function"?Q({present:Z.isPresent}):B6.Children.only(Q),X=D7(Z.ref,Hu(q));return typeof Q==="function"||Z.isPresent?B6.cloneElement(q,{ref:X}):null};JJ.displayName="Presence";function Wu($){let[J,Q]=B6.useState(),Z=B6.useRef(null),q=B6.useRef($),X=B6.useRef("none"),Y=$?"mounted":"unmounted",[z,K]=Gu(Y,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return B6.useEffect(()=>{let W=QY(Z.current);X.current=z==="mounted"?W:"none"},[z]),L1(()=>{let W=Z.current,H=q.current;if(H!==$){let U=X.current,_=QY(W);if($)K("MOUNT");else if(_==="none"||W?.display==="none")K("UNMOUNT");else if(H&&U!==_)K("ANIMATION_OUT");else K("UNMOUNT");q.current=$}},[$,K]),L1(()=>{if(J){let W,H=J.ownerDocument.defaultView??window,B=(_)=>{let F=QY(Z.current).includes(CSS.escape(_.animationName));if(_.target===J&&F){if(K("ANIMATION_END"),!q.current){let V=J.style.animationFillMode;J.style.animationFillMode="forwards",W=H.setTimeout(()=>{if(J.style.animationFillMode==="forwards")J.style.animationFillMode=V})}}},U=(_)=>{if(_.target===J)X.current=QY(Z.current)};return J.addEventListener("animationstart",U),J.addEventListener("animationcancel",B),J.addEventListener("animationend",B),()=>{H.clearTimeout(W),J.removeEventListener("animationstart",U),J.removeEventListener("animationcancel",B),J.removeEventListener("animationend",B)}}else K("ANIMATION_END")},[J,K]),{isPresent:["mounted","unmountSuspended"].includes(z),ref:B6.useCallback((W)=>{Z.current=W?getComputedStyle(W):null,Q(W)},[])}}function QY($){return $?.animationName||"none"}function Hu($){let J=Object.getOwnPropertyDescriptor($.props,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning;if(Q)return $.ref;if(J=Object.getOwnPropertyDescriptor($,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning,Q)return $.props.ref;return $.props.ref||$.ref}var $O=R(v(),1),JO=R($5(),1);var Y8=R(v(),1);function ZY($){let J=Bu($),Q=Y8.forwardRef((Z,q)=>{let{children:X,...Y}=Z,z=Y8.Children.toArray(X),K=z.find(_u);if(K){let W=K.props.children,H=z.map((B)=>{if(B===K){if(Y8.Children.count(W)>1)return Y8.Children.only(null);return Y8.isValidElement(W)?W.props.children:null}else return B});return G(J,{...Y,ref:q,children:Y8.isValidElement(W)?Y8.cloneElement(W,void 0,H):null})}return G(J,{...Y,ref:q,children:X})});return Q.displayName=`${$}.Slot`,Q}function Bu($){let J=Y8.forwardRef((Q,Z)=>{let{children:q,...X}=Q;if(Y8.isValidElement(q)){let Y=Fu(q),z=Lu(X,q.props);if(q.type!==Y8.Fragment)z.ref=Z?QZ(Z,Y):Y;return Y8.cloneElement(q,z)}return Y8.Children.count(q)>1?Y8.Children.only(null):null});return J.displayName=`${$}.SlotClone`,J}var Uu=Symbol("radix.slottable");function _u($){return Y8.isValidElement($)&&typeof $.type==="function"&&"__radixId"in $.type&&$.type.__radixId===Uu}function Lu($,J){let Q={...J};for(let Z in J){let q=$[Z],X=J[Z];if(/^on[A-Z]/.test(Z)){if(q&&X)Q[Z]=(...z)=>{let K=X(...z);return q(...z),K};else if(q)Q[Z]=q}else if(Z==="style")Q[Z]={...q,...X};else if(Z==="className")Q[Z]=[q,X].filter(Boolean).join(" ")}return{...$,...Q}}function Fu($){let J=Object.getOwnPropertyDescriptor($.props,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning;if(Q)return $.ref;if(J=Object.getOwnPropertyDescriptor($,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning,Q)return $.props.ref;return $.props.ref||$.ref}var Vu=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],QJ=Vu.reduce(($,J)=>{let Q=ZY(`Primitive.${J}`),Z=$O.forwardRef((q,X)=>{let{asChild:Y,...z}=q,K=Y?Q:J;if(typeof window<"u")window[Symbol.for("radix-ui")]=!0;return G(K,{...z,ref:X})});return Z.displayName=`Primitive.${J}`,{...$,[J]:Z}},{});function QO($,J){if($)JO.flushSync(()=>$.dispatchEvent(J))}var O8=R(v(),1);var d90=!!(typeof window<"u"&&window.document&&window.document.createElement);function w2($,J,{checkForDefaultPrevented:Q=!0}={}){return function(q){if($?.(q),Q===!1||!q.defaultPrevented)return J?.(q)}}var qO=R(v(),1);function ZO($,J){if(typeof $==="function")return $(J);else if($!==null&&$!==void 0)$.current=J}function z3(...$){return(J)=>{let Q=!1,Z=$.map((q)=>{let X=ZO(q,J);if(!Q&&typeof X=="function")Q=!0;return X});if(Q)return()=>{for(let q=0;q{let{scope:U,children:_,...L}=B,F=U?.[$]?.[K]||z,V=R4.useMemo(()=>L,Object.values(L));return G(F.Provider,{value:V,children:_})};W.displayName=X+"Provider";function H(B,U){let _=U?.[$]?.[K]||z,L=R4.useContext(_);if(L)return L;if(Y!==void 0)return Y;throw Error(`\`${B}\` must be used within \`${X}\``)}return[W,H]}let q=()=>{let X=Q.map((Y)=>{return R4.createContext(Y)});return function(z){let K=z?.[$]||X;return R4.useMemo(()=>({[`__scope${$}`]:{...z,[$]:K}}),[z,K])}};return q.scopeName=$,[Z,Mu(q,...J)]}function Mu(...$){let J=$[0];if($.length===1)return J;let Q=()=>{let Z=$.map((q)=>({useScope:q(),scopeName:q.scopeName}));return function(X){let Y=Z.reduce((z,{useScope:K,scopeName:W})=>{let B=K(X)[`__scope${W}`];return{...z,...B}},{});return R4.useMemo(()=>({[`__scope${J.scopeName}`]:Y}),[Y])}};return Q.scopeName=J.scopeName,Q}var KO=R(v(),1),ku=R($5(),1);var z8=R(v(),1);function zO($){let J=Du($),Q=z8.forwardRef((Z,q)=>{let{children:X,...Y}=Z,z=z8.Children.toArray(X),K=z.find(Ou);if(K){let W=K.props.children,H=z.map((B)=>{if(B===K){if(z8.Children.count(W)>1)return z8.Children.only(null);return z8.isValidElement(W)?W.props.children:null}else return B});return G(J,{...Y,ref:q,children:z8.isValidElement(W)?z8.cloneElement(W,void 0,H):null})}return G(J,{...Y,ref:q,children:X})});return Q.displayName=`${$}.Slot`,Q}function Du($){let J=z8.forwardRef((Q,Z)=>{let{children:q,...X}=Q;if(z8.isValidElement(q)){let Y=wu(q),z=Au(X,q.props);if(q.type!==z8.Fragment)z.ref=Z?z3(Z,Y):Y;return z8.cloneElement(q,z)}return z8.Children.count(q)>1?z8.Children.only(null):null});return J.displayName=`${$}.SlotClone`,J}var Nu=Symbol("radix.slottable");function Ou($){return z8.isValidElement($)&&typeof $.type==="function"&&"__radixId"in $.type&&$.type.__radixId===Nu}function Au($,J){let Q={...J};for(let Z in J){let q=$[Z],X=J[Z];if(/^on[A-Z]/.test(Z)){if(q&&X)Q[Z]=(...z)=>{let K=X(...z);return q(...z),K};else if(q)Q[Z]=q}else if(Z==="style")Q[Z]={...q,...X};else if(Z==="className")Q[Z]=[q,X].filter(Boolean).join(" ")}return{...$,...Q}}function wu($){let J=Object.getOwnPropertyDescriptor($.props,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning;if(Q)return $.ref;if(J=Object.getOwnPropertyDescriptor($,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning,Q)return $.props.ref;return $.props.ref||$.ref}var Iu=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],K3=Iu.reduce(($,J)=>{let Q=zO(`Primitive.${J}`),Z=KO.forwardRef((q,X)=>{let{asChild:Y,...z}=q,K=Y?Q:J;if(typeof window<"u")window[Symbol.for("radix-ui")]=!0;return G(K,{...z,ref:X})});return Z.displayName=`Primitive.${J}`,{...$,[J]:Z}},{});var i6=R(v(),1);var qY=R(v(),1);var Tu=i6[" useInsertionEffect ".trim().toString()]||L1;function GO({prop:$,defaultProp:J,onChange:Q=()=>{},caller:Z}){let[q,X,Y]=bu({defaultProp:J,onChange:Q}),z=$!==void 0,K=z?$:q;{let H=i6.useRef($!==void 0);i6.useEffect(()=>{let B=H.current;if(B!==z)console.warn(`${Z} is changing from ${B?"controlled":"uncontrolled"} to ${z?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`);H.current=z},[z,Z])}let W=i6.useCallback((H)=>{if(z){let B=ju(H)?H($):H;if(B!==$)Y.current?.(B)}else X(H)},[z,$,X,Y]);return[K,W]}function bu({defaultProp:$,onChange:J}){let[Q,Z]=i6.useState($),q=i6.useRef(Q),X=i6.useRef(J);return Tu(()=>{X.current=J},[J]),i6.useEffect(()=>{if(q.current!==Q)X.current?.(Q),q.current=Q},[Q,q]),[Q,Z,X]}function ju($){return typeof $==="function"}var J40=Symbol("RADIX:SYNC_STATE");var G3="rovingFocusGroup.onEntryFocus",Eu={bubbles:!1,cancelable:!0},ZZ="RovingFocusGroup",[W3,WO,yu]=K7(ZZ),[Pu,ZJ]=YO(ZZ,[yu]),[Ru,Cu]=Pu(ZZ),HO=O8.forwardRef(($,J)=>{return G(W3.Provider,{scope:$.__scopeRovingFocusGroup,children:G(W3.Slot,{scope:$.__scopeRovingFocusGroup,children:G(Su,{...$,ref:J})})})});HO.displayName=ZZ;var Su=O8.forwardRef(($,J)=>{let{__scopeRovingFocusGroup:Q,orientation:Z,loop:q=!1,dir:X,currentTabStopId:Y,defaultCurrentTabStopId:z,onCurrentTabStopIdChange:K,onEntryFocus:W,preventScrollOnEntryFocus:H=!1,...B}=$,U=O8.useRef(null),_=XO(J,U),L=d9(X),[F,V]=GO({prop:Y,defaultProp:z??null,onChange:K,caller:ZZ}),[M,D]=O8.useState(!1),N=c5(W),O=WO(Q),I=O8.useRef(!1),[k,T]=O8.useState(0);return O8.useEffect(()=>{let A=U.current;if(A)return A.addEventListener(G3,N),()=>A.removeEventListener(G3,N)},[N]),G(Ru,{scope:Q,orientation:Z,dir:L,loop:q,currentTabStopId:F,onItemFocus:O8.useCallback((A)=>V(A),[V]),onItemShiftTab:O8.useCallback(()=>D(!0),[]),onFocusableItemAdd:O8.useCallback(()=>T((A)=>A+1),[]),onFocusableItemRemove:O8.useCallback(()=>T((A)=>A-1),[]),children:G(K3.div,{tabIndex:M||k===0?-1:0,"data-orientation":Z,...B,ref:_,style:{outline:"none",...$.style},onMouseDown:w2($.onMouseDown,()=>{I.current=!0}),onFocus:w2($.onFocus,(A)=>{let w=!I.current;if(A.target===A.currentTarget&&w&&!M){let C=new CustomEvent(G3,Eu);if(A.currentTarget.dispatchEvent(C),!C.defaultPrevented){let y=O().filter((l)=>l.focusable),x=y.find((l)=>l.active),j=y.find((l)=>l.id===F),h=[x,j,...y].filter(Boolean).map((l)=>l.ref.current);_O(h,H)}}I.current=!1}),onBlur:w2($.onBlur,()=>D(!1))})})}),BO="RovingFocusGroupItem",UO=O8.forwardRef(($,J)=>{let{__scopeRovingFocusGroup:Q,focusable:Z=!0,active:q=!1,tabStopId:X,children:Y,...z}=$,K=a5(),W=X||K,H=Cu(BO,Q),B=H.currentTabStopId===W,U=WO(Q),{onFocusableItemAdd:_,onFocusableItemRemove:L,currentTabStopId:F}=H;return O8.useEffect(()=>{if(Z)return _(),()=>L()},[Z,_,L]),G(W3.ItemSlot,{scope:Q,id:W,focusable:Z,active:q,children:G(K3.span,{tabIndex:B?0:-1,"data-orientation":H.orientation,...z,ref:J,onMouseDown:w2($.onMouseDown,(V)=>{if(!Z)V.preventDefault();else H.onItemFocus(W)}),onFocus:w2($.onFocus,()=>H.onItemFocus(W)),onKeyDown:w2($.onKeyDown,(V)=>{if(V.key==="Tab"&&V.shiftKey){H.onItemShiftTab();return}if(V.target!==V.currentTarget)return;let M=fu(V,H.orientation,H.dir);if(M!==void 0){if(V.metaKey||V.ctrlKey||V.altKey||V.shiftKey)return;V.preventDefault();let N=U().filter((O)=>O.focusable).map((O)=>O.ref.current);if(M==="last")N.reverse();else if(M==="prev"||M==="next"){if(M==="prev")N.reverse();let O=N.indexOf(V.currentTarget);N=H.loop?vu(N,O+1):N.slice(O+1)}setTimeout(()=>_O(N))}}),children:typeof Y==="function"?Y({isCurrentTabStop:B,hasTabStop:F!=null}):Y})})});UO.displayName=BO;var hu={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function xu($,J){if(J!=="rtl")return $;return $==="ArrowLeft"?"ArrowRight":$==="ArrowRight"?"ArrowLeft":$}function fu($,J,Q){let Z=xu($.key,Q);if(J==="vertical"&&["ArrowLeft","ArrowRight"].includes(Z))return;if(J==="horizontal"&&["ArrowUp","ArrowDown"].includes(Z))return;return hu[Z]}function _O($,J=!1){let Q=document.activeElement;for(let Z of $){if(Z===Q)return;if(Z.focus({preventScroll:J}),document.activeElement!==Q)return}}function vu($,J){return $.map((Q,Z)=>$[(J+Z)%$.length])}var XY=HO,YY=UO;var H3=["Enter"," "],gu=["ArrowDown","PageUp","Home"],VO=["ArrowUp","PageDown","End"],uu=[...gu,...VO],mu={ltr:[...H3,"ArrowRight"],rtl:[...H3,"ArrowLeft"]},cu={ltr:["ArrowLeft"],rtl:["ArrowRight"]},zZ="Menu",[XZ,du,pu]=K7(zZ),[k2,B3]=tN(zZ,[pu,c6,ZJ]),KZ=c6(),MO=ZJ(),[DO,N7]=k2(zZ),[lu,GZ]=k2(zZ),NO=($)=>{let{__scopeMenu:J,open:Q=!1,children:Z,dir:q,onOpenChange:X,modal:Y=!0}=$,z=KZ(J),[K,W]=Y1.useState(null),H=Y1.useRef(!1),B=c5(X),U=d9(q);return Y1.useEffect(()=>{let _=()=>{H.current=!0,document.addEventListener("pointerdown",L,{capture:!0,once:!0}),document.addEventListener("pointermove",L,{capture:!0,once:!0})},L=()=>H.current=!1;return document.addEventListener("keydown",_,{capture:!0}),()=>{document.removeEventListener("keydown",_,{capture:!0}),document.removeEventListener("pointerdown",L,{capture:!0}),document.removeEventListener("pointermove",L,{capture:!0})}},[]),G(w4,{...z,children:G(DO,{scope:J,open:Q,onOpenChange:B,content:K,onContentChange:W,children:G(lu,{scope:J,onClose:Y1.useCallback(()=>B(!1),[B]),isUsingKeyboardRef:H,dir:U,modal:Y,children:Z})})})};NO.displayName=zZ;var iu="MenuAnchor",U3=Y1.forwardRef(($,J)=>{let{__scopeMenu:Q,...Z}=$,q=KZ(Q);return G(k4,{...q,...Z,ref:J})});U3.displayName=iu;var _3="MenuPortal",[ru,OO]=k2(_3,{forceMount:void 0}),AO=($)=>{let{__scopeMenu:J,forceMount:Q,children:Z,container:q}=$,X=N7(_3,J);return G(ru,{scope:J,forceMount:Q,children:G(JJ,{present:Q||X.open,children:G(k9,{asChild:!0,container:q,children:Z})})})};AO.displayName=_3;var r6="MenuContent",[su,L3]=k2(r6),wO=Y1.forwardRef(($,J)=>{let Q=OO(r6,$.__scopeMenu),{forceMount:Z=Q.forceMount,...q}=$,X=N7(r6,$.__scopeMenu),Y=GZ(r6,$.__scopeMenu);return G(XZ.Provider,{scope:$.__scopeMenu,children:G(JJ,{present:Z||X.open,children:G(XZ.Slot,{scope:$.__scopeMenu,children:Y.modal?G(ou,{...q,ref:J}):G(nu,{...q,ref:J})})})})}),ou=Y1.forwardRef(($,J)=>{let Q=N7(r6,$.__scopeMenu),Z=Y1.useRef(null),q=D7(J,Z);return Y1.useEffect(()=>{let X=Z.current;if(X)return L7(X)},[]),G(F3,{...$,ref:q,trapFocus:Q.open,disableOutsidePointerEvents:Q.open,disableOutsideScroll:!0,onFocusOutside:P5($.onFocusOutside,(X)=>X.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>Q.onOpenChange(!1)})}),nu=Y1.forwardRef(($,J)=>{let Q=N7(r6,$.__scopeMenu);return G(F3,{...$,ref:J,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>Q.onOpenChange(!1)})}),au=ZY("MenuContent.ScrollLock"),F3=Y1.forwardRef(($,J)=>{let{__scopeMenu:Q,loop:Z=!1,trapFocus:q,onOpenAutoFocus:X,onCloseAutoFocus:Y,disableOutsidePointerEvents:z,onEntryFocus:K,onEscapeKeyDown:W,onPointerDownOutside:H,onFocusOutside:B,onInteractOutside:U,onDismiss:_,disableOutsideScroll:L,...F}=$,V=N7(r6,Q),M=GZ(r6,Q),D=KZ(Q),N=MO(Q),O=du(Q),[I,k]=Y1.useState(null),T=Y1.useRef(null),A=D7(J,T,V.onContentChange),w=Y1.useRef(0),C=Y1.useRef(""),y=Y1.useRef(0),x=Y1.useRef(null),j=Y1.useRef("right"),P=Y1.useRef(0),h=L?I4:Y1.Fragment,l=L?{as:au,allowPinchZoom:!0}:void 0,t=(i)=>{let J0=C.current+i,K0=O().filter((c)=>!c.disabled),e=document.activeElement,H0=K0.find((c)=>c.ref.current===e)?.textValue,q0=K0.map((c)=>c.textValue),E=Gm(q0,J0,H0),d=K0.find((c)=>c.textValue===E)?.ref.current;if(function c(r){if(C.current=r,window.clearTimeout(w.current),r!=="")w.current=window.setTimeout(()=>c(""),1000)}(J0),d)setTimeout(()=>d.focus())};Y1.useEffect(()=>{return()=>window.clearTimeout(w.current)},[]),G7();let S=Y1.useCallback((i)=>{return j.current===x.current?.side&&Hm(i,x.current?.area)},[]);return G(su,{scope:Q,searchRef:C,onItemEnter:Y1.useCallback((i)=>{if(S(i))i.preventDefault()},[S]),onItemLeave:Y1.useCallback((i)=>{if(S(i))return;T.current?.focus(),k(null)},[S]),onTriggerLeave:Y1.useCallback((i)=>{if(S(i))i.preventDefault()},[S]),pointerGraceTimerRef:y,onPointerGraceIntentChange:Y1.useCallback((i)=>{x.current=i},[]),children:G(h,{...l,children:G(O4,{asChild:!0,trapped:q,onMountAutoFocus:P5(X,(i)=>{i.preventDefault(),T.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:Y,children:G(O9,{asChild:!0,disableOutsidePointerEvents:z,onEscapeKeyDown:W,onPointerDownOutside:H,onFocusOutside:B,onInteractOutside:U,onDismiss:_,children:G(XY,{asChild:!0,...N,dir:M.dir,orientation:"vertical",loop:Z,currentTabStopId:I,onCurrentTabStopIdChange:k,onEntryFocus:P5(K,(i)=>{if(!M.isUsingKeyboardRef.current)i.preventDefault()}),preventScrollOnEntryFocus:!0,children:G(U7,{role:"menu","aria-orientation":"vertical","data-state":uO(V.open),"data-radix-menu-content":"",dir:M.dir,...D,...F,ref:A,style:{outline:"none",...F.style},onKeyDown:P5(F.onKeyDown,(i)=>{let K0=i.target.closest("[data-radix-menu-content]")===i.currentTarget,e=i.ctrlKey||i.altKey||i.metaKey,H0=i.key.length===1;if(K0){if(i.key==="Tab")i.preventDefault();if(!e&&H0)t(i.key)}let q0=T.current;if(i.target!==q0)return;if(!uu.includes(i.key))return;i.preventDefault();let d=O().filter((c)=>!c.disabled).map((c)=>c.ref.current);if(VO.includes(i.key))d.reverse();zm(d)}),onBlur:P5($.onBlur,(i)=>{if(!i.currentTarget.contains(i.target))window.clearTimeout(w.current),C.current=""}),onPointerMove:P5($.onPointerMove,YZ((i)=>{let J0=i.target,K0=P.current!==i.clientX;if(i.currentTarget.contains(J0)&&K0){let e=i.clientX>P.current?"right":"left";j.current=e,P.current=i.clientX}}))})})})})})})});wO.displayName=r6;var tu="MenuGroup",V3=Y1.forwardRef(($,J)=>{let{__scopeMenu:Q,...Z}=$;return G(QJ.div,{role:"group",...Z,ref:J})});V3.displayName=tu;var eu="MenuLabel",kO=Y1.forwardRef(($,J)=>{let{__scopeMenu:Q,...Z}=$;return G(QJ.div,{...Z,ref:J})});kO.displayName=eu;var zY="MenuItem",FO="menu.itemSelect",GY=Y1.forwardRef(($,J)=>{let{disabled:Q=!1,onSelect:Z,...q}=$,X=Y1.useRef(null),Y=GZ(zY,$.__scopeMenu),z=L3(zY,$.__scopeMenu),K=D7(J,X),W=Y1.useRef(!1),H=()=>{let B=X.current;if(!Q&&B){let U=new CustomEvent(FO,{bubbles:!0,cancelable:!0});if(B.addEventListener(FO,(_)=>Z?.(_),{once:!0}),QO(B,U),U.defaultPrevented)W.current=!1;else Y.onClose()}};return G(IO,{...q,ref:K,disabled:Q,onClick:P5($.onClick,H),onPointerDown:(B)=>{$.onPointerDown?.(B),W.current=!0},onPointerUp:P5($.onPointerUp,(B)=>{if(!W.current)B.currentTarget?.click()}),onKeyDown:P5($.onKeyDown,(B)=>{let U=z.searchRef.current!=="";if(Q||U&&B.key===" ")return;if(H3.includes(B.key))B.currentTarget.click(),B.preventDefault()})})});GY.displayName=zY;var IO=Y1.forwardRef(($,J)=>{let{__scopeMenu:Q,disabled:Z=!1,textValue:q,...X}=$,Y=L3(zY,Q),z=MO(Q),K=Y1.useRef(null),W=D7(J,K),[H,B]=Y1.useState(!1),[U,_]=Y1.useState("");return Y1.useEffect(()=>{let L=K.current;if(L)_((L.textContent??"").trim())},[X.children]),G(XZ.ItemSlot,{scope:Q,disabled:Z,textValue:q??U,children:G(YY,{asChild:!0,...z,focusable:!Z,children:G(QJ.div,{role:"menuitem","data-highlighted":H?"":void 0,"aria-disabled":Z||void 0,"data-disabled":Z?"":void 0,...X,ref:W,onPointerMove:P5($.onPointerMove,YZ((L)=>{if(Z)Y.onItemLeave(L);else if(Y.onItemEnter(L),!L.defaultPrevented)L.currentTarget.focus({preventScroll:!0})})),onPointerLeave:P5($.onPointerLeave,YZ((L)=>Y.onItemLeave(L))),onFocus:P5($.onFocus,()=>B(!0)),onBlur:P5($.onBlur,()=>B(!1))})})})}),$m="MenuCheckboxItem",TO=Y1.forwardRef(($,J)=>{let{checked:Q=!1,onCheckedChange:Z,...q}=$;return G(PO,{scope:$.__scopeMenu,checked:Q,children:G(GY,{role:"menuitemcheckbox","aria-checked":KY(Q)?"mixed":Q,...q,ref:J,"data-state":N3(Q),onSelect:P5(q.onSelect,()=>Z?.(KY(Q)?!0:!Q),{checkForDefaultPrevented:!1})})})});TO.displayName=$m;var bO="MenuRadioGroup",[Jm,Qm]=k2(bO,{value:void 0,onValueChange:()=>{}}),jO=Y1.forwardRef(($,J)=>{let{value:Q,onValueChange:Z,...q}=$,X=c5(Z);return G(Jm,{scope:$.__scopeMenu,value:Q,onValueChange:X,children:G(V3,{...q,ref:J})})});jO.displayName=bO;var EO="MenuRadioItem",yO=Y1.forwardRef(($,J)=>{let{value:Q,...Z}=$,q=Qm(EO,$.__scopeMenu),X=Q===q.value;return G(PO,{scope:$.__scopeMenu,checked:X,children:G(GY,{role:"menuitemradio","aria-checked":X,...Z,ref:J,"data-state":N3(X),onSelect:P5(Z.onSelect,()=>q.onValueChange?.(Q),{checkForDefaultPrevented:!1})})})});yO.displayName=EO;var M3="MenuItemIndicator",[PO,Zm]=k2(M3,{checked:!1}),RO=Y1.forwardRef(($,J)=>{let{__scopeMenu:Q,forceMount:Z,...q}=$,X=Zm(M3,Q);return G(JJ,{present:Z||KY(X.checked)||X.checked===!0,children:G(QJ.span,{...q,ref:J,"data-state":N3(X.checked)})})});RO.displayName=M3;var qm="MenuSeparator",CO=Y1.forwardRef(($,J)=>{let{__scopeMenu:Q,...Z}=$;return G(QJ.div,{role:"separator","aria-orientation":"horizontal",...Z,ref:J})});CO.displayName=qm;var Xm="MenuArrow",SO=Y1.forwardRef(($,J)=>{let{__scopeMenu:Q,...Z}=$,q=KZ(Q);return G(_7,{...q,...Z,ref:J})});SO.displayName=Xm;var D3="MenuSub",[Ym,hO]=k2(D3),xO=($)=>{let{__scopeMenu:J,children:Q,open:Z=!1,onOpenChange:q}=$,X=N7(D3,J),Y=KZ(J),[z,K]=Y1.useState(null),[W,H]=Y1.useState(null),B=c5(q);return Y1.useEffect(()=>{if(X.open===!1)B(!1);return()=>B(!1)},[X.open,B]),G(w4,{...Y,children:G(DO,{scope:J,open:Z,onOpenChange:B,content:W,onContentChange:H,children:G(Ym,{scope:J,contentId:a5(),triggerId:a5(),trigger:z,onTriggerChange:K,children:Q})})})};xO.displayName=D3;var qZ="MenuSubTrigger",fO=Y1.forwardRef(($,J)=>{let Q=N7(qZ,$.__scopeMenu),Z=GZ(qZ,$.__scopeMenu),q=hO(qZ,$.__scopeMenu),X=L3(qZ,$.__scopeMenu),Y=Y1.useRef(null),{pointerGraceTimerRef:z,onPointerGraceIntentChange:K}=X,W={__scopeMenu:$.__scopeMenu},H=Y1.useCallback(()=>{if(Y.current)window.clearTimeout(Y.current);Y.current=null},[]);return Y1.useEffect(()=>H,[H]),Y1.useEffect(()=>{let B=z.current;return()=>{window.clearTimeout(B),K(null)}},[z,K]),G(U3,{asChild:!0,...W,children:G(IO,{id:q.triggerId,"aria-haspopup":"menu","aria-expanded":Q.open,"aria-controls":q.contentId,"data-state":uO(Q.open),...$,ref:QZ(J,q.onTriggerChange),onClick:(B)=>{if($.onClick?.(B),$.disabled||B.defaultPrevented)return;if(B.currentTarget.focus(),!Q.open)Q.onOpenChange(!0)},onPointerMove:P5($.onPointerMove,YZ((B)=>{if(X.onItemEnter(B),B.defaultPrevented)return;if(!$.disabled&&!Q.open&&!Y.current)X.onPointerGraceIntentChange(null),Y.current=window.setTimeout(()=>{Q.onOpenChange(!0),H()},100)})),onPointerLeave:P5($.onPointerLeave,YZ((B)=>{H();let U=Q.content?.getBoundingClientRect();if(U){let _=Q.content?.dataset.side,L=_==="right",F=L?-5:5,V=U[L?"left":"right"],M=U[L?"right":"left"];X.onPointerGraceIntentChange({area:[{x:B.clientX+F,y:B.clientY},{x:V,y:U.top},{x:M,y:U.top},{x:M,y:U.bottom},{x:V,y:U.bottom}],side:_}),window.clearTimeout(z.current),z.current=window.setTimeout(()=>X.onPointerGraceIntentChange(null),300)}else{if(X.onTriggerLeave(B),B.defaultPrevented)return;X.onPointerGraceIntentChange(null)}})),onKeyDown:P5($.onKeyDown,(B)=>{let U=X.searchRef.current!=="";if($.disabled||U&&B.key===" ")return;if(mu[Z.dir].includes(B.key))Q.onOpenChange(!0),Q.content?.focus(),B.preventDefault()})})})});fO.displayName=qZ;var vO="MenuSubContent",gO=Y1.forwardRef(($,J)=>{let Q=OO(r6,$.__scopeMenu),{forceMount:Z=Q.forceMount,...q}=$,X=N7(r6,$.__scopeMenu),Y=GZ(r6,$.__scopeMenu),z=hO(vO,$.__scopeMenu),K=Y1.useRef(null),W=D7(J,K);return G(XZ.Provider,{scope:$.__scopeMenu,children:G(JJ,{present:Z||X.open,children:G(XZ.Slot,{scope:$.__scopeMenu,children:G(F3,{id:z.contentId,"aria-labelledby":z.triggerId,...q,ref:W,align:"start",side:Y.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:(H)=>{if(Y.isUsingKeyboardRef.current)K.current?.focus();H.preventDefault()},onCloseAutoFocus:(H)=>H.preventDefault(),onFocusOutside:P5($.onFocusOutside,(H)=>{if(H.target!==z.trigger)X.onOpenChange(!1)}),onEscapeKeyDown:P5($.onEscapeKeyDown,(H)=>{Y.onClose(),H.preventDefault()}),onKeyDown:P5($.onKeyDown,(H)=>{let B=H.currentTarget.contains(H.target),U=cu[Y.dir].includes(H.key);if(B&&U)X.onOpenChange(!1),z.trigger?.focus(),H.preventDefault()})})})})})});gO.displayName=vO;function uO($){return $?"open":"closed"}function KY($){return $==="indeterminate"}function N3($){return KY($)?"indeterminate":$?"checked":"unchecked"}function zm($){let J=document.activeElement;for(let Q of $){if(Q===J)return;if(Q.focus(),document.activeElement!==J)return}}function Km($,J){return $.map((Q,Z)=>$[(J+Z)%$.length])}function Gm($,J,Q){let q=J.length>1&&Array.from(J).every((W)=>W===J[0])?J[0]:J,X=Q?$.indexOf(Q):-1,Y=Km($,Math.max(X,0));if(q.length===1)Y=Y.filter((W)=>W!==Q);let K=Y.find((W)=>W.toLowerCase().startsWith(q.toLowerCase()));return K!==Q?K:void 0}function Wm($,J){let{x:Q,y:Z}=$,q=!1;for(let X=0,Y=J.length-1;XZ!==U>Z&&Q<(B-W)*(Z-H)/(U-H)+W)q=!q}return q}function Hm($,J){if(!J)return!1;let Q={x:$.clientX,y:$.clientY};return Wm(Q,J)}function YZ($){return(J)=>J.pointerType==="mouse"?$(J):void 0}var mO=NO,cO=U3,dO=AO,pO=wO,lO=V3,iO=kO,rO=GY,sO=TO,oO=jO,nO=yO,aO=RO,tO=CO,eO=SO,$A=xO,JA=fO,QA=gO;var s6=R(v(),1);var WY=R(v(),1);var Um=s6[" useInsertionEffect ".trim().toString()]||L1;function ZA({prop:$,defaultProp:J,onChange:Q=()=>{},caller:Z}){let[q,X,Y]=_m({defaultProp:J,onChange:Q}),z=$!==void 0,K=z?$:q;{let H=s6.useRef($!==void 0);s6.useEffect(()=>{let B=H.current;if(B!==z)console.warn(`${Z} is changing from ${B?"controlled":"uncontrolled"} to ${z?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`);H.current=z},[z,Z])}let W=s6.useCallback((H)=>{if(z){let B=Lm(H)?H($):H;if(B!==$)Y.current?.(B)}else X(H)},[z,$,X,Y]);return[K,W]}function _m({defaultProp:$,onChange:J}){let[Q,Z]=s6.useState($),q=s6.useRef(Q),X=s6.useRef(J);return Um(()=>{X.current=J},[J]),s6.useEffect(()=>{if(q.current!==Q)X.current?.(Q),q.current=Q},[Q,q]),[Q,Z,X]}function Lm($){return typeof $==="function"}var C40=Symbol("RADIX:SYNC_STATE");var O3="ContextMenu",[Fm,c40]=pN(O3,[B3]),g8=B3(),[Vm,qA]=Fm(O3),XA=($)=>{let{__scopeContextMenu:J,children:Q,onOpenChange:Z,dir:q,modal:X=!0}=$,[Y,z]=H5.useState(!1),K=g8(J),W=c5(Z),H=H5.useCallback((B)=>{z(B),W(B)},[W]);return G(Vm,{scope:J,open:Y,onOpenChange:H,modal:X,children:G(mO,{...K,dir:q,open:Y,onOpenChange:H,modal:X,children:Q})})};XA.displayName=O3;var YA="ContextMenuTrigger",zA=H5.forwardRef(($,J)=>{let{__scopeContextMenu:Q,disabled:Z=!1,...q}=$,X=qA(YA,Q),Y=g8(Q),z=H5.useRef({x:0,y:0}),K=H5.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...z.current})}),W=H5.useRef(0),H=H5.useCallback(()=>window.clearTimeout(W.current),[]),B=(U)=>{z.current={x:U.clientX,y:U.clientY},X.onOpenChange(!0)};return H5.useEffect(()=>H,[H]),H5.useEffect(()=>void(Z&&H()),[Z,H]),b(W1,{children:[G(cO,{...Y,virtualRef:K}),G(oN.span,{"data-state":X.open?"open":"closed","data-disabled":Z?"":void 0,...q,ref:J,style:{WebkitTouchCallout:"none",...$.style},onContextMenu:Z?$.onContextMenu:$J($.onContextMenu,(U)=>{H(),B(U),U.preventDefault()}),onPointerDown:Z?$.onPointerDown:$J($.onPointerDown,HY((U)=>{H(),W.current=window.setTimeout(()=>B(U),700)})),onPointerMove:Z?$.onPointerMove:$J($.onPointerMove,HY(H)),onPointerCancel:Z?$.onPointerCancel:$J($.onPointerCancel,HY(H)),onPointerUp:Z?$.onPointerUp:$J($.onPointerUp,HY(H))})]})});zA.displayName=YA;var Mm="ContextMenuPortal",KA=($)=>{let{__scopeContextMenu:J,...Q}=$,Z=g8(J);return G(dO,{...Z,...Q})};KA.displayName=Mm;var GA="ContextMenuContent",WA=H5.forwardRef(($,J)=>{let{__scopeContextMenu:Q,...Z}=$,q=qA(GA,Q),X=g8(Q),Y=H5.useRef(!1);return G(pO,{...X,...Z,ref:J,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:(z)=>{if($.onCloseAutoFocus?.(z),!z.defaultPrevented&&Y.current)z.preventDefault();Y.current=!1},onInteractOutside:(z)=>{if($.onInteractOutside?.(z),!z.defaultPrevented&&!q.modal)Y.current=!0},style:{...$.style,...{"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}}})});WA.displayName=GA;var Dm="ContextMenuGroup",Nm=H5.forwardRef(($,J)=>{let{__scopeContextMenu:Q,...Z}=$,q=g8(Q);return G(lO,{...q,...Z,ref:J})});Nm.displayName=Dm;var Om="ContextMenuLabel",HA=H5.forwardRef(($,J)=>{let{__scopeContextMenu:Q,...Z}=$,q=g8(Q);return G(iO,{...q,...Z,ref:J})});HA.displayName=Om;var Am="ContextMenuItem",BA=H5.forwardRef(($,J)=>{let{__scopeContextMenu:Q,...Z}=$,q=g8(Q);return G(rO,{...q,...Z,ref:J})});BA.displayName=Am;var wm="ContextMenuCheckboxItem",UA=H5.forwardRef(($,J)=>{let{__scopeContextMenu:Q,...Z}=$,q=g8(Q);return G(sO,{...q,...Z,ref:J})});UA.displayName=wm;var km="ContextMenuRadioGroup",Im=H5.forwardRef(($,J)=>{let{__scopeContextMenu:Q,...Z}=$,q=g8(Q);return G(oO,{...q,...Z,ref:J})});Im.displayName=km;var Tm="ContextMenuRadioItem",_A=H5.forwardRef(($,J)=>{let{__scopeContextMenu:Q,...Z}=$,q=g8(Q);return G(nO,{...q,...Z,ref:J})});_A.displayName=Tm;var bm="ContextMenuItemIndicator",LA=H5.forwardRef(($,J)=>{let{__scopeContextMenu:Q,...Z}=$,q=g8(Q);return G(aO,{...q,...Z,ref:J})});LA.displayName=bm;var jm="ContextMenuSeparator",FA=H5.forwardRef(($,J)=>{let{__scopeContextMenu:Q,...Z}=$,q=g8(Q);return G(tO,{...q,...Z,ref:J})});FA.displayName=jm;var Em="ContextMenuArrow",ym=H5.forwardRef(($,J)=>{let{__scopeContextMenu:Q,...Z}=$,q=g8(Q);return G(eO,{...q,...Z,ref:J})});ym.displayName=Em;var VA="ContextMenuSub",MA=($)=>{let{__scopeContextMenu:J,children:Q,onOpenChange:Z,open:q,defaultOpen:X}=$,Y=g8(J),[z,K]=ZA({prop:q,defaultProp:X??!1,onChange:Z,caller:VA});return G($A,{...Y,open:z,onOpenChange:K,children:Q})};MA.displayName=VA;var Pm="ContextMenuSubTrigger",DA=H5.forwardRef(($,J)=>{let{__scopeContextMenu:Q,...Z}=$,q=g8(Q);return G(JA,{...q,...Z,ref:J})});DA.displayName=Pm;var Rm="ContextMenuSubContent",NA=H5.forwardRef(($,J)=>{let{__scopeContextMenu:Q,...Z}=$,q=g8(Q);return G(QA,{...q,...Z,ref:J,style:{...$.style,...{"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}}})});NA.displayName=Rm;function HY($){return(J)=>J.pointerType!=="mouse"?$(J):void 0}var OA=XA,AA=zA,wA=KA,A3=WA;var w3=HA,k3=BA,I3=UA;var T3=_A,b3=LA,j3=FA;var kA=MA,E3=DA,y3=NA;var o6=OA,n6=AA;var TA=kA;var P3=C4.forwardRef(({className:$,inset:J,children:Q,...Z},q)=>b(E3,{ref:q,className:b0("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm text-popover-foreground outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",J&&"pl-8",$),...Z,children:[Q,G(BY,{className:"ml-auto h-4 w-4"})]}));P3.displayName=E3.displayName;var R3=C4.forwardRef(({className:$,...J},Q)=>G(y3,{ref:Q,className:b0("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-context-menu-content-transform-origin]",$),...J}));R3.displayName=y3.displayName;var E6=C4.forwardRef(({className:$,...J},Q)=>G(wA,{children:b("div",{className:`${M8}`,children:[G("div",{"aria-hidden":"true","data-easy-media-context-menu-backdrop":"",className:"fixed inset-0 z-[9997]"}),G(A3,{ref:Q,className:b0("z-[9999] max-h-[--radix-context-menu-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-context-menu-content-transform-origin]",$),...J})]})}));E6.displayName=A3.displayName;var J5=C4.forwardRef(({className:$,inset:J,...Q},Z)=>G(k3,{ref:Z,className:b0("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",J&&"pl-8",$),...Q}));J5.displayName=k3.displayName;var Sm=C4.forwardRef(({className:$,children:J,checked:Q,...Z},q)=>b(I3,{ref:q,className:b0("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",$),checked:Q,...Z,children:[G("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:G(b3,{children:G(T9,{className:"h-4 w-4"})})}),J]}));Sm.displayName=I3.displayName;var hm=C4.forwardRef(({className:$,children:J,...Q},Z)=>b(T3,{ref:Z,className:b0("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",$),...Q,children:[G("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:G(b3,{children:G(IA,{className:"h-4 w-4 fill-current"})})}),J]}));hm.displayName=T3.displayName;var xm=C4.forwardRef(({className:$,inset:J,...Q},Z)=>G(w3,{ref:Z,className:b0("px-2 py-1.5 text-sm font-semibold text-foreground",J&&"pl-8",$),...Q}));xm.displayName=w3.displayName;var C3=C4.forwardRef(({className:$,...J},Q)=>G(j3,{ref:Q,className:b0("-mx-1 my-1 h-px bg-border",$),...J}));C3.displayName=j3.displayName;var fm=({className:$,...J})=>{return G("span",{className:b0("ml-auto text-xs tracking-widest text-muted-foreground",$),...J})};fm.displayName="ContextMenuShortcut";var sA=R(v(),1);var D5=R(v(),1);var n40=!!(typeof window<"u"&&window.document&&window.document.createElement);function qJ($,J,{checkForDefaultPrevented:Q=!0}={}){return function(q){if($?.(q),Q===!1||!q.defaultPrevented)return J?.(q)}}var jA=R(v(),1);function bA($,J){if(typeof $==="function")return $(J);else if($!==null&&$!==void 0)$.current=J}function S3(...$){return(J)=>{let Q=!1,Z=$.map((q)=>{let X=bA(q,J);if(!Q&&typeof X=="function")Q=!0;return X});if(Q)return()=>{for(let q=0;q{let{scope:U,children:_,...L}=B,F=U?.[$]?.[K]||z,V=S4.useMemo(()=>L,Object.values(L));return G(F.Provider,{value:V,children:_})};W.displayName=X+"Provider";function H(B,U){let _=U?.[$]?.[K]||z,L=S4.useContext(_);if(L)return L;if(Y!==void 0)return Y;throw Error(`\`${B}\` must be used within \`${X}\``)}return[W,H]}let q=()=>{let X=Q.map((Y)=>{return S4.createContext(Y)});return function(z){let K=z?.[$]||X;return S4.useMemo(()=>({[`__scope${$}`]:{...z,[$]:K}}),[z,K])}};return q.scopeName=$,[Z,vm(q,...J)]}function vm(...$){let J=$[0];if($.length===1)return J;let Q=()=>{let Z=$.map((q)=>({useScope:q(),scopeName:q.scopeName}));return function(X){let Y=Z.reduce((z,{useScope:K,scopeName:W})=>{let B=K(X)[`__scope${W}`];return{...z,...B}},{});return S4.useMemo(()=>({[`__scope${J.scopeName}`]:Y}),[Y])}};return Q.scopeName=J.scopeName,Q}var U6=R(v(),1);var yA=R(v(),1);function gm($,J){return yA.useReducer((Q,Z)=>{return J[Q][Z]??Q},$)}var _Y=($)=>{let{present:J,children:Q}=$,Z=um(J),q=typeof Q==="function"?Q({present:Z.isPresent}):U6.Children.only(Q),X=WZ(Z.ref,mm(q));return typeof Q==="function"||Z.isPresent?U6.cloneElement(q,{ref:X}):null};_Y.displayName="Presence";function um($){let[J,Q]=U6.useState(),Z=U6.useRef(null),q=U6.useRef($),X=U6.useRef("none"),Y=$?"mounted":"unmounted",[z,K]=gm(Y,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return U6.useEffect(()=>{let W=UY(Z.current);X.current=z==="mounted"?W:"none"},[z]),L1(()=>{let W=Z.current,H=q.current;if(H!==$){let U=X.current,_=UY(W);if($)K("MOUNT");else if(_==="none"||W?.display==="none")K("UNMOUNT");else if(H&&U!==_)K("ANIMATION_OUT");else K("UNMOUNT");q.current=$}},[$,K]),L1(()=>{if(J){let W,H=J.ownerDocument.defaultView??window,B=(_)=>{let F=UY(Z.current).includes(CSS.escape(_.animationName));if(_.target===J&&F){if(K("ANIMATION_END"),!q.current){let V=J.style.animationFillMode;J.style.animationFillMode="forwards",W=H.setTimeout(()=>{if(J.style.animationFillMode==="forwards")J.style.animationFillMode=V})}}},U=(_)=>{if(_.target===J)X.current=UY(Z.current)};return J.addEventListener("animationstart",U),J.addEventListener("animationcancel",B),J.addEventListener("animationend",B),()=>{H.clearTimeout(W),J.removeEventListener("animationstart",U),J.removeEventListener("animationcancel",B),J.removeEventListener("animationend",B)}}else K("ANIMATION_END")},[J,K]),{isPresent:["mounted","unmountSuspended"].includes(z),ref:U6.useCallback((W)=>{Z.current=W?getComputedStyle(W):null,Q(W)},[])}}function UY($){return $?.animationName||"none"}function mm($){let J=Object.getOwnPropertyDescriptor($.props,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning;if(Q)return $.ref;if(J=Object.getOwnPropertyDescriptor($,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning,Q)return $.props.ref;return $.props.ref||$.ref}var PA=R(v(),1),rm=R($5(),1);var K8=R(v(),1);function LY($){let J=cm($),Q=K8.forwardRef((Z,q)=>{let{children:X,...Y}=Z,z=K8.Children.toArray(X),K=z.find(pm);if(K){let W=K.props.children,H=z.map((B)=>{if(B===K){if(K8.Children.count(W)>1)return K8.Children.only(null);return K8.isValidElement(W)?W.props.children:null}else return B});return G(J,{...Y,ref:q,children:K8.isValidElement(W)?K8.cloneElement(W,void 0,H):null})}return G(J,{...Y,ref:q,children:X})});return Q.displayName=`${$}.Slot`,Q}function cm($){let J=K8.forwardRef((Q,Z)=>{let{children:q,...X}=Q;if(K8.isValidElement(q)){let Y=im(q),z=lm(X,q.props);if(q.type!==K8.Fragment)z.ref=Z?S3(Z,Y):Y;return K8.cloneElement(q,z)}return K8.Children.count(q)>1?K8.Children.only(null):null});return J.displayName=`${$}.SlotClone`,J}var dm=Symbol("radix.slottable");function pm($){return K8.isValidElement($)&&typeof $.type==="function"&&"__radixId"in $.type&&$.type.__radixId===dm}function lm($,J){let Q={...J};for(let Z in J){let q=$[Z],X=J[Z];if(/^on[A-Z]/.test(Z)){if(q&&X)Q[Z]=(...z)=>{let K=X(...z);return q(...z),K};else if(q)Q[Z]=q}else if(Z==="style")Q[Z]={...q,...X};else if(Z==="className")Q[Z]=[q,X].filter(Boolean).join(" ")}return{...$,...Q}}function im($){let J=Object.getOwnPropertyDescriptor($.props,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning;if(Q)return $.ref;if(J=Object.getOwnPropertyDescriptor($,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning,Q)return $.props.ref;return $.props.ref||$.ref}var sm=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],h3=sm.reduce(($,J)=>{let Q=LY(`Primitive.${J}`),Z=PA.forwardRef((q,X)=>{let{asChild:Y,...z}=q,K=Y?Q:J;if(typeof window<"u")window[Symbol.for("radix-ui")]=!0;return G(K,{...z,ref:X})});return Z.displayName=`Primitive.${J}`,{...$,[J]:Z}},{});var a6=R(v(),1);var FY=R(v(),1);var om=a6[" useInsertionEffect ".trim().toString()]||L1;function RA({prop:$,defaultProp:J,onChange:Q=()=>{},caller:Z}){let[q,X,Y]=nm({defaultProp:J,onChange:Q}),z=$!==void 0,K=z?$:q;{let H=a6.useRef($!==void 0);a6.useEffect(()=>{let B=H.current;if(B!==z)console.warn(`${Z} is changing from ${B?"controlled":"uncontrolled"} to ${z?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`);H.current=z},[z,Z])}let W=a6.useCallback((H)=>{if(z){let B=am(H)?H($):H;if(B!==$)Y.current?.(B)}else X(H)},[z,$,X,Y]);return[K,W]}function nm({defaultProp:$,onChange:J}){let[Q,Z]=a6.useState($),q=a6.useRef(Q),X=a6.useRef(J);return om(()=>{X.current=J},[J]),a6.useEffect(()=>{if(q.current!==Q)X.current?.(Q),q.current=Q},[Q,q]),[Q,Z,X]}function am($){return typeof $==="function"}var H70=Symbol("RADIX:SYNC_STATE");var VY="Popover",[CA,E70]=EA(VY,[c6]),HZ=c6(),[tm,O7]=CA(VY),SA=($)=>{let{__scopePopover:J,children:Q,open:Z,defaultOpen:q,onOpenChange:X,modal:Y=!1}=$,z=HZ(J),K=D5.useRef(null),[W,H]=D5.useState(!1),[B,U]=RA({prop:Z,defaultProp:q??!1,onChange:X,caller:VY});return G(w4,{...z,children:G(tm,{scope:J,contentId:a5(),triggerRef:K,open:B,onOpenChange:U,onOpenToggle:D5.useCallback(()=>U((_)=>!_),[U]),hasCustomAnchor:W,onCustomAnchorAdd:D5.useCallback(()=>H(!0),[]),onCustomAnchorRemove:D5.useCallback(()=>H(!1),[]),modal:Y,children:Q})})};SA.displayName=VY;var hA="PopoverAnchor",xA=D5.forwardRef(($,J)=>{let{__scopePopover:Q,...Z}=$,q=O7(hA,Q),X=HZ(Q),{onCustomAnchorAdd:Y,onCustomAnchorRemove:z}=q;return D5.useEffect(()=>{return Y(),()=>z()},[Y,z]),G(k4,{...X,...Z,ref:J})});xA.displayName=hA;var fA="PopoverTrigger",vA=D5.forwardRef(($,J)=>{let{__scopePopover:Q,...Z}=$,q=O7(fA,Q),X=HZ(Q),Y=WZ(J,q.triggerRef),z=G(h3.button,{type:"button","aria-haspopup":"dialog","aria-expanded":q.open,"aria-controls":q.contentId,"data-state":dA(q.open),...Z,ref:Y,onClick:qJ($.onClick,q.onOpenToggle)});return q.hasCustomAnchor?z:G(k4,{asChild:!0,...X,children:z})});vA.displayName=fA;var x3="PopoverPortal",[em,$c]=CA(x3,{forceMount:void 0}),gA=($)=>{let{__scopePopover:J,forceMount:Q,children:Z,container:q}=$,X=O7(x3,J);return G(em,{scope:J,forceMount:Q,children:G(_Y,{present:Q||X.open,children:G(k9,{asChild:!0,container:q,children:Z})})})};gA.displayName=x3;var XJ="PopoverContent",uA=D5.forwardRef(($,J)=>{let Q=$c(XJ,$.__scopePopover),{forceMount:Z=Q.forceMount,...q}=$,X=O7(XJ,$.__scopePopover);return G(_Y,{present:Z||X.open,children:X.modal?G(Qc,{...q,ref:J}):G(Zc,{...q,ref:J})})});uA.displayName=XJ;var Jc=LY("PopoverContent.RemoveScroll"),Qc=D5.forwardRef(($,J)=>{let Q=O7(XJ,$.__scopePopover),Z=D5.useRef(null),q=WZ(J,Z),X=D5.useRef(!1);return D5.useEffect(()=>{let Y=Z.current;if(Y)return L7(Y)},[]),G(I4,{as:Jc,allowPinchZoom:!0,children:G(mA,{...$,ref:q,trapFocus:Q.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:qJ($.onCloseAutoFocus,(Y)=>{if(Y.preventDefault(),!X.current)Q.triggerRef.current?.focus()}),onPointerDownOutside:qJ($.onPointerDownOutside,(Y)=>{let z=Y.detail.originalEvent,K=z.button===0&&z.ctrlKey===!0,W=z.button===2||K;X.current=W},{checkForDefaultPrevented:!1}),onFocusOutside:qJ($.onFocusOutside,(Y)=>Y.preventDefault(),{checkForDefaultPrevented:!1})})})}),Zc=D5.forwardRef(($,J)=>{let Q=O7(XJ,$.__scopePopover),Z=D5.useRef(!1),q=D5.useRef(!1);return G(mA,{...$,ref:J,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:(X)=>{if($.onCloseAutoFocus?.(X),!X.defaultPrevented){if(!Z.current)Q.triggerRef.current?.focus();X.preventDefault()}Z.current=!1,q.current=!1},onInteractOutside:(X)=>{if($.onInteractOutside?.(X),!X.defaultPrevented){if(Z.current=!0,X.detail.originalEvent.type==="pointerdown")q.current=!0}let Y=X.target;if(Q.triggerRef.current?.contains(Y))X.preventDefault();if(X.detail.originalEvent.type==="focusin"&&q.current)X.preventDefault()}})}),mA=D5.forwardRef(($,J)=>{let{__scopePopover:Q,trapFocus:Z,onOpenAutoFocus:q,onCloseAutoFocus:X,disableOutsidePointerEvents:Y,onEscapeKeyDown:z,onPointerDownOutside:K,onFocusOutside:W,onInteractOutside:H,...B}=$,U=O7(XJ,Q),_=HZ(Q);return G7(),G(O4,{asChild:!0,loop:!0,trapped:Z,onMountAutoFocus:q,onUnmountAutoFocus:X,children:G(O9,{asChild:!0,disableOutsidePointerEvents:Y,onInteractOutside:H,onEscapeKeyDown:z,onPointerDownOutside:K,onFocusOutside:W,onDismiss:()=>U.onOpenChange(!1),children:G(U7,{"data-state":dA(U.open),role:"dialog",id:U.contentId,..._,...B,ref:J,style:{...B.style,...{"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}}})})})}),cA="PopoverClose",qc=D5.forwardRef(($,J)=>{let{__scopePopover:Q,...Z}=$,q=O7(cA,Q);return G(h3.button,{type:"button",...Z,ref:J,onClick:qJ($.onClick,()=>q.onOpenChange(!1))})});qc.displayName=cA;var Xc="PopoverArrow",Yc=D5.forwardRef(($,J)=>{let{__scopePopover:Q,...Z}=$,q=HZ(Q);return G(_7,{...q,...Z,ref:J})});Yc.displayName=Xc;function dA($){return $?"open":"closed"}var pA=SA,lA=xA,iA=vA,rA=gA,f3=uA;var a1=pA,T5=iA,_6=lA,s1=sA.forwardRef(({className:$,align:J="center",sideOffset:Q=4,...Z},q)=>G(rA,{children:G("div",{className:`${M8}`,children:G(f3,{ref:q,align:J,sideOffset:Q,className:b0("z-[9999] w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-popover-content-transform-origin]",$),...Z})})}));s1.displayName=f3.displayName;var o1=R(v(),1);var oA=R(v(),1);var $6=oA.forwardRef(({className:$,type:J,...Q},Z)=>{return G("input",{type:J,className:b0("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",$),ref:Z,...Q})});$6.displayName="Input";var Pw=R(v(),1);var i5=R(v(),1);var nA=R(v(),1),Kc=Object.defineProperty,g3=($,J)=>Kc($,"name",{value:J,configurable:!0});function v3($,J){if(typeof $==="function")return $(J);else if($!==null&&$!==void 0)$.current=J}g3(v3,"setRef");function aA(...$){return(J)=>{let Q=!1,Z=$.map((q)=>{let X=v3(q,J);if(!Q&&typeof X=="function")Q=!0;return X});if(Q)return()=>{for(let q=0;qGc($,"name",{value:J,configurable:!0});function Wc($,J){let Q=e6.createContext(J);Q.displayName=$+"Context";let Z=t6((X)=>{let{children:Y,...z}=X,K=e6.useMemo(()=>z,Object.values(z));return G(Q.Provider,{value:K,children:Y})},"Provider");Z.displayName=$+"Provider";function q(X,Y={}){let{optional:z=!1}=Y,K=e6.useContext(Q);if(K)return K;if(J!==void 0)return J;if(z)return;throw Error(`\`${X}\` must be used within \`${$}\``)}return t6(q,"useContext"),[Z,q]}t6(Wc,"createContext");function u3($,J=[]){let Q=[];function Z(X,Y){let z=e6.createContext(Y);z.displayName=X+"Context";let K=Q.length;Q=[...Q,Y];let W=t6((B)=>{let{scope:U,children:_,...L}=B,F=U?.[$]?.[K]||z,V=e6.useMemo(()=>L,Object.values(L));return G(F.Provider,{value:V,children:_})},"Provider");W.displayName=X+"Provider";function H(B,U,_={}){let{optional:L=!1}=_,F=U?.[$]?.[K]||z,V=e6.useContext(F);if(V)return V;if(Y!==void 0)return Y;if(L)return;throw Error(`\`${B}\` must be used within \`${X}\``)}return t6(H,"useContext"),[W,H]}t6(Z,"createContext");let q=t6(()=>{let X=Q.map((Y)=>{return e6.createContext(Y)});return t6(function(z){let K=z?.[$]||X;return e6.useMemo(()=>({[`__scope${$}`]:{...z,[$]:K}}),[z,K])},"useScope")},"createScope");return q.scopeName=$,[Z,tA(q,...J)]}t6(u3,"createContextScope");function tA(...$){let J=$[0];if($.length===1)return J;let Q=t6(()=>{let Z=$.map((q)=>({useScope:q(),scopeName:q.scopeName}));return t6(function(X){let Y=Z.reduce((z,{useScope:K,scopeName:W})=>{let B=K(X)[`__scope${W}`];return{...z,...B}},{});return e6.useMemo(()=>({[`__scope${J.scopeName}`]:Y}),[Y])},"useComposedScopes")},"createScope");return Q.scopeName=J.scopeName,Q}t6(tA,"composeContextScopes");var Hc=Object.defineProperty,zJ=($,J)=>Hc($,"name",{value:J,configurable:!0}),eA=!!(typeof window<"u"&&window.document&&window.document.createElement);function BZ($,J,{checkForDefaultPrevented:Q=!0}={}){return zJ(function(q){if($?.(q),Q===!1||!q||!q.defaultPrevented)return J?.(q)},"handleEvent")}zJ(BZ,"composeEventHandlers");function Bc($){if(!eA)throw Error("Cannot access window outside of the DOM");return $?.ownerDocument?.defaultView??window}zJ(Bc,"getOwnerWindow");function m3($){if(!eA)throw Error("Cannot access document outside of the DOM");return $?.ownerDocument??document}zJ(m3,"getOwnerDocument");function $w($,J=!1){let{activeElement:Q}=m3($);if(!Q?.nodeName)return null;if(Jw(Q)&&Q.contentDocument)return $w(Q.contentDocument.body,J);if(J){let Z=Q.getAttribute("aria-activedescendant");if(Z){let q=m3(Q).getElementById(Z);if(q)return q}}return Q}zJ($w,"getActiveElement");function Jw($){return $.tagName==="IFRAME"}zJ(Jw,"isFrame");var $9=R(v(),1);var MY=!1;var Qw=R(v(),1),Zw=globalThis?.document?Qw.useLayoutEffect:()=>{};var b9=R(v(),1);var qw=R(v(),1),Xw=globalThis?.document?qw.useLayoutEffect:()=>{};var KJ=R(v(),1),Uc=Object.defineProperty,_c=($,J)=>Uc($,"name",{value:J,configurable:!0}),Yw=KJ[" useEffectEvent ".trim().toString()],zw=KJ[" useInsertionEffect ".trim().toString()];function c3($){if(typeof Yw==="function")return Yw($);let J=KJ.useRef(()=>{throw Error("Cannot call an event handler while rendering.")});if(typeof zw==="function")zw(()=>{J.current=$});else Xw(()=>{J.current=$});return KJ.useMemo(()=>(...Q)=>J.current?.(...Q),[])}_c(c3,"useEffectEvent");var Lc=Object.defineProperty,UZ=($,J)=>Lc($,"name",{value:J,configurable:!0}),Fc=$9[" useInsertionEffect ".trim().toString()]||Zw;function d3({prop:$,defaultProp:J,onChange:Q=UZ(()=>{},"onChange"),caller:Z}){let[q,X,Y]=Gw({defaultProp:J,onChange:Q}),z=$!==void 0,K=z?$:q;if(MY){let H=$9.useRef($!==void 0);$9.useEffect(()=>{let B=H.current;if(B!==z)console.warn(`${Z} is changing from ${B?"controlled":"uncontrolled"} to ${z?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`);H.current=z},[z,Z])}let W=$9.useCallback((H)=>{if(z){let B=Ww(H)?H($):H;if(B!==$)Y.current?.(B)}else X(H)},[z,$,X,Y]);return[K,W]}UZ(d3,"useControllableState");function Gw({defaultProp:$,onChange:J}){let[Q,Z]=$9.useState($),q=$9.useRef(Q),X=$9.useRef(J);return Fc(()=>{X.current=J},[J]),$9.useEffect(()=>{if(q.current!==Q)X.current?.(Q),q.current=Q},[Q,q]),[Q,Z,X]}UZ(Gw,"useUncontrolledState");function Ww($){return typeof $==="function"}UZ(Ww,"isFunction");var Kw=Symbol("RADIX:SYNC_STATE");function Vc($,J,Q,Z){let{prop:q,defaultProp:X,onChange:Y,caller:z}=J,K=q!==void 0,W=c3(Y);if(MY){let V=b9.useRef(q!==void 0);b9.useEffect(()=>{let M=V.current;if(M!==K)console.warn(`${z} is changing from ${M?"controlled":"uncontrolled"} to ${K?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`);V.current=K},[K,z])}let H=[{...Q,state:X}];if(Z)H.push(Z);let[B,U]=b9.useReducer((V,M)=>{if(M.type===Kw)return{...V,state:M.state};let D=$(V,M);if(K&&!Object.is(D.state,V.state))W(D.state);return D},...H),_=B.state,L=b9.useRef(_);b9.useEffect(()=>{if(L.current!==_){if(L.current=_,!K)W(_)}},[_,L,K]);let F=b9.useMemo(()=>{if(q!==void 0)return{...B,state:q};return B},[B,q]);return b9.useEffect(()=>{if(K&&!Object.is(q,B.state))U({type:Kw,state:q})},[q,B.state,K]),[F,U]}UZ(Vc,"useControllableStateReducer");var Uw=R(v(),1);var Hw=R(v(),1),Bw=globalThis?.document?Hw.useLayoutEffect:()=>{};var Mc=Object.defineProperty,Dc=($,J)=>Mc($,"name",{value:J,configurable:!0});function p3($){let[J,Q]=Uw.useState(void 0);return Bw(()=>{if($){Q({width:$.offsetWidth,height:$.offsetHeight});let Z=new ResizeObserver((q)=>{if(!Array.isArray(q))return;if(!q.length)return;let X=q[0],Y,z;if("borderBoxSize"in X){let K=X.borderBoxSize,W=Array.isArray(K)?K[0]:K;Y=W.inlineSize,z=W.blockSize}else Y=$.offsetWidth,z=$.offsetHeight;Q({width:Y,height:z})});return Z.observe($,{box:"border-box"}),()=>Z.unobserve($)}else Q(void 0)},[$]),J}Dc(p3,"useSize");var R8=R(v(),1);var _w=R(v(),1),l3=globalThis?.document?_w.useLayoutEffect:()=>{};var Lw=R(v(),1),Nc=Object.defineProperty,h4=($,J)=>Nc($,"name",{value:J,configurable:!0});function Fw($,J){return Lw.useReducer((Q,Z)=>{return J[Q][Z]??Q},$)}h4(Fw,"useStateMachine");var Vw=h4(($)=>{let{present:J,children:Q}=$,Z=Mw(J),q=typeof Q==="function"?Q({present:Z.isPresent}):R8.Children.only(Q),X=Dw(Z.ref,Nw(q));return typeof Q==="function"||Z.isPresent?R8.cloneElement(q,{ref:X}):null},"Presence");function Mw($){let[J,Q]=R8.useState(),Z=R8.useRef(null),q=R8.useRef($),X=R8.useRef("none"),Y=R8.useRef(void 0),z=$?"mounted":"unmounted",[K,W]=Fw(z,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return R8.useEffect(()=>{if(K==="mounted")X.current=Y.current??GJ(Z.current),Y.current=void 0;else X.current="none"},[K]),l3(()=>{let H=Z.current,B=q.current;if(B!==$){let _=X.current,L=GJ(H);if($)Y.current=L,W("MOUNT");else if(L==="none"||H?.display==="none")W("UNMOUNT");else if(B&&_!==L)W("ANIMATION_OUT");else W("UNMOUNT");q.current=$}},[$,W]),l3(()=>{if(J){let H,B=J.ownerDocument.defaultView??window,U=h4((L)=>{let V=GJ(Z.current).includes(CSS.escape(L.animationName));if(L.target===J&&V){if(W("ANIMATION_END"),!q.current){let M=J.style.animationFillMode;J.style.animationFillMode="forwards",H=B.setTimeout(()=>{if(J.style.animationFillMode==="forwards")J.style.animationFillMode=M})}}},"handleAnimationEnd"),_=h4((L)=>{if(L.target===J)X.current=GJ(Z.current)},"handleAnimationStart");return J.addEventListener("animationstart",_),J.addEventListener("animationcancel",U),J.addEventListener("animationend",U),()=>{B.clearTimeout(H),J.removeEventListener("animationstart",_),J.removeEventListener("animationcancel",U),J.removeEventListener("animationend",U)}}else W("ANIMATION_END")},[J,W]),{isPresent:["mounted","unmountSuspended"].includes(K),ref:R8.useCallback((H)=>{if(H){let B=getComputedStyle(H);Z.current=B,Y.current=GJ(B)}else Z.current=null;Q(H)},[])}}h4(Mw,"usePresence");function i3($,J){if(typeof $==="function")return $(J);else if($!==null&&$!==void 0)$.current=J}h4(i3,"setRef");function Dw(...$){let J=R8.useRef($);return J.current=$,R8.useCallback((Q)=>{let Z=J.current,q=!1,X=Z.map((Y)=>{let z=i3(Y,Q);if(!q&&typeof z==="function")q=!0;return z});if(q)return()=>{for(let Y=0;YOc($,"name",{value:J,configurable:!0});function s3($){let J=C8.forwardRef((Q,Z)=>{let{children:q,...X}=Q,Y=null,z=!1,K=[];if(r3(q)&&typeof DY==="function")q=DY(q._payload);if(C8.Children.forEach(q,(U)=>{if(kw(U)){z=!0;let _=U,L="child"in _.props?_.props.child:_.props.children;if(r3(L)&&typeof DY==="function")L=DY(L._payload);Y=wc(_,L),K.push(Y?.props?.children)}else K.push(U)}),Y)Y=C8.cloneElement(Y,void 0,K);else if(!z&&C8.Children.count(q)===1&&C8.isValidElement(q))Y=q;let W=Y?ww(Y):void 0,H=YJ(Z,W);if(!Y){if(q||q===0)throw Error(z?Tc($):Ic($));return q}let B=Aw(X,Y.props??{});if(Y.type!==C8.Fragment)B.ref=Z?H:W;return C8.cloneElement(Y,B)});return J.displayName=`${$}.Slot`,J}j9(s3,"createSlot");var Ow=Symbol.for("radix.slottable");function Ac($){let J=j9((Q)=>("child"in Q)?Q.children(Q.child):Q.children,"Slottable");return J.displayName=`${$}.Slottable`,J.__radixId=Ow,J}j9(Ac,"createSlottable");var wc=j9(($,J)=>{if("child"in $.props){let Q=$.props.child;if(!C8.isValidElement(Q))return null;return C8.cloneElement(Q,void 0,$.props.children(Q.props.children))}return C8.isValidElement(J)?J:null},"getSlottableElementFromSlottable");function Aw($,J){let Q={...J};for(let Z in J){let q=$[Z],X=J[Z];if(/^on[A-Z]/.test(Z)){if(q&&X)Q[Z]=(...z)=>{let K=X(...z);return q(...z),K};else if(q)Q[Z]=q}else if(Z==="style")Q[Z]={...q,...X};else if(Z==="className")Q[Z]=[q,X].filter(Boolean).join(" ")}return{...$,...Q}}j9(Aw,"mergeProps");function ww($){let J=Object.getOwnPropertyDescriptor($.props,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning;if(Q)return $.ref;if(J=Object.getOwnPropertyDescriptor($,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning,Q)return $.props.ref;return $.props.ref||$.ref}j9(ww,"getElementRef");function kw($){return C8.isValidElement($)&&typeof $.type==="function"&&"__radixId"in $.type&&$.type.__radixId===Ow}j9(kw,"isSlottable");var kc=Symbol.for("react.lazy");function r3($){return $!=null&&typeof $==="object"&&"$$typeof"in $&&$.$$typeof===kc&&"_payload"in $&&Iw($._payload)}j9(r3,"isLazyComponent");function Iw($){return typeof $==="object"&&$!==null&&"then"in $}j9(Iw,"isPromiseLike");var Ic=j9(($)=>{return`${$} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`},"createSlotError"),Tc=j9(($)=>{return`${$} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`},"createSlottableError"),DY=C8[" use ".trim().toString()];var bc=Object.defineProperty,jc=($,J)=>bc($,"name",{value:J,configurable:!0}),Ec=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],NY=Ec.reduce(($,J)=>{let Q=s3(`Primitive.${J}`),Z=Tw.forwardRef((q,X)=>{let{asChild:Y,...z}=q,K=Y?Q:J;if(typeof window<"u")window[Symbol.for("radix-ui")]=!0;return G(K,{...z,ref:X})});return Z.displayName=`Primitive.${J}`,{...$,[J]:Z}},{});function yc($,J){if($)bw.flushSync(()=>$.dispatchEvent(J))}jc(yc,"dispatchDiscreteCustomEvent");var Pc=Object.defineProperty,f4=($,J)=>Pc($,"name",{value:J,configurable:!0}),o3="Checkbox",[Rc,F20]=u3(o3),[Cc,n3]=Rc(o3);function jw($){let{__scopeCheckbox:J,checked:Q,children:Z,defaultChecked:q,disabled:X,form:Y,name:z,onCheckedChange:K,required:W,value:H="on",internal_do_not_use_render:B}=$,[U,_]=d3({prop:Q,defaultProp:q??!1,onChange:K,caller:o3}),[L,F]=i5.useState(null),[V,M]=i5.useState(null),D=i5.useRef(!1),[N,O]=i5.useReducer((T)=>T+1,0),I=L?!!Y||!!L.closest("form"):!0,k={checked:U,disabled:X,setChecked:_,control:L,setControl:F,name:z,form:Y,value:H,hasConsumerStoppedPropagationRef:D,userInteractionCount:N,onUserInteraction:O,required:W,defaultChecked:x4(q)?!1:q,isFormControl:I,bubbleInput:V,setBubbleInput:M};return G(Cc,{scope:J,...k,children:yw(B)?B(k):Z})}f4(jw,"CheckboxProvider");var Sc="CheckboxTrigger",hc=i5.forwardRef(f4(function({__scopeCheckbox:J,onKeyDown:Q,onClick:Z,...q},X){let{control:Y,value:z,disabled:K,checked:W,required:H,setControl:B,setChecked:U,hasConsumerStoppedPropagationRef:_,onUserInteraction:L,isFormControl:F,bubbleInput:V}=n3(Sc,J),M=YJ(X,B),D=i5.useRef(W);return i5.useEffect(()=>{let N=Y?.form;if(N){let O=f4(()=>U(D.current),"reset");return N.addEventListener("reset",O),()=>N.removeEventListener("reset",O)}},[Y,U]),G(NY.button,{type:"button",role:"checkbox","aria-checked":x4(W)?"mixed":W,"aria-required":H,"data-state":t3(W),"data-disabled":K?"":void 0,disabled:K,value:z,...q,ref:M,onKeyDown:BZ(Q,(N)=>{if(N.key==="Enter")N.preventDefault()}),onClick:BZ(Z,(N)=>{if(L(),U((O)=>x4(O)?!0:!O),V&&F){if(_.current=N.isPropagationStopped(),!_.current)N.stopPropagation()}})})},"CheckboxTrigger")),a3=i5.forwardRef(f4(function(J,Q){let{__scopeCheckbox:Z,name:q,checked:X,defaultChecked:Y,required:z,disabled:K,value:W,onCheckedChange:H,form:B,...U}=J;return G(jw,{__scopeCheckbox:Z,checked:X,defaultChecked:Y,disabled:K,required:z,onCheckedChange:H,name:q,form:B,value:W,internal_do_not_use_render:({isFormControl:_})=>b(W1,{children:[G(hc,{...U,ref:Q,__scopeCheckbox:Z}),_&&G(vc,{__scopeCheckbox:Z})]})})},"Checkbox")),xc="CheckboxIndicator",Ew=i5.forwardRef(f4(function(J,Q){let{__scopeCheckbox:Z,forceMount:q,...X}=J,Y=n3(xc,Z);return G(Vw,{present:q||x4(Y.checked)||Y.checked===!0,children:G(NY.span,{"data-state":t3(Y.checked),"data-disabled":Y.disabled?"":void 0,...X,ref:Q,style:{pointerEvents:"none",...J.style}})})},"CheckboxIndicator")),fc="CheckboxBubbleInput",vc=i5.forwardRef(f4(function({__scopeCheckbox:J,onClick:Q,...Z},q){let{control:X,hasConsumerStoppedPropagationRef:Y,userInteractionCount:z,checked:K,defaultChecked:W,required:H,disabled:B,name:U,value:_,form:L,bubbleInput:F,setBubbleInput:V}=n3(fc,J),M=YJ(q,V),D=p3(X),N=i5.useRef(!1),O=i5.useRef(K),I=i5.useRef(z);i5.useEffect(()=>{let T=F;if(!T)return;let A=window.HTMLInputElement.prototype,C=Object.getOwnPropertyDescriptor(A,"checked").set,y=z!==I.current;I.current=z;let x=O.current!==K;O.current=K;let j=!(y&&Y.current);if(x&&C){N.current=!y;let P=new Event("click",{bubbles:j});T.indeterminate=x4(K),C.call(T,x4(K)?!1:K),T.dispatchEvent(P),N.current=!1}},[F,K,Y,z]);let k=i5.useRef(x4(K)?!1:K);return G(NY.input,{type:"checkbox","aria-hidden":!0,defaultChecked:W??k.current,required:H,disabled:B,name:U,value:_,form:L,...Z,tabIndex:-1,ref:M,onClick:BZ(Q,(T)=>{if(N.current)T.stopPropagation()}),style:{...Z.style,...D,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"CheckboxBubbleInput"));function yw($){return typeof $==="function"}f4(yw,"isFunction");function x4($){return $==="indeterminate"}f4(x4,"isIndeterminate");function t3($){return x4($)?"indeterminate":$?"checked":"unchecked"}f4(t3,"getState");var WJ=Pw.forwardRef(({className:$,...J},Q)=>G(a3,{ref:Q,className:b0("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",$),...J,children:G(Ew,{className:b0("grid place-content-center text-current"),children:G(T9,{className:"h-4 w-4"})})}));WJ.displayName=a3.displayName;var IY=R(v(),1);var g4=R(v(),1);var O20=!!(typeof window<"u"&&window.document&&window.document.createElement);function OY($,J,{checkForDefaultPrevented:Q=!0}={}){return function(q){if($?.(q),Q===!1||!q.defaultPrevented)return J?.(q)}}var v4=R(v(),1);function Rw($,J=[]){let Q=[];function Z(X,Y){let z=v4.createContext(Y),K=Q.length;Q=[...Q,Y];let W=(B)=>{let{scope:U,children:_,...L}=B,F=U?.[$]?.[K]||z,V=v4.useMemo(()=>L,Object.values(L));return G(F.Provider,{value:V,children:_})};W.displayName=X+"Provider";function H(B,U){let _=U?.[$]?.[K]||z,L=v4.useContext(_);if(L)return L;if(Y!==void 0)return Y;throw Error(`\`${B}\` must be used within \`${X}\``)}return[W,H]}let q=()=>{let X=Q.map((Y)=>{return v4.createContext(Y)});return function(z){let K=z?.[$]||X;return v4.useMemo(()=>({[`__scope${$}`]:{...z,[$]:K}}),[z,K])}};return q.scopeName=$,[Z,uc(q,...J)]}function uc(...$){let J=$[0];if($.length===1)return J;let Q=()=>{let Z=$.map((q)=>({useScope:q(),scopeName:q.scopeName}));return function(X){let Y=Z.reduce((z,{useScope:K,scopeName:W})=>{let B=K(X)[`__scope${W}`];return{...z,...B}},{});return v4.useMemo(()=>({[`__scope${J.scopeName}`]:Y}),[Y])}};return Q.scopeName=J.scopeName,Q}var L6=R(v(),1);var Sw=R(v(),1);function Cw($,J){if(typeof $==="function")return $(J);else if($!==null&&$!==void 0)$.current=J}function mc(...$){return(J)=>{let Q=!1,Z=$.map((q)=>{let X=Cw(q,J);if(!Q&&typeof X=="function")Q=!0;return X});if(Q)return()=>{for(let q=0;q{return J[Q][Z]??Q},$)}var e3=($)=>{let{present:J,children:Q}=$,Z=dc(J),q=typeof Q==="function"?Q({present:Z.isPresent}):L6.Children.only(Q),X=hw(Z.ref,pc(q));return typeof Q==="function"||Z.isPresent?L6.cloneElement(q,{ref:X}):null};e3.displayName="Presence";function dc($){let[J,Q]=L6.useState(),Z=L6.useRef(null),q=L6.useRef($),X=L6.useRef("none"),Y=$?"mounted":"unmounted",[z,K]=cc(Y,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return L6.useEffect(()=>{let W=AY(Z.current);X.current=z==="mounted"?W:"none"},[z]),L1(()=>{let W=Z.current,H=q.current;if(H!==$){let U=X.current,_=AY(W);if($)K("MOUNT");else if(_==="none"||W?.display==="none")K("UNMOUNT");else if(H&&U!==_)K("ANIMATION_OUT");else K("UNMOUNT");q.current=$}},[$,K]),L1(()=>{if(J){let W,H=J.ownerDocument.defaultView??window,B=(_)=>{let F=AY(Z.current).includes(CSS.escape(_.animationName));if(_.target===J&&F){if(K("ANIMATION_END"),!q.current){let V=J.style.animationFillMode;J.style.animationFillMode="forwards",W=H.setTimeout(()=>{if(J.style.animationFillMode==="forwards")J.style.animationFillMode=V})}}},U=(_)=>{if(_.target===J)X.current=AY(Z.current)};return J.addEventListener("animationstart",U),J.addEventListener("animationcancel",B),J.addEventListener("animationend",B),()=>{H.clearTimeout(W),J.removeEventListener("animationstart",U),J.removeEventListener("animationcancel",B),J.removeEventListener("animationend",B)}}else K("ANIMATION_END")},[J,K]),{isPresent:["mounted","unmountSuspended"].includes(z),ref:L6.useCallback((W)=>{Z.current=W?getComputedStyle(W):null,Q(W)},[])}}function AY($){return $?.animationName||"none"}function pc($){let J=Object.getOwnPropertyDescriptor($.props,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning;if(Q)return $.ref;if(J=Object.getOwnPropertyDescriptor($,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning,Q)return $.props.ref;return $.props.ref||$.ref}var uw=R(v(),1),ac=R($5(),1);var G8=R(v(),1);var lc=R(v(),1);function fw($,J){if(typeof $==="function")return $(J);else if($!==null&&$!==void 0)$.current=J}function vw(...$){return(J)=>{let Q=!1,Z=$.map((q)=>{let X=fw(q,J);if(!Q&&typeof X=="function")Q=!0;return X});if(Q)return()=>{for(let q=0;q{let{children:X,...Y}=Z,z=G8.Children.toArray(X),K=z.find(sc);if(K){let W=K.props.children,H=z.map((B)=>{if(B===K){if(G8.Children.count(W)>1)return G8.Children.only(null);return G8.isValidElement(W)?W.props.children:null}else return B});return G(J,{...Y,ref:q,children:G8.isValidElement(W)?G8.cloneElement(W,void 0,H):null})}return G(J,{...Y,ref:q,children:X})});return Q.displayName=`${$}.Slot`,Q}function ic($){let J=G8.forwardRef((Q,Z)=>{let{children:q,...X}=Q;if(G8.isValidElement(q)){let Y=nc(q),z=oc(X,q.props);if(q.type!==G8.Fragment)z.ref=Z?vw(Z,Y):Y;return G8.cloneElement(q,z)}return G8.Children.count(q)>1?G8.Children.only(null):null});return J.displayName=`${$}.SlotClone`,J}var rc=Symbol("radix.slottable");function sc($){return G8.isValidElement($)&&typeof $.type==="function"&&"__radixId"in $.type&&$.type.__radixId===rc}function oc($,J){let Q={...J};for(let Z in J){let q=$[Z],X=J[Z];if(/^on[A-Z]/.test(Z)){if(q&&X)Q[Z]=(...z)=>{let K=X(...z);return q(...z),K};else if(q)Q[Z]=q}else if(Z==="style")Q[Z]={...q,...X};else if(Z==="className")Q[Z]=[q,X].filter(Boolean).join(" ")}return{...$,...Q}}function nc($){let J=Object.getOwnPropertyDescriptor($.props,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning;if(Q)return $.ref;if(J=Object.getOwnPropertyDescriptor($,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning,Q)return $.props.ref;return $.props.ref||$.ref}var tc=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],_Z=tc.reduce(($,J)=>{let Q=gw(`Primitive.${J}`),Z=uw.forwardRef((q,X)=>{let{asChild:Y,...z}=q,K=Y?Q:J;if(typeof window<"u")window[Symbol.for("radix-ui")]=!0;return G(K,{...z,ref:X})});return Z.displayName=`Primitive.${J}`,{...$,[J]:Z}},{});var J9=R(v(),1);var wY=R(v(),1);var ec=J9[" useInsertionEffect ".trim().toString()]||L1;function mw({prop:$,defaultProp:J,onChange:Q=()=>{},caller:Z}){let[q,X,Y]=$d({defaultProp:J,onChange:Q}),z=$!==void 0,K=z?$:q;{let H=J9.useRef($!==void 0);J9.useEffect(()=>{let B=H.current;if(B!==z)console.warn(`${Z} is changing from ${B?"controlled":"uncontrolled"} to ${z?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`);H.current=z},[z,Z])}let W=J9.useCallback((H)=>{if(z){let B=Jd(H)?H($):H;if(B!==$)Y.current?.(B)}else X(H)},[z,$,X,Y]);return[K,W]}function $d({defaultProp:$,onChange:J}){let[Q,Z]=J9.useState($),q=J9.useRef(Q),X=J9.useRef(J);return ec(()=>{X.current=J},[J]),J9.useEffect(()=>{if(q.current!==Q)X.current?.(Q),q.current=Q},[Q,q]),[Q,Z,X]}function Jd($){return typeof $==="function"}var f20=Symbol("RADIX:SYNC_STATE");var kY="Tabs",[Qd,s20]=Rw(kY,[ZJ]),cw=ZJ(),[Zd,$B]=Qd(kY),dw=g4.forwardRef(($,J)=>{let{__scopeTabs:Q,value:Z,onValueChange:q,defaultValue:X,orientation:Y="horizontal",dir:z,activationMode:K="automatic",...W}=$,H=d9(z),[B,U]=mw({prop:Z,onChange:q,defaultProp:X??"",caller:kY});return G(Zd,{scope:Q,baseId:a5(),value:B,onValueChange:U,orientation:Y,dir:H,activationMode:K,children:G(_Z.div,{dir:H,"data-orientation":Y,...W,ref:J})})});dw.displayName=kY;var pw="TabsList",lw=g4.forwardRef(($,J)=>{let{__scopeTabs:Q,loop:Z=!0,...q}=$,X=$B(pw,Q),Y=cw(Q);return G(XY,{asChild:!0,...Y,orientation:X.orientation,dir:X.dir,loop:Z,children:G(_Z.div,{role:"tablist","aria-orientation":X.orientation,...q,ref:J})})});lw.displayName=pw;var iw="TabsTrigger",rw=g4.forwardRef(($,J)=>{let{__scopeTabs:Q,value:Z,disabled:q=!1,...X}=$,Y=$B(iw,Q),z=cw(Q),K=nw(Y.baseId,Z),W=aw(Y.baseId,Z),H=Z===Y.value;return G(YY,{asChild:!0,...z,focusable:!q,active:H,children:G(_Z.button,{type:"button",role:"tab","aria-selected":H,"aria-controls":W,"data-state":H?"active":"inactive","data-disabled":q?"":void 0,disabled:q,id:K,...X,ref:J,onMouseDown:OY($.onMouseDown,(B)=>{if(!q&&B.button===0&&B.ctrlKey===!1)Y.onValueChange(Z);else B.preventDefault()}),onKeyDown:OY($.onKeyDown,(B)=>{if([" ","Enter"].includes(B.key))Y.onValueChange(Z)}),onFocus:OY($.onFocus,()=>{let B=Y.activationMode!=="manual";if(!H&&!q&&B)Y.onValueChange(Z)})})})});rw.displayName=iw;var sw="TabsContent",ow=g4.forwardRef(($,J)=>{let{__scopeTabs:Q,value:Z,forceMount:q,children:X,...Y}=$,z=$B(sw,Q),K=nw(z.baseId,Z),W=aw(z.baseId,Z),H=Z===z.value,B=g4.useRef(H);return g4.useEffect(()=>{let U=requestAnimationFrame(()=>B.current=!1);return()=>cancelAnimationFrame(U)},[]),G(e3,{present:q||H,children:({present:U})=>G(_Z.div,{"data-state":H?"active":"inactive","data-orientation":z.orientation,role:"tabpanel","aria-labelledby":K,hidden:!U,id:W,tabIndex:0,...Y,ref:J,style:{...$.style,animationDuration:B.current?"0s":void 0},children:U&&X})})});ow.displayName=sw;function nw($,J){return`${$}-trigger-${J}`}function aw($,J){return`${$}-content-${J}`}var tw=dw,JB=lw,QB=rw,ZB=ow;var u4=tw,r9=IY.forwardRef(({className:$,...J},Q)=>G(JB,{ref:Q,className:b0("inline-flex h-9 items-center justify-center rounded-lg border bg-muted p-1 text-muted-foreground",$),...J}));r9.displayName=JB.displayName;var W8=IY.forwardRef(({className:$,...J},Q)=>G(QB,{ref:Q,className:b0("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",$),...J}));W8.displayName=QB.displayName;var E9=IY.forwardRef(({className:$,...J},Q)=>G(ZB,{ref:Q,className:b0("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",$),...J}));E9.displayName=ZB.displayName;function I2({className:$,...J}){return G("div",{className:b0("animate-pulse rounded-md bg-primary/10",$),...J})}var Xd=globalThis.comfyAPI.app.app;var ew=($,J,Q=3000)=>{try{Xd.extensionManager.toast.add({severity:"error",summary:$,detail:J,life:Q})}catch{globalThis.alert($)}};async function LZ($,J=""){let Q=new FormData;if(Q.append("image",$),Q.append("type","input"),Q.append("overwrite","false"),J)Q.append("subfolder",J);let Z=await fetch("/upload/image",{method:"POST",body:Q});if(!Z.ok)throw Error(`Upload failed: ${Z.status}`);let q=await Z.json();return q.subfolder?`${q.subfolder}/${q.name}`:q.name}var TY=R(v(),1),Yd=180,zd={threshold:0};function qB($,{delayMs:J=Yd,observerInit:Q=zd}={}){let[Z,q]=TY.useState(!1);return TY.useEffect(()=>{if(Z)return;let X=$.current;if(!X)return;if(typeof IntersectionObserver>"u"){q(!0);return}let Y,z=new IntersectionObserver(([K])=>{if(K.isIntersecting){Y??=setTimeout(()=>{q(!0),z.disconnect()},J);return}if(Y)clearTimeout(Y),Y=void 0},Q);return z.observe(X),()=>{if(Y)clearTimeout(Y);z.disconnect()}},[J,Z,Q,$]),Z}var bY=new Map,HJ=new Map,XB=new Set,$k=0,BJ={inputs:0,outputs:0,local:0};function Kd($){return JSON.stringify($)}function Jk($){let J=$&&typeof $==="object"?$:{};return(Array.isArray(J.items)?J.items:Array.isArray(J.files)?J.files:[]).reduce((Z,q)=>{if(!q||typeof q!=="object")return Z;let X=q;return Z.push(X.type==="dir"?X:{...X,type:"file"}),Z},[])}function Gd($){let J=new URLSearchParams({source:$.source,type:$.mediaType});if($.source==="local")J.set("path",$.localPath);if($.subfolder)J.set("subfolder",$.subfolder);return`/easy-media/media/list?${J}`}function Qk($){let J=Kd($),Q=bY.get(J);if(Q)return Promise.resolve(Q.items);let Z=HJ.get(J);if(Z)return Z.promise;let q=BJ[$.source],X=fetch(Gd($)).then((Y)=>{if(!Y.ok)throw Error(`${Y.status}`);return Y.json()}).then((Y)=>{let z=Jk(Y);if(q===BJ[$.source])bY.set(J,{request:$,items:z});return z}).finally(()=>{if(HJ.get(J)?.promise===X)HJ.delete(J)});return HJ.set(J,{request:$,promise:X}),X}async function jY($){let J=new URLSearchParams({source:$.source,type:$.mediaType,hours:String($.hours)});if($.limit)J.set("limit",String($.limit));let Q=await fetch(`/easy-media/media/recent?${J}`);if(!Q.ok)throw Error(`${Q.status}`);let Z=await Q.json();return Jk(Z)}async function Zk($,J=48,Q=50){let[Z,q]=await Promise.all([jY({source:"outputs",mediaType:$,hours:J,limit:Q}),jY({source:"temp",mediaType:$,hours:J,limit:Q})]),X=Z.filter((z)=>z.type==="file"&&typeof z.path==="string").map((z)=>({...z,source_type:"output"})),Y=q.filter((z)=>z.type==="file"&&typeof z.path==="string").map((z)=>({...z,source_type:"temp"}));return[...X,...Y].sort((z,K)=>K.mtime-z.mtime)}function R5($){if($)BJ[$]+=1;else BJ.inputs+=1,BJ.outputs+=1,BJ.local+=1;for(let[J,Q]of bY)if(!$||Q.request.source===$)bY.delete(J);for(let[J,Q]of HJ)if(!$||Q.request.source===$)HJ.delete(J);$k+=1,XB.forEach((J)=>J())}function qk($){return XB.add($),()=>XB.delete($)}function YB(){return $k}var Xk=new Map,FZ="|MULTIPLE|",Yk=2000;function Wd($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;return`${($/1048576).toFixed(1)} MB`}function _k($,J){if(J==="audio")return UJ;if(J==="image")return LJ;if(J==="video")return _J;let Q=$.split(".").pop()?.toLowerCase()??"";if(["mp3","wav","flac","ogg","m4a","aac","opus","wma"].includes(Q))return UJ;if(["png","jpg","jpeg","webp","gif","bmp","tiff","tif"].includes(Q))return LJ;if(["mp4","webm","mov","mkv","avi","m4v"].includes(Q))return _J;return Gk}function WB($,J){if(J==="image")return!0;let Q=$.split(".").pop()?.toLowerCase()??"";return["png","jpg","jpeg","webp","gif","bmp","tiff","tif"].includes(Q)}function Lk($,J){if(J==="audio")return!0;let Q=$.split(".").pop()?.toLowerCase()??"";return["mp3","wav","flac","ogg","m4a","aac","opus","wma"].includes(Q)}function Fk($,J){if(J==="video")return!0;let Q=$.split(".").pop()?.toLowerCase()??"";return["mp4","webm","mov","mkv","avi","m4v"].includes(Q)}function GB($){if(!$)return new Set;return new Set($.split(FZ).filter((J)=>J.length>0))}function Hd($){let J=$.split(FZ)[0]??"";if(!J||J.startsWith("http")||J.startsWith("__slot__:"))return"";return J.replaceAll("\\","/").split("/").slice(0,-1).join("/")}function Bd($){return $.replaceAll("\\","/").split("/").filter(Boolean)}function zk($,J){if(WB($.name,J)&&$.width&&$.height)return`${$.width}×${$.height}`;return Wd($.size)}function Ud($,J){return[...$].sort((Q,Z)=>{if(J==="date")return Z.mtime-Q.mtime;return Q.name.localeCompare(Z.name)})}function _d($){return[...$].sort((J,Q)=>J.name.localeCompare(Q.name))}function Ld($){if($==="name")return"mediaSelector.sortName";if($==="date")return"mediaSelector.sortDate";return"mediaSelector.sortFolders"}function Vk({src:$,alt:J,className:Q}){let Z=o1.useRef(null),q=qB(Z);return G("img",{ref:Z,src:q?$:void 0,alt:J,className:Q,onError:(X)=>{X.target.style.display="none"}})}function Mk({src:$,className:J}){let Q=o1.useRef(null),Z=qB(Q);return G("video",{ref:Q,src:Z?$:void 0,className:J,muted:!0,playsInline:!0,preload:"metadata",onLoadedMetadata:(q)=>{let X=q.currentTarget;if(Number.isFinite(X.duration)&&X.duration>0.1)X.currentTime=0.1},onError:(q)=>{q.currentTarget.style.display="none"}})}function Fd({file:$,mediaType:J,isSelected:Q}){let Z=_k($.name,J),q=WB($.name,J)&&!!$.url,X=!q&&Fk($.name,J)&&!!$.url,Y=!q&&!X&&Lk($.name,J);return b("div",{className:b0("relative w-full aspect-square rounded overflow-hidden flex items-center justify-center bg-muted",Q&&"ring-2 ring-primary"),children:[q?G(Vk,{src:$.url,alt:$.name,className:"w-full h-full object-cover"}):X?G(Mk,{src:$.url,className:"w-full h-full object-cover"}):G(Z,{className:`w-6 h-6 ${Y?"text-highlight":"text-muted-foreground"}`}),Q&&G("div",{className:"absolute top-1 right-1",children:G(yY,{className:"w-3.5 h-3.5 text-primary fill-primary-foreground"})})]})}function Vd(){return G("div",{className:"grid grid-cols-4 gap-2 p-2",children:Array.from({length:8},($,J)=>`sk-grid-${J}`).map(($)=>b("div",{className:"space-y-1",children:[G(I2,{className:"w-full aspect-square rounded"}),G(I2,{className:"h-3 w-3/4"}),G(I2,{className:"h-2.5 w-1/2"})]},$))})}function Md(){return G("div",{className:"flex flex-col gap-1 p-2",children:Array.from({length:6},($,J)=>`sk-list-${J}`).map(($)=>b("div",{className:"flex items-center gap-2 h-8",children:[G(I2,{className:"w-6 h-6 rounded shrink-0"}),G(I2,{className:"h-3 flex-1"}),G(I2,{className:"h-3 w-14 shrink-0"})]},$))})}function Dd({subfolder:$,onNavigate:J}){if(!$)return null;let Q=Bd($);return b("div",{className:"flex items-center gap-0.5 px-2 py-0.5 border-b border-border text-[11px] text-muted-foreground flex-wrap",children:[G("button",{type:"button",className:"hover:text-foreground transition-colors",onClick:()=>J(""),children:"…"}),Q.map((Z,q)=>{let X=Q.slice(0,q+1).join("/");return b("span",{className:"flex items-center gap-0.5",children:[G(BY,{className:"w-3 h-3 shrink-0"}),G("button",{type:"button",className:"hover:text-foreground transition-colors truncate max-w-20",onClick:()=>J(X),children:Z})]},X)})]})}function EY({source:$,mediaType:J,localPath:Q,viewMode:Z,sortBy:q,searchQuery:X,value:Y,historySource:z="outputs",onChange:K,onSourceChange:W,initialSubfolder:H,onNavigateSubfolder:B,onAddLocalFile:U,multipleSelection:_,selectionLimit:L,onToggleSelection:F,onVisibleFilesChange:V}){let M=X1(),[D,N]=o1.useState([]),[O,I]=o1.useState(H??""),[k,T]=o1.useState(!0),[A,w]=o1.useState(null),C=o1.useSyncExternalStore(qk,YB,YB),y=GB(Y),x=$==="history"?"history":`${$}|${Q}`,j=o1.useRef(x);o1.useEffect(()=>{let f=j.current;if(j.current=x,f!==x)I(""),N([])},[x]),o1.useEffect(()=>{if($==="local"&&!Q){T(!1);return}T(!0),w(null);let f=!1;return($==="history"?z==="combined"?Zk(J,48,50):jY({source:"outputs",mediaType:J,hours:48,limit:50}):Qk({source:$,mediaType:J,localPath:Q,subfolder:O})).then((G0)=>{if(!f)N(G0)}).catch((G0)=>{if(!f)w(G0 instanceof Error?G0.message:JSON.stringify(G0))}).finally(()=>{if(!f)T(!1)}),()=>{f=!0}},[$,z,J,Q,O,C]);let P=_d(D.filter((f)=>f.type==="dir")),h=Ud(D.filter((f)=>f.type==="file").filter((f)=>f.name.toLowerCase().includes(X.toLowerCase())),q),l=P.filter((f)=>X?f.name.toLowerCase().includes(X.toLowerCase()):!0);if(o1.useEffect(()=>{V(h)},[h,V]),k)return Z==="grid"?G(Vd,{}):G(Md,{});if(A)return G("div",{className:"flex items-center justify-center h-24 text-destructive text-xs",children:M("mediaSelector.error",{msg:A})});let t=l.length===0&&h.length===0,S=h.filter((f)=>y.has(f.path)),J0=(q==="folders"?[...l,...h]:[...h,...l]).filter((f)=>f.type==="dir"||!y.has(f.path));function K0(f){if(f===O)return;N([]),T(!0),V([]),I(f),B?.(f)}function e(f){if($==="history")return f.source_type==="temp"?"temp":"output";return $==="outputs"?"output":$==="local"?"local":"input"}function H0(f){let o=e(f);K(f.path,o==="temp"?"output":o),W?.({filePath:f.path,sourceType:o})}function q0(f,o){let G0=e(f),p=_&&!o&&y.size>=L;return b("div",{role:"button",tabIndex:p?-1:0,"aria-disabled":p,className:b0("relative flex flex-col gap-1 text-left hover:opacity-80 transition-opacity",p&&"cursor-not-allowed opacity-50"),onClick:()=>_?F(f.path,G0==="temp"?"output":G0):H0(f),onKeyDown:(Z0)=>{if(Z0.target!==Z0.currentTarget)return;if(Z0.key!=="Enter"&&Z0.key!==" ")return;if(Z0.preventDefault(),_)F(f.path,G0==="temp"?"output":G0);else H0(f)},children:[G(Fd,{file:f,mediaType:J,isSelected:o&&!_}),_&&G(WJ,{checked:o,disabled:p,"aria-label":M("mediaSelector.selectFile",{name:f.name}),className:"absolute right-1 top-1 z-10 bg-background/80",onClick:(Z0)=>Z0.stopPropagation(),onCheckedChange:()=>F(f.path,G0==="temp"?"output":G0)}),G("span",{className:"text-[10px] truncate leading-tight max-w-full",title:f.name,children:f.name}),G("span",{className:"text-[10px] text-muted-foreground truncate leading-tight max-w-full",children:zk(f,J)})]},f.path)}function E(f,o){let G0=_k(f.name,J),p=WB(f.name,J)&&!!f.url,Z0=!p&&Fk(f.name,J)&&!!f.url,Q0=!p&&!Z0&&Lk(f.name,J),B0=e(f),W0=_&&!o&&y.size>=L;return b("div",{role:"button",tabIndex:W0?-1:0,"aria-disabled":W0,className:b0("flex items-center gap-2 px-2 py-1 text-left hover:bg-accent transition-colors",o&&"bg-accent",W0&&"cursor-not-allowed opacity-50"),onClick:()=>_?F(f.path,B0==="temp"?"output":B0):H0(f),onKeyDown:(L0)=>{if(L0.target!==L0.currentTarget)return;if(L0.key!=="Enter"&&L0.key!==" ")return;if(L0.preventDefault(),_)F(f.path,B0==="temp"?"output":B0);else H0(f)},children:[_&&G(WJ,{checked:o,disabled:W0,"aria-label":M("mediaSelector.selectFile",{name:f.name}),onClick:(L0)=>L0.stopPropagation(),onCheckedChange:()=>F(f.path,B0==="temp"?"output":B0)}),p&&G("div",{className:"w-4 h-4 rounded overflow-hidden shrink-0 bg-muted",children:G(Vk,{src:f.url,alt:f.name,className:"w-full h-full object-cover"})}),Z0&&G("div",{className:"w-4 h-4 rounded overflow-hidden shrink-0 bg-muted",children:G(Mk,{src:f.url,className:"w-full h-full object-cover"})}),Q0&&G("div",{className:"w-4 h-4 rounded flex items-center justify-center bg-[#34d399] shrink-0",children:G(G0,{className:"w-3 h-3 text-white"})}),!p&&!Z0&&!Q0&&G(G0,{className:"w-4 h-4 text-muted-foreground shrink-0"}),G("span",{className:"flex-1 text-xs truncate min-w-0",title:f.name,children:f.name}),G("span",{className:"text-[10px] text-muted-foreground shrink-0",children:zk(f,J)}),o&&!_&&G(yY,{className:"w-3.5 h-3.5 text-primary shrink-0"})]},f.path)}function d(f){return b("button",{type:"button",className:"flex flex-col gap-1 text-left hover:opacity-80 transition-opacity",onClick:()=>K0(f.path),children:[G("div",{className:"relative w-full aspect-square rounded overflow-hidden bg-muted flex items-center justify-center",children:G(zB,{className:"w-6 h-6 text-warning"})}),G("span",{className:"text-[10px] truncate leading-tight max-w-full",title:f.name,children:f.name})]},f.path)}function c(f){return b("button",{type:"button",className:"flex items-center gap-2 px-2 py-1 text-left hover:bg-accent transition-colors",onClick:()=>K0(f.path),children:[G("div",{className:"w-4 h-4 rounded flex items-center justify-center bg-muted shrink-0",children:G(zB,{className:"w-3 h-3 text-warning"})}),G("span",{className:"flex-1 text-xs truncate min-w-0",title:f.name,children:f.name})]},f.path)}function r(f){return f.type==="dir"?d(f):q0(f,y.has(f.path))}function u(f){return f.type==="dir"?c(f):E(f,y.has(f.path))}function m(){return b("div",{className:"grid grid-cols-4 gap-2 p-2 overflow-y-auto flex-1",children:[U&&b("button",{type:"button",className:"flex flex-col gap-1 text-left hover:opacity-80 transition-opacity",onClick:U,children:[G("div",{className:"relative w-full aspect-square rounded overflow-hidden bg-muted flex items-center justify-center border-2 border-dashed border-muted-foreground/50",children:G(z5,{className:"w-6 h-6 text-muted-foreground"})}),G("span",{className:"text-[10px] truncate leading-tight max-w-full text-muted-foreground",children:M("mediaSelector.addLocal")})]},"__add_local__"),S.map((f)=>q0(f,!0)),J0.map(r)]})}function s(){return b("div",{className:"flex flex-col overflow-y-auto flex-1",children:[U&&b("button",{type:"button",className:"flex items-center gap-2 px-2 py-1 text-left hover:bg-accent transition-colors text-muted-foreground",onClick:U,children:[G("div",{className:"w-4 h-4 rounded flex items-center justify-center bg-muted shrink-0",children:G(z5,{className:"w-3 h-3"})}),G("span",{className:"flex-1 text-xs truncate min-w-0",children:M("mediaSelector.addLocal")})]},"__add_local__"),S.map((f)=>E(f,!0)),J0.map(u)]})}return b("div",{className:"flex flex-col flex-1 overflow-hidden",children:[$!=="history"?G(Dd,{subfolder:O,onNavigate:K0}):null,t&&G("div",{className:"flex items-center justify-center h-24 text-muted-foreground text-xs",children:M("mediaSelector.empty")}),!t&&Z==="grid"&&m(),!t&&Z!=="grid"&&s()]})}function V5({value:$,onChange:J,onSourceChange:Q,mediaType:Z="all",defaultTab:q="inputs",slotItems:X=[],historySource:Y="outputs",historyOnly:z=!1,allowMultipleSelection:K=!1,maxSelectionCount:W=9}){let H=X1(),B=Z==="image"||Z==="audio"||Z==="video",U=Xk.get(Z),_=$&&["inputs","outputs","local"].includes(q)?{...U?.subfolders,[q]:Hd($)}:U?.subfolders??{},[L,F]=o1.useState(z?"history":$?q:U?.activeTab??q),[V,M]=o1.useState(_),[D,N]=o1.useState("grid"),[O,I]=o1.useState("name"),[k,T]=o1.useState(""),[A,w]=o1.useState(""),[C,y]=o1.useState(L==="url"?$:""),[x,j]=o1.useState(!1),[P,h]=o1.useState(!1),[l,t]=o1.useState(()=>new Set),[S,i]=o1.useState([]),[J0,K0]=o1.useState(!1),e=o1.useRef(null),H0=o1.useRef(null),q0=Number.isFinite(W)?Math.max(1,Math.floor(W)):9,E=Z==="image"&&K,d=P?[...l].join(FZ):$,c=GB(d),r=o1.useRef(q);o1.useEffect(()=>{if(z)return;if(r.current===q)return;r.current=q,F(q),T("")},[q,z]),o1.useEffect(()=>()=>{if(H0.current!==null)clearTimeout(H0.current)},[]);function u(g,a=V){Xk.set(Z,{activeTab:g,subfolders:a})}function m(g){if(F(g),T(""),i([]),P)t(new Set),h(!1);u(g)}function s(g,a){let I0={...V,[g]:a};M(I0),u(L,I0),T("")}function f(){I((g)=>{if(g==="name")return"date";if(g==="date")return"folders";return"name"})}function o(){let g=Date.now();if(e.current!==null&&g-e.current{H0.current=null,K0(!1)},Yk)}function G0(g,a){J(g,a==="temp"?"output":a),Q?.({filePath:g,sourceType:a})}function p(g){i((a)=>{let I0=a.map((F0)=>F0.path).join(` -`),w0=g.map((F0)=>F0.path).join(` -`);return I0===w0?a:g})}function Z0(){t(new Set([...GB($)].slice(0,q0))),h(!0)}function Q0(){t(new Set),h(!1)}function B0(g){t((a)=>{let I0=new Set(a);if(I0.has(g))I0.delete(g);else if(I0.size{let a=new Set(g);for(let I0 of S){if(a.size>=q0)break;a.add(I0.path)}return a})}function L0(){if(l.size===0)return;let g=L==="outputs"||L==="history"?"output":L==="local"?"local":"input";G0([...l].join(FZ),g),h(!1)}async function _0(){if(x)return;j(!0);try{let g=new globalThis.Image;await new Promise((a,I0)=>{g.onload=a,g.onerror=()=>I0(Error("Image load failed")),g.src=C}),J(C)}catch{await N0()}finally{j(!1)}}async function N0(){try{let g=await fetch("/easy-media/download-url",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:C})});if(!g.ok){ew(H("mediaSelector.urlErrorTitle"),H("mediaSelector.urlErrorNotFound"));return}let a=await g.json();if(a.source_type==="url")J(a.url);else R5("inputs"),J(a.file_name)}catch{J(C)}}function d0(){let g=document.createElement("input");g.type="file";let a=Z==="image"?"image/*":Z==="audio"?"audio/*":Z==="video"?"video/*":"*/*";g.accept=a,g.multiple=!0,g.onchange=async()=>{if(!g.files||g.files.length===0)return;if(g.files.length===1){let w0=g.files[0];try{let F0=await LZ(w0,V.inputs??"");R5("inputs"),J(F0)}catch(F0){console.error("[MediaSelector] upload failed:",F0)}return}let I0=[];for(let w0 of g.files)try{let F0=await LZ(w0,V.inputs??"");I0.push(F0)}catch(F0){console.error("[MediaSelector] upload failed:",F0)}if(I0.length>0)R5("inputs"),J(I0.join(FZ))},g.click()}return G("div",{"data-media-selector":"",className:"flex flex-col w-80 h-80 text-xs select-none",children:b(u4,{value:L,onValueChange:(g)=>m(g),className:"flex flex-col flex-1 overflow-hidden",children:[G(r9,{className:"w-full rounded-none rounded-t-md h-7 p-0.5 gap-0.5 shrink-0",children:z?G(W8,{value:"history",className:"flex-1 h-full text-[11px] px-1",children:H("mediaSelector.tabHistory")}):b(W1,{children:[G(W8,{value:"inputs",className:"flex-1 h-full text-[11px] px-1",children:H("mediaSelector.tabInputs")}),G(W8,{value:"outputs",className:"flex-1 h-full text-[11px] px-1",children:H("mediaSelector.tabOutputs")}),G(W8,{value:"history",className:"flex-1 h-full text-[11px] px-1",children:H("mediaSelector.tabHistory")}),G(W8,{value:"url",className:"flex-1 h-full text-[11px] px-1",children:H("mediaSelector.tabUrl")}),B&&G(W8,{value:"slot",className:"flex-1 h-full text-[11px] px-1",children:H("mediaSelector.tabSlot")})]})}),L!=="url"&&L!=="slot"&&b("div",{className:"flex items-center gap-1 px-2 py-1 border-b border-border shrink-0",children:[b("div",{className:"relative flex-1",children:[G(Uk,{className:"absolute left-1.5 top-1/2 -translate-y-1/2 w-3 h-3 text-muted-foreground pointer-events-none"}),G($6,{className:"h-6 pl-6 text-[11px]",placeholder:H("mediaSelector.searchPlaceholder"),value:k,onChange:(g)=>T(g.target.value)})]}),E&&!P&&b(k0,{variant:"ghost",size:"sm",className:"h-6 gap-1 px-1.5 text-[11px]",title:H("mediaSelector.filter"),onClick:Z0,children:[G(KB,{className:"w-3 h-3"}),H("mediaSelector.filter")]}),P?b(W1,{children:[G(k0,{variant:"ghost",size:"icon",className:"h-6 w-6",title:H("mediaSelector.cancelFilter"),onClick:Q0,children:G(KB,{className:"w-3 h-3"})}),G(k0,{variant:"ghost",size:"sm",className:"h-6 px-1.5 text-[11px]",disabled:S.length===0||l.size>=q0,onClick:W0,children:H("mediaSelector.selectAll")}),G(k0,{variant:"ghost",size:"sm",className:"h-6 px-1.5 text-[11px]",disabled:l.size===0,onClick:L0,children:H("mediaSelector.confirm")})]}):null,G(k0,{variant:"ghost",size:"icon",className:"h-6 w-6",title:H("mediaSelector.sort",{by:H(Ld(O))}),onClick:f,children:G(Kk,{className:"w-3 h-3"})}),!P&&G(k0,{variant:"ghost",size:"icon",className:"h-6 w-6",title:H(D==="grid"?"mediaSelector.viewList":"mediaSelector.viewGrid"),onClick:()=>N((g)=>g==="grid"?"list":"grid"),children:D==="grid"?G(Hk,{className:"w-3 h-3"}):G(Wk,{className:"w-3 h-3"})}),G(k0,{variant:"ghost",size:"icon",className:"h-6 w-6",title:H("mediaSelector.refresh"),"aria-label":H("mediaSelector.refresh"),disabled:J0,onClick:o,children:G(PY,{className:"w-3 h-3"})})]}),G(E9,{value:"inputs",className:"mt-0 flex-1 overflow-hidden flex flex-col",children:G(EY,{source:"inputs",mediaType:Z,localPath:"",viewMode:D,sortBy:O,searchQuery:k,value:d,onChange:(g)=>G0(g,"input"),initialSubfolder:V.inputs,onNavigateSubfolder:(g)=>s("inputs",g),onAddLocalFile:d0,multipleSelection:P,selectionLimit:q0,onToggleSelection:B0,onVisibleFilesChange:p})}),G(E9,{value:"outputs",className:"mt-0 flex-1 overflow-hidden flex flex-col",children:G(EY,{source:"outputs",mediaType:Z,localPath:"",viewMode:D,sortBy:O,searchQuery:k,value:d,onChange:(g)=>G0(g,"output"),initialSubfolder:V.outputs,onNavigateSubfolder:(g)=>s("outputs",g),multipleSelection:P,selectionLimit:q0,onToggleSelection:B0,onVisibleFilesChange:p})}),G(E9,{value:"history",className:"mt-0 flex-1 overflow-hidden flex flex-col",children:G(EY,{source:"history",mediaType:Z,localPath:"",viewMode:D,sortBy:O,searchQuery:k,value:d,historySource:Y,onChange:(g,a)=>G0(g,a),onSourceChange:Q,initialSubfolder:"",multipleSelection:P,selectionLimit:q0,onToggleSelection:B0,onVisibleFilesChange:p})}),b(E9,{value:"local",className:"mt-0 flex-1 overflow-hidden flex flex-col",children:[G("div",{className:"flex gap-1 px-2 pt-1 pb-1 border-b border-border",children:G($6,{className:"h-6 text-[11px] flex-1",placeholder:H("mediaSelector.localPathPlaceholder"),value:A,onChange:(g)=>w(g.target.value)})}),G(EY,{source:"local",mediaType:Z,localPath:A,viewMode:D,sortBy:O,searchQuery:k,value:d,onChange:(g)=>G0(g,"local"),initialSubfolder:V.local,onNavigateSubfolder:(g)=>s("local",g),multipleSelection:P,selectionLimit:q0,onToggleSelection:B0,onVisibleFilesChange:p})]}),G(E9,{value:"url",className:"mt-0 flex-1 p-2",children:b("div",{className:"space-y-2",children:[G("p",{className:"text-muted-foreground text-[11px]",children:H("mediaSelector.urlHint")}),G($6,{className:"h-7 text-[11px]",placeholder:"https://...",value:C,onChange:(g)=>y(g.target.value),onKeyDown:(g)=>{if(g.key==="Enter")_0()}}),G(k0,{size:"sm",className:"h-6 text-[11px] w-full",disabled:!C.startsWith("http")||x,onClick:_0,children:x?H("mediaSelector.urlChecking"):H("mediaSelector.urlConfirm")})]})}),B&&G(E9,{value:"slot",className:"mt-0 flex-1 overflow-hidden flex flex-col",children:X.length===0?G("div",{className:"flex-1 flex items-center justify-center text-muted-foreground text-[11px]",children:H("mediaSelector.slotEmpty")}):G("div",{className:"flex flex-col overflow-y-auto flex-1",children:X.map((g,a)=>({item:g,index:a})).sort((g,a)=>Number(c.has(a.item.value))-Number(c.has(g.item.value))).map(({item:g,index:a})=>{let I0=c.has(g.value),w0=g.value.startsWith("__slot__:image"),F0=g.value.startsWith("__slot__:audio"),u0=g.value.startsWith("__slot__:video"),P0=w0?H("mediaSelector.slotImage",{n:a+1}):F0?H("mediaSelector.slotAudio",{n:a+1}):u0?H("mediaSelector.slotVideo",{n:a+1}):g.label;return b("button",{type:"button",className:b0("flex items-center gap-2 px-2 py-1 text-left hover:bg-accent transition-colors",I0&&"bg-accent"),onClick:()=>J(g.value),children:[g.img?G("img",{src:g.img,alt:P0,className:"w-8 h-8 object-cover rounded shrink-0 bg-muted"}):F0?G("div",{className:"w-8 h-8 rounded flex items-center justify-center bg-[#34d399] shrink-0",children:G(UJ,{className:"w-4 h-4 text-white"})}):u0?G("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded bg-muted",children:G(_J,{className:"h-4 w-4 text-muted-foreground"})}):G(Bk,{className:"w-3.5 h-3.5 text-muted-foreground shrink-0"}),G("span",{className:"flex-1 text-xs truncate min-w-0",children:P0}),F0&&g.audio_name&&G("span",{className:"text-[10px] text-muted-foreground truncate max-w-24",title:g.audio_name,children:g.audio_name}),I0&&G(yY,{className:"w-3.5 h-3.5 text-primary shrink-0"})]},g.value)})})})]})})}function HB($){if($.url)return $.url;if($.local_path)return $.local_path;if($.file_path){if(/^https?:\/\//i.test($.file_path))return $.file_path;let J=Math.max($.file_path.lastIndexOf("/"),$.file_path.lastIndexOf("\\")),Q=J>=0?$.file_path.slice(J+1):$.file_path,Z=J>=0?$.file_path.slice(0,J):"",q=$.source_type==="output"||$.source_type==="local"?$.source_type:"input";return`/view?filename=${encodeURIComponent(Q)}&type=${q}&subfolder=${encodeURIComponent(Z)}`}return null}function Dk($,J="input"){return{source_type:J,file_path:$,file_name:$.split("/").pop()??$}}function Nk($){return{source_type:"url",url:$,file_name:$.split("/").pop()??$}}function Ok($){let J=$.map((Q)=>HB(Q)).filter((Q)=>Q!==null);if(J.length===0)return{};return{backgroundImage:J.map((Q)=>`url("${Q.replaceAll('"',"%22")}")`).join(", "),backgroundRepeat:"repeat",backgroundSize:J.map(()=>"auto 100%").join(", "),backgroundPosition:"0 0"}}function BB({position:$,onClick:J,disabled:Q}){let Z=X1();return G("button",{type:"button","aria-label":$==="left"?Z("insertButton.insertBefore"):Z("insertButton.insertAfter"),className:"flex items-center opacity-80 hover:opacity-100 transition-opacity cursor-pointer select-none disabled:opacity-20",onClick:(q)=>{q.stopPropagation(),J()},disabled:Q,style:{padding:0,border:"none",background:"none"},children:G("span",{className:"inline-flex items-center justify-center rounded-full bg-foreground shrink-0",style:{width:10,height:10},children:G(z5,{className:"w-2 h-2 text-background"})})})}var s9=R(v(),1);var Nd=8,Od=12;function Ad($,J,Q,Z){let q=Z/Math.max(Q-1,1),X=$*q,Y=Math.min((J+1)*q,Z);return{left:X,width:Math.max(Y-X,2)}}function wd($,J=0.3){if(!$.startsWith("#")||$.length<7)return"var(--border)";let Q=Number.parseInt($.slice(1,3),16),Z=Number.parseInt($.slice(3,5),16),q=Number.parseInt($.slice(5,7),16),X=Math.round(Q+(255-Q)*J),Y=Math.round(Z+(255-Z)*J),z=Math.round(q+(255-q)*J);return`#${X.toString(16).padStart(2,"0")}${Y.toString(16).padStart(2,"0")}${z.toString(16).padStart(2,"0")}`}var RY=s9.default.forwardRef(function({segment:J,totalFrames:Q,areaWidth:Z,interactive:q=!0,hideLeftHandle:X=!1,disableLeftResize:Y=!1,minStart:z=0,selected:K=!1,onClick:W,onDoubleClick:H,onSelect:B,onContextMenu:U,onDragEnd:_,onResizeEnd:L,children:F,backgroundSlot:V,className:M,bgStyle:D,frameRate:N,displayFormat:O},I){let k=X1(),[T,A]=s9.useState(!1),w=s9.useRef(null);function C(){if(A(!0),w.current)clearTimeout(w.current)}function y(){if(w.current)clearTimeout(w.current);w.current=setTimeout(()=>A(!1),1500)}let{left:x,width:j}=Ad(J.start_frame,J.end_frame,Q,Z),P=s9.useRef(null),h=s9.useRef(!1),[l,t]=s9.useState(!1),[S,i]=s9.useState(null);function J0(){return K?Od:Nd}function K0(E){if(!q)return;let d=E.currentTarget.getBoundingClientRect(),c=E.clientX-d.left,r=J0(),u=c<=r&&!Y,m=c>=d.width-r;if(u||m)i("ew-resize");else i("grab")}function e(){i(null)}function H0(E){if(!q)return;E.preventDefault(),h.current=!1;let d=Z/Math.max(Q-1,1),c=E.clientX,r=J.start_frame,u=E.currentTarget.getBoundingClientRect(),m=E.clientX-u.left,s=J0(),f=m<=s&&!Y,o=m>=u.width-s,G0="move";if(f)G0="start";else if(o)G0="end";if(C(),G0!=="move")t(!0);function p(Q0){let B0=Math.round((Q0.clientX-c)/d);if(B0!==0)h.current=!0;if(G0==="start"&&L)L(J.id,"start",B0,z);else if(G0==="end"&&L)L(J.id,"end",B0);else if(G0==="move"&&_)_(J.id,B0,r)}function Z0(){if(P.current=null,G0!=="move")t(!1);y(),globalThis.removeEventListener("mousemove",p),globalThis.removeEventListener("mouseup",Z0)}globalThis.addEventListener("mousemove",p),globalThis.addEventListener("mouseup",Z0)}function q0(E){return(d)=>{if(!q||!L)return;d.preventDefault(),d.stopPropagation();let c=d.clientX,r=Z/Math.max(Q-1,1);t(!0),C();function u(s){let f=Math.round((s.clientX-c)/r);L?.(J.id,E,f,E==="start"?z:void 0)}function m(){t(!1),y(),globalThis.removeEventListener("mousemove",u),globalThis.removeEventListener("mouseup",m)}globalThis.addEventListener("mousemove",u),globalThis.addEventListener("mouseup",m)}}return b("div",{ref:I,role:"button",tabIndex:0,"data-segment-block":"",className:b0("absolute top-0 h-full flex items-center overflow-hidden rounded select-none active:opacity-70",M),style:{left:x,width:j,backgroundColor:J.color,border:l?"1px solid #eab308":K?"1px solid var(--foreground)":`1px solid ${wd(J.color)}`,cursor:S??(q?"grab":"default"),...D},onMouseDown:H0,onMouseMove:K0,onMouseLeave:e,onClick:(E)=>{if(h.current)return;E.stopPropagation(),C(),y(),B?.(J),W?.(J)},onDoubleClick:()=>H?.(J),onContextMenu:(E)=>U?.(E,J),onKeyDown:(E)=>{if(E.key==="Enter")B?.(J),W?.(J)},children:[V&&G("div",{className:"absolute inset-0 pointer-events-none overflow-hidden rounded z-1",children:V}),T&&N!==void 0&&O!==void 0&&G("div",{className:"absolute top-0.5 left-1 z-20 pointer-events-none",children:G("span",{className:"text-[9px] bg-black/70 text-white px-1 py-px rounded leading-none",children:O==="seconds"?`${(J.start_frame/N).toFixed(1)}s`:`${J.start_frame}f`})}),q&&L&&!X&&G("button",{type:"button","aria-label":k("segmentBlock.resizeStart"),className:"absolute left-0 top-0 h-full w-0.5 cursor-ew-resize z-20",style:{background:l?"#eab308":K?"var(--foreground)":"transparent"},onMouseDown:(E)=>{if(Y)return;q0("start")(E)}}),G("div",{className:"flex-1 overflow-hidden min-w-0 px-1.5 text-xs text-foreground font-medium pointer-events-none",children:F}),q&&L&&G("button",{type:"button","aria-label":k("segmentBlock.resizeEnd"),className:"absolute right-0 top-0 h-full w-0.5 cursor-ew-resize z-20",style:{background:l?"#eab308":K?"var(--foreground)":"transparent"},onMouseDown:(E)=>{E.stopPropagation(),q0("end")(E)}})]})});var Ak=80;function CY({children:$,height:J,grow:Q}){let Z=J??40;return G("div",{className:"flex border-b border-border",style:Q!==void 0?{flexGrow:Q,minHeight:0}:{height:Z,minHeight:Z},children:G("div",{className:"relative flex-1 min-w-0 overflow-x-clip overflow-y-visible",children:$})})}function VZ($){return $*2+1}function kd($,J){if($.length===0)return $;let Q=Math.floor(J/$.length),Z=J%$.length;return $.map((q,X)=>{let Y=X=X&&J<=Y)return{start:X,end:Y}}let Z=$[$.length-1];if(J>Z.end_frame&&Z.end_frameHB(Z)).filter((Z)=>Z!==null);if(J.length===0)return null;let Q=Array.from({length:24},(Z,q)=>J.map((X,Y)=>({src:X,key:`${q}-${Y}`}))).flat();return G("div",{className:"absolute inset-0 bg-black overflow-hidden",children:G("div",{className:"flex h-full w-max",children:Q.map(({src:Z,key:q})=>G("img",{src:Z,alt:"",className:"h-full w-auto max-w-none shrink-0 object-contain",draggable:!1,onError:(X)=>{X.currentTarget.style.display="none"}},q))})})}function jd({seg:$,index:J}){let Q=X1(),Z=$.content,q=Z.images.length>0,X=Z.text.trim().length>0;if(!q)return G("div",{className:"flex items-center justify-center w-full h-full px-1",children:X?G("span",{className:"text-[9px] text-foreground leading-tight line-clamp-3 text-center",children:Z.text}):b("div",{className:"flex flex-col gap-1",children:[G("span",{className:"text-[9px] text-foreground leading-tight truncate text-center",children:Q("maintainTrack.segmentLabel",{n:J+1})}),G("span",{className:"text-[8px] text-muted-foreground leading-tight truncate text-center",children:Q("maintainTrack.segmentPlaceholder")})]})});return G(W1,{children:X&&G("div",{className:"absolute bottom-0 left-0 right-0 px-1 pb-0.5 pointer-events-none z-10 bg-black",children:G("span",{className:"block text-[9px] leading-tight truncate text-white drop-shadow",children:Z.text})})})}function wk({track:$,totalFrames:J,frameRate:Q,displayFormat:Z,areaWidth:q,canvasScale:X=1,selectedId:Y,onSelectedIdChange:z,onTrackChange:K,onSegmentsChange:W,onExtendTimeline:H,grow:B}){let U=X1(),_=m4.useRef(null),[L,F]=m4.useState(null),[V,M]=m4.useState(null),[D,N]=m4.useState(!1),[O,I]=m4.useState({x:0,y:0}),[k,T]=m4.useState(""),A=m4.useRef(null),w=$.segments;function C(E){let d=_.current?.getBoundingClientRect();if(!d)return;let c=E.clientX-d.left;if(w.length===0)return;if(!e(c))z(null)}function y(E){let d=_.current?.getBoundingClientRect();if(!d||$.locked)return;let c=E.clientX-d.left,r=q/Math.max(J-1,1),u=Math.round(c/r);if(w.length===0){W([{id:x1(),start_frame:0,end_frame:J-1,content:{text:"",images:[],type:"flf"},color:$.color}]);return}if(w.find((o)=>u>=o.start_frame&&u<=o.end_frame))return;let s=[...w].sort((o,G0)=>o.start_frame-G0.start_frame),f=Td(s,u,J);if(!f)return;W([...w,{id:x1(),start_frame:f.start,end_frame:f.end,content:{text:"",images:[],type:"flf"},color:$.color}])}function x(E,d,c){let r=w.find((Q0)=>Q0.id===E);if(!r)return;let u=r.end_frame-r.start_frame,m=Math.max(0,c+d),s=Math.min(J-1,m+u),f=s-u,G0=[...w.map((Q0)=>Q0.id===E?{...Q0,start_frame:f,end_frame:s}:Q0)].sort((Q0,B0)=>Q0.start_frame+Q0.end_frame-(B0.start_frame+B0.end_frame)),p=[...w].sort((Q0,B0)=>Q0.start_frame-B0.start_frame).map((Q0)=>({start_frame:Q0.start_frame,end_frame:Q0.end_frame})),Z0=G0.map((Q0,B0)=>({...Q0,start_frame:p[B0].start_frame,end_frame:p[B0].end_frame}));W(Z0)}function j(E,d,c){if($.locked)return;let r=w.findIndex((s)=>s.id===E);if(r===-1)return;let u=w[r],m=[...w];if(d==="end")P(m,r,u,c);else h(m,r,u,c);W(m)}function P(E,d,c,r){let u=E[d+1],m=c.start_frame+1,s=Math.max(m,Math.min(c.end_frame+r,J-1));if(E[d]=l(c,c.start_frame,s),u){let f=s+1;if(u.start_frame!==f){let o=f-u.start_frame;E[d+1]={...u,start_frame:f,end_frame:u.end_frame+o};for(let G0=d+2;G0c.start_frame-r.start_frame);if(E.length===0||E[0].start_frame>0)return{start:0,end:E.length>0?E[0].start_frame-1:J-1};for(let c=0;cZ0.id===Y);if(d===-1)return;let c=w[d],r=VZ(Q),u=E==="left"?c.start_frame:c.end_frame+1,m=E==="left"?d:d+1,s={id:x1(),start_frame:u,end_frame:u+r-1,content:{text:"",images:[],type:"flf"},color:$.color},f=w.map((Z0,Q0)=>{if(Q0J&&H)H(o,p);else W(o);z(s.id)}function i(E){if($.locked)return;let d=[...w].sort((Z0,Q0)=>Z0.start_frame-Q0.start_frame),c=d.findIndex((Z0)=>Z0.id===E);if(c===-1)return;let r=d[c],u=r.end_frame-r.start_frame+1,m=r.end_frame+1,s={...structuredClone(r),id:x1(),start_frame:m,end_frame:m+u-1,color:$.color},f=[],o=s.end_frame+1;for(let Z0 of d.slice(c+1)){let Q0=Z0.end_frame-Z0.start_frame+1;f.push({...Z0,start_frame:o,end_frame:o+Q0-1}),o+=Q0}let G0=[...d.slice(0,c+1),s,...f],p=J+u;if(H)H(G0,p);else W(G0);z(s.id)}function J0(){if(w.length===0){W([{id:x1(),start_frame:0,end_frame:J-1,content:{text:"",images:[],type:"flf"},color:$.color}]);return}let E=t();if(E){W([...w,{id:x1(),start_frame:E.start,end_frame:E.end,content:{text:"",images:[],type:"flf"},color:$.color}].sort((s,f)=>s.start_frame-f.start_frame));return}let d=w.at(-1),c=VZ(Q),r=d.end_frame+1,u=r+c-1,m={id:x1(),start_frame:r,end_frame:u,content:{text:"",images:[],type:"flf"},color:$.color};if(W([...w,m]),H)H([...w,m],u+1)}function K0(E){let d=w.findIndex((m)=>m.id===E);if(d===-1)return;if(w.length===1){if(W([]),Y===E)z(null);return}let c=w[d],r=c.end_frame-c.start_frame+1,u=w.map((m,s)=>{if(s===d)return null;let f={...m};if(s>d)f.start_frame=m.start_frame-r,f.end_frame=m.end_frame-r;return f}).filter((m)=>m!==null);if(d>0)u[d-1]={...u[d-1],end_frame:c.start_frame-1};if(W(u),Y===E)z(null)}function e(E){let d=q/Math.max(J-1,1),c=Math.round(E/d);return w.find((r)=>c>=r.start_frame&&c<=r.end_frame)??null}function H0(E){if(E.dataTransfer.types.includes("Files")){E.preventDefault();let d=E.currentTarget.getBoundingClientRect(),c=(E.clientX-d.left)/X;M(Math.round(c/q*(J-1)))}}async function q0(E){E.preventDefault();let d=new Set([".png",".jpg",".jpeg",".webp",".gif",".bmp",".tiff",".tif"]),c=Array.from(E.dataTransfer.files).filter((Z0)=>{if(Z0.type.startsWith("image/"))return!0;let Q0=`.${Z0.name.split(".").pop()?.toLowerCase()??""}`;return d.has(Q0)});if(c.length===0){M(null);return}let r=[];for(let Z0 of c)try{let Q0=await Id(Z0);r.push(Q0)}catch(Q0){console.error("[MaintainTrack] upload failed:",Q0)}if(r.length===0){M(null);return}if(R5("inputs"),w.length===0){let Z0=Math.floor(J/r.length),Q0=J%r.length,B0=[],W0=0;for(let L0=0;L0J-1)break;let _0=Math.min(m,J-Q0);Z0.push({id:x1(),start_frame:Q0,end_frame:Q0+_0-1,content:{text:"",images:[{source_type:"input",file_path:L0,file_name:L0.split("/").pop()??L0}],type:"flf"},color:$.color}),Q0+=m}let B0=[...w,...Z0].sort((L0,_0)=>L0.start_frame-_0.start_frame);W(B0);let W0=Z0[Z0.length-1];if(W0&&H)H(B0,W0.end_frame+1);M(null);return}let s=w[w.length-1],f=[],o=s.end_frame+1;for(let Z0 of r)f.push({id:x1(),start_frame:o,end_frame:o+m-1,content:{text:"",images:[{source_type:"input",file_path:Z0,file_name:Z0.split("/").pop()??Z0}],type:"flf"},color:$.color}),o+=m;let G0=[...w,...f];W(G0);let p=f[f.length-1];if(H)H(G0,p.end_frame+1);M(null)}return b(CY,{track:$,onTrackChange:K,height:B===void 0?Ak:void 0,grow:B,children:[b(o6,{children:[G(n6,{className:"relative block w-full h-full",asChild:!0,children:b("section",{ref:_,"aria-label":U("maintainTrack.dropZone"),className:"relative w-full h-full",onDragOver:H0,onDragLeave:()=>M(null),onDrop:q0,onClick:C,onDoubleClick:y,children:[w.map((E,d)=>G(RY,{segment:E,totalFrames:J,areaWidth:q,interactive:!$.locked,hideLeftHandle:!1,disableLeftResize:d===0,selected:Y===E.id,onSelect:(c)=>z(Y===c.id?null:c.id),onDragEnd:x,onResizeEnd:j,frameRate:Q,displayFormat:Z,onContextMenu:(c,r)=>{F(r.id),z(r.id)},onDoubleClick:(c)=>{A.current=c.id,setTimeout(()=>{A.current=null},100)},backgroundSlot:E.content.images.length>0?G(bd,{images:E.content.images}):void 0,children:G(jd,{seg:E,index:d})},E.id)),Y&&!$.locked&&(()=>{let E=w.findIndex((u)=>u.id===Y);if(E===-1)return null;let d=w[E],c=d.start_frame/Math.max(J-1,1)*q,r=(d.end_frame+1)/Math.max(J-1,1)*q;return b(W1,{children:[G("div",{className:"absolute pointer-events-auto",style:{left:E==0?c+10:c,top:-16,transform:"translate(-50%, 0)",zIndex:25},children:G(BB,{position:"left",onClick:()=>S("left")})}),G("div",{className:"absolute pointer-events-auto",style:{left:E>=w.length-1||w.length==1?r-10:r,top:-16,transform:"translate(-50%, 0)",zIndex:25},children:G(BB,{position:"right",onClick:()=>S("right")})})]})})(),w.length===0?b(o6,{children:[G(n6,{asChild:!0,children:b("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-muted-foreground select-none opacity-40",children:[b("div",{className:"flex items-center gap-1",children:[G(z5,{className:"w-3 h-3"}),G("span",{className:"text-[11px]",children:U("maintainTrack.placeholder")})]}),G("span",{className:"text-[10px]",children:U("maintainTrack.placeholderHint")})]})}),b(E6,{children:[G(J5,{onClick:J0,children:U("maintainTrack.contextAdd")}),G(J5,{onClick:()=>{I({x:0,y:60}),T(""),N(!0)},children:U("maintainTrack.addMedia")})]})]}):G("div",{className:"hidden"}),V!==null&&G("div",{className:"absolute top-0 w-0.5 h-full bg-foreground/60 pointer-events-none",style:{left:V/Math.max(J-1,1)*q}})]})}),b(E6,{onCloseAutoFocus:()=>F(null),children:[G(J5,{onClick:()=>W(kd(w,J)),children:U("maintainTrack.contextDistribute")}),G(J5,{onClick:J0,children:U("maintainTrack.contextAdd")}),L&&b(W1,{children:[G(J5,{onClick:()=>{i(L),F(null)},children:U("maintainTrack.contextClone")}),G(J5,{onClick:()=>{K0(L),F(null)},children:U("maintainTrack.contextDelete")})]})]})]}),b(a1,{open:D,onOpenChange:N,children:[G(_6,{asChild:!0,children:G("span",{className:"absolute w-0 h-0 pointer-events-none",style:{left:O.x,top:O.y}})}),G(s1,{"data-add-popover":"",className:"p-0 w-auto",side:"bottom",align:"start",onOpenAutoFocus:(E)=>E.preventDefault(),children:G(V5,{value:k,onChange:(E,d)=>{if(!E){N(!1);return}let r=E.includes("|MULTIPLE|")?E.split("|MULTIPLE|"):[E],u=d??"input";if(w.length===0){let p=[],Z0=0;for(let Q0=0;Q0J-1)break;let W0=r[B0],L0=W0.split("/").pop()??W0,_0=W0.startsWith("http"),N0=Math.min(p,J-Q0);Z0.push({id:x1(),start_frame:Q0,end_frame:Q0+N0-1,content:{text:"",images:[{source_type:_0?"url":u,file_path:_0?void 0:W0,url:_0?W0:void 0,file_name:L0}],type:"flf"},color:$.color}),Q0+=p}W([...w,...Z0].sort((B0,W0)=>B0.start_frame-W0.start_frame)),N(!1);return}let s=w[w.length-1],f=VZ(Q),o=[],G0=s.end_frame+1;for(let p=0;p{let Q=!1,Z=$.map((q)=>{let X=kk(q,J);if(!Q&&typeof X=="function")Q=!0;return X});if(Q)return()=>{for(let q=0;q{let{children:Y,...z}=X,K=Q9.useMemo(()=>z,Object.values(z));return G(Q.Provider,{value:K,children:Y})};Z.displayName=$+"Provider";function q(X){let Y=Q9.useContext(Q);if(Y)return Y;if(J!==void 0)return J;throw Error(`\`${X}\` must be used within \`${$}\``)}return[Z,q]}function bk($,J=[]){let Q=[];function Z(X,Y){let z=Q9.createContext(Y),K=Q.length;Q=[...Q,Y];let W=(B)=>{let{scope:U,children:_,...L}=B,F=U?.[$]?.[K]||z,V=Q9.useMemo(()=>L,Object.values(L));return G(F.Provider,{value:V,children:_})};W.displayName=X+"Provider";function H(B,U){let _=U?.[$]?.[K]||z,L=Q9.useContext(_);if(L)return L;if(Y!==void 0)return Y;throw Error(`\`${B}\` must be used within \`${X}\``)}return[W,H]}let q=()=>{let X=Q.map((Y)=>{return Q9.createContext(Y)});return function(z){let K=z?.[$]||X;return Q9.useMemo(()=>({[`__scope${$}`]:{...z,[$]:K}}),[z,K])}};return q.scopeName=$,[Z,Ed(q,...J)]}function Ed(...$){let J=$[0];if($.length===1)return J;let Q=()=>{let Z=$.map((q)=>({useScope:q(),scopeName:q.scopeName}));return function(X){let Y=Z.reduce((z,{useScope:K,scopeName:W})=>{let B=K(X)[`__scope${W}`];return{...z,...B}},{});return Q9.useMemo(()=>({[`__scope${J.scopeName}`]:Y}),[Y])}};return Q.scopeName=J.scopeName,Q}var Z9=R(v(),1);var SY=R(v(),1);var yd=Z9[" useInsertionEffect ".trim().toString()]||L1;function jk({prop:$,defaultProp:J,onChange:Q=()=>{},caller:Z}){let[q,X,Y]=Pd({defaultProp:J,onChange:Q}),z=$!==void 0,K=z?$:q;{let H=Z9.useRef($!==void 0);Z9.useEffect(()=>{let B=H.current;if(B!==z)console.warn(`${Z} is changing from ${B?"controlled":"uncontrolled"} to ${z?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`);H.current=z},[z,Z])}let W=Z9.useCallback((H)=>{if(z){let B=Rd(H)?H($):H;if(B!==$)Y.current?.(B)}else X(H)},[z,$,X,Y]);return[K,W]}function Pd({defaultProp:$,onChange:J}){let[Q,Z]=Z9.useState($),q=Z9.useRef(Q),X=Z9.useRef(J);return yd(()=>{X.current=J},[J]),Z9.useEffect(()=>{if(q.current!==Q)X.current?.(Q),q.current=Q},[Q,q]),[Q,Z,X]}function Rd($){return typeof $==="function"}var n$0=Symbol("RADIX:SYNC_STATE");var F6=R(v(),1);var Ek=R(v(),1);function Cd($,J){return Ek.useReducer((Q,Z)=>{return J[Q][Z]??Q},$)}var DZ=($)=>{let{present:J,children:Q}=$,Z=Sd(J),q=typeof Q==="function"?Q({present:Z.isPresent}):F6.Children.only(Q),X=VJ(Z.ref,hd(q));return typeof Q==="function"||Z.isPresent?F6.cloneElement(q,{ref:X}):null};DZ.displayName="Presence";function Sd($){let[J,Q]=F6.useState(),Z=F6.useRef(null),q=F6.useRef($),X=F6.useRef("none"),Y=$?"mounted":"unmounted",[z,K]=Cd(Y,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return F6.useEffect(()=>{let W=hY(Z.current);X.current=z==="mounted"?W:"none"},[z]),L1(()=>{let W=Z.current,H=q.current;if(H!==$){let U=X.current,_=hY(W);if($)K("MOUNT");else if(_==="none"||W?.display==="none")K("UNMOUNT");else if(H&&U!==_)K("ANIMATION_OUT");else K("UNMOUNT");q.current=$}},[$,K]),L1(()=>{if(J){let W,H=J.ownerDocument.defaultView??window,B=(_)=>{let F=hY(Z.current).includes(CSS.escape(_.animationName));if(_.target===J&&F){if(K("ANIMATION_END"),!q.current){let V=J.style.animationFillMode;J.style.animationFillMode="forwards",W=H.setTimeout(()=>{if(J.style.animationFillMode==="forwards")J.style.animationFillMode=V})}}},U=(_)=>{if(_.target===J)X.current=hY(Z.current)};return J.addEventListener("animationstart",U),J.addEventListener("animationcancel",B),J.addEventListener("animationend",B),()=>{H.clearTimeout(W),J.removeEventListener("animationstart",U),J.removeEventListener("animationcancel",B),J.removeEventListener("animationend",B)}}else K("ANIMATION_END")},[J,K]),{isPresent:["mounted","unmountSuspended"].includes(z),ref:F6.useCallback((W)=>{Z.current=W?getComputedStyle(W):null,Q(W)},[])}}function hY($){return $?.animationName||"none"}function hd($){let J=Object.getOwnPropertyDescriptor($.props,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning;if(Q)return $.ref;if(J=Object.getOwnPropertyDescriptor($,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning,Q)return $.props.ref;return $.props.ref||$.ref}var yk=R(v(),1),md=R($5(),1);var H8=R(v(),1);function xY($){let J=xd($),Q=H8.forwardRef((Z,q)=>{let{children:X,...Y}=Z,z=H8.Children.toArray(X),K=z.find(vd);if(K){let W=K.props.children,H=z.map((B)=>{if(B===K){if(H8.Children.count(W)>1)return H8.Children.only(null);return H8.isValidElement(W)?W.props.children:null}else return B});return G(J,{...Y,ref:q,children:H8.isValidElement(W)?H8.cloneElement(W,void 0,H):null})}return G(J,{...Y,ref:q,children:X})});return Q.displayName=`${$}.Slot`,Q}function xd($){let J=H8.forwardRef((Q,Z)=>{let{children:q,...X}=Q;if(H8.isValidElement(q)){let Y=ud(q),z=gd(X,q.props);if(q.type!==H8.Fragment)z.ref=Z?UB(Z,Y):Y;return H8.cloneElement(q,z)}return H8.Children.count(q)>1?H8.Children.only(null):null});return J.displayName=`${$}.SlotClone`,J}var fd=Symbol("radix.slottable");function vd($){return H8.isValidElement($)&&typeof $.type==="function"&&"__radixId"in $.type&&$.type.__radixId===fd}function gd($,J){let Q={...J};for(let Z in J){let q=$[Z],X=J[Z];if(/^on[A-Z]/.test(Z)){if(q&&X)Q[Z]=(...z)=>{let K=X(...z);return q(...z),K};else if(q)Q[Z]=q}else if(Z==="style")Q[Z]={...q,...X};else if(Z==="className")Q[Z]=[q,X].filter(Boolean).join(" ")}return{...$,...Q}}function ud($){let J=Object.getOwnPropertyDescriptor($.props,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning;if(Q)return $.ref;if(J=Object.getOwnPropertyDescriptor($,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning,Q)return $.props.ref;return $.props.ref||$.ref}var cd=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],MJ=cd.reduce(($,J)=>{let Q=xY(`Primitive.${J}`),Z=yk.forwardRef((q,X)=>{let{asChild:Y,...z}=q,K=Y?Q:J;if(typeof window<"u")window[Symbol.for("radix-ui")]=!0;return G(K,{...z,ref:X})});return Z.displayName=`Primitive.${J}`,{...$,[J]:Z}},{});var vY="Dialog",[Pk,AJ0]=bk(vY),[dd,y9]=Pk(vY),Rk=($)=>{let{__scopeDialog:J,children:Q,open:Z,defaultOpen:q,onOpenChange:X,modal:Y=!0}=$,z=U5.useRef(null),K=U5.useRef(null),[W,H]=jk({prop:Z,defaultProp:q??!1,onChange:X,caller:vY});return G(dd,{scope:J,triggerRef:z,contentRef:K,contentId:a5(),titleId:a5(),descriptionId:a5(),open:W,onOpenChange:H,onOpenToggle:U5.useCallback(()=>H((B)=>!B),[H]),modal:Y,children:Q})};Rk.displayName=vY;var Ck="DialogTrigger",pd=U5.forwardRef(($,J)=>{let{__scopeDialog:Q,...Z}=$,q=y9(Ck,Q),X=VJ(J,q.triggerRef);return G(MJ.button,{type:"button","aria-haspopup":"dialog","aria-expanded":q.open,"aria-controls":q.contentId,"data-state":FB(q.open),...Z,ref:X,onClick:FJ($.onClick,q.onOpenToggle)})});pd.displayName=Ck;var _B="DialogPortal",[ld,Sk]=Pk(_B,{forceMount:void 0}),hk=($)=>{let{__scopeDialog:J,forceMount:Q,children:Z,container:q}=$,X=y9(_B,J);return G(ld,{scope:J,forceMount:Q,children:U5.Children.map(Z,(Y)=>G(DZ,{present:Q||X.open,children:G(k9,{asChild:!0,container:q,children:Y})}))})};hk.displayName=_B;var fY="DialogOverlay",xk=U5.forwardRef(($,J)=>{let Q=Sk(fY,$.__scopeDialog),{forceMount:Z=Q.forceMount,...q}=$,X=y9(fY,$.__scopeDialog);return X.modal?G(DZ,{present:Z||X.open,children:G(rd,{...q,ref:J})}):null});xk.displayName=fY;var id=xY("DialogOverlay.RemoveScroll"),rd=U5.forwardRef(($,J)=>{let{__scopeDialog:Q,...Z}=$,q=y9(fY,Q);return G(I4,{as:id,allowPinchZoom:!0,shards:[q.contentRef],children:G(MJ.div,{"data-state":FB(q.open),...Z,ref:J,style:{pointerEvents:"auto",...Z.style}})})}),T2="DialogContent",fk=U5.forwardRef(($,J)=>{let Q=Sk(T2,$.__scopeDialog),{forceMount:Z=Q.forceMount,...q}=$,X=y9(T2,$.__scopeDialog);return G(DZ,{present:Z||X.open,children:X.modal?G(sd,{...q,ref:J}):G(od,{...q,ref:J})})});fk.displayName=T2;var sd=U5.forwardRef(($,J)=>{let Q=y9(T2,$.__scopeDialog),Z=U5.useRef(null),q=VJ(J,Q.contentRef,Z);return U5.useEffect(()=>{let X=Z.current;if(X)return L7(X)},[]),G(vk,{...$,ref:q,trapFocus:Q.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:FJ($.onCloseAutoFocus,(X)=>{X.preventDefault(),Q.triggerRef.current?.focus()}),onPointerDownOutside:FJ($.onPointerDownOutside,(X)=>{let Y=X.detail.originalEvent,z=Y.button===0&&Y.ctrlKey===!0;if(Y.button===2||z)X.preventDefault()}),onFocusOutside:FJ($.onFocusOutside,(X)=>X.preventDefault())})}),od=U5.forwardRef(($,J)=>{let Q=y9(T2,$.__scopeDialog),Z=U5.useRef(!1),q=U5.useRef(!1);return G(vk,{...$,ref:J,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:(X)=>{if($.onCloseAutoFocus?.(X),!X.defaultPrevented){if(!Z.current)Q.triggerRef.current?.focus();X.preventDefault()}Z.current=!1,q.current=!1},onInteractOutside:(X)=>{if($.onInteractOutside?.(X),!X.defaultPrevented){if(Z.current=!0,X.detail.originalEvent.type==="pointerdown")q.current=!0}let Y=X.target;if(Q.triggerRef.current?.contains(Y))X.preventDefault();if(X.detail.originalEvent.type==="focusin"&&q.current)X.preventDefault()}})}),vk=U5.forwardRef(($,J)=>{let{__scopeDialog:Q,trapFocus:Z,onOpenAutoFocus:q,onCloseAutoFocus:X,...Y}=$,z=y9(T2,Q),K=U5.useRef(null),W=VJ(J,K);return G7(),b(W1,{children:[G(O4,{asChild:!0,loop:!0,trapped:Z,onMountAutoFocus:q,onUnmountAutoFocus:X,children:G(O9,{role:"dialog",id:z.contentId,"aria-describedby":z.descriptionId,"aria-labelledby":z.titleId,"data-state":FB(z.open),...Y,ref:W,onDismiss:()=>z.onOpenChange(!1)})}),b(W1,{children:[G(nd,{titleId:z.titleId}),G(td,{contentRef:K,descriptionId:z.descriptionId})]})]})}),LB="DialogTitle",gk=U5.forwardRef(($,J)=>{let{__scopeDialog:Q,...Z}=$,q=y9(LB,Q);return G(MJ.h2,{id:q.titleId,...Z,ref:J})});gk.displayName=LB;var uk="DialogDescription",mk=U5.forwardRef(($,J)=>{let{__scopeDialog:Q,...Z}=$,q=y9(uk,Q);return G(MJ.p,{id:q.descriptionId,...Z,ref:J})});mk.displayName=uk;var ck="DialogClose",dk=U5.forwardRef(($,J)=>{let{__scopeDialog:Q,...Z}=$,q=y9(ck,Q);return G(MJ.button,{type:"button",...Z,ref:J,onClick:FJ($.onClick,()=>q.onOpenChange(!1))})});dk.displayName=ck;function FB($){return $?"open":"closed"}var pk="DialogTitleWarning",[wJ0,lk]=Tk(pk,{contentName:T2,titleName:LB,docsSlug:"dialog"}),nd=({titleId:$})=>{let J=lk(pk),Q=`\`${J.contentName}\` requires a \`${J.titleName}\` for the component to be accessible for screen reader users. - -If you want to hide the \`${J.titleName}\`, you can wrap it with our VisuallyHidden component. - -For more information, see https://radix-ui.com/primitives/docs/components/${J.docsSlug}`;return U5.useEffect(()=>{if($){if(!document.getElementById($))console.error(Q)}},[Q,$]),null},ad="DialogDescriptionWarning",td=({contentRef:$,descriptionId:J})=>{let Z=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${lk(ad).contentName}}.`;return U5.useEffect(()=>{let q=$.current?.getAttribute("aria-describedby");if(J&&q){if(!document.getElementById(J))console.warn(Z)}},[Z,$,J]),null},ik=Rk;var rk=hk,VB=xk,MB=fk,DB=gk,NB=mk,sk=dk;var DJ=ik;var $p=rk;var ok=NZ.forwardRef(({className:$,...J},Q)=>G(VB,{ref:Q,className:b0("fixed inset-0 z-50 bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",$),...J}));ok.displayName=VB.displayName;var b2=NZ.forwardRef(({className:$,children:J,...Q},Z)=>G($p,{children:b("div",{className:`${M8}`,children:[G(ok,{}),b(MB,{ref:Z,className:b0("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",$),...Q,children:[J,b(sk,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[G(o9,{className:"h-4 w-4"}),G("span",{className:"sr-only",children:"Close"})]})]})]})}));b2.displayName=MB.displayName;var OZ=({className:$,...J})=>G("div",{className:b0("flex flex-col space-y-1.5 text-center sm:text-left",$),...J});OZ.displayName="DialogHeader";var AZ=({className:$,...J})=>G("div",{className:b0("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",$),...J});AZ.displayName="DialogFooter";var j2=NZ.forwardRef(({className:$,...J},Q)=>G(DB,{ref:Q,className:b0("text-lg font-semibold leading-none tracking-tight",$),...J}));j2.displayName=DB.displayName;var wZ=NZ.forwardRef(({className:$,...J},Q)=>G(NB,{ref:Q,className:b0("text-sm text-muted-foreground",$),...J}));wZ.displayName=NB.displayName;var q9=R(v(),1);var gY=new Map;function Jp($,J){if(!$)return getComputedStyle(J).getPropertyValue("--multitrack-waveform").trim()||"#1D7456";if($.startsWith("var(")){let Q=$.match(/^var\((--[^)]+)\)$/);if(Q)return getComputedStyle(J).getPropertyValue(Q[1]).trim()||"#1D7456"}return $}function Qp($,J,Q,Z,q){let X=window.devicePixelRatio||1,Y=$.getBoundingClientRect();if(Y.width===0||Y.height===0)return;$.width=Math.round(Y.width*X),$.height=Math.round(Y.height*X);let z=$.getContext("2d");if(!z)return;z.scale(X,X);let{width:K,height:W}=Y,H=W/2,B=Math.floor(Q*J.length),U=Math.ceil(Z*J.length),L=Math.max(U-B,1)/K;z.clearRect(0,0,K,W),z.fillStyle=Jp(q,$);for(let F=0;F{let Z=await fetch($);if(!Z.ok)throw Error(`Unable to fetch waveform media: ${$}`);let q=await Z.arrayBuffer(),X=new AudioContext;try{let z=(await X.decodeAudioData(q)).getChannelData(0),K=2000,W=Math.ceil(z.length/2000),H=new Float32Array(2000);for(let B=0;B<2000;B++){let U=0,_=B*W;for(let L=_;L<_+W&&LU)U=F}H[B]=U}return gY.set($,H),H}finally{await X.close()}})();gY.set($,Q);try{return await Q}catch(Z){throw gY.delete($),Z}}function uY({content:$,startRatio:J=0,endRatio:Q=1,className:Z,color:q}){let X=q9.useRef(null),Y=q9.useRef(null),z=Q5($),K=q9.useRef(J),W=q9.useRef(Q),H=q9.useRef(q);K.current=J,W.current=Q,H.current=q;let B=q9.useCallback(()=>{let U=X.current;if(!U||!Y.current)return;Qp(U,Y.current,K.current,W.current,H.current)},[]);return q9.useEffect(()=>{if(!z){Y.current=null;return}let U=z,_=!1;async function L(){try{let F=await Zp(U);if(_)return;Y.current=F,B()}catch(F){if(!_)console.warn("[AudioWaveform] failed to decode waveform:",F)}}return L(),()=>{_=!0}},[z,B]),q9.useEffect(()=>{B()},[J,Q,B]),q9.useEffect(()=>{let U=X.current;if(!U)return;let _=new ResizeObserver(B);return _.observe(U),()=>_.disconnect()},[B]),G("canvas",{ref:X,className:Z,style:{display:"block",width:"100%",height:"100%"}})}function nk($){if($==="input")return"inputs";if($==="output")return"outputs";if($==="url")return"url";if($==="local")return"local";return"inputs"}function mY($,J,Q){return $/Math.max(J-1,1)*Q}function tk({track:$,totalFrames:J,frameRate:Q,displayFormat:Z,areaWidth:q,selectedId:X,onSelectedIdChange:Y,onTrackChange:z,onSegmentsChange:K,node:W,app:H,grow:B}){let U=X1(),_=A8.useRef(null),[L,F]=A8.useState(null),[V,M]=A8.useState(null),[D,N]=A8.useState(!1),[O,I]=A8.useState("inputs"),[k,T]=A8.useState({x:0,y:0}),[A,w]=A8.useState(null),[C,y]=A8.useState(""),[x,j]=A8.useState(null),[P,h]=A8.useState(!1),l=A8.useRef([]),t=A8.useMemo(()=>Y9(W,H,"audio"),[W,H,D]);A8.useEffect(()=>{return()=>{l.current.forEach((p)=>{p.removeEventListener("loadedmetadata",()=>{}),p.removeEventListener("error",()=>{}),p.src=""}),l.current=[]}},[]),A8.useEffect(()=>{let p=_.current?.closest(".comfyui-react-widget");if(!p)return;let Z0=`${M8}-overlay-active`;return p.classList.toggle(Z0,D||P),()=>p.classList.remove(Z0)},[D,P]);let S=$.segments,i=S.reduce((p,Z0)=>Math.max(p,Z0.end_frame),-1),J0=ia.id===A?{...a,content:g}:a)),N(!1);return}async function W0(_0,N0,d0,g){let a=_0.split("/").pop()??_0,w0=_0.startsWith("http")?{source_type:"url",url:_0,file_name:a}:g==="local"?{source_type:"local",local_path:_0,file_name:a}:{source_type:g,file_path:_0,file_name:a},F0=cY(w0)??_0,u0=await new Promise((Z1)=>{let K1=new Audio(F0);l.current.push(K1),K1.preload="metadata",K1.addEventListener("loadedmetadata",()=>Z1(K1.duration)),K1.addEventListener("error",()=>Z1(5))}),P0=Math.ceil(u0*Q),n0=Math.min(J-1,N0+P0-1);if(N0>=J)return{newSeg:null,nextCursor:N0,updatedSegments:d0};let R0={id:x1(),start_frame:N0,end_frame:n0,origin_start_frame:N0,origin_end_frame:N0+P0-1,content:w0,color:$.color,markers:[]};return{newSeg:R0,nextCursor:n0+1,updatedSegments:[...d0,R0]}}async function L0(){let _0=i>=0?i+1:0,N0=[...S];for(let d0 of B0){if(_0>=J)break;if(d0.startsWith("__slot__:")){let g=d0.slice(9),I0=t.find((R0)=>R0.value===d0)?.audio_name,w0=I0?X9(I0,"input"):void 0,F0=await new Promise((R0)=>{if(w0){let Z1=new Audio(w0);l.current.push(Z1),Z1.preload="metadata",Z1.addEventListener("loadedmetadata",()=>R0(Z1.duration)),Z1.addEventListener("error",()=>R0(5))}else R0(5)}),u0=Math.ceil(F0*Q),P0=Math.min(J-1,_0+u0-1),n0={id:x1(),start_frame:_0,end_frame:P0,origin_start_frame:_0,origin_end_frame:_0+u0-1,content:{source_type:"slot",slot_name:g,file_name:g,url:w0},color:$.color,markers:[]};N0=[...N0,n0],_0=P0+1}else{let g=await W0(d0,_0,N0,Z0);if(g.newSeg)_0=g.nextCursor,N0=g.updatedSegments}}if(K([...N0].sort((d0,g)=>d0.start_frame-g.start_frame)),N0.length>S.length)w(N0[N0.length-1].id);N(!1)}L0()}function q0(p){if(K(S.filter((Z0)=>Z0.id!==p)),N(!1),X===p)Y(null)}function E(p){return S.find((Z0)=>p>=Z0.start_frame&&p<=Z0.end_frame)??null}function d(p){let Z0=_.current?.getBoundingClientRect();if(!Z0)return;let Q0=q/Math.max(J-1,1),B0=Math.round((p.clientX-Z0.left)/Q0);if(!E(B0))Y(null)}function c(p){p.preventDefault();let Z0=p.currentTarget.getBoundingClientRect(),Q0=p.clientX-Z0.left,B0=Math.round(Q0/q*(J-1));F(B0)}async function r(p){p.preventDefault();let Z0=new Set([".mp3",".wav",".flac",".ogg",".m4a",".aac",".opus",".wma"]),Q0=Array.from(p.dataTransfer.files).filter((_0)=>{if(_0.type.startsWith("audio/"))return!0;let N0=`.${_0.name.split(".").pop()?.toLowerCase()??""}`;return Z0.has(N0)});if(Q0.length===0){F(null);return}if(!J0)return;let B0=[...S],W0=L??(i>=0?i+1:0),L0=!1;for(let _0 of Q0){if(W0>=J)break;try{let N0=new FormData;N0.append("file",_0);let d0=await fetch("/easy-media/upload",{method:"POST",body:N0});if(!d0.ok)continue;let{file_name:g}=await d0.json();L0=!0;let a=X9(g,"input"),I0=await new Promise((P0)=>{let n0=new Audio(a);n0.preload="metadata",l.current.push(n0),n0.addEventListener("loadedmetadata",()=>P0(n0.duration)),n0.addEventListener("error",()=>P0(5))}),w0=Math.ceil(I0*Q),F0=Math.min(J-1,W0+w0-1),u0={id:x1(),start_frame:W0,end_frame:F0,origin_start_frame:W0,origin_end_frame:W0+w0-1,content:{source_type:"input",file_path:g,file_name:g},color:$.color,markers:[]};B0.push(u0),W0=u0.end_frame+1}catch{}}if(L0)R5("inputs");K(B0.toSorted((_0,N0)=>_0.start_frame-N0.start_frame)),F(null)}function u(p,Z0,Q0,B0=0){if($.locked)return;let W0=S.find((a)=>a.id===p);if(!W0)return;let L0=W0.origin_start_frame??W0.start_frame,_0=W0.origin_end_frame??W0.end_frame,N0=S.filter((a)=>a.id!==p).toSorted((a,I0)=>a.start_frame-I0.start_frame),d0=W0.start_frame,g=W0.end_frame;if(Z0==="start"){d0=Math.max(B0,Math.max(L0,W0.start_frame+Q0));let a=N0.findLast((I0)=>I0.end_frameI0.start_frame>W0.start_frame);if(a)g=Math.min(g,a.start_frame-1);g=Math.max(g,W0.start_frame+1)}K(S.map((a)=>a.id===p?{...a,start_frame:d0,end_frame:g}:a))}function m(p,Z0,Q0){if($.locked)return;let B0=S.find((a)=>a.id===p);if(!B0)return;let W0=B0.end_frame-B0.start_frame,L0=Math.max(0,Q0+Z0),_0=Math.min(J-1,L0+W0),N0=_0-W0,d0=Math.max(0,N0)-B0.start_frame,g=S.map((a)=>{if(a.id!==p)return a;return{...a,start_frame:Math.max(0,N0),end_frame:Math.min(J-1,_0),origin_start_frame:(a.origin_start_frame??a.start_frame)+d0,origin_end_frame:(a.origin_end_frame??a.end_frame)+d0}}).toSorted((a,I0)=>a.start_frame-I0.start_frame);K(g)}function s(p,Z0){let Q0=S.map((B0)=>{if(B0.id!==p)return B0;let W0=[...B0.markers??[],{id:x1(),frame:Z0,label:""}];return{...B0,markers:W0}});K(Q0)}function f(p,Z0){let Q0=S.map((B0)=>{if(B0.id!==p)return B0;return{...B0,markers:(B0.markers??[]).filter((W0)=>W0.id!==Z0)}});K(Q0)}function o(p,Z0,Q0){let B0=S.map((W0)=>{if(W0.id!==p)return W0;return{...W0,markers:(W0.markers??[]).map((L0)=>L0.id===Z0?{...L0,label:Q0}:L0)}});K(B0),M(null)}let G0=[G("button",{type:"button",title:U("audioTrack.addMarker"),className:"w-full h-full flex items-center justify-center hover:bg-accent",onClick:()=>{if(!S.length)return;let p=S[0],Z0=Math.floor((p.start_frame+p.end_frame)/2);s(p.id,Z0)}},"marker"),void 0,void 0];return b(CY,{track:$,onTrackChange:z,toolSlots:G0,grow:B,children:[b(a1,{open:D,onOpenChange:N,children:[b(o6,{children:[G(n6,{className:"relative block w-full h-full",asChild:!0,children:b("section",{ref:_,"aria-label":U("audioTrack.dropZone"),className:"relative w-full h-full cursor-default",onDragOver:c,onDragLeave:()=>F(null),onDrop:r,onClick:d,onContextMenu:()=>h(!0),onDoubleClick:(p)=>{if(p.target.closest("[data-segment-block]"))return;if(!J0)return;e(p,"inputs",null,"")},children:[G(_6,{asChild:!0,children:G("span",{className:"absolute w-0 h-0 pointer-events-none",style:{left:k.x,top:k.y}})}),S.length===0?b("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-muted-foreground pointer-events-none select-none opacity-40",children:[b("div",{className:"flex items-center gap-1",children:[G(NJ,{className:"w-3 h-3"}),G("span",{className:"text-[11px]",children:U("audioTrack.placeholder")})]}),G("span",{className:"text-[10px]",children:U("audioTrack.placeholderHint")})]}):G(W1,{children:S.map((p)=>b(RY,{segment:p,totalFrames:J,areaWidth:q,interactive:!$.locked,minStart:0,selected:X===p.id,onSelect:(Z0)=>{Y(X===Z0.id?null:Z0.id)},onDoubleClick:()=>{K0(mY(p.start_frame,J,q),8,nk(p.content.source_type),p.id,p.content.file_path??p.content.local_path??p.content.url??"")},onDragEnd:m,onResizeEnd:u,frameRate:Q,displayFormat:Z,backgroundSlot:G(uY,{content:p.content,startRatio:p.origin_end_frame!==void 0&&p.origin_start_frame!==void 0?(p.start_frame-p.origin_start_frame)/(p.origin_end_frame-p.origin_start_frame):0,endRatio:p.origin_end_frame!==void 0&&p.origin_start_frame!==void 0?(p.end_frame-p.origin_start_frame)/(p.origin_end_frame-p.origin_start_frame):1,color:"#2E6E53"}),onContextMenu:(Z0,Q0)=>{Y(Q0.id),j(Q0.id)},children:[G("span",{className:"absolute top-0.5 truncate text-[8px]",children:p.content.file_name}),(p.markers??[]).map((Z0)=>G(n1,{delayDuration:200,children:b(B1,{children:[G(U1,{asChild:!0,children:G("button",{type:"button","aria-label":Z0.label?U("audioTrack.markerAriaLabel",{label:Z0.label}):U("audioTrack.markerAtFrame",{frame:Z0.frame}),className:"absolute top-0 w-0.5 h-full bg-yellow-300/80 cursor-pointer hover:bg-yellow-200 z-20",style:{left:mY(Z0.frame,J,q)},onClick:(Q0)=>{Q0.stopPropagation(),M({segId:p.id,markerId:Z0.id,label:Z0.label??""})}})}),G(H1,{side:"top",children:G("p",{children:Z0.label||U("audioTrack.frameLabel",{n:Z0.frame})})})]})},Z0.id))]},p.id))}),L!==null&&G("div",{className:"absolute top-0 w-0.5 h-full bg-foreground/60 pointer-events-none",style:{left:mY(L,J,q)}})]})}),b(E6,{onCloseAutoFocus:()=>{j(null),h(!1)},children:[G(J5,{disabled:!J0,onClick:()=>setTimeout(()=>K0(8,8,"inputs",null,""),0),children:U("audioTrack.contextAdd")}),x&&(()=>{let p=S.find((Z0)=>Z0.id===x);return b(W1,{children:[G(J5,{onClick:()=>{if(!p)return;setTimeout(()=>K0(mY(p.start_frame,J,q),8,nk(p.content.source_type),p.id,p.content.file_path??p.content.local_path??p.content.url??""),0),j(null)},children:U("audioTrack.contextEdit")}),G(J5,{onClick:()=>{q0(x),j(null)},children:U("audioTrack.contextDelete")})]})})()]})]}),G(s1,{"data-audio-popover":"",className:"p-0 w-auto",side:"bottom",align:"start",onOpenAutoFocus:(p)=>p.preventDefault(),children:G(V5,{value:C,onChange:H0,mediaType:"audio",defaultTab:O,slotItems:t})})]}),G(DJ,{open:!!V,onOpenChange:(p)=>{if(!p)M(null)},children:b(b2,{className:"max-w-xs p-4 space-y-2",children:[G(j2,{className:"text-xs text-muted-foreground font-normal",children:U("audioTrack.markerLabelInput")}),V!=null&&(()=>{let p=V;return b(W1,{children:[G($6,{autoFocus:!0,className:"h-7 text-xs",value:p.label,onChange:(Z0)=>M({...p,label:Z0.target.value}),onKeyDown:(Z0)=>{if(Z0.key==="Enter")o(p.segId,p.markerId,p.label);if(Z0.key==="Escape")M(null)}}),b("div",{className:"flex gap-2 justify-end",children:[G(k0,{size:"sm",variant:"ghost",className:"h-6 text-xs",onClick:()=>M(null),children:U("common.cancel")}),G(k0,{size:"sm",variant:"destructive",className:"h-6 text-xs",onClick:()=>{f(p.segId,p.markerId),M(null)},children:U("common.delete")}),G(k0,{size:"sm",className:"h-6 text-xs",onClick:()=>o(p.segId,p.markerId,p.label),children:U("common.save")})]})]})})()]})}),(D||P)&&ak.createPortal(G("div",{"aria-hidden":"true",style:{position:"fixed",inset:0,zIndex:9997},onPointerDown:()=>{N(!1),h(!1)}}),document.body)]})}var f1=R(v(),1);var ek=R(v(),1);var c4=ek.forwardRef(({className:$,...J},Q)=>{return G("textarea",{className:b0("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 resize-none",$),ref:Q,...J})});c4.displayName="Textarea";function qp($){return String($).replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}function Xp($){return $.split(/[||]/).map(qp).join('|')}var $I={fontFamily:"inherit",fontSize:"10px",lineHeight:"1.4",letterSpacing:0,whiteSpace:"pre-wrap",overflowWrap:"break-word",wordBreak:"break-word"};function Yp($,J,Q,Z){if($.length===0)return[];if($.length===J.length)return J.map((z,K)=>({...z,content:{...z.content,text:$[K]}}));let q=Math.max(1,$.length),X=Math.floor(Q/q),Y=Q%q;return $.map((z,K)=>({id:J[K]?.id??x1(),start_frame:K*X+Math.min(K,Y),end_frame:KF.content.text).join("|"),[H,B]=f1.useState(()=>W);f1.useEffect(()=>{if(z.current)return;B((F)=>F===W?F:W)},[W]);function U(){if(X.current&&Y.current)Y.current.scrollTop=X.current.scrollTop}let _=f1.useCallback((F)=>{let V=F===""?[]:F.split(/[||]/);Z(Yp(V,K.current,J,Q))},[J,Q,Z]),L=f1.useCallback((F)=>{let V=F.target.value;if(B(V),z.current)return;_(V)},[_]);return b("div",{className:"flex flex-col gap-1",children:[b("div",{className:"relative w-full h-30 overflow-hidden",children:[G("div",{ref:Y,"aria-hidden":"true",className:"absolute inset-0 overflow-y-auto pointer-events-none",style:{...$I,padding:0},dangerouslySetInnerHTML:{__html:Xp(H)}}),G(c4,{ref:X,value:H,onChange:L,onScroll:U,spellCheck:!1,onCompositionStart:()=>{z.current=!0},onCompositionEnd:()=>{z.current=!1;let F=X.current?.value??"";B(F),_(F)},className:"absolute inset-0 w-full h-full resize-none border-0 shadow-none focus-visible:ring-0 p-0 bg-transparent outline-none",style:{...$I,color:"transparent",caretColor:"var(--foreground)"}})]}),G("p",{className:"text-[9px] text-muted-foreground",children:q("maintainTrack.combinedHint")})]})}function JI($,J){return $.map((Q,Z)=>{let q=Math.max(1,Math.floor(J/Math.max($.length,1)));return{id:String(Z),item:Q,start_frame:Q.start_frame??Z*q,end_frame:Q.end_frame??Math.min(J-1,Z*q+q-1)}})}function Kp($,J,Q,Z){let q=Z/Math.max(Q-1,1),X=$*q,Y=Math.min((J+1)*q,Z);return{left:X,width:Math.max(Y-X,20)}}async function Gp($){let J=new FormData;J.append("image",$),J.append("type","input"),J.append("overwrite","false");let Q=await fetch("/upload/image",{method:"POST",body:J});if(!Q.ok)throw Error(`Upload failed: ${Q.status}`);let Z=await Q.json();return`${Z.subfolder?`${Z.subfolder}/`:""}${Z.name}`}function Wp($,J,Q){return Q==="seconds"?`${($/J).toFixed(1)}s`:`${$}f`}function Hp($,J=0.3){if(!$.startsWith("#")||$.length<7)return"var(--border)";let Q=Number.parseInt($.slice(1,3),16),Z=Number.parseInt($.slice(3,5),16),q=Number.parseInt($.slice(5,7),16),X=Math.round(Q+(255-Q)*J),Y=Math.round(Z+(255-Z)*J),z=Math.round(q+(255-q)*J);return`#${X.toString(16).padStart(2,"0")}${Y.toString(16).padStart(2,"0")}${z.toString(16).padStart(2,"0")}`}var Bp=f1.default.forwardRef(function({block:J,span:Q,areaWidth:Z,frameRate:q,displayFormat:X,trackColor:Y,selected:z=!1,onSelect:K,onMoveEnd:W,onResizeEnd:H,onEdit:B,onRemove:U,onContextMenu:_},L){let F=X1(),[V,M]=f1.useState(J.start_frame),[D,N]=f1.useState(J.end_frame),[O,I]=f1.useState(!1),[k,T]=f1.useState(!1),A=f1.useRef(J.start_frame),w=f1.useRef(J.end_frame),C=f1.useRef(!1),y=f1.useRef(!1),x=f1.useRef(null);f1.useEffect(()=>{if(!C.current)A.current=J.start_frame,w.current=J.end_frame,M(J.start_frame),N(J.end_frame)},[J.start_frame,J.end_frame]);let{left:j,width:P}=Kp(V,D,Q,Z);function h(){if(I(!0),x.current)clearTimeout(x.current)}function l(){if(C.current=!1,x.current)clearTimeout(x.current);x.current=setTimeout(()=>I(!1),2000)}function t(e){if(e.button!==0)return;e.preventDefault(),C.current=!0,y.current=!1,h();let H0=e.clientX,q0=J.start_frame,d=J.end_frame-q0,c=Z/Math.max(Q-1,1);function r(m){let s=Math.round((m.clientX-H0)/c);if(s!==0)y.current=!0;let f=Math.max(0,Math.min(Q-1-d,q0+s)),o=f+d;A.current=f,w.current=o,M(f),N(o)}function u(){l(),W(J.id,A.current,w.current),globalThis.removeEventListener("mousemove",r),globalThis.removeEventListener("mouseup",u)}globalThis.addEventListener("mousemove",r),globalThis.addEventListener("mouseup",u)}function S(e){return(H0)=>{if(H0.button!==0)return;H0.preventDefault(),H0.stopPropagation(),C.current=!0,T(!0),h();let q0=H0.clientX,E=J.start_frame,d=J.end_frame,c=Z/Math.max(Q-1,1);function r(m){let s=Math.round((m.clientX-q0)/c);if(e==="start"){let f=Math.max(0,Math.min(d-1,E+s));A.current=f,M(f)}else{let f=Math.max(E+1,Math.min(Q-1,d+s));w.current=f,N(f)}}function u(){T(!1),l(),H(J.id,A.current,w.current),globalThis.removeEventListener("mousemove",r),globalThis.removeEventListener("mouseup",u)}globalThis.addEventListener("mousemove",r),globalThis.addEventListener("mouseup",u)}}let i=[J.item],J0=k?"#eab308":z?"var(--foreground)":Hp(Y),K0=k?"#eab308":z?"var(--foreground)":"transparent";return b("div",{ref:L,role:"button",tabIndex:0,className:"absolute top-0 h-full select-none group",style:{left:j,width:P,backgroundColor:Y,opacity:0.9,border:`1px solid ${J0}`,borderRadius:3,overflow:"hidden",cursor:"grab"},onMouseDown:t,onClick:(e)=>{if(y.current)return;e.stopPropagation(),K?.(J.id)},onDoubleClick:()=>{K?.(J.id),B()},onContextMenu:_,onKeyDown:(e)=>{if(e.key==="Enter")K?.(J.id),B()},children:[i.length>0&&G("div",{className:"absolute inset-0 bg-black overflow-hidden",style:Ok(i)}),G("button",{type:"button","aria-label":"Resize start",className:"absolute left-0 top-0 h-full w-0.5 cursor-ew-resize z-10 border-0 p-0",style:{background:K0},onMouseDown:S("start")}),G("button",{type:"button","aria-label":"Resize end",className:"absolute right-0 top-0 h-full w-0.5 cursor-ew-resize z-10 border-0 p-0",style:{background:K0},onMouseDown:S("end")}),G("button",{type:"button",className:"absolute top-0.5 right-0.5 w-3 h-3 z-20 rounded-sm bg-destructive text-white text-[9px] flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",onClick:(e)=>{e.stopPropagation(),U()},title:F("common.delete"),children:"×"}),G("div",{className:"absolute bottom-0 left-0 right-0 text-center text-[8px] bg-black/60 text-white truncate px-1 pointer-events-none",children:J.item.file_name}),O&&G("div",{className:"absolute top-0.5 left-1 z-20 pointer-events-none",children:G("span",{className:"text-[9px] bg-black/80 text-white px-1 py-px rounded leading-none",children:Wp(V,q,X)})})]})});function QI({segment:$,allSegments:J,totalFrames:Q,frameRate:Z,displayFormat:q,areaWidth:X,trackColor:Y,canvasScale:z,onContentChange:K,onAllSegmentsChange:W,node:H,app:B}){let U=X1(),_=$.end_frame-$.start_frame+1,[L,F]=f1.useState("individual"),[V,M]=f1.useState(()=>JI($.content.images,_)),D=$.content.images.map((E)=>[E.source_type,E.file_path,E.local_path,E.url,E.slot_name,E.start_frame,E.end_frame].join(":")).join("|");f1.useEffect(()=>{M(JI($.content.images,_))},[$.id,D,$.content.images,_]);let[N,O]=f1.useState(!1),[I,k]=f1.useState(null),[T,A]=f1.useState(null),[w,C]=f1.useState(""),[y,x]=f1.useState("inputs"),[j,P]=f1.useState({x:8,y:8}),h=f1.useRef(null),l=f1.useRef(!1),t=f1.useMemo(()=>Y9(H,B,"image"),[H,B,N]);function S(E,d,c,r){if(E){let u=h.current?.getBoundingClientRect();P({x:E.clientX-(u?.left??0),y:E.clientY-(u?.top??0)})}l.current=!0,k(d),C(c),x(r),O(!0)}function i(E,d){let c=E.startsWith("__slot__:"),r=!c&&/^https?:\/\//i.test(E),u=c?E.slice(9):void 0,s=t.find((o)=>o.value===E)?.img,f;if(c)f={source_type:"slot",slot_name:u,file_name:u??E,url:s};else if(r)f=Nk(E);else f=Dk(E,d);if(I===null){let o=V.reduce((L0,_0)=>Math.max(L0,_0.end_frame),-1),G0=o>=0?o+1:0,p=V;if(G0>=_&&V.length>0){let L0=V.at(-1),_0=Math.floor((L0.start_frame+L0.end_frame)/2);p=V.map((N0,d0)=>d0===V.length-1?{...N0,end_frame:_0}:N0),G0=_0+1}let Z0=p.length===0?Math.max(1,Math.floor(_/2)):Math.max(1,Math.floor(_/(p.length+1))),Q0=Math.min(_-1,G0+Z0-1),B0={id:String(p.length),item:{...f,start_frame:G0,end_frame:Q0},start_frame:G0,end_frame:Q0},W0=[...p,B0];M(W0),K({images:W0.map((L0)=>({...L0.item,start_frame:L0.start_frame,end_frame:L0.end_frame}))})}else{let o=V.map((G0)=>G0.id===I?{...G0,item:{...f,start_frame:G0.start_frame,end_frame:G0.end_frame}}:G0);M(o),K({images:o.map((G0)=>({...G0.item,start_frame:G0.start_frame,end_frame:G0.end_frame}))})}O(!1)}function J0(E,d,c){let r=V.map((u)=>u.id===E?{...u,start_frame:d,end_frame:c}:u);M(r),K({images:r.map((u)=>({...u.item,start_frame:u.start_frame,end_frame:u.end_frame}))})}function K0(E){let d=V.filter((c)=>c.id!==E);M(d),K({images:d.map((c)=>({...c.item,start_frame:c.start_frame,end_frame:c.end_frame}))})}function e(){if(V.length===0)return;let E=Math.floor(_/V.length),d=_%V.length,c=V.map((r,u)=>{let m=u({...r.item,start_frame:r.start_frame,end_frame:r.end_frame}))})}function H0(E){if(!E.dataTransfer.types.includes("Files"))return;E.preventDefault(),E.dataTransfer.dropEffect="copy"}async function q0(E){if(!E.dataTransfer.types.includes("Files"))return;E.preventDefault();let d=new Set([".png",".jpg",".jpeg",".webp",".gif",".bmp",".tiff",".tif"]),c=Array.from(E.dataTransfer.files).filter((Q0)=>{if(Q0.type.startsWith("image/"))return!0;let B0=`.${Q0.name.split(".").pop()?.toLowerCase()??""}`;return d.has(B0)});if(c.length===0)return;let r=E.currentTarget.getBoundingClientRect(),m=((Number.isFinite(E.clientX)?E.clientX:r.left+X/2)-r.left)/z,s=Math.max(0,Math.min(_-1,Math.round(m/X*(_-1)))),f=Math.max(1,Math.floor(_/Math.max(V.length+c.length,1))),o=[];for(let Q0 of c)try{o.push(await Gp(Q0))}catch(B0){console.error("[EditPanel] upload failed:",B0)}if(o.length===0)return;R5("inputs");let G0=s,p=[];for(let Q0 of o){if(G0>_-1)break;let B0=Math.min(_-1,G0+f-1),W0={source_type:"input",file_path:Q0,file_name:Q0.split("/").pop()??Q0,start_frame:G0,end_frame:B0};p.push({id:String(V.length+p.length),item:W0,start_frame:G0,end_frame:B0}),G0=B0+1}if(p.length===0)return;let Z0=[...V,...p];M(Z0),K({images:Z0.map((Q0)=>({...Q0.item,start_frame:Q0.start_frame,end_frame:Q0.end_frame}))})}return b("div",{"data-edit-panel":"",className:"bg-card border border-border rounded shadow-lg overflow-hidden",style:{width:X},children:[L==="combined"?G("div",{className:"p-2 border-border",children:G(zp,{allSegments:J,totalFrames:Q,trackColor:Y,onAllSegmentsChange:W},`combined-${$.id}-${L}`)}):b(W1,{children:[G("div",{className:"p-2 border-b border-border",children:G(c4,{className:"w-full h-16 resize-none text-[10px] border-0 shadow-none focus-visible:ring-0 p-0 bg-transparent",placeholder:U("maintainTrack.promptPlaceholder"),value:$.content.text,onChange:(E)=>K({text:E.target.value})})}),G(JY,{totalFrames:_,frameRate:Z,displayFormat:q,width:X,canvasScale:z,showLabel:!1}),b("div",{ref:h,className:"relative w-full select-none bg-muted/30",style:{height:48},onDragOver:H0,onDrop:q0,children:[V.length===0?b(o6,{children:[G(n6,{asChild:!0,children:b("button",{type:"button",className:"absolute inset-0 flex items-center justify-center gap-1 text-[10px] text-muted-foreground hover:text-foreground cursor-pointer",onClick:(E)=>S(E,null,"","inputs"),children:[G(z5,{className:"w-2.5 h-2.5"}),G("span",{children:U("maintainTrack.addImage")})]})}),G(E6,{children:G(J5,{onClick:()=>S(null,null,"","inputs"),children:U("imageTrack.contextAdd")})})]}):b(W1,{children:[V.map((E)=>{return b(o6,{children:[G(n6,{asChild:!0,children:G(Bp,{block:E,span:_,areaWidth:X,frameRate:Z,displayFormat:q,trackColor:Y,selected:T===E.id,onSelect:A,onMoveEnd:J0,onResizeEnd:J0,onEdit:()=>S(null,E.id,E.item.file_path??E.item.url??"",E.item.source_type==="url"?"url":"inputs"),onRemove:()=>K0(E.id)})}),b(E6,{children:[G(J5,{onClick:()=>{A(E.id),S(null,E.id,E.item.file_path??E.item.url??"",E.item.source_type==="url"?"url":"inputs")},children:U("imageTrack.contextReselect")}),G(J5,{onClick:()=>S(null,null,"","inputs"),children:U("imageTrack.contextAdd")}),G(J5,{disabled:V.length<1,onClick:e,children:U("imageTrack.contextDistribute")}),G(C3,{}),G(J5,{className:"text-destructive focus:text-destructive",onClick:()=>K0(E.id),children:U("imageTrack.contextDelete")})]})]},E.id)}),G("button",{type:"button",className:"absolute right-1 top-1/2 w-5 h-5 flex items-center justify-center rounded border border-dashed border-border bg-card transition-colors text-muted-foreground z-30 cursor-pointer",onClick:(E)=>{E.stopPropagation(),S(E,null,"","inputs")},title:U("maintainTrack.addImage"),children:G(z5,{className:"w-3 h-3"})})]}),b(a1,{open:N,onOpenChange:(E)=>{if(!E)O(!1)},children:[G(_6,{asChild:!0,children:G("span",{className:"absolute w-0 h-0 pointer-events-none",style:{left:j.x,top:j.y}})}),G(s1,{className:"p-0 w-auto",side:"bottom",align:"start",onOpenAutoFocus:(E)=>E.preventDefault(),onInteractOutside:(E)=>{if(l.current)l.current=!1,E.preventDefault()},children:G(V5,{value:w,onChange:i,mediaType:"image",defaultTab:y,slotItems:t})})]})]})]}),b("div",{className:"flex items-center space-between gap-2 p-2 border-t",children:[G(u4,{value:L,onValueChange:(E)=>F(E),children:b(r9,{className:"h-6",children:[G(W8,{value:"individual",className:"text-[10px] h-5 px-2",children:U("maintainTrack.tabIndividual")}),G(W8,{value:"combined",className:"text-[10px] h-5 px-2",children:U("maintainTrack.tabCombined")})]})}),L==="combined"?G(W1,{}):G("div",{className:"flex items-center gap-2 ml-auto",children:b(E8,{value:$.content.type,onValueChange:(E)=>K({type:E}),children:[G(y8,{className:"h-6 w-28 text-[10px]",children:G(W6,{})}),b(P8,{children:[G(l5,{value:"flf",children:U("maintainTrack.flf")}),G(l5,{value:"fmlf",children:U("maintainTrack.fmlf")}),G(l5,{value:"ref",children:U("maintainTrack.ref")})]})]})})]})]})}var dY=R(v(),1);function n9($){let[J,Q]=dY.useState(()=>$?.canvas?.ds?.scale??1);return dY.useEffect(()=>{if(!$?.canvas)return;let Z=$.canvas,q=Z.onDrawForeground?.bind(Z);return Z.onDrawForeground=(...X)=>{q?.(...X);let Y=Z.ds?.scale??1;Q((z)=>z!==Y?Y:z)},()=>{Z.onDrawForeground=q}},[$]),J}var pY=R(v(),1);function OJ($){let[J,Q]=pY.useState(0);return pY.useLayoutEffect(()=>{let Z=$.current;if(!Z)return;let q=new ResizeObserver(()=>Q(Z.clientWidth));return q.observe(Z),Q(Z.clientWidth),()=>q.disconnect()},[$]),J}var ZI=R(v(),1);function qI($){let J=ZI.useRef($);return J.current=$,J}function Up($){if($&&typeof $==="object"&&!Array.isArray($)){let J=$;if(Array.isArray(J.tracks)&&typeof J.total_length==="number"&&typeof J.frame_rate==="number")return $}return XI()}function _p($){return cY($.content)}var lY={current:-1};function Lp($,J,Q,Z,q){if(!(Q>=J.start_frame&&Q<=J.end_frame)){if(!$.paused)$.pause();return}if(Q!==lY.current){let Y=J.origin_start_frame??J.start_frame,K=(Q-Y)/Z;if(Math.abs($.currentTime-K)>0.1)$.currentTime=K;lY.current=Q}if(q){if($.paused&&$.readyState>=2)$.play().catch(()=>{})}else if(!$.paused)$.pause()}function Fp({value:$,onChange:J,app:Q,node:Z}){let q=Up($),[X,Y]=B8.useState("frames"),[z,K]=B8.useState(null),W=B8.useRef(null),H=B8.useRef(null),B=OJ(H),[U,_]=B8.useState(!1),[L,F]=B8.useState(0),[V,M]=B8.useState(!1),D=B8.useRef(null),[N,O]=B8.useState(1),I=Q?.ui?.settings?.settingsValues?.["Comfy.VueNodes.Enabled"],k=Q?.ui?.settings?.settingsValues?.["Comfy.Locale"],T=n9(Q),A=B8.useRef({rafId:null,lastTimestamp:null,frame:0,audioEls:new Map}),w=Math.max(B,1)*N;function C(m){let s=H.current;if(!s||s.scrollWidth<=s.clientWidth)return;m.preventDefault(),m.stopPropagation();let f=m.deltaMode===1?16:m.deltaMode===2?s.clientWidth:1,o=Math.abs(m.deltaX)>Math.abs(m.deltaY)?m.deltaX:m.deltaY;s.scrollLeft=Math.max(0,Math.min(s.scrollWidth-s.clientWidth,s.scrollLeft+o*f))}let y=qI(q);B8.useEffect(()=>{A.current.frame=L},[L]);function x(){let{tracks:m}=y.current,s=A.current,f=m.filter((o)=>o.type==="audio").flatMap((o)=>o.segments);for(let o of f)if(!s.audioEls.has(o.id)){let G0=_p(o);if(!G0)continue;let p=new Audio(G0);p.preload="auto",p.playbackRate=1,s.audioEls.set(o.id,p)}else{let G0=s.audioEls.get(o.id);if(G0.playbackRate===1)continue;G0.playbackRate=1}for(let[o,G0]of s.audioEls.entries())if(!f.some((p)=>p.id===o))G0.pause(),s.audioEls.delete(o)}function j(m,s){let{frame_rate:f,tracks:o}=y.current,G0=o.filter((p)=>p.type==="audio").flatMap((p)=>p.segments);for(let[p,Z0]of A.current.audioEls.entries()){let Q0=G0.find((B0)=>B0.id===p);if(Q0)Lp(Z0,Q0,m,f,s);else if(!Z0.paused)Z0.pause()}}B8.useEffect(()=>{x()},[q.tracks]),B8.useEffect(()=>{let m=A.current;if(!U){if(m.rafId!==null)cancelAnimationFrame(m.rafId),m.rafId=null,lY.current=-1;j(m.frame,!1);return}x();let s={current:0},f={current:0};function o(G0){let p=(G0-s.current)/1000,{frame_rate:Z0,total_length:Q0}=y.current,B0=f.current+p*Z0,W0=Math.min(Q0-1,B0);if(m.frame=W0,F(Math.round(W0)),j(W0,!0),W0>=Q0-1){if(_(!1),M(!0),D.current)clearTimeout(D.current);D.current=setTimeout(()=>M(!1),1500);return}m.rafId=requestAnimationFrame(o)}return s.current=performance.now(),f.current=m.frame,m.rafId=requestAnimationFrame(o),()=>{if(m.rafId!==null)cancelAnimationFrame(m.rafId)}},[U]),B8.useEffect(()=>{return()=>{for(let m of A.current.audioEls.values())m.pause()}},[]),B8.useEffect(()=>{if(!U||!H.current)return;let m=H.current,s=L/Math.max(q.total_length-1,1)*w,{scrollLeft:f,clientWidth:o}=m,G0=o*0.15;if(sf+o-G0)m.scrollLeft=s-o+G0},[L,U,w,q.total_length]);function P(m){J({...q,...m})}function h(m,s){P({tracks:q.tracks.map((f)=>f.id===m?{...f,...s}:f)})}function l(m,s){P({tracks:q.tracks.map((f)=>f.id===m?{...f,segments:s}:f)})}function t(m){if(I)m.stopPropagation()}function S(){if(!U&&L>=q.total_length-1)F(0),A.current.frame=0;let m=U;if(_((s)=>!s),m){if(M(!0),D.current)clearTimeout(D.current);D.current=setTimeout(()=>M(!1),1500)}else M(!1)}function i(m){if(F(m),A.current.frame=m,lY.current=m,j(m,U),M(!0),!U){if(D.current)clearTimeout(D.current);D.current=setTimeout(()=>M(!1),1500)}}function J0(){if(!z)return;let m=q.tracks.map((s)=>{if(s.type!=="maintain")return{...s,segments:s.segments.filter((Q0)=>Q0.id!==z)};let f=s.segments,o=f.findIndex((Q0)=>Q0.id===z);if(o===-1)return s;if(f.length===1)return{...s,segments:[]};let G0=f[o],p=G0.end_frame-G0.start_frame+1,Z0=f.map((Q0,B0)=>{if(B0===o)return null;let W0={...Q0};if(B0>o)W0.start_frame=Q0.start_frame-p,W0.end_frame=Q0.end_frame-p;return W0}).filter((Q0)=>Q0!==null);if(o>0)Z0[o-1]={...Z0[o-1],end_frame:G0.start_frame-1};return{...s,segments:Z0}});P({tracks:m}),K(null)}let K0=q.tracks.find((m)=>m.type==="maintain"),e=K0&&z?K0.segments.find((m)=>m.id===z)??null:null;B8.useEffect(()=>{let m=W.current?.closest(".comfyui-react-widget");if(!m)return;let s=`${M8}-timeline-editor-open`;return m.classList.toggle(s,e!==null),()=>m.classList.remove(s)},[e]);function H0(m){if(!K0||!z)return;l(K0.id,K0.segments.map((s)=>s.id===z?{...s,content:{...s.content,...m}}:s))}function q0(m,s){if(!K0)return;let f=K0.segments,o=f.findIndex((_0)=>_0.id===m);if(o===-1)return;let G0=f[o],p=G0.end_frame-G0.start_frame+1;if(s===p)return;let Z0=s-p,Q0=G0.end_frame+Z0,B0=f.map((_0,N0)=>{if(N0Math.max(_0,N0.end_frame),0),L0=Math.max(q.total_length,W0+1);P({tracks:q.tracks.map((_0)=>_0.type==="maintain"?{..._0,segments:B0}:_0),total_length:L0})}function E(m){let s=m.target;if(s.closest("[data-edit-panel]")||s.closest("[data-segment-block]")||s.closest("[data-add-popover]")||s.closest("[data-media-selector]")||s.closest("[data-audio-popover]")||s.closest("[data-time-toolbar]")||s.closest("[data-radix-popper-content-wrapper]")||s.closest("[data-radix-context-menu-content]"))return;K(null)}let r=Math.min(1.5,Math.max(0.8,1/T)),u=B/r;return G(y6.Provider,{value:k,children:G(n1,{children:b("div",{ref:W,className:`relative flex flex-col h-full w-full text-foreground font-sans text-xs select-none${I?" nodeNew":""}`,onContextMenu:t,onClick:E,children:[b("div",{className:"flex flex-col flex-1 min-h-0 rounded overflow-hidden",children:[G(dN,{totalLength:q.total_length,frameRate:q.frame_rate,displayFormat:X,onTotalLengthChange:(m)=>{let s=q.total_length;if(m{if(p.end_frame>=m){let Z0=p.end_frame-p.start_frame+1,Q0=m-p.start_frame;return{...p,end_frame:m-1,content:{...p.content,images:MZ(p.content.images,Z0,Q0)}}}return p}),G0=5;for(let p=o.length-1;p>=0;p--){let Z0=o[p],Q0=Z0.end_frame-Z0.start_frame+1;if(Q0{if(L0===p)return null;let _0={...W0};if(L0>p)_0.start_frame=Math.max(0,W0.start_frame-B0),_0.end_frame=Math.max(0,W0.end_frame-B0);return _0}).filter((W0)=>W0!==null),p>0)o[p-1]={...o[p-1],end_frame:Z0.start_frame-1}}}P({tracks:q.tracks.map((p)=>p.type==="maintain"?{...p,segments:o}:p),total_length:m})}else P({total_length:m})},onFrameRateChange:(m)=>P({frame_rate:m}),onDisplayFormatChange:Y,isPlaying:U,onPlayPause:S,hasSelection:z!==null,canDelete:z!==null&&(q.tracks.some((m)=>m.type!=="maintain"&&m.segments.some((s)=>s.id===z))||(K0?.segments.length??0)>0),onDeleteSelected:J0,zoom:N,onZoomChange:O,selectedSegment:e,onSelectedSegmentDurationChange:q0}),G("div",{ref:H,className:"flex-1 min-h-0 overflow-x-hidden overflow-y-auto",children:b("div",{className:"h-full flex flex-col",style:{width:w,minWidth:"100%"},children:[G("div",{className:"border-t shrink-0",children:G(JY,{totalFrames:q.total_length,frameRate:q.frame_rate,displayFormat:X,width:w,canvasScale:T,playheadFrame:L,showLabel:V||U,onSeek:i,onWheel:C})}),b("div",{className:"relative flex-1 min-h-0 flex flex-col",children:[L!==void 0&&w>0&&G("div",{className:"absolute top-0 h-full w-px bg-red-400 pointer-events-none z-30",style:{left:L/Math.max(q.total_length-1,1)*w}}),q.tracks.map((m)=>{if(m.type==="maintain")return G(wk,{track:m,totalFrames:q.total_length,frameRate:q.frame_rate,displayFormat:X,areaWidth:w,canvasScale:T,selectedId:z,onSelectedIdChange:K,onTrackChange:(s)=>h(m.id,s),onSegmentsChange:(s)=>l(m.id,s),onExtendTimeline:(s,f)=>{P({tracks:q.tracks.map((o)=>o.type==="maintain"?{...o,segments:s}:o),total_length:f})},grow:2},m.id);if(m.type==="audio")return G(tk,{track:m,totalFrames:q.total_length,frameRate:q.frame_rate,displayFormat:X,areaWidth:w,selectedId:z,onSelectedIdChange:K,onTrackChange:(s)=>h(m.id,s),onSegmentsChange:(s)=>l(m.id,s),node:Z,app:Q,grow:1},m.id);return null})]})]})})]}),e&&K0&&G("div",{className:"absolute left-0 z-50",style:{top:"100%",transformOrigin:"top left",transform:`scale(${r})`,width:u},children:G(QI,{segment:e,allSegments:K0.segments,totalFrames:q.total_length,frameRate:q.frame_rate,displayFormat:X,areaWidth:u,canvasScale:T*r,trackColor:K0.color,onContentChange:H0,onAllSegmentsChange:(m)=>{if(l(K0.id,m),z&&!m.some((s)=>s.id===z))K(null)},node:Z,app:Q})})]})})})}var l1=R(v(),1);var V6=R(v(),1),OB=50;function d4($){return JSON.stringify($)}function YI($,J){let[Q,Z]=V6.useState({past:[],future:[]}),q=V6.useRef($),X=V6.useRef(d4($)),Y=V6.useRef(d4($)),z=V6.useRef(new Set),K=V6.useRef(new Set),W=d4($);V6.useLayoutEffect(()=>{let _=z.current;if(_.size>0){if(_.has(W)){if(_.delete(W),_.size===0)K.current.clear();Y.current=W,X.current=W,q.current=$;return}if(W===Y.current||K.current.has(W))return;_.clear(),K.current.clear(),X.current=W,Y.current=W,q.current=$,Z({past:[],future:[]});return}if(q.current=$,W!==X.current){X.current=W,Y.current=W,Z({past:[],future:[]});return}Y.current=W},[$,W]);let H=V6.useCallback((_)=>{let L=q.current,F=d4(L),V=d4(_);if(V===F)return;X.current=V,z.current.add(V),K.current.add(F),q.current=_,Z((M)=>({past:[...M.past,L].slice(-OB),future:[]})),J(_)},[J]),B=V6.useCallback(()=>{Z((_)=>{let L=_.past.at(-1);if(!L)return _;let F=q.current,V=d4(F),M=d4(L);return X.current=M,z.current.add(M),K.current.add(V),q.current=L,J(L),{past:_.past.slice(0,-1),future:[F,..._.future].slice(0,OB)}})},[J]),U=V6.useCallback(()=>{Z((_)=>{let L=_.future[0];if(!L)return _;let F=q.current,V=d4(F),M=d4(L);return X.current=M,z.current.add(M),K.current.add(V),q.current=L,J(L),{past:[..._.past,F].slice(-OB),future:_.future.slice(1)}})},[J]);return{canUndo:Q.past.length>0,canRedo:Q.future.length>0,commitChange:H,undo:B,redo:U}}var rY=R(v(),1);var Vp=250;function AB($){try{return JSON.stringify($)}catch(J){return console.error("[useMultiTrackResolutionInput] failed to serialize resolution input:",J),String(Date.now())}}function sY($){let[J,Q]=rY.useState(()=>iY($));return rY.useEffect(()=>{let Z=iY($),q=AB(Z);Q((Y)=>AB(Y)===q?Y:Z);let X=window.setInterval(()=>{Z=iY($);let Y=AB(Z);if(Y===q)return;q=Y,Q(Z)},Vp);return()=>window.clearInterval(X)},[$]),J}var wB="easy-media-model-missing";class E2 extends Error{model;constructor($,J){super($);this.name="MissingModelError",this.model=J}}function Mp($){if(!$||typeof $!=="object")return!1;let J=$;return typeof J.name==="string"&&typeof J.display_name==="string"&&typeof J.filename==="string"&&typeof J.directory==="string"&&typeof J.path==="string"&&typeof J.url==="string"&&(J.urls===void 0||Array.isArray(J.urls)&&J.urls.every((Q)=>typeof Q==="string"))}function oY($){return Mp($)?$:null}function AJ($){if(!$||typeof $!=="object")return;let J=$,Q=oY(J.model_missing);if(!Q)return;let Z=typeof J.error==="string"?J.error:`${Q.display_name} model is not installed.`;throw new E2(Z,Q)}async function zI($){let J=await fetch("/easy-media/models/download",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model_name:$})}),Q;try{Q=await J.json()}catch(q){throw Error(`Model download returned invalid JSON: ${String(q)}`)}if(!J.ok){let q=Q&&typeof Q==="object"&&"error"in Q?String(Q.error):`Model download failed (${J.status})`;throw Error(q)}if(!Q||typeof Q!=="object")throw Error("Invalid model download response");let Z=oY(Q.model);if(!Z)throw Error("Invalid model download response");return Z}function Dp($){if(!$||typeof $!=="object")throw Error("Invalid smart split response");let J=$;if(typeof J.error==="string")throw Error(J.error);if(!Array.isArray(J.ranges))throw Error("Invalid smart split response");return{ranges:J.ranges.map((Z)=>{if(!Array.isArray(Z)||Z.length!==2||!Z.every(Number.isFinite))throw Error("Invalid shot range in smart split response");return[Number(Z[0]),Number(Z[1])]})}}async function kB($,J){let Q=await fetch("/easy-media/video/smart-split",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source_type:$.content.source_type??"input",file_path:$.content.file_path,local_path:$.content.local_path,url:$.content.url,fps:J})}),Z;try{Z=await Q.json()}catch(q){throw Error(`Smart split returned invalid JSON: ${String(q)}`)}if(!Q.ok){AJ(Z);let q=Z&&typeof Z==="object"&&"error"in Z?String(Z.error):`Smart split failed (${Q.status})`;throw Error(q)}return Dp(Z)}function nY($,J,Q){let Z=[$.start_frame,...J,$.end_frame];return Z.slice(0,-1).map((q,X)=>({...$,id:X===0?$.id:x1(),start_frame:q,end_frame:Z[X+1],...Q===void 0?{}:{origin_start_frame:Q},content:{...$.content,images:$.content.images?.map((Y)=>({...Y}))}}))}function IB($,J){return $.tracks.find((Q)=>Q.type==="video"&&Q.segments.some((Z)=>Z.id===J))?.segments.find((Q)=>Q.id===J)}function KI($,J){let Q=$.origin_start_frame??$.start_frame;return[...new Set(J.ranges.map((Z)=>Z[1]+Q).filter((Z)=>Z>$.start_frame&&Z<$.end_frame))].sort((Z,q)=>Z-q)}function GI($,J){let Q=IB($,J);if(!Q)return!1;return $.tracks.some((Z)=>Z.type==="task"&&Z.segments.some((q)=>q.start_frame===Q.start_frame&&q.end_frame===Q.end_frame))}function WI($,J,Q){let Z=IB($,J);if(!Z)return $;let q=Z.end_frame-Z.start_frame,X=Z.origin_start_frame??Z.start_frame,Y=KI(Z,Q);if(q<=1||Y.length===0)return $;let z=$.tracks.map((K)=>({...K,segments:K.segments.flatMap((W)=>{let H=W.id===J,B=K.type==="task"&&W.start_frame===Z.start_frame&&W.end_frame===Z.end_frame;if(H)return nY(W,Y,X);return B?nY(W,Y):[W]}).sort((W,H)=>W.start_frame-H.start_frame)}));return{...$,tracks:z}}function HI($,J,Q){let Z=IB($,J);if(!Z)return $;let q=KI(Z,Q);if(q.length===0)return $;return{...$,tracks:$.tracks.map((X)=>({...X,segments:X.segments.flatMap((Y)=>X.type==="task"&&Y.start_frame===Z.start_frame&&Y.end_frame===Z.end_frame?nY(Y,q):[Y]).sort((Y,z)=>Y.start_frame-z.start_frame)}))}}function TB($,J,Q){let Z=$.tracks.flatMap((z)=>z.segments).find((z)=>z.id===J),q=Math.round(Q);if(!Z||q<=Z.start_frame||q>=Z.end_frame)return $;let Y=Z.content.media_type==="video"||Z.content.media_type==="audio"?Z.origin_start_frame??Z.start_frame:void 0;return{...$,tracks:$.tracks.map((z)=>({...z,segments:z.segments.flatMap((K)=>K.id===J?nY(K,[q],Y):[K]).sort((K,W)=>K.start_frame-W.start_frame)}))}}var y2="#9D4937",R2={font_size:12,color:"#ffffff",outline_color:"#000000",background_color:"rgba(0, 0, 0, 0)",background_opacity:0.7,x:0.125,y:0.8,width:0.75};function Np($){if(!$||typeof $!=="object")throw Error("Invalid subtitle segment");let J=$,Q=Number(J.start),Z=Number(J.end);if(!Number.isFinite(Q)||!Number.isFinite(Z)||Z<=Q)throw Error("Invalid subtitle timestamp");if(typeof J.text!=="string")throw Error("Invalid subtitle text");return{start:Q,end:Z,text:J.text}}function Op($){if(!$||typeof $!=="object")throw Error("Invalid subtitle recognition response");let J=$;if(typeof J.error==="string")throw Error(J.error);if(!Array.isArray(J.segments))throw Error("Invalid subtitle recognition response");return{segments:J.segments.map(Np)}}function Ap($,J){return $.tracks.find((Q)=>(Q.type==="video"||Q.type==="audio")&&Q.segments.some((Z)=>Z.id===J))?.segments.find((Q)=>Q.id===J)}function wp($){return{id:x1(),name:`Subtitle ${$+1}`,type:"subtitle",color:y2,muted:!1,solo:!1,volume_db:P2,locked:!1,segments:[]}}async function BI($,J,Q="qwen3-asr"){let Z=await fetch("/easy-media/subtitles/recognize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({media_type:$.content.media_type,source_type:$.content.source_type??"input",file_path:$.content.file_path,local_path:$.content.local_path,url:$.content.url,fps:J,start_frame:$.start_frame,end_frame:$.end_frame,origin_start_frame:$.origin_start_frame,method:Q})}),q;try{q=await Z.json()}catch(X){throw Error(`Subtitle recognition returned invalid JSON: ${String(X)}`)}if(!Z.ok){AJ(q);let X=q&&typeof q==="object"&&"error"in q?String(q.error):`Subtitle recognition failed (${Z.status})`;throw Error(X)}return Op(q)}function UI($,J,Q){let Z=Ap($,J);if(!Z||Q.segments.length===0)return $;let q=Q.segments.flatMap((K)=>{let W=Math.max(Z.start_frame,Z.start_frame+P9(K.start,$.frame_rate)),H=Math.min(Z.end_frame,Z.start_frame+P9(K.end,$.frame_rate));if(H<=W)return[];return[{id:x1(),start_frame:W,end_frame:H,color:y2,content:{media_type:"subtitle",text:K.text,subtitle_style:{...R2}}}]});if(q.length===0)return $;let X=!1,Y=$.tracks.map((K)=>{if(K.type!=="subtitle")return K;if(X)return K;return X=!0,{...K,color:K.color||y2,segments:[...K.segments,...q].sort((W,H)=>W.start_frame-H.start_frame)}}),z=X?Y:[...$.tracks,{...wp($.tracks.filter((K)=>K.type==="subtitle").length),segments:q}];return{...$,tracks:z,total_length:U8(z,$.frame_rate)}}var IZ={model:"VoxCPM2",prompt:"",cfg:2,steps:10,referenceAudio:"",referenceAudioSourceType:"input"};async function kp($){if(!$.referenceAudio)return{path:void 0,sourceType:void 0};if(!/^https?:\/\//i.test($.referenceAudio))return{path:$.referenceAudio,sourceType:$.referenceAudioSourceType??"input"};let J=await fetch("/easy-media/download-url",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:$.referenceAudio})}),Q;try{Q=await J.json()}catch(q){throw Error(`Reference audio download returned invalid JSON: ${String(q)}`)}let Z=Q&&typeof Q==="object"&&"file_name"in Q?Q.file_name:void 0;if(!J.ok||typeof Z!=="string"||!Z){let q=Q&&typeof Q==="object"&&"error"in Q?String(Q.error):`Reference audio download failed (${J.status})`;throw Error(q)}return{path:Z,sourceType:"input"}}function Ip($){if(!$||typeof $!=="object")throw Error("Invalid subtitle speech response");let J=$;if(typeof J.error==="string")throw Error(J.error);if(typeof J.file_path!=="string"||J.source_type!=="output")throw Error("Invalid subtitle speech response");return{filePath:J.file_path,sourceType:"output",absolutePath:typeof J.absolute_path==="string"?J.absolute_path:"",message:typeof J.message==="string"?J.message:"",duration:typeof J.duration==="number"&&Number.isFinite(J.duration)?J.duration:void 0}}async function _I($){let J=await kp($),Q=await fetch("/easy-media/subtitles/speech",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:$.text,model:$.model,prompt:$.prompt,cfg:$.cfg,steps:$.steps,reference_audio_path:J.path,reference_audio_source_type:J.sourceType})}),Z;try{Z=await Q.json()}catch(q){throw Error(`Subtitle speech returned invalid JSON: ${String(q)}`)}if(!Q.ok){AJ(Z);let q=Z&&typeof Z==="object"&&"error"in Z?String(Z.error):`Subtitle speech failed (${Q.status})`;throw Error(q)}return Ip(Z)}function Tp($,J,Q,Z){return Math.max($,Q){if(H.type!=="audio"||z)return H;if(H.segments.some((U)=>Tp(J.startFrame,X,U.start_frame,U.end_frame)))return H;return z=!0,{...H,segments:[...H.segments,Y].sort((U,_)=>U.start_frame-_.start_frame)}}),W=z?K:[...K,bp($.tracks.filter((H)=>H.type==="audio").length,Y)];return{...$,tracks:W,total_length:U8(W,$.frame_rate)}}var jp=/^(\d+):([0-5]\d):([0-5]\d)[,.](\d{3})\s*-->\s*(\d+):([0-5]\d):([0-5]\d)[,.](\d{3})(?:\s+.*)?$/;function FI($){let[J,Q,Z,q]=$.map(Number);return J*3600+Q*60+Z+q/1000}function Ep($){let J=$.replace(/^\uFEFF/,"").replaceAll(`\r -`,` -`).replaceAll("\r",` -`).split(` -`),Q=[];for(let Z=0;ZX)Q.push({startSeconds:X,endSeconds:Y,text:K})}return Q}function VI($,J){let Q=Ep($).sort((q,X)=>q.startSeconds-X.startSeconds||q.endSeconds-X.endSeconds);if(Q.length===0)throw Error("No valid SRT subtitle cues found");let Z=Q[0].startSeconds;return Q.map((q,X)=>{let Y=J.startFrame+Math.round((q.startSeconds-Z)*J.frameRate),z=Math.max(Y+1,J.startFrame+Math.round((q.endSeconds-Z)*J.frameRate));return{id:J.createId(X),start_frame:Y,end_frame:z,color:J.color,content:{media_type:"subtitle",text:q.text,subtitle_style:{...J.subtitleStyle}}}})}function bB($,J){if(!J)return!1;try{return new URL($,J).origin===new URL(J).origin}catch(Q){return console.error("[audio-utils] failed to resolve media origin:",Q),!1}}function MI($,J,Q=globalThis.location?.href){let q=10**((Number.isFinite($)?$:0)/20);return bB(J,Q)?q:Math.min(1,q)}function jB($){return new Promise((J,Q)=>{let Z=new Audio,q=()=>{Z.removeEventListener("loadedmetadata",X),Z.removeEventListener("error",Y),Z.src=""},X=()=>{let z=Z.duration;if(q(),!Number.isFinite(z)||z<=0){Q(Error(`Invalid audio duration for ${$}`));return}J({duration:z})},Y=()=>{q(),Q(Error(`Unable to load audio metadata for ${$}`))};Z.addEventListener("loadedmetadata",X),Z.addEventListener("error",Y),Z.preload="metadata",Z.src=$})}function TZ($){return new Promise((J,Q)=>{let Z=document.createElement("video");Z.preload="metadata",Z.muted=!0,Z.onloadedmetadata=()=>{J({duration:Number.isFinite(Z.duration)?Z.duration:0,width:Z.videoWidth,height:Z.videoHeight})},Z.onerror=()=>Q(Error(`Unable to load video metadata: ${$}`)),Z.src=$})}function DI($,J=0.1){return new Promise((Q,Z)=>{let q=document.createElement("video");q.preload="auto",q.muted=!0,q.playsInline=!0;function X(){try{let{videoWidth:Y,videoHeight:z}=q;if(Y<=0||z<=0){Z(Error(`Unable to capture video frame: ${$}`));return}let K=document.createElement("canvas");K.width=Y,K.height=z;let W=K.getContext("2d");if(!W){Z(Error("Unable to create canvas context for video frame"));return}W.drawImage(q,0,0,Y,z),K.toBlob((H)=>{if(!H){Z(Error(`Unable to encode video frame: ${$}`));return}Q(URL.createObjectURL(H))},"image/jpeg",0.8)}catch(Y){Z(Y instanceof Error?Y:Error(`Unable to capture video frame: ${$}`))}}q.onloadeddata=()=>{let Y=Number.isFinite(q.duration)?Math.max(0,Math.min(J,Math.max(0,q.duration-0.001))):Math.max(0,J);if(Y>0){q.currentTime=Y;return}X()},q.onseeked=X,q.onerror=()=>Z(Error(`Unable to load video frame: ${$}`)),q.src=$})}var aY=R(v(),1);var NI=bZ("SplitCenterIcon",[["path",{d:"M5 4h4v16H5",key:"left-bracket"}],["path",{d:"M19 4h-4v16h4",key:"right-bracket"}]]),OI=bZ("SplitLeftDotsIcon",[["path",{d:"M20 4h-4v16h4",key:"bracket"}],["path",{d:"M6 4h.01",key:"d1"}],["path",{d:"M6 20h.01",key:"d3"}],["path",{d:"M11 4h.01",key:"d4"}],["path",{d:"M11 8h.01",key:"d5"}],["path",{d:"M11 12h.01",key:"d6"}],["path",{d:"M11 16h.01",key:"d7"}],["path",{d:"M11 20h.01",key:"d8"}]]),AI=bZ("SplitRightDotsIcon",[["path",{d:"M4 4h4v16H4",key:"bracket"}],["path",{d:"M13 4h.01",key:"d1"}],["path",{d:"M13 8h.01",key:"d2"}],["path",{d:"M13 12h.01",key:"d3"}],["path",{d:"M13 16h.01",key:"d4"}],["path",{d:"M13 20h.01",key:"d5"}],["path",{d:"M18 4h.01",key:"d6"}],["path",{d:"M18 20h.01",key:"d8"}]]),wJ=bZ("TaskMarkerIcon",[["path",{d:"M7.5 4.75h9a1 1 0 0 1 1 1v8.5L12 20l-5.5-5.75V5.75a1 1 0 0 1 1-1Z",key:"task-marker"}]]);function wI({marker:$,markerNumber:J,frameRate:Q,left:Z,selected:q,dragging:X,onSelect:Y,onDragStart:z,onDelete:K}){let W=X1(),H=W("multitrack.taskMarkerLabel",{n:J.toString().padStart(2,"0")}),B=M6($.frame,{frameRate:Q,showFrames:!0,showHours:!1});return b(o6,{children:[b(B1,{children:[G(U1,{asChild:!0,children:G(n6,{asChild:!0,children:b(k0,{type:"button",variant:"ghost",size:"icon",className:`absolute top-0 z-30 h-6 w-5 -translate-x-1/2 rounded-none p-0 hover:bg-transparent ${X?"cursor-grabbing":"cursor-grab"} ${q?"opacity-100":"opacity-90"}`,style:{left:Z,color:"var(--highlight)"},"aria-label":W("multitrack.taskMarkerAtFrame",{frame:$.frame}),"aria-pressed":q,onMouseDown:(U)=>{U.preventDefault(),U.stopPropagation(),Y($.id),z($.id,U.clientX)},onContextMenu:(U)=>{U.stopPropagation(),Y($.id)},onClick:(U)=>{U.stopPropagation()},children:[G("span",{className:"absolute left-1/2 top-0 h-2 w-px -translate-x-1/2 bg-border"}),G(wJ,{className:"absolute left-1/2 top-1 h-4 w-4 -translate-x-1/2 fill-current stroke-current"})]})})}),b(H1,{side:"bottom",sideOffset:3,className:"min-w-24 rounded-md border border-border bg-popover px-2 py-1.5 text-popover-foreground shadow-md",children:[G("div",{className:"text-[10px] font-medium leading-4",children:H}),G("div",{className:"text-[11px] leading-4 tabular-nums",children:B})]})]}),G(E6,{children:b(J5,{onClick:()=>K($.id),children:[G(M5,{className:"mr-2 h-3.5 w-3.5"}),W("multitrack.deleteTaskMarker")]})})]})}var Z5=28,C2=48,EB=56,yB=[1,2,5,10,15,30,60,120,300];function yp($,J,Q){let Z=Math.max(1,J),q=Math.max($,1),X=Q/q,Y=X>=6,z=[],K=Number.NEGATIVE_INFINITY;function W(L){return(L-K)*X>=EB}function H(L,F,V){if(F)K=L;z.push({time:L,label:F,major:V})}if(Y){let L=Math.max(1,Math.ceil(EB/Math.max(X,1))),F=Math.max(1,Math.round(Z/8)),V=Math.max(1,Math.ceil(L/F)*F);for(let M=0;M<=$;M+=1){let D=M%V===0,N=M===$&&W(M),O=D||N;H(M,O?M6(M,{frameRate:Z,showFrames:!0}):void 0,O)}return z}let B=EB/Math.max(X*Z,1),U=yB.find((L)=>L>=B)??yB[yB.length-1],_=Math.max(1,Math.round(U*Z));for(let L=0;L<=$;L+=_)H(L,M6(L,{frameRate:Z,showFrames:!0}),!0);if(z.at(-1)?.time!==$&&W($))H($,M6($,{frameRate:Z,showFrames:!0}),!0);return z}function tY({totalLength:$,frameRate:J,width:Q,canvasScale:Z,currentTime:q,taskMarkers:X,selectedTaskMarkerId:Y,onSeek:z,onSelectTaskMarker:K,onMoveTaskMarker:W,onDeleteTaskMarker:H}){let B=aY.useRef(null),[U,_]=aY.useState(null),L=Math.max(1,Q-Z5),F=Math.max(1,L-C2),V=yp($,J,F),M=Math.max($,1),D=Z5+q/M*F,N=Z5+F;function O(A){let w=A/Math.max(Q,1);return Number.isFinite(w)&&w>0.01?w:Math.max(Z,0.01)}function I(A,w,C){let x=Math.max(0,(A-w)/C-Z5)/F;return Math.max(0,Math.min($,Math.round(x*$)))}function k(A){A.preventDefault();let w=A.currentTarget.getBoundingClientRect(),C=O(w.width);z(I(A.clientX,w.left,C));function y(j){z(I(j.clientX,w.left,C))}function x(){globalThis.removeEventListener("mousemove",y),globalThis.removeEventListener("mouseup",x)}globalThis.addEventListener("mousemove",y),globalThis.addEventListener("mouseup",x)}function T(A,w){let C=X.find((i)=>i.id===A);if(!C)return;let y=B.current?.getBoundingClientRect(),x=y?.left??0,j=O(y?.width??0),P=C.frame,h=P;function l(i){let J0=Math.max(1,I(i,x,j));if(X.some((e)=>e.id!==A&&e.frame===J0))return;h=J0,_({markerId:A,frame:J0})}function t(i){l(i.clientX)}function S(i){if(l(i.clientX),globalThis.removeEventListener("mousemove",t),globalThis.removeEventListener("mouseup",S),_(null),h!==P)W(A,h)}l(w),globalThis.addEventListener("mousemove",t),globalThis.addEventListener("mouseup",S)}return b("div",{ref:B,className:`relative h-6 shrink-0 select-none border-b border-border ${U?"cursor-grabbing":"cursor-col-resize"}`,style:{width:Q},onMouseDown:k,children:[G("div",{className:"absolute left-0 top-0 h-full border-r border-border",style:{width:Z5}}),G("div",{className:"pointer-events-none absolute top-0 h-full bg-black/30",style:{left:N,width:C2}}),V.map((A)=>b("div",{className:"absolute bottom-0 flex h-full flex-col justify-end",style:{left:Z5+A.time/M*F},children:[G("div",{className:A.major?"h-3 w-px bg-border":"h-1.5 w-px bg-border"}),A.label&&G("span",{className:"absolute left-1 top-1 text-[8px] text-muted-foreground",children:A.label})]},`${A.time}-${A.major?"major":"minor"}`)),X.map((A,w)=>{let C=U?.markerId===A.id,y=C?{...A,frame:U.frame}:A;return G(wI,{marker:y,markerNumber:w+1,frameRate:J,left:Z5+y.frame/M*F,selected:y.id===Y,dragging:C,onSelect:K,onDragStart:T,onDelete:H},y.id)}),G("div",{className:"absolute top-0 h-full w-px bg-destructive",style:{left:D}})]})}var R9="h-6 w-6 shrink-0 [&_svg]:size-3.5",D6="size-3.5";function bI({currentTime:$,totalLength:J,frameRate:Q,isPlaying:Z,zoom:q,snapEnabled:X,taskOverview:Y,timelineCollapsed:z,onPlayPause:K,onZoomChange:W,onSnapEnabledChange:H,canAddTaskMarker:B,onAddTaskMarker:U,onTaskOverviewChange:_,onToggleTimeline:L,canDelete:F,onDeleteSelected:V,onCutAtCurrentTime:M,canTrimCenter:D,canTrimLeft:N,canTrimRight:O,onTrimLeftAtCurrentTime:I,onTrimRightAtCurrentTime:k,canUndo:T,canRedo:A,onUndo:w,onRedo:C}){let y=X1();function x(j,P){return b(B1,{children:[G(U1,{asChild:!0,children:G("span",{className:"inline-flex shrink-0",children:P})}),G(H1,{children:j})]})}return b("div",{className:"grid h-9 min-h-9 shrink-0 grid-cols-[1fr_auto_1fr] items-center overflow-hidden border-b border-border text-[10px] leading-none",children:[b("div",{className:"flex items-center",children:[x(y("multitrack.undo"),G(k0,{type:"button",variant:"ghost",size:"icon",className:`${R9} text-muted-foreground cursor-pointer`,disabled:!T,"aria-label":y("multitrack.undo"),onClick:(j)=>{j.stopPropagation(),w()},children:G(TI,{className:D6})})),x(y("multitrack.redo"),G(k0,{type:"button",variant:"ghost",size:"icon",className:`${R9} text-muted-foreground cursor-pointer`,disabled:!A,"aria-label":y("multitrack.redo"),onClick:(j)=>{j.stopPropagation(),C()},children:G(II,{className:D6})})),x(y("multitrack.cutMode"),G(k0,{type:"button",variant:"ghost",size:"icon",className:`${R9} text-muted-foreground cursor-pointer`,disabled:!D,"aria-label":y("multitrack.cutMode"),onClick:(j)=>{j.stopPropagation(),M()},children:G(NI,{className:D6})})),x(y("multitrack.trimLeftAtPlayhead"),G(k0,{type:"button",variant:"ghost",size:"icon",className:`${R9} text-muted-foreground cursor-pointer`,disabled:!N,"aria-label":y("multitrack.trimLeftAtPlayhead"),onClick:(j)=>{j.stopPropagation(),I()},children:G(OI,{className:D6})})),x(y("multitrack.trimRightAtPlayhead"),G(k0,{type:"button",variant:"ghost",size:"icon",className:`${R9} text-muted-foreground cursor-pointer`,disabled:!O,"aria-label":y("multitrack.trimRightAtPlayhead"),onClick:(j)=>{j.stopPropagation(),k()},children:G(AI,{className:D6})})),x(y("multitrack.deleteSelectedSegment"),G(k0,{type:"button",variant:"ghost",size:"icon",className:`${R9} text-muted-foreground cursor-pointer`,disabled:!F,"aria-label":y("multitrack.deleteSelectedSegment"),onClick:(j)=>{j.stopPropagation(),V()},children:G(M5,{className:D6})})),x(y("multitrack.addTaskMarker"),G(k0,{type:"button",variant:"ghost",size:"icon",className:`${R9} text-muted-foreground cursor-pointer`,disabled:!B,"aria-label":y("multitrack.addTaskMarker"),onClick:(j)=>{j.stopPropagation(),U()},children:G(wJ,{className:D6})}))]}),b("div",{className:"flex items-center gap-2 text-muted-foreground",children:[G("span",{className:"w-16 text-right tabular-nums text-gradient",children:M6($,{frameRate:Q,showFrames:!0})}),x(Z?y("multitrack.pause"):y("multitrack.play"),G(k0,{type:"button",variant:"secondary",size:"icon",className:`${R9} text-foreground rounded-full cursor-pointer`,"aria-label":Z?y("multitrack.pause"):y("multitrack.play"),onClick:K,children:Z?b("svg",{className:D6,viewBox:"0 0 24 24",fill:"none",children:[G("defs",{children:b("linearGradient",{id:"icon-gradient-pause",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[G("stop",{offset:"0%",stopColor:"var(--primary)"}),G("stop",{offset:"100%",stopColor:"var(--highlight)"})]})}),G("rect",{x:"6",y:"5",width:"4",height:"14",rx:"1",fill:"url(#icon-gradient-pause)"}),G("rect",{x:"14",y:"5",width:"4",height:"14",rx:"1",fill:"url(#icon-gradient-pause)"})]}):b("svg",{className:D6,viewBox:"0 0 24 24",fill:"none",children:[G("defs",{children:b("linearGradient",{id:"icon-gradient-play",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[G("stop",{offset:"0%",stopColor:"var(--primary)"}),G("stop",{offset:"100%",stopColor:"var(--highlight)"})]})}),G("path",{d:"M8 5.5v13l11-6.5L8 5.5z",fill:"url(#icon-gradient-play)"})]})})),G("span",{className:"w-16 tabular-nums",children:M6(J,{frameRate:Q,showFrames:!0})})]}),b("div",{className:"ml-auto flex h-6 max-h-6 min-h-6 items-center gap-0.5 overflow-hidden",children:[x(y("multitrack.taskOverview"),G(k0,{type:"button",variant:Y?"outline":"ghost",size:"icon",className:`${R9} cursor-pointer ${Y?"text-highlight":"text-muted-foreground"}`,"aria-label":y("multitrack.taskOverview"),"aria-pressed":Y,onClick:(j)=>{j.stopPropagation(),_(!Y)},children:G(eY,{className:D6})})),x(y("multitrack.timelineSnap"),G(k0,{type:"button",variant:X?"outline":"ghost",size:"icon",className:`${R9} cursor-pointer ${X?"text-highlight":"text-muted-foreground"}`,"aria-label":y("multitrack.timelineSnap"),"aria-pressed":X,onClick:(j)=>{j.stopPropagation(),H(!X)},children:G(kI,{className:D6})})),x(z?y("multitrack.showTimeline"):y("multitrack.hideTimeline"),G(k0,{type:"button",variant:"ghost",size:"icon",className:`${R9} text-muted-foreground cursor-pointer`,"aria-label":z?y("multitrack.showTimeline"):y("multitrack.hideTimeline"),onClick:(j)=>{j.stopPropagation(),L()},children:z?G($z,{className:D6}):G(Jz,{className:D6})})),x(y("multitrack.timelineZoom"),G("span",{className:"inline-flex shrink-0","aria-label":y("multitrack.timelineZoom"),children:G(t$,{className:`${D6} text-muted-foreground`})})),G("div",{className:"relative h-3 max-h-3 min-h-3 w-12 overflow-visible",children:G(N8,{min:1,max:6,step:0.25,value:[q],onValueChange:([j])=>W(j),className:"absolute inset-0 h-3 max-h-3 min-h-3 w-12 [&_[role=slider]]:h-2.5 [&_[role=slider]]:w-2.5 [&_[data-orientation=horizontal]]:h-1","aria-label":y("multitrack.timelineZoom")})})]})]})}var w5=R(v(),1);var Pp=jI("inline-flex items-center rounded-md border px-2 py-0.5 text-xs font-medium transition-colors focus:outline-none focus:ring-1 focus:ring-ring",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function kJ({className:$,variant:J,...Q}){return G("div",{className:b0(Pp({variant:J}),$),...Q})}var A7=R(v(),1),PB=1,Rp=6,EI=1.15,yI={x:50,y:50};function Qz($,J){let Q=A7.useRef(null),[Z,q]=A7.useState(PB),[X,Y]=A7.useState(yI);A7.useEffect(()=>{q(PB),Y(yI)},[$]),A7.useEffect(()=>{if(!$)return;let K=(W)=>{if(W.key==="Escape")J()};return document.addEventListener("keydown",K),()=>document.removeEventListener("keydown",K)},[$,J]);function z(K){K.preventDefault(),K.stopPropagation();let W=Q.current?.getBoundingClientRect();if(W&&W.width>0&&W.height>0)Y({x:Math.max(0,Math.min(100,(K.clientX-W.left)/W.width*100)),y:Math.max(0,Math.min(100,(K.clientY-W.top)/W.height*100))});let H=K.deltaY<0?EI:1/EI;q((B)=>Math.max(PB,Math.min(Rp,B*H)))}return{imageRef:Q,zoom:Z,origin:X,onWheel:z}}var qz=R(v(),1);function Cp($){let J=a9.findIndex((Z)=>Z===$);if(J>=0)return J;let Q=a9.findIndex((Z)=>Z===S2);if(!Number.isFinite($)||$<=0)return Math.max(0,Q);return a9.reduce((Z,q,X)=>{let Y=a9[Z]??S2;return Math.abs(q-$){M(F)},[F]);function D(T){let A=SB(T);if(B){K({volume_db:A});return}z({volume_db:A})}function N(){if(B){K({muted:!L});return}z({muted:!$})}function O(T){let A=Math.max(0,Math.min(a9.length-1,Math.round(T))),w=a9[A]??S2;if(w!==Q)z({frame_rate:w})}function I(){let T=Zz(V,Q);if(T===null){M(F);return}if(M(IJ(T,Q)),T!==X)W(T)}let k=Cp(Q);return b("div",{className:"absolute top-1/2 z-20 flex -translate-y-1/2 flex-col overflow-hidden rounded-lg border border-border bg-popover/90 text-popover-foreground shadow-lg backdrop-blur",style:{right:Y},children:[b(a1,{children:[G(T5,{asChild:!0,children:b(k0,{type:"button",variant:"ghost",className:"flex h-12 w-10 flex-col gap-1 rounded-none px-1 py-1 cursor-pointer","aria-label":H("multitrack.audioSettings"),children:[L?G(TJ,{className:"h-4 w-4"}):G(t9,{className:"h-4 w-4"}),G("span",{className:"text-[8px]",children:U})]})}),b(s1,{className:"w-56 space-y-3",align:"end",side:"left",children:[b("div",{className:"flex items-center justify-between gap-3 cursor-pointer",children:[G("span",{className:"text-sm font-medium",children:U}),G(k0,{type:"button",variant:"secondary",size:"sm",className:"cursor-pointer","aria-label":L?H("multitrack.unmutePreviewAudio"):H("multitrack.mutePreviewAudio"),onClick:N,children:L?H("multitrack.unmute"):H("multitrack.mute")})]}),b("div",{className:"grid gap-2 text-xs text-muted-foreground",children:[b("span",{className:"flex items-center justify-between",children:[G("span",{children:H("multitrack.volume")}),b("span",{className:"tabular-nums text-foreground",children:[_.toFixed(1)," dB"]})]}),G(e8,{"aria-label":H("multitrack.volume"),min:RB,max:CB,step:0.1,className:"cursor-pointer",value:_,onChange:D})]}),G(N8,{"aria-label":H("multitrack.volume"),className:"cursor-pointer",value:[SB(_)],min:RB,max:CB,step:0.1,onValueChange:(T)=>D(T[0]??0)})]})]}),G("div",{className:"mx-3 h-px bg-border"}),b(a1,{children:[G(T5,{asChild:!0,children:b(k0,{type:"button",variant:"ghost",className:"flex h-12 w-10 flex-col gap-1 rounded-none px-1 py-1 cursor-pointer","aria-label":H("multitrack.fpsSettings"),children:[G(PI,{className:"h-4 w-4"}),G("span",{className:"text-[8px]",children:H("multitrack.frameRate")})]})}),G(s1,{className:"w-72 space-y-4",align:"end",side:"left",children:b("div",{className:"grid gap-3 text-xs text-muted-foreground",children:[b("div",{className:"flex items-center justify-between",children:[G("span",{children:H("multitrack.frameRate")}),b("span",{className:"tabular-nums text-foreground",children:[a9[k]??S2," ",H("multitrack.fps")]})]}),G(N8,{"aria-label":H("multitrack.frameRate"),value:[k],min:0,max:a9.length-1,step:1,ticks:a9.map((T,A)=>({value:A,label:String(T)})),onValueChange:(T)=>O(T[0]??k)}),X!==null&&b("label",{className:"grid gap-2 pt-2",children:[H("multitrack.duration"),G($6,{"aria-label":H("multitrack.duration"),type:"text",inputMode:"numeric",placeholder:"00:00:00",className:"tabular-nums",value:V,onChange:(T)=>M(T.currentTarget.value),onBlur:I,onKeyDown:(T)=>{if(T.key!=="Enter")return;T.preventDefault(),I()}})]})]})})]})]})}var z9=R(v(),1);function Sp({source:$,isPlaying:J,playbackNonce:Q=0}){let Z=z9.useRef(null),q=z9.useRef(null),X=z9.useRef(null),Y=z9.useMemo(()=>Q5({source_type:$.segment.content.source_type??"input",file_path:$.segment.content.file_path,local_path:$.segment.content.local_path,url:$.segment.content.url,slot_name:$.segment.content.slot_name}),[$.segment.content]),z=globalThis.location?.href,K=Y?MI($.volumeDb,Y,z):0,W=Y?bB(Y,z):!1;return z9.useEffect(()=>()=>{let H=Z.current;if(!H)return;H.pause(),H.src=""},[]),z9.useEffect(()=>{let H=Z.current,B=globalThis.AudioContext;if(!H||!Y||!B)return;if(!W)return;try{let U=new B,_=U.createGain();return U.createMediaElementSource(H).connect(_).connect(U.destination),q.current=U,X.current=_,H.volume=1,()=>{_.disconnect(),X.current=null,q.current=null,U.close().catch((L)=>{console.error("[PreviewAudioPlayback] failed to close audio context:",L)})}}catch(U){console.error("[PreviewAudioPlayback] failed to create audio gain graph:",U)}},[W,Y]),z9.useEffect(()=>{let H=Z.current;if(!H)return;if(X.current){X.current.gain.value=K;return}H.volume=Math.max(0,Math.min(1,K))},[K]),z9.useEffect(()=>{let H=Z.current;if(!H||J||Math.abs(H.currentTime-$.localTime)<=0.001)return;try{H.currentTime=$.localTime}catch(B){console.error("[PreviewAudioPlayback] failed to seek audio:",B)}},[J,$.localTime]),z9.useEffect(()=>{let H=Z.current;if(!H)return;if(!J){H.pause();return}q.current?.resume().catch((U)=>{console.error("[PreviewAudioPlayback] failed to resume audio context:",U)});try{H.currentTime=$.localTime}catch(U){console.error("[PreviewAudioPlayback] failed to seek audio before playback:",U)}H.play()?.catch((U)=>{console.error("[PreviewAudioPlayback] failed to play audio:",U)})},[J,$.segment.id,Y,Q]),Y?G("audio",{ref:Z,"data-testid":`preview-audio-${$.segment.id}`,src:Y,preload:"auto",className:"hidden"}):null}function CI({sources:$,isPlaying:J,playbackNonce:Q=0}){return $.map((Z)=>G(Sp,{source:Z,isPlaying:J,playbackNonce:Q},`${Z.trackId}:${Z.segment.id}`))}var hp={version:1,projection:"equirectangular",yaw:0,pitch:0,hfov:90,aspect_ratio:1};function hI($,J,Q){return Math.min(Q,Math.max(J,$))}function Xz($){return typeof $==="number"&&Number.isFinite($)}function SI($){return(($+180)%360+360)%360-180}function xp($){if(!$||typeof $!=="object"||Array.isArray($))return!1;let J=$;return J.version===1&&J.projection==="equirectangular"&&Xz(J.yaw)&&Xz(J.pitch)&&Xz(J.hfov)&&Xz(J.aspect_ratio)&&J.aspect_ratio>0}function xI($){if(!xp($))return{...hp};return{version:1,projection:"equirectangular",yaw:SI($.yaw),pitch:SI($.pitch),hfov:hI($.hfov,30,120),aspect_ratio:$.aspect_ratio}}function fI($,J){if(!Number.isFinite(J)||J<=0)throw RangeError("Panorama aspect ratio must be a positive finite number");let Q=hI($,30,120)*Math.PI/180;return 2*Math.atan(Math.tan(Q/2)/J)*180/Math.PI}function Yz({alt:$,className:J,imageId:Q,imageUrl:Z,view:q}){let X=xI(q),Y=fI(X.hfov,1.7777777777777777),z=360/X.hfov*100,K=50-X.yaw/X.hfov*100,W=50+X.pitch/Y*100;return G("div",{"data-testid":`panorama-image-preview-${Q}`,className:b0("relative aspect-video w-full overflow-hidden bg-black",J),children:[-1,0,1].map((H)=>G("img",{src:Z,alt:H===0?$:"","aria-hidden":H===0?void 0:!0,className:"pointer-events-none absolute top-1/2 max-w-none -translate-x-1/2 -translate-y-1/2 select-none",style:{left:`${K+H*z}%`,top:`${W}%`,width:`${z}%`},draggable:!1},H))})}var u1=R(v(),1);var C1=R(v(),1);function fp($,J){let Q=getComputedStyle($),Z=parseFloat(Q.fontSize);return J*Z}function vp($,J){let Q=getComputedStyle($.ownerDocument.documentElement),Z=parseFloat(Q.fontSize);return J*Z}function gp($){return $/100*window.innerHeight}function up($){return $/100*window.innerWidth}function mp($){switch(typeof $){case"number":return[$,"px"];case"string":{let J=parseFloat($);return $.endsWith("%")?[J,"%"]:$.endsWith("px")?[J,"px"]:$.endsWith("rem")?[J,"rem"]:$.endsWith("em")?[J,"em"]:$.endsWith("vh")?[J,"vh"]:$.endsWith("vw")?[J,"vw"]:[J,"%"]}}}function jZ({groupSize:$,panelElement:J,styleProp:Q}){let Z,[q,X]=mp(Q);switch(X){case"%":{Z=q/100*$;break}case"px":{Z=q;break}case"rem":{Z=vp(J,q);break}case"em":{Z=fp(J,q);break}case"vh":{Z=gp(q);break}case"vw":{Z=up(q);break}}return Z}function J6($){return parseFloat($.toFixed(3))}function PJ({group:$}){let{orientation:J,panels:Q}=$;return Q.reduce((Z,q)=>(Z+=J==="horizontal"?q.element.offsetWidth:q.element.offsetHeight,Z),0)}function xB($){let{panels:J}=$,Q=PJ({group:$});return Q===0?J.map((Z)=>({groupResizeBehavior:Z.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:Z.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:Z.panelConstraints.disabled,minSize:0,maxSize:100,panelId:Z.id})):J.map((Z)=>{let{element:q,panelConstraints:X}=Z,Y=0;if(X.collapsedSize!==void 0){let H=jZ({groupSize:Q,panelElement:q,styleProp:X.collapsedSize});Y=J6(H/Q*100)}let z;if(X.defaultSize!==void 0){let H=jZ({groupSize:Q,panelElement:q,styleProp:X.defaultSize});z=J6(H/Q*100)}let K=0;if(X.minSize!==void 0){let H=jZ({groupSize:Q,panelElement:q,styleProp:X.minSize});K=J6(H/Q*100)}let W=100;if(X.maxSize!==void 0){let H=jZ({groupSize:Q,panelElement:q,styleProp:X.maxSize});W=J6(H/Q*100)}return{groupResizeBehavior:X.groupResizeBehavior,collapsedSize:Y,collapsible:X.collapsible===!0,defaultSize:z,disabled:X.disabled,minSize:K,maxSize:W,panelId:Z.id}})}function K5($,J="Assertion error"){if(!$)throw Error(J)}function fB($,J){return Array.from(J).sort($==="horizontal"?cp:dp)}function cp($,J){let Q=$.element.offsetLeft-J.element.offsetLeft;return Q!==0?Q:$.element.offsetWidth-J.element.offsetWidth}function dp($,J){let Q=$.element.offsetTop-J.element.offsetTop;return Q!==0?Q:$.element.offsetHeight-J.element.offsetHeight}function $T($){return $!==null&&typeof $=="object"&&"nodeType"in $&&$.nodeType===Node.ELEMENT_NODE}function JT($,J){return{x:$.x>=J.left&&$.x<=J.right?0:Math.min(Math.abs($.x-J.left),Math.abs($.x-J.right)),y:$.y>=J.top&&$.y<=J.bottom?0:Math.min(Math.abs($.y-J.top),Math.abs($.y-J.bottom))}}function pp({orientation:$,rects:J,targetRect:Q}){let Z={x:Q.x+Q.width/2,y:Q.y+Q.height/2},q,X=Number.MAX_VALUE;for(let Y of J){let{x:z,y:K}=JT(Z,Y),W=$==="horizontal"?z:K;W({element:L}))).map(({element:L})=>L),Y=[],z=!1,K=!1,W=-1,H=-1,B=0,U,_=[];{let L=-1;for(let F of X)F.hasAttribute("data-panel")&&(L++,F.hasAttribute("data-disabled")||(B++,W===-1&&(W=L),H=L))}if(B>1){let L=-1;for(let F of X)if(F.hasAttribute("data-panel")){L++;let V=Z.find((M)=>M.element===F);if(V){if(U){let M=U.element.getBoundingClientRect(),D=F.getBoundingClientRect(),N;if(K){let O=Q==="horizontal"?new DOMRect(M.right,M.top,0,M.height):new DOMRect(M.left,M.bottom,M.width,0),I=Q==="horizontal"?new DOMRect(D.left,D.top,0,D.height):new DOMRect(D.left,D.top,D.width,0);switch(_.length){case 0:{N=[O,I];break}case 1:{let k=_[0],T=pp({orientation:Q,rects:[M,D],targetRect:k.element.getBoundingClientRect()});N=[k,T===M?I:O];break}default:{N=_;break}}}else _.length?N=_:N=[Q==="horizontal"?new DOMRect(M.right,D.top,D.left-M.right,D.height):new DOMRect(D.left,M.bottom,D.width,D.top-M.bottom)];for(let O of N){let I="width"in O?O:O.element.getBoundingClientRect(),k=lp()?$.resizeTargetMinimumSize.coarse:$.resizeTargetMinimumSize.fine;if(I.widthH;!z&&!T&&Y.push({group:$,groupSize:PJ({group:$}),panels:[U,V],separator:"width"in O?void 0:O,rect:I}),z=!1}}K=!1,U=V,_=[]}}else if(F.hasAttribute("data-separator")){F.ariaDisabled!==null&&(z=!0);let V=q.find((M)=>M.element===F);V?_.push(V):(U=void 0,_=[])}else K=!0}return Y}class vB{#$={};addListener($,J){let Q=this.#$[$];return Q===void 0?this.#$[$]=[J]:Q.includes(J)||Q.push(J),()=>{this.removeListener($,J)}}emit($,J){let Q=this.#$[$];if(Q!==void 0)if(Q.length===1)Q[0].call(null,J);else{let Z=!1,q=null,X=Array.from(Q);for(let Y=0;Y=0&&Q.splice(Z,1)}}}var $4=new Map,ZT=new vB;function ip($){$4=new Map($4),$4.delete($)}function vI($,J){for(let[Q]of $4)if(Q.id===$)return Q}function w7($,J){for(let[Q,Z]of $4)if(Q.id===$)return Z;if(J)throw Error(`Could not find data for Group with id ${$}`)}function g2(){return $4}function gB($,J){return ZT.addListener("groupChange",(Q)=>{Q.group.id===$&&J(Q)})}function p4($,J){let Q=$4.get($);$4=new Map($4),$4.set($,J),ZT.emit("groupChange",{group:$,prev:Q,next:J})}function rp($,J,Q){let Z,q={x:1/0,y:1/0};for(let X of J){let Y=JT(Q,X.rect);switch($){case"horizontal":{Y.x<=q.x&&(Z=X,q=Y);break}case"vertical":{Y.y<=q.y&&(Z=X,q=Y);break}}}return Z?{distance:q,hitRegion:Z}:void 0}function sp($){return $!==null&&typeof $=="object"&&"nodeType"in $&&$.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function op($,J){if($===J)throw Error("Cannot compare node with itself");let Q={a:mI($),b:mI(J)},Z;for(;Q.a.at(-1)===Q.b.at(-1);)Z=Q.a.pop(),Q.b.pop();K5(Z,"Stacking order can only be calculated for elements with a common ancestor");let q={a:uI(gI(Q.a)),b:uI(gI(Q.b))};if(q.a===q.b){let X=Z.childNodes,Y={a:Q.a.at(-1),b:Q.b.at(-1)},z=X.length;for(;z--;){let K=X[z];if(K===Y.a)return 1;if(K===Y.b)return-1}}return Math.sign(q.a-q.b)}var np=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function ap($){let J=getComputedStyle(qT($)??$).display;return J==="flex"||J==="inline-flex"}function tp($){let J=getComputedStyle($);return!!(J.position==="fixed"||J.zIndex!=="auto"&&(J.position!=="static"||ap($))||+J.opacity<1||("transform"in J)&&J.transform!=="none"||("webkitTransform"in J)&&J.webkitTransform!=="none"||("mixBlendMode"in J)&&J.mixBlendMode!=="normal"||("filter"in J)&&J.filter!=="none"||("webkitFilter"in J)&&J.webkitFilter!=="none"||("isolation"in J)&&J.isolation==="isolate"||np.test(J.willChange)||J.webkitOverflowScrolling==="touch")}function gI($){let J=$.length;for(;J--;){let Q=$[J];if(K5(Q,"Missing node"),tp(Q))return Q}return null}function uI($){return $&&Number(getComputedStyle($).zIndex)||0}function mI($){let J=[];for(;$;)J.push($),$=qT($);return J}function qT($){let{parentNode:J}=$;return sp(J)?J.host:J}function ep($,J){return $.xJ.x&&$.yJ.y}function $l({groupElement:$,hitRegion:J,pointerEventTarget:Q}){if(!$T(Q)||Q.contains($)||$.contains(Q))return!0;if(op(Q,$)>0){let Z=Q;for(;Z;){if(Z.contains($))return!0;if(ep(Z.getBoundingClientRect(),J))return!1;Z=Z.parentElement}}return!0}function uB($,J){let Q=[];return J.forEach((Z,q)=>{if(q.disabled)return;let X=QT(q),Y=rp(q.orientation,X,{x:$.clientX,y:$.clientY});Y&&Y.distance.x<=0&&Y.distance.y<=0&&$l({groupElement:q.element,hitRegion:Y.hitRegion.rect,pointerEventTarget:$.target})&&Q.push(Y.hitRegion)}),Q}function Jl($,J){if($.length!==J.length)return!1;for(let Q=0;Q<$.length;Q++)if($[Q]!=J[Q])return!1;return!0}function u8($,J,Q=0){return Math.abs(J6($)-J6(J))<=Q}function e9($,J){return u8($,J)?0:$>J?1:-1}function jJ({overrideDisabledPanels:$,panelConstraints:J,prevSize:Q,size:Z}){let{collapsedSize:q=0,collapsible:X,disabled:Y,maxSize:z=100,minSize:K=0}=J;if(Y&&!$)return Q;if(e9(Z,K)<0)if(X){let W=(q+K)/2;e9(Z,W)<0?Z=q:Z=K}else Z=K;return Z=Math.min(z,Z),Z=J6(Z),Z}function yZ({delta:$,initialLayout:J,panelConstraints:Q,pivotIndices:Z,prevLayout:q,trigger:X}){if(u8($,0))return J;let Y=X==="imperative-api",z=Object.values(J),K=Object.values(q),W=[...z],[H,B]=Z;K5(H!=null,"Invalid first pivot index"),K5(B!=null,"Invalid second pivot index");let U=0;switch(X){case"keyboard":{{let F=$<0?B:H,V=Q[F];K5(V,`Panel constraints not found for index ${F}`);let{collapsedSize:M=0,collapsible:D,minSize:N=0}=V;if(D){let O=z[F];if(K5(O!=null,`Previous layout not found for panel index ${F}`),u8(O,M)){let I=N-O;e9(I,Math.abs($))>0&&($=$<0?0-I:I)}}}{let F=$<0?H:B,V=Q[F];K5(V,`No panel constraints found for index ${F}`);let{collapsedSize:M=0,collapsible:D,minSize:N=0}=V;if(D){let O=z[F];if(K5(O!=null,`Previous layout not found for panel index ${F}`),u8(O,N)){let I=O-M;e9(I,Math.abs($))>0&&($=$<0?0-I:I)}}}break}default:{let F=$<0?B:H,V=Q[F];K5(V,`Panel constraints not found for index ${F}`);let M=z[F],{collapsible:D,collapsedSize:N,minSize:O}=V;if(D&&e9(M,O)<0)if($>0){let I=O-N,k=I/2,T=M+$;e9(T,O)<0&&($=e9($,k)<=0?0:I)}else{let I=O-N,k=100-I/2,T=M-$;e9(T,O)<0&&($=e9(100+$,k)>0?0:-I)}break}}{let F=$<0?1:-1,V=$<0?B:H,M=0;for(;;){let N=z[V];K5(N!=null,`Previous layout not found for panel index ${V}`);let O=jJ({overrideDisabledPanels:Y,panelConstraints:Q[V],prevSize:N,size:100})-N;if(M+=O,V+=F,V<0||V>=Q.length)break}let D=Math.min(Math.abs($),Math.abs(M));$=$<0?0-D:D}{let F=$<0?H:B;for(;F>=0&&F=0))break;$<0?F--:F++}}if(Jl(K,W))return q;{let F=$<0?B:H,V=z[F];K5(V!=null,`Previous layout not found for panel index ${F}`);let M=V+U,D=jJ({overrideDisabledPanels:Y,panelConstraints:Q[F],prevSize:V,size:M});if(W[F]=D,!u8(D,M)){let N=M-D,O=$<0?B:H;for(;O>=0&&O0?O--:O++}}}let _=Object.values(W).reduce((F,V)=>V+F,0);if(!u8(_,100,0.1))return q;let L=Object.keys(q);return W.reduce((F,V,M)=>(F[L[M]]=V,F),{})}function x2($,J){if(Object.keys($).length!==Object.keys(J).length)return!1;for(let Q in $)if(J[Q]===void 0||e9($[Q],J[Q])!==0)return!1;return!0}function f2({layout:$,panelConstraints:J}){let Q=Object.values($),Z=[...Q],q=Z.reduce((z,K)=>z+K,0);if(Z.length!==J.length)throw Error(`Invalid ${J.length} panel layout: ${Z.map((z)=>`${z}%`).join(", ")}`);if(!u8(q,100)&&Z.length>0)for(let z=0;z(z[Y[W]]=K,z),{})}function XT({groupId:$,panelId:J}){let Q=()=>{let K=g2();for(let[W,{defaultLayoutDeferred:H,derivedPanelConstraints:B,layout:U,groupSize:_,separatorToPanels:L}]of K)if(W.id===$)return{defaultLayoutDeferred:H,derivedPanelConstraints:B,group:W,groupSize:_,layout:U,separatorToPanels:L};throw Error(`Group ${$} not found`)},Z=()=>{let K=Q().derivedPanelConstraints.find((W)=>W.panelId===J);if(K!==void 0)return K;throw Error(`Panel constraints not found for Panel ${J}`)},q=()=>{let K=Q().group.panels.find((W)=>W.id===J);if(K!==void 0)return K;throw Error(`Layout not found for Panel ${J}`)},X=()=>{let K=Q().layout[J];if(K!==void 0)return K;throw Error(`Layout not found for Panel ${J}`)},Y=({nextSize:K,panels:W,prevLayout:H,derivedPanelConstraints:B})=>{let U=X(),_=W.findIndex((V)=>V.id===J),L=_===0,F=_===W.length-1;if(F&&K{let D=B[M];return D?.collapsible&&u8(D.collapsedSize,H[D.panelId])}))){let V=W.slice(0,_).reduce((M,D)=>M+H[D.id],0);return{...H,[J]:J6(100-V)}}return yZ({delta:F?U-K:K-U,initialLayout:H,panelConstraints:B,pivotIndices:F?[_-1,_]:[_,_+1],prevLayout:H,trigger:"imperative-api"})},z=(K)=>{let W=X();if(K===W)return;let{defaultLayoutDeferred:H,derivedPanelConstraints:B,group:U,groupSize:_,layout:L,separatorToPanels:F}=Q(),V=Y({nextSize:K,panels:U.panels,prevLayout:L,derivedPanelConstraints:B}),M=f2({layout:V,panelConstraints:B});x2(L,M)||p4(U,{defaultLayoutDeferred:H,derivedPanelConstraints:B,groupSize:_,layout:M,separatorToPanels:F})};return{collapse:()=>{let{collapsible:K,collapsedSize:W}=Z(),{mutableValues:H}=q(),B=X();K&&B!==W&&(H.expandToSize=B,z(W))},expand:()=>{let{collapsible:K,collapsedSize:W,minSize:H}=Z(),{mutableValues:B}=q(),U=X();if(K&&U===W){let _=B.expandToSize??H;_===0&&(_=1),z(_)}},getSize:()=>{let{group:K}=Q(),W=X(),{element:H}=q(),B=K.orientation==="horizontal"?H.offsetWidth:H.offsetHeight;return{asPercentage:W,inPixels:B}},isCollapsed:()=>{let{collapsible:K,collapsedSize:W}=Z(),H=X();return K&&u8(W,H)},resize:(K)=>{let{group:W}=Q(),{element:H}=q(),B=PJ({group:W}),U=jZ({groupSize:B,panelElement:H,styleProp:K}),_=J6(U/B*100);z(_)}}}function cI($){if($.defaultPrevented)return;let J=g2();uB($,J).forEach((Q)=>{if(Q.separator&&!Q.separator.disableDoubleClick){let Z=Q.panels.find((q)=>q.panelConstraints.defaultSize!==void 0);if(Z){let q=Z.panelConstraints.defaultSize,X=XT({groupId:Q.group.id,panelId:Z.id});X&&q!==void 0&&(X.resize(q),$.preventDefault())}}})}function Gz($){let J=g2();for(let[Q]of J)if(Q.separators.some((Z)=>Z.element===$))return Q;throw Error("Could not find parent Group for separator element")}function YT({groupId:$}){let J=()=>{let Q=g2();for(let[Z,q]of Q)if(Z.id===$)return{group:Z,...q};throw Error(`Could not find Group with id "${$}"`)};return{getLayout(){let{defaultLayoutDeferred:Q,layout:Z}=J();return Q?{}:Z},setLayout(Q){let{defaultLayoutDeferred:Z,derivedPanelConstraints:q,group:X,groupSize:Y,layout:z,separatorToPanels:K}=J(),W=f2({layout:Q,panelConstraints:q});return Z?z:(x2(z,W)||p4(X,{defaultLayoutDeferred:Z,derivedPanelConstraints:q,groupSize:Y,layout:W,separatorToPanels:K}),W)}}}function h2($,J){let Q=Gz($),Z=w7(Q.id,!0),q=Q.separators.find((H)=>H.element===$);K5(q,"Matching separator not found");let X=Z.separatorToPanels.get(q);K5(X,"Matching panels not found");let Y=X.map((H)=>Q.panels.indexOf(H)),z=YT({groupId:Q.id}).getLayout(),K=yZ({delta:J,initialLayout:z,panelConstraints:Z.derivedPanelConstraints,pivotIndices:Y,prevLayout:z,trigger:"keyboard"}),W=f2({layout:K,panelConstraints:Z.derivedPanelConstraints});x2(z,W)||p4(Q,{defaultLayoutDeferred:Z.defaultLayoutDeferred,derivedPanelConstraints:Z.derivedPanelConstraints,groupSize:Z.groupSize,layout:W,separatorToPanels:Z.separatorToPanels})}function dI($){if($.defaultPrevented)return;let J=$.currentTarget,Q=Gz(J);if(!Q.disabled)switch($.key){case"ArrowDown":{$.preventDefault(),Q.orientation==="vertical"&&h2(J,5);break}case"ArrowLeft":{$.preventDefault(),Q.orientation==="horizontal"&&h2(J,-5);break}case"ArrowRight":{$.preventDefault(),Q.orientation==="horizontal"&&h2(J,5);break}case"ArrowUp":{$.preventDefault(),Q.orientation==="vertical"&&h2(J,-5);break}case"End":{$.preventDefault(),h2(J,100);break}case"Enter":{$.preventDefault();let Z=Gz(J),q=w7(Z.id,!0),{derivedPanelConstraints:X,layout:Y,separatorToPanels:z}=q,K=Z.separators.find((U)=>U.element===J);K5(K,"Matching separator not found");let W=z.get(K);K5(W,"Matching panels not found");let H=W[0],B=X.find((U)=>U.panelId===H.id);if(K5(B,"Panel metadata not found"),B.collapsible){let U=Y[H.id],_=B.collapsedSize===U?Z.mutableState.expandedPanelSizes[H.id]??B.minSize:B.collapsedSize;h2(J,_-U)}break}case"F6":{$.preventDefault();let Z=Gz(J).separators.map((Y)=>Y.element),q=Array.from(Z).findIndex((Y)=>Y===$.currentTarget);K5(q!==null,"Index not found");let X=$.shiftKey?q>0?q-1:Z.length-1:q+10)return;let J=g2(),Q=uB($,J),Z=new Map,q=!1;Q.forEach((X)=>{X.separator&&(q||(q=!0,X.separator.element.focus({focusVisible:!1,preventScroll:!0})));let Y=J.get(X.group);Y&&Z.set(X.group,Y.layout)}),yJ({cursorFlags:0,hitRegions:Q,initialLayoutMap:Z,pointerDownAtPoint:{x:$.clientX,y:$.clientY},state:"active"}),Q.length&&$.preventDefault()}var ql=($)=>$,hB=()=>{},zT=1,KT=2,GT=4,WT=8,lI=3,iI=12,Kz;function rI(){return Kz===void 0&&(Kz=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(Kz=!0)),Kz}function Xl({cursorFlags:$,groups:J,state:Q}){let Z=0,q=0;switch(Q){case"active":case"hover":J.forEach((X)=>{if(!X.mutableState.disableCursor)switch(X.orientation){case"horizontal":{Z++;break}case"vertical":{q++;break}}})}if(!(Z===0&&q===0)){switch(Q){case"active":{if($&&rI()){let X=($&zT)!==0,Y=($&KT)!==0,z=($>)!==0,K=($&WT)!==0;if(X)return z?"se-resize":K?"ne-resize":"e-resize";if(Y)return z?"sw-resize":K?"nw-resize":"w-resize";if(z)return"s-resize";if(K)return"n-resize"}break}}return rI()?Z>0&&q>0?"move":Z>0?"ew-resize":"ns-resize":Z>0&&q>0?"grab":Z>0?"col-resize":"row-resize"}}var sI=new WeakMap;function cB($){if($.defaultView===null||$.defaultView===void 0)return;let{prevStyle:J,styleSheet:Q}=sI.get($)??{};Q===void 0&&(Q=new $.defaultView.CSSStyleSheet,$.adoptedStyleSheets&&(Object.isExtensible($.adoptedStyleSheets)?$.adoptedStyleSheets.push(Q):$.adoptedStyleSheets=[...$.adoptedStyleSheets,Q]));let Z=v2();switch(Z.state){case"active":case"hover":{let q=Xl({cursorFlags:Z.cursorFlags,groups:Z.hitRegions.map((Y)=>Y.group),state:Z.state}),X=`*, *:hover {cursor: ${q} !important; }`;if(J===X)return;J=X,q?Q.cssRules.length===0?Q.insertRule(X):Q.replaceSync(X):Q.cssRules.length===1&&Q.deleteRule(0);break}case"inactive":{J=void 0,Q.cssRules.length===1&&Q.deleteRule(0);break}}sI.set($,{prevStyle:J,styleSheet:Q})}function HT({document:$,event:J,hitRegions:Q,initialLayoutMap:Z,mountedGroups:q,pointerDownAtPoint:X,prevCursorFlags:Y}){let z=0;Q.forEach((W)=>{let{group:H,groupSize:B}=W,{orientation:U,panels:_}=H,{disableCursor:L}=H.mutableState,F=0;X?U==="horizontal"?F=(J.clientX-X.x)/B*100:F=(J.clientY-X.y)/B*100:U==="horizontal"?F=J.clientX<0?-100:100:F=J.clientY<0?-100:100;let V=Z.get(H),M=q.get(H);if(!V||!M)return;let{defaultLayoutDeferred:D,derivedPanelConstraints:N,groupSize:O,layout:I,separatorToPanels:k}=M;if(N&&I&&k){let T=yZ({delta:F,initialLayout:V,panelConstraints:N,pivotIndices:W.panels.map((A)=>_.indexOf(A)),prevLayout:I,trigger:"mouse-or-touch"});if(x2(T,I)){if(F!==0&&!L)switch(U){case"horizontal":{z|=F<0?zT:KT;break}case"vertical":{z|=F<0?GT:WT;break}}}else p4(W.group,{defaultLayoutDeferred:D,derivedPanelConstraints:N,groupSize:O,layout:T,separatorToPanels:k})}});let K=0;J.movementX===0?K|=Y&lI:K|=z&lI,J.movementY===0?K|=Y&iI:K|=z&iI,Zl(K),cB($)}function oI($){let J=g2(),Q=v2();switch(Q.state){case"active":HT({document:$.currentTarget,event:$,hitRegions:Q.hitRegions,initialLayoutMap:Q.initialLayoutMap,mountedGroups:J,prevCursorFlags:Q.cursorFlags})}}function nI($){if($.defaultPrevented)return;let J=v2(),Q=g2();switch(J.state){case"active":{if($.buttons===0){yJ({cursorFlags:0,state:"inactive"}),J.hitRegions.forEach((Z)=>{let q=w7(Z.group.id,!0);p4(Z.group,q)});return}for(let Z of J.hitRegions)if(Z.separator){let{element:q}=Z.separator;q.hasPointerCapture?.($.pointerId)||q.setPointerCapture?.($.pointerId)}HT({document:$.currentTarget,event:$,hitRegions:J.hitRegions,initialLayoutMap:J.initialLayoutMap,mountedGroups:Q,pointerDownAtPoint:J.pointerDownAtPoint,prevCursorFlags:J.cursorFlags});break}default:{let Z=uB($,Q);Z.length===0?J.state!=="inactive"&&yJ({cursorFlags:0,state:"inactive"}):yJ({cursorFlags:0,hitRegions:Z,state:"hover"}),cB($.currentTarget);break}}}function aI($){if($.relatedTarget instanceof HTMLIFrameElement)switch(v2().state){case"hover":yJ({cursorFlags:0,state:"inactive"})}}function tI($){if($.defaultPrevented)return;if($.pointerType==="mouse"&&$.button>0)return;let J=v2();switch(J.state){case"active":yJ({cursorFlags:0,state:"inactive"}),J.hitRegions.length>0&&(cB($.currentTarget),J.hitRegions.forEach((Q)=>{let Z=w7(Q.group.id,!0);p4(Q.group,Z)}),$.preventDefault())}}function eI($){let J=0,Q=0,Z={};for(let X of $)if(X.defaultSize!==void 0){J++;let Y=J6(X.defaultSize);Q+=Y,Z[X.panelId]=Y}else Z[X.panelId]=void 0;let q=$.length-J;if(q!==0){let X=J6((100-Q)/q);for(let Y of $)Y.defaultSize===void 0&&(Z[Y.panelId]=X)}return Z}function Yl($,J,Q){if(!Q[0])return;let Z=$.panels.find((K)=>K.element===J);if(!Z||!Z.onResize)return;let q=PJ({group:$}),X=$.orientation==="horizontal"?Z.element.offsetWidth:Z.element.offsetHeight,Y=Z.mutableValues.prevSize,z={asPercentage:J6(X/q*100),inPixels:X};Z.mutableValues.prevSize=z,Z.onResize(z,Z.id,Y)}function zl($,J){if(Object.keys($).length!==Object.keys(J).length)return!1;for(let Q in $)if($[Q]!==J[Q])return!1;return!0}function Kl({group:$,nextGroupSize:J,prevGroupSize:Q,prevLayout:Z}){if(Q<=0||J<=0||Q===J)return Z;let q=0,X=0,Y=!1,z=new Map,K=[];for(let B of $.panels){let U=Z[B.id]??0;switch(B.panelConstraints.groupResizeBehavior){case"preserve-pixel-size":{Y=!0;let _=U/100*Q,L=J6(_/J*100);z.set(B.id,L),q+=L;break}case"preserve-relative-size":default:{K.push(B.id),X+=U;break}}}if(!Y||K.length===0)return Z;let W=100-q,H={...Z};if(z.forEach((B,U)=>{H[U]=B}),X>0)for(let B of K){let U=Z[B]??0;H[B]=J6(U/X*W)}else{let B=J6(W/K.length);for(let U of K)H[U]=B}return H}function Gl($,J){let Q=$.map((q)=>q.id),Z=Object.keys(J);if(Q.length!==Z.length)return!1;for(let q of Q)if(!Z.includes(q))return!1;return!0}var bJ=new Map;function Wl($){let J=!0;K5($.element.ownerDocument.defaultView,"Cannot register an unmounted Group");let Q=$.element.ownerDocument.defaultView.ResizeObserver,Z=new Set,q=new Set,X=new Q((L)=>{for(let F of L){let{borderBoxSize:V,target:M}=F;if(M===$.element){if(J){let D=PJ({group:$});if(D===0)return;let N=w7($.id);if(!N)return;let O=xB($),I=N.defaultLayoutDeferred?eI(O):N.layout,k=Kl({group:$,nextGroupSize:D,prevGroupSize:N.groupSize,prevLayout:I}),T=f2({layout:k,panelConstraints:O});if(!N.defaultLayoutDeferred&&x2(N.layout,T)&&zl(N.derivedPanelConstraints,O)&&N.groupSize===D)return;p4($,{defaultLayoutDeferred:!1,derivedPanelConstraints:O,groupSize:D,layout:T,separatorToPanels:N.separatorToPanels})}}else Yl($,M,V)}});X.observe($.element),$.panels.forEach((L)=>{K5(!Z.has(L.id),`Panel ids must be unique; id "${L.id}" was used more than once`),Z.add(L.id),L.onResize&&X.observe(L.element)});let Y=PJ({group:$}),z=xB($),K=$.panels.map(({id:L})=>L).join(","),W=$.mutableState.defaultLayout;W&&(Gl($.panels,W)||(W=void 0));let H=$.mutableState.layouts[K]??W??eI(z),B=f2({layout:H,panelConstraints:z}),U=$.element.ownerDocument;bJ.set(U,(bJ.get(U)??0)+1);let _=new Map;return QT($).forEach((L)=>{L.separator&&_.set(L.separator,L.panels)}),p4($,{defaultLayoutDeferred:Y===0,derivedPanelConstraints:z,groupSize:Y,layout:B,separatorToPanels:_}),$.separators.forEach((L)=>{K5(!q.has(L.id),`Separator ids must be unique; id "${L.id}" was used more than once`),q.add(L.id),L.element.addEventListener("keydown",dI)}),bJ.get(U)===1&&(U.addEventListener("dblclick",cI,!0),U.addEventListener("pointerdown",pI,!0),U.addEventListener("pointerleave",oI),U.addEventListener("pointermove",nI),U.addEventListener("pointerout",aI),U.addEventListener("pointerup",tI,!0)),function(){J=!1,bJ.set(U,Math.max(0,(bJ.get(U)??0)-1)),ip($),$.separators.forEach((L)=>{L.element.removeEventListener("keydown",dI)}),bJ.get(U)||(U.removeEventListener("dblclick",cI,!0),U.removeEventListener("pointerdown",pI,!0),U.removeEventListener("pointerleave",oI),U.removeEventListener("pointermove",nI),U.removeEventListener("pointerout",aI),U.removeEventListener("pointerup",tI,!0)),X.disconnect()}}function Hl(){let[$,J]=C1.useState({}),Q=C1.useCallback(()=>J({}),[]);return[$,Q]}function dB($){let J=C1.useId();return`${$??J}`}var u2=typeof window<"u"?C1.useLayoutEffect:C1.useEffect;function EZ($){let J=C1.useRef($);return u2(()=>{J.current=$},[$]),C1.useCallback((...Q)=>J.current?.(...Q),[J])}function pB(...$){return EZ((J)=>{$.forEach((Q)=>{if(Q)switch(typeof Q){case"function":{Q(J);break}case"object":{Q.current=J;break}}})})}function lB($){let J=C1.useRef({...$});return u2(()=>{for(let Q in $)J.current[Q]=$[Q]},[$]),J.current}var BT=C1.createContext(null);function Bl($,J){let Q=C1.useRef({getLayout:()=>({}),setLayout:ql});C1.useImperativeHandle(J,()=>Q.current,[]),u2(()=>{Object.assign(Q.current,YT({groupId:$}))})}function iB({children:$,className:J,defaultLayout:Q,disableCursor:Z,disabled:q,elementRef:X,groupRef:Y,id:z,onLayoutChange:K,onLayoutChanged:W,orientation:H="horizontal",resizeTargetMinimumSize:B={coarse:20,fine:10},style:U,..._}){let L=C1.useRef({onLayoutChange:{},onLayoutChanged:{}}),F=EZ((y)=>{x2(L.current.onLayoutChange,y)||(L.current.onLayoutChange=y,K?.(y))}),V=EZ((y)=>{x2(L.current.onLayoutChanged,y)||(L.current.onLayoutChanged=y,W?.(y))}),M=dB(z),D=C1.useRef(null),[N,O]=Hl(),I=C1.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:B,separators:[]}),k=pB(D,X);Bl(M,Y);let T=EZ((y,x)=>{let j=v2(),P=vI(y),h=w7(y);if(h){let l=!1;switch(j.state){case"active":{l=j.hitRegions.some((t)=>t.group===P);break}}return{flexGrow:h.layout[x]??1,pointerEvents:l?"none":void 0}}if(Q?.[x])return{flexGrow:Q?.[x]}}),A=lB({defaultLayout:Q,disableCursor:Z}),w=C1.useMemo(()=>({get disableCursor(){return!!A.disableCursor},getPanelStyles:T,id:M,orientation:H,registerPanel:(y)=>{let x=I.current;return x.panels=fB(H,[...x.panels,y]),O(),()=>{x.panels=x.panels.filter((j)=>j!==y),O()}},registerSeparator:(y)=>{let x=I.current;return x.separators=fB(H,[...x.separators,y]),O(),()=>{x.separators=x.separators.filter((j)=>j!==y),O()}},updatePanelProps:(y,{disabled:x})=>{let j=I.current.panels.find((l)=>l.id===y);j&&(j.panelConstraints.disabled=x);let P=vI(M),h=w7(M);P&&h&&p4(P,{...h,derivedPanelConstraints:xB(P)})},updateSeparatorProps:(y,{disabled:x,disableDoubleClick:j})=>{let P=I.current.separators.find((h)=>h.id===y);P&&(P.disabled=x,P.disableDoubleClick=j)}}),[T,M,O,H,A]),C=C1.useRef(null);return u2(()=>{let y=D.current;if(y===null)return;let x=I.current,j;if(A.defaultLayout!==void 0&&Object.keys(A.defaultLayout).length===x.panels.length){j={};for(let J0 of x.panels){let K0=A.defaultLayout[J0.id];K0!==void 0&&(j[J0.id]=K0)}}let P={disabled:!!q,element:y,id:M,mutableState:{defaultLayout:j,disableCursor:!!A.disableCursor,expandedPanelSizes:I.current.lastExpandedPanelSizes,layouts:I.current.layouts},orientation:H,panels:x.panels,resizeTargetMinimumSize:x.resizeTargetMinimumSize,separators:x.separators};C.current=P;let h=Wl(P),{defaultLayoutDeferred:l,derivedPanelConstraints:t,layout:S}=w7(P.id,!0);!l&&t.length>0&&(F(S),V(S));let i=gB(M,(J0)=>{let{defaultLayoutDeferred:K0,derivedPanelConstraints:e,layout:H0}=J0.next;if(K0||e.length===0)return;let q0=P.panels.map(({id:d})=>d).join(",");P.mutableState.layouts[q0]=H0,e.forEach((d)=>{if(d.collapsible){let{layout:c}=J0.prev??{};if(c){let r=u8(d.collapsedSize,H0[d.panelId]),u=u8(d.collapsedSize,c[d.panelId]);r&&!u&&(P.mutableState.expandedPanelSizes[d.panelId]=c[d.panelId])}}});let E=v2().state!=="active";F(H0),E&&V(H0)});return()=>{C.current=null,h(),i()}},[q,M,V,F,H,N,A]),C1.useEffect(()=>{let y=C.current;y&&(y.mutableState.defaultLayout=Q,y.mutableState.disableCursor=!!Z)}),G(BT.Provider,{value:w,children:G("div",{..._,className:J,"data-group":!0,"data-testid":M,id:M,ref:k,style:{height:"100%",width:"100%",overflow:"hidden",...U,display:"flex",flexDirection:H==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:H==="horizontal"?"pan-y":"pan-x"},children:$})})}iB.displayName="Group";function rB(){let $=C1.useContext(BT);return K5($,"Group Context not found; did you render a Panel or Separator outside of a Group?"),$}function Ul($,J){let{id:Q}=rB(),Z=C1.useRef({collapse:hB,expand:hB,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:hB});C1.useImperativeHandle(J,()=>Z.current,[]),u2(()=>{Object.assign(Z.current,XT({groupId:Q,panelId:$}))})}function sB({children:$,className:J,collapsedSize:Q="0%",collapsible:Z=!1,defaultSize:q,disabled:X,elementRef:Y,groupResizeBehavior:z="preserve-relative-size",id:K,maxSize:W="100%",minSize:H="0%",onResize:B,panelRef:U,style:_,...L}){let F=!!K,V=dB(K),M=lB({disabled:X}),D=C1.useRef(null),N=pB(D,Y),{getPanelStyles:O,id:I,orientation:k,registerPanel:T,updatePanelProps:A}=rB(),w=B!==null,C=EZ((P,h,l)=>{B?.(P,K,l)});u2(()=>{let P=D.current;if(P!==null){let h={element:P,id:V,idIsStable:F,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:w?C:void 0,panelConstraints:{groupResizeBehavior:z,collapsedSize:Q,collapsible:Z,defaultSize:q,disabled:M.disabled,maxSize:W,minSize:H}};return T(h)}},[z,Q,Z,q,w,V,F,W,H,C,T,M]),C1.useEffect(()=>{A(V,{disabled:X})},[X,V,A]),Ul(V,U);let y=()=>{let P=O(I,V);if(P)return JSON.stringify(P)},x=C1.useSyncExternalStore((P)=>gB(I,P),y,y),j;return x?j=JSON.parse(x):q!==void 0?j={flexGrow:void 0,flexShrink:void 0,flexBasis:q}:j={flexGrow:1},G("div",{...L,"data-disabled":X||void 0,"data-panel":!0,"data-testid":V,id:V,ref:N,style:{..._l,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...j},children:G("div",{className:J,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",..._,touchAction:k==="horizontal"?"pan-y":"pan-x"},children:$})})}sB.displayName="Panel";var _l={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function Ll({layout:$,panelConstraints:J,panelId:Q,panelIndex:Z}){let q,X,Y=$[Q],z=J.find((K)=>K.panelId===Q);if(z){let K=z.maxSize,W=z.collapsible?z.collapsedSize:z.minSize,H=[Z,Z+1];X=f2({layout:yZ({delta:W-Y,initialLayout:$,panelConstraints:J,pivotIndices:H,prevLayout:$}),panelConstraints:J})[Q],q=f2({layout:yZ({delta:K-Y,initialLayout:$,panelConstraints:J,pivotIndices:H,prevLayout:$}),panelConstraints:J})[Q]}return{valueControls:Q,valueMax:q,valueMin:X,valueNow:Y}}function oB({children:$,className:J,disabled:Q,disableDoubleClick:Z,elementRef:q,id:X,style:Y,...z}){let K=dB(X),W=lB({disabled:Q,disableDoubleClick:Z}),[H,B]=C1.useState({}),[U,_]=C1.useState("inactive"),[L,F]=C1.useState(!1),V=C1.useRef(null),M=pB(V,q),{disableCursor:D,id:N,orientation:O,registerSeparator:I,updateSeparatorProps:k}=rB(),T=O==="horizontal"?"vertical":"horizontal";u2(()=>{let C=V.current;if(C!==null){let y={disabled:W.disabled,disableDoubleClick:W.disableDoubleClick,element:C,id:K},x=I(y),j=Ql((h)=>{_(h.next.state!=="inactive"&&h.next.hitRegions.some((l)=>l.separator===y)?h.next.state:"inactive")}),P=gB(N,(h)=>{let{derivedPanelConstraints:l,layout:t,separatorToPanels:S}=h.next,i=S.get(y);if(i){let J0=i[0],K0=i.indexOf(J0);B(Ll({layout:t,panelConstraints:l,panelId:J0.id,panelIndex:K0}))}});return()=>{j(),P(),x()}}},[N,K,I,W]),C1.useEffect(()=>{k(K,{disabled:Q,disableDoubleClick:Z})},[Q,Z,K,k]);let A;Q&&!D&&(A="not-allowed");let w;if(Q)w="disabled";else switch(U){case"active":{w="active";break}default:L?w="focus":w=U}return G("div",{...z,"aria-controls":H.valueControls,"aria-disabled":Q||void 0,"aria-orientation":T,"aria-valuemax":H.valueMax,"aria-valuemin":H.valueMin,"aria-valuenow":H.valueNow,children:$,className:J,"data-separator":w,"data-testid":K,id:K,onBlur:()=>F(!1),onFocus:()=>F(!0),ref:M,role:"separator",style:{flexBasis:"auto",cursor:A,...Y,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:Q?void 0:0})}oB.displayName="Separator";function _T({className:$,...J}){return G(iB,{"data-slot":"resizable-panel-group",className:b0("flex h-full w-full aria-[orientation=vertical]:flex-col",$),...J})}function nB($){return G(sB,{"data-slot":"resizable-panel",...$})}function LT({withHandle:$,className:J,onPointerDown:Q,...Z}){return G(oB,{"data-slot":"resizable-handle",className:b0("relative flex w-px touch-none items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-2 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 aria-[orientation=vertical]:cursor-col-resize aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:cursor-row-resize aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-2 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90",J),onPointerDown:(q)=>{q.stopPropagation(),Q?.(q)},...Z,children:$?G("div",{className:"z-10 flex h-7 w-3 items-center justify-center rounded-sm border border-border bg-background shadow-sm",children:G(UT,{className:"size-2.5 text-muted-foreground"})}):null})}var Vl={backgroundColor:"var(--multitrack-video-bg)",backgroundColorStrong:"var(--multitrack-video-bg-strong)",borderColor:"var(--multitrack-video-border)",textColor:"var(--multitrack-video-text)",textClassName:"text-[10px]",titleBackgroundColor:null,waveformColor:"var(--multitrack-video-waveform)",showThumbnail:!0,showWaveform:!0,waveformSource:"decoded-media"},Ml={backgroundColor:"var(--multitrack-audio-bg)",backgroundColorStrong:"var(--multitrack-audio-bg-strong)",borderColor:"var(--multitrack-audio-border)",textColor:"var(--multitrack-audio-text)",textClassName:"text-[10px]",titleBackgroundColor:"var(--multitrack-audio-title-bg)",waveformColor:"var(--multitrack-audio-waveform)",showThumbnail:!1,showWaveform:!0,waveformSource:"decoded-media"},Dl={backgroundColor:"var(--multitrack-task-bg)",backgroundColorStrong:"var(--multitrack-task-bg-strong)",borderColor:"var(--multitrack-task-border)",textColor:"var(--multitrack-task-text)",textClassName:"text-[8px]",titleBackgroundColor:null,waveformColor:null,showThumbnail:!1,showWaveform:!1,waveformSource:null},Nl={backgroundColor:"var(--multitrack-subtitle-bg)",backgroundColorStrong:"var(--multitrack-subtitle-bg-strong)",borderColor:"var(--multitrack-subtitle-border)",textColor:"var(--multitrack-subtitle-text)",textClassName:"text-[8px]",titleBackgroundColor:null,waveformColor:null,showThumbnail:!1,showWaveform:!1,waveformSource:null};function J4($){if($==="video")return Vl;if($==="audio")return Ml;if($==="subtitle")return Nl;return Dl}var P6=R(v(),1),DT=R($5(),1);var Ol=new Set(["arabic","chinese","english","french","german","hindi","indonesian","italian","japanese","korean","malay","portuguese","russian","spanish","thai","turkish","vietnamese"]),RJ=/<[^<>\n]*>|@(?:图片|音频|视频|Picture|Image|Audio|Video)\s*\d+|\{[^{}\n]*\}|\[[^\[\]\n]*\]|\(S\d+(?:\s*,\s*S?\d+)*\)|(?:subject_definitions|summary|retention_analysis|detailed_description|overall_soundscape|non_diegetic_music)\s*:\s*|(?:主体定义|摘要|留存分析|详细描述|整体声景|非叙事性音乐)\s*[::]\s*|[||]/gi,$U="prompt-reference-chip inline-flex h-[1.6em] max-w-full items-center gap-1 rounded-md border px-1.5 py-0.5 mx-1 align-middle font-semibold leading-none shadow-sm",NT="font-semibold text-muted-foreground";function OT($){if(/^$/i.test($))return!0;if(/^<\/?d>$/i.test($)||/^<(?:scenetrans|cutoff)>$/i.test($))return!0;if(/^\[Shot\s+\d+\]$/i.test($)||/^\(S\d+(?:\s*,\s*S?\d+)*\)$/i.test($))return!0;return AT($)}function AT($){let J=$.match(/^\[([A-Za-z]+)\]$/)?.[1].toLowerCase();return J!==void 0&&Ol.has(J)}function FT($){return/^\[Shot\s+\d+\]$/i.test($)}function wT($){return/^(?:(?:subject_definitions|summary|retention_analysis|detailed_description|overall_soundscape|non_diegetic_music)\s*:|(?:主体定义|摘要|留存分析|详细描述|整体声景|非叙事性音乐)\s*[::])\s*$/i.test($)}function Al($,J){if(J?.color)return J.color;if($.type==="audio")return"var(--multitrack-audio-waveform)";if($.type==="video")return"var(--multitrack-video-waveform)";return"var(--multitrack-task-bg)"}function kT($,J){$.style.color=J,$.style.borderColor=J,$.style.backgroundColor=`color-mix(in srgb, ${J} 10%, transparent)`}function wl($,J){let Q=J.type==="image"?"Picture":J.type==="audio"?"Audio":"Video";if(/^<(?:Picture|Image|Audio|Video)\s+\d+>$/i.test($))return`<${Q} ${J.index}>`;if(/^@(?:Picture|Image|Audio|Video)\s*\d+$/i.test($))return`@${Q} ${J.index}`;return J.token}function CJ($){let J=$.match(/^@?(图片|音频|视频|Picture|Image|Audio|Video)\s*(\d+)>?$/i)??$.match(/^<(Picture|Audio|Video)\s+(\d+)>$/i);if(!J)return null;let Q=J[1].toLowerCase();return{type:Q==="图片"||Q==="picture"||Q==="image"?"image":Q==="音频"||Q==="audio"?"audio":"video",index:Number(J[2])}}function Uz($){let J="",Q=(q)=>{J+=q.replaceAll("​","")},Z=(q)=>{if(q.nodeType===Node.TEXT_NODE){Q(q.textContent??"");return}if(!(q instanceof HTMLElement))return;let X=q.dataset.promptReferenceToken??q.dataset.promptSemanticToken;if(X!==void 0){Q(X);return}if(q.dataset.promptEmphasisText!==void 0){Q(q.textContent??"");return}if(q.tagName==="BR"){Q(` -`);return}if((q.tagName==="DIV"||q.tagName==="P")&&J&&!J.endsWith(` -`))Q(` -`);q.childNodes.forEach(Z)};return $.childNodes.forEach(Z),J}function PZ($){return Uz($)}function kl($){return/^\n*$/.test($)?"":$}function aB($){let J=window.getSelection();if(!J?.rangeCount)return PZ($).length;let Q=J.getRangeAt(0);if(!$.contains(Q.endContainer))return PZ($).length;let Z=Q.cloneRange();return Z.selectNodeContents($),Z.setEnd(Q.endContainer,Q.endOffset),Uz(Z.cloneContents()).length}function Il($,J,Q,Z){let q=[];RJ.lastIndex=0;for(let X of $.matchAll(RJ)){let Y=X[0],z=CJ(Y);if(z&&!J)q.push(`reference:${z.type}:${z.index}`);else if(Q&&OT(Y))q.push(`semantic:${Y.toLowerCase()}`);else if(Q&&wT(Y))q.push(`emphasis:${Y.toLowerCase()}`);else if(J&&(Y.startsWith("{")||Y.startsWith("<")))q.push("system");else if(Z&&(Y==="|"||Y==="|"))q.push("pipe")}return q.join("|")}function Tl($){return Array.from($.querySelectorAll("[data-prompt-reference-token], [data-prompt-semantic-token], [data-prompt-emphasis-text], [data-system-prompt-variable], [data-pipe]")).map((J)=>{let Q=J.dataset.promptReferenceToken;if(Q!==void 0){let Z=CJ(Q);return Z?`reference:${Z.type}:${Z.index}`:"reference:unknown"}if(J.dataset.systemPromptVariable!==void 0)return"system";if(J.dataset.promptSemanticToken!==void 0)return`semantic:${J.dataset.promptSemanticToken.toLowerCase()}`;if(J.dataset.promptEmphasisText!==void 0)return`emphasis:${J.dataset.promptEmphasisText.toLowerCase()}`;return"pipe"}).join("|")}function Wz($,J){let Q=window.getSelection();if(!Q)return;let Z=Math.max(0,J);for(let X of $.childNodes){let Y=X instanceof HTMLElement?X:null,z=Y?.dataset.promptReferenceToken??Y?.dataset.promptSemanticToken??Y?.dataset.promptEmphasisText,K=z!==void 0?z.length:Y?.tagName==="BR"?1:X.textContent?.replaceAll("​","").length??0;if(Z<=K){let W=document.createRange();if(z!==void 0)Z===0?W.setStartBefore(X):W.setStartAfter(X);else if(Y?.tagName==="BR")Z===0?W.setStartBefore(X):W.setStartAfter(X);else if(X.nodeType===Node.TEXT_NODE)W.setStart(X,Math.min(Z,X.textContent?.length??0));else{let H=document.createTreeWalker(X,NodeFilter.SHOW_TEXT).nextNode();if(H)W.setStart(H,Math.min(Z,H.textContent?.length??0));else W.setStartAfter(X)}W.collapse(!0),Q.removeAllRanges(),Q.addRange(W);return}Z-=K}let q=document.createRange();q.selectNodeContents($),q.collapse(!1),Q.removeAllRanges(),Q.addRange(q)}function bl($,J,Q){RJ.lastIndex=0;for(let Z of $.matchAll(RJ)){if(!CJ(Z[0]))continue;let q=Z.index??0,X=q+Z[0].length;if(Q==="Backspace"&&J>q&&J<=X)return{start:q,end:X};if(Q==="Delete"&&J>=q&&J{if(Z>0)$.append(document.createElement("br"));if(Q)$.append(document.createTextNode(Q))})}function tB($,J){J.split(` -`).forEach((Q,Z)=>{if(Z>0)$.append(document.createElement("br"));if(!Q)return;let q=document.createElement("span");q.dataset.promptDialogueContent="true",q.className=NT,q.textContent=Q,$.append(q)})}function VT($,J){let Q=window.getSelection();if(!Q?.rangeCount)return!1;let Z=Q.getRangeAt(0);if(!$.contains(Z.commonAncestorContainer))return!1;Z.deleteContents();let q=document.createDocumentFragment();Bz(q,J);let X=document.createTextNode("​");q.append(X),Z.insertNode(q);let Y=document.createRange();return Y.setStart(X,X.textContent?.length??0),Y.collapse(!0),Q.removeAllRanges(),Q.addRange(Y),!0}function jl($){let J=window.getSelection();if(!J?.rangeCount||J.isCollapsed)return null;let Q=J.getRangeAt(0);if(!$.contains(Q.commonAncestorContainer))return null;return Uz(Q.cloneContents())}function El($,J,Q){let Z=CJ(J),q=document.createElement("span");if(q.contentEditable="false",q.dataset.promptReferenceToken=J,q.dataset.promptReferenceType=Z?.type??"",q.className=`${$U} cursor-pointer`,kT(q,Z?Al(Z,Q):"var(--muted-foreground)"),Q?.type==="image"&&Q.thumbnailUrl){let Y=document.createElement("img");Y.src=Q.thumbnailUrl,Y.alt="",Y.draggable=!1,Y.className="h-4 w-4 shrink-0 rounded-sm object-cover align-middle",q.append(Y)}else{let Y=document.createElement("span");Y.className="prompt-reference-icon inline-flex h-4 w-4 shrink-0 items-center justify-center",Y.dataset.referenceIcon=Q?.type??Z?.type??"image";let z=document.createElementNS("http://www.w3.org/2000/svg","svg");z.setAttribute("viewBox","0 0 24 24"),z.setAttribute("fill","none"),z.setAttribute("stroke","currentColor"),z.setAttribute("stroke-width","2"),z.setAttribute("stroke-linecap","round"),z.setAttribute("stroke-linejoin","round"),z.setAttribute("aria-hidden","true"),z.classList.add("lucide","h-4","w-4");let K=Q?.type??Z?.type??"image";(K==="audio"?["M2 10v3","M6 6v11","M10 3v18","M14 8v7","M18 5v13","M22 10v3"]:K==="video"?["m16 13 5.223-3.482a.5.5 0 0 1 .777.416v8.132a.5.5 0 0 1-.777.416L16 15","M2 6h14v12H2z","m2 6 3-4","m7 6 3-4","m12 6 3-4"]:["M14.5 4h-9A2.5 2.5 0 0 0 3 6.5v11A2.5 2.5 0 0 0 5.5 20h13a2.5 2.5 0 0 0 2.5-2.5v-8","m3 16 5-5c.928-.893 2.072-.893 3 0l4 4","m14 14 1-1c.928-.893 2.072-.893 3 0l3 3","M14 7h.01"]).forEach((H)=>{let B=document.createElementNS("http://www.w3.org/2000/svg","path");B.setAttribute("d",H),z.append(B)}),Y.append(z),q.append(Y)}let X=document.createElement("span");X.className="inline-flex h-full items-center leading-none",X.textContent=J,q.append(X),q.title=Q?.detail??J,$.append(q)}function MT($,J){let Q=document.createElement("span");Q.className="inline-flex h-3.5 w-3.5 shrink-0 items-center justify-center",Q.dataset.semanticIcon=J;let Z=document.createElementNS("http://www.w3.org/2000/svg","svg");Z.setAttribute("viewBox","0 0 24 24"),Z.setAttribute("fill","none"),Z.setAttribute("stroke","currentColor"),Z.setAttribute("stroke-width","2"),Z.setAttribute("stroke-linecap","round"),Z.setAttribute("stroke-linejoin","round"),Z.setAttribute("aria-hidden","true"),Z.classList.add("lucide","h-3.5","w-3.5"),(J==="subject"?["M18 21a8 8 0 0 0-16 0","M10 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8","M19 8v6","M22 11h-6"]:["M21 15a4 4 0 0 1-4 4H8l-5 3V7a4 4 0 0 1 4-4h10a4 4 0 0 1 4 4z"]).forEach((X)=>{let Y=document.createElementNS("http://www.w3.org/2000/svg","path");Y.setAttribute("d",X),Z.append(Y)}),Q.append(Z),$.append(Q)}function yl($,J){let Q=document.createElement("span");Q.contentEditable="false",Q.dataset.promptSemanticToken=J,Q.className=$U;let Z=/^$/i.test(J),q=/^<\/?d>$/i.test(J),X=FT(J)||AT(J),Y=Z||FT(J)?"var(--highlight)":q?"var(--prompt-dialogue)":"var(--prompt-semantic)";if(X)Q.classList.add("border-border","bg-background","text-foreground");else kT(Q,Y);if(Z)MT(Q,"subject");if(q)MT(Q,"dialogue");let z=document.createElement("span");z.className="inline-flex h-full items-center leading-none",z.textContent=J,Q.append(z),$.append(Q)}function Pl($,J){let Q=document.createElement("span");Q.dataset.promptEmphasisText=J,Q.className=NT,Q.textContent=J,$.append(Q)}function Hz($,J,Q,Z,q,X){$.textContent="";let Y=0,z=!1;RJ.lastIndex=0;for(let W of J.matchAll(RJ)){let H=W.index??0,B=J.slice(Y,H);if(z)tB($,B);else Bz($,B);let U=W[0],_=/^$/i.test(U);if(/^<\/d>$/i.test(U))z=!1;let F=CJ(U);if(F&&!Z){let V=Q.find((M)=>M.type===F.type&&M.index===F.index);El($,U,V)}else if(q&&OT(U))yl($,U);else if(q&&wT(U))Pl($,U);else if(Z&&(U.startsWith("{")||U.startsWith("<"))){let V=document.createElement("span");V.dataset.systemPromptVariable="true",V.className="text-highlight",V.textContent=U,$.append(V)}else if(X&&(U==="|"||U==="|")){let V=document.createElement("span");V.dataset.pipe="true",V.className="text-highlight",V.textContent="|",$.append(V)}else if(z)tB($,U);else Bz($,U);if(q&&_)z=!0;Y=H+U.length}let K=J.slice(Y);if(z)tB($,K);else Bz($,K)}function Rl({type:$}){if($==="audio")return G(eB,{className:"h-4 w-4"});if($==="video")return G(Q4,{className:"h-4 w-4"});return G(LJ,{className:"h-4 w-4"})}function _z({value:$,onChange:J,ariaLabel:Q,placeholder:Z,resources:q=[],mentionsEnabled:X=!1,interactivePlaceholder:Y=!1,highlightSystemVariables:z=!1,highlightPromptSemantics:K=!1,highlightPipes:W=!1,className:H,testId:B}){let U=X1(),_=P6.useRef(null),L=P6.useRef(null),F=P6.useRef(!1),V=P6.useRef(""),[M,D]=P6.useState(null),[N,O]=P6.useState($.length===0),I=P6.useMemo(()=>{if(!M)return q;let j=M.query.toLocaleLowerCase();return q.filter((P)=>!j||`${P.label} ${P.detail}`.toLocaleLowerCase().includes(j))},[M,q]),k=P6.useMemo(()=>JSON.stringify({value:$,highlightSystemVariables:z,highlightPromptSemantics:K,highlightPipes:W,resources:q.map((j)=>[j.id,j.index,j.label,j.detail,j.token,j.color,j.thumbnailUrl])}),[W,K,z,q,$]);P6.useEffect(()=>{O($.length===0);let j=L.current;if(!j||V.current===k)return;let P=document.activeElement===j,h=P?aB(j):0;if(Hz(j,$,q,z,K,W),P)Wz(j,Math.min(h,$.length));V.current=k},[W,K,z,k,q,$]);function T(j,P){if(!X){D(null);return}let l=j.slice(0,P).match(/@([^\s@|<>]*)$/);if(!l){D(null);return}if(CJ(l[0])){D(null);return}let t=_.current,S=window.getSelection(),J0=(S?.rangeCount?S.getRangeAt(0):null)?.getBoundingClientRect?.(),K0=t?.getBoundingClientRect(),e=J0?.left??K0?.left??0,H0=J0?.top??K0?.top??0,q0=J0?.bottom??K0?.bottom??0,E=Math.min(Math.max(8,e),Math.max(8,window.innerWidth-264)),d=q0+214<=window.innerHeight?q0+6:Math.max(8,H0-214),c=P-l[0].length;D((r)=>({start:c,end:P,query:l[1],left:E,top:d,activeIndex:r?.start===c?r.activeIndex:0}))}function A(j){if(!X||!N)return;let P=j.getBoundingClientRect(),h=Math.min(Math.max(8,P.left),Math.max(8,window.innerWidth-264)),l=P.bottom+214<=window.innerHeight?P.bottom+6:Math.max(8,P.top-214);D({start:0,end:0,query:"",left:h,top:l,activeIndex:0})}function w(j){let P=L.current,h=j.dataset.promptReferenceToken;if(!X||!P||h===void 0)return;let l=document.createRange();l.selectNodeContents(P),l.setEndBefore(j);let t=Uz(l.cloneContents()).length,S=j.getBoundingClientRect(),i=Math.min(Math.max(8,S.left),Math.max(8,window.innerWidth-264)),J0=S.bottom+214<=window.innerHeight?S.bottom+6:Math.max(8,S.top-214);D({start:t,end:t+h.length,query:"",left:i,top:J0,activeIndex:0})}function C(){let j=L.current;if(!j)return;let P=kl(PZ(j)),h=P.length===0?0:aB(j);if(P.length===0||Tl(j)!==Il(P,z,K,W)){let{scrollTop:t,scrollLeft:S}=j;Hz(j,P,q,z,K,W),Wz(j,h),j.scrollTop=t,j.scrollLeft=S}O(P.length===0),V.current=JSON.stringify({value:P,highlightSystemVariables:z,highlightPromptSemantics:K,highlightPipes:W,resources:q.map((t)=>[t.id,t.index,t.label,t.detail,t.token,t.color,t.thumbnailUrl])}),J(P),T(P,h)}function y(j){let P=L.current;if(!P||!M)return;let h=PZ(P),l=h.slice(M.start,M.end),t=wl(l,j),S=`${h.slice(0,M.start)}${t}${h.slice(M.end)}`;Hz(P,S,q,z,K,W),O(!1),Wz(P,M.start+t.length),V.current="",J(S),D(null),P.focus()}function x(j){let P=L.current;if(!P)return!1;let h=PZ(P),l=bl(h,aB(P),j);if(!l)return!1;let t=`${h.slice(0,l.start)}${h.slice(l.end)}`;return Hz(P,t,q,z,K,W),O(t.length===0),Wz(P,l.start),V.current="",D(null),J(t),!0}return b("div",{ref:_,className:"relative h-full min-h-0 max-h-full overflow-hidden [contain:size_layout_paint]",children:[G("div",{ref:L,role:"textbox","aria-label":Q,"aria-multiline":"true","data-testid":B,"data-placeholder":Z,contentEditable:!0,suppressContentEditableWarning:!0,className:b0("prompt-content-editor h-full min-h-0 max-h-full overflow-auto whitespace-pre-wrap wrap-break-word rounded-md px-3 py-2 text-[10px] leading-normal text-foreground caret-foreground outline-none focus-visible:ring-1 focus-visible:ring-ring",!Y&&"empty:before:pointer-events-none empty:before:text-muted-foreground empty:before:content-[attr(data-placeholder)]",H),onInput:()=>{if(!F.current)C()},onCompositionStart:()=>{F.current=!0},onCompositionEnd:()=>{F.current=!1,C()},onPaste:(j)=>{j.preventDefault(),j.stopPropagation(),j.nativeEvent.stopImmediatePropagation?.();let P=L.current,h=j.clipboardData.getData("text/plain");if(P&&VT(P,h))C()},onCopy:(j)=>{j.stopPropagation();let P=L.current,h=P?jl(P):null;if(h===null)return;j.preventDefault(),j.clipboardData.setData("text/plain",h)},onKeyDown:(j)=>{if((j.key==="Backspace"||j.key==="Delete")&&x(j.key)){j.preventDefault();return}if(M){if(j.key==="Escape")j.preventDefault(),D(null);else if(j.key==="ArrowDown"||j.key==="ArrowUp")j.preventDefault(),D((P)=>P&&I.length>0?{...P,activeIndex:(P.activeIndex+(j.key==="ArrowDown"?1:-1)+I.length)%I.length}:P);else if(j.key==="Enter"&&I.length>0){j.preventDefault(),y(I[Math.min(M.activeIndex,I.length-1)]);return}}if(j.key==="Enter"&&!F.current&&!j.nativeEvent.isComposing){j.preventDefault();let P=L.current;if(P&&VT(P,` -`))C();return}if((j.ctrlKey||j.metaKey)&&["a","c","v","x"].includes(j.key.toLowerCase()))j.stopPropagation()},onClick:(j)=>{let h=(j.target instanceof Element?j.target:null)?.closest("[data-prompt-reference-token]");if(h&&L.current?.contains(h))w(h);else D(null)},onBlur:(j)=>{if(_.current?.contains(j.relatedTarget))return;D(null)}}),Y&&N&&(()=>{let j=Z.indexOf("@"),P=j>=0?Z.slice(0,j):Z,h=j>=0?Z.slice(j+1):"";return b("div",{className:"pointer-events-none absolute inset-0 overflow-hidden whitespace-pre-wrap wrap-break-word px-3 py-2 text-[10px] leading-normal text-muted-foreground",children:[P,j>=0&&G(k0,{type:"button",variant:"ghost","aria-label":U("multitrack.openReferenceResources"),className:b0($U,"pointer-events-auto min-w-0 border-border bg-background text-highlight text-[10px]"),onPointerDown:(l)=>l.preventDefault(),onClick:(l)=>A(l.currentTarget),children:"@"}),h]})})(),M&&DT.createPortal(G("div",{className:M8,children:b("div",{role:"listbox","aria-label":U("multitrack.referenceResources"),className:b0("fixed z-50 flex w-64 flex-col overflow-y-auto rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-md",I.length===0?"h-64":"max-h-52"),style:{left:M.left,top:M.top},children:[G("div",{className:"shrink-0 px-2 py-1.5 text-[10px] font-semibold text-muted-foreground",children:U("multitrack.referenceResources")}),I.length===0?b("div",{"data-testid":"reference-resources-empty",className:"flex min-h-0 flex-1 flex-col items-center justify-center gap-4 px-5 pb-7 text-center text-muted-foreground",children:[b("div",{"aria-hidden":"true",className:"relative h-14 w-20 opacity-60",children:[G("span",{className:"absolute left-8 -top-2 flex h-10 w-10 -rotate-12 items-center justify-center rounded-md border border-border bg-muted shadow-sm",children:G(LJ,{className:"h-5 w-5"})}),G("span",{className:"absolute -left-2 top-1 flex h-10 w-10 rotate-3 items-center justify-center rounded-md border border-border bg-muted shadow-sm",children:G(eB,{className:"h-5 w-5"})}),G("span",{className:"absolute left-6 top-4 flex h-10 w-10 rotate-6 items-center justify-center rounded-md border border-border bg-muted shadow-sm",children:G(Q4,{className:"h-5 w-5"})})]}),G("span",{className:" text-[10px] leading-relaxed",children:U("multitrack.referenceResourcesEmpty")})]}):I.map((j,P)=>b(k0,{type:"button",variant:"ghost",role:"option","aria-selected":P===M.activeIndex,className:b0("h-auto w-full justify-start gap-2 px-2 py-1.5 text-left",P===M.activeIndex&&"bg-accent text-accent-foreground"),onPointerDown:(h)=>h.preventDefault(),onPointerMove:()=>D((h)=>h?{...h,activeIndex:P}:h),onClick:()=>y(j),children:[j.type==="image"&&j.thumbnailUrl?G("img",{src:j.thumbnailUrl,alt:"",className:"h-8 w-8 shrink-0 rounded-sm object-cover"}):G("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-sm bg-muted",children:G(Rl,{type:j.type})}),b("span",{className:"min-w-0",children:[G("span",{className:"block truncate text-[11px] font-semibold",style:{color:j.color},children:j.label}),G("span",{className:"block truncate text-[9px] text-muted-foreground",children:j.detail})]})]},j.id))]})}),document.body)]})}var IT=180,Cl="55%",TT=280,Sl=16,JU="task-images-resizable-panel",bT="task-prompt-resizable-panel",Fz,Lz=null;function jT($){return Mz($.content.images)}function hl($,J,Q){let Z=$.findIndex((z)=>z.id===J),q=$.findIndex((z)=>z.id===Q);if(Z<0||q<0||Z===q)return $;let X=[...$],[Y]=X.splice(Z,1);return X.splice(q,0,Y),X}function RZ($){return $.file_name??$.file_path??$.local_path??$.url??$.slot_name??$.id}function xl($){if(!$)return"";if($.slot_name)return`__slot__:${$.slot_name}`;return $.file_path??$.local_path??$.url??""}function fl($){if($?.source_type==="output")return"outputs";if($?.source_type==="local")return"local";if($?.source_type==="url")return"url";if($?.source_type==="slot")return"slot";return"inputs"}function vl($,J){if(J)return J;if($.startsWith("__slot__:"))return"slot";if($.startsWith("http://")||$.startsWith("https://"))return"url";return"input"}function ST($,J){return J.some((Q)=>Q.content.media_type==="video"&&Q.start_frame<$.end_frame&&Q.end_frame>$.start_frame)}function ET($,J,Q,Z){let q=xZ($.content.images),X=QU($.content.task_mode??"default",q.length,ST($,Q)),Y=$.content.task_mode??"default",z=X==="fl2v"||X==="fmlf2v"?"i2v":X;return J.find((W)=>W.format===Z&&(W.modes?.includes(Y)||W.task_type===X))?.system_prompt??J.find((W)=>W.task_type===z&&W.format===void 0)?.system_prompt??""}async function gl(){if(Fz)return Fz;if(!Lz)Lz=(async()=>{let $=await fetch("/easy-media/prompt/system-prompts");if(!$.ok)throw Error(`Failed to load system prompt options: ${$.status}`);let J=await $.json(),Q=Array.isArray(J.items)?J.items:[];return Fz=Q,Q})().catch(($)=>{throw Lz=null,$});return Lz}function hT({segment:$,node:J,app:Q,trackSegments:Z,selectedSegments:q,videoSegments:X=[],mediaTracks:Y=[],frameRate:z=S2,totalFrames:K,imageIndexOffset:W=0,format:H,onContentChange:B,onTrackSegmentsContentChange:U,onTrackSegmentsChange:_,onDurationChange:L,onOpenImagePreview:F}){let V=X1(),M=u1.useRef(null),[D,N]=u1.useState("user"),[O,I]=u1.useState("individual"),[k,T]=u1.useState(!1),[A,w]=u1.useState(null),[C,y]=u1.useState(!1),[x,j]=u1.useState(!1),[P,h]=u1.useState(Fz??null),[l,t]=u1.useState(!1),[S,i]=u1.useState(!1),J0=m2(vJ($),z),K0=IJ(J0,z),[e,H0]=u1.useState(K0),q0=jT($),E=u1.useMemo(()=>Y9(J,Q,"image"),[J,Q,k]),d=q0.find(($0)=>$0.id===A),c=$.content.task_mode??"default",r=$.content.continuity_mode??CZ,u=$.content.ref_image_size??wz,m=u1.useMemo(()=>Z&&Z.length>0?Z:[$],[$,Z]),s=m.map(($0)=>SZ($0.content)).join("|"),[f,o]=u1.useState(s),G0=Math.max(0,m.findIndex(($0)=>$0.id===$.id)),p=m.reduce(($0,S0)=>S0.start_frame<$0.start_frame?S0:$0).id,Z0=q?.some(($0)=>$0.id!==p)===!0,Q0=$.content.user_prompt_variant==="b"?"b":"a",B0=O==="combined"?f:SZ($.content),W0=H==="MiniMax",L0=W0?V("multitrack.minimaxPromptPlaceholder"):V("multitrack.promptPlaceholder"),_0=ST($,X),N0=ET($,P??[],X,H),d0=O==="combined"?m.map(($0)=>$0.content.system_prompt??ET($0,P??[],X,H)).join("|"):$.content.system_prompt||N0,g=u1.useMemo(()=>{let $0=xZ(q0).map((A1,O1)=>({id:`image:${A1.id}`,type:"image",index:O1+1,label:V("multitrack.referencePicture",{n:O1+1}),detail:RZ(A1),token:`@${V("multitrack.referencePicture",{n:O1+1})}`,color:J4("task").backgroundColor,thumbnailUrl:Q5({source_type:A1.source_type??"input",file_path:A1.file_path,local_path:A1.local_path,url:A1.url,slot_name:A1.slot_name})??void 0})),S0=Y.filter((A1)=>A1.type==="video"&&A1.segments.some((O1)=>O1.content.media_type==="video")),c0=Y.filter((A1)=>A1.type==="audio"&&A1.segments.some((O1)=>O1.content.media_type==="audio")),Q1=S0.map((A1,O1)=>{let k5=O1+1,f8=V("multitrack.referenceAudioItem",{n:k5});return{id:`video-audio:${A1.id}`,type:"audio",index:k5,label:f8,detail:A1.name,token:`@${f8}`,color:J4("video").waveformColor??J4("video").backgroundColor}}),D1=c0.map((A1,O1)=>{let k5=S0.length+O1+1,f8=V("multitrack.referenceAudioItem",{n:k5});return{id:`audio:${A1.id}`,type:"audio",index:k5,label:f8,detail:A1.name,token:`@${f8}`,color:J4("audio").waveformColor??J4("audio").backgroundColor}}),d1=S0.map((A1,O1)=>{let k5=O1+1,f8=V("multitrack.referenceVideoItem",{n:k5});return{id:`video:${A1.id}`,type:"video",index:k5,label:f8,detail:A1.name,token:`@${f8}`,color:J4("video").waveformColor??J4("video").backgroundColor}});return[...$0,...Q1,...D1,...d1]},[q0,Y,V]);u1.useEffect(()=>{H0(K0)},[K0]),u1.useEffect(()=>{i(!1)},[$.id]),u1.useEffect(()=>{o(($0)=>$0===s?$0:s)},[s]);function a(){let $0=Zz(e,z);if($0===null){H0(K0),i(!1);return}if(H0(IJ($0,z)),i(!1),$0!==J0)L?.($0)}u1.useEffect(()=>{if(D!=="system")return;if(P!==null)return;let $0=!1;return t(!0),gl().then((S0)=>{if(!$0)h(S0)}).catch((S0)=>{if(console.error("[TaskSegmentEditor] failed to load system prompt options:",S0),!$0)h([])}).finally(()=>{if(!$0)t(!1)}),()=>{$0=!0}},[D,P]);function I0($0){if(Array.from($0.files).some((c0)=>c0.type.startsWith("image/")))return!0;return Array.from($0.items??[]).some((c0)=>c0.kind==="file"&&c0.type.startsWith("image/"))}function w0($0){if(!$0.dataTransfer||!I0($0.dataTransfer))return;$0.preventDefault(),y(!0)}function F0($0){if(!$0.dataTransfer||!I0($0.dataTransfer))return;$0.preventDefault(),y(!0)}function u0($0){let S0=$0.relatedTarget;if(S0 instanceof Node&&$0.currentTarget.contains(S0))return;y(!1)}async function P0($0){if($0.preventDefault(),y(!1),!$0.dataTransfer)return;let S0=Z4-q0.length;if(S0<=0)return;let c0=Array.from($0.dataTransfer.files).filter((d1)=>d1.type.startsWith("image/")).slice(0,S0);if(c0.length===0)return;let D1=(await Promise.allSettled(c0.map((d1)=>b7(d1)))).flatMap((d1)=>{if(d1.status==="fulfilled")return[d1.value];return console.error("[TaskSegmentEditor] failed to upload task image:",d1.reason),[]});if(D1.length>0)R5("inputs"),B({images:[...q0,...D1]})}function n0($0,S0){let c0=A?1:Z4-q0.length;if(c0<=0)return;let Q1=fJ($0).slice(0,c0),D1=vl($0,S0),d1=Q1.map((A1)=>xJ(A1,D1));if(d1.length===0)return;if(A){let A1={...d1[0],id:A};if(d?.shared_reference===!0&&U){let O1=k7(d),k5=new Map(I7(m,d,!1).map((Y6)=>[Y6.segmentId,Y6.images])),f8=m.map((Y6)=>({...Y6,content:{...Y6.content,images:Y6.id===$.id?[A1,...(k5.get(Y6.id)??[]).filter((pW)=>k7(pW)!==O1)]:k5.get(Y6.id)??jT(Y6)}}));U(I7(f8,A1,!0).map((Y6)=>({segmentId:Y6.segmentId,patch:{images:Y6.images}}))),w(null),T(!1);return}B({images:q0.map((O1)=>O1.id===A?A1:O1)})}else B({images:[...q0,...d1]});w(null),T(!1)}function R0($0){let S0=$0===""?[""]:$0.split(/[||]/);if(_){let c0=m.reduce((Q1,D1)=>Math.max(Q1,D1.end_frame),0);_(CT(S0,m,K??c0,$.color));return}U?.(m.map((c0,Q1)=>({segmentId:c0.id,patch:hZ(c0.content,S0[Q1]??"")})))}function Z1($0){if(O==="combined"){o($0),R0($0);return}B(hZ($.content,$0))}function K1($0){if(O==="combined"){let S0=$0.split("|");U?.(m.map((c0,Q1)=>({segmentId:c0.id,patch:{system_prompt:S0[Q1]??""}})));return}B({system_prompt:$0})}function a0(){let $0={user_prompt:B0,user_prompt_b:B0};if(U)U(m.map((S0)=>({segmentId:S0.id,patch:$0})));else B($0);j(!1)}function T1($0){if(!q||q.length<=1||!U){B($0);return}U(q.map((S0)=>({segmentId:S0.id,patch:$0.continuity_mode!==void 0&&S0.id===p?{...$0,continuity_mode:CZ}:$0})))}function v1($0){let S0=q0.find((c0)=>c0.id===$0);if(S0?.shared_reference===!0&&U){let c0=k7(S0),Q1=I7(m,S0,!1).map((D1)=>({segmentId:D1.segmentId,patch:{images:D1.segmentId===$.id?D1.images.filter((d1)=>k7(d1)!==c0):D1.images}}));U(Q1);return}B({images:q0.filter((c0)=>c0.id!==$0)})}function E1($0,S0){if(S0&&!SJ(m,$0))return;let c0=I7(m,$0,S0);if(U){U(c0.map((D1)=>({segmentId:D1.segmentId,patch:{images:D1.images}})));return}let Q1=c0.find((D1)=>D1.segmentId===$.id);if(Q1)B({images:Q1.images})}function n($0,S0){B({images:q0.map((c0)=>c0.id===$0?{...c0,muted:S0}:c0)})}let D0=q0.length>0&&q0.length<4?"grid-cols-2":"grid-cols-3",O0=C?"border-primary bg-accent/20":"border-border bg-muted/20",v0=u1.useRef(null),i0=u1.useRef(null),G1=u1.useRef(null),h1=u1.useRef(null),i1=u1.useRef(null),Y0=u1.useRef(null),[C0,x0]=u1.useState(!0),[r0,E0]=u1.useState("40%"),[F1,r1]=u1.useState(120);u1.useLayoutEffect(()=>{let $0=i0.current;if(!$0)return;let S0=globalThis.getComputedStyle($0),c0=$0.clientWidth-Number.parseFloat(S0.paddingLeft)-Number.parseFloat(S0.paddingRight),Q1=$0.clientHeight-Number.parseFloat(S0.paddingTop)-Number.parseFloat(S0.paddingBottom);if(c0<=0||Q1<=0)return;let D1=Math.min(c0*0.55,c0-TT-Sl);E0(Math.max(IT,Math.min(Q1,D1)))},[]),u1.useLayoutEffect(()=>{let $0=h1.current??G1.current;if(!$0)return;let S0=()=>{let Q1=$0.clientWidth;if(Q1<=0)return;r1((D1)=>Math.abs(D1-Q1)>1?Q1:D1)};S0();let c0=new ResizeObserver(S0);return c0.observe($0),()=>c0.disconnect()},[q0.length]);let y1=Math.round(Math.max(14,Math.min(F1*0.07,28))),t1=Math.round(Math.max(14,Math.min(F1*0.08,32))),L5=Math.round(Math.max(10,Math.min(F1*0.05,20))),z0=Math.round(Math.max(10,Math.min(F1*0.06,18)));u1.useEffect(()=>{let $0=v0.current;if(!$0)return;let S0=new ResizeObserver((c0)=>{let Q1=c0[0]?.contentRect.width??$0.clientWidth;x0(Q1>=600)});return S0.observe($0),x0($0.clientWidth>=600),()=>S0.disconnect()},[]);function A0($0){if($0.button!==0)return;$0.preventDefault(),$0.stopPropagation();let S0=i1.current?.getLayout(),c0=$0.currentTarget.parentElement?.getBoundingClientRect().width??0,Q1=S0?.[JU];if(c0<=0||Q1===void 0)return;Y0.current={pointerId:$0.pointerId,startClientX:$0.clientX,startImageSize:Q1,groupWidth:c0},$0.currentTarget.setPointerCapture?.($0.pointerId)}function f0($0){let S0=Y0.current;if(!S0||S0.pointerId!==$0.pointerId)return;$0.preventDefault(),$0.stopPropagation();let c0=S0.startImageSize+($0.clientX-S0.startClientX)/S0.groupWidth*100;i1.current?.setLayout({[JU]:c0,[bT]:100-c0})}function $1($0){if(Y0.current?.pointerId!==$0.pointerId)return;if($0.preventDefault(),$0.stopPropagation(),Y0.current=null,$0.currentTarget.hasPointerCapture?.($0.pointerId))$0.currentTarget.releasePointerCapture?.($0.pointerId)}return b("div",{ref:v0,"data-capture-wheel":"true",className:"task-segment-editor flex h-full min-h-24 w-full flex-col overflow-hidden rounded-sm bg-background text-foreground",children:[G("div",{ref:i0,className:"flex min-h-0 flex-1 p-4",children:b(_T,{groupRef:i1,orientation:"horizontal",className:"min-h-0 min-w-0",children:[O==="individual"&&G(nB,{id:JU,defaultSize:r0,minSize:IT,maxSize:Cl,children:G("div",{ref:h1,"data-testid":"task-image-drop-zone","aria-label":V("multitrack.taskImageDropZone"),className:b0("task-image-drop-zone flex h-full min-h-0 w-full items-center justify-center rounded-md border border-dashed transition-colors",C?"border-primary bg-accent/20":"border-border bg-muted/30"),onDragEnter:w0,onDragOver:F0,onDragLeave:u0,onDrop:P0,children:b(a1,{open:k,onOpenChange:($0)=>{if(T($0),!$0)w(null)},children:[q0.length===0?G(T5,{asChild:!0,children:b("div",{role:"button",tabIndex:0,className:b0("task-image-picker-empty flex aspect-square h-full max-h-full min-h-24 min-w-24 max-w-full cursor-pointer flex-col items-center justify-center gap-1 rounded-md px-4 py-2 text-foreground shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",O0),"aria-label":V("multitrack.taskImageDropZone"),onClick:()=>w(null),onKeyDown:($0)=>{if($0.key!=="Enter"&&$0.key!==" ")return;$0.preventDefault(),T(!0)},children:[G(Vz,{}),G("span",{className:"text-[10px] font-semibold mt-1",children:V("multitrack.selectImage")}),G("span",{className:"max-w-full whitespace-normal text-center text-[9px] text-muted-foreground",children:V("multitrack.imageDropHint")})]})}):G(_6,{asChild:!0,children:b("div",{ref:G1,"data-testid":"task-image-grid",className:b0("task-image-grid relative grid h-full w-full auto-rows-max content-start gap-2 overflow-y-auto rounded-md p-3 transition-colors",D0,O0),children:[q0.map(($0,S0)=>{let c0=Q5({source_type:$0.source_type??"input",file_path:$0.file_path,local_path:$0.local_path,url:$0.url,slot_name:$0.slot_name}),Q1=$0.shared_reference===!0||SJ(m,$0),D1=$0.shared_reference?y1:t1,d1={width:`${L5}px`,height:`${L5}px`},A1=RT(q0,$0.id,W);return b("div",{draggable:!0,"data-testid":`task-image-${$0.id}`,className:`task-image-grid-item group/task-image relative flex aspect-square w-full self-start cursor-pointer items-center justify-center overflow-hidden rounded-md border bg-black ${$0.shared_reference?$0.muted===!0?"border-highlight opacity-50":"border-highlight":"border-border"}`,role:"button",tabIndex:0,"aria-label":V("multitrack.reselectImage",{name:RZ($0)}),onClick:()=>{w($0.id),T(!0)},onKeyDown:(O1)=>{if(O1.target!==O1.currentTarget)return;if(O1.key!=="Enter"&&O1.key!==" ")return;O1.preventDefault(),w($0.id),T(!0)},onDragStart:()=>{M.current=$0.id},onDragOver:(O1)=>O1.preventDefault(),onDrop:()=>{let O1=M.current;if(M.current=null,!O1)return;B({images:hl(q0,O1,$0.id)})},children:[c0&&$0.panorama_view?G(Yz,{imageId:$0.id,imageUrl:c0,alt:RZ($0),view:$0.panorama_view,className:b0("absolute inset-0 m-auto transition-opacity",$0.muted===!0&&"opacity-40")}):c0?G("img",{src:c0,alt:RZ($0),className:b0("absolute inset-0 h-full w-full object-contain transition-opacity",$0.muted===!0&&"opacity-40"),draggable:!1}):G("div",{className:"flex h-full w-full items-center justify-center px-2 text-center text-[8px] text-muted-foreground",children:$0.source_type==="slot"?V("mediaSelector.slotImage",{n:Dz($0,S0)}):RZ($0)}),G("div",{"data-testid":`task-image-overlay-${$0.id}`,"aria-hidden":"true",className:"pointer-events-none absolute inset-0 z-[5] bg-black/30 opacity-0 transition-opacity group-hover/task-image:opacity-100 group-focus-within/task-image:opacity-100"}),b("div",{"data-testid":`task-image-actions-${$0.id}`,className:"absolute right-0.5 top-1 z-10 flex gap-1 opacity-0 transition-opacity group-hover/task-image:opacity-100 group-focus-within/task-image:opacity-100",children:[G(n1,{children:b(B1,{children:[G(U1,{asChild:!0,children:G(k0,{type:"button",size:"icon",variant:$0.shared_reference===!0?"secondary":"ghost","data-testid":`task-image-shared-${$0.id}`,className:`h-auto w-auto cursor-pointer bg-background/70 hover:bg-background/90 ${$0.shared_reference===!0?"text-highlight":"text-muted-foreground"}`,style:{width:D1,height:D1},"aria-label":$0.shared_reference===!0?V("multitrack.disableSharedReference"):V("multitrack.enableSharedReference"),"aria-pressed":$0.shared_reference===!0,disabled:!Q1,onClick:(O1)=>{O1.stopPropagation(),E1($0,$0.shared_reference!==!0)},children:G(hJ,{style:d1})})}),G(H1,{side:"bottom",className:"max-w-64",children:Q1?V("multitrack.sharedImageReferenceTooltip"):V("multitrack.sharedImageLimitTooltip")})]})}),G(n1,{children:b(B1,{children:[G(U1,{asChild:!0,children:G(k0,{type:"button",size:"icon",variant:$0.muted===!0?"secondary":"ghost","data-testid":`task-image-muted-${$0.id}`,className:`h-auto w-auto cursor-pointer bg-background/70 font-bold hover:bg-background/90 ${$0.muted===!0?"text-destructive hover:text-destructive":"text-muted-foreground"}`,style:{width:D1,height:D1,fontSize:z0},"aria-label":$0.muted===!0?V("multitrack.includeImage"):V("multitrack.bypassImage"),"aria-pressed":$0.muted===!0,onClick:(O1)=>{O1.stopPropagation(),n($0.id,$0.muted!==!0)},children:"M"})}),G(H1,{side:"bottom",children:$0.muted===!0?V("multitrack.includeImageTooltip"):V("multitrack.bypassImageTooltip")})]})}),G(n1,{children:b(B1,{children:[G(U1,{asChild:!0,children:G(k0,{type:"button",size:"icon",variant:"ghost",className:"h-auto w-auto cursor-pointer bg-background/70 text-muted-foreground font-bold hover:bg-background/90",style:{width:D1,height:D1},"aria-label":V("multitrack.previewImage"),disabled:!c0,onClick:(O1)=>{O1.stopPropagation(),F?.($0.id)},children:G(T7,{style:d1})})}),G(H1,{side:"bottom",children:V("multitrack.previewImage")})]})}),G(n1,{children:b(B1,{children:[G(U1,{asChild:!0,children:G(k0,{type:"button",size:"icon",variant:"ghost",className:"h-auto w-auto cursor-pointer bg-background/70 text-destructive hover:bg-background/90 hover:text-destructive",style:{width:D1,height:D1},"aria-label":V("multitrack.deleteImage"),onClick:(O1)=>{O1.stopPropagation(),v1($0.id)},children:G(M5,{style:d1})})}),G(H1,{side:"bottom",children:V("multitrack.deleteImage")})]})})]}),A1!==null?G("span",{"data-testid":`task-image-index-${$0.id}`,className:"absolute bottom-0 left-0 z-10 min-w-5 rounded-sm bg-black/50 px-1.5 py-0.5 text-center text-[9px] font-semibold leading-none text-white",children:A1}):null]},$0.id)}),q0.length{w(null),T(!0)},children:G(z5,{className:"h-7 w-7"})})]})}),G(s1,{className:"w-auto p-0",align:"end",children:G(V5,{value:xl(d),mediaType:"image",defaultTab:fl(d),allowMultipleSelection:!A,maxSelectionCount:A?1:Z4-q0.length,slotItems:E,onChange:n0},A??"add-images")})]})})}),O==="individual"?G(LT,{withHandle:!0,"aria-label":V("multitrack.resizeTaskEditorPanels"),className:"mx-2 bg-transparent",onPointerDown:A0,onPointerMove:f0,onPointerUp:$1,onPointerCancel:$1,onLostPointerCapture:()=>{Y0.current=null}}):null,G(nB,{id:bT,minSize:O==="individual"?TT:"100%",children:b("div",{"data-testid":"task-prompt-panel",className:"flex h-full min-h-0 min-w-0 flex-col overflow-hidden rounded-md border border-border bg-muted/30 shadow-sm",children:[O==="individual"&&b("div",{className:"flex h-11 shrink-0 items-center px-2 justify-between",children:[b("div",{className:"flex h-7 items-center rounded-md bg-card p-1",children:[G(k0,{type:"button",variant:"ghost",className:b0("h-full rounded-sm px-3 py-1 text-[10px] shadow-none cursor-pointer",D==="user"?"bg-background text-primary hover:bg-background/90 hover:text-primary":"text-muted-foreground"),onClick:()=>N("user"),children:V("multitrack.userPrompt")}),G(k0,{type:"button",variant:"ghost",className:b0("h-full rounded-sm px-3 py-1 text-[10px] shadow-none cursor-pointer",D==="system"?"bg-background text-primary hover:bg-background/90 hover:text-primary":"text-muted-foreground"),onClick:()=>N("system"),children:V("multitrack.systemPrompt")})]}),D==="user"?b("div",{className:"flex items-center gap-1",children:[G(k0,{type:"button",variant:"ghost",className:"h-7 px-2 text-[10px] text-highlight hover:bg-highlight/10 hover:text-highlight cursor-pointer hover:opacity-70",onClick:()=>j(!0),children:V("multitrack.applyPromptToAll")}),G(n1,{delayDuration:300,children:b(B1,{children:[G(U1,{asChild:!0,children:G("div",{"aria-label":V("multitrack.userPromptVariantTooltip"),children:G(u4,{value:Q0,onValueChange:($0)=>B({user_prompt_variant:$0}),children:b(r9,{className:"h-7 bg-card p-1",children:[G(W8,{value:"a",className:"h-full min-w-7 px-2 text-[10px]",children:"A"}),G(W8,{value:"b",className:"h-full min-w-7 px-2 text-[10px]",children:"B"})]})})})}),G(H1,{side:"bottom",className:"max-w-72",children:V("multitrack.userPromptVariantTooltip")})]})})]}):Boolean($.content.system_prompt)&&b(B1,{children:[G(U1,{asChild:!0,children:G(k0,{type:"button",size:"icon",variant:"ghost",className:"h-7 w-7 text-muted-foreground [&_svg]:!size-3","aria-label":V("multitrack.resetSystemPrompt"),onClick:()=>B({system_prompt:""}),children:G(PT,{})})}),G(H1,{side:"bottom",children:V("multitrack.resetSystemPrompt")})]})]}),O==="combined"?b("div",{className:"flex min-h-0 flex-1 flex-col gap-1 p-2",children:[G("div",{className:"relative h-full min-h-0 flex-1 overflow-hidden rounded-md bg-card",children:G(_z,{ariaLabel:V("multitrack.prompt"),placeholder:L0,interactivePlaceholder:W0,testId:"combined-prompt-highlight",className:"border-none bg-card shadow-none",value:B0,resources:g,mentionsEnabled:!0,highlightPromptSemantics:!0,highlightPipes:!0,onChange:Z1})}),G("p",{className:"shrink-0 text-[9px] text-muted-foreground mt-1",children:V("maintainTrack.combinedHint")})]}):D==="user"?G("div",{className:"relative h-full min-h-0 flex-1 overflow-hidden pb-2 px-2",children:G(_z,{placeholder:L0,interactivePlaceholder:W0,ariaLabel:V("multitrack.prompt"),className:"border-none bg-card shadow-none",value:B0,resources:g,mentionsEnabled:!0,highlightPromptSemantics:!0,onChange:Z1})}):G("div",{className:"relative h-full min-h-0 flex-1 overflow-hidden pb-2 px-2",children:G("div",{className:"relative h-full min-h-0 overflow-hidden rounded-md bg-card",children:G(_z,{ariaLabel:V("multitrack.systemPrompt"),placeholder:l?V("multitrack.loadingSystemPrompt"):V("multitrack.systemPromptPlaceholder"),className:"border-none bg-card shadow-none",value:d0,resources:g,highlightSystemVariables:!0,onChange:K1})})})]})})]},O)}),b("div",{className:"relative flex shrink-0 items-center justify-between border-t border-dashed border-border p-2",children:[G(u4,{value:O,onValueChange:($0)=>I($0),className:C0?void 0:"hidden",children:b(r9,{className:"h-8 bg-card",children:[G(W8,{value:"individual",className:"text-[10px]",children:V("multitrack.individualEdit")}),G(W8,{value:"combined",className:"text-[10px]",children:V("multitrack.combinedEdit")})]})}),G("div",{className:b0(C0?"absolute left-1/2 -translate-x-1/2":"flex items-center",S&&"w-28"),children:S?G($6,{autoFocus:!0,"aria-label":V("multitrack.duration"),type:"text",inputMode:"numeric",placeholder:"00:00:00",className:"tabular-nums",value:e,onChange:($0)=>H0($0.currentTarget.value),onBlur:a,onKeyDown:($0)=>{if($0.key!=="Enter")return;$0.preventDefault(),a()}}):b("div",{className:"flex items-center gap-1 text-muted-foreground",children:[b("div",{className:"flex flex-col items-center",children:[G("span",{className:"text-[10px] text-primary",children:V("multitrack.taskNumber",{n:G0+1})}),G("span",{className:"text-[10px] mt-0.5 tabular-nums",children:K0})]}),L&&G(k0,{type:"button",variant:"ghost",size:"icon",className:"h-5 w-5 cursor-pointer","aria-label":V("multitrack.editTaskDuration"),onClick:()=>i(!0),children:G(yT,{className:"h-3 w-3"})})]})}),b("div",{className:"flex items-center gap-2",children:[H==="MiniMax"&&(G0>0||Z0)&&b(E8,{value:r,onValueChange:($0)=>T1({continuity_mode:$0}),children:[G(n1,{delayDuration:300,children:b(B1,{children:[G(U1,{asChild:!0,children:G(y8,{"aria-label":V("multitrack.continuityMode"),className:"h-8 w-28 bg-card text-[10px]",children:G(W6,{})})}),G(H1,{side:"bottom",className:"max-w-72",children:V("multitrack.continuityModeTooltip")})]})}),G(P8,{children:Oz.map(($0)=>G(l5,{value:$0,children:G("span",{className:"text-[10px]",children:V(`multitrackContinuityModes.${$0}`)})},$0))})]}),H==="MiniMax"&&["ref","edit"].includes(c)&&b(E8,{value:u,onValueChange:($0)=>T1({ref_image_size:$0}),children:[G(n1,{delayDuration:300,children:b(B1,{children:[G(U1,{asChild:!0,children:G(y8,{"aria-label":V("multitrack.refImageSize"),className:"h-8 w-20 bg-card text-[10px]",children:G(W6,{})})}),G(H1,{side:"bottom",className:"max-w-72",children:V("multitrack.refImageSizeTooltip")})]})}),G(P8,{children:Az.map(($0)=>G(l5,{value:$0,children:G("span",{className:"text-[10px]",children:V(`multitrackRefImageSizes.${$0}`)})},$0))})]}),b(E8,{value:c,onValueChange:($0)=>T1({task_mode:$0}),children:[G(n1,{delayDuration:300,children:b(B1,{children:[G(U1,{asChild:!0,children:G(y8,{"aria-label":V("multitrack.taskMode"),className:"h-8 w-24 bg-card text-[10px]",children:G(W6,{})})}),G(H1,{side:"bottom",className:"max-w-72",children:V("multitrack.taskModeTooltip")})]})}),G(P8,{children:Nz.map(($0)=>G(l5,{value:$0,children:G("span",{className:"text-[10px]",children:V(`multitrackTaskModes.${QU($0,q0.length,_0)}`)})},$0))})]})]})]}),G(DJ,{open:x,onOpenChange:j,children:b(b2,{className:"max-w-md",children:[b(OZ,{children:[G(j2,{children:V("multitrack.applyPromptToAllTitle")}),G(wZ,{children:V("multitrack.applyPromptToAllDescription")})]}),b(AZ,{children:[G(k0,{type:"button",variant:"outline",onClick:()=>j(!1),children:V("common.cancel")}),G(k0,{type:"button",onClick:a0,children:V("multitrack.applyPromptToAllConfirm")})]})]})})]})}var m8=R(v(),1);function ul($){if($==="stretch")return"fill";if($==="crop")return"cover";return"contain"}function xT($,J){if(!Number.isFinite(J)||Math.abs($.currentTime-J)<=0.001)return;try{$.currentTime=J}catch(Q){console.error("[VideoPreview] failed to seek preview video:",Q)}}function vT({activeVideo:$,resolution:J,isPlaying:Q,playbackNonce:Z=0,muted:q,volume:X,frameRate:Y,className:z,children:K}){let W=X1(),H=m8.useRef(null),[B,U]=m8.useState(null),[_,L]=m8.useState(null),[F,V]=m8.useState(null),[M,D]=m8.useState(null),N=m8.useMemo(()=>{if(!$)return null;return Q5({source_type:$.segment.content.source_type??"input",file_path:$.segment.content.file_path,local_path:$.segment.content.local_path,url:$.segment.content.url,slot_name:$.segment.content.slot_name})},[$]),O=Math.max(0,Math.min(X,1)),I=ul(J.resizeMethod),k=$?.segment.id??null,T=$?.segment.content.source_type==="url",A=$?.localTime??0,w=Math.round(A*Y),C=$&&N?`${N}:${Y}:${w}`:null,y=F?.url===N,x=y&&F.fps!==null&&Math.abs(F.fps-Y)<=0.01;m8.useEffect(()=>{if(!$||!N||T)return;let P=new AbortController,h=$.segment.content,l=N;async function t(){try{let S=await fetch("/easy-media/video/source-fps",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source_type:h.source_type??"input",file_path:h.file_path,local_path:h.local_path,url:h.url}),signal:P.signal});if(!S.ok)throw Error(`Video frame rate request failed (${S.status})`);let i=await S.json(),J0=i&&typeof i==="object"&&"fps"in i?i.fps:null;if(typeof J0!=="number"||!Number.isFinite(J0)||J0<=0)throw Error("Video frame rate response is invalid");if(!P.signal.aborted)V({url:l,fps:J0})}catch(S){if(!P.signal.aborted)console.error("[VideoPreview] failed to probe source frame rate:",S),V({url:l,fps:null})}}return t(),()=>P.abort()},[N,T]),m8.useEffect(()=>{if(Q||T||x||!y||!$||!N||C===null){U(null),L(null);return}let P=C,h=new AbortController,l=null,t=$.segment.content;async function S(){try{let J0=await fetch("/easy-media/video/preview-frame",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source_type:t.source_type??"input",file_path:t.file_path,local_path:t.local_path,url:t.url,frame:w,fps:Y}),signal:h.signal});if(!J0.ok)throw Error(`Preview frame request failed (${J0.status})`);if(l=URL.createObjectURL(await J0.blob()),!h.signal.aborted)L(null),U({key:P,url:l})}catch(J0){if(!h.signal.aborted)console.error("[VideoPreview] failed to load timeline frame:",J0),L(P)}}let i=setTimeout(()=>{S()},60);return()=>{if(clearTimeout(i),h.abort(),l)URL.revokeObjectURL(l)}},[$?.segment.id,Y,Q,T,w,y,C,x,N]),m8.useEffect(()=>{let P=H.current;if(!P)return;P.muted=q,P.volume=O},[q,O]),m8.useEffect(()=>{let P=H.current;if(!P||!$||Q)return;xT(P,$.localTime)},[$,A,Q]),m8.useEffect(()=>{let P=H.current;if(x&&!Q&&P&&P.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA&&!P.seeking&&Math.abs(P.currentTime-A)<1/Y)D(C)},[A,Y,Q,C,x]);function j(){let P=H.current;if(x&&!Q&&P&&!P.seeking&&Math.abs(P.currentTime-A)<1/Y)D(C)}return m8.useEffect(()=>{let P=H.current;if(!P||!$)return;if(Q){xT(P,$.localTime);let h=P.play();if(h)h.catch((l)=>{console.error("[VideoPreview] failed to play preview video:",l)});return}P.pause()},[Q,N,k,Z]),b("div",{"data-testid":"multitrack-video-stage",className:b0("relative flex h-full min-w-0 max-h-full max-w-full items-center justify-center overflow-hidden bg-black",z),style:{aspectRatio:`${J.width} / ${J.height}`},children:[N?G("video",{ref:H,"data-testid":"multitrack-video-preview",className:"absolute inset-0 h-full min-h-0 w-full min-w-0 max-h-full max-w-full",src:N,muted:q,playsInline:!0,preload:"auto",onSeeked:j,onLoadedData:j,style:{objectFit:I,visibility:Q||T||_===C||x&&M===C?"visible":"hidden"}}):$?.segment.content.source_type==="slot"?G("div",{"data-testid":"multitrack-video-slot-placeholder",className:"flex h-full w-full items-center justify-center bg-muted/30 px-3 text-center text-xs font-medium text-muted-foreground",children:W("mediaSelector.slotVideo",{n:fT($.segment.content.slot_name)})}):G("div",{"data-testid":"multitrack-black-frame",className:"h-full w-full bg-black"}),!Q&&B?.key===C&&G("img",{src:B.url,alt:"","data-testid":"multitrack-timeline-frame",className:"absolute inset-0 h-full w-full",style:{objectFit:I}}),K]})}var m9=R(v(),1);var s0=R(v(),1);function c2($,J){if($.indexOf(J)===-1)$.push(J)}function j7($,J){let Q=$.indexOf(J);if(Q>-1)$.splice(Q,1)}var _8=($,J,Q)=>{if(Q>J)return J;if(Q<$)return $;return Q};function ZU($,J){return J?`${$}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${J}`:$}var q4=()=>{},N6=()=>{};if(typeof process<"u"&&process.env?.NODE_ENV!=="production")q4=($,J,Q)=>{if(!$&&typeof console<"u")console.warn(ZU(J,Q))},N6=($,J,Q)=>{if(!$)throw Error(ZU(J,Q))};var Q6={};var fZ=($)=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test($);var vZ=($)=>typeof $==="object"&&$!==null;var gZ=($)=>/^0[^.\s]+$/u.test($);function uZ($){let J;return()=>{if(J===void 0)J=$();return J}}var b5=($)=>$;var C9=(...$)=>$.reduce((J,Q)=>(Z)=>Q(J(Z)));var X4=($,J,Q)=>{let Z=J-$;return Z?(Q-$)/Z:1};class E7{constructor(){this.subscriptions=[]}add($){return c2(this.subscriptions,$),()=>j7(this.subscriptions,$)}notify($,J,Q){let Z=this.subscriptions.length;if(!Z)return;if(Z===1)this.subscriptions[0]($,J,Q);else for(let q=0;q$*1000,w8=($)=>$/1000;var mZ=($,J)=>J?$*(1000/J):0;var gT=($,J,Q)=>(((1-3*Q+3*J)*$+(3*Q-6*J))*$+3*J)*$,ml=0.0000001,cl=12;function dl($,J,Q,Z,q){let X,Y,z=0;do if(Y=J+(Q-J)/2,X=gT(Y,Z,q)-$,X>0)Q=Y;else J=Y;while(Math.abs(X)>ml&&++zdl(X,0,1,$,Q);return(X)=>X===0||X===1?X:gT(q(X),J,Z)}var kz=($)=>(J)=>J<=0.5?$(2*J)/2:(2-$(2*(1-J)))/2;var Iz=($)=>(J)=>1-$(1-J);var Tz=y7(0.33,1.53,0.69,0.99),gJ=Iz(Tz),cZ=kz(gJ);var dZ=($)=>$>=1?1:($*=2)<1?0.5*gJ($):0.5*(2-Math.pow(2,-10*($-1)));var pZ=($)=>1-Math.sin(Math.acos($)),lZ=Iz(pZ),iZ=kz(pZ);var qU=y7(0.42,0,1,1),XU=y7(0,0,0.58,1),rZ=y7(0.42,0,0.58,1);var YU=($)=>{return Array.isArray($)&&typeof $[0]!=="number"};var sZ=($)=>Array.isArray($)&&typeof $[0]==="number";var uT={linear:b5,easeIn:qU,easeInOut:rZ,easeOut:XU,circIn:pZ,circInOut:iZ,circOut:lZ,backIn:gJ,backInOut:cZ,backOut:Tz,anticipate:dZ},pl=($)=>{return typeof $==="string"},bz=($)=>{if(sZ($)){N6($.length===4,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");let[J,Q,Z,q]=$;return y7(J,Q,Z,q)}else if(pl($))return N6(uT[$]!==void 0,`Invalid easing type '${$}'`,"invalid-easing-type"),uT[$];return $};var oZ=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function mT($){let J=new Set,Q=new Set,Z=!1,q=!1,X=new WeakSet,Y={delta:0,timestamp:0,isProcessing:!1};function z(W){if(X.has(W))K.schedule(W),$();W(Y)}let K={schedule:(W,H=!1,B=!1)=>{let _=B&&Z?J:Q;if(H)X.add(W);return _.add(W),W},cancel:(W)=>{Q.delete(W),X.delete(W)},process:(W)=>{if(Y=W,Z){q=!0;return}Z=!0;let H=J;if(J=Q,Q=H,J.forEach(z),J.clear(),Z=!1,q)q=!1,K.process(W)}};return K}var ll=40;function jz($,J){let Q=!1,Z=!0,q={delta:0,timestamp:0,isProcessing:!1},X=()=>Q=!0,Y=oZ.reduce((N,O)=>{return N[O]=mT(X),N},{}),{setup:z,read:K,resolveKeyframes:W,preUpdate:H,update:B,preRender:U,render:_,postRender:L}=Y,F=()=>{let N=Q6.useManualTiming,O=N?q.timestamp:performance.now();if(Q=!1,!N)q.delta=Z?16.666666666666668:Math.max(Math.min(O-q.timestamp,ll),1);if(q.timestamp=O,q.isProcessing=!0,z.process(q),K.process(q),W.process(q),H.process(q),B.process(q),U.process(q),_.process(q),L.process(q),q.isProcessing=!1,Q&&J)Z=!1,$(F)},V=()=>{if(Q=!0,Z=!0,!q.isProcessing)$(F)};return{schedule:oZ.reduce((N,O)=>{let I=Y[O];return N[O]=(k,T=!1,A=!1)=>{if(!Q)V();return I.schedule(k,T,A)},N},{}),cancel:(N)=>{for(let O=0;O{if(Ez===void 0)j5.set(C5.isProcessing||Q6.useManualTiming?C5.timestamp:performance.now());return Ez},set:($)=>{Ez=$,queueMicrotask(il)}};var cT=($)=>(J)=>typeof J==="string"&&J.startsWith($),yz=cT("--"),rl=cT("var(--"),uJ=($)=>{if(!rl($))return!1;return sl.test($.split("/*")[0].trim())},sl=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function zU($){if(typeof $!=="string")return!1;return $.split("/*")[0].includes("var(--")}var Y4={test:($)=>typeof $==="number",parse:parseFloat,transform:($)=>$},l4={...Y4,transform:($)=>_8(0,1,$)},aZ={...Y4,default:1};var P7=($)=>Math.round($*1e5)/1e5;var mJ=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function dT($){return $==null}var pT=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu;var cJ=($,J)=>(Q)=>{return Boolean(typeof Q==="string"&&pT.test(Q)&&Q.startsWith($)||J&&!dT(Q)&&Object.prototype.hasOwnProperty.call(Q,J))},Pz=($,J,Q)=>(Z)=>{if(typeof Z!=="string")return Z;let[q,X,Y,z]=Z.match(mJ);return{[$]:parseFloat(q),[J]:parseFloat(X),[Q]:parseFloat(Y),alpha:z!==void 0?parseFloat(z):1}};var ol=($)=>_8(0,255,$),KU={...Y4,transform:($)=>Math.round(ol($))},z4={test:cJ("rgb","red"),parse:Pz("red","green","blue"),transform:({red:$,green:J,blue:Q,alpha:Z=1})=>"rgba("+KU.transform($)+", "+KU.transform(J)+", "+KU.transform(Q)+", "+P7(l4.transform(Z))+")"};function nl($){let J="",Q="",Z="",q="";if($.length>5)J=$.substring(1,3),Q=$.substring(3,5),Z=$.substring(5,7),q=$.substring(7,9);else J=$.substring(1,2),Q=$.substring(2,3),Z=$.substring(3,4),q=$.substring(4,5),J+=J,Q+=Q,Z+=Z,q+=q;return{red:parseInt(J,16),green:parseInt(Q,16),blue:parseInt(Z,16),alpha:q?parseInt(q,16)/255:1}}var tZ={test:cJ("#"),parse:nl,transform:z4.transform};var eZ=($)=>({test:(J)=>typeof J==="string"&&J.endsWith($)&&J.split(" ").length===1,parse:parseFloat,transform:(J)=>`${J}${$}`}),K9=eZ("deg"),c8=eZ("%"),p0=eZ("px"),GU=eZ("vh"),WU=eZ("vw"),Rz=(()=>({...c8,parse:($)=>c8.parse($)/100,transform:($)=>c8.transform($*100)}))();var R7={test:cJ("hsl","hue"),parse:Pz("hue","saturation","lightness"),transform:({hue:$,saturation:J,lightness:Q,alpha:Z=1})=>{return"hsla("+Math.round($)+", "+c8.transform(P7(J))+", "+c8.transform(P7(Q))+", "+P7(l4.transform(Z))+")"}};var N5={test:($)=>z4.test($)||tZ.test($)||R7.test($),parse:($)=>{if(z4.test($))return z4.parse($);else if(R7.test($))return R7.parse($);else return tZ.parse($)},transform:($)=>{return typeof $==="string"?$:$.hasOwnProperty("red")?z4.transform($):R7.transform($)},getAnimatableNone:($)=>{let J=N5.parse($);return J.alpha=0,N5.transform(J)}};var lT=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function al($){return isNaN($)&&typeof $==="string"&&($.match(mJ)?.length||0)+($.match(lT)?.length||0)>0}var rT="number",sT="color",tl="var",el="var(",iT="${}",$i=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function C7($){let J=$.toString(),Q=[],Z={color:[],number:[],var:[]},q=[],X=0,z=J.replace($i,(K)=>{if(N5.test(K))Z.color.push(X),q.push(sT),Q.push(N5.parse(K));else if(K.startsWith(el))Z.var.push(X),q.push(tl),Q.push(K);else Z.number.push(X),q.push(rT),Q.push(parseFloat(K));return++X,iT}).split(iT);return{values:Q,split:z,indexes:Z,types:q}}function Ji($){return C7($).values}function oT({split:$,types:J}){let Q=$.length;return(Z)=>{let q="";for(let X=0;Xtypeof $==="number"?0:N5.test($)?N5.getAnimatableNone($):$,qi=($,J)=>{if(typeof $==="number")return J?.trim().endsWith("/")?$:0;return Zi($)};function Xi($){let J=C7($);return oT(J)(J.values.map((Z,q)=>qi(Z,J.split[q])))}var L8={test:al,parse:Ji,createTransformer:Qi,getAnimatableNone:Xi};function HU($,J,Q){if(Q<0)Q+=1;if(Q>1)Q-=1;if(Q<0.16666666666666666)return $+(J-$)*6*Q;if(Q<0.5)return J;if(Q<0.6666666666666666)return $+(J-$)*(0.6666666666666666-Q)*6;return $}function nT({hue:$,saturation:J,lightness:Q,alpha:Z}){$/=360,J/=100,Q/=100;let q=0,X=0,Y=0;if(!J)q=X=Y=Q;else{let z=Q<0.5?Q*(1+J):Q+J-Q*J,K=2*Q-z;q=HU(K,z,$+0.3333333333333333),X=HU(K,z,$),Y=HU(K,z,$-0.3333333333333333)}return{red:Math.round(q*255),green:Math.round(X*255),blue:Math.round(Y*255),alpha:Z}}function dJ($,J){return(Q)=>Q>0?J:$}var b1=($,J,Q)=>{return $+(J-$)*Q};var BU=($,J,Q)=>{let Z=$*$,q=Q*(J*J-Z)+Z;return q<0?0:Math.sqrt(q)},Yi=[tZ,z4,R7],zi=($)=>Yi.find((J)=>J.test($));function aT($){let J=zi($);if(q4(Boolean(J),`'${$}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!Boolean(J))return!1;let Q=J.parse($);if(J===R7)Q=nT(Q);return Q}var UU=($,J)=>{let Q=aT($),Z=aT(J);if(!Q||!Z)return dJ($,J);let q={...Q};return(X)=>{return q.red=BU(Q.red,Z.red,X),q.green=BU(Q.green,Z.green,X),q.blue=BU(Q.blue,Z.blue,X),q.alpha=b1(Q.alpha,Z.alpha,X),z4.transform(q)}};var Cz=new Set(["none","hidden"]);function tT($,J){if(Cz.has($))return(Q)=>Q<=0?$:J;else return(Q)=>Q>=1?J:$}function Ki($,J){return(Q)=>b1($,J,Q)}function Sz($){if(typeof $==="number")return Ki;else if(typeof $==="string")return uJ($)?dJ:N5.test($)?UU:Hi;else if(Array.isArray($))return eT;else if(typeof $==="object")return N5.test($)?UU:Gi;return dJ}function eT($,J){let Q=[...$],Z=Q.length,q=$.map((X,Y)=>Sz(X)(X,J[Y]));return(X)=>{for(let Y=0;Y{for(let X in Z)Q[X]=Z[X](q);return Q}}function Wi($,J){let Q=[],Z={color:0,var:0,number:0};for(let q=0;q{let Q=L8.createTransformer(J),Z=C7($),q=C7(J);if(Z.indexes.var.length===q.indexes.var.length&&Z.indexes.color.length===q.indexes.color.length&&Z.indexes.number.length>=q.indexes.number.length){if(Cz.has($)&&!q.values.length||Cz.has(J)&&!Z.values.length)return tT($,J);return C9(eT(Wi(Z,q),q.values),Q)}else return q4(!0,`Complex values '${$}' and '${J}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),dJ($,J)};function hz($,J,Q){if(typeof $==="number"&&typeof J==="number"&&typeof Q==="number")return b1($,J,Q);return Sz($)($,J)}var $b=($)=>{let J=({timestamp:Q})=>$(Q);return{start:(Q=!0)=>k1.update(J,Q),stop:()=>O6(J),now:()=>C5.isProcessing?C5.timestamp:j5.now()}};var xz=($,J,Q=10)=>{let Z="",q=Math.max(Math.round(J/Q),2);for(let X=0;X=20000?1/0:J}function Jb($,J=100,Q){let Z=Q({...$,keyframes:[0,J]}),q=Math.min(pJ(Z),fz);return{type:"keyframes",ease:(X)=>{return Z.next(q*X).value/J},duration:w8(q)}}var E5={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:0.3,visualDuration:0.3,restSpeed:{granular:0.01,default:2},restDelta:{granular:0.005,default:0.5},minDuration:0.01,maxDuration:10,minDamping:0.05,maxDamping:1};function LU($,J){return $*Math.sqrt(1-J*J)}var Bi=12;function Ui($,J,Q){let Z=Q;for(let q=1;q{let H=W*Y,B=H*$,U=H-Q,_=LU(W,Y),L=Math.exp(-B);return _U-U/_*L},X=(W)=>{let B=W*Y*$,U=B*Q+Q,_=Math.pow(Y,2)*Math.pow(W,2)*$,L=Math.exp(-B),F=LU(Math.pow(W,2),Y);return(-q(W)+_U>0?-1:1)*((U-_)*L)/F};else q=(W)=>{let H=Math.exp(-W*$),B=(W-Q)*$+1;return-_U+H*B},X=(W)=>{let H=Math.exp(-W*$),B=(Q-W)*($*$);return H*B};let z=5/$,K=Ui(q,X,z);if($=f5($),isNaN(K))return{stiffness:E5.stiffness,damping:E5.damping,duration:$};else{let W=Math.pow(K,2)*Z;return{stiffness:W,damping:Y*2*Math.sqrt(Z*W),duration:$}}}var Li=["duration","bounce"],Fi=["stiffness","damping","mass"];function Qb($,J){return J.some((Q)=>$[Q]!==void 0)}function Vi($){let J={velocity:E5.velocity,stiffness:E5.stiffness,damping:E5.damping,mass:E5.mass,isResolvedFromDuration:!1,...$};if(!Qb($,Fi)&&Qb($,Li))if(J.velocity=0,$.visualDuration){let Q=$.visualDuration,Z=2*Math.PI/(Q*1.2),q=Z*Z,X=2*_8(0.05,1,1-($.bounce||0))*Math.sqrt(q);J={...J,mass:E5.mass,stiffness:q,damping:X}}else{let Q=_i({...$,velocity:0});J={...J,...Q,mass:E5.mass},J.isResolvedFromDuration=!0}return J}function lJ($=E5.visualDuration,J=E5.bounce){let Q=typeof $!=="object"?{visualDuration:$,keyframes:[0,1],bounce:J}:$,{restSpeed:Z,restDelta:q}=Q,X=Q.keyframes[0],Y=Q.keyframes[Q.keyframes.length-1],z={done:!1,value:X},{stiffness:K,damping:W,mass:H,duration:B,velocity:U,isResolvedFromDuration:_}=Vi({...Q,velocity:-w8(Q.velocity||0)}),L=U||0,F=W/(2*Math.sqrt(K*H)),V=Y-X,M=w8(Math.sqrt(K/H)),D=Math.abs(V)<5;Z||(Z=D?E5.restSpeed.granular:E5.restSpeed.default),q||(q=D?E5.restDelta.granular:E5.restDelta.default);let N,O,I,k,T,A;if(F<1)I=LU(M,F),k=(L+F*M*V)/I,N=(C)=>{let y=Math.exp(-F*M*C);return Y-y*(k*Math.sin(I*C)+V*Math.cos(I*C))},T=F*M*k+V*I,A=F*M*V-k*I,O=(C)=>{return Math.exp(-F*M*C)*(T*Math.sin(I*C)+A*Math.cos(I*C))};else if(F===1){N=(y)=>Y-Math.exp(-M*y)*(V+(L+M*V)*y);let C=L+M*V;O=(y)=>Math.exp(-M*y)*(M*C*y-L)}else{let C=M*Math.sqrt(F*F-1);N=(P)=>{let h=Math.exp(-F*M*P),l=Math.min(C*P,300);return Y-h*((L+F*M*V)*Math.sinh(l)+C*V*Math.cosh(l))/C};let y=(L+F*M*V)/C,x=F*M*y-V*C,j=F*M*V-y*C;O=(P)=>{let h=Math.exp(-F*M*P),l=Math.min(C*P,300);return h*(x*Math.sinh(l)+j*Math.cosh(l))}}let w={calculatedDuration:_?B||null:null,velocity:(C)=>f5(O(C)),next:(C)=>{if(!_&&F<1){let x=Math.exp(-F*M*C),j=Math.sin(I*C),P=Math.cos(I*C),h=Y-x*(k*j+V*P),l=f5(x*(T*j+A*P));return z.done=Math.abs(l)<=Z&&Math.abs(Y-h)<=q,z.value=z.done?Y:h,z}let y=N(C);if(!_){let x=f5(O(C));z.done=Math.abs(x)<=Z&&Math.abs(Y-y)<=q}else z.done=C>=B;return z.value=z.done?Y:y,z},toString:()=>{let C=Math.min(pJ(w),fz),y=xz((x)=>w.next(C*x).value,C,30);return C+"ms "+y},toTransition:()=>{}};return w}lJ.applyToOptions=($)=>{let J=Jb($,100,lJ);return $.ease=J.ease,$.duration=f5(J.duration),$.type="keyframes",$};var Mi=5;function vz($,J,Q){let Z=Math.max(J-Mi,0);return mZ(Q-$(Z),J-Z)}function $q({keyframes:$,velocity:J=0,power:Q=0.8,timeConstant:Z=325,bounceDamping:q=10,bounceStiffness:X=500,modifyTarget:Y,min:z,max:K,restDelta:W=0.5,restSpeed:H}){let B=$[0],U={done:!1,value:B},_=(A)=>z!==void 0&&AK,L=(A)=>{if(z===void 0)return K;if(K===void 0)return z;return Math.abs(z-A)-F*Math.exp(-A/Z),N=(A)=>M+D(A),O=(A)=>{let w=D(A),C=N(A);U.done=Math.abs(w)<=W,U.value=U.done?M:C},I,k,T=(A)=>{if(!_(U.value))return;I=A,k=lJ({keyframes:[U.value,L(U.value)],velocity:vz(N,A,U.value),damping:q,stiffness:X,restDelta:W,restSpeed:H})};return T(0),{calculatedDuration:null,next:(A)=>{let w=!1;if(!k&&I===void 0)w=!0,O(A),T(A);if(I!==void 0&&A>=I)return k.next(A-I);else return!w&&O(A),U}}}function Di($,J,Q){let Z=[],q=Q||Q6.mix||hz,X=$.length-1;for(let Y=0;YJ[0];if(X===2&&J[0]===J[1])return()=>J[1];let Y=$[0]===$[1];if($[0]>$[X-1])$=[...$].reverse(),J=[...J].reverse();let z=Di(J,Z,q),K=z.length,W=(H)=>{if(Y&&H<$[0])return J[0];let B=0;if(K>1){for(;B<$.length-2;B++)if(H<$[B+1])break}let U=X4($[B],$[B+1],H);return z[B](U)};return Q?(H)=>W(_8($[0],$[X-1],H)):W}function qb($,J){let Q=$[$.length-1];for(let Z=1;Z<=J;Z++){let q=X4(0,J,Z);$.push(b1(Q,1,q))}}function Xb($){let J=[0];return qb(J,$.length-1),J}function Yb($,J){return $.map((Q)=>Q*J)}function Ni($,J){return $.map(()=>J||rZ).splice(0,$.length-1)}function d2({duration:$=300,keyframes:J,times:Q,ease:Z="easeInOut"}){let q=YU(Z)?Z.map(bz):bz(Z),X={done:!1,value:J[0]},Y=Yb(Q&&Q.length===J.length?Q:Xb(J),$),z=Zb(Y,J,{ease:Array.isArray(q)?q:Ni(J,q)});return{calculatedDuration:$,next:(K)=>{return X.value=z(K),X.done=K>=$,X}}}var Oi=($)=>$!==null;function S7($,{repeat:J,repeatType:Q="loop"},Z,q=1){let X=$.filter(Oi),z=q<0||J&&Q!=="loop"&&J%2===1?0:X.length-1;return!z||Z===void 0?X[z]:Z}var Ai={decay:$q,inertia:$q,tween:d2,keyframes:d2,spring:lJ};function gz($){if(typeof $.type==="string")$.type=Ai[$.type]}class p2{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(($)=>{this.resolve=$})}notifyFinished(){this.resolve()}then($,J){return this.finished.then($,J)}}var wi=($)=>$/100;class h7 extends p2{constructor($){super();if(this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{let{motionValue:J}=this.options;if(J&&J.updatedAt!==j5.now())this.tick(j5.now());if(this.isStopped=!0,this.state==="idle")return;this.teardown(),this.options.onStop?.()},this.options=$,this.initAnimation(),this.play(),$.autoplay===!1)this.pause()}initAnimation(){let{options:$}=this;gz($);let{type:J=d2,repeat:Q=0,repeatDelay:Z=0,repeatType:q,velocity:X=0}=$,{keyframes:Y}=$,z=J||d2;if(z!==d2&&typeof Y[0]!=="number")this.mixKeyframes=C9(wi,hz(Y[0],Y[1])),Y=[0,100];let K=z({...$,keyframes:Y});if(q==="mirror")this.mirroredGenerator=z({...$,keyframes:[...Y].reverse(),velocity:-X});if(K.calculatedDuration===null)K.calculatedDuration=pJ(K);let{calculatedDuration:W}=K;this.calculatedDuration=W,this.resolvedDuration=W+Z,this.totalDuration=this.resolvedDuration*(Q+1)-Z,this.generator=K}updateTime($){let J=Math.round($-this.startTime)*this.playbackSpeed;if(this.holdTime!==null)this.currentTime=this.holdTime;else this.currentTime=J}tick($,J=!1){let{generator:Q,totalDuration:Z,mixKeyframes:q,mirroredGenerator:X,resolvedDuration:Y,calculatedDuration:z}=this;if(this.startTime===null)return Q.next(0);let{delay:K=0,keyframes:W,repeat:H,repeatType:B,repeatDelay:U,type:_,onUpdate:L,finalKeyframe:F}=this.options;if(this.speed>0)this.startTime=Math.min(this.startTime,$);else if(this.speed<0)this.startTime=Math.min($-Z/this.speed,this.startTime);if(J)this.currentTime=$;else this.updateTime($);let V=this.currentTime-K*(this.playbackSpeed>=0?1:-1),M=this.playbackSpeed>=0?V<0:V>Z;if(this.currentTime=Math.max(V,0),this.state==="finished"&&this.holdTime===null)this.currentTime=Z;let D=this.currentTime,N=Q;if(H){let T=Math.min(this.currentTime,Z)/Y,A=Math.floor(T),w=T%1;if(!w&&T>=1)w=1;if(w===1&&A--,A=Math.min(A,H+1),Boolean(A%2)){if(B==="reverse"){if(w=1-w,U)w-=U/Y}else if(B==="mirror")N=X}D=_8(0,1,w)*Y}let O;if(M)this.delayState.value=W[0],O=this.delayState;else O=N.next(D);if(q&&!M)O.value=q(O.value);let{done:I}=O;if(!M&&z!==null)I=this.playbackSpeed>=0?this.currentTime>=Z:this.currentTime<=0;let k=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&I);if(k&&_!==$q)O.value=S7(W,this.options,F,this.speed);if(L)L(O.value);if(k)this.finish();return O}then($,J){return this.finished.then($,J)}get duration(){return w8(this.calculatedDuration)}get iterationDuration(){let{delay:$=0}=this.options||{};return this.duration+w8($)}get time(){return w8(this.currentTime)}set time($){if($=f5($),this.currentTime=$,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0)this.holdTime=$;else if(this.driver)this.startTime=this.driver.now()-$/this.playbackSpeed;if(this.driver)this.driver.start(!1);else this.startTime=0,this.state="paused",this.holdTime=$,this.tick($)}getGeneratorVelocity(){let $=this.currentTime;if($<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity($);let J=this.generator.next($).value;return vz((Q)=>this.generator.next(Q).value,$,J)}get speed(){return this.playbackSpeed}set speed($){let J=this.playbackSpeed!==$;if(J&&this.driver)this.updateTime(j5.now());if(this.playbackSpeed=$,J&&this.driver)this.time=w8(this.currentTime)}play(){if(this.isStopped)return;let{driver:$=$b,startTime:J}=this.options;if(!this.driver)this.driver=$((Z)=>this.tick(Z));this.options.onPlay?.();let Q=this.driver.now();if(this.state==="finished")this.updateFinished(),this.startTime=Q;else if(this.holdTime!==null)this.startTime=Q-this.holdTime;else if(!this.startTime)this.startTime=J??Q;if(this.state==="finished"&&this.speed<0)this.startTime+=this.calculatedDuration;this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(j5.now()),this.holdTime=this.currentTime}complete(){if(this.state!=="running")this.play();this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){if(!this.driver)return;this.driver.stop(),this.driver=void 0}sample($){return this.startTime=0,this.tick($,!0)}attachTimeline($){if(this.options.allowFlatten)this.options.type="keyframes",this.options.ease="linear",this.initAnimation();return this.driver?.stop(),$.observe(this)}}function zb($){for(let J=1;J<$.length;J++)$[J]??($[J]=$[J-1])}var l2=($)=>$*180/Math.PI,FU=($)=>{let J=l2(Math.atan2($[1],$[0]));return VU(J)},ki={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:($)=>(Math.abs($[0])+Math.abs($[3]))/2,rotate:FU,rotateZ:FU,skewX:($)=>l2(Math.atan($[1])),skewY:($)=>l2(Math.atan($[2])),skew:($)=>(Math.abs($[1])+Math.abs($[2]))/2},VU=($)=>{if($=$%360,$<0)$+=360;return $},Kb=FU,Gb=($)=>Math.sqrt($[0]*$[0]+$[1]*$[1]),Wb=($)=>Math.sqrt($[4]*$[4]+$[5]*$[5]),Ii={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Gb,scaleY:Wb,scale:($)=>(Gb($)+Wb($))/2,rotateX:($)=>VU(l2(Math.atan2($[6],$[5]))),rotateY:($)=>VU(l2(Math.atan2(-$[2],$[0]))),rotateZ:Kb,rotate:Kb,skewX:($)=>l2(Math.atan($[4])),skewY:($)=>l2(Math.atan($[1])),skew:($)=>(Math.abs($[1])+Math.abs($[4]))/2};function uz($){return $.includes("scale")?1:0}function mz($,J){if(!$||$==="none")return uz(J);let Q=$.match(/^matrix3d\(([-\d.e\s,]+)\)$/u),Z,q;if(Q)Z=Ii,q=Q;else{let z=$.match(/^matrix\(([-\d.e\s,]+)\)$/u);Z=ki,q=z}if(!q)return uz(J);let X=Z[J],Y=q[1].split(",").map(Ti);return typeof X==="function"?X(Y):Y[X]}var Hb=($,J)=>{let{transform:Q="none"}=getComputedStyle($);return mz(Q,J)};function Ti($){return parseFloat($.trim())}var K4=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],G9=(()=>new Set([...K4,"pathRotation"]))();var MU=($)=>$===Y4||$===p0,bi=new Set(["x","y","z"]),ji=K4.filter(($)=>!bi.has($));function Bb($){let J=[];return ji.forEach((Q)=>{let Z=$.getValue(Q);if(Z!==void 0)J.push([Q,Z.get()]),Z.set(Q.startsWith("scale")?1:0)}),J}var i4={width:({x:$},{paddingLeft:J="0",paddingRight:Q="0",boxSizing:Z})=>{let q=$.max-$.min;return Z==="border-box"?q:q-parseFloat(J)-parseFloat(Q)},height:({y:$},{paddingTop:J="0",paddingBottom:Q="0",boxSizing:Z})=>{let q=$.max-$.min;return Z==="border-box"?q:q-parseFloat(J)-parseFloat(Q)},top:($,{top:J})=>parseFloat(J),left:($,{left:J})=>parseFloat(J),bottom:({y:$},{top:J})=>parseFloat(J)+($.max-$.min),right:({x:$},{left:J})=>parseFloat(J)+($.max-$.min),x:($,{transform:J})=>mz(J,"x"),y:($,{transform:J})=>mz(J,"y")};i4.translateX=i4.x;i4.translateY=i4.y;var i2=new Set,DU=!1,NU=!1,OU=!1;function Ub(){if(NU){let $=Array.from(i2).filter((Z)=>Z.needsMeasurement),J=new Set($.map((Z)=>Z.element)),Q=new Map;J.forEach((Z)=>{let q=Bb(Z);if(!q.length)return;Q.set(Z,q),Z.render()}),$.forEach((Z)=>Z.measureInitialState()),J.forEach((Z)=>{Z.render();let q=Q.get(Z);if(q)q.forEach(([X,Y])=>{Z.getValue(X)?.set(Y)})}),$.forEach((Z)=>Z.measureEndState()),$.forEach((Z)=>{if(Z.suspendedScrollY!==void 0)window.scrollTo(0,Z.suspendedScrollY)})}NU=!1,DU=!1,i2.forEach(($)=>$.complete(OU)),i2.clear()}function _b(){i2.forEach(($)=>{if($.readKeyframes(),$.needsMeasurement)NU=!0})}function Lb(){OU=!0,_b(),Ub(),OU=!1}class r2{constructor($,J,Q,Z,q,X=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...$],this.onComplete=J,this.name=Q,this.motionValue=Z,this.element=q,this.isAsync=X}scheduleResolve(){if(this.state="scheduled",this.isAsync){if(i2.add(this),!DU)DU=!0,k1.read(_b),k1.resolveKeyframes(Ub)}else this.readKeyframes(),this.complete()}readKeyframes(){let{unresolvedKeyframes:$,name:J,element:Q,motionValue:Z}=this;if($[0]===null){let q=Z?.get(),X=$[$.length-1];if(q!==void 0)$[0]=q;else if(Q&&J){let Y=Q.readValue(J,X);if(Y!==void 0&&Y!==null)$[0]=Y}if($[0]===void 0)$[0]=X;if(Z&&q===void 0)Z.set($[0])}zb($)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete($=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,$),i2.delete(this)}cancel(){if(this.state==="scheduled")i2.delete(this),this.state="pending"}resume(){if(this.state==="pending")this.scheduleResolve()}}var Fb=($)=>$.startsWith("--");function cz($,J,Q){Fb(J)?$.style.setProperty(J,Q):$.style[J]=Q}var Vb={};function dz($,J){let Q=uZ($);return()=>Vb[J]??Q()}var Mb=dz(()=>window.ScrollTimeline!==void 0,"scrollTimeline");var pz=dz(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch($){return!1}return!0},"linearEasing");var s2=([$,J,Q,Z])=>`cubic-bezier(${$}, ${J}, ${Q}, ${Z})`;var AU={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:s2([0,0.65,0.55,1]),circOut:s2([0.55,0,1,0.45]),backIn:s2([0.31,0.01,0.66,-0.59]),backOut:s2([0.33,1.53,0.69,0.99])};function wU($,J){if(!$)return;else if(typeof $==="function")return pz()?xz($,J):"ease-out";else if(sZ($))return s2($);else if(Array.isArray($))return $.map((Q)=>wU(Q,J)||AU.easeOut);else return AU[$]}function Db($,J,Q,{delay:Z=0,duration:q=300,repeat:X=0,repeatType:Y="loop",ease:z="easeOut",times:K}={},W=void 0){let H={[J]:Q};if(K)H.offset=K;let B=wU(z,q);if(Array.isArray(B))H.easing=B;let U={delay:Z,duration:q,easing:!Array.isArray(B)?B:"linear",fill:"both",iterations:X+1,direction:Y==="reverse"?"alternate":"normal"};if(W)U.pseudoElement=W;return $.animate(H,U)}function lz($){return typeof $==="function"&&"applyToOptions"in $}function Nb({type:$,...J}){if(lz($)&&pz())return $.applyToOptions(J);else J.duration??(J.duration=300),J.ease??(J.ease="easeOut");return J}class Jq extends p2{constructor($){super();if(this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!$)return;let{element:J,name:Q,keyframes:Z,pseudoElement:q,allowFlatten:X=!1,finalKeyframe:Y,onComplete:z}=$;this.isPseudoElement=Boolean(q),this.allowFlatten=X,this.options=$,N6(typeof $.type!=="string",`Mini animate() doesn't support "type" as a string.`,"mini-spring");let K=Nb($);if(this.animation=Db(J,Q,Z,K,q),K.autoplay===!1)this.animation.pause();this.animation.onfinish=()=>{if(this.finishedTime=this.time,!q){let W=S7(Z,this.options,Y,this.speed);if(this.updateMotionValue)this.updateMotionValue(W);cz(J,Q,W),this.animation.cancel()}z?.(),this.notifyFinished()}}play(){if(this.isStopped)return;if(this.manualStartTime=null,this.animation.play(),this.state==="finished")this.updateFinished()}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch($){}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:$}=this;if($==="idle"||$==="finished")return;if(this.updateMotionValue)this.updateMotionValue();else this.commitStyles();if(!this.isPseudoElement)this.cancel()}commitStyles(){let $=this.options?.element;if(!this.isPseudoElement&&$?.isConnected)this.animation.commitStyles?.()}get duration(){let $=this.animation.effect?.getComputedTiming?.().duration||0;return w8(Number($))}get iterationDuration(){let{delay:$=0}=this.options||{};return this.duration+w8($)}get time(){return w8(Number(this.animation.currentTime)||0)}set time($){let J=this.finishedTime!==null;if(this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=f5($),J)this.animation.pause()}get speed(){return this.animation.playbackRate}set speed($){if($<0)this.finishedTime=null;this.animation.playbackRate=$}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime($){this.manualStartTime=this.animation.startTime=$}attachTimeline({timeline:$,rangeStart:J,rangeEnd:Q,observe:Z}){if(this.allowFlatten)this.animation.effect?.updateTiming({easing:"linear"});if(this.animation.onfinish=null,$&&Mb()){if(this.animation.timeline=$,J)this.animation.rangeStart=J;if(Q)this.animation.rangeEnd=Q;return b5}else return Z(this)}}var Ob={anticipate:dZ,backInOut:cZ,circInOut:iZ};function Ei($){return $ in Ob}function Ab($){if(typeof $.ease==="string"&&Ei($.ease))$.ease=Ob[$.ease]}var kU=10;class IU extends Jq{constructor($){Ab($),gz($);super($);if($.startTime!==void 0&&$.autoplay!==!1)this.startTime=$.startTime;this.options=$}updateMotionValue($){let{motionValue:J,onUpdate:Q,onComplete:Z,element:q,...X}=this.options;if(!J)return;if($!==void 0){J.set($);return}let Y=new h7({...X,autoplay:!1}),z=Math.max(kU,j5.now()-this.startTime),K=_8(0,kU,z-kU),W=Y.sample(z).value,{name:H}=this.options;if(q&&H)cz(q,H,W);J.setWithVelocity(Y.sample(Math.max(0,z-K)).value,W,K),Y.stop()}}var TU=($,J)=>{if(J==="zIndex")return!1;if(typeof $==="number"||Array.isArray($))return!0;if(typeof $==="string"&&(L8.test($)||$==="0")&&!$.startsWith("url("))return!0;return!1};function yi($){let J=$[0];if($.length===1)return!0;for(let Q=0;Q<$.length;Q++)if($[Q]!==J)return!0}function wb($,J,Q,Z){let q=$[0];if(q===null)return!1;if(J==="display"||J==="visibility")return!0;let X=$[$.length-1],Y=TU(q,J),z=TU(X,J);if(q4(Y===z,`You are trying to animate ${J} from "${q}" to "${X}". "${Y?X:q}" is not an animatable value.`,"value-not-animatable"),!Y||!z)return!1;return yi($)||(Q==="spring"||lz(Q))&&Z}function Qq($){$.duration=0,$.type="keyframes"}var iz=new Set(["opacity","clipPath","filter","transform"]);var Pi=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function kb($){for(let J=0;J<$.length;J++)if(typeof $[J]==="string"&&Pi.test($[J]))return!0;return!1}var Ri=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),Ci=uZ(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function Ib($){let{motionValue:J,name:Q,repeatDelay:Z,repeatType:q,damping:X,type:Y,keyframes:z}=$;if(!(J?.owner?.current instanceof HTMLElement))return!1;let{onUpdate:W,transformTemplate:H}=J.owner.getProps();return Ci()&&Q&&(iz.has(Q)||Ri.has(Q)&&kb(z))&&(Q!=="transform"||!H)&&!W&&!Z&&q!=="mirror"&&X!==0&&Y!=="inertia"}var Si=40;class bU extends p2{constructor({autoplay:$=!0,delay:J=0,type:Q="keyframes",repeat:Z=0,repeatDelay:q=0,repeatType:X="loop",keyframes:Y,name:z,motionValue:K,element:W,...H}){super();this.stop=()=>{if(this._animation)this._animation.stop(),this.stopTimeline?.();this.keyframeResolver?.cancel()},this.createdAt=j5.now();let B={autoplay:$,delay:J,type:Q,repeat:Z,repeatDelay:q,repeatType:X,name:z,motionValue:K,element:W,...H},U=W?.KeyframeResolver||r2;this.keyframeResolver=new U(Y,(_,L,F)=>this.onKeyframesResolved(_,L,B,!F),z,K,W),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved($,J,Q,Z){this.keyframeResolver=void 0;let{name:q,type:X,velocity:Y,delay:z,isHandoff:K,onUpdate:W}=Q;this.resolvedAt=j5.now();let H=!0;if(!wb($,q,X,Y)){if(H=!1,Q6.instantAnimations||!z)W?.(S7($,Q,J));$[0]=$[$.length-1],Qq(Q),Q.repeat=0}let U={startTime:Z?!this.resolvedAt?this.createdAt:this.resolvedAt-this.createdAt>Si?this.resolvedAt:this.createdAt:void 0,finalKeyframe:J,...Q,keyframes:$},_=H&&!K&&Ib(U),L=U.motionValue?.owner?.current,F;if(_)try{F=new IU({...U,element:L})}catch{F=new h7(U)}else F=new h7(U);if(F.finished.then(()=>{this.notifyFinished()}).catch(b5),this.pendingTimeline)this.stopTimeline=F.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0;this._animation=F}get finished(){if(!this._animation)return this._finished;else return this.animation.finished}then($,J){return this.finished.finally($).then(()=>{})}get animation(){if(!this._animation)this.keyframeResolver?.resume(),Lb();return this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time($){this.animation.time=$}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed($){this.animation.speed=$}get startTime(){return this.animation.startTime}attachTimeline($){if(this._animation)this.stopTimeline=this.animation.attachTimeline($);else this.pendingTimeline=$;return()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){if(this._animation)this.animation.cancel();this.keyframeResolver?.cancel()}}function rz($,J,Q,Z=0,q=1){let X=Array.from($).sort((W,H)=>W.sortNodePosition(H)).indexOf(J),Y=$.size,z=(Y-1)*Z;return typeof Q==="function"?Q(X,Y):q===1?X*Z:z-X*Z}var Tb=30,xi=($)=>{return!isNaN(parseFloat($))},bb={current:void 0};class jb{constructor($,J={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=(Q)=>{let Z=j5.now();if(this.updatedAt!==Z)this.setPrevFrameValue();if(this.prev=this.current,this.setCurrent(Q),this.current!==this.prev){if(this.events.change?.notify(this.current),this.dependents)for(let q of this.dependents)q.dirty()}},this.hasAnimated=!1,this.setCurrent($),this.owner=J.owner}setCurrent($){if(this.current=$,this.updatedAt=j5.now(),this.canTrackVelocity===null&&$!==void 0)this.canTrackVelocity=xi(this.current)}setPrevFrameValue($=this.current){this.prevFrameValue=$,this.prevUpdatedAt=this.updatedAt}onChange($){return this.on("change",$)}on($,J){if(!this.events[$])this.events[$]=new E7;let Q=this.events[$].add(J);if($==="change")return()=>{Q(),k1.read(()=>{if(!this.events.change.getSize())this.stop()})};return Q}clearListeners(){for(let $ in this.events)this.events[$].clear()}attach($,J){this.passiveEffect=$,this.stopPassiveEffect=J}set($){if(!this.passiveEffect)this.updateAndNotify($);else this.passiveEffect($,this.updateAndNotify)}setWithVelocity($,J,Q){this.set(J),this.prev=void 0,this.prevFrameValue=$,this.prevUpdatedAt=this.updatedAt-Q}jump($,J=!0){if(this.updateAndNotify($),this.prev=$,this.prevUpdatedAt=this.prevFrameValue=void 0,J&&this.stop(),this.stopPassiveEffect)this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent($){if(!this.dependents)this.dependents=new Set;this.dependents.add($)}removeDependent($){if(this.dependents)this.dependents.delete($)}get(){if(bb.current)bb.current.push(this);return this.current}getPrevious(){return this.prev}getVelocity(){let $=j5.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||$-this.updatedAt>Tb)return 0;let J=Math.min(this.updatedAt-this.prevUpdatedAt,Tb);return mZ(parseFloat(this.current)-parseFloat(this.prevFrameValue),J)}start($){return this.stop(),new Promise((J)=>{if(this.hasAnimated=!0,this.animation=$(J),this.events.animationStart)this.events.animationStart.notify()}).then(()=>{if(this.events.animationComplete)this.events.animationComplete.notify();this.clearAnimation()})}stop(){if(this.animation){if(this.animation.stop(),this.events.animationCancel)this.events.animationCancel.notify()}this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){if(this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect)this.stopPassiveEffect()}}function S9($,J){return new jb($,J)}function sz($,J){if($?.inherit&&J){let{inherit:Q,...Z}=$;return{...J,...Z}}return $}function iJ($,J){let Q=$?.[J]??$?.default??$;if(Q!==$)return sz(Q,$);return Q}var fi={type:"spring",stiffness:500,damping:25,restSpeed:10},vi=($)=>({type:"spring",stiffness:550,damping:$===0?2*Math.sqrt(550):30,restSpeed:10}),gi={type:"keyframes",duration:0.8},ui={type:"keyframes",ease:[0.25,0.1,0.35,1],duration:0.3},Eb=($,{keyframes:J})=>{if(J.length>2)return gi;else if(G9.has($))return $.startsWith("scale")?vi(J[1]):fi;return ui};var mi=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function yb($){for(let J in $)if(!mi.has(J))return!0;return!1}var o2=($,J,Q,Z={},q,X)=>(Y)=>{let z=iJ(Z,$)||{},K=z.delay||Z.delay||0,{elapsed:W=0}=Z;W=W-f5(K);let H={keyframes:Array.isArray(Q)?Q:[null,Q],ease:"easeOut",velocity:J.getVelocity(),...z,delay:-W,onUpdate:(U)=>{J.set(U),z.onUpdate&&z.onUpdate(U)},onComplete:()=>{Y(),z.onComplete&&z.onComplete()},name:$,motionValue:J,element:X?void 0:q};if(!yb(z))Object.assign(H,Eb($,H));if(H.duration&&(H.duration=f5(H.duration)),H.repeatDelay&&(H.repeatDelay=f5(H.repeatDelay)),H.from!==void 0)H.keyframes[0]=H.from;let B=!1;if(H.type===!1||H.duration===0&&!H.repeatDelay){if(Qq(H),H.delay===0)B=!0}if(Q6.instantAnimations||Q6.skipAnimations||q?.shouldSkipAnimations||z.skipAnimations)B=!0,Qq(H),H.delay=0;if(H.allowFlatten=!z.type&&!z.ease,B&&!X&&J.get()!==void 0){let U=S7(H.keyframes,z);if(U!==void 0){k1.update(()=>{H.onUpdate(U),H.onComplete()});return}}return z.isSync?new h7(H):new bU(H)};var ci=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function di($){let J=ci.exec($);if(!J)return[,];let[,Q,Z,q]=J;return[`--${Q??Z}`,q]}var pi=4;function jU($,J,Q=1){N6(Q<=pi,`Max CSS variable fallback depth detected in property "${$}". This may indicate a circular fallback dependency.`,"max-css-var-depth");let[Z,q]=di($);if(!Z)return;let X=window.getComputedStyle(J).getPropertyValue(Z);if(X){let Y=X.trim();return fZ(Y)?parseFloat(Y):Y}return uJ(q)?jU(q,J,Q+1):q}function Pb($){let J=[{},{}];return $?.values.forEach((Q,Z)=>{J[0][Z]=Q.get(),J[1][Z]=Q.getVelocity()}),J}function n2($,J,Q,Z){if(typeof J==="function"){let[q,X]=Pb(Z);J=J(Q!==void 0?Q:$.custom,q,X)}if(typeof J==="string")J=$.variants&&$.variants[J];if(typeof J==="function"){let[q,X]=Pb(Z);J=J(Q!==void 0?Q:$.custom,q,X)}return J}function R6($,J,Q){let Z=$.getProps();return n2(Z,J,Q!==void 0?Q:Z.custom,$)}var oz=new Set(["width","height","top","left","right","bottom",...K4]);var Zq=($)=>{return Array.isArray($)};function li($,J,Q){if($.hasValue(J))$.getValue(J).set(Q);else $.addValue(J,S9(Q))}function ii($){return Zq($)?$[$.length-1]||0:$}function Rb($,J){let Q=R6($,J),{transitionEnd:Z={},transition:q={},...X}=Q||{};X={...X,...Z};for(let Y in X){let z=ii(X[Y]);li($,Y,z)}}var q5=($)=>Boolean($&&$.getVelocity);function Cb($){return Boolean(q5($)&&$.add)}function rJ($,J){let Q=$.getValue("willChange");if(Cb(Q))return Q.add(J);else if(!Q&&Q6.WillChange){let Z=new Q6.WillChange("auto");$.addValue("willChange",Z),Z.add(J)}}function sJ($){return $.replace(/([A-Z])/g,(J)=>`-${J.toLowerCase()}`)}var Sb="framerAppearId",qq="data-"+sJ(Sb);function nz($){return $.props[qq]}function ri({protectedKeys:$,needsAnimating:J},Q){let Z=$.hasOwnProperty(Q)&&J[Q]!==!0;return J[Q]=!1,Z}function az($,J,{delay:Q=0,transitionOverride:Z,type:q}={}){let{transition:X,transitionEnd:Y,...z}=J,K=$.getDefaultTransition();X=X?sz(X,K):K;let W=X?.reduceMotion,H=X?.skipAnimations;if(Z)X=Z;let B=[],U=q&&$.animationState&&$.animationState.getState()[q],_=X?.path;if(_)_.animateVisualElement($,z,X,Q,B);for(let L in z){let F=$.getValue(L,$.latestValues[L]??null),V=z[L];if(V===void 0||U&&ri(U,L))continue;let M={delay:Q,...iJ(X||{},L)};if(H)M.skipAnimations=!0;let D=F.get();if(D!==void 0&&!F.isAnimating()&&!Array.isArray(V)&&V===D&&!M.velocity){k1.update(()=>F.set(V));continue}let N=!1;if(window.MotionHandoffAnimation){let k=nz($);if(k){let T=window.MotionHandoffAnimation(k,L,k1);if(T!==null)M.startTime=T,N=!0}}rJ($,L);let O=W??$.shouldReduceMotion;F.start(o2(L,F,V,O&&oz.has(L)?{type:!1}:M,$,N));let I=F.animation;if(I)B.push(I)}if(Y){let L=()=>k1.update(()=>{Y&&Rb($,Y)});if(B.length)Promise.all(B).then(L);else L()}return B}function tz($,J,Q={}){let Z=R6($,J,Q.type==="exit"?$.presenceContext?.custom:void 0),{transition:q=$.getDefaultTransition()||{}}=Z||{};if(Q.transitionOverride)q=Q.transitionOverride;let X=Z?()=>Promise.all(az($,Z,Q)):()=>Promise.resolve(),Y=$.variantChildren&&$.variantChildren.size?(K=0)=>{let{delayChildren:W=0,staggerChildren:H,staggerDirection:B}=q;return si($,J,K,W,H,B,Q)}:()=>Promise.resolve(),{when:z}=q;if(z){let[K,W]=z==="beforeChildren"?[X,Y]:[Y,X];return K().then(()=>W())}else return Promise.all([X(),Y(Q.delay)])}function si($,J,Q=0,Z=0,q=0,X=1,Y){let z=[];for(let K of $.variantChildren)K.notify("AnimationStart",J),z.push(tz(K,J,{...Y,delay:Q+(typeof Z==="function"?0:Z)+rz($.variantChildren,K,Z,q,X)}).then(()=>K.notify("AnimationComplete",J)));return Promise.all(z)}function hb($,J,Q={}){$.notify("AnimationStart",J);let Z;if(Array.isArray(J)){let q=J.map((X)=>tz($,X,Q));Z=Promise.all(q)}else if(typeof J==="string")Z=tz($,J,Q);else{let q=typeof J==="function"?R6($,J,Q.custom):J;Z=Promise.all(az($,q,Q))}return Z.then(()=>{$.notify("AnimationComplete",J)})}var xb={test:($)=>$==="auto",parse:($)=>$};var ez=($)=>(J)=>J.test($);var EU=[Y4,p0,c8,K9,WU,GU,xb],yU=($)=>EU.find(ez($));function fb($){if(typeof $==="number")return $===0;else if($!==null)return $==="none"||$==="0"||gZ($);else return!0}var oi=new Set(["brightness","contrast","saturate","opacity"]);function ni($){let[J,Q]=$.slice(0,-1).split("(");if(J==="drop-shadow")return $;let[Z]=Q.match(mJ)||[];if(!Z)return $;let q=Q.replace(Z,""),X=oi.has(J)?1:0;if(Z!==Q)X*=100;return J+"("+X+q+")"}var ai=/\b([a-z-]*)\(.*?\)/gu,Xq={...L8,getAnimatableNone:($)=>{let J=$.match(ai);return J?J.map(ni).join(" "):$}};var Yq={...L8,getAnimatableNone:($)=>{let J=L8.parse($);return L8.createTransformer($)(J.map((Z)=>typeof Z==="number"?0:typeof Z==="object"?{...Z,alpha:1}:Z))}};var PU={...Y4,transform:Math.round};var vb={rotate:K9,pathRotation:K9,rotateX:K9,rotateY:K9,rotateZ:K9,scale:aZ,scaleX:aZ,scaleY:aZ,scaleZ:aZ,skew:K9,skewX:K9,skewY:K9,distance:p0,translateX:p0,translateY:p0,translateZ:p0,x:p0,y:p0,z:p0,perspective:p0,transformPerspective:p0,opacity:l4,originX:Rz,originY:Rz,originZ:p0};var a2={borderWidth:p0,borderTopWidth:p0,borderRightWidth:p0,borderBottomWidth:p0,borderLeftWidth:p0,borderRadius:p0,borderTopLeftRadius:p0,borderTopRightRadius:p0,borderBottomRightRadius:p0,borderBottomLeftRadius:p0,width:p0,maxWidth:p0,height:p0,maxHeight:p0,top:p0,right:p0,bottom:p0,left:p0,inset:p0,insetBlock:p0,insetBlockStart:p0,insetBlockEnd:p0,insetInline:p0,insetInlineStart:p0,insetInlineEnd:p0,padding:p0,paddingTop:p0,paddingRight:p0,paddingBottom:p0,paddingLeft:p0,paddingBlock:p0,paddingBlockStart:p0,paddingBlockEnd:p0,paddingInline:p0,paddingInlineStart:p0,paddingInlineEnd:p0,margin:p0,marginTop:p0,marginRight:p0,marginBottom:p0,marginLeft:p0,marginBlock:p0,marginBlockStart:p0,marginBlockEnd:p0,marginInline:p0,marginInlineStart:p0,marginInlineEnd:p0,fontSize:p0,backgroundPositionX:p0,backgroundPositionY:p0,...vb,zIndex:PU,fillOpacity:l4,strokeOpacity:l4,numOctaves:PU};var ti={...a2,color:N5,backgroundColor:N5,outlineColor:N5,fill:N5,stroke:N5,borderColor:N5,borderTopColor:N5,borderRightColor:N5,borderBottomColor:N5,borderLeftColor:N5,filter:Xq,WebkitFilter:Xq,mask:Yq,WebkitMask:Yq},$K=($)=>ti[$];var ei=new Set([Xq,Yq]);function JK($,J){let Q=$K($);if(!ei.has(Q))Q=L8;return Q.getAnimatableNone?Q.getAnimatableNone(J):void 0}var $r=new Set(["auto","none","0"]);function gb($,J,Q){let Z=0,q=void 0;while(Z<$.length&&!q){let X=$[Z];if(typeof X==="string"&&!$r.has(X)&&C7(X).values.length)q=$[Z];Z++}if(q&&Q)for(let X of J)$[X]=JK(Q,q)}class RU extends r2{constructor($,J,Q,Z,q){super($,J,Q,Z,q,!0)}readKeyframes(){let{unresolvedKeyframes:$,element:J,name:Q}=this;if(!J||!J.current)return;super.readKeyframes();for(let W=0;W<$.length;W++){let H=$[W];if(typeof H==="string"){if(H=H.trim(),uJ(H)){let B=jU(H,J.current);if(B!==void 0)$[W]=B;if(W===$.length-1)this.finalKeyframe=H}}}if(this.resolveNoneKeyframes(),!oz.has(Q)||$.length!==2)return;let[Z,q]=$,X=yU(Z),Y=yU(q),z=zU(Z),K=zU(q);if(z!==K&&i4[Q]){this.needsMeasurement=!0;return}if(X===Y)return;if(MU(X)&&MU(Y))for(let W=0;W<$.length;W++){let H=$[W];if(typeof H==="string")$[W]=parseFloat(H)}else if(i4[Q])this.needsMeasurement=!0}resolveNoneKeyframes(){let{unresolvedKeyframes:$,name:J}=this,Q=[];for(let Z=0;Z<$.length;Z++)if($[Z]===null||fb($[Z]))Q.push(Z);if(Q.length)gb($,Q,J)}measureInitialState(){let{element:$,unresolvedKeyframes:J,name:Q}=this;if(!$||!$.current)return;if(Q==="height")this.suspendedScrollY=window.pageYOffset;this.measuredOrigin=i4[Q]($.measureViewportBox(),window.getComputedStyle($.current)),J[0]=this.measuredOrigin;let Z=J[J.length-1];if(Z!==void 0)$.getValue(Q,Z).jump(Z,!1)}measureEndState(){let{element:$,name:J,unresolvedKeyframes:Q}=this;if(!$||!$.current)return;let Z=$.getValue(J);Z&&Z.jump(this.measuredOrigin,!1);let q=Q.length-1,X=Q[q];if(Q[q]=i4[J]($.measureViewportBox(),window.getComputedStyle($.current)),X!==null&&this.finalKeyframe===void 0)this.finalKeyframe=X;if(this.removedTransforms?.length)this.removedTransforms.forEach(([Y,z])=>{$.getValue(Y).set(z)});this.resolveNoneKeyframes()}}var zq=["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"];function QK($,J,Q){if($==null)return[];if($ instanceof EventTarget)return[$];else if(typeof $==="string"){let Z=document;if(J)Z=J.current;let q=Q?.[$]??Z.querySelectorAll($);return q?Array.from(q):[]}return Array.from($).filter((Z)=>Z!=null)}var Kq=($,J)=>{return J&&typeof $==="number"?J.transform($):$};function ub($){return vZ($)&&"offsetHeight"in $&&!("ownerSVGElement"in $)}var{schedule:t2,cancel:Jr}=jz(queueMicrotask,!1);var W9={x:!1,y:!1};function ZK(){return W9.x||W9.y}function CU($){if($==="x"||$==="y")if(W9[$])return null;else return W9[$]=!0,()=>{W9[$]=!1};else if(W9.x||W9.y)return null;else return W9.x=W9.y=!0,()=>{W9.x=W9.y=!1}}function qK($,J){let Q=QK($),Z=new AbortController,q={passive:!0,...J,signal:Z.signal};return[Q,q,()=>Z.abort()]}function Qr($){return!($.pointerType==="touch"||ZK())}function SU($,J,Q={}){let[Z,q,X]=qK($,Q);return Z.forEach((Y)=>{let z=!1,K=!1,W,H=()=>{Y.removeEventListener("pointerleave",L)},B=(V)=>{if(W)W(V),W=void 0;H()},U=(V)=>{if(z=!1,window.removeEventListener("pointerup",U),window.removeEventListener("pointercancel",U),K)K=!1,B(V)},_=()=>{z=!0,window.addEventListener("pointerup",U,q),window.addEventListener("pointercancel",U,q)},L=(V)=>{if(V.pointerType==="touch")return;if(z){K=!0;return}B(V)},F=(V)=>{if(!Qr(V))return;K=!1;let M=J(Y,V);if(typeof M!=="function")return;W=M,Y.addEventListener("pointerleave",L,q)};Y.addEventListener("pointerenter",F,q),Y.addEventListener("pointerdown",_,q)}),X}var hU=($,J)=>{if(!J)return!1;else if($===J)return!0;else return hU($,J.parentElement)};var e2=($)=>{if($.pointerType==="mouse")return typeof $.button!=="number"||$.button<=0;else return $.isPrimary!==!1};var Zr=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function xU($){return Zr.has($.tagName)||$.isContentEditable===!0}var qr=new Set(["INPUT","SELECT","TEXTAREA"]);function fU($){return qr.has($.tagName)||$.isContentEditable===!0}var oJ=new WeakSet;function mb($){return(J)=>{if(J.key!=="Enter")return;$(J)}}function vU($,J){$.dispatchEvent(new PointerEvent("pointer"+J,{isPrimary:!0,bubbles:!0}))}var cb=($,J)=>{let Q=$.currentTarget;if(!Q)return;let Z=mb(()=>{if(oJ.has(Q))return;vU(Q,"down");let q=mb(()=>{vU(Q,"up")}),X=()=>vU(Q,"cancel");Q.addEventListener("keyup",q,J),Q.addEventListener("blur",X,J)});Q.addEventListener("keydown",Z,J),Q.addEventListener("blur",()=>Q.removeEventListener("keydown",Z),J)};function db($){return e2($)&&!ZK()}var pb=new WeakSet;function gU($,J,Q={}){let[Z,q,X]=qK($,Q),Y=(z)=>{let K=z.currentTarget;if(!db(z))return;if(pb.has(z))return;if(oJ.add(K),Q.stopPropagation)pb.add(z);let W=J(K,z),H={...q,capture:!0},B=(L,F)=>{if(window.removeEventListener("pointerup",U,H),window.removeEventListener("pointercancel",_,H),oJ.has(K))oJ.delete(K);if(!db(L))return;if(typeof W==="function")W(L,{success:F})},U=(L)=>{B(L,K===window||K===document||Q.useGlobalTarget||hU(K,L.target))},_=(L)=>{B(L,!1)};window.addEventListener("pointerup",U,H),window.addEventListener("pointercancel",_,H)};return Z.forEach((z)=>{if((Q.useGlobalTarget?window:z).addEventListener("pointerdown",Y,q),ub(z)){if(z.addEventListener("focus",(W)=>cb(W,q)),!xU(z)&&!z.hasAttribute("tabindex"))z.tabIndex=0}}),X}function nJ($){return vZ($)&&"ownerSVGElement"in $}var XK=new WeakMap,YK,lb=($,J,Q)=>(Z,q)=>{if(q&&q[0])return q[0][$+"Size"];else if(nJ(Z)&&"getBBox"in Z)return Z.getBBox()[J];else return Z[Q]},Xr=lb("inline","width","offsetWidth"),Yr=lb("block","height","offsetHeight");function zr({target:$,borderBoxSize:J}){XK.get($)?.forEach((Q)=>{Q($,{get width(){return Xr($,J)},get height(){return Yr($,J)}})})}function Kr($){$.forEach(zr)}function Gr(){if(typeof ResizeObserver>"u")return;YK=new ResizeObserver(Kr)}function ib($,J){if(!YK)Gr();let Q=QK($);return Q.forEach((Z)=>{let q=XK.get(Z);if(!q)q=new Set,XK.set(Z,q);q.add(J),YK?.observe(Z)}),()=>{Q.forEach((Z)=>{let q=XK.get(Z);if(q?.delete(J),!q?.size)YK?.unobserve(Z)})}}var zK=new Set,aJ;function Wr(){aJ=()=>{let $={get width(){return window.innerWidth},get height(){return window.innerHeight}};zK.forEach((J)=>J($))},window.addEventListener("resize",aJ)}function rb($){if(zK.add($),!aJ)Wr();return()=>{if(zK.delete($),!zK.size&&typeof aJ==="function")window.removeEventListener("resize",aJ),aJ=void 0}}function KK($,J){return typeof $==="function"?rb($):ib($,J)}var $$={value:null,addProjectionMetrics:null};function sb($){return nJ($)&&$.tagName==="svg"}var Hr=[...EU,N5,L8],ob=($)=>Hr.find(ez($));var uU=()=>({translate:0,scale:1,origin:0,originPoint:0}),x7=()=>({x:uU(),y:uU()}),mU=()=>({min:0,max:0}),O5=()=>({x:mU(),y:mU()});var nb=new WeakMap;function r4($){return $!==null&&typeof $==="object"&&typeof $.start==="function"}function G4($){return typeof $==="string"||Array.isArray($)}var GK=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Gq=["initial",...GK];function f7($){return r4($.animate)||Gq.some((J)=>G4($[J]))}function Wq($){return Boolean(f7($)||$.variants)}function ab($,J,Q){for(let Z in J){let q=J[Z],X=Q[Z];if(q5(q))$.addValue(Z,q);else if(q5(X))$.addValue(Z,S9(q,{owner:$}));else if(X!==q)if($.hasValue(Z)){let Y=$.getValue(Z);if(Y.liveStyle===!0)Y.jump(q);else if(!Y.hasAnimated)Y.set(q)}else{let Y=$.getStaticValue(Z);$.addValue(Z,S9(Y!==void 0?Y:q,{owner:$}))}}for(let Z in Q)if(J[Z]===void 0)$.removeValue(Z);return J}var Hq={current:null},WK={current:!1};var Br=typeof window<"u";function tb(){if(WK.current=!0,!Br)return;if(window.matchMedia){let $=window.matchMedia("(prefers-reduced-motion)"),J=()=>Hq.current=$.matches;$.addEventListener("change",J),J()}else Hq.current=!1}var eb=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],HK={};function Bq($){HK=$}function cU(){return HK}class BK{scrapeMotionValuesFromProps($,J,Q){return{}}constructor({parent:$,props:J,presenceContext:Q,reducedMotionConfig:Z,skipAnimations:q,blockInitialAnimation:X,visualState:Y},z={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=r2,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{if(!this.current)return;this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection)},this.renderScheduledAt=0,this.scheduleRender=()=>{let U=j5.now();if(this.renderScheduledAtthis.bindToMotionValue(Q,J)),this.reducedMotionConfig==="never")this.shouldReduceMotion=!1;else if(this.reducedMotionConfig==="always")this.shouldReduceMotion=!0;else{if(!WK.current)tb();this.shouldReduceMotion=Hq.current}this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),O6(this.notifyUpdate),O6(this.render),this.valueSubscriptions.forEach(($)=>$()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(let $ in this.events)this.events[$].clear();for(let $ in this.features){let J=this.features[$];if(J)J.unmount(),J.isMounted=!1}this.current=null}addChild($){this.children.add($),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add($)}removeChild($){this.children.delete($),this.enteringChildren&&this.enteringChildren.delete($)}bindToMotionValue($,J){if(this.valueSubscriptions.has($))this.valueSubscriptions.get($)();if(J.accelerate&&iz.has($)&&this.current instanceof HTMLElement){let{factory:X,keyframes:Y,times:z,ease:K,duration:W}=J.accelerate,H=new Jq({element:this.current,name:$,keyframes:Y,times:z,ease:K,duration:f5(W)}),B=X(H);this.valueSubscriptions.set($,()=>{B(),H.cancel()});return}let Q=G9.has($);if(Q&&this.onBindTransform)this.onBindTransform();let Z=J.on("change",(X)=>{if(this.latestValues[$]=X,this.props.onUpdate&&k1.preRender(this.notifyUpdate),Q&&this.projection)this.projection.isTransformDirty=!0;this.scheduleRender()}),q;if(typeof window<"u"&&window.MotionCheckAppearSync)q=window.MotionCheckAppearSync(this,$,J);this.valueSubscriptions.set($,()=>{if(Z(),q)q()})}sortNodePosition($){if(!this.current||!this.sortInstanceNodePosition||this.type!==$.type)return 0;return this.sortInstanceNodePosition(this.current,$.current)}updateFeatures(){let $="animation";for($ in HK){let J=HK[$];if(!J)continue;let{isEnabled:Q,Feature:Z}=J;if(!this.features[$]&&Z&&Q(this.props))this.features[$]=new Z(this);if(this.features[$]){let q=this.features[$];if(q.isMounted)q.update();else q.mount(),q.isMounted=!0}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):O5()}getStaticValue($){return this.latestValues[$]}setStaticValue($,J){this.latestValues[$]=J}update($,J){if($.transformTemplate||this.props.transformTemplate)this.scheduleRender();this.prevProps=this.props,this.props=$,this.prevPresenceContext=this.presenceContext,this.presenceContext=J;for(let Q=0;QJ.variantChildren.delete($)}addValue($,J){let Q=this.values.get($);if(J!==Q){if(Q)this.removeValue($);this.bindToMotionValue($,J),this.values.set($,J),this.latestValues[$]=J.get()}}removeValue($){this.values.delete($);let J=this.valueSubscriptions.get($);if(J)J(),this.valueSubscriptions.delete($);delete this.latestValues[$],this.removeValueFromRenderState($,this.renderState)}hasValue($){return this.values.has($)}getValue($,J){if(this.props.values&&this.props.values[$])return this.props.values[$];let Q=this.values.get($);if(Q===void 0&&J!==void 0)Q=S9(J===null?void 0:J,{owner:this}),this.addValue($,Q);return Q}readValue($,J){let Q=this.latestValues[$]!==void 0||!this.current?this.latestValues[$]:this.getBaseTargetFromProps(this.props,$)??this.readValueFromInstance(this.current,$,this.options);if(Q!==void 0&&Q!==null){if(typeof Q==="string"&&(fZ(Q)||gZ(Q)))Q=parseFloat(Q);else if(!ob(Q)&&L8.test(J))Q=JK($,J);this.setBaseTarget($,q5(Q)?Q.get():Q)}return q5(Q)?Q.get():Q}setBaseTarget($,J){this.baseTarget[$]=J}getBaseTarget($){let{initial:J}=this.props,Q;if(typeof J==="string"||typeof J==="object"){let q=n2(this.props,J,this.presenceContext?.custom);if(q)Q=q[$]}if(J&&Q!==void 0)return Q;let Z=this.getBaseTargetFromProps(this.props,$);if(Z!==void 0&&!q5(Z))return Z;return this.initialValues[$]!==void 0&&Q===void 0?void 0:this.baseTarget[$]}on($,J){if(!this.events[$])this.events[$]=new E7;return this.events[$].add(J)}notify($,...J){if(this.events[$])this.events[$].notify(...J)}scheduleRenderMicrotask(){t2.render(this.render)}}class Uq extends BK{constructor(){super(...arguments);this.KeyframeResolver=RU}sortInstanceNodePosition($,J){return $.compareDocumentPosition(J)&2?1:-1}getBaseTargetFromProps($,J){let Q=$.style;return Q?Q[J]:void 0}removeValueFromRenderState($,{vars:J,style:Q}){delete J[$],delete Q[$]}handleChildMotionValue(){if(this.childSubscription)this.childSubscription(),delete this.childSubscription;let{children:$}=this.props;if(q5($))this.childSubscription=$.on("change",(J)=>{if(this.current)this.current.textContent=`${J}`})}}class k8{constructor($){this.isMounted=!1,this.node=$}update(){}}function _q({top:$,left:J,right:Q,bottom:Z}){return{x:{min:J,max:Q},y:{min:$,max:Z}}}function dU({x:$,y:J}){return{top:J.min,right:$.max,bottom:J.max,left:$.min}}function pU($,J){if(!J)return $;let Q=J({x:$.left,y:$.top}),Z=J({x:$.right,y:$.bottom});return{top:Q.y,left:Q.x,bottom:Z.y,right:Z.x}}function lU($){return $===void 0||$===1}function UK({scale:$,scaleX:J,scaleY:Q}){return!lU($)||!lU(J)||!lU(Q)}function s4($){return UK($)||iU($)||$.z||$.rotate||$.rotateX||$.rotateY||$.skewX||$.skewY}function iU($){return $j($.x)||$j($.y)}function $j($){return $&&$!=="0%"}function Lq($,J,Q){let Z=$-Q,q=J*Z;return Q+q}function Jj($,J,Q,Z,q){if(q!==void 0)$=Lq($,q,Z);return Lq($,Q,Z)+J}function rU($,J=0,Q=1,Z,q){$.min=Jj($.min,J,Q,Z,q),$.max=Jj($.max,J,Q,Z,q)}function sU($,{x:J,y:Q}){rU($.x,J.translate,J.scale,J.originPoint),rU($.y,Q.translate,Q.scale,Q.originPoint)}var Qj=0.999999999999,Zj=1.0000000000001;function Yj($,J,Q,Z=!1){let q=Q.length;if(!q)return;J.x=J.y=1;let X,Y;for(let z=0;zQj)J.x=1;if(J.yQj)J.y=1}function H9($,J){$.min+=J,$.max+=J}function qj($,J,Q,Z,q=0.5){let X=b1($.min,$.max,q);rU($,J,Q,X,Z)}function Xj($,J){if(typeof $==="string")return parseFloat($)/100*(J.max-J.min);return $}function Fq($,J,Q){let Z=Q??$;qj($.x,Xj(J.x,Z.x),J.scaleX,J.scale,J.originX),qj($.y,Xj(J.y,Z.y),J.scaleY,J.scale,J.originY)}function _K($,J){return _q(pU($.getBoundingClientRect(),J))}function oU($,J,Q){let Z=_K($,Q),{scroll:q}=J;if(q)H9(Z.x,q.offset.x),H9(Z.y,q.offset.y);return Z}var Ur={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},_r=K4.length;function zj($,J,Q){let Z="",q=!0;for(let Y=0;Y<_r;Y++){let z=K4[Y],K=$[z];if(K===void 0)continue;let W=!0;if(typeof K==="number")W=K===(z.startsWith("scale")?1:0);else{let H=parseFloat(K);W=z.startsWith("scale")?H===1:H===0}if(!W||Q){let H=Kq(K,a2[z]);if(!W){q=!1;let B=Ur[z]||z;Z+=`${B}(${H}) `}if(Q)J[z]=H}}let X=$.pathRotation;if(X)q=!1,Z+=`rotate(${Kq(X,a2.pathRotation)}) `;if(Z=Z.trim(),Q)Z=Q(J,q?"":Z);else if(q)Z="none";return Z}function J$($,J,Q){let{style:Z,vars:q,transformOrigin:X}=$,Y=!1,z=!1;for(let K in J){let W=J[K];if(G9.has(K)){Y=!0;continue}else if(yz(K)){q[K]=W;continue}else{let H=Kq(W,a2[K]);if(K.startsWith("origin"))z=!0,X[K]=H;else Z[K]=H}}if(!J.transform){if(Y||Q)Z.transform=zj(J,$.transform,Q);else if(Z.transform)Z.transform="none"}if(z){let{originX:K="50%",originY:W="50%",originZ:H=0}=X;Z.transformOrigin=`${K} ${W} ${H}`}}function LK($,{style:J,vars:Q},Z,q){let X=$.style,Y;for(Y in J)X[Y]=J[Y];q?.applyProjectionStyles(X,Z);for(Y in Q)X.setProperty(Y,Q[Y])}function Kj($,J){if(J.max===J.min)return 0;return $/(J.max-J.min)*100}var tJ={correct:($,J)=>{if(!J.target)return $;if(typeof $==="string")if(p0.test($))$=parseFloat($);else return $;let Q=Kj($,J.target.x),Z=Kj($,J.target.y);return`${Q}% ${Z}%`}};var Gj={correct:($,{treeScale:J,projectionDelta:Q})=>{let Z=$,q=L8.parse($);if(q.length>5)return Z;let X=L8.createTransformer($),Y=typeof q[0]!=="number"?1:0,z=Q.x.scale*J.x,K=Q.y.scale*J.y;q[0+Y]/=z,q[1+Y]/=K;let W=b1(z,K,0.5);if(typeof q[2+Y]==="number")q[2+Y]/=W;if(typeof q[3+Y]==="number")q[3+Y]/=W;return X(q)}};var Vq={borderRadius:{...tJ,applyTo:[...zq]},borderTopLeftRadius:tJ,borderTopRightRadius:tJ,borderBottomLeftRadius:tJ,borderBottomRightRadius:tJ,boxShadow:Gj};function Mq($,{layout:J,layoutId:Q}){return G9.has($)||$.startsWith("origin")||(J||Q!==void 0)&&(!!Vq[$]||$==="opacity")}function Q$($,J,Q){let Z=$.style,q=J?.style,X={};if(!Z)return X;for(let Y in Z)if(q5(Z[Y])||q&&q5(q[Y])||Mq(Y,$)||Q?.getValue(Y)?.liveStyle!==void 0)X[Y]=Z[Y];return X}function Lr($){return window.getComputedStyle($)}class FK extends Uq{constructor(){super(...arguments);this.type="html",this.renderInstance=LK}readValueFromInstance($,J){if(G9.has(J))return this.projection?.isProjecting?uz(J):Hb($,J);else{let Q=Lr($),Z=(yz(J)?Q.getPropertyValue(J):Q[J])||0;return typeof Z==="string"?Z.trim():Z}}measureInstanceViewportBox($,{transformPagePoint:J}){return _K($,J)}build($,J,Q){J$($,J,Q.transformTemplate)}scrapeMotionValuesFromProps($,J,Q){return Q$($,J,Q)}}var Fr={offset:"stroke-dashoffset",array:"stroke-dasharray"},Vr={offset:"strokeDashoffset",array:"strokeDasharray"};function Wj($,J,Q=1,Z=0,q=!0){$.pathLength=1;let X=q?Fr:Vr;$[X.offset]=`${-Z}`,$[X.array]=`${J} ${Q}`}var Mr=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function Dq($,{attrX:J,attrY:Q,attrScale:Z,pathLength:q,pathSpacing:X=1,pathOffset:Y=0,...z},K,W,H){if(J$($,z,W),K){if($.style.viewBox)$.attrs.viewBox=$.style.viewBox;return}$.attrs=$.style,$.style={};let{attrs:B,style:U}=$;if(B.transform)U.transform=B.transform,delete B.transform;if(U.transform||B.transformOrigin)U.transformOrigin=B.transformOrigin??"50% 50%",delete B.transformOrigin;if(U.transform)U.transformBox=H?.transformBox??"fill-box",delete B.transformBox;for(let _ of Mr)if(B[_]!==void 0)U[_]=B[_],delete B[_];if(J!==void 0)B.x=J;if(Q!==void 0)B.y=Q;if(Z!==void 0)B.scale=Z;if(q!==void 0)Wj(B,q,X,Y,!1)}var VK=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);var Nq=($)=>typeof $==="string"&&$.toLowerCase()==="svg";function Hj($,J,Q,Z){LK($,J,void 0,Z);for(let q in J.attrs)$.setAttribute(!VK.has(q)?sJ(q):q,J.attrs[q])}function Oq($,J,Q){let Z=Q$($,J,Q);for(let q in $)if(q5($[q])||q5(J[q])){let X=K4.indexOf(q)!==-1?"attr"+q.charAt(0).toUpperCase()+q.substring(1):q;Z[X]=$[q]}return Z}class MK extends Uq{constructor(){super(...arguments);this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=O5}getBaseTargetFromProps($,J){return $[J]}readValueFromInstance($,J){if(G9.has(J)){let Q=$K(J);return Q?Q.default||0:0}return J=!VK.has(J)?sJ(J):J,$.getAttribute(J)}scrapeMotionValuesFromProps($,J,Q){return Oq($,J,Q)}build($,J,Q){Dq($,J,this.isSVGTag,Q.transformTemplate,Q.style)}renderInstance($,J,Q,Z){Hj($,J,Q,Z)}mount($){this.isSVGTag=Nq($.tagName),super.mount($)}}var Dr=Gq.length;function nU($){if(!$)return;if(!$.isControllingVariants){let Q=$.parent?nU($.parent)||{}:{};if($.props.initial!==void 0)Q.initial=$.props.initial;return Q}let J={};for(let Q=0;Q{return Promise.all(J.map(({animation:Q,options:Z})=>hb($,Q,Z)))}}function tU($){let J=Ar($),Q=Bj(),Z=!0,q=!1,X=(W)=>(H,B)=>{let U=R6($,B,W==="exit"?$.presenceContext?.custom:void 0);if(U){let{transition:_,transitionEnd:L,...F}=U;H={...H,...F,...L}}return H};function Y(W){J=W($)}function z(W){let{props:H}=$,B=nU($.parent)||{},U=[],_=new Set,L={},F=1/0;for(let M=0;MF&&I,C=!1,y=Array.isArray(O)?O:[O],x=y.reduce(X(D),{});if(k===!1)x={};let{prevResolvedValues:j={}}=N,P={...j,...x},h=(S)=>{if(w=!0,_.has(S))C=!0,_.delete(S);N.needsAnimating[S]=!0;let i=$.getValue(S);if(i)i.liveStyle=!1};for(let S in P){let i=x[S],J0=j[S];if(L.hasOwnProperty(S))continue;let K0=!1;if(Zq(i)&&Zq(J0))K0=!aU(i,J0)||A;else K0=i!==J0;if(K0)if(i!==void 0&&i!==null)h(S);else _.add(S);else if(i!==void 0&&_.has(S))h(S);else N.protectedKeys[S]=!0}if(N.prevProp=O,N.prevResolvedValues=x,N.isActive)L={...L,...x};if((Z||q)&&$.blockInitialAnimation)w=!1;let l=T&&A;if(w&&(!l||C))U.push(...y.map((S)=>{let i={type:D};if(typeof S==="string"&&(Z||q)&&!l&&$.manuallyAnimateOnMount&&$.parent){let{parent:J0}=$,K0=R6(J0,S);if(J0.enteringChildren&&K0){let{delayChildren:e}=K0.transition||{};i.delay=rz(J0.enteringChildren,$,e)}}return{animation:S,options:i}}))}if(_.size){let M={};if(typeof H.initial!=="boolean"){let D=R6($,Array.isArray(H.initial)?H.initial[0]:H.initial);if(D&&D.transition)M.transition=D.transition}_.forEach((D)=>{let N=$.getBaseTarget(D),O=$.getValue(D);if(O)O.liveStyle=!0;M[D]=N??null}),U.push({animation:M})}let V=Boolean(U.length);if(Z&&(H.initial===!1||H.initial===H.animate)&&!$.manuallyAnimateOnMount)V=!1;return Z=!1,q=!1,V?J(U):Promise.resolve()}function K(W,H){if(Q[W].isActive===H)return Promise.resolve();$.variantChildren?.forEach((U)=>U.animationState?.setActive(W,H)),Q[W].isActive=H;let B=z(W);for(let U in Q)Q[U].protectedKeys={};return B}return{animateChanges:z,setActive:K,setAnimateFunction:Y,getState:()=>Q,reset:()=>{Q=Bj(),q=!0}}}function Uj($,J){if(typeof J==="string")return J!==$;else if(Array.isArray(J))return!aU(J,$);return!1}function Z$($=!1){return{isActive:$,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Bj(){return{animate:Z$(!0),whileInView:Z$(),whileHover:Z$(),whileTap:Z$(),whileDrag:Z$(),whileFocus:Z$(),exit:Z$()}}function DK($,J){$.min=J.min,$.max=J.max}function B9($,J){DK($.x,J.x),DK($.y,J.y)}function eU($,J){$.translate=J.translate,$.scale=J.scale,$.originPoint=J.originPoint,$.origin=J.origin}var _j=0.0001,wr=1-_j,kr=1+_j,Lj=0.01,Ir=0-Lj,Tr=0+Lj;function r5($){return $.max-$.min}function Z_($,J,Q){return Math.abs($-J)<=Q}function $_($,J,Q,Z=0.5){if($.origin=Z,$.originPoint=b1(J.min,J.max,$.origin),$.scale=r5(Q)/r5(J),$.translate=b1(Q.min,Q.max,$.origin)-$.originPoint,$.scale>=wr&&$.scale<=kr||isNaN($.scale))$.scale=1;if($.translate>=Ir&&$.translate<=Tr||isNaN($.translate))$.translate=0}function q$($,J,Q,Z){$_($.x,J.x,Q.x,Z?Z.originX:void 0),$_($.y,J.y,Q.y,Z?Z.originY:void 0)}function J_($,J,Q,Z=0){let q=Z?b1(Q.min,Q.max,Z):Q.min;$.min=q+J.min,$.max=$.min+r5(J)}function q_($,J,Q,Z){J_($.x,J.x,Q.x,Z?.x),J_($.y,J.y,Q.y,Z?.y)}function Q_($,J,Q,Z=0){let q=Z?b1(Q.min,Q.max,Z):Q.min;$.min=J.min-q,$.max=$.min+r5(J)}function eJ($,J,Q,Z){Q_($.x,J.x,Q.x,Z?.x),Q_($.y,J.y,Q.y,Z?.y)}function Fj($,J,Q,Z,q){if($-=J,$=Lq($,1/Q,Z),q!==void 0)$=Lq($,1/q,Z);return $}function br($,J=0,Q=1,Z=0.5,q,X=$,Y=$){if(c8.test(J))J=parseFloat(J),J=b1(Y.min,Y.max,J/100)-Y.min;if(typeof J!=="number")return;let z=b1(X.min,X.max,Z);if($===X)z-=J;$.min=Fj($.min,J,Q,z,q),$.max=Fj($.max,J,Q,z,q)}function Vj($,J,[Q,Z,q],X,Y){br($,J[Q],J[Z],J[q],J.scale,X,Y)}var jr=["x","scaleX","originX"],Er=["y","scaleY","originY"];function X_($,J,Q,Z){Vj($.x,J,jr,Q?Q.x:void 0,Z?Z.x:void 0),Vj($.y,J,Er,Q?Q.y:void 0,Z?Z.y:void 0)}function Mj($){return $.translate===0&&$.scale===1}function Y_($){return Mj($.x)&&Mj($.y)}function Dj($,J){return $.min===J.min&&$.max===J.max}function Oj($,J){return Dj($.x,J.x)&&Dj($.y,J.y)}function Nj($,J){return Math.round($.min)===Math.round(J.min)&&Math.round($.max)===Math.round(J.max)}function z_($,J){return Nj($.x,J.x)&&Nj($.y,J.y)}function K_($){return r5($.x)/r5($.y)}function G_($,J){return $.translate===J.translate&&$.scale===J.scale&&$.originPoint===J.originPoint}function C6($){return[$("x"),$("y")]}function Aj($,J,Q){let Z="",q=$.x.translate/J.x,X=$.y.translate/J.y,Y=Q?.z||0;if(q||X||Y)Z=`translate3d(${q}px, ${X}px, ${Y}px) `;if(J.x!==1||J.y!==1)Z+=`scale(${1/J.x}, ${1/J.y}) `;if(Q){let{transformPerspective:W,rotate:H,pathRotation:B,rotateX:U,rotateY:_,skewX:L,skewY:F}=Q;if(W)Z=`perspective(${W}px) ${Z}`;if(H)Z+=`rotate(${H}deg) `;if(B)Z+=`rotate(${B}deg) `;if(U)Z+=`rotateX(${U}deg) `;if(_)Z+=`rotateY(${_}deg) `;if(L)Z+=`skewX(${L}deg) `;if(F)Z+=`skewY(${F}deg) `}let z=$.x.scale*J.x,K=$.y.scale*J.y;if(z!==1||K!==1)Z+=`scale(${z}, ${K})`;return Z||"none"}var yr=zq.length,wj=($)=>typeof $==="string"?parseFloat($):$,kj=($)=>typeof $==="number"||p0.test($);function Tj($,J,Q,Z,q,X){if(q)$.opacity=b1(0,Q.opacity??1,Pr(Z)),$.opacityExit=b1(J.opacity??1,0,Rr(Z));else if(X)$.opacity=b1(J.opacity??1,Q.opacity??1,Z);for(let Y=0;Y{if(Z<$)return 0;if(Z>J)return 1;return Q(X4($,J,Z))}}function jj($,J,Q){let Z=q5($)?$:S9($);return Z.start(o2("",Z,J,Q)),Z.animation}function W4($,J,Q,Z={passive:!0}){return $.addEventListener(J,Q,Z),()=>$.removeEventListener(J,Q,Z)}var Ej=($,J)=>$.depth-J.depth;class W_{constructor(){this.children=[],this.isDirty=!1}add($){c2(this.children,$),this.isDirty=!0}remove($){j7(this.children,$),this.isDirty=!0}forEach($){this.isDirty&&this.children.sort(Ej),this.isDirty=!1,this.children.forEach($)}}function yj($,J){let Q=j5.now(),Z=({timestamp:q})=>{let X=q-Q;if(X>=J)O6(Z),$(X-J)};return k1.setup(Z,!0),()=>O6(Z)}function X$($){return q5($)?$.get():$}class H_{constructor(){this.members=[]}add($){c2(this.members,$);for(let J=this.members.length-1;J>=0;J--){let Q=this.members[J];if(Q===$||Q===this.lead||Q===this.prevLead)continue;let Z=Q.instance;if((!Z||Z.isConnected===!1)&&!Q.snapshot)j7(this.members,Q),Q.unmount()}$.scheduleRender()}remove($){if(j7(this.members,$),$===this.prevLead)this.prevLead=void 0;if($===this.lead){let J=this.members[this.members.length-1];if(J)this.promote(J)}}relegate($){for(let J=this.members.indexOf($)-1;J>=0;J--){let Q=this.members[J];if(Q.isPresent!==!1&&Q.instance?.isConnected!==!1)return this.promote(Q),!0}return!1}promote($,J){let Q=this.lead;if($===Q)return;if(this.prevLead=Q,this.lead=$,$.show(),Q){Q.updateSnapshot(),$.scheduleRender();let{layoutDependency:Z}=Q.options,{layoutDependency:q}=$.options;if(Z===void 0||Z!==q){if($.resumeFrom=Q,J)Q.preserveOpacity=!0;if(Q.snapshot)$.snapshot=Q.snapshot,$.snapshot.latestValues=Q.animationValues||Q.latestValues;if($.root?.isUpdating)$.isLayoutDirty=!0}if($.options.crossfade===!1)Q.hide()}}exitAnimationComplete(){this.members.forEach(($)=>{$.options.onExitComplete?.(),$.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(($)=>$.instance&&$.scheduleRender(!1))}removeLeadSnapshot(){if(this.lead?.snapshot)this.lead.snapshot=void 0}}var Y$={hasAnimatedSinceResize:!0,hasEverUpdated:!1};var z$={nodes:0,calculatedTargetDeltas:0,calculatedProjections:0},B_=["","X","Y","Z"],Cr=1000,Sr=0;function U_($,J,Q,Z){let{latestValues:q}=J;if(q[$]){if(Q[$]=q[$],J.setStaticValue($,0),Z)Z[$]=0}}function gj($){if($.hasCheckedOptimisedAppear=!0,$.root===$)return;let{visualElement:J}=$.options;if(!J)return;let Q=nz(J);if(window.MotionHasOptimisedAnimation(Q,"transform")){let{layout:q,layoutId:X}=$.options;window.MotionCancelOptimisedAnimation(Q,"transform",k1,!(q||X))}let{parent:Z}=$;if(Z&&!Z.hasCheckedOptimisedAppear)gj(Z)}function NK({attachResizeListener:$,defaultParent:J,measureScroll:Q,checkIsScrollRoot:Z,resetTransform:q}){return class{constructor(Y={},z=J?.()){this.id=Sr++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{if(this.isUpdating)this.isUpdating=!1,this.clearAllSnapshots()},this.updateProjection=()=>{if(this.projectionUpdateScheduled=!1,$$.value)z$.nodes=z$.calculatedTargetDeltas=z$.calculatedProjections=0;if(this.nodes.forEach(fr),this.nodes.forEach(dr),this.nodes.forEach(pr),this.nodes.forEach(vr),$$.addProjectionMetrics)$$.addProjectionMetrics(z$)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=Y,this.root=z?z.root||z:this,this.path=z?[...z.path,z]:[],this.parent=z,this.depth=z?z.depth+1:0;for(let K=0;Kthis.root.updateBlockedByResize=!1;k1.read(()=>{B=window.innerWidth}),$(Y,()=>{let _=window.innerWidth;if(_===B)return;if(B=_,this.root.updateBlockedByResize=!0,H&&H(),H=yj(U,250),Y$.hasAnimatedSinceResize)Y$.hasAnimatedSinceResize=!1,this.nodes.forEach(Cj)})}if(z)this.root.registerSharedNode(z,this);if(this.options.animate!==!1&&W&&(z||K))this.addEventListener("didUpdate",({delta:H,hasLayoutChanged:B,hasRelativeLayoutChanged:U,layout:_})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let L=this.options.transition||W.getDefaultTransition()||or,{onLayoutAnimationStart:F,onLayoutAnimationComplete:V}=W.getProps(),M=!this.targetLayout||!z_(this.targetLayout,_),D=!B&&U;if(this.options.layoutRoot||this.resumeFrom||D||B&&(M||!this.currentAnimation)){if(this.resumeFrom)this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0;let N={...iJ(L,"layout"),onPlay:F,onComplete:V};if(W.shouldReduceMotion||this.options.layoutRoot)N.delay=0,N.type=!1;this.startAnimation(N),this.setAnimationOrigin(H,D,N.path)}else{if(!B)Cj(this);if(this.isLead()&&this.options.onExitComplete)this.options.onExitComplete()}this.targetLayout=_})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let Y=this.getStack();Y&&Y.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),O6(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){if(this.isUpdateBlocked())return;this.isUpdating=!0,this.nodes&&this.nodes.forEach(lr),this.animationId++}getTransformTemplate(){let{visualElement:Y}=this.options;return Y&&Y.getProps().transformTemplate}willUpdate(Y=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear)gj(this);if(!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let H=0;H{if(this.isLayoutDirty)this.root.didUpdate();else this.root.checkUpdateFailed()})}updateSnapshot(){if(this.snapshot||!this.instance)return;if(this.snapshot=this.measure(),this.snapshot&&!r5(this.snapshot.measuredBox.x)&&!r5(this.snapshot.measuredBox.y))this.snapshot=void 0}updateLayout(){if(!this.instance)return;if(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty)return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let K=0;K{let T=k/1000,A=I?.(T);if(A)U.x.translate=A.x,U.x.scale=b1(Y.x.scale,1,T),U.x.origin=Y.x.origin,U.x.originPoint=Y.x.originPoint,U.y.translate=A.y,U.y.scale=b1(Y.y.scale,1,T),U.y.origin=Y.y.origin,U.y.originPoint=Y.y.originPoint;else Sj(U.x,Y.x,T),Sj(U.y,Y.y,T);if(this.setTargetDelta(U),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout){if(eJ(_,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),rr(this.relativeTarget,this.relativeTargetOrigin,_,T),O&&Oj(this.relativeTarget,O))this.isProjectionDirty=!1;if(!O)O=O5();B9(O,this.relativeTarget)}if(V)this.animationValues=B,Tj(B,H,this.latestValues,T,N,D);if(A&&A.rotate!==void 0){if(!this.animationValues)this.animationValues=B;this.animationValues.pathRotation=A.rotate}this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=T},this.mixTargetDelta(this.options.layoutRoot?1000:0)}startAnimation(Y){if(this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation)O6(this.pendingAnimation),this.pendingAnimation=void 0;this.pendingAnimation=k1.update(()=>{if(Y$.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=S9(0)),this.motionValue.jump(0,!1),this.currentAnimation=jj(this.motionValue,[0,1000],{...Y,velocity:0,isSync:!0,onUpdate:(z)=>{this.mixTargetDelta(z),Y.onUpdate&&Y.onUpdate(z)},onComplete:()=>{Y.onComplete&&Y.onComplete(),this.completeAnimation()}}),this.resumingFrom)this.resumingFrom.currentAnimation=this.currentAnimation;this.pendingAnimation=void 0})}completeAnimation(){if(this.resumingFrom)this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0;let Y=this.getStack();Y&&Y.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){if(this.currentAnimation)this.mixTargetDelta&&this.mixTargetDelta(Cr),this.currentAnimation.stop();this.completeAnimation()}applyTransformsToTarget(){let Y=this.getLead(),{targetWithTransforms:z,target:K,layout:W,latestValues:H}=Y;if(!z||!K||!W)return;if(this!==Y&&this.layout&&W&&uj(this.options.animationType,this.layout.layoutBox,W.layoutBox)){K=this.target||O5();let B=r5(this.layout.layoutBox.x);K.x.min=Y.target.x.min,K.x.max=K.x.min+B;let U=r5(this.layout.layoutBox.y);K.y.min=Y.target.y.min,K.y.max=K.y.min+U}B9(z,K),Fq(z,H),q$(this.projectionDeltaWithTransform,this.layoutCorrected,z,H)}registerSharedNode(Y,z){if(!this.sharedNodes.has(Y))this.sharedNodes.set(Y,new H_);this.sharedNodes.get(Y).add(z);let W=z.options.initialPromotionConfig;z.promote({transition:W?W.transition:void 0,preserveFollowOpacity:W&&W.shouldPreserveFollowOpacity?W.shouldPreserveFollowOpacity(z):void 0})}isLead(){let Y=this.getStack();return Y?Y.lead===this:!0}getLead(){let{layoutId:Y}=this.options;return Y?this.getStack()?.lead||this:this}getPrevLead(){let{layoutId:Y}=this.options;return Y?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:Y}=this.options;if(Y)return this.root.sharedNodes.get(Y)}promote({needsReset:Y,transition:z,preserveFollowOpacity:K}={}){let W=this.getStack();if(W)W.promote(this,K);if(Y)this.projectionDelta=void 0,this.needsReset=!0;if(z)this.setOptions({transition:z})}relegate(){let Y=this.getStack();if(Y)return Y.relegate(this);else return!1}resetSkewAndRotation(){let{visualElement:Y}=this.options;if(!Y)return;let z=!1,{latestValues:K}=Y;if(K.z||K.rotate||K.rotateX||K.rotateY||K.rotateZ||K.skewX||K.skewY)z=!0;if(!z)return;let W={};if(K.z)U_("z",Y,W,this.animationValues);for(let H=0;HY.currentAnimation?.stop()),this.root.nodes.forEach(Pj),this.root.sharedNodes.clear()}}}function hr($){$.updateLayout()}function xr($){let J=$.resumeFrom?.snapshot||$.snapshot;if($.isLead()&&$.layout&&J&&$.hasListeners("didUpdate")){let{layoutBox:Q,measuredBox:Z}=$.layout,{animationType:q}=$.options,X=J.source!==$.layout.source;if(q==="size")C6((H)=>{let B=X?J.measuredBox[H]:J.layoutBox[H],U=r5(B);B.min=Q[H].min,B.max=B.min+U});else if(q==="x"||q==="y"){let H=q==="x"?"y":"x";DK(X?J.measuredBox[H]:J.layoutBox[H],Q[H])}else if(uj(q,J.layoutBox,Q))C6((H)=>{let B=X?J.measuredBox[H]:J.layoutBox[H],U=r5(Q[H]);if(B.max=B.min+U,$.relativeTarget&&!$.currentAnimation)$.isProjectionDirty=!0,$.relativeTarget[H].max=$.relativeTarget[H].min+U});let Y=x7();q$(Y,Q,J.layoutBox);let z=x7();if(X)q$(z,$.applyTransform(Z,!0),J.measuredBox);else q$(z,Q,J.layoutBox);let K=!Y_(Y),W=!1;if(!$.resumeFrom){let H=$.getClosestProjectingParent();if(H&&!H.resumeFrom){let{snapshot:B,layout:U}=H;if(B&&U){let _=$.options.layoutAnchor||void 0,L=O5();eJ(L,J.layoutBox,B.layoutBox,_);let F=O5();if(eJ(F,Q,U.layoutBox,_),!z_(L,F))W=!0;if(H.options.layoutRoot)$.relativeTarget=F,$.relativeTargetOrigin=L,$.relativeParent=H}}}$.notifyListeners("didUpdate",{layout:Q,snapshot:J,delta:z,layoutDelta:Y,hasLayoutChanged:K,hasRelativeLayoutChanged:W})}else if($.isLead()){let{onExitComplete:Q}=$.options;Q&&Q()}$.options.transition=void 0}function fr($){if($$.value)z$.nodes++;if(!$.parent)return;if(!$.isProjecting())$.isProjectionDirty=$.parent.isProjectionDirty;$.isSharedProjectionDirty||($.isSharedProjectionDirty=Boolean($.isProjectionDirty||$.parent.isProjectionDirty||$.parent.isSharedProjectionDirty)),$.isTransformDirty||($.isTransformDirty=$.parent.isTransformDirty)}function vr($){$.isProjectionDirty=$.isSharedProjectionDirty=$.isTransformDirty=!1}function gr($){$.clearSnapshot()}function Pj($){$.clearMeasurements()}function ur($){$.isLayoutDirty=!0,$.updateLayout()}function Rj($){$.isLayoutDirty=!1}function mr($){if($.isAnimationBlocked&&$.layout&&!$.isLayoutDirty)$.snapshot=$.layout,$.isLayoutDirty=!0}function cr($){let{visualElement:J}=$.options;if(J&&J.getProps().onBeforeLayoutMeasure)J.notify("BeforeLayoutMeasure");$.resetTransform()}function Cj($){$.finishAnimation(),$.targetDelta=$.relativeTarget=$.target=void 0,$.isProjectionDirty=!0}function dr($){$.resolveTargetDelta()}function pr($){$.calcProjection()}function lr($){$.resetSkewAndRotation()}function ir($){$.removeLeadSnapshot()}function Sj($,J,Q){$.translate=b1(J.translate,0,Q),$.scale=b1(J.scale,1,Q),$.origin=J.origin,$.originPoint=J.originPoint}function hj($,J,Q,Z){$.min=b1(J.min,Q.min,Z),$.max=b1(J.max,Q.max,Z)}function rr($,J,Q,Z){hj($.x,J.x,Q.x,Z),hj($.y,J.y,Q.y,Z)}function sr($){return $.animationValues&&$.animationValues.opacityExit!==void 0}var or={duration:0.45,ease:[0.4,0,0.1,1]},xj=($)=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes($),fj=xj("applewebkit/")&&!xj("chrome/")?Math.round:b5;function vj($){$.min=fj($.min),$.max=fj($.max)}function nr($){vj($.x),vj($.y)}function uj($,J,Q){return $==="position"||$==="preserve-aspect"&&!Z_(K_(J),K_(Q),0.2)}function ar($){return $!==$.root&&$.scroll?.wasRoot}var mj=NK({attachResizeListener:($,J)=>W4($,"resize",J),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0});var OK={current:void 0},Aq=NK({measureScroll:($)=>({x:$.scrollLeft,y:$.scrollTop}),defaultParent:()=>{if(!OK.current){let $=new mj({});$.mount(window),$.setOptions({layoutScroll:!0}),OK.current=$}return OK.current},resetTransform:($,J)=>{$.style.transform=J!==void 0?J:"none"},checkIsScrollRoot:($)=>Boolean(window.getComputedStyle($).position==="fixed")});var dj=R(v(),1);var cj=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function $Q($){if(typeof $!=="string"||$.includes("-"))return!1;else if(cj.indexOf($)>-1||/[A-Z]/u.test($))return!0;return!1}var pj=($,J)=>{return J.isSVG??$Q($)?new MK(J):new FK(J,{allowProjection:$!==dj.Fragment})};var qQ=R(v(),1);var lj=R(v(),1),AK=lj.createContext({});var ij=R(v(),1),wK=ij.createContext({strict:!1});var rj=R(v(),1),kK=rj.createContext({transformPagePoint:($)=>$,isStatic:!1,reducedMotion:"never"});var sj=R(v(),1),v7=sj.createContext({});var IK=R(v(),1);function oj($,J){if(f7($)){let{initial:Q,animate:Z}=$;return{initial:Q===!1||G4(Q)?Q:void 0,animate:G4(Z)?Z:void 0}}return $.inherit!==!1?J:{}}function aj($){let{initial:J,animate:Q}=oj($,IK.useContext(v7));return IK.useMemo(()=>({initial:J,animate:Q}),[nj(J),nj(Q)])}function nj($){return Array.isArray($)?$.join(" "):$}var QQ=R(v(),1);var tj=R(v(),1);var JQ=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function __($,J,Q){for(let Z in J)if(!q5(J[Z])&&!Mq(Z,Q))$[Z]=J[Z]}function tr({transformTemplate:$},J){return tj.useMemo(()=>{let Q=JQ();return J$(Q,J,$),Object.assign({},Q.vars,Q.style)},[J])}function er($,J){let Q=$.style||{},Z={};return __(Z,Q,$),Object.assign(Z,tr($,J)),Z}function ej($,J){let Q={},Z=er($,J);if($.drag&&$.dragListener!==!1)Q.draggable=!1,Z.userSelect=Z.WebkitUserSelect=Z.WebkitTouchCallout="none",Z.touchAction=$.drag===!0?"none":`pan-${$.drag==="x"?"y":"x"}`;if($.tabIndex===void 0&&($.onTap||$.onTapStart||$.whileTap))Q.tabIndex=0;return Q.style=Z,Q}var $E=R(v(),1);var TK=()=>({...JQ(),attrs:{}});function JE($,J,Q,Z){let q=$E.useMemo(()=>{let X=TK();return Dq(X,J,Nq(Z),$.transformTemplate,$.style),{...X.attrs,style:{...X.style}}},[J]);if($.style){let X={};__(X,$.style,$),q.style={...X,...q.style}}return q}var $s=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function wq($){return $.startsWith("while")||$.startsWith("drag")&&$!=="draggable"||$.startsWith("layout")||$.startsWith("onTap")||$.startsWith("onPan")||$.startsWith("onLayout")||$s.has($)}var ZE=($)=>!wq($);function Js($){if(typeof $!=="function")return;ZE=(J)=>J.startsWith("on")?!wq(J):$(J)}try{let $="@emotion/is-prop-valid";Js(QE($).default)}catch{}function qE($,J,Q){let Z={};for(let q in $){if(q==="values"&&typeof $.values==="object")continue;if(q5($[q]))continue;if(ZE(q)||Q===!0&&wq(q)||!J&&!wq(q)||$.draggable&&q.startsWith("onDrag"))Z[q]=$[q]}return Z}function XE($,J,Q,{latestValues:Z},q,X=!1,Y){let K=(Y??$Q($)?JE:ej)(J,Z,q,$),W=qE(J,typeof $==="string",X),H=$!==QQ.Fragment?{...W,...K,ref:Q}:{},{children:B}=J,U=QQ.useMemo(()=>q5(B)?B.get():B,[B]);return QQ.createElement($,{...H,children:U})}var L_=R(v(),1);var YE=R(v(),1),ZQ=YE.createContext(null);var zE=R(v(),1);function KE($){let J=zE.useRef(null);if(J.current===null)J.current=$();return J.current}function Qs({scrapeMotionValuesFromProps:$,createRenderState:J},Q,Z,q){return{latestValues:Zs(Q,Z,q,$),renderState:J()}}function Zs($,J,Q,Z){let q={},X=Z($,{});for(let U in X)q[U]=X$(X[U]);let{initial:Y,animate:z}=$,K=f7($),W=Wq($);if(J&&W&&!K&&$.inherit!==!1){if(Y===void 0)Y=J.initial;if(z===void 0)z=J.animate}let H=Q?Q.initial===!1:!1;H=H||Y===!1;let B=H?z:Y;if(B&&typeof B!=="boolean"&&!r4(B)){let U=Array.isArray(B)?B:[B];for(let _=0;_(J,Q)=>{let Z=L_.useContext(v7),q=L_.useContext(ZQ),X=()=>Qs($,J,Z,q);return Q?X():KE(X)};var GE=bK({scrapeMotionValuesFromProps:Q$,createRenderState:JQ});var WE=bK({scrapeMotionValuesFromProps:Oq,createRenderState:TK});var HE={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},BE=!1;function qs(){if(BE)return;let $={};for(let J in HE)$[J]={isEnabled:(Q)=>HE[J].some((Z)=>!!Q[Z])};Bq($),BE=!0}function jK(){return qs(),cU()}function UE($){let J=jK();for(let Q in $)J[Q]={...J[Q],...$[Q]};Bq(J)}var _E=Symbol.for("motionComponentSymbol");var K$=R(v(),1);function LE($,J,Q){let Z=K$.useRef(Q);K$.useInsertionEffect(()=>{Z.current=Q});let q=K$.useRef(null);return K$.useCallback((X)=>{if(X)$.onMount?.(X);if(J)X?J.mount(X):J.unmount();let Y=Z.current;if(typeof Y==="function")if(X){let z=Y(X);if(typeof z==="function")q.current=z}else if(q.current)q.current(),q.current=null;else Y(X);else if(Y)Y.current=X},[J])}var Z6=R(v(),1);var FE=R(v(),1),EK=FE.createContext({});function g7($){return $&&typeof $==="object"&&Object.prototype.hasOwnProperty.call($,"current")}var yK=R(v(),1);var VE=typeof window<"u";var ME=VE?yK.useLayoutEffect:yK.useEffect;function DE($,J,Q,Z,q,X){let{visualElement:Y}=Z6.useContext(v7),z=Z6.useContext(wK),K=Z6.useContext(ZQ),W=Z6.useContext(kK),H=W.reducedMotion,B=W.skipAnimations,U=Z6.useRef(null),_=Z6.useRef(!1);if(Z=Z||z.renderer,!U.current&&Z){if(U.current=Z($,{visualState:J,parent:Y,props:Q,presenceContext:K,blockInitialAnimation:K?K.initial===!1:!1,reducedMotionConfig:H,skipAnimations:B,isSVG:X}),_.current&&U.current)U.current.manuallyAnimateOnMount=!0}let L=U.current,F=Z6.useContext(EK);if(L&&!L.projection&&q&&(L.type==="html"||L.type==="svg"))Xs(U.current,Q,q,F);let V=Z6.useRef(!1);Z6.useInsertionEffect(()=>{if(L&&V.current)L.update(Q,K)});let M=Q[qq],D=Z6.useRef(Boolean(M)&&typeof window<"u"&&!window.MotionHandoffIsComplete?.(M)&&window.MotionHasOptimisedAnimation?.(M));return ME(()=>{if(_.current=!0,!L)return;if(V.current=!0,window.MotionIsMounted=!0,L.updateFeatures(),L.scheduleRenderMicrotask(),D.current&&L.animationState)L.animationState.animateChanges()}),Z6.useEffect(()=>{if(!L)return;if(!D.current&&L.animationState)L.animationState.animateChanges();if(D.current)queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(M)}),D.current=!1;L.enteringChildren=void 0}),L}function Xs($,J,Q,Z){let{layoutId:q,layout:X,drag:Y,dragConstraints:z,layoutScroll:K,layoutRoot:W,layoutAnchor:H,layoutCrossfade:B}=J;$.projection=new Q($.latestValues,J["data-framer-portal-id"]?void 0:NE($.parent)),$.projection.setOptions({layoutId:q,layout:X,alwaysMeasureLayout:Boolean(Y)||z&&g7(z),visualElement:$,animationType:typeof X==="string"?X:"both",initialPromotionConfig:Z,crossfade:B,layoutScroll:K,layoutRoot:W,layoutAnchor:H})}function NE($){if(!$)return;return $.options.allowProjection!==!1?$.projection:NE($.parent)}function PK($,{forwardMotionProps:J=!1,type:Q}={},Z,q){Z&&UE(Z);let X=Q?Q==="svg":$Q($),Y=X?WE:GE;function z(W,H){let B,U={...qQ.useContext(kK),...W,layoutId:Ys(W)},{isStatic:_}=U,L=aj(W),F=Y(W,_);if(!_&&typeof window<"u"){zs(U,Z);let V=Ks(U);B=V.MeasureLayout,L.visualElement=DE($,F,U,q,V.ProjectionNode,X)}return b(v7.Provider,{value:L,children:[B&&L.visualElement?G(B,{visualElement:L.visualElement,...U}):null,XE($,W,LE(F,L.visualElement,H),F,_,J,X)]})}z.displayName=`motion.${typeof $==="string"?$:`create(${$.displayName??$.name??""})`}`;let K=qQ.forwardRef(z);return K[_E]=$,K}function Ys({layoutId:$}){let J=qQ.useContext(AK).id;return J&&$!==void 0?J+"-"+$:$}function zs($,J){let Q=qQ.useContext(wK).strict}function Ks($){let J=jK(),{drag:Q,layout:Z}=J;if(!Q&&!Z)return{};let q={...Q,...Z};return{MeasureLayout:Q?.isEnabled($)||Z?.isEnabled($)?q.MeasureLayout:void 0,ProjectionNode:q.ProjectionNode}}function OE($,J){if(typeof Proxy>"u")return PK;let Q=new Map,Z=(X,Y)=>{return PK(X,Y,$,J)};return new Proxy((X,Y)=>{return Z(X,Y)},{get:(X,Y)=>{if(Y==="create")return Z;if(!Q.has(Y))Q.set(Y,PK(Y,void 0,$,J));return Q.get(Y)}})}class F_ extends k8{constructor($){super($);$.animationState||($.animationState=tU($))}updateAnimationControlsSubscription(){let{animate:$}=this.node.getProps();if(r4($))this.unmountControls=$.subscribe(this.node)}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:$}=this.node.getProps(),{animate:J}=this.node.prevProps||{};if($!==J)this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}var Gs=0;class V_ extends k8{constructor(){super(...arguments);this.id=Gs++,this.isExitComplete=!1}update(){if(!this.node.presenceContext)return;let{isPresent:$,onExitComplete:J}=this.node.presenceContext,{isPresent:Q}=this.node.prevPresenceContext||{};if(!this.node.animationState||$===Q)return;if($&&Q===!1){if(this.isExitComplete){let{initial:q,custom:X}=this.node.getProps();if(typeof q==="string"||typeof q==="object"&&q!==null&&!Array.isArray(q)){let Y=R6(this.node,q,X);if(Y){let{transition:z,transitionEnd:K,...W}=Y;for(let H in W)this.node.getValue(H)?.jump(W[H])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}let Z=this.node.animationState.setActive("exit",!$);if(J&&!$)Z.then(()=>{this.isExitComplete=!0,J(this.id)})}mount(){let{register:$,onExitComplete:J}=this.node.presenceContext||{};if(J)J(this.id);if($)this.unmount=$(this.id)}unmount(){}}var AE={animation:{Feature:F_},exit:{Feature:V_}};function o4($){return{point:{x:$.pageX,y:$.pageY}}}var wE=($)=>(J)=>e2(J)&&$(J,o4(J));function u7($,J,Q,Z){return W4($,J,wE(Q),Z)}var RK=({current:$})=>{return $?$.ownerDocument.defaultView:null};var kE=($,J)=>Math.abs($-J);function IE($,J){let Q=kE($.x,J.x),Z=kE($.y,J.y);return Math.sqrt(Q**2+Z**2)}var TE=new Set(["auto","scroll"]);class kq{constructor($,J,{transformPagePoint:Q,contextWindow:Z=window,dragSnapToOrigin:q=!1,distanceThreshold:X=3,element:Y}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=(_)=>{this.handleScroll(_.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;if(this.lastRawMoveEventInfo)this.lastMoveEventInfo=CK(this.lastRawMoveEventInfo,this.transformPagePoint);let _=M_(this.lastMoveEventInfo,this.history),L=this.startEvent!==null,F=IE(_.offset,{x:0,y:0})>=this.distanceThreshold;if(!L&&!F)return;let{point:V}=_,{timestamp:M}=C5;this.history.push({...V,timestamp:M});let{onStart:D,onMove:N}=this.handlers;if(!L)D&&D(this.lastMoveEvent,_),this.startEvent=this.lastMoveEvent;N&&N(this.lastMoveEvent,_)},this.handlePointerMove=(_,L)=>{this.lastMoveEvent=_,this.lastRawMoveEventInfo=L,this.lastMoveEventInfo=CK(L,this.transformPagePoint),k1.update(this.updatePoint,!0)},this.handlePointerUp=(_,L)=>{this.end();let{onEnd:F,onSessionEnd:V,resumeAnimation:M}=this.handlers;if(this.dragSnapToOrigin||!this.startEvent)M&&M();if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let D=M_(_.type==="pointercancel"?this.lastMoveEventInfo:CK(L,this.transformPagePoint),this.history);if(this.startEvent&&F)F(_,D);V&&V(_,D)},!e2($))return;this.dragSnapToOrigin=q,this.handlers=J,this.transformPagePoint=Q,this.distanceThreshold=X,this.contextWindow=Z||window;let z=o4($),K=CK(z,this.transformPagePoint),{point:W}=K,{timestamp:H}=C5;this.history=[{...W,timestamp:H}];let{onSessionStart:B}=J;B&&B($,M_(K,this.history));let U={passive:!0,capture:!0};if(this.removeListeners=C9(u7(this.contextWindow,"pointermove",this.handlePointerMove,U),u7(this.contextWindow,"pointerup",this.handlePointerUp,U),u7(this.contextWindow,"pointercancel",this.handlePointerUp,U)),Y)this.startScrollTracking(Y)}startScrollTracking($){let J=$.parentElement;while(J){let Q=getComputedStyle(J);if(TE.has(Q.overflowX)||TE.has(Q.overflowY))this.scrollPositions.set(J,{x:J.scrollLeft,y:J.scrollTop});J=J.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll($){let J=this.scrollPositions.get($);if(!J)return;let Q=$===window,Z=Q?{x:window.scrollX,y:window.scrollY}:{x:$.scrollLeft,y:$.scrollTop},q={x:Z.x-J.x,y:Z.y-J.y};if(q.x===0&&q.y===0)return;if(Q){if(this.lastMoveEventInfo)this.lastMoveEventInfo.point.x+=q.x,this.lastMoveEventInfo.point.y+=q.y}else if(this.history.length>0)this.history[0].x-=q.x,this.history[0].y-=q.y;this.scrollPositions.set($,Z),k1.update(this.updatePoint,!0)}updateHandlers($){this.handlers=$}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),O6(this.updatePoint)}}function CK($,J){return J?{point:J($.point)}:$}function bE($,J){return{x:$.x-J.x,y:$.y-J.y}}function M_({point:$},J){return{point:$,delta:bE($,jE(J)),offset:bE($,Ws(J)),velocity:Hs(J,0.1)}}function Ws($){return $[0]}function jE($){return $[$.length-1]}function Hs($,J){if($.length<2)return{x:0,y:0};let Q=$.length-1,Z=null,q=jE($);while(Q>=0){if(Z=$[Q],q.timestamp-Z.timestamp>f5(J))break;Q--}if(!Z)return{x:0,y:0};if(Z===$[0]&&$.length>2&&q.timestamp-Z.timestamp>f5(J)*2)Z=$[1];let X=w8(q.timestamp-Z.timestamp);if(X===0)return{x:0,y:0};let Y={x:(q.x-Z.x)/X,y:(q.y-Z.y)/X};if(Y.x===1/0)Y.x=0;if(Y.y===1/0)Y.y=0;return Y}function CE($,{min:J,max:Q},Z){if(J!==void 0&&$Q)$=Z?b1(Q,$,Z.max):Math.min($,Q);return $}function EE($,J,Q){return{min:J!==void 0?$.min+J:void 0,max:Q!==void 0?$.max+Q-($.max-$.min):void 0}}function SE($,{top:J,left:Q,bottom:Z,right:q}){return{x:EE($.x,Q,q),y:EE($.y,J,Z)}}function yE($,J){let Q=J.min-$.min,Z=J.max-$.max;if(J.max-J.min<$.max-$.min)[Q,Z]=[Z,Q];return{min:Q,max:Z}}function hE($,J){return{x:yE($.x,J.x),y:yE($.y,J.y)}}function xE($,J){let Q=0.5,Z=r5($),q=r5(J);if(q>Z)Q=X4(J.min,J.max-Z,$.min);else if(Z>q)Q=X4($.min,$.max-q,J.min);return _8(0,1,Q)}function fE($,J){let Q={};if(J.min!==void 0)Q.min=J.min-$.min;if(J.max!==void 0)Q.max=J.max-$.min;return Q}var SK=0.35;function vE($=SK){if($===!1)$=0;else if($===!0)$=SK;return{x:PE($,"left","right"),y:PE($,"top","bottom")}}function PE($,J,Q){return{min:RE($,J),max:RE($,Q)}}function RE($,J){return typeof $==="number"?$:$[J]||0}var Bs=new WeakMap;class D_{constructor($){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=O5(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=$}start($,{snapToCursor:J=!1,distanceThreshold:Q}={}){let{presenceContext:Z}=this.visualElement;if(Z&&Z.isPresent===!1)return;let q=(H)=>{if(J)this.snapToCursor(o4(H).point);this.stopAnimation()},X=(H,B)=>{let{drag:U,dragPropagation:_,onDragStart:L}=this.getProps();if(U&&!_){if(this.openDragLock)this.openDragLock();if(this.openDragLock=CU(U),!this.openDragLock)return}if(this.latestPointerEvent=H,this.latestPanInfo=B,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection)this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0;if(C6((V)=>{let M=this.getAxisMotionValue(V).get()||0;if(c8.test(M)){let{projection:D}=this.visualElement;if(D&&D.layout){let N=D.layout.layoutBox[V];if(N)M=r5(N)*(parseFloat(M)/100)}}this.originPoint[V]=M}),L)k1.update(()=>L(H,B),!1,!0);rJ(this.visualElement,"transform");let{animationState:F}=this.visualElement;F&&F.setActive("whileDrag",!0)},Y=(H,B)=>{this.latestPointerEvent=H,this.latestPanInfo=B;let{dragPropagation:U,dragDirectionLock:_,onDirectionLock:L,onDrag:F}=this.getProps();if(!U&&!this.openDragLock)return;let{offset:V}=B;if(_&&this.currentDirection===null){if(this.currentDirection=_s(V),this.currentDirection!==null)L&&L(this.currentDirection);return}if(this.updateAxis("x",B.point,V),this.updateAxis("y",B.point,V),this.visualElement.render(),F)k1.update(()=>F(H,B),!1,!0)},z=(H,B)=>{this.latestPointerEvent=H,this.latestPanInfo=B,this.stop(H,B),this.latestPointerEvent=null,this.latestPanInfo=null},K=()=>{let{dragSnapToOrigin:H}=this.getProps();if(H||this.constraints)this.startAnimation({x:0,y:0})},{dragSnapToOrigin:W}=this.getProps();this.panSession=new kq($,{onSessionStart:q,onStart:X,onMove:Y,onSessionEnd:z,resumeAnimation:K},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:W,distanceThreshold:Q,contextWindow:RK(this.visualElement),element:this.visualElement.current})}stop($,J){let Q=$||this.latestPointerEvent,Z=J||this.latestPanInfo,q=this.isDragging;if(this.cancel(),!q||!Z||!Q)return;let{velocity:X}=Z;this.startAnimation(X);let{onDragEnd:Y}=this.getProps();if(Y)k1.postRender(()=>Y(Q,Z))}cancel(){this.isDragging=!1;let{projection:$,animationState:J}=this.visualElement;if($)$.isAnimationBlocked=!1;this.endPanSession();let{dragPropagation:Q}=this.getProps();if(!Q&&this.openDragLock)this.openDragLock(),this.openDragLock=null;J&&J.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis($,J,Q){let{drag:Z}=this.getProps();if(!Q||!hK($,Z,this.currentDirection))return;let q=this.getAxisMotionValue($),X=this.originPoint[$]+Q[$];if(this.constraints&&this.constraints[$])X=CE(X,this.constraints[$],this.elastic[$]);q.set(X)}resolveConstraints(){let{dragConstraints:$,dragElastic:J}=this.getProps(),Q=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,Z=this.constraints;if($&&g7($)){if(!this.constraints)this.constraints=this.resolveRefConstraints()}else if($&&Q)this.constraints=SE(Q.layoutBox,$);else this.constraints=!1;if(this.elastic=vE(J),Z!==this.constraints&&!g7($)&&Q&&this.constraints&&!this.hasMutatedConstraints)C6((q)=>{if(this.constraints!==!1&&this.getAxisMotionValue(q))this.constraints[q]=fE(Q.layoutBox[q],this.constraints[q])})}resolveRefConstraints(){let{dragConstraints:$,onMeasureDragConstraints:J}=this.getProps();if(!$||!g7($))return!1;let Q=$.current;N6(Q!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");let{projection:Z}=this.visualElement;if(!Z||!Z.layout)return!1;if(Z.root)Z.root.scroll=void 0,Z.root.updateScroll();let q=oU(Q,Z.root,this.visualElement.getTransformPagePoint()),X=hE(Z.layout.layoutBox,q);if(J){let Y=J(dU(X));if(this.hasMutatedConstraints=!!Y,Y)X=_q(Y)}return X}startAnimation($){let{drag:J,dragMomentum:Q,dragElastic:Z,dragTransition:q,dragSnapToOrigin:X,onDragTransitionEnd:Y}=this.getProps(),z=this.constraints||{},K=C6((W)=>{if(!hK(W,J,this.currentDirection))return;let H=z&&z[W]||{};if(X===!0||X===W)H={min:0,max:0};let B=Z?200:1e6,U=Z?40:1e7,_={type:"inertia",velocity:Q?$[W]:0,bounceStiffness:B,bounceDamping:U,timeConstant:750,restDelta:1,restSpeed:10,...q,...H};return this.startAxisValueAnimation(W,_)});return Promise.all(K).then(Y)}startAxisValueAnimation($,J){let Q=this.getAxisMotionValue($);return rJ(this.visualElement,$),Q.start(o2($,Q,0,J,this.visualElement,!1))}stopAnimation(){C6(($)=>this.getAxisMotionValue($).stop())}getAxisMotionValue($){let J=`_drag${$.toUpperCase()}`,Z=this.visualElement.getProps()[J];return Z?Z:this.visualElement.getValue($,this.visualElement.latestValues[$]??0)}snapToCursor($){C6((J)=>{let{drag:Q}=this.getProps();if(!hK(J,Q,this.currentDirection))return;let{projection:Z}=this.visualElement,q=this.getAxisMotionValue(J);if(Z&&Z.layout){let{min:X,max:Y}=Z.layout.layoutBox[J],z=q.get()||0;q.set($[J]-b1(X,Y,0.5)+z)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:$,dragConstraints:J}=this.getProps(),{projection:Q}=this.visualElement;if(!g7(J)||!Q||!this.constraints)return;this.stopAnimation();let Z={x:0,y:0};C6((X)=>{let Y=this.getAxisMotionValue(X);if(Y&&this.constraints!==!1){let z=Y.get();Z[X]=xE({min:z,max:z},this.constraints[X])}});let{transformTemplate:q}=this.visualElement.getProps();this.visualElement.current.style.transform=q?q({},""):"none",Q.root&&Q.root.updateScroll(),Q.updateLayout(),this.constraints=!1,this.resolveConstraints(),C6((X)=>{if(!hK(X,$,null))return;let Y=this.getAxisMotionValue(X),{min:z,max:K}=this.constraints[X];Y.set(b1(z,K,Z[X]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;Bs.set(this.visualElement,this);let $=this.visualElement.current,J=u7($,"pointerdown",(K)=>{let{drag:W,dragListener:H=!0}=this.getProps(),B=K.target,U=B!==$&&fU(B);if(W&&H&&!U)this.start(K)}),Q,Z=()=>{let{dragConstraints:K}=this.getProps();if(g7(K)&&K.current){if(this.constraints=this.resolveRefConstraints(),!Q)Q=Us($,K.current,()=>this.scalePositionWithinConstraints())}},{projection:q}=this.visualElement,X=q.addEventListener("measure",Z);if(q&&!q.layout)q.root&&q.root.updateScroll(),q.updateLayout();k1.read(Z);let Y=W4(window,"resize",()=>this.scalePositionWithinConstraints()),z=q.addEventListener("didUpdate",({delta:K,hasLayoutChanged:W})=>{if(this.isDragging&&W)C6((H)=>{let B=this.getAxisMotionValue(H);if(!B)return;this.originPoint[H]+=K[H].translate,B.set(B.get()+K[H].translate)}),this.visualElement.render()});return()=>{Y(),J(),X(),z&&z(),Q&&Q()}}getProps(){let $=this.visualElement.getProps(),{drag:J=!1,dragDirectionLock:Q=!1,dragPropagation:Z=!1,dragConstraints:q=!1,dragElastic:X=SK,dragMomentum:Y=!0}=$;return{...$,drag:J,dragDirectionLock:Q,dragPropagation:Z,dragConstraints:q,dragElastic:X,dragMomentum:Y}}}function gE($){let J=!0;return()=>{if(J){J=!1;return}$()}}function Us($,J,Q){let Z=KK($,gE(Q)),q=KK(J,gE(Q));return()=>{Z(),q()}}function hK($,J,Q){return(J===!0||J===$)&&(Q===null||Q===$)}function _s($,J=10){let Q=null;if(Math.abs($.y)>J)Q="y";else if(Math.abs($.x)>J)Q="x";return Q}class N_ extends k8{constructor($){super($);this.removeGroupControls=b5,this.removeListeners=b5,this.controls=new D_($)}mount(){let{dragControls:$}=this.node.getProps();if($)this.removeGroupControls=$.subscribe(this.controls);this.removeListeners=this.controls.addListeners()||b5}update(){let{dragControls:$}=this.node.getProps(),{dragControls:J}=this.node.prevProps||{};if($!==J){if(this.removeGroupControls(),$)this.removeGroupControls=$.subscribe(this.controls)}}unmount(){if(this.removeGroupControls(),this.removeListeners(),!this.controls.isDragging)this.controls.endPanSession()}}var O_=($)=>(J,Q)=>{if($)k1.update(()=>$(J,Q),!1,!0)};class A_ extends k8{constructor(){super(...arguments);this.removePointerDownListener=b5}onPointerDown($){this.session=new kq($,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:RK(this.node)})}createPanHandlers(){let{onPanSessionStart:$,onPanStart:J,onPan:Q,onPanEnd:Z}=this.node.getProps();return{onSessionStart:O_($),onStart:O_(J),onMove:O_(Q),onEnd:(q,X)=>{if(delete this.session,Z)k1.postRender(()=>Z(q,X))}}}mount(){this.removePointerDownListener=u7(this.node.current,"pointerdown",($)=>this.onPointerDown($))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}var Iq=R(v(),1);var m7=R(v(),1);function uE($=!0){let J=m7.useContext(ZQ);if(J===null)return[!0,null];let{isPresent:Q,onExitComplete:Z,register:q}=J,X=m7.useId();m7.useEffect(()=>{if($)return q(X)},[$]);let Y=m7.useCallback(()=>$&&Z&&Z(X),[X,Z,$]);return!Q&&Z?[!1,Y]:[!0]}var w_=!1;class mE extends Iq.Component{componentDidMount(){let{visualElement:$,layoutGroup:J,switchLayoutGroup:Q,layoutId:Z}=this.props,{projection:q}=$;if(q){if(J.group)J.group.add(q);if(Q&&Q.register&&Z)Q.register(q);if(w_)q.root.didUpdate();q.addEventListener("animationComplete",()=>{this.safeToRemove()}),q.setOptions({...q.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})}Y$.hasEverUpdated=!0}getSnapshotBeforeUpdate($){let{layoutDependency:J,visualElement:Q,drag:Z,isPresent:q}=this.props,{projection:X}=Q;if(!X)return null;if(X.isPresent=q,$.layoutDependency!==J)X.setOptions({...X.options,layoutDependency:J});if(w_=!0,Z||$.layoutDependency!==J||J===void 0||$.isPresent!==q)X.willUpdate();else this.safeToRemove();if($.isPresent!==q){if(q)X.promote();else if(!X.relegate())k1.postRender(()=>{let Y=X.getStack();if(!Y||!Y.members.length)this.safeToRemove()})}return null}componentDidUpdate(){let{visualElement:$,layoutAnchor:J}=this.props,{projection:Q}=$;if(Q)Q.options.layoutAnchor=J,Q.root.didUpdate(),t2.postRender(()=>{if(!Q.currentAnimation&&Q.isLead())this.safeToRemove()})}componentWillUnmount(){let{visualElement:$,layoutGroup:J,switchLayoutGroup:Q}=this.props,{projection:Z}=$;if(w_=!0,Z){if(Z.scheduleCheckAfterUnmount(),J&&J.group)J.group.remove(Z);if(Q&&Q.deregister)Q.deregister(Z)}}safeToRemove(){let{safeToRemove:$}=this.props;$&&$()}render(){return null}}function xK($){let[J,Q]=uE(),Z=Iq.useContext(AK);return G(mE,{...$,layoutGroup:Z,switchLayoutGroup:Iq.useContext(EK),isPresent:J,safeToRemove:Q})}var cE={pan:{Feature:A_},drag:{Feature:N_,ProjectionNode:Aq,MeasureLayout:xK}};function dE($,J,Q){let{props:Z}=$;if($.animationState&&Z.whileHover)$.animationState.setActive("whileHover",Q==="Start");let q="onHover"+Q,X=Z[q];if(X)k1.postRender(()=>X(J,o4(J)))}class k_ extends k8{mount(){let{current:$}=this.node;if(!$)return;this.unmount=SU($,(J,Q)=>{return dE(this.node,Q,"Start"),(Z)=>dE(this.node,Z,"End")})}unmount(){}}class I_ extends k8{constructor(){super(...arguments);this.isActive=!1}onFocus(){let $=!1;try{$=this.node.current.matches(":focus-visible")}catch(J){$=!0}if(!$||!this.node.animationState)return;this.node.animationState.setActive("whileFocus",!0),this.isActive=!0}onBlur(){if(!this.isActive||!this.node.animationState)return;this.node.animationState.setActive("whileFocus",!1),this.isActive=!1}mount(){this.unmount=C9(W4(this.node.current,"focus",()=>this.onFocus()),W4(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function pE($,J,Q){let{props:Z}=$;if($.current instanceof HTMLButtonElement&&$.current.disabled)return;if($.animationState&&Z.whileTap)$.animationState.setActive("whileTap",Q==="Start");let q="onTap"+(Q==="End"?"":Q),X=Z[q];if(X)k1.postRender(()=>X(J,o4(J)))}class T_ extends k8{mount(){let{current:$}=this.node;if(!$)return;let{globalTapTarget:J,propagate:Q}=this.node.props;this.unmount=gU($,(Z,q)=>{return pE(this.node,q,"Start"),(X,{success:Y})=>pE(this.node,X,Y?"End":"Cancel")},{useGlobalTarget:J,stopPropagation:Q?.tap===!1})}unmount(){}}var j_=new WeakMap,b_=new WeakMap,Ls=($)=>{let J=j_.get($.target);J&&J($)},Fs=($)=>{$.forEach(Ls)};function Vs({root:$,...J}){let Q=$||document;if(!b_.has(Q))b_.set(Q,{});let Z=b_.get(Q),q=JSON.stringify(J);if(!Z[q])Z[q]=new IntersectionObserver(Fs,{root:$,...J});return Z[q]}function lE($,J,Q){let Z=Vs(J);return j_.set($,Q),Z.observe($),()=>{j_.delete($),Z.unobserve($)}}var Ms={some:0,all:1};class E_ extends k8{constructor(){super(...arguments);this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();let{viewport:$={}}=this.node.getProps(),{root:J,margin:Q,amount:Z="some",once:q}=$,X={root:J?J.current:void 0,rootMargin:Q,threshold:typeof Z==="number"?Z:Ms[Z]},Y=(z)=>{let{isIntersecting:K}=z;if(this.isInView===K)return;if(this.isInView=K,q&&!K&&this.hasEnteredView)return;else if(K)this.hasEnteredView=!0;if(this.node.animationState)this.node.animationState.setActive("whileInView",K);let{onViewportEnter:W,onViewportLeave:H}=this.node.getProps(),B=K?W:H;B&&B(z)};this.stopObserver=lE(this.node.current,X,Y)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;let{props:$,prevProps:J}=this.node;if(["amount","margin","root"].some(Ds($,J)))this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}}function Ds({viewport:$={}},{viewport:J={}}={}){return(Q)=>$[Q]!==J[Q]}var iE={inView:{Feature:E_},tap:{Feature:T_},focus:{Feature:I_},hover:{Feature:k_}};var rE={layout:{ProjectionNode:Aq,MeasureLayout:xK}};var sE={...AE,...iE,...cE,...rE};var Tq=OE(sE,pj);var $2={};n4($2,{createHandle:()=>MR,Viewport:()=>VR,Trigger:()=>PP,Title:()=>qR,Root:()=>wP,Positioner:()=>rP,Portal:()=>SP,Popup:()=>tP,Handle:()=>mG,Description:()=>YR,Close:()=>KR,Backdrop:()=>QR,Arrow:()=>$R});var J7=R(v(),1);function m1(){}var G$=Object.freeze([]),I1=Object.freeze({});var p8=R(v(),1);function _1($,J,Q,Z){return $.addEventListener(J,Q,Z),()=>{$.removeEventListener(J,Q,Z)}}function I8(...$){return()=>{for(let J=0;J<$.length;J+=1){let Q=$[J];if(Q)Q()}}}var nE=R(v(),1),oE={};function G5($,J){let Q=nE.useRef(oE);if(Q.current===oE)Q.current=$(J);return Q}function U9($,J,Q,Z){let q=G5(tE).current;if(Ns(q,$,J,Q,Z))eE(q,[$,J,Q,Z]);return q.callback}function aE($){let J=G5(tE).current;if(Os(J,$))eE(J,$);return J.callback}function tE(){return{callback:null,cleanup:null,refs:[]}}function Ns($,J,Q,Z,q){return $.refs[0]!==J||$.refs[1]!==Q||$.refs[2]!==Z||$.refs[3]!==q}function Os($,J){return $.refs.length!==J.length||$.refs.some((Q,Z)=>Q!==J[Z])}function eE($,J){if($.refs=J,J.every((Q)=>Q==null)){$.callback=null;return}$.callback=(Q)=>{if($.cleanup)$.cleanup(),$.cleanup=null;if(Q!=null){let Z=Array(J.length).fill(null);for(let q=0;q{for(let q=0;q{},y0=typeof document<"u"?$y.useLayoutEffect:As;function _5($){let J=G5(ws,$).current;return J.next=$,y0(J.effect),J}function ws($){let J={current:$,next:$,effect:()=>{J.current=J.next}};return J}var ks=R(v(),1),bq={...ks};var y_=bq.useInsertionEffect,Is=y_&&y_!==bq.useLayoutEffect?y_:($)=>$();function g0($){let J=G5(Ts).current;return J.next=$,Is(J.effect),J.trampoline}function Ts(){let $={next:void 0,callback:bs,trampoline:(...J)=>$.callback?.(...J),effect:()=>{$.callback=$.next}};return $}function bs(){}var Jy=R(v(),1),js=[];function c7($){Jy.useEffect($,js)}var jq=0;class T8{static create(){return new T8}currentId=jq;start($,J){this.clear(),this.currentId=setTimeout(()=>{this.currentId=jq,J()},$)}isStarted(){return this.currentId!==jq}clear=()=>{if(this.currentId!==jq)clearTimeout(this.currentId),this.currentId=jq};disposeEffect=()=>{return this.clear}}function B5(){let $=G5(T8.create).current;return c7($.disposeEffect),$}var c1={};n4(c1,{screenReader:()=>x_,os:()=>C_,env:()=>f_,engine:()=>h_});var C_={};n4(C_,{windows:()=>Rs,mac:()=>Xy,linux:()=>Cs,ios:()=>P_,apple:()=>R_,android:()=>qy});function Es(){if(typeof navigator>"u")return{userAgent:"",platform:"",maxTouchPoints:0};return{userAgent:navigator.userAgent,platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}var{userAgent:ys,platform:Ps,maxTouchPoints:Qy}=Es(),W$=ys.toLowerCase(),H$=Ps.toLowerCase();var P_=/^i(os$|p)/.test(H$)||H$==="macintel"&&Qy>1,Zy="android",qy=H$===Zy||W$.includes(Zy),Xy=!P_&&H$.startsWith("mac"),Rs=H$.startsWith("win"),Cs=!qy&&/^(linux|chrome os)/.test(H$),R_=Xy||P_;var h_={};n4(h_,{webkit:()=>S_,gecko:()=>Ss,blink:()=>hs});var S_=typeof CSS<"u"&&!!CSS.supports?.("-webkit-backdrop-filter:none"),Ss=!S_&&W$.includes("firefox"),hs=!S_&&W$.includes("chrom");var x_={};n4(x_,{voiceOver:()=>xs});var xs=R_;var f_={};n4(f_,{jsdom:()=>fs});var fs=/jsdom|happydom/.test(W$);var fK=null,bA0=globalThis.requestAnimationFrame;class Yy{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=($)=>{this.isScheduled=!1;let J=this.callbacks,Q=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,Q>0)for(let Z=0;Z=this.callbacks.length)return;this.callbacks[J]=null,this.callbacksCount-=1}}var vK=new Yy;class _9{static create(){return new _9}static request($){return vK.request($)}static cancel($){return vK.cancel($)}currentId=fK;request($){this.cancel(),this.currentId=vK.request(()=>{this.currentId=fK,$()})}cancel=()=>{if(this.currentId!==fK)vK.cancel(this.currentId),this.currentId=fK};disposeEffect=()=>{return this.cancel}}function S6(){let $=G5(_9.create).current;return c7($.disposeEffect),$}function z1($){return $?.ownerDocument||document}var uK=R(v(),1);var zy={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},gK={...zy,position:"fixed",top:0,left:0},Ky={...zy,position:"absolute"};var L9=uK.forwardRef(function(J,Q){let[Z,q]=uK.useState();return y0(()=>{if(c1.screenReader.voiceOver&&c1.engine.webkit)q("button")},[]),G("span",{...J,ref:Q,style:gK,"aria-hidden":Z?void 0:!0,...{tabIndex:0,role:Z},"data-base-ui-focus-guard":""})});var Eq="data-base-ui-focusable";var v_="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",yq="ArrowLeft",Pq="ArrowRight",g_="ArrowUp",mK="ArrowDown";function v5($){let J=$.activeElement;while(J?.shadowRoot?.activeElement!=null)J=J.shadowRoot.activeElement;return J}function e0($,J){if(!$||!J)return!1;let Q=J.getRootNode?.();if($.contains(J))return!0;if(Q&&l9(Q)){let Z=J;while(Z){if($===Z)return!0;Z=Z.parentNode||Z.host}}return!1}function A5($){if("composedPath"in $)return $.composedPath()[0];return $.target}function d7($,J){if(!V1($))return!1;let Q=$;if(J.hasElement(Q))return!Q.hasAttribute("data-trigger-disabled");for(let[,Z]of J.entries())if(e0(Z,Q))return!Z.hasAttribute("data-trigger-disabled");return!1}function cK($,J){if(J==null)return!1;if("composedPath"in $)return $.composedPath().includes(J);let Q=$;return Q.target!=null&&J.contains(Q.target)}function Gy($){return $.matches("html,body")}function B$($){return R1($)&&$.matches(v_)}function u_($){return $?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${v_}`)!=null}function Rq($){if(!$)return!1;return $.getAttribute("role")==="combobox"&&B$($)}function Wy($){if(!$||c1.env.jsdom)return!0;try{return $.matches(":focus-visible")}catch(J){return!0}}function Cq($){if(!$)return null;return $.hasAttribute(Eq)?$:$.querySelector(`[${Eq}]`)||$}function q6($){$.preventDefault(),$.stopPropagation()}function Hy($){return"nativeEvent"in $}function dK($){if($.pointerType===""&&$.isTrusted)return!0;if(c1.os.android&&$.pointerType)return $.type==="click"&&$.buttons===1;return $.detail===0&&!$.pointerType}function pK($){if(c1.env.jsdom)return!1;return!c1.os.android&&$.width===0&&$.height===0||c1.os.android&&$.width===1&&$.height===1&&$.pressure===0&&$.detail===0&&$.pointerType==="mouse"||$.width<1&&$.height<1&&$.pressure===0&&$.detail===0&&$.pointerType==="touch"}function p7($,J){let Q=["mouse","pen"];if(!J)Q.push("",void 0);return Q.includes($)}function By($){let J=$.type;return J==="click"||J==="mousedown"||J==="keydown"||J==="keyup"}function m_($,J){return J<0||J>=$.length}function lK($,J){return U$($.current,{disabledIndices:J})}function c_($,J){return U$($.current,{decrement:!0,startingIndex:$.current.length,disabledIndices:J})}function U$($,{startingIndex:J=-1,decrement:Q=!1,disabledIndices:Z,amount:q=1}={}){let X=J;do X+=Q?-q:q;while(X>=0&&X<=$.length-1&&d_($,X,Z));return X}function d_($,J,Q){if(typeof Q==="function"?Q(J):Q?.includes(J)??!1)return!0;let q=$[J];if(!q)return!1;if(!_$(q))return!0;return!Q&&(q.hasAttribute("disabled")||q.getAttribute("aria-disabled")==="true")}function vs($){return $.visibility==="hidden"||$.visibility==="collapse"}function _$($,J=$?d5($):null){if(!$||!$.isConnected||!J||vs(J))return!1;if(typeof $.checkVisibility==="function")return $.checkVisibility();return J.display!=="none"&&J.display!=="contents"}var gs='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function us($){let J=$.assignedSlot;if(J)return J;if($.parentElement)return $.parentElement;let Q=$.getRootNode();return l9(Q)?Q.host:null}function l_($){for(let J of Array.from($.children))if(x5(J)==="summary")return J;return null}function ms($,J){let Q=l_(J);return!!Q&&($===Q||e0(Q,$))}function Uy($){let J=$?x5($):"";return $!=null&&$.matches(gs)&&(J!=="summary"||$.parentElement!=null&&x5($.parentElement)==="details"&&l_($.parentElement)===$)&&(J!=="details"||l_($)==null)&&(J!=="input"||$.type!=="hidden")}function _y($){if(!Uy($)||!$.isConnected||$.matches(":disabled"))return!1;for(let J=$;J;J=us(J)){let Q=J!==$,Z=x5(J)==="slot";if(J.hasAttribute("inert"))return!1;if(Q&&x5(J)==="details"&&!J.open&&!ms($,J)||J.hasAttribute("hidden")||!Z&&!cs(J,Q))return!1}return!0}function cs($,J){let Q=d5($);if(!J)return _$($,Q);return Q.display!=="none"}function Ly($){let J=$.tabIndex;if(J<0){let Q=x5($);if(Q==="details"||Q==="audio"||Q==="video"||R1($)&&$.isContentEditable)return 0}return J}function p_($){if(x5($)!=="input")return null;let J=$;return J.type==="radio"&&J.name!==""?J:null}function ds($,J){let Q=p_($);if(!Q)return!0;let Z=J.find((q)=>{let X=p_(q);return X?.name===Q.name&&X.form===Q.form&&X.checked});if(Z)return Z===Q;return J.find((q)=>{let X=p_(q);return X?.name===Q.name&&X.form===Q.form})===Q}function Fy($){if(R1($)&&x5($)==="slot"){let J=$.assignedElements({flatten:!0});if(J.length>0)return J}if(R1($)&&$.shadowRoot)return Array.from($.shadowRoot.children);return Array.from($.children)}function Vy($,J){Fy($).forEach((Q)=>{if(Uy(Q))J.push(Q);Vy(Q,J)})}function My($,J,Q){Fy($).forEach((Z)=>{if(R1(Z)&&Z.matches(J))Q.push(Z);My(Z,J,Q)})}function iK($){return _y($)&&Ly($)>=0}function i_($){let J=[];return Vy($,J),J.filter(_y)}function XQ($){let J=i_($);return J.filter((Q)=>Ly(Q)>=0&&ds(Q,J))}function Dy($,J){let Q=XQ($),Z=Q.length;if(Z===0)return;let q=v5(z1($)),X=Q.indexOf(q),Y=X===-1?J===1?0:Z-1:X+J;return Q[Y]}function YQ($){return Dy(z1($).body,1)||$}function rK($){return Dy(z1($).body,-1)||$}function Ny($,J){if(!$)return null;let Q=XQ(z1($).body),Z=Q.length;if(Z===0)return null;let q=Q.indexOf($);if(q===-1)return null;let X=(q+J+Z)%Z;return Q[X]}function Oy($){return Ny($,1)}function Ay($){return Ny($,-1)}function a4($,J){let Q=J||$.currentTarget,Z=$.relatedTarget;return!Z||!e0(Q,Z)}function wy($){XQ($).forEach((Q)=>{Q.dataset.tabindex=Q.getAttribute("tabindex")||"",Q.setAttribute("tabindex","-1")})}function r_($){let J=[];My($,"[data-tabindex]",J),J.forEach((Q)=>{let Z=Q.dataset.tabindex;if(delete Q.dataset.tabindex,Z)Q.setAttribute("tabindex",Z);else Q.removeAttribute("tabindex")})}function F9($,J,Q=!0){return $.filter((q)=>q.parentId===J).flatMap((q)=>[...!Q||q.context?.open?[q]:[],...F9($,q.id,Q)])}function s_($,J){let Q=[],Z=$.find((q)=>q.id===J)?.parentId;while(Z){let q=$.find((X)=>X.id===Z);if(Z=q?.parentId,q)Q=Q.concat(q)}return Q}var T0={};n4(T0,{windowResize:()=>ko,wheel:()=>Lo,triggerPress:()=>ls,triggerHover:()=>is,triggerFocus:()=>rs,trackPress:()=>$o,swipe:()=>wo,siblingOpen:()=>Mo,scrub:()=>Fo,pointer:()=>Uo,outsidePress:()=>ss,none:()=>ps,missing:()=>No,listNavigation:()=>Ho,linkPress:()=>as,keyboard:()=>Bo,itemPress:()=>os,inputPress:()=>zo,inputPaste:()=>Yo,inputClear:()=>qo,inputChange:()=>Zo,inputBlur:()=>Xo,initial:()=>Oo,incrementPress:()=>Jo,imperativeAction:()=>Ao,focusOut:()=>Ko,escapeKey:()=>Go,drag:()=>_o,disabled:()=>Do,decrementPress:()=>Qo,closeWatcher:()=>Wo,closePress:()=>ns,clearPress:()=>ts,chipRemovePress:()=>es,cancelOpen:()=>Vo});var ps="none",ls="trigger-press",is="trigger-hover",rs="trigger-focus",ss="outside-press",os="item-press",ns="close-press",as="link-press",ts="clear-press",es="chip-remove-press",$o="track-press",Jo="increment-press",Qo="decrement-press",Zo="input-change",qo="input-clear",Xo="input-blur",Yo="input-paste",zo="input-press",Ko="focus-out",Go="escape-key",Wo="close-watcher",Ho="list-navigation",Bo="keyboard",Uo="pointer",_o="drag",Lo="wheel",Fo="scrub",Vo="cancel-open",Mo="sibling-open",Do="disabled",No="missing",Oo="initial",Ao="imperative-action",wo="swipe",ko="window-resize";function l0($,J,Q,Z){let q=!1,X=!1,Y=Z??I1;return{reason:$,event:J??new Event("base-ui"),cancel(){q=!0},allowPropagation(){X=!0},get isCanceled(){return q},get isPropagationAllowed(){return X},trigger:Q,...Y}}function h9($,J,Q){let Z=Q??I1;return{reason:$,event:J??new Event("base-ui"),...Z}}function t4($){return`data-base-ui-${$}`}var sK=0;function zQ($,J={}){let{preventScroll:Q=!1,sync:Z=!1,shouldFocus:q}=J;cancelAnimationFrame(sK);function X(){if(q&&!q())return;$?.focus({preventScroll:Q})}if(Z)return X(),m1;let Y=requestAnimationFrame(X);return sK=Y,()=>{if(sK===Y)cancelAnimationFrame(Y),sK=0}}var o_={inert:new WeakMap,"aria-hidden":new WeakMap},ky="data-base-ui-inert",a_={inert:new WeakSet,"aria-hidden":new WeakSet},Sq=new WeakMap,n_=0;function Io($){return a_[$]}function jy($){if(!$)return null;return l9($)?$.host:jy($.parentNode)}var Iy=($,J)=>J.map((Q)=>{if($.contains(Q))return Q;let Z=jy(Q);if($.contains(Z))return Z;return null}).filter((Q)=>Q!=null),Ty=($)=>{let J=new Set;return $.forEach((Q)=>{let Z=Q;while(Z&&!J.has(Z))J.add(Z),Z=Z.parentNode}),J},by=($,J,Q)=>{let Z=[],q=(X)=>{if(!X||Q.has(X))return;Array.from(X.children).forEach((Y)=>{if(x5(Y)==="script")return;if(J.has(Y))q(Y);else Z.push(Y)})};return q($),Z};function To($,J,Q,Z,{mark:q=!0}){let X=null;if(Z)X="inert";else if(Q)X="aria-hidden";let Y=null,z=null,K=Iy(J,$),W=q?by(J,Ty(K),new Set(K)):[],H=[],B=[];if(X){let U=o_[X],_=Io(X);z=_,Y=U;let L=Iy(J,Array.from(J.querySelectorAll("[aria-live]"))),F=K.concat(L);by(J,Ty(F),new Set(F)).forEach((M)=>{let D=M.getAttribute(X),N=D!==null&&D!=="false",O=(U.get(M)||0)+1;if(U.set(M,O),H.push(M),O===1&&N)_.add(M);if(!N)M.setAttribute(X,X==="inert"?"":"true")})}if(q)W.forEach((U)=>{let _=(Sq.get(U)||0)+1;if(Sq.set(U,_),B.push(U),_===1)U.setAttribute(ky,"")});return n_+=1,()=>{if(Y)H.forEach((U)=>{let L=(Y.get(U)||0)-1;if(Y.set(U,L),!L){if(!z?.has(U)&&X)U.removeAttribute(X);z?.delete(U)}});if(q)B.forEach((U)=>{let _=(Sq.get(U)||0)-1;if(Sq.set(U,_),!_)U.removeAttribute(ky)});if(n_-=1,!n_)o_.inert=new WeakMap,o_["aria-hidden"]=new WeakMap,a_.inert=new WeakSet,a_["aria-hidden"]=new WeakSet,Sq=new WeakMap}}function t_($,J={}){let{ariaHidden:Q=!1,inert:Z=!1,mark:q=!0}=J,X=z1($[0]).body;return To($,X,Q,Z,{mark:q})}var y5=R(v(),1),qL=R($5(),1);var oK=R(v(),1);var Ey=0;function bo($,J="mui"){let[Q,Z]=oK.useState($),q=$||Q;return oK.useEffect(()=>{if(Q==null)Ey+=1,Z(`${J}-${Ey}`)},[Q,J]),q}var yy=bq.useId;function h6($,J){if(yy!==void 0){let Q=yy();return $??(J?`${J}-${Q}`:Q)}return bo($,J)}function jo($,J){return function(Z,...q){let X=new URL($);return X.searchParams.set("code",Z.toString()),q.forEach((Y)=>X.searchParams.append("args[]",Y)),`${J} error #${Z}; visit ${X} for the full message.`}}var Eo=jo("https://base-ui.com/production-error","Base UI"),M1=Eo;var l7=R(v(),1);var Ry=R(v(),1);var Py=R(v(),1),yo=parseInt(Py.version,10);function KQ($){return yo>=$}function e_($){if(!Ry.isValidElement($))return null;let J=$,Q=J.props;return(KQ(19)?Q?.ref:J.ref)??null}function hq($,J){if($&&!J)return $;if(!$&&J)return J;if($||J)return{...$,...J};return}function Cy($,J){let Q={};for(let Z in $){let q=$[Z];if(J?.hasOwnProperty(Z)){let X=J[Z](q);if(X!=null)Object.assign(Q,X);continue}if(q===!0)Q[`data-${Z.toLowerCase()}`]="";else if(q)Q[`data-${Z.toLowerCase()}`]=q.toString()}return Q}function Sy($,J){return typeof $==="function"?$(J):$}function hy($,J){return typeof $==="function"?$(J):$}var $L={};function S8($,J,Q,Z,q){if(!Q&&!Z&&!q&&!$)return nK(J);let X=nK($);if(J)X=xq(X,J);if(Q)X=xq(X,Q);if(Z)X=xq(X,Z);if(q)X=xq(X,q);return X}function xy($){if($.length===0)return $L;if($.length===1)return nK($[0]);let J=nK($[0]);for(let Q=1;Q<$.length;Q+=1)J=xq(J,$[Q]);return J}function nK($){if(JL($))return{...vy($,$L)};return Po($)}function xq($,J){if(JL(J))return vy(J,$);return Ro($,J)}function Po($){let J={...$};for(let Q in J){let Z=J[Q];if(fy(Q,Z))J[Q]=gy(Z)}return J}function Ro($,J){if(!J)return $;for(let Q in J){let Z=J[Q];switch(Q){case"style":{$[Q]=hq($.style,Z);break}case"className":{$[Q]=QL($.className,Z);break}default:if(fy(Q,Z))$[Q]=Co($[Q],Z);else $[Q]=Z}}return $}function fy($,J){let Q=$.charCodeAt(0),Z=$.charCodeAt(1),q=$.charCodeAt(2);return Q===111&&Z===110&&q>=65&&q<=90&&(typeof J==="function"||typeof J>"u")}function JL($){return typeof $==="function"}function vy($,J){if(JL($))return $(J);return $??$L}function Co($,J){if(!J)return $;if(!$)return gy(J);return(...Q)=>{let Z=Q[0];if(uy(Z)){let X=Z;fq(X);let Y=J(...Q);if(!X.baseUIHandlerPrevented)$?.(...Q);return Y}let q=J(...Q);return $?.(...Q),q}}function gy($){if(!$)return $;return(...J)=>{let Q=J[0];if(uy(Q))fq(Q);return $(...J)}}function fq($){return $.preventBaseUIHandler=()=>{$.baseUIHandlerPrevented=!0},$}function QL($,J){if(J){if($)return J+" "+$;return J}return $}function uy($){return $!=null&&typeof $==="object"&&"nativeEvent"in $}var ZL=R(v(),1);function o0($,J,Q={}){let Z=J.render,q=So(J,Q);if(Q.enabled===!1)return null;let X=Q.state??I1;return fo($,Z,q,X)}function So($,J={}){let{className:Q,style:Z,render:q}=$,{state:X=I1,ref:Y,props:z,stateAttributesMapping:K,enabled:W=!0}=J,H=W?Sy(Q,X):void 0,B=W?hy(Z,X):void 0,U=W?Cy(X,K):I1,_=W&&z?ho(z):void 0,L=W?hq(U,_)??{}:I1;if(typeof document<"u")if(!W)U9(null,null);else if(Array.isArray(Y))L.ref=aE([L.ref,e_(q),...Y]);else L.ref=U9(L.ref,e_(q),Y);if(!W)return I1;if(H!==void 0)L.className=QL(L.className,H);if(B!==void 0)L.style=hq(L.style,B);return L}function ho($){if(Array.isArray($))return xy($);return S8(void 0,$)}var xo=Symbol.for("react.lazy");function fo($,J,Q,Z){if(J){if(typeof J==="function")return J(Q,Z);let q=S8(Q,J.props);q.ref=Q.ref;let X=J;if(X?.$$typeof===xo)X=l7.Children.toArray(J)[0];return l7.cloneElement(X,q)}if($){if(typeof $==="string")return vo($,Q)}throw Error(M1(8))}function vo($,J){if($==="button")return ZL.createElement("button",{type:"button",...J,key:J.key});if($==="img")return ZL.createElement("img",{alt:"",...J,key:J.key});return l7.createElement($,J)}var my=500,aK=500,cy={style:{transition:"none"}},tK="data-base-ui-click-trigger";var dy={fallbackAxisSide:"none"},eK={fallbackAxisSide:"end"},py={clipPath:"inset(50%)",position:"fixed",top:0,left:0};var ly=y5.createContext(null),XL=()=>y5.useContext(ly),go=t4("portal");function iy($={}){let{ref:J,container:Q,componentProps:Z=I1,elementProps:q}=$,X=h6(),z=XL()?.portalNode,[K,W]=y5.useState(null),[H,B]=y5.useState(null),U=g0((V)=>{if(V!==null)B(V)}),_=y5.useRef(null);y0(()=>{if(Q===null){if(_.current)_.current=null,B(null),W(null);return}if(X==null)return;let V=(Q&&(VX(Q)?Q:Q.current))??z??document.body;if(V==null){if(_.current)_.current=null,B(null),W(null);return}if(_.current!==V)_.current=V,B(null),W(V)},[Q,z,X]);let L=o0("div",Z,{ref:[J,U],props:[{id:X,[go]:""},q]});return{portalNode:H,portalSubtree:K&&L?qL.createPortal(L,K):null}}var vq=y5.forwardRef(function(J,Q){let{render:Z,className:q,style:X,children:Y,container:z,renderGuards:K,...W}=J,{portalNode:H,portalSubtree:B}=iy({container:z,ref:Q,componentProps:J,elementProps:W}),U=y5.useRef(null),_=y5.useRef(null),L=y5.useRef(null),F=y5.useRef(null),[V,M]=y5.useState(null),D=y5.useRef(!1),N=V?.modal,O=V?.open,I=typeof K==="boolean"?K:!!V&&!V.modal&&V.open&&!!H;y5.useEffect(()=>{if(!H||N)return;function T(A){if(H&&A.relatedTarget&&a4(A))if(A.type==="focusin"){if(D.current)r_(H),D.current=!1}else wy(H),D.current=!0}return I8(_1(H,"focusin",T,!0),_1(H,"focusout",T,!0))},[H,N]),y0(()=>{if(!H||O!==!0||!D.current)return;r_(H),D.current=!1},[O,H]);let k=y5.useMemo(()=>({beforeOutsideRef:U,afterOutsideRef:_,beforeInsideRef:L,afterInsideRef:F,portalNode:H,setFocusManagerState:M}),[H]);return b(y5.Fragment,{children:[B,b(ly.Provider,{value:k,children:[I&&H&&G(L9,{"data-type":"outside",ref:U,onFocus:(T)=>{if(a4(T,H))L.current?.focus();else{let A=V?V.domReference:null;rK(A)?.focus()}}}),I&&H&&G("span",{"aria-owns":H.id,style:py}),H&&qL.createPortal(Y,H),I&&H&&G(L9,{"data-type":"outside",ref:_,onFocus:(T)=>{if(a4(T,H))F.current?.focus();else{let A=V?V.domReference:null;if(YQ(A)?.focus(),V?.closeOnFocusOut)V?.onOpenChange(!1,l0(T0.focusOut,T.nativeEvent))}}})]})]})});var i7=R(v(),1);function $G(){let $=new Map;return{emit(J,Q){$.get(J)?.forEach((Z)=>Z(Q))},on(J,Q){if(!$.has(J))$.set(J,new Set);$.get(J).add(Q)},off(J,Q){$.get(J)?.delete(Q)}}}class L${nodesRef={current:[]};events=$G();addNode($){this.nodesRef.current.push($)}removeNode($){let J=this.nodesRef.current.findIndex((Q)=>Q===$);if(J!==-1)this.nodesRef.current.splice(J,1)}}var ry=i7.createContext(null),sy=i7.createContext(null),h8=()=>i7.useContext(ry)?.id||null,d8=($)=>{let J=i7.useContext(sy);return $??J};function F$($){let J=h6(),Q=d8($),Z=h8();return y0(()=>{if(!J)return;let q={id:J,parentId:Z};return Q?.addNode(q),()=>{Q?.removeNode(q)}},[Q,J,Z]),J}function gq($){let{children:J,id:Q}=$,Z=h8();return G(ry.Provider,{value:i7.useMemo(()=>({id:Q,parentId:Z}),[Q,Z]),children:J})}function uq($){let{children:J,externalTree:Q}=$,Z=G5(()=>Q??new L$).current;return G(sy.Provider,{value:Z,children:J})}function x9($){if($==null)return $;return"current"in $?$.current:$}function uo($,J){let Q=S1(A5($));if($ instanceof Q.KeyboardEvent)return"keyboard";if($ instanceof Q.FocusEvent)return J||"keyboard";if("pointerType"in $)return $.pointerType||"keyboard";if("touches"in $)return"touch";if($ instanceof Q.MouseEvent)return J||($.detail===0?"keyboard":"mouse");return""}var oy=20,r7=[];function YL(){r7=r7.filter(($)=>{return $.deref()?.isConnected})}function ny($){if(YL(),$&&x5($)!=="body"){if(r7.push(new WeakRef($)),r7.length>oy)r7=r7.slice(-oy)}}function ay(){return YL(),r7[r7.length-1]?.deref()}function mo($){if(!$)return null;if(iK($))return $;return XQ($)[0]||$}function ty($){if($.hasAttribute("tabindex")&&!$.hasAttribute("data-tabindex"))return;if(!$.getAttribute("role")?.includes("dialog"))return;let Q=i_($).filter((q)=>{let X=q.getAttribute("data-tabindex")||"";return iK(q)||q.hasAttribute("data-tabindex")&&!X.startsWith("-")}),Z=$.getAttribute("tabindex");if(Q.length===0){if(Z!=="0")$.setAttribute("tabindex","0"),$.setAttribute("data-tabindex","0")}else if(Z!=="-1"||$.hasAttribute("data-tabindex")&&$.getAttribute("data-tabindex")!=="-1")$.setAttribute("tabindex","-1"),$.setAttribute("data-tabindex","-1")}function mq($){let{context:J,children:Q,disabled:Z=!1,initialFocus:q=!0,returnFocus:X=!0,restoreFocus:Y=!1,modal:z=!0,closeOnFocusOut:K=!0,openInteractionType:W="",nextFocusableElement:H,previousFocusableElement:B,beforeContentFocusGuardRef:U,externalTree:_,getInsideElements:L}=$,F="rootStore"in J?J.rootStore:J,V=F.useState("open"),M=F.useState("domReferenceElement"),D=F.useState("floatingElement"),{events:N,dataRef:O}=F.context,I=g0(()=>O.current.floatingContext?.nodeId),k=q===!1,T=Rq(M)&&k,A=_5(q),w=_5(X),C=_5(W),y=_5(V),x=d8(_),j=XL(),P=p8.useRef(!1),h=p8.useRef(!1),l=p8.useRef(!1),t=p8.useRef(null),S=p8.useRef(""),i=p8.useRef(""),J0=p8.useRef(null),K0=p8.useRef(null),e=U9(J0,U,j?.beforeInsideRef),H0=U9(K0,j?.afterInsideRef),q0=B5(),E=B5(),d=S6(),c=j!=null,r=Cq(D),u=g0((f=r)=>{return f?XQ(f):[]}),m=g0(()=>L?.().filter((f)=>f!=null)??[]);p8.useEffect(()=>{if(Z||!z)return;function f(G0){if(G0.key==="Tab"){if(e0(r,v5(z1(r)))&&u().length===0&&!T)q6(G0)}}let o=z1(r);return _1(o,"keydown",f)},[Z,r,z,T,u]),p8.useEffect(()=>{if(Z||!V)return;let f=z1(r);function o(){l.current=!1}function G0(Z0){let Q0=A5(Z0),B0=m(),W0=e0(D,Q0)||e0(M,Q0)||e0(j?.portalNode,Q0)||B0.some((L0)=>L0===Q0||e0(L0,Q0));if(l.current=!W0,i.current=Z0.pointerType||"keyboard",Q0?.closest(`[${tK}]`))h.current=!0,E.start(0,()=>{h.current=!1})}function p(){i.current="keyboard"}return I8(_1(f,"pointerdown",G0,!0),_1(f,"pointerup",o,!0),_1(f,"pointercancel",o,!0),_1(f,"keydown",p,!0),o)},[Z,D,M,r,V,j,E,m]),p8.useEffect(()=>{if(Z||!K)return;let f=z1(r);function o(){h.current=!0,E.start(0,()=>{h.current=!1})}function G0(B0){let W0=A5(B0);if(iK(W0))t.current=W0}function p(B0){let{relatedTarget:W0,currentTarget:L0}=B0,_0=A5(B0);if(z&&W0==null&&_0!=null&&e0(D,_0))ny(_0);queueMicrotask(()=>{let N0=I(),d0=F.context.triggerElements,g=m(),a=W0?.hasAttribute(t4("focus-guard"))&&[J0.current,K0.current,j?.beforeInsideRef.current,j?.afterInsideRef.current,j?.beforeOutsideRef.current,j?.afterOutsideRef.current,x9(B),x9(H)].includes(W0),I0=!(e0(M,W0)||e0(D,W0)||e0(W0,D)||e0(j?.portalNode,W0)||g.some((w0)=>w0===W0||e0(w0,W0))||W0!=null&&d0.hasElement(W0)||d0.hasMatchingElement((w0)=>e0(w0,W0))||a||x&&(F9(x.nodesRef.current,N0).find((w0)=>e0(w0.context?.elements.floating,W0)||e0(w0.context?.elements.domReference,W0))||s_(x.nodesRef.current,N0).find((w0)=>[w0.context?.elements.floating,Cq(w0.context?.elements.floating)].includes(W0)||w0.context?.elements.domReference===W0)));if(L0===M&&r)ty(r);if(Y&&L0!==M&&!_$(_0)&&v5(f)===f.body){if(R1(r)){if(r.focus(),Y==="popup"){d.request(()=>{r.focus()});return}}let w0=u(),F0=t.current,u0=(F0&&w0.includes(F0)?F0:null)||w0[w0.length-1]||r;if(R1(u0))u0.focus()}if(O.current.insideReactTree){O.current.insideReactTree=!1;return}if((T?!0:!z)&&W0&&I0&&!h.current&&(T||W0!==ay()))P.current=!0,F.setOpen(!1,l0(T0.focusOut,B0))})}function Z0(){if(l.current)return;O.current.insideReactTree=!0,q0.start(0,()=>{O.current.insideReactTree=!1})}let Q0=R1(M)?M:null;if(!D&&!Q0)return;return I8(Q0&&_1(Q0,"focusout",p),Q0&&_1(Q0,"pointerdown",o),D&&_1(D,"focusin",G0),D&&_1(D,"focusout",p),D&&j&&_1(D,"focusout",Z0,!0))},[Z,M,D,r,z,x,j,F,K,Y,u,T,I,O,q0,E,d,H,B,m]),p8.useEffect(()=>{if(Z||!D||!V)return;let f=Array.from(j?.portalNode?.querySelectorAll(`[${t4("portal")}]`)||[]),G0=(x?s_(x.nodesRef.current,I()):[]).find((L0)=>Rq(L0.context?.elements.domReference||null))?.context?.elements.domReference,Z0=[...[D,...f,J0.current,K0.current,j?.beforeOutsideRef.current,j?.afterOutsideRef.current,...m()],G0,x9(B),x9(H),T?M:null].filter((L0)=>L0!=null),Q0=t_(Z0,{ariaHidden:z||T,mark:!1}),B0=[D,...f].filter((L0)=>L0!=null),W0=t_(B0);return()=>{W0(),Q0()}},[V,Z,M,D,z,j,T,x,I,H,B,m]),y0(()=>{if(!V||Z||!R1(r))return;let f=z1(r),o=v5(f);queueMicrotask(()=>{let G0=A.current,p=typeof G0==="function"?G0(C.current||""):G0;if(p===void 0||p===!1)return;if(e0(r,o))return;let Q0=null,B0=()=>{if(Q0==null)Q0=u(r);return Q0[0]||r},W0;if(p===!0||p===null)W0=B0();else W0=x9(p);W0=W0||B0();let L0=e0(r,v5(f));zQ(W0,{preventScroll:W0===r,shouldFocus(){if(!y.current)return!1;if(L0)return!0;let _0=v5(f);return!(_0!==W0&&e0(r,_0))}})})},[Z,V,r,u,A,C,y]),y0(()=>{if(Z||!r)return;let f=z1(r),o=v5(f),G0=C.current==null;ny(o);function p(Q0){if(!Q0.open)S.current=uo(Q0.nativeEvent,i.current);if(Q0.reason===T0.triggerHover&&Q0.nativeEvent.type==="mouseleave")P.current=!0;if(Q0.reason!==T0.outsidePress)return;if(Q0.nested)P.current=!1;else if(dK(Q0.nativeEvent)||pK(Q0.nativeEvent))P.current=!1;else{let B0=!1;if(z1(r).createElement("div").focus({get preventScroll(){return B0=!0,!1}}),B0)P.current=!1;else P.current=!0}}N.on("openchange",p);function Z0(){let Q0=w.current,B0=typeof Q0==="function"?Q0(S.current):Q0;if(B0===void 0||B0===!1)return null;if(B0===null)B0=!0;let W0=M?.isConnected?M:null,L0=o?.isConnected&&x5(o)!=="body"?o:null,_0=G0?L0||W0:W0||L0;if(!_0)_0=ay()||null;if(typeof B0==="boolean")return _0;return x9(B0)||_0||null}return()=>{N.off("openchange",p);let Q0=v5(f),B0=m(),W0=e0(D,Q0)||B0.some((N0)=>N0===Q0||e0(N0,Q0))||x&&F9(x.nodesRef.current,I(),!1).some((N0)=>e0(N0.context?.elements.floating,Q0)),L0=w.current,_0=Z0();queueMicrotask(()=>{let N0=mo(_0),d0=typeof L0!=="boolean";if(L0&&!P.current&&R1(N0)&&(!d0&&N0!==Q0&&Q0!==f.body?W0:!0))N0.focus({preventScroll:!0});P.current=!1})}},[Z,D,r,w,C,N,x,M,I,m]),y0(()=>{if(!c1.engine.webkit||V||!D)return;let f=v5(z1(D));if(!R1(f)||!B$(f))return;if(e0(D,f))f.blur()},[V,D]),y0(()=>{if(Z||!j)return;return j.setFocusManagerState({modal:z,closeOnFocusOut:K,open:V,onOpenChange:F.setOpen,domReference:M}),()=>{j.setFocusManagerState(null)}},[Z,j,z,V,F,K,M]),y0(()=>{if(Z||!r)return;return ty(r),()=>{queueMicrotask(YL)}},[Z,r]);let s=!Z&&(z?!T:!0)&&(c||z);return b(p8.Fragment,{children:[s&&G(L9,{"data-type":"inside",ref:e,onFocus:(f)=>{if(z){let o=u();zQ(o[o.length-1])}else if(j?.portalNode)if(P.current=!1,a4(f,j.portalNode))YQ(M)?.focus();else x9(B??j.beforeOutsideRef)?.focus()}}),Q,s&&G(L9,{"data-type":"inside",ref:H0,onFocus:(f)=>{if(z)zQ(u()[0]);else if(j?.portalNode){if(K)P.current=!0;if(a4(f,j.portalNode))rK(M)?.focus();else x9(H??j.afterOutsideRef)?.focus()}}})]})}var cq=R(v(),1);function V$($,J={}){let{enabled:Q=!0,event:Z="click",toggle:q=!0,ignoreMouse:X=!1,stickIfOpen:Y=!0,touchOpenDelay:z=0,reason:K=T0.triggerPress}=J,W="rootStore"in $?$.rootStore:$,H=W.context.dataRef,B=cq.useRef(void 0),U=S6(),_=B5(),L=cq.useMemo(()=>{function F(M,D,N,O){let I=l0(K,D,N);if(M&&O==="touch"&&z>0)_.start(z,()=>{W.setOpen(!0,I)});else W.setOpen(M,I)}function V(M,D,N){let O=H.current.openEvent,I=W.select("domReferenceElement")!==D;if(M&&I)return!0;if(!M)return!0;if(!q)return!0;if(O&&Y)return!N(O.type);return!1}return{onPointerDown(M){B.current=M.pointerType},onMouseDown(M){let D=B.current,N=M.nativeEvent,O=W.select("open");if(M.button!==0||Z==="click"||p7(D,!0)&&X)return;let I=V(O,M.currentTarget,(A)=>A==="click"||A==="mousedown"),k=A5(N);if(B$(k)){F(I,N,k,D);return}let T=M.currentTarget;U.request(()=>{F(I,N,T,D)})},onClick(M){if(Z==="mousedown-only")return;let D=B.current;if(Z==="mousedown"&&D){B.current=void 0;return}if(p7(D,!0)&&X)return;let N=W.select("open"),O=V(N,M.currentTarget,(I)=>I==="click"||I==="mousedown"||I==="keydown"||I==="keyup");F(O,M.nativeEvent,M.currentTarget,D)},onKeyDown(){B.current=void 0}}},[H,Z,X,K,W,Y,q,U,_,z]);return cq.useMemo(()=>Q?{reference:L}:I1,[Q,L])}var A6=R(v(),1);function co(){return!1}function po($){return{escapeKey:typeof $==="boolean"?$:$?.escapeKey??!1,outsidePress:typeof $==="boolean"?$:$?.outsidePress??!0}}function dq($,J={}){let{enabled:Q=!0,escapeKey:Z=!0,outsidePress:q=!0,outsidePressEvent:X="sloppy",referencePress:Y=co,bubbles:z,externalTree:K}=J,W="rootStore"in $?$.rootStore:$,H=W.useState("open"),B=W.useState("floatingElement"),{dataRef:U}=W.context,_=d8(K),L=g0(typeof q==="function"?q:()=>!1),F=typeof q==="function"?L:q,V=F!==!1,M=g0(()=>X),{escapeKey:D,outsidePress:N}=po(z),O=A6.useRef(!1),I=A6.useRef(!1),k=A6.useRef(!1),T=A6.useRef(!1),A=A6.useRef(""),w=A6.useRef(null),C=B5(),y=B5(),x=g0(()=>{y.clear(),U.current.insideReactTree=!1}),j=g0((e)=>{let H0=U.current.floatingContext?.nodeId;return(_?F9(_.nodesRef.current,H0):[]).some((E)=>E.context?.open&&!E.context.dataRef.current[e])}),P=g0((e)=>{return cK(e,W.select("floatingElement"))||cK(e,W.select("domReferenceElement"))}),h=g0((e)=>{if(!Y())return;W.setOpen(!1,l0(T0.triggerPress,e.nativeEvent))}),l=g0((e)=>{if(!H||!Q||!Z||e.key!=="Escape")return;if(T.current)return;if(!D&&j("__escapeKeyBubbles"))return;let H0=Hy(e)?e.nativeEvent:e,q0=l0(T0.escapeKey,H0);if(W.setOpen(!1,q0),!q0.isCanceled)e.preventDefault();if(!D&&!q0.isPropagationAllowed)e.stopPropagation()}),t=g0(()=>{U.current.insideReactTree=!0,y.start(0,x)}),S=g0((e)=>{if(!H||!Q||e.button!==0)return;let H0=A5(e.nativeEvent);if(!e0(W.select("floatingElement"),H0))return;if(!O.current)O.current=!0,I.current=!1}),i=g0((e)=>{if(!H||!Q)return;if(!(e.defaultPrevented||e.nativeEvent.defaultPrevented))return;if(O.current)I.current=!0});A6.useEffect(()=>{if(!H||!Q)return;U.current.__escapeKeyBubbles=D,U.current.__outsidePressBubbles=N;let e=new T8,H0=new T8;function q0(){e.clear(),T.current=!0}function E(){e.start(c1.engine.webkit?5:0,()=>{T.current=!1})}function d(){k.current=!0,H0.start(0,()=>{k.current=!1})}function c(){O.current=!1,I.current=!1}function r(){let g=A.current,a=g==="pen"||!g?"mouse":g,I0=M(),w0=typeof I0==="function"?I0():I0;if(typeof w0==="string")return w0;return w0[a]}function u(g){let a=r();return a==="intentional"&&g.type!=="click"||a==="sloppy"&&g.type==="click"}function m(g){let a=U.current.floatingContext?.nodeId,I0=_&&F9(_.nodesRef.current,a).some((w0)=>cK(g,w0.context?.elements.floating));return P(g)||I0}function s(g){if(u(g)){if(g.type!=="click"&&!P(g))H0.clear(),k.current=!1;x();return}if(U.current.insideReactTree){x();return}let a=A5(g),I0=`[${t4("inert")}]`,w0=V1(a)?a.getRootNode():null,F0=Array.from((l9(w0)?w0:z1(W.select("floatingElement"))).querySelectorAll(I0)),u0=W.context.triggerElements;if(a&&(u0.hasElement(a)||u0.hasMatchingElement((n0)=>e0(n0,a))))return;let P0=V1(a)?a:null;while(P0&&!j6(P0)){let n0=b6(P0);if(j6(n0)||!V1(n0))break;P0=n0}if(F0.length&&V1(a)&&!Gy(a)&&!e0(a,W.select("floatingElement"))&&F0.every((n0)=>!e0(P0,n0)))return;if(R1(a)&&!("touches"in g)){let n0=j6(a),R0=d5(a),Z1=/auto|scroll/,K1=n0||Z1.test(R0.overflowX),a0=n0||Z1.test(R0.overflowY),T1=K1&&a.clientWidth>0&&a.scrollWidth>a.clientWidth,v1=a0&&a.clientHeight>0&&a.scrollHeight>a.clientHeight,E1=R0.direction==="rtl",n=v1&&(E1?g.offsetX<=a.offsetWidth-a.clientWidth:g.offsetX>a.clientWidth),D0=T1&&g.offsetY>a.clientHeight;if(n||D0)return}if(m(g))return;if(r()==="intentional"&&k.current){H0.clear(),k.current=!1;return}if(typeof F==="function"&&!F(g))return;if(j("__outsidePressBubbles"))return;W.setOpen(!1,l0(T0.outsidePress,g)),x()}function f(g){if(r()!=="sloppy"||g.pointerType==="touch"||!W.select("open")||!Q||P(g))return;s(g)}function o(g){if(r()!=="sloppy"||!W.select("open")||!Q||P(g))return;let a=g.touches[0];if(a)w.current={startTime:Date.now(),startX:a.clientX,startY:a.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},C.start(1000,()=>{if(w.current)w.current.dismissOnTouchEnd=!1,w.current.dismissOnMouseDown=!1})}function G0(g,a){let I0=A5(g);if(!I0)return;let w0=_1(I0,g.type,()=>{a(g),w0()})}function p(g){A.current="touch",G0(g,o)}function Z0(g){if(C.clear(),g.type==="pointerdown")A.current=g.pointerType;if(g.type==="mousedown"&&w.current&&!w.current.dismissOnMouseDown)return;G0(g,(a)=>{if(a.type==="pointerdown")f(a);else s(a)})}function Q0(g){if(!O.current)return;let a=I.current;if(c(),r()!=="intentional")return;if(g.type==="pointercancel"){if(a)d();return}if(m(g))return;if(a){d();return}if(typeof F==="function"&&!F(g))return;H0.clear(),k.current=!0,x()}function B0(g){if(r()!=="sloppy"||!w.current||P(g))return;let a=g.touches[0];if(!a)return;let I0=Math.abs(a.clientX-w.current.startX),w0=Math.abs(a.clientY-w.current.startY),F0=Math.sqrt(I0*I0+w0*w0);if(F0>5)w.current.dismissOnTouchEnd=!0;if(F0>10)s(g),C.clear(),w.current=null}function W0(g){G0(g,B0)}function L0(g){if(r()!=="sloppy"||!w.current||P(g))return;if(w.current.dismissOnTouchEnd)s(g);C.clear(),w.current=null}function _0(g){G0(g,L0)}let N0=z1(B),d0=I8(Z&&I8(_1(N0,"keydown",l),_1(N0,"compositionstart",q0),_1(N0,"compositionend",E)),V&&I8(_1(N0,"click",Z0,!0),_1(N0,"pointerdown",Z0,!0),_1(N0,"pointerup",Q0,!0),_1(N0,"pointercancel",Q0,!0),_1(N0,"mousedown",Z0,!0),_1(N0,"mouseup",Q0,!0),_1(N0,"touchstart",p,!0),_1(N0,"touchmove",W0,!0),_1(N0,"touchend",_0,!0)));return()=>{d0(),e.clear(),H0.clear(),c(),k.current=!1}},[U,B,Z,V,F,H,Q,D,N,l,x,M,j,P,_,W,C]),A6.useEffect(x,[F,x]);let J0=A6.useMemo(()=>({onKeyDown:l,onPointerDown:h,onClick:h}),[l,h]),K0=A6.useMemo(()=>({onKeyDown:l,onPointerDown:i,onMouseDown:i,onClickCapture:t,onMouseDownCapture(e){t(),S(e)},onPointerDownCapture(e){t(),S(e)},onMouseUpCapture:t,onTouchEndCapture:t,onTouchMoveCapture:t}),[l,t,S,i]);return A6.useMemo(()=>Q?{reference:J0,floating:K0,trigger:J0}:{},[Q,J0,K0])}var l8=R(v(),1);var WQ=R(v(),1),Nn=R($5(),1);var ey=R(v(),1);function $P($){let J=ey.useRef(!0);if(J.current)J.current=!1,$()}var zP=R(v(),1);var J1=($,J,Q,Z,q,X,...Y)=>{if(Y.length>0)throw Error(M1(1));let z;if($&&J&&Q&&Z&&q&&X)z=(K,W,H,B)=>{let U=$(K,W,H,B),_=J(K,W,H,B),L=Q(K,W,H,B),F=Z(K,W,H,B),V=q(K,W,H,B);return X(U,_,L,F,V,W,H,B)};else if($&&J&&Q&&Z&&q)z=(K,W,H,B)=>{let U=$(K,W,H,B),_=J(K,W,H,B),L=Q(K,W,H,B),F=Z(K,W,H,B);return q(U,_,L,F,W,H,B)};else if($&&J&&Q&&Z)z=(K,W,H,B)=>{let U=$(K,W,H,B),_=J(K,W,H,B),L=Q(K,W,H,B);return Z(U,_,L,W,H,B)};else if($&&J&&Q)z=(K,W,H,B)=>{let U=$(K,W,H,B),_=J(K,W,H,B);return Q(U,_,W,H,B)};else if($&&J)z=(K,W,H,B)=>{let U=$(K,W,H,B);return J(U,W,H,B)};else if($)z=$;else throw Error("Missing arguments");return z};var XP=R(v(),1),UL=R(KL(),1);var s7=R(v(),1),Zn=KL();function qn($,J){return $===J&&($!==0||1/$===1/J)||$!==$&&J!==J}var Xn=typeof Object.is==="function"?Object.is:qn,Yn=Zn.useSyncExternalStore,zn=s7.useRef,Kn=s7.useEffect,Gn=s7.useMemo,Wn=s7.useDebugValue;var GL=function($,J,Q,Z,q){var X=zn(null);if(X.current===null){var Y={hasValue:!1,value:null};X.current=Y}else Y=X.current;X=Gn(function(){function K(_){if(!W){if(W=!0,H=_,_=Z(_),q!==void 0&&Y.hasValue){var L=Y.value;if(q(L,_))return B=L}return B=_}if(L=B,Xn(H,_))return L;var F=Z(_);if(q!==void 0&&q(L,F))return H=_,L;return H=_,B=F}var W=!1,H,B,U=Q===void 0?null:Q;return[function(){return K(J())},U===null?void 0:function(){return K(U())}]},[J,Q,Z,q]);var z=Yn($,X[0],X[1]);return Kn(function(){Y.hasValue=!0,Y.value=z},[z]),Wn(z),z};var JP=R(v(),1);var WL=[],HL=void 0;function QP(){return HL}function ZP($){WL.push($)}function BL($){let J=(Q,Z)=>{let q=G5(Hn).current,X;try{HL=q;for(let Y of WL)Y.before(q);X=$(Q,Z);for(let Y of WL)Y.after(q);q.didInitialize=!0}finally{HL=void 0}return X};return J.displayName=$.displayName||$.name,J}function qP($){return JP.forwardRef(BL($))}function Hn(){return{didInitialize:!1}}var Bn=KQ(19),Un=Bn?Ln:Fn;function JG($,J,Q,Z,q){return Un($,J,Q,Z,q)}function _n($,J,Q,Z,q){let X=XP.useCallback(()=>J($.getSnapshot(),Q,Z,q),[$,J,Q,Z,q]);return UL.useSyncExternalStore($.subscribe,X,X)}ZP({before($){if($.syncIndex=0,!$.didInitialize)$.syncTick=1,$.syncHooks=[],$.didChangeStore=!0,$.getSnapshot=()=>{let J=!1;for(let Q=0;Q<$.syncHooks.length;Q+=1){let Z=$.syncHooks[Q],q=Z.selector(Z.store.state,Z.a1,Z.a2,Z.a3);if(!Object.is(Z.value,q))J=!0,Z.value=q}if(J)$.syncTick+=1;return $.syncTick}},after($){if($.syncHooks.length>0){if($.didChangeStore)$.didChangeStore=!1,$.subscribe=(J)=>{let Q=new Set;for(let q of $.syncHooks)Q.add(q.store);let Z=[];for(let q of Q)Z.push(q.subscribe(J));return()=>{for(let q of Z)q()}};UL.useSyncExternalStore($.subscribe,$.getSnapshot,$.getSnapshot)}}});function Ln($,J,Q,Z,q){let X=QP();if(!X)return _n($,J,Q,Z,q);let Y=X.syncIndex;X.syncIndex+=1;let z;if(!X.didInitialize)z={store:$,selector:J,a1:Q,a2:Z,a3:q,value:J($.getSnapshot(),Q,Z,q)},X.syncHooks.push(z);else if(z=X.syncHooks[Y],z.store!==$||z.selector!==J||!Object.is(z.a1,Q)||!Object.is(z.a2,Z)||!Object.is(z.a3,q)){if(z.store!==$)X.didChangeStore=!0;z.store=$,z.selector=J,z.a1=Q,z.a2=Z,z.a3=q,z.value=J($.getSnapshot(),Q,Z,q)}return z.value}function Fn($,J,Q,Z,q){return GL($.subscribe,$.getSnapshot,$.getSnapshot,(X)=>J(X,Q,Z,q))}class _L{constructor($){this.state=$,this.listeners=new Set,this.updateTick=0}subscribe=($)=>{return this.listeners.add($),()=>{this.listeners.delete($)}};getSnapshot=()=>{return this.state};setState($){if(this.state===$)return;this.state=$,this.updateTick+=1;let J=this.updateTick;for(let Q of this.listeners){if(J!==this.updateTick)return;Q($)}}update($){for(let J in $)if(!Object.is(this.state[J],$[J])){this.setState({...this.state,...$});return}}set($,J){if(!Object.is(this.state[$],J))this.setState({...this.state,[$]:J})}notifyAll(){let $={...this.state};this.setState($)}use($,J,Q,Z){return JG(this,$,J,Q,Z)}}var M$=R(v(),1);class D$ extends _L{constructor($,J={},Q){super($);this.context=J,this.selectors=Q}useSyncedValue($,J){M$.useDebugValue($);let Q=this;y0(()=>{if(Q.state[$]!==J)Q.set($,J)},[Q,$,J])}useSyncedValueWithCleanup($,J){let Q=this;y0(()=>{if(Q.state[$]!==J)Q.set($,J);return()=>{Q.set($,void 0)}},[Q,$,J])}useSyncedValues($){let J=this,Q=Object.values($);y0(()=>{J.update($)},[J,...Q])}useControlledProp($,J){M$.useDebugValue($);let Q=this,Z=J!==void 0;y0(()=>{if(Z&&!Object.is(Q.state[$],J))Q.setState({...Q.state,[$]:J})},[Q,$,J,Z])}select($,J,Q,Z){let q=this.selectors[$];return q(this.state,J,Q,Z)}useState($,J,Q,Z){return M$.useDebugValue($),JG(this,this.selectors[$],J,Q,Z)}useContextCallback($,J){M$.useDebugValue($);let Q=g0(J??m1);this.context[$]=Q}useStateSetter($){let J=M$.useRef(void 0);if(J.current===void 0)J.current=(Q)=>{this.set($,Q)};return J.current}observe($,J){let Q;if(typeof $==="function")Q=$;else Q=this.selectors[$];let Z=Q(this.state);return J(Z,Z,this),this.subscribe((q)=>{let X=Q(q);if(!Object.is(Z,X)){let Y=Z;Z=X,J(X,Y,this)}})}}var QG=R(v(),1);function YP(){let[,$]=QG.useState({});return QG.useCallback(()=>{$({})},[])}var Vn={open:J1(($)=>$.open),transitionStatus:J1(($)=>$.transitionStatus),domReferenceElement:J1(($)=>$.domReferenceElement),referenceElement:J1(($)=>$.positionReference??$.referenceElement),floatingElement:J1(($)=>$.floatingElement),floatingId:J1(($)=>$.floatingId)};class e4 extends D${constructor($){let{syncOnly:J,nested:Q,onOpenChange:Z,triggerElements:q,...X}=$;super({...X,positionReference:X.referenceElement,domReferenceElement:X.referenceElement},{onOpenChange:Z,dataRef:{current:{}},events:$G(),nested:Q,triggerElements:q},Vn);this.syncOnly=J}syncOpenEvent=($,J)=>{if(!$||!this.state.open||J!=null&&By(J))this.context.dataRef.current.openEvent=$?J:void 0};dispatchOpenChange=($,J)=>{this.syncOpenEvent($,J.event);let Q={open:$,reason:J.reason,nativeEvent:J.event,nested:this.context.nested,triggerElement:J.trigger};this.context.events.emit("openchange",Q)};setOpen=($,J)=>{if(this.syncOnly){this.context.onOpenChange?.($,J);return}this.dispatchOpenChange($,J),this.context.onOpenChange?.($,J)}}function pq($){let{popupStore:J,treatPopupAsFloatingElement:Q=!1,floatingRootContext:Z,floatingId:q,nested:X,onOpenChange:Y}=$,z=J.useState("open"),K=J.useState("activeTriggerElement"),W=J.useState(Q?"popupElement":"positionerElement"),H=J.context.triggerElements,B=Y,U=zP.useRef(null);if(Z===void 0&&U.current===null)U.current=new e4({open:z,transitionStatus:void 0,referenceElement:K,floatingElement:W,triggerElements:H,onOpenChange:B,floatingId:q,syncOnly:!0,nested:X});let _=Z??U.current;return J.useSyncedValue("floatingId",q),y0(()=>{let L={open:z,floatingId:q,referenceElement:K,floatingElement:W};if(V1(K))L.domReferenceElement=K;if(_.state.positionReference===_.state.referenceElement)L.positionReference=K;_.update(L)},[z,q,K,W,_]),_.context.onOpenChange=B,_.context.nested=X,_}var LL=R(v(),1);function GQ($,J=!1,Q=!1){let[Z,q]=LL.useState($&&J?"idle":void 0),[X,Y]=LL.useState($);if($&&!X)Y(!0),q("starting");if(!$&&X&&Z!=="ending"&&!Q)q("ending");if(!$&&!X&&Z==="ending")q(void 0);return y0(()=>{if(!$&&X&&Z!=="ending"&&Q){let z=_9.request(()=>{q("ending")});return()=>{_9.cancel(z)}}return},[$,X,Z,Q]),y0(()=>{if(!$||J)return;let z=_9.request(()=>{q(void 0)});return()=>{_9.cancel(z)}},[J,$]),y0(()=>{if(!$||!J)return;if($&&X&&Z!=="idle")q("starting");let z=_9.request(()=>{q("idle")});return()=>{_9.cancel(z)}},[J,$,X,Z]),{mounted:X,setMounted:Y,transitionStatus:Z}}var GP=R(v(),1);var KP=R($5(),1);var N$=function($){return $.startingStyle="data-starting-style",$.endingStyle="data-ending-style",$}({}),Mn={[N$.startingStyle]:""},Dn={[N$.endingStyle]:""},H4={transitionStatus($){if($==="starting")return Mn;if($==="ending")return Dn;return null}};function B4($,J=!1,Q=!0){let Z=S6();return g0((q,X=null)=>{Z.cancel();let Y=x9($);if(Y==null)return;let z=Y,K=()=>{KP.flushSync(q)};if(typeof z.getAnimations!=="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){q();return}function W(){Promise.all(z.getAnimations().map((H)=>H.finished)).then(()=>{if(!X?.aborted)K()}).catch(()=>{if(Q){if(!X?.aborted)K();return}let H=z.getAnimations();if(!X?.aborted&&H.length>0&&H.some((B)=>B.pending||B.playState!=="finished"))W()})}if(J){let H=N$.startingStyle;if(!z.hasAttribute(H)){Z.request(W);return}let B=new MutationObserver(()=>{if(!z.hasAttribute(H))B.disconnect(),W()});B.observe(z,{attributes:!0,attributeFilter:[H]}),X?.addEventListener("abort",()=>B.disconnect(),{once:!0});return}Z.request(W)})}function U4($){let{enabled:J=!0,open:Q,ref:Z,onComplete:q}=$,X=g0(q),Y=B4(Z,Q,!1);GP.useEffect(()=>{if(!J)return;let z=new AbortController;return Y(X,z.signal),()=>{z.abort()}},[J,Q,X,Y])}var HQ={tabIndex:-1,[Eq]:""};function WP($){return(J)=>J==="touch"?$.current:!0}function HP($,J,Q=!1){let Z=h6(),q=h8()!=null,X=WQ.useRef(null);if($===void 0&&X.current===null)X.current=J(Z,q);let Y=$??X.current;return pq({popupStore:Y,treatPopupAsFloatingElement:Q,floatingRootContext:Y.state.floatingRootContext,floatingId:Z,nested:q,onOpenChange:Y.setOpen}),{store:Y,internalStore:X.current}}function FL($,J){let Q=WQ.useRef(null),Z=WQ.useRef(null);return WQ.useCallback((q)=>{if($===void 0)return;let X=!1;if(Q.current!==null){let Y=Q.current,z=Z.current,K=J.context.triggerElements.getById(Y);if(z&&K===z)J.context.triggerElements.delete(Y),X=!0;Q.current=null,Z.current=null}if(q!==null)Q.current=$,Z.current=q,J.context.triggerElements.add($,q),X=!0;if(X){let Y=J.context.triggerElements.size;if(J.select("open")&&J.state.triggerCount!==Y)J.set("triggerCount",Y)}},[J,$])}function ZG($,J,Q,Z=!1){if(J)$.preventUnmountingOnClose=!1;else if(Z)$.preventUnmountingOnClose=!0;let q=Q?.id??null;if(q||J)$.activeTriggerId=q,$.activeTriggerElement=Q??null}function qG($){let J=!1;return $.preventUnmountOnClose=()=>{J=!0},()=>J}function XG($,J,Q,Z){$P(()=>{if(J===void 0&&$.state.open===!1&&Q)$.state={...$.state,open:!0,activeTriggerId:Z,preventUnmountingOnClose:!1}})}function YG($,J,Q,Z){let q=Q.useState("isMountedByTrigger",$),X=FL($,Q),Y=g0((z)=>{if(X(z),!z)return;let K=Q.select("open"),W=Q.select("activeTriggerId");if(W===$){Q.update({activeTriggerElement:z,...K?Z:null});return}if(W==null&&K)Q.update({activeTriggerId:$,activeTriggerElement:z,...Z})});return y0(()=>{if(q)Q.update({activeTriggerElement:J.current,...Z})},[q,Q,J,...Object.values(Z)]),{registerTrigger:Y,isMountedByThisTrigger:q}}function zG($,J={}){let{closeOnActiveTriggerUnmount:Q=!1}=J,Z=$.useState("open"),q=$.useState("triggerCount");y0(()=>{if(!Z){if($.state.triggerCount!==0)$.set("triggerCount",0);return}let X=$.context.triggerElements.size,Y={};if($.state.triggerCount!==X)Y.triggerCount=X;let z=$.select("activeTriggerId"),K=null;if(z){let W=$.context.triggerElements.getById(z);if(!W)K=z;else if(W!==$.state.activeTriggerElement)Y.activeTriggerElement=W}if(!K&&!z&&X===1){let W=$.context.triggerElements.entries().next();if(!W.done){let[H,B]=W.value;Y.activeTriggerId=H,Y.activeTriggerElement=B}}if(Y.triggerCount!==void 0||Y.activeTriggerId!==void 0||Y.activeTriggerElement!==void 0)$.update(Y);if(K){if(Q)queueMicrotask(()=>{if($.select("open")&&$.select("activeTriggerId")===K&&!$.context.triggerElements.getById(K)){let W=l0(T0.none);if($.setOpen(!1,W),!W.isCanceled)$.update({activeTriggerId:null,activeTriggerElement:null})}})}},[Z,$,q,Q])}function KG($,J,Q){let{mounted:Z,setMounted:q,transitionStatus:X}=GQ($),Y=J.useState("preventUnmountingOnClose"),z=$?!1:Y;J.useSyncedValues({mounted:Z,transitionStatus:X,preventUnmountingOnClose:z});let K=g0(()=>{q(!1),J.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),Q?.(),J.context.onOpenChangeComplete?.(!1)});return U4({enabled:Z&&!$&&!z,open:$,ref:J.context.popupRef,onComplete(){if(!$)K()}}),{forceUnmount:K,transitionStatus:X}}function GG($,J){$.useSyncedValues(J),y0(()=>()=>{$.update({activeTriggerProps:I1,inactiveTriggerProps:I1,popupProps:I1})},[$])}function BP($,J){y0(()=>{if(!J&&$.state.openMethod!==null)$.set("openMethod",null)},[J,$]),y0(()=>()=>{if($.state.openMethod!==null)$.set("openMethod",null)},[$])}class $7{constructor(){this.elementsSet=new Set,this.idMap=new Map}add($,J){let Q=this.idMap.get($);if(Q===J)return;if(Q!==void 0)this.elementsSet.delete(Q);this.elementsSet.add(J),this.idMap.set($,J)}delete($){let J=this.idMap.get($);if(J)this.elementsSet.delete(J),this.idMap.delete($)}hasElement($){return this.elementsSet.has($)}hasMatchingElement($){for(let J of this.elementsSet)if($(J))return!0;return!1}getById($){return this.idMap.get($)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}}function UP(){return new e4({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new $7,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function WG(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:UP(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:I1,inactiveTriggerProps:I1,popupProps:I1}}function LP($,J,Q=!1){return new e4({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:$,floatingId:J,syncOnly:!0,nested:Q,onOpenChange:void 0})}var lq=J1(($)=>$.triggerIdProp??$.activeTriggerId),VL=J1(($)=>$.openProp??$.open),_P=J1(($)=>{return($.popupElement?.id??$.floatingId)||void 0});function FP($,J){return J!==void 0&&VL($)&&lq($)===J}function On($,J){if(FP($,J))return!0;return J!==void 0&&VL($)&&lq($)==null&&$.triggerCount===1}var HG={open:VL,mounted:J1(($)=>$.mounted),transitionStatus:J1(($)=>$.transitionStatus),floatingRootContext:J1(($)=>$.floatingRootContext),triggerCount:J1(($)=>$.triggerCount),preventUnmountingOnClose:J1(($)=>$.preventUnmountingOnClose),payload:J1(($)=>$.payload),activeTriggerId:lq,activeTriggerElement:J1(($)=>$.mounted?$.activeTriggerElement:null),popupId:_P,isTriggerActive:J1(($,J)=>J!==void 0&&lq($)===J),isOpenedByTrigger:J1(($,J)=>FP($,J)),isMountedByTrigger:J1(($,J)=>J!==void 0&&lq($)===J&&$.mounted),triggerProps:J1(($,J)=>J?$.activeTriggerProps:$.inactiveTriggerProps),triggerPopupId:J1(($,J)=>On($,J)?_P($):void 0),popupProps:J1(($)=>$.popupProps),popupElement:J1(($)=>$.popupElement),positionerElement:J1(($)=>$.positionerElement)};function VP($){let{open:J=!1,onOpenChange:Q,elements:Z={}}=$,q=h6(),X=h8()!=null,Y=G5(()=>new e4({open:J,transitionStatus:void 0,onOpenChange:Q,referenceElement:Z.reference??null,floatingElement:Z.floating??null,triggerElements:new $7,floatingId:q,syncOnly:!1,nested:X})).current;return y0(()=>{let z={open:J,floatingId:q};if(Z.reference!==void 0)z.referenceElement=Z.reference,z.domReferenceElement=V1(Z.reference)?Z.reference:null;if(Z.floating!==void 0)z.floatingElement=Z.floating;Y.update(z)},[J,q,Z.reference,Z.floating,Y]),Y.context.onOpenChange=Q,Y.context.nested=X,Y}function ML($={}){let{nodeId:J,externalTree:Q}=$,Z=VP($),q=$.rootContext||Z,X=q.useState("referenceElement"),Y=q.useState("floatingElement"),z=q.useState("domReferenceElement"),K=q.useState("open"),W=q.useState("floatingId"),[H,B]=l8.useState(null),[U,_]=l8.useState(void 0),[L,F]=l8.useState(void 0),V=l8.useRef(null),M=d8(Q),D=l8.useMemo(()=>({reference:X,floating:Y,domReference:z}),[X,Y,z]),N=IX({...$,elements:{...D,...H&&{reference:H}}}),O=V1(U)?U:null,I=L===void 0?q.state.floatingElement:L;q.useSyncedValue("referenceElement",U??null),q.useSyncedValue("domReferenceElement",U===void 0?z:O),q.useSyncedValue("floatingElement",I);let k=l8.useCallback((x)=>{let j=V1(x)?{getBoundingClientRect:()=>x.getBoundingClientRect(),getClientRects:()=>x.getClientRects(),contextElement:x}:x;B(j),N.refs.setReference(j)},[N.refs]),T=l8.useCallback((x)=>{if(V1(x)||x===null)V.current=x,_(x);if(V1(N.refs.reference.current)||N.refs.reference.current===null||x!==null&&!V1(x))N.refs.setReference(x)},[N.refs,_]),A=l8.useCallback((x)=>{F(x),N.refs.setFloating(x)},[N.refs]),w=l8.useMemo(()=>({...N.refs,setReference:T,setFloating:A,setPositionReference:k,domReference:V}),[N.refs,T,A,k]),C=l8.useMemo(()=>({...N.elements,domReference:z}),[N.elements,z]),y=l8.useMemo(()=>({...N,dataRef:q.context.dataRef,open:K,onOpenChange:q.setOpen,events:q.context.events,floatingId:W,refs:w,elements:C,nodeId:J,rootStore:q}),[N,w,C,J,q,K,W]);return y0(()=>{if(z)V.current=z},[z]),y0(()=>{q.context.dataRef.current.floatingContext=y;let x=M?.nodesRef.current.find((j)=>j.id===J);if(x)x.context=y}),l8.useMemo(()=>({...N,context:y,refs:w,elements:C,rootStore:q}),[N,w,C,y,q])}var _4=R(v(),1);var DL=c1.os.mac&&c1.engine.webkit;function NL($,J={}){let{enabled:Q=!0,delay:Z}=J,q="rootStore"in $?$.rootStore:$,{events:X,dataRef:Y}=q.context,z=_4.useRef(!1),K=_4.useRef(null),W=_4.useRef(!0),H=B5();_4.useEffect(()=>{let U=q.select("domReferenceElement");if(!Q)return;let _=S1(U);function L(){let M=q.select("domReferenceElement");if(!q.select("open")&&R1(M)&&M===v5(z1(M)))z.current=!0}function F(){W.current=!0}function V(){W.current=!1}return I8(_1(_,"blur",L),DL&&_1(_,"keydown",F,!0),DL&&_1(_,"pointerdown",V,!0))},[q,Q]),_4.useEffect(()=>{if(!Q)return;function U(_){if(_.reason===T0.triggerPress||_.reason===T0.escapeKey){let L=q.select("domReferenceElement");if(V1(L))K.current=L,z.current=!0}}return X.on("openchange",U),()=>{X.off("openchange",U)}},[X,Q,q]);let B=_4.useMemo(()=>{function U(){z.current=!1,K.current=null}return{onMouseLeave(){U()},onFocus(_){let L=_.currentTarget;if(z.current){if(K.current===L)return;U()}let F=A5(_.nativeEvent);if(V1(F)){if(DL&&!_.relatedTarget){if(!W.current&&!B$(F))return}else if(!Wy(F))return}let V=d7(_.relatedTarget,q.context.triggerElements),{nativeEvent:M,currentTarget:D}=_,N=typeof Z==="function"?Z():Z;if(q.select("open")&&V||N===0||N===void 0){q.setOpen(!0,l0(T0.triggerFocus,M,D));return}H.start(N,()=>{if(z.current)return;q.setOpen(!0,l0(T0.triggerFocus,M,D))})},onBlur(_){U();let{relatedTarget:L,nativeEvent:F}=_,V=V1(L)&&L.hasAttribute(t4("focus-guard"))&&L.getAttribute("data-type")==="outside";H.start(0,()=>{let M=q.select("domReferenceElement"),D=v5(z1(M));if(!L&&D===M)return;if(e0(Y.current.floatingContext?.refs.floating.current,D)||e0(M,D)||V)return;if(d7(L??D,q.context.triggerElements))return;q.setOpen(!1,l0(T0.triggerFocus,F))})}}},[Y,Z,q,H]);return _4.useMemo(()=>Q?{reference:B,trigger:B}:{},[Q,B])}var wL=R(v(),1);class OL{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new T8,this.restTimeout=new T8,this.handleCloseOptions=void 0}static create(){return new OL}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>{return this.dispose}}var BG=new WeakMap;function BQ($){if(!$.performedPointerEventsMutation)return;let J=$.pointerEventsScopeElement;if(J&&BG.get(J)===$)$.pointerEventsScopeElement?.style.removeProperty("pointer-events"),$.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),$.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),BG.delete(J);$.performedPointerEventsMutation=!1,$.pointerEventsScopeElement=null,$.pointerEventsReferenceElement=null,$.pointerEventsFloatingElement=null}function UG($,J){let{scopeElement:Q,referenceElement:Z,floatingElement:q}=J,X=BG.get(Q);if(X&&X!==$)BQ(X);BQ($),$.performedPointerEventsMutation=!0,$.pointerEventsScopeElement=Q,$.pointerEventsReferenceElement=Z,$.pointerEventsFloatingElement=q,BG.set(Q,$),Q.style.pointerEvents="none",Z.style.pointerEvents="auto",q.style.pointerEvents="auto"}function _G($){let J=$.context.dataRef.current,Q=G5(()=>J.hoverInteractionState??OL.create()).current;if(!J.hoverInteractionState)J.hoverInteractionState=Q;return c7(J.hoverInteractionState.disposeEffect),J.hoverInteractionState}function An($,J){if(J!=null&&!p7(J))return 0;if(typeof $==="function")return $();return $}function iq($,J,Q){let Z=An($,Q);if(typeof Z==="number")return Z;return Z?.[J]}function AL($){if(typeof $==="function")return $();return $}function LG($,J){return J||$==="click"||$==="mousedown"}function MP($){return $?.includes("mouse")&&$!=="mousedown"}function rq($,J={}){let{enabled:Q=!0,closeDelay:Z=0,nodeId:q}=J,X="rootStore"in $?$.rootStore:$,Y=X.useState("open"),z=X.useState("floatingElement"),K=X.useState("domReferenceElement"),{dataRef:W}=X.context,H=d8(),B=h8(),U=_G(X),_=B5(),L=g0(()=>{return LG(W.current.openEvent?.type,U.interactedInside)}),F=g0(()=>{return MP(W.current.openEvent?.type)}),V=g0(()=>{BQ(U)});y0(()=>{if(!Y)U.pointerType=void 0,U.restTimeoutPending=!1,U.interactedInside=!1,V()},[Y,U,V]),wL.useEffect(()=>{return V},[V]),y0(()=>{if(!Q)return;if(Y&&U.handleCloseOptions?.blockPointerEvents&&F()&&V1(K)&&z){let M=K,D=z,N=z1(z),O=H?.nodesRef.current.find((A)=>A.id===B)?.context?.elements.floating;if(O)O.style.pointerEvents="";let I=U.pointerEventsScopeElement!==D?U.pointerEventsScopeElement:null,k=O!==D?O:null,T=U.handleCloseOptions?.getScope?.()??I??k??M.closest("[data-rootownerid]")??N.body;return UG(U,{scopeElement:T,referenceElement:M,floatingElement:D}),()=>{V()}}return},[Q,Y,K,z,U,F,H,B,V]),wL.useEffect(()=>{if(!Q)return;function M(){return!!(H&&B&&F9(H.nodesRef.current,B).length>0)}function D(A){let w=iq(Z,"close",U.pointerType),C=()=>{X.setOpen(!1,l0(T0.triggerHover,A)),H?.events.emit("floating.closed",A)};if(w)U.openChangeTimeout.start(w,C);else U.openChangeTimeout.clear(),C()}function N(A){let w=A5(A);if(!u_(w)){U.interactedInside=!1;return}U.interactedInside=w?.closest("[aria-haspopup]")!=null}function O(){U.openChangeTimeout.clear(),_.clear(),H?.events.off("floating.closed",k),V()}function I(A){if(M()&&H){H.events.on("floating.closed",k);return}if(d7(A.relatedTarget,X.context.triggerElements))return;let w=W.current.floatingContext?.nodeId??q,C=A.relatedTarget;if(H&&w&&V1(C)&&F9(H.nodesRef.current,w,!1).some((x)=>e0(x.context?.elements.floating,C)))return;if(U.handler){U.handler(A);return}if(V(),F()&&!L())D(A)}function k(A){if(!H||!B||M())return;_.start(0,()=>{H.events.off("floating.closed",k),X.setOpen(!1,l0(T0.triggerHover,A)),H.events.emit("floating.closed",A)})}let T=z;return I8(T&&_1(T,"mouseenter",O),T&&_1(T,"mouseleave",I),T&&_1(T,"pointerdown",N,!0),()=>{H?.events.off("floating.closed",k)})},[Q,z,X,W,Z,q,F,L,V,U,H,B,_])}var o7=R(v(),1),DP=R($5(),1);var wn={current:null};function O$($,J={}){let{enabled:Q=!0,delay:Z=0,handleClose:q=null,mouseOnly:X=!1,restMs:Y=0,move:z=!0,triggerElementRef:K=wn,externalTree:W,isActiveTrigger:H=!0,getHandleCloseContext:B,isClosing:U,shouldOpen:_}=J,L="rootStore"in $?$.rootStore:$,{dataRef:F,events:V}=L.context,M=d8(W),D=_G(L),N=o7.useRef(!1),O=_5(q),I=_5(Z),k=_5(Y),T=_5(Q),A=_5(_),w=_5(U),C=g0(()=>{return LG(F.current.openEvent?.type,D.interactedInside)}),y=g0(()=>{return A.current?.()!==!1}),x=g0((h,l,t)=>{let S=L.context.triggerElements;if(S.hasElement(l))return!h||!e0(h,l);if(!V1(t))return!1;let i=t;return S.hasMatchingElement((J0)=>e0(J0,i))&&(!h||!e0(h,i))}),j=g0(()=>{if(!D.handler)return;z1(L.select("domReferenceElement")).removeEventListener("mousemove",D.handler),D.handler=void 0}),P=g0(()=>{BQ(D)});if(H)D.handleCloseOptions=O.current?.__options;return o7.useEffect(()=>j,[j]),o7.useEffect(()=>{if(!Q)return;function h(l){if(!l.open)N.current=l.reason===T0.triggerHover,j(),D.openChangeTimeout.clear(),D.restTimeout.clear(),D.blockMouseMove=!0,D.restTimeoutPending=!1;else N.current=!1}return V.on("openchange",h),()=>{V.off("openchange",h)}},[Q,V,D,j]),o7.useEffect(()=>{if(!Q)return;function h(i,J0=!0){let K0=iq(I.current,"close",D.pointerType);if(K0)D.openChangeTimeout.start(K0,()=>{L.setOpen(!1,l0(T0.triggerHover,i)),M?.events.emit("floating.closed",i)});else if(J0)D.openChangeTimeout.clear(),L.setOpen(!1,l0(T0.triggerHover,i)),M?.events.emit("floating.closed",i)}let l=K.current??(H?L.select("domReferenceElement"):null);if(!V1(l))return;function t(i){if(D.openChangeTimeout.clear(),D.blockMouseMove=!1,X&&!p7(D.pointerType))return;let J0=AL(k.current),K0=iq(I.current,"open",D.pointerType),e=A5(i),H0=i.currentTarget??null,q0=L.select("domReferenceElement"),E=H0;if(V1(e)&&!L.context.triggerElements.hasElement(e)){for(let G0 of L.context.triggerElements.elements())if(e0(G0,e)){E=G0;break}}if(V1(H0)&&V1(q0)&&!L.context.triggerElements.hasElement(H0)&&e0(H0,q0))E=q0;let d=E==null?!1:x(q0,E,e),c=L.select("open"),r=w.current?.()??L.select("transitionStatus")==="ending",u=!c&&r&&N.current,m=!d&&V1(E)&&V1(q0)&&e0(q0,E)&&u,s=J0>0&&!K0,f=d&&(c||u)||m,o=!c||d;if(f){if(y())L.setOpen(!0,l0(T0.triggerHover,i,E));return}if(s)return;if(K0)D.openChangeTimeout.start(K0,()=>{if(o&&y())L.setOpen(!0,l0(T0.triggerHover,i,E))});else if(o){if(y())L.setOpen(!0,l0(T0.triggerHover,i,E))}}function S(i){if(C()){P();return}j();let J0=L.select("domReferenceElement"),K0=z1(J0);D.restTimeout.clear(),D.restTimeoutPending=!1;let e=F.current.floatingContext??B?.();if(d7(i.relatedTarget,L.context.triggerElements))return;if(O.current&&e){if(!L.select("open"))D.openChangeTimeout.clear();let q0=K.current;D.handler=O.current({...e,tree:M,x:i.clientX,y:i.clientY,onClose(){if(P(),j(),T.current&&!C()&&q0===L.select("domReferenceElement"))h(i,!0)}}),K0.addEventListener("mousemove",D.handler),D.handler(i);return}if(D.pointerType==="touch"?!e0(L.select("floatingElement"),i.relatedTarget):!0)h(i)}if(z)return I8(_1(l,"mousemove",t,{once:!0}),_1(l,"mouseenter",t),_1(l,"mouseleave",S));return I8(_1(l,"mouseenter",t),_1(l,"mouseleave",S))},[j,P,F,I,L,Q,O,D,H,x,C,X,z,k,K,M,T,B,w,y]),o7.useMemo(()=>{if(!Q)return;function h(l){D.pointerType=l.pointerType}return{onPointerDown:h,onPointerEnter:h,onMouseMove(l){let{nativeEvent:t}=l,S=l.currentTarget,i=L.select("domReferenceElement"),J0=L.select("open"),K0=x(i,S,l.target);if(X&&!p7(D.pointerType))return;if(J0&&K0&&D.handleCloseOptions?.blockPointerEvents){let q0=L.select("floatingElement");if(q0){let E=D.handleCloseOptions?.getScope?.()??S.ownerDocument.body;UG(D,{scopeElement:E,referenceElement:S,floatingElement:q0})}}let e=AL(k.current);if(J0&&!K0||e===0)return;if(!K0&&D.restTimeoutPending&&l.movementX**2+l.movementY**2<2)return;D.restTimeout.clear();function H0(){if(D.restTimeoutPending=!1,C())return;let q0=L.select("open");if(!D.blockMouseMove&&(!q0||K0)&&y())L.setOpen(!0,l0(T0.triggerHover,t,S))}if(D.pointerType==="touch")DP.flushSync(()=>{H0()});else if(K0&&J0)H0();else D.restTimeoutPending=!0,D.restTimeout.start(e,H0)}}},[Q,D,C,x,X,L,k,y])}var x8=R(v(),1);var kn="Escape";function VG($,J,Q){switch($){case"vertical":return J;case"horizontal":return Q;default:return J||Q}}function FG($,J){return VG(J,$===g_||$===mK,$===yq||$===Pq)}function kL($,J,Q){return VG(J,$===mK,Q?$===yq:$===Pq)||$==="Enter"||$===" "||$===""}function In($,J,Q){return VG(J,Q?$===yq:$===Pq,$===mK)}function Tn($,J,Q,Z){let q=Q?$===Pq:$===yq,X=$===g_;if(J==="both"||J==="horizontal"&&Z)return $===kn;return VG(J,q,X)}function IL($,J){let{listRef:Q,activeIndex:Z,onNavigate:q=()=>{},enabled:X=!0,selectedIndex:Y=null,allowEscape:z=!1,loopFocus:K=!1,nested:W=!1,rtl:H=!1,virtual:B=!1,focusItemOnOpen:U="auto",focusItemOnHover:_=!0,openOnArrowKeyDown:L=!0,disabledIndices:F=void 0,orientation:V="vertical",parentOrientation:M,id:D,resetOnPointerLeave:N=!0,externalTree:O,grid:I}=J,k=I!=null,T="rootStore"in $?$.rootStore:$,A=T.useState("open"),w=T.useState("floatingElement"),C=T.useState("domReferenceElement"),y=T.context.dataRef,x=Cq(w),j=Rq(C),P=_5(x),h=h8(),l=d8(O),t=x8.useRef(U),S=x8.useRef(Y??-1),i=x8.useRef(null),J0=x8.useRef(!0),K0=g0((g)=>{q(S.current===-1?null:S.current,g)}),e=x8.useRef(!!w),H0=x8.useRef(A),q0=x8.useRef(!1),E=x8.useRef(!1),d=x8.useRef(null),c=_5(F),r=_5(A),u=_5(Y),m=_5(N),s=S6(),f=S6(),o=g0(()=>{function g(F0){if(B)l?.events.emit("virtualfocus",F0);else d.current=zQ(F0,{sync:q0.current,preventScroll:!0})}let a=Q.current[S.current],I0=E.current;if(a)g(a);(q0.current?(F0)=>F0():(F0)=>s.request(F0))(()=>{let F0=Q.current[S.current]||a;if(!F0)return;if(!a)g(F0);if(W0&&(I0||!J0.current))F0.scrollIntoView?.({block:"nearest",inline:"nearest"})})});y0(()=>{y.current.orientation=V},[y,V]),y0(()=>{if(!X)return;if(A&&w){if(S.current=Y??-1,t.current&&Y!=null)E.current=!0,K0()}else if(e.current)S.current=-1,K0()},[X,A,w,Y,K0]),y0(()=>{if(!X)return;if(!A){q0.current=!1;return}if(!w)return;if(Z==null){if(q0.current=!1,u.current!=null)return;if(e.current)S.current=-1,o();if((!H0.current||!e.current)&&t.current&&(i.current!=null||t.current===!0&&i.current==null)){let g=0,a=()=>{if(Q.current[0]==null){if(g<2)(g?(w0)=>f.request(w0):queueMicrotask)(a);g+=1}else S.current=i.current==null||kL(i.current,V,H)||W?lK(Q):c_(Q),i.current=null,K0()};a()}}else if(!m_(Q.current,Z))S.current=Z,o(),E.current=!1},[X,A,w,Z,u,W,Q,V,H,K0,o,f]),y0(()=>{if(!X||w||!l||B||!e.current)return;let g=l.nodesRef.current,a=g.find((F0)=>F0.id===h)?.context?.elements.floating,I0=v5(z1(C??a??null)),w0=g.some((F0)=>F0.context&&e0(F0.context.elements.floating,I0));if(a&&!w0&&J0.current)a.focus({preventScroll:!0})},[X,w,C,l,h,B]),y0(()=>{H0.current=A,e.current=!!w}),y0(()=>{if(!A)i.current=null,t.current=U},[A,U]);let G0=Z!=null,p=g0((g)=>{if(!r.current)return;let a=Q.current.indexOf(g.currentTarget);if(a!==-1&&(S.current!==a||Z!==a))S.current=a,K0(g)}),Z0=g0(()=>{return M??l?.nodesRef.current.find((g)=>g.id===h)?.context?.dataRef?.current.orientation}),Q0=g0(()=>{return lK(Q,c.current)}),B0=g0((g)=>{if(J0.current=!1,q0.current=!0,g.which===229)return;if(!r.current&&g.currentTarget===P.current)return;if(W&&Tn(g.key,V,H,k)){if(!FG(g.key,Z0()))q6(g);if(T.setOpen(!1,l0(T0.listNavigation,g.nativeEvent)),R1(C))if(B)l?.events.emit("virtualfocus",C);else C.focus();return}let a=S.current,I0=lK(Q,F),w0=c_(Q,F);if(!j){if(g.key==="Home")q6(g),S.current=I0,K0(g);if(g.key==="End")q6(g),S.current=w0,K0(g)}if(I!=null){let F0=I(g,S.current,Q,V,K,H,F,I0,w0);if(F0!=null)S.current=F0,K0(g);if(V==="both")return}if(FG(g.key,V)){if(q6(g),A&&!B&&v5(g.currentTarget.ownerDocument)===g.currentTarget){S.current=kL(g.key,V,H)?I0:w0,K0(g);return}if(kL(g.key,V,H))if(K)if(a>=w0)if(z&&a!==Q.current.length)S.current=-1;else q0.current=!1,S.current=I0;else S.current=U$(Q.current,{startingIndex:a,disabledIndices:F});else S.current=Math.min(w0,U$(Q.current,{startingIndex:a,disabledIndices:F}));else if(K)if(a<=I0)if(z&&a!==-1)S.current=Q.current.length;else q0.current=!1,S.current=w0;else S.current=U$(Q.current,{startingIndex:a,decrement:!0,disabledIndices:F});else S.current=Math.max(I0,U$(Q.current,{startingIndex:a,decrement:!0,disabledIndices:F}));if(m_(Q.current,S.current))S.current=-1;K0(g)}}),W0=x8.useMemo(()=>{return{onFocus(a){q0.current=!0,p(a)},onClick:({currentTarget:a})=>a.focus({preventScroll:!0}),onMouseMove(a){if(q0.current=!0,E.current=!1,_)p(a)},onPointerLeave(a){if(!r.current||!J0.current||a.pointerType==="touch")return;q0.current=!0;let I0=a.relatedTarget;if(!_||Q.current.includes(I0))return;if(!m.current)return;if(d.current?.(),d.current=null,S.current=-1,K0(a),!B){let w0=P.current,F0=v5(z1(w0));if(w0&&e0(w0,F0))w0.focus({preventScroll:!0})}}}},[p,r,P,_,Q,K0,m,B]),L0=x8.useMemo(()=>{return B&&A&&G0&&{"aria-activedescendant":`${D}-${Z}`}},[B,A,G0,D,Z]),_0=x8.useMemo(()=>{return{"aria-orientation":V==="both"?void 0:V,...!j?L0:{},onKeyDown(g){if(g.key==="Tab"&&g.shiftKey&&A&&!B){let a=A5(g.nativeEvent);if(a&&!e0(P.current,a))return;if(q6(g),T.setOpen(!1,l0(T0.focusOut,g.nativeEvent)),R1(C))C.focus();return}B0(g)},onPointerMove(){J0.current=!0}}},[L0,B0,P,V,j,T,A,B,C]),N0=x8.useMemo(()=>{function g(w0){T.setOpen(!0,l0(T0.listNavigation,w0.nativeEvent,w0.currentTarget))}function a(w0){if(U==="auto"&&dK(w0.nativeEvent))t.current=!B}function I0(w0){if(t.current=U,U==="auto"&&pK(w0.nativeEvent))t.current=!0}return{onKeyDown(w0){let F0=T.select("open");J0.current=!1;let u0=w0.key.startsWith("Arrow"),P0=In(w0.key,Z0(),H),n0=FG(w0.key,V),R0=(W?P0:n0)||w0.key==="Enter"||w0.key.trim()==="";if(B&&F0)return B0(w0);if(!F0&&!L&&u0)return;if(R0){let Z1=FG(w0.key,Z0());i.current=W&&Z1?null:w0.key}if(W){if(P0)if(q6(w0),F0)S.current=Q0(),K0(w0);else g(w0);return}if(n0){if(u.current!=null)S.current=u.current;if(q6(w0),!F0&&L)g(w0);else B0(w0);if(F0)K0(w0)}return},onFocus(w0){if(T.select("open")&&!B)S.current=-1,K0(w0)},onPointerDown:I0,onPointerEnter:I0,onMouseDown:a,onClick:a}},[B0,U,Q0,W,K0,T,L,V,Z0,H,u,B]),d0=x8.useMemo(()=>{return{...L0,...N0}},[L0,N0]);return x8.useMemo(()=>X?{reference:d0,floating:_0,item:W0,trigger:N0}:{},[X,d0,_0,N0,W0])}var A$=R(v(),1);function TL($,J){let{listRef:Q,elementsRef:Z,activeIndex:q,onMatch:X,disabledIndices:Y,onTyping:z,enabled:K=!0,resetMs:W=750,selectedIndex:H=null}=J,B="rootStore"in $?$.rootStore:$,U=B.useState("open"),_=B5(),L=A$.useRef(""),F=A$.useRef(H??q??-1),V=A$.useRef(null),M=g0((O)=>{function I(P){let h=Z?.current[P];return!h||_$(h)}function k(P){if(!I(P))return!1;return Y==null||!d_(G$,P,Y)}function T(P,h,l=0){if(P.length===0)return-1;let t=(l%P.length+P.length)%P.length,S=h.toLowerCase();for(let i=0;i0&&O.key===" ")q6(O),z?.(!0);if(L.current.length>0&&L.current[0]!==" "){if(T(A,L.current)===-1&&O.key!==" ")z?.(!1)}if(A==null||O.key.length!==1||O.ctrlKey||O.metaKey||O.altKey)return;if(U&&O.key!==" ")q6(O),z?.(!0);let w=L.current==="";if(w)F.current=H??q??-1;if(A.every((P,h)=>P&&k(h)?P[0]?.toLowerCase()!==P[1]?.toLowerCase():!0)&&L.current===O.key)L.current="",F.current=V.current;L.current+=O.key,_.start(W,()=>{L.current="",F.current=V.current,z?.(!1)});let x=((w?H??q??-1:F.current)??0)+1,j=T(A,L.current,x);if(j!==-1)X?.(j),V.current=j;else if(O.key!==" ")L.current="",z?.(!1)}),D=g0((O)=>{let I=O.relatedTarget,k=B.select("domReferenceElement"),T=B.select("floatingElement");if(e0(k,I)||e0(T,I))return;_.clear(),L.current="",F.current=V.current,z?.(!1)});y0(()=>{if(!U&&H!==null)return;if(_.clear(),V.current=null,L.current!=="")L.current=""},[U,H,_]),y0(()=>{if(U&&L.current==="")F.current=H??q??-1},[U,H,q]);let N=A$.useMemo(()=>({onKeyDown:M,onBlur:D}),[M,D]);return A$.useMemo(()=>K?{reference:N,floating:N}:{},[K,N])}var NP=0.1,bn=NP*NP,W5=0.5;function MG($,J,Q,Z,q,X){return Z>=J!==X>=J&&$<=(q-Q)*(J-Z)/(X-Z)+Q}function DG($,J,Q,Z,q,X,Y,z,K,W){let H=!1;if(MG($,J,Q,Z,q,X))H=!H;if(MG($,J,q,X,Y,z))H=!H;if(MG($,J,Y,z,K,W))H=!H;if(MG($,J,K,W,Q,Z))H=!H;return H}function jn($,J,Q){return $>=Q.x&&$<=Q.x+Q.width&&J>=Q.y&&J<=Q.y+Q.height}function NG($,J,Q,Z,q,X){let Y=Math.min(Q,q),z=Math.max(Q,q),K=Math.min(Z,X),W=Math.max(Z,X);return $>=Y&&$<=z&&J>=K&&J<=W}function w$($={}){let{blockPointerEvents:J=!1}=$,Q=new T8,Z=({x:q,y:X,placement:Y,elements:z,onClose:K,nodeId:W,tree:H})=>{let B=Y?.split("-")[0],U=!1,_=null,L=null,F=typeof performance<"u"?performance.now():0;function V(D,N){let O=performance.now(),I=O-F;if(_===null||L===null||I===0)return _=D,L=N,F=O,!1;let k=D-_,T=N-L,A=k*k+T*T,w=I*I*bn;return _=D,L=N,F=O,A0)}function j(){if(!x())M()}if(x())return;let P=O.getBoundingClientRect(),h=I.getBoundingClientRect(),l=q>h.right-h.width/2,t=X>h.bottom-h.height/2,S=h.width>P.width,i=h.height>P.height,J0=(S?P:h).left,K0=(S?P:h).right,e=(i?P:h).top,H0=(i?P:h).bottom;if(B==="top"&&X>=P.bottom-1||B==="bottom"&&X<=P.top+1||B==="left"&&q>=P.right-1||B==="right"&&q<=P.left+1){j();return}let q0=!1;switch(B){case"top":q0=NG(k,T,J0,P.top+1,K0,h.bottom-1);break;case"bottom":q0=NG(k,T,J0,h.top+1,K0,P.bottom-1);break;case"left":q0=NG(k,T,h.right-1,H0,P.left+1,e);break;case"right":q0=NG(k,T,P.right-1,H0,h.left+1,e);break;default:}if(q0)return;if(U&&!jn(k,T,P)){j();return}if(!w&&V(k,T)){j();return}let E=!1;switch(B){case"top":{let d=S?W5/2:W5*4,c=S?q+d:l?q+d:q-d,r=S?q-d:l?q+d:q-d,u=X+W5+1,m=l?h.bottom-W5:S?h.bottom-W5:h.top,s=l?S?h.bottom-W5:h.top:h.bottom-W5;E=DG(k,T,c,u,r,u,h.left,m,h.right,s);break}case"bottom":{let d=S?W5/2:W5*4,c=S?q+d:l?q+d:q-d,r=S?q-d:l?q+d:q-d,u=X-W5,m=l?h.top+W5:S?h.top+W5:h.bottom,s=l?S?h.top+W5:h.bottom:h.top+W5;E=DG(k,T,c,u,r,u,h.left,m,h.right,s);break}case"left":{let d=i?W5/2:W5*4,c=i?X+d:t?X+d:X-d,r=i?X-d:t?X+d:X-d,u=q+W5+1,m=t?h.right-W5:i?h.right-W5:h.left,s=t?i?h.right-W5:h.left:h.right-W5;E=DG(k,T,m,h.top,s,h.bottom,u,c,u,r);break}case"right":{let d=i?W5/2:W5*4,c=i?X+d:t?X+d:X-d,r=i?X-d:t?X+d:X-d,u=q-W5,m=t?h.left+W5:i?h.left+W5:h.right,s=t?i?h.left+W5:h.right:h.left+W5;E=DG(k,T,u,c,u,r,m,h.top,s,h.bottom);break}default:}if(!E)j();else if(!U)Q.start(40,j);return}};return Z.__options={...$,blockPointerEvents:J},Z}var OG=R(v(),1),bL=OG.createContext(void 0);function S5($){let J=OG.useContext(bL);if(J===void 0&&!$)throw Error(M1(47));return J}var n7=R(v(),1),OP=R($5(),1);function En(){return{...WG(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}var yn={...HG,disabled:J1(($)=>$.disabled),instantType:J1(($)=>$.instantType),openMethod:J1(($)=>$.openMethod),openChangeReason:J1(($)=>$.openChangeReason),modal:J1(($)=>$.modal),focusManagerModal:J1(($)=>$.focusManagerModal),stickIfOpen:J1(($)=>$.stickIfOpen),titleElementId:J1(($)=>$.titleElementId),descriptionElementId:J1(($)=>$.descriptionElementId),openOnHover:J1(($)=>$.openOnHover),closeDelay:J1(($)=>$.closeDelay),hasViewport:J1(($)=>$.hasViewport)};class UQ extends D${constructor($,J,Q=!1){let Z={...En(),...$},q=new $7;if(Z.open&&$?.mounted===void 0)Z.mounted=!0;Z.floatingRootContext=LP(q,J,Q);super(Z,{popupRef:n7.createRef(),backdropRef:n7.createRef(),internalBackdropRef:n7.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:n7.createRef(),beforeContentFocusGuardRef:n7.createRef(),stickIfOpenTimeout:new T8,triggerElements:q},yn)}setOpen=($,J)=>{let Q=J.reason===T0.triggerHover,Z=J.reason===T0.triggerPress&&J.event.detail===0,q=!$&&(J.reason===T0.escapeKey||J.reason==null),X=qG(J),Y=this.select("activeTriggerId");if(!$&&J.reason===T0.closePress&&J.trigger==null&&Y!=null)J.trigger=this.context.triggerElements.getById(Y)??this.select("activeTriggerElement")??void 0;if(this.context.onOpenChange?.($,J),J.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange($,J);let z=()=>{let K={open:$,openChangeReason:J.reason};ZG(K,$,J.trigger,X()),this.update(K)};if(Q)this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(aK,()=>{this.set("stickIfOpen",!1)}),OP.flushSync(z);else z();if(Z||q)this.set("instantType",Z?"click":"dismiss");else if(J.reason===T0.focusOut)this.set("instantType","focus");else this.set("instantType",void 0)};static useStore($,J){let{store:Q,internalStore:Z}=HP($,(q,X)=>new UQ(J,q,X));return n7.useEffect(()=>Z?.disposeEffect(),[Z]),Q}disposeEffect=()=>{return this.context.stickIfOpenTimeout.disposeEffect()}}function AP({props:$}){let{children:J,open:Q,defaultOpen:Z=!1,onOpenChange:q,onOpenChangeComplete:X,modal:Y=!1,handle:z,triggerId:K,defaultTriggerId:W=null}=$,H=UQ.useStore(z?.store,{modal:Y,open:Z,openProp:Q,activeTriggerId:W,triggerIdProp:K});XG(H,Q,Z,W),H.useControlledProp("openProp",Q),H.useControlledProp("triggerIdProp",K);let B=H.useState("open"),U=H.useState("mounted"),_=H.useState("payload"),L=h8()!=null;H.useContextCallback("onOpenChange",q),H.useContextCallback("onOpenChangeComplete",X),BP(H,B),zG(H);let{forceUnmount:F}=KG(B,H,()=>{H.update({stickIfOpen:!0,openChangeReason:null})});H.useSyncedValues({modal:Y,nested:L}),J7.useEffect(()=>{if(!B)H.context.stickIfOpenTimeout.clear()},[H,B]);let V=J7.useCallback(()=>{H.setOpen(!1,l0(T0.imperativeAction))},[H]);J7.useImperativeHandle($.actionsRef,()=>({unmount:F,close:V}),[F,V]);let M=B||U,D=J7.useMemo(()=>({store:H}),[H]);return b(bL.Provider,{value:D,children:[M&&G(Pn,{store:H,modal:Y}),typeof J==="function"?J({payload:_}):J]})}function wP($){if(S5(!0))return G(AP,{props:$});return G(uq,{children:G(AP,{props:$})})}function Pn({store:$,modal:J}){let Q=$.useState("floatingRootContext"),Z=dq(Q,{outsidePressEvent:{mouse:J==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),q=Z.reference??I1,X=Z.trigger??I1,Y=J7.useMemo(()=>S8(HQ,Z.floating),[Z.floating]);return GG($,{activeTriggerProps:q,inactiveTriggerProps:X,popupProps:Y}),null}var a7=R(v(),1);var LQ=R(v(),1);var AG=R(v(),1),Rn=AG.createContext(void 0);function _Q($=!1){let J=AG.useContext(Rn);if(J===void 0&&!$)throw Error(M1(16));return J}var kP=R(v(),1);function IP($){let{focusableWhenDisabled:J,disabled:Q,composite:Z=!1,tabIndex:q=0,isNativeButton:X}=$,Y=Z&&J!==!1,z=Z&&J===!1;return{props:kP.useMemo(()=>{let W={onKeyDown(H){if(Q&&J&&H.key!=="Tab")H.preventDefault()}};if(!Z){if(W.tabIndex=q,!X&&Q)W.tabIndex=J?q:-1}if(X&&(J||Y)||!X&&Q)W["aria-disabled"]=Q;if(X&&(!J||z))W.disabled=Q;return W},[Z,Q,J,Y,z,X,q])}}function x6($={}){let{disabled:J=!1,focusableWhenDisabled:Q,tabIndex:Z=0,native:q=!0,composite:X}=$,Y=LQ.useRef(null),z=_Q(!0),K=X??z!==void 0,{props:W}=IP({focusableWhenDisabled:Q,disabled:J,composite:K,tabIndex:Z,isNativeButton:q}),H=LQ.useCallback(()=>{let _=Y.current;if(!jL(_))return;if(K&&J&&W.disabled===void 0&&_.disabled)_.disabled=!1},[J,W.disabled,K]);y0(H,[H]);let B=LQ.useCallback((_={})=>{let{onClick:L,onMouseDown:F,onKeyUp:V,onKeyDown:M,onPointerDown:D,...N}=_;return S8({onClick(O){if(J){O.preventDefault();return}L?.(O)},onMouseDown(O){if(!J)F?.(O)},onKeyDown(O){if(J)return;if(fq(O),M?.(O),O.baseUIHandlerPrevented)return;let I=O.target===O.currentTarget,k=O.currentTarget,T=jL(k),A=!q&&Cn(k),w=I&&(q?T:!A),C=O.key==="Enter",y=O.key===" ",x=k.getAttribute("role"),j=x?.startsWith("menuitem")||x==="option"||x==="gridcell";if(I&&K&&y){if(O.defaultPrevented&&j)return;if(O.preventDefault(),A||q&&T)k.click(),O.preventBaseUIHandler();else if(w)L?.(O),O.preventBaseUIHandler();return}if(w){if(!q&&(y||C))O.preventDefault();if(!q&&C)L?.(O)}},onKeyUp(O){if(J)return;if(fq(O),V?.(O),O.target===O.currentTarget&&q&&K&&jL(O.currentTarget)&&O.key===" "){O.preventDefault();return}if(O.baseUIHandlerPrevented)return;if(O.target===O.currentTarget&&!q&&!K&&O.key===" ")L?.(O)},onPointerDown(O){if(J){O.preventDefault();return}D?.(O)}},q?{type:"button"}:{role:"button"},W,N)},[J,W,K,q]),U=g0((_)=>{Y.current=_,H()});return{getButtonProps:B,buttonRef:U}}function jL($){return R1($)&&$.tagName==="BUTTON"}function Cn($){return Boolean($?.tagName==="A"&&$?.href)}var yL=function($){return $.open="data-open",$.closed="data-closed",$[$.startingStyle=N$.startingStyle]="startingStyle",$[$.endingStyle=N$.endingStyle]="endingStyle",$.anchorHidden="data-anchor-hidden",$.side="data-side",$.align="data-align",$}({}),EL=function($){return $.popupOpen="data-popup-open",$.pressed="data-pressed",$}({}),Sn={[EL.popupOpen]:""},hn={[EL.popupOpen]:"",[EL.pressed]:""},xn={[yL.open]:""},fn={[yL.closed]:""},vn={[yL.anchorHidden]:""},wG={open($){if($)return Sn;return null}},sq={open($){if($)return hn;return null}},w6={open($){if($)return xn;return fn},anchorHidden($){if($)return vn;return null}};var TP=300;function h5($){return h6($,"base-ui")}var bP=R(v(),1),PL=R($5(),1);function kG($,J){let Q=bP.useRef(null);function Z(X){PL.flushSync(()=>{$.setOpen(!1,l0(T0.focusOut,X.nativeEvent,X.currentTarget))}),Ay(Q.current)?.focus()}function q(X){let Y=$.select("positionerElement");if(Y&&a4(X,Y))$.context.beforeContentFocusGuardRef.current?.focus();else{PL.flushSync(()=>{$.setOpen(!1,l0(T0.focusOut,X.nativeEvent,X.currentTarget))});let z=Oy($.context.triggerFocusTargetRef.current||J.current);while(z!==null&&e0(Y,z)){let K=z;if(z=YQ(z),z===K)break}z?.focus()}}return{preFocusGuardRef:Q,handlePreFocusGuardFocus:Z,handleFocusTargetFocus:q}}var nq=R(v(),1);var oq=R(v(),1);function jP($){let J=oq.useRef(""),Q=oq.useCallback((q)=>{if(q.defaultPrevented)return;J.current=q.pointerType,$(q,q.pointerType)},[$]);return{onClick:oq.useCallback((q)=>{if(q.detail===0){$(q,"keyboard");return}if("pointerType"in q)$(q,q.pointerType);else $(q,J.current);J.current=""},[$]),onPointerDown:Q}}var EP=R(v(),1);function IG($,J){let Q=EP.useRef($),Z=g0(J);y0(()=>{if(Q.current===$)return;Z(Q.current)},[$,Z]),y0(()=>{Q.current=$},[$])}function RL($,J){let Q=g0((X,Y)=>{if(!(typeof $==="function"?$():$))J(Y||(c1.os.ios?"touch":""))}),{onClick:Z,onPointerDown:q}=jP(Q);return nq.useMemo(()=>({onClick:Z,onPointerDown:q}),[Z,q])}function yP($){let[J,Q]=nq.useState(null),Z=RL($,Q);return IG($,(q)=>{if(q&&!$)Q(null)}),nq.useMemo(()=>({openMethod:J,triggerProps:Z}),[J,Z])}var PP=a7.forwardRef(function(J,Q){let{render:Z,className:q,style:X,disabled:Y=!1,nativeButton:z=!0,handle:K,payload:W,openOnHover:H=!1,delay:B=TP,closeDelay:U=0,id:_,...L}=J,F=S5(!0),V=K?.store??F?.store;if(!V)throw Error(M1(74));let M=h5(_),D=V.useState("isTriggerActive",M),N=V.useState("floatingRootContext"),O=V.useState("isOpenedByTrigger",M),I=V.useState("triggerPopupId",M),k=a7.useRef(null),{registerTrigger:T,isMountedByThisTrigger:A}=YG(M,k,V,{payload:W,disabled:Y,openOnHover:H,closeDelay:U}),w=V.useState("openChangeReason"),C=V.useState("stickIfOpen"),y=V.useState("openMethod"),x=V.useState("focusManagerModal"),j=O$(N,{enabled:!Y&&N!=null&&H&&(y!=="touch"||w!==T0.triggerPress),mouseOnly:!0,move:!1,handleClose:w$(),restMs:B,delay:{close:U},triggerElementRef:k,isActiveTrigger:D,isClosing:()=>V.select("transitionStatus")==="ending"}),P=V$(N,{enabled:N!=null,stickIfOpen:C}),h=RL(()=>V.select("open"),(E)=>{V.set("openMethod",E)}),l=V.useState("triggerProps",A),{getButtonProps:t,buttonRef:S}=x6({disabled:Y,native:z}),i={open(E){if(E&&w===T0.triggerPress)return sq.open(E);return wG.open(E)}},{preFocusGuardRef:J0,handlePreFocusGuardFocus:K0,handleFocusTargetFocus:e}=kG(V,k),q0=o0("button",J,{state:{disabled:Y,open:O},ref:[S,Q,T,k],props:[P.reference,j,l,h,{[tK]:"",id:M,"aria-haspopup":"dialog","aria-expanded":O,"aria-controls":I},L,t],stateAttributesMapping:i});if(A&&!x)return b(a7.Fragment,{children:[G(L9,{ref:J0,onFocus:K0}),G(a7.Fragment,{children:q0},M),G(L9,{ref:V.context.triggerFocusTargetRef,onFocus:e})]});return G(a7.Fragment,{children:q0},M)});var CP=R(v(),1);var TG=R(v(),1),CL=TG.createContext(void 0);function RP(){let $=TG.useContext(CL);if($===void 0)throw Error(M1(45));return $}var SP=CP.forwardRef(function(J,Q){let{keepMounted:Z=!1,...q}=J,{store:X}=S5();if(!(X.useState("mounted")||Z))return null;return G(CL.Provider,{value:Z,children:G(vq,{ref:Q,...q})})});var DQ=R(v(),1);function FQ($){if(KQ(19))return $;return $?"true":void 0}var bG=R(v(),1),SL=bG.createContext(void 0);function VQ(){let $=bG.useContext(SL);if(!$)throw Error(M1(46));return $}var f6=R(v(),1);var jG=R(v(),1),gn=jG.createContext(void 0);function t7(){return jG.useContext(gn)?.direction??"ltr"}var un=($)=>({name:"arrow",options:$,async fn(J){let{x:Q,y:Z,placement:q,rects:X,platform:Y,elements:z,middlewareData:K}=J,{element:W,padding:H=0,offsetParent:B="real"}=u6($,J)||{};if(W==null)return{};let U=gQ(H),_={x:Q,y:Z},L=m$(q),F=u$(L),V=await Y.getDimensions(W),M=L==="y",D=M?"top":"left",N=M?"bottom":"right",O=M?"clientHeight":"clientWidth",I=X.reference[F]+X.reference[L]-_[L]-X.floating[F],k=_[L]-X.reference[L],T=B==="real"?await Y.getOffsetParent?.(W):z.floating,A=z.floating[O]||X.floating[F];if(!A||!await Y.isElement?.(T))A=z.floating[O]||X.floating[F];let w=I/2-k/2,C=A/2-V[F]/2-1,y=Math.min(U[D],C),x=Math.min(U[N],C),j=y,P=A-V[F]-x,h=A/2-V[F]/2+w,l=g$(j,h,P),t=!K.arrow&&m6(q)!=null&&h!==l&&X.reference[F]/2-(h({...un($),options:[$,J]});var mn=rQ().fn,xP={name:"hide",async fn($){let{width:J,height:Q,x:Z,y:q}=$.rects.reference,X=J===0&&Q===0&&Z===0&&q===0;return{data:{referenceHidden:(await mn($)).data?.referenceHidden||X}}}};var aq={sideX:"left",sideY:"top"},EG={name:"adaptiveOrigin",async fn($){let{x:J,y:Q,rects:{floating:Z},elements:{floating:q},platform:X,strategy:Y,placement:z}=$,K=S1(q),W=K.getComputedStyle(q);if(!(W.transitionDuration!=="0s"&&W.transitionDuration!==""))return{x:J,y:Q,data:aq};let B=await X.getOffsetParent?.(q),U={width:0,height:0};if(Y==="fixed"&&K?.visualViewport)U={width:K.visualViewport.width,height:K.visualViewport.height};else if(B===K){let D=z1(q);U={width:D.documentElement.clientWidth,height:D.documentElement.clientHeight}}else if(await X.isElement?.(B))U=await X.getDimensions(B);let _=j8(z),L=J,F=Q;if(_==="left")L=U.width-(J+Z.width);if(_==="top")F=U.height-(Q+Z.height);let V=_==="left"?"right":aq.sideX,M=_==="top"?"bottom":aq.sideY;return{x:L,y:F,data:{sideX:V,sideY:M}}}};function gP($,J,Q){let Z=$==="inline-start"||$==="inline-end";return{top:"top",right:Z?Q?"inline-start":"inline-end":"right",bottom:"bottom",left:Z?Q?"inline-end":"inline-start":"left"}[J]}function fP($,J,Q){let{rects:Z,placement:q}=$;return{side:gP(J,j8(q),Q),align:m6(q)||"center",anchor:{width:Z.reference.width,height:Z.reference.height},positioner:{width:Z.floating.width,height:Z.floating.height}}}function yG($){let{anchor:J,positionMethod:Q="absolute",side:Z="bottom",sideOffset:q=0,align:X="center",alignOffset:Y=0,collisionBoundary:z,collisionPadding:K=5,sticky:W=!1,arrowPadding:H=5,disableAnchorTracking:B=!1,inline:U,keepMounted:_=!1,floatingRootContext:L,mounted:F,collisionAvoidance:V,shiftCrossAxis:M=!1,nodeId:D,adaptiveOrigin:N,lazyFlip:O=!1,externalTree:I}=$,[k,T]=f6.useState(null);if(!F&&k!==null)T(null);let A=V.side||"flip",w=V.align||"flip",C=V.fallbackAxisSide||"end",y=typeof J==="function"?J:void 0,x=g0(y),j=y?x:J,P=_5(J),h=_5(F),t=t7()==="rtl",S=k||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":t?"left":"right","inline-start":t?"right":"left"}[Z],i=X==="center"?S:`${S}-${X}`,J0=K,K0=1,e=Z==="bottom"?K0:0,H0=Z==="top"?K0:0,q0=Z==="right"?K0:0,E=Z==="left"?K0:0;if(typeof J0==="number")J0={top:J0+e,right:J0+E,bottom:J0+H0,left:J0+q0};else if(J0)J0={top:(J0.top||0)+e,right:(J0.right||0)+E,bottom:(J0.bottom||0)+H0,left:(J0.left||0)+q0};let d={boundary:z==="clipping-ancestors"?"clippingAncestors":z,padding:J0},c=f6.useRef(null),r=_5(q),u=_5(Y),m=typeof q!=="function"?q:0,s=typeof Y!=="function"?Y:0,f=[];if(U)f.push(U);f.push(cQ((n)=>{let D0=fP(n,Z,t),O0=typeof r.current==="function"?r.current(D0):r.current,v0=typeof u.current==="function"?u.current(D0):u.current;return{mainAxis:O0,crossAxis:v0,alignmentAxis:v0}},[m,s,t,Z]));let o=w==="none"&&A!=="shift",G0=!o&&(W||M||A==="shift"),p=A==="none"?null:lQ({...d,padding:{top:J0.top+K0,right:J0.right+K0,bottom:J0.bottom+K0,left:J0.left+K0},mainAxis:!M&&A==="flip",crossAxis:w==="flip"?"alignment":!1,fallbackAxisSideDirection:C}),Z0=o?null:dQ((n)=>{let D0=z1(n.elements.floating).documentElement;return{...d,rootBoundary:M?{x:0,y:0,width:D0.clientWidth,height:D0.clientHeight}:void 0,mainAxis:w!=="none",crossAxis:G0,limiter:W||M?void 0:pQ((O0)=>{if(!c.current)return{};let{width:v0,height:i0}=c.current.getBoundingClientRect(),G1=z6(j8(O0.placement)),h1=G1==="y"?v0:i0,i1=G1==="y"?J0.left+J0.right:J0.top+J0.bottom;return{offset:h1/2+i1/2}})}},[d,W,M,J0,w]);if(A==="shift"||w==="shift"||X==="center")f.push(Z0,p);else f.push(p,Z0);f.push(iQ({...d,apply({elements:{floating:n},availableWidth:D0,availableHeight:O0,rects:v0}){if(!h.current)return;let i0=n.style;i0.setProperty("--available-width",`${D0}px`),i0.setProperty("--available-height",`${O0}px`);let G1=S1(n).devicePixelRatio||1,{x:h1,y:i1,width:Y0,height:C0}=v0.reference,x0=(Math.round((h1+Y0)*G1)-Math.round(h1*G1))/G1,r0=(Math.round((i1+C0)*G1)-Math.round(i1*G1))/G1;i0.setProperty("--anchor-width",`${x0}px`),i0.setProperty("--anchor-height",`${r0}px`)}}),hP((n)=>({element:c.current||z1(n.elements.floating).createElement("div"),padding:H,offsetParent:"floating"}),[H]),{name:"transformOrigin",fn(n){let{elements:D0,middlewareData:O0,placement:v0,rects:i0,y:G1}=n,h1=j8(v0),i1=z6(h1),Y0=c.current,C0=O0.arrow?.x||0,x0=O0.arrow?.y||0,r0=Y0?.clientWidth||0,E0=Y0?.clientHeight||0,F1=C0+r0/2,r1=x0+E0/2,y1=Math.abs(O0.shift?.y||0),t1=i0.reference.height/2,L5=typeof q==="function"?q(fP(n,Z,t)):q,z0=y1>L5,A0={top:`${F1}px calc(100% + ${L5}px)`,bottom:`${F1}px ${-L5}px`,left:`calc(100% + ${L5}px) ${r1}px`,right:`${-L5}px ${r1}px`}[h1],f0=`${F1}px ${i0.reference.y+t1-G1}px`;return D0.floating.style.setProperty("--transform-origin",G0&&i1==="y"&&z0?f0:A0),{}}},xP,N),y0(()=>{if(!F&&L)L.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[F,L]);let Q0=f6.useMemo(()=>({elementResize:!B&&typeof ResizeObserver<"u",layoutShift:!B&&typeof IntersectionObserver<"u"}),[B]),{refs:B0,elements:W0,x:L0,y:_0,middlewareData:N0,update:d0,placement:g,context:a,isPositioned:I0,floatingStyles:w0}=ML({rootContext:L,open:_?F:void 0,placement:i,middleware:f,strategy:Q,whileElementsMounted:_?void 0:(...n)=>_2(...n,Q0),nodeId:D,externalTree:I}),{sideX:F0,sideY:u0}=N0.adaptiveOrigin||aq,P0=I0?Q:"fixed",n0=f6.useMemo(()=>{let n=N?{position:P0,[F0]:L0,[u0]:_0}:{position:P0,...w0};if(!I0)n.opacity=0;return n},[N,P0,F0,L0,u0,_0,w0,I0]),R0=f6.useRef(null);y0(()=>{if(!F)return;let n=P.current,D0=typeof n==="function"?n():n,v0=(vP(D0)?D0.current:D0)||null||null;if(v0!==R0.current)B0.setPositionReference(v0),R0.current=v0},[F,B0,j,P]),f6.useEffect(()=>{if(!F)return;let n=P.current;if(typeof n==="function")return;if(vP(n)&&n.current!==R0.current)B0.setPositionReference(n.current),R0.current=n.current},[F,B0,j,P]),f6.useEffect(()=>{if(_&&F&&W0.reference&&W0.floating)return _2(W0.reference,W0.floating,d0,Q0);return},[_,F,W0,d0,Q0]);let Z1=j8(g),K1=gP(Z,Z1,t),a0=m6(g)||"center",T1=Boolean(N0.hide?.referenceHidden);y0(()=>{if(O&&F&&I0)T(Z1)},[O,F,I0,Z1]);let v1=f6.useMemo(()=>({position:"absolute",top:N0.arrow?.y,left:N0.arrow?.x}),[N0.arrow]),E1=N0.arrow?.centerOffset!==0;return f6.useMemo(()=>({positionerStyles:n0,arrowStyles:v1,arrowRef:c,arrowUncentered:E1,side:K1,align:a0,physicalSide:Z1,anchorHidden:T1,refs:B0,context:a,isPositioned:I0,update:d0}),[n0,v1,c,E1,K1,a0,Z1,T1,B0,a,I0,d0])}function vP($){return $!=null&&"current"in $}var uP=R(v(),1);var PG=uP.forwardRef(function(J,Q){let{cutout:Z,...q}=J,X;if(Z){let Y=Z.getBoundingClientRect();X=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${Y.left}px ${Y.top}px,${Y.left}px ${Y.bottom}px,${Y.right}px ${Y.bottom}px,${Y.right}px ${Y.top}px,${Y.left}px ${Y.top}px)`}return G("div",{ref:Q,role:"presentation","data-base-ui-inert":"",...q,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:X}})});function MQ($){return $==="starting"?cy:I1}function RG($,J,{styles:Q,transitionStatus:Z,props:q,refs:X,hidden:Y,inert:z=!1}){let K={...Q};if(z)K.pointerEvents="none";return o0("div",$,{state:J,ref:X,props:[{role:"presentation",hidden:Y,style:K},MQ(Z),q],stateAttributesMapping:w6})}var iP=R(v(),1);var mP={},cP={},dP="";function cn($){if(typeof document>"u")return!1;let J=z1($);return S1(J).innerWidth-J.documentElement.clientWidth>0}function dn($){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;let Q=z1($),Z=Q.documentElement,q=Q.body,X=i9(Z)?Z:q,Y=X.style.overflowY,z=Z.style.scrollbarGutter;Z.style.scrollbarGutter="stable",X.style.overflowY="scroll";let K=X.offsetWidth;X.style.overflowY="hidden";let W=X.offsetWidth;return X.style.overflowY=Y,Z.style.scrollbarGutter=z,K===W}function pn($){let J=z1($),Q=J.documentElement,Z=J.body,q=i9(Q)?Q:Z,X={overflowY:q.style.overflowY,overflowX:q.style.overflowX};return Object.assign(q.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(q.style,X)}}function ln($){let J=z1($),Q=J.documentElement,Z=J.body,q=S1(Q),X=0,Y=0,z=!1,K=_9.create();if(c1.engine.webkit&&(q.visualViewport?.scale??1)!==1)return()=>{};function W(){let _=q.getComputedStyle(Q),L=q.getComputedStyle(Z),M=(_.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";X=Q.scrollTop,Y=Q.scrollLeft,mP={scrollbarGutter:Q.style.scrollbarGutter,overflowY:Q.style.overflowY,overflowX:Q.style.overflowX},dP=Q.style.scrollBehavior,cP={position:Z.style.position,height:Z.style.height,width:Z.style.width,boxSizing:Z.style.boxSizing,overflowY:Z.style.overflowY,overflowX:Z.style.overflowX,scrollBehavior:Z.style.scrollBehavior};let D=Q.scrollHeight>Q.clientHeight,N=Q.scrollWidth>Q.clientWidth,O=_.overflowY==="scroll"||L.overflowY==="scroll",I=_.overflowX==="scroll"||L.overflowX==="scroll",k=Math.max(0,q.innerWidth-Z.clientWidth),T=Math.max(0,q.innerHeight-Z.clientHeight),A=parseFloat(L.marginTop)+parseFloat(L.marginBottom),w=parseFloat(L.marginLeft)+parseFloat(L.marginRight),C=i9(Q)?Q:Z;if(z=dn($),z){Q.style.scrollbarGutter=M,C.style.overflowY="hidden",C.style.overflowX="hidden";return}if(Object.assign(Q.style,{scrollbarGutter:M,overflowY:"hidden",overflowX:"hidden"}),D||O)Q.style.overflowY="scroll";if(N||I)Q.style.overflowX="scroll";Object.assign(Z.style,{position:"relative",height:A||T?`calc(100dvh - ${A+T}px)`:"100dvh",width:w||k?`calc(100vw - ${w+k}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),Z.scrollTop=X,Z.scrollLeft=Y,Q.setAttribute("data-base-ui-scroll-locked",""),Q.style.scrollBehavior="unset"}function H(){if(Object.assign(Q.style,mP),Object.assign(Z.style,cP),!z)Q.scrollTop=X,Q.scrollLeft=Y,Q.removeAttribute("data-base-ui-scroll-locked"),Q.style.scrollBehavior=dP}function B(){H(),K.request(W)}W();let U=_1(q,"resize",B);return()=>{if(K.cancel(),H(),typeof q.removeEventListener==="function")U()}}class pP{lockCount=0;restore=null;timeoutLock=T8.create();timeoutUnlock=T8.create();acquire($){if(this.lockCount+=1,this.lockCount===1&&this.restore===null)this.timeoutLock.start(0,()=>this.lock($));return this.release}release=()=>{if(this.lockCount-=1,this.lockCount===0&&this.restore)this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{if(this.lockCount===0&&this.restore)this.restore?.(),this.restore=null};lock($){if(this.lockCount===0||this.restore!==null)return;let Q=z1($).documentElement,Z=S1(Q).getComputedStyle(Q).overflowY;if(Z==="hidden"||Z==="clip"){this.restore=m1;return}let q=c1.os.ios||!cn($);this.restore=q?pn($):ln($)}}var rn=new pP;function lP($=!0,J=null){y0(()=>{if(!$)return;return rn.acquire(J)},[$,J])}var sn=20;function CG($,J,Q,Z){let[q,X]=iP.useState(!1);y0(()=>{if(!$||!J||Q==null){X(!1);return}let Y=z1(Q).documentElement.clientWidth,z=Q.offsetWidth;X(Y>0&&z>0&&z>=Y-sn)},[$,J,Q]),lP($&&(!J||q),Z)}var rP=DQ.forwardRef(function(J,Q){let{render:Z,className:q,style:X,anchor:Y,positionMethod:z="absolute",side:K="bottom",align:W="center",sideOffset:H=0,alignOffset:B=0,collisionBoundary:U="clipping-ancestors",collisionPadding:_=5,arrowPadding:L=5,sticky:F=!1,disableAnchorTracking:V=!1,collisionAvoidance:M=eK,...D}=J,{store:N}=S5(),O=RP(),I=F$(),k=N.useState("floatingRootContext"),T=N.useState("mounted"),A=N.useState("open"),w=N.useState("openChangeReason"),C=N.useState("activeTriggerElement"),y=N.useState("modal"),x=N.useState("openMethod"),j=N.useState("positionerElement"),P=N.useState("instantType"),h=N.useState("transitionStatus"),l=N.useState("hasViewport"),t=DQ.useRef(null),S=B4(j,!1,!1),i=yG({anchor:Y,floatingRootContext:k,positionMethod:z,mounted:T,side:K,sideOffset:H,align:W,alignOffset:B,arrowPadding:L,collisionBoundary:U,collisionPadding:_,sticky:F,disableAnchorTracking:V,keepMounted:O,nodeId:I,collisionAvoidance:M,adaptiveOrigin:l?EG:void 0}),J0=k.useState("domReferenceElement");y0(()=>{let q0=J0,E=t.current;if(q0)t.current=q0;if(E&&q0&&q0!==E){N.set("instantType",void 0);let d=new AbortController;return S(()=>{N.set("instantType","trigger-change")},d.signal),()=>{d.abort()}}return},[J0,S,N]),CG(A&&y===!0&&w!==T0.triggerHover,x==="touch",j,C);let K0=DQ.useCallback((q0)=>{N.set("positionerElement",q0)},[N]),e={open:A,side:i.side,align:i.align,anchorHidden:i.anchorHidden,instant:P},H0=RG(J,e,{styles:i.positionerStyles,transitionStatus:h,props:D,refs:[Q,K0],hidden:!T,inert:!A});return b(SL.Provider,{value:i,children:[T&&y===!0&&w!==T0.triggerHover&&G(PG,{ref:N.context.internalBackdropRef,inert:FQ(!A),cutout:C}),G(gq,{id:I,children:H0})]})});var fG=R(v(),1);var on="ArrowUp",nn="ArrowDown",an="ArrowLeft",tn="ArrowRight",en="Home",$a="End";var Ja=new Set([an,tn]);var Qa=new Set([on,nn]);var Za=new Set([...Ja,...Qa]),SG=new Set([...Za,en,$a]);var hG=R(v(),1),qa=hG.createContext(void 0);function xG($){let J=hG.useContext(qa);if(J===void 0&&!$)throw Error(M1(69));return J}var e7=R(v(),1);var sP=e7.createContext(void 0);function oP(){let[$,J]=e7.useState(0),Q=g0(()=>{return J((q)=>q+1),()=>{J((q)=>Math.max(0,q-1))}});return{context:e7.useMemo(()=>({register:Q}),[Q]),hasClosePart:$>0}}function nP($){let{value:J,children:Q}=$;return G(sP.Provider,{value:J,children:Q})}function aP(){let $=e7.useContext(sP);y0(()=>{return $?.register()},[$])}var Xa={...w6,...H4},tP=fG.forwardRef(function(J,Q){let{render:Z,className:q,style:X,initialFocus:Y,finalFocus:z,...K}=J,{store:W}=S5(),H=VQ(),B=xG(!0)!=null,{context:U,hasClosePart:_}=oP(),L=W.useState("open"),F=W.useState("openMethod"),V=W.useState("instantType"),M=W.useState("transitionStatus"),D=W.useState("popupProps"),N=W.useState("titleElementId"),O=W.useState("descriptionElementId"),I=W.useState("modal"),k=W.useState("mounted"),T=W.useState("openChangeReason"),A=W.useState("activeTriggerElement"),w=W.useState("floatingRootContext"),C=w.useState("floatingId"),y=W.useState("disabled"),x=W.useState("openOnHover"),j=W.useState("closeDelay"),P=K.id??C;U4({open:L,ref:W.context.popupRef,onComplete(){if(L)W.context.onOpenChangeComplete?.(!0)}}),rq(w,{enabled:x&&!y,closeDelay:j});let h=Y===void 0?WP(W.context.popupRef):Y,l=I!==!1&&_;W.useSyncedValue("focusManagerModal",l);let t=fG.useCallback((J0)=>{W.set("popupElement",J0)},[W]),S={open:L,side:H.side,align:H.align,instant:V,transitionStatus:M},i=o0("div",J,{state:S,ref:[Q,W.context.popupRef,t],props:[D,{id:P,role:"dialog",...HQ,"aria-labelledby":N,"aria-describedby":O,onKeyDown(J0){if(B&&SG.has(J0.key))J0.stopPropagation()}},MQ(M),K],stateAttributesMapping:Xa});return G(mq,{context:w,openInteractionType:F,modal:l,disabled:!k||T===T0.triggerHover,initialFocus:h,returnFocus:z,restoreFocus:"popup",previousFocusableElement:R1(A)?A:void 0,nextFocusableElement:W.context.triggerFocusTargetRef,beforeContentFocusGuardRef:W.context.beforeContentFocusGuardRef,children:G(nP,{value:U,children:i})})});var eP=R(v(),1);var $R=eP.forwardRef(function(J,Q){let{render:Z,className:q,style:X,...Y}=J,{store:z}=S5(),K=z.useState("open"),{arrowRef:W,side:H,align:B,arrowUncentered:U,arrowStyles:_}=VQ();return o0("div",J,{state:{open:K,side:H,align:B,uncentered:U},ref:[Q,W],props:[{style:_,"aria-hidden":!0},Y],stateAttributesMapping:w6})});var JR=R(v(),1);var Ya={...w6,...H4},QR=JR.forwardRef(function(J,Q){let{render:Z,className:q,style:X,...Y}=J,{store:z}=S5(),K=z.useState("open"),W=z.useState("mounted"),H=z.useState("transitionStatus"),B=z.useState("openChangeReason");return o0("div",J,{state:{open:K,transitionStatus:H},ref:[z.context.backdropRef,Q],props:[{role:"presentation",hidden:!W,style:{pointerEvents:B===T0.triggerHover?"none":void 0,userSelect:"none",WebkitUserSelect:"none"}},Y],stateAttributesMapping:Ya})});var ZR=R(v(),1);var qR=ZR.forwardRef(function(J,Q){let{render:Z,className:q,style:X,...Y}=J,{store:z}=S5(),K=h5(Y.id);return z.useSyncedValueWithCleanup("titleElementId",K),o0("h2",J,{ref:Q,props:[{id:K},Y]})});var XR=R(v(),1);var YR=XR.forwardRef(function(J,Q){let{render:Z,className:q,style:X,...Y}=J,{store:z}=S5(),K=h5(Y.id);return z.useSyncedValueWithCleanup("descriptionElementId",K),o0("p",J,{ref:Q,props:[{id:K},Y]})});var zR=R(v(),1);var KR=zR.forwardRef(function(J,Q){let{render:Z,className:q,style:X,disabled:Y=!1,nativeButton:z=!0,...K}=J,{buttonRef:W,getButtonProps:H}=x6({disabled:Y,focusableWhenDisabled:!1,native:z}),{store:B}=S5();return aP(),o0("button",J,{ref:[Q,W],props:[{onClick(_){B.setOpen(!1,l0(T0.closePress,_.nativeEvent))}},K,H]})});var FR=R(v(),1);var GR=function($){return $.popupWidth="--popup-width",$.popupHeight="--popup-height",$}({});var i8=R(v(),1),LR=R($5(),1);var WR=R(v(),1);function HR($){let[J,Q]=WR.useState({current:$,previous:null});if($!==J.current)Q({current:$,previous:J.current});return J.previous}var NQ=R(v(),1);function hL($){let J=d5($),Q=parseFloat(J.width)||0,Z=parseFloat(J.height)||0,q=R1($),X=q?$.offsetWidth:Q,Y=q?$.offsetHeight:Z;if(H7(Q)!==X||H7(Z)!==Y)Q=X,Z=Y;return{width:Q,height:Z}}function UR($){let{popupElement:J,positionerElement:Q,content:Z,mounted:q,onMeasureLayout:X,onMeasureLayoutComplete:Y,side:z,direction:K}=$,W=B4(J,!0,!1),H=S6(),B=NQ.useRef(null),U=NQ.useRef(!0),_=NQ.useRef(m1),L=g0(X),F=g0(Y),V=NQ.useMemo(()=>{let M=z==="top",D=z==="left";if(K==="rtl")M=M||z==="inline-end",D=D||z==="inline-end";else M=M||z==="inline-start",D=D||z==="inline-start";return M?{position:"absolute",[z==="top"?"bottom":"top"]:"0",[D?"right":"left"]:"0"}:I1},[z,K]);y0(()=>{if(!q){_.current=m1,U.current=!0,B.current=null;return}if(!J||!Q)return;_.current=BR(J,V),xL(J,"auto");let M=gG(J,"position","static"),D=gG(J,"transform","none"),N=gG(J,"scale","1"),O=BR(Q,{"--available-width":"max-content","--available-height":"max-content"});function I(){M(),D(),O()}function k(){I(),N()}if(L?.(),U.current||B.current===null){vG(Q,"max-content");let C=hL(J);return B.current=C,vG(Q,C),k(),F?.(null,C),U.current=!1,()=>{_.current(),_.current=m1}}vG(Q,"max-content");let T=B.current,A=hL(J);B.current=A,xL(J,T),k(),F?.(T,A),vG(Q,A);let w=new AbortController;return H.request(()=>{xL(J,A),W(()=>{J.style.setProperty("--popup-width","auto"),J.style.setProperty("--popup-height","auto")},w.signal)}),()=>{w.abort(),H.cancel(),_.current(),_.current=m1}},[Z,J,Q,W,H,q,L,F,V])}function gG($,J,Q){let Z=$.style.getPropertyValue(J);return $.style.setProperty(J,Q),()=>{$.style.setProperty(J,Z)}}function BR($,J){let Q=[];for(let[Z,q]of Object.entries(J))Q.push(gG($,Z,q));return Q.length?()=>{Q.forEach((Z)=>Z())}:m1}function xL($,J){let Q=J==="auto"?"auto":`${J.width}px`,Z=J==="auto"?"auto":`${J.height}px`;$.style.setProperty("--popup-width",Q),$.style.setProperty("--popup-height",Z)}function vG($,J){let Q=J==="max-content"?"max-content":`${J.width}px`,Z=J==="max-content"?"max-content":`${J.height}px`;$.style.setProperty("--positioner-width",Q),$.style.setProperty("--positioner-height",Z)}function uG($){let{store:J,side:Q,cssVars:Z,children:q}=$,X=t7(),Y=J.useState("activeTriggerElement"),z=J.useState("activeTriggerId"),K=J.useState("open"),W=J.useState("payload"),H=J.useState("mounted"),B=J.useState("popupElement"),U=J.useState("positionerElement"),_=HR(K?Y:null),L=Ga(z,W),F=i8.useRef(null),[V,M]=i8.useState(null),[D,N]=i8.useState(null),O=i8.useRef(null),I=i8.useRef(null),k=B4(O,!0,!1),T=S6(),[A,w]=i8.useState(null),[C,y]=i8.useState(!1);y0(()=>{return J.set("hasViewport",!0),()=>{J.set("hasViewport",!1)}},[J]);let x=g0(()=>{O.current?.style.setProperty("animation","none"),O.current?.style.setProperty("transition","none"),I.current?.style.setProperty("display","none")}),j=g0((S)=>{if(O.current?.style.removeProperty("animation"),O.current?.style.removeProperty("transition"),I.current?.style.removeProperty("display"),S)w(S)}),P=i8.useRef(null);y0(()=>{if(!K||!H)P.current=null},[K,H]),y0(()=>{if(Y&&_&&Y!==_&&P.current!==Y&&F.current){M(F.current),y(!0);let S=Ka(_,Y);N(S),T.request(()=>{LR.flushSync(()=>{y(!1)}),k(()=>{M(null),w(null),F.current=null})}),P.current=Y}},[Y,_,V,k,T]),y0(()=>{let S=O.current;if(!S)return;let i=z1(S).createElement("div");for(let J0 of Array.from(S.childNodes))i.appendChild(J0.cloneNode(!0));F.current=i});let h=V!=null,l;if(!h)l=G("div",{"data-current":!0,ref:O,children:q},L);else l=b(i8.Fragment,{children:[G("div",{"data-previous":!0,inert:FQ(!0),ref:I,style:{...A?{[Z.popupWidth]:`${A.width}px`,[Z.popupHeight]:`${A.height}px`}:null,position:"absolute"},"data-ending-style":C?void 0:""},"previous"),G("div",{"data-current":!0,ref:O,"data-starting-style":C?"":void 0,children:q},L)]});y0(()=>{let S=I.current;if(!S||!V)return;S.replaceChildren(...Array.from(V.childNodes))},[V]),UR({popupElement:B,positionerElement:U,mounted:H,content:W,onMeasureLayout:x,onMeasureLayoutComplete:j,side:Q,direction:X});let t={activationDirection:za(D),transitioning:h};return{children:l,state:t}}function za($){if(!$)return;return`${_R($.horizontal,5,"right","left")} ${_R($.vertical,5,"down","up")}`}function _R($,J,Q,Z){if($>J)return Q;if($<-J)return Z;return""}function Ka($,J){let Q=$.getBoundingClientRect(),Z=J.getBoundingClientRect(),q={x:Q.left+Q.width/2,y:Q.top+Q.height/2},X={x:Z.left+Z.width/2,y:Z.top+Z.height/2};return{horizontal:X.x-q.x,vertical:X.y-q.y}}function Ga($,J){let[Q,Z]=i8.useState(0),q=i8.useRef($),X=i8.useRef(J),Y=i8.useRef(!1);return y0(()=>{let z=q.current,K=X.current,W=$!==z,H=J!==K;if(W)Z((B)=>B+1),Y.current=!H;else if(Y.current&&H)Z((B)=>B+1),Y.current=!1;q.current=$,X.current=J},[$,J]),`${$??"current"}-${Q}`}var Wa={activationDirection:($)=>$?{"data-activation-direction":$}:null},VR=FR.forwardRef(function(J,Q){let{render:Z,className:q,style:X,children:Y,...z}=J,{store:K}=S5(),{side:W}=VQ(),H=K.useState("instantType"),{children:B,state:U}=uG({store:K,side:W,cssVars:GR,children:Y}),_={activationDirection:U.activationDirection,transitioning:U.transitioning,instant:H};return o0("div",J,{state:_,ref:Q,props:[z,{children:B}],stateAttributesMapping:Wa})});class mG{constructor(){this.store=new UQ}open($){let J=$?this.store.context.triggerElements.getById($)??void 0:void 0;if($&&!J)throw Error(M1(80,$));this.store.setOpen(!0,l0(T0.imperativeAction,void 0,J))}close(){this.store.setOpen(!1,l0(T0.imperativeAction,void 0,void 0))}get isOpen(){return this.store.select("open")}}function MR(){return new mG}var V4={};n4(V4,{createHandle:()=>YC,Viewport:()=>QC,Trigger:()=>eR,SubmenuTrigger:()=>XC,SubmenuRoot:()=>rR,Separator:()=>qC,Root:()=>KW,RadioItemIndicator:()=>lR,RadioItem:()=>pR,RadioGroup:()=>cR,Positioner:()=>uR,Portal:()=>vR,Popup:()=>hR,LinkItem:()=>SR,Item:()=>CR,Handle:()=>HW,GroupLabel:()=>PR,Group:()=>ER,CheckboxItemIndicator:()=>bR,CheckboxItem:()=>TR,Backdrop:()=>AR,Arrow:()=>NR});var DR=R(v(),1);var cG=R(v(),1),fL=cG.createContext(void 0);function r8($){let J=cG.useContext(fL);if(J===void 0&&!$)throw Error(M1(33));return J}var dG=R(v(),1),vL=dG.createContext(void 0);function X5($){let J=dG.useContext(vL);if(J===void 0&&!$)throw Error(M1(36));return J}var NR=DR.forwardRef(function(J,Q){let{render:Z,className:q,style:X,...Y}=J,{store:z}=X5(),{arrowRef:K,side:W,align:H,arrowUncentered:B,arrowStyles:U}=r8(),L={open:z.useState("open"),side:W,align:H,uncentered:B};return o0("div",J,{ref:[K,Q],stateAttributesMapping:w6,state:L,props:{style:U,"aria-hidden":!0,...Y}})});var OR=R(v(),1);var pG=R(v(),1),Ha=pG.createContext(void 0);function L4($=!0){let J=pG.useContext(Ha);if(J===void 0&&!$)throw Error(M1(25));return J}var Ba={...w6,...H4},AR=OR.forwardRef(function(J,Q){let{render:Z,className:q,style:X,...Y}=J,{store:z}=X5(),K=z.useState("open"),W=z.useState("mounted"),H=z.useState("transitionStatus"),B=z.useState("lastOpenChangeReason"),U=L4(),_={open:K,transitionStatus:H};return o0("div",J,{ref:U?.backdropRef?[Q,U.backdropRef]:Q,state:_,stateAttributesMapping:Ba,props:[{role:"presentation",hidden:!W,style:{pointerEvents:B===T0.triggerHover?"none":void 0,userSelect:"none",WebkitUserSelect:"none"}},Y]})});var sG=R(v(),1);var k$=R(v(),1);function OQ({controlled:$,default:J,name:Q,state:Z="value"}){let{current:q}=k$.useRef($!==void 0),[X,Y]=k$.useState(J),z=q?$:X,K=k$.useCallback((W)=>{if(!q)Y(W)},[]);return[z,K]}var lG=R(v(),1),gL=lG.createContext(void 0);function wR(){let $=lG.useContext(gL);if($===void 0)throw Error(M1(30));return $}var AQ=R(v(),1);var kR=R(v(),1);function iG($){let{closeOnClick:J,highlighted:Q,id:Z,nodeId:q,store:X,typingRef:Y,itemRef:z,itemMetadata:K}=$,{events:W}=X.useState("floatingTreeRoot"),H=X.useState("open"),B=L4(!0),U=B!==void 0;return kR.useMemo(()=>({id:Z,role:"menuitem",tabIndex:H&&Q?0:-1,onKeyDown(_){if(_.key===" "&&Y?.current)_.preventDefault()},onMouseMove(_){if(!q)return;W.emit("itemhover",{nodeId:q,target:_.currentTarget})},onClick(_){if(J)W.emit("close",{domEvent:_,reason:T0.itemPress})},onMouseUp(_){if(B){let L=B.initialCursorPointRef.current;if(B.initialCursorPointRef.current=null,U&&L&&Math.abs(_.clientX-L.x)<=1&&Math.abs(_.clientY-L.y)<=1)return;if(U&&!c1.os.mac&&_.button===2)return}if(z.current&&X.context.allowMouseUpTriggerRef.current&&(!U||_.button===2)){if(!K||K.type==="regular-item")z.current.click()}}}),[J,Q,Z,W,q,H,X,Y,z,B,U,K])}var wQ={type:"regular-item"};function J2($){let{closeOnClick:J,disabled:Q=!1,highlighted:Z,id:q,store:X,typingRef:Y=X.context.typingRef,nativeButton:z,itemMetadata:K,nodeId:W}=$,H=X.useState("disabled"),B=Q||H,U=AQ.useRef(null),{getButtonProps:_,buttonRef:L}=x6({disabled:B,focusableWhenDisabled:!0,native:z,composite:!0}),F=iG({closeOnClick:J,highlighted:Z,id:q,nodeId:W,store:X,typingRef:Y,itemRef:U,itemMetadata:K}),V=AQ.useCallback((D)=>{return S8(F,{onMouseEnter(){if(K.type!=="submenu-trigger")return;K.setActive()}},D,_)},[F,_,K]),M=U9(U,L);return AQ.useMemo(()=>({getItemProps:V,itemRef:M}),[V,M])}var I$=R(v(),1);var rG=R(v(),1),uL=rG.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>{return()=>{}},elementsRef:{current:[]},nextIndexRef:{current:0}});function IR(){return rG.useContext(uL)}var Ua=function($){return $[$.None=0]="None",$[$.GuessFromOrder=1]="GuessFromOrder",$}({});function V9($={}){let{label:J,metadata:Q,textRef:Z,indexGuessBehavior:q,index:X}=$,{register:Y,unregister:z,subscribeMapChange:K,elementsRef:W,labelsRef:H,nextIndexRef:B}=IR(),U=I$.useRef(-1),[_,L]=I$.useState(X??(q===Ua.GuessFromOrder?()=>{if(U.current===-1){let M=B.current;B.current+=1,U.current=M}return U.current}:-1)),F=I$.useRef(null),V=I$.useCallback((M)=>{if(F.current=M,_!==-1&&M!==null){if(W.current[_]=M,H){let D=J!==void 0;H.current[_]=D?J:Z?.current?.textContent??M.textContent}}},[_,W,H,J,Z]);return y0(()=>{if(X!=null)return;let M=F.current;if(M)return Y(M,Q),()=>{z(M)};return},[X,Y,z,Q]),y0(()=>{if(X!=null)return;return K((M)=>{let D=F.current?M.get(F.current)?.index:null;if(D!=null)L(D)})},[X,K,L]),{ref:V,index:_}}var mL=function($){return $.checked="data-checked",$.unchecked="data-unchecked",$.disabled="data-disabled",$.highlighted="data-highlighted",$}({});var Q2={checked($){if($)return{[mL.checked]:""};return{[mL.unchecked]:""}},...H4};var TR=sG.forwardRef(function(J,Q){let{render:Z,className:q,id:X,label:Y,nativeButton:z=!1,disabled:K=!1,closeOnClick:W=!1,checked:H,defaultChecked:B,onCheckedChange:U,style:_,...L}=J,F=V9({label:Y}),V=r8(!0),M=h5(X),{store:D}=X5(),N=D.useState("isActive",F.index),O=D.useState("itemProps"),[I,k]=OQ({controlled:H,default:B??!1,name:"MenuCheckboxItem",state:"checked"}),{getItemProps:T,itemRef:A}=J2({closeOnClick:W,disabled:K,highlighted:N,id:M,store:D,nativeButton:z,nodeId:V?.context.nodeId,itemMetadata:wQ}),w=sG.useMemo(()=>({disabled:K,highlighted:N,checked:I}),[K,N,I]);function C(x){let j=l0(T0.itemPress,x.nativeEvent,void 0,{preventUnmountOnClose(){}});if(U?.(!I,j),j.isCanceled)return;k((P)=>!P)}let y=o0("div",J,{state:w,stateAttributesMapping:Q2,props:[O,{role:"menuitemcheckbox","aria-checked":I,onClick:C},L,T],ref:[A,Q,F.ref]});return G(gL.Provider,{value:w,children:y})});var oG=R(v(),1);var bR=oG.forwardRef(function(J,Q){let{render:Z,className:q,style:X,keepMounted:Y=!1,...z}=J,K=wR(),W=oG.useRef(null),{transitionStatus:H,setMounted:B}=GQ(K.checked);U4({open:K.checked,ref:W,onComplete(){if(!K.checked)B(!1)}});let U={checked:K.checked,disabled:K.disabled,highlighted:K.highlighted,transitionStatus:H};return o0("span",J,{state:U,ref:[Q,W],stateAttributesMapping:Q2,props:{"aria-hidden":!0,...z},enabled:Y||K.checked})});var aG=R(v(),1);var nG=R(v(),1),tq=nG.createContext(void 0);function jR(){let $=nG.useContext(tq);if($===void 0)throw Error(M1(31));return $}var ER=aG.forwardRef(function(J,Q){let{render:Z,className:q,style:X,...Y}=J,[z,K]=aG.useState(void 0),W=o0("div",J,{ref:Q,props:{role:"group","aria-labelledby":z,...Y}});return G(tq.Provider,{value:K,children:W})});var yR=R(v(),1);var PR=yR.forwardRef(function(J,Q){let{render:Z,className:q,style:X,id:Y,...z}=J,K=h5(Y),W=jR();return y0(()=>{return W(K),()=>{W(void 0)}},[W,K]),o0("div",J,{ref:Q,props:{id:K,role:"presentation",...z}})});var RR=R(v(),1);var CR=RR.forwardRef(function(J,Q){let{render:Z,className:q,id:X,label:Y,nativeButton:z=!1,disabled:K=!1,closeOnClick:W=!0,style:H,...B}=J,U=V9({label:Y}),_=r8(!0),L=h5(X),{store:F}=X5(),V=F.useState("isActive",U.index),M=F.useState("itemProps"),{getItemProps:D,itemRef:N}=J2({closeOnClick:W,disabled:K,highlighted:V,id:L,store:F,nativeButton:z,nodeId:_?.context.nodeId,itemMetadata:wQ});return o0("div",J,{state:{disabled:K,highlighted:V},props:[M,B,D],ref:[N,Q,U.ref]})});var tG=R(v(),1);var SR=tG.forwardRef(function(J,Q){let{render:Z,className:q,id:X,label:Y,closeOnClick:z=!1,style:K,...W}=J,H=tG.useRef(null),B=V9({label:Y}),_=r8(!0)?.context.nodeId,L=h5(X),{store:F}=X5(),V=F.useState("isActive",B.index),M=F.useState("itemProps"),D=F.context.typingRef,{getButtonProps:N,buttonRef:O}=x6({native:!1,composite:!0}),I=iG({closeOnClick:z,highlighted:V,id:L,nodeId:_,store:F,typingRef:D,itemRef:H});function k(A){return S8(I,A,N)}return o0("a",J,{state:{highlighted:V},props:[M,W,k],ref:[H,O,Q,B.ref]})});var kQ=R(v(),1);var _a={...w6,...H4},hR=kQ.forwardRef(function(J,Q){let{render:Z,className:q,style:X,finalFocus:Y,...z}=J,{store:K}=X5(),{side:W,align:H}=r8(),B=xG(!0)!=null,U=K.useState("open"),_=K.useState("transitionStatus"),L=K.useState("popupProps"),F=K.useState("mounted"),V=K.useState("instantType"),M=K.useState("activeTriggerElement"),D=K.useState("parent"),N=K.useState("lastOpenChangeReason"),O=K.useState("rootId"),I=K.useState("floatingRootContext"),k=K.useState("floatingTreeRoot"),T=K.useState("closeDelay"),A=K.useState("activeTriggerElement"),w=K.useState("hoverEnabled"),C=K.useState("disabled"),y=K.useState("openMethod"),x=D.type==="context-menu";U4({open:U,ref:K.context.popupRef,onComplete(){if(U)K.context.onOpenChangeComplete?.(!0)}}),kQ.useEffect(()=>{function t(S){K.setOpen(!1,l0(S.reason,S.domEvent))}return k.events.on("close",t),()=>{k.events.off("close",t)}},[k.events,K]),rq(I,{enabled:w&&!C&&!x&&D.type!=="menubar",closeDelay:T});let j=kQ.useCallback((t)=>{K.set("popupElement",t)},[K]),P={transitionStatus:_,side:W,align:H,open:U,nested:D.type==="menu",instant:V},h=o0("div",J,{state:P,ref:[Q,K.context.popupRef,j],stateAttributesMapping:_a,props:[L,{onKeyDown(t){if(B&&SG.has(t.key))t.stopPropagation()}},MQ(_),z,{"data-rootownerid":O}]}),l=D.type===void 0||x;if(M||D.type==="menubar"&&N!==T0.outsidePress)l=!0;return G(mq,{context:I,openInteractionType:y,modal:x,disabled:!F,returnFocus:Y===void 0?l:Y,initialFocus:D.type!=="menu",restoreFocus:!0,externalTree:D.type!=="menubar"?k:void 0,previousFocusableElement:A,nextFocusableElement:D.type===void 0?K.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:D.type===void 0?K.context.beforeContentFocusGuardRef:void 0,children:h})});var fR=R(v(),1);var eG=R(v(),1),cL=eG.createContext(void 0);function xR(){let $=eG.useContext(cL);if($===void 0)throw Error(M1(32));return $}var vR=fR.forwardRef(function(J,Q){let{keepMounted:Z=!1,...q}=J,{store:X}=X5();if(!(X.useState("mounted")||Z))return null;return G(cL.Provider,{value:Z,children:G(vq,{ref:Q,...q})})});var F4=R(v(),1);var Z2=R(v(),1);function gR($){let{children:J,elementsRef:Q,labelsRef:Z,onMapChange:q}=$,X=g0(q),Y=Z2.useRef(0),z=G5(Fa).current,K=G5(La).current,[W,H]=Z2.useState(0),B=Z2.useRef(W),U=g0((M,D)=>{K.set(M,D??null),B.current+=1,H(B.current)}),_=g0((M)=>{K.delete(M),B.current+=1,H(B.current)}),L=Z2.useMemo(()=>{Ma(W);let M=new Map;return Array.from(K.keys()).filter((N)=>N.isConnected).sort(Va).forEach((N,O)=>{let I=K.get(N)??{};M.set(N,{...I,index:O})}),M},[K,W]);y0(()=>{if(typeof MutationObserver!=="function"||L.size===0)return;let M=new MutationObserver((D)=>{let N=new Set,O=(I)=>N.has(I)?N.delete(I):N.add(I);if(D.forEach((I)=>{I.removedNodes.forEach(O),I.addedNodes.forEach(O)}),N.size===0)B.current+=1,H(B.current)});return L.forEach((D,N)=>{if(N.parentElement)M.observe(N.parentElement,{childList:!0})}),()=>{M.disconnect()}},[L]),y0(()=>{if(B.current===W){if(Q.current.length!==L.size)Q.current.length=L.size;if(Z&&Z.current.length!==L.size)Z.current.length=L.size;Y.current=L.size}X(L)},[X,L,Q,Z,W]),y0(()=>{return()=>{Q.current=[]}},[Q]),y0(()=>{return()=>{if(Z)Z.current=[]}},[Z]);let F=g0((M)=>{return z.add(M),()=>{z.delete(M)}});y0(()=>{z.forEach((M)=>M(L))},[z,L]);let V=Z2.useMemo(()=>({register:U,unregister:_,subscribeMapChange:F,elementsRef:Q,labelsRef:Z,nextIndexRef:Y}),[U,_,F,Q,Z,Y]);return G(uL.Provider,{value:V,children:J})}function La(){return new Map}function Fa(){return new Set}function Va($,J){let Q=$.compareDocumentPosition(J);if(Q&Node.DOCUMENT_POSITION_FOLLOWING||Q&Node.DOCUMENT_POSITION_CONTAINED_BY)return-1;if(Q&Node.DOCUMENT_POSITION_PRECEDING||Q&Node.DOCUMENT_POSITION_CONTAINS)return 1;return 0}function Ma($){}var uR=F4.forwardRef(function(J,Q){let{anchor:Z,positionMethod:q="absolute",className:X,render:Y,side:z,align:K,sideOffset:W=0,alignOffset:H=0,collisionBoundary:B="clipping-ancestors",collisionPadding:U=5,arrowPadding:_=5,sticky:L=!1,disableAnchorTracking:F=!1,collisionAvoidance:V=dy,style:M,...D}=J,{store:N}=X5(),O=xR(),I=L4(!0),k=N.useState("parent"),T=N.useState("floatingRootContext"),A=N.useState("floatingTreeRoot"),w=N.useState("mounted"),C=N.useState("open"),y=N.useState("modal"),x=N.useState("openMethod"),j=N.useState("activeTriggerElement"),P=N.useState("transitionStatus"),h=N.useState("positionerElement"),l=N.useState("instantType"),t=N.useState("hasViewport"),S=N.useState("lastOpenChangeReason"),i=N.useState("floatingNodeId"),J0=N.useState("floatingParentNodeId"),K0=T.useState("domReferenceElement"),e=F4.useRef(null),H0=B4(h,!1,!1),q0=Z,E=W,d=H,c=K,r=V;if(k.type==="context-menu"){if(q0=Z??k.context?.anchor,c=c??"start",!z&&c!=="center")d=J.alignOffset??2,E=J.sideOffset??-5}let u=z,m=c;if(k.type==="menu")u=u??"inline-end",m=m??"start",r=J.collisionAvoidance??eK;else if(k.type==="menubar")u=u??(k.context.orientation==="vertical"?"inline-end":"bottom"),m=m??"start";let s=k.type==="context-menu",f=yG({anchor:q0,floatingRootContext:T,positionMethod:I?"fixed":q,mounted:w,side:u,sideOffset:E,align:m,alignOffset:d,arrowPadding:s?0:_,collisionBoundary:B,collisionPadding:U,sticky:L,nodeId:i,keepMounted:O,disableAnchorTracking:F,collisionAvoidance:r,shiftCrossAxis:s&&!(("side"in r)&&r.side==="flip"),externalTree:A,adaptiveOrigin:t?EG:void 0});F4.useEffect(()=>{function L0(_0){if(_0.open){if(_0.parentNodeId===i)N.set("hoverEnabled",!1);if(_0.nodeId!==i&&_0.parentNodeId===N.select("floatingParentNodeId"))N.setOpen(!1,l0(T0.siblingOpen))}}return A.events.on("menuopenchange",L0),()=>{A.events.off("menuopenchange",L0)}},[N,A.events,i]),F4.useEffect(()=>{if(N.select("floatingParentNodeId")==null)return;function L0(_0){if(_0.open||_0.nodeId!==N.select("floatingParentNodeId"))return;let N0=_0.reason??T0.siblingOpen;N.setOpen(!1,l0(N0))}return A.events.on("menuopenchange",L0),()=>{A.events.off("menuopenchange",L0)}},[A.events,N]);let o=B5();F4.useEffect(()=>{if(!C)o.clear()},[C,o]),F4.useEffect(()=>{function L0(_0){if(!C||_0.nodeId!==N.select("floatingParentNodeId"))return;if(_0.target&&j&&j!==_0.target){let N0=N.select("closeDelay");if(N0>0){if(!o.isStarted())o.start(N0,()=>{N.setOpen(!1,l0(T0.siblingOpen))})}else N.setOpen(!1,l0(T0.siblingOpen))}else o.clear()}return A.events.on("itemhover",L0),()=>{A.events.off("itemhover",L0)}},[A.events,C,j,N,o]),F4.useEffect(()=>{let L0={open:C,nodeId:i,parentNodeId:J0,reason:N.select("lastOpenChangeReason")};A.events.emit("menuopenchange",L0)},[A.events,C,N,i,J0]),y0(()=>{let L0=K0,_0=e.current;if(L0)e.current=L0;if(_0&&L0&&L0!==_0){N.set("instantType",void 0);let N0=new AbortController;return H0(()=>{N.set("instantType","trigger-change")},N0.signal),()=>{N0.abort()}}return},[K0,H0,N]);let G0={open:C,side:f.side,align:f.align,anchorHidden:f.anchorHidden,nested:k.type==="menu",instant:l},p=k.type==="menubar"&&k.context.modal,Z0=y&&S!==T0.triggerHover;CG(C&&(p||Z0),x==="touch",h,j);let Q0=RG(J,G0,{styles:f.positionerStyles,transitionStatus:P,props:D,refs:[Q,N.useStateSetter("positionerElement")],hidden:!w,inert:!C}),B0=w&&k.type!=="menu"&&(k.type!=="menubar"&&y&&S!==T0.triggerHover||k.type==="menubar"&&k.context.modal),W0=null;if(k.type==="menubar")W0=k.context.contentElement;else if(k.type===void 0)W0=j;return b(fL.Provider,{value:f,children:[B0&&G(PG,{ref:k.type==="context-menu"||k.type==="nested-context-menu"?k.context.internalBackdropRef:null,inert:FQ(!C),cutout:W0}),G(gq,{id:i,children:G(gR,{elementsRef:N.context.itemDomElements,labelsRef:N.context.itemLabels,children:Q0})})]})});var q2=R(v(),1);var $W=R(v(),1),dL=$W.createContext(void 0);function mR(){let $=$W.useContext(dL);if($===void 0)throw Error(M1(34));return $}var cR=q2.memo(q2.forwardRef(function(J,Q){let{render:Z,className:q,value:X,defaultValue:Y,onValueChange:z,disabled:K=!1,style:W,"aria-labelledby":H,...B}=J,[U,_]=q2.useState(void 0),[L,F]=OQ({controlled:X,default:Y,name:"MenuRadioGroup"}),V=g0((O,I)=>{if(z?.(O,I),I.isCanceled)return;F(O)}),D=o0("div",J,{state:{disabled:K},ref:Q,props:{role:"group","aria-labelledby":H??U,"aria-disabled":K||void 0,...B}}),N=q2.useMemo(()=>({value:L,setValue:V,disabled:K}),[L,V,K]);return G(tq.Provider,{value:_,children:G(dL.Provider,{value:N,children:D})})}));var QW=R(v(),1);var JW=R(v(),1),pL=JW.createContext(void 0);function dR(){let $=JW.useContext(pL);if($===void 0)throw Error(M1(35));return $}var pR=QW.forwardRef(function(J,Q){let{render:Z,className:q,id:X,label:Y,nativeButton:z=!1,disabled:K=!1,closeOnClick:W=!1,value:H,style:B,...U}=J,_=V9({label:Y}),L=r8(!0),F=h5(X),{store:V}=X5(),M=V.useState("isActive",_.index),D=V.useState("itemProps"),{value:N,setValue:O,disabled:I}=mR(),k=I||K,T=N===H,{getItemProps:A,itemRef:w}=J2({closeOnClick:W,disabled:k,highlighted:M,id:F,store:V,nativeButton:z,nodeId:L?.context.nodeId,itemMetadata:wQ}),C=QW.useMemo(()=>({disabled:k,highlighted:M,checked:T}),[k,M,T]);function y(j){let P=l0(T0.itemPress,j.nativeEvent,void 0,{preventUnmountOnClose(){}});O(H,P)}let x=o0("div",J,{state:C,stateAttributesMapping:Q2,props:[D,{role:"menuitemradio","aria-checked":T,onClick:y},U,A],ref:[w,Q,_.ref]});return G(pL.Provider,{value:C,children:x})});var ZW=R(v(),1);var lR=ZW.forwardRef(function(J,Q){let{render:Z,className:q,style:X,keepMounted:Y=!1,...z}=J,K=dR(),W=ZW.useRef(null),{transitionStatus:H,setMounted:B}=GQ(K.checked);U4({open:K.checked,ref:W,onComplete(){if(!K.checked)B(!1)}});let U={checked:K.checked,disabled:K.disabled,highlighted:K.highlighted,transitionStatus:H};return o0("span",J,{state:U,stateAttributesMapping:Q2,ref:[Q,W],props:{"aria-hidden":!0,...z},enabled:Y||K.checked})});var g5=R(v(),1);var qW=R(v(),1),Da=qW.createContext(null);function XW($){let J=qW.useContext(Da);if(J===null&&!$)throw Error(M1(5));return J}var eq=R(v(),1);var Na={...HG,disabled:J1(($)=>$.parent.type==="menubar"?$.parent.context.disabled||$.disabled:$.disabled),modal:J1(($)=>($.parent.type===void 0||$.parent.type==="context-menu")&&($.modal??!0)),openMethod:J1(($)=>$.openMethod),allowMouseEnter:J1(($)=>$.allowMouseEnter),highlightItemOnHover:J1(($)=>$.highlightItemOnHover),stickIfOpen:J1(($)=>$.stickIfOpen),parent:J1(($)=>$.parent),rootId:J1(($)=>{if($.parent.type==="menu")return $.parent.store.select("rootId");return $.parent.type!==void 0?$.parent.context.rootId:$.rootId}),activeIndex:J1(($)=>$.activeIndex),isActive:J1(($,J)=>$.activeIndex===J),hoverEnabled:J1(($)=>$.hoverEnabled),instantType:J1(($)=>$.instantType),lastOpenChangeReason:J1(($)=>$.openChangeReason),floatingTreeRoot:J1(($)=>{if($.parent.type==="menu")return $.parent.store.select("floatingTreeRoot");return $.floatingTreeRoot}),floatingNodeId:J1(($)=>$.floatingNodeId),floatingParentNodeId:J1(($)=>$.floatingParentNodeId),itemProps:J1(($)=>$.itemProps),closeDelay:J1(($)=>$.closeDelay),hasViewport:J1(($)=>$.hasViewport),keyboardEventRelay:J1(($)=>{if($.keyboardEventRelay)return $.keyboardEventRelay;if($.parent.type==="menu")return $.parent.store.select("keyboardEventRelay");return})};class IQ extends D${constructor($){super({...Oa(),...$},{positionerRef:eq.createRef(),popupRef:eq.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:eq.createRef(),beforeContentFocusGuardRef:eq.createRef(),onOpenChangeComplete:void 0,triggerElements:new $7},Na);this.unsubscribeParentListener=this.observe("parent",(J)=>{if(this.unsubscribeParentListener?.(),J.type==="menu"){let Q=J.store.select("rootId"),Z=J.store.select("floatingTreeRoot"),q=J.store.select("keyboardEventRelay");this.unsubscribeParentListener=J.store.subscribe(()=>{let X=J.store.select("rootId"),Y=J.store.select("floatingTreeRoot"),z=J.store.select("keyboardEventRelay");if(Q===X&&Z===Y&&q===z)return;Q=X,Z=Y,q=z,this.notifyAll()}),this.context.allowMouseUpTriggerRef=J.store.context.allowMouseUpTriggerRef;return}if(J.type!==void 0)this.context.allowMouseUpTriggerRef=J.context.allowMouseUpTriggerRef;this.unsubscribeParentListener=null})}setOpen($,J){this.state.floatingRootContext.context.events.emit("setOpen",{open:$,eventDetails:J})}static useStore($,J){let Q=G5(()=>{return new IQ(J)}).current;return $??Q}unsubscribeParentListener=null}function Oa(){return{...WG(),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new L$,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:I1,keyboardEventRelay:void 0,closeDelay:0,hasViewport:!1}}var YW=R(v(),1),lL=YW.createContext(void 0);function zW(){return YW.useContext(lL)}var KW=BL(function(J){let{children:Q,open:Z,onOpenChange:q,onOpenChangeComplete:X,defaultOpen:Y=!1,disabled:z=!1,modal:K,loopFocus:W=!0,orientation:H="vertical",actionsRef:B,closeParentOnEsc:U=!1,handle:_,triggerId:L,defaultTriggerId:F=null,highlightItemOnHover:V=!0}=J,M=L4(!0),D=X5(!0),N=XW(!0),O=zW(),I=g5.useMemo(()=>{if(O&&D)return{type:"menu",store:D.store};if(N)return{type:"menubar",context:N};if(M&&!D)return{type:"context-menu",context:M};return{type:void 0}},[M,D,N,O]),k=IQ.useStore(_?.store,{open:Y,openProp:Z,activeTriggerId:F,triggerIdProp:L,parent:I});XG(k,Z,Y,F),k.useControlledProp("openProp",Z),k.useControlledProp("triggerIdProp",L),k.useContextCallback("onOpenChangeComplete",X);let T=h6(),A=h6(),w=k.useState("floatingTreeRoot"),C=F$(w),y=h8(),x=k.useState("open"),j=k.useState("activeTriggerElement"),P=k.useState("positionerElement"),h=k.useState("hoverEnabled"),l=k.useState("disabled"),t=k.useState("lastOpenChangeReason"),S=k.useState("parent"),i=k.useState("activeIndex"),J0=k.useState("payload"),K0=k.useState("floatingParentNodeId"),e=g5.useRef(null),H0=g5.useRef(S.type!=="context-menu"),q0=B5(),E=g5.useRef(!0),d=B5(),c=K0!=null,{openMethod:r,triggerProps:u}=yP(x);k.useSyncedValues({disabled:z,highlightItemOnHover:V,modal:S.type===void 0?K:void 0,openMethod:r,rootId:T}),zG(k);let{forceUnmount:m}=KG(x,k,()=>{k.update({allowMouseEnter:!1,stickIfOpen:!0})});y0(()=>{if(M&&!D)k.update({parent:{type:"context-menu",context:M},floatingNodeId:C,floatingParentNodeId:y});else if(D)k.update({floatingNodeId:C,floatingParentNodeId:y})},[M,D,C,y,k]),g5.useEffect(()=>{if(!x)e.current=null;if(S.type!=="context-menu")return;if(!x){q0.clear(),H0.current=!1;return}q0.start(500,()=>{H0.current=!0})},[q0,x,S.type]),y0(()=>{if(!x&&!h)k.set("hoverEnabled",!0)},[x,h,k]);let s=g0((F0,u0)=>{let P0=u0.reason;if(x===F0&&u0.trigger===j&&t===P0)return;let n0=qG(u0);if(!F0&&u0.trigger==null)u0.trigger=j??void 0;if(q?.(F0,u0),u0.isCanceled)return;k.state.floatingRootContext.dispatchOpenChange(F0,u0);let R0=u0.event;if(F0===!1&&R0?.type==="click"&&R0.pointerType==="touch"&&!E.current)return;if(F0&&P0===T0.triggerFocus)E.current=!1,d.start(300,()=>{E.current=!0});else E.current=!0,d.clear();let Z1=(P0===T0.triggerPress||P0===T0.itemPress)&&R0.detail===0&&R0?.isTrusted,K1=!F0&&(P0===T0.escapeKey||P0==null),a0={open:F0,openChangeReason:P0};if(e.current=u0.event??null,ZG(a0,F0,u0.trigger,n0()),k.update(a0),S.type==="menubar"&&(P0===T0.triggerFocus||P0===T0.focusOut||P0===T0.triggerHover||P0===T0.listNavigation||P0===T0.siblingOpen))k.set("instantType","group");else if(Z1||K1)k.set("instantType",Z1?"click":"dismiss");else k.set("instantType",void 0)}),f=pq({popupStore:k,floatingId:A,nested:y!=null,onOpenChange:s}),o=f.context.events;g5.useEffect(()=>{let F0=({open:u0,eventDetails:P0})=>s(u0,P0);return o.on("setOpen",F0),()=>{o?.off("setOpen",F0)}},[o,s]);let G0=g5.useCallback(()=>{k.setOpen(!1,l0(T0.imperativeAction))},[k]);g5.useImperativeHandle(B,()=>({unmount:m,close:G0}),[m,G0]);let p;if(S.type==="context-menu")p=S.context;g5.useImperativeHandle(p?.positionerRef,()=>P,[P]),g5.useImperativeHandle(p?.actionsRef,()=>({setOpen:s}),[s]);let Z0=dq(f,{enabled:!l,bubbles:{escapeKey:U&&S.type==="menu"},outsidePress(){if(S.type!=="context-menu"||e.current?.type==="contextmenu")return!0;return H0.current},externalTree:c?w:void 0}),Q0=t7(),B0=g5.useCallback((F0)=>{if(k.select("activeIndex")===F0)return;k.set("activeIndex",F0)},[k]),W0=IL(f,{enabled:!l,listRef:k.context.itemDomElements,activeIndex:i,nested:S.type!==void 0,loopFocus:W,orientation:H,parentOrientation:S.type==="menubar"?S.context.orientation:void 0,rtl:Q0==="rtl",disabledIndices:G$,onNavigate:B0,openOnArrowKeyDown:S.type!=="context-menu",externalTree:c?w:void 0,focusItemOnHover:V}),L0=g5.useCallback((F0)=>{k.context.typingRef.current=F0},[k]),_0=TL(f,{enabled:!l,listRef:k.context.itemLabels,elementsRef:k.context.itemDomElements,activeIndex:i,resetMs:my,onMatch:(F0)=>{if(x&&F0!==i)k.set("activeIndex",F0)},onTyping:L0}),N0=g5.useMemo(()=>{let F0=S8(_0.reference,W0.reference,Z0.reference,{onMouseMove(){k.set("allowMouseEnter",!0)}},u);return F0["aria-haspopup"]="menu",F0["aria-expanded"]=x,F0},[k,_0.reference,W0.reference,Z0.reference,u,x]),d0=g5.useMemo(()=>{let F0=S8(W0.trigger,Z0.trigger,u);return F0["aria-haspopup"]="menu",F0["aria-expanded"]=!1,F0},[W0.trigger,Z0.trigger,u]),g=g5.useMemo(()=>S8(HQ,{id:A,role:"menu","aria-labelledby":j?.id,onMouseMove(){if(k.set("allowMouseEnter",!0),S.type==="menu")k.set("hoverEnabled",!1)},onClick(){if(k.select("hoverEnabled"))k.set("hoverEnabled",!1)},onKeyDown(F0){let u0=k.select("keyboardEventRelay");if(u0&&!F0.isPropagationStopped())u0(F0)}},_0.floating,W0.floating,Z0.floating),[j,A,S.type,k,_0.floating,W0.floating,Z0.floating]),a=W0.item??I1;GG(k,{floatingRootContext:f,activeTriggerProps:N0,inactiveTriggerProps:d0,popupProps:g,itemProps:a});let I0=g5.useMemo(()=>({store:k,parent:I}),[k,I]),w0=G(vL.Provider,{value:I0,children:typeof Q==="function"?Q({payload:J0}):Q});if(S.type===void 0||S.type==="context-menu")return G(uq,{externalTree:w,children:w0});return w0});var iR=R(v(),1);function rR($){let J=X5().store,Q=iR.useMemo(()=>({parentMenu:J}),[J]);return G(lL.Provider,{value:Q,children:G(KW,{...$})})}var s8=R(v(),1);function sR($){let J=$.getBoundingClientRect(),Q=S1($);if(c1.env.jsdom)return J;let Z=Q.getComputedStyle($,"::before"),q=Q.getComputedStyle($,"::after");if(!(Z.content!=="none"||q.content!=="none"))return J;let Y=parseFloat(Z.width)||0,z=parseFloat(Z.height)||0,K=parseFloat(q.width)||0,W=parseFloat(q.height)||0,H=Math.max(J.width,Y,K),B=Math.max(J.height,z,W),U=H-J.width,_=B-J.height;return{left:J.left-U/2,right:J.right+U/2,top:J.top-_/2,bottom:J.bottom+_/2}}var oR=R(v(),1);function nR($={}){let{highlightItemOnHover:J,highlightedIndex:Q,onHighlightedIndexChange:Z}=_Q(),{ref:q,index:X}=V9($),Y=Q===X,z=oR.useRef(null),K=U9(q,z);return{compositeProps:{tabIndex:Y?0:-1,onFocus(){Z(X)},onMouseMove(){let H=z.current;if(!J||!H)return;let B=H.hasAttribute("disabled")||H.ariaDisabled==="true";if(!Y&&!B)H.focus()}},compositeRef:K,index:X}}function aR($){let{render:J,className:Q,style:Z,state:q=I1,props:X=G$,refs:Y=G$,metadata:z,stateAttributesMapping:K,tag:W="div",...H}=$,{compositeProps:B,compositeRef:U}=nR({metadata:z});return o0(W,$,{state:q,ref:[...Y,U],props:[B,...X,H],stateAttributesMapping:K})}function iL($){if(R1($)&&$.hasAttribute("data-rootownerid"))return $.getAttribute("data-rootownerid")??void 0;if(j6($))return;return iL(b6($))}var GW=R(v(),1);function tR($){let{enabled:J=!0,mouseDownAction:Q,open:Z}=$,q=GW.useRef(!1);return GW.useMemo(()=>{if(!J)return I1;return{onMouseDown:(X)=>{if(Q==="open"&&!Z||Q==="close"&&Z)q.current=!0,z1(X.currentTarget).addEventListener("click",()=>{q.current=!1},{once:!0})},onClick:(X)=>{if(q.current)q.current=!1,X.preventBaseUIHandler()}}},[J,Q,Z])}var WW=2,eR=qP(function(J,Q){let{render:Z,className:q,style:X,disabled:Y=!1,nativeButton:z=!0,id:K,openOnHover:W,delay:H=100,closeDelay:B=0,handle:U,payload:_,...L}=J,F=X5(!0),V=U?.store??F?.store;if(!V)throw Error(M1(85));let M=h5(K),D=V.useState("isTriggerActive",M),N=V.useState("floatingRootContext"),O=V.useState("isOpenedByTrigger",M),I=V.useState("triggerPopupId",M),k=s8.useRef(null),T=wa(),A=_Q(!0),w=d8(),C=s8.useMemo(()=>{return w??new L$},[w]),y=F$(C),x=h8(),{registerTrigger:j,isMountedByThisTrigger:P}=YG(M,k,V,{payload:_,closeDelay:B,parent:T,floatingTreeRoot:C,floatingNodeId:y,floatingParentNodeId:x,keyboardEventRelay:A?.relayKeyboardEvent}),h=T.type==="menubar",l=V.useState("disabled"),t=Y||l||h&&T.context.disabled,{getButtonProps:S,buttonRef:i}=x6({disabled:t,native:z});s8.useEffect(()=>{if(!O&&T.type===void 0)V.context.allowMouseUpTriggerRef.current=!1},[V,O,T.type]);let J0=s8.useRef(null),K0=B5(),e=g0((W0)=>{if(!J0.current)return;K0.clear(),V.context.allowMouseUpTriggerRef.current=!1;let L0=W0.target;if(e0(J0.current,L0)||e0(V.select("positionerElement"),L0)||L0===J0.current)return;if(L0!=null&&iL(L0)===V.select("rootId"))return;let _0=sR(J0.current);if(W0.clientX>=_0.left-WW&&W0.clientX<=_0.right+WW&&W0.clientY>=_0.top-WW&&W0.clientY<=_0.bottom+WW)return;C.events.emit("close",{domEvent:W0,reason:T0.cancelOpen})});s8.useEffect(()=>{if(O&&V.select("lastOpenChangeReason")===T0.triggerHover)z1(J0.current).addEventListener("mouseup",e,{once:!0})},[O,e,V]);let H0=h&&T.context.hasSubmenuOpen,E=O$(N,{enabled:(W??H0)&&!t&&T.type!=="context-menu"&&(!h||H0&&!P),handleClose:w$({blockPointerEvents:!h}),mouseOnly:!0,move:!1,restMs:T.type===void 0?H:void 0,delay:{close:B},triggerElementRef:k,externalTree:C,isActiveTrigger:D,isClosing:()=>V.select("transitionStatus")==="ending"}),d=Aa(O,V.select("lastOpenChangeReason")),c=V$(N,{enabled:!t&&T.type!=="context-menu",event:O&&h?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:T.type===void 0?d:!1}),r=NL(N,{enabled:!t&&H0}),u=tR({open:O,enabled:h,mouseDownAction:"open"}),m=s8.useMemo(()=>S8(r.reference,c.reference),[r.reference,c.reference]),s=V.useState("triggerProps",P),{preFocusGuardRef:f,handlePreFocusGuardFocus:o,handleFocusTargetFocus:G0}=kG(V,k),p={disabled:t,open:O},Z0=[J0,Q,i,j,k],Q0=[m,E??I1,s,{"aria-haspopup":"menu","aria-controls":I,id:M,onMouseDown:(W0)=>{if(V.select("open"))return;K0.start(200,()=>{V.context.allowMouseUpTriggerRef.current=!0}),z1(W0.currentTarget).addEventListener("mouseup",e,{once:!0})}},h?{role:"menuitem"}:{},u,L,S],B0=o0("button",J,{enabled:!h,stateAttributesMapping:sq,state:p,ref:Z0,props:Q0});if(h)return G(aR,{tag:"button",render:Z,className:q,style:X,state:p,refs:Z0,props:Q0,stateAttributesMapping:sq});if(O)return b(s8.Fragment,{children:[G(L9,{ref:f,onFocus:o},`${M}-pre-focus-guard`),G(s8.Fragment,{children:B0},M),G(L9,{ref:V.context.triggerFocusTargetRef,onFocus:G0},`${M}-post-focus-guard`)]});return G(s8.Fragment,{children:B0},M)});function Aa($,J){let Q=B5(),[Z,q]=s8.useState(!1);return y0(()=>{if($&&J==="trigger-hover")q(!0),Q.start(aK,()=>{q(!1)});else if(!$)Q.clear(),q(!1)},[$,J,Q]),Z}function wa(){let $=L4(!0),J=X5(!0),Q=XW(!0);return s8.useMemo(()=>{if(Q)return{type:"menubar",context:Q};if($&&!J)return{type:"context-menu",context:$};return{type:void 0}},[$,J,Q])}var JC=R(v(),1);var $C=function($){return $.popupWidth="--popup-width",$.popupHeight="--popup-height",$}({});var ka={activationDirection:($)=>$?{"data-activation-direction":$}:null},QC=JC.forwardRef(function(J,Q){let{render:Z,className:q,style:X,children:Y,...z}=J,{store:K}=X5(),{side:W}=r8(),H=K.useState("instantType"),{children:B,state:U}=uG({store:K,side:W,cssVars:$C,children:Y}),_={activationDirection:U.activationDirection,transitioning:U.transitioning,instant:H};return o0("div",J,{state:_,ref:Q,props:[z,{children:B}],stateAttributesMapping:ka})});var ZC=R(v(),1);var qC=ZC.forwardRef(function(J,Q){let{className:Z,render:q,orientation:X="horizontal",style:Y,...z}=J;return o0("div",J,{state:{orientation:X},ref:Q,props:[{role:"separator","aria-orientation":X},z]})});var Q7=R(v(),1);var XC=Q7.forwardRef(function(J,Q){let{render:Z,className:q,style:X,label:Y,id:z,nativeButton:K=!1,openOnHover:W=!0,delay:H=100,closeDelay:B=0,disabled:U=!1,..._}=J,L=V9({label:Y}),F=r8(),{store:V}=X5(),M=h5(z),D=V.useState("open"),N=V.useState("floatingRootContext"),O=V.useState("floatingTreeRoot"),I=V.useState("triggerPopupId",M),k=FL(M,V),T=Q7.useCallback((c)=>{let r=k(c);if(c!==null&&V.select("open")&&V.select("activeTriggerId")==null)V.update({activeTriggerId:M,activeTriggerElement:c,closeDelay:B});return r},[k,B,V,M]),A=Q7.useRef(null),w=Q7.useCallback((c)=>{A.current=c,V.set("activeTriggerElement",c)},[V]),C=zW();if(!C?.parentMenu)throw Error(M1(37));V.useSyncedValue("closeDelay",B);let y=C.parentMenu,x=V.useState("disabled"),j=y.useState("disabled"),P=U||x||j,h=y.useState("itemProps"),l=y.useState("isActive",L.index),t=Q7.useMemo(()=>({type:"submenu-trigger",setActive(){if(y.select("highlightItemOnHover"))y.set("activeIndex",L.index)}}),[y,L.index]),{getItemProps:S,itemRef:i}=J2({closeOnClick:!1,disabled:P,highlighted:l,id:M,store:V,typingRef:y.context.typingRef,nativeButton:K,itemMetadata:t,nodeId:F?.context.nodeId}),J0=V.useState("hoverEnabled"),K0=O$(N,{enabled:J0&&W&&!P,handleClose:w$({blockPointerEvents:!0}),mouseOnly:!0,move:!0,restMs:H,delay:{open:H,close:B},shouldOpen:H>0?()=>y.select("allowMouseEnter"):void 0,triggerElementRef:A,externalTree:O,isClosing:()=>V.select("transitionStatus")==="ending"}),H0=V$(N,{enabled:!P,event:"mousedown",toggle:!W,ignoreMouse:W,stickIfOpen:!1}).reference??I1,q0=V.useState("triggerProps",!0);return delete q0.id,o0("div",J,{state:{disabled:P,highlighted:l,open:D},stateAttributesMapping:wG,props:[H0,K0,q0,h,{"aria-controls":I,tabIndex:D||l?0:-1,onBlur(){if(l)y.set("activeIndex",null)}},_,S],ref:[Q,L.ref,i,T,w]})});class HW{constructor(){this.store=new IQ}open($){let J=$?this.store.context.triggerElements.getById($):void 0;if($&&!J)throw Error(M1(83,$));this.store.setOpen(!0,l0("imperative-action",void 0,J))}close(){this.store.setOpen(!1,l0("imperative-action",void 0,void 0))}get isOpen(){return this.store.select("open")}}function YC(){return new HW}var j$={};n4(j$,{ScrubAreaCursor:()=>aC,ScrubArea:()=>oC,Root:()=>jC,Input:()=>pC,Increment:()=>gC,Group:()=>yC,Decrement:()=>mC});var o8=R(v(),1);var BW=R(v(),1),rL=BW.createContext(void 0);function M4(){let $=BW.useContext(rL);if($===void 0)throw Error(M1(43));return $}var UW=R(v(),1);var sL=function($){return $.disabled="data-disabled",$.valid="data-valid",$.invalid="data-invalid",$.touched="data-touched",$.dirty="data-dirty",$.filled="data-filled",$.focused="data-focused",$}({});var zC={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},TQ={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},KC={disabled:!1,...TQ},GC={valid($){if($===null)return null;if($)return{[sL.valid]:""};return{[sL.invalid]:""}}};var Ia={invalid:void 0,name:void 0,validityData:{state:zC,errors:[],error:"",value:"",initialValue:null},setValidityData:m1,disabled:void 0,touched:TQ.touched,setTouched:m1,dirty:TQ.dirty,setDirty:m1,filled:TQ.filled,setFilled:m1,focused:TQ.focused,setFocused:m1,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:KC,markedDirtyRef:{current:!1},registerFieldControl:m1,validation:{getValidationProps:($,J=I1)=>J,inputRef:{current:null},registerInput:m1,commit:async()=>{},change:m1}},Ta=UW.createContext(Ia);function bQ($=!0){let J=UW.useContext(Ta);if(J.setValidityData===m1&&!$)throw Error(M1(28));return J}var _W=R(v(),1);var ba=_W.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:m1,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function LW(){return _W.useContext(ba)}var $X=R(v(),1);var FW=R(v(),1);var ja=FW.createContext({controlId:void 0,registerControlId:m1,labelId:void 0,setLabelId:m1,messageIds:[],setMessageIds:m1,getDescriptionProps:($)=>$});function VW(){return FW.useContext(ja)}function WC($={}){let{id:J,implicit:Q=!1,controlRef:Z}=$,{controlId:q,registerControlId:X}=VW(),Y=h5(J),z=Q?q:void 0,K=G5(()=>Symbol("labelable-control")),W=$X.useRef(!1),H=$X.useRef(J!=null),B=g0(()=>{if(!W.current||X===m1)return;W.current=!1,X(K.current,void 0)});return y0(()=>{if(X===m1)return;let U;if(Q){let _=Z?.current;if(V1(_)&&_.closest("label")!=null)U=J??null;else U=z??Y}else if(J!=null)H.current=!0,U=J;else if(H.current)U=Y;else{B();return}if(U===void 0){B();return}W.current=!0,X(K.current,U);return},[J,Z,z,X,Q,Y,K,B]),$X.useEffect(()=>{return B},[B]),q??Y}var M9={inputValue:()=>null,value:()=>null,...GC};function oL($){if(Array.isArray($))return $.map((J)=>oL(J)).join(",");if($==null)return"";return String($)}var HC=new Map;function T$($,J){let Q=JSON.stringify({locale:oL($),options:J}),Z=HC.get(Q);if(Z)return Z;let q=new Intl.NumberFormat($,J);return HC.set(Q,q),q}function jQ($,J,Q){if($==null)return"";return T$(J,Q).format($)}var UC=["零","〇","一","二","三","四","五","六","七","八","九"],Ea={零:"0",〇:"0",一:"1",二:"2",三:"3",四:"4",五:"5",六:"6",七:"7",八:"8",九:"9"},nL=["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"],aL=["۰","۱","۲","۳","۴","۵","۶","۷","۸","۹"],tL=["0","1","2","3","4","5","6","7","8","9"],eL=["%","٪","%","﹪"],$F=["‰","؉"],_C=["−","-","‒","–","—","﹣"],LC=["+","﹢"],ya=".",Pa=",",Ra=new RegExp(`[${nL.join("")}]`,"g"),Ca=new RegExp(`[${aL.join("")}]`,"g"),Sa=new RegExp(`[${tL.join("")}]`,"g"),ha=new RegExp(`[${UC.join("")}]`,"g"),FC=new RegExp(`[${eL.join("")}]`),VC=new RegExp(`[${$F.join("")}]`),xa=new RegExp(FC.source,"g"),fa=new RegExp(VC.source,"g"),MC=new RegExp(`[${nL.join("")}]`),DC=new RegExp(`[${aL.join("")}]`),NC=new RegExp(`[${UC.join("")}]`),va=new RegExp(`[${tL.join("")}]`);function JF($){return $>="0"&&$<="9"||MC.test($)||DC.test($)||NC.test($)||va.test($)}var OC=[".",",",ya,Pa,"٫","٬"],QF=/\p{Zs}/u,AC=["+",...LC],wC=["-",..._C],JX=($)=>$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),ga=($)=>$.replace(/[-\\\]^]/g,(J)=>`\\${J}`);function BC($,J){let[Q,Z="0"]=String($).split("e");return Number(`${Q}e${Number(Z)+J}`)}var kC=($)=>`[${$.map(ga).join("")}]`,IC=kC(["-"].concat(_C)),TC=kC(["+"].concat(LC)),ZF=new RegExp(IC,"gu"),qF=new RegExp(TC,"gu"),MW=new RegExp(IC),XF=new RegExp(TC);function QX($,J){let Q=T$($,J).formatToParts(11111.1),Z={};return Q.forEach((q)=>{Z[q.type]=q.value}),T$($).formatToParts(0.1).forEach((q)=>{if(q.type==="decimal")Z[q.type]=q.value}),Z}function Z7($,J,Q){if($==null)return null;let Z=String($).replace(/\p{Cf}/gu,"").trim();Z=Z.replace(ZF,"-").replace(qF,"+");let q=!1,X=Z.match(/([+-])\s*$/);if(X){if(X[1]==="-")q=!0;Z=Z.replace(/([+-])\s*$/,"")}let Y=Z.match(/^\s*([+-])/);if(Y){if(Y[1]==="-")q=!0;Z=Z.replace(/^\s*[+-]/,"")}let z=J;if(z===void 0){if(MC.test(Z)||DC.test(Z))z="ar";else if(NC.test(Z))z="zh"}let{group:K,decimal:W,currency:H,exponentSeparator:B}=QX(z,Q),U=T$(z,Q).formatToParts(1).filter((A)=>A.type==="unit").map((A)=>JX(A.value)),_=U.length?new RegExp(U.join("|"),"g"):null,L=null;if(K){let A=/\p{Zs}/u.test(K),w=K==="'"||K==="’";if(A)L=/\p{Zs}/gu;else if(w)L=/['’]/g;else L=new RegExp(JX(K),"g")}let V=[{regex:L,replacement:""},{regex:W?new RegExp(JX(W),"g"):null,replacement:"."},{regex:/./g,replacement:"."},{regex:/,/g,replacement:""},{regex:/٫/g,replacement:"."},{regex:/٬/g,replacement:""},{regex:H?new RegExp(JX(H),"g"):null,replacement:""},{regex:_,replacement:""},{regex:xa,replacement:""},{regex:fa,replacement:""},{regex:B?new RegExp(JX(B),"g"):null,replacement:"e"},{regex:Ra,replacement:(A)=>String(nL.indexOf(A))},{regex:Ca,replacement:(A)=>String(aL.indexOf(A))},{regex:Sa,replacement:(A)=>String(tL.indexOf(A))},{regex:ha,replacement:(A)=>Ea[A]}].reduce((A,{regex:w,replacement:C})=>{return w?A.replace(w,C):A},Z),M=V.lastIndexOf(".");if(M!==-1)V=`${V.slice(0,M).replace(/\./g,"")}.${V.slice(M+1).replace(/\./g,"")}`;if(/^[-+]?Infinity$/i.test(Z)||Z.includes("∞"))return null;let D=(q?"-":"")+V,N=parseFloat(D),O=Q?.style,I=O==="unit"&&Q?.unit==="percent",k=FC.test($)||O==="percent";if(VC.test($))N=BC(N,-3);else if(!I&&k)N=BC(N,-2);if(!Number.isFinite(N))return null;return N}function YF($,J=Number.MIN_SAFE_INTEGER,Q=Number.MAX_SAFE_INTEGER){return Math.max(J,Math.min($,Q))}var ua=0.0000000001,ma=0.0000000001;function DW($){return $?.maximumFractionDigits!=null||$?.minimumFractionDigits!=null||$?.maximumSignificantDigits!=null||$?.minimumSignificantDigits!=null||$?.roundingIncrement!=null||$?.roundingMode!=null||$?.roundingPriority!=null}function zF($,J){if(!Number.isFinite($))return $;if(!DW(J)){let X=parseFloat($.toPrecision(15)),Y=Math.abs(X-$),z=Math.min(Number.EPSILON*Math.max(1,Math.abs($)),ma);return Y<=z?X:$}let Q=T$("en-US",{...J,signDisplay:"auto",currencySign:"standard",notation:J.notation==="compact"?"standard":J.notation,useGrouping:!1}),Z=Q.format($),q=Z7(Z,"en-US",J);if(q===null)return $;return Q.format(q)===Z?q:$}function ca($,J,Q,Z="directional"){let q=Math.abs(Q),X=Math.sign(Q),Y=q*ua*X,z=$-J+Y;if(Z==="nearest")return J+Math.round(z/Q)*Q;let K=X>0?Math.floor(z/q):Math.ceil(z/q);return J+K*q}function bC($,{step:J,minWithDefault:Q,maxWithDefault:Z,minWithZeroDefault:q,format:X,snapOnStep:Y,small:z,clamp:K}){if($===null)return $;let W=$;if(J!=null&&Y&&J!==0){let B=z||Q===Number.MIN_SAFE_INTEGER?q:Q;W=ca(W,B,J,z?"nearest":"directional")}if(K)W=YF(W,Q,Z);if(J==null&&!DW(X))return W;let H=zF(W,X);return K?YF(H,Q,Z):H}var jC=o8.forwardRef(function(J,Q){let{id:Z,min:q,max:X,smallStep:Y=0.1,step:z=1,largeStep:K=10,required:W=!1,disabled:H=!1,readOnly:B=!1,form:U,name:_,defaultValue:L,value:F,onValueChange:V,onValueCommitted:M,allowWheelScrub:D=!1,snapOnStep:N=!1,allowOutOfRange:O=!1,format:I,locale:k,render:T,className:A,inputRef:w,style:C,...y}=J,{setDirty:x,validityData:j,disabled:P,setFilled:h,invalid:l,name:t,state:S,validation:i}=bQ(),{clearErrors:J0}=LW(),K0=P||H,e=t??_,H0=z==="any"?1:z,[q0,E]=o8.useState(!1),d=q??Number.MIN_SAFE_INTEGER,c=X??Number.MAX_SAFE_INTEGER,r=q??0,u=I?.style,m=o8.useRef(null),s=U9(w,i.inputRef),f=WC({id:Z}),[o,G0]=OQ({controlled:F,default:L,name:"NumberField",state:"value"}),p=o??null,Z0=_5(p);y0(()=>{h(p!==null)},[h,p]);let Q0=YP(),B0=_5(I),W0=o8.useRef(!1),L0=g0((K1,a0)=>{W0.current=!1,M?.(K1,a0)}),_0=o8.useRef(!0),N0=o8.useRef(null),[d0,g]=o8.useState(()=>jQ(p,k,I)),[a,I0]=o8.useState("numeric"),w0=g0(()=>{let{decimal:K1,group:a0,currency:T1,literal:v1}=QX(k,I),E1=new Set;if(OC.forEach((O0)=>E1.add(O0)),K1)E1.add(K1);if(a0){if(E1.add(a0),QF.test(a0))E1.add(" ")}let n=u==="percent"||u==="unit"&&I?.unit==="percent",D0=u==="percent"||u==="unit"&&I?.unit==="permille";if(n)eL.forEach((O0)=>E1.add(O0));if(D0)$F.forEach((O0)=>E1.add(O0));if(u==="currency"&&T1)E1.add(T1);if(v1){if(Array.from(v1).forEach((O0)=>E1.add(O0)),QF.test(v1))E1.add(" ")}if(AC.forEach((O0)=>E1.add(O0)),d<0||O)wC.forEach((O0)=>E1.add(O0));return E1}),F0=g0((K1)=>{if(K1?.altKey)return Y;if(K1?.shiftKey)return K;return H0}),u0=g0((K1,a0)=>{let{event:T1,direction:v1}=a0,E1=a0.reason===T0.inputChange||a0.reason===T0.inputClear||a0.reason===T0.inputBlur||a0.reason===T0.inputPaste||a0.reason===T0.none,n=!O||!E1,D0=bC(K1,{step:v1?F0(T1)*v1:void 0,format:B0.current,minWithDefault:d,maxWithDefault:c,minWithZeroDefault:r,snapOnStep:N,small:T1?.altKey??!1,clamp:n}),O0=D0!==p||E1&&(K1!==p||_0.current===!1);if(O0){if(V?.(D0,a0),a0.isCanceled)return!1;G0(D0),x(D0!==j.initialValue),W0.current=!0}if(N0.current=D0,_0.current)g(jQ(D0,k,I));return Q0(),O0}),P0=g0((K1,{direction:a0,currentValue:T1,event:v1,reason:E1})=>{let n=T1==null?Z0.current:T1,D0=v1;if(typeof n!=="number")return u0(0,l0(E1,D0));return u0(n+K1*a0,l0(E1,D0,void 0,{direction:a0}))});y0(function(){if(!_0.current)return;let a0=jQ(p,k,I);if(a0!==d0)g(a0)}),y0(function(){if(!c1.os.ios)return;let a0="text";if(d>=0)a0="decimal";I0(a0)},[d]),o8.useEffect(function(){let a0=m.current;if(K0||B||!D||!a0)return;function T1(v1){if(v1.ctrlKey||v5(z1(m.current))!==m.current)return;v1.preventDefault(),_0.current=!0;let E1=F0(v1);if(P0(E1,{direction:v1.deltaY>0?-1:1,event:v1,reason:"wheel"}))L0(N0.current??Z0.current,h9(T0.wheel,v1))}return _1(a0,"wheel",T1)},[D,P0,K0,B,F0,L0,N0,Z0]);let n0=o8.useMemo(()=>({...S,disabled:K0,readOnly:B,required:W,value:p,inputValue:d0,scrubbing:q0}),[S,K0,B,W,p,d0,q0]),R0=o8.useMemo(()=>({inputRef:m,inputValue:d0,value:p,minWithDefault:d,maxWithDefault:c,disabled:K0,readOnly:B,id:f,setValue:u0,incrementValue:P0,getStepAmount:F0,allowInputSyncRef:_0,formatOptionsRef:B0,valueRef:Z0,lastChangedValueRef:N0,hasPendingCommitRef:W0,name:e,nameProp:_,required:W,invalid:l,inputMode:a,getAllowedNonNumericKeys:w0,min:q,max:X,setInputValue:g,locale:k,isScrubbing:q0,setIsScrubbing:E,state:n0,onValueCommitted:L0}),[m,d0,p,d,c,K0,B,f,u0,P0,F0,B0,Z0,e,_,W,l,a,w0,q,X,g,k,q0,n0,L0]),Z1=o0("div",J,{ref:Q,state:n0,props:y,stateAttributesMapping:M9});return b(rL.Provider,{value:R0,children:[Z1,G("input",{...i.getValidationProps(K0,{onFocus(){m.current?.focus()},onChange(K1){if(K1.nativeEvent.defaultPrevented||K0||B)return;let a0=K1.currentTarget.valueAsNumber,T1=Number.isNaN(a0)?null:a0,v1=l0(T0.none,K1.nativeEvent);u0(T1,v1),J0(e),i.change(N0.current??T1)}}),ref:s,type:"number",form:U,name:e,value:p??"",min:q,max:X,step:z,disabled:K0,readOnly:B,required:W,"aria-hidden":!0,tabIndex:-1,style:e?Ky:gK,suppressHydrationWarning:!0})]})});var EC=R(v(),1);var yC=EC.forwardRef(function(J,Q){let{render:Z,className:q,style:X,...Y}=J,{state:z}=M4();return o0("div",J,{ref:Q,state:z,props:[{role:"group"},Y],stateAttributesMapping:M9})});var vC=R(v(),1);var v9=R(v(),1);var PC=0;class KF extends T8{static create(){return new KF}start($,J){this.clear(),this.currentId=setInterval(()=>{J()},$)}clear=()=>{if(this.currentId!==PC)clearInterval(this.currentId),this.currentId=PC}}function RC(){let $=G5(KF.create).current;return c7($.disposeEffect),$}var da=60,pa=400,la=8,ia=50,ra=3;function b$($){return $==="touch"||$==="pen"}function CC($){let{disabled:J,readOnly:Q=!1,tick:Z,onStop:q,tickDelay:X=da,startDelay:Y=pa,scrollDistance:z=la,elementRef:K}=$,W=B5(),H=RC(),B=B5(),U=v9.useRef(!1),_=v9.useRef(0),L=v9.useRef({x:0,y:0}),F=v9.useRef(!1),V=v9.useRef(!1),M=v9.useRef(""),D=v9.useRef(m1),N=v9.useRef(m1),O=g0(()=>{B.clear(),W.clear(),H.clear(),D.current(),_.current=0});function I(A){O();let w=K.current;if(!w)return;let C=S1(w);function y(x){x.preventDefault()}if(D.current=_1(C,"contextmenu",y),N.current(),N.current=_1(C,"pointerup",(x)=>{U.current=!1,O(),q?.(x)},{once:!0}),!Z(A)){O();return}W.start(Y,()=>{H.start(X,()=>{if(!Z(A))O()})})}v9.useEffect(()=>()=>{O(),N.current()},[O]);let k={onTouchStart(){F.current=!0},onTouchEnd(){F.current=!1},onPointerDown(A){let w=!A.button||A.button===0;if(A.defaultPrevented||!w||J||Q)return;if(M.current=A.pointerType,V.current=!1,U.current=!0,L.current={x:A.clientX,y:A.clientY},!b$(A.pointerType))A.preventDefault(),I(A.nativeEvent);else B.start(ia,()=>{let y=_.current;if(_.current=0,U.current&&yz**2)O()},onMouseEnter(A){if(A.defaultPrevented||J||Q||!U.current||F.current||b$(M.current))return;I(A.nativeEvent)},onMouseLeave(){if(F.current)return;O()},onMouseUp(){if(F.current)return;O()}},T=g0((A)=>{if(A.defaultPrevented)return!0;if(b$(M.current))return V.current;return A.detail!==0});return{pointerHandlers:k,shouldSkipClick:T}}var SC=60,hC=400,xC=8;var sa={WebkitUserSelect:"none",userSelect:"none"};function fC($){let{allowInputSyncRef:J,disabled:Q,formatOptionsRef:Z,getStepAmount:q,id:X,incrementValue:Y,inputRef:z,inputValue:K,isIncrement:W,locale:H,readOnly:B,setValue:U,valueRef:_,lastChangedValueRef:L,onValueCommitted:F}=$,V=W?T0.incrementPress:T0.decrementPress;function M(I){let k=!J.current;if(J.current=!0,!k){L.current=_.current;return}let T=Z7(K,H,Z.current);if(T!==null){let A=l0(V,I);if(U(T,A),!A.isCanceled)_.current=T}}let{pointerHandlers:D,shouldSkipClick:N}=CC({disabled:Q||B,elementRef:z,tickDelay:SC,startDelay:hC,scrollDistance:xC,tick(I){let k=q(I);return Y(k,{direction:W?1:-1,event:I,reason:V})},onStop(I){let k=L.current??_.current;F(k,h9(V,I))}});return{disabled:Q,"aria-label":W?"Increase":"Decrease","aria-controls":X,tabIndex:-1,style:sa,...D,onClick(I){let k=Q||B;if(I.defaultPrevented||k||N(I))return;M(I.nativeEvent);let T=q(I),A=_.current;Y(T,{direction:W?1:-1,event:I.nativeEvent,reason:V});let w=L.current??_.current;if(w!==A)F(w,h9(V,I.nativeEvent))},onPointerDown(I){let k=!I.button||I.button===0;if(I.defaultPrevented||B||!k||Q)return;if(M(I.nativeEvent),L.current=null,!b$(I.pointerType))z.current?.focus();D.onPointerDown(I)}}}function NW($,J,Q){let{render:Z,className:q,disabled:X=!1,nativeButton:Y=!0,style:z,...K}=$,{allowInputSyncRef:W,disabled:H,formatOptionsRef:B,getStepAmount:U,id:_,incrementValue:L,inputRef:F,inputValue:V,maxWithDefault:M,minWithDefault:D,readOnly:N,setValue:O,state:I,value:k,valueRef:T,locale:A,lastChangedValueRef:w,onValueCommitted:C}=M4(),y=k!=null&&(Q?k>=M:k<=D),x=X||H||y,j=fC({isIncrement:Q,inputRef:F,inputValue:V,disabled:x,readOnly:N,id:_,setValue:O,getStepAmount:U,incrementValue:L,allowInputSyncRef:W,formatOptionsRef:B,valueRef:T,locale:A,lastChangedValueRef:w,onValueCommitted:C}),{getButtonProps:P,buttonRef:h}=x6({disabled:x||N,native:Y,focusableWhenDisabled:!0}),l={...I,disabled:x};return o0("button",$,{ref:[J,h],state:l,props:[j,K,P],stateAttributesMapping:M9})}var gC=vC.forwardRef(function(J,Q){return NW(J,Q,!0)});var uC=R(v(),1);var mC=uC.forwardRef(function(J,Q){return NW(J,Q,!1)});var EQ=R(v(),1);var cC=R(v(),1);function dC($,J,Q,Z,q=!0,X){let{registerFieldControl:Y}=bQ(),z=cC.useRef(null);if(!z.current)z.current=Symbol();y0(()=>{let K=z.current;if(!K||!q)return;return Y(K,{controlRef:$,getValue:Z,id:J,name:X,value:Q}),()=>{Y(K,void 0)}},[$,q,Z,J,X,Y,Q])}var oa=new Set(["Backspace","Delete","ArrowLeft","ArrowRight","Tab","Enter","Escape"]),pC=EQ.forwardRef(function(J,Q){let{render:Z,className:q,style:X,...Y}=J,{allowInputSyncRef:z,disabled:K,formatOptionsRef:W,getAllowedNonNumericKeys:H,getStepAmount:B,id:U,incrementValue:_,inputMode:L,inputValue:F,max:V,min:M,name:D,nameProp:N,readOnly:O,required:I,setValue:k,state:T,setInputValue:A,locale:w,inputRef:C,value:y,onValueCommitted:x,lastChangedValueRef:j,hasPendingCommitRef:P,valueRef:h}=M4(),{clearErrors:l}=LW(),{validationMode:t,setTouched:S,setFocused:i,invalid:J0,shouldValidateOnChange:K0,validation:e}=bQ(),{labelId:H0}=VW(),q0=EQ.useRef(!1),E=EQ.useRef(!1),d=EQ.useRef(null);return dC(C,U,y,void 0,!K,N),y0(()=>{if(d.current!=null){let u=d.current;d.current=null,C.current?.setSelectionRange(u,u)}}),IG(y,()=>{if(l(D),E.current&&!K0()){E.current=!1;return}e.change(y)}),o0("input",J,{ref:[Q,C],state:T,props:[{id:U,required:I,disabled:K,readOnly:O,inputMode:L,value:F,type:"text",autoComplete:"off",autoCorrect:"off",spellCheck:"false","aria-roledescription":"Number field","aria-invalid":!K&&J0?!0:void 0,"aria-labelledby":H0,suppressHydrationWarning:!0,onFocus(u){if(u.defaultPrevented||K)return;if(i(!0),q0.current)return;q0.current=!0;let m=u.currentTarget,s=m.value.length;m.setSelectionRange(s,s)},onBlur(u){if(u.defaultPrevented||K)return;if(S(!0),i(!1),O)return;let m=!z.current,s=P.current;if(z.current=!0,F.trim()===""){let _0=l0(T0.inputClear,u.nativeEvent);if(k(null,_0),_0.isCanceled)return;if(t==="onBlur")e.commit(null);if(m||s||y!==null)x(null,h9(T0.inputClear,u.nativeEvent));return}let f=W.current,o=Z7(F,w,f);if(o===null)return;let G0=DW(f),p;if(!m&&!G0)p=y;else if(G0)p=zF(o,f);else p=o;let Z0=h9(T0.inputBlur,u.nativeEvent),Q0=y!==p,B0=m||Q0||s,W0=p;if(Q0){let _0=l0(T0.inputBlur,u.nativeEvent);if(E.current=!0,k(p,_0),_0.isCanceled){E.current=!1;return}if(W0=j.current??p,W0===y)E.current=!1}if(t==="onBlur")e.commit(W0);if(B0)x(W0,Z0);let L0=jQ(W0,w,f);if(F!==L0)A(L0)},onChange(u){if(u.nativeEvent.defaultPrevented)return;z.current=!1;let m=u.currentTarget.value;if(m.trim()===""){A(m),k(null,l0(T0.inputClear,u.nativeEvent));return}let s=H();if(!Array.from(m).every((G0)=>JF(G0)||MW.test(G0)||s.has(G0)))return;let o=Z7(m,w,W.current);if(A(m),o!==null)k(o,l0(T0.inputChange,u.nativeEvent))},onKeyDown(u){if(u.defaultPrevented||O||K)return;let m=u.nativeEvent,s=!z.current,f=H(),o=f.has(u.key),{decimal:G0,currency:p,percentSign:Z0}=QX(w,W.current),Q0=u.currentTarget.selectionStart,B0=u.currentTarget.selectionEnd,W0=Q0===0&&B0===F.length,L0=(P0)=>Q0!=null&&B0!=null&&P0>=Q0&&P0{if(P0.test(u.key)&&Array.from(f).some((R0)=>P0.test(R0))){let R0=F.search(n0),Z1=R0!==-1&&L0(R0);o=!(MW.test(F)||XF.test(F))||W0||Z1}}),[G0,p,Z0].forEach((P0)=>{if(u.key===P0){let n0=F.indexOf(P0),R0=L0(n0);o=!F.includes(P0)||W0||R0}});let N0=oa.has(u.key),d0=u.key==="ArrowUp"||u.key==="ArrowDown";if(u.which===229||u.altKey&&!d0||u.ctrlKey||u.metaKey||o||JF(u.key)||N0)return;let g=u.key==="Home"&&M!=null,a=u.key==="End"&&V!=null;if(u.key.length>1&&!d0&&!g&&!a)return;let I0=s?Z7(F,w,W.current):null,w0=B(u);q6(u);let F0=h9(T0.keyboard,m),u0=!1;if(u.key==="ArrowUp"||u.key==="ArrowDown"){if(z.current=!0,!s)j.current=h.current;u0=_(w0,{direction:u.key==="ArrowUp"?1:-1,currentValue:I0,event:m,reason:T0.keyboard})}else if(g)z.current=!0,u0=k(M,l0(T0.keyboard,m));else if(a)z.current=!0,u0=k(V,l0(T0.keyboard,m));if(u0)x(j.current??h.current,F0)},onPaste(u){if(u.defaultPrevented||O||K)return;let m="";try{m=u.clipboardData?.getData("text/plain")??""}catch{return}u.preventDefault();let s=u.currentTarget,f=s.selectionStart??F.length,o=s.selectionEnd??F.length,G0=F.slice(0,f)+m+F.slice(o),p=Z7(G0,w,W.current);if(p!==null)z.current=!1,d.current=f+m.length,k(p,l0(T0.inputPaste,u.nativeEvent)),A(G0)}},Y,(u)=>e.getValidationProps(K,u)],stateAttributesMapping:M9})});var u5=R(v(),1),sC=R($5(),1);var OW=R(v(),1),GF=OW.createContext(void 0);function lC(){let $=OW.useContext(GF);if($===void 0)throw Error(M1(44));return $}function iC($,J){let Q=S1(J);if($!=null){let q=J.getBoundingClientRect();return{left:q.left-$/2,top:q.top-$/2,right:q.right+$/2,bottom:q.bottom+$/2}}let Z=Q.visualViewport;if(Z)return{left:Z.offsetLeft,top:Z.offsetTop,right:Z.offsetLeft+Z.width,bottom:Z.offsetTop+Z.height};return{left:0,top:0,right:Q.document.documentElement.clientWidth,bottom:Q.document.documentElement.clientHeight}}function rC($,J){let Q=S1($).visualViewport;if(!Q)return()=>{};function Z(){if(Q)J.current=Q.scale}return Z(),_1(Q,"resize",Z)}var na={touchAction:"none",WebkitUserSelect:"none",userSelect:"none"},oC=u5.forwardRef(function(J,Q){let{render:Z,className:q,direction:X="horizontal",pixelSensitivity:Y=2,teleportDistance:z,style:K,...W}=J,{state:H,setIsScrubbing:B,disabled:U,readOnly:_,inputRef:L,incrementValue:F,allowInputSyncRef:V,getStepAmount:M,onValueCommitted:D,lastChangedValueRef:N,valueRef:O}=M4(),I=u5.useRef(null),k=u5.useRef(!1),T=u5.useRef(!1),A=u5.useRef(null),w=u5.useRef(null),C=u5.useRef({x:0,y:0}),y=u5.useRef(1),x=B5(),[j,P]=u5.useState(!1),[h,l]=u5.useState(!1),[t,S]=u5.useState(!1);u5.useEffect(()=>{if(!t||!w.current)return;return rC(w.current,y)},[t]);function i(E,d){if(w.current)w.current.style.transform=`translate3d(${E}px,${d}px,0) scale(${1/y.current})`}let J0=g0(({movementX:E,movementY:d})=>{let c=w.current,r=I.current;if(!c||!r)return;let u=iC(z,r),m=C.current,s={x:Math.round(m.x+E),y:Math.round(m.y+d)},f=c.offsetWidth,o=c.offsetHeight;if(s.x+f/2u.right)s.x=u.left-f/2;if(s.y+o/2u.bottom)s.y=u.top-o/2;C.current=s,i(s.x,s.y)}),K0=g0((E,{clientX:d,clientY:c})=>{sC.flushSync(()=>{S(E),B(E)});let r=w.current;if(!r||!E)return;let u={x:d-r.offsetWidth/2,y:c-r.offsetHeight/2};C.current=u,i(u.x,u.y)});u5.useEffect(function(){if(!L.current||U||_||!t)return;let d=0;function c(s){function f(){try{z1(I.current).exitPointerLock()}catch{}finally{k.current=!1,K0(!1,s),D(N.current??O.current,h9(T0.scrub,s));let o=A.current,G0=L.current;if(!T.current&&o!=null&&G0)o.dispatchEvent(new(S1(G0)).MouseEvent("click",{bubbles:!0,cancelable:!0}));T.current=!1,A.current=null}}if(c1.engine.gecko)x.start(20,f);else f()}function r(s){if(!k.current)return;s.preventDefault(),J0(s);let{movementX:f,movementY:o}=s;if(d+=X==="vertical"?o:f,Math.abs(d)>=Y){d=0,T.current=!0;let G0=X==="vertical"?-o:f,p=M(s),Z0=G0*p;if(Z0!==0)V.current=!0,F(Math.abs(Z0),{direction:Z0>=0?1:-1,event:s,reason:T0.scrub})}}let u=S1(L.current),m=I8(_1(u,"pointerup",c,!0),_1(u,"pointermove",r,!0));return()=>{x.clear(),m()}},[U,_,V,F,t,M,L,K0,J0,X,Y,N,D,O,x]),u5.useEffect(()=>()=>{if(k.current){k.current=!1,B(!1);try{z1(I.current).exitPointerLock()}catch{}}},[B]),u5.useEffect(function(){let d=I.current;if(!d||U||_)return;function c(r){if(r.touches.length===1)r.preventDefault()}return _1(d,"touchstart",c)},[U,_]);let H0=o0("span",J,{ref:[Q,I],state:H,props:[{role:"presentation",style:na,async onPointerDown(E){let d=!E.button||E.button===0;if(E.defaultPrevented||_||!d||U)return;let c=E.pointerType==="touch";if(P(c),E.pointerType==="mouse")E.preventDefault(),L.current?.focus();if(k.current=!0,T.current=!1,A.current=A5(E.nativeEvent),K0(!0,E.nativeEvent),!c&&!c1.engine.webkit)try{await z1(I.current).body.requestPointerLock(),l(!1)}catch(r){l(!0)}finally{if(k.current)K0(!0,E.nativeEvent)}}},W],stateAttributesMapping:M9}),q0=u5.useMemo(()=>({isScrubbing:t,isTouchInput:j,isPointerLockDenied:h,scrubAreaCursorRef:w}),[t,j,h]);return G(GF.Provider,{value:q0,children:H0})});var AW=R(v(),1),nC=R($5(),1);var aa={position:"fixed",top:0,left:0,pointerEvents:"none"},aC=AW.forwardRef(function(J,Q){let{render:Z,className:q,style:X,...Y}=J,{state:z}=M4(),{isScrubbing:K,isTouchInput:W,isPointerLockDenied:H,scrubAreaCursorRef:B}=lC(),[U,_]=AW.useState(null),L=K&&!c1.engine.webkit&&!W&&!H,F=o0("span",J,{enabled:L,ref:[Q,B,_],state:z,props:[{role:"presentation",style:aa},Y],stateAttributesMapping:M9});return F&&nC.createPortal(F,z1(U).body)});var ZX={fast:{type:"spring",duration:0.08,bounce:0,exit:{duration:0.06}},moderate:{type:"spring",duration:0.16,bounce:0.08,exit:{duration:0.12}},settle:{type:"spring",duration:0.16,bounce:0,exit:{duration:0.12}},slow:{type:"spring",duration:0.24,bounce:0.12,exit:{duration:0.16}}};var E$={normal:"'wght' 400, 'opsz' 14",medium:"'wght' 450, 'opsz' 15",semibold:"'wght' 550, 'opsz' 20",bold:"'wght' 700, 'opsz' 25"};var q7=R(v(),1);var WF={pill:{item:"rounded-[20px]",bg:"rounded-[20px]",focusRing:"rounded-[22px]",mergedBg:"rounded-2xl",container:"rounded-3xl",button:"rounded-[20px]",input:"rounded-[20px]",bgRadius:20,mergedRadius:16},rounded:{item:"rounded-lg",bg:"rounded-lg",focusRing:"rounded-[10px]",mergedBg:"rounded-lg",container:"rounded-xl",button:"rounded-lg",input:"rounded-lg",bgRadius:8,mergedRadius:8}},ta=q7.createContext(null);function g9(){let $=q7.useContext(ta);if(!$)return WF.pill;return $.classes}var $S=s0.createContext(null);function ea({value:$,children:J}){return G($S.Provider,{value:$,children:J})}function F8($){return Math.max(0,Math.min(1,$))}function v6($){return Math.max(0,Math.min(255,$))}function LF($,J,Q){let Z=Q*J,q=($%360+360)%360/60,X=Z*(1-Math.abs(q%2-1)),Y=0,z=0,K=0;if(q<1)Y=Z,z=X,K=0;else if(q<2)Y=X,z=Z,K=0;else if(q<3)Y=0,z=Z,K=X;else if(q<4)Y=0,z=X,K=Z;else if(q<5)Y=X,z=0,K=Z;else Y=Z,z=0,K=X;let W=Q-Z;return{r:(Y+W)*255,g:(z+W)*255,b:(K+W)*255}}function yQ($,J,Q){$/=255,J/=255,Q/=255;let Z=Math.max($,J,Q),q=Math.min($,J,Q),X=Z,Y=Z-q,z=Z===0?0:Y/Z,K=0;if(Y>0){if(Z===$)K=(J-Q)/Y%6;else if(Z===J)K=(Q-$)/Y+2;else K=($-J)/Y+4;if(K*=60,K<0)K+=360}return{h:K,s:z,v:X}}function FF($,J,Q){$/=255,J/=255,Q/=255;let Z=Math.max($,J,Q),q=Math.min($,J,Q),X=(Z+q)/2,Y=Z-q,z=0,K=0;if(Y>0){if(K=X>0.5?Y/(2-Z-q):Y/(Z+q),Z===$)z=(J-Q)/Y%6;else if(Z===J)z=(Q-$)/Y+2;else z=($-J)/Y+4;if(z*=60,z<0)z+=360}return{h:z,s:K,l:X}}function JS($,J,Q){let Z=(1-Math.abs(2*Q-1))*J,q=($%360+360)%360/60,X=Z*(1-Math.abs(q%2-1)),Y=0,z=0,K=0;if(q<1)Y=Z,z=X;else if(q<2)Y=X,z=Z;else if(q<3)z=Z,K=X;else if(q<4)z=X,K=Z;else if(q<5)Y=X,K=Z;else Y=Z,K=X;let W=Q-Z/2;return{r:(Y+W)*255,g:(z+W)*255,b:(K+W)*255}}function HF($){return $=$/255,$<=0.04045?$/12.92:Math.pow(($+0.055)/1.055,2.4)}function BF($){let J=$<=0.0031308?12.92*$:1.055*Math.pow($,0.4166666666666667)-0.055;return F8(J)*255}function $t($,J,Q){let Z=0.4122214708*$+0.5363325363*J+0.0514459929*Q,q=0.2119034982*$+0.6806995451*J+0.1073969566*Q,X=0.0883024619*$+0.2817188376*J+0.6299787005*Q,Y=Math.cbrt(Z),z=Math.cbrt(q),K=Math.cbrt(X);return{L:0.2104542553*Y+0.793617785*z-0.0040720468*K,a:1.9779984951*Y-2.428592205*z+0.4505937099*K,b:0.0259040371*Y+0.7827717662*z-0.808675766*K}}function Jt($,J,Q){let Z=$+0.3963377774*J+0.2158037573*Q,q=$-0.1055613458*J-0.0638541728*Q,X=$-0.0894841775*J-1.291485548*Q,Y=Z*Z*Z,z=q*q*q,K=X*X*X;return{r:4.0767416621*Y-3.3077115913*z+0.2309699292*K,g:-1.2684380046*Y+2.6097574011*z-0.3413193965*K,b:-0.0041960863*Y-0.7034186147*z+1.707614701*K}}function VF($,J,Q){let Z=HF($),q=HF(J),X=HF(Q),Y=$t(Z,q,X),z=Math.sqrt(Y.a*Y.a+Y.b*Y.b),K=Math.atan2(Y.b,Y.a)*180/Math.PI;if(K<0)K+=360;return{L:Y.L,C:z,H:K}}function QS($,J,Q){let Z=J*Math.cos(Q*Math.PI/180),q=J*Math.sin(Q*Math.PI/180),X=Jt($,Z,q);return{r:v6(BF(X.r)),g:v6(BF(X.g)),b:v6(BF(X.b))}}function y$($){return Math.round(v6($)).toString(16).padStart(2,"0")}function PQ($,J,Q,Z){if(Z>=1)return`#${y$($)}${y$(J)}${y$(Q)}`;return`#${y$($)}${y$(J)}${y$(Q)}${y$(Z*255)}`}function Qt($){if($.length===3)return $.split("").map((J)=>J+J).join("");if($.length===4)return $.split("").map((J)=>J+J).join("");return $}function Zt($){let J=$.trim().match(/^#?([0-9a-fA-F]{3,8})$/);if(!J)return null;let Q=J[1];if(Q.length===3||Q.length===4)Q=Qt(Q);if(Q.length===6)return{r:parseInt(Q.slice(0,2),16),g:parseInt(Q.slice(2,4),16),b:parseInt(Q.slice(4,6),16),a:1};if(Q.length===8)return{r:parseInt(Q.slice(0,2),16),g:parseInt(Q.slice(2,4),16),b:parseInt(Q.slice(4,6),16),a:parseInt(Q.slice(6,8),16)/255};return null}function X2($){let J=$.trim();if(!J)return null;if(J.startsWith("#")||/^[0-9a-fA-F]{3,8}$/.test(J))return Zt(J);let Q=J.match(/^rgba?\(\s*([^)]+)\)$/i);if(Q){let X=Q[1].split(/[\s,/]+/).filter(Boolean);if(X.length<3)return null;let Y=parseFloat(X[0]),z=parseFloat(X[1]),K=parseFloat(X[2]),W=1;if(X[3]!==void 0)W=X[3].endsWith("%")?parseFloat(X[3])/100:parseFloat(X[3]);if([Y,z,K,W].some(Number.isNaN))return null;return{r:v6(Y),g:v6(z),b:v6(K),a:F8(W)}}let Z=J.match(/^hsla?\(\s*([^)]+)\)$/i);if(Z){let X=Z[1].split(/[\s,/]+/).filter(Boolean);if(X.length<3)return null;let Y=parseFloat(X[0]),z=X[1].endsWith("%")?parseFloat(X[1])/100:parseFloat(X[1]),K=X[2].endsWith("%")?parseFloat(X[2])/100:parseFloat(X[2]),W=1;if(X[3]!==void 0)W=X[3].endsWith("%")?parseFloat(X[3])/100:parseFloat(X[3]);if([Y,z,K,W].some(Number.isNaN))return null;let H=JS(Y,F8(z),F8(K));return{r:v6(H.r),g:v6(H.g),b:v6(H.b),a:F8(W)}}let q=J.match(/^oklch\(\s*([^)]+)\)$/i);if(q){let X=q[1].split(/[\s,/]+/).filter(Boolean);if(X.length<3)return null;let Y=X[0].endsWith("%")?parseFloat(X[0])/100:parseFloat(X[0]),z=parseFloat(X[1]),K=parseFloat(X[2]),W=1;if(X[3]!==void 0)W=X[3].endsWith("%")?parseFloat(X[3])/100:parseFloat(X[3]);if([Y,z,K,W].some(Number.isNaN))return null;let H=QS(F8(Y),Math.max(0,z),K);return{r:v6(H.r),g:v6(H.g),b:v6(H.b),a:F8(W)}}return null}var wW=null;function ZS($){let J=X2($);if(J)return J;let Q=$.trim();if(!Q||typeof document>"u")return null;if(!wW){if(wW=document.createElement("canvas").getContext("2d"),!wW)return null}let Z=wW;Z.fillStyle="#000000",Z.fillStyle=Q;let q=String(Z.fillStyle);Z.fillStyle="#ffffff",Z.fillStyle=Q;let X=String(Z.fillStyle);if(q!==X)return null;return X2(q)}function UF($,J,Q,Z){let{r:q,g:X,b:Y}=LF($,J,Q),z=FF(q,X,Y),K=VF(q,X,Y),W=PQ(q,X,Y,Z),H=Z>=1?`rgb(${Math.round(q)}, ${Math.round(X)}, ${Math.round(Y)})`:`rgba(${Math.round(q)}, ${Math.round(X)}, ${Math.round(Y)}, ${Number(Z.toFixed(3))})`,B=Z>=1?`hsl(${Math.round(z.h)}, ${Math.round(z.s*100)}%, ${Math.round(z.l*100)}%)`:`hsla(${Math.round(z.h)}, ${Math.round(z.s*100)}%, ${Math.round(z.l*100)}%, ${Number(Z.toFixed(3))})`,U=Z>=1?`oklch(${(K.L*100).toFixed(1)}% ${K.C.toFixed(3)} ${K.H.toFixed(1)})`:`oklch(${(K.L*100).toFixed(1)}% ${K.C.toFixed(3)} ${K.H.toFixed(1)} / ${Number(Z.toFixed(3))})`;return{h:$,s:J,v:Q,a:Z,r:Math.round(q),g:Math.round(X),b:Math.round(Y),hex:W,rgb:H,hsl:B,oklch:U}}function _F($,J){switch(J){case"hex":return $.hex;case"rgb":return $.rgb;case"hsl":return $.hsl;case"oklch":return $.oklch}}var qt=280,Xt=156,qS={backgroundImage:"conic-gradient(var(--checker-a) 0 25%, var(--checker-b) 0 50%, var(--checker-a) 0 75%, var(--checker-b) 0)",backgroundSize:"8px 8px"};function Yt({h:$,s:J,v:Q,onChange:Z}){let q=s0.useRef(null),[X,Y]=s0.useState(!1),z=s0.useRef(!1),[K,W]=s0.useState(!1),[H,B]=s0.useState(!1),[U,_]=s0.useState(null),L=g9(),F=s0.useCallback((w,C)=>{let y=q.current?.getBoundingClientRect();if(!y)return;let x=F8((w-y.left)/y.width),j=F8((C-y.top)/y.height);Z(x,1-j)},[Z]),V=s0.useCallback((w,C)=>{let y=q.current?.getBoundingClientRect();if(!y)return;_({x:F8((w-y.left)/y.width)*100,y:F8((C-y.top)/y.height)*100})},[]),M=s0.useCallback((w)=>{if(w.pointerType==="mouse"&&w.button!==0)return;w.preventDefault(),Y(!0),z.current=!1,w.currentTarget.setPointerCapture(w.pointerId),F(w.clientX,w.clientY)},[F]),D=s0.useCallback((w)=>{if(V(w.clientX,w.clientY),!X)return;z.current=!0,F(w.clientX,w.clientY)},[X,F,V]),N=s0.useCallback(()=>{Y(!1),z.current=!1},[]),O=s0.useCallback((w)=>{let C=w.shiftKey?0.1:0.01,y=J,x=Q,j=!0;if(w.key==="ArrowLeft")y=F8(J-C);else if(w.key==="ArrowRight")y=F8(J+C);else if(w.key==="ArrowUp")x=F8(Q+C);else if(w.key==="ArrowDown")x=F8(Q-C);else j=!1;if(j)w.preventDefault(),Z(y,x)},[Z,J,Q]),{r:I,g:k,b:T}=LF($,J,Q),A=`rgb(${Math.round(I)}, ${Math.round(k)}, ${Math.round(T)})`;return b("div",{ref:q,role:"application","aria-label":"Saturation and brightness",tabIndex:0,onFocus:(w)=>{if(w.currentTarget.matches(":focus-visible"))W(!0)},onBlur:()=>W(!1),onPointerEnter:()=>B(!0),onPointerLeave:()=>{B(!1),_(null)},onPointerDown:M,onPointerMove:D,onPointerUp:N,onKeyDown:O,className:b0("relative w-full select-none touch-none cursor-none outline-none",L.bg),style:{height:Xt,boxShadow:K?"0 0 0 2px var(--focus-ring, #6B97FF)":void 0},children:[G("div",{className:b0("absolute inset-0 overflow-hidden",L.bg==="rounded-[20px]"?"rounded-2xl":L.bg),style:{background:`linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${$}, 100%, 50%))`}}),G(Tq.div,{className:"absolute pointer-events-none rounded-full",initial:!1,animate:{left:`${J*100}%`,top:`${(1-Q)*100}%`,width:18,height:18},transition:{duration:0},style:{transform:"translate(-50%, -50%)",border:"1px solid white",boxShadow:"0 0 0 1px rgba(0,0,0,1)",backgroundColor:A}}),H&&!X&&U&&G("div",{className:"absolute pointer-events-none rounded-full",style:{left:`${U.x}%`,top:`${U.y}%`,width:18,height:18,transform:"translate(-50%, -50%)",border:"2px solid rgba(255, 255, 255, 0.55)",boxShadow:"0 0 0 1px rgba(0, 0, 0, 0.2)"}})]})}function XS({value:$,onChange:J,min:Q,max:Z,step:q,trackStyle:X,thumbColor:Y,thumbBorderColor:z,className:K,...W}){return b(aQ,{className:b0("relative flex h-8 w-full touch-none select-none items-center",K),value:[$],min:Q,max:Z,step:q,onValueChange:(H)=>J(H[0]??$),...W,children:[G(rX,{className:"relative h-4 w-full grow overflow-hidden rounded-full border border-border bg-muted",style:X,children:G(sX,{className:"absolute h-full bg-transparent"})}),G(oX,{className:"block h-5 w-5 rounded-full border-2 bg-background shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",style:{backgroundColor:Y,borderColor:z}})]})}function zt({h:$,onChange:J}){let Q=`hsl(${$}, 100%, 50%)`;return G(XS,{value:$,onChange:J,min:0,max:360,step:1,thumbColor:Q,thumbBorderColor:"rgba(255,255,255,0.9)",trackStyle:{background:"linear-gradient(to right, hsl(0,100%,50%), hsl(60,100%,50%), hsl(120,100%,50%), hsl(180,100%,50%), hsl(240,100%,50%), hsl(300,100%,50%), hsl(360,100%,50%))",borderColor:"transparent"},"aria-label":"Hue"})}function Kt({a:$,solidColor:J,solidR:Q,solidG:Z,solidB:q,onChange:X}){let Y=`rgba(${Q}, ${Z}, ${q}, 0)`;return G(XS,{value:Math.round($*100),onChange:(z)=>X(z/100),min:0,max:100,step:1,thumbColor:J,thumbBorderColor:"rgba(255,255,255,0.9)",trackStyle:{backgroundImage:`linear-gradient(to right, ${Y} 0%, ${J} 98%), conic-gradient(var(--checker-a) 0 25%, var(--checker-b) 0 50%, var(--checker-a) 0 75%, var(--checker-b) 0)`,backgroundSize:"100% 100%, 8px 8px",borderWidth:0},"aria-label":"Alpha"})}var tC={hex:"HEX",rgb:"RGB",hsl:"HSL",oklch:"OKLCH"},Gt=["hex","rgb","hsl","oklch"],Wt=WF.rounded;function Ht({value:$,label:J,checked:Q}){let Z=g9();return G(V4.RadioItem,{value:$,label:J,closeOnClick:!0,render:G("div",{className:b0("relative z-10 flex items-center px-3 py-2 text-[13px] cursor-pointer outline-none",Z.item)}),children:G("span",{className:b0("transition-colors duration-80",Q?"text-foreground":"text-muted-foreground"),style:{fontVariationSettings:Q?E$.semibold:E$.normal},children:J})})}function Bt({value:$,onChange:J,open:Q,defaultOpen:Z=!1}){let[q,X]=s0.useState(Z),Y=Q!==void 0,z=Y?Q:q,K=s0.useRef(null),W=g9(),H=s0.useContext($S),B=T4;return b(V4.Root,{open:z,onOpenChange:(U)=>{if(!Y)X(U)},actionsRef:K,modal:!1,children:[b(V4.Trigger,{className:b0("flex items-center justify-between gap-2 h-9 px-3 text-[13px] bg-transparent hover:bg-hover hover:text-foreground transition-colors duration-80 outline-none focus-visible:ring-1 focus-visible:ring-[color:var(--focus-ring,#6B97FF)] cursor-pointer border border-border",z?"bg-active text-foreground":"text-muted-foreground active:bg-active",W.input),style:{fontVariationSettings:E$.medium},children:[G("span",{children:tC[$]}),G(B,{size:14,strokeWidth:1.5,className:b0("text-muted-foreground transition-transform duration-150",z&&"rotate-180")})]}),G(V4.Portal,{container:H??void 0,children:G(V4.Positioner,{side:"bottom",align:"start",sideOffset:6,className:"z-[60] outline-none",children:G(Tq.div,{initial:{opacity:0,y:-4,scaleY:0.96},animate:z?{opacity:1,y:0,scaleY:1}:{opacity:0,y:-4,scaleY:0.96},transition:z?ZX.fast:ZX.fast.exit,style:{transformOrigin:"top center"},onAnimationComplete:()=>{if(!z)K.current?.unmount()},children:G(V4.Popup,{className:b0(`relative flex flex-col gap-0.5 min-w-[var(--anchor-width)] bg-popover ${Wt.container} p-1 select-none outline-none`),children:G(V4.RadioGroup,{value:$,onValueChange:(U)=>J(U),className:"contents",children:Gt.map((U)=>G(Ht,{value:U,label:tC[U],checked:$===U},U))})})})})})]})}var YS=s0.forwardRef(({value:$,onCommit:J,ariaLabel:Q,width:Z,className:q,inputClassName:X,align:Y="left",prefix:z,inputMode:K="text",nudgeStep:W,nudgeShiftStep:H,hasPercent:B=!1,decimals:U,min:_,max:L,wrap:F=!1},V)=>{let[M,D]=s0.useState($),N=s0.useRef(!1),O=g9();s0.useEffect(()=>{if(!N.current)D($)},[$]);let I=(A)=>U!=null?A.toFixed(U):String(Math.round(A)),k=(A)=>{let w=A;if(F&&_!=null&&L!=null){let x=L-_;w=((w-_)%x+x)%x+_}else{if(_!=null)w=Math.max(_,w);if(L!=null)w=Math.min(L,w)}let C=I(w),y=B?`${C}%`:C;D(y),J(y)},T=(A,w)=>{let C=w?H??10:W??1,y=parseFloat(M.replace("%",""));if(Number.isNaN(y))return;k(y+A*C)};return b("div",{className:b0("flex items-center h-9 px-2 bg-transparent hover:bg-hover active:bg-active transition-colors duration-80 focus-within:ring-1 focus-within:ring-[color:var(--highlight,#6B97FF)] select-none border border-border",O.input,q),style:{width:Z},children:[z&&G("span",{className:"text-[12px] text-muted-foreground mr-1 select-none",children:z}),G("input",{ref:V,value:M,onChange:(A)=>D(A.target.value),onFocus:(A)=>{N.current=!0,A.currentTarget.select()},onBlur:()=>{if(N.current=!1,M!==$){let A=parseFloat(M.replace("%",""));if(!Number.isNaN(A)&&(_!=null||L!=null))k(A);else J(M)}else D($)},onKeyDown:(A)=>{if(A.key==="Enter")A.currentTarget.blur();else if(A.key==="Escape")D($),A.currentTarget.blur();else if((W!=null||H!=null)&&(A.key==="ArrowUp"||A.key==="ArrowDown"))A.preventDefault(),T(A.key==="ArrowUp"?1:-1,A.shiftKey)},inputMode:K,"aria-label":Q,className:b0("flex-1 min-w-0 bg-transparent text-foreground text-[13px] outline-none tabular-nums",Y==="center"&&"text-center",Y==="right"&&"text-right",X),style:{fontVariationSettings:E$.medium}})]})});YS.displayName="TextColorInput";var zS=s0.forwardRef(({value:$,onCommit:J,ariaLabel:Q,width:Z,className:q,inputClassName:X,align:Y="left",prefix:z,inputMode:K="numeric",nudgeStep:W,nudgeShiftStep:H,hasPercent:B=!1,decimals:U,min:_,max:L,wrap:F=!1},V)=>{let M=g9(),D=s0.useRef(null),[N,O]=s0.useState(!1),I=s0.useRef(!1),k=parseFloat(String($).replace("%","")),T=Number.isNaN(k)?null:k,A=s0.useMemo(()=>{let y={useGrouping:!1};if(U!=null)y.minimumFractionDigits=U,y.maximumFractionDigits=U;else y.maximumFractionDigits=0;if(B)y.style="unit",y.unit="percent";return y},[U,B]),w=s0.useCallback((y)=>{if(D.current=y,typeof V==="function")V(y);else if(V)V.current=y},[V]),C=s0.useCallback((y)=>{let x=y;if(F&&_!=null&&L!=null){if(x<_||x>L){let P=L-_;x=((x-_)%P+P)%P+_}}else{if(_!=null)x=Math.max(_,x);if(L!=null)x=Math.min(L,x)}let j=U!=null?x.toFixed(U):String(Math.round(x));J(B?`${j}%`:j)},[F,_,L,U,B,J]);return G(j$.Root,{value:T,onValueChange:(y,x)=>{if(y==null)return;let j=x.reason;if(j==="input-change"||j==="input-paste"||j==="input-clear")return;C(y)},onValueCommitted:(y,x)=>{if(x.reason==="scrub")I.current=!1,D.current?.blur()},min:F?void 0:_,max:F?void 0:L,step:W??1,largeStep:H??10,format:A,className:b0("flex items-center h-9 bg-transparent hover:bg-hover active:bg-active transition-colors duration-80 focus-within:ring-1 focus-within:ring-[color:var(--highlight,#6B97FF)] select-none border border-border",M.input,q),style:{width:Z},children:b(j$.ScrubArea,{direction:"horizontal",pixelSensitivity:1,onPointerDownCapture:()=>{I.current=!0},onClick:()=>{I.current=!1,O(!0),D.current?.focus(),D.current?.select()},className:b0("flex flex-1 min-w-0 items-center self-stretch px-2",!N&&"cursor-ew-resize"),children:[G(j$.ScrubAreaCursor,{className:"drop-shadow-[0_1px_1px_rgba(0,0,0,0.4)]",children:G("svg",{width:24,height:14,viewBox:"0 0 24 14",fill:"#000",stroke:"#fff",strokeWidth:1,"aria-hidden":"true",children:G("path",{d:"M0.5 7l5-5v3.5h13V2l5 5-5 5V8.5h-13V12l-5-5z"})})}),z&&G("span",{className:"text-[12px] text-muted-foreground mr-1 select-none",children:z}),G(j$.Input,{ref:w,"aria-label":Q,inputMode:K,onPointerDown:(y)=>{if(N)y.stopPropagation()},onFocus:(y)=>{if(I.current)return;O(!0),y.currentTarget.select()},onBlur:()=>{O(!1)},onKeyDown:(y)=>{if(y.key==="Enter")y.currentTarget.blur();else if(y.key==="Escape"){let x=y.currentTarget,j=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"value")?.set;if(j&&T!=null){let P=U!=null?T.toFixed(U):String(Math.round(T));j.call(x,B?`${P}%`:P),x.dispatchEvent(new Event("input",{bubbles:!0}))}x.blur()}},className:b0("flex-1 min-w-0 bg-transparent text-foreground text-[13px] outline-none tabular-nums",Y==="center"&&"text-center",Y==="right"&&"text-right",!N&&"pointer-events-none",X),style:{fontVariationSettings:E$.medium}})]})})});zS.displayName="ScrubColorInput";var D9=s0.forwardRef(({scrubbable:$=!1,...J},Q)=>$?G(zS,{ref:Q,...J}):G(YS,{ref:Q,...J}));D9.displayName="ColorInput";function Ut({onPick:$}){let[J,Q]=s0.useState(!1),Z=g9(),q=eC;if(s0.useEffect(()=>{Q(typeof window<"u"&&"EyeDropper"in window)},[]),!J)return null;return G("button",{type:"button",onClick:async()=>{try{let K=await new window.EyeDropper().open();$(K.sRGBHex)}catch{}},"aria-label":"Pick color from screen",className:b0("flex items-center justify-center h-9 px-3 text-muted-foreground bg-transparent hover:bg-hover hover:text-foreground active:bg-active transition-colors duration-80 outline-none focus-visible:ring-1 focus-visible:ring-[color:var(--focus-ring,#6B97FF)] cursor-pointer border border-border",Z.input),children:G(q,{size:16,strokeWidth:1.5})})}function _t({color:$,size:J=24,className:Q,style:Z}){let q=g9();return G("span",{className:b0("inline-block relative shrink-0 overflow-hidden",q.bg,Q),style:{width:J,height:J,...qS,boxShadow:"inset 0 0 0 1px rgba(127,127,127,0.25)",...Z},children:G("span",{className:"absolute inset-0",style:{backgroundColor:$}})})}var KS=s0.forwardRef(({color:$,size:J=28,selected:Q,className:Z,onMouseEnter:q,onMouseLeave:X,...Y},z)=>{let K=g9(),[W,H]=s0.useState(!1),B=Q?"inset 0 0 0 1px rgba(127,127,127,0.25), 0 0 0 2px var(--background), 0 0 0 4px #6B97FF":W?"inset 0 0 0 1px rgba(127,127,127,0.25), 0 0 0 2px var(--background), 0 0 0 4px rgba(127,127,127,0.4)":"inset 0 0 0 1px rgba(127,127,127,0.25)";return G("button",{ref:z,type:"button","aria-label":`Select color ${$}`,className:b0("relative shrink-0 overflow-hidden cursor-pointer outline-none transition-shadow duration-100",K.bg,Z),style:{width:J,height:J,...qS,boxShadow:B},onMouseEnter:(U)=>{H(!0),q?.(U)},onMouseLeave:(U)=>{H(!1),X?.(U)},...Y,children:G("span",{className:"absolute inset-0",style:{backgroundColor:$}})})});KS.displayName="ColorSwatch";function Lt({swatches:$,current:J,onPick:Q}){let Z=s0.useMemo(()=>{let Y=X2(J);return Y?PQ(Y.r,Y.g,Y.b,Y.a).toLowerCase():""},[J]),[q,X]=s0.useState({});return s0.useEffect(()=>{let Y={};for(let z of $)if(!X2(z)){let K=ZS(z);if(K)Y[z]=PQ(K.r,K.g,K.b,K.a).toLowerCase()}X(Y)},[$]),G("div",{className:"flex flex-wrap gap-2",children:$.map((Y,z)=>{let K=X2(Y),H=(K?PQ(K.r,K.g,K.b,K.a).toLowerCase():q[Y]??Y.toLowerCase())===Z;return G(KS,{color:Y,size:28,selected:H,onClick:()=>Q(Y)},`${Y}-${z}`)})})}var GS=s0.forwardRef(({value:$,defaultValue:J="#6B97FF",onValueChange:Q,format:Z,defaultFormat:q="hex",onFormatChange:X,swatches:Y,hideEyedropper:z,formatOpen:K,defaultFormatOpen:W,className:H,...B},U)=>{let _=$!==void 0,[L,F]=s0.useState($??J),V=_?$:L,M=Z!==void 0,[D,N]=s0.useState(q),O=M?Z:D,I=s0.useMemo(()=>{let e=X2(V);if(!e)return{h:0,s:1,v:1,a:1};let H0=yQ(e.r,e.g,e.b);return{h:H0.s===0?0:H0.h,s:H0.s,v:H0.v,a:e.a}},[]),[k,T]=s0.useState(I),A=s0.useRef(null),w=s0.useRef("");s0.useEffect(()=>{if(!_)return;let e=w.current,H0=$;if(H0===e)return;let q0=X2(H0);if(!q0)return;A.current=null;let E=yQ(q0.r,q0.g,q0.b);T((d)=>({h:E.s===0?d.h:E.h,s:E.s,v:E.v,a:q0.a}))},[$,_]);let C=s0.useMemo(()=>UF(k.h,k.s,k.v,k.a),[k]),y=s0.useCallback((e)=>{let H0={...k,...e};T(H0);let q0=UF(H0.h,H0.s,H0.v,H0.a),E=_F(q0,O);if(w.current=E,!_)F(E);Q?.(E,q0)},[k,O,_,Q]),x=s0.useCallback((e)=>{if(!M)N(e);X?.(e);let H0=_F(C,e);if(w.current=H0,!_)F(H0);Q?.(H0,C)},[M,_,X,Q,C]),j=s0.useCallback((e)=>{let H0=ZS(e);if(!H0)return;A.current=null;let q0=yQ(H0.r,H0.g,H0.b),E={h:q0.s===0?k.h:q0.h,s:q0.s,v:q0.v,a:H0.a};T(E);let d=UF(E.h,E.s,E.v,E.a),c=_F(d,O);if(w.current=c,!_)F(c);Q?.(c,d)},[k.h,O,_,Q]),P=s0.useCallback((e)=>{j(e)},[j]),h=s0.useCallback((e)=>{j(e)},[j]),l=s0.useMemo(()=>LF(k.h,k.s,k.v),[k.h,k.s,k.v]),t=Math.round(l.r),S=Math.round(l.g),i=Math.round(l.b),J0=`rgb(${t}, ${S}, ${i})`,K0=g9();return b("div",{ref:U,className:b0("flex flex-col gap-2 p-3",K0.container,H),style:{width:qt},...B,children:[G(Yt,{h:k.h,s:k.s,v:k.v,onChange:(e,H0)=>y({s:e,v:H0})}),b("div",{className:"flex flex-col [&>*]:mb-0 [&>*+*]:-mt-px",children:[G(zt,{h:k.h,onChange:(e)=>{A.current=null,y({h:e})}}),G(Kt,{a:k.a,solidColor:J0,solidR:t,solidG:S,solidB:i,onChange:(e)=>y({a:e})})]}),b("div",{className:"grid grid-cols-2 gap-2",children:[G(Bt,{value:O,onChange:x,open:K,defaultOpen:W}),!z&&G(Ut,{onPick:h})]}),G(Ft,{parsed:C,format:O,oklchHue:A.current,onChannelChange:(e,H0)=>{let q0={...C};switch(e){case"hex":j(H0);return;case"r":case"g":case"b":{A.current=null;let E=e==="r"?Number(H0):q0.r,d=e==="g"?Number(H0):q0.g,c=e==="b"?Number(H0):q0.b,r=yQ(E,d,c);y({h:r.s===0?k.h:r.h,s:r.s,v:r.v});return}case"hSL":case"sSL":case"lSL":{if(e==="hSL")A.current=null;let E=FF(q0.r,q0.g,q0.b),d=e==="hSL"?Number(H0):E.h,c=e==="sSL"?Number(H0)/100:E.s,r=e==="lSL"?Number(H0)/100:E.l,u=JS(d,F8(c),F8(r)),m=yQ(u.r,u.g,u.b);y({h:m.s===0?d:m.h,s:m.s,v:m.v});return}case"L":case"C":case"H":{let E=VF(q0.r,q0.g,q0.b),d=A.current??E.H,c=e==="L"?Number(H0)/100:E.L,r=e==="C"?Number(H0):E.C,u=e==="H"?Number(H0):d;A.current=u;let m=QS(F8(c),Math.max(0,r),u),s=yQ(m.r,m.g,m.b);y({h:s.s===0?k.h:s.h,s:s.s,v:s.v});return}case"alphaPercent":{let E=F8(Number(H0)/100);y({a:E});return}}}}),Y&&Y.length>0&&G(Lt,{swatches:Y,current:C.hex,onPick:P})]})});GS.displayName="ColorPicker";function Ft({parsed:$,format:J,oklchHue:Q,onChannelChange:Z}){let q=Math.round($.a*100);if(J==="hex"){let z=$.hex.replace(/^#/,"").toUpperCase();return b("div",{className:"grid grid-cols-2 gap-2",children:[G(u9,{label:"Hex",children:G(D9,{value:z,onCommit:(K)=>Z("hex",K.startsWith("#")?K:`#${K}`),ariaLabel:"Hex value",prefix:"#"})}),G(kW,{value:q,onCommit:(K)=>Z("alphaPercent",String(K))})]})}if(J==="rgb")return b("div",{className:"grid grid-cols-4 gap-1",children:[G(u9,{label:"Red",children:G(D9,{value:String($.r),onCommit:(z)=>Z("r",z),ariaLabel:"Red",align:"center",inputMode:"numeric",nudgeStep:1,nudgeShiftStep:10,scrubbable:!0,min:0,max:255})}),G(u9,{label:"Green",children:G(D9,{value:String($.g),onCommit:(z)=>Z("g",z),ariaLabel:"Green",align:"center",inputMode:"numeric",nudgeStep:1,nudgeShiftStep:10,scrubbable:!0,min:0,max:255})}),G(u9,{label:"Blue",children:G(D9,{value:String($.b),onCommit:(z)=>Z("b",z),ariaLabel:"Blue",align:"center",inputMode:"numeric",nudgeStep:1,nudgeShiftStep:10,scrubbable:!0,min:0,max:255})}),G(kW,{value:q,onCommit:(z)=>Z("alphaPercent",String(z))})]});if(J==="hsl"){let z=FF($.r,$.g,$.b);return b("div",{className:"grid grid-cols-4 gap-1",children:[G(u9,{label:"Hue",children:G(D9,{value:String(Math.round(z.h)),onCommit:(K)=>Z("hSL",K),ariaLabel:"Hue",align:"center",inputMode:"numeric",nudgeStep:1,nudgeShiftStep:10,scrubbable:!0,min:0,max:360,wrap:!0})}),G(u9,{label:"Saturation",children:G(D9,{value:String(Math.round(z.s*100)),onCommit:(K)=>Z("sSL",K),ariaLabel:"Saturation",align:"center",inputMode:"numeric",nudgeStep:1,nudgeShiftStep:10,scrubbable:!0,min:0,max:100})}),G(u9,{label:"Lightness",children:G(D9,{value:String(Math.round(z.l*100)),onCommit:(K)=>Z("lSL",K),ariaLabel:"Lightness",align:"center",inputMode:"numeric",nudgeStep:1,nudgeShiftStep:10,scrubbable:!0,min:0,max:100})}),G(kW,{value:q,onCommit:(K)=>Z("alphaPercent",String(K))})]})}let X=VF($.r,$.g,$.b),Y=Q??X.H;return b("div",{className:"grid grid-cols-4 gap-1",children:[G(u9,{label:"Lightness",children:G(D9,{value:(X.L*100).toFixed(0),onCommit:(z)=>Z("L",z),ariaLabel:"Lightness",align:"center",inputMode:"decimal",nudgeStep:1,nudgeShiftStep:10,scrubbable:!0,min:0,max:100})}),G(u9,{label:"Chroma",children:G(D9,{value:X.C.toFixed(2),onCommit:(z)=>Z("C",z),ariaLabel:"Chroma",align:"center",inputMode:"decimal",nudgeStep:0.01,nudgeShiftStep:0.1,decimals:2,scrubbable:!0,min:0,max:0.4})}),G(u9,{label:"Hue",children:G(D9,{value:Y.toFixed(0),onCommit:(z)=>Z("H",z),ariaLabel:"Hue",align:"center",inputMode:"numeric",nudgeStep:1,nudgeShiftStep:10,scrubbable:!0,min:0,max:360,wrap:!0})}),G(kW,{value:q,onCommit:(z)=>Z("alphaPercent",String(z))})]})}function u9({label:$,children:J}){return b(B1,{delayDuration:300,children:[G(U1,{asChild:!0,children:G("span",{className:"contents",children:J})}),G(H1,{children:$})]})}function kW({value:$,onCommit:J}){return G(u9,{label:"Alpha",children:G(D9,{value:`${$}%`,onCommit:(Q)=>{let Z=parseFloat(Q.replace("%",""));if(Number.isNaN(Z))return;J(Math.max(0,Math.min(100,Math.round(Z))))},ariaLabel:"Alpha",align:"center",inputMode:"numeric",nudgeStep:1,nudgeShiftStep:10,hasPercent:!0,scrubbable:!0,min:0,max:100})})}var MF=s0.forwardRef(({triggerAriaLabel:$,triggerLabel:J,triggerLabelPosition:Q="left",triggerShowValue:Z=!0,triggerShowRemove:q=!1,onTriggerRemove:X,triggerClassName:Y,side:z="bottom",align:K="start",sideOffset:W=6,alignOffset:H=0,open:B,defaultOpen:U=!1,onOpenChange:_,...L},F)=>{let V=B!==void 0,[M,D]=s0.useState(U),N=V?B:M,O=s0.useRef(null),[I,k]=s0.useState(null),T=g9(),A=s0.useCallback((S)=>{if(!V)D(S);_?.(S)},[V,_]),w=L.value!==void 0,[C,y]=s0.useState(L.value??L.defaultValue??"#6B97FF"),x=w?L.value:C,j=s0.useCallback((S,i)=>{if(!w)y(S);L.onValueChange?.(S,i)},[w,L]);s0.useEffect(()=>{if(N)return;let S=setTimeout(()=>O.current?.unmount(),150);return()=>clearTimeout(S)},[N]);let P=o9,h=s0.useMemo(()=>X2(x),[x]),l=h?PQ(h.r,h.g,h.b,h.a):x,t=h?PQ(h.r,h.g,h.b,h.a).toUpperCase():x;return G($2.Root,{open:N,onOpenChange:A,actionsRef:O,modal:!1,children:b("div",{ref:F,className:"inline-flex",children:[b($2.Trigger,{"aria-label":$,className:b0("flex items-center gap-2 h-9 px-2 border border-border bg-transparent hover:bg-hover transition-colors duration-80 outline-none focus-visible:ring-1 focus-visible:ring-[color:var(--focus-ring,#6B97FF)] cursor-pointer",T.input,Y),style:{fontVariationSettings:E$.medium},children:[J&&Q==="left"&&G("span",{className:"text-[13px] text-muted-foreground px-1 select-none",children:J}),G(_t,{color:l,size:20}),Z&&G("span",{className:"text-[13px] text-foreground tabular-nums",children:t}),J&&Q==="right"&&G("span",{className:"text-[13px] text-muted-foreground px-1 select-none",children:J}),q&&G("span",{role:"button","aria-label":"Remove color",tabIndex:0,onClick:(S)=>{S.stopPropagation(),X?.()},onKeyDown:(S)=>{if(S.key==="Enter"||S.key===" ")S.stopPropagation(),S.preventDefault(),X?.()},className:"ml-1 text-muted-foreground hover:text-foreground cursor-pointer flex items-center",children:G(P,{size:14,strokeWidth:1.5})})]}),G($2.Portal,{children:G("div",{className:M8,children:G($2.Positioner,{side:z,align:K,sideOffset:W,alignOffset:H,className:"z-[10000] outline-none",children:G(Tq.div,{initial:{opacity:0,y:-4,scaleY:0.96},animate:N?{opacity:1,y:0,scaleY:1}:{opacity:0,y:-4,scaleY:0.96},transition:N?ZX.moderate:ZX.moderate.exit,style:{transformOrigin:"top left"},onAnimationComplete:()=>{if(!N)O.current?.unmount()},children:G($2.Popup,{render:G("div",{ref:k}),className:"outline-none",children:G(ea,{value:I,children:G(GS,{...L,value:x,onValueChange:j,className:b0("bg-popover",L.className)})})})})})})})]})})});MF.displayName="ColorPickerPopover";var Vt=[{id:"no-outline",label:"No outline",style:{color:"#ffffff",outline_color:"transparent",background_color:"transparent"}},{id:"white-outline",label:"White",style:{color:"#ffffff",outline_color:"#000000",background_color:"transparent"}},{id:"yellow-outline",label:"Yellow",style:{color:"#ffd60a",outline_color:"#000000",background_color:"transparent"}},{id:"black-card",label:"Black",style:{color:"#ffffff",outline_color:"transparent",background_color:"#000000"}},{id:"white-card",label:"White card",style:{color:"#000000",outline_color:"transparent",background_color:"#ffffff"}},{id:"accent-card",label:"Accent",style:{color:"#ffffff",outline_color:"transparent",background_color:"#b65764"}},{id:"green-outline",label:"Green",style:{color:"#50f0a0",outline_color:"#000000",background_color:"transparent"}},{id:"blue-shadow",label:"Blue",style:{color:"#ffffff",outline_color:"#2f8cff",background_color:"transparent"}},{id:"pink-shadow",label:"Pink",style:{color:"#ffffff",outline_color:"#ff5ba7",background_color:"transparent"}},{id:"cream-card",label:"Cream",style:{color:"#251f1a",outline_color:"transparent",background_color:"#f4e8b7"}},{id:"red-outline",label:"Red",style:{color:"#ff334e",outline_color:"#ffffff",background_color:"transparent"}},{id:"teal-card",label:"Teal",style:{color:"#ffffff",outline_color:"transparent",background_color:"#0f766e"}},{id:"rose-card",label:"Rose",style:{color:"#fff1f4",outline_color:"transparent",background_color:"#be4f60"}}];function US($,J){if(!$)return J;if($.trim().toLowerCase()==="transparent")return"rgba(0, 0, 0, 0)";return $}function P$($){let J=US($,"rgba(0, 0, 0, 0)").replaceAll(" ","").toLowerCase();if(J==="rgba(0,0,0,0)")return"transparent";return J}function Mt($,J){return P$($.color)===P$(J.style.color)&&P$($.outline_color)===P$(J.style.outline_color)&&P$($.background_color)===P$(J.style.background_color)}function IW($){return Math.round($*100)}function qX($){return Math.max(0,Math.min(1,$/100))}function WS($){return Number($.toFixed(1))}function Dt($){return P$($)!=="transparent"}function _S({text:$,style:J,onTextChange:Q,onStyleChange:Z,speechSettings:q,onSpeechSettingsChange:X,onGenerateSpeech:Y}){let z=X1(),[K,W]=m9.useState(IZ),H=q??K,[B,U]=m9.useState(!1),[_,L]=m9.useState(!1),F=m9.useRef(null),[V,M]=m9.useState(!1),D=J.background_opacity??0.7,N=IW(D),O=!Dt(J.background_color),I=m9.useMemo(()=>{if(!H.referenceAudio)return null;if(/^https?:\/\//i.test(H.referenceAudio))return H.referenceAudio;let w=H.referenceAudioSourceType??"input";return Q5({source_type:w,file_path:w==="input"||w==="output"?H.referenceAudio:void 0,local_path:w==="local"?H.referenceAudio:void 0})},[H.referenceAudio,H.referenceAudioSourceType]);m9.useEffect(()=>{let w=F.current;if(L(!1),w){w.pause();try{w.currentTime=0}catch(C){console.error("[SubtitleSettingsPanel] failed to reset reference audio preview:",C)}}return()=>{w?.pause()}},[I]);function k(w){let C={...H,...w};if(q){X?.(C);return}W(C)}async function T(){if(!Y||V)return;M(!0);try{await Y(H)}finally{M(!1)}}async function A(){let w=F.current;if(!w||!I)return;if(_){w.pause(),L(!1);return}if(w.ended)try{w.currentTime=0}catch(C){console.error("[SubtitleSettingsPanel] failed to restart reference audio preview:",C)}L(!0);try{await w.play()}catch(C){L(!1),console.error("[SubtitleSettingsPanel] failed to play reference audio preview:",C)}}return b("aside",{"data-testid":"subtitle-settings-panel","data-capture-wheel":"true",className:"flex h-full min-h-0 w-[35%] min-w-72 shrink-0 flex-col overflow-hidden border-l border-border bg-muted/30 text-card-foreground shadow-lg","aria-label":z("multitrack.subtitleTextSettings"),children:[I?G("audio",{ref:F,"data-testid":"reference-audio-preview",src:I,preload:"metadata",className:"hidden",onEnded:()=>L(!1)}):null,b(u4,{defaultValue:"text",className:"flex min-h-0 flex-1 flex-col",children:[G("div",{className:"border-b border-border p-1",children:b(r9,{className:"h-8 bg-card border-0 cursor-pointer",children:[b(W8,{value:"text",className:"gap-1 text-[10px]",children:[G(BS,{className:"h-3 w-3"}),z("multitrack.text")]}),b(W8,{value:"speech",className:"gap-1 text-[10px]",children:[G(DF,{className:"h-3 w-3"}),z("multitrack.speech")]})]})}),G(E9,{value:"text",className:"mt-0 min-h-0 flex-1 overflow-y-auto p-3",children:b("div",{className:"grid gap-4",children:[G("label",{className:"grid gap-1.5 text-xs font-medium text-foreground",children:G(c4,{"aria-label":z("multitrack.subtitleText"),className:"min-h-20 resize-none bg-card text-xs",value:$,onChange:(w)=>Q(w.currentTarget.value)})}),b("div",{className:"grid grid-cols-[3rem_minmax(0,1fr)] items-center gap-3",children:[G("span",{className:"text-[11px] font-medium text-foreground",children:z("multitrack.fontSize")}),b("div",{className:"flex min-w-0 items-center gap-2",children:[G("div",{className:"flex-1 w-full",children:G(N8,{"aria-label":z("multitrack.fontSize"),value:[J.font_size],min:8,max:66,step:1,onValueChange:(w)=>Z({font_size:w[0]??J.font_size})})}),G(e8,{"aria-label":z("multitrack.fontSize"),className:"h-7 w-16 shrink-0",min:8,max:96,step:1,value:J.font_size,onChange:(w)=>Z({font_size:w})})]})]}),b("div",{className:"grid grid-cols-[3rem_minmax(0,1fr)] items-center gap-3",children:[G("span",{className:"text-[11px] font-medium text-foreground",children:z("multitrack.backgroundOpacity")}),b("div",{className:"flex min-w-0 items-center gap-2",children:[G("div",{className:"flex-1 w-full",children:G(N8,{"aria-label":z("multitrack.backgroundOpacity"),value:[N],min:0,max:100,step:1,disabled:O,onValueChange:(w)=>Z({background_opacity:qX(w[0]??N)})})}),G(e8,{"aria-label":z("multitrack.backgroundOpacityPercent"),className:"h-7 w-16 shrink-0",min:0,max:100,step:1,disabled:O,value:N,onChange:(w)=>Z({background_opacity:qX(w)})})]})]}),b("div",{className:"grid grid-cols-[3rem_minmax(0,1fr)] items-center gap-3",children:[G("span",{className:"text-[11px] font-medium text-foreground",children:z("multitrack.textColor")}),G(MF,{value:US(J.color,"#ffffff"),defaultFormat:"hex",triggerAriaLabel:z("multitrack.textColor"),triggerClassName:"w-full justify-start h-6 text-[10px]",side:"left",align:"start",sideOffset:10,onValueChange:(w)=>Z({color:w})})]}),b("div",{className:"grid gap-2",children:[G("span",{className:"text-[11px] font-medium text-foreground",children:z("multitrack.presetStyle")}),G("div",{className:"grid grid-cols-7 gap-1.5",children:Vt.map((w)=>{let C=Mt(J,w);return G(k0,{type:"button",variant:"ghost","aria-pressed":C,className:b0("flex aspect-square h-auto min-h-0 w-full items-center justify-center rounded-md border bg-muted p-0 text-base font-bold transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",C?"border-primary ring-2 ring-primary":"border-border"),"aria-label":z("multitrack.applyPresetStyle",{name:w.label}),onClick:()=>Z(w.style),children:w.id==="no-outline"?G(HS,{className:"h-4 w-4 text-muted-foreground"}):G("span",{className:"rounded px-1 leading-none",style:{color:w.style.color,backgroundColor:w.style.background_color,textShadow:`1px 0 0 ${w.style.outline_color}, -1px 0 0 ${w.style.outline_color}, 0 1px 0 ${w.style.outline_color}, 0 -1px 0 ${w.style.outline_color}`},children:"T"})},w.id)})})]}),b("div",{className:"grid grid-cols-[3rem_repeat(3,minmax(0,1fr))] items-center gap-2",children:[b("span",{className:"text-[11px] font-medium text-foreground",children:[z("multitrack.position"),"%"]}),b("label",{className:"flex min-w-0 items-center gap-1",children:[G("span",{className:"text-[10px] font-medium text-muted-foreground",children:z("multitrack.positionX")}),G(e8,{"aria-label":z("multitrack.positionXPercent"),className:"h-7 min-w-0 flex-1",min:0,max:100,step:1,value:IW(J.x),onChange:(w)=>Z({x:qX(w)})})]}),b("label",{className:"flex min-w-0 items-center gap-1",children:[G("span",{className:"text-[10px] font-medium text-muted-foreground",children:z("multitrack.positionY")}),G(e8,{"aria-label":z("multitrack.positionYPercent"),className:"h-7 min-w-0 flex-1",min:0,max:95,step:1,value:IW(J.y),onChange:(w)=>Z({y:Math.min(0.95,qX(w))})})]}),b("label",{className:"flex min-w-0 items-center gap-1",children:[G("span",{className:"text-[10px] font-medium text-muted-foreground",children:z("multitrack.subtitleWidthShort")}),G(e8,{"aria-label":z("multitrack.subtitleWidthPercent"),className:"h-7 min-w-0 flex-1",min:10,max:100,step:1,value:IW(J.width),onChange:(w)=>Z({width:Math.max(0.1,qX(w))})})]})]})]})}),b(E9,{value:"speech",className:"mt-0 flex min-h-0 flex-1 flex-col overflow-hidden p-0",children:[G("div",{className:"min-h-0 flex-1 overflow-y-auto p-3 pb-4",children:b("div",{className:"grid gap-4",children:[b("div",{className:"grid grid-cols-[4.25rem_minmax(0,1fr)] items-center gap-3",children:[G("span",{className:"text-[11px] font-medium text-foreground",children:z("multitrack.speechModel")}),b(E8,{value:H.model,onValueChange:(w)=>k({model:w}),children:[G(y8,{"aria-label":z("multitrack.speechModel"),className:"h-8 w-full bg-card text-xs",children:G(W6,{})}),G(P8,{children:G(l5,{value:"VoxCPM2",children:"VoxCPM2"})})]})]}),G("label",{className:"grid gap-1.5",children:G(c4,{"aria-label":z("multitrack.speechPrompt"),className:"min-h-20 resize-none bg-card text-xs",value:H.prompt,placeholder:z("multitrack.speechPromptPlaceholder"),onChange:(w)=>k({prompt:w.currentTarget.value})})}),b("div",{className:"grid grid-cols-[4.25rem_minmax(0,1fr)] items-center gap-3",children:[G("span",{className:"text-[11px] font-medium text-foreground",children:z("multitrack.speechCfg")}),b("div",{className:"flex min-w-0 items-center gap-2",children:[G("div",{className:"flex-1 w-full",children:G(N8,{"aria-label":z("multitrack.speechCfg"),value:[H.cfg],min:0.1,max:5,step:0.1,onValueChange:(w)=>k({cfg:WS(w[0]??H.cfg)})})}),G(e8,{"aria-label":z("multitrack.speechCfg"),className:"h-7 w-16 shrink-0",min:0.1,max:5,step:0.1,value:H.cfg,formatValue:(w)=>w.toFixed(1),onChange:(w)=>k({cfg:WS(w)})})]})]}),b("div",{className:"grid grid-cols-[4.25rem_minmax(0,1fr)] items-center gap-3",children:[G("span",{className:"text-[11px] font-medium text-foreground",children:z("multitrack.speechSteps")}),b("div",{className:"flex min-w-0 items-center gap-2",children:[G("div",{className:"flex-1 w-full",children:G(N8,{"aria-label":z("multitrack.speechSteps"),value:[H.steps],min:1,max:50,step:1,onValueChange:(w)=>k({steps:w[0]??H.steps})})}),G(e8,{"aria-label":z("multitrack.speechSteps"),className:"h-7 w-16 shrink-0",min:1,max:50,step:1,value:H.steps,onChange:(w)=>k({steps:w})})]})]}),b("div",{className:"grid grid-cols-[4.25rem_minmax(0,1fr)] items-start gap-3",children:[G("span",{className:"pt-1.5 text-[11px] font-medium text-foreground",children:z("multitrack.referenceAudio")}),G("div",{className:"min-w-0",children:H.referenceAudio?b("div",{className:"flex min-w-0 items-center gap-1",children:[b(a1,{open:B,onOpenChange:U,children:[G(T5,{asChild:!0,children:b(k0,{type:"button",variant:"secondary",className:"h-8 min-w-0 flex-1 cursor-pointer justify-start bg-card px-1 text-xs","aria-label":z("multitrack.reselectReferenceAudio"),children:[G(UJ,{className:"h-3.5 w-3.5 shrink-0 text-highlight"}),G("span",{className:"truncate",children:H.referenceAudio})]})}),G(s1,{className:"w-auto p-0",align:"end",children:G(V5,{value:H.referenceAudio,mediaType:"audio",defaultTab:"inputs",onChange:(w,C)=>{k({referenceAudio:w,referenceAudioSourceType:C??"input"}),U(!1)}})})]}),I?G(k0,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0 cursor-pointer","aria-label":z(_?"multitrack.pauseReferenceAudio":"multitrack.playReferenceAudio"),onClick:()=>void A(),children:_?G(M7,{className:"h-3.5 w-3.5"}):G(E4,{className:"h-3.5 w-3.5"})}):null,G(k0,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0 cursor-pointer text-destructive","aria-label":z("multitrack.clearReferenceAudio"),onClick:()=>k({referenceAudio:""}),children:G(M5,{className:"h-3.5 w-3.5"})})]}):b(a1,{open:B,onOpenChange:U,children:[G(T5,{asChild:!0,children:b(k0,{type:"button",variant:"secondary",className:"h-8 w-full cursor-pointer justify-start bg-card text-xs",children:[G(z5,{className:"h-3.5 w-3.5"}),z("multitrack.addReferenceAudio")]})}),G(s1,{className:"w-auto p-0",align:"end",children:G(V5,{value:"",mediaType:"audio",defaultTab:"inputs",onChange:(w,C)=>{k({referenceAudio:w,referenceAudioSourceType:C??"input"}),U(!1)}})})]})})]})]})}),G("div",{className:"sticky bottom-0 flex shrink-0 justify-end border-t border-border bg-muted/80 p-2 backdrop-blur",children:b(k0,{type:"button",disabled:!Y||V,className:"h-7 cursor-pointer bg-highlight px-3 text-[11px] text-background shadow hover:bg-highlight/90",onClick:T,children:[V?G(X6,{className:"h-3 w-3 animate-spin"}):G(DF,{className:"h-3 w-3"}),z("multitrack.speech")]})})]})]})]})}var Nt="calc(max(35%, 18rem) + 12px)";function Ot($,J,Q){let Z=$.findIndex((z)=>z.id===J),q=$.findIndex((z)=>z.id===Q);if(Z<0||q<0||Z===q)return $;let X=[...$],[Y]=X.splice(Z,1);return X.splice(q,0,Y),X}function At($,J){let Q=yW($,J);for(let Z of $.tracks){if(Z.type!=="task")continue;let q=Z.segments.findIndex((K)=>Q>=K.start_frame&&Q{let W=Q5({source_type:K.source_type??"input",file_path:K.file_path,local_path:K.local_path,url:K.url,slot_name:K.slot_name});return{image:K,url:W??void 0}});return{index:q,segmentId:X.id,allImages:Y,images:z}}return null}function wt($,J){let Q=yW($,J);for(let Z of $.tracks){if(Z.type!=="task")continue;let q=Z.segments.findIndex((z)=>Q>=z.start_frame&&Q{if(Z.type!=="subtitle"||Z.visible===!1)return[];return Z.segments.filter((q)=>Q>=q.start_frame&&QI(null)),[T,A]=w5.useState(null),[w,C]=w5.useState("balanced"),[y,x]=w5.useState(!1),[j,P]=w5.useState(!1),[h,l]=w5.useState(null),[t,S]=w5.useState(null),[i,J0]=w5.useState(null),K0=sY(X),e=w5.useMemo(()=>Y9(X,Y,"image"),[X,Y,y]),H0=w5.useMemo(()=>$.tracks.filter((Y0)=>Y0.type==="video").flatMap((Y0)=>Y0.segments),[$.tracks]),q0=w5.useMemo(()=>$.tracks.some((Y0)=>Y0.segments.length>0),[$.tracks]),E=w5.useMemo(()=>{let Y0=H0.find((C0)=>C0.content.media_type==="video");if(!Y0)return null;return Q5({source_type:Y0.content.source_type??"input",file_path:Y0.content.file_path,local_path:Y0.content.local_path,url:Y0.content.url,slot_name:Y0.content.slot_name})},[H0]),d=Q?.trackType==="audio"?null:Q,c=d?.trackType==="task"?null:MS($,J,d?.trackType==="video"?d.segment.id:null),r=DS($,J,d),u=d===null?At($,J):null,m=d===null?wt($,J):null,s=w5.useMemo(()=>{if(d?.trackType==="task")return[];let Y0=kt($,J);if(d?.trackType!=="subtitle")return Y0;let C0=d.segment,x0=Y0.findIndex((r0)=>r0.id===C0.id);if(x0<0)return[...Y0,C0];return Y0.map((r0,E0)=>E0===x0?C0:r0)},[J,$,d]),f=NS(K0,i),o=Q?.trackType==="video"||Q?.trackType==="audio"?m2(vJ(Q.segment),$.frame_rate):null,G0=Q?.trackType==="subtitle"?TW({...R2,...Q.segment.content.subtitle_style}):null,p=Q?.trackType==="subtitle"?{...IZ,...Q.segment.content.subtitle_speech}:IZ,Z0=Q?.trackType==="task"?Q.segment.content.images??[]:[],Q0=O?.source==="selected"?Z0.find((Y0)=>Y0.id===O.imageId)??null:O?.source==="active"?u?.allImages.find((Y0)=>Y0.id===O.imageId)??null:null,B0=u?.images.find(({image:Y0})=>Y0.id===T)??u?.images[0]??null,W0=Boolean(u&&!c),L0=w==="image-large"?"w-32 flex-[0_0_8rem]":"w-20 flex-[0_0_5rem]",_0=w==="image-large"?"h-full flex-none":"h-full flex-none",N0=G0?"mx-auto flex h-full min-h-24 w-full max-w-full items-stretch justify-center gap-0":W0?"mx-auto flex h-full min-h-24 w-full max-w-full items-center justify-center gap-3":"mx-auto flex h-full min-h-24 w-fit max-w-full items-center justify-center gap-3";w5.useEffect(()=>{I(null)},[Q?.segment.id]),w5.useEffect(()=>{if(!z)return;let Y0=s.find((C0)=>C0.id===z);if(!Y0)return;S({segmentId:Y0.id,text:Y0.content.text??""}),K?.()},[s,z,K]),w5.useEffect(()=>{if(!u){A(null);return}if(u.images.some(({image:Y0})=>Y0.id===T))return;A(u.images[0]?.image.id??null)},[u,T]),w5.useEffect(()=>{if(!m){l(null);return}let Y0=m.content.user_prompt_variant==="b"?"b":"a";if(h?.segmentId===m.segmentId&&h.variant===Y0)return;l(null)},[m,h?.segmentId,h?.variant]),w5.useEffect(()=>{if(O?.source==="active"&&O.segmentId!==u?.segmentId)I(null)},[O,u?.segmentId]),w5.useEffect(()=>{if(!E){J0(null);return}let Y0=!1;return TZ(E).then((C0)=>{if(!Y0)J0({width:C0.width,height:C0.height})}).catch((C0)=>{if(console.error("[PreviewArea] failed to read first video metadata:",C0),!Y0)J0(null)}),()=>{Y0=!0}},[E]);function d0(Y0){if(!u)return;let C0=N.current;if(N.current=null,!C0)return;L?.([{segmentId:u.segmentId,patch:{images:Ot(u.allImages,C0,Y0)}}])}function g(Y0){if(!u)return;let C0=u.allImages.find((x0)=>x0.id===Y0);if(C0?.shared_reference===!0){let x0=U&&U.length>0?U:$.tracks.filter((E0)=>E0.type==="task").flatMap((E0)=>E0.segments),r0=k7(C0);L?.(I7(x0,C0,!1).map((E0)=>({segmentId:E0.segmentId,patch:{images:E0.segmentId===u.segmentId?E0.images.filter((F1)=>k7(F1)!==r0):E0.images}})));return}L?.([{segmentId:u.segmentId,patch:{images:u.allImages.filter((x0)=>x0.id!==Y0)}}])}function a(Y0,C0){let x0=U&&U.length>0?U:u?$.tracks.filter((r0)=>r0.type==="task").flatMap((r0)=>r0.segments):[];if(x0.length===0||C0&&!SJ(x0,Y0))return;L?.(I7(x0,Y0,C0).map((r0)=>({segmentId:r0.segmentId,patch:{images:r0.images}})))}function I0(Y0,C0){if(!u)return;L?.([{segmentId:u.segmentId,patch:{images:u.allImages.map((x0)=>x0.id===Y0?{...x0,muted:C0}:x0)}}])}function w0(Y0){if(Array.from(Y0.files).some((x0)=>x0.type.startsWith("image/")))return!0;return Array.from(Y0.items??[]).some((x0)=>x0.kind==="file"&&x0.type.startsWith("image/"))}function F0(Y0){if(!Y0.dataTransfer||!w0(Y0.dataTransfer))return;Y0.preventDefault(),P(!0)}function u0(Y0){if(!Y0.dataTransfer||!w0(Y0.dataTransfer))return;Y0.preventDefault(),P(!0)}function P0(Y0){let C0=Y0.relatedTarget;if(C0 instanceof Node&&Y0.currentTarget.contains(C0))return;P(!1)}async function n0(Y0){if(Y0.preventDefault(),P(!1),!Y0.dataTransfer||!u)return;let C0=Z4-u.allImages.length;if(C0<=0)return;let x0=Array.from(Y0.dataTransfer.files).filter((F1)=>F1.type.startsWith("image/")).slice(0,C0);if(x0.length===0)return;let E0=(await Promise.allSettled(x0.map((F1)=>b7(F1)))).flatMap((F1)=>{if(F1.status==="fulfilled")return[F1.value];return console.error("[PreviewArea] failed to upload active task image:",F1.reason),[]});if(E0.length===0)return;R5("inputs"),L?.([{segmentId:u.segmentId,patch:{images:[...u.allImages,...E0]}}])}function R0(Y0,C0){if(!u)return;let x0=Z4-u.allImages.length;if(x0<=0)return;let r0=fJ(Y0).slice(0,x0),E0=C0??(Y0.startsWith("http://")||Y0.startsWith("https://")?"url":"input"),F1=r0.map((r1)=>xJ(r1,E0));if(F1.length===0)return;L?.([{segmentId:u.segmentId,patch:{images:[...u.allImages,...F1]}}]),x(!1)}function Z1(Y0){if(!h||!m)return;l({...h,text:Y0}),L?.([{segmentId:h.segmentId,patch:hZ(m.content,Y0)}])}function K1(){l(null)}function a0(Y0,C0){L?.([{segmentId:Y0,patch:{task_mode:C0}}])}function T1(Y0,C0){L?.([{segmentId:Y0,patch:{continuity_mode:C0}}])}function v1(Y0,C0){L?.([{segmentId:Y0,patch:{ref_image_size:C0}}])}function E1(){if(!t)return;if(Q?.trackType==="subtitle"&&Q.segment.id===t.segmentId)B({text:t.text});else L?.([{segmentId:t.segmentId,patch:{text:t.text}}]);S(null)}function n(Y0,C0,x0,r0,E0){if(!C0)return G("div",{"data-testid":`task-preview-slot-image-${Y0.id}`,className:`${E0} flex items-center justify-center bg-muted/30 px-2 text-center text-[9px] text-muted-foreground`,children:Y0.source_type==="slot"?D("mediaSelector.slotImage",{n:Dz(Y0,r0)}):x0});return Y0.panorama_view?G(Yz,{imageId:Y0.id,imageUrl:C0,alt:x0,view:Y0.panorama_view,className:E0}):G("img",{className:E0,src:C0,alt:x0,draggable:!1})}function D0(Y0="h-10 w-10 aspect-square",C0=!1){if(!u||u.allImages.length>=Z4)return null;return b(a1,{open:y,onOpenChange:x,children:[G(T5,{asChild:!0,children:b(k0,{type:"button",variant:"outline","data-testid":u.images.length===0?"task-preview-empty-add-image":"task-preview-add-image",className:`cursor-pointer shrink-0 border-dashed bg-background/70 text-muted-foreground transition-colors hover:bg-background/90 ${j?"border-primary bg-accent/20 text-foreground":"border-border"} ${C0?"flex-col gap-1":""} ${Y0}`,"aria-label":D("multitrack.addImage"),onClick:(x0)=>{x0.stopPropagation(),x(!0)},onDragEnter:F0,onDragOver:u0,onDragLeave:P0,onDrop:n0,children:[G(z5,{className:"h-5 w-5"}),C0?G("span",{className:"text-[10px] font-semibold",children:D("multitrack.addImage")}):null]})}),G(s1,{className:"w-auto p-0",align:"end",children:G(V5,{value:"",mediaType:"image",allowMultipleSelection:!0,maxSelectionCount:Z4-u.allImages.length,slotItems:e,onChange:R0})})]})}function O0(Y0,C0,x0,r0,E0="aspect-square w-full",F1=!0,r1="thumbnail"){if(!u)return null;let y1=Y0.file_name??Y0.file_path??Y0.local_path??Y0.url??Y0.slot_name??Y0.id,t1=Y0.shared_reference?Y0.muted===!0?"border-highlight opacity-50":"border-highlight":r0?"border-primary":"border-border";return b("div",{"data-testid":`task-preview-image-${Y0.id}`,className:`group/task-image relative shrink-0 cursor-pointer overflow-hidden rounded-sm border bg-black ${t1} ${E0}`,draggable:!0,onDragStart:()=>{N.current=Y0.id},onDragEnd:()=>{N.current=null},onDragOver:(L5)=>L5.preventDefault(),onDrop:()=>d0(Y0.id),children:[G(k0,{type:"button",variant:"ghost",className:r1==="flow"&&C0?"h-full w-auto max-w-full rounded-none p-0 hover:bg-transparent":"h-full w-full rounded-none p-0 hover:bg-transparent","aria-label":y1,onClick:()=>A(Y0.id),children:n(Y0,C0,y1,x0,r1==="flow"&&C0?`h-full w-auto max-w-full object-contain transition-opacity ${Y0.muted===!0?"opacity-40":""}`:`h-full w-full object-contain transition-opacity ${Y0.muted===!0?"opacity-40":""}`)}),F1?i0(Y0,y1,r1==="flow"?"flow":"split",Boolean(C0)):null]},Y0.id)}function v0(Y0){let C0=Q?.segment.id===Y0.id&&Q.trackType==="subtitle",x0=TW({...R2,...Y0.content.subtitle_style}),r0=t?.segmentId===Y0.id?t:null,E0=It(x0.background_color,x0.background_opacity),F1=!OS(E0),r1=(z0)=>{if(!C0)return;B({subtitle_style:TW({...x0,...z0})})};function y1(z0){if(r0){z0.stopPropagation();return}if(z0.preventDefault(),z0.stopPropagation(),!C0){W?.(Y0.id);return}let A0=z0.currentTarget.closest("[data-multitrack-preview-area]")?.getBoundingClientRect();if(!A0)return;let{width:f0,height:$1}=A0,$0=z0.clientX,S0=z0.clientY,c0=x0;function Q1(d1){r1({x:c0.x+(d1.clientX-$0)/f0,y:c0.y+(d1.clientY-S0)/$1})}function D1(){globalThis.removeEventListener("mousemove",Q1),globalThis.removeEventListener("mouseup",D1)}globalThis.addEventListener("mousemove",Q1),globalThis.addEventListener("mouseup",D1)}function t1(z0){z0.preventDefault(),z0.stopPropagation(),W?.(Y0.id),S({segmentId:Y0.id,text:Y0.content.text??""})}function L5(z0,A0){if(!C0)return;A0.preventDefault(),A0.stopPropagation();let f0=A0.currentTarget.closest("[data-multitrack-preview-area]")?.getBoundingClientRect();if(!f0)return;let $1=f0.width,$0=A0.clientX,S0=x0;function c0(D1){let d1=(D1.clientX-$0)/$1;if(z0==="left"){let A1=S0.x+d1;r1({x:A1,width:S0.width-d1});return}r1({width:S0.width+d1})}function Q1(){globalThis.removeEventListener("mousemove",c0),globalThis.removeEventListener("mouseup",Q1)}globalThis.addEventListener("mousemove",c0),globalThis.addEventListener("mouseup",Q1)}return b("div",{"data-testid":"subtitle-preview-overlay",className:`absolute z-10 text-center leading-snug ${C0?"ring-1 ring-primary cursor-move":"cursor-pointer"}`,style:{left:`${(x0.x+x0.width/2)*100}%`,top:`${x0.y*100}%`,width:"max-content",maxWidth:`${x0.width*100}%`,transform:"translateX(-50%)",color:x0.color,fontSize:x0.font_size,textShadow:LS(x0.outline_color||"#000000")},onMouseDown:y1,onDoubleClick:t1,children:[r0?G($6,{"data-testid":"subtitle-preview-editor",autoFocus:!0,"aria-label":D("multitrack.editSubtitle"),value:r0.text,className:`inline-block h-auto max-w-full rounded-sm border-primary px-3 py-1.5 text-center leading-snug text-inherit shadow-none focus-visible:ring-1 ${F1?"shadow-sm":""}`,style:{width:`${Math.max(r0.text.length+2,5)}em`,backgroundColor:E0,color:x0.color,fontSize:x0.font_size,textShadow:LS(x0.outline_color||"#000000")},onMouseDown:(z0)=>z0.stopPropagation(),onClick:(z0)=>z0.stopPropagation(),onDoubleClick:(z0)=>z0.stopPropagation(),onChange:(z0)=>S({...r0,text:z0.currentTarget.value}),onBlur:E1,onKeyDown:(z0)=>{if(z0.key==="Enter")z0.preventDefault(),E1();if(z0.key==="Escape")z0.preventDefault(),S(null)}}):G("span",{"data-testid":"subtitle-preview-text",className:`inline-block max-w-full whitespace-pre-wrap break-words rounded-sm px-2 py-1 ${F1?"shadow-sm":""}`,style:{backgroundColor:E0},children:Y0.content.text}),C0?b(W1,{children:[G("span",{className:"absolute left-0 top-0 h-full w-1 cursor-ew-resize bg-primary",onMouseDown:(z0)=>L5("left",z0)}),G("span",{className:"absolute right-0 top-0 h-full w-1 cursor-ew-resize bg-primary",onMouseDown:(z0)=>L5("right",z0)})]}):null]})}function i0(Y0,C0,x0,r0=!0){if(!u)return null;let E0=x0==="flow"?"absolute right-0 top-1 flex gap-1 opacity-0 transition-opacity group-hover/task-image:opacity-100 group-focus-within/task-image:opacity-100":"absolute right-0 top-0 flex gap-0.5 opacity-0 transition-opacity group-hover/task-image:opacity-100 group-focus-within/task-image:opacity-100",F1="h-auto w-auto",r1="[&_svg]:!size-4",y1=Y0.shared_reference?16:18,t1=U&&U.length>0?U:$.tracks.filter((z0)=>z0.type==="task").flatMap((z0)=>z0.segments),L5=Y0.shared_reference===!0||SJ(t1,Y0);return b("div",{className:E0,children:[G(n1,{children:b(B1,{children:[G(U1,{asChild:!0,children:G(k0,{type:"button",size:"icon",variant:Y0.shared_reference===!0?"secondary":"ghost",className:`${F1} cursor-pointer rounded-none bg-background/70 hover:bg-background/90 ${r1} ${Y0.shared_reference===!0?"text-highlight":"text-muted-foreground"}`,style:{width:y1,height:y1},"aria-label":Y0.shared_reference===!0?D("multitrack.disableSharedReference"):D("multitrack.enableSharedReference"),"aria-pressed":Y0.shared_reference===!0,disabled:!L5,onClick:(z0)=>{z0.stopPropagation(),a(Y0,Y0.shared_reference!==!0)},children:G(hJ,{})})}),G(H1,{side:"bottom",className:"max-w-64",children:L5?D("multitrack.sharedImageReferenceTooltip"):D("multitrack.sharedImageLimitTooltip")})]})}),G(n1,{children:b(B1,{children:[G(U1,{asChild:!0,children:G(k0,{type:"button",size:"icon",variant:Y0.muted===!0?"secondary":"ghost","data-testid":`task-preview-image-muted-${Y0.id}`,className:`${F1} cursor-pointer bg-background/70 text-[14px] font-bold hover:bg-background/90 ${Y0.muted===!0?"text-destructive hover:text-destructive":"text-muted-foreground"}`,style:{width:y1,height:y1},"aria-label":Y0.muted===!0?D("multitrack.includeImage"):D("multitrack.bypassImage"),"aria-pressed":Y0.muted===!0,onClick:(z0)=>{z0.stopPropagation(),I0(Y0.id,Y0.muted!==!0)},children:"M"})}),G(H1,{side:"bottom",children:Y0.muted===!0?D("multitrack.includeImageTooltip"):D("multitrack.bypassImageTooltip")})]})}),G(n1,{children:b(B1,{children:[G(U1,{asChild:!0,children:G(k0,{type:"button",size:"icon",variant:"ghost",className:`${F1} cursor-pointer bg-background/70 font-bold text-muted-foreground hover:bg-background/90 ${r1}`,style:{width:y1,height:y1},"aria-label":D("multitrack.previewImage"),disabled:!r0,onClick:(z0)=>{z0.stopPropagation(),I({imageId:Y0.id,segmentId:u.segmentId,source:"active"})},children:G(T7,{})})}),G(H1,{side:"bottom",children:D("multitrack.previewImage")})]})}),G(n1,{children:b(B1,{children:[G(U1,{asChild:!0,children:G(k0,{type:"button",size:"icon",variant:"ghost",className:`${F1} cursor-pointer rounded-none bg-background/70 text-destructive hover:bg-background/90 hover:text-destructive ${r1}`,style:{width:y1,height:y1},"aria-label":`${D("multitrack.deleteImage")} ${C0}`,onClick:(z0)=>{z0.stopPropagation(),g(Y0.id)},children:G(o9,{})})}),G(H1,{side:"bottom",children:D("multitrack.deleteImage")})]})})]})}function G1(){if(!m)return null;let Y0=h?.segmentId===m.segmentId?h:null,x0=(Y0?.text??m.prompt).trim().length>0,r0=w==="image-large"?D("multitrack.previewLayoutBalanced"):D("multitrack.previewLayoutImageLarge");return b("div",{"data-testid":"task-prompt-overlay",className:`flex w-full editing ${Y0?"items-end":"items-center"} bg-background/70 px-2 text-primary-foreground`,children:[!W0?G(n1,{children:b(B1,{children:[G(U1,{asChild:!0,children:G(k0,{type:"button",size:"icon",variant:"ghost",className:"h-6 w-6 shrink-0 cursor-pointer rounded-none text-primary [&_svg]:!size-3","aria-label":r0,onClick:(E0)=>{E0.stopPropagation(),C((F1)=>F1==="balanced"?"image-large":"balanced")},children:w==="image-large"?G(VS,{}):G(FS,{})})}),G(H1,{side:"top",children:r0})]})}):null,Y0?G(c4,{"data-testid":"task-prompt-editor",autoFocus:!0,"aria-label":D("multitrack.userPrompt"),placeholder:D("multitrack.promptPlaceholder"),className:"min-h-24 flex-1 resize-none border-none bg-transparent px-1 py-0 text-[9px] leading-4 text-primary shadow-none focus-visible:ring-0",value:Y0.text,onMouseDown:(E0)=>E0.stopPropagation(),onClick:(E0)=>E0.stopPropagation(),onDoubleClick:(E0)=>E0.stopPropagation(),onChange:(E0)=>Z1(E0.currentTarget.value),onBlur:K1,onKeyDown:(E0)=>{if(E0.key==="Escape")E0.preventDefault(),l(null);if((E0.metaKey||E0.ctrlKey)&&E0.key==="Enter")E0.preventDefault(),K1()}}):G("div",{"data-testid":"task-prompt-text",className:`min-w-0 flex-1 truncate px-1 text-[9px] leading-4 ${x0?"text-primary":"text-muted-foreground"}`,title:x0?m.prompt:D("multitrack.promptPlaceholder"),onDoubleClick:(E0)=>{E0.preventDefault(),E0.stopPropagation(),l({segmentId:m.segmentId,variant:m.content.user_prompt_variant==="b"?"b":"a",text:m.prompt})},children:x0?m.prompt:D("multitrack.promptPlaceholder")}),G("span",{className:"shrink-0 px-1 text-[9px] leading-4 text-secondary",children:"|"}),K0.format==="MiniMax"&&m.index>0&&b(W1,{children:[b(E8,{value:m.content.continuity_mode??CZ,disabled:!L,onValueChange:(E0)=>T1(m.segmentId,E0),children:[G(n1,{delayDuration:300,children:b(B1,{children:[G(U1,{asChild:!0,children:G(y8,{"data-testid":"task-continuity-mode-select","aria-label":D("multitrack.continuityMode"),className:"h-5 min-h-0 w-24 shrink-0 cursor-pointer border-none bg-transparent px-1 text-[9px] leading-4 text-primary shadow-none focus-visible:ring-1 focus-visible:ring-ring [&_svg]:size-3",onClick:(E0)=>E0.stopPropagation(),onDoubleClick:(E0)=>E0.stopPropagation(),children:G(W6,{})})}),G(H1,{side:"top",children:D("multitrack.continuityModeTooltip")})]})}),G(P8,{children:Oz.map((E0)=>G(l5,{value:E0,children:G("span",{className:"text-[10px]",children:D(`multitrackContinuityModes.${E0}`)})},E0))})]}),G("span",{className:"shrink-0 px-1 text-[9px] leading-4 text-secondary",children:"|"})]}),K0.format==="MiniMax"&&["ref","edit"].includes(m.taskMode)&&b(W1,{children:[b(E8,{value:m.content.ref_image_size??wz,disabled:!L,onValueChange:(E0)=>v1(m.segmentId,E0),children:[G(n1,{delayDuration:300,children:b(B1,{children:[G(U1,{asChild:!0,children:G(y8,{"data-testid":"task-ref-image-size-select","aria-label":D("multitrack.refImageSize"),className:"h-5 min-h-0 w-16 shrink-0 cursor-pointer border-none bg-transparent px-1 text-[9px] leading-4 text-primary shadow-none focus-visible:ring-1 focus-visible:ring-ring [&_svg]:size-3",onClick:(E0)=>E0.stopPropagation(),onDoubleClick:(E0)=>E0.stopPropagation(),children:G(W6,{})})}),G(H1,{side:"top",children:D("multitrack.refImageSizeTooltip")})]})}),G(P8,{children:Az.map((E0)=>G(l5,{value:E0,children:G("span",{className:"text-[10px]",children:D(`multitrackRefImageSizes.${E0}`)})},E0))})]}),G("span",{className:"shrink-0 px-1 text-[9px] leading-4 text-secondary",children:"|"})]}),b(E8,{value:m.taskMode,disabled:!L,onValueChange:(E0)=>a0(m.segmentId,E0),children:[G(n1,{delayDuration:300,children:b(B1,{children:[G(U1,{asChild:!0,children:G(y8,{"data-testid":"task-mode-select","aria-label":D("multitrack.taskMode"),className:"h-5 min-h-0 w-12 shrink-0 cursor-pointer border-none bg-transparent px-1 text-[9px] leading-4 text-primary shadow-none focus-visible:ring-1 focus-visible:ring-ring [&_svg]:size-3",onClick:(E0)=>E0.stopPropagation(),onDoubleClick:(E0)=>E0.stopPropagation(),children:G(W6,{})})}),G(H1,{side:"top",children:D("multitrack.taskModeTooltip")})]})}),G(P8,{children:Nz.map((E0)=>G(l5,{value:E0,children:G("span",{className:"text-[10px]",children:EW(E0,D)})},E0))})]})]})}function h1(){let Y0=[[jW,"multitrack.emptyTaskTrack","multitrack.emptyTaskTrackPurpose"],[Q4,"multitrack.emptyVideoTrack","multitrack.emptyVideoTrackPurpose"],[t9,"multitrack.emptyAudioTrack","multitrack.emptyAudioTrackPurpose"],[R$,"multitrack.emptySubtitleTrack","multitrack.emptySubtitleTrackPurpose"]],C0=[[wJ,"multitrack.emptyTaskMarkers","multitrack.emptyTaskMarkersPurpose"],[eY,"multitrack.emptyTaskOverview","multitrack.emptyTaskOverviewPurpose"]];return b("div",{"data-testid":"multitrack-empty-preview",className:"flex h-full w-full flex-col items-center justify-center px-6 py-5 text-center",children:[G(Q4,{className:"mb-2 h-9 w-9 text-muted-foreground","aria-hidden":"true"}),G("h3",{className:"text-sm font-semibold text-foreground",children:D("multitrack.emptyPreviewTitle")}),G("p",{className:"mt-1 text-xs text-muted-foreground",children:D("multitrack.emptyPreviewDescription")}),G("dl",{className:"mt-4 grid max-w-xl grid-cols-[auto_1fr] gap-x-3 gap-y-1.5 text-left text-[11px] leading-4",children:Y0.map(([x0,r0,E0])=>b("div",{className:"contents",children:[b("dt",{className:"flex items-center gap-1.5 font-medium text-foreground",children:[G(x0,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground","aria-hidden":"true"}),G("span",{children:D(r0)})]}),G("dd",{className:"text-muted-foreground",children:D(E0)})]},r0))}),G("div",{"data-testid":"multitrack-empty-preview-features",className:"mt-4 flex max-w-2xl items-start justify-center gap-5 border-t border-border pt-3 text-left",children:C0.map(([x0,r0,E0])=>b("div",{className:"flex max-w-xs items-start gap-2",children:[G(x0,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":"true"}),b("p",{className:"text-[11px] leading-4 text-muted-foreground",children:[G("span",{className:"font-medium text-foreground",children:D(r0)}),G("span",{className:"block",children:D(E0)})]})]},r0))})]})}function i1(Y0){let C0=Q5({source_type:Y0.source_type??"input",file_path:Y0.file_path,local_path:Y0.local_path,url:Y0.url,slot_name:Y0.slot_name});if(!C0)return null;let x0=Y0.file_name??Y0.file_path??Y0.local_path??Y0.url??Y0.id;return b("div",{"data-testid":"task-image-expanded-preview","data-zoom":k.zoom.toFixed(2),className:"absolute inset-0 z-30 flex items-center justify-center overflow-hidden bg-black p-3 pt-12",onWheel:k.onWheel,children:[b(k0,{type:"button",variant:"secondary",className:"absolute left-2 top-2 z-20 h-8 cursor-pointer gap-1.5 px-2.5 text-xs","aria-label":D("multitrack.backToPreview"),onClick:()=>I(null),children:[G(bW,{className:"h-4 w-4"}),G("span",{children:D("multitrack.backToPreview")})]}),b("span",{className:"pointer-events-none absolute right-2 top-2 z-20 rounded bg-background/70 px-2 py-1 text-[10px] tabular-nums text-foreground",children:[Math.round(k.zoom*100),"%"]}),G("img",{ref:k.imageRef,src:C0,alt:x0,className:"max-h-full max-w-full object-contain transition-transform duration-100 ease-out",style:{transform:`scale(${k.zoom})`,transformOrigin:`${k.origin.x}% ${k.origin.y}%`},draggable:!1})]})}if(Q?.trackType==="task")return G("div",{"data-multitrack-preview-area":!0,className:"relative flex min-h-24 w-full min-w-0 max-w-full flex-1 overflow-hidden rounded-sm bg-background",onClick:(Y0)=>Y0.stopPropagation(),children:Q0?i1(Q0):G(hT,{segment:Q.segment,node:X,app:Y,trackSegments:U,selectedSegments:_,videoSegments:H0,mediaTracks:$.tracks.filter((Y0)=>Y0.type==="audio"||Y0.type==="video"),frameRate:$.frame_rate,totalFrames:$.total_length,imageIndexOffset:K0.format==="MiniMax"?1:0,format:K0.format,onContentChange:B,onTrackSegmentsContentChange:L,onTrackSegmentsChange:F,onDurationChange:V,onOpenImagePreview:(Y0)=>I({imageId:Y0,segmentId:Q.segment.id,source:"selected"})})});return b("div",{"data-multitrack-preview-area":!0,className:"relative flex min-h-24 w-full min-w-0 max-w-full flex-1 items-center justify-center overflow-hidden rounded-sm text-xs text-muted-foreground bg-background",onClick:(Y0)=>Y0.stopPropagation(),children:[Q0&&O?.source==="active"?i1(Q0):null,Q===null&&f.mode==="megapixels"?b(kJ,{"data-testid":"multitrack-preview-resolution-badge",variant:"outline",className:"pointer-events-none absolute right-2 top-2 z-30 flex items-baseline gap-1.5 border-border bg-background/90 px-2 py-1 text-foreground shadow-sm backdrop-blur",children:[G("span",{className:"text-[9px] font-normal text-muted-foreground",children:D("multitrack.currentResolution")}),b("span",{className:"text-[11px] font-semibold tabular-nums",children:[f.width," × ",f.height]})]}):null,b("div",{className:"flex h-full min-h-24 w-full flex-col items-center justify-center gap-0.5",children:[!q0?h1():null,b("div",{className:!q0?"hidden":`min-w-0 ${N0}`,children:[W0&&u?b(W1,{children:[b("div",{"data-testid":"task-preview-images","data-layout":"flow",className:"flex h-full min-h-0 w-full flex-wrap content-center items-center justify-center gap-2 overflow-y-auto p-2",children:[u.images.map(({image:Y0,url:C0},x0)=>O0(Y0,C0,x0,Y0.id===B0?.image.id,Y0.source_type==="slot"&&!C0?"h-40 w-40 aspect-square":"h-40 w-fit max-w-full",!0,"flow")),D0("h-40 w-40 aspect-square",!0)]}),s.map((Y0)=>G("div",{children:v0(Y0)},Y0.id))]}):u&&b("div",{"data-testid":"task-preview-images",className:`flex max-h-full shrink-0 flex-col gap-2 overflow-hidden transition-all duration-300 ease-in-out ${L0}`,children:[G("div",{className:"shrink-0 text-center text-[10px] font-medium text-foreground pt-2",children:D("multitrack.previewTaskLabel",{n:u.index})}),b("div",{className:"flex min-h-0 flex-col gap-2 overflow-y-auto pb-2",children:[u.images.map(({image:Y0,url:C0},x0)=>{return O0(Y0,C0,x0,Y0.id===B0?.image.id)}),D0("aspect-square h-auto w-full")]})]}),!W0?G("div",{className:G0?"relative flex h-auto min-h-0 min-w-0 max-h-full flex-1 self-center flex-col items-center justify-center overflow-hidden":`min-w-0 transition-all duration-300 ease-in-out ${u?_0:"h-full flex-[1_1_100%]"}`,style:G0?{aspectRatio:`${f.width} / ${f.height}`}:void 0,children:G(vT,{activeVideo:c,resolution:f,isPlaying:Z,playbackNonce:q,muted:!0,volume:0,frameRate:$.frame_rate,className:G0?"absolute inset-0 h-full w-full":void 0,children:s.map((Y0)=>G("div",{children:v0(Y0)},Y0.id))})}):null,Q?.trackType==="subtitle"&&G0?G(_S,{text:Q.segment.content.text??"",style:G0,onTextChange:(Y0)=>B({text:Y0}),onStyleChange:(Y0)=>{B({subtitle_style:TW({...G0,...Y0})})},speechSettings:p,onSpeechSettingsChange:(Y0)=>B({subtitle_speech:Y0}),onGenerateSpeech:(Y0)=>M?.(Q.segment,Y0)??Promise.resolve()}):null]}),q0?G1():null]}),G(CI,{sources:r,isPlaying:Z,playbackNonce:q}),G(RI,{globalMuted:$.muted===!0,globalVolumeDb:$.volume_db??0,frameRate:$.frame_rate,selectedMediaVolumeDb:Q?.trackType==="video"||Q?.trackType==="audio"?Q.segment.content.volume_db??0:null,selectedMediaMuted:Q?.trackType==="video"||Q?.trackType==="audio"?Q.segment.content.muted===!0:!1,selectedMediaDuration:o,rightInset:G0?Nt:12,onGlobalSettingsChange:H,onSelectedSegmentContentChange:B,onSelectedSegmentDurationChange:V})]})}var RQ=R(v(),1);var wS=5;function IS({segment:$,frameRate:J,open:Q,onOpenChange:Z,onConfirm:q}){let X=X1(),[Y,z]=RQ.useState(wS),K=$?vJ($):0,W=Math.max(1,Math.round(J));RQ.useEffect(()=>{if(!Q||!$)return;z(wS)},[Q,$?.id]);let H=RQ.useMemo(()=>{return P9(Y,W)},[W,Y]),B=H>0&&H=1&&H=2,_=m2(K,W),L=Math.max(1,Math.floor(m2(Math.max(1,K-1),W)));function F(M){z(Math.max(1,Math.round(M)))}function V(M){if(M.preventDefault(),!$||!U)return;q($.id,H),Z(!1)}return G(DJ,{open:Q,onOpenChange:Z,children:b(b2,{className:"max-w-xs",children:[b(OZ,{children:[G(j2,{children:X("multitrack.splitTaskSegment")}),G(wZ,{children:X("multitrack.splitTaskSegmentDescription",{frames:K,seconds:_.toFixed(2)})})]}),b("form",{className:"space-y-4",onSubmit:V,children:[b("div",{className:"flex w-full items-center gap-2",children:[G(e8,{min:1,max:L,step:1,value:Y,className:"h-9 min-w-0 flex-1","aria-label":X("multitrack.splitTaskSegmentSeconds"),onChange:F}),G("span",{className:"flex h-9 shrink-0 items-center rounded-md border border-border bg-muted px-3 text-sm text-muted-foreground",children:X("multitrack.splitTaskSegmentSecondsUnit")})]}),G("p",{className:`text-xs leading-5 ${U?"text-muted-foreground":"text-destructive"}`,children:U?X("multitrack.splitTaskSegmentPreview",{count:B}):X("multitrack.splitTaskSegmentInvalid")}),b(AZ,{children:[G(k0,{type:"button",variant:"outline",onClick:()=>Z(!1),children:X("common.cancel")}),b(k0,{type:"submit",disabled:!U,children:[G(kS,{className:"h-4 w-4"}),X("multitrack.splitTaskSegmentConfirm")]})]})]})]})})}var I6=R(v(),1);var k6=R(v(),1);var Tt=8,bt=12,jt=8,Et=4;function yt($,J,Q){let Z=Math.max(J,1),q=$.start_frame/Z*Q,X=$.end_frame/Z*Q;return{left:q,width:Math.max(2,X-q)}}function Y2({trackType:$,segmentIndex:J,segment:Q,totalLength:Z,frameRate:q,areaWidth:X,canvasScale:Y,selected:z,onSelect:K,onDelete:W,onDistribute:H,onClone:B,onMerge:U,onSplitTask:_,onSmartSplit:L,onSmartSplitTasks:F,onRecognizeSubtitles:V,cutMode:M=!1,onCut:D,onResize:N,onResizePreview:O,onMove:I,onDragPreviewChange:k,getDragPreviewStart:T,onDragPreviewEnd:A,onDoubleClick:w,dimmed:C=!1,showTaskIndex:y=!0,taskOverview:x=!1,audioLocked:j=!1,audioLockEnabled:P=!1,onAudioLockToggle:h,sharedReference:l=!1,onSharedReferenceToggle:t}){let S=X1(),i=k6.useRef(!1),J0=k6.useRef(null),K0=k6.useRef(null),e=k6.useRef(!1),[H0,q0]=k6.useState(!1),[E,d]=k6.useState(!1),[c,r]=k6.useState(null),[u,m]=k6.useState(null),[s,f]=k6.useState(null),{left:o,width:G0}=yt(Q,Z,X),p=Q5({source_type:Q.content.source_type??"input",file_path:Q.content.file_path,local_path:Q.content.local_path,url:Q.content.url}),Z0=Math.max(0,Q.end_frame-Q.start_frame),Q0=Q.content.duration&&Q.content.duration>0?Q.content.duration*Math.max(q,1):null,B0=Q.origin_start_frame??Q.start_frame,W0=Q0?Math.max(0,Math.min(1,(Q.start_frame-B0)/Q0)):0,L0=Q0?Math.max(W0,Math.min(1,(Q.end_frame-B0)/Q0)):1,_0=Math.max(0,(Q.start_frame-B0)/Math.max(q,1)),N0=EW(Q.content.task_mode??"default",S),d0=$==="task"?y?S("multitrackSegment.taskLabel",{n:J+1,mode:N0}):N0:$==="subtitle"?Q.content.text??S("multitrack.subtitle"):Q.content.file_name??Q.id,g=M6(Z0,{frameRate:q,showFrames:!0}),a=Q.content.user_prompt?.trim()??"",I0=xZ(Q.content.images).flatMap((n)=>{let D0=Q5({source_type:n.source_type??"input",file_path:n.file_path,local_path:n.local_path,url:n.url,slot_name:n.slot_name});return D0?[D0]:[]}),w0=Array.from({length:24},(n,D0)=>I0.map((O0,v0)=>({key:`${D0}-${v0}`,url:O0}))).flat(),F0=J4($),u0=$==="video"?S("multitrack.cloneVideoSegment"):$==="audio"?S("multitrack.cloneAudioSegment"):S("multitrack.cloneTaskSegment"),P0=H0?"var(--warning)":z?F0.borderColor:F0.backgroundColorStrong,n0={left:c?0:o,top:c?c.y:void 0,bottom:c?void 0:void 0,width:c?c.width:G0,height:c?c.height:void 0,position:"absolute",transform:c?`translate3d(${c.x}px, 0, 0)`:void 0,backgroundColor:F0.backgroundColor,color:F0.textColor,border:`1px solid ${P0}`,"--multitrack-waveform":F0.waveformColor??void 0,cursor:M?"text":s??"grab",zIndex:E?9999:z?30:1,boxShadow:E?"0 8px 24px rgb(0 0 0 / 0.35)":void 0,pointerEvents:c?"none":void 0};function R0(n){if(J0.current=n,K0.current!==null)return;K0.current=requestAnimationFrame(()=>{if(K0.current=null,r(J0.current),J0.current)k?.(Q.id,J0.current.nextStartTime,J0.current.clientY)})}k6.useEffect(()=>{if(!F0.showThumbnail||!p){m(null);return}let n=!1,D0=null;return DI(p,_0).then((O0)=>{if(n){URL.revokeObjectURL(O0);return}D0=O0,m(O0)}).catch((O0)=>{if(console.error("[MultiTrackSegmentBlock] failed to capture video poster:",O0),!n)m(null)}),()=>{if(n=!0,D0)URL.revokeObjectURL(D0)}},[p,F0.showThumbnail,_0]),k6.useEffect(()=>{return()=>{if(K0.current!==null)cancelAnimationFrame(K0.current)}},[]);function Z1(){return z?bt:Tt}function K1(n){let D0=n/Math.max(G0,1);return Number.isFinite(D0)&&D0>0.01?D0:Math.max(Y,0.01)}function a0(n,D0,O0){return(n-D0)/O0/Math.max(X,1)*Math.max(Z,1)}function T1(){return Math.max(1,Math.round(jt/Math.max(X,1)*Math.max(Z,1)))}function v1(n){if(M)return;let D0=n.currentTarget.getBoundingClientRect(),O0=K1(D0.width),v0=(n.clientX-D0.left)/O0,i0=Z1();f(v0<=i0||v0>=D0.width/O0-i0?"ew-resize":"grab")}function E1(n){if(n.button!==0)return;if(n.preventDefault(),n.stopPropagation(),M)return;i.current=!1,e.current=!1,K(Q.id,n.metaKey||n.ctrlKey?"toggle":n.shiftKey||z?"add":"replace");let D0=n.currentTarget.getBoundingClientRect(),O0=K1(D0.width),v0=(n.clientX-D0.left)/O0,i0=D0.width/O0,G1=Z1(),h1=v0<=G1?"start":v0>=i0-G1?"end":null,i1=n.clientX,Y0=n.clientY;if(!h1){let S0=function(Q1){let D1=a0(Q1.clientX,i1,O0);if(Math.hypot(Q1.clientX-i1,Q1.clientY-Y0)0)i.current=!0;O(Q.id,C0,x0+t1,E0)}function r1(y1){let t1=a0(y1.clientX,r0,O0);if(i.current)N(Q.id,C0,x0+t1,E0);q0(!1),globalThis.removeEventListener("mousemove",F1),globalThis.removeEventListener("mouseup",r1)}globalThis.addEventListener("mousemove",F1),globalThis.addEventListener("mouseup",r1)}return G(W1,{children:b(o6,{children:[G(n6,{asChild:!0,children:b("div",{role:"button","data-multitrack-segment":"",tabIndex:0,className:`absolute top-1 bottom-1 flex items-center rounded select-none active:opacity-70 ${$==="audio"?"overflow-visible":"overflow-hidden"} ${C?"opacity-50":""}`,style:n0,onMouseDown:E1,onMouseMove:v1,onMouseLeave:()=>f(null),onClick:(n)=>{if(n.stopPropagation(),M&&D){let D0=n.currentTarget.getBoundingClientRect(),O0=D0.width/Math.max(Y,0.01),v0=(n.clientX-D0.left)/Math.max(Y,0.01),i0=Math.max(0,Math.min(1,v0/Math.max(O0,1))),G1=Math.round(Q.start_frame+i0*(Q.end_frame-Q.start_frame));D(Q.id,G1);return}if(!i.current)n.preventDefault()},onContextMenu:(n)=>{n.stopPropagation(),K(Q.id,z?"add":"replace")},onDoubleClick:(n)=>{if(n.preventDefault(),n.stopPropagation(),M)return;w?.(Q.id,n)},onKeyDown:(n)=>{if(n.key==="Enter")K(Q.id,n.metaKey||n.ctrlKey?"toggle":n.shiftKey?"add":"replace");if(n.key==="Delete"||n.key==="Backspace")W(Q.id)},children:[G("div",{className:"pointer-events-none relative flex h-full min-w-0 flex-1 flex-col gap-0.5 overflow-hidden rounded-sm",children:$==="task"&&x?b(W1,{children:[w0.length>0?G("div",{className:"absolute inset-0 overflow-hidden bg-black",children:G("div",{className:"flex h-full w-max",children:w0.map(({key:n,url:D0})=>G("img",{src:D0,alt:"",className:"h-full w-auto max-w-none shrink-0 object-contain",draggable:!1,onError:(O0)=>{O0.currentTarget.style.display="none"}},n))})}):null,G("div",{className:w0.length>0?"absolute inset-x-0 bottom-0 z-10 flex items-center bg-black px-1 py-0.5 text-white":"absolute inset-0 flex items-center justify-center px-1 text-center",children:G("span",{className:`min-w-0 text-[9px] leading-tight ${w0.length>0?"truncate":"line-clamp-3"}`,children:a||d0})})]}):b(W1,{children:[b("div",{className:`flex h-3.5 min-w-0 items-center gap-1 leading-none ${F0.textClassName}`,style:{backgroundColor:F0.titleBackgroundColor??void 0},children:[G("span",{className:"truncate rounded-sm px-1 font-medium",children:d0}),G("span",{className:"shrink-0 rounded-sm px-1 tabular-nums",children:g})]}),F0.showThumbnail?G("div",{className:"h-8 overflow-hidden bg-black",style:{backgroundImage:u?`url(${JSON.stringify(u)})`:void 0,backgroundPosition:"left center",backgroundRepeat:"repeat-x",backgroundSize:"auto 32px"}}):null,F0.showWaveform?b("div",{className:$==="audio"?"relative min-h-0 flex-1 overflow-hidden rounded-sm":"relative h-2.5 overflow-hidden rounded-sm",style:{backgroundColor:F0.backgroundColorStrong},children:[G("div",{className:"absolute inset-x-0 top-0 z-10 h-0.5 bg-warning"}),G(uY,{content:{source_type:Q.content.source_type??"input",file_path:Q.content.file_path,local_path:Q.content.local_path,url:Q.content.url,slot_name:Q.content.slot_name},startRatio:W0,endRatio:L0,className:"h-full w-full",color:F0.waveformColor??void 0})]}):$!=="audio"?G("div",{className:"min-h-0 flex-1"}):null]})}),G("span",{className:"absolute left-0 top-0 h-full w-0.5 cursor-ew-resize",style:{background:H0||z?P0:"transparent"}}),G("span",{className:"absolute right-0 top-0 h-full w-0.5 cursor-ew-resize",style:{background:H0||z?P0:"transparent"}}),$==="audio"||$==="video"?G(n1,{children:b(B1,{children:[G(U1,{asChild:!0,children:G(k0,{type:"button",size:"icon",variant:l?"secondary":"ghost","data-testid":`${$}-shared-reference`,"aria-label":l?S("multitrack.disableSharedReference"):S("multitrack.enableSharedReference"),"aria-pressed":l,className:`absolute ${P?"right-8":"right-2"} top-0.5 z-20 h-5 w-5 cursor-pointer bg-background/80 shadow-sm [&_svg]:!size-3 ${l?"text-highlight":"text-muted-foreground"}`,onMouseDown:(n)=>{n.preventDefault(),n.stopPropagation()},onClick:(n)=>{n.preventDefault(),n.stopPropagation(),t?.(!l)},children:G(hJ,{})})}),G(H1,{side:"bottom",className:"max-w-72",children:S("multitrack.sharedReferenceTooltip")})]})}):null,($==="audio"||$==="video")&&P?G(W1,{children:b(B1,{children:[G(U1,{asChild:!0,children:G(k0,{type:"button",size:"icon",variant:j?"secondary":"ghost","data-testid":$==="audio"?"audio-segment-lock":"video-segment-audio-lock","aria-label":j?S("multitrack.unlockAudio"):S("multitrack.lockAudio"),"aria-pressed":j,className:`absolute right-2 top-0.5 z-20 h-5 w-5 cursor-pointer bg-background/80 shadow-sm [&_svg]:!size-3 ${j?"text-highlight":"text-muted-foreground"}`,onMouseDown:(n)=>{n.preventDefault(),n.stopPropagation()},onClick:(n)=>{n.preventDefault(),n.stopPropagation(),h?.(!j)},children:j?G(bS,{}):G(TS,{})})}),G(H1,{side:"bottom",className:"max-w-72",children:S($==="video"?"multitrack.videoAudioLockTooltip":"multitrack.audioLockTooltip")})]})}):null]})}),b(E6,{children:[$==="video"&&L?G(J5,{onClick:()=>L(Q.id),children:S("multitrack.smartSplit")}):null,$==="video"&&F?G(J5,{onClick:()=>F(Q.id),children:S("multitrack.smartSplitTasksOnly")}):null,($==="video"||$==="audio")&&V?b(TA,{children:[G(P3,{children:S("multitrack.recognizeSubtitles")}),b(R3,{children:[G(J5,{onClick:()=>V(Q.id,"whisper-large-v3"),children:S("multitrack.recognizeSubtitlesWhisper")}),G(J5,{onClick:()=>V(Q.id,"qwen3-asr"),children:S("multitrack.recognizeSubtitlesQwen3")})]})]}):null,$==="task"&&H?G(J5,{onClick:H,children:S("multitrack.distributeTaskSegments")}):null,B?G(J5,{onClick:()=>B(Q.id),children:u0}):null,$==="task"&&U?G(J5,{onClick:U,children:S("multitrack.mergeTaskSegments")}):null,$==="task"&&_?G(J5,{onClick:()=>_(Q.id),children:S("multitrack.splitTaskSegment")}):null,G(J5,{onClick:()=>W(Q.id),children:S("multitrack.deleteSegment")})]})]})})}var C$=R(v(),1);function PW({track:$,icon:J,preserveSelection:Q=!1,onChange:Z}){let q=X1();return b("div",{className:"flex h-full flex-col items-center justify-center gap-0.5",children:[J,b("div",{className:"flex gap-px mt-1",children:[b(B1,{children:[G(U1,{asChild:!0,children:G(k0,{type:"button",variant:"outline",size:"icon",className:`h-3 w-3 cursor-pointer rounded-sm bg-card p-0 text-[8px] ${$.muted?"text-destructive":"text-muted-foreground"}`,"aria-label":q("multitrack.muteTrack",{name:$.name}),"aria-pressed":$.muted,onClick:(X)=>{if(Q)X.stopPropagation();Z({muted:!$.muted})},children:q("multitrack.muteShort")})}),G(H1,{children:q("multitrack.muteTrack",{name:$.name})})]}),b(B1,{children:[G(U1,{asChild:!0,children:G(k0,{type:"button",variant:"outline",size:"icon",className:`h-3 w-3 cursor-pointer rounded-sm bg-card p-0 text-[8px] ${$.solo?"text-highlight":"text-muted-foreground"}`,"aria-label":q("multitrack.soloTrack",{name:$.name}),"aria-pressed":$.solo===!0,onClick:(X)=>{if(Q)X.stopPropagation();Z({solo:!$.solo})},children:q("multitrack.soloShort")})}),G(H1,{children:q("multitrack.soloTrack",{name:$.name})})]})]})]})}var jS=R(v(),1);function z2($){let J=[...$].sort((q,X)=>q.start_frame-X.start_frame);if(J.length===0)return[];let Q=J[0].start_frame>0?[{startFrame:0,endFrame:J[0].start_frame}]:[],Z=J[0].end_frame;for(let q of J.slice(1)){if(q.start_frame>Z)Q.push({startFrame:Z,endFrame:q.start_frame});Z=Math.max(Z,q.end_frame)}return Q}var K2=jS.forwardRef(function({gap:J,totalLength:Q,width:Z,ariaLabel:q,onClick:X,className:Y,style:z,...K},W){let B=(J.startFrame+(J.endFrame-J.startFrame)/2)/Math.max(Q,1)*Z;return G(k0,{...K,ref:W,type:"button",variant:"secondary",size:"icon","data-testid":`track-gap-add-${J.startFrame}-${J.endFrame}`,className:b0("absolute top-1/2 z-10 h-5 w-5 -translate-x-1/2 -translate-y-1/2 cursor-pointer",Y),style:{...z,left:B},"aria-label":q,onClick:(U)=>{U.stopPropagation(),X?.(U)},children:G(z5,{className:"h-2.5 w-2.5"})})});function CQ({track:$,children:J}){let Q=X1();return G(k0,{type:"button",variant:"ghost",size:"icon",draggable:!0,className:"h-5 w-5 cursor-grab p-0 active:cursor-grabbing","aria-label":Q("multitrack.reorderTrack",{name:$.name}),"data-multitrack-track-drag-handle":$.id,children:J})}function Pt($){if($==="output")return"outputs";if($==="local")return"local";if($==="url")return"url";if($==="slot")return"slot";return"inputs"}function ES({track:$,totalLength:J,frameRate:Q,width:Z,canvasScale:q,selectedSegmentIds:X,node:Y,app:z,onAddAudio:K,onReplaceAudio:W,onSelectSegment:H,onDeleteSegment:B,onCloneSegment:U,onDeleteTrack:_,onTrackAudioSettingsChange:L,onSharedReferenceChange:F=()=>{},onResizeSegment:V,onResizeSegmentPreview:M,onMoveSegment:D,onDragPreviewChange:N,getDragPreviewStart:O,onDragPreviewEnd:I,onRecognizeSubtitles:k=()=>{},cutMode:T,onCutSegment:A,audioLockEnabled:w=!1}){let C=X1(),y=C$.useRef(null),[x,j]=C$.useState(!1),[P,h]=C$.useState(null),l=C$.useMemo(()=>Y9(Y,z,"audio"),[Y,z,x,P]),t=$.segments.reduce((e,H0)=>Math.max(e,H0.end_frame),0),S=$.segments.length===0?6:t/Math.max(J,1)*Z+6,i=z2($.segments),J0=P?$.segments.find((e)=>e.id===P.segmentId):void 0,K0=J0?.content.file_path??J0?.content.local_path??J0?.content.url??(J0?.content.slot_name?`__slot__:${J0.content.slot_name}`:"");return b("div",{className:"relative flex h-16 border-b border-border","data-multitrack-track-id":$.id,children:[G("div",{className:"shrink-0 border-r border-border",style:{width:Z5},children:G(PW,{track:$,icon:G(CQ,{track:$,children:G(NJ,{className:"h-3.5 w-3.5 text-muted-foreground"})}),preserveSelection:$.segments.some((e)=>X.has(e.id)),onChange:(e)=>L($.id,e)})}),b("div",{ref:y,className:"relative min-w-0 flex-1",children:[$.segments.map((e,H0)=>G(Y2,{trackType:"audio",segmentIndex:H0,segment:e,totalLength:J,frameRate:Q,areaWidth:Z,canvasScale:q,selected:X.has(e.id),onSelect:H,onDelete:B,onClone:U,onResize:V,onResizePreview:M,onMove:D,onDragPreviewChange:N,getDragPreviewStart:O,onDragPreviewEnd:I,onRecognizeSubtitles:k,cutMode:T,onCut:A,audioLocked:w&&$.audio_locked===!0,audioLockEnabled:w,onAudioLockToggle:(q0)=>{L($.id,{audio_locked:q0})},sharedReference:e.content.shared_reference===!0,onSharedReferenceToggle:(q0)=>{F($.id,e.id,q0)},onDoubleClick:(q0,E)=>{let d=y.current?.getBoundingClientRect();if(!d)return;h({segmentId:q0,x:(E.clientX-d.left)/Math.max(q,0.01),y:(E.clientY-d.top)/Math.max(q,0.01)})}},e.id)),i.map((e)=>b(a1,{children:[G(T5,{asChild:!0,children:G(K2,{gap:e,totalLength:J,width:Z,ariaLabel:C("multitrack.addAudioSegment")})}),G(s1,{className:"w-auto p-0",align:"center",children:G(V5,{value:"",mediaType:"audio",defaultTab:"inputs",slotItems:l,onChange:(H0,q0="input")=>{let E=l.find((c)=>c.value===H0)?.audio_name,d=E?X9(E,"input"):void 0;K($.id,H0,q0,d,e.startFrame,e.endFrame)}})})]},`${e.startFrame}-${e.endFrame}`)),b("div",{className:"absolute top-1/2 flex -translate-y-1/2 gap-1",style:{left:S},children:[b(a1,{open:x,onOpenChange:j,children:[G(T5,{asChild:!0,children:G(k0,{type:"button",variant:"secondary",size:"icon",className:"h-5 w-5 cursor-pointer","aria-label":C("multitrack.addAudioSegment"),children:G(z5,{className:"h-2.5 w-2.5"})})}),G(s1,{className:"w-auto p-0",align:"start",children:G(V5,{value:"",mediaType:"audio",defaultTab:"inputs",slotItems:l,onChange:(e,H0="input")=>{let q0=l.find((d)=>d.value===e)?.audio_name,E=q0?X9(q0,"input"):void 0;K($.id,e,H0,E),j(!1)}})})]}),$.segments.length===0?b(B1,{children:[G(U1,{asChild:!0,children:G(k0,{type:"button",variant:"ghost",size:"icon",className:"h-5 w-5 cursor-pointer text-destructive","aria-label":C("multitrack.deleteTrack",{name:$.name}),onClick:()=>_($.id),children:G(M5,{className:"h-2.5 w-2.5"})})}),G(H1,{children:C("multitrack.deleteTrack",{name:$.name})})]}):null]}),b(a1,{open:P!==null,onOpenChange:(e)=>{if(!e)h(null)},children:[P?G(_6,{asChild:!0,children:G("div",{className:"absolute h-px w-px",style:{left:P.x,top:P.y}})}):null,G(s1,{className:"w-auto p-0",align:"start",children:G(V5,{value:K0,mediaType:"audio",defaultTab:Pt(J0?.content.source_type),slotItems:l,onChange:(e,H0="input")=>{if(!P)return;let q0=l.find((d)=>d.value===e)?.audio_name,E=q0?X9(q0,"input"):void 0;W($.id,P.segmentId,e,H0,E),h(null)}})})]})]})]})}var S$=R(v(),1);function Rt($){if($==="output")return"outputs";if($==="local")return"local";if($==="url")return"url";if($==="slot")return"slot";return"inputs"}function NF($,J){let Q=J.find((Z)=>Z.value===$)?.video_name;return Q?X9(Q,"input"):void 0}function yS({track:$,totalLength:J,frameRate:Q,width:Z,canvasScale:q,selectedSegmentIds:X,node:Y,app:z,onAddVideo:K,onSelectSegment:W,onDeleteSegment:H,onCloneSegment:B,canDeleteTrack:U,onDeleteTrack:_,onTrackAudioSettingsChange:L,onSharedReferenceChange:F=()=>{},onResizeSegment:V,onResizeSegmentPreview:M,onMoveSegment:D,onDragPreviewChange:N,getDragPreviewStart:O,onDragPreviewEnd:I,onReplaceVideo:k,onSmartSplit:T,onSmartSplitTasks:A,onRecognizeSubtitles:w=()=>{},cutMode:C,onCutSegment:y,audioLockEnabled:x=!1}){let j=X1(),P=S$.useRef(null),[h,l]=S$.useState(!1),[t,S]=S$.useState(null),i=S$.useMemo(()=>Y9(Y,z,"video"),[Y,z,h,t]),J0=t?$.segments.find((E)=>E.id===t.segmentId):void 0,K0=J0?.content.source_type==="slot"&&J0.content.slot_name?`__slot__:${J0.content.slot_name}`:J0?.content.file_path??J0?.content.local_path??J0?.content.url??"",H0=$.segments.reduce((E,d)=>Math.max(E,d.end_frame),0)/Math.max(J,1)*Z,q0=z2($.segments);return b("div",{className:"relative flex h-16 border-b border-border","data-multitrack-track-id":$.id,children:[G("div",{className:"shrink-0 border-r border-border",style:{width:Z5},children:G(PW,{track:$,icon:G(CQ,{track:$,children:G(Q4,{className:"h-3.5 w-3.5 text-muted-foreground"})}),preserveSelection:$.segments.some((E)=>X.has(E.id)),onChange:(E)=>L($.id,E)})}),b("div",{ref:P,className:"relative min-w-0 flex-1",children:[$.segments.map((E,d)=>G(Y2,{trackType:$.type,segmentIndex:d,segment:E,totalLength:J,frameRate:Q,areaWidth:Z,canvasScale:q,selected:X.has(E.id),onSelect:W,onDelete:H,onClone:B,onSmartSplit:T,onSmartSplitTasks:A,onRecognizeSubtitles:w,cutMode:C,onCut:y,onResize:V,onResizePreview:M,onMove:D,onDragPreviewChange:N,getDragPreviewStart:O,onDragPreviewEnd:I,audioLocked:x&&$.audio_locked===!0,audioLockEnabled:x,onAudioLockToggle:(c)=>{L($.id,{audio_locked:c})},sharedReference:E.content.shared_reference===!0,onSharedReferenceToggle:(c)=>{F($.id,E.id,c)},onDoubleClick:(c,r)=>{let u=P.current?.getBoundingClientRect();if(!u)return;S({segmentId:c,x:(r.clientX-u.left)/Math.max(q,0.01),y:(r.clientY-u.top)/Math.max(q,0.01)})}},E.id)),q0.map((E)=>b(a1,{children:[G(T5,{asChild:!0,children:G(K2,{gap:E,totalLength:J,width:Z,ariaLabel:j("multitrack.addVideo")})}),G(s1,{className:"w-auto p-0",align:"center",children:G(V5,{value:"",mediaType:"video",defaultTab:"inputs",slotItems:i,onChange:(d,c="input")=>{K($.id,d,c,E.startFrame,E.endFrame,NF(d,i))}})})]},`${E.startFrame}-${E.endFrame}`)),b("div",{className:"absolute top-1/2 flex -translate-y-1/2 flex-col gap-1",style:{left:$.segments.length===0?6:H0+6},children:[b(a1,{open:h,onOpenChange:l,children:[G(T5,{asChild:!0,children:G(k0,{type:"button",variant:"secondary",size:"icon",className:"h-5 w-5 cursor-pointer","aria-label":j("multitrack.addVideo"),children:G(z5,{className:"h-2.5 w-2.5"})})}),G(s1,{className:"w-auto p-0",align:"start",children:G(V5,{value:"",mediaType:"video",defaultTab:"inputs",slotItems:i,onChange:(E,d="input")=>{K($.id,E,d,void 0,void 0,NF(E,i)),l(!1)}})})]}),U?b(B1,{children:[G(U1,{asChild:!0,children:G(k0,{type:"button",variant:"ghost",size:"icon",className:"h-5 w-5 cursor-pointer text-destructive","aria-label":j("multitrack.deleteTrack",{name:$.name}),onClick:()=>_($.id),children:G(M5,{className:"h-2.5 w-2.5"})})}),G(H1,{children:j("multitrack.deleteTrack",{name:$.name})})]}):null]}),b(a1,{open:t!==null,onOpenChange:(E)=>{if(!E)S(null)},children:[t?G(_6,{asChild:!0,children:G("div",{className:"absolute h-px w-px",style:{left:t.x,top:t.y}})}):null,G(s1,{className:"w-auto p-0",align:"start",children:G(V5,{value:K0,mediaType:"video",defaultTab:Rt(J0?.content.source_type),slotItems:i,onChange:(E,d="input")=>{if(!t)return;k($.id,t.segmentId,E,d,NF(E,i)),S(null)}})})]})]})]})}function RS({track:$,totalLength:J,frameRate:Q,width:Z,canvasScale:q,selectedSegmentIds:X,onSelectSegment:Y,onAddSubtitleSegment:z,onDeleteSegment:K,onCloneSegment:W,onDeleteTrack:H,onTrackVisibilityChange:B=()=>{},onEditSubtitleSegment:U,onResizeSegment:_,onResizeSegmentPreview:L,onMoveSegment:F,onDragPreviewChange:V,getDragPreviewStart:M,onDragPreviewEnd:D}){let N=X1(),O=$.segments.reduce((A,w)=>Math.max(A,w.end_frame),0),I=$.segments.length===0?6:O/Math.max(J,1)*Z+6,k=z2($.segments),T=$.visible!==!1;return b("div",{className:"relative flex h-[30px] border-b border-border","data-multitrack-track-id":$.id,children:[G("div",{className:"flex shrink-0 items-center justify-center border-r border-border",style:{width:Z5},children:G(CQ,{track:$,children:G(R$,{className:"h-3.5 w-3.5 text-muted-foreground"})})}),b("div",{className:"relative min-w-0 flex-1",children:[$.segments.map((A,w)=>G(Y2,{trackType:"subtitle",segmentIndex:w,segment:A,totalLength:J,frameRate:Q,areaWidth:Z,canvasScale:q,selected:X.has(A.id),onSelect:Y,onDelete:K,onClone:W,onResize:_,onResizePreview:L,onMove:F,onDragPreviewChange:V,getDragPreviewStart:M,onDragPreviewEnd:D,dimmed:!T,onDoubleClick:()=>{Y(A.id),U(A.id)}},A.id)),k.map((A)=>G(K2,{gap:A,totalLength:J,width:Z,ariaLabel:N("multitrack.addSubtitleSegment"),onClick:()=>z($.id,A.startFrame,A.endFrame)},`${A.startFrame}-${A.endFrame}`)),b("div",{className:"absolute top-1/2 flex -translate-y-1/2 flex-row gap-1",style:{left:I},children:[b(B1,{children:[G(U1,{asChild:!0,children:G(k0,{type:"button",variant:"secondary",size:"icon",className:"h-5 w-5 cursor-pointer","aria-label":N("multitrack.addSubtitleSegment"),onClick:(A)=>{A.stopPropagation(),z($.id)},children:G(z5,{className:"h-2.5 w-2.5"})})}),G(H1,{children:N("multitrack.addSubtitleSegment")})]}),$.segments.length===0?b(B1,{children:[G(U1,{asChild:!0,children:G(k0,{type:"button",variant:"ghost",size:"icon",className:"h-5 w-5 cursor-pointer text-destructive","aria-label":N("multitrack.deleteTrack",{name:$.name}),onClick:()=>H($.id),children:G(M5,{className:"h-2.5 w-2.5"})})}),G(H1,{children:N("multitrack.deleteTrack",{name:$.name})})]}):null,b(B1,{children:[G(U1,{asChild:!0,children:G(k0,{type:"button",variant:T?"ghost":"outline",size:"icon",className:`h-5 w-5 cursor-pointer ${T?"text-muted-foreground":"text-foreground"}`,"aria-label":T?N("multitrack.hideSubtitleTrack",{name:$.name}):N("multitrack.showSubtitleTrack",{name:$.name}),"aria-pressed":!T,onClick:(A)=>{A.stopPropagation(),B($.id,!T)},children:T?G(PS,{className:"h-2.5 w-2.5"}):G(T7,{className:"h-2.5 w-2.5"})})}),G(H1,{children:T?N("multitrack.hideSubtitleTrack",{name:$.name}):N("multitrack.showSubtitleTrack",{name:$.name})})]})]})]})]})}function Ct({type:$}){return G($==="video"?Q4:$==="audio"?t9:$==="subtitle"?R$:$==="task"?jW:xS,{className:"h-3.5 w-3.5 text-muted-foreground"})}function CS($,J){if($===J)return!0;if(!$||!J)return!1;return $.segmentId===J.segmentId&&$.targetTrackId===J.targetTrackId&&$.insertIndex===J.insertIndex&&$.start_frame===J.start_frame&&$.end_frame===J.end_frame}var St=new Set(["mp3","wav","flac","ogg","m4a","aac","opus","wma"]),ht=new Set(["mp4","webm","mov","mkv","avi","m4v"]),xt=new Set(["png","jpg","jpeg","webp","gif","bmp","tif","tiff","avif"]);function uS($){let J=$.name.split(".").pop()?.toLowerCase()??"";if(J==="srt")return"subtitle";if($.type.startsWith("audio/"))return"audio";if($.type.startsWith("video/"))return"video";if($.type.startsWith("image/"))return"image";if(St.has(J))return"audio";if(ht.has(J))return"video";if(xt.has(J))return"image";return null}function ft($){let J=mS($);if(J)return uS(J);for(let Q of Array.from($.items)){if(Q.kind!=="file")continue;if(Q.type==="application/x-subrip")return"subtitle";if(Q.type.startsWith("audio/"))return"audio";if(Q.type.startsWith("video/"))return"video";if(Q.type.startsWith("image/"))return"image"}return null}function SS($){return Array.from($.types).includes("Files")||$.files.length>0||Array.from($.items).some((J)=>J.kind==="file")}function mS($){let J=Array.from($.files)[0];if(J)return J;for(let Q of Array.from($.items)){if(Q.kind!=="file")continue;let Z=Q.getAsFile();if(Z)return Z}return null}function cS({data:$,node:J,app:Q,width:Z,currentTime:q,snapEnabled:X,canvasScale:Y,selectedSegmentIds:z,taskOverview:K=!1,onAddVideo:W,onAddAudio:H,onReplaceAudio:B,onAddTrack:U,onAddSubtitleSegment:_,onImportSubtitles:L=()=>{},onReplaceVideo:F,onAddTaskSegment:V,onSelectSegment:M,onSelectSegments:D,onClearSelection:N,onDeleteSegment:O,onDeleteTrack:I,onReorderTrack:k=()=>{},onTrackVisibilityChange:T=()=>{},onTrackAudioSettingsChange:A,onSharedReferenceChange:w=()=>{},onDistributeTaskSegments:C,onCloneTaskSegment:y,canMergeSelectedTaskSegments:x=!1,onMergeSelectedTaskSegments:j,onSplitTaskSegment:P=()=>{},onResizeSegment:h,onResizeSegmentPreview:l,onMoveSegment:t,onSmartSplit:S,onSmartSplitTasks:i,onRecognizeSubtitles:J0=()=>{},onEditSubtitleSegment:K0=()=>{},cutMode:e,onCutSegment:H0,format:q0}){let E=X1(),d=I6.useRef(null),c=I6.useRef(null),r=I6.useRef(null),u=I6.useRef(!1),m=I6.useRef(!1),s=I6.useRef(null),[f,o]=I6.useState(null),[G0,p]=I6.useState(null),[Z0,Q0]=I6.useState(null),[B0,W0]=I6.useState(null),L0=Math.max($.total_length,1),_0=Math.max(1,Z-Z5),N0=Math.max(1,_0-C2),d0=Z5+q/L0*N0,g=Z5+N0,a=24,I0=$.tracks.reduce((z0,A0)=>z0+hQ(A0.type,K),0),w0=I0+24,F0=$.tracks.find((z0)=>z0.type==="video")?.id,u0=$.tracks.filter((z0)=>z0.type==="video").length>=SQ,P0=$.tracks.filter((z0)=>z0.type==="audio").length>=SQ,n0=$.tracks.filter((z0)=>z0.type==="subtitle").length>=SQ,R0=$.tracks.reduce((z0,A0)=>{let f0=z0.at(-1)?.bottom??0;return z0.push({id:A0.id,top:f0,bottom:f0+hQ(A0.type,K)}),z0},[]);I6.useEffect(()=>{return()=>{s.current?.()}},[]);function Z1(z0){let A0=d.current?.getBoundingClientRect();if(!A0)return null;let f0=(z0-A0.top)/Math.max(Y,0.01);return R0.find(($1)=>f0>=$1.top&&f0<$1.bottom)?.id??null}function K1(z0,A0){let f0=d.current?.getBoundingClientRect();if(!f0)return null;let $1=Math.max(Y,0.01);return{x:(z0-f0.left)/$1,y:(A0-f0.top)/$1}}function a0(z0,A0){let f0=K1(z0,A0);if(!f0)return null;return{x:Math.max(0,Math.min(Z,f0.x)),y:Math.max(0,Math.min(w0,f0.y))}}function T1(z0,A0){return{left:Math.min(z0.x,A0.x),top:Math.min(z0.y,A0.y),width:Math.abs(A0.x-z0.x),height:Math.abs(A0.y-z0.y)}}function v1(z0,A0,f0){let $1=R0.find((A1)=>A1.id===z0);if(!$1)return!1;let $0=Z5+A0.start_frame/L0*N0,S0=Z5+A0.end_frame/L0*N0,c0=$1.top+4,Q1=$1.bottom-4,D1=f0.left+f0.width,d1=f0.top+f0.height;return $0f0.left&&c0f0.top}function E1(z0){return $.tracks.flatMap((A0)=>A0.segments.filter((f0)=>v1(A0.id,f0,z0)).map((f0)=>f0.id))}function n(z0){if(z0.button!==0||e)return!1;let A0=z0.target;return!A0.closest("[data-multitrack-segment]")&&!A0.closest("button")&&!A0.closest('[role="button"]')&&!A0.closest("[data-radix-popper-content-wrapper]")}function D0(){s.current?.();let z0=null,A0=($1)=>{$1.preventDefault(),$1.stopPropagation(),$1.stopImmediatePropagation(),f0()};function f0(){if(globalThis.removeEventListener("click",A0,!0),z0!==null)globalThis.clearTimeout(z0);if(s.current===f0)s.current=null}s.current=f0,globalThis.addEventListener("click",A0,!0),z0=globalThis.setTimeout(f0,0)}function O0(z0){if(!n(z0))return;let A0=K1(z0.clientX,z0.clientY);if(!A0||A0.y>w0)return;z0.preventDefault(),z0.stopPropagation(),c.current=A0,u.current=!1;function f0($0){let S0=c.current,c0=a0($0.clientX,$0.clientY);if(!S0||!c0)return;let Q1=T1(S0,c0);if(Q1.width>3||Q1.height>3)u.current=!0;W0(Q1)}function $1($0){let S0=c.current,c0=a0($0.clientX,$0.clientY);if(c.current=null,W0(null),globalThis.removeEventListener("mousemove",f0),globalThis.removeEventListener("mouseup",$1),!S0||!c0)return;if(!u.current){N();return}m.current=!0,D0();let Q1=E1(T1(S0,c0));D(Q1)}globalThis.addEventListener("mousemove",f0),globalThis.addEventListener("mouseup",$1)}function v0(z0,A0,f0){let $1=d.current?.getBoundingClientRect(),$0=Z1(A0),S0=$.tracks.find((k5)=>k5.id===$0),c0=f0==="image"?S0?.type==="task":f0===S0?.type;if(!$1||!S0||!c0)return null;let Q1=(z0-$1.left)/Math.max(Y,0.01)-Z5,D1=Math.round(Math.max(0,Math.min(N0,Q1))/N0*L0),d1=[...S0.segments].sort((k5,f8)=>k5.start_frame-f8.start_frame),A1=d1.filter((k5)=>k5.start_frame+(k5.end_frame-k5.start_frame)/2f0.id===A0?.dataset.multitrackTrackId)}function h1(z0){if(!(z0.target instanceof Element))return;let A0=z0.target.closest("[data-multitrack-track-drag-handle]"),f0=$.tracks.find(($1)=>$1.id===A0?.dataset.multitrackTrackDragHandle);if(!f0||f0.type==="task")return;r.current=f0.id,z0.dataTransfer.effectAllowed="move",z0.dataTransfer.setData("application/x-easy-media-track",f0.id)}function i1(z0){let A0=r.current,f0=G1(z0.target);if(!A0||!f0||f0.type==="task"||f0.id===A0)return;z0.preventDefault(),z0.stopPropagation(),z0.dataTransfer.dropEffect="move"}function Y0(z0){let A0=r.current,f0=G1(z0.target);if(r.current=null,!A0||!f0||f0.type==="task"||f0.id===A0)return;z0.preventDefault(),z0.stopPropagation(),k(A0,f0.id)}async function C0(z0){if(!SS(z0.dataTransfer))return;z0.preventDefault(),z0.stopPropagation();let A0=mS(z0.dataTransfer),f0=A0?uS(A0):null,$1=v0(z0.clientX,z0.clientY,f0);if(p(null),!A0||!$1)return;Q0({...$1,fileName:A0.name});try{if(f0==="subtitle"){L($1.trackId,await A0.text(),$1.frame);return}if(f0==="image"){let S0=await b7(A0);R5("inputs"),V($1.trackId,$1.frame,void 0,[S0]);return}let $0=await LZ(A0);if(R5("inputs"),f0==="video")W($1.trackId,$0,"input",$1.frame);else H($1.trackId,$0,"input",void 0,$1.frame)}catch($0){console.error("[TrackArea] failed to process dropped media:",$0)}finally{Q0(null)}}function x0(z0){let A0=R0.find(($0)=>$0.id===z0.targetTrackId);if(!A0)return null;let f0=Z5+z0.start_frame/L0*N0,$1=Z5+z0.end_frame/L0*N0;return{left:f0,top:A0.top+4,width:Math.max(2,$1-f0),height:Math.max(2,A0.bottom-A0.top-8)}}function r0(){return Math.max(1,Math.round(8/N0*L0))}function E0(z0,A0){return X?fS($,z0,A0,r0(),q):b8(A0,$.frame_rate)}function F1(z0,A0,f0){let $1=Z1(f0);if(!$1){o((S0)=>CS(S0,null)?S0:null);return}let $0=vS($.tracks,z0,$1,E0(z0,A0),$.frame_rate);o((S0)=>CS(S0,$0)?S0:$0)}function r1(z0,A0,f0,$1){let $0=Z1($1);if(o(null),!$0)return;t(z0,$0??A0,E0(z0,f0))}let y1=f?x0(f):null,t1=f?gS($.tracks,f,$.frame_rate):null;function L5(z0){if(!f||z0.id===f.segmentId)return z0;return t1?.find((A0)=>A0.id===z0.id)??z0}return b("div",{ref:d,className:"relative shrink-0",style:{width:Z,height:w0},"data-multitrack-track-area":!0,onDragOverCapture:i0,onDragLeave:(z0)=>{let A0=z0.relatedTarget;if(!(A0 instanceof Node)||!z0.currentTarget.contains(A0))p(null)},onDropCapture:C0,onDragStart:h1,onDragOver:i1,onDrop:Y0,onDragEnd:()=>{r.current=null},onMouseDown:O0,onClick:(z0)=>{if(z0.stopPropagation(),m.current){m.current=!1;return}let A0=z0.target;if(!A0.closest("[data-multitrack-segment]")&&!A0.closest("button")&&!A0.closest('[role="button"]'))N()},children:[G("div",{className:"pointer-events-none absolute top-0 z-10 bg-black/30",style:{left:g,width:C2,height:I0}}),G("div",{className:"absolute top-0 z-20 w-px bg-destructive",style:{left:d0,height:I0}}),$.tracks.map((z0)=>{if(z0.type==="video")return G(yS,{track:{...z0,segments:z0.segments.map((A0)=>L5(A0))},totalLength:$.total_length,frameRate:$.frame_rate,width:N0,canvasScale:Y,selectedSegmentIds:z,node:J,app:Q,onAddVideo:W,onReplaceVideo:F,onSelectSegment:M,onDeleteSegment:O,onCloneSegment:(A0)=>y(z0.id,A0),onSmartSplit:S,onSmartSplitTasks:i,onRecognizeSubtitles:J0,cutMode:e,onCutSegment:H0,canDeleteTrack:z0.id!==F0,onDeleteTrack:I,onTrackAudioSettingsChange:A,onSharedReferenceChange:w,onResizeSegment:h,onResizeSegmentPreview:l,onMoveSegment:(A0,f0,$1)=>{r1(A0,z0.id,f0,$1)},onDragPreviewChange:F1,getDragPreviewStart:E0,onDragPreviewEnd:()=>o(null),audioLockEnabled:q0==="MiniMax"},z0.id);if(z0.type==="audio")return G(ES,{track:{...z0,segments:z0.segments.map((A0)=>L5(A0))},totalLength:$.total_length,frameRate:$.frame_rate,width:N0,canvasScale:Y,selectedSegmentIds:z,node:J,app:Q,onAddAudio:H,onReplaceAudio:B,onSelectSegment:M,onDeleteSegment:O,onCloneSegment:(A0)=>y(z0.id,A0),onDeleteTrack:I,onTrackAudioSettingsChange:A,onSharedReferenceChange:w,onResizeSegment:h,onResizeSegmentPreview:l,onMoveSegment:(A0,f0,$1)=>r1(A0,z0.id,f0,$1),onDragPreviewChange:F1,getDragPreviewStart:E0,onDragPreviewEnd:()=>o(null),onRecognizeSubtitles:J0,cutMode:e,onCutSegment:H0,audioLockEnabled:q0==="MiniMax"},z0.id);if(z0.type==="subtitle")return G(RS,{track:{...z0,segments:z0.segments.map((A0)=>L5(A0))},totalLength:$.total_length,frameRate:$.frame_rate,width:N0,canvasScale:Y,selectedSegmentIds:z,onSelectSegment:M,onAddSubtitleSegment:_,onDeleteSegment:O,onCloneSegment:(A0)=>y(z0.id,A0),onDeleteTrack:I,onTrackVisibilityChange:T,onEditSubtitleSegment:K0,onResizeSegment:h,onResizeSegmentPreview:l,onMoveSegment:(A0,f0,$1)=>r1(A0,z0.id,f0,$1),onDragPreviewChange:F1,getDragPreviewStart:E0,onDragPreviewEnd:()=>o(null)},z0.id);return b("div",{"data-testid":`track-row-${z0.id}`,"data-multitrack-track-id":z0.id,className:"relative flex border-b border-border",style:{height:hQ(z0.type,K)},children:[G("div",{className:"flex shrink-0 items-center justify-center border-r border-border",style:{width:Z5},children:G(Ct,{type:z0.type})}),b("div",{className:"relative min-w-0 flex-1",children:[z0.segments.map((A0,f0)=>G(Y2,{trackType:z0.type,segmentIndex:f0,segment:L5(A0),totalLength:$.total_length,frameRate:$.frame_rate,areaWidth:N0,canvasScale:Y,selected:z.has(A0.id),showTaskIndex:($.task_markers??[]).length===0,taskOverview:z0.type==="task"&&K,onSelect:M,onDelete:O,onDistribute:z0.type==="task"?()=>C(z0.id):void 0,onClone:z0.type==="task"?($1)=>y(z0.id,$1):void 0,onMerge:z0.type==="task"&&z.has(A0.id)&&x?j:void 0,onSplitTask:z0.type==="task"?P:void 0,cutMode:e,onCut:H0,onResize:h,onResizePreview:l,onMove:($1,$0,S0)=>{r1($1,z0.id,$0,S0)},onDragPreviewChange:F1,getDragPreviewStart:E0,onDragPreviewEnd:()=>o(null)},A0.id)),z0.type==="task"?b(W1,{children:[z2(z0.segments).map((A0)=>G(K2,{gap:A0,totalLength:$.total_length,width:N0,ariaLabel:E("multitrack.addTaskSegment"),onClick:()=>V(z0.id,A0.startFrame,A0.endFrame)},`${A0.startFrame}-${A0.endFrame}`)),G(k0,{type:"button",variant:"secondary",size:"icon",className:"absolute top-1/2 h-5 w-5 cursor-pointer",style:{left:z0.segments.length===0?6:z0.segments.reduce((A0,f0)=>Math.max(A0,f0.end_frame),0)/L0*N0+6,transform:"translateY(-50%)"},"aria-label":E("multitrack.addTaskSegment"),onClick:(A0)=>{A0.stopPropagation(),V(z0.id)},children:G(z5,{className:"h-2.5 w-2.5"})})]}):b(B1,{children:[G(U1,{asChild:!0,children:G(k0,{type:"button",variant:"ghost",size:"icon",className:"absolute top-1/2 h-5 w-5 -translate-y-1/2 cursor-pointer text-destructive",style:{left:z0.segments.length===0?6:z0.segments.reduce((A0,f0)=>Math.max(A0,f0.end_frame),0)/L0*N0+6},"aria-label":E("multitrack.deleteTrack",{name:z0.name}),onClick:()=>I(z0.id),children:G(M5,{className:"h-2.5 w-2.5"})})}),G(H1,{children:E("multitrack.deleteTrack",{name:z0.name})})]})]})]},z0.id)}),b("div",{className:"flex items-center justify-center gap-1 border-b border-border text-[10px] text-muted-foreground",style:{height:24},children:[G("span",{children:E("multitrack.addTrack")}),b(B1,{children:[G(U1,{asChild:!0,children:G(k0,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 cursor-pointer disabled:cursor-not-allowed",disabled:u0,"aria-label":E("multitrack.addVideoTrack"),onClick:()=>U("video"),children:G(hS,{className:"h-3.5 w-3.5"})})}),G(H1,{children:E("multitrack.addVideoTrack")})]}),b(B1,{children:[G(U1,{asChild:!0,children:G(k0,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 cursor-pointer disabled:cursor-not-allowed",disabled:P0,"aria-label":E("multitrack.addAudioTrack"),onClick:()=>U("audio"),children:G(NJ,{className:"h-3.5 w-3.5"})})}),G(H1,{children:E("multitrack.addAudioTrack")})]}),b(B1,{children:[G(U1,{asChild:!0,children:G(k0,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 cursor-pointer disabled:cursor-not-allowed",disabled:n0,"aria-label":E("multitrack.addSubtitleTrack"),onClick:()=>U("subtitle"),children:G(R$,{className:"h-3.5 w-3.5"})})}),G(H1,{children:E("multitrack.addSubtitleTrack")})]})]}),y1?G("div",{className:"pointer-events-none absolute z-10 rounded border border-border bg-muted/60",style:y1}):null,B0?G("div",{className:"pointer-events-none absolute z-40 rounded border border-primary bg-primary/10",style:B0}):null,G0?(()=>{let z0=R0.find((A0)=>A0.id===G0.trackId);if(!z0)return null;return G("div",{"data-testid":"external-media-drop-slot",className:"pointer-events-none absolute z-30 w-1 rounded bg-primary",style:{left:Z5+G0.frame/L0*N0,top:z0.top+4,height:z0.bottom-z0.top-8}})})():null,Z0?(()=>{let z0=R0.find((A0)=>A0.id===Z0.trackId);if(!z0)return null;return b("div",{role:"status","aria-live":"polite",className:"pointer-events-none absolute z-40 flex max-w-48 items-center gap-1.5 rounded border border-border bg-background/95 px-2 py-1 text-[10px] text-foreground shadow-sm",style:{left:Z5+Z0.frame/L0*N0,top:z0.top+(z0.bottom-z0.top)/2,transform:"translate(-50%, -50%)"},children:[G(X6,{className:"h-3.5 w-3.5 shrink-0 animate-spin"}),G("span",{className:"truncate",children:E("multitrack.externalMediaUploading",{name:Z0.fileName})})]})})():null]})}function vt($){if($&&typeof $==="object"&&!Array.isArray($)){if(Array.isArray($.tracks))return TF($)}return Hh()}function RW($,J){let Q=[...$].sort((B,U)=>B.start_frame-U.start_frame),Z=Q.filter((B)=>B.start_frame+(B.end_frame-B.start_frame)/2{let U=B.end_frame-B.start_frame,_=Math.max(B.start_frame,W);return W=_+U,{...B,start_frame:_,end_frame:W}});return[...q,K,...H]}function dS($){let J=$.task_overview===!0;return $.tracks.reduce((Q,Z)=>Q+hQ(Z.type,J),0)}function gt({value:$,onChange:J,app:Q,node:Z}){let q=vt($),X=JSON.stringify(q),[Y,z]=l1.useState(null),K=Y??q,W=K.task_overview===!0,H=l1.useRef(q);H.current=q;let[B,U]=l1.useState(0),[_,L]=l1.useState(!1),[F,V]=l1.useState(1),[M,D]=l1.useState(!0),[N,O]=l1.useState(!1),[I,k]=l1.useState(null),[T,A]=l1.useState(null),[w,C]=l1.useState(()=>new Set),[y,x]=l1.useState(null),[j,P]=l1.useState(null),[h,l]=l1.useState(!1),[t,S]=l1.useState(!1),[i,J0]=l1.useState(0),[K0,e]=l1.useState(null),[H0,q0]=l1.useState(!1),[E,d]=l1.useState(null),c=l1.useRef(null),r=l1.useRef(null),u=l1.useRef(0),m=l1.useRef(0),s=l1.useRef(0),o=Math.max(1,OJ(r))*F,G0=n9(Q),p=sY(Z),Z0=w.size<=1?IF(K,T):null,Q0=w.size>1?K.tracks.flatMap((X0)=>X0.type==="task"?X0.segments.filter((V0)=>w.has(V0.id)):[]):[],B0=Q0.length===w.size&&Q0.length>1,W0=kF(K.tracks,w)!==null,L0=Z0??(B0?IF(K,T):null),_0=L0?.trackType==="task"?K.tracks.find((X0)=>X0.id===L0.trackId&&X0.type==="task")?.segments??[L0.segment]:void 0,N0=j?K.tracks.find((X0)=>X0.type==="task"&&X0.segments.some((V0)=>V0.id===j))?.segments.find((X0)=>X0.id===j)??null:null,d0=l1.useCallback((X0)=>{let V0=dS(X0)-dS(H.current);pS(Z,V0),H.current=X0,J(X0)},[Z,J]),{canUndo:g,canRedo:a,commitChange:I0,undo:w0,redo:F0}=YI(q,d0),u0=Q?.ui?.settings?.settingsValues?.["Comfy.Locale"],P0=(X0,V0)=>SW(u0,X0,V0),n0=K0?.directory.split(/[\\/]/).filter(Boolean).at(-1)??"";function R0(X0){I0(TF(X0))}function Z1(X0){A(X0),C(X0?new Set([X0]):new Set)}function K1(X0){let V0=b8(X0,K.frame_rate);s.current=V0,U(V0)}function a0(X0,V0="replace"){let U0=K.tracks.find((M0)=>M0.type==="task"&&M0.segments.some((h0)=>h0.id===X0))?.segments.find((M0)=>M0.id===X0);if(U0&&(s.current=U0.end_frame))K1(U0.start_frame);k(null),C((M0)=>{if(V0==="replace")return A(X0),new Set([X0]);let h0=new Set(M0);if(V0==="toggle"&&h0.has(X0))return h0.delete(X0),A((j0)=>j0===X0?h0.values().next().value??null:j0),h0;return h0.add(X0),A(X0),h0})}function T1(X0){k(null);let V0=new Set(X0);C(V0),A(X0.at(-1)??null)}function v1(){Z1(null),k(null)}l1.useEffect(()=>{z(null);let X0=new Set(q.tracks.flatMap((V0)=>V0.segments.map((U0)=>U0.id)));C((V0)=>{let U0=new Set([...V0].filter((M0)=>X0.has(M0)));return A((M0)=>M0&&!X0.has(M0)?U0.values().next().value??null:M0),U0}),k((V0)=>V0&&q.task_markers?.some((U0)=>U0.id===V0)?V0:null)},[X]);function E1(){let X0=b8(B,K.frame_rate);return X0>0&&X0<=K.total_length&&!(K.task_markers??[]).some((V0)=>V0.frame===X0)}function n(){let X0=b8(B,K.frame_rate);if(!E1())return;let V0={id:x1(),frame:X0};R0({...K,task_markers:[...K.task_markers??[],V0]}),Z1(null),k(V0.id)}function D0(X0){if(!(K.task_markers??[]).some((V0)=>V0.id===X0))return;R0({...K,task_markers:(K.task_markers??[]).filter((V0)=>V0.id!==X0)}),k((V0)=>V0===X0?null:V0)}function O0(X0,V0){let U0=b8(V0,K.frame_rate),M0=K.task_markers??[],h0=M0.find((j0)=>j0.id===X0);if(!h0||h0.frame===U0)return;if(U0<=0||U0>K.total_length)return;if(M0.some((j0)=>j0.id!==X0&&j0.frame===U0))return;R0({...K,task_markers:M0.map((j0)=>j0.id===X0?{...j0,frame:U0}:j0)})}function v0(X0){R0({...q,task_overview:X0})}l1.useEffect(()=>{s.current=B},[B]),l1.useEffect(()=>{if(!T||w.size!==1)return;let X0=K.tracks.find((M0)=>M0.type==="task"&&M0.segments.some((h0)=>h0.id===T)),V0=X0?.segments.find((M0)=>M0.id===T);if(!X0||!V0)return;if(B>=V0.start_frame&&BB>=M0.start_frame&&B{let X0=Z;return X0.__easyMediaSyncPlay=()=>{if(c.current!==null)cancelAnimationFrame(c.current);c.current=null,s.current=0,m.current=0,u.current=performance.now(),U(0),L(!0),J0((V0)=>V0+1)},()=>{if(X0.__easyMediaSyncPlay)delete X0.__easyMediaSyncPlay}},[Z]),l1.useEffect(()=>{let X0=Q.api;if(!X0?.addCustomEventListener||!X0.removeCustomEventListener)return;let V0=(U0)=>{let M0=oY(U0.detail);if(!M0)return;e(M0),d(null),q0(!1)};return X0.addCustomEventListener(wB,V0),()=>X0.removeCustomEventListener?.(wB,V0)},[Q]),l1.useEffect(()=>{if(!_){if(c.current!==null)cancelAnimationFrame(c.current);c.current=null;return}u.current=performance.now(),m.current=s.current;function X0(V0){let U0=(V0-u.current)/1000,M0=b8(m.current+P9(U0,K.frame_rate),K.frame_rate);if(M0>=K.total_length){s.current=0,m.current=0,u.current=V0,U(0),J0((h0)=>h0+1),c.current=requestAnimationFrame(X0);return}s.current=M0,U(M0),c.current=requestAnimationFrame(X0)}return c.current=requestAnimationFrame(X0),()=>{if(c.current!==null)cancelAnimationFrame(c.current)}},[_,i,K.frame_rate,K.total_length]);async function i0(X0,V0,U0,M0,h0,j0){let t0=AF(V0,U0);if(j0)t0.url=j0;let q1=Q5(t0),p1;if(q1)try{let m5=await TZ(q1);if(Number.isFinite(m5.duration)&&m5.duration>0)p1=m5.duration}catch(m5){console.error("[MultiTrackWidget] failed to read video metadata:",m5)}let P1=H.current,e1={added:!1,startFrame:0,endFrame:0},g1=P1.tracks.map((m5)=>{if(m5.id!==X0)return m5;let Y7=M0===void 0?b8(m5.segments.reduce((c9,xQ)=>Math.max(c9,xQ.end_frame),0),P1.frame_rate):Math.max(0,Math.round(M0)),HX=h0===void 0?Y7+Math.max(1,CW(p1??OF,P1.frame_rate)):Math.max(Y7+1,Math.round(h0));return e1.added=!0,e1.startFrame=Y7,e1.endFrame=HX,{...m5,segments:(()=>{let c9={id:x1(),start_frame:Y7,end_frame:HX,color:m5.color,content:{...t0,...p1===void 0?{}:{duration:p1}}};if(M0===void 0)return[...m5.segments,c9];return RW(m5.segments,c9)})()}}),T6=M0===void 0?g1:nS(P1.tracks,g1),W2=e1.added?aS(T6,e1.startFrame,e1.endFrame):T6;R0({...P1,tracks:W2,total_length:U8(W2,P1.frame_rate)})}async function G1(X0,V0,U0,M0,h0,j0){let t0=wF(V0,U0);if(M0)t0.url=M0;let q1=Q5(t0),p1;if(q1)try{p1=(await jB(q1)).duration}catch(g1){console.error("[MultiTrackWidget] failed to read audio metadata:",g1)}let P1=H.current,e1=P1.tracks.map((g1)=>{if(g1.id!==X0||g1.type!=="audio")return g1;let T6=h0===void 0?g1.segments.reduce((m5,Y7)=>Math.max(m5,Y7.end_frame),0):Math.max(0,Math.round(h0)),W2=j0===void 0?T6+Math.max(1,CW(p1??OF,P1.frame_rate)):Math.max(T6+1,Math.round(j0));return{...g1,segments:(()=>{let m5={id:x1(),start_frame:T6,end_frame:W2,color:g1.color,content:{...t0,...p1===void 0?{}:{duration:p1}}};if(h0===void 0)return[...g1.segments,m5];return RW(g1.segments,m5)})()}});R0({...P1,tracks:e1,total_length:U8(e1,P1.frame_rate)})}async function h1(X0,V0,U0,M0,h0){let j0=wF(U0,M0);if(h0)j0.url=h0;let t0=Q5(j0),q1=null;if(t0)try{q1=(await jB(t0)).duration}catch(e1){console.error("[MultiTrackWidget] failed to read replacement audio metadata:",e1)}let p1=H.current,P1=p1.tracks.map((e1)=>{if(e1.id!==X0||e1.type!=="audio")return e1;return{...e1,segments:e1.segments.map((g1)=>{if(g1.id!==V0)return g1;return{...g1,end_frame:q1===null?g1.end_frame:iS(g1,q1,p1.frame_rate),origin_start_frame:g1.start_frame,content:{...j0,...q1===null?{}:{duration:q1},muted:g1.content.muted??j0.muted,volume_db:g1.content.volume_db??j0.volume_db,shared_reference:g1.content.shared_reference===!0}}})}});R0({...p1,tracks:P1,total_length:U8(P1,p1.frame_rate)})}function i1(X0){if(X0!=="video"&&X0!=="audio"&&X0!=="subtitle")return;let V0=K.tracks.filter((h0)=>h0.type===X0).length;if(V0>=SQ)return;let U0=X0==="video"||X0==="audio",M0={id:x1(),name:`${X0==="video"?"Video":X0==="audio"?"Audio":"Subtitle"} ${V0}`,type:X0,color:X0==="subtitle"?y2:kZ[X0],muted:!1,solo:U0?!1:void 0,volume_db:U0?P2:void 0,locked:!1,segments:[]};R0({...K,tracks:[...K.tracks,M0]})}function Y0(X0){let V0=K.tracks.find((j0)=>j0.id===X0),U0=K.tracks.find((j0)=>j0.type==="video")?.id;if(!V0||V0.type==="task"||V0.id===U0)return;let M0=new Set(V0.segments.map((j0)=>j0.id)),h0=K.tracks.filter((j0)=>j0.id!==X0);R0({...K,tracks:h0,total_length:U8(h0,K.frame_rate)}),C((j0)=>{let t0=new Set([...j0].filter((q1)=>!M0.has(q1)));return A((q1)=>q1&&M0.has(q1)?t0.values().next().value??null:q1),t0})}function C0(X0,V0){let U0=K.tracks.findIndex((q1)=>q1.id===X0),M0=K.tracks.findIndex((q1)=>q1.id===V0),h0=K.tracks[U0],j0=K.tracks[M0];if(U0<0||M0<0||U0===M0||h0?.type==="task"||j0?.type==="task")return;let t0=[...K.tracks];t0[U0]=j0,t0[M0]=h0,R0({...K,tracks:t0})}function x0(X0,V0){if("audio_locked"in V0){R0(Wh(K,X0,V0.audio_locked===!0));return}if("solo"in V0){let U0=K.tracks.find((j0)=>j0.id===X0);if(!U0||U0.type!=="video"&&U0.type!=="audio")return;let M0=V0.solo===!0,h0=K.tracks.map((j0)=>{if(j0.type!=="video"&&j0.type!=="audio")return j0;if(j0.id===X0)return{...j0,...V0,solo:M0,muted:M0?!1:j0.muted};return{...j0,solo:!1,muted:M0?!0:!1}});R0({...K,tracks:h0});return}R0({...K,tracks:K.tracks.map((U0)=>U0.id===X0?{...U0,...V0}:U0)})}function r0(X0,V0){R0({...K,tracks:K.tracks.map((U0)=>U0.id===X0&&U0.type==="subtitle"?{...U0,visible:V0}:U0)})}function E0(X0,V0,U0){R0({...K,tracks:K.tracks.map((M0)=>{if(M0.id!==X0||M0.type!=="audio"&&M0.type!=="video")return M0;return{...M0,segments:M0.segments.map((h0)=>({...h0,content:{...h0.content,shared_reference:U0&&h0.id===V0,speaker_reference:void 0}}))}})})}async function F1(X0,V0,U0,M0,h0){let j0=AF(U0,M0);if(h0)j0.url=h0;let t0=Q5(j0),q1;if(t0)try{let P1=await TZ(t0);if(Number.isFinite(P1.duration)&&P1.duration>0)q1=P1.duration}catch(P1){console.error("[MultiTrackWidget] failed to read replacement video metadata:",P1)}let p1=K.tracks.map((P1)=>{if(P1.id!==X0)return P1;return{...P1,segments:P1.segments.map((e1)=>e1.id===V0?{...e1,content:{...j0,...q1===void 0?{}:{duration:q1},shared_reference:e1.content.shared_reference===!0}}:e1)}});R0({...K,tracks:p1,total_length:U8(p1,K.frame_rate)})}function r1(X0,V0,U0,M0){let h0=K.tracks.map((j0)=>{if(j0.id!==X0||j0.type!=="task")return j0;let t0=V0===void 0?b8(j0.segments.reduce((P1,e1)=>Math.max(P1,e1.end_frame),0),K.frame_rate):Math.max(0,Math.round(V0)),q1=U0===void 0?t0+Math.max(1,P9(5,K.frame_rate)):Math.max(t0+1,Math.round(U0)),p1={id:x1(),start_frame:t0,end_frame:q1,color:j0.color,content:{media_type:"none",...oS(j0.segments,t0,j0.task_mode??"default"),images:M0??[]}};return{...j0,segments:V0===void 0?[...j0.segments,p1]:RW(j0.segments,p1)}});R0({...K,tracks:h0,total_length:U8(h0,K.frame_rate)})}function y1(X0,V0,U0){let M0=K.tracks.map((h0)=>{if(h0.id!==X0||h0.type!=="subtitle")return h0;let j0=V0===void 0?b8(h0.segments.reduce((P1,e1)=>Math.max(P1,e1.end_frame),0),K.frame_rate):Math.max(0,Math.round(V0)),t0=U0===void 0?j0+Math.max(1,P9(5,K.frame_rate)):Math.max(j0+1,Math.round(U0)),q1=h0.segments.find((P1)=>P1.content.subtitle_style)?.content.subtitle_style,p1={id:x1(),start_frame:j0,end_frame:t0,color:h0.color||y2,content:{media_type:"subtitle",text:"默认文字",subtitle_style:{...q1??R2}}};return{...h0,segments:V0===void 0?[...h0.segments,p1]:RW(h0.segments,p1)}});R0({...K,tracks:M0,total_length:U8(M0,K.frame_rate)})}function t1(X0,V0,U0){let M0=H.current,h0=M0.tracks.map((j0)=>{if(j0.id!==X0||j0.type!=="subtitle")return j0;let t0=j0.segments.find((g1)=>g1.content.subtitle_style)?.content.subtitle_style,q1=VI(V0,{color:j0.color||y2,createId:()=>x1(),frameRate:M0.frame_rate,startFrame:Math.max(0,Math.round(U0)),subtitleStyle:t0??R2}),p1=q1.reduce((g1,T6)=>Math.min(g1,T6.start_frame),q1[0].start_frame),P1=q1.reduce((g1,T6)=>Math.max(g1,T6.end_frame),q1[0].end_frame),e1=j0.segments.filter((g1)=>g1.end_frame<=p1||g1.start_frame>=P1);return{...j0,segments:[...e1,...q1].sort((g1,T6)=>g1.start_frame-T6.start_frame)}});R0({...M0,tracks:h0,total_length:U8(h0,M0.frame_rate)})}function L5(X0){let V0=w.has(X0)?w:new Set([X0]),U0=V0.size>1?Qh(K.tracks,V0,K.frame_rate):Jh(K.tracks,X0,K.frame_rate),M0=U8(U0,K.frame_rate);R0({...K,tracks:U0,total_length:M0}),v1(),U((h0)=>Math.min(h0,M0))}function z0(X0){let V0=K.tracks.map((U0)=>U0.id===X0&&U0.type==="task"?{...U0,segments:tS(U0.segments,K.total_length)}:U0);R0({...K,tracks:V0})}function A0(X0,V0){let U0=null,M0=0,h0=K.tracks.map((j0)=>{if(j0.id!==X0)return j0;let t0=$h(j0.segments,V0);if(!t0)return j0;return U0=t0.clonedSegmentId,M0=t0.segments.reduce((q1,p1)=>Math.max(q1,p1.end_frame),0),{...j0,segments:t0.segments}});if(!U0)return;R0({...K,tracks:h0,total_length:Math.max(K.total_length,M0)}),Z1(U0)}function f0(){let X0=kF(K.tracks,w);if(!X0)return;R0({...K,tracks:X0.tracks,total_length:U8(X0.tracks,K.frame_rate)}),Z1(X0.mergedSegmentId)}function $1(X0,V0){let U0=[],M0=K.tracks.map((h0)=>{if(h0.type!=="task"||!h0.segments.some((t0)=>t0.id===X0))return h0;let j0=eS(h0.segments,X0,V0);if(!j0)return h0;return U0=j0.splitSegmentIds,{...h0,segments:j0.segments}});if(U0.length===0)return;R0({...K,tracks:M0,total_length:U8(M0,K.frame_rate)}),C(new Set(U0)),A(U0[0]??null)}function $0(X0,V0,U0,M0){let h0=X0.tracks.map((t0)=>{if(t0.type==="task"&&U0==="end"&&t0.segments.some((q1)=>q1.id===V0))return{...t0,segments:zh(t0.segments,V0,b8(M0,X0.frame_rate))};return{...t0,segments:t0.segments.map((q1)=>{if(q1.id!==V0)return q1;let p1=[...t0.segments].sort((c9,xQ)=>c9.start_frame-xQ.start_frame),P1=p1.findIndex((c9)=>c9.id===V0),e1=P1>0?p1[P1-1]:null,g1=P1>=0&&P10?Math.max(1,CW(q1.content.duration,X0.frame_rate)):Number.POSITIVE_INFINITY;if(U0==="start"){let c9=b8(M0,X0.frame_rate),xQ=Math.max(0,e1?.end_frame??0,q1.end_frame-W2),ch=q1.end_frame-1,gF=Math.max(xQ,Math.min(c9,ch));return{...q1,start_frame:gF,...gF!==q1.start_frame&&(t0.type==="video"||t0.type==="audio")?{origin_start_frame:q1.origin_start_frame??q1.start_frame}:{}}}let m5=b8(M0,X0.frame_rate),Y7=q1.start_frame+1,HX=Math.min(g1?.start_frame??Number.POSITIVE_INFINITY,q1.start_frame+W2);return{...q1,end_frame:Math.max(Y7,Math.min(m5,HX))}}).sort((q1,p1)=>q1.start_frame-p1.start_frame)}}),j0=Yh(X0.tracks,h0,V0);return{...X0,tracks:j0,total_length:U8(j0,X0.frame_rate)}}function S0(X0,V0,U0,M0){return M?rS(q,X0,V0,U0,M0,s.current):b8(U0,q.frame_rate)}function c0(X0,V0,U0,M0=0){z($0(q,X0,V0,S0(X0,V0,U0,M0)))}function Q1(X0,V0,U0,M0=0){z(null),R0($0(q,X0,V0,S0(X0,V0,U0,M0)))}function D1(X0,V0,U0){let M0=w.has(X0)?qh(K.tracks,w,X0,V0,U0,K.frame_rate):Zh(K.tracks,X0,V0,U0,K.frame_rate);R0({...K,tracks:M0,total_length:U8(M0,K.frame_rate)})}function d1(X0){let V0=X0.frame_rate;if(typeof V0==="number"&&V0>0&&V0!==K.frame_rate){let U0=Gh(K,V0),M0=sS(s.current,K.frame_rate,U0.frame_rate);s.current=M0,U(M0),R0({...U0,...X0,frame_rate:U0.frame_rate});return}R0({...K,...X0,frame_rate:K.frame_rate})}function A1(X0){if(!T)return;if(Z0?.trackType==="subtitle"&&X0.subtitle_style){let{subtitle_style:V0,...U0}=X0,M0=Object.keys(U0).length>0,h0=K.tracks.map((j0)=>{if(j0.id!==Z0.trackId||j0.type!=="subtitle")return j0;return{...j0,segments:j0.segments.map((t0)=>({...t0,content:{...t0.content,...M0&&t0.id===T?U0:{},subtitle_style:V0}}))}});R0({...K,tracks:h0});return}R0(Xh(K,T,X0))}function O1(X0){let V0=new Map(X0.map((M0)=>[M0.segmentId,M0.patch])),U0=K.tracks.map((M0)=>({...M0,segments:M0.segments.map((h0)=>{let j0=V0.get(h0.id);if(!j0)return h0;return{...h0,content:{...h0.content,...j0}}})}));R0({...K,tracks:U0})}function k5(X0){if(Z0?.trackType!=="task")return;let V0=K.tracks.map((U0)=>U0.id===Z0.trackId?{...U0,segments:X0}:U0);R0({...K,tracks:V0,total_length:U8(V0,K.frame_rate)})}function f8(X0){if(!T)return;R0(Kh(K,T,X0,K.frame_rate))}async function Y6(X0){let V0=K.tracks.find((U0)=>U0.type==="video"&&U0.segments.some((M0)=>M0.id===X0))?.segments.find((U0)=>U0.id===X0);if(!V0||h)return;L(!1),l(!0);try{let U0=await kB(V0,K.frame_rate);R0(WI(K,X0,U0))}catch(U0){if(U0 instanceof E2){e(U0.model),d(null);return}console.error("[MultiTrackWidget] smart split failed:",U0);let M0=U0 instanceof Error?U0.message:String(U0);try{Q.extensionManager.toast.add({severity:"error",summary:P0("multitrack.smartSplitFailed"),detail:M0,life:5000})}catch(h0){console.error("[MultiTrackWidget] failed to show smart split error:",h0)}}finally{l(!1)}}async function pW(X0){let V0=K.tracks.find((U0)=>U0.type==="video"&&U0.segments.some((M0)=>M0.id===X0))?.segments.find((U0)=>U0.id===X0);if(!V0||h)return;if(!GI(K,X0)){try{Q.extensionManager.toast.add({severity:"warn",summary:P0("multitrack.smartSplitTasksOnly"),detail:P0("multitrack.noMatchingTaskSegment"),life:4000})}catch(U0){console.error("[MultiTrackWidget] failed to show task split warning:",U0)}return}L(!1),l(!0);try{let U0=await kB(V0,K.frame_rate);R0(HI(K,X0,U0))}catch(U0){if(U0 instanceof E2){e(U0.model),d(null);return}console.error("[MultiTrackWidget] task-only smart split failed:",U0);let M0=U0 instanceof Error?U0.message:String(U0);try{Q.extensionManager.toast.add({severity:"error",summary:P0("multitrack.smartSplitFailed"),detail:M0,life:5000})}catch(h0){console.error("[MultiTrackWidget] failed to show smart split error:",h0)}}finally{l(!1)}}async function xh(X0,V0){let U0=K.tracks.find((M0)=>(M0.type==="video"||M0.type==="audio")&&M0.segments.some((h0)=>h0.id===X0))?.segments.find((M0)=>M0.id===X0);if(!U0||t)return;L(!1),S(!0);try{let M0=await BI(U0,K.frame_rate,V0);R0(UI(K,X0,M0))}catch(M0){if(M0 instanceof E2){e(M0.model),d(null);return}console.error("[MultiTrackWidget] subtitle recognition failed:",M0);let h0=M0 instanceof Error?M0.message:String(M0);try{Q.extensionManager?.toast?.add({severity:"error",summary:P0("multitrack.subtitleRecognitionFailed"),detail:h0,life:5000})}catch(j0){console.error("[MultiTrackWidget] failed to show subtitle recognition error:",j0)}}finally{S(!1)}}async function fh(X0,V0){if(X0.content.media_type!=="subtitle")return;L(!1);try{let U0=await _I({...V0,text:X0.content.text??""});R5("outputs");let M0=H.current;R0(LI(M0,{subtitleSegmentId:X0.id,startFrame:X0.start_frame,endFrame:X0.end_frame,filePath:U0.filePath,duration:U0.duration}));try{Q.extensionManager?.toast?.add({severity:"success",summary:P0("multitrack.subtitleSpeechComplete"),detail:U0.message||P0("multitrack.subtitleSpeechSaved",{path:U0.absolutePath||U0.filePath}),life:5000})}catch(h0){console.error("[MultiTrackWidget] failed to show subtitle speech success:",h0)}}catch(U0){if(U0 instanceof E2){e(U0.model),d(null);return}console.error("[MultiTrackWidget] subtitle speech generation failed:",U0);let M0=U0 instanceof Error?U0.message:String(U0);try{Q.extensionManager?.toast?.add({severity:"error",summary:P0("multitrack.subtitleSpeechFailed"),detail:M0,life:5000})}catch(h0){console.error("[MultiTrackWidget] failed to show subtitle speech error:",h0)}}}function vh(X0,V0){R0(TB(K,X0,V0))}function gh(){let X0=b8(B,K.frame_rate),V0=w.size>0?Array.from(w):K.tracks.flatMap((j0)=>j0.segments.filter((t0)=>X0>t0.start_frame&&X0t0.id));if(V0.length===0)return;let U0=K.tracks.reduce((j0,t0)=>j0+t0.segments.length,0),M0=V0.reduce((j0,t0)=>TB(j0,t0,X0),K);if(M0.tracks.reduce((j0,t0)=>j0+t0.segments.length,0)===U0)return;R0(M0)}function fF(X0){let V0=w.size>0?w:new Set(K.tracks.flatMap((U0)=>U0.segments.map((M0)=>M0.id)));return K.tracks.flatMap((U0)=>U0.segments.filter((M0)=>V0.has(M0.id)&&X0>M0.start_frame&&X0M0.id))}function lW(){let X0=b8(B,K.frame_rate);return fF(X0).length>0}function vF(X0){let V0=b8(B,K.frame_rate),U0=fF(V0);if(U0.length===0)return;let M0=U0.reduce((h0,j0)=>$0(h0,j0,X0,V0),K);R0(M0)}async function uh(){if(!K0||H0)return;q0(!0),d(null);try{let X0=await zI(K0.name);e(null);try{Q.extensionManager?.toast?.add({severity:"success",summary:P0("modelDownload.downloadComplete"),detail:P0("modelDownload.downloadCompleteDetail",{name:X0.display_name}),life:5000})}catch(V0){console.error("[MultiTrackWidget] failed to show model download success:",V0)}}catch(X0){let V0=X0 instanceof Error?X0.message:String(X0);d(V0)}finally{q0(!1)}}function mh(){if(!K0)return;for(let X0 of K0.urls??[K0.url])globalThis.open(X0,"_blank","noopener,noreferrer")}return G(y6.Provider,{value:u0,children:G(n1,{children:b("div",{className:"relative flex h-full w-full min-w-0 max-w-full flex-col overflow-hidden rounded text-foreground font-sans text-xs select-none","aria-busy":h||t,children:[G(AS,{data:K,currentTime:B,selectedSegment:L0,isPlaying:_,playbackNonce:i,node:Z,app:Q,editingSubtitleSegmentId:y,onSubtitleEditRequestHandled:()=>x(null),onSelectSegment:(X0)=>a0(X0),onGlobalSettingsChange:d1,onSelectedSegmentContentChange:A1,taskSegments:_0,selectedTaskSegments:B0?Q0:void 0,onTrackSegmentsContentChange:O1,onTaskTrackSegmentsChange:k5,onSelectedSegmentDurationChange:f8,onGenerateSubtitleSpeech:fh}),G(bI,{currentTime:B,totalLength:K.total_length,frameRate:K.frame_rate,isPlaying:_,zoom:F,snapEnabled:M,taskOverview:W,timelineCollapsed:N,onPlayPause:()=>L((X0)=>!X0),onZoomChange:V,onSnapEnabledChange:D,canAddTaskMarker:E1(),onAddTaskMarker:n,onTaskOverviewChange:v0,onToggleTimeline:()=>O((X0)=>!X0),canDelete:w.size>0,onDeleteSelected:()=>{if(T)L5(T)},onCutAtCurrentTime:gh,canTrimCenter:lW(),canTrimLeft:lW(),canTrimRight:lW(),onTrimLeftAtCurrentTime:()=>vF("start"),onTrimRightAtCurrentTime:()=>vF("end"),canUndo:g,canRedo:a,onUndo:w0,onRedo:F0}),G("div",{"data-testid":"multitrack-timeline-panel","aria-hidden":N,className:`grid shrink-0 transition-[grid-template-rows] duration-300 ease-in-out ${N?"grid-rows-[0fr]":"grid-rows-[1fr]"}`,children:G("div",{className:"min-h-0 shrink-0 overflow-hidden",children:G("div",{ref:r,className:"no-scrollbar shrink-0 overflow-x-auto overflow-y-hidden",children:b("div",{className:"min-h-full",style:{width:o,minWidth:"100%"},children:[G(tY,{totalLength:K.total_length,frameRate:K.frame_rate,width:o,canvasScale:G0,currentTime:B,taskMarkers:K.task_markers??[],selectedTaskMarkerId:I,onSeek:K1,onSelectTaskMarker:(X0)=>{Z1(null),k(X0)},onMoveTaskMarker:O0,onDeleteTaskMarker:D0}),G(cS,{data:K,node:Z,app:Q,width:o,currentTime:B,snapEnabled:M,canvasScale:G0,selectedSegmentIds:w,taskOverview:W,onAddVideo:i0,onAddAudio:G1,onReplaceAudio:h1,onAddTrack:i1,onAddSubtitleSegment:y1,onImportSubtitles:t1,onReplaceVideo:F1,onAddTaskSegment:r1,onSelectSegment:a0,onSelectSegments:T1,onClearSelection:v1,onDeleteSegment:L5,onDeleteTrack:Y0,onReorderTrack:C0,onTrackVisibilityChange:r0,onTrackAudioSettingsChange:x0,onSharedReferenceChange:E0,onDistributeTaskSegments:z0,onCloneTaskSegment:A0,canMergeSelectedTaskSegments:W0,onMergeSelectedTaskSegments:f0,onSplitTaskSegment:P,onResizeSegment:Q1,onResizeSegmentPreview:c0,onMoveSegment:D1,onSmartSplit:Y6,onSmartSplitTasks:pW,onRecognizeSubtitles:xh,onEditSubtitleSegment:x,cutMode:!1,onCutSegment:vh,format:p.format})]})})})}),h?G("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-background/80","data-testid":"smart-split-overlay",role:"status","aria-live":"polite",children:b("div",{className:"flex items-center gap-2 rounded border border-border bg-background px-3 py-2 text-foreground shadow-sm",children:[G(X6,{className:"h-4 w-4 animate-spin"}),G("span",{children:P0("multitrack.smartSplitting")})]})}):null,t?G("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-background/80","data-testid":"subtitle-recognition-overlay",role:"status","aria-live":"polite",children:b("div",{className:"flex items-center gap-2 rounded border border-border bg-background px-3 py-2 text-foreground shadow-sm",children:[G(X6,{className:"h-4 w-4 animate-spin"}),G("span",{children:P0("multitrack.recognizingSubtitles")})]})}):null,G(IS,{segment:N0,frameRate:K.frame_rate,open:Boolean(j),onOpenChange:(X0)=>{if(!X0)P(null)},onConfirm:$1}),K0?G("div",{className:"absolute inset-0 z-[60] flex items-center justify-center bg-background/90 p-4","data-testid":"missing-model-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"missing-model-title",children:b("div",{className:"w-full max-w-md rounded border border-border bg-background p-4 text-foreground shadow-sm",children:[b("div",{className:"flex items-start justify-between gap-3",children:[b("div",{className:"min-w-0",children:[G("h3",{id:"missing-model-title",className:"text-sm font-semibold",children:P0("modelDownload.title",{name:K0.display_name})}),G("p",{className:"mt-2 text-xs leading-5 text-muted-foreground",children:P0("modelDownload.description",{name:K0.display_name,directory:n0})})]}),G(k0,{type:"button",variant:"ghost",size:"icon",onClick:()=>e(null),"aria-label":P0("modelDownload.close"),disabled:H0,children:G(o9,{className:"h-4 w-4"})})]}),G("div",{className:"mt-3 rounded border border-border bg-muted px-2 py-1.5 font-mono text-[8px] leading-4 text-foreground break-all",children:K0.path}),E?G("p",{className:"mt-3 text-xs leading-5 text-destructive",children:E}):null,b("div",{className:"mt-4 flex flex-wrap justify-end gap-2",children:[b(k0,{type:"button",variant:"outline",size:"sm",onClick:mh,disabled:H0,children:[G(lS,{className:"h-4 w-4"}),P0("modelDownload.manual")]}),b(k0,{type:"button",size:"sm",onClick:uh,disabled:H0,children:[H0?G(X6,{className:"h-4 w-4 animate-spin"}):G(hW,{className:"h-4 w-4"}),H0?P0("modelDownload.downloading"):P0("modelDownload.auto")]})]})]})}):null]})})})}var x$=R(v(),1);var h$=25;function ut($){if($?.source_type==="output")return"outputs";if($?.source_type==="local")return"local";if($?.source_type==="url")return"url";return"inputs"}function mt($,J){if(J)return J;return/^https?:\/\//i.test($)?"url":"input"}function ct({value:$,onChange:J,app:Q}){let Z=Q?.ui?.settings?.settingsValues?.["Comfy.Locale"],X=($&&Array.isArray($.images)?$:{images:[]}).images.slice(0,h$),[Y,z]=x$.useState(!1),[K,W]=x$.useState(null),[H,B]=x$.useState(null),[U,_]=x$.useState(!1),L=x$.useRef(null),F=n9(Q),V=Boolean(Q?.ui?.settings?.settingsValues?.["Comfy.VueNodes.Enabled"]),M=X.find((T)=>T.id===K),D=Math.min(5,Math.max(1,Math.ceil(Math.sqrt(X.length+(X.lengthxJ(y,mt(y,A)));O(K?X.map((y)=>y.id===K?{...C[0],id:K}:y):[...X,...C]),W(null),z(!1)}async function k(T){if(!T?.length)return;let A=Array.from(T).filter((y)=>y.type.startsWith("image/")).slice(0,h$-X.length),w=await Promise.allSettled(A.map(b7)),C=[];for(let y of w)if(y.status==="fulfilled")C.push(y.value);else console.error("[MultiImagesLoaderWidget] image upload failed:",y.reason);if(C.length)R5("inputs"),O([...X,...C])}return G(y6.Provider,{value:Z,children:G(dt,{images:X,columns:D,controlSize:N,isNodeV2:V,selectorOpen:Y,setSelectorOpen:z,replaceId:K,setReplaceId:W,activeImage:M,preview:H,setPreview:B,dragOver:U,setDragOver:_,dragId:L,commit:O,select:I,dropFiles:k})})}function dt($){let J=X1(),{images:Q,columns:Z,controlSize:q}=$,X=$.preview&&Q5({...$.preview,source_type:$.preview.source_type??"input"}),Y=Qz($.preview?.id??null,()=>$.setPreview(null));return b("div",{className:`relative flex h-full min-h-0 w-full flex-col overflow-hidden rounded-md bg-muted/20 text-foreground ${$.isNodeV2?"nodeNew":""}`,onDragOver:(z)=>{z.preventDefault(),$.setDragOver(!0)},onDragLeave:(z)=>{if(!z.currentTarget.contains(z.relatedTarget))$.setDragOver(!1)},onDrop:(z)=>{z.preventDefault(),$.setDragOver(!1),$.dropFiles(z.dataTransfer.files)},children:[b(a1,{open:$.selectorOpen,onOpenChange:(z)=>{if($.setSelectorOpen(z),!z)$.setReplaceId(null)},children:[Q.length===0?b("div",{className:`task-image-picker-empty relative flex h-full min-h-0 w-full flex-1 flex-col items-center justify-center gap-2 rounded-md px-4 py-2 text-foreground shadow-sm ${$.dragOver?"border border-primary bg-accent/20":"bg-muted/20"}`,children:[G(Vz,{className:"size-12 shrink-0"}),G("span",{className:"mt-1 text-base font-semibold",children:J("multitrack.selectImage")}),G("span",{className:"max-w-full whitespace-normal text-center text-sm text-muted-foreground",children:J("multitrack.imageDropHint")}),G(T5,{asChild:!0,children:G(k0,{type:"button",variant:"ghost",className:"absolute inset-0 h-full w-full cursor-pointer rounded-md p-0 hover:bg-accent/20 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring","aria-label":J("multitrack.selectImage"),onClick:()=>$.setReplaceId(null)})})]}):G(_6,{asChild:!0,children:b("div",{className:`task-image-grid grid h-full min-h-0 w-full flex-1 auto-rows-max content-start gap-2 overflow-y-auto rounded-md p-3 transition-colors ${$.dragOver?"border border-primary bg-accent/20":"bg-muted/20"}`,style:{gridTemplateColumns:`repeat(${Z}, minmax(0, 1fr))`},children:[Q.map((z,K)=>{let W=Q5({...z,source_type:z.source_type??"input"}),H=z.file_name??z.file_path??z.local_path??z.url??String(K+1);return b("div",{className:"group relative aspect-square min-w-0 w-full self-start overflow-hidden rounded-md border border-border bg-black",draggable:!0,onDragStart:()=>{$.dragId.current=z.id},onDragEnd:()=>{$.dragId.current=null},onDrop:(B)=>{if(B.dataTransfer.files.length>0||!$.dragId.current)return;B.preventDefault(),B.stopPropagation(),$.setDragOver(!1);let U=$.dragId.current;if(U===z.id)return;let _=[...Q],L=_.findIndex((M)=>M.id===U);if(L<0)return;let F=_.findIndex((M)=>M.id===z.id),[V]=_.splice(L,1);_.splice(F,0,V),$.commit(_)},children:[G(k0,{variant:"ghost",className:"absolute inset-0 h-full w-full rounded-none p-0","aria-label":J("multiImagesLoader.replace",{n:K+1}),onClick:()=>{$.setReplaceId(z.id),$.setSelectorOpen(!0)},children:W?G("img",{src:W,alt:H,className:"h-full w-full object-contain",draggable:!1}):G("span",{className:"px-1 text-xs text-image-tile-foreground",children:H})}),G("span",{className:"pointer-events-none absolute bottom-0 left-0 bg-black/50 px-1.5 text-[10px] text-image-tile-foreground",children:K+1}),b("div",{className:"absolute right-1 top-1 flex gap-1 opacity-0 group-hover:opacity-100 group-focus-within:opacity-100",children:[G(k0,{variant:"secondary",size:"icon",style:{width:q,height:q},"aria-label":J("multiImagesLoader.preview"),onClick:()=>$.setPreview(z),children:G(T7,{})}),G(k0,{variant:"destructive",size:"icon",style:{width:q,height:q},"aria-label":J("multiImagesLoader.delete"),onClick:()=>$.commit(Q.filter((B)=>B.id!==z.id)),children:G(M5,{})})]})]},z.id)}),Q.length{$.setReplaceId(null),$.setSelectorOpen(!0)},children:G(z5,{})})]})}),G(s1,{className:"w-auto p-0",align:"start",children:G(V5,{value:$.activeImage?.file_path??$.activeImage?.local_path??$.activeImage?.url??"",mediaType:"image",defaultTab:ut($.activeImage),allowMultipleSelection:!$.replaceId,maxSelectionCount:$.replaceId?1:h$-Q.length,onChange:$.select},$.replaceId??"add")})]}),Q.length>0&&b("div",{className:"flex h-9 shrink-0 items-center justify-between gap-2 border-t border-border bg-background/60 px-3 text-xs",children:[G("span",{className:"text-muted-foreground",children:J("multiImagesLoader.imageCount",{n:Q.length})}),b(k0,{type:"button",variant:"ghost",size:"sm",className:"h-7 gap-1 px-2 text-xs text-destructive hover:text-destructive",onClick:()=>{$.setSelectorOpen(!1),$.setReplaceId(null),$.setPreview(null),$.commit([])},children:[G(M5,{className:"size-3.5"}),J("multiImagesLoader.clearAll")]})]}),X&&b("div",{"data-testid":"multi-images-expanded-preview","data-zoom":Y.zoom.toFixed(2),className:"absolute inset-0 z-30 flex items-center justify-center overflow-hidden bg-black p-3 pt-12",onWheel:Y.onWheel,children:[b(k0,{type:"button",variant:"secondary",className:"absolute left-2 top-2 z-20 h-8 cursor-pointer gap-1.5 px-2.5 text-xs","aria-label":J("multitrack.backToPreview"),onClick:()=>$.setPreview(null),children:[G(bW,{className:"h-4 w-4"}),G("span",{children:J("multitrack.backToPreview")})]}),b("span",{className:"pointer-events-none absolute right-2 top-2 z-20 rounded bg-background/70 px-2 py-1 text-[10px] tabular-nums text-foreground",children:[Math.round(Y.zoom*100),"%"]}),G("img",{ref:Y.imageRef,src:X,alt:$.preview?.file_name??$.preview?.file_path??$.preview?.url??"",className:"max-h-full max-w-full object-contain transition-transform duration-100 ease-out",style:{transform:`scale(${Y.zoom})`,transformOrigin:`${Y.origin.x}% ${Y.origin.y}%`},draggable:!1})]})]})}var j1=R(v(),1);var XX=R(v(),1);function Bh($,J,Q,Z,q,X){let Y=$?Math.max($.startTime,Math.min($.endTime,$.currentTime)):void 0,z=$?.isPlaying,K=XX.useCallback((W)=>{if(!W||Y===void 0)return;let H=Number.isFinite(W.duration)?Math.min(Y,W.duration):Y;try{if(!z||Math.abs(W.currentTime-H)>0.12)W.currentTime=H;if(z&&Number.isFinite(W.duration)&&Y>=W.duration)W.pause();else if(z&&W.paused)W.play()?.catch((B)=>{console.error("[CompareVideoWidget] failed to resume parent playback:",B),X()})}catch(B){console.error("[CompareVideoWidget] failed to follow parent playback:",B)}},[X,z,Y]);return XX.useEffect(()=>{if(Y===void 0)return;Z(Y),K(J.current),K(Q.current)},[Q,Z,J,K,Y]),XX.useEffect(()=>{if(z===void 0)return;if(z)q();else X()},[X,q,z]),K}var jF={save_output:!1,filename_prefix:"ComfyUI",watch_output_history:!1,compare_mode:"compare",source:null,output:null},pt=50,lt=new Set([".mp4",".webm",".mov",".avi",".mkv",".flv",".wmv",".m4v"]);function Uh($){if(!$?.filename)return null;let J=$.type??"temp",Q=$.subfolder??"";return`/view?filename=${encodeURIComponent($.filename)}&type=${encodeURIComponent(J)}&subfolder=${encodeURIComponent(Q)}`}function _h($){if(!$||typeof $!=="object")return null;let J=$,Q=J.source_type??J.type,Z=Q==="input"||Q==="output"||Q==="temp"||Q==="url"?Q:void 0,q=typeof J.file_path==="string"?J.file_path:typeof J.path==="string"?J.path:void 0,Y=(typeof J.url==="string"?J.url:void 0)??q??"";if(!Y.trim())return null;if(Z==="url"||/^https?:\/\//i.test(Y))return{source_type:"url",url:Y};if(!Z||!q)return null;return{source_type:Z,file_path:q}}function xW($){if(!$)return null;let{source_type:J,file_path:Q,url:Z}=$;if(J==="url"||/^https?:\/\//i.test(Z??Q??""))return Z??Q??null;if((J==="input"||J==="output"||J==="temp")&&Q)return X9(Q,J);return null}function wh($){if(!$)return"";return $.file_path??$.url??""}function it($,J){if($?.source_type==="url")return"url";if($?.source_type==="output")return"outputs";return J==="output"?"outputs":"inputs"}function EF($){let J=wh($);return J.split(/[\\/]/).pop()||J}function yF($){return $.path?`${$.source_type}:${$.path}`:null}function rt($,J){if(!$||typeof $!=="object")return null;let Q=$,Z=typeof Q.filename==="string"?Q.filename:"",q=Q.type==="output"||Q.type==="temp"?Q.type:void 0;if(!Z||!q)return null;if(Z.toLowerCase().includes("easy_compare"))return null;let X=Z.lastIndexOf(".");if(X<=0)return null;let Y=Z.slice(X).toLowerCase();if(!lt.has(Y))return null;let z=typeof Q.subfolder==="string"?Q.subfolder.replaceAll("\\","/"):"",K=z?`${z}/${Z}`:Z;return{type:"file",name:Z,path:K,url:X9(K,q),size:0,mtime:J,source_type:q}}function st($){if(!$||typeof $!=="object")return[];let J=$.output;if(!J||typeof J!=="object")return[];let Q=J,Z=[],q=new Set,X=Date.now();for(let Y of["video","images"]){let z=Q[Y];if(!Array.isArray(z))continue;for(let K of z){let W=rt(K,X);if(!W)continue;let H=yF(W);if(!H||q.has(H))continue;q.add(H),Z.push(W),X+=1}}return Z}function ot($){return{source_type:"output",file_path:$}}function nt($){return{source_type:"temp",file_path:$}}function Lh($,J){if(!$&&!J)return!0;if(!$||!J)return!1;return $.source_type===J.source_type&&$.file_path===J.file_path&&$.url===J.url}function YX($){if(!$)return null;let J=$.file_path??$.url??"";return J?`${$.source_type}:${J}`:null}function at($){return $.source_type==="temp"?nt($.path):ot($.path)}function tt($,J,Q=new Set){let Z=[],q=new Set;for(let W of J){let H=at(W),B=YX(H);if(!B||q.has(B))continue;q.add(B),Z.push(H)}let X=Q.has("source")&&$.source!=null,Y=Q.has("output")&&$.output!=null,z=X?$.source??null:Y?Z.find((W)=>YX(W)!==YX($.output))??null:Z.length>=2?Z[1]:null,K=Y?$.output??null:X?Z.find((W)=>YX(W)!==YX(z))??null:Z.length>=1?Z[0]:null;return{source:z,output:K}}function fW($){if(Array.isArray($)){for(let J of $){let Q=fW(J);if(Q)return Q}return null}if(!$||typeof $!=="object")return null;return $}function et($){if(!$||typeof $!=="object")return{...jF};let J=$,Q=J.compare_mode,Z=Q==="source"||Q==="compare"||Q==="side-by-side"||Q==="output"?Q:"compare";return{save_output:J.save_output===!0,filename_prefix:typeof J.filename_prefix==="string"?J.filename_prefix:jF.filename_prefix,watch_output_history:J.watch_output_history===!0,compare_mode:Z,source:_h(J.source),output:_h(J.output)}}function $e($){if(!$||typeof $!=="object")return null;let J=$,Q=fW(J.compare_videos);if(Q)return Q;let Z=J.output;if(Z&&typeof Z==="object"){let X=fW(Z.compare_videos);if(X)return X}let q=J.ui;if(q&&typeof q==="object"){let X=fW(q.compare_videos);if(X)return X}return null}function Je($,J){if(!$||typeof $!=="object")return!0;let Q=$.node;if(Q===void 0||Q===null||J.id===void 0||J.id===null)return!0;return String(Q)===String(J.id)}function Fh($){if(!Number.isFinite($)||$<0)return"0:00";let J=Math.floor($/60),Q=Math.floor($%60);return`${J}:${Q.toString().padStart(2,"0")}`}function bF($,J){if(!$||!Number.isFinite(J))return;try{$.currentTime=J}catch(Q){console.error("[CompareVideoWidget] failed to seek video:",Q)}}function Qe({app:$,node:J,value:Q,onChange:Z}){let q=$?.ui?.settings?.settingsValues?.["Comfy.Locale"],X=J,Y=et(Q);return G(y6.Provider,{value:q,children:G(Ih,{app:$,node:X,settings:Y,onSettingsChange:Z})})}var kh=j1.memo(function({app:J,sourceUrl:Q,outputUrl:Z,pausePlaybackNonce:q,parentPlayback:X}){let Y=J?.ui?.settings?.settingsValues?.["Comfy.Locale"],[z,K]=j1.useState("side-by-side"),W=j1.useMemo(()=>({...jF,compare_mode:z,source:{source_type:"url",url:Q},output:{source_type:"url",url:Z}}),[z,Z,Q]);return G(y6.Provider,{value:Y,children:G(Ih,{app:J,node:{},settings:W,onSettingsChange:(H)=>K(H.compare_mode??"side-by-side"),allowMediaSelection:!1,bindNodeEvents:!1,pausePlaybackNonce:q,parentPlayback:X})})});function Vh({settings:$,onSettingsChange:J}){let Q=X1();return b("div",{className:"flex w-64 flex-col gap-3",children:[b("div",{className:"flex items-center gap-2",children:[b(k0,{type:"button",variant:"ghost",role:"checkbox","aria-checked":$.save_output,disabled:$.watch_output_history,className:b0("h-auto flex-1 cursor-pointer justify-start gap-2 px-0 py-1 hover:bg-transparent",$.watch_output_history&&"cursor-not-allowed opacity-50"),onClick:()=>J({...$,save_output:!$.save_output}),children:[G("span",{className:b0("flex h-4 w-4 shrink-0 items-center justify-center rounded-sm border border-border",$.save_output&&"border-primary bg-primary text-primary-foreground"),children:$.save_output?G(T9,{className:"h-3 w-3"}):null}),G("span",{className:"text-left",children:Q("compareVideo.saveOutput")})]}),b(k0,{type:"button",variant:"ghost",role:"checkbox","aria-checked":$.watch_output_history,className:"h-auto flex-1 cursor-pointer justify-start gap-2 px-0 py-1 hover:bg-transparent",onClick:()=>{let Z=!$.watch_output_history;J({...$,watch_output_history:Z,source:Z?null:$.source,output:Z?null:$.output,save_output:Z?!1:$.save_output})},children:[G("span",{className:b0("flex h-4 w-4 shrink-0 items-center justify-center rounded-sm border border-border",$.watch_output_history&&"border-primary bg-primary text-primary-foreground"),children:$.watch_output_history?G(T9,{className:"h-3 w-3"}):null}),G(Oh,{className:"h-3.5 w-3.5 text-muted-foreground"}),G("span",{className:"text-left",children:Q("compareVideo.watchOutputHistory")})]})]}),b("label",{className:"flex flex-col gap-1.5 text-xs text-muted-foreground",children:[G("span",{children:Q("compareVideo.filenamePrefix")}),G($6,{value:$.filename_prefix,disabled:$.watch_output_history,placeholder:"ComfyUI","aria-label":Q("compareVideo.filenamePrefix"),onChange:(Z)=>J({...$,filename_prefix:Z.currentTarget.value})})]})]})}function Mh({slot:$,selection:J,disabled:Q=!1,watchHistory:Z=!1,onSelect:q,onClear:X}){let Y=X1(),[z,K]=j1.useState(!1),W=EF(J),H=$==="source"?Y("compareVideo.source"):Y("compareVideo.output"),B=$==="source"?Y("compareVideo.selectSource"):Y("compareVideo.selectOutput"),U=$==="source"?Y("compareVideo.clearSource"):Y("compareVideo.clearOutput");return b("div",{className:"flex items-center gap-1",children:[b(a1,{open:z,onOpenChange:(_)=>{if(Q)return;K(_)},children:[G(T5,{asChild:!0,children:b(k0,{type:"button",variant:"secondary",size:"sm",disabled:Q,className:b0("h-7 gap-1.5 border-border/50 bg-muted/60 px-2 text-foreground shadow",Q?"cursor-not-allowed opacity-50":"cursor-pointer hover:bg-muted/90"),"aria-label":W?`${H}: ${W}`:B,children:[G(Nh,{className:"h-3.5 w-3.5"}),G("span",{className:"max-w-36 truncate text-[11px]",children:W||B})]})}),G(s1,{className:"w-auto p-0",align:$==="source"?"start":"end",children:G(V5,{value:wh(J),mediaType:"video",defaultTab:Z?"history":it(J,$),historySource:"combined",historyOnly:Z,onChange:(_,L)=>{if(L===void 0)q(_,L),K(!1)},onSourceChange:(_)=>{q(_.filePath,_.sourceType),K(!1)}},`${$}-${W||"empty"}`)})]}),J?G(k0,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 cursor-pointer bg-muted/60 text-foreground shadow hover:bg-muted/90","aria-label":U,disabled:Q,onClick:X,children:G(o9,{className:"h-3.5 w-3.5"})}):null]})}function Ih({app:$,node:J,settings:Q,onSettingsChange:Z,allowMediaSelection:q=!0,bindNodeEvents:X=!0,pausePlaybackNonce:Y,parentPlayback:z}){let K=X1(),W=n9($),H=j1.useRef(null),B=j1.useRef(null),U=j1.useRef(null),[_,L]=j1.useState(()=>J.__easyMediaCompareVideos??null),[F,V]=j1.useState(Q.compare_mode??"compare"),[M,D]=j1.useState(50),[N,O]=j1.useState(!1),[I,k]=j1.useState(!1),[T,A]=j1.useState(!1),w=T||z?.muted===!0,[C,y]=j1.useState(0.75),[x,j]=j1.useState(0),[P,h]=j1.useState(0),l=j1.useRef(Q),t=j1.useRef(z);t.current=z;let S=j1.useRef(Z),i=j1.useRef(new Set),J0=j1.useRef(Q.watch_output_history);l.current=Q,S.current=Z;let K0=j1.useMemo(()=>xW(Q.source)??(Q.watch_output_history?null:Uh(_?.source)),[_,Q.source,Q.watch_output_history]),e=j1.useMemo(()=>xW(Q.output)??(Q.watch_output_history?null:Uh(_?.output)),[_,Q.output,Q.watch_output_history]),H0=Boolean(K0),q0=Boolean(e),E=H0||q0,d=H0&&q0,c=z?.isPlaying?z.endTime:q0?P:Math.max(_?.duration??0,P,0),r=d?F:H0?"source":"output",u=d&&r==="side-by-side",m=r==="source"?100:r==="output"?0:u?50:M,s=r!=="compare"||!N;j1.useEffect(()=>{if(!X)return;function g(u0){let P0=$e(u0);if(!P0)return;J.__easyMediaCompareVideos=P0,L(P0),j(0),k(!1),h(0)}let a=J.onExecuted,I0=function(P0){a?.call(this,P0),g(P0)};J.onExecuted=I0;let w0=$.api,F0=(u0)=>{if(!Je(u0.detail,J))return;g(u0.detail)};return w0?.addEventListener?.("executed",F0),w0?.addCustomEventListener?.("executed",F0),()=>{if(J.onExecuted===I0)J.onExecuted=a;w0?.removeEventListener?.("executed",F0),w0?.removeCustomEventListener?.("executed",F0)}},[$.api,X,J]),j1.useEffect(()=>{if(H.current)H.current.muted=w||q0,H.current.volume=C;if(B.current)B.current.muted=w,B.current.volume=C},[q0,w,C]),j1.useEffect(()=>{if(d)V(Q.compare_mode??"compare");else if(H0)V("source");else if(q0)V("output")},[d,q0,H0,Q.compare_mode]),j1.useEffect(()=>{let g=J0.current;if(J0.current=Q.watch_output_history,Q.watch_output_history&&!g)i.current.clear();else if(!Q.watch_output_history&&g)J.__easyMediaCompareVideos=null,L(null),j(0),h(0)},[J,Q.watch_output_history]),j1.useEffect(()=>{if(!Q.watch_output_history)return;let g=[],a=[],I0=new Set;function w0(){let R0=l.current;if(!R0.watch_output_history)return;let{source:Z1,output:K1}=tt(R0,g,i.current);if(Lh(R0.source,Z1)&&Lh(R0.output,K1))return;S.current({...R0,source:Z1,output:K1}),j(0),h(0),k(!1)}function F0(R0){let Z1=st(R0.detail);if(Z1.length===0)return;for(let K1 of Z1){let a0=yF(K1);if(!a0||I0.has(a0))continue;I0.add(a0),a.push(K1)}}function u0(){a=[],I0=new Set}function P0(){let R0=[...a].reverse(),Z1=[],K1=new Set;for(let a0 of[...R0,...g]){let T1=yF(a0);if(!T1||K1.has(T1))continue;K1.add(T1),Z1.push(a0)}g.splice(0,g.length,...Z1.slice(0,pt)),a=[],I0=new Set,w0()}let n0=$.api;return n0?.addEventListener?.("execution_start",u0),n0?.addEventListener?.("executed",F0),n0?.addEventListener?.("execution_success",P0),n0?.addCustomEventListener?.("execution_start",u0),n0?.addCustomEventListener?.("executed",F0),n0?.addCustomEventListener?.("execution_success",P0),()=>{n0?.removeEventListener?.("execution_start",u0),n0?.removeEventListener?.("executed",F0),n0?.removeEventListener?.("execution_success",P0),n0?.removeCustomEventListener?.("execution_start",u0),n0?.removeCustomEventListener?.("executed",F0),n0?.removeCustomEventListener?.("execution_success",P0)}},[$.api,Q.watch_output_history]);let f=j1.useCallback((g)=>{bF(H.current,g),bF(B.current,g)},[]),o=j1.useCallback(()=>{k(!0);for(let g of[H.current,B.current]){if(!g)continue;let a=t.current;if(a?.isPlaying&&Number.isFinite(g.duration)&&a.currentTime>=g.duration)continue;if(!g.paused)continue;let I0=g.play();if(I0)I0.catch((w0)=>{console.error("[CompareVideoWidget] failed to play video:",w0),k(!1)})}},[]),G0=j1.useCallback(()=>{k(!1),H.current?.pause(),B.current?.pause()},[]);j1.useEffect(()=>{if(Y===void 0)return;G0()},[Y,G0]);let p=Bh(z,H,B,j,o,G0);j1.useEffect(()=>{let g=H.current,a=B.current;return()=>{g?.pause(),a?.pause()}},[K0,e]),j1.useEffect(()=>{if(!X)return;return J.__easyMediaSyncPlay=()=>{f(0),j(0),o()},()=>{if(J.__easyMediaSyncPlay)delete J.__easyMediaSyncPlay}},[X,J,o,f]);function Z0(g){if(!d||r!=="compare")return;let a=U.current?.getBoundingClientRect();if(!a)return;let I0=W>0?W:1,w0=(g.clientX-a.left)/I0,F0=a.width/I0,u0=F0>0?w0/F0*100:50;D(Math.max(0,Math.min(100,u0)))}function Q0(g){if(z?.isPlaying)return;let a=g.currentTarget,I0=B.current??H.current;if(a!==I0)return;j(a.currentTime);let w0=a===H.current?B.current:H.current;if(w0&&Math.abs(w0.currentTime-a.currentTime)>0.08)bF(w0,a.currentTime)}function B0(g){if(z?.isPlaying){g.currentTarget.pause();return}if(f(0),j(0),I)o()}function W0(g){let a=g[0]??0;if(z?.isPlaying){z.onSeek(Math.max(z.startTime,Math.min(z.endTime,a)));return}j(a),f(a)}function L0(){V((g)=>{let a="compare";if(g==="compare")a="side-by-side";else if(g==="side-by-side")a="source";else if(g==="source")a="output";return Z({...Q,compare_mode:a}),a})}function _0(g,a,I0){let w0=/^https?:\/\//i.test(a),F0=I0==="output"?"output":I0==="temp"?"temp":I0==="input"?"input":w0?"url":"input",u0=F0==="url"?{source_type:"url",url:a}:{source_type:F0,file_path:a},P0={...Q,[g]:u0},n0=g==="source"?P0.output:P0.source;if(Q.watch_output_history)i.current.add(g);if(Z(P0),j(0),h(0),k(!1),xW(u0)&&xW(n0))V(P0.compare_mode??"compare")}function N0(g){if(Q.watch_output_history)i.current.delete(g);Z({...Q,[g]:null}),j(0),h(0),k(!1)}function d0(){let g=Q.watch_output_history?EF(Q.output):_?.output?.filename??EF(Q.output);if(!e||!g)return;try{let a=document.createElement("a");a.href=e,a.download=g,a.rel="noopener",document.body.appendChild(a),a.click(),a.remove()}catch(a){console.error("[CompareVideoWidget] failed to download output video:",a)}}return G(n1,{children:b("div",{className:"group relative h-full min-h-[320px] w-full overflow-hidden rounded border border-border bg-background text-foreground",children:[b("div",{ref:U,className:"relative h-full min-h-[320px] overflow-hidden bg-black",onPointerEnter:()=>O(!0),onPointerMove:(g)=>{Z0(g)},onPointerLeave:()=>{if(O(!1),r==="compare")D(50)},onPointerCancel:()=>{if(O(!1),r==="compare")D(50)},children:[K0?G("video",{ref:H,className:b0("absolute inset-0 h-full w-full object-contain",!H0&&"invisible",u&&"right-auto w-1/2"),"data-compare-video-panel":u?"source":void 0,src:K0,loop:!z?.isPlaying,muted:w||q0,playsInline:!0,preload:"auto",onLoadedMetadata:(g)=>{let a=g.currentTarget.duration||0;if(!q0)h(a);p(g.currentTarget)},onTimeUpdate:Q0,onEnded:B0}):null,e?G("video",{ref:B,className:b0("absolute inset-0 h-full w-full object-contain",!q0&&"invisible",u&&"left-1/2 w-1/2"),style:{clipPath:u?void 0:`inset(0 0 0 ${m}%)`,transition:!u&&s?"clip-path 260ms ease":void 0},"data-compare-video-panel":u?"output":void 0,src:e,loop:!z?.isPlaying,muted:w,playsInline:!0,preload:"auto",onLoadedMetadata:(g)=>{let a=g.currentTarget.duration||0;h(a),p(g.currentTarget)},onTimeUpdate:Q0,onEnded:B0}):null,!E?b("div",{className:"absolute inset-0 z-20 flex flex-col items-center justify-center gap-4 bg-background p-4 pt-12",children:[G(Vh,{settings:Q,onSettingsChange:Z}),G("p",{className:"text-xs text-muted-foreground mt-2",children:K("compareVideo.empty")})]}):null,q?b(W1,{children:[G("div",{className:"absolute left-3 top-2 z-30",children:G(Mh,{slot:"source",selection:Q.source,watchHistory:Q.watch_output_history,onSelect:(g,a)=>_0("source",g,a),onClear:()=>N0("source")})}),G("div",{className:"absolute right-3 top-2 z-30",children:G(Mh,{slot:"output",selection:Q.output,watchHistory:Q.watch_output_history,onSelect:(g,a)=>_0("output",g,a),onClear:()=>N0("output")})})]}):null,d&&(r==="compare"||u)?G("div",{className:"pointer-events-none absolute inset-y-0 w-px bg-white shadow",style:{left:`${m}%`,transition:s?"left 260ms ease":void 0}}):null,d?b(k0,{type:"button",className:"absolute left-1/2 top-2 z-30 -translate-x-1/2 cursor-pointer bg-muted/60 text-foreground shadow hover:bg-muted/90",onClick:L0,onPointerDown:(g)=>g.stopPropagation(),size:"sm",variant:"secondary",children:[r==="source"||r==="output"?G(_J,{className:"h-4 w-4"}):G(Dh,{className:"h-4 w-4"}),r==="source"?K("compareVideo.sourceOnly"):r==="output"?K("compareVideo.outputOnly"):r==="side-by-side"?K("compareVideo.sideBySide"):K("compareVideo.compare")]}):null]}),b("div",{"data-compare-video-toolbar":!0,className:"@container/compare-video-controls pointer-events-none absolute inset-x-0 bottom-0 z-10 grid translate-y-full grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-2 border-t border-border bg-background/90 px-1 opacity-0 shadow-sm backdrop-blur-sm transition-[opacity,transform] duration-300 ease-out @max-[420px]/compare-video-controls:grid-cols-[minmax(0,1fr)_auto] @max-[420px]/compare-video-controls:gap-x-1 @max-[420px]/compare-video-controls:gap-y-0 @max-[420px]/compare-video-controls:px-2 @max-[420px]/compare-video-controls:py-1 group-hover:pointer-events-auto group-hover:translate-y-0 group-hover:opacity-100 group-focus-within:pointer-events-auto group-focus-within:translate-y-0 group-focus-within:opacity-100",children:[G("div",{"data-compare-video-playback":!0,className:"@max-[420px]/compare-video-controls:col-start-1 @max-[420px]/compare-video-controls:row-start-2",children:b(B1,{children:[G(U1,{asChild:!0,children:G(k0,{type:"button",variant:"ghost",size:"icon",className:"cursor-pointer",onClick:()=>{if(I){if(G0(),z?.isPlaying)z.onPause()}else o()},"aria-label":I?K("compareVideo.pause"):K("compareVideo.play"),children:I?G(M7,{className:"h-4 w-4"}):G(E4,{className:"h-4 w-4"})})}),G(H1,{children:I?K("compareVideo.pause"):K("compareVideo.play")})]})}),b("div",{"data-compare-video-seek":!0,className:"grid min-w-0 grid-cols-[auto_minmax(4rem,1fr)_auto] items-center gap-2 @max-[420px]/compare-video-controls:col-span-2 @max-[420px]/compare-video-controls:col-start-1 @max-[420px]/compare-video-controls:row-start-1 @max-[420px]/compare-video-controls:w-full @max-[420px]/compare-video-controls:px-1 @max-[420px]/compare-video-controls:py-1",children:[G("span",{className:"w-10 text-right text-[11px] tabular-nums text-muted-foreground",children:Fh(x)}),G("div",{className:"min-w-0",children:G(N8,{className:"w-full",value:[Math.min(x,c||x)],min:z?.isPlaying?z.startTime:0,max:Math.max(c,x,0.01),step:0.01,onValueChange:W0,"aria-label":K("compareVideo.seek")})}),G("span",{className:"w-10 text-[11px] tabular-nums text-muted-foreground",children:Fh(c)})]}),b("div",{"data-compare-video-actions":!0,className:"flex items-center gap-2 @max-[420px]/compare-video-controls:col-start-2 @max-[420px]/compare-video-controls:row-start-2 @max-[420px]/compare-video-controls:gap-1",children:[b(B1,{children:[G(U1,{asChild:!0,children:G(k0,{type:"button",variant:"ghost",size:"icon",className:"cursor-pointer",onClick:()=>A((g)=>!g),"aria-label":T?K("compareVideo.unmute"):K("compareVideo.mute"),children:T?G(TJ,{className:"h-4 w-4"}):G(t9,{className:"h-4 w-4"})})}),G(H1,{children:T?K("compareVideo.unmute"):K("compareVideo.mute")})]}),G("div",{"data-compare-video-volume":!0,children:G(N8,{className:"w-20",value:[C],min:0,max:1,step:0.01,onValueChange:(g)=>y(g[0]??0),"aria-label":K("compareVideo.volume")})}),q?b(a1,{children:[G(T5,{asChild:!0,children:G(k0,{type:"button",variant:"ghost",size:"icon",className:"cursor-pointer","aria-label":K("compareVideo.settings"),children:G(Ah,{className:"h-4 w-4"})})}),G(s1,{align:"end",className:"w-auto",children:G(Vh,{settings:Q,onSettingsChange:Z})})]}):null,q&&q0?b(B1,{children:[G(U1,{asChild:!0,children:G(k0,{type:"button",variant:"ghost",size:"icon",className:"cursor-pointer","aria-label":K("compareVideo.downloadOutput"),onClick:d0,children:G(hW,{className:"h-4 w-4"})})}),G(H1,{children:K("compareVideo.downloadOutput")})]}):null]})]})]})})}var X7=R(v(),1);var G2={minimax:"h3-context-ir (海螺官方)",volcengine:"doubao-seed-2-0-pro-260215 (火山引擎)",zhipu:"glm-5v-turbo (智谱)",runningHubDoubao:"bytedance/doubao-seed-2.0-pro (RunningHub)",runningHubGlm:"glm-5v-turbo (RunningHub)",local:"llama.cpp (本地)"},vW=new Map;function Ze($){if(!$||typeof $!=="object")throw Error("RunningHub returned an invalid account response.");let J=$;if(typeof J.error==="string")throw Error(J.error);let Q=Number(J.amount);if(!Number.isFinite(Q))throw Error("RunningHub account response did not contain a valid balance.");return{amount:Q,currency:typeof J.currency==="string"?J.currency:"CNY"}}var Th=[{id:"minimax",modelNames:[G2.minimax],balancePageUrl:"https://platform.minimaxi.com/console/recharge-records",apiKeyPageUrl:"https://platform.minimaxi.com/console/access?tab=api-keys"},{id:"volcengine",modelNames:[G2.volcengine],balancePageUrl:"https://console.volcengine.com/finance/",apiKeyPageUrl:"https://console.volcengine.com/ark/region:ark+cn-beijing/apiKey"},{id:"zhipu",modelNames:[G2.zhipu],balancePageUrl:"https://open.bigmodel.cn/usercenter/financial/balance",apiKeyPageUrl:"https://open.bigmodel.cn/usercenter/apikeys"},{id:"runninghub",modelNames:[G2.runningHubDoubao,G2.runningHubGlm],balancePageUrl:"https://www.runninghub.cn/call-api/bill-task?tab=llmLogs&inviteCode=rh-v1623",apiKeyPageUrl:"https://www.runninghub.cn/zh-cn/enterprise-api/sharedApi?inviteCode=rh-v1623",balanceRequest:{url:"/easy-media/prompt-enhancer/runninghub-balance",refreshIntervalMs:30000,createInit:($)=>({method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({api_key:$})}),readBalance:Ze}},{id:"local",modelNames:[G2.local]}];function PF($){return Th.find((J)=>J.modelNames.includes($))??Th[0]}async function bh($,J){let Q=$.balanceRequest;if(!Q)throw Error("The selected provider does not expose a balance API.");let Z=`${$.id}:${J}`,q=vW.get(Z);if(q?.request)return q.request;if(q?.completedAt!==void 0&&Date.now()-q.completedAt{let Y=await fetch(Q.url,Q.createInit(J));if(!Y.ok)throw Error(`Balance request failed with status ${Y.status}.`);let z=await Y.json();return Q.readBalance(z)})();vW.set(Z,{request:X});try{let Y=await X;return vW.set(Z,{balance:Y,completedAt:Date.now()}),Y}catch(Y){throw vW.set(Z,{error:Y,completedAt:Date.now()}),Y}}function gW($){let J=$;while(Array.isArray(J)&&J.length===1)J=J[0];return J}function jh($,J){let Q=gW($);if(!Q||typeof Q!=="object")return"";let Z=gW(Q[J]);return typeof Z==="string"?Z:""}function uW($){let J=$.widgets??[],Q=J.find((X)=>X.name==="model")?.value,Z=gW(J.find((X)=>X.name==="model.model")?.value??Q),q=gW(J.find((X)=>X.name==="model.apikey")?.value??J.find((X)=>X.name==="apikey")?.value);return{modelName:typeof Z==="string"?Z:jh(Q,"model")||G2.minimax,apiKey:typeof q==="string"?q:jh(Q,"apikey")}}function RF($){globalThis.open($,"_blank","noopener,noreferrer")}function Eh($,J){try{return new Intl.NumberFormat(J||void 0,{style:"currency",currency:$.currency,minimumFractionDigits:2,maximumFractionDigits:2}).format($.amount)}catch(Q){return console.error("[PromptEnhancerAccountBar] failed to format balance:",Q),`${$.amount.toFixed(2)} ${$.currency}`}}function qe({apiKey:$,locale:J,modelName:Q,refreshToken:Z=0}){let q=X1(),X=PF(Q),[Y,z]=X7.useState(null),[K,W]=X7.useState(!1),[H,B]=X7.useState(!1);if(X7.useEffect(()=>{let _=X.balanceRequest,L=$.trim();if(z(null),W(!1),B(Boolean(_)),!_)return;let F=!1;return(async()=>{try{let M=await bh(X,L);if(!F)z(M)}catch(M){if(F)return;console.error("[PromptEnhancerAccountBar] failed to load balance:",M),W(!0)}finally{if(!F)B(!1)}})(),()=>{F=!0}},[$,X,Z]),X.id==="local")return G("div",{className:"flex h-[30px] items-center border-t border-border px-2 text-[10px] text-muted-foreground",children:q("promptEnhancerAccount.localModel")});return b("div",{className:"flex h-[30px] min-w-0 items-center justify-between gap-2",children:[G("div",{className:"min-w-0",children:(()=>{if(!X.balanceRequest)return G(k0,{className:"h-6 px-1.5 text-[10px] cursor-pointer",onClick:()=>X.balancePageUrl&&RF(X.balancePageUrl),size:"sm",type:"button",variant:"link",children:q("promptEnhancerAccount.viewBalance")});if(H)return b(kJ,{className:"h-5 gap-1 px-1.5 text-[10px]",variant:"outline",children:[G(X6,{className:"size-3 animate-spin"}),q("promptEnhancerAccount.loadingBalance")]});if(Y)return G(kJ,{className:"h-5 max-w-full truncate px-1.5 text-[10px] cursor-pointer",title:Eh(Y,J),variant:"secondary",onClick:()=>X.balancePageUrl&&RF(X.balancePageUrl),children:q("promptEnhancerAccount.balance",{amount:Eh(Y,J)})});let _=K?q("promptEnhancerAccount.balanceUnavailable"):q("promptEnhancerAccount.apiKeyRequired");return G(kJ,{className:"h-5 px-1.5 text-[10px]",title:_,variant:"outline",children:q("promptEnhancerAccount.balanceEmpty")})})()}),X.apiKeyPageUrl?b(k0,{className:"h-6 shrink-0 px-1.5 text-[10px] cursor-pointer",onClick:()=>X.apiKeyPageUrl&&RF(X.apiKeyPageUrl),size:"sm",type:"button",variant:"outline",children:[G(yh,{className:"size-1"}),q("promptEnhancerAccount.apiKey")]}):null]})}function Xe($){return G(y6.Provider,{value:$.locale,children:G(qe,{...$})})}function Ye({app:$,node:J}){let Q=J,[Z,q]=X7.useState(()=>uW(Q)),[X,Y]=X7.useState(0);return X7.useEffect(()=>{let z=!0,K=Q.onConfigure,W=Q.onExecuted,H=Q.onWidgetChanged,B=()=>{queueMicrotask(()=>{if(!z)return;let F=uW(Q);q((V)=>V.modelName===F.modelName&&V.apiKey===F.apiKey?V:F)})},U=function(F){K?.call(this,F),B()},_=function(F){W?.call(this,F);let V=uW(Q);if(PF(V.modelName).id==="runninghub")Y((M)=>M+1)},L=function(F,V,M,D){if(H?.call(this,F,V,M,D),F==="model"||F==="model.model"||F==="model.apikey"||F==="apikey")B()};return Q.onConfigure=U,Q.onExecuted=_,Q.onWidgetChanged=L,B(),()=>{if(z=!1,Q.onConfigure===U)Q.onConfigure=K;if(Q.onExecuted===_)Q.onExecuted=W;if(Q.onWidgetChanged===L)Q.onWidgetChanged=H}},[Q]),G(Xe,{apiKey:Z.apiKey,locale:$?.ui?.settings?.settingsValues?.["Comfy.Locale"],modelName:Z.modelName,refreshToken:X})}var N1=R(v(),1);var mW=R(v(),1);function Ph($){let J=mW.useRef($);J.current=$,mW.useEffect(()=>{function Q(){if(document.visibilityState==="hidden")J.current()}function Z(){J.current()}return document.addEventListener("visibilitychange",Q),window.addEventListener("pagehide",Z),()=>{document.removeEventListener("visibilitychange",Q),window.removeEventListener("pagehide",Z)}},[])}var hh=1,ze=100,CF="h-6 w-6 shrink-0 [&_svg]:size-3.5",cW=Symbol("drop-prompt-input");function SF($){if(!$||typeof $!=="object"||Array.isArray($))return WX;let J=$;return{project_name:typeof J.project_name==="string"?J.project_name:"default",width:Number.isFinite(J.width)?Math.max(0,Number(J.width)):0,height:Number.isFinite(J.height)?Math.max(0,Number(J.height)):0,frame_rate:Number.isFinite(J.frame_rate)&&Number(J.frame_rate)>0?Number(J.frame_rate):24,clips:Array.isArray(J.clips)?J.clips:[],auto_combine:J.auto_combine!==!1,updated_at:J.updated_at}}function Ke($){let J=$.graph?.links;if(!J)return[];if(Array.isArray(J))return J.filter(Boolean);if(J instanceof Map)return[...J.values()].filter(Boolean);return Object.values(J).filter(Boolean)}function Ge($,J,Q){let Z=new Set(Object.keys(Q));for(let q of $.graph?._nodes??[])if(q.id!=null)Z.add(String(q.id));if(J&&typeof J==="object"&&"nodes"in J&&Array.isArray(J.nodes)){for(let q of J.nodes)if(q&&typeof q==="object"&&"id"in q&&q.id!=null)Z.add(String(q.id))}return Z}function hF($,J,Q){if(Array.isArray($)&&$.length===2&&(typeof $[0]==="string"||typeof $[0]==="number")&&typeof $[1]==="number"&&Q.has(String($[0])))return J.has(String($[0]))?$:cW;if(Array.isArray($))return $.flatMap((Z)=>{let q=hF(Z,J,Q);return q===cW?[]:[q]});if($&&typeof $==="object")return Object.fromEntries(Object.entries($).flatMap(([Z,q])=>{let X=hF(q,J,Q);return X===cW?[]:[[Z,X]]}));return $}function We($){let J=String($.id??""),Q=new Set(J?[J]:[]),Z=J?[J]:[],q=Ke($);while(Z.length>0){let X=Z.shift();for(let Y of q){if(String(Y.origin_id??"")!==X||Y.target_id==null)continue;let z=String(Y.target_id);if(Q.has(z))continue;Q.add(z),Z.push(z)}}return Q}function dW($){return Math.max(hh,$.source_end_frame-$.source_start_frame)}function Rh($){return $.filter((J)=>J.enabled!==!1).reduce((J,Q)=>J+dW(Q),0)}function zX($,J){let Q=0;for(let Z of $){if(Z.enabled===!1)continue;let q=Q+dW(Z);if(JQ.file_path===$.file_path)?J:[{file_path:$.file_path,file_name:$.file_name,media_revision:$.media_revision,source_frame_count:$.source_frame_count},...J]}function Sh($,J){let Q=Math.max(hh,J.source_frame_count),Z=Math.min($.source_start_frame,Q-1);return{...$,file_path:J.file_path,file_name:J.file_name,media_revision:J.media_revision,source_start_frame:Z,source_end_frame:Math.max(Z+1,Math.min($.source_end_frame,Q)),source_frame_count:Q,continuity_mode:J.continuity_mode??$.continuity_mode}}function Ue({value:$,onChange:J,app:Q,node:Z}){let q=SF($),X=Q?.ui?.settings?.settingsValues?.["Comfy.Locale"],Y=N1.useCallback((n,D0)=>SW(X,n,D0),[X]),[z,K]=N1.useState(0),[W,H]=N1.useState(!1),[B,U]=N1.useState(!1),[_,L]=N1.useState(1),[F,V]=N1.useState(!1),[M,D]=N1.useState(!1),[N,O]=N1.useState(!1),[I,k]=N1.useState(null),[T,A]=N1.useState(!1),[w,C]=N1.useState(["default"]),[y,x]=N1.useState(null),[j,P]=N1.useState({}),[h,l]=N1.useState(0),[t,S]=N1.useState(0),i=N1.useRef(new Map),J0=N1.useRef(0),K0=N1.useRef(0),e=N1.useRef(0),H0=N1.useRef(0),q0=N1.useRef(null),E=N1.useRef(null),d=N1.useRef(0),c=N1.useRef(!1),r=N1.useRef(q);r.current=q;let u=n9(Q),s=Math.max(1,OJ(E))*_,f=Rh(q.clips),o=zX(q.clips,Math.min(z,Math.max(0,f-1))),G0=o?Ch(o.clip):null,p=q.clips.filter((n)=>n.enabled!==!1),Z0=o?p.findIndex((n)=>n.id===o.clip.id):-1,Q0=Z0>=0&&p.length>1?p[(Z0+1)%p.length]:void 0,B0=Q0?Ch(Q0):null,W0=w.includes(q.project_name)||!q.project_name?w:[...w,q.project_name];function L0(n){let D0=new Set(GX(n).map((v0)=>v0.file_path));if(D0.size===1)return[...D0];let O0=[...new Set(j[n.id]??[])].filter((v0)=>D0.has(v0)).slice(0,2);return O0.includes(n.file_path)?O0:[n.file_path]}let _0=o?L0(o.clip).map((n)=>GX(o.clip).find((D0)=>D0.file_path===n)).filter((n)=>Boolean(n)):[],N0=_0.length===2?_0.map(Be):[],d0=N0.length===2&&N0.every(Boolean);function g(n){Z1(He(q.clips,n.id))}function a(n,D0){let O0=n.video_files?.find((v0)=>v0.file_path===D0);if(!O0)return;J({...q,clips:q.clips.map((v0)=>v0.id===n.id?Sh(v0,O0):v0)}),I0(n,O0)}async function I0(n,D0){let O0=q.project_name||"default";try{let v0=await Q.api.fetchApi("/easy-media/project/video",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({project_name:O0,segment_index:n.index,file_path:D0.file_path})}),i0;try{i0=await v0.json()}catch(G1){if(!(G1 instanceof SyntaxError))throw G1;throw Error(Y("projectVideoCombine.selectClipFileFailed"))}if(!v0.ok)throw Error(KX(i0,Y("projectVideoCombine.selectClipFileFailed")))}catch(v0){Q.extensionManager.toast.add({severity:"error",summary:Y("projectVideoCombine.selectClipFileFailed"),detail:v0 instanceof Error?v0.message:String(v0),life:5000}),F0(O0,!1)}}function w0(n,D0){let O0=L0(n),v0=O0.includes(D0);if(v0&&O0.length===1)return;if(!v0&&O0.length>=2)return;let i0=v0?O0.filter((G1)=>G1!==D0):[...O0,D0];if(P((G1)=>({...G1,[n.id]:i0})),g(n),i0[0]!==n.file_path)a(n,i0[0])}let F0=N1.useCallback(async(n,D0=!0)=>{if(!n||c.current)return;let O0=++d.current;if(D(!0),n!==q.project_name)H(!1),K(0),x(null),P({}),J({...WX,project_name:n,auto_combine:q.auto_combine});try{let i0=await Q.api.fetchApi(`/easy-media/project?project_name=${encodeURIComponent(n)}`),G1=await i0.json();if(!i0.ok&&i0.status===404&&n==="default"){if(O0!==d.current)return;J({...WX,project_name:"default",auto_combine:q.auto_combine});return}if(!i0.ok)throw Error(KX(G1,Y("projectVideoCombine.refreshFailed")));if(O0!==d.current)return;J({...SF(G1),auto_combine:q.auto_combine})}catch(i0){if(D0&&O0===d.current)Q.extensionManager.toast.add({severity:"error",summary:Y("projectVideoCombine.refreshFailed"),detail:i0 instanceof Error?i0.message:String(i0),life:5000})}finally{if(O0===d.current)D(!1)}},[Q,q.auto_combine,q.project_name,J,Y]),u0=N1.useCallback(async()=>{try{let n=await Q.api.fetchApi("/easy-media/projects"),D0=await n.json();if(!n.ok)throw Error(KX(D0,Y("projectVideoCombine.projectListFailed")));let O0=D0&&typeof D0==="object"&&"projects"in D0&&Array.isArray(D0.projects)?D0.projects.filter((v0)=>typeof v0==="string"&&v0.length>0):[];C(O0.includes("default")?O0:["default",...O0])}catch(n){Q.extensionManager.toast.add({severity:"error",summary:Y("projectVideoCombine.projectListFailed"),detail:n instanceof Error?n.message:String(n),life:5000})}},[Q,Y]);async function P0(n,D0){if(c.current)return;c.current=!0,k(D0.file_path);let O0=q.project_name||"default";try{if(!await Q.extensionManager.dialog.confirm({title:Y("projectVideoCombine.deleteClipFileTitle"),message:Y("projectVideoCombine.deleteClipFileConfirm",{file:D0.file_name})}))return;++d.current,D(!1);let i0=await Q.api.fetchApi("/easy-media/project/video",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({project_name:O0,segment_index:n.index,file_path:D0.file_path})}),G1;try{G1=await i0.json()}catch(r0){if(!(r0 instanceof SyntaxError))throw r0;if(i0.status===404||i0.status===405)throw Error(Y("projectVideoCombine.deleteClipFileUnavailable"));throw Error(Y("projectVideoCombine.deleteClipFileInvalidResponse",{status:i0.status}))}if(!i0.ok)throw Error(KX(G1,Y("projectVideoCombine.deleteClipFileFailed")));if(!G1||typeof G1!=="object"||!("project_name"in G1)||G1.project_name!==O0||!("clips"in G1)||!Array.isArray(G1.clips))throw Error(Y("projectVideoCombine.deleteClipFileInvalidResponse",{status:i0.status}));let h1=r.current;if((h1.project_name||"default")!==O0)return;let i1=SF(G1),Y0=i1.clips.find((r0)=>r0.id===n.id),C0={...h1,updated_at:i1.updated_at,clips:h1.clips.flatMap((r0)=>{if(r0.id!==n.id)return[r0];if(!Y0)return[];let E0=GX(Y0),r1=[r0.file_path,...j[r0.id]??[]].map((y1)=>E0.find((t1)=>t1.file_path===y1)).find((y1)=>y1!==void 0)??E0.find((y1)=>y1.file_path===Y0.file_path);return[Sh({...r0,video_files:E0},r1)]})};P((r0)=>{let E0={...r0},F1=C0.clips.find((t1)=>t1.id===n.id);if(!F1)return delete E0[n.id],E0;let r1=new Set(GX(F1).map((t1)=>t1.file_path)),y1=[...new Set(r0[n.id]??[])].filter((t1)=>r1.has(t1));return E0[n.id]=r1.size>1&&y1.length===2&&y1.includes(F1.file_path)?y1:[F1.file_path],E0}),H(!1),S((r0)=>r0+1),l((r0)=>r0+1);let x0=Math.min(J0.current,Math.max(0,Rh(C0.clips)-1));J0.current=x0,K(x0),x(zX(C0.clips,x0)?.clip.id??null),J(C0)}catch(v0){Q.extensionManager.toast.add({severity:"error",summary:Y("projectVideoCombine.deleteClipFileFailed"),detail:v0 instanceof Error?v0.message:String(v0),life:5000})}finally{c.current=!1,k(null)}}async function n0(){let n=q.project_name||"default",D0=!1;try{D0=await Q.extensionManager.dialog.confirm({title:Y("projectVideoCombine.deleteProjectTitle"),message:Y(n==="default"?"projectVideoCombine.deleteDefaultProjectConfirm":"projectVideoCombine.deleteProjectConfirm",{project:n})})}catch(O0){Q.extensionManager.toast.add({severity:"error",summary:Y("projectVideoCombine.deleteProjectFailed"),detail:O0 instanceof Error?O0.message:String(O0),life:5000});return}if(!D0)return;O(!0),D(!1),++d.current;try{let O0=await Q.api.fetchApi(`/easy-media/project?project_name=${encodeURIComponent(n)}`,{method:"DELETE"}),v0=await O0.json();if(!O0.ok)throw Error(KX(v0,Y("projectVideoCombine.deleteProjectFailed")));H(!1),K(0),x(null),P({}),C((i0)=>n==="default"?i0:i0.filter((G1)=>G1!==n)),J({...WX,project_name:"default",auto_combine:q.auto_combine}),Q.extensionManager.toast.add({severity:"success",summary:Y("projectVideoCombine.deleteProjectSuccess"),detail:Y("projectVideoCombine.deleteProjectSuccessDetail",{project:n}),life:4000})}catch(O0){Q.extensionManager.toast.add({severity:"error",summary:Y("projectVideoCombine.deleteProjectFailed"),detail:O0 instanceof Error?O0.message:String(O0),life:5000})}finally{O(!1)}}N1.useEffect(()=>{if(q.clips.length===0)F0(q.project_name||"default",!1)},[]),N1.useEffect(()=>{let n=()=>void F0(q.project_name||"default",!1);return Q.api.addEventListener("execution_success",n),()=>Q.api.removeEventListener("execution_success",n)},[Q.api,q.project_name,F0]),N1.useEffect(()=>{let n=(D0)=>{let O0=D0.detail,v0=O0&&typeof O0==="object"&&"project_name"in O0?String(O0.project_name):"",i0=q.project_name||"default";F0(v0||i0,!1)};return Q.api.addCustomEventListener("easy_multitrack_project_refresh",n),()=>Q.api.removeCustomEventListener("easy_multitrack_project_refresh",n)},[Q.api,q.project_name,F0]),N1.useEffect(()=>{let n=(D0)=>{let O0=D0.detail;if(!O0||typeof O0!=="object")return;let v0="node_id"in O0?String(O0.node_id):"";if(v0&&v0!==String(Z.id??""))return;let i0="project_name"in O0?String(O0.project_name):"";if(i0)F0(i0,!1)};return Q.api.addCustomEventListener("easy-media.project.selected",n),()=>Q.api.removeCustomEventListener("easy-media.project.selected",n)},[Q.api,Z,F0]),N1.useEffect(()=>{let n=Z;return n.__easyMediaSyncPlay=(D0,O0)=>{if(typeof O0==="boolean")U(O0);J0.current=0,K(0),x(zX(q.clips,0)?.clip.id??null),l((v0)=>v0+1),H(!0)},()=>{delete n.__easyMediaSyncPlay}},[q.clips,Z]),N1.useEffect(()=>{J0.current=z},[z]);let R0=N1.useCallback(()=>{if(q0.current!==null)cancelAnimationFrame(q0.current),q0.current=null;for(let n of i.current.values())n.pause()},[]);Ph(()=>{R0(),K(J0.current),H(!1),S((n)=>n+1)}),N1.useEffect(()=>()=>R0(),[R0]),N1.useEffect(()=>{let n=Q.extensionManager.workflow,D0=n.activeWorkflow?.key??null;return n.$subscribe((O0,v0)=>{let i0=v0.activeWorkflow?.key??null;if(D0!==null&&i0!==null&&i0!==D0)R0(),K(J0.current),H(!1),S((G1)=>G1+1);D0=i0})},[Q.extensionManager.workflow,R0]),N1.useEffect(()=>{if(!W||f<=0){if(q0.current!==null)cancelAnimationFrame(q0.current);q0.current=null;return}e.current=performance.now(),H0.current=e.current,K0.current=J0.current>=f?0:J0.current;function n(D0){let O0=Math.floor((D0-e.current)/1000*q.frame_rate),v0=K0.current+O0;if(v0>=f)J0.current=0,K0.current=0,e.current=D0,K(0),x(zX(q.clips,0)?.clip.id??null),l((i0)=>i0+1);else if(v0!==J0.current){if(J0.current=v0,D0-H0.current>=ze)H0.current=D0,K(v0)}q0.current=requestAnimationFrame(n)}return q0.current=requestAnimationFrame(n),()=>{if(q0.current!==null)cancelAnimationFrame(q0.current);q0.current=null}},[q.clips,q.frame_rate,W,f]),N1.useEffect(()=>{let n=o?i.current.get(o.clip.id):void 0;if(!n||!o)return;let D0=(o.clip.source_start_frame+Math.max(0,J0.current-o.start))/q.frame_rate;try{if(Math.abs(n.currentTime-D0)>0.001)n.currentTime=D0}catch(O0){console.error("[ProjectVideoCombineWidget] failed to seek preview video:",O0)}},[o?.clip.id,G0,q.frame_rate,d0,h]),N1.useEffect(()=>{if(W)return;let n=o?i.current.get(o.clip.id):void 0;if(!n||!o)return;let D0=(o.clip.source_start_frame+Math.max(0,z-o.start))/q.frame_rate;try{if(Math.abs(n.currentTime-D0)>0.001)n.currentTime=D0}catch(O0){console.error("[ProjectVideoCombineWidget] failed to seek paused preview video:",O0)}},[o?.clip.id,G0,z,q.frame_rate,d0,W]),N1.useEffect(()=>{let n=Q0?i.current.get(Q0.id):void 0;if(!n||!Q0)return;let D0=Q0.source_start_frame/q.frame_rate;try{if(Math.abs(n.currentTime-D0)>0.001)n.currentTime=D0}catch(O0){console.error("[ProjectVideoCombineWidget] failed to preload the next preview video:",O0)}},[q.frame_rate,Q0?.id,B0]),N1.useEffect(()=>{let n=o?i.current.get(o.clip.id):void 0;if(!n||!o)return;for(let[D0,O0]of i.current)if(D0!==o.clip.id)O0.pause();if(W)n.play().catch((D0)=>{console.error("[ProjectVideoCombineWidget] failed to play preview video:",D0),H(!1)});else n.pause()},[o?.clip.id,G0,d0,W,h]);function Z1(n){let D0=Math.max(0,Math.min(f,Math.round(n)));if(J0.current=D0,W)K0.current=D0>=f?0:D0,e.current=performance.now();K(D0);let O0=zX(q.clips,Math.min(D0,Math.max(0,f-1)));x(O0?.clip.id??null)}function K1(){H((n)=>{if(n)K(J0.current);return!n})}async function a0(){let n=q.project_name||"default";try{let D0=await Q.api.getQueue();if(D0.Running.length>0||D0.Pending.length>0)throw Error(Y("projectVideoCombine.queueBusy"));A(!0);let O0=await Q.graphToPrompt(),v0=We(Z),i0=O0.output,G1=Ge(Z,O0.workflow,i0),h1=Object.fromEntries(Object.entries(i0).filter(([i1])=>v0.has(i1)).map(([i1,Y0])=>{let C0=hF(Y0.inputs??{},v0,G1),x0=C0===cW?{}:C0;if(i1===String(Z.id??""))x0.project_name=n,x0.project_data=JSON.stringify({...q,auto_combine:!0});return[i1,{...Y0,inputs:x0}]}));if(Object.keys(h1).length<2)throw Error(Y("projectVideoCombine.connectSaveNode"));await Q.api.queuePrompt(0,{...O0,output:h1}),Q.extensionManager.toast.add({severity:"info",summary:Y("projectVideoCombine.combineQueued"),detail:Y("projectVideoCombine.combineQueuedDetail",{project:n}),life:4000})}catch(D0){Q.extensionManager.toast.add({severity:"error",summary:Y("projectVideoCombine.combineFailed"),detail:D0 instanceof Error?D0.message:String(D0),life:6000})}finally{A(!1)}}function T1(n,D0){return b(B1,{children:[G(U1,{asChild:!0,children:G("span",{className:"inline-flex shrink-0",children:D0})}),G(H1,{children:n})]})}let v1=Math.max(1,s-Z5-C2),E1=Z5+Math.min(z,f)/Math.max(f,1)*v1;return G(y6.Provider,{value:X,children:G(n1,{children:b("div",{className:"flex h-full min-h-[520px] w-full flex-col overflow-hidden rounded-md border border-border bg-background text-foreground",children:[b("div",{className:"flex h-10 shrink-0 items-center justify-between border-b border-border px-2",children:[b("div",{className:"flex items-center gap-1",children:[b(E8,{disabled:I!==null,value:q.project_name||"default",onOpenChange:(n)=>{if(n)u0()},onValueChange:(n)=>void F0(n),children:[G(y8,{className:"h-7 w-32 text-xs","aria-label":Y("projectVideoCombine.selectProject"),children:G(W6,{})}),G(P8,{children:W0.map((n)=>G(l5,{value:n,children:n},n))})]}),T1(Y("projectVideoCombine.deleteProject"),G(k0,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive",disabled:N||M||I!==null,"aria-label":Y("projectVideoCombine.deleteProject"),onClick:()=>void n0(),children:N?G(X6,{className:"size-3.5 animate-spin"}):G(M5,{className:"size-3.5"})}))]}),b("div",{className:"flex items-center gap-2",children:[T1(Y("projectVideoCombine.refresh"),G(k0,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",disabled:M||I!==null,"aria-label":Y("projectVideoCombine.refresh"),onClick:()=>void F0(q.project_name||"default"),children:M?G(X6,{className:"size-3.5 animate-spin"}):G(PY,{className:"size-3.5"})})),b("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[G(WJ,{checked:q.auto_combine,onCheckedChange:(n)=>J({...q,auto_combine:n===!0})}),Y("projectVideoCombine.autoCombine")]}),b(k0,{type:"button",size:"sm",className:"h-7 gap-1.5 text-xs",disabled:T||I!==null||q.clips.length===0,onClick:()=>void a0(),children:[T?G(X6,{className:"size-3.5 animate-spin"}):G(E4,{className:"size-3.5"}),Y("projectVideoCombine.combine")]})]})]}),G("div",{className:"relative flex min-h-0 flex-1 items-center justify-center overflow-hidden bg-black p-3",children:d0?G(kh,{app:Q,sourceUrl:N0[0],outputUrl:N0[1],pausePlaybackNonce:t,parentPlayback:{isPlaying:W,currentTime:(o.clip.source_start_frame+z-o.start)/q.frame_rate,startTime:o.clip.source_start_frame/q.frame_rate,endTime:o.clip.source_end_frame/q.frame_rate,muted:B,onPause:()=>{K(J0.current),H(!1)},onSeek:(n)=>Z1(o.start+n*q.frame_rate-o.clip.source_start_frame)}},`${o.clip.id}:${N0.join("|")}`):G0?[{clip:o.clip,url:G0,visible:!0},...Q0&&B0?[{clip:Q0,url:B0,visible:!1}]:[]].map(({clip:n,url:D0,visible:O0})=>G("video",{ref:(v0)=>{if(v0)i.current.set(n.id,v0);else i.current.delete(n.id)},src:D0,preload:"auto",playsInline:!0,muted:!O0||B,"aria-hidden":!O0,className:O0?"h-full max-h-full w-full object-contain":"pointer-events-none absolute left-0 top-0 h-px w-px opacity-0"},n.id)):G("div",{className:"text-xs text-muted-foreground",children:Y("projectVideoCombine.emptyPreview")})}),b("div",{className:"grid h-9 shrink-0 grid-cols-[1fr_auto_1fr] items-center border-y border-border px-1 text-[10px]",children:[G("div",{className:"flex items-center",children:T1(B?Y("projectVideoCombine.unmutePreview"):Y("projectVideoCombine.mutePreview"),G(k0,{type:"button",variant:"ghost",size:"icon",className:CF,"aria-label":B?Y("projectVideoCombine.unmutePreview"):Y("projectVideoCombine.mutePreview"),"aria-pressed":B,onClick:()=>U((n)=>!n),children:B?G(TJ,{}):G(t9,{})}))}),b("div",{className:"flex items-center gap-2 text-muted-foreground",children:[G("span",{className:"w-16 text-right tabular-nums text-gradient",children:M6(z,{frameRate:q.frame_rate,showFrames:!0})}),G(k0,{type:"button",variant:"secondary",size:"icon",className:`${CF} rounded-full`,disabled:f===0,"aria-label":W?Y("multitrack.pause"):Y("multitrack.play"),onClick:K1,children:W?G(M7,{}):G(E4,{})}),G("span",{className:"w-16 tabular-nums",children:M6(f,{frameRate:q.frame_rate,showFrames:!0})})]}),b("div",{className:"ml-auto flex items-center gap-1",children:[T1(F?Y("multitrack.showTimeline"):Y("multitrack.hideTimeline"),G(k0,{type:"button",variant:"ghost",size:"icon",className:CF,"aria-label":F?Y("multitrack.showTimeline"):Y("multitrack.hideTimeline"),onClick:()=>V((n)=>!n),children:F?G($z,{}):G(Jz,{})})),G(t$,{className:"size-3.5 text-muted-foreground"}),G(N8,{min:1,max:6,step:0.25,value:[_],onValueChange:([n])=>L(n),className:"h-3 w-12","aria-label":Y("multitrack.timelineZoom")})]})]}),G("div",{ref:E,className:`no-scrollbar h-[104px] shrink-0 overflow-x-auto overflow-y-hidden bg-muted/20 ${F?"hidden":""}`,"aria-hidden":F,children:b("div",{style:{width:s,minWidth:"100%"},children:[G(tY,{totalLength:f,frameRate:q.frame_rate,width:s,canvasScale:u,currentTime:z,taskMarkers:[],selectedTaskMarkerId:null,onSeek:Z1,onSelectTaskMarker:()=>{},onMoveTaskMarker:()=>{},onDeleteTaskMarker:()=>{}}),b("div",{className:"relative h-20",style:{width:s},children:[G("div",{className:"absolute top-2 flex h-14 overflow-hidden rounded-sm border border-border bg-muted/40",style:{left:Z5,width:v1},children:q.clips.filter((n)=>n.enabled!==!1).map((n)=>{let O0=`h-full min-w-0 shrink-0 rounded-none border-r border-border px-2 ${y===n.id?"bg-primary/20 ring-1 ring-inset ring-primary":"bg-secondary/40 hover:bg-secondary/60"}`,v0={width:`${dW(n)/Math.max(f,1)*100}%`},i0=b("div",{className:"flex min-w-0 flex-col items-center leading-tight",children:[G("span",{className:"truncate text-[11px] font-medium",children:Y("projectVideoCombine.clipLabel",{number:n.index+1})}),G("span",{className:"truncate text-[9px] text-muted-foreground",children:Y("projectVideoCombine.clipContinuity",{mode:Y(n.continuity_mode==="shot"?"projectVideoCombine.continuityShot":n.continuity_mode==="context_swap"?"projectVideoCombine.continuityContextSwap":"projectVideoCombine.continuityContext")})})]}),G1=L0(n);return b(a1,{onOpenChange:(h1)=>{if(h1)g(n)},children:[G(T5,{asChild:!0,children:b(k0,{type:"button",variant:"ghost",className:`${O0} relative justify-center`,style:v0,"aria-label":Y("projectVideoCombine.selectClipFiles",{number:n.index+1}),children:[i0,b("span",{className:"absolute right-2 flex items-center gap-0.5 text-[9px] text-muted-foreground",children:[G1.length>1?G1.length:null,G(T4,{className:"size-3"})]})]})}),b(s1,{className:"w-64 p-1",align:"center",children:[G("div",{className:"px-2 py-1 text-[10px] text-muted-foreground",children:Y("projectVideoCombine.selectClipFilesHint")}),GX(n).map((h1)=>{let i1=G1.includes(h1.file_path),Y0=I!==null||!i1&&G1.length>=2;return b("div",{className:"flex items-center gap-1",children:[b(k0,{type:"button",variant:"ghost",role:"checkbox","aria-checked":i1,disabled:Y0,className:b0("h-8 min-w-0 flex-1 justify-start gap-2 px-2 text-xs",Y0&&"opacity-50"),onClick:()=>w0(n,h1.file_path),children:[G("span",{className:b0("flex size-4 shrink-0 items-center justify-center rounded-sm border border-border",i1&&"border-primary bg-primary text-primary-foreground"),children:i1?G(T9,{className:"size-3"}):null}),G("span",{className:"truncate",children:h1.file_name})]}),G(k0,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0 text-destructive hover:text-destructive",disabled:I!==null||N||M,"aria-label":Y("projectVideoCombine.deleteClipFile",{file:h1.file_name}),title:Y("projectVideoCombine.deleteClipFile",{file:h1.file_name}),onPointerDown:(C0)=>C0.stopPropagation(),onKeyDown:(C0)=>C0.stopPropagation(),onClick:(C0)=>{C0.preventDefault(),C0.stopPropagation(),P0(n,h1)},children:I===h1.file_path?G(X6,{className:"size-3.5 animate-spin"}):G(M5,{className:"size-3.5"})})]},h1.file_path)})]})]},n.id)})}),G("div",{className:"pointer-events-none absolute top-0 h-20 w-px bg-destructive",style:{left:E1}})]})]})})]})})})}export{Fp as TimelineWidget,_e as SamplingPreviewWidget,Ye as PromptEnhancerAccountWidget,Ue as ProjectVideoCombineWidget,gt as MultiTrackWidget,ct as MultiImagesLoaderWidget,Qe as CompareVideoWidget}; diff --git a/dist/release/chunks/index-9zskwz7p.js b/dist/release/chunks/index-9zskwz7p.js new file mode 100644 index 0000000..adb7ebe --- /dev/null +++ b/dist/release/chunks/index-9zskwz7p.js @@ -0,0 +1,2 @@ +import{rc as q}from"./index-6y5pqcvv.js";function O_(_){let $=Math.max(_.lastIndexOf("/"),_.lastIndexOf("\\"));return{filename:$>=0?_.slice($+1):_,subfolder:$>=0?_.slice(0,$):""}}function W_(_,$){let{filename:U,subfolder:A}=O_(_);return`/view?filename=${encodeURIComponent(U)}&type=${$}&subfolder=${encodeURIComponent(A)}`}function k_(_,$){if($===void 0||$==="")return _;let U=_.includes("?")?"&":"?";return`${_}${U}v=${encodeURIComponent(String($))}`}function X_(_){if(_.url)return _.url;if(_.local_path)return`file://${_.local_path}`;if(_.source_type!=="input"&&_.source_type!=="output")return null;if(!_.file_path)return null;let $=_.source_type==="output"?"output":"input";return W_(_.file_path,$)}function r(_,$=0){let U=_?.match(/(\d+)$/)?.[1];return U?Number(U):$+1}function i_(_){return X_(_)}var u=9,H_="|MULTIPLE|";function w(_){return Array.isArray(_)?_:[]}function a(_){return w(_).filter(($)=>$.muted!==!0)}function n_(_,$,U=0){let A=_.findIndex((M)=>M.id===$);if(A<0||_[A].muted===!0)return null;return U+_.slice(0,A+1).filter((M)=>M.muted!==!0).length-1}function m_(_,$){return r(_.slot_name,$)}function B(_){let $=_.source_type??"input",U=$==="slot"?_.slot_name:_.file_path??_.local_path??_.url??_.file_name;return`${$}:${U??_.id}`}function s_(_,$){let U=B($);return _.every((A)=>{let M=w(A.content.images);return M.some((j)=>B(j)===U)||M.length{let j=w(M.content.images),G=j.find((O)=>B(O)===A);if(U){let O=G?{...G,shared_reference:!0}:{...$,id:q(),shared_reference:!0,shared_reference_copy:!0};return{segmentId:M.id,images:[...j.filter((W)=>W.shared_reference===!0&&B(W)!==A),O,...j.filter((W)=>W.shared_reference!==!0&&B(W)!==A)].slice(0,u)}}return{segmentId:M.id,images:j.flatMap((O)=>{if(B(O)!==A)return[O];if(O.shared_reference_copy===!0)return[];let W={...O,shared_reference:!1};return delete W.shared_reference_copy,[W]})}})}function t(_){let $=_.filter((A)=>A.type==="task").flatMap((A)=>A.segments),U=new Map;for(let A of $)for(let M of w(A.content.images)){if(M.shared_reference!==!0)continue;let j=B(M);if(!U.has(j))U.set(j,M)}if(U.size===0)return _;return _.map((A)=>{if(A.type!=="task")return A;return{...A,segments:A.segments.map((M)=>{let j=w(M.content.images),G=Array.from(U.entries()).map(([W,X])=>{let Q=j.find((Y)=>B(Y)===W);return Q?{...Q,shared_reference:!0}:{...X,id:q(),shared_reference:!0,shared_reference_copy:!0}}),O=j.filter((W)=>!U.has(B(W)));return{...M,content:{...M.content,images:[...G,...O].slice(0,u)}}})}})}function a_(_,$){let U=_.startsWith("__slot__:")?"slot":$,A=U==="slot"?_.replace(/^__slot__:/,""):void 0,M=A??_.split(/[\\/]/).pop()??_;return{id:q(),source_type:U,file_path:U==="input"||U==="output"?_:void 0,local_path:U==="local"?_:void 0,url:U==="url"?_:void 0,slot_name:A,file_name:M}}function t_(_){return _.split(H_).filter(($)=>$.length>0)}async function e_(_){let $=new FormData;$.append("image",_);let U=await fetch("/upload/image",{method:"POST",body:$});if(!U.ok)throw Error(`Failed to upload image: ${_.name}`);let A=await U.json(),M=A.name??_.name,j=A.subfolder??"";return{id:q(),source_type:"input",file_path:j?`${j}/${M}`:M,file_name:M}}var V=24,J_=120,Q_=5,Y_=["default","ref","edit","l2v"],I="default",Z_=["shot","context","context_swap"],$_="shot",C_=["match","max"],U_="match",D=0,E_=-20,N_=6,A$=3,M$=[16,20,24,25,30,50,60],q_="Moxie Multimedia",A_="MiniMax";function M_(_){let $=(_??"").trim();return $===q_?A_:$}function j$(_){let $=M_(_);return $===A_||$===""}function G$(_,$=!1){if(_==="task")return $?64:30;if(_==="subtitle")return 30;return 64}function K$(_,$){let U=_.startsWith("__slot__:")?"slot":$==="input"&&/^https?:\/\//i.test(_)?"url":$,A=U==="slot"?_.replace(/^__slot__:/,""):void 0;return{media_type:"video",source_type:U,file_path:U==="input"||U==="output"?_:void 0,local_path:U==="local"?_:void 0,url:U==="url"?_:void 0,...A?{slot_name:A}:{},file_name:A??_.split(/[\\/]/).pop()??_}}function O$(_,$){let U=_.startsWith("__slot__:")?"slot":$==="input"&&/^https?:\/\//i.test(_)?"url":$;return{media_type:"audio",source_type:U,file_path:U==="input"||U==="output"?_:void 0,local_path:U==="local"?_:void 0,url:U==="url"?_:void 0,slot_name:U==="slot"?_.replace(/^__slot__:/,""):void 0,file_name:U==="slot"?_.replace(/^__slot__:/,""):_.split(/[\\/]/).pop()??_,muted:!1,volume_db:D}}function W$(_,$,U){let A=Math.max(1,_.end_frame-_.start_frame),M=Math.max(1,c($,U));return _.start_frame+Math.min(A,M)}var p={task:"var(--multitrack-task-bg)",video:"var(--primary)",audio:"var(--highlight)",subtitle:"var(--accent)"};function X$(_,$){return $(`multitrackTaskModes.${_}`)}function H$(_,$,U){if(_==="l2v")return"l2v";if(_==="ref")return U?"rv2v":"r2v";if(_==="edit")return $>0?"vi2v":"v2v";if($<=0)return"r2v";if($===1)return"i2v";if($===2)return"fl2v";return"fmlf2v"}function J$(_,$){if($.size<2)return null;let U=_.filter((H)=>H.type==="task"&&H.segments.some((Z)=>$.has(Z.id)));if(U.length!==1)return null;let A=U[0],M=[...A.segments].sort((H,Z)=>H.start_frame-Z.start_frame),j=M.flatMap((H,Z)=>$.has(H.id)?[Z]:[]);if(j.length!==$.size||j.length<2)return null;let G=j[0],O=j[j.length-1];if(O-G+1!==j.length)return null;let W=M.slice(G,O+1),X=W[0],Q=W.find((H)=>z_(H.content).trim().length>0||a(H.content.images).length>0)??X,Y={...X,start_frame:X.start_frame,end_frame:W[W.length-1].end_frame,content:{...Q.content}},J=new Set(W.map((H)=>H.id)),K=M.flatMap((H)=>{if(H.id===X.id)return[Y];return J.has(H.id)?[]:[H]});return{tracks:_.map((H)=>H.id===A.id?{...H,segments:K}:H),mergedSegmentId:Y.id}}function B_(_,$){if($<=0)return 0;return Math.round(_*$)}function R(_,$){if($<=0)return 0;return _/$}function b_(_){if(!Number.isFinite(_))return D;return Math.max(E_,Math.min(N_,_))}function Q$(_){return 10**((Number.isFinite(_)?_:D)/20)}function o(_){let $=m(_);return $===null?D:b_($)}function Y$(_,$){let U=$>0?$:V,A=Math.max(0,Math.round(_*U)),M=Math.floor(A/U),j=Math.floor(M/60),G=M%60,O=A%U;return[j,G,O].map((W)=>W.toString().padStart(2,"0")).join(":")}function Z$(_,$){if(!Number.isInteger($)||$<=0)return null;let U=/^(\d{2,}):([0-5]\d):(\d{2})$/.exec(_.trim());if(!U)return null;let A=Number.parseInt(U[1],10),M=Number.parseInt(U[2],10),j=Number.parseInt(U[3],10);if(j>=$)return null;let G=A*60+M+j/$;return G>0?G:null}function C$(_,$={}){let U=$.frameRate&&$.frameRate>0?$.frameRate:0,A=Math.max(0,$.showFrames?Math.round(_):Math.floor(_)),M=$.showFrames&&U>0?Math.floor(A/U):U>0?Math.floor(A/U):Math.floor(A),j=Math.floor(M/3600),G=Math.floor(M%3600/60),O=M%60,X=($.showHours===!1?Math.floor(M/60):G).toString().padStart(2,"0"),Q=O.toString().padStart(2,"0");if($.showFrames&&U>0){let Y=(A%U).toString().padStart(2,"0");if($.showHours!==!1&&j>0)return`${j.toString().padStart(2,"0")}:${X}:${Q}:${Y}`;return`${X}:${Q}:${Y}`}if($.showHours!==!1&&j>0)return`${j.toString().padStart(2,"0")}:${X}:${Q}`;return`${X}:${Q}`}function b(_,$){return Math.max(0,Math.round(_))}function E$(_,$,U,A,M,j){let G=_.tracks.flatMap((K)=>K.segments).find((K)=>K.id===$);if(!G)return A;let O=b(A,_.frame_rate),W=Math.max(0,Math.round(M));if(W<=0)return O;let X=new Set([0,_.total_length]);if(typeof j==="number"&&Number.isFinite(j))X.add(b(j,_.frame_rate));for(let K of _.tracks)for(let H of K.segments){if(H.id===$)continue;X.add(H.start_frame),X.add(H.end_frame)}let Q=U==="start"?G.end_frame:G.start_frame,Y=O,J=W+1;for(let K of X){if(U==="start"&&K>=Q)continue;if(U==="end"&&K<=Q)continue;let H=Math.abs(O-K);if(H>W||H>=J)continue;Y=K,J=H}return Y}function N$(_,$,U,A,M){let j=_.tracks.flatMap((K)=>K.segments).find((K)=>K.id===$);if(!j)return U;let G=b(U,_.frame_rate),O=Math.max(0,Math.round(A));if(O<=0)return G;let W=N(j),X=G+W,Q=new Set([0,_.total_length]);if(typeof M==="number"&&Number.isFinite(M))Q.add(b(M,_.frame_rate));for(let K of _.tracks)for(let H of K.segments){if(H.id===$)continue;Q.add(H.start_frame)}let Y=G,J=O+1;for(let K of Q){let H=Math.abs(G-K);if(H<=O&&HO||Z>=J)continue;Y=C,J=Z}return Y}function c(_,$){return Math.max(0,B_(_,$))}function S(_,$,U){return c(R(_,$),U)}function N(_){return Math.max(0,_.end_frame-_.start_frame)}function v(_,$=V){let U=Math.max(1,Math.round($)),A=Q_*U,M=L_(_);return M>0?M:A}var q$=v;function L_(_){return _.flatMap(($)=>$.segments).reduce(($,U)=>Math.max($,U.end_frame),0)}function y_(_,$,U,A){return _U}function V_(_){return typeof _==="string"&&Y_.includes(_)}function j_(_){return V_(_)?_:I}function D_(_){return typeof _==="string"&&Z_.includes(_)?_:$_}function w_(_){return typeof _==="string"&&C_.includes(_)?_:U_}function G_(_,$,U=I){let A=_.filter((j)=>j.start_frame<$).sort((j,G)=>G.start_frame-j.start_frame)[0],M=A?.content.system_prompt;return{task_mode:A?.content.task_mode??U,continuity_mode:A?.content.continuity_mode??$_,ref_image_size:A?.content.ref_image_size??U_,...M?{system_prompt:M}:{}}}function p_(_,$){return _.filter((U)=>{return U.start_frame+N(U)/2<$}).length}function f(_,$,U){let A=[..._].sort((j,G)=>j.start_frame-G.start_frame),M=Math.max(0,Math.round($));return p_(A,M)}function z(_,$,U){let A=$-_.start_frame;return{..._,start_frame:$,end_frame:U,origin_start_frame:_.origin_start_frame===void 0?void 0:_.origin_start_frame+A}}function P(_,$){let U=0;return _.map((A)=>{let M=N(A),j=Math.round(U),G=Math.round(j+M);return U=G,z(A,j,G)})}function n(_,$,U,A){let M=f(_,U,A),j=N($),G=b(U,A),O=_[M-1]?.end_frame??0,W=Math.max(G,O),X=[..._.slice(0,M),z($,W,W+j),..._.slice(M)],Q=0;return{insertIndex:M,segments:X.map((Y,J)=>{if(Jj.type==="video");if(!U)return $;let A=$.filter((j)=>j.type==="video").flatMap((j)=>j.segments),M=U.segments.flatMap((j)=>{let G=A.find((O)=>O.id===j.id);return G?[{originalSegment:j,updatedSegment:G}]:[]});return $.map((j)=>{if(j.type!=="task")return j;return{...j,segments:j.segments.map((G)=>{let O=M.find(({originalSegment:W})=>G.start_frame===W.start_frame&&G.end_frame===W.end_frame);return O?{...G,start_frame:O.updatedSegment.start_frame,end_frame:O.updatedSegment.end_frame}:G})}})}function B$(_,$,U){let A=b($,V),M=Math.max(A+1,b(U,V)),j=_.find((W)=>W.type==="task");if(!j)return _;if(j.segments.some((W)=>y_(W.start_frame,W.end_frame,A,M)))return _;let O={id:q(),start_frame:A,end_frame:M,color:p.task,content:{media_type:"none",...G_(j.segments,A,j.task_mode??I)}};return _.map((W)=>{if(W.id!==j.id)return W;return{...W,segments:[...W.segments,O].sort((X,Q)=>X.start_frame-Q.start_frame)}})}function b$(_,$,U,A){let M=_.length>0?_:[""];if(M.length===$.length)return $.map((Y,J)=>({...Y,content:e(Y.content,M[J])}));let j=M.length,G=Math.max(j,Math.round(U)),O=Math.floor(G/j),W=G%j,X=0,Q=[];return M.forEach((Y,J)=>{let K=$[J],H=O+(JG.start_frame-O.start_frame).map((G,O)=>{let W=A+(OQ.start_frame-Y.start_frame),M=A.findIndex((Q)=>Q.id===$);if(M<0)return null;let j=A[M],G=N(j),O=Math.round(U);if(G<=1||O<1||O>=G)return null;let W=j.start_frame,X=[];while(WQ.id)}}function V$(_,$){let U=[..._].sort((J,K)=>J.start_frame-K.start_frame),A=U.findIndex((J)=>J.id===$);if(A<0)return null;let M=U[A],j=N(M);if(j<=0)return null;let G=q(),O=M.end_frame,W=O-M.start_frame,X={...structuredClone(M),id:G,start_frame:O,end_frame:O+j,...M.origin_start_frame===void 0?{}:{origin_start_frame:M.origin_start_frame+W}},Q=X.end_frame,Y=U.slice(A+1).map((J)=>{let K=N(J),H=Q-J.start_frame,Z={...J,start_frame:Q,end_frame:Q+K,...J.origin_start_frame===void 0?{}:{origin_start_frame:J.origin_start_frame+H}};return Q=Z.end_frame,Z});return{segments:[...U.slice(0,A+1),X,...Y],clonedSegmentId:G,addedDuration:j}}function D$(_,$,U=V){return I_(_,[$],U)}function I_(_,$,U=V){let A=new Set($);if(A.size===0)return _;return _.map((M)=>({...M,segments:M.segments.filter((j)=>!A.has(j.id))}))}function F_(_,$,U,A,M){let j=_.find((K)=>K.segments.some((H)=>H.id===$)),G=_.find((K)=>K.id===U);if(!j||!G||j.type!==G.type)return _;let O=j.segments.find((K)=>K.id===$);if(!O)return _;if(N(O)<=0)return _;let X=G.segments.filter((K)=>K.id!==$).sort((K,H)=>K.start_frame-H.start_frame),Q=f(X,A,M);if(T(G.type)){let K=n(X,O,A,M),H=_.map((Z)=>{if(Z.id===j.id&&Z.id!==G.id)return{...Z,segments:Z.segments.filter((C)=>C.id!==$)};if(Z.id!==G.id)return Z;return{...Z,segments:K.segments}});return G.type==="video"?x(_,H):H}let Y=P([...X.slice(0,Q),O,...X.slice(Q)],M),J=_.map((K)=>{if(K.id===j.id&&K.id!==G.id)return{...K,segments:P(K.segments.filter((H)=>H.id!==$),M)};if(K.id!==G.id)return K;return{...K,segments:Y}});return x(_,J)}function R_(_,$,U,A,M){let j=_.flatMap((W)=>W.segments).find((W)=>W.id===U);if(!j)return _;let G=b(A-j.start_frame,M);if(G===0)return _;let O=_.map((W)=>{let X=W.segments.filter((H)=>$.has(H.id)).sort((H,Z)=>H.start_frame-Z.start_frame);if(X.length===0)return W;let Q=W.segments.filter((H)=>!$.has(H.id)).sort((H,Z)=>H.start_frame-Z.start_frame),Y=X.map((H)=>{let Z=N(H),C=Math.max(0,H.start_frame+G);return z(H,C,C+Z)});if(T(W.type)){let H=[...Q,...Y].sort((C,L)=>C.start_frame-L.start_frame),Z=0;return{...W,segments:H.map((C)=>{let L=$.has(C.id)?Math.max(C.start_frame,Z):C.start_frame,s=L===C.start_frame?C:z(C,L,L+N(C));return Z=Math.max(Z,s.end_frame),s})}}let J=Y.reduce((H,Z)=>Math.min(H,Z.start_frame),Number.POSITIVE_INFINITY),K=f(Q,J,M);return{...W,segments:P([...Q.slice(0,K),...Y,...Q.slice(K)],M)}});return x(_,O)}function w$(_,$,U,A,M,j){let G=new Set($);if(G.size<=1||!G.has(U))return F_(_,U,A,M,j);return R_(_,G,U,M,j)}function p$(_,$,U,A,M){let j=_.find((K)=>K.segments.some((H)=>H.id===$)),G=_.find((K)=>K.id===U);if(!j||!G||j.type!==G.type)return null;let O=j.segments.find((K)=>K.id===$);if(!O)return null;if(N(O)<=0)return null;let X=G.segments.filter((K)=>K.id!==$).sort((K,H)=>K.start_frame-H.start_frame),Q=f(X,A,M);if(T(G.type)){let K=n(X,O,A,M),H=K.segments[K.insertIndex];return{segmentId:$,targetTrackId:U,insertIndex:K.insertIndex,start_frame:H.start_frame,end_frame:H.end_frame}}let J=P([...X.slice(0,Q),O,...X.slice(Q)],M)[Q];if(!J)return null;return{segmentId:$,targetTrackId:U,insertIndex:Q,start_frame:J.start_frame,end_frame:J.end_frame}}function z$(_,$,U){let A=_.find((K)=>K.id===$.targetTrackId),M=_.flatMap((K)=>K.segments).find((K)=>K.id===$.segmentId);if(!A||!M)return null;if(N(M)<=0)return null;let G=A.segments.filter((K)=>K.id!==$.segmentId).sort((K,H)=>K.start_frame-H.start_frame),O=T(A.type)?n(G,M,$.start_frame,U).segments:P([...G.slice(0,$.insertIndex),M,...G.slice($.insertIndex)],U),W=O.filter((K)=>K.id!==$.segmentId);if(A.type!=="video")return W;let X=_.map((K)=>K.id===A.id?{...K,segments:O}:K),Q=x(_,X),Y=new Map(_.filter((K)=>K.type==="task").flatMap((K)=>K.segments).map((K)=>[K.id,K])),J=Q.filter((K)=>K.type==="task").flatMap((K)=>K.segments).filter((K)=>{let H=Y.get(K.id);return H&&(H.start_frame!==K.start_frame||H.end_frame!==K.end_frame)});return[...W,...J]}function l(_,$){return $>=_.start_frame&&$<_.end_frame}function K_(_,$){let U=b($,_.frame_rate);if(_.total_length>0&&U===_.total_length)return _.total_length-1;return U}function k(_,$){return Math.max(0,$-(_.origin_start_frame??_.start_frame))}function P$(_,$,U){let A=K_(_,$),M=_.tracks.filter((j)=>j.type==="video");if(U){for(let j of M){let G=j.segments.find((O)=>O.id===U);if(!G||G.content.media_type!=="video"||!l(G,A))continue;return{trackId:j.id,segment:G,localTime:R(k(G,A),_.frame_rate)}}return null}for(let j of M){let G=j.segments.find((O)=>O.content.media_type==="video"&&l(O,A));if(!G)continue;return{trackId:j.id,segment:G,localTime:R(k(G,A),_.frame_rate)}}return null}function I$(_,$,U){if(_.muted===!0||U!==null&&U.trackType!=="video"&&U.trackType!=="audio")return[];let A=K_(_,$),M=_.tracks.filter((O)=>O.type==="video"||O.type==="audio"),j=M.some((O)=>O.solo===!0),G=U&&(U.trackType==="video"||U.trackType==="audio")?U.segment.id:null;return M.flatMap((O)=>{if(O.muted||j&&O.solo!==!0)return[];return O.segments.flatMap((W)=>{if(G&&W.id!==G)return[];if(!l(W,A)||W.content.muted===!0)return[];if(W.content.media_type!=="video"&&W.content.media_type!=="audio")return[];return[{trackId:O.id,segment:W,localTime:R(k(W,A),_.frame_rate),volumeDb:(_.volume_db??0)+(O.volume_db??0)+(W.content.volume_db??0)}]})})}function F$(_,$){if(!$)return null;for(let U of _.tracks){let A=U.segments.find((M)=>M.id===$);if(!A)continue;return{trackId:U.id,trackType:U.type,segment:A}}return null}function R$(_,$,U){return{..._,tracks:_.tracks.map((A)=>({...A,segments:A.segments.map((M)=>M.id===$?{...M,content:{...M.content,...U}}:M)}))}}function x_(_,$,U){let A=_.find((G)=>G.type==="video"),M=A?.segments.find((G)=>G.id===U);if(!A||!M)return $;let j=$.find((G)=>G.id===A.id)?.segments.find((G)=>G.id===U);if(!j)return $;return $.map((G)=>{if(G.type!=="task")return G;return{...G,segments:G.segments.map((O)=>O.start_frame===M.start_frame&&O.end_frame===M.end_frame?{...O,start_frame:j.start_frame,end_frame:j.end_frame}:O)}})}function h_(_,$,U){let A=[..._].sort((Y,J)=>Y.start_frame-J.start_frame),M=A.findIndex((Y)=>Y.id===$);if(M<0)return _;let j=A[M],G=Math.max(j.start_frame+1,Math.round(U)),O=G-j.end_frame;if(O===0)return A;let W=A[M+1],X=W?Math.max(0,W.start_frame-j.end_frame):0,Q=O>0?Math.max(0,O-X):O;return A.map((Y,J)=>{if(J{let W=O.segments.find((J)=>J.id===$);if(!W)return O;let X=b(W.start_frame+M,A);if(O.type==="task")return{...O,segments:h_(O.segments,$,X)};let Q=O.segments.filter((J)=>J.id!==$&&J.start_frame>W.start_frame).reduce((J,K)=>Math.min(J,K.start_frame),Number.POSITIVE_INFINITY),Y=Math.max(W.start_frame+1,Math.min(X,Q));return{...O,segments:O.segments.map((J)=>J.id===$?{...J,end_frame:Y}:J)}}),G=x_(_.tracks,j,$);return{..._,tracks:G,total_length:v(G,A)}}function h$(_,$){let U=Math.max(1,Math.round($));if(U===_.frame_rate)return _;let A=_.tracks.map((M)=>({...M,segments:M.segments.map((j)=>{let G=S(j.start_frame,_.frame_rate,U),O=Math.max(G+1,S(j.end_frame,_.frame_rate,U));return{...j,start_frame:G,end_frame:O,origin_start_frame:j.origin_start_frame===void 0?void 0:Math.round(j.origin_start_frame*U/_.frame_rate)}})}));return{..._,frame_rate:U,task_markers:(_.task_markers??[]).map((M)=>({...M,frame:S(M.frame,_.frame_rate,U)})),tracks:A,total_length:v(A,U)}}var F={width:544,height:960};function E(_){let $=Number(_);return Number.isFinite($)&&$>0?$:null}function i(_){return typeof _==="string"&&["stretch","resize","pad","pad (white)","pad_edge","pad_edge_pixel","crop","pillarbox_blur"].includes(_)?_:"stretch"}function v$(_,$,U){let A=_.tracks.find((M)=>M.id===$);if(!A||A.type!=="audio"&&A.type!=="video")return _;return{..._,tracks:_.tracks.map((M)=>M.type===A.type?{...M,audio_locked:U&&M.id===$}:M)}}function v_(_){let $=new Set;return _.map((U)=>{if(U.type!=="audio"&&U.type!=="video"||U.audio_locked!==!0)return U;if(!$.has(U.type))return $.add(U.type),U;return{...U,audio_locked:!1}})}function d(_){if(Array.isArray(_))return _.length>0?d(_[0]):void 0;return _}function y(_){if(!_)return;if(_.value!==void 0)return d(_.value);if(!_.serializeValue)return;try{return d(_.serializeValue())}catch($){console.error("[multitrack-utils] failed to read resolution widget value:",$);return}}function f$(_){let $=_?.widgets??[],U=new Map($.map((J)=>[J.name,J])),A=y(U.get("resolution")),M={};if(typeof A==="string")M.resolution=A;else if(A&&typeof A==="object"){let J=A;if(typeof J.resolution==="string")M.resolution=J.resolution;let K=i(J.resize_method);if(J.resize_method!==void 0)M.resize_method=K;let H=E(J.resize_to_pixel);if(H!==null)M.resize_to_pixel=H;let Z=E(J.width);if(Z!==null)M.width=Z;let C=E(J.height);if(C!==null)M.height=C;if(typeof J.aspect_ratio==="string")M.aspect_ratio=J.aspect_ratio;let L=E(J.megapixels);if(L!==null)M.megapixels=L}let j=y(U.get("resolution.resize_method"));if(j!==void 0)M.resize_method=i(j);let G=E(y(U.get("resolution.resize_to_pixel")));if(G!==null)M.resize_to_pixel=G;let O=E(y(U.get("resolution.width")));if(O!==null)M.width=O;let W=E(y(U.get("resolution.height")));if(W!==null)M.height=W;let X=y(U.get("resolution.aspect_ratio"));if(typeof X==="string")M.aspect_ratio=X;let Q=E(y(U.get("resolution.megapixels")));if(Q!==null)M.megapixels=Q;let Y=y(U.get("format"));if(typeof Y==="string")M.format=M_(Y);return M}function f_(_,$,U){if(!_||_.width<=0||_.height<=0)return F;let A=_.width/_.height;if($==="longest"){if(_.width>=_.height)return{width:U,height:Math.round(U/A)};return{width:Math.round(U*A),height:U}}if(_.width<=_.height)return{width:U,height:Math.round(U/A)};return{width:Math.round(U*A),height:U}}function T$(_,$){let U=typeof _==="string"?{resolution:_}:_&&typeof _==="object"?_:{},A=typeof U.resolution==="string"?U.resolution:"",M=A.toLowerCase(),j=i(U.resize_method),G=A.match(/(\d+)\s*x\s*(\d+)/i);if(M.includes("megapixels")){let O=typeof U.aspect_ratio==="string"?U.aspect_ratio.match(/(\d+)\s*:\s*(\d+)/):null,W=E(O?.[1])??1,X=E(O?.[2])??1,Q=E(U.megapixels)??1,Y={AnimateDiff:8,Mochi:16,LTXV:32,Hunyuan:16,Cosmos:16,Wan:8,MiniMax:32},J=typeof U.format==="string"?Y[U.format]??1:1,K=Math.sqrt(Q*1024*1024/(W*X));return{width:Math.round(W*K/J)*J,height:Math.round(X*K/J)*J,resizeMethod:j,mode:"megapixels"}}if(M.includes("custom"))return{width:E(U.width)??F.width,height:E(U.height)??F.height,resizeMethod:j,mode:"custom"};if(M.includes("longest")||M.includes("shortest")){let O=M.includes("longest")?"longest":"shortest";return{...f_($,O,E(U.resize_to_pixel)??960),resizeMethod:j,mode:O}}if(G)return{width:Number(G[1]),height:Number(G[2]),resizeMethod:j,mode:"fixed"};if(M.includes("auto")&&$&&$.width>0&&$.height>0)return{width:$.width,height:$.height,resizeMethod:j,mode:"auto"};return{...F,resizeMethod:j,mode:"auto"}}function m(_){let $=Number(_);return Number.isFinite($)?$:null}function g(_){let $=m(_);return $===null?null:Math.max(0,Math.round($))}function T_(_){let $=m(_);return $===null?null:Math.round($)}function h(_){let $={..._};return delete $.volume,$}function u_(_){let $=g(_.start_frame)??0,U=g(_.end_frame)??$+1,A={...h(_.content),muted:_.content.muted===!0,volume_db:o(_.content.volume_db)};if(delete A.audio_locked,A.media_type==="audio"||A.media_type==="video")A.shared_reference=A.shared_reference===!0||A.speaker_reference===!0;return delete A.speaker_reference,{...h(_),start_frame:$,end_frame:Math.max($+1,U),origin_start_frame:T_(_.origin_start_frame)??void 0,content:A}}function S_(_){let $=_.segments.map((A)=>u_(A)).sort((A,M)=>A.start_frame-M.start_frame);if(_.type!=="audio"&&_.type!=="video")return $;let U=!1;return $.map((A)=>{if(A.content.shared_reference!==!0)return A;if(!U)return U=!0,A;return{...A,content:{...A.content,shared_reference:!1}}})}function __(_){let $={..._,task_mode:j_(_.task_mode),continuity_mode:D_(_.continuity_mode),ref_image_size:w_(_.ref_image_size),images:Array.isArray(_.images)?_.images:[]};if($.user_prompt===void 0&&typeof $.text==="string")$.user_prompt=$.text;return delete $.text,$}function o_(_,$){return v(_,$)}function u$(){return{muted:!1,volume_db:D,task_markers:[],task_overview:!1,tracks:[{id:q(),name:"Task 0",type:"task",task_mode:I,color:p.task,muted:!1,solo:!1,volume_db:D,locked:!1,segments:[]},{id:q(),name:"Video 0",type:"video",color:p.video,muted:!1,solo:!1,volume_db:D,locked:!1,segments:[]}],total_length:J_,frame_rate:V}}function S$(_){let $=Math.max(1,Math.round(_.frame_rate??V)),U=_.tracks.map((X)=>{let Q=h(X),Y=(X.type==="audio"||X.type==="video")&&X.segments.some((H)=>H.content.audio_locked===!0),J=S_(X),K={muted:X.muted===!0,solo:X.solo===!0,volume_db:o(X.volume_db)};if(X.type!=="segment"){if(X.type==="task")return{...Q,...K,type:"task",task_mode:j_(X.task_mode),color:X.color==="var(--muted)"?p.task:X.color,segments:J.map((H)=>({...H,content:__(H.content)}))};return{...Q,...K,type:X.type,audio_locked:X.type==="audio"||X.type==="video"?X.audio_locked===!0||Y:void 0,visible:X.type==="subtitle"?X.visible!==!1:X.visible,segments:J}}return{...Q,...K,name:X.name,type:"task",task_mode:I,color:p.task,segments:J.map((H)=>({...H,content:__(H.content)}))}}),A={task:0,video:0,audio:0,subtitle:0},M=U.map((X)=>{let Q=A[X.type];A[X.type]+=1;let Y=X.type.charAt(0).toUpperCase()+X.type.slice(1);return{...X,name:`${Y} ${Q}`}}),j=v_(M),G=t(j),O=o_(G,$),W=l_(_.task_markers,O);return{...h(_),muted:_.muted??!1,volume_db:o(_.volume_db),frame_rate:$,total_length:O,task_markers:W,task_overview:_.task_overview===!0,tracks:G}}function l_(_,$){if(!Array.isArray(_))return[];let U=_.flatMap((M)=>{if(!M||typeof M!=="object")return[];let j=M,G=g(j.frame);if(typeof j.id!=="string"||j.id.length===0)return[];if(G===null||G<=0||G>$)return[];return[{id:j.id,frame:G}]}).sort((M,j)=>M.frame-j.frame),A=new Set;return U.filter((M)=>{if(A.has(M.frame))return!1;return A.add(M.frame),!0})} +export{W_ as Na,k_ as Oa,X_ as Pa,r as Qa,i_ as Ra,u as Sa,w as Ta,a as Ua,n_ as Va,m_ as Wa,B as Xa,s_ as Ya,r_ as Za,a_ as _a,t_ as $a,e_ as ab,V as bb,J_ as cb,Q_ as db,Y_ as eb,I as fb,Z_ as gb,$_ as hb,C_ as ib,U_ as jb,D as kb,E_ as lb,N_ as mb,A$ as nb,M$ as ob,q_ as pb,A_ as qb,M_ as rb,j$ as sb,G$ as tb,K$ as ub,O$ as vb,W$ as wb,p as xb,X$ as yb,H$ as zb,J$ as Ab,B_ as Bb,R as Cb,b_ as Db,Q$ as Eb,Y$ as Fb,Z$ as Gb,C$ as Hb,b as Ib,E$ as Jb,N$ as Kb,c as Lb,S as Mb,N as Nb,v as Ob,q$ as Pb,G_ as Qb,x as Rb,B$ as Sb,b$ as Tb,z_ as Ub,P_ as Vb,L$ as Wb,y$ as Xb,V$ as Yb,D$ as Zb,I_ as _b,F_ as $b,w$ as ac,p$ as bc,z$ as cc,K_ as dc,P$ as ec,I$ as fc,F$ as gc,R$ as hc,x_ as ic,h_ as jc,x$ as kc,h$ as lc,v$ as mc,f$ as nc,T$ as oc,u$ as pc,S$ as qc}; diff --git a/dist/release/chunks/index-fpdytcvw.js b/dist/release/chunks/index-eqdkw1y2.js similarity index 98% rename from dist/release/chunks/index-fpdytcvw.js rename to dist/release/chunks/index-eqdkw1y2.js index 375f647..30e6406 100644 --- a/dist/release/chunks/index-fpdytcvw.js +++ b/dist/release/chunks/index-eqdkw1y2.js @@ -1,2 +1,2 @@ -import{qc as C}from"./index-3jazyhrg.js";function A(B,j,q,H=new Set){let G=B,J=j;while(G!==null&&J!==null){let Z=`${G}:${J}`;if(H.has(Z)){console.debug(`[trace] Cycle detected at node ${G}, slot ${J}`);break}H.add(Z);let X=q.getNodeById(G);if(!X)break;let z=X.outputs?.[J];if(!z)break;console.debug(`[trace] Node #${G} "${X.name||X.type||"unknown"}" slot ${J} isList=${z.shape==6}`);let K=z.link;if(K===null||K===void 0)return console.debug(`[trace] Root source found: #${G}`),G;let Y=q.links[K];if(!Y)break;G=Y.origin_id,J=Y.origin_slot}return console.debug("[trace] Root source: none"),null}function v(B){if(B?.type!=="LoadVideo")return;let j=B.widgets?.find((q)=>q.name==="file")?.value??B.widgets_values?.[0];return typeof j==="string"&&j.trim()?j:void 0}function L(B,j,q,H){try{let J=B?.getInputLink?.(q);if(J)return J}catch(J){console.error("[timeline-utils] failed to read input link:",J)}let G=j.link;if(G===null||G===void 0)return null;return H?.links?.[G]??null}function F(B,j){let q=B.widgets?.find((J)=>J?.name==="skip_empty");if(typeof q?.value==="boolean")return q.value;let H=B.inputs?.findIndex((J)=>J.name==="skip_empty")??-1,G=H>=0?B.widgets_values?.[H]:void 0;if(typeof G==="boolean")return G;return j!=="audio"}function f(B,j,q){if(!B?.inputs||!j?.graph)return[];let H=[],G=q.toUpperCase();for(let[J,Z]of B.inputs.entries()){if((Z.type??"").toUpperCase()!==G)continue;let X=L(B,Z,J,j.graph);if(!X)continue;let{origin_id:z,origin_slot:K}=X,Y=j.graph.getNodeById(z);if(!Y)continue;if((Y.outputs?.[K]).shape==6){let U=Y.inputs.map((M,P)=>({inp:M,index:P,link:L(Y,M,P,j.graph)})).filter(({inp:M,link:P})=>(M.type??"").toUpperCase()===G&&P!==null).sort((M,P)=>{let $=parseInt(M.inp.name.match(/(\d+)$/)?.[1]??"0",10),Q=parseInt(P.inp.name.match(/(\d+)$/)?.[1]??"0",10);return $-Q});if(U.length>0){let M=F(Y,q);for(let[P,{inp:$,link:Q}]of U.entries()){let O,V,W;if(Q){let E=A(Q.origin_id,Q.origin_slot,j.graph);if(E!==null){let b=j.graph.getNodeById(E);if(q=="image")O=b?.imgs?.[0]?.currentSrc;else if(q=="audio")V=b.widgets_values?.[0]??b.widgets?.[0]?.value;else if(q==="video")W=v(b)}}let w=M?`${q}${P+1}`:$.name;H.push({label:$.name,img:O,audio_name:V,video_name:W,value:`__slot__:${w}`})}}}else{let U,M,P,$=A(X.origin_id,X.origin_slot,j.graph),Q=$!==null?j.graph.getNodeById($):Y;if(q=="image")U=Q?.imgs?.[0]?.currentSrc;else if(q=="audio"&&Q?.type=="LoadAudio")M=Q.widgets_values?.[0]??Q.widgets?.[0]?.value;else if(q==="video")P=v(Q);H.push({label:Z.name,img:U,audio_name:M,video_name:P,value:`__slot__:${Z.name}`})}break}return H}function N(B,j,q){if(j<=0||q<=0)return B;return B.map((H)=>{if(H.start_frame===void 0||H.end_frame===void 0)return H;let G=Math.max(0,Math.min(q-1,Math.round(H.start_frame/j*q))),J=Math.round((H.end_frame+1)/j*q),Z=Math.max(G,Math.min(q-1,J-1));return{...H,start_frame:G,end_frame:Z}})}function R(B,j){return Math.ceil(B*j/4)*4+1}function g(B,j){return Math.ceil(B*j)}function D(B,j){return(B-1)/j}function k(B,j,q){if(q==="frames")return`${B}f`;return`${D(B,j).toFixed(2)}s`}function I(B,j){let q=B.trim();if(q.endsWith("s")){let J=Number.parseFloat(q.slice(0,-1));if(Number.isNaN(J))return Number.NaN;return R(J,j)}let H=q.endsWith("f")?q.slice(0,-1):q,G=Number.parseInt(H,10);return Number.isNaN(G)?Number.NaN:G}var _={audio:"#34d399",prompt:"#a78bfa",image:"#fb923c",video:"#60a5fa",maintain:"var(--muted)"};function c(B){let j=B??((J)=>""),q=121,H=24;return{tracks:[{id:C(),name:j("timeline.defaultTrackName",{n:1}),type:"maintain",color:_.maintain,muted:!1,locked:!1,segments:[]},{id:C(),name:j("timeline.defaultAudioTrackName",{n:1}),type:"audio",color:_.audio,muted:!1,locked:!1,segments:[]}],total_length:121,frame_rate:24}}function l(B,j,q,H){let G=B/(q-1)*H,J=(j+1)/(q-1)*H;return{left:G,width:Math.max(J-G,2)}} +import{rc as C}from"./index-6y5pqcvv.js";function A(B,j,q,H=new Set){let G=B,J=j;while(G!==null&&J!==null){let Z=`${G}:${J}`;if(H.has(Z)){console.debug(`[trace] Cycle detected at node ${G}, slot ${J}`);break}H.add(Z);let X=q.getNodeById(G);if(!X)break;let z=X.outputs?.[J];if(!z)break;console.debug(`[trace] Node #${G} "${X.name||X.type||"unknown"}" slot ${J} isList=${z.shape==6}`);let K=z.link;if(K===null||K===void 0)return console.debug(`[trace] Root source found: #${G}`),G;let Y=q.links[K];if(!Y)break;G=Y.origin_id,J=Y.origin_slot}return console.debug("[trace] Root source: none"),null}function v(B){if(B?.type!=="LoadVideo")return;let j=B.widgets?.find((q)=>q.name==="file")?.value??B.widgets_values?.[0];return typeof j==="string"&&j.trim()?j:void 0}function L(B,j,q,H){try{let J=B?.getInputLink?.(q);if(J)return J}catch(J){console.error("[timeline-utils] failed to read input link:",J)}let G=j.link;if(G===null||G===void 0)return null;return H?.links?.[G]??null}function F(B,j){let q=B.widgets?.find((J)=>J?.name==="skip_empty");if(typeof q?.value==="boolean")return q.value;let H=B.inputs?.findIndex((J)=>J.name==="skip_empty")??-1,G=H>=0?B.widgets_values?.[H]:void 0;if(typeof G==="boolean")return G;return j!=="audio"}function f(B,j,q){if(!B?.inputs||!j?.graph)return[];let H=[],G=q.toUpperCase();for(let[J,Z]of B.inputs.entries()){if((Z.type??"").toUpperCase()!==G)continue;let X=L(B,Z,J,j.graph);if(!X)continue;let{origin_id:z,origin_slot:K}=X,Y=j.graph.getNodeById(z);if(!Y)continue;if((Y.outputs?.[K]).shape==6){let U=Y.inputs.map((M,P)=>({inp:M,index:P,link:L(Y,M,P,j.graph)})).filter(({inp:M,link:P})=>(M.type??"").toUpperCase()===G&&P!==null).sort((M,P)=>{let $=parseInt(M.inp.name.match(/(\d+)$/)?.[1]??"0",10),Q=parseInt(P.inp.name.match(/(\d+)$/)?.[1]??"0",10);return $-Q});if(U.length>0){let M=F(Y,q);for(let[P,{inp:$,link:Q}]of U.entries()){let O,V,W;if(Q){let E=A(Q.origin_id,Q.origin_slot,j.graph);if(E!==null){let b=j.graph.getNodeById(E);if(q=="image")O=b?.imgs?.[0]?.currentSrc;else if(q=="audio")V=b.widgets_values?.[0]??b.widgets?.[0]?.value;else if(q==="video")W=v(b)}}let w=M?`${q}${P+1}`:$.name;H.push({label:$.name,img:O,audio_name:V,video_name:W,value:`__slot__:${w}`})}}}else{let U,M,P,$=A(X.origin_id,X.origin_slot,j.graph),Q=$!==null?j.graph.getNodeById($):Y;if(q=="image")U=Q?.imgs?.[0]?.currentSrc;else if(q=="audio"&&Q?.type=="LoadAudio")M=Q.widgets_values?.[0]??Q.widgets?.[0]?.value;else if(q==="video")P=v(Q);H.push({label:Z.name,img:U,audio_name:M,video_name:P,value:`__slot__:${Z.name}`})}break}return H}function N(B,j,q){if(j<=0||q<=0)return B;return B.map((H)=>{if(H.start_frame===void 0||H.end_frame===void 0)return H;let G=Math.max(0,Math.min(q-1,Math.round(H.start_frame/j*q))),J=Math.round((H.end_frame+1)/j*q),Z=Math.max(G,Math.min(q-1,J-1));return{...H,start_frame:G,end_frame:Z}})}function R(B,j){return Math.ceil(B*j/4)*4+1}function g(B,j){return Math.ceil(B*j)}function D(B,j){return(B-1)/j}function k(B,j,q){if(q==="frames")return`${B}f`;return`${D(B,j).toFixed(2)}s`}function I(B,j){let q=B.trim();if(q.endsWith("s")){let J=Number.parseFloat(q.slice(0,-1));if(Number.isNaN(J))return Number.NaN;return R(J,j)}let H=q.endsWith("f")?q.slice(0,-1):q,G=Number.parseInt(H,10);return Number.isNaN(G)?Number.NaN:G}var _={audio:"#34d399",prompt:"#a78bfa",image:"#fb923c",video:"#60a5fa",maintain:"var(--muted)"};function c(B){let j=B??((J)=>""),q=121,H=24;return{tracks:[{id:C(),name:j("timeline.defaultTrackName",{n:1}),type:"maintain",color:_.maintain,muted:!1,locked:!1,segments:[]},{id:C(),name:j("timeline.defaultAudioTrackName",{n:1}),type:"audio",color:_.audio,muted:!1,locked:!1,segments:[]}],total_length:121,frame_rate:24}}function l(B,j,q,H){let G=B/(q-1)*H,J=(j+1)/(q-1)*H;return{left:G,width:Math.max(J-G,2)}} export{f as Da,N as Ea,R as Fa,g as Ga,D as Ha,k as Ia,I as Ja,_ as Ka,c as La,l as Ma}; diff --git a/dist/release/chunks/index-8qxfph9w.js b/dist/release/chunks/index-nje7pz68.js similarity index 99% rename from dist/release/chunks/index-8qxfph9w.js rename to dist/release/chunks/index-nje7pz68.js index 675c49c..8f1c928 100644 --- a/dist/release/chunks/index-8qxfph9w.js +++ b/dist/release/chunks/index-nje7pz68.js @@ -1,2 +1,2 @@ -import{Aa as L}from"./index-2femq7pq.js";import{rc as N}from"./index-w8y4mejn.js";var xr=new Set(["easy timelineEditor","easy multiTrackEditor"]);var Wr={"easy timelineEditor":[520,430],"easy multiTrackEditor":[800,700]};function rt(t){if(Array.isArray(t)&&t.length>=2){let i=Number(t[0]),T=Number(t[1]);return Number.isFinite(i)&&Number.isFinite(T)?[i,T]:null}if(ArrayBuffer.isView(t)&&"length"in t&&Number(t.length)>=2){let i=t,T=Number(i[0]),u=Number(i[1]);return Number.isFinite(T)&&Number.isFinite(u)?[T,u]:null}if(!t||typeof t!=="object")return null;let e=t,r=Number(e.width??e[0]),n=Number(e.height??e[1]);return Number.isFinite(r)&&Number.isFinite(n)?[r,n]:null}function Le(t,e){let r=Number(t?.properties?.easyMediaTimelineHeight??e?.properties?.easyMediaTimelineHeight);if(Number.isFinite(r)&&r>0)return r;return rt(e?.size)?.[1]??null}function bt(t,e){let r=Number(e);if(!Number.isFinite(r)||r<=0)return;t.properties??={},t.properties.easyMediaTimelineHeight=r}function _e(t,e,r){let n=rt(t.size);if(!n||Math.abs(n[1]-e)<1)return;let i=n[0]||r||480;if(typeof t.setSize==="function")t.setSize([i,e]);else t.size=[i,e];t.setDirtyCanvas?.(!0,!0)}function ae(t){let e=Number(t?.__easyMediaTimelineHeightRestoreVersion);t.__easyMediaTimelineHeightRestoreVersion=Number.isFinite(e)?e+1:1}function Si(t,e){let r=rt(t?.size);if(!r||!Number.isFinite(e)||e===0)return;let n=Math.max(1,r[1]+e);ae(t),delete t.__easyMediaTimelineWidgetResizeGuard,bt(t,n),_e(t,n,r[0])}function xt(t,e,r){if(!Number.isFinite(e)||e===null||e<=0)return;let n=Number(t?.__easyMediaTimelineHeightRestoreVersion)||0;globalThis.setTimeout(()=>{if((Number(t?.__easyMediaTimelineHeightRestoreVersion)||0)!==n)return;_e(t,e,r)},100)}function Ne(t){let e=t?.__easyMediaTimelineWidgetResizeGuard;if(!e||!Number.isFinite(e.height)||e.height<=0)return null;if(Date.now()>e.expiresAt)return delete t.__easyMediaTimelineWidgetResizeGuard,null;return e}function Ir(t){let e=rt(t?.size),r=Le(t)??e?.[1]??null;if(!Number.isFinite(r)||r===null||r<=0)return;t.properties??={},t.properties.easyMediaTimelineHeight=r,t.__easyMediaTimelineWidgetResizeGuard={height:r,width:e?.[0],expiresAt:Date.now()+500}}function Ai(t,e){if(!xr.has(e.name||""))return;let r=t.prototype.onNodeCreated,n=t.prototype.onConfigure,i=t.prototype.onResize,T=t.prototype.onSerialize,u=t.prototype.onWidgetChanged;t.prototype.onNodeCreated=function(){r?.call(this);let p=e.name||"",m=Wr[p];if(!m)return;this.size[0]=m[0],this.size[1]=m[1],this.setDirtyCanvas?.(!0,!0)},t.prototype.onConfigure=function(p){n?.call(this,p);let m=Le(this,p);if(ae(this),m!==null)bt(this,m);xt(this,m,rt(p?.size)?.[0])},t.prototype.onResize=function(p){i?.call(this,p);let m=rt(p);if(!m)return;let k=Ne(this);if(k){bt(this,k.height),xt(this,k.height,k.width??m[0]);return}bt(this,m[1])},t.prototype.onWidgetChanged=function(p,m,k,f){Ir(this),u?.call(this,p,m,k,f);let E=Ne(this);if(E)xt(this,E.height,E.width)},t.prototype.onSerialize=function(p){T?.call(this,p);let m=rt(this.size);if(m)bt(this,m[1]);p.properties??={},p.properties.easyMediaTimelineHeight=this.properties?.easyMediaTimelineHeight}}var Ei={project_name:"default",width:0,height:0,frame_rate:24,clips:[],auto_combine:!0};var O=N(L(),1);var Xt=N(L(),1);var Qt=(...t)=>t.filter((e,r,n)=>{return Boolean(e)&&e.trim()!==""&&n.indexOf(e)===r}).join(" ").trim();var je=(t)=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();var se=(t)=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,r,n)=>n?n.toUpperCase():r.toLowerCase());var Wt=(t)=>{let e=se(t);return e.charAt(0).toUpperCase()+e.slice(1)};var Pt=N(L(),1);var Jt={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"};var ce=(t)=>{for(let e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0;return!1};var ut=N(L(),1),Cr=ut.createContext({});var tr=()=>ut.useContext(Cr);var er=Pt.forwardRef(({color:t,size:e,strokeWidth:r,absoluteStrokeWidth:n,className:i="",children:T,iconNode:u,...p},m)=>{let{size:k=24,strokeWidth:f=2,absoluteStrokeWidth:E=!1,color:o="currentColor",className:b=""}=tr()??{},Z=n??E?Number(r??f)*24/Number(e??k):r??f;return Pt.createElement("svg",{ref:m,...Jt,width:e??k??Jt.width,height:e??k??Jt.height,stroke:t??o,strokeWidth:Z,className:Qt("lucide",b,i),...!T&&!ce(p)&&{"aria-hidden":"true"},...p},[...u.map(([H,P])=>Pt.createElement(H,P)),...Array.isArray(T)?T:[T]])});var d=(t,e)=>{let r=Xt.forwardRef(({className:n,...i},T)=>Xt.createElement(er,{ref:T,iconNode:e,className:Qt(`lucide-${je(Wt(t))}`,`lucide-${t}`,n),...i}));return r.displayName=Wt(t),r};var Ur=[["rect",{width:"18",height:"14",x:"3",y:"5",rx:"2",ry:"2",key:"12ruh7"}],["path",{d:"M7 15h4M15 15h2M7 11h2M13 11h4",key:"1ueiar"}]],kt=d("captions",Ur);var Nr=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],pt=d("circle-check",Nr);var Lr=[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]],mt=d("cloud-upload",Lr);var _r=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],ht=d("columns-2",_r);var ar=[["path",{d:"M4 6.835V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-.343",key:"1vfytu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M2 19a2 2 0 0 1 4 0v1a2 2 0 0 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 0 1-4 0v-1a2 2 0 0 1 4 0",key:"1etmh7"}]],_=d("file-headphone",ar);var jr=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M15.033 13.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56v-4.704a.645.645 0 0 1 .967-.56z",key:"1tzo1f"}]],yt=d("file-play",jr);var sr=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],St=d("loader-circle",sr);var cr=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]],At=d("lock-open",cr);var tn=[["path",{d:"m11 7.601-5.994 8.19a1 1 0 0 0 .1 1.298l.817.818a1 1 0 0 0 1.314.087L15.09 12",key:"80a601"}],["path",{d:"M16.5 21.174C15.5 20.5 14.372 20 13 20c-2.058 0-3.928 2.356-6 2-2.072-.356-2.775-3.369-1.5-4.5",key:"j0ngtp"}],["circle",{cx:"16",cy:"7",r:"5",key:"d08jfb"}]],ft=d("mic-vocal",tn);var en=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],Et=d("panel-left",en);var rn=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],It=d("arrow-left",rn);var nn=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],Ct=d("arrow-up-down",nn);var dn=[["path",{d:"M2 10v3",key:"1fnikh"}],["path",{d:"M6 6v11",key:"11sgs0"}],["path",{d:"M10 3v18",key:"yhl04a"}],["path",{d:"M14 8v7",key:"3a1oy3"}],["path",{d:"M18 5v13",key:"123xd1"}],["path",{d:"M22 10v3",key:"154ddg"}]],Ut=d("audio-lines",dn);var Tn=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}]],Nt=d("ban",Tn);var un=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Lt=d("check",un);var kn=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],_t=d("chevron-down",kn);var pn=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],at=d("chevron-right",pn);var mn=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],jt=d("chevron-up",mn);var hn=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],st=d("circle",hn);var yn=[["path",{d:"m12.296 3.464 3.02 3.956",key:"qash78"}],["path",{d:"M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3z",key:"1h7j8b"}],["path",{d:"M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"4lm6w1"}],["path",{d:"m6.18 5.276 3.1 3.899",key:"zjj9t3"}]],ct=d("clapperboard",yn);var Sn=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],te=d("download",Sn);var An=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],ee=d("external-link",An);var fn=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],Vt=d("eye-off",fn);var En=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],wt=d("eye",En);var Dn=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],re=d("file",Dn);var on=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 3v18",key:"bbkbws"}],["path",{d:"M3 7.5h4",key:"zfgn84"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 16.5h4",key:"1230mu"}],["path",{d:"M17 3v18",key:"in4fa5"}],["path",{d:"M17 7.5h4",key:"myr1c1"}],["path",{d:"M17 16.5h4",key:"go4c1d"}]],ne=d("film",on);var Hn=[["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"}]],de=d("folder-open",Hn);var Fn=[["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"}]],ie=d("folder",Fn);var ln=[["path",{d:"M2 7v10",key:"a2pl2d"}],["path",{d:"M6 5v14",key:"1kq3d7"}],["rect",{width:"12",height:"18",x:"10",y:"3",rx:"2",key:"13i7bc"}]],Te=d("gallery-horizontal-end",ln);var bn=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],ue=d("gauge",bn);var Pn=[["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"}]],ke=d("grip-vertical",Pn);var Vn=[["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"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],pe=d("history",Vn);var wn=[["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"}]],me=d("image",wn);var On=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],he=d("key-round",On);var Yn=[["path",{d:"M13 13.74a2 2 0 0 1-2 0L2.5 8.87a1 1 0 0 1 0-1.74L11 2.26a2 2 0 0 1 2 0l8.5 4.87a1 1 0 0 1 0 1.74z",key:"15q6uc"}],["path",{d:"m20 14.285 1.5.845a1 1 0 0 1 0 1.74L13 21.74a2 2 0 0 1-2 0l-8.5-4.87a1 1 0 0 1 0-1.74l1.5-.845",key:"byia6g"}]],ye=d("layers-2",Yn);var Zn=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],Se=d("layout-grid",Zn);var Rn=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}],["path",{d:"M14 4h7",key:"3xa0d5"}],["path",{d:"M14 9h7",key:"1icrd9"}],["path",{d:"M14 15h7",key:"1mj8o2"}],["path",{d:"M14 20h7",key:"11slyb"}]],Ae=d("layout-list",Rn);var qn=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],fe=d("link-2",qn);var Bn=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]],Ee=d("list-checks",Bn);var Qn=[["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"M3 10a2 2 0 0 0 2 2h3",key:"1npucw"}],["path",{d:"M3 5v12a2 2 0 0 0 2 2h3",key:"x1gjn2"}]],De=d("list-tree",Qn);var Jn=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],oe=d("lock",Jn);var Xn=[["path",{d:"m12 15 4 4",key:"lnac28"}],["path",{d:"M2.352 10.648a1.205 1.205 0 0 0 0 1.704l2.296 2.296a1.205 1.205 0 0 0 1.704 0l6.029-6.029a1 1 0 1 1 3 3l-6.029 6.029a1.205 1.205 0 0 0 0 1.704l2.296 2.296a1.205 1.205 0 0 0 1.704 0l6.365-6.367A1 1 0 0 0 8.716 4.282z",key:"nlhkjb"}],["path",{d:"m5 8 4 4",key:"j6kj7e"}]],He=d("magnet",Xn);var $n=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],Fe=d("maximize-2",$n);var zn=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],le=d("minimize-2",zn);var vn=[["circle",{cx:"8",cy:"18",r:"4",key:"1fc0mg"}],["path",{d:"M12 18V2l7 4",key:"g04rme"}]],be=d("music-2",vn);var Kn=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]],Pe=d("panel-right",Kn);var Gn=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],Ve=d("pause",Gn);var gn=[["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"}]],we=d("pencil",gn);var Mn=[["path",{d:"m12 9-8.414 8.414A2 2 0 0 0 3 18.828v1.344a2 2 0 0 1-.586 1.414A2 2 0 0 1 3.828 21h1.344a2 2 0 0 0 1.414-.586L15 12",key:"1y3wsu"}],["path",{d:"m18 9 .4.4a1 1 0 1 1-3 3l-3.8-3.8a1 1 0 1 1 3-3l.4.4 3.4-3.4a1 1 0 1 1 3 3z",key:"110lr1"}],["path",{d:"m2 22 .414-.414",key:"jhxm08"}]],Oe=d("pipette",Mn);var xn=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],Ye=d("play",xn);var Wn=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Ze=d("plus",Wn);var In=[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]],Re=d("redo-2",In);var Cn=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],qe=d("refresh-cw",Cn);var Un=[["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"}]],Be=d("rotate-ccw",Un);var Nn=[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]],Qe=d("scissors",Nn);var Ln=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Je=d("search",Ln);var _n=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],Xe=d("settings-2",_n);var an=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],$e=d("share-2",an);var jn=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],ze=d("trash-2",jn);var sn=[["path",{d:"M12 4v16",key:"1654pz"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2",key:"e0r10z"}],["path",{d:"M9 20h6",key:"s66wpe"}]],ve=d("type",sn);var cn=[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]],Ke=d("undo-2",cn);var td=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]],Ge=d("volume-2",td);var ed=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]],ge=d("volume-x",ed);var rd=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Me=d("x",rd);var nd=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],xe=d("zoom-out",nd);var Qr=N(L(),1);var Y=N(L(),1);var dd=N(L(),1);function rr(t,e){if(typeof t==="function")return t(e);else if(t!==null&&t!==void 0)t.current=e}function nr(...t){return(e)=>{let r=!1,n=t.map((i)=>{let T=rr(i,e);if(!r&&typeof T=="function")r=!0;return T});if(r)return()=>{for(let i=0;i{let{children:T,...u}=n;if(ir(T)&&typeof zt==="function")T=zt(T._payload);let p=Y.Children.toArray(T),m=p.find(yd);if(m){let k=m.props.children,f=p.map((E)=>{if(E===m){if(Y.Children.count(k)>1)return Y.Children.only(null);return Y.isValidElement(k)?k.props.children:null}else return E});return l(e,{...u,ref:i,children:Y.isValidElement(k)?Y.cloneElement(k,void 0,f):null})}return l(e,{...u,ref:i,children:T})});return r.displayName=`${t}.Slot`,r}var Tr=pd("Slot");function md(t){let e=Y.forwardRef((r,n)=>{let{children:i,...T}=r;if(ir(i)&&typeof zt==="function")i=zt(i._payload);if(Y.isValidElement(i)){let u=Ad(i),p=Sd(T,i.props);if(i.type!==Y.Fragment)p.ref=n?nr(n,u):u;return Y.cloneElement(i,p)}return Y.Children.count(i)>1?Y.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var hd=Symbol("radix.slottable");function yd(t){return Y.isValidElement(t)&&typeof t.type==="function"&&"__radixId"in t.type&&t.type.__radixId===hd}function Sd(t,e){let r={...e};for(let n in e){let i=t[n],T=e[n];if(/^on[A-Z]/.test(n)){if(i&&T)r[n]=(...p)=>{let m=T(...p);return i(...p),m};else if(i)r[n]=i}else if(n==="style")r[n]={...i,...T};else if(n==="className")r[n]=[i,T].filter(Boolean).join(" ")}return{...t,...r}}function Ad(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning;if(r)return t.ref;if(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r)return t.props.ref;return t.props.ref||t.ref}function ur(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;etypeof t==="boolean"?`${t}`:t===0?"0":t,pr=vt,mr=(t,e)=>(r)=>{var n;if((e===null||e===void 0?void 0:e.variants)==null)return pr(t,r===null||r===void 0?void 0:r.class,r===null||r===void 0?void 0:r.className);let{variants:i,defaultVariants:T}=e,u=Object.keys(i).map((k)=>{let f=r===null||r===void 0?void 0:r[k],E=T===null||T===void 0?void 0:T[k];if(f===null)return null;let o=kr(f)||kr(E);return i[k][o]}),p=r&&Object.entries(r).reduce((k,f)=>{let[E,o]=f;if(o===void 0)return k;return k[E]=o,k},{}),m=e===null||e===void 0?void 0:(n=e.compoundVariants)===null||n===void 0?void 0:n.reduce((k,f)=>{let{class:E,className:o,...b}=f;return Object.entries(b).every((Z)=>{let[H,P]=Z;return Array.isArray(P)?P.includes({...T,...p}[H]):{...T,...p}[H]===P})?[...k,E,o]:k},[]);return pr(t,u,m,r===null||r===void 0?void 0:r.class,r===null||r===void 0?void 0:r.className)};var fd=(t,e)=>{let r=Array(t.length+e.length);for(let n=0;n({classGroupId:t,validator:e}),Er=(t=new Map,e=null,r)=>({nextPart:t,validators:e,classGroupId:r});var hr=[];var Dd=(t)=>{let e=Hd(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:(u)=>{if(u.startsWith("[")&&u.endsWith("]"))return od(u);let p=u.split("-"),m=p[0]===""&&p.length>1?1:0;return Dr(p,m,e)},getConflictingClassGroupIds:(u,p)=>{if(p){let m=n[u],k=r[u];if(m){if(k)return fd(k,m);return m}return k||hr}return r[u]||hr}}},Dr=(t,e,r)=>{if(t.length-e===0)return r.classGroupId;let i=t[e],T=r.nextPart.get(i);if(T){let k=Dr(t,e+1,T);if(k)return k}let u=r.validators;if(u===null)return;let p=e===0?t.join("-"):t.slice(e).join("-"),m=u.length;for(let k=0;kt.slice(1,-1).indexOf(":")===-1?void 0:(()=>{let e=t.slice(1,-1),r=e.indexOf(":"),n=e.slice(0,r);return n?"arbitrary.."+n:void 0})(),Hd=(t)=>{let{theme:e,classGroups:r}=t;return Fd(r,e)},Fd=(t,e)=>{let r=Er();for(let n in t){let i=t[n];Ie(i,r,n,e)}return r},Ie=(t,e,r,n)=>{let i=t.length;for(let T=0;T{if(typeof t==="string"){bd(t,e,r);return}if(typeof t==="function"){Pd(t,e,r,n);return}Vd(t,e,r,n)},bd=(t,e,r)=>{let n=t===""?e:or(e,t);n.classGroupId=r},Pd=(t,e,r,n)=>{if(wd(t)){Ie(t(n),e,r,n);return}if(e.validators===null)e.validators=[];e.validators.push(Ed(r,t))},Vd=(t,e,r,n)=>{let i=Object.entries(t),T=i.length;for(let u=0;u{let r=t,n=e.split("-"),i=n.length;for(let T=0;T("isThemeGetter"in t)&&t.isThemeGetter===!0,Od=(t)=>{if(t<1)return{get:()=>{return},set:()=>{}};let e=0,r=Object.create(null),n=Object.create(null),i=(T,u)=>{if(r[T]=u,e++,e>t)e=0,n=r,r=Object.create(null)};return{get(T){let u=r[T];if(u!==void 0)return u;if((u=n[T])!==void 0)return i(T,u),u},set(T,u){if(T in r)r[T]=u;else i(T,u)}}};var Yd=[],yr=(t,e,r,n,i)=>({modifiers:t,hasImportantModifier:e,baseClassName:r,maybePostfixModifierPosition:n,isExternal:i}),Zd=(t)=>{let{prefix:e,experimentalParseClassName:r}=t,n=(i)=>{let T=[],u=0,p=0,m=0,k,f=i.length;for(let H=0;Hm?k-m:void 0;return yr(T,b,o,Z)};if(e){let i=e+":",T=n;n=(u)=>u.startsWith(i)?T(u.slice(i.length)):yr(Yd,!1,u,void 0,!0)}if(r){let i=n;n=(T)=>r({className:T,parseClassName:i})}return n},Rd=(t)=>{let e=new Map;return t.orderSensitiveModifiers.forEach((r,n)=>{e.set(r,1e6+n)}),(r)=>{let n=[],i=[];for(let T=0;T0)i.sort(),n.push(...i),i=[];n.push(u)}else i.push(u)}if(i.length>0)i.sort(),n.push(...i);return n}},qd=(t)=>({cache:Od(t.cacheSize),parseClassName:Zd(t),sortModifiers:Rd(t),postfixLookupClassGroupIds:Bd(t),...Dd(t)}),Bd=(t)=>{let e=Object.create(null),r=t.postfixLookupClassGroups;if(r)for(let n=0;n{let{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:i,sortModifiers:T,postfixLookupClassGroupIds:u}=e,p=[],m=t.trim().split(Qd),k="";for(let f=m.length-1;f>=0;f-=1){let E=m[f],{isExternal:o,modifiers:b,hasImportantModifier:Z,baseClassName:H,maybePostfixModifierPosition:P}=r(E);if(o){k=E+(k.length>0?" "+k:k);continue}let $=!!P,R;if($){let z=H.substring(0,P);R=n(z);let S=R&&u[R]?n(H):void 0;if(S&&S!==R)R=S,$=!1}else R=n(H);if(!R){if(!$){k=E+(k.length>0?" "+k:k);continue}if(R=n(H),!R){k=E+(k.length>0?" "+k:k);continue}$=!1}let j=b.length===0?"":b.length===1?b[0]:T(b).join(":"),x=Z?j+"!":j,W=x+R;if(p.indexOf(W)>-1)continue;p.push(W);let I=i(R,$);for(let z=0;z0?" "+k:k)}return k},Xd=(...t)=>{let e=0,r,n,i="";while(e{if(typeof t==="string")return t;let e,r="";for(let n=0;n{let r,n,i,T,u=(m)=>{let k=e.reduce((f,E)=>E(f),t());return r=qd(k),n=r.cache.get,i=r.cache.set,T=p,p(m)},p=(m)=>{let k=n(m);if(k)return k;let f=Jd(m,r);return i(m,f),f};return T=u,(...m)=>T(Xd(...m))},zd=[],q=(t)=>{let e=(r)=>r[t]||zd;return e.isThemeGetter=!0,e},Fr=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,lr=/^\((?:(\w[\w-]*):)?(.+)\)$/i,vd=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Kd=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Gd=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,gd=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Md=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,xd=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,s=(t)=>vd.test(t),D=(t)=>!!t&&!Number.isNaN(Number(t)),M=(t)=>!!t&&Number.isInteger(Number(t)),We=(t)=>t.endsWith("%")&&D(t.slice(0,-1)),a=(t)=>Kd.test(t),br=()=>!0,Wd=(t)=>Gd.test(t)&&!gd.test(t),Ce=()=>!1,Id=(t)=>Md.test(t),Cd=(t)=>xd.test(t),Ud=(t)=>!h(t)&&!y(t),Nd=(t)=>t.startsWith("@container")&&(t[10]==="/"&&t[11]!==void 0||t[11]==="s"&&t[16]!==void 0&&t.startsWith("-size/",10)||t[11]==="n"&&t[18]!==void 0&&t.startsWith("-normal/",10)),Ld=(t)=>c(t,wr,Ce),h=(t)=>Fr.test(t),nt=(t)=>c(t,Or,Wd),Sr=(t)=>c(t,ri,D),_d=(t)=>c(t,Zr,br),ad=(t)=>c(t,Yr,Ce),Ar=(t)=>c(t,Pr,Ce),jd=(t)=>c(t,Vr,Cd),Kt=(t)=>c(t,Rr,Id),y=(t)=>lr.test(t),Ot=(t)=>dt(t,Or),sd=(t)=>dt(t,Yr),fr=(t)=>dt(t,Pr),cd=(t)=>dt(t,wr),ti=(t)=>dt(t,Vr),Gt=(t)=>dt(t,Rr,!0),ei=(t)=>dt(t,Zr,!0),c=(t,e,r)=>{let n=Fr.exec(t);if(n){if(n[1])return e(n[1]);return r(n[2])}return!1},dt=(t,e,r=!1)=>{let n=lr.exec(t);if(n){if(n[1])return e(n[1]);return r}return!1},Pr=(t)=>t==="position"||t==="percentage",Vr=(t)=>t==="image"||t==="url",wr=(t)=>t==="length"||t==="size"||t==="bg-size",Or=(t)=>t==="length",ri=(t)=>t==="number",Yr=(t)=>t==="family-name",Zr=(t)=>t==="number"||t==="weight",Rr=(t)=>t==="shadow";var ni=()=>{let t=q("color"),e=q("font"),r=q("text"),n=q("font-weight"),i=q("tracking"),T=q("leading"),u=q("breakpoint"),p=q("container"),m=q("spacing"),k=q("radius"),f=q("shadow"),E=q("inset-shadow"),o=q("text-shadow"),b=q("drop-shadow"),Z=q("blur"),H=q("perspective"),P=q("aspect"),$=q("ease"),R=q("animate"),j=()=>["auto","avoid","all","avoid-page","page","left","right","column"],x=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],W=()=>[...x(),y,h],I=()=>["auto","hidden","clip","visible","scroll"],z=()=>["auto","contain","none"],S=()=>[y,h,m],J=()=>[s,"full","auto",...S()],V=()=>[M,"none","subgrid",y,h],tt=()=>["auto",{span:["full",M,y,h]},M,y,h],g=()=>[M,"auto",y,h],it=()=>["auto","min","max","fr",y,h],ot=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],C=()=>["start","end","center","stretch","center-safe","end-safe"],X=()=>["auto",...S()],U=()=>[s,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...S()],Ht=()=>[s,"screen","full","dvw","lvw","svw","min","max","fit",...S()],et=()=>[s,"screen","full","lh","dvh","lvh","svh","min","max","fit",...S()],A=()=>[t,y,h],Zt=()=>[...x(),fr,Ar,{position:[y,h]}],Ft=()=>["no-repeat",{repeat:["","x","y","space","round"]}],lt=()=>["auto","cover","contain",cd,Ld,{size:[y,h]}],Tt=()=>[We,Ot,nt],Q=()=>["","none","full",k,y,h],B=()=>["",D,Ot,nt],w=()=>["solid","dashed","dotted","double"],v=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],F=()=>[D,We,fr,Ar],K=()=>["","none",Z,y,h],Rt=()=>["none",D,y,h],qt=()=>["none",D,y,h],Mt=()=>[D,y,h],Bt=()=>[s,"full",...S()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[a],breakpoint:[a],color:[br],container:[a],"drop-shadow":[a],ease:["in","out","in-out"],font:[Ud],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[a],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[a],shadow:[a],spacing:["px",D],text:[a],"text-shadow":[a],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",s,h,y,P]}],container:["container"],"container-type":[{"@container":["","normal","size",y,h]}],"container-named":[Nd],columns:[{columns:[D,h,y,p]}],"break-after":[{"break-after":j()}],"break-before":[{"break-before":j()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:W()}],overflow:[{overflow:I()}],"overflow-x":[{"overflow-x":I()}],"overflow-y":[{"overflow-y":I()}],overscroll:[{overscroll:z()}],"overscroll-x":[{"overscroll-x":z()}],"overscroll-y":[{"overscroll-y":z()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:J()}],"inset-x":[{"inset-x":J()}],"inset-y":[{"inset-y":J()}],start:[{"inset-s":J(),start:J()}],end:[{"inset-e":J(),end:J()}],"inset-bs":[{"inset-bs":J()}],"inset-be":[{"inset-be":J()}],top:[{top:J()}],right:[{right:J()}],bottom:[{bottom:J()}],left:[{left:J()}],visibility:["visible","invisible","collapse"],z:[{z:[M,"auto",y,h]}],basis:[{basis:[s,"full","auto",p,...S()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[D,s,"auto","initial","none",h]}],grow:[{grow:["",D,y,h]}],shrink:[{shrink:["",D,y,h]}],order:[{order:[M,"first","last","none",y,h]}],"grid-cols":[{"grid-cols":V()}],"col-start-end":[{col:tt()}],"col-start":[{"col-start":g()}],"col-end":[{"col-end":g()}],"grid-rows":[{"grid-rows":V()}],"row-start-end":[{row:tt()}],"row-start":[{"row-start":g()}],"row-end":[{"row-end":g()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":it()}],"auto-rows":[{"auto-rows":it()}],gap:[{gap:S()}],"gap-x":[{"gap-x":S()}],"gap-y":[{"gap-y":S()}],"justify-content":[{justify:[...ot(),"normal"]}],"justify-items":[{"justify-items":[...C(),"normal"]}],"justify-self":[{"justify-self":["auto",...C()]}],"align-content":[{content:["normal",...ot()]}],"align-items":[{items:[...C(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...C(),{baseline:["","last"]}]}],"place-content":[{"place-content":ot()}],"place-items":[{"place-items":[...C(),"baseline"]}],"place-self":[{"place-self":["auto",...C()]}],p:[{p:S()}],px:[{px:S()}],py:[{py:S()}],ps:[{ps:S()}],pe:[{pe:S()}],pbs:[{pbs:S()}],pbe:[{pbe:S()}],pt:[{pt:S()}],pr:[{pr:S()}],pb:[{pb:S()}],pl:[{pl:S()}],m:[{m:X()}],mx:[{mx:X()}],my:[{my:X()}],ms:[{ms:X()}],me:[{me:X()}],mbs:[{mbs:X()}],mbe:[{mbe:X()}],mt:[{mt:X()}],mr:[{mr:X()}],mb:[{mb:X()}],ml:[{ml:X()}],"space-x":[{"space-x":S()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":S()}],"space-y-reverse":["space-y-reverse"],size:[{size:U()}],"inline-size":[{inline:["auto",...Ht()]}],"min-inline-size":[{"min-inline":["auto",...Ht()]}],"max-inline-size":[{"max-inline":["none",...Ht()]}],"block-size":[{block:["auto",...et()]}],"min-block-size":[{"min-block":["auto",...et()]}],"max-block-size":[{"max-block":["none",...et()]}],w:[{w:[p,"screen",...U()]}],"min-w":[{"min-w":[p,"screen","none",...U()]}],"max-w":[{"max-w":[p,"screen","none","prose",{screen:[u]},...U()]}],h:[{h:["screen","lh",...U()]}],"min-h":[{"min-h":["screen","lh","none",...U()]}],"max-h":[{"max-h":["screen","lh",...U()]}],"font-size":[{text:["base",r,Ot,nt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,ei,_d]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",We,h]}],"font-family":[{font:[sd,ad,e]}],"font-features":[{"font-features":[h]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,y,h]}],"line-clamp":[{"line-clamp":[D,"none",y,Sr]}],leading:[{leading:[T,...S()]}],"list-image":[{"list-image":["none",y,h]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",y,h]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:A()}],"text-color":[{text:A()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...w(),"wavy"]}],"text-decoration-thickness":[{decoration:[D,"from-font","auto",y,nt]}],"text-decoration-color":[{decoration:A()}],"underline-offset":[{"underline-offset":[D,"auto",y,h]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:S()}],"tab-size":[{tab:[M,y,h]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",y,h]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",y,h]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Zt()}],"bg-repeat":[{bg:Ft()}],"bg-size":[{bg:lt()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},M,y,h],radial:["",y,h],conic:[M,y,h]},ti,jd]}],"bg-color":[{bg:A()}],"gradient-from-pos":[{from:Tt()}],"gradient-via-pos":[{via:Tt()}],"gradient-to-pos":[{to:Tt()}],"gradient-from":[{from:A()}],"gradient-via":[{via:A()}],"gradient-to":[{to:A()}],rounded:[{rounded:Q()}],"rounded-s":[{"rounded-s":Q()}],"rounded-e":[{"rounded-e":Q()}],"rounded-t":[{"rounded-t":Q()}],"rounded-r":[{"rounded-r":Q()}],"rounded-b":[{"rounded-b":Q()}],"rounded-l":[{"rounded-l":Q()}],"rounded-ss":[{"rounded-ss":Q()}],"rounded-se":[{"rounded-se":Q()}],"rounded-ee":[{"rounded-ee":Q()}],"rounded-es":[{"rounded-es":Q()}],"rounded-tl":[{"rounded-tl":Q()}],"rounded-tr":[{"rounded-tr":Q()}],"rounded-br":[{"rounded-br":Q()}],"rounded-bl":[{"rounded-bl":Q()}],"border-w":[{border:B()}],"border-w-x":[{"border-x":B()}],"border-w-y":[{"border-y":B()}],"border-w-s":[{"border-s":B()}],"border-w-e":[{"border-e":B()}],"border-w-bs":[{"border-bs":B()}],"border-w-be":[{"border-be":B()}],"border-w-t":[{"border-t":B()}],"border-w-r":[{"border-r":B()}],"border-w-b":[{"border-b":B()}],"border-w-l":[{"border-l":B()}],"divide-x":[{"divide-x":B()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":B()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...w(),"hidden","none"]}],"divide-style":[{divide:[...w(),"hidden","none"]}],"border-color":[{border:A()}],"border-color-x":[{"border-x":A()}],"border-color-y":[{"border-y":A()}],"border-color-s":[{"border-s":A()}],"border-color-e":[{"border-e":A()}],"border-color-bs":[{"border-bs":A()}],"border-color-be":[{"border-be":A()}],"border-color-t":[{"border-t":A()}],"border-color-r":[{"border-r":A()}],"border-color-b":[{"border-b":A()}],"border-color-l":[{"border-l":A()}],"divide-color":[{divide:A()}],"outline-style":[{outline:[...w(),"none","hidden"]}],"outline-offset":[{"outline-offset":[D,y,h]}],"outline-w":[{outline:["",D,Ot,nt]}],"outline-color":[{outline:A()}],shadow:[{shadow:["","none",f,Gt,Kt]}],"shadow-color":[{shadow:A()}],"inset-shadow":[{"inset-shadow":["none",E,Gt,Kt]}],"inset-shadow-color":[{"inset-shadow":A()}],"ring-w":[{ring:B()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:A()}],"ring-offset-w":[{"ring-offset":[D,nt]}],"ring-offset-color":[{"ring-offset":A()}],"inset-ring-w":[{"inset-ring":B()}],"inset-ring-color":[{"inset-ring":A()}],"text-shadow":[{"text-shadow":["none",o,Gt,Kt]}],"text-shadow-color":[{"text-shadow":A()}],opacity:[{opacity:[D,y,h]}],"mix-blend":[{"mix-blend":[...v(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":v()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[D]}],"mask-image-linear-from-pos":[{"mask-linear-from":F()}],"mask-image-linear-to-pos":[{"mask-linear-to":F()}],"mask-image-linear-from-color":[{"mask-linear-from":A()}],"mask-image-linear-to-color":[{"mask-linear-to":A()}],"mask-image-t-from-pos":[{"mask-t-from":F()}],"mask-image-t-to-pos":[{"mask-t-to":F()}],"mask-image-t-from-color":[{"mask-t-from":A()}],"mask-image-t-to-color":[{"mask-t-to":A()}],"mask-image-r-from-pos":[{"mask-r-from":F()}],"mask-image-r-to-pos":[{"mask-r-to":F()}],"mask-image-r-from-color":[{"mask-r-from":A()}],"mask-image-r-to-color":[{"mask-r-to":A()}],"mask-image-b-from-pos":[{"mask-b-from":F()}],"mask-image-b-to-pos":[{"mask-b-to":F()}],"mask-image-b-from-color":[{"mask-b-from":A()}],"mask-image-b-to-color":[{"mask-b-to":A()}],"mask-image-l-from-pos":[{"mask-l-from":F()}],"mask-image-l-to-pos":[{"mask-l-to":F()}],"mask-image-l-from-color":[{"mask-l-from":A()}],"mask-image-l-to-color":[{"mask-l-to":A()}],"mask-image-x-from-pos":[{"mask-x-from":F()}],"mask-image-x-to-pos":[{"mask-x-to":F()}],"mask-image-x-from-color":[{"mask-x-from":A()}],"mask-image-x-to-color":[{"mask-x-to":A()}],"mask-image-y-from-pos":[{"mask-y-from":F()}],"mask-image-y-to-pos":[{"mask-y-to":F()}],"mask-image-y-from-color":[{"mask-y-from":A()}],"mask-image-y-to-color":[{"mask-y-to":A()}],"mask-image-radial":[{"mask-radial":[y,h]}],"mask-image-radial-from-pos":[{"mask-radial-from":F()}],"mask-image-radial-to-pos":[{"mask-radial-to":F()}],"mask-image-radial-from-color":[{"mask-radial-from":A()}],"mask-image-radial-to-color":[{"mask-radial-to":A()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":x()}],"mask-image-conic-pos":[{"mask-conic":[D]}],"mask-image-conic-from-pos":[{"mask-conic-from":F()}],"mask-image-conic-to-pos":[{"mask-conic-to":F()}],"mask-image-conic-from-color":[{"mask-conic-from":A()}],"mask-image-conic-to-color":[{"mask-conic-to":A()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Zt()}],"mask-repeat":[{mask:Ft()}],"mask-size":[{mask:lt()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",y,h]}],filter:[{filter:["","none",y,h]}],blur:[{blur:K()}],brightness:[{brightness:[D,y,h]}],contrast:[{contrast:[D,y,h]}],"drop-shadow":[{"drop-shadow":["","none",b,Gt,Kt]}],"drop-shadow-color":[{"drop-shadow":A()}],grayscale:[{grayscale:["",D,y,h]}],"hue-rotate":[{"hue-rotate":[D,y,h]}],invert:[{invert:["",D,y,h]}],saturate:[{saturate:[D,y,h]}],sepia:[{sepia:["",D,y,h]}],"backdrop-filter":[{"backdrop-filter":["","none",y,h]}],"backdrop-blur":[{"backdrop-blur":K()}],"backdrop-brightness":[{"backdrop-brightness":[D,y,h]}],"backdrop-contrast":[{"backdrop-contrast":[D,y,h]}],"backdrop-grayscale":[{"backdrop-grayscale":["",D,y,h]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[D,y,h]}],"backdrop-invert":[{"backdrop-invert":["",D,y,h]}],"backdrop-opacity":[{"backdrop-opacity":[D,y,h]}],"backdrop-saturate":[{"backdrop-saturate":[D,y,h]}],"backdrop-sepia":[{"backdrop-sepia":["",D,y,h]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":S()}],"border-spacing-x":[{"border-spacing-x":S()}],"border-spacing-y":[{"border-spacing-y":S()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",y,h]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[D,"initial",y,h]}],ease:[{ease:["linear","initial",$,y,h]}],delay:[{delay:[D,y,h]}],animate:[{animate:["none",R,y,h]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[H,y,h]}],"perspective-origin":[{"perspective-origin":W()}],rotate:[{rotate:Rt()}],"rotate-x":[{"rotate-x":Rt()}],"rotate-y":[{"rotate-y":Rt()}],"rotate-z":[{"rotate-z":Rt()}],scale:[{scale:qt()}],"scale-x":[{"scale-x":qt()}],"scale-y":[{"scale-y":qt()}],"scale-z":[{"scale-z":qt()}],"scale-3d":["scale-3d"],skew:[{skew:Mt()}],"skew-x":[{"skew-x":Mt()}],"skew-y":[{"skew-y":Mt()}],transform:[{transform:[y,h,"","none","gpu","cpu"]}],"transform-origin":[{origin:W()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Bt()}],"translate-x":[{"translate-x":Bt()}],"translate-y":[{"translate-y":Bt()}],"translate-z":[{"translate-z":Bt()}],"translate-none":["translate-none"],zoom:[{zoom:[M,y,h]}],accent:[{accent:A()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:A()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",y,h]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":A()}],"scrollbar-track-color":[{"scrollbar-track":A()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":S()}],"scroll-mx":[{"scroll-mx":S()}],"scroll-my":[{"scroll-my":S()}],"scroll-ms":[{"scroll-ms":S()}],"scroll-me":[{"scroll-me":S()}],"scroll-mbs":[{"scroll-mbs":S()}],"scroll-mbe":[{"scroll-mbe":S()}],"scroll-mt":[{"scroll-mt":S()}],"scroll-mr":[{"scroll-mr":S()}],"scroll-mb":[{"scroll-mb":S()}],"scroll-ml":[{"scroll-ml":S()}],"scroll-p":[{"scroll-p":S()}],"scroll-px":[{"scroll-px":S()}],"scroll-py":[{"scroll-py":S()}],"scroll-ps":[{"scroll-ps":S()}],"scroll-pe":[{"scroll-pe":S()}],"scroll-pbs":[{"scroll-pbs":S()}],"scroll-pbe":[{"scroll-pbe":S()}],"scroll-pt":[{"scroll-pt":S()}],"scroll-pr":[{"scroll-pr":S()}],"scroll-pb":[{"scroll-pb":S()}],"scroll-pl":[{"scroll-pl":S()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",y,h]}],fill:[{fill:["none",...A()]}],"stroke-w":[{stroke:[D,Ot,nt,Sr]}],stroke:[{stroke:["none",...A()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}};var qr=$d(ni);function Br(...t){return qr(vt(t))}var di=mr("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),Yt=Qr.forwardRef(({className:t,variant:e,size:r,asChild:n=!1,...i},T)=>{return l(n?Tr:"button",{className:Br(di({variant:e,size:r,className:t})),ref:T,...i})});Yt.displayName="Button";var G=N(L(),1);function Jr(t,e,r=!0){let[n,i]=G.useState([]),T=G.useRef([]);return G.useEffect(()=>{let u=!1,p=!1,m=null,k=[],f=(o)=>{let b=T.current;T.current=o,i(o),b.forEach(({bitmap:Z})=>Z.close())};async function E(){if(!r||!t||t.type!=="image/webp"||typeof ImageDecoder>"u"){if(!u)f([]);return}let o=await ImageDecoder.isTypeSupported(t.type);if(u)return;if(!o){f([]);return}let b=await t.arrayBuffer();if(u)return;m=new ImageDecoder({data:b,type:t.type,preferAnimation:!0}),await m.tracks.ready;let Z=m.tracks.selectedTrack?.frameCount??0;for(let H=0;H{if(!u)console.error("[SamplingPreviewWidget] failed to decode preview:",o)}),()=>{if(u=!0,m?.close(),!p)k.forEach(({bitmap:o})=>o.close())}},[t,r,e]),G.useEffect(()=>()=>{T.current.forEach(({bitmap:u})=>u.close()),T.current=[]},[]),n}function Xr(t,e,r,n){let[i,T]=G.useState(0),[u,p]=G.useState(0),m=G.useRef(0);return G.useEffect(()=>{m.current=0,T(0),p(0)},[t]),G.useEffect(()=>{let k=r&&e>1?e/r*1000:0;if(!t||k<=0){T(t?100:0),p(0);return}if(!n)return;let f=0,E=performance.now(),o=(b)=>{m.current=(m.current+b-E)%k,E=b;let Z=m.current/k*100;T(Z),p(Math.min(e-1,Math.floor(Z/100*e))),f=requestAnimationFrame(o)};return f=requestAnimationFrame(o),()=>cancelAnimationFrame(f)},[r,e,n,t]),{frameIndex:u,progress:i}}var gt=N(L(),1);var $r={common:{cancel:"Cancel",save:"Save",add:"Add",delete:"Delete",syncPlay:"Sync Play"},compareVideo:{empty:"Choose source and output videos to compare, or run the node with inputs.",source:"Source",output:"Output",selectSource:"Select source",selectOutput:"Select output",clearSource:"Clear source video",clearOutput:"Clear output video",sourceOnly:"Source",outputOnly:"Output",sideBySide:"A/B",compare:"Compare",play:"Play",pause:"Pause",seek:"Video time",mute:"Mute audio",unmute:"Unmute audio",volume:"Volume",saveOutput:"Save output video",watchOutputHistory:"Watch output history",filenamePrefix:"Save prefix",settings:"Output settings",downloadOutput:"Download output video"},promptEnhancerAccount:{balance:"Balance: {amount}",balanceEmpty:"Balance: --",viewBalance:"View balance",loadingBalance:"Loading balance...",balanceUnavailable:"Balance is temporarily unavailable",apiKeyRequired:"Enter an API key to load the balance",apiKey:"API Key",localModel:"Local model — no API account required"},projectVideoCombine:{selectProject:"Select project",deleteProject:"Delete project",deleteProjectTitle:"Delete project?",deleteProjectConfirm:"Delete the {project} project and its entire folder, including latent, JSON, and media files? This cannot be undone.",deleteDefaultProjectConfirm:"Clear all latent, JSON, and media files from the default project? The default folder will be kept. This cannot be undone.",deleteProjectSuccess:"Project deleted",deleteProjectSuccessDetail:"The {project} project was deleted.",deleteProjectFailed:"Project deletion failed",deleteClipFile:"Delete {file}",deleteClipFileTitle:"Delete generated clip?",deleteClipFileConfirm:"Permanently delete {file} and its associated generation artifacts? The latest project state will be saved. This cannot be undone.",deleteClipFileFailed:"Clip deletion failed",deleteClipFileUnavailable:"The clip deletion endpoint is unavailable (HTTP 404/405). Restart ComfyUI to load the updated backend, then refresh this page and try again.",deleteClipFileInvalidResponse:"The server returned an invalid project response (HTTP {status}). The preview was not changed. Refresh the project to check its saved state.",refresh:"Refresh project",mutePreview:"Mute preview audio",unmutePreview:"Unmute preview audio",combine:"Combine",autoCombine:"Auto combine",clipLabel:"Segment {number}",clipContinuity:"{mode}",selectClipFile:"Select a file for segment {number}",selectClipFiles:"Select up to two videos for segment {number}",selectClipFilesHint:"Select one video for the project, or two to compare.",selectClipFileFailed:"Video selection could not be saved",continuityShot:"Shot",continuityContext:"Context",continuityContextSwap:"Swap Context",emptyPreview:"Refresh the project to preview its generated clips.",refreshFailed:"Project refresh failed",combineFailed:"Project combine failed",projectListFailed:"Could not load projects",connectSaveNode:"Connect this node to a video save output before combining manually.",combineQueued:"Combine queued",combineQueuedDetail:"The {project} project and its downstream nodes were added to the queue.",queueBusy:"Wait until the current ComfyUI queue is empty before combining manually."},samplingPreview:{title:"Sampling preview",meta:"Segment {segment} · {pass} · {step}/{total}",playbackProgress:"Sampling preview playback progress",hidePreview:"Hide sampling preview",showPreview:"Show sampling preview",pausePreview:"Pause sampling preview",resumePreview:"Resume sampling preview",first:"First pass",second:"Second pass",selflift:"SelfLift"},toolbar:{frames:"Frames",seconds:"Seconds",fps:"fps",play:"Play",pause:"Pause",deleteSegment:"Delete selected segment",zoom:"Zoom"},timeline:{defaultTrackName:"Track {n}",defaultAudioTrackName:"Audio Track {n}"},multitrackTaskModes:{default:"TI2V",l2v:"L2V",t2v:"T2V",i2v:"I2V",fl2v:"FL2V",fmlf2v:"FMLF2V",v2v:"V2V",r2v:"R2V",rv2v:"RV2V",vi2v:"VI2V",ref:"R2V",edit:"Edit"},multitrackSegment:{taskLabel:"Segment {n} {mode}"},multitrack:{audio:"Audio",globalAudio:"MainAudio",audioSettings:"Audio settings",speed:"Speed",fpsSettings:"fps settings",mutePreviewAudio:"Mute preview audio",unmutePreviewAudio:"Unmute preview audio",mute:"Mute",unmute:"Unmute",volume:"Volume",frameRate:"FPS",currentResolution:"Current resolution",fps:"fps",duration:"Duration",editTaskDuration:"Edit task duration",prompt:"Prompt",promptPlaceholder:"Double-click to describe what you want to generate...",minimaxPromptPlaceholder:"Reference mode supports up to 9 images, 3 audio clips, and 3 videos. Enter text or use @ references to freely combine images, text, audio, and video. For example, @Picture 1 imitates the movement in @Video 1 with the voice from @Audio 1.",openReferenceResources:"Open reference resources",userPrompt:"User Prompt",userPromptVariantTooltip:"New: The user prompt output follows your A/B selection (select A to output A, select B to output B). Use A/B to compare prompts, or to preserve both the original and reverse-engineered prompts.",systemPrompt:"System Prompt",systemPromptPlaceholder:"System prompt",loadingSystemPrompt:"Loading default system prompt...",resetSystemPrompt:"Reset system prompt",referenceResources:"Reference resources",referenceResourcesEmpty:"Add task images or media clips to a track first.",referencePicture:"Picture {n}",referenceAudioItem:"Audio {n}",referenceVideoItem:"Video {n}",taskImageDropZone:"Task image drop zone",resizeTaskEditorPanels:"Resize image and prompt panels",selectImage:"Select image",addImage:"Add image",imageDropHint:"Click to choose, or drag files here.",previewImage:"Preview image",bypassImage:"Bypass image",includeImage:"Include image",bypassImageTooltip:"Bypass this image so it is not used as a reference or counted in image numbering.",includeImageTooltip:"Include this image as a generation reference again.",backToPreview:"Back to preview",deleteImage:"Delete image",previewLayoutBalanced:"Use balanced preview layout",previewLayoutImageLarge:"Enlarge task images",showTaskPrompt:"Show task prompt",hideTaskPrompt:"Hide task prompt",individualEdit:"Individual",combinedEdit:"Combined",applyPromptToAll:"Apply to all",applyPromptToAllTitle:"Apply this prompt to every segment?",applyPromptToAllDescription:"The selected user prompt from this segment will replace both prompt A and prompt B in every task segment, including prompts already set on other segments.",applyPromptToAllConfirm:"Replace all",taskNumber:"Segment {n}",taskMode:"Task mode",taskModeTooltip:"Choose how this segment generates video.",continuityMode:"Continuity mode",continuityModeTooltip:"Start a new shot, continue with a five-frame video anchor, or preserve motion while replacing the character appearance.",refImageSize:"Reference image size",refImageSizeTooltip:"Match scales reference images to the generation area; Max keeps a larger reference for stronger identity fidelity but can be much slower.",lockAudio:"Lock audio",unlockAudio:"Unlock audio",audioLockedMarker:"Audio track locked",audioLockTooltip:"(Only effective in MultiTrack Project) After locking audio, video generation will no longer regenerate the audio and will instead coordinate the video visuals with the original audio.",videoAudioLockTooltip:"(Only effective in MultiTrack Project) Locking makes video generation follow this video track's visual timeline. Video and audio track locks can be enabled together; when both are enabled, the audio track takes priority for audio locking and replacement.",enableSpeakerReference:"Reuse as speaker audio",disableSpeakerReference:"Stop reusing speaker audio",speakerReferenceTooltip:"(MiniMax only) Reuse this clip as this audio track's @Audio reference in every task. Audio longer than 15 seconds is truncated to its first 15 seconds.",enableSharedReference:"Use as shared reference",disableSharedReference:"Stop using as shared reference",sharedReferenceTooltip:"Use this media as this track's reference in every task. Shared audio uses up to its first 15 seconds.",sharedImageReferenceTooltip:"Set this image to public, and place before local images in every task. Shared and local images together are limited to 9 per task.",sharedImageLimitTooltip:"A task already has 9 different images. Remove one before sharing this image.",previewTaskLabel:"Task{n}",emptyPreviewTitle:"No segments yet",emptyPreviewDescription:"Add a task segment or video clip to the tracks below.",emptyTaskTrack:"Task track",emptyTaskTrackPurpose:"Without markers, track segments define task divisions; edit prompts, reference images, and more in each segment.",emptyVideoTrack:"Video track",emptyVideoTrackPurpose:"Drag or select videos to add them; right-click clips for smart split and subtitle recognition.",emptyAudioTrack:"Audio track",emptyAudioTrackPurpose:"Drag or select audio to add it; right-click clips for subtitle recognition.",emptySubtitleTrack:"Subtitle track",emptySubtitleTrackPurpose:"Add and edit subtitle styles and positioning, with text-to-speech support.",emptyTaskMarkers:"Task markers",emptyTaskMarkersPurpose:"Markers can group multiple segments into one loop task.",emptyTaskOverview:"Task track overview",emptyTaskOverviewPurpose:"Expand the task track to view each segment's prompt and reference images.",addVideo:"Add video",addAudioSegment:"Add audio",externalMediaUploading:"Uploading {name}...",addTrack:"Add track:",addVideoTrack:"Add video track",addAudioTrack:"Add audio track",addSubtitleTrack:"Add subtitle track",addSubtitleSegment:"Add subtitle",notSupportedYet:"Not supported yet",deleteTrack:"Delete {name}",reorderTrack:"Drag to reorder {name}",hideSubtitleTrack:"Hide {name}",showSubtitleTrack:"Show {name}",muteTrack:"Mute {name}",soloTrack:"Solo {name}",muteShort:"M",soloShort:"S",addTaskSegment:"Add task segment",deleteSelectedSegment:"Delete selected segment",addTaskMarker:"Add task marker",deleteTaskMarker:"Delete task marker",taskMarkerLabel:"Segment {n}",taskMarkerAtFrame:"Task marker at frame {frame}",taskOverview:"Tasktrack Overview",deleteSegment:"Delete segment",subtitle:"Subtitle",text:"Text",editSubtitle:"Edit subtitle",recognizeSubtitles:"Recognize subtitles",recognizeSubtitlesQwen3:"Qwen3-ASR",recognizeSubtitlesWhisper:"Whisper Large V3",recognizingSubtitles:"Recognizing subtitles...",subtitleRecognitionFailed:"Subtitle recognition failed",subtitleSpeechComplete:"Audio generation complete",subtitleSpeechSaved:"Audio generated and saved to {path}",subtitleSpeechFailed:"Audio generation failed",subtitleTextSettings:"Subtitle text settings",subtitleText:"Subtitle text",fontSize:"Font size",textColor:"Color",outlineColor:"Outline color",backgroundColor:"BG color",backgroundOpacity:"BG opacity",backgroundOpacityPercent:"Background opacity (%)",presetStyle:"Preset style",applyPresetStyle:"Apply {name} subtitle style",position:"Position",positionX:"X",positionY:"Y",subtitleWidth:"Width",subtitleWidthShort:"W",positionXPercent:"X (%)",positionYPercent:"Y (%)",subtitleWidthPercent:"Width (%)",speech:"Speech",speechModel:"Model",speechPrompt:"Control prompt",speechPromptPlaceholder:"Control prompt: Describe language, dialect, emotion, gender, etc. here.",speechCfg:"CFG",speechSteps:"Steps",referenceAudio:"Reference audio",addReferenceAudio:"Add reference audio",reselectReferenceAudio:"Reselect reference audio",playReferenceAudio:"Play reference audio",pauseReferenceAudio:"Pause reference audio",clearReferenceAudio:"Clear reference audio",distributeTaskSegments:"Distribute segments evenly",mergeTaskSegments:"Merge segments",cloneTaskSegment:"Clone segment",cloneVideoSegment:"Clone video",cloneAudioSegment:"Clone audio",splitTaskSegment:"Split segment",splitTaskSegmentDescription:"Current segment is {frames} frames ({seconds}s). Enter the seconds for each split.",splitTaskSegmentSeconds:"Split seconds",splitTaskSegmentSecondsUnit:"s",splitTaskSegmentPreview:"Will split into {count} segments.",splitTaskSegmentInvalid:"Enter at least 1 second and less than the current segment duration.",splitTaskSegmentConfirm:"Split",smartSplit:"Smart split",smartSplitTasksOnly:"Smart split (tasks only)",noMatchingTaskSegment:"No task segment has the same start and end frames.",smartSplitting:"Detecting shots...",smartSplitFailed:"Smart split failed",cutMode:"Trim segments",trimLeftAtPlayhead:"Trim left",trimRightAtPlayhead:"Trim right",undo:"Undo",redo:"Redo",play:"Play",pause:"Pause",timelineSnap:"Timeline snap",hideTimeline:"Hide timeline",showTimeline:"Show timeline",timelineZoom:"Timeline zoom"},multitrackContinuityModes:{shot:"Shot",context:"Context",context_swap:"Swap Context"},multitrackRefImageSizes:{match:"Match",max:"Max"},modelDownload:{title:"{name} is missing",description:"{name} must be installed under {directory}. Download it automatically or open the source link and place the file there manually.",auto:"Auto download",manual:"Manual download",exit:"Exit",close:"Close",downloading:"Downloading...",downloadComplete:"Model installed",downloadCompleteDetail:"{name} was downloaded. Run the action again."},trackRow:{trackColor:"Track color"},segmentBlock:{resizeStart:"Resize segment start",resizeEnd:"Resize segment end"},promptTrack:{distributeEvenly:"Distribute evenly",addSegment:"Add segment",deleteSegment:"Delete selected segment",addSegmentTitle:"Add segment",promptPlaceholder:"Prompt text...",segmentLabel:"Segment {n}",empty:"empty",editSegmentTitle:"Edit segment {n}",contextEdit:"Edit segment",contextAdd:"Add segment",contextDistribute:"Distribute evenly",editDialogTitle:"Edit Prompts",tabCombined:"Combined",tabIndividual:"Individual",combinedHint:"Use | to separate segments. Changes apply in real-time.",segmentCount:"{n} segment(s)"},audioTrack:{addMarker:"Add marker",importFile:"Import audio file…",importUrl:"Import from URL…",enterUrl:"Enter audio URL:",frameLabel:"Frame {n}",markerAriaLabel:"Marker: {label}",markerAtFrame:"Marker at frame {frame}",editMarker:"Edit marker",markerLabelInput:"Marker label",placeholder:"Audio Track",placeholderHint:"Double-click to add content",dropZone:"Audio track drop zone",selectMedia:"Select audio",contextEdit:"Edit segment",contextAdd:"Add segment",contextDelete:"Delete segment"},imageTrack:{dropZone:"Image track drop zone",addSegment:"Add image",deleteSegment:"Delete selected segment",importFile:"Import image file…",importUrl:"Import from URL…",enterUrl:"Enter image URL:",placeholder:"Image Track",placeholderHint:"Double-click to add content",contextReselect:"Change Segment",contextAdd:"Add segment",contextDistribute:"Distribute evenly",contextDelete:"Delete segment"},maintainTrack:{dropZone:"Maintain track drop zone",segmentLabel:"Segment {n}",segmentPlaceholder:"Click segment to write the prompt...",placeholder:"Add segment",placeholderHint:"Double-click to add segment",promptPlaceholder:"Prompt text...",addImage:"Add image",tabCombined:"Combined",tabIndividual:"Individual",combinedHint:"Use | to separate segments. Changes apply in real-time.",contextEdit:"Edit segment",contextAdd:"Add segment",contextClone:"Clone segment",contextDelete:"Delete segment",contextDistribute:"Distribute evenly",addMedia:"Add media",flf:"First Last frames",fmlf:"Multiple frames",ref:"Reference frames"},insertButton:{insertBefore:"Insert segment before",insertAfter:"Insert segment after"},panorama:{applyView:"Apply view",cancel:"Cancel panorama",cancelHint:"Remove the saved panorama view and exit",orientation:"Yaw {yaw}° · Pitch {pitch}°",zoom:"FOV {fov}° ×{ratio}",exit:"Exit panorama view",loading:"Loading panorama...",invalidView:"Saved panorama view is invalid.",webglUnavailable:"WebGL panorama rendering is unavailable.",textureLoadFailed:"Failed to load this image as a panorama texture."},multiImagesLoader:{add:"Add images",replace:"Replace image {n}",preview:"Preview image",delete:"Delete image",imageCount:"Images: {n}",clearAll:"Clear all"},mediaSelector:{tabInputs:"Inputs",tabOutputs:"Outputs",tabHistory:"History",filter:"Multi",selectAll:"SelectAll",confirm:"Confirm",tabLocal:"Local",tabUrl:"URL",searchPlaceholder:"Search...",sort:"Sort by {by}",sortName:"name",sortDate:"date",sortFolders:"folders first",viewList:"List view",viewGrid:"Grid view",refresh:"Refresh",localPathPlaceholder:"Absolute folder path...",urlHint:"Paste an http(s) URL to a media file.",urlConfirm:"Confirm URL",urlChecking:"Checking...",urlErrorTitle:"URL Error",urlErrorNotFound:"File not found or access denied.",empty:"No files found",error:"Failed to load: {msg}",tabSlot:"Slot",slotNotConnected:"No connected input",slotEmpty:"No content available",slotList:"list",slotImage:"Image {n}",slotAudio:"Audio {n}",slotVideo:"Video {n}",addLocal:"Add local file"}};var zr={common:{cancel:"取消",save:"保存",add:"添加",delete:"删除",syncPlay:"同步播放"},compareVideo:{empty:"请选择视频进行对比,或在接入输入后执行节点。",source:"Source",output:"Output",selectSource:"选择源",selectOutput:"选择目标",clearSource:"清除源视频",clearOutput:"清除目标视频",sourceOnly:"Source",outputOnly:"Output",sideBySide:"A/B",compare:"Compare",play:"播放",pause:"暂停",seek:"视频时间",mute:"静音",unmute:"取消静音",volume:"音量",saveOutput:"保存输出视频",watchOutputHistory:"监听输出历史",filenamePrefix:"保存前缀",settings:"输出设置",downloadOutput:"下载输出视频"},promptEnhancerAccount:{balance:"余额:{amount}",balanceEmpty:"余额:--",viewBalance:"去查看余额",loadingBalance:"正在获取余额...",balanceUnavailable:"暂时无法获取余额",apiKeyRequired:"填写 API Key 后可获取余额",apiKey:"API Key",localModel:"本地模型,无需 API 账户"},projectVideoCombine:{selectProject:"选择项目",deleteProject:"删除项目",deleteProjectTitle:"删除项目?",deleteProjectConfirm:"确定删除项目 {project} 及其整个文件夹吗?其中的 latent、JSON 和媒体文件也会一并删除,且无法恢复。",deleteDefaultProjectConfirm:"确定清空 default 项目的所有 latent、JSON 和媒体文件吗?default 文件夹会保留,删除后无法恢复。",deleteProjectSuccess:"项目已删除",deleteProjectSuccessDetail:"项目 {project} 已删除。",deleteProjectFailed:"项目删除失败",deleteClipFile:"删除 {file}",deleteClipFileTitle:"删除生成片段?",deleteClipFileConfirm:"确定永久删除 {file} 及其关联的生成文件吗?删除后将保存项目最新状态,此操作无法恢复。",deleteClipFileFailed:"片段删除失败",deleteClipFileUnavailable:"片段删除接口不可用(HTTP 404/405)。请重启 ComfyUI 以加载更新后的后端,再刷新页面重试。",deleteClipFileInvalidResponse:"服务器返回的项目数据无效(HTTP {status}),预览未修改。请刷新项目以核实已保存的状态。",refresh:"刷新项目",mutePreview:"关闭预览声音",unmutePreview:"开启预览声音",combine:"合并",autoCombine:"自动合并",clipLabel:"片段{number}",clipContinuity:"{mode}",selectClipFile:"选择片段{number}的视频文件",selectClipFiles:"为片段{number}选择最多两个视频",selectClipFilesHint:"选择一个视频用于项目,选择两个视频进行对比。",selectClipFileFailed:"视频版本选择保存失败",continuityShot:"分镜",continuityContext:"上下文",continuityContextSwap:"上下文(替换)",emptyPreview:"请刷新项目以预览已生成的视频片段。",refreshFailed:"项目刷新失败",combineFailed:"项目合并失败",projectListFailed:"无法获取项目列表",connectSaveNode:"请先将此节点连接到视频保存输出节点,再执行手动合并。",combineQueued:"合并任务已提交",combineQueuedDetail:"项目 {project} 及其下游节点已加入队列。",queueBusy:"当前 ComfyUI 队列仍有任务,请等待队列清空后再手动合并。"},samplingPreview:{title:"采样预览",meta:"片段 {segment} · {pass} · {step}/{total}",playbackProgress:"采样预览播放进度",hidePreview:"隐藏采样预览",showPreview:"显示采样预览",pausePreview:"暂停采样预览",resumePreview:"继续采样预览",first:"一采",second:"二采",selflift:"SelfLift"},toolbar:{frames:"帧",seconds:"秒",fps:"帧/秒",play:"播放",pause:"暂停",deleteSegment:"删除选中片段",zoom:"缩放"},timeline:{defaultTrackName:"主轨 {n}",defaultAudioTrackName:"音频轨 {n}"},multitrackTaskModes:{default:"文图",t2v:"文生视频",i2v:"图生视频",fl2v:"首尾生视频",fmlf2v:"多帧生视频",l2v:"尾帧",r2v:"参考生视频",rv2v:"参考视频生视频",vi2v:"图像视频编辑",v2v:"视频生视频",ref:"参考",edit:"编辑"},multitrackSegment:{taskLabel:"片段 {n} {mode}"},multitrack:{audio:"音频",globalAudio:"总音频",audioSettings:"音频设置",speed:"速度",fpsSettings:"速度设置",mutePreviewAudio:"静音预览音频",unmutePreviewAudio:"取消静音预览音频",mute:"静音",unmute:"取消静音",volume:"音量",frameRate:"帧率",currentResolution:"当前分辨率",fps:"帧/秒",duration:"时长",editTaskDuration:"编辑任务时长",prompt:"提示词",promptPlaceholder:"双击描述您想要生成的内容...",minimaxPromptPlaceholder:"参考模式下最多支持9张图片,3个音频,3个视频, 输入文字或 @ 参考内容, 自由组合图、文、音,视频多元素,定义精彩互动。例如 @图片1 模仿 @视频1 的动作,音色参考 @音频1。",openReferenceResources:"打开引用资源",userPrompt:"用户提示词",userPromptVariantTooltip:"✨新功能:用户提示词将根据您的选择输出(即选择 A 时输出 A,选择 B 时 输出 B)。A/B 可用于提示词对比,也可用于分别保存原提示词与反推后的提示词。",systemPrompt:"系统提示词",systemPromptPlaceholder:"系统提示词",loadingSystemPrompt:"正在加载默认系统提示词...",resetSystemPrompt:"重置系统提示词",referenceResources:"可能@的内容",referenceResourcesEmpty:"请先在左侧添加图片或在媒体轨道中添加片段。",referencePicture:"图片{n}",referenceAudioItem:"音频{n}",referenceVideoItem:"视频{n}",taskImageDropZone:"任务图片拖放区域",resizeTaskEditorPanels:"调整图片与提示词区域宽度",selectImage:"选择图片",addImage:"添加图片",imageDropHint:"点击从文件选择,或将文件拖到这里。",previewImage:"预览图片",bypassImage:"禁用图片",includeImage:"启用图片",bypassImageTooltip:"禁用该图片;生成时不会作为参考图,且不占图片序号。",includeImageTooltip:"重新启用该图片作为生成参考图。",backToPreview:"返回预览",deleteImage:"删除图片",previewLayoutBalanced:"使用均衡预览布局",previewLayoutImageLarge:"放大任务图片区",showTaskPrompt:"显示任务提示词",hideTaskPrompt:"隐藏任务提示词",individualEdit:"逐段编辑",combinedEdit:"整体编辑",applyPromptToAll:"应用到所有",applyPromptToAllTitle:"将提示词应用到所有片段?",applyPromptToAllDescription:"当前片段选中的用户提示词将覆盖所有任务片段的 A、B 提示词;其他片段已设置的提示词也会被替换。",applyPromptToAllConfirm:"确认覆盖",taskNumber:"片段 {n}",taskMode:"任务模式",taskModeTooltip:"选择当前片段的视频生成方式。",continuityMode:"衔接模式",continuityModeTooltip:"选择开启新分镜、使用五帧视频锚点承接上下文,或在保留动作连续性的同时替换角色外观。",refImageSize:"参考图像尺寸",refImageSizeTooltip:"匹配尺寸会按生成画面面积缩放参考图;最大尺寸会保留更大的参考图以提升主体一致性,但生成速度可能慢数倍。",lockAudio:"锁定音频",unlockAudio:"解除音频锁定",audioLockedMarker:"音频轨道已锁定",audioLockTooltip:"(仅多轨项目有效) 锁定音频后,视频生成将不再重新生成音频,而改用原音频协调视频画面生成。",videoAudioLockTooltip:"(仅多轨项目有效)锁定后,视频生成会遵循该视频轨道画面的时间线。视频轨道音频锁可与音频轨道锁同时启用;同时启用时,音频轨道将优先用于音频锁定和替换。",enableSpeakerReference:"复用为说话人音频",disableSpeakerReference:"停止复用说话人音频",speakerReferenceTooltip:"(仅 MiniMax)在每个任务中将此片段复用为该音轨对应的 @音频 引用;超过 15 秒时只取开头 15 秒。",enableSharedReference:"设为公共参考",disableSharedReference:"取消公共参考",sharedReferenceTooltip:"将此媒体作为该轨道在所有任务片段中的公共参考;公共音频最多使用开头 15 秒。",sharedImageReferenceTooltip:"将此图片设为公用图片,它将排在每个任务片段的私有图片之前;公共图片与私有图片每段合计最多 9 张。",sharedImageLimitTooltip:"已有任务片段包含 9 张不同图片,请先移除一张再设为公共图片。",previewTaskLabel:"任务{n}",emptyPreviewTitle:"还没有可预览的片段",emptyPreviewDescription:"请在下方轨道添加任务片段或视频片段。",emptyTaskTrack:"任务轨道",emptyTaskTrackPurpose:"未打标时,轨道中片段代表任务分割数量、片段中可编辑提示词、参考图片等。",emptyVideoTrack:"视频轨道",emptyVideoTrackPurpose:"拖拽或选择视频以添加,片段上右键支持智能分割、识别字幕。",emptyAudioTrack:"音频轨道",emptyAudioTrackPurpose:"拖拽或选择音频以添加,片段上右键支持识别字幕。",emptySubtitleTrack:"字幕轨道",emptySubtitleTrackPurpose:"添加、编辑字幕样式与定位,支持字幕朗读。",emptyTaskMarkers:"任务标签",emptyTaskMarkersPurpose:"打标后可以将多片段作为一轮循环任务。",emptyTaskOverview:"任务轨概览",emptyTaskOverviewPurpose:"展开任务轨,查看各片段的提示词和参考图片。",addVideo:"添加视频",addAudioSegment:"添加音频",externalMediaUploading:"正在上传 {name}...",addTrack:"添加轨道:",addVideoTrack:"添加视频轨",addAudioTrack:"添加音频轨",addSubtitleTrack:"添加字幕轨",addSubtitleSegment:"添加字幕",notSupportedYet:"暂不支持",deleteTrack:"删除{name}",reorderTrack:"拖动以调整{name}顺序",hideSubtitleTrack:"隐藏{name}",showSubtitleTrack:"显示{name}",muteTrack:"静音{name}",soloTrack:"独奏{name}",muteShort:"M",soloShort:"S",addTaskSegment:"添加任务片段",deleteSelectedSegment:"删除选中片段",addTaskMarker:"添加任务标记",deleteTaskMarker:"删除任务标记",taskMarkerLabel:"片段 {n}",taskMarkerAtFrame:"第 {frame} 帧任务标记",taskOverview:"任务轨概览",deleteSegment:"删除片段",subtitle:"字幕",text:"文字",editSubtitle:"编辑字幕",recognizeSubtitles:"识别字幕",recognizeSubtitlesQwen3:"Qwen3-ASR",recognizeSubtitlesWhisper:"Whisper Large V3",recognizingSubtitles:"正在识别字幕...",subtitleRecognitionFailed:"识别字幕失败",subtitleSpeechComplete:"音频生成完成",subtitleSpeechSaved:"音频生成完成保存到 {path}",subtitleSpeechFailed:"音频生成失败",subtitleTextSettings:"字幕文字设置",subtitleText:"字幕文字",fontSize:"字号",textColor:"文字颜色",outlineColor:"描边颜色",backgroundColor:"背景颜色",backgroundOpacity:"背景透明",backgroundOpacityPercent:"背景透明度(%)",presetStyle:"预设样式",applyPresetStyle:"应用{name}字幕样式",position:"位置",positionX:"X",positionY:"Y",subtitleWidth:"宽度",subtitleWidthShort:"宽",positionXPercent:"X(%)",positionYPercent:"Y(%)",subtitleWidthPercent:"宽度(%)",speech:"朗读",speechModel:"模型",speechPrompt:"控制指令",speechPromptPlaceholder:"控制指令:可以在此处描述语言、方言、情感、性别等。",speechCfg:"CFG",speechSteps:"推理步数",referenceAudio:"参考音频",addReferenceAudio:"添加参考音频",reselectReferenceAudio:"重选参考音频",playReferenceAudio:"播放参考音频",pauseReferenceAudio:"暂停参考音频",clearReferenceAudio:"清除参考音频",distributeTaskSegments:"均分片段",mergeTaskSegments:"合并片段",cloneTaskSegment:"复制片段",cloneVideoSegment:"复制视频",cloneAudioSegment:"复制音频",splitTaskSegment:"拆分片段",splitTaskSegmentDescription:"当前片段为 {frames} 帧({seconds} 秒),请输入每段拆分秒数。",splitTaskSegmentSeconds:"拆分秒数",splitTaskSegmentSecondsUnit:"秒",splitTaskSegmentPreview:"将拆分为 {count} 个片段。",splitTaskSegmentInvalid:"请输入至少 1 秒且小于当前片段时长的数值。",splitTaskSegmentConfirm:"拆分",smartSplit:"智能分割",smartSplitTasksOnly:"智能分割(仅任务)",noMatchingTaskSegment:"没有起止帧相同的任务片段。",smartSplitting:"正在智能分割...",smartSplitFailed:"智能分割失败",cutMode:"分割片段",trimLeftAtPlayhead:"向左裁剪",trimRightAtPlayhead:"向右裁剪",undo:"撤销",redo:"重做",play:"播放",pause:"暂停",timelineSnap:"时间线磁吸",hideTimeline:"隐藏轨道区域",showTimeline:"显示轨道区域",timelineZoom:"时间线缩放"},multitrackContinuityModes:{shot:"分镜",context:"上下文",context_swap:"上下文(主体替换)"},multitrackRefImageSizes:{match:"匹配尺寸",max:"最大尺寸"},modelDownload:{title:"缺少 {name} 模型",description:"需要将 {name} 安装到 {directory}。可以自动下载,或打开下载链接后手动放入该目录。自动下载将从 Hugging Face 中进行下载,如果您的网络不太稳定或长时间没有下载成功,请重启 ComfyUI,重新使用手动进行下载。",auto:"自动下载",manual:"手动下载",exit:"退出",close:"关闭",downloading:"下载中...",downloadComplete:"模型已安装",downloadCompleteDetail:"{name} 已下载,请重新执行操作。"},trackRow:{trackColor:"轨道颜色"},segmentBlock:{resizeStart:"调整片段开始",resizeEnd:"调整片段结束"},promptTrack:{distributeEvenly:"均匀分布",addSegment:"添加分段",deleteSegment:"删除选中片段",addSegmentTitle:"添加分段",promptPlaceholder:"提示词...",segmentLabel:"片段 {n}",empty:"空",editSegmentTitle:"编辑分段 {n}",contextEdit:"编辑片段",contextAdd:"添加分段",contextDistribute:"均匀分布",editDialogTitle:"编辑提示词",tabCombined:"整体编辑",tabIndividual:"逐段编辑",combinedHint:"用 | 分隔各分段,修改实时生效。",segmentCount:"共 {n} 个分段"},audioTrack:{addMarker:"添加标记",importFile:"导入音频文件…",importUrl:"从 URL 导入…",enterUrl:"请输入音频 URL:",frameLabel:"第 {n} 帧",markerAriaLabel:"标记:{label}",markerAtFrame:"第 {frame} 帧标记",editMarker:"编辑标记",markerLabelInput:"标记名称",placeholder:"音频轨道",placeholderHint:"双击可添加内容",dropZone:"音频轨道拖放区域",selectMedia:"选择音频",contextEdit:"编辑片段",contextAdd:"添加片段",contextDelete:"删除片段"},imageTrack:{dropZone:"图片轨道拖放区域",addSegment:"添加图片",deleteSegment:"删除选中片段",importFile:"导入图片文件…",importUrl:"从 URL 导入…",enterUrl:"请输入图片 URL:",placeholder:"图片轨道",placeholderHint:"双击可添加内容",contextReselect:"重选分片段",contextAdd:"添加分片段",contextDistribute:"均分分片段",contextDelete:"删除片段"},maintainTrack:{dropZone:"主轨拖放区域",segmentLabel:"片段 {n}",segmentPlaceholder:"点击片段修改提示...",placeholder:"添加片段",placeholderHint:"双击添加片段",promptPlaceholder:"提示词...",addImage:"添加图片",tabCombined:"整体编辑",tabIndividual:"逐段编辑",combinedHint:"用 | 分隔各分段,修改实时生效。",contextEdit:"编辑片段",contextAdd:"添加片段",contextClone:"克隆片段",contextDelete:"删除片段",contextDistribute:"均匀分布",addMedia:"添加媒体",flf:"首尾帧",fmlf:"多帧",ref:"参考帧"},insertButton:{insertBefore:"在此之前插入片段",insertAfter:"在此之后插入片段"},panorama:{applyView:"应用视角",cancel:"取消全景",cancelHint:"删除已保存的全景视角并退出",orientation:"横 {yaw}° · 纵 {pitch}°",zoom:"视场 {fov}° ×{ratio}",exit:"退出全景查看",loading:"正在加载全景图...",invalidView:"已保存的全景视角无效。",webglUnavailable:"当前环境无法使用 WebGL 全景渲染。",textureLoadFailed:"无法将此图片加载为全景纹理。"},multiImagesLoader:{add:"添加图像",replace:"替换图像 {n}",preview:"预览图像",delete:"删除图像",imageCount:"图片数量:{n}",clearAll:"清空所有"},mediaSelector:{tabInputs:"输入",tabOutputs:"输出",tabHistory:"历史",tabLocal:"本地",tabUrl:"URL",searchPlaceholder:"搜索...",sort:"排序:{by}",filter:"多选",selectAll:"全选",confirm:"确定",sortName:"名称",sortDate:"日期",sortFolders:"文件夹优先",viewList:"列表视图",viewGrid:"网格视图",refresh:"刷新",localPathPlaceholder:"本地文件夹绝对路径...",urlHint:"粘贴媒体文件的 http(s) URL。",urlConfirm:"确认 URL",urlChecking:"检测中...",urlErrorTitle:"URL 错误",urlErrorNotFound:"未找到文件,或服务器拒绝访问。",empty:"未找到文件",error:"加载失败:{msg}",tabSlot:"插槽",slotNotConnected:"未连接输入",slotEmpty:"暂无内容",slotList:"列表",slotImage:"图像 {n}",slotAudio:"音频 {n}",slotVideo:"视频 {n}",addLocal:"添加本地文件"}};var vr={en:$r,zh:zr},Ue=gt.createContext(void 0);function ui(t){if(!t)return"en";let e=t.split("-")[0].toLowerCase();return e in vr?e:"en"}function ki(t,e,r){let n=ui(t),i=vr[n],T=e.indexOf("."),u=T===-1?e:e.slice(0,T),p=T===-1?"":e.slice(T+1),m=i[u]?.[p]??e;if(r)for(let[k,f]of Object.entries(r))m=m.replaceAll(`{${k}}`,String(f));return m}function Kr(){let t=gt.useContext(Ue);return(e,r)=>ki(t,e,r)}var Gr="easy_media.sampling_preview",gr="execution_start";function pi(t){return t===void 0?"":String(t).split(":").at(-1)?.split(".").at(-1)}function mi(t,e){let r=typeof e==="function"?e():e;return[t.display_node_id,t.node_id].some((n)=>pi(n)===String(r))}function Mr(t,e){let r=atob(t),n=new Uint8Array(r.length);for(let i=0;i{let n=r.current;if(!n)return;n.width=t.bitmap.width,n.height=t.bitmap.height;let i=n.getContext("2d");if(!i){console.error("[SamplingPreviewWidget] 2D canvas context is unavailable");return}i.drawImage(t.bitmap,0,0)},[t]),l("canvas",{ref:r,role:"img","aria-label":e,className:"absolute inset-0 h-full w-full object-contain"})}function yi({app:t,nodeId:e,executionRevision:r=0,onVisibilityChange:n,interactive:i=!0,visibilityControlOnly:T=!1}){let u=Kr(),[p,m]=O.useState(null),[k,f]=O.useState(null),[E,o]=O.useState(""),[b,Z]=O.useState([]),[H,P]=O.useState(!0),[$,R]=O.useState(!0),[j,x]=O.useState(""),W=O.useRef(null),I=O.useRef(null),z=O.useRef(null),S=i&&!T,J=i||T,V=H?p:k??p;O.useEffect(()=>{let w=(F)=>{let K=F.detail;z.current=K&&typeof K==="object"&&"prompt_id"in K&&typeof K.prompt_id==="string"?K.prompt_id:null},v=(F)=>{let K=F.detail;if(!K?.image||!mi(K,e))return;if(z.current!==null&&K.prompt_id!==z.current)return;m(K)};return t.api.addCustomEventListener(gr,w),t.api.addCustomEventListener(Gr,v),()=>{t.api.removeCustomEventListener(gr,w),t.api.removeCustomEventListener(Gr,v)}},[t.api,e]),O.useEffect(()=>{m(null),f(null),P(!0),x("")},[r]),O.useEffect(()=>{n?.(p!==null)},[n,p]);let tt=O.useMemo(()=>V?Mr(V.image,V.mime):null,[V]);O.useEffect(()=>{if(!tt){o("");return}let w=URL.createObjectURL(tt);return o(w),()=>URL.revokeObjectURL(w)},[tt]),O.useEffect(()=>{let w=V?.images??[];if(w.length===0){Z([]);return}let v=w.map((F)=>URL.createObjectURL(Mr(F,"image/jpeg")));return Z(v),()=>v.forEach((F)=>URL.revokeObjectURL(F))},[V]);let g=Jr(tt,V?.image,S),it=b.length||V?.frame_count||g.length,ot=V?`${V.segment_index}:${V.sampling_pass}:${V.frame_count}:${V.fps}`:void 0,{frameIndex:C,progress:X}=Xr(ot,it,V?.fps??null,H);if(!V)return null;let U=u(`samplingPreview.${V.sampling_pass}`),Ht=g.length<=1||it<=1?0:Math.min(g.length-1,Math.floor(C/it*g.length)),et=g[Ht],A=b[Math.min(C,b.length-1)],Zt=V.mime==="image/webp"&&b.length===0&&et===void 0,Ft=()=>{if(!Zt)return;let w=W.current,v=I.current;if(!w?.complete||w.naturalWidth<=0||w.naturalHeight<=0||!v)return;v.width=w.naturalWidth,v.height=w.naturalHeight;let F=v.getContext("2d");if(!F){console.error("[SamplingPreviewWidget] 2D canvas context is unavailable");return}F.drawImage(w,0,0),x(E)},lt=()=>{if(H)Ft(),f(p),P(!1);else f(null),P(!0)},Tt=u(H?"samplingPreview.pausePreview":"samplingPreview.resumePreview"),Q=u("samplingPreview.meta",{segment:V.segment_index+1,pass:U,step:V.step,total:V.total}),B=l("div",{role:"progressbar","aria-label":u("samplingPreview.playbackProgress"),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(X),className:"h-1.5 w-full overflow-hidden rounded-full bg-muted",children:l("div",{className:"h-full rounded-full bg-primary",style:{width:`${X}%`}})});return Dt("div",{className:"relative flex h-full w-full flex-col overflow-hidden rounded-lg border border-border bg-black",children:[$?S?l(Yt,{type:"button",variant:"ghost","aria-label":Tt,onClick:lt,className:"relative min-h-0 flex-1 rounded-none p-0 hover:bg-black",children:A?l("img",{src:A,alt:u("samplingPreview.title"),draggable:!1,className:"absolute inset-0 h-full w-full object-contain"}):et?l(hi,{frame:et,label:u("samplingPreview.title")}):E?Dt($t,{children:[l("img",{ref:W,src:E,alt:u("samplingPreview.title"),draggable:!1,onLoad:()=>{if(!H&&!j)Ft()},className:"absolute inset-0 h-full w-full object-contain"}),l("canvas",{ref:I,"data-testid":"sampling-preview-frozen-frame","aria-hidden":"true",hidden:H||!j,className:"absolute inset-0 h-full w-full object-contain"})]}):null}):l("div",{className:"relative min-h-0 flex-1",children:A?l("img",{src:A,alt:u("samplingPreview.title"),draggable:!1,className:"absolute inset-0 h-full w-full object-contain"}):E?l("img",{src:E,alt:u("samplingPreview.title"),draggable:!1,className:"absolute inset-0 h-full w-full object-contain"}):null}):l("div",{"data-testid":"sampling-preview-placeholder","aria-hidden":"true",className:"min-h-0 flex-1 bg-black"}),Dt("div",{className:"shrink-0 border-t border-border bg-background px-2 py-1 gap-0",children:[Dt("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[l("span",{children:Q}),J?l(Yt,{type:"button",variant:"ghost",size:"icon","aria-label":u($?"samplingPreview.hidePreview":"samplingPreview.showPreview"),onClick:()=>R((w)=>!w),className:"pointer-events-auto h-6 w-6",children:$?l(Vt,{}):l(wt,{})}):null]}),S?l(Yt,{type:"button",variant:"ghost","aria-label":Tt,onClick:lt,className:"h-3 w-full rounded-full p-0 hover:bg-muted",children:B}):l("div",{className:"h-3 w-full rounded-full p-0",children:B})]})]})}function UDe(t){let e=t.app?.ui?.settings?.settingsValues?.["Comfy.Locale"];return l(Ue.Provider,{value:e,children:l(yi,{...t})})} +import{Aa as L}from"./index-1wrhp8dx.js";import{sc as N}from"./index-xcg45zk8.js";var xr=new Set(["easy timelineEditor","easy multiTrackEditor"]);var Wr={"easy timelineEditor":[520,430],"easy multiTrackEditor":[800,700]};function rt(t){if(Array.isArray(t)&&t.length>=2){let i=Number(t[0]),T=Number(t[1]);return Number.isFinite(i)&&Number.isFinite(T)?[i,T]:null}if(ArrayBuffer.isView(t)&&"length"in t&&Number(t.length)>=2){let i=t,T=Number(i[0]),u=Number(i[1]);return Number.isFinite(T)&&Number.isFinite(u)?[T,u]:null}if(!t||typeof t!=="object")return null;let e=t,r=Number(e.width??e[0]),n=Number(e.height??e[1]);return Number.isFinite(r)&&Number.isFinite(n)?[r,n]:null}function Le(t,e){let r=Number(t?.properties?.easyMediaTimelineHeight??e?.properties?.easyMediaTimelineHeight);if(Number.isFinite(r)&&r>0)return r;return rt(e?.size)?.[1]??null}function bt(t,e){let r=Number(e);if(!Number.isFinite(r)||r<=0)return;t.properties??={},t.properties.easyMediaTimelineHeight=r}function _e(t,e,r){let n=rt(t.size);if(!n||Math.abs(n[1]-e)<1)return;let i=n[0]||r||480;if(typeof t.setSize==="function")t.setSize([i,e]);else t.size=[i,e];t.setDirtyCanvas?.(!0,!0)}function ae(t){let e=Number(t?.__easyMediaTimelineHeightRestoreVersion);t.__easyMediaTimelineHeightRestoreVersion=Number.isFinite(e)?e+1:1}function Si(t,e){let r=rt(t?.size);if(!r||!Number.isFinite(e)||e===0)return;let n=Math.max(1,r[1]+e);ae(t),delete t.__easyMediaTimelineWidgetResizeGuard,bt(t,n),_e(t,n,r[0])}function xt(t,e,r){if(!Number.isFinite(e)||e===null||e<=0)return;let n=Number(t?.__easyMediaTimelineHeightRestoreVersion)||0;globalThis.setTimeout(()=>{if((Number(t?.__easyMediaTimelineHeightRestoreVersion)||0)!==n)return;_e(t,e,r)},100)}function Ne(t){let e=t?.__easyMediaTimelineWidgetResizeGuard;if(!e||!Number.isFinite(e.height)||e.height<=0)return null;if(Date.now()>e.expiresAt)return delete t.__easyMediaTimelineWidgetResizeGuard,null;return e}function Ir(t){let e=rt(t?.size),r=Le(t)??e?.[1]??null;if(!Number.isFinite(r)||r===null||r<=0)return;t.properties??={},t.properties.easyMediaTimelineHeight=r,t.__easyMediaTimelineWidgetResizeGuard={height:r,width:e?.[0],expiresAt:Date.now()+500}}function Ai(t,e){if(!xr.has(e.name||""))return;let r=t.prototype.onNodeCreated,n=t.prototype.onConfigure,i=t.prototype.onResize,T=t.prototype.onSerialize,u=t.prototype.onWidgetChanged;t.prototype.onNodeCreated=function(){r?.call(this);let p=e.name||"",m=Wr[p];if(!m)return;this.size[0]=m[0],this.size[1]=m[1],this.setDirtyCanvas?.(!0,!0)},t.prototype.onConfigure=function(p){n?.call(this,p);let m=Le(this,p);if(ae(this),m!==null)bt(this,m);xt(this,m,rt(p?.size)?.[0])},t.prototype.onResize=function(p){i?.call(this,p);let m=rt(p);if(!m)return;let k=Ne(this);if(k){bt(this,k.height),xt(this,k.height,k.width??m[0]);return}bt(this,m[1])},t.prototype.onWidgetChanged=function(p,m,k,f){Ir(this),u?.call(this,p,m,k,f);let E=Ne(this);if(E)xt(this,E.height,E.width)},t.prototype.onSerialize=function(p){T?.call(this,p);let m=rt(this.size);if(m)bt(this,m[1]);p.properties??={},p.properties.easyMediaTimelineHeight=this.properties?.easyMediaTimelineHeight}}var Ei={project_name:"default",width:0,height:0,frame_rate:24,clips:[],auto_combine:!0};var O=N(L(),1);var Xt=N(L(),1);var Qt=(...t)=>t.filter((e,r,n)=>{return Boolean(e)&&e.trim()!==""&&n.indexOf(e)===r}).join(" ").trim();var je=(t)=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();var se=(t)=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,r,n)=>n?n.toUpperCase():r.toLowerCase());var Wt=(t)=>{let e=se(t);return e.charAt(0).toUpperCase()+e.slice(1)};var Pt=N(L(),1);var Jt={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"};var ce=(t)=>{for(let e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0;return!1};var ut=N(L(),1),Cr=ut.createContext({});var tr=()=>ut.useContext(Cr);var er=Pt.forwardRef(({color:t,size:e,strokeWidth:r,absoluteStrokeWidth:n,className:i="",children:T,iconNode:u,...p},m)=>{let{size:k=24,strokeWidth:f=2,absoluteStrokeWidth:E=!1,color:o="currentColor",className:b=""}=tr()??{},Z=n??E?Number(r??f)*24/Number(e??k):r??f;return Pt.createElement("svg",{ref:m,...Jt,width:e??k??Jt.width,height:e??k??Jt.height,stroke:t??o,strokeWidth:Z,className:Qt("lucide",b,i),...!T&&!ce(p)&&{"aria-hidden":"true"},...p},[...u.map(([H,P])=>Pt.createElement(H,P)),...Array.isArray(T)?T:[T]])});var d=(t,e)=>{let r=Xt.forwardRef(({className:n,...i},T)=>Xt.createElement(er,{ref:T,iconNode:e,className:Qt(`lucide-${je(Wt(t))}`,`lucide-${t}`,n),...i}));return r.displayName=Wt(t),r};var Ur=[["rect",{width:"18",height:"14",x:"3",y:"5",rx:"2",ry:"2",key:"12ruh7"}],["path",{d:"M7 15h4M15 15h2M7 11h2M13 11h4",key:"1ueiar"}]],kt=d("captions",Ur);var Nr=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],pt=d("circle-check",Nr);var Lr=[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]],mt=d("cloud-upload",Lr);var _r=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],ht=d("columns-2",_r);var ar=[["path",{d:"M4 6.835V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-.343",key:"1vfytu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M2 19a2 2 0 0 1 4 0v1a2 2 0 0 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 0 1-4 0v-1a2 2 0 0 1 4 0",key:"1etmh7"}]],_=d("file-headphone",ar);var jr=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M15.033 13.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56v-4.704a.645.645 0 0 1 .967-.56z",key:"1tzo1f"}]],yt=d("file-play",jr);var sr=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],St=d("loader-circle",sr);var cr=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]],At=d("lock-open",cr);var tn=[["path",{d:"m11 7.601-5.994 8.19a1 1 0 0 0 .1 1.298l.817.818a1 1 0 0 0 1.314.087L15.09 12",key:"80a601"}],["path",{d:"M16.5 21.174C15.5 20.5 14.372 20 13 20c-2.058 0-3.928 2.356-6 2-2.072-.356-2.775-3.369-1.5-4.5",key:"j0ngtp"}],["circle",{cx:"16",cy:"7",r:"5",key:"d08jfb"}]],ft=d("mic-vocal",tn);var en=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],Et=d("panel-left",en);var rn=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],It=d("arrow-left",rn);var nn=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],Ct=d("arrow-up-down",nn);var dn=[["path",{d:"M2 10v3",key:"1fnikh"}],["path",{d:"M6 6v11",key:"11sgs0"}],["path",{d:"M10 3v18",key:"yhl04a"}],["path",{d:"M14 8v7",key:"3a1oy3"}],["path",{d:"M18 5v13",key:"123xd1"}],["path",{d:"M22 10v3",key:"154ddg"}]],Ut=d("audio-lines",dn);var Tn=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}]],Nt=d("ban",Tn);var un=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Lt=d("check",un);var kn=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],_t=d("chevron-down",kn);var pn=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],at=d("chevron-right",pn);var mn=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],jt=d("chevron-up",mn);var hn=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],st=d("circle",hn);var yn=[["path",{d:"m12.296 3.464 3.02 3.956",key:"qash78"}],["path",{d:"M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3z",key:"1h7j8b"}],["path",{d:"M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"4lm6w1"}],["path",{d:"m6.18 5.276 3.1 3.899",key:"zjj9t3"}]],ct=d("clapperboard",yn);var Sn=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],te=d("download",Sn);var An=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],ee=d("external-link",An);var fn=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],Vt=d("eye-off",fn);var En=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],wt=d("eye",En);var Dn=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],re=d("file",Dn);var on=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 3v18",key:"bbkbws"}],["path",{d:"M3 7.5h4",key:"zfgn84"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 16.5h4",key:"1230mu"}],["path",{d:"M17 3v18",key:"in4fa5"}],["path",{d:"M17 7.5h4",key:"myr1c1"}],["path",{d:"M17 16.5h4",key:"go4c1d"}]],ne=d("film",on);var Hn=[["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"}]],de=d("folder-open",Hn);var Fn=[["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"}]],ie=d("folder",Fn);var ln=[["path",{d:"M2 7v10",key:"a2pl2d"}],["path",{d:"M6 5v14",key:"1kq3d7"}],["rect",{width:"12",height:"18",x:"10",y:"3",rx:"2",key:"13i7bc"}]],Te=d("gallery-horizontal-end",ln);var bn=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],ue=d("gauge",bn);var Pn=[["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"}]],ke=d("grip-vertical",Pn);var Vn=[["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"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],pe=d("history",Vn);var wn=[["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"}]],me=d("image",wn);var On=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],he=d("key-round",On);var Yn=[["path",{d:"M13 13.74a2 2 0 0 1-2 0L2.5 8.87a1 1 0 0 1 0-1.74L11 2.26a2 2 0 0 1 2 0l8.5 4.87a1 1 0 0 1 0 1.74z",key:"15q6uc"}],["path",{d:"m20 14.285 1.5.845a1 1 0 0 1 0 1.74L13 21.74a2 2 0 0 1-2 0l-8.5-4.87a1 1 0 0 1 0-1.74l1.5-.845",key:"byia6g"}]],ye=d("layers-2",Yn);var Zn=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],Se=d("layout-grid",Zn);var Rn=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}],["path",{d:"M14 4h7",key:"3xa0d5"}],["path",{d:"M14 9h7",key:"1icrd9"}],["path",{d:"M14 15h7",key:"1mj8o2"}],["path",{d:"M14 20h7",key:"11slyb"}]],Ae=d("layout-list",Rn);var qn=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],fe=d("link-2",qn);var Bn=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]],Ee=d("list-checks",Bn);var Qn=[["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"M3 10a2 2 0 0 0 2 2h3",key:"1npucw"}],["path",{d:"M3 5v12a2 2 0 0 0 2 2h3",key:"x1gjn2"}]],De=d("list-tree",Qn);var Jn=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],oe=d("lock",Jn);var Xn=[["path",{d:"m12 15 4 4",key:"lnac28"}],["path",{d:"M2.352 10.648a1.205 1.205 0 0 0 0 1.704l2.296 2.296a1.205 1.205 0 0 0 1.704 0l6.029-6.029a1 1 0 1 1 3 3l-6.029 6.029a1.205 1.205 0 0 0 0 1.704l2.296 2.296a1.205 1.205 0 0 0 1.704 0l6.365-6.367A1 1 0 0 0 8.716 4.282z",key:"nlhkjb"}],["path",{d:"m5 8 4 4",key:"j6kj7e"}]],He=d("magnet",Xn);var $n=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],Fe=d("maximize-2",$n);var zn=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],le=d("minimize-2",zn);var vn=[["circle",{cx:"8",cy:"18",r:"4",key:"1fc0mg"}],["path",{d:"M12 18V2l7 4",key:"g04rme"}]],be=d("music-2",vn);var Kn=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]],Pe=d("panel-right",Kn);var Gn=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],Ve=d("pause",Gn);var gn=[["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"}]],we=d("pencil",gn);var Mn=[["path",{d:"m12 9-8.414 8.414A2 2 0 0 0 3 18.828v1.344a2 2 0 0 1-.586 1.414A2 2 0 0 1 3.828 21h1.344a2 2 0 0 0 1.414-.586L15 12",key:"1y3wsu"}],["path",{d:"m18 9 .4.4a1 1 0 1 1-3 3l-3.8-3.8a1 1 0 1 1 3-3l.4.4 3.4-3.4a1 1 0 1 1 3 3z",key:"110lr1"}],["path",{d:"m2 22 .414-.414",key:"jhxm08"}]],Oe=d("pipette",Mn);var xn=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],Ye=d("play",xn);var Wn=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Ze=d("plus",Wn);var In=[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]],Re=d("redo-2",In);var Cn=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],qe=d("refresh-cw",Cn);var Un=[["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"}]],Be=d("rotate-ccw",Un);var Nn=[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]],Qe=d("scissors",Nn);var Ln=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Je=d("search",Ln);var _n=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],Xe=d("settings-2",_n);var an=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],$e=d("share-2",an);var jn=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],ze=d("trash-2",jn);var sn=[["path",{d:"M12 4v16",key:"1654pz"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2",key:"e0r10z"}],["path",{d:"M9 20h6",key:"s66wpe"}]],ve=d("type",sn);var cn=[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]],Ke=d("undo-2",cn);var td=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]],Ge=d("volume-2",td);var ed=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]],ge=d("volume-x",ed);var rd=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Me=d("x",rd);var nd=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],xe=d("zoom-out",nd);var Qr=N(L(),1);var Y=N(L(),1);var dd=N(L(),1);function rr(t,e){if(typeof t==="function")return t(e);else if(t!==null&&t!==void 0)t.current=e}function nr(...t){return(e)=>{let r=!1,n=t.map((i)=>{let T=rr(i,e);if(!r&&typeof T=="function")r=!0;return T});if(r)return()=>{for(let i=0;i{let{children:T,...u}=n;if(ir(T)&&typeof zt==="function")T=zt(T._payload);let p=Y.Children.toArray(T),m=p.find(yd);if(m){let k=m.props.children,f=p.map((E)=>{if(E===m){if(Y.Children.count(k)>1)return Y.Children.only(null);return Y.isValidElement(k)?k.props.children:null}else return E});return l(e,{...u,ref:i,children:Y.isValidElement(k)?Y.cloneElement(k,void 0,f):null})}return l(e,{...u,ref:i,children:T})});return r.displayName=`${t}.Slot`,r}var Tr=pd("Slot");function md(t){let e=Y.forwardRef((r,n)=>{let{children:i,...T}=r;if(ir(i)&&typeof zt==="function")i=zt(i._payload);if(Y.isValidElement(i)){let u=Ad(i),p=Sd(T,i.props);if(i.type!==Y.Fragment)p.ref=n?nr(n,u):u;return Y.cloneElement(i,p)}return Y.Children.count(i)>1?Y.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var hd=Symbol("radix.slottable");function yd(t){return Y.isValidElement(t)&&typeof t.type==="function"&&"__radixId"in t.type&&t.type.__radixId===hd}function Sd(t,e){let r={...e};for(let n in e){let i=t[n],T=e[n];if(/^on[A-Z]/.test(n)){if(i&&T)r[n]=(...p)=>{let m=T(...p);return i(...p),m};else if(i)r[n]=i}else if(n==="style")r[n]={...i,...T};else if(n==="className")r[n]=[i,T].filter(Boolean).join(" ")}return{...t,...r}}function Ad(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning;if(r)return t.ref;if(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r)return t.props.ref;return t.props.ref||t.ref}function ur(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;etypeof t==="boolean"?`${t}`:t===0?"0":t,pr=vt,mr=(t,e)=>(r)=>{var n;if((e===null||e===void 0?void 0:e.variants)==null)return pr(t,r===null||r===void 0?void 0:r.class,r===null||r===void 0?void 0:r.className);let{variants:i,defaultVariants:T}=e,u=Object.keys(i).map((k)=>{let f=r===null||r===void 0?void 0:r[k],E=T===null||T===void 0?void 0:T[k];if(f===null)return null;let o=kr(f)||kr(E);return i[k][o]}),p=r&&Object.entries(r).reduce((k,f)=>{let[E,o]=f;if(o===void 0)return k;return k[E]=o,k},{}),m=e===null||e===void 0?void 0:(n=e.compoundVariants)===null||n===void 0?void 0:n.reduce((k,f)=>{let{class:E,className:o,...b}=f;return Object.entries(b).every((Z)=>{let[H,P]=Z;return Array.isArray(P)?P.includes({...T,...p}[H]):{...T,...p}[H]===P})?[...k,E,o]:k},[]);return pr(t,u,m,r===null||r===void 0?void 0:r.class,r===null||r===void 0?void 0:r.className)};var fd=(t,e)=>{let r=Array(t.length+e.length);for(let n=0;n({classGroupId:t,validator:e}),Er=(t=new Map,e=null,r)=>({nextPart:t,validators:e,classGroupId:r});var hr=[];var Dd=(t)=>{let e=Hd(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:(u)=>{if(u.startsWith("[")&&u.endsWith("]"))return od(u);let p=u.split("-"),m=p[0]===""&&p.length>1?1:0;return Dr(p,m,e)},getConflictingClassGroupIds:(u,p)=>{if(p){let m=n[u],k=r[u];if(m){if(k)return fd(k,m);return m}return k||hr}return r[u]||hr}}},Dr=(t,e,r)=>{if(t.length-e===0)return r.classGroupId;let i=t[e],T=r.nextPart.get(i);if(T){let k=Dr(t,e+1,T);if(k)return k}let u=r.validators;if(u===null)return;let p=e===0?t.join("-"):t.slice(e).join("-"),m=u.length;for(let k=0;kt.slice(1,-1).indexOf(":")===-1?void 0:(()=>{let e=t.slice(1,-1),r=e.indexOf(":"),n=e.slice(0,r);return n?"arbitrary.."+n:void 0})(),Hd=(t)=>{let{theme:e,classGroups:r}=t;return Fd(r,e)},Fd=(t,e)=>{let r=Er();for(let n in t){let i=t[n];Ie(i,r,n,e)}return r},Ie=(t,e,r,n)=>{let i=t.length;for(let T=0;T{if(typeof t==="string"){bd(t,e,r);return}if(typeof t==="function"){Pd(t,e,r,n);return}Vd(t,e,r,n)},bd=(t,e,r)=>{let n=t===""?e:or(e,t);n.classGroupId=r},Pd=(t,e,r,n)=>{if(wd(t)){Ie(t(n),e,r,n);return}if(e.validators===null)e.validators=[];e.validators.push(Ed(r,t))},Vd=(t,e,r,n)=>{let i=Object.entries(t),T=i.length;for(let u=0;u{let r=t,n=e.split("-"),i=n.length;for(let T=0;T("isThemeGetter"in t)&&t.isThemeGetter===!0,Od=(t)=>{if(t<1)return{get:()=>{return},set:()=>{}};let e=0,r=Object.create(null),n=Object.create(null),i=(T,u)=>{if(r[T]=u,e++,e>t)e=0,n=r,r=Object.create(null)};return{get(T){let u=r[T];if(u!==void 0)return u;if((u=n[T])!==void 0)return i(T,u),u},set(T,u){if(T in r)r[T]=u;else i(T,u)}}};var Yd=[],yr=(t,e,r,n,i)=>({modifiers:t,hasImportantModifier:e,baseClassName:r,maybePostfixModifierPosition:n,isExternal:i}),Zd=(t)=>{let{prefix:e,experimentalParseClassName:r}=t,n=(i)=>{let T=[],u=0,p=0,m=0,k,f=i.length;for(let H=0;Hm?k-m:void 0;return yr(T,b,o,Z)};if(e){let i=e+":",T=n;n=(u)=>u.startsWith(i)?T(u.slice(i.length)):yr(Yd,!1,u,void 0,!0)}if(r){let i=n;n=(T)=>r({className:T,parseClassName:i})}return n},Rd=(t)=>{let e=new Map;return t.orderSensitiveModifiers.forEach((r,n)=>{e.set(r,1e6+n)}),(r)=>{let n=[],i=[];for(let T=0;T0)i.sort(),n.push(...i),i=[];n.push(u)}else i.push(u)}if(i.length>0)i.sort(),n.push(...i);return n}},qd=(t)=>({cache:Od(t.cacheSize),parseClassName:Zd(t),sortModifiers:Rd(t),postfixLookupClassGroupIds:Bd(t),...Dd(t)}),Bd=(t)=>{let e=Object.create(null),r=t.postfixLookupClassGroups;if(r)for(let n=0;n{let{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:i,sortModifiers:T,postfixLookupClassGroupIds:u}=e,p=[],m=t.trim().split(Qd),k="";for(let f=m.length-1;f>=0;f-=1){let E=m[f],{isExternal:o,modifiers:b,hasImportantModifier:Z,baseClassName:H,maybePostfixModifierPosition:P}=r(E);if(o){k=E+(k.length>0?" "+k:k);continue}let $=!!P,R;if($){let z=H.substring(0,P);R=n(z);let S=R&&u[R]?n(H):void 0;if(S&&S!==R)R=S,$=!1}else R=n(H);if(!R){if(!$){k=E+(k.length>0?" "+k:k);continue}if(R=n(H),!R){k=E+(k.length>0?" "+k:k);continue}$=!1}let j=b.length===0?"":b.length===1?b[0]:T(b).join(":"),x=Z?j+"!":j,W=x+R;if(p.indexOf(W)>-1)continue;p.push(W);let I=i(R,$);for(let z=0;z0?" "+k:k)}return k},Xd=(...t)=>{let e=0,r,n,i="";while(e{if(typeof t==="string")return t;let e,r="";for(let n=0;n{let r,n,i,T,u=(m)=>{let k=e.reduce((f,E)=>E(f),t());return r=qd(k),n=r.cache.get,i=r.cache.set,T=p,p(m)},p=(m)=>{let k=n(m);if(k)return k;let f=Jd(m,r);return i(m,f),f};return T=u,(...m)=>T(Xd(...m))},zd=[],q=(t)=>{let e=(r)=>r[t]||zd;return e.isThemeGetter=!0,e},Fr=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,lr=/^\((?:(\w[\w-]*):)?(.+)\)$/i,vd=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Kd=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Gd=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,gd=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Md=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,xd=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,s=(t)=>vd.test(t),D=(t)=>!!t&&!Number.isNaN(Number(t)),M=(t)=>!!t&&Number.isInteger(Number(t)),We=(t)=>t.endsWith("%")&&D(t.slice(0,-1)),a=(t)=>Kd.test(t),br=()=>!0,Wd=(t)=>Gd.test(t)&&!gd.test(t),Ce=()=>!1,Id=(t)=>Md.test(t),Cd=(t)=>xd.test(t),Ud=(t)=>!h(t)&&!y(t),Nd=(t)=>t.startsWith("@container")&&(t[10]==="/"&&t[11]!==void 0||t[11]==="s"&&t[16]!==void 0&&t.startsWith("-size/",10)||t[11]==="n"&&t[18]!==void 0&&t.startsWith("-normal/",10)),Ld=(t)=>c(t,wr,Ce),h=(t)=>Fr.test(t),nt=(t)=>c(t,Or,Wd),Sr=(t)=>c(t,ri,D),_d=(t)=>c(t,Zr,br),ad=(t)=>c(t,Yr,Ce),Ar=(t)=>c(t,Pr,Ce),jd=(t)=>c(t,Vr,Cd),Kt=(t)=>c(t,Rr,Id),y=(t)=>lr.test(t),Ot=(t)=>dt(t,Or),sd=(t)=>dt(t,Yr),fr=(t)=>dt(t,Pr),cd=(t)=>dt(t,wr),ti=(t)=>dt(t,Vr),Gt=(t)=>dt(t,Rr,!0),ei=(t)=>dt(t,Zr,!0),c=(t,e,r)=>{let n=Fr.exec(t);if(n){if(n[1])return e(n[1]);return r(n[2])}return!1},dt=(t,e,r=!1)=>{let n=lr.exec(t);if(n){if(n[1])return e(n[1]);return r}return!1},Pr=(t)=>t==="position"||t==="percentage",Vr=(t)=>t==="image"||t==="url",wr=(t)=>t==="length"||t==="size"||t==="bg-size",Or=(t)=>t==="length",ri=(t)=>t==="number",Yr=(t)=>t==="family-name",Zr=(t)=>t==="number"||t==="weight",Rr=(t)=>t==="shadow";var ni=()=>{let t=q("color"),e=q("font"),r=q("text"),n=q("font-weight"),i=q("tracking"),T=q("leading"),u=q("breakpoint"),p=q("container"),m=q("spacing"),k=q("radius"),f=q("shadow"),E=q("inset-shadow"),o=q("text-shadow"),b=q("drop-shadow"),Z=q("blur"),H=q("perspective"),P=q("aspect"),$=q("ease"),R=q("animate"),j=()=>["auto","avoid","all","avoid-page","page","left","right","column"],x=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],W=()=>[...x(),y,h],I=()=>["auto","hidden","clip","visible","scroll"],z=()=>["auto","contain","none"],S=()=>[y,h,m],J=()=>[s,"full","auto",...S()],V=()=>[M,"none","subgrid",y,h],tt=()=>["auto",{span:["full",M,y,h]},M,y,h],g=()=>[M,"auto",y,h],it=()=>["auto","min","max","fr",y,h],ot=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],C=()=>["start","end","center","stretch","center-safe","end-safe"],X=()=>["auto",...S()],U=()=>[s,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...S()],Ht=()=>[s,"screen","full","dvw","lvw","svw","min","max","fit",...S()],et=()=>[s,"screen","full","lh","dvh","lvh","svh","min","max","fit",...S()],A=()=>[t,y,h],Zt=()=>[...x(),fr,Ar,{position:[y,h]}],Ft=()=>["no-repeat",{repeat:["","x","y","space","round"]}],lt=()=>["auto","cover","contain",cd,Ld,{size:[y,h]}],Tt=()=>[We,Ot,nt],Q=()=>["","none","full",k,y,h],B=()=>["",D,Ot,nt],w=()=>["solid","dashed","dotted","double"],v=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],F=()=>[D,We,fr,Ar],K=()=>["","none",Z,y,h],Rt=()=>["none",D,y,h],qt=()=>["none",D,y,h],Mt=()=>[D,y,h],Bt=()=>[s,"full",...S()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[a],breakpoint:[a],color:[br],container:[a],"drop-shadow":[a],ease:["in","out","in-out"],font:[Ud],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[a],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[a],shadow:[a],spacing:["px",D],text:[a],"text-shadow":[a],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",s,h,y,P]}],container:["container"],"container-type":[{"@container":["","normal","size",y,h]}],"container-named":[Nd],columns:[{columns:[D,h,y,p]}],"break-after":[{"break-after":j()}],"break-before":[{"break-before":j()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:W()}],overflow:[{overflow:I()}],"overflow-x":[{"overflow-x":I()}],"overflow-y":[{"overflow-y":I()}],overscroll:[{overscroll:z()}],"overscroll-x":[{"overscroll-x":z()}],"overscroll-y":[{"overscroll-y":z()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:J()}],"inset-x":[{"inset-x":J()}],"inset-y":[{"inset-y":J()}],start:[{"inset-s":J(),start:J()}],end:[{"inset-e":J(),end:J()}],"inset-bs":[{"inset-bs":J()}],"inset-be":[{"inset-be":J()}],top:[{top:J()}],right:[{right:J()}],bottom:[{bottom:J()}],left:[{left:J()}],visibility:["visible","invisible","collapse"],z:[{z:[M,"auto",y,h]}],basis:[{basis:[s,"full","auto",p,...S()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[D,s,"auto","initial","none",h]}],grow:[{grow:["",D,y,h]}],shrink:[{shrink:["",D,y,h]}],order:[{order:[M,"first","last","none",y,h]}],"grid-cols":[{"grid-cols":V()}],"col-start-end":[{col:tt()}],"col-start":[{"col-start":g()}],"col-end":[{"col-end":g()}],"grid-rows":[{"grid-rows":V()}],"row-start-end":[{row:tt()}],"row-start":[{"row-start":g()}],"row-end":[{"row-end":g()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":it()}],"auto-rows":[{"auto-rows":it()}],gap:[{gap:S()}],"gap-x":[{"gap-x":S()}],"gap-y":[{"gap-y":S()}],"justify-content":[{justify:[...ot(),"normal"]}],"justify-items":[{"justify-items":[...C(),"normal"]}],"justify-self":[{"justify-self":["auto",...C()]}],"align-content":[{content:["normal",...ot()]}],"align-items":[{items:[...C(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...C(),{baseline:["","last"]}]}],"place-content":[{"place-content":ot()}],"place-items":[{"place-items":[...C(),"baseline"]}],"place-self":[{"place-self":["auto",...C()]}],p:[{p:S()}],px:[{px:S()}],py:[{py:S()}],ps:[{ps:S()}],pe:[{pe:S()}],pbs:[{pbs:S()}],pbe:[{pbe:S()}],pt:[{pt:S()}],pr:[{pr:S()}],pb:[{pb:S()}],pl:[{pl:S()}],m:[{m:X()}],mx:[{mx:X()}],my:[{my:X()}],ms:[{ms:X()}],me:[{me:X()}],mbs:[{mbs:X()}],mbe:[{mbe:X()}],mt:[{mt:X()}],mr:[{mr:X()}],mb:[{mb:X()}],ml:[{ml:X()}],"space-x":[{"space-x":S()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":S()}],"space-y-reverse":["space-y-reverse"],size:[{size:U()}],"inline-size":[{inline:["auto",...Ht()]}],"min-inline-size":[{"min-inline":["auto",...Ht()]}],"max-inline-size":[{"max-inline":["none",...Ht()]}],"block-size":[{block:["auto",...et()]}],"min-block-size":[{"min-block":["auto",...et()]}],"max-block-size":[{"max-block":["none",...et()]}],w:[{w:[p,"screen",...U()]}],"min-w":[{"min-w":[p,"screen","none",...U()]}],"max-w":[{"max-w":[p,"screen","none","prose",{screen:[u]},...U()]}],h:[{h:["screen","lh",...U()]}],"min-h":[{"min-h":["screen","lh","none",...U()]}],"max-h":[{"max-h":["screen","lh",...U()]}],"font-size":[{text:["base",r,Ot,nt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,ei,_d]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",We,h]}],"font-family":[{font:[sd,ad,e]}],"font-features":[{"font-features":[h]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,y,h]}],"line-clamp":[{"line-clamp":[D,"none",y,Sr]}],leading:[{leading:[T,...S()]}],"list-image":[{"list-image":["none",y,h]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",y,h]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:A()}],"text-color":[{text:A()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...w(),"wavy"]}],"text-decoration-thickness":[{decoration:[D,"from-font","auto",y,nt]}],"text-decoration-color":[{decoration:A()}],"underline-offset":[{"underline-offset":[D,"auto",y,h]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:S()}],"tab-size":[{tab:[M,y,h]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",y,h]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",y,h]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Zt()}],"bg-repeat":[{bg:Ft()}],"bg-size":[{bg:lt()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},M,y,h],radial:["",y,h],conic:[M,y,h]},ti,jd]}],"bg-color":[{bg:A()}],"gradient-from-pos":[{from:Tt()}],"gradient-via-pos":[{via:Tt()}],"gradient-to-pos":[{to:Tt()}],"gradient-from":[{from:A()}],"gradient-via":[{via:A()}],"gradient-to":[{to:A()}],rounded:[{rounded:Q()}],"rounded-s":[{"rounded-s":Q()}],"rounded-e":[{"rounded-e":Q()}],"rounded-t":[{"rounded-t":Q()}],"rounded-r":[{"rounded-r":Q()}],"rounded-b":[{"rounded-b":Q()}],"rounded-l":[{"rounded-l":Q()}],"rounded-ss":[{"rounded-ss":Q()}],"rounded-se":[{"rounded-se":Q()}],"rounded-ee":[{"rounded-ee":Q()}],"rounded-es":[{"rounded-es":Q()}],"rounded-tl":[{"rounded-tl":Q()}],"rounded-tr":[{"rounded-tr":Q()}],"rounded-br":[{"rounded-br":Q()}],"rounded-bl":[{"rounded-bl":Q()}],"border-w":[{border:B()}],"border-w-x":[{"border-x":B()}],"border-w-y":[{"border-y":B()}],"border-w-s":[{"border-s":B()}],"border-w-e":[{"border-e":B()}],"border-w-bs":[{"border-bs":B()}],"border-w-be":[{"border-be":B()}],"border-w-t":[{"border-t":B()}],"border-w-r":[{"border-r":B()}],"border-w-b":[{"border-b":B()}],"border-w-l":[{"border-l":B()}],"divide-x":[{"divide-x":B()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":B()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...w(),"hidden","none"]}],"divide-style":[{divide:[...w(),"hidden","none"]}],"border-color":[{border:A()}],"border-color-x":[{"border-x":A()}],"border-color-y":[{"border-y":A()}],"border-color-s":[{"border-s":A()}],"border-color-e":[{"border-e":A()}],"border-color-bs":[{"border-bs":A()}],"border-color-be":[{"border-be":A()}],"border-color-t":[{"border-t":A()}],"border-color-r":[{"border-r":A()}],"border-color-b":[{"border-b":A()}],"border-color-l":[{"border-l":A()}],"divide-color":[{divide:A()}],"outline-style":[{outline:[...w(),"none","hidden"]}],"outline-offset":[{"outline-offset":[D,y,h]}],"outline-w":[{outline:["",D,Ot,nt]}],"outline-color":[{outline:A()}],shadow:[{shadow:["","none",f,Gt,Kt]}],"shadow-color":[{shadow:A()}],"inset-shadow":[{"inset-shadow":["none",E,Gt,Kt]}],"inset-shadow-color":[{"inset-shadow":A()}],"ring-w":[{ring:B()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:A()}],"ring-offset-w":[{"ring-offset":[D,nt]}],"ring-offset-color":[{"ring-offset":A()}],"inset-ring-w":[{"inset-ring":B()}],"inset-ring-color":[{"inset-ring":A()}],"text-shadow":[{"text-shadow":["none",o,Gt,Kt]}],"text-shadow-color":[{"text-shadow":A()}],opacity:[{opacity:[D,y,h]}],"mix-blend":[{"mix-blend":[...v(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":v()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[D]}],"mask-image-linear-from-pos":[{"mask-linear-from":F()}],"mask-image-linear-to-pos":[{"mask-linear-to":F()}],"mask-image-linear-from-color":[{"mask-linear-from":A()}],"mask-image-linear-to-color":[{"mask-linear-to":A()}],"mask-image-t-from-pos":[{"mask-t-from":F()}],"mask-image-t-to-pos":[{"mask-t-to":F()}],"mask-image-t-from-color":[{"mask-t-from":A()}],"mask-image-t-to-color":[{"mask-t-to":A()}],"mask-image-r-from-pos":[{"mask-r-from":F()}],"mask-image-r-to-pos":[{"mask-r-to":F()}],"mask-image-r-from-color":[{"mask-r-from":A()}],"mask-image-r-to-color":[{"mask-r-to":A()}],"mask-image-b-from-pos":[{"mask-b-from":F()}],"mask-image-b-to-pos":[{"mask-b-to":F()}],"mask-image-b-from-color":[{"mask-b-from":A()}],"mask-image-b-to-color":[{"mask-b-to":A()}],"mask-image-l-from-pos":[{"mask-l-from":F()}],"mask-image-l-to-pos":[{"mask-l-to":F()}],"mask-image-l-from-color":[{"mask-l-from":A()}],"mask-image-l-to-color":[{"mask-l-to":A()}],"mask-image-x-from-pos":[{"mask-x-from":F()}],"mask-image-x-to-pos":[{"mask-x-to":F()}],"mask-image-x-from-color":[{"mask-x-from":A()}],"mask-image-x-to-color":[{"mask-x-to":A()}],"mask-image-y-from-pos":[{"mask-y-from":F()}],"mask-image-y-to-pos":[{"mask-y-to":F()}],"mask-image-y-from-color":[{"mask-y-from":A()}],"mask-image-y-to-color":[{"mask-y-to":A()}],"mask-image-radial":[{"mask-radial":[y,h]}],"mask-image-radial-from-pos":[{"mask-radial-from":F()}],"mask-image-radial-to-pos":[{"mask-radial-to":F()}],"mask-image-radial-from-color":[{"mask-radial-from":A()}],"mask-image-radial-to-color":[{"mask-radial-to":A()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":x()}],"mask-image-conic-pos":[{"mask-conic":[D]}],"mask-image-conic-from-pos":[{"mask-conic-from":F()}],"mask-image-conic-to-pos":[{"mask-conic-to":F()}],"mask-image-conic-from-color":[{"mask-conic-from":A()}],"mask-image-conic-to-color":[{"mask-conic-to":A()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Zt()}],"mask-repeat":[{mask:Ft()}],"mask-size":[{mask:lt()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",y,h]}],filter:[{filter:["","none",y,h]}],blur:[{blur:K()}],brightness:[{brightness:[D,y,h]}],contrast:[{contrast:[D,y,h]}],"drop-shadow":[{"drop-shadow":["","none",b,Gt,Kt]}],"drop-shadow-color":[{"drop-shadow":A()}],grayscale:[{grayscale:["",D,y,h]}],"hue-rotate":[{"hue-rotate":[D,y,h]}],invert:[{invert:["",D,y,h]}],saturate:[{saturate:[D,y,h]}],sepia:[{sepia:["",D,y,h]}],"backdrop-filter":[{"backdrop-filter":["","none",y,h]}],"backdrop-blur":[{"backdrop-blur":K()}],"backdrop-brightness":[{"backdrop-brightness":[D,y,h]}],"backdrop-contrast":[{"backdrop-contrast":[D,y,h]}],"backdrop-grayscale":[{"backdrop-grayscale":["",D,y,h]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[D,y,h]}],"backdrop-invert":[{"backdrop-invert":["",D,y,h]}],"backdrop-opacity":[{"backdrop-opacity":[D,y,h]}],"backdrop-saturate":[{"backdrop-saturate":[D,y,h]}],"backdrop-sepia":[{"backdrop-sepia":["",D,y,h]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":S()}],"border-spacing-x":[{"border-spacing-x":S()}],"border-spacing-y":[{"border-spacing-y":S()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",y,h]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[D,"initial",y,h]}],ease:[{ease:["linear","initial",$,y,h]}],delay:[{delay:[D,y,h]}],animate:[{animate:["none",R,y,h]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[H,y,h]}],"perspective-origin":[{"perspective-origin":W()}],rotate:[{rotate:Rt()}],"rotate-x":[{"rotate-x":Rt()}],"rotate-y":[{"rotate-y":Rt()}],"rotate-z":[{"rotate-z":Rt()}],scale:[{scale:qt()}],"scale-x":[{"scale-x":qt()}],"scale-y":[{"scale-y":qt()}],"scale-z":[{"scale-z":qt()}],"scale-3d":["scale-3d"],skew:[{skew:Mt()}],"skew-x":[{"skew-x":Mt()}],"skew-y":[{"skew-y":Mt()}],transform:[{transform:[y,h,"","none","gpu","cpu"]}],"transform-origin":[{origin:W()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Bt()}],"translate-x":[{"translate-x":Bt()}],"translate-y":[{"translate-y":Bt()}],"translate-z":[{"translate-z":Bt()}],"translate-none":["translate-none"],zoom:[{zoom:[M,y,h]}],accent:[{accent:A()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:A()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",y,h]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":A()}],"scrollbar-track-color":[{"scrollbar-track":A()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":S()}],"scroll-mx":[{"scroll-mx":S()}],"scroll-my":[{"scroll-my":S()}],"scroll-ms":[{"scroll-ms":S()}],"scroll-me":[{"scroll-me":S()}],"scroll-mbs":[{"scroll-mbs":S()}],"scroll-mbe":[{"scroll-mbe":S()}],"scroll-mt":[{"scroll-mt":S()}],"scroll-mr":[{"scroll-mr":S()}],"scroll-mb":[{"scroll-mb":S()}],"scroll-ml":[{"scroll-ml":S()}],"scroll-p":[{"scroll-p":S()}],"scroll-px":[{"scroll-px":S()}],"scroll-py":[{"scroll-py":S()}],"scroll-ps":[{"scroll-ps":S()}],"scroll-pe":[{"scroll-pe":S()}],"scroll-pbs":[{"scroll-pbs":S()}],"scroll-pbe":[{"scroll-pbe":S()}],"scroll-pt":[{"scroll-pt":S()}],"scroll-pr":[{"scroll-pr":S()}],"scroll-pb":[{"scroll-pb":S()}],"scroll-pl":[{"scroll-pl":S()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",y,h]}],fill:[{fill:["none",...A()]}],"stroke-w":[{stroke:[D,Ot,nt,Sr]}],stroke:[{stroke:["none",...A()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}};var qr=$d(ni);function Br(...t){return qr(vt(t))}var di=mr("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),Yt=Qr.forwardRef(({className:t,variant:e,size:r,asChild:n=!1,...i},T)=>{return l(n?Tr:"button",{className:Br(di({variant:e,size:r,className:t})),ref:T,...i})});Yt.displayName="Button";var G=N(L(),1);function Jr(t,e,r=!0){let[n,i]=G.useState([]),T=G.useRef([]);return G.useEffect(()=>{let u=!1,p=!1,m=null,k=[],f=(o)=>{let b=T.current;T.current=o,i(o),b.forEach(({bitmap:Z})=>Z.close())};async function E(){if(!r||!t||t.type!=="image/webp"||typeof ImageDecoder>"u"){if(!u)f([]);return}let o=await ImageDecoder.isTypeSupported(t.type);if(u)return;if(!o){f([]);return}let b=await t.arrayBuffer();if(u)return;m=new ImageDecoder({data:b,type:t.type,preferAnimation:!0}),await m.tracks.ready;let Z=m.tracks.selectedTrack?.frameCount??0;for(let H=0;H{if(!u)console.error("[SamplingPreviewWidget] failed to decode preview:",o)}),()=>{if(u=!0,m?.close(),!p)k.forEach(({bitmap:o})=>o.close())}},[t,r,e]),G.useEffect(()=>()=>{T.current.forEach(({bitmap:u})=>u.close()),T.current=[]},[]),n}function Xr(t,e,r,n){let[i,T]=G.useState(0),[u,p]=G.useState(0),m=G.useRef(0);return G.useEffect(()=>{m.current=0,T(0),p(0)},[t]),G.useEffect(()=>{let k=r&&e>1?e/r*1000:0;if(!t||k<=0){T(t?100:0),p(0);return}if(!n)return;let f=0,E=performance.now(),o=(b)=>{m.current=(m.current+b-E)%k,E=b;let Z=m.current/k*100;T(Z),p(Math.min(e-1,Math.floor(Z/100*e))),f=requestAnimationFrame(o)};return f=requestAnimationFrame(o),()=>cancelAnimationFrame(f)},[r,e,n,t]),{frameIndex:u,progress:i}}var gt=N(L(),1);var $r={common:{cancel:"Cancel",save:"Save",add:"Add",delete:"Delete",syncPlay:"Sync Play"},compareVideo:{empty:"Choose source and output videos to compare, or run the node with inputs.",source:"Source",output:"Output",selectSource:"Select source",selectOutput:"Select output",clearSource:"Clear source video",clearOutput:"Clear output video",sourceOnly:"Source",outputOnly:"Output",sideBySide:"A/B",compare:"Compare",play:"Play",pause:"Pause",seek:"Video time",mute:"Mute audio",unmute:"Unmute audio",volume:"Volume",saveOutput:"Save output video",watchOutputHistory:"Watch output history",filenamePrefix:"Save prefix",settings:"Output settings",downloadOutput:"Download output video"},promptEnhancerAccount:{balance:"Balance: {amount}",balanceEmpty:"Balance: --",viewBalance:"View balance",loadingBalance:"Loading balance...",balanceUnavailable:"Balance is temporarily unavailable",apiKeyRequired:"Enter an API key to load the balance",apiKey:"API Key",localModel:"Local model — no API account required"},projectVideoCombine:{selectProject:"Select project",deleteProject:"Delete project",deleteProjectTitle:"Delete project?",deleteProjectConfirm:"Delete the {project} project and its entire folder, including latent, JSON, and media files? This cannot be undone.",deleteDefaultProjectConfirm:"Clear all latent, JSON, and media files from the default project? The default folder will be kept. This cannot be undone.",deleteProjectSuccess:"Project deleted",deleteProjectSuccessDetail:"The {project} project was deleted.",deleteProjectFailed:"Project deletion failed",deleteClipFile:"Delete {file}",deleteClipFileTitle:"Delete generated clip?",deleteClipFileConfirm:"Permanently delete {file} and its associated generation artifacts? The latest project state will be saved. This cannot be undone.",deleteClipFileFailed:"Clip deletion failed",deleteClipFileUnavailable:"The clip deletion endpoint is unavailable (HTTP 404/405). Restart ComfyUI to load the updated backend, then refresh this page and try again.",deleteClipFileInvalidResponse:"The server returned an invalid project response (HTTP {status}). The preview was not changed. Refresh the project to check its saved state.",refresh:"Refresh project",mutePreview:"Mute preview audio",unmutePreview:"Unmute preview audio",combine:"Combine",autoCombine:"Auto combine",clipLabel:"Segment {number}",clipContinuity:"{mode}",selectClipFile:"Select a file for segment {number}",selectClipFiles:"Select up to two videos for segment {number}",selectClipFilesHint:"Select one video for the project, or two to compare.",selectClipFileFailed:"Video selection could not be saved",continuityShot:"Shot",continuityContext:"Context",continuityContextSwap:"Swap Context",emptyPreview:"Refresh the project to preview its generated clips.",refreshFailed:"Project refresh failed",combineFailed:"Project combine failed",projectListFailed:"Could not load projects",connectSaveNode:"Connect this node to a video save output before combining manually.",combineQueued:"Combine queued",combineQueuedDetail:"The {project} project and its downstream nodes were added to the queue.",queueBusy:"Wait until the current ComfyUI queue is empty before combining manually."},samplingPreview:{title:"Sampling preview",meta:"Segment {segment} · {pass} · {step}/{total}",playbackProgress:"Sampling preview playback progress",hidePreview:"Hide sampling preview",showPreview:"Show sampling preview",pausePreview:"Pause sampling preview",resumePreview:"Resume sampling preview",first:"First pass",second:"Second pass",selflift:"SelfLift"},toolbar:{frames:"Frames",seconds:"Seconds",fps:"fps",play:"Play",pause:"Pause",deleteSegment:"Delete selected segment",zoom:"Zoom"},timeline:{defaultTrackName:"Track {n}",defaultAudioTrackName:"Audio Track {n}"},multitrackTaskModes:{default:"TI2V",l2v:"L2V",t2v:"T2V",i2v:"I2V",fl2v:"FL2V",fmlf2v:"FMLF2V",v2v:"V2V",r2v:"R2V",rv2v:"RV2V",vi2v:"VI2V",ref:"R2V",edit:"Edit"},multitrackSegment:{taskLabel:"Segment {n} {mode}"},multitrack:{audio:"Audio",globalAudio:"MainAudio",audioSettings:"Audio settings",speed:"Speed",fpsSettings:"fps settings",mutePreviewAudio:"Mute preview audio",unmutePreviewAudio:"Unmute preview audio",mute:"Mute",unmute:"Unmute",volume:"Volume",frameRate:"FPS",currentResolution:"Current resolution",fps:"fps",duration:"Duration",editTaskDuration:"Edit task duration",prompt:"Prompt",promptPlaceholder:"Double-click to describe what you want to generate...",minimaxPromptPlaceholder:"Reference mode supports up to 9 images, 3 audio clips, and 3 videos. Enter text or use @ references to freely combine images, text, audio, and video. For example, @Picture 1 imitates the movement in @Video 1 with the voice from @Audio 1.",openReferenceResources:"Open reference resources",userPrompt:"User Prompt",userPromptVariantTooltip:"New: The user prompt output follows your A/B selection (select A to output A, select B to output B). Use A/B to compare prompts, or to preserve both the original and reverse-engineered prompts.",systemPrompt:"System Prompt",systemPromptPlaceholder:"System prompt",loadingSystemPrompt:"Loading default system prompt...",resetSystemPrompt:"Reset system prompt",referenceResources:"Reference resources",referenceResourcesEmpty:"Add task images or media clips to a track first.",referencePicture:"Picture {n}",referenceAudioItem:"Audio {n}",referenceVideoItem:"Video {n}",taskImageDropZone:"Task image drop zone",resizeTaskEditorPanels:"Resize image and prompt panels",selectImage:"Select image",addImage:"Add image",imageDropHint:"Click to choose, or drag files here.",previewImage:"Preview image",bypassImage:"Bypass image",includeImage:"Include image",bypassImageTooltip:"Bypass this image so it is not used as a reference or counted in image numbering.",includeImageTooltip:"Include this image as a generation reference again.",backToPreview:"Back to preview",deleteImage:"Delete image",previewLayoutBalanced:"Use balanced preview layout",previewLayoutImageLarge:"Enlarge task images",showTaskPrompt:"Show task prompt",hideTaskPrompt:"Hide task prompt",individualEdit:"Individual",combinedEdit:"Combined",applyPromptToAll:"Apply to all",applyPromptToAllTitle:"Apply this prompt to every segment?",applyPromptToAllDescription:"The selected user prompt from this segment will replace both prompt A and prompt B in every task segment, including prompts already set on other segments.",applyPromptToAllConfirm:"Replace all",taskNumber:"Segment {n}",taskMode:"Task mode",taskModeTooltip:"Choose how this segment generates video.",continuityMode:"Continuity mode",continuityModeTooltip:"Start a new shot, continue with a five-frame video anchor, or preserve motion while replacing the character appearance.",refImageSize:"Reference image size",refImageSizeTooltip:"Match scales reference images to the generation area; Max keeps a larger reference for stronger identity fidelity but can be much slower.",lockAudio:"Lock audio",unlockAudio:"Unlock audio",audioLockedMarker:"Audio track locked",audioLockTooltip:"(Only effective in MultiTrack Project) After locking audio, video generation will no longer regenerate the audio and will instead coordinate the video visuals with the original audio.",videoAudioLockTooltip:"(Only effective in MultiTrack Project) Locking makes video generation follow this video track's visual timeline. Video and audio track locks can be enabled together; when both are enabled, the audio track takes priority for audio locking and replacement.",enableSpeakerReference:"Reuse as speaker audio",disableSpeakerReference:"Stop reusing speaker audio",speakerReferenceTooltip:"(MiniMax only) Reuse this clip as this audio track's @Audio reference in every task. Audio longer than 15 seconds is truncated to its first 15 seconds.",enableSharedReference:"Use as shared reference",disableSharedReference:"Stop using as shared reference",sharedReferenceTooltip:"Use this media as this track's reference in every task. Shared audio uses up to its first 15 seconds.",sharedImageReferenceTooltip:"Set this image to public, and place before local images in every task. Shared and local images together are limited to 9 per task.",sharedImageLimitTooltip:"A task already has 9 different images. Remove one before sharing this image.",previewTaskLabel:"Task{n}",emptyPreviewTitle:"No segments yet",emptyPreviewDescription:"Add a task segment or video clip to the tracks below.",emptyTaskTrack:"Task track",emptyTaskTrackPurpose:"Without markers, track segments define task divisions; edit prompts, reference images, and more in each segment.",emptyVideoTrack:"Video track",emptyVideoTrackPurpose:"Drag or select videos to add them; right-click clips for smart split and subtitle recognition.",emptyAudioTrack:"Audio track",emptyAudioTrackPurpose:"Drag or select audio to add it; right-click clips for subtitle recognition.",emptySubtitleTrack:"Subtitle track",emptySubtitleTrackPurpose:"Add and edit subtitle styles and positioning, with text-to-speech support.",emptyTaskMarkers:"Task markers",emptyTaskMarkersPurpose:"Markers can group multiple segments into one loop task.",emptyTaskOverview:"Task track overview",emptyTaskOverviewPurpose:"Expand the task track to view each segment's prompt and reference images.",addVideo:"Add video",addAudioSegment:"Add audio",externalMediaUploading:"Uploading {name}...",addTrack:"Add track:",addVideoTrack:"Add video track",addAudioTrack:"Add audio track",addSubtitleTrack:"Add subtitle track",addSubtitleSegment:"Add subtitle",notSupportedYet:"Not supported yet",deleteTrack:"Delete {name}",reorderTrack:"Drag to reorder {name}",hideSubtitleTrack:"Hide {name}",showSubtitleTrack:"Show {name}",muteTrack:"Mute {name}",soloTrack:"Solo {name}",muteShort:"M",soloShort:"S",addTaskSegment:"Add task segment",deleteSelectedSegment:"Delete selected segment",addTaskMarker:"Add task marker",deleteTaskMarker:"Delete task marker",taskMarkerLabel:"Segment {n}",taskMarkerAtFrame:"Task marker at frame {frame}",taskOverview:"Tasktrack Overview",deleteSegment:"Delete segment",subtitle:"Subtitle",text:"Text",editSubtitle:"Edit subtitle",recognizeSubtitles:"Recognize subtitles",recognizeSubtitlesQwen3:"Qwen3-ASR",recognizeSubtitlesWhisper:"Whisper Large V3",recognizingSubtitles:"Recognizing subtitles...",subtitleRecognitionFailed:"Subtitle recognition failed",subtitleSpeechComplete:"Audio generation complete",subtitleSpeechSaved:"Audio generated and saved to {path}",subtitleSpeechFailed:"Audio generation failed",subtitleTextSettings:"Subtitle text settings",subtitleText:"Subtitle text",fontSize:"Font size",textColor:"Color",outlineColor:"Outline color",backgroundColor:"BG color",backgroundOpacity:"BG opacity",backgroundOpacityPercent:"Background opacity (%)",presetStyle:"Preset style",applyPresetStyle:"Apply {name} subtitle style",position:"Position",positionX:"X",positionY:"Y",subtitleWidth:"Width",subtitleWidthShort:"W",positionXPercent:"X (%)",positionYPercent:"Y (%)",subtitleWidthPercent:"Width (%)",speech:"Speech",speechModel:"Model",speechPrompt:"Control prompt",speechPromptPlaceholder:"Control prompt: Describe language, dialect, emotion, gender, etc. here.",speechCfg:"CFG",speechSteps:"Steps",referenceAudio:"Reference audio",addReferenceAudio:"Add reference audio",reselectReferenceAudio:"Reselect reference audio",playReferenceAudio:"Play reference audio",pauseReferenceAudio:"Pause reference audio",clearReferenceAudio:"Clear reference audio",distributeTaskSegments:"Distribute segments evenly",mergeTaskSegments:"Merge segments",cloneTaskSegment:"Clone segment",cloneVideoSegment:"Clone video",cloneAudioSegment:"Clone audio",splitTaskSegment:"Split segment",splitTaskSegmentDescription:"Current segment is {frames} frames ({seconds}s). Enter the seconds for each split.",splitTaskSegmentSeconds:"Split seconds",splitTaskSegmentSecondsUnit:"s",splitTaskSegmentPreview:"Will split into {count} segments.",splitTaskSegmentInvalid:"Enter at least 1 second and less than the current segment duration.",splitTaskSegmentConfirm:"Split",smartSplit:"Smart split",smartSplitTasksOnly:"Smart split (tasks only)",noMatchingTaskSegment:"No task segment has the same start and end frames.",smartSplitting:"Detecting shots...",smartSplitFailed:"Smart split failed",cutMode:"Trim segments",trimLeftAtPlayhead:"Trim left",trimRightAtPlayhead:"Trim right",undo:"Undo",redo:"Redo",play:"Play",pause:"Pause",timelineSnap:"Timeline snap",hideTimeline:"Hide timeline",showTimeline:"Show timeline",timelineZoom:"Timeline zoom"},multitrackContinuityModes:{shot:"Shot",context:"Context",context_swap:"Swap Context"},multitrackRefImageSizes:{match:"Match",max:"Max"},modelDownload:{title:"{name} is missing",description:"{name} must be installed under {directory}. Download it automatically or open the source link and place the file there manually.",auto:"Auto download",manual:"Manual download",exit:"Exit",close:"Close",downloading:"Downloading...",downloadComplete:"Model installed",downloadCompleteDetail:"{name} was downloaded. Run the action again."},trackRow:{trackColor:"Track color"},segmentBlock:{resizeStart:"Resize segment start",resizeEnd:"Resize segment end"},promptTrack:{distributeEvenly:"Distribute evenly",addSegment:"Add segment",deleteSegment:"Delete selected segment",addSegmentTitle:"Add segment",promptPlaceholder:"Prompt text...",segmentLabel:"Segment {n}",empty:"empty",editSegmentTitle:"Edit segment {n}",contextEdit:"Edit segment",contextAdd:"Add segment",contextDistribute:"Distribute evenly",editDialogTitle:"Edit Prompts",tabCombined:"Combined",tabIndividual:"Individual",combinedHint:"Use | to separate segments. Changes apply in real-time.",segmentCount:"{n} segment(s)"},audioTrack:{addMarker:"Add marker",importFile:"Import audio file…",importUrl:"Import from URL…",enterUrl:"Enter audio URL:",frameLabel:"Frame {n}",markerAriaLabel:"Marker: {label}",markerAtFrame:"Marker at frame {frame}",editMarker:"Edit marker",markerLabelInput:"Marker label",placeholder:"Audio Track",placeholderHint:"Double-click to add content",dropZone:"Audio track drop zone",selectMedia:"Select audio",contextEdit:"Edit segment",contextAdd:"Add segment",contextDelete:"Delete segment"},imageTrack:{dropZone:"Image track drop zone",addSegment:"Add image",deleteSegment:"Delete selected segment",importFile:"Import image file…",importUrl:"Import from URL…",enterUrl:"Enter image URL:",placeholder:"Image Track",placeholderHint:"Double-click to add content",contextReselect:"Change Segment",contextAdd:"Add segment",contextDistribute:"Distribute evenly",contextDelete:"Delete segment"},maintainTrack:{dropZone:"Maintain track drop zone",segmentLabel:"Segment {n}",segmentPlaceholder:"Click segment to write the prompt...",placeholder:"Add segment",placeholderHint:"Double-click to add segment",promptPlaceholder:"Prompt text...",addImage:"Add image",tabCombined:"Combined",tabIndividual:"Individual",combinedHint:"Use | to separate segments. Changes apply in real-time.",contextEdit:"Edit segment",contextAdd:"Add segment",contextClone:"Clone segment",contextDelete:"Delete segment",contextDistribute:"Distribute evenly",addMedia:"Add media",flf:"First Last frames",fmlf:"Multiple frames",ref:"Reference frames"},insertButton:{insertBefore:"Insert segment before",insertAfter:"Insert segment after"},panorama:{applyView:"Apply view",cancel:"Cancel panorama",cancelHint:"Remove the saved panorama view and exit",orientation:"Yaw {yaw}° · Pitch {pitch}°",zoom:"FOV {fov}° ×{ratio}",exit:"Exit panorama view",loading:"Loading panorama...",invalidView:"Saved panorama view is invalid.",webglUnavailable:"WebGL panorama rendering is unavailable.",textureLoadFailed:"Failed to load this image as a panorama texture."},multiImagesLoader:{add:"Add images",replace:"Replace image {n}",preview:"Preview image",delete:"Delete image",imageCount:"Images: {n}",clearAll:"Clear all"},mediaSelector:{tabInputs:"Inputs",tabOutputs:"Outputs",tabHistory:"History",filter:"Multi",selectAll:"SelectAll",confirm:"Confirm",tabLocal:"Local",tabUrl:"URL",searchPlaceholder:"Search...",sort:"Sort by {by}",sortName:"name",sortDate:"date",sortFolders:"folders first",viewList:"List view",viewGrid:"Grid view",refresh:"Refresh",localPathPlaceholder:"Absolute folder path...",urlHint:"Paste an http(s) URL to a media file.",urlConfirm:"Confirm URL",urlChecking:"Checking...",urlErrorTitle:"URL Error",urlErrorNotFound:"File not found or access denied.",empty:"No files found",error:"Failed to load: {msg}",tabSlot:"Slot",slotNotConnected:"No connected input",slotEmpty:"No content available",slotList:"list",slotImage:"Image {n}",slotAudio:"Audio {n}",slotVideo:"Video {n}",addLocal:"Add local file"}};var zr={common:{cancel:"取消",save:"保存",add:"添加",delete:"删除",syncPlay:"同步播放"},compareVideo:{empty:"请选择视频进行对比,或在接入输入后执行节点。",source:"Source",output:"Output",selectSource:"选择源",selectOutput:"选择目标",clearSource:"清除源视频",clearOutput:"清除目标视频",sourceOnly:"Source",outputOnly:"Output",sideBySide:"A/B",compare:"Compare",play:"播放",pause:"暂停",seek:"视频时间",mute:"静音",unmute:"取消静音",volume:"音量",saveOutput:"保存输出视频",watchOutputHistory:"监听输出历史",filenamePrefix:"保存前缀",settings:"输出设置",downloadOutput:"下载输出视频"},promptEnhancerAccount:{balance:"余额:{amount}",balanceEmpty:"余额:--",viewBalance:"去查看余额",loadingBalance:"正在获取余额...",balanceUnavailable:"暂时无法获取余额",apiKeyRequired:"填写 API Key 后可获取余额",apiKey:"API Key",localModel:"本地模型,无需 API 账户"},projectVideoCombine:{selectProject:"选择项目",deleteProject:"删除项目",deleteProjectTitle:"删除项目?",deleteProjectConfirm:"确定删除项目 {project} 及其整个文件夹吗?其中的 latent、JSON 和媒体文件也会一并删除,且无法恢复。",deleteDefaultProjectConfirm:"确定清空 default 项目的所有 latent、JSON 和媒体文件吗?default 文件夹会保留,删除后无法恢复。",deleteProjectSuccess:"项目已删除",deleteProjectSuccessDetail:"项目 {project} 已删除。",deleteProjectFailed:"项目删除失败",deleteClipFile:"删除 {file}",deleteClipFileTitle:"删除生成片段?",deleteClipFileConfirm:"确定永久删除 {file} 及其关联的生成文件吗?删除后将保存项目最新状态,此操作无法恢复。",deleteClipFileFailed:"片段删除失败",deleteClipFileUnavailable:"片段删除接口不可用(HTTP 404/405)。请重启 ComfyUI 以加载更新后的后端,再刷新页面重试。",deleteClipFileInvalidResponse:"服务器返回的项目数据无效(HTTP {status}),预览未修改。请刷新项目以核实已保存的状态。",refresh:"刷新项目",mutePreview:"关闭预览声音",unmutePreview:"开启预览声音",combine:"合并",autoCombine:"自动合并",clipLabel:"片段{number}",clipContinuity:"{mode}",selectClipFile:"选择片段{number}的视频文件",selectClipFiles:"为片段{number}选择最多两个视频",selectClipFilesHint:"选择一个视频用于项目,选择两个视频进行对比。",selectClipFileFailed:"视频版本选择保存失败",continuityShot:"分镜",continuityContext:"上下文",continuityContextSwap:"上下文(替换)",emptyPreview:"请刷新项目以预览已生成的视频片段。",refreshFailed:"项目刷新失败",combineFailed:"项目合并失败",projectListFailed:"无法获取项目列表",connectSaveNode:"请先将此节点连接到视频保存输出节点,再执行手动合并。",combineQueued:"合并任务已提交",combineQueuedDetail:"项目 {project} 及其下游节点已加入队列。",queueBusy:"当前 ComfyUI 队列仍有任务,请等待队列清空后再手动合并。"},samplingPreview:{title:"采样预览",meta:"片段 {segment} · {pass} · {step}/{total}",playbackProgress:"采样预览播放进度",hidePreview:"隐藏采样预览",showPreview:"显示采样预览",pausePreview:"暂停采样预览",resumePreview:"继续采样预览",first:"一采",second:"二采",selflift:"SelfLift"},toolbar:{frames:"帧",seconds:"秒",fps:"帧/秒",play:"播放",pause:"暂停",deleteSegment:"删除选中片段",zoom:"缩放"},timeline:{defaultTrackName:"主轨 {n}",defaultAudioTrackName:"音频轨 {n}"},multitrackTaskModes:{default:"文图",t2v:"文生视频",i2v:"图生视频",fl2v:"首尾生视频",fmlf2v:"多帧生视频",l2v:"尾帧",r2v:"参考生视频",rv2v:"参考视频生视频",vi2v:"图像视频编辑",v2v:"视频生视频",ref:"参考",edit:"编辑"},multitrackSegment:{taskLabel:"片段 {n} {mode}"},multitrack:{audio:"音频",globalAudio:"总音频",audioSettings:"音频设置",speed:"速度",fpsSettings:"速度设置",mutePreviewAudio:"静音预览音频",unmutePreviewAudio:"取消静音预览音频",mute:"静音",unmute:"取消静音",volume:"音量",frameRate:"帧率",currentResolution:"当前分辨率",fps:"帧/秒",duration:"时长",editTaskDuration:"编辑任务时长",prompt:"提示词",promptPlaceholder:"双击描述您想要生成的内容...",minimaxPromptPlaceholder:"参考模式下最多支持9张图片,3个音频,3个视频, 输入文字或 @ 参考内容, 自由组合图、文、音,视频多元素,定义精彩互动。例如 @图片1 模仿 @视频1 的动作,音色参考 @音频1。",openReferenceResources:"打开引用资源",userPrompt:"用户提示词",userPromptVariantTooltip:"✨新功能:用户提示词将根据您的选择输出(即选择 A 时输出 A,选择 B 时 输出 B)。A/B 可用于提示词对比,也可用于分别保存原提示词与反推后的提示词。",systemPrompt:"系统提示词",systemPromptPlaceholder:"系统提示词",loadingSystemPrompt:"正在加载默认系统提示词...",resetSystemPrompt:"重置系统提示词",referenceResources:"可能@的内容",referenceResourcesEmpty:"请先在左侧添加图片或在媒体轨道中添加片段。",referencePicture:"图片{n}",referenceAudioItem:"音频{n}",referenceVideoItem:"视频{n}",taskImageDropZone:"任务图片拖放区域",resizeTaskEditorPanels:"调整图片与提示词区域宽度",selectImage:"选择图片",addImage:"添加图片",imageDropHint:"点击从文件选择,或将文件拖到这里。",previewImage:"预览图片",bypassImage:"禁用图片",includeImage:"启用图片",bypassImageTooltip:"禁用该图片;生成时不会作为参考图,且不占图片序号。",includeImageTooltip:"重新启用该图片作为生成参考图。",backToPreview:"返回预览",deleteImage:"删除图片",previewLayoutBalanced:"使用均衡预览布局",previewLayoutImageLarge:"放大任务图片区",showTaskPrompt:"显示任务提示词",hideTaskPrompt:"隐藏任务提示词",individualEdit:"逐段编辑",combinedEdit:"整体编辑",applyPromptToAll:"应用到所有",applyPromptToAllTitle:"将提示词应用到所有片段?",applyPromptToAllDescription:"当前片段选中的用户提示词将覆盖所有任务片段的 A、B 提示词;其他片段已设置的提示词也会被替换。",applyPromptToAllConfirm:"确认覆盖",taskNumber:"片段 {n}",taskMode:"任务模式",taskModeTooltip:"选择当前片段的视频生成方式。",continuityMode:"衔接模式",continuityModeTooltip:"选择开启新分镜、使用五帧视频锚点承接上下文,或在保留动作连续性的同时替换角色外观。",refImageSize:"参考图像尺寸",refImageSizeTooltip:"匹配尺寸会按生成画面面积缩放参考图;最大尺寸会保留更大的参考图以提升主体一致性,但生成速度可能慢数倍。",lockAudio:"锁定音频",unlockAudio:"解除音频锁定",audioLockedMarker:"音频轨道已锁定",audioLockTooltip:"(仅多轨项目有效) 锁定音频后,视频生成将不再重新生成音频,而改用原音频协调视频画面生成。",videoAudioLockTooltip:"(仅多轨项目有效)锁定后,视频生成会遵循该视频轨道画面的时间线。视频轨道音频锁可与音频轨道锁同时启用;同时启用时,音频轨道将优先用于音频锁定和替换。",enableSpeakerReference:"复用为说话人音频",disableSpeakerReference:"停止复用说话人音频",speakerReferenceTooltip:"(仅 MiniMax)在每个任务中将此片段复用为该音轨对应的 @音频 引用;超过 15 秒时只取开头 15 秒。",enableSharedReference:"设为公共参考",disableSharedReference:"取消公共参考",sharedReferenceTooltip:"将此媒体作为该轨道在所有任务片段中的公共参考;公共音频最多使用开头 15 秒。",sharedImageReferenceTooltip:"将此图片设为公用图片,它将排在每个任务片段的私有图片之前;公共图片与私有图片每段合计最多 9 张。",sharedImageLimitTooltip:"已有任务片段包含 9 张不同图片,请先移除一张再设为公共图片。",previewTaskLabel:"任务{n}",emptyPreviewTitle:"还没有可预览的片段",emptyPreviewDescription:"请在下方轨道添加任务片段或视频片段。",emptyTaskTrack:"任务轨道",emptyTaskTrackPurpose:"未打标时,轨道中片段代表任务分割数量、片段中可编辑提示词、参考图片等。",emptyVideoTrack:"视频轨道",emptyVideoTrackPurpose:"拖拽或选择视频以添加,片段上右键支持智能分割、识别字幕。",emptyAudioTrack:"音频轨道",emptyAudioTrackPurpose:"拖拽或选择音频以添加,片段上右键支持识别字幕。",emptySubtitleTrack:"字幕轨道",emptySubtitleTrackPurpose:"添加、编辑字幕样式与定位,支持字幕朗读。",emptyTaskMarkers:"任务标签",emptyTaskMarkersPurpose:"打标后可以将多片段作为一轮循环任务。",emptyTaskOverview:"任务轨概览",emptyTaskOverviewPurpose:"展开任务轨,查看各片段的提示词和参考图片。",addVideo:"添加视频",addAudioSegment:"添加音频",externalMediaUploading:"正在上传 {name}...",addTrack:"添加轨道:",addVideoTrack:"添加视频轨",addAudioTrack:"添加音频轨",addSubtitleTrack:"添加字幕轨",addSubtitleSegment:"添加字幕",notSupportedYet:"暂不支持",deleteTrack:"删除{name}",reorderTrack:"拖动以调整{name}顺序",hideSubtitleTrack:"隐藏{name}",showSubtitleTrack:"显示{name}",muteTrack:"静音{name}",soloTrack:"独奏{name}",muteShort:"M",soloShort:"S",addTaskSegment:"添加任务片段",deleteSelectedSegment:"删除选中片段",addTaskMarker:"添加任务标记",deleteTaskMarker:"删除任务标记",taskMarkerLabel:"片段 {n}",taskMarkerAtFrame:"第 {frame} 帧任务标记",taskOverview:"任务轨概览",deleteSegment:"删除片段",subtitle:"字幕",text:"文字",editSubtitle:"编辑字幕",recognizeSubtitles:"识别字幕",recognizeSubtitlesQwen3:"Qwen3-ASR",recognizeSubtitlesWhisper:"Whisper Large V3",recognizingSubtitles:"正在识别字幕...",subtitleRecognitionFailed:"识别字幕失败",subtitleSpeechComplete:"音频生成完成",subtitleSpeechSaved:"音频生成完成保存到 {path}",subtitleSpeechFailed:"音频生成失败",subtitleTextSettings:"字幕文字设置",subtitleText:"字幕文字",fontSize:"字号",textColor:"文字颜色",outlineColor:"描边颜色",backgroundColor:"背景颜色",backgroundOpacity:"背景透明",backgroundOpacityPercent:"背景透明度(%)",presetStyle:"预设样式",applyPresetStyle:"应用{name}字幕样式",position:"位置",positionX:"X",positionY:"Y",subtitleWidth:"宽度",subtitleWidthShort:"宽",positionXPercent:"X(%)",positionYPercent:"Y(%)",subtitleWidthPercent:"宽度(%)",speech:"朗读",speechModel:"模型",speechPrompt:"控制指令",speechPromptPlaceholder:"控制指令:可以在此处描述语言、方言、情感、性别等。",speechCfg:"CFG",speechSteps:"推理步数",referenceAudio:"参考音频",addReferenceAudio:"添加参考音频",reselectReferenceAudio:"重选参考音频",playReferenceAudio:"播放参考音频",pauseReferenceAudio:"暂停参考音频",clearReferenceAudio:"清除参考音频",distributeTaskSegments:"均分片段",mergeTaskSegments:"合并片段",cloneTaskSegment:"复制片段",cloneVideoSegment:"复制视频",cloneAudioSegment:"复制音频",splitTaskSegment:"拆分片段",splitTaskSegmentDescription:"当前片段为 {frames} 帧({seconds} 秒),请输入每段拆分秒数。",splitTaskSegmentSeconds:"拆分秒数",splitTaskSegmentSecondsUnit:"秒",splitTaskSegmentPreview:"将拆分为 {count} 个片段。",splitTaskSegmentInvalid:"请输入至少 1 秒且小于当前片段时长的数值。",splitTaskSegmentConfirm:"拆分",smartSplit:"智能分割",smartSplitTasksOnly:"智能分割(仅任务)",noMatchingTaskSegment:"没有起止帧相同的任务片段。",smartSplitting:"正在智能分割...",smartSplitFailed:"智能分割失败",cutMode:"分割片段",trimLeftAtPlayhead:"向左裁剪",trimRightAtPlayhead:"向右裁剪",undo:"撤销",redo:"重做",play:"播放",pause:"暂停",timelineSnap:"时间线磁吸",hideTimeline:"隐藏轨道区域",showTimeline:"显示轨道区域",timelineZoom:"时间线缩放"},multitrackContinuityModes:{shot:"分镜",context:"上下文",context_swap:"上下文(主体替换)"},multitrackRefImageSizes:{match:"匹配尺寸",max:"最大尺寸"},modelDownload:{title:"缺少 {name} 模型",description:"需要将 {name} 安装到 {directory}。可以自动下载,或打开下载链接后手动放入该目录。自动下载将从 Hugging Face 中进行下载,如果您的网络不太稳定或长时间没有下载成功,请重启 ComfyUI,重新使用手动进行下载。",auto:"自动下载",manual:"手动下载",exit:"退出",close:"关闭",downloading:"下载中...",downloadComplete:"模型已安装",downloadCompleteDetail:"{name} 已下载,请重新执行操作。"},trackRow:{trackColor:"轨道颜色"},segmentBlock:{resizeStart:"调整片段开始",resizeEnd:"调整片段结束"},promptTrack:{distributeEvenly:"均匀分布",addSegment:"添加分段",deleteSegment:"删除选中片段",addSegmentTitle:"添加分段",promptPlaceholder:"提示词...",segmentLabel:"片段 {n}",empty:"空",editSegmentTitle:"编辑分段 {n}",contextEdit:"编辑片段",contextAdd:"添加分段",contextDistribute:"均匀分布",editDialogTitle:"编辑提示词",tabCombined:"整体编辑",tabIndividual:"逐段编辑",combinedHint:"用 | 分隔各分段,修改实时生效。",segmentCount:"共 {n} 个分段"},audioTrack:{addMarker:"添加标记",importFile:"导入音频文件…",importUrl:"从 URL 导入…",enterUrl:"请输入音频 URL:",frameLabel:"第 {n} 帧",markerAriaLabel:"标记:{label}",markerAtFrame:"第 {frame} 帧标记",editMarker:"编辑标记",markerLabelInput:"标记名称",placeholder:"音频轨道",placeholderHint:"双击可添加内容",dropZone:"音频轨道拖放区域",selectMedia:"选择音频",contextEdit:"编辑片段",contextAdd:"添加片段",contextDelete:"删除片段"},imageTrack:{dropZone:"图片轨道拖放区域",addSegment:"添加图片",deleteSegment:"删除选中片段",importFile:"导入图片文件…",importUrl:"从 URL 导入…",enterUrl:"请输入图片 URL:",placeholder:"图片轨道",placeholderHint:"双击可添加内容",contextReselect:"重选分片段",contextAdd:"添加分片段",contextDistribute:"均分分片段",contextDelete:"删除片段"},maintainTrack:{dropZone:"主轨拖放区域",segmentLabel:"片段 {n}",segmentPlaceholder:"点击片段修改提示...",placeholder:"添加片段",placeholderHint:"双击添加片段",promptPlaceholder:"提示词...",addImage:"添加图片",tabCombined:"整体编辑",tabIndividual:"逐段编辑",combinedHint:"用 | 分隔各分段,修改实时生效。",contextEdit:"编辑片段",contextAdd:"添加片段",contextClone:"克隆片段",contextDelete:"删除片段",contextDistribute:"均匀分布",addMedia:"添加媒体",flf:"首尾帧",fmlf:"多帧",ref:"参考帧"},insertButton:{insertBefore:"在此之前插入片段",insertAfter:"在此之后插入片段"},panorama:{applyView:"应用视角",cancel:"取消全景",cancelHint:"删除已保存的全景视角并退出",orientation:"横 {yaw}° · 纵 {pitch}°",zoom:"视场 {fov}° ×{ratio}",exit:"退出全景查看",loading:"正在加载全景图...",invalidView:"已保存的全景视角无效。",webglUnavailable:"当前环境无法使用 WebGL 全景渲染。",textureLoadFailed:"无法将此图片加载为全景纹理。"},multiImagesLoader:{add:"添加图像",replace:"替换图像 {n}",preview:"预览图像",delete:"删除图像",imageCount:"图片数量:{n}",clearAll:"清空所有"},mediaSelector:{tabInputs:"输入",tabOutputs:"输出",tabHistory:"历史",tabLocal:"本地",tabUrl:"URL",searchPlaceholder:"搜索...",sort:"排序:{by}",filter:"多选",selectAll:"全选",confirm:"确定",sortName:"名称",sortDate:"日期",sortFolders:"文件夹优先",viewList:"列表视图",viewGrid:"网格视图",refresh:"刷新",localPathPlaceholder:"本地文件夹绝对路径...",urlHint:"粘贴媒体文件的 http(s) URL。",urlConfirm:"确认 URL",urlChecking:"检测中...",urlErrorTitle:"URL 错误",urlErrorNotFound:"未找到文件,或服务器拒绝访问。",empty:"未找到文件",error:"加载失败:{msg}",tabSlot:"插槽",slotNotConnected:"未连接输入",slotEmpty:"暂无内容",slotList:"列表",slotImage:"图像 {n}",slotAudio:"音频 {n}",slotVideo:"视频 {n}",addLocal:"添加本地文件"}};var vr={en:$r,zh:zr},Ue=gt.createContext(void 0);function ui(t){if(!t)return"en";let e=t.split("-")[0].toLowerCase();return e in vr?e:"en"}function ki(t,e,r){let n=ui(t),i=vr[n],T=e.indexOf("."),u=T===-1?e:e.slice(0,T),p=T===-1?"":e.slice(T+1),m=i[u]?.[p]??e;if(r)for(let[k,f]of Object.entries(r))m=m.replaceAll(`{${k}}`,String(f));return m}function Kr(){let t=gt.useContext(Ue);return(e,r)=>ki(t,e,r)}var Gr="easy_media.sampling_preview",gr="execution_start";function pi(t){return t===void 0?"":String(t).split(":").at(-1)?.split(".").at(-1)}function mi(t,e){let r=typeof e==="function"?e():e;return[t.display_node_id,t.node_id].some((n)=>pi(n)===String(r))}function Mr(t,e){let r=atob(t),n=new Uint8Array(r.length);for(let i=0;i{let n=r.current;if(!n)return;n.width=t.bitmap.width,n.height=t.bitmap.height;let i=n.getContext("2d");if(!i){console.error("[SamplingPreviewWidget] 2D canvas context is unavailable");return}i.drawImage(t.bitmap,0,0)},[t]),l("canvas",{ref:r,role:"img","aria-label":e,className:"absolute inset-0 h-full w-full object-contain"})}function yi({app:t,nodeId:e,executionRevision:r=0,onVisibilityChange:n,interactive:i=!0,visibilityControlOnly:T=!1}){let u=Kr(),[p,m]=O.useState(null),[k,f]=O.useState(null),[E,o]=O.useState(""),[b,Z]=O.useState([]),[H,P]=O.useState(!0),[$,R]=O.useState(!0),[j,x]=O.useState(""),W=O.useRef(null),I=O.useRef(null),z=O.useRef(null),S=i&&!T,J=i||T,V=H?p:k??p;O.useEffect(()=>{let w=(F)=>{let K=F.detail;z.current=K&&typeof K==="object"&&"prompt_id"in K&&typeof K.prompt_id==="string"?K.prompt_id:null},v=(F)=>{let K=F.detail;if(!K?.image||!mi(K,e))return;if(z.current!==null&&K.prompt_id!==z.current)return;m(K)};return t.api.addCustomEventListener(gr,w),t.api.addCustomEventListener(Gr,v),()=>{t.api.removeCustomEventListener(gr,w),t.api.removeCustomEventListener(Gr,v)}},[t.api,e]),O.useEffect(()=>{m(null),f(null),P(!0),x("")},[r]),O.useEffect(()=>{n?.(p!==null)},[n,p]);let tt=O.useMemo(()=>V?Mr(V.image,V.mime):null,[V]);O.useEffect(()=>{if(!tt){o("");return}let w=URL.createObjectURL(tt);return o(w),()=>URL.revokeObjectURL(w)},[tt]),O.useEffect(()=>{let w=V?.images??[];if(w.length===0){Z([]);return}let v=w.map((F)=>URL.createObjectURL(Mr(F,"image/jpeg")));return Z(v),()=>v.forEach((F)=>URL.revokeObjectURL(F))},[V]);let g=Jr(tt,V?.image,S),it=b.length||V?.frame_count||g.length,ot=V?`${V.segment_index}:${V.sampling_pass}:${V.frame_count}:${V.fps}`:void 0,{frameIndex:C,progress:X}=Xr(ot,it,V?.fps??null,H);if(!V)return null;let U=u(`samplingPreview.${V.sampling_pass}`),Ht=g.length<=1||it<=1?0:Math.min(g.length-1,Math.floor(C/it*g.length)),et=g[Ht],A=b[Math.min(C,b.length-1)],Zt=V.mime==="image/webp"&&b.length===0&&et===void 0,Ft=()=>{if(!Zt)return;let w=W.current,v=I.current;if(!w?.complete||w.naturalWidth<=0||w.naturalHeight<=0||!v)return;v.width=w.naturalWidth,v.height=w.naturalHeight;let F=v.getContext("2d");if(!F){console.error("[SamplingPreviewWidget] 2D canvas context is unavailable");return}F.drawImage(w,0,0),x(E)},lt=()=>{if(H)Ft(),f(p),P(!1);else f(null),P(!0)},Tt=u(H?"samplingPreview.pausePreview":"samplingPreview.resumePreview"),Q=u("samplingPreview.meta",{segment:V.segment_index+1,pass:U,step:V.step,total:V.total}),B=l("div",{role:"progressbar","aria-label":u("samplingPreview.playbackProgress"),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(X),className:"h-1.5 w-full overflow-hidden rounded-full bg-muted",children:l("div",{className:"h-full rounded-full bg-primary",style:{width:`${X}%`}})});return Dt("div",{className:"relative flex h-full w-full flex-col overflow-hidden rounded-lg border border-border bg-black",children:[$?S?l(Yt,{type:"button",variant:"ghost","aria-label":Tt,onClick:lt,className:"relative min-h-0 flex-1 rounded-none p-0 hover:bg-black",children:A?l("img",{src:A,alt:u("samplingPreview.title"),draggable:!1,className:"absolute inset-0 h-full w-full object-contain"}):et?l(hi,{frame:et,label:u("samplingPreview.title")}):E?Dt($t,{children:[l("img",{ref:W,src:E,alt:u("samplingPreview.title"),draggable:!1,onLoad:()=>{if(!H&&!j)Ft()},className:"absolute inset-0 h-full w-full object-contain"}),l("canvas",{ref:I,"data-testid":"sampling-preview-frozen-frame","aria-hidden":"true",hidden:H||!j,className:"absolute inset-0 h-full w-full object-contain"})]}):null}):l("div",{className:"relative min-h-0 flex-1",children:A?l("img",{src:A,alt:u("samplingPreview.title"),draggable:!1,className:"absolute inset-0 h-full w-full object-contain"}):E?l("img",{src:E,alt:u("samplingPreview.title"),draggable:!1,className:"absolute inset-0 h-full w-full object-contain"}):null}):l("div",{"data-testid":"sampling-preview-placeholder","aria-hidden":"true",className:"min-h-0 flex-1 bg-black"}),Dt("div",{className:"shrink-0 border-t border-border bg-background px-2 py-1 gap-0",children:[Dt("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[l("span",{children:Q}),J?l(Yt,{type:"button",variant:"ghost",size:"icon","aria-label":u($?"samplingPreview.hidePreview":"samplingPreview.showPreview"),onClick:()=>R((w)=>!w),className:"pointer-events-auto h-6 w-6",children:$?l(Vt,{}):l(wt,{})}):null]}),S?l(Yt,{type:"button",variant:"ghost","aria-label":Tt,onClick:lt,className:"h-3 w-full rounded-full p-0 hover:bg-muted",children:B}):l("div",{className:"h-3 w-full rounded-full p-0",children:B})]})]})}function UDe(t){let e=t.app?.ui?.settings?.settingsValues?.["Comfy.Locale"];return l(Ue.Provider,{value:e,children:l(yi,{...t})})} export{Ue as b,ki as c,Kr as d,Si as e,Ai as f,Ei as g,d as h,kt as i,pt as j,mt as k,ht as l,_ as m,yt as n,St as o,At as p,ft as q,Et as r,It as s,Ct as t,Ut as u,Nt as v,Lt as w,_t as x,at as y,jt as z,st as A,ct as B,te as C,ee as D,Vt as E,wt as F,re as G,ne as H,de as I,ie as J,Te as K,ue as L,ke as M,pe as N,me as O,he as P,ye as Q,Se as R,Ae as S,fe as T,Ee as U,De as V,oe as W,He as X,Fe as Y,le as Z,be as _,Pe as $,Ve as aa,we as ba,Oe as ca,Ye as da,Ze as ea,Re as fa,qe as ga,Be as ha,Qe as ia,Je as ja,Xe as ka,$e as la,ze as ma,ve as na,Ke as oa,Ge as pa,ge as qa,Me as ra,xe as sa,$t as ta,l as ua,Dt as va,mr as wa,Br as xa,Yt as ya,UDe as za}; diff --git a/dist/release/chunks/index-w8y4mejn.js b/dist/release/chunks/index-xcg45zk8.js similarity index 95% rename from dist/release/chunks/index-w8y4mejn.js rename to dist/release/chunks/index-xcg45zk8.js index 497f959..d0d19a9 100644 --- a/dist/release/chunks/index-w8y4mejn.js +++ b/dist/release/chunks/index-xcg45zk8.js @@ -1,2 +1,2 @@ var j=Object.create;var{getPrototypeOf:k,defineProperty:f,getOwnPropertyNames:l}=Object;var m=Object.prototype.hasOwnProperty;function n(a){return this[a]}var o,p,s=(a,b,c)=>{var g=a!=null&&typeof a==="object";if(g){var h=b?o??=new WeakMap:p??=new WeakMap,i=h.get(a);if(i)return i}c=a!=null?j(k(a)):{};let d=b||!a||!a.__esModule?f(c,"default",{value:a,enumerable:!0}):c;for(let e of l(a))if(!m.call(d,e))f(d,e,{get:n.bind(a,e),enumerable:!0});if(g)h.set(a,d);return d};var t=(a,b)=>()=>(b||a((b={exports:{}}).exports,b),b.exports);var q=(a)=>a;function r(a,b){this[a]=q.bind(null,b)}var u=(a,b)=>{for(var c in b)f(a,c,{get:b[c],enumerable:!0,configurable:!0,set:r.bind(b,c)})};var v=(a,b)=>()=>(a&&(b=a(a=0)),b);var w=((a)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(a,{get:(b,c)=>(typeof require<"u"?require:b)[c]}):a)(function(a){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')}); -export{s as rc,t as sc,u as tc,v as uc,w as vc}; +export{s as sc,t as tc,u as uc,v as vc,w as wc}; diff --git a/dist/release/chunks/index-3wva2e3j.js b/dist/release/chunks/index-xk3sxqv7.js similarity index 99% rename from dist/release/chunks/index-3wva2e3j.js rename to dist/release/chunks/index-xk3sxqv7.js index 12c6743..2d98dc7 100644 --- a/dist/release/chunks/index-3wva2e3j.js +++ b/dist/release/chunks/index-xk3sxqv7.js @@ -1,4 +1,4 @@ -import{Aa as r8,Ba as n8}from"./index-2femq7pq.js";import{rc as tU,sc as I4,tc as a8,uc as xJ}from"./index-w8y4mejn.js";function P0(G,X){var Z=G.length;G.push(X);G:for(;0>>1,z=G[Y];if(0>>1;YJY(A,Z))BJY(q,A)?(G[Y]=q,G[B]=Z,Y=B):(G[Y]=A,G[U]=Z,Y=U);else if(BJY(q,Z))G[Y]=q,G[B]=Z,Y=B;else break G}}return X}function JY(G,X){var Z=G.sortIndex-X.sortIndex;return Z!==0?Z:G.id-X.id}function BY(G){for(var X=uG(LX);X!==null;){if(X.callback===null)HY(LX);else if(X.startTime<=G)HY(LX),X.sortIndex=X.expirationTime,P0(aG,X);else break;X=uG(LX)}}function m0(G){if(Y7=!1,BY(G),!Z7)if(uG(aG)!==null)Z7=!0,qZ||(qZ=!0,HZ());else{var X=uG(LX);X!==null&&u0(m0,X.startTime-G)}}function NJ(){return v0?!0:dG()-bJG&&NJ());){var Y=NG.callback;if(typeof Y==="function"){NG.callback=null,AY=NG.priorityLevel;var z=Y(NG.expirationTime<=G);if(G=dG(),typeof z==="function"){NG.callback=z,BY(G),X=!0;break X}NG===uG(aG)&&HY(aG),BY(G)}else HY(aG);NG=uG(aG)}if(NG!==null)X=!0;else{var J=uG(LX);J!==null&&u0(m0,J.startTime-G),X=!1}}break G}finally{NG=null,AY=Z,E0=!1}X=void 0}}finally{X?HZ():qZ=!1}}}function u0(G,X){z7=IJ(function(){G(dG())},X)}var dG=void 0,h0,UY,g0,aG,LX,p8=1,NG=null,AY=3,E0=!1,Z7=!1,Y7=!1,v0=!1,IJ,KJ,_J,qZ=!1,z7=-1,s8=5,bJ=-1,HZ,WY,y0,d0=5,l0=1,c0=4,wZ=3,i0=2,p0=function(G){G.callback=null},s0=function(){return AY},o0=function(){v0=!0},jZ=function(G,X,Z){var Y=dG();switch(typeof Z==="object"&&Z!==null?(Z=Z.delay,Z=typeof Z==="number"&&0Y?(G.sortIndex=Z,P0(LX,G),uG(aG)===null&&G===uG(LX)&&(Y7?(KJ(z7),z7=-1):Y7=!0,u0(m0,Z-Y))):(G.sortIndex=z,P0(aG,G),Z7||E0||(Z7=!0,qZ||(qZ=!0,HZ()))),G},a0;var TJ=xJ(()=>{if(typeof performance==="object"&&typeof performance.now==="function")h0=performance,dG=function(){return h0.now()};else UY=Date,g0=UY.now(),dG=function(){return UY.now()-g0};aG=[],LX=[],IJ=typeof setTimeout==="function"?setTimeout:null,KJ=typeof clearTimeout==="function"?clearTimeout:null,_J=typeof setImmediate<"u"?setImmediate:null;if(typeof _J==="function")HZ=function(){_J(f0)};else if(typeof MessageChannel<"u")WY=new MessageChannel,y0=WY.port2,WY.port1.onmessage=f0,HZ=function(){y0.postMessage(null)};else HZ=function(){IJ(f0,0)};a0=NJ});var VJ={};a8(VJ,{version:()=>u8,hydrateRoot:()=>m8,createRoot:()=>v8});function D(G){var X="https://react.dev/errors/"+G;if(1RZ||(G.current=f6[RZ],f6[RZ]=null,RZ--)}function u(G,X){RZ++,f6[RZ]=G.current,G.current=X}function dY(G,X){switch(u(TX,X),u(f7,G),u(pG,null),X.nodeType){case 9:case 11:G=(G=X.documentElement)?(G=G.namespaceURI)?hU(G):0:0;break;default:if(G=X.tagName,X=X.namespaceURI)X=hU(X),G=K8(X,G);else switch(G){case"svg":G=1;break;case"math":G=2;break;default:G=0}}YG(pG),u(pG,G)}function yZ(){YG(pG),YG(f7),YG(TX)}function P6(G){G.memoizedState!==null&&u(uY,G);var X=pG.current,Z=K8(X,G.type);X!==Z&&(u(f7,G),u(pG,Z))}function lY(G){f7.current===G&&(YG(pG),YG(f7)),uY.current===G&&(YG(uY),c7._currentValue=aX)}function cX(G){if(r0===void 0)try{throw Error()}catch(Z){var X=Z.stack.trim().match(/\n( *(at )?)/);r0=X&&X[1]||"",$J=-1>>1,z=G[Y];if(0>>1;YJY(A,Z))BJY(q,A)?(G[Y]=q,G[B]=Z,Y=B):(G[Y]=A,G[U]=Z,Y=U);else if(BJY(q,Z))G[Y]=q,G[B]=Z,Y=B;else break G}}return X}function JY(G,X){var Z=G.sortIndex-X.sortIndex;return Z!==0?Z:G.id-X.id}function BY(G){for(var X=uG(LX);X!==null;){if(X.callback===null)HY(LX);else if(X.startTime<=G)HY(LX),X.sortIndex=X.expirationTime,P0(aG,X);else break;X=uG(LX)}}function m0(G){if(Y7=!1,BY(G),!Z7)if(uG(aG)!==null)Z7=!0,qZ||(qZ=!0,HZ());else{var X=uG(LX);X!==null&&u0(m0,X.startTime-G)}}function NJ(){return v0?!0:dG()-bJG&&NJ());){var Y=NG.callback;if(typeof Y==="function"){NG.callback=null,AY=NG.priorityLevel;var z=Y(NG.expirationTime<=G);if(G=dG(),typeof z==="function"){NG.callback=z,BY(G),X=!0;break X}NG===uG(aG)&&HY(aG),BY(G)}else HY(aG);NG=uG(aG)}if(NG!==null)X=!0;else{var J=uG(LX);J!==null&&u0(m0,J.startTime-G),X=!1}}break G}finally{NG=null,AY=Z,E0=!1}X=void 0}}finally{X?HZ():qZ=!1}}}function u0(G,X){z7=IJ(function(){G(dG())},X)}var dG=void 0,h0,UY,g0,aG,LX,p8=1,NG=null,AY=3,E0=!1,Z7=!1,Y7=!1,v0=!1,IJ,KJ,_J,qZ=!1,z7=-1,s8=5,bJ=-1,HZ,WY,y0,d0=5,l0=1,c0=4,wZ=3,i0=2,p0=function(G){G.callback=null},s0=function(){return AY},o0=function(){v0=!0},jZ=function(G,X,Z){var Y=dG();switch(typeof Z==="object"&&Z!==null?(Z=Z.delay,Z=typeof Z==="number"&&0Y?(G.sortIndex=Z,P0(LX,G),uG(aG)===null&&G===uG(LX)&&(Y7?(KJ(z7),z7=-1):Y7=!0,u0(m0,Z-Y))):(G.sortIndex=z,P0(aG,G),Z7||E0||(Z7=!0,qZ||(qZ=!0,HZ()))),G},a0;var TJ=xJ(()=>{if(typeof performance==="object"&&typeof performance.now==="function")h0=performance,dG=function(){return h0.now()};else UY=Date,g0=UY.now(),dG=function(){return UY.now()-g0};aG=[],LX=[],IJ=typeof setTimeout==="function"?setTimeout:null,KJ=typeof clearTimeout==="function"?clearTimeout:null,_J=typeof setImmediate<"u"?setImmediate:null;if(typeof _J==="function")HZ=function(){_J(f0)};else if(typeof MessageChannel<"u")WY=new MessageChannel,y0=WY.port2,WY.port1.onmessage=f0,HZ=function(){y0.postMessage(null)};else HZ=function(){IJ(f0,0)};a0=NJ});var VJ={};a8(VJ,{version:()=>u8,hydrateRoot:()=>m8,createRoot:()=>v8});function D(G){var X="https://react.dev/errors/"+G;if(1RZ||(G.current=f6[RZ],f6[RZ]=null,RZ--)}function u(G,X){RZ++,f6[RZ]=G.current,G.current=X}function dY(G,X){switch(u(TX,X),u(f7,G),u(pG,null),X.nodeType){case 9:case 11:G=(G=X.documentElement)?(G=G.namespaceURI)?hU(G):0:0;break;default:if(G=X.tagName,X=X.namespaceURI)X=hU(X),G=K8(X,G);else switch(G){case"svg":G=1;break;case"math":G=2;break;default:G=0}}YG(pG),u(pG,G)}function yZ(){YG(pG),YG(f7),YG(TX)}function P6(G){G.memoizedState!==null&&u(uY,G);var X=pG.current,Z=K8(X,G.type);X!==Z&&(u(f7,G),u(pG,Z))}function lY(G){f7.current===G&&(YG(pG),YG(f7)),uY.current===G&&(YG(uY),c7._currentValue=aX)}function cX(G){if(r0===void 0)try{throw Error()}catch(Z){var X=Z.stack.trim().match(/\n( *(at )?)/);r0=X&&X[1]||"",$J=-1)":-1{var v9=R(v());function so($,J){return $===J&&($!==0||1/$===1/J)||$!==$&&J!==J}var oo=typeof Object.is==="function"?Object.is:so,no=v9.useState,ao=v9.useEffect,to=v9.useLayoutEffect,eo=v9.useDebugValue;function $n($,J){var Q=J(),Z=no({inst:{value:Q,getSnapshot:J}}),q=Z[0].inst,X=Z[1];return to(function(){q.value=Q,q.getSnapshot=J,GL(q)&&X({inst:q})},[$,Q,J]),ao(function(){return GL(q)&&X({inst:q}),$(function(){GL(q)&&X({inst:q})})},[$]),eo(Q),Q}function GL($){var J=$.getSnapshot;$=$.value;try{var Q=J();return!oo($,Q)}catch(Z){return!0}}function Jn($,J){return J()}var Qn=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?Jn:$n;Zn.useSyncExternalStore=v9.useSyncExternalStore!==void 0?v9.useSyncExternalStore:Qn});var B8=R(v(),1);var pN=R(v(),1);var D8=R(v(),1);var c0=R(v(),1),mH=R(J5(),1);function g$($,[J,Q]){return Math.min(Q,Math.max(J,$))}var Me=!!(typeof window<"u"&&window.document&&window.document.createElement);function V8($,J,{checkForDefaultPrevented:Q=!0}={}){return function(q){if($?.(q),Q===!1||!q.defaultPrevented)return J?.(q)}}var K7=R(v(),1);var N4=R(v(),1);function cF($,J=[]){let Q=[];function Z(X,Y){let z=N4.createContext(Y),K=Q.length;Q=[...Q,Y];let W=(B)=>{let{scope:U,children:_,...L}=B,F=U?.[$]?.[K]||z,V=N4.useMemo(()=>L,Object.values(L));return G(F.Provider,{value:V,children:_})};W.displayName=X+"Provider";function H(B,U){let _=U?.[$]?.[K]||z,L=N4.useContext(_);if(L)return L;if(Y!==void 0)return Y;throw Error(`\`${B}\` must be used within \`${X}\``)}return[W,H]}let q=()=>{let X=Q.map((Y)=>{return N4.createContext(Y)});return function(z){let K=z?.[$]||X;return N4.useMemo(()=>({[`__scope${$}`]:{...z,[$]:K}}),[z,K])}};return q.scopeName=$,[Z,lh(q,...J)]}function lh(...$){let J=$[0];if($.length===1)return J;let Q=()=>{let Z=$.map((q)=>({useScope:q(),scopeName:q.scopeName}));return function(X){let Y=Z.reduce((z,{useScope:K,scopeName:W})=>{let B=K(X)[`__scope${W}`];return{...z,...B}},{});return N4.useMemo(()=>({[`__scope${J.scopeName}`]:Y}),[Y])}};return Q.scopeName=J.scopeName,Q}var pF=R(v(),1);function dF($,J){if(typeof $==="function")return $(J);else if($!==null&&$!==void 0)$.current=J}function sW(...$){return(J)=>{let Q=!1,Z=$.map((q)=>{let X=dF(q,J);if(!Q&&typeof X=="function")Q=!0;return X});if(Q)return()=>{for(let q=0;q{let{children:X,...Y}=Z,z=s5.Children.toArray(X),K=z.find(sh);if(K){let W=K.props.children,H=z.map((B)=>{if(B===K){if(s5.Children.count(W)>1)return s5.Children.only(null);return s5.isValidElement(W)?W.props.children:null}else return B});return G(J,{...Y,ref:q,children:s5.isValidElement(W)?s5.cloneElement(W,void 0,H):null})}return G(J,{...Y,ref:q,children:X})});return Q.displayName=`${$}.Slot`,Q}function ih($){let J=s5.forwardRef((Q,Z)=>{let{children:q,...X}=Q;if(s5.isValidElement(q)){let Y=nh(q),z=oh(X,q.props);if(q.type!==s5.Fragment)z.ref=Z?sW(Z,Y):Y;return s5.cloneElement(q,z)}return s5.Children.count(q)>1?s5.Children.only(null):null});return J.displayName=`${$}.SlotClone`,J}var rh=Symbol("radix.slottable");function sh($){return s5.isValidElement($)&&typeof $.type==="function"&&"__radixId"in $.type&&$.type.__radixId===rh}function oh($,J){let Q={...J};for(let Z in J){let q=$[Z],X=J[Z];if(/^on[A-Z]/.test(Z)){if(q&&X)Q[Z]=(...z)=>{let K=X(...z);return q(...z),K};else if(q)Q[Z]=q}else if(Z==="style")Q[Z]={...q,...X};else if(Z==="className")Q[Z]=[q,X].filter(Boolean).join(" ")}return{...$,...Q}}function nh($){let J=Object.getOwnPropertyDescriptor($.props,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning;if(Q)return $.ref;if(J=Object.getOwnPropertyDescriptor($,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning,Q)return $.props.ref;return $.props.ref||$.ref}var ah=R(v(),1);function G7($){let J=$+"CollectionProvider",[Q,Z]=cF(J),[q,X]=Q(J,{collectionRef:{current:null},itemMap:new Map}),Y=(F)=>{let{scope:V,children:M}=F,D=K7.default.useRef(null),N=K7.default.useRef(new Map).current;return G(q,{scope:V,itemMap:N,collectionRef:D,children:M})};Y.displayName=J;let z=$+"CollectionSlot",K=nW(z),W=K7.default.forwardRef((F,V)=>{let{scope:M,children:D}=F,N=X(z,M),O=oW(V,N.collectionRef);return G(K,{ref:O,children:D})});W.displayName=z;let H=$+"CollectionItemSlot",B="data-radix-collection-item",U=nW(H),_=K7.default.forwardRef((F,V)=>{let{scope:M,children:D,...N}=F,O=K7.default.useRef(null),k=oW(V,O),I=X(H,M);return K7.default.useEffect(()=>{return I.itemMap.set(O,{ref:O,...N}),()=>void I.itemMap.delete(O)}),G(U,{...{[B]:""},ref:k,children:D})});_.displayName=H;function L(F){let V=X($+"CollectionConsumer",F);return K7.default.useCallback(()=>{let D=V.collectionRef.current;if(!D)return[];let N=Array.from(D.querySelectorAll(`[${B}]`));return Array.from(V.itemMap.values()).sort((I,b)=>N.indexOf(I.ref.current)-N.indexOf(b.ref.current))},[V.collectionRef,V.itemMap])}return[{Provider:Y,Slot:W,ItemSlot:_},L,Z]}var lF=new WeakMap,ye=class $ extends Map{#$;constructor(J){super(J);this.#$=[...super.keys()],lF.set(this,!0)}set(J,Q){if(lF.get(this))if(this.has(J))this.#$[this.#$.indexOf(J)]=J;else this.#$.push(J);return super.set(J,Q),this}insert(J,Q,Z){let q=this.has(Q),X=this.#$.length,Y=iF(J),z=Y>=0?Y:X+Y,K=z<0||z>=X?-1:z;if(K===this.size||q&&K===this.size-1||K===-1)return this.set(Q,Z),this;let W=this.size+(q?0:1);if(Y<0)z++;let H=[...this.#$],B,U=!1;for(let _=z;_=this.size)q=this.size-1;return this.at(q)}keyFrom(J,Q){let Z=this.indexOf(J);if(Z===-1)return;let q=Z+Q;if(q<0)q=0;if(q>=this.size)q=this.size-1;return this.keyAt(q)}find(J,Q){let Z=0;for(let q of this){if(Reflect.apply(J,Q,[q,Z,this]))return q;Z++}return}findIndex(J,Q){let Z=0;for(let q of this){if(Reflect.apply(J,Q,[q,Z,this]))return Z;Z++}return-1}filter(J,Q){let Z=[],q=0;for(let X of this){if(Reflect.apply(J,Q,[X,q,this]))Z.push(X);q++}return new $(Z)}map(J,Q){let Z=[],q=0;for(let X of this)Z.push([X[0],Reflect.apply(J,Q,[X,q,this])]),q++;return new $(Z)}reduce(...J){let[Q,Z]=J,q=0,X=Z??this.at(0);for(let Y of this){if(q===0&&J.length===1)X=Y;else X=Reflect.apply(Q,this,[X,Y,q,this]);q++}return X}reduceRight(...J){let[Q,Z]=J,q=Z??this.at(-1);for(let X=this.size-1;X>=0;X--){let Y=this.at(X);if(X===this.size-1&&J.length===1)q=Y;else q=Reflect.apply(Q,this,[q,Y,X,this])}return q}toSorted(J){let Q=[...this.entries()].sort(J);return new $(Q)}toReversed(){let J=new $;for(let Q=this.size-1;Q>=0;Q--){let Z=this.keyAt(Q),q=this.get(Z);J.set(Z,q)}return J}toSpliced(...J){let Q=[...this.entries()];return Q.splice(...J),new $(Q)}slice(J,Q){let Z=new $,q=this.size-1;if(J===void 0)return Z;if(J<0)J=J+this.size;if(Q!==void 0&&Q>0)q=Q-1;for(let X=J;X<=q;X++){let Y=this.keyAt(X),z=this.get(Y);Z.set(Y,z)}return Z}every(J,Q){let Z=0;for(let q of this){if(!Reflect.apply(J,Q,[q,Z,this]))return!1;Z++}return!0}some(J,Q){let Z=0;for(let q of this){if(Reflect.apply(J,Q,[q,Z,this]))return!0;Z++}return!1}};function aW($,J){if("at"in Array.prototype)return Array.prototype.at.call($,J);let Q=th($,J);return Q===-1?void 0:$[Q]}function th($,J){let Q=$.length,Z=iF(J),q=Z>=0?Z:Q+Z;return q<0||q>=Q?-1:q}function iF($){return $!==$||$===0?0:Math.trunc($)}var sF=R(v(),1);function rF($,J){if(typeof $==="function")return $(J);else if($!==null&&$!==void 0)$.current=J}function tW(...$){return(J)=>{let Q=!1,Z=$.map((q)=>{let X=rF(q,J);if(!Q&&typeof X=="function")Q=!0;return X});if(Q)return()=>{for(let q=0;q{let{scope:U,children:_,...L}=B,F=U?.[$]?.[K]||z,V=O4.useMemo(()=>L,Object.values(L));return G(F.Provider,{value:V,children:_})};W.displayName=X+"Provider";function H(B,U){let _=U?.[$]?.[K]||z,L=O4.useContext(_);if(L)return L;if(Y!==void 0)return Y;throw Error(`\`${B}\` must be used within \`${X}\``)}return[W,H]}let q=()=>{let X=Q.map((Y)=>{return O4.createContext(Y)});return function(z){let K=z?.[$]||X;return O4.useMemo(()=>({[`__scope${$}`]:{...z,[$]:K}}),[z,K])}};return q.scopeName=$,[Z,eh(q,...J)]}function eh(...$){let J=$[0];if($.length===1)return J;let Q=()=>{let Z=$.map((q)=>({useScope:q(),scopeName:q.scopeName}));return function(X){let Y=Z.reduce((z,{useScope:K,scopeName:W})=>{let B=K(X)[`__scope${W}`];return{...z,...B}},{});return O4.useMemo(()=>({[`__scope${J.scopeName}`]:Y}),[Y])}};return Q.scopeName=J.scopeName,Q}var _X=R(v(),1);var $x=_X.createContext(void 0);function p9($){let J=_X.useContext($x);return $||J||"ltr"}var I5=R(v(),1);var ve=!!(typeof window<"u"&&window.document&&window.document.createElement);function LX($,J,{checkForDefaultPrevented:Q=!0}={}){return function(q){if($?.(q),Q===!1||!q.defaultPrevented)return J?.(q)}}var eF=R(v(),1),$V=R(J5(),1);var o5=R(v(),1);var aF=R(v(),1);function nF($,J){if(typeof $==="function")return $(J);else if($!==null&&$!==void 0)$.current=J}function eW(...$){return(J)=>{let Q=!1,Z=$.map((q)=>{let X=nF(q,J);if(!Q&&typeof X=="function")Q=!0;return X});if(Q)return()=>{for(let q=0;q{let{children:X,...Y}=Z,z=o5.Children.toArray(X),K=z.find(Zx);if(K){let W=K.props.children,H=z.map((B)=>{if(B===K){if(o5.Children.count(W)>1)return o5.Children.only(null);return o5.isValidElement(W)?W.props.children:null}else return B});return G(J,{...Y,ref:q,children:o5.isValidElement(W)?o5.cloneElement(W,void 0,H):null})}return G(J,{...Y,ref:q,children:X})});return Q.displayName=`${$}.Slot`,Q}function Jx($){let J=o5.forwardRef((Q,Z)=>{let{children:q,...X}=Q;if(o5.isValidElement(q)){let Y=Xx(q),z=qx(X,q.props);if(q.type!==o5.Fragment)z.ref=Z?eW(Z,Y):Y;return o5.cloneElement(q,z)}return o5.Children.count(q)>1?o5.Children.only(null):null});return J.displayName=`${$}.SlotClone`,J}var Qx=Symbol("radix.slottable");function Zx($){return o5.isValidElement($)&&typeof $.type==="function"&&"__radixId"in $.type&&$.type.__radixId===Qx}function qx($,J){let Q={...J};for(let Z in J){let q=$[Z],X=J[Z];if(/^on[A-Z]/.test(Z)){if(q&&X)Q[Z]=(...z)=>{let K=X(...z);return q(...z),K};else if(q)Q[Z]=q}else if(Z==="style")Q[Z]={...q,...X};else if(Z==="className")Q[Z]=[q,X].filter(Boolean).join(" ")}return{...$,...Q}}function Xx($){let J=Object.getOwnPropertyDescriptor($.props,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning;if(Q)return $.ref;if(J=Object.getOwnPropertyDescriptor($,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning,Q)return $.props.ref;return $.props.ref||$.ref}var Yx=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],JH=Yx.reduce(($,J)=>{let Q=tF(`Primitive.${J}`),Z=eF.forwardRef((q,X)=>{let{asChild:Y,...z}=q,K=Y?Q:J;if(typeof window<"u")window[Symbol.for("radix-ui")]=!0;return G(K,{...z,ref:X})});return Z.displayName=`Primitive.${J}`,{...$,[J]:Z}},{});function JV($,J){if($)$V.flushSync(()=>$.dispatchEvent(J))}var u$=R(v(),1);function c5($){let J=u$.useRef($);return u$.useEffect(()=>{J.current=$}),u$.useMemo(()=>(...Q)=>J.current?.(...Q),[])}var QV=R(v(),1);function ZV($,J=globalThis?.document){let Q=c5($);QV.useEffect(()=>{let Z=(q)=>{if(q.key==="Escape")Q(q)};return J.addEventListener("keydown",Z,{capture:!0}),()=>J.removeEventListener("keydown",Z,{capture:!0})},[Q,J])}var zx="DismissableLayer",QH="dismissableLayer.update",Kx="dismissableLayer.pointerDownOutside",Gx="dismissableLayer.focusOutside",qV,YV=I5.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),A9=I5.forwardRef(($,J)=>{let{disableOutsidePointerEvents:Q=!1,onEscapeKeyDown:Z,onPointerDownOutside:q,onFocusOutside:X,onInteractOutside:Y,onDismiss:z,...K}=$,W=I5.useContext(YV),[H,B]=I5.useState(null),U=H?.ownerDocument??globalThis?.document,[,_]=I5.useState({}),L=$H(J,(b)=>B(b)),F=Array.from(W.layers),[V]=[...W.layersWithOutsidePointerEventsDisabled].slice(-1),M=F.indexOf(V),D=H?F.indexOf(H):-1,N=W.layersWithOutsidePointerEventsDisabled.size>0,O=D>=M,k=Bx((b)=>{let A=b.target,w=[...W.branches].some((C)=>C.contains(A));if(!O||w)return;if(q?.(b),Y?.(b),!b.defaultPrevented)z?.()},U),I=Ux((b)=>{let A=b.target;if([...W.branches].some((C)=>C.contains(A)))return;if(X?.(b),Y?.(b),!b.defaultPrevented)z?.()},U);return ZV((b)=>{if(D!==W.layers.size-1)return;if(Z?.(b),!b.defaultPrevented&&z)b.preventDefault(),z()},U),I5.useEffect(()=>{if(!H)return;if(Q){if(W.layersWithOutsidePointerEventsDisabled.size===0)qV=U.body.style.pointerEvents,U.body.style.pointerEvents="none";W.layersWithOutsidePointerEventsDisabled.add(H)}return W.layers.add(H),XV(),()=>{if(Q&&W.layersWithOutsidePointerEventsDisabled.size===1)U.body.style.pointerEvents=qV}},[H,U,Q,W]),I5.useEffect(()=>{return()=>{if(!H)return;W.layers.delete(H),W.layersWithOutsidePointerEventsDisabled.delete(H),XV()}},[H,W]),I5.useEffect(()=>{let b=()=>_({});return document.addEventListener(QH,b),()=>document.removeEventListener(QH,b)},[]),G(JH.div,{...K,ref:L,style:{pointerEvents:N?O?"auto":"none":void 0,...$.style},onFocusCapture:LX($.onFocusCapture,I.onFocusCapture),onBlurCapture:LX($.onBlurCapture,I.onBlurCapture),onPointerDownCapture:LX($.onPointerDownCapture,k.onPointerDownCapture)})});A9.displayName=zx;var Wx="DismissableLayerBranch",Hx=I5.forwardRef(($,J)=>{let Q=I5.useContext(YV),Z=I5.useRef(null),q=$H(J,Z);return I5.useEffect(()=>{let X=Z.current;if(X)return Q.branches.add(X),()=>{Q.branches.delete(X)}},[Q.branches]),G(JH.div,{...$,ref:q})});Hx.displayName=Wx;function Bx($,J=globalThis?.document){let Q=c5($),Z=I5.useRef(!1),q=I5.useRef(()=>{});return I5.useEffect(()=>{let X=(z)=>{if(z.target&&!Z.current){let W=function(){zV(Kx,Q,H,{discrete:!0})};var K=W;let H={originalEvent:z};if(z.pointerType==="touch")J.removeEventListener("click",q.current),q.current=W,J.addEventListener("click",q.current,{once:!0});else W()}else J.removeEventListener("click",q.current);Z.current=!1},Y=window.setTimeout(()=>{J.addEventListener("pointerdown",X)},0);return()=>{window.clearTimeout(Y),J.removeEventListener("pointerdown",X),J.removeEventListener("click",q.current)}},[J,Q]),{onPointerDownCapture:()=>Z.current=!0}}function Ux($,J=globalThis?.document){let Q=c5($),Z=I5.useRef(!1);return I5.useEffect(()=>{let q=(X)=>{if(X.target&&!Z.current)zV(Gx,Q,{originalEvent:X},{discrete:!1})};return J.addEventListener("focusin",q),()=>J.removeEventListener("focusin",q)},[J,Q]),{onFocusCapture:()=>Z.current=!0,onBlurCapture:()=>Z.current=!1}}function XV(){let $=new CustomEvent(QH);document.dispatchEvent($)}function zV($,J,Q,{discrete:Z}){let q=Q.originalEvent.target,X=new CustomEvent($,{bubbles:!1,cancelable:!0,detail:Q});if(J)q.addEventListener($,J,{once:!0});if(Z)JV(q,X);else q.dispatchEvent(X)}var GV=R(v(),1),ZH=0;function W7(){GV.useEffect(()=>{let $=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",$[0]??KV()),document.body.insertAdjacentElement("beforeend",$[1]??KV()),ZH++,()=>{if(ZH===1)document.querySelectorAll("[data-radix-focus-guard]").forEach((J)=>J.remove());ZH--}},[])}function KV(){let $=document.createElement("span");return $.setAttribute("data-radix-focus-guard",""),$.tabIndex=0,$.style.outline="none",$.style.opacity="0",$.style.position="fixed",$.style.pointerEvents="none",$}var u6=R(v(),1);var HV=R(v(),1);function WV($,J){if(typeof $==="function")return $(J);else if($!==null&&$!==void 0)$.current=J}function qH(...$){return(J)=>{let Q=!1,Z=$.map((q)=>{let X=WV(q,J);if(!Q&&typeof X=="function")Q=!0;return X});if(Q)return()=>{for(let q=0;q{let{children:X,...Y}=Z,z=n5.Children.toArray(X),K=z.find(Fx);if(K){let W=K.props.children,H=z.map((B)=>{if(B===K){if(n5.Children.count(W)>1)return n5.Children.only(null);return n5.isValidElement(W)?W.props.children:null}else return B});return G(J,{...Y,ref:q,children:n5.isValidElement(W)?n5.cloneElement(W,void 0,H):null})}return G(J,{...Y,ref:q,children:X})});return Q.displayName=`${$}.Slot`,Q}function _x($){let J=n5.forwardRef((Q,Z)=>{let{children:q,...X}=Q;if(n5.isValidElement(q)){let Y=Mx(q),z=Vx(X,q.props);if(q.type!==n5.Fragment)z.ref=Z?qH(Z,Y):Y;return n5.cloneElement(q,z)}return n5.Children.count(q)>1?n5.Children.only(null):null});return J.displayName=`${$}.SlotClone`,J}var Lx=Symbol("radix.slottable");function Fx($){return n5.isValidElement($)&&typeof $.type==="function"&&"__radixId"in $.type&&$.type.__radixId===Lx}function Vx($,J){let Q={...J};for(let Z in J){let q=$[Z],X=J[Z];if(/^on[A-Z]/.test(Z)){if(q&&X)Q[Z]=(...z)=>{let K=X(...z);return q(...z),K};else if(q)Q[Z]=q}else if(Z==="style")Q[Z]={...q,...X};else if(Z==="className")Q[Z]=[q,X].filter(Boolean).join(" ")}return{...$,...Q}}function Mx($){let J=Object.getOwnPropertyDescriptor($.props,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning;if(Q)return $.ref;if(J=Object.getOwnPropertyDescriptor($,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning,Q)return $.props.ref;return $.props.ref||$.ref}var Nx=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],LV=Nx.reduce(($,J)=>{let Q=UV(`Primitive.${J}`),Z=_V.forwardRef((q,X)=>{let{asChild:Y,...z}=q,K=Y?Q:J;if(typeof window<"u")window[Symbol.for("radix-ui")]=!0;return G(K,{...z,ref:X})});return Z.displayName=`Primitive.${J}`,{...$,[J]:Z}},{});var XH="focusScope.autoFocusOnMount",YH="focusScope.autoFocusOnUnmount",FV={bubbles:!1,cancelable:!0},Ox="FocusScope",A4=u6.forwardRef(($,J)=>{let{loop:Q=!1,trapped:Z=!1,onMountAutoFocus:q,onUnmountAutoFocus:X,...Y}=$,[z,K]=u6.useState(null),W=c5(q),H=c5(X),B=u6.useRef(null),U=BV(J,(F)=>K(F)),_=u6.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;u6.useEffect(()=>{if(Z){let D=function(I){if(_.paused||!z)return;let b=I.target;if(z.contains(b))B.current=b;else H7(B.current,{select:!0})},N=function(I){if(_.paused||!z)return;let b=I.relatedTarget;if(b===null)return;if(!z.contains(b))H7(B.current,{select:!0})},O=function(I){if(document.activeElement!==document.body)return;for(let A of I)if(A.removedNodes.length>0)H7(z)};var F=D,V=N,M=O;document.addEventListener("focusin",D),document.addEventListener("focusout",N);let k=new MutationObserver(O);if(z)k.observe(z,{childList:!0,subtree:!0});return()=>{document.removeEventListener("focusin",D),document.removeEventListener("focusout",N),k.disconnect()}}},[Z,z,_.paused]),u6.useEffect(()=>{if(z){MV.add(_);let F=document.activeElement;if(!z.contains(F)){let M=new CustomEvent(XH,FV);if(z.addEventListener(XH,W),z.dispatchEvent(M),!M.defaultPrevented){if(Ax(bx(NV(z)),{select:!0}),document.activeElement===F)H7(z)}}return()=>{z.removeEventListener(XH,W),setTimeout(()=>{let M=new CustomEvent(YH,FV);if(z.addEventListener(YH,H),z.dispatchEvent(M),!M.defaultPrevented)H7(F??document.body,{select:!0});z.removeEventListener(YH,H),MV.remove(_)},0)}}},[z,W,H,_]);let L=u6.useCallback((F)=>{if(!Q&&!Z)return;if(_.paused)return;let V=F.key==="Tab"&&!F.altKey&&!F.ctrlKey&&!F.metaKey,M=document.activeElement;if(V&&M){let D=F.currentTarget,[N,O]=wx(D);if(!(N&&O)){if(M===D)F.preventDefault()}else if(!F.shiftKey&&M===O){if(F.preventDefault(),Q)H7(N,{select:!0})}else if(F.shiftKey&&M===N){if(F.preventDefault(),Q)H7(O,{select:!0})}}},[Q,Z,_.paused]);return G(LV.div,{tabIndex:-1,...Y,ref:U,onKeyDown:L})});A4.displayName=Ox;function Ax($,{select:J=!1}={}){let Q=document.activeElement;for(let Z of $)if(H7(Z,{select:J}),document.activeElement!==Q)return}function wx($){let J=NV($),Q=VV(J,$),Z=VV(J.reverse(),$);return[Q,Z]}function NV($){let J=[],Q=document.createTreeWalker($,NodeFilter.SHOW_ELEMENT,{acceptNode:(Z)=>{let q=Z.tagName==="INPUT"&&Z.type==="hidden";if(Z.disabled||Z.hidden||q)return NodeFilter.FILTER_SKIP;return Z.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});while(Q.nextNode())J.push(Q.currentNode);return J}function VV($,J){for(let Q of $)if(!kx(Q,{upTo:J}))return Q}function kx($,{upTo:J}){if(getComputedStyle($).visibility==="hidden")return!0;while($){if(J!==void 0&&$===J)return!1;if(getComputedStyle($).display==="none")return!0;$=$.parentElement}return!1}function Ix($){return $ instanceof HTMLInputElement&&"select"in $}function H7($,{select:J=!1}={}){if($&&$.focus){let Q=document.activeElement;if($.focus({preventScroll:!0}),$!==Q&&Ix($)&&J)$.select()}}var MV=Tx();function Tx(){let $=[];return{add(J){let Q=$[0];if(J!==Q)Q?.pause();$=DV($,J),$.unshift(J)},remove(J){$=DV($,J),$[0]?.resume()}}}function DV($,J){let Q=[...$],Z=Q.indexOf(J);if(Z!==-1)Q.splice(Z,1);return Q}function bx($){return $.filter((J)=>J.tagName!=="A")}var zH=R(v(),1);var OV=R(v(),1),_1=globalThis?.document?OV.useLayoutEffect:()=>{};var jx=zH[" useId ".trim().toString()]||(()=>{return}),Ex=0;function a5($){let[J,Q]=zH.useState(jx());return _1(()=>{if(!$)Q((Z)=>Z??String(Ex++))},[$]),$||(J?`radix-${J}`:"")}var K6=R(v(),1);var kV=["top","right","bottom","left"];var{min:l9,max:n8,round:B7,floor:uQ}=Math,w9=($)=>({x:$,y:$}),yx={left:"right",right:"left",bottom:"top",top:"bottom"};function m$($,J,Q){return n8($,l9(J,Q))}function m6($,J){return typeof $==="function"?$(J):$}function E8($){return $.split("-")[0]}function c6($){return $.split("-")[1]}function VX($){return $==="x"?"y":"x"}function c$($){return $==="y"?"height":"width"}function z6($){let J=$[0];return J==="t"||J==="b"?"y":"x"}function d$($){return VX(z6($))}function IV($,J,Q){if(Q===void 0)Q=!1;let Z=c6($),q=d$($),X=c$(q),Y=q==="x"?Z===(Q?"end":"start")?"right":"left":Z==="start"?"bottom":"top";if(J.reference[X]>J.floating[X])Y=gQ(Y);return[Y,gQ(Y)]}function TV($){let J=gQ($);return[FX($),J,FX(J)]}function FX($){return $.includes("start")?$.replace("start","end"):$.replace("end","start")}var AV=["left","right"],wV=["right","left"],Px=["top","bottom"],Rx=["bottom","top"];function Cx($,J,Q){switch($){case"top":case"bottom":if(Q)return J?wV:AV;return J?AV:wV;case"left":case"right":return J?Px:Rx;default:return[]}}function bV($,J,Q,Z){let q=c6($),X=Cx(E8($),Q==="start",Z);if(q){if(X=X.map((Y)=>Y+"-"+q),J)X=X.concat(X.map(FX))}return X}function gQ($){let J=E8($);return yx[J]+$.slice(J.length)}function Sx($){return{top:0,right:0,bottom:0,left:0,...$}}function mQ($){return typeof $!=="number"?Sx($):{top:$,right:$,bottom:$,left:$}}function B2($){let{x:J,y:Q,width:Z,height:q}=$;return{width:Z,height:q,top:Q,left:J,right:J+Z,bottom:Q+q,x:J,y:Q}}function jV($,J,Q){let{reference:Z,floating:q}=$,X=z6(J),Y=d$(J),z=c$(Y),K=E8(J),W=X==="y",H=Z.x+Z.width/2-q.width/2,B=Z.y+Z.height/2-q.height/2,U=Z[z]/2-q[z]/2,_;switch(K){case"top":_={x:H,y:Z.y-q.height};break;case"bottom":_={x:H,y:Z.y+Z.height};break;case"right":_={x:Z.x+Z.width,y:B};break;case"left":_={x:Z.x-q.width,y:B};break;default:_={x:Z.x,y:Z.y}}switch(c6(J)){case"start":_[Y]-=U*(Q&&W?-1:1);break;case"end":_[Y]+=U*(Q&&W?-1:1);break}return _}async function PV($,J){var Q;if(J===void 0)J={};let{x:Z,y:q,platform:X,rects:Y,elements:z,strategy:K}=$,{boundary:W="clippingAncestors",rootBoundary:H="viewport",elementContext:B="floating",altBoundary:U=!1,padding:_=0}=m6(J,$),L=mQ(_),V=z[U?B==="floating"?"reference":"floating":B],M=B2(await X.getClippingRect({element:((Q=await(X.isElement==null?void 0:X.isElement(V)))!=null?Q:!0)?V:V.contextElement||await(X.getDocumentElement==null?void 0:X.getDocumentElement(z.floating)),boundary:W,rootBoundary:H,strategy:K})),D=B==="floating"?{x:Z,y:q,width:Y.floating.width,height:Y.floating.height}:Y.reference,N=await(X.getOffsetParent==null?void 0:X.getOffsetParent(z.floating)),O=await(X.isElement==null?void 0:X.isElement(N))?await(X.getScale==null?void 0:X.getScale(N))||{x:1,y:1}:{x:1,y:1},k=B2(X.convertOffsetParentRelativeRectToViewportRelativeRect?await X.convertOffsetParentRelativeRectToViewportRelativeRect({elements:z,rect:D,offsetParent:N,strategy:K}):D);return{top:(M.top-k.top+L.top)/O.y,bottom:(k.bottom-M.bottom+L.bottom)/O.y,left:(M.left-k.left+L.left)/O.x,right:(k.right-M.right+L.right)/O.x}}var hx=50,RV=async($,J,Q)=>{let{placement:Z="bottom",strategy:q="absolute",middleware:X=[],platform:Y}=Q,z=Y.detectOverflow?Y:{...Y,detectOverflow:PV},K=await(Y.isRTL==null?void 0:Y.isRTL(J)),W=await Y.getElementRects({reference:$,floating:J,strategy:q}),{x:H,y:B}=jV(W,Z,K),U=Z,_=0,L={};for(let F=0;F({name:"arrow",options:$,async fn(J){let{x:Q,y:Z,placement:q,rects:X,platform:Y,elements:z,middlewareData:K}=J,{element:W,padding:H=0}=m6($,J)||{};if(W==null)return{};let B=mQ(H),U={x:Q,y:Z},_=d$(q),L=c$(_),F=await Y.getDimensions(W),V=_==="y",M=V?"top":"left",D=V?"bottom":"right",N=V?"clientHeight":"clientWidth",O=X.reference[L]+X.reference[_]-U[_]-X.floating[L],k=U[_]-X.reference[_],I=await(Y.getOffsetParent==null?void 0:Y.getOffsetParent(W)),b=I?I[N]:0;if(!b||!await(Y.isElement==null?void 0:Y.isElement(I)))b=z.floating[N]||X.floating[L];let A=O/2-k/2,w=b/2-F[L]/2-1,C=l9(B[M],w),y=l9(B[D],w),x=C,E=b-F[L]-y,P=b/2-F[L]/2+A,h=m$(x,P,E),p=!K.arrow&&c6(q)!=null&&P!==h&&X.reference[L]/2-(PP<=0)){var y,x;let P=(((y=X.flip)==null?void 0:y.index)||0)+1,h=b[P];if(h){if(!(B==="alignment"?D!==z6(h):!1)||C.every((S)=>z6(S.placement)===D?S.overflows[0]>0:!0))return{data:{index:P,overflows:C},reset:{placement:h}}}let p=(x=C.filter((e)=>e.overflows[0]<=0).sort((e,S)=>e.overflows[1]-S.overflows[1])[0])==null?void 0:x.placement;if(!p)switch(_){case"bestFit":{var E;let e=(E=C.filter((S)=>{if(I){let r=z6(S.placement);return r===D||r==="y"}return!0}).map((S)=>[S.placement,S.overflows.filter((r)=>r>0).reduce((r,$0)=>r+$0,0)]).sort((S,r)=>S[1]-r[1])[0])==null?void 0:E[0];if(e)p=e;break}case"initialPlacement":p=z;break}if(q!==p)return{reset:{placement:p}}}return{}}}};function EV($,J){return{top:$.top-J.height,right:$.right-J.width,bottom:$.bottom-J.height,left:$.left-J.width}}function yV($){return kV.some((J)=>$[J]>=0)}var hV=function($){if($===void 0)$={};return{name:"hide",options:$,async fn(J){let{rects:Q,platform:Z}=J,{strategy:q="referenceHidden",...X}=m6($,J);switch(q){case"referenceHidden":{let Y=await Z.detectOverflow(J,{...X,elementContext:"reference"}),z=EV(Y,Q.reference);return{data:{referenceHiddenOffsets:z,referenceHidden:yV(z)}}}case"escaped":{let Y=await Z.detectOverflow(J,{...X,altBoundary:!0}),z=EV(Y,Q.floating);return{data:{escapedOffsets:z,escaped:yV(z)}}}default:return{}}}}};var xV=new Set(["left","top"]);async function xx($,J){let{placement:Q,platform:Z,elements:q}=$,X=await(Z.isRTL==null?void 0:Z.isRTL(q.floating)),Y=E8(Q),z=c6(Q),K=z6(Q)==="y",W=xV.has(Y)?-1:1,H=X&&K?-1:1,B=m6(J,$),{mainAxis:U,crossAxis:_,alignmentAxis:L}=typeof B==="number"?{mainAxis:B,crossAxis:0,alignmentAxis:null}:{mainAxis:B.mainAxis||0,crossAxis:B.crossAxis||0,alignmentAxis:B.alignmentAxis};if(z&&typeof L==="number")_=z==="end"?L*-1:L;return K?{x:_*H,y:U*W}:{x:U*W,y:_*H}}var fV=function($){if($===void 0)$=0;return{name:"offset",options:$,async fn(J){var Q,Z;let{x:q,y:X,placement:Y,middlewareData:z}=J,K=await xx(J,$);if(Y===((Q=z.offset)==null?void 0:Q.placement)&&(Z=z.arrow)!=null&&Z.alignmentOffset)return{};return{x:q+K.x,y:X+K.y,data:{...K,placement:Y}}}}},vV=function($){if($===void 0)$={};return{name:"shift",options:$,async fn(J){let{x:Q,y:Z,placement:q,platform:X}=J,{mainAxis:Y=!0,crossAxis:z=!1,limiter:K={fn:(M)=>{let{x:D,y:N}=M;return{x:D,y:N}}},...W}=m6($,J),H={x:Q,y:Z},B=await X.detectOverflow(J,W),U=z6(E8(q)),_=VX(U),L=H[_],F=H[U];if(Y){let M=_==="y"?"top":"left",D=_==="y"?"bottom":"right",N=L+B[M],O=L-B[D];L=m$(N,L,O)}if(z){let M=U==="y"?"top":"left",D=U==="y"?"bottom":"right",N=F+B[M],O=F-B[D];F=m$(N,F,O)}let V=K.fn({...J,[_]:L,[U]:F});return{...V,data:{x:V.x-Q,y:V.y-Z,enabled:{[_]:Y,[U]:z}}}}}},gV=function($){if($===void 0)$={};return{options:$,fn(J){let{x:Q,y:Z,placement:q,rects:X,middlewareData:Y}=J,{offset:z=0,mainAxis:K=!0,crossAxis:W=!0}=m6($,J),H={x:Q,y:Z},B=z6(q),U=VX(B),_=H[U],L=H[B],F=m6(z,J),V=typeof F==="number"?{mainAxis:F,crossAxis:0}:{mainAxis:0,crossAxis:0,...F};if(K){let N=U==="y"?"height":"width",O=X.reference[U]-X.floating[N]+V.mainAxis,k=X.reference[U]+X.reference[N]-V.mainAxis;if(_k)_=k}if(W){var M,D;let N=U==="y"?"width":"height",O=xV.has(E8(q)),k=X.reference[B]-X.floating[N]+(O?((M=Y.offset)==null?void 0:M[B])||0:0)+(O?0:V.crossAxis),I=X.reference[B]+X.reference[N]+(O?0:((D=Y.offset)==null?void 0:D[B])||0)-(O?V.crossAxis:0);if(LI)L=I}return{[U]:_,[B]:L}}}},uV=function($){if($===void 0)$={};return{name:"size",options:$,async fn(J){var Q,Z;let{placement:q,rects:X,platform:Y,elements:z}=J,{apply:K=()=>{},...W}=m6($,J),H=await Y.detectOverflow(J,W),B=E8(q),U=c6(q),_=z6(q)==="y",{width:L,height:F}=X.floating,V,M;if(B==="top"||B==="bottom")V=B,M=U===(await(Y.isRTL==null?void 0:Y.isRTL(z.floating))?"start":"end")?"left":"right";else M=B,V=U==="end"?"top":"bottom";let D=F-H.top-H.bottom,N=L-H.left-H.right,O=l9(F-H[V],D),k=l9(L-H[M],N),I=!J.middlewareData.shift,b=O,A=k;if((Q=J.middlewareData.shift)!=null&&Q.enabled.x)A=N;if((Z=J.middlewareData.shift)!=null&&Z.enabled.y)b=D;if(I&&!U){let C=n8(H.left,0),y=n8(H.right,0),x=n8(H.top,0),E=n8(H.bottom,0);if(_)A=L-2*(C!==0||y!==0?C+y:n8(H.left,H.right));else b=F-2*(x!==0||E!==0?x+E:n8(H.top,H.bottom))}await K({...J,availableWidth:A,availableHeight:b});let w=await Y.getDimensions(z.floating);if(L!==w.width||F!==w.height)return{reset:{rects:!0}};return{}}}};function MX(){return typeof window<"u"}function x5($){if(DX($))return($.nodeName||"").toLowerCase();return"#document"}function h1($){var J;return($==null||(J=$.ownerDocument)==null?void 0:J.defaultView)||window}function k9($){var J;return(J=(DX($)?$.ownerDocument:$.document)||window.document)==null?void 0:J.documentElement}function DX($){if(!MX())return!1;return $ instanceof Node||$ instanceof h1($).Node}function F1($){if(!MX())return!1;return $ instanceof Element||$ instanceof h1($).Element}function y1($){if(!MX())return!1;return $ instanceof HTMLElement||$ instanceof h1($).HTMLElement}function i9($){if(!MX()||typeof ShadowRoot>"u")return!1;return $ instanceof ShadowRoot||$ instanceof h1($).ShadowRoot}function r9($){let{overflow:J,overflowX:Q,overflowY:Z,display:q}=d5($);return/auto|scroll|overlay|hidden|clip/.test(J+Z+Q)&&q!=="inline"&&q!=="contents"}function mV($){return/^(table|td|th)$/.test(x5($))}function cQ($){try{if($.matches(":popover-open"))return!0}catch(J){}try{return $.matches(":modal")}catch(J){return!1}}var fx=/transform|translate|scale|rotate|perspective|filter/,vx=/paint|layout|strict|content/,U2=($)=>!!$&&$!=="none",KH;function NX($){let J=F1($)?d5($):$;return U2(J.transform)||U2(J.translate)||U2(J.scale)||U2(J.rotate)||U2(J.perspective)||!OX()&&(U2(J.backdropFilter)||U2(J.filter))||fx.test(J.willChange||"")||vx.test(J.contain||"")}function cV($){let J=b6($);while(y1(J)&&!j6(J)){if(NX(J))return J;else if(cQ(J))return null;J=b6(J)}return null}function OX(){if(KH==null)KH=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none");return KH}function j6($){return/^(html|body|#document)$/.test(x5($))}function d5($){return h1($).getComputedStyle($)}function dQ($){if(F1($))return{scrollLeft:$.scrollLeft,scrollTop:$.scrollTop};return{scrollLeft:$.scrollX,scrollTop:$.scrollY}}function b6($){if(x5($)==="html")return $;let J=$.assignedSlot||$.parentNode||i9($)&&$.host||k9($);return i9(J)?J.host:J}function dV($){let J=b6($);if(j6(J))return $.ownerDocument?$.ownerDocument.body:$.body;if(y1(J)&&r9(J))return J;return dV(J)}function U7($,J,Q){var Z;if(J===void 0)J=[];if(Q===void 0)Q=!0;let q=dV($),X=q===((Z=$.ownerDocument)==null?void 0:Z.body),Y=h1(q);if(X){let z=AX(Y);return J.concat(Y,Y.visualViewport||[],r9(q)?q:[],z&&Q?U7(z):[])}else return J.concat(q,U7(q,[],Q))}function AX($){return $.parent&&Object.getPrototypeOf($.parent)?$.frameElement:null}function rV($){let J=d5($),Q=parseFloat(J.width)||0,Z=parseFloat(J.height)||0,q=y1($),X=q?$.offsetWidth:Q,Y=q?$.offsetHeight:Z,z=B7(Q)!==X||B7(Z)!==Y;if(z)Q=X,Z=Y;return{width:Q,height:Z,$:z}}function WH($){return!F1($)?$.contextElement:$}function p$($){let J=WH($);if(!y1(J))return w9(1);let Q=J.getBoundingClientRect(),{width:Z,height:q,$:X}=rV(J),Y=(X?B7(Q.width):Q.width)/Z,z=(X?B7(Q.height):Q.height)/q;if(!Y||!Number.isFinite(Y))Y=1;if(!z||!Number.isFinite(z))z=1;return{x:Y,y:z}}var gx=w9(0);function sV($){let J=h1($);if(!OX()||!J.visualViewport)return gx;return{x:J.visualViewport.offsetLeft,y:J.visualViewport.offsetTop}}function ux($,J,Q){if(J===void 0)J=!1;if(!Q||J&&Q!==h1($))return!1;return J}function _2($,J,Q,Z){if(J===void 0)J=!1;if(Q===void 0)Q=!1;let q=$.getBoundingClientRect(),X=WH($),Y=w9(1);if(J)if(Z){if(F1(Z))Y=p$(Z)}else Y=p$($);let z=ux(X,Q,Z)?sV(X):w9(0),K=(q.left+z.x)/Y.x,W=(q.top+z.y)/Y.y,H=q.width/Y.x,B=q.height/Y.y;if(X){let U=h1(X),_=Z&&F1(Z)?h1(Z):Z,L=U,F=AX(L);while(F&&Z&&_!==L){let V=p$(F),M=F.getBoundingClientRect(),D=d5(F),N=M.left+(F.clientLeft+parseFloat(D.paddingLeft))*V.x,O=M.top+(F.clientTop+parseFloat(D.paddingTop))*V.y;K*=V.x,W*=V.y,H*=V.x,B*=V.y,K+=N,W+=O,L=h1(F),F=AX(L)}}return B2({width:H,height:B,x:K,y:W})}function wX($,J){let Q=dQ($).scrollLeft;if(!J)return _2(k9($)).left+Q;return J.left+Q}function oV($,J){let Q=$.getBoundingClientRect(),Z=Q.left+J.scrollLeft-wX($,Q),q=Q.top+J.scrollTop;return{x:Z,y:q}}function mx($){let{elements:J,rect:Q,offsetParent:Z,strategy:q}=$,X=q==="fixed",Y=k9(Z),z=J?cQ(J.floating):!1;if(Z===Y||z&&X)return Q;let K={scrollLeft:0,scrollTop:0},W=w9(1),H=w9(0),B=y1(Z);if(B||!B&&!X){if(x5(Z)!=="body"||r9(Y))K=dQ(Z);if(B){let _=_2(Z);W=p$(Z),H.x=_.x+Z.clientLeft,H.y=_.y+Z.clientTop}}let U=Y&&!B&&!X?oV(Y,K):w9(0);return{width:Q.width*W.x,height:Q.height*W.y,x:Q.x*W.x-K.scrollLeft*W.x+H.x+U.x,y:Q.y*W.y-K.scrollTop*W.y+H.y+U.y}}function cx($){return Array.from($.getClientRects())}function dx($){let J=k9($),Q=dQ($),Z=$.ownerDocument.body,q=n8(J.scrollWidth,J.clientWidth,Z.scrollWidth,Z.clientWidth),X=n8(J.scrollHeight,J.clientHeight,Z.scrollHeight,Z.clientHeight),Y=-Q.scrollLeft+wX($),z=-Q.scrollTop;if(d5(Z).direction==="rtl")Y+=n8(J.clientWidth,Z.clientWidth)-q;return{width:q,height:X,x:Y,y:z}}var pV=25;function px($,J){let Q=h1($),Z=k9($),q=Q.visualViewport,X=Z.clientWidth,Y=Z.clientHeight,z=0,K=0;if(q){X=q.width,Y=q.height;let H=OX();if(!H||H&&J==="fixed")z=q.offsetLeft,K=q.offsetTop}let W=wX(Z);if(W<=0){let H=Z.ownerDocument,B=H.body,U=getComputedStyle(B),_=H.compatMode==="CSS1Compat"?parseFloat(U.marginLeft)+parseFloat(U.marginRight)||0:0,L=Math.abs(Z.clientWidth-B.clientWidth-_);if(L<=pV)X-=L}else if(W<=pV)X+=W;return{width:X,height:Y,x:z,y:K}}function lx($,J){let Q=_2($,!0,J==="fixed"),Z=Q.top+$.clientTop,q=Q.left+$.clientLeft,X=y1($)?p$($):w9(1),Y=$.clientWidth*X.x,z=$.clientHeight*X.y,K=q*X.x,W=Z*X.y;return{width:Y,height:z,x:K,y:W}}function lV($,J,Q){let Z;if(J==="viewport")Z=px($,Q);else if(J==="document")Z=dx(k9($));else if(F1(J))Z=lx(J,Q);else{let q=sV($);Z={x:J.x-q.x,y:J.y-q.y,width:J.width,height:J.height}}return B2(Z)}function nV($,J){let Q=b6($);if(Q===J||!F1(Q)||j6(Q))return!1;return d5(Q).position==="fixed"||nV(Q,J)}function ix($,J){let Q=J.get($);if(Q)return Q;let Z=U7($,[],!1).filter((z)=>F1(z)&&x5(z)!=="body"),q=null,X=d5($).position==="fixed",Y=X?b6($):$;while(F1(Y)&&!j6(Y)){let z=d5(Y),K=NX(Y);if(!K&&z.position==="fixed")q=null;if(X?!K&&!q:!K&&z.position==="static"&&!!q&&(q.position==="absolute"||q.position==="fixed")||r9(Y)&&!K&&nV($,Y))Z=Z.filter((H)=>H!==Y);else q=z;Y=b6(Y)}return J.set($,Z),Z}function rx($){let{element:J,boundary:Q,rootBoundary:Z,strategy:q}=$,Y=[...Q==="clippingAncestors"?cQ(J)?[]:ix(J,this._c):[].concat(Q),Z],z=lV(J,Y[0],q),K=z.top,W=z.right,H=z.bottom,B=z.left;for(let U=1;U{Y(!1,0.0000001)},1000);else Y(!1,b)}if(b===1&&!tV(W,$.getBoundingClientRect()))Y();O=!1}try{Q=new IntersectionObserver(k,{...N,root:q.ownerDocument})}catch(I){Q=new IntersectionObserver(k,N)}Q.observe($)}return Y(!0),X}function L2($,J,Q,Z){if(Z===void 0)Z={};let{ancestorScroll:q=!0,ancestorResize:X=!0,elementResize:Y=typeof ResizeObserver==="function",layoutShift:z=typeof IntersectionObserver==="function",animationFrame:K=!1}=Z,W=WH($),H=q||X?[...W?U7(W):[],...J?U7(J):[]]:[];H.forEach((M)=>{q&&M.addEventListener("scroll",Q,{passive:!0}),X&&M.addEventListener("resize",Q)});let B=W&&z?tx(W,Q):null,U=-1,_=null;if(Y){if(_=new ResizeObserver((M)=>{let[D]=M;if(D&&D.target===W&&_&&J)_.unobserve(J),cancelAnimationFrame(U),U=requestAnimationFrame(()=>{var N;(N=_)==null||N.observe(J)});Q()}),W&&!K)_.observe(W);if(J)_.observe(J)}let L,F=K?_2($):null;if(K)V();function V(){let M=_2($);if(F&&!tV(F,M))Q();F=M,L=requestAnimationFrame(V)}return Q(),()=>{var M;if(H.forEach((D)=>{q&&D.removeEventListener("scroll",Q),X&&D.removeEventListener("resize",Q)}),B==null||B(),(M=_)==null||M.disconnect(),_=null,K)cancelAnimationFrame(L)}}var eV=fV;var $M=vV,JM=SV,QM=uV,ZM=hV,BH=CV;var qM=gV,kX=($,J,Q)=>{let Z=new Map,q={platform:HH,...Q},X={...q.platform,_c:Z};return RV($,J,{...q,platform:X})};var p5=R(v(),1),YM=R(v(),1),zM=R(J5(),1),$f=typeof document<"u",Jf=function(){},IX=$f?YM.useLayoutEffect:Jf;function TX($,J){if($===J)return!0;if(typeof $!==typeof J)return!1;if(typeof $==="function"&&$.toString()===J.toString())return!0;let Q,Z,q;if($&&J&&typeof $==="object"){if(Array.isArray($)){if(Q=$.length,Q!==J.length)return!1;for(Z=Q;Z--!==0;)if(!TX($[Z],J[Z]))return!1;return!0}if(q=Object.keys($),Q=q.length,Q!==Object.keys(J).length)return!1;for(Z=Q;Z--!==0;)if(!{}.hasOwnProperty.call(J,q[Z]))return!1;for(Z=Q;Z--!==0;){let X=q[Z];if(X==="_owner"&&$.$$typeof)continue;if(!TX($[X],J[X]))return!1}return!0}return $!==$&&J!==J}function KM($){if(typeof window>"u")return 1;return($.ownerDocument.defaultView||window).devicePixelRatio||1}function XM($,J){let Q=KM($);return Math.round(J*Q)/Q}function UH($){let J=p5.useRef($);return IX(()=>{J.current=$}),J}function bX($){if($===void 0)$={};let{placement:J="bottom",strategy:Q="absolute",middleware:Z=[],platform:q,elements:{reference:X,floating:Y}={},transform:z=!0,whileElementsMounted:K,open:W}=$,[H,B]=p5.useState({x:0,y:0,strategy:Q,placement:J,middlewareData:{},isPositioned:!1}),[U,_]=p5.useState(Z);if(!TX(U,Z))_(Z);let[L,F]=p5.useState(null),[V,M]=p5.useState(null),D=p5.useCallback((S)=>{if(S!==I.current)I.current=S,F(S)},[]),N=p5.useCallback((S)=>{if(S!==b.current)b.current=S,M(S)},[]),O=X||L,k=Y||V,I=p5.useRef(null),b=p5.useRef(null),A=p5.useRef(H),w=K!=null,C=UH(K),y=UH(q),x=UH(W),E=p5.useCallback(()=>{if(!I.current||!b.current)return;let S={placement:J,strategy:Q,middleware:U};if(y.current)S.platform=y.current;kX(I.current,b.current,S).then((r)=>{let $0={...r,isPositioned:x.current!==!1};if(P.current&&!TX(A.current,$0))A.current=$0,zM.flushSync(()=>{B($0)})})},[U,J,Q,y,x]);IX(()=>{if(W===!1&&A.current.isPositioned)A.current.isPositioned=!1,B((S)=>({...S,isPositioned:!1}))},[W]);let P=p5.useRef(!1);IX(()=>{return P.current=!0,()=>{P.current=!1}},[]),IX(()=>{if(O)I.current=O;if(k)b.current=k;if(O&&k){if(C.current)return C.current(O,k,E);E()}},[O,k,E,C,w]);let h=p5.useMemo(()=>({reference:I,floating:b,setReference:D,setFloating:N}),[D,N]),p=p5.useMemo(()=>({reference:O,floating:k}),[O,k]),e=p5.useMemo(()=>{let S={position:Q,left:0,top:0};if(!p.floating)return S;let r=XM(p.floating,H.x),$0=XM(p.floating,H.y);if(z)return{...S,transform:"translate("+r+"px, "+$0+"px)",...KM(p.floating)>=1.5&&{willChange:"transform"}};return{position:Q,left:r,top:$0}},[Q,z,p.floating,H.x,H.y]);return p5.useMemo(()=>({...H,update:E,refs:h,elements:p,floatingStyles:e}),[H,E,h,p,e])}var Qf=($)=>{function J(Q){return{}.hasOwnProperty.call(Q,"current")}return{name:"arrow",options:$,fn(Q){let{element:Z,padding:q}=typeof $==="function"?$(Q):$;if(Z&&J(Z)){if(Z.current!=null)return BH({element:Z.current,padding:q}).fn(Q);return{}}if(Z)return BH({element:Z,padding:q}).fn(Q);return{}}}},pQ=($,J)=>{let Q=eV($);return{name:Q.name,fn:Q.fn,options:[$,J]}},lQ=($,J)=>{let Q=$M($);return{name:Q.name,fn:Q.fn,options:[$,J]}},iQ=($,J)=>{return{fn:qM($).fn,options:[$,J]}},rQ=($,J)=>{let Q=JM($);return{name:Q.name,fn:Q.fn,options:[$,J]}},sQ=($,J)=>{let Q=QM($);return{name:Q.name,fn:Q.fn,options:[$,J]}};var oQ=($,J)=>{let Q=ZM($);return{name:Q.name,fn:Q.fn,options:[$,J]}};var _H=($,J)=>{let Q=Qf($);return{name:Q.name,fn:Q.fn,options:[$,J]}};var _M=R(v(),1);var BM=R(v(),1),Gf=R(J5(),1);var t5=R(v(),1);var Zf=R(v(),1);function GM($,J){if(typeof $==="function")return $(J);else if($!==null&&$!==void 0)$.current=J}function WM(...$){return(J)=>{let Q=!1,Z=$.map((q)=>{let X=GM(q,J);if(!Q&&typeof X=="function")Q=!0;return X});if(Q)return()=>{for(let q=0;q{let{children:X,...Y}=Z,z=t5.Children.toArray(X),K=z.find(Yf);if(K){let W=K.props.children,H=z.map((B)=>{if(B===K){if(t5.Children.count(W)>1)return t5.Children.only(null);return t5.isValidElement(W)?W.props.children:null}else return B});return G(J,{...Y,ref:q,children:t5.isValidElement(W)?t5.cloneElement(W,void 0,H):null})}return G(J,{...Y,ref:q,children:X})});return Q.displayName=`${$}.Slot`,Q}function qf($){let J=t5.forwardRef((Q,Z)=>{let{children:q,...X}=Q;if(t5.isValidElement(q)){let Y=Kf(q),z=zf(X,q.props);if(q.type!==t5.Fragment)z.ref=Z?WM(Z,Y):Y;return t5.cloneElement(q,z)}return t5.Children.count(q)>1?t5.Children.only(null):null});return J.displayName=`${$}.SlotClone`,J}var Xf=Symbol("radix.slottable");function Yf($){return t5.isValidElement($)&&typeof $.type==="function"&&"__radixId"in $.type&&$.type.__radixId===Xf}function zf($,J){let Q={...J};for(let Z in J){let q=$[Z],X=J[Z];if(/^on[A-Z]/.test(Z)){if(q&&X)Q[Z]=(...z)=>{let K=X(...z);return q(...z),K};else if(q)Q[Z]=q}else if(Z==="style")Q[Z]={...q,...X};else if(Z==="className")Q[Z]=[q,X].filter(Boolean).join(" ")}return{...$,...Q}}function Kf($){let J=Object.getOwnPropertyDescriptor($.props,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning;if(Q)return $.ref;if(J=Object.getOwnPropertyDescriptor($,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning,Q)return $.props.ref;return $.props.ref||$.ref}var Wf=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],UM=Wf.reduce(($,J)=>{let Q=HM(`Primitive.${J}`),Z=BM.forwardRef((q,X)=>{let{asChild:Y,...z}=q,K=Y?Q:J;if(typeof window<"u")window[Symbol.for("radix-ui")]=!0;return G(K,{...z,ref:X})});return Z.displayName=`Primitive.${J}`,{...$,[J]:Z}},{});var Hf="Arrow",LM=_M.forwardRef(($,J)=>{let{children:Q,width:Z=10,height:q=5,...X}=$;return G(UM.svg,{...X,ref:J,width:Z,height:q,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:$.asChild?Q:G("polygon",{points:"0,0 30,0 15,10"})})});LM.displayName=Hf;var FM=LM;var MM=R(v(),1);function VM($,J){if(typeof $==="function")return $(J);else if($!==null&&$!==void 0)$.current=J}function LH(...$){return(J)=>{let Q=!1,Z=$.map((q)=>{let X=VM(q,J);if(!Q&&typeof X=="function")Q=!0;return X});if(Q)return()=>{for(let q=0;q{let{scope:U,children:_,...L}=B,F=U?.[$]?.[K]||z,V=w4.useMemo(()=>L,Object.values(L));return G(F.Provider,{value:V,children:_})};W.displayName=X+"Provider";function H(B,U){let _=U?.[$]?.[K]||z,L=w4.useContext(_);if(L)return L;if(Y!==void 0)return Y;throw Error(`\`${B}\` must be used within \`${X}\``)}return[W,H]}let q=()=>{let X=Q.map((Y)=>{return w4.createContext(Y)});return function(z){let K=z?.[$]||X;return w4.useMemo(()=>({[`__scope${$}`]:{...z,[$]:K}}),[z,K])}};return q.scopeName=$,[Z,Uf(q,...J)]}function Uf(...$){let J=$[0];if($.length===1)return J;let Q=()=>{let Z=$.map((q)=>({useScope:q(),scopeName:q.scopeName}));return function(X){let Y=Z.reduce((z,{useScope:K,scopeName:W})=>{let B=K(X)[`__scope${W}`];return{...z,...B}},{});return w4.useMemo(()=>({[`__scope${J.scopeName}`]:Y}),[Y])}};return Q.scopeName=J.scopeName,Q}var OM=R(v(),1),Df=R(J5(),1);var e5=R(v(),1);function NM($){let J=_f($),Q=e5.forwardRef((Z,q)=>{let{children:X,...Y}=Z,z=e5.Children.toArray(X),K=z.find(Ff);if(K){let W=K.props.children,H=z.map((B)=>{if(B===K){if(e5.Children.count(W)>1)return e5.Children.only(null);return e5.isValidElement(W)?W.props.children:null}else return B});return G(J,{...Y,ref:q,children:e5.isValidElement(W)?e5.cloneElement(W,void 0,H):null})}return G(J,{...Y,ref:q,children:X})});return Q.displayName=`${$}.Slot`,Q}function _f($){let J=e5.forwardRef((Q,Z)=>{let{children:q,...X}=Q;if(e5.isValidElement(q)){let Y=Mf(q),z=Vf(X,q.props);if(q.type!==e5.Fragment)z.ref=Z?LH(Z,Y):Y;return e5.cloneElement(q,z)}return e5.Children.count(q)>1?e5.Children.only(null):null});return J.displayName=`${$}.SlotClone`,J}var Lf=Symbol("radix.slottable");function Ff($){return e5.isValidElement($)&&typeof $.type==="function"&&"__radixId"in $.type&&$.type.__radixId===Lf}function Vf($,J){let Q={...J};for(let Z in J){let q=$[Z],X=J[Z];if(/^on[A-Z]/.test(Z)){if(q&&X)Q[Z]=(...z)=>{let K=X(...z);return q(...z),K};else if(q)Q[Z]=q}else if(Z==="style")Q[Z]={...q,...X};else if(Z==="className")Q[Z]=[q,X].filter(Boolean).join(" ")}return{...$,...Q}}function Mf($){let J=Object.getOwnPropertyDescriptor($.props,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning;if(Q)return $.ref;if(J=Object.getOwnPropertyDescriptor($,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning,Q)return $.props.ref;return $.props.ref||$.ref}var Nf=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],VH=Nf.reduce(($,J)=>{let Q=NM(`Primitive.${J}`),Z=OM.forwardRef((q,X)=>{let{asChild:Y,...z}=q,K=Y?Q:J;if(typeof window<"u")window[Symbol.for("radix-ui")]=!0;return G(K,{...z,ref:X})});return Z.displayName=`Primitive.${J}`,{...$,[J]:Z}},{});var AM=R(v(),1);function wM($){let[J,Q]=AM.useState(void 0);return _1(()=>{if($){Q({width:$.offsetWidth,height:$.offsetHeight});let Z=new ResizeObserver((q)=>{if(!Array.isArray(q))return;if(!q.length)return;let X=q[0],Y,z;if("borderBoxSize"in X){let K=X.borderBoxSize,W=Array.isArray(K)?K[0]:K;Y=W.inlineSize,z=W.blockSize}else Y=$.offsetWidth,z=$.offsetHeight;Q({width:Y,height:z})});return Z.observe($,{box:"border-box"}),()=>Z.unobserve($)}else Q(void 0)},[$]),J}var MH="Popper",[kM,d6]=DM(MH),[Of,IM]=kM(MH),TM=($)=>{let{__scopePopper:J,children:Q}=$,[Z,q]=K6.useState(null);return G(Of,{scope:J,anchor:Z,onAnchorChange:q,children:Q})};TM.displayName=MH;var bM="PopperAnchor",jM=K6.forwardRef(($,J)=>{let{__scopePopper:Q,virtualRef:Z,...q}=$,X=IM(bM,Q),Y=K6.useRef(null),z=FH(J,Y),K=K6.useRef(null);return K6.useEffect(()=>{let W=K.current;if(K.current=Z?.current||Y.current,W!==K.current)X.onAnchorChange(K.current)}),Z?null:G(VH.div,{...q,ref:z})});jM.displayName=bM;var DH="PopperContent",[Af,wf]=kM(DH),EM=K6.forwardRef(($,J)=>{let{__scopePopper:Q,side:Z="bottom",sideOffset:q=0,align:X="center",alignOffset:Y=0,arrowPadding:z=0,avoidCollisions:K=!0,collisionBoundary:W=[],collisionPadding:H=0,sticky:B="partial",hideWhenDetached:U=!1,updatePositionStrategy:_="optimized",onPlaced:L,...F}=$,V=IM(DH,Q),[M,D]=K6.useState(null),N=FH(J,(m)=>D(m)),[O,k]=K6.useState(null),I=wM(O),b=I?.width??0,A=I?.height??0,w=Z+(X!=="center"?"-"+X:""),C=typeof H==="number"?H:{top:0,right:0,bottom:0,left:0,...H},y=Array.isArray(W)?W:[W],x=y.length>0,E={padding:C,boundary:y.filter(If),altBoundary:x},{refs:P,floatingStyles:h,placement:p,isPositioned:e,middlewareData:S}=bX({strategy:"fixed",placement:w,whileElementsMounted:(...m)=>{return L2(...m,{animationFrame:_==="always"})},elements:{reference:V.anchor},middleware:[pQ({mainAxis:q+A,alignmentAxis:Y}),K&&lQ({mainAxis:!0,crossAxis:!1,limiter:B==="partial"?iQ():void 0,...E}),K&&rQ({...E}),sQ({...E,apply:({elements:m,rects:s,availableWidth:u,availableHeight:c})=>{let{width:i,height:f}=s.reference,o=m.floating.style;o.setProperty("--radix-popper-available-width",`${u}px`),o.setProperty("--radix-popper-available-height",`${c}px`),o.setProperty("--radix-popper-anchor-width",`${i}px`),o.setProperty("--radix-popper-anchor-height",`${f}px`)}}),O&&_H({element:O,padding:z}),Tf({arrowWidth:b,arrowHeight:A}),U&&oQ({strategy:"referenceHidden",...E})]}),[r,$0]=RM(p),K0=c5(L);_1(()=>{if(e)K0?.()},[e,K0]);let t=S.arrow?.x,H0=S.arrow?.y,z0=S.arrow?.centerOffset!==0,[j,d]=K6.useState();return _1(()=>{if(M)d(window.getComputedStyle(M).zIndex)},[M]),G("div",{ref:P.setFloating,"data-radix-popper-content-wrapper":"",style:{...h,transform:e?h.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:j,["--radix-popper-transform-origin"]:[S.transformOrigin?.x,S.transformOrigin?.y].join(" "),...S.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:$.dir,children:G(Af,{scope:Q,placedSide:r,onArrowChange:k,arrowX:t,arrowY:H0,shouldHideArrow:z0,children:G(VH.div,{"data-side":r,"data-align":$0,...F,ref:N,style:{...F.style,animation:!e?"none":void 0}})})})});EM.displayName=DH;var yM="PopperArrow",kf={top:"bottom",right:"left",bottom:"top",left:"right"},PM=K6.forwardRef(function(J,Q){let{__scopePopper:Z,...q}=J,X=wf(yM,Z),Y=kf[X.placedSide];return G("span",{ref:X.onArrowChange,style:{position:"absolute",left:X.arrowX,top:X.arrowY,[Y]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[X.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[X.placedSide],visibility:X.shouldHideArrow?"hidden":void 0},children:G(FM,{...q,ref:Q,style:{...q.style,display:"block"}})})});PM.displayName=yM;function If($){return $!==null}var Tf=($)=>({name:"transformOrigin",options:$,fn(J){let{placement:Q,rects:Z,middlewareData:q}=J,Y=q.arrow?.centerOffset!==0,z=Y?0:$.arrowWidth,K=Y?0:$.arrowHeight,[W,H]=RM(Q),B={start:"0%",center:"50%",end:"100%"}[H],U=(q.arrow?.x??0)+z/2,_=(q.arrow?.y??0)+K/2,L="",F="";if(W==="bottom")L=Y?B:`${U}px`,F=`${-K}px`;else if(W==="top")L=Y?B:`${U}px`,F=`${Z.floating.height+K}px`;else if(W==="right")L=`${-K}px`,F=Y?B:`${_}px`;else if(W==="left")L=`${Z.floating.width+K}px`,F=Y?B:`${_}px`;return{data:{x:L,y:F}}}});function RM($){let[J,Q="center"]=$.split("-");return[J,Q]}var k4=TM,I4=jM,_7=EM,L7=PM;var EX=R(v(),1),vM=R(J5(),1);var xM=R(v(),1),Cf=R(J5(),1);var $8=R(v(),1);var bf=R(v(),1);function CM($,J){if(typeof $==="function")return $(J);else if($!==null&&$!==void 0)$.current=J}function SM(...$){return(J)=>{let Q=!1,Z=$.map((q)=>{let X=CM(q,J);if(!Q&&typeof X=="function")Q=!0;return X});if(Q)return()=>{for(let q=0;q{let{children:X,...Y}=Z,z=$8.Children.toArray(X),K=z.find(yf);if(K){let W=K.props.children,H=z.map((B)=>{if(B===K){if($8.Children.count(W)>1)return $8.Children.only(null);return $8.isValidElement(W)?W.props.children:null}else return B});return G(J,{...Y,ref:q,children:$8.isValidElement(W)?$8.cloneElement(W,void 0,H):null})}return G(J,{...Y,ref:q,children:X})});return Q.displayName=`${$}.Slot`,Q}function jf($){let J=$8.forwardRef((Q,Z)=>{let{children:q,...X}=Q;if($8.isValidElement(q)){let Y=Rf(q),z=Pf(X,q.props);if(q.type!==$8.Fragment)z.ref=Z?SM(Z,Y):Y;return $8.cloneElement(q,z)}return $8.Children.count(q)>1?$8.Children.only(null):null});return J.displayName=`${$}.SlotClone`,J}var Ef=Symbol("radix.slottable");function yf($){return $8.isValidElement($)&&typeof $.type==="function"&&"__radixId"in $.type&&$.type.__radixId===Ef}function Pf($,J){let Q={...J};for(let Z in J){let q=$[Z],X=J[Z];if(/^on[A-Z]/.test(Z)){if(q&&X)Q[Z]=(...z)=>{let K=X(...z);return q(...z),K};else if(q)Q[Z]=q}else if(Z==="style")Q[Z]={...q,...X};else if(Z==="className")Q[Z]=[q,X].filter(Boolean).join(" ")}return{...$,...Q}}function Rf($){let J=Object.getOwnPropertyDescriptor($.props,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning;if(Q)return $.ref;if(J=Object.getOwnPropertyDescriptor($,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning,Q)return $.props.ref;return $.props.ref||$.ref}var Sf=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],fM=Sf.reduce(($,J)=>{let Q=hM(`Primitive.${J}`),Z=xM.forwardRef((q,X)=>{let{asChild:Y,...z}=q,K=Y?Q:J;if(typeof window<"u")window[Symbol.for("radix-ui")]=!0;return G(K,{...z,ref:X})});return Z.displayName=`Primitive.${J}`,{...$,[J]:Z}},{});var hf="Portal",I9=EX.forwardRef(($,J)=>{let{container:Q,...Z}=$,[q,X]=EX.useState(!1);_1(()=>X(!0),[]);let Y=Q||q&&globalThis?.document?.body;return Y?vM.default.createPortal(G(fM.div,{...Z,ref:J}),Y):null});I9.displayName=hf;var gM=R(v(),1),mf=R(J5(),1);var J8=R(v(),1);function yX($){let J=xf($),Q=J8.forwardRef((Z,q)=>{let{children:X,...Y}=Z,z=J8.Children.toArray(X),K=z.find(vf);if(K){let W=K.props.children,H=z.map((B)=>{if(B===K){if(J8.Children.count(W)>1)return J8.Children.only(null);return J8.isValidElement(W)?W.props.children:null}else return B});return G(J,{...Y,ref:q,children:J8.isValidElement(W)?J8.cloneElement(W,void 0,H):null})}return G(J,{...Y,ref:q,children:X})});return Q.displayName=`${$}.Slot`,Q}function xf($){let J=J8.forwardRef((Q,Z)=>{let{children:q,...X}=Q;if(J8.isValidElement(q)){let Y=uf(q),z=gf(X,q.props);if(q.type!==J8.Fragment)z.ref=Z?tW(Z,Y):Y;return J8.cloneElement(q,z)}return J8.Children.count(q)>1?J8.Children.only(null):null});return J.displayName=`${$}.SlotClone`,J}var ff=Symbol("radix.slottable");function vf($){return J8.isValidElement($)&&typeof $.type==="function"&&"__radixId"in $.type&&$.type.__radixId===ff}function gf($,J){let Q={...J};for(let Z in J){let q=$[Z],X=J[Z];if(/^on[A-Z]/.test(Z)){if(q&&X)Q[Z]=(...z)=>{let K=X(...z);return q(...z),K};else if(q)Q[Z]=q}else if(Z==="style")Q[Z]={...q,...X};else if(Z==="className")Q[Z]=[q,X].filter(Boolean).join(" ")}return{...$,...Q}}function uf($){let J=Object.getOwnPropertyDescriptor($.props,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning;if(Q)return $.ref;if(J=Object.getOwnPropertyDescriptor($,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning,Q)return $.props.ref;return $.props.ref||$.ref}var cf=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],a8=cf.reduce(($,J)=>{let Q=yX(`Primitive.${J}`),Z=gM.forwardRef((q,X)=>{let{asChild:Y,...z}=q,K=Y?Q:J;if(typeof window<"u")window[Symbol.for("radix-ui")]=!0;return G(K,{...z,ref:X})});return Z.displayName=`Primitive.${J}`,{...$,[J]:Z}},{});var p6=R(v(),1);var PX=R(v(),1);var df=p6[" useInsertionEffect ".trim().toString()]||_1;function NH({prop:$,defaultProp:J,onChange:Q=()=>{},caller:Z}){let[q,X,Y]=pf({defaultProp:J,onChange:Q}),z=$!==void 0,K=z?$:q;{let H=p6.useRef($!==void 0);p6.useEffect(()=>{let B=H.current;if(B!==z)console.warn(`${Z} is changing from ${B?"controlled":"uncontrolled"} to ${z?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`);H.current=z},[z,Z])}let W=p6.useCallback((H)=>{if(z){let B=lf(H)?H($):H;if(B!==$)Y.current?.(B)}else X(H)},[z,$,X,Y]);return[K,W]}function pf({defaultProp:$,onChange:J}){let[Q,Z]=p6.useState($),q=p6.useRef(Q),X=p6.useRef(J);return df(()=>{X.current=J},[J]),p6.useEffect(()=>{if(q.current!==Q)X.current?.(Q),q.current=Q},[Q,q]),[Q,Z,X]}function lf($){return typeof $==="function"}var j10=Symbol("RADIX:SYNC_STATE");var RX=R(v(),1);function CX($){let J=RX.useRef({value:$,previous:$});return RX.useMemo(()=>{if(J.current.value!==$)J.current.previous=J.current.value,J.current.value=$;return J.current.previous},[$])}var lM=R(v(),1);var dM=R(v(),1),ef=R(J5(),1);var Q8=R(v(),1);var rf=R(v(),1);function uM($,J){if(typeof $==="function")return $(J);else if($!==null&&$!==void 0)$.current=J}function mM(...$){return(J)=>{let Q=!1,Z=$.map((q)=>{let X=uM(q,J);if(!Q&&typeof X=="function")Q=!0;return X});if(Q)return()=>{for(let q=0;q{let{children:X,...Y}=Z,z=Q8.Children.toArray(X),K=z.find(nf);if(K){let W=K.props.children,H=z.map((B)=>{if(B===K){if(Q8.Children.count(W)>1)return Q8.Children.only(null);return Q8.isValidElement(W)?W.props.children:null}else return B});return G(J,{...Y,ref:q,children:Q8.isValidElement(W)?Q8.cloneElement(W,void 0,H):null})}return G(J,{...Y,ref:q,children:X})});return Q.displayName=`${$}.Slot`,Q}function sf($){let J=Q8.forwardRef((Q,Z)=>{let{children:q,...X}=Q;if(Q8.isValidElement(q)){let Y=tf(q),z=af(X,q.props);if(q.type!==Q8.Fragment)z.ref=Z?mM(Z,Y):Y;return Q8.cloneElement(q,z)}return Q8.Children.count(q)>1?Q8.Children.only(null):null});return J.displayName=`${$}.SlotClone`,J}var of=Symbol("radix.slottable");function nf($){return Q8.isValidElement($)&&typeof $.type==="function"&&"__radixId"in $.type&&$.type.__radixId===of}function af($,J){let Q={...J};for(let Z in J){let q=$[Z],X=J[Z];if(/^on[A-Z]/.test(Z)){if(q&&X)Q[Z]=(...z)=>{let K=X(...z);return q(...z),K};else if(q)Q[Z]=q}else if(Z==="style")Q[Z]={...q,...X};else if(Z==="className")Q[Z]=[q,X].filter(Boolean).join(" ")}return{...$,...Q}}function tf($){let J=Object.getOwnPropertyDescriptor($.props,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning;if(Q)return $.ref;if(J=Object.getOwnPropertyDescriptor($,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning,Q)return $.props.ref;return $.props.ref||$.ref}var $v=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],pM=$v.reduce(($,J)=>{let Q=cM(`Primitive.${J}`),Z=dM.forwardRef((q,X)=>{let{asChild:Y,...z}=q,K=Y?Q:J;if(typeof window<"u")window[Symbol.for("radix-ui")]=!0;return G(K,{...z,ref:X})});return Z.displayName=`Primitive.${J}`,{...$,[J]:Z}},{});var OH=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Jv="VisuallyHidden",iM=lM.forwardRef(($,J)=>{return G(pM.span,{...$,ref:J,style:{...OH,...$.style}})});iM.displayName=Jv;var rM=iM;var Zv=function($){if(typeof document>"u")return null;var J=Array.isArray($)?$[0]:$;return J.ownerDocument.body},l$=new WeakMap,SX=new WeakMap,hX={},AH=0,sM=function($){return $&&($.host||sM($.parentNode))},qv=function($,J){return J.map(function(Q){if($.contains(Q))return Q;var Z=sM(Q);if(Z&&$.contains(Z))return Z;return console.error("aria-hidden",Q,"in not contained inside",$,". Doing nothing"),null}).filter(function(Q){return Boolean(Q)})},Xv=function($,J,Q,Z){var q=qv(J,Array.isArray($)?$:[$]);if(!hX[Q])hX[Q]=new WeakMap;var X=hX[Q],Y=[],z=new Set,K=new Set(q),W=function(B){if(!B||z.has(B))return;z.add(B),W(B.parentNode)};q.forEach(W);var H=function(B){if(!B||K.has(B))return;Array.prototype.forEach.call(B.children,function(U){if(z.has(U))H(U);else try{var _=U.getAttribute(Z),L=_!==null&&_!=="false",F=(l$.get(U)||0)+1,V=(X.get(U)||0)+1;if(l$.set(U,F),X.set(U,V),Y.push(U),F===1&&L)SX.set(U,!0);if(V===1)U.setAttribute(Q,"true");if(!L)U.setAttribute(Z,"true")}catch(M){console.error("aria-hidden: cannot operate on ",U,M)}})};return H(J),z.clear(),AH++,function(){if(Y.forEach(function(B){var U=l$.get(B)-1,_=X.get(B)-1;if(l$.set(B,U),X.set(B,_),!U){if(!SX.has(B))B.removeAttribute(Z);SX.delete(B)}if(!_)B.removeAttribute(Q)}),AH--,!AH)l$=new WeakMap,l$=new WeakMap,SX=new WeakMap,hX={}}},F7=function($,J,Q){if(Q===void 0)Q="data-aria-hidden";var Z=Array.from(Array.isArray($)?$:[$]),q=J||Zv($);if(!q)return function(){return null};return Z.push.apply(Z,Array.from(q.querySelectorAll("[aria-live], script"))),Xv(Z,q,Q,"aria-hidden")};var G6=function(){return G6=Object.assign||function(J){for(var Q,Z=1,q=arguments.length;Z"u")return Bv;var J=Uv($),Q=document.documentElement.clientWidth,Z=window.innerWidth;return{left:J[0],top:J[1],right:J[2],gap:Math.max(0,Z-Q+J[2]-J[0])}};var _v=aQ(),i$="data-scroll-locked",Lv=function($,J,Q,Z){var{left:q,top:X,right:Y,gap:z}=$;if(Q===void 0)Q="margin";return` + .`.concat(wH,` { + overflow: hidden `).concat(Z,`; + padding-right: `).concat(z,"px ").concat(Z,`; + } + body[`).concat(i$,`] { + overflow: hidden `).concat(Z,`; + overscroll-behavior: contain; + `).concat([J&&"position: relative ".concat(Z,";"),Q==="margin"&&` + padding-left: `.concat(q,`px; + padding-top: `).concat(X,`px; + padding-right: `).concat(Y,`px; + margin-left:0; + margin-top:0; + margin-right: `).concat(z,"px ").concat(Z,`; + `),Q==="padding"&&"padding-right: ".concat(z,"px ").concat(Z,";")].filter(Boolean).join(""),` + } + + .`).concat(F2,` { + right: `).concat(z,"px ").concat(Z,`; + } + + .`).concat(V2,` { + margin-right: `).concat(z,"px ").concat(Z,`; + } + + .`).concat(F2," .").concat(F2,` { + right: 0 `).concat(Z,`; + } + + .`).concat(V2," .").concat(V2,` { + margin-right: 0 `).concat(Z,`; + } + + body[`).concat(i$,`] { + `).concat(kH,": ").concat(z,`px; + } +`)},qD=function(){var $=parseInt(document.body.getAttribute(i$)||"0",10);return isFinite($)?$:0},Fv=function(){r$.useEffect(function(){return document.body.setAttribute(i$,(qD()+1).toString()),function(){var $=qD()-1;if($<=0)document.body.removeAttribute(i$);else document.body.setAttribute(i$,$.toString())}},[])},CH=function($){var{noRelative:J,noImportant:Q,gapMode:Z}=$,q=Z===void 0?"margin":Z;Fv();var X=r$.useMemo(function(){return RH(q)},[q]);return r$.createElement(_v,{styles:Lv(X,!J,q,!Q?"!important":"")})};var SH=!1;if(typeof window<"u")try{s$=Object.defineProperty({},"passive",{get:function(){return SH=!0,!0}}),window.addEventListener("test",s$,s$),window.removeEventListener("test",s$,s$)}catch($){SH=!1}var s$,M2=SH?{passive:!1}:!1;var Vv=function($){return $.tagName==="TEXTAREA"},XD=function($,J){if(!($ instanceof Element))return!1;var Q=window.getComputedStyle($);return Q[J]!=="hidden"&&!(Q.overflowY===Q.overflowX&&!Vv($)&&Q[J]==="visible")},Mv=function($){return XD($,"overflowY")},Dv=function($){return XD($,"overflowX")},hH=function($,J){var Q=J.ownerDocument,Z=J;do{if(typeof ShadowRoot<"u"&&Z instanceof ShadowRoot)Z=Z.host;var q=YD($,Z);if(q){var X=zD($,Z),Y=X[1],z=X[2];if(Y>z)return!0}Z=Z.parentNode}while(Z&&Z!==Q.body);return!1},Nv=function($){var{scrollTop:J,scrollHeight:Q,clientHeight:Z}=$;return[J,Q,Z]},Ov=function($){var{scrollLeft:J,scrollWidth:Q,clientWidth:Z}=$;return[J,Q,Z]},YD=function($,J){return $==="v"?Mv(J):Dv(J)},zD=function($,J){return $==="v"?Nv(J):Ov(J)},Av=function($,J){return $==="h"&&J==="rtl"?-1:1},KD=function($,J,Q,Z,q){var X=Av($,window.getComputedStyle(J).direction),Y=X*Z,z=Q.target,K=J.contains(z),W=!1,H=Y>0,B=0,U=0;do{if(!z)break;var _=zD($,z),L=_[0],F=_[1],V=_[2],M=F-V-X*L;if(L||M){if(YD($,z))B+=M,U+=L}var D=z.parentNode;z=D&&D.nodeType===Node.DOCUMENT_FRAGMENT_NODE?D.host:D}while(!K&&z!==document.body||K&&(J.contains(z)||J===z));if(H&&(q&&Math.abs(B)<1||!q&&Y>B))W=!0;else if(!H&&(q&&Math.abs(U)<1||!q&&-Y>U))W=!0;return W};var uX=function($){return"changedTouches"in $?[$.changedTouches[0].clientX,$.changedTouches[0].clientY]:[0,0]},GD=function($){return[$.deltaX,$.deltaY]},WD=function($){return $&&"current"in $?$.current:$},wv=function($,J){return $[0]===J[0]&&$[1]===J[1]},kv=function($){return` + .block-interactivity-`.concat($,` {pointer-events: none;} + .allow-interactivity-`).concat($,` {pointer-events: all;} +`)},Iv=0,o$=[];function HD($){var J=F5.useRef([]),Q=F5.useRef([0,0]),Z=F5.useRef(),q=F5.useState(Iv++)[0],X=F5.useState(aQ)[0],Y=F5.useRef($);F5.useEffect(function(){Y.current=$},[$]),F5.useEffect(function(){if($.inert){document.body.classList.add("block-interactivity-".concat(q));var F=oM([$.lockRef.current],($.shards||[]).map(WD),!0).filter(Boolean);return F.forEach(function(V){return V.classList.add("allow-interactivity-".concat(q))}),function(){document.body.classList.remove("block-interactivity-".concat(q)),F.forEach(function(V){return V.classList.remove("allow-interactivity-".concat(q))})}}return},[$.inert,$.lockRef.current,$.shards]);var z=F5.useCallback(function(F,V){if("touches"in F&&F.touches.length===2||F.type==="wheel"&&F.ctrlKey)return!Y.current.allowPinchZoom;var M=uX(F),D=Q.current,N="deltaX"in F?F.deltaX:D[0]-M[0],O="deltaY"in F?F.deltaY:D[1]-M[1],k,I=F.target,b=Math.abs(N)>Math.abs(O)?"h":"v";if("touches"in F&&b==="h"&&I.type==="range")return!1;var A=window.getSelection(),w=A&&A.anchorNode,C=w?w===I||w.contains(I):!1;if(C)return!1;var y=hH(b,I);if(!y)return!0;if(y)k=b;else k=b==="v"?"h":"v",y=hH(b,I);if(!y)return!1;if(!Z.current&&"changedTouches"in F&&(N||O))Z.current=k;if(!k)return!0;var x=Z.current||k;return KD(x,V,F,x==="h"?N:O,!0)},[]),K=F5.useCallback(function(F){var V=F;if(!o$.length||o$[o$.length-1]!==X)return;var M="deltaY"in V?GD(V):uX(V),D=J.current.filter(function(k){return k.name===V.type&&(k.target===V.target||V.target===k.shadowParent)&&wv(k.delta,M)})[0];if(D&&D.should){if(V.cancelable)V.preventDefault();return}if(!D){var N=(Y.current.shards||[]).map(WD).filter(Boolean).filter(function(k){return k.contains(V.target)}),O=N.length>0?z(V,N[0]):!Y.current.noIsolation;if(O){if(V.cancelable)V.preventDefault()}}},[]),W=F5.useCallback(function(F,V,M,D){var N={name:F,delta:V,target:M,should:D,shadowParent:Tv(M)};J.current.push(N),setTimeout(function(){J.current=J.current.filter(function(O){return O!==N})},1)},[]),H=F5.useCallback(function(F){Q.current=uX(F),Z.current=void 0},[]),B=F5.useCallback(function(F){W(F.type,GD(F),F.target,z(F,$.lockRef.current))},[]),U=F5.useCallback(function(F){W(F.type,uX(F),F.target,z(F,$.lockRef.current))},[]);F5.useEffect(function(){return o$.push(X),$.setCallbacks({onScrollCapture:B,onWheelCapture:B,onTouchMoveCapture:U}),document.addEventListener("wheel",K,M2),document.addEventListener("touchmove",K,M2),document.addEventListener("touchstart",H,M2),function(){o$=o$.filter(function(F){return F!==X}),document.removeEventListener("wheel",K,M2),document.removeEventListener("touchmove",K,M2),document.removeEventListener("touchstart",H,M2)}},[]);var{removeScrollBar:_,inert:L}=$;return F5.createElement(F5.Fragment,null,L?F5.createElement(X,{styles:kv(q)}):null,_?F5.createElement(CH,{noRelative:$.noRelative,gapMode:$.gapMode}):null)}function Tv($){var J=null;while($!==null){if($ instanceof ShadowRoot)J=$.host,$=$.host;$=$.parentNode}return J}var BD=bH(gX,HD);var UD=mX.forwardRef(function($,J){return mX.createElement(nQ,G6({},$,{ref:J,sideCar:BD}))});UD.classNames=nQ.classNames;var T4=UD;var bv=[" ","Enter","ArrowUp","ArrowDown"],jv=[" ","Enter"],D2="Select",[dX,pX,Ev]=G7(D2),[n$,u80]=oF(D2,[Ev,d6]),lX=d6(),[yv,V7]=n$(D2),[Pv,Rv]=n$(D2),_D=($)=>{let{__scopeSelect:J,children:Q,open:Z,defaultOpen:q,onOpenChange:X,value:Y,defaultValue:z,onValueChange:K,dir:W,name:H,autoComplete:B,disabled:U,required:_,form:L}=$,F=lX(J),[V,M]=c0.useState(null),[D,N]=c0.useState(null),[O,k]=c0.useState(!1),I=p9(W),[b,A]=NH({prop:Z,defaultProp:q??!1,onChange:X,caller:D2}),[w,C]=NH({prop:Y,defaultProp:z,onChange:K,caller:D2}),y=c0.useRef(null),x=V?L||!!V.closest("form"):!0,[E,P]=c0.useState(new Set),h=Array.from(E).map((p)=>p.props.value).join(";");return G(k4,{...F,children:T(yv,{required:_,scope:J,trigger:V,onTriggerChange:M,valueNode:D,onValueNodeChange:N,valueNodeHasChildren:O,onValueNodeHasChildrenChange:k,contentId:a5(),value:w,onValueChange:C,open:b,onOpenChange:A,dir:I,triggerPointerDownPosRef:y,disabled:U,children:[G(dX.Provider,{scope:J,children:G(Pv,{scope:$.__scopeSelect,onNativeOptionAdd:c0.useCallback((p)=>{P((e)=>new Set(e).add(p))},[]),onNativeOptionRemove:c0.useCallback((p)=>{P((e)=>{let S=new Set(e);return S.delete(p),S})},[]),children:Q})}),x?T(vD,{"aria-hidden":!0,required:_,tabIndex:-1,name:H,autoComplete:B,value:w,onChange:(p)=>C(p.target.value),disabled:U,form:L,children:[w===void 0?G("option",{value:""}):null,Array.from(E)]},h):null]})})};_D.displayName=D2;var LD="SelectTrigger",FD=c0.forwardRef(($,J)=>{let{__scopeSelect:Q,disabled:Z=!1,...q}=$,X=lX(Q),Y=V7(LD,Q),z=Y.disabled||Z,K=O9(J,Y.onTriggerChange),W=pX(Q),H=c0.useRef("touch"),[B,U,_]=uD((F)=>{let V=W().filter((N)=>!N.disabled),M=V.find((N)=>N.value===Y.value),D=mD(V,F,M);if(D!==void 0)Y.onValueChange(D.value)}),L=(F)=>{if(!z)Y.onOpenChange(!0),_();if(F)Y.triggerPointerDownPosRef.current={x:Math.round(F.pageX),y:Math.round(F.pageY)}};return G(I4,{asChild:!0,...X,children:G(a8.button,{type:"button",role:"combobox","aria-controls":Y.contentId,"aria-expanded":Y.open,"aria-required":Y.required,"aria-autocomplete":"none",dir:Y.dir,"data-state":Y.open?"open":"closed",disabled:z,"data-disabled":z?"":void 0,"data-placeholder":gD(Y.value)?"":void 0,...q,ref:K,onClick:V8(q.onClick,(F)=>{if(F.currentTarget.focus(),H.current!=="mouse")L(F)}),onPointerDown:V8(q.onPointerDown,(F)=>{H.current=F.pointerType;let V=F.target;if(V.hasPointerCapture(F.pointerId))V.releasePointerCapture(F.pointerId);if(F.button===0&&F.ctrlKey===!1&&F.pointerType==="mouse")L(F),F.preventDefault()}),onKeyDown:V8(q.onKeyDown,(F)=>{let V=B.current!=="";if(!(F.ctrlKey||F.altKey||F.metaKey)&&F.key.length===1)U(F.key);if(V&&F.key===" ")return;if(bv.includes(F.key))L(),F.preventDefault()})})})});FD.displayName=LD;var VD="SelectValue",MD=c0.forwardRef(($,J)=>{let{__scopeSelect:Q,className:Z,style:q,children:X,placeholder:Y="",...z}=$,K=V7(VD,Q),{onValueNodeHasChildrenChange:W}=K,H=X!==void 0,B=O9(J,K.onValueNodeChange);return _1(()=>{W(H)},[W,H]),G(a8.span,{...z,ref:B,style:{pointerEvents:"none"},children:gD(K.value)?G(G1,{children:Y}):X})});MD.displayName=VD;var Cv="SelectIcon",DD=c0.forwardRef(($,J)=>{let{__scopeSelect:Q,children:Z,...q}=$;return G(a8.span,{"aria-hidden":!0,...q,ref:J,children:Z||"▼"})});DD.displayName=Cv;var Sv="SelectPortal",ND=($)=>{return G(I9,{asChild:!0,...$})};ND.displayName=Sv;var N2="SelectContent",OD=c0.forwardRef(($,J)=>{let Q=V7(N2,$.__scopeSelect),[Z,q]=c0.useState();if(_1(()=>{q(new DocumentFragment)},[]),!Q.open){let X=Z;return X?mH.createPortal(G(AD,{scope:$.__scopeSelect,children:G(dX.Slot,{scope:$.__scopeSelect,children:G("div",{children:$.children})})}),X):null}return G(wD,{...$,ref:J})});OD.displayName=N2;var T9=10,[AD,M7]=n$(N2),hv="SelectContentImpl",xv=yX("SelectContent.RemoveScroll"),wD=c0.forwardRef(($,J)=>{let{__scopeSelect:Q,position:Z="item-aligned",onCloseAutoFocus:q,onEscapeKeyDown:X,onPointerDownOutside:Y,side:z,sideOffset:K,align:W,alignOffset:H,arrowPadding:B,collisionBoundary:U,collisionPadding:_,sticky:L,hideWhenDetached:F,avoidCollisions:V,...M}=$,D=V7(N2,Q),[N,O]=c0.useState(null),[k,I]=c0.useState(null),b=O9(J,(m)=>O(m)),[A,w]=c0.useState(null),[C,y]=c0.useState(null),x=pX(Q),[E,P]=c0.useState(!1),h=c0.useRef(!1);c0.useEffect(()=>{if(N)return F7(N)},[N]),W7();let p=c0.useCallback((m)=>{let[s,...u]=x().map((f)=>f.ref.current),[c]=u.slice(-1),i=document.activeElement;for(let f of m){if(f===i)return;if(f?.scrollIntoView({block:"nearest"}),f===s&&k)k.scrollTop=0;if(f===c&&k)k.scrollTop=k.scrollHeight;if(f?.focus(),document.activeElement!==i)return}},[x,k]),e=c0.useCallback(()=>p([A,N]),[p,A,N]);c0.useEffect(()=>{if(E)e()},[E,e]);let{onOpenChange:S,triggerPointerDownPosRef:r}=D;c0.useEffect(()=>{if(N){let m={x:0,y:0},s=(c)=>{m={x:Math.abs(Math.round(c.pageX)-(r.current?.x??0)),y:Math.abs(Math.round(c.pageY)-(r.current?.y??0))}},u=(c)=>{if(m.x<=10&&m.y<=10)c.preventDefault();else if(!N.contains(c.target))S(!1);document.removeEventListener("pointermove",s),r.current=null};if(r.current!==null)document.addEventListener("pointermove",s),document.addEventListener("pointerup",u,{capture:!0,once:!0});return()=>{document.removeEventListener("pointermove",s),document.removeEventListener("pointerup",u,{capture:!0})}}},[N,S,r]),c0.useEffect(()=>{let m=()=>S(!1);return window.addEventListener("blur",m),window.addEventListener("resize",m),()=>{window.removeEventListener("blur",m),window.removeEventListener("resize",m)}},[S]);let[$0,K0]=uD((m)=>{let s=x().filter((i)=>!i.disabled),u=s.find((i)=>i.ref.current===document.activeElement),c=mD(s,m,u);if(c)setTimeout(()=>c.ref.current.focus())}),t=c0.useCallback((m,s,u)=>{let c=!h.current&&!u;if(D.value!==void 0&&D.value===s||c){if(w(m),c)h.current=!0}},[D.value]),H0=c0.useCallback(()=>N?.focus(),[N]),z0=c0.useCallback((m,s,u)=>{let c=!h.current&&!u;if(D.value!==void 0&&D.value===s||c)y(m)},[D.value]),j=Z==="popper"?xH:kD,d=j===xH?{side:z,sideOffset:K,align:W,alignOffset:H,arrowPadding:B,collisionBoundary:U,collisionPadding:_,sticky:L,hideWhenDetached:F,avoidCollisions:V}:{};return G(AD,{scope:Q,content:N,viewport:k,onViewportChange:I,itemRefCallback:t,selectedItem:A,onItemLeave:H0,itemTextRefCallback:z0,focusSelectedItem:e,selectedItemText:C,position:Z,isPositioned:E,searchRef:$0,children:G(T4,{as:xv,allowPinchZoom:!0,children:G(A4,{asChild:!0,trapped:D.open,onMountAutoFocus:(m)=>{m.preventDefault()},onUnmountAutoFocus:V8(q,(m)=>{D.trigger?.focus({preventScroll:!0}),m.preventDefault()}),children:G(A9,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:X,onPointerDownOutside:Y,onFocusOutside:(m)=>m.preventDefault(),onDismiss:()=>D.onOpenChange(!1),children:G(j,{role:"listbox",id:D.contentId,"data-state":D.open?"open":"closed",dir:D.dir,onContextMenu:(m)=>m.preventDefault(),...M,...d,onPlaced:()=>P(!0),ref:b,style:{display:"flex",flexDirection:"column",outline:"none",...M.style},onKeyDown:V8(M.onKeyDown,(m)=>{let s=m.ctrlKey||m.altKey||m.metaKey;if(m.key==="Tab")m.preventDefault();if(!s&&m.key.length===1)K0(m.key);if(["ArrowUp","ArrowDown","Home","End"].includes(m.key)){let c=x().filter((i)=>!i.disabled).map((i)=>i.ref.current);if(["ArrowUp","End"].includes(m.key))c=c.slice().reverse();if(["ArrowUp","ArrowDown"].includes(m.key)){let i=m.target,f=c.indexOf(i);c=c.slice(f+1)}setTimeout(()=>p(c)),m.preventDefault()}})})})})})})});wD.displayName=hv;var fv="SelectItemAlignedPosition",kD=c0.forwardRef(($,J)=>{let{__scopeSelect:Q,onPlaced:Z,...q}=$,X=V7(N2,Q),Y=M7(N2,Q),[z,K]=c0.useState(null),[W,H]=c0.useState(null),B=O9(J,(b)=>H(b)),U=pX(Q),_=c0.useRef(!1),L=c0.useRef(!0),{viewport:F,selectedItem:V,selectedItemText:M,focusSelectedItem:D}=Y,N=c0.useCallback(()=>{if(X.trigger&&X.valueNode&&z&&W&&F&&V&&M){let b=X.trigger.getBoundingClientRect(),A=W.getBoundingClientRect(),w=X.valueNode.getBoundingClientRect(),C=M.getBoundingClientRect();if(X.dir!=="rtl"){let i=C.left-A.left,f=w.left-i,o=b.left-f,G0=b.width+o,l=Math.max(G0,A.width),Z0=window.innerWidth-T9,Q0=g$(f,[T9,Math.max(T9,Z0-l)]);z.style.minWidth=G0+"px",z.style.left=Q0+"px"}else{let i=A.right-C.right,f=window.innerWidth-w.right-i,o=window.innerWidth-b.right-f,G0=b.width+o,l=Math.max(G0,A.width),Z0=window.innerWidth-T9,Q0=g$(f,[T9,Math.max(T9,Z0-l)]);z.style.minWidth=G0+"px",z.style.right=Q0+"px"}let y=U(),x=window.innerHeight-T9*2,E=F.scrollHeight,P=window.getComputedStyle(W),h=parseInt(P.borderTopWidth,10),p=parseInt(P.paddingTop,10),e=parseInt(P.borderBottomWidth,10),S=parseInt(P.paddingBottom,10),r=h+p+E+S+e,$0=Math.min(V.offsetHeight*5,r),K0=window.getComputedStyle(F),t=parseInt(K0.paddingTop,10),H0=parseInt(K0.paddingBottom,10),z0=b.top+b.height/2-T9,j=x-z0,d=V.offsetHeight/2,m=V.offsetTop+d,s=h+p+m,u=r-s;if(s<=z0){let i=y.length>0&&V===y[y.length-1].ref.current;z.style.bottom="0px";let f=W.clientHeight-F.offsetTop-F.offsetHeight,o=Math.max(j,d+(i?H0:0)+f+e),G0=s+o;z.style.height=G0+"px"}else{let i=y.length>0&&V===y[0].ref.current;z.style.top="0px";let o=Math.max(z0,h+F.offsetTop+(i?t:0)+d)+u;z.style.height=o+"px",F.scrollTop=s-z0+F.offsetTop}z.style.margin=`${T9}px 0`,z.style.minHeight=$0+"px",z.style.maxHeight=x+"px",Z?.(),requestAnimationFrame(()=>_.current=!0)}},[U,X.trigger,X.valueNode,z,W,F,V,M,X.dir,Z]);_1(()=>N(),[N]);let[O,k]=c0.useState();_1(()=>{if(W)k(window.getComputedStyle(W).zIndex)},[W]);let I=c0.useCallback((b)=>{if(b&&L.current===!0)N(),D?.(),L.current=!1},[N,D]);return G(gv,{scope:Q,contentWrapper:z,shouldExpandOnScrollRef:_,onScrollButtonChange:I,children:G("div",{ref:K,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:O},children:G(a8.div,{...q,ref:B,style:{boxSizing:"border-box",maxHeight:"100%",...q.style}})})})});kD.displayName=fv;var vv="SelectPopperPosition",xH=c0.forwardRef(($,J)=>{let{__scopeSelect:Q,align:Z="start",collisionPadding:q=T9,...X}=$,Y=lX(Q);return G(_7,{...Y,...X,ref:J,align:Z,collisionPadding:q,style:{boxSizing:"border-box",...X.style,...{"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}}})});xH.displayName=vv;var[gv,cH]=n$(N2,{}),fH="SelectViewport",ID=c0.forwardRef(($,J)=>{let{__scopeSelect:Q,nonce:Z,...q}=$,X=M7(fH,Q),Y=cH(fH,Q),z=O9(J,X.onViewportChange),K=c0.useRef(0);return T(G1,{children:[G("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:Z}),G(dX.Slot,{scope:Q,children:G(a8.div,{"data-radix-select-viewport":"",role:"presentation",...q,ref:z,style:{position:"relative",flex:1,overflow:"hidden auto",...q.style},onScroll:V8(q.onScroll,(W)=>{let H=W.currentTarget,{contentWrapper:B,shouldExpandOnScrollRef:U}=Y;if(U?.current&&B){let _=Math.abs(K.current-H.scrollTop);if(_>0){let L=window.innerHeight-T9*2,F=parseFloat(B.style.minHeight),V=parseFloat(B.style.height),M=Math.max(F,V);if(M0?O:0,B.style.justifyContent="flex-end"}}}K.current=H.scrollTop})})})]})});ID.displayName=fH;var TD="SelectGroup",[uv,mv]=n$(TD),cv=c0.forwardRef(($,J)=>{let{__scopeSelect:Q,...Z}=$,q=a5();return G(uv,{scope:Q,id:q,children:G(a8.div,{role:"group","aria-labelledby":q,...Z,ref:J})})});cv.displayName=TD;var bD="SelectLabel",jD=c0.forwardRef(($,J)=>{let{__scopeSelect:Q,...Z}=$,q=mv(bD,Q);return G(a8.div,{id:q.id,...Z,ref:J})});jD.displayName=bD;var cX="SelectItem",[dv,ED]=n$(cX),yD=c0.forwardRef(($,J)=>{let{__scopeSelect:Q,value:Z,disabled:q=!1,textValue:X,...Y}=$,z=V7(cX,Q),K=M7(cX,Q),W=z.value===Z,[H,B]=c0.useState(X??""),[U,_]=c0.useState(!1),L=O9(J,(D)=>K.itemRefCallback?.(D,Z,q)),F=a5(),V=c0.useRef("touch"),M=()=>{if(!q)z.onValueChange(Z),z.onOpenChange(!1)};if(Z==="")throw Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return G(dv,{scope:Q,value:Z,disabled:q,textId:F,isSelected:W,onItemTextChange:c0.useCallback((D)=>{B((N)=>N||(D?.textContent??"").trim())},[]),children:G(dX.ItemSlot,{scope:Q,value:Z,disabled:q,textValue:H,children:G(a8.div,{role:"option","aria-labelledby":F,"data-highlighted":U?"":void 0,"aria-selected":W&&U,"data-state":W?"checked":"unchecked","aria-disabled":q||void 0,"data-disabled":q?"":void 0,tabIndex:q?void 0:-1,...Y,ref:L,onFocus:V8(Y.onFocus,()=>_(!0)),onBlur:V8(Y.onBlur,()=>_(!1)),onClick:V8(Y.onClick,()=>{if(V.current!=="mouse")M()}),onPointerUp:V8(Y.onPointerUp,()=>{if(V.current==="mouse")M()}),onPointerDown:V8(Y.onPointerDown,(D)=>{V.current=D.pointerType}),onPointerMove:V8(Y.onPointerMove,(D)=>{if(V.current=D.pointerType,q)K.onItemLeave?.();else if(V.current==="mouse")D.currentTarget.focus({preventScroll:!0})}),onPointerLeave:V8(Y.onPointerLeave,(D)=>{if(D.currentTarget===document.activeElement)K.onItemLeave?.()}),onKeyDown:V8(Y.onKeyDown,(D)=>{if(K.searchRef?.current!==""&&D.key===" ")return;if(jv.includes(D.key))M();if(D.key===" ")D.preventDefault()})})})})});yD.displayName=cX;var tQ="SelectItemText",PD=c0.forwardRef(($,J)=>{let{__scopeSelect:Q,className:Z,style:q,...X}=$,Y=V7(tQ,Q),z=M7(tQ,Q),K=ED(tQ,Q),W=Rv(tQ,Q),[H,B]=c0.useState(null),U=O9(J,(M)=>B(M),K.onItemTextChange,(M)=>z.itemTextRefCallback?.(M,K.value,K.disabled)),_=H?.textContent,L=c0.useMemo(()=>G("option",{value:K.value,disabled:K.disabled,children:_},K.value),[K.disabled,K.value,_]),{onNativeOptionAdd:F,onNativeOptionRemove:V}=W;return _1(()=>{return F(L),()=>V(L)},[F,V,L]),T(G1,{children:[G(a8.span,{id:K.textId,...X,ref:U}),K.isSelected&&Y.valueNode&&!Y.valueNodeHasChildren?mH.createPortal(X.children,Y.valueNode):null]})});PD.displayName=tQ;var RD="SelectItemIndicator",CD=c0.forwardRef(($,J)=>{let{__scopeSelect:Q,...Z}=$;return ED(RD,Q).isSelected?G(a8.span,{"aria-hidden":!0,...Z,ref:J}):null});CD.displayName=RD;var vH="SelectScrollUpButton",SD=c0.forwardRef(($,J)=>{let Q=M7(vH,$.__scopeSelect),Z=cH(vH,$.__scopeSelect),[q,X]=c0.useState(!1),Y=O9(J,Z.onScrollButtonChange);return _1(()=>{if(Q.viewport&&Q.isPositioned){let K=function(){let H=W.scrollTop>0;X(H)};var z=K;let W=Q.viewport;return K(),W.addEventListener("scroll",K),()=>W.removeEventListener("scroll",K)}},[Q.viewport,Q.isPositioned]),q?G(xD,{...$,ref:Y,onAutoScroll:()=>{let{viewport:z,selectedItem:K}=Q;if(z&&K)z.scrollTop=z.scrollTop-K.offsetHeight}}):null});SD.displayName=vH;var gH="SelectScrollDownButton",hD=c0.forwardRef(($,J)=>{let Q=M7(gH,$.__scopeSelect),Z=cH(gH,$.__scopeSelect),[q,X]=c0.useState(!1),Y=O9(J,Z.onScrollButtonChange);return _1(()=>{if(Q.viewport&&Q.isPositioned){let K=function(){let H=W.scrollHeight-W.clientHeight,B=Math.ceil(W.scrollTop)W.removeEventListener("scroll",K)}},[Q.viewport,Q.isPositioned]),q?G(xD,{...$,ref:Y,onAutoScroll:()=>{let{viewport:z,selectedItem:K}=Q;if(z&&K)z.scrollTop=z.scrollTop+K.offsetHeight}}):null});hD.displayName=gH;var xD=c0.forwardRef(($,J)=>{let{__scopeSelect:Q,onAutoScroll:Z,...q}=$,X=M7("SelectScrollButton",Q),Y=c0.useRef(null),z=pX(Q),K=c0.useCallback(()=>{if(Y.current!==null)window.clearInterval(Y.current),Y.current=null},[]);return c0.useEffect(()=>{return()=>K()},[K]),_1(()=>{z().find((H)=>H.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[z]),G(a8.div,{"aria-hidden":!0,...q,ref:J,style:{flexShrink:0,...q.style},onPointerDown:V8(q.onPointerDown,()=>{if(Y.current===null)Y.current=window.setInterval(Z,50)}),onPointerMove:V8(q.onPointerMove,()=>{if(X.onItemLeave?.(),Y.current===null)Y.current=window.setInterval(Z,50)}),onPointerLeave:V8(q.onPointerLeave,()=>{K()})})}),pv="SelectSeparator",fD=c0.forwardRef(($,J)=>{let{__scopeSelect:Q,...Z}=$;return G(a8.div,{"aria-hidden":!0,...Z,ref:J})});fD.displayName=pv;var uH="SelectArrow",lv=c0.forwardRef(($,J)=>{let{__scopeSelect:Q,...Z}=$,q=lX(Q),X=V7(uH,Q),Y=M7(uH,Q);return X.open&&Y.position==="popper"?G(L7,{...q,...Z,ref:J}):null});lv.displayName=uH;var iv="SelectBubbleInput",vD=c0.forwardRef(({__scopeSelect:$,value:J,...Q},Z)=>{let q=c0.useRef(null),X=O9(Z,q),Y=CX(J);return c0.useEffect(()=>{let z=q.current;if(!z)return;let K=window.HTMLSelectElement.prototype,H=Object.getOwnPropertyDescriptor(K,"value").set;if(Y!==J&&H){let B=new Event("change",{bubbles:!0});H.call(z,J),z.dispatchEvent(B)}},[Y,J]),G(a8.select,{...Q,style:{...OH,...Q.style},ref:X,defaultValue:J})});vD.displayName=iv;function gD($){return $===""||$===void 0}function uD($){let J=c5($),Q=c0.useRef(""),Z=c0.useRef(0),q=c0.useCallback((Y)=>{let z=Q.current+Y;J(z),function K(W){if(Q.current=W,window.clearTimeout(Z.current),W!=="")Z.current=window.setTimeout(()=>K(""),1000)}(z)},[J]),X=c0.useCallback(()=>{Q.current="",window.clearTimeout(Z.current)},[]);return c0.useEffect(()=>{return()=>window.clearTimeout(Z.current)},[]),[Q,q,X]}function mD($,J,Q){let q=J.length>1&&Array.from(J).every((W)=>W===J[0])?J[0]:J,X=Q?$.indexOf(Q):-1,Y=rv($,Math.max(X,0));if(q.length===1)Y=Y.filter((W)=>W!==Q);let K=Y.find((W)=>W.textValue.toLowerCase().startsWith(q.toLowerCase()));return K!==Q?K:void 0}function rv($,J){return $.map((Q,Z)=>$[(J+Z)%$.length])}var dH=_D,pH=FD,cD=MD,dD=DD,pD=ND,lH=OD,lD=ID;var iH=jD,rH=yD,iD=PD,rD=CD,sH=SD,oH=hD,nH=fD;var sD=D8.createContext({open:!1,close:()=>{}}),y8=({open:$,defaultOpen:J=!1,onOpenChange:Q,...Z})=>{let[q,X]=D8.useState(J),Y=$??q,z=D8.useCallback((W)=>{if($===void 0)X(W);Q?.(W)},[$,Q]),K=D8.useMemo(()=>({open:Y,close:()=>z(!1)}),[z,Y]);return G(sD.Provider,{value:K,children:G(dH,{...Z,open:Y,onOpenChange:z})})};y8.displayName=dH.displayName;var W6=cD,P8=D8.forwardRef(({className:$,children:J,...Q},Z)=>T(pH,{ref:Z,className:b0("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-border bg-muted pl-2 py-2 text-sm text-foreground shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",$),...Q,children:[J,G(dD,{asChild:!0,children:G(b4,{className:"h-4 w-4 opacity-50"})})]}));P8.displayName=pH.displayName;var oD=D8.forwardRef(({className:$,...J},Q)=>G(sH,{ref:Q,className:b0("flex cursor-default items-center justify-center py-1",$),...J,children:G(iX,{className:"h-4 w-4"})}));oD.displayName=sH.displayName;var nD=D8.forwardRef(({className:$,...J},Q)=>G(oH,{ref:Q,className:b0("flex cursor-default items-center justify-center py-1",$),...J,children:G(b4,{className:"h-4 w-4"})}));nD.displayName=oH.displayName;var R8=D8.forwardRef(({className:$,children:J,position:Q="popper",...Z},q)=>{let X=D8.useContext(sD);return G(pD,{children:T("div",{className:`${M8}`,children:[X.open?G("div",{"aria-hidden":"true","data-easy-media-select-backdrop":"",className:"fixed inset-0 z-[9997]",onPointerDown:X.close}):null,T(lH,{ref:q,className:b0("relative z-[9999] max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",Q==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",$),position:Q,...Z,children:[G(oD,{}),G(lD,{className:b0("p-1",Q==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:J}),G(nD,{})]})]})})});R8.displayName=lH.displayName;var ov=D8.forwardRef(({className:$,...J},Q)=>G(iH,{ref:Q,className:b0("px-2 py-1.5 text-sm font-semibold",$),...J}));ov.displayName=iH.displayName;var l5=D8.forwardRef(({className:$,children:J,...Q},Z)=>T(rH,{ref:Z,className:b0("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",$),...Q,children:[G("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:G(rD,{children:G(b9,{className:"h-4 w-4"})})}),G(iD,{children:J})]}));l5.displayName=rH.displayName;var nv=D8.forwardRef(({className:$,...J},Q)=>G(nH,{ref:Q,className:b0("-mx-1 my-1 h-px bg-muted",$),...J}));nv.displayName=nH.displayName;var t8=R(v(),1);function e8({value:$,onChange:J,min:Q=0,max:Z=1/0,step:q=1,className:X,disabled:Y,commitOnBlur:z=!1,formatValue:K,"aria-label":W}){let H=t8.useRef(null),B=t8.useRef(!1),[U,_]=t8.useState(String($));t8.useEffect(()=>{if(!z)return;_(String($))},[$,z]);let L=t8.useCallback((k)=>{return Math.min(Z,Math.max(Q,k))},[Q,Z]),F=t8.useCallback((k)=>{if(k===""){J(L(0));return}let I=Number.parseFloat(k);if(!Number.isNaN(I))J(L(I))},[J,L]),V=t8.useCallback(()=>{let k=Math.min(Z,$+q);if(J(k),z)_(String(k))},[z,$,q,Z,J]),M=t8.useCallback(()=>{let k=Math.max(Q,$-q);if(J(k),z)_(String(k))},[z,$,q,Q,J]),D=t8.useCallback((k)=>{let I=k.currentTarget.value;if(z)_(I);else{if(I===""){J(0);return}let b=Number.parseFloat(I);if(!Number.isNaN(b))J(L(b))}},[z,J,L]),N=t8.useCallback(()=>{if(z&&!B.current)F(U),_(String($));B.current=!1},[z,F,U,$]),O=t8.useCallback((k)=>{if(k.key==="ArrowUp"){k.preventDefault();let I=Math.min(Z,$+q);if(J(I),z)_(String(I))}else if(k.key==="ArrowDown"){k.preventDefault();let I=Math.max(Q,$-q);if(J(I),z)_(String(I))}else if(z&&k.key==="Enter")k.preventDefault(),B.current=!0,F(U),H.current?.blur()},[z,$,q,Q,Z,J,F,U]);return T("div",{className:b0("flex h-7 items-center rounded-md border border-node-input-border bg-node-input overflow-hidden",X),children:[G("input",{type:"number",value:z?U:K?.($)??$,onChange:D,onKeyDown:O,onBlur:N,ref:H,min:Q,max:Z,step:q,disabled:Y,"aria-label":W,className:b0("w-14 h-full flex-1 bg-muted text-node-foreground text-xs text-center border-0 focus:outline-none focus:ring-0 [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none")}),T("div",{className:"flex flex-col h-full border-l ",children:[G("button",{type:"button",onClick:V,disabled:Y||$>=Z,"aria-label":"Increment",className:b0("flex-1 flex items-center justify-center px-1 hover:bg-card cursor-pointer transition-colors disabled:opacity-40 disabled:cursor-not-allowed bg-muted"),children:G(iX,{className:"size-3 text-node-foreground"})}),G("div",{className:"h-px bg-border"}),G("button",{type:"button",onClick:M,disabled:Y||$<=Q,"aria-label":"Decrement",className:b0("flex-1 flex items-center justify-center px-1 hover:bg-card cursor-pointer transition-colors disabled:opacity-40 disabled:cursor-not-allowed bg-muted"),children:G(b4,{className:"size-3 text-node-foreground"})})]})]})}var NN=R(v(),1);var z5=R(v(),1);var a80=!!(typeof window<"u"&&window.document&&window.document.createElement);function O2($,J,{checkForDefaultPrevented:Q=!0}={}){return function(q){if($?.(q),Q===!1||!q.defaultPrevented)return J?.(q)}}var tD=R(v(),1);function aD($,J){if(typeof $==="function")return $(J);else if($!==null&&$!==void 0)$.current=J}function aH(...$){return(J)=>{let Q=!1,Z=$.map((q)=>{let X=aD(q,J);if(!Q&&typeof X=="function")Q=!0;return X});if(Q)return()=>{for(let q=0;q{let{scope:U,children:_,...L}=B,F=U?.[$]?.[K]||z,V=j4.useMemo(()=>L,Object.values(L));return G(F.Provider,{value:V,children:_})};W.displayName=X+"Provider";function H(B,U){let _=U?.[$]?.[K]||z,L=j4.useContext(_);if(L)return L;if(Y!==void 0)return Y;throw Error(`\`${B}\` must be used within \`${X}\``)}return[W,H]}let q=()=>{let X=Q.map((Y)=>{return j4.createContext(Y)});return function(z){let K=z?.[$]||X;return j4.useMemo(()=>({[`__scope${$}`]:{...z,[$]:K}}),[z,K])}};return q.scopeName=$,[Z,av(q,...J)]}function av(...$){let J=$[0];if($.length===1)return J;let Q=()=>{let Z=$.map((q)=>({useScope:q(),scopeName:q.scopeName}));return function(X){let Y=Z.reduce((z,{useScope:K,scopeName:W})=>{let B=K(X)[`__scope${W}`];return{...z,...B}},{});return j4.useMemo(()=>({[`__scope${J.scopeName}`]:Y}),[Y])}};return Q.scopeName=J.scopeName,Q}var l6=R(v(),1);var rX=R(v(),1);var tv=l6[" useInsertionEffect ".trim().toString()]||_1;function $N({prop:$,defaultProp:J,onChange:Q=()=>{},caller:Z}){let[q,X,Y]=ev({defaultProp:J,onChange:Q}),z=$!==void 0,K=z?$:q;{let H=l6.useRef($!==void 0);l6.useEffect(()=>{let B=H.current;if(B!==z)console.warn(`${Z} is changing from ${B?"controlled":"uncontrolled"} to ${z?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`);H.current=z},[z,Z])}let W=l6.useCallback((H)=>{if(z){let B=$g(H)?H($):H;if(B!==$)Y.current?.(B)}else X(H)},[z,$,X,Y]);return[K,W]}function ev({defaultProp:$,onChange:J}){let[Q,Z]=l6.useState($),q=l6.useRef(Q),X=l6.useRef(J);return tv(()=>{X.current=J},[J]),l6.useEffect(()=>{if(q.current!==Q)X.current?.(Q),q.current=Q},[Q,q]),[Q,Z,X]}function $g($){return typeof $==="function"}var Z60=Symbol("RADIX:SYNC_STATE");var JN=R(v(),1);function QN($){let[J,Q]=JN.useState(void 0);return _1(()=>{if($){Q({width:$.offsetWidth,height:$.offsetHeight});let Z=new ResizeObserver((q)=>{if(!Array.isArray(q))return;if(!q.length)return;let X=q[0],Y,z;if("borderBoxSize"in X){let K=X.borderBoxSize,W=Array.isArray(K)?K[0]:K;Y=W.inlineSize,z=W.blockSize}else Y=$.offsetWidth,z=$.offsetHeight;Q({width:Y,height:z})});return Z.observe($,{box:"border-box"}),()=>Z.unobserve($)}else Q(void 0)},[$]),J}var qN=R(v(),1),Yg=R(J5(),1);var Z8=R(v(),1);function ZN($){let J=Jg($),Q=Z8.forwardRef((Z,q)=>{let{children:X,...Y}=Z,z=Z8.Children.toArray(X),K=z.find(Zg);if(K){let W=K.props.children,H=z.map((B)=>{if(B===K){if(Z8.Children.count(W)>1)return Z8.Children.only(null);return Z8.isValidElement(W)?W.props.children:null}else return B});return G(J,{...Y,ref:q,children:Z8.isValidElement(W)?Z8.cloneElement(W,void 0,H):null})}return G(J,{...Y,ref:q,children:X})});return Q.displayName=`${$}.Slot`,Q}function Jg($){let J=Z8.forwardRef((Q,Z)=>{let{children:q,...X}=Q;if(Z8.isValidElement(q)){let Y=Xg(q),z=qg(X,q.props);if(q.type!==Z8.Fragment)z.ref=Z?aH(Z,Y):Y;return Z8.cloneElement(q,z)}return Z8.Children.count(q)>1?Z8.Children.only(null):null});return J.displayName=`${$}.SlotClone`,J}var Qg=Symbol("radix.slottable");function Zg($){return Z8.isValidElement($)&&typeof $.type==="function"&&"__radixId"in $.type&&$.type.__radixId===Qg}function qg($,J){let Q={...J};for(let Z in J){let q=$[Z],X=J[Z];if(/^on[A-Z]/.test(Z)){if(q&&X)Q[Z]=(...z)=>{let K=X(...z);return q(...z),K};else if(q)Q[Z]=q}else if(Z==="style")Q[Z]={...q,...X};else if(Z==="className")Q[Z]=[q,X].filter(Boolean).join(" ")}return{...$,...Q}}function Xg($){let J=Object.getOwnPropertyDescriptor($.props,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning;if(Q)return $.ref;if(J=Object.getOwnPropertyDescriptor($,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning,Q)return $.props.ref;return $.props.ref||$.ref}var zg=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],a$=zg.reduce(($,J)=>{let Q=ZN(`Primitive.${J}`),Z=qN.forwardRef((q,X)=>{let{asChild:Y,...z}=q,K=Y?Q:J;if(typeof window<"u")window[Symbol.for("radix-ui")]=!0;return G(K,{...z,ref:X})});return Z.displayName=`Primitive.${J}`,{...$,[J]:Z}},{});var XN=["PageUp","PageDown"],YN=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],zN={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},t$="Slider",[tH,Kg,Gg]=G7(t$),[KN,k60]=eD(t$,[Gg]),[Wg,sX]=KN(t$),GN=z5.forwardRef(($,J)=>{let{name:Q,min:Z=0,max:q=100,step:X=1,orientation:Y="horizontal",disabled:z=!1,minStepsBetweenThumbs:K=0,defaultValue:W=[Z],value:H,onValueChange:B=()=>{},onValueCommit:U=()=>{},inverted:_=!1,form:L,...F}=$,V=z5.useRef(new Set),M=z5.useRef(0),N=Y==="horizontal"?Hg:Bg,[O=[],k]=$N({prop:H,defaultProp:W,onChange:(y)=>{[...V.current][M.current]?.focus(),B(y)}}),I=z5.useRef(O);function b(y){let x=Vg(O,y);C(y,x)}function A(y){C(y,M.current)}function w(){let y=I.current[M.current];if(O[M.current]!==y)U(O)}function C(y,x,{commit:E}={commit:!1}){let P=Og(X),h=Ag(Math.round((y-Z)/X)*X+Z,P),p=g$(h,[Z,q]);k((e=[])=>{let S=Lg(e,p,x);if(Ng(S,K*X)){M.current=S.indexOf(p);let r=String(S)!==String(e);if(r&&E)U(S);return r?S:e}else return e})}return G(Wg,{scope:$.__scopeSlider,name:Q,disabled:z,min:Z,max:q,valueIndexToChangeRef:M,thumbs:V.current,values:O,orientation:Y,form:L,children:G(tH.Provider,{scope:$.__scopeSlider,children:G(tH.Slot,{scope:$.__scopeSlider,children:G(N,{"aria-disabled":z,"data-disabled":z?"":void 0,...F,ref:J,onPointerDown:O2(F.onPointerDown,()=>{if(!z)I.current=O}),min:Z,max:q,inverted:_,onSlideStart:z?void 0:b,onSlideMove:z?void 0:A,onSlideEnd:z?void 0:w,onHomeKeyDown:()=>!z&&C(Z,0,{commit:!0}),onEndKeyDown:()=>!z&&C(q,O.length-1,{commit:!0}),onStepKeyDown:({event:y,direction:x})=>{if(!z){let h=XN.includes(y.key)||y.shiftKey&&YN.includes(y.key)?10:1,p=M.current,e=O[p],S=X*h*x;C(e+S,p,{commit:!0})}}})})})})});GN.displayName=t$;var[WN,HN]=KN(t$,{startEdge:"left",endEdge:"right",size:"width",direction:1}),Hg=z5.forwardRef(($,J)=>{let{min:Q,max:Z,dir:q,inverted:X,onSlideStart:Y,onSlideMove:z,onSlideEnd:K,onStepKeyDown:W,...H}=$,[B,U]=z5.useState(null),_=A2(J,(N)=>U(N)),L=z5.useRef(void 0),F=p9(q),V=F==="ltr",M=V&&!X||!V&&X;function D(N){let O=L.current||B.getBoundingClientRect(),k=[0,O.width],b=J3(k,M?[Q,Z]:[Z,Q]);return L.current=O,b(N-O.left)}return G(WN,{scope:$.__scopeSlider,startEdge:M?"left":"right",endEdge:M?"right":"left",direction:M?1:-1,size:"width",children:G(BN,{dir:F,"data-orientation":"horizontal",...H,ref:_,style:{...H.style,["--radix-slider-thumb-transform"]:"translateX(-50%)"},onSlideStart:(N)=>{let O=D(N.clientX);Y?.(O)},onSlideMove:(N)=>{let O=D(N.clientX);z?.(O)},onSlideEnd:()=>{L.current=void 0,K?.()},onStepKeyDown:(N)=>{let k=zN[M?"from-left":"from-right"].includes(N.key);W?.({event:N,direction:k?-1:1})}})})}),Bg=z5.forwardRef(($,J)=>{let{min:Q,max:Z,inverted:q,onSlideStart:X,onSlideMove:Y,onSlideEnd:z,onStepKeyDown:K,...W}=$,H=z5.useRef(null),B=A2(J,H),U=z5.useRef(void 0),_=!q;function L(F){let V=U.current||H.current.getBoundingClientRect(),M=[0,V.height],N=J3(M,_?[Z,Q]:[Q,Z]);return U.current=V,N(F-V.top)}return G(WN,{scope:$.__scopeSlider,startEdge:_?"bottom":"top",endEdge:_?"top":"bottom",size:"height",direction:_?1:-1,children:G(BN,{"data-orientation":"vertical",...W,ref:B,style:{...W.style,["--radix-slider-thumb-transform"]:"translateY(50%)"},onSlideStart:(F)=>{let V=L(F.clientY);X?.(V)},onSlideMove:(F)=>{let V=L(F.clientY);Y?.(V)},onSlideEnd:()=>{U.current=void 0,z?.()},onStepKeyDown:(F)=>{let M=zN[_?"from-bottom":"from-top"].includes(F.key);K?.({event:F,direction:M?-1:1})}})})}),BN=z5.forwardRef(($,J)=>{let{__scopeSlider:Q,onSlideStart:Z,onSlideMove:q,onSlideEnd:X,onHomeKeyDown:Y,onEndKeyDown:z,onStepKeyDown:K,...W}=$,H=sX(t$,Q);return G(a$.span,{...W,ref:J,onKeyDown:O2($.onKeyDown,(B)=>{if(B.key==="Home")Y(B),B.preventDefault();else if(B.key==="End")z(B),B.preventDefault();else if(XN.concat(YN).includes(B.key))K(B),B.preventDefault()}),onPointerDown:O2($.onPointerDown,(B)=>{let U=B.target;if(U.setPointerCapture(B.pointerId),B.preventDefault(),H.thumbs.has(U))U.focus();else Z(B)}),onPointerMove:O2($.onPointerMove,(B)=>{if(B.target.hasPointerCapture(B.pointerId))q(B)}),onPointerUp:O2($.onPointerUp,(B)=>{let U=B.target;if(U.hasPointerCapture(B.pointerId))U.releasePointerCapture(B.pointerId),X(B)})})}),UN="SliderTrack",_N=z5.forwardRef(($,J)=>{let{__scopeSlider:Q,...Z}=$,q=sX(UN,Q);return G(a$.span,{"data-disabled":q.disabled?"":void 0,"data-orientation":q.orientation,...Z,ref:J})});_N.displayName=UN;var eH="SliderRange",LN=z5.forwardRef(($,J)=>{let{__scopeSlider:Q,...Z}=$,q=sX(eH,Q),X=HN(eH,Q),Y=z5.useRef(null),z=A2(J,Y),K=q.values.length,W=q.values.map((U)=>MN(U,q.min,q.max)),H=K>1?Math.min(...W):0,B=100-Math.max(...W);return G(a$.span,{"data-orientation":q.orientation,"data-disabled":q.disabled?"":void 0,...Z,ref:z,style:{...$.style,[X.startEdge]:H+"%",[X.endEdge]:B+"%"}})});LN.displayName=eH;var $3="SliderThumb",FN=z5.forwardRef(($,J)=>{let Q=Kg($.__scopeSlider),[Z,q]=z5.useState(null),X=A2(J,(z)=>q(z)),Y=z5.useMemo(()=>Z?Q().findIndex((z)=>z.ref.current===Z):-1,[Q,Z]);return G(Ug,{...$,ref:X,index:Y})}),Ug=z5.forwardRef(($,J)=>{let{__scopeSlider:Q,index:Z,name:q,...X}=$,Y=sX($3,Q),z=HN($3,Q),[K,W]=z5.useState(null),H=A2(J,(D)=>W(D)),B=K?Y.form||!!K.closest("form"):!0,U=QN(K),_=Y.values[Z],L=_===void 0?0:MN(_,Y.min,Y.max),F=Fg(Z,Y.values.length),V=U?.[z.size],M=V?Mg(V,L,z.direction):0;return z5.useEffect(()=>{if(K)return Y.thumbs.add(K),()=>{Y.thumbs.delete(K)}},[K,Y.thumbs]),T("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[z.startEdge]:`calc(${L}% + ${M}px)`},children:[G(tH.ItemSlot,{scope:$.__scopeSlider,children:G(a$.span,{role:"slider","aria-label":$["aria-label"]||F,"aria-valuemin":Y.min,"aria-valuenow":_,"aria-valuemax":Y.max,"aria-orientation":Y.orientation,"data-orientation":Y.orientation,"data-disabled":Y.disabled?"":void 0,tabIndex:Y.disabled?void 0:0,...X,ref:H,style:_===void 0?{display:"none"}:$.style,onFocus:O2($.onFocus,()=>{Y.valueIndexToChangeRef.current=Z})})}),B&&G(VN,{name:q??(Y.name?Y.name+(Y.values.length>1?"[]":""):void 0),form:Y.form,value:_},Z)]})});FN.displayName=$3;var _g="RadioBubbleInput",VN=z5.forwardRef(({__scopeSlider:$,value:J,...Q},Z)=>{let q=z5.useRef(null),X=A2(q,Z),Y=CX(J);return z5.useEffect(()=>{let z=q.current;if(!z)return;let K=window.HTMLInputElement.prototype,H=Object.getOwnPropertyDescriptor(K,"value").set;if(Y!==J&&H){let B=new Event("input",{bubbles:!0});H.call(z,J),z.dispatchEvent(B)}},[Y,J]),G(a$.input,{style:{display:"none"},...Q,ref:X,defaultValue:J})});VN.displayName=_g;function Lg($=[],J,Q){let Z=[...$];return Z[Q]=J,Z.sort((q,X)=>q-X)}function MN($,J,Q){let X=100/(Q-J)*($-J);return g$(X,[0,100])}function Fg($,J){if(J>2)return`Value ${$+1} of ${J}`;else if(J===2)return["Minimum","Maximum"][$];else return}function Vg($,J){if($.length===1)return 0;let Q=$.map((q)=>Math.abs(q-J)),Z=Math.min(...Q);return Q.indexOf(Z)}function Mg($,J,Q){let Z=$/2,q=50,X=J3([0,50],[0,Z]);return(Z-X(J)*Q)*Q}function Dg($){return $.slice(0,-1).map((J,Q)=>$[Q+1]-J)}function Ng($,J){if(J>0){let Q=Dg($);return Math.min(...Q)>=J}return!0}function J3($,J){return(Q)=>{if($[0]===$[1]||J[0]===J[1])return J[0];let Z=(J[1]-J[0])/($[1]-$[0]);return J[0]+Z*(Q-$[0])}}function Og($){return(String($).split(".")[1]||"").length}function Ag($,J){let Q=Math.pow(10,J);return Math.round($*Q)/Q}var eQ=GN,oX=_N,nX=LN,aX=FN;var N8=NN.forwardRef(({className:$,"aria-label":J,"aria-labelledby":Q,ticks:Z,...q},X)=>{let Y=q.value?.[0]??q.defaultValue?.[0];return G("div",{className:b0("relative",Z&&Z.length>0&&"pb-4"),children:T(eQ,{ref:X,className:b0("relative flex w-full touch-none select-none items-center",$),"aria-label":J,"aria-labelledby":Q,...q,children:[G(oX,{className:"relative h-1.5 w-full grow overflow-hidden rounded-full bg-muted",children:G(nX,{className:"absolute h-full bg-primary"})}),G(aX,{"aria-label":J,"aria-labelledby":Q,className:"block h-3 w-3 rounded-full border border-primary/50 bg-primary shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"}),Z&&Z.length>0&&G("div",{className:"absolute left-0 top-full flex w-full justify-between",children:Z.map((z)=>{let K=z.value===Y;return T("div",{className:"flex flex-col items-center gap-0.5",children:[G("div",{className:b0("h-1.5 w-px bg-muted-foreground/40",K&&"bg-primary")}),G("span",{className:b0("text-[10px] tabular-nums leading-none text-muted-foreground",K&&"font-medium text-foreground"),children:z.label})]},z.value)})})]})})});N8.displayName=eQ.displayName;var cN=R(v(),1);var A1=R(v(),1);var j60=!!(typeof window<"u"&&window.document&&window.document.createElement);function w2($,J,{checkForDefaultPrevented:Q=!0}={}){return function(q){if($?.(q),Q===!1||!q.defaultPrevented)return J?.(q)}}var AN=R(v(),1);function ON($,J){if(typeof $==="function")return $(J);else if($!==null&&$!==void 0)$.current=J}function Q3(...$){return(J)=>{let Q=!1,Z=$.map((q)=>{let X=ON(q,J);if(!Q&&typeof X=="function")Q=!0;return X});if(Q)return()=>{for(let q=0;q{let{scope:U,children:_,...L}=B,F=U?.[$]?.[K]||z,V=E4.useMemo(()=>L,Object.values(L));return G(F.Provider,{value:V,children:_})};W.displayName=X+"Provider";function H(B,U){let _=U?.[$]?.[K]||z,L=E4.useContext(_);if(L)return L;if(Y!==void 0)return Y;throw Error(`\`${B}\` must be used within \`${X}\``)}return[W,H]}let q=()=>{let X=Q.map((Y)=>{return E4.createContext(Y)});return function(z){let K=z?.[$]||X;return E4.useMemo(()=>({[`__scope${$}`]:{...z,[$]:K}}),[z,K])}};return q.scopeName=$,[Z,wg(q,...J)]}function wg(...$){let J=$[0];if($.length===1)return J;let Q=()=>{let Z=$.map((q)=>({useScope:q(),scopeName:q.scopeName}));return function(X){let Y=Z.reduce((z,{useScope:K,scopeName:W})=>{let B=K(X)[`__scope${W}`];return{...z,...B}},{});return E4.useMemo(()=>({[`__scope${J.scopeName}`]:Y}),[Y])}};return Q.scopeName=J.scopeName,Q}var H6=R(v(),1);var kN=R(v(),1);function kg($,J){return kN.useReducer((Q,Z)=>{return J[Q][Z]??Q},$)}var eX=($)=>{let{present:J,children:Q}=$,Z=Ig(J),q=typeof Q==="function"?Q({present:Z.isPresent}):H6.Children.only(Q),X=$Z(Z.ref,Tg(q));return typeof Q==="function"||Z.isPresent?H6.cloneElement(q,{ref:X}):null};eX.displayName="Presence";function Ig($){let[J,Q]=H6.useState(),Z=H6.useRef(null),q=H6.useRef($),X=H6.useRef("none"),Y=$?"mounted":"unmounted",[z,K]=kg(Y,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return H6.useEffect(()=>{let W=tX(Z.current);X.current=z==="mounted"?W:"none"},[z]),_1(()=>{let W=Z.current,H=q.current;if(H!==$){let U=X.current,_=tX(W);if($)K("MOUNT");else if(_==="none"||W?.display==="none")K("UNMOUNT");else if(H&&U!==_)K("ANIMATION_OUT");else K("UNMOUNT");q.current=$}},[$,K]),_1(()=>{if(J){let W,H=J.ownerDocument.defaultView??window,B=(_)=>{let F=tX(Z.current).includes(CSS.escape(_.animationName));if(_.target===J&&F){if(K("ANIMATION_END"),!q.current){let V=J.style.animationFillMode;J.style.animationFillMode="forwards",W=H.setTimeout(()=>{if(J.style.animationFillMode==="forwards")J.style.animationFillMode=V})}}},U=(_)=>{if(_.target===J)X.current=tX(Z.current)};return J.addEventListener("animationstart",U),J.addEventListener("animationcancel",B),J.addEventListener("animationend",B),()=>{H.clearTimeout(W),J.removeEventListener("animationstart",U),J.removeEventListener("animationcancel",B),J.removeEventListener("animationend",B)}}else K("ANIMATION_END")},[J,K]),{isPresent:["mounted","unmountSuspended"].includes(z),ref:H6.useCallback((W)=>{Z.current=W?getComputedStyle(W):null,Q(W)},[])}}function tX($){return $?.animationName||"none"}function Tg($){let J=Object.getOwnPropertyDescriptor($.props,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning;if(Q)return $.ref;if(J=Object.getOwnPropertyDescriptor($,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning,Q)return $.props.ref;return $.props.ref||$.ref}var jN=R(v(),1),Pg=R(J5(),1);var q8=R(v(),1);function IN($){let J=bg($),Q=q8.forwardRef((Z,q)=>{let{children:X,...Y}=Z,z=q8.Children.toArray(X),K=z.find(jg);if(K){let W=K.props.children,H=z.map((B)=>{if(B===K){if(q8.Children.count(W)>1)return q8.Children.only(null);return q8.isValidElement(W)?W.props.children:null}else return B});return G(J,{...Y,ref:q,children:q8.isValidElement(W)?q8.cloneElement(W,void 0,H):null})}return G(J,{...Y,ref:q,children:X})});return Q.displayName=`${$}.Slot`,Q}function bg($){let J=q8.forwardRef((Q,Z)=>{let{children:q,...X}=Q;if(q8.isValidElement(q)){let Y=yg(q),z=Eg(X,q.props);if(q.type!==q8.Fragment)z.ref=Z?Q3(Z,Y):Y;return q8.cloneElement(q,z)}return q8.Children.count(q)>1?q8.Children.only(null):null});return J.displayName=`${$}.SlotClone`,J}var TN=Symbol("radix.slottable");function bN($){let J=({children:Q})=>{return G(G1,{children:Q})};return J.displayName=`${$}.Slottable`,J.__radixId=TN,J}function jg($){return q8.isValidElement($)&&typeof $.type==="function"&&"__radixId"in $.type&&$.type.__radixId===TN}function Eg($,J){let Q={...J};for(let Z in J){let q=$[Z],X=J[Z];if(/^on[A-Z]/.test(Z)){if(q&&X)Q[Z]=(...z)=>{let K=X(...z);return q(...z),K};else if(q)Q[Z]=q}else if(Z==="style")Q[Z]={...q,...X};else if(Z==="className")Q[Z]=[q,X].filter(Boolean).join(" ")}return{...$,...Q}}function yg($){let J=Object.getOwnPropertyDescriptor($.props,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning;if(Q)return $.ref;if(J=Object.getOwnPropertyDescriptor($,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning,Q)return $.props.ref;return $.props.ref||$.ref}var Rg=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],EN=Rg.reduce(($,J)=>{let Q=IN(`Primitive.${J}`),Z=jN.forwardRef((q,X)=>{let{asChild:Y,...z}=q,K=Y?Q:J;if(typeof window<"u")window[Symbol.for("radix-ui")]=!0;return G(K,{...z,ref:X})});return Z.displayName=`Primitive.${J}`,{...$,[J]:Z}},{});var i6=R(v(),1);var $Y=R(v(),1);var Cg=i6[" useInsertionEffect ".trim().toString()]||_1;function yN({prop:$,defaultProp:J,onChange:Q=()=>{},caller:Z}){let[q,X,Y]=Sg({defaultProp:J,onChange:Q}),z=$!==void 0,K=z?$:q;{let H=i6.useRef($!==void 0);i6.useEffect(()=>{let B=H.current;if(B!==z)console.warn(`${Z} is changing from ${B?"controlled":"uncontrolled"} to ${z?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`);H.current=z},[z,Z])}let W=i6.useCallback((H)=>{if(z){let B=hg(H)?H($):H;if(B!==$)Y.current?.(B)}else X(H)},[z,$,X,Y]);return[K,W]}function Sg({defaultProp:$,onChange:J}){let[Q,Z]=i6.useState($),q=i6.useRef(Q),X=i6.useRef(J);return Cg(()=>{X.current=J},[J]),i6.useEffect(()=>{if(q.current!==Q)X.current?.(Q),q.current=Q},[Q,q]),[Q,Z,X]}function hg($){return typeof $==="function"}var d60=Symbol("RADIX:SYNC_STATE");var[JY,Z90]=wN("Tooltip",[d6]),QY=d6(),PN="TooltipProvider",xg=700,Z3="tooltip.open",[fg,X3]=JY(PN),RN=($)=>{let{__scopeTooltip:J,delayDuration:Q=xg,skipDelayDuration:Z=300,disableHoverableContent:q=!1,children:X}=$,Y=A1.useRef(!0),z=A1.useRef(!1),K=A1.useRef(0);return A1.useEffect(()=>{let W=K.current;return()=>window.clearTimeout(W)},[]),G(fg,{scope:J,isOpenDelayedRef:Y,delayDuration:Q,onOpen:A1.useCallback(()=>{window.clearTimeout(K.current),Y.current=!1},[]),onClose:A1.useCallback(()=>{window.clearTimeout(K.current),K.current=window.setTimeout(()=>Y.current=!0,Z)},[Z]),isPointerInTransitRef:z,onPointerInTransitChange:A1.useCallback((W)=>{z.current=W},[]),disableHoverableContent:q,children:X})};RN.displayName=PN;var JZ="Tooltip",[vg,QZ]=JY(JZ),CN=($)=>{let{__scopeTooltip:J,children:Q,open:Z,defaultOpen:q,onOpenChange:X,disableHoverableContent:Y,delayDuration:z}=$,K=X3(JZ,$.__scopeTooltip),W=QY(J),[H,B]=A1.useState(null),U=a5(),_=A1.useRef(0),L=Y??K.disableHoverableContent,F=z??K.delayDuration,V=A1.useRef(!1),[M,D]=yN({prop:Z,defaultProp:q??!1,onChange:(b)=>{if(b)K.onOpen(),document.dispatchEvent(new CustomEvent(Z3));else K.onClose();X?.(b)},caller:JZ}),N=A1.useMemo(()=>{return M?V.current?"delayed-open":"instant-open":"closed"},[M]),O=A1.useCallback(()=>{window.clearTimeout(_.current),_.current=0,V.current=!1,D(!0)},[D]),k=A1.useCallback(()=>{window.clearTimeout(_.current),_.current=0,D(!1)},[D]),I=A1.useCallback(()=>{window.clearTimeout(_.current),_.current=window.setTimeout(()=>{V.current=!0,D(!0),_.current=0},F)},[F,D]);return A1.useEffect(()=>{return()=>{if(_.current)window.clearTimeout(_.current),_.current=0}},[]),G(k4,{...W,children:G(vg,{scope:J,contentId:U,open:M,stateAttribute:N,trigger:H,onTriggerChange:B,onTriggerEnter:A1.useCallback(()=>{if(K.isOpenDelayedRef.current)I();else O()},[K.isOpenDelayedRef,I,O]),onTriggerLeave:A1.useCallback(()=>{if(L)k();else window.clearTimeout(_.current),_.current=0},[k,L]),onOpen:O,onClose:k,disableHoverableContent:L,children:Q})})};CN.displayName=JZ;var q3="TooltipTrigger",SN=A1.forwardRef(($,J)=>{let{__scopeTooltip:Q,...Z}=$,q=QZ(q3,Q),X=X3(q3,Q),Y=QY(Q),z=A1.useRef(null),K=$Z(J,z,q.onTriggerChange),W=A1.useRef(!1),H=A1.useRef(!1),B=A1.useCallback(()=>W.current=!1,[]);return A1.useEffect(()=>{return()=>document.removeEventListener("pointerup",B)},[B]),G(I4,{asChild:!0,...Y,children:G(EN.button,{"aria-describedby":q.open?q.contentId:void 0,"data-state":q.stateAttribute,...Z,ref:K,onPointerMove:w2($.onPointerMove,(U)=>{if(U.pointerType==="touch")return;if(!H.current&&!X.isPointerInTransitRef.current)q.onTriggerEnter(),H.current=!0}),onPointerLeave:w2($.onPointerLeave,()=>{q.onTriggerLeave(),H.current=!1}),onPointerDown:w2($.onPointerDown,()=>{if(q.open)q.onClose();W.current=!0,document.addEventListener("pointerup",B,{once:!0})}),onFocus:w2($.onFocus,()=>{if(!W.current)q.onOpen()}),onBlur:w2($.onBlur,q.onClose),onClick:w2($.onClick,q.onClose)})})});SN.displayName=q3;var Y3="TooltipPortal",[gg,ug]=JY(Y3,{forceMount:void 0}),hN=($)=>{let{__scopeTooltip:J,forceMount:Q,children:Z,container:q}=$,X=QZ(Y3,J);return G(gg,{scope:J,forceMount:Q,children:G(eX,{present:Q||X.open,children:G(I9,{asChild:!0,container:q,children:Z})})})};hN.displayName=Y3;var e$="TooltipContent",xN=A1.forwardRef(($,J)=>{let Q=ug(e$,$.__scopeTooltip),{forceMount:Z=Q.forceMount,side:q="top",...X}=$,Y=QZ(e$,$.__scopeTooltip);return G(eX,{present:Z||Y.open,children:Y.disableHoverableContent?G(fN,{side:q,...X,ref:J}):G(mg,{side:q,...X,ref:J})})}),mg=A1.forwardRef(($,J)=>{let Q=QZ(e$,$.__scopeTooltip),Z=X3(e$,$.__scopeTooltip),q=A1.useRef(null),X=$Z(J,q),[Y,z]=A1.useState(null),{trigger:K,onClose:W}=Q,H=q.current,{onPointerInTransitChange:B}=Z,U=A1.useCallback(()=>{z(null),B(!1)},[B]),_=A1.useCallback((L,F)=>{let V=L.currentTarget,M={x:L.clientX,y:L.clientY},D=ig(M,V.getBoundingClientRect()),N=rg(M,D),O=sg(F.getBoundingClientRect()),k=ng([...N,...O]);z(k),B(!0)},[B]);return A1.useEffect(()=>{return()=>U()},[U]),A1.useEffect(()=>{if(K&&H){let L=(V)=>_(V,H),F=(V)=>_(V,K);return K.addEventListener("pointerleave",L),H.addEventListener("pointerleave",F),()=>{K.removeEventListener("pointerleave",L),H.removeEventListener("pointerleave",F)}}},[K,H,_,U]),A1.useEffect(()=>{if(Y){let L=(F)=>{let V=F.target,M={x:F.clientX,y:F.clientY},D=K?.contains(V)||H?.contains(V),N=!og(M,Y);if(D)U();else if(N)U(),W()};return document.addEventListener("pointermove",L),()=>document.removeEventListener("pointermove",L)}},[K,H,Y,W,U]),G(fN,{...$,ref:X})}),[cg,dg]=JY(JZ,{isInside:!1}),pg=bN("TooltipContent"),fN=A1.forwardRef(($,J)=>{let{__scopeTooltip:Q,children:Z,"aria-label":q,onEscapeKeyDown:X,onPointerDownOutside:Y,...z}=$,K=QZ(e$,Q),W=QY(Q),{onClose:H}=K;return A1.useEffect(()=>{return document.addEventListener(Z3,H),()=>document.removeEventListener(Z3,H)},[H]),A1.useEffect(()=>{if(K.trigger){let B=(U)=>{if(U.target?.contains(K.trigger))H()};return window.addEventListener("scroll",B,{capture:!0}),()=>window.removeEventListener("scroll",B,{capture:!0})}},[K.trigger,H]),G(A9,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:X,onPointerDownOutside:Y,onFocusOutside:(B)=>B.preventDefault(),onDismiss:H,children:T(_7,{"data-state":K.stateAttribute,...W,...z,ref:J,style:{...z.style,...{"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"}},children:[G(pg,{children:Z}),G(cg,{scope:Q,isInside:!0,children:G(rM,{id:K.contentId,role:"tooltip",children:q||Z})})]})})});xN.displayName=e$;var vN="TooltipArrow",lg=A1.forwardRef(($,J)=>{let{__scopeTooltip:Q,...Z}=$,q=QY(Q);return dg(vN,Q).isInside?null:G(L7,{...q,...Z,ref:J})});lg.displayName=vN;function ig($,J){let Q=Math.abs(J.top-$.y),Z=Math.abs(J.bottom-$.y),q=Math.abs(J.right-$.x),X=Math.abs(J.left-$.x);switch(Math.min(Q,Z,q,X)){case X:return"left";case q:return"right";case Q:return"top";case Z:return"bottom";default:throw Error("unreachable")}}function rg($,J,Q=5){let Z=[];switch(J){case"top":Z.push({x:$.x-Q,y:$.y+Q},{x:$.x+Q,y:$.y+Q});break;case"bottom":Z.push({x:$.x-Q,y:$.y-Q},{x:$.x+Q,y:$.y-Q});break;case"left":Z.push({x:$.x+Q,y:$.y-Q},{x:$.x+Q,y:$.y+Q});break;case"right":Z.push({x:$.x-Q,y:$.y-Q},{x:$.x-Q,y:$.y+Q});break}return Z}function sg($){let{top:J,right:Q,bottom:Z,left:q}=$;return[{x:q,y:J},{x:Q,y:J},{x:Q,y:Z},{x:q,y:Z}]}function og($,J){let{x:Q,y:Z}=$,q=!1;for(let X=0,Y=J.length-1;XZ!==U>Z&&Q<(B-W)*(Z-H)/(U-H)+W)q=!q}return q}function ng($){let J=$.slice();return J.sort((Q,Z)=>{if(Q.xZ.x)return 1;else if(Q.yZ.y)return 1;else return 0}),ag(J)}function ag($){if($.length<=1)return $.slice();let J=[];for(let Z=0;Z<$.length;Z++){let q=$[Z];while(J.length>=2){let X=J[J.length-1],Y=J[J.length-2];if((X.x-Y.x)*(q.y-Y.y)>=(X.y-Y.y)*(q.x-Y.x))J.pop();else break}J.push(q)}J.pop();let Q=[];for(let Z=$.length-1;Z>=0;Z--){let q=$[Z];while(Q.length>=2){let X=Q[Q.length-1],Y=Q[Q.length-2];if((X.x-Y.x)*(q.y-Y.y)>=(X.y-Y.y)*(q.x-Y.x))Q.pop();else break}Q.push(q)}if(Q.pop(),J.length===1&&Q.length===1&&J[0].x===Q[0].x&&J[0].y===Q[0].y)return J;else return J.concat(Q)}var z3=RN,gN=CN,uN=SN,mN=hN,K3=xN;var n1=({disableHoverableContent:$=!0,...J})=>G(z3,{disableHoverableContent:$,...J});n1.displayName=z3.displayName;var H1=gN,B1=uN,W1=cN.forwardRef(({className:$,sideOffset:J=4,...Q},Z)=>G(mN,{children:G("div",{className:`${M8}`,children:G(K3,{ref:Z,sideOffset:J,className:b0("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",$),...Q})})}));W1.displayName=K3.displayName;function eg($,J){let Q=ZZ(Math.max($,1),Math.max(J,1));if(Q<=10)return{max:2,step:0.05};if(Q<=30)return{max:3,step:0.05};if(Q<=60)return{max:4,step:0.1};if(Q<=120)return{max:6,step:0.1};if(Q<=300)return{max:8,step:0.2};return{max:10,step:0.25}}function lN({totalLength:$,frameRate:J,displayFormat:Q,onTotalLengthChange:Z,onFrameRateChange:q,onDisplayFormatChange:X,isPlaying:Y,onPlayPause:z,hasSelection:K,canDelete:W=K,onDeleteSelected:H,zoom:B,onZoomChange:U,selectedSegment:_,onSelectedSegmentDurationChange:L}){let F=q1(),V=eg($,J);pN.useEffect(()=>{if(B>V.max)U(V.max)},[B,V.max,U]);let M=_?_.end_frame-_.start_frame+1:0,D;if(_)D=Q==="seconds"?Math.round(ZZ(M,J)*100)/100:M;else D=Q==="seconds"?Math.round(ZZ($,J)*100)/100:$;function N(k){if(k<=0)return;let I=Q==="seconds"?dN(k,J):Math.round(k);if(Q==="seconds"){let b=_?_.end_frame-_.start_frame+1:$;if(I===b){let A=ZZ(b,J);if(kA)I=b+4;else return}}if(_){let b=_.end_frame-_.start_frame+1;if(I-b===0)return;L(_.id,I)}else Z(I)}function O(k){if(k>0)q(Math.round(k))}return T("div",{className:"flex justify-between items-center gap-2 py-1 border-b border-border text-xs shrink-0",children:[T("div",{className:"flex items-center gap-0.5",children:[T(H1,{children:[G(B1,{asChild:!0,children:G(k0,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:z,"aria-label":Y?F("toolbar.pause"):F("toolbar.play"),children:Y?G(D7,{className:"w-2 h-2"}):G(y4,{className:"w-2 h-2"})})}),G(W1,{side:"bottom",children:Y?F("toolbar.pause"):F("toolbar.play")})]}),T(H1,{children:[G(B1,{asChild:!0,children:G(k0,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:H,disabled:!W,"aria-label":F("toolbar.deleteSegment"),children:G(D5,{className:"w-2 h-2"})})}),G(W1,{side:"bottom",children:F("toolbar.deleteSegment")})]})]}),T("div",{className:"flex items-center gap-2","data-time-toolbar":!0,children:[T("div",{className:"flex items-center gap-1",children:[G(e8,{value:D,onChange:N,min:1,max:2000,step:Q==="seconds"?1:4,commitOnBlur:!0,className:"h-6 w-18"}),T(y8,{value:Q,onValueChange:(k)=>X(k),children:[G(P8,{className:"h-6 w-10 text-xs",children:(Q==="frames"?F("toolbar.frames"):F("toolbar.seconds")).substring(0,1)}),T(R8,{children:[G(l5,{value:"frames",children:F("toolbar.frames")}),G(l5,{value:"seconds",children:F("toolbar.seconds")})]})]})]}),T("div",{className:"flex items-center gap-1",children:[G(e8,{value:J,onChange:O,min:1,max:60,step:1,commitOnBlur:!0,className:"h-6 w-14"}),G("span",{className:"text-muted-foreground",children:F("toolbar.fps")})]})]}),G("div",{className:"flex items-center gap-1 pr-1",children:T("div",{className:"flex items-center gap-1",children:[T(H1,{children:[G(B1,{asChild:!0,children:G($J,{className:"w-4 h-4 text-muted-foreground shrink-0"})}),G(W1,{side:"bottom",children:F("toolbar.zoom")})]}),G(N8,{min:1,max:V.max,step:V.step,value:[Math.min(B,V.max)],onValueChange:([k])=>U(k),className:"w-12 h-3","aria-label":F("toolbar.zoom")})]})})]})}var JJ=R(v(),1);function $u($,J,Q,Z){if(Z==="seconds"){let z=($-1)/Q/J,K=[0.1,0.25,0.5,1,2,5,10,15,30,60,120,300],W=K.reduce((H,B)=>Math.abs(B-z)Math.abs(z-q){return()=>{W.current=!1}},[]);function H(F){return Math.max(0,Math.min($-1,Math.round(F/Z*($-1))))}function B(F){if(!z)return;F.preventDefault(),W.current=!0;let V=F.currentTarget.getBoundingClientRect(),M=(F.clientX-V.left)/q;z(H(M));function D(O){if(!W.current)return;let k=(O.clientX-V.left)/q;z(H(k))}function N(){W.current=!1,globalThis.removeEventListener("mousemove",D),globalThis.removeEventListener("mouseup",N)}globalThis.addEventListener("mousemove",D),globalThis.addEventListener("mouseup",N)}let U=X===void 0?void 0:X/Math.max($-1,1)*Z,_=JJ.useMemo(()=>{let F=Math.max(5,Math.floor(Z/60)),V=$u($,F,J,Q),M=[];for(let N=0;N<$;N+=V){let O=Q==="seconds"?`${Math.max(0,N/J).toFixed(1)}s`:`${N}f`;M.push({frame:N,label:O,major:!0})}let D=$-1;if(!M.some((N)=>N.frame===D)){let N=Q==="seconds"?`${Math.max(0,D/J).toFixed(1)}s`:`${D}f`;M.push({frame:D,label:N,major:!1})}return M},[$,J,Q,Z]);function L(F){return F/Math.max($-1,1)*Z}return T("div",{role:"slider","aria-label":"Playhead position","aria-valuenow":X??0,"aria-valuemin":0,"aria-valuemax":$-1,tabIndex:z?0:-1,className:"relative h-6 shrink-0 select-none border-b border-border overflow-hidden cursor-col-resize",style:{width:Z},onMouseDown:B,onWheel:K,onKeyDown:(F)=>{if(!z)return;let V=F.shiftKey?10:1;if(F.key==="ArrowLeft")z(Math.max(0,(X??0)-V));else if(F.key==="ArrowRight")z(Math.min($-1,(X??0)+V))},children:[_.map(({frame:F,label:V,major:M})=>T("div",{className:"absolute top-0 flex flex-col items-start pointer-events-none",style:{left:L(F)},children:[G("div",{className:`w-px ${M?"h-2 bg-border":"h-1.5 bg-border"}`}),M&&G("span",{className:"text-[9px] text-muted-foreground/70 whitespace-nowrap translate-x-1",children:V})]},F)),U!==void 0&&G("div",{className:"absolute top-0 h-full w-px bg-red-400 pointer-events-none z-10",style:{left:U},children:G("div",{className:"absolute top-0 -translate-x-1/2 w-0 h-0 pointer-events-none",style:{borderLeft:"4px solid transparent",borderRight:"4px solid transparent",borderTop:"6px solid rgb(248 113 113)"}})}),Y&&U!==void 0&&G("div",{className:"absolute top-0 -translate-x-1/2 z-20 pointer-events-none",style:{left:U,top:"-2px"},children:G("div",{className:"bg-red-400 text-white text-[8px] font-medium px-1.5 py-0.5 rounded whitespace-nowrap shadow",children:Q==="seconds"?`${Math.max(0,(X??0)/J).toFixed(1)}s`:`${X??0}f`})})]})}var c4=R(v(),1);var S4=R(v(),1);var B5=R(v(),1);var N90=!!(typeof window<"u"&&window.document&&window.document.createElement);function QJ($,J,{checkForDefaultPrevented:Q=!0}={}){return function(q){if($?.(q),Q===!1||!q.defaultPrevented)return J?.(q)}}var P4=R(v(),1);function iN($,J=[]){let Q=[];function Z(X,Y){let z=P4.createContext(Y),K=Q.length;Q=[...Q,Y];let W=(B)=>{let{scope:U,children:_,...L}=B,F=U?.[$]?.[K]||z,V=P4.useMemo(()=>L,Object.values(L));return G(F.Provider,{value:V,children:_})};W.displayName=X+"Provider";function H(B,U){let _=U?.[$]?.[K]||z,L=P4.useContext(_);if(L)return L;if(Y!==void 0)return Y;throw Error(`\`${B}\` must be used within \`${X}\``)}return[W,H]}let q=()=>{let X=Q.map((Y)=>{return P4.createContext(Y)});return function(z){let K=z?.[$]||X;return P4.useMemo(()=>({[`__scope${$}`]:{...z,[$]:K}}),[z,K])}};return q.scopeName=$,[Z,Ju(q,...J)]}function Ju(...$){let J=$[0];if($.length===1)return J;let Q=()=>{let Z=$.map((q)=>({useScope:q(),scopeName:q.scopeName}));return function(X){let Y=Z.reduce((z,{useScope:K,scopeName:W})=>{let B=K(X)[`__scope${W}`];return{...z,...B}},{});return P4.useMemo(()=>({[`__scope${J.scopeName}`]:Y}),[Y])}};return Q.scopeName=J.scopeName,Q}var nN=R(v(),1),Ku=R(J5(),1);var X8=R(v(),1);var Qu=R(v(),1);function rN($,J){if(typeof $==="function")return $(J);else if($!==null&&$!==void 0)$.current=J}function sN(...$){return(J)=>{let Q=!1,Z=$.map((q)=>{let X=rN(q,J);if(!Q&&typeof X=="function")Q=!0;return X});if(Q)return()=>{for(let q=0;q{let{children:X,...Y}=Z,z=X8.Children.toArray(X),K=z.find(Xu);if(K){let W=K.props.children,H=z.map((B)=>{if(B===K){if(X8.Children.count(W)>1)return X8.Children.only(null);return X8.isValidElement(W)?W.props.children:null}else return B});return G(J,{...Y,ref:q,children:X8.isValidElement(W)?X8.cloneElement(W,void 0,H):null})}return G(J,{...Y,ref:q,children:X})});return Q.displayName=`${$}.Slot`,Q}function Zu($){let J=X8.forwardRef((Q,Z)=>{let{children:q,...X}=Q;if(X8.isValidElement(q)){let Y=zu(q),z=Yu(X,q.props);if(q.type!==X8.Fragment)z.ref=Z?sN(Z,Y):Y;return X8.cloneElement(q,z)}return X8.Children.count(q)>1?X8.Children.only(null):null});return J.displayName=`${$}.SlotClone`,J}var qu=Symbol("radix.slottable");function Xu($){return X8.isValidElement($)&&typeof $.type==="function"&&"__radixId"in $.type&&$.type.__radixId===qu}function Yu($,J){let Q={...J};for(let Z in J){let q=$[Z],X=J[Z];if(/^on[A-Z]/.test(Z)){if(q&&X)Q[Z]=(...z)=>{let K=X(...z);return q(...z),K};else if(q)Q[Z]=q}else if(Z==="style")Q[Z]={...q,...X};else if(Z==="className")Q[Z]=[q,X].filter(Boolean).join(" ")}return{...$,...Q}}function zu($){let J=Object.getOwnPropertyDescriptor($.props,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning;if(Q)return $.ref;if(J=Object.getOwnPropertyDescriptor($,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning,Q)return $.props.ref;return $.props.ref||$.ref}var Gu=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],aN=Gu.reduce(($,J)=>{let Q=oN(`Primitive.${J}`),Z=nN.forwardRef((q,X)=>{let{asChild:Y,...z}=q,K=Y?Q:J;if(typeof window<"u")window[Symbol.for("radix-ui")]=!0;return G(K,{...z,ref:X})});return Z.displayName=`Primitive.${J}`,{...$,[J]:Z}},{});var X1=R(v(),1);var P90=!!(typeof window<"u"&&window.document&&window.document.createElement);function P5($,J,{checkForDefaultPrevented:Q=!0}={}){return function(q){if($?.(q),Q===!1||!q.defaultPrevented)return J?.(q)}}var eN=R(v(),1);function tN($,J){if(typeof $==="function")return $(J);else if($!==null&&$!==void 0)$.current=J}function qZ(...$){return(J)=>{let Q=!1,Z=$.map((q)=>{let X=tN(q,J);if(!Q&&typeof X=="function")Q=!0;return X});if(Q)return()=>{for(let q=0;q{let{scope:U,children:_,...L}=B,F=U?.[$]?.[K]||z,V=R4.useMemo(()=>L,Object.values(L));return G(F.Provider,{value:V,children:_})};W.displayName=X+"Provider";function H(B,U){let _=U?.[$]?.[K]||z,L=R4.useContext(_);if(L)return L;if(Y!==void 0)return Y;throw Error(`\`${B}\` must be used within \`${X}\``)}return[W,H]}let q=()=>{let X=Q.map((Y)=>{return R4.createContext(Y)});return function(z){let K=z?.[$]||X;return R4.useMemo(()=>({[`__scope${$}`]:{...z,[$]:K}}),[z,K])}};return q.scopeName=$,[Z,Wu(q,...J)]}function Wu(...$){let J=$[0];if($.length===1)return J;let Q=()=>{let Z=$.map((q)=>({useScope:q(),scopeName:q.scopeName}));return function(X){let Y=Z.reduce((z,{useScope:K,scopeName:W})=>{let B=K(X)[`__scope${W}`];return{...z,...B}},{});return R4.useMemo(()=>({[`__scope${J.scopeName}`]:Y}),[Y])}};return Q.scopeName=J.scopeName,Q}var B6=R(v(),1);var JO=R(v(),1);function Hu($,J){return JO.useReducer((Q,Z)=>{return J[Q][Z]??Q},$)}var ZJ=($)=>{let{present:J,children:Q}=$,Z=Bu(J),q=typeof Q==="function"?Q({present:Z.isPresent}):B6.Children.only(Q),X=N7(Z.ref,Uu(q));return typeof Q==="function"||Z.isPresent?B6.cloneElement(q,{ref:X}):null};ZJ.displayName="Presence";function Bu($){let[J,Q]=B6.useState(),Z=B6.useRef(null),q=B6.useRef($),X=B6.useRef("none"),Y=$?"mounted":"unmounted",[z,K]=Hu(Y,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return B6.useEffect(()=>{let W=qY(Z.current);X.current=z==="mounted"?W:"none"},[z]),_1(()=>{let W=Z.current,H=q.current;if(H!==$){let U=X.current,_=qY(W);if($)K("MOUNT");else if(_==="none"||W?.display==="none")K("UNMOUNT");else if(H&&U!==_)K("ANIMATION_OUT");else K("UNMOUNT");q.current=$}},[$,K]),_1(()=>{if(J){let W,H=J.ownerDocument.defaultView??window,B=(_)=>{let F=qY(Z.current).includes(CSS.escape(_.animationName));if(_.target===J&&F){if(K("ANIMATION_END"),!q.current){let V=J.style.animationFillMode;J.style.animationFillMode="forwards",W=H.setTimeout(()=>{if(J.style.animationFillMode==="forwards")J.style.animationFillMode=V})}}},U=(_)=>{if(_.target===J)X.current=qY(Z.current)};return J.addEventListener("animationstart",U),J.addEventListener("animationcancel",B),J.addEventListener("animationend",B),()=>{H.clearTimeout(W),J.removeEventListener("animationstart",U),J.removeEventListener("animationcancel",B),J.removeEventListener("animationend",B)}}else K("ANIMATION_END")},[J,K]),{isPresent:["mounted","unmountSuspended"].includes(z),ref:B6.useCallback((W)=>{Z.current=W?getComputedStyle(W):null,Q(W)},[])}}function qY($){return $?.animationName||"none"}function Uu($){let J=Object.getOwnPropertyDescriptor($.props,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning;if(Q)return $.ref;if(J=Object.getOwnPropertyDescriptor($,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning,Q)return $.props.ref;return $.props.ref||$.ref}var QO=R(v(),1),ZO=R(J5(),1);var Y8=R(v(),1);function XY($){let J=_u($),Q=Y8.forwardRef((Z,q)=>{let{children:X,...Y}=Z,z=Y8.Children.toArray(X),K=z.find(Fu);if(K){let W=K.props.children,H=z.map((B)=>{if(B===K){if(Y8.Children.count(W)>1)return Y8.Children.only(null);return Y8.isValidElement(W)?W.props.children:null}else return B});return G(J,{...Y,ref:q,children:Y8.isValidElement(W)?Y8.cloneElement(W,void 0,H):null})}return G(J,{...Y,ref:q,children:X})});return Q.displayName=`${$}.Slot`,Q}function _u($){let J=Y8.forwardRef((Q,Z)=>{let{children:q,...X}=Q;if(Y8.isValidElement(q)){let Y=Mu(q),z=Vu(X,q.props);if(q.type!==Y8.Fragment)z.ref=Z?qZ(Z,Y):Y;return Y8.cloneElement(q,z)}return Y8.Children.count(q)>1?Y8.Children.only(null):null});return J.displayName=`${$}.SlotClone`,J}var Lu=Symbol("radix.slottable");function Fu($){return Y8.isValidElement($)&&typeof $.type==="function"&&"__radixId"in $.type&&$.type.__radixId===Lu}function Vu($,J){let Q={...J};for(let Z in J){let q=$[Z],X=J[Z];if(/^on[A-Z]/.test(Z)){if(q&&X)Q[Z]=(...z)=>{let K=X(...z);return q(...z),K};else if(q)Q[Z]=q}else if(Z==="style")Q[Z]={...q,...X};else if(Z==="className")Q[Z]=[q,X].filter(Boolean).join(" ")}return{...$,...Q}}function Mu($){let J=Object.getOwnPropertyDescriptor($.props,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning;if(Q)return $.ref;if(J=Object.getOwnPropertyDescriptor($,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning,Q)return $.props.ref;return $.props.ref||$.ref}var Du=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],qJ=Du.reduce(($,J)=>{let Q=XY(`Primitive.${J}`),Z=QO.forwardRef((q,X)=>{let{asChild:Y,...z}=q,K=Y?Q:J;if(typeof window<"u")window[Symbol.for("radix-ui")]=!0;return G(K,{...z,ref:X})});return Z.displayName=`Primitive.${J}`,{...$,[J]:Z}},{});function qO($,J){if($)ZO.flushSync(()=>$.dispatchEvent(J))}var O8=R(v(),1);var l90=!!(typeof window<"u"&&window.document&&window.document.createElement);function k2($,J,{checkForDefaultPrevented:Q=!0}={}){return function(q){if($?.(q),Q===!1||!q.defaultPrevented)return J?.(q)}}var YO=R(v(),1);function XO($,J){if(typeof $==="function")return $(J);else if($!==null&&$!==void 0)$.current=J}function G3(...$){return(J)=>{let Q=!1,Z=$.map((q)=>{let X=XO(q,J);if(!Q&&typeof X=="function")Q=!0;return X});if(Q)return()=>{for(let q=0;q{let{scope:U,children:_,...L}=B,F=U?.[$]?.[K]||z,V=C4.useMemo(()=>L,Object.values(L));return G(F.Provider,{value:V,children:_})};W.displayName=X+"Provider";function H(B,U){let _=U?.[$]?.[K]||z,L=C4.useContext(_);if(L)return L;if(Y!==void 0)return Y;throw Error(`\`${B}\` must be used within \`${X}\``)}return[W,H]}let q=()=>{let X=Q.map((Y)=>{return C4.createContext(Y)});return function(z){let K=z?.[$]||X;return C4.useMemo(()=>({[`__scope${$}`]:{...z,[$]:K}}),[z,K])}};return q.scopeName=$,[Z,Nu(q,...J)]}function Nu(...$){let J=$[0];if($.length===1)return J;let Q=()=>{let Z=$.map((q)=>({useScope:q(),scopeName:q.scopeName}));return function(X){let Y=Z.reduce((z,{useScope:K,scopeName:W})=>{let B=K(X)[`__scope${W}`];return{...z,...B}},{});return C4.useMemo(()=>({[`__scope${J.scopeName}`]:Y}),[Y])}};return Q.scopeName=J.scopeName,Q}var WO=R(v(),1),Tu=R(J5(),1);var z8=R(v(),1);function GO($){let J=Ou($),Q=z8.forwardRef((Z,q)=>{let{children:X,...Y}=Z,z=z8.Children.toArray(X),K=z.find(wu);if(K){let W=K.props.children,H=z.map((B)=>{if(B===K){if(z8.Children.count(W)>1)return z8.Children.only(null);return z8.isValidElement(W)?W.props.children:null}else return B});return G(J,{...Y,ref:q,children:z8.isValidElement(W)?z8.cloneElement(W,void 0,H):null})}return G(J,{...Y,ref:q,children:X})});return Q.displayName=`${$}.Slot`,Q}function Ou($){let J=z8.forwardRef((Q,Z)=>{let{children:q,...X}=Q;if(z8.isValidElement(q)){let Y=Iu(q),z=ku(X,q.props);if(q.type!==z8.Fragment)z.ref=Z?G3(Z,Y):Y;return z8.cloneElement(q,z)}return z8.Children.count(q)>1?z8.Children.only(null):null});return J.displayName=`${$}.SlotClone`,J}var Au=Symbol("radix.slottable");function wu($){return z8.isValidElement($)&&typeof $.type==="function"&&"__radixId"in $.type&&$.type.__radixId===Au}function ku($,J){let Q={...J};for(let Z in J){let q=$[Z],X=J[Z];if(/^on[A-Z]/.test(Z)){if(q&&X)Q[Z]=(...z)=>{let K=X(...z);return q(...z),K};else if(q)Q[Z]=q}else if(Z==="style")Q[Z]={...q,...X};else if(Z==="className")Q[Z]=[q,X].filter(Boolean).join(" ")}return{...$,...Q}}function Iu($){let J=Object.getOwnPropertyDescriptor($.props,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning;if(Q)return $.ref;if(J=Object.getOwnPropertyDescriptor($,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning,Q)return $.props.ref;return $.props.ref||$.ref}var bu=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],W3=bu.reduce(($,J)=>{let Q=GO(`Primitive.${J}`),Z=WO.forwardRef((q,X)=>{let{asChild:Y,...z}=q,K=Y?Q:J;if(typeof window<"u")window[Symbol.for("radix-ui")]=!0;return G(K,{...z,ref:X})});return Z.displayName=`Primitive.${J}`,{...$,[J]:Z}},{});var r6=R(v(),1);var YY=R(v(),1);var ju=r6[" useInsertionEffect ".trim().toString()]||_1;function HO({prop:$,defaultProp:J,onChange:Q=()=>{},caller:Z}){let[q,X,Y]=Eu({defaultProp:J,onChange:Q}),z=$!==void 0,K=z?$:q;{let H=r6.useRef($!==void 0);r6.useEffect(()=>{let B=H.current;if(B!==z)console.warn(`${Z} is changing from ${B?"controlled":"uncontrolled"} to ${z?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`);H.current=z},[z,Z])}let W=r6.useCallback((H)=>{if(z){let B=yu(H)?H($):H;if(B!==$)Y.current?.(B)}else X(H)},[z,$,X,Y]);return[K,W]}function Eu({defaultProp:$,onChange:J}){let[Q,Z]=r6.useState($),q=r6.useRef(Q),X=r6.useRef(J);return ju(()=>{X.current=J},[J]),r6.useEffect(()=>{if(q.current!==Q)X.current?.(Q),q.current=Q},[Q,q]),[Q,Z,X]}function yu($){return typeof $==="function"}var Z40=Symbol("RADIX:SYNC_STATE");var H3="rovingFocusGroup.onEntryFocus",Pu={bubbles:!1,cancelable:!0},XZ="RovingFocusGroup",[B3,BO,Ru]=G7(XZ),[Cu,XJ]=KO(XZ,[Ru]),[Su,hu]=Cu(XZ),UO=O8.forwardRef(($,J)=>{return G(B3.Provider,{scope:$.__scopeRovingFocusGroup,children:G(B3.Slot,{scope:$.__scopeRovingFocusGroup,children:G(xu,{...$,ref:J})})})});UO.displayName=XZ;var xu=O8.forwardRef(($,J)=>{let{__scopeRovingFocusGroup:Q,orientation:Z,loop:q=!1,dir:X,currentTabStopId:Y,defaultCurrentTabStopId:z,onCurrentTabStopIdChange:K,onEntryFocus:W,preventScrollOnEntryFocus:H=!1,...B}=$,U=O8.useRef(null),_=zO(J,U),L=p9(X),[F,V]=HO({prop:Y,defaultProp:z??null,onChange:K,caller:XZ}),[M,D]=O8.useState(!1),N=c5(W),O=BO(Q),k=O8.useRef(!1),[I,b]=O8.useState(0);return O8.useEffect(()=>{let A=U.current;if(A)return A.addEventListener(H3,N),()=>A.removeEventListener(H3,N)},[N]),G(Su,{scope:Q,orientation:Z,dir:L,loop:q,currentTabStopId:F,onItemFocus:O8.useCallback((A)=>V(A),[V]),onItemShiftTab:O8.useCallback(()=>D(!0),[]),onFocusableItemAdd:O8.useCallback(()=>b((A)=>A+1),[]),onFocusableItemRemove:O8.useCallback(()=>b((A)=>A-1),[]),children:G(W3.div,{tabIndex:M||I===0?-1:0,"data-orientation":Z,...B,ref:_,style:{outline:"none",...$.style},onMouseDown:k2($.onMouseDown,()=>{k.current=!0}),onFocus:k2($.onFocus,(A)=>{let w=!k.current;if(A.target===A.currentTarget&&w&&!M){let C=new CustomEvent(H3,Pu);if(A.currentTarget.dispatchEvent(C),!C.defaultPrevented){let y=O().filter((p)=>p.focusable),x=y.find((p)=>p.active),E=y.find((p)=>p.id===F),h=[x,E,...y].filter(Boolean).map((p)=>p.ref.current);FO(h,H)}}k.current=!1}),onBlur:k2($.onBlur,()=>D(!1))})})}),_O="RovingFocusGroupItem",LO=O8.forwardRef(($,J)=>{let{__scopeRovingFocusGroup:Q,focusable:Z=!0,active:q=!1,tabStopId:X,children:Y,...z}=$,K=a5(),W=X||K,H=hu(_O,Q),B=H.currentTabStopId===W,U=BO(Q),{onFocusableItemAdd:_,onFocusableItemRemove:L,currentTabStopId:F}=H;return O8.useEffect(()=>{if(Z)return _(),()=>L()},[Z,_,L]),G(B3.ItemSlot,{scope:Q,id:W,focusable:Z,active:q,children:G(W3.span,{tabIndex:B?0:-1,"data-orientation":H.orientation,...z,ref:J,onMouseDown:k2($.onMouseDown,(V)=>{if(!Z)V.preventDefault();else H.onItemFocus(W)}),onFocus:k2($.onFocus,()=>H.onItemFocus(W)),onKeyDown:k2($.onKeyDown,(V)=>{if(V.key==="Tab"&&V.shiftKey){H.onItemShiftTab();return}if(V.target!==V.currentTarget)return;let M=gu(V,H.orientation,H.dir);if(M!==void 0){if(V.metaKey||V.ctrlKey||V.altKey||V.shiftKey)return;V.preventDefault();let N=U().filter((O)=>O.focusable).map((O)=>O.ref.current);if(M==="last")N.reverse();else if(M==="prev"||M==="next"){if(M==="prev")N.reverse();let O=N.indexOf(V.currentTarget);N=H.loop?uu(N,O+1):N.slice(O+1)}setTimeout(()=>FO(N))}}),children:typeof Y==="function"?Y({isCurrentTabStop:B,hasTabStop:F!=null}):Y})})});LO.displayName=_O;var fu={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function vu($,J){if(J!=="rtl")return $;return $==="ArrowLeft"?"ArrowRight":$==="ArrowRight"?"ArrowLeft":$}function gu($,J,Q){let Z=vu($.key,Q);if(J==="vertical"&&["ArrowLeft","ArrowRight"].includes(Z))return;if(J==="horizontal"&&["ArrowUp","ArrowDown"].includes(Z))return;return fu[Z]}function FO($,J=!1){let Q=document.activeElement;for(let Z of $){if(Z===Q)return;if(Z.focus({preventScroll:J}),document.activeElement!==Q)return}}function uu($,J){return $.map((Q,Z)=>$[(J+Z)%$.length])}var zY=UO,KY=LO;var U3=["Enter"," "],mu=["ArrowDown","PageUp","Home"],DO=["ArrowUp","PageDown","End"],cu=[...mu,...DO],du={ltr:[...U3,"ArrowRight"],rtl:[...U3,"ArrowLeft"]},pu={ltr:["ArrowLeft"],rtl:["ArrowRight"]},GZ="Menu",[zZ,lu,iu]=G7(GZ),[I2,_3]=$O(GZ,[iu,d6,XJ]),WZ=d6(),NO=XJ(),[OO,O7]=I2(GZ),[ru,HZ]=I2(GZ),AO=($)=>{let{__scopeMenu:J,open:Q=!1,children:Z,dir:q,onOpenChange:X,modal:Y=!0}=$,z=WZ(J),[K,W]=X1.useState(null),H=X1.useRef(!1),B=c5(X),U=p9(q);return X1.useEffect(()=>{let _=()=>{H.current=!0,document.addEventListener("pointerdown",L,{capture:!0,once:!0}),document.addEventListener("pointermove",L,{capture:!0,once:!0})},L=()=>H.current=!1;return document.addEventListener("keydown",_,{capture:!0}),()=>{document.removeEventListener("keydown",_,{capture:!0}),document.removeEventListener("pointerdown",L,{capture:!0}),document.removeEventListener("pointermove",L,{capture:!0})}},[]),G(k4,{...z,children:G(OO,{scope:J,open:Q,onOpenChange:B,content:K,onContentChange:W,children:G(ru,{scope:J,onClose:X1.useCallback(()=>B(!1),[B]),isUsingKeyboardRef:H,dir:U,modal:Y,children:Z})})})};AO.displayName=GZ;var su="MenuAnchor",L3=X1.forwardRef(($,J)=>{let{__scopeMenu:Q,...Z}=$,q=WZ(Q);return G(I4,{...q,...Z,ref:J})});L3.displayName=su;var F3="MenuPortal",[ou,wO]=I2(F3,{forceMount:void 0}),kO=($)=>{let{__scopeMenu:J,forceMount:Q,children:Z,container:q}=$,X=O7(F3,J);return G(ou,{scope:J,forceMount:Q,children:G(ZJ,{present:Q||X.open,children:G(I9,{asChild:!0,container:q,children:Z})})})};kO.displayName=F3;var s6="MenuContent",[nu,V3]=I2(s6),IO=X1.forwardRef(($,J)=>{let Q=wO(s6,$.__scopeMenu),{forceMount:Z=Q.forceMount,...q}=$,X=O7(s6,$.__scopeMenu),Y=HZ(s6,$.__scopeMenu);return G(zZ.Provider,{scope:$.__scopeMenu,children:G(ZJ,{present:Z||X.open,children:G(zZ.Slot,{scope:$.__scopeMenu,children:Y.modal?G(au,{...q,ref:J}):G(tu,{...q,ref:J})})})})}),au=X1.forwardRef(($,J)=>{let Q=O7(s6,$.__scopeMenu),Z=X1.useRef(null),q=N7(J,Z);return X1.useEffect(()=>{let X=Z.current;if(X)return F7(X)},[]),G(M3,{...$,ref:q,trapFocus:Q.open,disableOutsidePointerEvents:Q.open,disableOutsideScroll:!0,onFocusOutside:P5($.onFocusOutside,(X)=>X.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>Q.onOpenChange(!1)})}),tu=X1.forwardRef(($,J)=>{let Q=O7(s6,$.__scopeMenu);return G(M3,{...$,ref:J,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>Q.onOpenChange(!1)})}),eu=XY("MenuContent.ScrollLock"),M3=X1.forwardRef(($,J)=>{let{__scopeMenu:Q,loop:Z=!1,trapFocus:q,onOpenAutoFocus:X,onCloseAutoFocus:Y,disableOutsidePointerEvents:z,onEntryFocus:K,onEscapeKeyDown:W,onPointerDownOutside:H,onFocusOutside:B,onInteractOutside:U,onDismiss:_,disableOutsideScroll:L,...F}=$,V=O7(s6,Q),M=HZ(s6,Q),D=WZ(Q),N=NO(Q),O=lu(Q),[k,I]=X1.useState(null),b=X1.useRef(null),A=N7(J,b,V.onContentChange),w=X1.useRef(0),C=X1.useRef(""),y=X1.useRef(0),x=X1.useRef(null),E=X1.useRef("right"),P=X1.useRef(0),h=L?T4:X1.Fragment,p=L?{as:eu,allowPinchZoom:!0}:void 0,e=(r)=>{let $0=C.current+r,K0=O().filter((m)=>!m.disabled),t=document.activeElement,H0=K0.find((m)=>m.ref.current===t)?.textValue,z0=K0.map((m)=>m.textValue),j=Hm(z0,$0,H0),d=K0.find((m)=>m.textValue===j)?.ref.current;if(function m(s){if(C.current=s,window.clearTimeout(w.current),s!=="")w.current=window.setTimeout(()=>m(""),1000)}($0),d)setTimeout(()=>d.focus())};X1.useEffect(()=>{return()=>window.clearTimeout(w.current)},[]),W7();let S=X1.useCallback((r)=>{return E.current===x.current?.side&&Um(r,x.current?.area)},[]);return G(nu,{scope:Q,searchRef:C,onItemEnter:X1.useCallback((r)=>{if(S(r))r.preventDefault()},[S]),onItemLeave:X1.useCallback((r)=>{if(S(r))return;b.current?.focus(),I(null)},[S]),onTriggerLeave:X1.useCallback((r)=>{if(S(r))r.preventDefault()},[S]),pointerGraceTimerRef:y,onPointerGraceIntentChange:X1.useCallback((r)=>{x.current=r},[]),children:G(h,{...p,children:G(A4,{asChild:!0,trapped:q,onMountAutoFocus:P5(X,(r)=>{r.preventDefault(),b.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:Y,children:G(A9,{asChild:!0,disableOutsidePointerEvents:z,onEscapeKeyDown:W,onPointerDownOutside:H,onFocusOutside:B,onInteractOutside:U,onDismiss:_,children:G(zY,{asChild:!0,...N,dir:M.dir,orientation:"vertical",loop:Z,currentTabStopId:k,onCurrentTabStopIdChange:I,onEntryFocus:P5(K,(r)=>{if(!M.isUsingKeyboardRef.current)r.preventDefault()}),preventScrollOnEntryFocus:!0,children:G(_7,{role:"menu","aria-orientation":"vertical","data-state":cO(V.open),"data-radix-menu-content":"",dir:M.dir,...D,...F,ref:A,style:{outline:"none",...F.style},onKeyDown:P5(F.onKeyDown,(r)=>{let K0=r.target.closest("[data-radix-menu-content]")===r.currentTarget,t=r.ctrlKey||r.altKey||r.metaKey,H0=r.key.length===1;if(K0){if(r.key==="Tab")r.preventDefault();if(!t&&H0)e(r.key)}let z0=b.current;if(r.target!==z0)return;if(!cu.includes(r.key))return;r.preventDefault();let d=O().filter((m)=>!m.disabled).map((m)=>m.ref.current);if(DO.includes(r.key))d.reverse();Gm(d)}),onBlur:P5($.onBlur,(r)=>{if(!r.currentTarget.contains(r.target))window.clearTimeout(w.current),C.current=""}),onPointerMove:P5($.onPointerMove,KZ((r)=>{let $0=r.target,K0=P.current!==r.clientX;if(r.currentTarget.contains($0)&&K0){let t=r.clientX>P.current?"right":"left";E.current=t,P.current=r.clientX}}))})})})})})})});IO.displayName=s6;var $m="MenuGroup",D3=X1.forwardRef(($,J)=>{let{__scopeMenu:Q,...Z}=$;return G(qJ.div,{role:"group",...Z,ref:J})});D3.displayName=$m;var Jm="MenuLabel",TO=X1.forwardRef(($,J)=>{let{__scopeMenu:Q,...Z}=$;return G(qJ.div,{...Z,ref:J})});TO.displayName=Jm;var GY="MenuItem",MO="menu.itemSelect",HY=X1.forwardRef(($,J)=>{let{disabled:Q=!1,onSelect:Z,...q}=$,X=X1.useRef(null),Y=HZ(GY,$.__scopeMenu),z=V3(GY,$.__scopeMenu),K=N7(J,X),W=X1.useRef(!1),H=()=>{let B=X.current;if(!Q&&B){let U=new CustomEvent(MO,{bubbles:!0,cancelable:!0});if(B.addEventListener(MO,(_)=>Z?.(_),{once:!0}),qO(B,U),U.defaultPrevented)W.current=!1;else Y.onClose()}};return G(bO,{...q,ref:K,disabled:Q,onClick:P5($.onClick,H),onPointerDown:(B)=>{$.onPointerDown?.(B),W.current=!0},onPointerUp:P5($.onPointerUp,(B)=>{if(!W.current)B.currentTarget?.click()}),onKeyDown:P5($.onKeyDown,(B)=>{let U=z.searchRef.current!=="";if(Q||U&&B.key===" ")return;if(U3.includes(B.key))B.currentTarget.click(),B.preventDefault()})})});HY.displayName=GY;var bO=X1.forwardRef(($,J)=>{let{__scopeMenu:Q,disabled:Z=!1,textValue:q,...X}=$,Y=V3(GY,Q),z=NO(Q),K=X1.useRef(null),W=N7(J,K),[H,B]=X1.useState(!1),[U,_]=X1.useState("");return X1.useEffect(()=>{let L=K.current;if(L)_((L.textContent??"").trim())},[X.children]),G(zZ.ItemSlot,{scope:Q,disabled:Z,textValue:q??U,children:G(KY,{asChild:!0,...z,focusable:!Z,children:G(qJ.div,{role:"menuitem","data-highlighted":H?"":void 0,"aria-disabled":Z||void 0,"data-disabled":Z?"":void 0,...X,ref:W,onPointerMove:P5($.onPointerMove,KZ((L)=>{if(Z)Y.onItemLeave(L);else if(Y.onItemEnter(L),!L.defaultPrevented)L.currentTarget.focus({preventScroll:!0})})),onPointerLeave:P5($.onPointerLeave,KZ((L)=>Y.onItemLeave(L))),onFocus:P5($.onFocus,()=>B(!0)),onBlur:P5($.onBlur,()=>B(!1))})})})}),Qm="MenuCheckboxItem",jO=X1.forwardRef(($,J)=>{let{checked:Q=!1,onCheckedChange:Z,...q}=$;return G(CO,{scope:$.__scopeMenu,checked:Q,children:G(HY,{role:"menuitemcheckbox","aria-checked":WY(Q)?"mixed":Q,...q,ref:J,"data-state":A3(Q),onSelect:P5(q.onSelect,()=>Z?.(WY(Q)?!0:!Q),{checkForDefaultPrevented:!1})})})});jO.displayName=Qm;var EO="MenuRadioGroup",[Zm,qm]=I2(EO,{value:void 0,onValueChange:()=>{}}),yO=X1.forwardRef(($,J)=>{let{value:Q,onValueChange:Z,...q}=$,X=c5(Z);return G(Zm,{scope:$.__scopeMenu,value:Q,onValueChange:X,children:G(D3,{...q,ref:J})})});yO.displayName=EO;var PO="MenuRadioItem",RO=X1.forwardRef(($,J)=>{let{value:Q,...Z}=$,q=qm(PO,$.__scopeMenu),X=Q===q.value;return G(CO,{scope:$.__scopeMenu,checked:X,children:G(HY,{role:"menuitemradio","aria-checked":X,...Z,ref:J,"data-state":A3(X),onSelect:P5(Z.onSelect,()=>q.onValueChange?.(Q),{checkForDefaultPrevented:!1})})})});RO.displayName=PO;var N3="MenuItemIndicator",[CO,Xm]=I2(N3,{checked:!1}),SO=X1.forwardRef(($,J)=>{let{__scopeMenu:Q,forceMount:Z,...q}=$,X=Xm(N3,Q);return G(ZJ,{present:Z||WY(X.checked)||X.checked===!0,children:G(qJ.span,{...q,ref:J,"data-state":A3(X.checked)})})});SO.displayName=N3;var Ym="MenuSeparator",hO=X1.forwardRef(($,J)=>{let{__scopeMenu:Q,...Z}=$;return G(qJ.div,{role:"separator","aria-orientation":"horizontal",...Z,ref:J})});hO.displayName=Ym;var zm="MenuArrow",xO=X1.forwardRef(($,J)=>{let{__scopeMenu:Q,...Z}=$,q=WZ(Q);return G(L7,{...q,...Z,ref:J})});xO.displayName=zm;var O3="MenuSub",[Km,fO]=I2(O3),vO=($)=>{let{__scopeMenu:J,children:Q,open:Z=!1,onOpenChange:q}=$,X=O7(O3,J),Y=WZ(J),[z,K]=X1.useState(null),[W,H]=X1.useState(null),B=c5(q);return X1.useEffect(()=>{if(X.open===!1)B(!1);return()=>B(!1)},[X.open,B]),G(k4,{...Y,children:G(OO,{scope:J,open:Z,onOpenChange:B,content:W,onContentChange:H,children:G(Km,{scope:J,contentId:a5(),triggerId:a5(),trigger:z,onTriggerChange:K,children:Q})})})};vO.displayName=O3;var YZ="MenuSubTrigger",gO=X1.forwardRef(($,J)=>{let Q=O7(YZ,$.__scopeMenu),Z=HZ(YZ,$.__scopeMenu),q=fO(YZ,$.__scopeMenu),X=V3(YZ,$.__scopeMenu),Y=X1.useRef(null),{pointerGraceTimerRef:z,onPointerGraceIntentChange:K}=X,W={__scopeMenu:$.__scopeMenu},H=X1.useCallback(()=>{if(Y.current)window.clearTimeout(Y.current);Y.current=null},[]);return X1.useEffect(()=>H,[H]),X1.useEffect(()=>{let B=z.current;return()=>{window.clearTimeout(B),K(null)}},[z,K]),G(L3,{asChild:!0,...W,children:G(bO,{id:q.triggerId,"aria-haspopup":"menu","aria-expanded":Q.open,"aria-controls":q.contentId,"data-state":cO(Q.open),...$,ref:qZ(J,q.onTriggerChange),onClick:(B)=>{if($.onClick?.(B),$.disabled||B.defaultPrevented)return;if(B.currentTarget.focus(),!Q.open)Q.onOpenChange(!0)},onPointerMove:P5($.onPointerMove,KZ((B)=>{if(X.onItemEnter(B),B.defaultPrevented)return;if(!$.disabled&&!Q.open&&!Y.current)X.onPointerGraceIntentChange(null),Y.current=window.setTimeout(()=>{Q.onOpenChange(!0),H()},100)})),onPointerLeave:P5($.onPointerLeave,KZ((B)=>{H();let U=Q.content?.getBoundingClientRect();if(U){let _=Q.content?.dataset.side,L=_==="right",F=L?-5:5,V=U[L?"left":"right"],M=U[L?"right":"left"];X.onPointerGraceIntentChange({area:[{x:B.clientX+F,y:B.clientY},{x:V,y:U.top},{x:M,y:U.top},{x:M,y:U.bottom},{x:V,y:U.bottom}],side:_}),window.clearTimeout(z.current),z.current=window.setTimeout(()=>X.onPointerGraceIntentChange(null),300)}else{if(X.onTriggerLeave(B),B.defaultPrevented)return;X.onPointerGraceIntentChange(null)}})),onKeyDown:P5($.onKeyDown,(B)=>{let U=X.searchRef.current!=="";if($.disabled||U&&B.key===" ")return;if(du[Z.dir].includes(B.key))Q.onOpenChange(!0),Q.content?.focus(),B.preventDefault()})})})});gO.displayName=YZ;var uO="MenuSubContent",mO=X1.forwardRef(($,J)=>{let Q=wO(s6,$.__scopeMenu),{forceMount:Z=Q.forceMount,...q}=$,X=O7(s6,$.__scopeMenu),Y=HZ(s6,$.__scopeMenu),z=fO(uO,$.__scopeMenu),K=X1.useRef(null),W=N7(J,K);return G(zZ.Provider,{scope:$.__scopeMenu,children:G(ZJ,{present:Z||X.open,children:G(zZ.Slot,{scope:$.__scopeMenu,children:G(M3,{id:z.contentId,"aria-labelledby":z.triggerId,...q,ref:W,align:"start",side:Y.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:(H)=>{if(Y.isUsingKeyboardRef.current)K.current?.focus();H.preventDefault()},onCloseAutoFocus:(H)=>H.preventDefault(),onFocusOutside:P5($.onFocusOutside,(H)=>{if(H.target!==z.trigger)X.onOpenChange(!1)}),onEscapeKeyDown:P5($.onEscapeKeyDown,(H)=>{Y.onClose(),H.preventDefault()}),onKeyDown:P5($.onKeyDown,(H)=>{let B=H.currentTarget.contains(H.target),U=pu[Y.dir].includes(H.key);if(B&&U)X.onOpenChange(!1),z.trigger?.focus(),H.preventDefault()})})})})})});mO.displayName=uO;function cO($){return $?"open":"closed"}function WY($){return $==="indeterminate"}function A3($){return WY($)?"indeterminate":$?"checked":"unchecked"}function Gm($){let J=document.activeElement;for(let Q of $){if(Q===J)return;if(Q.focus(),document.activeElement!==J)return}}function Wm($,J){return $.map((Q,Z)=>$[(J+Z)%$.length])}function Hm($,J,Q){let q=J.length>1&&Array.from(J).every((W)=>W===J[0])?J[0]:J,X=Q?$.indexOf(Q):-1,Y=Wm($,Math.max(X,0));if(q.length===1)Y=Y.filter((W)=>W!==Q);let K=Y.find((W)=>W.toLowerCase().startsWith(q.toLowerCase()));return K!==Q?K:void 0}function Bm($,J){let{x:Q,y:Z}=$,q=!1;for(let X=0,Y=J.length-1;XZ!==U>Z&&Q<(B-W)*(Z-H)/(U-H)+W)q=!q}return q}function Um($,J){if(!J)return!1;let Q={x:$.clientX,y:$.clientY};return Bm(Q,J)}function KZ($){return(J)=>J.pointerType==="mouse"?$(J):void 0}var dO=AO,pO=L3,lO=kO,iO=IO,rO=D3,sO=TO,oO=HY,nO=jO,aO=yO,tO=RO,eO=SO,$A=hO,JA=xO,QA=vO,ZA=gO,qA=mO;var o6=R(v(),1);var BY=R(v(),1);var Lm=o6[" useInsertionEffect ".trim().toString()]||_1;function XA({prop:$,defaultProp:J,onChange:Q=()=>{},caller:Z}){let[q,X,Y]=Fm({defaultProp:J,onChange:Q}),z=$!==void 0,K=z?$:q;{let H=o6.useRef($!==void 0);o6.useEffect(()=>{let B=H.current;if(B!==z)console.warn(`${Z} is changing from ${B?"controlled":"uncontrolled"} to ${z?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`);H.current=z},[z,Z])}let W=o6.useCallback((H)=>{if(z){let B=Vm(H)?H($):H;if(B!==$)Y.current?.(B)}else X(H)},[z,$,X,Y]);return[K,W]}function Fm({defaultProp:$,onChange:J}){let[Q,Z]=o6.useState($),q=o6.useRef(Q),X=o6.useRef(J);return Lm(()=>{X.current=J},[J]),o6.useEffect(()=>{if(q.current!==Q)X.current?.(Q),q.current=Q},[Q,q]),[Q,Z,X]}function Vm($){return typeof $==="function"}var h40=Symbol("RADIX:SYNC_STATE");var w3="ContextMenu",[Mm,p40]=iN(w3,[_3]),g8=_3(),[Dm,YA]=Mm(w3),zA=($)=>{let{__scopeContextMenu:J,children:Q,onOpenChange:Z,dir:q,modal:X=!0}=$,[Y,z]=B5.useState(!1),K=g8(J),W=c5(Z),H=B5.useCallback((B)=>{z(B),W(B)},[W]);return G(Dm,{scope:J,open:Y,onOpenChange:H,modal:X,children:G(dO,{...K,dir:q,open:Y,onOpenChange:H,modal:X,children:Q})})};zA.displayName=w3;var KA="ContextMenuTrigger",GA=B5.forwardRef(($,J)=>{let{__scopeContextMenu:Q,disabled:Z=!1,...q}=$,X=YA(KA,Q),Y=g8(Q),z=B5.useRef({x:0,y:0}),K=B5.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...z.current})}),W=B5.useRef(0),H=B5.useCallback(()=>window.clearTimeout(W.current),[]),B=(U)=>{z.current={x:U.clientX,y:U.clientY},X.onOpenChange(!0)};return B5.useEffect(()=>H,[H]),B5.useEffect(()=>void(Z&&H()),[Z,H]),T(G1,{children:[G(pO,{...Y,virtualRef:K}),G(aN.span,{"data-state":X.open?"open":"closed","data-disabled":Z?"":void 0,...q,ref:J,style:{WebkitTouchCallout:"none",...$.style},onContextMenu:Z?$.onContextMenu:QJ($.onContextMenu,(U)=>{H(),B(U),U.preventDefault()}),onPointerDown:Z?$.onPointerDown:QJ($.onPointerDown,UY((U)=>{H(),W.current=window.setTimeout(()=>B(U),700)})),onPointerMove:Z?$.onPointerMove:QJ($.onPointerMove,UY(H)),onPointerCancel:Z?$.onPointerCancel:QJ($.onPointerCancel,UY(H)),onPointerUp:Z?$.onPointerUp:QJ($.onPointerUp,UY(H))})]})});GA.displayName=KA;var Nm="ContextMenuPortal",WA=($)=>{let{__scopeContextMenu:J,...Q}=$,Z=g8(J);return G(lO,{...Z,...Q})};WA.displayName=Nm;var HA="ContextMenuContent",BA=B5.forwardRef(($,J)=>{let{__scopeContextMenu:Q,...Z}=$,q=YA(HA,Q),X=g8(Q),Y=B5.useRef(!1);return G(iO,{...X,...Z,ref:J,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:(z)=>{if($.onCloseAutoFocus?.(z),!z.defaultPrevented&&Y.current)z.preventDefault();Y.current=!1},onInteractOutside:(z)=>{if($.onInteractOutside?.(z),!z.defaultPrevented&&!q.modal)Y.current=!0},style:{...$.style,...{"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}}})});BA.displayName=HA;var Om="ContextMenuGroup",Am=B5.forwardRef(($,J)=>{let{__scopeContextMenu:Q,...Z}=$,q=g8(Q);return G(rO,{...q,...Z,ref:J})});Am.displayName=Om;var wm="ContextMenuLabel",UA=B5.forwardRef(($,J)=>{let{__scopeContextMenu:Q,...Z}=$,q=g8(Q);return G(sO,{...q,...Z,ref:J})});UA.displayName=wm;var km="ContextMenuItem",_A=B5.forwardRef(($,J)=>{let{__scopeContextMenu:Q,...Z}=$,q=g8(Q);return G(oO,{...q,...Z,ref:J})});_A.displayName=km;var Im="ContextMenuCheckboxItem",LA=B5.forwardRef(($,J)=>{let{__scopeContextMenu:Q,...Z}=$,q=g8(Q);return G(nO,{...q,...Z,ref:J})});LA.displayName=Im;var Tm="ContextMenuRadioGroup",bm=B5.forwardRef(($,J)=>{let{__scopeContextMenu:Q,...Z}=$,q=g8(Q);return G(aO,{...q,...Z,ref:J})});bm.displayName=Tm;var jm="ContextMenuRadioItem",FA=B5.forwardRef(($,J)=>{let{__scopeContextMenu:Q,...Z}=$,q=g8(Q);return G(tO,{...q,...Z,ref:J})});FA.displayName=jm;var Em="ContextMenuItemIndicator",VA=B5.forwardRef(($,J)=>{let{__scopeContextMenu:Q,...Z}=$,q=g8(Q);return G(eO,{...q,...Z,ref:J})});VA.displayName=Em;var ym="ContextMenuSeparator",MA=B5.forwardRef(($,J)=>{let{__scopeContextMenu:Q,...Z}=$,q=g8(Q);return G($A,{...q,...Z,ref:J})});MA.displayName=ym;var Pm="ContextMenuArrow",Rm=B5.forwardRef(($,J)=>{let{__scopeContextMenu:Q,...Z}=$,q=g8(Q);return G(JA,{...q,...Z,ref:J})});Rm.displayName=Pm;var DA="ContextMenuSub",NA=($)=>{let{__scopeContextMenu:J,children:Q,onOpenChange:Z,open:q,defaultOpen:X}=$,Y=g8(J),[z,K]=XA({prop:q,defaultProp:X??!1,onChange:Z,caller:DA});return G(QA,{...Y,open:z,onOpenChange:K,children:Q})};NA.displayName=DA;var Cm="ContextMenuSubTrigger",OA=B5.forwardRef(($,J)=>{let{__scopeContextMenu:Q,...Z}=$,q=g8(Q);return G(ZA,{...q,...Z,ref:J})});OA.displayName=Cm;var Sm="ContextMenuSubContent",AA=B5.forwardRef(($,J)=>{let{__scopeContextMenu:Q,...Z}=$,q=g8(Q);return G(qA,{...q,...Z,ref:J,style:{...$.style,...{"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}}})});AA.displayName=Sm;function UY($){return(J)=>J.pointerType!=="mouse"?$(J):void 0}var wA=zA,kA=GA,IA=WA,k3=BA;var I3=UA,T3=_A,b3=LA;var j3=FA,E3=VA,y3=MA;var TA=NA,P3=OA,R3=AA;var n6=wA,a6=kA;var jA=TA;var C3=S4.forwardRef(({className:$,inset:J,children:Q,...Z},q)=>T(P3,{ref:q,className:b0("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm text-popover-foreground outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",J&&"pl-8",$),...Z,children:[Q,G(_Y,{className:"ml-auto h-4 w-4"})]}));C3.displayName=P3.displayName;var S3=S4.forwardRef(({className:$,...J},Q)=>G(R3,{ref:Q,className:b0("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-context-menu-content-transform-origin]",$),...J}));S3.displayName=R3.displayName;var E6=S4.forwardRef(({className:$,...J},Q)=>G(IA,{children:T("div",{className:`${M8}`,children:[G("div",{"aria-hidden":"true","data-easy-media-context-menu-backdrop":"",className:"fixed inset-0 z-[9997]"}),G(k3,{ref:Q,className:b0("z-[9999] max-h-[--radix-context-menu-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-context-menu-content-transform-origin]",$),...J})]})}));E6.displayName=k3.displayName;var Q5=S4.forwardRef(({className:$,inset:J,...Q},Z)=>G(T3,{ref:Z,className:b0("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",J&&"pl-8",$),...Q}));Q5.displayName=T3.displayName;var xm=S4.forwardRef(({className:$,children:J,checked:Q,...Z},q)=>T(b3,{ref:q,className:b0("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",$),checked:Q,...Z,children:[G("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:G(E3,{children:G(b9,{className:"h-4 w-4"})})}),J]}));xm.displayName=b3.displayName;var fm=S4.forwardRef(({className:$,children:J,...Q},Z)=>T(j3,{ref:Z,className:b0("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",$),...Q,children:[G("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:G(E3,{children:G(bA,{className:"h-4 w-4 fill-current"})})}),J]}));fm.displayName=j3.displayName;var vm=S4.forwardRef(({className:$,inset:J,...Q},Z)=>G(I3,{ref:Z,className:b0("px-2 py-1.5 text-sm font-semibold text-foreground",J&&"pl-8",$),...Q}));vm.displayName=I3.displayName;var h3=S4.forwardRef(({className:$,...J},Q)=>G(y3,{ref:Q,className:b0("-mx-1 my-1 h-px bg-border",$),...J}));h3.displayName=y3.displayName;var gm=({className:$,...J})=>{return G("span",{className:b0("ml-auto text-xs tracking-widest text-muted-foreground",$),...J})};gm.displayName="ContextMenuShortcut";var nA=R(v(),1);var N5=R(v(),1);var t40=!!(typeof window<"u"&&window.document&&window.document.createElement);function YJ($,J,{checkForDefaultPrevented:Q=!0}={}){return function(q){if($?.(q),Q===!1||!q.defaultPrevented)return J?.(q)}}var yA=R(v(),1);function EA($,J){if(typeof $==="function")return $(J);else if($!==null&&$!==void 0)$.current=J}function x3(...$){return(J)=>{let Q=!1,Z=$.map((q)=>{let X=EA(q,J);if(!Q&&typeof X=="function")Q=!0;return X});if(Q)return()=>{for(let q=0;q{let{scope:U,children:_,...L}=B,F=U?.[$]?.[K]||z,V=h4.useMemo(()=>L,Object.values(L));return G(F.Provider,{value:V,children:_})};W.displayName=X+"Provider";function H(B,U){let _=U?.[$]?.[K]||z,L=h4.useContext(_);if(L)return L;if(Y!==void 0)return Y;throw Error(`\`${B}\` must be used within \`${X}\``)}return[W,H]}let q=()=>{let X=Q.map((Y)=>{return h4.createContext(Y)});return function(z){let K=z?.[$]||X;return h4.useMemo(()=>({[`__scope${$}`]:{...z,[$]:K}}),[z,K])}};return q.scopeName=$,[Z,um(q,...J)]}function um(...$){let J=$[0];if($.length===1)return J;let Q=()=>{let Z=$.map((q)=>({useScope:q(),scopeName:q.scopeName}));return function(X){let Y=Z.reduce((z,{useScope:K,scopeName:W})=>{let B=K(X)[`__scope${W}`];return{...z,...B}},{});return h4.useMemo(()=>({[`__scope${J.scopeName}`]:Y}),[Y])}};return Q.scopeName=J.scopeName,Q}var U6=R(v(),1);var RA=R(v(),1);function mm($,J){return RA.useReducer((Q,Z)=>{return J[Q][Z]??Q},$)}var FY=($)=>{let{present:J,children:Q}=$,Z=cm(J),q=typeof Q==="function"?Q({present:Z.isPresent}):U6.Children.only(Q),X=BZ(Z.ref,dm(q));return typeof Q==="function"||Z.isPresent?U6.cloneElement(q,{ref:X}):null};FY.displayName="Presence";function cm($){let[J,Q]=U6.useState(),Z=U6.useRef(null),q=U6.useRef($),X=U6.useRef("none"),Y=$?"mounted":"unmounted",[z,K]=mm(Y,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return U6.useEffect(()=>{let W=LY(Z.current);X.current=z==="mounted"?W:"none"},[z]),_1(()=>{let W=Z.current,H=q.current;if(H!==$){let U=X.current,_=LY(W);if($)K("MOUNT");else if(_==="none"||W?.display==="none")K("UNMOUNT");else if(H&&U!==_)K("ANIMATION_OUT");else K("UNMOUNT");q.current=$}},[$,K]),_1(()=>{if(J){let W,H=J.ownerDocument.defaultView??window,B=(_)=>{let F=LY(Z.current).includes(CSS.escape(_.animationName));if(_.target===J&&F){if(K("ANIMATION_END"),!q.current){let V=J.style.animationFillMode;J.style.animationFillMode="forwards",W=H.setTimeout(()=>{if(J.style.animationFillMode==="forwards")J.style.animationFillMode=V})}}},U=(_)=>{if(_.target===J)X.current=LY(Z.current)};return J.addEventListener("animationstart",U),J.addEventListener("animationcancel",B),J.addEventListener("animationend",B),()=>{H.clearTimeout(W),J.removeEventListener("animationstart",U),J.removeEventListener("animationcancel",B),J.removeEventListener("animationend",B)}}else K("ANIMATION_END")},[J,K]),{isPresent:["mounted","unmountSuspended"].includes(z),ref:U6.useCallback((W)=>{Z.current=W?getComputedStyle(W):null,Q(W)},[])}}function LY($){return $?.animationName||"none"}function dm($){let J=Object.getOwnPropertyDescriptor($.props,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning;if(Q)return $.ref;if(J=Object.getOwnPropertyDescriptor($,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning,Q)return $.props.ref;return $.props.ref||$.ref}var CA=R(v(),1),om=R(J5(),1);var K8=R(v(),1);function VY($){let J=pm($),Q=K8.forwardRef((Z,q)=>{let{children:X,...Y}=Z,z=K8.Children.toArray(X),K=z.find(im);if(K){let W=K.props.children,H=z.map((B)=>{if(B===K){if(K8.Children.count(W)>1)return K8.Children.only(null);return K8.isValidElement(W)?W.props.children:null}else return B});return G(J,{...Y,ref:q,children:K8.isValidElement(W)?K8.cloneElement(W,void 0,H):null})}return G(J,{...Y,ref:q,children:X})});return Q.displayName=`${$}.Slot`,Q}function pm($){let J=K8.forwardRef((Q,Z)=>{let{children:q,...X}=Q;if(K8.isValidElement(q)){let Y=sm(q),z=rm(X,q.props);if(q.type!==K8.Fragment)z.ref=Z?x3(Z,Y):Y;return K8.cloneElement(q,z)}return K8.Children.count(q)>1?K8.Children.only(null):null});return J.displayName=`${$}.SlotClone`,J}var lm=Symbol("radix.slottable");function im($){return K8.isValidElement($)&&typeof $.type==="function"&&"__radixId"in $.type&&$.type.__radixId===lm}function rm($,J){let Q={...J};for(let Z in J){let q=$[Z],X=J[Z];if(/^on[A-Z]/.test(Z)){if(q&&X)Q[Z]=(...z)=>{let K=X(...z);return q(...z),K};else if(q)Q[Z]=q}else if(Z==="style")Q[Z]={...q,...X};else if(Z==="className")Q[Z]=[q,X].filter(Boolean).join(" ")}return{...$,...Q}}function sm($){let J=Object.getOwnPropertyDescriptor($.props,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning;if(Q)return $.ref;if(J=Object.getOwnPropertyDescriptor($,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning,Q)return $.props.ref;return $.props.ref||$.ref}var nm=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],f3=nm.reduce(($,J)=>{let Q=VY(`Primitive.${J}`),Z=CA.forwardRef((q,X)=>{let{asChild:Y,...z}=q,K=Y?Q:J;if(typeof window<"u")window[Symbol.for("radix-ui")]=!0;return G(K,{...z,ref:X})});return Z.displayName=`Primitive.${J}`,{...$,[J]:Z}},{});var t6=R(v(),1);var MY=R(v(),1);var am=t6[" useInsertionEffect ".trim().toString()]||_1;function SA({prop:$,defaultProp:J,onChange:Q=()=>{},caller:Z}){let[q,X,Y]=tm({defaultProp:J,onChange:Q}),z=$!==void 0,K=z?$:q;{let H=t6.useRef($!==void 0);t6.useEffect(()=>{let B=H.current;if(B!==z)console.warn(`${Z} is changing from ${B?"controlled":"uncontrolled"} to ${z?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`);H.current=z},[z,Z])}let W=t6.useCallback((H)=>{if(z){let B=em(H)?H($):H;if(B!==$)Y.current?.(B)}else X(H)},[z,$,X,Y]);return[K,W]}function tm({defaultProp:$,onChange:J}){let[Q,Z]=t6.useState($),q=t6.useRef(Q),X=t6.useRef(J);return am(()=>{X.current=J},[J]),t6.useEffect(()=>{if(q.current!==Q)X.current?.(Q),q.current=Q},[Q,q]),[Q,Z,X]}function em($){return typeof $==="function"}var U70=Symbol("RADIX:SYNC_STATE");var DY="Popover",[hA,P70]=PA(DY,[d6]),UZ=d6(),[$c,A7]=hA(DY),xA=($)=>{let{__scopePopover:J,children:Q,open:Z,defaultOpen:q,onOpenChange:X,modal:Y=!1}=$,z=UZ(J),K=N5.useRef(null),[W,H]=N5.useState(!1),[B,U]=SA({prop:Z,defaultProp:q??!1,onChange:X,caller:DY});return G(k4,{...z,children:G($c,{scope:J,contentId:a5(),triggerRef:K,open:B,onOpenChange:U,onOpenToggle:N5.useCallback(()=>U((_)=>!_),[U]),hasCustomAnchor:W,onCustomAnchorAdd:N5.useCallback(()=>H(!0),[]),onCustomAnchorRemove:N5.useCallback(()=>H(!1),[]),modal:Y,children:Q})})};xA.displayName=DY;var fA="PopoverAnchor",vA=N5.forwardRef(($,J)=>{let{__scopePopover:Q,...Z}=$,q=A7(fA,Q),X=UZ(Q),{onCustomAnchorAdd:Y,onCustomAnchorRemove:z}=q;return N5.useEffect(()=>{return Y(),()=>z()},[Y,z]),G(I4,{...X,...Z,ref:J})});vA.displayName=fA;var gA="PopoverTrigger",uA=N5.forwardRef(($,J)=>{let{__scopePopover:Q,...Z}=$,q=A7(gA,Q),X=UZ(Q),Y=BZ(J,q.triggerRef),z=G(f3.button,{type:"button","aria-haspopup":"dialog","aria-expanded":q.open,"aria-controls":q.contentId,"data-state":lA(q.open),...Z,ref:Y,onClick:YJ($.onClick,q.onOpenToggle)});return q.hasCustomAnchor?z:G(I4,{asChild:!0,...X,children:z})});uA.displayName=gA;var v3="PopoverPortal",[Jc,Qc]=hA(v3,{forceMount:void 0}),mA=($)=>{let{__scopePopover:J,forceMount:Q,children:Z,container:q}=$,X=A7(v3,J);return G(Jc,{scope:J,forceMount:Q,children:G(FY,{present:Q||X.open,children:G(I9,{asChild:!0,container:q,children:Z})})})};mA.displayName=v3;var zJ="PopoverContent",cA=N5.forwardRef(($,J)=>{let Q=Qc(zJ,$.__scopePopover),{forceMount:Z=Q.forceMount,...q}=$,X=A7(zJ,$.__scopePopover);return G(FY,{present:Z||X.open,children:X.modal?G(qc,{...q,ref:J}):G(Xc,{...q,ref:J})})});cA.displayName=zJ;var Zc=VY("PopoverContent.RemoveScroll"),qc=N5.forwardRef(($,J)=>{let Q=A7(zJ,$.__scopePopover),Z=N5.useRef(null),q=BZ(J,Z),X=N5.useRef(!1);return N5.useEffect(()=>{let Y=Z.current;if(Y)return F7(Y)},[]),G(T4,{as:Zc,allowPinchZoom:!0,children:G(dA,{...$,ref:q,trapFocus:Q.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:YJ($.onCloseAutoFocus,(Y)=>{if(Y.preventDefault(),!X.current)Q.triggerRef.current?.focus()}),onPointerDownOutside:YJ($.onPointerDownOutside,(Y)=>{let z=Y.detail.originalEvent,K=z.button===0&&z.ctrlKey===!0,W=z.button===2||K;X.current=W},{checkForDefaultPrevented:!1}),onFocusOutside:YJ($.onFocusOutside,(Y)=>Y.preventDefault(),{checkForDefaultPrevented:!1})})})}),Xc=N5.forwardRef(($,J)=>{let Q=A7(zJ,$.__scopePopover),Z=N5.useRef(!1),q=N5.useRef(!1);return G(dA,{...$,ref:J,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:(X)=>{if($.onCloseAutoFocus?.(X),!X.defaultPrevented){if(!Z.current)Q.triggerRef.current?.focus();X.preventDefault()}Z.current=!1,q.current=!1},onInteractOutside:(X)=>{if($.onInteractOutside?.(X),!X.defaultPrevented){if(Z.current=!0,X.detail.originalEvent.type==="pointerdown")q.current=!0}let Y=X.target;if(Q.triggerRef.current?.contains(Y))X.preventDefault();if(X.detail.originalEvent.type==="focusin"&&q.current)X.preventDefault()}})}),dA=N5.forwardRef(($,J)=>{let{__scopePopover:Q,trapFocus:Z,onOpenAutoFocus:q,onCloseAutoFocus:X,disableOutsidePointerEvents:Y,onEscapeKeyDown:z,onPointerDownOutside:K,onFocusOutside:W,onInteractOutside:H,...B}=$,U=A7(zJ,Q),_=UZ(Q);return W7(),G(A4,{asChild:!0,loop:!0,trapped:Z,onMountAutoFocus:q,onUnmountAutoFocus:X,children:G(A9,{asChild:!0,disableOutsidePointerEvents:Y,onInteractOutside:H,onEscapeKeyDown:z,onPointerDownOutside:K,onFocusOutside:W,onDismiss:()=>U.onOpenChange(!1),children:G(_7,{"data-state":lA(U.open),role:"dialog",id:U.contentId,..._,...B,ref:J,style:{...B.style,...{"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}}})})})}),pA="PopoverClose",Yc=N5.forwardRef(($,J)=>{let{__scopePopover:Q,...Z}=$,q=A7(pA,Q);return G(f3.button,{type:"button",...Z,ref:J,onClick:YJ($.onClick,()=>q.onOpenChange(!1))})});Yc.displayName=pA;var zc="PopoverArrow",Kc=N5.forwardRef(($,J)=>{let{__scopePopover:Q,...Z}=$,q=UZ(Q);return G(L7,{...q,...Z,ref:J})});Kc.displayName=zc;function lA($){return $?"open":"closed"}var iA=xA,rA=vA,sA=uA,oA=mA,g3=cA;var a1=iA,T5=sA,_6=rA,s1=nA.forwardRef(({className:$,align:J="center",sideOffset:Q=4,...Z},q)=>G(oA,{children:G("div",{className:`${M8}`,children:G(g3,{ref:q,align:J,sideOffset:Q,className:b0("z-[9999] w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-popover-content-transform-origin]",$),...Z})})}));s1.displayName=g3.displayName;var o1=R(v(),1);var aA=R(v(),1);var $6=aA.forwardRef(({className:$,type:J,...Q},Z)=>{return G("input",{type:J,className:b0("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",$),ref:Z,...Q})});$6.displayName="Input";var Cw=R(v(),1);var i5=R(v(),1);var tA=R(v(),1),Wc=Object.defineProperty,m3=($,J)=>Wc($,"name",{value:J,configurable:!0});function u3($,J){if(typeof $==="function")return $(J);else if($!==null&&$!==void 0)$.current=J}m3(u3,"setRef");function eA(...$){return(J)=>{let Q=!1,Z=$.map((q)=>{let X=u3(q,J);if(!Q&&typeof X=="function")Q=!0;return X});if(Q)return()=>{for(let q=0;qHc($,"name",{value:J,configurable:!0});function Bc($,J){let Q=$9.createContext(J);Q.displayName=$+"Context";let Z=e6((X)=>{let{children:Y,...z}=X,K=$9.useMemo(()=>z,Object.values(z));return G(Q.Provider,{value:K,children:Y})},"Provider");Z.displayName=$+"Provider";function q(X,Y={}){let{optional:z=!1}=Y,K=$9.useContext(Q);if(K)return K;if(J!==void 0)return J;if(z)return;throw Error(`\`${X}\` must be used within \`${$}\``)}return e6(q,"useContext"),[Z,q]}e6(Bc,"createContext");function c3($,J=[]){let Q=[];function Z(X,Y){let z=$9.createContext(Y);z.displayName=X+"Context";let K=Q.length;Q=[...Q,Y];let W=e6((B)=>{let{scope:U,children:_,...L}=B,F=U?.[$]?.[K]||z,V=$9.useMemo(()=>L,Object.values(L));return G(F.Provider,{value:V,children:_})},"Provider");W.displayName=X+"Provider";function H(B,U,_={}){let{optional:L=!1}=_,F=U?.[$]?.[K]||z,V=$9.useContext(F);if(V)return V;if(Y!==void 0)return Y;if(L)return;throw Error(`\`${B}\` must be used within \`${X}\``)}return e6(H,"useContext"),[W,H]}e6(Z,"createContext");let q=e6(()=>{let X=Q.map((Y)=>{return $9.createContext(Y)});return e6(function(z){let K=z?.[$]||X;return $9.useMemo(()=>({[`__scope${$}`]:{...z,[$]:K}}),[z,K])},"useScope")},"createScope");return q.scopeName=$,[Z,$w(q,...J)]}e6(c3,"createContextScope");function $w(...$){let J=$[0];if($.length===1)return J;let Q=e6(()=>{let Z=$.map((q)=>({useScope:q(),scopeName:q.scopeName}));return e6(function(X){let Y=Z.reduce((z,{useScope:K,scopeName:W})=>{let B=K(X)[`__scope${W}`];return{...z,...B}},{});return $9.useMemo(()=>({[`__scope${J.scopeName}`]:Y}),[Y])},"useComposedScopes")},"createScope");return Q.scopeName=J.scopeName,Q}e6($w,"composeContextScopes");var Uc=Object.defineProperty,GJ=($,J)=>Uc($,"name",{value:J,configurable:!0}),Jw=!!(typeof window<"u"&&window.document&&window.document.createElement);function _Z($,J,{checkForDefaultPrevented:Q=!0}={}){return GJ(function(q){if($?.(q),Q===!1||!q||!q.defaultPrevented)return J?.(q)},"handleEvent")}GJ(_Z,"composeEventHandlers");function _c($){if(!Jw)throw Error("Cannot access window outside of the DOM");return $?.ownerDocument?.defaultView??window}GJ(_c,"getOwnerWindow");function d3($){if(!Jw)throw Error("Cannot access document outside of the DOM");return $?.ownerDocument??document}GJ(d3,"getOwnerDocument");function Qw($,J=!1){let{activeElement:Q}=d3($);if(!Q?.nodeName)return null;if(Zw(Q)&&Q.contentDocument)return Qw(Q.contentDocument.body,J);if(J){let Z=Q.getAttribute("aria-activedescendant");if(Z){let q=d3(Q).getElementById(Z);if(q)return q}}return Q}GJ(Qw,"getActiveElement");function Zw($){return $.tagName==="IFRAME"}GJ(Zw,"isFrame");var J9=R(v(),1);var NY=!1;var qw=R(v(),1),Xw=globalThis?.document?qw.useLayoutEffect:()=>{};var j9=R(v(),1);var Yw=R(v(),1),zw=globalThis?.document?Yw.useLayoutEffect:()=>{};var WJ=R(v(),1),Lc=Object.defineProperty,Fc=($,J)=>Lc($,"name",{value:J,configurable:!0}),Kw=WJ[" useEffectEvent ".trim().toString()],Gw=WJ[" useInsertionEffect ".trim().toString()];function p3($){if(typeof Kw==="function")return Kw($);let J=WJ.useRef(()=>{throw Error("Cannot call an event handler while rendering.")});if(typeof Gw==="function")Gw(()=>{J.current=$});else zw(()=>{J.current=$});return WJ.useMemo(()=>(...Q)=>J.current?.(...Q),[])}Fc(p3,"useEffectEvent");var Vc=Object.defineProperty,LZ=($,J)=>Vc($,"name",{value:J,configurable:!0}),Mc=J9[" useInsertionEffect ".trim().toString()]||Xw;function l3({prop:$,defaultProp:J,onChange:Q=LZ(()=>{},"onChange"),caller:Z}){let[q,X,Y]=Hw({defaultProp:J,onChange:Q}),z=$!==void 0,K=z?$:q;if(NY){let H=J9.useRef($!==void 0);J9.useEffect(()=>{let B=H.current;if(B!==z)console.warn(`${Z} is changing from ${B?"controlled":"uncontrolled"} to ${z?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`);H.current=z},[z,Z])}let W=J9.useCallback((H)=>{if(z){let B=Bw(H)?H($):H;if(B!==$)Y.current?.(B)}else X(H)},[z,$,X,Y]);return[K,W]}LZ(l3,"useControllableState");function Hw({defaultProp:$,onChange:J}){let[Q,Z]=J9.useState($),q=J9.useRef(Q),X=J9.useRef(J);return Mc(()=>{X.current=J},[J]),J9.useEffect(()=>{if(q.current!==Q)X.current?.(Q),q.current=Q},[Q,q]),[Q,Z,X]}LZ(Hw,"useUncontrolledState");function Bw($){return typeof $==="function"}LZ(Bw,"isFunction");var Ww=Symbol("RADIX:SYNC_STATE");function Dc($,J,Q,Z){let{prop:q,defaultProp:X,onChange:Y,caller:z}=J,K=q!==void 0,W=p3(Y);if(NY){let V=j9.useRef(q!==void 0);j9.useEffect(()=>{let M=V.current;if(M!==K)console.warn(`${z} is changing from ${M?"controlled":"uncontrolled"} to ${K?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`);V.current=K},[K,z])}let H=[{...Q,state:X}];if(Z)H.push(Z);let[B,U]=j9.useReducer((V,M)=>{if(M.type===Ww)return{...V,state:M.state};let D=$(V,M);if(K&&!Object.is(D.state,V.state))W(D.state);return D},...H),_=B.state,L=j9.useRef(_);j9.useEffect(()=>{if(L.current!==_){if(L.current=_,!K)W(_)}},[_,L,K]);let F=j9.useMemo(()=>{if(q!==void 0)return{...B,state:q};return B},[B,q]);return j9.useEffect(()=>{if(K&&!Object.is(q,B.state))U({type:Ww,state:q})},[q,B.state,K]),[F,U]}LZ(Dc,"useControllableStateReducer");var Lw=R(v(),1);var Uw=R(v(),1),_w=globalThis?.document?Uw.useLayoutEffect:()=>{};var Nc=Object.defineProperty,Oc=($,J)=>Nc($,"name",{value:J,configurable:!0});function i3($){let[J,Q]=Lw.useState(void 0);return _w(()=>{if($){Q({width:$.offsetWidth,height:$.offsetHeight});let Z=new ResizeObserver((q)=>{if(!Array.isArray(q))return;if(!q.length)return;let X=q[0],Y,z;if("borderBoxSize"in X){let K=X.borderBoxSize,W=Array.isArray(K)?K[0]:K;Y=W.inlineSize,z=W.blockSize}else Y=$.offsetWidth,z=$.offsetHeight;Q({width:Y,height:z})});return Z.observe($,{box:"border-box"}),()=>Z.unobserve($)}else Q(void 0)},[$]),J}Oc(i3,"useSize");var C8=R(v(),1);var Fw=R(v(),1),r3=globalThis?.document?Fw.useLayoutEffect:()=>{};var Vw=R(v(),1),Ac=Object.defineProperty,x4=($,J)=>Ac($,"name",{value:J,configurable:!0});function Mw($,J){return Vw.useReducer((Q,Z)=>{return J[Q][Z]??Q},$)}x4(Mw,"useStateMachine");var Dw=x4(($)=>{let{present:J,children:Q}=$,Z=Nw(J),q=typeof Q==="function"?Q({present:Z.isPresent}):C8.Children.only(Q),X=Ow(Z.ref,Aw(q));return typeof Q==="function"||Z.isPresent?C8.cloneElement(q,{ref:X}):null},"Presence");function Nw($){let[J,Q]=C8.useState(),Z=C8.useRef(null),q=C8.useRef($),X=C8.useRef("none"),Y=C8.useRef(void 0),z=$?"mounted":"unmounted",[K,W]=Mw(z,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return C8.useEffect(()=>{if(K==="mounted")X.current=Y.current??HJ(Z.current),Y.current=void 0;else X.current="none"},[K]),r3(()=>{let H=Z.current,B=q.current;if(B!==$){let _=X.current,L=HJ(H);if($)Y.current=L,W("MOUNT");else if(L==="none"||H?.display==="none")W("UNMOUNT");else if(B&&_!==L)W("ANIMATION_OUT");else W("UNMOUNT");q.current=$}},[$,W]),r3(()=>{if(J){let H,B=J.ownerDocument.defaultView??window,U=x4((L)=>{let V=HJ(Z.current).includes(CSS.escape(L.animationName));if(L.target===J&&V){if(W("ANIMATION_END"),!q.current){let M=J.style.animationFillMode;J.style.animationFillMode="forwards",H=B.setTimeout(()=>{if(J.style.animationFillMode==="forwards")J.style.animationFillMode=M})}}},"handleAnimationEnd"),_=x4((L)=>{if(L.target===J)X.current=HJ(Z.current)},"handleAnimationStart");return J.addEventListener("animationstart",_),J.addEventListener("animationcancel",U),J.addEventListener("animationend",U),()=>{B.clearTimeout(H),J.removeEventListener("animationstart",_),J.removeEventListener("animationcancel",U),J.removeEventListener("animationend",U)}}else W("ANIMATION_END")},[J,W]),{isPresent:["mounted","unmountSuspended"].includes(K),ref:C8.useCallback((H)=>{if(H){let B=getComputedStyle(H);Z.current=B,Y.current=HJ(B)}else Z.current=null;Q(H)},[])}}x4(Nw,"usePresence");function s3($,J){if(typeof $==="function")return $(J);else if($!==null&&$!==void 0)$.current=J}x4(s3,"setRef");function Ow(...$){let J=C8.useRef($);return J.current=$,C8.useCallback((Q)=>{let Z=J.current,q=!1,X=Z.map((Y)=>{let z=s3(Y,Q);if(!q&&typeof z==="function")q=!0;return z});if(q)return()=>{for(let Y=0;Ywc($,"name",{value:J,configurable:!0});function n3($){let J=S8.forwardRef((Q,Z)=>{let{children:q,...X}=Q,Y=null,z=!1,K=[];if(o3(q)&&typeof OY==="function")q=OY(q._payload);if(S8.Children.forEach(q,(U)=>{if(Tw(U)){z=!0;let _=U,L="child"in _.props?_.props.child:_.props.children;if(o3(L)&&typeof OY==="function")L=OY(L._payload);Y=Ic(_,L),K.push(Y?.props?.children)}else K.push(U)}),Y)Y=S8.cloneElement(Y,void 0,K);else if(!z&&S8.Children.count(q)===1&&S8.isValidElement(q))Y=q;let W=Y?Iw(Y):void 0,H=KJ(Z,W);if(!Y){if(q||q===0)throw Error(z?jc($):bc($));return q}let B=kw(X,Y.props??{});if(Y.type!==S8.Fragment)B.ref=Z?H:W;return S8.cloneElement(Y,B)});return J.displayName=`${$}.Slot`,J}E9(n3,"createSlot");var ww=Symbol.for("radix.slottable");function kc($){let J=E9((Q)=>("child"in Q)?Q.children(Q.child):Q.children,"Slottable");return J.displayName=`${$}.Slottable`,J.__radixId=ww,J}E9(kc,"createSlottable");var Ic=E9(($,J)=>{if("child"in $.props){let Q=$.props.child;if(!S8.isValidElement(Q))return null;return S8.cloneElement(Q,void 0,$.props.children(Q.props.children))}return S8.isValidElement(J)?J:null},"getSlottableElementFromSlottable");function kw($,J){let Q={...J};for(let Z in J){let q=$[Z],X=J[Z];if(/^on[A-Z]/.test(Z)){if(q&&X)Q[Z]=(...z)=>{let K=X(...z);return q(...z),K};else if(q)Q[Z]=q}else if(Z==="style")Q[Z]={...q,...X};else if(Z==="className")Q[Z]=[q,X].filter(Boolean).join(" ")}return{...$,...Q}}E9(kw,"mergeProps");function Iw($){let J=Object.getOwnPropertyDescriptor($.props,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning;if(Q)return $.ref;if(J=Object.getOwnPropertyDescriptor($,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning,Q)return $.props.ref;return $.props.ref||$.ref}E9(Iw,"getElementRef");function Tw($){return S8.isValidElement($)&&typeof $.type==="function"&&"__radixId"in $.type&&$.type.__radixId===ww}E9(Tw,"isSlottable");var Tc=Symbol.for("react.lazy");function o3($){return $!=null&&typeof $==="object"&&"$$typeof"in $&&$.$$typeof===Tc&&"_payload"in $&&bw($._payload)}E9(o3,"isLazyComponent");function bw($){return typeof $==="object"&&$!==null&&"then"in $}E9(bw,"isPromiseLike");var bc=E9(($)=>{return`${$} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`},"createSlotError"),jc=E9(($)=>{return`${$} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`},"createSlottableError"),OY=S8[" use ".trim().toString()];var Ec=Object.defineProperty,yc=($,J)=>Ec($,"name",{value:J,configurable:!0}),Pc=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],AY=Pc.reduce(($,J)=>{let Q=n3(`Primitive.${J}`),Z=jw.forwardRef((q,X)=>{let{asChild:Y,...z}=q,K=Y?Q:J;if(typeof window<"u")window[Symbol.for("radix-ui")]=!0;return G(K,{...z,ref:X})});return Z.displayName=`Primitive.${J}`,{...$,[J]:Z}},{});function Rc($,J){if($)Ew.flushSync(()=>$.dispatchEvent(J))}yc(Rc,"dispatchDiscreteCustomEvent");var Cc=Object.defineProperty,v4=($,J)=>Cc($,"name",{value:J,configurable:!0}),a3="Checkbox",[Sc,M20]=c3(a3),[hc,t3]=Sc(a3);function yw($){let{__scopeCheckbox:J,checked:Q,children:Z,defaultChecked:q,disabled:X,form:Y,name:z,onCheckedChange:K,required:W,value:H="on",internal_do_not_use_render:B}=$,[U,_]=l3({prop:Q,defaultProp:q??!1,onChange:K,caller:a3}),[L,F]=i5.useState(null),[V,M]=i5.useState(null),D=i5.useRef(!1),[N,O]=i5.useReducer((b)=>b+1,0),k=L?!!Y||!!L.closest("form"):!0,I={checked:U,disabled:X,setChecked:_,control:L,setControl:F,name:z,form:Y,value:H,hasConsumerStoppedPropagationRef:D,userInteractionCount:N,onUserInteraction:O,required:W,defaultChecked:f4(q)?!1:q,isFormControl:k,bubbleInput:V,setBubbleInput:M};return G(hc,{scope:J,...I,children:Rw(B)?B(I):Z})}v4(yw,"CheckboxProvider");var xc="CheckboxTrigger",fc=i5.forwardRef(v4(function({__scopeCheckbox:J,onKeyDown:Q,onClick:Z,...q},X){let{control:Y,value:z,disabled:K,checked:W,required:H,setControl:B,setChecked:U,hasConsumerStoppedPropagationRef:_,onUserInteraction:L,isFormControl:F,bubbleInput:V}=t3(xc,J),M=KJ(X,B),D=i5.useRef(W);return i5.useEffect(()=>{let N=Y?.form;if(N){let O=v4(()=>U(D.current),"reset");return N.addEventListener("reset",O),()=>N.removeEventListener("reset",O)}},[Y,U]),G(AY.button,{type:"button",role:"checkbox","aria-checked":f4(W)?"mixed":W,"aria-required":H,"data-state":$B(W),"data-disabled":K?"":void 0,disabled:K,value:z,...q,ref:M,onKeyDown:_Z(Q,(N)=>{if(N.key==="Enter")N.preventDefault()}),onClick:_Z(Z,(N)=>{if(L(),U((O)=>f4(O)?!0:!O),V&&F){if(_.current=N.isPropagationStopped(),!_.current)N.stopPropagation()}})})},"CheckboxTrigger")),e3=i5.forwardRef(v4(function(J,Q){let{__scopeCheckbox:Z,name:q,checked:X,defaultChecked:Y,required:z,disabled:K,value:W,onCheckedChange:H,form:B,...U}=J;return G(yw,{__scopeCheckbox:Z,checked:X,defaultChecked:Y,disabled:K,required:z,onCheckedChange:H,name:q,form:B,value:W,internal_do_not_use_render:({isFormControl:_})=>T(G1,{children:[G(fc,{...U,ref:Q,__scopeCheckbox:Z}),_&&G(uc,{__scopeCheckbox:Z})]})})},"Checkbox")),vc="CheckboxIndicator",Pw=i5.forwardRef(v4(function(J,Q){let{__scopeCheckbox:Z,forceMount:q,...X}=J,Y=t3(vc,Z);return G(Dw,{present:q||f4(Y.checked)||Y.checked===!0,children:G(AY.span,{"data-state":$B(Y.checked),"data-disabled":Y.disabled?"":void 0,...X,ref:Q,style:{pointerEvents:"none",...J.style}})})},"CheckboxIndicator")),gc="CheckboxBubbleInput",uc=i5.forwardRef(v4(function({__scopeCheckbox:J,onClick:Q,...Z},q){let{control:X,hasConsumerStoppedPropagationRef:Y,userInteractionCount:z,checked:K,defaultChecked:W,required:H,disabled:B,name:U,value:_,form:L,bubbleInput:F,setBubbleInput:V}=t3(gc,J),M=KJ(q,V),D=i3(X),N=i5.useRef(!1),O=i5.useRef(K),k=i5.useRef(z);i5.useEffect(()=>{let b=F;if(!b)return;let A=window.HTMLInputElement.prototype,C=Object.getOwnPropertyDescriptor(A,"checked").set,y=z!==k.current;k.current=z;let x=O.current!==K;O.current=K;let E=!(y&&Y.current);if(x&&C){N.current=!y;let P=new Event("click",{bubbles:E});b.indeterminate=f4(K),C.call(b,f4(K)?!1:K),b.dispatchEvent(P),N.current=!1}},[F,K,Y,z]);let I=i5.useRef(f4(K)?!1:K);return G(AY.input,{type:"checkbox","aria-hidden":!0,defaultChecked:W??I.current,required:H,disabled:B,name:U,value:_,form:L,...Z,tabIndex:-1,ref:M,onClick:_Z(Q,(b)=>{if(N.current)b.stopPropagation()}),style:{...Z.style,...D,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"CheckboxBubbleInput"));function Rw($){return typeof $==="function"}v4(Rw,"isFunction");function f4($){return $==="indeterminate"}v4(f4,"isIndeterminate");function $B($){return f4($)?"indeterminate":$?"checked":"unchecked"}v4($B,"getState");var BJ=Cw.forwardRef(({className:$,...J},Q)=>G(e3,{ref:Q,className:b0("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",$),...J,children:G(Pw,{className:b0("grid place-content-center text-current"),children:G(b9,{className:"h-4 w-4"})})}));BJ.displayName=e3.displayName;var bY=R(v(),1);var u4=R(v(),1);var w20=!!(typeof window<"u"&&window.document&&window.document.createElement);function wY($,J,{checkForDefaultPrevented:Q=!0}={}){return function(q){if($?.(q),Q===!1||!q.defaultPrevented)return J?.(q)}}var g4=R(v(),1);function Sw($,J=[]){let Q=[];function Z(X,Y){let z=g4.createContext(Y),K=Q.length;Q=[...Q,Y];let W=(B)=>{let{scope:U,children:_,...L}=B,F=U?.[$]?.[K]||z,V=g4.useMemo(()=>L,Object.values(L));return G(F.Provider,{value:V,children:_})};W.displayName=X+"Provider";function H(B,U){let _=U?.[$]?.[K]||z,L=g4.useContext(_);if(L)return L;if(Y!==void 0)return Y;throw Error(`\`${B}\` must be used within \`${X}\``)}return[W,H]}let q=()=>{let X=Q.map((Y)=>{return g4.createContext(Y)});return function(z){let K=z?.[$]||X;return g4.useMemo(()=>({[`__scope${$}`]:{...z,[$]:K}}),[z,K])}};return q.scopeName=$,[Z,cc(q,...J)]}function cc(...$){let J=$[0];if($.length===1)return J;let Q=()=>{let Z=$.map((q)=>({useScope:q(),scopeName:q.scopeName}));return function(X){let Y=Z.reduce((z,{useScope:K,scopeName:W})=>{let B=K(X)[`__scope${W}`];return{...z,...B}},{});return g4.useMemo(()=>({[`__scope${J.scopeName}`]:Y}),[Y])}};return Q.scopeName=J.scopeName,Q}var L6=R(v(),1);var xw=R(v(),1);function hw($,J){if(typeof $==="function")return $(J);else if($!==null&&$!==void 0)$.current=J}function dc(...$){return(J)=>{let Q=!1,Z=$.map((q)=>{let X=hw(q,J);if(!Q&&typeof X=="function")Q=!0;return X});if(Q)return()=>{for(let q=0;q{return J[Q][Z]??Q},$)}var JB=($)=>{let{present:J,children:Q}=$,Z=lc(J),q=typeof Q==="function"?Q({present:Z.isPresent}):L6.Children.only(Q),X=fw(Z.ref,ic(q));return typeof Q==="function"||Z.isPresent?L6.cloneElement(q,{ref:X}):null};JB.displayName="Presence";function lc($){let[J,Q]=L6.useState(),Z=L6.useRef(null),q=L6.useRef($),X=L6.useRef("none"),Y=$?"mounted":"unmounted",[z,K]=pc(Y,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return L6.useEffect(()=>{let W=kY(Z.current);X.current=z==="mounted"?W:"none"},[z]),_1(()=>{let W=Z.current,H=q.current;if(H!==$){let U=X.current,_=kY(W);if($)K("MOUNT");else if(_==="none"||W?.display==="none")K("UNMOUNT");else if(H&&U!==_)K("ANIMATION_OUT");else K("UNMOUNT");q.current=$}},[$,K]),_1(()=>{if(J){let W,H=J.ownerDocument.defaultView??window,B=(_)=>{let F=kY(Z.current).includes(CSS.escape(_.animationName));if(_.target===J&&F){if(K("ANIMATION_END"),!q.current){let V=J.style.animationFillMode;J.style.animationFillMode="forwards",W=H.setTimeout(()=>{if(J.style.animationFillMode==="forwards")J.style.animationFillMode=V})}}},U=(_)=>{if(_.target===J)X.current=kY(Z.current)};return J.addEventListener("animationstart",U),J.addEventListener("animationcancel",B),J.addEventListener("animationend",B),()=>{H.clearTimeout(W),J.removeEventListener("animationstart",U),J.removeEventListener("animationcancel",B),J.removeEventListener("animationend",B)}}else K("ANIMATION_END")},[J,K]),{isPresent:["mounted","unmountSuspended"].includes(z),ref:L6.useCallback((W)=>{Z.current=W?getComputedStyle(W):null,Q(W)},[])}}function kY($){return $?.animationName||"none"}function ic($){let J=Object.getOwnPropertyDescriptor($.props,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning;if(Q)return $.ref;if(J=Object.getOwnPropertyDescriptor($,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning,Q)return $.props.ref;return $.props.ref||$.ref}var cw=R(v(),1),ec=R(J5(),1);var G8=R(v(),1);var rc=R(v(),1);function gw($,J){if(typeof $==="function")return $(J);else if($!==null&&$!==void 0)$.current=J}function uw(...$){return(J)=>{let Q=!1,Z=$.map((q)=>{let X=gw(q,J);if(!Q&&typeof X=="function")Q=!0;return X});if(Q)return()=>{for(let q=0;q{let{children:X,...Y}=Z,z=G8.Children.toArray(X),K=z.find(nc);if(K){let W=K.props.children,H=z.map((B)=>{if(B===K){if(G8.Children.count(W)>1)return G8.Children.only(null);return G8.isValidElement(W)?W.props.children:null}else return B});return G(J,{...Y,ref:q,children:G8.isValidElement(W)?G8.cloneElement(W,void 0,H):null})}return G(J,{...Y,ref:q,children:X})});return Q.displayName=`${$}.Slot`,Q}function sc($){let J=G8.forwardRef((Q,Z)=>{let{children:q,...X}=Q;if(G8.isValidElement(q)){let Y=tc(q),z=ac(X,q.props);if(q.type!==G8.Fragment)z.ref=Z?uw(Z,Y):Y;return G8.cloneElement(q,z)}return G8.Children.count(q)>1?G8.Children.only(null):null});return J.displayName=`${$}.SlotClone`,J}var oc=Symbol("radix.slottable");function nc($){return G8.isValidElement($)&&typeof $.type==="function"&&"__radixId"in $.type&&$.type.__radixId===oc}function ac($,J){let Q={...J};for(let Z in J){let q=$[Z],X=J[Z];if(/^on[A-Z]/.test(Z)){if(q&&X)Q[Z]=(...z)=>{let K=X(...z);return q(...z),K};else if(q)Q[Z]=q}else if(Z==="style")Q[Z]={...q,...X};else if(Z==="className")Q[Z]=[q,X].filter(Boolean).join(" ")}return{...$,...Q}}function tc($){let J=Object.getOwnPropertyDescriptor($.props,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning;if(Q)return $.ref;if(J=Object.getOwnPropertyDescriptor($,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning,Q)return $.props.ref;return $.props.ref||$.ref}var $d=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],FZ=$d.reduce(($,J)=>{let Q=mw(`Primitive.${J}`),Z=cw.forwardRef((q,X)=>{let{asChild:Y,...z}=q,K=Y?Q:J;if(typeof window<"u")window[Symbol.for("radix-ui")]=!0;return G(K,{...z,ref:X})});return Z.displayName=`Primitive.${J}`,{...$,[J]:Z}},{});var Q9=R(v(),1);var IY=R(v(),1);var Jd=Q9[" useInsertionEffect ".trim().toString()]||_1;function dw({prop:$,defaultProp:J,onChange:Q=()=>{},caller:Z}){let[q,X,Y]=Qd({defaultProp:J,onChange:Q}),z=$!==void 0,K=z?$:q;{let H=Q9.useRef($!==void 0);Q9.useEffect(()=>{let B=H.current;if(B!==z)console.warn(`${Z} is changing from ${B?"controlled":"uncontrolled"} to ${z?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`);H.current=z},[z,Z])}let W=Q9.useCallback((H)=>{if(z){let B=Zd(H)?H($):H;if(B!==$)Y.current?.(B)}else X(H)},[z,$,X,Y]);return[K,W]}function Qd({defaultProp:$,onChange:J}){let[Q,Z]=Q9.useState($),q=Q9.useRef(Q),X=Q9.useRef(J);return Jd(()=>{X.current=J},[J]),Q9.useEffect(()=>{if(q.current!==Q)X.current?.(Q),q.current=Q},[Q,q]),[Q,Z,X]}function Zd($){return typeof $==="function"}var g20=Symbol("RADIX:SYNC_STATE");var TY="Tabs",[qd,n20]=Sw(TY,[XJ]),pw=XJ(),[Xd,QB]=qd(TY),lw=u4.forwardRef(($,J)=>{let{__scopeTabs:Q,value:Z,onValueChange:q,defaultValue:X,orientation:Y="horizontal",dir:z,activationMode:K="automatic",...W}=$,H=p9(z),[B,U]=dw({prop:Z,onChange:q,defaultProp:X??"",caller:TY});return G(Xd,{scope:Q,baseId:a5(),value:B,onValueChange:U,orientation:Y,dir:H,activationMode:K,children:G(FZ.div,{dir:H,"data-orientation":Y,...W,ref:J})})});lw.displayName=TY;var iw="TabsList",rw=u4.forwardRef(($,J)=>{let{__scopeTabs:Q,loop:Z=!0,...q}=$,X=QB(iw,Q),Y=pw(Q);return G(zY,{asChild:!0,...Y,orientation:X.orientation,dir:X.dir,loop:Z,children:G(FZ.div,{role:"tablist","aria-orientation":X.orientation,...q,ref:J})})});rw.displayName=iw;var sw="TabsTrigger",ow=u4.forwardRef(($,J)=>{let{__scopeTabs:Q,value:Z,disabled:q=!1,...X}=$,Y=QB(sw,Q),z=pw(Q),K=tw(Y.baseId,Z),W=ew(Y.baseId,Z),H=Z===Y.value;return G(KY,{asChild:!0,...z,focusable:!q,active:H,children:G(FZ.button,{type:"button",role:"tab","aria-selected":H,"aria-controls":W,"data-state":H?"active":"inactive","data-disabled":q?"":void 0,disabled:q,id:K,...X,ref:J,onMouseDown:wY($.onMouseDown,(B)=>{if(!q&&B.button===0&&B.ctrlKey===!1)Y.onValueChange(Z);else B.preventDefault()}),onKeyDown:wY($.onKeyDown,(B)=>{if([" ","Enter"].includes(B.key))Y.onValueChange(Z)}),onFocus:wY($.onFocus,()=>{let B=Y.activationMode!=="manual";if(!H&&!q&&B)Y.onValueChange(Z)})})})});ow.displayName=sw;var nw="TabsContent",aw=u4.forwardRef(($,J)=>{let{__scopeTabs:Q,value:Z,forceMount:q,children:X,...Y}=$,z=QB(nw,Q),K=tw(z.baseId,Z),W=ew(z.baseId,Z),H=Z===z.value,B=u4.useRef(H);return u4.useEffect(()=>{let U=requestAnimationFrame(()=>B.current=!1);return()=>cancelAnimationFrame(U)},[]),G(JB,{present:q||H,children:({present:U})=>G(FZ.div,{"data-state":H?"active":"inactive","data-orientation":z.orientation,role:"tabpanel","aria-labelledby":K,hidden:!U,id:W,tabIndex:0,...Y,ref:J,style:{...$.style,animationDuration:B.current?"0s":void 0},children:U&&X})})});aw.displayName=nw;function tw($,J){return`${$}-trigger-${J}`}function ew($,J){return`${$}-content-${J}`}var $k=lw,ZB=rw,qB=ow,XB=aw;var m4=$k,s9=bY.forwardRef(({className:$,...J},Q)=>G(ZB,{ref:Q,className:b0("inline-flex h-9 items-center justify-center rounded-lg border bg-muted p-1 text-muted-foreground",$),...J}));s9.displayName=ZB.displayName;var W8=bY.forwardRef(({className:$,...J},Q)=>G(qB,{ref:Q,className:b0("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",$),...J}));W8.displayName=qB.displayName;var y9=bY.forwardRef(({className:$,...J},Q)=>G(XB,{ref:Q,className:b0("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",$),...J}));y9.displayName=XB.displayName;function T2({className:$,...J}){return G("div",{className:b0("animate-pulse rounded-md bg-primary/10",$),...J})}var zd=globalThis.comfyAPI.app.app;var Jk=($,J,Q=3000)=>{try{zd.extensionManager.toast.add({severity:"error",summary:$,detail:J,life:Q})}catch{globalThis.alert($)}};async function VZ($,J=""){let Q=new FormData;if(Q.append("image",$),Q.append("type","input"),Q.append("overwrite","false"),J)Q.append("subfolder",J);let Z=await fetch("/upload/image",{method:"POST",body:Q});if(!Z.ok)throw Error(`Upload failed: ${Z.status}`);let q=await Z.json();return q.subfolder?`${q.subfolder}/${q.name}`:q.name}var jY=R(v(),1),Kd=180,Gd={threshold:0};function YB($,{delayMs:J=Kd,observerInit:Q=Gd}={}){let[Z,q]=jY.useState(!1);return jY.useEffect(()=>{if(Z)return;let X=$.current;if(!X)return;if(typeof IntersectionObserver>"u"){q(!0);return}let Y,z=new IntersectionObserver(([K])=>{if(K.isIntersecting){Y??=setTimeout(()=>{q(!0),z.disconnect()},J);return}if(Y)clearTimeout(Y),Y=void 0},Q);return z.observe(X),()=>{if(Y)clearTimeout(Y);z.disconnect()}},[J,Z,Q,$]),Z}var EY=new Map,UJ=new Map,zB=new Set,Qk=0,_J={inputs:0,outputs:0,local:0};function Wd($){return JSON.stringify($)}function Zk($){let J=$&&typeof $==="object"?$:{};return(Array.isArray(J.items)?J.items:Array.isArray(J.files)?J.files:[]).reduce((Z,q)=>{if(!q||typeof q!=="object")return Z;let X=q;return Z.push(X.type==="dir"?X:{...X,type:"file"}),Z},[])}function Hd($){let J=new URLSearchParams({source:$.source,type:$.mediaType});if($.source==="local")J.set("path",$.localPath);if($.subfolder)J.set("subfolder",$.subfolder);return`/easy-media/media/list?${J}`}function qk($){let J=Wd($),Q=EY.get(J);if(Q)return Promise.resolve(Q.items);let Z=UJ.get(J);if(Z)return Z.promise;let q=_J[$.source],X=fetch(Hd($)).then((Y)=>{if(!Y.ok)throw Error(`${Y.status}`);return Y.json()}).then((Y)=>{let z=Zk(Y);if(q===_J[$.source])EY.set(J,{request:$,items:z});return z}).finally(()=>{if(UJ.get(J)?.promise===X)UJ.delete(J)});return UJ.set(J,{request:$,promise:X}),X}async function yY($){let J=new URLSearchParams({source:$.source,type:$.mediaType,hours:String($.hours)});if($.limit)J.set("limit",String($.limit));let Q=await fetch(`/easy-media/media/recent?${J}`);if(!Q.ok)throw Error(`${Q.status}`);let Z=await Q.json();return Zk(Z)}async function Xk($,J=48,Q=50){let[Z,q]=await Promise.all([yY({source:"outputs",mediaType:$,hours:J,limit:Q}),yY({source:"temp",mediaType:$,hours:J,limit:Q})]),X=Z.filter((z)=>z.type==="file"&&typeof z.path==="string").map((z)=>({...z,source_type:"output"})),Y=q.filter((z)=>z.type==="file"&&typeof z.path==="string").map((z)=>({...z,source_type:"temp"}));return[...X,...Y].sort((z,K)=>K.mtime-z.mtime)}function R5($){if($)_J[$]+=1;else _J.inputs+=1,_J.outputs+=1,_J.local+=1;for(let[J,Q]of EY)if(!$||Q.request.source===$)EY.delete(J);for(let[J,Q]of UJ)if(!$||Q.request.source===$)UJ.delete(J);Qk+=1,zB.forEach((J)=>J())}function Yk($){return zB.add($),()=>zB.delete($)}function KB(){return Qk}var zk=new Map,MZ="|MULTIPLE|",Kk=2000;function Bd($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;return`${($/1048576).toFixed(1)} MB`}function Fk($,J){if(J==="audio")return LJ;if(J==="image")return VJ;if(J==="video")return FJ;let Q=$.split(".").pop()?.toLowerCase()??"";if(["mp3","wav","flac","ogg","m4a","aac","opus","wma"].includes(Q))return LJ;if(["png","jpg","jpeg","webp","gif","bmp","tiff","tif"].includes(Q))return VJ;if(["mp4","webm","mov","mkv","avi","m4v"].includes(Q))return FJ;return Hk}function BB($,J){if(J==="image")return!0;let Q=$.split(".").pop()?.toLowerCase()??"";return["png","jpg","jpeg","webp","gif","bmp","tiff","tif"].includes(Q)}function Vk($,J){if(J==="audio")return!0;let Q=$.split(".").pop()?.toLowerCase()??"";return["mp3","wav","flac","ogg","m4a","aac","opus","wma"].includes(Q)}function Mk($,J){if(J==="video")return!0;let Q=$.split(".").pop()?.toLowerCase()??"";return["mp4","webm","mov","mkv","avi","m4v"].includes(Q)}function HB($){if(!$)return new Set;return new Set($.split(MZ).filter((J)=>J.length>0))}function Ud($){let J=$.split(MZ)[0]??"";if(!J||J.startsWith("http")||J.startsWith("__slot__:"))return"";return J.replaceAll("\\","/").split("/").slice(0,-1).join("/")}function _d($){return $.replaceAll("\\","/").split("/").filter(Boolean)}function Gk($,J){if(BB($.name,J)&&$.width&&$.height)return`${$.width}×${$.height}`;return Bd($.size)}function Ld($,J){return[...$].sort((Q,Z)=>{if(J==="date")return Z.mtime-Q.mtime;return Q.name.localeCompare(Z.name)})}function Fd($){return[...$].sort((J,Q)=>J.name.localeCompare(Q.name))}function Vd($){if($==="name")return"mediaSelector.sortName";if($==="date")return"mediaSelector.sortDate";return"mediaSelector.sortFolders"}function Dk({src:$,alt:J,className:Q}){let Z=o1.useRef(null),q=YB(Z);return G("img",{ref:Z,src:q?$:void 0,alt:J,className:Q,onError:(X)=>{X.target.style.display="none"}})}function Nk({src:$,className:J}){let Q=o1.useRef(null),Z=YB(Q);return G("video",{ref:Q,src:Z?$:void 0,className:J,muted:!0,playsInline:!0,preload:"metadata",onLoadedMetadata:(q)=>{let X=q.currentTarget;if(Number.isFinite(X.duration)&&X.duration>0.1)X.currentTime=0.1},onError:(q)=>{q.currentTarget.style.display="none"}})}function Md({file:$,mediaType:J,isSelected:Q}){let Z=Fk($.name,J),q=BB($.name,J)&&!!$.url,X=!q&&Mk($.name,J)&&!!$.url,Y=!q&&!X&&Vk($.name,J);return T("div",{className:b0("relative w-full aspect-square rounded overflow-hidden flex items-center justify-center bg-muted",Q&&"ring-2 ring-primary"),children:[q?G(Dk,{src:$.url,alt:$.name,className:"w-full h-full object-cover"}):X?G(Nk,{src:$.url,className:"w-full h-full object-cover"}):G(Z,{className:`w-6 h-6 ${Y?"text-highlight":"text-muted-foreground"}`}),Q&&G("div",{className:"absolute top-1 right-1",children:G(RY,{className:"w-3.5 h-3.5 text-primary fill-primary-foreground"})})]})}function Dd(){return G("div",{className:"grid grid-cols-4 gap-2 p-2",children:Array.from({length:8},($,J)=>`sk-grid-${J}`).map(($)=>T("div",{className:"space-y-1",children:[G(T2,{className:"w-full aspect-square rounded"}),G(T2,{className:"h-3 w-3/4"}),G(T2,{className:"h-2.5 w-1/2"})]},$))})}function Nd(){return G("div",{className:"flex flex-col gap-1 p-2",children:Array.from({length:6},($,J)=>`sk-list-${J}`).map(($)=>T("div",{className:"flex items-center gap-2 h-8",children:[G(T2,{className:"w-6 h-6 rounded shrink-0"}),G(T2,{className:"h-3 flex-1"}),G(T2,{className:"h-3 w-14 shrink-0"})]},$))})}function Od({subfolder:$,onNavigate:J}){if(!$)return null;let Q=_d($);return T("div",{className:"flex items-center gap-0.5 px-2 py-0.5 border-b border-border text-[11px] text-muted-foreground flex-wrap",children:[G("button",{type:"button",className:"hover:text-foreground transition-colors",onClick:()=>J(""),children:"…"}),Q.map((Z,q)=>{let X=Q.slice(0,q+1).join("/");return T("span",{className:"flex items-center gap-0.5",children:[G(_Y,{className:"w-3 h-3 shrink-0"}),G("button",{type:"button",className:"hover:text-foreground transition-colors truncate max-w-20",onClick:()=>J(X),children:Z})]},X)})]})}function PY({source:$,mediaType:J,localPath:Q,viewMode:Z,sortBy:q,searchQuery:X,value:Y,historySource:z="outputs",onChange:K,onSourceChange:W,initialSubfolder:H,onNavigateSubfolder:B,onAddLocalFile:U,multipleSelection:_,selectionLimit:L,onToggleSelection:F,onVisibleFilesChange:V}){let M=q1(),[D,N]=o1.useState([]),[O,k]=o1.useState(H??""),[I,b]=o1.useState(!0),[A,w]=o1.useState(null),C=o1.useSyncExternalStore(Yk,KB,KB),y=HB(Y),x=$==="history"?"history":`${$}|${Q}`,E=o1.useRef(x);o1.useEffect(()=>{let f=E.current;if(E.current=x,f!==x)k(""),N([])},[x]),o1.useEffect(()=>{if($==="local"&&!Q){b(!1);return}b(!0),w(null);let f=!1;return($==="history"?z==="combined"?Xk(J,48,50):yY({source:"outputs",mediaType:J,hours:48,limit:50}):qk({source:$,mediaType:J,localPath:Q,subfolder:O})).then((G0)=>{if(!f)N(G0)}).catch((G0)=>{if(!f)w(G0 instanceof Error?G0.message:JSON.stringify(G0))}).finally(()=>{if(!f)b(!1)}),()=>{f=!0}},[$,z,J,Q,O,C]);let P=Fd(D.filter((f)=>f.type==="dir")),h=Ld(D.filter((f)=>f.type==="file").filter((f)=>f.name.toLowerCase().includes(X.toLowerCase())),q),p=P.filter((f)=>X?f.name.toLowerCase().includes(X.toLowerCase()):!0);if(o1.useEffect(()=>{V(h)},[h,V]),I)return Z==="grid"?G(Dd,{}):G(Nd,{});if(A)return G("div",{className:"flex items-center justify-center h-24 text-destructive text-xs",children:M("mediaSelector.error",{msg:A})});let e=p.length===0&&h.length===0,S=h.filter((f)=>y.has(f.path)),$0=(q==="folders"?[...p,...h]:[...h,...p]).filter((f)=>f.type==="dir"||!y.has(f.path));function K0(f){if(f===O)return;N([]),b(!0),V([]),k(f),B?.(f)}function t(f){if($==="history")return f.source_type==="temp"?"temp":"output";return $==="outputs"?"output":$==="local"?"local":"input"}function H0(f){let o=t(f);K(f.path,o==="temp"?"output":o),W?.({filePath:f.path,sourceType:o})}function z0(f,o){let G0=t(f),l=_&&!o&&y.size>=L;return T("div",{role:"button",tabIndex:l?-1:0,"aria-disabled":l,className:b0("relative flex flex-col gap-1 text-left hover:opacity-80 transition-opacity",l&&"cursor-not-allowed opacity-50"),onClick:()=>_?F(f.path,G0==="temp"?"output":G0):H0(f),onKeyDown:(Z0)=>{if(Z0.target!==Z0.currentTarget)return;if(Z0.key!=="Enter"&&Z0.key!==" ")return;if(Z0.preventDefault(),_)F(f.path,G0==="temp"?"output":G0);else H0(f)},children:[G(Md,{file:f,mediaType:J,isSelected:o&&!_}),_&&G(BJ,{checked:o,disabled:l,"aria-label":M("mediaSelector.selectFile",{name:f.name}),className:"absolute right-1 top-1 z-10 bg-background/80",onClick:(Z0)=>Z0.stopPropagation(),onCheckedChange:()=>F(f.path,G0==="temp"?"output":G0)}),G("span",{className:"text-[10px] truncate leading-tight max-w-full",title:f.name,children:f.name}),G("span",{className:"text-[10px] text-muted-foreground truncate leading-tight max-w-full",children:Gk(f,J)})]},f.path)}function j(f,o){let G0=Fk(f.name,J),l=BB(f.name,J)&&!!f.url,Z0=!l&&Mk(f.name,J)&&!!f.url,Q0=!l&&!Z0&&Vk(f.name,J),B0=t(f),W0=_&&!o&&y.size>=L;return T("div",{role:"button",tabIndex:W0?-1:0,"aria-disabled":W0,className:b0("flex items-center gap-2 px-2 py-1 text-left hover:bg-accent transition-colors",o&&"bg-accent",W0&&"cursor-not-allowed opacity-50"),onClick:()=>_?F(f.path,B0==="temp"?"output":B0):H0(f),onKeyDown:(L0)=>{if(L0.target!==L0.currentTarget)return;if(L0.key!=="Enter"&&L0.key!==" ")return;if(L0.preventDefault(),_)F(f.path,B0==="temp"?"output":B0);else H0(f)},children:[_&&G(BJ,{checked:o,disabled:W0,"aria-label":M("mediaSelector.selectFile",{name:f.name}),onClick:(L0)=>L0.stopPropagation(),onCheckedChange:()=>F(f.path,B0==="temp"?"output":B0)}),l&&G("div",{className:"w-4 h-4 rounded overflow-hidden shrink-0 bg-muted",children:G(Dk,{src:f.url,alt:f.name,className:"w-full h-full object-cover"})}),Z0&&G("div",{className:"w-4 h-4 rounded overflow-hidden shrink-0 bg-muted",children:G(Nk,{src:f.url,className:"w-full h-full object-cover"})}),Q0&&G("div",{className:"w-4 h-4 rounded flex items-center justify-center bg-[#34d399] shrink-0",children:G(G0,{className:"w-3 h-3 text-white"})}),!l&&!Z0&&!Q0&&G(G0,{className:"w-4 h-4 text-muted-foreground shrink-0"}),G("span",{className:"flex-1 text-xs truncate min-w-0",title:f.name,children:f.name}),G("span",{className:"text-[10px] text-muted-foreground shrink-0",children:Gk(f,J)}),o&&!_&&G(RY,{className:"w-3.5 h-3.5 text-primary shrink-0"})]},f.path)}function d(f){return T("button",{type:"button",className:"flex flex-col gap-1 text-left hover:opacity-80 transition-opacity",onClick:()=>K0(f.path),children:[G("div",{className:"relative w-full aspect-square rounded overflow-hidden bg-muted flex items-center justify-center",children:G(GB,{className:"w-6 h-6 text-warning"})}),G("span",{className:"text-[10px] truncate leading-tight max-w-full",title:f.name,children:f.name})]},f.path)}function m(f){return T("button",{type:"button",className:"flex items-center gap-2 px-2 py-1 text-left hover:bg-accent transition-colors",onClick:()=>K0(f.path),children:[G("div",{className:"w-4 h-4 rounded flex items-center justify-center bg-muted shrink-0",children:G(GB,{className:"w-3 h-3 text-warning"})}),G("span",{className:"flex-1 text-xs truncate min-w-0",title:f.name,children:f.name})]},f.path)}function s(f){return f.type==="dir"?d(f):z0(f,y.has(f.path))}function u(f){return f.type==="dir"?m(f):j(f,y.has(f.path))}function c(){return T("div",{className:"grid grid-cols-4 gap-2 p-2 overflow-y-auto flex-1",children:[U&&T("button",{type:"button",className:"flex flex-col gap-1 text-left hover:opacity-80 transition-opacity",onClick:U,children:[G("div",{className:"relative w-full aspect-square rounded overflow-hidden bg-muted flex items-center justify-center border-2 border-dashed border-muted-foreground/50",children:G(K5,{className:"w-6 h-6 text-muted-foreground"})}),G("span",{className:"text-[10px] truncate leading-tight max-w-full text-muted-foreground",children:M("mediaSelector.addLocal")})]},"__add_local__"),S.map((f)=>z0(f,!0)),$0.map(s)]})}function i(){return T("div",{className:"flex flex-col overflow-y-auto flex-1",children:[U&&T("button",{type:"button",className:"flex items-center gap-2 px-2 py-1 text-left hover:bg-accent transition-colors text-muted-foreground",onClick:U,children:[G("div",{className:"w-4 h-4 rounded flex items-center justify-center bg-muted shrink-0",children:G(K5,{className:"w-3 h-3"})}),G("span",{className:"flex-1 text-xs truncate min-w-0",children:M("mediaSelector.addLocal")})]},"__add_local__"),S.map((f)=>j(f,!0)),$0.map(u)]})}return T("div",{className:"flex flex-col flex-1 overflow-hidden",children:[$!=="history"?G(Od,{subfolder:O,onNavigate:K0}):null,e&&G("div",{className:"flex items-center justify-center h-24 text-muted-foreground text-xs",children:M("mediaSelector.empty")}),!e&&Z==="grid"&&c(),!e&&Z!=="grid"&&i()]})}function V5({value:$,onChange:J,onSourceChange:Q,mediaType:Z="all",defaultTab:q="inputs",slotItems:X=[],historySource:Y="outputs",historyOnly:z=!1,allowMultipleSelection:K=!1,maxSelectionCount:W=9}){let H=q1(),B=Z==="image"||Z==="audio"||Z==="video",U=zk.get(Z),_=$&&["inputs","outputs","local"].includes(q)?{...U?.subfolders,[q]:Ud($)}:U?.subfolders??{},[L,F]=o1.useState(z?"history":$?q:U?.activeTab??q),[V,M]=o1.useState(_),[D,N]=o1.useState("grid"),[O,k]=o1.useState("name"),[I,b]=o1.useState(""),[A,w]=o1.useState(""),[C,y]=o1.useState(L==="url"?$:""),[x,E]=o1.useState(!1),[P,h]=o1.useState(!1),[p,e]=o1.useState(()=>new Set),[S,r]=o1.useState([]),[$0,K0]=o1.useState(!1),t=o1.useRef(null),H0=o1.useRef(null),z0=Number.isFinite(W)?Math.max(1,Math.floor(W)):9,j=Z==="image"&&K,d=P?[...p].join(MZ):$,m=HB(d),s=o1.useRef(q);o1.useEffect(()=>{if(z)return;if(s.current===q)return;s.current=q,F(q),b("")},[q,z]),o1.useEffect(()=>()=>{if(H0.current!==null)clearTimeout(H0.current)},[]);function u(g,a=V){zk.set(Z,{activeTab:g,subfolders:a})}function c(g){if(F(g),b(""),r([]),P)e(new Set),h(!1);u(g)}function i(g,a){let I0={...V,[g]:a};M(I0),u(L,I0),b("")}function f(){k((g)=>{if(g==="name")return"date";if(g==="date")return"folders";return"name"})}function o(){let g=Date.now();if(t.current!==null&&g-t.current{H0.current=null,K0(!1)},Kk)}function G0(g,a){J(g,a==="temp"?"output":a),Q?.({filePath:g,sourceType:a})}function l(g){r((a)=>{let I0=a.map((F0)=>F0.path).join(` +`),A0=g.map((F0)=>F0.path).join(` +`);return I0===A0?a:g})}function Z0(){e(new Set([...HB($)].slice(0,z0))),h(!0)}function Q0(){e(new Set),h(!1)}function B0(g){e((a)=>{let I0=new Set(a);if(I0.has(g))I0.delete(g);else if(I0.size{let a=new Set(g);for(let I0 of S){if(a.size>=z0)break;a.add(I0.path)}return a})}function L0(){if(p.size===0)return;let g=L==="outputs"||L==="history"?"output":L==="local"?"local":"input";G0([...p].join(MZ),g),h(!1)}async function _0(){if(x)return;E(!0);try{let g=new globalThis.Image;await new Promise((a,I0)=>{g.onload=a,g.onerror=()=>I0(Error("Image load failed")),g.src=C}),J(C)}catch{await N0()}finally{E(!1)}}async function N0(){try{let g=await fetch("/easy-media/download-url",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:C})});if(!g.ok){Jk(H("mediaSelector.urlErrorTitle"),H("mediaSelector.urlErrorNotFound"));return}let a=await g.json();if(a.source_type==="url")J(a.url);else R5("inputs"),J(a.file_name)}catch{J(C)}}function d0(){let g=document.createElement("input");g.type="file";let a=Z==="image"?"image/*":Z==="audio"?"audio/*":Z==="video"?"video/*":"*/*";g.accept=a,g.multiple=!0,g.onchange=async()=>{if(!g.files||g.files.length===0)return;if(g.files.length===1){let A0=g.files[0];try{let F0=await VZ(A0,V.inputs??"");R5("inputs"),J(F0)}catch(F0){console.error("[MediaSelector] upload failed:",F0)}return}let I0=[];for(let A0 of g.files)try{let F0=await VZ(A0,V.inputs??"");I0.push(F0)}catch(F0){console.error("[MediaSelector] upload failed:",F0)}if(I0.length>0)R5("inputs"),J(I0.join(MZ))},g.click()}return G("div",{"data-media-selector":"",className:"flex flex-col w-80 h-80 text-xs select-none",children:T(m4,{value:L,onValueChange:(g)=>c(g),className:"flex flex-col flex-1 overflow-hidden",children:[G(s9,{className:"w-full rounded-none rounded-t-md h-7 p-0.5 gap-0.5 shrink-0",children:z?G(W8,{value:"history",className:"flex-1 h-full text-[11px] px-1",children:H("mediaSelector.tabHistory")}):T(G1,{children:[G(W8,{value:"inputs",className:"flex-1 h-full text-[11px] px-1",children:H("mediaSelector.tabInputs")}),G(W8,{value:"outputs",className:"flex-1 h-full text-[11px] px-1",children:H("mediaSelector.tabOutputs")}),G(W8,{value:"history",className:"flex-1 h-full text-[11px] px-1",children:H("mediaSelector.tabHistory")}),G(W8,{value:"url",className:"flex-1 h-full text-[11px] px-1",children:H("mediaSelector.tabUrl")}),B&&G(W8,{value:"slot",className:"flex-1 h-full text-[11px] px-1",children:H("mediaSelector.tabSlot")})]})}),L!=="url"&&L!=="slot"&&T("div",{className:"flex items-center gap-1 px-2 py-1 border-b border-border shrink-0",children:[T("div",{className:"relative flex-1",children:[G(Lk,{className:"absolute left-1.5 top-1/2 -translate-y-1/2 w-3 h-3 text-muted-foreground pointer-events-none"}),G($6,{className:"h-6 pl-6 text-[11px]",placeholder:H("mediaSelector.searchPlaceholder"),value:I,onChange:(g)=>b(g.target.value)})]}),j&&!P&&T(k0,{variant:"ghost",size:"sm",className:"h-6 gap-1 px-1.5 text-[11px]",title:H("mediaSelector.filter"),onClick:Z0,children:[G(WB,{className:"w-3 h-3"}),H("mediaSelector.filter")]}),P?T(G1,{children:[G(k0,{variant:"ghost",size:"icon",className:"h-6 w-6",title:H("mediaSelector.cancelFilter"),onClick:Q0,children:G(WB,{className:"w-3 h-3"})}),G(k0,{variant:"ghost",size:"sm",className:"h-6 px-1.5 text-[11px]",disabled:S.length===0||p.size>=z0,onClick:W0,children:H("mediaSelector.selectAll")}),G(k0,{variant:"ghost",size:"sm",className:"h-6 px-1.5 text-[11px]",disabled:p.size===0,onClick:L0,children:H("mediaSelector.confirm")})]}):null,G(k0,{variant:"ghost",size:"icon",className:"h-6 w-6",title:H("mediaSelector.sort",{by:H(Vd(O))}),onClick:f,children:G(Wk,{className:"w-3 h-3"})}),!P&&G(k0,{variant:"ghost",size:"icon",className:"h-6 w-6",title:H(D==="grid"?"mediaSelector.viewList":"mediaSelector.viewGrid"),onClick:()=>N((g)=>g==="grid"?"list":"grid"),children:D==="grid"?G(Uk,{className:"w-3 h-3"}):G(Bk,{className:"w-3 h-3"})}),G(k0,{variant:"ghost",size:"icon",className:"h-6 w-6",title:H("mediaSelector.refresh"),"aria-label":H("mediaSelector.refresh"),disabled:$0,onClick:o,children:G(CY,{className:"w-3 h-3"})})]}),G(y9,{value:"inputs",className:"mt-0 flex-1 overflow-hidden flex flex-col",children:G(PY,{source:"inputs",mediaType:Z,localPath:"",viewMode:D,sortBy:O,searchQuery:I,value:d,onChange:(g)=>G0(g,"input"),initialSubfolder:V.inputs,onNavigateSubfolder:(g)=>i("inputs",g),onAddLocalFile:d0,multipleSelection:P,selectionLimit:z0,onToggleSelection:B0,onVisibleFilesChange:l})}),G(y9,{value:"outputs",className:"mt-0 flex-1 overflow-hidden flex flex-col",children:G(PY,{source:"outputs",mediaType:Z,localPath:"",viewMode:D,sortBy:O,searchQuery:I,value:d,onChange:(g)=>G0(g,"output"),initialSubfolder:V.outputs,onNavigateSubfolder:(g)=>i("outputs",g),multipleSelection:P,selectionLimit:z0,onToggleSelection:B0,onVisibleFilesChange:l})}),G(y9,{value:"history",className:"mt-0 flex-1 overflow-hidden flex flex-col",children:G(PY,{source:"history",mediaType:Z,localPath:"",viewMode:D,sortBy:O,searchQuery:I,value:d,historySource:Y,onChange:(g,a)=>G0(g,a),onSourceChange:Q,initialSubfolder:"",multipleSelection:P,selectionLimit:z0,onToggleSelection:B0,onVisibleFilesChange:l})}),T(y9,{value:"local",className:"mt-0 flex-1 overflow-hidden flex flex-col",children:[G("div",{className:"flex gap-1 px-2 pt-1 pb-1 border-b border-border",children:G($6,{className:"h-6 text-[11px] flex-1",placeholder:H("mediaSelector.localPathPlaceholder"),value:A,onChange:(g)=>w(g.target.value)})}),G(PY,{source:"local",mediaType:Z,localPath:A,viewMode:D,sortBy:O,searchQuery:I,value:d,onChange:(g)=>G0(g,"local"),initialSubfolder:V.local,onNavigateSubfolder:(g)=>i("local",g),multipleSelection:P,selectionLimit:z0,onToggleSelection:B0,onVisibleFilesChange:l})]}),G(y9,{value:"url",className:"mt-0 flex-1 p-2",children:T("div",{className:"space-y-2",children:[G("p",{className:"text-muted-foreground text-[11px]",children:H("mediaSelector.urlHint")}),G($6,{className:"h-7 text-[11px]",placeholder:"https://...",value:C,onChange:(g)=>y(g.target.value),onKeyDown:(g)=>{if(g.key==="Enter")_0()}}),G(k0,{size:"sm",className:"h-6 text-[11px] w-full",disabled:!C.startsWith("http")||x,onClick:_0,children:x?H("mediaSelector.urlChecking"):H("mediaSelector.urlConfirm")})]})}),B&&G(y9,{value:"slot",className:"mt-0 flex-1 overflow-hidden flex flex-col",children:X.length===0?G("div",{className:"flex-1 flex items-center justify-center text-muted-foreground text-[11px]",children:H("mediaSelector.slotEmpty")}):G("div",{className:"flex flex-col overflow-y-auto flex-1",children:X.map((g,a)=>({item:g,index:a})).sort((g,a)=>Number(m.has(a.item.value))-Number(m.has(g.item.value))).map(({item:g,index:a})=>{let I0=m.has(g.value),A0=g.value.startsWith("__slot__:image"),F0=g.value.startsWith("__slot__:audio"),m0=g.value.startsWith("__slot__:video"),R0=A0?H("mediaSelector.slotImage",{n:a+1}):F0?H("mediaSelector.slotAudio",{n:a+1}):m0?H("mediaSelector.slotVideo",{n:a+1}):g.label;return T("button",{type:"button",className:b0("flex items-center gap-2 px-2 py-1 text-left hover:bg-accent transition-colors",I0&&"bg-accent"),onClick:()=>J(g.value),children:[g.img?G("img",{src:g.img,alt:R0,className:"w-8 h-8 object-cover rounded shrink-0 bg-muted"}):F0?G("div",{className:"w-8 h-8 rounded flex items-center justify-center bg-[#34d399] shrink-0",children:G(LJ,{className:"w-4 h-4 text-white"})}):m0?G("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded bg-muted",children:G(FJ,{className:"h-4 w-4 text-muted-foreground"})}):G(_k,{className:"w-3.5 h-3.5 text-muted-foreground shrink-0"}),G("span",{className:"flex-1 text-xs truncate min-w-0",children:R0}),F0&&g.audio_name&&G("span",{className:"text-[10px] text-muted-foreground truncate max-w-24",title:g.audio_name,children:g.audio_name}),I0&&G(RY,{className:"w-3.5 h-3.5 text-primary shrink-0"})]},g.value)})})})]})})}function UB($){if($.url)return $.url;if($.local_path)return $.local_path;if($.file_path){if(/^https?:\/\//i.test($.file_path))return $.file_path;let J=Math.max($.file_path.lastIndexOf("/"),$.file_path.lastIndexOf("\\")),Q=J>=0?$.file_path.slice(J+1):$.file_path,Z=J>=0?$.file_path.slice(0,J):"",q=$.source_type==="output"||$.source_type==="local"?$.source_type:"input";return`/view?filename=${encodeURIComponent(Q)}&type=${q}&subfolder=${encodeURIComponent(Z)}`}return null}function Ok($,J="input"){return{source_type:J,file_path:$,file_name:$.split("/").pop()??$}}function Ak($){return{source_type:"url",url:$,file_name:$.split("/").pop()??$}}function wk($){let J=$.map((Q)=>UB(Q)).filter((Q)=>Q!==null);if(J.length===0)return{};return{backgroundImage:J.map((Q)=>`url("${Q.replaceAll('"',"%22")}")`).join(", "),backgroundRepeat:"repeat",backgroundSize:J.map(()=>"auto 100%").join(", "),backgroundPosition:"0 0"}}function _B({position:$,onClick:J,disabled:Q}){let Z=q1();return G("button",{type:"button","aria-label":$==="left"?Z("insertButton.insertBefore"):Z("insertButton.insertAfter"),className:"flex items-center opacity-80 hover:opacity-100 transition-opacity cursor-pointer select-none disabled:opacity-20",onClick:(q)=>{q.stopPropagation(),J()},disabled:Q,style:{padding:0,border:"none",background:"none"},children:G("span",{className:"inline-flex items-center justify-center rounded-full bg-foreground shrink-0",style:{width:10,height:10},children:G(K5,{className:"w-2 h-2 text-background"})})})}var o9=R(v(),1);var Ad=8,wd=12;function kd($,J,Q,Z){let q=Z/Math.max(Q-1,1),X=$*q,Y=Math.min((J+1)*q,Z);return{left:X,width:Math.max(Y-X,2)}}function Id($,J=0.3){if(!$.startsWith("#")||$.length<7)return"var(--border)";let Q=Number.parseInt($.slice(1,3),16),Z=Number.parseInt($.slice(3,5),16),q=Number.parseInt($.slice(5,7),16),X=Math.round(Q+(255-Q)*J),Y=Math.round(Z+(255-Z)*J),z=Math.round(q+(255-q)*J);return`#${X.toString(16).padStart(2,"0")}${Y.toString(16).padStart(2,"0")}${z.toString(16).padStart(2,"0")}`}var SY=o9.default.forwardRef(function({segment:J,totalFrames:Q,areaWidth:Z,interactive:q=!0,hideLeftHandle:X=!1,disableLeftResize:Y=!1,minStart:z=0,selected:K=!1,onClick:W,onDoubleClick:H,onSelect:B,onContextMenu:U,onDragEnd:_,onResizeEnd:L,children:F,backgroundSlot:V,className:M,bgStyle:D,frameRate:N,displayFormat:O},k){let I=q1(),[b,A]=o9.useState(!1),w=o9.useRef(null);function C(){if(A(!0),w.current)clearTimeout(w.current)}function y(){if(w.current)clearTimeout(w.current);w.current=setTimeout(()=>A(!1),1500)}let{left:x,width:E}=kd(J.start_frame,J.end_frame,Q,Z),P=o9.useRef(null),h=o9.useRef(!1),[p,e]=o9.useState(!1),[S,r]=o9.useState(null);function $0(){return K?wd:Ad}function K0(j){if(!q)return;let d=j.currentTarget.getBoundingClientRect(),m=j.clientX-d.left,s=$0(),u=m<=s&&!Y,c=m>=d.width-s;if(u||c)r("ew-resize");else r("grab")}function t(){r(null)}function H0(j){if(!q)return;j.preventDefault(),h.current=!1;let d=Z/Math.max(Q-1,1),m=j.clientX,s=J.start_frame,u=j.currentTarget.getBoundingClientRect(),c=j.clientX-u.left,i=$0(),f=c<=i&&!Y,o=c>=u.width-i,G0="move";if(f)G0="start";else if(o)G0="end";if(C(),G0!=="move")e(!0);function l(Q0){let B0=Math.round((Q0.clientX-m)/d);if(B0!==0)h.current=!0;if(G0==="start"&&L)L(J.id,"start",B0,z);else if(G0==="end"&&L)L(J.id,"end",B0);else if(G0==="move"&&_)_(J.id,B0,s)}function Z0(){if(P.current=null,G0!=="move")e(!1);y(),globalThis.removeEventListener("mousemove",l),globalThis.removeEventListener("mouseup",Z0)}globalThis.addEventListener("mousemove",l),globalThis.addEventListener("mouseup",Z0)}function z0(j){return(d)=>{if(!q||!L)return;d.preventDefault(),d.stopPropagation();let m=d.clientX,s=Z/Math.max(Q-1,1);e(!0),C();function u(i){let f=Math.round((i.clientX-m)/s);L?.(J.id,j,f,j==="start"?z:void 0)}function c(){e(!1),y(),globalThis.removeEventListener("mousemove",u),globalThis.removeEventListener("mouseup",c)}globalThis.addEventListener("mousemove",u),globalThis.addEventListener("mouseup",c)}}return T("div",{ref:k,role:"button",tabIndex:0,"data-segment-block":"",className:b0("absolute top-0 h-full flex items-center overflow-hidden rounded select-none active:opacity-70",M),style:{left:x,width:E,backgroundColor:J.color,border:p?"1px solid #eab308":K?"1px solid var(--foreground)":`1px solid ${Id(J.color)}`,cursor:S??(q?"grab":"default"),...D},onMouseDown:H0,onMouseMove:K0,onMouseLeave:t,onClick:(j)=>{if(h.current)return;j.stopPropagation(),C(),y(),B?.(J),W?.(J)},onDoubleClick:()=>H?.(J),onContextMenu:(j)=>U?.(j,J),onKeyDown:(j)=>{if(j.key==="Enter")B?.(J),W?.(J)},children:[V&&G("div",{className:"absolute inset-0 pointer-events-none overflow-hidden rounded z-1",children:V}),b&&N!==void 0&&O!==void 0&&G("div",{className:"absolute top-0.5 left-1 z-20 pointer-events-none",children:G("span",{className:"text-[9px] bg-black/70 text-white px-1 py-px rounded leading-none",children:O==="seconds"?`${(J.start_frame/N).toFixed(1)}s`:`${J.start_frame}f`})}),q&&L&&!X&&G("button",{type:"button","aria-label":I("segmentBlock.resizeStart"),className:"absolute left-0 top-0 h-full w-0.5 cursor-ew-resize z-20",style:{background:p?"#eab308":K?"var(--foreground)":"transparent"},onMouseDown:(j)=>{if(Y)return;z0("start")(j)}}),G("div",{className:"flex-1 overflow-hidden min-w-0 px-1.5 text-xs text-foreground font-medium pointer-events-none",children:F}),q&&L&&G("button",{type:"button","aria-label":I("segmentBlock.resizeEnd"),className:"absolute right-0 top-0 h-full w-0.5 cursor-ew-resize z-20",style:{background:p?"#eab308":K?"var(--foreground)":"transparent"},onMouseDown:(j)=>{j.stopPropagation(),z0("end")(j)}})]})});var kk=80;function hY({children:$,height:J,grow:Q}){let Z=J??40;return G("div",{className:"flex border-b border-border",style:Q!==void 0?{flexGrow:Q,minHeight:0}:{height:Z,minHeight:Z},children:G("div",{className:"relative flex-1 min-w-0 overflow-x-clip overflow-y-visible",children:$})})}function DZ($){return $*2+1}function Td($,J){if($.length===0)return $;let Q=Math.floor(J/$.length),Z=J%$.length;return $.map((q,X)=>{let Y=X=X&&J<=Y)return{start:X,end:Y}}let Z=$[$.length-1];if(J>Z.end_frame&&Z.end_frameUB(Z)).filter((Z)=>Z!==null);if(J.length===0)return null;let Q=Array.from({length:24},(Z,q)=>J.map((X,Y)=>({src:X,key:`${q}-${Y}`}))).flat();return G("div",{className:"absolute inset-0 bg-black overflow-hidden",children:G("div",{className:"flex h-full w-max",children:Q.map(({src:Z,key:q})=>G("img",{src:Z,alt:"",className:"h-full w-auto max-w-none shrink-0 object-contain",draggable:!1,onError:(X)=>{X.currentTarget.style.display="none"}},q))})})}function yd({seg:$,index:J}){let Q=q1(),Z=$.content,q=Z.images.length>0,X=Z.text.trim().length>0;if(!q)return G("div",{className:"flex items-center justify-center w-full h-full px-1",children:X?G("span",{className:"text-[9px] text-foreground leading-tight line-clamp-3 text-center",children:Z.text}):T("div",{className:"flex flex-col gap-1",children:[G("span",{className:"text-[9px] text-foreground leading-tight truncate text-center",children:Q("maintainTrack.segmentLabel",{n:J+1})}),G("span",{className:"text-[8px] text-muted-foreground leading-tight truncate text-center",children:Q("maintainTrack.segmentPlaceholder")})]})});return G(G1,{children:X&&G("div",{className:"absolute bottom-0 left-0 right-0 px-1 pb-0.5 pointer-events-none z-10 bg-black",children:G("span",{className:"block text-[9px] leading-tight truncate text-white drop-shadow",children:Z.text})})})}function Ik({track:$,totalFrames:J,frameRate:Q,displayFormat:Z,areaWidth:q,canvasScale:X=1,selectedId:Y,onSelectedIdChange:z,onTrackChange:K,onSegmentsChange:W,onExtendTimeline:H,grow:B}){let U=q1(),_=c4.useRef(null),[L,F]=c4.useState(null),[V,M]=c4.useState(null),[D,N]=c4.useState(!1),[O,k]=c4.useState({x:0,y:0}),[I,b]=c4.useState(""),A=c4.useRef(null),w=$.segments;function C(j){let d=_.current?.getBoundingClientRect();if(!d)return;let m=j.clientX-d.left;if(w.length===0)return;if(!t(m))z(null)}function y(j){let d=_.current?.getBoundingClientRect();if(!d||$.locked)return;let m=j.clientX-d.left,s=q/Math.max(J-1,1),u=Math.round(m/s);if(w.length===0){W([{id:v1(),start_frame:0,end_frame:J-1,content:{text:"",images:[],type:"flf"},color:$.color}]);return}if(w.find((o)=>u>=o.start_frame&&u<=o.end_frame))return;let i=[...w].sort((o,G0)=>o.start_frame-G0.start_frame),f=jd(i,u,J);if(!f)return;W([...w,{id:v1(),start_frame:f.start,end_frame:f.end,content:{text:"",images:[],type:"flf"},color:$.color}])}function x(j,d,m){let s=w.find((Q0)=>Q0.id===j);if(!s)return;let u=s.end_frame-s.start_frame,c=Math.max(0,m+d),i=Math.min(J-1,c+u),f=i-u,G0=[...w.map((Q0)=>Q0.id===j?{...Q0,start_frame:f,end_frame:i}:Q0)].sort((Q0,B0)=>Q0.start_frame+Q0.end_frame-(B0.start_frame+B0.end_frame)),l=[...w].sort((Q0,B0)=>Q0.start_frame-B0.start_frame).map((Q0)=>({start_frame:Q0.start_frame,end_frame:Q0.end_frame})),Z0=G0.map((Q0,B0)=>({...Q0,start_frame:l[B0].start_frame,end_frame:l[B0].end_frame}));W(Z0)}function E(j,d,m){if($.locked)return;let s=w.findIndex((i)=>i.id===j);if(s===-1)return;let u=w[s],c=[...w];if(d==="end")P(c,s,u,m);else h(c,s,u,m);W(c)}function P(j,d,m,s){let u=j[d+1],c=m.start_frame+1,i=Math.max(c,Math.min(m.end_frame+s,J-1));if(j[d]=p(m,m.start_frame,i),u){let f=i+1;if(u.start_frame!==f){let o=f-u.start_frame;j[d+1]={...u,start_frame:f,end_frame:u.end_frame+o};for(let G0=d+2;G0m.start_frame-s.start_frame);if(j.length===0||j[0].start_frame>0)return{start:0,end:j.length>0?j[0].start_frame-1:J-1};for(let m=0;mZ0.id===Y);if(d===-1)return;let m=w[d],s=DZ(Q),u=j==="left"?m.start_frame:m.end_frame+1,c=j==="left"?d:d+1,i={id:v1(),start_frame:u,end_frame:u+s-1,content:{text:"",images:[],type:"flf"},color:$.color},f=w.map((Z0,Q0)=>{if(Q0J&&H)H(o,l);else W(o);z(i.id)}function r(j){if($.locked)return;let d=[...w].sort((Z0,Q0)=>Z0.start_frame-Q0.start_frame),m=d.findIndex((Z0)=>Z0.id===j);if(m===-1)return;let s=d[m],u=s.end_frame-s.start_frame+1,c=s.end_frame+1,i={...structuredClone(s),id:v1(),start_frame:c,end_frame:c+u-1,color:$.color},f=[],o=i.end_frame+1;for(let Z0 of d.slice(m+1)){let Q0=Z0.end_frame-Z0.start_frame+1;f.push({...Z0,start_frame:o,end_frame:o+Q0-1}),o+=Q0}let G0=[...d.slice(0,m+1),i,...f],l=J+u;if(H)H(G0,l);else W(G0);z(i.id)}function $0(){if(w.length===0){W([{id:v1(),start_frame:0,end_frame:J-1,content:{text:"",images:[],type:"flf"},color:$.color}]);return}let j=e();if(j){W([...w,{id:v1(),start_frame:j.start,end_frame:j.end,content:{text:"",images:[],type:"flf"},color:$.color}].sort((i,f)=>i.start_frame-f.start_frame));return}let d=w.at(-1),m=DZ(Q),s=d.end_frame+1,u=s+m-1,c={id:v1(),start_frame:s,end_frame:u,content:{text:"",images:[],type:"flf"},color:$.color};if(W([...w,c]),H)H([...w,c],u+1)}function K0(j){let d=w.findIndex((c)=>c.id===j);if(d===-1)return;if(w.length===1){if(W([]),Y===j)z(null);return}let m=w[d],s=m.end_frame-m.start_frame+1,u=w.map((c,i)=>{if(i===d)return null;let f={...c};if(i>d)f.start_frame=c.start_frame-s,f.end_frame=c.end_frame-s;return f}).filter((c)=>c!==null);if(d>0)u[d-1]={...u[d-1],end_frame:m.start_frame-1};if(W(u),Y===j)z(null)}function t(j){let d=q/Math.max(J-1,1),m=Math.round(j/d);return w.find((s)=>m>=s.start_frame&&m<=s.end_frame)??null}function H0(j){if(j.dataTransfer.types.includes("Files")){j.preventDefault();let d=j.currentTarget.getBoundingClientRect(),m=(j.clientX-d.left)/X;M(Math.round(m/q*(J-1)))}}async function z0(j){j.preventDefault();let d=new Set([".png",".jpg",".jpeg",".webp",".gif",".bmp",".tiff",".tif"]),m=Array.from(j.dataTransfer.files).filter((Z0)=>{if(Z0.type.startsWith("image/"))return!0;let Q0=`.${Z0.name.split(".").pop()?.toLowerCase()??""}`;return d.has(Q0)});if(m.length===0){M(null);return}let s=[];for(let Z0 of m)try{let Q0=await bd(Z0);s.push(Q0)}catch(Q0){console.error("[MaintainTrack] upload failed:",Q0)}if(s.length===0){M(null);return}if(R5("inputs"),w.length===0){let Z0=Math.floor(J/s.length),Q0=J%s.length,B0=[],W0=0;for(let L0=0;L0J-1)break;let _0=Math.min(c,J-Q0);Z0.push({id:v1(),start_frame:Q0,end_frame:Q0+_0-1,content:{text:"",images:[{source_type:"input",file_path:L0,file_name:L0.split("/").pop()??L0}],type:"flf"},color:$.color}),Q0+=c}let B0=[...w,...Z0].sort((L0,_0)=>L0.start_frame-_0.start_frame);W(B0);let W0=Z0[Z0.length-1];if(W0&&H)H(B0,W0.end_frame+1);M(null);return}let i=w[w.length-1],f=[],o=i.end_frame+1;for(let Z0 of s)f.push({id:v1(),start_frame:o,end_frame:o+c-1,content:{text:"",images:[{source_type:"input",file_path:Z0,file_name:Z0.split("/").pop()??Z0}],type:"flf"},color:$.color}),o+=c;let G0=[...w,...f];W(G0);let l=f[f.length-1];if(H)H(G0,l.end_frame+1);M(null)}return T(hY,{track:$,onTrackChange:K,height:B===void 0?kk:void 0,grow:B,children:[T(n6,{children:[G(a6,{className:"relative block w-full h-full",asChild:!0,children:T("section",{ref:_,"aria-label":U("maintainTrack.dropZone"),className:"relative w-full h-full",onDragOver:H0,onDragLeave:()=>M(null),onDrop:z0,onClick:C,onDoubleClick:y,children:[w.map((j,d)=>G(SY,{segment:j,totalFrames:J,areaWidth:q,interactive:!$.locked,hideLeftHandle:!1,disableLeftResize:d===0,selected:Y===j.id,onSelect:(m)=>z(Y===m.id?null:m.id),onDragEnd:x,onResizeEnd:E,frameRate:Q,displayFormat:Z,onContextMenu:(m,s)=>{F(s.id),z(s.id)},onDoubleClick:(m)=>{A.current=m.id,setTimeout(()=>{A.current=null},100)},backgroundSlot:j.content.images.length>0?G(Ed,{images:j.content.images}):void 0,children:G(yd,{seg:j,index:d})},j.id)),Y&&!$.locked&&(()=>{let j=w.findIndex((u)=>u.id===Y);if(j===-1)return null;let d=w[j],m=d.start_frame/Math.max(J-1,1)*q,s=(d.end_frame+1)/Math.max(J-1,1)*q;return T(G1,{children:[G("div",{className:"absolute pointer-events-auto",style:{left:j==0?m+10:m,top:-16,transform:"translate(-50%, 0)",zIndex:25},children:G(_B,{position:"left",onClick:()=>S("left")})}),G("div",{className:"absolute pointer-events-auto",style:{left:j>=w.length-1||w.length==1?s-10:s,top:-16,transform:"translate(-50%, 0)",zIndex:25},children:G(_B,{position:"right",onClick:()=>S("right")})})]})})(),w.length===0?T(n6,{children:[G(a6,{asChild:!0,children:T("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-muted-foreground select-none opacity-40",children:[T("div",{className:"flex items-center gap-1",children:[G(K5,{className:"w-3 h-3"}),G("span",{className:"text-[11px]",children:U("maintainTrack.placeholder")})]}),G("span",{className:"text-[10px]",children:U("maintainTrack.placeholderHint")})]})}),T(E6,{children:[G(Q5,{onClick:$0,children:U("maintainTrack.contextAdd")}),G(Q5,{onClick:()=>{k({x:0,y:60}),b(""),N(!0)},children:U("maintainTrack.addMedia")})]})]}):G("div",{className:"hidden"}),V!==null&&G("div",{className:"absolute top-0 w-0.5 h-full bg-foreground/60 pointer-events-none",style:{left:V/Math.max(J-1,1)*q}})]})}),T(E6,{onCloseAutoFocus:()=>F(null),children:[G(Q5,{onClick:()=>W(Td(w,J)),children:U("maintainTrack.contextDistribute")}),G(Q5,{onClick:$0,children:U("maintainTrack.contextAdd")}),L&&T(G1,{children:[G(Q5,{onClick:()=>{r(L),F(null)},children:U("maintainTrack.contextClone")}),G(Q5,{onClick:()=>{K0(L),F(null)},children:U("maintainTrack.contextDelete")})]})]})]}),T(a1,{open:D,onOpenChange:N,children:[G(_6,{asChild:!0,children:G("span",{className:"absolute w-0 h-0 pointer-events-none",style:{left:O.x,top:O.y}})}),G(s1,{"data-add-popover":"",className:"p-0 w-auto",side:"bottom",align:"start",onOpenAutoFocus:(j)=>j.preventDefault(),children:G(V5,{value:I,onChange:(j,d)=>{if(!j){N(!1);return}let s=j.includes("|MULTIPLE|")?j.split("|MULTIPLE|"):[j],u=d??"input";if(w.length===0){let l=[],Z0=0;for(let Q0=0;Q0J-1)break;let W0=s[B0],L0=W0.split("/").pop()??W0,_0=W0.startsWith("http"),N0=Math.min(l,J-Q0);Z0.push({id:v1(),start_frame:Q0,end_frame:Q0+N0-1,content:{text:"",images:[{source_type:_0?"url":u,file_path:_0?void 0:W0,url:_0?W0:void 0,file_name:L0}],type:"flf"},color:$.color}),Q0+=l}W([...w,...Z0].sort((B0,W0)=>B0.start_frame-W0.start_frame)),N(!1);return}let i=w[w.length-1],f=DZ(Q),o=[],G0=i.end_frame+1;for(let l=0;l{let Q=!1,Z=$.map((q)=>{let X=Tk(q,J);if(!Q&&typeof X=="function")Q=!0;return X});if(Q)return()=>{for(let q=0;q{let{children:Y,...z}=X,K=Z9.useMemo(()=>z,Object.values(z));return G(Q.Provider,{value:K,children:Y})};Z.displayName=$+"Provider";function q(X){let Y=Z9.useContext(Q);if(Y)return Y;if(J!==void 0)return J;throw Error(`\`${X}\` must be used within \`${$}\``)}return[Z,q]}function Ek($,J=[]){let Q=[];function Z(X,Y){let z=Z9.createContext(Y),K=Q.length;Q=[...Q,Y];let W=(B)=>{let{scope:U,children:_,...L}=B,F=U?.[$]?.[K]||z,V=Z9.useMemo(()=>L,Object.values(L));return G(F.Provider,{value:V,children:_})};W.displayName=X+"Provider";function H(B,U){let _=U?.[$]?.[K]||z,L=Z9.useContext(_);if(L)return L;if(Y!==void 0)return Y;throw Error(`\`${B}\` must be used within \`${X}\``)}return[W,H]}let q=()=>{let X=Q.map((Y)=>{return Z9.createContext(Y)});return function(z){let K=z?.[$]||X;return Z9.useMemo(()=>({[`__scope${$}`]:{...z,[$]:K}}),[z,K])}};return q.scopeName=$,[Z,Pd(q,...J)]}function Pd(...$){let J=$[0];if($.length===1)return J;let Q=()=>{let Z=$.map((q)=>({useScope:q(),scopeName:q.scopeName}));return function(X){let Y=Z.reduce((z,{useScope:K,scopeName:W})=>{let B=K(X)[`__scope${W}`];return{...z,...B}},{});return Z9.useMemo(()=>({[`__scope${J.scopeName}`]:Y}),[Y])}};return Q.scopeName=J.scopeName,Q}var q9=R(v(),1);var xY=R(v(),1);var Rd=q9[" useInsertionEffect ".trim().toString()]||_1;function yk({prop:$,defaultProp:J,onChange:Q=()=>{},caller:Z}){let[q,X,Y]=Cd({defaultProp:J,onChange:Q}),z=$!==void 0,K=z?$:q;{let H=q9.useRef($!==void 0);q9.useEffect(()=>{let B=H.current;if(B!==z)console.warn(`${Z} is changing from ${B?"controlled":"uncontrolled"} to ${z?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`);H.current=z},[z,Z])}let W=q9.useCallback((H)=>{if(z){let B=Sd(H)?H($):H;if(B!==$)Y.current?.(B)}else X(H)},[z,$,X,Y]);return[K,W]}function Cd({defaultProp:$,onChange:J}){let[Q,Z]=q9.useState($),q=q9.useRef(Q),X=q9.useRef(J);return Rd(()=>{X.current=J},[J]),q9.useEffect(()=>{if(q.current!==Q)X.current?.(Q),q.current=Q},[Q,q]),[Q,Z,X]}function Sd($){return typeof $==="function"}var t$0=Symbol("RADIX:SYNC_STATE");var F6=R(v(),1);var Pk=R(v(),1);function hd($,J){return Pk.useReducer((Q,Z)=>{return J[Q][Z]??Q},$)}var OZ=($)=>{let{present:J,children:Q}=$,Z=xd(J),q=typeof Q==="function"?Q({present:Z.isPresent}):F6.Children.only(Q),X=DJ(Z.ref,fd(q));return typeof Q==="function"||Z.isPresent?F6.cloneElement(q,{ref:X}):null};OZ.displayName="Presence";function xd($){let[J,Q]=F6.useState(),Z=F6.useRef(null),q=F6.useRef($),X=F6.useRef("none"),Y=$?"mounted":"unmounted",[z,K]=hd(Y,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return F6.useEffect(()=>{let W=fY(Z.current);X.current=z==="mounted"?W:"none"},[z]),_1(()=>{let W=Z.current,H=q.current;if(H!==$){let U=X.current,_=fY(W);if($)K("MOUNT");else if(_==="none"||W?.display==="none")K("UNMOUNT");else if(H&&U!==_)K("ANIMATION_OUT");else K("UNMOUNT");q.current=$}},[$,K]),_1(()=>{if(J){let W,H=J.ownerDocument.defaultView??window,B=(_)=>{let F=fY(Z.current).includes(CSS.escape(_.animationName));if(_.target===J&&F){if(K("ANIMATION_END"),!q.current){let V=J.style.animationFillMode;J.style.animationFillMode="forwards",W=H.setTimeout(()=>{if(J.style.animationFillMode==="forwards")J.style.animationFillMode=V})}}},U=(_)=>{if(_.target===J)X.current=fY(Z.current)};return J.addEventListener("animationstart",U),J.addEventListener("animationcancel",B),J.addEventListener("animationend",B),()=>{H.clearTimeout(W),J.removeEventListener("animationstart",U),J.removeEventListener("animationcancel",B),J.removeEventListener("animationend",B)}}else K("ANIMATION_END")},[J,K]),{isPresent:["mounted","unmountSuspended"].includes(z),ref:F6.useCallback((W)=>{Z.current=W?getComputedStyle(W):null,Q(W)},[])}}function fY($){return $?.animationName||"none"}function fd($){let J=Object.getOwnPropertyDescriptor($.props,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning;if(Q)return $.ref;if(J=Object.getOwnPropertyDescriptor($,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning,Q)return $.props.ref;return $.props.ref||$.ref}var Rk=R(v(),1),dd=R(J5(),1);var H8=R(v(),1);function vY($){let J=vd($),Q=H8.forwardRef((Z,q)=>{let{children:X,...Y}=Z,z=H8.Children.toArray(X),K=z.find(ud);if(K){let W=K.props.children,H=z.map((B)=>{if(B===K){if(H8.Children.count(W)>1)return H8.Children.only(null);return H8.isValidElement(W)?W.props.children:null}else return B});return G(J,{...Y,ref:q,children:H8.isValidElement(W)?H8.cloneElement(W,void 0,H):null})}return G(J,{...Y,ref:q,children:X})});return Q.displayName=`${$}.Slot`,Q}function vd($){let J=H8.forwardRef((Q,Z)=>{let{children:q,...X}=Q;if(H8.isValidElement(q)){let Y=cd(q),z=md(X,q.props);if(q.type!==H8.Fragment)z.ref=Z?LB(Z,Y):Y;return H8.cloneElement(q,z)}return H8.Children.count(q)>1?H8.Children.only(null):null});return J.displayName=`${$}.SlotClone`,J}var gd=Symbol("radix.slottable");function ud($){return H8.isValidElement($)&&typeof $.type==="function"&&"__radixId"in $.type&&$.type.__radixId===gd}function md($,J){let Q={...J};for(let Z in J){let q=$[Z],X=J[Z];if(/^on[A-Z]/.test(Z)){if(q&&X)Q[Z]=(...z)=>{let K=X(...z);return q(...z),K};else if(q)Q[Z]=q}else if(Z==="style")Q[Z]={...q,...X};else if(Z==="className")Q[Z]=[q,X].filter(Boolean).join(" ")}return{...$,...Q}}function cd($){let J=Object.getOwnPropertyDescriptor($.props,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning;if(Q)return $.ref;if(J=Object.getOwnPropertyDescriptor($,"ref")?.get,Q=J&&"isReactWarning"in J&&J.isReactWarning,Q)return $.props.ref;return $.props.ref||$.ref}var pd=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],NJ=pd.reduce(($,J)=>{let Q=vY(`Primitive.${J}`),Z=Rk.forwardRef((q,X)=>{let{asChild:Y,...z}=q,K=Y?Q:J;if(typeof window<"u")window[Symbol.for("radix-ui")]=!0;return G(K,{...z,ref:X})});return Z.displayName=`Primitive.${J}`,{...$,[J]:Z}},{});var uY="Dialog",[Ck,kJ0]=Ek(uY),[ld,P9]=Ck(uY),Sk=($)=>{let{__scopeDialog:J,children:Q,open:Z,defaultOpen:q,onOpenChange:X,modal:Y=!0}=$,z=_5.useRef(null),K=_5.useRef(null),[W,H]=yk({prop:Z,defaultProp:q??!1,onChange:X,caller:uY});return G(ld,{scope:J,triggerRef:z,contentRef:K,contentId:a5(),titleId:a5(),descriptionId:a5(),open:W,onOpenChange:H,onOpenToggle:_5.useCallback(()=>H((B)=>!B),[H]),modal:Y,children:Q})};Sk.displayName=uY;var hk="DialogTrigger",id=_5.forwardRef(($,J)=>{let{__scopeDialog:Q,...Z}=$,q=P9(hk,Q),X=DJ(J,q.triggerRef);return G(NJ.button,{type:"button","aria-haspopup":"dialog","aria-expanded":q.open,"aria-controls":q.contentId,"data-state":MB(q.open),...Z,ref:X,onClick:MJ($.onClick,q.onOpenToggle)})});id.displayName=hk;var FB="DialogPortal",[rd,xk]=Ck(FB,{forceMount:void 0}),fk=($)=>{let{__scopeDialog:J,forceMount:Q,children:Z,container:q}=$,X=P9(FB,J);return G(rd,{scope:J,forceMount:Q,children:_5.Children.map(Z,(Y)=>G(OZ,{present:Q||X.open,children:G(I9,{asChild:!0,container:q,children:Y})}))})};fk.displayName=FB;var gY="DialogOverlay",vk=_5.forwardRef(($,J)=>{let Q=xk(gY,$.__scopeDialog),{forceMount:Z=Q.forceMount,...q}=$,X=P9(gY,$.__scopeDialog);return X.modal?G(OZ,{present:Z||X.open,children:G(od,{...q,ref:J})}):null});vk.displayName=gY;var sd=vY("DialogOverlay.RemoveScroll"),od=_5.forwardRef(($,J)=>{let{__scopeDialog:Q,...Z}=$,q=P9(gY,Q);return G(T4,{as:sd,allowPinchZoom:!0,shards:[q.contentRef],children:G(NJ.div,{"data-state":MB(q.open),...Z,ref:J,style:{pointerEvents:"auto",...Z.style}})})}),b2="DialogContent",gk=_5.forwardRef(($,J)=>{let Q=xk(b2,$.__scopeDialog),{forceMount:Z=Q.forceMount,...q}=$,X=P9(b2,$.__scopeDialog);return G(OZ,{present:Z||X.open,children:X.modal?G(nd,{...q,ref:J}):G(ad,{...q,ref:J})})});gk.displayName=b2;var nd=_5.forwardRef(($,J)=>{let Q=P9(b2,$.__scopeDialog),Z=_5.useRef(null),q=DJ(J,Q.contentRef,Z);return _5.useEffect(()=>{let X=Z.current;if(X)return F7(X)},[]),G(uk,{...$,ref:q,trapFocus:Q.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:MJ($.onCloseAutoFocus,(X)=>{X.preventDefault(),Q.triggerRef.current?.focus()}),onPointerDownOutside:MJ($.onPointerDownOutside,(X)=>{let Y=X.detail.originalEvent,z=Y.button===0&&Y.ctrlKey===!0;if(Y.button===2||z)X.preventDefault()}),onFocusOutside:MJ($.onFocusOutside,(X)=>X.preventDefault())})}),ad=_5.forwardRef(($,J)=>{let Q=P9(b2,$.__scopeDialog),Z=_5.useRef(!1),q=_5.useRef(!1);return G(uk,{...$,ref:J,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:(X)=>{if($.onCloseAutoFocus?.(X),!X.defaultPrevented){if(!Z.current)Q.triggerRef.current?.focus();X.preventDefault()}Z.current=!1,q.current=!1},onInteractOutside:(X)=>{if($.onInteractOutside?.(X),!X.defaultPrevented){if(Z.current=!0,X.detail.originalEvent.type==="pointerdown")q.current=!0}let Y=X.target;if(Q.triggerRef.current?.contains(Y))X.preventDefault();if(X.detail.originalEvent.type==="focusin"&&q.current)X.preventDefault()}})}),uk=_5.forwardRef(($,J)=>{let{__scopeDialog:Q,trapFocus:Z,onOpenAutoFocus:q,onCloseAutoFocus:X,...Y}=$,z=P9(b2,Q),K=_5.useRef(null),W=DJ(J,K);return W7(),T(G1,{children:[G(A4,{asChild:!0,loop:!0,trapped:Z,onMountAutoFocus:q,onUnmountAutoFocus:X,children:G(A9,{role:"dialog",id:z.contentId,"aria-describedby":z.descriptionId,"aria-labelledby":z.titleId,"data-state":MB(z.open),...Y,ref:W,onDismiss:()=>z.onOpenChange(!1)})}),T(G1,{children:[G(td,{titleId:z.titleId}),G($p,{contentRef:K,descriptionId:z.descriptionId})]})]})}),VB="DialogTitle",mk=_5.forwardRef(($,J)=>{let{__scopeDialog:Q,...Z}=$,q=P9(VB,Q);return G(NJ.h2,{id:q.titleId,...Z,ref:J})});mk.displayName=VB;var ck="DialogDescription",dk=_5.forwardRef(($,J)=>{let{__scopeDialog:Q,...Z}=$,q=P9(ck,Q);return G(NJ.p,{id:q.descriptionId,...Z,ref:J})});dk.displayName=ck;var pk="DialogClose",lk=_5.forwardRef(($,J)=>{let{__scopeDialog:Q,...Z}=$,q=P9(pk,Q);return G(NJ.button,{type:"button",...Z,ref:J,onClick:MJ($.onClick,()=>q.onOpenChange(!1))})});lk.displayName=pk;function MB($){return $?"open":"closed"}var ik="DialogTitleWarning",[IJ0,rk]=jk(ik,{contentName:b2,titleName:VB,docsSlug:"dialog"}),td=({titleId:$})=>{let J=rk(ik),Q=`\`${J.contentName}\` requires a \`${J.titleName}\` for the component to be accessible for screen reader users. + +If you want to hide the \`${J.titleName}\`, you can wrap it with our VisuallyHidden component. + +For more information, see https://radix-ui.com/primitives/docs/components/${J.docsSlug}`;return _5.useEffect(()=>{if($){if(!document.getElementById($))console.error(Q)}},[Q,$]),null},ed="DialogDescriptionWarning",$p=({contentRef:$,descriptionId:J})=>{let Z=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${rk(ed).contentName}}.`;return _5.useEffect(()=>{let q=$.current?.getAttribute("aria-describedby");if(J&&q){if(!document.getElementById(J))console.warn(Z)}},[Z,$,J]),null},sk=Sk;var ok=fk,DB=vk,NB=gk,OB=mk,AB=dk,nk=lk;var OJ=sk;var Qp=ok;var ak=AZ.forwardRef(({className:$,...J},Q)=>G(DB,{ref:Q,className:b0("fixed inset-0 z-50 bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",$),...J}));ak.displayName=DB.displayName;var j2=AZ.forwardRef(({className:$,children:J,...Q},Z)=>G(Qp,{children:T("div",{className:`${M8}`,children:[G(ak,{}),T(NB,{ref:Z,className:b0("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",$),...Q,children:[J,T(nk,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[G(n9,{className:"h-4 w-4"}),G("span",{className:"sr-only",children:"Close"})]})]})]})}));j2.displayName=NB.displayName;var wZ=({className:$,...J})=>G("div",{className:b0("flex flex-col space-y-1.5 text-center sm:text-left",$),...J});wZ.displayName="DialogHeader";var kZ=({className:$,...J})=>G("div",{className:b0("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",$),...J});kZ.displayName="DialogFooter";var E2=AZ.forwardRef(({className:$,...J},Q)=>G(OB,{ref:Q,className:b0("text-lg font-semibold leading-none tracking-tight",$),...J}));E2.displayName=OB.displayName;var IZ=AZ.forwardRef(({className:$,...J},Q)=>G(AB,{ref:Q,className:b0("text-sm text-muted-foreground",$),...J}));IZ.displayName=AB.displayName;var X9=R(v(),1);var mY=new Map;function Zp($,J){if(!$)return getComputedStyle(J).getPropertyValue("--multitrack-waveform").trim()||"#1D7456";if($.startsWith("var(")){let Q=$.match(/^var\((--[^)]+)\)$/);if(Q)return getComputedStyle(J).getPropertyValue(Q[1]).trim()||"#1D7456"}return $}function qp($,J,Q,Z,q){let X=window.devicePixelRatio||1,Y=$.getBoundingClientRect();if(Y.width===0||Y.height===0)return;$.width=Math.round(Y.width*X),$.height=Math.round(Y.height*X);let z=$.getContext("2d");if(!z)return;z.scale(X,X);let{width:K,height:W}=Y,H=W/2,B=Math.floor(Q*J.length),U=Math.ceil(Z*J.length),L=Math.max(U-B,1)/K;z.clearRect(0,0,K,W),z.fillStyle=Zp(q,$);for(let F=0;F{let Z=await fetch($);if(!Z.ok)throw Error(`Unable to fetch waveform media: ${$}`);let q=await Z.arrayBuffer(),X=new AudioContext;try{let z=(await X.decodeAudioData(q)).getChannelData(0),K=2000,W=Math.ceil(z.length/2000),H=new Float32Array(2000);for(let B=0;B<2000;B++){let U=0,_=B*W;for(let L=_;L<_+W&&LU)U=F}H[B]=U}return mY.set($,H),H}finally{await X.close()}})();mY.set($,Q);try{return await Q}catch(Z){throw mY.delete($),Z}}function cY({content:$,startRatio:J=0,endRatio:Q=1,className:Z,color:q}){let X=X9.useRef(null),Y=X9.useRef(null),z=Z5($),K=X9.useRef(J),W=X9.useRef(Q),H=X9.useRef(q);K.current=J,W.current=Q,H.current=q;let B=X9.useCallback(()=>{let U=X.current;if(!U||!Y.current)return;qp(U,Y.current,K.current,W.current,H.current)},[]);return X9.useEffect(()=>{if(!z){Y.current=null;return}let U=z,_=!1;async function L(){try{let F=await Xp(U);if(_)return;Y.current=F,B()}catch(F){if(!_)console.warn("[AudioWaveform] failed to decode waveform:",F)}}return L(),()=>{_=!0}},[z,B]),X9.useEffect(()=>{B()},[J,Q,B]),X9.useEffect(()=>{let U=X.current;if(!U)return;let _=new ResizeObserver(B);return _.observe(U),()=>_.disconnect()},[B]),G("canvas",{ref:X,className:Z,style:{display:"block",width:"100%",height:"100%"}})}function tk($){if($==="input")return"inputs";if($==="output")return"outputs";if($==="url")return"url";if($==="local")return"local";return"inputs"}function dY($,J,Q){return $/Math.max(J-1,1)*Q}function $I({track:$,totalFrames:J,frameRate:Q,displayFormat:Z,areaWidth:q,selectedId:X,onSelectedIdChange:Y,onTrackChange:z,onSegmentsChange:K,node:W,app:H,grow:B}){let U=q1(),_=A8.useRef(null),[L,F]=A8.useState(null),[V,M]=A8.useState(null),[D,N]=A8.useState(!1),[O,k]=A8.useState("inputs"),[I,b]=A8.useState({x:0,y:0}),[A,w]=A8.useState(null),[C,y]=A8.useState(""),[x,E]=A8.useState(null),[P,h]=A8.useState(!1),p=A8.useRef([]),e=A8.useMemo(()=>z9(W,H,"audio"),[W,H,D]);A8.useEffect(()=>{return()=>{p.current.forEach((l)=>{l.removeEventListener("loadedmetadata",()=>{}),l.removeEventListener("error",()=>{}),l.src=""}),p.current=[]}},[]),A8.useEffect(()=>{let l=_.current?.closest(".comfyui-react-widget");if(!l)return;let Z0=`${M8}-overlay-active`;return l.classList.toggle(Z0,D||P),()=>l.classList.remove(Z0)},[D,P]);let S=$.segments,r=S.reduce((l,Z0)=>Math.max(l,Z0.end_frame),-1),$0=ra.id===A?{...a,content:g}:a)),N(!1);return}async function W0(_0,N0,d0,g){let a=_0.split("/").pop()??_0,A0=_0.startsWith("http")?{source_type:"url",url:_0,file_name:a}:g==="local"?{source_type:"local",local_path:_0,file_name:a}:{source_type:g,file_path:_0,file_name:a},F0=pY(A0)??_0,m0=await new Promise((z1)=>{let Q1=new Audio(F0);p.current.push(Q1),Q1.preload="metadata",Q1.addEventListener("loadedmetadata",()=>z1(Q1.duration)),Q1.addEventListener("error",()=>z1(5))}),R0=Math.ceil(m0*Q),n0=Math.min(J-1,N0+R0-1);if(N0>=J)return{newSeg:null,nextCursor:N0,updatedSegments:d0};let C0={id:v1(),start_frame:N0,end_frame:n0,origin_start_frame:N0,origin_end_frame:N0+R0-1,content:A0,color:$.color,markers:[]};return{newSeg:C0,nextCursor:n0+1,updatedSegments:[...d0,C0]}}async function L0(){let _0=r>=0?r+1:0,N0=[...S];for(let d0 of B0){if(_0>=J)break;if(d0.startsWith("__slot__:")){let g=d0.slice(9),I0=e.find((C0)=>C0.value===d0)?.audio_name,A0=I0?Y9(I0,"input"):void 0,F0=await new Promise((C0)=>{if(A0){let z1=new Audio(A0);p.current.push(z1),z1.preload="metadata",z1.addEventListener("loadedmetadata",()=>C0(z1.duration)),z1.addEventListener("error",()=>C0(5))}else C0(5)}),m0=Math.ceil(F0*Q),R0=Math.min(J-1,_0+m0-1),n0={id:v1(),start_frame:_0,end_frame:R0,origin_start_frame:_0,origin_end_frame:_0+m0-1,content:{source_type:"slot",slot_name:g,file_name:g,url:A0},color:$.color,markers:[]};N0=[...N0,n0],_0=R0+1}else{let g=await W0(d0,_0,N0,Z0);if(g.newSeg)_0=g.nextCursor,N0=g.updatedSegments}}if(K([...N0].sort((d0,g)=>d0.start_frame-g.start_frame)),N0.length>S.length)w(N0[N0.length-1].id);N(!1)}L0()}function z0(l){if(K(S.filter((Z0)=>Z0.id!==l)),N(!1),X===l)Y(null)}function j(l){return S.find((Z0)=>l>=Z0.start_frame&&l<=Z0.end_frame)??null}function d(l){let Z0=_.current?.getBoundingClientRect();if(!Z0)return;let Q0=q/Math.max(J-1,1),B0=Math.round((l.clientX-Z0.left)/Q0);if(!j(B0))Y(null)}function m(l){l.preventDefault();let Z0=l.currentTarget.getBoundingClientRect(),Q0=l.clientX-Z0.left,B0=Math.round(Q0/q*(J-1));F(B0)}async function s(l){l.preventDefault();let Z0=new Set([".mp3",".wav",".flac",".ogg",".m4a",".aac",".opus",".wma"]),Q0=Array.from(l.dataTransfer.files).filter((_0)=>{if(_0.type.startsWith("audio/"))return!0;let N0=`.${_0.name.split(".").pop()?.toLowerCase()??""}`;return Z0.has(N0)});if(Q0.length===0){F(null);return}if(!$0)return;let B0=[...S],W0=L??(r>=0?r+1:0),L0=!1;for(let _0 of Q0){if(W0>=J)break;try{let N0=new FormData;N0.append("file",_0);let d0=await fetch("/easy-media/upload",{method:"POST",body:N0});if(!d0.ok)continue;let{file_name:g}=await d0.json();L0=!0;let a=Y9(g,"input"),I0=await new Promise((R0)=>{let n0=new Audio(a);n0.preload="metadata",p.current.push(n0),n0.addEventListener("loadedmetadata",()=>R0(n0.duration)),n0.addEventListener("error",()=>R0(5))}),A0=Math.ceil(I0*Q),F0=Math.min(J-1,W0+A0-1),m0={id:v1(),start_frame:W0,end_frame:F0,origin_start_frame:W0,origin_end_frame:W0+A0-1,content:{source_type:"input",file_path:g,file_name:g},color:$.color,markers:[]};B0.push(m0),W0=m0.end_frame+1}catch{}}if(L0)R5("inputs");K(B0.toSorted((_0,N0)=>_0.start_frame-N0.start_frame)),F(null)}function u(l,Z0,Q0,B0=0){if($.locked)return;let W0=S.find((a)=>a.id===l);if(!W0)return;let L0=W0.origin_start_frame??W0.start_frame,_0=W0.origin_end_frame??W0.end_frame,N0=S.filter((a)=>a.id!==l).toSorted((a,I0)=>a.start_frame-I0.start_frame),d0=W0.start_frame,g=W0.end_frame;if(Z0==="start"){d0=Math.max(B0,Math.max(L0,W0.start_frame+Q0));let a=N0.findLast((I0)=>I0.end_frameI0.start_frame>W0.start_frame);if(a)g=Math.min(g,a.start_frame-1);g=Math.max(g,W0.start_frame+1)}K(S.map((a)=>a.id===l?{...a,start_frame:d0,end_frame:g}:a))}function c(l,Z0,Q0){if($.locked)return;let B0=S.find((a)=>a.id===l);if(!B0)return;let W0=B0.end_frame-B0.start_frame,L0=Math.max(0,Q0+Z0),_0=Math.min(J-1,L0+W0),N0=_0-W0,d0=Math.max(0,N0)-B0.start_frame,g=S.map((a)=>{if(a.id!==l)return a;return{...a,start_frame:Math.max(0,N0),end_frame:Math.min(J-1,_0),origin_start_frame:(a.origin_start_frame??a.start_frame)+d0,origin_end_frame:(a.origin_end_frame??a.end_frame)+d0}}).toSorted((a,I0)=>a.start_frame-I0.start_frame);K(g)}function i(l,Z0){let Q0=S.map((B0)=>{if(B0.id!==l)return B0;let W0=[...B0.markers??[],{id:v1(),frame:Z0,label:""}];return{...B0,markers:W0}});K(Q0)}function f(l,Z0){let Q0=S.map((B0)=>{if(B0.id!==l)return B0;return{...B0,markers:(B0.markers??[]).filter((W0)=>W0.id!==Z0)}});K(Q0)}function o(l,Z0,Q0){let B0=S.map((W0)=>{if(W0.id!==l)return W0;return{...W0,markers:(W0.markers??[]).map((L0)=>L0.id===Z0?{...L0,label:Q0}:L0)}});K(B0),M(null)}let G0=[G("button",{type:"button",title:U("audioTrack.addMarker"),className:"w-full h-full flex items-center justify-center hover:bg-accent",onClick:()=>{if(!S.length)return;let l=S[0],Z0=Math.floor((l.start_frame+l.end_frame)/2);i(l.id,Z0)}},"marker"),void 0,void 0];return T(hY,{track:$,onTrackChange:z,toolSlots:G0,grow:B,children:[T(a1,{open:D,onOpenChange:N,children:[T(n6,{children:[G(a6,{className:"relative block w-full h-full",asChild:!0,children:T("section",{ref:_,"aria-label":U("audioTrack.dropZone"),className:"relative w-full h-full cursor-default",onDragOver:m,onDragLeave:()=>F(null),onDrop:s,onClick:d,onContextMenu:()=>h(!0),onDoubleClick:(l)=>{if(l.target.closest("[data-segment-block]"))return;if(!$0)return;t(l,"inputs",null,"")},children:[G(_6,{asChild:!0,children:G("span",{className:"absolute w-0 h-0 pointer-events-none",style:{left:I.x,top:I.y}})}),S.length===0?T("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-muted-foreground pointer-events-none select-none opacity-40",children:[T("div",{className:"flex items-center gap-1",children:[G(AJ,{className:"w-3 h-3"}),G("span",{className:"text-[11px]",children:U("audioTrack.placeholder")})]}),G("span",{className:"text-[10px]",children:U("audioTrack.placeholderHint")})]}):G(G1,{children:S.map((l)=>T(SY,{segment:l,totalFrames:J,areaWidth:q,interactive:!$.locked,minStart:0,selected:X===l.id,onSelect:(Z0)=>{Y(X===Z0.id?null:Z0.id)},onDoubleClick:()=>{K0(dY(l.start_frame,J,q),8,tk(l.content.source_type),l.id,l.content.file_path??l.content.local_path??l.content.url??"")},onDragEnd:c,onResizeEnd:u,frameRate:Q,displayFormat:Z,backgroundSlot:G(cY,{content:l.content,startRatio:l.origin_end_frame!==void 0&&l.origin_start_frame!==void 0?(l.start_frame-l.origin_start_frame)/(l.origin_end_frame-l.origin_start_frame):0,endRatio:l.origin_end_frame!==void 0&&l.origin_start_frame!==void 0?(l.end_frame-l.origin_start_frame)/(l.origin_end_frame-l.origin_start_frame):1,color:"#2E6E53"}),onContextMenu:(Z0,Q0)=>{Y(Q0.id),E(Q0.id)},children:[G("span",{className:"absolute top-0.5 truncate text-[8px]",children:l.content.file_name}),(l.markers??[]).map((Z0)=>G(n1,{delayDuration:200,children:T(H1,{children:[G(B1,{asChild:!0,children:G("button",{type:"button","aria-label":Z0.label?U("audioTrack.markerAriaLabel",{label:Z0.label}):U("audioTrack.markerAtFrame",{frame:Z0.frame}),className:"absolute top-0 w-0.5 h-full bg-yellow-300/80 cursor-pointer hover:bg-yellow-200 z-20",style:{left:dY(Z0.frame,J,q)},onClick:(Q0)=>{Q0.stopPropagation(),M({segId:l.id,markerId:Z0.id,label:Z0.label??""})}})}),G(W1,{side:"top",children:G("p",{children:Z0.label||U("audioTrack.frameLabel",{n:Z0.frame})})})]})},Z0.id))]},l.id))}),L!==null&&G("div",{className:"absolute top-0 w-0.5 h-full bg-foreground/60 pointer-events-none",style:{left:dY(L,J,q)}})]})}),T(E6,{onCloseAutoFocus:()=>{E(null),h(!1)},children:[G(Q5,{disabled:!$0,onClick:()=>setTimeout(()=>K0(8,8,"inputs",null,""),0),children:U("audioTrack.contextAdd")}),x&&(()=>{let l=S.find((Z0)=>Z0.id===x);return T(G1,{children:[G(Q5,{onClick:()=>{if(!l)return;setTimeout(()=>K0(dY(l.start_frame,J,q),8,tk(l.content.source_type),l.id,l.content.file_path??l.content.local_path??l.content.url??""),0),E(null)},children:U("audioTrack.contextEdit")}),G(Q5,{onClick:()=>{z0(x),E(null)},children:U("audioTrack.contextDelete")})]})})()]})]}),G(s1,{"data-audio-popover":"",className:"p-0 w-auto",side:"bottom",align:"start",onOpenAutoFocus:(l)=>l.preventDefault(),children:G(V5,{value:C,onChange:H0,mediaType:"audio",defaultTab:O,slotItems:e})})]}),G(OJ,{open:!!V,onOpenChange:(l)=>{if(!l)M(null)},children:T(j2,{className:"max-w-xs p-4 space-y-2",children:[G(E2,{className:"text-xs text-muted-foreground font-normal",children:U("audioTrack.markerLabelInput")}),V!=null&&(()=>{let l=V;return T(G1,{children:[G($6,{autoFocus:!0,className:"h-7 text-xs",value:l.label,onChange:(Z0)=>M({...l,label:Z0.target.value}),onKeyDown:(Z0)=>{if(Z0.key==="Enter")o(l.segId,l.markerId,l.label);if(Z0.key==="Escape")M(null)}}),T("div",{className:"flex gap-2 justify-end",children:[G(k0,{size:"sm",variant:"ghost",className:"h-6 text-xs",onClick:()=>M(null),children:U("common.cancel")}),G(k0,{size:"sm",variant:"destructive",className:"h-6 text-xs",onClick:()=>{f(l.segId,l.markerId),M(null)},children:U("common.delete")}),G(k0,{size:"sm",className:"h-6 text-xs",onClick:()=>o(l.segId,l.markerId,l.label),children:U("common.save")})]})]})})()]})}),(D||P)&&ek.createPortal(G("div",{"aria-hidden":"true",style:{position:"fixed",inset:0,zIndex:9997},onPointerDown:()=>{N(!1),h(!1)}}),document.body)]})}var g1=R(v(),1);var JI=R(v(),1);var d4=JI.forwardRef(({className:$,...J},Q)=>{return G("textarea",{className:b0("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 resize-none",$),ref:Q,...J})});d4.displayName="Textarea";function Yp($){return String($).replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}function zp($){return $.split(/[||]/).map(Yp).join('|')}var QI={fontFamily:"inherit",fontSize:"10px",lineHeight:"1.4",letterSpacing:0,whiteSpace:"pre-wrap",overflowWrap:"break-word",wordBreak:"break-word"};function Kp($,J,Q,Z){if($.length===0)return[];if($.length===J.length)return J.map((z,K)=>({...z,content:{...z.content,text:$[K]}}));let q=Math.max(1,$.length),X=Math.floor(Q/q),Y=Q%q;return $.map((z,K)=>({id:J[K]?.id??v1(),start_frame:K*X+Math.min(K,Y),end_frame:KF.content.text).join("|"),[H,B]=g1.useState(()=>W);g1.useEffect(()=>{if(z.current)return;B((F)=>F===W?F:W)},[W]);function U(){if(X.current&&Y.current)Y.current.scrollTop=X.current.scrollTop}let _=g1.useCallback((F)=>{let V=F===""?[]:F.split(/[||]/);Z(Kp(V,K.current,J,Q))},[J,Q,Z]),L=g1.useCallback((F)=>{let V=F.target.value;if(B(V),z.current)return;_(V)},[_]);return T("div",{className:"flex flex-col gap-1",children:[T("div",{className:"relative w-full h-30 overflow-hidden",children:[G("div",{ref:Y,"aria-hidden":"true",className:"absolute inset-0 overflow-y-auto pointer-events-none",style:{...QI,padding:0},dangerouslySetInnerHTML:{__html:zp(H)}}),G(d4,{ref:X,value:H,onChange:L,onScroll:U,spellCheck:!1,onCompositionStart:()=>{z.current=!0},onCompositionEnd:()=>{z.current=!1;let F=X.current?.value??"";B(F),_(F)},className:"absolute inset-0 w-full h-full resize-none border-0 shadow-none focus-visible:ring-0 p-0 bg-transparent outline-none",style:{...QI,color:"transparent",caretColor:"var(--foreground)"}})]}),G("p",{className:"text-[9px] text-muted-foreground",children:q("maintainTrack.combinedHint")})]})}function ZI($,J){return $.map((Q,Z)=>{let q=Math.max(1,Math.floor(J/Math.max($.length,1)));return{id:String(Z),item:Q,start_frame:Q.start_frame??Z*q,end_frame:Q.end_frame??Math.min(J-1,Z*q+q-1)}})}function Wp($,J,Q,Z){let q=Z/Math.max(Q-1,1),X=$*q,Y=Math.min((J+1)*q,Z);return{left:X,width:Math.max(Y-X,20)}}async function Hp($){let J=new FormData;J.append("image",$),J.append("type","input"),J.append("overwrite","false");let Q=await fetch("/upload/image",{method:"POST",body:J});if(!Q.ok)throw Error(`Upload failed: ${Q.status}`);let Z=await Q.json();return`${Z.subfolder?`${Z.subfolder}/`:""}${Z.name}`}function Bp($,J,Q){return Q==="seconds"?`${($/J).toFixed(1)}s`:`${$}f`}function Up($,J=0.3){if(!$.startsWith("#")||$.length<7)return"var(--border)";let Q=Number.parseInt($.slice(1,3),16),Z=Number.parseInt($.slice(3,5),16),q=Number.parseInt($.slice(5,7),16),X=Math.round(Q+(255-Q)*J),Y=Math.round(Z+(255-Z)*J),z=Math.round(q+(255-q)*J);return`#${X.toString(16).padStart(2,"0")}${Y.toString(16).padStart(2,"0")}${z.toString(16).padStart(2,"0")}`}var _p=g1.default.forwardRef(function({block:J,span:Q,areaWidth:Z,frameRate:q,displayFormat:X,trackColor:Y,selected:z=!1,onSelect:K,onMoveEnd:W,onResizeEnd:H,onEdit:B,onRemove:U,onContextMenu:_},L){let F=q1(),[V,M]=g1.useState(J.start_frame),[D,N]=g1.useState(J.end_frame),[O,k]=g1.useState(!1),[I,b]=g1.useState(!1),A=g1.useRef(J.start_frame),w=g1.useRef(J.end_frame),C=g1.useRef(!1),y=g1.useRef(!1),x=g1.useRef(null);g1.useEffect(()=>{if(!C.current)A.current=J.start_frame,w.current=J.end_frame,M(J.start_frame),N(J.end_frame)},[J.start_frame,J.end_frame]);let{left:E,width:P}=Wp(V,D,Q,Z);function h(){if(k(!0),x.current)clearTimeout(x.current)}function p(){if(C.current=!1,x.current)clearTimeout(x.current);x.current=setTimeout(()=>k(!1),2000)}function e(t){if(t.button!==0)return;t.preventDefault(),C.current=!0,y.current=!1,h();let H0=t.clientX,z0=J.start_frame,d=J.end_frame-z0,m=Z/Math.max(Q-1,1);function s(c){let i=Math.round((c.clientX-H0)/m);if(i!==0)y.current=!0;let f=Math.max(0,Math.min(Q-1-d,z0+i)),o=f+d;A.current=f,w.current=o,M(f),N(o)}function u(){p(),W(J.id,A.current,w.current),globalThis.removeEventListener("mousemove",s),globalThis.removeEventListener("mouseup",u)}globalThis.addEventListener("mousemove",s),globalThis.addEventListener("mouseup",u)}function S(t){return(H0)=>{if(H0.button!==0)return;H0.preventDefault(),H0.stopPropagation(),C.current=!0,b(!0),h();let z0=H0.clientX,j=J.start_frame,d=J.end_frame,m=Z/Math.max(Q-1,1);function s(c){let i=Math.round((c.clientX-z0)/m);if(t==="start"){let f=Math.max(0,Math.min(d-1,j+i));A.current=f,M(f)}else{let f=Math.max(j+1,Math.min(Q-1,d+i));w.current=f,N(f)}}function u(){b(!1),p(),H(J.id,A.current,w.current),globalThis.removeEventListener("mousemove",s),globalThis.removeEventListener("mouseup",u)}globalThis.addEventListener("mousemove",s),globalThis.addEventListener("mouseup",u)}}let r=[J.item],$0=I?"#eab308":z?"var(--foreground)":Up(Y),K0=I?"#eab308":z?"var(--foreground)":"transparent";return T("div",{ref:L,role:"button",tabIndex:0,className:"absolute top-0 h-full select-none group",style:{left:E,width:P,backgroundColor:Y,opacity:0.9,border:`1px solid ${$0}`,borderRadius:3,overflow:"hidden",cursor:"grab"},onMouseDown:e,onClick:(t)=>{if(y.current)return;t.stopPropagation(),K?.(J.id)},onDoubleClick:()=>{K?.(J.id),B()},onContextMenu:_,onKeyDown:(t)=>{if(t.key==="Enter")K?.(J.id),B()},children:[r.length>0&&G("div",{className:"absolute inset-0 bg-black overflow-hidden",style:wk(r)}),G("button",{type:"button","aria-label":"Resize start",className:"absolute left-0 top-0 h-full w-0.5 cursor-ew-resize z-10 border-0 p-0",style:{background:K0},onMouseDown:S("start")}),G("button",{type:"button","aria-label":"Resize end",className:"absolute right-0 top-0 h-full w-0.5 cursor-ew-resize z-10 border-0 p-0",style:{background:K0},onMouseDown:S("end")}),G("button",{type:"button",className:"absolute top-0.5 right-0.5 w-3 h-3 z-20 rounded-sm bg-destructive text-white text-[9px] flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",onClick:(t)=>{t.stopPropagation(),U()},title:F("common.delete"),children:"×"}),G("div",{className:"absolute bottom-0 left-0 right-0 text-center text-[8px] bg-black/60 text-white truncate px-1 pointer-events-none",children:J.item.file_name}),O&&G("div",{className:"absolute top-0.5 left-1 z-20 pointer-events-none",children:G("span",{className:"text-[9px] bg-black/80 text-white px-1 py-px rounded leading-none",children:Bp(V,q,X)})})]})});function qI({segment:$,allSegments:J,totalFrames:Q,frameRate:Z,displayFormat:q,areaWidth:X,trackColor:Y,canvasScale:z,onContentChange:K,onAllSegmentsChange:W,node:H,app:B}){let U=q1(),_=$.end_frame-$.start_frame+1,[L,F]=g1.useState("individual"),[V,M]=g1.useState(()=>ZI($.content.images,_)),D=$.content.images.map((j)=>[j.source_type,j.file_path,j.local_path,j.url,j.slot_name,j.start_frame,j.end_frame].join(":")).join("|");g1.useEffect(()=>{M(ZI($.content.images,_))},[$.id,D,$.content.images,_]);let[N,O]=g1.useState(!1),[k,I]=g1.useState(null),[b,A]=g1.useState(null),[w,C]=g1.useState(""),[y,x]=g1.useState("inputs"),[E,P]=g1.useState({x:8,y:8}),h=g1.useRef(null),p=g1.useRef(!1),e=g1.useMemo(()=>z9(H,B,"image"),[H,B,N]);function S(j,d,m,s){if(j){let u=h.current?.getBoundingClientRect();P({x:j.clientX-(u?.left??0),y:j.clientY-(u?.top??0)})}p.current=!0,I(d),C(m),x(s),O(!0)}function r(j,d){let m=j.startsWith("__slot__:"),s=!m&&/^https?:\/\//i.test(j),u=m?j.slice(9):void 0,i=e.find((o)=>o.value===j)?.img,f;if(m)f={source_type:"slot",slot_name:u,file_name:u??j,url:i};else if(s)f=Ak(j);else f=Ok(j,d);if(k===null){let o=V.reduce((L0,_0)=>Math.max(L0,_0.end_frame),-1),G0=o>=0?o+1:0,l=V;if(G0>=_&&V.length>0){let L0=V.at(-1),_0=Math.floor((L0.start_frame+L0.end_frame)/2);l=V.map((N0,d0)=>d0===V.length-1?{...N0,end_frame:_0}:N0),G0=_0+1}let Z0=l.length===0?Math.max(1,Math.floor(_/2)):Math.max(1,Math.floor(_/(l.length+1))),Q0=Math.min(_-1,G0+Z0-1),B0={id:String(l.length),item:{...f,start_frame:G0,end_frame:Q0},start_frame:G0,end_frame:Q0},W0=[...l,B0];M(W0),K({images:W0.map((L0)=>({...L0.item,start_frame:L0.start_frame,end_frame:L0.end_frame}))})}else{let o=V.map((G0)=>G0.id===k?{...G0,item:{...f,start_frame:G0.start_frame,end_frame:G0.end_frame}}:G0);M(o),K({images:o.map((G0)=>({...G0.item,start_frame:G0.start_frame,end_frame:G0.end_frame}))})}O(!1)}function $0(j,d,m){let s=V.map((u)=>u.id===j?{...u,start_frame:d,end_frame:m}:u);M(s),K({images:s.map((u)=>({...u.item,start_frame:u.start_frame,end_frame:u.end_frame}))})}function K0(j){let d=V.filter((m)=>m.id!==j);M(d),K({images:d.map((m)=>({...m.item,start_frame:m.start_frame,end_frame:m.end_frame}))})}function t(){if(V.length===0)return;let j=Math.floor(_/V.length),d=_%V.length,m=V.map((s,u)=>{let c=u({...s.item,start_frame:s.start_frame,end_frame:s.end_frame}))})}function H0(j){if(!j.dataTransfer.types.includes("Files"))return;j.preventDefault(),j.dataTransfer.dropEffect="copy"}async function z0(j){if(!j.dataTransfer.types.includes("Files"))return;j.preventDefault();let d=new Set([".png",".jpg",".jpeg",".webp",".gif",".bmp",".tiff",".tif"]),m=Array.from(j.dataTransfer.files).filter((Q0)=>{if(Q0.type.startsWith("image/"))return!0;let B0=`.${Q0.name.split(".").pop()?.toLowerCase()??""}`;return d.has(B0)});if(m.length===0)return;let s=j.currentTarget.getBoundingClientRect(),c=((Number.isFinite(j.clientX)?j.clientX:s.left+X/2)-s.left)/z,i=Math.max(0,Math.min(_-1,Math.round(c/X*(_-1)))),f=Math.max(1,Math.floor(_/Math.max(V.length+m.length,1))),o=[];for(let Q0 of m)try{o.push(await Hp(Q0))}catch(B0){console.error("[EditPanel] upload failed:",B0)}if(o.length===0)return;R5("inputs");let G0=i,l=[];for(let Q0 of o){if(G0>_-1)break;let B0=Math.min(_-1,G0+f-1),W0={source_type:"input",file_path:Q0,file_name:Q0.split("/").pop()??Q0,start_frame:G0,end_frame:B0};l.push({id:String(V.length+l.length),item:W0,start_frame:G0,end_frame:B0}),G0=B0+1}if(l.length===0)return;let Z0=[...V,...l];M(Z0),K({images:Z0.map((Q0)=>({...Q0.item,start_frame:Q0.start_frame,end_frame:Q0.end_frame}))})}return T("div",{"data-edit-panel":"",className:"bg-card border border-border rounded shadow-lg overflow-hidden",style:{width:X},children:[L==="combined"?G("div",{className:"p-2 border-border",children:G(Gp,{allSegments:J,totalFrames:Q,trackColor:Y,onAllSegmentsChange:W},`combined-${$.id}-${L}`)}):T(G1,{children:[G("div",{className:"p-2 border-b border-border",children:G(d4,{className:"w-full h-16 resize-none text-[10px] border-0 shadow-none focus-visible:ring-0 p-0 bg-transparent",placeholder:U("maintainTrack.promptPlaceholder"),value:$.content.text,onChange:(j)=>K({text:j.target.value})})}),G(ZY,{totalFrames:_,frameRate:Z,displayFormat:q,width:X,canvasScale:z,showLabel:!1}),T("div",{ref:h,className:"relative w-full select-none bg-muted/30",style:{height:48},onDragOver:H0,onDrop:z0,children:[V.length===0?T(n6,{children:[G(a6,{asChild:!0,children:T("button",{type:"button",className:"absolute inset-0 flex items-center justify-center gap-1 text-[10px] text-muted-foreground hover:text-foreground cursor-pointer",onClick:(j)=>S(j,null,"","inputs"),children:[G(K5,{className:"w-2.5 h-2.5"}),G("span",{children:U("maintainTrack.addImage")})]})}),G(E6,{children:G(Q5,{onClick:()=>S(null,null,"","inputs"),children:U("imageTrack.contextAdd")})})]}):T(G1,{children:[V.map((j)=>{return T(n6,{children:[G(a6,{asChild:!0,children:G(_p,{block:j,span:_,areaWidth:X,frameRate:Z,displayFormat:q,trackColor:Y,selected:b===j.id,onSelect:A,onMoveEnd:$0,onResizeEnd:$0,onEdit:()=>S(null,j.id,j.item.file_path??j.item.url??"",j.item.source_type==="url"?"url":"inputs"),onRemove:()=>K0(j.id)})}),T(E6,{children:[G(Q5,{onClick:()=>{A(j.id),S(null,j.id,j.item.file_path??j.item.url??"",j.item.source_type==="url"?"url":"inputs")},children:U("imageTrack.contextReselect")}),G(Q5,{onClick:()=>S(null,null,"","inputs"),children:U("imageTrack.contextAdd")}),G(Q5,{disabled:V.length<1,onClick:t,children:U("imageTrack.contextDistribute")}),G(h3,{}),G(Q5,{className:"text-destructive focus:text-destructive",onClick:()=>K0(j.id),children:U("imageTrack.contextDelete")})]})]},j.id)}),G("button",{type:"button",className:"absolute right-1 top-1/2 w-5 h-5 flex items-center justify-center rounded border border-dashed border-border bg-card transition-colors text-muted-foreground z-30 cursor-pointer",onClick:(j)=>{j.stopPropagation(),S(j,null,"","inputs")},title:U("maintainTrack.addImage"),children:G(K5,{className:"w-3 h-3"})})]}),T(a1,{open:N,onOpenChange:(j)=>{if(!j)O(!1)},children:[G(_6,{asChild:!0,children:G("span",{className:"absolute w-0 h-0 pointer-events-none",style:{left:E.x,top:E.y}})}),G(s1,{className:"p-0 w-auto",side:"bottom",align:"start",onOpenAutoFocus:(j)=>j.preventDefault(),onInteractOutside:(j)=>{if(p.current)p.current=!1,j.preventDefault()},children:G(V5,{value:w,onChange:r,mediaType:"image",defaultTab:y,slotItems:e})})]})]})]}),T("div",{className:"flex items-center space-between gap-2 p-2 border-t",children:[G(m4,{value:L,onValueChange:(j)=>F(j),children:T(s9,{className:"h-6",children:[G(W8,{value:"individual",className:"text-[10px] h-5 px-2",children:U("maintainTrack.tabIndividual")}),G(W8,{value:"combined",className:"text-[10px] h-5 px-2",children:U("maintainTrack.tabCombined")})]})}),L==="combined"?G(G1,{}):G("div",{className:"flex items-center gap-2 ml-auto",children:T(y8,{value:$.content.type,onValueChange:(j)=>K({type:j}),children:[G(P8,{className:"h-6 w-28 text-[10px]",children:G(W6,{})}),T(R8,{children:[G(l5,{value:"flf",children:U("maintainTrack.flf")}),G(l5,{value:"fmlf",children:U("maintainTrack.fmlf")}),G(l5,{value:"ref",children:U("maintainTrack.ref")})]})]})})]})]})}var lY=R(v(),1);function a9($){let[J,Q]=lY.useState(()=>$?.canvas?.ds?.scale??1);return lY.useEffect(()=>{if(!$?.canvas)return;let Z=$.canvas,q=Z.onDrawForeground?.bind(Z);return Z.onDrawForeground=(...X)=>{q?.(...X);let Y=Z.ds?.scale??1;Q((z)=>z!==Y?Y:z)},()=>{Z.onDrawForeground=q}},[$]),J}var iY=R(v(),1);function wJ($){let[J,Q]=iY.useState(0);return iY.useLayoutEffect(()=>{let Z=$.current;if(!Z)return;let q=new ResizeObserver(()=>Q(Z.clientWidth));return q.observe(Z),Q(Z.clientWidth),()=>q.disconnect()},[$]),J}var XI=R(v(),1);function YI($){let J=XI.useRef($);return J.current=$,J}function Lp($){if($&&typeof $==="object"&&!Array.isArray($)){let J=$;if(Array.isArray(J.tracks)&&typeof J.total_length==="number"&&typeof J.frame_rate==="number")return $}return zI()}function Fp($){return pY($.content)}var rY={current:-1};function Vp($,J,Q,Z,q){if(!(Q>=J.start_frame&&Q<=J.end_frame)){if(!$.paused)$.pause();return}if(Q!==rY.current){let Y=J.origin_start_frame??J.start_frame,K=(Q-Y)/Z;if(Math.abs($.currentTime-K)>0.1)$.currentTime=K;rY.current=Q}if(q){if($.paused&&$.readyState>=2)$.play().catch(()=>{})}else if(!$.paused)$.pause()}function Mp({value:$,onChange:J,app:Q,node:Z}){let q=Lp($),[X,Y]=B8.useState("frames"),[z,K]=B8.useState(null),W=B8.useRef(null),H=B8.useRef(null),B=wJ(H),[U,_]=B8.useState(!1),[L,F]=B8.useState(0),[V,M]=B8.useState(!1),D=B8.useRef(null),[N,O]=B8.useState(1),k=Q?.ui?.settings?.settingsValues?.["Comfy.VueNodes.Enabled"],I=Q?.ui?.settings?.settingsValues?.["Comfy.Locale"],b=a9(Q),A=B8.useRef({rafId:null,lastTimestamp:null,frame:0,audioEls:new Map}),w=Math.max(B,1)*N;function C(c){let i=H.current;if(!i||i.scrollWidth<=i.clientWidth)return;c.preventDefault(),c.stopPropagation();let f=c.deltaMode===1?16:c.deltaMode===2?i.clientWidth:1,o=Math.abs(c.deltaX)>Math.abs(c.deltaY)?c.deltaX:c.deltaY;i.scrollLeft=Math.max(0,Math.min(i.scrollWidth-i.clientWidth,i.scrollLeft+o*f))}let y=YI(q);B8.useEffect(()=>{A.current.frame=L},[L]);function x(){let{tracks:c}=y.current,i=A.current,f=c.filter((o)=>o.type==="audio").flatMap((o)=>o.segments);for(let o of f)if(!i.audioEls.has(o.id)){let G0=Fp(o);if(!G0)continue;let l=new Audio(G0);l.preload="auto",l.playbackRate=1,i.audioEls.set(o.id,l)}else{let G0=i.audioEls.get(o.id);if(G0.playbackRate===1)continue;G0.playbackRate=1}for(let[o,G0]of i.audioEls.entries())if(!f.some((l)=>l.id===o))G0.pause(),i.audioEls.delete(o)}function E(c,i){let{frame_rate:f,tracks:o}=y.current,G0=o.filter((l)=>l.type==="audio").flatMap((l)=>l.segments);for(let[l,Z0]of A.current.audioEls.entries()){let Q0=G0.find((B0)=>B0.id===l);if(Q0)Vp(Z0,Q0,c,f,i);else if(!Z0.paused)Z0.pause()}}B8.useEffect(()=>{x()},[q.tracks]),B8.useEffect(()=>{let c=A.current;if(!U){if(c.rafId!==null)cancelAnimationFrame(c.rafId),c.rafId=null,rY.current=-1;E(c.frame,!1);return}x();let i={current:0},f={current:0};function o(G0){let l=(G0-i.current)/1000,{frame_rate:Z0,total_length:Q0}=y.current,B0=f.current+l*Z0,W0=Math.min(Q0-1,B0);if(c.frame=W0,F(Math.round(W0)),E(W0,!0),W0>=Q0-1){if(_(!1),M(!0),D.current)clearTimeout(D.current);D.current=setTimeout(()=>M(!1),1500);return}c.rafId=requestAnimationFrame(o)}return i.current=performance.now(),f.current=c.frame,c.rafId=requestAnimationFrame(o),()=>{if(c.rafId!==null)cancelAnimationFrame(c.rafId)}},[U]),B8.useEffect(()=>{return()=>{for(let c of A.current.audioEls.values())c.pause()}},[]),B8.useEffect(()=>{if(!U||!H.current)return;let c=H.current,i=L/Math.max(q.total_length-1,1)*w,{scrollLeft:f,clientWidth:o}=c,G0=o*0.15;if(if+o-G0)c.scrollLeft=i-o+G0},[L,U,w,q.total_length]);function P(c){J({...q,...c})}function h(c,i){P({tracks:q.tracks.map((f)=>f.id===c?{...f,...i}:f)})}function p(c,i){P({tracks:q.tracks.map((f)=>f.id===c?{...f,segments:i}:f)})}function e(c){if(k)c.stopPropagation()}function S(){if(!U&&L>=q.total_length-1)F(0),A.current.frame=0;let c=U;if(_((i)=>!i),c){if(M(!0),D.current)clearTimeout(D.current);D.current=setTimeout(()=>M(!1),1500)}else M(!1)}function r(c){if(F(c),A.current.frame=c,rY.current=c,E(c,U),M(!0),!U){if(D.current)clearTimeout(D.current);D.current=setTimeout(()=>M(!1),1500)}}function $0(){if(!z)return;let c=q.tracks.map((i)=>{if(i.type!=="maintain")return{...i,segments:i.segments.filter((Q0)=>Q0.id!==z)};let f=i.segments,o=f.findIndex((Q0)=>Q0.id===z);if(o===-1)return i;if(f.length===1)return{...i,segments:[]};let G0=f[o],l=G0.end_frame-G0.start_frame+1,Z0=f.map((Q0,B0)=>{if(B0===o)return null;let W0={...Q0};if(B0>o)W0.start_frame=Q0.start_frame-l,W0.end_frame=Q0.end_frame-l;return W0}).filter((Q0)=>Q0!==null);if(o>0)Z0[o-1]={...Z0[o-1],end_frame:G0.start_frame-1};return{...i,segments:Z0}});P({tracks:c}),K(null)}let K0=q.tracks.find((c)=>c.type==="maintain"),t=K0&&z?K0.segments.find((c)=>c.id===z)??null:null;B8.useEffect(()=>{let c=W.current?.closest(".comfyui-react-widget");if(!c)return;let i=`${M8}-timeline-editor-open`;return c.classList.toggle(i,t!==null),()=>c.classList.remove(i)},[t]);function H0(c){if(!K0||!z)return;p(K0.id,K0.segments.map((i)=>i.id===z?{...i,content:{...i.content,...c}}:i))}function z0(c,i){if(!K0)return;let f=K0.segments,o=f.findIndex((_0)=>_0.id===c);if(o===-1)return;let G0=f[o],l=G0.end_frame-G0.start_frame+1;if(i===l)return;let Z0=i-l,Q0=G0.end_frame+Z0,B0=f.map((_0,N0)=>{if(N0Math.max(_0,N0.end_frame),0),L0=Math.max(q.total_length,W0+1);P({tracks:q.tracks.map((_0)=>_0.type==="maintain"?{..._0,segments:B0}:_0),total_length:L0})}function j(c){let i=c.target;if(i.closest("[data-edit-panel]")||i.closest("[data-segment-block]")||i.closest("[data-add-popover]")||i.closest("[data-media-selector]")||i.closest("[data-audio-popover]")||i.closest("[data-time-toolbar]")||i.closest("[data-radix-popper-content-wrapper]")||i.closest("[data-radix-context-menu-content]"))return;K(null)}let s=Math.min(1.5,Math.max(0.8,1/b)),u=B/s;return G(y6.Provider,{value:I,children:G(n1,{children:T("div",{ref:W,className:`relative flex flex-col h-full w-full text-foreground font-sans text-xs select-none${k?" nodeNew":""}`,onContextMenu:e,onClick:j,children:[T("div",{className:"flex flex-col flex-1 min-h-0 rounded overflow-hidden",children:[G(lN,{totalLength:q.total_length,frameRate:q.frame_rate,displayFormat:X,onTotalLengthChange:(c)=>{let i=q.total_length;if(c{if(l.end_frame>=c){let Z0=l.end_frame-l.start_frame+1,Q0=c-l.start_frame;return{...l,end_frame:c-1,content:{...l.content,images:NZ(l.content.images,Z0,Q0)}}}return l}),G0=5;for(let l=o.length-1;l>=0;l--){let Z0=o[l],Q0=Z0.end_frame-Z0.start_frame+1;if(Q0{if(L0===l)return null;let _0={...W0};if(L0>l)_0.start_frame=Math.max(0,W0.start_frame-B0),_0.end_frame=Math.max(0,W0.end_frame-B0);return _0}).filter((W0)=>W0!==null),l>0)o[l-1]={...o[l-1],end_frame:Z0.start_frame-1}}}P({tracks:q.tracks.map((l)=>l.type==="maintain"?{...l,segments:o}:l),total_length:c})}else P({total_length:c})},onFrameRateChange:(c)=>P({frame_rate:c}),onDisplayFormatChange:Y,isPlaying:U,onPlayPause:S,hasSelection:z!==null,canDelete:z!==null&&(q.tracks.some((c)=>c.type!=="maintain"&&c.segments.some((i)=>i.id===z))||(K0?.segments.length??0)>0),onDeleteSelected:$0,zoom:N,onZoomChange:O,selectedSegment:t,onSelectedSegmentDurationChange:z0}),G("div",{ref:H,className:"flex-1 min-h-0 overflow-x-hidden overflow-y-auto",children:T("div",{className:"h-full flex flex-col",style:{width:w,minWidth:"100%"},children:[G("div",{className:"border-t shrink-0",children:G(ZY,{totalFrames:q.total_length,frameRate:q.frame_rate,displayFormat:X,width:w,canvasScale:b,playheadFrame:L,showLabel:V||U,onSeek:r,onWheel:C})}),T("div",{className:"relative flex-1 min-h-0 flex flex-col",children:[L!==void 0&&w>0&&G("div",{className:"absolute top-0 h-full w-px bg-red-400 pointer-events-none z-30",style:{left:L/Math.max(q.total_length-1,1)*w}}),q.tracks.map((c)=>{if(c.type==="maintain")return G(Ik,{track:c,totalFrames:q.total_length,frameRate:q.frame_rate,displayFormat:X,areaWidth:w,canvasScale:b,selectedId:z,onSelectedIdChange:K,onTrackChange:(i)=>h(c.id,i),onSegmentsChange:(i)=>p(c.id,i),onExtendTimeline:(i,f)=>{P({tracks:q.tracks.map((o)=>o.type==="maintain"?{...o,segments:i}:o),total_length:f})},grow:2},c.id);if(c.type==="audio")return G($I,{track:c,totalFrames:q.total_length,frameRate:q.frame_rate,displayFormat:X,areaWidth:w,selectedId:z,onSelectedIdChange:K,onTrackChange:(i)=>h(c.id,i),onSegmentsChange:(i)=>p(c.id,i),node:Z,app:Q,grow:1},c.id);return null})]})]})})]}),t&&K0&&G("div",{className:"absolute left-0 z-50",style:{top:"100%",transformOrigin:"top left",transform:`scale(${s})`,width:u},children:G(qI,{segment:t,allSegments:K0.segments,totalFrames:q.total_length,frameRate:q.frame_rate,displayFormat:X,areaWidth:u,canvasScale:b*s,trackColor:K0.color,onContentChange:H0,onAllSegmentsChange:(c)=>{if(p(K0.id,c),z&&!c.some((i)=>i.id===z))K(null)},node:Z,app:Q})})]})})})}var i1=R(v(),1);var V6=R(v(),1),wB=50;function p4($){return JSON.stringify($)}function KI($,J){let[Q,Z]=V6.useState({past:[],future:[]}),q=V6.useRef($),X=V6.useRef(p4($)),Y=V6.useRef(p4($)),z=V6.useRef(new Set),K=V6.useRef(new Set),W=p4($);V6.useLayoutEffect(()=>{let _=z.current;if(_.size>0){if(_.has(W)){if(_.delete(W),_.size===0)K.current.clear();Y.current=W,X.current=W,q.current=$;return}if(W===Y.current||K.current.has(W))return;_.clear(),K.current.clear(),X.current=W,Y.current=W,q.current=$,Z({past:[],future:[]});return}if(q.current=$,W!==X.current){X.current=W,Y.current=W,Z({past:[],future:[]});return}Y.current=W},[$,W]);let H=V6.useCallback((_)=>{let L=q.current,F=p4(L),V=p4(_);if(V===F)return;X.current=V,z.current.add(V),K.current.add(F),q.current=_,Z((M)=>({past:[...M.past,L].slice(-wB),future:[]})),J(_)},[J]),B=V6.useCallback(()=>{Z((_)=>{let L=_.past.at(-1);if(!L)return _;let F=q.current,V=p4(F),M=p4(L);return X.current=M,z.current.add(M),K.current.add(V),q.current=L,J(L),{past:_.past.slice(0,-1),future:[F,..._.future].slice(0,wB)}})},[J]),U=V6.useCallback(()=>{Z((_)=>{let L=_.future[0];if(!L)return _;let F=q.current,V=p4(F),M=p4(L);return X.current=M,z.current.add(M),K.current.add(V),q.current=L,J(L),{past:[..._.past,F].slice(-wB),future:_.future.slice(1)}})},[J]);return{canUndo:Q.past.length>0,canRedo:Q.future.length>0,commitChange:H,undo:B,redo:U}}var oY=R(v(),1);var Dp=250;function kB($){try{return JSON.stringify($)}catch(J){return console.error("[useMultiTrackResolutionInput] failed to serialize resolution input:",J),String(Date.now())}}function nY($){let[J,Q]=oY.useState(()=>sY($));return oY.useEffect(()=>{let Z=sY($),q=kB(Z);Q((Y)=>kB(Y)===q?Y:Z);let X=window.setInterval(()=>{Z=sY($);let Y=kB(Z);if(Y===q)return;q=Y,Q(Z)},Dp);return()=>window.clearInterval(X)},[$]),J}var IB="easy-media-model-missing";class y2 extends Error{model;constructor($,J){super($);this.name="MissingModelError",this.model=J}}function Np($){if(!$||typeof $!=="object")return!1;let J=$;return typeof J.name==="string"&&typeof J.display_name==="string"&&typeof J.filename==="string"&&typeof J.directory==="string"&&typeof J.path==="string"&&typeof J.url==="string"&&(J.urls===void 0||Array.isArray(J.urls)&&J.urls.every((Q)=>typeof Q==="string"))}function aY($){return Np($)?$:null}function kJ($){if(!$||typeof $!=="object")return;let J=$,Q=aY(J.model_missing);if(!Q)return;let Z=typeof J.error==="string"?J.error:`${Q.display_name} model is not installed.`;throw new y2(Z,Q)}async function GI($){let J=await fetch("/easy-media/models/download",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model_name:$})}),Q;try{Q=await J.json()}catch(q){throw Error(`Model download returned invalid JSON: ${String(q)}`)}if(!J.ok){let q=Q&&typeof Q==="object"&&"error"in Q?String(Q.error):`Model download failed (${J.status})`;throw Error(q)}if(!Q||typeof Q!=="object")throw Error("Invalid model download response");let Z=aY(Q.model);if(!Z)throw Error("Invalid model download response");return Z}function Op($){if(!$||typeof $!=="object")throw Error("Invalid smart split response");let J=$;if(typeof J.error==="string")throw Error(J.error);if(!Array.isArray(J.ranges))throw Error("Invalid smart split response");return{ranges:J.ranges.map((Z)=>{if(!Array.isArray(Z)||Z.length!==2||!Z.every(Number.isFinite))throw Error("Invalid shot range in smart split response");return[Number(Z[0]),Number(Z[1])]})}}async function TB($,J){let Q=await fetch("/easy-media/video/smart-split",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source_type:$.content.source_type??"input",file_path:$.content.file_path,local_path:$.content.local_path,url:$.content.url,fps:J})}),Z;try{Z=await Q.json()}catch(q){throw Error(`Smart split returned invalid JSON: ${String(q)}`)}if(!Q.ok){kJ(Z);let q=Z&&typeof Z==="object"&&"error"in Z?String(Z.error):`Smart split failed (${Q.status})`;throw Error(q)}return Op(Z)}function tY($,J,Q){let Z=[$.start_frame,...J,$.end_frame];return Z.slice(0,-1).map((q,X)=>({...$,id:X===0?$.id:v1(),start_frame:q,end_frame:Z[X+1],...Q===void 0?{}:{origin_start_frame:Q},content:{...$.content,images:$.content.images?.map((Y)=>({...Y}))}}))}function bB($,J){return $.tracks.find((Q)=>Q.type==="video"&&Q.segments.some((Z)=>Z.id===J))?.segments.find((Q)=>Q.id===J)}function WI($,J){let Q=$.origin_start_frame??$.start_frame;return[...new Set(J.ranges.map((Z)=>Z[1]+Q).filter((Z)=>Z>$.start_frame&&Z<$.end_frame))].sort((Z,q)=>Z-q)}function HI($,J){let Q=bB($,J);if(!Q)return!1;return $.tracks.some((Z)=>Z.type==="task"&&Z.segments.some((q)=>q.start_frame===Q.start_frame&&q.end_frame===Q.end_frame))}function BI($,J,Q){let Z=bB($,J);if(!Z)return $;let q=Z.end_frame-Z.start_frame,X=Z.origin_start_frame??Z.start_frame,Y=WI(Z,Q);if(q<=1||Y.length===0)return $;let z=$.tracks.map((K)=>({...K,segments:K.segments.flatMap((W)=>{let H=W.id===J,B=K.type==="task"&&W.start_frame===Z.start_frame&&W.end_frame===Z.end_frame;if(H)return tY(W,Y,X);return B?tY(W,Y):[W]}).sort((W,H)=>W.start_frame-H.start_frame)}));return{...$,tracks:z}}function UI($,J,Q){let Z=bB($,J);if(!Z)return $;let q=WI(Z,Q);if(q.length===0)return $;return{...$,tracks:$.tracks.map((X)=>({...X,segments:X.segments.flatMap((Y)=>X.type==="task"&&Y.start_frame===Z.start_frame&&Y.end_frame===Z.end_frame?tY(Y,q):[Y]).sort((Y,z)=>Y.start_frame-z.start_frame)}))}}function jB($,J,Q){let Z=$.tracks.flatMap((z)=>z.segments).find((z)=>z.id===J),q=Math.round(Q);if(!Z||q<=Z.start_frame||q>=Z.end_frame)return $;let Y=Z.content.media_type==="video"||Z.content.media_type==="audio"?Z.origin_start_frame??Z.start_frame:void 0;return{...$,tracks:$.tracks.map((z)=>({...z,segments:z.segments.flatMap((K)=>K.id===J?tY(K,[q],Y):[K]).sort((K,W)=>K.start_frame-W.start_frame)}))}}var P2="#9D4937",C2={font_size:12,color:"#ffffff",outline_color:"#000000",background_color:"rgba(0, 0, 0, 0)",background_opacity:0.7,x:0.125,y:0.8,width:0.75};function Ap($){if(!$||typeof $!=="object")throw Error("Invalid subtitle segment");let J=$,Q=Number(J.start),Z=Number(J.end);if(!Number.isFinite(Q)||!Number.isFinite(Z)||Z<=Q)throw Error("Invalid subtitle timestamp");if(typeof J.text!=="string")throw Error("Invalid subtitle text");return{start:Q,end:Z,text:J.text}}function wp($){if(!$||typeof $!=="object")throw Error("Invalid subtitle recognition response");let J=$;if(typeof J.error==="string")throw Error(J.error);if(!Array.isArray(J.segments))throw Error("Invalid subtitle recognition response");return{segments:J.segments.map(Ap)}}function kp($,J){return $.tracks.find((Q)=>(Q.type==="video"||Q.type==="audio")&&Q.segments.some((Z)=>Z.id===J))?.segments.find((Q)=>Q.id===J)}function Ip($){return{id:v1(),name:`Subtitle ${$+1}`,type:"subtitle",color:P2,muted:!1,solo:!1,volume_db:R2,locked:!1,segments:[]}}async function _I($,J,Q="qwen3-asr"){let Z=await fetch("/easy-media/subtitles/recognize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({media_type:$.content.media_type,source_type:$.content.source_type??"input",file_path:$.content.file_path,local_path:$.content.local_path,url:$.content.url,fps:J,start_frame:$.start_frame,end_frame:$.end_frame,origin_start_frame:$.origin_start_frame,method:Q})}),q;try{q=await Z.json()}catch(X){throw Error(`Subtitle recognition returned invalid JSON: ${String(X)}`)}if(!Z.ok){kJ(q);let X=q&&typeof q==="object"&&"error"in q?String(q.error):`Subtitle recognition failed (${Z.status})`;throw Error(X)}return wp(q)}function LI($,J,Q){let Z=kp($,J);if(!Z||Q.segments.length===0)return $;let q=Q.segments.flatMap((K)=>{let W=Math.max(Z.start_frame,Z.start_frame+R9(K.start,$.frame_rate)),H=Math.min(Z.end_frame,Z.start_frame+R9(K.end,$.frame_rate));if(H<=W)return[];return[{id:v1(),start_frame:W,end_frame:H,color:P2,content:{media_type:"subtitle",text:K.text,subtitle_style:{...C2}}}]});if(q.length===0)return $;let X=!1,Y=$.tracks.map((K)=>{if(K.type!=="subtitle")return K;if(X)return K;return X=!0,{...K,color:K.color||P2,segments:[...K.segments,...q].sort((W,H)=>W.start_frame-H.start_frame)}}),z=X?Y:[...$.tracks,{...Ip($.tracks.filter((K)=>K.type==="subtitle").length),segments:q}];return{...$,tracks:z,total_length:U8(z,$.frame_rate)}}var bZ={model:"VoxCPM2",prompt:"",cfg:2,steps:10,referenceAudio:"",referenceAudioSourceType:"input"};async function Tp($){if(!$.referenceAudio)return{path:void 0,sourceType:void 0};if(!/^https?:\/\//i.test($.referenceAudio))return{path:$.referenceAudio,sourceType:$.referenceAudioSourceType??"input"};let J=await fetch("/easy-media/download-url",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:$.referenceAudio})}),Q;try{Q=await J.json()}catch(q){throw Error(`Reference audio download returned invalid JSON: ${String(q)}`)}let Z=Q&&typeof Q==="object"&&"file_name"in Q?Q.file_name:void 0;if(!J.ok||typeof Z!=="string"||!Z){let q=Q&&typeof Q==="object"&&"error"in Q?String(Q.error):`Reference audio download failed (${J.status})`;throw Error(q)}return{path:Z,sourceType:"input"}}function bp($){if(!$||typeof $!=="object")throw Error("Invalid subtitle speech response");let J=$;if(typeof J.error==="string")throw Error(J.error);if(typeof J.file_path!=="string"||J.source_type!=="output")throw Error("Invalid subtitle speech response");return{filePath:J.file_path,sourceType:"output",absolutePath:typeof J.absolute_path==="string"?J.absolute_path:"",message:typeof J.message==="string"?J.message:"",duration:typeof J.duration==="number"&&Number.isFinite(J.duration)?J.duration:void 0}}async function FI($){let J=await Tp($),Q=await fetch("/easy-media/subtitles/speech",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:$.text,model:$.model,prompt:$.prompt,cfg:$.cfg,steps:$.steps,reference_audio_path:J.path,reference_audio_source_type:J.sourceType})}),Z;try{Z=await Q.json()}catch(q){throw Error(`Subtitle speech returned invalid JSON: ${String(q)}`)}if(!Q.ok){kJ(Z);let q=Z&&typeof Z==="object"&&"error"in Z?String(Z.error):`Subtitle speech failed (${Q.status})`;throw Error(q)}return bp(Z)}function jp($,J,Q,Z){return Math.max($,Q){if(H.type!=="audio"||z)return H;if(H.segments.some((U)=>jp(J.startFrame,X,U.start_frame,U.end_frame)))return H;return z=!0,{...H,segments:[...H.segments,Y].sort((U,_)=>U.start_frame-_.start_frame)}}),W=z?K:[...K,Ep($.tracks.filter((H)=>H.type==="audio").length,Y)];return{...$,tracks:W,total_length:U8(W,$.frame_rate)}}var yp=/^(\d+):([0-5]\d):([0-5]\d)[,.](\d{3})\s*-->\s*(\d+):([0-5]\d):([0-5]\d)[,.](\d{3})(?:\s+.*)?$/;function MI($){let[J,Q,Z,q]=$.map(Number);return J*3600+Q*60+Z+q/1000}function Pp($){let J=$.replace(/^\uFEFF/,"").replaceAll(`\r +`,` +`).replaceAll("\r",` +`).split(` +`),Q=[];for(let Z=0;ZX)Q.push({startSeconds:X,endSeconds:Y,text:K})}return Q}function DI($,J){let Q=Pp($).sort((q,X)=>q.startSeconds-X.startSeconds||q.endSeconds-X.endSeconds);if(Q.length===0)throw Error("No valid SRT subtitle cues found");let Z=Q[0].startSeconds;return Q.map((q,X)=>{let Y=J.startFrame+Math.round((q.startSeconds-Z)*J.frameRate),z=Math.max(Y+1,J.startFrame+Math.round((q.endSeconds-Z)*J.frameRate));return{id:J.createId(X),start_frame:Y,end_frame:z,color:J.color,content:{media_type:"subtitle",text:q.text,subtitle_style:{...J.subtitleStyle}}}})}function EB($,J){if(!J)return!1;try{return new URL($,J).origin===new URL(J).origin}catch(Q){return console.error("[audio-utils] failed to resolve media origin:",Q),!1}}function NI($,J,Q=globalThis.location?.href){let q=10**((Number.isFinite($)?$:0)/20);return EB(J,Q)?q:Math.min(1,q)}function yB($){return new Promise((J,Q)=>{let Z=new Audio,q=()=>{Z.removeEventListener("loadedmetadata",X),Z.removeEventListener("error",Y),Z.src=""},X=()=>{let z=Z.duration;if(q(),!Number.isFinite(z)||z<=0){Q(Error(`Invalid audio duration for ${$}`));return}J({duration:z})},Y=()=>{q(),Q(Error(`Unable to load audio metadata for ${$}`))};Z.addEventListener("loadedmetadata",X),Z.addEventListener("error",Y),Z.preload="metadata",Z.src=$})}function jZ($){return new Promise((J,Q)=>{let Z=document.createElement("video");Z.preload="metadata",Z.muted=!0,Z.onloadedmetadata=()=>{J({duration:Number.isFinite(Z.duration)?Z.duration:0,width:Z.videoWidth,height:Z.videoHeight})},Z.onerror=()=>Q(Error(`Unable to load video metadata: ${$}`)),Z.src=$})}function OI($,J=0.1){return new Promise((Q,Z)=>{let q=document.createElement("video");q.preload="auto",q.muted=!0,q.playsInline=!0;function X(){try{let{videoWidth:Y,videoHeight:z}=q;if(Y<=0||z<=0){Z(Error(`Unable to capture video frame: ${$}`));return}let K=document.createElement("canvas");K.width=Y,K.height=z;let W=K.getContext("2d");if(!W){Z(Error("Unable to create canvas context for video frame"));return}W.drawImage(q,0,0,Y,z),K.toBlob((H)=>{if(!H){Z(Error(`Unable to encode video frame: ${$}`));return}Q(URL.createObjectURL(H))},"image/jpeg",0.8)}catch(Y){Z(Y instanceof Error?Y:Error(`Unable to capture video frame: ${$}`))}}q.onloadeddata=()=>{let Y=Number.isFinite(q.duration)?Math.max(0,Math.min(J,Math.max(0,q.duration-0.001))):Math.max(0,J);if(Y>0){q.currentTime=Y;return}X()},q.onseeked=X,q.onerror=()=>Z(Error(`Unable to load video frame: ${$}`)),q.src=$})}var eY=R(v(),1);var AI=EZ("SplitCenterIcon",[["path",{d:"M5 4h4v16H5",key:"left-bracket"}],["path",{d:"M19 4h-4v16h4",key:"right-bracket"}]]),wI=EZ("SplitLeftDotsIcon",[["path",{d:"M20 4h-4v16h4",key:"bracket"}],["path",{d:"M6 4h.01",key:"d1"}],["path",{d:"M6 20h.01",key:"d3"}],["path",{d:"M11 4h.01",key:"d4"}],["path",{d:"M11 8h.01",key:"d5"}],["path",{d:"M11 12h.01",key:"d6"}],["path",{d:"M11 16h.01",key:"d7"}],["path",{d:"M11 20h.01",key:"d8"}]]),kI=EZ("SplitRightDotsIcon",[["path",{d:"M4 4h4v16H4",key:"bracket"}],["path",{d:"M13 4h.01",key:"d1"}],["path",{d:"M13 8h.01",key:"d2"}],["path",{d:"M13 12h.01",key:"d3"}],["path",{d:"M13 16h.01",key:"d4"}],["path",{d:"M13 20h.01",key:"d5"}],["path",{d:"M18 4h.01",key:"d6"}],["path",{d:"M18 20h.01",key:"d8"}]]),IJ=EZ("TaskMarkerIcon",[["path",{d:"M7.5 4.75h9a1 1 0 0 1 1 1v8.5L12 20l-5.5-5.75V5.75a1 1 0 0 1 1-1Z",key:"task-marker"}]]);function II({marker:$,markerNumber:J,frameRate:Q,left:Z,selected:q,dragging:X,onSelect:Y,onDragStart:z,onDelete:K}){let W=q1(),H=W("multitrack.taskMarkerLabel",{n:J.toString().padStart(2,"0")}),B=M6($.frame,{frameRate:Q,showFrames:!0,showHours:!1});return T(n6,{children:[T(H1,{children:[G(B1,{asChild:!0,children:G(a6,{asChild:!0,children:T(k0,{type:"button",variant:"ghost",size:"icon",className:`absolute top-0 z-30 h-6 w-5 -translate-x-1/2 rounded-none p-0 hover:bg-transparent ${X?"cursor-grabbing":"cursor-grab"} ${q?"opacity-100":"opacity-90"}`,style:{left:Z,color:"var(--highlight)"},"aria-label":W("multitrack.taskMarkerAtFrame",{frame:$.frame}),"aria-pressed":q,onMouseDown:(U)=>{U.preventDefault(),U.stopPropagation(),Y($.id),z($.id,U.clientX)},onContextMenu:(U)=>{U.stopPropagation(),Y($.id)},onClick:(U)=>{U.stopPropagation()},children:[G("span",{className:"absolute left-1/2 top-0 h-2 w-px -translate-x-1/2 bg-border"}),G(IJ,{className:"absolute left-1/2 top-1 h-4 w-4 -translate-x-1/2 fill-current stroke-current"})]})})}),T(W1,{side:"bottom",sideOffset:3,className:"min-w-24 rounded-md border border-border bg-popover px-2 py-1.5 text-popover-foreground shadow-md",children:[G("div",{className:"text-[10px] font-medium leading-4",children:H}),G("div",{className:"text-[11px] leading-4 tabular-nums",children:B})]})]}),G(E6,{children:T(Q5,{onClick:()=>K($.id),children:[G(D5,{className:"mr-2 h-3.5 w-3.5"}),W("multitrack.deleteTaskMarker")]})})]})}var q5=28,S2=48,PB=56,RB=[1,2,5,10,15,30,60,120,300];function Rp($,J,Q){let Z=Math.max(1,J),q=Math.max($,1),X=Q/q,Y=X>=6,z=[],K=Number.NEGATIVE_INFINITY;function W(L){return(L-K)*X>=PB}function H(L,F,V){if(F)K=L;z.push({time:L,label:F,major:V})}if(Y){let L=Math.max(1,Math.ceil(PB/Math.max(X,1))),F=Math.max(1,Math.round(Z/8)),V=Math.max(1,Math.ceil(L/F)*F);for(let M=0;M<=$;M+=1){let D=M%V===0,N=M===$&&W(M),O=D||N;H(M,O?M6(M,{frameRate:Z,showFrames:!0}):void 0,O)}return z}let B=PB/Math.max(X*Z,1),U=RB.find((L)=>L>=B)??RB[RB.length-1],_=Math.max(1,Math.round(U*Z));for(let L=0;L<=$;L+=_)H(L,M6(L,{frameRate:Z,showFrames:!0}),!0);if(z.at(-1)?.time!==$&&W($))H($,M6($,{frameRate:Z,showFrames:!0}),!0);return z}function $z({totalLength:$,frameRate:J,width:Q,canvasScale:Z,currentTime:q,taskMarkers:X,selectedTaskMarkerId:Y,onSeek:z,onSelectTaskMarker:K,onMoveTaskMarker:W,onDeleteTaskMarker:H}){let B=eY.useRef(null),[U,_]=eY.useState(null),L=Math.max(1,Q-q5),F=Math.max(1,L-S2),V=Rp($,J,F),M=Math.max($,1),D=q5+q/M*F,N=q5+F;function O(A){let w=A/Math.max(Q,1);return Number.isFinite(w)&&w>0.01?w:Math.max(Z,0.01)}function k(A,w,C){let x=Math.max(0,(A-w)/C-q5)/F;return Math.max(0,Math.min($,Math.round(x*$)))}function I(A){A.preventDefault();let w=A.currentTarget.getBoundingClientRect(),C=O(w.width);z(k(A.clientX,w.left,C));function y(E){z(k(E.clientX,w.left,C))}function x(){globalThis.removeEventListener("mousemove",y),globalThis.removeEventListener("mouseup",x)}globalThis.addEventListener("mousemove",y),globalThis.addEventListener("mouseup",x)}function b(A,w){let C=X.find((r)=>r.id===A);if(!C)return;let y=B.current?.getBoundingClientRect(),x=y?.left??0,E=O(y?.width??0),P=C.frame,h=P;function p(r){let $0=Math.max(1,k(r,x,E));if(X.some((t)=>t.id!==A&&t.frame===$0))return;h=$0,_({markerId:A,frame:$0})}function e(r){p(r.clientX)}function S(r){if(p(r.clientX),globalThis.removeEventListener("mousemove",e),globalThis.removeEventListener("mouseup",S),_(null),h!==P)W(A,h)}p(w),globalThis.addEventListener("mousemove",e),globalThis.addEventListener("mouseup",S)}return T("div",{ref:B,className:`relative h-6 shrink-0 select-none border-b border-border ${U?"cursor-grabbing":"cursor-col-resize"}`,style:{width:Q},onMouseDown:I,children:[G("div",{className:"absolute left-0 top-0 h-full border-r border-border",style:{width:q5}}),G("div",{className:"pointer-events-none absolute top-0 h-full bg-black/30",style:{left:N,width:S2}}),V.map((A)=>T("div",{className:"absolute bottom-0 flex h-full flex-col justify-end",style:{left:q5+A.time/M*F},children:[G("div",{className:A.major?"h-3 w-px bg-border":"h-1.5 w-px bg-border"}),A.label&&G("span",{className:"absolute left-1 top-1 text-[8px] text-muted-foreground",children:A.label})]},`${A.time}-${A.major?"major":"minor"}`)),X.map((A,w)=>{let C=U?.markerId===A.id,y=C?{...A,frame:U.frame}:A;return G(II,{marker:y,markerNumber:w+1,frameRate:J,left:q5+y.frame/M*F,selected:y.id===Y,dragging:C,onSelect:K,onDragStart:b,onDelete:H},y.id)}),G("div",{className:"absolute top-0 h-full w-px bg-destructive",style:{left:D}})]})}var C9="h-6 w-6 shrink-0 [&_svg]:size-3.5",D6="size-3.5";function EI({currentTime:$,totalLength:J,frameRate:Q,isPlaying:Z,zoom:q,snapEnabled:X,taskOverview:Y,timelineCollapsed:z,onPlayPause:K,onZoomChange:W,onSnapEnabledChange:H,canAddTaskMarker:B,onAddTaskMarker:U,onTaskOverviewChange:_,onToggleTimeline:L,canDelete:F,onDeleteSelected:V,onCutAtCurrentTime:M,canTrimCenter:D,canTrimLeft:N,canTrimRight:O,onTrimLeftAtCurrentTime:k,onTrimRightAtCurrentTime:I,canUndo:b,canRedo:A,onUndo:w,onRedo:C}){let y=q1();function x(E,P){return T(H1,{children:[G(B1,{asChild:!0,children:G("span",{className:"inline-flex shrink-0",children:P})}),G(W1,{children:E})]})}return T("div",{className:"grid h-9 min-h-9 shrink-0 grid-cols-[1fr_auto_1fr] items-center overflow-hidden border-b border-border text-[10px] leading-none",children:[T("div",{className:"flex items-center",children:[x(y("multitrack.undo"),G(k0,{type:"button",variant:"ghost",size:"icon",className:`${C9} text-muted-foreground cursor-pointer`,disabled:!b,"aria-label":y("multitrack.undo"),onClick:(E)=>{E.stopPropagation(),w()},children:G(jI,{className:D6})})),x(y("multitrack.redo"),G(k0,{type:"button",variant:"ghost",size:"icon",className:`${C9} text-muted-foreground cursor-pointer`,disabled:!A,"aria-label":y("multitrack.redo"),onClick:(E)=>{E.stopPropagation(),C()},children:G(bI,{className:D6})})),x(y("multitrack.cutMode"),G(k0,{type:"button",variant:"ghost",size:"icon",className:`${C9} text-muted-foreground cursor-pointer`,disabled:!D,"aria-label":y("multitrack.cutMode"),onClick:(E)=>{E.stopPropagation(),M()},children:G(AI,{className:D6})})),x(y("multitrack.trimLeftAtPlayhead"),G(k0,{type:"button",variant:"ghost",size:"icon",className:`${C9} text-muted-foreground cursor-pointer`,disabled:!N,"aria-label":y("multitrack.trimLeftAtPlayhead"),onClick:(E)=>{E.stopPropagation(),k()},children:G(wI,{className:D6})})),x(y("multitrack.trimRightAtPlayhead"),G(k0,{type:"button",variant:"ghost",size:"icon",className:`${C9} text-muted-foreground cursor-pointer`,disabled:!O,"aria-label":y("multitrack.trimRightAtPlayhead"),onClick:(E)=>{E.stopPropagation(),I()},children:G(kI,{className:D6})})),x(y("multitrack.deleteSelectedSegment"),G(k0,{type:"button",variant:"ghost",size:"icon",className:`${C9} text-muted-foreground cursor-pointer`,disabled:!F,"aria-label":y("multitrack.deleteSelectedSegment"),onClick:(E)=>{E.stopPropagation(),V()},children:G(D5,{className:D6})})),x(y("multitrack.addTaskMarker"),G(k0,{type:"button",variant:"ghost",size:"icon",className:`${C9} text-muted-foreground cursor-pointer`,disabled:!B,"aria-label":y("multitrack.addTaskMarker"),onClick:(E)=>{E.stopPropagation(),U()},children:G(IJ,{className:D6})}))]}),T("div",{className:"flex items-center gap-2 text-muted-foreground",children:[G("span",{className:"w-16 text-right tabular-nums text-gradient",children:M6($,{frameRate:Q,showFrames:!0})}),x(Z?y("multitrack.pause"):y("multitrack.play"),G(k0,{type:"button",variant:"secondary",size:"icon",className:`${C9} text-foreground rounded-full cursor-pointer`,"aria-label":Z?y("multitrack.pause"):y("multitrack.play"),onClick:K,children:Z?T("svg",{className:D6,viewBox:"0 0 24 24",fill:"none",children:[G("defs",{children:T("linearGradient",{id:"icon-gradient-pause",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[G("stop",{offset:"0%",stopColor:"var(--primary)"}),G("stop",{offset:"100%",stopColor:"var(--highlight)"})]})}),G("rect",{x:"6",y:"5",width:"4",height:"14",rx:"1",fill:"url(#icon-gradient-pause)"}),G("rect",{x:"14",y:"5",width:"4",height:"14",rx:"1",fill:"url(#icon-gradient-pause)"})]}):T("svg",{className:D6,viewBox:"0 0 24 24",fill:"none",children:[G("defs",{children:T("linearGradient",{id:"icon-gradient-play",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[G("stop",{offset:"0%",stopColor:"var(--primary)"}),G("stop",{offset:"100%",stopColor:"var(--highlight)"})]})}),G("path",{d:"M8 5.5v13l11-6.5L8 5.5z",fill:"url(#icon-gradient-play)"})]})})),G("span",{className:"w-16 tabular-nums",children:M6(J,{frameRate:Q,showFrames:!0})})]}),T("div",{className:"ml-auto flex h-6 max-h-6 min-h-6 items-center gap-0.5 overflow-hidden",children:[x(y("multitrack.taskOverview"),G(k0,{type:"button",variant:Y?"outline":"ghost",size:"icon",className:`${C9} cursor-pointer ${Y?"text-highlight":"text-muted-foreground"}`,"aria-label":y("multitrack.taskOverview"),"aria-pressed":Y,onClick:(E)=>{E.stopPropagation(),_(!Y)},children:G(Jz,{className:D6})})),x(y("multitrack.timelineSnap"),G(k0,{type:"button",variant:X?"outline":"ghost",size:"icon",className:`${C9} cursor-pointer ${X?"text-highlight":"text-muted-foreground"}`,"aria-label":y("multitrack.timelineSnap"),"aria-pressed":X,onClick:(E)=>{E.stopPropagation(),H(!X)},children:G(TI,{className:D6})})),x(z?y("multitrack.showTimeline"):y("multitrack.hideTimeline"),G(k0,{type:"button",variant:"ghost",size:"icon",className:`${C9} text-muted-foreground cursor-pointer`,"aria-label":z?y("multitrack.showTimeline"):y("multitrack.hideTimeline"),onClick:(E)=>{E.stopPropagation(),L()},children:z?G(Qz,{className:D6}):G(Zz,{className:D6})})),x(y("multitrack.timelineZoom"),G("span",{className:"inline-flex shrink-0","aria-label":y("multitrack.timelineZoom"),children:G($J,{className:`${D6} text-muted-foreground`})})),G("div",{className:"relative h-3 max-h-3 min-h-3 w-12 overflow-visible",children:G(N8,{min:1,max:6,step:0.25,value:[q],onValueChange:([E])=>W(E),className:"absolute inset-0 h-3 max-h-3 min-h-3 w-12 [&_[role=slider]]:h-2.5 [&_[role=slider]]:w-2.5 [&_[data-orientation=horizontal]]:h-1","aria-label":y("multitrack.timelineZoom")})})]})]})}var k5=R(v(),1);var Cp=yI("inline-flex items-center rounded-md border px-2 py-0.5 text-xs font-medium transition-colors focus:outline-none focus:ring-1 focus:ring-ring",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function TJ({className:$,variant:J,...Q}){return G("div",{className:b0(Cp({variant:J}),$),...Q})}var w7=R(v(),1),CB=1,Sp=6,PI=1.15,RI={x:50,y:50};function qz($,J){let Q=w7.useRef(null),[Z,q]=w7.useState(CB),[X,Y]=w7.useState(RI);w7.useEffect(()=>{q(CB),Y(RI)},[$]),w7.useEffect(()=>{if(!$)return;let K=(W)=>{if(W.key==="Escape")J()};return document.addEventListener("keydown",K),()=>document.removeEventListener("keydown",K)},[$,J]);function z(K){K.preventDefault(),K.stopPropagation();let W=Q.current?.getBoundingClientRect();if(W&&W.width>0&&W.height>0)Y({x:Math.max(0,Math.min(100,(K.clientX-W.left)/W.width*100)),y:Math.max(0,Math.min(100,(K.clientY-W.top)/W.height*100))});let H=K.deltaY<0?PI:1/PI;q((B)=>Math.max(CB,Math.min(Sp,B*H)))}return{imageRef:Q,zoom:Z,origin:X,onWheel:z}}var Yz=R(v(),1);function hp($){let J=t9.findIndex((Z)=>Z===$);if(J>=0)return J;let Q=t9.findIndex((Z)=>Z===h2);if(!Number.isFinite($)||$<=0)return Math.max(0,Q);return t9.reduce((Z,q,X)=>{let Y=t9[Z]??h2;return Math.abs(q-$){M(F)},[F]);function D(b){let A=xB(b);if(B){K({volume_db:A});return}z({volume_db:A})}function N(){if(B){K({muted:!L});return}z({muted:!$})}function O(b){let A=Math.max(0,Math.min(t9.length-1,Math.round(b))),w=t9[A]??h2;if(w!==Q)z({frame_rate:w})}function k(){let b=Xz(V,Q);if(b===null){M(F);return}if(M(bJ(b,Q)),b!==X)W(b)}let I=hp(Q);return T("div",{className:"absolute top-1/2 z-20 flex -translate-y-1/2 flex-col overflow-hidden rounded-lg border border-border bg-popover/90 text-popover-foreground shadow-lg backdrop-blur",style:{right:Y},children:[T(a1,{children:[G(T5,{asChild:!0,children:T(k0,{type:"button",variant:"ghost",className:"flex h-12 w-10 flex-col gap-1 rounded-none px-1 py-1 cursor-pointer","aria-label":H("multitrack.audioSettings"),children:[L?G(jJ,{className:"h-4 w-4"}):G(e9,{className:"h-4 w-4"}),G("span",{className:"text-[8px]",children:U})]})}),T(s1,{className:"w-56 space-y-3",align:"end",side:"left",children:[T("div",{className:"flex items-center justify-between gap-3 cursor-pointer",children:[G("span",{className:"text-sm font-medium",children:U}),G(k0,{type:"button",variant:"secondary",size:"sm",className:"cursor-pointer","aria-label":L?H("multitrack.unmutePreviewAudio"):H("multitrack.mutePreviewAudio"),onClick:N,children:L?H("multitrack.unmute"):H("multitrack.mute")})]}),T("div",{className:"grid gap-2 text-xs text-muted-foreground",children:[T("span",{className:"flex items-center justify-between",children:[G("span",{children:H("multitrack.volume")}),T("span",{className:"tabular-nums text-foreground",children:[_.toFixed(1)," dB"]})]}),G(e8,{"aria-label":H("multitrack.volume"),min:SB,max:hB,step:0.1,className:"cursor-pointer",value:_,onChange:D})]}),G(N8,{"aria-label":H("multitrack.volume"),className:"cursor-pointer",value:[xB(_)],min:SB,max:hB,step:0.1,onValueChange:(b)=>D(b[0]??0)})]})]}),G("div",{className:"mx-3 h-px bg-border"}),T(a1,{children:[G(T5,{asChild:!0,children:T(k0,{type:"button",variant:"ghost",className:"flex h-12 w-10 flex-col gap-1 rounded-none px-1 py-1 cursor-pointer","aria-label":H("multitrack.fpsSettings"),children:[G(CI,{className:"h-4 w-4"}),G("span",{className:"text-[8px]",children:H("multitrack.frameRate")})]})}),G(s1,{className:"w-72 space-y-4",align:"end",side:"left",children:T("div",{className:"grid gap-3 text-xs text-muted-foreground",children:[T("div",{className:"flex items-center justify-between",children:[G("span",{children:H("multitrack.frameRate")}),T("span",{className:"tabular-nums text-foreground",children:[t9[I]??h2," ",H("multitrack.fps")]})]}),G(N8,{"aria-label":H("multitrack.frameRate"),value:[I],min:0,max:t9.length-1,step:1,ticks:t9.map((b,A)=>({value:A,label:String(b)})),onValueChange:(b)=>O(b[0]??I)}),X!==null&&T("label",{className:"grid gap-2 pt-2",children:[H("multitrack.duration"),G($6,{"aria-label":H("multitrack.duration"),type:"text",inputMode:"numeric",placeholder:"00:00:00",className:"tabular-nums",value:V,onChange:(b)=>M(b.currentTarget.value),onBlur:k,onKeyDown:(b)=>{if(b.key!=="Enter")return;b.preventDefault(),k()}})]})]})})]})]})}var K9=R(v(),1);function xp({source:$,isPlaying:J,playbackNonce:Q=0}){let Z=K9.useRef(null),q=K9.useRef(null),X=K9.useRef(null),Y=K9.useMemo(()=>Z5({source_type:$.segment.content.source_type??"input",file_path:$.segment.content.file_path,local_path:$.segment.content.local_path,url:$.segment.content.url,slot_name:$.segment.content.slot_name}),[$.segment.content]),z=globalThis.location?.href,K=Y?NI($.volumeDb,Y,z):0,W=Y?EB(Y,z):!1;return K9.useEffect(()=>()=>{let H=Z.current;if(!H)return;H.pause(),H.src=""},[]),K9.useEffect(()=>{let H=Z.current,B=globalThis.AudioContext;if(!H||!Y||!B)return;if(!W)return;try{let U=new B,_=U.createGain();return U.createMediaElementSource(H).connect(_).connect(U.destination),q.current=U,X.current=_,H.volume=1,()=>{_.disconnect(),X.current=null,q.current=null,U.close().catch((L)=>{console.error("[PreviewAudioPlayback] failed to close audio context:",L)})}}catch(U){console.error("[PreviewAudioPlayback] failed to create audio gain graph:",U)}},[W,Y]),K9.useEffect(()=>{let H=Z.current;if(!H)return;if(X.current){X.current.gain.value=K;return}H.volume=Math.max(0,Math.min(1,K))},[K]),K9.useEffect(()=>{let H=Z.current;if(!H||J||Math.abs(H.currentTime-$.localTime)<=0.001)return;try{H.currentTime=$.localTime}catch(B){console.error("[PreviewAudioPlayback] failed to seek audio:",B)}},[J,$.localTime]),K9.useEffect(()=>{let H=Z.current;if(!H)return;if(!J){H.pause();return}q.current?.resume().catch((U)=>{console.error("[PreviewAudioPlayback] failed to resume audio context:",U)});try{H.currentTime=$.localTime}catch(U){console.error("[PreviewAudioPlayback] failed to seek audio before playback:",U)}H.play()?.catch((U)=>{console.error("[PreviewAudioPlayback] failed to play audio:",U)})},[J,$.segment.id,Y,Q]),Y?G("audio",{ref:Z,"data-testid":`preview-audio-${$.segment.id}`,src:Y,preload:"auto",className:"hidden"}):null}function hI({sources:$,isPlaying:J,playbackNonce:Q=0}){return $.map((Z)=>G(xp,{source:Z,isPlaying:J,playbackNonce:Q},`${Z.trackId}:${Z.segment.id}`))}var fp={version:1,projection:"equirectangular",yaw:0,pitch:0,hfov:90,aspect_ratio:1};function fI($,J,Q){return Math.min(Q,Math.max(J,$))}function zz($){return typeof $==="number"&&Number.isFinite($)}function xI($){return(($+180)%360+360)%360-180}function vp($){if(!$||typeof $!=="object"||Array.isArray($))return!1;let J=$;return J.version===1&&J.projection==="equirectangular"&&zz(J.yaw)&&zz(J.pitch)&&zz(J.hfov)&&zz(J.aspect_ratio)&&J.aspect_ratio>0}function vI($){if(!vp($))return{...fp};return{version:1,projection:"equirectangular",yaw:xI($.yaw),pitch:xI($.pitch),hfov:fI($.hfov,30,120),aspect_ratio:$.aspect_ratio}}function gI($,J){if(!Number.isFinite(J)||J<=0)throw RangeError("Panorama aspect ratio must be a positive finite number");let Q=fI($,30,120)*Math.PI/180;return 2*Math.atan(Math.tan(Q/2)/J)*180/Math.PI}function Kz({alt:$,className:J,imageId:Q,imageUrl:Z,view:q}){let X=vI(q),Y=gI(X.hfov,1.7777777777777777),z=360/X.hfov*100,K=50-X.yaw/X.hfov*100,W=50+X.pitch/Y*100;return G("div",{"data-testid":`panorama-image-preview-${Q}`,className:b0("relative aspect-video w-full overflow-hidden bg-black",J),children:[-1,0,1].map((H)=>G("img",{src:Z,alt:H===0?$:"","aria-hidden":H===0?void 0:!0,className:"pointer-events-none absolute top-1/2 max-w-none -translate-x-1/2 -translate-y-1/2 select-none",style:{left:`${K+H*z}%`,top:`${W}%`,width:`${z}%`},draggable:!1},H))})}var c1=R(v(),1);var P1=R(v(),1);function gp($,J){let Q=getComputedStyle($),Z=parseFloat(Q.fontSize);return J*Z}function up($,J){let Q=getComputedStyle($.ownerDocument.documentElement),Z=parseFloat(Q.fontSize);return J*Z}function mp($){return $/100*window.innerHeight}function cp($){return $/100*window.innerWidth}function dp($){switch(typeof $){case"number":return[$,"px"];case"string":{let J=parseFloat($);return $.endsWith("%")?[J,"%"]:$.endsWith("px")?[J,"px"]:$.endsWith("rem")?[J,"rem"]:$.endsWith("em")?[J,"em"]:$.endsWith("vh")?[J,"vh"]:$.endsWith("vw")?[J,"vw"]:[J,"%"]}}}function yZ({groupSize:$,panelElement:J,styleProp:Q}){let Z,[q,X]=dp(Q);switch(X){case"%":{Z=q/100*$;break}case"px":{Z=q;break}case"rem":{Z=up(J,q);break}case"em":{Z=gp(J,q);break}case"vh":{Z=mp(q);break}case"vw":{Z=cp(q);break}}return Z}function J6($){return parseFloat($.toFixed(3))}function CJ({group:$}){let{orientation:J,panels:Q}=$;return Q.reduce((Z,q)=>(Z+=J==="horizontal"?q.element.offsetWidth:q.element.offsetHeight,Z),0)}function vB($){let{panels:J}=$,Q=CJ({group:$});return Q===0?J.map((Z)=>({groupResizeBehavior:Z.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:Z.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:Z.panelConstraints.disabled,minSize:0,maxSize:100,panelId:Z.id})):J.map((Z)=>{let{element:q,panelConstraints:X}=Z,Y=0;if(X.collapsedSize!==void 0){let H=yZ({groupSize:Q,panelElement:q,styleProp:X.collapsedSize});Y=J6(H/Q*100)}let z;if(X.defaultSize!==void 0){let H=yZ({groupSize:Q,panelElement:q,styleProp:X.defaultSize});z=J6(H/Q*100)}let K=0;if(X.minSize!==void 0){let H=yZ({groupSize:Q,panelElement:q,styleProp:X.minSize});K=J6(H/Q*100)}let W=100;if(X.maxSize!==void 0){let H=yZ({groupSize:Q,panelElement:q,styleProp:X.maxSize});W=J6(H/Q*100)}return{groupResizeBehavior:X.groupResizeBehavior,collapsedSize:Y,collapsible:X.collapsible===!0,defaultSize:z,disabled:X.disabled,minSize:K,maxSize:W,panelId:Z.id}})}function G5($,J="Assertion error"){if(!$)throw Error(J)}function gB($,J){return Array.from(J).sort($==="horizontal"?pp:lp)}function pp($,J){let Q=$.element.offsetLeft-J.element.offsetLeft;return Q!==0?Q:$.element.offsetWidth-J.element.offsetWidth}function lp($,J){let Q=$.element.offsetTop-J.element.offsetTop;return Q!==0?Q:$.element.offsetHeight-J.element.offsetHeight}function QT($){return $!==null&&typeof $=="object"&&"nodeType"in $&&$.nodeType===Node.ELEMENT_NODE}function ZT($,J){return{x:$.x>=J.left&&$.x<=J.right?0:Math.min(Math.abs($.x-J.left),Math.abs($.x-J.right)),y:$.y>=J.top&&$.y<=J.bottom?0:Math.min(Math.abs($.y-J.top),Math.abs($.y-J.bottom))}}function ip({orientation:$,rects:J,targetRect:Q}){let Z={x:Q.x+Q.width/2,y:Q.y+Q.height/2},q,X=Number.MAX_VALUE;for(let Y of J){let{x:z,y:K}=ZT(Z,Y),W=$==="horizontal"?z:K;W({element:L}))).map(({element:L})=>L),Y=[],z=!1,K=!1,W=-1,H=-1,B=0,U,_=[];{let L=-1;for(let F of X)F.hasAttribute("data-panel")&&(L++,F.hasAttribute("data-disabled")||(B++,W===-1&&(W=L),H=L))}if(B>1){let L=-1;for(let F of X)if(F.hasAttribute("data-panel")){L++;let V=Z.find((M)=>M.element===F);if(V){if(U){let M=U.element.getBoundingClientRect(),D=F.getBoundingClientRect(),N;if(K){let O=Q==="horizontal"?new DOMRect(M.right,M.top,0,M.height):new DOMRect(M.left,M.bottom,M.width,0),k=Q==="horizontal"?new DOMRect(D.left,D.top,0,D.height):new DOMRect(D.left,D.top,D.width,0);switch(_.length){case 0:{N=[O,k];break}case 1:{let I=_[0],b=ip({orientation:Q,rects:[M,D],targetRect:I.element.getBoundingClientRect()});N=[I,b===M?k:O];break}default:{N=_;break}}}else _.length?N=_:N=[Q==="horizontal"?new DOMRect(M.right,D.top,D.left-M.right,D.height):new DOMRect(D.left,M.bottom,D.width,D.top-M.bottom)];for(let O of N){let k="width"in O?O:O.element.getBoundingClientRect(),I=rp()?$.resizeTargetMinimumSize.coarse:$.resizeTargetMinimumSize.fine;if(k.widthH;!z&&!b&&Y.push({group:$,groupSize:CJ({group:$}),panels:[U,V],separator:"width"in O?void 0:O,rect:k}),z=!1}}K=!1,U=V,_=[]}}else if(F.hasAttribute("data-separator")){F.ariaDisabled!==null&&(z=!0);let V=q.find((M)=>M.element===F);V?_.push(V):(U=void 0,_=[])}else K=!0}return Y}class uB{#$={};addListener($,J){let Q=this.#$[$];return Q===void 0?this.#$[$]=[J]:Q.includes(J)||Q.push(J),()=>{this.removeListener($,J)}}emit($,J){let Q=this.#$[$];if(Q!==void 0)if(Q.length===1)Q[0].call(null,J);else{let Z=!1,q=null,X=Array.from(Q);for(let Y=0;Y=0&&Q.splice(Z,1)}}}var J4=new Map,XT=new uB;function sp($){J4=new Map(J4),J4.delete($)}function uI($,J){for(let[Q]of J4)if(Q.id===$)return Q}function k7($,J){for(let[Q,Z]of J4)if(Q.id===$)return Z;if(J)throw Error(`Could not find data for Group with id ${$}`)}function u2(){return J4}function mB($,J){return XT.addListener("groupChange",(Q)=>{Q.group.id===$&&J(Q)})}function l4($,J){let Q=J4.get($);J4=new Map(J4),J4.set($,J),XT.emit("groupChange",{group:$,prev:Q,next:J})}function op($,J,Q){let Z,q={x:1/0,y:1/0};for(let X of J){let Y=ZT(Q,X.rect);switch($){case"horizontal":{Y.x<=q.x&&(Z=X,q=Y);break}case"vertical":{Y.y<=q.y&&(Z=X,q=Y);break}}}return Z?{distance:q,hitRegion:Z}:void 0}function np($){return $!==null&&typeof $=="object"&&"nodeType"in $&&$.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function ap($,J){if($===J)throw Error("Cannot compare node with itself");let Q={a:dI($),b:dI(J)},Z;for(;Q.a.at(-1)===Q.b.at(-1);)Z=Q.a.pop(),Q.b.pop();G5(Z,"Stacking order can only be calculated for elements with a common ancestor");let q={a:cI(mI(Q.a)),b:cI(mI(Q.b))};if(q.a===q.b){let X=Z.childNodes,Y={a:Q.a.at(-1),b:Q.b.at(-1)},z=X.length;for(;z--;){let K=X[z];if(K===Y.a)return 1;if(K===Y.b)return-1}}return Math.sign(q.a-q.b)}var tp=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function ep($){let J=getComputedStyle(YT($)??$).display;return J==="flex"||J==="inline-flex"}function $l($){let J=getComputedStyle($);return!!(J.position==="fixed"||J.zIndex!=="auto"&&(J.position!=="static"||ep($))||+J.opacity<1||("transform"in J)&&J.transform!=="none"||("webkitTransform"in J)&&J.webkitTransform!=="none"||("mixBlendMode"in J)&&J.mixBlendMode!=="normal"||("filter"in J)&&J.filter!=="none"||("webkitFilter"in J)&&J.webkitFilter!=="none"||("isolation"in J)&&J.isolation==="isolate"||tp.test(J.willChange)||J.webkitOverflowScrolling==="touch")}function mI($){let J=$.length;for(;J--;){let Q=$[J];if(G5(Q,"Missing node"),$l(Q))return Q}return null}function cI($){return $&&Number(getComputedStyle($).zIndex)||0}function dI($){let J=[];for(;$;)J.push($),$=YT($);return J}function YT($){let{parentNode:J}=$;return np(J)?J.host:J}function Jl($,J){return $.xJ.x&&$.yJ.y}function Ql({groupElement:$,hitRegion:J,pointerEventTarget:Q}){if(!QT(Q)||Q.contains($)||$.contains(Q))return!0;if(ap(Q,$)>0){let Z=Q;for(;Z;){if(Z.contains($))return!0;if(Jl(Z.getBoundingClientRect(),J))return!1;Z=Z.parentElement}}return!0}function cB($,J){let Q=[];return J.forEach((Z,q)=>{if(q.disabled)return;let X=qT(q),Y=op(q.orientation,X,{x:$.clientX,y:$.clientY});Y&&Y.distance.x<=0&&Y.distance.y<=0&&Ql({groupElement:q.element,hitRegion:Y.hitRegion.rect,pointerEventTarget:$.target})&&Q.push(Y.hitRegion)}),Q}function Zl($,J){if($.length!==J.length)return!1;for(let Q=0;Q<$.length;Q++)if($[Q]!=J[Q])return!1;return!0}function u8($,J,Q=0){return Math.abs(J6($)-J6(J))<=Q}function $4($,J){return u8($,J)?0:$>J?1:-1}function yJ({overrideDisabledPanels:$,panelConstraints:J,prevSize:Q,size:Z}){let{collapsedSize:q=0,collapsible:X,disabled:Y,maxSize:z=100,minSize:K=0}=J;if(Y&&!$)return Q;if($4(Z,K)<0)if(X){let W=(q+K)/2;$4(Z,W)<0?Z=q:Z=K}else Z=K;return Z=Math.min(z,Z),Z=J6(Z),Z}function RZ({delta:$,initialLayout:J,panelConstraints:Q,pivotIndices:Z,prevLayout:q,trigger:X}){if(u8($,0))return J;let Y=X==="imperative-api",z=Object.values(J),K=Object.values(q),W=[...z],[H,B]=Z;G5(H!=null,"Invalid first pivot index"),G5(B!=null,"Invalid second pivot index");let U=0;switch(X){case"keyboard":{{let F=$<0?B:H,V=Q[F];G5(V,`Panel constraints not found for index ${F}`);let{collapsedSize:M=0,collapsible:D,minSize:N=0}=V;if(D){let O=z[F];if(G5(O!=null,`Previous layout not found for panel index ${F}`),u8(O,M)){let k=N-O;$4(k,Math.abs($))>0&&($=$<0?0-k:k)}}}{let F=$<0?H:B,V=Q[F];G5(V,`No panel constraints found for index ${F}`);let{collapsedSize:M=0,collapsible:D,minSize:N=0}=V;if(D){let O=z[F];if(G5(O!=null,`Previous layout not found for panel index ${F}`),u8(O,N)){let k=O-M;$4(k,Math.abs($))>0&&($=$<0?0-k:k)}}}break}default:{let F=$<0?B:H,V=Q[F];G5(V,`Panel constraints not found for index ${F}`);let M=z[F],{collapsible:D,collapsedSize:N,minSize:O}=V;if(D&&$4(M,O)<0)if($>0){let k=O-N,I=k/2,b=M+$;$4(b,O)<0&&($=$4($,I)<=0?0:k)}else{let k=O-N,I=100-k/2,b=M-$;$4(b,O)<0&&($=$4(100+$,I)>0?0:-k)}break}}{let F=$<0?1:-1,V=$<0?B:H,M=0;for(;;){let N=z[V];G5(N!=null,`Previous layout not found for panel index ${V}`);let O=yJ({overrideDisabledPanels:Y,panelConstraints:Q[V],prevSize:N,size:100})-N;if(M+=O,V+=F,V<0||V>=Q.length)break}let D=Math.min(Math.abs($),Math.abs(M));$=$<0?0-D:D}{let F=$<0?H:B;for(;F>=0&&F=0))break;$<0?F--:F++}}if(Zl(K,W))return q;{let F=$<0?B:H,V=z[F];G5(V!=null,`Previous layout not found for panel index ${F}`);let M=V+U,D=yJ({overrideDisabledPanels:Y,panelConstraints:Q[F],prevSize:V,size:M});if(W[F]=D,!u8(D,M)){let N=M-D,O=$<0?B:H;for(;O>=0&&O0?O--:O++}}}let _=Object.values(W).reduce((F,V)=>V+F,0);if(!u8(_,100,0.1))return q;let L=Object.keys(q);return W.reduce((F,V,M)=>(F[L[M]]=V,F),{})}function f2($,J){if(Object.keys($).length!==Object.keys(J).length)return!1;for(let Q in $)if(J[Q]===void 0||$4($[Q],J[Q])!==0)return!1;return!0}function v2({layout:$,panelConstraints:J}){let Q=Object.values($),Z=[...Q],q=Z.reduce((z,K)=>z+K,0);if(Z.length!==J.length)throw Error(`Invalid ${J.length} panel layout: ${Z.map((z)=>`${z}%`).join(", ")}`);if(!u8(q,100)&&Z.length>0)for(let z=0;z(z[Y[W]]=K,z),{})}function zT({groupId:$,panelId:J}){let Q=()=>{let K=u2();for(let[W,{defaultLayoutDeferred:H,derivedPanelConstraints:B,layout:U,groupSize:_,separatorToPanels:L}]of K)if(W.id===$)return{defaultLayoutDeferred:H,derivedPanelConstraints:B,group:W,groupSize:_,layout:U,separatorToPanels:L};throw Error(`Group ${$} not found`)},Z=()=>{let K=Q().derivedPanelConstraints.find((W)=>W.panelId===J);if(K!==void 0)return K;throw Error(`Panel constraints not found for Panel ${J}`)},q=()=>{let K=Q().group.panels.find((W)=>W.id===J);if(K!==void 0)return K;throw Error(`Layout not found for Panel ${J}`)},X=()=>{let K=Q().layout[J];if(K!==void 0)return K;throw Error(`Layout not found for Panel ${J}`)},Y=({nextSize:K,panels:W,prevLayout:H,derivedPanelConstraints:B})=>{let U=X(),_=W.findIndex((V)=>V.id===J),L=_===0,F=_===W.length-1;if(F&&K{let D=B[M];return D?.collapsible&&u8(D.collapsedSize,H[D.panelId])}))){let V=W.slice(0,_).reduce((M,D)=>M+H[D.id],0);return{...H,[J]:J6(100-V)}}return RZ({delta:F?U-K:K-U,initialLayout:H,panelConstraints:B,pivotIndices:F?[_-1,_]:[_,_+1],prevLayout:H,trigger:"imperative-api"})},z=(K)=>{let W=X();if(K===W)return;let{defaultLayoutDeferred:H,derivedPanelConstraints:B,group:U,groupSize:_,layout:L,separatorToPanels:F}=Q(),V=Y({nextSize:K,panels:U.panels,prevLayout:L,derivedPanelConstraints:B}),M=v2({layout:V,panelConstraints:B});f2(L,M)||l4(U,{defaultLayoutDeferred:H,derivedPanelConstraints:B,groupSize:_,layout:M,separatorToPanels:F})};return{collapse:()=>{let{collapsible:K,collapsedSize:W}=Z(),{mutableValues:H}=q(),B=X();K&&B!==W&&(H.expandToSize=B,z(W))},expand:()=>{let{collapsible:K,collapsedSize:W,minSize:H}=Z(),{mutableValues:B}=q(),U=X();if(K&&U===W){let _=B.expandToSize??H;_===0&&(_=1),z(_)}},getSize:()=>{let{group:K}=Q(),W=X(),{element:H}=q(),B=K.orientation==="horizontal"?H.offsetWidth:H.offsetHeight;return{asPercentage:W,inPixels:B}},isCollapsed:()=>{let{collapsible:K,collapsedSize:W}=Z(),H=X();return K&&u8(W,H)},resize:(K)=>{let{group:W}=Q(),{element:H}=q(),B=CJ({group:W}),U=yZ({groupSize:B,panelElement:H,styleProp:K}),_=J6(U/B*100);z(_)}}}function pI($){if($.defaultPrevented)return;let J=u2();cB($,J).forEach((Q)=>{if(Q.separator&&!Q.separator.disableDoubleClick){let Z=Q.panels.find((q)=>q.panelConstraints.defaultSize!==void 0);if(Z){let q=Z.panelConstraints.defaultSize,X=zT({groupId:Q.group.id,panelId:Z.id});X&&q!==void 0&&(X.resize(q),$.preventDefault())}}})}function Hz($){let J=u2();for(let[Q]of J)if(Q.separators.some((Z)=>Z.element===$))return Q;throw Error("Could not find parent Group for separator element")}function KT({groupId:$}){let J=()=>{let Q=u2();for(let[Z,q]of Q)if(Z.id===$)return{group:Z,...q};throw Error(`Could not find Group with id "${$}"`)};return{getLayout(){let{defaultLayoutDeferred:Q,layout:Z}=J();return Q?{}:Z},setLayout(Q){let{defaultLayoutDeferred:Z,derivedPanelConstraints:q,group:X,groupSize:Y,layout:z,separatorToPanels:K}=J(),W=v2({layout:Q,panelConstraints:q});return Z?z:(f2(z,W)||l4(X,{defaultLayoutDeferred:Z,derivedPanelConstraints:q,groupSize:Y,layout:W,separatorToPanels:K}),W)}}}function x2($,J){let Q=Hz($),Z=k7(Q.id,!0),q=Q.separators.find((H)=>H.element===$);G5(q,"Matching separator not found");let X=Z.separatorToPanels.get(q);G5(X,"Matching panels not found");let Y=X.map((H)=>Q.panels.indexOf(H)),z=KT({groupId:Q.id}).getLayout(),K=RZ({delta:J,initialLayout:z,panelConstraints:Z.derivedPanelConstraints,pivotIndices:Y,prevLayout:z,trigger:"keyboard"}),W=v2({layout:K,panelConstraints:Z.derivedPanelConstraints});f2(z,W)||l4(Q,{defaultLayoutDeferred:Z.defaultLayoutDeferred,derivedPanelConstraints:Z.derivedPanelConstraints,groupSize:Z.groupSize,layout:W,separatorToPanels:Z.separatorToPanels})}function lI($){if($.defaultPrevented)return;let J=$.currentTarget,Q=Hz(J);if(!Q.disabled)switch($.key){case"ArrowDown":{$.preventDefault(),Q.orientation==="vertical"&&x2(J,5);break}case"ArrowLeft":{$.preventDefault(),Q.orientation==="horizontal"&&x2(J,-5);break}case"ArrowRight":{$.preventDefault(),Q.orientation==="horizontal"&&x2(J,5);break}case"ArrowUp":{$.preventDefault(),Q.orientation==="vertical"&&x2(J,-5);break}case"End":{$.preventDefault(),x2(J,100);break}case"Enter":{$.preventDefault();let Z=Hz(J),q=k7(Z.id,!0),{derivedPanelConstraints:X,layout:Y,separatorToPanels:z}=q,K=Z.separators.find((U)=>U.element===J);G5(K,"Matching separator not found");let W=z.get(K);G5(W,"Matching panels not found");let H=W[0],B=X.find((U)=>U.panelId===H.id);if(G5(B,"Panel metadata not found"),B.collapsible){let U=Y[H.id],_=B.collapsedSize===U?Z.mutableState.expandedPanelSizes[H.id]??B.minSize:B.collapsedSize;x2(J,_-U)}break}case"F6":{$.preventDefault();let Z=Hz(J).separators.map((Y)=>Y.element),q=Array.from(Z).findIndex((Y)=>Y===$.currentTarget);G5(q!==null,"Index not found");let X=$.shiftKey?q>0?q-1:Z.length-1:q+10)return;let J=u2(),Q=cB($,J),Z=new Map,q=!1;Q.forEach((X)=>{X.separator&&(q||(q=!0,X.separator.element.focus({focusVisible:!1,preventScroll:!0})));let Y=J.get(X.group);Y&&Z.set(X.group,Y.layout)}),RJ({cursorFlags:0,hitRegions:Q,initialLayoutMap:Z,pointerDownAtPoint:{x:$.clientX,y:$.clientY},state:"active"}),Q.length&&$.preventDefault()}var Yl=($)=>$,fB=()=>{},GT=1,WT=2,HT=4,BT=8,rI=3,sI=12,Wz;function oI(){return Wz===void 0&&(Wz=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(Wz=!0)),Wz}function zl({cursorFlags:$,groups:J,state:Q}){let Z=0,q=0;switch(Q){case"active":case"hover":J.forEach((X)=>{if(!X.mutableState.disableCursor)switch(X.orientation){case"horizontal":{Z++;break}case"vertical":{q++;break}}})}if(!(Z===0&&q===0)){switch(Q){case"active":{if($&&oI()){let X=($>)!==0,Y=($&WT)!==0,z=($&HT)!==0,K=($&BT)!==0;if(X)return z?"se-resize":K?"ne-resize":"e-resize";if(Y)return z?"sw-resize":K?"nw-resize":"w-resize";if(z)return"s-resize";if(K)return"n-resize"}break}}return oI()?Z>0&&q>0?"move":Z>0?"ew-resize":"ns-resize":Z>0&&q>0?"grab":Z>0?"col-resize":"row-resize"}}var nI=new WeakMap;function pB($){if($.defaultView===null||$.defaultView===void 0)return;let{prevStyle:J,styleSheet:Q}=nI.get($)??{};Q===void 0&&(Q=new $.defaultView.CSSStyleSheet,$.adoptedStyleSheets&&(Object.isExtensible($.adoptedStyleSheets)?$.adoptedStyleSheets.push(Q):$.adoptedStyleSheets=[...$.adoptedStyleSheets,Q]));let Z=g2();switch(Z.state){case"active":case"hover":{let q=zl({cursorFlags:Z.cursorFlags,groups:Z.hitRegions.map((Y)=>Y.group),state:Z.state}),X=`*, *:hover {cursor: ${q} !important; }`;if(J===X)return;J=X,q?Q.cssRules.length===0?Q.insertRule(X):Q.replaceSync(X):Q.cssRules.length===1&&Q.deleteRule(0);break}case"inactive":{J=void 0,Q.cssRules.length===1&&Q.deleteRule(0);break}}nI.set($,{prevStyle:J,styleSheet:Q})}function UT({document:$,event:J,hitRegions:Q,initialLayoutMap:Z,mountedGroups:q,pointerDownAtPoint:X,prevCursorFlags:Y}){let z=0;Q.forEach((W)=>{let{group:H,groupSize:B}=W,{orientation:U,panels:_}=H,{disableCursor:L}=H.mutableState,F=0;X?U==="horizontal"?F=(J.clientX-X.x)/B*100:F=(J.clientY-X.y)/B*100:U==="horizontal"?F=J.clientX<0?-100:100:F=J.clientY<0?-100:100;let V=Z.get(H),M=q.get(H);if(!V||!M)return;let{defaultLayoutDeferred:D,derivedPanelConstraints:N,groupSize:O,layout:k,separatorToPanels:I}=M;if(N&&k&&I){let b=RZ({delta:F,initialLayout:V,panelConstraints:N,pivotIndices:W.panels.map((A)=>_.indexOf(A)),prevLayout:k,trigger:"mouse-or-touch"});if(f2(b,k)){if(F!==0&&!L)switch(U){case"horizontal":{z|=F<0?GT:WT;break}case"vertical":{z|=F<0?HT:BT;break}}}else l4(W.group,{defaultLayoutDeferred:D,derivedPanelConstraints:N,groupSize:O,layout:b,separatorToPanels:I})}});let K=0;J.movementX===0?K|=Y&rI:K|=z&rI,J.movementY===0?K|=Y&sI:K|=z&sI,Xl(K),pB($)}function aI($){let J=u2(),Q=g2();switch(Q.state){case"active":UT({document:$.currentTarget,event:$,hitRegions:Q.hitRegions,initialLayoutMap:Q.initialLayoutMap,mountedGroups:J,prevCursorFlags:Q.cursorFlags})}}function tI($){if($.defaultPrevented)return;let J=g2(),Q=u2();switch(J.state){case"active":{if($.buttons===0){RJ({cursorFlags:0,state:"inactive"}),J.hitRegions.forEach((Z)=>{let q=k7(Z.group.id,!0);l4(Z.group,q)});return}for(let Z of J.hitRegions)if(Z.separator){let{element:q}=Z.separator;q.hasPointerCapture?.($.pointerId)||q.setPointerCapture?.($.pointerId)}UT({document:$.currentTarget,event:$,hitRegions:J.hitRegions,initialLayoutMap:J.initialLayoutMap,mountedGroups:Q,pointerDownAtPoint:J.pointerDownAtPoint,prevCursorFlags:J.cursorFlags});break}default:{let Z=cB($,Q);Z.length===0?J.state!=="inactive"&&RJ({cursorFlags:0,state:"inactive"}):RJ({cursorFlags:0,hitRegions:Z,state:"hover"}),pB($.currentTarget);break}}}function eI($){if($.relatedTarget instanceof HTMLIFrameElement)switch(g2().state){case"hover":RJ({cursorFlags:0,state:"inactive"})}}function $T($){if($.defaultPrevented)return;if($.pointerType==="mouse"&&$.button>0)return;let J=g2();switch(J.state){case"active":RJ({cursorFlags:0,state:"inactive"}),J.hitRegions.length>0&&(pB($.currentTarget),J.hitRegions.forEach((Q)=>{let Z=k7(Q.group.id,!0);l4(Q.group,Z)}),$.preventDefault())}}function JT($){let J=0,Q=0,Z={};for(let X of $)if(X.defaultSize!==void 0){J++;let Y=J6(X.defaultSize);Q+=Y,Z[X.panelId]=Y}else Z[X.panelId]=void 0;let q=$.length-J;if(q!==0){let X=J6((100-Q)/q);for(let Y of $)Y.defaultSize===void 0&&(Z[Y.panelId]=X)}return Z}function Kl($,J,Q){if(!Q[0])return;let Z=$.panels.find((K)=>K.element===J);if(!Z||!Z.onResize)return;let q=CJ({group:$}),X=$.orientation==="horizontal"?Z.element.offsetWidth:Z.element.offsetHeight,Y=Z.mutableValues.prevSize,z={asPercentage:J6(X/q*100),inPixels:X};Z.mutableValues.prevSize=z,Z.onResize(z,Z.id,Y)}function Gl($,J){if(Object.keys($).length!==Object.keys(J).length)return!1;for(let Q in $)if($[Q]!==J[Q])return!1;return!0}function Wl({group:$,nextGroupSize:J,prevGroupSize:Q,prevLayout:Z}){if(Q<=0||J<=0||Q===J)return Z;let q=0,X=0,Y=!1,z=new Map,K=[];for(let B of $.panels){let U=Z[B.id]??0;switch(B.panelConstraints.groupResizeBehavior){case"preserve-pixel-size":{Y=!0;let _=U/100*Q,L=J6(_/J*100);z.set(B.id,L),q+=L;break}case"preserve-relative-size":default:{K.push(B.id),X+=U;break}}}if(!Y||K.length===0)return Z;let W=100-q,H={...Z};if(z.forEach((B,U)=>{H[U]=B}),X>0)for(let B of K){let U=Z[B]??0;H[B]=J6(U/X*W)}else{let B=J6(W/K.length);for(let U of K)H[U]=B}return H}function Hl($,J){let Q=$.map((q)=>q.id),Z=Object.keys(J);if(Q.length!==Z.length)return!1;for(let q of Q)if(!Z.includes(q))return!1;return!0}var EJ=new Map;function Bl($){let J=!0;G5($.element.ownerDocument.defaultView,"Cannot register an unmounted Group");let Q=$.element.ownerDocument.defaultView.ResizeObserver,Z=new Set,q=new Set,X=new Q((L)=>{for(let F of L){let{borderBoxSize:V,target:M}=F;if(M===$.element){if(J){let D=CJ({group:$});if(D===0)return;let N=k7($.id);if(!N)return;let O=vB($),k=N.defaultLayoutDeferred?JT(O):N.layout,I=Wl({group:$,nextGroupSize:D,prevGroupSize:N.groupSize,prevLayout:k}),b=v2({layout:I,panelConstraints:O});if(!N.defaultLayoutDeferred&&f2(N.layout,b)&&Gl(N.derivedPanelConstraints,O)&&N.groupSize===D)return;l4($,{defaultLayoutDeferred:!1,derivedPanelConstraints:O,groupSize:D,layout:b,separatorToPanels:N.separatorToPanels})}}else Kl($,M,V)}});X.observe($.element),$.panels.forEach((L)=>{G5(!Z.has(L.id),`Panel ids must be unique; id "${L.id}" was used more than once`),Z.add(L.id),L.onResize&&X.observe(L.element)});let Y=CJ({group:$}),z=vB($),K=$.panels.map(({id:L})=>L).join(","),W=$.mutableState.defaultLayout;W&&(Hl($.panels,W)||(W=void 0));let H=$.mutableState.layouts[K]??W??JT(z),B=v2({layout:H,panelConstraints:z}),U=$.element.ownerDocument;EJ.set(U,(EJ.get(U)??0)+1);let _=new Map;return qT($).forEach((L)=>{L.separator&&_.set(L.separator,L.panels)}),l4($,{defaultLayoutDeferred:Y===0,derivedPanelConstraints:z,groupSize:Y,layout:B,separatorToPanels:_}),$.separators.forEach((L)=>{G5(!q.has(L.id),`Separator ids must be unique; id "${L.id}" was used more than once`),q.add(L.id),L.element.addEventListener("keydown",lI)}),EJ.get(U)===1&&(U.addEventListener("dblclick",pI,!0),U.addEventListener("pointerdown",iI,!0),U.addEventListener("pointerleave",aI),U.addEventListener("pointermove",tI),U.addEventListener("pointerout",eI),U.addEventListener("pointerup",$T,!0)),function(){J=!1,EJ.set(U,Math.max(0,(EJ.get(U)??0)-1)),sp($),$.separators.forEach((L)=>{L.element.removeEventListener("keydown",lI)}),EJ.get(U)||(U.removeEventListener("dblclick",pI,!0),U.removeEventListener("pointerdown",iI,!0),U.removeEventListener("pointerleave",aI),U.removeEventListener("pointermove",tI),U.removeEventListener("pointerout",eI),U.removeEventListener("pointerup",$T,!0)),X.disconnect()}}function Ul(){let[$,J]=P1.useState({}),Q=P1.useCallback(()=>J({}),[]);return[$,Q]}function lB($){let J=P1.useId();return`${$??J}`}var m2=typeof window<"u"?P1.useLayoutEffect:P1.useEffect;function PZ($){let J=P1.useRef($);return m2(()=>{J.current=$},[$]),P1.useCallback((...Q)=>J.current?.(...Q),[J])}function iB(...$){return PZ((J)=>{$.forEach((Q)=>{if(Q)switch(typeof Q){case"function":{Q(J);break}case"object":{Q.current=J;break}}})})}function rB($){let J=P1.useRef({...$});return m2(()=>{for(let Q in $)J.current[Q]=$[Q]},[$]),J.current}var _T=P1.createContext(null);function _l($,J){let Q=P1.useRef({getLayout:()=>({}),setLayout:Yl});P1.useImperativeHandle(J,()=>Q.current,[]),m2(()=>{Object.assign(Q.current,KT({groupId:$}))})}function sB({children:$,className:J,defaultLayout:Q,disableCursor:Z,disabled:q,elementRef:X,groupRef:Y,id:z,onLayoutChange:K,onLayoutChanged:W,orientation:H="horizontal",resizeTargetMinimumSize:B={coarse:20,fine:10},style:U,..._}){let L=P1.useRef({onLayoutChange:{},onLayoutChanged:{}}),F=PZ((y)=>{f2(L.current.onLayoutChange,y)||(L.current.onLayoutChange=y,K?.(y))}),V=PZ((y)=>{f2(L.current.onLayoutChanged,y)||(L.current.onLayoutChanged=y,W?.(y))}),M=lB(z),D=P1.useRef(null),[N,O]=Ul(),k=P1.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:B,separators:[]}),I=iB(D,X);_l(M,Y);let b=PZ((y,x)=>{let E=g2(),P=uI(y),h=k7(y);if(h){let p=!1;switch(E.state){case"active":{p=E.hitRegions.some((e)=>e.group===P);break}}return{flexGrow:h.layout[x]??1,pointerEvents:p?"none":void 0}}if(Q?.[x])return{flexGrow:Q?.[x]}}),A=rB({defaultLayout:Q,disableCursor:Z}),w=P1.useMemo(()=>({get disableCursor(){return!!A.disableCursor},getPanelStyles:b,id:M,orientation:H,registerPanel:(y)=>{let x=k.current;return x.panels=gB(H,[...x.panels,y]),O(),()=>{x.panels=x.panels.filter((E)=>E!==y),O()}},registerSeparator:(y)=>{let x=k.current;return x.separators=gB(H,[...x.separators,y]),O(),()=>{x.separators=x.separators.filter((E)=>E!==y),O()}},updatePanelProps:(y,{disabled:x})=>{let E=k.current.panels.find((p)=>p.id===y);E&&(E.panelConstraints.disabled=x);let P=uI(M),h=k7(M);P&&h&&l4(P,{...h,derivedPanelConstraints:vB(P)})},updateSeparatorProps:(y,{disabled:x,disableDoubleClick:E})=>{let P=k.current.separators.find((h)=>h.id===y);P&&(P.disabled=x,P.disableDoubleClick=E)}}),[b,M,O,H,A]),C=P1.useRef(null);return m2(()=>{let y=D.current;if(y===null)return;let x=k.current,E;if(A.defaultLayout!==void 0&&Object.keys(A.defaultLayout).length===x.panels.length){E={};for(let $0 of x.panels){let K0=A.defaultLayout[$0.id];K0!==void 0&&(E[$0.id]=K0)}}let P={disabled:!!q,element:y,id:M,mutableState:{defaultLayout:E,disableCursor:!!A.disableCursor,expandedPanelSizes:k.current.lastExpandedPanelSizes,layouts:k.current.layouts},orientation:H,panels:x.panels,resizeTargetMinimumSize:x.resizeTargetMinimumSize,separators:x.separators};C.current=P;let h=Bl(P),{defaultLayoutDeferred:p,derivedPanelConstraints:e,layout:S}=k7(P.id,!0);!p&&e.length>0&&(F(S),V(S));let r=mB(M,($0)=>{let{defaultLayoutDeferred:K0,derivedPanelConstraints:t,layout:H0}=$0.next;if(K0||t.length===0)return;let z0=P.panels.map(({id:d})=>d).join(",");P.mutableState.layouts[z0]=H0,t.forEach((d)=>{if(d.collapsible){let{layout:m}=$0.prev??{};if(m){let s=u8(d.collapsedSize,H0[d.panelId]),u=u8(d.collapsedSize,m[d.panelId]);s&&!u&&(P.mutableState.expandedPanelSizes[d.panelId]=m[d.panelId])}}});let j=g2().state!=="active";F(H0),j&&V(H0)});return()=>{C.current=null,h(),r()}},[q,M,V,F,H,N,A]),P1.useEffect(()=>{let y=C.current;y&&(y.mutableState.defaultLayout=Q,y.mutableState.disableCursor=!!Z)}),G(_T.Provider,{value:w,children:G("div",{..._,className:J,"data-group":!0,"data-testid":M,id:M,ref:I,style:{height:"100%",width:"100%",overflow:"hidden",...U,display:"flex",flexDirection:H==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:H==="horizontal"?"pan-y":"pan-x"},children:$})})}sB.displayName="Group";function oB(){let $=P1.useContext(_T);return G5($,"Group Context not found; did you render a Panel or Separator outside of a Group?"),$}function Ll($,J){let{id:Q}=oB(),Z=P1.useRef({collapse:fB,expand:fB,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:fB});P1.useImperativeHandle(J,()=>Z.current,[]),m2(()=>{Object.assign(Z.current,zT({groupId:Q,panelId:$}))})}function nB({children:$,className:J,collapsedSize:Q="0%",collapsible:Z=!1,defaultSize:q,disabled:X,elementRef:Y,groupResizeBehavior:z="preserve-relative-size",id:K,maxSize:W="100%",minSize:H="0%",onResize:B,panelRef:U,style:_,...L}){let F=!!K,V=lB(K),M=rB({disabled:X}),D=P1.useRef(null),N=iB(D,Y),{getPanelStyles:O,id:k,orientation:I,registerPanel:b,updatePanelProps:A}=oB(),w=B!==null,C=PZ((P,h,p)=>{B?.(P,K,p)});m2(()=>{let P=D.current;if(P!==null){let h={element:P,id:V,idIsStable:F,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:w?C:void 0,panelConstraints:{groupResizeBehavior:z,collapsedSize:Q,collapsible:Z,defaultSize:q,disabled:M.disabled,maxSize:W,minSize:H}};return b(h)}},[z,Q,Z,q,w,V,F,W,H,C,b,M]),P1.useEffect(()=>{A(V,{disabled:X})},[X,V,A]),Ll(V,U);let y=()=>{let P=O(k,V);if(P)return JSON.stringify(P)},x=P1.useSyncExternalStore((P)=>mB(k,P),y,y),E;return x?E=JSON.parse(x):q!==void 0?E={flexGrow:void 0,flexShrink:void 0,flexBasis:q}:E={flexGrow:1},G("div",{...L,"data-disabled":X||void 0,"data-panel":!0,"data-testid":V,id:V,ref:N,style:{...Fl,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...E},children:G("div",{className:J,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",..._,touchAction:I==="horizontal"?"pan-y":"pan-x"},children:$})})}nB.displayName="Panel";var Fl={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function Vl({layout:$,panelConstraints:J,panelId:Q,panelIndex:Z}){let q,X,Y=$[Q],z=J.find((K)=>K.panelId===Q);if(z){let K=z.maxSize,W=z.collapsible?z.collapsedSize:z.minSize,H=[Z,Z+1];X=v2({layout:RZ({delta:W-Y,initialLayout:$,panelConstraints:J,pivotIndices:H,prevLayout:$}),panelConstraints:J})[Q],q=v2({layout:RZ({delta:K-Y,initialLayout:$,panelConstraints:J,pivotIndices:H,prevLayout:$}),panelConstraints:J})[Q]}return{valueControls:Q,valueMax:q,valueMin:X,valueNow:Y}}function aB({children:$,className:J,disabled:Q,disableDoubleClick:Z,elementRef:q,id:X,style:Y,...z}){let K=lB(X),W=rB({disabled:Q,disableDoubleClick:Z}),[H,B]=P1.useState({}),[U,_]=P1.useState("inactive"),[L,F]=P1.useState(!1),V=P1.useRef(null),M=iB(V,q),{disableCursor:D,id:N,orientation:O,registerSeparator:k,updateSeparatorProps:I}=oB(),b=O==="horizontal"?"vertical":"horizontal";m2(()=>{let C=V.current;if(C!==null){let y={disabled:W.disabled,disableDoubleClick:W.disableDoubleClick,element:C,id:K},x=k(y),E=ql((h)=>{_(h.next.state!=="inactive"&&h.next.hitRegions.some((p)=>p.separator===y)?h.next.state:"inactive")}),P=mB(N,(h)=>{let{derivedPanelConstraints:p,layout:e,separatorToPanels:S}=h.next,r=S.get(y);if(r){let $0=r[0],K0=r.indexOf($0);B(Vl({layout:e,panelConstraints:p,panelId:$0.id,panelIndex:K0}))}});return()=>{E(),P(),x()}}},[N,K,k,W]),P1.useEffect(()=>{I(K,{disabled:Q,disableDoubleClick:Z})},[Q,Z,K,I]);let A;Q&&!D&&(A="not-allowed");let w;if(Q)w="disabled";else switch(U){case"active":{w="active";break}default:L?w="focus":w=U}return G("div",{...z,"aria-controls":H.valueControls,"aria-disabled":Q||void 0,"aria-orientation":b,"aria-valuemax":H.valueMax,"aria-valuemin":H.valueMin,"aria-valuenow":H.valueNow,children:$,className:J,"data-separator":w,"data-testid":K,id:K,onBlur:()=>F(!1),onFocus:()=>F(!0),ref:M,role:"separator",style:{flexBasis:"auto",cursor:A,...Y,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:Q?void 0:0})}aB.displayName="Separator";function FT({className:$,...J}){return G(sB,{"data-slot":"resizable-panel-group",className:b0("flex h-full w-full aria-[orientation=vertical]:flex-col",$),...J})}function tB($){return G(nB,{"data-slot":"resizable-panel",...$})}function VT({withHandle:$,className:J,onPointerDown:Q,...Z}){return G(aB,{"data-slot":"resizable-handle",className:b0("relative flex w-px touch-none items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-2 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 aria-[orientation=vertical]:cursor-col-resize aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:cursor-row-resize aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-2 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90",J),onPointerDown:(q)=>{q.stopPropagation(),Q?.(q)},...Z,children:$?G("div",{className:"z-10 flex h-7 w-3 items-center justify-center rounded-sm border border-border bg-background shadow-sm",children:G(LT,{className:"size-2.5 text-muted-foreground"})}):null})}var Dl={backgroundColor:"var(--multitrack-video-bg)",backgroundColorStrong:"var(--multitrack-video-bg-strong)",borderColor:"var(--multitrack-video-border)",textColor:"var(--multitrack-video-text)",textClassName:"text-[10px]",titleBackgroundColor:null,waveformColor:"var(--multitrack-video-waveform)",showThumbnail:!0,showWaveform:!0,waveformSource:"decoded-media"},Nl={backgroundColor:"var(--multitrack-audio-bg)",backgroundColorStrong:"var(--multitrack-audio-bg-strong)",borderColor:"var(--multitrack-audio-border)",textColor:"var(--multitrack-audio-text)",textClassName:"text-[10px]",titleBackgroundColor:"var(--multitrack-audio-title-bg)",waveformColor:"var(--multitrack-audio-waveform)",showThumbnail:!1,showWaveform:!0,waveformSource:"decoded-media"},Ol={backgroundColor:"var(--multitrack-task-bg)",backgroundColorStrong:"var(--multitrack-task-bg-strong)",borderColor:"var(--multitrack-task-border)",textColor:"var(--multitrack-task-text)",textClassName:"text-[8px]",titleBackgroundColor:null,waveformColor:null,showThumbnail:!1,showWaveform:!1,waveformSource:null},Al={backgroundColor:"var(--multitrack-subtitle-bg)",backgroundColorStrong:"var(--multitrack-subtitle-bg-strong)",borderColor:"var(--multitrack-subtitle-border)",textColor:"var(--multitrack-subtitle-text)",textClassName:"text-[8px]",titleBackgroundColor:null,waveformColor:null,showThumbnail:!1,showWaveform:!1,waveformSource:null};function Q4($){if($==="video")return Dl;if($==="audio")return Nl;if($==="subtitle")return Al;return Ol}var P6=R(v(),1),OT=R(J5(),1);var wl=new Set(["arabic","chinese","english","french","german","hindi","indonesian","italian","japanese","korean","malay","portuguese","russian","spanish","thai","turkish","vietnamese"]),SJ=/<[^<>\n]*>|@(?:图片|音频|视频|Picture|Image|Audio|Video)\s*\d+|\{[^{}\n]*\}|\[[^\[\]\n]*\]|\(S\d+(?:\s*,\s*S?\d+)*\)|(?:subject_definitions|summary|retention_analysis|detailed_description|overall_soundscape|non_diegetic_music)\s*:\s*|(?:主体定义|摘要|留存分析|详细描述|整体声景|非叙事性音乐)\s*[::]\s*|[||]/gi,QU="prompt-reference-chip inline-flex h-[1.6em] max-w-full items-center gap-1 rounded-md border px-1.5 py-0.5 mx-1 align-middle font-semibold leading-none shadow-sm",AT="font-semibold text-muted-foreground";function wT($){if(/^$/i.test($))return!0;if(/^<\/?d>$/i.test($)||/^<(?:scenetrans|cutoff)>$/i.test($))return!0;if(/^\[Shot\s+\d+\]$/i.test($)||/^\(S\d+(?:\s*,\s*S?\d+)*\)$/i.test($))return!0;return kT($)}function kT($){let J=$.match(/^\[([A-Za-z]+)\]$/)?.[1].toLowerCase();return J!==void 0&&wl.has(J)}function MT($){return/^\[Shot\s+\d+\]$/i.test($)}function IT($){return/^(?:(?:subject_definitions|summary|retention_analysis|detailed_description|overall_soundscape|non_diegetic_music)\s*:|(?:主体定义|摘要|留存分析|详细描述|整体声景|非叙事性音乐)\s*[::])\s*$/i.test($)}function kl($,J){if(J?.color)return J.color;if($.type==="audio")return"var(--multitrack-audio-waveform)";if($.type==="video")return"var(--multitrack-video-waveform)";return"var(--multitrack-task-bg)"}function TT($,J){$.style.color=J,$.style.borderColor=J,$.style.backgroundColor=`color-mix(in srgb, ${J} 10%, transparent)`}function Il($,J){let Q=J.type==="image"?"Picture":J.type==="audio"?"Audio":"Video";if(/^<(?:Picture|Image|Audio|Video)\s+\d+>$/i.test($))return`<${Q} ${J.index}>`;if(/^@(?:Picture|Image|Audio|Video)\s*\d+$/i.test($))return`@${Q} ${J.index}`;return J.token}function hJ($){let J=$.match(/^@?(图片|音频|视频|Picture|Image|Audio|Video)\s*(\d+)>?$/i)??$.match(/^<(Picture|Audio|Video)\s+(\d+)>$/i);if(!J)return null;let Q=J[1].toLowerCase();return{type:Q==="图片"||Q==="picture"||Q==="image"?"image":Q==="音频"||Q==="audio"?"audio":"video",index:Number(J[2])}}function Lz($){let J="",Q=(q)=>{J+=q.replaceAll("​","")},Z=(q)=>{if(q.nodeType===Node.TEXT_NODE){Q(q.textContent??"");return}if(!(q instanceof HTMLElement))return;let X=q.dataset.promptReferenceToken??q.dataset.promptSemanticToken;if(X!==void 0){Q(X);return}if(q.dataset.promptEmphasisText!==void 0){Q(q.textContent??"");return}if(q.tagName==="BR"){Q(` +`);return}if((q.tagName==="DIV"||q.tagName==="P")&&J&&!J.endsWith(` +`))Q(` +`);q.childNodes.forEach(Z)};return $.childNodes.forEach(Z),J}function CZ($){return Lz($)}function Tl($){return/^\n*$/.test($)?"":$}function eB($){let J=window.getSelection();if(!J?.rangeCount)return CZ($).length;let Q=J.getRangeAt(0);if(!$.contains(Q.endContainer))return CZ($).length;let Z=Q.cloneRange();return Z.selectNodeContents($),Z.setEnd(Q.endContainer,Q.endOffset),Lz(Z.cloneContents()).length}function bl($,J,Q,Z){let q=[];SJ.lastIndex=0;for(let X of $.matchAll(SJ)){let Y=X[0],z=hJ(Y);if(z&&!J)q.push(`reference:${z.type}:${z.index}`);else if(Q&&wT(Y))q.push(`semantic:${Y.toLowerCase()}`);else if(Q&&IT(Y))q.push(`emphasis:${Y.toLowerCase()}`);else if(J&&(Y.startsWith("{")||Y.startsWith("<")))q.push("system");else if(Z&&(Y==="|"||Y==="|"))q.push("pipe")}return q.join("|")}function jl($){return Array.from($.querySelectorAll("[data-prompt-reference-token], [data-prompt-semantic-token], [data-prompt-emphasis-text], [data-system-prompt-variable], [data-pipe]")).map((J)=>{let Q=J.dataset.promptReferenceToken;if(Q!==void 0){let Z=hJ(Q);return Z?`reference:${Z.type}:${Z.index}`:"reference:unknown"}if(J.dataset.systemPromptVariable!==void 0)return"system";if(J.dataset.promptSemanticToken!==void 0)return`semantic:${J.dataset.promptSemanticToken.toLowerCase()}`;if(J.dataset.promptEmphasisText!==void 0)return`emphasis:${J.dataset.promptEmphasisText.toLowerCase()}`;return"pipe"}).join("|")}function Bz($,J){let Q=window.getSelection();if(!Q)return;let Z=Math.max(0,J);for(let X of $.childNodes){let Y=X instanceof HTMLElement?X:null,z=Y?.dataset.promptReferenceToken??Y?.dataset.promptSemanticToken??Y?.dataset.promptEmphasisText,K=z!==void 0?z.length:Y?.tagName==="BR"?1:X.textContent?.replaceAll("​","").length??0;if(Z<=K){let W=document.createRange();if(z!==void 0)Z===0?W.setStartBefore(X):W.setStartAfter(X);else if(Y?.tagName==="BR")Z===0?W.setStartBefore(X):W.setStartAfter(X);else if(X.nodeType===Node.TEXT_NODE)W.setStart(X,Math.min(Z,X.textContent?.length??0));else{let H=document.createTreeWalker(X,NodeFilter.SHOW_TEXT).nextNode();if(H)W.setStart(H,Math.min(Z,H.textContent?.length??0));else W.setStartAfter(X)}W.collapse(!0),Q.removeAllRanges(),Q.addRange(W);return}Z-=K}let q=document.createRange();q.selectNodeContents($),q.collapse(!1),Q.removeAllRanges(),Q.addRange(q)}function El($,J,Q){SJ.lastIndex=0;for(let Z of $.matchAll(SJ)){if(!hJ(Z[0]))continue;let q=Z.index??0,X=q+Z[0].length;if(Q==="Backspace"&&J>q&&J<=X)return{start:q,end:X};if(Q==="Delete"&&J>=q&&J{if(Z>0)$.append(document.createElement("br"));if(Q)$.append(document.createTextNode(Q))})}function $U($,J){J.split(` +`).forEach((Q,Z)=>{if(Z>0)$.append(document.createElement("br"));if(!Q)return;let q=document.createElement("span");q.dataset.promptDialogueContent="true",q.className=AT,q.textContent=Q,$.append(q)})}function DT($,J){let Q=window.getSelection();if(!Q?.rangeCount)return!1;let Z=Q.getRangeAt(0);if(!$.contains(Z.commonAncestorContainer))return!1;Z.deleteContents();let q=document.createDocumentFragment();_z(q,J);let X=document.createTextNode("​");q.append(X),Z.insertNode(q);let Y=document.createRange();return Y.setStart(X,X.textContent?.length??0),Y.collapse(!0),Q.removeAllRanges(),Q.addRange(Y),!0}function yl($){let J=window.getSelection();if(!J?.rangeCount||J.isCollapsed)return null;let Q=J.getRangeAt(0);if(!$.contains(Q.commonAncestorContainer))return null;return Lz(Q.cloneContents())}function Pl($,J,Q){let Z=hJ(J),q=document.createElement("span");if(q.contentEditable="false",q.dataset.promptReferenceToken=J,q.dataset.promptReferenceType=Z?.type??"",q.className=`${QU} cursor-pointer`,TT(q,Z?kl(Z,Q):"var(--muted-foreground)"),Q?.type==="image"&&Q.thumbnailUrl){let Y=document.createElement("img");Y.src=Q.thumbnailUrl,Y.alt="",Y.draggable=!1,Y.className="h-4 w-4 shrink-0 rounded-sm object-cover align-middle",q.append(Y)}else{let Y=document.createElement("span");Y.className="prompt-reference-icon inline-flex h-4 w-4 shrink-0 items-center justify-center",Y.dataset.referenceIcon=Q?.type??Z?.type??"image";let z=document.createElementNS("http://www.w3.org/2000/svg","svg");z.setAttribute("viewBox","0 0 24 24"),z.setAttribute("fill","none"),z.setAttribute("stroke","currentColor"),z.setAttribute("stroke-width","2"),z.setAttribute("stroke-linecap","round"),z.setAttribute("stroke-linejoin","round"),z.setAttribute("aria-hidden","true"),z.classList.add("lucide","h-4","w-4");let K=Q?.type??Z?.type??"image";(K==="audio"?["M2 10v3","M6 6v11","M10 3v18","M14 8v7","M18 5v13","M22 10v3"]:K==="video"?["m16 13 5.223-3.482a.5.5 0 0 1 .777.416v8.132a.5.5 0 0 1-.777.416L16 15","M2 6h14v12H2z","m2 6 3-4","m7 6 3-4","m12 6 3-4"]:["M14.5 4h-9A2.5 2.5 0 0 0 3 6.5v11A2.5 2.5 0 0 0 5.5 20h13a2.5 2.5 0 0 0 2.5-2.5v-8","m3 16 5-5c.928-.893 2.072-.893 3 0l4 4","m14 14 1-1c.928-.893 2.072-.893 3 0l3 3","M14 7h.01"]).forEach((H)=>{let B=document.createElementNS("http://www.w3.org/2000/svg","path");B.setAttribute("d",H),z.append(B)}),Y.append(z),q.append(Y)}let X=document.createElement("span");X.className="inline-flex h-full items-center leading-none",X.textContent=J,q.append(X),q.title=Q?.detail??J,$.append(q)}function NT($,J){let Q=document.createElement("span");Q.className="inline-flex h-3.5 w-3.5 shrink-0 items-center justify-center",Q.dataset.semanticIcon=J;let Z=document.createElementNS("http://www.w3.org/2000/svg","svg");Z.setAttribute("viewBox","0 0 24 24"),Z.setAttribute("fill","none"),Z.setAttribute("stroke","currentColor"),Z.setAttribute("stroke-width","2"),Z.setAttribute("stroke-linecap","round"),Z.setAttribute("stroke-linejoin","round"),Z.setAttribute("aria-hidden","true"),Z.classList.add("lucide","h-3.5","w-3.5"),(J==="subject"?["M18 21a8 8 0 0 0-16 0","M10 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8","M19 8v6","M22 11h-6"]:["M21 15a4 4 0 0 1-4 4H8l-5 3V7a4 4 0 0 1 4-4h10a4 4 0 0 1 4 4z"]).forEach((X)=>{let Y=document.createElementNS("http://www.w3.org/2000/svg","path");Y.setAttribute("d",X),Z.append(Y)}),Q.append(Z),$.append(Q)}function Rl($,J){let Q=document.createElement("span");Q.contentEditable="false",Q.dataset.promptSemanticToken=J,Q.className=QU;let Z=/^$/i.test(J),q=/^<\/?d>$/i.test(J),X=MT(J)||kT(J),Y=Z||MT(J)?"var(--highlight)":q?"var(--prompt-dialogue)":"var(--prompt-semantic)";if(X)Q.classList.add("border-border","bg-background","text-foreground");else TT(Q,Y);if(Z)NT(Q,"subject");if(q)NT(Q,"dialogue");let z=document.createElement("span");z.className="inline-flex h-full items-center leading-none",z.textContent=J,Q.append(z),$.append(Q)}function Cl($,J){let Q=document.createElement("span");Q.dataset.promptEmphasisText=J,Q.className=AT,Q.textContent=J,$.append(Q)}function Uz($,J,Q,Z,q,X){$.textContent="";let Y=0,z=!1;SJ.lastIndex=0;for(let W of J.matchAll(SJ)){let H=W.index??0,B=J.slice(Y,H);if(z)$U($,B);else _z($,B);let U=W[0],_=/^$/i.test(U);if(/^<\/d>$/i.test(U))z=!1;let F=hJ(U);if(F&&!Z){let V=Q.find((M)=>M.type===F.type&&M.index===F.index);Pl($,U,V)}else if(q&&wT(U))Rl($,U);else if(q&&IT(U))Cl($,U);else if(Z&&(U.startsWith("{")||U.startsWith("<"))){let V=document.createElement("span");V.dataset.systemPromptVariable="true",V.className="text-highlight",V.textContent=U,$.append(V)}else if(X&&(U==="|"||U==="|")){let V=document.createElement("span");V.dataset.pipe="true",V.className="text-highlight",V.textContent="|",$.append(V)}else if(z)$U($,U);else _z($,U);if(q&&_)z=!0;Y=H+U.length}let K=J.slice(Y);if(z)$U($,K);else _z($,K)}function Sl({type:$}){if($==="audio")return G(JU,{className:"h-4 w-4"});if($==="video")return G(Z4,{className:"h-4 w-4"});return G(VJ,{className:"h-4 w-4"})}function Fz({value:$,onChange:J,ariaLabel:Q,placeholder:Z,resources:q=[],mentionsEnabled:X=!1,interactivePlaceholder:Y=!1,highlightSystemVariables:z=!1,highlightPromptSemantics:K=!1,highlightPipes:W=!1,className:H,testId:B}){let U=q1(),_=P6.useRef(null),L=P6.useRef(null),F=P6.useRef(!1),V=P6.useRef(""),[M,D]=P6.useState(null),[N,O]=P6.useState($.length===0),k=P6.useMemo(()=>{if(!M)return q;let E=M.query.toLocaleLowerCase();return q.filter((P)=>!E||`${P.label} ${P.detail}`.toLocaleLowerCase().includes(E))},[M,q]),I=P6.useMemo(()=>JSON.stringify({value:$,highlightSystemVariables:z,highlightPromptSemantics:K,highlightPipes:W,resources:q.map((E)=>[E.id,E.index,E.label,E.detail,E.token,E.color,E.thumbnailUrl])}),[W,K,z,q,$]);P6.useEffect(()=>{O($.length===0);let E=L.current;if(!E||V.current===I)return;let P=document.activeElement===E,h=P?eB(E):0;if(Uz(E,$,q,z,K,W),P)Bz(E,Math.min(h,$.length));V.current=I},[W,K,z,I,q,$]);function b(E,P){if(!X){D(null);return}let p=E.slice(0,P).match(/@([^\s@|<>]*)$/);if(!p){D(null);return}if(hJ(p[0])){D(null);return}let e=_.current,S=window.getSelection(),$0=(S?.rangeCount?S.getRangeAt(0):null)?.getBoundingClientRect?.(),K0=e?.getBoundingClientRect(),t=$0?.left??K0?.left??0,H0=$0?.top??K0?.top??0,z0=$0?.bottom??K0?.bottom??0,j=Math.min(Math.max(8,t),Math.max(8,window.innerWidth-264)),d=z0+214<=window.innerHeight?z0+6:Math.max(8,H0-214),m=P-p[0].length;D((s)=>({start:m,end:P,query:p[1],left:j,top:d,activeIndex:s?.start===m?s.activeIndex:0}))}function A(E){if(!X||!N)return;let P=E.getBoundingClientRect(),h=Math.min(Math.max(8,P.left),Math.max(8,window.innerWidth-264)),p=P.bottom+214<=window.innerHeight?P.bottom+6:Math.max(8,P.top-214);D({start:0,end:0,query:"",left:h,top:p,activeIndex:0})}function w(E){let P=L.current,h=E.dataset.promptReferenceToken;if(!X||!P||h===void 0)return;let p=document.createRange();p.selectNodeContents(P),p.setEndBefore(E);let e=Lz(p.cloneContents()).length,S=E.getBoundingClientRect(),r=Math.min(Math.max(8,S.left),Math.max(8,window.innerWidth-264)),$0=S.bottom+214<=window.innerHeight?S.bottom+6:Math.max(8,S.top-214);D({start:e,end:e+h.length,query:"",left:r,top:$0,activeIndex:0})}function C(){let E=L.current;if(!E)return;let P=Tl(CZ(E)),h=P.length===0?0:eB(E);if(P.length===0||jl(E)!==bl(P,z,K,W)){let{scrollTop:e,scrollLeft:S}=E;Uz(E,P,q,z,K,W),Bz(E,h),E.scrollTop=e,E.scrollLeft=S}O(P.length===0),V.current=JSON.stringify({value:P,highlightSystemVariables:z,highlightPromptSemantics:K,highlightPipes:W,resources:q.map((e)=>[e.id,e.index,e.label,e.detail,e.token,e.color,e.thumbnailUrl])}),J(P),b(P,h)}function y(E){let P=L.current;if(!P||!M)return;let h=CZ(P),p=h.slice(M.start,M.end),e=Il(p,E),S=`${h.slice(0,M.start)}${e}${h.slice(M.end)}`;Uz(P,S,q,z,K,W),O(!1),Bz(P,M.start+e.length),V.current="",J(S),D(null),P.focus()}function x(E){let P=L.current;if(!P)return!1;let h=CZ(P),p=El(h,eB(P),E);if(!p)return!1;let e=`${h.slice(0,p.start)}${h.slice(p.end)}`;return Uz(P,e,q,z,K,W),O(e.length===0),Bz(P,p.start),V.current="",D(null),J(e),!0}return T("div",{ref:_,className:"relative h-full min-h-0 max-h-full overflow-hidden [contain:size_layout_paint]",children:[G("div",{ref:L,role:"textbox","aria-label":Q,"aria-multiline":"true","data-testid":B,"data-placeholder":Z,contentEditable:!0,suppressContentEditableWarning:!0,className:b0("prompt-content-editor h-full min-h-0 max-h-full overflow-auto whitespace-pre-wrap wrap-break-word rounded-md px-3 py-2 text-[10px] leading-normal text-foreground caret-foreground outline-none focus-visible:ring-1 focus-visible:ring-ring",!Y&&"empty:before:pointer-events-none empty:before:text-muted-foreground empty:before:content-[attr(data-placeholder)]",H),onInput:()=>{if(!F.current)C()},onCompositionStart:()=>{F.current=!0},onCompositionEnd:()=>{F.current=!1,C()},onPaste:(E)=>{E.preventDefault(),E.stopPropagation(),E.nativeEvent.stopImmediatePropagation?.();let P=L.current,h=E.clipboardData.getData("text/plain");if(P&&DT(P,h))C()},onCopy:(E)=>{E.stopPropagation();let P=L.current,h=P?yl(P):null;if(h===null)return;E.preventDefault(),E.clipboardData.setData("text/plain",h)},onKeyDown:(E)=>{if((E.key==="Backspace"||E.key==="Delete")&&x(E.key)){E.preventDefault();return}if(M){if(E.key==="Escape")E.preventDefault(),D(null);else if(E.key==="ArrowDown"||E.key==="ArrowUp")E.preventDefault(),D((P)=>P&&k.length>0?{...P,activeIndex:(P.activeIndex+(E.key==="ArrowDown"?1:-1)+k.length)%k.length}:P);else if(E.key==="Enter"&&k.length>0){E.preventDefault(),y(k[Math.min(M.activeIndex,k.length-1)]);return}}if(E.key==="Enter"&&!F.current&&!E.nativeEvent.isComposing){E.preventDefault();let P=L.current;if(P&&DT(P,` +`))C();return}if((E.ctrlKey||E.metaKey)&&["a","c","v","x"].includes(E.key.toLowerCase()))E.stopPropagation()},onClick:(E)=>{let h=(E.target instanceof Element?E.target:null)?.closest("[data-prompt-reference-token]");if(h&&L.current?.contains(h))w(h);else D(null)},onBlur:(E)=>{if(_.current?.contains(E.relatedTarget))return;D(null)}}),Y&&N&&(()=>{let E=Z.indexOf("@"),P=E>=0?Z.slice(0,E):Z,h=E>=0?Z.slice(E+1):"";return T("div",{className:"pointer-events-none absolute inset-0 overflow-hidden whitespace-pre-wrap wrap-break-word px-3 py-2 text-[10px] leading-normal text-muted-foreground",children:[P,E>=0&&G(k0,{type:"button",variant:"ghost","aria-label":U("multitrack.openReferenceResources"),className:b0(QU,"pointer-events-auto min-w-0 border-border bg-background text-highlight text-[10px]"),onPointerDown:(p)=>p.preventDefault(),onClick:(p)=>A(p.currentTarget),children:"@"}),h]})})(),M&&OT.createPortal(G("div",{className:M8,children:T("div",{role:"listbox","aria-label":U("multitrack.referenceResources"),className:b0("fixed z-50 flex w-64 flex-col overflow-y-auto rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-md",k.length===0?"h-64":"max-h-52"),style:{left:M.left,top:M.top},children:[G("div",{className:"shrink-0 px-2 py-1.5 text-[10px] font-semibold text-muted-foreground",children:U("multitrack.referenceResources")}),k.length===0?T("div",{"data-testid":"reference-resources-empty",className:"flex min-h-0 flex-1 flex-col items-center justify-center gap-4 px-5 pb-7 text-center text-muted-foreground",children:[T("div",{"aria-hidden":"true",className:"relative h-14 w-20 opacity-60",children:[G("span",{className:"absolute left-8 -top-2 flex h-10 w-10 -rotate-12 items-center justify-center rounded-md border border-border bg-muted shadow-sm",children:G(VJ,{className:"h-5 w-5"})}),G("span",{className:"absolute -left-2 top-1 flex h-10 w-10 rotate-3 items-center justify-center rounded-md border border-border bg-muted shadow-sm",children:G(JU,{className:"h-5 w-5"})}),G("span",{className:"absolute left-6 top-4 flex h-10 w-10 rotate-6 items-center justify-center rounded-md border border-border bg-muted shadow-sm",children:G(Z4,{className:"h-5 w-5"})})]}),G("span",{className:" text-[10px] leading-relaxed",children:U("multitrack.referenceResourcesEmpty")})]}):k.map((E,P)=>T(k0,{type:"button",variant:"ghost",role:"option","aria-selected":P===M.activeIndex,className:b0("h-auto w-full justify-start gap-2 px-2 py-1.5 text-left",P===M.activeIndex&&"bg-accent text-accent-foreground"),onPointerDown:(h)=>h.preventDefault(),onPointerMove:()=>D((h)=>h?{...h,activeIndex:P}:h),onClick:()=>y(E),children:[E.type==="image"&&E.thumbnailUrl?G("img",{src:E.thumbnailUrl,alt:"",className:"h-8 w-8 shrink-0 rounded-sm object-cover"}):G("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-sm bg-muted",children:G(Sl,{type:E.type})}),T("span",{className:"min-w-0",children:[G("span",{className:"block truncate text-[11px] font-semibold",style:{color:E.color},children:E.label}),G("span",{className:"block truncate text-[9px] text-muted-foreground",children:E.detail})]})]},E.id))]})}),document.body)]})}var bT=180,hl="55%",jT=280,xl=16,ZU="task-images-resizable-panel",ET="task-prompt-resizable-panel",Mz,Vz=null;function yT($){return Nz($.content.images)}function fl($,J,Q){let Z=$.findIndex((z)=>z.id===J),q=$.findIndex((z)=>z.id===Q);if(Z<0||q<0||Z===q)return $;let X=[...$],[Y]=X.splice(Z,1);return X.splice(q,0,Y),X}function SZ($){return $.file_name??$.file_path??$.local_path??$.url??$.slot_name??$.id}function vl($){if(!$)return"";if($.slot_name)return`__slot__:${$.slot_name}`;return $.file_path??$.local_path??$.url??""}function gl($){if($?.source_type==="output")return"outputs";if($?.source_type==="local")return"local";if($?.source_type==="url")return"url";if($?.source_type==="slot")return"slot";return"inputs"}function ul($,J){if(J)return J;if($.startsWith("__slot__:"))return"slot";if($.startsWith("http://")||$.startsWith("https://"))return"url";return"input"}function fT($,J){return J.some((Q)=>Q.content.media_type==="video"&&Q.start_frame<$.end_frame&&Q.end_frame>$.start_frame)}function PT($,J,Q,Z){let q=vZ($.content.images),X=qU($.content.task_mode??"default",q.length,fT($,Q)),Y=$.content.task_mode??"default",z=X==="fl2v"||X==="fmlf2v"?"i2v":X;return J.find((W)=>W.format===Z&&(W.modes?.includes(Y)||W.task_type===X))?.system_prompt??J.find((W)=>W.task_type===z&&W.format===void 0)?.system_prompt??""}async function ml(){if(Mz)return Mz;if(!Vz)Vz=(async()=>{let $=await fetch("/easy-media/prompt/system-prompts");if(!$.ok)throw Error(`Failed to load system prompt options: ${$.status}`);let J=await $.json(),Q=Array.isArray(J.items)?J.items:[];return Mz=Q,Q})().catch(($)=>{throw Vz=null,$});return Vz}function vT({segment:$,node:J,app:Q,trackSegments:Z,selectedSegments:q,videoSegments:X=[],mediaTracks:Y=[],frameRate:z=h2,totalFrames:K,imageIndexOffset:W=0,format:H,onContentChange:B,onTrackSegmentsContentChange:U,onTrackSegmentsChange:_,onDurationChange:L,onOpenImagePreview:F}){let V=hT(H),M=q1(),D=c1.useRef(null),[N,O]=c1.useState("user"),[k,I]=c1.useState("individual"),[b,A]=c1.useState(!1),[w,C]=c1.useState(null),[y,x]=c1.useState(!1),[E,P]=c1.useState(!1),[h,p]=c1.useState(Mz??null),[e,S]=c1.useState(!1),[r,$0]=c1.useState(!1),K0=c2(uJ($),z),t=bJ(K0,z),[H0,z0]=c1.useState(t),j=yT($),d=c1.useMemo(()=>z9(J,Q,"image"),[J,Q,b]),m=j.find((J0)=>J0.id===w),s=$.content.task_mode??"default",u=$.content.continuity_mode??hZ,c=$.content.ref_image_size??Iz,i=c1.useMemo(()=>Z&&Z.length>0?Z:[$],[$,Z]),f=i.map((J0)=>xZ(J0.content)).join("|"),[o,G0]=c1.useState(f),l=Math.max(0,i.findIndex((J0)=>J0.id===$.id)),Z0=i.reduce((J0,u0)=>u0.start_frameJ0.id!==Z0)===!0,B0=$.content.user_prompt_variant==="b"?"b":"a",W0=k==="combined"?o:xZ($.content),L0=V==="MiniMax",_0=L0?M("multitrack.minimaxPromptPlaceholder"):M("multitrack.promptPlaceholder"),N0=fT($,X),d0=PT($,h??[],X,V),g=k==="combined"?i.map((J0)=>J0.content.system_prompt??PT(J0,h??[],X,V)).join("|"):$.content.system_prompt||d0,a=c1.useMemo(()=>{let J0=vZ(j).map((S1,L1)=>({id:`image:${S1.id}`,type:"image",index:L1+1,label:M("multitrack.referencePicture",{n:L1+1}),detail:SZ(S1),token:`@${M("multitrack.referencePicture",{n:L1+1})}`,color:Q4("task").backgroundColor,thumbnailUrl:Z5({source_type:S1.source_type??"input",file_path:S1.file_path,local_path:S1.local_path,url:S1.url,slot_name:S1.slot_name})??void 0})),u0=Y.filter((S1)=>S1.type==="video"&&S1.segments.some((L1)=>L1.content.media_type==="video")),g0=Y.filter((S1)=>S1.type==="audio"&&S1.segments.some((L1)=>L1.content.media_type==="audio")),N1=u0.map((S1,L1)=>{let j8=L1+1,g6=M("multitrack.referenceAudioItem",{n:j8});return{id:`video-audio:${S1.id}`,type:"audio",index:j8,label:g6,detail:S1.name,token:`@${g6}`,color:Q4("video").waveformColor??Q4("video").backgroundColor}}),M1=g0.map((S1,L1)=>{let j8=u0.length+L1+1,g6=M("multitrack.referenceAudioItem",{n:j8});return{id:`audio:${S1.id}`,type:"audio",index:j8,label:g6,detail:S1.name,token:`@${g6}`,color:Q4("audio").waveformColor??Q4("audio").backgroundColor}}),e1=u0.map((S1,L1)=>{let j8=L1+1,g6=M("multitrack.referenceVideoItem",{n:j8});return{id:`video:${S1.id}`,type:"video",index:j8,label:g6,detail:S1.name,token:`@${g6}`,color:Q4("video").waveformColor??Q4("video").backgroundColor}});return[...J0,...N1,...M1,...e1]},[j,Y,M]);c1.useEffect(()=>{z0(t)},[t]),c1.useEffect(()=>{$0(!1)},[$.id]),c1.useEffect(()=>{G0((J0)=>J0===f?J0:f)},[f]);function I0(){let J0=Xz(H0,z);if(J0===null){z0(t),$0(!1);return}if(z0(bJ(J0,z)),$0(!1),J0!==K0)L?.(J0)}c1.useEffect(()=>{if(N!=="system")return;if(h!==null)return;let J0=!1;return S(!0),ml().then((u0)=>{if(!J0)p(u0)}).catch((u0)=>{if(console.error("[TaskSegmentEditor] failed to load system prompt options:",u0),!J0)p([])}).finally(()=>{if(!J0)S(!1)}),()=>{J0=!0}},[N,h]);function A0(J0){if(Array.from(J0.files).some((g0)=>g0.type.startsWith("image/")))return!0;return Array.from(J0.items??[]).some((g0)=>g0.kind==="file"&&g0.type.startsWith("image/"))}function F0(J0){if(!J0.dataTransfer||!A0(J0.dataTransfer))return;J0.preventDefault(),x(!0)}function m0(J0){if(!J0.dataTransfer||!A0(J0.dataTransfer))return;J0.preventDefault(),x(!0)}function R0(J0){let u0=J0.relatedTarget;if(u0 instanceof Node&&J0.currentTarget.contains(u0))return;x(!1)}async function n0(J0){if(J0.preventDefault(),x(!1),!J0.dataTransfer)return;let u0=q4-j.length;if(u0<=0)return;let g0=Array.from(J0.dataTransfer.files).filter((e1)=>e1.type.startsWith("image/")).slice(0,u0);if(g0.length===0)return;let M1=(await Promise.allSettled(g0.map((e1)=>j7(e1)))).flatMap((e1)=>{if(e1.status==="fulfilled")return[e1.value];return console.error("[TaskSegmentEditor] failed to upload task image:",e1.reason),[]});if(M1.length>0)R5("inputs"),B({images:[...j,...M1]})}function C0(J0,u0){let g0=w?1:q4-j.length;if(g0<=0)return;let N1=gJ(J0).slice(0,g0),M1=ul(J0,u0),e1=N1.map((S1)=>vJ(S1,M1));if(e1.length===0)return;if(w){let S1={...e1[0],id:w};if(m?.shared_reference===!0&&U){let L1=I7(m),j8=new Map(T7(i,m,!1).map((Y6)=>[Y6.segmentId,Y6.images])),g6=i.map((Y6)=>({...Y6,content:{...Y6.content,images:Y6.id===$.id?[S1,...(j8.get(Y6.id)??[]).filter((iW)=>I7(iW)!==L1)]:j8.get(Y6.id)??yT(Y6)}}));U(T7(g6,S1,!0).map((Y6)=>({segmentId:Y6.segmentId,patch:{images:Y6.images}}))),C(null),A(!1);return}B({images:j.map((L1)=>L1.id===w?S1:L1)})}else B({images:[...j,...e1]});C(null),A(!1)}function z1(J0){let u0=J0===""?[""]:J0.split(/[||]/);if(_){let g0=i.reduce((N1,M1)=>Math.max(N1,M1.end_frame),0);_(xT(u0,i,K??g0,$.color));return}U?.(i.map((g0,N1)=>({segmentId:g0.id,patch:fZ(g0.content,u0[N1]??"")})))}function Q1(J0){if(k==="combined"){G0(J0),z1(J0);return}B(fZ($.content,J0))}function a0(J0){if(k==="combined"){let u0=J0.split("|");U?.(i.map((g0,N1)=>({segmentId:g0.id,patch:{system_prompt:u0[N1]??""}})));return}B({system_prompt:J0})}function R1(){let J0={user_prompt:W0,user_prompt_b:W0};if(U)U(i.map((u0)=>({segmentId:u0.id,patch:J0})));else B(J0);P(!1)}function C1(J0){if(!q||q.length<=1||!U){B(J0);return}U(q.map((u0)=>({segmentId:u0.id,patch:J0.continuity_mode!==void 0&&u0.id===Z0?{...J0,continuity_mode:hZ}:J0})))}function b1(J0){let u0=j.find((g0)=>g0.id===J0);if(u0?.shared_reference===!0&&U){let g0=I7(u0),N1=T7(i,u0,!1).map((M1)=>({segmentId:M1.segmentId,patch:{images:M1.segmentId===$.id?M1.images.filter((e1)=>I7(e1)!==g0):M1.images}}));U(N1);return}B({images:j.filter((g0)=>g0.id!==J0)})}function n(J0,u0){if(u0&&!xJ(i,J0))return;let g0=T7(i,J0,u0);if(U){U(g0.map((M1)=>({segmentId:M1.segmentId,patch:{images:M1.images}})));return}let N1=g0.find((M1)=>M1.segmentId===$.id);if(N1)B({images:N1.images})}function D0(J0,u0){B({images:j.map((g0)=>g0.id===J0?{...g0,muted:u0}:g0)})}let w0=j.length>0&&j.length<4?"grid-cols-2":"grid-cols-3",f0=y?"border-primary bg-accent/20":"border-border bg-muted/20",r0=c1.useRef(null),K1=c1.useRef(null),x1=c1.useRef(null),r1=c1.useRef(null),Y0=c1.useRef(null),y0=c1.useRef(null),[h0,i0]=c1.useState(!0),[E0,D1]=c1.useState("40%"),[u1,j1]=c1.useState(120);c1.useLayoutEffect(()=>{let J0=K1.current;if(!J0)return;let u0=globalThis.getComputedStyle(J0),g0=J0.clientWidth-Number.parseFloat(u0.paddingLeft)-Number.parseFloat(u0.paddingRight),N1=J0.clientHeight-Number.parseFloat(u0.paddingTop)-Number.parseFloat(u0.paddingBottom);if(g0<=0||N1<=0)return;let M1=Math.min(g0*0.55,g0-jT-xl);D1(Math.max(bT,Math.min(N1,M1)))},[]),c1.useLayoutEffect(()=>{let J0=r1.current??x1.current;if(!J0)return;let u0=()=>{let N1=J0.clientWidth;if(N1<=0)return;j1((M1)=>Math.abs(M1-N1)>1?N1:M1)};u0();let g0=new ResizeObserver(u0);return g0.observe(J0),()=>g0.disconnect()},[j.length]);let t1=Math.round(Math.max(14,Math.min(u1*0.07,28))),M5=Math.round(Math.max(14,Math.min(u1*0.08,32))),X0=Math.round(Math.max(10,Math.min(u1*0.05,20))),O0=Math.round(Math.max(10,Math.min(u1*0.06,18)));c1.useEffect(()=>{let J0=r0.current;if(!J0)return;let u0=new ResizeObserver((g0)=>{let N1=g0[0]?.contentRect.width??J0.clientWidth;i0(N1>=600)});return u0.observe(J0),i0(J0.clientWidth>=600),()=>u0.disconnect()},[]);function x0(J0){if(J0.button!==0)return;J0.preventDefault(),J0.stopPropagation();let u0=Y0.current?.getLayout(),g0=J0.currentTarget.parentElement?.getBoundingClientRect().width??0,N1=u0?.[ZU];if(g0<=0||N1===void 0)return;y0.current={pointerId:J0.pointerId,startClientX:J0.clientX,startImageSize:N1,groupWidth:g0},J0.currentTarget.setPointerCapture?.(J0.pointerId)}function J1(J0){let u0=y0.current;if(!u0||u0.pointerId!==J0.pointerId)return;J0.preventDefault(),J0.stopPropagation();let g0=u0.startImageSize+(J0.clientX-u0.startClientX)/u0.groupWidth*100;Y0.current?.setLayout({[ZU]:g0,[ET]:100-g0})}function f1(J0){if(y0.current?.pointerId!==J0.pointerId)return;if(J0.preventDefault(),J0.stopPropagation(),y0.current=null,J0.currentTarget.hasPointerCapture?.(J0.pointerId))J0.currentTarget.releasePointerCapture?.(J0.pointerId)}return T("div",{ref:r0,"data-capture-wheel":"true",className:"task-segment-editor flex h-full min-h-24 w-full flex-col overflow-hidden rounded-sm bg-background text-foreground",children:[G("div",{ref:K1,className:"flex min-h-0 flex-1 p-4",children:T(FT,{groupRef:Y0,orientation:"horizontal",className:"min-h-0 min-w-0",children:[k==="individual"&&G(tB,{id:ZU,defaultSize:E0,minSize:bT,maxSize:hl,children:G("div",{ref:r1,"data-testid":"task-image-drop-zone","aria-label":M("multitrack.taskImageDropZone"),className:b0("task-image-drop-zone flex h-full min-h-0 w-full items-center justify-center rounded-md border border-dashed transition-colors",y?"border-primary bg-accent/20":"border-border bg-muted/30"),onDragEnter:F0,onDragOver:m0,onDragLeave:R0,onDrop:n0,children:T(a1,{open:b,onOpenChange:(J0)=>{if(A(J0),!J0)C(null)},children:[j.length===0?G(T5,{asChild:!0,children:T("div",{role:"button",tabIndex:0,className:b0("task-image-picker-empty flex aspect-square h-full max-h-full min-h-24 min-w-24 max-w-full cursor-pointer flex-col items-center justify-center gap-1 rounded-md px-4 py-2 text-foreground shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",f0),"aria-label":M("multitrack.taskImageDropZone"),onClick:()=>C(null),onKeyDown:(J0)=>{if(J0.key!=="Enter"&&J0.key!==" ")return;J0.preventDefault(),A(!0)},children:[G(Dz,{}),G("span",{className:"text-[10px] font-semibold mt-1",children:M("multitrack.selectImage")}),G("span",{className:"max-w-full whitespace-normal text-center text-[9px] text-muted-foreground",children:M("multitrack.imageDropHint")})]})}):G(_6,{asChild:!0,children:T("div",{ref:x1,"data-testid":"task-image-grid",className:b0("task-image-grid relative grid h-full w-full auto-rows-max content-start gap-2 overflow-y-auto rounded-md p-3 transition-colors",w0,f0),children:[j.map((J0,u0)=>{let g0=Z5({source_type:J0.source_type??"input",file_path:J0.file_path,local_path:J0.local_path,url:J0.url,slot_name:J0.slot_name}),N1=J0.shared_reference===!0||xJ(i,J0),M1=J0.shared_reference?t1:M5,e1={width:`${X0}px`,height:`${X0}px`},S1=ST(j,J0.id,W);return T("div",{draggable:!0,"data-testid":`task-image-${J0.id}`,className:`task-image-grid-item group/task-image relative flex aspect-square w-full self-start cursor-pointer items-center justify-center overflow-hidden rounded-md border bg-black ${J0.shared_reference?J0.muted===!0?"border-highlight opacity-50":"border-highlight":"border-border"}`,role:"button",tabIndex:0,"aria-label":M("multitrack.reselectImage",{name:SZ(J0)}),onClick:()=>{C(J0.id),A(!0)},onKeyDown:(L1)=>{if(L1.target!==L1.currentTarget)return;if(L1.key!=="Enter"&&L1.key!==" ")return;L1.preventDefault(),C(J0.id),A(!0)},onDragStart:()=>{D.current=J0.id},onDragOver:(L1)=>L1.preventDefault(),onDrop:()=>{let L1=D.current;if(D.current=null,!L1)return;B({images:fl(j,L1,J0.id)})},children:[g0&&J0.panorama_view?G(Kz,{imageId:J0.id,imageUrl:g0,alt:SZ(J0),view:J0.panorama_view,className:b0("absolute inset-0 m-auto transition-opacity",J0.muted===!0&&"opacity-40")}):g0?G("img",{src:g0,alt:SZ(J0),className:b0("absolute inset-0 h-full w-full object-contain transition-opacity",J0.muted===!0&&"opacity-40"),draggable:!1}):G("div",{className:"flex h-full w-full items-center justify-center px-2 text-center text-[8px] text-muted-foreground",children:J0.source_type==="slot"?M("mediaSelector.slotImage",{n:Oz(J0,u0)}):SZ(J0)}),G("div",{"data-testid":`task-image-overlay-${J0.id}`,"aria-hidden":"true",className:"pointer-events-none absolute inset-0 z-[5] bg-black/30 opacity-0 transition-opacity group-hover/task-image:opacity-100 group-focus-within/task-image:opacity-100"}),T("div",{"data-testid":`task-image-actions-${J0.id}`,className:"absolute right-0.5 top-1 z-10 flex gap-1 opacity-0 transition-opacity group-hover/task-image:opacity-100 group-focus-within/task-image:opacity-100",children:[G(n1,{children:T(H1,{children:[G(B1,{asChild:!0,children:G(k0,{type:"button",size:"icon",variant:J0.shared_reference===!0?"secondary":"ghost","data-testid":`task-image-shared-${J0.id}`,className:`h-auto w-auto cursor-pointer bg-background/70 hover:bg-background/90 ${J0.shared_reference===!0?"text-highlight":"text-muted-foreground"}`,style:{width:M1,height:M1},"aria-label":J0.shared_reference===!0?M("multitrack.disableSharedReference"):M("multitrack.enableSharedReference"),"aria-pressed":J0.shared_reference===!0,disabled:!N1,onClick:(L1)=>{L1.stopPropagation(),n(J0,J0.shared_reference!==!0)},children:G(fJ,{style:e1})})}),G(W1,{side:"bottom",className:"max-w-64",children:N1?M("multitrack.sharedImageReferenceTooltip"):M("multitrack.sharedImageLimitTooltip")})]})}),G(n1,{children:T(H1,{children:[G(B1,{asChild:!0,children:G(k0,{type:"button",size:"icon",variant:J0.muted===!0?"secondary":"ghost","data-testid":`task-image-muted-${J0.id}`,className:`h-auto w-auto cursor-pointer bg-background/70 font-bold hover:bg-background/90 ${J0.muted===!0?"text-destructive hover:text-destructive":"text-muted-foreground"}`,style:{width:M1,height:M1,fontSize:O0},"aria-label":J0.muted===!0?M("multitrack.includeImage"):M("multitrack.bypassImage"),"aria-pressed":J0.muted===!0,onClick:(L1)=>{L1.stopPropagation(),D0(J0.id,J0.muted!==!0)},children:"M"})}),G(W1,{side:"bottom",children:J0.muted===!0?M("multitrack.includeImageTooltip"):M("multitrack.bypassImageTooltip")})]})}),G(n1,{children:T(H1,{children:[G(B1,{asChild:!0,children:G(k0,{type:"button",size:"icon",variant:"ghost",className:"h-auto w-auto cursor-pointer bg-background/70 text-muted-foreground font-bold hover:bg-background/90",style:{width:M1,height:M1},"aria-label":M("multitrack.previewImage"),disabled:!g0,onClick:(L1)=>{L1.stopPropagation(),F?.(J0.id)},children:G(b7,{style:e1})})}),G(W1,{side:"bottom",children:M("multitrack.previewImage")})]})}),G(n1,{children:T(H1,{children:[G(B1,{asChild:!0,children:G(k0,{type:"button",size:"icon",variant:"ghost",className:"h-auto w-auto cursor-pointer bg-background/70 text-destructive hover:bg-background/90 hover:text-destructive",style:{width:M1,height:M1},"aria-label":M("multitrack.deleteImage"),onClick:(L1)=>{L1.stopPropagation(),b1(J0.id)},children:G(D5,{style:e1})})}),G(W1,{side:"bottom",children:M("multitrack.deleteImage")})]})})]}),S1!==null?G("span",{"data-testid":`task-image-index-${J0.id}`,className:"absolute bottom-0 left-0 z-10 min-w-5 rounded-sm bg-black/50 px-1.5 py-0.5 text-center text-[9px] font-semibold leading-none text-white",children:S1}):null]},J0.id)}),j.length{C(null),A(!0)},children:G(K5,{className:"h-7 w-7"})})]})}),G(s1,{className:"w-auto p-0",align:"end",children:G(V5,{value:vl(m),mediaType:"image",defaultTab:gl(m),allowMultipleSelection:!w,maxSelectionCount:w?1:q4-j.length,slotItems:d,onChange:C0},w??"add-images")})]})})}),k==="individual"?G(VT,{withHandle:!0,"aria-label":M("multitrack.resizeTaskEditorPanels"),className:"mx-2 bg-transparent",onPointerDown:x0,onPointerMove:J1,onPointerUp:f1,onPointerCancel:f1,onLostPointerCapture:()=>{y0.current=null}}):null,G(tB,{id:ET,minSize:k==="individual"?jT:"100%",children:T("div",{"data-testid":"task-prompt-panel",className:"flex h-full min-h-0 min-w-0 flex-col overflow-hidden rounded-md border border-border bg-muted/30 shadow-sm",children:[k==="individual"&&T("div",{className:"flex h-11 shrink-0 items-center px-2 justify-between",children:[T("div",{className:"flex h-7 items-center rounded-md bg-card p-1",children:[G(k0,{type:"button",variant:"ghost",className:b0("h-full rounded-sm px-3 py-1 text-[10px] shadow-none cursor-pointer",N==="user"?"bg-background text-primary hover:bg-background/90 hover:text-primary":"text-muted-foreground"),onClick:()=>O("user"),children:M("multitrack.userPrompt")}),G(k0,{type:"button",variant:"ghost",className:b0("h-full rounded-sm px-3 py-1 text-[10px] shadow-none cursor-pointer",N==="system"?"bg-background text-primary hover:bg-background/90 hover:text-primary":"text-muted-foreground"),onClick:()=>O("system"),children:M("multitrack.systemPrompt")})]}),N==="user"?T("div",{className:"flex items-center gap-1",children:[G(k0,{type:"button",variant:"ghost",className:"h-7 px-2 text-[10px] text-highlight hover:bg-highlight/10 hover:text-highlight cursor-pointer hover:opacity-70",onClick:()=>P(!0),children:M("multitrack.applyPromptToAll")}),G(n1,{delayDuration:300,children:T(H1,{children:[G(B1,{asChild:!0,children:G("div",{"aria-label":M("multitrack.userPromptVariantTooltip"),children:G(m4,{value:B0,onValueChange:(J0)=>B({user_prompt_variant:J0}),children:T(s9,{className:"h-7 bg-card p-1",children:[G(W8,{value:"a",className:"h-full min-w-7 px-2 text-[10px]",children:"A"}),G(W8,{value:"b",className:"h-full min-w-7 px-2 text-[10px]",children:"B"})]})})})}),G(W1,{side:"bottom",className:"max-w-72",children:M("multitrack.userPromptVariantTooltip")})]})})]}):Boolean($.content.system_prompt)&&T(H1,{children:[G(B1,{asChild:!0,children:G(k0,{type:"button",size:"icon",variant:"ghost",className:"h-7 w-7 text-muted-foreground [&_svg]:!size-3","aria-label":M("multitrack.resetSystemPrompt"),onClick:()=>B({system_prompt:""}),children:G(CT,{})})}),G(W1,{side:"bottom",children:M("multitrack.resetSystemPrompt")})]})]}),k==="combined"?T("div",{className:"flex min-h-0 flex-1 flex-col gap-1 p-2",children:[G("div",{className:"relative h-full min-h-0 flex-1 overflow-hidden rounded-md bg-card",children:G(Fz,{ariaLabel:M("multitrack.prompt"),placeholder:_0,interactivePlaceholder:L0,testId:"combined-prompt-highlight",className:"border-none bg-card shadow-none",value:W0,resources:a,mentionsEnabled:!0,highlightPromptSemantics:!0,highlightPipes:!0,onChange:Q1})}),G("p",{className:"shrink-0 text-[9px] text-muted-foreground mt-1",children:M("maintainTrack.combinedHint")})]}):N==="user"?G("div",{className:"relative h-full min-h-0 flex-1 overflow-hidden pb-2 px-2",children:G(Fz,{placeholder:_0,interactivePlaceholder:L0,ariaLabel:M("multitrack.prompt"),className:"border-none bg-card shadow-none",value:W0,resources:a,mentionsEnabled:!0,highlightPromptSemantics:!0,onChange:Q1})}):G("div",{className:"relative h-full min-h-0 flex-1 overflow-hidden pb-2 px-2",children:G("div",{className:"relative h-full min-h-0 overflow-hidden rounded-md bg-card",children:G(Fz,{ariaLabel:M("multitrack.systemPrompt"),placeholder:e?M("multitrack.loadingSystemPrompt"):M("multitrack.systemPromptPlaceholder"),className:"border-none bg-card shadow-none",value:g,resources:a,highlightSystemVariables:!0,onChange:a0})})})]})})]},k)}),T("div",{className:"relative flex shrink-0 items-center justify-between border-t border-dashed border-border p-2",children:[G(m4,{value:k,onValueChange:(J0)=>I(J0),className:h0?void 0:"hidden",children:T(s9,{className:"h-8 bg-card",children:[G(W8,{value:"individual",className:"text-[10px]",children:M("multitrack.individualEdit")}),G(W8,{value:"combined",className:"text-[10px]",children:M("multitrack.combinedEdit")})]})}),G("div",{className:b0(h0?"absolute left-1/2 -translate-x-1/2":"flex items-center",r&&"w-28"),children:r?G($6,{autoFocus:!0,"aria-label":M("multitrack.duration"),type:"text",inputMode:"numeric",placeholder:"00:00:00",className:"tabular-nums",value:H0,onChange:(J0)=>z0(J0.currentTarget.value),onBlur:I0,onKeyDown:(J0)=>{if(J0.key!=="Enter")return;J0.preventDefault(),I0()}}):T("div",{className:"flex items-center gap-1 text-muted-foreground",children:[T("div",{className:"flex flex-col items-center",children:[G("span",{className:"text-[10px] text-primary",children:M("multitrack.taskNumber",{n:l+1})}),G("span",{className:"text-[10px] mt-0.5 tabular-nums",children:t})]}),L&&G(k0,{type:"button",variant:"ghost",size:"icon",className:"h-5 w-5 cursor-pointer","aria-label":M("multitrack.editTaskDuration"),onClick:()=>$0(!0),children:G(RT,{className:"h-3 w-3"})})]})}),T("div",{className:"flex items-center gap-2",children:[V==="MiniMax"&&(l>0||Q0)&&T(y8,{value:u,onValueChange:(J0)=>C1({continuity_mode:J0}),children:[G(n1,{delayDuration:300,children:T(H1,{children:[G(B1,{asChild:!0,children:G(P8,{"aria-label":M("multitrack.continuityMode"),className:"h-8 w-28 bg-card text-[10px]",children:G(W6,{})})}),G(W1,{side:"bottom",className:"max-w-72",children:M("multitrack.continuityModeTooltip")})]})}),G(R8,{children:wz.map((J0)=>G(l5,{value:J0,children:G("span",{className:"text-[10px]",children:M(`multitrackContinuityModes.${J0}`)})},J0))})]}),V==="MiniMax"&&["ref","edit"].includes(s)&&T(y8,{value:c,onValueChange:(J0)=>C1({ref_image_size:J0}),children:[G(n1,{delayDuration:300,children:T(H1,{children:[G(B1,{asChild:!0,children:G(P8,{"aria-label":M("multitrack.refImageSize"),className:"h-8 w-20 bg-card text-[10px]",children:G(W6,{})})}),G(W1,{side:"bottom",className:"max-w-72",children:M("multitrack.refImageSizeTooltip")})]})}),G(R8,{children:kz.map((J0)=>G(l5,{value:J0,children:G("span",{className:"text-[10px]",children:M(`multitrackRefImageSizes.${J0}`)})},J0))})]}),T(y8,{value:s,onValueChange:(J0)=>C1({task_mode:J0}),children:[G(n1,{delayDuration:300,children:T(H1,{children:[G(B1,{asChild:!0,children:G(P8,{"aria-label":M("multitrack.taskMode"),className:"h-8 w-24 bg-card text-[10px]",children:G(W6,{})})}),G(W1,{side:"bottom",className:"max-w-72",children:M("multitrack.taskModeTooltip")})]})}),G(R8,{children:Az.map((J0)=>G(l5,{value:J0,children:G("span",{className:"text-[10px]",children:M(`multitrackTaskModes.${qU(J0,j.length,N0)}`)})},J0))})]})]})]}),G(OJ,{open:E,onOpenChange:P,children:T(j2,{className:"max-w-md",children:[T(wZ,{children:[G(E2,{children:M("multitrack.applyPromptToAllTitle")}),G(IZ,{children:M("multitrack.applyPromptToAllDescription")})]}),T(kZ,{children:[G(k0,{type:"button",variant:"outline",onClick:()=>P(!1),children:M("common.cancel")}),G(k0,{type:"button",onClick:R1,children:M("multitrack.applyPromptToAllConfirm")})]})]})})]})}var m8=R(v(),1);function cl($){if($==="stretch")return"fill";if($==="crop")return"cover";return"contain"}function gT($,J){if(!Number.isFinite(J)||Math.abs($.currentTime-J)<=0.001)return;try{$.currentTime=J}catch(Q){console.error("[VideoPreview] failed to seek preview video:",Q)}}function mT({activeVideo:$,resolution:J,isPlaying:Q,playbackNonce:Z=0,muted:q,volume:X,frameRate:Y,className:z,children:K}){let W=q1(),H=m8.useRef(null),[B,U]=m8.useState(null),[_,L]=m8.useState(null),[F,V]=m8.useState(null),[M,D]=m8.useState(null),N=m8.useMemo(()=>{if(!$)return null;return Z5({source_type:$.segment.content.source_type??"input",file_path:$.segment.content.file_path,local_path:$.segment.content.local_path,url:$.segment.content.url,slot_name:$.segment.content.slot_name})},[$]),O=Math.max(0,Math.min(X,1)),k=cl(J.resizeMethod),I=$?.segment.id??null,b=$?.segment.content.source_type==="url",A=$?.localTime??0,w=Math.round(A*Y),C=$&&N?`${N}:${Y}:${w}`:null,y=F?.url===N,x=y&&F.fps!==null&&Math.abs(F.fps-Y)<=0.01;m8.useEffect(()=>{if(!$||!N||b)return;let P=new AbortController,h=$.segment.content,p=N;async function e(){try{let S=await fetch("/easy-media/video/source-fps",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source_type:h.source_type??"input",file_path:h.file_path,local_path:h.local_path,url:h.url}),signal:P.signal});if(!S.ok)throw Error(`Video frame rate request failed (${S.status})`);let r=await S.json(),$0=r&&typeof r==="object"&&"fps"in r?r.fps:null;if(typeof $0!=="number"||!Number.isFinite($0)||$0<=0)throw Error("Video frame rate response is invalid");if(!P.signal.aborted)V({url:p,fps:$0})}catch(S){if(!P.signal.aborted)console.error("[VideoPreview] failed to probe source frame rate:",S),V({url:p,fps:null})}}return e(),()=>P.abort()},[N,b]),m8.useEffect(()=>{if(Q||b||x||!y||!$||!N||C===null){U(null),L(null);return}let P=C,h=new AbortController,p=null,e=$.segment.content;async function S(){try{let $0=await fetch("/easy-media/video/preview-frame",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source_type:e.source_type??"input",file_path:e.file_path,local_path:e.local_path,url:e.url,frame:w,fps:Y}),signal:h.signal});if(!$0.ok)throw Error(`Preview frame request failed (${$0.status})`);if(p=URL.createObjectURL(await $0.blob()),!h.signal.aborted)L(null),U({key:P,url:p})}catch($0){if(!h.signal.aborted)console.error("[VideoPreview] failed to load timeline frame:",$0),L(P)}}let r=setTimeout(()=>{S()},60);return()=>{if(clearTimeout(r),h.abort(),p)URL.revokeObjectURL(p)}},[$?.segment.id,Y,Q,b,w,y,C,x,N]),m8.useEffect(()=>{let P=H.current;if(!P)return;P.muted=q,P.volume=O},[q,O]),m8.useEffect(()=>{let P=H.current;if(!P||!$||Q)return;gT(P,$.localTime)},[$,A,Q]),m8.useEffect(()=>{let P=H.current;if(x&&!Q&&P&&P.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA&&!P.seeking&&Math.abs(P.currentTime-A)<1/Y)D(C)},[A,Y,Q,C,x]);function E(){let P=H.current;if(x&&!Q&&P&&!P.seeking&&Math.abs(P.currentTime-A)<1/Y)D(C)}return m8.useEffect(()=>{let P=H.current;if(!P||!$)return;if(Q){gT(P,$.localTime);let h=P.play();if(h)h.catch((p)=>{console.error("[VideoPreview] failed to play preview video:",p)});return}P.pause()},[Q,N,I,Z]),T("div",{"data-testid":"multitrack-video-stage",className:b0("relative flex h-full min-w-0 max-h-full max-w-full items-center justify-center overflow-hidden bg-black",z),style:{aspectRatio:`${J.width} / ${J.height}`},children:[N?G("video",{ref:H,"data-testid":"multitrack-video-preview",className:"absolute inset-0 h-full min-h-0 w-full min-w-0 max-h-full max-w-full",src:N,muted:q,playsInline:!0,preload:"auto",onSeeked:E,onLoadedData:E,style:{objectFit:k,visibility:Q||b||_===C||x&&M===C?"visible":"hidden"}}):$?.segment.content.source_type==="slot"?G("div",{"data-testid":"multitrack-video-slot-placeholder",className:"flex h-full w-full items-center justify-center bg-muted/30 px-3 text-center text-xs font-medium text-muted-foreground",children:W("mediaSelector.slotVideo",{n:uT($.segment.content.slot_name)})}):G("div",{"data-testid":"multitrack-black-frame",className:"h-full w-full bg-black"}),!Q&&B?.key===C&&G("img",{src:B.url,alt:"","data-testid":"multitrack-timeline-frame",className:"absolute inset-0 h-full w-full",style:{objectFit:k}}),K]})}var c9=R(v(),1);var s0=R(v(),1);function d2($,J){if($.indexOf(J)===-1)$.push(J)}function E7($,J){let Q=$.indexOf(J);if(Q>-1)$.splice(Q,1)}var _8=($,J,Q)=>{if(Q>J)return J;if(Q<$)return $;return Q};function XU($,J){return J?`${$}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${J}`:$}var X4=()=>{},N6=()=>{};if(typeof process<"u"&&process.env?.NODE_ENV!=="production")X4=($,J,Q)=>{if(!$&&typeof console<"u")console.warn(XU(J,Q))},N6=($,J,Q)=>{if(!$)throw Error(XU(J,Q))};var Q6={};var gZ=($)=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test($);var uZ=($)=>typeof $==="object"&&$!==null;var mZ=($)=>/^0[^.\s]+$/u.test($);function cZ($){let J;return()=>{if(J===void 0)J=$();return J}}var b5=($)=>$;var S9=(...$)=>$.reduce((J,Q)=>(Z)=>Q(J(Z)));var Y4=($,J,Q)=>{let Z=J-$;return Z?(Q-$)/Z:1};class y7{constructor(){this.subscriptions=[]}add($){return d2(this.subscriptions,$),()=>E7(this.subscriptions,$)}notify($,J,Q){let Z=this.subscriptions.length;if(!Z)return;if(Z===1)this.subscriptions[0]($,J,Q);else for(let q=0;q$*1000,w8=($)=>$/1000;var dZ=($,J)=>J?$*(1000/J):0;var cT=($,J,Q)=>(((1-3*Q+3*J)*$+(3*Q-6*J))*$+3*J)*$,dl=0.0000001,pl=12;function ll($,J,Q,Z,q){let X,Y,z=0;do if(Y=J+(Q-J)/2,X=cT(Y,Z,q)-$,X>0)Q=Y;else J=Y;while(Math.abs(X)>dl&&++zll(X,0,1,$,Q);return(X)=>X===0||X===1?X:cT(q(X),J,Z)}var Tz=($)=>(J)=>J<=0.5?$(2*J)/2:(2-$(2*(1-J)))/2;var bz=($)=>(J)=>1-$(1-J);var jz=P7(0.33,1.53,0.69,0.99),mJ=bz(jz),pZ=Tz(mJ);var lZ=($)=>$>=1?1:($*=2)<1?0.5*mJ($):0.5*(2-Math.pow(2,-10*($-1)));var iZ=($)=>1-Math.sin(Math.acos($)),rZ=bz(iZ),sZ=Tz(iZ);var YU=P7(0.42,0,1,1),zU=P7(0,0,0.58,1),oZ=P7(0.42,0,0.58,1);var KU=($)=>{return Array.isArray($)&&typeof $[0]!=="number"};var nZ=($)=>Array.isArray($)&&typeof $[0]==="number";var dT={linear:b5,easeIn:YU,easeInOut:oZ,easeOut:zU,circIn:iZ,circInOut:sZ,circOut:rZ,backIn:mJ,backInOut:pZ,backOut:jz,anticipate:lZ},il=($)=>{return typeof $==="string"},Ez=($)=>{if(nZ($)){N6($.length===4,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");let[J,Q,Z,q]=$;return P7(J,Q,Z,q)}else if(il($))return N6(dT[$]!==void 0,`Invalid easing type '${$}'`,"invalid-easing-type"),dT[$];return $};var aZ=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function pT($){let J=new Set,Q=new Set,Z=!1,q=!1,X=new WeakSet,Y={delta:0,timestamp:0,isProcessing:!1};function z(W){if(X.has(W))K.schedule(W),$();W(Y)}let K={schedule:(W,H=!1,B=!1)=>{let _=B&&Z?J:Q;if(H)X.add(W);return _.add(W),W},cancel:(W)=>{Q.delete(W),X.delete(W)},process:(W)=>{if(Y=W,Z){q=!0;return}Z=!0;let H=J;if(J=Q,Q=H,J.forEach(z),J.clear(),Z=!1,q)q=!1,K.process(W)}};return K}var rl=40;function yz($,J){let Q=!1,Z=!0,q={delta:0,timestamp:0,isProcessing:!1},X=()=>Q=!0,Y=aZ.reduce((N,O)=>{return N[O]=pT(X),N},{}),{setup:z,read:K,resolveKeyframes:W,preUpdate:H,update:B,preRender:U,render:_,postRender:L}=Y,F=()=>{let N=Q6.useManualTiming,O=N?q.timestamp:performance.now();if(Q=!1,!N)q.delta=Z?16.666666666666668:Math.max(Math.min(O-q.timestamp,rl),1);if(q.timestamp=O,q.isProcessing=!0,z.process(q),K.process(q),W.process(q),H.process(q),B.process(q),U.process(q),_.process(q),L.process(q),q.isProcessing=!1,Q&&J)Z=!1,$(F)},V=()=>{if(Q=!0,Z=!0,!q.isProcessing)$(F)};return{schedule:aZ.reduce((N,O)=>{let k=Y[O];return N[O]=(I,b=!1,A=!1)=>{if(!Q)V();return k.schedule(I,b,A)},N},{}),cancel:(N)=>{for(let O=0;O{if(Pz===void 0)j5.set(C5.isProcessing||Q6.useManualTiming?C5.timestamp:performance.now());return Pz},set:($)=>{Pz=$,queueMicrotask(sl)}};var lT=($)=>(J)=>typeof J==="string"&&J.startsWith($),Rz=lT("--"),ol=lT("var(--"),cJ=($)=>{if(!ol($))return!1;return nl.test($.split("/*")[0].trim())},nl=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function GU($){if(typeof $!=="string")return!1;return $.split("/*")[0].includes("var(--")}var z4={test:($)=>typeof $==="number",parse:parseFloat,transform:($)=>$},i4={...z4,transform:($)=>_8(0,1,$)},eZ={...z4,default:1};var R7=($)=>Math.round($*1e5)/1e5;var dJ=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function iT($){return $==null}var rT=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu;var pJ=($,J)=>(Q)=>{return Boolean(typeof Q==="string"&&rT.test(Q)&&Q.startsWith($)||J&&!iT(Q)&&Object.prototype.hasOwnProperty.call(Q,J))},Cz=($,J,Q)=>(Z)=>{if(typeof Z!=="string")return Z;let[q,X,Y,z]=Z.match(dJ);return{[$]:parseFloat(q),[J]:parseFloat(X),[Q]:parseFloat(Y),alpha:z!==void 0?parseFloat(z):1}};var al=($)=>_8(0,255,$),WU={...z4,transform:($)=>Math.round(al($))},K4={test:pJ("rgb","red"),parse:Cz("red","green","blue"),transform:({red:$,green:J,blue:Q,alpha:Z=1})=>"rgba("+WU.transform($)+", "+WU.transform(J)+", "+WU.transform(Q)+", "+R7(i4.transform(Z))+")"};function tl($){let J="",Q="",Z="",q="";if($.length>5)J=$.substring(1,3),Q=$.substring(3,5),Z=$.substring(5,7),q=$.substring(7,9);else J=$.substring(1,2),Q=$.substring(2,3),Z=$.substring(3,4),q=$.substring(4,5),J+=J,Q+=Q,Z+=Z,q+=q;return{red:parseInt(J,16),green:parseInt(Q,16),blue:parseInt(Z,16),alpha:q?parseInt(q,16)/255:1}}var $q={test:pJ("#"),parse:tl,transform:K4.transform};var Jq=($)=>({test:(J)=>typeof J==="string"&&J.endsWith($)&&J.split(" ").length===1,parse:parseFloat,transform:(J)=>`${J}${$}`}),G9=Jq("deg"),c8=Jq("%"),p0=Jq("px"),HU=Jq("vh"),BU=Jq("vw"),Sz=(()=>({...c8,parse:($)=>c8.parse($)/100,transform:($)=>c8.transform($*100)}))();var C7={test:pJ("hsl","hue"),parse:Cz("hue","saturation","lightness"),transform:({hue:$,saturation:J,lightness:Q,alpha:Z=1})=>{return"hsla("+Math.round($)+", "+c8.transform(R7(J))+", "+c8.transform(R7(Q))+", "+R7(i4.transform(Z))+")"}};var O5={test:($)=>K4.test($)||$q.test($)||C7.test($),parse:($)=>{if(K4.test($))return K4.parse($);else if(C7.test($))return C7.parse($);else return $q.parse($)},transform:($)=>{return typeof $==="string"?$:$.hasOwnProperty("red")?K4.transform($):C7.transform($)},getAnimatableNone:($)=>{let J=O5.parse($);return J.alpha=0,O5.transform(J)}};var sT=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function el($){return isNaN($)&&typeof $==="string"&&($.match(dJ)?.length||0)+($.match(sT)?.length||0)>0}var nT="number",aT="color",$i="var",Ji="var(",oT="${}",Qi=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function S7($){let J=$.toString(),Q=[],Z={color:[],number:[],var:[]},q=[],X=0,z=J.replace(Qi,(K)=>{if(O5.test(K))Z.color.push(X),q.push(aT),Q.push(O5.parse(K));else if(K.startsWith(Ji))Z.var.push(X),q.push($i),Q.push(K);else Z.number.push(X),q.push(nT),Q.push(parseFloat(K));return++X,oT}).split(oT);return{values:Q,split:z,indexes:Z,types:q}}function Zi($){return S7($).values}function tT({split:$,types:J}){let Q=$.length;return(Z)=>{let q="";for(let X=0;Xtypeof $==="number"?0:O5.test($)?O5.getAnimatableNone($):$,Yi=($,J)=>{if(typeof $==="number")return J?.trim().endsWith("/")?$:0;return Xi($)};function zi($){let J=S7($);return tT(J)(J.values.map((Z,q)=>Yi(Z,J.split[q])))}var L8={test:el,parse:Zi,createTransformer:qi,getAnimatableNone:zi};function UU($,J,Q){if(Q<0)Q+=1;if(Q>1)Q-=1;if(Q<0.16666666666666666)return $+(J-$)*6*Q;if(Q<0.5)return J;if(Q<0.6666666666666666)return $+(J-$)*(0.6666666666666666-Q)*6;return $}function eT({hue:$,saturation:J,lightness:Q,alpha:Z}){$/=360,J/=100,Q/=100;let q=0,X=0,Y=0;if(!J)q=X=Y=Q;else{let z=Q<0.5?Q*(1+J):Q+J-Q*J,K=2*Q-z;q=UU(K,z,$+0.3333333333333333),X=UU(K,z,$),Y=UU(K,z,$-0.3333333333333333)}return{red:Math.round(q*255),green:Math.round(X*255),blue:Math.round(Y*255),alpha:Z}}function lJ($,J){return(Q)=>Q>0?J:$}var I1=($,J,Q)=>{return $+(J-$)*Q};var _U=($,J,Q)=>{let Z=$*$,q=Q*(J*J-Z)+Z;return q<0?0:Math.sqrt(q)},Ki=[$q,K4,C7],Gi=($)=>Ki.find((J)=>J.test($));function $b($){let J=Gi($);if(X4(Boolean(J),`'${$}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!Boolean(J))return!1;let Q=J.parse($);if(J===C7)Q=eT(Q);return Q}var LU=($,J)=>{let Q=$b($),Z=$b(J);if(!Q||!Z)return lJ($,J);let q={...Q};return(X)=>{return q.red=_U(Q.red,Z.red,X),q.green=_U(Q.green,Z.green,X),q.blue=_U(Q.blue,Z.blue,X),q.alpha=I1(Q.alpha,Z.alpha,X),K4.transform(q)}};var hz=new Set(["none","hidden"]);function Jb($,J){if(hz.has($))return(Q)=>Q<=0?$:J;else return(Q)=>Q>=1?J:$}function Wi($,J){return(Q)=>I1($,J,Q)}function xz($){if(typeof $==="number")return Wi;else if(typeof $==="string")return cJ($)?lJ:O5.test($)?LU:Ui;else if(Array.isArray($))return Qb;else if(typeof $==="object")return O5.test($)?LU:Hi;return lJ}function Qb($,J){let Q=[...$],Z=Q.length,q=$.map((X,Y)=>xz(X)(X,J[Y]));return(X)=>{for(let Y=0;Y{for(let X in Z)Q[X]=Z[X](q);return Q}}function Bi($,J){let Q=[],Z={color:0,var:0,number:0};for(let q=0;q{let Q=L8.createTransformer(J),Z=S7($),q=S7(J);if(Z.indexes.var.length===q.indexes.var.length&&Z.indexes.color.length===q.indexes.color.length&&Z.indexes.number.length>=q.indexes.number.length){if(hz.has($)&&!q.values.length||hz.has(J)&&!Z.values.length)return Jb($,J);return S9(Qb(Bi(Z,q),q.values),Q)}else return X4(!0,`Complex values '${$}' and '${J}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),lJ($,J)};function fz($,J,Q){if(typeof $==="number"&&typeof J==="number"&&typeof Q==="number")return I1($,J,Q);return xz($)($,J)}var Zb=($)=>{let J=({timestamp:Q})=>$(Q);return{start:(Q=!0)=>w1.update(J,Q),stop:()=>O6(J),now:()=>C5.isProcessing?C5.timestamp:j5.now()}};var vz=($,J,Q=10)=>{let Z="",q=Math.max(Math.round(J/Q),2);for(let X=0;X=20000?1/0:J}function qb($,J=100,Q){let Z=Q({...$,keyframes:[0,J]}),q=Math.min(iJ(Z),gz);return{type:"keyframes",ease:(X)=>{return Z.next(q*X).value/J},duration:w8(q)}}var E5={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:0.3,visualDuration:0.3,restSpeed:{granular:0.01,default:2},restDelta:{granular:0.005,default:0.5},minDuration:0.01,maxDuration:10,minDamping:0.05,maxDamping:1};function VU($,J){return $*Math.sqrt(1-J*J)}var _i=12;function Li($,J,Q){let Z=Q;for(let q=1;q<_i;q++)Z=Z-$(Z)/J(Z);return Z}var FU=0.001;function Fi({duration:$=E5.duration,bounce:J=E5.bounce,velocity:Q=E5.velocity,mass:Z=E5.mass}){let q,X;X4($<=f5(E5.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");let Y=1-J;if(Y=_8(E5.minDamping,E5.maxDamping,Y),$=_8(E5.minDuration,E5.maxDuration,w8($)),Y<1)q=(W)=>{let H=W*Y,B=H*$,U=H-Q,_=VU(W,Y),L=Math.exp(-B);return FU-U/_*L},X=(W)=>{let B=W*Y*$,U=B*Q+Q,_=Math.pow(Y,2)*Math.pow(W,2)*$,L=Math.exp(-B),F=VU(Math.pow(W,2),Y);return(-q(W)+FU>0?-1:1)*((U-_)*L)/F};else q=(W)=>{let H=Math.exp(-W*$),B=(W-Q)*$+1;return-FU+H*B},X=(W)=>{let H=Math.exp(-W*$),B=(Q-W)*($*$);return H*B};let z=5/$,K=Li(q,X,z);if($=f5($),isNaN(K))return{stiffness:E5.stiffness,damping:E5.damping,duration:$};else{let W=Math.pow(K,2)*Z;return{stiffness:W,damping:Y*2*Math.sqrt(Z*W),duration:$}}}var Vi=["duration","bounce"],Mi=["stiffness","damping","mass"];function Xb($,J){return J.some((Q)=>$[Q]!==void 0)}function Di($){let J={velocity:E5.velocity,stiffness:E5.stiffness,damping:E5.damping,mass:E5.mass,isResolvedFromDuration:!1,...$};if(!Xb($,Mi)&&Xb($,Vi))if(J.velocity=0,$.visualDuration){let Q=$.visualDuration,Z=2*Math.PI/(Q*1.2),q=Z*Z,X=2*_8(0.05,1,1-($.bounce||0))*Math.sqrt(q);J={...J,mass:E5.mass,stiffness:q,damping:X}}else{let Q=Fi({...$,velocity:0});J={...J,...Q,mass:E5.mass},J.isResolvedFromDuration=!0}return J}function rJ($=E5.visualDuration,J=E5.bounce){let Q=typeof $!=="object"?{visualDuration:$,keyframes:[0,1],bounce:J}:$,{restSpeed:Z,restDelta:q}=Q,X=Q.keyframes[0],Y=Q.keyframes[Q.keyframes.length-1],z={done:!1,value:X},{stiffness:K,damping:W,mass:H,duration:B,velocity:U,isResolvedFromDuration:_}=Di({...Q,velocity:-w8(Q.velocity||0)}),L=U||0,F=W/(2*Math.sqrt(K*H)),V=Y-X,M=w8(Math.sqrt(K/H)),D=Math.abs(V)<5;Z||(Z=D?E5.restSpeed.granular:E5.restSpeed.default),q||(q=D?E5.restDelta.granular:E5.restDelta.default);let N,O,k,I,b,A;if(F<1)k=VU(M,F),I=(L+F*M*V)/k,N=(C)=>{let y=Math.exp(-F*M*C);return Y-y*(I*Math.sin(k*C)+V*Math.cos(k*C))},b=F*M*I+V*k,A=F*M*V-I*k,O=(C)=>{return Math.exp(-F*M*C)*(b*Math.sin(k*C)+A*Math.cos(k*C))};else if(F===1){N=(y)=>Y-Math.exp(-M*y)*(V+(L+M*V)*y);let C=L+M*V;O=(y)=>Math.exp(-M*y)*(M*C*y-L)}else{let C=M*Math.sqrt(F*F-1);N=(P)=>{let h=Math.exp(-F*M*P),p=Math.min(C*P,300);return Y-h*((L+F*M*V)*Math.sinh(p)+C*V*Math.cosh(p))/C};let y=(L+F*M*V)/C,x=F*M*y-V*C,E=F*M*V-y*C;O=(P)=>{let h=Math.exp(-F*M*P),p=Math.min(C*P,300);return h*(x*Math.sinh(p)+E*Math.cosh(p))}}let w={calculatedDuration:_?B||null:null,velocity:(C)=>f5(O(C)),next:(C)=>{if(!_&&F<1){let x=Math.exp(-F*M*C),E=Math.sin(k*C),P=Math.cos(k*C),h=Y-x*(I*E+V*P),p=f5(x*(b*E+A*P));return z.done=Math.abs(p)<=Z&&Math.abs(Y-h)<=q,z.value=z.done?Y:h,z}let y=N(C);if(!_){let x=f5(O(C));z.done=Math.abs(x)<=Z&&Math.abs(Y-y)<=q}else z.done=C>=B;return z.value=z.done?Y:y,z},toString:()=>{let C=Math.min(iJ(w),gz),y=vz((x)=>w.next(C*x).value,C,30);return C+"ms "+y},toTransition:()=>{}};return w}rJ.applyToOptions=($)=>{let J=qb($,100,rJ);return $.ease=J.ease,$.duration=f5(J.duration),$.type="keyframes",$};var Ni=5;function uz($,J,Q){let Z=Math.max(J-Ni,0);return dZ(Q-$(Z),J-Z)}function Qq({keyframes:$,velocity:J=0,power:Q=0.8,timeConstant:Z=325,bounceDamping:q=10,bounceStiffness:X=500,modifyTarget:Y,min:z,max:K,restDelta:W=0.5,restSpeed:H}){let B=$[0],U={done:!1,value:B},_=(A)=>z!==void 0&&AK,L=(A)=>{if(z===void 0)return K;if(K===void 0)return z;return Math.abs(z-A)-F*Math.exp(-A/Z),N=(A)=>M+D(A),O=(A)=>{let w=D(A),C=N(A);U.done=Math.abs(w)<=W,U.value=U.done?M:C},k,I,b=(A)=>{if(!_(U.value))return;k=A,I=rJ({keyframes:[U.value,L(U.value)],velocity:uz(N,A,U.value),damping:q,stiffness:X,restDelta:W,restSpeed:H})};return b(0),{calculatedDuration:null,next:(A)=>{let w=!1;if(!I&&k===void 0)w=!0,O(A),b(A);if(k!==void 0&&A>=k)return I.next(A-k);else return!w&&O(A),U}}}function Oi($,J,Q){let Z=[],q=Q||Q6.mix||fz,X=$.length-1;for(let Y=0;YJ[0];if(X===2&&J[0]===J[1])return()=>J[1];let Y=$[0]===$[1];if($[0]>$[X-1])$=[...$].reverse(),J=[...J].reverse();let z=Oi(J,Z,q),K=z.length,W=(H)=>{if(Y&&H<$[0])return J[0];let B=0;if(K>1){for(;B<$.length-2;B++)if(H<$[B+1])break}let U=Y4($[B],$[B+1],H);return z[B](U)};return Q?(H)=>W(_8($[0],$[X-1],H)):W}function zb($,J){let Q=$[$.length-1];for(let Z=1;Z<=J;Z++){let q=Y4(0,J,Z);$.push(I1(Q,1,q))}}function Kb($){let J=[0];return zb(J,$.length-1),J}function Gb($,J){return $.map((Q)=>Q*J)}function Ai($,J){return $.map(()=>J||oZ).splice(0,$.length-1)}function p2({duration:$=300,keyframes:J,times:Q,ease:Z="easeInOut"}){let q=KU(Z)?Z.map(Ez):Ez(Z),X={done:!1,value:J[0]},Y=Gb(Q&&Q.length===J.length?Q:Kb(J),$),z=Yb(Y,J,{ease:Array.isArray(q)?q:Ai(J,q)});return{calculatedDuration:$,next:(K)=>{return X.value=z(K),X.done=K>=$,X}}}var wi=($)=>$!==null;function h7($,{repeat:J,repeatType:Q="loop"},Z,q=1){let X=$.filter(wi),z=q<0||J&&Q!=="loop"&&J%2===1?0:X.length-1;return!z||Z===void 0?X[z]:Z}var ki={decay:Qq,inertia:Qq,tween:p2,keyframes:p2,spring:rJ};function mz($){if(typeof $.type==="string")$.type=ki[$.type]}class l2{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(($)=>{this.resolve=$})}notifyFinished(){this.resolve()}then($,J){return this.finished.then($,J)}}var Ii=($)=>$/100;class x7 extends l2{constructor($){super();if(this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{let{motionValue:J}=this.options;if(J&&J.updatedAt!==j5.now())this.tick(j5.now());if(this.isStopped=!0,this.state==="idle")return;this.teardown(),this.options.onStop?.()},this.options=$,this.initAnimation(),this.play(),$.autoplay===!1)this.pause()}initAnimation(){let{options:$}=this;mz($);let{type:J=p2,repeat:Q=0,repeatDelay:Z=0,repeatType:q,velocity:X=0}=$,{keyframes:Y}=$,z=J||p2;if(z!==p2&&typeof Y[0]!=="number")this.mixKeyframes=S9(Ii,fz(Y[0],Y[1])),Y=[0,100];let K=z({...$,keyframes:Y});if(q==="mirror")this.mirroredGenerator=z({...$,keyframes:[...Y].reverse(),velocity:-X});if(K.calculatedDuration===null)K.calculatedDuration=iJ(K);let{calculatedDuration:W}=K;this.calculatedDuration=W,this.resolvedDuration=W+Z,this.totalDuration=this.resolvedDuration*(Q+1)-Z,this.generator=K}updateTime($){let J=Math.round($-this.startTime)*this.playbackSpeed;if(this.holdTime!==null)this.currentTime=this.holdTime;else this.currentTime=J}tick($,J=!1){let{generator:Q,totalDuration:Z,mixKeyframes:q,mirroredGenerator:X,resolvedDuration:Y,calculatedDuration:z}=this;if(this.startTime===null)return Q.next(0);let{delay:K=0,keyframes:W,repeat:H,repeatType:B,repeatDelay:U,type:_,onUpdate:L,finalKeyframe:F}=this.options;if(this.speed>0)this.startTime=Math.min(this.startTime,$);else if(this.speed<0)this.startTime=Math.min($-Z/this.speed,this.startTime);if(J)this.currentTime=$;else this.updateTime($);let V=this.currentTime-K*(this.playbackSpeed>=0?1:-1),M=this.playbackSpeed>=0?V<0:V>Z;if(this.currentTime=Math.max(V,0),this.state==="finished"&&this.holdTime===null)this.currentTime=Z;let D=this.currentTime,N=Q;if(H){let b=Math.min(this.currentTime,Z)/Y,A=Math.floor(b),w=b%1;if(!w&&b>=1)w=1;if(w===1&&A--,A=Math.min(A,H+1),Boolean(A%2)){if(B==="reverse"){if(w=1-w,U)w-=U/Y}else if(B==="mirror")N=X}D=_8(0,1,w)*Y}let O;if(M)this.delayState.value=W[0],O=this.delayState;else O=N.next(D);if(q&&!M)O.value=q(O.value);let{done:k}=O;if(!M&&z!==null)k=this.playbackSpeed>=0?this.currentTime>=Z:this.currentTime<=0;let I=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&k);if(I&&_!==Qq)O.value=h7(W,this.options,F,this.speed);if(L)L(O.value);if(I)this.finish();return O}then($,J){return this.finished.then($,J)}get duration(){return w8(this.calculatedDuration)}get iterationDuration(){let{delay:$=0}=this.options||{};return this.duration+w8($)}get time(){return w8(this.currentTime)}set time($){if($=f5($),this.currentTime=$,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0)this.holdTime=$;else if(this.driver)this.startTime=this.driver.now()-$/this.playbackSpeed;if(this.driver)this.driver.start(!1);else this.startTime=0,this.state="paused",this.holdTime=$,this.tick($)}getGeneratorVelocity(){let $=this.currentTime;if($<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity($);let J=this.generator.next($).value;return uz((Q)=>this.generator.next(Q).value,$,J)}get speed(){return this.playbackSpeed}set speed($){let J=this.playbackSpeed!==$;if(J&&this.driver)this.updateTime(j5.now());if(this.playbackSpeed=$,J&&this.driver)this.time=w8(this.currentTime)}play(){if(this.isStopped)return;let{driver:$=Zb,startTime:J}=this.options;if(!this.driver)this.driver=$((Z)=>this.tick(Z));this.options.onPlay?.();let Q=this.driver.now();if(this.state==="finished")this.updateFinished(),this.startTime=Q;else if(this.holdTime!==null)this.startTime=Q-this.holdTime;else if(!this.startTime)this.startTime=J??Q;if(this.state==="finished"&&this.speed<0)this.startTime+=this.calculatedDuration;this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(j5.now()),this.holdTime=this.currentTime}complete(){if(this.state!=="running")this.play();this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){if(!this.driver)return;this.driver.stop(),this.driver=void 0}sample($){return this.startTime=0,this.tick($,!0)}attachTimeline($){if(this.options.allowFlatten)this.options.type="keyframes",this.options.ease="linear",this.initAnimation();return this.driver?.stop(),$.observe(this)}}function Wb($){for(let J=1;J<$.length;J++)$[J]??($[J]=$[J-1])}var i2=($)=>$*180/Math.PI,MU=($)=>{let J=i2(Math.atan2($[1],$[0]));return DU(J)},Ti={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:($)=>(Math.abs($[0])+Math.abs($[3]))/2,rotate:MU,rotateZ:MU,skewX:($)=>i2(Math.atan($[1])),skewY:($)=>i2(Math.atan($[2])),skew:($)=>(Math.abs($[1])+Math.abs($[2]))/2},DU=($)=>{if($=$%360,$<0)$+=360;return $},Hb=MU,Bb=($)=>Math.sqrt($[0]*$[0]+$[1]*$[1]),Ub=($)=>Math.sqrt($[4]*$[4]+$[5]*$[5]),bi={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Bb,scaleY:Ub,scale:($)=>(Bb($)+Ub($))/2,rotateX:($)=>DU(i2(Math.atan2($[6],$[5]))),rotateY:($)=>DU(i2(Math.atan2(-$[2],$[0]))),rotateZ:Hb,rotate:Hb,skewX:($)=>i2(Math.atan($[4])),skewY:($)=>i2(Math.atan($[1])),skew:($)=>(Math.abs($[1])+Math.abs($[4]))/2};function cz($){return $.includes("scale")?1:0}function dz($,J){if(!$||$==="none")return cz(J);let Q=$.match(/^matrix3d\(([-\d.e\s,]+)\)$/u),Z,q;if(Q)Z=bi,q=Q;else{let z=$.match(/^matrix\(([-\d.e\s,]+)\)$/u);Z=Ti,q=z}if(!q)return cz(J);let X=Z[J],Y=q[1].split(",").map(ji);return typeof X==="function"?X(Y):Y[X]}var _b=($,J)=>{let{transform:Q="none"}=getComputedStyle($);return dz(Q,J)};function ji($){return parseFloat($.trim())}var G4=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],W9=(()=>new Set([...G4,"pathRotation"]))();var NU=($)=>$===z4||$===p0,Ei=new Set(["x","y","z"]),yi=G4.filter(($)=>!Ei.has($));function Lb($){let J=[];return yi.forEach((Q)=>{let Z=$.getValue(Q);if(Z!==void 0)J.push([Q,Z.get()]),Z.set(Q.startsWith("scale")?1:0)}),J}var r4={width:({x:$},{paddingLeft:J="0",paddingRight:Q="0",boxSizing:Z})=>{let q=$.max-$.min;return Z==="border-box"?q:q-parseFloat(J)-parseFloat(Q)},height:({y:$},{paddingTop:J="0",paddingBottom:Q="0",boxSizing:Z})=>{let q=$.max-$.min;return Z==="border-box"?q:q-parseFloat(J)-parseFloat(Q)},top:($,{top:J})=>parseFloat(J),left:($,{left:J})=>parseFloat(J),bottom:({y:$},{top:J})=>parseFloat(J)+($.max-$.min),right:({x:$},{left:J})=>parseFloat(J)+($.max-$.min),x:($,{transform:J})=>dz(J,"x"),y:($,{transform:J})=>dz(J,"y")};r4.translateX=r4.x;r4.translateY=r4.y;var r2=new Set,OU=!1,AU=!1,wU=!1;function Fb(){if(AU){let $=Array.from(r2).filter((Z)=>Z.needsMeasurement),J=new Set($.map((Z)=>Z.element)),Q=new Map;J.forEach((Z)=>{let q=Lb(Z);if(!q.length)return;Q.set(Z,q),Z.render()}),$.forEach((Z)=>Z.measureInitialState()),J.forEach((Z)=>{Z.render();let q=Q.get(Z);if(q)q.forEach(([X,Y])=>{Z.getValue(X)?.set(Y)})}),$.forEach((Z)=>Z.measureEndState()),$.forEach((Z)=>{if(Z.suspendedScrollY!==void 0)window.scrollTo(0,Z.suspendedScrollY)})}AU=!1,OU=!1,r2.forEach(($)=>$.complete(wU)),r2.clear()}function Vb(){r2.forEach(($)=>{if($.readKeyframes(),$.needsMeasurement)AU=!0})}function Mb(){wU=!0,Vb(),Fb(),wU=!1}class s2{constructor($,J,Q,Z,q,X=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...$],this.onComplete=J,this.name=Q,this.motionValue=Z,this.element=q,this.isAsync=X}scheduleResolve(){if(this.state="scheduled",this.isAsync){if(r2.add(this),!OU)OU=!0,w1.read(Vb),w1.resolveKeyframes(Fb)}else this.readKeyframes(),this.complete()}readKeyframes(){let{unresolvedKeyframes:$,name:J,element:Q,motionValue:Z}=this;if($[0]===null){let q=Z?.get(),X=$[$.length-1];if(q!==void 0)$[0]=q;else if(Q&&J){let Y=Q.readValue(J,X);if(Y!==void 0&&Y!==null)$[0]=Y}if($[0]===void 0)$[0]=X;if(Z&&q===void 0)Z.set($[0])}Wb($)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete($=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,$),r2.delete(this)}cancel(){if(this.state==="scheduled")r2.delete(this),this.state="pending"}resume(){if(this.state==="pending")this.scheduleResolve()}}var Db=($)=>$.startsWith("--");function pz($,J,Q){Db(J)?$.style.setProperty(J,Q):$.style[J]=Q}var Nb={};function lz($,J){let Q=cZ($);return()=>Nb[J]??Q()}var Ob=lz(()=>window.ScrollTimeline!==void 0,"scrollTimeline");var iz=lz(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch($){return!1}return!0},"linearEasing");var o2=([$,J,Q,Z])=>`cubic-bezier(${$}, ${J}, ${Q}, ${Z})`;var kU={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:o2([0,0.65,0.55,1]),circOut:o2([0.55,0,1,0.45]),backIn:o2([0.31,0.01,0.66,-0.59]),backOut:o2([0.33,1.53,0.69,0.99])};function IU($,J){if(!$)return;else if(typeof $==="function")return iz()?vz($,J):"ease-out";else if(nZ($))return o2($);else if(Array.isArray($))return $.map((Q)=>IU(Q,J)||kU.easeOut);else return kU[$]}function Ab($,J,Q,{delay:Z=0,duration:q=300,repeat:X=0,repeatType:Y="loop",ease:z="easeOut",times:K}={},W=void 0){let H={[J]:Q};if(K)H.offset=K;let B=IU(z,q);if(Array.isArray(B))H.easing=B;let U={delay:Z,duration:q,easing:!Array.isArray(B)?B:"linear",fill:"both",iterations:X+1,direction:Y==="reverse"?"alternate":"normal"};if(W)U.pseudoElement=W;return $.animate(H,U)}function rz($){return typeof $==="function"&&"applyToOptions"in $}function wb({type:$,...J}){if(rz($)&&iz())return $.applyToOptions(J);else J.duration??(J.duration=300),J.ease??(J.ease="easeOut");return J}class Zq extends l2{constructor($){super();if(this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!$)return;let{element:J,name:Q,keyframes:Z,pseudoElement:q,allowFlatten:X=!1,finalKeyframe:Y,onComplete:z}=$;this.isPseudoElement=Boolean(q),this.allowFlatten=X,this.options=$,N6(typeof $.type!=="string",`Mini animate() doesn't support "type" as a string.`,"mini-spring");let K=wb($);if(this.animation=Ab(J,Q,Z,K,q),K.autoplay===!1)this.animation.pause();this.animation.onfinish=()=>{if(this.finishedTime=this.time,!q){let W=h7(Z,this.options,Y,this.speed);if(this.updateMotionValue)this.updateMotionValue(W);pz(J,Q,W),this.animation.cancel()}z?.(),this.notifyFinished()}}play(){if(this.isStopped)return;if(this.manualStartTime=null,this.animation.play(),this.state==="finished")this.updateFinished()}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch($){}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:$}=this;if($==="idle"||$==="finished")return;if(this.updateMotionValue)this.updateMotionValue();else this.commitStyles();if(!this.isPseudoElement)this.cancel()}commitStyles(){let $=this.options?.element;if(!this.isPseudoElement&&$?.isConnected)this.animation.commitStyles?.()}get duration(){let $=this.animation.effect?.getComputedTiming?.().duration||0;return w8(Number($))}get iterationDuration(){let{delay:$=0}=this.options||{};return this.duration+w8($)}get time(){return w8(Number(this.animation.currentTime)||0)}set time($){let J=this.finishedTime!==null;if(this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=f5($),J)this.animation.pause()}get speed(){return this.animation.playbackRate}set speed($){if($<0)this.finishedTime=null;this.animation.playbackRate=$}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime($){this.manualStartTime=this.animation.startTime=$}attachTimeline({timeline:$,rangeStart:J,rangeEnd:Q,observe:Z}){if(this.allowFlatten)this.animation.effect?.updateTiming({easing:"linear"});if(this.animation.onfinish=null,$&&Ob()){if(this.animation.timeline=$,J)this.animation.rangeStart=J;if(Q)this.animation.rangeEnd=Q;return b5}else return Z(this)}}var kb={anticipate:lZ,backInOut:pZ,circInOut:sZ};function Pi($){return $ in kb}function Ib($){if(typeof $.ease==="string"&&Pi($.ease))$.ease=kb[$.ease]}var TU=10;class bU extends Zq{constructor($){Ib($),mz($);super($);if($.startTime!==void 0&&$.autoplay!==!1)this.startTime=$.startTime;this.options=$}updateMotionValue($){let{motionValue:J,onUpdate:Q,onComplete:Z,element:q,...X}=this.options;if(!J)return;if($!==void 0){J.set($);return}let Y=new x7({...X,autoplay:!1}),z=Math.max(TU,j5.now()-this.startTime),K=_8(0,TU,z-TU),W=Y.sample(z).value,{name:H}=this.options;if(q&&H)pz(q,H,W);J.setWithVelocity(Y.sample(Math.max(0,z-K)).value,W,K),Y.stop()}}var jU=($,J)=>{if(J==="zIndex")return!1;if(typeof $==="number"||Array.isArray($))return!0;if(typeof $==="string"&&(L8.test($)||$==="0")&&!$.startsWith("url("))return!0;return!1};function Ri($){let J=$[0];if($.length===1)return!0;for(let Q=0;Q<$.length;Q++)if($[Q]!==J)return!0}function Tb($,J,Q,Z){let q=$[0];if(q===null)return!1;if(J==="display"||J==="visibility")return!0;let X=$[$.length-1],Y=jU(q,J),z=jU(X,J);if(X4(Y===z,`You are trying to animate ${J} from "${q}" to "${X}". "${Y?X:q}" is not an animatable value.`,"value-not-animatable"),!Y||!z)return!1;return Ri($)||(Q==="spring"||rz(Q))&&Z}function qq($){$.duration=0,$.type="keyframes"}var sz=new Set(["opacity","clipPath","filter","transform"]);var Ci=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function bb($){for(let J=0;J<$.length;J++)if(typeof $[J]==="string"&&Ci.test($[J]))return!0;return!1}var Si=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),hi=cZ(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function jb($){let{motionValue:J,name:Q,repeatDelay:Z,repeatType:q,damping:X,type:Y,keyframes:z}=$;if(!(J?.owner?.current instanceof HTMLElement))return!1;let{onUpdate:W,transformTemplate:H}=J.owner.getProps();return hi()&&Q&&(sz.has(Q)||Si.has(Q)&&bb(z))&&(Q!=="transform"||!H)&&!W&&!Z&&q!=="mirror"&&X!==0&&Y!=="inertia"}var xi=40;class EU extends l2{constructor({autoplay:$=!0,delay:J=0,type:Q="keyframes",repeat:Z=0,repeatDelay:q=0,repeatType:X="loop",keyframes:Y,name:z,motionValue:K,element:W,...H}){super();this.stop=()=>{if(this._animation)this._animation.stop(),this.stopTimeline?.();this.keyframeResolver?.cancel()},this.createdAt=j5.now();let B={autoplay:$,delay:J,type:Q,repeat:Z,repeatDelay:q,repeatType:X,name:z,motionValue:K,element:W,...H},U=W?.KeyframeResolver||s2;this.keyframeResolver=new U(Y,(_,L,F)=>this.onKeyframesResolved(_,L,B,!F),z,K,W),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved($,J,Q,Z){this.keyframeResolver=void 0;let{name:q,type:X,velocity:Y,delay:z,isHandoff:K,onUpdate:W}=Q;this.resolvedAt=j5.now();let H=!0;if(!Tb($,q,X,Y)){if(H=!1,Q6.instantAnimations||!z)W?.(h7($,Q,J));$[0]=$[$.length-1],qq(Q),Q.repeat=0}let U={startTime:Z?!this.resolvedAt?this.createdAt:this.resolvedAt-this.createdAt>xi?this.resolvedAt:this.createdAt:void 0,finalKeyframe:J,...Q,keyframes:$},_=H&&!K&&jb(U),L=U.motionValue?.owner?.current,F;if(_)try{F=new bU({...U,element:L})}catch{F=new x7(U)}else F=new x7(U);if(F.finished.then(()=>{this.notifyFinished()}).catch(b5),this.pendingTimeline)this.stopTimeline=F.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0;this._animation=F}get finished(){if(!this._animation)return this._finished;else return this.animation.finished}then($,J){return this.finished.finally($).then(()=>{})}get animation(){if(!this._animation)this.keyframeResolver?.resume(),Mb();return this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time($){this.animation.time=$}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed($){this.animation.speed=$}get startTime(){return this.animation.startTime}attachTimeline($){if(this._animation)this.stopTimeline=this.animation.attachTimeline($);else this.pendingTimeline=$;return()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){if(this._animation)this.animation.cancel();this.keyframeResolver?.cancel()}}function oz($,J,Q,Z=0,q=1){let X=Array.from($).sort((W,H)=>W.sortNodePosition(H)).indexOf(J),Y=$.size,z=(Y-1)*Z;return typeof Q==="function"?Q(X,Y):q===1?X*Z:z-X*Z}var Eb=30,vi=($)=>{return!isNaN(parseFloat($))},yb={current:void 0};class Pb{constructor($,J={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=(Q)=>{let Z=j5.now();if(this.updatedAt!==Z)this.setPrevFrameValue();if(this.prev=this.current,this.setCurrent(Q),this.current!==this.prev){if(this.events.change?.notify(this.current),this.dependents)for(let q of this.dependents)q.dirty()}},this.hasAnimated=!1,this.setCurrent($),this.owner=J.owner}setCurrent($){if(this.current=$,this.updatedAt=j5.now(),this.canTrackVelocity===null&&$!==void 0)this.canTrackVelocity=vi(this.current)}setPrevFrameValue($=this.current){this.prevFrameValue=$,this.prevUpdatedAt=this.updatedAt}onChange($){return this.on("change",$)}on($,J){if(!this.events[$])this.events[$]=new y7;let Q=this.events[$].add(J);if($==="change")return()=>{Q(),w1.read(()=>{if(!this.events.change.getSize())this.stop()})};return Q}clearListeners(){for(let $ in this.events)this.events[$].clear()}attach($,J){this.passiveEffect=$,this.stopPassiveEffect=J}set($){if(!this.passiveEffect)this.updateAndNotify($);else this.passiveEffect($,this.updateAndNotify)}setWithVelocity($,J,Q){this.set(J),this.prev=void 0,this.prevFrameValue=$,this.prevUpdatedAt=this.updatedAt-Q}jump($,J=!0){if(this.updateAndNotify($),this.prev=$,this.prevUpdatedAt=this.prevFrameValue=void 0,J&&this.stop(),this.stopPassiveEffect)this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent($){if(!this.dependents)this.dependents=new Set;this.dependents.add($)}removeDependent($){if(this.dependents)this.dependents.delete($)}get(){if(yb.current)yb.current.push(this);return this.current}getPrevious(){return this.prev}getVelocity(){let $=j5.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||$-this.updatedAt>Eb)return 0;let J=Math.min(this.updatedAt-this.prevUpdatedAt,Eb);return dZ(parseFloat(this.current)-parseFloat(this.prevFrameValue),J)}start($){return this.stop(),new Promise((J)=>{if(this.hasAnimated=!0,this.animation=$(J),this.events.animationStart)this.events.animationStart.notify()}).then(()=>{if(this.events.animationComplete)this.events.animationComplete.notify();this.clearAnimation()})}stop(){if(this.animation){if(this.animation.stop(),this.events.animationCancel)this.events.animationCancel.notify()}this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){if(this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect)this.stopPassiveEffect()}}function h9($,J){return new Pb($,J)}function nz($,J){if($?.inherit&&J){let{inherit:Q,...Z}=$;return{...J,...Z}}return $}function sJ($,J){let Q=$?.[J]??$?.default??$;if(Q!==$)return nz(Q,$);return Q}var gi={type:"spring",stiffness:500,damping:25,restSpeed:10},ui=($)=>({type:"spring",stiffness:550,damping:$===0?2*Math.sqrt(550):30,restSpeed:10}),mi={type:"keyframes",duration:0.8},ci={type:"keyframes",ease:[0.25,0.1,0.35,1],duration:0.3},Rb=($,{keyframes:J})=>{if(J.length>2)return mi;else if(W9.has($))return $.startsWith("scale")?ui(J[1]):gi;return ci};var di=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function Cb($){for(let J in $)if(!di.has(J))return!0;return!1}var n2=($,J,Q,Z={},q,X)=>(Y)=>{let z=sJ(Z,$)||{},K=z.delay||Z.delay||0,{elapsed:W=0}=Z;W=W-f5(K);let H={keyframes:Array.isArray(Q)?Q:[null,Q],ease:"easeOut",velocity:J.getVelocity(),...z,delay:-W,onUpdate:(U)=>{J.set(U),z.onUpdate&&z.onUpdate(U)},onComplete:()=>{Y(),z.onComplete&&z.onComplete()},name:$,motionValue:J,element:X?void 0:q};if(!Cb(z))Object.assign(H,Rb($,H));if(H.duration&&(H.duration=f5(H.duration)),H.repeatDelay&&(H.repeatDelay=f5(H.repeatDelay)),H.from!==void 0)H.keyframes[0]=H.from;let B=!1;if(H.type===!1||H.duration===0&&!H.repeatDelay){if(qq(H),H.delay===0)B=!0}if(Q6.instantAnimations||Q6.skipAnimations||q?.shouldSkipAnimations||z.skipAnimations)B=!0,qq(H),H.delay=0;if(H.allowFlatten=!z.type&&!z.ease,B&&!X&&J.get()!==void 0){let U=h7(H.keyframes,z);if(U!==void 0){w1.update(()=>{H.onUpdate(U),H.onComplete()});return}}return z.isSync?new x7(H):new EU(H)};var pi=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function li($){let J=pi.exec($);if(!J)return[,];let[,Q,Z,q]=J;return[`--${Q??Z}`,q]}var ii=4;function yU($,J,Q=1){N6(Q<=ii,`Max CSS variable fallback depth detected in property "${$}". This may indicate a circular fallback dependency.`,"max-css-var-depth");let[Z,q]=li($);if(!Z)return;let X=window.getComputedStyle(J).getPropertyValue(Z);if(X){let Y=X.trim();return gZ(Y)?parseFloat(Y):Y}return cJ(q)?yU(q,J,Q+1):q}function Sb($){let J=[{},{}];return $?.values.forEach((Q,Z)=>{J[0][Z]=Q.get(),J[1][Z]=Q.getVelocity()}),J}function a2($,J,Q,Z){if(typeof J==="function"){let[q,X]=Sb(Z);J=J(Q!==void 0?Q:$.custom,q,X)}if(typeof J==="string")J=$.variants&&$.variants[J];if(typeof J==="function"){let[q,X]=Sb(Z);J=J(Q!==void 0?Q:$.custom,q,X)}return J}function R6($,J,Q){let Z=$.getProps();return a2(Z,J,Q!==void 0?Q:Z.custom,$)}var az=new Set(["width","height","top","left","right","bottom",...G4]);var Xq=($)=>{return Array.isArray($)};function ri($,J,Q){if($.hasValue(J))$.getValue(J).set(Q);else $.addValue(J,h9(Q))}function si($){return Xq($)?$[$.length-1]||0:$}function hb($,J){let Q=R6($,J),{transitionEnd:Z={},transition:q={},...X}=Q||{};X={...X,...Z};for(let Y in X){let z=si(X[Y]);ri($,Y,z)}}var X5=($)=>Boolean($&&$.getVelocity);function xb($){return Boolean(X5($)&&$.add)}function oJ($,J){let Q=$.getValue("willChange");if(xb(Q))return Q.add(J);else if(!Q&&Q6.WillChange){let Z=new Q6.WillChange("auto");$.addValue("willChange",Z),Z.add(J)}}function nJ($){return $.replace(/([A-Z])/g,(J)=>`-${J.toLowerCase()}`)}var fb="framerAppearId",Yq="data-"+nJ(fb);function tz($){return $.props[Yq]}function oi({protectedKeys:$,needsAnimating:J},Q){let Z=$.hasOwnProperty(Q)&&J[Q]!==!0;return J[Q]=!1,Z}function ez($,J,{delay:Q=0,transitionOverride:Z,type:q}={}){let{transition:X,transitionEnd:Y,...z}=J,K=$.getDefaultTransition();X=X?nz(X,K):K;let W=X?.reduceMotion,H=X?.skipAnimations;if(Z)X=Z;let B=[],U=q&&$.animationState&&$.animationState.getState()[q],_=X?.path;if(_)_.animateVisualElement($,z,X,Q,B);for(let L in z){let F=$.getValue(L,$.latestValues[L]??null),V=z[L];if(V===void 0||U&&oi(U,L))continue;let M={delay:Q,...sJ(X||{},L)};if(H)M.skipAnimations=!0;let D=F.get();if(D!==void 0&&!F.isAnimating()&&!Array.isArray(V)&&V===D&&!M.velocity){w1.update(()=>F.set(V));continue}let N=!1;if(window.MotionHandoffAnimation){let I=tz($);if(I){let b=window.MotionHandoffAnimation(I,L,w1);if(b!==null)M.startTime=b,N=!0}}oJ($,L);let O=W??$.shouldReduceMotion;F.start(n2(L,F,V,O&&az.has(L)?{type:!1}:M,$,N));let k=F.animation;if(k)B.push(k)}if(Y){let L=()=>w1.update(()=>{Y&&hb($,Y)});if(B.length)Promise.all(B).then(L);else L()}return B}function $K($,J,Q={}){let Z=R6($,J,Q.type==="exit"?$.presenceContext?.custom:void 0),{transition:q=$.getDefaultTransition()||{}}=Z||{};if(Q.transitionOverride)q=Q.transitionOverride;let X=Z?()=>Promise.all(ez($,Z,Q)):()=>Promise.resolve(),Y=$.variantChildren&&$.variantChildren.size?(K=0)=>{let{delayChildren:W=0,staggerChildren:H,staggerDirection:B}=q;return ni($,J,K,W,H,B,Q)}:()=>Promise.resolve(),{when:z}=q;if(z){let[K,W]=z==="beforeChildren"?[X,Y]:[Y,X];return K().then(()=>W())}else return Promise.all([X(),Y(Q.delay)])}function ni($,J,Q=0,Z=0,q=0,X=1,Y){let z=[];for(let K of $.variantChildren)K.notify("AnimationStart",J),z.push($K(K,J,{...Y,delay:Q+(typeof Z==="function"?0:Z)+oz($.variantChildren,K,Z,q,X)}).then(()=>K.notify("AnimationComplete",J)));return Promise.all(z)}function vb($,J,Q={}){$.notify("AnimationStart",J);let Z;if(Array.isArray(J)){let q=J.map((X)=>$K($,X,Q));Z=Promise.all(q)}else if(typeof J==="string")Z=$K($,J,Q);else{let q=typeof J==="function"?R6($,J,Q.custom):J;Z=Promise.all(ez($,q,Q))}return Z.then(()=>{$.notify("AnimationComplete",J)})}var gb={test:($)=>$==="auto",parse:($)=>$};var JK=($)=>(J)=>J.test($);var PU=[z4,p0,c8,G9,BU,HU,gb],RU=($)=>PU.find(JK($));function ub($){if(typeof $==="number")return $===0;else if($!==null)return $==="none"||$==="0"||mZ($);else return!0}var ai=new Set(["brightness","contrast","saturate","opacity"]);function ti($){let[J,Q]=$.slice(0,-1).split("(");if(J==="drop-shadow")return $;let[Z]=Q.match(dJ)||[];if(!Z)return $;let q=Q.replace(Z,""),X=ai.has(J)?1:0;if(Z!==Q)X*=100;return J+"("+X+q+")"}var ei=/\b([a-z-]*)\(.*?\)/gu,zq={...L8,getAnimatableNone:($)=>{let J=$.match(ei);return J?J.map(ti).join(" "):$}};var Kq={...L8,getAnimatableNone:($)=>{let J=L8.parse($);return L8.createTransformer($)(J.map((Z)=>typeof Z==="number"?0:typeof Z==="object"?{...Z,alpha:1}:Z))}};var CU={...z4,transform:Math.round};var mb={rotate:G9,pathRotation:G9,rotateX:G9,rotateY:G9,rotateZ:G9,scale:eZ,scaleX:eZ,scaleY:eZ,scaleZ:eZ,skew:G9,skewX:G9,skewY:G9,distance:p0,translateX:p0,translateY:p0,translateZ:p0,x:p0,y:p0,z:p0,perspective:p0,transformPerspective:p0,opacity:i4,originX:Sz,originY:Sz,originZ:p0};var t2={borderWidth:p0,borderTopWidth:p0,borderRightWidth:p0,borderBottomWidth:p0,borderLeftWidth:p0,borderRadius:p0,borderTopLeftRadius:p0,borderTopRightRadius:p0,borderBottomRightRadius:p0,borderBottomLeftRadius:p0,width:p0,maxWidth:p0,height:p0,maxHeight:p0,top:p0,right:p0,bottom:p0,left:p0,inset:p0,insetBlock:p0,insetBlockStart:p0,insetBlockEnd:p0,insetInline:p0,insetInlineStart:p0,insetInlineEnd:p0,padding:p0,paddingTop:p0,paddingRight:p0,paddingBottom:p0,paddingLeft:p0,paddingBlock:p0,paddingBlockStart:p0,paddingBlockEnd:p0,paddingInline:p0,paddingInlineStart:p0,paddingInlineEnd:p0,margin:p0,marginTop:p0,marginRight:p0,marginBottom:p0,marginLeft:p0,marginBlock:p0,marginBlockStart:p0,marginBlockEnd:p0,marginInline:p0,marginInlineStart:p0,marginInlineEnd:p0,fontSize:p0,backgroundPositionX:p0,backgroundPositionY:p0,...mb,zIndex:CU,fillOpacity:i4,strokeOpacity:i4,numOctaves:CU};var $r={...t2,color:O5,backgroundColor:O5,outlineColor:O5,fill:O5,stroke:O5,borderColor:O5,borderTopColor:O5,borderRightColor:O5,borderBottomColor:O5,borderLeftColor:O5,filter:zq,WebkitFilter:zq,mask:Kq,WebkitMask:Kq},QK=($)=>$r[$];var Jr=new Set([zq,Kq]);function ZK($,J){let Q=QK($);if(!Jr.has(Q))Q=L8;return Q.getAnimatableNone?Q.getAnimatableNone(J):void 0}var Qr=new Set(["auto","none","0"]);function cb($,J,Q){let Z=0,q=void 0;while(Z<$.length&&!q){let X=$[Z];if(typeof X==="string"&&!Qr.has(X)&&S7(X).values.length)q=$[Z];Z++}if(q&&Q)for(let X of J)$[X]=ZK(Q,q)}class SU extends s2{constructor($,J,Q,Z,q){super($,J,Q,Z,q,!0)}readKeyframes(){let{unresolvedKeyframes:$,element:J,name:Q}=this;if(!J||!J.current)return;super.readKeyframes();for(let W=0;W<$.length;W++){let H=$[W];if(typeof H==="string"){if(H=H.trim(),cJ(H)){let B=yU(H,J.current);if(B!==void 0)$[W]=B;if(W===$.length-1)this.finalKeyframe=H}}}if(this.resolveNoneKeyframes(),!az.has(Q)||$.length!==2)return;let[Z,q]=$,X=RU(Z),Y=RU(q),z=GU(Z),K=GU(q);if(z!==K&&r4[Q]){this.needsMeasurement=!0;return}if(X===Y)return;if(NU(X)&&NU(Y))for(let W=0;W<$.length;W++){let H=$[W];if(typeof H==="string")$[W]=parseFloat(H)}else if(r4[Q])this.needsMeasurement=!0}resolveNoneKeyframes(){let{unresolvedKeyframes:$,name:J}=this,Q=[];for(let Z=0;Z<$.length;Z++)if($[Z]===null||ub($[Z]))Q.push(Z);if(Q.length)cb($,Q,J)}measureInitialState(){let{element:$,unresolvedKeyframes:J,name:Q}=this;if(!$||!$.current)return;if(Q==="height")this.suspendedScrollY=window.pageYOffset;this.measuredOrigin=r4[Q]($.measureViewportBox(),window.getComputedStyle($.current)),J[0]=this.measuredOrigin;let Z=J[J.length-1];if(Z!==void 0)$.getValue(Q,Z).jump(Z,!1)}measureEndState(){let{element:$,name:J,unresolvedKeyframes:Q}=this;if(!$||!$.current)return;let Z=$.getValue(J);Z&&Z.jump(this.measuredOrigin,!1);let q=Q.length-1,X=Q[q];if(Q[q]=r4[J]($.measureViewportBox(),window.getComputedStyle($.current)),X!==null&&this.finalKeyframe===void 0)this.finalKeyframe=X;if(this.removedTransforms?.length)this.removedTransforms.forEach(([Y,z])=>{$.getValue(Y).set(z)});this.resolveNoneKeyframes()}}var Gq=["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"];function qK($,J,Q){if($==null)return[];if($ instanceof EventTarget)return[$];else if(typeof $==="string"){let Z=document;if(J)Z=J.current;let q=Q?.[$]??Z.querySelectorAll($);return q?Array.from(q):[]}return Array.from($).filter((Z)=>Z!=null)}var Wq=($,J)=>{return J&&typeof $==="number"?J.transform($):$};function db($){return uZ($)&&"offsetHeight"in $&&!("ownerSVGElement"in $)}var{schedule:e2,cancel:Zr}=yz(queueMicrotask,!1);var H9={x:!1,y:!1};function XK(){return H9.x||H9.y}function hU($){if($==="x"||$==="y")if(H9[$])return null;else return H9[$]=!0,()=>{H9[$]=!1};else if(H9.x||H9.y)return null;else return H9.x=H9.y=!0,()=>{H9.x=H9.y=!1}}function YK($,J){let Q=qK($),Z=new AbortController,q={passive:!0,...J,signal:Z.signal};return[Q,q,()=>Z.abort()]}function qr($){return!($.pointerType==="touch"||XK())}function xU($,J,Q={}){let[Z,q,X]=YK($,Q);return Z.forEach((Y)=>{let z=!1,K=!1,W,H=()=>{Y.removeEventListener("pointerleave",L)},B=(V)=>{if(W)W(V),W=void 0;H()},U=(V)=>{if(z=!1,window.removeEventListener("pointerup",U),window.removeEventListener("pointercancel",U),K)K=!1,B(V)},_=()=>{z=!0,window.addEventListener("pointerup",U,q),window.addEventListener("pointercancel",U,q)},L=(V)=>{if(V.pointerType==="touch")return;if(z){K=!0;return}B(V)},F=(V)=>{if(!qr(V))return;K=!1;let M=J(Y,V);if(typeof M!=="function")return;W=M,Y.addEventListener("pointerleave",L,q)};Y.addEventListener("pointerenter",F,q),Y.addEventListener("pointerdown",_,q)}),X}var fU=($,J)=>{if(!J)return!1;else if($===J)return!0;else return fU($,J.parentElement)};var $$=($)=>{if($.pointerType==="mouse")return typeof $.button!=="number"||$.button<=0;else return $.isPrimary!==!1};var Xr=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function vU($){return Xr.has($.tagName)||$.isContentEditable===!0}var Yr=new Set(["INPUT","SELECT","TEXTAREA"]);function gU($){return Yr.has($.tagName)||$.isContentEditable===!0}var aJ=new WeakSet;function pb($){return(J)=>{if(J.key!=="Enter")return;$(J)}}function uU($,J){$.dispatchEvent(new PointerEvent("pointer"+J,{isPrimary:!0,bubbles:!0}))}var lb=($,J)=>{let Q=$.currentTarget;if(!Q)return;let Z=pb(()=>{if(aJ.has(Q))return;uU(Q,"down");let q=pb(()=>{uU(Q,"up")}),X=()=>uU(Q,"cancel");Q.addEventListener("keyup",q,J),Q.addEventListener("blur",X,J)});Q.addEventListener("keydown",Z,J),Q.addEventListener("blur",()=>Q.removeEventListener("keydown",Z),J)};function ib($){return $$($)&&!XK()}var rb=new WeakSet;function mU($,J,Q={}){let[Z,q,X]=YK($,Q),Y=(z)=>{let K=z.currentTarget;if(!ib(z))return;if(rb.has(z))return;if(aJ.add(K),Q.stopPropagation)rb.add(z);let W=J(K,z),H={...q,capture:!0},B=(L,F)=>{if(window.removeEventListener("pointerup",U,H),window.removeEventListener("pointercancel",_,H),aJ.has(K))aJ.delete(K);if(!ib(L))return;if(typeof W==="function")W(L,{success:F})},U=(L)=>{B(L,K===window||K===document||Q.useGlobalTarget||fU(K,L.target))},_=(L)=>{B(L,!1)};window.addEventListener("pointerup",U,H),window.addEventListener("pointercancel",_,H)};return Z.forEach((z)=>{if((Q.useGlobalTarget?window:z).addEventListener("pointerdown",Y,q),db(z)){if(z.addEventListener("focus",(W)=>lb(W,q)),!vU(z)&&!z.hasAttribute("tabindex"))z.tabIndex=0}}),X}function tJ($){return uZ($)&&"ownerSVGElement"in $}var zK=new WeakMap,KK,sb=($,J,Q)=>(Z,q)=>{if(q&&q[0])return q[0][$+"Size"];else if(tJ(Z)&&"getBBox"in Z)return Z.getBBox()[J];else return Z[Q]},zr=sb("inline","width","offsetWidth"),Kr=sb("block","height","offsetHeight");function Gr({target:$,borderBoxSize:J}){zK.get($)?.forEach((Q)=>{Q($,{get width(){return zr($,J)},get height(){return Kr($,J)}})})}function Wr($){$.forEach(Gr)}function Hr(){if(typeof ResizeObserver>"u")return;KK=new ResizeObserver(Wr)}function ob($,J){if(!KK)Hr();let Q=qK($);return Q.forEach((Z)=>{let q=zK.get(Z);if(!q)q=new Set,zK.set(Z,q);q.add(J),KK?.observe(Z)}),()=>{Q.forEach((Z)=>{let q=zK.get(Z);if(q?.delete(J),!q?.size)KK?.unobserve(Z)})}}var GK=new Set,eJ;function Br(){eJ=()=>{let $={get width(){return window.innerWidth},get height(){return window.innerHeight}};GK.forEach((J)=>J($))},window.addEventListener("resize",eJ)}function nb($){if(GK.add($),!eJ)Br();return()=>{if(GK.delete($),!GK.size&&typeof eJ==="function")window.removeEventListener("resize",eJ),eJ=void 0}}function WK($,J){return typeof $==="function"?nb($):ob($,J)}var J$={value:null,addProjectionMetrics:null};function ab($){return tJ($)&&$.tagName==="svg"}var Ur=[...PU,O5,L8],tb=($)=>Ur.find(JK($));var cU=()=>({translate:0,scale:1,origin:0,originPoint:0}),f7=()=>({x:cU(),y:cU()}),dU=()=>({min:0,max:0}),A5=()=>({x:dU(),y:dU()});var eb=new WeakMap;function s4($){return $!==null&&typeof $==="object"&&typeof $.start==="function"}function W4($){return typeof $==="string"||Array.isArray($)}var HK=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Hq=["initial",...HK];function v7($){return s4($.animate)||Hq.some((J)=>W4($[J]))}function Bq($){return Boolean(v7($)||$.variants)}function $j($,J,Q){for(let Z in J){let q=J[Z],X=Q[Z];if(X5(q))$.addValue(Z,q);else if(X5(X))$.addValue(Z,h9(q,{owner:$}));else if(X!==q)if($.hasValue(Z)){let Y=$.getValue(Z);if(Y.liveStyle===!0)Y.jump(q);else if(!Y.hasAnimated)Y.set(q)}else{let Y=$.getStaticValue(Z);$.addValue(Z,h9(Y!==void 0?Y:q,{owner:$}))}}for(let Z in Q)if(J[Z]===void 0)$.removeValue(Z);return J}var Uq={current:null},BK={current:!1};var _r=typeof window<"u";function Jj(){if(BK.current=!0,!_r)return;if(window.matchMedia){let $=window.matchMedia("(prefers-reduced-motion)"),J=()=>Uq.current=$.matches;$.addEventListener("change",J),J()}else Uq.current=!1}var Qj=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],UK={};function _q($){UK=$}function pU(){return UK}class _K{scrapeMotionValuesFromProps($,J,Q){return{}}constructor({parent:$,props:J,presenceContext:Q,reducedMotionConfig:Z,skipAnimations:q,blockInitialAnimation:X,visualState:Y},z={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=s2,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{if(!this.current)return;this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection)},this.renderScheduledAt=0,this.scheduleRender=()=>{let U=j5.now();if(this.renderScheduledAtthis.bindToMotionValue(Q,J)),this.reducedMotionConfig==="never")this.shouldReduceMotion=!1;else if(this.reducedMotionConfig==="always")this.shouldReduceMotion=!0;else{if(!BK.current)Jj();this.shouldReduceMotion=Uq.current}this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),O6(this.notifyUpdate),O6(this.render),this.valueSubscriptions.forEach(($)=>$()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(let $ in this.events)this.events[$].clear();for(let $ in this.features){let J=this.features[$];if(J)J.unmount(),J.isMounted=!1}this.current=null}addChild($){this.children.add($),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add($)}removeChild($){this.children.delete($),this.enteringChildren&&this.enteringChildren.delete($)}bindToMotionValue($,J){if(this.valueSubscriptions.has($))this.valueSubscriptions.get($)();if(J.accelerate&&sz.has($)&&this.current instanceof HTMLElement){let{factory:X,keyframes:Y,times:z,ease:K,duration:W}=J.accelerate,H=new Zq({element:this.current,name:$,keyframes:Y,times:z,ease:K,duration:f5(W)}),B=X(H);this.valueSubscriptions.set($,()=>{B(),H.cancel()});return}let Q=W9.has($);if(Q&&this.onBindTransform)this.onBindTransform();let Z=J.on("change",(X)=>{if(this.latestValues[$]=X,this.props.onUpdate&&w1.preRender(this.notifyUpdate),Q&&this.projection)this.projection.isTransformDirty=!0;this.scheduleRender()}),q;if(typeof window<"u"&&window.MotionCheckAppearSync)q=window.MotionCheckAppearSync(this,$,J);this.valueSubscriptions.set($,()=>{if(Z(),q)q()})}sortNodePosition($){if(!this.current||!this.sortInstanceNodePosition||this.type!==$.type)return 0;return this.sortInstanceNodePosition(this.current,$.current)}updateFeatures(){let $="animation";for($ in UK){let J=UK[$];if(!J)continue;let{isEnabled:Q,Feature:Z}=J;if(!this.features[$]&&Z&&Q(this.props))this.features[$]=new Z(this);if(this.features[$]){let q=this.features[$];if(q.isMounted)q.update();else q.mount(),q.isMounted=!0}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):A5()}getStaticValue($){return this.latestValues[$]}setStaticValue($,J){this.latestValues[$]=J}update($,J){if($.transformTemplate||this.props.transformTemplate)this.scheduleRender();this.prevProps=this.props,this.props=$,this.prevPresenceContext=this.presenceContext,this.presenceContext=J;for(let Q=0;QJ.variantChildren.delete($)}addValue($,J){let Q=this.values.get($);if(J!==Q){if(Q)this.removeValue($);this.bindToMotionValue($,J),this.values.set($,J),this.latestValues[$]=J.get()}}removeValue($){this.values.delete($);let J=this.valueSubscriptions.get($);if(J)J(),this.valueSubscriptions.delete($);delete this.latestValues[$],this.removeValueFromRenderState($,this.renderState)}hasValue($){return this.values.has($)}getValue($,J){if(this.props.values&&this.props.values[$])return this.props.values[$];let Q=this.values.get($);if(Q===void 0&&J!==void 0)Q=h9(J===null?void 0:J,{owner:this}),this.addValue($,Q);return Q}readValue($,J){let Q=this.latestValues[$]!==void 0||!this.current?this.latestValues[$]:this.getBaseTargetFromProps(this.props,$)??this.readValueFromInstance(this.current,$,this.options);if(Q!==void 0&&Q!==null){if(typeof Q==="string"&&(gZ(Q)||mZ(Q)))Q=parseFloat(Q);else if(!tb(Q)&&L8.test(J))Q=ZK($,J);this.setBaseTarget($,X5(Q)?Q.get():Q)}return X5(Q)?Q.get():Q}setBaseTarget($,J){this.baseTarget[$]=J}getBaseTarget($){let{initial:J}=this.props,Q;if(typeof J==="string"||typeof J==="object"){let q=a2(this.props,J,this.presenceContext?.custom);if(q)Q=q[$]}if(J&&Q!==void 0)return Q;let Z=this.getBaseTargetFromProps(this.props,$);if(Z!==void 0&&!X5(Z))return Z;return this.initialValues[$]!==void 0&&Q===void 0?void 0:this.baseTarget[$]}on($,J){if(!this.events[$])this.events[$]=new y7;return this.events[$].add(J)}notify($,...J){if(this.events[$])this.events[$].notify(...J)}scheduleRenderMicrotask(){e2.render(this.render)}}class Lq extends _K{constructor(){super(...arguments);this.KeyframeResolver=SU}sortInstanceNodePosition($,J){return $.compareDocumentPosition(J)&2?1:-1}getBaseTargetFromProps($,J){let Q=$.style;return Q?Q[J]:void 0}removeValueFromRenderState($,{vars:J,style:Q}){delete J[$],delete Q[$]}handleChildMotionValue(){if(this.childSubscription)this.childSubscription(),delete this.childSubscription;let{children:$}=this.props;if(X5($))this.childSubscription=$.on("change",(J)=>{if(this.current)this.current.textContent=`${J}`})}}class k8{constructor($){this.isMounted=!1,this.node=$}update(){}}function Fq({top:$,left:J,right:Q,bottom:Z}){return{x:{min:J,max:Q},y:{min:$,max:Z}}}function lU({x:$,y:J}){return{top:J.min,right:$.max,bottom:J.max,left:$.min}}function iU($,J){if(!J)return $;let Q=J({x:$.left,y:$.top}),Z=J({x:$.right,y:$.bottom});return{top:Q.y,left:Q.x,bottom:Z.y,right:Z.x}}function rU($){return $===void 0||$===1}function LK({scale:$,scaleX:J,scaleY:Q}){return!rU($)||!rU(J)||!rU(Q)}function o4($){return LK($)||sU($)||$.z||$.rotate||$.rotateX||$.rotateY||$.skewX||$.skewY}function sU($){return Zj($.x)||Zj($.y)}function Zj($){return $&&$!=="0%"}function Vq($,J,Q){let Z=$-Q,q=J*Z;return Q+q}function qj($,J,Q,Z,q){if(q!==void 0)$=Vq($,q,Z);return Vq($,Q,Z)+J}function oU($,J=0,Q=1,Z,q){$.min=qj($.min,J,Q,Z,q),$.max=qj($.max,J,Q,Z,q)}function nU($,{x:J,y:Q}){oU($.x,J.translate,J.scale,J.originPoint),oU($.y,Q.translate,Q.scale,Q.originPoint)}var Xj=0.999999999999,Yj=1.0000000000001;function Gj($,J,Q,Z=!1){let q=Q.length;if(!q)return;J.x=J.y=1;let X,Y;for(let z=0;zXj)J.x=1;if(J.yXj)J.y=1}function B9($,J){$.min+=J,$.max+=J}function zj($,J,Q,Z,q=0.5){let X=I1($.min,$.max,q);oU($,J,Q,X,Z)}function Kj($,J){if(typeof $==="string")return parseFloat($)/100*(J.max-J.min);return $}function Mq($,J,Q){let Z=Q??$;zj($.x,Kj(J.x,Z.x),J.scaleX,J.scale,J.originX),zj($.y,Kj(J.y,Z.y),J.scaleY,J.scale,J.originY)}function FK($,J){return Fq(iU($.getBoundingClientRect(),J))}function aU($,J,Q){let Z=FK($,Q),{scroll:q}=J;if(q)B9(Z.x,q.offset.x),B9(Z.y,q.offset.y);return Z}var Lr={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Fr=G4.length;function Wj($,J,Q){let Z="",q=!0;for(let Y=0;Y{if(!J.target)return $;if(typeof $==="string")if(p0.test($))$=parseFloat($);else return $;let Q=Hj($,J.target.x),Z=Hj($,J.target.y);return`${Q}% ${Z}%`}};var Bj={correct:($,{treeScale:J,projectionDelta:Q})=>{let Z=$,q=L8.parse($);if(q.length>5)return Z;let X=L8.createTransformer($),Y=typeof q[0]!=="number"?1:0,z=Q.x.scale*J.x,K=Q.y.scale*J.y;q[0+Y]/=z,q[1+Y]/=K;let W=I1(z,K,0.5);if(typeof q[2+Y]==="number")q[2+Y]/=W;if(typeof q[3+Y]==="number")q[3+Y]/=W;return X(q)}};var Dq={borderRadius:{...$Q,applyTo:[...Gq]},borderTopLeftRadius:$Q,borderTopRightRadius:$Q,borderBottomLeftRadius:$Q,borderBottomRightRadius:$Q,boxShadow:Bj};function Nq($,{layout:J,layoutId:Q}){return W9.has($)||$.startsWith("origin")||(J||Q!==void 0)&&(!!Dq[$]||$==="opacity")}function Z$($,J,Q){let Z=$.style,q=J?.style,X={};if(!Z)return X;for(let Y in Z)if(X5(Z[Y])||q&&X5(q[Y])||Nq(Y,$)||Q?.getValue(Y)?.liveStyle!==void 0)X[Y]=Z[Y];return X}function Vr($){return window.getComputedStyle($)}class MK extends Lq{constructor(){super(...arguments);this.type="html",this.renderInstance=VK}readValueFromInstance($,J){if(W9.has(J))return this.projection?.isProjecting?cz(J):_b($,J);else{let Q=Vr($),Z=(Rz(J)?Q.getPropertyValue(J):Q[J])||0;return typeof Z==="string"?Z.trim():Z}}measureInstanceViewportBox($,{transformPagePoint:J}){return FK($,J)}build($,J,Q){Q$($,J,Q.transformTemplate)}scrapeMotionValuesFromProps($,J,Q){return Z$($,J,Q)}}var Mr={offset:"stroke-dashoffset",array:"stroke-dasharray"},Dr={offset:"strokeDashoffset",array:"strokeDasharray"};function Uj($,J,Q=1,Z=0,q=!0){$.pathLength=1;let X=q?Mr:Dr;$[X.offset]=`${-Z}`,$[X.array]=`${J} ${Q}`}var Nr=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function Oq($,{attrX:J,attrY:Q,attrScale:Z,pathLength:q,pathSpacing:X=1,pathOffset:Y=0,...z},K,W,H){if(Q$($,z,W),K){if($.style.viewBox)$.attrs.viewBox=$.style.viewBox;return}$.attrs=$.style,$.style={};let{attrs:B,style:U}=$;if(B.transform)U.transform=B.transform,delete B.transform;if(U.transform||B.transformOrigin)U.transformOrigin=B.transformOrigin??"50% 50%",delete B.transformOrigin;if(U.transform)U.transformBox=H?.transformBox??"fill-box",delete B.transformBox;for(let _ of Nr)if(B[_]!==void 0)U[_]=B[_],delete B[_];if(J!==void 0)B.x=J;if(Q!==void 0)B.y=Q;if(Z!==void 0)B.scale=Z;if(q!==void 0)Uj(B,q,X,Y,!1)}var DK=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);var Aq=($)=>typeof $==="string"&&$.toLowerCase()==="svg";function _j($,J,Q,Z){VK($,J,void 0,Z);for(let q in J.attrs)$.setAttribute(!DK.has(q)?nJ(q):q,J.attrs[q])}function wq($,J,Q){let Z=Z$($,J,Q);for(let q in $)if(X5($[q])||X5(J[q])){let X=G4.indexOf(q)!==-1?"attr"+q.charAt(0).toUpperCase()+q.substring(1):q;Z[X]=$[q]}return Z}class NK extends Lq{constructor(){super(...arguments);this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=A5}getBaseTargetFromProps($,J){return $[J]}readValueFromInstance($,J){if(W9.has(J)){let Q=QK(J);return Q?Q.default||0:0}return J=!DK.has(J)?nJ(J):J,$.getAttribute(J)}scrapeMotionValuesFromProps($,J,Q){return wq($,J,Q)}build($,J,Q){Oq($,J,this.isSVGTag,Q.transformTemplate,Q.style)}renderInstance($,J,Q,Z){_j($,J,Q,Z)}mount($){this.isSVGTag=Aq($.tagName),super.mount($)}}var Or=Hq.length;function tU($){if(!$)return;if(!$.isControllingVariants){let Q=$.parent?tU($.parent)||{}:{};if($.props.initial!==void 0)Q.initial=$.props.initial;return Q}let J={};for(let Q=0;Q{return Promise.all(J.map(({animation:Q,options:Z})=>vb($,Q,Z)))}}function $_($){let J=kr($),Q=Lj(),Z=!0,q=!1,X=(W)=>(H,B)=>{let U=R6($,B,W==="exit"?$.presenceContext?.custom:void 0);if(U){let{transition:_,transitionEnd:L,...F}=U;H={...H,...F,...L}}return H};function Y(W){J=W($)}function z(W){let{props:H}=$,B=tU($.parent)||{},U=[],_=new Set,L={},F=1/0;for(let M=0;MF&&k,C=!1,y=Array.isArray(O)?O:[O],x=y.reduce(X(D),{});if(I===!1)x={};let{prevResolvedValues:E={}}=N,P={...E,...x},h=(S)=>{if(w=!0,_.has(S))C=!0,_.delete(S);N.needsAnimating[S]=!0;let r=$.getValue(S);if(r)r.liveStyle=!1};for(let S in P){let r=x[S],$0=E[S];if(L.hasOwnProperty(S))continue;let K0=!1;if(Xq(r)&&Xq($0))K0=!eU(r,$0)||A;else K0=r!==$0;if(K0)if(r!==void 0&&r!==null)h(S);else _.add(S);else if(r!==void 0&&_.has(S))h(S);else N.protectedKeys[S]=!0}if(N.prevProp=O,N.prevResolvedValues=x,N.isActive)L={...L,...x};if((Z||q)&&$.blockInitialAnimation)w=!1;let p=b&&A;if(w&&(!p||C))U.push(...y.map((S)=>{let r={type:D};if(typeof S==="string"&&(Z||q)&&!p&&$.manuallyAnimateOnMount&&$.parent){let{parent:$0}=$,K0=R6($0,S);if($0.enteringChildren&&K0){let{delayChildren:t}=K0.transition||{};r.delay=oz($0.enteringChildren,$,t)}}return{animation:S,options:r}}))}if(_.size){let M={};if(typeof H.initial!=="boolean"){let D=R6($,Array.isArray(H.initial)?H.initial[0]:H.initial);if(D&&D.transition)M.transition=D.transition}_.forEach((D)=>{let N=$.getBaseTarget(D),O=$.getValue(D);if(O)O.liveStyle=!0;M[D]=N??null}),U.push({animation:M})}let V=Boolean(U.length);if(Z&&(H.initial===!1||H.initial===H.animate)&&!$.manuallyAnimateOnMount)V=!1;return Z=!1,q=!1,V?J(U):Promise.resolve()}function K(W,H){if(Q[W].isActive===H)return Promise.resolve();$.variantChildren?.forEach((U)=>U.animationState?.setActive(W,H)),Q[W].isActive=H;let B=z(W);for(let U in Q)Q[U].protectedKeys={};return B}return{animateChanges:z,setActive:K,setAnimateFunction:Y,getState:()=>Q,reset:()=>{Q=Lj(),q=!0}}}function Fj($,J){if(typeof J==="string")return J!==$;else if(Array.isArray(J))return!eU(J,$);return!1}function q$($=!1){return{isActive:$,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Lj(){return{animate:q$(!0),whileInView:q$(),whileHover:q$(),whileTap:q$(),whileDrag:q$(),whileFocus:q$(),exit:q$()}}function OK($,J){$.min=J.min,$.max=J.max}function U9($,J){OK($.x,J.x),OK($.y,J.y)}function J_($,J){$.translate=J.translate,$.scale=J.scale,$.originPoint=J.originPoint,$.origin=J.origin}var Vj=0.0001,Ir=1-Vj,Tr=1+Vj,Mj=0.01,br=0-Mj,jr=0+Mj;function r5($){return $.max-$.min}function X_($,J,Q){return Math.abs($-J)<=Q}function Q_($,J,Q,Z=0.5){if($.origin=Z,$.originPoint=I1(J.min,J.max,$.origin),$.scale=r5(Q)/r5(J),$.translate=I1(Q.min,Q.max,$.origin)-$.originPoint,$.scale>=Ir&&$.scale<=Tr||isNaN($.scale))$.scale=1;if($.translate>=br&&$.translate<=jr||isNaN($.translate))$.translate=0}function X$($,J,Q,Z){Q_($.x,J.x,Q.x,Z?Z.originX:void 0),Q_($.y,J.y,Q.y,Z?Z.originY:void 0)}function Z_($,J,Q,Z=0){let q=Z?I1(Q.min,Q.max,Z):Q.min;$.min=q+J.min,$.max=$.min+r5(J)}function Y_($,J,Q,Z){Z_($.x,J.x,Q.x,Z?.x),Z_($.y,J.y,Q.y,Z?.y)}function q_($,J,Q,Z=0){let q=Z?I1(Q.min,Q.max,Z):Q.min;$.min=J.min-q,$.max=$.min+r5(J)}function JQ($,J,Q,Z){q_($.x,J.x,Q.x,Z?.x),q_($.y,J.y,Q.y,Z?.y)}function Dj($,J,Q,Z,q){if($-=J,$=Vq($,1/Q,Z),q!==void 0)$=Vq($,1/q,Z);return $}function Er($,J=0,Q=1,Z=0.5,q,X=$,Y=$){if(c8.test(J))J=parseFloat(J),J=I1(Y.min,Y.max,J/100)-Y.min;if(typeof J!=="number")return;let z=I1(X.min,X.max,Z);if($===X)z-=J;$.min=Dj($.min,J,Q,z,q),$.max=Dj($.max,J,Q,z,q)}function Nj($,J,[Q,Z,q],X,Y){Er($,J[Q],J[Z],J[q],J.scale,X,Y)}var yr=["x","scaleX","originX"],Pr=["y","scaleY","originY"];function z_($,J,Q,Z){Nj($.x,J,yr,Q?Q.x:void 0,Z?Z.x:void 0),Nj($.y,J,Pr,Q?Q.y:void 0,Z?Z.y:void 0)}function Oj($){return $.translate===0&&$.scale===1}function K_($){return Oj($.x)&&Oj($.y)}function Aj($,J){return $.min===J.min&&$.max===J.max}function kj($,J){return Aj($.x,J.x)&&Aj($.y,J.y)}function wj($,J){return Math.round($.min)===Math.round(J.min)&&Math.round($.max)===Math.round(J.max)}function G_($,J){return wj($.x,J.x)&&wj($.y,J.y)}function W_($){return r5($.x)/r5($.y)}function H_($,J){return $.translate===J.translate&&$.scale===J.scale&&$.originPoint===J.originPoint}function C6($){return[$("x"),$("y")]}function Ij($,J,Q){let Z="",q=$.x.translate/J.x,X=$.y.translate/J.y,Y=Q?.z||0;if(q||X||Y)Z=`translate3d(${q}px, ${X}px, ${Y}px) `;if(J.x!==1||J.y!==1)Z+=`scale(${1/J.x}, ${1/J.y}) `;if(Q){let{transformPerspective:W,rotate:H,pathRotation:B,rotateX:U,rotateY:_,skewX:L,skewY:F}=Q;if(W)Z=`perspective(${W}px) ${Z}`;if(H)Z+=`rotate(${H}deg) `;if(B)Z+=`rotate(${B}deg) `;if(U)Z+=`rotateX(${U}deg) `;if(_)Z+=`rotateY(${_}deg) `;if(L)Z+=`skewX(${L}deg) `;if(F)Z+=`skewY(${F}deg) `}let z=$.x.scale*J.x,K=$.y.scale*J.y;if(z!==1||K!==1)Z+=`scale(${z}, ${K})`;return Z||"none"}var Rr=Gq.length,Tj=($)=>typeof $==="string"?parseFloat($):$,bj=($)=>typeof $==="number"||p0.test($);function Ej($,J,Q,Z,q,X){if(q)$.opacity=I1(0,Q.opacity??1,Cr(Z)),$.opacityExit=I1(J.opacity??1,0,Sr(Z));else if(X)$.opacity=I1(J.opacity??1,Q.opacity??1,Z);for(let Y=0;Y{if(Z<$)return 0;if(Z>J)return 1;return Q(Y4($,J,Z))}}function Pj($,J,Q){let Z=X5($)?$:h9($);return Z.start(n2("",Z,J,Q)),Z.animation}function H4($,J,Q,Z={passive:!0}){return $.addEventListener(J,Q,Z),()=>$.removeEventListener(J,Q,Z)}var Rj=($,J)=>$.depth-J.depth;class B_{constructor(){this.children=[],this.isDirty=!1}add($){d2(this.children,$),this.isDirty=!0}remove($){E7(this.children,$),this.isDirty=!0}forEach($){this.isDirty&&this.children.sort(Rj),this.isDirty=!1,this.children.forEach($)}}function Cj($,J){let Q=j5.now(),Z=({timestamp:q})=>{let X=q-Q;if(X>=J)O6(Z),$(X-J)};return w1.setup(Z,!0),()=>O6(Z)}function Y$($){return X5($)?$.get():$}class U_{constructor(){this.members=[]}add($){d2(this.members,$);for(let J=this.members.length-1;J>=0;J--){let Q=this.members[J];if(Q===$||Q===this.lead||Q===this.prevLead)continue;let Z=Q.instance;if((!Z||Z.isConnected===!1)&&!Q.snapshot)E7(this.members,Q),Q.unmount()}$.scheduleRender()}remove($){if(E7(this.members,$),$===this.prevLead)this.prevLead=void 0;if($===this.lead){let J=this.members[this.members.length-1];if(J)this.promote(J)}}relegate($){for(let J=this.members.indexOf($)-1;J>=0;J--){let Q=this.members[J];if(Q.isPresent!==!1&&Q.instance?.isConnected!==!1)return this.promote(Q),!0}return!1}promote($,J){let Q=this.lead;if($===Q)return;if(this.prevLead=Q,this.lead=$,$.show(),Q){Q.updateSnapshot(),$.scheduleRender();let{layoutDependency:Z}=Q.options,{layoutDependency:q}=$.options;if(Z===void 0||Z!==q){if($.resumeFrom=Q,J)Q.preserveOpacity=!0;if(Q.snapshot)$.snapshot=Q.snapshot,$.snapshot.latestValues=Q.animationValues||Q.latestValues;if($.root?.isUpdating)$.isLayoutDirty=!0}if($.options.crossfade===!1)Q.hide()}}exitAnimationComplete(){this.members.forEach(($)=>{$.options.onExitComplete?.(),$.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(($)=>$.instance&&$.scheduleRender(!1))}removeLeadSnapshot(){if(this.lead?.snapshot)this.lead.snapshot=void 0}}var z$={hasAnimatedSinceResize:!0,hasEverUpdated:!1};var K$={nodes:0,calculatedTargetDeltas:0,calculatedProjections:0},__=["","X","Y","Z"],hr=1000,xr=0;function L_($,J,Q,Z){let{latestValues:q}=J;if(q[$]){if(Q[$]=q[$],J.setStaticValue($,0),Z)Z[$]=0}}function cj($){if($.hasCheckedOptimisedAppear=!0,$.root===$)return;let{visualElement:J}=$.options;if(!J)return;let Q=tz(J);if(window.MotionHasOptimisedAnimation(Q,"transform")){let{layout:q,layoutId:X}=$.options;window.MotionCancelOptimisedAnimation(Q,"transform",w1,!(q||X))}let{parent:Z}=$;if(Z&&!Z.hasCheckedOptimisedAppear)cj(Z)}function AK({attachResizeListener:$,defaultParent:J,measureScroll:Q,checkIsScrollRoot:Z,resetTransform:q}){return class{constructor(Y={},z=J?.()){this.id=xr++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{if(this.isUpdating)this.isUpdating=!1,this.clearAllSnapshots()},this.updateProjection=()=>{if(this.projectionUpdateScheduled=!1,J$.value)K$.nodes=K$.calculatedTargetDeltas=K$.calculatedProjections=0;if(this.nodes.forEach(gr),this.nodes.forEach(lr),this.nodes.forEach(ir),this.nodes.forEach(ur),J$.addProjectionMetrics)J$.addProjectionMetrics(K$)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=Y,this.root=z?z.root||z:this,this.path=z?[...z.path,z]:[],this.parent=z,this.depth=z?z.depth+1:0;for(let K=0;Kthis.root.updateBlockedByResize=!1;w1.read(()=>{B=window.innerWidth}),$(Y,()=>{let _=window.innerWidth;if(_===B)return;if(B=_,this.root.updateBlockedByResize=!0,H&&H(),H=Cj(U,250),z$.hasAnimatedSinceResize)z$.hasAnimatedSinceResize=!1,this.nodes.forEach(xj)})}if(z)this.root.registerSharedNode(z,this);if(this.options.animate!==!1&&W&&(z||K))this.addEventListener("didUpdate",({delta:H,hasLayoutChanged:B,hasRelativeLayoutChanged:U,layout:_})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let L=this.options.transition||W.getDefaultTransition()||ar,{onLayoutAnimationStart:F,onLayoutAnimationComplete:V}=W.getProps(),M=!this.targetLayout||!G_(this.targetLayout,_),D=!B&&U;if(this.options.layoutRoot||this.resumeFrom||D||B&&(M||!this.currentAnimation)){if(this.resumeFrom)this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0;let N={...sJ(L,"layout"),onPlay:F,onComplete:V};if(W.shouldReduceMotion||this.options.layoutRoot)N.delay=0,N.type=!1;this.startAnimation(N),this.setAnimationOrigin(H,D,N.path)}else{if(!B)xj(this);if(this.isLead()&&this.options.onExitComplete)this.options.onExitComplete()}this.targetLayout=_})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let Y=this.getStack();Y&&Y.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),O6(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){if(this.isUpdateBlocked())return;this.isUpdating=!0,this.nodes&&this.nodes.forEach(rr),this.animationId++}getTransformTemplate(){let{visualElement:Y}=this.options;return Y&&Y.getProps().transformTemplate}willUpdate(Y=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear)cj(this);if(!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let H=0;H{if(this.isLayoutDirty)this.root.didUpdate();else this.root.checkUpdateFailed()})}updateSnapshot(){if(this.snapshot||!this.instance)return;if(this.snapshot=this.measure(),this.snapshot&&!r5(this.snapshot.measuredBox.x)&&!r5(this.snapshot.measuredBox.y))this.snapshot=void 0}updateLayout(){if(!this.instance)return;if(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty)return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let K=0;K{let b=I/1000,A=k?.(b);if(A)U.x.translate=A.x,U.x.scale=I1(Y.x.scale,1,b),U.x.origin=Y.x.origin,U.x.originPoint=Y.x.originPoint,U.y.translate=A.y,U.y.scale=I1(Y.y.scale,1,b),U.y.origin=Y.y.origin,U.y.originPoint=Y.y.originPoint;else fj(U.x,Y.x,b),fj(U.y,Y.y,b);if(this.setTargetDelta(U),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout){if(JQ(_,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),or(this.relativeTarget,this.relativeTargetOrigin,_,b),O&&kj(this.relativeTarget,O))this.isProjectionDirty=!1;if(!O)O=A5();U9(O,this.relativeTarget)}if(V)this.animationValues=B,Ej(B,H,this.latestValues,b,N,D);if(A&&A.rotate!==void 0){if(!this.animationValues)this.animationValues=B;this.animationValues.pathRotation=A.rotate}this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=b},this.mixTargetDelta(this.options.layoutRoot?1000:0)}startAnimation(Y){if(this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation)O6(this.pendingAnimation),this.pendingAnimation=void 0;this.pendingAnimation=w1.update(()=>{if(z$.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=h9(0)),this.motionValue.jump(0,!1),this.currentAnimation=Pj(this.motionValue,[0,1000],{...Y,velocity:0,isSync:!0,onUpdate:(z)=>{this.mixTargetDelta(z),Y.onUpdate&&Y.onUpdate(z)},onComplete:()=>{Y.onComplete&&Y.onComplete(),this.completeAnimation()}}),this.resumingFrom)this.resumingFrom.currentAnimation=this.currentAnimation;this.pendingAnimation=void 0})}completeAnimation(){if(this.resumingFrom)this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0;let Y=this.getStack();Y&&Y.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){if(this.currentAnimation)this.mixTargetDelta&&this.mixTargetDelta(hr),this.currentAnimation.stop();this.completeAnimation()}applyTransformsToTarget(){let Y=this.getLead(),{targetWithTransforms:z,target:K,layout:W,latestValues:H}=Y;if(!z||!K||!W)return;if(this!==Y&&this.layout&&W&&dj(this.options.animationType,this.layout.layoutBox,W.layoutBox)){K=this.target||A5();let B=r5(this.layout.layoutBox.x);K.x.min=Y.target.x.min,K.x.max=K.x.min+B;let U=r5(this.layout.layoutBox.y);K.y.min=Y.target.y.min,K.y.max=K.y.min+U}U9(z,K),Mq(z,H),X$(this.projectionDeltaWithTransform,this.layoutCorrected,z,H)}registerSharedNode(Y,z){if(!this.sharedNodes.has(Y))this.sharedNodes.set(Y,new U_);this.sharedNodes.get(Y).add(z);let W=z.options.initialPromotionConfig;z.promote({transition:W?W.transition:void 0,preserveFollowOpacity:W&&W.shouldPreserveFollowOpacity?W.shouldPreserveFollowOpacity(z):void 0})}isLead(){let Y=this.getStack();return Y?Y.lead===this:!0}getLead(){let{layoutId:Y}=this.options;return Y?this.getStack()?.lead||this:this}getPrevLead(){let{layoutId:Y}=this.options;return Y?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:Y}=this.options;if(Y)return this.root.sharedNodes.get(Y)}promote({needsReset:Y,transition:z,preserveFollowOpacity:K}={}){let W=this.getStack();if(W)W.promote(this,K);if(Y)this.projectionDelta=void 0,this.needsReset=!0;if(z)this.setOptions({transition:z})}relegate(){let Y=this.getStack();if(Y)return Y.relegate(this);else return!1}resetSkewAndRotation(){let{visualElement:Y}=this.options;if(!Y)return;let z=!1,{latestValues:K}=Y;if(K.z||K.rotate||K.rotateX||K.rotateY||K.rotateZ||K.skewX||K.skewY)z=!0;if(!z)return;let W={};if(K.z)L_("z",Y,W,this.animationValues);for(let H=0;H<__.length;H++)L_(`rotate${__[H]}`,Y,W,this.animationValues),L_(`skew${__[H]}`,Y,W,this.animationValues);Y.render();for(let H in W)if(Y.setStaticValue(H,W[H]),this.animationValues)this.animationValues[H]=W[H];Y.scheduleRender()}applyProjectionStyles(Y,z){if(!this.instance||this.isSVG)return;if(!this.isVisible){Y.visibility="hidden";return}let K=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,Y.visibility="",Y.opacity="",Y.pointerEvents=Y$(z?.pointerEvents)||"",Y.transform=K?K(this.latestValues,""):"none";return}let W=this.getLead();if(!this.projectionDelta||!this.layout||!W.target){if(this.options.layoutId)Y.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,Y.pointerEvents=Y$(z?.pointerEvents)||"";if(this.hasProjected&&!o4(this.latestValues))Y.transform=K?K({},""):"none",this.hasProjected=!1;return}Y.visibility="";let H=W.animationValues||W.latestValues;this.applyTransformsToTarget();let B=Ij(this.projectionDeltaWithTransform,this.treeScale,H);if(K)B=K(H,B);Y.transform=B;let{x:U,y:_}=this.projectionDelta;if(Y.transformOrigin=`${U.origin*100}% ${_.origin*100}% 0`,W.animationValues)Y.opacity=W===this?H.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:H.opacityExit;else Y.opacity=W===this?H.opacity!==void 0?H.opacity:"":H.opacityExit!==void 0?H.opacityExit:0;for(let L in Dq){if(H[L]===void 0)continue;let{correct:F,applyTo:V,isCSSVariable:M}=Dq[L],D=B==="none"?H[L]:F(H[L],W);if(V){let N=V.length;for(let O=0;OY.currentAnimation?.stop()),this.root.nodes.forEach(Sj),this.root.sharedNodes.clear()}}}function fr($){$.updateLayout()}function vr($){let J=$.resumeFrom?.snapshot||$.snapshot;if($.isLead()&&$.layout&&J&&$.hasListeners("didUpdate")){let{layoutBox:Q,measuredBox:Z}=$.layout,{animationType:q}=$.options,X=J.source!==$.layout.source;if(q==="size")C6((H)=>{let B=X?J.measuredBox[H]:J.layoutBox[H],U=r5(B);B.min=Q[H].min,B.max=B.min+U});else if(q==="x"||q==="y"){let H=q==="x"?"y":"x";OK(X?J.measuredBox[H]:J.layoutBox[H],Q[H])}else if(dj(q,J.layoutBox,Q))C6((H)=>{let B=X?J.measuredBox[H]:J.layoutBox[H],U=r5(Q[H]);if(B.max=B.min+U,$.relativeTarget&&!$.currentAnimation)$.isProjectionDirty=!0,$.relativeTarget[H].max=$.relativeTarget[H].min+U});let Y=f7();X$(Y,Q,J.layoutBox);let z=f7();if(X)X$(z,$.applyTransform(Z,!0),J.measuredBox);else X$(z,Q,J.layoutBox);let K=!K_(Y),W=!1;if(!$.resumeFrom){let H=$.getClosestProjectingParent();if(H&&!H.resumeFrom){let{snapshot:B,layout:U}=H;if(B&&U){let _=$.options.layoutAnchor||void 0,L=A5();JQ(L,J.layoutBox,B.layoutBox,_);let F=A5();if(JQ(F,Q,U.layoutBox,_),!G_(L,F))W=!0;if(H.options.layoutRoot)$.relativeTarget=F,$.relativeTargetOrigin=L,$.relativeParent=H}}}$.notifyListeners("didUpdate",{layout:Q,snapshot:J,delta:z,layoutDelta:Y,hasLayoutChanged:K,hasRelativeLayoutChanged:W})}else if($.isLead()){let{onExitComplete:Q}=$.options;Q&&Q()}$.options.transition=void 0}function gr($){if(J$.value)K$.nodes++;if(!$.parent)return;if(!$.isProjecting())$.isProjectionDirty=$.parent.isProjectionDirty;$.isSharedProjectionDirty||($.isSharedProjectionDirty=Boolean($.isProjectionDirty||$.parent.isProjectionDirty||$.parent.isSharedProjectionDirty)),$.isTransformDirty||($.isTransformDirty=$.parent.isTransformDirty)}function ur($){$.isProjectionDirty=$.isSharedProjectionDirty=$.isTransformDirty=!1}function mr($){$.clearSnapshot()}function Sj($){$.clearMeasurements()}function cr($){$.isLayoutDirty=!0,$.updateLayout()}function hj($){$.isLayoutDirty=!1}function dr($){if($.isAnimationBlocked&&$.layout&&!$.isLayoutDirty)$.snapshot=$.layout,$.isLayoutDirty=!0}function pr($){let{visualElement:J}=$.options;if(J&&J.getProps().onBeforeLayoutMeasure)J.notify("BeforeLayoutMeasure");$.resetTransform()}function xj($){$.finishAnimation(),$.targetDelta=$.relativeTarget=$.target=void 0,$.isProjectionDirty=!0}function lr($){$.resolveTargetDelta()}function ir($){$.calcProjection()}function rr($){$.resetSkewAndRotation()}function sr($){$.removeLeadSnapshot()}function fj($,J,Q){$.translate=I1(J.translate,0,Q),$.scale=I1(J.scale,1,Q),$.origin=J.origin,$.originPoint=J.originPoint}function vj($,J,Q,Z){$.min=I1(J.min,Q.min,Z),$.max=I1(J.max,Q.max,Z)}function or($,J,Q,Z){vj($.x,J.x,Q.x,Z),vj($.y,J.y,Q.y,Z)}function nr($){return $.animationValues&&$.animationValues.opacityExit!==void 0}var ar={duration:0.45,ease:[0.4,0,0.1,1]},gj=($)=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes($),uj=gj("applewebkit/")&&!gj("chrome/")?Math.round:b5;function mj($){$.min=uj($.min),$.max=uj($.max)}function tr($){mj($.x),mj($.y)}function dj($,J,Q){return $==="position"||$==="preserve-aspect"&&!X_(W_(J),W_(Q),0.2)}function er($){return $!==$.root&&$.scroll?.wasRoot}var pj=AK({attachResizeListener:($,J)=>H4($,"resize",J),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0});var wK={current:void 0},kq=AK({measureScroll:($)=>({x:$.scrollLeft,y:$.scrollTop}),defaultParent:()=>{if(!wK.current){let $=new pj({});$.mount(window),$.setOptions({layoutScroll:!0}),wK.current=$}return wK.current},resetTransform:($,J)=>{$.style.transform=J!==void 0?J:"none"},checkIsScrollRoot:($)=>Boolean(window.getComputedStyle($).position==="fixed")});var ij=R(v(),1);var lj=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function QQ($){if(typeof $!=="string"||$.includes("-"))return!1;else if(lj.indexOf($)>-1||/[A-Z]/u.test($))return!0;return!1}var rj=($,J)=>{return J.isSVG??QQ($)?new NK(J):new MK(J,{allowProjection:$!==ij.Fragment})};var YQ=R(v(),1);var sj=R(v(),1),kK=sj.createContext({});var oj=R(v(),1),IK=oj.createContext({strict:!1});var nj=R(v(),1),TK=nj.createContext({transformPagePoint:($)=>$,isStatic:!1,reducedMotion:"never"});var aj=R(v(),1),g7=aj.createContext({});var bK=R(v(),1);function tj($,J){if(v7($)){let{initial:Q,animate:Z}=$;return{initial:Q===!1||W4(Q)?Q:void 0,animate:W4(Z)?Z:void 0}}return $.inherit!==!1?J:{}}function $E($){let{initial:J,animate:Q}=tj($,bK.useContext(g7));return bK.useMemo(()=>({initial:J,animate:Q}),[ej(J),ej(Q)])}function ej($){return Array.isArray($)?$.join(" "):$}var qQ=R(v(),1);var JE=R(v(),1);var ZQ=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function F_($,J,Q){for(let Z in J)if(!X5(J[Z])&&!Nq(Z,Q))$[Z]=J[Z]}function $s({transformTemplate:$},J){return JE.useMemo(()=>{let Q=ZQ();return Q$(Q,J,$),Object.assign({},Q.vars,Q.style)},[J])}function Js($,J){let Q=$.style||{},Z={};return F_(Z,Q,$),Object.assign(Z,$s($,J)),Z}function QE($,J){let Q={},Z=Js($,J);if($.drag&&$.dragListener!==!1)Q.draggable=!1,Z.userSelect=Z.WebkitUserSelect=Z.WebkitTouchCallout="none",Z.touchAction=$.drag===!0?"none":`pan-${$.drag==="x"?"y":"x"}`;if($.tabIndex===void 0&&($.onTap||$.onTapStart||$.whileTap))Q.tabIndex=0;return Q.style=Z,Q}var ZE=R(v(),1);var jK=()=>({...ZQ(),attrs:{}});function qE($,J,Q,Z){let q=ZE.useMemo(()=>{let X=jK();return Oq(X,J,Aq(Z),$.transformTemplate,$.style),{...X.attrs,style:{...X.style}}},[J]);if($.style){let X={};F_(X,$.style,$),q.style={...X,...q.style}}return q}var Qs=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function Iq($){return $.startsWith("while")||$.startsWith("drag")&&$!=="draggable"||$.startsWith("layout")||$.startsWith("onTap")||$.startsWith("onPan")||$.startsWith("onLayout")||Qs.has($)}var YE=($)=>!Iq($);function Zs($){if(typeof $!=="function")return;YE=(J)=>J.startsWith("on")?!Iq(J):$(J)}try{let $="@emotion/is-prop-valid";Zs(XE($).default)}catch{}function zE($,J,Q){let Z={};for(let q in $){if(q==="values"&&typeof $.values==="object")continue;if(X5($[q]))continue;if(YE(q)||Q===!0&&Iq(q)||!J&&!Iq(q)||$.draggable&&q.startsWith("onDrag"))Z[q]=$[q]}return Z}function KE($,J,Q,{latestValues:Z},q,X=!1,Y){let K=(Y??QQ($)?qE:QE)(J,Z,q,$),W=zE(J,typeof $==="string",X),H=$!==qQ.Fragment?{...W,...K,ref:Q}:{},{children:B}=J,U=qQ.useMemo(()=>X5(B)?B.get():B,[B]);return qQ.createElement($,{...H,children:U})}var V_=R(v(),1);var GE=R(v(),1),XQ=GE.createContext(null);var WE=R(v(),1);function HE($){let J=WE.useRef(null);if(J.current===null)J.current=$();return J.current}function qs({scrapeMotionValuesFromProps:$,createRenderState:J},Q,Z,q){return{latestValues:Xs(Q,Z,q,$),renderState:J()}}function Xs($,J,Q,Z){let q={},X=Z($,{});for(let U in X)q[U]=Y$(X[U]);let{initial:Y,animate:z}=$,K=v7($),W=Bq($);if(J&&W&&!K&&$.inherit!==!1){if(Y===void 0)Y=J.initial;if(z===void 0)z=J.animate}let H=Q?Q.initial===!1:!1;H=H||Y===!1;let B=H?z:Y;if(B&&typeof B!=="boolean"&&!s4(B)){let U=Array.isArray(B)?B:[B];for(let _=0;_(J,Q)=>{let Z=V_.useContext(g7),q=V_.useContext(XQ),X=()=>qs($,J,Z,q);return Q?X():HE(X)};var BE=EK({scrapeMotionValuesFromProps:Z$,createRenderState:ZQ});var UE=EK({scrapeMotionValuesFromProps:wq,createRenderState:jK});var _E={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},LE=!1;function Ys(){if(LE)return;let $={};for(let J in _E)$[J]={isEnabled:(Q)=>_E[J].some((Z)=>!!Q[Z])};_q($),LE=!0}function yK(){return Ys(),pU()}function FE($){let J=yK();for(let Q in $)J[Q]={...J[Q],...$[Q]};_q(J)}var VE=Symbol.for("motionComponentSymbol");var G$=R(v(),1);function ME($,J,Q){let Z=G$.useRef(Q);G$.useInsertionEffect(()=>{Z.current=Q});let q=G$.useRef(null);return G$.useCallback((X)=>{if(X)$.onMount?.(X);if(J)X?J.mount(X):J.unmount();let Y=Z.current;if(typeof Y==="function")if(X){let z=Y(X);if(typeof z==="function")q.current=z}else if(q.current)q.current(),q.current=null;else Y(X);else if(Y)Y.current=X},[J])}var Z6=R(v(),1);var DE=R(v(),1),PK=DE.createContext({});function u7($){return $&&typeof $==="object"&&Object.prototype.hasOwnProperty.call($,"current")}var RK=R(v(),1);var NE=typeof window<"u";var OE=NE?RK.useLayoutEffect:RK.useEffect;function AE($,J,Q,Z,q,X){let{visualElement:Y}=Z6.useContext(g7),z=Z6.useContext(IK),K=Z6.useContext(XQ),W=Z6.useContext(TK),H=W.reducedMotion,B=W.skipAnimations,U=Z6.useRef(null),_=Z6.useRef(!1);if(Z=Z||z.renderer,!U.current&&Z){if(U.current=Z($,{visualState:J,parent:Y,props:Q,presenceContext:K,blockInitialAnimation:K?K.initial===!1:!1,reducedMotionConfig:H,skipAnimations:B,isSVG:X}),_.current&&U.current)U.current.manuallyAnimateOnMount=!0}let L=U.current,F=Z6.useContext(PK);if(L&&!L.projection&&q&&(L.type==="html"||L.type==="svg"))zs(U.current,Q,q,F);let V=Z6.useRef(!1);Z6.useInsertionEffect(()=>{if(L&&V.current)L.update(Q,K)});let M=Q[Yq],D=Z6.useRef(Boolean(M)&&typeof window<"u"&&!window.MotionHandoffIsComplete?.(M)&&window.MotionHasOptimisedAnimation?.(M));return OE(()=>{if(_.current=!0,!L)return;if(V.current=!0,window.MotionIsMounted=!0,L.updateFeatures(),L.scheduleRenderMicrotask(),D.current&&L.animationState)L.animationState.animateChanges()}),Z6.useEffect(()=>{if(!L)return;if(!D.current&&L.animationState)L.animationState.animateChanges();if(D.current)queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(M)}),D.current=!1;L.enteringChildren=void 0}),L}function zs($,J,Q,Z){let{layoutId:q,layout:X,drag:Y,dragConstraints:z,layoutScroll:K,layoutRoot:W,layoutAnchor:H,layoutCrossfade:B}=J;$.projection=new Q($.latestValues,J["data-framer-portal-id"]?void 0:wE($.parent)),$.projection.setOptions({layoutId:q,layout:X,alwaysMeasureLayout:Boolean(Y)||z&&u7(z),visualElement:$,animationType:typeof X==="string"?X:"both",initialPromotionConfig:Z,crossfade:B,layoutScroll:K,layoutRoot:W,layoutAnchor:H})}function wE($){if(!$)return;return $.options.allowProjection!==!1?$.projection:wE($.parent)}function CK($,{forwardMotionProps:J=!1,type:Q}={},Z,q){Z&&FE(Z);let X=Q?Q==="svg":QQ($),Y=X?UE:BE;function z(W,H){let B,U={...YQ.useContext(TK),...W,layoutId:Ks(W)},{isStatic:_}=U,L=$E(W),F=Y(W,_);if(!_&&typeof window<"u"){Gs(U,Z);let V=Ws(U);B=V.MeasureLayout,L.visualElement=AE($,F,U,q,V.ProjectionNode,X)}return T(g7.Provider,{value:L,children:[B&&L.visualElement?G(B,{visualElement:L.visualElement,...U}):null,KE($,W,ME(F,L.visualElement,H),F,_,J,X)]})}z.displayName=`motion.${typeof $==="string"?$:`create(${$.displayName??$.name??""})`}`;let K=YQ.forwardRef(z);return K[VE]=$,K}function Ks({layoutId:$}){let J=YQ.useContext(kK).id;return J&&$!==void 0?J+"-"+$:$}function Gs($,J){let Q=YQ.useContext(IK).strict}function Ws($){let J=yK(),{drag:Q,layout:Z}=J;if(!Q&&!Z)return{};let q={...Q,...Z};return{MeasureLayout:Q?.isEnabled($)||Z?.isEnabled($)?q.MeasureLayout:void 0,ProjectionNode:q.ProjectionNode}}function kE($,J){if(typeof Proxy>"u")return CK;let Q=new Map,Z=(X,Y)=>{return CK(X,Y,$,J)};return new Proxy((X,Y)=>{return Z(X,Y)},{get:(X,Y)=>{if(Y==="create")return Z;if(!Q.has(Y))Q.set(Y,CK(Y,void 0,$,J));return Q.get(Y)}})}class M_ extends k8{constructor($){super($);$.animationState||($.animationState=$_($))}updateAnimationControlsSubscription(){let{animate:$}=this.node.getProps();if(s4($))this.unmountControls=$.subscribe(this.node)}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:$}=this.node.getProps(),{animate:J}=this.node.prevProps||{};if($!==J)this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}var Hs=0;class D_ extends k8{constructor(){super(...arguments);this.id=Hs++,this.isExitComplete=!1}update(){if(!this.node.presenceContext)return;let{isPresent:$,onExitComplete:J}=this.node.presenceContext,{isPresent:Q}=this.node.prevPresenceContext||{};if(!this.node.animationState||$===Q)return;if($&&Q===!1){if(this.isExitComplete){let{initial:q,custom:X}=this.node.getProps();if(typeof q==="string"||typeof q==="object"&&q!==null&&!Array.isArray(q)){let Y=R6(this.node,q,X);if(Y){let{transition:z,transitionEnd:K,...W}=Y;for(let H in W)this.node.getValue(H)?.jump(W[H])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}let Z=this.node.animationState.setActive("exit",!$);if(J&&!$)Z.then(()=>{this.isExitComplete=!0,J(this.id)})}mount(){let{register:$,onExitComplete:J}=this.node.presenceContext||{};if(J)J(this.id);if($)this.unmount=$(this.id)}unmount(){}}var IE={animation:{Feature:M_},exit:{Feature:D_}};function n4($){return{point:{x:$.pageX,y:$.pageY}}}var TE=($)=>(J)=>$$(J)&&$(J,n4(J));function m7($,J,Q,Z){return H4($,J,TE(Q),Z)}var SK=({current:$})=>{return $?$.ownerDocument.defaultView:null};var bE=($,J)=>Math.abs($-J);function jE($,J){let Q=bE($.x,J.x),Z=bE($.y,J.y);return Math.sqrt(Q**2+Z**2)}var EE=new Set(["auto","scroll"]);class Tq{constructor($,J,{transformPagePoint:Q,contextWindow:Z=window,dragSnapToOrigin:q=!1,distanceThreshold:X=3,element:Y}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=(_)=>{this.handleScroll(_.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;if(this.lastRawMoveEventInfo)this.lastMoveEventInfo=hK(this.lastRawMoveEventInfo,this.transformPagePoint);let _=N_(this.lastMoveEventInfo,this.history),L=this.startEvent!==null,F=jE(_.offset,{x:0,y:0})>=this.distanceThreshold;if(!L&&!F)return;let{point:V}=_,{timestamp:M}=C5;this.history.push({...V,timestamp:M});let{onStart:D,onMove:N}=this.handlers;if(!L)D&&D(this.lastMoveEvent,_),this.startEvent=this.lastMoveEvent;N&&N(this.lastMoveEvent,_)},this.handlePointerMove=(_,L)=>{this.lastMoveEvent=_,this.lastRawMoveEventInfo=L,this.lastMoveEventInfo=hK(L,this.transformPagePoint),w1.update(this.updatePoint,!0)},this.handlePointerUp=(_,L)=>{this.end();let{onEnd:F,onSessionEnd:V,resumeAnimation:M}=this.handlers;if(this.dragSnapToOrigin||!this.startEvent)M&&M();if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let D=N_(_.type==="pointercancel"?this.lastMoveEventInfo:hK(L,this.transformPagePoint),this.history);if(this.startEvent&&F)F(_,D);V&&V(_,D)},!$$($))return;this.dragSnapToOrigin=q,this.handlers=J,this.transformPagePoint=Q,this.distanceThreshold=X,this.contextWindow=Z||window;let z=n4($),K=hK(z,this.transformPagePoint),{point:W}=K,{timestamp:H}=C5;this.history=[{...W,timestamp:H}];let{onSessionStart:B}=J;B&&B($,N_(K,this.history));let U={passive:!0,capture:!0};if(this.removeListeners=S9(m7(this.contextWindow,"pointermove",this.handlePointerMove,U),m7(this.contextWindow,"pointerup",this.handlePointerUp,U),m7(this.contextWindow,"pointercancel",this.handlePointerUp,U)),Y)this.startScrollTracking(Y)}startScrollTracking($){let J=$.parentElement;while(J){let Q=getComputedStyle(J);if(EE.has(Q.overflowX)||EE.has(Q.overflowY))this.scrollPositions.set(J,{x:J.scrollLeft,y:J.scrollTop});J=J.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll($){let J=this.scrollPositions.get($);if(!J)return;let Q=$===window,Z=Q?{x:window.scrollX,y:window.scrollY}:{x:$.scrollLeft,y:$.scrollTop},q={x:Z.x-J.x,y:Z.y-J.y};if(q.x===0&&q.y===0)return;if(Q){if(this.lastMoveEventInfo)this.lastMoveEventInfo.point.x+=q.x,this.lastMoveEventInfo.point.y+=q.y}else if(this.history.length>0)this.history[0].x-=q.x,this.history[0].y-=q.y;this.scrollPositions.set($,Z),w1.update(this.updatePoint,!0)}updateHandlers($){this.handlers=$}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),O6(this.updatePoint)}}function hK($,J){return J?{point:J($.point)}:$}function yE($,J){return{x:$.x-J.x,y:$.y-J.y}}function N_({point:$},J){return{point:$,delta:yE($,PE(J)),offset:yE($,Bs(J)),velocity:Us(J,0.1)}}function Bs($){return $[0]}function PE($){return $[$.length-1]}function Us($,J){if($.length<2)return{x:0,y:0};let Q=$.length-1,Z=null,q=PE($);while(Q>=0){if(Z=$[Q],q.timestamp-Z.timestamp>f5(J))break;Q--}if(!Z)return{x:0,y:0};if(Z===$[0]&&$.length>2&&q.timestamp-Z.timestamp>f5(J)*2)Z=$[1];let X=w8(q.timestamp-Z.timestamp);if(X===0)return{x:0,y:0};let Y={x:(q.x-Z.x)/X,y:(q.y-Z.y)/X};if(Y.x===1/0)Y.x=0;if(Y.y===1/0)Y.y=0;return Y}function xE($,{min:J,max:Q},Z){if(J!==void 0&&$Q)$=Z?I1(Q,$,Z.max):Math.min($,Q);return $}function RE($,J,Q){return{min:J!==void 0?$.min+J:void 0,max:Q!==void 0?$.max+Q-($.max-$.min):void 0}}function fE($,{top:J,left:Q,bottom:Z,right:q}){return{x:RE($.x,Q,q),y:RE($.y,J,Z)}}function CE($,J){let Q=J.min-$.min,Z=J.max-$.max;if(J.max-J.min<$.max-$.min)[Q,Z]=[Z,Q];return{min:Q,max:Z}}function vE($,J){return{x:CE($.x,J.x),y:CE($.y,J.y)}}function gE($,J){let Q=0.5,Z=r5($),q=r5(J);if(q>Z)Q=Y4(J.min,J.max-Z,$.min);else if(Z>q)Q=Y4($.min,$.max-q,J.min);return _8(0,1,Q)}function uE($,J){let Q={};if(J.min!==void 0)Q.min=J.min-$.min;if(J.max!==void 0)Q.max=J.max-$.min;return Q}var xK=0.35;function mE($=xK){if($===!1)$=0;else if($===!0)$=xK;return{x:SE($,"left","right"),y:SE($,"top","bottom")}}function SE($,J,Q){return{min:hE($,J),max:hE($,Q)}}function hE($,J){return typeof $==="number"?$:$[J]||0}var _s=new WeakMap;class O_{constructor($){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=A5(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=$}start($,{snapToCursor:J=!1,distanceThreshold:Q}={}){let{presenceContext:Z}=this.visualElement;if(Z&&Z.isPresent===!1)return;let q=(H)=>{if(J)this.snapToCursor(n4(H).point);this.stopAnimation()},X=(H,B)=>{let{drag:U,dragPropagation:_,onDragStart:L}=this.getProps();if(U&&!_){if(this.openDragLock)this.openDragLock();if(this.openDragLock=hU(U),!this.openDragLock)return}if(this.latestPointerEvent=H,this.latestPanInfo=B,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection)this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0;if(C6((V)=>{let M=this.getAxisMotionValue(V).get()||0;if(c8.test(M)){let{projection:D}=this.visualElement;if(D&&D.layout){let N=D.layout.layoutBox[V];if(N)M=r5(N)*(parseFloat(M)/100)}}this.originPoint[V]=M}),L)w1.update(()=>L(H,B),!1,!0);oJ(this.visualElement,"transform");let{animationState:F}=this.visualElement;F&&F.setActive("whileDrag",!0)},Y=(H,B)=>{this.latestPointerEvent=H,this.latestPanInfo=B;let{dragPropagation:U,dragDirectionLock:_,onDirectionLock:L,onDrag:F}=this.getProps();if(!U&&!this.openDragLock)return;let{offset:V}=B;if(_&&this.currentDirection===null){if(this.currentDirection=Fs(V),this.currentDirection!==null)L&&L(this.currentDirection);return}if(this.updateAxis("x",B.point,V),this.updateAxis("y",B.point,V),this.visualElement.render(),F)w1.update(()=>F(H,B),!1,!0)},z=(H,B)=>{this.latestPointerEvent=H,this.latestPanInfo=B,this.stop(H,B),this.latestPointerEvent=null,this.latestPanInfo=null},K=()=>{let{dragSnapToOrigin:H}=this.getProps();if(H||this.constraints)this.startAnimation({x:0,y:0})},{dragSnapToOrigin:W}=this.getProps();this.panSession=new Tq($,{onSessionStart:q,onStart:X,onMove:Y,onSessionEnd:z,resumeAnimation:K},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:W,distanceThreshold:Q,contextWindow:SK(this.visualElement),element:this.visualElement.current})}stop($,J){let Q=$||this.latestPointerEvent,Z=J||this.latestPanInfo,q=this.isDragging;if(this.cancel(),!q||!Z||!Q)return;let{velocity:X}=Z;this.startAnimation(X);let{onDragEnd:Y}=this.getProps();if(Y)w1.postRender(()=>Y(Q,Z))}cancel(){this.isDragging=!1;let{projection:$,animationState:J}=this.visualElement;if($)$.isAnimationBlocked=!1;this.endPanSession();let{dragPropagation:Q}=this.getProps();if(!Q&&this.openDragLock)this.openDragLock(),this.openDragLock=null;J&&J.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis($,J,Q){let{drag:Z}=this.getProps();if(!Q||!fK($,Z,this.currentDirection))return;let q=this.getAxisMotionValue($),X=this.originPoint[$]+Q[$];if(this.constraints&&this.constraints[$])X=xE(X,this.constraints[$],this.elastic[$]);q.set(X)}resolveConstraints(){let{dragConstraints:$,dragElastic:J}=this.getProps(),Q=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,Z=this.constraints;if($&&u7($)){if(!this.constraints)this.constraints=this.resolveRefConstraints()}else if($&&Q)this.constraints=fE(Q.layoutBox,$);else this.constraints=!1;if(this.elastic=mE(J),Z!==this.constraints&&!u7($)&&Q&&this.constraints&&!this.hasMutatedConstraints)C6((q)=>{if(this.constraints!==!1&&this.getAxisMotionValue(q))this.constraints[q]=uE(Q.layoutBox[q],this.constraints[q])})}resolveRefConstraints(){let{dragConstraints:$,onMeasureDragConstraints:J}=this.getProps();if(!$||!u7($))return!1;let Q=$.current;N6(Q!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");let{projection:Z}=this.visualElement;if(!Z||!Z.layout)return!1;if(Z.root)Z.root.scroll=void 0,Z.root.updateScroll();let q=aU(Q,Z.root,this.visualElement.getTransformPagePoint()),X=vE(Z.layout.layoutBox,q);if(J){let Y=J(lU(X));if(this.hasMutatedConstraints=!!Y,Y)X=Fq(Y)}return X}startAnimation($){let{drag:J,dragMomentum:Q,dragElastic:Z,dragTransition:q,dragSnapToOrigin:X,onDragTransitionEnd:Y}=this.getProps(),z=this.constraints||{},K=C6((W)=>{if(!fK(W,J,this.currentDirection))return;let H=z&&z[W]||{};if(X===!0||X===W)H={min:0,max:0};let B=Z?200:1e6,U=Z?40:1e7,_={type:"inertia",velocity:Q?$[W]:0,bounceStiffness:B,bounceDamping:U,timeConstant:750,restDelta:1,restSpeed:10,...q,...H};return this.startAxisValueAnimation(W,_)});return Promise.all(K).then(Y)}startAxisValueAnimation($,J){let Q=this.getAxisMotionValue($);return oJ(this.visualElement,$),Q.start(n2($,Q,0,J,this.visualElement,!1))}stopAnimation(){C6(($)=>this.getAxisMotionValue($).stop())}getAxisMotionValue($){let J=`_drag${$.toUpperCase()}`,Z=this.visualElement.getProps()[J];return Z?Z:this.visualElement.getValue($,this.visualElement.latestValues[$]??0)}snapToCursor($){C6((J)=>{let{drag:Q}=this.getProps();if(!fK(J,Q,this.currentDirection))return;let{projection:Z}=this.visualElement,q=this.getAxisMotionValue(J);if(Z&&Z.layout){let{min:X,max:Y}=Z.layout.layoutBox[J],z=q.get()||0;q.set($[J]-I1(X,Y,0.5)+z)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:$,dragConstraints:J}=this.getProps(),{projection:Q}=this.visualElement;if(!u7(J)||!Q||!this.constraints)return;this.stopAnimation();let Z={x:0,y:0};C6((X)=>{let Y=this.getAxisMotionValue(X);if(Y&&this.constraints!==!1){let z=Y.get();Z[X]=gE({min:z,max:z},this.constraints[X])}});let{transformTemplate:q}=this.visualElement.getProps();this.visualElement.current.style.transform=q?q({},""):"none",Q.root&&Q.root.updateScroll(),Q.updateLayout(),this.constraints=!1,this.resolveConstraints(),C6((X)=>{if(!fK(X,$,null))return;let Y=this.getAxisMotionValue(X),{min:z,max:K}=this.constraints[X];Y.set(I1(z,K,Z[X]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;_s.set(this.visualElement,this);let $=this.visualElement.current,J=m7($,"pointerdown",(K)=>{let{drag:W,dragListener:H=!0}=this.getProps(),B=K.target,U=B!==$&&gU(B);if(W&&H&&!U)this.start(K)}),Q,Z=()=>{let{dragConstraints:K}=this.getProps();if(u7(K)&&K.current){if(this.constraints=this.resolveRefConstraints(),!Q)Q=Ls($,K.current,()=>this.scalePositionWithinConstraints())}},{projection:q}=this.visualElement,X=q.addEventListener("measure",Z);if(q&&!q.layout)q.root&&q.root.updateScroll(),q.updateLayout();w1.read(Z);let Y=H4(window,"resize",()=>this.scalePositionWithinConstraints()),z=q.addEventListener("didUpdate",({delta:K,hasLayoutChanged:W})=>{if(this.isDragging&&W)C6((H)=>{let B=this.getAxisMotionValue(H);if(!B)return;this.originPoint[H]+=K[H].translate,B.set(B.get()+K[H].translate)}),this.visualElement.render()});return()=>{Y(),J(),X(),z&&z(),Q&&Q()}}getProps(){let $=this.visualElement.getProps(),{drag:J=!1,dragDirectionLock:Q=!1,dragPropagation:Z=!1,dragConstraints:q=!1,dragElastic:X=xK,dragMomentum:Y=!0}=$;return{...$,drag:J,dragDirectionLock:Q,dragPropagation:Z,dragConstraints:q,dragElastic:X,dragMomentum:Y}}}function cE($){let J=!0;return()=>{if(J){J=!1;return}$()}}function Ls($,J,Q){let Z=WK($,cE(Q)),q=WK(J,cE(Q));return()=>{Z(),q()}}function fK($,J,Q){return(J===!0||J===$)&&(Q===null||Q===$)}function Fs($,J=10){let Q=null;if(Math.abs($.y)>J)Q="y";else if(Math.abs($.x)>J)Q="x";return Q}class A_ extends k8{constructor($){super($);this.removeGroupControls=b5,this.removeListeners=b5,this.controls=new O_($)}mount(){let{dragControls:$}=this.node.getProps();if($)this.removeGroupControls=$.subscribe(this.controls);this.removeListeners=this.controls.addListeners()||b5}update(){let{dragControls:$}=this.node.getProps(),{dragControls:J}=this.node.prevProps||{};if($!==J){if(this.removeGroupControls(),$)this.removeGroupControls=$.subscribe(this.controls)}}unmount(){if(this.removeGroupControls(),this.removeListeners(),!this.controls.isDragging)this.controls.endPanSession()}}var w_=($)=>(J,Q)=>{if($)w1.update(()=>$(J,Q),!1,!0)};class k_ extends k8{constructor(){super(...arguments);this.removePointerDownListener=b5}onPointerDown($){this.session=new Tq($,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:SK(this.node)})}createPanHandlers(){let{onPanSessionStart:$,onPanStart:J,onPan:Q,onPanEnd:Z}=this.node.getProps();return{onSessionStart:w_($),onStart:w_(J),onMove:w_(Q),onEnd:(q,X)=>{if(delete this.session,Z)w1.postRender(()=>Z(q,X))}}}mount(){this.removePointerDownListener=m7(this.node.current,"pointerdown",($)=>this.onPointerDown($))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}var bq=R(v(),1);var c7=R(v(),1);function dE($=!0){let J=c7.useContext(XQ);if(J===null)return[!0,null];let{isPresent:Q,onExitComplete:Z,register:q}=J,X=c7.useId();c7.useEffect(()=>{if($)return q(X)},[$]);let Y=c7.useCallback(()=>$&&Z&&Z(X),[X,Z,$]);return!Q&&Z?[!1,Y]:[!0]}var I_=!1;class pE extends bq.Component{componentDidMount(){let{visualElement:$,layoutGroup:J,switchLayoutGroup:Q,layoutId:Z}=this.props,{projection:q}=$;if(q){if(J.group)J.group.add(q);if(Q&&Q.register&&Z)Q.register(q);if(I_)q.root.didUpdate();q.addEventListener("animationComplete",()=>{this.safeToRemove()}),q.setOptions({...q.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})}z$.hasEverUpdated=!0}getSnapshotBeforeUpdate($){let{layoutDependency:J,visualElement:Q,drag:Z,isPresent:q}=this.props,{projection:X}=Q;if(!X)return null;if(X.isPresent=q,$.layoutDependency!==J)X.setOptions({...X.options,layoutDependency:J});if(I_=!0,Z||$.layoutDependency!==J||J===void 0||$.isPresent!==q)X.willUpdate();else this.safeToRemove();if($.isPresent!==q){if(q)X.promote();else if(!X.relegate())w1.postRender(()=>{let Y=X.getStack();if(!Y||!Y.members.length)this.safeToRemove()})}return null}componentDidUpdate(){let{visualElement:$,layoutAnchor:J}=this.props,{projection:Q}=$;if(Q)Q.options.layoutAnchor=J,Q.root.didUpdate(),e2.postRender(()=>{if(!Q.currentAnimation&&Q.isLead())this.safeToRemove()})}componentWillUnmount(){let{visualElement:$,layoutGroup:J,switchLayoutGroup:Q}=this.props,{projection:Z}=$;if(I_=!0,Z){if(Z.scheduleCheckAfterUnmount(),J&&J.group)J.group.remove(Z);if(Q&&Q.deregister)Q.deregister(Z)}}safeToRemove(){let{safeToRemove:$}=this.props;$&&$()}render(){return null}}function vK($){let[J,Q]=dE(),Z=bq.useContext(kK);return G(pE,{...$,layoutGroup:Z,switchLayoutGroup:bq.useContext(PK),isPresent:J,safeToRemove:Q})}var lE={pan:{Feature:k_},drag:{Feature:A_,ProjectionNode:kq,MeasureLayout:vK}};function iE($,J,Q){let{props:Z}=$;if($.animationState&&Z.whileHover)$.animationState.setActive("whileHover",Q==="Start");let q="onHover"+Q,X=Z[q];if(X)w1.postRender(()=>X(J,n4(J)))}class T_ extends k8{mount(){let{current:$}=this.node;if(!$)return;this.unmount=xU($,(J,Q)=>{return iE(this.node,Q,"Start"),(Z)=>iE(this.node,Z,"End")})}unmount(){}}class b_ extends k8{constructor(){super(...arguments);this.isActive=!1}onFocus(){let $=!1;try{$=this.node.current.matches(":focus-visible")}catch(J){$=!0}if(!$||!this.node.animationState)return;this.node.animationState.setActive("whileFocus",!0),this.isActive=!0}onBlur(){if(!this.isActive||!this.node.animationState)return;this.node.animationState.setActive("whileFocus",!1),this.isActive=!1}mount(){this.unmount=S9(H4(this.node.current,"focus",()=>this.onFocus()),H4(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function rE($,J,Q){let{props:Z}=$;if($.current instanceof HTMLButtonElement&&$.current.disabled)return;if($.animationState&&Z.whileTap)$.animationState.setActive("whileTap",Q==="Start");let q="onTap"+(Q==="End"?"":Q),X=Z[q];if(X)w1.postRender(()=>X(J,n4(J)))}class j_ extends k8{mount(){let{current:$}=this.node;if(!$)return;let{globalTapTarget:J,propagate:Q}=this.node.props;this.unmount=mU($,(Z,q)=>{return rE(this.node,q,"Start"),(X,{success:Y})=>rE(this.node,X,Y?"End":"Cancel")},{useGlobalTarget:J,stopPropagation:Q?.tap===!1})}unmount(){}}var y_=new WeakMap,E_=new WeakMap,Vs=($)=>{let J=y_.get($.target);J&&J($)},Ms=($)=>{$.forEach(Vs)};function Ds({root:$,...J}){let Q=$||document;if(!E_.has(Q))E_.set(Q,{});let Z=E_.get(Q),q=JSON.stringify(J);if(!Z[q])Z[q]=new IntersectionObserver(Ms,{root:$,...J});return Z[q]}function sE($,J,Q){let Z=Ds(J);return y_.set($,Q),Z.observe($),()=>{y_.delete($),Z.unobserve($)}}var Ns={some:0,all:1};class P_ extends k8{constructor(){super(...arguments);this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();let{viewport:$={}}=this.node.getProps(),{root:J,margin:Q,amount:Z="some",once:q}=$,X={root:J?J.current:void 0,rootMargin:Q,threshold:typeof Z==="number"?Z:Ns[Z]},Y=(z)=>{let{isIntersecting:K}=z;if(this.isInView===K)return;if(this.isInView=K,q&&!K&&this.hasEnteredView)return;else if(K)this.hasEnteredView=!0;if(this.node.animationState)this.node.animationState.setActive("whileInView",K);let{onViewportEnter:W,onViewportLeave:H}=this.node.getProps(),B=K?W:H;B&&B(z)};this.stopObserver=sE(this.node.current,X,Y)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;let{props:$,prevProps:J}=this.node;if(["amount","margin","root"].some(Os($,J)))this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}}function Os({viewport:$={}},{viewport:J={}}={}){return(Q)=>$[Q]!==J[Q]}var oE={inView:{Feature:P_},tap:{Feature:j_},focus:{Feature:b_},hover:{Feature:T_}};var nE={layout:{ProjectionNode:kq,MeasureLayout:vK}};var aE={...IE,...oE,...lE,...nE};var jq=kE(aE,rj);var J2={};a4(J2,{createHandle:()=>OR,Viewport:()=>NR,Trigger:()=>SP,Title:()=>zR,Root:()=>TP,Positioner:()=>nP,Portal:()=>fP,Popup:()=>JR,Handle:()=>dG,Description:()=>GR,Close:()=>HR,Backdrop:()=>XR,Arrow:()=>ZR});var Q7=R(v(),1);function d1(){}var W$=Object.freeze([]),k1=Object.freeze({});var p8=R(v(),1);function U1($,J,Q,Z){return $.addEventListener(J,Q,Z),()=>{$.removeEventListener(J,Q,Z)}}function I8(...$){return()=>{for(let J=0;J<$.length;J+=1){let Q=$[J];if(Q)Q()}}}var eE=R(v(),1),tE={};function W5($,J){let Q=eE.useRef(tE);if(Q.current===tE)Q.current=$(J);return Q}function _9($,J,Q,Z){let q=W5(Jy).current;if(As(q,$,J,Q,Z))Qy(q,[$,J,Q,Z]);return q.callback}function $y($){let J=W5(Jy).current;if(ws(J,$))Qy(J,$);return J.callback}function Jy(){return{callback:null,cleanup:null,refs:[]}}function As($,J,Q,Z,q){return $.refs[0]!==J||$.refs[1]!==Q||$.refs[2]!==Z||$.refs[3]!==q}function ws($,J){return $.refs.length!==J.length||$.refs.some((Q,Z)=>Q!==J[Z])}function Qy($,J){if($.refs=J,J.every((Q)=>Q==null)){$.callback=null;return}$.callback=(Q)=>{if($.cleanup)$.cleanup(),$.cleanup=null;if(Q!=null){let Z=Array(J.length).fill(null);for(let q=0;q{for(let q=0;q{},P0=typeof document<"u"?Zy.useLayoutEffect:ks;function L5($){let J=W5(Is,$).current;return J.next=$,P0(J.effect),J}function Is($){let J={current:$,next:$,effect:()=>{J.current=J.next}};return J}var Ts=R(v(),1),Eq={...Ts};var R_=Eq.useInsertionEffect,bs=R_&&R_!==Eq.useLayoutEffect?R_:($)=>$();function v0($){let J=W5(js).current;return J.next=$,bs(J.effect),J.trampoline}function js(){let $={next:void 0,callback:Es,trampoline:(...J)=>$.callback?.(...J),effect:()=>{$.callback=$.next}};return $}function Es(){}var qy=R(v(),1),ys=[];function d7($){qy.useEffect($,ys)}var yq=0;class T8{static create(){return new T8}currentId=yq;start($,J){this.clear(),this.currentId=setTimeout(()=>{this.currentId=yq,J()},$)}isStarted(){return this.currentId!==yq}clear=()=>{if(this.currentId!==yq)clearTimeout(this.currentId),this.currentId=yq};disposeEffect=()=>{return this.clear}}function U5(){let $=W5(T8.create).current;return d7($.disposeEffect),$}var p1={};a4(p1,{screenReader:()=>v_,os:()=>h_,env:()=>g_,engine:()=>f_});var h_={};a4(h_,{windows:()=>Ss,mac:()=>Ky,linux:()=>hs,ios:()=>C_,apple:()=>S_,android:()=>zy});function Ps(){if(typeof navigator>"u")return{userAgent:"",platform:"",maxTouchPoints:0};return{userAgent:navigator.userAgent,platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}var{userAgent:Rs,platform:Cs,maxTouchPoints:Xy}=Ps(),H$=Rs.toLowerCase(),B$=Cs.toLowerCase();var C_=/^i(os$|p)/.test(B$)||B$==="macintel"&&Xy>1,Yy="android",zy=B$===Yy||H$.includes(Yy),Ky=!C_&&B$.startsWith("mac"),Ss=B$.startsWith("win"),hs=!zy&&/^(linux|chrome os)/.test(B$),S_=Ky||C_;var f_={};a4(f_,{webkit:()=>x_,gecko:()=>xs,blink:()=>fs});var x_=typeof CSS<"u"&&!!CSS.supports?.("-webkit-backdrop-filter:none"),xs=!x_&&H$.includes("firefox"),fs=!x_&&H$.includes("chrom");var v_={};a4(v_,{voiceOver:()=>vs});var vs=S_;var g_={};a4(g_,{jsdom:()=>gs});var gs=/jsdom|happydom/.test(H$);var gK=null,yA0=globalThis.requestAnimationFrame;class Gy{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=($)=>{this.isScheduled=!1;let J=this.callbacks,Q=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,Q>0)for(let Z=0;Z=this.callbacks.length)return;this.callbacks[J]=null,this.callbacksCount-=1}}var uK=new Gy;class L9{static create(){return new L9}static request($){return uK.request($)}static cancel($){return uK.cancel($)}currentId=gK;request($){this.cancel(),this.currentId=uK.request(()=>{this.currentId=gK,$()})}cancel=()=>{if(this.currentId!==gK)uK.cancel(this.currentId),this.currentId=gK};disposeEffect=()=>{return this.cancel}}function S6(){let $=W5(L9.create).current;return d7($.disposeEffect),$}function Y1($){return $?.ownerDocument||document}var cK=R(v(),1);var Wy={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},mK={...Wy,position:"fixed",top:0,left:0},Hy={...Wy,position:"absolute"};var F9=cK.forwardRef(function(J,Q){let[Z,q]=cK.useState();return P0(()=>{if(p1.screenReader.voiceOver&&p1.engine.webkit)q("button")},[]),G("span",{...J,ref:Q,style:mK,"aria-hidden":Z?void 0:!0,...{tabIndex:0,role:Z},"data-base-ui-focus-guard":""})});var Pq="data-base-ui-focusable";var u_="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",Rq="ArrowLeft",Cq="ArrowRight",m_="ArrowUp",dK="ArrowDown";function v5($){let J=$.activeElement;while(J?.shadowRoot?.activeElement!=null)J=J.shadowRoot.activeElement;return J}function e0($,J){if(!$||!J)return!1;let Q=J.getRootNode?.();if($.contains(J))return!0;if(Q&&i9(Q)){let Z=J;while(Z){if($===Z)return!0;Z=Z.parentNode||Z.host}}return!1}function w5($){if("composedPath"in $)return $.composedPath()[0];return $.target}function p7($,J){if(!F1($))return!1;let Q=$;if(J.hasElement(Q))return!Q.hasAttribute("data-trigger-disabled");for(let[,Z]of J.entries())if(e0(Z,Q))return!Z.hasAttribute("data-trigger-disabled");return!1}function pK($,J){if(J==null)return!1;if("composedPath"in $)return $.composedPath().includes(J);let Q=$;return Q.target!=null&&J.contains(Q.target)}function By($){return $.matches("html,body")}function U$($){return y1($)&&$.matches(u_)}function c_($){return $?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${u_}`)!=null}function Sq($){if(!$)return!1;return $.getAttribute("role")==="combobox"&&U$($)}function Uy($){if(!$||p1.env.jsdom)return!0;try{return $.matches(":focus-visible")}catch(J){return!0}}function hq($){if(!$)return null;return $.hasAttribute(Pq)?$:$.querySelector(`[${Pq}]`)||$}function q6($){$.preventDefault(),$.stopPropagation()}function _y($){return"nativeEvent"in $}function lK($){if($.pointerType===""&&$.isTrusted)return!0;if(p1.os.android&&$.pointerType)return $.type==="click"&&$.buttons===1;return $.detail===0&&!$.pointerType}function iK($){if(p1.env.jsdom)return!1;return!p1.os.android&&$.width===0&&$.height===0||p1.os.android&&$.width===1&&$.height===1&&$.pressure===0&&$.detail===0&&$.pointerType==="mouse"||$.width<1&&$.height<1&&$.pressure===0&&$.detail===0&&$.pointerType==="touch"}function l7($,J){let Q=["mouse","pen"];if(!J)Q.push("",void 0);return Q.includes($)}function Ly($){let J=$.type;return J==="click"||J==="mousedown"||J==="keydown"||J==="keyup"}function d_($,J){return J<0||J>=$.length}function rK($,J){return _$($.current,{disabledIndices:J})}function p_($,J){return _$($.current,{decrement:!0,startingIndex:$.current.length,disabledIndices:J})}function _$($,{startingIndex:J=-1,decrement:Q=!1,disabledIndices:Z,amount:q=1}={}){let X=J;do X+=Q?-q:q;while(X>=0&&X<=$.length-1&&l_($,X,Z));return X}function l_($,J,Q){if(typeof Q==="function"?Q(J):Q?.includes(J)??!1)return!0;let q=$[J];if(!q)return!1;if(!L$(q))return!0;return!Q&&(q.hasAttribute("disabled")||q.getAttribute("aria-disabled")==="true")}function us($){return $.visibility==="hidden"||$.visibility==="collapse"}function L$($,J=$?d5($):null){if(!$||!$.isConnected||!J||us(J))return!1;if(typeof $.checkVisibility==="function")return $.checkVisibility();return J.display!=="none"&&J.display!=="contents"}var ms='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function cs($){let J=$.assignedSlot;if(J)return J;if($.parentElement)return $.parentElement;let Q=$.getRootNode();return i9(Q)?Q.host:null}function r_($){for(let J of Array.from($.children))if(x5(J)==="summary")return J;return null}function ds($,J){let Q=r_(J);return!!Q&&($===Q||e0(Q,$))}function Fy($){let J=$?x5($):"";return $!=null&&$.matches(ms)&&(J!=="summary"||$.parentElement!=null&&x5($.parentElement)==="details"&&r_($.parentElement)===$)&&(J!=="details"||r_($)==null)&&(J!=="input"||$.type!=="hidden")}function Vy($){if(!Fy($)||!$.isConnected||$.matches(":disabled"))return!1;for(let J=$;J;J=cs(J)){let Q=J!==$,Z=x5(J)==="slot";if(J.hasAttribute("inert"))return!1;if(Q&&x5(J)==="details"&&!J.open&&!ds($,J)||J.hasAttribute("hidden")||!Z&&!ps(J,Q))return!1}return!0}function ps($,J){let Q=d5($);if(!J)return L$($,Q);return Q.display!=="none"}function My($){let J=$.tabIndex;if(J<0){let Q=x5($);if(Q==="details"||Q==="audio"||Q==="video"||y1($)&&$.isContentEditable)return 0}return J}function i_($){if(x5($)!=="input")return null;let J=$;return J.type==="radio"&&J.name!==""?J:null}function ls($,J){let Q=i_($);if(!Q)return!0;let Z=J.find((q)=>{let X=i_(q);return X?.name===Q.name&&X.form===Q.form&&X.checked});if(Z)return Z===Q;return J.find((q)=>{let X=i_(q);return X?.name===Q.name&&X.form===Q.form})===Q}function Dy($){if(y1($)&&x5($)==="slot"){let J=$.assignedElements({flatten:!0});if(J.length>0)return J}if(y1($)&&$.shadowRoot)return Array.from($.shadowRoot.children);return Array.from($.children)}function Ny($,J){Dy($).forEach((Q)=>{if(Fy(Q))J.push(Q);Ny(Q,J)})}function Oy($,J,Q){Dy($).forEach((Z)=>{if(y1(Z)&&Z.matches(J))Q.push(Z);Oy(Z,J,Q)})}function sK($){return Vy($)&&My($)>=0}function s_($){let J=[];return Ny($,J),J.filter(Vy)}function zQ($){let J=s_($);return J.filter((Q)=>My(Q)>=0&&ls(Q,J))}function Ay($,J){let Q=zQ($),Z=Q.length;if(Z===0)return;let q=v5(Y1($)),X=Q.indexOf(q),Y=X===-1?J===1?0:Z-1:X+J;return Q[Y]}function KQ($){return Ay(Y1($).body,1)||$}function oK($){return Ay(Y1($).body,-1)||$}function wy($,J){if(!$)return null;let Q=zQ(Y1($).body),Z=Q.length;if(Z===0)return null;let q=Q.indexOf($);if(q===-1)return null;let X=(q+J+Z)%Z;return Q[X]}function ky($){return wy($,1)}function Iy($){return wy($,-1)}function t4($,J){let Q=J||$.currentTarget,Z=$.relatedTarget;return!Z||!e0(Q,Z)}function Ty($){zQ($).forEach((Q)=>{Q.dataset.tabindex=Q.getAttribute("tabindex")||"",Q.setAttribute("tabindex","-1")})}function o_($){let J=[];Oy($,"[data-tabindex]",J),J.forEach((Q)=>{let Z=Q.dataset.tabindex;if(delete Q.dataset.tabindex,Z)Q.setAttribute("tabindex",Z);else Q.removeAttribute("tabindex")})}function V9($,J,Q=!0){return $.filter((q)=>q.parentId===J).flatMap((q)=>[...!Q||q.context?.open?[q]:[],...V9($,q.id,Q)])}function n_($,J){let Q=[],Z=$.find((q)=>q.id===J)?.parentId;while(Z){let q=$.find((X)=>X.id===Z);if(Z=q?.parentId,q)Q=Q.concat(q)}return Q}var T0={};a4(T0,{windowResize:()=>To,wheel:()=>Vo,triggerPress:()=>rs,triggerHover:()=>ss,triggerFocus:()=>os,trackPress:()=>Qo,swipe:()=>Io,siblingOpen:()=>No,scrub:()=>Mo,pointer:()=>Lo,outsidePress:()=>ns,none:()=>is,missing:()=>Ao,listNavigation:()=>Uo,linkPress:()=>es,keyboard:()=>_o,itemPress:()=>as,inputPress:()=>Go,inputPaste:()=>Ko,inputClear:()=>Yo,inputChange:()=>Xo,inputBlur:()=>zo,initial:()=>wo,incrementPress:()=>Zo,imperativeAction:()=>ko,focusOut:()=>Wo,escapeKey:()=>Ho,drag:()=>Fo,disabled:()=>Oo,decrementPress:()=>qo,closeWatcher:()=>Bo,closePress:()=>ts,clearPress:()=>$o,chipRemovePress:()=>Jo,cancelOpen:()=>Do});var is="none",rs="trigger-press",ss="trigger-hover",os="trigger-focus",ns="outside-press",as="item-press",ts="close-press",es="link-press",$o="clear-press",Jo="chip-remove-press",Qo="track-press",Zo="increment-press",qo="decrement-press",Xo="input-change",Yo="input-clear",zo="input-blur",Ko="input-paste",Go="input-press",Wo="focus-out",Ho="escape-key",Bo="close-watcher",Uo="list-navigation",_o="keyboard",Lo="pointer",Fo="drag",Vo="wheel",Mo="scrub",Do="cancel-open",No="sibling-open",Oo="disabled",Ao="missing",wo="initial",ko="imperative-action",Io="swipe",To="window-resize";function l0($,J,Q,Z){let q=!1,X=!1,Y=Z??k1;return{reason:$,event:J??new Event("base-ui"),cancel(){q=!0},allowPropagation(){X=!0},get isCanceled(){return q},get isPropagationAllowed(){return X},trigger:Q,...Y}}function x9($,J,Q){let Z=Q??k1;return{reason:$,event:J??new Event("base-ui"),...Z}}function e4($){return`data-base-ui-${$}`}var nK=0;function GQ($,J={}){let{preventScroll:Q=!1,sync:Z=!1,shouldFocus:q}=J;cancelAnimationFrame(nK);function X(){if(q&&!q())return;$?.focus({preventScroll:Q})}if(Z)return X(),d1;let Y=requestAnimationFrame(X);return nK=Y,()=>{if(nK===Y)cancelAnimationFrame(Y),nK=0}}var a_={inert:new WeakMap,"aria-hidden":new WeakMap},by="data-base-ui-inert",e_={inert:new WeakSet,"aria-hidden":new WeakSet},xq=new WeakMap,t_=0;function bo($){return e_[$]}function Py($){if(!$)return null;return i9($)?$.host:Py($.parentNode)}var jy=($,J)=>J.map((Q)=>{if($.contains(Q))return Q;let Z=Py(Q);if($.contains(Z))return Z;return null}).filter((Q)=>Q!=null),Ey=($)=>{let J=new Set;return $.forEach((Q)=>{let Z=Q;while(Z&&!J.has(Z))J.add(Z),Z=Z.parentNode}),J},yy=($,J,Q)=>{let Z=[],q=(X)=>{if(!X||Q.has(X))return;Array.from(X.children).forEach((Y)=>{if(x5(Y)==="script")return;if(J.has(Y))q(Y);else Z.push(Y)})};return q($),Z};function jo($,J,Q,Z,{mark:q=!0}){let X=null;if(Z)X="inert";else if(Q)X="aria-hidden";let Y=null,z=null,K=jy(J,$),W=q?yy(J,Ey(K),new Set(K)):[],H=[],B=[];if(X){let U=a_[X],_=bo(X);z=_,Y=U;let L=jy(J,Array.from(J.querySelectorAll("[aria-live]"))),F=K.concat(L);yy(J,Ey(F),new Set(F)).forEach((M)=>{let D=M.getAttribute(X),N=D!==null&&D!=="false",O=(U.get(M)||0)+1;if(U.set(M,O),H.push(M),O===1&&N)_.add(M);if(!N)M.setAttribute(X,X==="inert"?"":"true")})}if(q)W.forEach((U)=>{let _=(xq.get(U)||0)+1;if(xq.set(U,_),B.push(U),_===1)U.setAttribute(by,"")});return t_+=1,()=>{if(Y)H.forEach((U)=>{let L=(Y.get(U)||0)-1;if(Y.set(U,L),!L){if(!z?.has(U)&&X)U.removeAttribute(X);z?.delete(U)}});if(q)B.forEach((U)=>{let _=(xq.get(U)||0)-1;if(xq.set(U,_),!_)U.removeAttribute(by)});if(t_-=1,!t_)a_.inert=new WeakMap,a_["aria-hidden"]=new WeakMap,e_.inert=new WeakSet,e_["aria-hidden"]=new WeakSet,xq=new WeakMap}}function $L($,J={}){let{ariaHidden:Q=!1,inert:Z=!1,mark:q=!0}=J,X=Y1($[0]).body;return jo($,X,Q,Z,{mark:q})}var y5=R(v(),1),YL=R(J5(),1);var aK=R(v(),1);var Ry=0;function Eo($,J="mui"){let[Q,Z]=aK.useState($),q=$||Q;return aK.useEffect(()=>{if(Q==null)Ry+=1,Z(`${J}-${Ry}`)},[Q,J]),q}var Cy=Eq.useId;function h6($,J){if(Cy!==void 0){let Q=Cy();return $??(J?`${J}-${Q}`:Q)}return Eo($,J)}function yo($,J){return function(Z,...q){let X=new URL($);return X.searchParams.set("code",Z.toString()),q.forEach((Y)=>X.searchParams.append("args[]",Y)),`${J} error #${Z}; visit ${X} for the full message.`}}var Po=yo("https://base-ui.com/production-error","Base UI"),V1=Po;var i7=R(v(),1);var hy=R(v(),1);var Sy=R(v(),1),Ro=parseInt(Sy.version,10);function WQ($){return Ro>=$}function JL($){if(!hy.isValidElement($))return null;let J=$,Q=J.props;return(WQ(19)?Q?.ref:J.ref)??null}function fq($,J){if($&&!J)return $;if(!$&&J)return J;if($||J)return{...$,...J};return}function xy($,J){let Q={};for(let Z in $){let q=$[Z];if(J?.hasOwnProperty(Z)){let X=J[Z](q);if(X!=null)Object.assign(Q,X);continue}if(q===!0)Q[`data-${Z.toLowerCase()}`]="";else if(q)Q[`data-${Z.toLowerCase()}`]=q.toString()}return Q}function fy($,J){return typeof $==="function"?$(J):$}function vy($,J){return typeof $==="function"?$(J):$}var QL={};function h8($,J,Q,Z,q){if(!Q&&!Z&&!q&&!$)return tK(J);let X=tK($);if(J)X=vq(X,J);if(Q)X=vq(X,Q);if(Z)X=vq(X,Z);if(q)X=vq(X,q);return X}function gy($){if($.length===0)return QL;if($.length===1)return tK($[0]);let J=tK($[0]);for(let Q=1;Q<$.length;Q+=1)J=vq(J,$[Q]);return J}function tK($){if(ZL($))return{...my($,QL)};return Co($)}function vq($,J){if(ZL(J))return my(J,$);return So($,J)}function Co($){let J={...$};for(let Q in J){let Z=J[Q];if(uy(Q,Z))J[Q]=cy(Z)}return J}function So($,J){if(!J)return $;for(let Q in J){let Z=J[Q];switch(Q){case"style":{$[Q]=fq($.style,Z);break}case"className":{$[Q]=qL($.className,Z);break}default:if(uy(Q,Z))$[Q]=ho($[Q],Z);else $[Q]=Z}}return $}function uy($,J){let Q=$.charCodeAt(0),Z=$.charCodeAt(1),q=$.charCodeAt(2);return Q===111&&Z===110&&q>=65&&q<=90&&(typeof J==="function"||typeof J>"u")}function ZL($){return typeof $==="function"}function my($,J){if(ZL($))return $(J);return $??QL}function ho($,J){if(!J)return $;if(!$)return cy(J);return(...Q)=>{let Z=Q[0];if(dy(Z)){let X=Z;gq(X);let Y=J(...Q);if(!X.baseUIHandlerPrevented)$?.(...Q);return Y}let q=J(...Q);return $?.(...Q),q}}function cy($){if(!$)return $;return(...J)=>{let Q=J[0];if(dy(Q))gq(Q);return $(...J)}}function gq($){return $.preventBaseUIHandler=()=>{$.baseUIHandlerPrevented=!0},$}function qL($,J){if(J){if($)return J+" "+$;return J}return $}function dy($){return $!=null&&typeof $==="object"&&"nativeEvent"in $}var XL=R(v(),1);function o0($,J,Q={}){let Z=J.render,q=xo(J,Q);if(Q.enabled===!1)return null;let X=Q.state??k1;return go($,Z,q,X)}function xo($,J={}){let{className:Q,style:Z,render:q}=$,{state:X=k1,ref:Y,props:z,stateAttributesMapping:K,enabled:W=!0}=J,H=W?fy(Q,X):void 0,B=W?vy(Z,X):void 0,U=W?xy(X,K):k1,_=W&&z?fo(z):void 0,L=W?fq(U,_)??{}:k1;if(typeof document<"u")if(!W)_9(null,null);else if(Array.isArray(Y))L.ref=$y([L.ref,JL(q),...Y]);else L.ref=_9(L.ref,JL(q),Y);if(!W)return k1;if(H!==void 0)L.className=qL(L.className,H);if(B!==void 0)L.style=fq(L.style,B);return L}function fo($){if(Array.isArray($))return gy($);return h8(void 0,$)}var vo=Symbol.for("react.lazy");function go($,J,Q,Z){if(J){if(typeof J==="function")return J(Q,Z);let q=h8(Q,J.props);q.ref=Q.ref;let X=J;if(X?.$$typeof===vo)X=i7.Children.toArray(J)[0];return i7.cloneElement(X,q)}if($){if(typeof $==="string")return uo($,Q)}throw Error(V1(8))}function uo($,J){if($==="button")return XL.createElement("button",{type:"button",...J,key:J.key});if($==="img")return XL.createElement("img",{alt:"",...J,key:J.key});return i7.createElement($,J)}var py=500,eK=500,ly={style:{transition:"none"}},$G="data-base-ui-click-trigger";var iy={fallbackAxisSide:"none"},JG={fallbackAxisSide:"end"},ry={clipPath:"inset(50%)",position:"fixed",top:0,left:0};var sy=y5.createContext(null),zL=()=>y5.useContext(sy),mo=e4("portal");function oy($={}){let{ref:J,container:Q,componentProps:Z=k1,elementProps:q}=$,X=h6(),z=zL()?.portalNode,[K,W]=y5.useState(null),[H,B]=y5.useState(null),U=v0((V)=>{if(V!==null)B(V)}),_=y5.useRef(null);P0(()=>{if(Q===null){if(_.current)_.current=null,B(null),W(null);return}if(X==null)return;let V=(Q&&(DX(Q)?Q:Q.current))??z??document.body;if(V==null){if(_.current)_.current=null,B(null),W(null);return}if(_.current!==V)_.current=V,B(null),W(V)},[Q,z,X]);let L=o0("div",Z,{ref:[J,U],props:[{id:X,[mo]:""},q]});return{portalNode:H,portalSubtree:K&&L?YL.createPortal(L,K):null}}var uq=y5.forwardRef(function(J,Q){let{render:Z,className:q,style:X,children:Y,container:z,renderGuards:K,...W}=J,{portalNode:H,portalSubtree:B}=oy({container:z,ref:Q,componentProps:J,elementProps:W}),U=y5.useRef(null),_=y5.useRef(null),L=y5.useRef(null),F=y5.useRef(null),[V,M]=y5.useState(null),D=y5.useRef(!1),N=V?.modal,O=V?.open,k=typeof K==="boolean"?K:!!V&&!V.modal&&V.open&&!!H;y5.useEffect(()=>{if(!H||N)return;function b(A){if(H&&A.relatedTarget&&t4(A))if(A.type==="focusin"){if(D.current)o_(H),D.current=!1}else Ty(H),D.current=!0}return I8(U1(H,"focusin",b,!0),U1(H,"focusout",b,!0))},[H,N]),P0(()=>{if(!H||O!==!0||!D.current)return;o_(H),D.current=!1},[O,H]);let I=y5.useMemo(()=>({beforeOutsideRef:U,afterOutsideRef:_,beforeInsideRef:L,afterInsideRef:F,portalNode:H,setFocusManagerState:M}),[H]);return T(y5.Fragment,{children:[B,T(sy.Provider,{value:I,children:[k&&H&&G(F9,{"data-type":"outside",ref:U,onFocus:(b)=>{if(t4(b,H))L.current?.focus();else{let A=V?V.domReference:null;oK(A)?.focus()}}}),k&&H&&G("span",{"aria-owns":H.id,style:ry}),H&&YL.createPortal(Y,H),k&&H&&G(F9,{"data-type":"outside",ref:_,onFocus:(b)=>{if(t4(b,H))F.current?.focus();else{let A=V?V.domReference:null;if(KQ(A)?.focus(),V?.closeOnFocusOut)V?.onOpenChange(!1,l0(T0.focusOut,b.nativeEvent))}}})]})]})});var r7=R(v(),1);function QG(){let $=new Map;return{emit(J,Q){$.get(J)?.forEach((Z)=>Z(Q))},on(J,Q){if(!$.has(J))$.set(J,new Set);$.get(J).add(Q)},off(J,Q){$.get(J)?.delete(Q)}}}class F${nodesRef={current:[]};events=QG();addNode($){this.nodesRef.current.push($)}removeNode($){let J=this.nodesRef.current.findIndex((Q)=>Q===$);if(J!==-1)this.nodesRef.current.splice(J,1)}}var ny=r7.createContext(null),ay=r7.createContext(null),x8=()=>r7.useContext(ny)?.id||null,d8=($)=>{let J=r7.useContext(ay);return $??J};function V$($){let J=h6(),Q=d8($),Z=x8();return P0(()=>{if(!J)return;let q={id:J,parentId:Z};return Q?.addNode(q),()=>{Q?.removeNode(q)}},[Q,J,Z]),J}function mq($){let{children:J,id:Q}=$,Z=x8();return G(ny.Provider,{value:r7.useMemo(()=>({id:Q,parentId:Z}),[Q,Z]),children:J})}function cq($){let{children:J,externalTree:Q}=$,Z=W5(()=>Q??new F$).current;return G(ay.Provider,{value:Z,children:J})}function f9($){if($==null)return $;return"current"in $?$.current:$}function co($,J){let Q=h1(w5($));if($ instanceof Q.KeyboardEvent)return"keyboard";if($ instanceof Q.FocusEvent)return J||"keyboard";if("pointerType"in $)return $.pointerType||"keyboard";if("touches"in $)return"touch";if($ instanceof Q.MouseEvent)return J||($.detail===0?"keyboard":"mouse");return""}var ty=20,s7=[];function KL(){s7=s7.filter(($)=>{return $.deref()?.isConnected})}function ey($){if(KL(),$&&x5($)!=="body"){if(s7.push(new WeakRef($)),s7.length>ty)s7=s7.slice(-ty)}}function $P(){return KL(),s7[s7.length-1]?.deref()}function po($){if(!$)return null;if(sK($))return $;return zQ($)[0]||$}function JP($){if($.hasAttribute("tabindex")&&!$.hasAttribute("data-tabindex"))return;if(!$.getAttribute("role")?.includes("dialog"))return;let Q=s_($).filter((q)=>{let X=q.getAttribute("data-tabindex")||"";return sK(q)||q.hasAttribute("data-tabindex")&&!X.startsWith("-")}),Z=$.getAttribute("tabindex");if(Q.length===0){if(Z!=="0")$.setAttribute("tabindex","0"),$.setAttribute("data-tabindex","0")}else if(Z!=="-1"||$.hasAttribute("data-tabindex")&&$.getAttribute("data-tabindex")!=="-1")$.setAttribute("tabindex","-1"),$.setAttribute("data-tabindex","-1")}function dq($){let{context:J,children:Q,disabled:Z=!1,initialFocus:q=!0,returnFocus:X=!0,restoreFocus:Y=!1,modal:z=!0,closeOnFocusOut:K=!0,openInteractionType:W="",nextFocusableElement:H,previousFocusableElement:B,beforeContentFocusGuardRef:U,externalTree:_,getInsideElements:L}=$,F="rootStore"in J?J.rootStore:J,V=F.useState("open"),M=F.useState("domReferenceElement"),D=F.useState("floatingElement"),{events:N,dataRef:O}=F.context,k=v0(()=>O.current.floatingContext?.nodeId),I=q===!1,b=Sq(M)&&I,A=L5(q),w=L5(X),C=L5(W),y=L5(V),x=d8(_),E=zL(),P=p8.useRef(!1),h=p8.useRef(!1),p=p8.useRef(!1),e=p8.useRef(null),S=p8.useRef(""),r=p8.useRef(""),$0=p8.useRef(null),K0=p8.useRef(null),t=_9($0,U,E?.beforeInsideRef),H0=_9(K0,E?.afterInsideRef),z0=U5(),j=U5(),d=S6(),m=E!=null,s=hq(D),u=v0((f=s)=>{return f?zQ(f):[]}),c=v0(()=>L?.().filter((f)=>f!=null)??[]);p8.useEffect(()=>{if(Z||!z)return;function f(G0){if(G0.key==="Tab"){if(e0(s,v5(Y1(s)))&&u().length===0&&!b)q6(G0)}}let o=Y1(s);return U1(o,"keydown",f)},[Z,s,z,b,u]),p8.useEffect(()=>{if(Z||!V)return;let f=Y1(s);function o(){p.current=!1}function G0(Z0){let Q0=w5(Z0),B0=c(),W0=e0(D,Q0)||e0(M,Q0)||e0(E?.portalNode,Q0)||B0.some((L0)=>L0===Q0||e0(L0,Q0));if(p.current=!W0,r.current=Z0.pointerType||"keyboard",Q0?.closest(`[${$G}]`))h.current=!0,j.start(0,()=>{h.current=!1})}function l(){r.current="keyboard"}return I8(U1(f,"pointerdown",G0,!0),U1(f,"pointerup",o,!0),U1(f,"pointercancel",o,!0),U1(f,"keydown",l,!0),o)},[Z,D,M,s,V,E,j,c]),p8.useEffect(()=>{if(Z||!K)return;let f=Y1(s);function o(){h.current=!0,j.start(0,()=>{h.current=!1})}function G0(B0){let W0=w5(B0);if(sK(W0))e.current=W0}function l(B0){let{relatedTarget:W0,currentTarget:L0}=B0,_0=w5(B0);if(z&&W0==null&&_0!=null&&e0(D,_0))ey(_0);queueMicrotask(()=>{let N0=k(),d0=F.context.triggerElements,g=c(),a=W0?.hasAttribute(e4("focus-guard"))&&[$0.current,K0.current,E?.beforeInsideRef.current,E?.afterInsideRef.current,E?.beforeOutsideRef.current,E?.afterOutsideRef.current,f9(B),f9(H)].includes(W0),I0=!(e0(M,W0)||e0(D,W0)||e0(W0,D)||e0(E?.portalNode,W0)||g.some((A0)=>A0===W0||e0(A0,W0))||W0!=null&&d0.hasElement(W0)||d0.hasMatchingElement((A0)=>e0(A0,W0))||a||x&&(V9(x.nodesRef.current,N0).find((A0)=>e0(A0.context?.elements.floating,W0)||e0(A0.context?.elements.domReference,W0))||n_(x.nodesRef.current,N0).find((A0)=>[A0.context?.elements.floating,hq(A0.context?.elements.floating)].includes(W0)||A0.context?.elements.domReference===W0)));if(L0===M&&s)JP(s);if(Y&&L0!==M&&!L$(_0)&&v5(f)===f.body){if(y1(s)){if(s.focus(),Y==="popup"){d.request(()=>{s.focus()});return}}let A0=u(),F0=e.current,m0=(F0&&A0.includes(F0)?F0:null)||A0[A0.length-1]||s;if(y1(m0))m0.focus()}if(O.current.insideReactTree){O.current.insideReactTree=!1;return}if((b?!0:!z)&&W0&&I0&&!h.current&&(b||W0!==$P()))P.current=!0,F.setOpen(!1,l0(T0.focusOut,B0))})}function Z0(){if(p.current)return;O.current.insideReactTree=!0,z0.start(0,()=>{O.current.insideReactTree=!1})}let Q0=y1(M)?M:null;if(!D&&!Q0)return;return I8(Q0&&U1(Q0,"focusout",l),Q0&&U1(Q0,"pointerdown",o),D&&U1(D,"focusin",G0),D&&U1(D,"focusout",l),D&&E&&U1(D,"focusout",Z0,!0))},[Z,M,D,s,z,x,E,F,K,Y,u,b,k,O,z0,j,d,H,B,c]),p8.useEffect(()=>{if(Z||!D||!V)return;let f=Array.from(E?.portalNode?.querySelectorAll(`[${e4("portal")}]`)||[]),G0=(x?n_(x.nodesRef.current,k()):[]).find((L0)=>Sq(L0.context?.elements.domReference||null))?.context?.elements.domReference,Z0=[...[D,...f,$0.current,K0.current,E?.beforeOutsideRef.current,E?.afterOutsideRef.current,...c()],G0,f9(B),f9(H),b?M:null].filter((L0)=>L0!=null),Q0=$L(Z0,{ariaHidden:z||b,mark:!1}),B0=[D,...f].filter((L0)=>L0!=null),W0=$L(B0);return()=>{W0(),Q0()}},[V,Z,M,D,z,E,b,x,k,H,B,c]),P0(()=>{if(!V||Z||!y1(s))return;let f=Y1(s),o=v5(f);queueMicrotask(()=>{let G0=A.current,l=typeof G0==="function"?G0(C.current||""):G0;if(l===void 0||l===!1)return;if(e0(s,o))return;let Q0=null,B0=()=>{if(Q0==null)Q0=u(s);return Q0[0]||s},W0;if(l===!0||l===null)W0=B0();else W0=f9(l);W0=W0||B0();let L0=e0(s,v5(f));GQ(W0,{preventScroll:W0===s,shouldFocus(){if(!y.current)return!1;if(L0)return!0;let _0=v5(f);return!(_0!==W0&&e0(s,_0))}})})},[Z,V,s,u,A,C,y]),P0(()=>{if(Z||!s)return;let f=Y1(s),o=v5(f),G0=C.current==null;ey(o);function l(Q0){if(!Q0.open)S.current=co(Q0.nativeEvent,r.current);if(Q0.reason===T0.triggerHover&&Q0.nativeEvent.type==="mouseleave")P.current=!0;if(Q0.reason!==T0.outsidePress)return;if(Q0.nested)P.current=!1;else if(lK(Q0.nativeEvent)||iK(Q0.nativeEvent))P.current=!1;else{let B0=!1;if(Y1(s).createElement("div").focus({get preventScroll(){return B0=!0,!1}}),B0)P.current=!1;else P.current=!0}}N.on("openchange",l);function Z0(){let Q0=w.current,B0=typeof Q0==="function"?Q0(S.current):Q0;if(B0===void 0||B0===!1)return null;if(B0===null)B0=!0;let W0=M?.isConnected?M:null,L0=o?.isConnected&&x5(o)!=="body"?o:null,_0=G0?L0||W0:W0||L0;if(!_0)_0=$P()||null;if(typeof B0==="boolean")return _0;return f9(B0)||_0||null}return()=>{N.off("openchange",l);let Q0=v5(f),B0=c(),W0=e0(D,Q0)||B0.some((N0)=>N0===Q0||e0(N0,Q0))||x&&V9(x.nodesRef.current,k(),!1).some((N0)=>e0(N0.context?.elements.floating,Q0)),L0=w.current,_0=Z0();queueMicrotask(()=>{let N0=po(_0),d0=typeof L0!=="boolean";if(L0&&!P.current&&y1(N0)&&(!d0&&N0!==Q0&&Q0!==f.body?W0:!0))N0.focus({preventScroll:!0});P.current=!1})}},[Z,D,s,w,C,N,x,M,k,c]),P0(()=>{if(!p1.engine.webkit||V||!D)return;let f=v5(Y1(D));if(!y1(f)||!U$(f))return;if(e0(D,f))f.blur()},[V,D]),P0(()=>{if(Z||!E)return;return E.setFocusManagerState({modal:z,closeOnFocusOut:K,open:V,onOpenChange:F.setOpen,domReference:M}),()=>{E.setFocusManagerState(null)}},[Z,E,z,V,F,K,M]),P0(()=>{if(Z||!s)return;return JP(s),()=>{queueMicrotask(KL)}},[Z,s]);let i=!Z&&(z?!b:!0)&&(m||z);return T(p8.Fragment,{children:[i&&G(F9,{"data-type":"inside",ref:t,onFocus:(f)=>{if(z){let o=u();GQ(o[o.length-1])}else if(E?.portalNode)if(P.current=!1,t4(f,E.portalNode))KQ(M)?.focus();else f9(B??E.beforeOutsideRef)?.focus()}}),Q,i&&G(F9,{"data-type":"inside",ref:H0,onFocus:(f)=>{if(z)GQ(u()[0]);else if(E?.portalNode){if(K)P.current=!0;if(t4(f,E.portalNode))oK(M)?.focus();else f9(H??E.afterOutsideRef)?.focus()}}})]})}var pq=R(v(),1);function M$($,J={}){let{enabled:Q=!0,event:Z="click",toggle:q=!0,ignoreMouse:X=!1,stickIfOpen:Y=!0,touchOpenDelay:z=0,reason:K=T0.triggerPress}=J,W="rootStore"in $?$.rootStore:$,H=W.context.dataRef,B=pq.useRef(void 0),U=S6(),_=U5(),L=pq.useMemo(()=>{function F(M,D,N,O){let k=l0(K,D,N);if(M&&O==="touch"&&z>0)_.start(z,()=>{W.setOpen(!0,k)});else W.setOpen(M,k)}function V(M,D,N){let O=H.current.openEvent,k=W.select("domReferenceElement")!==D;if(M&&k)return!0;if(!M)return!0;if(!q)return!0;if(O&&Y)return!N(O.type);return!1}return{onPointerDown(M){B.current=M.pointerType},onMouseDown(M){let D=B.current,N=M.nativeEvent,O=W.select("open");if(M.button!==0||Z==="click"||l7(D,!0)&&X)return;let k=V(O,M.currentTarget,(A)=>A==="click"||A==="mousedown"),I=w5(N);if(U$(I)){F(k,N,I,D);return}let b=M.currentTarget;U.request(()=>{F(k,N,b,D)})},onClick(M){if(Z==="mousedown-only")return;let D=B.current;if(Z==="mousedown"&&D){B.current=void 0;return}if(l7(D,!0)&&X)return;let N=W.select("open"),O=V(N,M.currentTarget,(k)=>k==="click"||k==="mousedown"||k==="keydown"||k==="keyup");F(O,M.nativeEvent,M.currentTarget,D)},onKeyDown(){B.current=void 0}}},[H,Z,X,K,W,Y,q,U,_,z]);return pq.useMemo(()=>Q?{reference:L}:k1,[Q,L])}var A6=R(v(),1);function lo(){return!1}function io($){return{escapeKey:typeof $==="boolean"?$:$?.escapeKey??!1,outsidePress:typeof $==="boolean"?$:$?.outsidePress??!0}}function lq($,J={}){let{enabled:Q=!0,escapeKey:Z=!0,outsidePress:q=!0,outsidePressEvent:X="sloppy",referencePress:Y=lo,bubbles:z,externalTree:K}=J,W="rootStore"in $?$.rootStore:$,H=W.useState("open"),B=W.useState("floatingElement"),{dataRef:U}=W.context,_=d8(K),L=v0(typeof q==="function"?q:()=>!1),F=typeof q==="function"?L:q,V=F!==!1,M=v0(()=>X),{escapeKey:D,outsidePress:N}=io(z),O=A6.useRef(!1),k=A6.useRef(!1),I=A6.useRef(!1),b=A6.useRef(!1),A=A6.useRef(""),w=A6.useRef(null),C=U5(),y=U5(),x=v0(()=>{y.clear(),U.current.insideReactTree=!1}),E=v0((t)=>{let H0=U.current.floatingContext?.nodeId;return(_?V9(_.nodesRef.current,H0):[]).some((j)=>j.context?.open&&!j.context.dataRef.current[t])}),P=v0((t)=>{return pK(t,W.select("floatingElement"))||pK(t,W.select("domReferenceElement"))}),h=v0((t)=>{if(!Y())return;W.setOpen(!1,l0(T0.triggerPress,t.nativeEvent))}),p=v0((t)=>{if(!H||!Q||!Z||t.key!=="Escape")return;if(b.current)return;if(!D&&E("__escapeKeyBubbles"))return;let H0=_y(t)?t.nativeEvent:t,z0=l0(T0.escapeKey,H0);if(W.setOpen(!1,z0),!z0.isCanceled)t.preventDefault();if(!D&&!z0.isPropagationAllowed)t.stopPropagation()}),e=v0(()=>{U.current.insideReactTree=!0,y.start(0,x)}),S=v0((t)=>{if(!H||!Q||t.button!==0)return;let H0=w5(t.nativeEvent);if(!e0(W.select("floatingElement"),H0))return;if(!O.current)O.current=!0,k.current=!1}),r=v0((t)=>{if(!H||!Q)return;if(!(t.defaultPrevented||t.nativeEvent.defaultPrevented))return;if(O.current)k.current=!0});A6.useEffect(()=>{if(!H||!Q)return;U.current.__escapeKeyBubbles=D,U.current.__outsidePressBubbles=N;let t=new T8,H0=new T8;function z0(){t.clear(),b.current=!0}function j(){t.start(p1.engine.webkit?5:0,()=>{b.current=!1})}function d(){I.current=!0,H0.start(0,()=>{I.current=!1})}function m(){O.current=!1,k.current=!1}function s(){let g=A.current,a=g==="pen"||!g?"mouse":g,I0=M(),A0=typeof I0==="function"?I0():I0;if(typeof A0==="string")return A0;return A0[a]}function u(g){let a=s();return a==="intentional"&&g.type!=="click"||a==="sloppy"&&g.type==="click"}function c(g){let a=U.current.floatingContext?.nodeId,I0=_&&V9(_.nodesRef.current,a).some((A0)=>pK(g,A0.context?.elements.floating));return P(g)||I0}function i(g){if(u(g)){if(g.type!=="click"&&!P(g))H0.clear(),I.current=!1;x();return}if(U.current.insideReactTree){x();return}let a=w5(g),I0=`[${e4("inert")}]`,A0=F1(a)?a.getRootNode():null,F0=Array.from((i9(A0)?A0:Y1(W.select("floatingElement"))).querySelectorAll(I0)),m0=W.context.triggerElements;if(a&&(m0.hasElement(a)||m0.hasMatchingElement((n0)=>e0(n0,a))))return;let R0=F1(a)?a:null;while(R0&&!j6(R0)){let n0=b6(R0);if(j6(n0)||!F1(n0))break;R0=n0}if(F0.length&&F1(a)&&!By(a)&&!e0(a,W.select("floatingElement"))&&F0.every((n0)=>!e0(R0,n0)))return;if(y1(a)&&!("touches"in g)){let n0=j6(a),C0=d5(a),z1=/auto|scroll/,Q1=n0||z1.test(C0.overflowX),a0=n0||z1.test(C0.overflowY),R1=Q1&&a.clientWidth>0&&a.scrollWidth>a.clientWidth,C1=a0&&a.clientHeight>0&&a.scrollHeight>a.clientHeight,b1=C0.direction==="rtl",n=C1&&(b1?g.offsetX<=a.offsetWidth-a.clientWidth:g.offsetX>a.clientWidth),D0=R1&&g.offsetY>a.clientHeight;if(n||D0)return}if(c(g))return;if(s()==="intentional"&&I.current){H0.clear(),I.current=!1;return}if(typeof F==="function"&&!F(g))return;if(E("__outsidePressBubbles"))return;W.setOpen(!1,l0(T0.outsidePress,g)),x()}function f(g){if(s()!=="sloppy"||g.pointerType==="touch"||!W.select("open")||!Q||P(g))return;i(g)}function o(g){if(s()!=="sloppy"||!W.select("open")||!Q||P(g))return;let a=g.touches[0];if(a)w.current={startTime:Date.now(),startX:a.clientX,startY:a.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},C.start(1000,()=>{if(w.current)w.current.dismissOnTouchEnd=!1,w.current.dismissOnMouseDown=!1})}function G0(g,a){let I0=w5(g);if(!I0)return;let A0=U1(I0,g.type,()=>{a(g),A0()})}function l(g){A.current="touch",G0(g,o)}function Z0(g){if(C.clear(),g.type==="pointerdown")A.current=g.pointerType;if(g.type==="mousedown"&&w.current&&!w.current.dismissOnMouseDown)return;G0(g,(a)=>{if(a.type==="pointerdown")f(a);else i(a)})}function Q0(g){if(!O.current)return;let a=k.current;if(m(),s()!=="intentional")return;if(g.type==="pointercancel"){if(a)d();return}if(c(g))return;if(a){d();return}if(typeof F==="function"&&!F(g))return;H0.clear(),I.current=!0,x()}function B0(g){if(s()!=="sloppy"||!w.current||P(g))return;let a=g.touches[0];if(!a)return;let I0=Math.abs(a.clientX-w.current.startX),A0=Math.abs(a.clientY-w.current.startY),F0=Math.sqrt(I0*I0+A0*A0);if(F0>5)w.current.dismissOnTouchEnd=!0;if(F0>10)i(g),C.clear(),w.current=null}function W0(g){G0(g,B0)}function L0(g){if(s()!=="sloppy"||!w.current||P(g))return;if(w.current.dismissOnTouchEnd)i(g);C.clear(),w.current=null}function _0(g){G0(g,L0)}let N0=Y1(B),d0=I8(Z&&I8(U1(N0,"keydown",p),U1(N0,"compositionstart",z0),U1(N0,"compositionend",j)),V&&I8(U1(N0,"click",Z0,!0),U1(N0,"pointerdown",Z0,!0),U1(N0,"pointerup",Q0,!0),U1(N0,"pointercancel",Q0,!0),U1(N0,"mousedown",Z0,!0),U1(N0,"mouseup",Q0,!0),U1(N0,"touchstart",l,!0),U1(N0,"touchmove",W0,!0),U1(N0,"touchend",_0,!0)));return()=>{d0(),t.clear(),H0.clear(),m(),I.current=!1}},[U,B,Z,V,F,H,Q,D,N,p,x,M,E,P,_,W,C]),A6.useEffect(x,[F,x]);let $0=A6.useMemo(()=>({onKeyDown:p,onPointerDown:h,onClick:h}),[p,h]),K0=A6.useMemo(()=>({onKeyDown:p,onPointerDown:r,onMouseDown:r,onClickCapture:e,onMouseDownCapture(t){e(),S(t)},onPointerDownCapture(t){e(),S(t)},onMouseUpCapture:e,onTouchEndCapture:e,onTouchMoveCapture:e}),[p,e,S,r]);return A6.useMemo(()=>Q?{reference:$0,floating:K0,trigger:$0}:{},[Q,$0,K0])}var l8=R(v(),1);var BQ=R(v(),1),An=R(J5(),1);var QP=R(v(),1);function ZP($){let J=QP.useRef(!0);if(J.current)J.current=!1,$()}var WP=R(v(),1);var $1=($,J,Q,Z,q,X,...Y)=>{if(Y.length>0)throw Error(V1(1));let z;if($&&J&&Q&&Z&&q&&X)z=(K,W,H,B)=>{let U=$(K,W,H,B),_=J(K,W,H,B),L=Q(K,W,H,B),F=Z(K,W,H,B),V=q(K,W,H,B);return X(U,_,L,F,V,W,H,B)};else if($&&J&&Q&&Z&&q)z=(K,W,H,B)=>{let U=$(K,W,H,B),_=J(K,W,H,B),L=Q(K,W,H,B),F=Z(K,W,H,B);return q(U,_,L,F,W,H,B)};else if($&&J&&Q&&Z)z=(K,W,H,B)=>{let U=$(K,W,H,B),_=J(K,W,H,B),L=Q(K,W,H,B);return Z(U,_,L,W,H,B)};else if($&&J&&Q)z=(K,W,H,B)=>{let U=$(K,W,H,B),_=J(K,W,H,B);return Q(U,_,W,H,B)};else if($&&J)z=(K,W,H,B)=>{let U=$(K,W,H,B);return J(U,W,H,B)};else if($)z=$;else throw Error("Missing arguments");return z};var KP=R(v(),1),LL=R(WL(),1);var o7=R(v(),1),Xn=WL();function Yn($,J){return $===J&&($!==0||1/$===1/J)||$!==$&&J!==J}var zn=typeof Object.is==="function"?Object.is:Yn,Kn=Xn.useSyncExternalStore,Gn=o7.useRef,Wn=o7.useEffect,Hn=o7.useMemo,Bn=o7.useDebugValue;var HL=function($,J,Q,Z,q){var X=Gn(null);if(X.current===null){var Y={hasValue:!1,value:null};X.current=Y}else Y=X.current;X=Hn(function(){function K(_){if(!W){if(W=!0,H=_,_=Z(_),q!==void 0&&Y.hasValue){var L=Y.value;if(q(L,_))return B=L}return B=_}if(L=B,zn(H,_))return L;var F=Z(_);if(q!==void 0&&q(L,F))return H=_,L;return H=_,B=F}var W=!1,H,B,U=Q===void 0?null:Q;return[function(){return K(J())},U===null?void 0:function(){return K(U())}]},[J,Q,Z,q]);var z=Kn($,X[0],X[1]);return Wn(function(){Y.hasValue=!0,Y.value=z},[z]),Bn(z),z};var qP=R(v(),1);var BL=[],UL=void 0;function XP(){return UL}function YP($){BL.push($)}function _L($){let J=(Q,Z)=>{let q=W5(Un).current,X;try{UL=q;for(let Y of BL)Y.before(q);X=$(Q,Z);for(let Y of BL)Y.after(q);q.didInitialize=!0}finally{UL=void 0}return X};return J.displayName=$.displayName||$.name,J}function zP($){return qP.forwardRef(_L($))}function Un(){return{didInitialize:!1}}var _n=WQ(19),Ln=_n?Vn:Mn;function ZG($,J,Q,Z,q){return Ln($,J,Q,Z,q)}function Fn($,J,Q,Z,q){let X=KP.useCallback(()=>J($.getSnapshot(),Q,Z,q),[$,J,Q,Z,q]);return LL.useSyncExternalStore($.subscribe,X,X)}YP({before($){if($.syncIndex=0,!$.didInitialize)$.syncTick=1,$.syncHooks=[],$.didChangeStore=!0,$.getSnapshot=()=>{let J=!1;for(let Q=0;Q<$.syncHooks.length;Q+=1){let Z=$.syncHooks[Q],q=Z.selector(Z.store.state,Z.a1,Z.a2,Z.a3);if(!Object.is(Z.value,q))J=!0,Z.value=q}if(J)$.syncTick+=1;return $.syncTick}},after($){if($.syncHooks.length>0){if($.didChangeStore)$.didChangeStore=!1,$.subscribe=(J)=>{let Q=new Set;for(let q of $.syncHooks)Q.add(q.store);let Z=[];for(let q of Q)Z.push(q.subscribe(J));return()=>{for(let q of Z)q()}};LL.useSyncExternalStore($.subscribe,$.getSnapshot,$.getSnapshot)}}});function Vn($,J,Q,Z,q){let X=XP();if(!X)return Fn($,J,Q,Z,q);let Y=X.syncIndex;X.syncIndex+=1;let z;if(!X.didInitialize)z={store:$,selector:J,a1:Q,a2:Z,a3:q,value:J($.getSnapshot(),Q,Z,q)},X.syncHooks.push(z);else if(z=X.syncHooks[Y],z.store!==$||z.selector!==J||!Object.is(z.a1,Q)||!Object.is(z.a2,Z)||!Object.is(z.a3,q)){if(z.store!==$)X.didChangeStore=!0;z.store=$,z.selector=J,z.a1=Q,z.a2=Z,z.a3=q,z.value=J($.getSnapshot(),Q,Z,q)}return z.value}function Mn($,J,Q,Z,q){return HL($.subscribe,$.getSnapshot,$.getSnapshot,(X)=>J(X,Q,Z,q))}class FL{constructor($){this.state=$,this.listeners=new Set,this.updateTick=0}subscribe=($)=>{return this.listeners.add($),()=>{this.listeners.delete($)}};getSnapshot=()=>{return this.state};setState($){if(this.state===$)return;this.state=$,this.updateTick+=1;let J=this.updateTick;for(let Q of this.listeners){if(J!==this.updateTick)return;Q($)}}update($){for(let J in $)if(!Object.is(this.state[J],$[J])){this.setState({...this.state,...$});return}}set($,J){if(!Object.is(this.state[$],J))this.setState({...this.state,[$]:J})}notifyAll(){let $={...this.state};this.setState($)}use($,J,Q,Z){return ZG(this,$,J,Q,Z)}}var D$=R(v(),1);class N$ extends FL{constructor($,J={},Q){super($);this.context=J,this.selectors=Q}useSyncedValue($,J){D$.useDebugValue($);let Q=this;P0(()=>{if(Q.state[$]!==J)Q.set($,J)},[Q,$,J])}useSyncedValueWithCleanup($,J){let Q=this;P0(()=>{if(Q.state[$]!==J)Q.set($,J);return()=>{Q.set($,void 0)}},[Q,$,J])}useSyncedValues($){let J=this,Q=Object.values($);P0(()=>{J.update($)},[J,...Q])}useControlledProp($,J){D$.useDebugValue($);let Q=this,Z=J!==void 0;P0(()=>{if(Z&&!Object.is(Q.state[$],J))Q.setState({...Q.state,[$]:J})},[Q,$,J,Z])}select($,J,Q,Z){let q=this.selectors[$];return q(this.state,J,Q,Z)}useState($,J,Q,Z){return D$.useDebugValue($),ZG(this,this.selectors[$],J,Q,Z)}useContextCallback($,J){D$.useDebugValue($);let Q=v0(J??d1);this.context[$]=Q}useStateSetter($){let J=D$.useRef(void 0);if(J.current===void 0)J.current=(Q)=>{this.set($,Q)};return J.current}observe($,J){let Q;if(typeof $==="function")Q=$;else Q=this.selectors[$];let Z=Q(this.state);return J(Z,Z,this),this.subscribe((q)=>{let X=Q(q);if(!Object.is(Z,X)){let Y=Z;Z=X,J(X,Y,this)}})}}var qG=R(v(),1);function GP(){let[,$]=qG.useState({});return qG.useCallback(()=>{$({})},[])}var Dn={open:$1(($)=>$.open),transitionStatus:$1(($)=>$.transitionStatus),domReferenceElement:$1(($)=>$.domReferenceElement),referenceElement:$1(($)=>$.positionReference??$.referenceElement),floatingElement:$1(($)=>$.floatingElement),floatingId:$1(($)=>$.floatingId)};class $7 extends N${constructor($){let{syncOnly:J,nested:Q,onOpenChange:Z,triggerElements:q,...X}=$;super({...X,positionReference:X.referenceElement,domReferenceElement:X.referenceElement},{onOpenChange:Z,dataRef:{current:{}},events:QG(),nested:Q,triggerElements:q},Dn);this.syncOnly=J}syncOpenEvent=($,J)=>{if(!$||!this.state.open||J!=null&&Ly(J))this.context.dataRef.current.openEvent=$?J:void 0};dispatchOpenChange=($,J)=>{this.syncOpenEvent($,J.event);let Q={open:$,reason:J.reason,nativeEvent:J.event,nested:this.context.nested,triggerElement:J.trigger};this.context.events.emit("openchange",Q)};setOpen=($,J)=>{if(this.syncOnly){this.context.onOpenChange?.($,J);return}this.dispatchOpenChange($,J),this.context.onOpenChange?.($,J)}}function iq($){let{popupStore:J,treatPopupAsFloatingElement:Q=!1,floatingRootContext:Z,floatingId:q,nested:X,onOpenChange:Y}=$,z=J.useState("open"),K=J.useState("activeTriggerElement"),W=J.useState(Q?"popupElement":"positionerElement"),H=J.context.triggerElements,B=Y,U=WP.useRef(null);if(Z===void 0&&U.current===null)U.current=new $7({open:z,transitionStatus:void 0,referenceElement:K,floatingElement:W,triggerElements:H,onOpenChange:B,floatingId:q,syncOnly:!0,nested:X});let _=Z??U.current;return J.useSyncedValue("floatingId",q),P0(()=>{let L={open:z,floatingId:q,referenceElement:K,floatingElement:W};if(F1(K))L.domReferenceElement=K;if(_.state.positionReference===_.state.referenceElement)L.positionReference=K;_.update(L)},[z,q,K,W,_]),_.context.onOpenChange=B,_.context.nested=X,_}var VL=R(v(),1);function HQ($,J=!1,Q=!1){let[Z,q]=VL.useState($&&J?"idle":void 0),[X,Y]=VL.useState($);if($&&!X)Y(!0),q("starting");if(!$&&X&&Z!=="ending"&&!Q)q("ending");if(!$&&!X&&Z==="ending")q(void 0);return P0(()=>{if(!$&&X&&Z!=="ending"&&Q){let z=L9.request(()=>{q("ending")});return()=>{L9.cancel(z)}}return},[$,X,Z,Q]),P0(()=>{if(!$||J)return;let z=L9.request(()=>{q(void 0)});return()=>{L9.cancel(z)}},[J,$]),P0(()=>{if(!$||!J)return;if($&&X&&Z!=="idle")q("starting");let z=L9.request(()=>{q("idle")});return()=>{L9.cancel(z)}},[J,$,X,Z]),{mounted:X,setMounted:Y,transitionStatus:Z}}var BP=R(v(),1);var HP=R(J5(),1);var O$=function($){return $.startingStyle="data-starting-style",$.endingStyle="data-ending-style",$}({}),Nn={[O$.startingStyle]:""},On={[O$.endingStyle]:""},B4={transitionStatus($){if($==="starting")return Nn;if($==="ending")return On;return null}};function U4($,J=!1,Q=!0){let Z=S6();return v0((q,X=null)=>{Z.cancel();let Y=f9($);if(Y==null)return;let z=Y,K=()=>{HP.flushSync(q)};if(typeof z.getAnimations!=="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){q();return}function W(){Promise.all(z.getAnimations().map((H)=>H.finished)).then(()=>{if(!X?.aborted)K()}).catch(()=>{if(Q){if(!X?.aborted)K();return}let H=z.getAnimations();if(!X?.aborted&&H.length>0&&H.some((B)=>B.pending||B.playState!=="finished"))W()})}if(J){let H=O$.startingStyle;if(!z.hasAttribute(H)){Z.request(W);return}let B=new MutationObserver(()=>{if(!z.hasAttribute(H))B.disconnect(),W()});B.observe(z,{attributes:!0,attributeFilter:[H]}),X?.addEventListener("abort",()=>B.disconnect(),{once:!0});return}Z.request(W)})}function _4($){let{enabled:J=!0,open:Q,ref:Z,onComplete:q}=$,X=v0(q),Y=U4(Z,Q,!1);BP.useEffect(()=>{if(!J)return;let z=new AbortController;return Y(X,z.signal),()=>{z.abort()}},[J,Q,X,Y])}var UQ={tabIndex:-1,[Pq]:""};function UP($){return(J)=>J==="touch"?$.current:!0}function _P($,J,Q=!1){let Z=h6(),q=x8()!=null,X=BQ.useRef(null);if($===void 0&&X.current===null)X.current=J(Z,q);let Y=$??X.current;return iq({popupStore:Y,treatPopupAsFloatingElement:Q,floatingRootContext:Y.state.floatingRootContext,floatingId:Z,nested:q,onOpenChange:Y.setOpen}),{store:Y,internalStore:X.current}}function ML($,J){let Q=BQ.useRef(null),Z=BQ.useRef(null);return BQ.useCallback((q)=>{if($===void 0)return;let X=!1;if(Q.current!==null){let Y=Q.current,z=Z.current,K=J.context.triggerElements.getById(Y);if(z&&K===z)J.context.triggerElements.delete(Y),X=!0;Q.current=null,Z.current=null}if(q!==null)Q.current=$,Z.current=q,J.context.triggerElements.add($,q),X=!0;if(X){let Y=J.context.triggerElements.size;if(J.select("open")&&J.state.triggerCount!==Y)J.set("triggerCount",Y)}},[J,$])}function XG($,J,Q,Z=!1){if(J)$.preventUnmountingOnClose=!1;else if(Z)$.preventUnmountingOnClose=!0;let q=Q?.id??null;if(q||J)$.activeTriggerId=q,$.activeTriggerElement=Q??null}function YG($){let J=!1;return $.preventUnmountOnClose=()=>{J=!0},()=>J}function zG($,J,Q,Z){ZP(()=>{if(J===void 0&&$.state.open===!1&&Q)$.state={...$.state,open:!0,activeTriggerId:Z,preventUnmountingOnClose:!1}})}function KG($,J,Q,Z){let q=Q.useState("isMountedByTrigger",$),X=ML($,Q),Y=v0((z)=>{if(X(z),!z)return;let K=Q.select("open"),W=Q.select("activeTriggerId");if(W===$){Q.update({activeTriggerElement:z,...K?Z:null});return}if(W==null&&K)Q.update({activeTriggerId:$,activeTriggerElement:z,...Z})});return P0(()=>{if(q)Q.update({activeTriggerElement:J.current,...Z})},[q,Q,J,...Object.values(Z)]),{registerTrigger:Y,isMountedByThisTrigger:q}}function GG($,J={}){let{closeOnActiveTriggerUnmount:Q=!1}=J,Z=$.useState("open"),q=$.useState("triggerCount");P0(()=>{if(!Z){if($.state.triggerCount!==0)$.set("triggerCount",0);return}let X=$.context.triggerElements.size,Y={};if($.state.triggerCount!==X)Y.triggerCount=X;let z=$.select("activeTriggerId"),K=null;if(z){let W=$.context.triggerElements.getById(z);if(!W)K=z;else if(W!==$.state.activeTriggerElement)Y.activeTriggerElement=W}if(!K&&!z&&X===1){let W=$.context.triggerElements.entries().next();if(!W.done){let[H,B]=W.value;Y.activeTriggerId=H,Y.activeTriggerElement=B}}if(Y.triggerCount!==void 0||Y.activeTriggerId!==void 0||Y.activeTriggerElement!==void 0)$.update(Y);if(K){if(Q)queueMicrotask(()=>{if($.select("open")&&$.select("activeTriggerId")===K&&!$.context.triggerElements.getById(K)){let W=l0(T0.none);if($.setOpen(!1,W),!W.isCanceled)$.update({activeTriggerId:null,activeTriggerElement:null})}})}},[Z,$,q,Q])}function WG($,J,Q){let{mounted:Z,setMounted:q,transitionStatus:X}=HQ($),Y=J.useState("preventUnmountingOnClose"),z=$?!1:Y;J.useSyncedValues({mounted:Z,transitionStatus:X,preventUnmountingOnClose:z});let K=v0(()=>{q(!1),J.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),Q?.(),J.context.onOpenChangeComplete?.(!1)});return _4({enabled:Z&&!$&&!z,open:$,ref:J.context.popupRef,onComplete(){if(!$)K()}}),{forceUnmount:K,transitionStatus:X}}function HG($,J){$.useSyncedValues(J),P0(()=>()=>{$.update({activeTriggerProps:k1,inactiveTriggerProps:k1,popupProps:k1})},[$])}function LP($,J){P0(()=>{if(!J&&$.state.openMethod!==null)$.set("openMethod",null)},[J,$]),P0(()=>()=>{if($.state.openMethod!==null)$.set("openMethod",null)},[$])}class J7{constructor(){this.elementsSet=new Set,this.idMap=new Map}add($,J){let Q=this.idMap.get($);if(Q===J)return;if(Q!==void 0)this.elementsSet.delete(Q);this.elementsSet.add(J),this.idMap.set($,J)}delete($){let J=this.idMap.get($);if(J)this.elementsSet.delete(J),this.idMap.delete($)}hasElement($){return this.elementsSet.has($)}hasMatchingElement($){for(let J of this.elementsSet)if($(J))return!0;return!1}getById($){return this.idMap.get($)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}}function FP(){return new $7({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new J7,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function BG(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:FP(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:k1,inactiveTriggerProps:k1,popupProps:k1}}function MP($,J,Q=!1){return new $7({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:$,floatingId:J,syncOnly:!0,nested:Q,onOpenChange:void 0})}var rq=$1(($)=>$.triggerIdProp??$.activeTriggerId),DL=$1(($)=>$.openProp??$.open),VP=$1(($)=>{return($.popupElement?.id??$.floatingId)||void 0});function DP($,J){return J!==void 0&&DL($)&&rq($)===J}function wn($,J){if(DP($,J))return!0;return J!==void 0&&DL($)&&rq($)==null&&$.triggerCount===1}var UG={open:DL,mounted:$1(($)=>$.mounted),transitionStatus:$1(($)=>$.transitionStatus),floatingRootContext:$1(($)=>$.floatingRootContext),triggerCount:$1(($)=>$.triggerCount),preventUnmountingOnClose:$1(($)=>$.preventUnmountingOnClose),payload:$1(($)=>$.payload),activeTriggerId:rq,activeTriggerElement:$1(($)=>$.mounted?$.activeTriggerElement:null),popupId:VP,isTriggerActive:$1(($,J)=>J!==void 0&&rq($)===J),isOpenedByTrigger:$1(($,J)=>DP($,J)),isMountedByTrigger:$1(($,J)=>J!==void 0&&rq($)===J&&$.mounted),triggerProps:$1(($,J)=>J?$.activeTriggerProps:$.inactiveTriggerProps),triggerPopupId:$1(($,J)=>wn($,J)?VP($):void 0),popupProps:$1(($)=>$.popupProps),popupElement:$1(($)=>$.popupElement),positionerElement:$1(($)=>$.positionerElement)};function NP($){let{open:J=!1,onOpenChange:Q,elements:Z={}}=$,q=h6(),X=x8()!=null,Y=W5(()=>new $7({open:J,transitionStatus:void 0,onOpenChange:Q,referenceElement:Z.reference??null,floatingElement:Z.floating??null,triggerElements:new J7,floatingId:q,syncOnly:!1,nested:X})).current;return P0(()=>{let z={open:J,floatingId:q};if(Z.reference!==void 0)z.referenceElement=Z.reference,z.domReferenceElement=F1(Z.reference)?Z.reference:null;if(Z.floating!==void 0)z.floatingElement=Z.floating;Y.update(z)},[J,q,Z.reference,Z.floating,Y]),Y.context.onOpenChange=Q,Y.context.nested=X,Y}function NL($={}){let{nodeId:J,externalTree:Q}=$,Z=NP($),q=$.rootContext||Z,X=q.useState("referenceElement"),Y=q.useState("floatingElement"),z=q.useState("domReferenceElement"),K=q.useState("open"),W=q.useState("floatingId"),[H,B]=l8.useState(null),[U,_]=l8.useState(void 0),[L,F]=l8.useState(void 0),V=l8.useRef(null),M=d8(Q),D=l8.useMemo(()=>({reference:X,floating:Y,domReference:z}),[X,Y,z]),N=bX({...$,elements:{...D,...H&&{reference:H}}}),O=F1(U)?U:null,k=L===void 0?q.state.floatingElement:L;q.useSyncedValue("referenceElement",U??null),q.useSyncedValue("domReferenceElement",U===void 0?z:O),q.useSyncedValue("floatingElement",k);let I=l8.useCallback((x)=>{let E=F1(x)?{getBoundingClientRect:()=>x.getBoundingClientRect(),getClientRects:()=>x.getClientRects(),contextElement:x}:x;B(E),N.refs.setReference(E)},[N.refs]),b=l8.useCallback((x)=>{if(F1(x)||x===null)V.current=x,_(x);if(F1(N.refs.reference.current)||N.refs.reference.current===null||x!==null&&!F1(x))N.refs.setReference(x)},[N.refs,_]),A=l8.useCallback((x)=>{F(x),N.refs.setFloating(x)},[N.refs]),w=l8.useMemo(()=>({...N.refs,setReference:b,setFloating:A,setPositionReference:I,domReference:V}),[N.refs,b,A,I]),C=l8.useMemo(()=>({...N.elements,domReference:z}),[N.elements,z]),y=l8.useMemo(()=>({...N,dataRef:q.context.dataRef,open:K,onOpenChange:q.setOpen,events:q.context.events,floatingId:W,refs:w,elements:C,nodeId:J,rootStore:q}),[N,w,C,J,q,K,W]);return P0(()=>{if(z)V.current=z},[z]),P0(()=>{q.context.dataRef.current.floatingContext=y;let x=M?.nodesRef.current.find((E)=>E.id===J);if(x)x.context=y}),l8.useMemo(()=>({...N,context:y,refs:w,elements:C,rootStore:q}),[N,w,C,y,q])}var L4=R(v(),1);var OL=p1.os.mac&&p1.engine.webkit;function AL($,J={}){let{enabled:Q=!0,delay:Z}=J,q="rootStore"in $?$.rootStore:$,{events:X,dataRef:Y}=q.context,z=L4.useRef(!1),K=L4.useRef(null),W=L4.useRef(!0),H=U5();L4.useEffect(()=>{let U=q.select("domReferenceElement");if(!Q)return;let _=h1(U);function L(){let M=q.select("domReferenceElement");if(!q.select("open")&&y1(M)&&M===v5(Y1(M)))z.current=!0}function F(){W.current=!0}function V(){W.current=!1}return I8(U1(_,"blur",L),OL&&U1(_,"keydown",F,!0),OL&&U1(_,"pointerdown",V,!0))},[q,Q]),L4.useEffect(()=>{if(!Q)return;function U(_){if(_.reason===T0.triggerPress||_.reason===T0.escapeKey){let L=q.select("domReferenceElement");if(F1(L))K.current=L,z.current=!0}}return X.on("openchange",U),()=>{X.off("openchange",U)}},[X,Q,q]);let B=L4.useMemo(()=>{function U(){z.current=!1,K.current=null}return{onMouseLeave(){U()},onFocus(_){let L=_.currentTarget;if(z.current){if(K.current===L)return;U()}let F=w5(_.nativeEvent);if(F1(F)){if(OL&&!_.relatedTarget){if(!W.current&&!U$(F))return}else if(!Uy(F))return}let V=p7(_.relatedTarget,q.context.triggerElements),{nativeEvent:M,currentTarget:D}=_,N=typeof Z==="function"?Z():Z;if(q.select("open")&&V||N===0||N===void 0){q.setOpen(!0,l0(T0.triggerFocus,M,D));return}H.start(N,()=>{if(z.current)return;q.setOpen(!0,l0(T0.triggerFocus,M,D))})},onBlur(_){U();let{relatedTarget:L,nativeEvent:F}=_,V=F1(L)&&L.hasAttribute(e4("focus-guard"))&&L.getAttribute("data-type")==="outside";H.start(0,()=>{let M=q.select("domReferenceElement"),D=v5(Y1(M));if(!L&&D===M)return;if(e0(Y.current.floatingContext?.refs.floating.current,D)||e0(M,D)||V)return;if(p7(L??D,q.context.triggerElements))return;q.setOpen(!1,l0(T0.triggerFocus,F))})}}},[Y,Z,q,H]);return L4.useMemo(()=>Q?{reference:B,trigger:B}:{},[Q,B])}var IL=R(v(),1);class wL{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new T8,this.restTimeout=new T8,this.handleCloseOptions=void 0}static create(){return new wL}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>{return this.dispose}}var _G=new WeakMap;function _Q($){if(!$.performedPointerEventsMutation)return;let J=$.pointerEventsScopeElement;if(J&&_G.get(J)===$)$.pointerEventsScopeElement?.style.removeProperty("pointer-events"),$.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),$.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),_G.delete(J);$.performedPointerEventsMutation=!1,$.pointerEventsScopeElement=null,$.pointerEventsReferenceElement=null,$.pointerEventsFloatingElement=null}function LG($,J){let{scopeElement:Q,referenceElement:Z,floatingElement:q}=J,X=_G.get(Q);if(X&&X!==$)_Q(X);_Q($),$.performedPointerEventsMutation=!0,$.pointerEventsScopeElement=Q,$.pointerEventsReferenceElement=Z,$.pointerEventsFloatingElement=q,_G.set(Q,$),Q.style.pointerEvents="none",Z.style.pointerEvents="auto",q.style.pointerEvents="auto"}function FG($){let J=$.context.dataRef.current,Q=W5(()=>J.hoverInteractionState??wL.create()).current;if(!J.hoverInteractionState)J.hoverInteractionState=Q;return d7(J.hoverInteractionState.disposeEffect),J.hoverInteractionState}function kn($,J){if(J!=null&&!l7(J))return 0;if(typeof $==="function")return $();return $}function sq($,J,Q){let Z=kn($,Q);if(typeof Z==="number")return Z;return Z?.[J]}function kL($){if(typeof $==="function")return $();return $}function VG($,J){return J||$==="click"||$==="mousedown"}function OP($){return $?.includes("mouse")&&$!=="mousedown"}function oq($,J={}){let{enabled:Q=!0,closeDelay:Z=0,nodeId:q}=J,X="rootStore"in $?$.rootStore:$,Y=X.useState("open"),z=X.useState("floatingElement"),K=X.useState("domReferenceElement"),{dataRef:W}=X.context,H=d8(),B=x8(),U=FG(X),_=U5(),L=v0(()=>{return VG(W.current.openEvent?.type,U.interactedInside)}),F=v0(()=>{return OP(W.current.openEvent?.type)}),V=v0(()=>{_Q(U)});P0(()=>{if(!Y)U.pointerType=void 0,U.restTimeoutPending=!1,U.interactedInside=!1,V()},[Y,U,V]),IL.useEffect(()=>{return V},[V]),P0(()=>{if(!Q)return;if(Y&&U.handleCloseOptions?.blockPointerEvents&&F()&&F1(K)&&z){let M=K,D=z,N=Y1(z),O=H?.nodesRef.current.find((A)=>A.id===B)?.context?.elements.floating;if(O)O.style.pointerEvents="";let k=U.pointerEventsScopeElement!==D?U.pointerEventsScopeElement:null,I=O!==D?O:null,b=U.handleCloseOptions?.getScope?.()??k??I??M.closest("[data-rootownerid]")??N.body;return LG(U,{scopeElement:b,referenceElement:M,floatingElement:D}),()=>{V()}}return},[Q,Y,K,z,U,F,H,B,V]),IL.useEffect(()=>{if(!Q)return;function M(){return!!(H&&B&&V9(H.nodesRef.current,B).length>0)}function D(A){let w=sq(Z,"close",U.pointerType),C=()=>{X.setOpen(!1,l0(T0.triggerHover,A)),H?.events.emit("floating.closed",A)};if(w)U.openChangeTimeout.start(w,C);else U.openChangeTimeout.clear(),C()}function N(A){let w=w5(A);if(!c_(w)){U.interactedInside=!1;return}U.interactedInside=w?.closest("[aria-haspopup]")!=null}function O(){U.openChangeTimeout.clear(),_.clear(),H?.events.off("floating.closed",I),V()}function k(A){if(M()&&H){H.events.on("floating.closed",I);return}if(p7(A.relatedTarget,X.context.triggerElements))return;let w=W.current.floatingContext?.nodeId??q,C=A.relatedTarget;if(H&&w&&F1(C)&&V9(H.nodesRef.current,w,!1).some((x)=>e0(x.context?.elements.floating,C)))return;if(U.handler){U.handler(A);return}if(V(),F()&&!L())D(A)}function I(A){if(!H||!B||M())return;_.start(0,()=>{H.events.off("floating.closed",I),X.setOpen(!1,l0(T0.triggerHover,A)),H.events.emit("floating.closed",A)})}let b=z;return I8(b&&U1(b,"mouseenter",O),b&&U1(b,"mouseleave",k),b&&U1(b,"pointerdown",N,!0),()=>{H?.events.off("floating.closed",I)})},[Q,z,X,W,Z,q,F,L,V,U,H,B,_])}var n7=R(v(),1),AP=R(J5(),1);var In={current:null};function A$($,J={}){let{enabled:Q=!0,delay:Z=0,handleClose:q=null,mouseOnly:X=!1,restMs:Y=0,move:z=!0,triggerElementRef:K=In,externalTree:W,isActiveTrigger:H=!0,getHandleCloseContext:B,isClosing:U,shouldOpen:_}=J,L="rootStore"in $?$.rootStore:$,{dataRef:F,events:V}=L.context,M=d8(W),D=FG(L),N=n7.useRef(!1),O=L5(q),k=L5(Z),I=L5(Y),b=L5(Q),A=L5(_),w=L5(U),C=v0(()=>{return VG(F.current.openEvent?.type,D.interactedInside)}),y=v0(()=>{return A.current?.()!==!1}),x=v0((h,p,e)=>{let S=L.context.triggerElements;if(S.hasElement(p))return!h||!e0(h,p);if(!F1(e))return!1;let r=e;return S.hasMatchingElement(($0)=>e0($0,r))&&(!h||!e0(h,r))}),E=v0(()=>{if(!D.handler)return;Y1(L.select("domReferenceElement")).removeEventListener("mousemove",D.handler),D.handler=void 0}),P=v0(()=>{_Q(D)});if(H)D.handleCloseOptions=O.current?.__options;return n7.useEffect(()=>E,[E]),n7.useEffect(()=>{if(!Q)return;function h(p){if(!p.open)N.current=p.reason===T0.triggerHover,E(),D.openChangeTimeout.clear(),D.restTimeout.clear(),D.blockMouseMove=!0,D.restTimeoutPending=!1;else N.current=!1}return V.on("openchange",h),()=>{V.off("openchange",h)}},[Q,V,D,E]),n7.useEffect(()=>{if(!Q)return;function h(r,$0=!0){let K0=sq(k.current,"close",D.pointerType);if(K0)D.openChangeTimeout.start(K0,()=>{L.setOpen(!1,l0(T0.triggerHover,r)),M?.events.emit("floating.closed",r)});else if($0)D.openChangeTimeout.clear(),L.setOpen(!1,l0(T0.triggerHover,r)),M?.events.emit("floating.closed",r)}let p=K.current??(H?L.select("domReferenceElement"):null);if(!F1(p))return;function e(r){if(D.openChangeTimeout.clear(),D.blockMouseMove=!1,X&&!l7(D.pointerType))return;let $0=kL(I.current),K0=sq(k.current,"open",D.pointerType),t=w5(r),H0=r.currentTarget??null,z0=L.select("domReferenceElement"),j=H0;if(F1(t)&&!L.context.triggerElements.hasElement(t)){for(let G0 of L.context.triggerElements.elements())if(e0(G0,t)){j=G0;break}}if(F1(H0)&&F1(z0)&&!L.context.triggerElements.hasElement(H0)&&e0(H0,z0))j=z0;let d=j==null?!1:x(z0,j,t),m=L.select("open"),s=w.current?.()??L.select("transitionStatus")==="ending",u=!m&&s&&N.current,c=!d&&F1(j)&&F1(z0)&&e0(z0,j)&&u,i=$0>0&&!K0,f=d&&(m||u)||c,o=!m||d;if(f){if(y())L.setOpen(!0,l0(T0.triggerHover,r,j));return}if(i)return;if(K0)D.openChangeTimeout.start(K0,()=>{if(o&&y())L.setOpen(!0,l0(T0.triggerHover,r,j))});else if(o){if(y())L.setOpen(!0,l0(T0.triggerHover,r,j))}}function S(r){if(C()){P();return}E();let $0=L.select("domReferenceElement"),K0=Y1($0);D.restTimeout.clear(),D.restTimeoutPending=!1;let t=F.current.floatingContext??B?.();if(p7(r.relatedTarget,L.context.triggerElements))return;if(O.current&&t){if(!L.select("open"))D.openChangeTimeout.clear();let z0=K.current;D.handler=O.current({...t,tree:M,x:r.clientX,y:r.clientY,onClose(){if(P(),E(),b.current&&!C()&&z0===L.select("domReferenceElement"))h(r,!0)}}),K0.addEventListener("mousemove",D.handler),D.handler(r);return}if(D.pointerType==="touch"?!e0(L.select("floatingElement"),r.relatedTarget):!0)h(r)}if(z)return I8(U1(p,"mousemove",e,{once:!0}),U1(p,"mouseenter",e),U1(p,"mouseleave",S));return I8(U1(p,"mouseenter",e),U1(p,"mouseleave",S))},[E,P,F,k,L,Q,O,D,H,x,C,X,z,I,K,M,b,B,w,y]),n7.useMemo(()=>{if(!Q)return;function h(p){D.pointerType=p.pointerType}return{onPointerDown:h,onPointerEnter:h,onMouseMove(p){let{nativeEvent:e}=p,S=p.currentTarget,r=L.select("domReferenceElement"),$0=L.select("open"),K0=x(r,S,p.target);if(X&&!l7(D.pointerType))return;if($0&&K0&&D.handleCloseOptions?.blockPointerEvents){let z0=L.select("floatingElement");if(z0){let j=D.handleCloseOptions?.getScope?.()??S.ownerDocument.body;LG(D,{scopeElement:j,referenceElement:S,floatingElement:z0})}}let t=kL(I.current);if($0&&!K0||t===0)return;if(!K0&&D.restTimeoutPending&&p.movementX**2+p.movementY**2<2)return;D.restTimeout.clear();function H0(){if(D.restTimeoutPending=!1,C())return;let z0=L.select("open");if(!D.blockMouseMove&&(!z0||K0)&&y())L.setOpen(!0,l0(T0.triggerHover,e,S))}if(D.pointerType==="touch")AP.flushSync(()=>{H0()});else if(K0&&$0)H0();else D.restTimeoutPending=!0,D.restTimeout.start(t,H0)}}},[Q,D,C,x,X,L,I,y])}var f8=R(v(),1);var Tn="Escape";function DG($,J,Q){switch($){case"vertical":return J;case"horizontal":return Q;default:return J||Q}}function MG($,J){return DG(J,$===m_||$===dK,$===Rq||$===Cq)}function TL($,J,Q){return DG(J,$===dK,Q?$===Rq:$===Cq)||$==="Enter"||$===" "||$===""}function bn($,J,Q){return DG(J,Q?$===Rq:$===Cq,$===dK)}function jn($,J,Q,Z){let q=Q?$===Cq:$===Rq,X=$===m_;if(J==="both"||J==="horizontal"&&Z)return $===Tn;return DG(J,q,X)}function bL($,J){let{listRef:Q,activeIndex:Z,onNavigate:q=()=>{},enabled:X=!0,selectedIndex:Y=null,allowEscape:z=!1,loopFocus:K=!1,nested:W=!1,rtl:H=!1,virtual:B=!1,focusItemOnOpen:U="auto",focusItemOnHover:_=!0,openOnArrowKeyDown:L=!0,disabledIndices:F=void 0,orientation:V="vertical",parentOrientation:M,id:D,resetOnPointerLeave:N=!0,externalTree:O,grid:k}=J,I=k!=null,b="rootStore"in $?$.rootStore:$,A=b.useState("open"),w=b.useState("floatingElement"),C=b.useState("domReferenceElement"),y=b.context.dataRef,x=hq(w),E=Sq(C),P=L5(x),h=x8(),p=d8(O),e=f8.useRef(U),S=f8.useRef(Y??-1),r=f8.useRef(null),$0=f8.useRef(!0),K0=v0((g)=>{q(S.current===-1?null:S.current,g)}),t=f8.useRef(!!w),H0=f8.useRef(A),z0=f8.useRef(!1),j=f8.useRef(!1),d=f8.useRef(null),m=L5(F),s=L5(A),u=L5(Y),c=L5(N),i=S6(),f=S6(),o=v0(()=>{function g(F0){if(B)p?.events.emit("virtualfocus",F0);else d.current=GQ(F0,{sync:z0.current,preventScroll:!0})}let a=Q.current[S.current],I0=j.current;if(a)g(a);(z0.current?(F0)=>F0():(F0)=>i.request(F0))(()=>{let F0=Q.current[S.current]||a;if(!F0)return;if(!a)g(F0);if(W0&&(I0||!$0.current))F0.scrollIntoView?.({block:"nearest",inline:"nearest"})})});P0(()=>{y.current.orientation=V},[y,V]),P0(()=>{if(!X)return;if(A&&w){if(S.current=Y??-1,e.current&&Y!=null)j.current=!0,K0()}else if(t.current)S.current=-1,K0()},[X,A,w,Y,K0]),P0(()=>{if(!X)return;if(!A){z0.current=!1;return}if(!w)return;if(Z==null){if(z0.current=!1,u.current!=null)return;if(t.current)S.current=-1,o();if((!H0.current||!t.current)&&e.current&&(r.current!=null||e.current===!0&&r.current==null)){let g=0,a=()=>{if(Q.current[0]==null){if(g<2)(g?(A0)=>f.request(A0):queueMicrotask)(a);g+=1}else S.current=r.current==null||TL(r.current,V,H)||W?rK(Q):p_(Q),r.current=null,K0()};a()}}else if(!d_(Q.current,Z))S.current=Z,o(),j.current=!1},[X,A,w,Z,u,W,Q,V,H,K0,o,f]),P0(()=>{if(!X||w||!p||B||!t.current)return;let g=p.nodesRef.current,a=g.find((F0)=>F0.id===h)?.context?.elements.floating,I0=v5(Y1(C??a??null)),A0=g.some((F0)=>F0.context&&e0(F0.context.elements.floating,I0));if(a&&!A0&&$0.current)a.focus({preventScroll:!0})},[X,w,C,p,h,B]),P0(()=>{H0.current=A,t.current=!!w}),P0(()=>{if(!A)r.current=null,e.current=U},[A,U]);let G0=Z!=null,l=v0((g)=>{if(!s.current)return;let a=Q.current.indexOf(g.currentTarget);if(a!==-1&&(S.current!==a||Z!==a))S.current=a,K0(g)}),Z0=v0(()=>{return M??p?.nodesRef.current.find((g)=>g.id===h)?.context?.dataRef?.current.orientation}),Q0=v0(()=>{return rK(Q,m.current)}),B0=v0((g)=>{if($0.current=!1,z0.current=!0,g.which===229)return;if(!s.current&&g.currentTarget===P.current)return;if(W&&jn(g.key,V,H,I)){if(!MG(g.key,Z0()))q6(g);if(b.setOpen(!1,l0(T0.listNavigation,g.nativeEvent)),y1(C))if(B)p?.events.emit("virtualfocus",C);else C.focus();return}let a=S.current,I0=rK(Q,F),A0=p_(Q,F);if(!E){if(g.key==="Home")q6(g),S.current=I0,K0(g);if(g.key==="End")q6(g),S.current=A0,K0(g)}if(k!=null){let F0=k(g,S.current,Q,V,K,H,F,I0,A0);if(F0!=null)S.current=F0,K0(g);if(V==="both")return}if(MG(g.key,V)){if(q6(g),A&&!B&&v5(g.currentTarget.ownerDocument)===g.currentTarget){S.current=TL(g.key,V,H)?I0:A0,K0(g);return}if(TL(g.key,V,H))if(K)if(a>=A0)if(z&&a!==Q.current.length)S.current=-1;else z0.current=!1,S.current=I0;else S.current=_$(Q.current,{startingIndex:a,disabledIndices:F});else S.current=Math.min(A0,_$(Q.current,{startingIndex:a,disabledIndices:F}));else if(K)if(a<=I0)if(z&&a!==-1)S.current=Q.current.length;else z0.current=!1,S.current=A0;else S.current=_$(Q.current,{startingIndex:a,decrement:!0,disabledIndices:F});else S.current=Math.max(I0,_$(Q.current,{startingIndex:a,decrement:!0,disabledIndices:F}));if(d_(Q.current,S.current))S.current=-1;K0(g)}}),W0=f8.useMemo(()=>{return{onFocus(a){z0.current=!0,l(a)},onClick:({currentTarget:a})=>a.focus({preventScroll:!0}),onMouseMove(a){if(z0.current=!0,j.current=!1,_)l(a)},onPointerLeave(a){if(!s.current||!$0.current||a.pointerType==="touch")return;z0.current=!0;let I0=a.relatedTarget;if(!_||Q.current.includes(I0))return;if(!c.current)return;if(d.current?.(),d.current=null,S.current=-1,K0(a),!B){let A0=P.current,F0=v5(Y1(A0));if(A0&&e0(A0,F0))A0.focus({preventScroll:!0})}}}},[l,s,P,_,Q,K0,c,B]),L0=f8.useMemo(()=>{return B&&A&&G0&&{"aria-activedescendant":`${D}-${Z}`}},[B,A,G0,D,Z]),_0=f8.useMemo(()=>{return{"aria-orientation":V==="both"?void 0:V,...!E?L0:{},onKeyDown(g){if(g.key==="Tab"&&g.shiftKey&&A&&!B){let a=w5(g.nativeEvent);if(a&&!e0(P.current,a))return;if(q6(g),b.setOpen(!1,l0(T0.focusOut,g.nativeEvent)),y1(C))C.focus();return}B0(g)},onPointerMove(){$0.current=!0}}},[L0,B0,P,V,E,b,A,B,C]),N0=f8.useMemo(()=>{function g(A0){b.setOpen(!0,l0(T0.listNavigation,A0.nativeEvent,A0.currentTarget))}function a(A0){if(U==="auto"&&lK(A0.nativeEvent))e.current=!B}function I0(A0){if(e.current=U,U==="auto"&&iK(A0.nativeEvent))e.current=!0}return{onKeyDown(A0){let F0=b.select("open");$0.current=!1;let m0=A0.key.startsWith("Arrow"),R0=bn(A0.key,Z0(),H),n0=MG(A0.key,V),C0=(W?R0:n0)||A0.key==="Enter"||A0.key.trim()==="";if(B&&F0)return B0(A0);if(!F0&&!L&&m0)return;if(C0){let z1=MG(A0.key,Z0());r.current=W&&z1?null:A0.key}if(W){if(R0)if(q6(A0),F0)S.current=Q0(),K0(A0);else g(A0);return}if(n0){if(u.current!=null)S.current=u.current;if(q6(A0),!F0&&L)g(A0);else B0(A0);if(F0)K0(A0)}return},onFocus(A0){if(b.select("open")&&!B)S.current=-1,K0(A0)},onPointerDown:I0,onPointerEnter:I0,onMouseDown:a,onClick:a}},[B0,U,Q0,W,K0,b,L,V,Z0,H,u,B]),d0=f8.useMemo(()=>{return{...L0,...N0}},[L0,N0]);return f8.useMemo(()=>X?{reference:d0,floating:_0,item:W0,trigger:N0}:{},[X,d0,_0,N0,W0])}var w$=R(v(),1);function jL($,J){let{listRef:Q,elementsRef:Z,activeIndex:q,onMatch:X,disabledIndices:Y,onTyping:z,enabled:K=!0,resetMs:W=750,selectedIndex:H=null}=J,B="rootStore"in $?$.rootStore:$,U=B.useState("open"),_=U5(),L=w$.useRef(""),F=w$.useRef(H??q??-1),V=w$.useRef(null),M=v0((O)=>{function k(P){let h=Z?.current[P];return!h||L$(h)}function I(P){if(!k(P))return!1;return Y==null||!l_(W$,P,Y)}function b(P,h,p=0){if(P.length===0)return-1;let e=(p%P.length+P.length)%P.length,S=h.toLowerCase();for(let r=0;r0&&O.key===" ")q6(O),z?.(!0);if(L.current.length>0&&L.current[0]!==" "){if(b(A,L.current)===-1&&O.key!==" ")z?.(!1)}if(A==null||O.key.length!==1||O.ctrlKey||O.metaKey||O.altKey)return;if(U&&O.key!==" ")q6(O),z?.(!0);let w=L.current==="";if(w)F.current=H??q??-1;if(A.every((P,h)=>P&&I(h)?P[0]?.toLowerCase()!==P[1]?.toLowerCase():!0)&&L.current===O.key)L.current="",F.current=V.current;L.current+=O.key,_.start(W,()=>{L.current="",F.current=V.current,z?.(!1)});let x=((w?H??q??-1:F.current)??0)+1,E=b(A,L.current,x);if(E!==-1)X?.(E),V.current=E;else if(O.key!==" ")L.current="",z?.(!1)}),D=v0((O)=>{let k=O.relatedTarget,I=B.select("domReferenceElement"),b=B.select("floatingElement");if(e0(I,k)||e0(b,k))return;_.clear(),L.current="",F.current=V.current,z?.(!1)});P0(()=>{if(!U&&H!==null)return;if(_.clear(),V.current=null,L.current!=="")L.current=""},[U,H,_]),P0(()=>{if(U&&L.current==="")F.current=H??q??-1},[U,H,q]);let N=w$.useMemo(()=>({onKeyDown:M,onBlur:D}),[M,D]);return w$.useMemo(()=>K?{reference:N,floating:N}:{},[K,N])}var wP=0.1,En=wP*wP,H5=0.5;function NG($,J,Q,Z,q,X){return Z>=J!==X>=J&&$<=(q-Q)*(J-Z)/(X-Z)+Q}function OG($,J,Q,Z,q,X,Y,z,K,W){let H=!1;if(NG($,J,Q,Z,q,X))H=!H;if(NG($,J,q,X,Y,z))H=!H;if(NG($,J,Y,z,K,W))H=!H;if(NG($,J,K,W,Q,Z))H=!H;return H}function yn($,J,Q){return $>=Q.x&&$<=Q.x+Q.width&&J>=Q.y&&J<=Q.y+Q.height}function AG($,J,Q,Z,q,X){let Y=Math.min(Q,q),z=Math.max(Q,q),K=Math.min(Z,X),W=Math.max(Z,X);return $>=Y&&$<=z&&J>=K&&J<=W}function k$($={}){let{blockPointerEvents:J=!1}=$,Q=new T8,Z=({x:q,y:X,placement:Y,elements:z,onClose:K,nodeId:W,tree:H})=>{let B=Y?.split("-")[0],U=!1,_=null,L=null,F=typeof performance<"u"?performance.now():0;function V(D,N){let O=performance.now(),k=O-F;if(_===null||L===null||k===0)return _=D,L=N,F=O,!1;let I=D-_,b=N-L,A=I*I+b*b,w=k*k*En;return _=D,L=N,F=O,A0)}function E(){if(!x())M()}if(x())return;let P=O.getBoundingClientRect(),h=k.getBoundingClientRect(),p=q>h.right-h.width/2,e=X>h.bottom-h.height/2,S=h.width>P.width,r=h.height>P.height,$0=(S?P:h).left,K0=(S?P:h).right,t=(r?P:h).top,H0=(r?P:h).bottom;if(B==="top"&&X>=P.bottom-1||B==="bottom"&&X<=P.top+1||B==="left"&&q>=P.right-1||B==="right"&&q<=P.left+1){E();return}let z0=!1;switch(B){case"top":z0=AG(I,b,$0,P.top+1,K0,h.bottom-1);break;case"bottom":z0=AG(I,b,$0,h.top+1,K0,P.bottom-1);break;case"left":z0=AG(I,b,h.right-1,H0,P.left+1,t);break;case"right":z0=AG(I,b,P.right-1,H0,h.left+1,t);break;default:}if(z0)return;if(U&&!yn(I,b,P)){E();return}if(!w&&V(I,b)){E();return}let j=!1;switch(B){case"top":{let d=S?H5/2:H5*4,m=S?q+d:p?q+d:q-d,s=S?q-d:p?q+d:q-d,u=X+H5+1,c=p?h.bottom-H5:S?h.bottom-H5:h.top,i=p?S?h.bottom-H5:h.top:h.bottom-H5;j=OG(I,b,m,u,s,u,h.left,c,h.right,i);break}case"bottom":{let d=S?H5/2:H5*4,m=S?q+d:p?q+d:q-d,s=S?q-d:p?q+d:q-d,u=X-H5,c=p?h.top+H5:S?h.top+H5:h.bottom,i=p?S?h.top+H5:h.bottom:h.top+H5;j=OG(I,b,m,u,s,u,h.left,c,h.right,i);break}case"left":{let d=r?H5/2:H5*4,m=r?X+d:e?X+d:X-d,s=r?X-d:e?X+d:X-d,u=q+H5+1,c=e?h.right-H5:r?h.right-H5:h.left,i=e?r?h.right-H5:h.left:h.right-H5;j=OG(I,b,c,h.top,i,h.bottom,u,m,u,s);break}case"right":{let d=r?H5/2:H5*4,m=r?X+d:e?X+d:X-d,s=r?X-d:e?X+d:X-d,u=q-H5,c=e?h.left+H5:r?h.left+H5:h.right,i=e?r?h.left+H5:h.right:h.left+H5;j=OG(I,b,u,m,u,s,c,h.top,i,h.bottom);break}default:}if(!j)E();else if(!U)Q.start(40,E);return}};return Z.__options={...$,blockPointerEvents:J},Z}var wG=R(v(),1),EL=wG.createContext(void 0);function S5($){let J=wG.useContext(EL);if(J===void 0&&!$)throw Error(V1(47));return J}var a7=R(v(),1),kP=R(J5(),1);function Pn(){return{...BG(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}var Rn={...UG,disabled:$1(($)=>$.disabled),instantType:$1(($)=>$.instantType),openMethod:$1(($)=>$.openMethod),openChangeReason:$1(($)=>$.openChangeReason),modal:$1(($)=>$.modal),focusManagerModal:$1(($)=>$.focusManagerModal),stickIfOpen:$1(($)=>$.stickIfOpen),titleElementId:$1(($)=>$.titleElementId),descriptionElementId:$1(($)=>$.descriptionElementId),openOnHover:$1(($)=>$.openOnHover),closeDelay:$1(($)=>$.closeDelay),hasViewport:$1(($)=>$.hasViewport)};class LQ extends N${constructor($,J,Q=!1){let Z={...Pn(),...$},q=new J7;if(Z.open&&$?.mounted===void 0)Z.mounted=!0;Z.floatingRootContext=MP(q,J,Q);super(Z,{popupRef:a7.createRef(),backdropRef:a7.createRef(),internalBackdropRef:a7.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:a7.createRef(),beforeContentFocusGuardRef:a7.createRef(),stickIfOpenTimeout:new T8,triggerElements:q},Rn)}setOpen=($,J)=>{let Q=J.reason===T0.triggerHover,Z=J.reason===T0.triggerPress&&J.event.detail===0,q=!$&&(J.reason===T0.escapeKey||J.reason==null),X=YG(J),Y=this.select("activeTriggerId");if(!$&&J.reason===T0.closePress&&J.trigger==null&&Y!=null)J.trigger=this.context.triggerElements.getById(Y)??this.select("activeTriggerElement")??void 0;if(this.context.onOpenChange?.($,J),J.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange($,J);let z=()=>{let K={open:$,openChangeReason:J.reason};XG(K,$,J.trigger,X()),this.update(K)};if(Q)this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(eK,()=>{this.set("stickIfOpen",!1)}),kP.flushSync(z);else z();if(Z||q)this.set("instantType",Z?"click":"dismiss");else if(J.reason===T0.focusOut)this.set("instantType","focus");else this.set("instantType",void 0)};static useStore($,J){let{store:Q,internalStore:Z}=_P($,(q,X)=>new LQ(J,q,X));return a7.useEffect(()=>Z?.disposeEffect(),[Z]),Q}disposeEffect=()=>{return this.context.stickIfOpenTimeout.disposeEffect()}}function IP({props:$}){let{children:J,open:Q,defaultOpen:Z=!1,onOpenChange:q,onOpenChangeComplete:X,modal:Y=!1,handle:z,triggerId:K,defaultTriggerId:W=null}=$,H=LQ.useStore(z?.store,{modal:Y,open:Z,openProp:Q,activeTriggerId:W,triggerIdProp:K});zG(H,Q,Z,W),H.useControlledProp("openProp",Q),H.useControlledProp("triggerIdProp",K);let B=H.useState("open"),U=H.useState("mounted"),_=H.useState("payload"),L=x8()!=null;H.useContextCallback("onOpenChange",q),H.useContextCallback("onOpenChangeComplete",X),LP(H,B),GG(H);let{forceUnmount:F}=WG(B,H,()=>{H.update({stickIfOpen:!0,openChangeReason:null})});H.useSyncedValues({modal:Y,nested:L}),Q7.useEffect(()=>{if(!B)H.context.stickIfOpenTimeout.clear()},[H,B]);let V=Q7.useCallback(()=>{H.setOpen(!1,l0(T0.imperativeAction))},[H]);Q7.useImperativeHandle($.actionsRef,()=>({unmount:F,close:V}),[F,V]);let M=B||U,D=Q7.useMemo(()=>({store:H}),[H]);return T(EL.Provider,{value:D,children:[M&&G(Cn,{store:H,modal:Y}),typeof J==="function"?J({payload:_}):J]})}function TP($){if(S5(!0))return G(IP,{props:$});return G(cq,{children:G(IP,{props:$})})}function Cn({store:$,modal:J}){let Q=$.useState("floatingRootContext"),Z=lq(Q,{outsidePressEvent:{mouse:J==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),q=Z.reference??k1,X=Z.trigger??k1,Y=Q7.useMemo(()=>h8(UQ,Z.floating),[Z.floating]);return HG($,{activeTriggerProps:q,inactiveTriggerProps:X,popupProps:Y}),null}var t7=R(v(),1);var VQ=R(v(),1);var kG=R(v(),1),Sn=kG.createContext(void 0);function FQ($=!1){let J=kG.useContext(Sn);if(J===void 0&&!$)throw Error(V1(16));return J}var bP=R(v(),1);function jP($){let{focusableWhenDisabled:J,disabled:Q,composite:Z=!1,tabIndex:q=0,isNativeButton:X}=$,Y=Z&&J!==!1,z=Z&&J===!1;return{props:bP.useMemo(()=>{let W={onKeyDown(H){if(Q&&J&&H.key!=="Tab")H.preventDefault()}};if(!Z){if(W.tabIndex=q,!X&&Q)W.tabIndex=J?q:-1}if(X&&(J||Y)||!X&&Q)W["aria-disabled"]=Q;if(X&&(!J||z))W.disabled=Q;return W},[Z,Q,J,Y,z,X,q])}}function x6($={}){let{disabled:J=!1,focusableWhenDisabled:Q,tabIndex:Z=0,native:q=!0,composite:X}=$,Y=VQ.useRef(null),z=FQ(!0),K=X??z!==void 0,{props:W}=jP({focusableWhenDisabled:Q,disabled:J,composite:K,tabIndex:Z,isNativeButton:q}),H=VQ.useCallback(()=>{let _=Y.current;if(!yL(_))return;if(K&&J&&W.disabled===void 0&&_.disabled)_.disabled=!1},[J,W.disabled,K]);P0(H,[H]);let B=VQ.useCallback((_={})=>{let{onClick:L,onMouseDown:F,onKeyUp:V,onKeyDown:M,onPointerDown:D,...N}=_;return h8({onClick(O){if(J){O.preventDefault();return}L?.(O)},onMouseDown(O){if(!J)F?.(O)},onKeyDown(O){if(J)return;if(gq(O),M?.(O),O.baseUIHandlerPrevented)return;let k=O.target===O.currentTarget,I=O.currentTarget,b=yL(I),A=!q&&hn(I),w=k&&(q?b:!A),C=O.key==="Enter",y=O.key===" ",x=I.getAttribute("role"),E=x?.startsWith("menuitem")||x==="option"||x==="gridcell";if(k&&K&&y){if(O.defaultPrevented&&E)return;if(O.preventDefault(),A||q&&b)I.click(),O.preventBaseUIHandler();else if(w)L?.(O),O.preventBaseUIHandler();return}if(w){if(!q&&(y||C))O.preventDefault();if(!q&&C)L?.(O)}},onKeyUp(O){if(J)return;if(gq(O),V?.(O),O.target===O.currentTarget&&q&&K&&yL(O.currentTarget)&&O.key===" "){O.preventDefault();return}if(O.baseUIHandlerPrevented)return;if(O.target===O.currentTarget&&!q&&!K&&O.key===" ")L?.(O)},onPointerDown(O){if(J){O.preventDefault();return}D?.(O)}},q?{type:"button"}:{role:"button"},W,N)},[J,W,K,q]),U=v0((_)=>{Y.current=_,H()});return{getButtonProps:B,buttonRef:U}}function yL($){return y1($)&&$.tagName==="BUTTON"}function hn($){return Boolean($?.tagName==="A"&&$?.href)}var RL=function($){return $.open="data-open",$.closed="data-closed",$[$.startingStyle=O$.startingStyle]="startingStyle",$[$.endingStyle=O$.endingStyle]="endingStyle",$.anchorHidden="data-anchor-hidden",$.side="data-side",$.align="data-align",$}({}),PL=function($){return $.popupOpen="data-popup-open",$.pressed="data-pressed",$}({}),xn={[PL.popupOpen]:""},fn={[PL.popupOpen]:"",[PL.pressed]:""},vn={[RL.open]:""},gn={[RL.closed]:""},un={[RL.anchorHidden]:""},IG={open($){if($)return xn;return null}},nq={open($){if($)return fn;return null}},w6={open($){if($)return vn;return gn},anchorHidden($){if($)return un;return null}};var EP=300;function h5($){return h6($,"base-ui")}var yP=R(v(),1),CL=R(J5(),1);function TG($,J){let Q=yP.useRef(null);function Z(X){CL.flushSync(()=>{$.setOpen(!1,l0(T0.focusOut,X.nativeEvent,X.currentTarget))}),Iy(Q.current)?.focus()}function q(X){let Y=$.select("positionerElement");if(Y&&t4(X,Y))$.context.beforeContentFocusGuardRef.current?.focus();else{CL.flushSync(()=>{$.setOpen(!1,l0(T0.focusOut,X.nativeEvent,X.currentTarget))});let z=ky($.context.triggerFocusTargetRef.current||J.current);while(z!==null&&e0(Y,z)){let K=z;if(z=KQ(z),z===K)break}z?.focus()}}return{preFocusGuardRef:Q,handlePreFocusGuardFocus:Z,handleFocusTargetFocus:q}}var tq=R(v(),1);var aq=R(v(),1);function PP($){let J=aq.useRef(""),Q=aq.useCallback((q)=>{if(q.defaultPrevented)return;J.current=q.pointerType,$(q,q.pointerType)},[$]);return{onClick:aq.useCallback((q)=>{if(q.detail===0){$(q,"keyboard");return}if("pointerType"in q)$(q,q.pointerType);else $(q,J.current);J.current=""},[$]),onPointerDown:Q}}var RP=R(v(),1);function bG($,J){let Q=RP.useRef($),Z=v0(J);P0(()=>{if(Q.current===$)return;Z(Q.current)},[$,Z]),P0(()=>{Q.current=$},[$])}function SL($,J){let Q=v0((X,Y)=>{if(!(typeof $==="function"?$():$))J(Y||(p1.os.ios?"touch":""))}),{onClick:Z,onPointerDown:q}=PP(Q);return tq.useMemo(()=>({onClick:Z,onPointerDown:q}),[Z,q])}function CP($){let[J,Q]=tq.useState(null),Z=SL($,Q);return bG($,(q)=>{if(q&&!$)Q(null)}),tq.useMemo(()=>({openMethod:J,triggerProps:Z}),[J,Z])}var SP=t7.forwardRef(function(J,Q){let{render:Z,className:q,style:X,disabled:Y=!1,nativeButton:z=!0,handle:K,payload:W,openOnHover:H=!1,delay:B=EP,closeDelay:U=0,id:_,...L}=J,F=S5(!0),V=K?.store??F?.store;if(!V)throw Error(V1(74));let M=h5(_),D=V.useState("isTriggerActive",M),N=V.useState("floatingRootContext"),O=V.useState("isOpenedByTrigger",M),k=V.useState("triggerPopupId",M),I=t7.useRef(null),{registerTrigger:b,isMountedByThisTrigger:A}=KG(M,I,V,{payload:W,disabled:Y,openOnHover:H,closeDelay:U}),w=V.useState("openChangeReason"),C=V.useState("stickIfOpen"),y=V.useState("openMethod"),x=V.useState("focusManagerModal"),E=A$(N,{enabled:!Y&&N!=null&&H&&(y!=="touch"||w!==T0.triggerPress),mouseOnly:!0,move:!1,handleClose:k$(),restMs:B,delay:{close:U},triggerElementRef:I,isActiveTrigger:D,isClosing:()=>V.select("transitionStatus")==="ending"}),P=M$(N,{enabled:N!=null,stickIfOpen:C}),h=SL(()=>V.select("open"),(j)=>{V.set("openMethod",j)}),p=V.useState("triggerProps",A),{getButtonProps:e,buttonRef:S}=x6({disabled:Y,native:z}),r={open(j){if(j&&w===T0.triggerPress)return nq.open(j);return IG.open(j)}},{preFocusGuardRef:$0,handlePreFocusGuardFocus:K0,handleFocusTargetFocus:t}=TG(V,I),z0=o0("button",J,{state:{disabled:Y,open:O},ref:[S,Q,b,I],props:[P.reference,E,p,h,{[$G]:"",id:M,"aria-haspopup":"dialog","aria-expanded":O,"aria-controls":k},L,e],stateAttributesMapping:r});if(A&&!x)return T(t7.Fragment,{children:[G(F9,{ref:$0,onFocus:K0}),G(t7.Fragment,{children:z0},M),G(F9,{ref:V.context.triggerFocusTargetRef,onFocus:t})]});return G(t7.Fragment,{children:z0},M)});var xP=R(v(),1);var jG=R(v(),1),hL=jG.createContext(void 0);function hP(){let $=jG.useContext(hL);if($===void 0)throw Error(V1(45));return $}var fP=xP.forwardRef(function(J,Q){let{keepMounted:Z=!1,...q}=J,{store:X}=S5();if(!(X.useState("mounted")||Z))return null;return G(hL.Provider,{value:Z,children:G(uq,{ref:Q,...q})})});var OQ=R(v(),1);function MQ($){if(WQ(19))return $;return $?"true":void 0}var EG=R(v(),1),xL=EG.createContext(void 0);function DQ(){let $=EG.useContext(xL);if(!$)throw Error(V1(46));return $}var f6=R(v(),1);var yG=R(v(),1),mn=yG.createContext(void 0);function e7(){return yG.useContext(mn)?.direction??"ltr"}var cn=($)=>({name:"arrow",options:$,async fn(J){let{x:Q,y:Z,placement:q,rects:X,platform:Y,elements:z,middlewareData:K}=J,{element:W,padding:H=0,offsetParent:B="real"}=m6($,J)||{};if(W==null)return{};let U=mQ(H),_={x:Q,y:Z},L=d$(q),F=c$(L),V=await Y.getDimensions(W),M=L==="y",D=M?"top":"left",N=M?"bottom":"right",O=M?"clientHeight":"clientWidth",k=X.reference[F]+X.reference[L]-_[L]-X.floating[F],I=_[L]-X.reference[L],b=B==="real"?await Y.getOffsetParent?.(W):z.floating,A=z.floating[O]||X.floating[F];if(!A||!await Y.isElement?.(b))A=z.floating[O]||X.floating[F];let w=k/2-I/2,C=A/2-V[F]/2-1,y=Math.min(U[D],C),x=Math.min(U[N],C),E=y,P=A-V[F]-x,h=A/2-V[F]/2+w,p=m$(E,h,P),e=!K.arrow&&c6(q)!=null&&h!==p&&X.reference[F]/2-(h({...cn($),options:[$,J]});var dn=oQ().fn,gP={name:"hide",async fn($){let{width:J,height:Q,x:Z,y:q}=$.rects.reference,X=J===0&&Q===0&&Z===0&&q===0;return{data:{referenceHidden:(await dn($)).data?.referenceHidden||X}}}};var eq={sideX:"left",sideY:"top"},PG={name:"adaptiveOrigin",async fn($){let{x:J,y:Q,rects:{floating:Z},elements:{floating:q},platform:X,strategy:Y,placement:z}=$,K=h1(q),W=K.getComputedStyle(q);if(!(W.transitionDuration!=="0s"&&W.transitionDuration!==""))return{x:J,y:Q,data:eq};let B=await X.getOffsetParent?.(q),U={width:0,height:0};if(Y==="fixed"&&K?.visualViewport)U={width:K.visualViewport.width,height:K.visualViewport.height};else if(B===K){let D=Y1(q);U={width:D.documentElement.clientWidth,height:D.documentElement.clientHeight}}else if(await X.isElement?.(B))U=await X.getDimensions(B);let _=E8(z),L=J,F=Q;if(_==="left")L=U.width-(J+Z.width);if(_==="top")F=U.height-(Q+Z.height);let V=_==="left"?"right":eq.sideX,M=_==="top"?"bottom":eq.sideY;return{x:L,y:F,data:{sideX:V,sideY:M}}}};function cP($,J,Q){let Z=$==="inline-start"||$==="inline-end";return{top:"top",right:Z?Q?"inline-start":"inline-end":"right",bottom:"bottom",left:Z?Q?"inline-end":"inline-start":"left"}[J]}function uP($,J,Q){let{rects:Z,placement:q}=$;return{side:cP(J,E8(q),Q),align:c6(q)||"center",anchor:{width:Z.reference.width,height:Z.reference.height},positioner:{width:Z.floating.width,height:Z.floating.height}}}function RG($){let{anchor:J,positionMethod:Q="absolute",side:Z="bottom",sideOffset:q=0,align:X="center",alignOffset:Y=0,collisionBoundary:z,collisionPadding:K=5,sticky:W=!1,arrowPadding:H=5,disableAnchorTracking:B=!1,inline:U,keepMounted:_=!1,floatingRootContext:L,mounted:F,collisionAvoidance:V,shiftCrossAxis:M=!1,nodeId:D,adaptiveOrigin:N,lazyFlip:O=!1,externalTree:k}=$,[I,b]=f6.useState(null);if(!F&&I!==null)b(null);let A=V.side||"flip",w=V.align||"flip",C=V.fallbackAxisSide||"end",y=typeof J==="function"?J:void 0,x=v0(y),E=y?x:J,P=L5(J),h=L5(F),e=e7()==="rtl",S=I||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":e?"left":"right","inline-start":e?"right":"left"}[Z],r=X==="center"?S:`${S}-${X}`,$0=K,K0=1,t=Z==="bottom"?K0:0,H0=Z==="top"?K0:0,z0=Z==="right"?K0:0,j=Z==="left"?K0:0;if(typeof $0==="number")$0={top:$0+t,right:$0+j,bottom:$0+H0,left:$0+z0};else if($0)$0={top:($0.top||0)+t,right:($0.right||0)+j,bottom:($0.bottom||0)+H0,left:($0.left||0)+z0};let d={boundary:z==="clipping-ancestors"?"clippingAncestors":z,padding:$0},m=f6.useRef(null),s=L5(q),u=L5(Y),c=typeof q!=="function"?q:0,i=typeof Y!=="function"?Y:0,f=[];if(U)f.push(U);f.push(pQ((n)=>{let D0=uP(n,Z,e),w0=typeof s.current==="function"?s.current(D0):s.current,f0=typeof u.current==="function"?u.current(D0):u.current;return{mainAxis:w0,crossAxis:f0,alignmentAxis:f0}},[c,i,e,Z]));let o=w==="none"&&A!=="shift",G0=!o&&(W||M||A==="shift"),l=A==="none"?null:rQ({...d,padding:{top:$0.top+K0,right:$0.right+K0,bottom:$0.bottom+K0,left:$0.left+K0},mainAxis:!M&&A==="flip",crossAxis:w==="flip"?"alignment":!1,fallbackAxisSideDirection:C}),Z0=o?null:lQ((n)=>{let D0=Y1(n.elements.floating).documentElement;return{...d,rootBoundary:M?{x:0,y:0,width:D0.clientWidth,height:D0.clientHeight}:void 0,mainAxis:w!=="none",crossAxis:G0,limiter:W||M?void 0:iQ((w0)=>{if(!m.current)return{};let{width:f0,height:r0}=m.current.getBoundingClientRect(),K1=z6(E8(w0.placement)),x1=K1==="y"?f0:r0,r1=K1==="y"?$0.left+$0.right:$0.top+$0.bottom;return{offset:x1/2+r1/2}})}},[d,W,M,$0,w]);if(A==="shift"||w==="shift"||X==="center")f.push(Z0,l);else f.push(l,Z0);f.push(sQ({...d,apply({elements:{floating:n},availableWidth:D0,availableHeight:w0,rects:f0}){if(!h.current)return;let r0=n.style;r0.setProperty("--available-width",`${D0}px`),r0.setProperty("--available-height",`${w0}px`);let K1=h1(n).devicePixelRatio||1,{x:x1,y:r1,width:Y0,height:y0}=f0.reference,h0=(Math.round((x1+Y0)*K1)-Math.round(x1*K1))/K1,i0=(Math.round((r1+y0)*K1)-Math.round(r1*K1))/K1;r0.setProperty("--anchor-width",`${h0}px`),r0.setProperty("--anchor-height",`${i0}px`)}}),vP((n)=>({element:m.current||Y1(n.elements.floating).createElement("div"),padding:H,offsetParent:"floating"}),[H]),{name:"transformOrigin",fn(n){let{elements:D0,middlewareData:w0,placement:f0,rects:r0,y:K1}=n,x1=E8(f0),r1=z6(x1),Y0=m.current,y0=w0.arrow?.x||0,h0=w0.arrow?.y||0,i0=Y0?.clientWidth||0,E0=Y0?.clientHeight||0,D1=y0+i0/2,u1=h0+E0/2,j1=Math.abs(w0.shift?.y||0),t1=r0.reference.height/2,M5=typeof q==="function"?q(uP(n,Z,e)):q,X0=j1>M5,O0={top:`${D1}px calc(100% + ${M5}px)`,bottom:`${D1}px ${-M5}px`,left:`calc(100% + ${M5}px) ${u1}px`,right:`${-M5}px ${u1}px`}[x1],x0=`${D1}px ${r0.reference.y+t1-K1}px`;return D0.floating.style.setProperty("--transform-origin",G0&&r1==="y"&&X0?x0:O0),{}}},gP,N),P0(()=>{if(!F&&L)L.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[F,L]);let Q0=f6.useMemo(()=>({elementResize:!B&&typeof ResizeObserver<"u",layoutShift:!B&&typeof IntersectionObserver<"u"}),[B]),{refs:B0,elements:W0,x:L0,y:_0,middlewareData:N0,update:d0,placement:g,context:a,isPositioned:I0,floatingStyles:A0}=NL({rootContext:L,open:_?F:void 0,placement:r,middleware:f,strategy:Q,whileElementsMounted:_?void 0:(...n)=>L2(...n,Q0),nodeId:D,externalTree:k}),{sideX:F0,sideY:m0}=N0.adaptiveOrigin||eq,R0=I0?Q:"fixed",n0=f6.useMemo(()=>{let n=N?{position:R0,[F0]:L0,[m0]:_0}:{position:R0,...A0};if(!I0)n.opacity=0;return n},[N,R0,F0,L0,m0,_0,A0,I0]),C0=f6.useRef(null);P0(()=>{if(!F)return;let n=P.current,D0=typeof n==="function"?n():n,f0=(mP(D0)?D0.current:D0)||null||null;if(f0!==C0.current)B0.setPositionReference(f0),C0.current=f0},[F,B0,E,P]),f6.useEffect(()=>{if(!F)return;let n=P.current;if(typeof n==="function")return;if(mP(n)&&n.current!==C0.current)B0.setPositionReference(n.current),C0.current=n.current},[F,B0,E,P]),f6.useEffect(()=>{if(_&&F&&W0.reference&&W0.floating)return L2(W0.reference,W0.floating,d0,Q0);return},[_,F,W0,d0,Q0]);let z1=E8(g),Q1=cP(Z,z1,e),a0=c6(g)||"center",R1=Boolean(N0.hide?.referenceHidden);P0(()=>{if(O&&F&&I0)b(z1)},[O,F,I0,z1]);let C1=f6.useMemo(()=>({position:"absolute",top:N0.arrow?.y,left:N0.arrow?.x}),[N0.arrow]),b1=N0.arrow?.centerOffset!==0;return f6.useMemo(()=>({positionerStyles:n0,arrowStyles:C1,arrowRef:m,arrowUncentered:b1,side:Q1,align:a0,physicalSide:z1,anchorHidden:R1,refs:B0,context:a,isPositioned:I0,update:d0}),[n0,C1,m,b1,Q1,a0,z1,R1,B0,a,I0,d0])}function mP($){return $!=null&&"current"in $}var dP=R(v(),1);var CG=dP.forwardRef(function(J,Q){let{cutout:Z,...q}=J,X;if(Z){let Y=Z.getBoundingClientRect();X=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${Y.left}px ${Y.top}px,${Y.left}px ${Y.bottom}px,${Y.right}px ${Y.bottom}px,${Y.right}px ${Y.top}px,${Y.left}px ${Y.top}px)`}return G("div",{ref:Q,role:"presentation","data-base-ui-inert":"",...q,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:X}})});function NQ($){return $==="starting"?ly:k1}function SG($,J,{styles:Q,transitionStatus:Z,props:q,refs:X,hidden:Y,inert:z=!1}){let K={...Q};if(z)K.pointerEvents="none";return o0("div",$,{state:J,ref:X,props:[{role:"presentation",hidden:Y,style:K},NQ(Z),q],stateAttributesMapping:w6})}var oP=R(v(),1);var pP={},lP={},iP="";function pn($){if(typeof document>"u")return!1;let J=Y1($);return h1(J).innerWidth-J.documentElement.clientWidth>0}function ln($){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;let Q=Y1($),Z=Q.documentElement,q=Q.body,X=r9(Z)?Z:q,Y=X.style.overflowY,z=Z.style.scrollbarGutter;Z.style.scrollbarGutter="stable",X.style.overflowY="scroll";let K=X.offsetWidth;X.style.overflowY="hidden";let W=X.offsetWidth;return X.style.overflowY=Y,Z.style.scrollbarGutter=z,K===W}function rn($){let J=Y1($),Q=J.documentElement,Z=J.body,q=r9(Q)?Q:Z,X={overflowY:q.style.overflowY,overflowX:q.style.overflowX};return Object.assign(q.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(q.style,X)}}function sn($){let J=Y1($),Q=J.documentElement,Z=J.body,q=h1(Q),X=0,Y=0,z=!1,K=L9.create();if(p1.engine.webkit&&(q.visualViewport?.scale??1)!==1)return()=>{};function W(){let _=q.getComputedStyle(Q),L=q.getComputedStyle(Z),M=(_.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";X=Q.scrollTop,Y=Q.scrollLeft,pP={scrollbarGutter:Q.style.scrollbarGutter,overflowY:Q.style.overflowY,overflowX:Q.style.overflowX},iP=Q.style.scrollBehavior,lP={position:Z.style.position,height:Z.style.height,width:Z.style.width,boxSizing:Z.style.boxSizing,overflowY:Z.style.overflowY,overflowX:Z.style.overflowX,scrollBehavior:Z.style.scrollBehavior};let D=Q.scrollHeight>Q.clientHeight,N=Q.scrollWidth>Q.clientWidth,O=_.overflowY==="scroll"||L.overflowY==="scroll",k=_.overflowX==="scroll"||L.overflowX==="scroll",I=Math.max(0,q.innerWidth-Z.clientWidth),b=Math.max(0,q.innerHeight-Z.clientHeight),A=parseFloat(L.marginTop)+parseFloat(L.marginBottom),w=parseFloat(L.marginLeft)+parseFloat(L.marginRight),C=r9(Q)?Q:Z;if(z=ln($),z){Q.style.scrollbarGutter=M,C.style.overflowY="hidden",C.style.overflowX="hidden";return}if(Object.assign(Q.style,{scrollbarGutter:M,overflowY:"hidden",overflowX:"hidden"}),D||O)Q.style.overflowY="scroll";if(N||k)Q.style.overflowX="scroll";Object.assign(Z.style,{position:"relative",height:A||b?`calc(100dvh - ${A+b}px)`:"100dvh",width:w||I?`calc(100vw - ${w+I}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),Z.scrollTop=X,Z.scrollLeft=Y,Q.setAttribute("data-base-ui-scroll-locked",""),Q.style.scrollBehavior="unset"}function H(){if(Object.assign(Q.style,pP),Object.assign(Z.style,lP),!z)Q.scrollTop=X,Q.scrollLeft=Y,Q.removeAttribute("data-base-ui-scroll-locked"),Q.style.scrollBehavior=iP}function B(){H(),K.request(W)}W();let U=U1(q,"resize",B);return()=>{if(K.cancel(),H(),typeof q.removeEventListener==="function")U()}}class rP{lockCount=0;restore=null;timeoutLock=T8.create();timeoutUnlock=T8.create();acquire($){if(this.lockCount+=1,this.lockCount===1&&this.restore===null)this.timeoutLock.start(0,()=>this.lock($));return this.release}release=()=>{if(this.lockCount-=1,this.lockCount===0&&this.restore)this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{if(this.lockCount===0&&this.restore)this.restore?.(),this.restore=null};lock($){if(this.lockCount===0||this.restore!==null)return;let Q=Y1($).documentElement,Z=h1(Q).getComputedStyle(Q).overflowY;if(Z==="hidden"||Z==="clip"){this.restore=d1;return}let q=p1.os.ios||!pn($);this.restore=q?rn($):sn($)}}var on=new rP;function sP($=!0,J=null){P0(()=>{if(!$)return;return on.acquire(J)},[$,J])}var nn=20;function hG($,J,Q,Z){let[q,X]=oP.useState(!1);P0(()=>{if(!$||!J||Q==null){X(!1);return}let Y=Y1(Q).documentElement.clientWidth,z=Q.offsetWidth;X(Y>0&&z>0&&z>=Y-nn)},[$,J,Q]),sP($&&(!J||q),Z)}var nP=OQ.forwardRef(function(J,Q){let{render:Z,className:q,style:X,anchor:Y,positionMethod:z="absolute",side:K="bottom",align:W="center",sideOffset:H=0,alignOffset:B=0,collisionBoundary:U="clipping-ancestors",collisionPadding:_=5,arrowPadding:L=5,sticky:F=!1,disableAnchorTracking:V=!1,collisionAvoidance:M=JG,...D}=J,{store:N}=S5(),O=hP(),k=V$(),I=N.useState("floatingRootContext"),b=N.useState("mounted"),A=N.useState("open"),w=N.useState("openChangeReason"),C=N.useState("activeTriggerElement"),y=N.useState("modal"),x=N.useState("openMethod"),E=N.useState("positionerElement"),P=N.useState("instantType"),h=N.useState("transitionStatus"),p=N.useState("hasViewport"),e=OQ.useRef(null),S=U4(E,!1,!1),r=RG({anchor:Y,floatingRootContext:I,positionMethod:z,mounted:b,side:K,sideOffset:H,align:W,alignOffset:B,arrowPadding:L,collisionBoundary:U,collisionPadding:_,sticky:F,disableAnchorTracking:V,keepMounted:O,nodeId:k,collisionAvoidance:M,adaptiveOrigin:p?PG:void 0}),$0=I.useState("domReferenceElement");P0(()=>{let z0=$0,j=e.current;if(z0)e.current=z0;if(j&&z0&&z0!==j){N.set("instantType",void 0);let d=new AbortController;return S(()=>{N.set("instantType","trigger-change")},d.signal),()=>{d.abort()}}return},[$0,S,N]),hG(A&&y===!0&&w!==T0.triggerHover,x==="touch",E,C);let K0=OQ.useCallback((z0)=>{N.set("positionerElement",z0)},[N]),t={open:A,side:r.side,align:r.align,anchorHidden:r.anchorHidden,instant:P},H0=SG(J,t,{styles:r.positionerStyles,transitionStatus:h,props:D,refs:[Q,K0],hidden:!b,inert:!A});return T(xL.Provider,{value:r,children:[b&&y===!0&&w!==T0.triggerHover&&G(CG,{ref:N.context.internalBackdropRef,inert:MQ(!A),cutout:C}),G(mq,{id:k,children:H0})]})});var gG=R(v(),1);var an="ArrowUp",tn="ArrowDown",en="ArrowLeft",$a="ArrowRight",Ja="Home",Qa="End";var Za=new Set([en,$a]);var qa=new Set([an,tn]);var Xa=new Set([...Za,...qa]),xG=new Set([...Xa,Ja,Qa]);var fG=R(v(),1),Ya=fG.createContext(void 0);function vG($){let J=fG.useContext(Ya);if(J===void 0&&!$)throw Error(V1(69));return J}var $2=R(v(),1);var aP=$2.createContext(void 0);function tP(){let[$,J]=$2.useState(0),Q=v0(()=>{return J((q)=>q+1),()=>{J((q)=>Math.max(0,q-1))}});return{context:$2.useMemo(()=>({register:Q}),[Q]),hasClosePart:$>0}}function eP($){let{value:J,children:Q}=$;return G(aP.Provider,{value:J,children:Q})}function $R(){let $=$2.useContext(aP);P0(()=>{return $?.register()},[$])}var za={...w6,...B4},JR=gG.forwardRef(function(J,Q){let{render:Z,className:q,style:X,initialFocus:Y,finalFocus:z,...K}=J,{store:W}=S5(),H=DQ(),B=vG(!0)!=null,{context:U,hasClosePart:_}=tP(),L=W.useState("open"),F=W.useState("openMethod"),V=W.useState("instantType"),M=W.useState("transitionStatus"),D=W.useState("popupProps"),N=W.useState("titleElementId"),O=W.useState("descriptionElementId"),k=W.useState("modal"),I=W.useState("mounted"),b=W.useState("openChangeReason"),A=W.useState("activeTriggerElement"),w=W.useState("floatingRootContext"),C=w.useState("floatingId"),y=W.useState("disabled"),x=W.useState("openOnHover"),E=W.useState("closeDelay"),P=K.id??C;_4({open:L,ref:W.context.popupRef,onComplete(){if(L)W.context.onOpenChangeComplete?.(!0)}}),oq(w,{enabled:x&&!y,closeDelay:E});let h=Y===void 0?UP(W.context.popupRef):Y,p=k!==!1&&_;W.useSyncedValue("focusManagerModal",p);let e=gG.useCallback(($0)=>{W.set("popupElement",$0)},[W]),S={open:L,side:H.side,align:H.align,instant:V,transitionStatus:M},r=o0("div",J,{state:S,ref:[Q,W.context.popupRef,e],props:[D,{id:P,role:"dialog",...UQ,"aria-labelledby":N,"aria-describedby":O,onKeyDown($0){if(B&&xG.has($0.key))$0.stopPropagation()}},NQ(M),K],stateAttributesMapping:za});return G(dq,{context:w,openInteractionType:F,modal:p,disabled:!I||b===T0.triggerHover,initialFocus:h,returnFocus:z,restoreFocus:"popup",previousFocusableElement:y1(A)?A:void 0,nextFocusableElement:W.context.triggerFocusTargetRef,beforeContentFocusGuardRef:W.context.beforeContentFocusGuardRef,children:G(eP,{value:U,children:r})})});var QR=R(v(),1);var ZR=QR.forwardRef(function(J,Q){let{render:Z,className:q,style:X,...Y}=J,{store:z}=S5(),K=z.useState("open"),{arrowRef:W,side:H,align:B,arrowUncentered:U,arrowStyles:_}=DQ();return o0("div",J,{state:{open:K,side:H,align:B,uncentered:U},ref:[Q,W],props:[{style:_,"aria-hidden":!0},Y],stateAttributesMapping:w6})});var qR=R(v(),1);var Ka={...w6,...B4},XR=qR.forwardRef(function(J,Q){let{render:Z,className:q,style:X,...Y}=J,{store:z}=S5(),K=z.useState("open"),W=z.useState("mounted"),H=z.useState("transitionStatus"),B=z.useState("openChangeReason");return o0("div",J,{state:{open:K,transitionStatus:H},ref:[z.context.backdropRef,Q],props:[{role:"presentation",hidden:!W,style:{pointerEvents:B===T0.triggerHover?"none":void 0,userSelect:"none",WebkitUserSelect:"none"}},Y],stateAttributesMapping:Ka})});var YR=R(v(),1);var zR=YR.forwardRef(function(J,Q){let{render:Z,className:q,style:X,...Y}=J,{store:z}=S5(),K=h5(Y.id);return z.useSyncedValueWithCleanup("titleElementId",K),o0("h2",J,{ref:Q,props:[{id:K},Y]})});var KR=R(v(),1);var GR=KR.forwardRef(function(J,Q){let{render:Z,className:q,style:X,...Y}=J,{store:z}=S5(),K=h5(Y.id);return z.useSyncedValueWithCleanup("descriptionElementId",K),o0("p",J,{ref:Q,props:[{id:K},Y]})});var WR=R(v(),1);var HR=WR.forwardRef(function(J,Q){let{render:Z,className:q,style:X,disabled:Y=!1,nativeButton:z=!0,...K}=J,{buttonRef:W,getButtonProps:H}=x6({disabled:Y,focusableWhenDisabled:!1,native:z}),{store:B}=S5();return $R(),o0("button",J,{ref:[Q,W],props:[{onClick(_){B.setOpen(!1,l0(T0.closePress,_.nativeEvent))}},K,H]})});var DR=R(v(),1);var BR=function($){return $.popupWidth="--popup-width",$.popupHeight="--popup-height",$}({});var i8=R(v(),1),MR=R(J5(),1);var UR=R(v(),1);function _R($){let[J,Q]=UR.useState({current:$,previous:null});if($!==J.current)Q({current:$,previous:J.current});return J.previous}var AQ=R(v(),1);function fL($){let J=d5($),Q=parseFloat(J.width)||0,Z=parseFloat(J.height)||0,q=y1($),X=q?$.offsetWidth:Q,Y=q?$.offsetHeight:Z;if(B7(Q)!==X||B7(Z)!==Y)Q=X,Z=Y;return{width:Q,height:Z}}function FR($){let{popupElement:J,positionerElement:Q,content:Z,mounted:q,onMeasureLayout:X,onMeasureLayoutComplete:Y,side:z,direction:K}=$,W=U4(J,!0,!1),H=S6(),B=AQ.useRef(null),U=AQ.useRef(!0),_=AQ.useRef(d1),L=v0(X),F=v0(Y),V=AQ.useMemo(()=>{let M=z==="top",D=z==="left";if(K==="rtl")M=M||z==="inline-end",D=D||z==="inline-end";else M=M||z==="inline-start",D=D||z==="inline-start";return M?{position:"absolute",[z==="top"?"bottom":"top"]:"0",[D?"right":"left"]:"0"}:k1},[z,K]);P0(()=>{if(!q){_.current=d1,U.current=!0,B.current=null;return}if(!J||!Q)return;_.current=LR(J,V),vL(J,"auto");let M=mG(J,"position","static"),D=mG(J,"transform","none"),N=mG(J,"scale","1"),O=LR(Q,{"--available-width":"max-content","--available-height":"max-content"});function k(){M(),D(),O()}function I(){k(),N()}if(L?.(),U.current||B.current===null){uG(Q,"max-content");let C=fL(J);return B.current=C,uG(Q,C),I(),F?.(null,C),U.current=!1,()=>{_.current(),_.current=d1}}uG(Q,"max-content");let b=B.current,A=fL(J);B.current=A,vL(J,b),I(),F?.(b,A),uG(Q,A);let w=new AbortController;return H.request(()=>{vL(J,A),W(()=>{J.style.setProperty("--popup-width","auto"),J.style.setProperty("--popup-height","auto")},w.signal)}),()=>{w.abort(),H.cancel(),_.current(),_.current=d1}},[Z,J,Q,W,H,q,L,F,V])}function mG($,J,Q){let Z=$.style.getPropertyValue(J);return $.style.setProperty(J,Q),()=>{$.style.setProperty(J,Z)}}function LR($,J){let Q=[];for(let[Z,q]of Object.entries(J))Q.push(mG($,Z,q));return Q.length?()=>{Q.forEach((Z)=>Z())}:d1}function vL($,J){let Q=J==="auto"?"auto":`${J.width}px`,Z=J==="auto"?"auto":`${J.height}px`;$.style.setProperty("--popup-width",Q),$.style.setProperty("--popup-height",Z)}function uG($,J){let Q=J==="max-content"?"max-content":`${J.width}px`,Z=J==="max-content"?"max-content":`${J.height}px`;$.style.setProperty("--positioner-width",Q),$.style.setProperty("--positioner-height",Z)}function cG($){let{store:J,side:Q,cssVars:Z,children:q}=$,X=e7(),Y=J.useState("activeTriggerElement"),z=J.useState("activeTriggerId"),K=J.useState("open"),W=J.useState("payload"),H=J.useState("mounted"),B=J.useState("popupElement"),U=J.useState("positionerElement"),_=_R(K?Y:null),L=Ha(z,W),F=i8.useRef(null),[V,M]=i8.useState(null),[D,N]=i8.useState(null),O=i8.useRef(null),k=i8.useRef(null),I=U4(O,!0,!1),b=S6(),[A,w]=i8.useState(null),[C,y]=i8.useState(!1);P0(()=>{return J.set("hasViewport",!0),()=>{J.set("hasViewport",!1)}},[J]);let x=v0(()=>{O.current?.style.setProperty("animation","none"),O.current?.style.setProperty("transition","none"),k.current?.style.setProperty("display","none")}),E=v0((S)=>{if(O.current?.style.removeProperty("animation"),O.current?.style.removeProperty("transition"),k.current?.style.removeProperty("display"),S)w(S)}),P=i8.useRef(null);P0(()=>{if(!K||!H)P.current=null},[K,H]),P0(()=>{if(Y&&_&&Y!==_&&P.current!==Y&&F.current){M(F.current),y(!0);let S=Wa(_,Y);N(S),b.request(()=>{MR.flushSync(()=>{y(!1)}),I(()=>{M(null),w(null),F.current=null})}),P.current=Y}},[Y,_,V,I,b]),P0(()=>{let S=O.current;if(!S)return;let r=Y1(S).createElement("div");for(let $0 of Array.from(S.childNodes))r.appendChild($0.cloneNode(!0));F.current=r});let h=V!=null,p;if(!h)p=G("div",{"data-current":!0,ref:O,children:q},L);else p=T(i8.Fragment,{children:[G("div",{"data-previous":!0,inert:MQ(!0),ref:k,style:{...A?{[Z.popupWidth]:`${A.width}px`,[Z.popupHeight]:`${A.height}px`}:null,position:"absolute"},"data-ending-style":C?void 0:""},"previous"),G("div",{"data-current":!0,ref:O,"data-starting-style":C?"":void 0,children:q},L)]});P0(()=>{let S=k.current;if(!S||!V)return;S.replaceChildren(...Array.from(V.childNodes))},[V]),FR({popupElement:B,positionerElement:U,mounted:H,content:W,onMeasureLayout:x,onMeasureLayoutComplete:E,side:Q,direction:X});let e={activationDirection:Ga(D),transitioning:h};return{children:p,state:e}}function Ga($){if(!$)return;return`${VR($.horizontal,5,"right","left")} ${VR($.vertical,5,"down","up")}`}function VR($,J,Q,Z){if($>J)return Q;if($<-J)return Z;return""}function Wa($,J){let Q=$.getBoundingClientRect(),Z=J.getBoundingClientRect(),q={x:Q.left+Q.width/2,y:Q.top+Q.height/2},X={x:Z.left+Z.width/2,y:Z.top+Z.height/2};return{horizontal:X.x-q.x,vertical:X.y-q.y}}function Ha($,J){let[Q,Z]=i8.useState(0),q=i8.useRef($),X=i8.useRef(J),Y=i8.useRef(!1);return P0(()=>{let z=q.current,K=X.current,W=$!==z,H=J!==K;if(W)Z((B)=>B+1),Y.current=!H;else if(Y.current&&H)Z((B)=>B+1),Y.current=!1;q.current=$,X.current=J},[$,J]),`${$??"current"}-${Q}`}var Ba={activationDirection:($)=>$?{"data-activation-direction":$}:null},NR=DR.forwardRef(function(J,Q){let{render:Z,className:q,style:X,children:Y,...z}=J,{store:K}=S5(),{side:W}=DQ(),H=K.useState("instantType"),{children:B,state:U}=cG({store:K,side:W,cssVars:BR,children:Y}),_={activationDirection:U.activationDirection,transitioning:U.transitioning,instant:H};return o0("div",J,{state:_,ref:Q,props:[z,{children:B}],stateAttributesMapping:Ba})});class dG{constructor(){this.store=new LQ}open($){let J=$?this.store.context.triggerElements.getById($)??void 0:void 0;if($&&!J)throw Error(V1(80,$));this.store.setOpen(!0,l0(T0.imperativeAction,void 0,J))}close(){this.store.setOpen(!1,l0(T0.imperativeAction,void 0,void 0))}get isOpen(){return this.store.select("open")}}function OR(){return new dG}var M4={};a4(M4,{createHandle:()=>GC,Viewport:()=>XC,Trigger:()=>QC,SubmenuTrigger:()=>KC,SubmenuRoot:()=>nR,Separator:()=>zC,Root:()=>WW,RadioItemIndicator:()=>sR,RadioItem:()=>rR,RadioGroup:()=>lR,Positioner:()=>dR,Portal:()=>mR,Popup:()=>vR,LinkItem:()=>fR,Item:()=>xR,Handle:()=>UW,GroupLabel:()=>SR,Group:()=>RR,CheckboxItemIndicator:()=>yR,CheckboxItem:()=>ER,Backdrop:()=>IR,Arrow:()=>wR});var AR=R(v(),1);var pG=R(v(),1),gL=pG.createContext(void 0);function r8($){let J=pG.useContext(gL);if(J===void 0&&!$)throw Error(V1(33));return J}var lG=R(v(),1),uL=lG.createContext(void 0);function Y5($){let J=lG.useContext(uL);if(J===void 0&&!$)throw Error(V1(36));return J}var wR=AR.forwardRef(function(J,Q){let{render:Z,className:q,style:X,...Y}=J,{store:z}=Y5(),{arrowRef:K,side:W,align:H,arrowUncentered:B,arrowStyles:U}=r8(),L={open:z.useState("open"),side:W,align:H,uncentered:B};return o0("div",J,{ref:[K,Q],stateAttributesMapping:w6,state:L,props:{style:U,"aria-hidden":!0,...Y}})});var kR=R(v(),1);var iG=R(v(),1),Ua=iG.createContext(void 0);function F4($=!0){let J=iG.useContext(Ua);if(J===void 0&&!$)throw Error(V1(25));return J}var _a={...w6,...B4},IR=kR.forwardRef(function(J,Q){let{render:Z,className:q,style:X,...Y}=J,{store:z}=Y5(),K=z.useState("open"),W=z.useState("mounted"),H=z.useState("transitionStatus"),B=z.useState("lastOpenChangeReason"),U=F4(),_={open:K,transitionStatus:H};return o0("div",J,{ref:U?.backdropRef?[Q,U.backdropRef]:Q,state:_,stateAttributesMapping:_a,props:[{role:"presentation",hidden:!W,style:{pointerEvents:B===T0.triggerHover?"none":void 0,userSelect:"none",WebkitUserSelect:"none"}},Y]})});var nG=R(v(),1);var I$=R(v(),1);function wQ({controlled:$,default:J,name:Q,state:Z="value"}){let{current:q}=I$.useRef($!==void 0),[X,Y]=I$.useState(J),z=q?$:X,K=I$.useCallback((W)=>{if(!q)Y(W)},[]);return[z,K]}var rG=R(v(),1),mL=rG.createContext(void 0);function TR(){let $=rG.useContext(mL);if($===void 0)throw Error(V1(30));return $}var kQ=R(v(),1);var bR=R(v(),1);function sG($){let{closeOnClick:J,highlighted:Q,id:Z,nodeId:q,store:X,typingRef:Y,itemRef:z,itemMetadata:K}=$,{events:W}=X.useState("floatingTreeRoot"),H=X.useState("open"),B=F4(!0),U=B!==void 0;return bR.useMemo(()=>({id:Z,role:"menuitem",tabIndex:H&&Q?0:-1,onKeyDown(_){if(_.key===" "&&Y?.current)_.preventDefault()},onMouseMove(_){if(!q)return;W.emit("itemhover",{nodeId:q,target:_.currentTarget})},onClick(_){if(J)W.emit("close",{domEvent:_,reason:T0.itemPress})},onMouseUp(_){if(B){let L=B.initialCursorPointRef.current;if(B.initialCursorPointRef.current=null,U&&L&&Math.abs(_.clientX-L.x)<=1&&Math.abs(_.clientY-L.y)<=1)return;if(U&&!p1.os.mac&&_.button===2)return}if(z.current&&X.context.allowMouseUpTriggerRef.current&&(!U||_.button===2)){if(!K||K.type==="regular-item")z.current.click()}}}),[J,Q,Z,W,q,H,X,Y,z,B,U,K])}var IQ={type:"regular-item"};function Q2($){let{closeOnClick:J,disabled:Q=!1,highlighted:Z,id:q,store:X,typingRef:Y=X.context.typingRef,nativeButton:z,itemMetadata:K,nodeId:W}=$,H=X.useState("disabled"),B=Q||H,U=kQ.useRef(null),{getButtonProps:_,buttonRef:L}=x6({disabled:B,focusableWhenDisabled:!0,native:z,composite:!0}),F=sG({closeOnClick:J,highlighted:Z,id:q,nodeId:W,store:X,typingRef:Y,itemRef:U,itemMetadata:K}),V=kQ.useCallback((D)=>{return h8(F,{onMouseEnter(){if(K.type!=="submenu-trigger")return;K.setActive()}},D,_)},[F,_,K]),M=_9(U,L);return kQ.useMemo(()=>({getItemProps:V,itemRef:M}),[V,M])}var T$=R(v(),1);var oG=R(v(),1),cL=oG.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>{return()=>{}},elementsRef:{current:[]},nextIndexRef:{current:0}});function jR(){return oG.useContext(cL)}var La=function($){return $[$.None=0]="None",$[$.GuessFromOrder=1]="GuessFromOrder",$}({});function M9($={}){let{label:J,metadata:Q,textRef:Z,indexGuessBehavior:q,index:X}=$,{register:Y,unregister:z,subscribeMapChange:K,elementsRef:W,labelsRef:H,nextIndexRef:B}=jR(),U=T$.useRef(-1),[_,L]=T$.useState(X??(q===La.GuessFromOrder?()=>{if(U.current===-1){let M=B.current;B.current+=1,U.current=M}return U.current}:-1)),F=T$.useRef(null),V=T$.useCallback((M)=>{if(F.current=M,_!==-1&&M!==null){if(W.current[_]=M,H){let D=J!==void 0;H.current[_]=D?J:Z?.current?.textContent??M.textContent}}},[_,W,H,J,Z]);return P0(()=>{if(X!=null)return;let M=F.current;if(M)return Y(M,Q),()=>{z(M)};return},[X,Y,z,Q]),P0(()=>{if(X!=null)return;return K((M)=>{let D=F.current?M.get(F.current)?.index:null;if(D!=null)L(D)})},[X,K,L]),{ref:V,index:_}}var dL=function($){return $.checked="data-checked",$.unchecked="data-unchecked",$.disabled="data-disabled",$.highlighted="data-highlighted",$}({});var Z2={checked($){if($)return{[dL.checked]:""};return{[dL.unchecked]:""}},...B4};var ER=nG.forwardRef(function(J,Q){let{render:Z,className:q,id:X,label:Y,nativeButton:z=!1,disabled:K=!1,closeOnClick:W=!1,checked:H,defaultChecked:B,onCheckedChange:U,style:_,...L}=J,F=M9({label:Y}),V=r8(!0),M=h5(X),{store:D}=Y5(),N=D.useState("isActive",F.index),O=D.useState("itemProps"),[k,I]=wQ({controlled:H,default:B??!1,name:"MenuCheckboxItem",state:"checked"}),{getItemProps:b,itemRef:A}=Q2({closeOnClick:W,disabled:K,highlighted:N,id:M,store:D,nativeButton:z,nodeId:V?.context.nodeId,itemMetadata:IQ}),w=nG.useMemo(()=>({disabled:K,highlighted:N,checked:k}),[K,N,k]);function C(x){let E=l0(T0.itemPress,x.nativeEvent,void 0,{preventUnmountOnClose(){}});if(U?.(!k,E),E.isCanceled)return;I((P)=>!P)}let y=o0("div",J,{state:w,stateAttributesMapping:Z2,props:[O,{role:"menuitemcheckbox","aria-checked":k,onClick:C},L,b],ref:[A,Q,F.ref]});return G(mL.Provider,{value:w,children:y})});var aG=R(v(),1);var yR=aG.forwardRef(function(J,Q){let{render:Z,className:q,style:X,keepMounted:Y=!1,...z}=J,K=TR(),W=aG.useRef(null),{transitionStatus:H,setMounted:B}=HQ(K.checked);_4({open:K.checked,ref:W,onComplete(){if(!K.checked)B(!1)}});let U={checked:K.checked,disabled:K.disabled,highlighted:K.highlighted,transitionStatus:H};return o0("span",J,{state:U,ref:[Q,W],stateAttributesMapping:Z2,props:{"aria-hidden":!0,...z},enabled:Y||K.checked})});var eG=R(v(),1);var tG=R(v(),1),$X=tG.createContext(void 0);function PR(){let $=tG.useContext($X);if($===void 0)throw Error(V1(31));return $}var RR=eG.forwardRef(function(J,Q){let{render:Z,className:q,style:X,...Y}=J,[z,K]=eG.useState(void 0),W=o0("div",J,{ref:Q,props:{role:"group","aria-labelledby":z,...Y}});return G($X.Provider,{value:K,children:W})});var CR=R(v(),1);var SR=CR.forwardRef(function(J,Q){let{render:Z,className:q,style:X,id:Y,...z}=J,K=h5(Y),W=PR();return P0(()=>{return W(K),()=>{W(void 0)}},[W,K]),o0("div",J,{ref:Q,props:{id:K,role:"presentation",...z}})});var hR=R(v(),1);var xR=hR.forwardRef(function(J,Q){let{render:Z,className:q,id:X,label:Y,nativeButton:z=!1,disabled:K=!1,closeOnClick:W=!0,style:H,...B}=J,U=M9({label:Y}),_=r8(!0),L=h5(X),{store:F}=Y5(),V=F.useState("isActive",U.index),M=F.useState("itemProps"),{getItemProps:D,itemRef:N}=Q2({closeOnClick:W,disabled:K,highlighted:V,id:L,store:F,nativeButton:z,nodeId:_?.context.nodeId,itemMetadata:IQ});return o0("div",J,{state:{disabled:K,highlighted:V},props:[M,B,D],ref:[N,Q,U.ref]})});var $W=R(v(),1);var fR=$W.forwardRef(function(J,Q){let{render:Z,className:q,id:X,label:Y,closeOnClick:z=!1,style:K,...W}=J,H=$W.useRef(null),B=M9({label:Y}),_=r8(!0)?.context.nodeId,L=h5(X),{store:F}=Y5(),V=F.useState("isActive",B.index),M=F.useState("itemProps"),D=F.context.typingRef,{getButtonProps:N,buttonRef:O}=x6({native:!1,composite:!0}),k=sG({closeOnClick:z,highlighted:V,id:L,nodeId:_,store:F,typingRef:D,itemRef:H});function I(A){return h8(k,A,N)}return o0("a",J,{state:{highlighted:V},props:[M,W,I],ref:[H,O,Q,B.ref]})});var TQ=R(v(),1);var Fa={...w6,...B4},vR=TQ.forwardRef(function(J,Q){let{render:Z,className:q,style:X,finalFocus:Y,...z}=J,{store:K}=Y5(),{side:W,align:H}=r8(),B=vG(!0)!=null,U=K.useState("open"),_=K.useState("transitionStatus"),L=K.useState("popupProps"),F=K.useState("mounted"),V=K.useState("instantType"),M=K.useState("activeTriggerElement"),D=K.useState("parent"),N=K.useState("lastOpenChangeReason"),O=K.useState("rootId"),k=K.useState("floatingRootContext"),I=K.useState("floatingTreeRoot"),b=K.useState("closeDelay"),A=K.useState("activeTriggerElement"),w=K.useState("hoverEnabled"),C=K.useState("disabled"),y=K.useState("openMethod"),x=D.type==="context-menu";_4({open:U,ref:K.context.popupRef,onComplete(){if(U)K.context.onOpenChangeComplete?.(!0)}}),TQ.useEffect(()=>{function e(S){K.setOpen(!1,l0(S.reason,S.domEvent))}return I.events.on("close",e),()=>{I.events.off("close",e)}},[I.events,K]),oq(k,{enabled:w&&!C&&!x&&D.type!=="menubar",closeDelay:b});let E=TQ.useCallback((e)=>{K.set("popupElement",e)},[K]),P={transitionStatus:_,side:W,align:H,open:U,nested:D.type==="menu",instant:V},h=o0("div",J,{state:P,ref:[Q,K.context.popupRef,E],stateAttributesMapping:Fa,props:[L,{onKeyDown(e){if(B&&xG.has(e.key))e.stopPropagation()}},NQ(_),z,{"data-rootownerid":O}]}),p=D.type===void 0||x;if(M||D.type==="menubar"&&N!==T0.outsidePress)p=!0;return G(dq,{context:k,openInteractionType:y,modal:x,disabled:!F,returnFocus:Y===void 0?p:Y,initialFocus:D.type!=="menu",restoreFocus:!0,externalTree:D.type!=="menubar"?I:void 0,previousFocusableElement:A,nextFocusableElement:D.type===void 0?K.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:D.type===void 0?K.context.beforeContentFocusGuardRef:void 0,children:h})});var uR=R(v(),1);var JW=R(v(),1),pL=JW.createContext(void 0);function gR(){let $=JW.useContext(pL);if($===void 0)throw Error(V1(32));return $}var mR=uR.forwardRef(function(J,Q){let{keepMounted:Z=!1,...q}=J,{store:X}=Y5();if(!(X.useState("mounted")||Z))return null;return G(pL.Provider,{value:Z,children:G(uq,{ref:Q,...q})})});var V4=R(v(),1);var q2=R(v(),1);function cR($){let{children:J,elementsRef:Q,labelsRef:Z,onMapChange:q}=$,X=v0(q),Y=q2.useRef(0),z=W5(Ma).current,K=W5(Va).current,[W,H]=q2.useState(0),B=q2.useRef(W),U=v0((M,D)=>{K.set(M,D??null),B.current+=1,H(B.current)}),_=v0((M)=>{K.delete(M),B.current+=1,H(B.current)}),L=q2.useMemo(()=>{Na(W);let M=new Map;return Array.from(K.keys()).filter((N)=>N.isConnected).sort(Da).forEach((N,O)=>{let k=K.get(N)??{};M.set(N,{...k,index:O})}),M},[K,W]);P0(()=>{if(typeof MutationObserver!=="function"||L.size===0)return;let M=new MutationObserver((D)=>{let N=new Set,O=(k)=>N.has(k)?N.delete(k):N.add(k);if(D.forEach((k)=>{k.removedNodes.forEach(O),k.addedNodes.forEach(O)}),N.size===0)B.current+=1,H(B.current)});return L.forEach((D,N)=>{if(N.parentElement)M.observe(N.parentElement,{childList:!0})}),()=>{M.disconnect()}},[L]),P0(()=>{if(B.current===W){if(Q.current.length!==L.size)Q.current.length=L.size;if(Z&&Z.current.length!==L.size)Z.current.length=L.size;Y.current=L.size}X(L)},[X,L,Q,Z,W]),P0(()=>{return()=>{Q.current=[]}},[Q]),P0(()=>{return()=>{if(Z)Z.current=[]}},[Z]);let F=v0((M)=>{return z.add(M),()=>{z.delete(M)}});P0(()=>{z.forEach((M)=>M(L))},[z,L]);let V=q2.useMemo(()=>({register:U,unregister:_,subscribeMapChange:F,elementsRef:Q,labelsRef:Z,nextIndexRef:Y}),[U,_,F,Q,Z,Y]);return G(cL.Provider,{value:V,children:J})}function Va(){return new Map}function Ma(){return new Set}function Da($,J){let Q=$.compareDocumentPosition(J);if(Q&Node.DOCUMENT_POSITION_FOLLOWING||Q&Node.DOCUMENT_POSITION_CONTAINED_BY)return-1;if(Q&Node.DOCUMENT_POSITION_PRECEDING||Q&Node.DOCUMENT_POSITION_CONTAINS)return 1;return 0}function Na($){}var dR=V4.forwardRef(function(J,Q){let{anchor:Z,positionMethod:q="absolute",className:X,render:Y,side:z,align:K,sideOffset:W=0,alignOffset:H=0,collisionBoundary:B="clipping-ancestors",collisionPadding:U=5,arrowPadding:_=5,sticky:L=!1,disableAnchorTracking:F=!1,collisionAvoidance:V=iy,style:M,...D}=J,{store:N}=Y5(),O=gR(),k=F4(!0),I=N.useState("parent"),b=N.useState("floatingRootContext"),A=N.useState("floatingTreeRoot"),w=N.useState("mounted"),C=N.useState("open"),y=N.useState("modal"),x=N.useState("openMethod"),E=N.useState("activeTriggerElement"),P=N.useState("transitionStatus"),h=N.useState("positionerElement"),p=N.useState("instantType"),e=N.useState("hasViewport"),S=N.useState("lastOpenChangeReason"),r=N.useState("floatingNodeId"),$0=N.useState("floatingParentNodeId"),K0=b.useState("domReferenceElement"),t=V4.useRef(null),H0=U4(h,!1,!1),z0=Z,j=W,d=H,m=K,s=V;if(I.type==="context-menu"){if(z0=Z??I.context?.anchor,m=m??"start",!z&&m!=="center")d=J.alignOffset??2,j=J.sideOffset??-5}let u=z,c=m;if(I.type==="menu")u=u??"inline-end",c=c??"start",s=J.collisionAvoidance??JG;else if(I.type==="menubar")u=u??(I.context.orientation==="vertical"?"inline-end":"bottom"),c=c??"start";let i=I.type==="context-menu",f=RG({anchor:z0,floatingRootContext:b,positionMethod:k?"fixed":q,mounted:w,side:u,sideOffset:j,align:c,alignOffset:d,arrowPadding:i?0:_,collisionBoundary:B,collisionPadding:U,sticky:L,nodeId:r,keepMounted:O,disableAnchorTracking:F,collisionAvoidance:s,shiftCrossAxis:i&&!(("side"in s)&&s.side==="flip"),externalTree:A,adaptiveOrigin:e?PG:void 0});V4.useEffect(()=>{function L0(_0){if(_0.open){if(_0.parentNodeId===r)N.set("hoverEnabled",!1);if(_0.nodeId!==r&&_0.parentNodeId===N.select("floatingParentNodeId"))N.setOpen(!1,l0(T0.siblingOpen))}}return A.events.on("menuopenchange",L0),()=>{A.events.off("menuopenchange",L0)}},[N,A.events,r]),V4.useEffect(()=>{if(N.select("floatingParentNodeId")==null)return;function L0(_0){if(_0.open||_0.nodeId!==N.select("floatingParentNodeId"))return;let N0=_0.reason??T0.siblingOpen;N.setOpen(!1,l0(N0))}return A.events.on("menuopenchange",L0),()=>{A.events.off("menuopenchange",L0)}},[A.events,N]);let o=U5();V4.useEffect(()=>{if(!C)o.clear()},[C,o]),V4.useEffect(()=>{function L0(_0){if(!C||_0.nodeId!==N.select("floatingParentNodeId"))return;if(_0.target&&E&&E!==_0.target){let N0=N.select("closeDelay");if(N0>0){if(!o.isStarted())o.start(N0,()=>{N.setOpen(!1,l0(T0.siblingOpen))})}else N.setOpen(!1,l0(T0.siblingOpen))}else o.clear()}return A.events.on("itemhover",L0),()=>{A.events.off("itemhover",L0)}},[A.events,C,E,N,o]),V4.useEffect(()=>{let L0={open:C,nodeId:r,parentNodeId:$0,reason:N.select("lastOpenChangeReason")};A.events.emit("menuopenchange",L0)},[A.events,C,N,r,$0]),P0(()=>{let L0=K0,_0=t.current;if(L0)t.current=L0;if(_0&&L0&&L0!==_0){N.set("instantType",void 0);let N0=new AbortController;return H0(()=>{N.set("instantType","trigger-change")},N0.signal),()=>{N0.abort()}}return},[K0,H0,N]);let G0={open:C,side:f.side,align:f.align,anchorHidden:f.anchorHidden,nested:I.type==="menu",instant:p},l=I.type==="menubar"&&I.context.modal,Z0=y&&S!==T0.triggerHover;hG(C&&(l||Z0),x==="touch",h,E);let Q0=SG(J,G0,{styles:f.positionerStyles,transitionStatus:P,props:D,refs:[Q,N.useStateSetter("positionerElement")],hidden:!w,inert:!C}),B0=w&&I.type!=="menu"&&(I.type!=="menubar"&&y&&S!==T0.triggerHover||I.type==="menubar"&&I.context.modal),W0=null;if(I.type==="menubar")W0=I.context.contentElement;else if(I.type===void 0)W0=E;return T(gL.Provider,{value:f,children:[B0&&G(CG,{ref:I.type==="context-menu"||I.type==="nested-context-menu"?I.context.internalBackdropRef:null,inert:MQ(!C),cutout:W0}),G(mq,{id:r,children:G(cR,{elementsRef:N.context.itemDomElements,labelsRef:N.context.itemLabels,children:Q0})})]})});var X2=R(v(),1);var QW=R(v(),1),lL=QW.createContext(void 0);function pR(){let $=QW.useContext(lL);if($===void 0)throw Error(V1(34));return $}var lR=X2.memo(X2.forwardRef(function(J,Q){let{render:Z,className:q,value:X,defaultValue:Y,onValueChange:z,disabled:K=!1,style:W,"aria-labelledby":H,...B}=J,[U,_]=X2.useState(void 0),[L,F]=wQ({controlled:X,default:Y,name:"MenuRadioGroup"}),V=v0((O,k)=>{if(z?.(O,k),k.isCanceled)return;F(O)}),D=o0("div",J,{state:{disabled:K},ref:Q,props:{role:"group","aria-labelledby":H??U,"aria-disabled":K||void 0,...B}}),N=X2.useMemo(()=>({value:L,setValue:V,disabled:K}),[L,V,K]);return G($X.Provider,{value:_,children:G(lL.Provider,{value:N,children:D})})}));var qW=R(v(),1);var ZW=R(v(),1),iL=ZW.createContext(void 0);function iR(){let $=ZW.useContext(iL);if($===void 0)throw Error(V1(35));return $}var rR=qW.forwardRef(function(J,Q){let{render:Z,className:q,id:X,label:Y,nativeButton:z=!1,disabled:K=!1,closeOnClick:W=!1,value:H,style:B,...U}=J,_=M9({label:Y}),L=r8(!0),F=h5(X),{store:V}=Y5(),M=V.useState("isActive",_.index),D=V.useState("itemProps"),{value:N,setValue:O,disabled:k}=pR(),I=k||K,b=N===H,{getItemProps:A,itemRef:w}=Q2({closeOnClick:W,disabled:I,highlighted:M,id:F,store:V,nativeButton:z,nodeId:L?.context.nodeId,itemMetadata:IQ}),C=qW.useMemo(()=>({disabled:I,highlighted:M,checked:b}),[I,M,b]);function y(E){let P=l0(T0.itemPress,E.nativeEvent,void 0,{preventUnmountOnClose(){}});O(H,P)}let x=o0("div",J,{state:C,stateAttributesMapping:Z2,props:[D,{role:"menuitemradio","aria-checked":b,onClick:y},U,A],ref:[w,Q,_.ref]});return G(iL.Provider,{value:C,children:x})});var XW=R(v(),1);var sR=XW.forwardRef(function(J,Q){let{render:Z,className:q,style:X,keepMounted:Y=!1,...z}=J,K=iR(),W=XW.useRef(null),{transitionStatus:H,setMounted:B}=HQ(K.checked);_4({open:K.checked,ref:W,onComplete(){if(!K.checked)B(!1)}});let U={checked:K.checked,disabled:K.disabled,highlighted:K.highlighted,transitionStatus:H};return o0("span",J,{state:U,stateAttributesMapping:Z2,ref:[Q,W],props:{"aria-hidden":!0,...z},enabled:Y||K.checked})});var g5=R(v(),1);var YW=R(v(),1),Oa=YW.createContext(null);function zW($){let J=YW.useContext(Oa);if(J===null&&!$)throw Error(V1(5));return J}var JX=R(v(),1);var Aa={...UG,disabled:$1(($)=>$.parent.type==="menubar"?$.parent.context.disabled||$.disabled:$.disabled),modal:$1(($)=>($.parent.type===void 0||$.parent.type==="context-menu")&&($.modal??!0)),openMethod:$1(($)=>$.openMethod),allowMouseEnter:$1(($)=>$.allowMouseEnter),highlightItemOnHover:$1(($)=>$.highlightItemOnHover),stickIfOpen:$1(($)=>$.stickIfOpen),parent:$1(($)=>$.parent),rootId:$1(($)=>{if($.parent.type==="menu")return $.parent.store.select("rootId");return $.parent.type!==void 0?$.parent.context.rootId:$.rootId}),activeIndex:$1(($)=>$.activeIndex),isActive:$1(($,J)=>$.activeIndex===J),hoverEnabled:$1(($)=>$.hoverEnabled),instantType:$1(($)=>$.instantType),lastOpenChangeReason:$1(($)=>$.openChangeReason),floatingTreeRoot:$1(($)=>{if($.parent.type==="menu")return $.parent.store.select("floatingTreeRoot");return $.floatingTreeRoot}),floatingNodeId:$1(($)=>$.floatingNodeId),floatingParentNodeId:$1(($)=>$.floatingParentNodeId),itemProps:$1(($)=>$.itemProps),closeDelay:$1(($)=>$.closeDelay),hasViewport:$1(($)=>$.hasViewport),keyboardEventRelay:$1(($)=>{if($.keyboardEventRelay)return $.keyboardEventRelay;if($.parent.type==="menu")return $.parent.store.select("keyboardEventRelay");return})};class bQ extends N${constructor($){super({...wa(),...$},{positionerRef:JX.createRef(),popupRef:JX.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:JX.createRef(),beforeContentFocusGuardRef:JX.createRef(),onOpenChangeComplete:void 0,triggerElements:new J7},Aa);this.unsubscribeParentListener=this.observe("parent",(J)=>{if(this.unsubscribeParentListener?.(),J.type==="menu"){let Q=J.store.select("rootId"),Z=J.store.select("floatingTreeRoot"),q=J.store.select("keyboardEventRelay");this.unsubscribeParentListener=J.store.subscribe(()=>{let X=J.store.select("rootId"),Y=J.store.select("floatingTreeRoot"),z=J.store.select("keyboardEventRelay");if(Q===X&&Z===Y&&q===z)return;Q=X,Z=Y,q=z,this.notifyAll()}),this.context.allowMouseUpTriggerRef=J.store.context.allowMouseUpTriggerRef;return}if(J.type!==void 0)this.context.allowMouseUpTriggerRef=J.context.allowMouseUpTriggerRef;this.unsubscribeParentListener=null})}setOpen($,J){this.state.floatingRootContext.context.events.emit("setOpen",{open:$,eventDetails:J})}static useStore($,J){let Q=W5(()=>{return new bQ(J)}).current;return $??Q}unsubscribeParentListener=null}function wa(){return{...BG(),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new F$,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:k1,keyboardEventRelay:void 0,closeDelay:0,hasViewport:!1}}var KW=R(v(),1),rL=KW.createContext(void 0);function GW(){return KW.useContext(rL)}var WW=_L(function(J){let{children:Q,open:Z,onOpenChange:q,onOpenChangeComplete:X,defaultOpen:Y=!1,disabled:z=!1,modal:K,loopFocus:W=!0,orientation:H="vertical",actionsRef:B,closeParentOnEsc:U=!1,handle:_,triggerId:L,defaultTriggerId:F=null,highlightItemOnHover:V=!0}=J,M=F4(!0),D=Y5(!0),N=zW(!0),O=GW(),k=g5.useMemo(()=>{if(O&&D)return{type:"menu",store:D.store};if(N)return{type:"menubar",context:N};if(M&&!D)return{type:"context-menu",context:M};return{type:void 0}},[M,D,N,O]),I=bQ.useStore(_?.store,{open:Y,openProp:Z,activeTriggerId:F,triggerIdProp:L,parent:k});zG(I,Z,Y,F),I.useControlledProp("openProp",Z),I.useControlledProp("triggerIdProp",L),I.useContextCallback("onOpenChangeComplete",X);let b=h6(),A=h6(),w=I.useState("floatingTreeRoot"),C=V$(w),y=x8(),x=I.useState("open"),E=I.useState("activeTriggerElement"),P=I.useState("positionerElement"),h=I.useState("hoverEnabled"),p=I.useState("disabled"),e=I.useState("lastOpenChangeReason"),S=I.useState("parent"),r=I.useState("activeIndex"),$0=I.useState("payload"),K0=I.useState("floatingParentNodeId"),t=g5.useRef(null),H0=g5.useRef(S.type!=="context-menu"),z0=U5(),j=g5.useRef(!0),d=U5(),m=K0!=null,{openMethod:s,triggerProps:u}=CP(x);I.useSyncedValues({disabled:z,highlightItemOnHover:V,modal:S.type===void 0?K:void 0,openMethod:s,rootId:b}),GG(I);let{forceUnmount:c}=WG(x,I,()=>{I.update({allowMouseEnter:!1,stickIfOpen:!0})});P0(()=>{if(M&&!D)I.update({parent:{type:"context-menu",context:M},floatingNodeId:C,floatingParentNodeId:y});else if(D)I.update({floatingNodeId:C,floatingParentNodeId:y})},[M,D,C,y,I]),g5.useEffect(()=>{if(!x)t.current=null;if(S.type!=="context-menu")return;if(!x){z0.clear(),H0.current=!1;return}z0.start(500,()=>{H0.current=!0})},[z0,x,S.type]),P0(()=>{if(!x&&!h)I.set("hoverEnabled",!0)},[x,h,I]);let i=v0((F0,m0)=>{let R0=m0.reason;if(x===F0&&m0.trigger===E&&e===R0)return;let n0=YG(m0);if(!F0&&m0.trigger==null)m0.trigger=E??void 0;if(q?.(F0,m0),m0.isCanceled)return;I.state.floatingRootContext.dispatchOpenChange(F0,m0);let C0=m0.event;if(F0===!1&&C0?.type==="click"&&C0.pointerType==="touch"&&!j.current)return;if(F0&&R0===T0.triggerFocus)j.current=!1,d.start(300,()=>{j.current=!0});else j.current=!0,d.clear();let z1=(R0===T0.triggerPress||R0===T0.itemPress)&&C0.detail===0&&C0?.isTrusted,Q1=!F0&&(R0===T0.escapeKey||R0==null),a0={open:F0,openChangeReason:R0};if(t.current=m0.event??null,XG(a0,F0,m0.trigger,n0()),I.update(a0),S.type==="menubar"&&(R0===T0.triggerFocus||R0===T0.focusOut||R0===T0.triggerHover||R0===T0.listNavigation||R0===T0.siblingOpen))I.set("instantType","group");else if(z1||Q1)I.set("instantType",z1?"click":"dismiss");else I.set("instantType",void 0)}),f=iq({popupStore:I,floatingId:A,nested:y!=null,onOpenChange:i}),o=f.context.events;g5.useEffect(()=>{let F0=({open:m0,eventDetails:R0})=>i(m0,R0);return o.on("setOpen",F0),()=>{o?.off("setOpen",F0)}},[o,i]);let G0=g5.useCallback(()=>{I.setOpen(!1,l0(T0.imperativeAction))},[I]);g5.useImperativeHandle(B,()=>({unmount:c,close:G0}),[c,G0]);let l;if(S.type==="context-menu")l=S.context;g5.useImperativeHandle(l?.positionerRef,()=>P,[P]),g5.useImperativeHandle(l?.actionsRef,()=>({setOpen:i}),[i]);let Z0=lq(f,{enabled:!p,bubbles:{escapeKey:U&&S.type==="menu"},outsidePress(){if(S.type!=="context-menu"||t.current?.type==="contextmenu")return!0;return H0.current},externalTree:m?w:void 0}),Q0=e7(),B0=g5.useCallback((F0)=>{if(I.select("activeIndex")===F0)return;I.set("activeIndex",F0)},[I]),W0=bL(f,{enabled:!p,listRef:I.context.itemDomElements,activeIndex:r,nested:S.type!==void 0,loopFocus:W,orientation:H,parentOrientation:S.type==="menubar"?S.context.orientation:void 0,rtl:Q0==="rtl",disabledIndices:W$,onNavigate:B0,openOnArrowKeyDown:S.type!=="context-menu",externalTree:m?w:void 0,focusItemOnHover:V}),L0=g5.useCallback((F0)=>{I.context.typingRef.current=F0},[I]),_0=jL(f,{enabled:!p,listRef:I.context.itemLabels,elementsRef:I.context.itemDomElements,activeIndex:r,resetMs:py,onMatch:(F0)=>{if(x&&F0!==r)I.set("activeIndex",F0)},onTyping:L0}),N0=g5.useMemo(()=>{let F0=h8(_0.reference,W0.reference,Z0.reference,{onMouseMove(){I.set("allowMouseEnter",!0)}},u);return F0["aria-haspopup"]="menu",F0["aria-expanded"]=x,F0},[I,_0.reference,W0.reference,Z0.reference,u,x]),d0=g5.useMemo(()=>{let F0=h8(W0.trigger,Z0.trigger,u);return F0["aria-haspopup"]="menu",F0["aria-expanded"]=!1,F0},[W0.trigger,Z0.trigger,u]),g=g5.useMemo(()=>h8(UQ,{id:A,role:"menu","aria-labelledby":E?.id,onMouseMove(){if(I.set("allowMouseEnter",!0),S.type==="menu")I.set("hoverEnabled",!1)},onClick(){if(I.select("hoverEnabled"))I.set("hoverEnabled",!1)},onKeyDown(F0){let m0=I.select("keyboardEventRelay");if(m0&&!F0.isPropagationStopped())m0(F0)}},_0.floating,W0.floating,Z0.floating),[E,A,S.type,I,_0.floating,W0.floating,Z0.floating]),a=W0.item??k1;HG(I,{floatingRootContext:f,activeTriggerProps:N0,inactiveTriggerProps:d0,popupProps:g,itemProps:a});let I0=g5.useMemo(()=>({store:I,parent:k}),[I,k]),A0=G(uL.Provider,{value:I0,children:typeof Q==="function"?Q({payload:$0}):Q});if(S.type===void 0||S.type==="context-menu")return G(cq,{externalTree:w,children:A0});return A0});var oR=R(v(),1);function nR($){let J=Y5().store,Q=oR.useMemo(()=>({parentMenu:J}),[J]);return G(rL.Provider,{value:Q,children:G(WW,{...$})})}var s8=R(v(),1);function aR($){let J=$.getBoundingClientRect(),Q=h1($);if(p1.env.jsdom)return J;let Z=Q.getComputedStyle($,"::before"),q=Q.getComputedStyle($,"::after");if(!(Z.content!=="none"||q.content!=="none"))return J;let Y=parseFloat(Z.width)||0,z=parseFloat(Z.height)||0,K=parseFloat(q.width)||0,W=parseFloat(q.height)||0,H=Math.max(J.width,Y,K),B=Math.max(J.height,z,W),U=H-J.width,_=B-J.height;return{left:J.left-U/2,right:J.right+U/2,top:J.top-_/2,bottom:J.bottom+_/2}}var tR=R(v(),1);function eR($={}){let{highlightItemOnHover:J,highlightedIndex:Q,onHighlightedIndexChange:Z}=FQ(),{ref:q,index:X}=M9($),Y=Q===X,z=tR.useRef(null),K=_9(q,z);return{compositeProps:{tabIndex:Y?0:-1,onFocus(){Z(X)},onMouseMove(){let H=z.current;if(!J||!H)return;let B=H.hasAttribute("disabled")||H.ariaDisabled==="true";if(!Y&&!B)H.focus()}},compositeRef:K,index:X}}function $C($){let{render:J,className:Q,style:Z,state:q=k1,props:X=W$,refs:Y=W$,metadata:z,stateAttributesMapping:K,tag:W="div",...H}=$,{compositeProps:B,compositeRef:U}=eR({metadata:z});return o0(W,$,{state:q,ref:[...Y,U],props:[B,...X,H],stateAttributesMapping:K})}function sL($){if(y1($)&&$.hasAttribute("data-rootownerid"))return $.getAttribute("data-rootownerid")??void 0;if(j6($))return;return sL(b6($))}var HW=R(v(),1);function JC($){let{enabled:J=!0,mouseDownAction:Q,open:Z}=$,q=HW.useRef(!1);return HW.useMemo(()=>{if(!J)return k1;return{onMouseDown:(X)=>{if(Q==="open"&&!Z||Q==="close"&&Z)q.current=!0,Y1(X.currentTarget).addEventListener("click",()=>{q.current=!1},{once:!0})},onClick:(X)=>{if(q.current)q.current=!1,X.preventBaseUIHandler()}}},[J,Q,Z])}var BW=2,QC=zP(function(J,Q){let{render:Z,className:q,style:X,disabled:Y=!1,nativeButton:z=!0,id:K,openOnHover:W,delay:H=100,closeDelay:B=0,handle:U,payload:_,...L}=J,F=Y5(!0),V=U?.store??F?.store;if(!V)throw Error(V1(85));let M=h5(K),D=V.useState("isTriggerActive",M),N=V.useState("floatingRootContext"),O=V.useState("isOpenedByTrigger",M),k=V.useState("triggerPopupId",M),I=s8.useRef(null),b=Ia(),A=FQ(!0),w=d8(),C=s8.useMemo(()=>{return w??new F$},[w]),y=V$(C),x=x8(),{registerTrigger:E,isMountedByThisTrigger:P}=KG(M,I,V,{payload:_,closeDelay:B,parent:b,floatingTreeRoot:C,floatingNodeId:y,floatingParentNodeId:x,keyboardEventRelay:A?.relayKeyboardEvent}),h=b.type==="menubar",p=V.useState("disabled"),e=Y||p||h&&b.context.disabled,{getButtonProps:S,buttonRef:r}=x6({disabled:e,native:z});s8.useEffect(()=>{if(!O&&b.type===void 0)V.context.allowMouseUpTriggerRef.current=!1},[V,O,b.type]);let $0=s8.useRef(null),K0=U5(),t=v0((W0)=>{if(!$0.current)return;K0.clear(),V.context.allowMouseUpTriggerRef.current=!1;let L0=W0.target;if(e0($0.current,L0)||e0(V.select("positionerElement"),L0)||L0===$0.current)return;if(L0!=null&&sL(L0)===V.select("rootId"))return;let _0=aR($0.current);if(W0.clientX>=_0.left-BW&&W0.clientX<=_0.right+BW&&W0.clientY>=_0.top-BW&&W0.clientY<=_0.bottom+BW)return;C.events.emit("close",{domEvent:W0,reason:T0.cancelOpen})});s8.useEffect(()=>{if(O&&V.select("lastOpenChangeReason")===T0.triggerHover)Y1($0.current).addEventListener("mouseup",t,{once:!0})},[O,t,V]);let H0=h&&b.context.hasSubmenuOpen,j=A$(N,{enabled:(W??H0)&&!e&&b.type!=="context-menu"&&(!h||H0&&!P),handleClose:k$({blockPointerEvents:!h}),mouseOnly:!0,move:!1,restMs:b.type===void 0?H:void 0,delay:{close:B},triggerElementRef:I,externalTree:C,isActiveTrigger:D,isClosing:()=>V.select("transitionStatus")==="ending"}),d=ka(O,V.select("lastOpenChangeReason")),m=M$(N,{enabled:!e&&b.type!=="context-menu",event:O&&h?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:b.type===void 0?d:!1}),s=AL(N,{enabled:!e&&H0}),u=JC({open:O,enabled:h,mouseDownAction:"open"}),c=s8.useMemo(()=>h8(s.reference,m.reference),[s.reference,m.reference]),i=V.useState("triggerProps",P),{preFocusGuardRef:f,handlePreFocusGuardFocus:o,handleFocusTargetFocus:G0}=TG(V,I),l={disabled:e,open:O},Z0=[$0,Q,r,E,I],Q0=[c,j??k1,i,{"aria-haspopup":"menu","aria-controls":k,id:M,onMouseDown:(W0)=>{if(V.select("open"))return;K0.start(200,()=>{V.context.allowMouseUpTriggerRef.current=!0}),Y1(W0.currentTarget).addEventListener("mouseup",t,{once:!0})}},h?{role:"menuitem"}:{},u,L,S],B0=o0("button",J,{enabled:!h,stateAttributesMapping:nq,state:l,ref:Z0,props:Q0});if(h)return G($C,{tag:"button",render:Z,className:q,style:X,state:l,refs:Z0,props:Q0,stateAttributesMapping:nq});if(O)return T(s8.Fragment,{children:[G(F9,{ref:f,onFocus:o},`${M}-pre-focus-guard`),G(s8.Fragment,{children:B0},M),G(F9,{ref:V.context.triggerFocusTargetRef,onFocus:G0},`${M}-post-focus-guard`)]});return G(s8.Fragment,{children:B0},M)});function ka($,J){let Q=U5(),[Z,q]=s8.useState(!1);return P0(()=>{if($&&J==="trigger-hover")q(!0),Q.start(eK,()=>{q(!1)});else if(!$)Q.clear(),q(!1)},[$,J,Q]),Z}function Ia(){let $=F4(!0),J=Y5(!0),Q=zW(!0);return s8.useMemo(()=>{if(Q)return{type:"menubar",context:Q};if($&&!J)return{type:"context-menu",context:$};return{type:void 0}},[$,J,Q])}var qC=R(v(),1);var ZC=function($){return $.popupWidth="--popup-width",$.popupHeight="--popup-height",$}({});var Ta={activationDirection:($)=>$?{"data-activation-direction":$}:null},XC=qC.forwardRef(function(J,Q){let{render:Z,className:q,style:X,children:Y,...z}=J,{store:K}=Y5(),{side:W}=r8(),H=K.useState("instantType"),{children:B,state:U}=cG({store:K,side:W,cssVars:ZC,children:Y}),_={activationDirection:U.activationDirection,transitioning:U.transitioning,instant:H};return o0("div",J,{state:_,ref:Q,props:[z,{children:B}],stateAttributesMapping:Ta})});var YC=R(v(),1);var zC=YC.forwardRef(function(J,Q){let{className:Z,render:q,orientation:X="horizontal",style:Y,...z}=J;return o0("div",J,{state:{orientation:X},ref:Q,props:[{role:"separator","aria-orientation":X},z]})});var Z7=R(v(),1);var KC=Z7.forwardRef(function(J,Q){let{render:Z,className:q,style:X,label:Y,id:z,nativeButton:K=!1,openOnHover:W=!0,delay:H=100,closeDelay:B=0,disabled:U=!1,..._}=J,L=M9({label:Y}),F=r8(),{store:V}=Y5(),M=h5(z),D=V.useState("open"),N=V.useState("floatingRootContext"),O=V.useState("floatingTreeRoot"),k=V.useState("triggerPopupId",M),I=ML(M,V),b=Z7.useCallback((m)=>{let s=I(m);if(m!==null&&V.select("open")&&V.select("activeTriggerId")==null)V.update({activeTriggerId:M,activeTriggerElement:m,closeDelay:B});return s},[I,B,V,M]),A=Z7.useRef(null),w=Z7.useCallback((m)=>{A.current=m,V.set("activeTriggerElement",m)},[V]),C=GW();if(!C?.parentMenu)throw Error(V1(37));V.useSyncedValue("closeDelay",B);let y=C.parentMenu,x=V.useState("disabled"),E=y.useState("disabled"),P=U||x||E,h=y.useState("itemProps"),p=y.useState("isActive",L.index),e=Z7.useMemo(()=>({type:"submenu-trigger",setActive(){if(y.select("highlightItemOnHover"))y.set("activeIndex",L.index)}}),[y,L.index]),{getItemProps:S,itemRef:r}=Q2({closeOnClick:!1,disabled:P,highlighted:p,id:M,store:V,typingRef:y.context.typingRef,nativeButton:K,itemMetadata:e,nodeId:F?.context.nodeId}),$0=V.useState("hoverEnabled"),K0=A$(N,{enabled:$0&&W&&!P,handleClose:k$({blockPointerEvents:!0}),mouseOnly:!0,move:!0,restMs:H,delay:{open:H,close:B},shouldOpen:H>0?()=>y.select("allowMouseEnter"):void 0,triggerElementRef:A,externalTree:O,isClosing:()=>V.select("transitionStatus")==="ending"}),H0=M$(N,{enabled:!P,event:"mousedown",toggle:!W,ignoreMouse:W,stickIfOpen:!1}).reference??k1,z0=V.useState("triggerProps",!0);return delete z0.id,o0("div",J,{state:{disabled:P,highlighted:p,open:D},stateAttributesMapping:IG,props:[H0,K0,z0,h,{"aria-controls":k,tabIndex:D||p?0:-1,onBlur(){if(p)y.set("activeIndex",null)}},_,S],ref:[Q,L.ref,r,b,w]})});class UW{constructor(){this.store=new bQ}open($){let J=$?this.store.context.triggerElements.getById($):void 0;if($&&!J)throw Error(V1(83,$));this.store.setOpen(!0,l0("imperative-action",void 0,J))}close(){this.store.setOpen(!1,l0("imperative-action",void 0,void 0))}get isOpen(){return this.store.select("open")}}function GC(){return new UW}var E$={};a4(E$,{ScrubAreaCursor:()=>$S,ScrubArea:()=>tC,Root:()=>PC,Input:()=>rC,Increment:()=>cC,Group:()=>CC,Decrement:()=>pC});var o8=R(v(),1);var _W=R(v(),1),oL=_W.createContext(void 0);function D4(){let $=_W.useContext(oL);if($===void 0)throw Error(V1(43));return $}var LW=R(v(),1);var nL=function($){return $.disabled="data-disabled",$.valid="data-valid",$.invalid="data-invalid",$.touched="data-touched",$.dirty="data-dirty",$.filled="data-filled",$.focused="data-focused",$}({});var WC={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},jQ={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},HC={disabled:!1,...jQ},BC={valid($){if($===null)return null;if($)return{[nL.valid]:""};return{[nL.invalid]:""}}};var ba={invalid:void 0,name:void 0,validityData:{state:WC,errors:[],error:"",value:"",initialValue:null},setValidityData:d1,disabled:void 0,touched:jQ.touched,setTouched:d1,dirty:jQ.dirty,setDirty:d1,filled:jQ.filled,setFilled:d1,focused:jQ.focused,setFocused:d1,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:HC,markedDirtyRef:{current:!1},registerFieldControl:d1,validation:{getValidationProps:($,J=k1)=>J,inputRef:{current:null},registerInput:d1,commit:async()=>{},change:d1}},ja=LW.createContext(ba);function EQ($=!0){let J=LW.useContext(ja);if(J.setValidityData===d1&&!$)throw Error(V1(28));return J}var FW=R(v(),1);var Ea=FW.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:d1,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function VW(){return FW.useContext(Ea)}var QX=R(v(),1);var MW=R(v(),1);var ya=MW.createContext({controlId:void 0,registerControlId:d1,labelId:void 0,setLabelId:d1,messageIds:[],setMessageIds:d1,getDescriptionProps:($)=>$});function DW(){return MW.useContext(ya)}function UC($={}){let{id:J,implicit:Q=!1,controlRef:Z}=$,{controlId:q,registerControlId:X}=DW(),Y=h5(J),z=Q?q:void 0,K=W5(()=>Symbol("labelable-control")),W=QX.useRef(!1),H=QX.useRef(J!=null),B=v0(()=>{if(!W.current||X===d1)return;W.current=!1,X(K.current,void 0)});return P0(()=>{if(X===d1)return;let U;if(Q){let _=Z?.current;if(F1(_)&&_.closest("label")!=null)U=J??null;else U=z??Y}else if(J!=null)H.current=!0,U=J;else if(H.current)U=Y;else{B();return}if(U===void 0){B();return}W.current=!0,X(K.current,U);return},[J,Z,z,X,Q,Y,K,B]),QX.useEffect(()=>{return B},[B]),q??Y}var D9={inputValue:()=>null,value:()=>null,...BC};function aL($){if(Array.isArray($))return $.map((J)=>aL(J)).join(",");if($==null)return"";return String($)}var _C=new Map;function b$($,J){let Q=JSON.stringify({locale:aL($),options:J}),Z=_C.get(Q);if(Z)return Z;let q=new Intl.NumberFormat($,J);return _C.set(Q,q),q}function yQ($,J,Q){if($==null)return"";return b$(J,Q).format($)}var FC=["零","〇","一","二","三","四","五","六","七","八","九"],Pa={零:"0",〇:"0",一:"1",二:"2",三:"3",四:"4",五:"5",六:"6",七:"7",八:"8",九:"9"},tL=["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"],eL=["۰","۱","۲","۳","۴","۵","۶","۷","۸","۹"],$F=["0","1","2","3","4","5","6","7","8","9"],JF=["%","٪","%","﹪"],QF=["‰","؉"],VC=["−","-","‒","–","—","﹣"],MC=["+","﹢"],Ra=".",Ca=",",Sa=new RegExp(`[${tL.join("")}]`,"g"),ha=new RegExp(`[${eL.join("")}]`,"g"),xa=new RegExp(`[${$F.join("")}]`,"g"),fa=new RegExp(`[${FC.join("")}]`,"g"),DC=new RegExp(`[${JF.join("")}]`),NC=new RegExp(`[${QF.join("")}]`),va=new RegExp(DC.source,"g"),ga=new RegExp(NC.source,"g"),OC=new RegExp(`[${tL.join("")}]`),AC=new RegExp(`[${eL.join("")}]`),wC=new RegExp(`[${FC.join("")}]`),ua=new RegExp(`[${$F.join("")}]`);function ZF($){return $>="0"&&$<="9"||OC.test($)||AC.test($)||wC.test($)||ua.test($)}var kC=[".",",",Ra,Ca,"٫","٬"],qF=/\p{Zs}/u,IC=["+",...MC],TC=["-",...VC],ZX=($)=>$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),ma=($)=>$.replace(/[-\\\]^]/g,(J)=>`\\${J}`);function LC($,J){let[Q,Z="0"]=String($).split("e");return Number(`${Q}e${Number(Z)+J}`)}var bC=($)=>`[${$.map(ma).join("")}]`,jC=bC(["-"].concat(VC)),EC=bC(["+"].concat(MC)),XF=new RegExp(jC,"gu"),YF=new RegExp(EC,"gu"),NW=new RegExp(jC),zF=new RegExp(EC);function qX($,J){let Q=b$($,J).formatToParts(11111.1),Z={};return Q.forEach((q)=>{Z[q.type]=q.value}),b$($).formatToParts(0.1).forEach((q)=>{if(q.type==="decimal")Z[q.type]=q.value}),Z}function q7($,J,Q){if($==null)return null;let Z=String($).replace(/\p{Cf}/gu,"").trim();Z=Z.replace(XF,"-").replace(YF,"+");let q=!1,X=Z.match(/([+-])\s*$/);if(X){if(X[1]==="-")q=!0;Z=Z.replace(/([+-])\s*$/,"")}let Y=Z.match(/^\s*([+-])/);if(Y){if(Y[1]==="-")q=!0;Z=Z.replace(/^\s*[+-]/,"")}let z=J;if(z===void 0){if(OC.test(Z)||AC.test(Z))z="ar";else if(wC.test(Z))z="zh"}let{group:K,decimal:W,currency:H,exponentSeparator:B}=qX(z,Q),U=b$(z,Q).formatToParts(1).filter((A)=>A.type==="unit").map((A)=>ZX(A.value)),_=U.length?new RegExp(U.join("|"),"g"):null,L=null;if(K){let A=/\p{Zs}/u.test(K),w=K==="'"||K==="’";if(A)L=/\p{Zs}/gu;else if(w)L=/['’]/g;else L=new RegExp(ZX(K),"g")}let V=[{regex:L,replacement:""},{regex:W?new RegExp(ZX(W),"g"):null,replacement:"."},{regex:/./g,replacement:"."},{regex:/,/g,replacement:""},{regex:/٫/g,replacement:"."},{regex:/٬/g,replacement:""},{regex:H?new RegExp(ZX(H),"g"):null,replacement:""},{regex:_,replacement:""},{regex:va,replacement:""},{regex:ga,replacement:""},{regex:B?new RegExp(ZX(B),"g"):null,replacement:"e"},{regex:Sa,replacement:(A)=>String(tL.indexOf(A))},{regex:ha,replacement:(A)=>String(eL.indexOf(A))},{regex:xa,replacement:(A)=>String($F.indexOf(A))},{regex:fa,replacement:(A)=>Pa[A]}].reduce((A,{regex:w,replacement:C})=>{return w?A.replace(w,C):A},Z),M=V.lastIndexOf(".");if(M!==-1)V=`${V.slice(0,M).replace(/\./g,"")}.${V.slice(M+1).replace(/\./g,"")}`;if(/^[-+]?Infinity$/i.test(Z)||Z.includes("∞"))return null;let D=(q?"-":"")+V,N=parseFloat(D),O=Q?.style,k=O==="unit"&&Q?.unit==="percent",I=DC.test($)||O==="percent";if(NC.test($))N=LC(N,-3);else if(!k&&I)N=LC(N,-2);if(!Number.isFinite(N))return null;return N}function KF($,J=Number.MIN_SAFE_INTEGER,Q=Number.MAX_SAFE_INTEGER){return Math.max(J,Math.min($,Q))}var ca=0.0000000001,da=0.0000000001;function OW($){return $?.maximumFractionDigits!=null||$?.minimumFractionDigits!=null||$?.maximumSignificantDigits!=null||$?.minimumSignificantDigits!=null||$?.roundingIncrement!=null||$?.roundingMode!=null||$?.roundingPriority!=null}function GF($,J){if(!Number.isFinite($))return $;if(!OW(J)){let X=parseFloat($.toPrecision(15)),Y=Math.abs(X-$),z=Math.min(Number.EPSILON*Math.max(1,Math.abs($)),da);return Y<=z?X:$}let Q=b$("en-US",{...J,signDisplay:"auto",currencySign:"standard",notation:J.notation==="compact"?"standard":J.notation,useGrouping:!1}),Z=Q.format($),q=q7(Z,"en-US",J);if(q===null)return $;return Q.format(q)===Z?q:$}function pa($,J,Q,Z="directional"){let q=Math.abs(Q),X=Math.sign(Q),Y=q*ca*X,z=$-J+Y;if(Z==="nearest")return J+Math.round(z/Q)*Q;let K=X>0?Math.floor(z/q):Math.ceil(z/q);return J+K*q}function yC($,{step:J,minWithDefault:Q,maxWithDefault:Z,minWithZeroDefault:q,format:X,snapOnStep:Y,small:z,clamp:K}){if($===null)return $;let W=$;if(J!=null&&Y&&J!==0){let B=z||Q===Number.MIN_SAFE_INTEGER?q:Q;W=pa(W,B,J,z?"nearest":"directional")}if(K)W=KF(W,Q,Z);if(J==null&&!OW(X))return W;let H=GF(W,X);return K?KF(H,Q,Z):H}var PC=o8.forwardRef(function(J,Q){let{id:Z,min:q,max:X,smallStep:Y=0.1,step:z=1,largeStep:K=10,required:W=!1,disabled:H=!1,readOnly:B=!1,form:U,name:_,defaultValue:L,value:F,onValueChange:V,onValueCommitted:M,allowWheelScrub:D=!1,snapOnStep:N=!1,allowOutOfRange:O=!1,format:k,locale:I,render:b,className:A,inputRef:w,style:C,...y}=J,{setDirty:x,validityData:E,disabled:P,setFilled:h,invalid:p,name:e,state:S,validation:r}=EQ(),{clearErrors:$0}=VW(),K0=P||H,t=e??_,H0=z==="any"?1:z,[z0,j]=o8.useState(!1),d=q??Number.MIN_SAFE_INTEGER,m=X??Number.MAX_SAFE_INTEGER,s=q??0,u=k?.style,c=o8.useRef(null),i=_9(w,r.inputRef),f=UC({id:Z}),[o,G0]=wQ({controlled:F,default:L,name:"NumberField",state:"value"}),l=o??null,Z0=L5(l);P0(()=>{h(l!==null)},[h,l]);let Q0=GP(),B0=L5(k),W0=o8.useRef(!1),L0=v0((Q1,a0)=>{W0.current=!1,M?.(Q1,a0)}),_0=o8.useRef(!0),N0=o8.useRef(null),[d0,g]=o8.useState(()=>yQ(l,I,k)),[a,I0]=o8.useState("numeric"),A0=v0(()=>{let{decimal:Q1,group:a0,currency:R1,literal:C1}=qX(I,k),b1=new Set;if(kC.forEach((w0)=>b1.add(w0)),Q1)b1.add(Q1);if(a0){if(b1.add(a0),qF.test(a0))b1.add(" ")}let n=u==="percent"||u==="unit"&&k?.unit==="percent",D0=u==="percent"||u==="unit"&&k?.unit==="permille";if(n)JF.forEach((w0)=>b1.add(w0));if(D0)QF.forEach((w0)=>b1.add(w0));if(u==="currency"&&R1)b1.add(R1);if(C1){if(Array.from(C1).forEach((w0)=>b1.add(w0)),qF.test(C1))b1.add(" ")}if(IC.forEach((w0)=>b1.add(w0)),d<0||O)TC.forEach((w0)=>b1.add(w0));return b1}),F0=v0((Q1)=>{if(Q1?.altKey)return Y;if(Q1?.shiftKey)return K;return H0}),m0=v0((Q1,a0)=>{let{event:R1,direction:C1}=a0,b1=a0.reason===T0.inputChange||a0.reason===T0.inputClear||a0.reason===T0.inputBlur||a0.reason===T0.inputPaste||a0.reason===T0.none,n=!O||!b1,D0=yC(Q1,{step:C1?F0(R1)*C1:void 0,format:B0.current,minWithDefault:d,maxWithDefault:m,minWithZeroDefault:s,snapOnStep:N,small:R1?.altKey??!1,clamp:n}),w0=D0!==l||b1&&(Q1!==l||_0.current===!1);if(w0){if(V?.(D0,a0),a0.isCanceled)return!1;G0(D0),x(D0!==E.initialValue),W0.current=!0}if(N0.current=D0,_0.current)g(yQ(D0,I,k));return Q0(),w0}),R0=v0((Q1,{direction:a0,currentValue:R1,event:C1,reason:b1})=>{let n=R1==null?Z0.current:R1,D0=C1;if(typeof n!=="number")return m0(0,l0(b1,D0));return m0(n+Q1*a0,l0(b1,D0,void 0,{direction:a0}))});P0(function(){if(!_0.current)return;let a0=yQ(l,I,k);if(a0!==d0)g(a0)}),P0(function(){if(!p1.os.ios)return;let a0="text";if(d>=0)a0="decimal";I0(a0)},[d]),o8.useEffect(function(){let a0=c.current;if(K0||B||!D||!a0)return;function R1(C1){if(C1.ctrlKey||v5(Y1(c.current))!==c.current)return;C1.preventDefault(),_0.current=!0;let b1=F0(C1);if(R0(b1,{direction:C1.deltaY>0?-1:1,event:C1,reason:"wheel"}))L0(N0.current??Z0.current,x9(T0.wheel,C1))}return U1(a0,"wheel",R1)},[D,R0,K0,B,F0,L0,N0,Z0]);let n0=o8.useMemo(()=>({...S,disabled:K0,readOnly:B,required:W,value:l,inputValue:d0,scrubbing:z0}),[S,K0,B,W,l,d0,z0]),C0=o8.useMemo(()=>({inputRef:c,inputValue:d0,value:l,minWithDefault:d,maxWithDefault:m,disabled:K0,readOnly:B,id:f,setValue:m0,incrementValue:R0,getStepAmount:F0,allowInputSyncRef:_0,formatOptionsRef:B0,valueRef:Z0,lastChangedValueRef:N0,hasPendingCommitRef:W0,name:t,nameProp:_,required:W,invalid:p,inputMode:a,getAllowedNonNumericKeys:A0,min:q,max:X,setInputValue:g,locale:I,isScrubbing:z0,setIsScrubbing:j,state:n0,onValueCommitted:L0}),[c,d0,l,d,m,K0,B,f,m0,R0,F0,B0,Z0,t,_,W,p,a,A0,q,X,g,I,z0,n0,L0]),z1=o0("div",J,{ref:Q,state:n0,props:y,stateAttributesMapping:D9});return T(oL.Provider,{value:C0,children:[z1,G("input",{...r.getValidationProps(K0,{onFocus(){c.current?.focus()},onChange(Q1){if(Q1.nativeEvent.defaultPrevented||K0||B)return;let a0=Q1.currentTarget.valueAsNumber,R1=Number.isNaN(a0)?null:a0,C1=l0(T0.none,Q1.nativeEvent);m0(R1,C1),$0(t),r.change(N0.current??R1)}}),ref:i,type:"number",form:U,name:t,value:l??"",min:q,max:X,step:z,disabled:K0,readOnly:B,required:W,"aria-hidden":!0,tabIndex:-1,style:t?Hy:mK,suppressHydrationWarning:!0})]})});var RC=R(v(),1);var CC=RC.forwardRef(function(J,Q){let{render:Z,className:q,style:X,...Y}=J,{state:z}=D4();return o0("div",J,{ref:Q,state:z,props:[{role:"group"},Y],stateAttributesMapping:D9})});var mC=R(v(),1);var g9=R(v(),1);var SC=0;class WF extends T8{static create(){return new WF}start($,J){this.clear(),this.currentId=setInterval(()=>{J()},$)}clear=()=>{if(this.currentId!==SC)clearInterval(this.currentId),this.currentId=SC}}function hC(){let $=W5(WF.create).current;return d7($.disposeEffect),$}var la=60,ia=400,ra=8,sa=50,oa=3;function j$($){return $==="touch"||$==="pen"}function xC($){let{disabled:J,readOnly:Q=!1,tick:Z,onStop:q,tickDelay:X=la,startDelay:Y=ia,scrollDistance:z=ra,elementRef:K}=$,W=U5(),H=hC(),B=U5(),U=g9.useRef(!1),_=g9.useRef(0),L=g9.useRef({x:0,y:0}),F=g9.useRef(!1),V=g9.useRef(!1),M=g9.useRef(""),D=g9.useRef(d1),N=g9.useRef(d1),O=v0(()=>{B.clear(),W.clear(),H.clear(),D.current(),_.current=0});function k(A){O();let w=K.current;if(!w)return;let C=h1(w);function y(x){x.preventDefault()}if(D.current=U1(C,"contextmenu",y),N.current(),N.current=U1(C,"pointerup",(x)=>{U.current=!1,O(),q?.(x)},{once:!0}),!Z(A)){O();return}W.start(Y,()=>{H.start(X,()=>{if(!Z(A))O()})})}g9.useEffect(()=>()=>{O(),N.current()},[O]);let I={onTouchStart(){F.current=!0},onTouchEnd(){F.current=!1},onPointerDown(A){let w=!A.button||A.button===0;if(A.defaultPrevented||!w||J||Q)return;if(M.current=A.pointerType,V.current=!1,U.current=!0,L.current={x:A.clientX,y:A.clientY},!j$(A.pointerType))A.preventDefault(),k(A.nativeEvent);else B.start(sa,()=>{let y=_.current;if(_.current=0,U.current&&yz**2)O()},onMouseEnter(A){if(A.defaultPrevented||J||Q||!U.current||F.current||j$(M.current))return;k(A.nativeEvent)},onMouseLeave(){if(F.current)return;O()},onMouseUp(){if(F.current)return;O()}},b=v0((A)=>{if(A.defaultPrevented)return!0;if(j$(M.current))return V.current;return A.detail!==0});return{pointerHandlers:I,shouldSkipClick:b}}var fC=60,vC=400,gC=8;var na={WebkitUserSelect:"none",userSelect:"none"};function uC($){let{allowInputSyncRef:J,disabled:Q,formatOptionsRef:Z,getStepAmount:q,id:X,incrementValue:Y,inputRef:z,inputValue:K,isIncrement:W,locale:H,readOnly:B,setValue:U,valueRef:_,lastChangedValueRef:L,onValueCommitted:F}=$,V=W?T0.incrementPress:T0.decrementPress;function M(k){let I=!J.current;if(J.current=!0,!I){L.current=_.current;return}let b=q7(K,H,Z.current);if(b!==null){let A=l0(V,k);if(U(b,A),!A.isCanceled)_.current=b}}let{pointerHandlers:D,shouldSkipClick:N}=xC({disabled:Q||B,elementRef:z,tickDelay:fC,startDelay:vC,scrollDistance:gC,tick(k){let I=q(k);return Y(I,{direction:W?1:-1,event:k,reason:V})},onStop(k){let I=L.current??_.current;F(I,x9(V,k))}});return{disabled:Q,"aria-label":W?"Increase":"Decrease","aria-controls":X,tabIndex:-1,style:na,...D,onClick(k){let I=Q||B;if(k.defaultPrevented||I||N(k))return;M(k.nativeEvent);let b=q(k),A=_.current;Y(b,{direction:W?1:-1,event:k.nativeEvent,reason:V});let w=L.current??_.current;if(w!==A)F(w,x9(V,k.nativeEvent))},onPointerDown(k){let I=!k.button||k.button===0;if(k.defaultPrevented||B||!I||Q)return;if(M(k.nativeEvent),L.current=null,!j$(k.pointerType))z.current?.focus();D.onPointerDown(k)}}}function AW($,J,Q){let{render:Z,className:q,disabled:X=!1,nativeButton:Y=!0,style:z,...K}=$,{allowInputSyncRef:W,disabled:H,formatOptionsRef:B,getStepAmount:U,id:_,incrementValue:L,inputRef:F,inputValue:V,maxWithDefault:M,minWithDefault:D,readOnly:N,setValue:O,state:k,value:I,valueRef:b,locale:A,lastChangedValueRef:w,onValueCommitted:C}=D4(),y=I!=null&&(Q?I>=M:I<=D),x=X||H||y,E=uC({isIncrement:Q,inputRef:F,inputValue:V,disabled:x,readOnly:N,id:_,setValue:O,getStepAmount:U,incrementValue:L,allowInputSyncRef:W,formatOptionsRef:B,valueRef:b,locale:A,lastChangedValueRef:w,onValueCommitted:C}),{getButtonProps:P,buttonRef:h}=x6({disabled:x||N,native:Y,focusableWhenDisabled:!0}),p={...k,disabled:x};return o0("button",$,{ref:[J,h],state:p,props:[E,K,P],stateAttributesMapping:D9})}var cC=mC.forwardRef(function(J,Q){return AW(J,Q,!0)});var dC=R(v(),1);var pC=dC.forwardRef(function(J,Q){return AW(J,Q,!1)});var PQ=R(v(),1);var lC=R(v(),1);function iC($,J,Q,Z,q=!0,X){let{registerFieldControl:Y}=EQ(),z=lC.useRef(null);if(!z.current)z.current=Symbol();P0(()=>{let K=z.current;if(!K||!q)return;return Y(K,{controlRef:$,getValue:Z,id:J,name:X,value:Q}),()=>{Y(K,void 0)}},[$,q,Z,J,X,Y,Q])}var aa=new Set(["Backspace","Delete","ArrowLeft","ArrowRight","Tab","Enter","Escape"]),rC=PQ.forwardRef(function(J,Q){let{render:Z,className:q,style:X,...Y}=J,{allowInputSyncRef:z,disabled:K,formatOptionsRef:W,getAllowedNonNumericKeys:H,getStepAmount:B,id:U,incrementValue:_,inputMode:L,inputValue:F,max:V,min:M,name:D,nameProp:N,readOnly:O,required:k,setValue:I,state:b,setInputValue:A,locale:w,inputRef:C,value:y,onValueCommitted:x,lastChangedValueRef:E,hasPendingCommitRef:P,valueRef:h}=D4(),{clearErrors:p}=VW(),{validationMode:e,setTouched:S,setFocused:r,invalid:$0,shouldValidateOnChange:K0,validation:t}=EQ(),{labelId:H0}=DW(),z0=PQ.useRef(!1),j=PQ.useRef(!1),d=PQ.useRef(null);return iC(C,U,y,void 0,!K,N),P0(()=>{if(d.current!=null){let u=d.current;d.current=null,C.current?.setSelectionRange(u,u)}}),bG(y,()=>{if(p(D),j.current&&!K0()){j.current=!1;return}t.change(y)}),o0("input",J,{ref:[Q,C],state:b,props:[{id:U,required:k,disabled:K,readOnly:O,inputMode:L,value:F,type:"text",autoComplete:"off",autoCorrect:"off",spellCheck:"false","aria-roledescription":"Number field","aria-invalid":!K&&$0?!0:void 0,"aria-labelledby":H0,suppressHydrationWarning:!0,onFocus(u){if(u.defaultPrevented||K)return;if(r(!0),z0.current)return;z0.current=!0;let c=u.currentTarget,i=c.value.length;c.setSelectionRange(i,i)},onBlur(u){if(u.defaultPrevented||K)return;if(S(!0),r(!1),O)return;let c=!z.current,i=P.current;if(z.current=!0,F.trim()===""){let _0=l0(T0.inputClear,u.nativeEvent);if(I(null,_0),_0.isCanceled)return;if(e==="onBlur")t.commit(null);if(c||i||y!==null)x(null,x9(T0.inputClear,u.nativeEvent));return}let f=W.current,o=q7(F,w,f);if(o===null)return;let G0=OW(f),l;if(!c&&!G0)l=y;else if(G0)l=GF(o,f);else l=o;let Z0=x9(T0.inputBlur,u.nativeEvent),Q0=y!==l,B0=c||Q0||i,W0=l;if(Q0){let _0=l0(T0.inputBlur,u.nativeEvent);if(j.current=!0,I(l,_0),_0.isCanceled){j.current=!1;return}if(W0=E.current??l,W0===y)j.current=!1}if(e==="onBlur")t.commit(W0);if(B0)x(W0,Z0);let L0=yQ(W0,w,f);if(F!==L0)A(L0)},onChange(u){if(u.nativeEvent.defaultPrevented)return;z.current=!1;let c=u.currentTarget.value;if(c.trim()===""){A(c),I(null,l0(T0.inputClear,u.nativeEvent));return}let i=H();if(!Array.from(c).every((G0)=>ZF(G0)||NW.test(G0)||i.has(G0)))return;let o=q7(c,w,W.current);if(A(c),o!==null)I(o,l0(T0.inputChange,u.nativeEvent))},onKeyDown(u){if(u.defaultPrevented||O||K)return;let c=u.nativeEvent,i=!z.current,f=H(),o=f.has(u.key),{decimal:G0,currency:l,percentSign:Z0}=qX(w,W.current),Q0=u.currentTarget.selectionStart,B0=u.currentTarget.selectionEnd,W0=Q0===0&&B0===F.length,L0=(R0)=>Q0!=null&&B0!=null&&R0>=Q0&&R0{if(R0.test(u.key)&&Array.from(f).some((C0)=>R0.test(C0))){let C0=F.search(n0),z1=C0!==-1&&L0(C0);o=!(NW.test(F)||zF.test(F))||W0||z1}}),[G0,l,Z0].forEach((R0)=>{if(u.key===R0){let n0=F.indexOf(R0),C0=L0(n0);o=!F.includes(R0)||W0||C0}});let N0=aa.has(u.key),d0=u.key==="ArrowUp"||u.key==="ArrowDown";if(u.which===229||u.altKey&&!d0||u.ctrlKey||u.metaKey||o||ZF(u.key)||N0)return;let g=u.key==="Home"&&M!=null,a=u.key==="End"&&V!=null;if(u.key.length>1&&!d0&&!g&&!a)return;let I0=i?q7(F,w,W.current):null,A0=B(u);q6(u);let F0=x9(T0.keyboard,c),m0=!1;if(u.key==="ArrowUp"||u.key==="ArrowDown"){if(z.current=!0,!i)E.current=h.current;m0=_(A0,{direction:u.key==="ArrowUp"?1:-1,currentValue:I0,event:c,reason:T0.keyboard})}else if(g)z.current=!0,m0=I(M,l0(T0.keyboard,c));else if(a)z.current=!0,m0=I(V,l0(T0.keyboard,c));if(m0)x(E.current??h.current,F0)},onPaste(u){if(u.defaultPrevented||O||K)return;let c="";try{c=u.clipboardData?.getData("text/plain")??""}catch{return}u.preventDefault();let i=u.currentTarget,f=i.selectionStart??F.length,o=i.selectionEnd??F.length,G0=F.slice(0,f)+c+F.slice(o),l=q7(G0,w,W.current);if(l!==null)z.current=!1,d.current=f+c.length,I(l,l0(T0.inputPaste,u.nativeEvent)),A(G0)}},Y,(u)=>t.getValidationProps(K,u)],stateAttributesMapping:D9})});var u5=R(v(),1),aC=R(J5(),1);var wW=R(v(),1),HF=wW.createContext(void 0);function sC(){let $=wW.useContext(HF);if($===void 0)throw Error(V1(44));return $}function oC($,J){let Q=h1(J);if($!=null){let q=J.getBoundingClientRect();return{left:q.left-$/2,top:q.top-$/2,right:q.right+$/2,bottom:q.bottom+$/2}}let Z=Q.visualViewport;if(Z)return{left:Z.offsetLeft,top:Z.offsetTop,right:Z.offsetLeft+Z.width,bottom:Z.offsetTop+Z.height};return{left:0,top:0,right:Q.document.documentElement.clientWidth,bottom:Q.document.documentElement.clientHeight}}function nC($,J){let Q=h1($).visualViewport;if(!Q)return()=>{};function Z(){if(Q)J.current=Q.scale}return Z(),U1(Q,"resize",Z)}var ta={touchAction:"none",WebkitUserSelect:"none",userSelect:"none"},tC=u5.forwardRef(function(J,Q){let{render:Z,className:q,direction:X="horizontal",pixelSensitivity:Y=2,teleportDistance:z,style:K,...W}=J,{state:H,setIsScrubbing:B,disabled:U,readOnly:_,inputRef:L,incrementValue:F,allowInputSyncRef:V,getStepAmount:M,onValueCommitted:D,lastChangedValueRef:N,valueRef:O}=D4(),k=u5.useRef(null),I=u5.useRef(!1),b=u5.useRef(!1),A=u5.useRef(null),w=u5.useRef(null),C=u5.useRef({x:0,y:0}),y=u5.useRef(1),x=U5(),[E,P]=u5.useState(!1),[h,p]=u5.useState(!1),[e,S]=u5.useState(!1);u5.useEffect(()=>{if(!e||!w.current)return;return nC(w.current,y)},[e]);function r(j,d){if(w.current)w.current.style.transform=`translate3d(${j}px,${d}px,0) scale(${1/y.current})`}let $0=v0(({movementX:j,movementY:d})=>{let m=w.current,s=k.current;if(!m||!s)return;let u=oC(z,s),c=C.current,i={x:Math.round(c.x+j),y:Math.round(c.y+d)},f=m.offsetWidth,o=m.offsetHeight;if(i.x+f/2u.right)i.x=u.left-f/2;if(i.y+o/2u.bottom)i.y=u.top-o/2;C.current=i,r(i.x,i.y)}),K0=v0((j,{clientX:d,clientY:m})=>{aC.flushSync(()=>{S(j),B(j)});let s=w.current;if(!s||!j)return;let u={x:d-s.offsetWidth/2,y:m-s.offsetHeight/2};C.current=u,r(u.x,u.y)});u5.useEffect(function(){if(!L.current||U||_||!e)return;let d=0;function m(i){function f(){try{Y1(k.current).exitPointerLock()}catch{}finally{I.current=!1,K0(!1,i),D(N.current??O.current,x9(T0.scrub,i));let o=A.current,G0=L.current;if(!b.current&&o!=null&&G0)o.dispatchEvent(new(h1(G0)).MouseEvent("click",{bubbles:!0,cancelable:!0}));b.current=!1,A.current=null}}if(p1.engine.gecko)x.start(20,f);else f()}function s(i){if(!I.current)return;i.preventDefault(),$0(i);let{movementX:f,movementY:o}=i;if(d+=X==="vertical"?o:f,Math.abs(d)>=Y){d=0,b.current=!0;let G0=X==="vertical"?-o:f,l=M(i),Z0=G0*l;if(Z0!==0)V.current=!0,F(Math.abs(Z0),{direction:Z0>=0?1:-1,event:i,reason:T0.scrub})}}let u=h1(L.current),c=I8(U1(u,"pointerup",m,!0),U1(u,"pointermove",s,!0));return()=>{x.clear(),c()}},[U,_,V,F,e,M,L,K0,$0,X,Y,N,D,O,x]),u5.useEffect(()=>()=>{if(I.current){I.current=!1,B(!1);try{Y1(k.current).exitPointerLock()}catch{}}},[B]),u5.useEffect(function(){let d=k.current;if(!d||U||_)return;function m(s){if(s.touches.length===1)s.preventDefault()}return U1(d,"touchstart",m)},[U,_]);let H0=o0("span",J,{ref:[Q,k],state:H,props:[{role:"presentation",style:ta,async onPointerDown(j){let d=!j.button||j.button===0;if(j.defaultPrevented||_||!d||U)return;let m=j.pointerType==="touch";if(P(m),j.pointerType==="mouse")j.preventDefault(),L.current?.focus();if(I.current=!0,b.current=!1,A.current=w5(j.nativeEvent),K0(!0,j.nativeEvent),!m&&!p1.engine.webkit)try{await Y1(k.current).body.requestPointerLock(),p(!1)}catch(s){p(!0)}finally{if(I.current)K0(!0,j.nativeEvent)}}},W],stateAttributesMapping:D9}),z0=u5.useMemo(()=>({isScrubbing:e,isTouchInput:E,isPointerLockDenied:h,scrubAreaCursorRef:w}),[e,E,h]);return G(HF.Provider,{value:z0,children:H0})});var kW=R(v(),1),eC=R(J5(),1);var ea={position:"fixed",top:0,left:0,pointerEvents:"none"},$S=kW.forwardRef(function(J,Q){let{render:Z,className:q,style:X,...Y}=J,{state:z}=D4(),{isScrubbing:K,isTouchInput:W,isPointerLockDenied:H,scrubAreaCursorRef:B}=sC(),[U,_]=kW.useState(null),L=K&&!p1.engine.webkit&&!W&&!H,F=o0("span",J,{enabled:L,ref:[Q,B,_],state:z,props:[{role:"presentation",style:ea},Y],stateAttributesMapping:D9});return F&&eC.createPortal(F,Y1(U).body)});var XX={fast:{type:"spring",duration:0.08,bounce:0,exit:{duration:0.06}},moderate:{type:"spring",duration:0.16,bounce:0.08,exit:{duration:0.12}},settle:{type:"spring",duration:0.16,bounce:0,exit:{duration:0.12}},slow:{type:"spring",duration:0.24,bounce:0.12,exit:{duration:0.16}}};var y$={normal:"'wght' 400, 'opsz' 14",medium:"'wght' 450, 'opsz' 15",semibold:"'wght' 550, 'opsz' 20",bold:"'wght' 700, 'opsz' 25"};var X7=R(v(),1);var BF={pill:{item:"rounded-[20px]",bg:"rounded-[20px]",focusRing:"rounded-[22px]",mergedBg:"rounded-2xl",container:"rounded-3xl",button:"rounded-[20px]",input:"rounded-[20px]",bgRadius:20,mergedRadius:16},rounded:{item:"rounded-lg",bg:"rounded-lg",focusRing:"rounded-[10px]",mergedBg:"rounded-lg",container:"rounded-xl",button:"rounded-lg",input:"rounded-lg",bgRadius:8,mergedRadius:8}},$t=X7.createContext(null);function u9(){let $=X7.useContext($t);if(!$)return BF.pill;return $.classes}var ZS=s0.createContext(null);function Jt({value:$,children:J}){return G(ZS.Provider,{value:$,children:J})}function F8($){return Math.max(0,Math.min(1,$))}function v6($){return Math.max(0,Math.min(255,$))}function VF($,J,Q){let Z=Q*J,q=($%360+360)%360/60,X=Z*(1-Math.abs(q%2-1)),Y=0,z=0,K=0;if(q<1)Y=Z,z=X,K=0;else if(q<2)Y=X,z=Z,K=0;else if(q<3)Y=0,z=Z,K=X;else if(q<4)Y=0,z=X,K=Z;else if(q<5)Y=X,z=0,K=Z;else Y=Z,z=0,K=X;let W=Q-Z;return{r:(Y+W)*255,g:(z+W)*255,b:(K+W)*255}}function RQ($,J,Q){$/=255,J/=255,Q/=255;let Z=Math.max($,J,Q),q=Math.min($,J,Q),X=Z,Y=Z-q,z=Z===0?0:Y/Z,K=0;if(Y>0){if(Z===$)K=(J-Q)/Y%6;else if(Z===J)K=(Q-$)/Y+2;else K=($-J)/Y+4;if(K*=60,K<0)K+=360}return{h:K,s:z,v:X}}function MF($,J,Q){$/=255,J/=255,Q/=255;let Z=Math.max($,J,Q),q=Math.min($,J,Q),X=(Z+q)/2,Y=Z-q,z=0,K=0;if(Y>0){if(K=X>0.5?Y/(2-Z-q):Y/(Z+q),Z===$)z=(J-Q)/Y%6;else if(Z===J)z=(Q-$)/Y+2;else z=($-J)/Y+4;if(z*=60,z<0)z+=360}return{h:z,s:K,l:X}}function qS($,J,Q){let Z=(1-Math.abs(2*Q-1))*J,q=($%360+360)%360/60,X=Z*(1-Math.abs(q%2-1)),Y=0,z=0,K=0;if(q<1)Y=Z,z=X;else if(q<2)Y=X,z=Z;else if(q<3)z=Z,K=X;else if(q<4)z=X,K=Z;else if(q<5)Y=X,K=Z;else Y=Z,K=X;let W=Q-Z/2;return{r:(Y+W)*255,g:(z+W)*255,b:(K+W)*255}}function UF($){return $=$/255,$<=0.04045?$/12.92:Math.pow(($+0.055)/1.055,2.4)}function _F($){let J=$<=0.0031308?12.92*$:1.055*Math.pow($,0.4166666666666667)-0.055;return F8(J)*255}function Qt($,J,Q){let Z=0.4122214708*$+0.5363325363*J+0.0514459929*Q,q=0.2119034982*$+0.6806995451*J+0.1073969566*Q,X=0.0883024619*$+0.2817188376*J+0.6299787005*Q,Y=Math.cbrt(Z),z=Math.cbrt(q),K=Math.cbrt(X);return{L:0.2104542553*Y+0.793617785*z-0.0040720468*K,a:1.9779984951*Y-2.428592205*z+0.4505937099*K,b:0.0259040371*Y+0.7827717662*z-0.808675766*K}}function Zt($,J,Q){let Z=$+0.3963377774*J+0.2158037573*Q,q=$-0.1055613458*J-0.0638541728*Q,X=$-0.0894841775*J-1.291485548*Q,Y=Z*Z*Z,z=q*q*q,K=X*X*X;return{r:4.0767416621*Y-3.3077115913*z+0.2309699292*K,g:-1.2684380046*Y+2.6097574011*z-0.3413193965*K,b:-0.0041960863*Y-0.7034186147*z+1.707614701*K}}function DF($,J,Q){let Z=UF($),q=UF(J),X=UF(Q),Y=Qt(Z,q,X),z=Math.sqrt(Y.a*Y.a+Y.b*Y.b),K=Math.atan2(Y.b,Y.a)*180/Math.PI;if(K<0)K+=360;return{L:Y.L,C:z,H:K}}function XS($,J,Q){let Z=J*Math.cos(Q*Math.PI/180),q=J*Math.sin(Q*Math.PI/180),X=Zt($,Z,q);return{r:v6(_F(X.r)),g:v6(_F(X.g)),b:v6(_F(X.b))}}function P$($){return Math.round(v6($)).toString(16).padStart(2,"0")}function CQ($,J,Q,Z){if(Z>=1)return`#${P$($)}${P$(J)}${P$(Q)}`;return`#${P$($)}${P$(J)}${P$(Q)}${P$(Z*255)}`}function qt($){if($.length===3)return $.split("").map((J)=>J+J).join("");if($.length===4)return $.split("").map((J)=>J+J).join("");return $}function Xt($){let J=$.trim().match(/^#?([0-9a-fA-F]{3,8})$/);if(!J)return null;let Q=J[1];if(Q.length===3||Q.length===4)Q=qt(Q);if(Q.length===6)return{r:parseInt(Q.slice(0,2),16),g:parseInt(Q.slice(2,4),16),b:parseInt(Q.slice(4,6),16),a:1};if(Q.length===8)return{r:parseInt(Q.slice(0,2),16),g:parseInt(Q.slice(2,4),16),b:parseInt(Q.slice(4,6),16),a:parseInt(Q.slice(6,8),16)/255};return null}function Y2($){let J=$.trim();if(!J)return null;if(J.startsWith("#")||/^[0-9a-fA-F]{3,8}$/.test(J))return Xt(J);let Q=J.match(/^rgba?\(\s*([^)]+)\)$/i);if(Q){let X=Q[1].split(/[\s,/]+/).filter(Boolean);if(X.length<3)return null;let Y=parseFloat(X[0]),z=parseFloat(X[1]),K=parseFloat(X[2]),W=1;if(X[3]!==void 0)W=X[3].endsWith("%")?parseFloat(X[3])/100:parseFloat(X[3]);if([Y,z,K,W].some(Number.isNaN))return null;return{r:v6(Y),g:v6(z),b:v6(K),a:F8(W)}}let Z=J.match(/^hsla?\(\s*([^)]+)\)$/i);if(Z){let X=Z[1].split(/[\s,/]+/).filter(Boolean);if(X.length<3)return null;let Y=parseFloat(X[0]),z=X[1].endsWith("%")?parseFloat(X[1])/100:parseFloat(X[1]),K=X[2].endsWith("%")?parseFloat(X[2])/100:parseFloat(X[2]),W=1;if(X[3]!==void 0)W=X[3].endsWith("%")?parseFloat(X[3])/100:parseFloat(X[3]);if([Y,z,K,W].some(Number.isNaN))return null;let H=qS(Y,F8(z),F8(K));return{r:v6(H.r),g:v6(H.g),b:v6(H.b),a:F8(W)}}let q=J.match(/^oklch\(\s*([^)]+)\)$/i);if(q){let X=q[1].split(/[\s,/]+/).filter(Boolean);if(X.length<3)return null;let Y=X[0].endsWith("%")?parseFloat(X[0])/100:parseFloat(X[0]),z=parseFloat(X[1]),K=parseFloat(X[2]),W=1;if(X[3]!==void 0)W=X[3].endsWith("%")?parseFloat(X[3])/100:parseFloat(X[3]);if([Y,z,K,W].some(Number.isNaN))return null;let H=XS(F8(Y),Math.max(0,z),K);return{r:v6(H.r),g:v6(H.g),b:v6(H.b),a:F8(W)}}return null}var IW=null;function YS($){let J=Y2($);if(J)return J;let Q=$.trim();if(!Q||typeof document>"u")return null;if(!IW){if(IW=document.createElement("canvas").getContext("2d"),!IW)return null}let Z=IW;Z.fillStyle="#000000",Z.fillStyle=Q;let q=String(Z.fillStyle);Z.fillStyle="#ffffff",Z.fillStyle=Q;let X=String(Z.fillStyle);if(q!==X)return null;return Y2(q)}function LF($,J,Q,Z){let{r:q,g:X,b:Y}=VF($,J,Q),z=MF(q,X,Y),K=DF(q,X,Y),W=CQ(q,X,Y,Z),H=Z>=1?`rgb(${Math.round(q)}, ${Math.round(X)}, ${Math.round(Y)})`:`rgba(${Math.round(q)}, ${Math.round(X)}, ${Math.round(Y)}, ${Number(Z.toFixed(3))})`,B=Z>=1?`hsl(${Math.round(z.h)}, ${Math.round(z.s*100)}%, ${Math.round(z.l*100)}%)`:`hsla(${Math.round(z.h)}, ${Math.round(z.s*100)}%, ${Math.round(z.l*100)}%, ${Number(Z.toFixed(3))})`,U=Z>=1?`oklch(${(K.L*100).toFixed(1)}% ${K.C.toFixed(3)} ${K.H.toFixed(1)})`:`oklch(${(K.L*100).toFixed(1)}% ${K.C.toFixed(3)} ${K.H.toFixed(1)} / ${Number(Z.toFixed(3))})`;return{h:$,s:J,v:Q,a:Z,r:Math.round(q),g:Math.round(X),b:Math.round(Y),hex:W,rgb:H,hsl:B,oklch:U}}function FF($,J){switch(J){case"hex":return $.hex;case"rgb":return $.rgb;case"hsl":return $.hsl;case"oklch":return $.oklch}}var Yt=280,zt=156,zS={backgroundImage:"conic-gradient(var(--checker-a) 0 25%, var(--checker-b) 0 50%, var(--checker-a) 0 75%, var(--checker-b) 0)",backgroundSize:"8px 8px"};function Kt({h:$,s:J,v:Q,onChange:Z}){let q=s0.useRef(null),[X,Y]=s0.useState(!1),z=s0.useRef(!1),[K,W]=s0.useState(!1),[H,B]=s0.useState(!1),[U,_]=s0.useState(null),L=u9(),F=s0.useCallback((w,C)=>{let y=q.current?.getBoundingClientRect();if(!y)return;let x=F8((w-y.left)/y.width),E=F8((C-y.top)/y.height);Z(x,1-E)},[Z]),V=s0.useCallback((w,C)=>{let y=q.current?.getBoundingClientRect();if(!y)return;_({x:F8((w-y.left)/y.width)*100,y:F8((C-y.top)/y.height)*100})},[]),M=s0.useCallback((w)=>{if(w.pointerType==="mouse"&&w.button!==0)return;w.preventDefault(),Y(!0),z.current=!1,w.currentTarget.setPointerCapture(w.pointerId),F(w.clientX,w.clientY)},[F]),D=s0.useCallback((w)=>{if(V(w.clientX,w.clientY),!X)return;z.current=!0,F(w.clientX,w.clientY)},[X,F,V]),N=s0.useCallback(()=>{Y(!1),z.current=!1},[]),O=s0.useCallback((w)=>{let C=w.shiftKey?0.1:0.01,y=J,x=Q,E=!0;if(w.key==="ArrowLeft")y=F8(J-C);else if(w.key==="ArrowRight")y=F8(J+C);else if(w.key==="ArrowUp")x=F8(Q+C);else if(w.key==="ArrowDown")x=F8(Q-C);else E=!1;if(E)w.preventDefault(),Z(y,x)},[Z,J,Q]),{r:k,g:I,b}=VF($,J,Q),A=`rgb(${Math.round(k)}, ${Math.round(I)}, ${Math.round(b)})`;return T("div",{ref:q,role:"application","aria-label":"Saturation and brightness",tabIndex:0,onFocus:(w)=>{if(w.currentTarget.matches(":focus-visible"))W(!0)},onBlur:()=>W(!1),onPointerEnter:()=>B(!0),onPointerLeave:()=>{B(!1),_(null)},onPointerDown:M,onPointerMove:D,onPointerUp:N,onKeyDown:O,className:b0("relative w-full select-none touch-none cursor-none outline-none",L.bg),style:{height:zt,boxShadow:K?"0 0 0 2px var(--focus-ring, #6B97FF)":void 0},children:[G("div",{className:b0("absolute inset-0 overflow-hidden",L.bg==="rounded-[20px]"?"rounded-2xl":L.bg),style:{background:`linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${$}, 100%, 50%))`}}),G(jq.div,{className:"absolute pointer-events-none rounded-full",initial:!1,animate:{left:`${J*100}%`,top:`${(1-Q)*100}%`,width:18,height:18},transition:{duration:0},style:{transform:"translate(-50%, -50%)",border:"1px solid white",boxShadow:"0 0 0 1px rgba(0,0,0,1)",backgroundColor:A}}),H&&!X&&U&&G("div",{className:"absolute pointer-events-none rounded-full",style:{left:`${U.x}%`,top:`${U.y}%`,width:18,height:18,transform:"translate(-50%, -50%)",border:"2px solid rgba(255, 255, 255, 0.55)",boxShadow:"0 0 0 1px rgba(0, 0, 0, 0.2)"}})]})}function KS({value:$,onChange:J,min:Q,max:Z,step:q,trackStyle:X,thumbColor:Y,thumbBorderColor:z,className:K,...W}){return T(eQ,{className:b0("relative flex h-8 w-full touch-none select-none items-center",K),value:[$],min:Q,max:Z,step:q,onValueChange:(H)=>J(H[0]??$),...W,children:[G(oX,{className:"relative h-4 w-full grow overflow-hidden rounded-full border border-border bg-muted",style:X,children:G(nX,{className:"absolute h-full bg-transparent"})}),G(aX,{className:"block h-5 w-5 rounded-full border-2 bg-background shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",style:{backgroundColor:Y,borderColor:z}})]})}function Gt({h:$,onChange:J}){let Q=`hsl(${$}, 100%, 50%)`;return G(KS,{value:$,onChange:J,min:0,max:360,step:1,thumbColor:Q,thumbBorderColor:"rgba(255,255,255,0.9)",trackStyle:{background:"linear-gradient(to right, hsl(0,100%,50%), hsl(60,100%,50%), hsl(120,100%,50%), hsl(180,100%,50%), hsl(240,100%,50%), hsl(300,100%,50%), hsl(360,100%,50%))",borderColor:"transparent"},"aria-label":"Hue"})}function Wt({a:$,solidColor:J,solidR:Q,solidG:Z,solidB:q,onChange:X}){let Y=`rgba(${Q}, ${Z}, ${q}, 0)`;return G(KS,{value:Math.round($*100),onChange:(z)=>X(z/100),min:0,max:100,step:1,thumbColor:J,thumbBorderColor:"rgba(255,255,255,0.9)",trackStyle:{backgroundImage:`linear-gradient(to right, ${Y} 0%, ${J} 98%), conic-gradient(var(--checker-a) 0 25%, var(--checker-b) 0 50%, var(--checker-a) 0 75%, var(--checker-b) 0)`,backgroundSize:"100% 100%, 8px 8px",borderWidth:0},"aria-label":"Alpha"})}var JS={hex:"HEX",rgb:"RGB",hsl:"HSL",oklch:"OKLCH"},Ht=["hex","rgb","hsl","oklch"],Bt=BF.rounded;function Ut({value:$,label:J,checked:Q}){let Z=u9();return G(M4.RadioItem,{value:$,label:J,closeOnClick:!0,render:G("div",{className:b0("relative z-10 flex items-center px-3 py-2 text-[13px] cursor-pointer outline-none",Z.item)}),children:G("span",{className:b0("transition-colors duration-80",Q?"text-foreground":"text-muted-foreground"),style:{fontVariationSettings:Q?y$.semibold:y$.normal},children:J})})}function _t({value:$,onChange:J,open:Q,defaultOpen:Z=!1}){let[q,X]=s0.useState(Z),Y=Q!==void 0,z=Y?Q:q,K=s0.useRef(null),W=u9(),H=s0.useContext(ZS),B=b4;return T(M4.Root,{open:z,onOpenChange:(U)=>{if(!Y)X(U)},actionsRef:K,modal:!1,children:[T(M4.Trigger,{className:b0("flex items-center justify-between gap-2 h-9 px-3 text-[13px] bg-transparent hover:bg-hover hover:text-foreground transition-colors duration-80 outline-none focus-visible:ring-1 focus-visible:ring-[color:var(--focus-ring,#6B97FF)] cursor-pointer border border-border",z?"bg-active text-foreground":"text-muted-foreground active:bg-active",W.input),style:{fontVariationSettings:y$.medium},children:[G("span",{children:JS[$]}),G(B,{size:14,strokeWidth:1.5,className:b0("text-muted-foreground transition-transform duration-150",z&&"rotate-180")})]}),G(M4.Portal,{container:H??void 0,children:G(M4.Positioner,{side:"bottom",align:"start",sideOffset:6,className:"z-[60] outline-none",children:G(jq.div,{initial:{opacity:0,y:-4,scaleY:0.96},animate:z?{opacity:1,y:0,scaleY:1}:{opacity:0,y:-4,scaleY:0.96},transition:z?XX.fast:XX.fast.exit,style:{transformOrigin:"top center"},onAnimationComplete:()=>{if(!z)K.current?.unmount()},children:G(M4.Popup,{className:b0(`relative flex flex-col gap-0.5 min-w-[var(--anchor-width)] bg-popover ${Bt.container} p-1 select-none outline-none`),children:G(M4.RadioGroup,{value:$,onValueChange:(U)=>J(U),className:"contents",children:Ht.map((U)=>G(Ut,{value:U,label:JS[U],checked:$===U},U))})})})})})]})}var GS=s0.forwardRef(({value:$,onCommit:J,ariaLabel:Q,width:Z,className:q,inputClassName:X,align:Y="left",prefix:z,inputMode:K="text",nudgeStep:W,nudgeShiftStep:H,hasPercent:B=!1,decimals:U,min:_,max:L,wrap:F=!1},V)=>{let[M,D]=s0.useState($),N=s0.useRef(!1),O=u9();s0.useEffect(()=>{if(!N.current)D($)},[$]);let k=(A)=>U!=null?A.toFixed(U):String(Math.round(A)),I=(A)=>{let w=A;if(F&&_!=null&&L!=null){let x=L-_;w=((w-_)%x+x)%x+_}else{if(_!=null)w=Math.max(_,w);if(L!=null)w=Math.min(L,w)}let C=k(w),y=B?`${C}%`:C;D(y),J(y)},b=(A,w)=>{let C=w?H??10:W??1,y=parseFloat(M.replace("%",""));if(Number.isNaN(y))return;I(y+A*C)};return T("div",{className:b0("flex items-center h-9 px-2 bg-transparent hover:bg-hover active:bg-active transition-colors duration-80 focus-within:ring-1 focus-within:ring-[color:var(--highlight,#6B97FF)] select-none border border-border",O.input,q),style:{width:Z},children:[z&&G("span",{className:"text-[12px] text-muted-foreground mr-1 select-none",children:z}),G("input",{ref:V,value:M,onChange:(A)=>D(A.target.value),onFocus:(A)=>{N.current=!0,A.currentTarget.select()},onBlur:()=>{if(N.current=!1,M!==$){let A=parseFloat(M.replace("%",""));if(!Number.isNaN(A)&&(_!=null||L!=null))I(A);else J(M)}else D($)},onKeyDown:(A)=>{if(A.key==="Enter")A.currentTarget.blur();else if(A.key==="Escape")D($),A.currentTarget.blur();else if((W!=null||H!=null)&&(A.key==="ArrowUp"||A.key==="ArrowDown"))A.preventDefault(),b(A.key==="ArrowUp"?1:-1,A.shiftKey)},inputMode:K,"aria-label":Q,className:b0("flex-1 min-w-0 bg-transparent text-foreground text-[13px] outline-none tabular-nums",Y==="center"&&"text-center",Y==="right"&&"text-right",X),style:{fontVariationSettings:y$.medium}})]})});GS.displayName="TextColorInput";var WS=s0.forwardRef(({value:$,onCommit:J,ariaLabel:Q,width:Z,className:q,inputClassName:X,align:Y="left",prefix:z,inputMode:K="numeric",nudgeStep:W,nudgeShiftStep:H,hasPercent:B=!1,decimals:U,min:_,max:L,wrap:F=!1},V)=>{let M=u9(),D=s0.useRef(null),[N,O]=s0.useState(!1),k=s0.useRef(!1),I=parseFloat(String($).replace("%","")),b=Number.isNaN(I)?null:I,A=s0.useMemo(()=>{let y={useGrouping:!1};if(U!=null)y.minimumFractionDigits=U,y.maximumFractionDigits=U;else y.maximumFractionDigits=0;if(B)y.style="unit",y.unit="percent";return y},[U,B]),w=s0.useCallback((y)=>{if(D.current=y,typeof V==="function")V(y);else if(V)V.current=y},[V]),C=s0.useCallback((y)=>{let x=y;if(F&&_!=null&&L!=null){if(x<_||x>L){let P=L-_;x=((x-_)%P+P)%P+_}}else{if(_!=null)x=Math.max(_,x);if(L!=null)x=Math.min(L,x)}let E=U!=null?x.toFixed(U):String(Math.round(x));J(B?`${E}%`:E)},[F,_,L,U,B,J]);return G(E$.Root,{value:b,onValueChange:(y,x)=>{if(y==null)return;let E=x.reason;if(E==="input-change"||E==="input-paste"||E==="input-clear")return;C(y)},onValueCommitted:(y,x)=>{if(x.reason==="scrub")k.current=!1,D.current?.blur()},min:F?void 0:_,max:F?void 0:L,step:W??1,largeStep:H??10,format:A,className:b0("flex items-center h-9 bg-transparent hover:bg-hover active:bg-active transition-colors duration-80 focus-within:ring-1 focus-within:ring-[color:var(--highlight,#6B97FF)] select-none border border-border",M.input,q),style:{width:Z},children:T(E$.ScrubArea,{direction:"horizontal",pixelSensitivity:1,onPointerDownCapture:()=>{k.current=!0},onClick:()=>{k.current=!1,O(!0),D.current?.focus(),D.current?.select()},className:b0("flex flex-1 min-w-0 items-center self-stretch px-2",!N&&"cursor-ew-resize"),children:[G(E$.ScrubAreaCursor,{className:"drop-shadow-[0_1px_1px_rgba(0,0,0,0.4)]",children:G("svg",{width:24,height:14,viewBox:"0 0 24 14",fill:"#000",stroke:"#fff",strokeWidth:1,"aria-hidden":"true",children:G("path",{d:"M0.5 7l5-5v3.5h13V2l5 5-5 5V8.5h-13V12l-5-5z"})})}),z&&G("span",{className:"text-[12px] text-muted-foreground mr-1 select-none",children:z}),G(E$.Input,{ref:w,"aria-label":Q,inputMode:K,onPointerDown:(y)=>{if(N)y.stopPropagation()},onFocus:(y)=>{if(k.current)return;O(!0),y.currentTarget.select()},onBlur:()=>{O(!1)},onKeyDown:(y)=>{if(y.key==="Enter")y.currentTarget.blur();else if(y.key==="Escape"){let x=y.currentTarget,E=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"value")?.set;if(E&&b!=null){let P=U!=null?b.toFixed(U):String(Math.round(b));E.call(x,B?`${P}%`:P),x.dispatchEvent(new Event("input",{bubbles:!0}))}x.blur()}},className:b0("flex-1 min-w-0 bg-transparent text-foreground text-[13px] outline-none tabular-nums",Y==="center"&&"text-center",Y==="right"&&"text-right",!N&&"pointer-events-none",X),style:{fontVariationSettings:y$.medium}})]})})});WS.displayName="ScrubColorInput";var N9=s0.forwardRef(({scrubbable:$=!1,...J},Q)=>$?G(WS,{ref:Q,...J}):G(GS,{ref:Q,...J}));N9.displayName="ColorInput";function Lt({onPick:$}){let[J,Q]=s0.useState(!1),Z=u9(),q=QS;if(s0.useEffect(()=>{Q(typeof window<"u"&&"EyeDropper"in window)},[]),!J)return null;return G("button",{type:"button",onClick:async()=>{try{let K=await new window.EyeDropper().open();$(K.sRGBHex)}catch{}},"aria-label":"Pick color from screen",className:b0("flex items-center justify-center h-9 px-3 text-muted-foreground bg-transparent hover:bg-hover hover:text-foreground active:bg-active transition-colors duration-80 outline-none focus-visible:ring-1 focus-visible:ring-[color:var(--focus-ring,#6B97FF)] cursor-pointer border border-border",Z.input),children:G(q,{size:16,strokeWidth:1.5})})}function Ft({color:$,size:J=24,className:Q,style:Z}){let q=u9();return G("span",{className:b0("inline-block relative shrink-0 overflow-hidden",q.bg,Q),style:{width:J,height:J,...zS,boxShadow:"inset 0 0 0 1px rgba(127,127,127,0.25)",...Z},children:G("span",{className:"absolute inset-0",style:{backgroundColor:$}})})}var HS=s0.forwardRef(({color:$,size:J=28,selected:Q,className:Z,onMouseEnter:q,onMouseLeave:X,...Y},z)=>{let K=u9(),[W,H]=s0.useState(!1),B=Q?"inset 0 0 0 1px rgba(127,127,127,0.25), 0 0 0 2px var(--background), 0 0 0 4px #6B97FF":W?"inset 0 0 0 1px rgba(127,127,127,0.25), 0 0 0 2px var(--background), 0 0 0 4px rgba(127,127,127,0.4)":"inset 0 0 0 1px rgba(127,127,127,0.25)";return G("button",{ref:z,type:"button","aria-label":`Select color ${$}`,className:b0("relative shrink-0 overflow-hidden cursor-pointer outline-none transition-shadow duration-100",K.bg,Z),style:{width:J,height:J,...zS,boxShadow:B},onMouseEnter:(U)=>{H(!0),q?.(U)},onMouseLeave:(U)=>{H(!1),X?.(U)},...Y,children:G("span",{className:"absolute inset-0",style:{backgroundColor:$}})})});HS.displayName="ColorSwatch";function Vt({swatches:$,current:J,onPick:Q}){let Z=s0.useMemo(()=>{let Y=Y2(J);return Y?CQ(Y.r,Y.g,Y.b,Y.a).toLowerCase():""},[J]),[q,X]=s0.useState({});return s0.useEffect(()=>{let Y={};for(let z of $)if(!Y2(z)){let K=YS(z);if(K)Y[z]=CQ(K.r,K.g,K.b,K.a).toLowerCase()}X(Y)},[$]),G("div",{className:"flex flex-wrap gap-2",children:$.map((Y,z)=>{let K=Y2(Y),H=(K?CQ(K.r,K.g,K.b,K.a).toLowerCase():q[Y]??Y.toLowerCase())===Z;return G(HS,{color:Y,size:28,selected:H,onClick:()=>Q(Y)},`${Y}-${z}`)})})}var BS=s0.forwardRef(({value:$,defaultValue:J="#6B97FF",onValueChange:Q,format:Z,defaultFormat:q="hex",onFormatChange:X,swatches:Y,hideEyedropper:z,formatOpen:K,defaultFormatOpen:W,className:H,...B},U)=>{let _=$!==void 0,[L,F]=s0.useState($??J),V=_?$:L,M=Z!==void 0,[D,N]=s0.useState(q),O=M?Z:D,k=s0.useMemo(()=>{let t=Y2(V);if(!t)return{h:0,s:1,v:1,a:1};let H0=RQ(t.r,t.g,t.b);return{h:H0.s===0?0:H0.h,s:H0.s,v:H0.v,a:t.a}},[]),[I,b]=s0.useState(k),A=s0.useRef(null),w=s0.useRef("");s0.useEffect(()=>{if(!_)return;let t=w.current,H0=$;if(H0===t)return;let z0=Y2(H0);if(!z0)return;A.current=null;let j=RQ(z0.r,z0.g,z0.b);b((d)=>({h:j.s===0?d.h:j.h,s:j.s,v:j.v,a:z0.a}))},[$,_]);let C=s0.useMemo(()=>LF(I.h,I.s,I.v,I.a),[I]),y=s0.useCallback((t)=>{let H0={...I,...t};b(H0);let z0=LF(H0.h,H0.s,H0.v,H0.a),j=FF(z0,O);if(w.current=j,!_)F(j);Q?.(j,z0)},[I,O,_,Q]),x=s0.useCallback((t)=>{if(!M)N(t);X?.(t);let H0=FF(C,t);if(w.current=H0,!_)F(H0);Q?.(H0,C)},[M,_,X,Q,C]),E=s0.useCallback((t)=>{let H0=YS(t);if(!H0)return;A.current=null;let z0=RQ(H0.r,H0.g,H0.b),j={h:z0.s===0?I.h:z0.h,s:z0.s,v:z0.v,a:H0.a};b(j);let d=LF(j.h,j.s,j.v,j.a),m=FF(d,O);if(w.current=m,!_)F(m);Q?.(m,d)},[I.h,O,_,Q]),P=s0.useCallback((t)=>{E(t)},[E]),h=s0.useCallback((t)=>{E(t)},[E]),p=s0.useMemo(()=>VF(I.h,I.s,I.v),[I.h,I.s,I.v]),e=Math.round(p.r),S=Math.round(p.g),r=Math.round(p.b),$0=`rgb(${e}, ${S}, ${r})`,K0=u9();return T("div",{ref:U,className:b0("flex flex-col gap-2 p-3",K0.container,H),style:{width:Yt},...B,children:[G(Kt,{h:I.h,s:I.s,v:I.v,onChange:(t,H0)=>y({s:t,v:H0})}),T("div",{className:"flex flex-col [&>*]:mb-0 [&>*+*]:-mt-px",children:[G(Gt,{h:I.h,onChange:(t)=>{A.current=null,y({h:t})}}),G(Wt,{a:I.a,solidColor:$0,solidR:e,solidG:S,solidB:r,onChange:(t)=>y({a:t})})]}),T("div",{className:"grid grid-cols-2 gap-2",children:[G(_t,{value:O,onChange:x,open:K,defaultOpen:W}),!z&&G(Lt,{onPick:h})]}),G(Mt,{parsed:C,format:O,oklchHue:A.current,onChannelChange:(t,H0)=>{let z0={...C};switch(t){case"hex":E(H0);return;case"r":case"g":case"b":{A.current=null;let j=t==="r"?Number(H0):z0.r,d=t==="g"?Number(H0):z0.g,m=t==="b"?Number(H0):z0.b,s=RQ(j,d,m);y({h:s.s===0?I.h:s.h,s:s.s,v:s.v});return}case"hSL":case"sSL":case"lSL":{if(t==="hSL")A.current=null;let j=MF(z0.r,z0.g,z0.b),d=t==="hSL"?Number(H0):j.h,m=t==="sSL"?Number(H0)/100:j.s,s=t==="lSL"?Number(H0)/100:j.l,u=qS(d,F8(m),F8(s)),c=RQ(u.r,u.g,u.b);y({h:c.s===0?d:c.h,s:c.s,v:c.v});return}case"L":case"C":case"H":{let j=DF(z0.r,z0.g,z0.b),d=A.current??j.H,m=t==="L"?Number(H0)/100:j.L,s=t==="C"?Number(H0):j.C,u=t==="H"?Number(H0):d;A.current=u;let c=XS(F8(m),Math.max(0,s),u),i=RQ(c.r,c.g,c.b);y({h:i.s===0?I.h:i.h,s:i.s,v:i.v});return}case"alphaPercent":{let j=F8(Number(H0)/100);y({a:j});return}}}}),Y&&Y.length>0&&G(Vt,{swatches:Y,current:C.hex,onPick:P})]})});BS.displayName="ColorPicker";function Mt({parsed:$,format:J,oklchHue:Q,onChannelChange:Z}){let q=Math.round($.a*100);if(J==="hex"){let z=$.hex.replace(/^#/,"").toUpperCase();return T("div",{className:"grid grid-cols-2 gap-2",children:[G(m9,{label:"Hex",children:G(N9,{value:z,onCommit:(K)=>Z("hex",K.startsWith("#")?K:`#${K}`),ariaLabel:"Hex value",prefix:"#"})}),G(TW,{value:q,onCommit:(K)=>Z("alphaPercent",String(K))})]})}if(J==="rgb")return T("div",{className:"grid grid-cols-4 gap-1",children:[G(m9,{label:"Red",children:G(N9,{value:String($.r),onCommit:(z)=>Z("r",z),ariaLabel:"Red",align:"center",inputMode:"numeric",nudgeStep:1,nudgeShiftStep:10,scrubbable:!0,min:0,max:255})}),G(m9,{label:"Green",children:G(N9,{value:String($.g),onCommit:(z)=>Z("g",z),ariaLabel:"Green",align:"center",inputMode:"numeric",nudgeStep:1,nudgeShiftStep:10,scrubbable:!0,min:0,max:255})}),G(m9,{label:"Blue",children:G(N9,{value:String($.b),onCommit:(z)=>Z("b",z),ariaLabel:"Blue",align:"center",inputMode:"numeric",nudgeStep:1,nudgeShiftStep:10,scrubbable:!0,min:0,max:255})}),G(TW,{value:q,onCommit:(z)=>Z("alphaPercent",String(z))})]});if(J==="hsl"){let z=MF($.r,$.g,$.b);return T("div",{className:"grid grid-cols-4 gap-1",children:[G(m9,{label:"Hue",children:G(N9,{value:String(Math.round(z.h)),onCommit:(K)=>Z("hSL",K),ariaLabel:"Hue",align:"center",inputMode:"numeric",nudgeStep:1,nudgeShiftStep:10,scrubbable:!0,min:0,max:360,wrap:!0})}),G(m9,{label:"Saturation",children:G(N9,{value:String(Math.round(z.s*100)),onCommit:(K)=>Z("sSL",K),ariaLabel:"Saturation",align:"center",inputMode:"numeric",nudgeStep:1,nudgeShiftStep:10,scrubbable:!0,min:0,max:100})}),G(m9,{label:"Lightness",children:G(N9,{value:String(Math.round(z.l*100)),onCommit:(K)=>Z("lSL",K),ariaLabel:"Lightness",align:"center",inputMode:"numeric",nudgeStep:1,nudgeShiftStep:10,scrubbable:!0,min:0,max:100})}),G(TW,{value:q,onCommit:(K)=>Z("alphaPercent",String(K))})]})}let X=DF($.r,$.g,$.b),Y=Q??X.H;return T("div",{className:"grid grid-cols-4 gap-1",children:[G(m9,{label:"Lightness",children:G(N9,{value:(X.L*100).toFixed(0),onCommit:(z)=>Z("L",z),ariaLabel:"Lightness",align:"center",inputMode:"decimal",nudgeStep:1,nudgeShiftStep:10,scrubbable:!0,min:0,max:100})}),G(m9,{label:"Chroma",children:G(N9,{value:X.C.toFixed(2),onCommit:(z)=>Z("C",z),ariaLabel:"Chroma",align:"center",inputMode:"decimal",nudgeStep:0.01,nudgeShiftStep:0.1,decimals:2,scrubbable:!0,min:0,max:0.4})}),G(m9,{label:"Hue",children:G(N9,{value:Y.toFixed(0),onCommit:(z)=>Z("H",z),ariaLabel:"Hue",align:"center",inputMode:"numeric",nudgeStep:1,nudgeShiftStep:10,scrubbable:!0,min:0,max:360,wrap:!0})}),G(TW,{value:q,onCommit:(z)=>Z("alphaPercent",String(z))})]})}function m9({label:$,children:J}){return T(H1,{delayDuration:300,children:[G(B1,{asChild:!0,children:G("span",{className:"contents",children:J})}),G(W1,{children:$})]})}function TW({value:$,onCommit:J}){return G(m9,{label:"Alpha",children:G(N9,{value:`${$}%`,onCommit:(Q)=>{let Z=parseFloat(Q.replace("%",""));if(Number.isNaN(Z))return;J(Math.max(0,Math.min(100,Math.round(Z))))},ariaLabel:"Alpha",align:"center",inputMode:"numeric",nudgeStep:1,nudgeShiftStep:10,hasPercent:!0,scrubbable:!0,min:0,max:100})})}var NF=s0.forwardRef(({triggerAriaLabel:$,triggerLabel:J,triggerLabelPosition:Q="left",triggerShowValue:Z=!0,triggerShowRemove:q=!1,onTriggerRemove:X,triggerClassName:Y,side:z="bottom",align:K="start",sideOffset:W=6,alignOffset:H=0,open:B,defaultOpen:U=!1,onOpenChange:_,...L},F)=>{let V=B!==void 0,[M,D]=s0.useState(U),N=V?B:M,O=s0.useRef(null),[k,I]=s0.useState(null),b=u9(),A=s0.useCallback((S)=>{if(!V)D(S);_?.(S)},[V,_]),w=L.value!==void 0,[C,y]=s0.useState(L.value??L.defaultValue??"#6B97FF"),x=w?L.value:C,E=s0.useCallback((S,r)=>{if(!w)y(S);L.onValueChange?.(S,r)},[w,L]);s0.useEffect(()=>{if(N)return;let S=setTimeout(()=>O.current?.unmount(),150);return()=>clearTimeout(S)},[N]);let P=n9,h=s0.useMemo(()=>Y2(x),[x]),p=h?CQ(h.r,h.g,h.b,h.a):x,e=h?CQ(h.r,h.g,h.b,h.a).toUpperCase():x;return G(J2.Root,{open:N,onOpenChange:A,actionsRef:O,modal:!1,children:T("div",{ref:F,className:"inline-flex",children:[T(J2.Trigger,{"aria-label":$,className:b0("flex items-center gap-2 h-9 px-2 border border-border bg-transparent hover:bg-hover transition-colors duration-80 outline-none focus-visible:ring-1 focus-visible:ring-[color:var(--focus-ring,#6B97FF)] cursor-pointer",b.input,Y),style:{fontVariationSettings:y$.medium},children:[J&&Q==="left"&&G("span",{className:"text-[13px] text-muted-foreground px-1 select-none",children:J}),G(Ft,{color:p,size:20}),Z&&G("span",{className:"text-[13px] text-foreground tabular-nums",children:e}),J&&Q==="right"&&G("span",{className:"text-[13px] text-muted-foreground px-1 select-none",children:J}),q&&G("span",{role:"button","aria-label":"Remove color",tabIndex:0,onClick:(S)=>{S.stopPropagation(),X?.()},onKeyDown:(S)=>{if(S.key==="Enter"||S.key===" ")S.stopPropagation(),S.preventDefault(),X?.()},className:"ml-1 text-muted-foreground hover:text-foreground cursor-pointer flex items-center",children:G(P,{size:14,strokeWidth:1.5})})]}),G(J2.Portal,{children:G("div",{className:M8,children:G(J2.Positioner,{side:z,align:K,sideOffset:W,alignOffset:H,className:"z-[10000] outline-none",children:G(jq.div,{initial:{opacity:0,y:-4,scaleY:0.96},animate:N?{opacity:1,y:0,scaleY:1}:{opacity:0,y:-4,scaleY:0.96},transition:N?XX.moderate:XX.moderate.exit,style:{transformOrigin:"top left"},onAnimationComplete:()=>{if(!N)O.current?.unmount()},children:G(J2.Popup,{render:G("div",{ref:I}),className:"outline-none",children:G(Jt,{value:k,children:G(BS,{...L,value:x,onValueChange:E,className:b0("bg-popover",L.className)})})})})})})})]})})});NF.displayName="ColorPickerPopover";var Dt=[{id:"no-outline",label:"No outline",style:{color:"#ffffff",outline_color:"transparent",background_color:"transparent"}},{id:"white-outline",label:"White",style:{color:"#ffffff",outline_color:"#000000",background_color:"transparent"}},{id:"yellow-outline",label:"Yellow",style:{color:"#ffd60a",outline_color:"#000000",background_color:"transparent"}},{id:"black-card",label:"Black",style:{color:"#ffffff",outline_color:"transparent",background_color:"#000000"}},{id:"white-card",label:"White card",style:{color:"#000000",outline_color:"transparent",background_color:"#ffffff"}},{id:"accent-card",label:"Accent",style:{color:"#ffffff",outline_color:"transparent",background_color:"#b65764"}},{id:"green-outline",label:"Green",style:{color:"#50f0a0",outline_color:"#000000",background_color:"transparent"}},{id:"blue-shadow",label:"Blue",style:{color:"#ffffff",outline_color:"#2f8cff",background_color:"transparent"}},{id:"pink-shadow",label:"Pink",style:{color:"#ffffff",outline_color:"#ff5ba7",background_color:"transparent"}},{id:"cream-card",label:"Cream",style:{color:"#251f1a",outline_color:"transparent",background_color:"#f4e8b7"}},{id:"red-outline",label:"Red",style:{color:"#ff334e",outline_color:"#ffffff",background_color:"transparent"}},{id:"teal-card",label:"Teal",style:{color:"#ffffff",outline_color:"transparent",background_color:"#0f766e"}},{id:"rose-card",label:"Rose",style:{color:"#fff1f4",outline_color:"transparent",background_color:"#be4f60"}}];function FS($,J){if(!$)return J;if($.trim().toLowerCase()==="transparent")return"rgba(0, 0, 0, 0)";return $}function R$($){let J=FS($,"rgba(0, 0, 0, 0)").replaceAll(" ","").toLowerCase();if(J==="rgba(0,0,0,0)")return"transparent";return J}function Nt($,J){return R$($.color)===R$(J.style.color)&&R$($.outline_color)===R$(J.style.outline_color)&&R$($.background_color)===R$(J.style.background_color)}function bW($){return Math.round($*100)}function YX($){return Math.max(0,Math.min(1,$/100))}function US($){return Number($.toFixed(1))}function Ot($){return R$($)!=="transparent"}function VS({text:$,style:J,onTextChange:Q,onStyleChange:Z,speechSettings:q,onSpeechSettingsChange:X,onGenerateSpeech:Y}){let z=q1(),[K,W]=c9.useState(bZ),H=q??K,[B,U]=c9.useState(!1),[_,L]=c9.useState(!1),F=c9.useRef(null),[V,M]=c9.useState(!1),D=J.background_opacity??0.7,N=bW(D),O=!Ot(J.background_color),k=c9.useMemo(()=>{if(!H.referenceAudio)return null;if(/^https?:\/\//i.test(H.referenceAudio))return H.referenceAudio;let w=H.referenceAudioSourceType??"input";return Z5({source_type:w,file_path:w==="input"||w==="output"?H.referenceAudio:void 0,local_path:w==="local"?H.referenceAudio:void 0})},[H.referenceAudio,H.referenceAudioSourceType]);c9.useEffect(()=>{let w=F.current;if(L(!1),w){w.pause();try{w.currentTime=0}catch(C){console.error("[SubtitleSettingsPanel] failed to reset reference audio preview:",C)}}return()=>{w?.pause()}},[k]);function I(w){let C={...H,...w};if(q){X?.(C);return}W(C)}async function b(){if(!Y||V)return;M(!0);try{await Y(H)}finally{M(!1)}}async function A(){let w=F.current;if(!w||!k)return;if(_){w.pause(),L(!1);return}if(w.ended)try{w.currentTime=0}catch(C){console.error("[SubtitleSettingsPanel] failed to restart reference audio preview:",C)}L(!0);try{await w.play()}catch(C){L(!1),console.error("[SubtitleSettingsPanel] failed to play reference audio preview:",C)}}return T("aside",{"data-testid":"subtitle-settings-panel","data-capture-wheel":"true",className:"flex h-full min-h-0 w-[35%] min-w-72 shrink-0 flex-col overflow-hidden border-l border-border bg-muted/30 text-card-foreground shadow-lg","aria-label":z("multitrack.subtitleTextSettings"),children:[k?G("audio",{ref:F,"data-testid":"reference-audio-preview",src:k,preload:"metadata",className:"hidden",onEnded:()=>L(!1)}):null,T(m4,{defaultValue:"text",className:"flex min-h-0 flex-1 flex-col",children:[G("div",{className:"border-b border-border p-1",children:T(s9,{className:"h-8 bg-card border-0 cursor-pointer",children:[T(W8,{value:"text",className:"gap-1 text-[10px]",children:[G(LS,{className:"h-3 w-3"}),z("multitrack.text")]}),T(W8,{value:"speech",className:"gap-1 text-[10px]",children:[G(OF,{className:"h-3 w-3"}),z("multitrack.speech")]})]})}),G(y9,{value:"text",className:"mt-0 min-h-0 flex-1 overflow-y-auto p-3",children:T("div",{className:"grid gap-4",children:[G("label",{className:"grid gap-1.5 text-xs font-medium text-foreground",children:G(d4,{"aria-label":z("multitrack.subtitleText"),className:"min-h-20 resize-none bg-card text-xs",value:$,onChange:(w)=>Q(w.currentTarget.value)})}),T("div",{className:"grid grid-cols-[3rem_minmax(0,1fr)] items-center gap-3",children:[G("span",{className:"text-[11px] font-medium text-foreground",children:z("multitrack.fontSize")}),T("div",{className:"flex min-w-0 items-center gap-2",children:[G("div",{className:"flex-1 w-full",children:G(N8,{"aria-label":z("multitrack.fontSize"),value:[J.font_size],min:8,max:66,step:1,onValueChange:(w)=>Z({font_size:w[0]??J.font_size})})}),G(e8,{"aria-label":z("multitrack.fontSize"),className:"h-7 w-16 shrink-0",min:8,max:96,step:1,value:J.font_size,onChange:(w)=>Z({font_size:w})})]})]}),T("div",{className:"grid grid-cols-[3rem_minmax(0,1fr)] items-center gap-3",children:[G("span",{className:"text-[11px] font-medium text-foreground",children:z("multitrack.backgroundOpacity")}),T("div",{className:"flex min-w-0 items-center gap-2",children:[G("div",{className:"flex-1 w-full",children:G(N8,{"aria-label":z("multitrack.backgroundOpacity"),value:[N],min:0,max:100,step:1,disabled:O,onValueChange:(w)=>Z({background_opacity:YX(w[0]??N)})})}),G(e8,{"aria-label":z("multitrack.backgroundOpacityPercent"),className:"h-7 w-16 shrink-0",min:0,max:100,step:1,disabled:O,value:N,onChange:(w)=>Z({background_opacity:YX(w)})})]})]}),T("div",{className:"grid grid-cols-[3rem_minmax(0,1fr)] items-center gap-3",children:[G("span",{className:"text-[11px] font-medium text-foreground",children:z("multitrack.textColor")}),G(NF,{value:FS(J.color,"#ffffff"),defaultFormat:"hex",triggerAriaLabel:z("multitrack.textColor"),triggerClassName:"w-full justify-start h-6 text-[10px]",side:"left",align:"start",sideOffset:10,onValueChange:(w)=>Z({color:w})})]}),T("div",{className:"grid gap-2",children:[G("span",{className:"text-[11px] font-medium text-foreground",children:z("multitrack.presetStyle")}),G("div",{className:"grid grid-cols-7 gap-1.5",children:Dt.map((w)=>{let C=Nt(J,w);return G(k0,{type:"button",variant:"ghost","aria-pressed":C,className:b0("flex aspect-square h-auto min-h-0 w-full items-center justify-center rounded-md border bg-muted p-0 text-base font-bold transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",C?"border-primary ring-2 ring-primary":"border-border"),"aria-label":z("multitrack.applyPresetStyle",{name:w.label}),onClick:()=>Z(w.style),children:w.id==="no-outline"?G(_S,{className:"h-4 w-4 text-muted-foreground"}):G("span",{className:"rounded px-1 leading-none",style:{color:w.style.color,backgroundColor:w.style.background_color,textShadow:`1px 0 0 ${w.style.outline_color}, -1px 0 0 ${w.style.outline_color}, 0 1px 0 ${w.style.outline_color}, 0 -1px 0 ${w.style.outline_color}`},children:"T"})},w.id)})})]}),T("div",{className:"grid grid-cols-[3rem_repeat(3,minmax(0,1fr))] items-center gap-2",children:[T("span",{className:"text-[11px] font-medium text-foreground",children:[z("multitrack.position"),"%"]}),T("label",{className:"flex min-w-0 items-center gap-1",children:[G("span",{className:"text-[10px] font-medium text-muted-foreground",children:z("multitrack.positionX")}),G(e8,{"aria-label":z("multitrack.positionXPercent"),className:"h-7 min-w-0 flex-1",min:0,max:100,step:1,value:bW(J.x),onChange:(w)=>Z({x:YX(w)})})]}),T("label",{className:"flex min-w-0 items-center gap-1",children:[G("span",{className:"text-[10px] font-medium text-muted-foreground",children:z("multitrack.positionY")}),G(e8,{"aria-label":z("multitrack.positionYPercent"),className:"h-7 min-w-0 flex-1",min:0,max:95,step:1,value:bW(J.y),onChange:(w)=>Z({y:Math.min(0.95,YX(w))})})]}),T("label",{className:"flex min-w-0 items-center gap-1",children:[G("span",{className:"text-[10px] font-medium text-muted-foreground",children:z("multitrack.subtitleWidthShort")}),G(e8,{"aria-label":z("multitrack.subtitleWidthPercent"),className:"h-7 min-w-0 flex-1",min:10,max:100,step:1,value:bW(J.width),onChange:(w)=>Z({width:Math.max(0.1,YX(w))})})]})]})]})}),T(y9,{value:"speech",className:"mt-0 flex min-h-0 flex-1 flex-col overflow-hidden p-0",children:[G("div",{className:"min-h-0 flex-1 overflow-y-auto p-3 pb-4",children:T("div",{className:"grid gap-4",children:[T("div",{className:"grid grid-cols-[4.25rem_minmax(0,1fr)] items-center gap-3",children:[G("span",{className:"text-[11px] font-medium text-foreground",children:z("multitrack.speechModel")}),T(y8,{value:H.model,onValueChange:(w)=>I({model:w}),children:[G(P8,{"aria-label":z("multitrack.speechModel"),className:"h-8 w-full bg-card text-xs",children:G(W6,{})}),G(R8,{children:G(l5,{value:"VoxCPM2",children:"VoxCPM2"})})]})]}),G("label",{className:"grid gap-1.5",children:G(d4,{"aria-label":z("multitrack.speechPrompt"),className:"min-h-20 resize-none bg-card text-xs",value:H.prompt,placeholder:z("multitrack.speechPromptPlaceholder"),onChange:(w)=>I({prompt:w.currentTarget.value})})}),T("div",{className:"grid grid-cols-[4.25rem_minmax(0,1fr)] items-center gap-3",children:[G("span",{className:"text-[11px] font-medium text-foreground",children:z("multitrack.speechCfg")}),T("div",{className:"flex min-w-0 items-center gap-2",children:[G("div",{className:"flex-1 w-full",children:G(N8,{"aria-label":z("multitrack.speechCfg"),value:[H.cfg],min:0.1,max:5,step:0.1,onValueChange:(w)=>I({cfg:US(w[0]??H.cfg)})})}),G(e8,{"aria-label":z("multitrack.speechCfg"),className:"h-7 w-16 shrink-0",min:0.1,max:5,step:0.1,value:H.cfg,formatValue:(w)=>w.toFixed(1),onChange:(w)=>I({cfg:US(w)})})]})]}),T("div",{className:"grid grid-cols-[4.25rem_minmax(0,1fr)] items-center gap-3",children:[G("span",{className:"text-[11px] font-medium text-foreground",children:z("multitrack.speechSteps")}),T("div",{className:"flex min-w-0 items-center gap-2",children:[G("div",{className:"flex-1 w-full",children:G(N8,{"aria-label":z("multitrack.speechSteps"),value:[H.steps],min:1,max:50,step:1,onValueChange:(w)=>I({steps:w[0]??H.steps})})}),G(e8,{"aria-label":z("multitrack.speechSteps"),className:"h-7 w-16 shrink-0",min:1,max:50,step:1,value:H.steps,onChange:(w)=>I({steps:w})})]})]}),T("div",{className:"grid grid-cols-[4.25rem_minmax(0,1fr)] items-start gap-3",children:[G("span",{className:"pt-1.5 text-[11px] font-medium text-foreground",children:z("multitrack.referenceAudio")}),G("div",{className:"min-w-0",children:H.referenceAudio?T("div",{className:"flex min-w-0 items-center gap-1",children:[T(a1,{open:B,onOpenChange:U,children:[G(T5,{asChild:!0,children:T(k0,{type:"button",variant:"secondary",className:"h-8 min-w-0 flex-1 cursor-pointer justify-start bg-card px-1 text-xs","aria-label":z("multitrack.reselectReferenceAudio"),children:[G(LJ,{className:"h-3.5 w-3.5 shrink-0 text-highlight"}),G("span",{className:"truncate",children:H.referenceAudio})]})}),G(s1,{className:"w-auto p-0",align:"end",children:G(V5,{value:H.referenceAudio,mediaType:"audio",defaultTab:"inputs",onChange:(w,C)=>{I({referenceAudio:w,referenceAudioSourceType:C??"input"}),U(!1)}})})]}),k?G(k0,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0 cursor-pointer","aria-label":z(_?"multitrack.pauseReferenceAudio":"multitrack.playReferenceAudio"),onClick:()=>void A(),children:_?G(D7,{className:"h-3.5 w-3.5"}):G(y4,{className:"h-3.5 w-3.5"})}):null,G(k0,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0 cursor-pointer text-destructive","aria-label":z("multitrack.clearReferenceAudio"),onClick:()=>I({referenceAudio:""}),children:G(D5,{className:"h-3.5 w-3.5"})})]}):T(a1,{open:B,onOpenChange:U,children:[G(T5,{asChild:!0,children:T(k0,{type:"button",variant:"secondary",className:"h-8 w-full cursor-pointer justify-start bg-card text-xs",children:[G(K5,{className:"h-3.5 w-3.5"}),z("multitrack.addReferenceAudio")]})}),G(s1,{className:"w-auto p-0",align:"end",children:G(V5,{value:"",mediaType:"audio",defaultTab:"inputs",onChange:(w,C)=>{I({referenceAudio:w,referenceAudioSourceType:C??"input"}),U(!1)}})})]})})]})]})}),G("div",{className:"sticky bottom-0 flex shrink-0 justify-end border-t border-border bg-muted/80 p-2 backdrop-blur",children:T(k0,{type:"button",disabled:!Y||V,className:"h-7 cursor-pointer bg-highlight px-3 text-[11px] text-background shadow hover:bg-highlight/90",onClick:b,children:[V?G(X6,{className:"h-3 w-3 animate-spin"}):G(OF,{className:"h-3 w-3"}),z("multitrack.speech")]})})]})]})]})}var At="calc(max(35%, 18rem) + 12px)";function wt($,J,Q){let Z=$.findIndex((z)=>z.id===J),q=$.findIndex((z)=>z.id===Q);if(Z<0||q<0||Z===q)return $;let X=[...$],[Y]=X.splice(Z,1);return X.splice(q,0,Y),X}function kt($,J){let Q=RW($,J);for(let Z of $.tracks){if(Z.type!=="task")continue;let q=Z.segments.findIndex((K)=>Q>=K.start_frame&&Q{let W=Z5({source_type:K.source_type??"input",file_path:K.file_path,local_path:K.local_path,url:K.url,slot_name:K.slot_name});return{image:K,url:W??void 0}});return{index:q,segmentId:X.id,allImages:Y,images:z}}return null}function It($,J){let Q=RW($,J);for(let Z of $.tracks){if(Z.type!=="task")continue;let q=Z.segments.findIndex((z)=>Q>=z.start_frame&&Q{if(Z.type!=="subtitle"||Z.visible===!1)return[];return Z.segments.filter((q)=>Q>=q.start_frame&&Qk(null)),[b,A]=k5.useState(null),[w,C]=k5.useState("balanced"),[y,x]=k5.useState(!1),[E,P]=k5.useState(!1),[h,p]=k5.useState(null),[e,S]=k5.useState(null),[r,$0]=k5.useState(null),K0=nY(X),t=k5.useMemo(()=>z9(X,Y,"image"),[X,Y,y]),H0=k5.useMemo(()=>$.tracks.filter((Y0)=>Y0.type==="video").flatMap((Y0)=>Y0.segments),[$.tracks]),z0=k5.useMemo(()=>$.tracks.some((Y0)=>Y0.segments.length>0),[$.tracks]),j=k5.useMemo(()=>{let Y0=H0.find((y0)=>y0.content.media_type==="video");if(!Y0)return null;return Z5({source_type:Y0.content.source_type??"input",file_path:Y0.content.file_path,local_path:Y0.content.local_path,url:Y0.content.url,slot_name:Y0.content.slot_name})},[H0]),d=Q?.trackType==="audio"?null:Q,m=d?.trackType==="task"?null:OS($,J,d?.trackType==="video"?d.segment.id:null),s=AS($,J,d),u=d===null?kt($,J):null,c=d===null?It($,J):null,i=k5.useMemo(()=>{if(d?.trackType==="task")return[];let Y0=Tt($,J);if(d?.trackType!=="subtitle")return Y0;let y0=d.segment,h0=Y0.findIndex((i0)=>i0.id===y0.id);if(h0<0)return[...Y0,y0];return Y0.map((i0,E0)=>E0===h0?y0:i0)},[J,$,d]),f=wS(K0,r),o=Q?.trackType==="video"||Q?.trackType==="audio"?c2(uJ(Q.segment),$.frame_rate):null,G0=Q?.trackType==="subtitle"?jW({...C2,...Q.segment.content.subtitle_style}):null,l=Q?.trackType==="subtitle"?{...bZ,...Q.segment.content.subtitle_speech}:bZ,Z0=Q?.trackType==="task"?Q.segment.content.images??[]:[],Q0=O?.source==="selected"?Z0.find((Y0)=>Y0.id===O.imageId)??null:O?.source==="active"?u?.allImages.find((Y0)=>Y0.id===O.imageId)??null:null,B0=u?.images.find(({image:Y0})=>Y0.id===b)??u?.images[0]??null,W0=Boolean(u&&!m),L0=w==="image-large"?"w-32 flex-[0_0_8rem]":"w-20 flex-[0_0_5rem]",_0=w==="image-large"?"h-full flex-none":"h-full flex-none",N0=G0?"mx-auto flex h-full min-h-24 w-full max-w-full items-stretch justify-center gap-0":W0?"mx-auto flex h-full min-h-24 w-full max-w-full items-center justify-center gap-3":"mx-auto flex h-full min-h-24 w-fit max-w-full items-center justify-center gap-3";k5.useEffect(()=>{k(null)},[Q?.segment.id]),k5.useEffect(()=>{if(!z)return;let Y0=i.find((y0)=>y0.id===z);if(!Y0)return;S({segmentId:Y0.id,text:Y0.content.text??""}),K?.()},[i,z,K]),k5.useEffect(()=>{if(!u){A(null);return}if(u.images.some(({image:Y0})=>Y0.id===b))return;A(u.images[0]?.image.id??null)},[u,b]),k5.useEffect(()=>{if(!c){p(null);return}let Y0=c.content.user_prompt_variant==="b"?"b":"a";if(h?.segmentId===c.segmentId&&h.variant===Y0)return;p(null)},[c,h?.segmentId,h?.variant]),k5.useEffect(()=>{if(O?.source==="active"&&O.segmentId!==u?.segmentId)k(null)},[O,u?.segmentId]),k5.useEffect(()=>{if(!j){$0(null);return}let Y0=!1;return jZ(j).then((y0)=>{if(!Y0)$0({width:y0.width,height:y0.height})}).catch((y0)=>{if(console.error("[PreviewArea] failed to read first video metadata:",y0),!Y0)$0(null)}),()=>{Y0=!0}},[j]);function d0(Y0){if(!u)return;let y0=N.current;if(N.current=null,!y0)return;L?.([{segmentId:u.segmentId,patch:{images:wt(u.allImages,y0,Y0)}}])}function g(Y0){if(!u)return;let y0=u.allImages.find((h0)=>h0.id===Y0);if(y0?.shared_reference===!0){let h0=U&&U.length>0?U:$.tracks.filter((E0)=>E0.type==="task").flatMap((E0)=>E0.segments),i0=I7(y0);L?.(T7(h0,y0,!1).map((E0)=>({segmentId:E0.segmentId,patch:{images:E0.segmentId===u.segmentId?E0.images.filter((D1)=>I7(D1)!==i0):E0.images}})));return}L?.([{segmentId:u.segmentId,patch:{images:u.allImages.filter((h0)=>h0.id!==Y0)}}])}function a(Y0,y0){let h0=U&&U.length>0?U:u?$.tracks.filter((i0)=>i0.type==="task").flatMap((i0)=>i0.segments):[];if(h0.length===0||y0&&!xJ(h0,Y0))return;L?.(T7(h0,Y0,y0).map((i0)=>({segmentId:i0.segmentId,patch:{images:i0.images}})))}function I0(Y0,y0){if(!u)return;L?.([{segmentId:u.segmentId,patch:{images:u.allImages.map((h0)=>h0.id===Y0?{...h0,muted:y0}:h0)}}])}function A0(Y0){if(Array.from(Y0.files).some((h0)=>h0.type.startsWith("image/")))return!0;return Array.from(Y0.items??[]).some((h0)=>h0.kind==="file"&&h0.type.startsWith("image/"))}function F0(Y0){if(!Y0.dataTransfer||!A0(Y0.dataTransfer))return;Y0.preventDefault(),P(!0)}function m0(Y0){if(!Y0.dataTransfer||!A0(Y0.dataTransfer))return;Y0.preventDefault(),P(!0)}function R0(Y0){let y0=Y0.relatedTarget;if(y0 instanceof Node&&Y0.currentTarget.contains(y0))return;P(!1)}async function n0(Y0){if(Y0.preventDefault(),P(!1),!Y0.dataTransfer||!u)return;let y0=q4-u.allImages.length;if(y0<=0)return;let h0=Array.from(Y0.dataTransfer.files).filter((D1)=>D1.type.startsWith("image/")).slice(0,y0);if(h0.length===0)return;let E0=(await Promise.allSettled(h0.map((D1)=>j7(D1)))).flatMap((D1)=>{if(D1.status==="fulfilled")return[D1.value];return console.error("[PreviewArea] failed to upload active task image:",D1.reason),[]});if(E0.length===0)return;R5("inputs"),L?.([{segmentId:u.segmentId,patch:{images:[...u.allImages,...E0]}}])}function C0(Y0,y0){if(!u)return;let h0=q4-u.allImages.length;if(h0<=0)return;let i0=gJ(Y0).slice(0,h0),E0=y0??(Y0.startsWith("http://")||Y0.startsWith("https://")?"url":"input"),D1=i0.map((u1)=>vJ(u1,E0));if(D1.length===0)return;L?.([{segmentId:u.segmentId,patch:{images:[...u.allImages,...D1]}}]),x(!1)}function z1(Y0){if(!h||!c)return;p({...h,text:Y0}),L?.([{segmentId:h.segmentId,patch:fZ(c.content,Y0)}])}function Q1(){p(null)}function a0(Y0,y0){L?.([{segmentId:Y0,patch:{task_mode:y0}}])}function R1(Y0,y0){L?.([{segmentId:Y0,patch:{continuity_mode:y0}}])}function C1(Y0,y0){L?.([{segmentId:Y0,patch:{ref_image_size:y0}}])}function b1(){if(!e)return;if(Q?.trackType==="subtitle"&&Q.segment.id===e.segmentId)B({text:e.text});else L?.([{segmentId:e.segmentId,patch:{text:e.text}}]);S(null)}function n(Y0,y0,h0,i0,E0){if(!y0)return G("div",{"data-testid":`task-preview-slot-image-${Y0.id}`,className:`${E0} flex items-center justify-center bg-muted/30 px-2 text-center text-[9px] text-muted-foreground`,children:Y0.source_type==="slot"?D("mediaSelector.slotImage",{n:Oz(Y0,i0)}):h0});return Y0.panorama_view?G(Kz,{imageId:Y0.id,imageUrl:y0,alt:h0,view:Y0.panorama_view,className:E0}):G("img",{className:E0,src:y0,alt:h0,draggable:!1})}function D0(Y0="h-10 w-10 aspect-square",y0=!1){if(!u||u.allImages.length>=q4)return null;return T(a1,{open:y,onOpenChange:x,children:[G(T5,{asChild:!0,children:T(k0,{type:"button",variant:"outline","data-testid":u.images.length===0?"task-preview-empty-add-image":"task-preview-add-image",className:`cursor-pointer shrink-0 border-dashed bg-background/70 text-muted-foreground transition-colors hover:bg-background/90 ${E?"border-primary bg-accent/20 text-foreground":"border-border"} ${y0?"flex-col gap-1":""} ${Y0}`,"aria-label":D("multitrack.addImage"),onClick:(h0)=>{h0.stopPropagation(),x(!0)},onDragEnter:F0,onDragOver:m0,onDragLeave:R0,onDrop:n0,children:[G(K5,{className:"h-5 w-5"}),y0?G("span",{className:"text-[10px] font-semibold",children:D("multitrack.addImage")}):null]})}),G(s1,{className:"w-auto p-0",align:"end",children:G(V5,{value:"",mediaType:"image",allowMultipleSelection:!0,maxSelectionCount:q4-u.allImages.length,slotItems:t,onChange:C0})})]})}function w0(Y0,y0,h0,i0,E0="aspect-square w-full",D1=!0,u1="thumbnail"){if(!u)return null;let j1=Y0.file_name??Y0.file_path??Y0.local_path??Y0.url??Y0.slot_name??Y0.id,t1=Y0.shared_reference?Y0.muted===!0?"border-highlight opacity-50":"border-highlight":i0?"border-primary":"border-border";return T("div",{"data-testid":`task-preview-image-${Y0.id}`,className:`group/task-image relative shrink-0 cursor-pointer overflow-hidden rounded-sm border bg-black ${t1} ${E0}`,draggable:!0,onDragStart:()=>{N.current=Y0.id},onDragEnd:()=>{N.current=null},onDragOver:(M5)=>M5.preventDefault(),onDrop:()=>d0(Y0.id),children:[G(k0,{type:"button",variant:"ghost",className:u1==="flow"&&y0?"h-full w-auto max-w-full rounded-none p-0 hover:bg-transparent":"h-full w-full rounded-none p-0 hover:bg-transparent","aria-label":j1,onClick:()=>A(Y0.id),children:n(Y0,y0,j1,h0,u1==="flow"&&y0?`h-full w-auto max-w-full object-contain transition-opacity ${Y0.muted===!0?"opacity-40":""}`:`h-full w-full object-contain transition-opacity ${Y0.muted===!0?"opacity-40":""}`)}),D1?r0(Y0,j1,u1==="flow"?"flow":"split",Boolean(y0)):null]},Y0.id)}function f0(Y0){let y0=Q?.segment.id===Y0.id&&Q.trackType==="subtitle",h0=jW({...C2,...Y0.content.subtitle_style}),i0=e?.segmentId===Y0.id?e:null,E0=bt(h0.background_color,h0.background_opacity),D1=!kS(E0),u1=(X0)=>{if(!y0)return;B({subtitle_style:jW({...h0,...X0})})};function j1(X0){if(i0){X0.stopPropagation();return}if(X0.preventDefault(),X0.stopPropagation(),!y0){W?.(Y0.id);return}let O0=X0.currentTarget.closest("[data-multitrack-preview-area]")?.getBoundingClientRect();if(!O0)return;let{width:x0,height:J1}=O0,f1=X0.clientX,J0=X0.clientY,u0=h0;function g0(M1){u1({x:u0.x+(M1.clientX-f1)/x0,y:u0.y+(M1.clientY-J0)/J1})}function N1(){globalThis.removeEventListener("mousemove",g0),globalThis.removeEventListener("mouseup",N1)}globalThis.addEventListener("mousemove",g0),globalThis.addEventListener("mouseup",N1)}function t1(X0){X0.preventDefault(),X0.stopPropagation(),W?.(Y0.id),S({segmentId:Y0.id,text:Y0.content.text??""})}function M5(X0,O0){if(!y0)return;O0.preventDefault(),O0.stopPropagation();let x0=O0.currentTarget.closest("[data-multitrack-preview-area]")?.getBoundingClientRect();if(!x0)return;let J1=x0.width,f1=O0.clientX,J0=h0;function u0(N1){let M1=(N1.clientX-f1)/J1;if(X0==="left"){let e1=J0.x+M1;u1({x:e1,width:J0.width-M1});return}u1({width:J0.width+M1})}function g0(){globalThis.removeEventListener("mousemove",u0),globalThis.removeEventListener("mouseup",g0)}globalThis.addEventListener("mousemove",u0),globalThis.addEventListener("mouseup",g0)}return T("div",{"data-testid":"subtitle-preview-overlay",className:`absolute z-10 text-center leading-snug ${y0?"ring-1 ring-primary cursor-move":"cursor-pointer"}`,style:{left:`${(h0.x+h0.width/2)*100}%`,top:`${h0.y*100}%`,width:"max-content",maxWidth:`${h0.width*100}%`,transform:"translateX(-50%)",color:h0.color,fontSize:h0.font_size,textShadow:MS(h0.outline_color||"#000000")},onMouseDown:j1,onDoubleClick:t1,children:[i0?G($6,{"data-testid":"subtitle-preview-editor",autoFocus:!0,"aria-label":D("multitrack.editSubtitle"),value:i0.text,className:`inline-block h-auto max-w-full rounded-sm border-primary px-3 py-1.5 text-center leading-snug text-inherit shadow-none focus-visible:ring-1 ${D1?"shadow-sm":""}`,style:{width:`${Math.max(i0.text.length+2,5)}em`,backgroundColor:E0,color:h0.color,fontSize:h0.font_size,textShadow:MS(h0.outline_color||"#000000")},onMouseDown:(X0)=>X0.stopPropagation(),onClick:(X0)=>X0.stopPropagation(),onDoubleClick:(X0)=>X0.stopPropagation(),onChange:(X0)=>S({...i0,text:X0.currentTarget.value}),onBlur:b1,onKeyDown:(X0)=>{if(X0.key==="Enter")X0.preventDefault(),b1();if(X0.key==="Escape")X0.preventDefault(),S(null)}}):G("span",{"data-testid":"subtitle-preview-text",className:`inline-block max-w-full whitespace-pre-wrap break-words rounded-sm px-2 py-1 ${D1?"shadow-sm":""}`,style:{backgroundColor:E0},children:Y0.content.text}),y0?T(G1,{children:[G("span",{className:"absolute left-0 top-0 h-full w-1 cursor-ew-resize bg-primary",onMouseDown:(X0)=>M5("left",X0)}),G("span",{className:"absolute right-0 top-0 h-full w-1 cursor-ew-resize bg-primary",onMouseDown:(X0)=>M5("right",X0)})]}):null]})}function r0(Y0,y0,h0,i0=!0){if(!u)return null;let E0=h0==="flow"?"absolute right-0 top-1 flex gap-1 opacity-0 transition-opacity group-hover/task-image:opacity-100 group-focus-within/task-image:opacity-100":"absolute right-0 top-0 flex gap-0.5 opacity-0 transition-opacity group-hover/task-image:opacity-100 group-focus-within/task-image:opacity-100",D1="h-auto w-auto",u1="[&_svg]:!size-4",j1=Y0.shared_reference?16:18,t1=U&&U.length>0?U:$.tracks.filter((X0)=>X0.type==="task").flatMap((X0)=>X0.segments),M5=Y0.shared_reference===!0||xJ(t1,Y0);return T("div",{className:E0,children:[G(n1,{children:T(H1,{children:[G(B1,{asChild:!0,children:G(k0,{type:"button",size:"icon",variant:Y0.shared_reference===!0?"secondary":"ghost",className:`${D1} cursor-pointer rounded-none bg-background/70 hover:bg-background/90 ${u1} ${Y0.shared_reference===!0?"text-highlight":"text-muted-foreground"}`,style:{width:j1,height:j1},"aria-label":Y0.shared_reference===!0?D("multitrack.disableSharedReference"):D("multitrack.enableSharedReference"),"aria-pressed":Y0.shared_reference===!0,disabled:!M5,onClick:(X0)=>{X0.stopPropagation(),a(Y0,Y0.shared_reference!==!0)},children:G(fJ,{})})}),G(W1,{side:"bottom",className:"max-w-64",children:M5?D("multitrack.sharedImageReferenceTooltip"):D("multitrack.sharedImageLimitTooltip")})]})}),G(n1,{children:T(H1,{children:[G(B1,{asChild:!0,children:G(k0,{type:"button",size:"icon",variant:Y0.muted===!0?"secondary":"ghost","data-testid":`task-preview-image-muted-${Y0.id}`,className:`${D1} cursor-pointer bg-background/70 text-[14px] font-bold hover:bg-background/90 ${Y0.muted===!0?"text-destructive hover:text-destructive":"text-muted-foreground"}`,style:{width:j1,height:j1},"aria-label":Y0.muted===!0?D("multitrack.includeImage"):D("multitrack.bypassImage"),"aria-pressed":Y0.muted===!0,onClick:(X0)=>{X0.stopPropagation(),I0(Y0.id,Y0.muted!==!0)},children:"M"})}),G(W1,{side:"bottom",children:Y0.muted===!0?D("multitrack.includeImageTooltip"):D("multitrack.bypassImageTooltip")})]})}),G(n1,{children:T(H1,{children:[G(B1,{asChild:!0,children:G(k0,{type:"button",size:"icon",variant:"ghost",className:`${D1} cursor-pointer bg-background/70 font-bold text-muted-foreground hover:bg-background/90 ${u1}`,style:{width:j1,height:j1},"aria-label":D("multitrack.previewImage"),disabled:!i0,onClick:(X0)=>{X0.stopPropagation(),k({imageId:Y0.id,segmentId:u.segmentId,source:"active"})},children:G(b7,{})})}),G(W1,{side:"bottom",children:D("multitrack.previewImage")})]})}),G(n1,{children:T(H1,{children:[G(B1,{asChild:!0,children:G(k0,{type:"button",size:"icon",variant:"ghost",className:`${D1} cursor-pointer rounded-none bg-background/70 text-destructive hover:bg-background/90 hover:text-destructive ${u1}`,style:{width:j1,height:j1},"aria-label":`${D("multitrack.deleteImage")} ${y0}`,onClick:(X0)=>{X0.stopPropagation(),g(Y0.id)},children:G(n9,{})})}),G(W1,{side:"bottom",children:D("multitrack.deleteImage")})]})})]})}function K1(){if(!c)return null;let Y0=h?.segmentId===c.segmentId?h:null,h0=(Y0?.text??c.prompt).trim().length>0,i0=w==="image-large"?D("multitrack.previewLayoutBalanced"):D("multitrack.previewLayoutImageLarge");return T("div",{"data-testid":"task-prompt-overlay",className:`flex w-full editing ${Y0?"items-end":"items-center"} bg-background/70 px-2 text-primary-foreground`,children:[!W0?G(n1,{children:T(H1,{children:[G(B1,{asChild:!0,children:G(k0,{type:"button",size:"icon",variant:"ghost",className:"h-6 w-6 shrink-0 cursor-pointer rounded-none text-primary [&_svg]:!size-3","aria-label":i0,onClick:(E0)=>{E0.stopPropagation(),C((D1)=>D1==="balanced"?"image-large":"balanced")},children:w==="image-large"?G(NS,{}):G(DS,{})})}),G(W1,{side:"top",children:i0})]})}):null,Y0?G(d4,{"data-testid":"task-prompt-editor",autoFocus:!0,"aria-label":D("multitrack.userPrompt"),placeholder:D("multitrack.promptPlaceholder"),className:"min-h-24 flex-1 resize-none border-none bg-transparent px-1 py-0 text-[9px] leading-4 text-primary shadow-none focus-visible:ring-0",value:Y0.text,onMouseDown:(E0)=>E0.stopPropagation(),onClick:(E0)=>E0.stopPropagation(),onDoubleClick:(E0)=>E0.stopPropagation(),onChange:(E0)=>z1(E0.currentTarget.value),onBlur:Q1,onKeyDown:(E0)=>{if(E0.key==="Escape")E0.preventDefault(),p(null);if((E0.metaKey||E0.ctrlKey)&&E0.key==="Enter")E0.preventDefault(),Q1()}}):G("div",{"data-testid":"task-prompt-text",className:`min-w-0 flex-1 truncate px-1 text-[9px] leading-4 ${h0?"text-primary":"text-muted-foreground"}`,title:h0?c.prompt:D("multitrack.promptPlaceholder"),onDoubleClick:(E0)=>{E0.preventDefault(),E0.stopPropagation(),p({segmentId:c.segmentId,variant:c.content.user_prompt_variant==="b"?"b":"a",text:c.prompt})},children:h0?c.prompt:D("multitrack.promptPlaceholder")}),G("span",{className:"shrink-0 px-1 text-[9px] leading-4 text-secondary",children:"|"}),C$(K0.format)&&c.index>0&&T(G1,{children:[T(y8,{value:c.content.continuity_mode??hZ,disabled:!L,onValueChange:(E0)=>R1(c.segmentId,E0),children:[G(n1,{delayDuration:300,children:T(H1,{children:[G(B1,{asChild:!0,children:G(P8,{"data-testid":"task-continuity-mode-select","aria-label":D("multitrack.continuityMode"),className:"h-5 min-h-0 w-24 shrink-0 cursor-pointer border-none bg-transparent px-1 text-[9px] leading-4 text-primary shadow-none focus-visible:ring-1 focus-visible:ring-ring [&_svg]:size-3",onClick:(E0)=>E0.stopPropagation(),onDoubleClick:(E0)=>E0.stopPropagation(),children:G(W6,{})})}),G(W1,{side:"top",children:D("multitrack.continuityModeTooltip")})]})}),G(R8,{children:wz.map((E0)=>G(l5,{value:E0,children:G("span",{className:"text-[10px]",children:D(`multitrackContinuityModes.${E0}`)})},E0))})]}),G("span",{className:"shrink-0 px-1 text-[9px] leading-4 text-secondary",children:"|"})]}),C$(K0.format)&&["ref","edit"].includes(c.taskMode)&&T(G1,{children:[T(y8,{value:c.content.ref_image_size??Iz,disabled:!L,onValueChange:(E0)=>C1(c.segmentId,E0),children:[G(n1,{delayDuration:300,children:T(H1,{children:[G(B1,{asChild:!0,children:G(P8,{"data-testid":"task-ref-image-size-select","aria-label":D("multitrack.refImageSize"),className:"h-5 min-h-0 w-16 shrink-0 cursor-pointer border-none bg-transparent px-1 text-[9px] leading-4 text-primary shadow-none focus-visible:ring-1 focus-visible:ring-ring [&_svg]:size-3",onClick:(E0)=>E0.stopPropagation(),onDoubleClick:(E0)=>E0.stopPropagation(),children:G(W6,{})})}),G(W1,{side:"top",children:D("multitrack.refImageSizeTooltip")})]})}),G(R8,{children:kz.map((E0)=>G(l5,{value:E0,children:G("span",{className:"text-[10px]",children:D(`multitrackRefImageSizes.${E0}`)})},E0))})]}),G("span",{className:"shrink-0 px-1 text-[9px] leading-4 text-secondary",children:"|"})]}),T(y8,{value:c.taskMode,disabled:!L,onValueChange:(E0)=>a0(c.segmentId,E0),children:[G(n1,{delayDuration:300,children:T(H1,{children:[G(B1,{asChild:!0,children:G(P8,{"data-testid":"task-mode-select","aria-label":D("multitrack.taskMode"),className:"h-5 min-h-0 w-12 shrink-0 cursor-pointer border-none bg-transparent px-1 text-[9px] leading-4 text-primary shadow-none focus-visible:ring-1 focus-visible:ring-ring [&_svg]:size-3",onClick:(E0)=>E0.stopPropagation(),onDoubleClick:(E0)=>E0.stopPropagation(),children:G(W6,{})})}),G(W1,{side:"top",children:D("multitrack.taskModeTooltip")})]})}),G(R8,{children:Az.map((E0)=>G(l5,{value:E0,children:G("span",{className:"text-[10px]",children:PW(E0,D)})},E0))})]})]})}function x1(){let Y0=[[yW,"multitrack.emptyTaskTrack","multitrack.emptyTaskTrackPurpose"],[Z4,"multitrack.emptyVideoTrack","multitrack.emptyVideoTrackPurpose"],[e9,"multitrack.emptyAudioTrack","multitrack.emptyAudioTrackPurpose"],[S$,"multitrack.emptySubtitleTrack","multitrack.emptySubtitleTrackPurpose"]],y0=[[IJ,"multitrack.emptyTaskMarkers","multitrack.emptyTaskMarkersPurpose"],[Jz,"multitrack.emptyTaskOverview","multitrack.emptyTaskOverviewPurpose"]];return T("div",{"data-testid":"multitrack-empty-preview",className:"flex h-full w-full flex-col items-center justify-center px-6 py-5 text-center",children:[G(Z4,{className:"mb-2 h-9 w-9 text-muted-foreground","aria-hidden":"true"}),G("h3",{className:"text-sm font-semibold text-foreground",children:D("multitrack.emptyPreviewTitle")}),G("p",{className:"mt-1 text-xs text-muted-foreground",children:D("multitrack.emptyPreviewDescription")}),G("dl",{className:"mt-4 grid max-w-xl grid-cols-[auto_1fr] gap-x-3 gap-y-1.5 text-left text-[11px] leading-4",children:Y0.map(([h0,i0,E0])=>T("div",{className:"contents",children:[T("dt",{className:"flex items-center gap-1.5 font-medium text-foreground",children:[G(h0,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground","aria-hidden":"true"}),G("span",{children:D(i0)})]}),G("dd",{className:"text-muted-foreground",children:D(E0)})]},i0))}),G("div",{"data-testid":"multitrack-empty-preview-features",className:"mt-4 flex max-w-2xl items-start justify-center gap-5 border-t border-border pt-3 text-left",children:y0.map(([h0,i0,E0])=>T("div",{className:"flex max-w-xs items-start gap-2",children:[G(h0,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":"true"}),T("p",{className:"text-[11px] leading-4 text-muted-foreground",children:[G("span",{className:"font-medium text-foreground",children:D(i0)}),G("span",{className:"block",children:D(E0)})]})]},i0))})]})}function r1(Y0){let y0=Z5({source_type:Y0.source_type??"input",file_path:Y0.file_path,local_path:Y0.local_path,url:Y0.url,slot_name:Y0.slot_name});if(!y0)return null;let h0=Y0.file_name??Y0.file_path??Y0.local_path??Y0.url??Y0.id;return T("div",{"data-testid":"task-image-expanded-preview","data-zoom":I.zoom.toFixed(2),className:"absolute inset-0 z-30 flex items-center justify-center overflow-hidden bg-black p-3 pt-12",onWheel:I.onWheel,children:[T(k0,{type:"button",variant:"secondary",className:"absolute left-2 top-2 z-20 h-8 cursor-pointer gap-1.5 px-2.5 text-xs","aria-label":D("multitrack.backToPreview"),onClick:()=>k(null),children:[G(EW,{className:"h-4 w-4"}),G("span",{children:D("multitrack.backToPreview")})]}),T("span",{className:"pointer-events-none absolute right-2 top-2 z-20 rounded bg-background/70 px-2 py-1 text-[10px] tabular-nums text-foreground",children:[Math.round(I.zoom*100),"%"]}),G("img",{ref:I.imageRef,src:y0,alt:h0,className:"max-h-full max-w-full object-contain transition-transform duration-100 ease-out",style:{transform:`scale(${I.zoom})`,transformOrigin:`${I.origin.x}% ${I.origin.y}%`},draggable:!1})]})}if(Q?.trackType==="task")return G("div",{"data-multitrack-preview-area":!0,className:"relative flex min-h-24 w-full min-w-0 max-w-full flex-1 overflow-hidden rounded-sm bg-background",onClick:(Y0)=>Y0.stopPropagation(),children:Q0?r1(Q0):G(vT,{segment:Q.segment,node:X,app:Y,trackSegments:U,selectedSegments:_,videoSegments:H0,mediaTracks:$.tracks.filter((Y0)=>Y0.type==="audio"||Y0.type==="video"),frameRate:$.frame_rate,totalFrames:$.total_length,imageIndexOffset:C$(K0.format)?1:0,format:K0.format,onContentChange:B,onTrackSegmentsContentChange:L,onTrackSegmentsChange:F,onDurationChange:V,onOpenImagePreview:(Y0)=>k({imageId:Y0,segmentId:Q.segment.id,source:"selected"})})});return T("div",{"data-multitrack-preview-area":!0,className:"relative flex min-h-24 w-full min-w-0 max-w-full flex-1 items-center justify-center overflow-hidden rounded-sm text-xs text-muted-foreground bg-background",onClick:(Y0)=>Y0.stopPropagation(),children:[Q0&&O?.source==="active"?r1(Q0):null,Q===null&&f.mode==="megapixels"?T(TJ,{"data-testid":"multitrack-preview-resolution-badge",variant:"outline",className:"pointer-events-none absolute right-2 top-2 z-30 flex items-baseline gap-1.5 border-border bg-background/90 px-2 py-1 text-foreground shadow-sm backdrop-blur",children:[G("span",{className:"text-[9px] font-normal text-muted-foreground",children:D("multitrack.currentResolution")}),T("span",{className:"text-[11px] font-semibold tabular-nums",children:[f.width," × ",f.height]})]}):null,T("div",{className:"flex h-full min-h-24 w-full flex-col items-center justify-center gap-0.5",children:[!z0?x1():null,T("div",{className:!z0?"hidden":`min-w-0 ${N0}`,children:[W0&&u?T(G1,{children:[T("div",{"data-testid":"task-preview-images","data-layout":"flow",className:"flex h-full min-h-0 w-full flex-wrap content-center items-center justify-center gap-2 overflow-y-auto p-2",children:[u.images.map(({image:Y0,url:y0},h0)=>w0(Y0,y0,h0,Y0.id===B0?.image.id,Y0.source_type==="slot"&&!y0?"h-40 w-40 aspect-square":"h-40 w-fit max-w-full",!0,"flow")),D0("h-40 w-40 aspect-square",!0)]}),i.map((Y0)=>G("div",{children:f0(Y0)},Y0.id))]}):u&&T("div",{"data-testid":"task-preview-images",className:`flex max-h-full shrink-0 flex-col gap-2 overflow-hidden transition-all duration-300 ease-in-out ${L0}`,children:[G("div",{className:"shrink-0 text-center text-[10px] font-medium text-foreground pt-2",children:D("multitrack.previewTaskLabel",{n:u.index})}),T("div",{className:"flex min-h-0 flex-col gap-2 overflow-y-auto pb-2",children:[u.images.map(({image:Y0,url:y0},h0)=>{return w0(Y0,y0,h0,Y0.id===B0?.image.id)}),D0("aspect-square h-auto w-full")]})]}),!W0?G("div",{className:G0?"relative flex h-auto min-h-0 min-w-0 max-h-full flex-1 self-center flex-col items-center justify-center overflow-hidden":`min-w-0 transition-all duration-300 ease-in-out ${u?_0:"h-full flex-[1_1_100%]"}`,style:G0?{aspectRatio:`${f.width} / ${f.height}`}:void 0,children:G(mT,{activeVideo:m,resolution:f,isPlaying:Z,playbackNonce:q,muted:!0,volume:0,frameRate:$.frame_rate,className:G0?"absolute inset-0 h-full w-full":void 0,children:i.map((Y0)=>G("div",{children:f0(Y0)},Y0.id))})}):null,Q?.trackType==="subtitle"&&G0?G(VS,{text:Q.segment.content.text??"",style:G0,onTextChange:(Y0)=>B({text:Y0}),onStyleChange:(Y0)=>{B({subtitle_style:jW({...G0,...Y0})})},speechSettings:l,onSpeechSettingsChange:(Y0)=>B({subtitle_speech:Y0}),onGenerateSpeech:(Y0)=>M?.(Q.segment,Y0)??Promise.resolve()}):null]}),z0?K1():null]}),G(hI,{sources:s,isPlaying:Z,playbackNonce:q}),G(SI,{globalMuted:$.muted===!0,globalVolumeDb:$.volume_db??0,frameRate:$.frame_rate,selectedMediaVolumeDb:Q?.trackType==="video"||Q?.trackType==="audio"?Q.segment.content.volume_db??0:null,selectedMediaMuted:Q?.trackType==="video"||Q?.trackType==="audio"?Q.segment.content.muted===!0:!1,selectedMediaDuration:o,rightInset:G0?At:12,onGlobalSettingsChange:H,onSelectedSegmentContentChange:B,onSelectedSegmentDurationChange:V})]})}var SQ=R(v(),1);var TS=5;function jS({segment:$,frameRate:J,open:Q,onOpenChange:Z,onConfirm:q}){let X=q1(),[Y,z]=SQ.useState(TS),K=$?uJ($):0,W=Math.max(1,Math.round(J));SQ.useEffect(()=>{if(!Q||!$)return;z(TS)},[Q,$?.id]);let H=SQ.useMemo(()=>{return R9(Y,W)},[W,Y]),B=H>0&&H=1&&H=2,_=c2(K,W),L=Math.max(1,Math.floor(c2(Math.max(1,K-1),W)));function F(M){z(Math.max(1,Math.round(M)))}function V(M){if(M.preventDefault(),!$||!U)return;q($.id,H),Z(!1)}return G(OJ,{open:Q,onOpenChange:Z,children:T(j2,{className:"max-w-xs",children:[T(wZ,{children:[G(E2,{children:X("multitrack.splitTaskSegment")}),G(IZ,{children:X("multitrack.splitTaskSegmentDescription",{frames:K,seconds:_.toFixed(2)})})]}),T("form",{className:"space-y-4",onSubmit:V,children:[T("div",{className:"flex w-full items-center gap-2",children:[G(e8,{min:1,max:L,step:1,value:Y,className:"h-9 min-w-0 flex-1","aria-label":X("multitrack.splitTaskSegmentSeconds"),onChange:F}),G("span",{className:"flex h-9 shrink-0 items-center rounded-md border border-border bg-muted px-3 text-sm text-muted-foreground",children:X("multitrack.splitTaskSegmentSecondsUnit")})]}),G("p",{className:`text-xs leading-5 ${U?"text-muted-foreground":"text-destructive"}`,children:U?X("multitrack.splitTaskSegmentPreview",{count:B}):X("multitrack.splitTaskSegmentInvalid")}),T(kZ,{children:[G(k0,{type:"button",variant:"outline",onClick:()=>Z(!1),children:X("common.cancel")}),T(k0,{type:"submit",disabled:!U,children:[G(bS,{className:"h-4 w-4"}),X("multitrack.splitTaskSegmentConfirm")]})]})]})]})})}var I6=R(v(),1);var k6=R(v(),1);var jt=8,Et=12,yt=8,Pt=4;function Rt($,J,Q){let Z=Math.max(J,1),q=$.start_frame/Z*Q,X=$.end_frame/Z*Q;return{left:q,width:Math.max(2,X-q)}}function z2({trackType:$,segmentIndex:J,segment:Q,totalLength:Z,frameRate:q,areaWidth:X,canvasScale:Y,selected:z,onSelect:K,onDelete:W,onDistribute:H,onClone:B,onMerge:U,onSplitTask:_,onSmartSplit:L,onSmartSplitTasks:F,onRecognizeSubtitles:V,cutMode:M=!1,onCut:D,onResize:N,onResizePreview:O,onMove:k,onDragPreviewChange:I,getDragPreviewStart:b,onDragPreviewEnd:A,onDoubleClick:w,dimmed:C=!1,showTaskIndex:y=!0,taskOverview:x=!1,audioLocked:E=!1,audioLockEnabled:P=!1,onAudioLockToggle:h,sharedReference:p=!1,onSharedReferenceToggle:e}){let S=q1(),r=k6.useRef(!1),$0=k6.useRef(null),K0=k6.useRef(null),t=k6.useRef(!1),[H0,z0]=k6.useState(!1),[j,d]=k6.useState(!1),[m,s]=k6.useState(null),[u,c]=k6.useState(null),[i,f]=k6.useState(null),{left:o,width:G0}=Rt(Q,Z,X),l=Z5({source_type:Q.content.source_type??"input",file_path:Q.content.file_path,local_path:Q.content.local_path,url:Q.content.url}),Z0=Math.max(0,Q.end_frame-Q.start_frame),Q0=Q.content.duration&&Q.content.duration>0?Q.content.duration*Math.max(q,1):null,B0=Q.origin_start_frame??Q.start_frame,W0=Q0?Math.max(0,Math.min(1,(Q.start_frame-B0)/Q0)):0,L0=Q0?Math.max(W0,Math.min(1,(Q.end_frame-B0)/Q0)):1,_0=Math.max(0,(Q.start_frame-B0)/Math.max(q,1)),N0=PW(Q.content.task_mode??"default",S),d0=$==="task"?y?S("multitrackSegment.taskLabel",{n:J+1,mode:N0}):N0:$==="subtitle"?Q.content.text??S("multitrack.subtitle"):Q.content.file_name??Q.id,g=M6(Z0,{frameRate:q,showFrames:!0}),a=Q.content.user_prompt?.trim()??"",I0=vZ(Q.content.images).flatMap((n)=>{let D0=Z5({source_type:n.source_type??"input",file_path:n.file_path,local_path:n.local_path,url:n.url,slot_name:n.slot_name});return D0?[D0]:[]}),A0=Array.from({length:24},(n,D0)=>I0.map((w0,f0)=>({key:`${D0}-${f0}`,url:w0}))).flat(),F0=Q4($),m0=$==="video"?S("multitrack.cloneVideoSegment"):$==="audio"?S("multitrack.cloneAudioSegment"):S("multitrack.cloneTaskSegment"),R0=H0?"var(--warning)":z?F0.borderColor:F0.backgroundColorStrong,n0={left:m?0:o,top:m?m.y:void 0,bottom:m?void 0:void 0,width:m?m.width:G0,height:m?m.height:void 0,position:"absolute",transform:m?`translate3d(${m.x}px, 0, 0)`:void 0,backgroundColor:F0.backgroundColor,color:F0.textColor,border:`1px solid ${R0}`,"--multitrack-waveform":F0.waveformColor??void 0,cursor:M?"text":i??"grab",zIndex:j?9999:z?30:1,boxShadow:j?"0 8px 24px rgb(0 0 0 / 0.35)":void 0,pointerEvents:m?"none":void 0};function C0(n){if($0.current=n,K0.current!==null)return;K0.current=requestAnimationFrame(()=>{if(K0.current=null,s($0.current),$0.current)I?.(Q.id,$0.current.nextStartTime,$0.current.clientY)})}k6.useEffect(()=>{if(!F0.showThumbnail||!l){c(null);return}let n=!1,D0=null;return OI(l,_0).then((w0)=>{if(n){URL.revokeObjectURL(w0);return}D0=w0,c(w0)}).catch((w0)=>{if(console.error("[MultiTrackSegmentBlock] failed to capture video poster:",w0),!n)c(null)}),()=>{if(n=!0,D0)URL.revokeObjectURL(D0)}},[l,F0.showThumbnail,_0]),k6.useEffect(()=>{return()=>{if(K0.current!==null)cancelAnimationFrame(K0.current)}},[]);function z1(){return z?Et:jt}function Q1(n){let D0=n/Math.max(G0,1);return Number.isFinite(D0)&&D0>0.01?D0:Math.max(Y,0.01)}function a0(n,D0,w0){return(n-D0)/w0/Math.max(X,1)*Math.max(Z,1)}function R1(){return Math.max(1,Math.round(yt/Math.max(X,1)*Math.max(Z,1)))}function C1(n){if(M)return;let D0=n.currentTarget.getBoundingClientRect(),w0=Q1(D0.width),f0=(n.clientX-D0.left)/w0,r0=z1();f(f0<=r0||f0>=D0.width/w0-r0?"ew-resize":"grab")}function b1(n){if(n.button!==0)return;if(n.preventDefault(),n.stopPropagation(),M)return;r.current=!1,t.current=!1,K(Q.id,n.metaKey||n.ctrlKey?"toggle":n.shiftKey||z?"add":"replace");let D0=n.currentTarget.getBoundingClientRect(),w0=Q1(D0.width),f0=(n.clientX-D0.left)/w0,r0=D0.width/w0,K1=z1(),x1=f0<=K1?"start":f0>=r0-K1?"end":null,r1=n.clientX,Y0=n.clientY;if(!x1){let J0=function(g0){let N1=a0(g0.clientX,r1,w0);if(Math.hypot(g0.clientX-r1,g0.clientY-Y0)0)r.current=!0;O(Q.id,y0,h0+t1,E0)}function u1(j1){let t1=a0(j1.clientX,i0,w0);if(r.current)N(Q.id,y0,h0+t1,E0);z0(!1),globalThis.removeEventListener("mousemove",D1),globalThis.removeEventListener("mouseup",u1)}globalThis.addEventListener("mousemove",D1),globalThis.addEventListener("mouseup",u1)}return G(G1,{children:T(n6,{children:[G(a6,{asChild:!0,children:T("div",{role:"button","data-multitrack-segment":"",tabIndex:0,className:`absolute top-1 bottom-1 flex items-center rounded select-none active:opacity-70 ${$==="audio"?"overflow-visible":"overflow-hidden"} ${C?"opacity-50":""}`,style:n0,onMouseDown:b1,onMouseMove:C1,onMouseLeave:()=>f(null),onClick:(n)=>{if(n.stopPropagation(),M&&D){let D0=n.currentTarget.getBoundingClientRect(),w0=D0.width/Math.max(Y,0.01),f0=(n.clientX-D0.left)/Math.max(Y,0.01),r0=Math.max(0,Math.min(1,f0/Math.max(w0,1))),K1=Math.round(Q.start_frame+r0*(Q.end_frame-Q.start_frame));D(Q.id,K1);return}if(!r.current)n.preventDefault()},onContextMenu:(n)=>{n.stopPropagation(),K(Q.id,z?"add":"replace")},onDoubleClick:(n)=>{if(n.preventDefault(),n.stopPropagation(),M)return;w?.(Q.id,n)},onKeyDown:(n)=>{if(n.key==="Enter")K(Q.id,n.metaKey||n.ctrlKey?"toggle":n.shiftKey?"add":"replace");if(n.key==="Delete"||n.key==="Backspace")W(Q.id)},children:[G("div",{className:"pointer-events-none relative flex h-full min-w-0 flex-1 flex-col gap-0.5 overflow-hidden rounded-sm",children:$==="task"&&x?T(G1,{children:[A0.length>0?G("div",{className:"absolute inset-0 overflow-hidden bg-black",children:G("div",{className:"flex h-full w-max",children:A0.map(({key:n,url:D0})=>G("img",{src:D0,alt:"",className:"h-full w-auto max-w-none shrink-0 object-contain",draggable:!1,onError:(w0)=>{w0.currentTarget.style.display="none"}},n))})}):null,G("div",{className:A0.length>0?"absolute inset-x-0 bottom-0 z-10 flex items-center bg-black px-1 py-0.5 text-white":"absolute inset-0 flex items-center justify-center px-1 text-center",children:G("span",{className:`min-w-0 text-[9px] leading-tight ${A0.length>0?"truncate":"line-clamp-3"}`,children:a||d0})})]}):T(G1,{children:[T("div",{className:`flex h-3.5 min-w-0 items-center gap-1 leading-none ${F0.textClassName}`,style:{backgroundColor:F0.titleBackgroundColor??void 0},children:[G("span",{className:"truncate rounded-sm px-1 font-medium",children:d0}),G("span",{className:"shrink-0 rounded-sm px-1 tabular-nums",children:g})]}),F0.showThumbnail?G("div",{className:"h-8 overflow-hidden bg-black",style:{backgroundImage:u?`url(${JSON.stringify(u)})`:void 0,backgroundPosition:"left center",backgroundRepeat:"repeat-x",backgroundSize:"auto 32px"}}):null,F0.showWaveform?T("div",{className:$==="audio"?"relative min-h-0 flex-1 overflow-hidden rounded-sm":"relative h-2.5 overflow-hidden rounded-sm",style:{backgroundColor:F0.backgroundColorStrong},children:[G("div",{className:"absolute inset-x-0 top-0 z-10 h-0.5 bg-warning"}),G(cY,{content:{source_type:Q.content.source_type??"input",file_path:Q.content.file_path,local_path:Q.content.local_path,url:Q.content.url,slot_name:Q.content.slot_name},startRatio:W0,endRatio:L0,className:"h-full w-full",color:F0.waveformColor??void 0})]}):$!=="audio"?G("div",{className:"min-h-0 flex-1"}):null]})}),G("span",{className:"absolute left-0 top-0 h-full w-0.5 cursor-ew-resize",style:{background:H0||z?R0:"transparent"}}),G("span",{className:"absolute right-0 top-0 h-full w-0.5 cursor-ew-resize",style:{background:H0||z?R0:"transparent"}}),$==="audio"||$==="video"?G(n1,{children:T(H1,{children:[G(B1,{asChild:!0,children:G(k0,{type:"button",size:"icon",variant:p?"secondary":"ghost","data-testid":`${$}-shared-reference`,"aria-label":p?S("multitrack.disableSharedReference"):S("multitrack.enableSharedReference"),"aria-pressed":p,className:`absolute ${P?"right-8":"right-2"} top-0.5 z-20 h-5 w-5 cursor-pointer bg-background/80 shadow-sm [&_svg]:!size-3 ${p?"text-highlight":"text-muted-foreground"}`,onMouseDown:(n)=>{n.preventDefault(),n.stopPropagation()},onClick:(n)=>{n.preventDefault(),n.stopPropagation(),e?.(!p)},children:G(fJ,{})})}),G(W1,{side:"bottom",className:"max-w-72",children:S("multitrack.sharedReferenceTooltip")})]})}):null,($==="audio"||$==="video")&&P?G(G1,{children:T(H1,{children:[G(B1,{asChild:!0,children:G(k0,{type:"button",size:"icon",variant:E?"secondary":"ghost","data-testid":$==="audio"?"audio-segment-lock":"video-segment-audio-lock","aria-label":E?S("multitrack.unlockAudio"):S("multitrack.lockAudio"),"aria-pressed":E,className:`absolute right-2 top-0.5 z-20 h-5 w-5 cursor-pointer bg-background/80 shadow-sm [&_svg]:!size-3 ${E?"text-highlight":"text-muted-foreground"}`,onMouseDown:(n)=>{n.preventDefault(),n.stopPropagation()},onClick:(n)=>{n.preventDefault(),n.stopPropagation(),h?.(!E)},children:E?G(yS,{}):G(ES,{})})}),G(W1,{side:"bottom",className:"max-w-72",children:S($==="video"?"multitrack.videoAudioLockTooltip":"multitrack.audioLockTooltip")})]})}):null]})}),T(E6,{children:[$==="video"&&L?G(Q5,{onClick:()=>L(Q.id),children:S("multitrack.smartSplit")}):null,$==="video"&&F?G(Q5,{onClick:()=>F(Q.id),children:S("multitrack.smartSplitTasksOnly")}):null,($==="video"||$==="audio")&&V?T(jA,{children:[G(C3,{children:S("multitrack.recognizeSubtitles")}),T(S3,{children:[G(Q5,{onClick:()=>V(Q.id,"whisper-large-v3"),children:S("multitrack.recognizeSubtitlesWhisper")}),G(Q5,{onClick:()=>V(Q.id,"qwen3-asr"),children:S("multitrack.recognizeSubtitlesQwen3")})]})]}):null,$==="task"&&H?G(Q5,{onClick:H,children:S("multitrack.distributeTaskSegments")}):null,B?G(Q5,{onClick:()=>B(Q.id),children:m0}):null,$==="task"&&U?G(Q5,{onClick:U,children:S("multitrack.mergeTaskSegments")}):null,$==="task"&&_?G(Q5,{onClick:()=>_(Q.id),children:S("multitrack.splitTaskSegment")}):null,G(Q5,{onClick:()=>W(Q.id),children:S("multitrack.deleteSegment")})]})]})})}var h$=R(v(),1);function CW({track:$,icon:J,preserveSelection:Q=!1,onChange:Z}){let q=q1();return T("div",{className:"flex h-full flex-col items-center justify-center gap-0.5",children:[J,T("div",{className:"flex gap-px mt-1",children:[T(H1,{children:[G(B1,{asChild:!0,children:G(k0,{type:"button",variant:"outline",size:"icon",className:`h-3 w-3 cursor-pointer rounded-sm bg-card p-0 text-[8px] ${$.muted?"text-destructive":"text-muted-foreground"}`,"aria-label":q("multitrack.muteTrack",{name:$.name}),"aria-pressed":$.muted,onClick:(X)=>{if(Q)X.stopPropagation();Z({muted:!$.muted})},children:q("multitrack.muteShort")})}),G(W1,{children:q("multitrack.muteTrack",{name:$.name})})]}),T(H1,{children:[G(B1,{asChild:!0,children:G(k0,{type:"button",variant:"outline",size:"icon",className:`h-3 w-3 cursor-pointer rounded-sm bg-card p-0 text-[8px] ${$.solo?"text-highlight":"text-muted-foreground"}`,"aria-label":q("multitrack.soloTrack",{name:$.name}),"aria-pressed":$.solo===!0,onClick:(X)=>{if(Q)X.stopPropagation();Z({solo:!$.solo})},children:q("multitrack.soloShort")})}),G(W1,{children:q("multitrack.soloTrack",{name:$.name})})]})]})]})}var PS=R(v(),1);function K2($){let J=[...$].sort((q,X)=>q.start_frame-X.start_frame);if(J.length===0)return[];let Q=J[0].start_frame>0?[{startFrame:0,endFrame:J[0].start_frame}]:[],Z=J[0].end_frame;for(let q of J.slice(1)){if(q.start_frame>Z)Q.push({startFrame:Z,endFrame:q.start_frame});Z=Math.max(Z,q.end_frame)}return Q}var G2=PS.forwardRef(function({gap:J,totalLength:Q,width:Z,ariaLabel:q,onClick:X,className:Y,style:z,...K},W){let B=(J.startFrame+(J.endFrame-J.startFrame)/2)/Math.max(Q,1)*Z;return G(k0,{...K,ref:W,type:"button",variant:"secondary",size:"icon","data-testid":`track-gap-add-${J.startFrame}-${J.endFrame}`,className:b0("absolute top-1/2 z-10 h-5 w-5 -translate-x-1/2 -translate-y-1/2 cursor-pointer",Y),style:{...z,left:B},"aria-label":q,onClick:(U)=>{U.stopPropagation(),X?.(U)},children:G(K5,{className:"h-2.5 w-2.5"})})});function hQ({track:$,children:J}){let Q=q1();return G(k0,{type:"button",variant:"ghost",size:"icon",draggable:!0,className:"h-5 w-5 cursor-grab p-0 active:cursor-grabbing","aria-label":Q("multitrack.reorderTrack",{name:$.name}),"data-multitrack-track-drag-handle":$.id,children:J})}function Ct($){if($==="output")return"outputs";if($==="local")return"local";if($==="url")return"url";if($==="slot")return"slot";return"inputs"}function RS({track:$,totalLength:J,frameRate:Q,width:Z,canvasScale:q,selectedSegmentIds:X,node:Y,app:z,onAddAudio:K,onReplaceAudio:W,onSelectSegment:H,onDeleteSegment:B,onCloneSegment:U,onDeleteTrack:_,onTrackAudioSettingsChange:L,onSharedReferenceChange:F=()=>{},onResizeSegment:V,onResizeSegmentPreview:M,onMoveSegment:D,onDragPreviewChange:N,getDragPreviewStart:O,onDragPreviewEnd:k,onRecognizeSubtitles:I=()=>{},cutMode:b,onCutSegment:A,audioLockEnabled:w=!1}){let C=q1(),y=h$.useRef(null),[x,E]=h$.useState(!1),[P,h]=h$.useState(null),p=h$.useMemo(()=>z9(Y,z,"audio"),[Y,z,x,P]),e=$.segments.reduce((t,H0)=>Math.max(t,H0.end_frame),0),S=$.segments.length===0?6:e/Math.max(J,1)*Z+6,r=K2($.segments),$0=P?$.segments.find((t)=>t.id===P.segmentId):void 0,K0=$0?.content.file_path??$0?.content.local_path??$0?.content.url??($0?.content.slot_name?`__slot__:${$0.content.slot_name}`:"");return T("div",{className:"relative flex h-16 border-b border-border","data-multitrack-track-id":$.id,children:[G("div",{className:"shrink-0 border-r border-border",style:{width:q5},children:G(CW,{track:$,icon:G(hQ,{track:$,children:G(AJ,{className:"h-3.5 w-3.5 text-muted-foreground"})}),preserveSelection:$.segments.some((t)=>X.has(t.id)),onChange:(t)=>L($.id,t)})}),T("div",{ref:y,className:"relative min-w-0 flex-1",children:[$.segments.map((t,H0)=>G(z2,{trackType:"audio",segmentIndex:H0,segment:t,totalLength:J,frameRate:Q,areaWidth:Z,canvasScale:q,selected:X.has(t.id),onSelect:H,onDelete:B,onClone:U,onResize:V,onResizePreview:M,onMove:D,onDragPreviewChange:N,getDragPreviewStart:O,onDragPreviewEnd:k,onRecognizeSubtitles:I,cutMode:b,onCut:A,audioLocked:w&&$.audio_locked===!0,audioLockEnabled:w,onAudioLockToggle:(z0)=>{L($.id,{audio_locked:z0})},sharedReference:t.content.shared_reference===!0,onSharedReferenceToggle:(z0)=>{F($.id,t.id,z0)},onDoubleClick:(z0,j)=>{let d=y.current?.getBoundingClientRect();if(!d)return;h({segmentId:z0,x:(j.clientX-d.left)/Math.max(q,0.01),y:(j.clientY-d.top)/Math.max(q,0.01)})}},t.id)),r.map((t)=>T(a1,{children:[G(T5,{asChild:!0,children:G(G2,{gap:t,totalLength:J,width:Z,ariaLabel:C("multitrack.addAudioSegment")})}),G(s1,{className:"w-auto p-0",align:"center",children:G(V5,{value:"",mediaType:"audio",defaultTab:"inputs",slotItems:p,onChange:(H0,z0="input")=>{let j=p.find((m)=>m.value===H0)?.audio_name,d=j?Y9(j,"input"):void 0;K($.id,H0,z0,d,t.startFrame,t.endFrame)}})})]},`${t.startFrame}-${t.endFrame}`)),T("div",{className:"absolute top-1/2 flex -translate-y-1/2 gap-1",style:{left:S},children:[T(a1,{open:x,onOpenChange:E,children:[G(T5,{asChild:!0,children:G(k0,{type:"button",variant:"secondary",size:"icon",className:"h-5 w-5 cursor-pointer","aria-label":C("multitrack.addAudioSegment"),children:G(K5,{className:"h-2.5 w-2.5"})})}),G(s1,{className:"w-auto p-0",align:"start",children:G(V5,{value:"",mediaType:"audio",defaultTab:"inputs",slotItems:p,onChange:(t,H0="input")=>{let z0=p.find((d)=>d.value===t)?.audio_name,j=z0?Y9(z0,"input"):void 0;K($.id,t,H0,j),E(!1)}})})]}),$.segments.length===0?T(H1,{children:[G(B1,{asChild:!0,children:G(k0,{type:"button",variant:"ghost",size:"icon",className:"h-5 w-5 cursor-pointer text-destructive","aria-label":C("multitrack.deleteTrack",{name:$.name}),onClick:()=>_($.id),children:G(D5,{className:"h-2.5 w-2.5"})})}),G(W1,{children:C("multitrack.deleteTrack",{name:$.name})})]}):null]}),T(a1,{open:P!==null,onOpenChange:(t)=>{if(!t)h(null)},children:[P?G(_6,{asChild:!0,children:G("div",{className:"absolute h-px w-px",style:{left:P.x,top:P.y}})}):null,G(s1,{className:"w-auto p-0",align:"start",children:G(V5,{value:K0,mediaType:"audio",defaultTab:Ct($0?.content.source_type),slotItems:p,onChange:(t,H0="input")=>{if(!P)return;let z0=p.find((d)=>d.value===t)?.audio_name,j=z0?Y9(z0,"input"):void 0;W($.id,P.segmentId,t,H0,j),h(null)}})})]})]})]})}var x$=R(v(),1);function St($){if($==="output")return"outputs";if($==="local")return"local";if($==="url")return"url";if($==="slot")return"slot";return"inputs"}function AF($,J){let Q=J.find((Z)=>Z.value===$)?.video_name;return Q?Y9(Q,"input"):void 0}function CS({track:$,totalLength:J,frameRate:Q,width:Z,canvasScale:q,selectedSegmentIds:X,node:Y,app:z,onAddVideo:K,onSelectSegment:W,onDeleteSegment:H,onCloneSegment:B,canDeleteTrack:U,onDeleteTrack:_,onTrackAudioSettingsChange:L,onSharedReferenceChange:F=()=>{},onResizeSegment:V,onResizeSegmentPreview:M,onMoveSegment:D,onDragPreviewChange:N,getDragPreviewStart:O,onDragPreviewEnd:k,onReplaceVideo:I,onSmartSplit:b,onSmartSplitTasks:A,onRecognizeSubtitles:w=()=>{},cutMode:C,onCutSegment:y,audioLockEnabled:x=!1}){let E=q1(),P=x$.useRef(null),[h,p]=x$.useState(!1),[e,S]=x$.useState(null),r=x$.useMemo(()=>z9(Y,z,"video"),[Y,z,h,e]),$0=e?$.segments.find((j)=>j.id===e.segmentId):void 0,K0=$0?.content.source_type==="slot"&&$0.content.slot_name?`__slot__:${$0.content.slot_name}`:$0?.content.file_path??$0?.content.local_path??$0?.content.url??"",H0=$.segments.reduce((j,d)=>Math.max(j,d.end_frame),0)/Math.max(J,1)*Z,z0=K2($.segments);return T("div",{className:"relative flex h-16 border-b border-border","data-multitrack-track-id":$.id,children:[G("div",{className:"shrink-0 border-r border-border",style:{width:q5},children:G(CW,{track:$,icon:G(hQ,{track:$,children:G(Z4,{className:"h-3.5 w-3.5 text-muted-foreground"})}),preserveSelection:$.segments.some((j)=>X.has(j.id)),onChange:(j)=>L($.id,j)})}),T("div",{ref:P,className:"relative min-w-0 flex-1",children:[$.segments.map((j,d)=>G(z2,{trackType:$.type,segmentIndex:d,segment:j,totalLength:J,frameRate:Q,areaWidth:Z,canvasScale:q,selected:X.has(j.id),onSelect:W,onDelete:H,onClone:B,onSmartSplit:b,onSmartSplitTasks:A,onRecognizeSubtitles:w,cutMode:C,onCut:y,onResize:V,onResizePreview:M,onMove:D,onDragPreviewChange:N,getDragPreviewStart:O,onDragPreviewEnd:k,audioLocked:x&&$.audio_locked===!0,audioLockEnabled:x,onAudioLockToggle:(m)=>{L($.id,{audio_locked:m})},sharedReference:j.content.shared_reference===!0,onSharedReferenceToggle:(m)=>{F($.id,j.id,m)},onDoubleClick:(m,s)=>{let u=P.current?.getBoundingClientRect();if(!u)return;S({segmentId:m,x:(s.clientX-u.left)/Math.max(q,0.01),y:(s.clientY-u.top)/Math.max(q,0.01)})}},j.id)),z0.map((j)=>T(a1,{children:[G(T5,{asChild:!0,children:G(G2,{gap:j,totalLength:J,width:Z,ariaLabel:E("multitrack.addVideo")})}),G(s1,{className:"w-auto p-0",align:"center",children:G(V5,{value:"",mediaType:"video",defaultTab:"inputs",slotItems:r,onChange:(d,m="input")=>{K($.id,d,m,j.startFrame,j.endFrame,AF(d,r))}})})]},`${j.startFrame}-${j.endFrame}`)),T("div",{className:"absolute top-1/2 flex -translate-y-1/2 flex-col gap-1",style:{left:$.segments.length===0?6:H0+6},children:[T(a1,{open:h,onOpenChange:p,children:[G(T5,{asChild:!0,children:G(k0,{type:"button",variant:"secondary",size:"icon",className:"h-5 w-5 cursor-pointer","aria-label":E("multitrack.addVideo"),children:G(K5,{className:"h-2.5 w-2.5"})})}),G(s1,{className:"w-auto p-0",align:"start",children:G(V5,{value:"",mediaType:"video",defaultTab:"inputs",slotItems:r,onChange:(j,d="input")=>{K($.id,j,d,void 0,void 0,AF(j,r)),p(!1)}})})]}),U?T(H1,{children:[G(B1,{asChild:!0,children:G(k0,{type:"button",variant:"ghost",size:"icon",className:"h-5 w-5 cursor-pointer text-destructive","aria-label":E("multitrack.deleteTrack",{name:$.name}),onClick:()=>_($.id),children:G(D5,{className:"h-2.5 w-2.5"})})}),G(W1,{children:E("multitrack.deleteTrack",{name:$.name})})]}):null]}),T(a1,{open:e!==null,onOpenChange:(j)=>{if(!j)S(null)},children:[e?G(_6,{asChild:!0,children:G("div",{className:"absolute h-px w-px",style:{left:e.x,top:e.y}})}):null,G(s1,{className:"w-auto p-0",align:"start",children:G(V5,{value:K0,mediaType:"video",defaultTab:St($0?.content.source_type),slotItems:r,onChange:(j,d="input")=>{if(!e)return;I($.id,e.segmentId,j,d,AF(j,r)),S(null)}})})]})]})]})}function hS({track:$,totalLength:J,frameRate:Q,width:Z,canvasScale:q,selectedSegmentIds:X,onSelectSegment:Y,onAddSubtitleSegment:z,onDeleteSegment:K,onCloneSegment:W,onDeleteTrack:H,onTrackVisibilityChange:B=()=>{},onEditSubtitleSegment:U,onResizeSegment:_,onResizeSegmentPreview:L,onMoveSegment:F,onDragPreviewChange:V,getDragPreviewStart:M,onDragPreviewEnd:D}){let N=q1(),O=$.segments.reduce((A,w)=>Math.max(A,w.end_frame),0),k=$.segments.length===0?6:O/Math.max(J,1)*Z+6,I=K2($.segments),b=$.visible!==!1;return T("div",{className:"relative flex h-[30px] border-b border-border","data-multitrack-track-id":$.id,children:[G("div",{className:"flex shrink-0 items-center justify-center border-r border-border",style:{width:q5},children:G(hQ,{track:$,children:G(S$,{className:"h-3.5 w-3.5 text-muted-foreground"})})}),T("div",{className:"relative min-w-0 flex-1",children:[$.segments.map((A,w)=>G(z2,{trackType:"subtitle",segmentIndex:w,segment:A,totalLength:J,frameRate:Q,areaWidth:Z,canvasScale:q,selected:X.has(A.id),onSelect:Y,onDelete:K,onClone:W,onResize:_,onResizePreview:L,onMove:F,onDragPreviewChange:V,getDragPreviewStart:M,onDragPreviewEnd:D,dimmed:!b,onDoubleClick:()=>{Y(A.id),U(A.id)}},A.id)),I.map((A)=>G(G2,{gap:A,totalLength:J,width:Z,ariaLabel:N("multitrack.addSubtitleSegment"),onClick:()=>z($.id,A.startFrame,A.endFrame)},`${A.startFrame}-${A.endFrame}`)),T("div",{className:"absolute top-1/2 flex -translate-y-1/2 flex-row gap-1",style:{left:k},children:[T(H1,{children:[G(B1,{asChild:!0,children:G(k0,{type:"button",variant:"secondary",size:"icon",className:"h-5 w-5 cursor-pointer","aria-label":N("multitrack.addSubtitleSegment"),onClick:(A)=>{A.stopPropagation(),z($.id)},children:G(K5,{className:"h-2.5 w-2.5"})})}),G(W1,{children:N("multitrack.addSubtitleSegment")})]}),$.segments.length===0?T(H1,{children:[G(B1,{asChild:!0,children:G(k0,{type:"button",variant:"ghost",size:"icon",className:"h-5 w-5 cursor-pointer text-destructive","aria-label":N("multitrack.deleteTrack",{name:$.name}),onClick:()=>H($.id),children:G(D5,{className:"h-2.5 w-2.5"})})}),G(W1,{children:N("multitrack.deleteTrack",{name:$.name})})]}):null,T(H1,{children:[G(B1,{asChild:!0,children:G(k0,{type:"button",variant:b?"ghost":"outline",size:"icon",className:`h-5 w-5 cursor-pointer ${b?"text-muted-foreground":"text-foreground"}`,"aria-label":b?N("multitrack.hideSubtitleTrack",{name:$.name}):N("multitrack.showSubtitleTrack",{name:$.name}),"aria-pressed":!b,onClick:(A)=>{A.stopPropagation(),B($.id,!b)},children:b?G(SS,{className:"h-2.5 w-2.5"}):G(b7,{className:"h-2.5 w-2.5"})})}),G(W1,{children:b?N("multitrack.hideSubtitleTrack",{name:$.name}):N("multitrack.showSubtitleTrack",{name:$.name})})]})]})]})]})}function ht({type:$}){return G($==="video"?Z4:$==="audio"?e9:$==="subtitle"?S$:$==="task"?yW:gS,{className:"h-3.5 w-3.5 text-muted-foreground"})}function xS($,J){if($===J)return!0;if(!$||!J)return!1;return $.segmentId===J.segmentId&&$.targetTrackId===J.targetTrackId&&$.insertIndex===J.insertIndex&&$.start_frame===J.start_frame&&$.end_frame===J.end_frame}var xt=new Set(["mp3","wav","flac","ogg","m4a","aac","opus","wma"]),ft=new Set(["mp4","webm","mov","mkv","avi","m4v"]),vt=new Set(["png","jpg","jpeg","webp","gif","bmp","tif","tiff","avif"]);function dS($){let J=$.name.split(".").pop()?.toLowerCase()??"";if(J==="srt")return"subtitle";if($.type.startsWith("audio/"))return"audio";if($.type.startsWith("video/"))return"video";if($.type.startsWith("image/"))return"image";if(xt.has(J))return"audio";if(ft.has(J))return"video";if(vt.has(J))return"image";return null}function gt($){let J=pS($);if(J)return dS(J);for(let Q of Array.from($.items)){if(Q.kind!=="file")continue;if(Q.type==="application/x-subrip")return"subtitle";if(Q.type.startsWith("audio/"))return"audio";if(Q.type.startsWith("video/"))return"video";if(Q.type.startsWith("image/"))return"image"}return null}function fS($){return Array.from($.types).includes("Files")||$.files.length>0||Array.from($.items).some((J)=>J.kind==="file")}function pS($){let J=Array.from($.files)[0];if(J)return J;for(let Q of Array.from($.items)){if(Q.kind!=="file")continue;let Z=Q.getAsFile();if(Z)return Z}return null}function lS({data:$,node:J,app:Q,width:Z,currentTime:q,snapEnabled:X,canvasScale:Y,selectedSegmentIds:z,taskOverview:K=!1,onAddVideo:W,onAddAudio:H,onReplaceAudio:B,onAddTrack:U,onAddSubtitleSegment:_,onImportSubtitles:L=()=>{},onReplaceVideo:F,onAddTaskSegment:V,onSelectSegment:M,onSelectSegments:D,onClearSelection:N,onDeleteSegment:O,onDeleteTrack:k,onReorderTrack:I=()=>{},onTrackVisibilityChange:b=()=>{},onTrackAudioSettingsChange:A,onSharedReferenceChange:w=()=>{},onDistributeTaskSegments:C,onCloneTaskSegment:y,canMergeSelectedTaskSegments:x=!1,onMergeSelectedTaskSegments:E,onSplitTaskSegment:P=()=>{},onResizeSegment:h,onResizeSegmentPreview:p,onMoveSegment:e,onSmartSplit:S,onSmartSplitTasks:r,onRecognizeSubtitles:$0=()=>{},onEditSubtitleSegment:K0=()=>{},cutMode:t,onCutSegment:H0,format:z0}){let j=q1(),d=I6.useRef(null),m=I6.useRef(null),s=I6.useRef(null),u=I6.useRef(!1),c=I6.useRef(!1),i=I6.useRef(null),[f,o]=I6.useState(null),[G0,l]=I6.useState(null),[Z0,Q0]=I6.useState(null),[B0,W0]=I6.useState(null),L0=Math.max($.total_length,1),_0=Math.max(1,Z-q5),N0=Math.max(1,_0-S2),d0=q5+q/L0*N0,g=q5+N0,a=24,I0=$.tracks.reduce((X0,O0)=>X0+fQ(O0.type,K),0),A0=I0+24,F0=$.tracks.find((X0)=>X0.type==="video")?.id,m0=$.tracks.filter((X0)=>X0.type==="video").length>=xQ,R0=$.tracks.filter((X0)=>X0.type==="audio").length>=xQ,n0=$.tracks.filter((X0)=>X0.type==="subtitle").length>=xQ,C0=$.tracks.reduce((X0,O0)=>{let x0=X0.at(-1)?.bottom??0;return X0.push({id:O0.id,top:x0,bottom:x0+fQ(O0.type,K)}),X0},[]);I6.useEffect(()=>{return()=>{i.current?.()}},[]);function z1(X0){let O0=d.current?.getBoundingClientRect();if(!O0)return null;let x0=(X0-O0.top)/Math.max(Y,0.01);return C0.find((J1)=>x0>=J1.top&&x0e1.id===X0);if(!J1)return!1;let f1=q5+O0.start_frame/L0*N0,J0=q5+O0.end_frame/L0*N0,u0=J1.top+4,g0=J1.bottom-4,N1=x0.left+x0.width,M1=x0.top+x0.height;return f1x0.left&&u0x0.top}function b1(X0){return $.tracks.flatMap((O0)=>O0.segments.filter((x0)=>C1(O0.id,x0,X0)).map((x0)=>x0.id))}function n(X0){if(X0.button!==0||t)return!1;let O0=X0.target;return!O0.closest("[data-multitrack-segment]")&&!O0.closest("button")&&!O0.closest('[role="button"]')&&!O0.closest("[data-radix-popper-content-wrapper]")}function D0(){i.current?.();let X0=null,O0=(J1)=>{J1.preventDefault(),J1.stopPropagation(),J1.stopImmediatePropagation(),x0()};function x0(){if(globalThis.removeEventListener("click",O0,!0),X0!==null)globalThis.clearTimeout(X0);if(i.current===x0)i.current=null}i.current=x0,globalThis.addEventListener("click",O0,!0),X0=globalThis.setTimeout(x0,0)}function w0(X0){if(!n(X0))return;let O0=Q1(X0.clientX,X0.clientY);if(!O0||O0.y>A0)return;X0.preventDefault(),X0.stopPropagation(),m.current=O0,u.current=!1;function x0(f1){let J0=m.current,u0=a0(f1.clientX,f1.clientY);if(!J0||!u0)return;let g0=R1(J0,u0);if(g0.width>3||g0.height>3)u.current=!0;W0(g0)}function J1(f1){let J0=m.current,u0=a0(f1.clientX,f1.clientY);if(m.current=null,W0(null),globalThis.removeEventListener("mousemove",x0),globalThis.removeEventListener("mouseup",J1),!J0||!u0)return;if(!u.current){N();return}c.current=!0,D0();let g0=b1(R1(J0,u0));D(g0)}globalThis.addEventListener("mousemove",x0),globalThis.addEventListener("mouseup",J1)}function f0(X0,O0,x0){let J1=d.current?.getBoundingClientRect(),f1=z1(O0),J0=$.tracks.find((L1)=>L1.id===f1),u0=x0==="image"?J0?.type==="task":x0===J0?.type;if(!J1||!J0||!u0)return null;let g0=(X0-J1.left)/Math.max(Y,0.01)-q5,N1=Math.round(Math.max(0,Math.min(N0,g0))/N0*L0),M1=[...J0.segments].sort((L1,j8)=>L1.start_frame-j8.start_frame),e1=M1.filter((L1)=>L1.start_frame+(L1.end_frame-L1.start_frame)/2x0.id===O0?.dataset.multitrackTrackId)}function x1(X0){if(!(X0.target instanceof Element))return;let O0=X0.target.closest("[data-multitrack-track-drag-handle]"),x0=$.tracks.find((J1)=>J1.id===O0?.dataset.multitrackTrackDragHandle);if(!x0||x0.type==="task")return;s.current=x0.id,X0.dataTransfer.effectAllowed="move",X0.dataTransfer.setData("application/x-easy-media-track",x0.id)}function r1(X0){let O0=s.current,x0=K1(X0.target);if(!O0||!x0||x0.type==="task"||x0.id===O0)return;X0.preventDefault(),X0.stopPropagation(),X0.dataTransfer.dropEffect="move"}function Y0(X0){let O0=s.current,x0=K1(X0.target);if(s.current=null,!O0||!x0||x0.type==="task"||x0.id===O0)return;X0.preventDefault(),X0.stopPropagation(),I(O0,x0.id)}async function y0(X0){if(!fS(X0.dataTransfer))return;X0.preventDefault(),X0.stopPropagation();let O0=pS(X0.dataTransfer),x0=O0?dS(O0):null,J1=f0(X0.clientX,X0.clientY,x0);if(l(null),!O0||!J1)return;Q0({...J1,fileName:O0.name});try{if(x0==="subtitle"){L(J1.trackId,await O0.text(),J1.frame);return}if(x0==="image"){let J0=await j7(O0);R5("inputs"),V(J1.trackId,J1.frame,void 0,[J0]);return}let f1=await VZ(O0);if(R5("inputs"),x0==="video")W(J1.trackId,f1,"input",J1.frame);else H(J1.trackId,f1,"input",void 0,J1.frame)}catch(f1){console.error("[TrackArea] failed to process dropped media:",f1)}finally{Q0(null)}}function h0(X0){let O0=C0.find((f1)=>f1.id===X0.targetTrackId);if(!O0)return null;let x0=q5+X0.start_frame/L0*N0,J1=q5+X0.end_frame/L0*N0;return{left:x0,top:O0.top+4,width:Math.max(2,J1-x0),height:Math.max(2,O0.bottom-O0.top-8)}}function i0(){return Math.max(1,Math.round(8/N0*L0))}function E0(X0,O0){return X?uS($,X0,O0,i0(),q):b8(O0,$.frame_rate)}function D1(X0,O0,x0){let J1=z1(x0);if(!J1){o((J0)=>xS(J0,null)?J0:null);return}let f1=mS($.tracks,X0,J1,E0(X0,O0),$.frame_rate);o((J0)=>xS(J0,f1)?J0:f1)}function u1(X0,O0,x0,J1){let f1=z1(J1);if(o(null),!f1)return;e(X0,f1??O0,E0(X0,x0))}let j1=f?h0(f):null,t1=f?cS($.tracks,f,$.frame_rate):null;function M5(X0){if(!f||X0.id===f.segmentId)return X0;return t1?.find((O0)=>O0.id===X0.id)??X0}return T("div",{ref:d,className:"relative shrink-0",style:{width:Z,height:A0},"data-multitrack-track-area":!0,onDragOverCapture:r0,onDragLeave:(X0)=>{let O0=X0.relatedTarget;if(!(O0 instanceof Node)||!X0.currentTarget.contains(O0))l(null)},onDropCapture:y0,onDragStart:x1,onDragOver:r1,onDrop:Y0,onDragEnd:()=>{s.current=null},onMouseDown:w0,onClick:(X0)=>{if(X0.stopPropagation(),c.current){c.current=!1;return}let O0=X0.target;if(!O0.closest("[data-multitrack-segment]")&&!O0.closest("button")&&!O0.closest('[role="button"]'))N()},children:[G("div",{className:"pointer-events-none absolute top-0 z-10 bg-black/30",style:{left:g,width:S2,height:I0}}),G("div",{className:"absolute top-0 z-20 w-px bg-destructive",style:{left:d0,height:I0}}),$.tracks.map((X0)=>{if(X0.type==="video")return G(CS,{track:{...X0,segments:X0.segments.map((O0)=>M5(O0))},totalLength:$.total_length,frameRate:$.frame_rate,width:N0,canvasScale:Y,selectedSegmentIds:z,node:J,app:Q,onAddVideo:W,onReplaceVideo:F,onSelectSegment:M,onDeleteSegment:O,onCloneSegment:(O0)=>y(X0.id,O0),onSmartSplit:S,onSmartSplitTasks:r,onRecognizeSubtitles:$0,cutMode:t,onCutSegment:H0,canDeleteTrack:X0.id!==F0,onDeleteTrack:k,onTrackAudioSettingsChange:A,onSharedReferenceChange:w,onResizeSegment:h,onResizeSegmentPreview:p,onMoveSegment:(O0,x0,J1)=>{u1(O0,X0.id,x0,J1)},onDragPreviewChange:D1,getDragPreviewStart:E0,onDragPreviewEnd:()=>o(null),audioLockEnabled:C$(z0)},X0.id);if(X0.type==="audio")return G(RS,{track:{...X0,segments:X0.segments.map((O0)=>M5(O0))},totalLength:$.total_length,frameRate:$.frame_rate,width:N0,canvasScale:Y,selectedSegmentIds:z,node:J,app:Q,onAddAudio:H,onReplaceAudio:B,onSelectSegment:M,onDeleteSegment:O,onCloneSegment:(O0)=>y(X0.id,O0),onDeleteTrack:k,onTrackAudioSettingsChange:A,onSharedReferenceChange:w,onResizeSegment:h,onResizeSegmentPreview:p,onMoveSegment:(O0,x0,J1)=>u1(O0,X0.id,x0,J1),onDragPreviewChange:D1,getDragPreviewStart:E0,onDragPreviewEnd:()=>o(null),onRecognizeSubtitles:$0,cutMode:t,onCutSegment:H0,audioLockEnabled:C$(z0)},X0.id);if(X0.type==="subtitle")return G(hS,{track:{...X0,segments:X0.segments.map((O0)=>M5(O0))},totalLength:$.total_length,frameRate:$.frame_rate,width:N0,canvasScale:Y,selectedSegmentIds:z,onSelectSegment:M,onAddSubtitleSegment:_,onDeleteSegment:O,onCloneSegment:(O0)=>y(X0.id,O0),onDeleteTrack:k,onTrackVisibilityChange:b,onEditSubtitleSegment:K0,onResizeSegment:h,onResizeSegmentPreview:p,onMoveSegment:(O0,x0,J1)=>u1(O0,X0.id,x0,J1),onDragPreviewChange:D1,getDragPreviewStart:E0,onDragPreviewEnd:()=>o(null)},X0.id);return T("div",{"data-testid":`track-row-${X0.id}`,"data-multitrack-track-id":X0.id,className:"relative flex border-b border-border",style:{height:fQ(X0.type,K)},children:[G("div",{className:"flex shrink-0 items-center justify-center border-r border-border",style:{width:q5},children:G(ht,{type:X0.type})}),T("div",{className:"relative min-w-0 flex-1",children:[X0.segments.map((O0,x0)=>G(z2,{trackType:X0.type,segmentIndex:x0,segment:M5(O0),totalLength:$.total_length,frameRate:$.frame_rate,areaWidth:N0,canvasScale:Y,selected:z.has(O0.id),showTaskIndex:($.task_markers??[]).length===0,taskOverview:X0.type==="task"&&K,onSelect:M,onDelete:O,onDistribute:X0.type==="task"?()=>C(X0.id):void 0,onClone:X0.type==="task"?(J1)=>y(X0.id,J1):void 0,onMerge:X0.type==="task"&&z.has(O0.id)&&x?E:void 0,onSplitTask:X0.type==="task"?P:void 0,cutMode:t,onCut:H0,onResize:h,onResizePreview:p,onMove:(J1,f1,J0)=>{u1(J1,X0.id,f1,J0)},onDragPreviewChange:D1,getDragPreviewStart:E0,onDragPreviewEnd:()=>o(null)},O0.id)),X0.type==="task"?T(G1,{children:[K2(X0.segments).map((O0)=>G(G2,{gap:O0,totalLength:$.total_length,width:N0,ariaLabel:j("multitrack.addTaskSegment"),onClick:()=>V(X0.id,O0.startFrame,O0.endFrame)},`${O0.startFrame}-${O0.endFrame}`)),G(k0,{type:"button",variant:"secondary",size:"icon",className:"absolute top-1/2 h-5 w-5 cursor-pointer",style:{left:X0.segments.length===0?6:X0.segments.reduce((O0,x0)=>Math.max(O0,x0.end_frame),0)/L0*N0+6,transform:"translateY(-50%)"},"aria-label":j("multitrack.addTaskSegment"),onClick:(O0)=>{O0.stopPropagation(),V(X0.id)},children:G(K5,{className:"h-2.5 w-2.5"})})]}):T(H1,{children:[G(B1,{asChild:!0,children:G(k0,{type:"button",variant:"ghost",size:"icon",className:"absolute top-1/2 h-5 w-5 -translate-y-1/2 cursor-pointer text-destructive",style:{left:X0.segments.length===0?6:X0.segments.reduce((O0,x0)=>Math.max(O0,x0.end_frame),0)/L0*N0+6},"aria-label":j("multitrack.deleteTrack",{name:X0.name}),onClick:()=>k(X0.id),children:G(D5,{className:"h-2.5 w-2.5"})})}),G(W1,{children:j("multitrack.deleteTrack",{name:X0.name})})]})]})]},X0.id)}),T("div",{className:"flex items-center justify-center gap-1 border-b border-border text-[10px] text-muted-foreground",style:{height:24},children:[G("span",{children:j("multitrack.addTrack")}),T(H1,{children:[G(B1,{asChild:!0,children:G(k0,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 cursor-pointer disabled:cursor-not-allowed",disabled:m0,"aria-label":j("multitrack.addVideoTrack"),onClick:()=>U("video"),children:G(vS,{className:"h-3.5 w-3.5"})})}),G(W1,{children:j("multitrack.addVideoTrack")})]}),T(H1,{children:[G(B1,{asChild:!0,children:G(k0,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 cursor-pointer disabled:cursor-not-allowed",disabled:R0,"aria-label":j("multitrack.addAudioTrack"),onClick:()=>U("audio"),children:G(AJ,{className:"h-3.5 w-3.5"})})}),G(W1,{children:j("multitrack.addAudioTrack")})]}),T(H1,{children:[G(B1,{asChild:!0,children:G(k0,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 cursor-pointer disabled:cursor-not-allowed",disabled:n0,"aria-label":j("multitrack.addSubtitleTrack"),onClick:()=>U("subtitle"),children:G(S$,{className:"h-3.5 w-3.5"})})}),G(W1,{children:j("multitrack.addSubtitleTrack")})]})]}),j1?G("div",{className:"pointer-events-none absolute z-10 rounded border border-border bg-muted/60",style:j1}):null,B0?G("div",{className:"pointer-events-none absolute z-40 rounded border border-primary bg-primary/10",style:B0}):null,G0?(()=>{let X0=C0.find((O0)=>O0.id===G0.trackId);if(!X0)return null;return G("div",{"data-testid":"external-media-drop-slot",className:"pointer-events-none absolute z-30 w-1 rounded bg-primary",style:{left:q5+G0.frame/L0*N0,top:X0.top+4,height:X0.bottom-X0.top-8}})})():null,Z0?(()=>{let X0=C0.find((O0)=>O0.id===Z0.trackId);if(!X0)return null;return T("div",{role:"status","aria-live":"polite",className:"pointer-events-none absolute z-40 flex max-w-48 items-center gap-1.5 rounded border border-border bg-background/95 px-2 py-1 text-[10px] text-foreground shadow-sm",style:{left:q5+Z0.frame/L0*N0,top:X0.top+(X0.bottom-X0.top)/2,transform:"translate(-50%, -50%)"},children:[G(X6,{className:"h-3.5 w-3.5 shrink-0 animate-spin"}),G("span",{className:"truncate",children:j("multitrack.externalMediaUploading",{name:Z0.fileName})})]})})():null]})}function ut($){if($&&typeof $==="object"&&!Array.isArray($)){if(Array.isArray($.tracks))return jF($)}return _h()}function SW($,J){let Q=[...$].sort((B,U)=>B.start_frame-U.start_frame),Z=Q.filter((B)=>B.start_frame+(B.end_frame-B.start_frame)/2{let U=B.end_frame-B.start_frame,_=Math.max(B.start_frame,W);return W=_+U,{...B,start_frame:_,end_frame:W}});return[...q,K,...H]}function iS($){let J=$.task_overview===!0;return $.tracks.reduce((Q,Z)=>Q+fQ(Z.type,J),0)}function mt({value:$,onChange:J,app:Q,node:Z}){let q=ut($),X=JSON.stringify(q),[Y,z]=i1.useState(null),K=Y??q,W=K.task_overview===!0,H=i1.useRef(q);H.current=q;let[B,U]=i1.useState(0),[_,L]=i1.useState(!1),[F,V]=i1.useState(1),[M,D]=i1.useState(!0),[N,O]=i1.useState(!1),[k,I]=i1.useState(null),[b,A]=i1.useState(null),[w,C]=i1.useState(()=>new Set),[y,x]=i1.useState(null),[E,P]=i1.useState(null),[h,p]=i1.useState(!1),[e,S]=i1.useState(!1),[r,$0]=i1.useState(0),[K0,t]=i1.useState(null),[H0,z0]=i1.useState(!1),[j,d]=i1.useState(null),m=i1.useRef(null),s=i1.useRef(null),u=i1.useRef(0),c=i1.useRef(0),i=i1.useRef(0),o=Math.max(1,wJ(s))*F,G0=a9(Q),l=nY(Z),Z0=w.size<=1?bF(K,b):null,Q0=w.size>1?K.tracks.flatMap((q0)=>q0.type==="task"?q0.segments.filter((V0)=>w.has(V0.id)):[]):[],B0=Q0.length===w.size&&Q0.length>1,W0=TF(K.tracks,w)!==null,L0=Z0??(B0?bF(K,b):null),_0=L0?.trackType==="task"?K.tracks.find((q0)=>q0.id===L0.trackId&&q0.type==="task")?.segments??[L0.segment]:void 0,N0=E?K.tracks.find((q0)=>q0.type==="task"&&q0.segments.some((V0)=>V0.id===E))?.segments.find((q0)=>q0.id===E)??null:null,d0=i1.useCallback((q0)=>{let V0=iS(q0)-iS(H.current);rS(Z,V0),H.current=q0,J(q0)},[Z,J]),{canUndo:g,canRedo:a,commitChange:I0,undo:A0,redo:F0}=KI(q,d0),m0=Q?.ui?.settings?.settingsValues?.["Comfy.Locale"],R0=(q0,V0)=>xW(m0,q0,V0),n0=K0?.directory.split(/[\\/]/).filter(Boolean).at(-1)??"";function C0(q0){I0(jF(q0))}function z1(q0){A(q0),C(q0?new Set([q0]):new Set)}function Q1(q0){let V0=b8(q0,K.frame_rate);i.current=V0,U(V0)}function a0(q0,V0="replace"){let U0=K.tracks.find((M0)=>M0.type==="task"&&M0.segments.some((S0)=>S0.id===q0))?.segments.find((M0)=>M0.id===q0);if(U0&&(i.current=U0.end_frame))Q1(U0.start_frame);I(null),C((M0)=>{if(V0==="replace")return A(q0),new Set([q0]);let S0=new Set(M0);if(V0==="toggle"&&S0.has(q0))return S0.delete(q0),A((j0)=>j0===q0?S0.values().next().value??null:j0),S0;return S0.add(q0),A(q0),S0})}function R1(q0){I(null);let V0=new Set(q0);C(V0),A(q0.at(-1)??null)}function C1(){z1(null),I(null)}i1.useEffect(()=>{z(null);let q0=new Set(q.tracks.flatMap((V0)=>V0.segments.map((U0)=>U0.id)));C((V0)=>{let U0=new Set([...V0].filter((M0)=>q0.has(M0)));return A((M0)=>M0&&!q0.has(M0)?U0.values().next().value??null:M0),U0}),I((V0)=>V0&&q.task_markers?.some((U0)=>U0.id===V0)?V0:null)},[X]);function b1(){let q0=b8(B,K.frame_rate);return q0>0&&q0<=K.total_length&&!(K.task_markers??[]).some((V0)=>V0.frame===q0)}function n(){let q0=b8(B,K.frame_rate);if(!b1())return;let V0={id:v1(),frame:q0};C0({...K,task_markers:[...K.task_markers??[],V0]}),z1(null),I(V0.id)}function D0(q0){if(!(K.task_markers??[]).some((V0)=>V0.id===q0))return;C0({...K,task_markers:(K.task_markers??[]).filter((V0)=>V0.id!==q0)}),I((V0)=>V0===q0?null:V0)}function w0(q0,V0){let U0=b8(V0,K.frame_rate),M0=K.task_markers??[],S0=M0.find((j0)=>j0.id===q0);if(!S0||S0.frame===U0)return;if(U0<=0||U0>K.total_length)return;if(M0.some((j0)=>j0.id!==q0&&j0.frame===U0))return;C0({...K,task_markers:M0.map((j0)=>j0.id===q0?{...j0,frame:U0}:j0)})}function f0(q0){C0({...q,task_overview:q0})}i1.useEffect(()=>{i.current=B},[B]),i1.useEffect(()=>{if(!b||w.size!==1)return;let q0=K.tracks.find((M0)=>M0.type==="task"&&M0.segments.some((S0)=>S0.id===b)),V0=q0?.segments.find((M0)=>M0.id===b);if(!q0||!V0)return;if(B>=V0.start_frame&&BB>=M0.start_frame&&B{let q0=Z;return q0.__easyMediaSyncPlay=()=>{if(m.current!==null)cancelAnimationFrame(m.current);m.current=null,i.current=0,c.current=0,u.current=performance.now(),U(0),L(!0),$0((V0)=>V0+1)},()=>{if(q0.__easyMediaSyncPlay)delete q0.__easyMediaSyncPlay}},[Z]),i1.useEffect(()=>{let q0=Q.api;if(!q0?.addCustomEventListener||!q0.removeCustomEventListener)return;let V0=(U0)=>{let M0=aY(U0.detail);if(!M0)return;t(M0),d(null),z0(!1)};return q0.addCustomEventListener(IB,V0),()=>q0.removeCustomEventListener?.(IB,V0)},[Q]),i1.useEffect(()=>{if(!_){if(m.current!==null)cancelAnimationFrame(m.current);m.current=null;return}u.current=performance.now(),c.current=i.current;function q0(V0){let U0=(V0-u.current)/1000,M0=b8(c.current+R9(U0,K.frame_rate),K.frame_rate);if(M0>=K.total_length){i.current=0,c.current=0,u.current=V0,U(0),$0((S0)=>S0+1),m.current=requestAnimationFrame(q0);return}i.current=M0,U(M0),m.current=requestAnimationFrame(q0)}return m.current=requestAnimationFrame(q0),()=>{if(m.current!==null)cancelAnimationFrame(m.current)}},[_,r,K.frame_rate,K.total_length]);async function r0(q0,V0,U0,M0,S0,j0){let t0=kF(V0,U0);if(j0)t0.url=j0;let Z1=Z5(t0),l1;if(Z1)try{let m5=await jZ(Z1);if(Number.isFinite(m5.duration)&&m5.duration>0)l1=m5.duration}catch(m5){console.error("[MultiTrackWidget] failed to read video metadata:",m5)}let E1=H.current,$5={added:!1,startFrame:0,endFrame:0},m1=E1.tracks.map((m5)=>{if(m5.id!==q0)return m5;let z7=M0===void 0?b8(m5.segments.reduce((d9,vQ)=>Math.max(d9,vQ.end_frame),0),E1.frame_rate):Math.max(0,Math.round(M0)),UX=S0===void 0?z7+Math.max(1,hW(l1??wF,E1.frame_rate)):Math.max(z7+1,Math.round(S0));return $5.added=!0,$5.startFrame=z7,$5.endFrame=UX,{...m5,segments:(()=>{let d9={id:v1(),start_frame:z7,end_frame:UX,color:m5.color,content:{...t0,...l1===void 0?{}:{duration:l1}}};if(M0===void 0)return[...m5.segments,d9];return SW(m5.segments,d9)})()}}),T6=M0===void 0?m1:eS(E1.tracks,m1),H2=$5.added?$h(T6,$5.startFrame,$5.endFrame):T6;C0({...E1,tracks:H2,total_length:U8(H2,E1.frame_rate)})}async function K1(q0,V0,U0,M0,S0,j0){let t0=IF(V0,U0);if(M0)t0.url=M0;let Z1=Z5(t0),l1;if(Z1)try{l1=(await yB(Z1)).duration}catch(m1){console.error("[MultiTrackWidget] failed to read audio metadata:",m1)}let E1=H.current,$5=E1.tracks.map((m1)=>{if(m1.id!==q0||m1.type!=="audio")return m1;let T6=S0===void 0?m1.segments.reduce((m5,z7)=>Math.max(m5,z7.end_frame),0):Math.max(0,Math.round(S0)),H2=j0===void 0?T6+Math.max(1,hW(l1??wF,E1.frame_rate)):Math.max(T6+1,Math.round(j0));return{...m1,segments:(()=>{let m5={id:v1(),start_frame:T6,end_frame:H2,color:m1.color,content:{...t0,...l1===void 0?{}:{duration:l1}}};if(S0===void 0)return[...m1.segments,m5];return SW(m1.segments,m5)})()}});C0({...E1,tracks:$5,total_length:U8($5,E1.frame_rate)})}async function x1(q0,V0,U0,M0,S0){let j0=IF(U0,M0);if(S0)j0.url=S0;let t0=Z5(j0),Z1=null;if(t0)try{Z1=(await yB(t0)).duration}catch($5){console.error("[MultiTrackWidget] failed to read replacement audio metadata:",$5)}let l1=H.current,E1=l1.tracks.map(($5)=>{if($5.id!==q0||$5.type!=="audio")return $5;return{...$5,segments:$5.segments.map((m1)=>{if(m1.id!==V0)return m1;return{...m1,end_frame:Z1===null?m1.end_frame:oS(m1,Z1,l1.frame_rate),origin_start_frame:m1.start_frame,content:{...j0,...Z1===null?{}:{duration:Z1},muted:m1.content.muted??j0.muted,volume_db:m1.content.volume_db??j0.volume_db,shared_reference:m1.content.shared_reference===!0}}})}});C0({...l1,tracks:E1,total_length:U8(E1,l1.frame_rate)})}function r1(q0){if(q0!=="video"&&q0!=="audio"&&q0!=="subtitle")return;let V0=K.tracks.filter((S0)=>S0.type===q0).length;if(V0>=xQ)return;let U0=q0==="video"||q0==="audio",M0={id:v1(),name:`${q0==="video"?"Video":q0==="audio"?"Audio":"Subtitle"} ${V0}`,type:q0,color:q0==="subtitle"?P2:TZ[q0],muted:!1,solo:U0?!1:void 0,volume_db:U0?R2:void 0,locked:!1,segments:[]};C0({...K,tracks:[...K.tracks,M0]})}function Y0(q0){let V0=K.tracks.find((j0)=>j0.id===q0),U0=K.tracks.find((j0)=>j0.type==="video")?.id;if(!V0||V0.type==="task"||V0.id===U0)return;let M0=new Set(V0.segments.map((j0)=>j0.id)),S0=K.tracks.filter((j0)=>j0.id!==q0);C0({...K,tracks:S0,total_length:U8(S0,K.frame_rate)}),C((j0)=>{let t0=new Set([...j0].filter((Z1)=>!M0.has(Z1)));return A((Z1)=>Z1&&M0.has(Z1)?t0.values().next().value??null:Z1),t0})}function y0(q0,V0){let U0=K.tracks.findIndex((Z1)=>Z1.id===q0),M0=K.tracks.findIndex((Z1)=>Z1.id===V0),S0=K.tracks[U0],j0=K.tracks[M0];if(U0<0||M0<0||U0===M0||S0?.type==="task"||j0?.type==="task")return;let t0=[...K.tracks];t0[U0]=j0,t0[M0]=S0,C0({...K,tracks:t0})}function h0(q0,V0){if("audio_locked"in V0){C0(Uh(K,q0,V0.audio_locked===!0));return}if("solo"in V0){let U0=K.tracks.find((j0)=>j0.id===q0);if(!U0||U0.type!=="video"&&U0.type!=="audio")return;let M0=V0.solo===!0,S0=K.tracks.map((j0)=>{if(j0.type!=="video"&&j0.type!=="audio")return j0;if(j0.id===q0)return{...j0,...V0,solo:M0,muted:M0?!1:j0.muted};return{...j0,solo:!1,muted:M0?!0:!1}});C0({...K,tracks:S0});return}C0({...K,tracks:K.tracks.map((U0)=>U0.id===q0?{...U0,...V0}:U0)})}function i0(q0,V0){C0({...K,tracks:K.tracks.map((U0)=>U0.id===q0&&U0.type==="subtitle"?{...U0,visible:V0}:U0)})}function E0(q0,V0,U0){C0({...K,tracks:K.tracks.map((M0)=>{if(M0.id!==q0||M0.type!=="audio"&&M0.type!=="video")return M0;return{...M0,segments:M0.segments.map((S0)=>({...S0,content:{...S0.content,shared_reference:U0&&S0.id===V0,speaker_reference:void 0}}))}})})}async function D1(q0,V0,U0,M0,S0){let j0=kF(U0,M0);if(S0)j0.url=S0;let t0=Z5(j0),Z1;if(t0)try{let E1=await jZ(t0);if(Number.isFinite(E1.duration)&&E1.duration>0)Z1=E1.duration}catch(E1){console.error("[MultiTrackWidget] failed to read replacement video metadata:",E1)}let l1=K.tracks.map((E1)=>{if(E1.id!==q0)return E1;return{...E1,segments:E1.segments.map(($5)=>$5.id===V0?{...$5,content:{...j0,...Z1===void 0?{}:{duration:Z1},shared_reference:$5.content.shared_reference===!0}}:$5)}});C0({...K,tracks:l1,total_length:U8(l1,K.frame_rate)})}function u1(q0,V0,U0,M0){let S0=K.tracks.map((j0)=>{if(j0.id!==q0||j0.type!=="task")return j0;let t0=V0===void 0?b8(j0.segments.reduce((E1,$5)=>Math.max(E1,$5.end_frame),0),K.frame_rate):Math.max(0,Math.round(V0)),Z1=U0===void 0?t0+Math.max(1,R9(5,K.frame_rate)):Math.max(t0+1,Math.round(U0)),l1={id:v1(),start_frame:t0,end_frame:Z1,color:j0.color,content:{media_type:"none",...tS(j0.segments,t0,j0.task_mode??"default"),images:M0??[]}};return{...j0,segments:V0===void 0?[...j0.segments,l1]:SW(j0.segments,l1)}});C0({...K,tracks:S0,total_length:U8(S0,K.frame_rate)})}function j1(q0,V0,U0){let M0=K.tracks.map((S0)=>{if(S0.id!==q0||S0.type!=="subtitle")return S0;let j0=V0===void 0?b8(S0.segments.reduce((E1,$5)=>Math.max(E1,$5.end_frame),0),K.frame_rate):Math.max(0,Math.round(V0)),t0=U0===void 0?j0+Math.max(1,R9(5,K.frame_rate)):Math.max(j0+1,Math.round(U0)),Z1=S0.segments.find((E1)=>E1.content.subtitle_style)?.content.subtitle_style,l1={id:v1(),start_frame:j0,end_frame:t0,color:S0.color||P2,content:{media_type:"subtitle",text:"默认文字",subtitle_style:{...Z1??C2}}};return{...S0,segments:V0===void 0?[...S0.segments,l1]:SW(S0.segments,l1)}});C0({...K,tracks:M0,total_length:U8(M0,K.frame_rate)})}function t1(q0,V0,U0){let M0=H.current,S0=M0.tracks.map((j0)=>{if(j0.id!==q0||j0.type!=="subtitle")return j0;let t0=j0.segments.find((m1)=>m1.content.subtitle_style)?.content.subtitle_style,Z1=DI(V0,{color:j0.color||P2,createId:()=>v1(),frameRate:M0.frame_rate,startFrame:Math.max(0,Math.round(U0)),subtitleStyle:t0??C2}),l1=Z1.reduce((m1,T6)=>Math.min(m1,T6.start_frame),Z1[0].start_frame),E1=Z1.reduce((m1,T6)=>Math.max(m1,T6.end_frame),Z1[0].end_frame),$5=j0.segments.filter((m1)=>m1.end_frame<=l1||m1.start_frame>=E1);return{...j0,segments:[...$5,...Z1].sort((m1,T6)=>m1.start_frame-T6.start_frame)}});C0({...M0,tracks:S0,total_length:U8(S0,M0.frame_rate)})}function M5(q0){let V0=w.has(q0)?w:new Set([q0]),U0=V0.size>1?Xh(K.tracks,V0,K.frame_rate):qh(K.tracks,q0,K.frame_rate),M0=U8(U0,K.frame_rate);C0({...K,tracks:U0,total_length:M0}),C1(),U((S0)=>Math.min(S0,M0))}function X0(q0){let V0=K.tracks.map((U0)=>U0.id===q0&&U0.type==="task"?{...U0,segments:Jh(U0.segments,K.total_length)}:U0);C0({...K,tracks:V0})}function O0(q0,V0){let U0=null,M0=0,S0=K.tracks.map((j0)=>{if(j0.id!==q0)return j0;let t0=Zh(j0.segments,V0);if(!t0)return j0;return U0=t0.clonedSegmentId,M0=t0.segments.reduce((Z1,l1)=>Math.max(Z1,l1.end_frame),0),{...j0,segments:t0.segments}});if(!U0)return;C0({...K,tracks:S0,total_length:Math.max(K.total_length,M0)}),z1(U0)}function x0(){let q0=TF(K.tracks,w);if(!q0)return;C0({...K,tracks:q0.tracks,total_length:U8(q0.tracks,K.frame_rate)}),z1(q0.mergedSegmentId)}function J1(q0,V0){let U0=[],M0=K.tracks.map((S0)=>{if(S0.type!=="task"||!S0.segments.some((t0)=>t0.id===q0))return S0;let j0=Qh(S0.segments,q0,V0);if(!j0)return S0;return U0=j0.splitSegmentIds,{...S0,segments:j0.segments}});if(U0.length===0)return;C0({...K,tracks:M0,total_length:U8(M0,K.frame_rate)}),C(new Set(U0)),A(U0[0]??null)}function f1(q0,V0,U0,M0){let S0=q0.tracks.map((t0)=>{if(t0.type==="task"&&U0==="end"&&t0.segments.some((Z1)=>Z1.id===V0))return{...t0,segments:Wh(t0.segments,V0,b8(M0,q0.frame_rate))};return{...t0,segments:t0.segments.map((Z1)=>{if(Z1.id!==V0)return Z1;let l1=[...t0.segments].sort((d9,vQ)=>d9.start_frame-vQ.start_frame),E1=l1.findIndex((d9)=>d9.id===V0),$5=E1>0?l1[E1-1]:null,m1=E1>=0&&E10?Math.max(1,hW(Z1.content.duration,q0.frame_rate)):Number.POSITIVE_INFINITY;if(U0==="start"){let d9=b8(M0,q0.frame_rate),vQ=Math.max(0,$5?.end_frame??0,Z1.end_frame-H2),ph=Z1.end_frame-1,mF=Math.max(vQ,Math.min(d9,ph));return{...Z1,start_frame:mF,...mF!==Z1.start_frame&&(t0.type==="video"||t0.type==="audio")?{origin_start_frame:Z1.origin_start_frame??Z1.start_frame}:{}}}let m5=b8(M0,q0.frame_rate),z7=Z1.start_frame+1,UX=Math.min(m1?.start_frame??Number.POSITIVE_INFINITY,Z1.start_frame+H2);return{...Z1,end_frame:Math.max(z7,Math.min(m5,UX))}}).sort((Z1,l1)=>Z1.start_frame-l1.start_frame)}}),j0=Gh(q0.tracks,S0,V0);return{...q0,tracks:j0,total_length:U8(j0,q0.frame_rate)}}function J0(q0,V0,U0,M0){return M?nS(q,q0,V0,U0,M0,i.current):b8(U0,q.frame_rate)}function u0(q0,V0,U0,M0=0){z(f1(q,q0,V0,J0(q0,V0,U0,M0)))}function g0(q0,V0,U0,M0=0){z(null),C0(f1(q,q0,V0,J0(q0,V0,U0,M0)))}function N1(q0,V0,U0){let M0=w.has(q0)?zh(K.tracks,w,q0,V0,U0,K.frame_rate):Yh(K.tracks,q0,V0,U0,K.frame_rate);C0({...K,tracks:M0,total_length:U8(M0,K.frame_rate)})}function M1(q0){let V0=q0.frame_rate;if(typeof V0==="number"&&V0>0&&V0!==K.frame_rate){let U0=Bh(K,V0),M0=aS(i.current,K.frame_rate,U0.frame_rate);i.current=M0,U(M0),C0({...U0,...q0,frame_rate:U0.frame_rate});return}C0({...K,...q0,frame_rate:K.frame_rate})}function e1(q0){if(!b)return;if(Z0?.trackType==="subtitle"&&q0.subtitle_style){let{subtitle_style:V0,...U0}=q0,M0=Object.keys(U0).length>0,S0=K.tracks.map((j0)=>{if(j0.id!==Z0.trackId||j0.type!=="subtitle")return j0;return{...j0,segments:j0.segments.map((t0)=>({...t0,content:{...t0.content,...M0&&t0.id===b?U0:{},subtitle_style:V0}}))}});C0({...K,tracks:S0});return}C0(Kh(K,b,q0))}function S1(q0){let V0=new Map(q0.map((M0)=>[M0.segmentId,M0.patch])),U0=K.tracks.map((M0)=>({...M0,segments:M0.segments.map((S0)=>{let j0=V0.get(S0.id);if(!j0)return S0;return{...S0,content:{...S0.content,...j0}}})}));C0({...K,tracks:U0})}function L1(q0){if(Z0?.trackType!=="task")return;let V0=K.tracks.map((U0)=>U0.id===Z0.trackId?{...U0,segments:q0}:U0);C0({...K,tracks:V0,total_length:U8(V0,K.frame_rate)})}function j8(q0){if(!b)return;C0(Hh(K,b,q0,K.frame_rate))}async function g6(q0){let V0=K.tracks.find((U0)=>U0.type==="video"&&U0.segments.some((M0)=>M0.id===q0))?.segments.find((U0)=>U0.id===q0);if(!V0||h)return;L(!1),p(!0);try{let U0=await TB(V0,K.frame_rate);C0(BI(K,q0,U0))}catch(U0){if(U0 instanceof y2){t(U0.model),d(null);return}console.error("[MultiTrackWidget] smart split failed:",U0);let M0=U0 instanceof Error?U0.message:String(U0);try{Q.extensionManager.toast.add({severity:"error",summary:R0("multitrack.smartSplitFailed"),detail:M0,life:5000})}catch(S0){console.error("[MultiTrackWidget] failed to show smart split error:",S0)}}finally{p(!1)}}async function Y6(q0){let V0=K.tracks.find((U0)=>U0.type==="video"&&U0.segments.some((M0)=>M0.id===q0))?.segments.find((U0)=>U0.id===q0);if(!V0||h)return;if(!HI(K,q0)){try{Q.extensionManager.toast.add({severity:"warn",summary:R0("multitrack.smartSplitTasksOnly"),detail:R0("multitrack.noMatchingTaskSegment"),life:4000})}catch(U0){console.error("[MultiTrackWidget] failed to show task split warning:",U0)}return}L(!1),p(!0);try{let U0=await TB(V0,K.frame_rate);C0(UI(K,q0,U0))}catch(U0){if(U0 instanceof y2){t(U0.model),d(null);return}console.error("[MultiTrackWidget] task-only smart split failed:",U0);let M0=U0 instanceof Error?U0.message:String(U0);try{Q.extensionManager.toast.add({severity:"error",summary:R0("multitrack.smartSplitFailed"),detail:M0,life:5000})}catch(S0){console.error("[MultiTrackWidget] failed to show smart split error:",S0)}}finally{p(!1)}}async function iW(q0,V0){let U0=K.tracks.find((M0)=>(M0.type==="video"||M0.type==="audio")&&M0.segments.some((S0)=>S0.id===q0))?.segments.find((M0)=>M0.id===q0);if(!U0||e)return;L(!1),S(!0);try{let M0=await _I(U0,K.frame_rate,V0);C0(LI(K,q0,M0))}catch(M0){if(M0 instanceof y2){t(M0.model),d(null);return}console.error("[MultiTrackWidget] subtitle recognition failed:",M0);let S0=M0 instanceof Error?M0.message:String(M0);try{Q.extensionManager?.toast?.add({severity:"error",summary:R0("multitrack.subtitleRecognitionFailed"),detail:S0,life:5000})}catch(j0){console.error("[MultiTrackWidget] failed to show subtitle recognition error:",j0)}}finally{S(!1)}}async function gh(q0,V0){if(q0.content.media_type!=="subtitle")return;L(!1);try{let U0=await FI({...V0,text:q0.content.text??""});R5("outputs");let M0=H.current;C0(VI(M0,{subtitleSegmentId:q0.id,startFrame:q0.start_frame,endFrame:q0.end_frame,filePath:U0.filePath,duration:U0.duration}));try{Q.extensionManager?.toast?.add({severity:"success",summary:R0("multitrack.subtitleSpeechComplete"),detail:U0.message||R0("multitrack.subtitleSpeechSaved",{path:U0.absolutePath||U0.filePath}),life:5000})}catch(S0){console.error("[MultiTrackWidget] failed to show subtitle speech success:",S0)}}catch(U0){if(U0 instanceof y2){t(U0.model),d(null);return}console.error("[MultiTrackWidget] subtitle speech generation failed:",U0);let M0=U0 instanceof Error?U0.message:String(U0);try{Q.extensionManager?.toast?.add({severity:"error",summary:R0("multitrack.subtitleSpeechFailed"),detail:M0,life:5000})}catch(S0){console.error("[MultiTrackWidget] failed to show subtitle speech error:",S0)}}}function uh(q0,V0){C0(jB(K,q0,V0))}function mh(){let q0=b8(B,K.frame_rate),V0=w.size>0?Array.from(w):K.tracks.flatMap((j0)=>j0.segments.filter((t0)=>q0>t0.start_frame&&q0t0.id));if(V0.length===0)return;let U0=K.tracks.reduce((j0,t0)=>j0+t0.segments.length,0),M0=V0.reduce((j0,t0)=>jB(j0,t0,q0),K);if(M0.tracks.reduce((j0,t0)=>j0+t0.segments.length,0)===U0)return;C0(M0)}function gF(q0){let V0=w.size>0?w:new Set(K.tracks.flatMap((U0)=>U0.segments.map((M0)=>M0.id)));return K.tracks.flatMap((U0)=>U0.segments.filter((M0)=>V0.has(M0.id)&&q0>M0.start_frame&&q0M0.id))}function rW(){let q0=b8(B,K.frame_rate);return gF(q0).length>0}function uF(q0){let V0=b8(B,K.frame_rate),U0=gF(V0);if(U0.length===0)return;let M0=U0.reduce((S0,j0)=>f1(S0,j0,q0,V0),K);C0(M0)}async function ch(){if(!K0||H0)return;z0(!0),d(null);try{let q0=await GI(K0.name);t(null);try{Q.extensionManager?.toast?.add({severity:"success",summary:R0("modelDownload.downloadComplete"),detail:R0("modelDownload.downloadCompleteDetail",{name:q0.display_name}),life:5000})}catch(V0){console.error("[MultiTrackWidget] failed to show model download success:",V0)}}catch(q0){let V0=q0 instanceof Error?q0.message:String(q0);d(V0)}finally{z0(!1)}}function dh(){if(!K0)return;for(let q0 of K0.urls??[K0.url])globalThis.open(q0,"_blank","noopener,noreferrer")}return G(y6.Provider,{value:m0,children:G(n1,{children:T("div",{className:"relative flex h-full w-full min-w-0 max-w-full flex-col overflow-hidden rounded text-foreground font-sans text-xs select-none","aria-busy":h||e,children:[G(IS,{data:K,currentTime:B,selectedSegment:L0,isPlaying:_,playbackNonce:r,node:Z,app:Q,editingSubtitleSegmentId:y,onSubtitleEditRequestHandled:()=>x(null),onSelectSegment:(q0)=>a0(q0),onGlobalSettingsChange:M1,onSelectedSegmentContentChange:e1,taskSegments:_0,selectedTaskSegments:B0?Q0:void 0,onTrackSegmentsContentChange:S1,onTaskTrackSegmentsChange:L1,onSelectedSegmentDurationChange:j8,onGenerateSubtitleSpeech:gh}),G(EI,{currentTime:B,totalLength:K.total_length,frameRate:K.frame_rate,isPlaying:_,zoom:F,snapEnabled:M,taskOverview:W,timelineCollapsed:N,onPlayPause:()=>L((q0)=>!q0),onZoomChange:V,onSnapEnabledChange:D,canAddTaskMarker:b1(),onAddTaskMarker:n,onTaskOverviewChange:f0,onToggleTimeline:()=>O((q0)=>!q0),canDelete:w.size>0,onDeleteSelected:()=>{if(b)M5(b)},onCutAtCurrentTime:mh,canTrimCenter:rW(),canTrimLeft:rW(),canTrimRight:rW(),onTrimLeftAtCurrentTime:()=>uF("start"),onTrimRightAtCurrentTime:()=>uF("end"),canUndo:g,canRedo:a,onUndo:A0,onRedo:F0}),G("div",{"data-testid":"multitrack-timeline-panel","aria-hidden":N,className:`grid shrink-0 transition-[grid-template-rows] duration-300 ease-in-out ${N?"grid-rows-[0fr]":"grid-rows-[1fr]"}`,children:G("div",{className:"min-h-0 shrink-0 overflow-hidden",children:G("div",{ref:s,className:"no-scrollbar shrink-0 overflow-x-auto overflow-y-hidden",children:T("div",{className:"min-h-full",style:{width:o,minWidth:"100%"},children:[G($z,{totalLength:K.total_length,frameRate:K.frame_rate,width:o,canvasScale:G0,currentTime:B,taskMarkers:K.task_markers??[],selectedTaskMarkerId:k,onSeek:Q1,onSelectTaskMarker:(q0)=>{z1(null),I(q0)},onMoveTaskMarker:w0,onDeleteTaskMarker:D0}),G(lS,{data:K,node:Z,app:Q,width:o,currentTime:B,snapEnabled:M,canvasScale:G0,selectedSegmentIds:w,taskOverview:W,onAddVideo:r0,onAddAudio:K1,onReplaceAudio:x1,onAddTrack:r1,onAddSubtitleSegment:j1,onImportSubtitles:t1,onReplaceVideo:D1,onAddTaskSegment:u1,onSelectSegment:a0,onSelectSegments:R1,onClearSelection:C1,onDeleteSegment:M5,onDeleteTrack:Y0,onReorderTrack:y0,onTrackVisibilityChange:i0,onTrackAudioSettingsChange:h0,onSharedReferenceChange:E0,onDistributeTaskSegments:X0,onCloneTaskSegment:O0,canMergeSelectedTaskSegments:W0,onMergeSelectedTaskSegments:x0,onSplitTaskSegment:P,onResizeSegment:g0,onResizeSegmentPreview:u0,onMoveSegment:N1,onSmartSplit:g6,onSmartSplitTasks:Y6,onRecognizeSubtitles:iW,onEditSubtitleSegment:x,cutMode:!1,onCutSegment:uh,format:l.format})]})})})}),h?G("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-background/80","data-testid":"smart-split-overlay",role:"status","aria-live":"polite",children:T("div",{className:"flex items-center gap-2 rounded border border-border bg-background px-3 py-2 text-foreground shadow-sm",children:[G(X6,{className:"h-4 w-4 animate-spin"}),G("span",{children:R0("multitrack.smartSplitting")})]})}):null,e?G("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-background/80","data-testid":"subtitle-recognition-overlay",role:"status","aria-live":"polite",children:T("div",{className:"flex items-center gap-2 rounded border border-border bg-background px-3 py-2 text-foreground shadow-sm",children:[G(X6,{className:"h-4 w-4 animate-spin"}),G("span",{children:R0("multitrack.recognizingSubtitles")})]})}):null,G(jS,{segment:N0,frameRate:K.frame_rate,open:Boolean(E),onOpenChange:(q0)=>{if(!q0)P(null)},onConfirm:J1}),K0?G("div",{className:"absolute inset-0 z-[60] flex items-center justify-center bg-background/90 p-4","data-testid":"missing-model-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"missing-model-title",children:T("div",{className:"w-full max-w-md rounded border border-border bg-background p-4 text-foreground shadow-sm",children:[T("div",{className:"flex items-start justify-between gap-3",children:[T("div",{className:"min-w-0",children:[G("h3",{id:"missing-model-title",className:"text-sm font-semibold",children:R0("modelDownload.title",{name:K0.display_name})}),G("p",{className:"mt-2 text-xs leading-5 text-muted-foreground",children:R0("modelDownload.description",{name:K0.display_name,directory:n0})})]}),G(k0,{type:"button",variant:"ghost",size:"icon",onClick:()=>t(null),"aria-label":R0("modelDownload.close"),disabled:H0,children:G(n9,{className:"h-4 w-4"})})]}),G("div",{className:"mt-3 rounded border border-border bg-muted px-2 py-1.5 font-mono text-[8px] leading-4 text-foreground break-all",children:K0.path}),j?G("p",{className:"mt-3 text-xs leading-5 text-destructive",children:j}):null,T("div",{className:"mt-4 flex flex-wrap justify-end gap-2",children:[T(k0,{type:"button",variant:"outline",size:"sm",onClick:dh,disabled:H0,children:[G(sS,{className:"h-4 w-4"}),R0("modelDownload.manual")]}),T(k0,{type:"button",size:"sm",onClick:ch,disabled:H0,children:[H0?G(X6,{className:"h-4 w-4 animate-spin"}):G(fW,{className:"h-4 w-4"}),H0?R0("modelDownload.downloading"):R0("modelDownload.auto")]})]})]})}):null]})})})}var v$=R(v(),1);var f$=25;function ct($){if($?.source_type==="output")return"outputs";if($?.source_type==="local")return"local";if($?.source_type==="url")return"url";return"inputs"}function dt($,J){if(J)return J;return/^https?:\/\//i.test($)?"url":"input"}function pt({value:$,onChange:J,app:Q}){let Z=Q?.ui?.settings?.settingsValues?.["Comfy.Locale"],X=($&&Array.isArray($.images)?$:{images:[]}).images.slice(0,f$),[Y,z]=v$.useState(!1),[K,W]=v$.useState(null),[H,B]=v$.useState(null),[U,_]=v$.useState(!1),L=v$.useRef(null),F=a9(Q),V=Boolean(Q?.ui?.settings?.settingsValues?.["Comfy.VueNodes.Enabled"]),M=X.find((b)=>b.id===K),D=Math.min(5,Math.max(1,Math.ceil(Math.sqrt(X.length+(X.lengthvJ(y,dt(y,A)));O(K?X.map((y)=>y.id===K?{...C[0],id:K}:y):[...X,...C]),W(null),z(!1)}async function I(b){if(!b?.length)return;let A=Array.from(b).filter((y)=>y.type.startsWith("image/")).slice(0,f$-X.length),w=await Promise.allSettled(A.map(j7)),C=[];for(let y of w)if(y.status==="fulfilled")C.push(y.value);else console.error("[MultiImagesLoaderWidget] image upload failed:",y.reason);if(C.length)R5("inputs"),O([...X,...C])}return G(y6.Provider,{value:Z,children:G(lt,{images:X,columns:D,controlSize:N,isNodeV2:V,selectorOpen:Y,setSelectorOpen:z,replaceId:K,setReplaceId:W,activeImage:M,preview:H,setPreview:B,dragOver:U,setDragOver:_,dragId:L,commit:O,select:k,dropFiles:I})})}function lt($){let J=q1(),{images:Q,columns:Z,controlSize:q}=$,X=$.preview&&Z5({...$.preview,source_type:$.preview.source_type??"input"}),Y=qz($.preview?.id??null,()=>$.setPreview(null));return T("div",{className:`relative flex h-full min-h-0 w-full flex-col overflow-hidden rounded-md bg-muted/20 text-foreground ${$.isNodeV2?"nodeNew":""}`,onDragOver:(z)=>{z.preventDefault(),$.setDragOver(!0)},onDragLeave:(z)=>{if(!z.currentTarget.contains(z.relatedTarget))$.setDragOver(!1)},onDrop:(z)=>{z.preventDefault(),$.setDragOver(!1),$.dropFiles(z.dataTransfer.files)},children:[T(a1,{open:$.selectorOpen,onOpenChange:(z)=>{if($.setSelectorOpen(z),!z)$.setReplaceId(null)},children:[Q.length===0?T("div",{className:`task-image-picker-empty relative flex h-full min-h-0 w-full flex-1 flex-col items-center justify-center gap-2 rounded-md px-4 py-2 text-foreground shadow-sm ${$.dragOver?"border border-primary bg-accent/20":"bg-muted/20"}`,children:[G(Dz,{className:"size-12 shrink-0"}),G("span",{className:"mt-1 text-base font-semibold",children:J("multitrack.selectImage")}),G("span",{className:"max-w-full whitespace-normal text-center text-sm text-muted-foreground",children:J("multitrack.imageDropHint")}),G(T5,{asChild:!0,children:G(k0,{type:"button",variant:"ghost",className:"absolute inset-0 h-full w-full cursor-pointer rounded-md p-0 hover:bg-accent/20 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring","aria-label":J("multitrack.selectImage"),onClick:()=>$.setReplaceId(null)})})]}):G(_6,{asChild:!0,children:T("div",{className:`task-image-grid grid h-full min-h-0 w-full flex-1 auto-rows-max content-start gap-2 overflow-y-auto rounded-md p-3 transition-colors ${$.dragOver?"border border-primary bg-accent/20":"bg-muted/20"}`,style:{gridTemplateColumns:`repeat(${Z}, minmax(0, 1fr))`},children:[Q.map((z,K)=>{let W=Z5({...z,source_type:z.source_type??"input"}),H=z.file_name??z.file_path??z.local_path??z.url??String(K+1);return T("div",{className:"group relative aspect-square min-w-0 w-full self-start overflow-hidden rounded-md border border-border bg-black",draggable:!0,onDragStart:()=>{$.dragId.current=z.id},onDragEnd:()=>{$.dragId.current=null},onDrop:(B)=>{if(B.dataTransfer.files.length>0||!$.dragId.current)return;B.preventDefault(),B.stopPropagation(),$.setDragOver(!1);let U=$.dragId.current;if(U===z.id)return;let _=[...Q],L=_.findIndex((M)=>M.id===U);if(L<0)return;let F=_.findIndex((M)=>M.id===z.id),[V]=_.splice(L,1);_.splice(F,0,V),$.commit(_)},children:[G(k0,{variant:"ghost",className:"absolute inset-0 h-full w-full rounded-none p-0","aria-label":J("multiImagesLoader.replace",{n:K+1}),onClick:()=>{$.setReplaceId(z.id),$.setSelectorOpen(!0)},children:W?G("img",{src:W,alt:H,className:"h-full w-full object-contain",draggable:!1}):G("span",{className:"px-1 text-xs text-image-tile-foreground",children:H})}),G("span",{className:"pointer-events-none absolute bottom-0 left-0 bg-black/50 px-1.5 text-[10px] text-image-tile-foreground",children:K+1}),T("div",{className:"absolute right-1 top-1 flex gap-1 opacity-0 group-hover:opacity-100 group-focus-within:opacity-100",children:[G(k0,{variant:"secondary",size:"icon",style:{width:q,height:q},"aria-label":J("multiImagesLoader.preview"),onClick:()=>$.setPreview(z),children:G(b7,{})}),G(k0,{variant:"destructive",size:"icon",style:{width:q,height:q},"aria-label":J("multiImagesLoader.delete"),onClick:()=>$.commit(Q.filter((B)=>B.id!==z.id)),children:G(D5,{})})]})]},z.id)}),Q.length{$.setReplaceId(null),$.setSelectorOpen(!0)},children:G(K5,{})})]})}),G(s1,{className:"w-auto p-0",align:"start",children:G(V5,{value:$.activeImage?.file_path??$.activeImage?.local_path??$.activeImage?.url??"",mediaType:"image",defaultTab:ct($.activeImage),allowMultipleSelection:!$.replaceId,maxSelectionCount:$.replaceId?1:f$-Q.length,onChange:$.select},$.replaceId??"add")})]}),Q.length>0&&T("div",{className:"flex h-9 shrink-0 items-center justify-between gap-2 border-t border-border bg-background/60 px-3 text-xs",children:[G("span",{className:"text-muted-foreground",children:J("multiImagesLoader.imageCount",{n:Q.length})}),T(k0,{type:"button",variant:"ghost",size:"sm",className:"h-7 gap-1 px-2 text-xs text-destructive hover:text-destructive",onClick:()=>{$.setSelectorOpen(!1),$.setReplaceId(null),$.setPreview(null),$.commit([])},children:[G(D5,{className:"size-3.5"}),J("multiImagesLoader.clearAll")]})]}),X&&T("div",{"data-testid":"multi-images-expanded-preview","data-zoom":Y.zoom.toFixed(2),className:"absolute inset-0 z-30 flex items-center justify-center overflow-hidden bg-black p-3 pt-12",onWheel:Y.onWheel,children:[T(k0,{type:"button",variant:"secondary",className:"absolute left-2 top-2 z-20 h-8 cursor-pointer gap-1.5 px-2.5 text-xs","aria-label":J("multitrack.backToPreview"),onClick:()=>$.setPreview(null),children:[G(EW,{className:"h-4 w-4"}),G("span",{children:J("multitrack.backToPreview")})]}),T("span",{className:"pointer-events-none absolute right-2 top-2 z-20 rounded bg-background/70 px-2 py-1 text-[10px] tabular-nums text-foreground",children:[Math.round(Y.zoom*100),"%"]}),G("img",{ref:Y.imageRef,src:X,alt:$.preview?.file_name??$.preview?.file_path??$.preview?.url??"",className:"max-h-full max-w-full object-contain transition-transform duration-100 ease-out",style:{transform:`scale(${Y.zoom})`,transformOrigin:`${Y.origin.x}% ${Y.origin.y}%`},draggable:!1})]})]})}var T1=R(v(),1);var zX=R(v(),1);function Lh($,J,Q,Z,q,X){let Y=$?Math.max($.startTime,Math.min($.endTime,$.currentTime)):void 0,z=$?.isPlaying,K=zX.useCallback((W)=>{if(!W||Y===void 0)return;let H=Number.isFinite(W.duration)?Math.min(Y,W.duration):Y;try{if(!z||Math.abs(W.currentTime-H)>0.12)W.currentTime=H;if(z&&Number.isFinite(W.duration)&&Y>=W.duration)W.pause();else if(z&&W.paused)W.play()?.catch((B)=>{console.error("[CompareVideoWidget] failed to resume parent playback:",B),X()})}catch(B){console.error("[CompareVideoWidget] failed to follow parent playback:",B)}},[X,z,Y]);return zX.useEffect(()=>{if(Y===void 0)return;Z(Y),K(J.current),K(Q.current)},[Q,Z,J,K,Y]),zX.useEffect(()=>{if(z===void 0)return;if(z)q();else X()},[X,q,z]),K}var yF={save_output:!1,filename_prefix:"ComfyUI",watch_output_history:!1,compare_mode:"compare",source:null,output:null},it=50,rt=new Set([".mp4",".webm",".mov",".avi",".mkv",".flv",".wmv",".m4v"]);function Fh($){if(!$?.filename)return null;let J=$.type??"temp",Q=$.subfolder??"";return`/view?filename=${encodeURIComponent($.filename)}&type=${encodeURIComponent(J)}&subfolder=${encodeURIComponent(Q)}`}function Vh($){if(!$||typeof $!=="object")return null;let J=$,Q=J.source_type??J.type,Z=Q==="input"||Q==="output"||Q==="temp"||Q==="url"?Q:void 0,q=typeof J.file_path==="string"?J.file_path:typeof J.path==="string"?J.path:void 0,Y=(typeof J.url==="string"?J.url:void 0)??q??"";if(!Y.trim())return null;if(Z==="url"||/^https?:\/\//i.test(Y))return{source_type:"url",url:Y};if(!Z||!q)return null;return{source_type:Z,file_path:q}}function vW($){if(!$)return null;let{source_type:J,file_path:Q,url:Z}=$;if(J==="url"||/^https?:\/\//i.test(Z??Q??""))return Z??Q??null;if((J==="input"||J==="output"||J==="temp")&&Q)return Y9(Q,J);return null}function Th($){if(!$)return"";return $.file_path??$.url??""}function st($,J){if($?.source_type==="url")return"url";if($?.source_type==="output")return"outputs";return J==="output"?"outputs":"inputs"}function PF($){let J=Th($);return J.split(/[\\/]/).pop()||J}function RF($){return $.path?`${$.source_type}:${$.path}`:null}function ot($,J){if(!$||typeof $!=="object")return null;let Q=$,Z=typeof Q.filename==="string"?Q.filename:"",q=Q.type==="output"||Q.type==="temp"?Q.type:void 0;if(!Z||!q)return null;if(Z.toLowerCase().includes("easy_compare"))return null;let X=Z.lastIndexOf(".");if(X<=0)return null;let Y=Z.slice(X).toLowerCase();if(!rt.has(Y))return null;let z=typeof Q.subfolder==="string"?Q.subfolder.replaceAll("\\","/"):"",K=z?`${z}/${Z}`:Z;return{type:"file",name:Z,path:K,url:Y9(K,q),size:0,mtime:J,source_type:q}}function nt($){if(!$||typeof $!=="object")return[];let J=$.output;if(!J||typeof J!=="object")return[];let Q=J,Z=[],q=new Set,X=Date.now();for(let Y of["video","images"]){let z=Q[Y];if(!Array.isArray(z))continue;for(let K of z){let W=ot(K,X);if(!W)continue;let H=RF(W);if(!H||q.has(H))continue;q.add(H),Z.push(W),X+=1}}return Z}function at($){return{source_type:"output",file_path:$}}function tt($){return{source_type:"temp",file_path:$}}function Mh($,J){if(!$&&!J)return!0;if(!$||!J)return!1;return $.source_type===J.source_type&&$.file_path===J.file_path&&$.url===J.url}function KX($){if(!$)return null;let J=$.file_path??$.url??"";return J?`${$.source_type}:${J}`:null}function et($){return $.source_type==="temp"?tt($.path):at($.path)}function $e($,J,Q=new Set){let Z=[],q=new Set;for(let W of J){let H=et(W),B=KX(H);if(!B||q.has(B))continue;q.add(B),Z.push(H)}let X=Q.has("source")&&$.source!=null,Y=Q.has("output")&&$.output!=null,z=X?$.source??null:Y?Z.find((W)=>KX(W)!==KX($.output))??null:Z.length>=2?Z[1]:null,K=Y?$.output??null:X?Z.find((W)=>KX(W)!==KX(z))??null:Z.length>=1?Z[0]:null;return{source:z,output:K}}function gW($){if(Array.isArray($)){for(let J of $){let Q=gW(J);if(Q)return Q}return null}if(!$||typeof $!=="object")return null;return $}function Je($){if(!$||typeof $!=="object")return{...yF};let J=$,Q=J.compare_mode,Z=Q==="source"||Q==="compare"||Q==="side-by-side"||Q==="output"?Q:"compare";return{save_output:J.save_output===!0,filename_prefix:typeof J.filename_prefix==="string"?J.filename_prefix:yF.filename_prefix,watch_output_history:J.watch_output_history===!0,compare_mode:Z,source:Vh(J.source),output:Vh(J.output)}}function Qe($){if(!$||typeof $!=="object")return null;let J=$,Q=gW(J.compare_videos);if(Q)return Q;let Z=J.output;if(Z&&typeof Z==="object"){let X=gW(Z.compare_videos);if(X)return X}let q=J.ui;if(q&&typeof q==="object"){let X=gW(q.compare_videos);if(X)return X}return null}function Ze($,J){if(!$||typeof $!=="object")return!0;let Q=$.node;if(Q===void 0||Q===null||J.id===void 0||J.id===null)return!0;return String(Q)===String(J.id)}function Dh($){if(!Number.isFinite($)||$<0)return"0:00";let J=Math.floor($/60),Q=Math.floor($%60);return`${J}:${Q.toString().padStart(2,"0")}`}function EF($,J){if(!$||!Number.isFinite(J))return;try{$.currentTime=J}catch(Q){console.error("[CompareVideoWidget] failed to seek video:",Q)}}function qe({app:$,node:J,value:Q,onChange:Z}){let q=$?.ui?.settings?.settingsValues?.["Comfy.Locale"],X=J,Y=Je(Q);return G(y6.Provider,{value:q,children:G(jh,{app:$,node:X,settings:Y,onSettingsChange:Z})})}var bh=T1.memo(function({app:J,sourceUrl:Q,outputUrl:Z,pausePlaybackNonce:q,parentPlayback:X}){let Y=J?.ui?.settings?.settingsValues?.["Comfy.Locale"],[z,K]=T1.useState("side-by-side"),W=T1.useMemo(()=>({...yF,compare_mode:z,source:{source_type:"url",url:Q},output:{source_type:"url",url:Z}}),[z,Z,Q]);return G(y6.Provider,{value:Y,children:G(jh,{app:J,node:{},settings:W,onSettingsChange:(H)=>K(H.compare_mode??"side-by-side"),allowMediaSelection:!1,bindNodeEvents:!1,pausePlaybackNonce:q,parentPlayback:X})})});function Nh({settings:$,onSettingsChange:J}){let Q=q1();return T("div",{className:"flex w-64 flex-col gap-3",children:[T("div",{className:"flex items-center gap-2",children:[T(k0,{type:"button",variant:"ghost",role:"checkbox","aria-checked":$.save_output,disabled:$.watch_output_history,className:b0("h-auto flex-1 cursor-pointer justify-start gap-2 px-0 py-1 hover:bg-transparent",$.watch_output_history&&"cursor-not-allowed opacity-50"),onClick:()=>J({...$,save_output:!$.save_output}),children:[G("span",{className:b0("flex h-4 w-4 shrink-0 items-center justify-center rounded-sm border border-border",$.save_output&&"border-primary bg-primary text-primary-foreground"),children:$.save_output?G(b9,{className:"h-3 w-3"}):null}),G("span",{className:"text-left",children:Q("compareVideo.saveOutput")})]}),T(k0,{type:"button",variant:"ghost",role:"checkbox","aria-checked":$.watch_output_history,className:"h-auto flex-1 cursor-pointer justify-start gap-2 px-0 py-1 hover:bg-transparent",onClick:()=>{let Z=!$.watch_output_history;J({...$,watch_output_history:Z,source:Z?null:$.source,output:Z?null:$.output,save_output:Z?!1:$.save_output})},children:[G("span",{className:b0("flex h-4 w-4 shrink-0 items-center justify-center rounded-sm border border-border",$.watch_output_history&&"border-primary bg-primary text-primary-foreground"),children:$.watch_output_history?G(b9,{className:"h-3 w-3"}):null}),G(kh,{className:"h-3.5 w-3.5 text-muted-foreground"}),G("span",{className:"text-left",children:Q("compareVideo.watchOutputHistory")})]})]}),T("label",{className:"flex flex-col gap-1.5 text-xs text-muted-foreground",children:[G("span",{children:Q("compareVideo.filenamePrefix")}),G($6,{value:$.filename_prefix,disabled:$.watch_output_history,placeholder:"ComfyUI","aria-label":Q("compareVideo.filenamePrefix"),onChange:(Z)=>J({...$,filename_prefix:Z.currentTarget.value})})]})]})}function Oh({slot:$,selection:J,disabled:Q=!1,watchHistory:Z=!1,onSelect:q,onClear:X}){let Y=q1(),[z,K]=T1.useState(!1),W=PF(J),H=$==="source"?Y("compareVideo.source"):Y("compareVideo.output"),B=$==="source"?Y("compareVideo.selectSource"):Y("compareVideo.selectOutput"),U=$==="source"?Y("compareVideo.clearSource"):Y("compareVideo.clearOutput");return T("div",{className:"flex items-center gap-1",children:[T(a1,{open:z,onOpenChange:(_)=>{if(Q)return;K(_)},children:[G(T5,{asChild:!0,children:T(k0,{type:"button",variant:"secondary",size:"sm",disabled:Q,className:b0("h-7 gap-1.5 border-border/50 bg-muted/60 px-2 text-foreground shadow",Q?"cursor-not-allowed opacity-50":"cursor-pointer hover:bg-muted/90"),"aria-label":W?`${H}: ${W}`:B,children:[G(wh,{className:"h-3.5 w-3.5"}),G("span",{className:"max-w-36 truncate text-[11px]",children:W||B})]})}),G(s1,{className:"w-auto p-0",align:$==="source"?"start":"end",children:G(V5,{value:Th(J),mediaType:"video",defaultTab:Z?"history":st(J,$),historySource:"combined",historyOnly:Z,onChange:(_,L)=>{if(L===void 0)q(_,L),K(!1)},onSourceChange:(_)=>{q(_.filePath,_.sourceType),K(!1)}},`${$}-${W||"empty"}`)})]}),J?G(k0,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 cursor-pointer bg-muted/60 text-foreground shadow hover:bg-muted/90","aria-label":U,disabled:Q,onClick:X,children:G(n9,{className:"h-3.5 w-3.5"})}):null]})}function jh({app:$,node:J,settings:Q,onSettingsChange:Z,allowMediaSelection:q=!0,bindNodeEvents:X=!0,pausePlaybackNonce:Y,parentPlayback:z}){let K=q1(),W=a9($),H=T1.useRef(null),B=T1.useRef(null),U=T1.useRef(null),[_,L]=T1.useState(()=>J.__easyMediaCompareVideos??null),[F,V]=T1.useState(Q.compare_mode??"compare"),[M,D]=T1.useState(50),[N,O]=T1.useState(!1),[k,I]=T1.useState(!1),[b,A]=T1.useState(!1),w=b||z?.muted===!0,[C,y]=T1.useState(0.75),[x,E]=T1.useState(0),[P,h]=T1.useState(0),p=T1.useRef(Q),e=T1.useRef(z);e.current=z;let S=T1.useRef(Z),r=T1.useRef(new Set),$0=T1.useRef(Q.watch_output_history);p.current=Q,S.current=Z;let K0=T1.useMemo(()=>vW(Q.source)??(Q.watch_output_history?null:Fh(_?.source)),[_,Q.source,Q.watch_output_history]),t=T1.useMemo(()=>vW(Q.output)??(Q.watch_output_history?null:Fh(_?.output)),[_,Q.output,Q.watch_output_history]),H0=Boolean(K0),z0=Boolean(t),j=H0||z0,d=H0&&z0,m=z?.isPlaying?z.endTime:z0?P:Math.max(_?.duration??0,P,0),s=d?F:H0?"source":"output",u=d&&s==="side-by-side",c=s==="source"?100:s==="output"?0:u?50:M,i=s!=="compare"||!N;T1.useEffect(()=>{if(!X)return;function g(m0){let R0=Qe(m0);if(!R0)return;J.__easyMediaCompareVideos=R0,L(R0),E(0),I(!1),h(0)}let a=J.onExecuted,I0=function(R0){a?.call(this,R0),g(R0)};J.onExecuted=I0;let A0=$.api,F0=(m0)=>{if(!Ze(m0.detail,J))return;g(m0.detail)};return A0?.addEventListener?.("executed",F0),A0?.addCustomEventListener?.("executed",F0),()=>{if(J.onExecuted===I0)J.onExecuted=a;A0?.removeEventListener?.("executed",F0),A0?.removeCustomEventListener?.("executed",F0)}},[$.api,X,J]),T1.useEffect(()=>{if(H.current)H.current.muted=w||z0,H.current.volume=C;if(B.current)B.current.muted=w,B.current.volume=C},[z0,w,C]),T1.useEffect(()=>{if(d)V(Q.compare_mode??"compare");else if(H0)V("source");else if(z0)V("output")},[d,z0,H0,Q.compare_mode]),T1.useEffect(()=>{let g=$0.current;if($0.current=Q.watch_output_history,Q.watch_output_history&&!g)r.current.clear();else if(!Q.watch_output_history&&g)J.__easyMediaCompareVideos=null,L(null),E(0),h(0)},[J,Q.watch_output_history]),T1.useEffect(()=>{if(!Q.watch_output_history)return;let g=[],a=[],I0=new Set;function A0(){let C0=p.current;if(!C0.watch_output_history)return;let{source:z1,output:Q1}=$e(C0,g,r.current);if(Mh(C0.source,z1)&&Mh(C0.output,Q1))return;S.current({...C0,source:z1,output:Q1}),E(0),h(0),I(!1)}function F0(C0){let z1=nt(C0.detail);if(z1.length===0)return;for(let Q1 of z1){let a0=RF(Q1);if(!a0||I0.has(a0))continue;I0.add(a0),a.push(Q1)}}function m0(){a=[],I0=new Set}function R0(){let C0=[...a].reverse(),z1=[],Q1=new Set;for(let a0 of[...C0,...g]){let R1=RF(a0);if(!R1||Q1.has(R1))continue;Q1.add(R1),z1.push(a0)}g.splice(0,g.length,...z1.slice(0,it)),a=[],I0=new Set,A0()}let n0=$.api;return n0?.addEventListener?.("execution_start",m0),n0?.addEventListener?.("executed",F0),n0?.addEventListener?.("execution_success",R0),n0?.addCustomEventListener?.("execution_start",m0),n0?.addCustomEventListener?.("executed",F0),n0?.addCustomEventListener?.("execution_success",R0),()=>{n0?.removeEventListener?.("execution_start",m0),n0?.removeEventListener?.("executed",F0),n0?.removeEventListener?.("execution_success",R0),n0?.removeCustomEventListener?.("execution_start",m0),n0?.removeCustomEventListener?.("executed",F0),n0?.removeCustomEventListener?.("execution_success",R0)}},[$.api,Q.watch_output_history]);let f=T1.useCallback((g)=>{EF(H.current,g),EF(B.current,g)},[]),o=T1.useCallback(()=>{I(!0);for(let g of[H.current,B.current]){if(!g)continue;let a=e.current;if(a?.isPlaying&&Number.isFinite(g.duration)&&a.currentTime>=g.duration)continue;if(!g.paused)continue;let I0=g.play();if(I0)I0.catch((A0)=>{console.error("[CompareVideoWidget] failed to play video:",A0),I(!1)})}},[]),G0=T1.useCallback(()=>{I(!1),H.current?.pause(),B.current?.pause()},[]);T1.useEffect(()=>{if(Y===void 0)return;G0()},[Y,G0]);let l=Lh(z,H,B,E,o,G0);T1.useEffect(()=>{let g=H.current,a=B.current;return()=>{g?.pause(),a?.pause()}},[K0,t]),T1.useEffect(()=>{if(!X)return;return J.__easyMediaSyncPlay=()=>{f(0),E(0),o()},()=>{if(J.__easyMediaSyncPlay)delete J.__easyMediaSyncPlay}},[X,J,o,f]);function Z0(g){if(!d||s!=="compare")return;let a=U.current?.getBoundingClientRect();if(!a)return;let I0=W>0?W:1,A0=(g.clientX-a.left)/I0,F0=a.width/I0,m0=F0>0?A0/F0*100:50;D(Math.max(0,Math.min(100,m0)))}function Q0(g){if(z?.isPlaying)return;let a=g.currentTarget,I0=B.current??H.current;if(a!==I0)return;E(a.currentTime);let A0=a===H.current?B.current:H.current;if(A0&&Math.abs(A0.currentTime-a.currentTime)>0.08)EF(A0,a.currentTime)}function B0(g){if(z?.isPlaying){g.currentTarget.pause();return}if(f(0),E(0),k)o()}function W0(g){let a=g[0]??0;if(z?.isPlaying){z.onSeek(Math.max(z.startTime,Math.min(z.endTime,a)));return}E(a),f(a)}function L0(){V((g)=>{let a="compare";if(g==="compare")a="side-by-side";else if(g==="side-by-side")a="source";else if(g==="source")a="output";return Z({...Q,compare_mode:a}),a})}function _0(g,a,I0){let A0=/^https?:\/\//i.test(a),F0=I0==="output"?"output":I0==="temp"?"temp":I0==="input"?"input":A0?"url":"input",m0=F0==="url"?{source_type:"url",url:a}:{source_type:F0,file_path:a},R0={...Q,[g]:m0},n0=g==="source"?R0.output:R0.source;if(Q.watch_output_history)r.current.add(g);if(Z(R0),E(0),h(0),I(!1),vW(m0)&&vW(n0))V(R0.compare_mode??"compare")}function N0(g){if(Q.watch_output_history)r.current.delete(g);Z({...Q,[g]:null}),E(0),h(0),I(!1)}function d0(){let g=Q.watch_output_history?PF(Q.output):_?.output?.filename??PF(Q.output);if(!t||!g)return;try{let a=document.createElement("a");a.href=t,a.download=g,a.rel="noopener",document.body.appendChild(a),a.click(),a.remove()}catch(a){console.error("[CompareVideoWidget] failed to download output video:",a)}}return G(n1,{children:T("div",{className:"group relative h-full min-h-[320px] w-full overflow-hidden rounded border border-border bg-background text-foreground",children:[T("div",{ref:U,className:"relative h-full min-h-[320px] overflow-hidden bg-black",onPointerEnter:()=>O(!0),onPointerMove:(g)=>{Z0(g)},onPointerLeave:()=>{if(O(!1),s==="compare")D(50)},onPointerCancel:()=>{if(O(!1),s==="compare")D(50)},children:[K0?G("video",{ref:H,className:b0("absolute inset-0 h-full w-full object-contain",!H0&&"invisible",u&&"right-auto w-1/2"),"data-compare-video-panel":u?"source":void 0,src:K0,loop:!z?.isPlaying,muted:w||z0,playsInline:!0,preload:"auto",onLoadedMetadata:(g)=>{let a=g.currentTarget.duration||0;if(!z0)h(a);l(g.currentTarget)},onTimeUpdate:Q0,onEnded:B0}):null,t?G("video",{ref:B,className:b0("absolute inset-0 h-full w-full object-contain",!z0&&"invisible",u&&"left-1/2 w-1/2"),style:{clipPath:u?void 0:`inset(0 0 0 ${c}%)`,transition:!u&&i?"clip-path 260ms ease":void 0},"data-compare-video-panel":u?"output":void 0,src:t,loop:!z?.isPlaying,muted:w,playsInline:!0,preload:"auto",onLoadedMetadata:(g)=>{let a=g.currentTarget.duration||0;h(a),l(g.currentTarget)},onTimeUpdate:Q0,onEnded:B0}):null,!j?T("div",{className:"absolute inset-0 z-20 flex flex-col items-center justify-center gap-4 bg-background p-4 pt-12",children:[G(Nh,{settings:Q,onSettingsChange:Z}),G("p",{className:"text-xs text-muted-foreground mt-2",children:K("compareVideo.empty")})]}):null,q?T(G1,{children:[G("div",{className:"absolute left-3 top-2 z-30",children:G(Oh,{slot:"source",selection:Q.source,watchHistory:Q.watch_output_history,onSelect:(g,a)=>_0("source",g,a),onClear:()=>N0("source")})}),G("div",{className:"absolute right-3 top-2 z-30",children:G(Oh,{slot:"output",selection:Q.output,watchHistory:Q.watch_output_history,onSelect:(g,a)=>_0("output",g,a),onClear:()=>N0("output")})})]}):null,d&&(s==="compare"||u)?G("div",{className:"pointer-events-none absolute inset-y-0 w-px bg-white shadow",style:{left:`${c}%`,transition:i?"left 260ms ease":void 0}}):null,d?T(k0,{type:"button",className:"absolute left-1/2 top-2 z-30 -translate-x-1/2 cursor-pointer bg-muted/60 text-foreground shadow hover:bg-muted/90",onClick:L0,onPointerDown:(g)=>g.stopPropagation(),size:"sm",variant:"secondary",children:[s==="source"||s==="output"?G(FJ,{className:"h-4 w-4"}):G(Ah,{className:"h-4 w-4"}),s==="source"?K("compareVideo.sourceOnly"):s==="output"?K("compareVideo.outputOnly"):s==="side-by-side"?K("compareVideo.sideBySide"):K("compareVideo.compare")]}):null]}),T("div",{"data-compare-video-toolbar":!0,className:"@container/compare-video-controls pointer-events-none absolute inset-x-0 bottom-0 z-10 grid translate-y-full grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-2 border-t border-border bg-background/90 px-1 opacity-0 shadow-sm backdrop-blur-sm transition-[opacity,transform] duration-300 ease-out @max-[420px]/compare-video-controls:grid-cols-[minmax(0,1fr)_auto] @max-[420px]/compare-video-controls:gap-x-1 @max-[420px]/compare-video-controls:gap-y-0 @max-[420px]/compare-video-controls:px-2 @max-[420px]/compare-video-controls:py-1 group-hover:pointer-events-auto group-hover:translate-y-0 group-hover:opacity-100 group-focus-within:pointer-events-auto group-focus-within:translate-y-0 group-focus-within:opacity-100",children:[G("div",{"data-compare-video-playback":!0,className:"@max-[420px]/compare-video-controls:col-start-1 @max-[420px]/compare-video-controls:row-start-2",children:T(H1,{children:[G(B1,{asChild:!0,children:G(k0,{type:"button",variant:"ghost",size:"icon",className:"cursor-pointer",onClick:()=>{if(k){if(G0(),z?.isPlaying)z.onPause()}else o()},"aria-label":k?K("compareVideo.pause"):K("compareVideo.play"),children:k?G(D7,{className:"h-4 w-4"}):G(y4,{className:"h-4 w-4"})})}),G(W1,{children:k?K("compareVideo.pause"):K("compareVideo.play")})]})}),T("div",{"data-compare-video-seek":!0,className:"grid min-w-0 grid-cols-[auto_minmax(4rem,1fr)_auto] items-center gap-2 @max-[420px]/compare-video-controls:col-span-2 @max-[420px]/compare-video-controls:col-start-1 @max-[420px]/compare-video-controls:row-start-1 @max-[420px]/compare-video-controls:w-full @max-[420px]/compare-video-controls:px-1 @max-[420px]/compare-video-controls:py-1",children:[G("span",{className:"w-10 text-right text-[11px] tabular-nums text-muted-foreground",children:Dh(x)}),G("div",{className:"min-w-0",children:G(N8,{className:"w-full",value:[Math.min(x,m||x)],min:z?.isPlaying?z.startTime:0,max:Math.max(m,x,0.01),step:0.01,onValueChange:W0,"aria-label":K("compareVideo.seek")})}),G("span",{className:"w-10 text-[11px] tabular-nums text-muted-foreground",children:Dh(m)})]}),T("div",{"data-compare-video-actions":!0,className:"flex items-center gap-2 @max-[420px]/compare-video-controls:col-start-2 @max-[420px]/compare-video-controls:row-start-2 @max-[420px]/compare-video-controls:gap-1",children:[T(H1,{children:[G(B1,{asChild:!0,children:G(k0,{type:"button",variant:"ghost",size:"icon",className:"cursor-pointer",onClick:()=>A((g)=>!g),"aria-label":b?K("compareVideo.unmute"):K("compareVideo.mute"),children:b?G(jJ,{className:"h-4 w-4"}):G(e9,{className:"h-4 w-4"})})}),G(W1,{children:b?K("compareVideo.unmute"):K("compareVideo.mute")})]}),G("div",{"data-compare-video-volume":!0,children:G(N8,{className:"w-20",value:[C],min:0,max:1,step:0.01,onValueChange:(g)=>y(g[0]??0),"aria-label":K("compareVideo.volume")})}),q?T(a1,{children:[G(T5,{asChild:!0,children:G(k0,{type:"button",variant:"ghost",size:"icon",className:"cursor-pointer","aria-label":K("compareVideo.settings"),children:G(Ih,{className:"h-4 w-4"})})}),G(s1,{align:"end",className:"w-auto",children:G(Nh,{settings:Q,onSettingsChange:Z})})]}):null,q&&z0?T(H1,{children:[G(B1,{asChild:!0,children:G(k0,{type:"button",variant:"ghost",size:"icon",className:"cursor-pointer","aria-label":K("compareVideo.downloadOutput"),onClick:d0,children:G(fW,{className:"h-4 w-4"})})}),G(W1,{children:K("compareVideo.downloadOutput")})]}):null]})]})]})})}var Y7=R(v(),1);var W2={minimax:"h3-context-ir (海螺官方)",volcengine:"doubao-seed-2-0-pro-260215 (火山引擎)",zhipu:"glm-5v-turbo (智谱)",runningHubDoubao:"bytedance/doubao-seed-2.0-pro (RunningHub)",runningHubGlm:"glm-5v-turbo (RunningHub)",local:"llama.cpp (本地)"},uW=new Map;function Xe($){if(!$||typeof $!=="object")throw Error("RunningHub returned an invalid account response.");let J=$;if(typeof J.error==="string")throw Error(J.error);let Q=Number(J.amount);if(!Number.isFinite(Q))throw Error("RunningHub account response did not contain a valid balance.");return{amount:Q,currency:typeof J.currency==="string"?J.currency:"CNY"}}var Eh=[{id:"minimax",modelNames:[W2.minimax],balancePageUrl:"https://platform.minimaxi.com/console/recharge-records",apiKeyPageUrl:"https://platform.minimaxi.com/console/access?tab=api-keys"},{id:"volcengine",modelNames:[W2.volcengine],balancePageUrl:"https://console.volcengine.com/finance/",apiKeyPageUrl:"https://console.volcengine.com/ark/region:ark+cn-beijing/apiKey"},{id:"zhipu",modelNames:[W2.zhipu],balancePageUrl:"https://open.bigmodel.cn/usercenter/financial/balance",apiKeyPageUrl:"https://open.bigmodel.cn/usercenter/apikeys"},{id:"runninghub",modelNames:[W2.runningHubDoubao,W2.runningHubGlm],balancePageUrl:"https://www.runninghub.cn/call-api/bill-task?tab=llmLogs&inviteCode=rh-v1623",apiKeyPageUrl:"https://www.runninghub.cn/zh-cn/enterprise-api/sharedApi?inviteCode=rh-v1623",balanceRequest:{url:"/easy-media/prompt-enhancer/runninghub-balance",refreshIntervalMs:30000,createInit:($)=>({method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({api_key:$})}),readBalance:Xe}},{id:"local",modelNames:[W2.local]}];function CF($){return Eh.find((J)=>J.modelNames.includes($))??Eh[0]}async function yh($,J){let Q=$.balanceRequest;if(!Q)throw Error("The selected provider does not expose a balance API.");let Z=`${$.id}:${J}`,q=uW.get(Z);if(q?.request)return q.request;if(q?.completedAt!==void 0&&Date.now()-q.completedAt{let Y=await fetch(Q.url,Q.createInit(J));if(!Y.ok)throw Error(`Balance request failed with status ${Y.status}.`);let z=await Y.json();return Q.readBalance(z)})();uW.set(Z,{request:X});try{let Y=await X;return uW.set(Z,{balance:Y,completedAt:Date.now()}),Y}catch(Y){throw uW.set(Z,{error:Y,completedAt:Date.now()}),Y}}function mW($){let J=$;while(Array.isArray(J)&&J.length===1)J=J[0];return J}function Ph($,J){let Q=mW($);if(!Q||typeof Q!=="object")return"";let Z=mW(Q[J]);return typeof Z==="string"?Z:""}function cW($){let J=$.widgets??[],Q=J.find((X)=>X.name==="model")?.value,Z=mW(J.find((X)=>X.name==="model.model")?.value??Q),q=mW(J.find((X)=>X.name==="model.apikey")?.value??J.find((X)=>X.name==="apikey")?.value);return{modelName:typeof Z==="string"?Z:Ph(Q,"model")||W2.minimax,apiKey:typeof q==="string"?q:Ph(Q,"apikey")}}function SF($){globalThis.open($,"_blank","noopener,noreferrer")}function Rh($,J){try{return new Intl.NumberFormat(J||void 0,{style:"currency",currency:$.currency,minimumFractionDigits:2,maximumFractionDigits:2}).format($.amount)}catch(Q){return console.error("[PromptEnhancerAccountBar] failed to format balance:",Q),`${$.amount.toFixed(2)} ${$.currency}`}}function Ye({apiKey:$,locale:J,modelName:Q,refreshToken:Z=0}){let q=q1(),X=CF(Q),[Y,z]=Y7.useState(null),[K,W]=Y7.useState(!1),[H,B]=Y7.useState(!1);if(Y7.useEffect(()=>{let _=X.balanceRequest,L=$.trim();if(z(null),W(!1),B(Boolean(_)),!_)return;let F=!1;return(async()=>{try{let M=await yh(X,L);if(!F)z(M)}catch(M){if(F)return;console.error("[PromptEnhancerAccountBar] failed to load balance:",M),W(!0)}finally{if(!F)B(!1)}})(),()=>{F=!0}},[$,X,Z]),X.id==="local")return G("div",{className:"flex h-[30px] items-center border-t border-border px-2 text-[10px] text-muted-foreground",children:q("promptEnhancerAccount.localModel")});return T("div",{className:"flex h-[30px] min-w-0 items-center justify-between gap-2",children:[G("div",{className:"min-w-0",children:(()=>{if(!X.balanceRequest)return G(k0,{className:"h-6 px-1.5 text-[10px] cursor-pointer",onClick:()=>X.balancePageUrl&&SF(X.balancePageUrl),size:"sm",type:"button",variant:"link",children:q("promptEnhancerAccount.viewBalance")});if(H)return T(TJ,{className:"h-5 gap-1 px-1.5 text-[10px]",variant:"outline",children:[G(X6,{className:"size-3 animate-spin"}),q("promptEnhancerAccount.loadingBalance")]});if(Y)return G(TJ,{className:"h-5 max-w-full truncate px-1.5 text-[10px] cursor-pointer",title:Rh(Y,J),variant:"secondary",onClick:()=>X.balancePageUrl&&SF(X.balancePageUrl),children:q("promptEnhancerAccount.balance",{amount:Rh(Y,J)})});let _=K?q("promptEnhancerAccount.balanceUnavailable"):q("promptEnhancerAccount.apiKeyRequired");return G(TJ,{className:"h-5 px-1.5 text-[10px]",title:_,variant:"outline",children:q("promptEnhancerAccount.balanceEmpty")})})()}),X.apiKeyPageUrl?T(k0,{className:"h-6 shrink-0 px-1.5 text-[10px] cursor-pointer",onClick:()=>X.apiKeyPageUrl&&SF(X.apiKeyPageUrl),size:"sm",type:"button",variant:"outline",children:[G(Ch,{className:"size-1"}),q("promptEnhancerAccount.apiKey")]}):null]})}function ze($){return G(y6.Provider,{value:$.locale,children:G(Ye,{...$})})}function Ke({app:$,node:J}){let Q=J,[Z,q]=Y7.useState(()=>cW(Q)),[X,Y]=Y7.useState(0);return Y7.useEffect(()=>{let z=!0,K=Q.onConfigure,W=Q.onExecuted,H=Q.onWidgetChanged,B=()=>{queueMicrotask(()=>{if(!z)return;let F=cW(Q);q((V)=>V.modelName===F.modelName&&V.apiKey===F.apiKey?V:F)})},U=function(F){K?.call(this,F),B()},_=function(F){W?.call(this,F);let V=cW(Q);if(CF(V.modelName).id==="runninghub")Y((M)=>M+1)},L=function(F,V,M,D){if(H?.call(this,F,V,M,D),F==="model"||F==="model.model"||F==="model.apikey"||F==="apikey")B()};return Q.onConfigure=U,Q.onExecuted=_,Q.onWidgetChanged=L,B(),()=>{if(z=!1,Q.onConfigure===U)Q.onConfigure=K;if(Q.onExecuted===_)Q.onExecuted=W;if(Q.onWidgetChanged===L)Q.onWidgetChanged=H}},[Q]),G(ze,{apiKey:Z.apiKey,locale:$?.ui?.settings?.settingsValues?.["Comfy.Locale"],modelName:Z.modelName,refreshToken:X})}var O1=R(v(),1);var dW=R(v(),1);function Sh($){let J=dW.useRef($);J.current=$,dW.useEffect(()=>{function Q(){if(document.visibilityState==="hidden")J.current()}function Z(){J.current()}return document.addEventListener("visibilitychange",Q),window.addEventListener("pagehide",Z),()=>{document.removeEventListener("visibilitychange",Q),window.removeEventListener("pagehide",Z)}},[])}var vh=1,Ge=100,hF="h-6 w-6 shrink-0 [&_svg]:size-3.5",pW=Symbol("drop-prompt-input");function xF($){if(!$||typeof $!=="object"||Array.isArray($))return BX;let J=$;return{project_name:typeof J.project_name==="string"?J.project_name:"default",width:Number.isFinite(J.width)?Math.max(0,Number(J.width)):0,height:Number.isFinite(J.height)?Math.max(0,Number(J.height)):0,frame_rate:Number.isFinite(J.frame_rate)&&Number(J.frame_rate)>0?Number(J.frame_rate):24,clips:Array.isArray(J.clips)?J.clips:[],auto_combine:J.auto_combine!==!1,updated_at:J.updated_at}}function We($){let J=$.graph?.links;if(!J)return[];if(Array.isArray(J))return J.filter(Boolean);if(J instanceof Map)return[...J.values()].filter(Boolean);return Object.values(J).filter(Boolean)}function He($,J,Q){let Z=new Set(Object.keys(Q));for(let q of $.graph?._nodes??[])if(q.id!=null)Z.add(String(q.id));if(J&&typeof J==="object"&&"nodes"in J&&Array.isArray(J.nodes)){for(let q of J.nodes)if(q&&typeof q==="object"&&"id"in q&&q.id!=null)Z.add(String(q.id))}return Z}function fF($,J,Q){if(Array.isArray($)&&$.length===2&&(typeof $[0]==="string"||typeof $[0]==="number")&&typeof $[1]==="number"&&Q.has(String($[0])))return J.has(String($[0]))?$:pW;if(Array.isArray($))return $.flatMap((Z)=>{let q=fF(Z,J,Q);return q===pW?[]:[q]});if($&&typeof $==="object")return Object.fromEntries(Object.entries($).flatMap(([Z,q])=>{let X=fF(q,J,Q);return X===pW?[]:[[Z,X]]}));return $}function Be($){let J=String($.id??""),Q=new Set(J?[J]:[]),Z=J?[J]:[],q=We($);while(Z.length>0){let X=Z.shift();for(let Y of q){if(String(Y.origin_id??"")!==X||Y.target_id==null)continue;let z=String(Y.target_id);if(Q.has(z))continue;Q.add(z),Z.push(z)}}return Q}function lW($){return Math.max(vh,$.source_end_frame-$.source_start_frame)}function hh($){return $.filter((J)=>J.enabled!==!1).reduce((J,Q)=>J+lW(Q),0)}function GX($,J){let Q=0;for(let Z of $){if(Z.enabled===!1)continue;let q=Q+lW(Z);if(JQ.file_path===$.file_path)?J:[{file_path:$.file_path,file_name:$.file_name,media_revision:$.media_revision,source_frame_count:$.source_frame_count},...J]}function fh($,J){let Q=Math.max(vh,J.source_frame_count),Z=Math.min($.source_start_frame,Q-1);return{...$,file_path:J.file_path,file_name:J.file_name,media_revision:J.media_revision,source_start_frame:Z,source_end_frame:Math.max(Z+1,Math.min($.source_end_frame,Q)),source_frame_count:Q,continuity_mode:J.continuity_mode??$.continuity_mode}}function Le({value:$,onChange:J,app:Q,node:Z}){let q=xF($),X=Q?.ui?.settings?.settingsValues?.["Comfy.Locale"],Y=O1.useCallback((n,D0)=>xW(X,n,D0),[X]),[z,K]=O1.useState(0),[W,H]=O1.useState(!1),[B,U]=O1.useState(!1),[_,L]=O1.useState(1),[F,V]=O1.useState(!1),[M,D]=O1.useState(!1),[N,O]=O1.useState(!1),[k,I]=O1.useState(null),[b,A]=O1.useState(!1),[w,C]=O1.useState(["default"]),[y,x]=O1.useState(null),[E,P]=O1.useState({}),[h,p]=O1.useState(0),[e,S]=O1.useState(0),r=O1.useRef(new Map),$0=O1.useRef(0),K0=O1.useRef(0),t=O1.useRef(0),H0=O1.useRef(0),z0=O1.useRef(null),j=O1.useRef(null),d=O1.useRef(0),m=O1.useRef(!1),s=O1.useRef(q);s.current=q;let u=a9(Q),i=Math.max(1,wJ(j))*_,f=hh(q.clips),o=GX(q.clips,Math.min(z,Math.max(0,f-1))),G0=o?xh(o.clip):null,l=q.clips.filter((n)=>n.enabled!==!1),Z0=o?l.findIndex((n)=>n.id===o.clip.id):-1,Q0=Z0>=0&&l.length>1?l[(Z0+1)%l.length]:void 0,B0=Q0?xh(Q0):null,W0=w.includes(q.project_name)||!q.project_name?w:[...w,q.project_name];function L0(n){let D0=new Set(HX(n).map((f0)=>f0.file_path));if(D0.size===1)return[...D0];let w0=[...new Set(E[n.id]??[])].filter((f0)=>D0.has(f0)).slice(0,2);return w0.includes(n.file_path)?w0:[n.file_path]}let _0=o?L0(o.clip).map((n)=>HX(o.clip).find((D0)=>D0.file_path===n)).filter((n)=>Boolean(n)):[],N0=_0.length===2?_0.map(_e):[],d0=N0.length===2&&N0.every(Boolean);function g(n){z1(Ue(q.clips,n.id))}function a(n,D0){let w0=n.video_files?.find((f0)=>f0.file_path===D0);if(!w0)return;J({...q,clips:q.clips.map((f0)=>f0.id===n.id?fh(f0,w0):f0)}),I0(n,w0)}async function I0(n,D0){let w0=q.project_name||"default";try{let f0=await Q.api.fetchApi("/easy-media/project/video",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({project_name:w0,segment_index:n.index,file_path:D0.file_path})}),r0;try{r0=await f0.json()}catch(K1){if(!(K1 instanceof SyntaxError))throw K1;throw Error(Y("projectVideoCombine.selectClipFileFailed"))}if(!f0.ok)throw Error(WX(r0,Y("projectVideoCombine.selectClipFileFailed")))}catch(f0){Q.extensionManager.toast.add({severity:"error",summary:Y("projectVideoCombine.selectClipFileFailed"),detail:f0 instanceof Error?f0.message:String(f0),life:5000}),F0(w0,!1)}}function A0(n,D0){let w0=L0(n),f0=w0.includes(D0);if(f0&&w0.length===1)return;if(!f0&&w0.length>=2)return;let r0=f0?w0.filter((K1)=>K1!==D0):[...w0,D0];if(P((K1)=>({...K1,[n.id]:r0})),g(n),r0[0]!==n.file_path)a(n,r0[0])}let F0=O1.useCallback(async(n,D0=!0)=>{if(!n||m.current)return;let w0=++d.current;if(D(!0),n!==q.project_name)H(!1),K(0),x(null),P({}),J({...BX,project_name:n,auto_combine:q.auto_combine});try{let r0=await Q.api.fetchApi(`/easy-media/project?project_name=${encodeURIComponent(n)}`),K1=await r0.json();if(!r0.ok&&r0.status===404&&n==="default"){if(w0!==d.current)return;J({...BX,project_name:"default",auto_combine:q.auto_combine});return}if(!r0.ok)throw Error(WX(K1,Y("projectVideoCombine.refreshFailed")));if(w0!==d.current)return;J({...xF(K1),auto_combine:q.auto_combine})}catch(r0){if(D0&&w0===d.current)Q.extensionManager.toast.add({severity:"error",summary:Y("projectVideoCombine.refreshFailed"),detail:r0 instanceof Error?r0.message:String(r0),life:5000})}finally{if(w0===d.current)D(!1)}},[Q,q.auto_combine,q.project_name,J,Y]),m0=O1.useCallback(async()=>{try{let n=await Q.api.fetchApi("/easy-media/projects"),D0=await n.json();if(!n.ok)throw Error(WX(D0,Y("projectVideoCombine.projectListFailed")));let w0=D0&&typeof D0==="object"&&"projects"in D0&&Array.isArray(D0.projects)?D0.projects.filter((f0)=>typeof f0==="string"&&f0.length>0):[];C(w0.includes("default")?w0:["default",...w0])}catch(n){Q.extensionManager.toast.add({severity:"error",summary:Y("projectVideoCombine.projectListFailed"),detail:n instanceof Error?n.message:String(n),life:5000})}},[Q,Y]);async function R0(n,D0){if(m.current)return;m.current=!0,I(D0.file_path);let w0=q.project_name||"default";try{if(!await Q.extensionManager.dialog.confirm({title:Y("projectVideoCombine.deleteClipFileTitle"),message:Y("projectVideoCombine.deleteClipFileConfirm",{file:D0.file_name})}))return;++d.current,D(!1);let r0=await Q.api.fetchApi("/easy-media/project/video",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({project_name:w0,segment_index:n.index,file_path:D0.file_path})}),K1;try{K1=await r0.json()}catch(i0){if(!(i0 instanceof SyntaxError))throw i0;if(r0.status===404||r0.status===405)throw Error(Y("projectVideoCombine.deleteClipFileUnavailable"));throw Error(Y("projectVideoCombine.deleteClipFileInvalidResponse",{status:r0.status}))}if(!r0.ok)throw Error(WX(K1,Y("projectVideoCombine.deleteClipFileFailed")));if(!K1||typeof K1!=="object"||!("project_name"in K1)||K1.project_name!==w0||!("clips"in K1)||!Array.isArray(K1.clips))throw Error(Y("projectVideoCombine.deleteClipFileInvalidResponse",{status:r0.status}));let x1=s.current;if((x1.project_name||"default")!==w0)return;let r1=xF(K1),Y0=r1.clips.find((i0)=>i0.id===n.id),y0={...x1,updated_at:r1.updated_at,clips:x1.clips.flatMap((i0)=>{if(i0.id!==n.id)return[i0];if(!Y0)return[];let E0=HX(Y0),u1=[i0.file_path,...E[i0.id]??[]].map((j1)=>E0.find((t1)=>t1.file_path===j1)).find((j1)=>j1!==void 0)??E0.find((j1)=>j1.file_path===Y0.file_path);return[fh({...i0,video_files:E0},u1)]})};P((i0)=>{let E0={...i0},D1=y0.clips.find((t1)=>t1.id===n.id);if(!D1)return delete E0[n.id],E0;let u1=new Set(HX(D1).map((t1)=>t1.file_path)),j1=[...new Set(i0[n.id]??[])].filter((t1)=>u1.has(t1));return E0[n.id]=u1.size>1&&j1.length===2&&j1.includes(D1.file_path)?j1:[D1.file_path],E0}),H(!1),S((i0)=>i0+1),p((i0)=>i0+1);let h0=Math.min($0.current,Math.max(0,hh(y0.clips)-1));$0.current=h0,K(h0),x(GX(y0.clips,h0)?.clip.id??null),J(y0)}catch(f0){Q.extensionManager.toast.add({severity:"error",summary:Y("projectVideoCombine.deleteClipFileFailed"),detail:f0 instanceof Error?f0.message:String(f0),life:5000})}finally{m.current=!1,I(null)}}async function n0(){let n=q.project_name||"default",D0=!1;try{D0=await Q.extensionManager.dialog.confirm({title:Y("projectVideoCombine.deleteProjectTitle"),message:Y(n==="default"?"projectVideoCombine.deleteDefaultProjectConfirm":"projectVideoCombine.deleteProjectConfirm",{project:n})})}catch(w0){Q.extensionManager.toast.add({severity:"error",summary:Y("projectVideoCombine.deleteProjectFailed"),detail:w0 instanceof Error?w0.message:String(w0),life:5000});return}if(!D0)return;O(!0),D(!1),++d.current;try{let w0=await Q.api.fetchApi(`/easy-media/project?project_name=${encodeURIComponent(n)}`,{method:"DELETE"}),f0=await w0.json();if(!w0.ok)throw Error(WX(f0,Y("projectVideoCombine.deleteProjectFailed")));H(!1),K(0),x(null),P({}),C((r0)=>n==="default"?r0:r0.filter((K1)=>K1!==n)),J({...BX,project_name:"default",auto_combine:q.auto_combine}),Q.extensionManager.toast.add({severity:"success",summary:Y("projectVideoCombine.deleteProjectSuccess"),detail:Y("projectVideoCombine.deleteProjectSuccessDetail",{project:n}),life:4000})}catch(w0){Q.extensionManager.toast.add({severity:"error",summary:Y("projectVideoCombine.deleteProjectFailed"),detail:w0 instanceof Error?w0.message:String(w0),life:5000})}finally{O(!1)}}O1.useEffect(()=>{if(q.clips.length===0)F0(q.project_name||"default",!1)},[]),O1.useEffect(()=>{let n=()=>void F0(q.project_name||"default",!1);return Q.api.addEventListener("execution_success",n),()=>Q.api.removeEventListener("execution_success",n)},[Q.api,q.project_name,F0]),O1.useEffect(()=>{let n=(D0)=>{let w0=D0.detail,f0=w0&&typeof w0==="object"&&"project_name"in w0?String(w0.project_name):"",r0=q.project_name||"default";F0(f0||r0,!1)};return Q.api.addCustomEventListener("easy_multitrack_project_refresh",n),()=>Q.api.removeCustomEventListener("easy_multitrack_project_refresh",n)},[Q.api,q.project_name,F0]),O1.useEffect(()=>{let n=(D0)=>{let w0=D0.detail;if(!w0||typeof w0!=="object")return;let f0="node_id"in w0?String(w0.node_id):"";if(f0&&f0!==String(Z.id??""))return;let r0="project_name"in w0?String(w0.project_name):"";if(r0)F0(r0,!1)};return Q.api.addCustomEventListener("easy-media.project.selected",n),()=>Q.api.removeCustomEventListener("easy-media.project.selected",n)},[Q.api,Z,F0]),O1.useEffect(()=>{let n=Z;return n.__easyMediaSyncPlay=(D0,w0)=>{if(typeof w0==="boolean")U(w0);$0.current=0,K(0),x(GX(q.clips,0)?.clip.id??null),p((f0)=>f0+1),H(!0)},()=>{delete n.__easyMediaSyncPlay}},[q.clips,Z]),O1.useEffect(()=>{$0.current=z},[z]);let C0=O1.useCallback(()=>{if(z0.current!==null)cancelAnimationFrame(z0.current),z0.current=null;for(let n of r.current.values())n.pause()},[]);Sh(()=>{C0(),K($0.current),H(!1),S((n)=>n+1)}),O1.useEffect(()=>()=>C0(),[C0]),O1.useEffect(()=>{let n=Q.extensionManager.workflow,D0=n.activeWorkflow?.key??null;return n.$subscribe((w0,f0)=>{let r0=f0.activeWorkflow?.key??null;if(D0!==null&&r0!==null&&r0!==D0)C0(),K($0.current),H(!1),S((K1)=>K1+1);D0=r0})},[Q.extensionManager.workflow,C0]),O1.useEffect(()=>{if(!W||f<=0){if(z0.current!==null)cancelAnimationFrame(z0.current);z0.current=null;return}t.current=performance.now(),H0.current=t.current,K0.current=$0.current>=f?0:$0.current;function n(D0){let w0=Math.floor((D0-t.current)/1000*q.frame_rate),f0=K0.current+w0;if(f0>=f)$0.current=0,K0.current=0,t.current=D0,K(0),x(GX(q.clips,0)?.clip.id??null),p((r0)=>r0+1);else if(f0!==$0.current){if($0.current=f0,D0-H0.current>=Ge)H0.current=D0,K(f0)}z0.current=requestAnimationFrame(n)}return z0.current=requestAnimationFrame(n),()=>{if(z0.current!==null)cancelAnimationFrame(z0.current);z0.current=null}},[q.clips,q.frame_rate,W,f]),O1.useEffect(()=>{let n=o?r.current.get(o.clip.id):void 0;if(!n||!o)return;let D0=(o.clip.source_start_frame+Math.max(0,$0.current-o.start))/q.frame_rate;try{if(Math.abs(n.currentTime-D0)>0.001)n.currentTime=D0}catch(w0){console.error("[ProjectVideoCombineWidget] failed to seek preview video:",w0)}},[o?.clip.id,G0,q.frame_rate,d0,h]),O1.useEffect(()=>{if(W)return;let n=o?r.current.get(o.clip.id):void 0;if(!n||!o)return;let D0=(o.clip.source_start_frame+Math.max(0,z-o.start))/q.frame_rate;try{if(Math.abs(n.currentTime-D0)>0.001)n.currentTime=D0}catch(w0){console.error("[ProjectVideoCombineWidget] failed to seek paused preview video:",w0)}},[o?.clip.id,G0,z,q.frame_rate,d0,W]),O1.useEffect(()=>{let n=Q0?r.current.get(Q0.id):void 0;if(!n||!Q0)return;let D0=Q0.source_start_frame/q.frame_rate;try{if(Math.abs(n.currentTime-D0)>0.001)n.currentTime=D0}catch(w0){console.error("[ProjectVideoCombineWidget] failed to preload the next preview video:",w0)}},[q.frame_rate,Q0?.id,B0]),O1.useEffect(()=>{let n=o?r.current.get(o.clip.id):void 0;if(!n||!o)return;for(let[D0,w0]of r.current)if(D0!==o.clip.id)w0.pause();if(W)n.play().catch((D0)=>{console.error("[ProjectVideoCombineWidget] failed to play preview video:",D0),H(!1)});else n.pause()},[o?.clip.id,G0,d0,W,h]);function z1(n){let D0=Math.max(0,Math.min(f,Math.round(n)));if($0.current=D0,W)K0.current=D0>=f?0:D0,t.current=performance.now();K(D0);let w0=GX(q.clips,Math.min(D0,Math.max(0,f-1)));x(w0?.clip.id??null)}function Q1(){H((n)=>{if(n)K($0.current);return!n})}async function a0(){let n=q.project_name||"default";try{let D0=await Q.api.getQueue();if(D0.Running.length>0||D0.Pending.length>0)throw Error(Y("projectVideoCombine.queueBusy"));A(!0);let w0=await Q.graphToPrompt(),f0=Be(Z),r0=w0.output,K1=He(Z,w0.workflow,r0),x1=Object.fromEntries(Object.entries(r0).filter(([r1])=>f0.has(r1)).map(([r1,Y0])=>{let y0=fF(Y0.inputs??{},f0,K1),h0=y0===pW?{}:y0;if(r1===String(Z.id??""))h0.project_name=n,h0.project_data=JSON.stringify({...q,auto_combine:!0});return[r1,{...Y0,inputs:h0}]}));if(Object.keys(x1).length<2)throw Error(Y("projectVideoCombine.connectSaveNode"));await Q.api.queuePrompt(0,{...w0,output:x1}),Q.extensionManager.toast.add({severity:"info",summary:Y("projectVideoCombine.combineQueued"),detail:Y("projectVideoCombine.combineQueuedDetail",{project:n}),life:4000})}catch(D0){Q.extensionManager.toast.add({severity:"error",summary:Y("projectVideoCombine.combineFailed"),detail:D0 instanceof Error?D0.message:String(D0),life:6000})}finally{A(!1)}}function R1(n,D0){return T(H1,{children:[G(B1,{asChild:!0,children:G("span",{className:"inline-flex shrink-0",children:D0})}),G(W1,{children:n})]})}let C1=Math.max(1,i-q5-S2),b1=q5+Math.min(z,f)/Math.max(f,1)*C1;return G(y6.Provider,{value:X,children:G(n1,{children:T("div",{className:"flex h-full min-h-[520px] w-full flex-col overflow-hidden rounded-md border border-border bg-background text-foreground",children:[T("div",{className:"flex h-10 shrink-0 items-center justify-between border-b border-border px-2",children:[T("div",{className:"flex items-center gap-1",children:[T(y8,{disabled:k!==null,value:q.project_name||"default",onOpenChange:(n)=>{if(n)m0()},onValueChange:(n)=>void F0(n),children:[G(P8,{className:"h-7 w-32 text-xs","aria-label":Y("projectVideoCombine.selectProject"),children:G(W6,{})}),G(R8,{children:W0.map((n)=>G(l5,{value:n,children:n},n))})]}),R1(Y("projectVideoCombine.deleteProject"),G(k0,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive",disabled:N||M||k!==null,"aria-label":Y("projectVideoCombine.deleteProject"),onClick:()=>void n0(),children:N?G(X6,{className:"size-3.5 animate-spin"}):G(D5,{className:"size-3.5"})}))]}),T("div",{className:"flex items-center gap-2",children:[R1(Y("projectVideoCombine.refresh"),G(k0,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",disabled:M||k!==null,"aria-label":Y("projectVideoCombine.refresh"),onClick:()=>void F0(q.project_name||"default"),children:M?G(X6,{className:"size-3.5 animate-spin"}):G(CY,{className:"size-3.5"})})),T("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[G(BJ,{checked:q.auto_combine,onCheckedChange:(n)=>J({...q,auto_combine:n===!0})}),Y("projectVideoCombine.autoCombine")]}),T(k0,{type:"button",size:"sm",className:"h-7 gap-1.5 text-xs",disabled:b||k!==null||q.clips.length===0,onClick:()=>void a0(),children:[b?G(X6,{className:"size-3.5 animate-spin"}):G(y4,{className:"size-3.5"}),Y("projectVideoCombine.combine")]})]})]}),G("div",{className:"relative flex min-h-0 flex-1 items-center justify-center overflow-hidden bg-black p-3",children:d0?G(bh,{app:Q,sourceUrl:N0[0],outputUrl:N0[1],pausePlaybackNonce:e,parentPlayback:{isPlaying:W,currentTime:(o.clip.source_start_frame+z-o.start)/q.frame_rate,startTime:o.clip.source_start_frame/q.frame_rate,endTime:o.clip.source_end_frame/q.frame_rate,muted:B,onPause:()=>{K($0.current),H(!1)},onSeek:(n)=>z1(o.start+n*q.frame_rate-o.clip.source_start_frame)}},`${o.clip.id}:${N0.join("|")}`):G0?[{clip:o.clip,url:G0,visible:!0},...Q0&&B0?[{clip:Q0,url:B0,visible:!1}]:[]].map(({clip:n,url:D0,visible:w0})=>G("video",{ref:(f0)=>{if(f0)r.current.set(n.id,f0);else r.current.delete(n.id)},src:D0,preload:"auto",playsInline:!0,muted:!w0||B,"aria-hidden":!w0,className:w0?"h-full max-h-full w-full object-contain":"pointer-events-none absolute left-0 top-0 h-px w-px opacity-0"},n.id)):G("div",{className:"text-xs text-muted-foreground",children:Y("projectVideoCombine.emptyPreview")})}),T("div",{className:"grid h-9 shrink-0 grid-cols-[1fr_auto_1fr] items-center border-y border-border px-1 text-[10px]",children:[G("div",{className:"flex items-center",children:R1(B?Y("projectVideoCombine.unmutePreview"):Y("projectVideoCombine.mutePreview"),G(k0,{type:"button",variant:"ghost",size:"icon",className:hF,"aria-label":B?Y("projectVideoCombine.unmutePreview"):Y("projectVideoCombine.mutePreview"),"aria-pressed":B,onClick:()=>U((n)=>!n),children:B?G(jJ,{}):G(e9,{})}))}),T("div",{className:"flex items-center gap-2 text-muted-foreground",children:[G("span",{className:"w-16 text-right tabular-nums text-gradient",children:M6(z,{frameRate:q.frame_rate,showFrames:!0})}),G(k0,{type:"button",variant:"secondary",size:"icon",className:`${hF} rounded-full`,disabled:f===0,"aria-label":W?Y("multitrack.pause"):Y("multitrack.play"),onClick:Q1,children:W?G(D7,{}):G(y4,{})}),G("span",{className:"w-16 tabular-nums",children:M6(f,{frameRate:q.frame_rate,showFrames:!0})})]}),T("div",{className:"ml-auto flex items-center gap-1",children:[R1(F?Y("multitrack.showTimeline"):Y("multitrack.hideTimeline"),G(k0,{type:"button",variant:"ghost",size:"icon",className:hF,"aria-label":F?Y("multitrack.showTimeline"):Y("multitrack.hideTimeline"),onClick:()=>V((n)=>!n),children:F?G(Qz,{}):G(Zz,{})})),G($J,{className:"size-3.5 text-muted-foreground"}),G(N8,{min:1,max:6,step:0.25,value:[_],onValueChange:([n])=>L(n),className:"h-3 w-12","aria-label":Y("multitrack.timelineZoom")})]})]}),G("div",{ref:j,className:`no-scrollbar h-[104px] shrink-0 overflow-x-auto overflow-y-hidden bg-muted/20 ${F?"hidden":""}`,"aria-hidden":F,children:T("div",{style:{width:i,minWidth:"100%"},children:[G($z,{totalLength:f,frameRate:q.frame_rate,width:i,canvasScale:u,currentTime:z,taskMarkers:[],selectedTaskMarkerId:null,onSeek:z1,onSelectTaskMarker:()=>{},onMoveTaskMarker:()=>{},onDeleteTaskMarker:()=>{}}),T("div",{className:"relative h-20",style:{width:i},children:[G("div",{className:"absolute top-2 flex h-14 overflow-hidden rounded-sm border border-border bg-muted/40",style:{left:q5,width:C1},children:q.clips.filter((n)=>n.enabled!==!1).map((n)=>{let w0=`h-full min-w-0 shrink-0 rounded-none border-r border-border px-2 ${y===n.id?"bg-primary/20 ring-1 ring-inset ring-primary":"bg-secondary/40 hover:bg-secondary/60"}`,f0={width:`${lW(n)/Math.max(f,1)*100}%`},r0=T("div",{className:"flex min-w-0 flex-col items-center leading-tight",children:[G("span",{className:"truncate text-[11px] font-medium",children:Y("projectVideoCombine.clipLabel",{number:n.index+1})}),G("span",{className:"truncate text-[9px] text-muted-foreground",children:Y("projectVideoCombine.clipContinuity",{mode:Y(n.continuity_mode==="shot"?"projectVideoCombine.continuityShot":n.continuity_mode==="context_swap"?"projectVideoCombine.continuityContextSwap":"projectVideoCombine.continuityContext")})})]}),K1=L0(n);return T(a1,{onOpenChange:(x1)=>{if(x1)g(n)},children:[G(T5,{asChild:!0,children:T(k0,{type:"button",variant:"ghost",className:`${w0} relative justify-center`,style:f0,"aria-label":Y("projectVideoCombine.selectClipFiles",{number:n.index+1}),children:[r0,T("span",{className:"absolute right-2 flex items-center gap-0.5 text-[9px] text-muted-foreground",children:[K1.length>1?K1.length:null,G(b4,{className:"size-3"})]})]})}),T(s1,{className:"w-64 p-1",align:"center",children:[G("div",{className:"px-2 py-1 text-[10px] text-muted-foreground",children:Y("projectVideoCombine.selectClipFilesHint")}),HX(n).map((x1)=>{let r1=K1.includes(x1.file_path),Y0=k!==null||!r1&&K1.length>=2;return T("div",{className:"flex items-center gap-1",children:[T(k0,{type:"button",variant:"ghost",role:"checkbox","aria-checked":r1,disabled:Y0,className:b0("h-8 min-w-0 flex-1 justify-start gap-2 px-2 text-xs",Y0&&"opacity-50"),onClick:()=>A0(n,x1.file_path),children:[G("span",{className:b0("flex size-4 shrink-0 items-center justify-center rounded-sm border border-border",r1&&"border-primary bg-primary text-primary-foreground"),children:r1?G(b9,{className:"size-3"}):null}),G("span",{className:"truncate",children:x1.file_name})]}),G(k0,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0 text-destructive hover:text-destructive",disabled:k!==null||N||M,"aria-label":Y("projectVideoCombine.deleteClipFile",{file:x1.file_name}),title:Y("projectVideoCombine.deleteClipFile",{file:x1.file_name}),onPointerDown:(y0)=>y0.stopPropagation(),onKeyDown:(y0)=>y0.stopPropagation(),onClick:(y0)=>{y0.preventDefault(),y0.stopPropagation(),R0(n,x1)},children:k===x1.file_path?G(X6,{className:"size-3.5 animate-spin"}):G(D5,{className:"size-3.5"})})]},x1.file_path)})]})]},n.id)})}),G("div",{className:"pointer-events-none absolute top-0 h-20 w-px bg-destructive",style:{left:b1}})]})]})})]})})})}export{Mp as TimelineWidget,Fe as SamplingPreviewWidget,Ke as PromptEnhancerAccountWidget,Le as ProjectVideoCombineWidget,mt as MultiTrackWidget,pt as MultiImagesLoaderWidget,qe as CompareVideoWidget}; diff --git a/dist/release/chunks/multitrack-utils-4cdm46fs.js b/dist/release/chunks/multitrack-utils-4cdm46fs.js new file mode 100644 index 0000000..86b026d --- /dev/null +++ b/dist/release/chunks/multitrack-utils-4cdm46fs.js @@ -0,0 +1 @@ +import{$b as _,Ab as z,Bb as A,Cb as B,Db as C,Eb as D,Fb as E,Gb as F,Hb as G,Ib as H,Jb as I,Kb as J,Lb as K,Mb as L,Nb as M,Ob as N,Pb as O,Qb as P,Rb as Q,Sb as R,Tb as S,Ub as T,Vb as U,Wb as V,Xb as W,Yb as X,Zb as Y,_b as Z,ac as $,bb as a,bc as aa,cb as b,cc as ba,db as c,dc as ca,eb as d,ec as da,fb as e,fc as ea,gb as f,gc as fa,hb as g,hc as ga,ib as h,ic as ha,jb as i,jc as ia,kb as j,kc as ja,lb as k,lc as ka,mb as l,mc as la,nb as m,nc as ma,ob as n,oc as na,pb as o,pc as oa,qb as p,qc as pa,rb as q,sb as r,tb as s,ub as t,vb as u,wb as v,xb as w,yb as x,zb as y}from"./index-9zskwz7p.js";import"./index-6y5pqcvv.js";import"./index-xcg45zk8.js";export{ja as updateMultiTrackSegmentDuration,ga as updateMultiTrackSegmentContent,Q as syncMatchingTasksToPrimaryVideoTrack,ha as syncMatchingTasksToPrimaryVideoSegment,W as splitMultiTrackSegmentByFrames,H as snapTimeToFrame,K as snapSecondsToFrame,I as snapMultiTrackResizeTime,J as snapMultiTrackMoveStartTime,la as setMultiTrackAudioTrackLock,M as segmentDuration,A as secondsToFrame,ia as resizeTaskSegmentEnd,ka as remapTrackDataFrameRate,L as remapFrameToRate,na as parseMultiTrackPreviewResolution,F as parseMultiTrackDurationTimecode,pa as normalizeTrackData,q as normalizeFormatValue,D as multiTrackDbToLinearGain,$ as moveSelectedSegments,_ as moveSegmentBetweenCompatibleTracks,z as mergeSelectedTaskSegments,r as isMoxieEditorFormat,U as getSelectedTaskUserPromptPatch,T as getSelectedTaskUserPrompt,fa as getSelectedMultiTrackSegment,ba as getSegmentDragPreviewSegments,aa as getSegmentDragPlaceholder,s as getMultiTrackTrackHeight,y as getMultiTrackTaskType,x as getMultiTrackTaskModeLabel,ca as getMultiTrackPreviewFrame,P as getInheritedTaskSegmentContent,da as getActivePreviewVideoSegment,ea as getActivePreviewAudioSources,B as frameToSeconds,G as formatMultiTrackTime,E as formatMultiTrackDurationTimecode,V as distributeMultiTrackSegmentsEvenly,Z as deleteSegmentsWithLinkedTasks,Y as deleteSegmentWithLinkedTasks,t as createMultiTrackVideoContent,u as createMultiTrackAudioContent,oa as createDefaultTrackData,ma as collectMultiTrackPreviewResolutionInput,X as cloneMultiTrackSegment,C as clampMultiTrackVolumeDb,N as calculateTotalLength,O as calculateTotalDuration,v as calculateReplacementAudioEndFrame,S as applyCombinedTaskTexts,R as addDefaultTaskSegmentIfRangeEmpty,w as MULTITRACK_TRACK_COLORS,d as MULTITRACK_TASK_MODES,h as MULTITRACK_REF_IMAGE_SIZES,k as MULTITRACK_MIN_VOLUME_DB,c as MULTITRACK_MIN_DURATION_SECONDS,m as MULTITRACK_MEDIA_TRACK_LIMIT,l as MULTITRACK_MAX_VOLUME_DB,n as MULTITRACK_FRAME_RATE_OPTIONS,j as MULTITRACK_DEFAULT_VOLUME_DB,b as MULTITRACK_DEFAULT_TOTAL_LENGTH,e as MULTITRACK_DEFAULT_TASK_MODE,i as MULTITRACK_DEFAULT_REF_IMAGE_SIZE,a as MULTITRACK_DEFAULT_FRAME_RATE,g as MULTITRACK_DEFAULT_CONTINUITY_MODE,f as MULTITRACK_CONTINUITY_MODES,p as FORMAT_INTERNAL_VALUE,o as FORMAT_DISPLAY_LABEL}; diff --git a/dist/release/chunks/multitrack-utils-8qv6nsb8.js b/dist/release/chunks/multitrack-utils-8qv6nsb8.js deleted file mode 100644 index dd8c2a5..0000000 --- a/dist/release/chunks/multitrack-utils-8qv6nsb8.js +++ /dev/null @@ -1 +0,0 @@ -import{$b as _,Ab as z,Bb as A,Cb as B,Db as C,Eb as D,Fb as E,Gb as F,Hb as G,Ib as H,Jb as I,Kb as J,Lb as K,Mb as L,Nb as M,Ob as N,Pb as O,Qb as P,Rb as Q,Sb as R,Tb as S,Ub as T,Vb as U,Wb as V,Xb as W,Yb as X,Zb as Y,_b as Z,ac as $,bb as a,bc as aa,cb as b,cc as ba,db as c,dc as ca,eb as d,ec as da,fb as e,fc as ea,gb as f,gc as fa,hb as g,hc as ga,ib as h,ic as ha,jb as i,jc as ia,kb as j,kc as ja,lb as k,lc as ka,mb as l,mc as la,nb as m,nc as ma,ob as n,oc as na,pb as o,pc as oa,qb as p,rb as q,sb as r,tb as s,ub as t,vb as u,wb as v,xb as w,yb as x,zb as y}from"./index-6mdy4n0q.js";import"./index-3jazyhrg.js";import"./index-w8y4mejn.js";export{ia as updateMultiTrackSegmentDuration,fa as updateMultiTrackSegmentContent,P as syncMatchingTasksToPrimaryVideoTrack,ga as syncMatchingTasksToPrimaryVideoSegment,V as splitMultiTrackSegmentByFrames,G as snapTimeToFrame,J as snapSecondsToFrame,H as snapMultiTrackResizeTime,I as snapMultiTrackMoveStartTime,ka as setMultiTrackAudioTrackLock,L as segmentDuration,z as secondsToFrame,ha as resizeTaskSegmentEnd,ja as remapTrackDataFrameRate,K as remapFrameToRate,ma as parseMultiTrackPreviewResolution,E as parseMultiTrackDurationTimecode,oa as normalizeTrackData,q as normalizeFormatValue,C as multiTrackDbToLinearGain,_ as moveSelectedSegments,Z as moveSegmentBetweenCompatibleTracks,y as mergeSelectedTaskSegments,T as getSelectedTaskUserPromptPatch,S as getSelectedTaskUserPrompt,ea as getSelectedMultiTrackSegment,aa as getSegmentDragPreviewSegments,$ as getSegmentDragPlaceholder,r as getMultiTrackTrackHeight,x as getMultiTrackTaskType,w as getMultiTrackTaskModeLabel,ba as getMultiTrackPreviewFrame,O as getInheritedTaskSegmentContent,ca as getActivePreviewVideoSegment,da as getActivePreviewAudioSources,A as frameToSeconds,F as formatMultiTrackTime,D as formatMultiTrackDurationTimecode,U as distributeMultiTrackSegmentsEvenly,Y as deleteSegmentsWithLinkedTasks,X as deleteSegmentWithLinkedTasks,s as createMultiTrackVideoContent,t as createMultiTrackAudioContent,na as createDefaultTrackData,la as collectMultiTrackPreviewResolutionInput,W as cloneMultiTrackSegment,B as clampMultiTrackVolumeDb,M as calculateTotalLength,N as calculateTotalDuration,u as calculateReplacementAudioEndFrame,R as applyCombinedTaskTexts,Q as addDefaultTaskSegmentIfRangeEmpty,v as MULTITRACK_TRACK_COLORS,d as MULTITRACK_TASK_MODES,h as MULTITRACK_REF_IMAGE_SIZES,k as MULTITRACK_MIN_VOLUME_DB,c as MULTITRACK_MIN_DURATION_SECONDS,m as MULTITRACK_MEDIA_TRACK_LIMIT,l as MULTITRACK_MAX_VOLUME_DB,n as MULTITRACK_FRAME_RATE_OPTIONS,j as MULTITRACK_DEFAULT_VOLUME_DB,b as MULTITRACK_DEFAULT_TOTAL_LENGTH,e as MULTITRACK_DEFAULT_TASK_MODE,i as MULTITRACK_DEFAULT_REF_IMAGE_SIZE,a as MULTITRACK_DEFAULT_FRAME_RATE,g as MULTITRACK_DEFAULT_CONTINUITY_MODE,f as MULTITRACK_CONTINUITY_MODES,p as FORMAT_INTERNAL_VALUE,o as FORMAT_DISPLAY_LABEL}; diff --git a/dist/release/chunks/timeline-utils-c1qm6z94.js b/dist/release/chunks/timeline-utils-c6x7npad.js similarity index 69% rename from dist/release/chunks/timeline-utils-c1qm6z94.js rename to dist/release/chunks/timeline-utils-c6x7npad.js index f6be5b1..ede4406 100644 --- a/dist/release/chunks/timeline-utils-c1qm6z94.js +++ b/dist/release/chunks/timeline-utils-c6x7npad.js @@ -1 +1 @@ -import{Da as a,Ea as b,Fa as c,Ga as d,Ha as e,Ia as f,Ja as g,Ka as h,La as i,Ma as j}from"./index-fpdytcvw.js";import"./index-3jazyhrg.js";import"./index-w8y4mejn.js";export{j as segmentPixelRect,c as secondsToFrames,d as secondsToAudioFrames,b as scaleImageItemsToDuration,g as parseTimeInput,e as framesToSeconds,f as formatTime,i as createDefaultTimelineData,a as computeSlotItems,h as TRACK_DEFAULT_COLORS}; +import{Da as a,Ea as b,Fa as c,Ga as d,Ha as e,Ia as f,Ja as g,Ka as h,La as i,Ma as j}from"./index-eqdkw1y2.js";import"./index-6y5pqcvv.js";import"./index-xcg45zk8.js";export{j as segmentPixelRect,c as secondsToFrames,d as secondsToAudioFrames,b as scaleImageItemsToDuration,g as parseTimeInput,e as framesToSeconds,f as formatTime,i as createDefaultTimelineData,a as computeSlotItems,h as TRACK_DEFAULT_COLORS}; diff --git a/dist/release/index.js b/dist/release/index.js index 782acfb..3a7ffdf 100644 --- a/dist/release/index.js +++ b/dist/release/index.js @@ -1,2 +1,2 @@ -import{a as Jf}from"./chunks/index-3wva2e3j.js";import{c as R,f as n,g as a,ua as E,za as t}from"./chunks/index-8qxfph9w.js";import{Ca as T}from"./chunks/index-2femq7pq.js";import{qc as W}from"./chunks/index-3jazyhrg.js";import{rc as Ff,vc as O}from"./chunks/index-w8y4mejn.js";function g(f,m){if(document.getElementById(m))return null;let C=document.createElement("style");return C.id=m,C.textContent=f,document.head.appendChild(C),C}var Y=new Set(["easy saveVideo","easy compareVideos","easy multiTrackEditor","easy multitrackProjectVideoCombine"]),s="common.syncPlay";function q(f){return Y.has(f?.comfyClass??f?.type??"")}function d(f){let m=new Set;return f.filter((C)=>{if(m.has(C))return!1;return m.add(C),!0})}function w(f,m){let C=Object.values(m?.selected_nodes??{}).filter(q);if(C.length>0)return d(C);if(q(f))return[f];return[]}function r(f){return f instanceof HTMLElement}function G(f,m){if(f instanceof HTMLVideoElement){m.add(f);return}if(r(f))f.querySelectorAll("video").forEach((C)=>m.add(C))}function p(f){let m=new Set;for(let C of f.widgets??[]){if(!C||typeof C!=="object")continue;for(let z of["element","inputEl","video","container"])G(C[z],m)}for(let C of f.imgs??[])G(C,m);return[...m]}var L={"easy saveVideo":0,"easy multitrackProjectVideoCombine":1,"easy multiTrackEditor":2};function S(f){return f.comfyClass??f.type??""}function o(f,m){let C=L[S(f)];if(C===void 0)return;let z=m.reduce((V,Z)=>{let N=L[S(Z)];return N===void 0?V:Math.min(V,N)},Number.POSITIVE_INFINITY);return Number.isFinite(z)?C>z:void 0}function D(f,m){let C=p(f);for(let z of C)try{if(z.pause(),z.currentTime=0,typeof m==="boolean")z.muted=m;let V=z.play();if(V)V.catch((Z)=>{console.error("[EasyMedia Sync Play] failed to play native video:",Z)})}catch(V){console.error("[EasyMedia Sync Play] failed to reset native video:",V)}return C.length>0}async function e(f){let m=performance.now();await Promise.all(f.map(async(C)=>{try{let z=o(C,f);if(C.__easyMediaSyncPlay){await C.__easyMediaSyncPlay(m,z);return}if(!D(C,z))console.warn("[EasyMedia Sync Play] no playable video found for node:",C)}catch(z){console.error("[EasyMedia Sync Play] failed to sync play node:",z)}}))}function u(f,m,C){if(!q(f))return[];if(w(f,m).length===0)return[];return[null,{content:R(C,s),callback:()=>e(w(f,m))}]}function A(f,m){if(!Y.has(m.name??""))return;f.prototype.__easyMediaSyncPlay??=function(z,V){D(this,V)}}function y(f,m){if(m.name!=="easy multiImagesLoader")return;let C=f.prototype.onNodeCreated;f.prototype.onNodeCreated=function(){C?.call(this);let z=[600,700];if(typeof this.setSize==="function")this.setSize(z);else this.size=z;this.setDirtyCanvas?.(!0,!0)}}var ff=[720,520];function Cf(f,m,C){if(typeof f.setSize==="function")f.setSize([m,C]);else f.size=[m,C];f.setDirtyCanvas?.(!0,!0)}function I(f,m){if(m.name!=="easy compareVideos")return;let C=f.prototype.onNodeCreated;f.prototype.onNodeCreated=function(){C?.call(this);let[V,Z]=ff;Cf(this,V,Z)}}var mf=[450,100];function zf(f,m,C){if(typeof f.setSize==="function")f.setSize([m,C]);else f.size=[m,C];f.setDirtyCanvas?.(!0,!0)}function P(f,m){if(m.name!=="easy multitrackProjectVideoCombine")return;let C=f.prototype.onNodeCreated;f.prototype.onNodeCreated=function(){C?.call(this);let[V,Z]=mf;zf(this,V,Z)}}function i(f,m){if(m.name!=="easy compareVideos")return;let C=f.prototype;C.hideOutputImages=!0,C.onDrawBackground=function(){let V=this.widgets?.find((Z)=>Z.name==="video-preview");if(V&&this.removeWidget)try{this.removeWidget(V)}catch(Z){console.error("[CompareVideoWidget] failed to remove the default video preview:",Z)}this.videoContainer?.replaceChildren(),this.videoContainer=void 0,this.imgs=void 0}}function Vf(f){if(f instanceof Error)return(f.message||f.name).slice(0,4000);return(typeof f==="object"?JSON.stringify(f):String(f)).slice(0,4000)}async function Zf(f,m){let C=!1,z,V;try{if(Reflect.get(f,"processingQueue"))throw Error("ComfyUI is already submitting a workflow; wait for it to finish");let Z=f.extensionManager.workflow.activeWorkflow;if(m.mode==="replace"&&!Z)throw Error("There is no active workflow to replace");let N=structuredClone(m.workflow);if(N.id=W(),await f.loadGraphData(N,!0,!0,m.mode==="replace"?Z:`${m.name.replace(/\.json$/i,"")}-${m.request_id}`)===!1||f.rootGraph.serialize().id!==N.id)throw Error("ComfyUI did not load the requested workflow");if(f.canvas.setDirty(!0,!0),!m.auto_queue)return{status:"loaded"};if(Reflect.get(f,"processingQueue"))throw Error("ComfyUI started another submission while loading; workflow was opened but not queued");let J=f.api.queuePrompt,F=!0,Q=async($,B,...U)=>{if(!F)return J.call(f.api,$,B,...U);if(B.workflow.id!==N.id||C)throw V=Error("Workflow changed or another run started during submission"),V;C=!0;try{let M=await J.call(f.api,$,B,...U);return z=M.prompt_id,M}catch(M){throw V=M,M}};f.api.queuePrompt=Q;try{let $=await f.queuePrompt(0,1);if(z)return{status:"queued",prompt_id:z};if(!$||V)throw V??Error("ComfyUI rejected the workflow; check node errors");throw Error("ComfyUI did not return a prompt_id; check queue/history before retrying")}finally{if(F=!1,f.api.queuePrompt===Q)f.api.queuePrompt=J}}catch(Z){if(z)return{status:"queued",prompt_id:z};return{status:C?"unknown":"failed",error:Vf(Z)}}}function _(f){let m=W(),C=!1,z,V,Z=!1;async function N(J,F){let Q=await f.api.fetchApi(`/easy-media/workflow/${J}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(F)});if(!Q.ok)throw Error(`Workflow bridge: HTTP ${Q.status}: ${await Q.text()}`);return Q.json()}async function X(){try{if(!f.api.clientId)return;if(V){let{job:F,result:Q}=V;await N(`submissions/${F.request_id}/result`,{...Q,claim_token:F.claim_token}),V=void 0}if(!f.extensionManager.workflow.activeWorkflow||f.extensionManager.workflow.isBusy)return;let J=await N("poll",{client_id:m,session_id:f.api.clientId,title:document.title.slice(0,300)});if(Z=!1,J.job){let F=await Zf(f,J.job);if(V={job:J.job,result:F},F.status==="failed"||F.status==="unknown")f.extensionManager.toast.add({severity:"error",summary:"Easy Media workflow",detail:F.error,life:8000})}}catch(J){if(!Z)console.error("[Easy Media] Workflow submission bridge:",J);Z=!0}finally{if(!C)z=setTimeout(()=>{X()},Z?5000:1000)}}return z=setTimeout(()=>{X()},1000),()=>{if(C=!0,z)clearTimeout(z)}}var v=Ff(Jf(),1);var Mf="easy multitrackProject",H="easy-media-sampling-preview",h=8,K=280,b=K-h;function Nf(f,m){let C=!1,z=!1,V=0,Z=null,N=null,X=null,J=null,F=document.createElement("div");F.classList.add("comfyui-react-widget",T),F.hidden=!0,Object.assign(F.style,{width:"100%",height:`${K}px`,maxHeight:`${K}px`,overflow:"hidden",position:"relative",pointerEvents:"none"});let Q=f.addDOMWidget(H,H,F,{getMinHeight:()=>C?K:h,getMaxHeight:()=>C?K:h,hideOnZoom:!1,margin:0,serialize:!1});Q.hidden=!1;let $=()=>{let M=F.parentElement;if(!M)return;if(M!==J)X?.disconnect(),J=M,X=new MutationObserver($),X.observe(M,{attributes:!0,attributeFilter:["style"]}),N?.disconnect(),N=null;let c=C?K:h,j=C?"auto":"none";if(M.style.maxHeight!==`${c}px`)M.style.maxHeight=`${c}px`;if(M.style.overflow!=="hidden")M.style.overflow="hidden";if(M.style.pointerEvents!==j)M.style.pointerEvents=j};if(N=new MutationObserver($),document.body)N.observe(document.body,{childList:!0,subtree:!0});globalThis.requestAnimationFrame?.($);let B=(M)=>{if(C===M)return;if(C=M,F.hidden=!C,F.style.pointerEvents=C?"auto":"none",delete Q.computedHeight,f.size&&f.setSize){if(C&&!z)f.setSize([f.size[0],f.size[1]+b]),z=!0;else if(!C&&z)f.setSize([f.size[0],Math.max(h,f.size[1]-b)]),z=!1}f.onResize?.(f.size),f.graph?.setDirtyCanvas?.(!0,!0),globalThis.requestAnimationFrame?.($)},U=()=>Z?.render(E(t,{app:m,nodeId:()=>f.id,executionRevision:V,onVisibilityChange:B}));return Z=v.createRoot(F),U(),{reset:()=>{V+=1,U()},cleanup:()=>{N?.disconnect(),X?.disconnect(),Z?.unmount(),F.remove(),Z=null}}}function l(f,m,C){if(m.name!==Mf)return;let z=f.prototype,V=z.onNodeCreated,Z=z.onExecutionStart,N=z.onRemoved;z.onNodeCreated=function(...J){V?.apply(this,J);let F=Nf(this,C);this.easyMediaSamplingPreviewCleanup=F.cleanup,this.easyMediaSamplingPreviewReset=F.reset},z.onExecutionStart=function(...J){this.easyMediaSamplingPreviewReset?.(),Z?.apply(this,J)},z.onRemoved=function(...J){this.easyMediaSamplingPreviewCleanup?.(),delete this.easyMediaSamplingPreviewCleanup,delete this.easyMediaSamplingPreviewReset,N?.apply(this,J)}}var[{createReactWidget:x},{TimelineWidget:Qf,MultiTrackWidget:Xf,MultiImagesLoaderWidget:$f,CompareVideoWidget:Kf,PromptEnhancerAccountWidget:xf,ProjectVideoCombineWidget:Bf},{createDefaultTimelineData:Uf},{createDefaultTrackData:hf}]=await Promise.all([import("./chunks/create-react-widget-x2d1v5cz.js"),import("./chunks/index-93keyn9s.js"),import("./chunks/timeline-utils-c1qm6z94.js"),import("./chunks/multitrack-utils-8qv6nsb8.js")]),kf=JSON.stringify(Uf()),Of=JSON.stringify(hf()),qf=JSON.stringify({save_output:!0,filename_prefix:"ComfyUI",watch_output_history:!1}),k=globalThis.comfyAPI.app.app;k.registerExtension({name:"Comfy.EasyMedia.widgets",async setup(){_(k),g(`/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */ +import{a as Jf}from"./chunks/index-xk3sxqv7.js";import{c as R,f as n,g as a,ua as E,za as t}from"./chunks/index-nje7pz68.js";import{Ca as T}from"./chunks/index-1wrhp8dx.js";import{rc as W}from"./chunks/index-6y5pqcvv.js";import{sc as Ff,wc as O}from"./chunks/index-xcg45zk8.js";function g(f,m){if(document.getElementById(m))return null;let C=document.createElement("style");return C.id=m,C.textContent=f,document.head.appendChild(C),C}var Y=new Set(["easy saveVideo","easy compareVideos","easy multiTrackEditor","easy multitrackProjectVideoCombine"]),s="common.syncPlay";function q(f){return Y.has(f?.comfyClass??f?.type??"")}function d(f){let m=new Set;return f.filter((C)=>{if(m.has(C))return!1;return m.add(C),!0})}function w(f,m){let C=Object.values(m?.selected_nodes??{}).filter(q);if(C.length>0)return d(C);if(q(f))return[f];return[]}function r(f){return f instanceof HTMLElement}function G(f,m){if(f instanceof HTMLVideoElement){m.add(f);return}if(r(f))f.querySelectorAll("video").forEach((C)=>m.add(C))}function p(f){let m=new Set;for(let C of f.widgets??[]){if(!C||typeof C!=="object")continue;for(let z of["element","inputEl","video","container"])G(C[z],m)}for(let C of f.imgs??[])G(C,m);return[...m]}var L={"easy saveVideo":0,"easy multitrackProjectVideoCombine":1,"easy multiTrackEditor":2};function S(f){return f.comfyClass??f.type??""}function o(f,m){let C=L[S(f)];if(C===void 0)return;let z=m.reduce((V,Z)=>{let N=L[S(Z)];return N===void 0?V:Math.min(V,N)},Number.POSITIVE_INFINITY);return Number.isFinite(z)?C>z:void 0}function D(f,m){let C=p(f);for(let z of C)try{if(z.pause(),z.currentTime=0,typeof m==="boolean")z.muted=m;let V=z.play();if(V)V.catch((Z)=>{console.error("[EasyMedia Sync Play] failed to play native video:",Z)})}catch(V){console.error("[EasyMedia Sync Play] failed to reset native video:",V)}return C.length>0}async function e(f){let m=performance.now();await Promise.all(f.map(async(C)=>{try{let z=o(C,f);if(C.__easyMediaSyncPlay){await C.__easyMediaSyncPlay(m,z);return}if(!D(C,z))console.warn("[EasyMedia Sync Play] no playable video found for node:",C)}catch(z){console.error("[EasyMedia Sync Play] failed to sync play node:",z)}}))}function u(f,m,C){if(!q(f))return[];if(w(f,m).length===0)return[];return[null,{content:R(C,s),callback:()=>e(w(f,m))}]}function A(f,m){if(!Y.has(m.name??""))return;f.prototype.__easyMediaSyncPlay??=function(z,V){D(this,V)}}function y(f,m){if(m.name!=="easy multiImagesLoader")return;let C=f.prototype.onNodeCreated;f.prototype.onNodeCreated=function(){C?.call(this);let z=[600,700];if(typeof this.setSize==="function")this.setSize(z);else this.size=z;this.setDirtyCanvas?.(!0,!0)}}var ff=[720,520];function Cf(f,m,C){if(typeof f.setSize==="function")f.setSize([m,C]);else f.size=[m,C];f.setDirtyCanvas?.(!0,!0)}function I(f,m){if(m.name!=="easy compareVideos")return;let C=f.prototype.onNodeCreated;f.prototype.onNodeCreated=function(){C?.call(this);let[V,Z]=ff;Cf(this,V,Z)}}var mf=[450,100];function zf(f,m,C){if(typeof f.setSize==="function")f.setSize([m,C]);else f.size=[m,C];f.setDirtyCanvas?.(!0,!0)}function P(f,m){if(m.name!=="easy multitrackProjectVideoCombine")return;let C=f.prototype.onNodeCreated;f.prototype.onNodeCreated=function(){C?.call(this);let[V,Z]=mf;zf(this,V,Z)}}function i(f,m){if(m.name!=="easy compareVideos")return;let C=f.prototype;C.hideOutputImages=!0,C.onDrawBackground=function(){let V=this.widgets?.find((Z)=>Z.name==="video-preview");if(V&&this.removeWidget)try{this.removeWidget(V)}catch(Z){console.error("[CompareVideoWidget] failed to remove the default video preview:",Z)}this.videoContainer?.replaceChildren(),this.videoContainer=void 0,this.imgs=void 0}}function Vf(f){if(f instanceof Error)return(f.message||f.name).slice(0,4000);return(typeof f==="object"?JSON.stringify(f):String(f)).slice(0,4000)}async function Zf(f,m){let C=!1,z,V;try{if(Reflect.get(f,"processingQueue"))throw Error("ComfyUI is already submitting a workflow; wait for it to finish");let Z=f.extensionManager.workflow.activeWorkflow;if(m.mode==="replace"&&!Z)throw Error("There is no active workflow to replace");let N=structuredClone(m.workflow);if(N.id=W(),await f.loadGraphData(N,!0,!0,m.mode==="replace"?Z:`${m.name.replace(/\.json$/i,"")}-${m.request_id}`)===!1||f.rootGraph.serialize().id!==N.id)throw Error("ComfyUI did not load the requested workflow");if(f.canvas.setDirty(!0,!0),!m.auto_queue)return{status:"loaded"};if(Reflect.get(f,"processingQueue"))throw Error("ComfyUI started another submission while loading; workflow was opened but not queued");let J=f.api.queuePrompt,F=!0,Q=async($,B,...U)=>{if(!F)return J.call(f.api,$,B,...U);if(B.workflow.id!==N.id||C)throw V=Error("Workflow changed or another run started during submission"),V;C=!0;try{let M=await J.call(f.api,$,B,...U);return z=M.prompt_id,M}catch(M){throw V=M,M}};f.api.queuePrompt=Q;try{let $=await f.queuePrompt(0,1);if(z)return{status:"queued",prompt_id:z};if(!$||V)throw V??Error("ComfyUI rejected the workflow; check node errors");throw Error("ComfyUI did not return a prompt_id; check queue/history before retrying")}finally{if(F=!1,f.api.queuePrompt===Q)f.api.queuePrompt=J}}catch(Z){if(z)return{status:"queued",prompt_id:z};return{status:C?"unknown":"failed",error:Vf(Z)}}}function _(f){let m=W(),C=!1,z,V,Z=!1;async function N(J,F){let Q=await f.api.fetchApi(`/easy-media/workflow/${J}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(F)});if(!Q.ok)throw Error(`Workflow bridge: HTTP ${Q.status}: ${await Q.text()}`);return Q.json()}async function X(){try{if(!f.api.clientId)return;if(V){let{job:F,result:Q}=V;await N(`submissions/${F.request_id}/result`,{...Q,claim_token:F.claim_token}),V=void 0}if(!f.extensionManager.workflow.activeWorkflow||f.extensionManager.workflow.isBusy)return;let J=await N("poll",{client_id:m,session_id:f.api.clientId,title:document.title.slice(0,300)});if(Z=!1,J.job){let F=await Zf(f,J.job);if(V={job:J.job,result:F},F.status==="failed"||F.status==="unknown")f.extensionManager.toast.add({severity:"error",summary:"Easy Media workflow",detail:F.error,life:8000})}}catch(J){if(!Z)console.error("[Easy Media] Workflow submission bridge:",J);Z=!0}finally{if(!C)z=setTimeout(()=>{X()},Z?5000:1000)}}return z=setTimeout(()=>{X()},1000),()=>{if(C=!0,z)clearTimeout(z)}}var v=Ff(Jf(),1);var Mf="easy multitrackProject",H="easy-media-sampling-preview",h=8,K=280,b=K-h;function Nf(f,m){let C=!1,z=!1,V=0,Z=null,N=null,X=null,J=null,F=document.createElement("div");F.classList.add("comfyui-react-widget",T),F.hidden=!0,Object.assign(F.style,{width:"100%",height:`${K}px`,maxHeight:`${K}px`,overflow:"hidden",position:"relative",pointerEvents:"none"});let Q=f.addDOMWidget(H,H,F,{getMinHeight:()=>C?K:h,getMaxHeight:()=>C?K:h,hideOnZoom:!1,margin:0,serialize:!1});Q.hidden=!1;let $=()=>{let M=F.parentElement;if(!M)return;if(M!==J)X?.disconnect(),J=M,X=new MutationObserver($),X.observe(M,{attributes:!0,attributeFilter:["style"]}),N?.disconnect(),N=null;let c=C?K:h,j=C?"auto":"none";if(M.style.maxHeight!==`${c}px`)M.style.maxHeight=`${c}px`;if(M.style.overflow!=="hidden")M.style.overflow="hidden";if(M.style.pointerEvents!==j)M.style.pointerEvents=j};if(N=new MutationObserver($),document.body)N.observe(document.body,{childList:!0,subtree:!0});globalThis.requestAnimationFrame?.($);let B=(M)=>{if(C===M)return;if(C=M,F.hidden=!C,F.style.pointerEvents=C?"auto":"none",delete Q.computedHeight,f.size&&f.setSize){if(C&&!z)f.setSize([f.size[0],f.size[1]+b]),z=!0;else if(!C&&z)f.setSize([f.size[0],Math.max(h,f.size[1]-b)]),z=!1}f.onResize?.(f.size),f.graph?.setDirtyCanvas?.(!0,!0),globalThis.requestAnimationFrame?.($)},U=()=>Z?.render(E(t,{app:m,nodeId:()=>f.id,executionRevision:V,onVisibilityChange:B}));return Z=v.createRoot(F),U(),{reset:()=>{V+=1,U()},cleanup:()=>{N?.disconnect(),X?.disconnect(),Z?.unmount(),F.remove(),Z=null}}}function l(f,m,C){if(m.name!==Mf)return;let z=f.prototype,V=z.onNodeCreated,Z=z.onExecutionStart,N=z.onRemoved;z.onNodeCreated=function(...J){V?.apply(this,J);let F=Nf(this,C);this.easyMediaSamplingPreviewCleanup=F.cleanup,this.easyMediaSamplingPreviewReset=F.reset},z.onExecutionStart=function(...J){this.easyMediaSamplingPreviewReset?.(),Z?.apply(this,J)},z.onRemoved=function(...J){this.easyMediaSamplingPreviewCleanup?.(),delete this.easyMediaSamplingPreviewCleanup,delete this.easyMediaSamplingPreviewReset,N?.apply(this,J)}}var[{createReactWidget:x},{TimelineWidget:Qf,MultiTrackWidget:Xf,MultiImagesLoaderWidget:$f,CompareVideoWidget:Kf,PromptEnhancerAccountWidget:xf,ProjectVideoCombineWidget:Bf},{createDefaultTimelineData:Uf},{createDefaultTrackData:hf}]=await Promise.all([import("./chunks/create-react-widget-5z94rw5h.js"),import("./chunks/index-ymfyx447.js"),import("./chunks/timeline-utils-c6x7npad.js"),import("./chunks/multitrack-utils-4cdm46fs.js")]),kf=JSON.stringify(Uf()),Of=JSON.stringify(hf()),qf=JSON.stringify({save_output:!0,filename_prefix:"ComfyUI",watch_output_history:!1}),k=globalThis.comfyAPI.app.app,Wf="2026-09-27.2";k.registerExtension({name:"Comfy.EasyMedia.widgets",async setup(){console.info(`[Moxie Multimedia Suite] editor bundle ${Wf}`),_(k),g(`/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */ @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial;--tw-content:"";--tw-space-x-reverse:0;--tw-animation-delay:0s;--tw-animation-direction:normal;--tw-animation-duration:initial;--tw-animation-fill-mode:none;--tw-animation-iteration-count:1;--tw-enter-blur:0;--tw-enter-opacity:1;--tw-enter-rotate:0;--tw-enter-scale:1;--tw-enter-translate-x:0;--tw-enter-translate-y:0;--tw-exit-blur:0;--tw-exit-opacity:1;--tw-exit-rotate:0;--tw-exit-scale:1;--tw-exit-translate-x:0;--tw-exit-translate-y:0}}}.mmnode{--font-sans:var(--font-sans);--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-400:oklch(70.4% .191 22.216);--color-yellow-200:oklch(94.5% .129 101.54);--color-yellow-300:oklch(90.5% .182 98.111);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-xs:20rem;--container-md:28rem;--container-lg:32rem;--container-xl:36rem;--container-2xl:42rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height:calc(1.5 / 1);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tight:-.025em;--tracking-widest:.1em;--leading-tight:1.25;--leading-snug:1.375;--leading-normal:1.5;--leading-relaxed:1.625;--radius-2xl:1rem;--radius-3xl:1.5rem;--ease-out:cubic-bezier(0, 0, .2, 1);--ease-in-out:cubic-bezier(.4, 0, .2, 1);--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--blur-sm:8px;--aspect-video:16 / 9;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--font-heading:var(--font-heading);--shadow-8:var(--shadow-8);--shadow-7:var(--shadow-7);--shadow-6:var(--shadow-6);--shadow-5:var(--shadow-5);--shadow-4:var(--shadow-4);--shadow-3:var(--shadow-3);--shadow-2:var(--shadow-2);--shadow-1:var(--shadow-1)}.mmnode .\\@container\\/compare-video-controls{container:compare-video-controls/inline-size}.mmnode .pointer-events-auto{pointer-events:auto}.mmnode .pointer-events-none{pointer-events:none}.mmnode .\\!visible{visibility:visible!important}.mmnode .collapse{visibility:collapse}.mmnode .invisible{visibility:hidden}.mmnode .visible{visibility:visible}.mmnode .sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.mmnode .absolute{position:absolute}.mmnode .fixed{position:fixed}.mmnode .relative{position:relative}.mmnode .sticky{position:sticky}.mmnode .inset-0{inset:calc(var(--spacing) * 0)}.mmnode .inset-x-0{inset-inline:calc(var(--spacing) * 0)}.mmnode .inset-y-0{inset-block:calc(var(--spacing) * 0)}.mmnode .-top-2{top:calc(var(--spacing) * -2)}.mmnode .-top-12{top:calc(var(--spacing) * -12)}.mmnode .top-0{top:calc(var(--spacing) * 0)}.mmnode .top-0\\.5{top:calc(var(--spacing) * .5)}.mmnode .top-1{top:calc(var(--spacing) * 1)}.mmnode .top-1\\/2{top:50%}.mmnode .top-2{top:calc(var(--spacing) * 2)}.mmnode .top-3{top:calc(var(--spacing) * 3)}.mmnode .top-4{top:calc(var(--spacing) * 4)}.mmnode .top-\\[50\\%\\]{top:50%}.mmnode .top-full{top:100%}.mmnode .-right-12{right:calc(var(--spacing) * -12)}.mmnode .right-0{right:calc(var(--spacing) * 0)}.mmnode .right-0\\.5{right:calc(var(--spacing) * .5)}.mmnode .right-1{right:calc(var(--spacing) * 1)}.mmnode .right-2{right:calc(var(--spacing) * 2)}.mmnode .right-3{right:calc(var(--spacing) * 3)}.mmnode .right-4{right:calc(var(--spacing) * 4)}.mmnode .right-8{right:calc(var(--spacing) * 8)}.mmnode .right-auto{right:auto}.mmnode .-bottom-12{bottom:calc(var(--spacing) * -12)}.mmnode .bottom-0{bottom:calc(var(--spacing) * 0)}.mmnode .bottom-1{bottom:calc(var(--spacing) * 1)}.mmnode .bottom-2{bottom:calc(var(--spacing) * 2)}.mmnode .-left-2{left:calc(var(--spacing) * -2)}.mmnode .-left-12{left:calc(var(--spacing) * -12)}.mmnode .left-0{left:calc(var(--spacing) * 0)}.mmnode .left-1{left:calc(var(--spacing) * 1)}.mmnode .left-1\\.5{left:calc(var(--spacing) * 1.5)}.mmnode .left-1\\/2{left:50%}.mmnode .left-2{left:calc(var(--spacing) * 2)}.mmnode .left-3{left:calc(var(--spacing) * 3)}.mmnode .left-6{left:calc(var(--spacing) * 6)}.mmnode .left-8{left:calc(var(--spacing) * 8)}.mmnode .left-\\[50\\%\\]{left:50%}.mmnode .z-1{z-index:1}.mmnode .z-10{z-index:10}.mmnode .z-20{z-index:20}.mmnode .z-30{z-index:30}.mmnode .z-40{z-index:40}.mmnode .z-50{z-index:50}.mmnode .z-\\[5\\]{z-index:5}.mmnode .z-\\[60\\]{z-index:60}.mmnode .z-\\[9997\\]{z-index:9997}.mmnode .z-\\[9999\\]{z-index:9999}.mmnode .z-\\[10000\\]{z-index:10000}.mmnode .container{width:100%}@media (min-width:40rem){.mmnode .container{max-width:40rem}}@media (min-width:48rem){.mmnode .container{max-width:48rem}}@media (min-width:64rem){.mmnode .container{max-width:64rem}}@media (min-width:80rem){.mmnode .container{max-width:80rem}}@media (min-width:96rem){.mmnode .container{max-width:96rem}}.mmnode .m-auto{margin:auto}.mmnode .-mx-1{margin-inline:calc(var(--spacing) * -1)}.mmnode .mx-1{margin-inline:calc(var(--spacing) * 1)}.mmnode .mx-2{margin-inline:calc(var(--spacing) * 2)}.mmnode .mx-3{margin-inline:calc(var(--spacing) * 3)}.mmnode .mx-auto{margin-inline:auto}.mmnode .my-1{margin-block:calc(var(--spacing) * 1)}.mmnode .-mt-4{margin-top:calc(var(--spacing) * -4)}.mmnode .mt-0{margin-top:calc(var(--spacing) * 0)}.mmnode .mt-0\\.5{margin-top:calc(var(--spacing) * .5)}.mmnode .mt-1{margin-top:calc(var(--spacing) * 1)}.mmnode .mt-2{margin-top:calc(var(--spacing) * 2)}.mmnode .mt-3{margin-top:calc(var(--spacing) * 3)}.mmnode .mt-4{margin-top:calc(var(--spacing) * 4)}.mmnode .mr-1{margin-right:calc(var(--spacing) * 1)}.mmnode .mr-2{margin-right:calc(var(--spacing) * 2)}.mmnode .mb-2{margin-bottom:calc(var(--spacing) * 2)}.mmnode .-ml-4{margin-left:calc(var(--spacing) * -4)}.mmnode .ml-1{margin-left:calc(var(--spacing) * 1)}.mmnode .ml-auto{margin-left:auto}.mmnode .no-scrollbar{-ms-overflow-style:none;scrollbar-width:none}.mmnode .no-scrollbar::-webkit-scrollbar{display:none}.mmnode .line-clamp-3{-webkit-line-clamp:3;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.mmnode .block{display:block}.mmnode .contents{display:contents}.mmnode .flex{display:flex}.mmnode .grid{display:grid}.mmnode .hidden{display:none}.mmnode .inline{display:inline}.mmnode .inline-block{display:inline-block}.mmnode .inline-flex{display:inline-flex}.mmnode .aspect-square{aspect-ratio:1}.mmnode .aspect-video{aspect-ratio:var(--aspect-video)}.mmnode .size-1{width:calc(var(--spacing) * 1);height:calc(var(--spacing) * 1)}.mmnode .size-2\\.5{width:calc(var(--spacing) * 2.5);height:calc(var(--spacing) * 2.5)}.mmnode .size-3{width:calc(var(--spacing) * 3);height:calc(var(--spacing) * 3)}.mmnode .size-3\\.5{width:calc(var(--spacing) * 3.5);height:calc(var(--spacing) * 3.5)}.mmnode .size-4{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.mmnode .size-7{width:calc(var(--spacing) * 7);height:calc(var(--spacing) * 7)}.mmnode .size-12{width:calc(var(--spacing) * 12);height:calc(var(--spacing) * 12)}.mmnode .h-0{height:calc(var(--spacing) * 0)}.mmnode .h-0\\.5{height:calc(var(--spacing) * .5)}.mmnode .h-1\\.5{height:calc(var(--spacing) * 1.5)}.mmnode .h-2{height:calc(var(--spacing) * 2)}.mmnode .h-2\\.5{height:calc(var(--spacing) * 2.5)}.mmnode .h-3{height:calc(var(--spacing) * 3)}.mmnode .h-3\\.5{height:calc(var(--spacing) * 3.5)}.mmnode .h-4{height:calc(var(--spacing) * 4)}.mmnode .h-5{height:calc(var(--spacing) * 5)}.mmnode .h-6{height:calc(var(--spacing) * 6)}.mmnode .h-7{height:calc(var(--spacing) * 7)}.mmnode .h-8{height:calc(var(--spacing) * 8)}.mmnode .h-9{height:calc(var(--spacing) * 9)}.mmnode .h-10{height:calc(var(--spacing) * 10)}.mmnode .h-11{height:calc(var(--spacing) * 11)}.mmnode .h-12{height:calc(var(--spacing) * 12)}.mmnode .h-14{height:calc(var(--spacing) * 14)}.mmnode .h-16{height:calc(var(--spacing) * 16)}.mmnode .h-20{height:calc(var(--spacing) * 20)}.mmnode .h-24{height:calc(var(--spacing) * 24)}.mmnode .h-30{height:calc(var(--spacing) * 30)}.mmnode .h-40{height:calc(var(--spacing) * 40)}.mmnode .h-64{height:calc(var(--spacing) * 64)}.mmnode .h-80{height:calc(var(--spacing) * 80)}.mmnode .h-\\[1\\.6em\\]{height:1.6em}.mmnode .h-\\[30px\\]{height:30px}.mmnode .h-\\[104px\\]{height:104px}.mmnode .h-\\[300px\\]{height:300px}.mmnode .h-\\[var\\(--radix-select-trigger-height\\)\\]{height:var(--radix-select-trigger-height)}.mmnode .h-auto{height:auto}.mmnode .h-full{height:100%}.mmnode .h-px{height:1px}.mmnode .max-h-3{max-height:calc(var(--spacing) * 3)}.mmnode .max-h-6{max-height:calc(var(--spacing) * 6)}.mmnode .max-h-52{max-height:calc(var(--spacing) * 52)}.mmnode .max-h-\\[--radix-context-menu-content-available-height\\]{max-height:--radix-context-menu-content-available-height}.mmnode .max-h-\\[--radix-select-content-available-height\\]{max-height:--radix-select-content-available-height}.mmnode .max-h-full{max-height:100%}.mmnode .min-h-0{min-height:calc(var(--spacing) * 0)}.mmnode .min-h-3{min-height:calc(var(--spacing) * 3)}.mmnode .min-h-6{min-height:calc(var(--spacing) * 6)}.mmnode .min-h-9{min-height:calc(var(--spacing) * 9)}.mmnode .min-h-20{min-height:calc(var(--spacing) * 20)}.mmnode .min-h-24{min-height:calc(var(--spacing) * 24)}.mmnode .min-h-\\[60px\\]{min-height:60px}.mmnode .min-h-\\[320px\\]{min-height:320px}.mmnode .min-h-\\[520px\\]{min-height:520px}.mmnode .min-h-full{min-height:100%}.mmnode .w-0{width:calc(var(--spacing) * 0)}.mmnode .w-0\\.5{width:calc(var(--spacing) * .5)}.mmnode .w-1{width:calc(var(--spacing) * 1)}.mmnode .w-1\\/2{width:50%}.mmnode .w-2{width:calc(var(--spacing) * 2)}.mmnode .w-2\\.5{width:calc(var(--spacing) * 2.5)}.mmnode .w-3{width:calc(var(--spacing) * 3)}.mmnode .w-3\\.5{width:calc(var(--spacing) * 3.5)}.mmnode .w-3\\/4{width:75%}.mmnode .w-4{width:calc(var(--spacing) * 4)}.mmnode .w-5{width:calc(var(--spacing) * 5)}.mmnode .w-6{width:calc(var(--spacing) * 6)}.mmnode .w-7{width:calc(var(--spacing) * 7)}.mmnode .w-8{width:calc(var(--spacing) * 8)}.mmnode .w-9{width:calc(var(--spacing) * 9)}.mmnode .w-10{width:calc(var(--spacing) * 10)}.mmnode .w-12{width:calc(var(--spacing) * 12)}.mmnode .w-14{width:calc(var(--spacing) * 14)}.mmnode .w-16{width:calc(var(--spacing) * 16)}.mmnode .w-18{width:calc(var(--spacing) * 18)}.mmnode .w-20{width:calc(var(--spacing) * 20)}.mmnode .w-24{width:calc(var(--spacing) * 24)}.mmnode .w-28{width:calc(var(--spacing) * 28)}.mmnode .w-32{width:calc(var(--spacing) * 32)}.mmnode .w-40{width:calc(var(--spacing) * 40)}.mmnode .w-44{width:calc(var(--spacing) * 44)}.mmnode .w-56{width:calc(var(--spacing) * 56)}.mmnode .w-64{width:calc(var(--spacing) * 64)}.mmnode .w-72{width:calc(var(--spacing) * 72)}.mmnode .w-80{width:calc(var(--spacing) * 80)}.mmnode .w-\\[35\\%\\]{width:35%}.mmnode .w-auto{width:auto}.mmnode .w-fit{width:fit-content}.mmnode .w-full{width:100%}.mmnode .w-max{width:max-content}.mmnode .w-px{width:1px}.mmnode .max-w-2xl{max-width:var(--container-2xl)}.mmnode .max-w-20{max-width:calc(var(--spacing) * 20)}.mmnode .max-w-24{max-width:calc(var(--spacing) * 24)}.mmnode .max-w-36{max-width:calc(var(--spacing) * 36)}.mmnode .max-w-48{max-width:calc(var(--spacing) * 48)}.mmnode .max-w-64{max-width:calc(var(--spacing) * 64)}.mmnode .max-w-72{max-width:calc(var(--spacing) * 72)}.mmnode .max-w-full{max-width:100%}.mmnode .max-w-lg{max-width:var(--container-lg)}.mmnode .max-w-md{max-width:var(--container-md)}.mmnode .max-w-none{max-width:none}.mmnode .max-w-xl{max-width:var(--container-xl)}.mmnode .max-w-xs{max-width:var(--container-xs)}.mmnode .min-w-0{min-width:calc(var(--spacing) * 0)}.mmnode .min-w-5{min-width:calc(var(--spacing) * 5)}.mmnode .min-w-6{min-width:calc(var(--spacing) * 6)}.mmnode .min-w-7{min-width:calc(var(--spacing) * 7)}.mmnode .min-w-24{min-width:calc(var(--spacing) * 24)}.mmnode .min-w-72{min-width:calc(var(--spacing) * 72)}.mmnode .min-w-\\[8rem\\]{min-width:8rem}.mmnode .min-w-\\[var\\(--anchor-width\\)\\]{min-width:var(--anchor-width)}.mmnode .min-w-\\[var\\(--radix-select-trigger-width\\)\\]{min-width:var(--radix-select-trigger-width)}.mmnode .flex-1{flex:1}.mmnode .flex-\\[0_0_5rem\\]{flex:0 0 5rem}.mmnode .flex-\\[0_0_8rem\\]{flex:0 0 8rem}.mmnode .flex-\\[1_1_100\\%\\]{flex:100%}.mmnode .flex-none{flex:none}.mmnode .shrink-0{flex-shrink:0}.mmnode .flex-grow,.mmnode .grow{flex-grow:1}.mmnode .grow-0{flex-grow:0}.mmnode .basis-full{flex-basis:100%}.mmnode .origin-\\[--radix-context-menu-content-transform-origin\\]{transform-origin:--radix-context-menu-content-transform-origin}.mmnode .origin-\\[--radix-popover-content-transform-origin\\]{transform-origin:--radix-popover-content-transform-origin}.mmnode .origin-\\[--radix-select-content-transform-origin\\]{transform-origin:--radix-select-content-transform-origin}.mmnode .origin-\\[--radix-tooltip-content-transform-origin\\]{transform-origin:--radix-tooltip-content-transform-origin}.mmnode .-translate-x-1\\/2{--tw-translate-x:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.mmnode .translate-x-1{--tw-translate-x:calc(var(--spacing) * 1);translate:var(--tw-translate-x) var(--tw-translate-y)}.mmnode .translate-x-\\[-50\\%\\]{--tw-translate-x:-50%;translate:var(--tw-translate-x) var(--tw-translate-y)}.mmnode .-translate-y-1\\/2{--tw-translate-y:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.mmnode .translate-y-\\[-50\\%\\]{--tw-translate-y:-50%;translate:var(--tw-translate-x) var(--tw-translate-y)}.mmnode .translate-y-full{--tw-translate-y:100%;translate:var(--tw-translate-x) var(--tw-translate-y)}.mmnode .-rotate-12{rotate:-12deg}.mmnode .rotate-3{rotate:3deg}.mmnode .rotate-6{rotate:6deg}.mmnode .rotate-90{rotate:90deg}.mmnode .rotate-180{rotate:180deg}.mmnode .transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.mmnode .animate-in{animation:enter var(--tw-animation-duration,var(--tw-duration,.15s))var(--tw-ease,ease)var(--tw-animation-delay,0s)var(--tw-animation-iteration-count,1)var(--tw-animation-direction,normal)var(--tw-animation-fill-mode,none)}.mmnode .animate-pulse{animation:var(--animate-pulse)}.mmnode .animate-spin{animation:var(--animate-spin)}.mmnode .cursor-col-resize{cursor:col-resize}.mmnode .cursor-default{cursor:default}.mmnode .cursor-ew-resize{cursor:ew-resize}.mmnode .cursor-grab{cursor:grab}.mmnode .cursor-grabbing{cursor:grabbing}.mmnode .cursor-move{cursor:move}.mmnode .cursor-none{cursor:none}.mmnode .cursor-not-allowed{cursor:not-allowed}.mmnode .cursor-pointer{cursor:pointer}.mmnode .touch-none{touch-action:none}.mmnode .resize{resize:both}.mmnode .resize-none{resize:none}.mmnode .\\[appearance\\:textfield\\]{appearance:textfield}.mmnode .auto-rows-max{grid-auto-rows:max-content}.mmnode .grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.mmnode .grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.mmnode .grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.mmnode .grid-cols-7{grid-template-columns:repeat(7,minmax(0,1fr))}.mmnode .grid-cols-\\[1fr_auto_1fr\\]{grid-template-columns:1fr auto 1fr}.mmnode .grid-cols-\\[3rem_minmax\\(0\\,1fr\\)\\]{grid-template-columns:3rem minmax(0,1fr)}.mmnode .grid-cols-\\[3rem_repeat\\(3\\,minmax\\(0\\,1fr\\)\\)\\]{grid-template-columns:3rem repeat(3,minmax(0,1fr))}.mmnode .grid-cols-\\[4\\.25rem_minmax\\(0\\,1fr\\)\\]{grid-template-columns:4.25rem minmax(0,1fr)}.mmnode .grid-cols-\\[auto_1fr\\]{grid-template-columns:auto 1fr}.mmnode .grid-cols-\\[auto_minmax\\(0\\,1fr\\)_auto\\]{grid-template-columns:auto minmax(0,1fr) auto}.mmnode .grid-cols-\\[auto_minmax\\(4rem\\,1fr\\)_auto\\]{grid-template-columns:auto minmax(4rem,1fr) auto}.mmnode .grid-rows-\\[0fr\\]{grid-template-rows:0fr}.mmnode .grid-rows-\\[1fr\\]{grid-template-rows:1fr}.mmnode .flex-col{flex-direction:column}.mmnode .flex-col-reverse{flex-direction:column-reverse}.mmnode .flex-row{flex-direction:row}.mmnode .flex-wrap{flex-wrap:wrap}.mmnode .place-content-center{place-content:center}.mmnode .content-center{align-content:center}.mmnode .content-start{align-content:flex-start}.mmnode .items-baseline{align-items:baseline}.mmnode .items-center{align-items:center}.mmnode .items-end{align-items:flex-end}.mmnode .items-start{align-items:flex-start}.mmnode .items-stretch{align-items:stretch}.mmnode .justify-between{justify-content:space-between}.mmnode .justify-center{justify-content:center}.mmnode .justify-end{justify-content:flex-end}.mmnode .justify-start{justify-content:flex-start}.mmnode .gap-0{gap:calc(var(--spacing) * 0)}.mmnode .gap-0\\.5{gap:calc(var(--spacing) * .5)}.mmnode .gap-1{gap:calc(var(--spacing) * 1)}.mmnode .gap-1\\.5{gap:calc(var(--spacing) * 1.5)}.mmnode .gap-2{gap:calc(var(--spacing) * 2)}.mmnode .gap-3{gap:calc(var(--spacing) * 3)}.mmnode .gap-4{gap:calc(var(--spacing) * 4)}.mmnode .gap-5{gap:calc(var(--spacing) * 5)}.mmnode .gap-px{gap:1px}:where(.mmnode .space-y-0\\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * .5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * .5) * calc(1 - var(--tw-space-y-reverse)))}:where(.mmnode .space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1) * calc(1 - var(--tw-space-y-reverse)))}:where(.mmnode .space-y-1\\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.mmnode .space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.mmnode .space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.mmnode .space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}.mmnode .gap-x-3{column-gap:calc(var(--spacing) * 3)}.mmnode .gap-y-1\\.5{row-gap:calc(var(--spacing) * 1.5)}.mmnode .self-center{align-self:center}.mmnode .self-start{align-self:flex-start}.mmnode .self-stretch{align-self:stretch}.mmnode .truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.mmnode .overflow-auto{overflow:auto}.mmnode .overflow-hidden{overflow:hidden}.mmnode .overflow-visible{overflow:visible}.mmnode .overflow-x-auto{overflow-x:auto}.mmnode .overflow-x-clip{overflow-x:clip}.mmnode .overflow-x-hidden{overflow-x:hidden}.mmnode .overflow-y-auto{overflow-y:auto}.mmnode .overflow-y-hidden{overflow-y:hidden}.mmnode .overflow-y-visible{overflow-y:visible}.mmnode .rounded{border-radius:.25rem}.mmnode .rounded-2xl{border-radius:var(--radius-2xl)}.mmnode .rounded-3xl{border-radius:var(--radius-3xl)}.mmnode .rounded-\\[10px\\]{border-radius:10px}.mmnode .rounded-\\[20px\\]{border-radius:20px}.mmnode .rounded-\\[22px\\]{border-radius:22px}.mmnode .rounded-full{border-radius:3.40282e38px}.mmnode .rounded-lg{border-radius:var(--radius)}.mmnode .rounded-md{border-radius:calc(var(--radius) - 2px)}.mmnode .rounded-none{border-radius:0}.mmnode .rounded-sm{border-radius:calc(var(--radius) - 4px)}.mmnode .rounded-xl{border-radius:calc(var(--radius) + 4px)}.mmnode .rounded-t-md{border-top-left-radius:calc(var(--radius) - 2px);border-top-right-radius:calc(var(--radius) - 2px)}.mmnode .border{border-style:var(--tw-border-style);border-width:1px}.mmnode .border-0{border-style:var(--tw-border-style);border-width:0}.mmnode .border-2{border-style:var(--tw-border-style);border-width:2px}.mmnode .border-y{border-block-style:var(--tw-border-style);border-block-width:1px}.mmnode .border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.mmnode .border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.mmnode .border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.mmnode .border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.mmnode .border-dashed{--tw-border-style:dashed;border-style:dashed}.mmnode .border-none{--tw-border-style:none;border-style:none}.mmnode .border-border,.mmnode .border-border\\/50{border-color:var(--border)}@supports (color:color-mix(in lab, red, red)){.mmnode .border-border\\/50{border-color:color-mix(in oklab, var(--border) 50%, transparent)}}.mmnode .border-highlight{border-color:var(--highlight)}.mmnode .border-input{border-color:var(--input)}.mmnode .border-muted-foreground\\/50{border-color:var(--muted-foreground)}@supports (color:color-mix(in lab, red, red)){.mmnode .border-muted-foreground\\/50{border-color:color-mix(in oklab, var(--muted-foreground) 50%, transparent)}}.mmnode .border-primary,.mmnode .border-primary\\/50{border-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.mmnode .border-primary\\/50{border-color:color-mix(in oklab, var(--primary) 50%, transparent)}}.mmnode .border-transparent{border-color:#0000}.mmnode .bg-\\[\\#34d399\\]{background-color:#34d399}.mmnode .bg-accent,.mmnode .bg-accent\\/20{background-color:var(--accent)}@supports (color:color-mix(in lab, red, red)){.mmnode .bg-accent\\/20{background-color:color-mix(in oklab, var(--accent) 20%, transparent)}}.mmnode .bg-background,.mmnode .bg-background\\/60{background-color:var(--background)}@supports (color:color-mix(in lab, red, red)){.mmnode .bg-background\\/60{background-color:color-mix(in oklab, var(--background) 60%, transparent)}}.mmnode .bg-background\\/70{background-color:var(--background)}@supports (color:color-mix(in lab, red, red)){.mmnode .bg-background\\/70{background-color:color-mix(in oklab, var(--background) 70%, transparent)}}.mmnode .bg-background\\/80{background-color:var(--background)}@supports (color:color-mix(in lab, red, red)){.mmnode .bg-background\\/80{background-color:color-mix(in oklab, var(--background) 80%, transparent)}}.mmnode .bg-background\\/90{background-color:var(--background)}@supports (color:color-mix(in lab, red, red)){.mmnode .bg-background\\/90{background-color:color-mix(in oklab, var(--background) 90%, transparent)}}.mmnode .bg-background\\/95{background-color:var(--background)}@supports (color:color-mix(in lab, red, red)){.mmnode .bg-background\\/95{background-color:color-mix(in oklab, var(--background) 95%, transparent)}}.mmnode .bg-black{background-color:var(--color-black)}.mmnode .bg-black\\/30{background-color:#0000004d}@supports (color:color-mix(in lab, red, red)){.mmnode .bg-black\\/30{background-color:color-mix(in oklab, var(--color-black) 30%, transparent)}}.mmnode .bg-black\\/50{background-color:#00000080}@supports (color:color-mix(in lab, red, red)){.mmnode .bg-black\\/50{background-color:color-mix(in oklab, var(--color-black) 50%, transparent)}}.mmnode .bg-black\\/60{background-color:#0009}@supports (color:color-mix(in lab, red, red)){.mmnode .bg-black\\/60{background-color:color-mix(in oklab, var(--color-black) 60%, transparent)}}.mmnode .bg-black\\/70{background-color:#000000b3}@supports (color:color-mix(in lab, red, red)){.mmnode .bg-black\\/70{background-color:color-mix(in oklab, var(--color-black) 70%, transparent)}}.mmnode .bg-black\\/80{background-color:#000c}@supports (color:color-mix(in lab, red, red)){.mmnode .bg-black\\/80{background-color:color-mix(in oklab, var(--color-black) 80%, transparent)}}.mmnode .bg-border{background-color:var(--border)}.mmnode .bg-card{background-color:var(--card)}.mmnode .bg-destructive{background-color:var(--destructive)}.mmnode .bg-foreground,.mmnode .bg-foreground\\/60{background-color:var(--foreground)}@supports (color:color-mix(in lab, red, red)){.mmnode .bg-foreground\\/60{background-color:color-mix(in oklab, var(--foreground) 60%, transparent)}}.mmnode .bg-highlight{background-color:var(--highlight)}.mmnode .bg-muted{background-color:var(--muted)}.mmnode .bg-muted-foreground\\/40{background-color:var(--muted-foreground)}@supports (color:color-mix(in lab, red, red)){.mmnode .bg-muted-foreground\\/40{background-color:color-mix(in oklab, var(--muted-foreground) 40%, transparent)}}.mmnode .bg-muted\\/20{background-color:var(--muted)}@supports (color:color-mix(in lab, red, red)){.mmnode .bg-muted\\/20{background-color:color-mix(in oklab, var(--muted) 20%, transparent)}}.mmnode .bg-muted\\/30{background-color:var(--muted)}@supports (color:color-mix(in lab, red, red)){.mmnode .bg-muted\\/30{background-color:color-mix(in oklab, var(--muted) 30%, transparent)}}.mmnode .bg-muted\\/40{background-color:var(--muted)}@supports (color:color-mix(in lab, red, red)){.mmnode .bg-muted\\/40{background-color:color-mix(in oklab, var(--muted) 40%, transparent)}}.mmnode .bg-muted\\/60{background-color:var(--muted)}@supports (color:color-mix(in lab, red, red)){.mmnode .bg-muted\\/60{background-color:color-mix(in oklab, var(--muted) 60%, transparent)}}.mmnode .bg-muted\\/80{background-color:var(--muted)}@supports (color:color-mix(in lab, red, red)){.mmnode .bg-muted\\/80{background-color:color-mix(in oklab, var(--muted) 80%, transparent)}}.mmnode .bg-popover,.mmnode .bg-popover\\/90{background-color:var(--popover)}@supports (color:color-mix(in lab, red, red)){.mmnode .bg-popover\\/90{background-color:color-mix(in oklab, var(--popover) 90%, transparent)}}.mmnode .bg-primary,.mmnode .bg-primary\\/10{background-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.mmnode .bg-primary\\/10{background-color:color-mix(in oklab, var(--primary) 10%, transparent)}}.mmnode .bg-primary\\/20{background-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.mmnode .bg-primary\\/20{background-color:color-mix(in oklab, var(--primary) 20%, transparent)}}.mmnode .bg-red-400{background-color:var(--color-red-400)}.mmnode .bg-secondary,.mmnode .bg-secondary\\/40{background-color:var(--secondary)}@supports (color:color-mix(in lab, red, red)){.mmnode .bg-secondary\\/40{background-color:color-mix(in oklab, var(--secondary) 40%, transparent)}}.mmnode .bg-transparent{background-color:#0000}.mmnode .bg-white{background-color:var(--color-white)}.mmnode .bg-yellow-300\\/80{background-color:#ffe02acc}@supports (color:color-mix(in lab, red, red)){.mmnode .bg-yellow-300\\/80{background-color:color-mix(in oklab, var(--color-yellow-300) 80%, transparent)}}.mmnode .fill-current{fill:currentColor}.mmnode .fill-primary-foreground{fill:var(--primary-foreground)}.mmnode .stroke-current{stroke:currentColor}.mmnode .object-contain{object-fit:contain}.mmnode .object-cover{object-fit:cover}.mmnode .p-0{padding:calc(var(--spacing) * 0)}.mmnode .p-0\\.5{padding:calc(var(--spacing) * .5)}.mmnode .p-1{padding:calc(var(--spacing) * 1)}.mmnode .p-2{padding:calc(var(--spacing) * 2)}.mmnode .p-3{padding:calc(var(--spacing) * 3)}.mmnode .p-4{padding:calc(var(--spacing) * 4)}.mmnode .p-6{padding:calc(var(--spacing) * 6)}.mmnode .px-0{padding-inline:calc(var(--spacing) * 0)}.mmnode .px-0\\.5{padding-inline:calc(var(--spacing) * .5)}.mmnode .px-1{padding-inline:calc(var(--spacing) * 1)}.mmnode .px-1\\.5{padding-inline:calc(var(--spacing) * 1.5)}.mmnode .px-2{padding-inline:calc(var(--spacing) * 2)}.mmnode .px-2\\.5{padding-inline:calc(var(--spacing) * 2.5)}.mmnode .px-3{padding-inline:calc(var(--spacing) * 3)}.mmnode .px-4{padding-inline:calc(var(--spacing) * 4)}.mmnode .px-5{padding-inline:calc(var(--spacing) * 5)}.mmnode .px-6{padding-inline:calc(var(--spacing) * 6)}.mmnode .px-8{padding-inline:calc(var(--spacing) * 8)}.mmnode .py-0{padding-block:calc(var(--spacing) * 0)}.mmnode .py-0\\.5{padding-block:calc(var(--spacing) * .5)}.mmnode .py-1{padding-block:calc(var(--spacing) * 1)}.mmnode .py-1\\.5{padding-block:calc(var(--spacing) * 1.5)}.mmnode .py-2{padding-block:calc(var(--spacing) * 2)}.mmnode .py-5{padding-block:calc(var(--spacing) * 5)}.mmnode .py-px{padding-block:1px}.mmnode .pt-1{padding-top:calc(var(--spacing) * 1)}.mmnode .pt-1\\.5{padding-top:calc(var(--spacing) * 1.5)}.mmnode .pt-2{padding-top:calc(var(--spacing) * 2)}.mmnode .pt-3{padding-top:calc(var(--spacing) * 3)}.mmnode .pt-4{padding-top:calc(var(--spacing) * 4)}.mmnode .pt-12{padding-top:calc(var(--spacing) * 12)}.mmnode .pr-1{padding-right:calc(var(--spacing) * 1)}.mmnode .pr-2{padding-right:calc(var(--spacing) * 2)}.mmnode .pr-8{padding-right:calc(var(--spacing) * 8)}.mmnode .pb-0\\.5{padding-bottom:calc(var(--spacing) * .5)}.mmnode .pb-1{padding-bottom:calc(var(--spacing) * 1)}.mmnode .pb-2{padding-bottom:calc(var(--spacing) * 2)}.mmnode .pb-4{padding-bottom:calc(var(--spacing) * 4)}.mmnode .pb-7{padding-bottom:calc(var(--spacing) * 7)}.mmnode .pl-1{padding-left:calc(var(--spacing) * 1)}.mmnode .pl-2{padding-left:calc(var(--spacing) * 2)}.mmnode .pl-4{padding-left:calc(var(--spacing) * 4)}.mmnode .pl-6{padding-left:calc(var(--spacing) * 6)}.mmnode .pl-8{padding-left:calc(var(--spacing) * 8)}.mmnode .text-center{text-align:center}.mmnode .text-left{text-align:left}.mmnode .text-right{text-align:right}.mmnode .align-middle{vertical-align:middle}.mmnode .font-mono{font-family:var(--font-mono)}.mmnode .font-sans{font-family:var(--font-sans)}.mmnode .text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.mmnode .text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.mmnode .text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.mmnode .text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.mmnode .text-\\[8px\\]{font-size:8px}.mmnode .text-\\[9px\\]{font-size:9px}.mmnode .text-\\[10px\\]{font-size:10px}.mmnode .text-\\[11px\\]{font-size:11px}.mmnode .text-\\[12px\\]{font-size:12px}.mmnode .text-\\[13px\\]{font-size:13px}.mmnode .text-\\[14px\\]{font-size:14px}.mmnode .leading-4{--tw-leading:calc(var(--spacing) * 4);line-height:calc(var(--spacing) * 4)}.mmnode .leading-5{--tw-leading:calc(var(--spacing) * 5);line-height:calc(var(--spacing) * 5)}.mmnode .leading-none{--tw-leading:1;line-height:1}.mmnode .leading-normal{--tw-leading:var(--leading-normal);line-height:var(--leading-normal)}.mmnode .leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.mmnode .leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.mmnode .leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.mmnode .font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.mmnode .font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.mmnode .font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.mmnode .font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.mmnode .tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.mmnode .tracking-widest{--tw-tracking:var(--tracking-widest);letter-spacing:var(--tracking-widest)}.mmnode .break-words,.mmnode .wrap-break-word{overflow-wrap:break-word}.mmnode .break-all{word-break:break-all}.mmnode .whitespace-normal{white-space:normal}.mmnode .whitespace-nowrap{white-space:nowrap}.mmnode .whitespace-pre-wrap{white-space:pre-wrap}.mmnode .text-accent-foreground{color:var(--accent-foreground)}.mmnode .text-background{color:var(--background)}.mmnode .text-card-foreground{color:var(--card-foreground)}.mmnode .text-current{color:currentColor}.mmnode .text-destructive{color:var(--destructive)}.mmnode .text-destructive-foreground{color:var(--destructive-foreground)}.mmnode .text-foreground{color:var(--foreground)}.mmnode .text-highlight{color:var(--highlight)}.mmnode .text-image-tile-foreground{color:var(--image-tile-foreground)}.mmnode .text-inherit{color:inherit}.mmnode .text-muted-foreground,.mmnode .text-muted-foreground\\/70{color:var(--muted-foreground)}@supports (color:color-mix(in lab, red, red)){.mmnode .text-muted-foreground\\/70{color:color-mix(in oklab, var(--muted-foreground) 70%, transparent)}}.mmnode .text-popover-foreground{color:var(--popover-foreground)}.mmnode .text-primary{color:var(--primary)}.mmnode .text-primary-foreground{color:var(--primary-foreground)}.mmnode .text-secondary{color:var(--secondary)}.mmnode .text-secondary-foreground{color:var(--secondary-foreground)}.mmnode .text-transparent{color:#0000}.mmnode .text-white{color:var(--color-white)}.mmnode .italic{font-style:italic}.mmnode .tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.mmnode .underline-offset-4{text-underline-offset:4px}.mmnode .caret-foreground{caret-color:var(--foreground)}.mmnode .accent-card{accent-color:var(--card)}.mmnode .opacity-0{opacity:0}.mmnode .opacity-40{opacity:.4}.mmnode .opacity-50{opacity:.5}.mmnode .opacity-60{opacity:.6}.mmnode .opacity-70{opacity:.7}.mmnode .opacity-80{opacity:.8}.mmnode .opacity-90{opacity:.9}.mmnode .opacity-100{opacity:1}.mmnode .shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.mmnode .shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.mmnode .shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.mmnode .shadow-none{--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.mmnode .shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.mmnode .ring,.mmnode .ring-1{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.mmnode .ring-2{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.mmnode .ring-primary{--tw-ring-color:var(--primary)}.mmnode .ring-offset-background{--tw-ring-offset-color:var(--background)}.mmnode .outline{outline-style:var(--tw-outline-style);outline-width:1px}.mmnode .blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.mmnode .drop-shadow{--tw-drop-shadow-size:drop-shadow(0 1px 2px var(--tw-drop-shadow-color,#0000001a)) drop-shadow(0 1px 1px var(--tw-drop-shadow-color,#0000000f));--tw-drop-shadow:drop-shadow(0 1px 2px #0000001a) drop-shadow(0 1px 1px #0000000f);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.mmnode .drop-shadow-\\[0_1px_1px_rgba\\(0\\,0\\,0\\,0\\.4\\)\\]{--tw-drop-shadow-size:drop-shadow(0 1px 1px var(--tw-drop-shadow-color,#0006));--tw-drop-shadow:var(--tw-drop-shadow-size);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.mmnode .filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.mmnode .backdrop-blur{--tw-backdrop-blur:blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.mmnode .backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.mmnode .transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.mmnode .transition-\\[grid-template-rows\\]{transition-property:grid-template-rows;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.mmnode .transition-\\[opacity\\,transform\\]{transition-property:opacity,transform;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.mmnode .transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.mmnode .transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.mmnode .transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.mmnode .transition-shadow{transition-property:box-shadow;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.mmnode .transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.mmnode .duration-80{--tw-duration:80ms;transition-duration:80ms}.mmnode .duration-100{--tw-duration:.1s;transition-duration:.1s}.mmnode .duration-150{--tw-duration:.15s;transition-duration:.15s}.mmnode .duration-200{--tw-duration:.2s;transition-duration:.2s}.mmnode .duration-300{--tw-duration:.3s;transition-duration:.3s}.mmnode .ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.mmnode .ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.mmnode .\\[contain\\:size_layout_paint\\]{contain:size layout paint}.mmnode .fade-in-0{--tw-enter-opacity:0}.mmnode .outline-none{--tw-outline-style:none;outline-style:none}.mmnode .select-none{-webkit-user-select:none;user-select:none}.mmnode .zoom-in-95{--tw-enter-scale:.95}.mmnode .\\[build\\:watch\\]{build:watch}.mmnode .paused{animation-play-state:paused}.mmnode .ring-inset{--tw-ring-inset:inset}.mmnode .running{animation-play-state:running}.mmnode .group-focus-within\\:pointer-events-auto:is(:where(.group):focus-within *){pointer-events:auto}.mmnode .group-focus-within\\:translate-y-0:is(:where(.group):focus-within *){--tw-translate-y:calc(var(--spacing) * 0);translate:var(--tw-translate-x) var(--tw-translate-y)}.mmnode .group-focus-within\\:opacity-100:is(:where(.group):focus-within *),.mmnode .group-focus-within\\/task-image\\:opacity-100:is(:where(.group\\/task-image):focus-within *){opacity:1}@media (hover:hover){.mmnode .group-hover\\:pointer-events-auto:is(:where(.group):hover *){pointer-events:auto}.mmnode .group-hover\\:translate-y-0:is(:where(.group):hover *){--tw-translate-y:calc(var(--spacing) * 0);translate:var(--tw-translate-x) var(--tw-translate-y)}.mmnode .group-hover\\:opacity-100:is(:where(.group):hover *),.mmnode .group-hover\\/task-image\\:opacity-100:is(:where(.group\\/task-image):hover *){opacity:1}}.mmnode .file\\:border-0::file-selector-button{border-style:var(--tw-border-style);border-width:0}.mmnode .file\\:bg-transparent::file-selector-button{background-color:#0000}.mmnode .file\\:text-sm::file-selector-button{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.mmnode .file\\:font-medium::file-selector-button{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.mmnode .file\\:text-foreground::file-selector-button{color:var(--foreground)}.mmnode .placeholder\\:text-muted-foreground::placeholder{color:var(--muted-foreground)}.mmnode .after\\:absolute:after{content:var(--tw-content);position:absolute}.mmnode .after\\:inset-y-0:after{content:var(--tw-content);inset-block:calc(var(--spacing) * 0)}.mmnode .after\\:left-1\\/2:after{content:var(--tw-content);left:50%}.mmnode .after\\:w-2:after{content:var(--tw-content);width:calc(var(--spacing) * 2)}.mmnode .after\\:-translate-x-1\\/2:after{content:var(--tw-content);--tw-translate-x:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.mmnode .last\\:border-b-0:last-child{border-bottom-style:var(--tw-border-style);border-bottom-width:0}.mmnode .empty\\:before\\:pointer-events-none:empty:before{content:var(--tw-content);pointer-events:none}.mmnode .empty\\:before\\:text-muted-foreground:empty:before{content:var(--tw-content);color:var(--muted-foreground)}.mmnode .empty\\:before\\:content-\\[attr\\(data-placeholder\\)\\]:empty:before{--tw-content:attr(data-placeholder);content:var(--tw-content)}.mmnode .focus-within\\:ring-1:focus-within{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.mmnode .focus-within\\:ring-\\[color\\:var\\(--highlight\\,\\#6B97FF\\)\\]:focus-within{--tw-ring-color:var(--highlight,#6b97ff)}@media (hover:hover){.mmnode .hover\\:bg-accent:hover,.mmnode .hover\\:bg-accent\\/20:hover{background-color:var(--accent)}@supports (color:color-mix(in lab, red, red)){.mmnode .hover\\:bg-accent\\/20:hover{background-color:color-mix(in oklab, var(--accent) 20%, transparent)}}.mmnode .hover\\:bg-background\\/90:hover{background-color:var(--background)}@supports (color:color-mix(in lab, red, red)){.mmnode .hover\\:bg-background\\/90:hover{background-color:color-mix(in oklab, var(--background) 90%, transparent)}}.mmnode .hover\\:bg-black:hover{background-color:var(--color-black)}.mmnode .hover\\:bg-card:hover{background-color:var(--card)}.mmnode .hover\\:bg-destructive\\/90:hover{background-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.mmnode .hover\\:bg-destructive\\/90:hover{background-color:color-mix(in oklab, var(--destructive) 90%, transparent)}}.mmnode .hover\\:bg-highlight\\/10:hover{background-color:var(--highlight)}@supports (color:color-mix(in lab, red, red)){.mmnode .hover\\:bg-highlight\\/10:hover{background-color:color-mix(in oklab, var(--highlight) 10%, transparent)}}.mmnode .hover\\:bg-highlight\\/90:hover{background-color:var(--highlight)}@supports (color:color-mix(in lab, red, red)){.mmnode .hover\\:bg-highlight\\/90:hover{background-color:color-mix(in oklab, var(--highlight) 90%, transparent)}}.mmnode .hover\\:bg-muted:hover,.mmnode .hover\\:bg-muted\\/90:hover{background-color:var(--muted)}@supports (color:color-mix(in lab, red, red)){.mmnode .hover\\:bg-muted\\/90:hover{background-color:color-mix(in oklab, var(--muted) 90%, transparent)}}.mmnode .hover\\:bg-primary\\/80:hover{background-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.mmnode .hover\\:bg-primary\\/80:hover{background-color:color-mix(in oklab, var(--primary) 80%, transparent)}}.mmnode .hover\\:bg-primary\\/90:hover{background-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.mmnode .hover\\:bg-primary\\/90:hover{background-color:color-mix(in oklab, var(--primary) 90%, transparent)}}.mmnode .hover\\:bg-secondary\\/60:hover{background-color:var(--secondary)}@supports (color:color-mix(in lab, red, red)){.mmnode .hover\\:bg-secondary\\/60:hover{background-color:color-mix(in oklab, var(--secondary) 60%, transparent)}}.mmnode .hover\\:bg-secondary\\/80:hover{background-color:var(--secondary)}@supports (color:color-mix(in lab, red, red)){.mmnode .hover\\:bg-secondary\\/80:hover{background-color:color-mix(in oklab, var(--secondary) 80%, transparent)}}.mmnode .hover\\:bg-transparent:hover{background-color:#0000}.mmnode .hover\\:bg-yellow-200:hover{background-color:var(--color-yellow-200)}.mmnode .hover\\:text-accent-foreground:hover{color:var(--accent-foreground)}.mmnode .hover\\:text-destructive:hover{color:var(--destructive)}.mmnode .hover\\:text-foreground:hover{color:var(--foreground)}.mmnode .hover\\:text-highlight:hover{color:var(--highlight)}.mmnode .hover\\:text-primary:hover{color:var(--primary)}.mmnode .hover\\:underline:hover{text-decoration-line:underline}.mmnode .hover\\:opacity-70:hover{opacity:.7}.mmnode .hover\\:opacity-80:hover{opacity:.8}.mmnode .hover\\:opacity-100:hover{opacity:1}}.mmnode .focus\\:bg-accent:focus{background-color:var(--accent)}.mmnode .focus\\:text-accent-foreground:focus{color:var(--accent-foreground)}.mmnode .focus\\:text-destructive:focus{color:var(--destructive)}.mmnode .focus\\:ring-0:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.mmnode .focus\\:ring-1:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.mmnode .focus\\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.mmnode .focus\\:ring-ring:focus{--tw-ring-color:var(--ring)}.mmnode .focus\\:ring-offset-2:focus{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.mmnode .focus\\:outline-none:focus{--tw-outline-style:none;outline-style:none}.mmnode .focus-visible\\:ring-0:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.mmnode .focus-visible\\:ring-1:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.mmnode .focus-visible\\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.mmnode .focus-visible\\:ring-\\[color\\:var\\(--focus-ring\\,\\#6B97FF\\)\\]:focus-visible{--tw-ring-color:var(--focus-ring,#6b97ff)}.mmnode .focus-visible\\:ring-ring:focus-visible{--tw-ring-color:var(--ring)}.mmnode .focus-visible\\:ring-offset-1:focus-visible{--tw-ring-offset-width:1px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.mmnode .focus-visible\\:ring-offset-2:focus-visible{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.mmnode .focus-visible\\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.mmnode .active\\:cursor-grabbing:active{cursor:grabbing}.mmnode .active\\:opacity-70:active{opacity:.7}.mmnode .disabled\\:pointer-events-none:disabled{pointer-events:none}.mmnode .disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.mmnode .disabled\\:opacity-20:disabled{opacity:.2}.mmnode .disabled\\:opacity-25:disabled{opacity:.25}.mmnode .disabled\\:opacity-40:disabled{opacity:.4}.mmnode .disabled\\:opacity-50:disabled{opacity:.5}.mmnode .aria-\\[orientation\\=horizontal\\]\\:h-px[aria-orientation=horizontal]{height:1px}.mmnode .aria-\\[orientation\\=horizontal\\]\\:w-full[aria-orientation=horizontal]{width:100%}.mmnode .aria-\\[orientation\\=horizontal\\]\\:cursor-row-resize[aria-orientation=horizontal]{cursor:row-resize}.mmnode .aria-\\[orientation\\=horizontal\\]\\:after\\:left-0[aria-orientation=horizontal]:after{content:var(--tw-content);left:calc(var(--spacing) * 0)}.mmnode .aria-\\[orientation\\=horizontal\\]\\:after\\:h-2[aria-orientation=horizontal]:after{content:var(--tw-content);height:calc(var(--spacing) * 2)}.mmnode .aria-\\[orientation\\=horizontal\\]\\:after\\:w-full[aria-orientation=horizontal]:after{content:var(--tw-content);width:100%}.mmnode .aria-\\[orientation\\=horizontal\\]\\:after\\:translate-x-0[aria-orientation=horizontal]:after{content:var(--tw-content);--tw-translate-x:calc(var(--spacing) * 0);translate:var(--tw-translate-x) var(--tw-translate-y)}.mmnode .aria-\\[orientation\\=horizontal\\]\\:after\\:-translate-y-1\\/2[aria-orientation=horizontal]:after{content:var(--tw-content);--tw-translate-y:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.mmnode .aria-\\[orientation\\=vertical\\]\\:cursor-col-resize[aria-orientation=vertical]{cursor:col-resize}.mmnode .aria-\\[orientation\\=vertical\\]\\:flex-col[aria-orientation=vertical]{flex-direction:column}.mmnode .data-\\[disabled\\]\\:pointer-events-none[data-disabled]{pointer-events:none}.mmnode .data-\\[disabled\\]\\:opacity-50[data-disabled]{opacity:.5}.mmnode .data-\\[placeholder\\]\\:text-muted-foreground[data-placeholder]{color:var(--muted-foreground)}.mmnode .data-\\[side\\=bottom\\]\\:translate-y-1[data-side=bottom]{--tw-translate-y:calc(var(--spacing) * 1);translate:var(--tw-translate-x) var(--tw-translate-y)}.mmnode .data-\\[side\\=bottom\\]\\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y:calc(2*var(--spacing)*-1)}.mmnode .data-\\[side\\=left\\]\\:-translate-x-1[data-side=left]{--tw-translate-x:calc(var(--spacing) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.mmnode .data-\\[side\\=left\\]\\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x:calc(2*var(--spacing))}.mmnode .data-\\[side\\=right\\]\\:translate-x-1[data-side=right]{--tw-translate-x:calc(var(--spacing) * 1);translate:var(--tw-translate-x) var(--tw-translate-y)}.mmnode .data-\\[side\\=right\\]\\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x:calc(2*var(--spacing)*-1)}.mmnode .data-\\[side\\=top\\]\\:-translate-y-1[data-side=top]{--tw-translate-y:calc(var(--spacing) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.mmnode .data-\\[side\\=top\\]\\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y:calc(2*var(--spacing))}.mmnode .data-\\[state\\=active\\]\\:bg-background[data-state=active]{background-color:var(--background)}.mmnode .data-\\[state\\=active\\]\\:text-foreground[data-state=active]{color:var(--foreground)}.mmnode .data-\\[state\\=active\\]\\:shadow[data-state=active]{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.mmnode .data-\\[state\\=checked\\]\\:bg-primary[data-state=checked]{background-color:var(--primary)}.mmnode .data-\\[state\\=checked\\]\\:text-primary-foreground[data-state=checked]{color:var(--primary-foreground)}.mmnode .data-\\[state\\=closed\\]\\:animate-out[data-state=closed]{animation:exit var(--tw-animation-duration,var(--tw-duration,.15s))var(--tw-ease,ease)var(--tw-animation-delay,0s)var(--tw-animation-iteration-count,1)var(--tw-animation-direction,normal)var(--tw-animation-fill-mode,none)}.mmnode .data-\\[state\\=closed\\]\\:fade-out-0[data-state=closed]{--tw-exit-opacity:0}.mmnode .data-\\[state\\=closed\\]\\:zoom-out-95[data-state=closed]{--tw-exit-scale:.95}.mmnode .data-\\[state\\=closed\\]\\:slide-out-to-left-1\\/2[data-state=closed]{--tw-exit-translate-x:calc(1 / 2*-100%)}.mmnode .data-\\[state\\=closed\\]\\:slide-out-to-top-\\[48\\%\\][data-state=closed]{--tw-exit-translate-y:calc(48%*-1)}.mmnode .data-\\[state\\=open\\]\\:animate-in[data-state=open]{animation:enter var(--tw-animation-duration,var(--tw-duration,.15s))var(--tw-ease,ease)var(--tw-animation-delay,0s)var(--tw-animation-iteration-count,1)var(--tw-animation-direction,normal)var(--tw-animation-fill-mode,none)}.mmnode .data-\\[state\\=open\\]\\:bg-accent[data-state=open]{background-color:var(--accent)}.mmnode .data-\\[state\\=open\\]\\:text-accent-foreground[data-state=open]{color:var(--accent-foreground)}.mmnode .data-\\[state\\=open\\]\\:text-muted-foreground[data-state=open]{color:var(--muted-foreground)}.mmnode .data-\\[state\\=open\\]\\:fade-in-0[data-state=open]{--tw-enter-opacity:0}.mmnode .data-\\[state\\=open\\]\\:zoom-in-95[data-state=open]{--tw-enter-scale:.95}.mmnode .data-\\[state\\=open\\]\\:slide-in-from-left-1\\/2[data-state=open]{--tw-enter-translate-x:calc(1 / 2*-100%)}.mmnode .data-\\[state\\=open\\]\\:slide-in-from-top-\\[48\\%\\][data-state=open]{--tw-enter-translate-y:calc(48%*-1)}@media (min-width:40rem){.mmnode .sm\\:flex-row{flex-direction:row}.mmnode .sm\\:justify-end{justify-content:flex-end}:where(.mmnode .sm\\:space-x-2>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing) * 2) * var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-x-reverse)))}.mmnode .sm\\:rounded-lg{border-radius:var(--radius)}.mmnode .sm\\:text-left{text-align:left}}@media (min-width:48rem){.mmnode .md\\:text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}}@container compare-video-controls not (min-width:420px){.mmnode .\\@max-\\[420px\\]\\/compare-video-controls\\:col-span-2{grid-column:span 2/span 2}.mmnode .\\@max-\\[420px\\]\\/compare-video-controls\\:col-start-1{grid-column-start:1}.mmnode .\\@max-\\[420px\\]\\/compare-video-controls\\:col-start-2{grid-column-start:2}.mmnode .\\@max-\\[420px\\]\\/compare-video-controls\\:row-start-1{grid-row-start:1}.mmnode .\\@max-\\[420px\\]\\/compare-video-controls\\:row-start-2{grid-row-start:2}.mmnode .\\@max-\\[420px\\]\\/compare-video-controls\\:hidden{display:none}.mmnode .\\@max-\\[420px\\]\\/compare-video-controls\\:w-full{width:100%}.mmnode .\\@max-\\[420px\\]\\/compare-video-controls\\:grid-cols-\\[minmax\\(0\\,1fr\\)_auto\\]{grid-template-columns:minmax(0,1fr) auto}.mmnode .\\@max-\\[420px\\]\\/compare-video-controls\\:gap-1{gap:calc(var(--spacing) * 1)}.mmnode .\\@max-\\[420px\\]\\/compare-video-controls\\:gap-x-1{column-gap:calc(var(--spacing) * 1)}.mmnode .\\@max-\\[420px\\]\\/compare-video-controls\\:gap-y-0{row-gap:calc(var(--spacing) * 0)}.mmnode .\\@max-\\[420px\\]\\/compare-video-controls\\:px-1{padding-inline:calc(var(--spacing) * 1)}.mmnode .\\@max-\\[420px\\]\\/compare-video-controls\\:px-2{padding-inline:calc(var(--spacing) * 2)}.mmnode .\\@max-\\[420px\\]\\/compare-video-controls\\:py-1{padding-block:calc(var(--spacing) * 1)}}.mmnode .\\[\\&_\\[data-orientation\\=horizontal\\]\\]\\:h-1 [data-orientation=horizontal]{height:calc(var(--spacing) * 1)}.mmnode .\\[\\&_\\[role\\=slider\\]\\]\\:h-2\\.5 [role=slider]{height:calc(var(--spacing) * 2.5)}.mmnode .\\[\\&_\\[role\\=slider\\]\\]\\:w-2\\.5 [role=slider]{width:calc(var(--spacing) * 2.5)}.mmnode .\\[\\&_svg\\]\\:pointer-events-none svg{pointer-events:none}.mmnode .\\[\\&_svg\\]\\:\\!size-3 svg{width:calc(var(--spacing) * 3)!important;height:calc(var(--spacing) * 3)!important}.mmnode .\\[\\&_svg\\]\\:\\!size-4 svg{width:calc(var(--spacing) * 4)!important;height:calc(var(--spacing) * 4)!important}.mmnode .\\[\\&_svg\\]\\:size-3 svg{width:calc(var(--spacing) * 3);height:calc(var(--spacing) * 3)}.mmnode .\\[\\&_svg\\]\\:size-3\\.5 svg{width:calc(var(--spacing) * 3.5);height:calc(var(--spacing) * 3.5)}.mmnode .\\[\\&_svg\\]\\:size-4 svg{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.mmnode .\\[\\&_svg\\]\\:shrink-0 svg{flex-shrink:0}.mmnode .\\[\\&\\:\\:-webkit-inner-spin-button\\]\\:appearance-none::-webkit-inner-spin-button{appearance:none}.mmnode .\\[\\&\\:\\:-webkit-outer-spin-button\\]\\:appearance-none::-webkit-outer-spin-button{appearance:none}.mmnode .\\[\\&\\>\\*\\]\\:mb-0>*{margin-bottom:calc(var(--spacing) * 0)}.mmnode .\\[\\&\\>\\*\\+\\*\\]\\:-mt-px>*+*{margin-top:-1px}.mmnode .\\[\\&\\>div\\]\\:h-full>div{height:100%}.mmnode .\\[\\&\\>span\\]\\:line-clamp-1>span{-webkit-line-clamp:1;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.mmnode .\\[\\&\\[aria-orientation\\=horizontal\\]\\>div\\]\\:rotate-90[aria-orientation=horizontal]>div{rotate:90deg}@property --tw-animation-delay{syntax:"*";inherits:false;initial-value:0s}@property --tw-animation-direction{syntax:"*";inherits:false;initial-value:normal}@property --tw-animation-duration{syntax:"*";inherits:false}@property --tw-animation-fill-mode{syntax:"*";inherits:false;initial-value:none}@property --tw-animation-iteration-count{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-blur{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-opacity{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-rotate{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-scale{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-blur{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-opacity{syntax:"*";inherits:false;initial-value:1}@property --tw-exit-rotate{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-scale{syntax:"*";inherits:false;initial-value:1}@property --tw-exit-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-translate-y{syntax:"*";inherits:false;initial-value:0}@layer base{.mmnode{--checker-a:oklch(100% 0 0);--checker-b:oklch(100% 0 0);--background:oklch(100% 0 0);--foreground:oklch(14.5% 0 0);--card:oklch(100% 0 0);--card-foreground:oklch(14.5% 0 0);--popover:oklch(100% 0 0);--popover-foreground:oklch(14.5% 0 0);--primary:oklch(20.5% 0 0);--primary-foreground:oklch(98.5% 0 0);--secondary:oklch(97% 0 0);--secondary-foreground:oklch(20.5% 0 0);--muted:var(--comfy-input-bg);--muted-foreground:oklch(55.6% 0 0);--accent:oklch(97% 0 0);--accent-foreground:oklch(20.5% 0 0);--destructive:oklch(57.7% .245 27.325);--destructive-foreground:oklch(98.5% 0 0);--highlight:oklch(73.286% .16689 115.634);--prompt-semantic:oklch(62% .19 48);--prompt-dialogue:#cf3976;--panorama-axis-z:oklch(58% .2 255);--image-tile-foreground:oklch(98.5% 0 0);--warning:oklch(92.2% .191 90);--multitrack-video-bg:oklch(42% .08 195);--multitrack-video-bg-strong:oklch(34% .09 195);--multitrack-video-border:oklch(82% .08 195);--multitrack-video-text:oklch(96% .02 195);--multitrack-video-waveform:#0a777e;--multitrack-audio-bg:#0e3058;--multitrack-audio-bg-strong:#0e3058;--multitrack-audio-title-bg:#274569;--multitrack-audio-waveform:#1581b3;--multitrack-audio-border:oklch(70% .1 220);--multitrack-audio-text:oklch(96% .02 245);--multitrack-task-bg:#744a82;--multitrack-task-bg-strong:#5f3b6a;--multitrack-task-border:#a783b2;--multitrack-task-text:oklch(96% .01 260);--multitrack-subtitle-bg:#9d4937;--multitrack-subtitle-bg-strong:#7d3a2c;--multitrack-subtitle-border:#c9705a;--multitrack-subtitle-text:#fff;--multitrack-waveform:oklch(55% .09 185);--border:var(--border-color);--input:oklch(92.2% 0 0);--ring:oklch(70.8% 0 0);--radius:.5rem}.mmnode .nodeNew{--muted:var(--component-node-widget-background)}.mmnode *,.mmnode :after,.mmnode :before,.mmnode ::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}.mmnode ::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}.mmnode html,.mmnode :host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}.mmnode hr{height:0;color:inherit;border-top-width:1px}.mmnode abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.mmnode h1,.mmnode h2,.mmnode h3,.mmnode h4,.mmnode h5,.mmnode h6{font-size:inherit;font-weight:inherit}.mmnode a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}.mmnode b,.mmnode strong{font-weight:bolder}.mmnode code,.mmnode kbd,.mmnode samp,.mmnode pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}.mmnode small{font-size:80%}.mmnode sub,.mmnode sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}.mmnode sub{bottom:-.25em}.mmnode sup{top:-.5em}.mmnode table{text-indent:0;border-color:inherit;border-collapse:collapse}.mmnode :-moz-focusring{outline:auto}.mmnode progress{vertical-align:baseline}.mmnode summary{display:list-item}.mmnode ol,.mmnode ul,.mmnode menu{list-style:none}.mmnode img,.mmnode svg,.mmnode video,.mmnode canvas,.mmnode audio,.mmnode iframe,.mmnode embed,.mmnode object{vertical-align:middle;display:block}.mmnode img,.mmnode video{max-width:100%;height:auto}.mmnode button,.mmnode input,.mmnode select,.mmnode optgroup,.mmnode textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}.mmnode ::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}.mmnode :where(select:is([multiple],[size])) optgroup{font-weight:bolder}.mmnode :where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}.mmnode ::file-selector-button{margin-inline-end:4px}.mmnode ::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){.mmnode ::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){.mmnode ::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}.mmnode textarea{resize:vertical}.mmnode ::-webkit-search-decoration{-webkit-appearance:none}.mmnode ::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}.mmnode ::-webkit-datetime-edit{display:inline-flex}.mmnode ::-webkit-datetime-edit-fields-wrapper{padding:0}.mmnode ::-webkit-datetime-edit{padding-block:0}.mmnode ::-webkit-datetime-edit-year-field{padding-block:0}.mmnode ::-webkit-datetime-edit-month-field{padding-block:0}.mmnode ::-webkit-datetime-edit-day-field{padding-block:0}.mmnode ::-webkit-datetime-edit-hour-field{padding-block:0}.mmnode ::-webkit-datetime-edit-minute-field{padding-block:0}.mmnode ::-webkit-datetime-edit-second-field{padding-block:0}.mmnode ::-webkit-datetime-edit-millisecond-field{padding-block:0}.mmnode ::-webkit-datetime-edit-meridiem-field{padding-block:0}.mmnode ::-webkit-calendar-picker-indicator{line-height:1}.mmnode :-moz-ui-invalid{box-shadow:none}.mmnode button,.mmnode input:where([type=button],[type=reset],[type=submit]){appearance:button}.mmnode ::file-selector-button{appearance:button}.mmnode ::-webkit-inner-spin-button{height:auto}.mmnode ::-webkit-outer-spin-button{height:auto}.mmnode [hidden]:where(:not([hidden=until-found])){display:none!important}.mmnode *{border-color:var(--border)}.dark-theme .mmnode{--checker-a:oklch(14.5% 0 0);--checker-b:oklch(20.5% 0 0);--background:oklch(14.5% 0 0);--foreground:oklch(98.5% 0 0);--card:oklch(20.5% 0 0);--card-foreground:oklch(98.5% 0 0);--popover:oklch(20.5% 0 0);--popover-foreground:oklch(98.5% 0 0);--primary:oklch(92.2% 0 0);--primary-foreground:oklch(20.5% 0 0);--secondary:oklch(26.9% 0 0);--secondary-foreground:oklch(98.5% 0 0);--muted:var(--comfy-input-bg);--muted-foreground:oklch(70.8% 0 0);--accent:oklch(26.9% 0 0);--accent-foreground:oklch(98.5% 0 0);--destructive:oklch(70.4% .191 22.216);--destructive-foreground:oklch(98.5% 0 0);--prompt-semantic:oklch(78% .17 65);--prompt-dialogue:#cf3976;--panorama-axis-z:oklch(72% .16 250);--multitrack-video-bg:oklch(42% .08 195);--multitrack-video-bg-strong:oklch(34% .09 195);--multitrack-video-border:oklch(82% .08 195);--multitrack-video-text:oklch(96% .02 195);--multitrack-video-waveform:#0a777e;--multitrack-audio-bg:#0e3058;--multitrack-audio-bg-strong:#0e3058;--multitrack-audio-title-bg:#274569;--multitrack-audio-waveform:#1581b3;--multitrack-audio-border:oklch(70% .1 220);--multitrack-audio-text:oklch(96% .02 245);--multitrack-task-bg:#744a82;--multitrack-task-bg-strong:#5f3b6a;--multitrack-task-border:#a783b2;--multitrack-task-text:oklch(96% .01 260);--multitrack-subtitle-bg:#9d4937;--multitrack-subtitle-bg-strong:#7d3a2c;--multitrack-subtitle-border:#c9705a;--multitrack-subtitle-text:#fff;--multitrack-waveform:oklch(55% .09 185);--border:var(--border-color);--input:oklch(100% 0 0/.15);--ring:oklch(55.6% 0 0);--highlight:oklch(96.109% .18336 113.683)}}@layer components{.mmnode [data-state=active]{background-color:var(--background);color:var(--foreground);box-shadow:0 1px 3px #0000001a,0 1px 2px -1px #0000001a}.mmnode [data-state=open]{color:var(--foreground)}.mmnode [data-state=closed]{color:var(--muted-foreground)}.mmnode [data-disabled=true]{pointer-events:none;opacity:.5}.mmnode .no-scrollbar{scrollbar-width:none;-ms-overflow-style:none}.mmnode .no-scrollbar::-webkit-scrollbar{display:none}.mmnode .text-gradient{background:linear-gradient(90deg, var(--primary), var(--highlight));-webkit-text-fill-color:#0000;-webkit-background-clip:text;background-clip:text}.mmnode .task-image-grid-item,.mmnode .task-image-grid-add{transition:opacity .18s}.mmnode .task-segment-editor{container-type:inline-size}@container (max-width:40rem){.mmnode .task-segment-editor .task-image-drop-zone{aspect-ratio:auto;width:clamp(10rem,40%,20rem)}.mmnode .task-segment-editor .task-image-picker-empty{aspect-ratio:auto;width:100%;min-width:0;padding-inline:.5rem}.mmnode .task-segment-editor .task-image-grid{grid-template-columns:minmax(0,1fr)}}}.comfyui-react-widget.mmnode{box-sizing:border-box;contain:size layout paint;width:100%;min-width:0;height:100%;min-height:0;max-height:100%;display:block;position:relative;overflow:hidden}.comfyui-react-widget.mmnode.mmnode-timeline-editor-open{contain:size layout;z-index:9999;overflow:visible}.comfyui-react-widget.mmnode-overlay-active{z-index:9999!important;position:relative!important}body>.mmnode{visibility:visible;pointer-events:none;display:block}body>.mmnode>*{pointer-events:auto}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@property --tw-content{syntax:"*";inherits:false;initial-value:""}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}}@keyframes enter{0%{opacity:var(--tw-enter-opacity,1);transform:translate3d(var(--tw-enter-translate-x,0),var(--tw-enter-translate-y,0),0)scale3d(var(--tw-enter-scale,1),var(--tw-enter-scale,1),var(--tw-enter-scale,1))rotate(var(--tw-enter-rotate,0));filter:blur(var(--tw-enter-blur,0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity,1);transform:translate3d(var(--tw-exit-translate-x,0),var(--tw-exit-translate-y,0),0)scale3d(var(--tw-exit-scale,1),var(--tw-exit-scale,1),var(--tw-exit-scale,1))rotate(var(--tw-exit-rotate,0));filter:blur(var(--tw-exit-blur,0))}}`,"MMnode-globals")},beforeRegisterNodeDef(f,m){n(f,m),y(f,m),I(f,m),P(f,m),A(f,m),i(f,m),l(f,m,k)},getNodeMenuItems(f){let m=k.ui?.settings?.settingsValues?.["Comfy.Locale"];return u(f,k.canvas,m)},getCustomWidgets(){return{TIMELINE:x(Qf,{defaultValue:kf,keepResponsiveWidthInLiteGraph:!0,domWidgetOptions:{getMinHeight:()=>180}}),TRACK_DATA:x(Xf,{defaultValue:Of,keepResponsiveWidthInLiteGraph:!0,domWidgetOptions:{getMinHeight:()=>320}}),IMAGE_DATA:x($f,{defaultValue:JSON.stringify({images:[]}),keepResponsiveWidthInLiteGraph:!0,domWidgetOptions:{getMinHeight:()=>320,hideOnZoom:!1,serialize:!0}}),PROJECT_DATA:x(Bf,{defaultValue:JSON.stringify(a),keepResponsiveWidthInLiteGraph:!0,domWidgetOptions:{getMinHeight:()=>520,hideOnZoom:!1,serialize:!0}}),EASY_COMPARE_VIDEO:x(Kf,{defaultValue:qf,keepResponsiveWidthInLiteGraph:!0,domWidgetOptions:{getMinHeight:()=>360,hideOnZoom:!1,serialize:!0}}),EASY_API_ACCOUNT:x(xf,{defaultValue:"",keepResponsiveWidthInLiteGraph:!0,height:44,domWidgetOptions:{getMinHeight:()=>44,getMaxHeight:()=>44,hideOnZoom:!1,serialize:!0}})}}}); diff --git a/frontend/src/components/widgets/multitrack/PreviewArea.tsx b/frontend/src/components/widgets/multitrack/PreviewArea.tsx index 967716d..e23260f 100644 --- a/frontend/src/components/widgets/multitrack/PreviewArea.tsx +++ b/frontend/src/components/widgets/multitrack/PreviewArea.tsx @@ -27,6 +27,7 @@ import { type MultiTrackVideoMetadata, type SelectedMultiTrackSegment, } from '@/lib/multitrack-utils' +import { isMoxieEditorFormat } from '@/lib/multitrack-utils' import { useMultiTrackResolutionInput } from '@/hooks/use-multitrack-resolution-input' import { useExpandedImagePreview } from '@/hooks/use-expanded-image-preview' import { useT } from '@/lib/i18n' @@ -1110,7 +1111,7 @@ export function PreviewArea({ )} | - {resolutionInput.format === 'MiniMax' && activeTaskPrompt.index > 0 && ( + {isMoxieEditorFormat(resolutionInput.format) && activeTaskPrompt.index > 0 && ( <> track.type === 'audio' || track.type === 'video')} frameRate={data.frame_rate} totalFrames={data.total_length} - imageIndexOffset={resolutionInput.format === 'MiniMax' ? 1 : 0} + imageIndexOffset={isMoxieEditorFormat(resolutionInput.format) ? 1 : 0} format={resolutionInput.format} onContentChange={onSelectedSegmentContentChange} onTrackSegmentsContentChange={onTrackSegmentsContentChange} diff --git a/frontend/src/components/widgets/multitrack/TaskSegmentEditor.tsx b/frontend/src/components/widgets/multitrack/TaskSegmentEditor.tsx index 76b9edb..ea842b6 100644 --- a/frontend/src/components/widgets/multitrack/TaskSegmentEditor.tsx +++ b/frontend/src/components/widgets/multitrack/TaskSegmentEditor.tsx @@ -42,6 +42,7 @@ import { parseMultiTrackDurationTimecode, segmentDuration, } from '@/lib/multitrack-utils' +import { normalizeFormatValue } from '@/lib/multitrack-utils' import { cn } from '@/lib/utils' import { createTaskImage, @@ -231,13 +232,14 @@ export function TaskSegmentEditor({ frameRate = MULTITRACK_DEFAULT_FRAME_RATE, totalFrames, imageIndexOffset = 0, - format, + format: rawFormat, onContentChange, onTrackSegmentsContentChange, onTrackSegmentsChange, onDurationChange, onOpenImagePreview, }: Readonly) { + const format = normalizeFormatValue(rawFormat) const t = useT() const draggedImageIdRef = useRef(null) const [promptTab, setPromptTab] = useState('user') diff --git a/frontend/src/components/widgets/multitrack/TrackArea.tsx b/frontend/src/components/widgets/multitrack/TrackArea.tsx index 1ba8ebb..2907651 100644 --- a/frontend/src/components/widgets/multitrack/TrackArea.tsx +++ b/frontend/src/components/widgets/multitrack/TrackArea.tsx @@ -15,6 +15,7 @@ import { snapTimeToFrame, type SegmentDragPlaceholder, } from '@/lib/multitrack-utils' +import { isMoxieEditorFormat } from '@/lib/multitrack-utils' import type { MultiTrack, MultiTrackSegment, MultiTrackTaskImage, MultiTrackType } from '@/types/multitrack' import type { MultiTrackSourceType, TrackData } from '@/types/multitrack' import { MULTITRACK_LEFT_GUTTER, MULTITRACK_RIGHT_RESERVE } from './MultiTrackRuler' @@ -609,7 +610,7 @@ export function TrackArea({ onDragPreviewChange={updateDragPlaceholder} getDragPreviewStart={snappedMoveStartTime} onDragPreviewEnd={() => setDragPlaceholder(null)} - audioLockEnabled={format === 'MiniMax'} + audioLockEnabled={isMoxieEditorFormat(format)} /> ) } @@ -643,7 +644,7 @@ export function TrackArea({ onRecognizeSubtitles={onRecognizeSubtitles} cutMode={cutMode} onCutSegment={onCutSegment} - audioLockEnabled={format === 'MiniMax'} + audioLockEnabled={isMoxieEditorFormat(format)} /> ) } diff --git a/frontend/src/index.ts b/frontend/src/index.ts index 9eca604..bd09b05 100644 --- a/frontend/src/index.ts +++ b/frontend/src/index.ts @@ -44,10 +44,15 @@ const DEFAULT_COMPARE_VIDEO_VALUE = JSON.stringify({ const comfyApp = globalThis.comfyAPI!.app.app +// Bump on every rebuilt release bundle so users can verify the served editor +// build in the browser console (stale-cache debugging). +const FRONTEND_BUNDLE_VERSION = '2026-09-27.2' + comfyApp.registerExtension({ name: 'Comfy.EasyMedia.widgets', async setup() { + console.info(`[Moxie Multimedia Suite] editor bundle ${FRONTEND_BUNDLE_VERSION}`) installWorkflowSubmission(comfyApp) addInlineStyles( __COMFY_EASY_MEDIA_GLOBAL_CSS__, diff --git a/frontend/src/lib/multitrack-utils.ts b/frontend/src/lib/multitrack-utils.ts index cb49a6e..d03f8e1 100644 --- a/frontend/src/lib/multitrack-utils.ts +++ b/frontend/src/lib/multitrack-utils.ts @@ -33,8 +33,16 @@ export const MULTITRACK_FRAME_RATE_OPTIONS = [16, 20, 24, 25, 30, 50, 60] as con export const FORMAT_DISPLAY_LABEL = 'Moxie Multimedia' export const FORMAT_INTERNAL_VALUE = 'MiniMax' -export function normalizeFormatValue(value: string): string { - return value === FORMAT_DISPLAY_LABEL ? FORMAT_INTERNAL_VALUE : value +export function normalizeFormatValue(value: string | null | undefined): string { + const trimmed = (value ?? '').trim() + return trimmed === FORMAT_DISPLAY_LABEL ? FORMAT_INTERNAL_VALUE : trimmed +} + +// MiniMax-gated editor features stay enabled even when the format widget value +// is missing or unrecognized: the pack ships exactly one video format. +export function isMoxieEditorFormat(value: string | null | undefined): boolean { + const normalized = normalizeFormatValue(value) + return normalized === FORMAT_INTERNAL_VALUE || normalized === '' } export function getMultiTrackTrackHeight(type: string, taskOverview = false): number {