@bylqwjc/media-editor-video 1.0.18 → 1.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +12 -12
- package/package.json +1 -1
- package/dist/legacy.js +0 -11
package/dist/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
var u1=Object.defineProperty,c1=(n,a)=>{for(var o in a)u1(n,o,{get:a[o],enumerable:!0})},d1=Object.create,c0=Object.defineProperty,m1=Object.getOwnPropertyDescriptor,f1=Object.getOwnPropertyNames,p1=Object.getPrototypeOf,h1=Object.prototype.hasOwnProperty,La=(n,a)=>()=>(a||n((a={exports:{}}).exports,a),a.exports),v1=(n,a,o,l)=>{if(a&&typeof a=="object"||typeof a=="function")for(let s of f1(a))!h1.call(n,s)&&s!==o&&c0(n,s,{get:()=>a[s],enumerable:!(l=m1(a,s))||l.enumerable});return n},Ar=(n,a,o)=>(o=n!=null?d1(p1(n)):{},v1(a||!n||!n.__esModule?c0(o,"default",{value:n,enumerable:!0}):o,n)),ce={};c1(ce,{BRAND:()=>H1,DIRTY:()=>Yu,EMPTY_PATH:()=>x1,INVALID:()=>Xt,NEVER:()=>Sx,OK:()=>Nr,ParseStatus:()=>Rr,Schema:()=>mn,ZodAny:()=>Uo,ZodArray:()=>ro,ZodBigInt:()=>ts,ZodBoolean:()=>ns,ZodBranded:()=>Bm,ZodCatch:()=>fs,ZodDate:()=>rs,ZodDefault:()=>ms,ZodDiscriminatedUnion:()=>v0,ZodEffects:()=>xa,ZodEnum:()=>cs,ZodError:()=>ya,ZodFirstPartyTypeKind:()=>Qt,ZodFunction:()=>b0,ZodIntersection:()=>ls,ZodIssueCode:()=>Ue,ZodLazy:()=>ss,ZodLiteral:()=>us,ZodMap:()=>Ku,ZodNaN:()=>Xu,ZodNativeEnum:()=>ds,ZodNever:()=>ni,ZodNull:()=>is,ZodNullable:()=>_i,ZodNumber:()=>es,ZodObject:()=>ca,ZodOptional:()=>Na,ZodParsedType:()=>St,ZodPipeline:()=>zm,ZodPromise:()=>Ko,ZodReadonly:()=>ps,ZodRecord:()=>g0,ZodSchema:()=>mn,ZodSet:()=>Gu,ZodString:()=>Yo,ZodSymbol:()=>Uu,ZodTransformer:()=>xa,ZodTuple:()=>Ni,ZodType:()=>mn,ZodUndefined:()=>as,ZodUnion:()=>os,ZodUnknown:()=>no,ZodVoid:()=>Zu,addIssueToContext:()=>vt,any:()=>X1,array:()=>tx,bigint:()=>Y1,boolean:()=>C0,coerce:()=>Cx,custom:()=>w0,date:()=>U1,datetimeRegex:()=>h0,defaultErrorMap:()=>qo,discriminatedUnion:()=>ix,effect:()=>S0,enum:()=>px,function:()=>dx,getErrorMap:()=>Wu,getParsedType:()=>ti,instanceof:()=>W1,intersection:()=>ox,isAborted:()=>Am,isAsync:()=>Jl,isDirty:()=>Nm,isValid:()=>to,late:()=>V1,lazy:()=>mx,literal:()=>fx,makeIssue:()=>qu,map:()=>ux,nan:()=>q1,nativeEnum:()=>hx,never:()=>J1,null:()=>G1,nullable:()=>bx,number:()=>k0,object:()=>nx,objectUtil:()=>Lm,oboolean:()=>kx,onumber:()=>Ex,optional:()=>gx,ostring:()=>wx,pipeline:()=>xx,preprocess:()=>yx,promise:()=>vx,quotelessJson:()=>g1,record:()=>sx,set:()=>cx,setErrorMap:()=>y1,strictObject:()=>rx,string:()=>E0,symbol:()=>Z1,transformer:()=>S0,tuple:()=>lx,undefined:()=>K1,union:()=>ax,unknown:()=>Q1,util:()=>En,void:()=>ex});var En;(function(n){n.assertEqual=s=>{};function a(s){}n.assertIs=a;function o(s){throw new Error}n.assertNever=o,n.arrayToEnum=s=>{const d={};for(const m of s)d[m]=m;return d},n.getValidEnumValues=s=>{const d=n.objectKeys(s).filter(h=>typeof s[s[h]]!="number"),m={};for(const h of d)m[h]=s[h];return n.objectValues(m)},n.objectValues=s=>n.objectKeys(s).map(function(d){return s[d]}),n.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const d=[];for(const m in s)Object.prototype.hasOwnProperty.call(s,m)&&d.push(m);return d},n.find=(s,d)=>{for(const m of s)if(d(m))return m},n.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function l(s,d=" | "){return s.map(m=>typeof m=="string"?`'${m}'`:m).join(d)}n.joinValues=l,n.jsonStringifyReplacer=(s,d)=>typeof d=="bigint"?d.toString():d})(En||(En={}));var Lm;(function(n){n.mergeShapes=(a,o)=>({...a,...o})})(Lm||(Lm={}));var St=En.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ti=n=>{switch(typeof n){case"undefined":return St.undefined;case"string":return St.string;case"number":return Number.isNaN(n)?St.nan:St.number;case"boolean":return St.boolean;case"function":return St.function;case"bigint":return St.bigint;case"symbol":return St.symbol;case"object":return Array.isArray(n)?St.array:n===null?St.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?St.promise:typeof Map<"u"&&n instanceof Map?St.map:typeof Set<"u"&&n instanceof Set?St.set:typeof Date<"u"&&n instanceof Date?St.date:St.object;default:return St.unknown}},Ue=En.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),g1=n=>JSON.stringify(n,null,2).replace(/"([^"]+)":/g,"$1:"),ya=class ub extends Error{get errors(){return this.issues}constructor(a){super(),this.issues=[],this.addIssue=l=>{this.issues=[...this.issues,l]},this.addIssues=(l=[])=>{this.issues=[...this.issues,...l]};const o=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,o):this.__proto__=o,this.name="ZodError",this.issues=a}format(a){const o=a||function(d){return d.message},l={_errors:[]},s=d=>{for(const m of d.issues)if(m.code==="invalid_union")m.unionErrors.map(s);else if(m.code==="invalid_return_type")s(m.returnTypeError);else if(m.code==="invalid_arguments")s(m.argumentsError);else if(m.path.length===0)l._errors.push(o(m));else{let h=l,g=0;for(;g<m.path.length;){const v=m.path[g];g===m.path.length-1?(h[v]=h[v]||{_errors:[]},h[v]._errors.push(o(m))):h[v]=h[v]||{_errors:[]},h=h[v],g++}}};return s(this),l}static assert(a){if(!(a instanceof ub))throw new Error(`Not a ZodError: ${a}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,En.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(a=o=>o.message){const o={},l=[];for(const s of this.issues)if(s.path.length>0){const d=s.path[0];o[d]=o[d]||[],o[d].push(a(s))}else l.push(a(s));return{formErrors:l,fieldErrors:o}}get formErrors(){return this.flatten()}};ya.create=n=>new ya(n);var b1=(n,a)=>{let o;switch(n.code){case Ue.invalid_type:n.received===St.undefined?o="Required":o=`Expected ${n.expected}, received ${n.received}`;break;case Ue.invalid_literal:o=`Invalid literal value, expected ${JSON.stringify(n.expected,En.jsonStringifyReplacer)}`;break;case Ue.unrecognized_keys:o=`Unrecognized key(s) in object: ${En.joinValues(n.keys,", ")}`;break;case Ue.invalid_union:o="Invalid input";break;case Ue.invalid_union_discriminator:o=`Invalid discriminator value. Expected ${En.joinValues(n.options)}`;break;case Ue.invalid_enum_value:o=`Invalid enum value. Expected ${En.joinValues(n.options)}, received '${n.received}'`;break;case Ue.invalid_arguments:o="Invalid function arguments";break;case Ue.invalid_return_type:o="Invalid function return type";break;case Ue.invalid_date:o="Invalid date";break;case Ue.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(o=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(o=`${o} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?o=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?o=`Invalid input: must end with "${n.validation.endsWith}"`:En.assertNever(n.validation):n.validation!=="regex"?o=`Invalid ${n.validation}`:o="Invalid";break;case Ue.too_small:n.type==="array"?o=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?o=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?o=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="bigint"?o=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?o=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:o="Invalid input";break;case Ue.too_big:n.type==="array"?o=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?o=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?o=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?o=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?o=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:o="Invalid input";break;case Ue.custom:o="Invalid input";break;case Ue.invalid_intersection_types:o="Intersection results could not be merged";break;case Ue.not_multiple_of:o=`Number must be a multiple of ${n.multipleOf}`;break;case Ue.not_finite:o="Number must be finite";break;default:o=a.defaultError,En.assertNever(n)}return{message:o}},qo=b1,d0=qo;function y1(n){d0=n}function Wu(){return d0}var qu=n=>{const{data:a,path:o,errorMaps:l,issueData:s}=n,d=[...o,...s.path||[]],m={...s,path:d};if(s.message!==void 0)return{...s,path:d,message:s.message};let h="";const g=l.filter(v=>!!v).slice().reverse();for(const v of g)h=v(m,{data:a,defaultError:h}).message;return{...s,path:d,message:h}},x1=[];function vt(n,a){const o=Wu(),l=qu({issueData:a,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,o,o===qo?void 0:qo].filter(s=>!!s)});n.common.issues.push(l)}var Rr=class cb{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(a,o){const l=[];for(const s of o){if(s.status==="aborted")return Xt;s.status==="dirty"&&a.dirty(),l.push(s.value)}return{status:a.value,value:l}}static async mergeObjectAsync(a,o){const l=[];for(const s of o){const d=await s.key,m=await s.value;l.push({key:d,value:m})}return cb.mergeObjectSync(a,l)}static mergeObjectSync(a,o){const l={};for(const s of o){const{key:d,value:m}=s;if(d.status==="aborted"||m.status==="aborted")return Xt;d.status==="dirty"&&a.dirty(),m.status==="dirty"&&a.dirty(),d.value!=="__proto__"&&(typeof m.value<"u"||s.alwaysSet)&&(l[d.value]=m.value)}return{status:a.value,value:l}}},Xt=Object.freeze({status:"aborted"}),Yu=n=>({status:"dirty",value:n}),Nr=n=>({status:"valid",value:n}),Am=n=>n.status==="aborted",Nm=n=>n.status==="dirty",to=n=>n.status==="valid",Jl=n=>typeof Promise<"u"&&n instanceof Promise,Dt;(function(n){n.errToObj=a=>typeof a=="string"?{message:a}:a||{},n.toString=a=>typeof a=="string"?a:a?.message})(Dt||(Dt={}));var Aa=class{constructor(n,a,o,l){this._cachedPath=[],this.parent=n,this.data=a,this._path=o,this._key=l}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},m0=(n,a)=>{if(to(a))return{success:!0,data:a.value};if(!n.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const o=new ya(n.common.issues);return this._error=o,this._error}}};function sn(n){if(!n)return{};const{errorMap:a,invalid_type_error:o,required_error:l,description:s}=n;if(a&&(o||l))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return a?{errorMap:a,description:s}:{errorMap:(d,m)=>{const{message:h}=n;return d.code==="invalid_enum_value"?{message:h??m.defaultError}:typeof m.data>"u"?{message:h??l??m.defaultError}:d.code!=="invalid_type"?{message:m.defaultError}:{message:h??o??m.defaultError}},description:s}}var mn=class{get description(){return this._def.description}_getType(n){return ti(n.data)}_getOrReturnCtx(n,a){return a||{common:n.parent.common,data:n.data,parsedType:ti(n.data),schemaErrorMap:this._def.errorMap,path:n.path,parent:n.parent}}_processInputParams(n){return{status:new Rr,ctx:{common:n.parent.common,data:n.data,parsedType:ti(n.data),schemaErrorMap:this._def.errorMap,path:n.path,parent:n.parent}}}_parseSync(n){const a=this._parse(n);if(Jl(a))throw new Error("Synchronous parse encountered promise.");return a}_parseAsync(n){const a=this._parse(n);return Promise.resolve(a)}parse(n,a){const o=this.safeParse(n,a);if(o.success)return o.data;throw o.error}safeParse(n,a){const o={common:{issues:[],async:a?.async??!1,contextualErrorMap:a?.errorMap},path:a?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:n,parsedType:ti(n)},l=this._parseSync({data:n,path:o.path,parent:o});return m0(o,l)}"~validate"(n){const a={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:n,parsedType:ti(n)};if(!this["~standard"].async)try{const o=this._parseSync({data:n,path:[],parent:a});return to(o)?{value:o.value}:{issues:a.common.issues}}catch(o){o?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),a.common={issues:[],async:!0}}return this._parseAsync({data:n,path:[],parent:a}).then(o=>to(o)?{value:o.value}:{issues:a.common.issues})}async parseAsync(n,a){const o=await this.safeParseAsync(n,a);if(o.success)return o.data;throw o.error}async safeParseAsync(n,a){const o={common:{issues:[],contextualErrorMap:a?.errorMap,async:!0},path:a?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:n,parsedType:ti(n)},l=this._parse({data:n,path:o.path,parent:o}),s=await(Jl(l)?l:Promise.resolve(l));return m0(o,s)}refine(n,a){const o=l=>typeof a=="string"||typeof a>"u"?{message:a}:typeof a=="function"?a(l):a;return this._refinement((l,s)=>{const d=n(l),m=()=>s.addIssue({code:Ue.custom,...o(l)});return typeof Promise<"u"&&d instanceof Promise?d.then(h=>h?!0:(m(),!1)):d?!0:(m(),!1)})}refinement(n,a){return this._refinement((o,l)=>n(o)?!0:(l.addIssue(typeof a=="function"?a(o,l):a),!1))}_refinement(n){return new xa({schema:this,typeName:Qt.ZodEffects,effect:{type:"refinement",refinement:n}})}superRefine(n){return this._refinement(n)}constructor(n){this.spa=this.safeParseAsync,this._def=n,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:a=>this["~validate"](a)}}optional(){return Na.create(this,this._def)}nullable(){return _i.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ro.create(this)}promise(){return Ko.create(this,this._def)}or(n){return os.create([this,n],this._def)}and(n){return ls.create(this,n,this._def)}transform(n){return new xa({...sn(this._def),schema:this,typeName:Qt.ZodEffects,effect:{type:"transform",transform:n}})}default(n){const a=typeof n=="function"?n:()=>n;return new ms({...sn(this._def),innerType:this,defaultValue:a,typeName:Qt.ZodDefault})}brand(){return new Bm({typeName:Qt.ZodBranded,type:this,...sn(this._def)})}catch(n){const a=typeof n=="function"?n:()=>n;return new fs({...sn(this._def),innerType:this,catchValue:a,typeName:Qt.ZodCatch})}describe(n){const a=this.constructor;return new a({...this._def,description:n})}pipe(n){return zm.create(this,n)}readonly(){return ps.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},w1=/^c[^\s-]{8,}$/i,E1=/^[0-9a-z]+$/,k1=/^[0-9A-HJKMNP-TV-Z]{26}$/i,C1=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,S1=/^[a-z0-9_-]{21}$/i,F1=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,M1=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,L1=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,A1="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",_m,N1=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,_1=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,T1=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,B1=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,z1=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,D1=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,f0="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",j1=new RegExp(`^${f0}$`);function p0(n){let a="[0-5]\\d";n.precision?a=`${a}\\.\\d{${n.precision}}`:n.precision==null&&(a=`${a}(\\.\\d+)?`);const o=n.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${a})${o}`}function O1(n){return new RegExp(`^${p0(n)}$`)}function h0(n){let a=`${f0}T${p0(n)}`;const o=[];return o.push(n.local?"Z?":"Z"),n.offset&&o.push("([+-]\\d{2}:?\\d{2})"),a=`${a}(${o.join("|")})`,new RegExp(`^${a}$`)}function P1(n,a){return!!((a==="v4"||!a)&&N1.test(n)||(a==="v6"||!a)&&T1.test(n))}function $1(n,a){if(!F1.test(n))return!1;try{const[o]=n.split(".");if(!o)return!1;const l=o.replace(/-/g,"+").replace(/_/g,"/").padEnd(o.length+(4-o.length%4)%4,"="),s=JSON.parse(atob(l));return!(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||a&&s.alg!==a)}catch{return!1}}function R1(n,a){return!!((a==="v4"||!a)&&_1.test(n)||(a==="v6"||!a)&&B1.test(n))}var Yo=class zs extends mn{_parse(a){if(this._def.coerce&&(a.data=String(a.data)),this._getType(a)!==St.string){const s=this._getOrReturnCtx(a);return vt(s,{code:Ue.invalid_type,expected:St.string,received:s.parsedType}),Xt}const o=new Rr;let l;for(const s of this._def.checks)if(s.kind==="min")a.data.length<s.value&&(l=this._getOrReturnCtx(a,l),vt(l,{code:Ue.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),o.dirty());else if(s.kind==="max")a.data.length>s.value&&(l=this._getOrReturnCtx(a,l),vt(l,{code:Ue.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),o.dirty());else if(s.kind==="length"){const d=a.data.length>s.value,m=a.data.length<s.value;(d||m)&&(l=this._getOrReturnCtx(a,l),d?vt(l,{code:Ue.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):m&&vt(l,{code:Ue.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),o.dirty())}else if(s.kind==="email")L1.test(a.data)||(l=this._getOrReturnCtx(a,l),vt(l,{validation:"email",code:Ue.invalid_string,message:s.message}),o.dirty());else if(s.kind==="emoji")_m||(_m=new RegExp(A1,"u")),_m.test(a.data)||(l=this._getOrReturnCtx(a,l),vt(l,{validation:"emoji",code:Ue.invalid_string,message:s.message}),o.dirty());else if(s.kind==="uuid")C1.test(a.data)||(l=this._getOrReturnCtx(a,l),vt(l,{validation:"uuid",code:Ue.invalid_string,message:s.message}),o.dirty());else if(s.kind==="nanoid")S1.test(a.data)||(l=this._getOrReturnCtx(a,l),vt(l,{validation:"nanoid",code:Ue.invalid_string,message:s.message}),o.dirty());else if(s.kind==="cuid")w1.test(a.data)||(l=this._getOrReturnCtx(a,l),vt(l,{validation:"cuid",code:Ue.invalid_string,message:s.message}),o.dirty());else if(s.kind==="cuid2")E1.test(a.data)||(l=this._getOrReturnCtx(a,l),vt(l,{validation:"cuid2",code:Ue.invalid_string,message:s.message}),o.dirty());else if(s.kind==="ulid")k1.test(a.data)||(l=this._getOrReturnCtx(a,l),vt(l,{validation:"ulid",code:Ue.invalid_string,message:s.message}),o.dirty());else if(s.kind==="url")try{new URL(a.data)}catch{l=this._getOrReturnCtx(a,l),vt(l,{validation:"url",code:Ue.invalid_string,message:s.message}),o.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(a.data)||(l=this._getOrReturnCtx(a,l),vt(l,{validation:"regex",code:Ue.invalid_string,message:s.message}),o.dirty())):s.kind==="trim"?a.data=a.data.trim():s.kind==="includes"?a.data.includes(s.value,s.position)||(l=this._getOrReturnCtx(a,l),vt(l,{code:Ue.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),o.dirty()):s.kind==="toLowerCase"?a.data=a.data.toLowerCase():s.kind==="toUpperCase"?a.data=a.data.toUpperCase():s.kind==="startsWith"?a.data.startsWith(s.value)||(l=this._getOrReturnCtx(a,l),vt(l,{code:Ue.invalid_string,validation:{startsWith:s.value},message:s.message}),o.dirty()):s.kind==="endsWith"?a.data.endsWith(s.value)||(l=this._getOrReturnCtx(a,l),vt(l,{code:Ue.invalid_string,validation:{endsWith:s.value},message:s.message}),o.dirty()):s.kind==="datetime"?h0(s).test(a.data)||(l=this._getOrReturnCtx(a,l),vt(l,{code:Ue.invalid_string,validation:"datetime",message:s.message}),o.dirty()):s.kind==="date"?j1.test(a.data)||(l=this._getOrReturnCtx(a,l),vt(l,{code:Ue.invalid_string,validation:"date",message:s.message}),o.dirty()):s.kind==="time"?O1(s).test(a.data)||(l=this._getOrReturnCtx(a,l),vt(l,{code:Ue.invalid_string,validation:"time",message:s.message}),o.dirty()):s.kind==="duration"?M1.test(a.data)||(l=this._getOrReturnCtx(a,l),vt(l,{validation:"duration",code:Ue.invalid_string,message:s.message}),o.dirty()):s.kind==="ip"?P1(a.data,s.version)||(l=this._getOrReturnCtx(a,l),vt(l,{validation:"ip",code:Ue.invalid_string,message:s.message}),o.dirty()):s.kind==="jwt"?$1(a.data,s.alg)||(l=this._getOrReturnCtx(a,l),vt(l,{validation:"jwt",code:Ue.invalid_string,message:s.message}),o.dirty()):s.kind==="cidr"?R1(a.data,s.version)||(l=this._getOrReturnCtx(a,l),vt(l,{validation:"cidr",code:Ue.invalid_string,message:s.message}),o.dirty()):s.kind==="base64"?z1.test(a.data)||(l=this._getOrReturnCtx(a,l),vt(l,{validation:"base64",code:Ue.invalid_string,message:s.message}),o.dirty()):s.kind==="base64url"?D1.test(a.data)||(l=this._getOrReturnCtx(a,l),vt(l,{validation:"base64url",code:Ue.invalid_string,message:s.message}),o.dirty()):En.assertNever(s);return{status:o.value,value:a.data}}_regex(a,o,l){return this.refinement(s=>a.test(s),{validation:o,code:Ue.invalid_string,...Dt.errToObj(l)})}_addCheck(a){return new zs({...this._def,checks:[...this._def.checks,a]})}email(a){return this._addCheck({kind:"email",...Dt.errToObj(a)})}url(a){return this._addCheck({kind:"url",...Dt.errToObj(a)})}emoji(a){return this._addCheck({kind:"emoji",...Dt.errToObj(a)})}uuid(a){return this._addCheck({kind:"uuid",...Dt.errToObj(a)})}nanoid(a){return this._addCheck({kind:"nanoid",...Dt.errToObj(a)})}cuid(a){return this._addCheck({kind:"cuid",...Dt.errToObj(a)})}cuid2(a){return this._addCheck({kind:"cuid2",...Dt.errToObj(a)})}ulid(a){return this._addCheck({kind:"ulid",...Dt.errToObj(a)})}base64(a){return this._addCheck({kind:"base64",...Dt.errToObj(a)})}base64url(a){return this._addCheck({kind:"base64url",...Dt.errToObj(a)})}jwt(a){return this._addCheck({kind:"jwt",...Dt.errToObj(a)})}ip(a){return this._addCheck({kind:"ip",...Dt.errToObj(a)})}cidr(a){return this._addCheck({kind:"cidr",...Dt.errToObj(a)})}datetime(a){return typeof a=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:a}):this._addCheck({kind:"datetime",precision:typeof a?.precision>"u"?null:a?.precision,offset:a?.offset??!1,local:a?.local??!1,...Dt.errToObj(a?.message)})}date(a){return this._addCheck({kind:"date",message:a})}time(a){return typeof a=="string"?this._addCheck({kind:"time",precision:null,message:a}):this._addCheck({kind:"time",precision:typeof a?.precision>"u"?null:a?.precision,...Dt.errToObj(a?.message)})}duration(a){return this._addCheck({kind:"duration",...Dt.errToObj(a)})}regex(a,o){return this._addCheck({kind:"regex",regex:a,...Dt.errToObj(o)})}includes(a,o){return this._addCheck({kind:"includes",value:a,position:o?.position,...Dt.errToObj(o?.message)})}startsWith(a,o){return this._addCheck({kind:"startsWith",value:a,...Dt.errToObj(o)})}endsWith(a,o){return this._addCheck({kind:"endsWith",value:a,...Dt.errToObj(o)})}min(a,o){return this._addCheck({kind:"min",value:a,...Dt.errToObj(o)})}max(a,o){return this._addCheck({kind:"max",value:a,...Dt.errToObj(o)})}length(a,o){return this._addCheck({kind:"length",value:a,...Dt.errToObj(o)})}nonempty(a){return this.min(1,Dt.errToObj(a))}trim(){return new zs({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new zs({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new zs({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(a=>a.kind==="datetime")}get isDate(){return!!this._def.checks.find(a=>a.kind==="date")}get isTime(){return!!this._def.checks.find(a=>a.kind==="time")}get isDuration(){return!!this._def.checks.find(a=>a.kind==="duration")}get isEmail(){return!!this._def.checks.find(a=>a.kind==="email")}get isURL(){return!!this._def.checks.find(a=>a.kind==="url")}get isEmoji(){return!!this._def.checks.find(a=>a.kind==="emoji")}get isUUID(){return!!this._def.checks.find(a=>a.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(a=>a.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(a=>a.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(a=>a.kind==="cuid2")}get isULID(){return!!this._def.checks.find(a=>a.kind==="ulid")}get isIP(){return!!this._def.checks.find(a=>a.kind==="ip")}get isCIDR(){return!!this._def.checks.find(a=>a.kind==="cidr")}get isBase64(){return!!this._def.checks.find(a=>a.kind==="base64")}get isBase64url(){return!!this._def.checks.find(a=>a.kind==="base64url")}get minLength(){let a=null;for(const o of this._def.checks)o.kind==="min"&&(a===null||o.value>a)&&(a=o.value);return a}get maxLength(){let a=null;for(const o of this._def.checks)o.kind==="max"&&(a===null||o.value<a)&&(a=o.value);return a}};Yo.create=n=>new Yo({checks:[],typeName:Qt.ZodString,coerce:n?.coerce??!1,...sn(n)});function I1(n,a){const o=(n.toString().split(".")[1]||"").length,l=(a.toString().split(".")[1]||"").length,s=o>l?o:l,d=Number.parseInt(n.toFixed(s).replace(".","")),m=Number.parseInt(a.toFixed(s).replace(".",""));return d%m/10**s}var es=class _f extends mn{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(a){if(this._def.coerce&&(a.data=Number(a.data)),this._getType(a)!==St.number){const s=this._getOrReturnCtx(a);return vt(s,{code:Ue.invalid_type,expected:St.number,received:s.parsedType}),Xt}let o;const l=new Rr;for(const s of this._def.checks)s.kind==="int"?En.isInteger(a.data)||(o=this._getOrReturnCtx(a,o),vt(o,{code:Ue.invalid_type,expected:"integer",received:"float",message:s.message}),l.dirty()):s.kind==="min"?(s.inclusive?a.data<s.value:a.data<=s.value)&&(o=this._getOrReturnCtx(a,o),vt(o,{code:Ue.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),l.dirty()):s.kind==="max"?(s.inclusive?a.data>s.value:a.data>=s.value)&&(o=this._getOrReturnCtx(a,o),vt(o,{code:Ue.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),l.dirty()):s.kind==="multipleOf"?I1(a.data,s.value)!==0&&(o=this._getOrReturnCtx(a,o),vt(o,{code:Ue.not_multiple_of,multipleOf:s.value,message:s.message}),l.dirty()):s.kind==="finite"?Number.isFinite(a.data)||(o=this._getOrReturnCtx(a,o),vt(o,{code:Ue.not_finite,message:s.message}),l.dirty()):En.assertNever(s);return{status:l.value,value:a.data}}gte(a,o){return this.setLimit("min",a,!0,Dt.toString(o))}gt(a,o){return this.setLimit("min",a,!1,Dt.toString(o))}lte(a,o){return this.setLimit("max",a,!0,Dt.toString(o))}lt(a,o){return this.setLimit("max",a,!1,Dt.toString(o))}setLimit(a,o,l,s){return new _f({...this._def,checks:[...this._def.checks,{kind:a,value:o,inclusive:l,message:Dt.toString(s)}]})}_addCheck(a){return new _f({...this._def,checks:[...this._def.checks,a]})}int(a){return this._addCheck({kind:"int",message:Dt.toString(a)})}positive(a){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Dt.toString(a)})}negative(a){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Dt.toString(a)})}nonpositive(a){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Dt.toString(a)})}nonnegative(a){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Dt.toString(a)})}multipleOf(a,o){return this._addCheck({kind:"multipleOf",value:a,message:Dt.toString(o)})}finite(a){return this._addCheck({kind:"finite",message:Dt.toString(a)})}safe(a){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Dt.toString(a)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Dt.toString(a)})}get minValue(){let a=null;for(const o of this._def.checks)o.kind==="min"&&(a===null||o.value>a)&&(a=o.value);return a}get maxValue(){let a=null;for(const o of this._def.checks)o.kind==="max"&&(a===null||o.value<a)&&(a=o.value);return a}get isInt(){return!!this._def.checks.find(a=>a.kind==="int"||a.kind==="multipleOf"&&En.isInteger(a.value))}get isFinite(){let a=null,o=null;for(const l of this._def.checks){if(l.kind==="finite"||l.kind==="int"||l.kind==="multipleOf")return!0;l.kind==="min"?(o===null||l.value>o)&&(o=l.value):l.kind==="max"&&(a===null||l.value<a)&&(a=l.value)}return Number.isFinite(o)&&Number.isFinite(a)}};es.create=n=>new es({checks:[],typeName:Qt.ZodNumber,coerce:n?.coerce||!1,...sn(n)});var ts=class Tf extends mn{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(a){if(this._def.coerce)try{a.data=BigInt(a.data)}catch{return this._getInvalidInput(a)}if(this._getType(a)!==St.bigint)return this._getInvalidInput(a);let o;const l=new Rr;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?a.data<s.value:a.data<=s.value)&&(o=this._getOrReturnCtx(a,o),vt(o,{code:Ue.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),l.dirty()):s.kind==="max"?(s.inclusive?a.data>s.value:a.data>=s.value)&&(o=this._getOrReturnCtx(a,o),vt(o,{code:Ue.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),l.dirty()):s.kind==="multipleOf"?a.data%s.value!==BigInt(0)&&(o=this._getOrReturnCtx(a,o),vt(o,{code:Ue.not_multiple_of,multipleOf:s.value,message:s.message}),l.dirty()):En.assertNever(s);return{status:l.value,value:a.data}}_getInvalidInput(a){const o=this._getOrReturnCtx(a);return vt(o,{code:Ue.invalid_type,expected:St.bigint,received:o.parsedType}),Xt}gte(a,o){return this.setLimit("min",a,!0,Dt.toString(o))}gt(a,o){return this.setLimit("min",a,!1,Dt.toString(o))}lte(a,o){return this.setLimit("max",a,!0,Dt.toString(o))}lt(a,o){return this.setLimit("max",a,!1,Dt.toString(o))}setLimit(a,o,l,s){return new Tf({...this._def,checks:[...this._def.checks,{kind:a,value:o,inclusive:l,message:Dt.toString(s)}]})}_addCheck(a){return new Tf({...this._def,checks:[...this._def.checks,a]})}positive(a){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Dt.toString(a)})}negative(a){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Dt.toString(a)})}nonpositive(a){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Dt.toString(a)})}nonnegative(a){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Dt.toString(a)})}multipleOf(a,o){return this._addCheck({kind:"multipleOf",value:a,message:Dt.toString(o)})}get minValue(){let a=null;for(const o of this._def.checks)o.kind==="min"&&(a===null||o.value>a)&&(a=o.value);return a}get maxValue(){let a=null;for(const o of this._def.checks)o.kind==="max"&&(a===null||o.value<a)&&(a=o.value);return a}};ts.create=n=>new ts({checks:[],typeName:Qt.ZodBigInt,coerce:n?.coerce??!1,...sn(n)});var ns=class extends mn{_parse(n){if(this._def.coerce&&(n.data=!!n.data),this._getType(n)!==St.boolean){const a=this._getOrReturnCtx(n);return vt(a,{code:Ue.invalid_type,expected:St.boolean,received:a.parsedType}),Xt}return Nr(n.data)}};ns.create=n=>new ns({typeName:Qt.ZodBoolean,coerce:n?.coerce||!1,...sn(n)});var rs=class db extends mn{_parse(a){if(this._def.coerce&&(a.data=new Date(a.data)),this._getType(a)!==St.date){const s=this._getOrReturnCtx(a);return vt(s,{code:Ue.invalid_type,expected:St.date,received:s.parsedType}),Xt}if(Number.isNaN(a.data.getTime())){const s=this._getOrReturnCtx(a);return vt(s,{code:Ue.invalid_date}),Xt}const o=new Rr;let l;for(const s of this._def.checks)s.kind==="min"?a.data.getTime()<s.value&&(l=this._getOrReturnCtx(a,l),vt(l,{code:Ue.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),o.dirty()):s.kind==="max"?a.data.getTime()>s.value&&(l=this._getOrReturnCtx(a,l),vt(l,{code:Ue.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),o.dirty()):En.assertNever(s);return{status:o.value,value:new Date(a.data.getTime())}}_addCheck(a){return new db({...this._def,checks:[...this._def.checks,a]})}min(a,o){return this._addCheck({kind:"min",value:a.getTime(),message:Dt.toString(o)})}max(a,o){return this._addCheck({kind:"max",value:a.getTime(),message:Dt.toString(o)})}get minDate(){let a=null;for(const o of this._def.checks)o.kind==="min"&&(a===null||o.value>a)&&(a=o.value);return a!=null?new Date(a):null}get maxDate(){let a=null;for(const o of this._def.checks)o.kind==="max"&&(a===null||o.value<a)&&(a=o.value);return a!=null?new Date(a):null}};rs.create=n=>new rs({checks:[],coerce:n?.coerce||!1,typeName:Qt.ZodDate,...sn(n)});var Uu=class extends mn{_parse(n){if(this._getType(n)!==St.symbol){const a=this._getOrReturnCtx(n);return vt(a,{code:Ue.invalid_type,expected:St.symbol,received:a.parsedType}),Xt}return Nr(n.data)}};Uu.create=n=>new Uu({typeName:Qt.ZodSymbol,...sn(n)});var as=class extends mn{_parse(n){if(this._getType(n)!==St.undefined){const a=this._getOrReturnCtx(n);return vt(a,{code:Ue.invalid_type,expected:St.undefined,received:a.parsedType}),Xt}return Nr(n.data)}};as.create=n=>new as({typeName:Qt.ZodUndefined,...sn(n)});var is=class extends mn{_parse(n){if(this._getType(n)!==St.null){const a=this._getOrReturnCtx(n);return vt(a,{code:Ue.invalid_type,expected:St.null,received:a.parsedType}),Xt}return Nr(n.data)}};is.create=n=>new is({typeName:Qt.ZodNull,...sn(n)});var Uo=class extends mn{constructor(){super(...arguments),this._any=!0}_parse(n){return Nr(n.data)}};Uo.create=n=>new Uo({typeName:Qt.ZodAny,...sn(n)});var no=class extends mn{constructor(){super(...arguments),this._unknown=!0}_parse(n){return Nr(n.data)}};no.create=n=>new no({typeName:Qt.ZodUnknown,...sn(n)});var ni=class extends mn{_parse(n){const a=this._getOrReturnCtx(n);return vt(a,{code:Ue.invalid_type,expected:St.never,received:a.parsedType}),Xt}};ni.create=n=>new ni({typeName:Qt.ZodNever,...sn(n)});var Zu=class extends mn{_parse(n){if(this._getType(n)!==St.undefined){const a=this._getOrReturnCtx(n);return vt(a,{code:Ue.invalid_type,expected:St.void,received:a.parsedType}),Xt}return Nr(n.data)}};Zu.create=n=>new Zu({typeName:Qt.ZodVoid,...sn(n)});var ro=class _c extends mn{_parse(a){const{ctx:o,status:l}=this._processInputParams(a),s=this._def;if(o.parsedType!==St.array)return vt(o,{code:Ue.invalid_type,expected:St.array,received:o.parsedType}),Xt;if(s.exactLength!==null){const m=o.data.length>s.exactLength.value,h=o.data.length<s.exactLength.value;(m||h)&&(vt(o,{code:m?Ue.too_big:Ue.too_small,minimum:h?s.exactLength.value:void 0,maximum:m?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),l.dirty())}if(s.minLength!==null&&o.data.length<s.minLength.value&&(vt(o,{code:Ue.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),l.dirty()),s.maxLength!==null&&o.data.length>s.maxLength.value&&(vt(o,{code:Ue.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),l.dirty()),o.common.async)return Promise.all([...o.data].map((m,h)=>s.type._parseAsync(new Aa(o,m,o.path,h)))).then(m=>Rr.mergeArray(l,m));const d=[...o.data].map((m,h)=>s.type._parseSync(new Aa(o,m,o.path,h)));return Rr.mergeArray(l,d)}get element(){return this._def.type}min(a,o){return new _c({...this._def,minLength:{value:a,message:Dt.toString(o)}})}max(a,o){return new _c({...this._def,maxLength:{value:a,message:Dt.toString(o)}})}length(a,o){return new _c({...this._def,exactLength:{value:a,message:Dt.toString(o)}})}nonempty(a){return this.min(1,a)}};ro.create=(n,a)=>new ro({type:n,minLength:null,maxLength:null,exactLength:null,typeName:Qt.ZodArray,...sn(a)});function Zo(n){if(n instanceof ca){const a={};for(const o in n.shape){const l=n.shape[o];a[o]=Na.create(Zo(l))}return new ca({...n._def,shape:()=>a})}else return n instanceof ro?new ro({...n._def,type:Zo(n.element)}):n instanceof Na?Na.create(Zo(n.unwrap())):n instanceof _i?_i.create(Zo(n.unwrap())):n instanceof Ni?Ni.create(n.items.map(a=>Zo(a))):n}var ca=class ka extends mn{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const a=this._def.shape(),o=En.objectKeys(a);return this._cached={shape:a,keys:o},this._cached}_parse(a){if(this._getType(a)!==St.object){const g=this._getOrReturnCtx(a);return vt(g,{code:Ue.invalid_type,expected:St.object,received:g.parsedType}),Xt}const{status:o,ctx:l}=this._processInputParams(a),{shape:s,keys:d}=this._getCached(),m=[];if(!(this._def.catchall instanceof ni&&this._def.unknownKeys==="strip"))for(const g in l.data)d.includes(g)||m.push(g);const h=[];for(const g of d){const v=s[g],w=l.data[g];h.push({key:{status:"valid",value:g},value:v._parse(new Aa(l,w,l.path,g)),alwaysSet:g in l.data})}if(this._def.catchall instanceof ni){const g=this._def.unknownKeys;if(g==="passthrough")for(const v of m)h.push({key:{status:"valid",value:v},value:{status:"valid",value:l.data[v]}});else if(g==="strict")m.length>0&&(vt(l,{code:Ue.unrecognized_keys,keys:m}),o.dirty());else if(g!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const g=this._def.catchall;for(const v of m){const w=l.data[v];h.push({key:{status:"valid",value:v},value:g._parse(new Aa(l,w,l.path,v)),alwaysSet:v in l.data})}}return l.common.async?Promise.resolve().then(async()=>{const g=[];for(const v of h){const w=await v.key,W=await v.value;g.push({key:w,value:W,alwaysSet:v.alwaysSet})}return g}).then(g=>Rr.mergeObjectSync(o,g)):Rr.mergeObjectSync(o,h)}get shape(){return this._def.shape()}strict(a){return Dt.errToObj,new ka({...this._def,unknownKeys:"strict",...a!==void 0?{errorMap:(o,l)=>{const s=this._def.errorMap?.(o,l).message??l.defaultError;return o.code==="unrecognized_keys"?{message:Dt.errToObj(a).message??s}:{message:s}}}:{}})}strip(){return new ka({...this._def,unknownKeys:"strip"})}passthrough(){return new ka({...this._def,unknownKeys:"passthrough"})}extend(a){return new ka({...this._def,shape:()=>({...this._def.shape(),...a})})}merge(a){return new ka({unknownKeys:a._def.unknownKeys,catchall:a._def.catchall,shape:()=>({...this._def.shape(),...a._def.shape()}),typeName:Qt.ZodObject})}setKey(a,o){return this.augment({[a]:o})}catchall(a){return new ka({...this._def,catchall:a})}pick(a){const o={};for(const l of En.objectKeys(a))a[l]&&this.shape[l]&&(o[l]=this.shape[l]);return new ka({...this._def,shape:()=>o})}omit(a){const o={};for(const l of En.objectKeys(this.shape))a[l]||(o[l]=this.shape[l]);return new ka({...this._def,shape:()=>o})}deepPartial(){return Zo(this)}partial(a){const o={};for(const l of En.objectKeys(this.shape)){const s=this.shape[l];a&&!a[l]?o[l]=s:o[l]=s.optional()}return new ka({...this._def,shape:()=>o})}required(a){const o={};for(const l of En.objectKeys(this.shape))if(a&&!a[l])o[l]=this.shape[l];else{let s=this.shape[l];for(;s instanceof Na;)s=s._def.innerType;o[l]=s}return new ka({...this._def,shape:()=>o})}keyof(){return y0(En.objectKeys(this.shape))}};ca.create=(n,a)=>new ca({shape:()=>n,unknownKeys:"strip",catchall:ni.create(),typeName:Qt.ZodObject,...sn(a)}),ca.strictCreate=(n,a)=>new ca({shape:()=>n,unknownKeys:"strict",catchall:ni.create(),typeName:Qt.ZodObject,...sn(a)}),ca.lazycreate=(n,a)=>new ca({shape:n,unknownKeys:"strip",catchall:ni.create(),typeName:Qt.ZodObject,...sn(a)});var os=class extends mn{_parse(n){const{ctx:a}=this._processInputParams(n),o=this._def.options;function l(s){for(const m of s)if(m.result.status==="valid")return m.result;for(const m of s)if(m.result.status==="dirty")return a.common.issues.push(...m.ctx.common.issues),m.result;const d=s.map(m=>new ya(m.ctx.common.issues));return vt(a,{code:Ue.invalid_union,unionErrors:d}),Xt}if(a.common.async)return Promise.all(o.map(async s=>{const d={...a,common:{...a.common,issues:[]},parent:null};return{result:await s._parseAsync({data:a.data,path:a.path,parent:d}),ctx:d}})).then(l);{let s;const d=[];for(const h of o){const g={...a,common:{...a.common,issues:[]},parent:null},v=h._parseSync({data:a.data,path:a.path,parent:g});if(v.status==="valid")return v;v.status==="dirty"&&!s&&(s={result:v,ctx:g}),g.common.issues.length&&d.push(g.common.issues)}if(s)return a.common.issues.push(...s.ctx.common.issues),s.result;const m=d.map(h=>new ya(h));return vt(a,{code:Ue.invalid_union,unionErrors:m}),Xt}}get options(){return this._def.options}};os.create=(n,a)=>new os({options:n,typeName:Qt.ZodUnion,...sn(a)});var Ai=n=>n instanceof ss?Ai(n.schema):n instanceof xa?Ai(n.innerType()):n instanceof us?[n.value]:n instanceof cs?n.options:n instanceof ds?En.objectValues(n.enum):n instanceof ms?Ai(n._def.innerType):n instanceof as?[void 0]:n instanceof is?[null]:n instanceof Na?[void 0,...Ai(n.unwrap())]:n instanceof _i?[null,...Ai(n.unwrap())]:n instanceof Bm||n instanceof ps?Ai(n.unwrap()):n instanceof fs?Ai(n._def.innerType):[],v0=class mb extends mn{_parse(a){const{ctx:o}=this._processInputParams(a);if(o.parsedType!==St.object)return vt(o,{code:Ue.invalid_type,expected:St.object,received:o.parsedType}),Xt;const l=this.discriminator,s=o.data[l],d=this.optionsMap.get(s);return d?o.common.async?d._parseAsync({data:o.data,path:o.path,parent:o}):d._parseSync({data:o.data,path:o.path,parent:o}):(vt(o,{code:Ue.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[l]}),Xt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(a,o,l){const s=new Map;for(const d of o){const m=Ai(d.shape[a]);if(!m.length)throw new Error(`A discriminator value for key \`${a}\` could not be extracted from all schema options`);for(const h of m){if(s.has(h))throw new Error(`Discriminator property ${String(a)} has duplicate value ${String(h)}`);s.set(h,d)}}return new mb({typeName:Qt.ZodDiscriminatedUnion,discriminator:a,options:o,optionsMap:s,...sn(l)})}};function Tm(n,a){const o=ti(n),l=ti(a);if(n===a)return{valid:!0,data:n};if(o===St.object&&l===St.object){const s=En.objectKeys(a),d=En.objectKeys(n).filter(h=>s.indexOf(h)!==-1),m={...n,...a};for(const h of d){const g=Tm(n[h],a[h]);if(!g.valid)return{valid:!1};m[h]=g.data}return{valid:!0,data:m}}else if(o===St.array&&l===St.array){if(n.length!==a.length)return{valid:!1};const s=[];for(let d=0;d<n.length;d++){const m=n[d],h=a[d],g=Tm(m,h);if(!g.valid)return{valid:!1};s.push(g.data)}return{valid:!0,data:s}}else return o===St.date&&l===St.date&&+n==+a?{valid:!0,data:n}:{valid:!1}}var ls=class extends mn{_parse(n){const{status:a,ctx:o}=this._processInputParams(n),l=(s,d)=>{if(Am(s)||Am(d))return Xt;const m=Tm(s.value,d.value);return m.valid?((Nm(s)||Nm(d))&&a.dirty(),{status:a.value,value:m.data}):(vt(o,{code:Ue.invalid_intersection_types}),Xt)};return o.common.async?Promise.all([this._def.left._parseAsync({data:o.data,path:o.path,parent:o}),this._def.right._parseAsync({data:o.data,path:o.path,parent:o})]).then(([s,d])=>l(s,d)):l(this._def.left._parseSync({data:o.data,path:o.path,parent:o}),this._def.right._parseSync({data:o.data,path:o.path,parent:o}))}};ls.create=(n,a,o)=>new ls({left:n,right:a,typeName:Qt.ZodIntersection,...sn(o)});var Ni=class fb extends mn{_parse(a){const{status:o,ctx:l}=this._processInputParams(a);if(l.parsedType!==St.array)return vt(l,{code:Ue.invalid_type,expected:St.array,received:l.parsedType}),Xt;if(l.data.length<this._def.items.length)return vt(l,{code:Ue.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Xt;!this._def.rest&&l.data.length>this._def.items.length&&(vt(l,{code:Ue.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),o.dirty());const s=[...l.data].map((d,m)=>{const h=this._def.items[m]||this._def.rest;return h?h._parse(new Aa(l,d,l.path,m)):null}).filter(d=>!!d);return l.common.async?Promise.all(s).then(d=>Rr.mergeArray(o,d)):Rr.mergeArray(o,s)}get items(){return this._def.items}rest(a){return new fb({...this._def,rest:a})}};Ni.create=(n,a)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ni({items:n,typeName:Qt.ZodTuple,rest:null,...sn(a)})};var g0=class Bf extends mn{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(a){const{status:o,ctx:l}=this._processInputParams(a);if(l.parsedType!==St.object)return vt(l,{code:Ue.invalid_type,expected:St.object,received:l.parsedType}),Xt;const s=[],d=this._def.keyType,m=this._def.valueType;for(const h in l.data)s.push({key:d._parse(new Aa(l,h,l.path,h)),value:m._parse(new Aa(l,l.data[h],l.path,h)),alwaysSet:h in l.data});return l.common.async?Rr.mergeObjectAsync(o,s):Rr.mergeObjectSync(o,s)}get element(){return this._def.valueType}static create(a,o,l){return o instanceof mn?new Bf({keyType:a,valueType:o,typeName:Qt.ZodRecord,...sn(l)}):new Bf({keyType:Yo.create(),valueType:a,typeName:Qt.ZodRecord,...sn(o)})}},Ku=class extends mn{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(n){const{status:a,ctx:o}=this._processInputParams(n);if(o.parsedType!==St.map)return vt(o,{code:Ue.invalid_type,expected:St.map,received:o.parsedType}),Xt;const l=this._def.keyType,s=this._def.valueType,d=[...o.data.entries()].map(([m,h],g)=>({key:l._parse(new Aa(o,m,o.path,[g,"key"])),value:s._parse(new Aa(o,h,o.path,[g,"value"]))}));if(o.common.async){const m=new Map;return Promise.resolve().then(async()=>{for(const h of d){const g=await h.key,v=await h.value;if(g.status==="aborted"||v.status==="aborted")return Xt;(g.status==="dirty"||v.status==="dirty")&&a.dirty(),m.set(g.value,v.value)}return{status:a.value,value:m}})}else{const m=new Map;for(const h of d){const g=h.key,v=h.value;if(g.status==="aborted"||v.status==="aborted")return Xt;(g.status==="dirty"||v.status==="dirty")&&a.dirty(),m.set(g.value,v.value)}return{status:a.value,value:m}}}};Ku.create=(n,a,o)=>new Ku({valueType:a,keyType:n,typeName:Qt.ZodMap,...sn(o)});var Gu=class zf extends mn{_parse(a){const{status:o,ctx:l}=this._processInputParams(a);if(l.parsedType!==St.set)return vt(l,{code:Ue.invalid_type,expected:St.set,received:l.parsedType}),Xt;const s=this._def;s.minSize!==null&&l.data.size<s.minSize.value&&(vt(l,{code:Ue.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),o.dirty()),s.maxSize!==null&&l.data.size>s.maxSize.value&&(vt(l,{code:Ue.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),o.dirty());const d=this._def.valueType;function m(g){const v=new Set;for(const w of g){if(w.status==="aborted")return Xt;w.status==="dirty"&&o.dirty(),v.add(w.value)}return{status:o.value,value:v}}const h=[...l.data.values()].map((g,v)=>d._parse(new Aa(l,g,l.path,v)));return l.common.async?Promise.all(h).then(g=>m(g)):m(h)}min(a,o){return new zf({...this._def,minSize:{value:a,message:Dt.toString(o)}})}max(a,o){return new zf({...this._def,maxSize:{value:a,message:Dt.toString(o)}})}size(a,o){return this.min(a,o).max(a,o)}nonempty(a){return this.min(1,a)}};Gu.create=(n,a)=>new Gu({valueType:n,minSize:null,maxSize:null,typeName:Qt.ZodSet,...sn(a)});var b0=class Tc extends mn{constructor(){super(...arguments),this.validate=this.implement}_parse(a){const{ctx:o}=this._processInputParams(a);if(o.parsedType!==St.function)return vt(o,{code:Ue.invalid_type,expected:St.function,received:o.parsedType}),Xt;function l(h,g){return qu({data:h,path:o.path,errorMaps:[o.common.contextualErrorMap,o.schemaErrorMap,Wu(),qo].filter(v=>!!v),issueData:{code:Ue.invalid_arguments,argumentsError:g}})}function s(h,g){return qu({data:h,path:o.path,errorMaps:[o.common.contextualErrorMap,o.schemaErrorMap,Wu(),qo].filter(v=>!!v),issueData:{code:Ue.invalid_return_type,returnTypeError:g}})}const d={errorMap:o.common.contextualErrorMap},m=o.data;if(this._def.returns instanceof Ko){const h=this;return Nr(async function(...g){const v=new ya([]),w=await h._def.args.parseAsync(g,d).catch(S=>{throw v.addIssue(l(g,S)),v}),W=await Reflect.apply(m,this,w);return await h._def.returns._def.type.parseAsync(W,d).catch(S=>{throw v.addIssue(s(W,S)),v})})}else{const h=this;return Nr(function(...g){const v=h._def.args.safeParse(g,d);if(!v.success)throw new ya([l(g,v.error)]);const w=Reflect.apply(m,this,v.data),W=h._def.returns.safeParse(w,d);if(!W.success)throw new ya([s(w,W.error)]);return W.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...a){return new Tc({...this._def,args:Ni.create(a).rest(no.create())})}returns(a){return new Tc({...this._def,returns:a})}implement(a){return this.parse(a)}strictImplement(a){return this.parse(a)}static create(a,o,l){return new Tc({args:a||Ni.create([]).rest(no.create()),returns:o||no.create(),typeName:Qt.ZodFunction,...sn(l)})}},ss=class extends mn{get schema(){return this._def.getter()}_parse(n){const{ctx:a}=this._processInputParams(n);return this._def.getter()._parse({data:a.data,path:a.path,parent:a})}};ss.create=(n,a)=>new ss({getter:n,typeName:Qt.ZodLazy,...sn(a)});var us=class extends mn{_parse(n){if(n.data!==this._def.value){const a=this._getOrReturnCtx(n);return vt(a,{received:a.data,code:Ue.invalid_literal,expected:this._def.value}),Xt}return{status:"valid",value:n.data}}get value(){return this._def.value}};us.create=(n,a)=>new us({value:n,typeName:Qt.ZodLiteral,...sn(a)});function y0(n,a){return new cs({values:n,typeName:Qt.ZodEnum,...sn(a)})}var cs=class Df extends mn{_parse(a){if(typeof a.data!="string"){const o=this._getOrReturnCtx(a),l=this._def.values;return vt(o,{expected:En.joinValues(l),received:o.parsedType,code:Ue.invalid_type}),Xt}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(a.data)){const o=this._getOrReturnCtx(a),l=this._def.values;return vt(o,{received:o.data,code:Ue.invalid_enum_value,options:l}),Xt}return Nr(a.data)}get options(){return this._def.values}get enum(){const a={};for(const o of this._def.values)a[o]=o;return a}get Values(){const a={};for(const o of this._def.values)a[o]=o;return a}get Enum(){const a={};for(const o of this._def.values)a[o]=o;return a}extract(a,o=this._def){return Df.create(a,{...this._def,...o})}exclude(a,o=this._def){return Df.create(this.options.filter(l=>!a.includes(l)),{...this._def,...o})}};cs.create=y0;var ds=class extends mn{_parse(n){const a=En.getValidEnumValues(this._def.values),o=this._getOrReturnCtx(n);if(o.parsedType!==St.string&&o.parsedType!==St.number){const l=En.objectValues(a);return vt(o,{expected:En.joinValues(l),received:o.parsedType,code:Ue.invalid_type}),Xt}if(this._cache||(this._cache=new Set(En.getValidEnumValues(this._def.values))),!this._cache.has(n.data)){const l=En.objectValues(a);return vt(o,{received:o.data,code:Ue.invalid_enum_value,options:l}),Xt}return Nr(n.data)}get enum(){return this._def.values}};ds.create=(n,a)=>new ds({values:n,typeName:Qt.ZodNativeEnum,...sn(a)});var Ko=class extends mn{unwrap(){return this._def.type}_parse(n){const{ctx:a}=this._processInputParams(n);if(a.parsedType!==St.promise&&a.common.async===!1)return vt(a,{code:Ue.invalid_type,expected:St.promise,received:a.parsedType}),Xt;const o=a.parsedType===St.promise?a.data:Promise.resolve(a.data);return Nr(o.then(l=>this._def.type.parseAsync(l,{path:a.path,errorMap:a.common.contextualErrorMap})))}};Ko.create=(n,a)=>new Ko({type:n,typeName:Qt.ZodPromise,...sn(a)});var xa=class extends mn{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Qt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(n){const{status:a,ctx:o}=this._processInputParams(n),l=this._def.effect||null,s={addIssue:d=>{vt(o,d),d.fatal?a.abort():a.dirty()},get path(){return o.path}};if(s.addIssue=s.addIssue.bind(s),l.type==="preprocess"){const d=l.transform(o.data,s);if(o.common.async)return Promise.resolve(d).then(async m=>{if(a.value==="aborted")return Xt;const h=await this._def.schema._parseAsync({data:m,path:o.path,parent:o});return h.status==="aborted"?Xt:h.status==="dirty"||a.value==="dirty"?Yu(h.value):h});{if(a.value==="aborted")return Xt;const m=this._def.schema._parseSync({data:d,path:o.path,parent:o});return m.status==="aborted"?Xt:m.status==="dirty"||a.value==="dirty"?Yu(m.value):m}}if(l.type==="refinement"){const d=m=>{const h=l.refinement(m,s);if(o.common.async)return Promise.resolve(h);if(h instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return m};if(o.common.async===!1){const m=this._def.schema._parseSync({data:o.data,path:o.path,parent:o});return m.status==="aborted"?Xt:(m.status==="dirty"&&a.dirty(),d(m.value),{status:a.value,value:m.value})}else return this._def.schema._parseAsync({data:o.data,path:o.path,parent:o}).then(m=>m.status==="aborted"?Xt:(m.status==="dirty"&&a.dirty(),d(m.value).then(()=>({status:a.value,value:m.value}))))}if(l.type==="transform")if(o.common.async===!1){const d=this._def.schema._parseSync({data:o.data,path:o.path,parent:o});if(!to(d))return Xt;const m=l.transform(d.value,s);if(m instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:a.value,value:m}}else return this._def.schema._parseAsync({data:o.data,path:o.path,parent:o}).then(d=>to(d)?Promise.resolve(l.transform(d.value,s)).then(m=>({status:a.value,value:m})):Xt);En.assertNever(l)}};xa.create=(n,a,o)=>new xa({schema:n,typeName:Qt.ZodEffects,effect:a,...sn(o)}),xa.createWithPreprocess=(n,a,o)=>new xa({schema:a,effect:{type:"preprocess",transform:n},typeName:Qt.ZodEffects,...sn(o)});var Na=class extends mn{_parse(n){return this._getType(n)===St.undefined?Nr(void 0):this._def.innerType._parse(n)}unwrap(){return this._def.innerType}};Na.create=(n,a)=>new Na({innerType:n,typeName:Qt.ZodOptional,...sn(a)});var _i=class extends mn{_parse(n){return this._getType(n)===St.null?Nr(null):this._def.innerType._parse(n)}unwrap(){return this._def.innerType}};_i.create=(n,a)=>new _i({innerType:n,typeName:Qt.ZodNullable,...sn(a)});var ms=class extends mn{_parse(n){const{ctx:a}=this._processInputParams(n);let o=a.data;return a.parsedType===St.undefined&&(o=this._def.defaultValue()),this._def.innerType._parse({data:o,path:a.path,parent:a})}removeDefault(){return this._def.innerType}};ms.create=(n,a)=>new ms({innerType:n,typeName:Qt.ZodDefault,defaultValue:typeof a.default=="function"?a.default:()=>a.default,...sn(a)});var fs=class extends mn{_parse(n){const{ctx:a}=this._processInputParams(n),o={...a,common:{...a.common,issues:[]}},l=this._def.innerType._parse({data:o.data,path:o.path,parent:{...o}});return Jl(l)?l.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new ya(o.common.issues)},input:o.data})})):{status:"valid",value:l.status==="valid"?l.value:this._def.catchValue({get error(){return new ya(o.common.issues)},input:o.data})}}removeCatch(){return this._def.innerType}};fs.create=(n,a)=>new fs({innerType:n,typeName:Qt.ZodCatch,catchValue:typeof a.catch=="function"?a.catch:()=>a.catch,...sn(a)});var Xu=class extends mn{_parse(n){if(this._getType(n)!==St.nan){const a=this._getOrReturnCtx(n);return vt(a,{code:Ue.invalid_type,expected:St.nan,received:a.parsedType}),Xt}return{status:"valid",value:n.data}}};Xu.create=n=>new Xu({typeName:Qt.ZodNaN,...sn(n)});var H1=Symbol("zod_brand"),Bm=class extends mn{_parse(n){const{ctx:a}=this._processInputParams(n),o=a.data;return this._def.type._parse({data:o,path:a.path,parent:a})}unwrap(){return this._def.type}},zm=class pb extends mn{_parse(a){const{status:o,ctx:l}=this._processInputParams(a);if(l.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:l.data,path:l.path,parent:l});return s.status==="aborted"?Xt:s.status==="dirty"?(o.dirty(),Yu(s.value)):this._def.out._parseAsync({data:s.value,path:l.path,parent:l})})();{const s=this._def.in._parseSync({data:l.data,path:l.path,parent:l});return s.status==="aborted"?Xt:s.status==="dirty"?(o.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:l.path,parent:l})}}static create(a,o){return new pb({in:a,out:o,typeName:Qt.ZodPipeline})}},ps=class extends mn{_parse(n){const a=this._def.innerType._parse(n),o=l=>(to(l)&&(l.value=Object.freeze(l.value)),l);return Jl(a)?a.then(l=>o(l)):o(a)}unwrap(){return this._def.innerType}};ps.create=(n,a)=>new ps({innerType:n,typeName:Qt.ZodReadonly,...sn(a)});function x0(n,a){const o=typeof n=="function"?n(a):typeof n=="string"?{message:n}:n;return typeof o=="string"?{message:o}:o}function w0(n,a={},o){return n?Uo.create().superRefine((l,s)=>{const d=n(l);if(d instanceof Promise)return d.then(m=>{if(!m){const h=x0(a,l),g=h.fatal??o??!0;s.addIssue({code:"custom",...h,fatal:g})}});if(!d){const m=x0(a,l),h=m.fatal??o??!0;s.addIssue({code:"custom",...m,fatal:h})}}):Uo.create()}var V1={object:ca.lazycreate},Qt;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(Qt||(Qt={}));var W1=(n,a={message:`Input not instance of ${n.name}`})=>w0(o=>o instanceof n,a),E0=Yo.create,k0=es.create,q1=Xu.create,Y1=ts.create,C0=ns.create,U1=rs.create,Z1=Uu.create,K1=as.create,G1=is.create,X1=Uo.create,Q1=no.create,J1=ni.create,ex=Zu.create,tx=ro.create,nx=ca.create,rx=ca.strictCreate,ax=os.create,ix=v0.create,ox=ls.create,lx=Ni.create,sx=g0.create,ux=Ku.create,cx=Gu.create,dx=b0.create,mx=ss.create,fx=us.create,px=cs.create,hx=ds.create,vx=Ko.create,S0=xa.create,gx=Na.create,bx=_i.create,yx=xa.createWithPreprocess,xx=zm.create,wx=()=>E0().optional(),Ex=()=>k0().optional(),kx=()=>C0().optional(),Cx={string:(n=>Yo.create({...n,coerce:!0})),number:(n=>es.create({...n,coerce:!0})),boolean:(n=>ns.create({...n,coerce:!0})),bigint:(n=>ts.create({...n,coerce:!0})),date:(n=>rs.create({...n,coerce:!0}))},Sx=Xt,hs={color:ce.string().max(32),width:ce.number().positive().max(200)},ri={rotation:ce.number().min(-180).max(180).optional()},ao={startAt:ce.number().min(0).optional(),endAt:ce.number().min(0).optional(),timelineTrack:ce.number().int().min(0).max(99).optional()},Fx=ce.discriminatedUnion("type",[ce.object({type:ce.literal("pen"),points:ce.array(ce.number()).min(4),...hs,...ao,...ri}),ce.object({type:ce.literal("line"),x1:ce.number(),y1:ce.number(),x2:ce.number(),y2:ce.number(),...hs,...ao,...ri}),ce.object({type:ce.literal("arrow"),x1:ce.number(),y1:ce.number(),x2:ce.number(),y2:ce.number(),...hs,...ao,...ri}),ce.object({type:ce.literal("rect"),x:ce.number(),y:ce.number(),w:ce.number(),h:ce.number(),...hs,...ao,...ri}),ce.object({type:ce.literal("ellipse"),x:ce.number(),y:ce.number(),w:ce.number(),h:ce.number(),...hs,...ao,...ri}),ce.object({type:ce.literal("text"),x:ce.number(),y:ce.number(),text:ce.string().max(500),color:ce.string().max(32),fontSize:ce.number().positive().max(512),startAt:ce.number().min(0).optional(),endAt:ce.number().min(0).optional(),timelineTrack:ce.number().int().min(0).max(99).optional(),...ri}),ce.object({type:ce.literal("sticker"),x:ce.number().optional(),y:ce.number().optional(),w:ce.number().positive().optional(),h:ce.number().positive().optional(),emoji:ce.string().max(16).optional(),src:ce.string().optional(),startAt:ce.number().min(0).optional(),endAt:ce.number().min(0).optional(),timelineTrack:ce.number().int().min(0).max(99).optional(),...ri}),ce.object({type:ce.literal("filter"),x:ce.number().optional(),y:ce.number().optional(),w:ce.number().positive().optional(),h:ce.number().positive().optional(),filterPreset:ce.string().max(32).optional(),...ao,...ri}),ce.object({type:ce.literal("adjust"),x:ce.number(),y:ce.number(),w:ce.number().positive(),h:ce.number().positive(),brightness:ce.number().min(-1).max(1).default(0),contrast:ce.number().min(-1).max(1).default(0),saturation:ce.number().min(-1).max(1).default(0),temperature:ce.number().min(-1).max(1).default(0),tint:ce.number().min(-1).max(1).default(0),vibrance:ce.number().min(-1).max(1).default(0),gamma:ce.number().min(-1).max(1).default(0),highlights:ce.number().min(-1).max(1).default(0),shadows:ce.number().min(-1).max(1).default(0),whites:ce.number().min(-1).max(1).default(0),blacks:ce.number().min(-1).max(1).default(0),lightSense:ce.number().min(-1).max(1).default(0),sharpen:ce.number().min(0).max(1).default(0),clarity:ce.number().min(0).max(1).default(0),grain:ce.number().min(0).max(1).default(0),fade:ce.number().min(0).max(1).default(0),vignette:ce.number().min(0).max(1).default(0),...ao,...ri})]),Mx=ce.object({srcIdx:ce.number().int().min(0).max(7),in:ce.number().min(0),out:ce.number().min(0)}),Lx=ce.object({srcIdx:ce.number().int().min(0).max(2),track:ce.number().int().min(0).default(0),startAt:ce.number().min(0),in:ce.number().min(0),out:ce.number().min(0),speed:ce.number().min(.5).max(2).default(1),volume:ce.number().min(0).max(2),fadeIn:ce.number().min(0).default(0),fadeOut:ce.number().min(0).default(0)}),Ax=ce.object({type:ce.enum(["none","fade","slide","wipe","flip","clockWipe","star","circle","rectangle"]).default("none"),duration:ce.number().min(0).max(2).default(.4)}),Nx=ce.object({fileName:ce.string().max(120).optional(),format:ce.enum(["mp4","mov","mxf"]).default("mp4"),width:ce.number().int().min(2).max(8192).optional(),height:ce.number().int().min(2).max(8192).optional(),frameRate:ce.number().int().min(12).max(120).default(30),videoBitrateKbps:ce.number().int().min(100).max(5e4).optional(),audioBitrateKbps:ce.number().int().min(32).max(1024).optional(),audioCodec:ce.enum(["aac","mp3"]).default("aac")}).optional(),_x=ce.object({clips:ce.array(Mx).min(1).max(50),audioClips:ce.array(Lx).max(8).default([]),canvas:ce.object({w:ce.number().int().min(2).max(4096),h:ce.number().int().min(2).max(4096)}),crop:ce.object({x:ce.number().min(0),y:ce.number().min(0),width:ce.number().positive(),height:ce.number().positive()}).optional(),scale:ce.object({width:ce.number().positive(),height:ce.number().positive(),fit:ce.enum(["contain","cover","force"])}).optional(),rotation:ce.number().min(-180).max(180).default(0),flipX:ce.boolean().default(!1),flipY:ce.boolean().default(!1),filters:ce.object({brightness:ce.number().min(-1).max(1).default(0),contrast:ce.number().min(-1).max(1).default(0),saturation:ce.number().min(-1).max(1).default(0),temperature:ce.number().min(-1).max(1).default(0),tint:ce.number().min(-1).max(1).default(0),vibrance:ce.number().min(-1).max(1).default(0),gamma:ce.number().min(-1).max(1).default(0),highlights:ce.number().min(-1).max(1).default(0),shadows:ce.number().min(-1).max(1).default(0),whites:ce.number().min(-1).max(1).default(0),blacks:ce.number().min(-1).max(1).default(0),lightSense:ce.number().min(-1).max(1).default(0),sharpen:ce.number().min(0).max(1).default(0),clarity:ce.number().min(0).max(1).default(0),grain:ce.number().min(0).max(1).default(0),fade:ce.number().min(0).max(1).default(0),vignette:ce.number().min(0).max(1).default(0)}).default({brightness:0,contrast:0,saturation:0,temperature:0,tint:0,vibrance:0,gamma:0,highlights:0,shadows:0,whites:0,blacks:0,lightSense:0,sharpen:0,clarity:0,grain:0,fade:0,vignette:0}),filterPreset:ce.string().max(32).optional(),overlays:ce.array(Fx).max(200).optional(),transitions:ce.array(Ax).max(49).default([]),keepAudio:ce.boolean().default(!0),poster:ce.object({time:ce.number().min(0),useAsVideoCover:ce.boolean().optional(),preview:ce.string().optional()}).optional(),exportSettings:Nx}).superRefine((n,a)=>{n.clips.forEach((o,l)=>{o.out<=o.in&&a.addIssue({code:ce.ZodIssueCode.custom,message:`clips[${l}].out \u5FC5\u987B\u5927\u4E8E in`,path:["clips",l,"out"]})}),n.audioClips?.forEach((o,l)=>{o.out<=o.in&&a.addIssue({code:ce.ZodIssueCode.custom,message:`audioClips[${l}].out \u5FC5\u987B\u5927\u4E8E in`,path:["audioClips",l,"out"]})}),(n.canvas.w%2!==0||n.canvas.h%2!==0)&&a.addIssue({code:ce.ZodIssueCode.custom,message:"canvas \u5BBD\u9AD8\u5FC5\u987B\u4E3A\u5076\u6570",path:["canvas"]}),n.exportSettings?.width!=null&&n.exportSettings.width%2!==0&&a.addIssue({code:ce.ZodIssueCode.custom,message:"exportSettings.width \u5FC5\u987B\u4E3A\u5076\u6570",path:["exportSettings","width"]}),n.exportSettings?.height!=null&&n.exportSettings.height%2!==0&&a.addIssue({code:ce.ZodIssueCode.custom,message:"exportSettings.height \u5FC5\u987B\u4E3A\u5076\u6570",path:["exportSettings","height"]})});function Qu(){return{clips:[],audioClips:[],canvas:{w:2,h:2},rotation:0,flipX:!1,flipY:!1,filters:{brightness:0,contrast:0,saturation:0,temperature:0,tint:0,vibrance:0,gamma:0,highlights:0,shadows:0,whites:0,blacks:0,lightSense:0,sharpen:0,clarity:0,grain:0,fade:0,vignette:0},transitions:[],keepAudio:!0}}var Ti=.1;function vs(n){return n.out-n.in}function ai(n){return n.reduce((a,o)=>a+vs(o),0)}function Ju(n,a){let o=0;for(let l=0;l<a&&l<n.length;l++)o+=vs(n[l]);return o}function io(n,a){if(!n.length||a<0)return null;let o=0;for(let l=0;l<n.length;l++){const s=vs(n[l]);if(a<o+s)return{idx:l,srcTime:n[l].in+(a-o)};o+=s}if(Math.abs(a-o)<1e-9||a<=o){const l=n.length-1;return{idx:l,srcTime:n[l].out}}return null}function Tx(n,a){const o=io(n,a);if(!o)return n;const l=n[o.idx];return o.srcTime<l.in+Ti||o.srcTime>l.out-Ti?n:[...n.slice(0,o.idx),{...l,out:o.srcTime},{...l,in:o.srcTime},...n.slice(o.idx+1)]}function Bx(n,a){return n.length<=1||!n[a]?n:n.filter((o,l)=>l!==a)}function zx(n,a){const o=n[a];return o?[...n.slice(0,a+1),{...o},...n.slice(a+1)]:n}function F0(n,a,o){if(a===o||!n[a]||o<0||o>=n.length)return n;const l=[...n],[s]=l.splice(a,1);return l.splice(o,0,s),l}function M0(n,a,o,l,s){if(!n[a])return n;const d=n.map(m=>({...m}));return o==="in"?d[a].in=Math.min(Math.max(l,0),d[a].out-Ti):d[a].out=Math.max(Math.min(l,s),d[a].in+Ti),d}function gs(n,a,o){const l=Math.max(Math.min(n.out,a),Ti),s=Math.min(Math.max(n.in,0),l-Ti),d=Math.min(Math.max(n.startAt,0),Math.max(0,o-Ti)),m=Math.max(Ti,l-s),h=Math.min(Math.max(Number(n.speed)||1,.5),2),g=Number.isInteger(n.track)&&n.track>=0?n.track:0,v=Math.min(Math.max(Number(n.fadeIn)||0,0),m),w=Math.min(Math.max(Number(n.fadeOut)||0,0),Math.max(0,m-v));return{...n,track:g,in:s,out:l,startAt:d,speed:h,fadeIn:v,fadeOut:w}}function Dx(n=[]){return(n??[]).reduce((a,o)=>{if(o?.type!=="text"&&o?.type!=="sticker")return a;const l=Number.isFinite(o?.startAt)?Math.max(0,Number(o.startAt)):0,s=Number.isFinite(o?.endAt)?Math.max(l,Number(o.endAt)):l;return Math.max(a,s)},0)}function Dm(n,a=[],o=[]){const l=ai(n),s=a.reduce((m,h)=>Math.max(m,h.startAt+(h.out-h.in)),0),d=Dx(o);return Math.max(l,s,d)}function L0(n){return[...new Set(n.map(a=>a.srcIdx))].sort((a,o)=>a-o)}function jx(n,a){const o=new Map(a.map((l,s)=>[l,s]));return n.map(l=>({...l,srcIdx:o.get(l.srcIdx)??0}))}var Ox=100;function jm(n){return{past:[],present:n,future:[]}}function A0(n,a){if(a===n.present)return n;const o=[...n.past,n.present];return o.length>Ox&&o.shift(),{past:o,present:a,future:[]}}function N0(n,a){return a===n.present?n:{...n,present:a}}function _0(n){return n.past.length>0}function T0(n){return n.future.length>0}function Px(n){return _0(n)?{past:n.past.slice(0,-1),present:n.past[n.past.length-1],future:[n.present,...n.future]}:n}function $x(n){if(!T0(n))return n;const[a,...o]=n.future;return{past:[...n.past,n.present],present:a,future:o}}function B0(n){const a=Math.min(Math.max(Math.round(n),2),4096);return a%2===0?a:a-1}var z0=n=>Math.min(Math.max(n,-180),180),Om=class{constructor(n=Qu()){this.videoSources=[],this.audioSources=[],this.listeners=new Set,this.transientBase=null,this.getSnapshot=()=>this.history.present,this.subscribe=a=>(this.listeners.add(a),()=>this.listeners.delete(a)),this.history=jm(n)}getState(){return this.history.present}emit(){const n=this.history.present;for(const a of this.listeners)a(n)}canUndo(){return _0(this.history)}canRedo(){return T0(this.history)}undo(){this.transientBase=null,this.history=Px(this.history),this.emit()}redo(){this.transientBase=null,this.history=$x(this.history),this.emit()}applyMut(n,a=!1){if(a)this.transientBase===null&&(this.transientBase=this.history.present),this.history=N0(this.history,n(this.transientBase));else{const o=this.transientBase??this.history.present,l=n(o),s=this.transientBase?{...this.history,present:this.transientBase}:this.history;this.history=A0(s,l),this.transientBase=null}this.emit()}registerVideoSource(n){const a=this.videoSources.length;this.videoSources.push(n);const o={srcIdx:a,in:0,out:n.duration};return a===0||this.history.present.clips.length===0?(this.transientBase=null,this.history=jm({...Qu(),clips:[o],canvas:{w:B0(n.width),h:B0(n.height)},poster:{time:Math.min(1,n.duration/2)}}),this.emit()):this.applyMut(l=>({...l,clips:[...l.clips,o]})),a}registerAudioSource(n){const a=this.audioSources.length;return this.audioSources.push(n),this.applyMut(o=>{const l=new Set((o.audioClips??[]).map((m,h)=>Number.isInteger(m?.track)&&m.track>=0?m.track:h));let s=0;for(;l.has(s);)s+=1;const d=gs({srcIdx:a,track:s,startAt:0,in:0,out:n.duration,volume:1},n.duration,ai(o.clips));return{...o,audioClips:[...o.audioClips,d]}}),a}getVideoSource(n){return this.videoSources[n]}getAudioSource(n){return this.audioSources[n]}addClipFromSource(n){const a=this.videoSources[n];a&&this.applyMut(o=>({...o,clips:[...o.clips,{srcIdx:n,in:0,out:a.duration}]}))}splitAtPlayhead(n){this.applyMut(a=>({...a,clips:Tx(a.clips,n)}))}removeClip(n){this.applyMut(a=>({...a,clips:Bx(a.clips,n)}))}duplicateClip(n){this.applyMut(a=>({...a,clips:zx(a.clips,n)}))}reorderClips(n,a){this.applyMut(o=>({...o,clips:F0(o.clips,n,a)}))}trimClip(n,a,o,l){this.applyMut(s=>{const d=s.clips[n];if(!d)return s;const m=this.videoSources[d.srcIdx]?.duration??d.out;return{...s,clips:M0(s.clips,n,a,o,m)}},l?.transient)}moveAudioClip(n,a,o){this.applyMut(l=>this.patchAudio(l,n,s=>({...s,startAt:a})),o?.transient)}trimAudioClip(n,a,o,l){this.applyMut(s=>this.patchAudio(s,n,d=>{if(a==="in"){const m=o-d.in;return{...d,in:o,startAt:d.startAt+m}}return{...d,out:o}}),l?.transient)}setAudioVolume(n,a,o){this.applyMut(l=>this.patchAudio(l,n,s=>({...s,volume:a}),!1),o?.transient)}removeAudioClip(n){this.applyMut(a=>({...a,audioClips:a.audioClips.filter((o,l)=>l!==n)}))}patchAudio(n,a,o,l=!0){const s=n.audioClips[a];if(!s)return n;let d=o(s);if(l){const m=this.audioSources[s.srcIdx]?.duration??s.out;d=gs(d,m,ai(n.clips))}return{...n,audioClips:n.audioClips.map((m,h)=>h===a?d:m)}}setCrop(n,a){this.applyMut(o=>({...o,crop:n}),a?.transient)}clearCrop(){this.applyMut(n=>({...n,crop:void 0}))}setScale(n){this.applyMut(a=>({...a,scale:n}))}clearScale(){this.applyMut(n=>({...n,scale:void 0}))}setRotation(n,a){this.applyMut(o=>({...o,rotation:z0(n)}),a?.transient)}rotateBy(n){this.applyMut(a=>{let o=a.rotation+n;return o>180&&(o-=360),o<-180&&(o+=360),{...a,rotation:z0(o)}})}flipX(){this.applyMut(n=>({...n,flipX:!n.flipX}))}flipY(){this.applyMut(n=>({...n,flipY:!n.flipY}))}setFilter(n,a,o){this.applyMut(l=>({...l,filters:{...l.filters,[n]:a}}),o?.transient)}setFilters(n,a){this.applyMut(o=>({...o,filters:{...o.filters,...n}}),a?.transient)}setFilterPreset(n){this.applyMut(a=>({...a,filterPreset:n}))}addOverlay(n){this.applyMut(a=>({...a,overlays:[...a.overlays??[],n]}))}updateOverlay(n,a,o){this.applyMut(l=>{const s=l.overlays??[];return s[n]?{...l,overlays:s.map((d,m)=>m===n?{...d,...a}:d)}:l},o?.transient)}removeOverlay(n){this.applyMut(a=>({...a,overlays:(a.overlays??[]).filter((o,l)=>l!==n)}))}patch(n,a){a?.transient?(this.transientBase===null&&(this.transientBase=this.history.present),this.history=N0(this.history,{...this.transientBase,...n}),this.emit()):this.commit(n)}commit(n){const a=n?{...this.history.present,...n}:this.history.present,o=this.transientBase;this.transientBase=null,this.history=A0(o?{...this.history,present:o}:this.history,a),this.emit()}setKeepAudio(n){this.applyMut(a=>({...a,keepAudio:n}))}setPoster(n){this.applyMut(a=>({...a,poster:{time:Math.max(0,n)}}))}totalDuration(){return ai(this.history.present.clips)}contentDuration(){const n=this.history.present;return Dm(n.clips,n.audioClips,n.overlays)}locate(n){return io(this.history.present.clips,n)}usedVideoSources(){return L0(this.history.present.clips)}getExportPlan(){const n=this.history.present,a=L0(n.clips),o=[...new Set(n.audioClips.map(s=>s.srcIdx))].sort((s,d)=>s-d),l=new Map(o.map((s,d)=>[s,d]));return{state:{...n,clips:jx(n.clips,a),audioClips:n.audioClips.map(s=>({...s,srcIdx:l.get(s.srcIdx)??0}))},videoSrcOrder:a,audioSrcOrder:o}}validate(){return _x.safeParse(this.getExportPlan().state)}reset(n=Qu()){this.transientBase=null,this.history=jm(n),this.emit()}};function D0(n,a){const o=n.replace(/\/$/,""),l=a.startsWith("/")?a:`/${a}`;return`${o}${l}`}async function j0(n,a){const o=await n.json().catch(()=>({}));return new Error(o.message||o.error||a)}function Rx(n={}){const a=n.baseUrl??"",o=n.fetch??globalThis.fetch,l=n.paths?.video??"/api/editor/video",s=n.paths?.poster??"/api/editor/poster";return{async exportVideo(d){const m=await o(D0(a,l),{method:"POST",body:d});if(!m.ok)throw await j0(m,"\u89C6\u9891\u5904\u7406\u5931\u8D25");return m.blob()},async extractPoster(d,m){const h=new FormData;h.append("file",d,d.name||"video.mp4"),h.append("time",String(m));const g=await o(D0(a,s),{method:"POST",body:h});if(!g.ok)throw await j0(g,"\u5C01\u9762\u62BD\u53D6\u5931\u8D25");return g.blob()}}}var Pm=Math.PI/180;function Go(n,a,o){const l=Ix(o);if(l===0||l===180)return{w:n,h:a};if(l===90||l===270)return{w:a,h:n};const s=l*Pm;return{w:Math.round(Math.abs(n*Math.cos(s))+Math.abs(a*Math.sin(s))),h:Math.round(Math.abs(n*Math.sin(s))+Math.abs(a*Math.cos(s)))}}function Ix(n){return(n%360+360)%360}function Kn(n){const a=Math.round(n);return a-a%2}function O0(n,a,o=40){const l=Math.min(Math.max(o,n.width),a.w),s=Math.min(Math.max(o,n.height),a.h),d=Math.min(Math.max(0,n.x),a.w-l),m=Math.min(Math.max(0,n.y),a.h-s);return{x:Math.round(d),y:Math.round(m),width:Math.round(l),height:Math.round(s)}}function ec(n,a){let o=n.w,l=o/a;return l>n.h&&(l=n.h,o=l*a),{x:Math.round((n.w-o)/2),y:Math.round((n.h-l)/2),width:Math.round(o),height:Math.round(l)}}function $m(n,a,o){const l={x:0,y:0,width:n.width,height:n.height},s={x:0,y:0,width:a.w,height:a.h};return o==="cover"?{src:ec({w:n.width,h:n.height},a.w/a.h),dst:s}:o==="contain"?{src:l,dst:ec({w:a.w,h:a.h},n.width/n.height)}:{src:l,dst:s}}function oo(n,a){if(a.scale)return{w:Kn(a.scale.width),h:Kn(a.scale.height)};if(a.crop)return{w:Kn(a.crop.width),h:Kn(a.crop.height)};const o=Go(n.w,n.h,a.rotation);return{w:Kn(o.w),h:Kn(o.h)}}var P0=[{id:"bw",label:"\u9ED1\u767D",vf:"hue=s=0",css:"grayscale(1)"},{id:"sepia",label:"\u590D\u53E4",vf:"colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131",css:"sepia(0.85)"},{id:"warm",label:"\u6696\u9633",vf:"colorbalance=rs=.15:gs=.04:bs=-.15",css:"sepia(0.25) saturate(1.25) brightness(1.03)"},{id:"cool",label:"\u51B7\u8C03",vf:"colorbalance=rs=-.14:bs=.16",css:"hue-rotate(12deg) saturate(0.95) brightness(1.02)"},{id:"vivid",label:"\u9C9C\u8273",vf:"eq=saturation=1.45:contrast=1.08",css:"saturate(1.45) contrast(1.08)"}];function $0(n){return n?P0.find(a=>a.id===n):void 0}function Rm(n,a){const o=$0(a)?.css??"";return[`brightness(${1+n.brightness})`,`contrast(${1+n.contrast})`,`saturate(${1+n.saturation})`,o].filter(Boolean).join(" ")}var R0=Math.PI/180;function tc(n,a,o){n.strokeStyle=a,n.lineWidth=o,n.lineCap="round",n.lineJoin="round"}function Hx(n,a,o,l,s,d){const m=Math.atan2(s-o,l-a),h=Math.max(12,d*3.5);n.beginPath(),n.moveTo(l,s),n.lineTo(l-h*Math.cos(m-Math.PI/7),s-h*Math.sin(m-Math.PI/7)),n.moveTo(l,s),n.lineTo(l-h*Math.cos(m+Math.PI/7),s-h*Math.sin(m+Math.PI/7)),n.stroke()}function I0(n){if(!Number.isFinite(n))return 0;let a=n%360;return a>180&&(a-=360),a<-180&&(a+=360),Math.abs(a)<.001?0:a}var Vx=.84;function Wx(n){const a=Math.max(8,Number(n?.w)||0),o=Math.max(8,Number(n?.h)||0),l=Math.max(8,Math.min(a,o)*Vx);return{x:(Number(n?.x)||0)+(a-l)/2,y:(Number(n?.y)||0)+(o-l)/2,size:l}}var Im=null;function qx(){return typeof document>"u"?null:(Im??(Im=document.createElement("canvas")),Im.getContext("2d"))}function H0(n){return Math.min(512,Math.max(8,Number(n.fontSize)||24))}function Yx(n,a){return Number.isFinite(n.paddingX)?Math.max(0,n.paddingX):Math.max(8,Math.round(a*.18))}function Ux(n,a){return Number.isFinite(n.paddingY)?Math.max(0,n.paddingY):Math.max(6,Math.round(a*.14))}function Zx(n,a){return(Number.isFinite(n.lineHeight)?Math.max(.9,n.lineHeight):1.1)*a}function Kx(n){return n.textAlign==="center"||n.textAlign==="right"?n.textAlign:"left"}function Gx(n){const a=H0(n),o=n.fontStyle||"normal",l=n.fontWeight||"700",s=n.fontFamily||'-apple-system, "PingFang SC", "Microsoft YaHei", sans-serif';return`${o} ${l} ${a}px ${s}`}function Xx(n,a){const o=n==null?"":String(n);switch(a){case"uppercase":return o.toUpperCase();case"lowercase":return o.toLowerCase();case"capitalize":return o.toLowerCase().replace(/(^|\s)(\S)/g,(l,s,d)=>`${s}${d.toUpperCase()}`);default:return o}}function Qx(n,a){const o=Xx(n,a).replace(/\r\n/g,`
|
|
1
|
+
var u1=Object.defineProperty,c1=(n,a)=>{for(var o in a)u1(n,o,{get:a[o],enumerable:!0})},d1=Object.create,c0=Object.defineProperty,m1=Object.getOwnPropertyDescriptor,f1=Object.getOwnPropertyNames,p1=Object.getPrototypeOf,h1=Object.prototype.hasOwnProperty,La=(n,a)=>()=>(a||n((a={exports:{}}).exports,a),a.exports),v1=(n,a,o,l)=>{if(a&&typeof a=="object"||typeof a=="function")for(let s of f1(a))!h1.call(n,s)&&s!==o&&c0(n,s,{get:()=>a[s],enumerable:!(l=m1(a,s))||l.enumerable});return n},Ar=(n,a,o)=>(o=n!=null?d1(p1(n)):{},v1(a||!n||!n.__esModule?c0(o,"default",{value:n,enumerable:!0}):o,n)),ce={};c1(ce,{BRAND:()=>H1,DIRTY:()=>Zu,EMPTY_PATH:()=>x1,INVALID:()=>Yt,NEVER:()=>Sx,OK:()=>Nr,ParseStatus:()=>Rr,Schema:()=>mn,ZodAny:()=>Uo,ZodArray:()=>ro,ZodBigInt:()=>ts,ZodBoolean:()=>ns,ZodBranded:()=>Bm,ZodCatch:()=>fs,ZodDate:()=>rs,ZodDefault:()=>ms,ZodDiscriminatedUnion:()=>v0,ZodEffects:()=>xa,ZodEnum:()=>cs,ZodError:()=>ya,ZodFirstPartyTypeKind:()=>Jt,ZodFunction:()=>b0,ZodIntersection:()=>ls,ZodIssueCode:()=>Ue,ZodLazy:()=>ss,ZodLiteral:()=>us,ZodMap:()=>Ku,ZodNaN:()=>Yu,ZodNativeEnum:()=>ds,ZodNever:()=>ni,ZodNull:()=>is,ZodNullable:()=>_i,ZodNumber:()=>es,ZodObject:()=>ca,ZodOptional:()=>Na,ZodParsedType:()=>St,ZodPipeline:()=>Dm,ZodPromise:()=>Ko,ZodReadonly:()=>ps,ZodRecord:()=>g0,ZodSchema:()=>mn,ZodSet:()=>Gu,ZodString:()=>Zo,ZodSymbol:()=>Uu,ZodTransformer:()=>xa,ZodTuple:()=>Ni,ZodType:()=>mn,ZodUndefined:()=>as,ZodUnion:()=>os,ZodUnknown:()=>no,ZodVoid:()=>Xu,addIssueToContext:()=>vt,any:()=>Y1,array:()=>tx,bigint:()=>Z1,boolean:()=>C0,coerce:()=>Cx,custom:()=>w0,date:()=>U1,datetimeRegex:()=>h0,defaultErrorMap:()=>qo,discriminatedUnion:()=>ix,effect:()=>S0,enum:()=>px,function:()=>dx,getErrorMap:()=>Wu,getParsedType:()=>ti,instanceof:()=>W1,intersection:()=>ox,isAborted:()=>Am,isAsync:()=>Ql,isDirty:()=>Nm,isValid:()=>to,late:()=>V1,lazy:()=>mx,literal:()=>fx,makeIssue:()=>qu,map:()=>ux,nan:()=>q1,nativeEnum:()=>hx,never:()=>Q1,null:()=>G1,nullable:()=>bx,number:()=>k0,object:()=>nx,objectUtil:()=>Lm,oboolean:()=>kx,onumber:()=>Ex,optional:()=>gx,ostring:()=>wx,pipeline:()=>xx,preprocess:()=>yx,promise:()=>vx,quotelessJson:()=>g1,record:()=>sx,set:()=>cx,setErrorMap:()=>y1,strictObject:()=>rx,string:()=>E0,symbol:()=>X1,transformer:()=>S0,tuple:()=>lx,undefined:()=>K1,union:()=>ax,unknown:()=>J1,util:()=>En,void:()=>ex});var En;(function(n){n.assertEqual=s=>{};function a(s){}n.assertIs=a;function o(s){throw new Error}n.assertNever=o,n.arrayToEnum=s=>{const d={};for(const m of s)d[m]=m;return d},n.getValidEnumValues=s=>{const d=n.objectKeys(s).filter(h=>typeof s[s[h]]!="number"),m={};for(const h of d)m[h]=s[h];return n.objectValues(m)},n.objectValues=s=>n.objectKeys(s).map(function(d){return s[d]}),n.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const d=[];for(const m in s)Object.prototype.hasOwnProperty.call(s,m)&&d.push(m);return d},n.find=(s,d)=>{for(const m of s)if(d(m))return m},n.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function l(s,d=" | "){return s.map(m=>typeof m=="string"?`'${m}'`:m).join(d)}n.joinValues=l,n.jsonStringifyReplacer=(s,d)=>typeof d=="bigint"?d.toString():d})(En||(En={}));var Lm;(function(n){n.mergeShapes=(a,o)=>({...a,...o})})(Lm||(Lm={}));var St=En.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ti=n=>{switch(typeof n){case"undefined":return St.undefined;case"string":return St.string;case"number":return Number.isNaN(n)?St.nan:St.number;case"boolean":return St.boolean;case"function":return St.function;case"bigint":return St.bigint;case"symbol":return St.symbol;case"object":return Array.isArray(n)?St.array:n===null?St.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?St.promise:typeof Map<"u"&&n instanceof Map?St.map:typeof Set<"u"&&n instanceof Set?St.set:typeof Date<"u"&&n instanceof Date?St.date:St.object;default:return St.unknown}},Ue=En.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),g1=n=>JSON.stringify(n,null,2).replace(/"([^"]+)":/g,"$1:"),ya=class ub extends Error{get errors(){return this.issues}constructor(a){super(),this.issues=[],this.addIssue=l=>{this.issues=[...this.issues,l]},this.addIssues=(l=[])=>{this.issues=[...this.issues,...l]};const o=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,o):this.__proto__=o,this.name="ZodError",this.issues=a}format(a){const o=a||function(d){return d.message},l={_errors:[]},s=d=>{for(const m of d.issues)if(m.code==="invalid_union")m.unionErrors.map(s);else if(m.code==="invalid_return_type")s(m.returnTypeError);else if(m.code==="invalid_arguments")s(m.argumentsError);else if(m.path.length===0)l._errors.push(o(m));else{let h=l,g=0;for(;g<m.path.length;){const v=m.path[g];g===m.path.length-1?(h[v]=h[v]||{_errors:[]},h[v]._errors.push(o(m))):h[v]=h[v]||{_errors:[]},h=h[v],g++}}};return s(this),l}static assert(a){if(!(a instanceof ub))throw new Error(`Not a ZodError: ${a}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,En.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(a=o=>o.message){const o={},l=[];for(const s of this.issues)if(s.path.length>0){const d=s.path[0];o[d]=o[d]||[],o[d].push(a(s))}else l.push(a(s));return{formErrors:l,fieldErrors:o}}get formErrors(){return this.flatten()}};ya.create=n=>new ya(n);var b1=(n,a)=>{let o;switch(n.code){case Ue.invalid_type:n.received===St.undefined?o="Required":o=`Expected ${n.expected}, received ${n.received}`;break;case Ue.invalid_literal:o=`Invalid literal value, expected ${JSON.stringify(n.expected,En.jsonStringifyReplacer)}`;break;case Ue.unrecognized_keys:o=`Unrecognized key(s) in object: ${En.joinValues(n.keys,", ")}`;break;case Ue.invalid_union:o="Invalid input";break;case Ue.invalid_union_discriminator:o=`Invalid discriminator value. Expected ${En.joinValues(n.options)}`;break;case Ue.invalid_enum_value:o=`Invalid enum value. Expected ${En.joinValues(n.options)}, received '${n.received}'`;break;case Ue.invalid_arguments:o="Invalid function arguments";break;case Ue.invalid_return_type:o="Invalid function return type";break;case Ue.invalid_date:o="Invalid date";break;case Ue.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(o=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(o=`${o} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?o=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?o=`Invalid input: must end with "${n.validation.endsWith}"`:En.assertNever(n.validation):n.validation!=="regex"?o=`Invalid ${n.validation}`:o="Invalid";break;case Ue.too_small:n.type==="array"?o=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?o=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?o=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="bigint"?o=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?o=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:o="Invalid input";break;case Ue.too_big:n.type==="array"?o=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?o=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?o=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?o=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?o=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:o="Invalid input";break;case Ue.custom:o="Invalid input";break;case Ue.invalid_intersection_types:o="Intersection results could not be merged";break;case Ue.not_multiple_of:o=`Number must be a multiple of ${n.multipleOf}`;break;case Ue.not_finite:o="Number must be finite";break;default:o=a.defaultError,En.assertNever(n)}return{message:o}},qo=b1,d0=qo;function y1(n){d0=n}function Wu(){return d0}var qu=n=>{const{data:a,path:o,errorMaps:l,issueData:s}=n,d=[...o,...s.path||[]],m={...s,path:d};if(s.message!==void 0)return{...s,path:d,message:s.message};let h="";const g=l.filter(v=>!!v).slice().reverse();for(const v of g)h=v(m,{data:a,defaultError:h}).message;return{...s,path:d,message:h}},x1=[];function vt(n,a){const o=Wu(),l=qu({issueData:a,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,o,o===qo?void 0:qo].filter(s=>!!s)});n.common.issues.push(l)}var Rr=class cb{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(a,o){const l=[];for(const s of o){if(s.status==="aborted")return Yt;s.status==="dirty"&&a.dirty(),l.push(s.value)}return{status:a.value,value:l}}static async mergeObjectAsync(a,o){const l=[];for(const s of o){const d=await s.key,m=await s.value;l.push({key:d,value:m})}return cb.mergeObjectSync(a,l)}static mergeObjectSync(a,o){const l={};for(const s of o){const{key:d,value:m}=s;if(d.status==="aborted"||m.status==="aborted")return Yt;d.status==="dirty"&&a.dirty(),m.status==="dirty"&&a.dirty(),d.value!=="__proto__"&&(typeof m.value<"u"||s.alwaysSet)&&(l[d.value]=m.value)}return{status:a.value,value:l}}},Yt=Object.freeze({status:"aborted"}),Zu=n=>({status:"dirty",value:n}),Nr=n=>({status:"valid",value:n}),Am=n=>n.status==="aborted",Nm=n=>n.status==="dirty",to=n=>n.status==="valid",Ql=n=>typeof Promise<"u"&&n instanceof Promise,zt;(function(n){n.errToObj=a=>typeof a=="string"?{message:a}:a||{},n.toString=a=>typeof a=="string"?a:a?.message})(zt||(zt={}));var Aa=class{constructor(n,a,o,l){this._cachedPath=[],this.parent=n,this.data=a,this._path=o,this._key=l}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},m0=(n,a)=>{if(to(a))return{success:!0,data:a.value};if(!n.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const o=new ya(n.common.issues);return this._error=o,this._error}}};function sn(n){if(!n)return{};const{errorMap:a,invalid_type_error:o,required_error:l,description:s}=n;if(a&&(o||l))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return a?{errorMap:a,description:s}:{errorMap:(d,m)=>{const{message:h}=n;return d.code==="invalid_enum_value"?{message:h??m.defaultError}:typeof m.data>"u"?{message:h??l??m.defaultError}:d.code!=="invalid_type"?{message:m.defaultError}:{message:h??o??m.defaultError}},description:s}}var mn=class{get description(){return this._def.description}_getType(n){return ti(n.data)}_getOrReturnCtx(n,a){return a||{common:n.parent.common,data:n.data,parsedType:ti(n.data),schemaErrorMap:this._def.errorMap,path:n.path,parent:n.parent}}_processInputParams(n){return{status:new Rr,ctx:{common:n.parent.common,data:n.data,parsedType:ti(n.data),schemaErrorMap:this._def.errorMap,path:n.path,parent:n.parent}}}_parseSync(n){const a=this._parse(n);if(Ql(a))throw new Error("Synchronous parse encountered promise.");return a}_parseAsync(n){const a=this._parse(n);return Promise.resolve(a)}parse(n,a){const o=this.safeParse(n,a);if(o.success)return o.data;throw o.error}safeParse(n,a){const o={common:{issues:[],async:a?.async??!1,contextualErrorMap:a?.errorMap},path:a?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:n,parsedType:ti(n)},l=this._parseSync({data:n,path:o.path,parent:o});return m0(o,l)}"~validate"(n){const a={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:n,parsedType:ti(n)};if(!this["~standard"].async)try{const o=this._parseSync({data:n,path:[],parent:a});return to(o)?{value:o.value}:{issues:a.common.issues}}catch(o){o?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),a.common={issues:[],async:!0}}return this._parseAsync({data:n,path:[],parent:a}).then(o=>to(o)?{value:o.value}:{issues:a.common.issues})}async parseAsync(n,a){const o=await this.safeParseAsync(n,a);if(o.success)return o.data;throw o.error}async safeParseAsync(n,a){const o={common:{issues:[],contextualErrorMap:a?.errorMap,async:!0},path:a?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:n,parsedType:ti(n)},l=this._parse({data:n,path:o.path,parent:o}),s=await(Ql(l)?l:Promise.resolve(l));return m0(o,s)}refine(n,a){const o=l=>typeof a=="string"||typeof a>"u"?{message:a}:typeof a=="function"?a(l):a;return this._refinement((l,s)=>{const d=n(l),m=()=>s.addIssue({code:Ue.custom,...o(l)});return typeof Promise<"u"&&d instanceof Promise?d.then(h=>h?!0:(m(),!1)):d?!0:(m(),!1)})}refinement(n,a){return this._refinement((o,l)=>n(o)?!0:(l.addIssue(typeof a=="function"?a(o,l):a),!1))}_refinement(n){return new xa({schema:this,typeName:Jt.ZodEffects,effect:{type:"refinement",refinement:n}})}superRefine(n){return this._refinement(n)}constructor(n){this.spa=this.safeParseAsync,this._def=n,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:a=>this["~validate"](a)}}optional(){return Na.create(this,this._def)}nullable(){return _i.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ro.create(this)}promise(){return Ko.create(this,this._def)}or(n){return os.create([this,n],this._def)}and(n){return ls.create(this,n,this._def)}transform(n){return new xa({...sn(this._def),schema:this,typeName:Jt.ZodEffects,effect:{type:"transform",transform:n}})}default(n){const a=typeof n=="function"?n:()=>n;return new ms({...sn(this._def),innerType:this,defaultValue:a,typeName:Jt.ZodDefault})}brand(){return new Bm({typeName:Jt.ZodBranded,type:this,...sn(this._def)})}catch(n){const a=typeof n=="function"?n:()=>n;return new fs({...sn(this._def),innerType:this,catchValue:a,typeName:Jt.ZodCatch})}describe(n){const a=this.constructor;return new a({...this._def,description:n})}pipe(n){return Dm.create(this,n)}readonly(){return ps.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},w1=/^c[^\s-]{8,}$/i,E1=/^[0-9a-z]+$/,k1=/^[0-9A-HJKMNP-TV-Z]{26}$/i,C1=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,S1=/^[a-z0-9_-]{21}$/i,F1=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,M1=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,L1=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,A1="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",_m,N1=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,_1=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,T1=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,B1=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,D1=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,z1=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,f0="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",P1=new RegExp(`^${f0}$`);function p0(n){let a="[0-5]\\d";n.precision?a=`${a}\\.\\d{${n.precision}}`:n.precision==null&&(a=`${a}(\\.\\d+)?`);const o=n.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${a})${o}`}function j1(n){return new RegExp(`^${p0(n)}$`)}function h0(n){let a=`${f0}T${p0(n)}`;const o=[];return o.push(n.local?"Z?":"Z"),n.offset&&o.push("([+-]\\d{2}:?\\d{2})"),a=`${a}(${o.join("|")})`,new RegExp(`^${a}$`)}function O1(n,a){return!!((a==="v4"||!a)&&N1.test(n)||(a==="v6"||!a)&&T1.test(n))}function $1(n,a){if(!F1.test(n))return!1;try{const[o]=n.split(".");if(!o)return!1;const l=o.replace(/-/g,"+").replace(/_/g,"/").padEnd(o.length+(4-o.length%4)%4,"="),s=JSON.parse(atob(l));return!(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||a&&s.alg!==a)}catch{return!1}}function R1(n,a){return!!((a==="v4"||!a)&&_1.test(n)||(a==="v6"||!a)&&B1.test(n))}var Zo=class Ds extends mn{_parse(a){if(this._def.coerce&&(a.data=String(a.data)),this._getType(a)!==St.string){const s=this._getOrReturnCtx(a);return vt(s,{code:Ue.invalid_type,expected:St.string,received:s.parsedType}),Yt}const o=new Rr;let l;for(const s of this._def.checks)if(s.kind==="min")a.data.length<s.value&&(l=this._getOrReturnCtx(a,l),vt(l,{code:Ue.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),o.dirty());else if(s.kind==="max")a.data.length>s.value&&(l=this._getOrReturnCtx(a,l),vt(l,{code:Ue.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),o.dirty());else if(s.kind==="length"){const d=a.data.length>s.value,m=a.data.length<s.value;(d||m)&&(l=this._getOrReturnCtx(a,l),d?vt(l,{code:Ue.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):m&&vt(l,{code:Ue.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),o.dirty())}else if(s.kind==="email")L1.test(a.data)||(l=this._getOrReturnCtx(a,l),vt(l,{validation:"email",code:Ue.invalid_string,message:s.message}),o.dirty());else if(s.kind==="emoji")_m||(_m=new RegExp(A1,"u")),_m.test(a.data)||(l=this._getOrReturnCtx(a,l),vt(l,{validation:"emoji",code:Ue.invalid_string,message:s.message}),o.dirty());else if(s.kind==="uuid")C1.test(a.data)||(l=this._getOrReturnCtx(a,l),vt(l,{validation:"uuid",code:Ue.invalid_string,message:s.message}),o.dirty());else if(s.kind==="nanoid")S1.test(a.data)||(l=this._getOrReturnCtx(a,l),vt(l,{validation:"nanoid",code:Ue.invalid_string,message:s.message}),o.dirty());else if(s.kind==="cuid")w1.test(a.data)||(l=this._getOrReturnCtx(a,l),vt(l,{validation:"cuid",code:Ue.invalid_string,message:s.message}),o.dirty());else if(s.kind==="cuid2")E1.test(a.data)||(l=this._getOrReturnCtx(a,l),vt(l,{validation:"cuid2",code:Ue.invalid_string,message:s.message}),o.dirty());else if(s.kind==="ulid")k1.test(a.data)||(l=this._getOrReturnCtx(a,l),vt(l,{validation:"ulid",code:Ue.invalid_string,message:s.message}),o.dirty());else if(s.kind==="url")try{new URL(a.data)}catch{l=this._getOrReturnCtx(a,l),vt(l,{validation:"url",code:Ue.invalid_string,message:s.message}),o.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(a.data)||(l=this._getOrReturnCtx(a,l),vt(l,{validation:"regex",code:Ue.invalid_string,message:s.message}),o.dirty())):s.kind==="trim"?a.data=a.data.trim():s.kind==="includes"?a.data.includes(s.value,s.position)||(l=this._getOrReturnCtx(a,l),vt(l,{code:Ue.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),o.dirty()):s.kind==="toLowerCase"?a.data=a.data.toLowerCase():s.kind==="toUpperCase"?a.data=a.data.toUpperCase():s.kind==="startsWith"?a.data.startsWith(s.value)||(l=this._getOrReturnCtx(a,l),vt(l,{code:Ue.invalid_string,validation:{startsWith:s.value},message:s.message}),o.dirty()):s.kind==="endsWith"?a.data.endsWith(s.value)||(l=this._getOrReturnCtx(a,l),vt(l,{code:Ue.invalid_string,validation:{endsWith:s.value},message:s.message}),o.dirty()):s.kind==="datetime"?h0(s).test(a.data)||(l=this._getOrReturnCtx(a,l),vt(l,{code:Ue.invalid_string,validation:"datetime",message:s.message}),o.dirty()):s.kind==="date"?P1.test(a.data)||(l=this._getOrReturnCtx(a,l),vt(l,{code:Ue.invalid_string,validation:"date",message:s.message}),o.dirty()):s.kind==="time"?j1(s).test(a.data)||(l=this._getOrReturnCtx(a,l),vt(l,{code:Ue.invalid_string,validation:"time",message:s.message}),o.dirty()):s.kind==="duration"?M1.test(a.data)||(l=this._getOrReturnCtx(a,l),vt(l,{validation:"duration",code:Ue.invalid_string,message:s.message}),o.dirty()):s.kind==="ip"?O1(a.data,s.version)||(l=this._getOrReturnCtx(a,l),vt(l,{validation:"ip",code:Ue.invalid_string,message:s.message}),o.dirty()):s.kind==="jwt"?$1(a.data,s.alg)||(l=this._getOrReturnCtx(a,l),vt(l,{validation:"jwt",code:Ue.invalid_string,message:s.message}),o.dirty()):s.kind==="cidr"?R1(a.data,s.version)||(l=this._getOrReturnCtx(a,l),vt(l,{validation:"cidr",code:Ue.invalid_string,message:s.message}),o.dirty()):s.kind==="base64"?D1.test(a.data)||(l=this._getOrReturnCtx(a,l),vt(l,{validation:"base64",code:Ue.invalid_string,message:s.message}),o.dirty()):s.kind==="base64url"?z1.test(a.data)||(l=this._getOrReturnCtx(a,l),vt(l,{validation:"base64url",code:Ue.invalid_string,message:s.message}),o.dirty()):En.assertNever(s);return{status:o.value,value:a.data}}_regex(a,o,l){return this.refinement(s=>a.test(s),{validation:o,code:Ue.invalid_string,...zt.errToObj(l)})}_addCheck(a){return new Ds({...this._def,checks:[...this._def.checks,a]})}email(a){return this._addCheck({kind:"email",...zt.errToObj(a)})}url(a){return this._addCheck({kind:"url",...zt.errToObj(a)})}emoji(a){return this._addCheck({kind:"emoji",...zt.errToObj(a)})}uuid(a){return this._addCheck({kind:"uuid",...zt.errToObj(a)})}nanoid(a){return this._addCheck({kind:"nanoid",...zt.errToObj(a)})}cuid(a){return this._addCheck({kind:"cuid",...zt.errToObj(a)})}cuid2(a){return this._addCheck({kind:"cuid2",...zt.errToObj(a)})}ulid(a){return this._addCheck({kind:"ulid",...zt.errToObj(a)})}base64(a){return this._addCheck({kind:"base64",...zt.errToObj(a)})}base64url(a){return this._addCheck({kind:"base64url",...zt.errToObj(a)})}jwt(a){return this._addCheck({kind:"jwt",...zt.errToObj(a)})}ip(a){return this._addCheck({kind:"ip",...zt.errToObj(a)})}cidr(a){return this._addCheck({kind:"cidr",...zt.errToObj(a)})}datetime(a){return typeof a=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:a}):this._addCheck({kind:"datetime",precision:typeof a?.precision>"u"?null:a?.precision,offset:a?.offset??!1,local:a?.local??!1,...zt.errToObj(a?.message)})}date(a){return this._addCheck({kind:"date",message:a})}time(a){return typeof a=="string"?this._addCheck({kind:"time",precision:null,message:a}):this._addCheck({kind:"time",precision:typeof a?.precision>"u"?null:a?.precision,...zt.errToObj(a?.message)})}duration(a){return this._addCheck({kind:"duration",...zt.errToObj(a)})}regex(a,o){return this._addCheck({kind:"regex",regex:a,...zt.errToObj(o)})}includes(a,o){return this._addCheck({kind:"includes",value:a,position:o?.position,...zt.errToObj(o?.message)})}startsWith(a,o){return this._addCheck({kind:"startsWith",value:a,...zt.errToObj(o)})}endsWith(a,o){return this._addCheck({kind:"endsWith",value:a,...zt.errToObj(o)})}min(a,o){return this._addCheck({kind:"min",value:a,...zt.errToObj(o)})}max(a,o){return this._addCheck({kind:"max",value:a,...zt.errToObj(o)})}length(a,o){return this._addCheck({kind:"length",value:a,...zt.errToObj(o)})}nonempty(a){return this.min(1,zt.errToObj(a))}trim(){return new Ds({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ds({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ds({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(a=>a.kind==="datetime")}get isDate(){return!!this._def.checks.find(a=>a.kind==="date")}get isTime(){return!!this._def.checks.find(a=>a.kind==="time")}get isDuration(){return!!this._def.checks.find(a=>a.kind==="duration")}get isEmail(){return!!this._def.checks.find(a=>a.kind==="email")}get isURL(){return!!this._def.checks.find(a=>a.kind==="url")}get isEmoji(){return!!this._def.checks.find(a=>a.kind==="emoji")}get isUUID(){return!!this._def.checks.find(a=>a.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(a=>a.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(a=>a.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(a=>a.kind==="cuid2")}get isULID(){return!!this._def.checks.find(a=>a.kind==="ulid")}get isIP(){return!!this._def.checks.find(a=>a.kind==="ip")}get isCIDR(){return!!this._def.checks.find(a=>a.kind==="cidr")}get isBase64(){return!!this._def.checks.find(a=>a.kind==="base64")}get isBase64url(){return!!this._def.checks.find(a=>a.kind==="base64url")}get minLength(){let a=null;for(const o of this._def.checks)o.kind==="min"&&(a===null||o.value>a)&&(a=o.value);return a}get maxLength(){let a=null;for(const o of this._def.checks)o.kind==="max"&&(a===null||o.value<a)&&(a=o.value);return a}};Zo.create=n=>new Zo({checks:[],typeName:Jt.ZodString,coerce:n?.coerce??!1,...sn(n)});function I1(n,a){const o=(n.toString().split(".")[1]||"").length,l=(a.toString().split(".")[1]||"").length,s=o>l?o:l,d=Number.parseInt(n.toFixed(s).replace(".","")),m=Number.parseInt(a.toFixed(s).replace(".",""));return d%m/10**s}var es=class _f extends mn{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(a){if(this._def.coerce&&(a.data=Number(a.data)),this._getType(a)!==St.number){const s=this._getOrReturnCtx(a);return vt(s,{code:Ue.invalid_type,expected:St.number,received:s.parsedType}),Yt}let o;const l=new Rr;for(const s of this._def.checks)s.kind==="int"?En.isInteger(a.data)||(o=this._getOrReturnCtx(a,o),vt(o,{code:Ue.invalid_type,expected:"integer",received:"float",message:s.message}),l.dirty()):s.kind==="min"?(s.inclusive?a.data<s.value:a.data<=s.value)&&(o=this._getOrReturnCtx(a,o),vt(o,{code:Ue.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),l.dirty()):s.kind==="max"?(s.inclusive?a.data>s.value:a.data>=s.value)&&(o=this._getOrReturnCtx(a,o),vt(o,{code:Ue.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),l.dirty()):s.kind==="multipleOf"?I1(a.data,s.value)!==0&&(o=this._getOrReturnCtx(a,o),vt(o,{code:Ue.not_multiple_of,multipleOf:s.value,message:s.message}),l.dirty()):s.kind==="finite"?Number.isFinite(a.data)||(o=this._getOrReturnCtx(a,o),vt(o,{code:Ue.not_finite,message:s.message}),l.dirty()):En.assertNever(s);return{status:l.value,value:a.data}}gte(a,o){return this.setLimit("min",a,!0,zt.toString(o))}gt(a,o){return this.setLimit("min",a,!1,zt.toString(o))}lte(a,o){return this.setLimit("max",a,!0,zt.toString(o))}lt(a,o){return this.setLimit("max",a,!1,zt.toString(o))}setLimit(a,o,l,s){return new _f({...this._def,checks:[...this._def.checks,{kind:a,value:o,inclusive:l,message:zt.toString(s)}]})}_addCheck(a){return new _f({...this._def,checks:[...this._def.checks,a]})}int(a){return this._addCheck({kind:"int",message:zt.toString(a)})}positive(a){return this._addCheck({kind:"min",value:0,inclusive:!1,message:zt.toString(a)})}negative(a){return this._addCheck({kind:"max",value:0,inclusive:!1,message:zt.toString(a)})}nonpositive(a){return this._addCheck({kind:"max",value:0,inclusive:!0,message:zt.toString(a)})}nonnegative(a){return this._addCheck({kind:"min",value:0,inclusive:!0,message:zt.toString(a)})}multipleOf(a,o){return this._addCheck({kind:"multipleOf",value:a,message:zt.toString(o)})}finite(a){return this._addCheck({kind:"finite",message:zt.toString(a)})}safe(a){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:zt.toString(a)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:zt.toString(a)})}get minValue(){let a=null;for(const o of this._def.checks)o.kind==="min"&&(a===null||o.value>a)&&(a=o.value);return a}get maxValue(){let a=null;for(const o of this._def.checks)o.kind==="max"&&(a===null||o.value<a)&&(a=o.value);return a}get isInt(){return!!this._def.checks.find(a=>a.kind==="int"||a.kind==="multipleOf"&&En.isInteger(a.value))}get isFinite(){let a=null,o=null;for(const l of this._def.checks){if(l.kind==="finite"||l.kind==="int"||l.kind==="multipleOf")return!0;l.kind==="min"?(o===null||l.value>o)&&(o=l.value):l.kind==="max"&&(a===null||l.value<a)&&(a=l.value)}return Number.isFinite(o)&&Number.isFinite(a)}};es.create=n=>new es({checks:[],typeName:Jt.ZodNumber,coerce:n?.coerce||!1,...sn(n)});var ts=class Tf extends mn{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(a){if(this._def.coerce)try{a.data=BigInt(a.data)}catch{return this._getInvalidInput(a)}if(this._getType(a)!==St.bigint)return this._getInvalidInput(a);let o;const l=new Rr;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?a.data<s.value:a.data<=s.value)&&(o=this._getOrReturnCtx(a,o),vt(o,{code:Ue.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),l.dirty()):s.kind==="max"?(s.inclusive?a.data>s.value:a.data>=s.value)&&(o=this._getOrReturnCtx(a,o),vt(o,{code:Ue.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),l.dirty()):s.kind==="multipleOf"?a.data%s.value!==BigInt(0)&&(o=this._getOrReturnCtx(a,o),vt(o,{code:Ue.not_multiple_of,multipleOf:s.value,message:s.message}),l.dirty()):En.assertNever(s);return{status:l.value,value:a.data}}_getInvalidInput(a){const o=this._getOrReturnCtx(a);return vt(o,{code:Ue.invalid_type,expected:St.bigint,received:o.parsedType}),Yt}gte(a,o){return this.setLimit("min",a,!0,zt.toString(o))}gt(a,o){return this.setLimit("min",a,!1,zt.toString(o))}lte(a,o){return this.setLimit("max",a,!0,zt.toString(o))}lt(a,o){return this.setLimit("max",a,!1,zt.toString(o))}setLimit(a,o,l,s){return new Tf({...this._def,checks:[...this._def.checks,{kind:a,value:o,inclusive:l,message:zt.toString(s)}]})}_addCheck(a){return new Tf({...this._def,checks:[...this._def.checks,a]})}positive(a){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:zt.toString(a)})}negative(a){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:zt.toString(a)})}nonpositive(a){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:zt.toString(a)})}nonnegative(a){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:zt.toString(a)})}multipleOf(a,o){return this._addCheck({kind:"multipleOf",value:a,message:zt.toString(o)})}get minValue(){let a=null;for(const o of this._def.checks)o.kind==="min"&&(a===null||o.value>a)&&(a=o.value);return a}get maxValue(){let a=null;for(const o of this._def.checks)o.kind==="max"&&(a===null||o.value<a)&&(a=o.value);return a}};ts.create=n=>new ts({checks:[],typeName:Jt.ZodBigInt,coerce:n?.coerce??!1,...sn(n)});var ns=class extends mn{_parse(n){if(this._def.coerce&&(n.data=!!n.data),this._getType(n)!==St.boolean){const a=this._getOrReturnCtx(n);return vt(a,{code:Ue.invalid_type,expected:St.boolean,received:a.parsedType}),Yt}return Nr(n.data)}};ns.create=n=>new ns({typeName:Jt.ZodBoolean,coerce:n?.coerce||!1,...sn(n)});var rs=class db extends mn{_parse(a){if(this._def.coerce&&(a.data=new Date(a.data)),this._getType(a)!==St.date){const s=this._getOrReturnCtx(a);return vt(s,{code:Ue.invalid_type,expected:St.date,received:s.parsedType}),Yt}if(Number.isNaN(a.data.getTime())){const s=this._getOrReturnCtx(a);return vt(s,{code:Ue.invalid_date}),Yt}const o=new Rr;let l;for(const s of this._def.checks)s.kind==="min"?a.data.getTime()<s.value&&(l=this._getOrReturnCtx(a,l),vt(l,{code:Ue.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),o.dirty()):s.kind==="max"?a.data.getTime()>s.value&&(l=this._getOrReturnCtx(a,l),vt(l,{code:Ue.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),o.dirty()):En.assertNever(s);return{status:o.value,value:new Date(a.data.getTime())}}_addCheck(a){return new db({...this._def,checks:[...this._def.checks,a]})}min(a,o){return this._addCheck({kind:"min",value:a.getTime(),message:zt.toString(o)})}max(a,o){return this._addCheck({kind:"max",value:a.getTime(),message:zt.toString(o)})}get minDate(){let a=null;for(const o of this._def.checks)o.kind==="min"&&(a===null||o.value>a)&&(a=o.value);return a!=null?new Date(a):null}get maxDate(){let a=null;for(const o of this._def.checks)o.kind==="max"&&(a===null||o.value<a)&&(a=o.value);return a!=null?new Date(a):null}};rs.create=n=>new rs({checks:[],coerce:n?.coerce||!1,typeName:Jt.ZodDate,...sn(n)});var Uu=class extends mn{_parse(n){if(this._getType(n)!==St.symbol){const a=this._getOrReturnCtx(n);return vt(a,{code:Ue.invalid_type,expected:St.symbol,received:a.parsedType}),Yt}return Nr(n.data)}};Uu.create=n=>new Uu({typeName:Jt.ZodSymbol,...sn(n)});var as=class extends mn{_parse(n){if(this._getType(n)!==St.undefined){const a=this._getOrReturnCtx(n);return vt(a,{code:Ue.invalid_type,expected:St.undefined,received:a.parsedType}),Yt}return Nr(n.data)}};as.create=n=>new as({typeName:Jt.ZodUndefined,...sn(n)});var is=class extends mn{_parse(n){if(this._getType(n)!==St.null){const a=this._getOrReturnCtx(n);return vt(a,{code:Ue.invalid_type,expected:St.null,received:a.parsedType}),Yt}return Nr(n.data)}};is.create=n=>new is({typeName:Jt.ZodNull,...sn(n)});var Uo=class extends mn{constructor(){super(...arguments),this._any=!0}_parse(n){return Nr(n.data)}};Uo.create=n=>new Uo({typeName:Jt.ZodAny,...sn(n)});var no=class extends mn{constructor(){super(...arguments),this._unknown=!0}_parse(n){return Nr(n.data)}};no.create=n=>new no({typeName:Jt.ZodUnknown,...sn(n)});var ni=class extends mn{_parse(n){const a=this._getOrReturnCtx(n);return vt(a,{code:Ue.invalid_type,expected:St.never,received:a.parsedType}),Yt}};ni.create=n=>new ni({typeName:Jt.ZodNever,...sn(n)});var Xu=class extends mn{_parse(n){if(this._getType(n)!==St.undefined){const a=this._getOrReturnCtx(n);return vt(a,{code:Ue.invalid_type,expected:St.void,received:a.parsedType}),Yt}return Nr(n.data)}};Xu.create=n=>new Xu({typeName:Jt.ZodVoid,...sn(n)});var ro=class _c extends mn{_parse(a){const{ctx:o,status:l}=this._processInputParams(a),s=this._def;if(o.parsedType!==St.array)return vt(o,{code:Ue.invalid_type,expected:St.array,received:o.parsedType}),Yt;if(s.exactLength!==null){const m=o.data.length>s.exactLength.value,h=o.data.length<s.exactLength.value;(m||h)&&(vt(o,{code:m?Ue.too_big:Ue.too_small,minimum:h?s.exactLength.value:void 0,maximum:m?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),l.dirty())}if(s.minLength!==null&&o.data.length<s.minLength.value&&(vt(o,{code:Ue.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),l.dirty()),s.maxLength!==null&&o.data.length>s.maxLength.value&&(vt(o,{code:Ue.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),l.dirty()),o.common.async)return Promise.all([...o.data].map((m,h)=>s.type._parseAsync(new Aa(o,m,o.path,h)))).then(m=>Rr.mergeArray(l,m));const d=[...o.data].map((m,h)=>s.type._parseSync(new Aa(o,m,o.path,h)));return Rr.mergeArray(l,d)}get element(){return this._def.type}min(a,o){return new _c({...this._def,minLength:{value:a,message:zt.toString(o)}})}max(a,o){return new _c({...this._def,maxLength:{value:a,message:zt.toString(o)}})}length(a,o){return new _c({...this._def,exactLength:{value:a,message:zt.toString(o)}})}nonempty(a){return this.min(1,a)}};ro.create=(n,a)=>new ro({type:n,minLength:null,maxLength:null,exactLength:null,typeName:Jt.ZodArray,...sn(a)});function Xo(n){if(n instanceof ca){const a={};for(const o in n.shape){const l=n.shape[o];a[o]=Na.create(Xo(l))}return new ca({...n._def,shape:()=>a})}else return n instanceof ro?new ro({...n._def,type:Xo(n.element)}):n instanceof Na?Na.create(Xo(n.unwrap())):n instanceof _i?_i.create(Xo(n.unwrap())):n instanceof Ni?Ni.create(n.items.map(a=>Xo(a))):n}var ca=class ka extends mn{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const a=this._def.shape(),o=En.objectKeys(a);return this._cached={shape:a,keys:o},this._cached}_parse(a){if(this._getType(a)!==St.object){const g=this._getOrReturnCtx(a);return vt(g,{code:Ue.invalid_type,expected:St.object,received:g.parsedType}),Yt}const{status:o,ctx:l}=this._processInputParams(a),{shape:s,keys:d}=this._getCached(),m=[];if(!(this._def.catchall instanceof ni&&this._def.unknownKeys==="strip"))for(const g in l.data)d.includes(g)||m.push(g);const h=[];for(const g of d){const v=s[g],w=l.data[g];h.push({key:{status:"valid",value:g},value:v._parse(new Aa(l,w,l.path,g)),alwaysSet:g in l.data})}if(this._def.catchall instanceof ni){const g=this._def.unknownKeys;if(g==="passthrough")for(const v of m)h.push({key:{status:"valid",value:v},value:{status:"valid",value:l.data[v]}});else if(g==="strict")m.length>0&&(vt(l,{code:Ue.unrecognized_keys,keys:m}),o.dirty());else if(g!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const g=this._def.catchall;for(const v of m){const w=l.data[v];h.push({key:{status:"valid",value:v},value:g._parse(new Aa(l,w,l.path,v)),alwaysSet:v in l.data})}}return l.common.async?Promise.resolve().then(async()=>{const g=[];for(const v of h){const w=await v.key,W=await v.value;g.push({key:w,value:W,alwaysSet:v.alwaysSet})}return g}).then(g=>Rr.mergeObjectSync(o,g)):Rr.mergeObjectSync(o,h)}get shape(){return this._def.shape()}strict(a){return zt.errToObj,new ka({...this._def,unknownKeys:"strict",...a!==void 0?{errorMap:(o,l)=>{const s=this._def.errorMap?.(o,l).message??l.defaultError;return o.code==="unrecognized_keys"?{message:zt.errToObj(a).message??s}:{message:s}}}:{}})}strip(){return new ka({...this._def,unknownKeys:"strip"})}passthrough(){return new ka({...this._def,unknownKeys:"passthrough"})}extend(a){return new ka({...this._def,shape:()=>({...this._def.shape(),...a})})}merge(a){return new ka({unknownKeys:a._def.unknownKeys,catchall:a._def.catchall,shape:()=>({...this._def.shape(),...a._def.shape()}),typeName:Jt.ZodObject})}setKey(a,o){return this.augment({[a]:o})}catchall(a){return new ka({...this._def,catchall:a})}pick(a){const o={};for(const l of En.objectKeys(a))a[l]&&this.shape[l]&&(o[l]=this.shape[l]);return new ka({...this._def,shape:()=>o})}omit(a){const o={};for(const l of En.objectKeys(this.shape))a[l]||(o[l]=this.shape[l]);return new ka({...this._def,shape:()=>o})}deepPartial(){return Xo(this)}partial(a){const o={};for(const l of En.objectKeys(this.shape)){const s=this.shape[l];a&&!a[l]?o[l]=s:o[l]=s.optional()}return new ka({...this._def,shape:()=>o})}required(a){const o={};for(const l of En.objectKeys(this.shape))if(a&&!a[l])o[l]=this.shape[l];else{let s=this.shape[l];for(;s instanceof Na;)s=s._def.innerType;o[l]=s}return new ka({...this._def,shape:()=>o})}keyof(){return y0(En.objectKeys(this.shape))}};ca.create=(n,a)=>new ca({shape:()=>n,unknownKeys:"strip",catchall:ni.create(),typeName:Jt.ZodObject,...sn(a)}),ca.strictCreate=(n,a)=>new ca({shape:()=>n,unknownKeys:"strict",catchall:ni.create(),typeName:Jt.ZodObject,...sn(a)}),ca.lazycreate=(n,a)=>new ca({shape:n,unknownKeys:"strip",catchall:ni.create(),typeName:Jt.ZodObject,...sn(a)});var os=class extends mn{_parse(n){const{ctx:a}=this._processInputParams(n),o=this._def.options;function l(s){for(const m of s)if(m.result.status==="valid")return m.result;for(const m of s)if(m.result.status==="dirty")return a.common.issues.push(...m.ctx.common.issues),m.result;const d=s.map(m=>new ya(m.ctx.common.issues));return vt(a,{code:Ue.invalid_union,unionErrors:d}),Yt}if(a.common.async)return Promise.all(o.map(async s=>{const d={...a,common:{...a.common,issues:[]},parent:null};return{result:await s._parseAsync({data:a.data,path:a.path,parent:d}),ctx:d}})).then(l);{let s;const d=[];for(const h of o){const g={...a,common:{...a.common,issues:[]},parent:null},v=h._parseSync({data:a.data,path:a.path,parent:g});if(v.status==="valid")return v;v.status==="dirty"&&!s&&(s={result:v,ctx:g}),g.common.issues.length&&d.push(g.common.issues)}if(s)return a.common.issues.push(...s.ctx.common.issues),s.result;const m=d.map(h=>new ya(h));return vt(a,{code:Ue.invalid_union,unionErrors:m}),Yt}}get options(){return this._def.options}};os.create=(n,a)=>new os({options:n,typeName:Jt.ZodUnion,...sn(a)});var Ai=n=>n instanceof ss?Ai(n.schema):n instanceof xa?Ai(n.innerType()):n instanceof us?[n.value]:n instanceof cs?n.options:n instanceof ds?En.objectValues(n.enum):n instanceof ms?Ai(n._def.innerType):n instanceof as?[void 0]:n instanceof is?[null]:n instanceof Na?[void 0,...Ai(n.unwrap())]:n instanceof _i?[null,...Ai(n.unwrap())]:n instanceof Bm||n instanceof ps?Ai(n.unwrap()):n instanceof fs?Ai(n._def.innerType):[],v0=class mb extends mn{_parse(a){const{ctx:o}=this._processInputParams(a);if(o.parsedType!==St.object)return vt(o,{code:Ue.invalid_type,expected:St.object,received:o.parsedType}),Yt;const l=this.discriminator,s=o.data[l],d=this.optionsMap.get(s);return d?o.common.async?d._parseAsync({data:o.data,path:o.path,parent:o}):d._parseSync({data:o.data,path:o.path,parent:o}):(vt(o,{code:Ue.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[l]}),Yt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(a,o,l){const s=new Map;for(const d of o){const m=Ai(d.shape[a]);if(!m.length)throw new Error(`A discriminator value for key \`${a}\` could not be extracted from all schema options`);for(const h of m){if(s.has(h))throw new Error(`Discriminator property ${String(a)} has duplicate value ${String(h)}`);s.set(h,d)}}return new mb({typeName:Jt.ZodDiscriminatedUnion,discriminator:a,options:o,optionsMap:s,...sn(l)})}};function Tm(n,a){const o=ti(n),l=ti(a);if(n===a)return{valid:!0,data:n};if(o===St.object&&l===St.object){const s=En.objectKeys(a),d=En.objectKeys(n).filter(h=>s.indexOf(h)!==-1),m={...n,...a};for(const h of d){const g=Tm(n[h],a[h]);if(!g.valid)return{valid:!1};m[h]=g.data}return{valid:!0,data:m}}else if(o===St.array&&l===St.array){if(n.length!==a.length)return{valid:!1};const s=[];for(let d=0;d<n.length;d++){const m=n[d],h=a[d],g=Tm(m,h);if(!g.valid)return{valid:!1};s.push(g.data)}return{valid:!0,data:s}}else return o===St.date&&l===St.date&&+n==+a?{valid:!0,data:n}:{valid:!1}}var ls=class extends mn{_parse(n){const{status:a,ctx:o}=this._processInputParams(n),l=(s,d)=>{if(Am(s)||Am(d))return Yt;const m=Tm(s.value,d.value);return m.valid?((Nm(s)||Nm(d))&&a.dirty(),{status:a.value,value:m.data}):(vt(o,{code:Ue.invalid_intersection_types}),Yt)};return o.common.async?Promise.all([this._def.left._parseAsync({data:o.data,path:o.path,parent:o}),this._def.right._parseAsync({data:o.data,path:o.path,parent:o})]).then(([s,d])=>l(s,d)):l(this._def.left._parseSync({data:o.data,path:o.path,parent:o}),this._def.right._parseSync({data:o.data,path:o.path,parent:o}))}};ls.create=(n,a,o)=>new ls({left:n,right:a,typeName:Jt.ZodIntersection,...sn(o)});var Ni=class fb extends mn{_parse(a){const{status:o,ctx:l}=this._processInputParams(a);if(l.parsedType!==St.array)return vt(l,{code:Ue.invalid_type,expected:St.array,received:l.parsedType}),Yt;if(l.data.length<this._def.items.length)return vt(l,{code:Ue.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Yt;!this._def.rest&&l.data.length>this._def.items.length&&(vt(l,{code:Ue.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),o.dirty());const s=[...l.data].map((d,m)=>{const h=this._def.items[m]||this._def.rest;return h?h._parse(new Aa(l,d,l.path,m)):null}).filter(d=>!!d);return l.common.async?Promise.all(s).then(d=>Rr.mergeArray(o,d)):Rr.mergeArray(o,s)}get items(){return this._def.items}rest(a){return new fb({...this._def,rest:a})}};Ni.create=(n,a)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ni({items:n,typeName:Jt.ZodTuple,rest:null,...sn(a)})};var g0=class Bf extends mn{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(a){const{status:o,ctx:l}=this._processInputParams(a);if(l.parsedType!==St.object)return vt(l,{code:Ue.invalid_type,expected:St.object,received:l.parsedType}),Yt;const s=[],d=this._def.keyType,m=this._def.valueType;for(const h in l.data)s.push({key:d._parse(new Aa(l,h,l.path,h)),value:m._parse(new Aa(l,l.data[h],l.path,h)),alwaysSet:h in l.data});return l.common.async?Rr.mergeObjectAsync(o,s):Rr.mergeObjectSync(o,s)}get element(){return this._def.valueType}static create(a,o,l){return o instanceof mn?new Bf({keyType:a,valueType:o,typeName:Jt.ZodRecord,...sn(l)}):new Bf({keyType:Zo.create(),valueType:a,typeName:Jt.ZodRecord,...sn(o)})}},Ku=class extends mn{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(n){const{status:a,ctx:o}=this._processInputParams(n);if(o.parsedType!==St.map)return vt(o,{code:Ue.invalid_type,expected:St.map,received:o.parsedType}),Yt;const l=this._def.keyType,s=this._def.valueType,d=[...o.data.entries()].map(([m,h],g)=>({key:l._parse(new Aa(o,m,o.path,[g,"key"])),value:s._parse(new Aa(o,h,o.path,[g,"value"]))}));if(o.common.async){const m=new Map;return Promise.resolve().then(async()=>{for(const h of d){const g=await h.key,v=await h.value;if(g.status==="aborted"||v.status==="aborted")return Yt;(g.status==="dirty"||v.status==="dirty")&&a.dirty(),m.set(g.value,v.value)}return{status:a.value,value:m}})}else{const m=new Map;for(const h of d){const g=h.key,v=h.value;if(g.status==="aborted"||v.status==="aborted")return Yt;(g.status==="dirty"||v.status==="dirty")&&a.dirty(),m.set(g.value,v.value)}return{status:a.value,value:m}}}};Ku.create=(n,a,o)=>new Ku({valueType:a,keyType:n,typeName:Jt.ZodMap,...sn(o)});var Gu=class Df extends mn{_parse(a){const{status:o,ctx:l}=this._processInputParams(a);if(l.parsedType!==St.set)return vt(l,{code:Ue.invalid_type,expected:St.set,received:l.parsedType}),Yt;const s=this._def;s.minSize!==null&&l.data.size<s.minSize.value&&(vt(l,{code:Ue.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),o.dirty()),s.maxSize!==null&&l.data.size>s.maxSize.value&&(vt(l,{code:Ue.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),o.dirty());const d=this._def.valueType;function m(g){const v=new Set;for(const w of g){if(w.status==="aborted")return Yt;w.status==="dirty"&&o.dirty(),v.add(w.value)}return{status:o.value,value:v}}const h=[...l.data.values()].map((g,v)=>d._parse(new Aa(l,g,l.path,v)));return l.common.async?Promise.all(h).then(g=>m(g)):m(h)}min(a,o){return new Df({...this._def,minSize:{value:a,message:zt.toString(o)}})}max(a,o){return new Df({...this._def,maxSize:{value:a,message:zt.toString(o)}})}size(a,o){return this.min(a,o).max(a,o)}nonempty(a){return this.min(1,a)}};Gu.create=(n,a)=>new Gu({valueType:n,minSize:null,maxSize:null,typeName:Jt.ZodSet,...sn(a)});var b0=class Tc extends mn{constructor(){super(...arguments),this.validate=this.implement}_parse(a){const{ctx:o}=this._processInputParams(a);if(o.parsedType!==St.function)return vt(o,{code:Ue.invalid_type,expected:St.function,received:o.parsedType}),Yt;function l(h,g){return qu({data:h,path:o.path,errorMaps:[o.common.contextualErrorMap,o.schemaErrorMap,Wu(),qo].filter(v=>!!v),issueData:{code:Ue.invalid_arguments,argumentsError:g}})}function s(h,g){return qu({data:h,path:o.path,errorMaps:[o.common.contextualErrorMap,o.schemaErrorMap,Wu(),qo].filter(v=>!!v),issueData:{code:Ue.invalid_return_type,returnTypeError:g}})}const d={errorMap:o.common.contextualErrorMap},m=o.data;if(this._def.returns instanceof Ko){const h=this;return Nr(async function(...g){const v=new ya([]),w=await h._def.args.parseAsync(g,d).catch(S=>{throw v.addIssue(l(g,S)),v}),W=await Reflect.apply(m,this,w);return await h._def.returns._def.type.parseAsync(W,d).catch(S=>{throw v.addIssue(s(W,S)),v})})}else{const h=this;return Nr(function(...g){const v=h._def.args.safeParse(g,d);if(!v.success)throw new ya([l(g,v.error)]);const w=Reflect.apply(m,this,v.data),W=h._def.returns.safeParse(w,d);if(!W.success)throw new ya([s(w,W.error)]);return W.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...a){return new Tc({...this._def,args:Ni.create(a).rest(no.create())})}returns(a){return new Tc({...this._def,returns:a})}implement(a){return this.parse(a)}strictImplement(a){return this.parse(a)}static create(a,o,l){return new Tc({args:a||Ni.create([]).rest(no.create()),returns:o||no.create(),typeName:Jt.ZodFunction,...sn(l)})}},ss=class extends mn{get schema(){return this._def.getter()}_parse(n){const{ctx:a}=this._processInputParams(n);return this._def.getter()._parse({data:a.data,path:a.path,parent:a})}};ss.create=(n,a)=>new ss({getter:n,typeName:Jt.ZodLazy,...sn(a)});var us=class extends mn{_parse(n){if(n.data!==this._def.value){const a=this._getOrReturnCtx(n);return vt(a,{received:a.data,code:Ue.invalid_literal,expected:this._def.value}),Yt}return{status:"valid",value:n.data}}get value(){return this._def.value}};us.create=(n,a)=>new us({value:n,typeName:Jt.ZodLiteral,...sn(a)});function y0(n,a){return new cs({values:n,typeName:Jt.ZodEnum,...sn(a)})}var cs=class zf extends mn{_parse(a){if(typeof a.data!="string"){const o=this._getOrReturnCtx(a),l=this._def.values;return vt(o,{expected:En.joinValues(l),received:o.parsedType,code:Ue.invalid_type}),Yt}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(a.data)){const o=this._getOrReturnCtx(a),l=this._def.values;return vt(o,{received:o.data,code:Ue.invalid_enum_value,options:l}),Yt}return Nr(a.data)}get options(){return this._def.values}get enum(){const a={};for(const o of this._def.values)a[o]=o;return a}get Values(){const a={};for(const o of this._def.values)a[o]=o;return a}get Enum(){const a={};for(const o of this._def.values)a[o]=o;return a}extract(a,o=this._def){return zf.create(a,{...this._def,...o})}exclude(a,o=this._def){return zf.create(this.options.filter(l=>!a.includes(l)),{...this._def,...o})}};cs.create=y0;var ds=class extends mn{_parse(n){const a=En.getValidEnumValues(this._def.values),o=this._getOrReturnCtx(n);if(o.parsedType!==St.string&&o.parsedType!==St.number){const l=En.objectValues(a);return vt(o,{expected:En.joinValues(l),received:o.parsedType,code:Ue.invalid_type}),Yt}if(this._cache||(this._cache=new Set(En.getValidEnumValues(this._def.values))),!this._cache.has(n.data)){const l=En.objectValues(a);return vt(o,{received:o.data,code:Ue.invalid_enum_value,options:l}),Yt}return Nr(n.data)}get enum(){return this._def.values}};ds.create=(n,a)=>new ds({values:n,typeName:Jt.ZodNativeEnum,...sn(a)});var Ko=class extends mn{unwrap(){return this._def.type}_parse(n){const{ctx:a}=this._processInputParams(n);if(a.parsedType!==St.promise&&a.common.async===!1)return vt(a,{code:Ue.invalid_type,expected:St.promise,received:a.parsedType}),Yt;const o=a.parsedType===St.promise?a.data:Promise.resolve(a.data);return Nr(o.then(l=>this._def.type.parseAsync(l,{path:a.path,errorMap:a.common.contextualErrorMap})))}};Ko.create=(n,a)=>new Ko({type:n,typeName:Jt.ZodPromise,...sn(a)});var xa=class extends mn{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Jt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(n){const{status:a,ctx:o}=this._processInputParams(n),l=this._def.effect||null,s={addIssue:d=>{vt(o,d),d.fatal?a.abort():a.dirty()},get path(){return o.path}};if(s.addIssue=s.addIssue.bind(s),l.type==="preprocess"){const d=l.transform(o.data,s);if(o.common.async)return Promise.resolve(d).then(async m=>{if(a.value==="aborted")return Yt;const h=await this._def.schema._parseAsync({data:m,path:o.path,parent:o});return h.status==="aborted"?Yt:h.status==="dirty"||a.value==="dirty"?Zu(h.value):h});{if(a.value==="aborted")return Yt;const m=this._def.schema._parseSync({data:d,path:o.path,parent:o});return m.status==="aborted"?Yt:m.status==="dirty"||a.value==="dirty"?Zu(m.value):m}}if(l.type==="refinement"){const d=m=>{const h=l.refinement(m,s);if(o.common.async)return Promise.resolve(h);if(h instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return m};if(o.common.async===!1){const m=this._def.schema._parseSync({data:o.data,path:o.path,parent:o});return m.status==="aborted"?Yt:(m.status==="dirty"&&a.dirty(),d(m.value),{status:a.value,value:m.value})}else return this._def.schema._parseAsync({data:o.data,path:o.path,parent:o}).then(m=>m.status==="aborted"?Yt:(m.status==="dirty"&&a.dirty(),d(m.value).then(()=>({status:a.value,value:m.value}))))}if(l.type==="transform")if(o.common.async===!1){const d=this._def.schema._parseSync({data:o.data,path:o.path,parent:o});if(!to(d))return Yt;const m=l.transform(d.value,s);if(m instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:a.value,value:m}}else return this._def.schema._parseAsync({data:o.data,path:o.path,parent:o}).then(d=>to(d)?Promise.resolve(l.transform(d.value,s)).then(m=>({status:a.value,value:m})):Yt);En.assertNever(l)}};xa.create=(n,a,o)=>new xa({schema:n,typeName:Jt.ZodEffects,effect:a,...sn(o)}),xa.createWithPreprocess=(n,a,o)=>new xa({schema:a,effect:{type:"preprocess",transform:n},typeName:Jt.ZodEffects,...sn(o)});var Na=class extends mn{_parse(n){return this._getType(n)===St.undefined?Nr(void 0):this._def.innerType._parse(n)}unwrap(){return this._def.innerType}};Na.create=(n,a)=>new Na({innerType:n,typeName:Jt.ZodOptional,...sn(a)});var _i=class extends mn{_parse(n){return this._getType(n)===St.null?Nr(null):this._def.innerType._parse(n)}unwrap(){return this._def.innerType}};_i.create=(n,a)=>new _i({innerType:n,typeName:Jt.ZodNullable,...sn(a)});var ms=class extends mn{_parse(n){const{ctx:a}=this._processInputParams(n);let o=a.data;return a.parsedType===St.undefined&&(o=this._def.defaultValue()),this._def.innerType._parse({data:o,path:a.path,parent:a})}removeDefault(){return this._def.innerType}};ms.create=(n,a)=>new ms({innerType:n,typeName:Jt.ZodDefault,defaultValue:typeof a.default=="function"?a.default:()=>a.default,...sn(a)});var fs=class extends mn{_parse(n){const{ctx:a}=this._processInputParams(n),o={...a,common:{...a.common,issues:[]}},l=this._def.innerType._parse({data:o.data,path:o.path,parent:{...o}});return Ql(l)?l.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new ya(o.common.issues)},input:o.data})})):{status:"valid",value:l.status==="valid"?l.value:this._def.catchValue({get error(){return new ya(o.common.issues)},input:o.data})}}removeCatch(){return this._def.innerType}};fs.create=(n,a)=>new fs({innerType:n,typeName:Jt.ZodCatch,catchValue:typeof a.catch=="function"?a.catch:()=>a.catch,...sn(a)});var Yu=class extends mn{_parse(n){if(this._getType(n)!==St.nan){const a=this._getOrReturnCtx(n);return vt(a,{code:Ue.invalid_type,expected:St.nan,received:a.parsedType}),Yt}return{status:"valid",value:n.data}}};Yu.create=n=>new Yu({typeName:Jt.ZodNaN,...sn(n)});var H1=Symbol("zod_brand"),Bm=class extends mn{_parse(n){const{ctx:a}=this._processInputParams(n),o=a.data;return this._def.type._parse({data:o,path:a.path,parent:a})}unwrap(){return this._def.type}},Dm=class pb extends mn{_parse(a){const{status:o,ctx:l}=this._processInputParams(a);if(l.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:l.data,path:l.path,parent:l});return s.status==="aborted"?Yt:s.status==="dirty"?(o.dirty(),Zu(s.value)):this._def.out._parseAsync({data:s.value,path:l.path,parent:l})})();{const s=this._def.in._parseSync({data:l.data,path:l.path,parent:l});return s.status==="aborted"?Yt:s.status==="dirty"?(o.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:l.path,parent:l})}}static create(a,o){return new pb({in:a,out:o,typeName:Jt.ZodPipeline})}},ps=class extends mn{_parse(n){const a=this._def.innerType._parse(n),o=l=>(to(l)&&(l.value=Object.freeze(l.value)),l);return Ql(a)?a.then(l=>o(l)):o(a)}unwrap(){return this._def.innerType}};ps.create=(n,a)=>new ps({innerType:n,typeName:Jt.ZodReadonly,...sn(a)});function x0(n,a){const o=typeof n=="function"?n(a):typeof n=="string"?{message:n}:n;return typeof o=="string"?{message:o}:o}function w0(n,a={},o){return n?Uo.create().superRefine((l,s)=>{const d=n(l);if(d instanceof Promise)return d.then(m=>{if(!m){const h=x0(a,l),g=h.fatal??o??!0;s.addIssue({code:"custom",...h,fatal:g})}});if(!d){const m=x0(a,l),h=m.fatal??o??!0;s.addIssue({code:"custom",...m,fatal:h})}}):Uo.create()}var V1={object:ca.lazycreate},Jt;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(Jt||(Jt={}));var W1=(n,a={message:`Input not instance of ${n.name}`})=>w0(o=>o instanceof n,a),E0=Zo.create,k0=es.create,q1=Yu.create,Z1=ts.create,C0=ns.create,U1=rs.create,X1=Uu.create,K1=as.create,G1=is.create,Y1=Uo.create,J1=no.create,Q1=ni.create,ex=Xu.create,tx=ro.create,nx=ca.create,rx=ca.strictCreate,ax=os.create,ix=v0.create,ox=ls.create,lx=Ni.create,sx=g0.create,ux=Ku.create,cx=Gu.create,dx=b0.create,mx=ss.create,fx=us.create,px=cs.create,hx=ds.create,vx=Ko.create,S0=xa.create,gx=Na.create,bx=_i.create,yx=xa.createWithPreprocess,xx=Dm.create,wx=()=>E0().optional(),Ex=()=>k0().optional(),kx=()=>C0().optional(),Cx={string:(n=>Zo.create({...n,coerce:!0})),number:(n=>es.create({...n,coerce:!0})),boolean:(n=>ns.create({...n,coerce:!0})),bigint:(n=>ts.create({...n,coerce:!0})),date:(n=>rs.create({...n,coerce:!0}))},Sx=Yt,hs={color:ce.string().max(32),width:ce.number().positive().max(200)},ri={rotation:ce.number().min(-180).max(180).optional()},ao={startAt:ce.number().min(0).optional(),endAt:ce.number().min(0).optional(),timelineTrack:ce.number().int().min(0).max(99).optional()},Fx=ce.discriminatedUnion("type",[ce.object({type:ce.literal("pen"),points:ce.array(ce.number()).min(4),...hs,...ao,...ri}),ce.object({type:ce.literal("line"),x1:ce.number(),y1:ce.number(),x2:ce.number(),y2:ce.number(),...hs,...ao,...ri}),ce.object({type:ce.literal("arrow"),x1:ce.number(),y1:ce.number(),x2:ce.number(),y2:ce.number(),...hs,...ao,...ri}),ce.object({type:ce.literal("rect"),x:ce.number(),y:ce.number(),w:ce.number(),h:ce.number(),...hs,...ao,...ri}),ce.object({type:ce.literal("ellipse"),x:ce.number(),y:ce.number(),w:ce.number(),h:ce.number(),...hs,...ao,...ri}),ce.object({type:ce.literal("text"),x:ce.number(),y:ce.number(),text:ce.string().max(500),color:ce.string().max(32),fontSize:ce.number().positive().max(512),startAt:ce.number().min(0).optional(),endAt:ce.number().min(0).optional(),timelineTrack:ce.number().int().min(0).max(99).optional(),...ri}),ce.object({type:ce.literal("sticker"),x:ce.number().optional(),y:ce.number().optional(),w:ce.number().positive().optional(),h:ce.number().positive().optional(),emoji:ce.string().max(16).optional(),src:ce.string().optional(),startAt:ce.number().min(0).optional(),endAt:ce.number().min(0).optional(),timelineTrack:ce.number().int().min(0).max(99).optional(),...ri}),ce.object({type:ce.literal("filter"),x:ce.number().optional(),y:ce.number().optional(),w:ce.number().positive().optional(),h:ce.number().positive().optional(),filterPreset:ce.string().max(32).optional(),...ao,...ri}),ce.object({type:ce.literal("adjust"),x:ce.number(),y:ce.number(),w:ce.number().positive(),h:ce.number().positive(),brightness:ce.number().min(-1).max(1).default(0),contrast:ce.number().min(-1).max(1).default(0),saturation:ce.number().min(-1).max(1).default(0),temperature:ce.number().min(-1).max(1).default(0),tint:ce.number().min(-1).max(1).default(0),vibrance:ce.number().min(-1).max(1).default(0),gamma:ce.number().min(-1).max(1).default(0),highlights:ce.number().min(-1).max(1).default(0),shadows:ce.number().min(-1).max(1).default(0),whites:ce.number().min(-1).max(1).default(0),blacks:ce.number().min(-1).max(1).default(0),lightSense:ce.number().min(-1).max(1).default(0),sharpen:ce.number().min(0).max(1).default(0),clarity:ce.number().min(0).max(1).default(0),grain:ce.number().min(0).max(1).default(0),fade:ce.number().min(0).max(1).default(0),vignette:ce.number().min(0).max(1).default(0),...ao,...ri})]),Mx=ce.object({srcIdx:ce.number().int().min(0).max(7),in:ce.number().min(0),out:ce.number().min(0)}),Lx=ce.object({srcIdx:ce.number().int().min(0).max(2),track:ce.number().int().min(0).default(0),startAt:ce.number().min(0),in:ce.number().min(0),out:ce.number().min(0),speed:ce.number().min(.5).max(2).default(1),volume:ce.number().min(0).max(2),fadeIn:ce.number().min(0).default(0),fadeOut:ce.number().min(0).default(0)}),Ax=ce.object({type:ce.enum(["none","fade","slide","wipe","flip","clockWipe","star","circle","rectangle"]).default("none"),duration:ce.number().min(0).max(2).default(.4)}),Nx=ce.object({fileName:ce.string().max(120).optional(),format:ce.enum(["mp4","mov","mxf"]).default("mp4"),width:ce.number().int().min(2).max(8192).optional(),height:ce.number().int().min(2).max(8192).optional(),frameRate:ce.number().int().min(12).max(120).default(30),videoBitrateKbps:ce.number().int().min(100).max(5e4).optional(),audioBitrateKbps:ce.number().int().min(32).max(1024).optional(),audioCodec:ce.enum(["aac","mp3"]).default("aac")}).optional(),_x=ce.object({clips:ce.array(Mx).min(1).max(50),audioClips:ce.array(Lx).max(8).default([]),canvas:ce.object({w:ce.number().int().min(2).max(4096),h:ce.number().int().min(2).max(4096)}),crop:ce.object({x:ce.number().min(0),y:ce.number().min(0),width:ce.number().positive(),height:ce.number().positive()}).optional(),scale:ce.object({width:ce.number().positive(),height:ce.number().positive(),fit:ce.enum(["contain","cover","force"])}).optional(),rotation:ce.number().min(-180).max(180).default(0),flipX:ce.boolean().default(!1),flipY:ce.boolean().default(!1),filters:ce.object({brightness:ce.number().min(-1).max(1).default(0),contrast:ce.number().min(-1).max(1).default(0),saturation:ce.number().min(-1).max(1).default(0),temperature:ce.number().min(-1).max(1).default(0),tint:ce.number().min(-1).max(1).default(0),vibrance:ce.number().min(-1).max(1).default(0),gamma:ce.number().min(-1).max(1).default(0),highlights:ce.number().min(-1).max(1).default(0),shadows:ce.number().min(-1).max(1).default(0),whites:ce.number().min(-1).max(1).default(0),blacks:ce.number().min(-1).max(1).default(0),lightSense:ce.number().min(-1).max(1).default(0),sharpen:ce.number().min(0).max(1).default(0),clarity:ce.number().min(0).max(1).default(0),grain:ce.number().min(0).max(1).default(0),fade:ce.number().min(0).max(1).default(0),vignette:ce.number().min(0).max(1).default(0)}).default({brightness:0,contrast:0,saturation:0,temperature:0,tint:0,vibrance:0,gamma:0,highlights:0,shadows:0,whites:0,blacks:0,lightSense:0,sharpen:0,clarity:0,grain:0,fade:0,vignette:0}),filterPreset:ce.string().max(32).optional(),overlays:ce.array(Fx).max(200).optional(),transitions:ce.array(Ax).max(49).default([]),keepAudio:ce.boolean().default(!0),poster:ce.object({time:ce.number().min(0),useAsVideoCover:ce.boolean().optional(),preview:ce.string().optional()}).optional(),exportSettings:Nx}).superRefine((n,a)=>{n.clips.forEach((o,l)=>{o.out<=o.in&&a.addIssue({code:ce.ZodIssueCode.custom,message:`clips[${l}].out \u5FC5\u987B\u5927\u4E8E in`,path:["clips",l,"out"]})}),n.audioClips?.forEach((o,l)=>{o.out<=o.in&&a.addIssue({code:ce.ZodIssueCode.custom,message:`audioClips[${l}].out \u5FC5\u987B\u5927\u4E8E in`,path:["audioClips",l,"out"]})}),(n.canvas.w%2!==0||n.canvas.h%2!==0)&&a.addIssue({code:ce.ZodIssueCode.custom,message:"canvas \u5BBD\u9AD8\u5FC5\u987B\u4E3A\u5076\u6570",path:["canvas"]}),n.exportSettings?.width!=null&&n.exportSettings.width%2!==0&&a.addIssue({code:ce.ZodIssueCode.custom,message:"exportSettings.width \u5FC5\u987B\u4E3A\u5076\u6570",path:["exportSettings","width"]}),n.exportSettings?.height!=null&&n.exportSettings.height%2!==0&&a.addIssue({code:ce.ZodIssueCode.custom,message:"exportSettings.height \u5FC5\u987B\u4E3A\u5076\u6570",path:["exportSettings","height"]})});function Ju(){return{clips:[],audioClips:[],canvas:{w:2,h:2},rotation:0,flipX:!1,flipY:!1,filters:{brightness:0,contrast:0,saturation:0,temperature:0,tint:0,vibrance:0,gamma:0,highlights:0,shadows:0,whites:0,blacks:0,lightSense:0,sharpen:0,clarity:0,grain:0,fade:0,vignette:0},transitions:[],keepAudio:!0}}var Ti=.1;function vs(n){return n.out-n.in}function ai(n){return n.reduce((a,o)=>a+vs(o),0)}function Qu(n,a){let o=0;for(let l=0;l<a&&l<n.length;l++)o+=vs(n[l]);return o}function io(n,a){if(!n.length||a<0)return null;let o=0;for(let l=0;l<n.length;l++){const s=vs(n[l]);if(a<o+s)return{idx:l,srcTime:n[l].in+(a-o)};o+=s}if(Math.abs(a-o)<1e-9||a<=o){const l=n.length-1;return{idx:l,srcTime:n[l].out}}return null}function Tx(n,a){const o=io(n,a);if(!o)return n;const l=n[o.idx];return o.srcTime<l.in+Ti||o.srcTime>l.out-Ti?n:[...n.slice(0,o.idx),{...l,out:o.srcTime},{...l,in:o.srcTime},...n.slice(o.idx+1)]}function Bx(n,a){return n.length<=1||!n[a]?n:n.filter((o,l)=>l!==a)}function Dx(n,a){const o=n[a];return o?[...n.slice(0,a+1),{...o},...n.slice(a+1)]:n}function F0(n,a,o){if(a===o||!n[a]||o<0||o>=n.length)return n;const l=[...n],[s]=l.splice(a,1);return l.splice(o,0,s),l}function M0(n,a,o,l,s){if(!n[a])return n;const d=n.map(m=>({...m}));return o==="in"?d[a].in=Math.min(Math.max(l,0),d[a].out-Ti):d[a].out=Math.max(Math.min(l,s),d[a].in+Ti),d}function gs(n,a,o){const l=Math.max(Math.min(n.out,a),Ti),s=Math.min(Math.max(n.in,0),l-Ti),d=Math.min(Math.max(n.startAt,0),Math.max(0,o-Ti)),m=Math.max(Ti,l-s),h=Math.min(Math.max(Number(n.speed)||1,.5),2),g=Number.isInteger(n.track)&&n.track>=0?n.track:0,v=Math.min(Math.max(Number(n.fadeIn)||0,0),m),w=Math.min(Math.max(Number(n.fadeOut)||0,0),Math.max(0,m-v));return{...n,track:g,in:s,out:l,startAt:d,speed:h,fadeIn:v,fadeOut:w}}function zx(n=[]){return(n??[]).reduce((a,o)=>{if(o?.type!=="text"&&o?.type!=="sticker")return a;const l=Number.isFinite(o?.startAt)?Math.max(0,Number(o.startAt)):0,s=Number.isFinite(o?.endAt)?Math.max(l,Number(o.endAt)):l;return Math.max(a,s)},0)}function zm(n,a=[],o=[]){const l=ai(n),s=a.reduce((m,h)=>Math.max(m,h.startAt+(h.out-h.in)),0),d=zx(o);return Math.max(l,s,d)}function L0(n){return[...new Set(n.map(a=>a.srcIdx))].sort((a,o)=>a-o)}function Px(n,a){const o=new Map(a.map((l,s)=>[l,s]));return n.map(l=>({...l,srcIdx:o.get(l.srcIdx)??0}))}var jx=100;function Pm(n){return{past:[],present:n,future:[]}}function A0(n,a){if(a===n.present)return n;const o=[...n.past,n.present];return o.length>jx&&o.shift(),{past:o,present:a,future:[]}}function N0(n,a){return a===n.present?n:{...n,present:a}}function _0(n){return n.past.length>0}function T0(n){return n.future.length>0}function Ox(n){return _0(n)?{past:n.past.slice(0,-1),present:n.past[n.past.length-1],future:[n.present,...n.future]}:n}function $x(n){if(!T0(n))return n;const[a,...o]=n.future;return{past:[...n.past,n.present],present:a,future:o}}function B0(n){const a=Math.min(Math.max(Math.round(n),2),4096);return a%2===0?a:a-1}var D0=n=>Math.min(Math.max(n,-180),180),jm=class{constructor(n=Ju()){this.videoSources=[],this.audioSources=[],this.listeners=new Set,this.transientBase=null,this.getSnapshot=()=>this.history.present,this.subscribe=a=>(this.listeners.add(a),()=>this.listeners.delete(a)),this.history=Pm(n)}getState(){return this.history.present}emit(){const n=this.history.present;for(const a of this.listeners)a(n)}canUndo(){return _0(this.history)}canRedo(){return T0(this.history)}undo(){this.transientBase=null,this.history=Ox(this.history),this.emit()}redo(){this.transientBase=null,this.history=$x(this.history),this.emit()}applyMut(n,a=!1){if(a)this.transientBase===null&&(this.transientBase=this.history.present),this.history=N0(this.history,n(this.transientBase));else{const o=this.transientBase??this.history.present,l=n(o),s=this.transientBase?{...this.history,present:this.transientBase}:this.history;this.history=A0(s,l),this.transientBase=null}this.emit()}registerVideoSource(n){const a=this.videoSources.length;this.videoSources.push(n);const o={srcIdx:a,in:0,out:n.duration};return a===0||this.history.present.clips.length===0?(this.transientBase=null,this.history=Pm({...Ju(),clips:[o],canvas:{w:B0(n.width),h:B0(n.height)},poster:{time:Math.min(1,n.duration/2)}}),this.emit()):this.applyMut(l=>({...l,clips:[...l.clips,o]})),a}registerAudioSource(n){const a=this.audioSources.length;return this.audioSources.push(n),this.applyMut(o=>{const l=new Set((o.audioClips??[]).map((m,h)=>Number.isInteger(m?.track)&&m.track>=0?m.track:h));let s=0;for(;l.has(s);)s+=1;const d=gs({srcIdx:a,track:s,startAt:0,in:0,out:n.duration,volume:1},n.duration,ai(o.clips));return{...o,audioClips:[...o.audioClips,d]}}),a}getVideoSource(n){return this.videoSources[n]}getAudioSource(n){return this.audioSources[n]}addClipFromSource(n){const a=this.videoSources[n];a&&this.applyMut(o=>({...o,clips:[...o.clips,{srcIdx:n,in:0,out:a.duration}]}))}splitAtPlayhead(n){this.applyMut(a=>({...a,clips:Tx(a.clips,n)}))}removeClip(n){this.applyMut(a=>({...a,clips:Bx(a.clips,n)}))}duplicateClip(n){this.applyMut(a=>({...a,clips:Dx(a.clips,n)}))}reorderClips(n,a){this.applyMut(o=>({...o,clips:F0(o.clips,n,a)}))}trimClip(n,a,o,l){this.applyMut(s=>{const d=s.clips[n];if(!d)return s;const m=this.videoSources[d.srcIdx]?.duration??d.out;return{...s,clips:M0(s.clips,n,a,o,m)}},l?.transient)}moveAudioClip(n,a,o){this.applyMut(l=>this.patchAudio(l,n,s=>({...s,startAt:a})),o?.transient)}trimAudioClip(n,a,o,l){this.applyMut(s=>this.patchAudio(s,n,d=>{if(a==="in"){const m=o-d.in;return{...d,in:o,startAt:d.startAt+m}}return{...d,out:o}}),l?.transient)}setAudioVolume(n,a,o){this.applyMut(l=>this.patchAudio(l,n,s=>({...s,volume:a}),!1),o?.transient)}removeAudioClip(n){this.applyMut(a=>({...a,audioClips:a.audioClips.filter((o,l)=>l!==n)}))}patchAudio(n,a,o,l=!0){const s=n.audioClips[a];if(!s)return n;let d=o(s);if(l){const m=this.audioSources[s.srcIdx]?.duration??s.out;d=gs(d,m,ai(n.clips))}return{...n,audioClips:n.audioClips.map((m,h)=>h===a?d:m)}}setCrop(n,a){this.applyMut(o=>({...o,crop:n}),a?.transient)}clearCrop(){this.applyMut(n=>({...n,crop:void 0}))}setScale(n){this.applyMut(a=>({...a,scale:n}))}clearScale(){this.applyMut(n=>({...n,scale:void 0}))}setRotation(n,a){this.applyMut(o=>({...o,rotation:D0(n)}),a?.transient)}rotateBy(n){this.applyMut(a=>{let o=a.rotation+n;return o>180&&(o-=360),o<-180&&(o+=360),{...a,rotation:D0(o)}})}flipX(){this.applyMut(n=>({...n,flipX:!n.flipX}))}flipY(){this.applyMut(n=>({...n,flipY:!n.flipY}))}setFilter(n,a,o){this.applyMut(l=>({...l,filters:{...l.filters,[n]:a}}),o?.transient)}setFilters(n,a){this.applyMut(o=>({...o,filters:{...o.filters,...n}}),a?.transient)}setFilterPreset(n){this.applyMut(a=>({...a,filterPreset:n}))}addOverlay(n){this.applyMut(a=>({...a,overlays:[...a.overlays??[],n]}))}updateOverlay(n,a,o){this.applyMut(l=>{const s=l.overlays??[];return s[n]?{...l,overlays:s.map((d,m)=>m===n?{...d,...a}:d)}:l},o?.transient)}removeOverlay(n){this.applyMut(a=>({...a,overlays:(a.overlays??[]).filter((o,l)=>l!==n)}))}patch(n,a){a?.transient?(this.transientBase===null&&(this.transientBase=this.history.present),this.history=N0(this.history,{...this.transientBase,...n}),this.emit()):this.commit(n)}commit(n){const a=n?{...this.history.present,...n}:this.history.present,o=this.transientBase;this.transientBase=null,this.history=A0(o?{...this.history,present:o}:this.history,a),this.emit()}setKeepAudio(n){this.applyMut(a=>({...a,keepAudio:n}))}setPoster(n){this.applyMut(a=>({...a,poster:{time:Math.max(0,n)}}))}totalDuration(){return ai(this.history.present.clips)}contentDuration(){const n=this.history.present;return zm(n.clips,n.audioClips,n.overlays)}locate(n){return io(this.history.present.clips,n)}usedVideoSources(){return L0(this.history.present.clips)}getExportPlan(){const n=this.history.present,a=L0(n.clips),o=[...new Set(n.audioClips.map(s=>s.srcIdx))].sort((s,d)=>s-d),l=new Map(o.map((s,d)=>[s,d]));return{state:{...n,clips:Px(n.clips,a),audioClips:n.audioClips.map(s=>({...s,srcIdx:l.get(s.srcIdx)??0}))},videoSrcOrder:a,audioSrcOrder:o}}validate(){return _x.safeParse(this.getExportPlan().state)}reset(n=Ju()){this.transientBase=null,this.history=Pm(n),this.emit()}};function z0(n,a){const o=n.replace(/\/$/,""),l=a.startsWith("/")?a:`/${a}`;return`${o}${l}`}async function P0(n,a){const o=await n.json().catch(()=>({}));return new Error(o.message||o.error||a)}function Rx(n={}){const a=n.baseUrl??"",o=n.fetch??globalThis.fetch,l=n.paths?.video??"/api/editor/video",s=n.paths?.poster??"/api/editor/poster";return{async exportVideo(d){const m=await o(z0(a,l),{method:"POST",body:d});if(!m.ok)throw await P0(m,"\u89C6\u9891\u5904\u7406\u5931\u8D25");return m.blob()},async extractPoster(d,m){const h=new FormData;h.append("file",d,d.name||"video.mp4"),h.append("time",String(m));const g=await o(z0(a,s),{method:"POST",body:h});if(!g.ok)throw await P0(g,"\u5C01\u9762\u62BD\u53D6\u5931\u8D25");return g.blob()}}}var Om=Math.PI/180;function Go(n,a,o){const l=Ix(o);if(l===0||l===180)return{w:n,h:a};if(l===90||l===270)return{w:a,h:n};const s=l*Om;return{w:Math.round(Math.abs(n*Math.cos(s))+Math.abs(a*Math.sin(s))),h:Math.round(Math.abs(n*Math.sin(s))+Math.abs(a*Math.cos(s)))}}function Ix(n){return(n%360+360)%360}function Kn(n){const a=Math.round(n);return a-a%2}function j0(n,a,o=40){const l=Math.min(Math.max(o,n.width),a.w),s=Math.min(Math.max(o,n.height),a.h),d=Math.min(Math.max(0,n.x),a.w-l),m=Math.min(Math.max(0,n.y),a.h-s);return{x:Math.round(d),y:Math.round(m),width:Math.round(l),height:Math.round(s)}}function ec(n,a){let o=n.w,l=o/a;return l>n.h&&(l=n.h,o=l*a),{x:Math.round((n.w-o)/2),y:Math.round((n.h-l)/2),width:Math.round(o),height:Math.round(l)}}function $m(n,a,o){const l={x:0,y:0,width:n.width,height:n.height},s={x:0,y:0,width:a.w,height:a.h};return o==="cover"?{src:ec({w:n.width,h:n.height},a.w/a.h),dst:s}:o==="contain"?{src:l,dst:ec({w:a.w,h:a.h},n.width/n.height)}:{src:l,dst:s}}function oo(n,a){if(a.scale)return{w:Kn(a.scale.width),h:Kn(a.scale.height)};if(a.crop)return{w:Kn(a.crop.width),h:Kn(a.crop.height)};const o=Go(n.w,n.h,a.rotation);return{w:Kn(o.w),h:Kn(o.h)}}var O0=[{id:"bw",label:"\u9ED1\u767D",vf:"hue=s=0",css:"grayscale(1)"},{id:"sepia",label:"\u590D\u53E4",vf:"colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131",css:"sepia(0.85)"},{id:"warm",label:"\u6696\u9633",vf:"colorbalance=rs=.15:gs=.04:bs=-.15",css:"sepia(0.25) saturate(1.25) brightness(1.03)"},{id:"cool",label:"\u51B7\u8C03",vf:"colorbalance=rs=-.14:bs=.16",css:"hue-rotate(12deg) saturate(0.95) brightness(1.02)"},{id:"vivid",label:"\u9C9C\u8273",vf:"eq=saturation=1.45:contrast=1.08",css:"saturate(1.45) contrast(1.08)"}];function $0(n){return n?O0.find(a=>a.id===n):void 0}function Rm(n,a){const o=$0(a)?.css??"";return[`brightness(${1+n.brightness})`,`contrast(${1+n.contrast})`,`saturate(${1+n.saturation})`,o].filter(Boolean).join(" ")}var R0=Math.PI/180;function tc(n,a,o){n.strokeStyle=a,n.lineWidth=o,n.lineCap="round",n.lineJoin="round"}function Hx(n,a,o,l,s,d){const m=Math.atan2(s-o,l-a),h=Math.max(12,d*3.5);n.beginPath(),n.moveTo(l,s),n.lineTo(l-h*Math.cos(m-Math.PI/7),s-h*Math.sin(m-Math.PI/7)),n.moveTo(l,s),n.lineTo(l-h*Math.cos(m+Math.PI/7),s-h*Math.sin(m+Math.PI/7)),n.stroke()}function I0(n){if(!Number.isFinite(n))return 0;let a=n%360;return a>180&&(a-=360),a<-180&&(a+=360),Math.abs(a)<.001?0:a}var Vx=.84;function Wx(n){const a=Math.max(8,Number(n?.w)||0),o=Math.max(8,Number(n?.h)||0),l=Math.max(8,Math.min(a,o)*Vx);return{x:(Number(n?.x)||0)+(a-l)/2,y:(Number(n?.y)||0)+(o-l)/2,size:l}}var Im=null;function qx(){return typeof document>"u"?null:(Im??(Im=document.createElement("canvas")),Im.getContext("2d"))}function H0(n){return Math.min(512,Math.max(8,Number(n.fontSize)||24))}function Zx(n,a){return Number.isFinite(n.paddingX)?Math.max(0,n.paddingX):Math.max(8,Math.round(a*.18))}function Ux(n,a){return Number.isFinite(n.paddingY)?Math.max(0,n.paddingY):Math.max(6,Math.round(a*.14))}function Xx(n,a){return(Number.isFinite(n.lineHeight)?Math.max(.9,n.lineHeight):1.1)*a}function Kx(n){return n.textAlign==="center"||n.textAlign==="right"?n.textAlign:"left"}function Gx(n){const a=H0(n),o=n.fontStyle||"normal",l=n.fontWeight||"700",s=n.fontFamily||'-apple-system, "PingFang SC", "Microsoft YaHei", sans-serif';return`${o} ${l} ${a}px ${s}`}function Yx(n,a){const o=n==null?"":String(n);switch(a){case"uppercase":return o.toUpperCase();case"lowercase":return o.toLowerCase();case"capitalize":return o.toLowerCase().replace(/(^|\s)(\S)/g,(l,s,d)=>`${s}${d.toUpperCase()}`);default:return o}}function Jx(n,a){const o=Yx(n,a).replace(/\r\n/g,`
|
|
2
2
|
`).split(`
|
|
3
|
-
`);return o.length?o:[""]}function bs(n){return Number.isFinite(n)&&n>=0}function Jx(n){if(!Hm(n))return null;const a=bs(n.startAt)?Number(n.startAt):null,o=bs(n.endAt)?Number(n.endAt):null;if(a==null&&o==null)return null;const l=Math.max(0,a??0),s=Math.max(l,o??l);return{start:l,end:s}}function V0(n){const a=Jx(n);return!!a&&a.end>a.start}function Hm(n){return n?.type==="pen"||n?.type==="line"||n?.type==="arrow"||n?.type==="rect"||n?.type==="ellipse"||n?.type==="text"||n?.type==="sticker"}function e2(n){if(!Hm(n)&&n?.type!=="filter"&&n?.type!=="adjust")return null;const a=bs(n.startAt)?Number(n.startAt):null,o=bs(n.endAt)?Number(n.endAt):null;if(a==null&&o==null)return null;const l=Math.max(0,a??0),s=Math.max(l,o??l);return{start:l,end:s}}function t2(n,a){const o=e2(n);return o?Number.isFinite(a)?a>=o.start&&a<=o.end:!1:!0}function n2(n,a){return n?.length?Number.isFinite(a)?n.filter(o=>t2(o,a)):n:[]}function W0(n){return n?.type==="text"||n?.type==="sticker"||n?.type==="filter"||n?.type==="adjust"}function q0(n){return Number.isFinite(n?.timelineTrack)?Math.max(0,Math.round(Number(n.timelineTrack))):0}function Y0(n){return bs(n?.startAt)?Number(n.startAt):0}function Vm(n){const a=H0(n),o=Yx(n,a),l=Ux(n,a),s=Zx(n,a),d=Qx(n.text,n.textTransform),m=qx(),h=Gx(n);m&&(m.font=h);const g=d.map(Q=>{const X=Q===""?" ":Q;return m?m.measureText(X).width:Math.max(1,X.length)*a*.6}),v=g.length?Math.max(...g):a*.6,w=Math.max(a,d.length*s),W=Math.max(Number.isFinite(n.width)?n.width:0,v+o*2),S=w+l*2;return{font:h,fontSize:a,paddingX:o,paddingY:l,lineHeight:s,lines:d,widths:g,boxWidth:W,boxHeight:S,align:Kx(n)}}function r2(n,a,o){return a.align==="center"?n.x+a.boxWidth/2-o/2:a.align==="right"?n.x+a.boxWidth-a.paddingX-o:n.x+a.paddingX}function a2(n,a,o,l,s,d){if(!a.textDecoration||d<=0)return;const m=o.fontSize,h=String(a.textDecoration).includes("underline"),g=String(a.textDecoration).includes("line-through");if(!(!h&&!g)){if(n.save(),n.strokeStyle=a.color||"#fff",n.lineWidth=Math.max(1,m/18),h){const v=s+m+Math.max(1,m*.08);n.beginPath(),n.moveTo(l,v),n.lineTo(l+d,v),n.stroke()}if(g){const v=s+m*.56;n.beginPath(),n.moveTo(l,v),n.lineTo(l+d,v),n.stroke()}n.restore()}}function da(n){return I0(n.rotation??0)}function Ir(n){switch(n.type){case"pen":{let a=1/0,o=1/0,l=-1/0,s=-1/0;for(let d=0;d<n.points.length;d+=2)a=Math.min(a,n.points[d]),l=Math.max(l,n.points[d]),o=Math.min(o,n.points[d+1]),s=Math.max(s,n.points[d+1]);return{x:a,y:o,w:l-a,h:s-o}}case"line":case"arrow":return{x:Math.min(n.x1,n.x2),y:Math.min(n.y1,n.y2),w:Math.abs(n.x2-n.x1),h:Math.abs(n.y2-n.y1)};case"rect":case"ellipse":case"sticker":return{x:n.x,y:n.y,w:n.w,h:n.h};case"text":{const a=Vm(n);return{x:n.x,y:n.y,w:a.boxWidth,h:a.boxHeight}}}}function Wm(n){const a=Ir(n);return{x:a.x+a.w/2,y:a.y+a.h/2}}function i2(n,a,o,l,s){const d=s*R0,m=Math.cos(d),h=Math.sin(d),g=n-o,v=a-l;return{x:o+g*m-v*h,y:l+g*h+v*m}}function U0(n,a,o,l,s){return{x:o+(n-o)*s,y:l+(a-l)*s}}function Z0(n,a,o){const l=da(a);if(l){const s=Wm(a);n.save(),n.translate(s.x,s.y),n.rotate(l*R0),n.translate(-s.x,-s.y),K0(n,a,o),n.restore();return}K0(n,a,o)}function K0(n,a,o){switch(a.type){case"pen":{tc(n,a.color,a.width),n.beginPath(),n.moveTo(a.points[0],a.points[1]);for(let l=2;l<a.points.length;l+=2)n.lineTo(a.points[l],a.points[l+1]);n.stroke();break}case"line":case"arrow":{tc(n,a.color,a.width),n.beginPath(),n.moveTo(a.x1,a.y1),n.lineTo(a.x2,a.y2),n.stroke(),a.type==="arrow"&&Hx(n,a.x1,a.y1,a.x2,a.y2,a.width);break}case"rect":{tc(n,a.color,a.width),n.strokeRect(a.x,a.y,a.w,a.h);break}case"ellipse":{tc(n,a.color,a.width),n.beginPath(),n.ellipse(a.x+a.w/2,a.y+a.h/2,Math.abs(a.w/2),Math.abs(a.h/2),0,0,Math.PI*2),n.stroke();break}case"text":{const l=Vm(a),s=Number.isFinite(a.opacity)?Math.min(1,Math.max(0,a.opacity/100)):1,d=Number.isFinite(a.borderWidth)?Math.max(0,a.borderWidth):0,m=a.autoOutline!==!1;n.save(),n.globalAlpha*=s,a.backgroundColor&&a.backgroundColor!=="transparent"&&(n.fillStyle=a.backgroundColor,n.fillRect(a.x,a.y,l.boxWidth,l.boxHeight)),n.fillStyle=a.color||"#fff",n.font=l.font,n.textBaseline="top",n.lineJoin="round";const h=a.boxShadow;h&&(n.shadowColor=h.color||"transparent",n.shadowOffsetX=h.x||0,n.shadowOffsetY=h.y||0,n.shadowBlur=h.blur||0),l.lines.forEach((g,v)=>{const w=l.widths[v]??0,W=r2(a,l,w),S=a.y+l.paddingY+v*l.lineHeight;(d>0||m)&&(n.strokeStyle=d>0?a.borderColor||"#000":a.strokeColor||"rgba(0,0,0,0.45)",n.lineWidth=d>0?d:Math.max(1,l.fontSize/18),n.strokeText(g,W,S)),n.fillText(g,W,S),a2(n,a,l,W,S,w)}),n.restore();break}case"sticker":{if(a.emoji){const l=Wx(a);n.save(),n.font=`${l.size}px -apple-system, "Apple Color Emoji", "Segoe UI Emoji", sans-serif`,n.textAlign="center",n.textBaseline="middle",n.fillText(a.emoji,l.x+l.size/2,l.y+l.size/2),n.restore()}else if(a.src){const l=o?.get(a.src);l&&n.drawImage(l,a.x,a.y,a.w,a.h)}break}}}function nc(n,a,o){for(const l of a)Z0(n,l,o)}async function rc(n){const a=new Map,o=[...new Set(n.filter(l=>l.type==="sticker"&&l.src).map(l=>l.src))];return await Promise.all(o.map(l=>new Promise(s=>{const d=new Image;d.onload=()=>{a.set(l,d),s()},d.onerror=()=>s(),d.src=l}))),a}async function G0(n,a,o){if(!n?.length)return null;const l=document.createElement("canvas");l.width=a,l.height=o;const s=l.getContext("2d");if(!s)return null;const d=await rc(n);return nc(s,n,d),new Promise(m=>l.toBlob(h=>m(h),"image/png"))}function qm(n,a,o,l=12){for(let s=n.length-1;s>=0;s--){const d=n[s];if(l2(d,a,o,l))return s}return-1}function o2(n,a,o,l,s){return Math.abs(n-o)<=s&&Math.abs(a-l)<=s}function X0(n,a,o,l,s,d,m){const h=s-o,g=d-l,v=h*h+g*g||1,w=Math.max(0,Math.min(1,((n-o)*h+(a-l)*g)/v)),W=o+w*h,S=l+w*g;return(n-W)**2+(a-S)**2<=m*m}function l2(n,a,o,l){const s=da(n);if(s){const d=Wm(n),m=i2(a,o,d.x,d.y,-s);return Q0(n,m.x,m.y,l)}return Q0(n,a,o,l)}function Q0(n,a,o,l){switch(n.type){case"pen":{for(let s=0;s+3<n.points.length;s+=2)if(X0(a,o,n.points[s],n.points[s+1],n.points[s+2],n.points[s+3],l+n.width/2))return!0;return!1}case"line":case"arrow":return X0(a,o,n.x1,n.y1,n.x2,n.y2,l+n.width/2);case"rect":case"ellipse":return a>=n.x-l&&a<=n.x+n.w+l&&o>=n.y-l&&o<=n.y+n.h+l;case"text":{const s=Vm(n);return a>=n.x-l&&a<=n.x+s.boxWidth+l&&o>=n.y-l&&o<=n.y+s.boxHeight+l}case"sticker":return o2(a,o,n.x+n.w/2,n.y+n.h/2,Math.max(n.w,n.h)/2+l)}}function J0(n,a,o){const l=Math.max(8,o);if(!(n>0)||!(a>0))return{w:l,h:l};const s=l/Math.max(n,a);return{w:Math.max(8,Math.round(n*s)),h:Math.max(8,Math.round(a*s))}}function Ym(n,a){const o=Math.max(.05,a),l=Wm(n);switch(n.type){case"pen":return{...n,points:n.points.map((s,d)=>d%2===0?l.x+(s-l.x)*o:l.y+(s-l.y)*o)};case"line":case"arrow":{const s=U0(n.x1,n.y1,l.x,l.y,o),d=U0(n.x2,n.y2,l.x,l.y,o);return{...n,x1:s.x,y1:s.y,x2:d.x,y2:d.y}}case"rect":case"ellipse":case"sticker":return{...n,w:Math.max(8,n.w*o),h:Math.max(8,n.h*o)};case"text":return{...n,fontSize:Math.min(512,Math.max(8,n.fontSize*o)),width:Number.isFinite(n.width)?Math.max(80,n.width*o):n.width,paddingX:Number.isFinite(n.paddingX)?Math.max(0,n.paddingX*o):n.paddingX,paddingY:Number.isFinite(n.paddingY)?Math.max(0,n.paddingY*o):n.paddingY,borderWidth:Number.isFinite(n.borderWidth)?Math.max(0,n.borderWidth*o):n.borderWidth,boxShadow:n.boxShadow?{...n.boxShadow,x:(n.boxShadow.x||0)*o,y:(n.boxShadow.y||0)*o,blur:(n.boxShadow.blur||0)*o}:n.boxShadow};default:return n}}function s2(n,a){return{...n,rotation:I0(a)}}function ac(n,a,o){switch(n.type){case"pen":{const l=n.points.map((s,d)=>d%2===0?s+a:s+o);return{...n,points:l}}case"line":case"arrow":return{...n,x1:n.x1+a,y1:n.y1+o,x2:n.x2+a,y2:n.y2+o};case"rect":case"ellipse":case"sticker":return{...n,x:n.x+a,y:n.y+o};case"text":return{...n,x:n.x+a,y:n.y+o}}}function u2(n){const a=String(n??"").match(/^data:(image\/(?:png|jpe?g));base64,([a-z0-9+/=]+)$/i);if(!a)return null;const o=atob(a[2]),l=new Uint8Array(o.length);for(let s=0;s<o.length;s++)l[s]=o.charCodeAt(s);return new Blob([l],{type:a[1].toLowerCase()})}async function c2(n,a,o=[]){const l=n.getExportPlan(),s=new FormData;l.videoSrcOrder.forEach((S,Q)=>{const X=a[S];X&&s.append(`video_${Q}`,X,X.name||`video_${Q}.mp4`)}),l.audioSrcOrder.forEach((S,Q)=>{const X=o[S];X&&s.append(`audio_${Q}`,X,X.name||`audio_${Q}`)});const d=oo(l.state.canvas,l.state),m=l.state.overlays??[],h=m.filter(S=>V0(S)),g=m.filter(S=>!V0(S)&&Hm(S)),v=await G0(g,d.w,d.h);v&&s.append("overlay",v,"overlay.png");for(let S=0;S<h.length;S++){const Q=await G0([h[S]],d.w,d.h);Q&&s.append(`textOverlay_${S}`,Q,`text-overlay-${S}.png`)}const w=l.state.poster?.useAsVideoCover?u2(l.state.poster.preview):null;w&&s.append("videoCover",w,"video-cover.png");const W=l.state.poster?.preview?{...l.state,poster:{...l.state.poster,preview:void 0}}:l.state;return s.append("editState",JSON.stringify(W)),s}function _a(n){return Math.max(-1,Math.min(1,Number(n)||0))}function Xo(n){return Math.max(0,Math.min(1,Number(n)||0))}function Cr(n){return Math.max(0,Math.min(1,n))}function ii(n){return Math.max(0,Math.min(255,n))}function lo(n,a,o){if(n===a)return o<n?0:1;const l=Math.max(0,Math.min(1,(o-n)/(a-n)));return l*l*(3-2*l)}function Um(n){const a=lo(.08,.4,n),o=1-lo(.6,.92,n);return Cr(a*o*2.2)}function eg(n,a,o=0){const l=Math.sin(n*12.9898+a*78.233+o*37.719)*43758.5453;return l-Math.floor(l)}var so=null;function d2(n,a){return typeof document>"u"?null:(so??(so=document.createElement("canvas")),so.width!==n&&(so.width=n),so.height!==a&&(so.height=a),so)}function tg(n,a,o,l){if(!l||l==="none")return;const s=d2(a,o),d=s?.getContext("2d");!s||!d||(d.setTransform(1,0,0,1,0,0),d.clearRect(0,0,a,o),d.drawImage(n.canvas,0,0,a,o),n.save(),n.setTransform(1,0,0,1,0,0),n.clearRect(0,0,a,o),n.filter=l,n.drawImage(s,0,0,a,o),n.restore(),n.filter="none")}function m2(n,a,o,l){const s=$0(l?.filterPreset)?.css??"";tg(n,a,o,s)}function f2(n,a,o,l){tg(n,a,o,Rm(l??{},"")),ng(n,a,o,l??{})}function p2(n={}){return["temperature","tint","vibrance","gamma","highlights","shadows","whites","blacks","lightSense"].some(a=>Math.abs(_a(n[a]))>1e-4)?!0:["sharpen","clarity","grain","fade","vignette"].some(a=>Xo(n[a])>1e-4)}function ng(n,a,o,l={}){if(!p2(l))return;let s;try{s=n.getImageData(0,0,a,o)}catch{return}const d=_a(l.temperature),m=_a(l.tint),h=_a(l.vibrance),g=_a(l.gamma),v=_a(l.highlights),w=_a(l.shadows),W=_a(l.whites),S=_a(l.blacks),Q=_a(l.lightSense),X=Xo(l.sharpen),ue=Xo(l.clarity),oe=Xo(l.grain),ge=Xo(l.fade),Be=Xo(l.vignette),Te=1+g*(g>0?1:.5),de=g===0?1:1/Math.max(.01,Te),Ae=d*.18,ve=d*.02,j=-d*.18,k=m*.1,H=-m*.12,T=s.data;for(let _=0;_<T.length;_+=4){let le=T[_]/255,se=T[_+1]/255,me=T[_+2]/255;if((d!==0||m!==0)&&(le=Cr(le+Ae+k),se=Cr(se+ve+H),me=Cr(me+j+k)),h!==0){const P=Math.max(le,se,me),$=Math.min(le,se,me),M=P-$,A=(le+se+me)/3,ee=h>0?h*(1-M):h*(.35+M*.65);le=Cr(A+(le-A)*(1+ee)),se=Cr(A+(se-A)*(1+ee)),me=Cr(A+(me-A)*(1+ee))}if(g!==0&&(le=Cr(Math.pow(le,de)),se=Cr(Math.pow(se,de)),me=Cr(Math.pow(me,de))),v!==0||w!==0||W!==0||S!==0||Q!==0||ge!==0){const P=.2126*le+.7152*se+.0722*me,$=1-lo(.18,.62,P),M=1-lo(.04,.32,P),A=lo(.38,.84,P),ee=lo(.7,.98,P),Me=Um(P),_e=w*$*.28+v*A*.24+S*M*.2+W*ee*.2+Q*Me*.18+ge*(.12+$*.06);if(le=Cr(le+_e),se=Cr(se+_e),me=Cr(me+_e),ge>0){const x=(le+se+me)/3,C=ge*.16;le=Cr(le*(1-C)+x*C),se=Cr(se*(1-C)+x*C),me=Cr(me*(1-C)+x*C)}}T[_]=Math.round(le*255),T[_+1]=Math.round(se*255),T[_+2]=Math.round(me*255)}if(X>1e-4||ue>1e-4){const _=new Uint8ClampedArray(T),le=a*4;for(let se=1;se<o-1;se++)for(let me=1;me<a-1;me++){const P=se*le+me*4,$=(_[P-4]+_[P+4]+_[P-le]+_[P+le]+_[P]*4)/8,M=(_[P-3]+_[P+5]+_[P-le+1]+_[P+le+1]+_[P+1]*4)/8,A=(_[P-2]+_[P+6]+_[P-le+2]+_[P+le+2]+_[P+2]*4)/8,ee=(.2126*_[P]+.7152*_[P+1]+.0722*_[P+2])/255,Me=Math.min(1.8,X*1.45+ue*.9*Um(ee));T[P]=ii(_[P]+(_[P]-$)*Me),T[P+1]=ii(_[P+1]+(_[P+1]-M)*Me),T[P+2]=ii(_[P+2]+(_[P+2]-A)*Me)}}if(oe>1e-4){const _=oe*26;for(let le=0;le<o;le++)for(let se=0;se<a;se++){const me=(le*a+se)*4,P=(.2126*T[me]+.7152*T[me+1]+.0722*T[me+2])/255,$=.4+Um(P)*.9,M=(eg(se,le)-.5)*_*$,A=(eg(se,le,1)-.5)*_*.22*oe;T[me]=ii(T[me]+M+A),T[me+1]=ii(T[me+1]+M*.88),T[me+2]=ii(T[me+2]+M-A)}}if(Be>1e-4){const _=(a-1)/2,le=(o-1)/2,se=Math.sqrt(_*_+le*le)||1;for(let me=0;me<o;me++)for(let P=0;P<a;P++){const $=(me*a+P)*4,M=P-_,A=me-le,ee=Math.sqrt(M*M+A*A)/se,Me=1-lo(.32,1,ee)*Be*.62;T[$]=ii(T[$]*Me),T[$+1]=ii(T[$+1]*Me),T[$+2]=ii(T[$+2]*Me)}}n.putImageData(s,0,0)}function Zm(n,a,o,l,s,d=1,m,h=!0){const g=oo(l,s);n.width=Math.max(2,Math.round(g.w*d)),n.height=Math.max(2,Math.round(g.h*d));const v=n.getContext("2d");if(!v)return;const w=Go(l.w,l.h,s.rotation),W=s.crop??{x:0,y:0,width:w.w,height:w.h},S=s.scale?.fit??"force",{src:Q,dst:X}=$m({width:W.width,height:W.height},g,S);S==="contain"&&(v.fillStyle="#000",v.fillRect(0,0,n.width,n.height)),v.filter=Rm(s.filters,s.filterPreset),v.save(),S==="contain"&&(v.beginPath(),v.rect(d*X.x,d*X.y,d*X.width,d*X.height),v.clip()),v.translate(d*X.x,d*X.y),v.scale(d*X.width/Q.width,d*X.height/Q.height),v.translate(-(W.x+Q.x),-(W.y+Q.y)),v.translate(w.w/2,w.h/2),v.rotate(s.rotation*Pm),v.scale(s.flipX?-1:1,s.flipY?-1:1);const ue=$m({width:o.w,height:o.h},{w:l.w,h:l.h},"cover");if(v.drawImage(a,ue.src.x,ue.src.y,ue.src.width,ue.src.height,-l.w/2,-l.h/2,l.w,l.h),v.restore(),v.filter="none",ng(v,n.width,n.height,s.filters),h&&s.overlays?.length){const oe=Number.isFinite(s?.__mePreviewTimelineTime)?Number(s.__mePreviewTimelineTime):null,ge=oe==null?s.overlays:n2(s.overlays,oe),Be=ge.map((de,Ae)=>({overlay:de,index:Ae})).filter(de=>W0(de.overlay)).sort((de,Ae)=>{const ve=q0(Ae.overlay)-q0(de.overlay);if(ve!==0)return ve;const j=Y0(de.overlay)-Y0(Ae.overlay);return Math.abs(j)>1e-6?j:de.index-Ae.index}),Te=ge.filter(de=>!W0(de));v.setTransform(d,0,0,d,0,0),Be.forEach(de=>{if(de.overlay?.type==="filter"){v.setTransform(1,0,0,1,0,0),m2(v,n.width,n.height,de.overlay),v.setTransform(d,0,0,d,0,0);return}if(de.overlay?.type==="adjust"){v.setTransform(1,0,0,1,0,0),f2(v,n.width,n.height,de.overlay),v.setTransform(d,0,0,d,0,0);return}Z0(v,de.overlay,m)}),nc(v,Te,m),v.setTransform(1,0,0,1,0,0)}}var rg={"tool.trim":"\u526A\u8F91","tool.crop":"\u88C1\u526A","tool.tune":"\u8C03\u8272","tool.filter":"\u6EE4\u955C","tool.annotate":"\u6807\u6CE8","tool.sticker":"\u8D34\u7EB8","tool.resize":"\u6BD4\u4F8B","tune.brightness":"\u4EAE\u5EA6","tune.contrast":"\u5BF9\u6BD4","tune.saturation":"\u9971\u548C","tune.gamma":"Gamma","overlay.select":"\u9009\u62E9","overlay.pen":"\u753B\u7B14","overlay.eraser":"\u6A61\u76AE","overlay.line":"\u76F4\u7EBF","overlay.arrow":"\u7BAD\u5934","overlay.rect":"\u77E9\u5F62","overlay.ellipse":"\u692D\u5706","overlay.text":"\u6587\u5B57","overlay.color":"\u7EBF\u8272","overlay.width":"\u7EBF\u5BBD","overlay.copySelected":"\u590D\u5236","overlay.delSelected":"\u5220\u9664\u9009\u4E2D","overlay.editSelected":"\u7F16\u8F91","overlay.pickImage":"\u9009\u62E9\u56FE\u7247","overlay.hint":"\u70B9 emoji/\u56FE\u7247\u6DFB\u52A0 \u2192 \u753B\u5E03\u4E0A\u62D6\u52A8\u6446\u4F4D,\u62D6\u53F3\u4E0B\u89D2\u7D2B\u8272\u628A\u624B\u7F29\u653E","overlay.textPlaceholder":"\u8F93\u5165\u6587\u5B57,\u56DE\u8F66\u786E\u8BA4","filter.none":"\u539F\u56FE","filter.bw":"\u9ED1\u767D","filter.sepia":"\u590D\u53E4","filter.warm":"\u6696\u9633","filter.cool":"\u51B7\u8C03","filter.vivid":"\u9C9C\u8273","ratio.orig":"\u539F\u59CB","ratio.free":"\u81EA\u7531\u6BD4\u4F8B","ratio.9:16":"\u7AD6\u5C4F 9:16","ratio.16:9":"\u6A2A\u5C4F 16:9","ratio.1:1":"\u65B9\u5F62 1:1","ratio.4:5":"\u7AD6\u56FE 4:5","act.fit":"\u9002\u5E94","act.zoomFit":"\u7F29\u653E\u81F3\u9002\u5F53\u5927\u5C0F","act.zoomTo":"\u7F29\u653E\u81F3 {value}%","act.split":"\u5206\u5272","act.copy":"\u590D\u5236","act.delete":"\u5220\u9664","act.restore":"\u8FD8\u539F","act.deleteMusic":"\u5220\u9664\u97F3\u4E50","act.cancel":"\u53D6\u6D88","act.exportPoster":"\u5BFC\u51FA\u5C01\u9762","act.exporting":"\u5BFC\u51FA\u4E2D\u2026","act.poster":"\u{1F5BC} \u5C01\u9762","act.again":"\u518D\u6B21\u4E0B\u8F7D","act.saveDrive":"\u5B58\u7F51\u76D8","act.changeImage":"\u2190 \u6362\u4E00\u5F20","act.changeVideo":"\u2190 \u6362\u4E00\u4E2A","crop.rotateLeft":"\u21BA \u5411\u5DE6\u65CB\u8F6C","crop.flipX":"\u21CB \u6C34\u5E73\u7FFB\u8F6C","crop.flipY":"\u21F5 \u5782\u76F4\u7FFB\u8F6C","crop.rotateLeftShort":"\u5DE6\u8F6C","crop.flipXShort":"\u6A2A\u7FFB","crop.flipYShort":"\u7AD6\u7FFB","tip.close":"\u5173\u95ED(\u6362\u6587\u4EF6)","tip.undo":"\u64A4\u9500","tip.redo":"\u91CD\u505A","tip.resetOpened":"\u91CD\u7F6E\u5230\u6253\u5F00\u6587\u4EF6\u65F6","tip.previewZoom":"\u9884\u89C8\u7F29\u653E\u6BD4\u4F8B","tip.previewZoomOut":"\u7F29\u5C0F\u9884\u89C8","tip.previewZoomIn":"\u653E\u5927\u9884\u89C8","tip.previewZoomFit":"\u9002\u5E94\u9884\u89C8","tip.previewPointer":"\u6307\u9488\u5DE5\u5177","tip.previewPan":"\u624B\u5DE5\u5177\uFF1A\u62D6\u52A8\u753B\u9762","tip.poster":"\u9884\u89C8\u5E76\u9009\u62E9\u5C01\u9762\u5E27","tip.keepAudio":"\u539F\u89C6\u9891\u58F0\u97F3\u5F00\u5173(\u4E0E\u97F3\u4E50\u6DF7\u97F3;\u9884\u89C8\u540C\u6B65)","tip.split":"\u5728\u64AD\u653E\u5934\u5904\u628A\u5F53\u524D\u7247\u6BB5\u4E00\u5206\u4E3A\u4E8C","tip.zoomOut":"\u7F29\u5C0F\u65F6\u95F4\u8F74(Ctrl+\u6EDA\u8F6E)","tip.zoomIn":"\u653E\u5927\u65F6\u95F4\u8F74(Ctrl+\u6EDA\u8F6E)","tip.fit":"\u7F29\u653E\u5230\u9002\u5E94\u5BBD\u5EA6","tip.addVideo":"\u6DFB\u52A0\u89C6\u9891\u7247\u6BB5","tip.addAudio":"\u6DFB\u52A0\u97F3\u4E50(\u97F3\u9891\u6587\u4EF6,\u6216\u9009\u542B\u58F0\u97F3\u7684\u89C6\u9891\u81EA\u52A8\u63D0\u53D6\u97F3\u8F68;\u4E0E\u539F\u58F0\u6DF7\u97F3)","tip.dupClip":"\u590D\u5236\u8BE5\u7247\u6BB5(\u63D2\u5230\u5176\u540E)","tip.delClip":"\u5220\u9664\u8BE5\u7247\u6BB5","tip.lockAspect":"\u9501\u5B9A\u7EB5\u6A2A\u6BD4","tip.dblConfirm":"\u53CC\u51FB\u786E\u8BA4\u88C1\u526A","err.notVideo":"\u8BF7\u9009\u62E9\u89C6\u9891\u6587\u4EF6","err.maxVideo":"\u6700\u591A {max} \u4E2A\u89C6\u9891\u7D20\u6750","err.videoLoad":"\u89C6\u9891\u52A0\u8F7D\u5931\u8D25,\u8BF7\u6362\u4E00\u4E2A\u6587\u4EF6","err.notAudio":"\u8BF7\u9009\u62E9\u97F3\u9891\u6587\u4EF6(mp3/wav/m4a),\u6216\u542B\u58F0\u97F3\u7684\u89C6\u9891(\u81EA\u52A8\u63D0\u53D6\u97F3\u8F68)","err.maxAudio":"\u6700\u591A {max} \u4E2A\u97F3\u9891\u7D20\u6750","err.audioLoad":"\u97F3\u9891\u52A0\u8F7D\u5931\u8D25,\u8BF7\u6362\u4E00\u4E2A\u6587\u4EF6","err.processFailed":"\u5904\u7406\u5931\u8D25","err.posterFailed":"\u5C01\u9762\u6E32\u67D3\u5931\u8D25","err.canvas":"canvas \u4E0D\u53EF\u7528","err.imageRead":"\u56FE\u7247\u8BFB\u53D6\u5931\u8D25,\u8BF7\u6362\u4E00\u5F20","err.notImage":"\u8BF7\u9009\u62E9\u56FE\u7247\u6587\u4EF6","err.fileType":"\u53EA\u652F\u6301\u56FE\u7247\u6216\u89C6\u9891\u6587\u4EF6","err.saveDrive":"\u5B58\u7F51\u76D8\u5931\u8D25","msg.processing":"\u6B63\u5728\u5BFC\u51FA\u4E2D\u2026","msg.exportingHint":"\u8BF7\u7A0D\u5019\uFF0C\u5BFC\u51FA\u5B8C\u6210\u540E\u4F1A\u81EA\u52A8\u8FD4\u56DE\u7ED3\u679C\u3002","msg.done":"\u5B8C\u6210 \u2713","msg.loading":"\u7D20\u6750\u52A0\u8F7D\u4E2D\u2026","msg.exported":"\u5DF2\u5BFC\u51FA\uFF1A","msg.saving":"\u5B58\u7F51\u76D8\u4E2D\u2026","msg.saved":"\u5DF2\u5B58\u5230\u7F51\u76D8 \u2713","lbl.ratioSection":"\u753B\u9762\u6BD4\u4F8B(\u88C1\u526A,\u4E0D\u53D8\u5F62)","lbl.dragToReposition":"\u2194 \u62D6\u52A8\u9884\u89C8\u53EF\u8C03\u6574\u88C1\u526A\u4F4D\u7F6E","lbl.sizeSection":"\u5BFC\u51FA\u5C3A\u5BF8(\u50CF\u7D20;\u6BD4\u4F8B\u4E0D\u7B26\u65F6 cover \u5C45\u4E2D\u88C1\u526A)","lbl.currentOut":"\u5F53\u524D\u8F93\u51FA","lbl.zoomSize":"\u5927\u5C0F","lbl.noScale":"(\u672A\u7F29\u653E)","lbl.coverNote":"\xB7 \u6BD4\u4F8B\u4E0D\u4E00\u81F4\u65F6\u5C45\u4E2D\u88C1\u526A(cover),\u4E0D\u53D8\u5F62","lbl.audioTrackHint":"\u266A \u97F3\u9891\u8F68(\u53F3\u4FA7 \uFF0B \u6DFB\u52A0\u97F3\u4E50,\u4E0E\u539F\u58F0\u6DF7\u97F3)","lbl.volume":"\u97F3\u91CF","lbl.volNote":"(\u9884\u89C8\u6700\u5927 100%,\u5BFC\u51FA\u6309\u8BBE\u5B9A\u503C)","lbl.music":"\u97F3\u4E50","kbd.fit":"\u21E7 F","poster.title":"\u9009\u62E9\u5C01\u9762\u5E27","panel.title":"\u5A92\u4F53\u7F16\u8F91\u5668","panel.subtitle":"\u4E0A\u4F20\u56FE\u7247 / \u89C6\u9891\uFF0C\u88C1\u526A \xB7 \u6EE4\u955C \xB7 \u6587\u5B57 \xB7 \u5BFC\u51FA","panel.pick":"\u70B9\u51FB\u9009\u62E9\u56FE\u7247\u6216\u89C6\u9891","panel.pickHint":"\u56FE\u7247\u7528 Filerobot \xB7 \u89C6\u9891\u53EF\u88C1\u526A/\u9759\u97F3/\u5C01\u9762"},h2={"tool.trim":"Trim","tool.crop":"Crop","tool.tune":"Tune","tool.filter":"Filters","tool.annotate":"Annotate","tool.sticker":"Stickers","tool.resize":"Ratio","tune.brightness":"Brightness","tune.contrast":"Contrast","tune.saturation":"Saturation","tune.gamma":"Gamma","overlay.select":"Select","overlay.pen":"Pen","overlay.eraser":"Eraser","overlay.line":"Line","overlay.arrow":"Arrow","overlay.rect":"Rect","overlay.ellipse":"Ellipse","overlay.text":"Text","overlay.color":"Color","overlay.width":"Width","overlay.copySelected":"Copy","overlay.delSelected":"Delete selected","overlay.editSelected":"Edit","overlay.pickImage":"Pick image","overlay.hint":"Tap emoji/image to add \u2192 drag to place, drag the purple corner handle to scale","overlay.textPlaceholder":"Type text, Enter to confirm","filter.none":"Original","filter.bw":"B&W","filter.sepia":"Sepia","filter.warm":"Warm","filter.cool":"Cool","filter.vivid":"Vivid","ratio.orig":"Original","ratio.free":"Free ratio","ratio.9:16":"Portrait 9:16","ratio.16:9":"Landscape 16:9","ratio.1:1":"Square 1:1","ratio.4:5":"Vertical 4:5","act.fit":"Fit","act.zoomFit":"Zoom to fit","act.zoomTo":"Zoom to {value}%","act.split":"Split","act.copy":"Copy","act.delete":"Delete","act.restore":"Reset","act.deleteMusic":"Remove music","act.cancel":"Cancel","act.exportPoster":"Export cover","act.exporting":"Exporting\u2026","act.poster":"\u{1F5BC} Cover","act.again":"Download again","act.saveDrive":"Save to drive","act.changeImage":"\u2190 Change image","act.changeVideo":"\u2190 Change file","crop.rotateLeft":"\u21BA Rotate left","crop.flipX":"\u21CB Flip horizontal","crop.flipY":"\u21F5 Flip vertical","crop.rotateLeftShort":"Rot","crop.flipXShort":"Flip","crop.flipYShort":"Flip","tip.close":"Close (change file)","tip.undo":"Undo","tip.redo":"Redo","tip.resetOpened":"Reset to opened file","tip.previewZoom":"Preview zoom","tip.previewZoomOut":"Zoom out preview","tip.previewZoomIn":"Zoom in preview","tip.previewZoomFit":"Fit preview","tip.previewPointer":"Pointer tool","tip.previewPan":"Hand tool: pan canvas","tip.poster":"Preview and pick a cover frame","tip.keepAudio":"Original audio on/off (mixed with music; preview follows)","tip.split":"Split the current clip at the playhead","tip.zoomOut":"Zoom out timeline (Ctrl+wheel)","tip.zoomIn":"Zoom in timeline (Ctrl+wheel)","tip.fit":"Fit to width","tip.addVideo":"Add video clip","tip.addAudio":"Add music (audio file, or a video with sound to extract its track; mixed with original)","tip.dupClip":"Duplicate clip (insert after)","tip.delClip":"Delete clip","tip.lockAspect":"Lock aspect ratio","tip.dblConfirm":"Double-click to confirm crop","err.notVideo":"Please choose a video file","err.maxVideo":"Up to {max} video sources","err.videoLoad":"Failed to load video, try another file","err.notAudio":"Choose an audio file (mp3/wav/m4a), or a video with sound (audio auto-extracted)","err.maxAudio":"Up to {max} audio sources","err.audioLoad":"Failed to load audio, try another file","err.processFailed":"Processing failed","err.posterFailed":"Failed to render cover","err.canvas":"Canvas unavailable","err.imageRead":"Failed to read image, try another","err.notImage":"Please choose an image file","err.fileType":"Only image or video files are supported","err.saveDrive":"Failed to save to drive","msg.processing":"Exporting\u2026","msg.exportingHint":"Please wait. The result will be returned automatically when export finishes.","msg.done":"Done \u2713","msg.loading":"Loading media\u2026","msg.exported":"Exported: ","msg.saving":"Saving\u2026","msg.saved":"Saved to drive \u2713","lbl.ratioSection":"Frame ratio (crop, no distortion)","lbl.dragToReposition":"\u2194 Drag the preview to reposition the crop","lbl.sizeSection":"Export size (px; cover center-crop when ratios differ)","lbl.currentOut":"Output","lbl.zoomSize":"Size","lbl.noScale":"(no scaling)","lbl.coverNote":"\xB7 center-cropped (cover) when ratios differ, no distortion","lbl.audioTrackHint":"\u266A Audio track (\uFF0B on the right to add music, mixed with original)","lbl.volume":"Volume","lbl.volNote":"(preview caps at 100%, export uses the set value)","lbl.music":"Music","kbd.fit":"\u21E7 F","poster.title":"Pick a cover frame","panel.title":"Media Editor","panel.subtitle":"Upload an image / video \u2014 crop \xB7 filters \xB7 text \xB7 export","panel.pick":"Click to choose an image or video","panel.pickHint":"Images via Filerobot \xB7 videos: trim/mute/cover"},v2={"tool.trim":"Editar","tool.crop":"Recortar","tool.tune":"Ajustar color","tool.filter":"Filtros","tool.annotate":"Anotar","tool.sticker":"Stickers","tool.resize":"Proporci\xF3n","tune.brightness":"Brillo","tune.contrast":"Contraste","tune.saturation":"Saturaci\xF3n","tune.gamma":"Gamma","overlay.select":"Seleccionar","overlay.pen":"Pincel","overlay.eraser":"Borrador","overlay.line":"L\xEDnea","overlay.arrow":"Flecha","overlay.rect":"Rect\xE1ngulo","overlay.ellipse":"Elipse","overlay.text":"Texto","overlay.color":"Color","overlay.width":"Grosor","overlay.copySelected":"Copiar","overlay.delSelected":"Eliminar seleccionado","overlay.editSelected":"Editar","overlay.pickImage":"Elegir imagen","overlay.hint":"Toca un emoji/imagen para a\xF1adirlo \u2192 arrastra para colocarlo, arrastra el tirador morado para escalar","overlay.textPlaceholder":"Escribe texto, Enter para confirmar","filter.none":"Original","filter.bw":"Blanco y negro","filter.sepia":"Sepia","filter.warm":"C\xE1lido","filter.cool":"Fr\xEDo","filter.vivid":"Intenso","ratio.orig":"Original","ratio.free":"Libre","ratio.9:16":"Vertical 9:16","ratio.16:9":"Horizontal 16:9","ratio.1:1":"Cuadrado 1:1","ratio.4:5":"Vertical 4:5","act.fit":"Ajustar","act.zoomFit":"Ajustar a pantalla","act.zoomTo":"Zoom al {value}%","act.split":"Dividir","act.copy":"Copiar","act.delete":"Eliminar","act.restore":"Restablecer","act.deleteMusic":"Quitar m\xFAsica","act.cancel":"Cancelar","act.exportPoster":"Exportar portada","act.exporting":"Exportando\u2026","act.poster":"\u{1F5BC} Portada","act.again":"Descargar de nuevo","act.saveDrive":"Guardar en disco","act.changeImage":"\u2190 Cambiar imagen","act.changeVideo":"\u2190 Cambiar archivo","crop.rotateLeft":"\u21BA Girar a la izquierda","crop.flipX":"\u21CB Voltear horizontal","crop.flipY":"\u21F5 Voltear vertical","crop.rotateLeftShort":"Giro","crop.flipXShort":"Flip","crop.flipYShort":"Flip","tip.close":"Cerrar (cambiar archivo)","tip.undo":"Deshacer","tip.redo":"Rehacer","tip.resetOpened":"Restablecer al archivo abierto","tip.previewZoom":"Zoom de vista previa","tip.previewZoomOut":"Reducir vista previa","tip.previewZoomIn":"Ampliar vista previa","tip.previewZoomFit":"Ajustar vista previa","tip.previewPointer":"Herramienta de puntero","tip.previewPan":"Mano: desplazar lienzo","tip.poster":"Previsualizar y elegir portada","tip.keepAudio":"Activar/desactivar audio original (mezclado con m\xFAsica; la vista previa lo refleja)","tip.split":"Dividir el clip actual en el cursor","tip.zoomOut":"Reducir l\xEDnea de tiempo (Ctrl+rueda)","tip.zoomIn":"Ampliar l\xEDnea de tiempo (Ctrl+rueda)","tip.fit":"Ajustar al ancho","tip.addVideo":"A\xF1adir clip de v\xEDdeo","tip.addAudio":"A\xF1adir m\xFAsica (archivo de audio o v\xEDdeo con sonido para extraer la pista; se mezcla con el original)","tip.dupClip":"Duplicar clip (insertar despu\xE9s)","tip.delClip":"Eliminar clip","tip.lockAspect":"Bloquear proporci\xF3n","tip.dblConfirm":"Doble clic para confirmar recorte","err.notVideo":"Elige un archivo de v\xEDdeo","err.maxVideo":"M\xE1ximo {max} v\xEDdeos","err.videoLoad":"No se pudo cargar el v\xEDdeo, prueba con otro archivo","err.notAudio":"Elige un audio (mp3/wav/m4a) o un v\xEDdeo con sonido (se extrae autom\xE1ticamente)","err.maxAudio":"M\xE1ximo {max} audios","err.audioLoad":"No se pudo cargar el audio, prueba con otro archivo","err.processFailed":"Error de procesamiento","err.posterFailed":"No se pudo renderizar la portada","err.canvas":"Canvas no disponible","err.imageRead":"No se pudo leer la imagen, prueba con otra","err.notImage":"Elige un archivo de imagen","err.fileType":"Solo se admiten archivos de imagen o v\xEDdeo","err.saveDrive":"No se pudo guardar en disco","msg.processing":"Exportando\u2026","msg.exportingHint":"Espera un momento. El resultado se devolver\xE1 autom\xE1ticamente al finalizar.","msg.done":"Listo \u2713","msg.loading":"Cargando medios\u2026","msg.exported":"Exportado: ","msg.saving":"Guardando\u2026","msg.saved":"Guardado en disco \u2713","lbl.ratioSection":"Proporci\xF3n de imagen (recorte, sin deformar)","lbl.dragToReposition":"\u2194 Arrastra la vista previa para reposicionar el recorte","lbl.sizeSection":"Tama\xF1o de exportaci\xF3n (px; recorte cover centrado si la proporci\xF3n difiere)","lbl.currentOut":"Salida","lbl.zoomSize":"Tama\xF1o","lbl.noScale":"(sin escala)","lbl.coverNote":"\xB7 recorte centrado (cover) cuando la proporci\xF3n difiere, sin deformar","lbl.audioTrackHint":"\u266A Pista de audio (\uFF0B a la derecha para a\xF1adir m\xFAsica, mezclada con el original)","lbl.volume":"Volumen","lbl.volNote":"(la vista previa limita a 100%, la exportaci\xF3n usa el valor definido)","lbl.music":"M\xFAsica","kbd.fit":"\u21E7 F","poster.title":"Elegir portada","panel.title":"Editor multimedia","panel.subtitle":"Sube una imagen / v\xEDdeo \u2014 recorta \xB7 filtros \xB7 texto \xB7 exporta","panel.pick":"Haz clic para elegir una imagen o v\xEDdeo","panel.pickHint":"Im\xE1genes con Filerobot \xB7 v\xEDdeos: cortar/silenciar/portada"},g2={\u7B80:"\u7C21",\u4F53:"\u9AD4",\u56FE:"\u5716",\u9891:"\u983B",\u89C6:"\u8996",\u8F91:"\u8F2F",\u8C03:"\u8ABF",\u6EE4:"\u6FFE",\u6807:"\u6A19",\u6CE8:"\u8A3B",\u8D34:"\u8CBC",\u9009:"\u9078",\u62E9:"\u64C7",\u7EBF:"\u7DDA",\u7BAD:"\u7BAD",\u5934:"\u982D",\u590D:"\u8907",\u5220:"\u522A",\u9664:"\u9664",\u7F16:"\u7DE8",\u8FB9:"\u908A",\u8F93:"\u8F38",\u5165:"\u5165",\u786E:"\u78BA",\u8BA4:"\u8A8D",\u9971:"\u98FD",\u5BF9:"\u5C0D",\u6696:"\u6696",\u9633:"\u967D",\u51B7:"\u51B7",\u7EB5:"\u7E31",\u6A2A:"\u6A6B",\u9002:"\u9069",\u5E94:"\u61C9",\u7F29:"\u7E2E",\u5B9E:"\u5BE6",\u9645:"\u969B",\u5BFC:"\u5C0E",\u51FA:"\u51FA",\u5C01:"\u5C01",\u9762:"\u9762",\u6362:"\u63DB",\u5F20:"\u5F35",\u9884:"\u9810",\u89C8:"\u89BD",\u52A8:"\u52D5",\u58F0:"\u8072",\u5F00:"\u958B",\u5173:"\u95DC",\u4E0E:"\u8207",\u4E50:"\u6A02",\u6DF7:"\u6DF7",\u5904:"\u8655",\u8F7D:"\u8F09",\u9519:"\u932F",\u8BEF:"\u8AA4",\u8BFB:"\u8B80",\u4EC5:"\u50C5",\u7EC8:"\u7D42",\u7A0D:"\u7A0D",\u5019:"\u5019",\u8FD4\u56DE:"\u8FD4\u56DE",\u5F53\u524D:"\u76EE\u524D",\u8F93\u51FA:"\u8F38\u51FA",\u753B:"\u756B",\u53D8:"\u8B8A",\u97F3\u9891:"\u97F3\u8A0A",\u97F3\u8F68:"\u97F3\u8ECC",\u6DFB\u52A0:"\u65B0\u589E",\u5220\u9664:"\u522A\u9664",\u4FDD\u5B58:"\u5132\u5B58",\u52A0\u8F7D:"\u8F09\u5165",\u7F51\u76D8:"\u7DB2\u76E4"},b2=n=>{let a=n;for(const[o,l]of Object.entries(g2).sort((s,d)=>d[0].length-s[0].length))a=a.replaceAll(o,l);return a},y2=Object.fromEntries(Object.entries(rg).map(([n,a])=>[n,b2(a)])),ag={zh:rg,en:h2,es:v2,"zh-Hant":y2};function x2(n,a,o){let l=ag[n]?.[a]??ag.zh[a]??a;if(o)for(const[s,d]of Object.entries(o))l=l.replaceAll(`{${s}}`,String(d));return l}var Km=[{platform:"tiktok",postType:"video",label:"TikTok Video",shortLabel:"TT\xB7Video",ratio:"9:16",imageSize:"1440x2560",videoRatio:"9:16",videoResolution:"720p"},{platform:"instagram",postType:"post",label:"Instagram Post",shortLabel:"IG\xB7Post",ratio:"1:1",imageSize:"2048x2048"},{platform:"instagram",postType:"reels",label:"Instagram Reels",shortLabel:"IG\xB7Reels",ratio:"9:16",imageSize:"1440x2560",videoRatio:"9:16",videoResolution:"720p"},{platform:"instagram",postType:"story",label:"Instagram Story",shortLabel:"IG\xB7Story",ratio:"9:16",imageSize:"1440x2560",videoRatio:"9:16",videoResolution:"720p"},{platform:"facebook",postType:"post",label:"Facebook Post",shortLabel:"FB\xB7Post",ratio:"1:1",imageSize:"2048x2048"},{platform:"facebook",postType:"reels",label:"Facebook Reels",shortLabel:"FB\xB7Reels",ratio:"9:16",imageSize:"1440x2560",videoRatio:"9:16",videoResolution:"720p"},{platform:"youtube",postType:"video",label:"YouTube Video",shortLabel:"YT\xB7Video",ratio:"16:9",imageSize:"2560x1440",videoRatio:"16:9",videoResolution:"1080p"},{platform:"youtube",postType:"shorts",label:"YouTube Shorts",shortLabel:"YT\xB7Shorts",ratio:"9:16",imageSize:"1440x2560",videoRatio:"9:16",videoResolution:"720p"},{platform:"pinterest",postType:"pin",label:"Pinterest Pin",shortLabel:"PIN",ratio:"2:3",imageSize:"1664x2496",videoRatio:"9:16",videoResolution:"720p"},{platform:"x",postType:"post",label:"X Post",shortLabel:"X\xB7Post",ratio:"16:9",imageSize:"2560x1440",videoRatio:"16:9",videoResolution:"720p"},{platform:"linkedin",postType:"post",label:"LinkedIn Post",shortLabel:"LI\xB7Post",ratio:"1:1",imageSize:"2048x2048"},{platform:"linkedin",postType:"video",label:"LinkedIn Video",shortLabel:"LI\xB7Video",ratio:"16:9",imageSize:"2560x1440",videoRatio:"16:9",videoResolution:"1080p"},{platform:"threads",postType:"post",label:"Threads Post",shortLabel:"TH\xB7Post",ratio:"1:1",imageSize:"2048x2048"},{platform:"telegram",postType:"post",label:"Telegram Post",shortLabel:"TG\xB7Post",ratio:"1:1",imageSize:"2048x2048",videoRatio:"9:16",videoResolution:"720p"},{platform:"reddit",postType:"post",label:"Reddit Post",shortLabel:"RD\xB7Post",ratio:"16:9",imageSize:"2560x1440",videoRatio:"16:9",videoResolution:"720p"}],w2={"1:1":"\u65B9\u5F62 1:1","4:5":"\u7AD6\u56FE 4:5","3:4":"\u7AD6\u56FE 3:4","9:16":"\u7AD6\u5C4F 9:16","16:9":"\u6A2A\u5C4F 16:9","2:3":"\u7AD6\u56FE 2:3","1.91:1":"\u6A2A\u5E45 1.91:1"};function ic(n){const[a,o]=n.split(":").map(Number);return!a||!o?1:a/o}function ig(n){const a=new Set,o=[];for(const l of n)!l||a.has(l)||(a.add(l),o.push({ratio:l,value:ic(l),label:w2[l]??l}));return o}var vE=ig(["1:1","4:5","3:4","2:3","9:16","16:9","1.91:1"]),Gm=ig(["9:16","16:9","1:1","4:5"]);function E2(n=Km){const a=new Set,o=[];for(const l of n){if(!l.videoRatio)continue;const s=`${l.platform}:${l.postType}:${l.videoRatio}`;if(a.has(s))continue;a.add(s);const d=l.label.split(" ").slice(0,-1).join(" ")||l.label;o.push({platform:l.platform,postType:l.postType,label:`${d} ${l.videoRatio}`,ratio:l.videoRatio,value:ic(l.videoRatio)})}return o}var gE=E2();function k2(n=Km){const a=new Map;for(const o of n){const l=a.get(o.platform);(!l||l.postType!=="post"&&o.postType==="post")&&a.set(o.platform,o)}return Array.from(a.values()).map(o=>{const[l,s]=o.imageSize.split("x").map(Number),d=o.label.split(" ").slice(0,-1).join(" ")||o.label;return{platform:o.platform,label:`${d} ${o.ratio}`,ratio:o.ratio,value:ic(o.ratio),w:l,h:s}})}var bE=k2();function C2(n,a){return n>=1?{w:Math.round(a*n/2)*2,h:a}:{w:a,h:Math.round(a/n/2)*2}}function S2(n=Km){const a=new Set,o=[];for(const l of n){if(!l.videoRatio||!l.videoResolution)continue;const s=l.videoResolution==="1080p"?1080:720,{w:d,h:m}=C2(ic(l.videoRatio),s),h=`${d}x${m}`;a.has(h)||(a.add(h),o.push({label:`${l.shortLabel} ${d}\xD7${m}`,w:d,h:m}))}return o}var yE=S2(),F2=La(n=>{var a=Symbol.for("react.transitional.element"),o=Symbol.for("react.portal"),l=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),d=Symbol.for("react.profiler"),m=Symbol.for("react.consumer"),h=Symbol.for("react.context"),g=Symbol.for("react.forward_ref"),v=Symbol.for("react.suspense"),w=Symbol.for("react.memo"),W=Symbol.for("react.lazy"),S=Symbol.for("react.activity"),Q=Symbol.iterator;function X(x){return x===null||typeof x!="object"?null:(x=Q&&x[Q]||x["@@iterator"],typeof x=="function"?x:null)}var ue={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},oe=Object.assign,ge={};function Be(x,C,O){this.props=x,this.context=C,this.refs=ge,this.updater=O||ue}Be.prototype.isReactComponent={},Be.prototype.setState=function(x,C){if(typeof x!="object"&&typeof x!="function"&&x!=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,x,C,"setState")},Be.prototype.forceUpdate=function(x){this.updater.enqueueForceUpdate(this,x,"forceUpdate")};function Te(){}Te.prototype=Be.prototype;function de(x,C,O){this.props=x,this.context=C,this.refs=ge,this.updater=O||ue}var Ae=de.prototype=new Te;Ae.constructor=de,oe(Ae,Be.prototype),Ae.isPureReactComponent=!0;var ve=Array.isArray;function j(){}var k={H:null,A:null,T:null,S:null},H=Object.prototype.hasOwnProperty;function T(x,C,O){var B=O.ref;return{$$typeof:a,type:x,key:C,ref:B!==void 0?B:null,props:O}}function _(x,C){return T(x.type,C,x.props)}function le(x){return typeof x=="object"&&x!==null&&x.$$typeof===a}function se(x){var C={"=":"=0",":":"=2"};return"$"+x.replace(/[=:]/g,function(O){return C[O]})}var me=/\/+/g;function P(x,C){return typeof x=="object"&&x!==null&&x.key!=null?se(""+x.key):C.toString(36)}function $(x){switch(x.status){case"fulfilled":return x.value;case"rejected":throw x.reason;default:switch(typeof x.status=="string"?x.then(j,j):(x.status="pending",x.then(function(C){x.status==="pending"&&(x.status="fulfilled",x.value=C)},function(C){x.status==="pending"&&(x.status="rejected",x.reason=C)})),x.status){case"fulfilled":return x.value;case"rejected":throw x.reason}}throw x}function M(x,C,O,B,G){var ze=typeof x;(ze==="undefined"||ze==="boolean")&&(x=null);var J=!1;if(x===null)J=!0;else switch(ze){case"bigint":case"string":case"number":J=!0;break;case"object":switch(x.$$typeof){case a:case o:J=!0;break;case W:return J=x._init,M(J(x._payload),C,O,B,G)}}if(J)return G=G(x),J=B===""?"."+P(x,0):B,ve(G)?(O="",J!=null&&(O=J.replace(me,"$&/")+"/"),M(G,C,O,"",function(xe){return xe})):G!=null&&(le(G)&&(G=_(G,O+(G.key==null||x&&x.key===G.key?"":(""+G.key).replace(me,"$&/")+"/")+J)),C.push(G)),1;J=0;var te=B===""?".":B+":";if(ve(x))for(var U=0;U<x.length;U++)B=x[U],ze=te+P(B,U),J+=M(B,C,O,ze,G);else if(U=X(x),typeof U=="function")for(x=U.call(x),U=0;!(B=x.next()).done;)B=B.value,ze=te+P(B,U++),J+=M(B,C,O,ze,G);else if(ze==="object"){if(typeof x.then=="function")return M($(x),C,O,B,G);throw C=String(x),Error("Objects are not valid as a React child (found: "+(C==="[object Object]"?"object with keys {"+Object.keys(x).join(", ")+"}":C)+"). If you meant to render a collection of children, use an array instead.")}return J}function A(x,C,O){if(x==null)return x;var B=[],G=0;return M(x,B,"","",function(ze){return C.call(O,ze,G++)}),B}function ee(x){if(x._status===-1){var C=x._result;C=C(),C.then(function(O){(x._status===0||x._status===-1)&&(x._status=1,x._result=O)},function(O){(x._status===0||x._status===-1)&&(x._status=2,x._result=O)}),x._status===-1&&(x._status=0,x._result=C)}if(x._status===1)return x._result.default;throw x._result}var Me=typeof reportError=="function"?reportError:function(x){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var C=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof x=="object"&&x!==null&&typeof x.message=="string"?String(x.message):String(x),error:x});if(!window.dispatchEvent(C))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",x);return}console.error(x)},_e={map:A,forEach:function(x,C,O){A(x,function(){C.apply(this,arguments)},O)},count:function(x){var C=0;return A(x,function(){C++}),C},toArray:function(x){return A(x,function(C){return C})||[]},only:function(x){if(!le(x))throw Error("React.Children.only expected to receive a single React element child.");return x}};n.Activity=S,n.Children=_e,n.Component=Be,n.Fragment=l,n.Profiler=d,n.PureComponent=de,n.StrictMode=s,n.Suspense=v,n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=k,n.__COMPILER_RUNTIME={__proto__:null,c:function(x){return k.H.useMemoCache(x)}},n.cache=function(x){return function(){return x.apply(null,arguments)}},n.cacheSignal=function(){return null},n.cloneElement=function(x,C,O){if(x==null)throw Error("The argument must be a React element, but you passed "+x+".");var B=oe({},x.props),G=x.key;if(C!=null)for(ze in C.key!==void 0&&(G=""+C.key),C)!H.call(C,ze)||ze==="key"||ze==="__self"||ze==="__source"||ze==="ref"&&C.ref===void 0||(B[ze]=C[ze]);var ze=arguments.length-2;if(ze===1)B.children=O;else if(1<ze){for(var J=Array(ze),te=0;te<ze;te++)J[te]=arguments[te+2];B.children=J}return T(x.type,G,B)},n.createContext=function(x){return x={$$typeof:h,_currentValue:x,_currentValue2:x,_threadCount:0,Provider:null,Consumer:null},x.Provider=x,x.Consumer={$$typeof:m,_context:x},x},n.createElement=function(x,C,O){var B,G={},ze=null;if(C!=null)for(B in C.key!==void 0&&(ze=""+C.key),C)H.call(C,B)&&B!=="key"&&B!=="__self"&&B!=="__source"&&(G[B]=C[B]);var J=arguments.length-2;if(J===1)G.children=O;else if(1<J){for(var te=Array(J),U=0;U<J;U++)te[U]=arguments[U+2];G.children=te}if(x&&x.defaultProps)for(B in J=x.defaultProps,J)G[B]===void 0&&(G[B]=J[B]);return T(x,ze,G)},n.createRef=function(){return{current:null}},n.forwardRef=function(x){return{$$typeof:g,render:x}},n.isValidElement=le,n.lazy=function(x){return{$$typeof:W,_payload:{_status:-1,_result:x},_init:ee}},n.memo=function(x,C){return{$$typeof:w,type:x,compare:C===void 0?null:C}},n.startTransition=function(x){var C=k.T,O={};k.T=O;try{var B=x(),G=k.S;G!==null&&G(O,B),typeof B=="object"&&B!==null&&typeof B.then=="function"&&B.then(j,Me)}catch(ze){Me(ze)}finally{C!==null&&O.types!==null&&(C.types=O.types),k.T=C}},n.unstable_useCacheRefresh=function(){return k.H.useCacheRefresh()},n.use=function(x){return k.H.use(x)},n.useActionState=function(x,C,O){return k.H.useActionState(x,C,O)},n.useCallback=function(x,C){return k.H.useCallback(x,C)},n.useContext=function(x){return k.H.useContext(x)},n.useDebugValue=function(){},n.useDeferredValue=function(x,C){return k.H.useDeferredValue(x,C)},n.useEffect=function(x,C){return k.H.useEffect(x,C)},n.useEffectEvent=function(x){return k.H.useEffectEvent(x)},n.useId=function(){return k.H.useId()},n.useImperativeHandle=function(x,C,O){return k.H.useImperativeHandle(x,C,O)},n.useInsertionEffect=function(x,C){return k.H.useInsertionEffect(x,C)},n.useLayoutEffect=function(x,C){return k.H.useLayoutEffect(x,C)},n.useMemo=function(x,C){return k.H.useMemo(x,C)},n.useOptimistic=function(x,C){return k.H.useOptimistic(x,C)},n.useReducer=function(x,C,O){return k.H.useReducer(x,C,O)},n.useRef=function(x){return k.H.useRef(x)},n.useState=function(x){return k.H.useState(x)},n.useSyncExternalStore=function(x,C,O){return k.H.useSyncExternalStore(x,C,O)},n.useTransition=function(){return k.H.useTransition()},n.version="19.2.7"}),Ta=La((n,a)=>{a.exports=F2()}),M2=La(n=>{function a($,M){var A=$.length;$.push(M);e:for(;0<A;){var ee=A-1>>>1,Me=$[ee];if(0<s(Me,M))$[ee]=M,$[A]=Me,A=ee;else break e}}function o($){return $.length===0?null:$[0]}function l($){if($.length===0)return null;var M=$[0],A=$.pop();if(A!==M){$[0]=A;e:for(var ee=0,Me=$.length,_e=Me>>>1;ee<_e;){var x=2*(ee+1)-1,C=$[x],O=x+1,B=$[O];if(0>s(C,A))O<Me&&0>s(B,C)?($[ee]=B,$[O]=A,ee=O):($[ee]=C,$[x]=A,ee=x);else if(O<Me&&0>s(B,A))$[ee]=B,$[O]=A,ee=O;else break e}}return M}function s($,M){var A=$.sortIndex-M.sortIndex;return A!==0?A:$.id-M.id}n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"?(d=performance,n.unstable_now=function(){return d.now()}):(m=Date,h=m.now(),n.unstable_now=function(){return m.now()-h});var d,m,h,g=[],v=[],w=1,W=null,S=3,Q=!1,X=!1,ue=!1,oe=!1,ge=typeof setTimeout=="function"?setTimeout:null,Be=typeof clearTimeout=="function"?clearTimeout:null,Te=typeof setImmediate<"u"?setImmediate:null;function de($){for(var M=o(v);M!==null;){if(M.callback===null)l(v);else if(M.startTime<=$)l(v),M.sortIndex=M.expirationTime,a(g,M);else break;M=o(v)}}function Ae($){if(ue=!1,de($),!X)if(o(g)!==null)X=!0,ve||(ve=!0,le());else{var M=o(v);M!==null&&P(Ae,M.startTime-$)}}var ve=!1,j=-1,k=5,H=-1;function T(){return oe?!0:!(n.unstable_now()-H<k)}function _(){if(oe=!1,ve){var $=n.unstable_now();H=$;var M=!0;try{e:{X=!1,ue&&(ue=!1,Be(j),j=-1),Q=!0;var A=S;try{t:{for(de($),W=o(g);W!==null&&!(W.expirationTime>$&&T());){var ee=W.callback;if(typeof ee=="function"){W.callback=null,S=W.priorityLevel;var Me=ee(W.expirationTime<=$);if($=n.unstable_now(),typeof Me=="function"){W.callback=Me,de($),M=!0;break t}W===o(g)&&l(g),de($)}else l(g);W=o(g)}if(W!==null)M=!0;else{var _e=o(v);_e!==null&&P(Ae,_e.startTime-$),M=!1}}break e}finally{W=null,S=A,Q=!1}M=void 0}}finally{M?le():ve=!1}}}var le;typeof Te=="function"?le=function(){Te(_)}:typeof MessageChannel<"u"?(se=new MessageChannel,me=se.port2,se.port1.onmessage=_,le=function(){me.postMessage(null)}):le=function(){ge(_,0)};var se,me;function P($,M){j=ge(function(){$(n.unstable_now())},M)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function($){$.callback=null},n.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):k=0<$?Math.floor(1e3/$):5},n.unstable_getCurrentPriorityLevel=function(){return S},n.unstable_next=function($){switch(S){case 1:case 2:case 3:var M=3;break;default:M=S}var A=S;S=M;try{return $()}finally{S=A}},n.unstable_requestPaint=function(){oe=!0},n.unstable_runWithPriority=function($,M){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var A=S;S=$;try{return M()}finally{S=A}},n.unstable_scheduleCallback=function($,M,A){var ee=n.unstable_now();switch(typeof A=="object"&&A!==null?(A=A.delay,A=typeof A=="number"&&0<A?ee+A:ee):A=ee,$){case 1:var Me=-1;break;case 2:Me=250;break;case 5:Me=1073741823;break;case 4:Me=1e4;break;default:Me=5e3}return Me=A+Me,$={id:w++,callback:M,priorityLevel:$,startTime:A,expirationTime:Me,sortIndex:-1},A>ee?($.sortIndex=A,a(v,$),o(g)===null&&$===o(v)&&(ue?(Be(j),j=-1):ue=!0,P(Ae,A-ee))):($.sortIndex=Me,a(g,$),X||Q||(X=!0,ve||(ve=!0,le()))),$},n.unstable_shouldYield=T,n.unstable_wrapCallback=function($){var M=S;return function(){var A=S;S=M;try{return $.apply(this,arguments)}finally{S=A}}}}),L2=La((n,a)=>{a.exports=M2()}),A2=La(n=>{var a=Ta();function o(v){var w="https://react.dev/errors/"+v;if(1<arguments.length){w+="?args[]="+encodeURIComponent(arguments[1]);for(var W=2;W<arguments.length;W++)w+="&args[]="+encodeURIComponent(arguments[W])}return"Minified React error #"+v+"; visit "+w+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(){}var s={d:{f:l,r:function(){throw Error(o(522))},D:l,C:l,L:l,m:l,X:l,S:l,M:l},p:0,findDOMNode:null},d=Symbol.for("react.portal");function m(v,w,W){var S=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:d,key:S==null?null:""+S,children:v,containerInfo:w,implementation:W}}var h=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function g(v,w){if(v==="font")return"";if(typeof w=="string")return w==="use-credentials"?w:""}n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,n.createPortal=function(v,w){var W=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!w||w.nodeType!==1&&w.nodeType!==9&&w.nodeType!==11)throw Error(o(299));return m(v,w,null,W)},n.flushSync=function(v){var w=h.T,W=s.p;try{if(h.T=null,s.p=2,v)return v()}finally{h.T=w,s.p=W,s.d.f()}},n.preconnect=function(v,w){typeof v=="string"&&(w?(w=w.crossOrigin,w=typeof w=="string"?w==="use-credentials"?w:"":void 0):w=null,s.d.C(v,w))},n.prefetchDNS=function(v){typeof v=="string"&&s.d.D(v)},n.preinit=function(v,w){if(typeof v=="string"&&w&&typeof w.as=="string"){var W=w.as,S=g(W,w.crossOrigin),Q=typeof w.integrity=="string"?w.integrity:void 0,X=typeof w.fetchPriority=="string"?w.fetchPriority:void 0;W==="style"?s.d.S(v,typeof w.precedence=="string"?w.precedence:void 0,{crossOrigin:S,integrity:Q,fetchPriority:X}):W==="script"&&s.d.X(v,{crossOrigin:S,integrity:Q,fetchPriority:X,nonce:typeof w.nonce=="string"?w.nonce:void 0})}},n.preinitModule=function(v,w){if(typeof v=="string")if(typeof w=="object"&&w!==null){if(w.as==null||w.as==="script"){var W=g(w.as,w.crossOrigin);s.d.M(v,{crossOrigin:W,integrity:typeof w.integrity=="string"?w.integrity:void 0,nonce:typeof w.nonce=="string"?w.nonce:void 0})}}else w==null&&s.d.M(v)},n.preload=function(v,w){if(typeof v=="string"&&typeof w=="object"&&w!==null&&typeof w.as=="string"){var W=w.as,S=g(W,w.crossOrigin);s.d.L(v,W,{crossOrigin:S,integrity:typeof w.integrity=="string"?w.integrity:void 0,nonce:typeof w.nonce=="string"?w.nonce:void 0,type:typeof w.type=="string"?w.type:void 0,fetchPriority:typeof w.fetchPriority=="string"?w.fetchPriority:void 0,referrerPolicy:typeof w.referrerPolicy=="string"?w.referrerPolicy:void 0,imageSrcSet:typeof w.imageSrcSet=="string"?w.imageSrcSet:void 0,imageSizes:typeof w.imageSizes=="string"?w.imageSizes:void 0,media:typeof w.media=="string"?w.media:void 0})}},n.preloadModule=function(v,w){if(typeof v=="string")if(w){var W=g(w.as,w.crossOrigin);s.d.m(v,{as:typeof w.as=="string"&&w.as!=="script"?w.as:void 0,crossOrigin:W,integrity:typeof w.integrity=="string"?w.integrity:void 0})}else s.d.m(v)},n.requestFormReset=function(v){s.d.r(v)},n.unstable_batchedUpdates=function(v,w){return v(w)},n.useFormState=function(v,w,W){return h.H.useFormState(v,w,W)},n.useFormStatus=function(){return h.H.useHostTransitionStatus()},n.version="19.2.7"}),N2=La((n,a)=>{function o(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(o)}catch(l){console.error(l)}}o(),a.exports=A2()}),_2=La(n=>{var a=L2(),o=Ta(),l=N2();function s(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var r=2;r<arguments.length;r++)t+="&args[]="+encodeURIComponent(arguments[r])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function d(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function m(e){var t=e,r=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(r=t.return),e=t.return;while(e)}return t.tag===3?r:null}function h(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function g(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function v(e){if(m(e)!==e)throw Error(s(188))}function w(e){var t=e.alternate;if(!t){if(t=m(e),t===null)throw Error(s(188));return t!==e?null:e}for(var r=e,i=t;;){var u=r.return;if(u===null)break;var c=u.alternate;if(c===null){if(i=u.return,i!==null){r=i;continue}break}if(u.child===c.child){for(c=u.child;c;){if(c===r)return v(u),e;if(c===i)return v(u),t;c=c.sibling}throw Error(s(188))}if(r.return!==i.return)r=u,i=c;else{for(var f=!1,y=u.child;y;){if(y===r){f=!0,r=u,i=c;break}if(y===i){f=!0,i=u,r=c;break}y=y.sibling}if(!f){for(y=c.child;y;){if(y===r){f=!0,r=c,i=u;break}if(y===i){f=!0,i=c,r=u;break}y=y.sibling}if(!f)throw Error(s(189))}}if(r.alternate!==i)throw Error(s(190))}if(r.tag!==3)throw Error(s(188));return r.stateNode.current===r?e:t}function W(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=W(e),t!==null)return t;e=e.sibling}return null}var S=Object.assign,Q=Symbol.for("react.element"),X=Symbol.for("react.transitional.element"),ue=Symbol.for("react.portal"),oe=Symbol.for("react.fragment"),ge=Symbol.for("react.strict_mode"),Be=Symbol.for("react.profiler"),Te=Symbol.for("react.consumer"),de=Symbol.for("react.context"),Ae=Symbol.for("react.forward_ref"),ve=Symbol.for("react.suspense"),j=Symbol.for("react.suspense_list"),k=Symbol.for("react.memo"),H=Symbol.for("react.lazy"),T=Symbol.for("react.activity"),_=Symbol.for("react.memo_cache_sentinel"),le=Symbol.iterator;function se(e){return e===null||typeof e!="object"?null:(e=le&&e[le]||e["@@iterator"],typeof e=="function"?e:null)}var me=Symbol.for("react.client.reference");function P(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===me?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case oe:return"Fragment";case Be:return"Profiler";case ge:return"StrictMode";case ve:return"Suspense";case j:return"SuspenseList";case T:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case ue:return"Portal";case de:return e.displayName||"Context";case Te:return(e._context.displayName||"Context")+".Consumer";case Ae:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case k:return t=e.displayName||null,t!==null?t:P(e.type)||"Memo";case H:t=e._payload,e=e._init;try{return P(e(t))}catch{}}return null}var $=Array.isArray,M=o.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,A=l.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ee={pending:!1,data:null,method:null,action:null},Me=[],_e=-1;function x(e){return{current:e}}function C(e){0>_e||(e.current=Me[_e],Me[_e]=null,_e--)}function O(e,t){_e++,Me[_e]=e.current,e.current=t}var B=x(null),G=x(null),ze=x(null),J=x(null);function te(e,t){switch(O(ze,t),O(G,e),O(B,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Bv(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Bv(t),e=zv(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}C(B),O(B,e)}function U(){C(B),C(G),C(ze)}function xe(e){e.memoizedState!==null&&O(J,e);var t=B.current,r=zv(t,e.type);t!==r&&(O(G,e),O(B,r))}function Ce(e){G.current===e&&(C(B),C(G)),J.current===e&&(C(J),Zl._currentValue=ee)}var Ye,et;function lt(e){if(Ye===void 0)try{throw Error()}catch(r){var t=r.stack.trim().match(/\n( *(at )?)/);Ye=t&&t[1]||"",et=-1<r.stack.indexOf(`
|
|
3
|
+
`);return o.length?o:[""]}function bs(n){return Number.isFinite(n)&&n>=0}function Qx(n){if(!Hm(n))return null;const a=bs(n.startAt)?Number(n.startAt):null,o=bs(n.endAt)?Number(n.endAt):null;if(a==null&&o==null)return null;const l=Math.max(0,a??0),s=Math.max(l,o??l);return{start:l,end:s}}function V0(n){const a=Qx(n);return!!a&&a.end>a.start}function Hm(n){return n?.type==="pen"||n?.type==="line"||n?.type==="arrow"||n?.type==="rect"||n?.type==="ellipse"||n?.type==="text"||n?.type==="sticker"}function e2(n){if(!Hm(n)&&n?.type!=="filter"&&n?.type!=="adjust")return null;const a=bs(n.startAt)?Number(n.startAt):null,o=bs(n.endAt)?Number(n.endAt):null;if(a==null&&o==null)return null;const l=Math.max(0,a??0),s=Math.max(l,o??l);return{start:l,end:s}}function t2(n,a){const o=e2(n);return o?Number.isFinite(a)?a>=o.start&&a<=o.end:!1:!0}function n2(n,a){return n?.length?Number.isFinite(a)?n.filter(o=>t2(o,a)):n:[]}function W0(n){return n?.type==="text"||n?.type==="sticker"||n?.type==="filter"||n?.type==="adjust"}function q0(n){return Number.isFinite(n?.timelineTrack)?Math.max(0,Math.round(Number(n.timelineTrack))):0}function Z0(n){return bs(n?.startAt)?Number(n.startAt):0}function Vm(n){const a=H0(n),o=Zx(n,a),l=Ux(n,a),s=Xx(n,a),d=Jx(n.text,n.textTransform),m=qx(),h=Gx(n);m&&(m.font=h);const g=d.map(J=>{const Y=J===""?" ":J;return m?m.measureText(Y).width:Math.max(1,Y.length)*a*.6}),v=g.length?Math.max(...g):a*.6,w=Math.max(a,d.length*s),W=Math.max(Number.isFinite(n.width)?n.width:0,v+o*2),S=w+l*2;return{font:h,fontSize:a,paddingX:o,paddingY:l,lineHeight:s,lines:d,widths:g,boxWidth:W,boxHeight:S,align:Kx(n)}}function r2(n,a,o){return a.align==="center"?n.x+a.boxWidth/2-o/2:a.align==="right"?n.x+a.boxWidth-a.paddingX-o:n.x+a.paddingX}function a2(n,a,o,l,s,d){if(!a.textDecoration||d<=0)return;const m=o.fontSize,h=String(a.textDecoration).includes("underline"),g=String(a.textDecoration).includes("line-through");if(!(!h&&!g)){if(n.save(),n.strokeStyle=a.color||"#fff",n.lineWidth=Math.max(1,m/18),h){const v=s+m+Math.max(1,m*.08);n.beginPath(),n.moveTo(l,v),n.lineTo(l+d,v),n.stroke()}if(g){const v=s+m*.56;n.beginPath(),n.moveTo(l,v),n.lineTo(l+d,v),n.stroke()}n.restore()}}function da(n){return I0(n.rotation??0)}function Ir(n){switch(n.type){case"pen":{let a=1/0,o=1/0,l=-1/0,s=-1/0;for(let d=0;d<n.points.length;d+=2)a=Math.min(a,n.points[d]),l=Math.max(l,n.points[d]),o=Math.min(o,n.points[d+1]),s=Math.max(s,n.points[d+1]);return{x:a,y:o,w:l-a,h:s-o}}case"line":case"arrow":return{x:Math.min(n.x1,n.x2),y:Math.min(n.y1,n.y2),w:Math.abs(n.x2-n.x1),h:Math.abs(n.y2-n.y1)};case"rect":case"ellipse":case"sticker":return{x:n.x,y:n.y,w:n.w,h:n.h};case"text":{const a=Vm(n);return{x:n.x,y:n.y,w:a.boxWidth,h:a.boxHeight}}}}function Wm(n){const a=Ir(n);return{x:a.x+a.w/2,y:a.y+a.h/2}}function i2(n,a,o,l,s){const d=s*R0,m=Math.cos(d),h=Math.sin(d),g=n-o,v=a-l;return{x:o+g*m-v*h,y:l+g*h+v*m}}function U0(n,a,o,l,s){return{x:o+(n-o)*s,y:l+(a-l)*s}}function X0(n,a,o){const l=da(a);if(l){const s=Wm(a);n.save(),n.translate(s.x,s.y),n.rotate(l*R0),n.translate(-s.x,-s.y),K0(n,a,o),n.restore();return}K0(n,a,o)}function K0(n,a,o){switch(a.type){case"pen":{tc(n,a.color,a.width),n.beginPath(),n.moveTo(a.points[0],a.points[1]);for(let l=2;l<a.points.length;l+=2)n.lineTo(a.points[l],a.points[l+1]);n.stroke();break}case"line":case"arrow":{tc(n,a.color,a.width),n.beginPath(),n.moveTo(a.x1,a.y1),n.lineTo(a.x2,a.y2),n.stroke(),a.type==="arrow"&&Hx(n,a.x1,a.y1,a.x2,a.y2,a.width);break}case"rect":{tc(n,a.color,a.width),n.strokeRect(a.x,a.y,a.w,a.h);break}case"ellipse":{tc(n,a.color,a.width),n.beginPath(),n.ellipse(a.x+a.w/2,a.y+a.h/2,Math.abs(a.w/2),Math.abs(a.h/2),0,0,Math.PI*2),n.stroke();break}case"text":{const l=Vm(a),s=Number.isFinite(a.opacity)?Math.min(1,Math.max(0,a.opacity/100)):1,d=Number.isFinite(a.borderWidth)?Math.max(0,a.borderWidth):0,m=a.autoOutline!==!1;n.save(),n.globalAlpha*=s,a.backgroundColor&&a.backgroundColor!=="transparent"&&(n.fillStyle=a.backgroundColor,n.fillRect(a.x,a.y,l.boxWidth,l.boxHeight)),n.fillStyle=a.color||"#fff",n.font=l.font,n.textBaseline="top",n.lineJoin="round";const h=a.boxShadow;h&&(n.shadowColor=h.color||"transparent",n.shadowOffsetX=h.x||0,n.shadowOffsetY=h.y||0,n.shadowBlur=h.blur||0),l.lines.forEach((g,v)=>{const w=l.widths[v]??0,W=r2(a,l,w),S=a.y+l.paddingY+v*l.lineHeight;(d>0||m)&&(n.strokeStyle=d>0?a.borderColor||"#000":a.strokeColor||"rgba(0,0,0,0.45)",n.lineWidth=d>0?d:Math.max(1,l.fontSize/18),n.strokeText(g,W,S)),n.fillText(g,W,S),a2(n,a,l,W,S,w)}),n.restore();break}case"sticker":{if(a.emoji){const l=Wx(a);n.save(),n.font=`${l.size}px -apple-system, "Apple Color Emoji", "Segoe UI Emoji", sans-serif`,n.textAlign="center",n.textBaseline="middle",n.fillText(a.emoji,l.x+l.size/2,l.y+l.size/2),n.restore()}else if(a.src){const l=o?.get(a.src);l&&n.drawImage(l,a.x,a.y,a.w,a.h)}break}}}function nc(n,a,o){for(const l of a)X0(n,l,o)}async function rc(n){const a=new Map,o=[...new Set(n.filter(l=>l.type==="sticker"&&l.src).map(l=>l.src))];return await Promise.all(o.map(l=>new Promise(s=>{const d=new Image;d.onload=()=>{a.set(l,d),s()},d.onerror=()=>s(),d.src=l}))),a}async function G0(n,a,o){if(!n?.length)return null;const l=document.createElement("canvas");l.width=a,l.height=o;const s=l.getContext("2d");if(!s)return null;const d=await rc(n);return nc(s,n,d),new Promise(m=>l.toBlob(h=>m(h),"image/png"))}function qm(n,a,o,l=12){for(let s=n.length-1;s>=0;s--){const d=n[s];if(l2(d,a,o,l))return s}return-1}function o2(n,a,o,l,s){return Math.abs(n-o)<=s&&Math.abs(a-l)<=s}function Y0(n,a,o,l,s,d,m){const h=s-o,g=d-l,v=h*h+g*g||1,w=Math.max(0,Math.min(1,((n-o)*h+(a-l)*g)/v)),W=o+w*h,S=l+w*g;return(n-W)**2+(a-S)**2<=m*m}function l2(n,a,o,l){const s=da(n);if(s){const d=Wm(n),m=i2(a,o,d.x,d.y,-s);return J0(n,m.x,m.y,l)}return J0(n,a,o,l)}function J0(n,a,o,l){switch(n.type){case"pen":{for(let s=0;s+3<n.points.length;s+=2)if(Y0(a,o,n.points[s],n.points[s+1],n.points[s+2],n.points[s+3],l+n.width/2))return!0;return!1}case"line":case"arrow":return Y0(a,o,n.x1,n.y1,n.x2,n.y2,l+n.width/2);case"rect":case"ellipse":return a>=n.x-l&&a<=n.x+n.w+l&&o>=n.y-l&&o<=n.y+n.h+l;case"text":{const s=Vm(n);return a>=n.x-l&&a<=n.x+s.boxWidth+l&&o>=n.y-l&&o<=n.y+s.boxHeight+l}case"sticker":return o2(a,o,n.x+n.w/2,n.y+n.h/2,Math.max(n.w,n.h)/2+l)}}function Q0(n,a,o){const l=Math.max(8,o);if(!(n>0)||!(a>0))return{w:l,h:l};const s=l/Math.max(n,a);return{w:Math.max(8,Math.round(n*s)),h:Math.max(8,Math.round(a*s))}}function Zm(n,a){const o=Math.max(.05,a),l=Wm(n);switch(n.type){case"pen":return{...n,points:n.points.map((s,d)=>d%2===0?l.x+(s-l.x)*o:l.y+(s-l.y)*o)};case"line":case"arrow":{const s=U0(n.x1,n.y1,l.x,l.y,o),d=U0(n.x2,n.y2,l.x,l.y,o);return{...n,x1:s.x,y1:s.y,x2:d.x,y2:d.y}}case"rect":case"ellipse":case"sticker":return{...n,w:Math.max(8,n.w*o),h:Math.max(8,n.h*o)};case"text":return{...n,fontSize:Math.min(512,Math.max(8,n.fontSize*o)),width:Number.isFinite(n.width)?Math.max(80,n.width*o):n.width,paddingX:Number.isFinite(n.paddingX)?Math.max(0,n.paddingX*o):n.paddingX,paddingY:Number.isFinite(n.paddingY)?Math.max(0,n.paddingY*o):n.paddingY,borderWidth:Number.isFinite(n.borderWidth)?Math.max(0,n.borderWidth*o):n.borderWidth,boxShadow:n.boxShadow?{...n.boxShadow,x:(n.boxShadow.x||0)*o,y:(n.boxShadow.y||0)*o,blur:(n.boxShadow.blur||0)*o}:n.boxShadow};default:return n}}function s2(n,a){return{...n,rotation:I0(a)}}function ac(n,a,o){switch(n.type){case"pen":{const l=n.points.map((s,d)=>d%2===0?s+a:s+o);return{...n,points:l}}case"line":case"arrow":return{...n,x1:n.x1+a,y1:n.y1+o,x2:n.x2+a,y2:n.y2+o};case"rect":case"ellipse":case"sticker":return{...n,x:n.x+a,y:n.y+o};case"text":return{...n,x:n.x+a,y:n.y+o}}}function u2(n){const a=String(n??"").match(/^data:(image\/(?:png|jpe?g));base64,([a-z0-9+/=]+)$/i);if(!a)return null;const o=atob(a[2]),l=new Uint8Array(o.length);for(let s=0;s<o.length;s++)l[s]=o.charCodeAt(s);return new Blob([l],{type:a[1].toLowerCase()})}async function c2(n,a,o=[]){const l=n.getExportPlan(),s=new FormData;l.videoSrcOrder.forEach((S,J)=>{const Y=a[S];Y&&s.append(`video_${J}`,Y,Y.name||`video_${J}.mp4`)}),l.audioSrcOrder.forEach((S,J)=>{const Y=o[S];Y&&s.append(`audio_${J}`,Y,Y.name||`audio_${J}`)});const d=oo(l.state.canvas,l.state),m=l.state.overlays??[],h=m.filter(S=>V0(S)),g=m.filter(S=>!V0(S)&&Hm(S)),v=await G0(g,d.w,d.h);v&&s.append("overlay",v,"overlay.png");for(let S=0;S<h.length;S++){const J=await G0([h[S]],d.w,d.h);J&&s.append(`textOverlay_${S}`,J,`text-overlay-${S}.png`)}const w=l.state.poster?.useAsVideoCover?u2(l.state.poster.preview):null;w&&s.append("videoCover",w,"video-cover.png");const W=l.state.poster?.preview?{...l.state,poster:{...l.state.poster,preview:void 0}}:l.state;return s.append("editState",JSON.stringify(W)),s}function _a(n){return Math.max(-1,Math.min(1,Number(n)||0))}function Yo(n){return Math.max(0,Math.min(1,Number(n)||0))}function Cr(n){return Math.max(0,Math.min(1,n))}function ii(n){return Math.max(0,Math.min(255,n))}function lo(n,a,o){if(n===a)return o<n?0:1;const l=Math.max(0,Math.min(1,(o-n)/(a-n)));return l*l*(3-2*l)}function Um(n){const a=lo(.08,.4,n),o=1-lo(.6,.92,n);return Cr(a*o*2.2)}function eg(n,a,o=0){const l=Math.sin(n*12.9898+a*78.233+o*37.719)*43758.5453;return l-Math.floor(l)}var so=null;function d2(n,a){return typeof document>"u"?null:(so??(so=document.createElement("canvas")),so.width!==n&&(so.width=n),so.height!==a&&(so.height=a),so)}function tg(n,a,o,l){if(!l||l==="none")return;const s=d2(a,o),d=s?.getContext("2d");!s||!d||(d.setTransform(1,0,0,1,0,0),d.clearRect(0,0,a,o),d.drawImage(n.canvas,0,0,a,o),n.save(),n.setTransform(1,0,0,1,0,0),n.clearRect(0,0,a,o),n.filter=l,n.drawImage(s,0,0,a,o),n.restore(),n.filter="none")}function m2(n,a,o,l){const s=$0(l?.filterPreset)?.css??"";tg(n,a,o,s)}function f2(n,a,o,l){tg(n,a,o,Rm(l??{},"")),ng(n,a,o,l??{})}function p2(n={}){return["temperature","tint","vibrance","gamma","highlights","shadows","whites","blacks","lightSense"].some(a=>Math.abs(_a(n[a]))>1e-4)?!0:["sharpen","clarity","grain","fade","vignette"].some(a=>Yo(n[a])>1e-4)}function ng(n,a,o,l={}){if(!p2(l))return;let s;try{s=n.getImageData(0,0,a,o)}catch{return}const d=_a(l.temperature),m=_a(l.tint),h=_a(l.vibrance),g=_a(l.gamma),v=_a(l.highlights),w=_a(l.shadows),W=_a(l.whites),S=_a(l.blacks),J=_a(l.lightSense),Y=Yo(l.sharpen),ue=Yo(l.clarity),oe=Yo(l.grain),ge=Yo(l.fade),Be=Yo(l.vignette),Te=1+g*(g>0?1:.5),de=g===0?1:1/Math.max(.01,Te),Ae=d*.18,ve=d*.02,P=-d*.18,k=m*.1,H=-m*.12,T=s.data;for(let _=0;_<T.length;_+=4){let le=T[_]/255,se=T[_+1]/255,me=T[_+2]/255;if((d!==0||m!==0)&&(le=Cr(le+Ae+k),se=Cr(se+ve+H),me=Cr(me+P+k)),h!==0){const O=Math.max(le,se,me),$=Math.min(le,se,me),M=O-$,A=(le+se+me)/3,ee=h>0?h*(1-M):h*(.35+M*.65);le=Cr(A+(le-A)*(1+ee)),se=Cr(A+(se-A)*(1+ee)),me=Cr(A+(me-A)*(1+ee))}if(g!==0&&(le=Cr(Math.pow(le,de)),se=Cr(Math.pow(se,de)),me=Cr(Math.pow(me,de))),v!==0||w!==0||W!==0||S!==0||J!==0||ge!==0){const O=.2126*le+.7152*se+.0722*me,$=1-lo(.18,.62,O),M=1-lo(.04,.32,O),A=lo(.38,.84,O),ee=lo(.7,.98,O),Me=Um(O),_e=w*$*.28+v*A*.24+S*M*.2+W*ee*.2+J*Me*.18+ge*(.12+$*.06);if(le=Cr(le+_e),se=Cr(se+_e),me=Cr(me+_e),ge>0){const x=(le+se+me)/3,C=ge*.16;le=Cr(le*(1-C)+x*C),se=Cr(se*(1-C)+x*C),me=Cr(me*(1-C)+x*C)}}T[_]=Math.round(le*255),T[_+1]=Math.round(se*255),T[_+2]=Math.round(me*255)}if(Y>1e-4||ue>1e-4){const _=new Uint8ClampedArray(T),le=a*4;for(let se=1;se<o-1;se++)for(let me=1;me<a-1;me++){const O=se*le+me*4,$=(_[O-4]+_[O+4]+_[O-le]+_[O+le]+_[O]*4)/8,M=(_[O-3]+_[O+5]+_[O-le+1]+_[O+le+1]+_[O+1]*4)/8,A=(_[O-2]+_[O+6]+_[O-le+2]+_[O+le+2]+_[O+2]*4)/8,ee=(.2126*_[O]+.7152*_[O+1]+.0722*_[O+2])/255,Me=Math.min(1.8,Y*1.45+ue*.9*Um(ee));T[O]=ii(_[O]+(_[O]-$)*Me),T[O+1]=ii(_[O+1]+(_[O+1]-M)*Me),T[O+2]=ii(_[O+2]+(_[O+2]-A)*Me)}}if(oe>1e-4){const _=oe*26;for(let le=0;le<o;le++)for(let se=0;se<a;se++){const me=(le*a+se)*4,O=(.2126*T[me]+.7152*T[me+1]+.0722*T[me+2])/255,$=.4+Um(O)*.9,M=(eg(se,le)-.5)*_*$,A=(eg(se,le,1)-.5)*_*.22*oe;T[me]=ii(T[me]+M+A),T[me+1]=ii(T[me+1]+M*.88),T[me+2]=ii(T[me+2]+M-A)}}if(Be>1e-4){const _=(a-1)/2,le=(o-1)/2,se=Math.sqrt(_*_+le*le)||1;for(let me=0;me<o;me++)for(let O=0;O<a;O++){const $=(me*a+O)*4,M=O-_,A=me-le,ee=Math.sqrt(M*M+A*A)/se,Me=1-lo(.32,1,ee)*Be*.62;T[$]=ii(T[$]*Me),T[$+1]=ii(T[$+1]*Me),T[$+2]=ii(T[$+2]*Me)}}n.putImageData(s,0,0)}function Xm(n,a,o,l,s,d=1,m,h=!0){const g=oo(l,s);n.width=Math.max(2,Math.round(g.w*d)),n.height=Math.max(2,Math.round(g.h*d));const v=n.getContext("2d");if(!v)return;const w=Go(l.w,l.h,s.rotation),W=s.crop??{x:0,y:0,width:w.w,height:w.h},S=s.scale?.fit??"force",{src:J,dst:Y}=$m({width:W.width,height:W.height},g,S);S==="contain"&&(v.fillStyle="#000",v.fillRect(0,0,n.width,n.height)),v.filter=Rm(s.filters,s.filterPreset),v.save(),S==="contain"&&(v.beginPath(),v.rect(d*Y.x,d*Y.y,d*Y.width,d*Y.height),v.clip()),v.translate(d*Y.x,d*Y.y),v.scale(d*Y.width/J.width,d*Y.height/J.height),v.translate(-(W.x+J.x),-(W.y+J.y)),v.translate(w.w/2,w.h/2),v.rotate(s.rotation*Om),v.scale(s.flipX?-1:1,s.flipY?-1:1);const ue=$m({width:o.w,height:o.h},{w:l.w,h:l.h},"cover");if(v.drawImage(a,ue.src.x,ue.src.y,ue.src.width,ue.src.height,-l.w/2,-l.h/2,l.w,l.h),v.restore(),v.filter="none",ng(v,n.width,n.height,s.filters),h&&s.overlays?.length){const oe=Number.isFinite(s?.__mePreviewTimelineTime)?Number(s.__mePreviewTimelineTime):null,ge=oe==null?s.overlays:n2(s.overlays,oe),Be=ge.map((de,Ae)=>({overlay:de,index:Ae})).filter(de=>W0(de.overlay)).sort((de,Ae)=>{const ve=q0(Ae.overlay)-q0(de.overlay);if(ve!==0)return ve;const P=Z0(de.overlay)-Z0(Ae.overlay);return Math.abs(P)>1e-6?P:de.index-Ae.index}),Te=ge.filter(de=>!W0(de));v.setTransform(d,0,0,d,0,0),Be.forEach(de=>{if(de.overlay?.type==="filter"){v.setTransform(1,0,0,1,0,0),m2(v,n.width,n.height,de.overlay),v.setTransform(d,0,0,d,0,0);return}if(de.overlay?.type==="adjust"){v.setTransform(1,0,0,1,0,0),f2(v,n.width,n.height,de.overlay),v.setTransform(d,0,0,d,0,0);return}X0(v,de.overlay,m)}),nc(v,Te,m),v.setTransform(1,0,0,1,0,0)}}var rg={"tool.trim":"\u526A\u8F91","tool.crop":"\u88C1\u526A","tool.tune":"\u8C03\u8272","tool.filter":"\u6EE4\u955C","tool.annotate":"\u6807\u6CE8","tool.sticker":"\u8D34\u7EB8","tool.resize":"\u6BD4\u4F8B","tune.brightness":"\u4EAE\u5EA6","tune.contrast":"\u5BF9\u6BD4","tune.saturation":"\u9971\u548C","tune.gamma":"Gamma","overlay.select":"\u9009\u62E9","overlay.pen":"\u753B\u7B14","overlay.eraser":"\u6A61\u76AE","overlay.line":"\u76F4\u7EBF","overlay.arrow":"\u7BAD\u5934","overlay.rect":"\u77E9\u5F62","overlay.ellipse":"\u692D\u5706","overlay.text":"\u6587\u5B57","overlay.color":"\u7EBF\u8272","overlay.width":"\u7EBF\u5BBD","overlay.copySelected":"\u590D\u5236","overlay.delSelected":"\u5220\u9664\u9009\u4E2D","overlay.editSelected":"\u7F16\u8F91","overlay.pickImage":"\u9009\u62E9\u56FE\u7247","overlay.hint":"\u70B9 emoji/\u56FE\u7247\u6DFB\u52A0 \u2192 \u753B\u5E03\u4E0A\u62D6\u52A8\u6446\u4F4D,\u62D6\u53F3\u4E0B\u89D2\u7D2B\u8272\u628A\u624B\u7F29\u653E","overlay.textPlaceholder":"\u8F93\u5165\u6587\u5B57,\u56DE\u8F66\u786E\u8BA4","filter.none":"\u539F\u56FE","filter.bw":"\u9ED1\u767D","filter.sepia":"\u590D\u53E4","filter.warm":"\u6696\u9633","filter.cool":"\u51B7\u8C03","filter.vivid":"\u9C9C\u8273","ratio.orig":"\u539F\u59CB","ratio.free":"\u81EA\u7531\u6BD4\u4F8B","ratio.9:16":"\u7AD6\u5C4F 9:16","ratio.16:9":"\u6A2A\u5C4F 16:9","ratio.1:1":"\u65B9\u5F62 1:1","ratio.4:5":"\u7AD6\u56FE 4:5","act.fit":"\u9002\u5E94","act.zoomFit":"\u7F29\u653E\u81F3\u9002\u5F53\u5927\u5C0F","act.zoomTo":"\u7F29\u653E\u81F3 {value}%","act.split":"\u5206\u5272","act.copy":"\u590D\u5236","act.delete":"\u5220\u9664","act.restore":"\u8FD8\u539F","act.deleteMusic":"\u5220\u9664\u97F3\u4E50","act.cancel":"\u53D6\u6D88","act.exportPoster":"\u5BFC\u51FA\u5C01\u9762","act.exporting":"\u5BFC\u51FA\u4E2D\u2026","act.poster":"\u{1F5BC} \u5C01\u9762","act.again":"\u518D\u6B21\u4E0B\u8F7D","act.saveDrive":"\u5B58\u7F51\u76D8","act.changeImage":"\u2190 \u6362\u4E00\u5F20","act.changeVideo":"\u2190 \u6362\u4E00\u4E2A","crop.rotateLeft":"\u21BA \u5411\u5DE6\u65CB\u8F6C","crop.flipX":"\u21CB \u6C34\u5E73\u7FFB\u8F6C","crop.flipY":"\u21F5 \u5782\u76F4\u7FFB\u8F6C","crop.rotateLeftShort":"\u5DE6\u8F6C","crop.flipXShort":"\u6A2A\u7FFB","crop.flipYShort":"\u7AD6\u7FFB","tip.close":"\u5173\u95ED(\u6362\u6587\u4EF6)","tip.undo":"\u64A4\u9500","tip.redo":"\u91CD\u505A","tip.resetOpened":"\u91CD\u7F6E\u5230\u6253\u5F00\u6587\u4EF6\u65F6","tip.previewZoom":"\u9884\u89C8\u7F29\u653E\u6BD4\u4F8B","tip.previewZoomOut":"\u7F29\u5C0F\u9884\u89C8","tip.previewZoomIn":"\u653E\u5927\u9884\u89C8","tip.previewZoomFit":"\u9002\u5E94\u9884\u89C8","tip.previewPointer":"\u6307\u9488\u5DE5\u5177","tip.previewPan":"\u624B\u5DE5\u5177\uFF1A\u62D6\u52A8\u753B\u9762","tip.poster":"\u9884\u89C8\u5E76\u9009\u62E9\u5C01\u9762\u5E27","tip.keepAudio":"\u539F\u89C6\u9891\u58F0\u97F3\u5F00\u5173(\u4E0E\u97F3\u4E50\u6DF7\u97F3;\u9884\u89C8\u540C\u6B65)","tip.split":"\u5728\u64AD\u653E\u5934\u5904\u628A\u5F53\u524D\u7247\u6BB5\u4E00\u5206\u4E3A\u4E8C","tip.zoomOut":"\u7F29\u5C0F\u65F6\u95F4\u8F74(Ctrl+\u6EDA\u8F6E)","tip.zoomIn":"\u653E\u5927\u65F6\u95F4\u8F74(Ctrl+\u6EDA\u8F6E)","tip.fit":"\u7F29\u653E\u5230\u9002\u5E94\u5BBD\u5EA6","tip.addVideo":"\u6DFB\u52A0\u89C6\u9891\u7247\u6BB5","tip.addAudio":"\u6DFB\u52A0\u97F3\u4E50(\u97F3\u9891\u6587\u4EF6,\u6216\u9009\u542B\u58F0\u97F3\u7684\u89C6\u9891\u81EA\u52A8\u63D0\u53D6\u97F3\u8F68;\u4E0E\u539F\u58F0\u6DF7\u97F3)","tip.dupClip":"\u590D\u5236\u8BE5\u7247\u6BB5(\u63D2\u5230\u5176\u540E)","tip.delClip":"\u5220\u9664\u8BE5\u7247\u6BB5","tip.lockAspect":"\u9501\u5B9A\u7EB5\u6A2A\u6BD4","tip.dblConfirm":"\u53CC\u51FB\u786E\u8BA4\u88C1\u526A","err.notVideo":"\u8BF7\u9009\u62E9\u89C6\u9891\u6587\u4EF6","err.maxVideo":"\u6700\u591A {max} \u4E2A\u89C6\u9891\u7D20\u6750","err.videoLoad":"\u89C6\u9891\u52A0\u8F7D\u5931\u8D25,\u8BF7\u6362\u4E00\u4E2A\u6587\u4EF6","err.notAudio":"\u8BF7\u9009\u62E9\u97F3\u9891\u6587\u4EF6(mp3/wav/m4a),\u6216\u542B\u58F0\u97F3\u7684\u89C6\u9891(\u81EA\u52A8\u63D0\u53D6\u97F3\u8F68)","err.maxAudio":"\u6700\u591A {max} \u4E2A\u97F3\u9891\u7D20\u6750","err.audioLoad":"\u97F3\u9891\u52A0\u8F7D\u5931\u8D25,\u8BF7\u6362\u4E00\u4E2A\u6587\u4EF6","err.processFailed":"\u5904\u7406\u5931\u8D25","err.posterFailed":"\u5C01\u9762\u6E32\u67D3\u5931\u8D25","err.canvas":"canvas \u4E0D\u53EF\u7528","err.imageRead":"\u56FE\u7247\u8BFB\u53D6\u5931\u8D25,\u8BF7\u6362\u4E00\u5F20","err.notImage":"\u8BF7\u9009\u62E9\u56FE\u7247\u6587\u4EF6","err.fileType":"\u53EA\u652F\u6301\u56FE\u7247\u6216\u89C6\u9891\u6587\u4EF6","err.saveDrive":"\u5B58\u7F51\u76D8\u5931\u8D25","msg.processing":"\u6B63\u5728\u5BFC\u51FA\u4E2D\u2026","msg.exportingHint":"\u8BF7\u7A0D\u5019\uFF0C\u5BFC\u51FA\u5B8C\u6210\u540E\u4F1A\u81EA\u52A8\u8FD4\u56DE\u7ED3\u679C\u3002","msg.done":"\u5B8C\u6210 \u2713","msg.loading":"\u7D20\u6750\u52A0\u8F7D\u4E2D\u2026","msg.exported":"\u5DF2\u5BFC\u51FA\uFF1A","msg.saving":"\u5B58\u7F51\u76D8\u4E2D\u2026","msg.saved":"\u5DF2\u5B58\u5230\u7F51\u76D8 \u2713","lbl.ratioSection":"\u753B\u9762\u6BD4\u4F8B(\u88C1\u526A,\u4E0D\u53D8\u5F62)","lbl.dragToReposition":"\u2194 \u62D6\u52A8\u9884\u89C8\u53EF\u8C03\u6574\u88C1\u526A\u4F4D\u7F6E","lbl.sizeSection":"\u5BFC\u51FA\u5C3A\u5BF8(\u50CF\u7D20;\u6BD4\u4F8B\u4E0D\u7B26\u65F6 cover \u5C45\u4E2D\u88C1\u526A)","lbl.currentOut":"\u5F53\u524D\u8F93\u51FA","lbl.zoomSize":"\u5927\u5C0F","lbl.noScale":"(\u672A\u7F29\u653E)","lbl.coverNote":"\xB7 \u6BD4\u4F8B\u4E0D\u4E00\u81F4\u65F6\u5C45\u4E2D\u88C1\u526A(cover),\u4E0D\u53D8\u5F62","lbl.audioTrackHint":"\u266A \u97F3\u9891\u8F68(\u53F3\u4FA7 \uFF0B \u6DFB\u52A0\u97F3\u4E50,\u4E0E\u539F\u58F0\u6DF7\u97F3)","lbl.volume":"\u97F3\u91CF","lbl.volNote":"(\u9884\u89C8\u6700\u5927 100%,\u5BFC\u51FA\u6309\u8BBE\u5B9A\u503C)","lbl.music":"\u97F3\u4E50","kbd.fit":"\u21E7 F","poster.title":"\u9009\u62E9\u5C01\u9762\u5E27","panel.title":"\u5A92\u4F53\u7F16\u8F91\u5668","panel.subtitle":"\u4E0A\u4F20\u56FE\u7247 / \u89C6\u9891\uFF0C\u88C1\u526A \xB7 \u6EE4\u955C \xB7 \u6587\u5B57 \xB7 \u5BFC\u51FA","panel.pick":"\u70B9\u51FB\u9009\u62E9\u56FE\u7247\u6216\u89C6\u9891","panel.pickHint":"\u56FE\u7247\u7528 Filerobot \xB7 \u89C6\u9891\u53EF\u88C1\u526A/\u9759\u97F3/\u5C01\u9762"},h2={"tool.trim":"Trim","tool.crop":"Crop","tool.tune":"Tune","tool.filter":"Filters","tool.annotate":"Annotate","tool.sticker":"Stickers","tool.resize":"Ratio","tune.brightness":"Brightness","tune.contrast":"Contrast","tune.saturation":"Saturation","tune.gamma":"Gamma","overlay.select":"Select","overlay.pen":"Pen","overlay.eraser":"Eraser","overlay.line":"Line","overlay.arrow":"Arrow","overlay.rect":"Rect","overlay.ellipse":"Ellipse","overlay.text":"Text","overlay.color":"Color","overlay.width":"Width","overlay.copySelected":"Copy","overlay.delSelected":"Delete selected","overlay.editSelected":"Edit","overlay.pickImage":"Pick image","overlay.hint":"Tap emoji/image to add \u2192 drag to place, drag the purple corner handle to scale","overlay.textPlaceholder":"Type text, Enter to confirm","filter.none":"Original","filter.bw":"B&W","filter.sepia":"Sepia","filter.warm":"Warm","filter.cool":"Cool","filter.vivid":"Vivid","ratio.orig":"Original","ratio.free":"Free ratio","ratio.9:16":"Portrait 9:16","ratio.16:9":"Landscape 16:9","ratio.1:1":"Square 1:1","ratio.4:5":"Vertical 4:5","act.fit":"Fit","act.zoomFit":"Zoom to fit","act.zoomTo":"Zoom to {value}%","act.split":"Split","act.copy":"Copy","act.delete":"Delete","act.restore":"Reset","act.deleteMusic":"Remove music","act.cancel":"Cancel","act.exportPoster":"Export cover","act.exporting":"Exporting\u2026","act.poster":"\u{1F5BC} Cover","act.again":"Download again","act.saveDrive":"Save to drive","act.changeImage":"\u2190 Change image","act.changeVideo":"\u2190 Change file","crop.rotateLeft":"\u21BA Rotate left","crop.flipX":"\u21CB Flip horizontal","crop.flipY":"\u21F5 Flip vertical","crop.rotateLeftShort":"Rot","crop.flipXShort":"Flip","crop.flipYShort":"Flip","tip.close":"Close (change file)","tip.undo":"Undo","tip.redo":"Redo","tip.resetOpened":"Reset to opened file","tip.previewZoom":"Preview zoom","tip.previewZoomOut":"Zoom out preview","tip.previewZoomIn":"Zoom in preview","tip.previewZoomFit":"Fit preview","tip.previewPointer":"Pointer tool","tip.previewPan":"Hand tool: pan canvas","tip.poster":"Preview and pick a cover frame","tip.keepAudio":"Original audio on/off (mixed with music; preview follows)","tip.split":"Split the current clip at the playhead","tip.zoomOut":"Zoom out timeline (Ctrl+wheel)","tip.zoomIn":"Zoom in timeline (Ctrl+wheel)","tip.fit":"Fit to width","tip.addVideo":"Add video clip","tip.addAudio":"Add music (audio file, or a video with sound to extract its track; mixed with original)","tip.dupClip":"Duplicate clip (insert after)","tip.delClip":"Delete clip","tip.lockAspect":"Lock aspect ratio","tip.dblConfirm":"Double-click to confirm crop","err.notVideo":"Please choose a video file","err.maxVideo":"Up to {max} video sources","err.videoLoad":"Failed to load video, try another file","err.notAudio":"Choose an audio file (mp3/wav/m4a), or a video with sound (audio auto-extracted)","err.maxAudio":"Up to {max} audio sources","err.audioLoad":"Failed to load audio, try another file","err.processFailed":"Processing failed","err.posterFailed":"Failed to render cover","err.canvas":"Canvas unavailable","err.imageRead":"Failed to read image, try another","err.notImage":"Please choose an image file","err.fileType":"Only image or video files are supported","err.saveDrive":"Failed to save to drive","msg.processing":"Exporting\u2026","msg.exportingHint":"Please wait. The result will be returned automatically when export finishes.","msg.done":"Done \u2713","msg.loading":"Loading media\u2026","msg.exported":"Exported: ","msg.saving":"Saving\u2026","msg.saved":"Saved to drive \u2713","lbl.ratioSection":"Frame ratio (crop, no distortion)","lbl.dragToReposition":"\u2194 Drag the preview to reposition the crop","lbl.sizeSection":"Export size (px; cover center-crop when ratios differ)","lbl.currentOut":"Output","lbl.zoomSize":"Size","lbl.noScale":"(no scaling)","lbl.coverNote":"\xB7 center-cropped (cover) when ratios differ, no distortion","lbl.audioTrackHint":"\u266A Audio track (\uFF0B on the right to add music, mixed with original)","lbl.volume":"Volume","lbl.volNote":"(preview caps at 100%, export uses the set value)","lbl.music":"Music","kbd.fit":"\u21E7 F","poster.title":"Pick a cover frame","panel.title":"Media Editor","panel.subtitle":"Upload an image / video \u2014 crop \xB7 filters \xB7 text \xB7 export","panel.pick":"Click to choose an image or video","panel.pickHint":"Images via Filerobot \xB7 videos: trim/mute/cover"},v2={"tool.trim":"Editar","tool.crop":"Recortar","tool.tune":"Ajustar color","tool.filter":"Filtros","tool.annotate":"Anotar","tool.sticker":"Stickers","tool.resize":"Proporci\xF3n","tune.brightness":"Brillo","tune.contrast":"Contraste","tune.saturation":"Saturaci\xF3n","tune.gamma":"Gamma","overlay.select":"Seleccionar","overlay.pen":"Pincel","overlay.eraser":"Borrador","overlay.line":"L\xEDnea","overlay.arrow":"Flecha","overlay.rect":"Rect\xE1ngulo","overlay.ellipse":"Elipse","overlay.text":"Texto","overlay.color":"Color","overlay.width":"Grosor","overlay.copySelected":"Copiar","overlay.delSelected":"Eliminar seleccionado","overlay.editSelected":"Editar","overlay.pickImage":"Elegir imagen","overlay.hint":"Toca un emoji/imagen para a\xF1adirlo \u2192 arrastra para colocarlo, arrastra el tirador morado para escalar","overlay.textPlaceholder":"Escribe texto, Enter para confirmar","filter.none":"Original","filter.bw":"Blanco y negro","filter.sepia":"Sepia","filter.warm":"C\xE1lido","filter.cool":"Fr\xEDo","filter.vivid":"Intenso","ratio.orig":"Original","ratio.free":"Libre","ratio.9:16":"Vertical 9:16","ratio.16:9":"Horizontal 16:9","ratio.1:1":"Cuadrado 1:1","ratio.4:5":"Vertical 4:5","act.fit":"Ajustar","act.zoomFit":"Ajustar a pantalla","act.zoomTo":"Zoom al {value}%","act.split":"Dividir","act.copy":"Copiar","act.delete":"Eliminar","act.restore":"Restablecer","act.deleteMusic":"Quitar m\xFAsica","act.cancel":"Cancelar","act.exportPoster":"Exportar portada","act.exporting":"Exportando\u2026","act.poster":"\u{1F5BC} Portada","act.again":"Descargar de nuevo","act.saveDrive":"Guardar en disco","act.changeImage":"\u2190 Cambiar imagen","act.changeVideo":"\u2190 Cambiar archivo","crop.rotateLeft":"\u21BA Girar a la izquierda","crop.flipX":"\u21CB Voltear horizontal","crop.flipY":"\u21F5 Voltear vertical","crop.rotateLeftShort":"Giro","crop.flipXShort":"Flip","crop.flipYShort":"Flip","tip.close":"Cerrar (cambiar archivo)","tip.undo":"Deshacer","tip.redo":"Rehacer","tip.resetOpened":"Restablecer al archivo abierto","tip.previewZoom":"Zoom de vista previa","tip.previewZoomOut":"Reducir vista previa","tip.previewZoomIn":"Ampliar vista previa","tip.previewZoomFit":"Ajustar vista previa","tip.previewPointer":"Herramienta de puntero","tip.previewPan":"Mano: desplazar lienzo","tip.poster":"Previsualizar y elegir portada","tip.keepAudio":"Activar/desactivar audio original (mezclado con m\xFAsica; la vista previa lo refleja)","tip.split":"Dividir el clip actual en el cursor","tip.zoomOut":"Reducir l\xEDnea de tiempo (Ctrl+rueda)","tip.zoomIn":"Ampliar l\xEDnea de tiempo (Ctrl+rueda)","tip.fit":"Ajustar al ancho","tip.addVideo":"A\xF1adir clip de v\xEDdeo","tip.addAudio":"A\xF1adir m\xFAsica (archivo de audio o v\xEDdeo con sonido para extraer la pista; se mezcla con el original)","tip.dupClip":"Duplicar clip (insertar despu\xE9s)","tip.delClip":"Eliminar clip","tip.lockAspect":"Bloquear proporci\xF3n","tip.dblConfirm":"Doble clic para confirmar recorte","err.notVideo":"Elige un archivo de v\xEDdeo","err.maxVideo":"M\xE1ximo {max} v\xEDdeos","err.videoLoad":"No se pudo cargar el v\xEDdeo, prueba con otro archivo","err.notAudio":"Elige un audio (mp3/wav/m4a) o un v\xEDdeo con sonido (se extrae autom\xE1ticamente)","err.maxAudio":"M\xE1ximo {max} audios","err.audioLoad":"No se pudo cargar el audio, prueba con otro archivo","err.processFailed":"Error de procesamiento","err.posterFailed":"No se pudo renderizar la portada","err.canvas":"Canvas no disponible","err.imageRead":"No se pudo leer la imagen, prueba con otra","err.notImage":"Elige un archivo de imagen","err.fileType":"Solo se admiten archivos de imagen o v\xEDdeo","err.saveDrive":"No se pudo guardar en disco","msg.processing":"Exportando\u2026","msg.exportingHint":"Espera un momento. El resultado se devolver\xE1 autom\xE1ticamente al finalizar.","msg.done":"Listo \u2713","msg.loading":"Cargando medios\u2026","msg.exported":"Exportado: ","msg.saving":"Guardando\u2026","msg.saved":"Guardado en disco \u2713","lbl.ratioSection":"Proporci\xF3n de imagen (recorte, sin deformar)","lbl.dragToReposition":"\u2194 Arrastra la vista previa para reposicionar el recorte","lbl.sizeSection":"Tama\xF1o de exportaci\xF3n (px; recorte cover centrado si la proporci\xF3n difiere)","lbl.currentOut":"Salida","lbl.zoomSize":"Tama\xF1o","lbl.noScale":"(sin escala)","lbl.coverNote":"\xB7 recorte centrado (cover) cuando la proporci\xF3n difiere, sin deformar","lbl.audioTrackHint":"\u266A Pista de audio (\uFF0B a la derecha para a\xF1adir m\xFAsica, mezclada con el original)","lbl.volume":"Volumen","lbl.volNote":"(la vista previa limita a 100%, la exportaci\xF3n usa el valor definido)","lbl.music":"M\xFAsica","kbd.fit":"\u21E7 F","poster.title":"Elegir portada","panel.title":"Editor multimedia","panel.subtitle":"Sube una imagen / v\xEDdeo \u2014 recorta \xB7 filtros \xB7 texto \xB7 exporta","panel.pick":"Haz clic para elegir una imagen o v\xEDdeo","panel.pickHint":"Im\xE1genes con Filerobot \xB7 v\xEDdeos: cortar/silenciar/portada"},g2={\u7B80:"\u7C21",\u4F53:"\u9AD4",\u56FE:"\u5716",\u9891:"\u983B",\u89C6:"\u8996",\u8F91:"\u8F2F",\u8C03:"\u8ABF",\u6EE4:"\u6FFE",\u6807:"\u6A19",\u6CE8:"\u8A3B",\u8D34:"\u8CBC",\u9009:"\u9078",\u62E9:"\u64C7",\u7EBF:"\u7DDA",\u7BAD:"\u7BAD",\u5934:"\u982D",\u590D:"\u8907",\u5220:"\u522A",\u9664:"\u9664",\u7F16:"\u7DE8",\u8FB9:"\u908A",\u8F93:"\u8F38",\u5165:"\u5165",\u786E:"\u78BA",\u8BA4:"\u8A8D",\u9971:"\u98FD",\u5BF9:"\u5C0D",\u6696:"\u6696",\u9633:"\u967D",\u51B7:"\u51B7",\u7EB5:"\u7E31",\u6A2A:"\u6A6B",\u9002:"\u9069",\u5E94:"\u61C9",\u7F29:"\u7E2E",\u5B9E:"\u5BE6",\u9645:"\u969B",\u5BFC:"\u5C0E",\u51FA:"\u51FA",\u5C01:"\u5C01",\u9762:"\u9762",\u6362:"\u63DB",\u5F20:"\u5F35",\u9884:"\u9810",\u89C8:"\u89BD",\u52A8:"\u52D5",\u58F0:"\u8072",\u5F00:"\u958B",\u5173:"\u95DC",\u4E0E:"\u8207",\u4E50:"\u6A02",\u6DF7:"\u6DF7",\u5904:"\u8655",\u8F7D:"\u8F09",\u9519:"\u932F",\u8BEF:"\u8AA4",\u8BFB:"\u8B80",\u4EC5:"\u50C5",\u7EC8:"\u7D42",\u7A0D:"\u7A0D",\u5019:"\u5019",\u8FD4\u56DE:"\u8FD4\u56DE",\u5F53\u524D:"\u76EE\u524D",\u8F93\u51FA:"\u8F38\u51FA",\u753B:"\u756B",\u53D8:"\u8B8A",\u97F3\u9891:"\u97F3\u8A0A",\u97F3\u8F68:"\u97F3\u8ECC",\u6DFB\u52A0:"\u65B0\u589E",\u5220\u9664:"\u522A\u9664",\u4FDD\u5B58:"\u5132\u5B58",\u52A0\u8F7D:"\u8F09\u5165",\u7F51\u76D8:"\u7DB2\u76E4"},b2=n=>{let a=n;for(const[o,l]of Object.entries(g2).sort((s,d)=>d[0].length-s[0].length))a=a.replaceAll(o,l);return a},y2=Object.fromEntries(Object.entries(rg).map(([n,a])=>[n,b2(a)])),ag={zh:rg,en:h2,es:v2,"zh-Hant":y2};function x2(n,a,o){let l=ag[n]?.[a]??ag.zh[a]??a;if(o)for(const[s,d]of Object.entries(o))l=l.replaceAll(`{${s}}`,String(d));return l}var Km=[{platform:"tiktok",postType:"video",label:"TikTok Video",shortLabel:"TT\xB7Video",ratio:"9:16",imageSize:"1440x2560",videoRatio:"9:16",videoResolution:"720p"},{platform:"instagram",postType:"post",label:"Instagram Post",shortLabel:"IG\xB7Post",ratio:"1:1",imageSize:"2048x2048"},{platform:"instagram",postType:"reels",label:"Instagram Reels",shortLabel:"IG\xB7Reels",ratio:"9:16",imageSize:"1440x2560",videoRatio:"9:16",videoResolution:"720p"},{platform:"instagram",postType:"story",label:"Instagram Story",shortLabel:"IG\xB7Story",ratio:"9:16",imageSize:"1440x2560",videoRatio:"9:16",videoResolution:"720p"},{platform:"facebook",postType:"post",label:"Facebook Post",shortLabel:"FB\xB7Post",ratio:"1:1",imageSize:"2048x2048"},{platform:"facebook",postType:"reels",label:"Facebook Reels",shortLabel:"FB\xB7Reels",ratio:"9:16",imageSize:"1440x2560",videoRatio:"9:16",videoResolution:"720p"},{platform:"youtube",postType:"video",label:"YouTube Video",shortLabel:"YT\xB7Video",ratio:"16:9",imageSize:"2560x1440",videoRatio:"16:9",videoResolution:"1080p"},{platform:"youtube",postType:"shorts",label:"YouTube Shorts",shortLabel:"YT\xB7Shorts",ratio:"9:16",imageSize:"1440x2560",videoRatio:"9:16",videoResolution:"720p"},{platform:"pinterest",postType:"pin",label:"Pinterest Pin",shortLabel:"PIN",ratio:"2:3",imageSize:"1664x2496",videoRatio:"9:16",videoResolution:"720p"},{platform:"x",postType:"post",label:"X Post",shortLabel:"X\xB7Post",ratio:"16:9",imageSize:"2560x1440",videoRatio:"16:9",videoResolution:"720p"},{platform:"linkedin",postType:"post",label:"LinkedIn Post",shortLabel:"LI\xB7Post",ratio:"1:1",imageSize:"2048x2048"},{platform:"linkedin",postType:"video",label:"LinkedIn Video",shortLabel:"LI\xB7Video",ratio:"16:9",imageSize:"2560x1440",videoRatio:"16:9",videoResolution:"1080p"},{platform:"threads",postType:"post",label:"Threads Post",shortLabel:"TH\xB7Post",ratio:"1:1",imageSize:"2048x2048"},{platform:"telegram",postType:"post",label:"Telegram Post",shortLabel:"TG\xB7Post",ratio:"1:1",imageSize:"2048x2048",videoRatio:"9:16",videoResolution:"720p"},{platform:"reddit",postType:"post",label:"Reddit Post",shortLabel:"RD\xB7Post",ratio:"16:9",imageSize:"2560x1440",videoRatio:"16:9",videoResolution:"720p"}],w2={"1:1":"\u65B9\u5F62 1:1","4:5":"\u7AD6\u56FE 4:5","3:4":"\u7AD6\u56FE 3:4","9:16":"\u7AD6\u5C4F 9:16","16:9":"\u6A2A\u5C4F 16:9","2:3":"\u7AD6\u56FE 2:3","1.91:1":"\u6A2A\u5E45 1.91:1"};function ic(n){const[a,o]=n.split(":").map(Number);return!a||!o?1:a/o}function ig(n){const a=new Set,o=[];for(const l of n)!l||a.has(l)||(a.add(l),o.push({ratio:l,value:ic(l),label:w2[l]??l}));return o}var vE=ig(["1:1","4:5","3:4","2:3","9:16","16:9","1.91:1"]),Gm=ig(["9:16","16:9","1:1","4:5"]);function E2(n=Km){const a=new Set,o=[];for(const l of n){if(!l.videoRatio)continue;const s=`${l.platform}:${l.postType}:${l.videoRatio}`;if(a.has(s))continue;a.add(s);const d=l.label.split(" ").slice(0,-1).join(" ")||l.label;o.push({platform:l.platform,postType:l.postType,label:`${d} ${l.videoRatio}`,ratio:l.videoRatio,value:ic(l.videoRatio)})}return o}var gE=E2();function k2(n=Km){const a=new Map;for(const o of n){const l=a.get(o.platform);(!l||l.postType!=="post"&&o.postType==="post")&&a.set(o.platform,o)}return Array.from(a.values()).map(o=>{const[l,s]=o.imageSize.split("x").map(Number),d=o.label.split(" ").slice(0,-1).join(" ")||o.label;return{platform:o.platform,label:`${d} ${o.ratio}`,ratio:o.ratio,value:ic(o.ratio),w:l,h:s}})}var bE=k2();function C2(n,a){return n>=1?{w:Math.round(a*n/2)*2,h:a}:{w:a,h:Math.round(a/n/2)*2}}function S2(n=Km){const a=new Set,o=[];for(const l of n){if(!l.videoRatio||!l.videoResolution)continue;const s=l.videoResolution==="1080p"?1080:720,{w:d,h:m}=C2(ic(l.videoRatio),s),h=`${d}x${m}`;a.has(h)||(a.add(h),o.push({label:`${l.shortLabel} ${d}\xD7${m}`,w:d,h:m}))}return o}var yE=S2(),F2=La(n=>{var a=Symbol.for("react.transitional.element"),o=Symbol.for("react.portal"),l=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),d=Symbol.for("react.profiler"),m=Symbol.for("react.consumer"),h=Symbol.for("react.context"),g=Symbol.for("react.forward_ref"),v=Symbol.for("react.suspense"),w=Symbol.for("react.memo"),W=Symbol.for("react.lazy"),S=Symbol.for("react.activity"),J=Symbol.iterator;function Y(x){return x===null||typeof x!="object"?null:(x=J&&x[J]||x["@@iterator"],typeof x=="function"?x:null)}var ue={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},oe=Object.assign,ge={};function Be(x,C,j){this.props=x,this.context=C,this.refs=ge,this.updater=j||ue}Be.prototype.isReactComponent={},Be.prototype.setState=function(x,C){if(typeof x!="object"&&typeof x!="function"&&x!=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,x,C,"setState")},Be.prototype.forceUpdate=function(x){this.updater.enqueueForceUpdate(this,x,"forceUpdate")};function Te(){}Te.prototype=Be.prototype;function de(x,C,j){this.props=x,this.context=C,this.refs=ge,this.updater=j||ue}var Ae=de.prototype=new Te;Ae.constructor=de,oe(Ae,Be.prototype),Ae.isPureReactComponent=!0;var ve=Array.isArray;function P(){}var k={H:null,A:null,T:null,S:null},H=Object.prototype.hasOwnProperty;function T(x,C,j){var B=j.ref;return{$$typeof:a,type:x,key:C,ref:B!==void 0?B:null,props:j}}function _(x,C){return T(x.type,C,x.props)}function le(x){return typeof x=="object"&&x!==null&&x.$$typeof===a}function se(x){var C={"=":"=0",":":"=2"};return"$"+x.replace(/[=:]/g,function(j){return C[j]})}var me=/\/+/g;function O(x,C){return typeof x=="object"&&x!==null&&x.key!=null?se(""+x.key):C.toString(36)}function $(x){switch(x.status){case"fulfilled":return x.value;case"rejected":throw x.reason;default:switch(typeof x.status=="string"?x.then(P,P):(x.status="pending",x.then(function(C){x.status==="pending"&&(x.status="fulfilled",x.value=C)},function(C){x.status==="pending"&&(x.status="rejected",x.reason=C)})),x.status){case"fulfilled":return x.value;case"rejected":throw x.reason}}throw x}function M(x,C,j,B,G){var De=typeof x;(De==="undefined"||De==="boolean")&&(x=null);var Q=!1;if(x===null)Q=!0;else switch(De){case"bigint":case"string":case"number":Q=!0;break;case"object":switch(x.$$typeof){case a:case o:Q=!0;break;case W:return Q=x._init,M(Q(x._payload),C,j,B,G)}}if(Q)return G=G(x),Q=B===""?"."+O(x,0):B,ve(G)?(j="",Q!=null&&(j=Q.replace(me,"$&/")+"/"),M(G,C,j,"",function(xe){return xe})):G!=null&&(le(G)&&(G=_(G,j+(G.key==null||x&&x.key===G.key?"":(""+G.key).replace(me,"$&/")+"/")+Q)),C.push(G)),1;Q=0;var te=B===""?".":B+":";if(ve(x))for(var U=0;U<x.length;U++)B=x[U],De=te+O(B,U),Q+=M(B,C,j,De,G);else if(U=Y(x),typeof U=="function")for(x=U.call(x),U=0;!(B=x.next()).done;)B=B.value,De=te+O(B,U++),Q+=M(B,C,j,De,G);else if(De==="object"){if(typeof x.then=="function")return M($(x),C,j,B,G);throw C=String(x),Error("Objects are not valid as a React child (found: "+(C==="[object Object]"?"object with keys {"+Object.keys(x).join(", ")+"}":C)+"). If you meant to render a collection of children, use an array instead.")}return Q}function A(x,C,j){if(x==null)return x;var B=[],G=0;return M(x,B,"","",function(De){return C.call(j,De,G++)}),B}function ee(x){if(x._status===-1){var C=x._result;C=C(),C.then(function(j){(x._status===0||x._status===-1)&&(x._status=1,x._result=j)},function(j){(x._status===0||x._status===-1)&&(x._status=2,x._result=j)}),x._status===-1&&(x._status=0,x._result=C)}if(x._status===1)return x._result.default;throw x._result}var Me=typeof reportError=="function"?reportError:function(x){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var C=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof x=="object"&&x!==null&&typeof x.message=="string"?String(x.message):String(x),error:x});if(!window.dispatchEvent(C))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",x);return}console.error(x)},_e={map:A,forEach:function(x,C,j){A(x,function(){C.apply(this,arguments)},j)},count:function(x){var C=0;return A(x,function(){C++}),C},toArray:function(x){return A(x,function(C){return C})||[]},only:function(x){if(!le(x))throw Error("React.Children.only expected to receive a single React element child.");return x}};n.Activity=S,n.Children=_e,n.Component=Be,n.Fragment=l,n.Profiler=d,n.PureComponent=de,n.StrictMode=s,n.Suspense=v,n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=k,n.__COMPILER_RUNTIME={__proto__:null,c:function(x){return k.H.useMemoCache(x)}},n.cache=function(x){return function(){return x.apply(null,arguments)}},n.cacheSignal=function(){return null},n.cloneElement=function(x,C,j){if(x==null)throw Error("The argument must be a React element, but you passed "+x+".");var B=oe({},x.props),G=x.key;if(C!=null)for(De in C.key!==void 0&&(G=""+C.key),C)!H.call(C,De)||De==="key"||De==="__self"||De==="__source"||De==="ref"&&C.ref===void 0||(B[De]=C[De]);var De=arguments.length-2;if(De===1)B.children=j;else if(1<De){for(var Q=Array(De),te=0;te<De;te++)Q[te]=arguments[te+2];B.children=Q}return T(x.type,G,B)},n.createContext=function(x){return x={$$typeof:h,_currentValue:x,_currentValue2:x,_threadCount:0,Provider:null,Consumer:null},x.Provider=x,x.Consumer={$$typeof:m,_context:x},x},n.createElement=function(x,C,j){var B,G={},De=null;if(C!=null)for(B in C.key!==void 0&&(De=""+C.key),C)H.call(C,B)&&B!=="key"&&B!=="__self"&&B!=="__source"&&(G[B]=C[B]);var Q=arguments.length-2;if(Q===1)G.children=j;else if(1<Q){for(var te=Array(Q),U=0;U<Q;U++)te[U]=arguments[U+2];G.children=te}if(x&&x.defaultProps)for(B in Q=x.defaultProps,Q)G[B]===void 0&&(G[B]=Q[B]);return T(x,De,G)},n.createRef=function(){return{current:null}},n.forwardRef=function(x){return{$$typeof:g,render:x}},n.isValidElement=le,n.lazy=function(x){return{$$typeof:W,_payload:{_status:-1,_result:x},_init:ee}},n.memo=function(x,C){return{$$typeof:w,type:x,compare:C===void 0?null:C}},n.startTransition=function(x){var C=k.T,j={};k.T=j;try{var B=x(),G=k.S;G!==null&&G(j,B),typeof B=="object"&&B!==null&&typeof B.then=="function"&&B.then(P,Me)}catch(De){Me(De)}finally{C!==null&&j.types!==null&&(C.types=j.types),k.T=C}},n.unstable_useCacheRefresh=function(){return k.H.useCacheRefresh()},n.use=function(x){return k.H.use(x)},n.useActionState=function(x,C,j){return k.H.useActionState(x,C,j)},n.useCallback=function(x,C){return k.H.useCallback(x,C)},n.useContext=function(x){return k.H.useContext(x)},n.useDebugValue=function(){},n.useDeferredValue=function(x,C){return k.H.useDeferredValue(x,C)},n.useEffect=function(x,C){return k.H.useEffect(x,C)},n.useEffectEvent=function(x){return k.H.useEffectEvent(x)},n.useId=function(){return k.H.useId()},n.useImperativeHandle=function(x,C,j){return k.H.useImperativeHandle(x,C,j)},n.useInsertionEffect=function(x,C){return k.H.useInsertionEffect(x,C)},n.useLayoutEffect=function(x,C){return k.H.useLayoutEffect(x,C)},n.useMemo=function(x,C){return k.H.useMemo(x,C)},n.useOptimistic=function(x,C){return k.H.useOptimistic(x,C)},n.useReducer=function(x,C,j){return k.H.useReducer(x,C,j)},n.useRef=function(x){return k.H.useRef(x)},n.useState=function(x){return k.H.useState(x)},n.useSyncExternalStore=function(x,C,j){return k.H.useSyncExternalStore(x,C,j)},n.useTransition=function(){return k.H.useTransition()},n.version="19.2.7"}),Ta=La((n,a)=>{a.exports=F2()}),M2=La(n=>{function a($,M){var A=$.length;$.push(M);e:for(;0<A;){var ee=A-1>>>1,Me=$[ee];if(0<s(Me,M))$[ee]=M,$[A]=Me,A=ee;else break e}}function o($){return $.length===0?null:$[0]}function l($){if($.length===0)return null;var M=$[0],A=$.pop();if(A!==M){$[0]=A;e:for(var ee=0,Me=$.length,_e=Me>>>1;ee<_e;){var x=2*(ee+1)-1,C=$[x],j=x+1,B=$[j];if(0>s(C,A))j<Me&&0>s(B,C)?($[ee]=B,$[j]=A,ee=j):($[ee]=C,$[x]=A,ee=x);else if(j<Me&&0>s(B,A))$[ee]=B,$[j]=A,ee=j;else break e}}return M}function s($,M){var A=$.sortIndex-M.sortIndex;return A!==0?A:$.id-M.id}n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"?(d=performance,n.unstable_now=function(){return d.now()}):(m=Date,h=m.now(),n.unstable_now=function(){return m.now()-h});var d,m,h,g=[],v=[],w=1,W=null,S=3,J=!1,Y=!1,ue=!1,oe=!1,ge=typeof setTimeout=="function"?setTimeout:null,Be=typeof clearTimeout=="function"?clearTimeout:null,Te=typeof setImmediate<"u"?setImmediate:null;function de($){for(var M=o(v);M!==null;){if(M.callback===null)l(v);else if(M.startTime<=$)l(v),M.sortIndex=M.expirationTime,a(g,M);else break;M=o(v)}}function Ae($){if(ue=!1,de($),!Y)if(o(g)!==null)Y=!0,ve||(ve=!0,le());else{var M=o(v);M!==null&&O(Ae,M.startTime-$)}}var ve=!1,P=-1,k=5,H=-1;function T(){return oe?!0:!(n.unstable_now()-H<k)}function _(){if(oe=!1,ve){var $=n.unstable_now();H=$;var M=!0;try{e:{Y=!1,ue&&(ue=!1,Be(P),P=-1),J=!0;var A=S;try{t:{for(de($),W=o(g);W!==null&&!(W.expirationTime>$&&T());){var ee=W.callback;if(typeof ee=="function"){W.callback=null,S=W.priorityLevel;var Me=ee(W.expirationTime<=$);if($=n.unstable_now(),typeof Me=="function"){W.callback=Me,de($),M=!0;break t}W===o(g)&&l(g),de($)}else l(g);W=o(g)}if(W!==null)M=!0;else{var _e=o(v);_e!==null&&O(Ae,_e.startTime-$),M=!1}}break e}finally{W=null,S=A,J=!1}M=void 0}}finally{M?le():ve=!1}}}var le;typeof Te=="function"?le=function(){Te(_)}:typeof MessageChannel<"u"?(se=new MessageChannel,me=se.port2,se.port1.onmessage=_,le=function(){me.postMessage(null)}):le=function(){ge(_,0)};var se,me;function O($,M){P=ge(function(){$(n.unstable_now())},M)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function($){$.callback=null},n.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):k=0<$?Math.floor(1e3/$):5},n.unstable_getCurrentPriorityLevel=function(){return S},n.unstable_next=function($){switch(S){case 1:case 2:case 3:var M=3;break;default:M=S}var A=S;S=M;try{return $()}finally{S=A}},n.unstable_requestPaint=function(){oe=!0},n.unstable_runWithPriority=function($,M){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var A=S;S=$;try{return M()}finally{S=A}},n.unstable_scheduleCallback=function($,M,A){var ee=n.unstable_now();switch(typeof A=="object"&&A!==null?(A=A.delay,A=typeof A=="number"&&0<A?ee+A:ee):A=ee,$){case 1:var Me=-1;break;case 2:Me=250;break;case 5:Me=1073741823;break;case 4:Me=1e4;break;default:Me=5e3}return Me=A+Me,$={id:w++,callback:M,priorityLevel:$,startTime:A,expirationTime:Me,sortIndex:-1},A>ee?($.sortIndex=A,a(v,$),o(g)===null&&$===o(v)&&(ue?(Be(P),P=-1):ue=!0,O(Ae,A-ee))):($.sortIndex=Me,a(g,$),Y||J||(Y=!0,ve||(ve=!0,le()))),$},n.unstable_shouldYield=T,n.unstable_wrapCallback=function($){var M=S;return function(){var A=S;S=M;try{return $.apply(this,arguments)}finally{S=A}}}}),L2=La((n,a)=>{a.exports=M2()}),A2=La(n=>{var a=Ta();function o(v){var w="https://react.dev/errors/"+v;if(1<arguments.length){w+="?args[]="+encodeURIComponent(arguments[1]);for(var W=2;W<arguments.length;W++)w+="&args[]="+encodeURIComponent(arguments[W])}return"Minified React error #"+v+"; visit "+w+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(){}var s={d:{f:l,r:function(){throw Error(o(522))},D:l,C:l,L:l,m:l,X:l,S:l,M:l},p:0,findDOMNode:null},d=Symbol.for("react.portal");function m(v,w,W){var S=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:d,key:S==null?null:""+S,children:v,containerInfo:w,implementation:W}}var h=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function g(v,w){if(v==="font")return"";if(typeof w=="string")return w==="use-credentials"?w:""}n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,n.createPortal=function(v,w){var W=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!w||w.nodeType!==1&&w.nodeType!==9&&w.nodeType!==11)throw Error(o(299));return m(v,w,null,W)},n.flushSync=function(v){var w=h.T,W=s.p;try{if(h.T=null,s.p=2,v)return v()}finally{h.T=w,s.p=W,s.d.f()}},n.preconnect=function(v,w){typeof v=="string"&&(w?(w=w.crossOrigin,w=typeof w=="string"?w==="use-credentials"?w:"":void 0):w=null,s.d.C(v,w))},n.prefetchDNS=function(v){typeof v=="string"&&s.d.D(v)},n.preinit=function(v,w){if(typeof v=="string"&&w&&typeof w.as=="string"){var W=w.as,S=g(W,w.crossOrigin),J=typeof w.integrity=="string"?w.integrity:void 0,Y=typeof w.fetchPriority=="string"?w.fetchPriority:void 0;W==="style"?s.d.S(v,typeof w.precedence=="string"?w.precedence:void 0,{crossOrigin:S,integrity:J,fetchPriority:Y}):W==="script"&&s.d.X(v,{crossOrigin:S,integrity:J,fetchPriority:Y,nonce:typeof w.nonce=="string"?w.nonce:void 0})}},n.preinitModule=function(v,w){if(typeof v=="string")if(typeof w=="object"&&w!==null){if(w.as==null||w.as==="script"){var W=g(w.as,w.crossOrigin);s.d.M(v,{crossOrigin:W,integrity:typeof w.integrity=="string"?w.integrity:void 0,nonce:typeof w.nonce=="string"?w.nonce:void 0})}}else w==null&&s.d.M(v)},n.preload=function(v,w){if(typeof v=="string"&&typeof w=="object"&&w!==null&&typeof w.as=="string"){var W=w.as,S=g(W,w.crossOrigin);s.d.L(v,W,{crossOrigin:S,integrity:typeof w.integrity=="string"?w.integrity:void 0,nonce:typeof w.nonce=="string"?w.nonce:void 0,type:typeof w.type=="string"?w.type:void 0,fetchPriority:typeof w.fetchPriority=="string"?w.fetchPriority:void 0,referrerPolicy:typeof w.referrerPolicy=="string"?w.referrerPolicy:void 0,imageSrcSet:typeof w.imageSrcSet=="string"?w.imageSrcSet:void 0,imageSizes:typeof w.imageSizes=="string"?w.imageSizes:void 0,media:typeof w.media=="string"?w.media:void 0})}},n.preloadModule=function(v,w){if(typeof v=="string")if(w){var W=g(w.as,w.crossOrigin);s.d.m(v,{as:typeof w.as=="string"&&w.as!=="script"?w.as:void 0,crossOrigin:W,integrity:typeof w.integrity=="string"?w.integrity:void 0})}else s.d.m(v)},n.requestFormReset=function(v){s.d.r(v)},n.unstable_batchedUpdates=function(v,w){return v(w)},n.useFormState=function(v,w,W){return h.H.useFormState(v,w,W)},n.useFormStatus=function(){return h.H.useHostTransitionStatus()},n.version="19.2.7"}),N2=La((n,a)=>{function o(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(o)}catch(l){console.error(l)}}o(),a.exports=A2()}),_2=La(n=>{var a=L2(),o=Ta(),l=N2();function s(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var r=2;r<arguments.length;r++)t+="&args[]="+encodeURIComponent(arguments[r])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function d(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function m(e){var t=e,r=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(r=t.return),e=t.return;while(e)}return t.tag===3?r:null}function h(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function g(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function v(e){if(m(e)!==e)throw Error(s(188))}function w(e){var t=e.alternate;if(!t){if(t=m(e),t===null)throw Error(s(188));return t!==e?null:e}for(var r=e,i=t;;){var u=r.return;if(u===null)break;var c=u.alternate;if(c===null){if(i=u.return,i!==null){r=i;continue}break}if(u.child===c.child){for(c=u.child;c;){if(c===r)return v(u),e;if(c===i)return v(u),t;c=c.sibling}throw Error(s(188))}if(r.return!==i.return)r=u,i=c;else{for(var f=!1,y=u.child;y;){if(y===r){f=!0,r=u,i=c;break}if(y===i){f=!0,i=u,r=c;break}y=y.sibling}if(!f){for(y=c.child;y;){if(y===r){f=!0,r=c,i=u;break}if(y===i){f=!0,i=c,r=u;break}y=y.sibling}if(!f)throw Error(s(189))}}if(r.alternate!==i)throw Error(s(190))}if(r.tag!==3)throw Error(s(188));return r.stateNode.current===r?e:t}function W(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=W(e),t!==null)return t;e=e.sibling}return null}var S=Object.assign,J=Symbol.for("react.element"),Y=Symbol.for("react.transitional.element"),ue=Symbol.for("react.portal"),oe=Symbol.for("react.fragment"),ge=Symbol.for("react.strict_mode"),Be=Symbol.for("react.profiler"),Te=Symbol.for("react.consumer"),de=Symbol.for("react.context"),Ae=Symbol.for("react.forward_ref"),ve=Symbol.for("react.suspense"),P=Symbol.for("react.suspense_list"),k=Symbol.for("react.memo"),H=Symbol.for("react.lazy"),T=Symbol.for("react.activity"),_=Symbol.for("react.memo_cache_sentinel"),le=Symbol.iterator;function se(e){return e===null||typeof e!="object"?null:(e=le&&e[le]||e["@@iterator"],typeof e=="function"?e:null)}var me=Symbol.for("react.client.reference");function O(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===me?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case oe:return"Fragment";case Be:return"Profiler";case ge:return"StrictMode";case ve:return"Suspense";case P:return"SuspenseList";case T:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case ue:return"Portal";case de:return e.displayName||"Context";case Te:return(e._context.displayName||"Context")+".Consumer";case Ae:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case k:return t=e.displayName||null,t!==null?t:O(e.type)||"Memo";case H:t=e._payload,e=e._init;try{return O(e(t))}catch{}}return null}var $=Array.isArray,M=o.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,A=l.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ee={pending:!1,data:null,method:null,action:null},Me=[],_e=-1;function x(e){return{current:e}}function C(e){0>_e||(e.current=Me[_e],Me[_e]=null,_e--)}function j(e,t){_e++,Me[_e]=e.current,e.current=t}var B=x(null),G=x(null),De=x(null),Q=x(null);function te(e,t){switch(j(De,t),j(G,e),j(B,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Bv(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Bv(t),e=Dv(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}C(B),j(B,e)}function U(){C(B),C(G),C(De)}function xe(e){e.memoizedState!==null&&j(Q,e);var t=B.current,r=Dv(t,e.type);t!==r&&(j(G,e),j(B,r))}function Ce(e){G.current===e&&(C(B),C(G)),Q.current===e&&(C(Q),Xl._currentValue=ee)}var Ze,et;function lt(e){if(Ze===void 0)try{throw Error()}catch(r){var t=r.stack.trim().match(/\n( *(at )?)/);Ze=t&&t[1]||"",et=-1<r.stack.indexOf(`
|
|
4
4
|
at`)?" (<anonymous>)":-1<r.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
5
|
-
`+
|
|
5
|
+
`+Ze+e+et}var ot=!1;function gt(e,t){if(!e||ot)return"";ot=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var i={DetermineComponentFrameRoot:function(){try{if(t){var Ie=function(){throw Error()};if(Object.defineProperty(Ie.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ie,[])}catch(Se){var ye=Se}Reflect.construct(e,[],Ie)}else{try{Ie.call()}catch(Se){ye=Se}e.call(Ie.prototype)}}else{try{throw Error()}catch(Se){ye=Se}(Ie=e())&&typeof Ie.catch=="function"&&Ie.catch(function(){})}}catch(Se){if(Se&&ye&&typeof Se.stack=="string")return[Se.stack,ye.stack]}return[null,null]}};i.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var u=Object.getOwnPropertyDescriptor(i.DetermineComponentFrameRoot,"name");u&&u.configurable&&Object.defineProperty(i.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var c=i.DetermineComponentFrameRoot(),f=c[0],y=c[1];if(f&&y){var R=f.split(`
|
|
6
6
|
`),he=y.split(`
|
|
7
|
-
`);for(u=i=0;i<R.length&&!R[i].includes("DetermineComponentFrameRoot");)i++;for(;u<he.length&&!he[u].includes("DetermineComponentFrameRoot");)u++;if(i===R.length||u===he.length)for(i=R.length-1,u=he.length-1;1<=i&&0<=u&&R[i]!==he[u];)u--;for(;1<=i&&0<=u;i--,u--)if(R[i]!==he[u]){if(i!==1||u!==1)do if(i--,u--,0>u||R[i]!==he[u]){var
|
|
8
|
-
`+R[i].replace(" at new "," at ");return e.displayName&&
|
|
7
|
+
`);for(u=i=0;i<R.length&&!R[i].includes("DetermineComponentFrameRoot");)i++;for(;u<he.length&&!he[u].includes("DetermineComponentFrameRoot");)u++;if(i===R.length||u===he.length)for(i=R.length-1,u=he.length-1;1<=i&&0<=u&&R[i]!==he[u];)u--;for(;1<=i&&0<=u;i--,u--)if(R[i]!==he[u]){if(i!==1||u!==1)do if(i--,u--,0>u||R[i]!==he[u]){var ze=`
|
|
8
|
+
`+R[i].replace(" at new "," at ");return e.displayName&&ze.includes("<anonymous>")&&(ze=ze.replace("<anonymous>",e.displayName)),ze}while(1<=i&&0<=u);break}}}finally{ot=!1,Error.prepareStackTrace=r}return(r=e?e.displayName||e.name:"")?lt(r):""}function Qt(e,t){switch(e.tag){case 26:case 27:case 5:return lt(e.type);case 16:return lt("Lazy");case 13:return e.child!==t&&t!==null?lt("Suspense Fallback"):lt("Suspense");case 19:return lt("SuspenseList");case 0:case 15:return gt(e.type,!1);case 11:return gt(e.type.render,!1);case 1:return gt(e.type,!0);case 31:return lt("Activity");default:return""}}function _t(e){try{var t="",r=null;do t+=Qt(e,r),r=e,e=e.return;while(e);return t}catch(i){return`
|
|
9
9
|
Error generating stack: `+i.message+`
|
|
10
|
-
`+i.stack}}var xt=Object.prototype.hasOwnProperty,Yt=a.unstable_scheduleCallback,tn=a.unstable_cancelCallback,_n=a.unstable_shouldYield,st=a.unstable_requestPaint,Ge=a.unstable_now,mt=a.unstable_getCurrentPriorityLevel,Rt=a.unstable_ImmediatePriority,Vt=a.unstable_UserBlockingPriority,kn=a.unstable_NormalPriority,xn=a.unstable_LowPriority,je=a.unstable_IdlePriority,dt=a.log,yt=a.unstable_setDisableYieldValue,pt=null,Mt=null;function dn(e){if(typeof dt=="function"&&yt(e),Mt&&typeof Mt.setStrictMode=="function")try{Mt.setStrictMode(pt,e)}catch{}}var Ut=Math.clz32?Math.clz32:Le,An=Math.log,K=Math.LN2;function Le(e){return e>>>=0,e===0?32:31-(An(e)/K|0)|0}var Ze=256,Tt=262144,rn=4194304;function Pt(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function nn(e,t,r){var i=e.pendingLanes;if(i===0)return 0;var u=0,c=e.suspendedLanes,f=e.pingedLanes;e=e.warmLanes;var y=i&134217727;return y!==0?(i=y&~c,i!==0?u=Pt(i):(f&=y,f!==0?u=Pt(f):r||(r=y&~e,r!==0&&(u=Pt(r))))):(y=i&~c,y!==0?u=Pt(y):f!==0?u=Pt(f):r||(r=i&~e,r!==0&&(u=Pt(r)))),u===0?0:t!==0&&t!==u&&(t&c)===0&&(c=u&-u,r=t&-t,c>=r||c===32&&(r&4194048)!==0)?t:u}function wn(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Y(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function fe(){var e=rn;return rn<<=1,(rn&62914560)===0&&(rn=4194304),e}function Ne(e){for(var t=[],r=0;31>r;r++)t.push(e);return t}function Qe(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Et(e,t,r,i,u,c){var f=e.pendingLanes;e.pendingLanes=r,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=r,e.entangledLanes&=r,e.errorRecoveryDisabledLanes&=r,e.shellSuspendCounter=0;var y=e.entanglements,R=e.expirationTimes,he=e.hiddenUpdates;for(r=f&~r;0<r;){var De=31-Ut(r),Ie=1<<De;y[De]=0,R[De]=-1;var ye=he[De];if(ye!==null)for(he[De]=null,De=0;De<ye.length;De++){var Se=ye[De];Se!==null&&(Se.lane&=-536870913)}r&=~Ie}i!==0&&z(e,i,0),c!==0&&u===0&&e.tag!==0&&(e.suspendedLanes|=c&~(f&~t))}function z(e,t,r){e.pendingLanes|=t,e.suspendedLanes&=~t;var i=31-Ut(t);e.entangledLanes|=t,e.entanglements[i]=e.entanglements[i]|1073741824|r&261930}function V(e,t){var r=e.entangledLanes|=t;for(e=e.entanglements;r;){var i=31-Ut(r),u=1<<i;u&t|e[i]&t&&(e[i]|=t),r&=~u}}function Fe(e,t){var r=t&-t;return r=(r&42)!==0?1:He(r),(r&(e.suspendedLanes|t))!==0?0:r}function He(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Xe(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function ct(){var e=A.p;return e!==0?e:(e=window.event,e===void 0?32:r0(e.type))}function kt(e,t){var r=A.p;try{return A.p=e,t()}finally{A.p=r}}var rt=Math.random().toString(36).slice(2),at="__reactFiber$"+rt,Ke="__reactProps$"+rt,Nt="__reactContainer$"+rt,Wt="__reactEvents$"+rt,Ct="__reactListeners$"+rt,bt="__reactHandles$"+rt,$t="__reactResources$"+rt,un="__reactMarker$"+rt;function pn(e){delete e[at],delete e[Ke],delete e[Wt],delete e[Ct],delete e[bt]}function Lt(e){var t=e[at];if(t)return t;for(var r=e.parentNode;r;){if(t=r[Nt]||r[at]){if(r=t.alternate,t.child!==null||r!==null&&r.child!==null)for(e=Iv(e);e!==null;){if(r=e[at])return r;e=Iv(e)}return t}e=r,r=e.parentNode}return null}function Zt(e){if(e=e[at]||e[Nt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function en(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(s(33))}function Tn(e){var t=e[$t];return t||(t=e[$t]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function fn(e){e[un]=!0}var Dn=new Set,zr={};function Hn(e,t){ur(e,t),ur(e+"Capture",t)}function ur(e,t){for(zr[e]=t,e=0;e<t.length;e++)Dn.add(t[e])}var Yn=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Fr={},D={};function ie(e){return xt.call(D,e)?!0:xt.call(Fr,e)?!1:Yn.test(e)?D[e]=!0:(Fr[e]=!0,!1)}function Pe(e,t,r){if(ie(t))if(r===null)e.removeAttribute(t);else{switch(typeof r){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var i=t.toLowerCase().slice(0,5);if(i!=="data-"&&i!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+r)}}function E(e,t,r){if(r===null)e.removeAttribute(t);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+r)}}function F(e,t,r,i){if(i===null)e.removeAttribute(r);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(r);return}e.setAttributeNS(t,r,""+i)}}function p(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function b(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function L(e,t,r){var i=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var u=i.get,c=i.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return u.call(this)},set:function(f){r=""+f,c.call(this,f)}}),Object.defineProperty(e,t,{enumerable:i.enumerable}),{getValue:function(){return r},setValue:function(f){r=""+f},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function q(e){if(!e._valueTracker){var t=b(e)?"checked":"value";e._valueTracker=L(e,t,""+e[t])}}function Ee(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),i="";return e&&(i=b(e)?e.checked?"true":"false":e.value),e=i,e!==r?(t.setValue(e),!0):!1}function be(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var Oe=/[\n"\\]/g;function ae(e){return e.replace(Oe,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function ke(e,t,r,i,u,c,f,y){e.name="",f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"?e.type=f:e.removeAttribute("type"),t!=null?f==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+p(t)):e.value!==""+p(t)&&(e.value=""+p(t)):f!=="submit"&&f!=="reset"||e.removeAttribute("value"),t!=null?We(e,f,p(t)):r!=null?We(e,f,p(r)):i!=null&&e.removeAttribute("value"),u==null&&c!=null&&(e.defaultChecked=!!c),u!=null&&(e.checked=u&&typeof u!="function"&&typeof u!="symbol"),y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"?e.name=""+p(y):e.removeAttribute("name")}function Ve(e,t,r,i,u,c,f,y){if(c!=null&&typeof c!="function"&&typeof c!="symbol"&&typeof c!="boolean"&&(e.type=c),t!=null||r!=null){if(!(c!=="submit"&&c!=="reset"||t!=null)){q(e);return}r=r!=null?""+p(r):"",t=t!=null?""+p(t):r,y||t===e.value||(e.value=t),e.defaultValue=t}i=i??u,i=typeof i!="function"&&typeof i!="symbol"&&!!i,e.checked=y?e.checked:!!i,e.defaultChecked=!!i,f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"&&(e.name=f),q(e)}function We(e,t,r){t==="number"&&be(e.ownerDocument)===e||e.defaultValue===""+r||(e.defaultValue=""+r)}function ft(e,t,r,i){if(e=e.options,t){t={};for(var u=0;u<r.length;u++)t["$"+r[u]]=!0;for(r=0;r<e.length;r++)u=t.hasOwnProperty("$"+e[r].value),e[r].selected!==u&&(e[r].selected=u),u&&i&&(e[r].defaultSelected=!0)}else{for(r=""+p(r),t=null,u=0;u<e.length;u++){if(e[u].value===r){e[u].selected=!0,i&&(e[u].defaultSelected=!0);return}t!==null||e[u].disabled||(t=e[u])}t!==null&&(t.selected=!0)}}function nt(e,t,r){if(t!=null&&(t=""+p(t),t!==e.value&&(e.value=t),r==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=r!=null?""+p(r):""}function it(e,t,r,i){if(t==null){if(i!=null){if(r!=null)throw Error(s(92));if($(i)){if(1<i.length)throw Error(s(93));i=i[0]}r=i}r==null&&(r=""),t=r}r=p(t),e.defaultValue=r,i=e.textContent,i===r&&i!==""&&i!==null&&(e.value=i),q(e)}function ht(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var wt=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Bt(e,t,r){var i=t.indexOf("--")===0;r==null||typeof r=="boolean"||r===""?i?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":i?e.setProperty(t,r):typeof r!="number"||r===0||wt.has(t)?t==="float"?e.cssFloat=r:e[t]=(""+r).trim():e[t]=r+"px"}function Ot(e,t,r){if(t!=null&&typeof t!="object")throw Error(s(62));if(e=e.style,r!=null){for(var i in r)!r.hasOwnProperty(i)||t!=null&&t.hasOwnProperty(i)||(i.indexOf("--")===0?e.setProperty(i,""):i==="float"?e.cssFloat="":e[i]="");for(var u in t)i=t[u],t.hasOwnProperty(u)&&r[u]!==i&&Bt(e,u,i)}else for(var c in t)t.hasOwnProperty(c)&&Bt(e,c,t[c])}function on(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Rn=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),cr=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Mr(e){return cr.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function ar(){}var N=null;function I(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var we=null,tt=null;function Je(e){var t=Zt(e);if(t&&(e=t.stateNode)){var r=e[Ke]||null;e:switch(e=t.stateNode,t.type){case"input":if(ke(e,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name),t=r.name,r.type==="radio"&&t!=null){for(r=e;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll('input[name="'+ae(""+t)+'"][type="radio"]'),t=0;t<r.length;t++){var i=r[t];if(i!==e&&i.form===e.form){var u=i[Ke]||null;if(!u)throw Error(s(90));ke(i,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name)}}for(t=0;t<r.length;t++)i=r[t],i.form===e.form&&Ee(i)}break e;case"textarea":nt(e,r.value,r.defaultValue);break e;case"select":t=r.value,t!=null&&ft(e,!!r.multiple,t,!1)}}}var qt=!1;function It(e,t,r){if(qt)return e(t,r);qt=!0;try{var i=e(t);return i}finally{if(qt=!1,(we!==null||tt!==null)&&(wu(),we&&(t=we,e=tt,tt=we=null,Je(t),e)))for(t=0;t<e.length;t++)Je(e[t])}}function Kt(e,t){var r=e.stateNode;if(r===null)return null;var i=r[Ke]||null;if(i===null)return null;r=i[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(i=!i.disabled)||(e=e.type,i=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!i;break e;default:e=!1}if(e)return null;if(r&&typeof r!="function")throw Error(s(231,t,typeof r));return r}var an=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Jn=!1;if(an)try{dr={},Object.defineProperty(dr,"passive",{get:function(){Jn=!0}}),window.addEventListener("test",dr,dr),window.removeEventListener("test",dr,dr)}catch{Jn=!1}var dr,pr=null,na=null,ja=null;function fa(){if(ja)return ja;var e,t=na,r=t.length,i,u="value"in pr?pr.value:pr.textContent,c=u.length;for(e=0;e<r&&t[e]===u[e];e++);var f=r-e;for(i=1;i<=f&&t[r-i]===u[c-i];i++);return ja=u.slice(e,1<i?1-i:void 0)}function Vr(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function hr(){return!0}function pa(){return!1}function yr(e){function t(r,i,u,c,f){this._reactName=r,this._targetInst=u,this.type=i,this.nativeEvent=c,this.target=f,this.currentTarget=null;for(var y in e)e.hasOwnProperty(y)&&(r=e[y],this[y]=r?r(c):c[y]);return this.isDefaultPrevented=(c.defaultPrevented!=null?c.defaultPrevented:c.returnValue===!1)?hr:pa,this.isPropagationStopped=pa,this}return S(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=hr)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=hr)},persist:function(){},isPersistent:hr}),t}var Oa={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},fo=yr(Oa),oi=S({},Oa,{view:0,detail:0}),Ds=yr(oi),$i,po,Pa,$a=S({},oi,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Dc,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Pa&&(Pa&&e.type==="mousemove"?($i=e.screenX-Pa.screenX,po=e.screenY-Pa.screenY):po=$i=0,Pa=e),$i)},movementY:function(e){return"movementY"in e?e.movementY:po}}),ho=yr($a),js=S({},$a,{dataTransfer:0}),Os=yr(js),Ps=S({},oi,{relatedTarget:0}),pl=yr(Ps),Bc=S({},Oa,{animationName:0,elapsedTime:0,pseudoElement:0}),zc=yr(Bc),hb=S({},Oa,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),vb=yr(hb),gb=S({},Oa,{data:0}),jf=yr(gb),bb={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},yb={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},xb={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function wb(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=xb[e])?!!t[e]:!1}function Dc(){return wb}var Eb=S({},oi,{key:function(e){if(e.key){var t=bb[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Vr(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?yb[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Dc,charCode:function(e){return e.type==="keypress"?Vr(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Vr(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),kb=yr(Eb),Cb=S({},$a,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Of=yr(Cb),Sb=S({},oi,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Dc}),Fb=yr(Sb),Mb=S({},Oa,{propertyName:0,elapsedTime:0,pseudoElement:0}),Lb=yr(Mb),Ab=S({},$a,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Nb=yr(Ab),_b=S({},Oa,{newState:0,oldState:0}),Tb=yr(_b),Bb=[9,13,27,32],jc=an&&"CompositionEvent"in window,hl=null;an&&"documentMode"in document&&(hl=document.documentMode);var zb=an&&"TextEvent"in window&&!hl,Pf=an&&(!jc||hl&&8<hl&&11>=hl),$f=" ",Rf=!1;function If(e,t){switch(e){case"keyup":return Bb.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Hf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var vo=!1;function Db(e,t){switch(e){case"compositionend":return Hf(t);case"keypress":return t.which!==32?null:(Rf=!0,$f);case"textInput":return e=t.data,e===$f&&Rf?null:e;default:return null}}function jb(e,t){if(vo)return e==="compositionend"||!jc&&If(e,t)?(e=fa(),ja=na=pr=null,vo=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Pf&&t.locale!=="ko"?null:t.data;default:return null}}var Ob={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Vf(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Ob[e.type]:t==="textarea"}function Wf(e,t,r,i){we?tt?tt.push(i):tt=[i]:we=i,t=Nu(t,"onChange"),0<t.length&&(r=new fo("onChange","change",null,r,i),e.push({event:r,listeners:t}))}var vl=null,gl=null;function Pb(e){Mv(e,0)}function $s(e){var t=en(e);if(Ee(t))return e}function qf(e,t){if(e==="change")return t}var Yf=!1;an&&(an?(Rs="oninput"in document,Rs||(Pc=document.createElement("div"),Pc.setAttribute("oninput","return;"),Rs=typeof Pc.oninput=="function"),Oc=Rs):Oc=!1,Yf=Oc&&(!document.documentMode||9<document.documentMode));var Oc,Rs,Pc;function Uf(){vl&&(vl.detachEvent("onpropertychange",Zf),gl=vl=null)}function Zf(e){if(e.propertyName==="value"&&$s(gl)){var t=[];Wf(t,gl,e,I(e)),It(Pb,t)}}function $b(e,t,r){e==="focusin"?(Uf(),vl=t,gl=r,vl.attachEvent("onpropertychange",Zf)):e==="focusout"&&Uf()}function Rb(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return $s(gl)}function Ib(e,t){if(e==="click")return $s(t)}function Hb(e,t){if(e==="input"||e==="change")return $s(t)}function Vb(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Wr=typeof Object.is=="function"?Object.is:Vb;function bl(e,t){if(Wr(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;for(i=0;i<r.length;i++){var u=r[i];if(!xt.call(t,u)||!Wr(e[u],t[u]))return!1}return!0}function Kf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Gf(e,t){var r=Kf(e);e=0;for(var i;r;){if(r.nodeType===3){if(i=e+r.textContent.length,e<=t&&i>=t)return{node:r,offset:t-e};e=i}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=Kf(r)}}function Xf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Xf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Qf(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=be(e.document);t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=be(e.document)}return t}function $c(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var Wb=an&&"documentMode"in document&&11>=document.documentMode,go=null,Rc=null,yl=null,Ic=!1;function Jf(e,t,r){var i=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;Ic||go==null||go!==be(i)||(i=go,"selectionStart"in i&&$c(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),yl&&bl(yl,i)||(yl=i,i=Nu(Rc,"onSelect"),0<i.length&&(t=new fo("onSelect","select",null,t,r),e.push({event:t,listeners:i}),t.target=go)))}function Ri(e,t){var r={};return r[e.toLowerCase()]=t.toLowerCase(),r["Webkit"+e]="webkit"+t,r["Moz"+e]="moz"+t,r}var bo={animationend:Ri("Animation","AnimationEnd"),animationiteration:Ri("Animation","AnimationIteration"),animationstart:Ri("Animation","AnimationStart"),transitionrun:Ri("Transition","TransitionRun"),transitionstart:Ri("Transition","TransitionStart"),transitioncancel:Ri("Transition","TransitionCancel"),transitionend:Ri("Transition","TransitionEnd")},Hc={},ep={};an&&(ep=document.createElement("div").style,"AnimationEvent"in window||(delete bo.animationend.animation,delete bo.animationiteration.animation,delete bo.animationstart.animation),"TransitionEvent"in window||delete bo.transitionend.transition);function Ii(e){if(Hc[e])return Hc[e];if(!bo[e])return e;var t=bo[e],r;for(r in t)if(t.hasOwnProperty(r)&&r in ep)return Hc[e]=t[r];return e}var tp=Ii("animationend"),np=Ii("animationiteration"),rp=Ii("animationstart"),qb=Ii("transitionrun"),Yb=Ii("transitionstart"),Ub=Ii("transitioncancel"),ap=Ii("transitionend"),ip=new Map,Vc="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Vc.push("scrollEnd");function ha(e,t){ip.set(e,t),Hn(t,[e])}var Is=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},ra=[],yo=0,Wc=0;function Hs(){for(var e=yo,t=Wc=yo=0;t<e;){var r=ra[t];ra[t++]=null;var i=ra[t];ra[t++]=null;var u=ra[t];ra[t++]=null;var c=ra[t];if(ra[t++]=null,i!==null&&u!==null){var f=i.pending;f===null?u.next=u:(u.next=f.next,f.next=u),i.pending=u}c!==0&&op(r,u,c)}}function Vs(e,t,r,i){ra[yo++]=e,ra[yo++]=t,ra[yo++]=r,ra[yo++]=i,Wc|=i,e.lanes|=i,e=e.alternate,e!==null&&(e.lanes|=i)}function qc(e,t,r,i){return Vs(e,t,r,i),Ws(e)}function Hi(e,t){return Vs(e,null,null,t),Ws(e)}function op(e,t,r){e.lanes|=r;var i=e.alternate;i!==null&&(i.lanes|=r);for(var u=!1,c=e.return;c!==null;)c.childLanes|=r,i=c.alternate,i!==null&&(i.childLanes|=r),c.tag===22&&(e=c.stateNode,e===null||e._visibility&1||(u=!0)),e=c,c=c.return;return e.tag===3?(c=e.stateNode,u&&t!==null&&(u=31-Ut(r),e=c.hiddenUpdates,i=e[u],i===null?e[u]=[t]:i.push(t),t.lane=r|536870912),c):null}function Ws(e){if(50<Il)throw Il=0,em=null,Error(s(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var xo={};function Zb(e,t,r,i){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function qr(e,t,r,i){return new Zb(e,t,r,i)}function Yc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ra(e,t){var r=e.alternate;return r===null?(r=qr(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&65011712,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r.refCleanup=e.refCleanup,r}function lp(e,t){e.flags&=65011714;var r=e.alternate;return r===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=r.childLanes,e.lanes=r.lanes,e.child=r.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=r.memoizedProps,e.memoizedState=r.memoizedState,e.updateQueue=r.updateQueue,e.type=r.type,t=r.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function qs(e,t,r,i,u,c){var f=0;if(i=e,typeof e=="function")Yc(e)&&(f=1);else if(typeof e=="string")f=Xy(e,r,B.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case T:return e=qr(31,r,t,u),e.elementType=T,e.lanes=c,e;case oe:return Vi(r.children,u,c,t);case ge:f=8,u|=24;break;case Be:return e=qr(12,r,t,u|2),e.elementType=Be,e.lanes=c,e;case ve:return e=qr(13,r,t,u),e.elementType=ve,e.lanes=c,e;case j:return e=qr(19,r,t,u),e.elementType=j,e.lanes=c,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case de:f=10;break e;case Te:f=9;break e;case Ae:f=11;break e;case k:f=14;break e;case H:f=16,i=null;break e}f=29,r=Error(s(130,e===null?"null":typeof e,"")),i=null}return t=qr(f,r,t,u),t.elementType=e,t.type=i,t.lanes=c,t}function Vi(e,t,r,i){return e=qr(7,e,i,t),e.lanes=r,e}function Uc(e,t,r){return e=qr(6,e,null,t),e.lanes=r,e}function sp(e){var t=qr(18,null,null,0);return t.stateNode=e,t}function Zc(e,t,r){return t=qr(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var up=new WeakMap;function aa(e,t){if(typeof e=="object"&&e!==null){var r=up.get(e);return r!==void 0?r:(t={value:e,source:t,stack:_t(t)},up.set(e,t),t)}return{value:e,source:t,stack:_t(t)}}var wo=[],Eo=0,Ys=null,xl=0,ia=[],oa=0,li=null,Ca=1,Sa="";function Ia(e,t){wo[Eo++]=xl,wo[Eo++]=Ys,Ys=e,xl=t}function cp(e,t,r){ia[oa++]=Ca,ia[oa++]=Sa,ia[oa++]=li,li=e;var i=Ca;e=Sa;var u=32-Ut(i)-1;i&=~(1<<u),r+=1;var c=32-Ut(t)+u;if(30<c){var f=u-u%5;c=(i&(1<<f)-1).toString(32),i>>=f,u-=f,Ca=1<<32-Ut(t)+u|r<<u|i,Sa=c+e}else Ca=1<<c|r<<u|i,Sa=e}function Kc(e){e.return!==null&&(Ia(e,1),cp(e,1,0))}function Gc(e){for(;e===Ys;)Ys=wo[--Eo],wo[Eo]=null,xl=wo[--Eo],wo[Eo]=null;for(;e===li;)li=ia[--oa],ia[oa]=null,Sa=ia[--oa],ia[oa]=null,Ca=ia[--oa],ia[oa]=null}function dp(e,t){ia[oa++]=Ca,ia[oa++]=Sa,ia[oa++]=li,Ca=t.id,Sa=t.overflow,li=e}var xr=null,Vn=null,yn=!1,si=null,la=!1,Xc=Error(s(519));function ui(e){var t=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw wl(aa(t,e)),Xc}function mp(e){var t=e.stateNode,r=e.type,i=e.memoizedProps;switch(t[at]=e,t[Ke]=i,r){case"dialog":vn("cancel",t),vn("close",t);break;case"iframe":case"object":case"embed":vn("load",t);break;case"video":case"audio":for(r=0;r<Vl.length;r++)vn(Vl[r],t);break;case"source":vn("error",t);break;case"img":case"image":case"link":vn("error",t),vn("load",t);break;case"details":vn("toggle",t);break;case"input":vn("invalid",t),Ve(t,i.value,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name,!0);break;case"select":vn("invalid",t);break;case"textarea":vn("invalid",t),it(t,i.value,i.defaultValue,i.children)}r=i.children,typeof r!="string"&&typeof r!="number"&&typeof r!="bigint"||t.textContent===""+r||i.suppressHydrationWarning===!0||_v(t.textContent,r)?(i.popover!=null&&(vn("beforetoggle",t),vn("toggle",t)),i.onScroll!=null&&vn("scroll",t),i.onScrollEnd!=null&&vn("scrollend",t),i.onClick!=null&&(t.onclick=ar),t=!0):t=!1,t||ui(e,!0)}function fp(e){for(xr=e.return;xr;)switch(xr.tag){case 5:case 31:case 13:la=!1;return;case 27:case 3:la=!0;return;default:xr=xr.return}}function ko(e){if(e!==xr)return!1;if(!yn)return fp(e),yn=!0,!1;var t=e.tag,r;if((r=t!==3&&t!==27)&&((r=t===5)&&(r=e.type,r=!(r!=="form"&&r!=="button")||fm(e.type,e.memoizedProps)),r=!r),r&&Vn&&ui(e),fp(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(317));Vn=Rv(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(317));Vn=Rv(e)}else t===27?(t=Vn,ki(e.type)?(e=bm,bm=null,Vn=e):Vn=t):Vn=xr?sa(e.stateNode.nextSibling):null;return!0}function Wi(){Vn=xr=null,yn=!1}function Qc(){var e=si;return e!==null&&(Pr===null?Pr=e:Pr.push.apply(Pr,e),si=null),e}function wl(e){si===null?si=[e]:si.push(e)}var Jc=x(null),qi=null,Ha=null;function ci(e,t,r){O(Jc,t._currentValue),t._currentValue=r}function Va(e){e._currentValue=Jc.current,C(Jc)}function ed(e,t,r){for(;e!==null;){var i=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,i!==null&&(i.childLanes|=t)):i!==null&&(i.childLanes&t)!==t&&(i.childLanes|=t),e===r)break;e=e.return}}function td(e,t,r,i){var u=e.child;for(u!==null&&(u.return=e);u!==null;){var c=u.dependencies;if(c!==null){var f=u.child;c=c.firstContext;e:for(;c!==null;){var y=c;c=u;for(var R=0;R<t.length;R++)if(y.context===t[R]){c.lanes|=r,y=c.alternate,y!==null&&(y.lanes|=r),ed(c.return,r,e),i||(f=null);break e}c=y.next}}else if(u.tag===18){if(f=u.return,f===null)throw Error(s(341));f.lanes|=r,c=f.alternate,c!==null&&(c.lanes|=r),ed(f,r,e),f=null}else f=u.child;if(f!==null)f.return=u;else for(f=u;f!==null;){if(f===e){f=null;break}if(u=f.sibling,u!==null){u.return=f.return,f=u;break}f=f.return}u=f}}function Co(e,t,r,i){e=null;for(var u=t,c=!1;u!==null;){if(!c){if((u.flags&524288)!==0)c=!0;else if((u.flags&262144)!==0)break}if(u.tag===10){var f=u.alternate;if(f===null)throw Error(s(387));if(f=f.memoizedProps,f!==null){var y=u.type;Wr(u.pendingProps.value,f.value)||(e!==null?e.push(y):e=[y])}}else if(u===J.current){if(f=u.alternate,f===null)throw Error(s(387));f.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(e!==null?e.push(Zl):e=[Zl])}u=u.return}e!==null&&td(t,e,r,i),t.flags|=262144}function Us(e){for(e=e.firstContext;e!==null;){if(!Wr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Yi(e){qi=e,Ha=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function wr(e){return pp(qi,e)}function Zs(e,t){return qi===null&&Yi(e),pp(e,t)}function pp(e,t){var r=t._currentValue;if(t={context:t,memoizedValue:r,next:null},Ha===null){if(e===null)throw Error(s(308));Ha=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Ha=Ha.next=t;return r}var Kb=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(r,i){e.push(i)}};this.abort=function(){t.aborted=!0,e.forEach(function(r){return r()})}},Gb=a.unstable_scheduleCallback,Xb=a.unstable_NormalPriority,ir={$$typeof:de,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function nd(){return{controller:new Kb,data:new Map,refCount:0}}function El(e){e.refCount--,e.refCount===0&&Gb(Xb,function(){e.controller.abort()})}var kl=null,rd=0,So=0,Fo=null;function Qb(e,t){if(kl===null){var r=kl=[];rd=0,So=om(),Fo={status:"pending",value:void 0,then:function(i){r.push(i)}}}return rd++,t.then(hp,hp),t}function hp(){if(--rd===0&&kl!==null){Fo!==null&&(Fo.status="fulfilled");var e=kl;kl=null,So=0,Fo=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Jb(e,t){var r=[],i={status:"pending",value:null,reason:null,then:function(u){r.push(u)}};return e.then(function(){i.status="fulfilled",i.value=t;for(var u=0;u<r.length;u++)(0,r[u])(t)},function(u){for(i.status="rejected",i.reason=u,u=0;u<r.length;u++)(0,r[u])(void 0)}),i}var vp=M.S;M.S=function(e,t){Jh=Ge(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&Qb(e,t),vp!==null&&vp(e,t)};var Ui=x(null);function ad(){var e=Ui.current;return e!==null?e:In.pooledCache}function Ks(e,t){t===null?O(Ui,Ui.current):O(Ui,t.pool)}function gp(){var e=ad();return e===null?null:{parent:ir._currentValue,pool:e}}var Mo=Error(s(460)),id=Error(s(474)),Gs=Error(s(542)),Xs={then:function(){}};function bp(e){return e=e.status,e==="fulfilled"||e==="rejected"}function yp(e,t,r){switch(r=e[r],r===void 0?e.push(t):r!==t&&(t.then(ar,ar),t=r),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,wp(e),e;default:if(typeof t.status=="string")t.then(ar,ar);else{if(e=In,e!==null&&100<e.shellSuspendCounter)throw Error(s(482));e=t,e.status="pending",e.then(function(i){if(t.status==="pending"){var u=t;u.status="fulfilled",u.value=i}},function(i){if(t.status==="pending"){var u=t;u.status="rejected",u.reason=i}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,wp(e),e}throw Ki=t,Mo}}function Zi(e){try{var t=e._init;return t(e._payload)}catch(r){throw r!==null&&typeof r=="object"&&typeof r.then=="function"?(Ki=r,Mo):r}}var Ki=null;function xp(){if(Ki===null)throw Error(s(459));var e=Ki;return Ki=null,e}function wp(e){if(e===Mo||e===Gs)throw Error(s(483))}var Lo=null,Cl=0;function Qs(e){var t=Cl;return Cl+=1,Lo===null&&(Lo=[]),yp(Lo,e,t)}function Sl(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Js(e,t){throw t.$$typeof===Q?Error(s(525)):(e=Object.prototype.toString.call(t),Error(s(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Ep(e){function t(re,Z){if(e){var pe=re.deletions;pe===null?(re.deletions=[Z],re.flags|=16):pe.push(Z)}}function r(re,Z){if(!e)return null;for(;Z!==null;)t(re,Z),Z=Z.sibling;return null}function i(re){for(var Z=new Map;re!==null;)re.key!==null?Z.set(re.key,re):Z.set(re.index,re),re=re.sibling;return Z}function u(re,Z){return re=Ra(re,Z),re.index=0,re.sibling=null,re}function c(re,Z,pe){return re.index=pe,e?(pe=re.alternate,pe!==null?(pe=pe.index,pe<Z?(re.flags|=67108866,Z):pe):(re.flags|=67108866,Z)):(re.flags|=1048576,Z)}function f(re){return e&&re.alternate===null&&(re.flags|=67108866),re}function y(re,Z,pe,$e){return Z===null||Z.tag!==6?(Z=Uc(pe,re.mode,$e),Z.return=re,Z):(Z=u(Z,pe),Z.return=re,Z)}function R(re,Z,pe,$e){var Ht=pe.type;return Ht===oe?De(re,Z,pe.props.children,$e,pe.key):Z!==null&&(Z.elementType===Ht||typeof Ht=="object"&&Ht!==null&&Ht.$$typeof===H&&Zi(Ht)===Z.type)?(Z=u(Z,pe.props),Sl(Z,pe),Z.return=re,Z):(Z=qs(pe.type,pe.key,pe.props,null,re.mode,$e),Sl(Z,pe),Z.return=re,Z)}function he(re,Z,pe,$e){return Z===null||Z.tag!==4||Z.stateNode.containerInfo!==pe.containerInfo||Z.stateNode.implementation!==pe.implementation?(Z=Zc(pe,re.mode,$e),Z.return=re,Z):(Z=u(Z,pe.children||[]),Z.return=re,Z)}function De(re,Z,pe,$e,Ht){return Z===null||Z.tag!==7?(Z=Vi(pe,re.mode,$e,Ht),Z.return=re,Z):(Z=u(Z,pe),Z.return=re,Z)}function Ie(re,Z,pe){if(typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint")return Z=Uc(""+Z,re.mode,pe),Z.return=re,Z;if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case X:return pe=qs(Z.type,Z.key,Z.props,null,re.mode,pe),Sl(pe,Z),pe.return=re,pe;case ue:return Z=Zc(Z,re.mode,pe),Z.return=re,Z;case H:return Z=Zi(Z),Ie(re,Z,pe)}if($(Z)||se(Z))return Z=Vi(Z,re.mode,pe,null),Z.return=re,Z;if(typeof Z.then=="function")return Ie(re,Qs(Z),pe);if(Z.$$typeof===de)return Ie(re,Zs(re,Z),pe);Js(re,Z)}return null}function ye(re,Z,pe,$e){var Ht=Z!==null?Z.key:null;if(typeof pe=="string"&&pe!==""||typeof pe=="number"||typeof pe=="bigint")return Ht!==null?null:y(re,Z,""+pe,$e);if(typeof pe=="object"&&pe!==null){switch(pe.$$typeof){case X:return pe.key===Ht?R(re,Z,pe,$e):null;case ue:return pe.key===Ht?he(re,Z,pe,$e):null;case H:return pe=Zi(pe),ye(re,Z,pe,$e)}if($(pe)||se(pe))return Ht!==null?null:De(re,Z,pe,$e,null);if(typeof pe.then=="function")return ye(re,Z,Qs(pe),$e);if(pe.$$typeof===de)return ye(re,Z,Zs(re,pe),$e);Js(re,pe)}return null}function Se(re,Z,pe,$e,Ht){if(typeof $e=="string"&&$e!==""||typeof $e=="number"||typeof $e=="bigint")return re=re.get(pe)||null,y(Z,re,""+$e,Ht);if(typeof $e=="object"&&$e!==null){switch($e.$$typeof){case X:return re=re.get($e.key===null?pe:$e.key)||null,R(Z,re,$e,Ht);case ue:return re=re.get($e.key===null?pe:$e.key)||null,he(Z,re,$e,Ht);case H:return $e=Zi($e),Se(re,Z,pe,$e,Ht)}if($($e)||se($e))return re=re.get(pe)||null,De(Z,re,$e,Ht,null);if(typeof $e.then=="function")return Se(re,Z,pe,Qs($e),Ht);if($e.$$typeof===de)return Se(re,Z,pe,Zs(Z,$e),Ht);Js(Z,$e)}return null}function At(re,Z,pe,$e){for(var Ht=null,Sn=null,zt=Z,cn=Z=0,bn=null;zt!==null&&cn<pe.length;cn++){zt.index>cn?(bn=zt,zt=null):bn=zt.sibling;var Fn=ye(re,zt,pe[cn],$e);if(Fn===null){zt===null&&(zt=bn);break}e&&zt&&Fn.alternate===null&&t(re,zt),Z=c(Fn,Z,cn),Sn===null?Ht=Fn:Sn.sibling=Fn,Sn=Fn,zt=bn}if(cn===pe.length)return r(re,zt),yn&&Ia(re,cn),Ht;if(zt===null){for(;cn<pe.length;cn++)zt=Ie(re,pe[cn],$e),zt!==null&&(Z=c(zt,Z,cn),Sn===null?Ht=zt:Sn.sibling=zt,Sn=zt);return yn&&Ia(re,cn),Ht}for(zt=i(zt);cn<pe.length;cn++)bn=Se(zt,re,cn,pe[cn],$e),bn!==null&&(e&&bn.alternate!==null&&zt.delete(bn.key===null?cn:bn.key),Z=c(bn,Z,cn),Sn===null?Ht=bn:Sn.sibling=bn,Sn=bn);return e&&zt.forEach(function(Li){return t(re,Li)}),yn&&Ia(re,cn),Ht}function Gt(re,Z,pe,$e){if(pe==null)throw Error(s(151));for(var Ht=null,Sn=null,zt=Z,cn=Z=0,bn=null,Fn=pe.next();zt!==null&&!Fn.done;cn++,Fn=pe.next()){zt.index>cn?(bn=zt,zt=null):bn=zt.sibling;var Li=ye(re,zt,Fn.value,$e);if(Li===null){zt===null&&(zt=bn);break}e&&zt&&Li.alternate===null&&t(re,zt),Z=c(Li,Z,cn),Sn===null?Ht=Li:Sn.sibling=Li,Sn=Li,zt=bn}if(Fn.done)return r(re,zt),yn&&Ia(re,cn),Ht;if(zt===null){for(;!Fn.done;cn++,Fn=pe.next())Fn=Ie(re,Fn.value,$e),Fn!==null&&(Z=c(Fn,Z,cn),Sn===null?Ht=Fn:Sn.sibling=Fn,Sn=Fn);return yn&&Ia(re,cn),Ht}for(zt=i(zt);!Fn.done;cn++,Fn=pe.next())Fn=Se(zt,re,cn,Fn.value,$e),Fn!==null&&(e&&Fn.alternate!==null&&zt.delete(Fn.key===null?cn:Fn.key),Z=c(Fn,Z,cn),Sn===null?Ht=Fn:Sn.sibling=Fn,Sn=Fn);return e&&zt.forEach(function(s1){return t(re,s1)}),yn&&Ia(re,cn),Ht}function Pn(re,Z,pe,$e){if(typeof pe=="object"&&pe!==null&&pe.type===oe&&pe.key===null&&(pe=pe.props.children),typeof pe=="object"&&pe!==null){switch(pe.$$typeof){case X:e:{for(var Ht=pe.key;Z!==null;){if(Z.key===Ht){if(Ht=pe.type,Ht===oe){if(Z.tag===7){r(re,Z.sibling),$e=u(Z,pe.props.children),$e.return=re,re=$e;break e}}else if(Z.elementType===Ht||typeof Ht=="object"&&Ht!==null&&Ht.$$typeof===H&&Zi(Ht)===Z.type){r(re,Z.sibling),$e=u(Z,pe.props),Sl($e,pe),$e.return=re,re=$e;break e}r(re,Z);break}else t(re,Z);Z=Z.sibling}pe.type===oe?($e=Vi(pe.props.children,re.mode,$e,pe.key),$e.return=re,re=$e):($e=qs(pe.type,pe.key,pe.props,null,re.mode,$e),Sl($e,pe),$e.return=re,re=$e)}return f(re);case ue:e:{for(Ht=pe.key;Z!==null;){if(Z.key===Ht)if(Z.tag===4&&Z.stateNode.containerInfo===pe.containerInfo&&Z.stateNode.implementation===pe.implementation){r(re,Z.sibling),$e=u(Z,pe.children||[]),$e.return=re,re=$e;break e}else{r(re,Z);break}else t(re,Z);Z=Z.sibling}$e=Zc(pe,re.mode,$e),$e.return=re,re=$e}return f(re);case H:return pe=Zi(pe),Pn(re,Z,pe,$e)}if($(pe))return At(re,Z,pe,$e);if(se(pe)){if(Ht=se(pe),typeof Ht!="function")throw Error(s(150));return pe=Ht.call(pe),Gt(re,Z,pe,$e)}if(typeof pe.then=="function")return Pn(re,Z,Qs(pe),$e);if(pe.$$typeof===de)return Pn(re,Z,Zs(re,pe),$e);Js(re,pe)}return typeof pe=="string"&&pe!==""||typeof pe=="number"||typeof pe=="bigint"?(pe=""+pe,Z!==null&&Z.tag===6?(r(re,Z.sibling),$e=u(Z,pe),$e.return=re,re=$e):(r(re,Z),$e=Uc(pe,re.mode,$e),$e.return=re,re=$e),f(re)):r(re,Z)}return function(re,Z,pe,$e){try{Cl=0;var Ht=Pn(re,Z,pe,$e);return Lo=null,Ht}catch(zt){if(zt===Mo||zt===Gs)throw zt;var Sn=qr(29,zt,null,re.mode);return Sn.lanes=$e,Sn.return=re,Sn}}}var Gi=Ep(!0),kp=Ep(!1),di=!1;function od(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ld(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function mi(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function fi(e,t,r){var i=e.updateQueue;if(i===null)return null;if(i=i.shared,(Mn&2)!==0){var u=i.pending;return u===null?t.next=t:(t.next=u.next,u.next=t),i.pending=t,t=Ws(e),op(e,null,r),t}return Vs(e,i,t,r),Ws(e)}function Fl(e,t,r){if(t=t.updateQueue,t!==null&&(t=t.shared,(r&4194048)!==0)){var i=t.lanes;i&=e.pendingLanes,r|=i,t.lanes=r,V(e,r)}}function sd(e,t){var r=e.updateQueue,i=e.alternate;if(i!==null&&(i=i.updateQueue,r===i)){var u=null,c=null;if(r=r.firstBaseUpdate,r!==null){do{var f={lane:r.lane,tag:r.tag,payload:r.payload,callback:null,next:null};c===null?u=c=f:c=c.next=f,r=r.next}while(r!==null);c===null?u=c=t:c=c.next=t}else u=c=t;r={baseState:i.baseState,firstBaseUpdate:u,lastBaseUpdate:c,shared:i.shared,callbacks:i.callbacks},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}var ud=!1;function Ml(){if(ud){var e=Fo;if(e!==null)throw e}}function Ll(e,t,r,i){ud=!1;var u=e.updateQueue;di=!1;var c=u.firstBaseUpdate,f=u.lastBaseUpdate,y=u.shared.pending;if(y!==null){u.shared.pending=null;var R=y,he=R.next;R.next=null,f===null?c=he:f.next=he,f=R;var De=e.alternate;De!==null&&(De=De.updateQueue,y=De.lastBaseUpdate,y!==f&&(y===null?De.firstBaseUpdate=he:y.next=he,De.lastBaseUpdate=R))}if(c!==null){var Ie=u.baseState;f=0,De=he=R=null,y=c;do{var ye=y.lane&-536870913,Se=ye!==y.lane;if(Se?(gn&ye)===ye:(i&ye)===ye){ye!==0&&ye===So&&(ud=!0),De!==null&&(De=De.next={lane:0,tag:y.tag,payload:y.payload,callback:null,next:null});e:{var At=e,Gt=y;ye=t;var Pn=r;switch(Gt.tag){case 1:if(At=Gt.payload,typeof At=="function"){Ie=At.call(Pn,Ie,ye);break e}Ie=At;break e;case 3:At.flags=At.flags&-65537|128;case 0:if(At=Gt.payload,ye=typeof At=="function"?At.call(Pn,Ie,ye):At,ye==null)break e;Ie=S({},Ie,ye);break e;case 2:di=!0}}ye=y.callback,ye!==null&&(e.flags|=64,Se&&(e.flags|=8192),Se=u.callbacks,Se===null?u.callbacks=[ye]:Se.push(ye))}else Se={lane:ye,tag:y.tag,payload:y.payload,callback:y.callback,next:null},De===null?(he=De=Se,R=Ie):De=De.next=Se,f|=ye;if(y=y.next,y===null){if(y=u.shared.pending,y===null)break;Se=y,y=Se.next,Se.next=null,u.lastBaseUpdate=Se,u.shared.pending=null}}while(!0);De===null&&(R=Ie),u.baseState=R,u.firstBaseUpdate=he,u.lastBaseUpdate=De,c===null&&(u.shared.lanes=0),bi|=f,e.lanes=f,e.memoizedState=Ie}}function Cp(e,t){if(typeof e!="function")throw Error(s(191,e));e.call(t)}function Sp(e,t){var r=e.callbacks;if(r!==null)for(e.callbacks=null,e=0;e<r.length;e++)Cp(r[e],t)}var Ao=x(null),eu=x(0);function Fp(e,t){e=Qa,O(eu,e),O(Ao,t),Qa=e|t.baseLanes}function cd(){O(eu,Qa),O(Ao,Ao.current)}function dd(){Qa=eu.current,C(Ao),C(eu)}var Yr=x(null),va=null;function pi(e){var t=e.alternate;O(er,er.current&1),O(Yr,e),va===null&&(t===null||Ao.current!==null||t.memoizedState!==null)&&(va=e)}function md(e){O(er,er.current),O(Yr,e),va===null&&(va=e)}function Mp(e){e.tag===22?(O(er,er.current),O(Yr,e),va===null&&(va=e)):hi()}function hi(){O(er,er.current),O(Yr,Yr.current)}function Ur(e){C(Yr),va===e&&(va=null),C(er)}var er=x(0);function tu(e){for(var t=e;t!==null;){if(t.tag===13){var r=t.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||vm(r)||gm(r)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Wa=0,ln=null,jn=null,or=null,nu=!1,No=!1,Xi=!1,ru=0,Al=0,_o=null,ey=0;function Xn(){throw Error(s(321))}function fd(e,t){if(t===null)return!1;for(var r=0;r<t.length&&r<e.length;r++)if(!Wr(e[r],t[r]))return!1;return!0}function pd(e,t,r,i,u,c){return Wa=c,ln=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,M.H=e===null||e.memoizedState===null?ch:Ad,Xi=!1,c=r(i,u),Xi=!1,No&&(c=Ap(t,r,i,u)),Lp(e),c}function Lp(e){M.H=Tl;var t=jn!==null&&jn.next!==null;if(Wa=0,or=jn=ln=null,nu=!1,Al=0,_o=null,t)throw Error(s(300));e===null||lr||(e=e.dependencies,e!==null&&Us(e)&&(lr=!0))}function Ap(e,t,r,i){ln=e;var u=0;do{if(No&&(_o=null),Al=0,No=!1,25<=u)throw Error(s(301));if(u+=1,or=jn=null,e.updateQueue!=null){var c=e.updateQueue;c.lastEffect=null,c.events=null,c.stores=null,c.memoCache!=null&&(c.memoCache.index=0)}M.H=dh,c=t(r,i)}while(No);return c}function ty(){var e=M.H,t=e.useState()[0];return t=typeof t.then=="function"?Nl(t):t,e=e.useState()[0],(jn!==null?jn.memoizedState:null)!==e&&(ln.flags|=1024),t}function hd(){var e=ru!==0;return ru=0,e}function vd(e,t,r){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~r}function gd(e){if(nu){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}nu=!1}Wa=0,or=jn=ln=null,No=!1,Al=ru=0,_o=null}function Lr(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return or===null?ln.memoizedState=or=e:or=or.next=e,or}function tr(){if(jn===null){var e=ln.alternate;e=e!==null?e.memoizedState:null}else e=jn.next;var t=or===null?ln.memoizedState:or.next;if(t!==null)or=t,jn=e;else{if(e===null)throw ln.alternate===null?Error(s(467)):Error(s(310));jn=e,e={memoizedState:jn.memoizedState,baseState:jn.baseState,baseQueue:jn.baseQueue,queue:jn.queue,next:null},or===null?ln.memoizedState=or=e:or=or.next=e}return or}function au(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Nl(e){var t=Al;return Al+=1,_o===null&&(_o=[]),e=yp(_o,e,t),t=ln,(or===null?t.memoizedState:or.next)===null&&(t=t.alternate,M.H=t===null||t.memoizedState===null?ch:Ad),e}function iu(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Nl(e);if(e.$$typeof===de)return wr(e)}throw Error(s(438,String(e)))}function bd(e){var t=null,r=ln.updateQueue;if(r!==null&&(t=r.memoCache),t==null){var i=ln.alternate;i!==null&&(i=i.updateQueue,i!==null&&(i=i.memoCache,i!=null&&(t={data:i.data.map(function(u){return u.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),r===null&&(r=au(),ln.updateQueue=r),r.memoCache=t,r=t.data[t.index],r===void 0)for(r=t.data[t.index]=Array(e),i=0;i<e;i++)r[i]=_;return t.index++,r}function qa(e,t){return typeof t=="function"?t(e):t}function ou(e){var t=tr();return yd(t,jn,e)}function yd(e,t,r){var i=e.queue;if(i===null)throw Error(s(311));i.lastRenderedReducer=r;var u=e.baseQueue,c=i.pending;if(c!==null){if(u!==null){var f=u.next;u.next=c.next,c.next=f}t.baseQueue=u=c,i.pending=null}if(c=e.baseState,u===null)e.memoizedState=c;else{t=u.next;var y=f=null,R=null,he=t,De=!1;do{var Ie=he.lane&-536870913;if(Ie!==he.lane?(gn&Ie)===Ie:(Wa&Ie)===Ie){var ye=he.revertLane;if(ye===0)R!==null&&(R=R.next={lane:0,revertLane:0,gesture:null,action:he.action,hasEagerState:he.hasEagerState,eagerState:he.eagerState,next:null}),Ie===So&&(De=!0);else if((Wa&ye)===ye){he=he.next,ye===So&&(De=!0);continue}else Ie={lane:0,revertLane:he.revertLane,gesture:null,action:he.action,hasEagerState:he.hasEagerState,eagerState:he.eagerState,next:null},R===null?(y=R=Ie,f=c):R=R.next=Ie,ln.lanes|=ye,bi|=ye;Ie=he.action,Xi&&r(c,Ie),c=he.hasEagerState?he.eagerState:r(c,Ie)}else ye={lane:Ie,revertLane:he.revertLane,gesture:he.gesture,action:he.action,hasEagerState:he.hasEagerState,eagerState:he.eagerState,next:null},R===null?(y=R=ye,f=c):R=R.next=ye,ln.lanes|=Ie,bi|=Ie;he=he.next}while(he!==null&&he!==t);if(R===null?f=c:R.next=y,!Wr(c,e.memoizedState)&&(lr=!0,De&&(r=Fo,r!==null)))throw r;e.memoizedState=c,e.baseState=f,e.baseQueue=R,i.lastRenderedState=c}return u===null&&(i.lanes=0),[e.memoizedState,i.dispatch]}function xd(e){var t=tr(),r=t.queue;if(r===null)throw Error(s(311));r.lastRenderedReducer=e;var i=r.dispatch,u=r.pending,c=t.memoizedState;if(u!==null){r.pending=null;var f=u=u.next;do c=e(c,f.action),f=f.next;while(f!==u);Wr(c,t.memoizedState)||(lr=!0),t.memoizedState=c,t.baseQueue===null&&(t.baseState=c),r.lastRenderedState=c}return[c,i]}function Np(e,t,r){var i=ln,u=tr(),c=yn;if(c){if(r===void 0)throw Error(s(407));r=r()}else r=t();var f=!Wr((jn||u).memoizedState,r);if(f&&(u.memoizedState=r,lr=!0),u=u.queue,kd(Bp.bind(null,i,u,e),[e]),u.getSnapshot!==t||f||or!==null&&or.memoizedState.tag&1){if(i.flags|=2048,To(9,{destroy:void 0},Tp.bind(null,i,u,r,t),null),In===null)throw Error(s(349));c||(Wa&127)!==0||_p(i,t,r)}return r}function _p(e,t,r){e.flags|=16384,e={getSnapshot:t,value:r},t=ln.updateQueue,t===null?(t=au(),ln.updateQueue=t,t.stores=[e]):(r=t.stores,r===null?t.stores=[e]:r.push(e))}function Tp(e,t,r,i){t.value=r,t.getSnapshot=i,zp(t)&&Dp(e)}function Bp(e,t,r){return r(function(){zp(t)&&Dp(e)})}function zp(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!Wr(e,r)}catch{return!0}}function Dp(e){var t=Hi(e,2);t!==null&&$r(t,e,2)}function wd(e){var t=Lr();if(typeof e=="function"){var r=e;if(e=r(),Xi){dn(!0);try{r()}finally{dn(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:qa,lastRenderedState:e},t}function jp(e,t,r,i){return e.baseState=r,yd(e,jn,typeof i=="function"?i:qa)}function ny(e,t,r,i,u){if(uu(e))throw Error(s(485));if(e=t.action,e!==null){var c={payload:u,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(f){c.listeners.push(f)}};M.T!==null?r(!0):c.isTransition=!1,i(c),r=t.pending,r===null?(c.next=t.pending=c,Op(t,c)):(c.next=r.next,t.pending=r.next=c)}}function Op(e,t){var r=t.action,i=t.payload,u=e.state;if(t.isTransition){var c=M.T,f={};M.T=f;try{var y=r(u,i),R=M.S;R!==null&&R(f,y),Pp(e,t,y)}catch(he){Ed(e,t,he)}finally{c!==null&&f.types!==null&&(c.types=f.types),M.T=c}}else try{c=r(u,i),Pp(e,t,c)}catch(he){Ed(e,t,he)}}function Pp(e,t,r){r!==null&&typeof r=="object"&&typeof r.then=="function"?r.then(function(i){$p(e,t,i)},function(i){return Ed(e,t,i)}):$p(e,t,r)}function $p(e,t,r){t.status="fulfilled",t.value=r,Rp(t),e.state=r,t=e.pending,t!==null&&(r=t.next,r===t?e.pending=null:(r=r.next,t.next=r,Op(e,r)))}function Ed(e,t,r){var i=e.pending;if(e.pending=null,i!==null){i=i.next;do t.status="rejected",t.reason=r,Rp(t),t=t.next;while(t!==i)}e.action=null}function Rp(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Ip(e,t){return t}function Hp(e,t){if(yn){var r=In.formState;if(r!==null){e:{var i=ln;if(yn){if(Vn){t:{for(var u=Vn,c=la;u.nodeType!==8;){if(!c){u=null;break t}if(u=sa(u.nextSibling),u===null){u=null;break t}}c=u.data,u=c==="F!"||c==="F"?u:null}if(u){Vn=sa(u.nextSibling),i=u.data==="F!";break e}}ui(i)}i=!1}i&&(t=r[0])}}return r=Lr(),r.memoizedState=r.baseState=t,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ip,lastRenderedState:t},r.queue=i,r=lh.bind(null,ln,i),i.dispatch=r,i=wd(!1),c=Ld.bind(null,ln,!1,i.queue),i=Lr(),u={state:t,dispatch:null,action:e,pending:null},i.queue=u,r=ny.bind(null,ln,u,c,r),u.dispatch=r,i.memoizedState=e,[t,r,!1]}function Vp(e){var t=tr();return Wp(t,jn,e)}function Wp(e,t,r){if(t=yd(e,t,Ip)[0],e=ou(qa)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var i=Nl(t)}catch(f){throw f===Mo?Gs:f}else i=t;t=tr();var u=t.queue,c=u.dispatch;return r!==t.memoizedState&&(ln.flags|=2048,To(9,{destroy:void 0},ry.bind(null,u,r),null)),[i,c,e]}function ry(e,t){e.action=t}function qp(e){var t=tr(),r=jn;if(r!==null)return Wp(t,r,e);tr(),t=t.memoizedState,r=tr();var i=r.queue.dispatch;return r.memoizedState=e,[t,i,!1]}function To(e,t,r,i){return e={tag:e,create:r,deps:i,inst:t,next:null},t=ln.updateQueue,t===null&&(t=au(),ln.updateQueue=t),r=t.lastEffect,r===null?t.lastEffect=e.next=e:(i=r.next,r.next=e,e.next=i,t.lastEffect=e),e}function Yp(){return tr().memoizedState}function lu(e,t,r,i){var u=Lr();ln.flags|=e,u.memoizedState=To(1|t,{destroy:void 0},r,i===void 0?null:i)}function su(e,t,r,i){var u=tr();i=i===void 0?null:i;var c=u.memoizedState.inst;jn!==null&&i!==null&&fd(i,jn.memoizedState.deps)?u.memoizedState=To(t,c,r,i):(ln.flags|=e,u.memoizedState=To(1|t,c,r,i))}function Up(e,t){lu(8390656,8,e,t)}function kd(e,t){su(2048,8,e,t)}function ay(e){ln.flags|=4;var t=ln.updateQueue;if(t===null)t=au(),ln.updateQueue=t,t.events=[e];else{var r=t.events;r===null?t.events=[e]:r.push(e)}}function Zp(e){var t=tr().memoizedState;return ay({ref:t,nextImpl:e}),function(){if((Mn&2)!==0)throw Error(s(440));return t.impl.apply(void 0,arguments)}}function Kp(e,t){return su(4,2,e,t)}function Gp(e,t){return su(4,4,e,t)}function Xp(e,t){if(typeof t=="function"){e=e();var r=t(e);return function(){typeof r=="function"?r():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Qp(e,t,r){r=r!=null?r.concat([e]):null,su(4,4,Xp.bind(null,t,e),r)}function Cd(){}function Jp(e,t){var r=tr();t=t===void 0?null:t;var i=r.memoizedState;return t!==null&&fd(t,i[1])?i[0]:(r.memoizedState=[e,t],e)}function eh(e,t){var r=tr();t=t===void 0?null:t;var i=r.memoizedState;if(t!==null&&fd(t,i[1]))return i[0];if(i=e(),Xi){dn(!0);try{e()}finally{dn(!1)}}return r.memoizedState=[i,t],i}function Sd(e,t,r){return r===void 0||(Wa&1073741824)!==0&&(gn&261930)===0?e.memoizedState=t:(e.memoizedState=r,e=tv(),ln.lanes|=e,bi|=e,r)}function th(e,t,r,i){return Wr(r,t)?r:Ao.current!==null?(e=Sd(e,r,i),Wr(e,t)||(lr=!0),e):(Wa&42)===0||(Wa&1073741824)!==0&&(gn&261930)===0?(lr=!0,e.memoizedState=r):(e=tv(),ln.lanes|=e,bi|=e,t)}function nh(e,t,r,i,u){var c=A.p;A.p=c!==0&&8>c?c:8;var f=M.T,y={};M.T=y,Ld(e,!1,t,r);try{var R=u(),he=M.S;if(he!==null&&he(y,R),R!==null&&typeof R=="object"&&typeof R.then=="function"){var De=Jb(R,i);_l(e,t,De,Gr(e))}else _l(e,t,i,Gr(e))}catch(Ie){_l(e,t,{then:function(){},status:"rejected",reason:Ie},Gr())}finally{A.p=c,f!==null&&y.types!==null&&(f.types=y.types),M.T=f}}function iy(){}function Fd(e,t,r,i){if(e.tag!==5)throw Error(s(476));var u=rh(e).queue;nh(e,u,t,ee,r===null?iy:function(){return ah(e),r(i)})}function rh(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ee,baseState:ee,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:qa,lastRenderedState:ee},next:null};var r={};return t.next={memoizedState:r,baseState:r,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:qa,lastRenderedState:r},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function ah(e){var t=rh(e);t.next===null&&(t=e.alternate.memoizedState),_l(e,t.next.queue,{},Gr())}function Md(){return wr(Zl)}function ih(){return tr().memoizedState}function oh(){return tr().memoizedState}function oy(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var r=Gr();e=mi(r);var i=fi(t,e,r);i!==null&&($r(i,t,r),Fl(i,t,r)),t={cache:nd()},e.payload=t;return}t=t.return}}function ly(e,t,r){var i=Gr();r={lane:i,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},uu(e)?sh(t,r):(r=qc(e,t,r,i),r!==null&&($r(r,e,i),uh(r,t,i)))}function lh(e,t,r){var i=Gr();_l(e,t,r,i)}function _l(e,t,r,i){var u={lane:i,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null};if(uu(e))sh(t,u);else{var c=e.alternate;if(e.lanes===0&&(c===null||c.lanes===0)&&(c=t.lastRenderedReducer,c!==null))try{var f=t.lastRenderedState,y=c(f,r);if(u.hasEagerState=!0,u.eagerState=y,Wr(y,f))return Vs(e,t,u,0),In===null&&Hs(),!1}catch{}if(r=qc(e,t,u,i),r!==null)return $r(r,e,i),uh(r,t,i),!0}return!1}function Ld(e,t,r,i){if(i={lane:2,revertLane:om(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},uu(e)){if(t)throw Error(s(479))}else t=qc(e,r,i,2),t!==null&&$r(t,e,2)}function uu(e){var t=e.alternate;return e===ln||t!==null&&t===ln}function sh(e,t){No=nu=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function uh(e,t,r){if((r&4194048)!==0){var i=t.lanes;i&=e.pendingLanes,r|=i,t.lanes=r,V(e,r)}}var Tl={readContext:wr,use:iu,useCallback:Xn,useContext:Xn,useEffect:Xn,useImperativeHandle:Xn,useLayoutEffect:Xn,useInsertionEffect:Xn,useMemo:Xn,useReducer:Xn,useRef:Xn,useState:Xn,useDebugValue:Xn,useDeferredValue:Xn,useTransition:Xn,useSyncExternalStore:Xn,useId:Xn,useHostTransitionStatus:Xn,useFormState:Xn,useActionState:Xn,useOptimistic:Xn,useMemoCache:Xn,useCacheRefresh:Xn};Tl.useEffectEvent=Xn;var ch={readContext:wr,use:iu,useCallback:function(e,t){return Lr().memoizedState=[e,t===void 0?null:t],e},useContext:wr,useEffect:Up,useImperativeHandle:function(e,t,r){r=r!=null?r.concat([e]):null,lu(4194308,4,Xp.bind(null,t,e),r)},useLayoutEffect:function(e,t){return lu(4194308,4,e,t)},useInsertionEffect:function(e,t){lu(4,2,e,t)},useMemo:function(e,t){var r=Lr();t=t===void 0?null:t;var i=e();if(Xi){dn(!0);try{e()}finally{dn(!1)}}return r.memoizedState=[i,t],i},useReducer:function(e,t,r){var i=Lr();if(r!==void 0){var u=r(t);if(Xi){dn(!0);try{r(t)}finally{dn(!1)}}}else u=t;return i.memoizedState=i.baseState=u,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:u},i.queue=e,e=e.dispatch=ly.bind(null,ln,e),[i.memoizedState,e]},useRef:function(e){var t=Lr();return e={current:e},t.memoizedState=e},useState:function(e){e=wd(e);var t=e.queue,r=lh.bind(null,ln,t);return t.dispatch=r,[e.memoizedState,r]},useDebugValue:Cd,useDeferredValue:function(e,t){var r=Lr();return Sd(r,e,t)},useTransition:function(){var e=wd(!1);return e=nh.bind(null,ln,e.queue,!0,!1),Lr().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,r){var i=ln,u=Lr();if(yn){if(r===void 0)throw Error(s(407));r=r()}else{if(r=t(),In===null)throw Error(s(349));(gn&127)!==0||_p(i,t,r)}u.memoizedState=r;var c={value:r,getSnapshot:t};return u.queue=c,Up(Bp.bind(null,i,c,e),[e]),i.flags|=2048,To(9,{destroy:void 0},Tp.bind(null,i,c,r,t),null),r},useId:function(){var e=Lr(),t=In.identifierPrefix;if(yn){var r=Sa,i=Ca;r=(i&~(1<<32-Ut(i)-1)).toString(32)+r,t="_"+t+"R_"+r,r=ru++,0<r&&(t+="H"+r.toString(32)),t+="_"}else r=ey++,t="_"+t+"r_"+r.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Md,useFormState:Hp,useActionState:Hp,useOptimistic:function(e){var t=Lr();t.memoizedState=t.baseState=e;var r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=r,t=Ld.bind(null,ln,!0,r),r.dispatch=t,[e,t]},useMemoCache:bd,useCacheRefresh:function(){return Lr().memoizedState=oy.bind(null,ln)},useEffectEvent:function(e){var t=Lr(),r={impl:e};return t.memoizedState=r,function(){if((Mn&2)!==0)throw Error(s(440));return r.impl.apply(void 0,arguments)}}},Ad={readContext:wr,use:iu,useCallback:Jp,useContext:wr,useEffect:kd,useImperativeHandle:Qp,useInsertionEffect:Kp,useLayoutEffect:Gp,useMemo:eh,useReducer:ou,useRef:Yp,useState:function(){return ou(qa)},useDebugValue:Cd,useDeferredValue:function(e,t){var r=tr();return th(r,jn.memoizedState,e,t)},useTransition:function(){var e=ou(qa)[0],t=tr().memoizedState;return[typeof e=="boolean"?e:Nl(e),t]},useSyncExternalStore:Np,useId:ih,useHostTransitionStatus:Md,useFormState:Vp,useActionState:Vp,useOptimistic:function(e,t){var r=tr();return jp(r,jn,e,t)},useMemoCache:bd,useCacheRefresh:oh};Ad.useEffectEvent=Zp;var dh={readContext:wr,use:iu,useCallback:Jp,useContext:wr,useEffect:kd,useImperativeHandle:Qp,useInsertionEffect:Kp,useLayoutEffect:Gp,useMemo:eh,useReducer:xd,useRef:Yp,useState:function(){return xd(qa)},useDebugValue:Cd,useDeferredValue:function(e,t){var r=tr();return jn===null?Sd(r,e,t):th(r,jn.memoizedState,e,t)},useTransition:function(){var e=xd(qa)[0],t=tr().memoizedState;return[typeof e=="boolean"?e:Nl(e),t]},useSyncExternalStore:Np,useId:ih,useHostTransitionStatus:Md,useFormState:qp,useActionState:qp,useOptimistic:function(e,t){var r=tr();return jn!==null?jp(r,jn,e,t):(r.baseState=e,[e,r.queue.dispatch])},useMemoCache:bd,useCacheRefresh:oh};dh.useEffectEvent=Zp;function Nd(e,t,r,i){t=e.memoizedState,r=r(i,t),r=r==null?t:S({},t,r),e.memoizedState=r,e.lanes===0&&(e.updateQueue.baseState=r)}var _d={enqueueSetState:function(e,t,r){e=e._reactInternals;var i=Gr(),u=mi(i);u.payload=t,r!=null&&(u.callback=r),t=fi(e,u,i),t!==null&&($r(t,e,i),Fl(t,e,i))},enqueueReplaceState:function(e,t,r){e=e._reactInternals;var i=Gr(),u=mi(i);u.tag=1,u.payload=t,r!=null&&(u.callback=r),t=fi(e,u,i),t!==null&&($r(t,e,i),Fl(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var r=Gr(),i=mi(r);i.tag=2,t!=null&&(i.callback=t),t=fi(e,i,r),t!==null&&($r(t,e,r),Fl(t,e,r))}};function mh(e,t,r,i,u,c,f){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(i,c,f):t.prototype&&t.prototype.isPureReactComponent?!bl(r,i)||!bl(u,c):!0}function fh(e,t,r,i){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(r,i),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(r,i),t.state!==e&&_d.enqueueReplaceState(t,t.state,null)}function Qi(e,t){var r=t;if("ref"in t){r={};for(var i in t)i!=="ref"&&(r[i]=t[i])}if(e=e.defaultProps){r===t&&(r=S({},r));for(var u in e)r[u]===void 0&&(r[u]=e[u])}return r}function ph(e){Is(e)}function hh(e){console.error(e)}function vh(e){Is(e)}function cu(e,t){try{var r=e.onUncaughtError;r(t.value,{componentStack:t.stack})}catch(i){setTimeout(function(){throw i})}}function gh(e,t,r){try{var i=e.onCaughtError;i(r.value,{componentStack:r.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(u){setTimeout(function(){throw u})}}function Td(e,t,r){return r=mi(r),r.tag=3,r.payload={element:null},r.callback=function(){cu(e,t)},r}function bh(e){return e=mi(e),e.tag=3,e}function yh(e,t,r,i){var u=r.type.getDerivedStateFromError;if(typeof u=="function"){var c=i.value;e.payload=function(){return u(c)},e.callback=function(){gh(t,r,i)}}var f=r.stateNode;f!==null&&typeof f.componentDidCatch=="function"&&(e.callback=function(){gh(t,r,i),typeof u!="function"&&(yi===null?yi=new Set([this]):yi.add(this));var y=i.stack;this.componentDidCatch(i.value,{componentStack:y!==null?y:""})})}function sy(e,t,r,i,u){if(r.flags|=32768,i!==null&&typeof i=="object"&&typeof i.then=="function"){if(t=r.alternate,t!==null&&Co(t,r,u,!0),r=Yr.current,r!==null){switch(r.tag){case 31:case 13:return va===null?Eu():r.alternate===null&&Qn===0&&(Qn=3),r.flags&=-257,r.flags|=65536,r.lanes=u,i===Xs?r.flags|=16384:(t=r.updateQueue,t===null?r.updateQueue=new Set([i]):t.add(i),rm(e,i,u)),!1;case 22:return r.flags|=65536,i===Xs?r.flags|=16384:(t=r.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([i])},r.updateQueue=t):(r=t.retryQueue,r===null?t.retryQueue=new Set([i]):r.add(i)),rm(e,i,u)),!1}throw Error(s(435,r.tag))}return rm(e,i,u),Eu(),!1}if(yn)return t=Yr.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=u,i!==Xc&&(e=Error(s(422),{cause:i}),wl(aa(e,r)))):(i!==Xc&&(t=Error(s(423),{cause:i}),wl(aa(t,r))),e=e.current.alternate,e.flags|=65536,u&=-u,e.lanes|=u,i=aa(i,r),u=Td(e.stateNode,i,u),sd(e,u),Qn!==4&&(Qn=2)),!1;var c=Error(s(520),{cause:i});if(c=aa(c,r),Rl===null?Rl=[c]:Rl.push(c),Qn!==4&&(Qn=2),t===null)return!0;i=aa(i,r),r=t;do{switch(r.tag){case 3:return r.flags|=65536,e=u&-u,r.lanes|=e,e=Td(r.stateNode,i,e),sd(r,e),!1;case 1:if(t=r.type,c=r.stateNode,(r.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||c!==null&&typeof c.componentDidCatch=="function"&&(yi===null||!yi.has(c))))return r.flags|=65536,u&=-u,r.lanes|=u,u=bh(u),yh(u,e,r,i),sd(r,u),!1}r=r.return}while(r!==null);return!1}var Bd=Error(s(461)),lr=!1;function Er(e,t,r,i){t.child=e===null?kp(t,null,r,i):Gi(t,e.child,r,i)}function xh(e,t,r,i,u){r=r.render;var c=t.ref;if("ref"in i){var f={};for(var y in i)y!=="ref"&&(f[y]=i[y])}else f=i;return Yi(t),i=pd(e,t,r,f,c,u),y=hd(),e!==null&&!lr?(vd(e,t,u),Ya(e,t,u)):(yn&&y&&Kc(t),t.flags|=1,Er(e,t,i,u),t.child)}function wh(e,t,r,i,u){if(e===null){var c=r.type;return typeof c=="function"&&!Yc(c)&&c.defaultProps===void 0&&r.compare===null?(t.tag=15,t.type=c,Eh(e,t,c,i,u)):(e=qs(r.type,null,i,t,t.mode,u),e.ref=t.ref,e.return=t,t.child=e)}if(c=e.child,!Id(e,u)){var f=c.memoizedProps;if(r=r.compare,r=r!==null?r:bl,r(f,i)&&e.ref===t.ref)return Ya(e,t,u)}return t.flags|=1,e=Ra(c,i),e.ref=t.ref,e.return=t,t.child=e}function Eh(e,t,r,i,u){if(e!==null){var c=e.memoizedProps;if(bl(c,i)&&e.ref===t.ref)if(lr=!1,t.pendingProps=i=c,Id(e,u))(e.flags&131072)!==0&&(lr=!0);else return t.lanes=e.lanes,Ya(e,t,u)}return zd(e,t,r,i,u)}function kh(e,t,r,i){var u=i.children,c=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.mode==="hidden"){if((t.flags&128)!==0){if(c=c!==null?c.baseLanes|r:r,e!==null){for(i=t.child=e.child,u=0;i!==null;)u=u|i.lanes|i.childLanes,i=i.sibling;i=u&~c}else i=0,t.child=null;return Ch(e,t,c,r,i)}if((r&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ks(t,c!==null?c.cachePool:null),c!==null?Fp(t,c):cd(),Mp(t);else return i=t.lanes=536870912,Ch(e,t,c!==null?c.baseLanes|r:r,r,i)}else c!==null?(Ks(t,c.cachePool),Fp(t,c),hi(),t.memoizedState=null):(e!==null&&Ks(t,null),cd(),hi());return Er(e,t,u,r),t.child}function Bl(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Ch(e,t,r,i,u){var c=ad();return c=c===null?null:{parent:ir._currentValue,pool:c},t.memoizedState={baseLanes:r,cachePool:c},e!==null&&Ks(t,null),cd(),Mp(t),e!==null&&Co(e,t,i,!0),t.childLanes=u,null}function du(e,t){return t=fu({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Sh(e,t,r){return Gi(t,e.child,null,r),e=du(t,t.pendingProps),e.flags|=2,Ur(t),t.memoizedState=null,e}function uy(e,t,r){var i=t.pendingProps,u=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(yn){if(i.mode==="hidden")return e=du(t,i),t.lanes=536870912,Bl(null,e);if(md(t),(e=Vn)?(e=$v(e,la),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:li!==null?{id:Ca,overflow:Sa}:null,retryLane:536870912,hydrationErrors:null},r=sp(e),r.return=t,t.child=r,xr=t,Vn=null)):e=null,e===null)throw ui(t);return t.lanes=536870912,null}return du(t,i)}var c=e.memoizedState;if(c!==null){var f=c.dehydrated;if(md(t),u)if(t.flags&256)t.flags&=-257,t=Sh(e,t,r);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(s(558));else if(lr||Co(e,t,r,!1),u=(r&e.childLanes)!==0,lr||u){if(i=In,i!==null&&(f=Fe(i,r),f!==0&&f!==c.retryLane))throw c.retryLane=f,Hi(e,f),$r(i,e,f),Bd;Eu(),t=Sh(e,t,r)}else e=c.treeContext,Vn=sa(f.nextSibling),xr=t,yn=!0,si=null,la=!1,e!==null&&dp(t,e),t=du(t,i),t.flags|=4096;return t}return e=Ra(e.child,{mode:i.mode,children:i.children}),e.ref=t.ref,t.child=e,e.return=t,e}function mu(e,t){var r=t.ref;if(r===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof r!="function"&&typeof r!="object")throw Error(s(284));(e===null||e.ref!==r)&&(t.flags|=4194816)}}function zd(e,t,r,i,u){return Yi(t),r=pd(e,t,r,i,void 0,u),i=hd(),e!==null&&!lr?(vd(e,t,u),Ya(e,t,u)):(yn&&i&&Kc(t),t.flags|=1,Er(e,t,r,u),t.child)}function Fh(e,t,r,i,u,c){return Yi(t),t.updateQueue=null,r=Ap(t,i,r,u),Lp(e),i=hd(),e!==null&&!lr?(vd(e,t,c),Ya(e,t,c)):(yn&&i&&Kc(t),t.flags|=1,Er(e,t,r,c),t.child)}function Mh(e,t,r,i,u){if(Yi(t),t.stateNode===null){var c=xo,f=r.contextType;typeof f=="object"&&f!==null&&(c=wr(f)),c=new r(i,c),t.memoizedState=c.state!==null&&c.state!==void 0?c.state:null,c.updater=_d,t.stateNode=c,c._reactInternals=t,c=t.stateNode,c.props=i,c.state=t.memoizedState,c.refs={},od(t),f=r.contextType,c.context=typeof f=="object"&&f!==null?wr(f):xo,c.state=t.memoizedState,f=r.getDerivedStateFromProps,typeof f=="function"&&(Nd(t,r,f,i),c.state=t.memoizedState),typeof r.getDerivedStateFromProps=="function"||typeof c.getSnapshotBeforeUpdate=="function"||typeof c.UNSAFE_componentWillMount!="function"&&typeof c.componentWillMount!="function"||(f=c.state,typeof c.componentWillMount=="function"&&c.componentWillMount(),typeof c.UNSAFE_componentWillMount=="function"&&c.UNSAFE_componentWillMount(),f!==c.state&&_d.enqueueReplaceState(c,c.state,null),Ll(t,i,c,u),Ml(),c.state=t.memoizedState),typeof c.componentDidMount=="function"&&(t.flags|=4194308),i=!0}else if(e===null){c=t.stateNode;var y=t.memoizedProps,R=Qi(r,y);c.props=R;var he=c.context,De=r.contextType;f=xo,typeof De=="object"&&De!==null&&(f=wr(De));var Ie=r.getDerivedStateFromProps;De=typeof Ie=="function"||typeof c.getSnapshotBeforeUpdate=="function",y=t.pendingProps!==y,De||typeof c.UNSAFE_componentWillReceiveProps!="function"&&typeof c.componentWillReceiveProps!="function"||(y||he!==f)&&fh(t,c,i,f),di=!1;var ye=t.memoizedState;c.state=ye,Ll(t,i,c,u),Ml(),he=t.memoizedState,y||ye!==he||di?(typeof Ie=="function"&&(Nd(t,r,Ie,i),he=t.memoizedState),(R=di||mh(t,r,R,i,ye,he,f))?(De||typeof c.UNSAFE_componentWillMount!="function"&&typeof c.componentWillMount!="function"||(typeof c.componentWillMount=="function"&&c.componentWillMount(),typeof c.UNSAFE_componentWillMount=="function"&&c.UNSAFE_componentWillMount()),typeof c.componentDidMount=="function"&&(t.flags|=4194308)):(typeof c.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=i,t.memoizedState=he),c.props=i,c.state=he,c.context=f,i=R):(typeof c.componentDidMount=="function"&&(t.flags|=4194308),i=!1)}else{c=t.stateNode,ld(e,t),f=t.memoizedProps,De=Qi(r,f),c.props=De,Ie=t.pendingProps,ye=c.context,he=r.contextType,R=xo,typeof he=="object"&&he!==null&&(R=wr(he)),y=r.getDerivedStateFromProps,(he=typeof y=="function"||typeof c.getSnapshotBeforeUpdate=="function")||typeof c.UNSAFE_componentWillReceiveProps!="function"&&typeof c.componentWillReceiveProps!="function"||(f!==Ie||ye!==R)&&fh(t,c,i,R),di=!1,ye=t.memoizedState,c.state=ye,Ll(t,i,c,u),Ml();var Se=t.memoizedState;f!==Ie||ye!==Se||di||e!==null&&e.dependencies!==null&&Us(e.dependencies)?(typeof y=="function"&&(Nd(t,r,y,i),Se=t.memoizedState),(De=di||mh(t,r,De,i,ye,Se,R)||e!==null&&e.dependencies!==null&&Us(e.dependencies))?(he||typeof c.UNSAFE_componentWillUpdate!="function"&&typeof c.componentWillUpdate!="function"||(typeof c.componentWillUpdate=="function"&&c.componentWillUpdate(i,Se,R),typeof c.UNSAFE_componentWillUpdate=="function"&&c.UNSAFE_componentWillUpdate(i,Se,R)),typeof c.componentDidUpdate=="function"&&(t.flags|=4),typeof c.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof c.componentDidUpdate!="function"||f===e.memoizedProps&&ye===e.memoizedState||(t.flags|=4),typeof c.getSnapshotBeforeUpdate!="function"||f===e.memoizedProps&&ye===e.memoizedState||(t.flags|=1024),t.memoizedProps=i,t.memoizedState=Se),c.props=i,c.state=Se,c.context=R,i=De):(typeof c.componentDidUpdate!="function"||f===e.memoizedProps&&ye===e.memoizedState||(t.flags|=4),typeof c.getSnapshotBeforeUpdate!="function"||f===e.memoizedProps&&ye===e.memoizedState||(t.flags|=1024),i=!1)}return c=i,mu(e,t),i=(t.flags&128)!==0,c||i?(c=t.stateNode,r=i&&typeof r.getDerivedStateFromError!="function"?null:c.render(),t.flags|=1,e!==null&&i?(t.child=Gi(t,e.child,null,u),t.child=Gi(t,null,r,u)):Er(e,t,r,u),t.memoizedState=c.state,e=t.child):e=Ya(e,t,u),e}function Lh(e,t,r,i){return Wi(),t.flags|=256,Er(e,t,r,i),t.child}var Dd={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function jd(e){return{baseLanes:e,cachePool:gp()}}function Od(e,t,r){return e=e!==null?e.childLanes&~r:0,t&&(e|=Kr),e}function Ah(e,t,r){var i=t.pendingProps,u=!1,c=(t.flags&128)!==0,f;if((f=c)||(f=e!==null&&e.memoizedState===null?!1:(er.current&2)!==0),f&&(u=!0,t.flags&=-129),f=(t.flags&32)!==0,t.flags&=-33,e===null){if(yn){if(u?pi(t):hi(),(e=Vn)?(e=$v(e,la),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:li!==null?{id:Ca,overflow:Sa}:null,retryLane:536870912,hydrationErrors:null},r=sp(e),r.return=t,t.child=r,xr=t,Vn=null)):e=null,e===null)throw ui(t);return gm(e)?t.lanes=32:t.lanes=536870912,null}var y=i.children;return i=i.fallback,u?(hi(),u=t.mode,y=fu({mode:"hidden",children:y},u),i=Vi(i,u,r,null),y.return=t,i.return=t,y.sibling=i,t.child=y,i=t.child,i.memoizedState=jd(r),i.childLanes=Od(e,f,r),t.memoizedState=Dd,Bl(null,i)):(pi(t),Pd(t,y))}var R=e.memoizedState;if(R!==null&&(y=R.dehydrated,y!==null)){if(c)t.flags&256?(pi(t),t.flags&=-257,t=$d(e,t,r)):t.memoizedState!==null?(hi(),t.child=e.child,t.flags|=128,t=null):(hi(),y=i.fallback,u=t.mode,i=fu({mode:"visible",children:i.children},u),y=Vi(y,u,r,null),y.flags|=2,i.return=t,y.return=t,i.sibling=y,t.child=i,Gi(t,e.child,null,r),i=t.child,i.memoizedState=jd(r),i.childLanes=Od(e,f,r),t.memoizedState=Dd,t=Bl(null,i));else if(pi(t),gm(y)){if(f=y.nextSibling&&y.nextSibling.dataset,f)var he=f.dgst;f=he,i=Error(s(419)),i.stack="",i.digest=f,wl({value:i,source:null,stack:null}),t=$d(e,t,r)}else if(lr||Co(e,t,r,!1),f=(r&e.childLanes)!==0,lr||f){if(f=In,f!==null&&(i=Fe(f,r),i!==0&&i!==R.retryLane))throw R.retryLane=i,Hi(e,i),$r(f,e,i),Bd;vm(y)||Eu(),t=$d(e,t,r)}else vm(y)?(t.flags|=192,t.child=e.child,t=null):(e=R.treeContext,Vn=sa(y.nextSibling),xr=t,yn=!0,si=null,la=!1,e!==null&&dp(t,e),t=Pd(t,i.children),t.flags|=4096);return t}return u?(hi(),y=i.fallback,u=t.mode,R=e.child,he=R.sibling,i=Ra(R,{mode:"hidden",children:i.children}),i.subtreeFlags=R.subtreeFlags&65011712,he!==null?y=Ra(he,y):(y=Vi(y,u,r,null),y.flags|=2),y.return=t,i.return=t,i.sibling=y,t.child=i,Bl(null,i),i=t.child,y=e.child.memoizedState,y===null?y=jd(r):(u=y.cachePool,u!==null?(R=ir._currentValue,u=u.parent!==R?{parent:R,pool:R}:u):u=gp(),y={baseLanes:y.baseLanes|r,cachePool:u}),i.memoizedState=y,i.childLanes=Od(e,f,r),t.memoizedState=Dd,Bl(e.child,i)):(pi(t),r=e.child,e=r.sibling,r=Ra(r,{mode:"visible",children:i.children}),r.return=t,r.sibling=null,e!==null&&(f=t.deletions,f===null?(t.deletions=[e],t.flags|=16):f.push(e)),t.child=r,t.memoizedState=null,r)}function Pd(e,t){return t=fu({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function fu(e,t){return e=qr(22,e,null,t),e.lanes=0,e}function $d(e,t,r){return Gi(t,e.child,null,r),e=Pd(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Nh(e,t,r){e.lanes|=t;var i=e.alternate;i!==null&&(i.lanes|=t),ed(e.return,t,r)}function Rd(e,t,r,i,u,c){var f=e.memoizedState;f===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:i,tail:r,tailMode:u,treeForkCount:c}:(f.isBackwards=t,f.rendering=null,f.renderingStartTime=0,f.last=i,f.tail=r,f.tailMode=u,f.treeForkCount=c)}function _h(e,t,r){var i=t.pendingProps,u=i.revealOrder,c=i.tail;i=i.children;var f=er.current,y=(f&2)!==0;if(y?(f=f&1|2,t.flags|=128):f&=1,O(er,f),Er(e,t,i,r),i=yn?xl:0,!y&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Nh(e,r,t);else if(e.tag===19)Nh(e,r,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(u){case"forwards":for(r=t.child,u=null;r!==null;)e=r.alternate,e!==null&&tu(e)===null&&(u=r),r=r.sibling;r=u,r===null?(u=t.child,t.child=null):(u=r.sibling,r.sibling=null),Rd(t,!1,u,r,c,i);break;case"backwards":case"unstable_legacy-backwards":for(r=null,u=t.child,t.child=null;u!==null;){if(e=u.alternate,e!==null&&tu(e)===null){t.child=u;break}e=u.sibling,u.sibling=r,r=u,u=e}Rd(t,!0,r,null,c,i);break;case"together":Rd(t,!1,null,null,void 0,i);break;default:t.memoizedState=null}return t.child}function Ya(e,t,r){if(e!==null&&(t.dependencies=e.dependencies),bi|=t.lanes,(r&t.childLanes)===0)if(e!==null){if(Co(e,t,r,!1),(r&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(s(153));if(t.child!==null){for(e=t.child,r=Ra(e,e.pendingProps),t.child=r,r.return=t;e.sibling!==null;)e=e.sibling,r=r.sibling=Ra(e,e.pendingProps),r.return=t;r.sibling=null}return t.child}function Id(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Us(e)))}function cy(e,t,r){switch(t.tag){case 3:te(t,t.stateNode.containerInfo),ci(t,ir,e.memoizedState.cache),Wi();break;case 27:case 5:xe(t);break;case 4:te(t,t.stateNode.containerInfo);break;case 10:ci(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,md(t),null;break;case 13:var i=t.memoizedState;if(i!==null)return i.dehydrated!==null?(pi(t),t.flags|=128,null):(r&t.child.childLanes)!==0?Ah(e,t,r):(pi(t),e=Ya(e,t,r),e!==null?e.sibling:null);pi(t);break;case 19:var u=(e.flags&128)!==0;if(i=(r&t.childLanes)!==0,i||(Co(e,t,r,!1),i=(r&t.childLanes)!==0),u){if(i)return _h(e,t,r);t.flags|=128}if(u=t.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),O(er,er.current),i)break;return null;case 22:return t.lanes=0,kh(e,t,r,t.pendingProps);case 24:ci(t,ir,e.memoizedState.cache)}return Ya(e,t,r)}function Th(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps)lr=!0;else{if(!Id(e,r)&&(t.flags&128)===0)return lr=!1,cy(e,t,r);lr=(e.flags&131072)!==0}else lr=!1,yn&&(t.flags&1048576)!==0&&cp(t,xl,t.index);switch(t.lanes=0,t.tag){case 16:e:{var i=t.pendingProps;if(e=Zi(t.elementType),t.type=e,typeof e=="function")Yc(e)?(i=Qi(e,i),t.tag=1,t=Mh(null,t,e,i,r)):(t.tag=0,t=zd(null,t,e,i,r));else{if(e!=null){var u=e.$$typeof;if(u===Ae){t.tag=11,t=xh(null,t,e,i,r);break e}else if(u===k){t.tag=14,t=wh(null,t,e,i,r);break e}}throw t=P(e)||e,Error(s(306,t,""))}}return t;case 0:return zd(e,t,t.type,t.pendingProps,r);case 1:return i=t.type,u=Qi(i,t.pendingProps),Mh(e,t,i,u,r);case 3:e:{if(te(t,t.stateNode.containerInfo),e===null)throw Error(s(387));i=t.pendingProps;var c=t.memoizedState;u=c.element,ld(e,t),Ll(t,i,null,r);var f=t.memoizedState;if(i=f.cache,ci(t,ir,i),i!==c.cache&&td(t,[ir],r,!0),Ml(),i=f.element,c.isDehydrated)if(c={element:i,isDehydrated:!1,cache:f.cache},t.updateQueue.baseState=c,t.memoizedState=c,t.flags&256){t=Lh(e,t,i,r);break e}else if(i!==u){u=aa(Error(s(424)),t),wl(u),t=Lh(e,t,i,r);break e}else for(e=t.stateNode.containerInfo,e.nodeType===9?e=e.body:e=e.nodeName==="HTML"?e.ownerDocument.body:e,Vn=sa(e.firstChild),xr=t,yn=!0,si=null,la=!0,r=kp(t,null,i,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(Wi(),i===u){t=Ya(e,t,r);break e}Er(e,t,i,r)}t=t.child}return t;case 26:return mu(e,t),e===null?(r=qv(t.type,null,t.pendingProps,null))?t.memoizedState=r:yn||(r=t.type,e=t.pendingProps,i=_u(ze.current).createElement(r),i[at]=t,i[Ke]=e,kr(i,r,e),fn(i),t.stateNode=i):t.memoizedState=qv(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return xe(t),e===null&&yn&&(i=t.stateNode=Hv(t.type,t.pendingProps,ze.current),xr=t,la=!0,u=Vn,ki(t.type)?(bm=u,Vn=sa(i.firstChild)):Vn=u),Er(e,t,t.pendingProps.children,r),mu(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&yn&&((u=i=Vn)&&(i=Py(i,t.type,t.pendingProps,la),i!==null?(t.stateNode=i,xr=t,Vn=sa(i.firstChild),la=!1,u=!0):u=!1),u||ui(t)),xe(t),u=t.type,c=t.pendingProps,f=e!==null?e.memoizedProps:null,i=c.children,fm(u,c)?i=null:f!==null&&fm(u,f)&&(t.flags|=32),t.memoizedState!==null&&(u=pd(e,t,ty,null,null,r),Zl._currentValue=u),mu(e,t),Er(e,t,i,r),t.child;case 6:return e===null&&yn&&((e=r=Vn)&&(r=$y(r,t.pendingProps,la),r!==null?(t.stateNode=r,xr=t,Vn=null,e=!0):e=!1),e||ui(t)),null;case 13:return Ah(e,t,r);case 4:return te(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Gi(t,null,i,r):Er(e,t,i,r),t.child;case 11:return xh(e,t,t.type,t.pendingProps,r);case 7:return Er(e,t,t.pendingProps,r),t.child;case 8:return Er(e,t,t.pendingProps.children,r),t.child;case 12:return Er(e,t,t.pendingProps.children,r),t.child;case 10:return i=t.pendingProps,ci(t,t.type,i.value),Er(e,t,i.children,r),t.child;case 9:return u=t.type._context,i=t.pendingProps.children,Yi(t),u=wr(u),i=i(u),t.flags|=1,Er(e,t,i,r),t.child;case 14:return wh(e,t,t.type,t.pendingProps,r);case 15:return Eh(e,t,t.type,t.pendingProps,r);case 19:return _h(e,t,r);case 31:return uy(e,t,r);case 22:return kh(e,t,r,t.pendingProps);case 24:return Yi(t),i=wr(ir),e===null?(u=ad(),u===null&&(u=In,c=nd(),u.pooledCache=c,c.refCount++,c!==null&&(u.pooledCacheLanes|=r),u=c),t.memoizedState={parent:i,cache:u},od(t),ci(t,ir,u)):((e.lanes&r)!==0&&(ld(e,t),Ll(t,null,null,r),Ml()),u=e.memoizedState,c=t.memoizedState,u.parent!==i?(u={parent:i,cache:i},t.memoizedState=u,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=u),ci(t,ir,i)):(i=c.cache,ci(t,ir,i),i!==u.cache&&td(t,[ir],r,!0))),Er(e,t,t.pendingProps.children,r),t.child;case 29:throw t.pendingProps}throw Error(s(156,t.tag))}function Ua(e){e.flags|=4}function Hd(e,t,r,i,u){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(u&335544128)===u)if(e.stateNode.complete)e.flags|=8192;else if(iv())e.flags|=8192;else throw Ki=Xs,id}else e.flags&=-16777217}function Bh(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Gv(t))if(iv())e.flags|=8192;else throw Ki=Xs,id}function pu(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?fe():536870912,e.lanes|=t,jo|=t)}function zl(e,t){if(!yn)switch(e.tailMode){case"hidden":t=e.tail;for(var r=null;t!==null;)t.alternate!==null&&(r=t),t=t.sibling;r===null?e.tail=null:r.sibling=null;break;case"collapsed":r=e.tail;for(var i=null;r!==null;)r.alternate!==null&&(i=r),r=r.sibling;i===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:i.sibling=null}}function Wn(e){var t=e.alternate!==null&&e.alternate.child===e.child,r=0,i=0;if(t)for(var u=e.child;u!==null;)r|=u.lanes|u.childLanes,i|=u.subtreeFlags&65011712,i|=u.flags&65011712,u.return=e,u=u.sibling;else for(u=e.child;u!==null;)r|=u.lanes|u.childLanes,i|=u.subtreeFlags,i|=u.flags,u.return=e,u=u.sibling;return e.subtreeFlags|=i,e.childLanes=r,t}function dy(e,t,r){var i=t.pendingProps;switch(Gc(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Wn(t),null;case 1:return Wn(t),null;case 3:return r=t.stateNode,i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),Va(ir),U(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(ko(t)?Ua(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Qc())),Wn(t),null;case 26:var u=t.type,c=t.memoizedState;return e===null?(Ua(t),c!==null?(Wn(t),Bh(t,c)):(Wn(t),Hd(t,u,null,i,r))):c?c!==e.memoizedState?(Ua(t),Wn(t),Bh(t,c)):(Wn(t),t.flags&=-16777217):(e=e.memoizedProps,e!==i&&Ua(t),Wn(t),Hd(t,u,e,i,r)),null;case 27:if(Ce(t),r=ze.current,u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&Ua(t);else{if(!i){if(t.stateNode===null)throw Error(s(166));return Wn(t),null}e=B.current,ko(t)?mp(t):(e=Hv(u,i,r),t.stateNode=e,Ua(t))}return Wn(t),null;case 5:if(Ce(t),u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&Ua(t);else{if(!i){if(t.stateNode===null)throw Error(s(166));return Wn(t),null}if(c=B.current,ko(t))mp(t);else{var f=_u(ze.current);switch(c){case 1:c=f.createElementNS("http://www.w3.org/2000/svg",u);break;case 2:c=f.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;default:switch(u){case"svg":c=f.createElementNS("http://www.w3.org/2000/svg",u);break;case"math":c=f.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;case"script":c=f.createElement("div"),c.innerHTML="<script><\/script>",c=c.removeChild(c.firstChild);break;case"select":c=typeof i.is=="string"?f.createElement("select",{is:i.is}):f.createElement("select"),i.multiple?c.multiple=!0:i.size&&(c.size=i.size);break;default:c=typeof i.is=="string"?f.createElement(u,{is:i.is}):f.createElement(u)}}c[at]=t,c[Ke]=i;e:for(f=t.child;f!==null;){if(f.tag===5||f.tag===6)c.appendChild(f.stateNode);else if(f.tag!==4&&f.tag!==27&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===t)break e;for(;f.sibling===null;){if(f.return===null||f.return===t)break e;f=f.return}f.sibling.return=f.return,f=f.sibling}t.stateNode=c;e:switch(kr(c,u,i),u){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}i&&Ua(t)}}return Wn(t),Hd(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,r),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==i&&Ua(t);else{if(typeof i!="string"&&t.stateNode===null)throw Error(s(166));if(e=ze.current,ko(t)){if(e=t.stateNode,r=t.memoizedProps,i=null,u=xr,u!==null)switch(u.tag){case 27:case 5:i=u.memoizedProps}e[at]=t,e=!!(e.nodeValue===r||i!==null&&i.suppressHydrationWarning===!0||_v(e.nodeValue,r)),e||ui(t,!0)}else e=_u(e).createTextNode(i),e[at]=t,t.stateNode=e}return Wn(t),null;case 31:if(r=t.memoizedState,e===null||e.memoizedState!==null){if(i=ko(t),r!==null){if(e===null){if(!i)throw Error(s(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(557));e[at]=t}else Wi(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Wn(t),e=!1}else r=Qc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),e=!0;if(!e)return t.flags&256?(Ur(t),t):(Ur(t),null);if((t.flags&128)!==0)throw Error(s(558))}return Wn(t),null;case 13:if(i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(u=ko(t),i!==null&&i.dehydrated!==null){if(e===null){if(!u)throw Error(s(318));if(u=t.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(s(317));u[at]=t}else Wi(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Wn(t),u=!1}else u=Qc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=u),u=!0;if(!u)return t.flags&256?(Ur(t),t):(Ur(t),null)}return Ur(t),(t.flags&128)!==0?(t.lanes=r,t):(r=i!==null,e=e!==null&&e.memoizedState!==null,r&&(i=t.child,u=null,i.alternate!==null&&i.alternate.memoizedState!==null&&i.alternate.memoizedState.cachePool!==null&&(u=i.alternate.memoizedState.cachePool.pool),c=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(c=i.memoizedState.cachePool.pool),c!==u&&(i.flags|=2048)),r!==e&&r&&(t.child.flags|=8192),pu(t,t.updateQueue),Wn(t),null);case 4:return U(),e===null&&sm(t.stateNode.containerInfo),Wn(t),null;case 10:return Va(t.type),Wn(t),null;case 19:if(C(er),i=t.memoizedState,i===null)return Wn(t),null;if(u=(t.flags&128)!==0,c=i.rendering,c===null)if(u)zl(i,!1);else{if(Qn!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(c=tu(e),c!==null){for(t.flags|=128,zl(i,!1),e=c.updateQueue,t.updateQueue=e,pu(t,e),t.subtreeFlags=0,e=r,r=t.child;r!==null;)lp(r,e),r=r.sibling;return O(er,er.current&1|2),yn&&Ia(t,i.treeForkCount),t.child}e=e.sibling}i.tail!==null&&Ge()>yu&&(t.flags|=128,u=!0,zl(i,!1),t.lanes=4194304)}else{if(!u)if(e=tu(c),e!==null){if(t.flags|=128,u=!0,e=e.updateQueue,t.updateQueue=e,pu(t,e),zl(i,!0),i.tail===null&&i.tailMode==="hidden"&&!c.alternate&&!yn)return Wn(t),null}else 2*Ge()-i.renderingStartTime>yu&&r!==536870912&&(t.flags|=128,u=!0,zl(i,!1),t.lanes=4194304);i.isBackwards?(c.sibling=t.child,t.child=c):(e=i.last,e!==null?e.sibling=c:t.child=c,i.last=c)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=Ge(),e.sibling=null,r=er.current,O(er,u?r&1|2:r&1),yn&&Ia(t,i.treeForkCount),e):(Wn(t),null);case 22:case 23:return Ur(t),dd(),i=t.memoizedState!==null,e!==null?e.memoizedState!==null!==i&&(t.flags|=8192):i&&(t.flags|=8192),i?(r&536870912)!==0&&(t.flags&128)===0&&(Wn(t),t.subtreeFlags&6&&(t.flags|=8192)):Wn(t),r=t.updateQueue,r!==null&&pu(t,r.retryQueue),r=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(r=e.memoizedState.cachePool.pool),i=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),i!==r&&(t.flags|=2048),e!==null&&C(Ui),null;case 24:return r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Va(ir),Wn(t),null;case 25:return null;case 30:return null}throw Error(s(156,t.tag))}function my(e,t){switch(Gc(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Va(ir),U(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Ce(t),null;case 31:if(t.memoizedState!==null){if(Ur(t),t.alternate===null)throw Error(s(340));Wi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Ur(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(s(340));Wi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return C(er),null;case 4:return U(),null;case 10:return Va(t.type),null;case 22:case 23:return Ur(t),dd(),e!==null&&C(Ui),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Va(ir),null;case 25:return null;default:return null}}function zh(e,t){switch(Gc(t),t.tag){case 3:Va(ir),U();break;case 26:case 27:case 5:Ce(t);break;case 4:U();break;case 31:t.memoizedState!==null&&Ur(t);break;case 13:Ur(t);break;case 19:C(er);break;case 10:Va(t.type);break;case 22:case 23:Ur(t),dd(),e!==null&&C(Ui);break;case 24:Va(ir)}}function Dl(e,t){try{var r=t.updateQueue,i=r!==null?r.lastEffect:null;if(i!==null){var u=i.next;r=u;do{if((r.tag&e)===e){i=void 0;var c=r.create,f=r.inst;i=c(),f.destroy=i}r=r.next}while(r!==u)}}catch(y){zn(t,t.return,y)}}function vi(e,t,r){try{var i=t.updateQueue,u=i!==null?i.lastEffect:null;if(u!==null){var c=u.next;i=c;do{if((i.tag&e)===e){var f=i.inst,y=f.destroy;if(y!==void 0){f.destroy=void 0,u=t;var R=r,he=y;try{he()}catch(De){zn(u,R,De)}}}i=i.next}while(i!==c)}}catch(De){zn(t,t.return,De)}}function Dh(e){var t=e.updateQueue;if(t!==null){var r=e.stateNode;try{Sp(t,r)}catch(i){zn(e,e.return,i)}}}function jh(e,t,r){r.props=Qi(e.type,e.memoizedProps),r.state=e.memoizedState;try{r.componentWillUnmount()}catch(i){zn(e,t,i)}}function jl(e,t){try{var r=e.ref;if(r!==null){switch(e.tag){case 26:case 27:case 5:var i=e.stateNode;break;case 30:i=e.stateNode;break;default:i=e.stateNode}typeof r=="function"?e.refCleanup=r(i):r.current=i}}catch(u){zn(e,t,u)}}function Fa(e,t){var r=e.ref,i=e.refCleanup;if(r!==null)if(typeof i=="function")try{i()}catch(u){zn(e,t,u)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof r=="function")try{r(null)}catch(u){zn(e,t,u)}else r.current=null}function Oh(e){var t=e.type,r=e.memoizedProps,i=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":r.autoFocus&&i.focus();break e;case"img":r.src?i.src=r.src:r.srcSet&&(i.srcset=r.srcSet)}}catch(u){zn(e,e.return,u)}}function Vd(e,t,r){try{var i=e.stateNode;Ty(i,e.type,r,t),i[Ke]=t}catch(u){zn(e,e.return,u)}}function Ph(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&ki(e.type)||e.tag===4}function Wd(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Ph(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&ki(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function qd(e,t,r){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r).insertBefore(e,t):(t=r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,t.appendChild(e),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=ar));else if(i!==4&&(i===27&&ki(e.type)&&(r=e.stateNode,t=null),e=e.child,e!==null))for(qd(e,t,r),e=e.sibling;e!==null;)qd(e,t,r),e=e.sibling}function hu(e,t,r){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(i!==4&&(i===27&&ki(e.type)&&(r=e.stateNode),e=e.child,e!==null))for(hu(e,t,r),e=e.sibling;e!==null;)hu(e,t,r),e=e.sibling}function $h(e){var t=e.stateNode,r=e.memoizedProps;try{for(var i=e.type,u=t.attributes;u.length;)t.removeAttributeNode(u[0]);kr(t,i,r),t[at]=e,t[Ke]=r}catch(c){zn(e,e.return,c)}}var Za=!1,sr=!1,Yd=!1,Rh=typeof WeakSet=="function"?WeakSet:Set,vr=null;function fy(e,t){if(e=e.containerInfo,dm=Pu,e=Qf(e),$c(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var i=r.getSelection&&r.getSelection();if(i&&i.rangeCount!==0){r=i.anchorNode;var u=i.anchorOffset,c=i.focusNode;i=i.focusOffset;try{r.nodeType,c.nodeType}catch{r=null;break e}var f=0,y=-1,R=-1,he=0,De=0,Ie=e,ye=null;t:for(;;){for(var Se;Ie!==r||u!==0&&Ie.nodeType!==3||(y=f+u),Ie!==c||i!==0&&Ie.nodeType!==3||(R=f+i),Ie.nodeType===3&&(f+=Ie.nodeValue.length),(Se=Ie.firstChild)!==null;)ye=Ie,Ie=Se;for(;;){if(Ie===e)break t;if(ye===r&&++he===u&&(y=f),ye===c&&++De===i&&(R=f),(Se=Ie.nextSibling)!==null)break;Ie=ye,ye=Ie.parentNode}Ie=Se}r=y===-1||R===-1?null:{start:y,end:R}}else r=null}r=r||{start:0,end:0}}else r=null;for(mm={focusedElem:e,selectionRange:r},Pu=!1,vr=t;vr!==null;)if(t=vr,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,vr=e;else for(;vr!==null;){switch(t=vr,c=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(r=0;r<e.length;r++)u=e[r],u.ref.impl=u.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&c!==null){e=void 0,r=t,u=c.memoizedProps,c=c.memoizedState,i=r.stateNode;try{var At=Qi(r.type,u);e=i.getSnapshotBeforeUpdate(At,c),i.__reactInternalSnapshotBeforeUpdate=e}catch(Gt){zn(r,r.return,Gt)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,r=e.nodeType,r===9)hm(e);else if(r===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":hm(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(s(163))}if(e=t.sibling,e!==null){e.return=t.return,vr=e;break}vr=t.return}}function Ih(e,t,r){var i=r.flags;switch(r.tag){case 0:case 11:case 15:Ga(e,r),i&4&&Dl(5,r);break;case 1:if(Ga(e,r),i&4)if(e=r.stateNode,t===null)try{e.componentDidMount()}catch(f){zn(r,r.return,f)}else{var u=Qi(r.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(u,t,e.__reactInternalSnapshotBeforeUpdate)}catch(f){zn(r,r.return,f)}}i&64&&Dh(r),i&512&&jl(r,r.return);break;case 3:if(Ga(e,r),i&64&&(e=r.updateQueue,e!==null)){if(t=null,r.child!==null)switch(r.child.tag){case 27:case 5:t=r.child.stateNode;break;case 1:t=r.child.stateNode}try{Sp(e,t)}catch(f){zn(r,r.return,f)}}break;case 27:t===null&&i&4&&$h(r);case 26:case 5:Ga(e,r),t===null&&i&4&&Oh(r),i&512&&jl(r,r.return);break;case 12:Ga(e,r);break;case 31:Ga(e,r),i&4&&Wh(e,r);break;case 13:Ga(e,r),i&4&&qh(e,r),i&64&&(e=r.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(r=Ey.bind(null,r),Ry(e,r))));break;case 22:if(i=r.memoizedState!==null||Za,!i){t=t!==null&&t.memoizedState!==null||sr,u=Za;var c=sr;Za=i,(sr=t)&&!c?Xa(e,r,(r.subtreeFlags&8772)!==0):Ga(e,r),Za=u,sr=c}break;case 30:break;default:Ga(e,r)}}function Hh(e){var t=e.alternate;t!==null&&(e.alternate=null,Hh(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&pn(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Un=null,Dr=!1;function Ka(e,t,r){for(r=r.child;r!==null;)Vh(e,t,r),r=r.sibling}function Vh(e,t,r){if(Mt&&typeof Mt.onCommitFiberUnmount=="function")try{Mt.onCommitFiberUnmount(pt,r)}catch{}switch(r.tag){case 26:sr||Fa(r,t),Ka(e,t,r),r.memoizedState?r.memoizedState.count--:r.stateNode&&(r=r.stateNode,r.parentNode.removeChild(r));break;case 27:sr||Fa(r,t);var i=Un,u=Dr;ki(r.type)&&(Un=r.stateNode,Dr=!1),Ka(e,t,r),ql(r.stateNode),Un=i,Dr=u;break;case 5:sr||Fa(r,t);case 6:if(i=Un,u=Dr,Un=null,Ka(e,t,r),Un=i,Dr=u,Un!==null)if(Dr)try{(Un.nodeType===9?Un.body:Un.nodeName==="HTML"?Un.ownerDocument.body:Un).removeChild(r.stateNode)}catch(c){zn(r,t,c)}else try{Un.removeChild(r.stateNode)}catch(c){zn(r,t,c)}break;case 18:Un!==null&&(Dr?(e=Un,Ov(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,r.stateNode),Wo(e)):Ov(Un,r.stateNode));break;case 4:i=Un,u=Dr,Un=r.stateNode.containerInfo,Dr=!0,Ka(e,t,r),Un=i,Dr=u;break;case 0:case 11:case 14:case 15:vi(2,r,t),sr||vi(4,r,t),Ka(e,t,r);break;case 1:sr||(Fa(r,t),i=r.stateNode,typeof i.componentWillUnmount=="function"&&jh(r,t,i)),Ka(e,t,r);break;case 21:Ka(e,t,r);break;case 22:sr=(i=sr)||r.memoizedState!==null,Ka(e,t,r),sr=i;break;default:Ka(e,t,r)}}function Wh(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Wo(e)}catch(r){zn(t,t.return,r)}}}function qh(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Wo(e)}catch(r){zn(t,t.return,r)}}function py(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Rh),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Rh),t;default:throw Error(s(435,e.tag))}}function vu(e,t){var r=py(e);t.forEach(function(i){if(!r.has(i)){r.add(i);var u=ky.bind(null,e,i);i.then(u,u)}})}function jr(e,t){var r=t.deletions;if(r!==null)for(var i=0;i<r.length;i++){var u=r[i],c=e,f=t,y=f;e:for(;y!==null;){switch(y.tag){case 27:if(ki(y.type)){Un=y.stateNode,Dr=!1;break e}break;case 5:Un=y.stateNode,Dr=!1;break e;case 3:case 4:Un=y.stateNode.containerInfo,Dr=!0;break e}y=y.return}if(Un===null)throw Error(s(160));Vh(c,f,u),Un=null,Dr=!1,c=u.alternate,c!==null&&(c.return=null),u.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Yh(t,e),t=t.sibling}var ga=null;function Yh(e,t){var r=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:jr(t,e),Or(e),i&4&&(vi(3,e,e.return),Dl(3,e),vi(5,e,e.return));break;case 1:jr(t,e),Or(e),i&512&&(sr||r===null||Fa(r,r.return)),i&64&&Za&&(e=e.updateQueue,e!==null&&(i=e.callbacks,i!==null&&(r=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=r===null?i:r.concat(i))));break;case 26:var u=ga;if(jr(t,e),Or(e),i&512&&(sr||r===null||Fa(r,r.return)),i&4){var c=r!==null?r.memoizedState:null;if(i=e.memoizedState,r===null)if(i===null)if(e.stateNode===null){e:{i=e.type,r=e.memoizedProps,u=u.ownerDocument||u;t:switch(i){case"title":c=u.getElementsByTagName("title")[0],(!c||c[un]||c[at]||c.namespaceURI==="http://www.w3.org/2000/svg"||c.hasAttribute("itemprop"))&&(c=u.createElement(i),u.head.insertBefore(c,u.querySelector("head > title"))),kr(c,i,r),c[at]=e,fn(c),i=c;break e;case"link":var f=Zv("link","href",u).get(i+(r.href||""));if(f){for(var y=0;y<f.length;y++)if(c=f[y],c.getAttribute("href")===(r.href==null||r.href===""?null:r.href)&&c.getAttribute("rel")===(r.rel==null?null:r.rel)&&c.getAttribute("title")===(r.title==null?null:r.title)&&c.getAttribute("crossorigin")===(r.crossOrigin==null?null:r.crossOrigin)){f.splice(y,1);break t}}c=u.createElement(i),kr(c,i,r),u.head.appendChild(c);break;case"meta":if(f=Zv("meta","content",u).get(i+(r.content||""))){for(y=0;y<f.length;y++)if(c=f[y],c.getAttribute("content")===(r.content==null?null:""+r.content)&&c.getAttribute("name")===(r.name==null?null:r.name)&&c.getAttribute("property")===(r.property==null?null:r.property)&&c.getAttribute("http-equiv")===(r.httpEquiv==null?null:r.httpEquiv)&&c.getAttribute("charset")===(r.charSet==null?null:r.charSet)){f.splice(y,1);break t}}c=u.createElement(i),kr(c,i,r),u.head.appendChild(c);break;default:throw Error(s(468,i))}c[at]=e,fn(c),i=c}e.stateNode=i}else Kv(u,e.type,e.stateNode);else e.stateNode=Uv(u,i,e.memoizedProps);else c!==i?(c===null?r.stateNode!==null&&(r=r.stateNode,r.parentNode.removeChild(r)):c.count--,i===null?Kv(u,e.type,e.stateNode):Uv(u,i,e.memoizedProps)):i===null&&e.stateNode!==null&&Vd(e,e.memoizedProps,r.memoizedProps)}break;case 27:jr(t,e),Or(e),i&512&&(sr||r===null||Fa(r,r.return)),r!==null&&i&4&&Vd(e,e.memoizedProps,r.memoizedProps);break;case 5:if(jr(t,e),Or(e),i&512&&(sr||r===null||Fa(r,r.return)),e.flags&32){u=e.stateNode;try{ht(u,"")}catch(At){zn(e,e.return,At)}}i&4&&e.stateNode!=null&&(u=e.memoizedProps,Vd(e,u,r!==null?r.memoizedProps:u)),i&1024&&(Yd=!0);break;case 6:if(jr(t,e),Or(e),i&4){if(e.stateNode===null)throw Error(s(162));i=e.memoizedProps,r=e.stateNode;try{r.nodeValue=i}catch(At){zn(e,e.return,At)}}break;case 3:if(zu=null,u=ga,ga=Tu(t.containerInfo),jr(t,e),ga=u,Or(e),i&4&&r!==null&&r.memoizedState.isDehydrated)try{Wo(t.containerInfo)}catch(At){zn(e,e.return,At)}Yd&&(Yd=!1,Uh(e));break;case 4:i=ga,ga=Tu(e.stateNode.containerInfo),jr(t,e),Or(e),ga=i;break;case 12:jr(t,e),Or(e);break;case 31:jr(t,e),Or(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,vu(e,i)));break;case 13:jr(t,e),Or(e),e.child.flags&8192&&e.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(bu=Ge()),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,vu(e,i)));break;case 22:u=e.memoizedState!==null;var R=r!==null&&r.memoizedState!==null,he=Za,De=sr;if(Za=he||u,sr=De||R,jr(t,e),sr=De,Za=he,Or(e),i&8192)e:for(t=e.stateNode,t._visibility=u?t._visibility&-2:t._visibility|1,u&&(r===null||R||Za||sr||Ji(e)),r=null,t=e;;){if(t.tag===5||t.tag===26){if(r===null){R=r=t;try{if(c=R.stateNode,u)f=c.style,typeof f.setProperty=="function"?f.setProperty("display","none","important"):f.display="none";else{y=R.stateNode;var Ie=R.memoizedProps.style,ye=Ie!=null&&Ie.hasOwnProperty("display")?Ie.display:null;y.style.display=ye==null||typeof ye=="boolean"?"":(""+ye).trim()}}catch(At){zn(R,R.return,At)}}}else if(t.tag===6){if(r===null){R=t;try{R.stateNode.nodeValue=u?"":R.memoizedProps}catch(At){zn(R,R.return,At)}}}else if(t.tag===18){if(r===null){R=t;try{var Se=R.stateNode;u?Pv(Se,!0):Pv(R.stateNode,!1)}catch(At){zn(R,R.return,At)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;r===t&&(r=null),t=t.return}r===t&&(r=null),t.sibling.return=t.return,t=t.sibling}i&4&&(i=e.updateQueue,i!==null&&(r=i.retryQueue,r!==null&&(i.retryQueue=null,vu(e,r))));break;case 19:jr(t,e),Or(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,vu(e,i)));break;case 30:break;case 21:break;default:jr(t,e),Or(e)}}function Or(e){var t=e.flags;if(t&2){try{for(var r,i=e.return;i!==null;){if(Ph(i)){r=i;break}i=i.return}if(r==null)throw Error(s(160));switch(r.tag){case 27:var u=r.stateNode,c=Wd(e);hu(e,c,u);break;case 5:var f=r.stateNode;r.flags&32&&(ht(f,""),r.flags&=-33);var y=Wd(e);hu(e,y,f);break;case 3:case 4:var R=r.stateNode.containerInfo,he=Wd(e);qd(e,he,R);break;default:throw Error(s(161))}}catch(De){zn(e,e.return,De)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Uh(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Uh(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Ga(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Ih(e,t.alternate,t),t=t.sibling}function Ji(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:vi(4,t,t.return),Ji(t);break;case 1:Fa(t,t.return);var r=t.stateNode;typeof r.componentWillUnmount=="function"&&jh(t,t.return,r),Ji(t);break;case 27:ql(t.stateNode);case 26:case 5:Fa(t,t.return),Ji(t);break;case 22:t.memoizedState===null&&Ji(t);break;case 30:Ji(t);break;default:Ji(t)}e=e.sibling}}function Xa(e,t,r){for(r=r&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var i=t.alternate,u=e,c=t,f=c.flags;switch(c.tag){case 0:case 11:case 15:Xa(u,c,r),Dl(4,c);break;case 1:if(Xa(u,c,r),i=c,u=i.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(he){zn(i,i.return,he)}if(i=c,u=i.updateQueue,u!==null){var y=i.stateNode;try{var R=u.shared.hiddenCallbacks;if(R!==null)for(u.shared.hiddenCallbacks=null,u=0;u<R.length;u++)Cp(R[u],y)}catch(he){zn(i,i.return,he)}}r&&f&64&&Dh(c),jl(c,c.return);break;case 27:$h(c);case 26:case 5:Xa(u,c,r),r&&i===null&&f&4&&Oh(c),jl(c,c.return);break;case 12:Xa(u,c,r);break;case 31:Xa(u,c,r),r&&f&4&&Wh(u,c);break;case 13:Xa(u,c,r),r&&f&4&&qh(u,c);break;case 22:c.memoizedState===null&&Xa(u,c,r),jl(c,c.return);break;case 30:break;default:Xa(u,c,r)}t=t.sibling}}function Ud(e,t){var r=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(r=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==r&&(e!=null&&e.refCount++,r!=null&&El(r))}function Zd(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&El(e))}function ba(e,t,r,i){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Zh(e,t,r,i),t=t.sibling}function Zh(e,t,r,i){var u=t.flags;switch(t.tag){case 0:case 11:case 15:ba(e,t,r,i),u&2048&&Dl(9,t);break;case 1:ba(e,t,r,i);break;case 3:ba(e,t,r,i),u&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&El(e)));break;case 12:if(u&2048){ba(e,t,r,i),e=t.stateNode;try{var c=t.memoizedProps,f=c.id,y=c.onPostCommit;typeof y=="function"&&y(f,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(R){zn(t,t.return,R)}}else ba(e,t,r,i);break;case 31:ba(e,t,r,i);break;case 13:ba(e,t,r,i);break;case 23:break;case 22:c=t.stateNode,f=t.alternate,t.memoizedState!==null?c._visibility&2?ba(e,t,r,i):Ol(e,t):c._visibility&2?ba(e,t,r,i):(c._visibility|=2,Bo(e,t,r,i,(t.subtreeFlags&10256)!==0||!1)),u&2048&&Ud(f,t);break;case 24:ba(e,t,r,i),u&2048&&Zd(t.alternate,t);break;default:ba(e,t,r,i)}}function Bo(e,t,r,i,u){for(u=u&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var c=e,f=t,y=r,R=i,he=f.flags;switch(f.tag){case 0:case 11:case 15:Bo(c,f,y,R,u),Dl(8,f);break;case 23:break;case 22:var De=f.stateNode;f.memoizedState!==null?De._visibility&2?Bo(c,f,y,R,u):Ol(c,f):(De._visibility|=2,Bo(c,f,y,R,u)),u&&he&2048&&Ud(f.alternate,f);break;case 24:Bo(c,f,y,R,u),u&&he&2048&&Zd(f.alternate,f);break;default:Bo(c,f,y,R,u)}t=t.sibling}}function Ol(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var r=e,i=t,u=i.flags;switch(i.tag){case 22:Ol(r,i),u&2048&&Ud(i.alternate,i);break;case 24:Ol(r,i),u&2048&&Zd(i.alternate,i);break;default:Ol(r,i)}t=t.sibling}}var Pl=8192;function zo(e,t,r){if(e.subtreeFlags&Pl)for(e=e.child;e!==null;)Kh(e,t,r),e=e.sibling}function Kh(e,t,r){switch(e.tag){case 26:zo(e,t,r),e.flags&Pl&&e.memoizedState!==null&&Qy(r,ga,e.memoizedState,e.memoizedProps);break;case 5:zo(e,t,r);break;case 3:case 4:var i=ga;ga=Tu(e.stateNode.containerInfo),zo(e,t,r),ga=i;break;case 22:e.memoizedState===null&&(i=e.alternate,i!==null&&i.memoizedState!==null?(i=Pl,Pl=16777216,zo(e,t,r),Pl=i):zo(e,t,r));break;default:zo(e,t,r)}}function Gh(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function $l(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var r=0;r<t.length;r++){var i=t[r];vr=i,Qh(i,e)}Gh(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Xh(e),e=e.sibling}function Xh(e){switch(e.tag){case 0:case 11:case 15:$l(e),e.flags&2048&&vi(9,e,e.return);break;case 3:$l(e);break;case 12:$l(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,gu(e)):$l(e);break;default:$l(e)}}function gu(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var r=0;r<t.length;r++){var i=t[r];vr=i,Qh(i,e)}Gh(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:vi(8,t,t.return),gu(t);break;case 22:r=t.stateNode,r._visibility&2&&(r._visibility&=-3,gu(t));break;default:gu(t)}e=e.sibling}}function Qh(e,t){for(;vr!==null;){var r=vr;switch(r.tag){case 0:case 11:case 15:vi(8,r,t);break;case 23:case 22:if(r.memoizedState!==null&&r.memoizedState.cachePool!==null){var i=r.memoizedState.cachePool.pool;i!=null&&i.refCount++}break;case 24:El(r.memoizedState.cache)}if(i=r.child,i!==null)i.return=r,vr=i;else e:for(r=e;vr!==null;){i=vr;var u=i.sibling,c=i.return;if(Hh(i),i===r){vr=null;break e}if(u!==null){u.return=c,vr=u;break e}vr=c}}}var hy={getCacheForType:function(e){var t=wr(ir),r=t.data.get(e);return r===void 0&&(r=e(),t.data.set(e,r)),r},cacheSignal:function(){return wr(ir).controller.signal}},vy=typeof WeakMap=="function"?WeakMap:Map,Mn=0,In=null,hn=null,gn=0,Bn=0,Zr=null,gi=!1,Do=!1,Kd=!1,Qa=0,Qn=0,bi=0,eo=0,Gd=0,Kr=0,jo=0,Rl=null,Pr=null,Xd=!1,bu=0,Jh=0,yu=1/0,xu=null,yi=null,mr=0,xi=null,Oo=null,Ja=0,Qd=0,Jd=null,ev=null,Il=0,em=null;function Gr(){return(Mn&2)!==0&&gn!==0?gn&-gn:M.T!==null?om():ct()}function tv(){if(Kr===0)if((gn&536870912)===0||yn){var e=Tt;Tt<<=1,(Tt&3932160)===0&&(Tt=262144),Kr=e}else Kr=536870912;return e=Yr.current,e!==null&&(e.flags|=32),Kr}function $r(e,t,r){(e===In&&(Bn===2||Bn===9)||e.cancelPendingCommit!==null)&&(Po(e,0),wi(e,gn,Kr,!1)),Qe(e,r),((Mn&2)===0||e!==In)&&(e===In&&((Mn&2)===0&&(eo|=r),Qn===4&&wi(e,gn,Kr,!1)),Ma(e))}function nv(e,t,r){if((Mn&6)!==0)throw Error(s(327));var i=!r&&(t&127)===0&&(t&e.expiredLanes)===0||wn(e,t),u=i?yy(e,t):nm(e,t,!0),c=i;do{if(u===0){Do&&!i&&wi(e,t,0,!1);break}else{if(r=e.current.alternate,c&&!gy(r)){u=nm(e,t,!1),c=!1;continue}if(u===2){if(c=t,e.errorRecoveryDisabledLanes&c)var f=0;else f=e.pendingLanes&-536870913,f=f!==0?f:f&536870912?536870912:0;if(f!==0){t=f;e:{var y=e;u=Rl;var R=y.current.memoizedState.isDehydrated;if(R&&(Po(y,f).flags|=256),f=nm(y,f,!1),f!==2){if(Kd&&!R){y.errorRecoveryDisabledLanes|=c,eo|=c,u=4;break e}c=Pr,Pr=u,c!==null&&(Pr===null?Pr=c:Pr.push.apply(Pr,c))}u=f}if(c=!1,u!==2)continue}}if(u===1){Po(e,0),wi(e,t,0,!0);break}e:{switch(i=e,c=u,c){case 0:case 1:throw Error(s(345));case 4:if((t&4194048)!==t)break;case 6:wi(i,t,Kr,!gi);break e;case 2:Pr=null;break;case 3:case 5:break;default:throw Error(s(329))}if((t&62914560)===t&&(u=bu+300-Ge(),10<u)){if(wi(i,t,Kr,!gi),nn(i,0,!0)!==0)break e;Ja=t,i.timeoutHandle=Dv(rv.bind(null,i,r,Pr,xu,Xd,t,Kr,eo,jo,gi,c,"Throttled",-0,0),u);break e}rv(i,r,Pr,xu,Xd,t,Kr,eo,jo,gi,c,null,-0,0)}}break}while(!0);Ma(e)}function rv(e,t,r,i,u,c,f,y,R,he,De,Ie,ye,Se){if(e.timeoutHandle=-1,Ie=t.subtreeFlags,Ie&8192||(Ie&16785408)===16785408){Ie={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ar},Kh(t,c,Ie);var At=(c&62914560)===c?bu-Ge():(c&4194048)===c?Jh-Ge():0;if(At=Jy(Ie,At),At!==null){Ja=c,e.cancelPendingCommit=At(dv.bind(null,e,t,c,r,i,u,f,y,R,De,Ie,null,ye,Se)),wi(e,c,f,!he);return}}dv(e,t,c,r,i,u,f,y,R)}function gy(e){for(var t=e;;){var r=t.tag;if((r===0||r===11||r===15)&&t.flags&16384&&(r=t.updateQueue,r!==null&&(r=r.stores,r!==null)))for(var i=0;i<r.length;i++){var u=r[i],c=u.getSnapshot;u=u.value;try{if(!Wr(c(),u))return!1}catch{return!1}}if(r=t.child,t.subtreeFlags&16384&&r!==null)r.return=t,t=r;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function wi(e,t,r,i){t&=~Gd,t&=~eo,e.suspendedLanes|=t,e.pingedLanes&=~t,i&&(e.warmLanes|=t),i=e.expirationTimes;for(var u=t;0<u;){var c=31-Ut(u),f=1<<c;i[c]=-1,u&=~f}r!==0&&z(e,r,t)}function wu(){return(Mn&6)===0?(Hl(0),!1):!0}function tm(){if(hn!==null){if(Bn===0)var e=hn.return;else e=hn,Ha=qi=null,gd(e),Lo=null,Cl=0,e=hn;for(;e!==null;)zh(e.alternate,e),e=e.return;hn=null}}function Po(e,t){var r=e.timeoutHandle;r!==-1&&(e.timeoutHandle=-1,Dy(r)),r=e.cancelPendingCommit,r!==null&&(e.cancelPendingCommit=null,r()),Ja=0,tm(),In=e,hn=r=Ra(e.current,null),gn=t,Bn=0,Zr=null,gi=!1,Do=wn(e,t),Kd=!1,jo=Kr=Gd=eo=bi=Qn=0,Pr=Rl=null,Xd=!1,(t&8)!==0&&(t|=t&32);var i=e.entangledLanes;if(i!==0)for(e=e.entanglements,i&=t;0<i;){var u=31-Ut(i),c=1<<u;t|=e[u],i&=~c}return Qa=t,Hs(),r}function av(e,t){ln=null,M.H=Tl,t===Mo||t===Gs?(t=xp(),Bn=3):t===id?(t=xp(),Bn=4):Bn=t===Bd?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Zr=t,hn===null&&(Qn=1,cu(e,aa(t,e.current)))}function iv(){var e=Yr.current;return e===null?!0:(gn&4194048)===gn?va===null:(gn&62914560)===gn||(gn&536870912)!==0?e===va:!1}function ov(){var e=M.H;return M.H=Tl,e===null?Tl:e}function lv(){var e=M.A;return M.A=hy,e}function Eu(){Qn=4,gi||(gn&4194048)!==gn&&Yr.current!==null||(Do=!0),(bi&134217727)===0&&(eo&134217727)===0||In===null||wi(In,gn,Kr,!1)}function nm(e,t,r){var i=Mn;Mn|=2;var u=ov(),c=lv();(In!==e||gn!==t)&&(xu=null,Po(e,t)),t=!1;var f=Qn;e:do try{if(Bn!==0&&hn!==null){var y=hn,R=Zr;switch(Bn){case 8:tm(),f=6;break e;case 3:case 2:case 9:case 6:Yr.current===null&&(t=!0);var he=Bn;if(Bn=0,Zr=null,$o(e,y,R,he),r&&Do){f=0;break e}break;default:he=Bn,Bn=0,Zr=null,$o(e,y,R,he)}}by(),f=Qn;break}catch(De){av(e,De)}while(!0);return t&&e.shellSuspendCounter++,Ha=qi=null,Mn=i,M.H=u,M.A=c,hn===null&&(In=null,gn=0,Hs()),f}function by(){for(;hn!==null;)sv(hn)}function yy(e,t){var r=Mn;Mn|=2;var i=ov(),u=lv();In!==e||gn!==t?(xu=null,yu=Ge()+500,Po(e,t)):Do=wn(e,t);e:do try{if(Bn!==0&&hn!==null){t=hn;var c=Zr;t:switch(Bn){case 1:Bn=0,Zr=null,$o(e,t,c,1);break;case 2:case 9:if(bp(c)){Bn=0,Zr=null,uv(t);break}t=function(){Bn!==2&&Bn!==9||In!==e||(Bn=7),Ma(e)},c.then(t,t);break e;case 3:Bn=7;break e;case 4:Bn=5;break e;case 7:bp(c)?(Bn=0,Zr=null,uv(t)):(Bn=0,Zr=null,$o(e,t,c,7));break;case 5:var f=null;switch(hn.tag){case 26:f=hn.memoizedState;case 5:case 27:var y=hn;if(f?Gv(f):y.stateNode.complete){Bn=0,Zr=null;var R=y.sibling;if(R!==null)hn=R;else{var he=y.return;he!==null?(hn=he,ku(he)):hn=null}break t}}Bn=0,Zr=null,$o(e,t,c,5);break;case 6:Bn=0,Zr=null,$o(e,t,c,6);break;case 8:tm(),Qn=6;break e;default:throw Error(s(462))}}xy();break}catch(De){av(e,De)}while(!0);return Ha=qi=null,M.H=i,M.A=u,Mn=r,hn!==null?0:(In=null,gn=0,Hs(),Qn)}function xy(){for(;hn!==null&&!_n();)sv(hn)}function sv(e){var t=Th(e.alternate,e,Qa);e.memoizedProps=e.pendingProps,t===null?ku(e):hn=t}function uv(e){var t=e,r=t.alternate;switch(t.tag){case 15:case 0:t=Fh(r,t,t.pendingProps,t.type,void 0,gn);break;case 11:t=Fh(r,t,t.pendingProps,t.type.render,t.ref,gn);break;case 5:gd(t);default:zh(r,t),t=hn=lp(t,Qa),t=Th(r,t,Qa)}e.memoizedProps=e.pendingProps,t===null?ku(e):hn=t}function $o(e,t,r,i){Ha=qi=null,gd(t),Lo=null,Cl=0;var u=t.return;try{if(sy(e,u,t,r,gn)){Qn=1,cu(e,aa(r,e.current)),hn=null;return}}catch(c){if(u!==null)throw hn=u,c;Qn=1,cu(e,aa(r,e.current)),hn=null;return}t.flags&32768?(yn||i===1?e=!0:Do||(gn&536870912)!==0?e=!1:(gi=e=!0,(i===2||i===9||i===3||i===6)&&(i=Yr.current,i!==null&&i.tag===13&&(i.flags|=16384))),cv(t,e)):ku(t)}function ku(e){var t=e;do{if((t.flags&32768)!==0){cv(t,gi);return}e=t.return;var r=dy(t.alternate,t,Qa);if(r!==null){hn=r;return}if(t=t.sibling,t!==null){hn=t;return}hn=t=e}while(t!==null);Qn===0&&(Qn=5)}function cv(e,t){do{var r=my(e.alternate,e);if(r!==null){r.flags&=32767,hn=r;return}if(r=e.return,r!==null&&(r.flags|=32768,r.subtreeFlags=0,r.deletions=null),!t&&(e=e.sibling,e!==null)){hn=e;return}hn=e=r}while(e!==null);Qn=6,hn=null}function dv(e,t,r,i,u,c,f,y,R){e.cancelPendingCommit=null;do Cu();while(mr!==0);if((Mn&6)!==0)throw Error(s(327));if(t!==null){if(t===e.current)throw Error(s(177));if(c=t.lanes|t.childLanes,c|=Wc,Et(e,r,c,f,y,R),e===In&&(hn=In=null,gn=0),Oo=t,xi=e,Ja=r,Qd=c,Jd=u,ev=i,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Cy(kn,function(){return vv(),null})):(e.callbackNode=null,e.callbackPriority=0),i=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||i){i=M.T,M.T=null,u=A.p,A.p=2,f=Mn,Mn|=4;try{fy(e,t,r)}finally{Mn=f,A.p=u,M.T=i}}mr=1,mv(),fv(),pv()}}function mv(){if(mr===1){mr=0;var e=xi,t=Oo,r=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||r){r=M.T,M.T=null;var i=A.p;A.p=2;var u=Mn;Mn|=4;try{Yh(t,e);var c=mm,f=Qf(e.containerInfo),y=c.focusedElem,R=c.selectionRange;if(f!==y&&y&&y.ownerDocument&&Xf(y.ownerDocument.documentElement,y)){if(R!==null&&$c(y)){var he=R.start,De=R.end;if(De===void 0&&(De=he),"selectionStart"in y)y.selectionStart=he,y.selectionEnd=Math.min(De,y.value.length);else{var Ie=y.ownerDocument||document,ye=Ie&&Ie.defaultView||window;if(ye.getSelection){var Se=ye.getSelection(),At=y.textContent.length,Gt=Math.min(R.start,At),Pn=R.end===void 0?Gt:Math.min(R.end,At);!Se.extend&&Gt>Pn&&(f=Pn,Pn=Gt,Gt=f);var re=Gf(y,Gt),Z=Gf(y,Pn);if(re&&Z&&(Se.rangeCount!==1||Se.anchorNode!==re.node||Se.anchorOffset!==re.offset||Se.focusNode!==Z.node||Se.focusOffset!==Z.offset)){var pe=Ie.createRange();pe.setStart(re.node,re.offset),Se.removeAllRanges(),Gt>Pn?(Se.addRange(pe),Se.extend(Z.node,Z.offset)):(pe.setEnd(Z.node,Z.offset),Se.addRange(pe))}}}}for(Ie=[],Se=y;Se=Se.parentNode;)Se.nodeType===1&&Ie.push({element:Se,left:Se.scrollLeft,top:Se.scrollTop});for(typeof y.focus=="function"&&y.focus(),y=0;y<Ie.length;y++){var $e=Ie[y];$e.element.scrollLeft=$e.left,$e.element.scrollTop=$e.top}}Pu=!!dm,mm=dm=null}finally{Mn=u,A.p=i,M.T=r}}e.current=t,mr=2}}function fv(){if(mr===2){mr=0;var e=xi,t=Oo,r=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||r){r=M.T,M.T=null;var i=A.p;A.p=2;var u=Mn;Mn|=4;try{Ih(e,t.alternate,t)}finally{Mn=u,A.p=i,M.T=r}}mr=3}}function pv(){if(mr===4||mr===3){mr=0,st();var e=xi,t=Oo,r=Ja,i=ev;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?mr=5:(mr=0,Oo=xi=null,hv(e,e.pendingLanes));var u=e.pendingLanes;if(u===0&&(yi=null),Xe(r),t=t.stateNode,Mt&&typeof Mt.onCommitFiberRoot=="function")try{Mt.onCommitFiberRoot(pt,t,void 0,(t.current.flags&128)===128)}catch{}if(i!==null){t=M.T,u=A.p,A.p=2,M.T=null;try{for(var c=e.onRecoverableError,f=0;f<i.length;f++){var y=i[f];c(y.value,{componentStack:y.stack})}}finally{M.T=t,A.p=u}}(Ja&3)!==0&&Cu(),Ma(e),u=e.pendingLanes,(r&261930)!==0&&(u&42)!==0?e===em?Il++:(Il=0,em=e):Il=0,Hl(0)}}function hv(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,El(t)))}function Cu(){return mv(),fv(),pv(),vv()}function vv(){if(mr!==5)return!1;var e=xi,t=Qd;Qd=0;var r=Xe(Ja),i=M.T,u=A.p;try{A.p=32>r?32:r,M.T=null,r=Jd,Jd=null;var c=xi,f=Ja;if(mr=0,Oo=xi=null,Ja=0,(Mn&6)!==0)throw Error(s(331));var y=Mn;if(Mn|=4,Xh(c.current),Zh(c,c.current,f,r),Mn=y,Hl(0,!1),Mt&&typeof Mt.onPostCommitFiberRoot=="function")try{Mt.onPostCommitFiberRoot(pt,c)}catch{}return!0}finally{A.p=u,M.T=i,hv(e,t)}}function gv(e,t,r){t=aa(r,t),t=Td(e.stateNode,t,2),e=fi(e,t,2),e!==null&&(Qe(e,2),Ma(e))}function zn(e,t,r){if(e.tag===3)gv(e,e,r);else for(;t!==null;){if(t.tag===3){gv(t,e,r);break}else if(t.tag===1){var i=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(yi===null||!yi.has(i))){e=aa(r,e),r=bh(2),i=fi(t,r,2),i!==null&&(yh(r,i,t,e),Qe(i,2),Ma(i));break}}t=t.return}}function rm(e,t,r){var i=e.pingCache;if(i===null){i=e.pingCache=new vy;var u=new Set;i.set(t,u)}else u=i.get(t),u===void 0&&(u=new Set,i.set(t,u));u.has(r)||(Kd=!0,u.add(r),e=wy.bind(null,e,t,r),t.then(e,e))}function wy(e,t,r){var i=e.pingCache;i!==null&&i.delete(t),e.pingedLanes|=e.suspendedLanes&r,e.warmLanes&=~r,In===e&&(gn&r)===r&&(Qn===4||Qn===3&&(gn&62914560)===gn&&300>Ge()-bu?(Mn&2)===0&&Po(e,0):Gd|=r,jo===gn&&(jo=0)),Ma(e)}function bv(e,t){t===0&&(t=fe()),e=Hi(e,t),e!==null&&(Qe(e,t),Ma(e))}function Ey(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),bv(e,r)}function ky(e,t){var r=0;switch(e.tag){case 31:case 13:var i=e.stateNode,u=e.memoizedState;u!==null&&(r=u.retryLane);break;case 19:i=e.stateNode;break;case 22:i=e.stateNode._retryCache;break;default:throw Error(s(314))}i!==null&&i.delete(t),bv(e,r)}function Cy(e,t){return Yt(e,t)}var Su=null,Ro=null,am=!1,Fu=!1,im=!1,Ei=0;function Ma(e){e!==Ro&&e.next===null&&(Ro===null?Su=Ro=e:Ro=Ro.next=e),Fu=!0,am||(am=!0,Fy())}function Hl(e,t){if(!im&&Fu){im=!0;do for(var r=!1,i=Su;i!==null;){if(e!==0){var u=i.pendingLanes;if(u===0)var c=0;else{var f=i.suspendedLanes,y=i.pingedLanes;c=(1<<31-Ut(42|e)+1)-1,c&=u&~(f&~y),c=c&201326741?c&201326741|1:c?c|2:0}c!==0&&(r=!0,Ev(i,c))}else c=gn,c=nn(i,i===In?c:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),(c&3)===0||wn(i,c)||(r=!0,Ev(i,c));i=i.next}while(r);im=!1}}function Sy(){yv()}function yv(){Fu=am=!1;var e=0;Ei!==0&&zy()&&(e=Ei);for(var t=Ge(),r=null,i=Su;i!==null;){var u=i.next,c=xv(i,t);c===0?(i.next=null,r===null?Su=u:r.next=u,u===null&&(Ro=r)):(r=i,(e!==0||(c&3)!==0)&&(Fu=!0)),i=u}mr!==0&&mr!==5||Hl(e),Ei!==0&&(Ei=0)}function xv(e,t){for(var r=e.suspendedLanes,i=e.pingedLanes,u=e.expirationTimes,c=e.pendingLanes&-62914561;0<c;){var f=31-Ut(c),y=1<<f,R=u[f];R===-1?((y&r)===0||(y&i)!==0)&&(u[f]=Y(y,t)):R<=t&&(e.expiredLanes|=y),c&=~y}if(t=In,r=gn,r=nn(e,e===t?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i=e.callbackNode,r===0||e===t&&(Bn===2||Bn===9)||e.cancelPendingCommit!==null)return i!==null&&i!==null&&tn(i),e.callbackNode=null,e.callbackPriority=0;if((r&3)===0||wn(e,r)){if(t=r&-r,t===e.callbackPriority)return t;switch(i!==null&&tn(i),Xe(r)){case 2:case 8:r=Vt;break;case 32:r=kn;break;case 268435456:r=je;break;default:r=kn}return i=wv.bind(null,e),r=Yt(r,i),e.callbackPriority=t,e.callbackNode=r,t}return i!==null&&i!==null&&tn(i),e.callbackPriority=2,e.callbackNode=null,2}function wv(e,t){if(mr!==0&&mr!==5)return e.callbackNode=null,e.callbackPriority=0,null;var r=e.callbackNode;if(Cu()&&e.callbackNode!==r)return null;var i=gn;return i=nn(e,e===In?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i===0?null:(nv(e,i,t),xv(e,Ge()),e.callbackNode!=null&&e.callbackNode===r?wv.bind(null,e):null)}function Ev(e,t){if(Cu())return null;nv(e,t,!0)}function Fy(){jy(function(){(Mn&6)!==0?Yt(Rt,Sy):yv()})}function om(){if(Ei===0){var e=So;e===0&&(e=Ze,Ze<<=1,(Ze&261888)===0&&(Ze=256)),Ei=e}return Ei}function kv(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Mr(""+e)}function Cv(e,t){var r=t.ownerDocument.createElement("input");return r.name=t.name,r.value=t.value,e.id&&r.setAttribute("form",e.id),t.parentNode.insertBefore(r,t),e=new FormData(e),r.parentNode.removeChild(r),e}function My(e,t,r,i,u){if(t==="submit"&&r&&r.stateNode===u){var c=kv((u[Ke]||null).action),f=i.submitter;f&&(t=(t=f[Ke]||null)?kv(t.formAction):f.getAttribute("formAction"),t!==null&&(c=t,f=null));var y=new fo("action","action",null,i,u);e.push({event:y,listeners:[{instance:null,listener:function(){if(i.defaultPrevented){if(Ei!==0){var R=f?Cv(u,f):new FormData(u);Fd(r,{pending:!0,data:R,method:u.method,action:c},null,R)}}else typeof c=="function"&&(y.preventDefault(),R=f?Cv(u,f):new FormData(u),Fd(r,{pending:!0,data:R,method:u.method,action:c},c,R))},currentTarget:u}]})}}for(Lu=0;Lu<Vc.length;Lu++)Mu=Vc[Lu],Sv=Mu.toLowerCase(),Fv=Mu[0].toUpperCase()+Mu.slice(1),ha(Sv,"on"+Fv);var Mu,Sv,Fv,Lu;ha(tp,"onAnimationEnd"),ha(np,"onAnimationIteration"),ha(rp,"onAnimationStart"),ha("dblclick","onDoubleClick"),ha("focusin","onFocus"),ha("focusout","onBlur"),ha(qb,"onTransitionRun"),ha(Yb,"onTransitionStart"),ha(Ub,"onTransitionCancel"),ha(ap,"onTransitionEnd"),ur("onMouseEnter",["mouseout","mouseover"]),ur("onMouseLeave",["mouseout","mouseover"]),ur("onPointerEnter",["pointerout","pointerover"]),ur("onPointerLeave",["pointerout","pointerover"]),Hn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Hn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Hn("onBeforeInput",["compositionend","keypress","textInput","paste"]),Hn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Hn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Hn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Vl="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Ly=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Vl));function Mv(e,t){t=(t&4)!==0;for(var r=0;r<e.length;r++){var i=e[r],u=i.event;i=i.listeners;e:{var c=void 0;if(t)for(var f=i.length-1;0<=f;f--){var y=i[f],R=y.instance,he=y.currentTarget;if(y=y.listener,R!==c&&u.isPropagationStopped())break e;c=y,u.currentTarget=he;try{c(u)}catch(De){Is(De)}u.currentTarget=null,c=R}else for(f=0;f<i.length;f++){if(y=i[f],R=y.instance,he=y.currentTarget,y=y.listener,R!==c&&u.isPropagationStopped())break e;c=y,u.currentTarget=he;try{c(u)}catch(De){Is(De)}u.currentTarget=null,c=R}}}}function vn(e,t){var r=t[Wt];r===void 0&&(r=t[Wt]=new Set);var i=e+"__bubble";r.has(i)||(Lv(t,e,2,!1),r.add(i))}function lm(e,t,r){var i=0;t&&(i|=4),Lv(r,e,i,t)}var Au="_reactListening"+Math.random().toString(36).slice(2);function sm(e){if(!e[Au]){e[Au]=!0,Dn.forEach(function(r){r!=="selectionchange"&&(Ly.has(r)||lm(r,!1,e),lm(r,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Au]||(t[Au]=!0,lm("selectionchange",!1,t))}}function Lv(e,t,r,i){switch(r0(t)){case 2:var u=n1;break;case 8:u=r1;break;default:u=km}r=u.bind(null,t,r,e),u=void 0,!Jn||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(u=!0),i?u!==void 0?e.addEventListener(t,r,{capture:!0,passive:u}):e.addEventListener(t,r,!0):u!==void 0?e.addEventListener(t,r,{passive:u}):e.addEventListener(t,r,!1)}function um(e,t,r,i,u){var c=i;if((t&1)===0&&(t&2)===0&&i!==null)e:for(;;){if(i===null)return;var f=i.tag;if(f===3||f===4){var y=i.stateNode.containerInfo;if(y===u)break;if(f===4)for(f=i.return;f!==null;){var R=f.tag;if((R===3||R===4)&&f.stateNode.containerInfo===u)return;f=f.return}for(;y!==null;){if(f=Lt(y),f===null)return;if(R=f.tag,R===5||R===6||R===26||R===27){i=c=f;continue e}y=y.parentNode}}i=i.return}It(function(){var he=c,De=I(r),Ie=[];e:{var ye=ip.get(e);if(ye!==void 0){var Se=fo,At=e;switch(e){case"keypress":if(Vr(r)===0)break e;case"keydown":case"keyup":Se=kb;break;case"focusin":At="focus",Se=pl;break;case"focusout":At="blur",Se=pl;break;case"beforeblur":case"afterblur":Se=pl;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Se=ho;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Se=Os;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Se=Fb;break;case tp:case np:case rp:Se=zc;break;case ap:Se=Lb;break;case"scroll":case"scrollend":Se=Ds;break;case"wheel":Se=Nb;break;case"copy":case"cut":case"paste":Se=vb;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Se=Of;break;case"toggle":case"beforetoggle":Se=Tb}var Gt=(t&4)!==0,Pn=!Gt&&(e==="scroll"||e==="scrollend"),re=Gt?ye!==null?ye+"Capture":null:ye;Gt=[];for(var Z=he,pe;Z!==null;){var $e=Z;if(pe=$e.stateNode,$e=$e.tag,$e!==5&&$e!==26&&$e!==27||pe===null||re===null||($e=Kt(Z,re),$e!=null&&Gt.push(Wl(Z,$e,pe))),Pn)break;Z=Z.return}0<Gt.length&&(ye=new Se(ye,At,null,r,De),Ie.push({event:ye,listeners:Gt}))}}if((t&7)===0){e:{if(ye=e==="mouseover"||e==="pointerover",Se=e==="mouseout"||e==="pointerout",ye&&r!==N&&(At=r.relatedTarget||r.fromElement)&&(Lt(At)||At[Nt]))break e;if((Se||ye)&&(ye=De.window===De?De:(ye=De.ownerDocument)?ye.defaultView||ye.parentWindow:window,Se?(At=r.relatedTarget||r.toElement,Se=he,At=At?Lt(At):null,At!==null&&(Pn=m(At),Gt=At.tag,At!==Pn||Gt!==5&&Gt!==27&&Gt!==6)&&(At=null)):(Se=null,At=he),Se!==At)){if(Gt=ho,$e="onMouseLeave",re="onMouseEnter",Z="mouse",(e==="pointerout"||e==="pointerover")&&(Gt=Of,$e="onPointerLeave",re="onPointerEnter",Z="pointer"),Pn=Se==null?ye:en(Se),pe=At==null?ye:en(At),ye=new Gt($e,Z+"leave",Se,r,De),ye.target=Pn,ye.relatedTarget=pe,$e=null,Lt(De)===he&&(Gt=new Gt(re,Z+"enter",At,r,De),Gt.target=pe,Gt.relatedTarget=Pn,$e=Gt),Pn=$e,Se&&At)t:{for(Gt=Ay,re=Se,Z=At,pe=0,$e=re;$e;$e=Gt($e))pe++;$e=0;for(var Ht=Z;Ht;Ht=Gt(Ht))$e++;for(;0<pe-$e;)re=Gt(re),pe--;for(;0<$e-pe;)Z=Gt(Z),$e--;for(;pe--;){if(re===Z||Z!==null&&re===Z.alternate){Gt=re;break t}re=Gt(re),Z=Gt(Z)}Gt=null}else Gt=null;Se!==null&&Av(Ie,ye,Se,Gt,!1),At!==null&&Pn!==null&&Av(Ie,Pn,At,Gt,!0)}}e:{if(ye=he?en(he):window,Se=ye.nodeName&&ye.nodeName.toLowerCase(),Se==="select"||Se==="input"&&ye.type==="file")var Sn=qf;else if(Vf(ye))if(Yf)Sn=Hb;else{Sn=Rb;var zt=$b}else Se=ye.nodeName,!Se||Se.toLowerCase()!=="input"||ye.type!=="checkbox"&&ye.type!=="radio"?he&&on(he.elementType)&&(Sn=qf):Sn=Ib;if(Sn&&(Sn=Sn(e,he))){Wf(Ie,Sn,r,De);break e}zt&&zt(e,ye,he),e==="focusout"&&he&&ye.type==="number"&&he.memoizedProps.value!=null&&We(ye,"number",ye.value)}switch(zt=he?en(he):window,e){case"focusin":(Vf(zt)||zt.contentEditable==="true")&&(go=zt,Rc=he,yl=null);break;case"focusout":yl=Rc=go=null;break;case"mousedown":Ic=!0;break;case"contextmenu":case"mouseup":case"dragend":Ic=!1,Jf(Ie,r,De);break;case"selectionchange":if(Wb)break;case"keydown":case"keyup":Jf(Ie,r,De)}var cn;if(jc)e:{switch(e){case"compositionstart":var bn="onCompositionStart";break e;case"compositionend":bn="onCompositionEnd";break e;case"compositionupdate":bn="onCompositionUpdate";break e}bn=void 0}else vo?If(e,r)&&(bn="onCompositionEnd"):e==="keydown"&&r.keyCode===229&&(bn="onCompositionStart");bn&&(Pf&&r.locale!=="ko"&&(vo||bn!=="onCompositionStart"?bn==="onCompositionEnd"&&vo&&(cn=fa()):(pr=De,na="value"in pr?pr.value:pr.textContent,vo=!0)),zt=Nu(he,bn),0<zt.length&&(bn=new jf(bn,e,null,r,De),Ie.push({event:bn,listeners:zt}),cn?bn.data=cn:(cn=Hf(r),cn!==null&&(bn.data=cn)))),(cn=zb?Db(e,r):jb(e,r))&&(bn=Nu(he,"onBeforeInput"),0<bn.length&&(zt=new jf("onBeforeInput","beforeinput",null,r,De),Ie.push({event:zt,listeners:bn}),zt.data=cn)),My(Ie,e,he,r,De)}Mv(Ie,t)})}function Wl(e,t,r){return{instance:e,listener:t,currentTarget:r}}function Nu(e,t){for(var r=t+"Capture",i=[];e!==null;){var u=e,c=u.stateNode;if(u=u.tag,u!==5&&u!==26&&u!==27||c===null||(u=Kt(e,r),u!=null&&i.unshift(Wl(e,u,c)),u=Kt(e,t),u!=null&&i.push(Wl(e,u,c))),e.tag===3)return i;e=e.return}return[]}function Ay(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Av(e,t,r,i,u){for(var c=t._reactName,f=[];r!==null&&r!==i;){var y=r,R=y.alternate,he=y.stateNode;if(y=y.tag,R!==null&&R===i)break;y!==5&&y!==26&&y!==27||he===null||(R=he,u?(he=Kt(r,c),he!=null&&f.unshift(Wl(r,he,R))):u||(he=Kt(r,c),he!=null&&f.push(Wl(r,he,R)))),r=r.return}f.length!==0&&e.push({event:t,listeners:f})}var Ny=/\r\n?/g,_y=/\u0000|\uFFFD/g;function Nv(e){return(typeof e=="string"?e:""+e).replace(Ny,`
|
|
11
|
-
`).replace(_y,"")}function _v(e,t){return t=Nv(t),Nv(e)===t}function On(e,t,r,i,u,c){switch(r){case"children":typeof i=="string"?t==="body"||t==="textarea"&&i===""||ht(e,i):(typeof i=="number"||typeof i=="bigint")&&t!=="body"&&ht(e,""+i);break;case"className":E(e,"class",i);break;case"tabIndex":E(e,"tabindex",i);break;case"dir":case"role":case"viewBox":case"width":case"height":E(e,r,i);break;case"style":Ot(e,i,c);break;case"data":if(t!=="object"){E(e,"data",i);break}case"src":case"href":if(i===""&&(t!=="a"||r!=="href")){e.removeAttribute(r);break}if(i==null||typeof i=="function"||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(r);break}i=Mr(""+i),e.setAttribute(r,i);break;case"action":case"formAction":if(typeof i=="function"){e.setAttribute(r,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof c=="function"&&(r==="formAction"?(t!=="input"&&On(e,t,"name",u.name,u,null),On(e,t,"formEncType",u.formEncType,u,null),On(e,t,"formMethod",u.formMethod,u,null),On(e,t,"formTarget",u.formTarget,u,null)):(On(e,t,"encType",u.encType,u,null),On(e,t,"method",u.method,u,null),On(e,t,"target",u.target,u,null)));if(i==null||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(r);break}i=Mr(""+i),e.setAttribute(r,i);break;case"onClick":i!=null&&(e.onclick=ar);break;case"onScroll":i!=null&&vn("scroll",e);break;case"onScrollEnd":i!=null&&vn("scrollend",e);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(s(61));if(r=i.__html,r!=null){if(u.children!=null)throw Error(s(60));e.innerHTML=r}}break;case"multiple":e.multiple=i&&typeof i!="function"&&typeof i!="symbol";break;case"muted":e.muted=i&&typeof i!="function"&&typeof i!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(i==null||typeof i=="function"||typeof i=="boolean"||typeof i=="symbol"){e.removeAttribute("xlink:href");break}r=Mr(""+i),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",r);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(r,""+i):e.removeAttribute(r);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":i&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(r,""):e.removeAttribute(r);break;case"capture":case"download":i===!0?e.setAttribute(r,""):i!==!1&&i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(r,i):e.removeAttribute(r);break;case"cols":case"rows":case"size":case"span":i!=null&&typeof i!="function"&&typeof i!="symbol"&&!isNaN(i)&&1<=i?e.setAttribute(r,i):e.removeAttribute(r);break;case"rowSpan":case"start":i==null||typeof i=="function"||typeof i=="symbol"||isNaN(i)?e.removeAttribute(r):e.setAttribute(r,i);break;case"popover":vn("beforetoggle",e),vn("toggle",e),Pe(e,"popover",i);break;case"xlinkActuate":F(e,"http://www.w3.org/1999/xlink","xlink:actuate",i);break;case"xlinkArcrole":F(e,"http://www.w3.org/1999/xlink","xlink:arcrole",i);break;case"xlinkRole":F(e,"http://www.w3.org/1999/xlink","xlink:role",i);break;case"xlinkShow":F(e,"http://www.w3.org/1999/xlink","xlink:show",i);break;case"xlinkTitle":F(e,"http://www.w3.org/1999/xlink","xlink:title",i);break;case"xlinkType":F(e,"http://www.w3.org/1999/xlink","xlink:type",i);break;case"xmlBase":F(e,"http://www.w3.org/XML/1998/namespace","xml:base",i);break;case"xmlLang":F(e,"http://www.w3.org/XML/1998/namespace","xml:lang",i);break;case"xmlSpace":F(e,"http://www.w3.org/XML/1998/namespace","xml:space",i);break;case"is":Pe(e,"is",i);break;case"innerText":case"textContent":break;default:(!(2<r.length)||r[0]!=="o"&&r[0]!=="O"||r[1]!=="n"&&r[1]!=="N")&&(r=Rn.get(r)||r,Pe(e,r,i))}}function cm(e,t,r,i,u,c){switch(r){case"style":Ot(e,i,c);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(s(61));if(r=i.__html,r!=null){if(u.children!=null)throw Error(s(60));e.innerHTML=r}}break;case"children":typeof i=="string"?ht(e,i):(typeof i=="number"||typeof i=="bigint")&&ht(e,""+i);break;case"onScroll":i!=null&&vn("scroll",e);break;case"onScrollEnd":i!=null&&vn("scrollend",e);break;case"onClick":i!=null&&(e.onclick=ar);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!zr.hasOwnProperty(r))e:{if(r[0]==="o"&&r[1]==="n"&&(u=r.endsWith("Capture"),t=r.slice(2,u?r.length-7:void 0),c=e[Ke]||null,c=c!=null?c[r]:null,typeof c=="function"&&e.removeEventListener(t,c,u),typeof i=="function")){typeof c!="function"&&c!==null&&(r in e?e[r]=null:e.hasAttribute(r)&&e.removeAttribute(r)),e.addEventListener(t,i,u);break e}r in e?e[r]=i:i===!0?e.setAttribute(r,""):Pe(e,r,i)}}}function kr(e,t,r){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":vn("error",e),vn("load",e);var i=!1,u=!1,c;for(c in r)if(r.hasOwnProperty(c)){var f=r[c];if(f!=null)switch(c){case"src":i=!0;break;case"srcSet":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,t));default:On(e,t,c,f,r,null)}}u&&On(e,t,"srcSet",r.srcSet,r,null),i&&On(e,t,"src",r.src,r,null);return;case"input":vn("invalid",e);var y=c=f=u=null,R=null,he=null;for(i in r)if(r.hasOwnProperty(i)){var De=r[i];if(De!=null)switch(i){case"name":u=De;break;case"type":f=De;break;case"checked":R=De;break;case"defaultChecked":he=De;break;case"value":c=De;break;case"defaultValue":y=De;break;case"children":case"dangerouslySetInnerHTML":if(De!=null)throw Error(s(137,t));break;default:On(e,t,i,De,r,null)}}Ve(e,c,y,R,he,f,u,!1);return;case"select":vn("invalid",e),i=f=c=null;for(u in r)if(r.hasOwnProperty(u)&&(y=r[u],y!=null))switch(u){case"value":c=y;break;case"defaultValue":f=y;break;case"multiple":i=y;default:On(e,t,u,y,r,null)}t=c,r=f,e.multiple=!!i,t!=null?ft(e,!!i,t,!1):r!=null&&ft(e,!!i,r,!0);return;case"textarea":vn("invalid",e),c=u=i=null;for(f in r)if(r.hasOwnProperty(f)&&(y=r[f],y!=null))switch(f){case"value":i=y;break;case"defaultValue":u=y;break;case"children":c=y;break;case"dangerouslySetInnerHTML":if(y!=null)throw Error(s(91));break;default:On(e,t,f,y,r,null)}it(e,i,u,c);return;case"option":for(R in r)r.hasOwnProperty(R)&&(i=r[R],i!=null)&&(R==="selected"?e.selected=i&&typeof i!="function"&&typeof i!="symbol":On(e,t,R,i,r,null));return;case"dialog":vn("beforetoggle",e),vn("toggle",e),vn("cancel",e),vn("close",e);break;case"iframe":case"object":vn("load",e);break;case"video":case"audio":for(i=0;i<Vl.length;i++)vn(Vl[i],e);break;case"image":vn("error",e),vn("load",e);break;case"details":vn("toggle",e);break;case"embed":case"source":case"link":vn("error",e),vn("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(he in r)if(r.hasOwnProperty(he)&&(i=r[he],i!=null))switch(he){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,t));default:On(e,t,he,i,r,null)}return;default:if(on(t)){for(De in r)r.hasOwnProperty(De)&&(i=r[De],i!==void 0&&cm(e,t,De,i,r,void 0));return}}for(y in r)r.hasOwnProperty(y)&&(i=r[y],i!=null&&On(e,t,y,i,r,null))}function Ty(e,t,r,i){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var u=null,c=null,f=null,y=null,R=null,he=null,De=null;for(Se in r){var Ie=r[Se];if(r.hasOwnProperty(Se)&&Ie!=null)switch(Se){case"checked":break;case"value":break;case"defaultValue":R=Ie;default:i.hasOwnProperty(Se)||On(e,t,Se,null,i,Ie)}}for(var ye in i){var Se=i[ye];if(Ie=r[ye],i.hasOwnProperty(ye)&&(Se!=null||Ie!=null))switch(ye){case"type":c=Se;break;case"name":u=Se;break;case"checked":he=Se;break;case"defaultChecked":De=Se;break;case"value":f=Se;break;case"defaultValue":y=Se;break;case"children":case"dangerouslySetInnerHTML":if(Se!=null)throw Error(s(137,t));break;default:Se!==Ie&&On(e,t,ye,Se,i,Ie)}}ke(e,f,y,R,he,De,c,u);return;case"select":Se=f=y=ye=null;for(c in r)if(R=r[c],r.hasOwnProperty(c)&&R!=null)switch(c){case"value":break;case"multiple":Se=R;default:i.hasOwnProperty(c)||On(e,t,c,null,i,R)}for(u in i)if(c=i[u],R=r[u],i.hasOwnProperty(u)&&(c!=null||R!=null))switch(u){case"value":ye=c;break;case"defaultValue":y=c;break;case"multiple":f=c;default:c!==R&&On(e,t,u,c,i,R)}t=y,r=f,i=Se,ye!=null?ft(e,!!r,ye,!1):!!i!=!!r&&(t!=null?ft(e,!!r,t,!0):ft(e,!!r,r?[]:"",!1));return;case"textarea":Se=ye=null;for(y in r)if(u=r[y],r.hasOwnProperty(y)&&u!=null&&!i.hasOwnProperty(y))switch(y){case"value":break;case"children":break;default:On(e,t,y,null,i,u)}for(f in i)if(u=i[f],c=r[f],i.hasOwnProperty(f)&&(u!=null||c!=null))switch(f){case"value":ye=u;break;case"defaultValue":Se=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(s(91));break;default:u!==c&&On(e,t,f,u,i,c)}nt(e,ye,Se);return;case"option":for(var At in r)ye=r[At],r.hasOwnProperty(At)&&ye!=null&&!i.hasOwnProperty(At)&&(At==="selected"?e.selected=!1:On(e,t,At,null,i,ye));for(R in i)ye=i[R],Se=r[R],i.hasOwnProperty(R)&&ye!==Se&&(ye!=null||Se!=null)&&(R==="selected"?e.selected=ye&&typeof ye!="function"&&typeof ye!="symbol":On(e,t,R,ye,i,Se));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Gt in r)ye=r[Gt],r.hasOwnProperty(Gt)&&ye!=null&&!i.hasOwnProperty(Gt)&&On(e,t,Gt,null,i,ye);for(he in i)if(ye=i[he],Se=r[he],i.hasOwnProperty(he)&&ye!==Se&&(ye!=null||Se!=null))switch(he){case"children":case"dangerouslySetInnerHTML":if(ye!=null)throw Error(s(137,t));break;default:On(e,t,he,ye,i,Se)}return;default:if(on(t)){for(var Pn in r)ye=r[Pn],r.hasOwnProperty(Pn)&&ye!==void 0&&!i.hasOwnProperty(Pn)&&cm(e,t,Pn,void 0,i,ye);for(De in i)ye=i[De],Se=r[De],!i.hasOwnProperty(De)||ye===Se||ye===void 0&&Se===void 0||cm(e,t,De,ye,i,Se);return}}for(var re in r)ye=r[re],r.hasOwnProperty(re)&&ye!=null&&!i.hasOwnProperty(re)&&On(e,t,re,null,i,ye);for(Ie in i)ye=i[Ie],Se=r[Ie],!i.hasOwnProperty(Ie)||ye===Se||ye==null&&Se==null||On(e,t,Ie,ye,i,Se)}function Tv(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function By(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,r=performance.getEntriesByType("resource"),i=0;i<r.length;i++){var u=r[i],c=u.transferSize,f=u.initiatorType,y=u.duration;if(c&&y&&Tv(f)){for(f=0,y=u.responseEnd,i+=1;i<r.length;i++){var R=r[i],he=R.startTime;if(he>y)break;var De=R.transferSize,Ie=R.initiatorType;De&&Tv(Ie)&&(R=R.responseEnd,f+=De*(R<y?1:(y-he)/(R-he)))}if(--i,t+=8*(c+f)/(u.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var dm=null,mm=null;function _u(e){return e.nodeType===9?e:e.ownerDocument}function Bv(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function zv(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function fm(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var pm=null;function zy(){var e=window.event;return e&&e.type==="popstate"?e===pm?!1:(pm=e,!0):(pm=null,!1)}var Dv=typeof setTimeout=="function"?setTimeout:void 0,Dy=typeof clearTimeout=="function"?clearTimeout:void 0,jv=typeof Promise=="function"?Promise:void 0,jy=typeof queueMicrotask=="function"?queueMicrotask:typeof jv<"u"?function(e){return jv.resolve(null).then(e).catch(Oy)}:Dv;function Oy(e){setTimeout(function(){throw e})}function ki(e){return e==="head"}function Ov(e,t){var r=t,i=0;do{var u=r.nextSibling;if(e.removeChild(r),u&&u.nodeType===8)if(r=u.data,r==="/$"||r==="/&"){if(i===0){e.removeChild(u),Wo(t);return}i--}else if(r==="$"||r==="$?"||r==="$~"||r==="$!"||r==="&")i++;else if(r==="html")ql(e.ownerDocument.documentElement);else if(r==="head"){r=e.ownerDocument.head,ql(r);for(var c=r.firstChild;c;){var f=c.nextSibling,y=c.nodeName;c[un]||y==="SCRIPT"||y==="STYLE"||y==="LINK"&&c.rel.toLowerCase()==="stylesheet"||r.removeChild(c),c=f}}else r==="body"&&ql(e.ownerDocument.body);r=u}while(r);Wo(t)}function Pv(e,t){var r=e;e=0;do{var i=r.nextSibling;if(r.nodeType===1?t?(r._stashedDisplay=r.style.display,r.style.display="none"):(r.style.display=r._stashedDisplay||"",r.getAttribute("style")===""&&r.removeAttribute("style")):r.nodeType===3&&(t?(r._stashedText=r.nodeValue,r.nodeValue=""):r.nodeValue=r._stashedText||""),i&&i.nodeType===8)if(r=i.data,r==="/$"){if(e===0)break;e--}else r!=="$"&&r!=="$?"&&r!=="$~"&&r!=="$!"||e++;r=i}while(r)}function hm(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var r=t;switch(t=t.nextSibling,r.nodeName){case"HTML":case"HEAD":case"BODY":hm(r),pn(r);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(r.rel.toLowerCase()==="stylesheet")continue}e.removeChild(r)}}function Py(e,t,r,i){for(;e.nodeType===1;){var u=r;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!i&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(i){if(!e[un])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(c=e.getAttribute("rel"),c==="stylesheet"&&e.hasAttribute("data-precedence")||c!==u.rel||e.getAttribute("href")!==(u.href==null||u.href===""?null:u.href)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin)||e.getAttribute("title")!==(u.title==null?null:u.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(c=e.getAttribute("src"),(c!==(u.src==null?null:u.src)||e.getAttribute("type")!==(u.type==null?null:u.type)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin))&&c&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var c=u.name==null?null:""+u.name;if(u.type==="hidden"&&e.getAttribute("name")===c)return e}else return e;if(e=sa(e.nextSibling),e===null)break}return null}function $y(e,t,r){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!r||(e=sa(e.nextSibling),e===null))return null;return e}function $v(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=sa(e.nextSibling),e===null))return null;return e}function vm(e){return e.data==="$?"||e.data==="$~"}function gm(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Ry(e,t){var r=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||r.readyState!=="loading")t();else{var i=function(){t(),r.removeEventListener("DOMContentLoaded",i)};r.addEventListener("DOMContentLoaded",i),e._reactRetry=i}}function sa(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var bm=null;function Rv(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="/$"||r==="/&"){if(t===0)return sa(e.nextSibling);t--}else r!=="$"&&r!=="$!"&&r!=="$?"&&r!=="$~"&&r!=="&"||t++}e=e.nextSibling}return null}function Iv(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"){if(t===0)return e;t--}else r!=="/$"&&r!=="/&"||t++}e=e.previousSibling}return null}function Hv(e,t,r){switch(t=_u(r),e){case"html":if(e=t.documentElement,!e)throw Error(s(452));return e;case"head":if(e=t.head,!e)throw Error(s(453));return e;case"body":if(e=t.body,!e)throw Error(s(454));return e;default:throw Error(s(451))}}function ql(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);pn(e)}var ua=new Map,Vv=new Set;function Tu(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var ei=A.d;A.d={f:Iy,r:Hy,D:Vy,C:Wy,L:qy,m:Yy,X:Zy,S:Uy,M:Ky};function Iy(){var e=ei.f(),t=wu();return e||t}function Hy(e){var t=Zt(e);t!==null&&t.tag===5&&t.type==="form"?ah(t):ei.r(e)}var Io=typeof document>"u"?null:document;function Wv(e,t,r){var i=Io;if(i&&typeof t=="string"&&t){var u=ae(t);u='link[rel="'+e+'"][href="'+u+'"]',typeof r=="string"&&(u+='[crossorigin="'+r+'"]'),Vv.has(u)||(Vv.add(u),e={rel:e,crossOrigin:r,href:t},i.querySelector(u)===null&&(t=i.createElement("link"),kr(t,"link",e),fn(t),i.head.appendChild(t)))}}function Vy(e){ei.D(e),Wv("dns-prefetch",e,null)}function Wy(e,t){ei.C(e,t),Wv("preconnect",e,t)}function qy(e,t,r){ei.L(e,t,r);var i=Io;if(i&&e&&t){var u='link[rel="preload"][as="'+ae(t)+'"]';t==="image"&&r&&r.imageSrcSet?(u+='[imagesrcset="'+ae(r.imageSrcSet)+'"]',typeof r.imageSizes=="string"&&(u+='[imagesizes="'+ae(r.imageSizes)+'"]')):u+='[href="'+ae(e)+'"]';var c=u;switch(t){case"style":c=Ho(e);break;case"script":c=Vo(e)}ua.has(c)||(e=S({rel:"preload",href:t==="image"&&r&&r.imageSrcSet?void 0:e,as:t},r),ua.set(c,e),i.querySelector(u)!==null||t==="style"&&i.querySelector(Yl(c))||t==="script"&&i.querySelector(Ul(c))||(t=i.createElement("link"),kr(t,"link",e),fn(t),i.head.appendChild(t)))}}function Yy(e,t){ei.m(e,t);var r=Io;if(r&&e){var i=t&&typeof t.as=="string"?t.as:"script",u='link[rel="modulepreload"][as="'+ae(i)+'"][href="'+ae(e)+'"]',c=u;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":c=Vo(e)}if(!ua.has(c)&&(e=S({rel:"modulepreload",href:e},t),ua.set(c,e),r.querySelector(u)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(r.querySelector(Ul(c)))return}i=r.createElement("link"),kr(i,"link",e),fn(i),r.head.appendChild(i)}}}function Uy(e,t,r){ei.S(e,t,r);var i=Io;if(i&&e){var u=Tn(i).hoistableStyles,c=Ho(e);t=t||"default";var f=u.get(c);if(!f){var y={loading:0,preload:null};if(f=i.querySelector(Yl(c)))y.loading=5;else{e=S({rel:"stylesheet",href:e,"data-precedence":t},r),(r=ua.get(c))&&ym(e,r);var R=f=i.createElement("link");fn(R),kr(R,"link",e),R._p=new Promise(function(he,De){R.onload=he,R.onerror=De}),R.addEventListener("load",function(){y.loading|=1}),R.addEventListener("error",function(){y.loading|=2}),y.loading|=4,Bu(f,t,i)}f={type:"stylesheet",instance:f,count:1,state:y},u.set(c,f)}}}function Zy(e,t){ei.X(e,t);var r=Io;if(r&&e){var i=Tn(r).hoistableScripts,u=Vo(e),c=i.get(u);c||(c=r.querySelector(Ul(u)),c||(e=S({src:e,async:!0},t),(t=ua.get(u))&&xm(e,t),c=r.createElement("script"),fn(c),kr(c,"link",e),r.head.appendChild(c)),c={type:"script",instance:c,count:1,state:null},i.set(u,c))}}function Ky(e,t){ei.M(e,t);var r=Io;if(r&&e){var i=Tn(r).hoistableScripts,u=Vo(e),c=i.get(u);c||(c=r.querySelector(Ul(u)),c||(e=S({src:e,async:!0,type:"module"},t),(t=ua.get(u))&&xm(e,t),c=r.createElement("script"),fn(c),kr(c,"link",e),r.head.appendChild(c)),c={type:"script",instance:c,count:1,state:null},i.set(u,c))}}function qv(e,t,r,i){var u=(u=ze.current)?Tu(u):null;if(!u)throw Error(s(446));switch(e){case"meta":case"title":return null;case"style":return typeof r.precedence=="string"&&typeof r.href=="string"?(t=Ho(r.href),r=Tn(u).hoistableStyles,i=r.get(t),i||(i={type:"style",instance:null,count:0,state:null},r.set(t,i)),i):{type:"void",instance:null,count:0,state:null};case"link":if(r.rel==="stylesheet"&&typeof r.href=="string"&&typeof r.precedence=="string"){e=Ho(r.href);var c=Tn(u).hoistableStyles,f=c.get(e);if(f||(u=u.ownerDocument||u,f={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},c.set(e,f),(c=u.querySelector(Yl(e)))&&!c._p&&(f.instance=c,f.state.loading=5),ua.has(e)||(r={rel:"preload",as:"style",href:r.href,crossOrigin:r.crossOrigin,integrity:r.integrity,media:r.media,hrefLang:r.hrefLang,referrerPolicy:r.referrerPolicy},ua.set(e,r),c||Gy(u,e,r,f.state))),t&&i===null)throw Error(s(528,""));return f}if(t&&i!==null)throw Error(s(529,""));return null;case"script":return t=r.async,r=r.src,typeof r=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Vo(r),r=Tn(u).hoistableScripts,i=r.get(t),i||(i={type:"script",instance:null,count:0,state:null},r.set(t,i)),i):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,e))}}function Ho(e){return'href="'+ae(e)+'"'}function Yl(e){return'link[rel="stylesheet"]['+e+"]"}function Yv(e){return S({},e,{"data-precedence":e.precedence,precedence:null})}function Gy(e,t,r,i){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?i.loading=1:(t=e.createElement("link"),i.preload=t,t.addEventListener("load",function(){return i.loading|=1}),t.addEventListener("error",function(){return i.loading|=2}),kr(t,"link",r),fn(t),e.head.appendChild(t))}function Vo(e){return'[src="'+ae(e)+'"]'}function Ul(e){return"script[async]"+e}function Uv(e,t,r){if(t.count++,t.instance===null)switch(t.type){case"style":var i=e.querySelector('style[data-href~="'+ae(r.href)+'"]');if(i)return t.instance=i,fn(i),i;var u=S({},r,{"data-href":r.href,"data-precedence":r.precedence,href:null,precedence:null});return i=(e.ownerDocument||e).createElement("style"),fn(i),kr(i,"style",u),Bu(i,r.precedence,e),t.instance=i;case"stylesheet":u=Ho(r.href);var c=e.querySelector(Yl(u));if(c)return t.state.loading|=4,t.instance=c,fn(c),c;i=Yv(r),(u=ua.get(u))&&ym(i,u),c=(e.ownerDocument||e).createElement("link"),fn(c);var f=c;return f._p=new Promise(function(y,R){f.onload=y,f.onerror=R}),kr(c,"link",i),t.state.loading|=4,Bu(c,r.precedence,e),t.instance=c;case"script":return c=Vo(r.src),(u=e.querySelector(Ul(c)))?(t.instance=u,fn(u),u):(i=r,(u=ua.get(c))&&(i=S({},r),xm(i,u)),e=e.ownerDocument||e,u=e.createElement("script"),fn(u),kr(u,"link",i),e.head.appendChild(u),t.instance=u);case"void":return null;default:throw Error(s(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(i=t.instance,t.state.loading|=4,Bu(i,r.precedence,e));return t.instance}function Bu(e,t,r){for(var i=r.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=i.length?i[i.length-1]:null,c=u,f=0;f<i.length;f++){var y=i[f];if(y.dataset.precedence===t)c=y;else if(c!==u)break}c?c.parentNode.insertBefore(e,c.nextSibling):(t=r.nodeType===9?r.head:r,t.insertBefore(e,t.firstChild))}function ym(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function xm(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var zu=null;function Zv(e,t,r){if(zu===null){var i=new Map,u=zu=new Map;u.set(r,i)}else u=zu,i=u.get(r),i||(i=new Map,u.set(r,i));if(i.has(e))return i;for(i.set(e,null),r=r.getElementsByTagName(e),u=0;u<r.length;u++){var c=r[u];if(!(c[un]||c[at]||e==="link"&&c.getAttribute("rel")==="stylesheet")&&c.namespaceURI!=="http://www.w3.org/2000/svg"){var f=c.getAttribute(t)||"";f=e+f;var y=i.get(f);y?y.push(c):i.set(f,[c])}}return i}function Kv(e,t,r){e=e.ownerDocument||e,e.head.insertBefore(r,t==="title"?e.querySelector("head > title"):null)}function Xy(e,t,r){if(r===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(e=t.disabled,typeof t.precedence=="string"&&e==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Gv(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Qy(e,t,r,i){if(r.type==="stylesheet"&&(typeof i.media!="string"||matchMedia(i.media).matches!==!1)&&(r.state.loading&4)===0){if(r.instance===null){var u=Ho(i.href),c=t.querySelector(Yl(u));if(c){t=c._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Du.bind(e),t.then(e,e)),r.state.loading|=4,r.instance=c,fn(c);return}c=t.ownerDocument||t,i=Yv(i),(u=ua.get(u))&&ym(i,u),c=c.createElement("link"),fn(c);var f=c;f._p=new Promise(function(y,R){f.onload=y,f.onerror=R}),kr(c,"link",i),r.instance=c}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(r,t),(t=r.state.preload)&&(r.state.loading&3)===0&&(e.count++,r=Du.bind(e),t.addEventListener("load",r),t.addEventListener("error",r))}}var wm=0;function Jy(e,t){return e.stylesheets&&e.count===0&&Ou(e,e.stylesheets),0<e.count||0<e.imgCount?function(r){var i=setTimeout(function(){if(e.stylesheets&&Ou(e,e.stylesheets),e.unsuspend){var c=e.unsuspend;e.unsuspend=null,c()}},6e4+t);0<e.imgBytes&&wm===0&&(wm=62500*By());var u=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Ou(e,e.stylesheets),e.unsuspend)){var c=e.unsuspend;e.unsuspend=null,c()}},(e.imgBytes>wm?50:800)+t);return e.unsuspend=r,function(){e.unsuspend=null,clearTimeout(i),clearTimeout(u)}}:null}function Du(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Ou(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var ju=null;function Ou(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ju=new Map,t.forEach(e1,e),ju=null,Du.call(e))}function e1(e,t){if(!(t.state.loading&4)){var r=ju.get(e);if(r)var i=r.get(null);else{r=new Map,ju.set(e,r);for(var u=e.querySelectorAll("link[data-precedence],style[data-precedence]"),c=0;c<u.length;c++){var f=u[c];(f.nodeName==="LINK"||f.getAttribute("media")!=="not all")&&(r.set(f.dataset.precedence,f),i=f)}i&&r.set(null,i)}u=t.instance,f=u.getAttribute("data-precedence"),c=r.get(f)||i,c===i&&r.set(null,u),r.set(f,u),this.count++,i=Du.bind(this),u.addEventListener("load",i),u.addEventListener("error",i),c?c.parentNode.insertBefore(u,c.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(u,e.firstChild)),t.state.loading|=4}}var Zl={$$typeof:de,Provider:null,Consumer:null,_currentValue:ee,_currentValue2:ee,_threadCount:0};function t1(e,t,r,i,u,c,f,y,R){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ne(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ne(0),this.hiddenUpdates=Ne(null),this.identifierPrefix=i,this.onUncaughtError=u,this.onCaughtError=c,this.onRecoverableError=f,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=R,this.incompleteTransitions=new Map}function Xv(e,t,r,i,u,c,f,y,R,he,De,Ie){return e=new t1(e,t,r,f,R,he,De,Ie,y),t=1,c===!0&&(t|=24),c=qr(3,null,null,t),e.current=c,c.stateNode=e,t=nd(),t.refCount++,e.pooledCache=t,t.refCount++,c.memoizedState={element:i,isDehydrated:r,cache:t},od(c),e}function Qv(e){return e?(e=xo,e):xo}function Jv(e,t,r,i,u,c){u=Qv(u),i.context===null?i.context=u:i.pendingContext=u,i=mi(t),i.payload={element:r},c=c===void 0?null:c,c!==null&&(i.callback=c),r=fi(e,i,t),r!==null&&($r(r,e,t),Fl(r,e,t))}function e0(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var r=e.retryLane;e.retryLane=r!==0&&r<t?r:t}}function Em(e,t){e0(e,t),(e=e.alternate)&&e0(e,t)}function t0(e){if(e.tag===13||e.tag===31){var t=Hi(e,67108864);t!==null&&$r(t,e,67108864),Em(e,67108864)}}function n0(e){if(e.tag===13||e.tag===31){var t=Gr();t=He(t);var r=Hi(e,t);r!==null&&$r(r,e,t),Em(e,t)}}var Pu=!0;function n1(e,t,r,i){var u=M.T;M.T=null;var c=A.p;try{A.p=2,km(e,t,r,i)}finally{A.p=c,M.T=u}}function r1(e,t,r,i){var u=M.T;M.T=null;var c=A.p;try{A.p=8,km(e,t,r,i)}finally{A.p=c,M.T=u}}function km(e,t,r,i){if(Pu){var u=Cm(i);if(u===null)um(e,t,i,$u,r),a0(e,i);else if(i1(u,e,t,r,i))i.stopPropagation();else if(a0(e,i),t&4&&-1<a1.indexOf(e)){for(;u!==null;){var c=Zt(u);if(c!==null)switch(c.tag){case 3:if(c=c.stateNode,c.current.memoizedState.isDehydrated){var f=Pt(c.pendingLanes);if(f!==0){var y=c;for(y.pendingLanes|=2,y.entangledLanes|=2;f;){var R=1<<31-Ut(f);y.entanglements[1]|=R,f&=~R}Ma(c),(Mn&6)===0&&(yu=Ge()+500,Hl(0))}}break;case 31:case 13:y=Hi(c,2),y!==null&&$r(y,c,2),wu(),Em(c,2)}if(c=Cm(i),c===null&&um(e,t,i,$u,r),c===u)break;u=c}u!==null&&i.stopPropagation()}else um(e,t,i,null,r)}}function Cm(e){return e=I(e),Sm(e)}var $u=null;function Sm(e){if($u=null,e=Lt(e),e!==null){var t=m(e);if(t===null)e=null;else{var r=t.tag;if(r===13){if(e=h(t),e!==null)return e;e=null}else if(r===31){if(e=g(t),e!==null)return e;e=null}else if(r===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return $u=e,null}function r0(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(mt()){case Rt:return 2;case Vt:return 8;case kn:case xn:return 32;case je:return 268435456;default:return 32}default:return 32}}var Fm=!1,Ci=null,Si=null,Fi=null,Kl=new Map,Gl=new Map,Mi=[],a1="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function a0(e,t){switch(e){case"focusin":case"focusout":Ci=null;break;case"dragenter":case"dragleave":Si=null;break;case"mouseover":case"mouseout":Fi=null;break;case"pointerover":case"pointerout":Kl.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Gl.delete(t.pointerId)}}function Xl(e,t,r,i,u,c){return e===null||e.nativeEvent!==c?(e={blockedOn:t,domEventName:r,eventSystemFlags:i,nativeEvent:c,targetContainers:[u]},t!==null&&(t=Zt(t),t!==null&&t0(t)),e):(e.eventSystemFlags|=i,t=e.targetContainers,u!==null&&t.indexOf(u)===-1&&t.push(u),e)}function i1(e,t,r,i,u){switch(t){case"focusin":return Ci=Xl(Ci,e,t,r,i,u),!0;case"dragenter":return Si=Xl(Si,e,t,r,i,u),!0;case"mouseover":return Fi=Xl(Fi,e,t,r,i,u),!0;case"pointerover":var c=u.pointerId;return Kl.set(c,Xl(Kl.get(c)||null,e,t,r,i,u)),!0;case"gotpointercapture":return c=u.pointerId,Gl.set(c,Xl(Gl.get(c)||null,e,t,r,i,u)),!0}return!1}function i0(e){var t=Lt(e.target);if(t!==null){var r=m(t);if(r!==null){if(t=r.tag,t===13){if(t=h(r),t!==null){e.blockedOn=t,kt(e.priority,function(){n0(r)});return}}else if(t===31){if(t=g(r),t!==null){e.blockedOn=t,kt(e.priority,function(){n0(r)});return}}else if(t===3&&r.stateNode.current.memoizedState.isDehydrated){e.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Ru(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var r=Cm(e.nativeEvent);if(r===null){r=e.nativeEvent;var i=new r.constructor(r.type,r);N=i,r.target.dispatchEvent(i),N=null}else return t=Zt(r),t!==null&&t0(t),e.blockedOn=r,!1;t.shift()}return!0}function o0(e,t,r){Ru(e)&&r.delete(t)}function o1(){Fm=!1,Ci!==null&&Ru(Ci)&&(Ci=null),Si!==null&&Ru(Si)&&(Si=null),Fi!==null&&Ru(Fi)&&(Fi=null),Kl.forEach(o0),Gl.forEach(o0)}function Iu(e,t){e.blockedOn===t&&(e.blockedOn=null,Fm||(Fm=!0,a.unstable_scheduleCallback(a.unstable_NormalPriority,o1)))}var Hu=null;function l0(e){Hu!==e&&(Hu=e,a.unstable_scheduleCallback(a.unstable_NormalPriority,function(){Hu===e&&(Hu=null);for(var t=0;t<e.length;t+=3){var r=e[t],i=e[t+1],u=e[t+2];if(typeof i!="function"){if(Sm(i||r)===null)continue;break}var c=Zt(r);c!==null&&(e.splice(t,3),t-=3,Fd(c,{pending:!0,data:u,method:r.method,action:i},i,u))}}))}function Wo(e){function t(R){return Iu(R,e)}Ci!==null&&Iu(Ci,e),Si!==null&&Iu(Si,e),Fi!==null&&Iu(Fi,e),Kl.forEach(t),Gl.forEach(t);for(var r=0;r<Mi.length;r++){var i=Mi[r];i.blockedOn===e&&(i.blockedOn=null)}for(;0<Mi.length&&(r=Mi[0],r.blockedOn===null);)i0(r),r.blockedOn===null&&Mi.shift();if(r=(e.ownerDocument||e).$$reactFormReplay,r!=null)for(i=0;i<r.length;i+=3){var u=r[i],c=r[i+1],f=u[Ke]||null;if(typeof c=="function")f||l0(r);else if(f){var y=null;if(c&&c.hasAttribute("formAction")){if(u=c,f=c[Ke]||null)y=f.formAction;else if(Sm(u)!==null)continue}else y=f.action;typeof y=="function"?r[i+1]=y:(r.splice(i,3),i-=3),l0(r)}}}function s0(){function e(c){c.canIntercept&&c.info==="react-transition"&&c.intercept({handler:function(){return new Promise(function(f){return u=f})},focusReset:"manual",scroll:"manual"})}function t(){u!==null&&(u(),u=null),i||setTimeout(r,20)}function r(){if(!i&&!navigation.transition){var c=navigation.currentEntry;c&&c.url!=null&&navigation.navigate(c.url,{state:c.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var i=!1,u=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(r,100),function(){i=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),u!==null&&(u(),u=null)}}}function Mm(e){this._internalRoot=e}Vu.prototype.render=Mm.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(s(409));var r=t.current,i=Gr();Jv(r,i,e,t,null,null)},Vu.prototype.unmount=Mm.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Jv(e.current,2,null,e,null,null),wu(),t[Nt]=null}};function Vu(e){this._internalRoot=e}Vu.prototype.unstable_scheduleHydration=function(e){if(e){var t=ct();e={blockedOn:null,target:e,priority:t};for(var r=0;r<Mi.length&&t!==0&&t<Mi[r].priority;r++);Mi.splice(r,0,e),r===0&&i0(e)}};var u0=o.version;if(u0!=="19.2.7")throw Error(s(527,u0,"19.2.7"));A.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(s(188)):(e=Object.keys(e).join(","),Error(s(268,e)));return e=w(t),e=e!==null?W(e):null,e=e===null?null:e.stateNode,e};var l1={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:M,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&(Ql=__REACT_DEVTOOLS_GLOBAL_HOOK__,!Ql.isDisabled&&Ql.supportsFiber))try{pt=Ql.inject(l1),Mt=Ql}catch{}var Ql;n.createRoot=function(e,t){if(!d(e))throw Error(s(299));var r=!1,i="",u=ph,c=hh,f=vh;return t!=null&&(t.unstable_strictMode===!0&&(r=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onUncaughtError!==void 0&&(u=t.onUncaughtError),t.onCaughtError!==void 0&&(c=t.onCaughtError),t.onRecoverableError!==void 0&&(f=t.onRecoverableError)),t=Xv(e,1,!1,null,null,r,i,null,u,c,f,s0),e[Nt]=t.current,sm(e),new Mm(t)},n.hydrateRoot=function(e,t,r){if(!d(e))throw Error(s(299));var i=!1,u="",c=ph,f=hh,y=vh,R=null;return r!=null&&(r.unstable_strictMode===!0&&(i=!0),r.identifierPrefix!==void 0&&(u=r.identifierPrefix),r.onUncaughtError!==void 0&&(c=r.onUncaughtError),r.onCaughtError!==void 0&&(f=r.onCaughtError),r.onRecoverableError!==void 0&&(y=r.onRecoverableError),r.formState!==void 0&&(R=r.formState)),t=Xv(e,1,!0,t,r??null,i,u,R,c,f,y,s0),t.context=Qv(null),r=t.current,i=Gr(),i=He(i),u=mi(i),u.callback=null,fi(r,u,i),r=i,t.current.lanes=r,Qe(t,r),Ma(t),e[Nt]=t.current,sm(e),new Vu(t)},n.version="19.2.7"}),T2=La((n,a)=>{function o(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(o)}catch(l){console.error(l)}}o(),a.exports=_2()}),B2=La(n=>{var a=Symbol.for("react.transitional.element"),o=Symbol.for("react.fragment");function l(s,d,m){var h=null;if(m!==void 0&&(h=""+m),d.key!==void 0&&(h=""+d.key),"key"in d){m={};for(var g in d)g!=="key"&&(m[g]=d[g])}else m=d;return d=m.ref,{$$typeof:a,type:s,key:h,ref:d!==void 0?d:null,props:m}}n.Fragment=o,n.jsx=l,n.jsxs=l}),Qo=La((n,a)=>{a.exports=B2()}),og=Ar(Ta(),1),z2=Ar(T2(),1),Ft=Ar(Ta(),1),lg=Ar(Ta(),1),D2=Ar(Ta(),1),j2=n=>(a,o)=>x2(n,a,o);function O2(n){return(0,D2.useSyncExternalStore)(n.subscribe,n.getSnapshot,n.getSnapshot)}var P2=n=>a=>n.patch(a,{transient:!0}),$2=n=>a=>n.commit(a),Re={fg:"var(--me-fg,#ededf0)",muted:"var(--me-fg-muted,#9a9aa3)",bg:"var(--me-bg,#08080a)",surface:"var(--me-surface,#141416)",chip:"var(--me-chip,#1c1c20)",border:"var(--me-border,#26262b)",accent:"var(--me-accent,#5b5bd6)",accentFg:"var(--me-accent-fg,#fff)",green:"#34d399"},ys=Ar(Qo(),1);function R2({value:n,min:a,max:o,rangePerWidth:l,step:s=1,onChange:d,onCommit:m,format:h}){let g=(0,lg.useRef)(null),v=(0,lg.useRef)(null),w=X=>{let ue=v.current,oe=g.current;if(!ue||!oe)return;let ge=l??o-a,Be=ue.startV+(X.clientX-ue.startX)/oe.clientWidth*ge,Te=Math.round(Be/s)*s;d(Math.min(o,Math.max(a,Te)))},W=()=>{v.current=null,window.removeEventListener("pointermove",w),window.removeEventListener("pointerup",W),m?.()},S=l??o-a,Q=-n/S*100;return(0,ys.jsxs)("div",{ref:g,style:{position:"relative",height:36,userSelect:"none",overflow:"hidden",cursor:"ew-resize",touchAction:"none"},onPointerDown:X=>{X.preventDefault(),v.current={startX:X.clientX,startV:n},window.addEventListener("pointermove",w),window.addEventListener("pointerup",W)},children:[(0,ys.jsx)("div",{style:{position:"absolute",top:"50%",left:"50%",display:"flex",alignItems:"center",gap:7,transform:`translate(calc(-50% + ${Q}%), -50%)`,width:"200%",justifyContent:"center"},children:Array.from({length:81}).map((X,ue)=>(0,ys.jsx)("span",{style:{flexShrink:0,borderRadius:"50%",width:ue%5===0?3:2,height:ue%5===0?3:2,background:ue%5===0?Re.muted:Re.border}},ue))}),(0,ys.jsx)("div",{style:{position:"absolute",left:"50%",top:0,bottom:0,width:1,background:Re.fg}}),(0,ys.jsx)("span",{style:{position:"absolute",left:"50%",transform:"translateX(-50%)",bottom:-2,fontSize:10,fontVariantNumeric:"tabular-nums",padding:"0 4px",borderRadius:4,color:Re.fg,background:Re.surface},children:h?h(n):Math.round(n)})]})}var xs=Ar(Ta(),1),I2=Ar(Qo(),1);function sg({videoEl:n,srcDims:a,canvasDims:o,state:l,maxW:s=Number.POSITIVE_INFINITY,maxH:d=Number.POSITIVE_INFINITY,zoomPercent:m=null,withOverlays:h=!0,onClick:g}){let v=(0,xs.useRef)(null),w=(0,xs.useRef)(new Map),W=(0,xs.useRef)(()=>{}),S=oo(o,l),Q=S.w?Math.min(s/S.w,d/S.h,1):1,X=m==null?Q:m/100,ue=Math.max(2,Math.round(S.w*X));return(0,xs.useEffect)(()=>{rc(l.overlays??[]).then(oe=>{w.current=oe,W.current()})},[l.overlays]),(0,xs.useEffect)(()=>{let oe=0,ge=0,Be=Math.min(1,1100/Math.max(2,S.w)),Te=()=>{let k=v.current;k&&n&&a.w&&S.w&&n.readyState>=2&&Zm(k,n,a,o,l,Be,w.current,h)},de=()=>!!n&&!n.paused&&!n.ended,Ae=()=>{ge||oe||(ge=requestAnimationFrame(()=>{ge=0,Te()}))},ve=()=>{Te(),oe=de()?requestAnimationFrame(ve):0},j=()=>{oe||(oe=requestAnimationFrame(ve))};return W.current=Te,Ae(),de()&&j(),n?.addEventListener("play",j),n?.addEventListener("playing",j),n?.addEventListener("pause",Ae),n?.addEventListener("seeked",Ae),n?.addEventListener("loadeddata",Ae),n?.addEventListener("timeupdate",Ae),()=>{W.current===Te&&(W.current=()=>{}),cancelAnimationFrame(oe),cancelAnimationFrame(ge),n?.removeEventListener("play",j),n?.removeEventListener("playing",j),n?.removeEventListener("pause",Ae),n?.removeEventListener("seeked",Ae),n?.removeEventListener("loadeddata",Ae),n?.removeEventListener("timeupdate",Ae)}},[n,a.w,a.h,o.w,o.h,S.w,S.h,l,h]),(0,I2.jsx)("canvas",{ref:v,onClick:g,style:{display:"block",borderRadius:8,width:ue,maxWidth:"none",height:"auto",cursor:g?"pointer":"default"}})}var Xr=Ar(Ta(),1),Ln=Ar(Qo(),1),Jo={padding:"6px 10px",borderRadius:6,background:Re.chip,color:Re.fg,border:"none",cursor:"pointer",font:"inherit",fontSize:13};function Xm({ratio:n}){if(!n)return(0,Ln.jsx)("span",{className:"me-video-ratio-glyph",style:{width:17,height:17,border:"1.6px solid currentColor",borderRadius:999,display:"inline-block",boxSizing:"border-box",opacity:.9},"aria-hidden":"true"});let[a=1,o=1]=n.split(":").map(Number),l=o>a,s=a>o;return(0,Ln.jsx)("span",{className:"me-video-ratio-glyph",style:{width:s?22:l?13:17,height:l?22:s?13:17,border:"1.6px solid currentColor",borderRadius:n?3:999,display:"inline-block",boxSizing:"border-box",opacity:n?1:.9},"aria-hidden":"true"})}function H2({videoEl:n,srcDims:a,canvasDims:o,state:l,patchLive:s,commit:d,ratioPreset:m,onRatioPreset:h,onConfirm:g,maxW:v=Number.POSITIVE_INFINITY,maxH:w=Number.POSITIVE_INFINITY,zoomPercent:W=null,t:S}){let Q=(0,Xr.useRef)(null),X=(0,Xr.useRef)(null),ue=(0,Xr.useRef)(null),oe=(0,Xr.useRef)(null),ge=(0,Xr.useRef)(null),Be=(0,Xr.useRef)({x:.5,y:.5}),[Te,de]=(0,Xr.useState)(!1),[,Ae]=(0,Xr.useState)(0),ve=Go(o.w,o.h,l.rotation),j=ve.w?Math.min(v/ve.w,w/ve.h,1):1,k=W==null?j:W/100,H=Math.max(2,Math.round(ve.w*k)),T=Math.max(2,Math.round(ve.h*k)),_=ve.w?H/ve.w:1,le=Number.isFinite(w)?Math.max(180,w+24):void 0,se=Number.isFinite(v)?Math.max(H,Math.round(v)):H,me=Number.isFinite(w)?Math.max(T,Math.round(w)):T,P=l.crop??{x:0,y:0,width:ve.w,height:ve.h},$=()=>{let te=ue.current;te&&(Be.current={x:te.scrollWidth>te.clientWidth?(te.scrollLeft+te.clientWidth/2)/te.scrollWidth:.5,y:te.scrollHeight>te.clientHeight?(te.scrollTop+te.clientHeight/2)/te.scrollHeight:.5})};(0,Xr.useEffect)(()=>{let te=ue.current;if(te)return te.addEventListener("scroll",$,{passive:!0}),()=>te.removeEventListener("scroll",$)},[]),(0,Xr.useLayoutEffect)(()=>{let te=ue.current;if(!te)return;let U=Be.current,xe=requestAnimationFrame(()=>{te.scrollLeft=Math.max(0,te.scrollWidth*U.x-te.clientWidth/2),te.scrollTop=Math.max(0,te.scrollHeight*U.y-te.clientHeight/2),$()});return()=>cancelAnimationFrame(xe)},[H,T,se,me]),(0,Xr.useEffect)(()=>{if(!Te)return;let te=U=>{let xe=oe.current;xe&&!xe.contains(U.target)&&de(!1)};return window.addEventListener("pointerdown",te),()=>window.removeEventListener("pointerdown",te)},[Te]),(0,Xr.useEffect)(()=>{let te=0,U=0,xe=()=>{let ot=Q.current,gt=n;if(ot&>&&a.w&>.readyState>=2){ot.width=Math.max(2,Math.round(ve.w*.5)),ot.height=Math.max(2,Math.round(ve.h*.5));let Jt=ot.getContext("2d");if(Jt){Jt.save(),Jt.translate(ot.width/2,ot.height/2),Jt.rotate(l.rotation*Pm),Jt.scale(l.flipX?-1:1,l.flipY?-1:1);let _t=$m({width:a.w,height:a.h},{w:o.w,h:o.h},"cover");Jt.drawImage(gt,_t.src.x,_t.src.y,_t.src.width,_t.src.height,-o.w*.5/2,-o.h*.5/2,o.w*.5,o.h*.5),Jt.restore()}}},Ce=()=>!!n&&!n.paused&&!n.ended,Ye=()=>{U||te||(U=requestAnimationFrame(()=>{U=0,xe()}))},et=()=>{xe(),te=Ce()?requestAnimationFrame(et):0},lt=()=>{te||(te=requestAnimationFrame(et))};return Ye(),Ce()&<(),n?.addEventListener("play",lt),n?.addEventListener("playing",lt),n?.addEventListener("pause",Ye),n?.addEventListener("seeked",Ye),n?.addEventListener("loadeddata",Ye),n?.addEventListener("timeupdate",Ye),()=>{cancelAnimationFrame(te),cancelAnimationFrame(U),n?.removeEventListener("play",lt),n?.removeEventListener("playing",lt),n?.removeEventListener("pause",Ye),n?.removeEventListener("seeked",Ye),n?.removeEventListener("loadeddata",Ye),n?.removeEventListener("timeupdate",Ye)}},[n,a.w,a.h,o.w,o.h,l.rotation,l.flipX,l.flipY]);let M=(()=>{let te=Gm.find(U=>U.ratio===m);return te?te.value:null})(),A=te=>{let U=ge.current,xe=X.current;if(!U||!xe)return;let Ce=xe.getBoundingClientRect(),Ye=(te.clientX-Ce.left)/_,et=(te.clientY-Ce.top)/_;if(U.kind==="move"){let Yt=O0({x:U.orig.x+(Ye-U.startX),y:U.orig.y+(et-U.startY),width:U.orig.width,height:U.orig.height},{w:ve.w,h:ve.h});s({crop:Yt});return}let lt=U.orig,ot={nw:{x:lt.x+lt.width,y:lt.y+lt.height},ne:{x:lt.x,y:lt.y+lt.height},sw:{x:lt.x+lt.width,y:lt.y},se:{x:lt.x,y:lt.y}}[U.corner],gt=Math.max(40,Math.abs(Ye-ot.x)),Jt=Math.max(40,M?gt/M:Math.abs(et-ot.y));M&&(gt=Jt*M);let _t=Math.min(ot.x,Ye),xt=U.corner==="nw"||U.corner==="ne"?ot.y-Jt:M?ot.y:Math.min(ot.y,et);s({crop:O0({x:_t,y:xt,width:gt,height:Jt},{w:ve.w,h:ve.h})})},ee=()=>{ge.current=null,window.removeEventListener("pointermove",A),window.removeEventListener("pointerup",ee),d()},Me=te=>U=>{U.preventDefault(),U.stopPropagation(),ge.current=te,window.addEventListener("pointermove",A),window.addEventListener("pointerup",ee),Ae(xe=>xe+1)},[_e,x]=(0,Xr.useState)(()=>Math.round(l.rotation/90)*90),C=l.rotation-_e,O=te=>{let U=te;for(;U>180;)U-=360;for(;U<-180;)U+=360;return U},B=(te,U,xe)=>{let Ce=O(te+U);x(Ce-U);let Ye=Go(o.w,o.h,Ce),et=M?ec({w:Ye.w,h:Ye.h},M):{x:0,y:0,width:Ye.w,height:Ye.h};xe?s({rotation:Ce,crop:et}):d({rotation:Ce,crop:et})},G=[{c:"nw",style:{left:-7,top:-7}},{c:"ne",style:{right:-7,top:-7}},{c:"sw",style:{left:-7,bottom:-7}},{c:"se",style:{right:-7,bottom:-7}}],ze=S(m?`ratio.${m}`:"ratio.free"),J=te=>{h(te),de(!1)};return(0,Ln.jsxs)("div",{className:"me-video-crop-view",style:{display:"flex",flexDirection:"column",alignItems:"center",gap:12,width:"100%"},children:[(0,Ln.jsxs)("div",{className:"me-video-fixed-controls me-video-crop-controls",style:{position:"relative",zIndex:3,display:"flex",alignItems:"center",gap:8,flexWrap:"wrap",justifyContent:"center"},children:[(0,Ln.jsx)("button",{className:"me-video-crop-action","data-mobile-label":S("crop.rotateLeftShort"),onClick:()=>B(_e-90,C,!1),style:Jo,children:S("crop.rotateLeft")}),(0,Ln.jsx)("button",{className:"me-video-crop-action","data-mobile-label":S("crop.flipXShort"),onClick:()=>d({flipX:!l.flipX}),style:Jo,children:S("crop.flipX")}),(0,Ln.jsx)("button",{className:"me-video-crop-action","data-mobile-label":S("crop.flipYShort"),onClick:()=>d({flipY:!l.flipY}),style:Jo,children:S("crop.flipY")}),(0,Ln.jsxs)("div",{ref:oe,className:"me-video-ratio-menu",style:{position:"relative",display:"inline-flex"},children:[(0,Ln.jsxs)("button",{type:"button",onClick:()=>de(te=>!te),style:{...Jo,display:"inline-flex",alignItems:"center",gap:6,minWidth:126,justifyContent:"space-between",background:Te||m?"color-mix(in srgb, var(--me-accent, #7c7cf0) 18%, transparent)":Re.chip,color:Te||m?Re.accent:Re.fg},"aria-haspopup":"menu","aria-expanded":Te,children:[(0,Ln.jsx)(Xm,{ratio:""}),(0,Ln.jsx)("span",{children:ze}),(0,Ln.jsx)("span",{"aria-hidden":"true",style:{fontSize:13,lineHeight:1},children:Te?"\u2303":"\u2304"})]}),Te&&(0,Ln.jsxs)("div",{className:"me-video-ratio-menu-panel",role:"menu",style:{position:"absolute",top:"calc(100% + 6px)",left:0,minWidth:190,padding:6,borderRadius:10,background:"rgba(28,28,32,0.98)",border:`1px solid ${Re.border}`,boxShadow:"0 14px 34px rgba(0,0,0,0.35)",zIndex:12},children:[(0,Ln.jsxs)("button",{type:"button",role:"menuitem",onClick:()=>J(""),style:{...Jo,width:"100%",height:34,display:"flex",alignItems:"center",justifyContent:"flex-start",gap:8,background:m===""?"color-mix(in srgb, var(--me-accent, #7c7cf0) 18%, transparent)":"transparent",color:m===""?Re.accent:Re.fg},children:[(0,Ln.jsx)(Xm,{ratio:""}),(0,Ln.jsx)("span",{children:S("ratio.free")})]}),Gm.map(te=>(0,Ln.jsxs)("button",{type:"button",role:"menuitem",onClick:()=>J(te.ratio),style:{...Jo,width:"100%",height:34,display:"flex",alignItems:"center",justifyContent:"flex-start",gap:8,background:m===te.ratio?"color-mix(in srgb, var(--me-accent, #7c7cf0) 18%, transparent)":"transparent",color:m===te.ratio?Re.accent:Re.fg},children:[(0,Ln.jsx)(Xm,{ratio:te.ratio}),(0,Ln.jsx)("span",{children:S(`ratio.${te.ratio}`)})]},te.ratio))]})]})]}),(0,Ln.jsx)("div",{ref:ue,className:"me-video-canvas-scroll",style:{position:"relative",zIndex:0,width:"100%",maxWidth:"100%",maxHeight:le,overflow:"auto",overscrollBehavior:"contain",padding:10,boxSizing:"border-box"},children:(0,Ln.jsx)("div",{className:"me-video-canvas-stage",style:{position:"relative",width:se,minWidth:"100%",minHeight:me,display:"grid",placeItems:"center"},children:(0,Ln.jsxs)("div",{ref:X,style:{position:"relative",width:H,flex:"0 0 auto"},onDoubleClick:()=>{d(),g?.()},title:S("tip.dblConfirm"),children:[(0,Ln.jsx)("canvas",{ref:Q,style:{display:"block",borderRadius:8,width:"100%",height:"auto"}}),(0,Ln.jsx)("div",{style:{position:"absolute",inset:0,overflow:"hidden",borderRadius:8},children:(0,Ln.jsxs)("div",{style:{position:"absolute",left:P.x*_,top:P.y*_,width:P.width*_,height:P.height*_,border:"1.5px solid rgba(255,255,255,0.9)",boxShadow:"0 0 0 9999px rgba(0,0,0,0.55)",cursor:"move",touchAction:"none"},onPointerDown:te=>{let U=X.current;if(!U)return;let xe=U.getBoundingClientRect();Me({kind:"move",startX:(te.clientX-xe.left)/_,startY:(te.clientY-xe.top)/_,orig:P})(te)},children:[[1,2].map(te=>(0,Ln.jsx)("div",{style:{position:"absolute",top:0,bottom:0,width:1,left:`${te/3*100}%`,background:"rgba(255,255,255,0.25)"}},`v${te}`)),[1,2].map(te=>(0,Ln.jsx)("div",{style:{position:"absolute",left:0,right:0,height:1,top:`${te/3*100}%`,background:"rgba(255,255,255,0.25)"}},`h${te}`)),G.map(({c:te,style:U})=>(0,Ln.jsx)("div",{style:{position:"absolute",width:14,height:14,borderRadius:"50%",...U,background:"#fff",boxShadow:"0 1px 4px rgba(0,0,0,0.5)",cursor:`${te}-resize`,touchAction:"none"},onPointerDown:Me({kind:"corner",corner:te,orig:P})},te)),(0,Ln.jsxs)("span",{style:{position:"absolute",top:-20,left:0,fontSize:10,whiteSpace:"nowrap",color:"rgba(255,255,255,0.85)"},children:[Math.round(P.width),"\xD7",Math.round(P.height)]})]})})]})})}),(0,Ln.jsx)("div",{className:"me-video-fixed-controls me-video-crop-dial",style:{position:"relative",zIndex:3,width:"100%",maxWidth:420},children:(0,Ln.jsx)(R2,{value:C,min:-45,max:45,rangePerWidth:90,step:.5,onChange:te=>B(_e,te,!0),onCommit:()=>d(),format:te=>`${(_e+te).toFixed(1).replace(/\.0$/,"")}\xB0`})})]})}var Zn=Ar(Ta(),1),ut=Ar(Qo(),1);function V2(n,a=1024){return new Promise((o,l)=>{let s=URL.createObjectURL(n),d=new Image;d.onload=()=>{let m=Math.min(1,a/Math.max(d.naturalWidth,d.naturalHeight)),h=document.createElement("canvas");h.width=Math.max(1,Math.round(d.naturalWidth*m)),h.height=Math.max(1,Math.round(d.naturalHeight*m));let g=h.getContext("2d");if(!g){URL.revokeObjectURL(s),l(new Error("canvas \u4E0D\u53EF\u7528"));return}g.drawImage(d,0,0,h.width,h.height),URL.revokeObjectURL(s),o({dataUrl:h.toDataURL("image/png"),w:h.width,h:h.height})},d.onerror=()=>{URL.revokeObjectURL(s),l(new Error("\u56FE\u7247\u8BFB\u53D6\u5931\u8D25,\u8BF7\u6362\u4E00\u5F20"))},d.src=s})}var W2=["pen","eraser","line","arrow","rect","ellipse","text"],ug=["#ffffff","#ff4d4f","#ffa940","#fadb14","#52c41a","#40a9ff","#7c7cf0","#000000"],q2=["\u{1F60D}","\u{1F602}","\u{1F600}","\u{1F64F}","\u{1F44D}","\u2764\uFE0F","\u{1F525}","\u{1F389}","\u2728","\u{1F4AF}"],cg=n=>({height:32,padding:"0 10px",borderRadius:8,fontSize:12,border:"none",cursor:"pointer",background:n?"color-mix(in srgb, var(--me-accent, #7c7cf0) 18%, transparent)":"transparent",color:n?Re.accent:Re.muted,font:"inherit",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6}),Qm=()=>({width:28,height:28,borderRadius:6,border:"1px solid rgba(124,124,240,0.4)",display:"inline-flex",alignItems:"center",justifyContent:"center",padding:0,background:"rgba(20,20,22,0.88)",color:Re.fg,boxShadow:"0 4px 14px rgba(0,0,0,0.24)",cursor:"pointer"}),Y2={position:"absolute",top:34,right:0,zIndex:8,padding:8,borderRadius:8,border:"1px solid rgba(255,255,255,0.12)",background:"rgba(20,20,22,0.96)",boxShadow:"0 10px 28px rgba(0,0,0,0.32)",pointerEvents:"auto"};function oc({children:n}){return(0,ut.jsx)("svg",{className:"me-video-overlay-action-icon",viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:n})}function U2(){return(0,ut.jsxs)(oc,{children:[(0,ut.jsx)("path",{d:"M5 19l4.2-1 9.1-9.1a2 2 0 0 0-2.8-2.8L6.4 15.2 5 19z"}),(0,ut.jsx)("path",{d:"M13.8 7.8l2.4 2.4"})]})}function Z2(){return(0,ut.jsxs)(oc,{children:[(0,ut.jsx)("rect",{x:"8",y:"8",width:"10",height:"10",rx:"1.8"}),(0,ut.jsx)("path",{d:"M6 14H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1"})]})}function K2(){return(0,ut.jsxs)(oc,{children:[(0,ut.jsx)("path",{d:"M5 7h14"}),(0,ut.jsx)("path",{d:"M9 7V5h6v2"}),(0,ut.jsx)("path",{d:"M8 10v8"}),(0,ut.jsx)("path",{d:"M12 10v8"}),(0,ut.jsx)("path",{d:"M16 10v8"}),(0,ut.jsx)("path",{d:"M7 7l1 13h8l1-13"})]})}function G2(){return(0,ut.jsxs)(oc,{children:[(0,ut.jsx)("path",{d:"M7 7a7 7 0 1 1-1.6 7.9"}),(0,ut.jsx)("path",{d:"M7 3v4h4"})]})}function X2(){return(0,ut.jsx)("svg",{className:"me-video-overlay-action-icon me-video-overlay-resize-icon",viewBox:"0 0 1024 1024","aria-hidden":"true",focusable:"false",children:(0,ut.jsx)("path",{d:"M940.517894 1024l0.660311-0.683893h82.633135v-82.633135l0.18866-0.165078-0.18866-0.18866v-513.863019h-119.374695v394.488324L204.531159 121.049053H598.52425V1.674359H85.156464L83.482106 0l-1.674359 1.674359H1.674359v80.133388L0 83.482106l1.674359 1.674358V598.52425h119.351112V204.507577l699.433835 699.433835H426.961448v119.374695h512.872553l0.683893 0.683893z"})})}function Bi({children:n}){return(0,ut.jsx)("svg",{className:"me-video-overlay-tool-icon",viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:n})}function dg({id:n}){switch(n){case"pen":return(0,ut.jsxs)(Bi,{children:[(0,ut.jsx)("path",{d:"M4 20l4.5-1 9.6-9.6a2 2 0 0 0-2.8-2.8L5.7 16.2 4 20z"}),(0,ut.jsx)("path",{d:"M13.7 8.2l2.1 2.1"})]});case"eraser":return(0,ut.jsxs)(Bi,{children:[(0,ut.jsx)("path",{d:"M4 15l8.5-8.5a2 2 0 0 1 2.8 0l2.2 2.2a2 2 0 0 1 0 2.8L10 19H6.5L4 16.5V15z"}),(0,ut.jsx)("path",{d:"M9 11l4 4"}),(0,ut.jsx)("path",{d:"M11 19h8"})]});case"line":return(0,ut.jsx)(Bi,{children:(0,ut.jsx)("path",{d:"M5 19L19 5"})});case"arrow":return(0,ut.jsxs)(Bi,{children:[(0,ut.jsx)("path",{d:"M5 19L19 5"}),(0,ut.jsx)("path",{d:"M11 5h8v8"})]});case"rect":return(0,ut.jsx)(Bi,{children:(0,ut.jsx)("rect",{x:"5",y:"6",width:"14",height:"12",rx:"1.5"})});case"ellipse":return(0,ut.jsx)(Bi,{children:(0,ut.jsx)("ellipse",{cx:"12",cy:"12",rx:"7",ry:"5"})});case"text":return(0,ut.jsxs)(Bi,{children:[(0,ut.jsx)("path",{d:"M5 6h14"}),(0,ut.jsx)("path",{d:"M12 6v13"}),(0,ut.jsx)("path",{d:"M9 19h6"})]});case"pickImage":return(0,ut.jsxs)(Bi,{children:[(0,ut.jsx)("rect",{x:"5",y:"5",width:"14",height:"14",rx:"2"}),(0,ut.jsx)("path",{d:"M8 15l2.5-2.5L13 15l2-2 3 3"}),(0,ut.jsx)("circle",{cx:"9",cy:"9",r:"1"})]})}}function Q2({videoEl:n,srcDims:a,canvasDims:o,state:l,mode:s,patchLive:d,commit:m,maxW:h=Number.POSITIVE_INFINITY,maxH:g=Number.POSITIVE_INFINITY,zoomPercent:v=null,t:w}){let W=(0,Zn.useRef)(null),S=(0,Zn.useRef)(null),Q=(0,Zn.useRef)(null),X=(0,Zn.useRef)(null),[ue,oe]=(0,Zn.useState)("pen"),[ge,Be]=(0,Zn.useState)("#ff4d4f"),[Te,de]=(0,Zn.useState)(6),[Ae,ve]=(0,Zn.useState)(-1),[j,k]=(0,Zn.useState)(""),[H,T]=(0,Zn.useState)(null),[_,le]=(0,Zn.useState)(null),[se,me]=(0,Zn.useState)(!1),P=(0,Zn.useRef)(null),$=(0,Zn.useRef)(-1),M=(0,Zn.useRef)(null),A=(0,Zn.useRef)(new Map),ee=(0,Zn.useRef)(()=>{}),Me=(0,Zn.useRef)(()=>{}),_e=(0,Zn.useRef)({x:.5,y:.5}),x=K=>{$.current=K,ve(K),Me.current()},C=oo(o,l),O=C.w?Math.min(h/C.w,g/C.h,1):1,B=v==null?O:v/100,G=Math.max(2,Math.round(C.w*B)),ze=Math.max(2,Math.round(C.h*B)),J=C.w?G/C.w:1,te=Number.isFinite(g)?Math.max(180,g+24):void 0,U=Number.isFinite(h)?Math.max(G,Math.round(h)):G,xe=Number.isFinite(g)?Math.max(ze,Math.round(g)):ze,Ce=l.overlays??[],Ye=Ae>=0?Ce[Ae]:void 0,et=Ye?tw(Ye,J):null;(0,Zn.useEffect)(()=>{le(null),me(!1)},[Ae]);let lt=()=>{let K=Q.current;K&&(_e.current={x:K.scrollWidth>K.clientWidth?(K.scrollLeft+K.clientWidth/2)/K.scrollWidth:.5,y:K.scrollHeight>K.clientHeight?(K.scrollTop+K.clientHeight/2)/K.scrollHeight:.5})};(0,Zn.useEffect)(()=>{let K=Q.current;if(K)return K.addEventListener("scroll",lt,{passive:!0}),()=>K.removeEventListener("scroll",lt)},[]),(0,Zn.useLayoutEffect)(()=>{let K=Q.current;if(!K)return;let Le=_e.current,Ze=requestAnimationFrame(()=>{K.scrollLeft=Math.max(0,K.scrollWidth*Le.x-K.clientWidth/2),K.scrollTop=Math.max(0,K.scrollHeight*Le.y-K.clientHeight/2),lt()});return()=>cancelAnimationFrame(Ze)},[G,ze,U,xe]),(0,Zn.useEffect)(()=>{rc(Ce).then(K=>{A.current=K,Me.current()})},[Ce]),(0,Zn.useEffect)(()=>{let K=0,Le=0,Ze=Math.min(1,1100/C.w),Tt=()=>{let Y=W.current,fe=n;if(Y&&fe&&a.w&&C.w&&fe.readyState>=2){Zm(Y,fe,a,o,l,Ze,void 0,!1);let Ne=Y.getContext("2d");if(Ne){Ne.setTransform(Ze,0,0,Ze,0,0);let Qe=_?Ce.filter((Et,z)=>z!==_.idx):Ce;nc(Ne,Qe,A.current),P.current&&nc(Ne,[P.current],A.current),Ne.setTransform(1,0,0,1,0,0)}}},rn=()=>!!n&&!n.paused&&!n.ended,Pt=()=>{Le||K||(Le=requestAnimationFrame(()=>{Le=0,Tt()}))},nn=()=>{Tt(),K=rn()?requestAnimationFrame(nn):0},wn=()=>{K||(K=requestAnimationFrame(nn))};return ee.current=Tt,Me.current=Pt,Pt(),rn()&&wn(),n?.addEventListener("play",wn),n?.addEventListener("playing",wn),n?.addEventListener("pause",Pt),n?.addEventListener("seeked",Pt),n?.addEventListener("loadeddata",Pt),n?.addEventListener("timeupdate",Pt),()=>{ee.current===Tt&&(ee.current=()=>{}),Me.current===Pt&&(Me.current=()=>{}),cancelAnimationFrame(K),cancelAnimationFrame(Le),n?.removeEventListener("play",wn),n?.removeEventListener("playing",wn),n?.removeEventListener("pause",Pt),n?.removeEventListener("seeked",Pt),n?.removeEventListener("loadeddata",Pt),n?.removeEventListener("timeupdate",Pt)}},[n,a.w,a.h,o.w,o.h,C.w,C.h,l,Ce,Ae,_?.idx]);let ot=K=>{let Le=S.current.getBoundingClientRect();return{x:(K.clientX-Le.left)/J,y:(K.clientY-Le.top)/J}},gt=(K,Le,Ze)=>{let Tt=Ce[K];if(!Tt)return;let rn=mg(Tt),Pt=rn.x+rn.w/2,nn=rn.y+rn.h/2;M.current={startX:Le.x,startY:Le.y,orig:Tt,mode:Ze,baseW:Math.max(8,rn.w),baseDistance:Math.max(8,Math.hypot(Le.x-Pt,Le.y-nn)),centerX:Pt,centerY:nn,startAngle:Math.atan2(Le.y-nn,Le.x-Pt)*180/Math.PI,origRotation:da(Tt)},window.addEventListener("pointermove",st),window.addEventListener("pointerup",Ge)},Jt=K=>{let Le=qm(Ce,K.x,K.y,Math.max(8,12/J));return x(Le),Le>=0?(gt(Le,K,"move"),!0):!1},_t=K=>{let Le=Ce[K];return!Le||Le.type!=="text"?!1:(x(K),me(!1),le({idx:K,value:Le.text,original:Le.text}),!0)},xt=K=>{K.preventDefault(),K.stopPropagation();let Le=ot(K),Ze=qm(Ce,Le.x,Le.y,Math.max(8,12/J));Ze>=0&&_t(Ze)},Yt=K=>{if(H)return;K.preventDefault();let Le=ot(K);if(ue==="eraser"&&s==="annotate"){let Tt=qm(Ce,Le.x,Le.y,Math.max(8,12/J));Tt>=0&&(m({overlays:Ce.filter((rn,Pt)=>Pt!==Tt)}),x(-1));return}if(Jt(Le)||s==="sticker")return;if(ue==="text"){T(Le);return}if(ue==="eraser")return;let Ze={color:ge,width:Te};P.current=ue==="pen"?{type:"pen",points:[Le.x,Le.y,Le.x+.01,Le.y+.01],...Ze}:ue==="line"||ue==="arrow"?{type:ue,x1:Le.x,y1:Le.y,x2:Le.x,y2:Le.y,...Ze}:{type:ue,x:Le.x,y:Le.y,w:1,h:1,...Ze},Me.current(),window.addEventListener("pointermove",tn),window.addEventListener("pointerup",_n)},tn=K=>{let Le=P.current;if(!Le)return;let Ze=ot(K);Le.type==="pen"?Le.points=[...Le.points,Ze.x,Ze.y]:Le.type==="line"||Le.type==="arrow"?(Le.x2=Ze.x,Le.y2=Ze.y):(Le.type==="rect"||Le.type==="ellipse")&&(Le.w=Ze.x-Le.x,Le.h=Ze.y-Le.y),Me.current()},_n=()=>{window.removeEventListener("pointermove",tn),window.removeEventListener("pointerup",_n);let K=P.current;if(P.current=null,Me.current(),!K||(K.type==="rect"||K.type==="ellipse")&&(Math.abs(K.w)<4||Math.abs(K.h)<4))return;let Le=K;(K.type==="rect"||K.type==="ellipse")&&(Le={...K,x:Math.min(K.x,K.x+K.w),y:Math.min(K.y,K.y+K.h),w:Math.abs(K.w),h:Math.abs(K.h)}),m({overlays:[...Ce,Le]})},st=K=>{let Le=M.current,Ze=$.current;if(!Le||Ze<0)return;let Tt=ot(K),rn=Le.origRotation+Math.atan2(Tt.y-Le.centerY,Tt.x-Le.centerX)*180/Math.PI-Le.startAngle,Pt=Le.mode==="scale"?Ym(Le.orig,Math.hypot(Tt.x-Le.centerX,Tt.y-Le.centerY)/Le.baseDistance):Le.mode==="rotate"?s2(Le.orig,ew(rn,Le)):ac(Le.orig,Tt.x-Le.startX,Tt.y-Le.startY);d({overlays:Ce.map((nn,wn)=>wn===Ze?Pt:nn)}),Me.current()},Ge=()=>{window.removeEventListener("pointermove",st),window.removeEventListener("pointerup",Ge),M.current&&m(),M.current=null},mt=(K,Le)=>{let Ze=Math.round(C.w*.14),Tt=Le?J0(Le.w,Le.h,Ze):{w:Ze,h:Ze},rn={type:"sticker",x:Math.round(C.w/2-Tt.w/2),y:Math.round(C.h/2-Tt.h/2),w:Tt.w,h:Tt.h,emoji:K,src:Le?.src};x(Ce.length),m({overlays:[...Ce,rn]})},Rt=K=>{if(H&&K.trim()){let Le=Math.max(24,Math.round(C.w/18));m({overlays:[...Ce,{type:"text",x:H.x,y:H.y,text:K.trim(),color:ge,fontSize:Le}]})}T(null)},Vt=(K,Le)=>{let Ze=$.current;if(Ze<0||!Ce[Ze])return;let Tt=Ce.map((rn,Pt)=>Pt===Ze?K(rn):rn);Le==="commit"?m({overlays:Tt}):d({overlays:Tt})},kn=()=>{let K=$.current;if(K<0||!Ce[K])return;let Le=ac(Ce[K],24,24);x(Ce.length),m({overlays:[...Ce,Le]})},xn=()=>{let K=$.current;K<0||(m({overlays:Ce.filter((Le,Ze)=>Ze!==K)}),x(-1))},je=()=>{let K=$.current,Le=K>=0?Ce[K]:void 0;if(!(!Le||Le.type==="sticker")){if(Le.type==="text"){_t(K);return}le(null),me(Ze=>!Ze)}},dt=()=>{_&&Vt(K=>K.type==="text"?{...K,text:_.original}:K,"commit"),le(null)},yt=()=>{_&&m(),le(null)},pt=K=>{let Le=$.current,Ze=Ce[Le];!Ze||!lc(Ze)||Vt(Tt=>lc(Tt)?{...Tt,color:K}:Tt,"commit")},Mt=(K,Le)=>{Ye&&Jm(Ye)&&Vt(Ze=>Jm(Ze)?{...Ze,width:K}:Ze,Le)},dn=K=>{Be(K),pt(K)},Ut=K=>{de(K)},An=Ye&&lc(Ye)?Ye.color:ge;return(0,ut.jsxs)("div",{className:`me-video-overlay-view me-video-overlay-view-${s}`,style:{display:"flex",flexDirection:"column",alignItems:"center",gap:12},children:[(0,ut.jsx)("div",{ref:Q,className:"me-video-canvas-scroll",style:{position:"relative",zIndex:0,width:"100%",maxWidth:"100%",maxHeight:te,overflow:"auto",overscrollBehavior:"contain",padding:8,boxSizing:"border-box"},children:(0,ut.jsx)("div",{className:"me-video-canvas-stage",style:{position:"relative",width:U,minWidth:"100%",minHeight:xe,display:"grid",placeItems:"center"},children:(0,ut.jsxs)("div",{ref:S,style:{position:"relative",width:G,flex:"0 0 auto",touchAction:"none"},children:[(0,ut.jsx)("canvas",{ref:W,style:{display:"block",borderRadius:8,width:"100%",height:"auto",cursor:s==="sticker"?"default":ue==="eraser"?"cell":"crosshair"},onPointerDown:Yt,onDoubleClick:xt}),H&&(0,ut.jsx)("input",{autoFocus:!0,style:{position:"absolute",left:H.x*J,top:H.y*J,background:"rgba(0,0,0,0.75)",border:`1px solid ${Re.accent}`,color:"#fff",minWidth:120,padding:"4px 8px",borderRadius:4,fontSize:14,outline:"none"},placeholder:w("overlay.textPlaceholder"),onKeyDown:K=>{K.key==="Enter"&&Rt(K.target.value),K.key==="Escape"&&T(null)},onBlur:K=>Rt(K.target.value)}),Ye&&et&&(0,ut.jsxs)("div",{className:"me-video-selection-frame",style:et.frameStyle,children:[(0,ut.jsx)("div",{className:"me-video-selection-handle",style:et.handleStyle,onPointerDown:K=>{K.preventDefault(),K.stopPropagation(),gt(Ae,ot(K),"scale")},children:(0,ut.jsx)(X2,{})}),(0,ut.jsx)("div",{className:"me-video-selection-rotate-handle",style:et.rotateHandleStyle,onPointerDown:K=>{K.preventDefault(),K.stopPropagation(),gt(Ae,ot(K),"rotate")},children:(0,ut.jsx)(G2,{})}),(0,ut.jsxs)("div",{className:"me-video-overlay-actions",style:et.actionsStyle,onPointerDown:K=>K.stopPropagation(),children:[Ye.type!=="sticker"&&Ye.type!=="text"&&(0,ut.jsx)("button",{type:"button",title:w("overlay.editSelected"),"aria-label":w("overlay.editSelected"),onClick:je,style:Qm(),children:(0,ut.jsx)(U2,{})}),(0,ut.jsx)("button",{type:"button",title:w("overlay.copySelected"),"aria-label":w("overlay.copySelected"),onClick:kn,style:Qm(),children:(0,ut.jsx)(Z2,{})}),(0,ut.jsx)("button",{type:"button",title:w("overlay.delSelected"),"aria-label":w("overlay.delSelected"),onClick:xn,style:Qm(),children:(0,ut.jsx)(K2,{})})]}),_&&Ye.type==="text"&&(0,ut.jsx)("textarea",{autoFocus:!0,className:"me-video-overlay-text-editor",value:_.value,onChange:K=>{let Le=K.target.value;le(Ze=>Ze&&{...Ze,value:Le}),Vt(Ze=>Ze.type==="text"?{...Ze,text:Le}:Ze,"live")},onBlur:yt,onKeyDown:K=>{K.key==="Enter"&&!K.shiftKey&&(K.preventDefault(),K.target.blur()),K.key==="Escape"&&dt()},style:{...et.textEditorStyle,color:Ye.color,fontFamily:"inherit",fontSize:Math.max(12,Ye.fontSize*J),lineHeight:1.15,outline:"none"}}),se&&Ye.type!=="text"&&Ye.type!=="sticker"&&(0,ut.jsxs)("div",{className:"me-video-overlay-style-popover",style:{...Y2,...et.popoverCounterStyle,display:"flex",alignItems:"center",gap:8},children:[ug.map(K=>(0,ut.jsx)("button",{onClick:()=>pt(K),style:{width:18,height:18,borderRadius:"50%",background:K,outline:lc(Ye)&&Ye.color===K?`2px solid ${Re.accent}`:`1px solid ${Re.border}`,outlineOffset:2,border:"none",cursor:"pointer"}},K)),Jm(Ye)&&(0,ut.jsx)("input",{type:"range",min:2,max:24,step:1,value:Ye.width,onChange:K=>Mt(Number(K.target.value),"live"),onPointerUp:()=>m(),style:{width:90}})]})]})]})})}),s==="annotate"?(0,ut.jsxs)("div",{className:"me-video-fixed-controls me-video-overlay-controls",style:{position:"relative",zIndex:3,display:"flex",flexDirection:"column",alignItems:"center",gap:8,width:"100%"},children:[(0,ut.jsxs)("div",{className:"me-video-overlay-style-row",style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap",justifyContent:"center",fontSize:12,color:Re.muted},children:[(0,ut.jsx)("span",{style:{fontSize:11,color:Re.muted},children:w("overlay.color")}),ug.map(K=>(0,ut.jsx)("button",{onClick:()=>dn(K),style:{width:20,height:20,borderRadius:"50%",background:K,outline:An===K?`2px solid ${Re.accent}`:`1px solid ${Re.border}`,outlineOffset:2,border:"none",cursor:"pointer"}},K)),(0,ut.jsx)("span",{style:{fontSize:11,marginLeft:8,color:Re.muted},children:w("overlay.width")}),(0,ut.jsx)("input",{type:"range",min:2,max:24,step:1,value:Te,onChange:K=>Ut(Number(K.target.value))})]}),(0,ut.jsx)("div",{className:"me-video-overlay-tool-row",style:{display:"flex",alignItems:"center",gap:4,flexWrap:"wrap",justifyContent:"center"},children:W2.map(K=>(0,ut.jsxs)("button",{onClick:()=>{oe(K),x(-1)},style:cg(ue===K),children:[(0,ut.jsx)(dg,{id:K}),(0,ut.jsx)("span",{children:w(`overlay.${K}`)})]},K))})]}):(0,ut.jsxs)("div",{className:"me-video-fixed-controls me-video-sticker-controls",style:{position:"relative",zIndex:3,display:"flex",alignItems:"center",gap:8,flexWrap:"wrap",justifyContent:"center",width:"100%"},children:[(0,ut.jsxs)("button",{onClick:()=>X.current?.click(),style:cg(!1),children:[(0,ut.jsx)(dg,{id:"pickImage"}),(0,ut.jsx)("span",{children:w("overlay.pickImage")})]}),(0,ut.jsx)("input",{ref:X,type:"file",accept:"image/*",style:{display:"none"},onChange:K=>{let Le=K.target.files?.[0];if(K.target.value="",!!Le){if(!Le.type.startsWith("image/")){k(w("err.notImage"));return}k(""),V2(Le).then(Ze=>mt(void 0,{src:Ze.dataUrl,w:Ze.w,h:Ze.h})).catch(Ze=>k(Ze.message))}}}),q2.map(K=>(0,ut.jsx)("button",{onClick:()=>mt(K),style:{fontSize:24,lineHeight:1,padding:6,borderRadius:999,border:"none",background:"transparent",cursor:"pointer"},children:K},K)),(0,ut.jsx)("span",{style:{width:"100%",textAlign:"center",fontSize:11,color:Re.muted},children:w("overlay.hint")})]}),j&&(0,ut.jsx)("div",{style:{padding:"6px 12px",borderRadius:6,fontSize:12,background:"rgba(239,68,68,0.12)",color:"#fca5a5"},children:j})]})}function mg(n){return Ir(n)}function J2(n){let a=n%360;return a>180&&(a-=360),a<-180&&(a+=360),a}function ew(n,a){let o=J2(n);return a.zeroSnapped?Math.abs(o)<=7?0:(a.zeroSnapped=!1,n):Math.abs(o)<=2.5?(a.zeroSnapped=!0,0):n}function tw(n,a){let o=mg(n),l=12/Math.max(a,.001),s=Math.max(o.w,l),d=Math.max(o.h,l),m=o.x-Math.max(0,s-o.w)/2,h=o.y-Math.max(0,d-o.h)/2,g=6,v=da(n);return{bbox:{x:m,y:h,w:s,h:d},frameStyle:{position:"absolute",left:(m-g)*a,top:(h-g)*a,width:(s+g*2)*a,height:(d+g*2)*a,border:"1.5px dashed #7c7cf0",borderRadius:4,boxSizing:"border-box",pointerEvents:"none",zIndex:6,transform:v?`rotate(${v}deg)`:void 0,transformOrigin:"center"},handleStyle:{position:"absolute",width:20,height:20,right:-10,bottom:-10,borderRadius:999,background:"rgba(20,20,22,0.88)",border:"1.5px solid #7c7cf0",color:"#f4f4f7",boxShadow:"0 2px 8px rgba(0,0,0,0.32)",cursor:"nwse-resize",pointerEvents:"auto",touchAction:"none",display:"inline-flex",alignItems:"center",justifyContent:"center",zIndex:10},rotateHandleStyle:{position:"absolute",width:20,height:20,right:-10,top:-10,borderRadius:999,background:"rgba(20,20,22,0.88)",border:"1.5px solid #7c7cf0",color:"#f4f4f7",boxShadow:"0 2px 8px rgba(0,0,0,0.32)",cursor:"grab",pointerEvents:"auto",touchAction:"none",display:"inline-flex",alignItems:"center",justifyContent:"center"},actionsStyle:{position:"absolute",top:-40,left:"50%",display:"flex",alignItems:"center",justifyContent:"center",gap:6,pointerEvents:"auto",zIndex:9,transform:v?`translateX(-50%) rotate(${-v}deg)`:"translateX(-50%)",transformOrigin:"center bottom"},popoverCounterStyle:{transform:v?`rotate(${-v}deg)`:void 0,transformOrigin:"right top"},textEditorStyle:{position:"absolute",left:g*a,top:g*a,width:s*a,height:d*a,minWidth:40,minHeight:24,resize:"none",border:"1px solid rgba(124,124,240,0.7)",borderRadius:4,background:"rgba(20,20,22,0.22)",padding:2,boxSizing:"border-box",overflow:"hidden",pointerEvents:"auto",zIndex:11}}}function lc(n){return n.type!=="sticker"}function Jm(n){return n.type==="pen"||n.type==="line"||n.type==="arrow"||n.type==="rect"||n.type==="ellipse"}var el=Ar(Ta(),1),Sr=Ar(Qo(),1),ws=12;function fg(n){let a=Math.floor(n/60),o=n-a*60;return`${a}:${o.toFixed(2).padStart(5,"0")}`}function nw({open:n,onClose:a,videoSrcs:o,clips:l,canvasDims:s,state:d,duration:m,sampleThumb:h,fileName:g,t:v}){let[w,W]=(0,el.useState)(0),[S,Q]=(0,el.useState)(!1),X=(0,el.useRef)(new Map),[ue,oe]=(0,el.useState)(null),[ge,Be]=(0,el.useState)({w:2,h:2}),Te=j=>{let k=X.current.get(j);return k||(k=document.createElement("video"),k.src=o[j]?.url??"",k.muted=!0,k.playsInline=!0,k.preload="auto",X.current.set(j,k)),k},de=j=>{let k=Math.min(Math.max(0,j),Math.max(0,m-.01));W(k);let H=io(l,k);if(!H)return;let T=l[H.idx].srcIdx,_=Te(T);Be(o[T]?.dims??{w:2,h:2}),oe(_),_.readyState>=1?_.currentTime=H.srcTime:_.addEventListener("loadedmetadata",()=>{_.currentTime=H.srcTime},{once:!0})};if((0,el.useEffect)(()=>(n&&de(w),()=>{n&&(X.current.forEach(j=>{try{j.pause(),j.removeAttribute("src"),j.load()}catch{}}),X.current.clear())}),[n]),!n)return null;let Ae=async()=>{if(!(!ue||S)){Q(!0);try{let j=document.createElement("canvas"),k=await rc(d.overlays??[]);Zm(j,ue,ge,s,d,1,k,!0);let H=await new Promise(le=>j.toBlob(se=>le(se),"image/jpeg",.92));if(!H)throw new Error(v("err.posterFailed"));let T=URL.createObjectURL(H),_=document.createElement("a");_.href=T,_.download=`${g}_poster.jpg`,document.body.appendChild(_),_.click(),_.remove(),setTimeout(()=>URL.revokeObjectURL(T),5e3),a()}finally{Q(!1)}}},ve={padding:"8px 16px",borderRadius:8,fontSize:13,border:"none",cursor:"pointer",background:Re.chip,color:Re.muted,font:"inherit"};return(0,Sr.jsx)("div",{style:{position:"fixed",inset:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",padding:24,background:"rgba(0,0,0,0.7)",backdropFilter:"blur(4px)"},onClick:a,children:(0,Sr.jsxs)("div",{style:{borderRadius:16,padding:16,display:"flex",flexDirection:"column",gap:12,maxWidth:672,width:"100%",background:Re.surface,border:`1px solid ${Re.border}`},onClick:j=>j.stopPropagation(),children:[(0,Sr.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[(0,Sr.jsx)("span",{style:{fontSize:14,fontWeight:500,color:Re.fg},children:v("poster.title")}),(0,Sr.jsxs)("span",{style:{marginLeft:8,fontSize:11,fontVariantNumeric:"tabular-nums",color:Re.muted},children:[fg(w)," / ",fg(m)]}),(0,Sr.jsx)("div",{style:{flex:1}}),(0,Sr.jsx)("button",{onClick:a,style:{width:28,height:28,borderRadius:6,border:"none",background:"transparent",color:Re.muted,cursor:"pointer"},children:"\u2715"})]}),(0,Sr.jsx)("div",{style:{display:"flex",justifyContent:"center"},children:(0,Sr.jsx)(sg,{videoEl:ue,srcDims:ge,canvasDims:s,state:d,maxW:620,maxH:340})}),(0,Sr.jsx)("div",{style:{display:"flex",borderRadius:8,overflow:"hidden",height:44},children:Array.from({length:ws},(j,k)=>{let H=(k+.5)*(m/ws),T=Math.abs(w-H)<m/ws/2,_=h(H);return _?(0,Sr.jsx)("img",{src:_,alt:"",onClick:()=>de(H),style:{height:"100%",objectFit:"cover",cursor:"pointer",width:`${100/ws}%`,outline:T?`2px solid ${Re.accent}`:"none",outlineOffset:-2},draggable:!1},k):(0,Sr.jsx)("span",{style:{height:"100%",width:`${100/ws}%`,background:Re.chip},onClick:()=>de(H)},k)})}),(0,Sr.jsx)("input",{type:"range",min:0,max:Math.max(.1,m),step:.05,value:w,onChange:j=>de(Number(j.target.value)),style:{width:"100%"}}),(0,Sr.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:8},children:[(0,Sr.jsx)("button",{onClick:a,style:ve,children:v("act.cancel")}),(0,Sr.jsx)("button",{onClick:Ae,disabled:S,style:{padding:"8px 20px",borderRadius:8,fontSize:13,fontWeight:500,border:"none",cursor:"pointer",background:Re.accent,color:Re.accentFg,opacity:S?.6:1},children:v(S?"act.exporting":"act.exportPoster")})]})]})})}var ne=Ar(Qo(),1),rw=n=>Math.min(96,Math.max(12,Math.ceil(n/.5))),aw=4,iw=240,ow=80,lw=[.5,1,2,5,10,15,30,60],ef=10,tf=500,pg=[50,100,200],sw=["trim","crop","filter","annotate","sticker","resize"];function hg(n){return JSON.parse(JSON.stringify(n))}function sc(n){let a=Math.floor(n/60),o=n-a*60;return`${a}:${o.toFixed(1).padStart(4,"0")}`}function uw(n,a){if(a<1)return sc(n);let o=Math.floor(n/60),l=Math.round(n-o*60);return`${o}:${String(l).padStart(2,"0")}`}function uc(n){return Math.min(tf,Math.max(ef,Math.round(n)))}function cw(n,a,o=rw(a)){return new Promise(l=>{let s=document.createElement("video");s.src=n,s.muted=!0,s.preload="auto";let d=128,m=72,h=document.createElement("canvas");h.width=d,h.height=m;let g=h.getContext("2d");if(!g)return l([]);let v=[],w=0,W=()=>{if(w>=o)return l(v);s.currentTime=Math.min(Math.max(0,a-.05),(w+.5)*(a/o))};s.onseeked=()=>{let S=s.videoWidth/s.videoHeight||1,Q=d/m,X=s.videoWidth,ue=s.videoHeight,oe=0,ge=0;S>Q?(X=s.videoHeight*Q,oe=(s.videoWidth-X)/2):(ue=s.videoWidth/Q,ge=(s.videoHeight-ue)/2),g.drawImage(s,oe,ge,X,ue,0,0,d,m),v.push(h.toDataURL("image/jpeg",.5)),w++,W()},s.onloadedmetadata=W,s.onerror=()=>l(v)})}var dw=n=>({width:"var(--me-editor-tool-button-width, 72px)",minHeight:"var(--me-editor-tool-button-height, 66px)",padding:"8px 0",borderRadius:"var(--me-editor-tool-button-radius, 8px)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"var(--me-editor-tool-button-gap, 6px)",background:n?"color-mix(in srgb, var(--me-accent, #7c7cf0) 16%, transparent)":"transparent",color:n?"var(--me-accent, #7c7cf0)":Re.muted,border:"1px solid transparent",boxSizing:"border-box",cursor:"pointer",font:"inherit"}),mw={width:"var(--me-editor-tool-icon-size, 20px)",height:"var(--me-editor-tool-icon-size, 20px)",display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:1},fw={fontSize:"var(--me-editor-tool-label-size, 12px)",lineHeight:1.2},nr={background:Re.surface,color:Re.fg,border:"none",borderRadius:6,cursor:"pointer",font:"inherit"};function tl({children:n,viewBox:a="0 0 24 24"}){return(0,ne.jsx)("svg",{className:"me-video-tool-icon",viewBox:a,"aria-hidden":"true",focusable:"false",children:n})}function cc({children:n,viewBox:a="0 0 24 24"}){return(0,ne.jsx)("svg",{className:"me-video-history-icon",viewBox:a,"aria-hidden":"true",focusable:"false",children:n})}function pw(){return(0,ne.jsxs)(cc,{viewBox:"0 0 1024 1024",children:[(0,ne.jsx)("path",{d:"M495.7 313.1c-16.6 0-30 13.4-30 30v182.6c0 3.3 0.5 6.4 1.5 9.3 2.1 14.5 14.6 25.7 29.7 25.7h182.6c16.6 0 30-13.4 30-30s-13.4-30-30-30H525.7V343.1c0-16.6-13.4-30-30-30z",fill:"currentColor",stroke:"none"}),(0,ne.jsx)("path",{d:"M857.3 366.1c-18.9-44.6-45.9-84.7-80.3-119.1-34.4-34.4-74.5-61.4-119.1-80.3-46.2-19.5-95.3-29.5-145.9-29.5-44.8 0-88.7 7.8-130.3 23.3-40.3 14.9-77.4 36.6-110.4 64.3-47.2 39.6-83.8 90.2-106.6 146.6l-16.1-30c-7.8-14.6-26-20.1-40.6-12.2-14.6 7.8-20.1 26-12.2 40.6l51.1 95.1c0.3 0.6 0.7 1.2 1.1 1.8 0.2 0.4 0.5 0.7 0.7 1.1 0.1 0.2 0.3 0.4 0.4 0.7 5.8 7.9 14.8 12.2 24.2 12.2 4.8 0 9.7-1.2 14.2-3.6 0 0 0.1 0 0.1-0.1l95-51c14.6-7.8 20.1-26 12.2-40.6-7.8-14.6-26-20.1-40.6-12.2l-32.5 17.5c19.3-46.1 49.5-87.4 88.3-120 27.7-23.3 58.9-41.4 92.7-54 35-13 71.8-19.5 109.5-19.5 84.1 0 163.1 32.7 222.5 92.2s92.2 138.5 92.2 222.5-32.9 163.2-92.4 222.6-138.4 92.2-222.5 92.2-163.1-32.7-222.5-92.2c-11.7-11.7-30.7-11.7-42.4 0s-11.7 30.7 0 42.4c34.4 34.4 74.5 61.4 119.1 80.3 46.2 19.5 95.3 29.5 145.9 29.5s99.7-9.9 145.9-29.5c44.6-18.9 84.7-45.9 119.1-80.3 34.4-34.4 61.4-74.5 80.3-119.1 19.5-46.2 29.5-95.3 29.5-145.9s-10.1-99.5-29.6-145.8z",fill:"currentColor",stroke:"none"})]})}function hw(){return(0,ne.jsxs)(cc,{children:[(0,ne.jsx)("path",{d:"M9 7H5v4"}),(0,ne.jsx)("path",{d:"M5.4 10.5a7 7 0 0 1 11.9-2.7 7 7 0 0 1 0 8.4"})]})}function vw(){return(0,ne.jsxs)(cc,{children:[(0,ne.jsx)("path",{d:"M15 7h4v4"}),(0,ne.jsx)("path",{d:"M18.6 10.5A7 7 0 0 0 6.7 7.8a7 7 0 0 0 0 8.4"})]})}function gw(){return(0,ne.jsx)(cc,{children:(0,ne.jsx)("path",{d:"M6 4l12 8-6 1.5L9 20 6 4z"})})}function bw({open:n}){return(0,ne.jsx)("svg",{className:"me-video-preview-caret",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",style:{width:14,height:14,transform:n?"rotate(180deg)":void 0},children:(0,ne.jsx)("path",{d:"M4 6l4 4 4-4",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})}function vg({dir:n}){return(0,ne.jsx)("svg",{viewBox:"0 0 12 12",width:12,height:12,"aria-hidden":"true",focusable:"false",style:{display:"block",transform:n==="down"?"rotate(180deg)":void 0},children:(0,ne.jsx)("path",{d:"M3 7l3-3 3 3",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}function yw({id:n}){switch(n){case"trim":return(0,ne.jsx)(tl,{viewBox:"0 0 1024 1024",children:(0,ne.jsx)("path",{d:"M870.912 769.264941a26.352941 26.352941 0 0 1-23.070118 26.142118l-3.312941 0.210823h-228.382117a26.352941 26.352941 0 0 1-3.312942-52.525176l3.312942-0.180706 43.911529-0.030118V655.058824h-43.911529a26.352941 26.352941 0 0 1-3.312942-52.495059l3.312942-0.210824h202.029176v-193.264941h-202.029176a26.352941 26.352941 0 0 1-3.312942-52.495059l3.312942-0.210823h43.911529V268.528941h-43.911529a26.352941 26.352941 0 0 1-3.312942-52.495059l3.312942-0.180706h228.412235c13.432471 0 24.515765 10.029176 26.142117 23.04l0.210824 3.312942v527.058823z m-52.705882-114.206117h-105.411765v87.823058h105.411765V655.058824z m0-386.529883h-105.411765v87.853177h105.411765V268.528941zM150.588235 242.206118c0-13.432471 10.059294-24.545882 23.04-26.172236l3.312941-0.180706h228.382118a26.352941 26.352941 0 0 1 3.312941 52.495059l-3.312941 0.210824L361.411765 268.528941v87.853177h43.971764a26.352941 26.352941 0 0 1 3.312942 52.525176l-3.312942 0.180706h-202.089411V602.352941h202.089411a26.352941 26.352941 0 0 1 3.312942 52.495059l-3.312942 0.210824h-43.971764v87.823058h43.971764a26.352941 26.352941 0 0 1 3.312942 52.525177l-3.312942 0.210823H176.911059a26.352941 26.352941 0 0 1-26.142118-23.070117L150.588235 769.234824v-527.058824z m158.117647 412.852706h-105.411764v87.823058h105.411764V655.058824z m0-386.529883h-105.411764v87.853177h105.411764V268.528941zM510.735059 180.705882c13.432471 0 24.545882 10.059294 26.172235 23.04l0.180706 3.312942v70.26447a26.352941 26.352941 0 0 1-52.495059 3.312941l-0.210823-3.312941V207.058824c0-14.546824 11.806118-26.352941 26.352941-26.352942zM510.735059 356.382118c13.432471 0 24.545882 10.059294 26.172235 23.070117l0.180706 3.312941v70.264471a26.352941 26.352941 0 0 1-52.495059 3.312941l-0.210823-3.312941v-70.294588c0-14.546824 11.806118-26.352941 26.352941-26.352941zM510.735059 532.088471c13.432471 0 24.545882 10.029176 26.172235 23.04l0.180706 3.312941v70.26447a26.352941 26.352941 0 0 1-52.495059 3.312942l-0.210823-3.312942v-70.26447c0-14.576941 11.806118-26.352941 26.352941-26.352941zM510.735059 707.764706c13.432471 0 24.545882 10.059294 26.172235 23.04l0.180706 3.312941v70.264471a26.352941 26.352941 0 0 1-52.495059 3.312941l-0.210823-3.312941v-70.264471c0-14.546824 11.806118-26.352941 26.352941-26.352941z",fill:"currentColor",stroke:"none"})});case"crop":return(0,ne.jsxs)(tl,{children:[(0,ne.jsx)("path",{d:"M7 3v14a4 4 0 0 0 4 4h10"}),(0,ne.jsx)("path",{d:"M3 7h14a4 4 0 0 1 4 4v10"})]});case"filter":return(0,ne.jsxs)(tl,{children:[(0,ne.jsx)("circle",{cx:"8.5",cy:"8.5",r:"4.2"}),(0,ne.jsx)("circle",{cx:"15.5",cy:"8.5",r:"4.2"}),(0,ne.jsx)("circle",{cx:"12",cy:"15.5",r:"4.2"})]});case"annotate":return(0,ne.jsxs)(tl,{children:[(0,ne.jsx)("path",{d:"M4 20l4.6-1 9.8-9.8a2.1 2.1 0 0 0-3-3L5.6 16 4 20z"}),(0,ne.jsx)("path",{d:"M13.8 7.8l2.4 2.4"})]});case"sticker":return(0,ne.jsxs)(tl,{children:[(0,ne.jsx)("path",{d:"M6 5h12v8.5L13.5 18H6V5z"}),(0,ne.jsx)("path",{d:"M13.5 18v-4.5H18"}),(0,ne.jsx)("path",{d:"M9 9h.01"}),(0,ne.jsx)("path",{d:"M13 9h.01"}),(0,ne.jsx)("path",{d:"M9 12.5c1.4 1 2.6 1 4 0"})]});case"resize":return(0,ne.jsxs)(tl,{children:[(0,ne.jsx)("path",{d:"M4 9V4h5"}),(0,ne.jsx)("path",{d:"M20 15v5h-5"}),(0,ne.jsx)("path",{d:"M4 4l6 6"}),(0,ne.jsx)("path",{d:"M20 20l-6-6"})]})}}function xw({engine:n,client:a,source:o,t:l,onExported:s,onError:d,maxVideos:m=6,maxAudios:h=3}){let g=O2(n),v=P2(n),w=$2(n),W=(0,Ft.useRef)(null),S=(0,Ft.useRef)(null),Q=(0,Ft.useRef)(null),X=(0,Ft.useRef)(null),ue=(0,Ft.useRef)({x:.5,y:.5}),oe=(0,Ft.useRef)(null),ge=(0,Ft.useRef)(null),Be=(0,Ft.useRef)(null),Te=(0,Ft.useRef)(null),de=(0,Ft.useRef)(!1),Ae=(0,Ft.useRef)(null),ve=(0,Ft.useRef)(null),[j,k]=(0,Ft.useState)([]),[H,T]=(0,Ft.useState)([]),[_,le]=(0,Ft.useState)(0),[se,me]=(0,Ft.useState)(!1),[P,$]=(0,Ft.useState)(0),[M,A]=(0,Ft.useState)("trim"),[ee,Me]=(0,Ft.useState)({width:0,height:0}),[_e,x]=(0,Ft.useState)(!1),[C,O]=(0,Ft.useState)("brightness"),[B,G]=(0,Ft.useState)(""),[ze,J]=(0,Ft.useState)("fit"),[te,U]=(0,Ft.useState)(!1),[xe,Ce]=(0,Ft.useState)("100"),[Ye,et]=(0,Ft.useState)(!0),[lt,ot]=(0,Ft.useState)(""),[gt,Jt]=(0,Ft.useState)(!1),[_t,xt]=(0,Ft.useState)(!1),[Yt,tn]=(0,Ft.useState)(""),[_n,st]=(0,Ft.useState)(""),[Ge,mt]=(0,Ft.useState)(null),[Rt,Vt]=(0,Ft.useState)(null),[kn,xn]=(0,Ft.useState)(null),[je,dt]=(0,Ft.useState)(60),yt=(0,Ft.useRef)(60);yt.current=je;let pt=(0,Ft.useRef)([]),Mt=(0,Ft.useRef)([]),dn=(0,Ft.useRef)(g),Ut=(0,Ft.useRef)(!1),An=(0,Ft.useRef)(0),K=(0,Ft.useRef)(0),Le=(0,Ft.useRef)(null),Ze=(0,Ft.useRef)(!1),Tt=(0,Ft.useRef)(null),rn=(0,Ft.useRef)(0),Pt=(0,Ft.useRef)([]),nn=(0,Ft.useRef)(null),wn=(0,Ft.useRef)(()=>{});dn.current=g;let Y=g.clips,fe=(0,Ft.useRef)(Y);fe.current=Y;let Ne=ai(Y),Qe=g.canvas,Et=g.audioClips??[],z=Dm(Y,Et),V=j.length>0&&Y.length>0,Fe=j[Y[P]?.srcIdx]??j[0]??null,He=Fe?.el??null,Xe=Fe?.dims??{w:2,h:2},ct=N=>{K.current=N,$(I=>I===N?I:N)},kt=N=>{A(N)},rt=N=>{Te.current==null&&(Te.current=hg(N),x(!0))};(0,Ft.useLayoutEffect)(()=>{let N=S.current;if(!N)return;let I=0,we=()=>{I=0;let dr=N.getBoundingClientRect(),pr=window.getComputedStyle(N),na=parseFloat(pr.paddingLeft||"0")+parseFloat(pr.paddingRight||"0"),ja=parseFloat(pr.paddingTop||"0")+parseFloat(pr.paddingBottom||"0"),fa=Math.max(0,Math.floor(dr.width-na)),Vr=Math.max(0,Math.floor(dr.height-ja));if(fa<=0||Vr<=0){let hr=N.closest(".me-video-workspace");if(hr){let pa=window.getComputedStyle(hr),yr=hr.getBoundingClientRect(),Oa=parseFloat(pa.paddingLeft||"0")+parseFloat(pa.paddingRight||"0"),fo=parseFloat(pa.paddingTop||"0")+parseFloat(pa.paddingBottom||"0"),oi=parseFloat(pa.columnGap||pa.gap||"0")||0,Ds=hr.querySelector(".me-video-toolrail"),$i=hr.querySelector(".me-video-inspector-rail"),po=hr.querySelector(".me-video-trim-panel"),Pa=Ds?Ds.getBoundingClientRect():null,$a=$i&&!$i.hidden?$i.getBoundingClientRect():null,ho=po?po.getBoundingClientRect():null,js=Pa&&Pa.width>0?Pa.width:0,Os=$a&&$a.width>0&&$a.height>0?$a.width:0,Ps=ho&&ho.height>0?ho.height:0,pl=js>0?oi:0,Bc=Os>0?oi:0,zc=Ps>0&&parseFloat(pa.rowGap||pa.gap||"0")||0;fa=fa>0?fa:Math.max(0,Math.floor(yr.width-Oa-js-Os-pl-Bc)),Vr=Vr>0?Vr:Math.max(0,Math.floor(yr.height-fo-Ps-zc))}}Me(hr=>hr.width===fa&&hr.height===Vr?hr:{width:fa,height:Vr})},tt=()=>{I||(I=requestAnimationFrame(we))},Je=new ResizeObserver(tt),qt=N.closest(".me-video-workspace"),It=qt?qt.querySelector(".me-video-toolrail"):null,Kt=qt?qt.querySelector(".me-video-inspector-rail"):null,an=qt?qt.querySelector(".me-video-trim-panel"):null,Jn=typeof MutationObserver=="function"&&qt?new MutationObserver(tt):null;return Je.observe(N),qt&&qt!==N&&Je.observe(qt),It&&It!==N&&Je.observe(It),Kt&&Kt!==N&&Je.observe(Kt),an&&an!==N&&Je.observe(an),Jn&&Jn.observe(qt,{childList:!0,subtree:!0}),tt(),()=>{I&&cancelAnimationFrame(I),Jn&&Jn.disconnect(),Je.disconnect()}},[]),(0,Ft.useEffect)(()=>{if(!te)return;let N=I=>{X.current?.contains(I.target)||U(!1)};return window.addEventListener("pointerdown",N),()=>window.removeEventListener("pointerdown",N)},[te]);let at=N=>{if(!N.type.startsWith("video/")){tn(l("err.notVideo"));return}if(pt.current.length>=m){tn(l("err.maxVideo",{max:m}));return}tn("");let I=URL.createObjectURL(N);Pt.current.push(I);let we=document.createElement("video");we.src=I,we.muted=!0,we.playsInline=!0,we.preload="auto",we.style.display="none",W.current?.appendChild(we),we.addEventListener("loadedmetadata",()=>{let tt={w:we.videoWidth,h:we.videoHeight},Je=It=>{let Kt=n.registerVideoSource({duration:It,width:tt.w,height:tt.h});rt(n.getState()),pt.current=(()=>{let an=[...pt.current];return an[Kt]={file:N,url:I,el:we,duration:It,dims:tt,thumbs:[]},an})(),k(pt.current),setTimeout(()=>fn(),0),cw(I,It).then(an=>{pt.current=pt.current.map((Jn,dr)=>dr===Kt?{...Jn,thumbs:an}:Jn),k(pt.current)})};if(isFinite(we.duration)&&we.duration>0){Je(we.duration);return}let qt=()=>{isFinite(we.duration)&&we.duration>0&&(we.removeEventListener("durationchange",qt),we.currentTime=0,Je(we.duration))};we.addEventListener("durationchange",qt),we.currentTime=1e7},{once:!0}),we.addEventListener("error",()=>tn(l("err.videoLoad")),{once:!0})},Ke=N=>{if(!N.type.startsWith("audio/")&&!N.type.startsWith("video/")){tn(l("err.notAudio"));return}if(Mt.current.length>=h){tn(l("err.maxAudio",{max:h}));return}tn("");let I=URL.createObjectURL(N);Pt.current.push(I);let we=new Audio;we.src=I,we.preload="auto",we.addEventListener("loadedmetadata",()=>{let tt=n.registerAudioSource({duration:we.duration});Mt.current=(()=>{let Je=[...Mt.current];return Je[tt]={file:N,url:I,el:we,duration:we.duration},Je})(),T(Mt.current)},{once:!0}),we.addEventListener("error",()=>tn(l("err.audioLoad")),{once:!0})},Nt=()=>{pt.current.forEach(N=>{N&&(N.el.pause(),N.el.remove())}),Mt.current.forEach(N=>N?.el.pause()),Pt.current.forEach(N=>URL.revokeObjectURL(N)),Pt.current=[],pt.current=[],Mt.current=[],Ut.current=!1,An.current=0,K.current=0,Ze.current=!1,Le.current=null,Tt.current=null,ve.current=null,Te.current=null,n.reset(Qu()),k([]),T([]),me(!1),le(0),$(0),A("trim"),G(""),J("fit"),U(!1),Ce("100"),x(!1),st(""),mt(null),Vt(null),xn(null),Jt(!1),ot(""),tn("")};(0,Ft.useEffect)(()=>{!o||nn.current===o||(nn.current=o,Nt(),at(o))},[o]),(0,Ft.useEffect)(()=>{let N=Pt.current;return()=>{pt.current.forEach(I=>I?.el.pause()),Mt.current.forEach(I=>I?.el.pause()),N.forEach(I=>URL.revokeObjectURL(I))}},[]),(0,Ft.useEffect)(()=>{let N=j[0]?.thumbs;N?.length&&st(N[Math.floor(N.length/2)])},[j]);let Wt=N=>pt.current[fe.current[N]?.srcIdx],Ct=()=>{if(Ze.current)return;let N=K.current,I=fe.current[N],we=Wt(N);if(!I||!we)return;let tt=Math.min(Math.max(we.el.currentTime-I.in,0),vs(I)),Je=Ju(fe.current,N)+tt;An.current=Je,le(qt=>Math.abs(qt-Je)>.004?Je:qt)},bt=()=>{if(Ze.current)return;let N=fe.current,I=K.current,we=N[I],tt=Wt(I);if(!we||!tt)return;let Je=tt.el;if(Je.paused&&!Je.ended)return;let qt=Je.currentTime;if(Le.current!=null){let It=Le.current;It.el===Je&&Math.abs(qt-It.t)<=.25&&(Le.current=null);return}if(qt>=we.out-.04){let It=N[I+1];if(It){let Kt=pt.current[It.srcIdx];if(!Kt)return;ct(I+1),Le.current={el:Kt.el,t:It.in},Kt.el===Je?(Je.currentTime=It.in,(Je.ended||Je.paused)&&Je.play().catch(()=>{})):(Je.muted=!0,Je.pause(),Kt.el.muted=!dn.current.keepAudio,Kt.el.currentTime=It.in,Kt.el.play().catch(()=>{}))}else{Je.pause(),Ut.current=!1,me(!1);let Kt=N[0],an=pt.current[Kt.srcIdx];ct(0),an&&(Le.current={el:an.el,t:Kt.in},an.el.currentTime=Kt.in)}}else if(qt>=we.out-1){let It=N[I+1];if(It){let Kt=pt.current[It.srcIdx];Kt&&Kt.el!==Je&&Kt.el.paused&&Math.abs(Kt.el.currentTime-It.in)>.2&&(Kt.el.currentTime=It.in)}}},$t=()=>{let N=dn.current,I=fe.current[K.current]?.srcIdx;pt.current.forEach((Je,qt)=>{if(!Je)return;let It=!N.keepAudio||qt!==I;Je.el.muted!==It&&(Je.el.muted=It)});let we=An.current,tt=Ut.current&&!Ze.current;(N.audioClips??[]).forEach(Je=>{let qt=Mt.current[Je.srcIdx];if(!qt)return;let It=qt.el,Kt=Je.out-Je.in;if(tt&&we>=Je.startAt&&we<Je.startAt+Kt){let an=Je.in+(we-Je.startAt);Math.abs(It.currentTime-an)>.3&&(It.currentTime=an),It.volume=Math.min(1,Je.volume),It.paused&&It.play().catch(()=>{})}else It.paused||It.pause()})},un=N=>{let I=fe.current,we=Math.min(Math.max(0,N),ai(I));An.current=we,le(we);let tt=io(I,we);if(!tt)return;let Je=pt.current[I[tt.idx].srcIdx];if(!Je)return;pt.current.forEach(It=>{It&&It.el!==Je.el&&(It.el.muted=!0,It.el.paused||It.el.pause())}),Je.el.muted=!dn.current.keepAudio,ct(tt.idx),Le.current=null;let qt=performance.now();qt-rn.current>60?(rn.current=qt,Je.el.currentTime=tt.srcTime,Tt.current=null):Tt.current={el:Je.el,t:tt.srcTime},wn.current()},pn=()=>{let N=fe.current;if(!N.length)return;if(Ut.current){Wt(K.current)?.el.pause(),Mt.current.forEach(Je=>Je?.el.pause()),Ut.current=!1,me(!1),wn.current();return}let I=An.current;I>=ai(N)-.05&&(I=0);let we=io(N,I);if(!we)return;let tt=pt.current[N[we.idx].srcIdx];tt&&(ct(we.idx),Le.current=null,tt.el.muted=!dn.current.keepAudio,tt.el.currentTime=we.srcTime,Ut.current=!0,me(!0),wn.current(),tt.el.play().catch(()=>{Ut.current=!1,me(!1)}))};(0,Ft.useEffect)(()=>{let N=0,I=()=>{N=0,Tt.current!=null&&performance.now()-rn.current>60&&(rn.current=performance.now(),Tt.current.el.currentTime=Tt.current.t,Tt.current=null),Ct(),Ut.current&&bt(),$t(),(Ut.current||Tt.current)&&(N=requestAnimationFrame(I))};return wn.current=()=>{N||(N=requestAnimationFrame(I))},wn.current(),()=>{wn.current=()=>{},cancelAnimationFrame(N)}},[]),(0,Ft.useEffect)(()=>{let N=()=>{Ct(),Ut.current&&bt(),$t()},I=j.map(we=>we?.el).filter(Boolean);return I.forEach(we=>{we.addEventListener("timeupdate",N),we.addEventListener("ended",N)}),()=>I.forEach(we=>{we.removeEventListener("timeupdate",N),we.removeEventListener("ended",N)})},[j]),(0,Ft.useEffect)(()=>{let N=io(Y,Math.min(An.current,Math.max(0,ai(Y)-.01)));ct(N?N.idx:0),Le.current=null,mt(I=>I!=null&&I>=(g.audioClips?.length??0)?null:I)},[Y,g.audioClips]),(0,Ft.useEffect)(()=>{Te.current==null&&g.clips.length>0&&rt(g)},[g]);let Lt=N=>{let I=ge.current;return!I||yt.current<=0?0:Math.max(0,(N-I.getBoundingClientRect().left)/yt.current)},Zt=N=>Math.min(iw,Math.max(aw,N)),en=(N,I,we)=>{let tt=Zt(N);tt!==yt.current&&(Ae.current={time:I,viewportX:we},yt.current=tt,dt(tt))},Tn=N=>{let I=oe.current;if(!I)return;let we=yt.current,tt=An.current*we,Je=tt>=I.scrollLeft&&tt<=I.scrollLeft+I.clientWidth?An.current:(I.scrollLeft+I.clientWidth/2)/we;en(we*N,Je,Je*we-I.scrollLeft)},fn=()=>{let N=oe.current,I=Dm(fe.current,dn.current.audioClips??[]);if(!N||I<=0)return;let we=Zt(N.clientWidth/I);if(we===yt.current){N.scrollLeft=0;return}Ae.current={time:0,viewportX:0},yt.current=we,dt(we)};(0,Ft.useLayoutEffect)(()=>{if(de.current)return;let N=oe.current;if(!N||z<=0)return;de.current=!0;let I=Zt(N.clientWidth/z);yt.current=I,dt(I)},[V,M,z]),(0,Ft.useLayoutEffect)(()=>{let N=Ae.current;if(!N)return;Ae.current=null;let I=oe.current;I&&(I.scrollLeft=Math.max(0,N.time*je-N.viewportX))},[je]),(0,Ft.useEffect)(()=>{let N=oe.current;if(!N)return;let I=we=>{if(we.ctrlKey||we.metaKey){we.preventDefault();let tt=we.clientX-N.getBoundingClientRect().left,Je=yt.current;en(Je*Math.pow(1.0015,-we.deltaY),(N.scrollLeft+tt)/Je,tt)}else Math.abs(we.deltaY)>Math.abs(we.deltaX)&&(we.preventDefault(),N.scrollLeft+=we.deltaY)};return N.addEventListener("wheel",I,{passive:!1}),()=>N.removeEventListener("wheel",I)},[V,M]),(0,Ft.useEffect)(()=>{if(!se||Ze.current)return;let N=oe.current;if(!N||N.scrollWidth<=N.clientWidth)return;let I=_*je;(I<N.scrollLeft+20||I>N.scrollLeft+N.clientWidth-60)&&(N.scrollLeft=Math.max(0,I-N.clientWidth*.3))},[_,se,je]);let Dn=N=>{let I=ve.current;if(!I)return;if(I.kind==="playhead"){un(Lt(N.clientX));return}let we=Lt(N.clientX);if(I.kind==="clipIn"||I.kind==="clipOut"){let Kt=I.orig[I.idx],an=pt.current[Kt.srcIdx],Jn=an?.duration??Kt.out,dr=Kt.in+(we-I.origStart);v({clips:M0(I.orig,I.idx,I.kind==="clipIn"?"in":"out",dr,Jn)}),an&&(Ze.current=!0,ct(I.idx),an.el.muted=!0,an.el.currentTime=Math.min(Math.max(dr,0),Jn));return}let tt=dn.current.audioClips??[],Je=tt[I.idx];if(!Je)return;let qt=Mt.current[Je.srcIdx],It=ai(fe.current);if(I.kind==="audioMove")v({audioClips:tt.map((Kt,an)=>an===I.idx?gs({...Je,startAt:I.origStartAt+(we-I.downT)},qt?.duration??Je.out,It):Kt)});else if(I.kind==="audioIn"){let Kt=we-I.downT,an=gs({...Je,in:I.origIn+Kt,startAt:Je.startAt+(Math.min(Math.max(I.origIn+Kt,0),Je.out-.1)-Je.in)},qt?.duration??Je.out,It);v({audioClips:tt.map((Jn,dr)=>dr===I.idx?an:Jn)})}else{let Kt=gs({...Je,out:I.origOut+(we-I.downT)},qt?.duration??Je.out,It);v({audioClips:tt.map((an,Jn)=>Jn===I.idx?Kt:an)})}},zr=()=>{let N=ve.current&&ve.current.kind!=="playhead";ve.current=null,Ze.current=!1,window.removeEventListener("pointermove",Dn),window.removeEventListener("pointerup",zr),N&&w()},Hn=N=>I=>{I.preventDefault(),I.stopPropagation(),ve.current=N,window.addEventListener("pointermove",Dn),window.addEventListener("pointerup",zr),N.kind==="playhead"&&(Ze.current=!0,un(Lt(I.clientX)))},ur=N=>I=>{I.preventDefault(),I.stopPropagation();let we=Be.current,tt=Array.from(we?.querySelectorAll("[data-clipblock]")??[]).map(pr=>{let na=pr.getBoundingClientRect();return na.left+na.width/2}),Je=I.clientX,qt=performance.now(),It=N,Kt=N,an=!1;ct(N),Vt(N),xn(N);let Jn=pr=>{Math.abs(pr.clientX-Je)>4&&(an=!0);let na=0,ja=1/0;tt.forEach((fa,Vr)=>{let hr=Math.abs(pr.clientX-fa);hr<ja&&(ja=hr,na=Vr)}),Kt=na,xn(na)},dr=()=>{window.removeEventListener("pointermove",Jn),window.removeEventListener("pointerup",dr),Vt(null),xn(null),an&&It!==Kt&&w({clips:F0(n.getState().clips,It,Kt)}),ct(Kt)};window.addEventListener("pointermove",Jn),window.addEventListener("pointerup",dr)},Yn=N=>{G(N);let I=Gm.find(tt=>tt.ratio===N);if(!I||Qe.w<4){N||w({crop:void 0});return}let we=Go(Qe.w,Qe.h,g.rotation);w({crop:ec({w:we.w,h:we.h},I.value)})},Fr=async()=>{tn(""),ot(l("msg.processing")),Jt(!0);try{let N=await c2(n,pt.current.map(qt=>qt?.file),Mt.current.map(qt=>qt?.file)),I=await a.exportVideo(N),we=new Date,tt=[we.getHours(),we.getMinutes(),we.getSeconds()].map(qt=>String(qt).padStart(2,"0")).join(""),Je=pt.current[0]?.file.name?.replace(/\.[^.]+$/,"")||"video";s?.(I,`${Je}_edited_${tt}.mp4`),Jt(!1),ot(l("msg.done")),setTimeout(()=>ot(""),1500)}catch(N){Jt(!1),ot(""),tn(N.message),d?.(N)}},D=()=>{let N=Te.current;if(!N)return;pt.current.forEach(Je=>{Je&&(Je.el.pause(),Je.el.muted=!0)}),Mt.current.forEach(Je=>Je?.el.pause()),Ut.current=!1,me(!1),Ze.current=!1,Le.current=null,Tt.current=null,ve.current=null,mt(null),Vt(null),xn(null),G(""),Jt(!1),ot(""),tn("");let I=hg(N);n.reset(I);let we=I.clips[0],tt=we?pt.current[we.srcIdx]:null;ct(0),An.current=0,le(0),tt&&(tt.el.currentTime=we?.in??0,tt.el.muted=!I.keepAudio,wn.current())},ie=M==="crop"||M==="annotate"||M==="sticker",Pe=oo(Qe,g),E=Ne,F=ee.width>0&&ee.width<=520?M==="trim"||M==="filter"?150:M==="sticker"?132:M==="annotate"?116:M==="crop"?78:M==="resize"?82:M==="filter"?92:72:M==="trim"||M==="filter"?220:M==="resize"?116:M==="filter"?110:96,p=S.current&&window.getComputedStyle(S.current).display==="contents"&&(M==="trim"||M==="filter")?0:F,b=V&&!ie?76:0,L=Math.max(240,ee.width),q=Math.max(160,ee.height-p-b),Ee=M==="crop"?Go(Qe.w,Qe.h,g.rotation):Pe,be=Ee.w?Math.max(1,Math.round(Math.min(L/Ee.w,q/Ee.h,1)*100)):100,Oe=ze==="fit"?null:uc(ze),ae=Math.max(2,Math.round(Pe.w*(Oe??be)/100)),ke=Math.max(2,Math.round(Pe.h*(Oe??be)/100)),Ve=Oe==null?"100%":Math.max(ae,L),We=Math.max(ke,q),ft=Oe??be,nt=uc(ft),it=ze==="fit"?`${l("act.fit")} ${be}%`:`${ft}%`,ht=`${Pe.w} x ${Pe.h} px`,wt=N=>{Rn(),J(N==="fit"?"fit":uc(N))},Bt=N=>{let I=uc(N);Ce(String(I)),wt(I)},Ot=()=>{let N=Number(xe);if(!Number.isFinite(N)){Ce(String(nt));return}Bt(N)},on=N=>{let I=Number(xe);Bt((Number.isFinite(I)?I:nt)+N)};(0,Ft.useEffect)(()=>{Ce(String(nt))},[nt]),(0,Ft.useEffect)(()=>{if(!V)return;let N=I=>{if(I.defaultPrevented||!I.shiftKey||I.metaKey||I.ctrlKey||I.altKey)return;let we=I.target,tt=we?.tagName?.toLowerCase();if(tt==="input"||tt==="textarea"||tt==="select"||we?.isContentEditable)return;let Je=I.key.toLowerCase();if(Je==="f"){I.preventDefault(),wt("fit"),U(!1);return}let qt=Number(Je)-1,It=pg[qt];It!=null&&(I.preventDefault(),wt(It),U(!1))};return window.addEventListener("keydown",N),()=>window.removeEventListener("keydown",N)},[V,nt]);let Rn=()=>{let N=Q.current;N&&(ue.current={x:N.scrollWidth>N.clientWidth?(N.scrollLeft+N.clientWidth/2)/N.scrollWidth:.5,y:N.scrollHeight>N.clientHeight?(N.scrollTop+N.clientHeight/2)/N.scrollHeight:.5})};(0,Ft.useEffect)(()=>{let N=Q.current;if(N)return N.addEventListener("scroll",Rn,{passive:!0}),()=>N.removeEventListener("scroll",Rn)},[V,M]),(0,Ft.useLayoutEffect)(()=>{let N=Q.current;if(!N)return;let I=ue.current,we=requestAnimationFrame(()=>{N.scrollLeft=Math.max(0,N.scrollWidth*I.x-N.clientWidth/2),N.scrollTop=Math.max(0,N.scrollHeight*I.y-N.clientHeight/2),Rn()});return()=>cancelAnimationFrame(we)},[ae,ke,Ve,We]);let cr=(0,Ft.useMemo)(()=>{if(!isFinite(z)||z<=0||je<=0)return[];let N=lw.find(we=>we*je>=ow)??60;for(;z/N>1500;)N*=2;let I=[];for(let we=0;we<=z+1e-6;we+=N)I.push({x:we*je,label:uw(we,N)});return I},[z,je]),Mr=N=>{let I=j[N.srcIdx];if(!I?.thumbs.length||!I.duration)return[];let we=I.thumbs.length,tt=I.duration/we,Je=Math.max(1,Math.ceil(8/(tt*je))),qt=Math.max(0,Math.floor(N.in/tt)),It=Math.min(we,Math.ceil(N.out/tt)),Kt=[];for(let an=qt-qt%Je;an<It;an+=Je)Kt.push({key:an,src:I.thumbs[Math.min(we-1,an)],left:(an*tt-N.in)*je,width:tt*je*Je+.5});return Kt},ar=N=>{let I=io(fe.current,N);if(!I)return;let we=pt.current[fe.current[I.idx].srcIdx];if(!we?.thumbs.length||!we.duration)return;let tt=Math.min(we.thumbs.length-1,Math.max(0,Math.floor(I.srcTime/we.duration*we.thumbs.length)));return we.thumbs[tt]};return(0,ne.jsxs)("div",{className:"me-video-editor",style:{position:"relative",height:"100%",minHeight:0,display:"flex",flexDirection:"column",borderRadius:12,overflow:"hidden",background:Re.bg,border:`1px solid ${Re.border}`,color:Re.fg,fontSize:13,fontFamily:'-apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif',lineHeight:1.4},children:[(0,ne.jsxs)("div",{className:"me-video-topbar",style:{position:"relative",zIndex:30,overflow:"visible",display:"flex",alignItems:"center",padding:"8px 12px",borderBottom:`1px solid ${Re.border}`},children:[(0,ne.jsxs)("div",{className:"me-video-history",style:{display:"flex",alignItems:"center",gap:4},children:[(0,ne.jsx)("button",{onClick:D,disabled:!_e,style:{...nr,width:32,height:32,background:"transparent",color:Re.muted,opacity:_e?1:.4,display:"inline-flex",alignItems:"center",justifyContent:"center"},title:l("tip.resetOpened"),children:(0,ne.jsx)(pw,{})}),(0,ne.jsx)("button",{onClick:()=>n.undo(),disabled:!n.canUndo(),style:{...nr,width:32,height:32,background:"transparent",color:Re.muted,opacity:n.canUndo()?1:.4,display:"inline-flex",alignItems:"center",justifyContent:"center"},title:l("tip.undo"),children:(0,ne.jsx)(hw,{})}),(0,ne.jsx)("button",{onClick:()=>n.redo(),disabled:!n.canRedo(),style:{...nr,width:32,height:32,background:"transparent",color:Re.muted,opacity:n.canRedo()?1:.4,display:"inline-flex",alignItems:"center",justifyContent:"center"},title:l("tip.redo"),children:(0,ne.jsx)(vw,{})})]}),(0,ne.jsxs)("div",{className:"me-video-preview-zoom",style:{position:"absolute",zIndex:80,left:"50%",transform:"translateX(-50%)",display:"flex",alignItems:"center",gap:6,color:Re.muted,fontSize:12},children:[(0,ne.jsx)("span",{className:"me-video-preview-resolution",style:{minWidth:106,textAlign:"right",color:Re.muted,fontVariantNumeric:"tabular-nums",whiteSpace:"nowrap"},children:V?ht:"-- x -- px"}),(0,ne.jsx)("button",{type:"button",className:"me-video-preview-tool-button is-active",disabled:!V,title:l("tip.previewPointer"),"aria-label":l("tip.previewPointer"),style:{...nr,width:32,height:32,borderRadius:10,background:"color-mix(in srgb, var(--me-accent, #7c7cf0) 16%, transparent)",color:Re.accent,opacity:V?1:.45,display:"inline-flex",alignItems:"center",justifyContent:"center",padding:0},children:(0,ne.jsx)(gw,{})})]}),(0,ne.jsx)("div",{style:{flex:1}}),(0,ne.jsx)("button",{className:"me-video-poster",onClick:()=>{Ut.current&&pn(),xt(!0)},disabled:!V,style:{...nr,padding:"6px 12px",background:Re.chip,color:Re.muted,marginRight:8,opacity:V?1:.4},title:l("tip.poster"),children:l("act.poster")}),(0,ne.jsx)("button",{className:"me-video-done",onClick:Fr,disabled:gt||!!lt||!V,style:{padding:"6px 20px",borderRadius:8,fontSize:13,fontWeight:600,border:"none",cursor:"pointer",background:"var(--me-video-done-bg, var(--me-accent,#5b5bd6))",color:"var(--me-video-done-fg, var(--me-accent-fg,#fff))",opacity:gt||lt||!V?.6:1},children:gt?l("act.exporting"):l("act.exportPoster").replace("\u5C01\u9762","").replace(/\s*cover/i,"").trim()||"Done"})]}),(0,ne.jsxs)("div",{className:"me-video-workspace",style:{flex:"1 1 0",minHeight:0,display:"flex",alignItems:"stretch",gap:8,padding:12},children:[(0,ne.jsx)("div",{className:"me-video-toolrail",style:{position:"relative",zIndex:20,display:"flex",flexDirection:"column",gap:6,flexShrink:0},children:sw.map(N=>(0,ne.jsxs)("button",{className:M===N?"is-active":void 0,onClick:()=>kt(N),style:dw(M===N),children:[(0,ne.jsx)("span",{style:mw,children:(0,ne.jsx)(yw,{id:N})}),(0,ne.jsx)("span",{style:fw,children:l(`tool.${N}`)})]},N))}),(0,ne.jsxs)("div",{ref:S,className:"me-video-main",style:{position:"relative",zIndex:1,overflow:"hidden",flex:1,minWidth:0,minHeight:0,boxSizing:"border-box",display:"flex",flexDirection:"column",alignItems:"center"},children:[(0,ne.jsx)("div",{ref:W,style:{display:"none"}}),!V&&(0,ne.jsxs)("label",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:8,height:320,color:Re.muted,cursor:"pointer"},children:[(0,ne.jsx)("span",{style:{fontSize:32},children:"\u{1F3AC}"}),(0,ne.jsx)("span",{style:{...nr,background:Re.accent,color:Re.accentFg,padding:"8px 16px"},children:l("panel.pick")}),(0,ne.jsx)("input",{type:"file",accept:"video/*",style:{display:"none"},onChange:N=>{let I=N.target.files?.[0];I&&at(I),N.target.value=""}})]}),V&&!ie&&(0,ne.jsxs)("div",{className:"me-video-preview-shell",style:{width:"100%",flex:"1 1 auto",minHeight:0,display:"flex",flexDirection:"column",alignItems:"stretch",gap:12},children:[(0,ne.jsx)("div",{ref:Q,className:"me-video-preview-scroll me-video-canvas-scroll",style:{position:"relative",zIndex:0,flex:"1 1 auto",minHeight:0,width:"100%",maxWidth:"100%",maxHeight:q,overflow:"auto",overscrollBehavior:"contain",padding:"14px 16px 10px",boxSizing:"border-box",background:"var(--me-surface)",borderRadius:18},children:(0,ne.jsx)("div",{className:"me-video-canvas-stage",style:{position:"relative",width:Ve,minWidth:"100%",minHeight:We,display:"grid",placeItems:"center"},children:(0,ne.jsx)(sg,{videoEl:He,srcDims:Xe,canvasDims:Qe,state:g,maxW:L,maxH:q,zoomPercent:Oe,onClick:M==="trim"?pn:void 0})})}),(0,ne.jsxs)("div",{className:"me-video-preview-footer",style:{flexShrink:0,minHeight:58,padding:"0 14px",borderRadius:16,background:"var(--me-surface)",boxShadow:"0 12px 30px rgba(0,0,0,0.12)",display:"grid",gridTemplateColumns:"minmax(0,1fr) auto minmax(0,1fr)",alignItems:"center",gap:12,color:Re.fg},children:[(0,ne.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,minWidth:0,fontSize:13,fontVariantNumeric:"tabular-nums",whiteSpace:"nowrap",overflow:"hidden"},children:[(0,ne.jsx)("span",{style:{color:"#00c8ff",fontWeight:600},children:sc(_)}),(0,ne.jsx)("span",{style:{color:Re.muted},children:`/ ${sc(Ne)}`})]}),(0,ne.jsx)("button",{type:"button",onClick:pn,disabled:!V,style:{...nr,width:38,height:38,borderRadius:999,background:"color-mix(in srgb, var(--me-fg, #ededf0) 8%, transparent)",color:Re.fg,display:"inline-flex",alignItems:"center",justifyContent:"center",padding:0,opacity:V?1:.45},children:se?"\u23F8":"\u25B6"}),(0,ne.jsx)("div",{style:{display:"flex",justifyContent:"flex-end"},children:(0,ne.jsxs)("div",{className:"me-video-preview-zoom-menu",ref:X,style:{position:"relative"},children:[(0,ne.jsxs)("button",{type:"button",onClick:()=>U(N=>!N),disabled:!V,title:l("tip.previewZoom"),"aria-label":l("tip.previewZoom"),style:{...nr,minWidth:112,height:38,padding:"0 10px 0 14px",borderRadius:12,background:"color-mix(in srgb, var(--me-fg, #ededf0) 8%, transparent)",color:V?Re.fg:Re.muted,opacity:V?1:.45,display:"inline-flex",alignItems:"center",justifyContent:"space-between",gap:8,fontSize:13,lineHeight:1},children:[(0,ne.jsx)("span",{children:it}),(0,ne.jsx)(bw,{open:te})]}),te&&(0,ne.jsxs)("div",{className:"me-video-preview-zoom-popover",style:{position:"absolute",right:0,bottom:50,zIndex:4e3,width:300,padding:14,borderRadius:12,border:`1px solid ${Re.border}`,background:"var(--me-surface)",boxShadow:"0 16px 42px rgba(0,0,0,0.18)",color:Re.fg},children:[(0,ne.jsx)("div",{style:{color:Re.muted,fontSize:12,marginBottom:10},children:l("lbl.zoomSize")}),(0,ne.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) 112px",gap:12,alignItems:"center"},children:[(0,ne.jsx)("input",{className:"me-video-preview-zoom-slider",type:"range",min:ef,max:tf,step:1,value:nt,onChange:N=>wt(Number(N.target.value)),"aria-label":l("tip.previewZoom"),style:{width:"100%",minWidth:0}}),(0,ne.jsxs)("span",{className:"me-video-preview-zoom-number",style:{height:34,borderRadius:9,background:Re.chip,display:"grid",gridTemplateColumns:"minmax(0, 1fr) auto 22px",alignItems:"center",overflow:"hidden",fontVariantNumeric:"tabular-nums",color:Re.fg},children:[(0,ne.jsx)("input",{className:"me-video-preview-zoom-input",type:"number",min:ef,max:tf,step:1,value:xe,onChange:N=>Ce(N.target.value.replace(/[^\d.]/g,"")),onBlur:Ot,onKeyDown:N=>{N.key==="Enter"&&N.currentTarget.blur(),N.key==="Escape"&&(Ce(String(nt)),N.currentTarget.blur())},"aria-label":l("tip.previewZoom"),style:{width:"100%",minWidth:0,height:"100%",padding:"0 0 0 10px",border:0,outline:0,background:"transparent",color:Re.fg,font:"inherit",fontSize:13,textAlign:"right",fontVariantNumeric:"tabular-nums"}}),(0,ne.jsx)("span",{style:{padding:"0 4px 0 1px",fontSize:13},children:"%"}),(0,ne.jsxs)("span",{className:"me-video-preview-zoom-stepper",style:{width:22,height:"100%",display:"grid",gridTemplateRows:"1fr 1fr",borderLeft:`1px solid ${Re.border}`},children:[(0,ne.jsx)("button",{type:"button",onClick:()=>on(1),"aria-label":l("tip.zoomIn"),style:{...nr,width:22,height:17,minHeight:0,padding:0,borderRadius:0,background:"transparent",color:Re.muted,display:"inline-flex",alignItems:"center",justifyContent:"center"},children:(0,ne.jsx)(vg,{dir:"up"})}),(0,ne.jsx)("button",{type:"button",onClick:()=>on(-1),"aria-label":l("tip.zoomOut"),style:{...nr,width:22,height:17,minHeight:0,padding:0,borderRadius:0,background:"transparent",color:Re.muted,display:"inline-flex",alignItems:"center",justifyContent:"center"},children:(0,ne.jsx)(vg,{dir:"down"})})]})]})]}),(0,ne.jsx)("div",{style:{height:1,background:Re.border,margin:"14px 0 8px"}}),(0,ne.jsxs)("button",{type:"button",className:"me-video-preview-zoom-shortcut",onClick:()=>{wt("fit"),U(!1)},style:{...nr,width:"100%",height:32,justifyContent:"space-between",background:"transparent",color:Re.fg,display:"flex",alignItems:"center",padding:"0 2px",fontSize:13},children:[(0,ne.jsx)("span",{children:l("act.zoomFit")}),(0,ne.jsx)("span",{style:{color:Re.muted},children:l("kbd.fit")})]}),pg.map((N,I)=>(0,ne.jsxs)("button",{type:"button",className:"me-video-preview-zoom-shortcut",onClick:()=>{wt(N),U(!1)},style:{...nr,width:"100%",height:32,justifyContent:"space-between",background:"transparent",color:Re.fg,display:"flex",alignItems:"center",padding:"0 2px",fontSize:13},children:[(0,ne.jsx)("span",{children:l("act.zoomTo",{value:N})}),(0,ne.jsx)("span",{style:{color:Re.muted},children:`\u21E7 ${I+1}`})]},N))]})]})})]})]}),V&&M==="crop"&&(0,ne.jsx)(H2,{videoEl:He,srcDims:Xe,canvasDims:Qe,state:g,patchLive:v,commit:w,ratioPreset:B,onRatioPreset:Yn,onConfirm:()=>A("trim"),maxW:L,maxH:q,zoomPercent:Oe,t:l}),V&&(M==="annotate"||M==="sticker")&&(0,ne.jsx)(Q2,{videoEl:He,srcDims:Xe,canvasDims:Qe,state:g,mode:M,patchLive:v,commit:w,maxW:L,maxH:q,zoomPercent:Oe,t:l}),V&&(M==="trim"||M==="filter")&&(0,ne.jsxs)("div",{className:"me-video-trim-panel",style:{width:"100%",marginTop:12},children:[(0,ne.jsxs)("div",{className:"me-video-trim-actions",style:{position:"relative",display:"flex",alignItems:"center",gap:8,marginBottom:8,padding:"6px 8px",borderRadius:8,background:Re.chip},children:[(0,ne.jsxs)("div",{className:"me-video-trim-action-btn",role:"button",tabIndex:0,onClick:()=>n.splitAtPlayhead(_),style:{...nr,padding:"0 14px",height:32,borderRadius:999,fontWeight:500,display:"flex",justifyContent:"center",alignItems:"center"},title:l("tip.split"),"aria-label":l("tip.split"),children:[(0,ne.jsx)("span",{className:"me-video-trim-action-icon","aria-hidden":"true",children:"\u2702"}),(0,ne.jsx)("span",{className:"me-video-trim-action-label",children:l("act.split")})]}),(0,ne.jsxs)("div",{className:"me-video-trim-action-btn",role:"button",tabIndex:Y[P]?0:-1,onClick:()=>{Y[P]&&n.duplicateClip(P)},"aria-disabled":Y[P]?"false":"true",style:{...nr,padding:"0 14px",height:32,borderRadius:999,fontWeight:500,display:"flex",justifyContent:"center",alignItems:"center",color:Y[P]?Re.fg:Re.muted,opacity:Y[P]?1:.5},title:l("tip.dupClip"),"aria-label":l("tip.dupClip"),children:[(0,ne.jsx)("span",{className:"me-video-trim-action-icon","aria-hidden":"true",children:"\u29C9"}),(0,ne.jsx)("span",{className:"me-video-trim-action-label",children:l("act.copy")})]}),(0,ne.jsxs)("div",{className:"me-video-trim-action-btn",role:"button",tabIndex:Y.length<=1?-1:0,onClick:()=>{Y.length>1&&n.removeClip(P)},"aria-disabled":Y.length<=1?"true":"false",style:{...nr,padding:"0 14px",height:32,borderRadius:999,fontWeight:500,display:"flex",justifyContent:"center",alignItems:"center",color:Y.length<=1?Re.muted:"#fca5a5",opacity:Y.length<=1?.5:1},title:l("tip.delClip"),"aria-label":l("tip.delClip"),children:[(0,ne.jsx)("span",{className:"me-video-trim-action-icon","aria-hidden":"true",children:"\u{1F5D1}"}),(0,ne.jsx)("span",{className:"me-video-trim-action-label",children:l("act.delete")})]}),(0,ne.jsx)("span",{style:{flex:1}}),(0,ne.jsxs)("div",{className:"me-video-timeline-zoom",style:{display:"flex",alignItems:"center",gap:4},children:[(0,ne.jsx)("button",{onClick:()=>Tn(1/1.4),style:{...nr,width:24,height:24,color:Re.muted},title:l("tip.zoomOut"),children:"\u2212"}),(0,ne.jsx)("button",{onClick:fn,style:{...nr,padding:"0 8px",height:24,fontSize:11,color:Re.muted},title:l("tip.fit"),children:l("act.fit")}),(0,ne.jsx)("button",{onClick:()=>Tn(1.4),style:{...nr,width:24,height:24,color:Re.muted},title:l("tip.zoomIn"),children:"\uFF0B"})]})]}),(0,ne.jsxs)("div",{className:"me-video-timeline-area",style:{display:"flex",alignItems:"flex-start",gap:4},children:[(0,ne.jsxs)("div",{style:{flexShrink:0,display:"flex",flexDirection:"column",width:34},children:[(0,ne.jsx)("div",{style:{height:22}}),(0,ne.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:64,marginTop:4},children:(0,ne.jsx)("button",{onClick:()=>n.setKeepAudio(!g.keepAudio),style:{...nr,width:32,height:32,borderRadius:999,background:Re.chip,opacity:g.keepAudio?1:.55},title:l("tip.keepAudio"),children:g.keepAudio?"\u{1F50A}":"\u{1F507}"})})]}),(0,ne.jsx)("div",{ref:oe,className:"me-video-timeline-scroll",style:{flex:1,minWidth:0,overflowX:"auto",overscrollBehaviorX:"contain"},children:(0,ne.jsxs)("div",{ref:ge,style:{position:"relative",width:z*je,minWidth:"100%"},children:[(0,ne.jsxs)("div",{style:{position:"relative",height:22,cursor:"pointer",touchAction:"none"},onPointerDown:Hn({kind:"playhead"}),children:[cr.map(N=>(0,ne.jsxs)("span",{children:[(0,ne.jsx)("span",{style:{position:"absolute",bottom:2,width:1,height:6,left:N.x,background:Re.border}}),(0,ne.jsx)("span",{style:{position:"absolute",bottom:0,fontSize:11,fontVariantNumeric:"tabular-nums",left:N.x+3,color:Re.muted},children:N.label})]},N.x)),E>0&&(0,ne.jsx)("span",{style:{position:"absolute",bottom:0,padding:"2px 6px",borderRadius:4,fontSize:11,fontVariantNumeric:"tabular-nums",fontWeight:500,whiteSpace:"nowrap",left:Math.min(Math.max(_*je,14),Math.max(14,E*je-14)),transform:"translateX(-50%)",background:Re.chip,border:`1px solid ${Re.border}`,color:Re.fg},children:sc(_)})]}),(0,ne.jsx)("div",{ref:Be,style:{position:"relative",marginTop:4,borderRadius:8,overflow:"hidden",height:64,background:Re.chip,cursor:"pointer"},onPointerDown:N=>{N.target===N.currentTarget&&Hn({kind:"playhead"})(N)},children:Y.map((N,I)=>(0,ne.jsxs)("div",{"data-clipblock":I,style:{position:"absolute",top:0,bottom:0,userSelect:"none",left:Ju(Y,I)*je,width:vs(N)*je,cursor:Rt===I?"grabbing":"grab",opacity:Rt!==null&&Rt!==I?.72:P===I?1:.82,transform:P===I?"translateY(-1px)":"none",zIndex:1,touchAction:"none"},onPointerDown:ur(I),children:[(0,ne.jsx)("div",{style:{position:"absolute",inset:0,overflow:"hidden",borderRadius:6},children:Mr(N).map(we=>(0,ne.jsx)("img",{src:we.src,alt:"",style:{position:"absolute",top:0,height:"100%",objectFit:"cover",left:we.left,width:we.width},draggable:!1},we.key))}),(0,ne.jsx)("div",{style:{position:"absolute",inset:0,pointerEvents:"none",border:`${P===I?3:2}px solid ${P===I?"#fff":"rgba(255,255,255,0.18)"}`,borderRadius:6,boxShadow:P===I?"0 0 0 1px rgba(255,255,255,0.26),0 10px 22px rgba(0,0,0,0.28)":kn===I&&Rt!==null&&kn!==Rt?"inset 4px 0 0 #fff":"none"}}),(0,ne.jsx)("span",{style:{position:"absolute",top:2,left:8,padding:"0 4px",height:16,borderRadius:999,fontSize:11,lineHeight:"16px",textAlign:"center",fontWeight:600,pointerEvents:"none",background:Re.accent,color:Re.accentFg},children:I+1}),(0,ne.jsx)("div",{style:{position:"absolute",top:0,bottom:0,left:0,width:10,cursor:"ew-resize",background:Re.accent,borderRadius:"6px 0 0 6px"},onPointerDown:Hn({kind:"clipIn",idx:I,orig:Y,origStart:Ju(Y,I)}),children:(0,ne.jsx)("div",{style:{position:"absolute",left:"50%",top:"50%",width:2,height:16,borderRadius:2,transform:"translate(-50%,-50%)",background:"rgba(255,255,255,0.85)"}})}),(0,ne.jsx)("div",{style:{position:"absolute",top:0,bottom:0,right:0,width:10,cursor:"ew-resize",background:Re.accent,borderRadius:"0 6px 6px 0"},onPointerDown:Hn({kind:"clipOut",idx:I,orig:Y,origStart:Ju(Y,I)}),children:(0,ne.jsx)("div",{style:{position:"absolute",left:"50%",top:"50%",width:2,height:16,borderRadius:2,transform:"translate(-50%,-50%)",background:"rgba(255,255,255,0.85)"}})})]},`clip-${I}`))}),(0,ne.jsxs)("div",{style:{position:"relative",marginTop:4,borderRadius:8,height:28,background:Re.chip,cursor:"pointer"},onPointerDown:N=>{N.target===N.currentTarget&&Hn({kind:"playhead"})(N)},children:[Et.length===0&&(0,ne.jsx)("span",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",paddingLeft:12,fontSize:11,color:Re.muted,pointerEvents:"none"},children:l("lbl.audioTrackHint")}),Et.map((N,I)=>{let we=Ge===I;return(0,ne.jsxs)("div",{style:{position:"absolute",top:2,bottom:2,borderRadius:4,userSelect:"none",left:N.startAt*je,width:Math.max(8,(N.out-N.in)*je),background:we?"rgba(52,211,153,0.5)":"rgba(52,211,153,0.3)",border:`1.5px solid ${Re.green}`,cursor:"grab",touchAction:"none"},onPointerDown:tt=>{mt(I),Hn({kind:"audioMove",idx:I,origStartAt:N.startAt,downT:Lt(tt.clientX)})(tt)},children:[(0,ne.jsxs)("span",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",paddingLeft:8,fontSize:11,overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",pointerEvents:"none",color:"#d1fae5"},children:["\u266A ",H[N.srcIdx]?.file.name??l("lbl.music")]}),(0,ne.jsx)("div",{style:{position:"absolute",top:0,bottom:0,left:0,width:6,cursor:"ew-resize",background:Re.green,borderRadius:"3px 0 0 3px"},onPointerDown:tt=>{mt(I),Hn({kind:"audioIn",idx:I,origIn:N.in,downT:Lt(tt.clientX)})(tt)}}),(0,ne.jsx)("div",{style:{position:"absolute",top:0,bottom:0,right:0,width:6,cursor:"ew-resize",background:Re.green,borderRadius:"0 3px 3px 0"},onPointerDown:tt=>{mt(I),Hn({kind:"audioOut",idx:I,origOut:N.out,downT:Lt(tt.clientX)})(tt)}})]},`au-${I}`)})]}),E>0&&(0,ne.jsx)("div",{style:{position:"absolute",top:0,bottom:0,pointerEvents:"none",left:_*je-1,width:2,background:"#fff",boxShadow:"0 0 4px rgba(0,0,0,0.8)",zIndex:30}})]})}),(0,ne.jsxs)("div",{style:{flexShrink:0,display:"flex",flexDirection:"column",width:44},children:[(0,ne.jsx)("div",{style:{height:22}}),(0,ne.jsxs)("label",{style:{display:"flex",alignItems:"center",justifyContent:"center",borderRadius:8,cursor:"pointer",fontSize:18,height:64,marginTop:4,border:`1.5px dashed ${Re.border}`,color:Re.muted},title:l("tip.addVideo"),children:["\uFF0B",(0,ne.jsx)("input",{type:"file",accept:"video/*",style:{display:"none"},onChange:N=>{let I=N.target.files?.[0];I&&at(I),N.target.value=""}})]}),(0,ne.jsxs)("label",{style:{display:"flex",alignItems:"center",justifyContent:"center",borderRadius:8,cursor:"pointer",fontSize:13,height:28,marginTop:4,border:`1.5px dashed ${Re.border}`,color:Re.muted},title:l("tip.addAudio"),children:["\u266A\uFF0B",(0,ne.jsx)("input",{type:"file",accept:"audio/*,video/*",style:{display:"none"},onChange:N=>{let I=N.target.files?.[0];I&&Ke(I),N.target.value=""}})]})]})]}),Ge!=null&&Et[Ge]&&(0,ne.jsxs)("div",{style:{marginTop:8,display:"flex",alignItems:"center",gap:12,padding:"8px 12px",borderRadius:8,fontSize:13,background:Re.chip,color:Re.muted},children:[(0,ne.jsxs)("span",{style:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",maxWidth:160},children:["\u266A ",H[Et[Ge].srcIdx]?.file.name??l("lbl.music")]}),(0,ne.jsx)("span",{style:{flexShrink:0},children:l("lbl.volume")}),(0,ne.jsx)("input",{type:"range",min:0,max:2,step:.1,value:Et[Ge].volume,onChange:N=>{let I=Number(N.target.value);v({audioClips:Et.map((we,tt)=>tt===Ge?{...we,volume:I}:we)})},onPointerUp:()=>w(),style:{width:144}}),(0,ne.jsxs)("span",{style:{fontVariantNumeric:"tabular-nums",width:40},children:[Math.round(Et[Ge].volume*100),"%"]}),(0,ne.jsx)("div",{style:{flex:1}}),(0,ne.jsx)("button",{onClick:()=>{w({audioClips:Et.filter((N,I)=>I!==Ge)}),mt(null)},style:{padding:"4px 8px",borderRadius:6,border:"none",cursor:"pointer",background:"rgba(239,68,68,0.15)",color:"#fca5a5"},children:l("act.deleteMusic")})]})]}),!1,V&&M==="resize"&&(0,ne.jsxs)("div",{style:{marginTop:16,display:"flex",flexDirection:"column",alignItems:"center",gap:12,width:"100%"},children:[(0,ne.jsx)("p",{style:{fontSize:11,marginBottom:-4,color:Re.muted},children:l("lbl.sizeSection")}),(0,ne.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,color:Re.muted},children:[(0,ne.jsx)("input",{type:"number",min:2,value:g.scale?.width??Pe.w,onChange:N=>{let I=Kn(Number(N.target.value)||2),we=Pe.w/Pe.h;w({scale:{width:I,height:Ye?Kn(I/we):g.scale?.height??Pe.h,fit:"cover"}})},style:{width:96,padding:"6px 8px",borderRadius:6,textAlign:"center",fontVariantNumeric:"tabular-nums",background:Re.chip,color:Re.fg,border:"none"}}),(0,ne.jsx)("span",{style:{fontSize:11},children:"W"}),(0,ne.jsx)("button",{onClick:()=>et(!Ye),style:{...nr,padding:"6px 8px",background:Re.chip},title:l("tip.lockAspect"),children:Ye?"\u{1F512}":"\u{1F513}"}),(0,ne.jsx)("span",{style:{fontSize:11},children:"H"}),(0,ne.jsx)("input",{type:"number",min:2,value:g.scale?.height??Pe.h,onChange:N=>{let I=Kn(Number(N.target.value)||2),we=Pe.w/Pe.h;w({scale:{width:Ye?Kn(I*we):g.scale?.width??Pe.w,height:I,fit:"cover"}})},style:{width:96,padding:"6px 8px",borderRadius:6,textAlign:"center",fontVariantNumeric:"tabular-nums",background:Re.chip,color:Re.fg,border:"none"}}),g.scale&&(0,ne.jsx)("button",{onClick:()=>{w({scale:void 0})},style:{...nr,padding:"6px 8px",fontSize:13,background:Re.chip},children:l("act.restore")})]}),(0,ne.jsxs)("p",{style:{fontSize:11,color:Re.muted},children:[l("lbl.currentOut"),":",g.scale?`${g.scale.width}\xD7${g.scale.height}`:`${Pe.w}\xD7${Pe.h}${l("lbl.noScale")}`," ",l("lbl.coverNote")]})]}),Yt&&(0,ne.jsx)("div",{style:{marginTop:12,padding:"8px 12px",borderRadius:6,fontSize:13,width:"100%",background:"rgba(239,68,68,0.12)",color:"#fca5a5"},children:Yt}),lt&&!gt&&(0,ne.jsx)("div",{style:{marginTop:12,fontSize:13,color:Re.accent},children:lt})]})]}),gt&&(0,ne.jsx)("div",{className:"me-video-export-loading",role:"status","aria-live":"polite","aria-busy":"true",style:{position:"absolute",inset:0,zIndex:120,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(3,3,3,0.58)",backdropFilter:"blur(3px)",pointerEvents:"auto"},children:(0,ne.jsxs)("div",{style:{minWidth:240,maxWidth:360,padding:"20px 24px",borderRadius:12,border:`1px solid ${Re.border}`,background:"rgba(20,20,22,0.94)",boxShadow:"0 18px 60px rgba(0,0,0,0.42)",color:Re.fg,display:"flex",flexDirection:"column",alignItems:"center",gap:10,textAlign:"center"},children:[(0,ne.jsx)("span",{className:"me-video-export-spinner","aria-hidden":"true"}),(0,ne.jsx)("strong",{style:{fontSize:15,fontWeight:600},children:lt}),(0,ne.jsx)("span",{style:{fontSize:12,lineHeight:1.5,color:Re.muted},children:l("msg.exportingHint")})]})}),(0,ne.jsx)(nw,{open:_t,onClose:()=>xt(!1),videoSrcs:j.map(N=>({url:N.url,dims:N.dims,duration:N.duration})),clips:Y,canvasDims:Qe,state:g,duration:E,sampleThumb:ar,fileName:j[0]?.file.name??"video",t:l})]})}var ww={"--me-fg":"#ededf0","--me-fg-muted":"#9a9aa3","--me-bg":"#08080a","--me-surface":"#141416","--me-chip":"#1c1c20","--me-border":"#26262b","--me-border-strong":"#34343a","--me-accent":"#7c7cf0","--me-accent-hover":"#8f8ff5","--me-accent-fg":"#ffffff"},Ew={"--me-fg":"#0a0a0a","--me-fg-muted":"#6b6b76","--me-bg":"#ffffff","--me-surface":"#fafafa","--me-chip":"#f1f1f3","--me-border":"#e6e6e8","--me-border-strong":"#d4d4d8","--me-accent":"#5b5bd6","--me-accent-hover":"#4f4fc9","--me-accent-fg":"#ffffff"};function kw(n="auto"){return n!=="auto"?n:typeof window<"u"&&window.matchMedia?.("(prefers-color-scheme: light)").matches?"light":"dark"}function Cw(n,a={}){n.style.position||(n.style.position="relative");let o=document.createElement("div");o.style.cssText="width:100%;height:100%;min-height:0;flex:1 1 0",n.appendChild(o);let l=(0,z2.createRoot)(o),s=a.engine??new Om,d=a.client??Rx({baseUrl:a.baseUrl}),m=a,h=w=>{m={...m,...w};let W=m;W.client&&(d=W.client);let S={...kw(W.theme)==="light"?Ew:ww,width:"100%",height:"100%",minHeight:0,background:"var(--me-bg)",color:"var(--me-fg)"};l.render((0,og.createElement)("div",{style:S},(0,og.createElement)(xw,{engine:s,client:d,source:W.source,t:j2(W.locale??"zh"),onExported:W.onExported,onError:W.onError,maxVideos:W.maxVideos,maxAudios:W.maxAudios})))};h(a);let g=null,v=null;return{update(w){h(w)},destroy(){l.unmount(),v?.(),g?.dispose(),o.remove()}}}var dc='-apple-system, "PingFang SC", "Microsoft YaHei", sans-serif',gg=["Arial","Segoe UI","Microsoft YaHei","Microsoft JhengHei","PingFang SC","Helvetica","Verdana","Tahoma","Trebuchet MS","Georgia","Times New Roman","Courier New","NSimSun","SimSun","SimHei","KaiTi","FangSong","Noto Sans SC"],Sw={"Microsoft YaHei":"\u5FAE\u8F6F\u96C5\u9ED1","Microsoft JhengHei":"\u5FAE\u8F6F\u6B63\u9ED1\u4F53","PingFang SC":"\u82F9\u65B9",SimSun:"\u5B8B\u4F53",NSimSun:"\u65B0\u5B8B\u4F53",SimHei:"\u9ED1\u4F53",KaiTi:"\u6977\u4F53",FangSong:"\u4EFF\u5B8B","Noto Sans SC":"\u601D\u6E90\u9ED1\u4F53","Songti SC":"\u5B8B\u4F53-\u7B80","Heiti SC":"\u9ED1\u4F53-\u7B80","Kaiti SC":"\u6977\u4F53-\u7B80",STSong:"\u534E\u6587\u5B8B\u4F53",STHeiti:"\u534E\u6587\u9ED1\u4F53",STKaiti:"\u534E\u6587\u6977\u4F53",STFangsong:"\u534E\u6587\u4EFF\u5B8B",STZhongsong:"\u534E\u6587\u4E2D\u5B8B",YouYuan:"\u5E7C\u5706",LiSu:"\u96B6\u4E66"},Fw=["microsoft yahei","microsoft jhenghei","pingfang","simsun","nsimsun","simhei","kaiti","fangsong","noto sans sc","songti","heiti","stsong","stheiti","stkaiti","stfangsong","stzhongsong","youyuan","lisu"],bg={heading:{text:"Heading and some body",fontSize:120,width:600,fontWeight:"700",textAlign:"center",color:"#ffffff",backgroundColor:"transparent",borderColor:"#000000",borderWidth:0,boxShadow:{color:"rgba(0,0,0,0.35)",x:0,y:4,blur:18}},subtitle:{text:"Subtitle line",fontSize:72,width:560,fontWeight:"600",textAlign:"center",color:"#ffffff",backgroundColor:"transparent",borderColor:"#000000",borderWidth:0,boxShadow:{color:"rgba(0,0,0,0.28)",x:0,y:2,blur:12}},label:{text:"Label",fontSize:44,width:300,fontWeight:"700",textAlign:"center",color:"#ffffff",backgroundColor:"rgba(8,8,10,0.72)",borderColor:"#000000",borderWidth:0,boxShadow:{color:"rgba(0,0,0,0.18)",x:0,y:2,blur:8},paddingX:24,paddingY:16}},nf=[{key:"none",label:"Cut",short:"Cut",duration:0},{key:"fade",label:"Fade",short:"Fade",duration:.45},{key:"slide",label:"Slide",short:"Slide",duration:.45},{key:"wipe",label:"Wipe",short:"Wipe",duration:.45},{key:"flip",label:"Flip",short:"Flip",duration:.35},{key:"clockWipe",label:"Clock",short:"Clock",duration:.5},{key:"star",label:"Star",short:"Star",duration:.35},{key:"circle",label:"Circle",short:"Circle",duration:.45},{key:"rectangle",label:"Rectangle",short:"Rect",duration:.45}],yg=!1,xg=!1,fr="me-video-timeline-selectionchange",wg="Aa Sample 123",rf=null;function wa(){if(yg||typeof document>"u")return;const n=document.createElement("style");n.id="me-video-text-enhancer-style",n.textContent=`
|
|
10
|
+
`+i.stack}}var xt=Object.prototype.hasOwnProperty,Zt=a.unstable_scheduleCallback,tn=a.unstable_cancelCallback,_n=a.unstable_shouldYield,st=a.unstable_requestPaint,Ge=a.unstable_now,mt=a.unstable_getCurrentPriorityLevel,Rt=a.unstable_ImmediatePriority,Vt=a.unstable_UserBlockingPriority,kn=a.unstable_NormalPriority,xn=a.unstable_LowPriority,Pe=a.unstable_IdlePriority,dt=a.log,yt=a.unstable_setDisableYieldValue,pt=null,Mt=null;function dn(e){if(typeof dt=="function"&&yt(e),Mt&&typeof Mt.setStrictMode=="function")try{Mt.setStrictMode(pt,e)}catch{}}var Ut=Math.clz32?Math.clz32:Le,An=Math.log,K=Math.LN2;function Le(e){return e>>>=0,e===0?32:31-(An(e)/K|0)|0}var Xe=256,Tt=262144,rn=4194304;function Ot(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function nn(e,t,r){var i=e.pendingLanes;if(i===0)return 0;var u=0,c=e.suspendedLanes,f=e.pingedLanes;e=e.warmLanes;var y=i&134217727;return y!==0?(i=y&~c,i!==0?u=Ot(i):(f&=y,f!==0?u=Ot(f):r||(r=y&~e,r!==0&&(u=Ot(r))))):(y=i&~c,y!==0?u=Ot(y):f!==0?u=Ot(f):r||(r=i&~e,r!==0&&(u=Ot(r)))),u===0?0:t!==0&&t!==u&&(t&c)===0&&(c=u&-u,r=t&-t,c>=r||c===32&&(r&4194048)!==0)?t:u}function wn(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Z(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function fe(){var e=rn;return rn<<=1,(rn&62914560)===0&&(rn=4194304),e}function Ne(e){for(var t=[],r=0;31>r;r++)t.push(e);return t}function Je(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Et(e,t,r,i,u,c){var f=e.pendingLanes;e.pendingLanes=r,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=r,e.entangledLanes&=r,e.errorRecoveryDisabledLanes&=r,e.shellSuspendCounter=0;var y=e.entanglements,R=e.expirationTimes,he=e.hiddenUpdates;for(r=f&~r;0<r;){var ze=31-Ut(r),Ie=1<<ze;y[ze]=0,R[ze]=-1;var ye=he[ze];if(ye!==null)for(he[ze]=null,ze=0;ze<ye.length;ze++){var Se=ye[ze];Se!==null&&(Se.lane&=-536870913)}r&=~Ie}i!==0&&D(e,i,0),c!==0&&u===0&&e.tag!==0&&(e.suspendedLanes|=c&~(f&~t))}function D(e,t,r){e.pendingLanes|=t,e.suspendedLanes&=~t;var i=31-Ut(t);e.entangledLanes|=t,e.entanglements[i]=e.entanglements[i]|1073741824|r&261930}function V(e,t){var r=e.entangledLanes|=t;for(e=e.entanglements;r;){var i=31-Ut(r),u=1<<i;u&t|e[i]&t&&(e[i]|=t),r&=~u}}function Fe(e,t){var r=t&-t;return r=(r&42)!==0?1:He(r),(r&(e.suspendedLanes|t))!==0?0:r}function He(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Ye(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function ct(){var e=A.p;return e!==0?e:(e=window.event,e===void 0?32:r0(e.type))}function kt(e,t){var r=A.p;try{return A.p=e,t()}finally{A.p=r}}var rt=Math.random().toString(36).slice(2),at="__reactFiber$"+rt,Ke="__reactProps$"+rt,Nt="__reactContainer$"+rt,Wt="__reactEvents$"+rt,Ct="__reactListeners$"+rt,bt="__reactHandles$"+rt,$t="__reactResources$"+rt,un="__reactMarker$"+rt;function pn(e){delete e[at],delete e[Ke],delete e[Wt],delete e[Ct],delete e[bt]}function Lt(e){var t=e[at];if(t)return t;for(var r=e.parentNode;r;){if(t=r[Nt]||r[at]){if(r=t.alternate,t.child!==null||r!==null&&r.child!==null)for(e=Iv(e);e!==null;){if(r=e[at])return r;e=Iv(e)}return t}e=r,r=e.parentNode}return null}function Xt(e){if(e=e[at]||e[Nt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function en(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(s(33))}function Tn(e){var t=e[$t];return t||(t=e[$t]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function fn(e){e[un]=!0}var zn=new Set,Dr={};function Hn(e,t){ur(e,t),ur(e+"Capture",t)}function ur(e,t){for(Dr[e]=t,e=0;e<t.length;e++)zn.add(t[e])}var Zn=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Fr={},z={};function ie(e){return xt.call(z,e)?!0:xt.call(Fr,e)?!1:Zn.test(e)?z[e]=!0:(Fr[e]=!0,!1)}function Oe(e,t,r){if(ie(t))if(r===null)e.removeAttribute(t);else{switch(typeof r){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var i=t.toLowerCase().slice(0,5);if(i!=="data-"&&i!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+r)}}function E(e,t,r){if(r===null)e.removeAttribute(t);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+r)}}function F(e,t,r,i){if(i===null)e.removeAttribute(r);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(r);return}e.setAttributeNS(t,r,""+i)}}function p(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function b(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function L(e,t,r){var i=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var u=i.get,c=i.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return u.call(this)},set:function(f){r=""+f,c.call(this,f)}}),Object.defineProperty(e,t,{enumerable:i.enumerable}),{getValue:function(){return r},setValue:function(f){r=""+f},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function q(e){if(!e._valueTracker){var t=b(e)?"checked":"value";e._valueTracker=L(e,t,""+e[t])}}function Ee(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),i="";return e&&(i=b(e)?e.checked?"true":"false":e.value),e=i,e!==r?(t.setValue(e),!0):!1}function be(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var je=/[\n"\\]/g;function ae(e){return e.replace(je,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function ke(e,t,r,i,u,c,f,y){e.name="",f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"?e.type=f:e.removeAttribute("type"),t!=null?f==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+p(t)):e.value!==""+p(t)&&(e.value=""+p(t)):f!=="submit"&&f!=="reset"||e.removeAttribute("value"),t!=null?We(e,f,p(t)):r!=null?We(e,f,p(r)):i!=null&&e.removeAttribute("value"),u==null&&c!=null&&(e.defaultChecked=!!c),u!=null&&(e.checked=u&&typeof u!="function"&&typeof u!="symbol"),y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"?e.name=""+p(y):e.removeAttribute("name")}function Ve(e,t,r,i,u,c,f,y){if(c!=null&&typeof c!="function"&&typeof c!="symbol"&&typeof c!="boolean"&&(e.type=c),t!=null||r!=null){if(!(c!=="submit"&&c!=="reset"||t!=null)){q(e);return}r=r!=null?""+p(r):"",t=t!=null?""+p(t):r,y||t===e.value||(e.value=t),e.defaultValue=t}i=i??u,i=typeof i!="function"&&typeof i!="symbol"&&!!i,e.checked=y?e.checked:!!i,e.defaultChecked=!!i,f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"&&(e.name=f),q(e)}function We(e,t,r){t==="number"&&be(e.ownerDocument)===e||e.defaultValue===""+r||(e.defaultValue=""+r)}function ft(e,t,r,i){if(e=e.options,t){t={};for(var u=0;u<r.length;u++)t["$"+r[u]]=!0;for(r=0;r<e.length;r++)u=t.hasOwnProperty("$"+e[r].value),e[r].selected!==u&&(e[r].selected=u),u&&i&&(e[r].defaultSelected=!0)}else{for(r=""+p(r),t=null,u=0;u<e.length;u++){if(e[u].value===r){e[u].selected=!0,i&&(e[u].defaultSelected=!0);return}t!==null||e[u].disabled||(t=e[u])}t!==null&&(t.selected=!0)}}function nt(e,t,r){if(t!=null&&(t=""+p(t),t!==e.value&&(e.value=t),r==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=r!=null?""+p(r):""}function it(e,t,r,i){if(t==null){if(i!=null){if(r!=null)throw Error(s(92));if($(i)){if(1<i.length)throw Error(s(93));i=i[0]}r=i}r==null&&(r=""),t=r}r=p(t),e.defaultValue=r,i=e.textContent,i===r&&i!==""&&i!==null&&(e.value=i),q(e)}function ht(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var wt=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Bt(e,t,r){var i=t.indexOf("--")===0;r==null||typeof r=="boolean"||r===""?i?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":i?e.setProperty(t,r):typeof r!="number"||r===0||wt.has(t)?t==="float"?e.cssFloat=r:e[t]=(""+r).trim():e[t]=r+"px"}function jt(e,t,r){if(t!=null&&typeof t!="object")throw Error(s(62));if(e=e.style,r!=null){for(var i in r)!r.hasOwnProperty(i)||t!=null&&t.hasOwnProperty(i)||(i.indexOf("--")===0?e.setProperty(i,""):i==="float"?e.cssFloat="":e[i]="");for(var u in t)i=t[u],t.hasOwnProperty(u)&&r[u]!==i&&Bt(e,u,i)}else for(var c in t)t.hasOwnProperty(c)&&Bt(e,c,t[c])}function on(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Rn=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),cr=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Mr(e){return cr.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function ar(){}var N=null;function I(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var we=null,tt=null;function Qe(e){var t=Xt(e);if(t&&(e=t.stateNode)){var r=e[Ke]||null;e:switch(e=t.stateNode,t.type){case"input":if(ke(e,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name),t=r.name,r.type==="radio"&&t!=null){for(r=e;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll('input[name="'+ae(""+t)+'"][type="radio"]'),t=0;t<r.length;t++){var i=r[t];if(i!==e&&i.form===e.form){var u=i[Ke]||null;if(!u)throw Error(s(90));ke(i,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name)}}for(t=0;t<r.length;t++)i=r[t],i.form===e.form&&Ee(i)}break e;case"textarea":nt(e,r.value,r.defaultValue);break e;case"select":t=r.value,t!=null&&ft(e,!!r.multiple,t,!1)}}}var qt=!1;function It(e,t,r){if(qt)return e(t,r);qt=!0;try{var i=e(t);return i}finally{if(qt=!1,(we!==null||tt!==null)&&(wu(),we&&(t=we,e=tt,tt=we=null,Qe(t),e)))for(t=0;t<e.length;t++)Qe(e[t])}}function Kt(e,t){var r=e.stateNode;if(r===null)return null;var i=r[Ke]||null;if(i===null)return null;r=i[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(i=!i.disabled)||(e=e.type,i=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!i;break e;default:e=!1}if(e)return null;if(r&&typeof r!="function")throw Error(s(231,t,typeof r));return r}var an=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Qn=!1;if(an)try{dr={},Object.defineProperty(dr,"passive",{get:function(){Qn=!0}}),window.addEventListener("test",dr,dr),window.removeEventListener("test",dr,dr)}catch{Qn=!1}var dr,pr=null,na=null,Pa=null;function fa(){if(Pa)return Pa;var e,t=na,r=t.length,i,u="value"in pr?pr.value:pr.textContent,c=u.length;for(e=0;e<r&&t[e]===u[e];e++);var f=r-e;for(i=1;i<=f&&t[r-i]===u[c-i];i++);return Pa=u.slice(e,1<i?1-i:void 0)}function Vr(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function hr(){return!0}function pa(){return!1}function yr(e){function t(r,i,u,c,f){this._reactName=r,this._targetInst=u,this.type=i,this.nativeEvent=c,this.target=f,this.currentTarget=null;for(var y in e)e.hasOwnProperty(y)&&(r=e[y],this[y]=r?r(c):c[y]);return this.isDefaultPrevented=(c.defaultPrevented!=null?c.defaultPrevented:c.returnValue===!1)?hr:pa,this.isPropagationStopped=pa,this}return S(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=hr)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=hr)},persist:function(){},isPersistent:hr}),t}var ja={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},fo=yr(ja),oi=S({},ja,{view:0,detail:0}),zs=yr(oi),$i,po,Oa,$a=S({},oi,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:zc,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Oa&&(Oa&&e.type==="mousemove"?($i=e.screenX-Oa.screenX,po=e.screenY-Oa.screenY):po=$i=0,Oa=e),$i)},movementY:function(e){return"movementY"in e?e.movementY:po}}),ho=yr($a),Ps=S({},$a,{dataTransfer:0}),js=yr(Ps),Os=S({},oi,{relatedTarget:0}),pl=yr(Os),Bc=S({},ja,{animationName:0,elapsedTime:0,pseudoElement:0}),Dc=yr(Bc),hb=S({},ja,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),vb=yr(hb),gb=S({},ja,{data:0}),Pf=yr(gb),bb={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},yb={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},xb={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function wb(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=xb[e])?!!t[e]:!1}function zc(){return wb}var Eb=S({},oi,{key:function(e){if(e.key){var t=bb[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Vr(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?yb[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:zc,charCode:function(e){return e.type==="keypress"?Vr(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Vr(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),kb=yr(Eb),Cb=S({},$a,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),jf=yr(Cb),Sb=S({},oi,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:zc}),Fb=yr(Sb),Mb=S({},ja,{propertyName:0,elapsedTime:0,pseudoElement:0}),Lb=yr(Mb),Ab=S({},$a,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Nb=yr(Ab),_b=S({},ja,{newState:0,oldState:0}),Tb=yr(_b),Bb=[9,13,27,32],Pc=an&&"CompositionEvent"in window,hl=null;an&&"documentMode"in document&&(hl=document.documentMode);var Db=an&&"TextEvent"in window&&!hl,Of=an&&(!Pc||hl&&8<hl&&11>=hl),$f=" ",Rf=!1;function If(e,t){switch(e){case"keyup":return Bb.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Hf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var vo=!1;function zb(e,t){switch(e){case"compositionend":return Hf(t);case"keypress":return t.which!==32?null:(Rf=!0,$f);case"textInput":return e=t.data,e===$f&&Rf?null:e;default:return null}}function Pb(e,t){if(vo)return e==="compositionend"||!Pc&&If(e,t)?(e=fa(),Pa=na=pr=null,vo=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Of&&t.locale!=="ko"?null:t.data;default:return null}}var jb={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Vf(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!jb[e.type]:t==="textarea"}function Wf(e,t,r,i){we?tt?tt.push(i):tt=[i]:we=i,t=Nu(t,"onChange"),0<t.length&&(r=new fo("onChange","change",null,r,i),e.push({event:r,listeners:t}))}var vl=null,gl=null;function Ob(e){Mv(e,0)}function $s(e){var t=en(e);if(Ee(t))return e}function qf(e,t){if(e==="change")return t}var Zf=!1;an&&(an?(Rs="oninput"in document,Rs||(Oc=document.createElement("div"),Oc.setAttribute("oninput","return;"),Rs=typeof Oc.oninput=="function"),jc=Rs):jc=!1,Zf=jc&&(!document.documentMode||9<document.documentMode));var jc,Rs,Oc;function Uf(){vl&&(vl.detachEvent("onpropertychange",Xf),gl=vl=null)}function Xf(e){if(e.propertyName==="value"&&$s(gl)){var t=[];Wf(t,gl,e,I(e)),It(Ob,t)}}function $b(e,t,r){e==="focusin"?(Uf(),vl=t,gl=r,vl.attachEvent("onpropertychange",Xf)):e==="focusout"&&Uf()}function Rb(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return $s(gl)}function Ib(e,t){if(e==="click")return $s(t)}function Hb(e,t){if(e==="input"||e==="change")return $s(t)}function Vb(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Wr=typeof Object.is=="function"?Object.is:Vb;function bl(e,t){if(Wr(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;for(i=0;i<r.length;i++){var u=r[i];if(!xt.call(t,u)||!Wr(e[u],t[u]))return!1}return!0}function Kf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Gf(e,t){var r=Kf(e);e=0;for(var i;r;){if(r.nodeType===3){if(i=e+r.textContent.length,e<=t&&i>=t)return{node:r,offset:t-e};e=i}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=Kf(r)}}function Yf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Yf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Jf(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=be(e.document);t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=be(e.document)}return t}function $c(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var Wb=an&&"documentMode"in document&&11>=document.documentMode,go=null,Rc=null,yl=null,Ic=!1;function Qf(e,t,r){var i=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;Ic||go==null||go!==be(i)||(i=go,"selectionStart"in i&&$c(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),yl&&bl(yl,i)||(yl=i,i=Nu(Rc,"onSelect"),0<i.length&&(t=new fo("onSelect","select",null,t,r),e.push({event:t,listeners:i}),t.target=go)))}function Ri(e,t){var r={};return r[e.toLowerCase()]=t.toLowerCase(),r["Webkit"+e]="webkit"+t,r["Moz"+e]="moz"+t,r}var bo={animationend:Ri("Animation","AnimationEnd"),animationiteration:Ri("Animation","AnimationIteration"),animationstart:Ri("Animation","AnimationStart"),transitionrun:Ri("Transition","TransitionRun"),transitionstart:Ri("Transition","TransitionStart"),transitioncancel:Ri("Transition","TransitionCancel"),transitionend:Ri("Transition","TransitionEnd")},Hc={},ep={};an&&(ep=document.createElement("div").style,"AnimationEvent"in window||(delete bo.animationend.animation,delete bo.animationiteration.animation,delete bo.animationstart.animation),"TransitionEvent"in window||delete bo.transitionend.transition);function Ii(e){if(Hc[e])return Hc[e];if(!bo[e])return e;var t=bo[e],r;for(r in t)if(t.hasOwnProperty(r)&&r in ep)return Hc[e]=t[r];return e}var tp=Ii("animationend"),np=Ii("animationiteration"),rp=Ii("animationstart"),qb=Ii("transitionrun"),Zb=Ii("transitionstart"),Ub=Ii("transitioncancel"),ap=Ii("transitionend"),ip=new Map,Vc="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Vc.push("scrollEnd");function ha(e,t){ip.set(e,t),Hn(t,[e])}var Is=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},ra=[],yo=0,Wc=0;function Hs(){for(var e=yo,t=Wc=yo=0;t<e;){var r=ra[t];ra[t++]=null;var i=ra[t];ra[t++]=null;var u=ra[t];ra[t++]=null;var c=ra[t];if(ra[t++]=null,i!==null&&u!==null){var f=i.pending;f===null?u.next=u:(u.next=f.next,f.next=u),i.pending=u}c!==0&&op(r,u,c)}}function Vs(e,t,r,i){ra[yo++]=e,ra[yo++]=t,ra[yo++]=r,ra[yo++]=i,Wc|=i,e.lanes|=i,e=e.alternate,e!==null&&(e.lanes|=i)}function qc(e,t,r,i){return Vs(e,t,r,i),Ws(e)}function Hi(e,t){return Vs(e,null,null,t),Ws(e)}function op(e,t,r){e.lanes|=r;var i=e.alternate;i!==null&&(i.lanes|=r);for(var u=!1,c=e.return;c!==null;)c.childLanes|=r,i=c.alternate,i!==null&&(i.childLanes|=r),c.tag===22&&(e=c.stateNode,e===null||e._visibility&1||(u=!0)),e=c,c=c.return;return e.tag===3?(c=e.stateNode,u&&t!==null&&(u=31-Ut(r),e=c.hiddenUpdates,i=e[u],i===null?e[u]=[t]:i.push(t),t.lane=r|536870912),c):null}function Ws(e){if(50<Il)throw Il=0,em=null,Error(s(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var xo={};function Xb(e,t,r,i){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function qr(e,t,r,i){return new Xb(e,t,r,i)}function Zc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ra(e,t){var r=e.alternate;return r===null?(r=qr(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&65011712,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r.refCleanup=e.refCleanup,r}function lp(e,t){e.flags&=65011714;var r=e.alternate;return r===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=r.childLanes,e.lanes=r.lanes,e.child=r.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=r.memoizedProps,e.memoizedState=r.memoizedState,e.updateQueue=r.updateQueue,e.type=r.type,t=r.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function qs(e,t,r,i,u,c){var f=0;if(i=e,typeof e=="function")Zc(e)&&(f=1);else if(typeof e=="string")f=Yy(e,r,B.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case T:return e=qr(31,r,t,u),e.elementType=T,e.lanes=c,e;case oe:return Vi(r.children,u,c,t);case ge:f=8,u|=24;break;case Be:return e=qr(12,r,t,u|2),e.elementType=Be,e.lanes=c,e;case ve:return e=qr(13,r,t,u),e.elementType=ve,e.lanes=c,e;case P:return e=qr(19,r,t,u),e.elementType=P,e.lanes=c,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case de:f=10;break e;case Te:f=9;break e;case Ae:f=11;break e;case k:f=14;break e;case H:f=16,i=null;break e}f=29,r=Error(s(130,e===null?"null":typeof e,"")),i=null}return t=qr(f,r,t,u),t.elementType=e,t.type=i,t.lanes=c,t}function Vi(e,t,r,i){return e=qr(7,e,i,t),e.lanes=r,e}function Uc(e,t,r){return e=qr(6,e,null,t),e.lanes=r,e}function sp(e){var t=qr(18,null,null,0);return t.stateNode=e,t}function Xc(e,t,r){return t=qr(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var up=new WeakMap;function aa(e,t){if(typeof e=="object"&&e!==null){var r=up.get(e);return r!==void 0?r:(t={value:e,source:t,stack:_t(t)},up.set(e,t),t)}return{value:e,source:t,stack:_t(t)}}var wo=[],Eo=0,Zs=null,xl=0,ia=[],oa=0,li=null,Ca=1,Sa="";function Ia(e,t){wo[Eo++]=xl,wo[Eo++]=Zs,Zs=e,xl=t}function cp(e,t,r){ia[oa++]=Ca,ia[oa++]=Sa,ia[oa++]=li,li=e;var i=Ca;e=Sa;var u=32-Ut(i)-1;i&=~(1<<u),r+=1;var c=32-Ut(t)+u;if(30<c){var f=u-u%5;c=(i&(1<<f)-1).toString(32),i>>=f,u-=f,Ca=1<<32-Ut(t)+u|r<<u|i,Sa=c+e}else Ca=1<<c|r<<u|i,Sa=e}function Kc(e){e.return!==null&&(Ia(e,1),cp(e,1,0))}function Gc(e){for(;e===Zs;)Zs=wo[--Eo],wo[Eo]=null,xl=wo[--Eo],wo[Eo]=null;for(;e===li;)li=ia[--oa],ia[oa]=null,Sa=ia[--oa],ia[oa]=null,Ca=ia[--oa],ia[oa]=null}function dp(e,t){ia[oa++]=Ca,ia[oa++]=Sa,ia[oa++]=li,Ca=t.id,Sa=t.overflow,li=e}var xr=null,Vn=null,yn=!1,si=null,la=!1,Yc=Error(s(519));function ui(e){var t=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw wl(aa(t,e)),Yc}function mp(e){var t=e.stateNode,r=e.type,i=e.memoizedProps;switch(t[at]=e,t[Ke]=i,r){case"dialog":vn("cancel",t),vn("close",t);break;case"iframe":case"object":case"embed":vn("load",t);break;case"video":case"audio":for(r=0;r<Vl.length;r++)vn(Vl[r],t);break;case"source":vn("error",t);break;case"img":case"image":case"link":vn("error",t),vn("load",t);break;case"details":vn("toggle",t);break;case"input":vn("invalid",t),Ve(t,i.value,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name,!0);break;case"select":vn("invalid",t);break;case"textarea":vn("invalid",t),it(t,i.value,i.defaultValue,i.children)}r=i.children,typeof r!="string"&&typeof r!="number"&&typeof r!="bigint"||t.textContent===""+r||i.suppressHydrationWarning===!0||_v(t.textContent,r)?(i.popover!=null&&(vn("beforetoggle",t),vn("toggle",t)),i.onScroll!=null&&vn("scroll",t),i.onScrollEnd!=null&&vn("scrollend",t),i.onClick!=null&&(t.onclick=ar),t=!0):t=!1,t||ui(e,!0)}function fp(e){for(xr=e.return;xr;)switch(xr.tag){case 5:case 31:case 13:la=!1;return;case 27:case 3:la=!0;return;default:xr=xr.return}}function ko(e){if(e!==xr)return!1;if(!yn)return fp(e),yn=!0,!1;var t=e.tag,r;if((r=t!==3&&t!==27)&&((r=t===5)&&(r=e.type,r=!(r!=="form"&&r!=="button")||fm(e.type,e.memoizedProps)),r=!r),r&&Vn&&ui(e),fp(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(317));Vn=Rv(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(317));Vn=Rv(e)}else t===27?(t=Vn,ki(e.type)?(e=bm,bm=null,Vn=e):Vn=t):Vn=xr?sa(e.stateNode.nextSibling):null;return!0}function Wi(){Vn=xr=null,yn=!1}function Jc(){var e=si;return e!==null&&(Or===null?Or=e:Or.push.apply(Or,e),si=null),e}function wl(e){si===null?si=[e]:si.push(e)}var Qc=x(null),qi=null,Ha=null;function ci(e,t,r){j(Qc,t._currentValue),t._currentValue=r}function Va(e){e._currentValue=Qc.current,C(Qc)}function ed(e,t,r){for(;e!==null;){var i=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,i!==null&&(i.childLanes|=t)):i!==null&&(i.childLanes&t)!==t&&(i.childLanes|=t),e===r)break;e=e.return}}function td(e,t,r,i){var u=e.child;for(u!==null&&(u.return=e);u!==null;){var c=u.dependencies;if(c!==null){var f=u.child;c=c.firstContext;e:for(;c!==null;){var y=c;c=u;for(var R=0;R<t.length;R++)if(y.context===t[R]){c.lanes|=r,y=c.alternate,y!==null&&(y.lanes|=r),ed(c.return,r,e),i||(f=null);break e}c=y.next}}else if(u.tag===18){if(f=u.return,f===null)throw Error(s(341));f.lanes|=r,c=f.alternate,c!==null&&(c.lanes|=r),ed(f,r,e),f=null}else f=u.child;if(f!==null)f.return=u;else for(f=u;f!==null;){if(f===e){f=null;break}if(u=f.sibling,u!==null){u.return=f.return,f=u;break}f=f.return}u=f}}function Co(e,t,r,i){e=null;for(var u=t,c=!1;u!==null;){if(!c){if((u.flags&524288)!==0)c=!0;else if((u.flags&262144)!==0)break}if(u.tag===10){var f=u.alternate;if(f===null)throw Error(s(387));if(f=f.memoizedProps,f!==null){var y=u.type;Wr(u.pendingProps.value,f.value)||(e!==null?e.push(y):e=[y])}}else if(u===Q.current){if(f=u.alternate,f===null)throw Error(s(387));f.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(e!==null?e.push(Xl):e=[Xl])}u=u.return}e!==null&&td(t,e,r,i),t.flags|=262144}function Us(e){for(e=e.firstContext;e!==null;){if(!Wr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Zi(e){qi=e,Ha=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function wr(e){return pp(qi,e)}function Xs(e,t){return qi===null&&Zi(e),pp(e,t)}function pp(e,t){var r=t._currentValue;if(t={context:t,memoizedValue:r,next:null},Ha===null){if(e===null)throw Error(s(308));Ha=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Ha=Ha.next=t;return r}var Kb=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(r,i){e.push(i)}};this.abort=function(){t.aborted=!0,e.forEach(function(r){return r()})}},Gb=a.unstable_scheduleCallback,Yb=a.unstable_NormalPriority,ir={$$typeof:de,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function nd(){return{controller:new Kb,data:new Map,refCount:0}}function El(e){e.refCount--,e.refCount===0&&Gb(Yb,function(){e.controller.abort()})}var kl=null,rd=0,So=0,Fo=null;function Jb(e,t){if(kl===null){var r=kl=[];rd=0,So=om(),Fo={status:"pending",value:void 0,then:function(i){r.push(i)}}}return rd++,t.then(hp,hp),t}function hp(){if(--rd===0&&kl!==null){Fo!==null&&(Fo.status="fulfilled");var e=kl;kl=null,So=0,Fo=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Qb(e,t){var r=[],i={status:"pending",value:null,reason:null,then:function(u){r.push(u)}};return e.then(function(){i.status="fulfilled",i.value=t;for(var u=0;u<r.length;u++)(0,r[u])(t)},function(u){for(i.status="rejected",i.reason=u,u=0;u<r.length;u++)(0,r[u])(void 0)}),i}var vp=M.S;M.S=function(e,t){Qh=Ge(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&Jb(e,t),vp!==null&&vp(e,t)};var Ui=x(null);function ad(){var e=Ui.current;return e!==null?e:In.pooledCache}function Ks(e,t){t===null?j(Ui,Ui.current):j(Ui,t.pool)}function gp(){var e=ad();return e===null?null:{parent:ir._currentValue,pool:e}}var Mo=Error(s(460)),id=Error(s(474)),Gs=Error(s(542)),Ys={then:function(){}};function bp(e){return e=e.status,e==="fulfilled"||e==="rejected"}function yp(e,t,r){switch(r=e[r],r===void 0?e.push(t):r!==t&&(t.then(ar,ar),t=r),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,wp(e),e;default:if(typeof t.status=="string")t.then(ar,ar);else{if(e=In,e!==null&&100<e.shellSuspendCounter)throw Error(s(482));e=t,e.status="pending",e.then(function(i){if(t.status==="pending"){var u=t;u.status="fulfilled",u.value=i}},function(i){if(t.status==="pending"){var u=t;u.status="rejected",u.reason=i}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,wp(e),e}throw Ki=t,Mo}}function Xi(e){try{var t=e._init;return t(e._payload)}catch(r){throw r!==null&&typeof r=="object"&&typeof r.then=="function"?(Ki=r,Mo):r}}var Ki=null;function xp(){if(Ki===null)throw Error(s(459));var e=Ki;return Ki=null,e}function wp(e){if(e===Mo||e===Gs)throw Error(s(483))}var Lo=null,Cl=0;function Js(e){var t=Cl;return Cl+=1,Lo===null&&(Lo=[]),yp(Lo,e,t)}function Sl(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Qs(e,t){throw t.$$typeof===J?Error(s(525)):(e=Object.prototype.toString.call(t),Error(s(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Ep(e){function t(re,X){if(e){var pe=re.deletions;pe===null?(re.deletions=[X],re.flags|=16):pe.push(X)}}function r(re,X){if(!e)return null;for(;X!==null;)t(re,X),X=X.sibling;return null}function i(re){for(var X=new Map;re!==null;)re.key!==null?X.set(re.key,re):X.set(re.index,re),re=re.sibling;return X}function u(re,X){return re=Ra(re,X),re.index=0,re.sibling=null,re}function c(re,X,pe){return re.index=pe,e?(pe=re.alternate,pe!==null?(pe=pe.index,pe<X?(re.flags|=67108866,X):pe):(re.flags|=67108866,X)):(re.flags|=1048576,X)}function f(re){return e&&re.alternate===null&&(re.flags|=67108866),re}function y(re,X,pe,$e){return X===null||X.tag!==6?(X=Uc(pe,re.mode,$e),X.return=re,X):(X=u(X,pe),X.return=re,X)}function R(re,X,pe,$e){var Ht=pe.type;return Ht===oe?ze(re,X,pe.props.children,$e,pe.key):X!==null&&(X.elementType===Ht||typeof Ht=="object"&&Ht!==null&&Ht.$$typeof===H&&Xi(Ht)===X.type)?(X=u(X,pe.props),Sl(X,pe),X.return=re,X):(X=qs(pe.type,pe.key,pe.props,null,re.mode,$e),Sl(X,pe),X.return=re,X)}function he(re,X,pe,$e){return X===null||X.tag!==4||X.stateNode.containerInfo!==pe.containerInfo||X.stateNode.implementation!==pe.implementation?(X=Xc(pe,re.mode,$e),X.return=re,X):(X=u(X,pe.children||[]),X.return=re,X)}function ze(re,X,pe,$e,Ht){return X===null||X.tag!==7?(X=Vi(pe,re.mode,$e,Ht),X.return=re,X):(X=u(X,pe),X.return=re,X)}function Ie(re,X,pe){if(typeof X=="string"&&X!==""||typeof X=="number"||typeof X=="bigint")return X=Uc(""+X,re.mode,pe),X.return=re,X;if(typeof X=="object"&&X!==null){switch(X.$$typeof){case Y:return pe=qs(X.type,X.key,X.props,null,re.mode,pe),Sl(pe,X),pe.return=re,pe;case ue:return X=Xc(X,re.mode,pe),X.return=re,X;case H:return X=Xi(X),Ie(re,X,pe)}if($(X)||se(X))return X=Vi(X,re.mode,pe,null),X.return=re,X;if(typeof X.then=="function")return Ie(re,Js(X),pe);if(X.$$typeof===de)return Ie(re,Xs(re,X),pe);Qs(re,X)}return null}function ye(re,X,pe,$e){var Ht=X!==null?X.key:null;if(typeof pe=="string"&&pe!==""||typeof pe=="number"||typeof pe=="bigint")return Ht!==null?null:y(re,X,""+pe,$e);if(typeof pe=="object"&&pe!==null){switch(pe.$$typeof){case Y:return pe.key===Ht?R(re,X,pe,$e):null;case ue:return pe.key===Ht?he(re,X,pe,$e):null;case H:return pe=Xi(pe),ye(re,X,pe,$e)}if($(pe)||se(pe))return Ht!==null?null:ze(re,X,pe,$e,null);if(typeof pe.then=="function")return ye(re,X,Js(pe),$e);if(pe.$$typeof===de)return ye(re,X,Xs(re,pe),$e);Qs(re,pe)}return null}function Se(re,X,pe,$e,Ht){if(typeof $e=="string"&&$e!==""||typeof $e=="number"||typeof $e=="bigint")return re=re.get(pe)||null,y(X,re,""+$e,Ht);if(typeof $e=="object"&&$e!==null){switch($e.$$typeof){case Y:return re=re.get($e.key===null?pe:$e.key)||null,R(X,re,$e,Ht);case ue:return re=re.get($e.key===null?pe:$e.key)||null,he(X,re,$e,Ht);case H:return $e=Xi($e),Se(re,X,pe,$e,Ht)}if($($e)||se($e))return re=re.get(pe)||null,ze(X,re,$e,Ht,null);if(typeof $e.then=="function")return Se(re,X,pe,Js($e),Ht);if($e.$$typeof===de)return Se(re,X,pe,Xs(X,$e),Ht);Qs(X,$e)}return null}function At(re,X,pe,$e){for(var Ht=null,Sn=null,Dt=X,cn=X=0,bn=null;Dt!==null&&cn<pe.length;cn++){Dt.index>cn?(bn=Dt,Dt=null):bn=Dt.sibling;var Fn=ye(re,Dt,pe[cn],$e);if(Fn===null){Dt===null&&(Dt=bn);break}e&&Dt&&Fn.alternate===null&&t(re,Dt),X=c(Fn,X,cn),Sn===null?Ht=Fn:Sn.sibling=Fn,Sn=Fn,Dt=bn}if(cn===pe.length)return r(re,Dt),yn&&Ia(re,cn),Ht;if(Dt===null){for(;cn<pe.length;cn++)Dt=Ie(re,pe[cn],$e),Dt!==null&&(X=c(Dt,X,cn),Sn===null?Ht=Dt:Sn.sibling=Dt,Sn=Dt);return yn&&Ia(re,cn),Ht}for(Dt=i(Dt);cn<pe.length;cn++)bn=Se(Dt,re,cn,pe[cn],$e),bn!==null&&(e&&bn.alternate!==null&&Dt.delete(bn.key===null?cn:bn.key),X=c(bn,X,cn),Sn===null?Ht=bn:Sn.sibling=bn,Sn=bn);return e&&Dt.forEach(function(Li){return t(re,Li)}),yn&&Ia(re,cn),Ht}function Gt(re,X,pe,$e){if(pe==null)throw Error(s(151));for(var Ht=null,Sn=null,Dt=X,cn=X=0,bn=null,Fn=pe.next();Dt!==null&&!Fn.done;cn++,Fn=pe.next()){Dt.index>cn?(bn=Dt,Dt=null):bn=Dt.sibling;var Li=ye(re,Dt,Fn.value,$e);if(Li===null){Dt===null&&(Dt=bn);break}e&&Dt&&Li.alternate===null&&t(re,Dt),X=c(Li,X,cn),Sn===null?Ht=Li:Sn.sibling=Li,Sn=Li,Dt=bn}if(Fn.done)return r(re,Dt),yn&&Ia(re,cn),Ht;if(Dt===null){for(;!Fn.done;cn++,Fn=pe.next())Fn=Ie(re,Fn.value,$e),Fn!==null&&(X=c(Fn,X,cn),Sn===null?Ht=Fn:Sn.sibling=Fn,Sn=Fn);return yn&&Ia(re,cn),Ht}for(Dt=i(Dt);!Fn.done;cn++,Fn=pe.next())Fn=Se(Dt,re,cn,Fn.value,$e),Fn!==null&&(e&&Fn.alternate!==null&&Dt.delete(Fn.key===null?cn:Fn.key),X=c(Fn,X,cn),Sn===null?Ht=Fn:Sn.sibling=Fn,Sn=Fn);return e&&Dt.forEach(function(s1){return t(re,s1)}),yn&&Ia(re,cn),Ht}function On(re,X,pe,$e){if(typeof pe=="object"&&pe!==null&&pe.type===oe&&pe.key===null&&(pe=pe.props.children),typeof pe=="object"&&pe!==null){switch(pe.$$typeof){case Y:e:{for(var Ht=pe.key;X!==null;){if(X.key===Ht){if(Ht=pe.type,Ht===oe){if(X.tag===7){r(re,X.sibling),$e=u(X,pe.props.children),$e.return=re,re=$e;break e}}else if(X.elementType===Ht||typeof Ht=="object"&&Ht!==null&&Ht.$$typeof===H&&Xi(Ht)===X.type){r(re,X.sibling),$e=u(X,pe.props),Sl($e,pe),$e.return=re,re=$e;break e}r(re,X);break}else t(re,X);X=X.sibling}pe.type===oe?($e=Vi(pe.props.children,re.mode,$e,pe.key),$e.return=re,re=$e):($e=qs(pe.type,pe.key,pe.props,null,re.mode,$e),Sl($e,pe),$e.return=re,re=$e)}return f(re);case ue:e:{for(Ht=pe.key;X!==null;){if(X.key===Ht)if(X.tag===4&&X.stateNode.containerInfo===pe.containerInfo&&X.stateNode.implementation===pe.implementation){r(re,X.sibling),$e=u(X,pe.children||[]),$e.return=re,re=$e;break e}else{r(re,X);break}else t(re,X);X=X.sibling}$e=Xc(pe,re.mode,$e),$e.return=re,re=$e}return f(re);case H:return pe=Xi(pe),On(re,X,pe,$e)}if($(pe))return At(re,X,pe,$e);if(se(pe)){if(Ht=se(pe),typeof Ht!="function")throw Error(s(150));return pe=Ht.call(pe),Gt(re,X,pe,$e)}if(typeof pe.then=="function")return On(re,X,Js(pe),$e);if(pe.$$typeof===de)return On(re,X,Xs(re,pe),$e);Qs(re,pe)}return typeof pe=="string"&&pe!==""||typeof pe=="number"||typeof pe=="bigint"?(pe=""+pe,X!==null&&X.tag===6?(r(re,X.sibling),$e=u(X,pe),$e.return=re,re=$e):(r(re,X),$e=Uc(pe,re.mode,$e),$e.return=re,re=$e),f(re)):r(re,X)}return function(re,X,pe,$e){try{Cl=0;var Ht=On(re,X,pe,$e);return Lo=null,Ht}catch(Dt){if(Dt===Mo||Dt===Gs)throw Dt;var Sn=qr(29,Dt,null,re.mode);return Sn.lanes=$e,Sn.return=re,Sn}}}var Gi=Ep(!0),kp=Ep(!1),di=!1;function od(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ld(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function mi(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function fi(e,t,r){var i=e.updateQueue;if(i===null)return null;if(i=i.shared,(Mn&2)!==0){var u=i.pending;return u===null?t.next=t:(t.next=u.next,u.next=t),i.pending=t,t=Ws(e),op(e,null,r),t}return Vs(e,i,t,r),Ws(e)}function Fl(e,t,r){if(t=t.updateQueue,t!==null&&(t=t.shared,(r&4194048)!==0)){var i=t.lanes;i&=e.pendingLanes,r|=i,t.lanes=r,V(e,r)}}function sd(e,t){var r=e.updateQueue,i=e.alternate;if(i!==null&&(i=i.updateQueue,r===i)){var u=null,c=null;if(r=r.firstBaseUpdate,r!==null){do{var f={lane:r.lane,tag:r.tag,payload:r.payload,callback:null,next:null};c===null?u=c=f:c=c.next=f,r=r.next}while(r!==null);c===null?u=c=t:c=c.next=t}else u=c=t;r={baseState:i.baseState,firstBaseUpdate:u,lastBaseUpdate:c,shared:i.shared,callbacks:i.callbacks},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}var ud=!1;function Ml(){if(ud){var e=Fo;if(e!==null)throw e}}function Ll(e,t,r,i){ud=!1;var u=e.updateQueue;di=!1;var c=u.firstBaseUpdate,f=u.lastBaseUpdate,y=u.shared.pending;if(y!==null){u.shared.pending=null;var R=y,he=R.next;R.next=null,f===null?c=he:f.next=he,f=R;var ze=e.alternate;ze!==null&&(ze=ze.updateQueue,y=ze.lastBaseUpdate,y!==f&&(y===null?ze.firstBaseUpdate=he:y.next=he,ze.lastBaseUpdate=R))}if(c!==null){var Ie=u.baseState;f=0,ze=he=R=null,y=c;do{var ye=y.lane&-536870913,Se=ye!==y.lane;if(Se?(gn&ye)===ye:(i&ye)===ye){ye!==0&&ye===So&&(ud=!0),ze!==null&&(ze=ze.next={lane:0,tag:y.tag,payload:y.payload,callback:null,next:null});e:{var At=e,Gt=y;ye=t;var On=r;switch(Gt.tag){case 1:if(At=Gt.payload,typeof At=="function"){Ie=At.call(On,Ie,ye);break e}Ie=At;break e;case 3:At.flags=At.flags&-65537|128;case 0:if(At=Gt.payload,ye=typeof At=="function"?At.call(On,Ie,ye):At,ye==null)break e;Ie=S({},Ie,ye);break e;case 2:di=!0}}ye=y.callback,ye!==null&&(e.flags|=64,Se&&(e.flags|=8192),Se=u.callbacks,Se===null?u.callbacks=[ye]:Se.push(ye))}else Se={lane:ye,tag:y.tag,payload:y.payload,callback:y.callback,next:null},ze===null?(he=ze=Se,R=Ie):ze=ze.next=Se,f|=ye;if(y=y.next,y===null){if(y=u.shared.pending,y===null)break;Se=y,y=Se.next,Se.next=null,u.lastBaseUpdate=Se,u.shared.pending=null}}while(!0);ze===null&&(R=Ie),u.baseState=R,u.firstBaseUpdate=he,u.lastBaseUpdate=ze,c===null&&(u.shared.lanes=0),bi|=f,e.lanes=f,e.memoizedState=Ie}}function Cp(e,t){if(typeof e!="function")throw Error(s(191,e));e.call(t)}function Sp(e,t){var r=e.callbacks;if(r!==null)for(e.callbacks=null,e=0;e<r.length;e++)Cp(r[e],t)}var Ao=x(null),eu=x(0);function Fp(e,t){e=Ja,j(eu,e),j(Ao,t),Ja=e|t.baseLanes}function cd(){j(eu,Ja),j(Ao,Ao.current)}function dd(){Ja=eu.current,C(Ao),C(eu)}var Zr=x(null),va=null;function pi(e){var t=e.alternate;j(er,er.current&1),j(Zr,e),va===null&&(t===null||Ao.current!==null||t.memoizedState!==null)&&(va=e)}function md(e){j(er,er.current),j(Zr,e),va===null&&(va=e)}function Mp(e){e.tag===22?(j(er,er.current),j(Zr,e),va===null&&(va=e)):hi()}function hi(){j(er,er.current),j(Zr,Zr.current)}function Ur(e){C(Zr),va===e&&(va=null),C(er)}var er=x(0);function tu(e){for(var t=e;t!==null;){if(t.tag===13){var r=t.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||vm(r)||gm(r)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Wa=0,ln=null,Pn=null,or=null,nu=!1,No=!1,Yi=!1,ru=0,Al=0,_o=null,ey=0;function Yn(){throw Error(s(321))}function fd(e,t){if(t===null)return!1;for(var r=0;r<t.length&&r<e.length;r++)if(!Wr(e[r],t[r]))return!1;return!0}function pd(e,t,r,i,u,c){return Wa=c,ln=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,M.H=e===null||e.memoizedState===null?ch:Ad,Yi=!1,c=r(i,u),Yi=!1,No&&(c=Ap(t,r,i,u)),Lp(e),c}function Lp(e){M.H=Tl;var t=Pn!==null&&Pn.next!==null;if(Wa=0,or=Pn=ln=null,nu=!1,Al=0,_o=null,t)throw Error(s(300));e===null||lr||(e=e.dependencies,e!==null&&Us(e)&&(lr=!0))}function Ap(e,t,r,i){ln=e;var u=0;do{if(No&&(_o=null),Al=0,No=!1,25<=u)throw Error(s(301));if(u+=1,or=Pn=null,e.updateQueue!=null){var c=e.updateQueue;c.lastEffect=null,c.events=null,c.stores=null,c.memoCache!=null&&(c.memoCache.index=0)}M.H=dh,c=t(r,i)}while(No);return c}function ty(){var e=M.H,t=e.useState()[0];return t=typeof t.then=="function"?Nl(t):t,e=e.useState()[0],(Pn!==null?Pn.memoizedState:null)!==e&&(ln.flags|=1024),t}function hd(){var e=ru!==0;return ru=0,e}function vd(e,t,r){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~r}function gd(e){if(nu){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}nu=!1}Wa=0,or=Pn=ln=null,No=!1,Al=ru=0,_o=null}function Lr(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return or===null?ln.memoizedState=or=e:or=or.next=e,or}function tr(){if(Pn===null){var e=ln.alternate;e=e!==null?e.memoizedState:null}else e=Pn.next;var t=or===null?ln.memoizedState:or.next;if(t!==null)or=t,Pn=e;else{if(e===null)throw ln.alternate===null?Error(s(467)):Error(s(310));Pn=e,e={memoizedState:Pn.memoizedState,baseState:Pn.baseState,baseQueue:Pn.baseQueue,queue:Pn.queue,next:null},or===null?ln.memoizedState=or=e:or=or.next=e}return or}function au(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Nl(e){var t=Al;return Al+=1,_o===null&&(_o=[]),e=yp(_o,e,t),t=ln,(or===null?t.memoizedState:or.next)===null&&(t=t.alternate,M.H=t===null||t.memoizedState===null?ch:Ad),e}function iu(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Nl(e);if(e.$$typeof===de)return wr(e)}throw Error(s(438,String(e)))}function bd(e){var t=null,r=ln.updateQueue;if(r!==null&&(t=r.memoCache),t==null){var i=ln.alternate;i!==null&&(i=i.updateQueue,i!==null&&(i=i.memoCache,i!=null&&(t={data:i.data.map(function(u){return u.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),r===null&&(r=au(),ln.updateQueue=r),r.memoCache=t,r=t.data[t.index],r===void 0)for(r=t.data[t.index]=Array(e),i=0;i<e;i++)r[i]=_;return t.index++,r}function qa(e,t){return typeof t=="function"?t(e):t}function ou(e){var t=tr();return yd(t,Pn,e)}function yd(e,t,r){var i=e.queue;if(i===null)throw Error(s(311));i.lastRenderedReducer=r;var u=e.baseQueue,c=i.pending;if(c!==null){if(u!==null){var f=u.next;u.next=c.next,c.next=f}t.baseQueue=u=c,i.pending=null}if(c=e.baseState,u===null)e.memoizedState=c;else{t=u.next;var y=f=null,R=null,he=t,ze=!1;do{var Ie=he.lane&-536870913;if(Ie!==he.lane?(gn&Ie)===Ie:(Wa&Ie)===Ie){var ye=he.revertLane;if(ye===0)R!==null&&(R=R.next={lane:0,revertLane:0,gesture:null,action:he.action,hasEagerState:he.hasEagerState,eagerState:he.eagerState,next:null}),Ie===So&&(ze=!0);else if((Wa&ye)===ye){he=he.next,ye===So&&(ze=!0);continue}else Ie={lane:0,revertLane:he.revertLane,gesture:null,action:he.action,hasEagerState:he.hasEagerState,eagerState:he.eagerState,next:null},R===null?(y=R=Ie,f=c):R=R.next=Ie,ln.lanes|=ye,bi|=ye;Ie=he.action,Yi&&r(c,Ie),c=he.hasEagerState?he.eagerState:r(c,Ie)}else ye={lane:Ie,revertLane:he.revertLane,gesture:he.gesture,action:he.action,hasEagerState:he.hasEagerState,eagerState:he.eagerState,next:null},R===null?(y=R=ye,f=c):R=R.next=ye,ln.lanes|=Ie,bi|=Ie;he=he.next}while(he!==null&&he!==t);if(R===null?f=c:R.next=y,!Wr(c,e.memoizedState)&&(lr=!0,ze&&(r=Fo,r!==null)))throw r;e.memoizedState=c,e.baseState=f,e.baseQueue=R,i.lastRenderedState=c}return u===null&&(i.lanes=0),[e.memoizedState,i.dispatch]}function xd(e){var t=tr(),r=t.queue;if(r===null)throw Error(s(311));r.lastRenderedReducer=e;var i=r.dispatch,u=r.pending,c=t.memoizedState;if(u!==null){r.pending=null;var f=u=u.next;do c=e(c,f.action),f=f.next;while(f!==u);Wr(c,t.memoizedState)||(lr=!0),t.memoizedState=c,t.baseQueue===null&&(t.baseState=c),r.lastRenderedState=c}return[c,i]}function Np(e,t,r){var i=ln,u=tr(),c=yn;if(c){if(r===void 0)throw Error(s(407));r=r()}else r=t();var f=!Wr((Pn||u).memoizedState,r);if(f&&(u.memoizedState=r,lr=!0),u=u.queue,kd(Bp.bind(null,i,u,e),[e]),u.getSnapshot!==t||f||or!==null&&or.memoizedState.tag&1){if(i.flags|=2048,To(9,{destroy:void 0},Tp.bind(null,i,u,r,t),null),In===null)throw Error(s(349));c||(Wa&127)!==0||_p(i,t,r)}return r}function _p(e,t,r){e.flags|=16384,e={getSnapshot:t,value:r},t=ln.updateQueue,t===null?(t=au(),ln.updateQueue=t,t.stores=[e]):(r=t.stores,r===null?t.stores=[e]:r.push(e))}function Tp(e,t,r,i){t.value=r,t.getSnapshot=i,Dp(t)&&zp(e)}function Bp(e,t,r){return r(function(){Dp(t)&&zp(e)})}function Dp(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!Wr(e,r)}catch{return!0}}function zp(e){var t=Hi(e,2);t!==null&&$r(t,e,2)}function wd(e){var t=Lr();if(typeof e=="function"){var r=e;if(e=r(),Yi){dn(!0);try{r()}finally{dn(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:qa,lastRenderedState:e},t}function Pp(e,t,r,i){return e.baseState=r,yd(e,Pn,typeof i=="function"?i:qa)}function ny(e,t,r,i,u){if(uu(e))throw Error(s(485));if(e=t.action,e!==null){var c={payload:u,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(f){c.listeners.push(f)}};M.T!==null?r(!0):c.isTransition=!1,i(c),r=t.pending,r===null?(c.next=t.pending=c,jp(t,c)):(c.next=r.next,t.pending=r.next=c)}}function jp(e,t){var r=t.action,i=t.payload,u=e.state;if(t.isTransition){var c=M.T,f={};M.T=f;try{var y=r(u,i),R=M.S;R!==null&&R(f,y),Op(e,t,y)}catch(he){Ed(e,t,he)}finally{c!==null&&f.types!==null&&(c.types=f.types),M.T=c}}else try{c=r(u,i),Op(e,t,c)}catch(he){Ed(e,t,he)}}function Op(e,t,r){r!==null&&typeof r=="object"&&typeof r.then=="function"?r.then(function(i){$p(e,t,i)},function(i){return Ed(e,t,i)}):$p(e,t,r)}function $p(e,t,r){t.status="fulfilled",t.value=r,Rp(t),e.state=r,t=e.pending,t!==null&&(r=t.next,r===t?e.pending=null:(r=r.next,t.next=r,jp(e,r)))}function Ed(e,t,r){var i=e.pending;if(e.pending=null,i!==null){i=i.next;do t.status="rejected",t.reason=r,Rp(t),t=t.next;while(t!==i)}e.action=null}function Rp(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Ip(e,t){return t}function Hp(e,t){if(yn){var r=In.formState;if(r!==null){e:{var i=ln;if(yn){if(Vn){t:{for(var u=Vn,c=la;u.nodeType!==8;){if(!c){u=null;break t}if(u=sa(u.nextSibling),u===null){u=null;break t}}c=u.data,u=c==="F!"||c==="F"?u:null}if(u){Vn=sa(u.nextSibling),i=u.data==="F!";break e}}ui(i)}i=!1}i&&(t=r[0])}}return r=Lr(),r.memoizedState=r.baseState=t,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ip,lastRenderedState:t},r.queue=i,r=lh.bind(null,ln,i),i.dispatch=r,i=wd(!1),c=Ld.bind(null,ln,!1,i.queue),i=Lr(),u={state:t,dispatch:null,action:e,pending:null},i.queue=u,r=ny.bind(null,ln,u,c,r),u.dispatch=r,i.memoizedState=e,[t,r,!1]}function Vp(e){var t=tr();return Wp(t,Pn,e)}function Wp(e,t,r){if(t=yd(e,t,Ip)[0],e=ou(qa)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var i=Nl(t)}catch(f){throw f===Mo?Gs:f}else i=t;t=tr();var u=t.queue,c=u.dispatch;return r!==t.memoizedState&&(ln.flags|=2048,To(9,{destroy:void 0},ry.bind(null,u,r),null)),[i,c,e]}function ry(e,t){e.action=t}function qp(e){var t=tr(),r=Pn;if(r!==null)return Wp(t,r,e);tr(),t=t.memoizedState,r=tr();var i=r.queue.dispatch;return r.memoizedState=e,[t,i,!1]}function To(e,t,r,i){return e={tag:e,create:r,deps:i,inst:t,next:null},t=ln.updateQueue,t===null&&(t=au(),ln.updateQueue=t),r=t.lastEffect,r===null?t.lastEffect=e.next=e:(i=r.next,r.next=e,e.next=i,t.lastEffect=e),e}function Zp(){return tr().memoizedState}function lu(e,t,r,i){var u=Lr();ln.flags|=e,u.memoizedState=To(1|t,{destroy:void 0},r,i===void 0?null:i)}function su(e,t,r,i){var u=tr();i=i===void 0?null:i;var c=u.memoizedState.inst;Pn!==null&&i!==null&&fd(i,Pn.memoizedState.deps)?u.memoizedState=To(t,c,r,i):(ln.flags|=e,u.memoizedState=To(1|t,c,r,i))}function Up(e,t){lu(8390656,8,e,t)}function kd(e,t){su(2048,8,e,t)}function ay(e){ln.flags|=4;var t=ln.updateQueue;if(t===null)t=au(),ln.updateQueue=t,t.events=[e];else{var r=t.events;r===null?t.events=[e]:r.push(e)}}function Xp(e){var t=tr().memoizedState;return ay({ref:t,nextImpl:e}),function(){if((Mn&2)!==0)throw Error(s(440));return t.impl.apply(void 0,arguments)}}function Kp(e,t){return su(4,2,e,t)}function Gp(e,t){return su(4,4,e,t)}function Yp(e,t){if(typeof t=="function"){e=e();var r=t(e);return function(){typeof r=="function"?r():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Jp(e,t,r){r=r!=null?r.concat([e]):null,su(4,4,Yp.bind(null,t,e),r)}function Cd(){}function Qp(e,t){var r=tr();t=t===void 0?null:t;var i=r.memoizedState;return t!==null&&fd(t,i[1])?i[0]:(r.memoizedState=[e,t],e)}function eh(e,t){var r=tr();t=t===void 0?null:t;var i=r.memoizedState;if(t!==null&&fd(t,i[1]))return i[0];if(i=e(),Yi){dn(!0);try{e()}finally{dn(!1)}}return r.memoizedState=[i,t],i}function Sd(e,t,r){return r===void 0||(Wa&1073741824)!==0&&(gn&261930)===0?e.memoizedState=t:(e.memoizedState=r,e=tv(),ln.lanes|=e,bi|=e,r)}function th(e,t,r,i){return Wr(r,t)?r:Ao.current!==null?(e=Sd(e,r,i),Wr(e,t)||(lr=!0),e):(Wa&42)===0||(Wa&1073741824)!==0&&(gn&261930)===0?(lr=!0,e.memoizedState=r):(e=tv(),ln.lanes|=e,bi|=e,t)}function nh(e,t,r,i,u){var c=A.p;A.p=c!==0&&8>c?c:8;var f=M.T,y={};M.T=y,Ld(e,!1,t,r);try{var R=u(),he=M.S;if(he!==null&&he(y,R),R!==null&&typeof R=="object"&&typeof R.then=="function"){var ze=Qb(R,i);_l(e,t,ze,Gr(e))}else _l(e,t,i,Gr(e))}catch(Ie){_l(e,t,{then:function(){},status:"rejected",reason:Ie},Gr())}finally{A.p=c,f!==null&&y.types!==null&&(f.types=y.types),M.T=f}}function iy(){}function Fd(e,t,r,i){if(e.tag!==5)throw Error(s(476));var u=rh(e).queue;nh(e,u,t,ee,r===null?iy:function(){return ah(e),r(i)})}function rh(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ee,baseState:ee,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:qa,lastRenderedState:ee},next:null};var r={};return t.next={memoizedState:r,baseState:r,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:qa,lastRenderedState:r},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function ah(e){var t=rh(e);t.next===null&&(t=e.alternate.memoizedState),_l(e,t.next.queue,{},Gr())}function Md(){return wr(Xl)}function ih(){return tr().memoizedState}function oh(){return tr().memoizedState}function oy(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var r=Gr();e=mi(r);var i=fi(t,e,r);i!==null&&($r(i,t,r),Fl(i,t,r)),t={cache:nd()},e.payload=t;return}t=t.return}}function ly(e,t,r){var i=Gr();r={lane:i,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},uu(e)?sh(t,r):(r=qc(e,t,r,i),r!==null&&($r(r,e,i),uh(r,t,i)))}function lh(e,t,r){var i=Gr();_l(e,t,r,i)}function _l(e,t,r,i){var u={lane:i,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null};if(uu(e))sh(t,u);else{var c=e.alternate;if(e.lanes===0&&(c===null||c.lanes===0)&&(c=t.lastRenderedReducer,c!==null))try{var f=t.lastRenderedState,y=c(f,r);if(u.hasEagerState=!0,u.eagerState=y,Wr(y,f))return Vs(e,t,u,0),In===null&&Hs(),!1}catch{}if(r=qc(e,t,u,i),r!==null)return $r(r,e,i),uh(r,t,i),!0}return!1}function Ld(e,t,r,i){if(i={lane:2,revertLane:om(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},uu(e)){if(t)throw Error(s(479))}else t=qc(e,r,i,2),t!==null&&$r(t,e,2)}function uu(e){var t=e.alternate;return e===ln||t!==null&&t===ln}function sh(e,t){No=nu=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function uh(e,t,r){if((r&4194048)!==0){var i=t.lanes;i&=e.pendingLanes,r|=i,t.lanes=r,V(e,r)}}var Tl={readContext:wr,use:iu,useCallback:Yn,useContext:Yn,useEffect:Yn,useImperativeHandle:Yn,useLayoutEffect:Yn,useInsertionEffect:Yn,useMemo:Yn,useReducer:Yn,useRef:Yn,useState:Yn,useDebugValue:Yn,useDeferredValue:Yn,useTransition:Yn,useSyncExternalStore:Yn,useId:Yn,useHostTransitionStatus:Yn,useFormState:Yn,useActionState:Yn,useOptimistic:Yn,useMemoCache:Yn,useCacheRefresh:Yn};Tl.useEffectEvent=Yn;var ch={readContext:wr,use:iu,useCallback:function(e,t){return Lr().memoizedState=[e,t===void 0?null:t],e},useContext:wr,useEffect:Up,useImperativeHandle:function(e,t,r){r=r!=null?r.concat([e]):null,lu(4194308,4,Yp.bind(null,t,e),r)},useLayoutEffect:function(e,t){return lu(4194308,4,e,t)},useInsertionEffect:function(e,t){lu(4,2,e,t)},useMemo:function(e,t){var r=Lr();t=t===void 0?null:t;var i=e();if(Yi){dn(!0);try{e()}finally{dn(!1)}}return r.memoizedState=[i,t],i},useReducer:function(e,t,r){var i=Lr();if(r!==void 0){var u=r(t);if(Yi){dn(!0);try{r(t)}finally{dn(!1)}}}else u=t;return i.memoizedState=i.baseState=u,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:u},i.queue=e,e=e.dispatch=ly.bind(null,ln,e),[i.memoizedState,e]},useRef:function(e){var t=Lr();return e={current:e},t.memoizedState=e},useState:function(e){e=wd(e);var t=e.queue,r=lh.bind(null,ln,t);return t.dispatch=r,[e.memoizedState,r]},useDebugValue:Cd,useDeferredValue:function(e,t){var r=Lr();return Sd(r,e,t)},useTransition:function(){var e=wd(!1);return e=nh.bind(null,ln,e.queue,!0,!1),Lr().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,r){var i=ln,u=Lr();if(yn){if(r===void 0)throw Error(s(407));r=r()}else{if(r=t(),In===null)throw Error(s(349));(gn&127)!==0||_p(i,t,r)}u.memoizedState=r;var c={value:r,getSnapshot:t};return u.queue=c,Up(Bp.bind(null,i,c,e),[e]),i.flags|=2048,To(9,{destroy:void 0},Tp.bind(null,i,c,r,t),null),r},useId:function(){var e=Lr(),t=In.identifierPrefix;if(yn){var r=Sa,i=Ca;r=(i&~(1<<32-Ut(i)-1)).toString(32)+r,t="_"+t+"R_"+r,r=ru++,0<r&&(t+="H"+r.toString(32)),t+="_"}else r=ey++,t="_"+t+"r_"+r.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Md,useFormState:Hp,useActionState:Hp,useOptimistic:function(e){var t=Lr();t.memoizedState=t.baseState=e;var r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=r,t=Ld.bind(null,ln,!0,r),r.dispatch=t,[e,t]},useMemoCache:bd,useCacheRefresh:function(){return Lr().memoizedState=oy.bind(null,ln)},useEffectEvent:function(e){var t=Lr(),r={impl:e};return t.memoizedState=r,function(){if((Mn&2)!==0)throw Error(s(440));return r.impl.apply(void 0,arguments)}}},Ad={readContext:wr,use:iu,useCallback:Qp,useContext:wr,useEffect:kd,useImperativeHandle:Jp,useInsertionEffect:Kp,useLayoutEffect:Gp,useMemo:eh,useReducer:ou,useRef:Zp,useState:function(){return ou(qa)},useDebugValue:Cd,useDeferredValue:function(e,t){var r=tr();return th(r,Pn.memoizedState,e,t)},useTransition:function(){var e=ou(qa)[0],t=tr().memoizedState;return[typeof e=="boolean"?e:Nl(e),t]},useSyncExternalStore:Np,useId:ih,useHostTransitionStatus:Md,useFormState:Vp,useActionState:Vp,useOptimistic:function(e,t){var r=tr();return Pp(r,Pn,e,t)},useMemoCache:bd,useCacheRefresh:oh};Ad.useEffectEvent=Xp;var dh={readContext:wr,use:iu,useCallback:Qp,useContext:wr,useEffect:kd,useImperativeHandle:Jp,useInsertionEffect:Kp,useLayoutEffect:Gp,useMemo:eh,useReducer:xd,useRef:Zp,useState:function(){return xd(qa)},useDebugValue:Cd,useDeferredValue:function(e,t){var r=tr();return Pn===null?Sd(r,e,t):th(r,Pn.memoizedState,e,t)},useTransition:function(){var e=xd(qa)[0],t=tr().memoizedState;return[typeof e=="boolean"?e:Nl(e),t]},useSyncExternalStore:Np,useId:ih,useHostTransitionStatus:Md,useFormState:qp,useActionState:qp,useOptimistic:function(e,t){var r=tr();return Pn!==null?Pp(r,Pn,e,t):(r.baseState=e,[e,r.queue.dispatch])},useMemoCache:bd,useCacheRefresh:oh};dh.useEffectEvent=Xp;function Nd(e,t,r,i){t=e.memoizedState,r=r(i,t),r=r==null?t:S({},t,r),e.memoizedState=r,e.lanes===0&&(e.updateQueue.baseState=r)}var _d={enqueueSetState:function(e,t,r){e=e._reactInternals;var i=Gr(),u=mi(i);u.payload=t,r!=null&&(u.callback=r),t=fi(e,u,i),t!==null&&($r(t,e,i),Fl(t,e,i))},enqueueReplaceState:function(e,t,r){e=e._reactInternals;var i=Gr(),u=mi(i);u.tag=1,u.payload=t,r!=null&&(u.callback=r),t=fi(e,u,i),t!==null&&($r(t,e,i),Fl(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var r=Gr(),i=mi(r);i.tag=2,t!=null&&(i.callback=t),t=fi(e,i,r),t!==null&&($r(t,e,r),Fl(t,e,r))}};function mh(e,t,r,i,u,c,f){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(i,c,f):t.prototype&&t.prototype.isPureReactComponent?!bl(r,i)||!bl(u,c):!0}function fh(e,t,r,i){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(r,i),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(r,i),t.state!==e&&_d.enqueueReplaceState(t,t.state,null)}function Ji(e,t){var r=t;if("ref"in t){r={};for(var i in t)i!=="ref"&&(r[i]=t[i])}if(e=e.defaultProps){r===t&&(r=S({},r));for(var u in e)r[u]===void 0&&(r[u]=e[u])}return r}function ph(e){Is(e)}function hh(e){console.error(e)}function vh(e){Is(e)}function cu(e,t){try{var r=e.onUncaughtError;r(t.value,{componentStack:t.stack})}catch(i){setTimeout(function(){throw i})}}function gh(e,t,r){try{var i=e.onCaughtError;i(r.value,{componentStack:r.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(u){setTimeout(function(){throw u})}}function Td(e,t,r){return r=mi(r),r.tag=3,r.payload={element:null},r.callback=function(){cu(e,t)},r}function bh(e){return e=mi(e),e.tag=3,e}function yh(e,t,r,i){var u=r.type.getDerivedStateFromError;if(typeof u=="function"){var c=i.value;e.payload=function(){return u(c)},e.callback=function(){gh(t,r,i)}}var f=r.stateNode;f!==null&&typeof f.componentDidCatch=="function"&&(e.callback=function(){gh(t,r,i),typeof u!="function"&&(yi===null?yi=new Set([this]):yi.add(this));var y=i.stack;this.componentDidCatch(i.value,{componentStack:y!==null?y:""})})}function sy(e,t,r,i,u){if(r.flags|=32768,i!==null&&typeof i=="object"&&typeof i.then=="function"){if(t=r.alternate,t!==null&&Co(t,r,u,!0),r=Zr.current,r!==null){switch(r.tag){case 31:case 13:return va===null?Eu():r.alternate===null&&Jn===0&&(Jn=3),r.flags&=-257,r.flags|=65536,r.lanes=u,i===Ys?r.flags|=16384:(t=r.updateQueue,t===null?r.updateQueue=new Set([i]):t.add(i),rm(e,i,u)),!1;case 22:return r.flags|=65536,i===Ys?r.flags|=16384:(t=r.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([i])},r.updateQueue=t):(r=t.retryQueue,r===null?t.retryQueue=new Set([i]):r.add(i)),rm(e,i,u)),!1}throw Error(s(435,r.tag))}return rm(e,i,u),Eu(),!1}if(yn)return t=Zr.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=u,i!==Yc&&(e=Error(s(422),{cause:i}),wl(aa(e,r)))):(i!==Yc&&(t=Error(s(423),{cause:i}),wl(aa(t,r))),e=e.current.alternate,e.flags|=65536,u&=-u,e.lanes|=u,i=aa(i,r),u=Td(e.stateNode,i,u),sd(e,u),Jn!==4&&(Jn=2)),!1;var c=Error(s(520),{cause:i});if(c=aa(c,r),Rl===null?Rl=[c]:Rl.push(c),Jn!==4&&(Jn=2),t===null)return!0;i=aa(i,r),r=t;do{switch(r.tag){case 3:return r.flags|=65536,e=u&-u,r.lanes|=e,e=Td(r.stateNode,i,e),sd(r,e),!1;case 1:if(t=r.type,c=r.stateNode,(r.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||c!==null&&typeof c.componentDidCatch=="function"&&(yi===null||!yi.has(c))))return r.flags|=65536,u&=-u,r.lanes|=u,u=bh(u),yh(u,e,r,i),sd(r,u),!1}r=r.return}while(r!==null);return!1}var Bd=Error(s(461)),lr=!1;function Er(e,t,r,i){t.child=e===null?kp(t,null,r,i):Gi(t,e.child,r,i)}function xh(e,t,r,i,u){r=r.render;var c=t.ref;if("ref"in i){var f={};for(var y in i)y!=="ref"&&(f[y]=i[y])}else f=i;return Zi(t),i=pd(e,t,r,f,c,u),y=hd(),e!==null&&!lr?(vd(e,t,u),Za(e,t,u)):(yn&&y&&Kc(t),t.flags|=1,Er(e,t,i,u),t.child)}function wh(e,t,r,i,u){if(e===null){var c=r.type;return typeof c=="function"&&!Zc(c)&&c.defaultProps===void 0&&r.compare===null?(t.tag=15,t.type=c,Eh(e,t,c,i,u)):(e=qs(r.type,null,i,t,t.mode,u),e.ref=t.ref,e.return=t,t.child=e)}if(c=e.child,!Id(e,u)){var f=c.memoizedProps;if(r=r.compare,r=r!==null?r:bl,r(f,i)&&e.ref===t.ref)return Za(e,t,u)}return t.flags|=1,e=Ra(c,i),e.ref=t.ref,e.return=t,t.child=e}function Eh(e,t,r,i,u){if(e!==null){var c=e.memoizedProps;if(bl(c,i)&&e.ref===t.ref)if(lr=!1,t.pendingProps=i=c,Id(e,u))(e.flags&131072)!==0&&(lr=!0);else return t.lanes=e.lanes,Za(e,t,u)}return Dd(e,t,r,i,u)}function kh(e,t,r,i){var u=i.children,c=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.mode==="hidden"){if((t.flags&128)!==0){if(c=c!==null?c.baseLanes|r:r,e!==null){for(i=t.child=e.child,u=0;i!==null;)u=u|i.lanes|i.childLanes,i=i.sibling;i=u&~c}else i=0,t.child=null;return Ch(e,t,c,r,i)}if((r&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ks(t,c!==null?c.cachePool:null),c!==null?Fp(t,c):cd(),Mp(t);else return i=t.lanes=536870912,Ch(e,t,c!==null?c.baseLanes|r:r,r,i)}else c!==null?(Ks(t,c.cachePool),Fp(t,c),hi(),t.memoizedState=null):(e!==null&&Ks(t,null),cd(),hi());return Er(e,t,u,r),t.child}function Bl(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Ch(e,t,r,i,u){var c=ad();return c=c===null?null:{parent:ir._currentValue,pool:c},t.memoizedState={baseLanes:r,cachePool:c},e!==null&&Ks(t,null),cd(),Mp(t),e!==null&&Co(e,t,i,!0),t.childLanes=u,null}function du(e,t){return t=fu({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Sh(e,t,r){return Gi(t,e.child,null,r),e=du(t,t.pendingProps),e.flags|=2,Ur(t),t.memoizedState=null,e}function uy(e,t,r){var i=t.pendingProps,u=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(yn){if(i.mode==="hidden")return e=du(t,i),t.lanes=536870912,Bl(null,e);if(md(t),(e=Vn)?(e=$v(e,la),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:li!==null?{id:Ca,overflow:Sa}:null,retryLane:536870912,hydrationErrors:null},r=sp(e),r.return=t,t.child=r,xr=t,Vn=null)):e=null,e===null)throw ui(t);return t.lanes=536870912,null}return du(t,i)}var c=e.memoizedState;if(c!==null){var f=c.dehydrated;if(md(t),u)if(t.flags&256)t.flags&=-257,t=Sh(e,t,r);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(s(558));else if(lr||Co(e,t,r,!1),u=(r&e.childLanes)!==0,lr||u){if(i=In,i!==null&&(f=Fe(i,r),f!==0&&f!==c.retryLane))throw c.retryLane=f,Hi(e,f),$r(i,e,f),Bd;Eu(),t=Sh(e,t,r)}else e=c.treeContext,Vn=sa(f.nextSibling),xr=t,yn=!0,si=null,la=!1,e!==null&&dp(t,e),t=du(t,i),t.flags|=4096;return t}return e=Ra(e.child,{mode:i.mode,children:i.children}),e.ref=t.ref,t.child=e,e.return=t,e}function mu(e,t){var r=t.ref;if(r===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof r!="function"&&typeof r!="object")throw Error(s(284));(e===null||e.ref!==r)&&(t.flags|=4194816)}}function Dd(e,t,r,i,u){return Zi(t),r=pd(e,t,r,i,void 0,u),i=hd(),e!==null&&!lr?(vd(e,t,u),Za(e,t,u)):(yn&&i&&Kc(t),t.flags|=1,Er(e,t,r,u),t.child)}function Fh(e,t,r,i,u,c){return Zi(t),t.updateQueue=null,r=Ap(t,i,r,u),Lp(e),i=hd(),e!==null&&!lr?(vd(e,t,c),Za(e,t,c)):(yn&&i&&Kc(t),t.flags|=1,Er(e,t,r,c),t.child)}function Mh(e,t,r,i,u){if(Zi(t),t.stateNode===null){var c=xo,f=r.contextType;typeof f=="object"&&f!==null&&(c=wr(f)),c=new r(i,c),t.memoizedState=c.state!==null&&c.state!==void 0?c.state:null,c.updater=_d,t.stateNode=c,c._reactInternals=t,c=t.stateNode,c.props=i,c.state=t.memoizedState,c.refs={},od(t),f=r.contextType,c.context=typeof f=="object"&&f!==null?wr(f):xo,c.state=t.memoizedState,f=r.getDerivedStateFromProps,typeof f=="function"&&(Nd(t,r,f,i),c.state=t.memoizedState),typeof r.getDerivedStateFromProps=="function"||typeof c.getSnapshotBeforeUpdate=="function"||typeof c.UNSAFE_componentWillMount!="function"&&typeof c.componentWillMount!="function"||(f=c.state,typeof c.componentWillMount=="function"&&c.componentWillMount(),typeof c.UNSAFE_componentWillMount=="function"&&c.UNSAFE_componentWillMount(),f!==c.state&&_d.enqueueReplaceState(c,c.state,null),Ll(t,i,c,u),Ml(),c.state=t.memoizedState),typeof c.componentDidMount=="function"&&(t.flags|=4194308),i=!0}else if(e===null){c=t.stateNode;var y=t.memoizedProps,R=Ji(r,y);c.props=R;var he=c.context,ze=r.contextType;f=xo,typeof ze=="object"&&ze!==null&&(f=wr(ze));var Ie=r.getDerivedStateFromProps;ze=typeof Ie=="function"||typeof c.getSnapshotBeforeUpdate=="function",y=t.pendingProps!==y,ze||typeof c.UNSAFE_componentWillReceiveProps!="function"&&typeof c.componentWillReceiveProps!="function"||(y||he!==f)&&fh(t,c,i,f),di=!1;var ye=t.memoizedState;c.state=ye,Ll(t,i,c,u),Ml(),he=t.memoizedState,y||ye!==he||di?(typeof Ie=="function"&&(Nd(t,r,Ie,i),he=t.memoizedState),(R=di||mh(t,r,R,i,ye,he,f))?(ze||typeof c.UNSAFE_componentWillMount!="function"&&typeof c.componentWillMount!="function"||(typeof c.componentWillMount=="function"&&c.componentWillMount(),typeof c.UNSAFE_componentWillMount=="function"&&c.UNSAFE_componentWillMount()),typeof c.componentDidMount=="function"&&(t.flags|=4194308)):(typeof c.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=i,t.memoizedState=he),c.props=i,c.state=he,c.context=f,i=R):(typeof c.componentDidMount=="function"&&(t.flags|=4194308),i=!1)}else{c=t.stateNode,ld(e,t),f=t.memoizedProps,ze=Ji(r,f),c.props=ze,Ie=t.pendingProps,ye=c.context,he=r.contextType,R=xo,typeof he=="object"&&he!==null&&(R=wr(he)),y=r.getDerivedStateFromProps,(he=typeof y=="function"||typeof c.getSnapshotBeforeUpdate=="function")||typeof c.UNSAFE_componentWillReceiveProps!="function"&&typeof c.componentWillReceiveProps!="function"||(f!==Ie||ye!==R)&&fh(t,c,i,R),di=!1,ye=t.memoizedState,c.state=ye,Ll(t,i,c,u),Ml();var Se=t.memoizedState;f!==Ie||ye!==Se||di||e!==null&&e.dependencies!==null&&Us(e.dependencies)?(typeof y=="function"&&(Nd(t,r,y,i),Se=t.memoizedState),(ze=di||mh(t,r,ze,i,ye,Se,R)||e!==null&&e.dependencies!==null&&Us(e.dependencies))?(he||typeof c.UNSAFE_componentWillUpdate!="function"&&typeof c.componentWillUpdate!="function"||(typeof c.componentWillUpdate=="function"&&c.componentWillUpdate(i,Se,R),typeof c.UNSAFE_componentWillUpdate=="function"&&c.UNSAFE_componentWillUpdate(i,Se,R)),typeof c.componentDidUpdate=="function"&&(t.flags|=4),typeof c.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof c.componentDidUpdate!="function"||f===e.memoizedProps&&ye===e.memoizedState||(t.flags|=4),typeof c.getSnapshotBeforeUpdate!="function"||f===e.memoizedProps&&ye===e.memoizedState||(t.flags|=1024),t.memoizedProps=i,t.memoizedState=Se),c.props=i,c.state=Se,c.context=R,i=ze):(typeof c.componentDidUpdate!="function"||f===e.memoizedProps&&ye===e.memoizedState||(t.flags|=4),typeof c.getSnapshotBeforeUpdate!="function"||f===e.memoizedProps&&ye===e.memoizedState||(t.flags|=1024),i=!1)}return c=i,mu(e,t),i=(t.flags&128)!==0,c||i?(c=t.stateNode,r=i&&typeof r.getDerivedStateFromError!="function"?null:c.render(),t.flags|=1,e!==null&&i?(t.child=Gi(t,e.child,null,u),t.child=Gi(t,null,r,u)):Er(e,t,r,u),t.memoizedState=c.state,e=t.child):e=Za(e,t,u),e}function Lh(e,t,r,i){return Wi(),t.flags|=256,Er(e,t,r,i),t.child}var zd={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Pd(e){return{baseLanes:e,cachePool:gp()}}function jd(e,t,r){return e=e!==null?e.childLanes&~r:0,t&&(e|=Kr),e}function Ah(e,t,r){var i=t.pendingProps,u=!1,c=(t.flags&128)!==0,f;if((f=c)||(f=e!==null&&e.memoizedState===null?!1:(er.current&2)!==0),f&&(u=!0,t.flags&=-129),f=(t.flags&32)!==0,t.flags&=-33,e===null){if(yn){if(u?pi(t):hi(),(e=Vn)?(e=$v(e,la),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:li!==null?{id:Ca,overflow:Sa}:null,retryLane:536870912,hydrationErrors:null},r=sp(e),r.return=t,t.child=r,xr=t,Vn=null)):e=null,e===null)throw ui(t);return gm(e)?t.lanes=32:t.lanes=536870912,null}var y=i.children;return i=i.fallback,u?(hi(),u=t.mode,y=fu({mode:"hidden",children:y},u),i=Vi(i,u,r,null),y.return=t,i.return=t,y.sibling=i,t.child=y,i=t.child,i.memoizedState=Pd(r),i.childLanes=jd(e,f,r),t.memoizedState=zd,Bl(null,i)):(pi(t),Od(t,y))}var R=e.memoizedState;if(R!==null&&(y=R.dehydrated,y!==null)){if(c)t.flags&256?(pi(t),t.flags&=-257,t=$d(e,t,r)):t.memoizedState!==null?(hi(),t.child=e.child,t.flags|=128,t=null):(hi(),y=i.fallback,u=t.mode,i=fu({mode:"visible",children:i.children},u),y=Vi(y,u,r,null),y.flags|=2,i.return=t,y.return=t,i.sibling=y,t.child=i,Gi(t,e.child,null,r),i=t.child,i.memoizedState=Pd(r),i.childLanes=jd(e,f,r),t.memoizedState=zd,t=Bl(null,i));else if(pi(t),gm(y)){if(f=y.nextSibling&&y.nextSibling.dataset,f)var he=f.dgst;f=he,i=Error(s(419)),i.stack="",i.digest=f,wl({value:i,source:null,stack:null}),t=$d(e,t,r)}else if(lr||Co(e,t,r,!1),f=(r&e.childLanes)!==0,lr||f){if(f=In,f!==null&&(i=Fe(f,r),i!==0&&i!==R.retryLane))throw R.retryLane=i,Hi(e,i),$r(f,e,i),Bd;vm(y)||Eu(),t=$d(e,t,r)}else vm(y)?(t.flags|=192,t.child=e.child,t=null):(e=R.treeContext,Vn=sa(y.nextSibling),xr=t,yn=!0,si=null,la=!1,e!==null&&dp(t,e),t=Od(t,i.children),t.flags|=4096);return t}return u?(hi(),y=i.fallback,u=t.mode,R=e.child,he=R.sibling,i=Ra(R,{mode:"hidden",children:i.children}),i.subtreeFlags=R.subtreeFlags&65011712,he!==null?y=Ra(he,y):(y=Vi(y,u,r,null),y.flags|=2),y.return=t,i.return=t,i.sibling=y,t.child=i,Bl(null,i),i=t.child,y=e.child.memoizedState,y===null?y=Pd(r):(u=y.cachePool,u!==null?(R=ir._currentValue,u=u.parent!==R?{parent:R,pool:R}:u):u=gp(),y={baseLanes:y.baseLanes|r,cachePool:u}),i.memoizedState=y,i.childLanes=jd(e,f,r),t.memoizedState=zd,Bl(e.child,i)):(pi(t),r=e.child,e=r.sibling,r=Ra(r,{mode:"visible",children:i.children}),r.return=t,r.sibling=null,e!==null&&(f=t.deletions,f===null?(t.deletions=[e],t.flags|=16):f.push(e)),t.child=r,t.memoizedState=null,r)}function Od(e,t){return t=fu({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function fu(e,t){return e=qr(22,e,null,t),e.lanes=0,e}function $d(e,t,r){return Gi(t,e.child,null,r),e=Od(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Nh(e,t,r){e.lanes|=t;var i=e.alternate;i!==null&&(i.lanes|=t),ed(e.return,t,r)}function Rd(e,t,r,i,u,c){var f=e.memoizedState;f===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:i,tail:r,tailMode:u,treeForkCount:c}:(f.isBackwards=t,f.rendering=null,f.renderingStartTime=0,f.last=i,f.tail=r,f.tailMode=u,f.treeForkCount=c)}function _h(e,t,r){var i=t.pendingProps,u=i.revealOrder,c=i.tail;i=i.children;var f=er.current,y=(f&2)!==0;if(y?(f=f&1|2,t.flags|=128):f&=1,j(er,f),Er(e,t,i,r),i=yn?xl:0,!y&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Nh(e,r,t);else if(e.tag===19)Nh(e,r,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(u){case"forwards":for(r=t.child,u=null;r!==null;)e=r.alternate,e!==null&&tu(e)===null&&(u=r),r=r.sibling;r=u,r===null?(u=t.child,t.child=null):(u=r.sibling,r.sibling=null),Rd(t,!1,u,r,c,i);break;case"backwards":case"unstable_legacy-backwards":for(r=null,u=t.child,t.child=null;u!==null;){if(e=u.alternate,e!==null&&tu(e)===null){t.child=u;break}e=u.sibling,u.sibling=r,r=u,u=e}Rd(t,!0,r,null,c,i);break;case"together":Rd(t,!1,null,null,void 0,i);break;default:t.memoizedState=null}return t.child}function Za(e,t,r){if(e!==null&&(t.dependencies=e.dependencies),bi|=t.lanes,(r&t.childLanes)===0)if(e!==null){if(Co(e,t,r,!1),(r&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(s(153));if(t.child!==null){for(e=t.child,r=Ra(e,e.pendingProps),t.child=r,r.return=t;e.sibling!==null;)e=e.sibling,r=r.sibling=Ra(e,e.pendingProps),r.return=t;r.sibling=null}return t.child}function Id(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Us(e)))}function cy(e,t,r){switch(t.tag){case 3:te(t,t.stateNode.containerInfo),ci(t,ir,e.memoizedState.cache),Wi();break;case 27:case 5:xe(t);break;case 4:te(t,t.stateNode.containerInfo);break;case 10:ci(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,md(t),null;break;case 13:var i=t.memoizedState;if(i!==null)return i.dehydrated!==null?(pi(t),t.flags|=128,null):(r&t.child.childLanes)!==0?Ah(e,t,r):(pi(t),e=Za(e,t,r),e!==null?e.sibling:null);pi(t);break;case 19:var u=(e.flags&128)!==0;if(i=(r&t.childLanes)!==0,i||(Co(e,t,r,!1),i=(r&t.childLanes)!==0),u){if(i)return _h(e,t,r);t.flags|=128}if(u=t.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),j(er,er.current),i)break;return null;case 22:return t.lanes=0,kh(e,t,r,t.pendingProps);case 24:ci(t,ir,e.memoizedState.cache)}return Za(e,t,r)}function Th(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps)lr=!0;else{if(!Id(e,r)&&(t.flags&128)===0)return lr=!1,cy(e,t,r);lr=(e.flags&131072)!==0}else lr=!1,yn&&(t.flags&1048576)!==0&&cp(t,xl,t.index);switch(t.lanes=0,t.tag){case 16:e:{var i=t.pendingProps;if(e=Xi(t.elementType),t.type=e,typeof e=="function")Zc(e)?(i=Ji(e,i),t.tag=1,t=Mh(null,t,e,i,r)):(t.tag=0,t=Dd(null,t,e,i,r));else{if(e!=null){var u=e.$$typeof;if(u===Ae){t.tag=11,t=xh(null,t,e,i,r);break e}else if(u===k){t.tag=14,t=wh(null,t,e,i,r);break e}}throw t=O(e)||e,Error(s(306,t,""))}}return t;case 0:return Dd(e,t,t.type,t.pendingProps,r);case 1:return i=t.type,u=Ji(i,t.pendingProps),Mh(e,t,i,u,r);case 3:e:{if(te(t,t.stateNode.containerInfo),e===null)throw Error(s(387));i=t.pendingProps;var c=t.memoizedState;u=c.element,ld(e,t),Ll(t,i,null,r);var f=t.memoizedState;if(i=f.cache,ci(t,ir,i),i!==c.cache&&td(t,[ir],r,!0),Ml(),i=f.element,c.isDehydrated)if(c={element:i,isDehydrated:!1,cache:f.cache},t.updateQueue.baseState=c,t.memoizedState=c,t.flags&256){t=Lh(e,t,i,r);break e}else if(i!==u){u=aa(Error(s(424)),t),wl(u),t=Lh(e,t,i,r);break e}else for(e=t.stateNode.containerInfo,e.nodeType===9?e=e.body:e=e.nodeName==="HTML"?e.ownerDocument.body:e,Vn=sa(e.firstChild),xr=t,yn=!0,si=null,la=!0,r=kp(t,null,i,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(Wi(),i===u){t=Za(e,t,r);break e}Er(e,t,i,r)}t=t.child}return t;case 26:return mu(e,t),e===null?(r=qv(t.type,null,t.pendingProps,null))?t.memoizedState=r:yn||(r=t.type,e=t.pendingProps,i=_u(De.current).createElement(r),i[at]=t,i[Ke]=e,kr(i,r,e),fn(i),t.stateNode=i):t.memoizedState=qv(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return xe(t),e===null&&yn&&(i=t.stateNode=Hv(t.type,t.pendingProps,De.current),xr=t,la=!0,u=Vn,ki(t.type)?(bm=u,Vn=sa(i.firstChild)):Vn=u),Er(e,t,t.pendingProps.children,r),mu(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&yn&&((u=i=Vn)&&(i=Oy(i,t.type,t.pendingProps,la),i!==null?(t.stateNode=i,xr=t,Vn=sa(i.firstChild),la=!1,u=!0):u=!1),u||ui(t)),xe(t),u=t.type,c=t.pendingProps,f=e!==null?e.memoizedProps:null,i=c.children,fm(u,c)?i=null:f!==null&&fm(u,f)&&(t.flags|=32),t.memoizedState!==null&&(u=pd(e,t,ty,null,null,r),Xl._currentValue=u),mu(e,t),Er(e,t,i,r),t.child;case 6:return e===null&&yn&&((e=r=Vn)&&(r=$y(r,t.pendingProps,la),r!==null?(t.stateNode=r,xr=t,Vn=null,e=!0):e=!1),e||ui(t)),null;case 13:return Ah(e,t,r);case 4:return te(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Gi(t,null,i,r):Er(e,t,i,r),t.child;case 11:return xh(e,t,t.type,t.pendingProps,r);case 7:return Er(e,t,t.pendingProps,r),t.child;case 8:return Er(e,t,t.pendingProps.children,r),t.child;case 12:return Er(e,t,t.pendingProps.children,r),t.child;case 10:return i=t.pendingProps,ci(t,t.type,i.value),Er(e,t,i.children,r),t.child;case 9:return u=t.type._context,i=t.pendingProps.children,Zi(t),u=wr(u),i=i(u),t.flags|=1,Er(e,t,i,r),t.child;case 14:return wh(e,t,t.type,t.pendingProps,r);case 15:return Eh(e,t,t.type,t.pendingProps,r);case 19:return _h(e,t,r);case 31:return uy(e,t,r);case 22:return kh(e,t,r,t.pendingProps);case 24:return Zi(t),i=wr(ir),e===null?(u=ad(),u===null&&(u=In,c=nd(),u.pooledCache=c,c.refCount++,c!==null&&(u.pooledCacheLanes|=r),u=c),t.memoizedState={parent:i,cache:u},od(t),ci(t,ir,u)):((e.lanes&r)!==0&&(ld(e,t),Ll(t,null,null,r),Ml()),u=e.memoizedState,c=t.memoizedState,u.parent!==i?(u={parent:i,cache:i},t.memoizedState=u,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=u),ci(t,ir,i)):(i=c.cache,ci(t,ir,i),i!==u.cache&&td(t,[ir],r,!0))),Er(e,t,t.pendingProps.children,r),t.child;case 29:throw t.pendingProps}throw Error(s(156,t.tag))}function Ua(e){e.flags|=4}function Hd(e,t,r,i,u){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(u&335544128)===u)if(e.stateNode.complete)e.flags|=8192;else if(iv())e.flags|=8192;else throw Ki=Ys,id}else e.flags&=-16777217}function Bh(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Gv(t))if(iv())e.flags|=8192;else throw Ki=Ys,id}function pu(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?fe():536870912,e.lanes|=t,Po|=t)}function Dl(e,t){if(!yn)switch(e.tailMode){case"hidden":t=e.tail;for(var r=null;t!==null;)t.alternate!==null&&(r=t),t=t.sibling;r===null?e.tail=null:r.sibling=null;break;case"collapsed":r=e.tail;for(var i=null;r!==null;)r.alternate!==null&&(i=r),r=r.sibling;i===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:i.sibling=null}}function Wn(e){var t=e.alternate!==null&&e.alternate.child===e.child,r=0,i=0;if(t)for(var u=e.child;u!==null;)r|=u.lanes|u.childLanes,i|=u.subtreeFlags&65011712,i|=u.flags&65011712,u.return=e,u=u.sibling;else for(u=e.child;u!==null;)r|=u.lanes|u.childLanes,i|=u.subtreeFlags,i|=u.flags,u.return=e,u=u.sibling;return e.subtreeFlags|=i,e.childLanes=r,t}function dy(e,t,r){var i=t.pendingProps;switch(Gc(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Wn(t),null;case 1:return Wn(t),null;case 3:return r=t.stateNode,i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),Va(ir),U(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(ko(t)?Ua(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Jc())),Wn(t),null;case 26:var u=t.type,c=t.memoizedState;return e===null?(Ua(t),c!==null?(Wn(t),Bh(t,c)):(Wn(t),Hd(t,u,null,i,r))):c?c!==e.memoizedState?(Ua(t),Wn(t),Bh(t,c)):(Wn(t),t.flags&=-16777217):(e=e.memoizedProps,e!==i&&Ua(t),Wn(t),Hd(t,u,e,i,r)),null;case 27:if(Ce(t),r=De.current,u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&Ua(t);else{if(!i){if(t.stateNode===null)throw Error(s(166));return Wn(t),null}e=B.current,ko(t)?mp(t):(e=Hv(u,i,r),t.stateNode=e,Ua(t))}return Wn(t),null;case 5:if(Ce(t),u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&Ua(t);else{if(!i){if(t.stateNode===null)throw Error(s(166));return Wn(t),null}if(c=B.current,ko(t))mp(t);else{var f=_u(De.current);switch(c){case 1:c=f.createElementNS("http://www.w3.org/2000/svg",u);break;case 2:c=f.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;default:switch(u){case"svg":c=f.createElementNS("http://www.w3.org/2000/svg",u);break;case"math":c=f.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;case"script":c=f.createElement("div"),c.innerHTML="<script><\/script>",c=c.removeChild(c.firstChild);break;case"select":c=typeof i.is=="string"?f.createElement("select",{is:i.is}):f.createElement("select"),i.multiple?c.multiple=!0:i.size&&(c.size=i.size);break;default:c=typeof i.is=="string"?f.createElement(u,{is:i.is}):f.createElement(u)}}c[at]=t,c[Ke]=i;e:for(f=t.child;f!==null;){if(f.tag===5||f.tag===6)c.appendChild(f.stateNode);else if(f.tag!==4&&f.tag!==27&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===t)break e;for(;f.sibling===null;){if(f.return===null||f.return===t)break e;f=f.return}f.sibling.return=f.return,f=f.sibling}t.stateNode=c;e:switch(kr(c,u,i),u){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}i&&Ua(t)}}return Wn(t),Hd(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,r),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==i&&Ua(t);else{if(typeof i!="string"&&t.stateNode===null)throw Error(s(166));if(e=De.current,ko(t)){if(e=t.stateNode,r=t.memoizedProps,i=null,u=xr,u!==null)switch(u.tag){case 27:case 5:i=u.memoizedProps}e[at]=t,e=!!(e.nodeValue===r||i!==null&&i.suppressHydrationWarning===!0||_v(e.nodeValue,r)),e||ui(t,!0)}else e=_u(e).createTextNode(i),e[at]=t,t.stateNode=e}return Wn(t),null;case 31:if(r=t.memoizedState,e===null||e.memoizedState!==null){if(i=ko(t),r!==null){if(e===null){if(!i)throw Error(s(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(557));e[at]=t}else Wi(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Wn(t),e=!1}else r=Jc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),e=!0;if(!e)return t.flags&256?(Ur(t),t):(Ur(t),null);if((t.flags&128)!==0)throw Error(s(558))}return Wn(t),null;case 13:if(i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(u=ko(t),i!==null&&i.dehydrated!==null){if(e===null){if(!u)throw Error(s(318));if(u=t.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(s(317));u[at]=t}else Wi(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Wn(t),u=!1}else u=Jc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=u),u=!0;if(!u)return t.flags&256?(Ur(t),t):(Ur(t),null)}return Ur(t),(t.flags&128)!==0?(t.lanes=r,t):(r=i!==null,e=e!==null&&e.memoizedState!==null,r&&(i=t.child,u=null,i.alternate!==null&&i.alternate.memoizedState!==null&&i.alternate.memoizedState.cachePool!==null&&(u=i.alternate.memoizedState.cachePool.pool),c=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(c=i.memoizedState.cachePool.pool),c!==u&&(i.flags|=2048)),r!==e&&r&&(t.child.flags|=8192),pu(t,t.updateQueue),Wn(t),null);case 4:return U(),e===null&&sm(t.stateNode.containerInfo),Wn(t),null;case 10:return Va(t.type),Wn(t),null;case 19:if(C(er),i=t.memoizedState,i===null)return Wn(t),null;if(u=(t.flags&128)!==0,c=i.rendering,c===null)if(u)Dl(i,!1);else{if(Jn!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(c=tu(e),c!==null){for(t.flags|=128,Dl(i,!1),e=c.updateQueue,t.updateQueue=e,pu(t,e),t.subtreeFlags=0,e=r,r=t.child;r!==null;)lp(r,e),r=r.sibling;return j(er,er.current&1|2),yn&&Ia(t,i.treeForkCount),t.child}e=e.sibling}i.tail!==null&&Ge()>yu&&(t.flags|=128,u=!0,Dl(i,!1),t.lanes=4194304)}else{if(!u)if(e=tu(c),e!==null){if(t.flags|=128,u=!0,e=e.updateQueue,t.updateQueue=e,pu(t,e),Dl(i,!0),i.tail===null&&i.tailMode==="hidden"&&!c.alternate&&!yn)return Wn(t),null}else 2*Ge()-i.renderingStartTime>yu&&r!==536870912&&(t.flags|=128,u=!0,Dl(i,!1),t.lanes=4194304);i.isBackwards?(c.sibling=t.child,t.child=c):(e=i.last,e!==null?e.sibling=c:t.child=c,i.last=c)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=Ge(),e.sibling=null,r=er.current,j(er,u?r&1|2:r&1),yn&&Ia(t,i.treeForkCount),e):(Wn(t),null);case 22:case 23:return Ur(t),dd(),i=t.memoizedState!==null,e!==null?e.memoizedState!==null!==i&&(t.flags|=8192):i&&(t.flags|=8192),i?(r&536870912)!==0&&(t.flags&128)===0&&(Wn(t),t.subtreeFlags&6&&(t.flags|=8192)):Wn(t),r=t.updateQueue,r!==null&&pu(t,r.retryQueue),r=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(r=e.memoizedState.cachePool.pool),i=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),i!==r&&(t.flags|=2048),e!==null&&C(Ui),null;case 24:return r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Va(ir),Wn(t),null;case 25:return null;case 30:return null}throw Error(s(156,t.tag))}function my(e,t){switch(Gc(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Va(ir),U(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Ce(t),null;case 31:if(t.memoizedState!==null){if(Ur(t),t.alternate===null)throw Error(s(340));Wi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Ur(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(s(340));Wi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return C(er),null;case 4:return U(),null;case 10:return Va(t.type),null;case 22:case 23:return Ur(t),dd(),e!==null&&C(Ui),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Va(ir),null;case 25:return null;default:return null}}function Dh(e,t){switch(Gc(t),t.tag){case 3:Va(ir),U();break;case 26:case 27:case 5:Ce(t);break;case 4:U();break;case 31:t.memoizedState!==null&&Ur(t);break;case 13:Ur(t);break;case 19:C(er);break;case 10:Va(t.type);break;case 22:case 23:Ur(t),dd(),e!==null&&C(Ui);break;case 24:Va(ir)}}function zl(e,t){try{var r=t.updateQueue,i=r!==null?r.lastEffect:null;if(i!==null){var u=i.next;r=u;do{if((r.tag&e)===e){i=void 0;var c=r.create,f=r.inst;i=c(),f.destroy=i}r=r.next}while(r!==u)}}catch(y){Dn(t,t.return,y)}}function vi(e,t,r){try{var i=t.updateQueue,u=i!==null?i.lastEffect:null;if(u!==null){var c=u.next;i=c;do{if((i.tag&e)===e){var f=i.inst,y=f.destroy;if(y!==void 0){f.destroy=void 0,u=t;var R=r,he=y;try{he()}catch(ze){Dn(u,R,ze)}}}i=i.next}while(i!==c)}}catch(ze){Dn(t,t.return,ze)}}function zh(e){var t=e.updateQueue;if(t!==null){var r=e.stateNode;try{Sp(t,r)}catch(i){Dn(e,e.return,i)}}}function Ph(e,t,r){r.props=Ji(e.type,e.memoizedProps),r.state=e.memoizedState;try{r.componentWillUnmount()}catch(i){Dn(e,t,i)}}function Pl(e,t){try{var r=e.ref;if(r!==null){switch(e.tag){case 26:case 27:case 5:var i=e.stateNode;break;case 30:i=e.stateNode;break;default:i=e.stateNode}typeof r=="function"?e.refCleanup=r(i):r.current=i}}catch(u){Dn(e,t,u)}}function Fa(e,t){var r=e.ref,i=e.refCleanup;if(r!==null)if(typeof i=="function")try{i()}catch(u){Dn(e,t,u)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof r=="function")try{r(null)}catch(u){Dn(e,t,u)}else r.current=null}function jh(e){var t=e.type,r=e.memoizedProps,i=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":r.autoFocus&&i.focus();break e;case"img":r.src?i.src=r.src:r.srcSet&&(i.srcset=r.srcSet)}}catch(u){Dn(e,e.return,u)}}function Vd(e,t,r){try{var i=e.stateNode;Ty(i,e.type,r,t),i[Ke]=t}catch(u){Dn(e,e.return,u)}}function Oh(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&ki(e.type)||e.tag===4}function Wd(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Oh(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&ki(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function qd(e,t,r){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r).insertBefore(e,t):(t=r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,t.appendChild(e),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=ar));else if(i!==4&&(i===27&&ki(e.type)&&(r=e.stateNode,t=null),e=e.child,e!==null))for(qd(e,t,r),e=e.sibling;e!==null;)qd(e,t,r),e=e.sibling}function hu(e,t,r){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(i!==4&&(i===27&&ki(e.type)&&(r=e.stateNode),e=e.child,e!==null))for(hu(e,t,r),e=e.sibling;e!==null;)hu(e,t,r),e=e.sibling}function $h(e){var t=e.stateNode,r=e.memoizedProps;try{for(var i=e.type,u=t.attributes;u.length;)t.removeAttributeNode(u[0]);kr(t,i,r),t[at]=e,t[Ke]=r}catch(c){Dn(e,e.return,c)}}var Xa=!1,sr=!1,Zd=!1,Rh=typeof WeakSet=="function"?WeakSet:Set,vr=null;function fy(e,t){if(e=e.containerInfo,dm=Ou,e=Jf(e),$c(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var i=r.getSelection&&r.getSelection();if(i&&i.rangeCount!==0){r=i.anchorNode;var u=i.anchorOffset,c=i.focusNode;i=i.focusOffset;try{r.nodeType,c.nodeType}catch{r=null;break e}var f=0,y=-1,R=-1,he=0,ze=0,Ie=e,ye=null;t:for(;;){for(var Se;Ie!==r||u!==0&&Ie.nodeType!==3||(y=f+u),Ie!==c||i!==0&&Ie.nodeType!==3||(R=f+i),Ie.nodeType===3&&(f+=Ie.nodeValue.length),(Se=Ie.firstChild)!==null;)ye=Ie,Ie=Se;for(;;){if(Ie===e)break t;if(ye===r&&++he===u&&(y=f),ye===c&&++ze===i&&(R=f),(Se=Ie.nextSibling)!==null)break;Ie=ye,ye=Ie.parentNode}Ie=Se}r=y===-1||R===-1?null:{start:y,end:R}}else r=null}r=r||{start:0,end:0}}else r=null;for(mm={focusedElem:e,selectionRange:r},Ou=!1,vr=t;vr!==null;)if(t=vr,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,vr=e;else for(;vr!==null;){switch(t=vr,c=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(r=0;r<e.length;r++)u=e[r],u.ref.impl=u.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&c!==null){e=void 0,r=t,u=c.memoizedProps,c=c.memoizedState,i=r.stateNode;try{var At=Ji(r.type,u);e=i.getSnapshotBeforeUpdate(At,c),i.__reactInternalSnapshotBeforeUpdate=e}catch(Gt){Dn(r,r.return,Gt)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,r=e.nodeType,r===9)hm(e);else if(r===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":hm(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(s(163))}if(e=t.sibling,e!==null){e.return=t.return,vr=e;break}vr=t.return}}function Ih(e,t,r){var i=r.flags;switch(r.tag){case 0:case 11:case 15:Ga(e,r),i&4&&zl(5,r);break;case 1:if(Ga(e,r),i&4)if(e=r.stateNode,t===null)try{e.componentDidMount()}catch(f){Dn(r,r.return,f)}else{var u=Ji(r.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(u,t,e.__reactInternalSnapshotBeforeUpdate)}catch(f){Dn(r,r.return,f)}}i&64&&zh(r),i&512&&Pl(r,r.return);break;case 3:if(Ga(e,r),i&64&&(e=r.updateQueue,e!==null)){if(t=null,r.child!==null)switch(r.child.tag){case 27:case 5:t=r.child.stateNode;break;case 1:t=r.child.stateNode}try{Sp(e,t)}catch(f){Dn(r,r.return,f)}}break;case 27:t===null&&i&4&&$h(r);case 26:case 5:Ga(e,r),t===null&&i&4&&jh(r),i&512&&Pl(r,r.return);break;case 12:Ga(e,r);break;case 31:Ga(e,r),i&4&&Wh(e,r);break;case 13:Ga(e,r),i&4&&qh(e,r),i&64&&(e=r.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(r=Ey.bind(null,r),Ry(e,r))));break;case 22:if(i=r.memoizedState!==null||Xa,!i){t=t!==null&&t.memoizedState!==null||sr,u=Xa;var c=sr;Xa=i,(sr=t)&&!c?Ya(e,r,(r.subtreeFlags&8772)!==0):Ga(e,r),Xa=u,sr=c}break;case 30:break;default:Ga(e,r)}}function Hh(e){var t=e.alternate;t!==null&&(e.alternate=null,Hh(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&pn(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Un=null,zr=!1;function Ka(e,t,r){for(r=r.child;r!==null;)Vh(e,t,r),r=r.sibling}function Vh(e,t,r){if(Mt&&typeof Mt.onCommitFiberUnmount=="function")try{Mt.onCommitFiberUnmount(pt,r)}catch{}switch(r.tag){case 26:sr||Fa(r,t),Ka(e,t,r),r.memoizedState?r.memoizedState.count--:r.stateNode&&(r=r.stateNode,r.parentNode.removeChild(r));break;case 27:sr||Fa(r,t);var i=Un,u=zr;ki(r.type)&&(Un=r.stateNode,zr=!1),Ka(e,t,r),ql(r.stateNode),Un=i,zr=u;break;case 5:sr||Fa(r,t);case 6:if(i=Un,u=zr,Un=null,Ka(e,t,r),Un=i,zr=u,Un!==null)if(zr)try{(Un.nodeType===9?Un.body:Un.nodeName==="HTML"?Un.ownerDocument.body:Un).removeChild(r.stateNode)}catch(c){Dn(r,t,c)}else try{Un.removeChild(r.stateNode)}catch(c){Dn(r,t,c)}break;case 18:Un!==null&&(zr?(e=Un,jv(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,r.stateNode),Wo(e)):jv(Un,r.stateNode));break;case 4:i=Un,u=zr,Un=r.stateNode.containerInfo,zr=!0,Ka(e,t,r),Un=i,zr=u;break;case 0:case 11:case 14:case 15:vi(2,r,t),sr||vi(4,r,t),Ka(e,t,r);break;case 1:sr||(Fa(r,t),i=r.stateNode,typeof i.componentWillUnmount=="function"&&Ph(r,t,i)),Ka(e,t,r);break;case 21:Ka(e,t,r);break;case 22:sr=(i=sr)||r.memoizedState!==null,Ka(e,t,r),sr=i;break;default:Ka(e,t,r)}}function Wh(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Wo(e)}catch(r){Dn(t,t.return,r)}}}function qh(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Wo(e)}catch(r){Dn(t,t.return,r)}}function py(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Rh),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Rh),t;default:throw Error(s(435,e.tag))}}function vu(e,t){var r=py(e);t.forEach(function(i){if(!r.has(i)){r.add(i);var u=ky.bind(null,e,i);i.then(u,u)}})}function Pr(e,t){var r=t.deletions;if(r!==null)for(var i=0;i<r.length;i++){var u=r[i],c=e,f=t,y=f;e:for(;y!==null;){switch(y.tag){case 27:if(ki(y.type)){Un=y.stateNode,zr=!1;break e}break;case 5:Un=y.stateNode,zr=!1;break e;case 3:case 4:Un=y.stateNode.containerInfo,zr=!0;break e}y=y.return}if(Un===null)throw Error(s(160));Vh(c,f,u),Un=null,zr=!1,c=u.alternate,c!==null&&(c.return=null),u.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Zh(t,e),t=t.sibling}var ga=null;function Zh(e,t){var r=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Pr(t,e),jr(e),i&4&&(vi(3,e,e.return),zl(3,e),vi(5,e,e.return));break;case 1:Pr(t,e),jr(e),i&512&&(sr||r===null||Fa(r,r.return)),i&64&&Xa&&(e=e.updateQueue,e!==null&&(i=e.callbacks,i!==null&&(r=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=r===null?i:r.concat(i))));break;case 26:var u=ga;if(Pr(t,e),jr(e),i&512&&(sr||r===null||Fa(r,r.return)),i&4){var c=r!==null?r.memoizedState:null;if(i=e.memoizedState,r===null)if(i===null)if(e.stateNode===null){e:{i=e.type,r=e.memoizedProps,u=u.ownerDocument||u;t:switch(i){case"title":c=u.getElementsByTagName("title")[0],(!c||c[un]||c[at]||c.namespaceURI==="http://www.w3.org/2000/svg"||c.hasAttribute("itemprop"))&&(c=u.createElement(i),u.head.insertBefore(c,u.querySelector("head > title"))),kr(c,i,r),c[at]=e,fn(c),i=c;break e;case"link":var f=Xv("link","href",u).get(i+(r.href||""));if(f){for(var y=0;y<f.length;y++)if(c=f[y],c.getAttribute("href")===(r.href==null||r.href===""?null:r.href)&&c.getAttribute("rel")===(r.rel==null?null:r.rel)&&c.getAttribute("title")===(r.title==null?null:r.title)&&c.getAttribute("crossorigin")===(r.crossOrigin==null?null:r.crossOrigin)){f.splice(y,1);break t}}c=u.createElement(i),kr(c,i,r),u.head.appendChild(c);break;case"meta":if(f=Xv("meta","content",u).get(i+(r.content||""))){for(y=0;y<f.length;y++)if(c=f[y],c.getAttribute("content")===(r.content==null?null:""+r.content)&&c.getAttribute("name")===(r.name==null?null:r.name)&&c.getAttribute("property")===(r.property==null?null:r.property)&&c.getAttribute("http-equiv")===(r.httpEquiv==null?null:r.httpEquiv)&&c.getAttribute("charset")===(r.charSet==null?null:r.charSet)){f.splice(y,1);break t}}c=u.createElement(i),kr(c,i,r),u.head.appendChild(c);break;default:throw Error(s(468,i))}c[at]=e,fn(c),i=c}e.stateNode=i}else Kv(u,e.type,e.stateNode);else e.stateNode=Uv(u,i,e.memoizedProps);else c!==i?(c===null?r.stateNode!==null&&(r=r.stateNode,r.parentNode.removeChild(r)):c.count--,i===null?Kv(u,e.type,e.stateNode):Uv(u,i,e.memoizedProps)):i===null&&e.stateNode!==null&&Vd(e,e.memoizedProps,r.memoizedProps)}break;case 27:Pr(t,e),jr(e),i&512&&(sr||r===null||Fa(r,r.return)),r!==null&&i&4&&Vd(e,e.memoizedProps,r.memoizedProps);break;case 5:if(Pr(t,e),jr(e),i&512&&(sr||r===null||Fa(r,r.return)),e.flags&32){u=e.stateNode;try{ht(u,"")}catch(At){Dn(e,e.return,At)}}i&4&&e.stateNode!=null&&(u=e.memoizedProps,Vd(e,u,r!==null?r.memoizedProps:u)),i&1024&&(Zd=!0);break;case 6:if(Pr(t,e),jr(e),i&4){if(e.stateNode===null)throw Error(s(162));i=e.memoizedProps,r=e.stateNode;try{r.nodeValue=i}catch(At){Dn(e,e.return,At)}}break;case 3:if(Du=null,u=ga,ga=Tu(t.containerInfo),Pr(t,e),ga=u,jr(e),i&4&&r!==null&&r.memoizedState.isDehydrated)try{Wo(t.containerInfo)}catch(At){Dn(e,e.return,At)}Zd&&(Zd=!1,Uh(e));break;case 4:i=ga,ga=Tu(e.stateNode.containerInfo),Pr(t,e),jr(e),ga=i;break;case 12:Pr(t,e),jr(e);break;case 31:Pr(t,e),jr(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,vu(e,i)));break;case 13:Pr(t,e),jr(e),e.child.flags&8192&&e.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(bu=Ge()),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,vu(e,i)));break;case 22:u=e.memoizedState!==null;var R=r!==null&&r.memoizedState!==null,he=Xa,ze=sr;if(Xa=he||u,sr=ze||R,Pr(t,e),sr=ze,Xa=he,jr(e),i&8192)e:for(t=e.stateNode,t._visibility=u?t._visibility&-2:t._visibility|1,u&&(r===null||R||Xa||sr||Qi(e)),r=null,t=e;;){if(t.tag===5||t.tag===26){if(r===null){R=r=t;try{if(c=R.stateNode,u)f=c.style,typeof f.setProperty=="function"?f.setProperty("display","none","important"):f.display="none";else{y=R.stateNode;var Ie=R.memoizedProps.style,ye=Ie!=null&&Ie.hasOwnProperty("display")?Ie.display:null;y.style.display=ye==null||typeof ye=="boolean"?"":(""+ye).trim()}}catch(At){Dn(R,R.return,At)}}}else if(t.tag===6){if(r===null){R=t;try{R.stateNode.nodeValue=u?"":R.memoizedProps}catch(At){Dn(R,R.return,At)}}}else if(t.tag===18){if(r===null){R=t;try{var Se=R.stateNode;u?Ov(Se,!0):Ov(R.stateNode,!1)}catch(At){Dn(R,R.return,At)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;r===t&&(r=null),t=t.return}r===t&&(r=null),t.sibling.return=t.return,t=t.sibling}i&4&&(i=e.updateQueue,i!==null&&(r=i.retryQueue,r!==null&&(i.retryQueue=null,vu(e,r))));break;case 19:Pr(t,e),jr(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,vu(e,i)));break;case 30:break;case 21:break;default:Pr(t,e),jr(e)}}function jr(e){var t=e.flags;if(t&2){try{for(var r,i=e.return;i!==null;){if(Oh(i)){r=i;break}i=i.return}if(r==null)throw Error(s(160));switch(r.tag){case 27:var u=r.stateNode,c=Wd(e);hu(e,c,u);break;case 5:var f=r.stateNode;r.flags&32&&(ht(f,""),r.flags&=-33);var y=Wd(e);hu(e,y,f);break;case 3:case 4:var R=r.stateNode.containerInfo,he=Wd(e);qd(e,he,R);break;default:throw Error(s(161))}}catch(ze){Dn(e,e.return,ze)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Uh(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Uh(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Ga(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Ih(e,t.alternate,t),t=t.sibling}function Qi(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:vi(4,t,t.return),Qi(t);break;case 1:Fa(t,t.return);var r=t.stateNode;typeof r.componentWillUnmount=="function"&&Ph(t,t.return,r),Qi(t);break;case 27:ql(t.stateNode);case 26:case 5:Fa(t,t.return),Qi(t);break;case 22:t.memoizedState===null&&Qi(t);break;case 30:Qi(t);break;default:Qi(t)}e=e.sibling}}function Ya(e,t,r){for(r=r&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var i=t.alternate,u=e,c=t,f=c.flags;switch(c.tag){case 0:case 11:case 15:Ya(u,c,r),zl(4,c);break;case 1:if(Ya(u,c,r),i=c,u=i.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(he){Dn(i,i.return,he)}if(i=c,u=i.updateQueue,u!==null){var y=i.stateNode;try{var R=u.shared.hiddenCallbacks;if(R!==null)for(u.shared.hiddenCallbacks=null,u=0;u<R.length;u++)Cp(R[u],y)}catch(he){Dn(i,i.return,he)}}r&&f&64&&zh(c),Pl(c,c.return);break;case 27:$h(c);case 26:case 5:Ya(u,c,r),r&&i===null&&f&4&&jh(c),Pl(c,c.return);break;case 12:Ya(u,c,r);break;case 31:Ya(u,c,r),r&&f&4&&Wh(u,c);break;case 13:Ya(u,c,r),r&&f&4&&qh(u,c);break;case 22:c.memoizedState===null&&Ya(u,c,r),Pl(c,c.return);break;case 30:break;default:Ya(u,c,r)}t=t.sibling}}function Ud(e,t){var r=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(r=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==r&&(e!=null&&e.refCount++,r!=null&&El(r))}function Xd(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&El(e))}function ba(e,t,r,i){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Xh(e,t,r,i),t=t.sibling}function Xh(e,t,r,i){var u=t.flags;switch(t.tag){case 0:case 11:case 15:ba(e,t,r,i),u&2048&&zl(9,t);break;case 1:ba(e,t,r,i);break;case 3:ba(e,t,r,i),u&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&El(e)));break;case 12:if(u&2048){ba(e,t,r,i),e=t.stateNode;try{var c=t.memoizedProps,f=c.id,y=c.onPostCommit;typeof y=="function"&&y(f,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(R){Dn(t,t.return,R)}}else ba(e,t,r,i);break;case 31:ba(e,t,r,i);break;case 13:ba(e,t,r,i);break;case 23:break;case 22:c=t.stateNode,f=t.alternate,t.memoizedState!==null?c._visibility&2?ba(e,t,r,i):jl(e,t):c._visibility&2?ba(e,t,r,i):(c._visibility|=2,Bo(e,t,r,i,(t.subtreeFlags&10256)!==0||!1)),u&2048&&Ud(f,t);break;case 24:ba(e,t,r,i),u&2048&&Xd(t.alternate,t);break;default:ba(e,t,r,i)}}function Bo(e,t,r,i,u){for(u=u&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var c=e,f=t,y=r,R=i,he=f.flags;switch(f.tag){case 0:case 11:case 15:Bo(c,f,y,R,u),zl(8,f);break;case 23:break;case 22:var ze=f.stateNode;f.memoizedState!==null?ze._visibility&2?Bo(c,f,y,R,u):jl(c,f):(ze._visibility|=2,Bo(c,f,y,R,u)),u&&he&2048&&Ud(f.alternate,f);break;case 24:Bo(c,f,y,R,u),u&&he&2048&&Xd(f.alternate,f);break;default:Bo(c,f,y,R,u)}t=t.sibling}}function jl(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var r=e,i=t,u=i.flags;switch(i.tag){case 22:jl(r,i),u&2048&&Ud(i.alternate,i);break;case 24:jl(r,i),u&2048&&Xd(i.alternate,i);break;default:jl(r,i)}t=t.sibling}}var Ol=8192;function Do(e,t,r){if(e.subtreeFlags&Ol)for(e=e.child;e!==null;)Kh(e,t,r),e=e.sibling}function Kh(e,t,r){switch(e.tag){case 26:Do(e,t,r),e.flags&Ol&&e.memoizedState!==null&&Jy(r,ga,e.memoizedState,e.memoizedProps);break;case 5:Do(e,t,r);break;case 3:case 4:var i=ga;ga=Tu(e.stateNode.containerInfo),Do(e,t,r),ga=i;break;case 22:e.memoizedState===null&&(i=e.alternate,i!==null&&i.memoizedState!==null?(i=Ol,Ol=16777216,Do(e,t,r),Ol=i):Do(e,t,r));break;default:Do(e,t,r)}}function Gh(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function $l(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var r=0;r<t.length;r++){var i=t[r];vr=i,Jh(i,e)}Gh(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Yh(e),e=e.sibling}function Yh(e){switch(e.tag){case 0:case 11:case 15:$l(e),e.flags&2048&&vi(9,e,e.return);break;case 3:$l(e);break;case 12:$l(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,gu(e)):$l(e);break;default:$l(e)}}function gu(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var r=0;r<t.length;r++){var i=t[r];vr=i,Jh(i,e)}Gh(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:vi(8,t,t.return),gu(t);break;case 22:r=t.stateNode,r._visibility&2&&(r._visibility&=-3,gu(t));break;default:gu(t)}e=e.sibling}}function Jh(e,t){for(;vr!==null;){var r=vr;switch(r.tag){case 0:case 11:case 15:vi(8,r,t);break;case 23:case 22:if(r.memoizedState!==null&&r.memoizedState.cachePool!==null){var i=r.memoizedState.cachePool.pool;i!=null&&i.refCount++}break;case 24:El(r.memoizedState.cache)}if(i=r.child,i!==null)i.return=r,vr=i;else e:for(r=e;vr!==null;){i=vr;var u=i.sibling,c=i.return;if(Hh(i),i===r){vr=null;break e}if(u!==null){u.return=c,vr=u;break e}vr=c}}}var hy={getCacheForType:function(e){var t=wr(ir),r=t.data.get(e);return r===void 0&&(r=e(),t.data.set(e,r)),r},cacheSignal:function(){return wr(ir).controller.signal}},vy=typeof WeakMap=="function"?WeakMap:Map,Mn=0,In=null,hn=null,gn=0,Bn=0,Xr=null,gi=!1,zo=!1,Kd=!1,Ja=0,Jn=0,bi=0,eo=0,Gd=0,Kr=0,Po=0,Rl=null,Or=null,Yd=!1,bu=0,Qh=0,yu=1/0,xu=null,yi=null,mr=0,xi=null,jo=null,Qa=0,Jd=0,Qd=null,ev=null,Il=0,em=null;function Gr(){return(Mn&2)!==0&&gn!==0?gn&-gn:M.T!==null?om():ct()}function tv(){if(Kr===0)if((gn&536870912)===0||yn){var e=Tt;Tt<<=1,(Tt&3932160)===0&&(Tt=262144),Kr=e}else Kr=536870912;return e=Zr.current,e!==null&&(e.flags|=32),Kr}function $r(e,t,r){(e===In&&(Bn===2||Bn===9)||e.cancelPendingCommit!==null)&&(Oo(e,0),wi(e,gn,Kr,!1)),Je(e,r),((Mn&2)===0||e!==In)&&(e===In&&((Mn&2)===0&&(eo|=r),Jn===4&&wi(e,gn,Kr,!1)),Ma(e))}function nv(e,t,r){if((Mn&6)!==0)throw Error(s(327));var i=!r&&(t&127)===0&&(t&e.expiredLanes)===0||wn(e,t),u=i?yy(e,t):nm(e,t,!0),c=i;do{if(u===0){zo&&!i&&wi(e,t,0,!1);break}else{if(r=e.current.alternate,c&&!gy(r)){u=nm(e,t,!1),c=!1;continue}if(u===2){if(c=t,e.errorRecoveryDisabledLanes&c)var f=0;else f=e.pendingLanes&-536870913,f=f!==0?f:f&536870912?536870912:0;if(f!==0){t=f;e:{var y=e;u=Rl;var R=y.current.memoizedState.isDehydrated;if(R&&(Oo(y,f).flags|=256),f=nm(y,f,!1),f!==2){if(Kd&&!R){y.errorRecoveryDisabledLanes|=c,eo|=c,u=4;break e}c=Or,Or=u,c!==null&&(Or===null?Or=c:Or.push.apply(Or,c))}u=f}if(c=!1,u!==2)continue}}if(u===1){Oo(e,0),wi(e,t,0,!0);break}e:{switch(i=e,c=u,c){case 0:case 1:throw Error(s(345));case 4:if((t&4194048)!==t)break;case 6:wi(i,t,Kr,!gi);break e;case 2:Or=null;break;case 3:case 5:break;default:throw Error(s(329))}if((t&62914560)===t&&(u=bu+300-Ge(),10<u)){if(wi(i,t,Kr,!gi),nn(i,0,!0)!==0)break e;Qa=t,i.timeoutHandle=zv(rv.bind(null,i,r,Or,xu,Yd,t,Kr,eo,Po,gi,c,"Throttled",-0,0),u);break e}rv(i,r,Or,xu,Yd,t,Kr,eo,Po,gi,c,null,-0,0)}}break}while(!0);Ma(e)}function rv(e,t,r,i,u,c,f,y,R,he,ze,Ie,ye,Se){if(e.timeoutHandle=-1,Ie=t.subtreeFlags,Ie&8192||(Ie&16785408)===16785408){Ie={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ar},Kh(t,c,Ie);var At=(c&62914560)===c?bu-Ge():(c&4194048)===c?Qh-Ge():0;if(At=Qy(Ie,At),At!==null){Qa=c,e.cancelPendingCommit=At(dv.bind(null,e,t,c,r,i,u,f,y,R,ze,Ie,null,ye,Se)),wi(e,c,f,!he);return}}dv(e,t,c,r,i,u,f,y,R)}function gy(e){for(var t=e;;){var r=t.tag;if((r===0||r===11||r===15)&&t.flags&16384&&(r=t.updateQueue,r!==null&&(r=r.stores,r!==null)))for(var i=0;i<r.length;i++){var u=r[i],c=u.getSnapshot;u=u.value;try{if(!Wr(c(),u))return!1}catch{return!1}}if(r=t.child,t.subtreeFlags&16384&&r!==null)r.return=t,t=r;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function wi(e,t,r,i){t&=~Gd,t&=~eo,e.suspendedLanes|=t,e.pingedLanes&=~t,i&&(e.warmLanes|=t),i=e.expirationTimes;for(var u=t;0<u;){var c=31-Ut(u),f=1<<c;i[c]=-1,u&=~f}r!==0&&D(e,r,t)}function wu(){return(Mn&6)===0?(Hl(0),!1):!0}function tm(){if(hn!==null){if(Bn===0)var e=hn.return;else e=hn,Ha=qi=null,gd(e),Lo=null,Cl=0,e=hn;for(;e!==null;)Dh(e.alternate,e),e=e.return;hn=null}}function Oo(e,t){var r=e.timeoutHandle;r!==-1&&(e.timeoutHandle=-1,zy(r)),r=e.cancelPendingCommit,r!==null&&(e.cancelPendingCommit=null,r()),Qa=0,tm(),In=e,hn=r=Ra(e.current,null),gn=t,Bn=0,Xr=null,gi=!1,zo=wn(e,t),Kd=!1,Po=Kr=Gd=eo=bi=Jn=0,Or=Rl=null,Yd=!1,(t&8)!==0&&(t|=t&32);var i=e.entangledLanes;if(i!==0)for(e=e.entanglements,i&=t;0<i;){var u=31-Ut(i),c=1<<u;t|=e[u],i&=~c}return Ja=t,Hs(),r}function av(e,t){ln=null,M.H=Tl,t===Mo||t===Gs?(t=xp(),Bn=3):t===id?(t=xp(),Bn=4):Bn=t===Bd?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Xr=t,hn===null&&(Jn=1,cu(e,aa(t,e.current)))}function iv(){var e=Zr.current;return e===null?!0:(gn&4194048)===gn?va===null:(gn&62914560)===gn||(gn&536870912)!==0?e===va:!1}function ov(){var e=M.H;return M.H=Tl,e===null?Tl:e}function lv(){var e=M.A;return M.A=hy,e}function Eu(){Jn=4,gi||(gn&4194048)!==gn&&Zr.current!==null||(zo=!0),(bi&134217727)===0&&(eo&134217727)===0||In===null||wi(In,gn,Kr,!1)}function nm(e,t,r){var i=Mn;Mn|=2;var u=ov(),c=lv();(In!==e||gn!==t)&&(xu=null,Oo(e,t)),t=!1;var f=Jn;e:do try{if(Bn!==0&&hn!==null){var y=hn,R=Xr;switch(Bn){case 8:tm(),f=6;break e;case 3:case 2:case 9:case 6:Zr.current===null&&(t=!0);var he=Bn;if(Bn=0,Xr=null,$o(e,y,R,he),r&&zo){f=0;break e}break;default:he=Bn,Bn=0,Xr=null,$o(e,y,R,he)}}by(),f=Jn;break}catch(ze){av(e,ze)}while(!0);return t&&e.shellSuspendCounter++,Ha=qi=null,Mn=i,M.H=u,M.A=c,hn===null&&(In=null,gn=0,Hs()),f}function by(){for(;hn!==null;)sv(hn)}function yy(e,t){var r=Mn;Mn|=2;var i=ov(),u=lv();In!==e||gn!==t?(xu=null,yu=Ge()+500,Oo(e,t)):zo=wn(e,t);e:do try{if(Bn!==0&&hn!==null){t=hn;var c=Xr;t:switch(Bn){case 1:Bn=0,Xr=null,$o(e,t,c,1);break;case 2:case 9:if(bp(c)){Bn=0,Xr=null,uv(t);break}t=function(){Bn!==2&&Bn!==9||In!==e||(Bn=7),Ma(e)},c.then(t,t);break e;case 3:Bn=7;break e;case 4:Bn=5;break e;case 7:bp(c)?(Bn=0,Xr=null,uv(t)):(Bn=0,Xr=null,$o(e,t,c,7));break;case 5:var f=null;switch(hn.tag){case 26:f=hn.memoizedState;case 5:case 27:var y=hn;if(f?Gv(f):y.stateNode.complete){Bn=0,Xr=null;var R=y.sibling;if(R!==null)hn=R;else{var he=y.return;he!==null?(hn=he,ku(he)):hn=null}break t}}Bn=0,Xr=null,$o(e,t,c,5);break;case 6:Bn=0,Xr=null,$o(e,t,c,6);break;case 8:tm(),Jn=6;break e;default:throw Error(s(462))}}xy();break}catch(ze){av(e,ze)}while(!0);return Ha=qi=null,M.H=i,M.A=u,Mn=r,hn!==null?0:(In=null,gn=0,Hs(),Jn)}function xy(){for(;hn!==null&&!_n();)sv(hn)}function sv(e){var t=Th(e.alternate,e,Ja);e.memoizedProps=e.pendingProps,t===null?ku(e):hn=t}function uv(e){var t=e,r=t.alternate;switch(t.tag){case 15:case 0:t=Fh(r,t,t.pendingProps,t.type,void 0,gn);break;case 11:t=Fh(r,t,t.pendingProps,t.type.render,t.ref,gn);break;case 5:gd(t);default:Dh(r,t),t=hn=lp(t,Ja),t=Th(r,t,Ja)}e.memoizedProps=e.pendingProps,t===null?ku(e):hn=t}function $o(e,t,r,i){Ha=qi=null,gd(t),Lo=null,Cl=0;var u=t.return;try{if(sy(e,u,t,r,gn)){Jn=1,cu(e,aa(r,e.current)),hn=null;return}}catch(c){if(u!==null)throw hn=u,c;Jn=1,cu(e,aa(r,e.current)),hn=null;return}t.flags&32768?(yn||i===1?e=!0:zo||(gn&536870912)!==0?e=!1:(gi=e=!0,(i===2||i===9||i===3||i===6)&&(i=Zr.current,i!==null&&i.tag===13&&(i.flags|=16384))),cv(t,e)):ku(t)}function ku(e){var t=e;do{if((t.flags&32768)!==0){cv(t,gi);return}e=t.return;var r=dy(t.alternate,t,Ja);if(r!==null){hn=r;return}if(t=t.sibling,t!==null){hn=t;return}hn=t=e}while(t!==null);Jn===0&&(Jn=5)}function cv(e,t){do{var r=my(e.alternate,e);if(r!==null){r.flags&=32767,hn=r;return}if(r=e.return,r!==null&&(r.flags|=32768,r.subtreeFlags=0,r.deletions=null),!t&&(e=e.sibling,e!==null)){hn=e;return}hn=e=r}while(e!==null);Jn=6,hn=null}function dv(e,t,r,i,u,c,f,y,R){e.cancelPendingCommit=null;do Cu();while(mr!==0);if((Mn&6)!==0)throw Error(s(327));if(t!==null){if(t===e.current)throw Error(s(177));if(c=t.lanes|t.childLanes,c|=Wc,Et(e,r,c,f,y,R),e===In&&(hn=In=null,gn=0),jo=t,xi=e,Qa=r,Jd=c,Qd=u,ev=i,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Cy(kn,function(){return vv(),null})):(e.callbackNode=null,e.callbackPriority=0),i=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||i){i=M.T,M.T=null,u=A.p,A.p=2,f=Mn,Mn|=4;try{fy(e,t,r)}finally{Mn=f,A.p=u,M.T=i}}mr=1,mv(),fv(),pv()}}function mv(){if(mr===1){mr=0;var e=xi,t=jo,r=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||r){r=M.T,M.T=null;var i=A.p;A.p=2;var u=Mn;Mn|=4;try{Zh(t,e);var c=mm,f=Jf(e.containerInfo),y=c.focusedElem,R=c.selectionRange;if(f!==y&&y&&y.ownerDocument&&Yf(y.ownerDocument.documentElement,y)){if(R!==null&&$c(y)){var he=R.start,ze=R.end;if(ze===void 0&&(ze=he),"selectionStart"in y)y.selectionStart=he,y.selectionEnd=Math.min(ze,y.value.length);else{var Ie=y.ownerDocument||document,ye=Ie&&Ie.defaultView||window;if(ye.getSelection){var Se=ye.getSelection(),At=y.textContent.length,Gt=Math.min(R.start,At),On=R.end===void 0?Gt:Math.min(R.end,At);!Se.extend&&Gt>On&&(f=On,On=Gt,Gt=f);var re=Gf(y,Gt),X=Gf(y,On);if(re&&X&&(Se.rangeCount!==1||Se.anchorNode!==re.node||Se.anchorOffset!==re.offset||Se.focusNode!==X.node||Se.focusOffset!==X.offset)){var pe=Ie.createRange();pe.setStart(re.node,re.offset),Se.removeAllRanges(),Gt>On?(Se.addRange(pe),Se.extend(X.node,X.offset)):(pe.setEnd(X.node,X.offset),Se.addRange(pe))}}}}for(Ie=[],Se=y;Se=Se.parentNode;)Se.nodeType===1&&Ie.push({element:Se,left:Se.scrollLeft,top:Se.scrollTop});for(typeof y.focus=="function"&&y.focus(),y=0;y<Ie.length;y++){var $e=Ie[y];$e.element.scrollLeft=$e.left,$e.element.scrollTop=$e.top}}Ou=!!dm,mm=dm=null}finally{Mn=u,A.p=i,M.T=r}}e.current=t,mr=2}}function fv(){if(mr===2){mr=0;var e=xi,t=jo,r=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||r){r=M.T,M.T=null;var i=A.p;A.p=2;var u=Mn;Mn|=4;try{Ih(e,t.alternate,t)}finally{Mn=u,A.p=i,M.T=r}}mr=3}}function pv(){if(mr===4||mr===3){mr=0,st();var e=xi,t=jo,r=Qa,i=ev;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?mr=5:(mr=0,jo=xi=null,hv(e,e.pendingLanes));var u=e.pendingLanes;if(u===0&&(yi=null),Ye(r),t=t.stateNode,Mt&&typeof Mt.onCommitFiberRoot=="function")try{Mt.onCommitFiberRoot(pt,t,void 0,(t.current.flags&128)===128)}catch{}if(i!==null){t=M.T,u=A.p,A.p=2,M.T=null;try{for(var c=e.onRecoverableError,f=0;f<i.length;f++){var y=i[f];c(y.value,{componentStack:y.stack})}}finally{M.T=t,A.p=u}}(Qa&3)!==0&&Cu(),Ma(e),u=e.pendingLanes,(r&261930)!==0&&(u&42)!==0?e===em?Il++:(Il=0,em=e):Il=0,Hl(0)}}function hv(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,El(t)))}function Cu(){return mv(),fv(),pv(),vv()}function vv(){if(mr!==5)return!1;var e=xi,t=Jd;Jd=0;var r=Ye(Qa),i=M.T,u=A.p;try{A.p=32>r?32:r,M.T=null,r=Qd,Qd=null;var c=xi,f=Qa;if(mr=0,jo=xi=null,Qa=0,(Mn&6)!==0)throw Error(s(331));var y=Mn;if(Mn|=4,Yh(c.current),Xh(c,c.current,f,r),Mn=y,Hl(0,!1),Mt&&typeof Mt.onPostCommitFiberRoot=="function")try{Mt.onPostCommitFiberRoot(pt,c)}catch{}return!0}finally{A.p=u,M.T=i,hv(e,t)}}function gv(e,t,r){t=aa(r,t),t=Td(e.stateNode,t,2),e=fi(e,t,2),e!==null&&(Je(e,2),Ma(e))}function Dn(e,t,r){if(e.tag===3)gv(e,e,r);else for(;t!==null;){if(t.tag===3){gv(t,e,r);break}else if(t.tag===1){var i=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(yi===null||!yi.has(i))){e=aa(r,e),r=bh(2),i=fi(t,r,2),i!==null&&(yh(r,i,t,e),Je(i,2),Ma(i));break}}t=t.return}}function rm(e,t,r){var i=e.pingCache;if(i===null){i=e.pingCache=new vy;var u=new Set;i.set(t,u)}else u=i.get(t),u===void 0&&(u=new Set,i.set(t,u));u.has(r)||(Kd=!0,u.add(r),e=wy.bind(null,e,t,r),t.then(e,e))}function wy(e,t,r){var i=e.pingCache;i!==null&&i.delete(t),e.pingedLanes|=e.suspendedLanes&r,e.warmLanes&=~r,In===e&&(gn&r)===r&&(Jn===4||Jn===3&&(gn&62914560)===gn&&300>Ge()-bu?(Mn&2)===0&&Oo(e,0):Gd|=r,Po===gn&&(Po=0)),Ma(e)}function bv(e,t){t===0&&(t=fe()),e=Hi(e,t),e!==null&&(Je(e,t),Ma(e))}function Ey(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),bv(e,r)}function ky(e,t){var r=0;switch(e.tag){case 31:case 13:var i=e.stateNode,u=e.memoizedState;u!==null&&(r=u.retryLane);break;case 19:i=e.stateNode;break;case 22:i=e.stateNode._retryCache;break;default:throw Error(s(314))}i!==null&&i.delete(t),bv(e,r)}function Cy(e,t){return Zt(e,t)}var Su=null,Ro=null,am=!1,Fu=!1,im=!1,Ei=0;function Ma(e){e!==Ro&&e.next===null&&(Ro===null?Su=Ro=e:Ro=Ro.next=e),Fu=!0,am||(am=!0,Fy())}function Hl(e,t){if(!im&&Fu){im=!0;do for(var r=!1,i=Su;i!==null;){if(e!==0){var u=i.pendingLanes;if(u===0)var c=0;else{var f=i.suspendedLanes,y=i.pingedLanes;c=(1<<31-Ut(42|e)+1)-1,c&=u&~(f&~y),c=c&201326741?c&201326741|1:c?c|2:0}c!==0&&(r=!0,Ev(i,c))}else c=gn,c=nn(i,i===In?c:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),(c&3)===0||wn(i,c)||(r=!0,Ev(i,c));i=i.next}while(r);im=!1}}function Sy(){yv()}function yv(){Fu=am=!1;var e=0;Ei!==0&&Dy()&&(e=Ei);for(var t=Ge(),r=null,i=Su;i!==null;){var u=i.next,c=xv(i,t);c===0?(i.next=null,r===null?Su=u:r.next=u,u===null&&(Ro=r)):(r=i,(e!==0||(c&3)!==0)&&(Fu=!0)),i=u}mr!==0&&mr!==5||Hl(e),Ei!==0&&(Ei=0)}function xv(e,t){for(var r=e.suspendedLanes,i=e.pingedLanes,u=e.expirationTimes,c=e.pendingLanes&-62914561;0<c;){var f=31-Ut(c),y=1<<f,R=u[f];R===-1?((y&r)===0||(y&i)!==0)&&(u[f]=Z(y,t)):R<=t&&(e.expiredLanes|=y),c&=~y}if(t=In,r=gn,r=nn(e,e===t?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i=e.callbackNode,r===0||e===t&&(Bn===2||Bn===9)||e.cancelPendingCommit!==null)return i!==null&&i!==null&&tn(i),e.callbackNode=null,e.callbackPriority=0;if((r&3)===0||wn(e,r)){if(t=r&-r,t===e.callbackPriority)return t;switch(i!==null&&tn(i),Ye(r)){case 2:case 8:r=Vt;break;case 32:r=kn;break;case 268435456:r=Pe;break;default:r=kn}return i=wv.bind(null,e),r=Zt(r,i),e.callbackPriority=t,e.callbackNode=r,t}return i!==null&&i!==null&&tn(i),e.callbackPriority=2,e.callbackNode=null,2}function wv(e,t){if(mr!==0&&mr!==5)return e.callbackNode=null,e.callbackPriority=0,null;var r=e.callbackNode;if(Cu()&&e.callbackNode!==r)return null;var i=gn;return i=nn(e,e===In?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i===0?null:(nv(e,i,t),xv(e,Ge()),e.callbackNode!=null&&e.callbackNode===r?wv.bind(null,e):null)}function Ev(e,t){if(Cu())return null;nv(e,t,!0)}function Fy(){Py(function(){(Mn&6)!==0?Zt(Rt,Sy):yv()})}function om(){if(Ei===0){var e=So;e===0&&(e=Xe,Xe<<=1,(Xe&261888)===0&&(Xe=256)),Ei=e}return Ei}function kv(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Mr(""+e)}function Cv(e,t){var r=t.ownerDocument.createElement("input");return r.name=t.name,r.value=t.value,e.id&&r.setAttribute("form",e.id),t.parentNode.insertBefore(r,t),e=new FormData(e),r.parentNode.removeChild(r),e}function My(e,t,r,i,u){if(t==="submit"&&r&&r.stateNode===u){var c=kv((u[Ke]||null).action),f=i.submitter;f&&(t=(t=f[Ke]||null)?kv(t.formAction):f.getAttribute("formAction"),t!==null&&(c=t,f=null));var y=new fo("action","action",null,i,u);e.push({event:y,listeners:[{instance:null,listener:function(){if(i.defaultPrevented){if(Ei!==0){var R=f?Cv(u,f):new FormData(u);Fd(r,{pending:!0,data:R,method:u.method,action:c},null,R)}}else typeof c=="function"&&(y.preventDefault(),R=f?Cv(u,f):new FormData(u),Fd(r,{pending:!0,data:R,method:u.method,action:c},c,R))},currentTarget:u}]})}}for(Lu=0;Lu<Vc.length;Lu++)Mu=Vc[Lu],Sv=Mu.toLowerCase(),Fv=Mu[0].toUpperCase()+Mu.slice(1),ha(Sv,"on"+Fv);var Mu,Sv,Fv,Lu;ha(tp,"onAnimationEnd"),ha(np,"onAnimationIteration"),ha(rp,"onAnimationStart"),ha("dblclick","onDoubleClick"),ha("focusin","onFocus"),ha("focusout","onBlur"),ha(qb,"onTransitionRun"),ha(Zb,"onTransitionStart"),ha(Ub,"onTransitionCancel"),ha(ap,"onTransitionEnd"),ur("onMouseEnter",["mouseout","mouseover"]),ur("onMouseLeave",["mouseout","mouseover"]),ur("onPointerEnter",["pointerout","pointerover"]),ur("onPointerLeave",["pointerout","pointerover"]),Hn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Hn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Hn("onBeforeInput",["compositionend","keypress","textInput","paste"]),Hn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Hn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Hn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Vl="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Ly=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Vl));function Mv(e,t){t=(t&4)!==0;for(var r=0;r<e.length;r++){var i=e[r],u=i.event;i=i.listeners;e:{var c=void 0;if(t)for(var f=i.length-1;0<=f;f--){var y=i[f],R=y.instance,he=y.currentTarget;if(y=y.listener,R!==c&&u.isPropagationStopped())break e;c=y,u.currentTarget=he;try{c(u)}catch(ze){Is(ze)}u.currentTarget=null,c=R}else for(f=0;f<i.length;f++){if(y=i[f],R=y.instance,he=y.currentTarget,y=y.listener,R!==c&&u.isPropagationStopped())break e;c=y,u.currentTarget=he;try{c(u)}catch(ze){Is(ze)}u.currentTarget=null,c=R}}}}function vn(e,t){var r=t[Wt];r===void 0&&(r=t[Wt]=new Set);var i=e+"__bubble";r.has(i)||(Lv(t,e,2,!1),r.add(i))}function lm(e,t,r){var i=0;t&&(i|=4),Lv(r,e,i,t)}var Au="_reactListening"+Math.random().toString(36).slice(2);function sm(e){if(!e[Au]){e[Au]=!0,zn.forEach(function(r){r!=="selectionchange"&&(Ly.has(r)||lm(r,!1,e),lm(r,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Au]||(t[Au]=!0,lm("selectionchange",!1,t))}}function Lv(e,t,r,i){switch(r0(t)){case 2:var u=n1;break;case 8:u=r1;break;default:u=km}r=u.bind(null,t,r,e),u=void 0,!Qn||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(u=!0),i?u!==void 0?e.addEventListener(t,r,{capture:!0,passive:u}):e.addEventListener(t,r,!0):u!==void 0?e.addEventListener(t,r,{passive:u}):e.addEventListener(t,r,!1)}function um(e,t,r,i,u){var c=i;if((t&1)===0&&(t&2)===0&&i!==null)e:for(;;){if(i===null)return;var f=i.tag;if(f===3||f===4){var y=i.stateNode.containerInfo;if(y===u)break;if(f===4)for(f=i.return;f!==null;){var R=f.tag;if((R===3||R===4)&&f.stateNode.containerInfo===u)return;f=f.return}for(;y!==null;){if(f=Lt(y),f===null)return;if(R=f.tag,R===5||R===6||R===26||R===27){i=c=f;continue e}y=y.parentNode}}i=i.return}It(function(){var he=c,ze=I(r),Ie=[];e:{var ye=ip.get(e);if(ye!==void 0){var Se=fo,At=e;switch(e){case"keypress":if(Vr(r)===0)break e;case"keydown":case"keyup":Se=kb;break;case"focusin":At="focus",Se=pl;break;case"focusout":At="blur",Se=pl;break;case"beforeblur":case"afterblur":Se=pl;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Se=ho;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Se=js;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Se=Fb;break;case tp:case np:case rp:Se=Dc;break;case ap:Se=Lb;break;case"scroll":case"scrollend":Se=zs;break;case"wheel":Se=Nb;break;case"copy":case"cut":case"paste":Se=vb;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Se=jf;break;case"toggle":case"beforetoggle":Se=Tb}var Gt=(t&4)!==0,On=!Gt&&(e==="scroll"||e==="scrollend"),re=Gt?ye!==null?ye+"Capture":null:ye;Gt=[];for(var X=he,pe;X!==null;){var $e=X;if(pe=$e.stateNode,$e=$e.tag,$e!==5&&$e!==26&&$e!==27||pe===null||re===null||($e=Kt(X,re),$e!=null&&Gt.push(Wl(X,$e,pe))),On)break;X=X.return}0<Gt.length&&(ye=new Se(ye,At,null,r,ze),Ie.push({event:ye,listeners:Gt}))}}if((t&7)===0){e:{if(ye=e==="mouseover"||e==="pointerover",Se=e==="mouseout"||e==="pointerout",ye&&r!==N&&(At=r.relatedTarget||r.fromElement)&&(Lt(At)||At[Nt]))break e;if((Se||ye)&&(ye=ze.window===ze?ze:(ye=ze.ownerDocument)?ye.defaultView||ye.parentWindow:window,Se?(At=r.relatedTarget||r.toElement,Se=he,At=At?Lt(At):null,At!==null&&(On=m(At),Gt=At.tag,At!==On||Gt!==5&&Gt!==27&&Gt!==6)&&(At=null)):(Se=null,At=he),Se!==At)){if(Gt=ho,$e="onMouseLeave",re="onMouseEnter",X="mouse",(e==="pointerout"||e==="pointerover")&&(Gt=jf,$e="onPointerLeave",re="onPointerEnter",X="pointer"),On=Se==null?ye:en(Se),pe=At==null?ye:en(At),ye=new Gt($e,X+"leave",Se,r,ze),ye.target=On,ye.relatedTarget=pe,$e=null,Lt(ze)===he&&(Gt=new Gt(re,X+"enter",At,r,ze),Gt.target=pe,Gt.relatedTarget=On,$e=Gt),On=$e,Se&&At)t:{for(Gt=Ay,re=Se,X=At,pe=0,$e=re;$e;$e=Gt($e))pe++;$e=0;for(var Ht=X;Ht;Ht=Gt(Ht))$e++;for(;0<pe-$e;)re=Gt(re),pe--;for(;0<$e-pe;)X=Gt(X),$e--;for(;pe--;){if(re===X||X!==null&&re===X.alternate){Gt=re;break t}re=Gt(re),X=Gt(X)}Gt=null}else Gt=null;Se!==null&&Av(Ie,ye,Se,Gt,!1),At!==null&&On!==null&&Av(Ie,On,At,Gt,!0)}}e:{if(ye=he?en(he):window,Se=ye.nodeName&&ye.nodeName.toLowerCase(),Se==="select"||Se==="input"&&ye.type==="file")var Sn=qf;else if(Vf(ye))if(Zf)Sn=Hb;else{Sn=Rb;var Dt=$b}else Se=ye.nodeName,!Se||Se.toLowerCase()!=="input"||ye.type!=="checkbox"&&ye.type!=="radio"?he&&on(he.elementType)&&(Sn=qf):Sn=Ib;if(Sn&&(Sn=Sn(e,he))){Wf(Ie,Sn,r,ze);break e}Dt&&Dt(e,ye,he),e==="focusout"&&he&&ye.type==="number"&&he.memoizedProps.value!=null&&We(ye,"number",ye.value)}switch(Dt=he?en(he):window,e){case"focusin":(Vf(Dt)||Dt.contentEditable==="true")&&(go=Dt,Rc=he,yl=null);break;case"focusout":yl=Rc=go=null;break;case"mousedown":Ic=!0;break;case"contextmenu":case"mouseup":case"dragend":Ic=!1,Qf(Ie,r,ze);break;case"selectionchange":if(Wb)break;case"keydown":case"keyup":Qf(Ie,r,ze)}var cn;if(Pc)e:{switch(e){case"compositionstart":var bn="onCompositionStart";break e;case"compositionend":bn="onCompositionEnd";break e;case"compositionupdate":bn="onCompositionUpdate";break e}bn=void 0}else vo?If(e,r)&&(bn="onCompositionEnd"):e==="keydown"&&r.keyCode===229&&(bn="onCompositionStart");bn&&(Of&&r.locale!=="ko"&&(vo||bn!=="onCompositionStart"?bn==="onCompositionEnd"&&vo&&(cn=fa()):(pr=ze,na="value"in pr?pr.value:pr.textContent,vo=!0)),Dt=Nu(he,bn),0<Dt.length&&(bn=new Pf(bn,e,null,r,ze),Ie.push({event:bn,listeners:Dt}),cn?bn.data=cn:(cn=Hf(r),cn!==null&&(bn.data=cn)))),(cn=Db?zb(e,r):Pb(e,r))&&(bn=Nu(he,"onBeforeInput"),0<bn.length&&(Dt=new Pf("onBeforeInput","beforeinput",null,r,ze),Ie.push({event:Dt,listeners:bn}),Dt.data=cn)),My(Ie,e,he,r,ze)}Mv(Ie,t)})}function Wl(e,t,r){return{instance:e,listener:t,currentTarget:r}}function Nu(e,t){for(var r=t+"Capture",i=[];e!==null;){var u=e,c=u.stateNode;if(u=u.tag,u!==5&&u!==26&&u!==27||c===null||(u=Kt(e,r),u!=null&&i.unshift(Wl(e,u,c)),u=Kt(e,t),u!=null&&i.push(Wl(e,u,c))),e.tag===3)return i;e=e.return}return[]}function Ay(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Av(e,t,r,i,u){for(var c=t._reactName,f=[];r!==null&&r!==i;){var y=r,R=y.alternate,he=y.stateNode;if(y=y.tag,R!==null&&R===i)break;y!==5&&y!==26&&y!==27||he===null||(R=he,u?(he=Kt(r,c),he!=null&&f.unshift(Wl(r,he,R))):u||(he=Kt(r,c),he!=null&&f.push(Wl(r,he,R)))),r=r.return}f.length!==0&&e.push({event:t,listeners:f})}var Ny=/\r\n?/g,_y=/\u0000|\uFFFD/g;function Nv(e){return(typeof e=="string"?e:""+e).replace(Ny,`
|
|
11
|
+
`).replace(_y,"")}function _v(e,t){return t=Nv(t),Nv(e)===t}function jn(e,t,r,i,u,c){switch(r){case"children":typeof i=="string"?t==="body"||t==="textarea"&&i===""||ht(e,i):(typeof i=="number"||typeof i=="bigint")&&t!=="body"&&ht(e,""+i);break;case"className":E(e,"class",i);break;case"tabIndex":E(e,"tabindex",i);break;case"dir":case"role":case"viewBox":case"width":case"height":E(e,r,i);break;case"style":jt(e,i,c);break;case"data":if(t!=="object"){E(e,"data",i);break}case"src":case"href":if(i===""&&(t!=="a"||r!=="href")){e.removeAttribute(r);break}if(i==null||typeof i=="function"||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(r);break}i=Mr(""+i),e.setAttribute(r,i);break;case"action":case"formAction":if(typeof i=="function"){e.setAttribute(r,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof c=="function"&&(r==="formAction"?(t!=="input"&&jn(e,t,"name",u.name,u,null),jn(e,t,"formEncType",u.formEncType,u,null),jn(e,t,"formMethod",u.formMethod,u,null),jn(e,t,"formTarget",u.formTarget,u,null)):(jn(e,t,"encType",u.encType,u,null),jn(e,t,"method",u.method,u,null),jn(e,t,"target",u.target,u,null)));if(i==null||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(r);break}i=Mr(""+i),e.setAttribute(r,i);break;case"onClick":i!=null&&(e.onclick=ar);break;case"onScroll":i!=null&&vn("scroll",e);break;case"onScrollEnd":i!=null&&vn("scrollend",e);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(s(61));if(r=i.__html,r!=null){if(u.children!=null)throw Error(s(60));e.innerHTML=r}}break;case"multiple":e.multiple=i&&typeof i!="function"&&typeof i!="symbol";break;case"muted":e.muted=i&&typeof i!="function"&&typeof i!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(i==null||typeof i=="function"||typeof i=="boolean"||typeof i=="symbol"){e.removeAttribute("xlink:href");break}r=Mr(""+i),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",r);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(r,""+i):e.removeAttribute(r);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":i&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(r,""):e.removeAttribute(r);break;case"capture":case"download":i===!0?e.setAttribute(r,""):i!==!1&&i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(r,i):e.removeAttribute(r);break;case"cols":case"rows":case"size":case"span":i!=null&&typeof i!="function"&&typeof i!="symbol"&&!isNaN(i)&&1<=i?e.setAttribute(r,i):e.removeAttribute(r);break;case"rowSpan":case"start":i==null||typeof i=="function"||typeof i=="symbol"||isNaN(i)?e.removeAttribute(r):e.setAttribute(r,i);break;case"popover":vn("beforetoggle",e),vn("toggle",e),Oe(e,"popover",i);break;case"xlinkActuate":F(e,"http://www.w3.org/1999/xlink","xlink:actuate",i);break;case"xlinkArcrole":F(e,"http://www.w3.org/1999/xlink","xlink:arcrole",i);break;case"xlinkRole":F(e,"http://www.w3.org/1999/xlink","xlink:role",i);break;case"xlinkShow":F(e,"http://www.w3.org/1999/xlink","xlink:show",i);break;case"xlinkTitle":F(e,"http://www.w3.org/1999/xlink","xlink:title",i);break;case"xlinkType":F(e,"http://www.w3.org/1999/xlink","xlink:type",i);break;case"xmlBase":F(e,"http://www.w3.org/XML/1998/namespace","xml:base",i);break;case"xmlLang":F(e,"http://www.w3.org/XML/1998/namespace","xml:lang",i);break;case"xmlSpace":F(e,"http://www.w3.org/XML/1998/namespace","xml:space",i);break;case"is":Oe(e,"is",i);break;case"innerText":case"textContent":break;default:(!(2<r.length)||r[0]!=="o"&&r[0]!=="O"||r[1]!=="n"&&r[1]!=="N")&&(r=Rn.get(r)||r,Oe(e,r,i))}}function cm(e,t,r,i,u,c){switch(r){case"style":jt(e,i,c);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(s(61));if(r=i.__html,r!=null){if(u.children!=null)throw Error(s(60));e.innerHTML=r}}break;case"children":typeof i=="string"?ht(e,i):(typeof i=="number"||typeof i=="bigint")&&ht(e,""+i);break;case"onScroll":i!=null&&vn("scroll",e);break;case"onScrollEnd":i!=null&&vn("scrollend",e);break;case"onClick":i!=null&&(e.onclick=ar);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Dr.hasOwnProperty(r))e:{if(r[0]==="o"&&r[1]==="n"&&(u=r.endsWith("Capture"),t=r.slice(2,u?r.length-7:void 0),c=e[Ke]||null,c=c!=null?c[r]:null,typeof c=="function"&&e.removeEventListener(t,c,u),typeof i=="function")){typeof c!="function"&&c!==null&&(r in e?e[r]=null:e.hasAttribute(r)&&e.removeAttribute(r)),e.addEventListener(t,i,u);break e}r in e?e[r]=i:i===!0?e.setAttribute(r,""):Oe(e,r,i)}}}function kr(e,t,r){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":vn("error",e),vn("load",e);var i=!1,u=!1,c;for(c in r)if(r.hasOwnProperty(c)){var f=r[c];if(f!=null)switch(c){case"src":i=!0;break;case"srcSet":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,t));default:jn(e,t,c,f,r,null)}}u&&jn(e,t,"srcSet",r.srcSet,r,null),i&&jn(e,t,"src",r.src,r,null);return;case"input":vn("invalid",e);var y=c=f=u=null,R=null,he=null;for(i in r)if(r.hasOwnProperty(i)){var ze=r[i];if(ze!=null)switch(i){case"name":u=ze;break;case"type":f=ze;break;case"checked":R=ze;break;case"defaultChecked":he=ze;break;case"value":c=ze;break;case"defaultValue":y=ze;break;case"children":case"dangerouslySetInnerHTML":if(ze!=null)throw Error(s(137,t));break;default:jn(e,t,i,ze,r,null)}}Ve(e,c,y,R,he,f,u,!1);return;case"select":vn("invalid",e),i=f=c=null;for(u in r)if(r.hasOwnProperty(u)&&(y=r[u],y!=null))switch(u){case"value":c=y;break;case"defaultValue":f=y;break;case"multiple":i=y;default:jn(e,t,u,y,r,null)}t=c,r=f,e.multiple=!!i,t!=null?ft(e,!!i,t,!1):r!=null&&ft(e,!!i,r,!0);return;case"textarea":vn("invalid",e),c=u=i=null;for(f in r)if(r.hasOwnProperty(f)&&(y=r[f],y!=null))switch(f){case"value":i=y;break;case"defaultValue":u=y;break;case"children":c=y;break;case"dangerouslySetInnerHTML":if(y!=null)throw Error(s(91));break;default:jn(e,t,f,y,r,null)}it(e,i,u,c);return;case"option":for(R in r)r.hasOwnProperty(R)&&(i=r[R],i!=null)&&(R==="selected"?e.selected=i&&typeof i!="function"&&typeof i!="symbol":jn(e,t,R,i,r,null));return;case"dialog":vn("beforetoggle",e),vn("toggle",e),vn("cancel",e),vn("close",e);break;case"iframe":case"object":vn("load",e);break;case"video":case"audio":for(i=0;i<Vl.length;i++)vn(Vl[i],e);break;case"image":vn("error",e),vn("load",e);break;case"details":vn("toggle",e);break;case"embed":case"source":case"link":vn("error",e),vn("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(he in r)if(r.hasOwnProperty(he)&&(i=r[he],i!=null))switch(he){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,t));default:jn(e,t,he,i,r,null)}return;default:if(on(t)){for(ze in r)r.hasOwnProperty(ze)&&(i=r[ze],i!==void 0&&cm(e,t,ze,i,r,void 0));return}}for(y in r)r.hasOwnProperty(y)&&(i=r[y],i!=null&&jn(e,t,y,i,r,null))}function Ty(e,t,r,i){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var u=null,c=null,f=null,y=null,R=null,he=null,ze=null;for(Se in r){var Ie=r[Se];if(r.hasOwnProperty(Se)&&Ie!=null)switch(Se){case"checked":break;case"value":break;case"defaultValue":R=Ie;default:i.hasOwnProperty(Se)||jn(e,t,Se,null,i,Ie)}}for(var ye in i){var Se=i[ye];if(Ie=r[ye],i.hasOwnProperty(ye)&&(Se!=null||Ie!=null))switch(ye){case"type":c=Se;break;case"name":u=Se;break;case"checked":he=Se;break;case"defaultChecked":ze=Se;break;case"value":f=Se;break;case"defaultValue":y=Se;break;case"children":case"dangerouslySetInnerHTML":if(Se!=null)throw Error(s(137,t));break;default:Se!==Ie&&jn(e,t,ye,Se,i,Ie)}}ke(e,f,y,R,he,ze,c,u);return;case"select":Se=f=y=ye=null;for(c in r)if(R=r[c],r.hasOwnProperty(c)&&R!=null)switch(c){case"value":break;case"multiple":Se=R;default:i.hasOwnProperty(c)||jn(e,t,c,null,i,R)}for(u in i)if(c=i[u],R=r[u],i.hasOwnProperty(u)&&(c!=null||R!=null))switch(u){case"value":ye=c;break;case"defaultValue":y=c;break;case"multiple":f=c;default:c!==R&&jn(e,t,u,c,i,R)}t=y,r=f,i=Se,ye!=null?ft(e,!!r,ye,!1):!!i!=!!r&&(t!=null?ft(e,!!r,t,!0):ft(e,!!r,r?[]:"",!1));return;case"textarea":Se=ye=null;for(y in r)if(u=r[y],r.hasOwnProperty(y)&&u!=null&&!i.hasOwnProperty(y))switch(y){case"value":break;case"children":break;default:jn(e,t,y,null,i,u)}for(f in i)if(u=i[f],c=r[f],i.hasOwnProperty(f)&&(u!=null||c!=null))switch(f){case"value":ye=u;break;case"defaultValue":Se=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(s(91));break;default:u!==c&&jn(e,t,f,u,i,c)}nt(e,ye,Se);return;case"option":for(var At in r)ye=r[At],r.hasOwnProperty(At)&&ye!=null&&!i.hasOwnProperty(At)&&(At==="selected"?e.selected=!1:jn(e,t,At,null,i,ye));for(R in i)ye=i[R],Se=r[R],i.hasOwnProperty(R)&&ye!==Se&&(ye!=null||Se!=null)&&(R==="selected"?e.selected=ye&&typeof ye!="function"&&typeof ye!="symbol":jn(e,t,R,ye,i,Se));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Gt in r)ye=r[Gt],r.hasOwnProperty(Gt)&&ye!=null&&!i.hasOwnProperty(Gt)&&jn(e,t,Gt,null,i,ye);for(he in i)if(ye=i[he],Se=r[he],i.hasOwnProperty(he)&&ye!==Se&&(ye!=null||Se!=null))switch(he){case"children":case"dangerouslySetInnerHTML":if(ye!=null)throw Error(s(137,t));break;default:jn(e,t,he,ye,i,Se)}return;default:if(on(t)){for(var On in r)ye=r[On],r.hasOwnProperty(On)&&ye!==void 0&&!i.hasOwnProperty(On)&&cm(e,t,On,void 0,i,ye);for(ze in i)ye=i[ze],Se=r[ze],!i.hasOwnProperty(ze)||ye===Se||ye===void 0&&Se===void 0||cm(e,t,ze,ye,i,Se);return}}for(var re in r)ye=r[re],r.hasOwnProperty(re)&&ye!=null&&!i.hasOwnProperty(re)&&jn(e,t,re,null,i,ye);for(Ie in i)ye=i[Ie],Se=r[Ie],!i.hasOwnProperty(Ie)||ye===Se||ye==null&&Se==null||jn(e,t,Ie,ye,i,Se)}function Tv(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function By(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,r=performance.getEntriesByType("resource"),i=0;i<r.length;i++){var u=r[i],c=u.transferSize,f=u.initiatorType,y=u.duration;if(c&&y&&Tv(f)){for(f=0,y=u.responseEnd,i+=1;i<r.length;i++){var R=r[i],he=R.startTime;if(he>y)break;var ze=R.transferSize,Ie=R.initiatorType;ze&&Tv(Ie)&&(R=R.responseEnd,f+=ze*(R<y?1:(y-he)/(R-he)))}if(--i,t+=8*(c+f)/(u.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var dm=null,mm=null;function _u(e){return e.nodeType===9?e:e.ownerDocument}function Bv(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Dv(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function fm(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var pm=null;function Dy(){var e=window.event;return e&&e.type==="popstate"?e===pm?!1:(pm=e,!0):(pm=null,!1)}var zv=typeof setTimeout=="function"?setTimeout:void 0,zy=typeof clearTimeout=="function"?clearTimeout:void 0,Pv=typeof Promise=="function"?Promise:void 0,Py=typeof queueMicrotask=="function"?queueMicrotask:typeof Pv<"u"?function(e){return Pv.resolve(null).then(e).catch(jy)}:zv;function jy(e){setTimeout(function(){throw e})}function ki(e){return e==="head"}function jv(e,t){var r=t,i=0;do{var u=r.nextSibling;if(e.removeChild(r),u&&u.nodeType===8)if(r=u.data,r==="/$"||r==="/&"){if(i===0){e.removeChild(u),Wo(t);return}i--}else if(r==="$"||r==="$?"||r==="$~"||r==="$!"||r==="&")i++;else if(r==="html")ql(e.ownerDocument.documentElement);else if(r==="head"){r=e.ownerDocument.head,ql(r);for(var c=r.firstChild;c;){var f=c.nextSibling,y=c.nodeName;c[un]||y==="SCRIPT"||y==="STYLE"||y==="LINK"&&c.rel.toLowerCase()==="stylesheet"||r.removeChild(c),c=f}}else r==="body"&&ql(e.ownerDocument.body);r=u}while(r);Wo(t)}function Ov(e,t){var r=e;e=0;do{var i=r.nextSibling;if(r.nodeType===1?t?(r._stashedDisplay=r.style.display,r.style.display="none"):(r.style.display=r._stashedDisplay||"",r.getAttribute("style")===""&&r.removeAttribute("style")):r.nodeType===3&&(t?(r._stashedText=r.nodeValue,r.nodeValue=""):r.nodeValue=r._stashedText||""),i&&i.nodeType===8)if(r=i.data,r==="/$"){if(e===0)break;e--}else r!=="$"&&r!=="$?"&&r!=="$~"&&r!=="$!"||e++;r=i}while(r)}function hm(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var r=t;switch(t=t.nextSibling,r.nodeName){case"HTML":case"HEAD":case"BODY":hm(r),pn(r);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(r.rel.toLowerCase()==="stylesheet")continue}e.removeChild(r)}}function Oy(e,t,r,i){for(;e.nodeType===1;){var u=r;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!i&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(i){if(!e[un])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(c=e.getAttribute("rel"),c==="stylesheet"&&e.hasAttribute("data-precedence")||c!==u.rel||e.getAttribute("href")!==(u.href==null||u.href===""?null:u.href)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin)||e.getAttribute("title")!==(u.title==null?null:u.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(c=e.getAttribute("src"),(c!==(u.src==null?null:u.src)||e.getAttribute("type")!==(u.type==null?null:u.type)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin))&&c&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var c=u.name==null?null:""+u.name;if(u.type==="hidden"&&e.getAttribute("name")===c)return e}else return e;if(e=sa(e.nextSibling),e===null)break}return null}function $y(e,t,r){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!r||(e=sa(e.nextSibling),e===null))return null;return e}function $v(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=sa(e.nextSibling),e===null))return null;return e}function vm(e){return e.data==="$?"||e.data==="$~"}function gm(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Ry(e,t){var r=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||r.readyState!=="loading")t();else{var i=function(){t(),r.removeEventListener("DOMContentLoaded",i)};r.addEventListener("DOMContentLoaded",i),e._reactRetry=i}}function sa(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var bm=null;function Rv(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="/$"||r==="/&"){if(t===0)return sa(e.nextSibling);t--}else r!=="$"&&r!=="$!"&&r!=="$?"&&r!=="$~"&&r!=="&"||t++}e=e.nextSibling}return null}function Iv(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"){if(t===0)return e;t--}else r!=="/$"&&r!=="/&"||t++}e=e.previousSibling}return null}function Hv(e,t,r){switch(t=_u(r),e){case"html":if(e=t.documentElement,!e)throw Error(s(452));return e;case"head":if(e=t.head,!e)throw Error(s(453));return e;case"body":if(e=t.body,!e)throw Error(s(454));return e;default:throw Error(s(451))}}function ql(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);pn(e)}var ua=new Map,Vv=new Set;function Tu(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var ei=A.d;A.d={f:Iy,r:Hy,D:Vy,C:Wy,L:qy,m:Zy,X:Xy,S:Uy,M:Ky};function Iy(){var e=ei.f(),t=wu();return e||t}function Hy(e){var t=Xt(e);t!==null&&t.tag===5&&t.type==="form"?ah(t):ei.r(e)}var Io=typeof document>"u"?null:document;function Wv(e,t,r){var i=Io;if(i&&typeof t=="string"&&t){var u=ae(t);u='link[rel="'+e+'"][href="'+u+'"]',typeof r=="string"&&(u+='[crossorigin="'+r+'"]'),Vv.has(u)||(Vv.add(u),e={rel:e,crossOrigin:r,href:t},i.querySelector(u)===null&&(t=i.createElement("link"),kr(t,"link",e),fn(t),i.head.appendChild(t)))}}function Vy(e){ei.D(e),Wv("dns-prefetch",e,null)}function Wy(e,t){ei.C(e,t),Wv("preconnect",e,t)}function qy(e,t,r){ei.L(e,t,r);var i=Io;if(i&&e&&t){var u='link[rel="preload"][as="'+ae(t)+'"]';t==="image"&&r&&r.imageSrcSet?(u+='[imagesrcset="'+ae(r.imageSrcSet)+'"]',typeof r.imageSizes=="string"&&(u+='[imagesizes="'+ae(r.imageSizes)+'"]')):u+='[href="'+ae(e)+'"]';var c=u;switch(t){case"style":c=Ho(e);break;case"script":c=Vo(e)}ua.has(c)||(e=S({rel:"preload",href:t==="image"&&r&&r.imageSrcSet?void 0:e,as:t},r),ua.set(c,e),i.querySelector(u)!==null||t==="style"&&i.querySelector(Zl(c))||t==="script"&&i.querySelector(Ul(c))||(t=i.createElement("link"),kr(t,"link",e),fn(t),i.head.appendChild(t)))}}function Zy(e,t){ei.m(e,t);var r=Io;if(r&&e){var i=t&&typeof t.as=="string"?t.as:"script",u='link[rel="modulepreload"][as="'+ae(i)+'"][href="'+ae(e)+'"]',c=u;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":c=Vo(e)}if(!ua.has(c)&&(e=S({rel:"modulepreload",href:e},t),ua.set(c,e),r.querySelector(u)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(r.querySelector(Ul(c)))return}i=r.createElement("link"),kr(i,"link",e),fn(i),r.head.appendChild(i)}}}function Uy(e,t,r){ei.S(e,t,r);var i=Io;if(i&&e){var u=Tn(i).hoistableStyles,c=Ho(e);t=t||"default";var f=u.get(c);if(!f){var y={loading:0,preload:null};if(f=i.querySelector(Zl(c)))y.loading=5;else{e=S({rel:"stylesheet",href:e,"data-precedence":t},r),(r=ua.get(c))&&ym(e,r);var R=f=i.createElement("link");fn(R),kr(R,"link",e),R._p=new Promise(function(he,ze){R.onload=he,R.onerror=ze}),R.addEventListener("load",function(){y.loading|=1}),R.addEventListener("error",function(){y.loading|=2}),y.loading|=4,Bu(f,t,i)}f={type:"stylesheet",instance:f,count:1,state:y},u.set(c,f)}}}function Xy(e,t){ei.X(e,t);var r=Io;if(r&&e){var i=Tn(r).hoistableScripts,u=Vo(e),c=i.get(u);c||(c=r.querySelector(Ul(u)),c||(e=S({src:e,async:!0},t),(t=ua.get(u))&&xm(e,t),c=r.createElement("script"),fn(c),kr(c,"link",e),r.head.appendChild(c)),c={type:"script",instance:c,count:1,state:null},i.set(u,c))}}function Ky(e,t){ei.M(e,t);var r=Io;if(r&&e){var i=Tn(r).hoistableScripts,u=Vo(e),c=i.get(u);c||(c=r.querySelector(Ul(u)),c||(e=S({src:e,async:!0,type:"module"},t),(t=ua.get(u))&&xm(e,t),c=r.createElement("script"),fn(c),kr(c,"link",e),r.head.appendChild(c)),c={type:"script",instance:c,count:1,state:null},i.set(u,c))}}function qv(e,t,r,i){var u=(u=De.current)?Tu(u):null;if(!u)throw Error(s(446));switch(e){case"meta":case"title":return null;case"style":return typeof r.precedence=="string"&&typeof r.href=="string"?(t=Ho(r.href),r=Tn(u).hoistableStyles,i=r.get(t),i||(i={type:"style",instance:null,count:0,state:null},r.set(t,i)),i):{type:"void",instance:null,count:0,state:null};case"link":if(r.rel==="stylesheet"&&typeof r.href=="string"&&typeof r.precedence=="string"){e=Ho(r.href);var c=Tn(u).hoistableStyles,f=c.get(e);if(f||(u=u.ownerDocument||u,f={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},c.set(e,f),(c=u.querySelector(Zl(e)))&&!c._p&&(f.instance=c,f.state.loading=5),ua.has(e)||(r={rel:"preload",as:"style",href:r.href,crossOrigin:r.crossOrigin,integrity:r.integrity,media:r.media,hrefLang:r.hrefLang,referrerPolicy:r.referrerPolicy},ua.set(e,r),c||Gy(u,e,r,f.state))),t&&i===null)throw Error(s(528,""));return f}if(t&&i!==null)throw Error(s(529,""));return null;case"script":return t=r.async,r=r.src,typeof r=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Vo(r),r=Tn(u).hoistableScripts,i=r.get(t),i||(i={type:"script",instance:null,count:0,state:null},r.set(t,i)),i):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,e))}}function Ho(e){return'href="'+ae(e)+'"'}function Zl(e){return'link[rel="stylesheet"]['+e+"]"}function Zv(e){return S({},e,{"data-precedence":e.precedence,precedence:null})}function Gy(e,t,r,i){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?i.loading=1:(t=e.createElement("link"),i.preload=t,t.addEventListener("load",function(){return i.loading|=1}),t.addEventListener("error",function(){return i.loading|=2}),kr(t,"link",r),fn(t),e.head.appendChild(t))}function Vo(e){return'[src="'+ae(e)+'"]'}function Ul(e){return"script[async]"+e}function Uv(e,t,r){if(t.count++,t.instance===null)switch(t.type){case"style":var i=e.querySelector('style[data-href~="'+ae(r.href)+'"]');if(i)return t.instance=i,fn(i),i;var u=S({},r,{"data-href":r.href,"data-precedence":r.precedence,href:null,precedence:null});return i=(e.ownerDocument||e).createElement("style"),fn(i),kr(i,"style",u),Bu(i,r.precedence,e),t.instance=i;case"stylesheet":u=Ho(r.href);var c=e.querySelector(Zl(u));if(c)return t.state.loading|=4,t.instance=c,fn(c),c;i=Zv(r),(u=ua.get(u))&&ym(i,u),c=(e.ownerDocument||e).createElement("link"),fn(c);var f=c;return f._p=new Promise(function(y,R){f.onload=y,f.onerror=R}),kr(c,"link",i),t.state.loading|=4,Bu(c,r.precedence,e),t.instance=c;case"script":return c=Vo(r.src),(u=e.querySelector(Ul(c)))?(t.instance=u,fn(u),u):(i=r,(u=ua.get(c))&&(i=S({},r),xm(i,u)),e=e.ownerDocument||e,u=e.createElement("script"),fn(u),kr(u,"link",i),e.head.appendChild(u),t.instance=u);case"void":return null;default:throw Error(s(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(i=t.instance,t.state.loading|=4,Bu(i,r.precedence,e));return t.instance}function Bu(e,t,r){for(var i=r.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=i.length?i[i.length-1]:null,c=u,f=0;f<i.length;f++){var y=i[f];if(y.dataset.precedence===t)c=y;else if(c!==u)break}c?c.parentNode.insertBefore(e,c.nextSibling):(t=r.nodeType===9?r.head:r,t.insertBefore(e,t.firstChild))}function ym(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function xm(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Du=null;function Xv(e,t,r){if(Du===null){var i=new Map,u=Du=new Map;u.set(r,i)}else u=Du,i=u.get(r),i||(i=new Map,u.set(r,i));if(i.has(e))return i;for(i.set(e,null),r=r.getElementsByTagName(e),u=0;u<r.length;u++){var c=r[u];if(!(c[un]||c[at]||e==="link"&&c.getAttribute("rel")==="stylesheet")&&c.namespaceURI!=="http://www.w3.org/2000/svg"){var f=c.getAttribute(t)||"";f=e+f;var y=i.get(f);y?y.push(c):i.set(f,[c])}}return i}function Kv(e,t,r){e=e.ownerDocument||e,e.head.insertBefore(r,t==="title"?e.querySelector("head > title"):null)}function Yy(e,t,r){if(r===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(e=t.disabled,typeof t.precedence=="string"&&e==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Gv(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Jy(e,t,r,i){if(r.type==="stylesheet"&&(typeof i.media!="string"||matchMedia(i.media).matches!==!1)&&(r.state.loading&4)===0){if(r.instance===null){var u=Ho(i.href),c=t.querySelector(Zl(u));if(c){t=c._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=zu.bind(e),t.then(e,e)),r.state.loading|=4,r.instance=c,fn(c);return}c=t.ownerDocument||t,i=Zv(i),(u=ua.get(u))&&ym(i,u),c=c.createElement("link"),fn(c);var f=c;f._p=new Promise(function(y,R){f.onload=y,f.onerror=R}),kr(c,"link",i),r.instance=c}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(r,t),(t=r.state.preload)&&(r.state.loading&3)===0&&(e.count++,r=zu.bind(e),t.addEventListener("load",r),t.addEventListener("error",r))}}var wm=0;function Qy(e,t){return e.stylesheets&&e.count===0&&ju(e,e.stylesheets),0<e.count||0<e.imgCount?function(r){var i=setTimeout(function(){if(e.stylesheets&&ju(e,e.stylesheets),e.unsuspend){var c=e.unsuspend;e.unsuspend=null,c()}},6e4+t);0<e.imgBytes&&wm===0&&(wm=62500*By());var u=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ju(e,e.stylesheets),e.unsuspend)){var c=e.unsuspend;e.unsuspend=null,c()}},(e.imgBytes>wm?50:800)+t);return e.unsuspend=r,function(){e.unsuspend=null,clearTimeout(i),clearTimeout(u)}}:null}function zu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ju(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Pu=null;function ju(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Pu=new Map,t.forEach(e1,e),Pu=null,zu.call(e))}function e1(e,t){if(!(t.state.loading&4)){var r=Pu.get(e);if(r)var i=r.get(null);else{r=new Map,Pu.set(e,r);for(var u=e.querySelectorAll("link[data-precedence],style[data-precedence]"),c=0;c<u.length;c++){var f=u[c];(f.nodeName==="LINK"||f.getAttribute("media")!=="not all")&&(r.set(f.dataset.precedence,f),i=f)}i&&r.set(null,i)}u=t.instance,f=u.getAttribute("data-precedence"),c=r.get(f)||i,c===i&&r.set(null,u),r.set(f,u),this.count++,i=zu.bind(this),u.addEventListener("load",i),u.addEventListener("error",i),c?c.parentNode.insertBefore(u,c.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(u,e.firstChild)),t.state.loading|=4}}var Xl={$$typeof:de,Provider:null,Consumer:null,_currentValue:ee,_currentValue2:ee,_threadCount:0};function t1(e,t,r,i,u,c,f,y,R){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ne(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ne(0),this.hiddenUpdates=Ne(null),this.identifierPrefix=i,this.onUncaughtError=u,this.onCaughtError=c,this.onRecoverableError=f,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=R,this.incompleteTransitions=new Map}function Yv(e,t,r,i,u,c,f,y,R,he,ze,Ie){return e=new t1(e,t,r,f,R,he,ze,Ie,y),t=1,c===!0&&(t|=24),c=qr(3,null,null,t),e.current=c,c.stateNode=e,t=nd(),t.refCount++,e.pooledCache=t,t.refCount++,c.memoizedState={element:i,isDehydrated:r,cache:t},od(c),e}function Jv(e){return e?(e=xo,e):xo}function Qv(e,t,r,i,u,c){u=Jv(u),i.context===null?i.context=u:i.pendingContext=u,i=mi(t),i.payload={element:r},c=c===void 0?null:c,c!==null&&(i.callback=c),r=fi(e,i,t),r!==null&&($r(r,e,t),Fl(r,e,t))}function e0(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var r=e.retryLane;e.retryLane=r!==0&&r<t?r:t}}function Em(e,t){e0(e,t),(e=e.alternate)&&e0(e,t)}function t0(e){if(e.tag===13||e.tag===31){var t=Hi(e,67108864);t!==null&&$r(t,e,67108864),Em(e,67108864)}}function n0(e){if(e.tag===13||e.tag===31){var t=Gr();t=He(t);var r=Hi(e,t);r!==null&&$r(r,e,t),Em(e,t)}}var Ou=!0;function n1(e,t,r,i){var u=M.T;M.T=null;var c=A.p;try{A.p=2,km(e,t,r,i)}finally{A.p=c,M.T=u}}function r1(e,t,r,i){var u=M.T;M.T=null;var c=A.p;try{A.p=8,km(e,t,r,i)}finally{A.p=c,M.T=u}}function km(e,t,r,i){if(Ou){var u=Cm(i);if(u===null)um(e,t,i,$u,r),a0(e,i);else if(i1(u,e,t,r,i))i.stopPropagation();else if(a0(e,i),t&4&&-1<a1.indexOf(e)){for(;u!==null;){var c=Xt(u);if(c!==null)switch(c.tag){case 3:if(c=c.stateNode,c.current.memoizedState.isDehydrated){var f=Ot(c.pendingLanes);if(f!==0){var y=c;for(y.pendingLanes|=2,y.entangledLanes|=2;f;){var R=1<<31-Ut(f);y.entanglements[1]|=R,f&=~R}Ma(c),(Mn&6)===0&&(yu=Ge()+500,Hl(0))}}break;case 31:case 13:y=Hi(c,2),y!==null&&$r(y,c,2),wu(),Em(c,2)}if(c=Cm(i),c===null&&um(e,t,i,$u,r),c===u)break;u=c}u!==null&&i.stopPropagation()}else um(e,t,i,null,r)}}function Cm(e){return e=I(e),Sm(e)}var $u=null;function Sm(e){if($u=null,e=Lt(e),e!==null){var t=m(e);if(t===null)e=null;else{var r=t.tag;if(r===13){if(e=h(t),e!==null)return e;e=null}else if(r===31){if(e=g(t),e!==null)return e;e=null}else if(r===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return $u=e,null}function r0(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(mt()){case Rt:return 2;case Vt:return 8;case kn:case xn:return 32;case Pe:return 268435456;default:return 32}default:return 32}}var Fm=!1,Ci=null,Si=null,Fi=null,Kl=new Map,Gl=new Map,Mi=[],a1="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function a0(e,t){switch(e){case"focusin":case"focusout":Ci=null;break;case"dragenter":case"dragleave":Si=null;break;case"mouseover":case"mouseout":Fi=null;break;case"pointerover":case"pointerout":Kl.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Gl.delete(t.pointerId)}}function Yl(e,t,r,i,u,c){return e===null||e.nativeEvent!==c?(e={blockedOn:t,domEventName:r,eventSystemFlags:i,nativeEvent:c,targetContainers:[u]},t!==null&&(t=Xt(t),t!==null&&t0(t)),e):(e.eventSystemFlags|=i,t=e.targetContainers,u!==null&&t.indexOf(u)===-1&&t.push(u),e)}function i1(e,t,r,i,u){switch(t){case"focusin":return Ci=Yl(Ci,e,t,r,i,u),!0;case"dragenter":return Si=Yl(Si,e,t,r,i,u),!0;case"mouseover":return Fi=Yl(Fi,e,t,r,i,u),!0;case"pointerover":var c=u.pointerId;return Kl.set(c,Yl(Kl.get(c)||null,e,t,r,i,u)),!0;case"gotpointercapture":return c=u.pointerId,Gl.set(c,Yl(Gl.get(c)||null,e,t,r,i,u)),!0}return!1}function i0(e){var t=Lt(e.target);if(t!==null){var r=m(t);if(r!==null){if(t=r.tag,t===13){if(t=h(r),t!==null){e.blockedOn=t,kt(e.priority,function(){n0(r)});return}}else if(t===31){if(t=g(r),t!==null){e.blockedOn=t,kt(e.priority,function(){n0(r)});return}}else if(t===3&&r.stateNode.current.memoizedState.isDehydrated){e.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Ru(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var r=Cm(e.nativeEvent);if(r===null){r=e.nativeEvent;var i=new r.constructor(r.type,r);N=i,r.target.dispatchEvent(i),N=null}else return t=Xt(r),t!==null&&t0(t),e.blockedOn=r,!1;t.shift()}return!0}function o0(e,t,r){Ru(e)&&r.delete(t)}function o1(){Fm=!1,Ci!==null&&Ru(Ci)&&(Ci=null),Si!==null&&Ru(Si)&&(Si=null),Fi!==null&&Ru(Fi)&&(Fi=null),Kl.forEach(o0),Gl.forEach(o0)}function Iu(e,t){e.blockedOn===t&&(e.blockedOn=null,Fm||(Fm=!0,a.unstable_scheduleCallback(a.unstable_NormalPriority,o1)))}var Hu=null;function l0(e){Hu!==e&&(Hu=e,a.unstable_scheduleCallback(a.unstable_NormalPriority,function(){Hu===e&&(Hu=null);for(var t=0;t<e.length;t+=3){var r=e[t],i=e[t+1],u=e[t+2];if(typeof i!="function"){if(Sm(i||r)===null)continue;break}var c=Xt(r);c!==null&&(e.splice(t,3),t-=3,Fd(c,{pending:!0,data:u,method:r.method,action:i},i,u))}}))}function Wo(e){function t(R){return Iu(R,e)}Ci!==null&&Iu(Ci,e),Si!==null&&Iu(Si,e),Fi!==null&&Iu(Fi,e),Kl.forEach(t),Gl.forEach(t);for(var r=0;r<Mi.length;r++){var i=Mi[r];i.blockedOn===e&&(i.blockedOn=null)}for(;0<Mi.length&&(r=Mi[0],r.blockedOn===null);)i0(r),r.blockedOn===null&&Mi.shift();if(r=(e.ownerDocument||e).$$reactFormReplay,r!=null)for(i=0;i<r.length;i+=3){var u=r[i],c=r[i+1],f=u[Ke]||null;if(typeof c=="function")f||l0(r);else if(f){var y=null;if(c&&c.hasAttribute("formAction")){if(u=c,f=c[Ke]||null)y=f.formAction;else if(Sm(u)!==null)continue}else y=f.action;typeof y=="function"?r[i+1]=y:(r.splice(i,3),i-=3),l0(r)}}}function s0(){function e(c){c.canIntercept&&c.info==="react-transition"&&c.intercept({handler:function(){return new Promise(function(f){return u=f})},focusReset:"manual",scroll:"manual"})}function t(){u!==null&&(u(),u=null),i||setTimeout(r,20)}function r(){if(!i&&!navigation.transition){var c=navigation.currentEntry;c&&c.url!=null&&navigation.navigate(c.url,{state:c.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var i=!1,u=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(r,100),function(){i=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),u!==null&&(u(),u=null)}}}function Mm(e){this._internalRoot=e}Vu.prototype.render=Mm.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(s(409));var r=t.current,i=Gr();Qv(r,i,e,t,null,null)},Vu.prototype.unmount=Mm.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Qv(e.current,2,null,e,null,null),wu(),t[Nt]=null}};function Vu(e){this._internalRoot=e}Vu.prototype.unstable_scheduleHydration=function(e){if(e){var t=ct();e={blockedOn:null,target:e,priority:t};for(var r=0;r<Mi.length&&t!==0&&t<Mi[r].priority;r++);Mi.splice(r,0,e),r===0&&i0(e)}};var u0=o.version;if(u0!=="19.2.7")throw Error(s(527,u0,"19.2.7"));A.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(s(188)):(e=Object.keys(e).join(","),Error(s(268,e)));return e=w(t),e=e!==null?W(e):null,e=e===null?null:e.stateNode,e};var l1={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:M,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&(Jl=__REACT_DEVTOOLS_GLOBAL_HOOK__,!Jl.isDisabled&&Jl.supportsFiber))try{pt=Jl.inject(l1),Mt=Jl}catch{}var Jl;n.createRoot=function(e,t){if(!d(e))throw Error(s(299));var r=!1,i="",u=ph,c=hh,f=vh;return t!=null&&(t.unstable_strictMode===!0&&(r=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onUncaughtError!==void 0&&(u=t.onUncaughtError),t.onCaughtError!==void 0&&(c=t.onCaughtError),t.onRecoverableError!==void 0&&(f=t.onRecoverableError)),t=Yv(e,1,!1,null,null,r,i,null,u,c,f,s0),e[Nt]=t.current,sm(e),new Mm(t)},n.hydrateRoot=function(e,t,r){if(!d(e))throw Error(s(299));var i=!1,u="",c=ph,f=hh,y=vh,R=null;return r!=null&&(r.unstable_strictMode===!0&&(i=!0),r.identifierPrefix!==void 0&&(u=r.identifierPrefix),r.onUncaughtError!==void 0&&(c=r.onUncaughtError),r.onCaughtError!==void 0&&(f=r.onCaughtError),r.onRecoverableError!==void 0&&(y=r.onRecoverableError),r.formState!==void 0&&(R=r.formState)),t=Yv(e,1,!0,t,r??null,i,u,R,c,f,y,s0),t.context=Jv(null),r=t.current,i=Gr(),i=He(i),u=mi(i),u.callback=null,fi(r,u,i),r=i,t.current.lanes=r,Je(t,r),Ma(t),e[Nt]=t.current,sm(e),new Vu(t)},n.version="19.2.7"}),T2=La((n,a)=>{function o(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(o)}catch(l){console.error(l)}}o(),a.exports=_2()}),B2=La(n=>{var a=Symbol.for("react.transitional.element"),o=Symbol.for("react.fragment");function l(s,d,m){var h=null;if(m!==void 0&&(h=""+m),d.key!==void 0&&(h=""+d.key),"key"in d){m={};for(var g in d)g!=="key"&&(m[g]=d[g])}else m=d;return d=m.ref,{$$typeof:a,type:s,key:h,ref:d!==void 0?d:null,props:m}}n.Fragment=o,n.jsx=l,n.jsxs=l}),Jo=La((n,a)=>{a.exports=B2()}),og=Ar(Ta(),1),D2=Ar(T2(),1),Ft=Ar(Ta(),1),lg=Ar(Ta(),1),z2=Ar(Ta(),1),P2=n=>(a,o)=>x2(n,a,o);function j2(n){return(0,z2.useSyncExternalStore)(n.subscribe,n.getSnapshot,n.getSnapshot)}var O2=n=>a=>n.patch(a,{transient:!0}),$2=n=>a=>n.commit(a),Re={fg:"var(--me-fg,#ededf0)",muted:"var(--me-fg-muted,#9a9aa3)",bg:"var(--me-bg,#08080a)",surface:"var(--me-surface,#141416)",chip:"var(--me-chip,#1c1c20)",border:"var(--me-border,#26262b)",accent:"var(--me-accent,#5b5bd6)",accentFg:"var(--me-accent-fg,#fff)",green:"#34d399"},ys=Ar(Jo(),1);function R2({value:n,min:a,max:o,rangePerWidth:l,step:s=1,onChange:d,onCommit:m,format:h}){let g=(0,lg.useRef)(null),v=(0,lg.useRef)(null),w=Y=>{let ue=v.current,oe=g.current;if(!ue||!oe)return;let ge=l??o-a,Be=ue.startV+(Y.clientX-ue.startX)/oe.clientWidth*ge,Te=Math.round(Be/s)*s;d(Math.min(o,Math.max(a,Te)))},W=()=>{v.current=null,window.removeEventListener("pointermove",w),window.removeEventListener("pointerup",W),m?.()},S=l??o-a,J=-n/S*100;return(0,ys.jsxs)("div",{ref:g,style:{position:"relative",height:36,userSelect:"none",overflow:"hidden",cursor:"ew-resize",touchAction:"none"},onPointerDown:Y=>{Y.preventDefault(),v.current={startX:Y.clientX,startV:n},window.addEventListener("pointermove",w),window.addEventListener("pointerup",W)},children:[(0,ys.jsx)("div",{style:{position:"absolute",top:"50%",left:"50%",display:"flex",alignItems:"center",gap:7,transform:`translate(calc(-50% + ${J}%), -50%)`,width:"200%",justifyContent:"center"},children:Array.from({length:81}).map((Y,ue)=>(0,ys.jsx)("span",{style:{flexShrink:0,borderRadius:"50%",width:ue%5===0?3:2,height:ue%5===0?3:2,background:ue%5===0?Re.muted:Re.border}},ue))}),(0,ys.jsx)("div",{style:{position:"absolute",left:"50%",top:0,bottom:0,width:1,background:Re.fg}}),(0,ys.jsx)("span",{style:{position:"absolute",left:"50%",transform:"translateX(-50%)",bottom:-2,fontSize:10,fontVariantNumeric:"tabular-nums",padding:"0 4px",borderRadius:4,color:Re.fg,background:Re.surface},children:h?h(n):Math.round(n)})]})}var xs=Ar(Ta(),1),I2=Ar(Jo(),1);function sg({videoEl:n,srcDims:a,canvasDims:o,state:l,maxW:s=Number.POSITIVE_INFINITY,maxH:d=Number.POSITIVE_INFINITY,zoomPercent:m=null,withOverlays:h=!0,onClick:g}){let v=(0,xs.useRef)(null),w=(0,xs.useRef)(new Map),W=(0,xs.useRef)(()=>{}),S=oo(o,l),J=S.w?Math.min(s/S.w,d/S.h,1):1,Y=m==null?J:m/100,ue=Math.max(2,Math.round(S.w*Y));return(0,xs.useEffect)(()=>{rc(l.overlays??[]).then(oe=>{w.current=oe,W.current()})},[l.overlays]),(0,xs.useEffect)(()=>{let oe=0,ge=0,Be=Math.min(1,1100/Math.max(2,S.w)),Te=()=>{let k=v.current;k&&n&&a.w&&S.w&&n.readyState>=2&&Xm(k,n,a,o,l,Be,w.current,h)},de=()=>!!n&&!n.paused&&!n.ended,Ae=()=>{ge||oe||(ge=requestAnimationFrame(()=>{ge=0,Te()}))},ve=()=>{Te(),oe=de()?requestAnimationFrame(ve):0},P=()=>{oe||(oe=requestAnimationFrame(ve))};return W.current=Te,Ae(),de()&&P(),n?.addEventListener("play",P),n?.addEventListener("playing",P),n?.addEventListener("pause",Ae),n?.addEventListener("seeked",Ae),n?.addEventListener("loadeddata",Ae),n?.addEventListener("timeupdate",Ae),()=>{W.current===Te&&(W.current=()=>{}),cancelAnimationFrame(oe),cancelAnimationFrame(ge),n?.removeEventListener("play",P),n?.removeEventListener("playing",P),n?.removeEventListener("pause",Ae),n?.removeEventListener("seeked",Ae),n?.removeEventListener("loadeddata",Ae),n?.removeEventListener("timeupdate",Ae)}},[n,a.w,a.h,o.w,o.h,S.w,S.h,l,h]),(0,I2.jsx)("canvas",{ref:v,onClick:g,style:{display:"block",borderRadius:8,width:ue,maxWidth:"none",height:"auto",cursor:g?"pointer":"default"}})}var Yr=Ar(Ta(),1),Ln=Ar(Jo(),1),Qo={padding:"6px 10px",borderRadius:6,background:Re.chip,color:Re.fg,border:"none",cursor:"pointer",font:"inherit",fontSize:13};function Ym({ratio:n}){if(!n)return(0,Ln.jsx)("span",{className:"me-video-ratio-glyph",style:{width:17,height:17,border:"1.6px solid currentColor",borderRadius:999,display:"inline-block",boxSizing:"border-box",opacity:.9},"aria-hidden":"true"});let[a=1,o=1]=n.split(":").map(Number),l=o>a,s=a>o;return(0,Ln.jsx)("span",{className:"me-video-ratio-glyph",style:{width:s?22:l?13:17,height:l?22:s?13:17,border:"1.6px solid currentColor",borderRadius:n?3:999,display:"inline-block",boxSizing:"border-box",opacity:n?1:.9},"aria-hidden":"true"})}function H2({videoEl:n,srcDims:a,canvasDims:o,state:l,patchLive:s,commit:d,ratioPreset:m,onRatioPreset:h,onConfirm:g,maxW:v=Number.POSITIVE_INFINITY,maxH:w=Number.POSITIVE_INFINITY,zoomPercent:W=null,t:S}){let J=(0,Yr.useRef)(null),Y=(0,Yr.useRef)(null),ue=(0,Yr.useRef)(null),oe=(0,Yr.useRef)(null),ge=(0,Yr.useRef)(null),Be=(0,Yr.useRef)({x:.5,y:.5}),[Te,de]=(0,Yr.useState)(!1),[,Ae]=(0,Yr.useState)(0),ve=Go(o.w,o.h,l.rotation),P=ve.w?Math.min(v/ve.w,w/ve.h,1):1,k=W==null?P:W/100,H=Math.max(2,Math.round(ve.w*k)),T=Math.max(2,Math.round(ve.h*k)),_=ve.w?H/ve.w:1,le=Number.isFinite(w)?Math.max(180,w+24):void 0,se=Number.isFinite(v)?Math.max(H,Math.round(v)):H,me=Number.isFinite(w)?Math.max(T,Math.round(w)):T,O=l.crop??{x:0,y:0,width:ve.w,height:ve.h},$=()=>{let te=ue.current;te&&(Be.current={x:te.scrollWidth>te.clientWidth?(te.scrollLeft+te.clientWidth/2)/te.scrollWidth:.5,y:te.scrollHeight>te.clientHeight?(te.scrollTop+te.clientHeight/2)/te.scrollHeight:.5})};(0,Yr.useEffect)(()=>{let te=ue.current;if(te)return te.addEventListener("scroll",$,{passive:!0}),()=>te.removeEventListener("scroll",$)},[]),(0,Yr.useLayoutEffect)(()=>{let te=ue.current;if(!te)return;let U=Be.current,xe=requestAnimationFrame(()=>{te.scrollLeft=Math.max(0,te.scrollWidth*U.x-te.clientWidth/2),te.scrollTop=Math.max(0,te.scrollHeight*U.y-te.clientHeight/2),$()});return()=>cancelAnimationFrame(xe)},[H,T,se,me]),(0,Yr.useEffect)(()=>{if(!Te)return;let te=U=>{let xe=oe.current;xe&&!xe.contains(U.target)&&de(!1)};return window.addEventListener("pointerdown",te),()=>window.removeEventListener("pointerdown",te)},[Te]),(0,Yr.useEffect)(()=>{let te=0,U=0,xe=()=>{let ot=J.current,gt=n;if(ot&>&&a.w&>.readyState>=2){ot.width=Math.max(2,Math.round(ve.w*.5)),ot.height=Math.max(2,Math.round(ve.h*.5));let Qt=ot.getContext("2d");if(Qt){Qt.save(),Qt.translate(ot.width/2,ot.height/2),Qt.rotate(l.rotation*Om),Qt.scale(l.flipX?-1:1,l.flipY?-1:1);let _t=$m({width:a.w,height:a.h},{w:o.w,h:o.h},"cover");Qt.drawImage(gt,_t.src.x,_t.src.y,_t.src.width,_t.src.height,-o.w*.5/2,-o.h*.5/2,o.w*.5,o.h*.5),Qt.restore()}}},Ce=()=>!!n&&!n.paused&&!n.ended,Ze=()=>{U||te||(U=requestAnimationFrame(()=>{U=0,xe()}))},et=()=>{xe(),te=Ce()?requestAnimationFrame(et):0},lt=()=>{te||(te=requestAnimationFrame(et))};return Ze(),Ce()&<(),n?.addEventListener("play",lt),n?.addEventListener("playing",lt),n?.addEventListener("pause",Ze),n?.addEventListener("seeked",Ze),n?.addEventListener("loadeddata",Ze),n?.addEventListener("timeupdate",Ze),()=>{cancelAnimationFrame(te),cancelAnimationFrame(U),n?.removeEventListener("play",lt),n?.removeEventListener("playing",lt),n?.removeEventListener("pause",Ze),n?.removeEventListener("seeked",Ze),n?.removeEventListener("loadeddata",Ze),n?.removeEventListener("timeupdate",Ze)}},[n,a.w,a.h,o.w,o.h,l.rotation,l.flipX,l.flipY]);let M=(()=>{let te=Gm.find(U=>U.ratio===m);return te?te.value:null})(),A=te=>{let U=ge.current,xe=Y.current;if(!U||!xe)return;let Ce=xe.getBoundingClientRect(),Ze=(te.clientX-Ce.left)/_,et=(te.clientY-Ce.top)/_;if(U.kind==="move"){let Zt=j0({x:U.orig.x+(Ze-U.startX),y:U.orig.y+(et-U.startY),width:U.orig.width,height:U.orig.height},{w:ve.w,h:ve.h});s({crop:Zt});return}let lt=U.orig,ot={nw:{x:lt.x+lt.width,y:lt.y+lt.height},ne:{x:lt.x,y:lt.y+lt.height},sw:{x:lt.x+lt.width,y:lt.y},se:{x:lt.x,y:lt.y}}[U.corner],gt=Math.max(40,Math.abs(Ze-ot.x)),Qt=Math.max(40,M?gt/M:Math.abs(et-ot.y));M&&(gt=Qt*M);let _t=Math.min(ot.x,Ze),xt=U.corner==="nw"||U.corner==="ne"?ot.y-Qt:M?ot.y:Math.min(ot.y,et);s({crop:j0({x:_t,y:xt,width:gt,height:Qt},{w:ve.w,h:ve.h})})},ee=()=>{ge.current=null,window.removeEventListener("pointermove",A),window.removeEventListener("pointerup",ee),d()},Me=te=>U=>{U.preventDefault(),U.stopPropagation(),ge.current=te,window.addEventListener("pointermove",A),window.addEventListener("pointerup",ee),Ae(xe=>xe+1)},[_e,x]=(0,Yr.useState)(()=>Math.round(l.rotation/90)*90),C=l.rotation-_e,j=te=>{let U=te;for(;U>180;)U-=360;for(;U<-180;)U+=360;return U},B=(te,U,xe)=>{let Ce=j(te+U);x(Ce-U);let Ze=Go(o.w,o.h,Ce),et=M?ec({w:Ze.w,h:Ze.h},M):{x:0,y:0,width:Ze.w,height:Ze.h};xe?s({rotation:Ce,crop:et}):d({rotation:Ce,crop:et})},G=[{c:"nw",style:{left:-7,top:-7}},{c:"ne",style:{right:-7,top:-7}},{c:"sw",style:{left:-7,bottom:-7}},{c:"se",style:{right:-7,bottom:-7}}],De=S(m?`ratio.${m}`:"ratio.free"),Q=te=>{h(te),de(!1)};return(0,Ln.jsxs)("div",{className:"me-video-crop-view",style:{display:"flex",flexDirection:"column",alignItems:"center",gap:12,width:"100%"},children:[(0,Ln.jsxs)("div",{className:"me-video-fixed-controls me-video-crop-controls",style:{position:"relative",zIndex:3,display:"flex",alignItems:"center",gap:8,flexWrap:"wrap",justifyContent:"center"},children:[(0,Ln.jsx)("button",{className:"me-video-crop-action","data-mobile-label":S("crop.rotateLeftShort"),onClick:()=>B(_e-90,C,!1),style:Qo,children:S("crop.rotateLeft")}),(0,Ln.jsx)("button",{className:"me-video-crop-action","data-mobile-label":S("crop.flipXShort"),onClick:()=>d({flipX:!l.flipX}),style:Qo,children:S("crop.flipX")}),(0,Ln.jsx)("button",{className:"me-video-crop-action","data-mobile-label":S("crop.flipYShort"),onClick:()=>d({flipY:!l.flipY}),style:Qo,children:S("crop.flipY")}),(0,Ln.jsxs)("div",{ref:oe,className:"me-video-ratio-menu",style:{position:"relative",display:"inline-flex"},children:[(0,Ln.jsxs)("button",{type:"button",onClick:()=>de(te=>!te),style:{...Qo,display:"inline-flex",alignItems:"center",gap:6,minWidth:126,justifyContent:"space-between",background:Te||m?"color-mix(in srgb, var(--me-accent, #7c7cf0) 18%, transparent)":Re.chip,color:Te||m?Re.accent:Re.fg},"aria-haspopup":"menu","aria-expanded":Te,children:[(0,Ln.jsx)(Ym,{ratio:""}),(0,Ln.jsx)("span",{children:De}),(0,Ln.jsx)("span",{"aria-hidden":"true",style:{fontSize:13,lineHeight:1},children:Te?"\u2303":"\u2304"})]}),Te&&(0,Ln.jsxs)("div",{className:"me-video-ratio-menu-panel",role:"menu",style:{position:"absolute",top:"calc(100% + 6px)",left:0,minWidth:190,padding:6,borderRadius:10,background:"rgba(28,28,32,0.98)",border:`1px solid ${Re.border}`,boxShadow:"0 14px 34px rgba(0,0,0,0.35)",zIndex:12},children:[(0,Ln.jsxs)("button",{type:"button",role:"menuitem",onClick:()=>Q(""),style:{...Qo,width:"100%",height:34,display:"flex",alignItems:"center",justifyContent:"flex-start",gap:8,background:m===""?"color-mix(in srgb, var(--me-accent, #7c7cf0) 18%, transparent)":"transparent",color:m===""?Re.accent:Re.fg},children:[(0,Ln.jsx)(Ym,{ratio:""}),(0,Ln.jsx)("span",{children:S("ratio.free")})]}),Gm.map(te=>(0,Ln.jsxs)("button",{type:"button",role:"menuitem",onClick:()=>Q(te.ratio),style:{...Qo,width:"100%",height:34,display:"flex",alignItems:"center",justifyContent:"flex-start",gap:8,background:m===te.ratio?"color-mix(in srgb, var(--me-accent, #7c7cf0) 18%, transparent)":"transparent",color:m===te.ratio?Re.accent:Re.fg},children:[(0,Ln.jsx)(Ym,{ratio:te.ratio}),(0,Ln.jsx)("span",{children:S(`ratio.${te.ratio}`)})]},te.ratio))]})]})]}),(0,Ln.jsx)("div",{ref:ue,className:"me-video-canvas-scroll",style:{position:"relative",zIndex:0,width:"100%",maxWidth:"100%",maxHeight:le,overflow:"auto",overscrollBehavior:"contain",padding:10,boxSizing:"border-box"},children:(0,Ln.jsx)("div",{className:"me-video-canvas-stage",style:{position:"relative",width:se,minWidth:"100%",minHeight:me,display:"grid",placeItems:"center"},children:(0,Ln.jsxs)("div",{ref:Y,style:{position:"relative",width:H,flex:"0 0 auto"},onDoubleClick:()=>{d(),g?.()},title:S("tip.dblConfirm"),children:[(0,Ln.jsx)("canvas",{ref:J,style:{display:"block",borderRadius:8,width:"100%",height:"auto"}}),(0,Ln.jsx)("div",{style:{position:"absolute",inset:0,overflow:"hidden",borderRadius:8},children:(0,Ln.jsxs)("div",{style:{position:"absolute",left:O.x*_,top:O.y*_,width:O.width*_,height:O.height*_,border:"1.5px solid rgba(255,255,255,0.9)",boxShadow:"0 0 0 9999px rgba(0,0,0,0.55)",cursor:"move",touchAction:"none"},onPointerDown:te=>{let U=Y.current;if(!U)return;let xe=U.getBoundingClientRect();Me({kind:"move",startX:(te.clientX-xe.left)/_,startY:(te.clientY-xe.top)/_,orig:O})(te)},children:[[1,2].map(te=>(0,Ln.jsx)("div",{style:{position:"absolute",top:0,bottom:0,width:1,left:`${te/3*100}%`,background:"rgba(255,255,255,0.25)"}},`v${te}`)),[1,2].map(te=>(0,Ln.jsx)("div",{style:{position:"absolute",left:0,right:0,height:1,top:`${te/3*100}%`,background:"rgba(255,255,255,0.25)"}},`h${te}`)),G.map(({c:te,style:U})=>(0,Ln.jsx)("div",{style:{position:"absolute",width:14,height:14,borderRadius:"50%",...U,background:"#fff",boxShadow:"0 1px 4px rgba(0,0,0,0.5)",cursor:`${te}-resize`,touchAction:"none"},onPointerDown:Me({kind:"corner",corner:te,orig:O})},te)),(0,Ln.jsxs)("span",{style:{position:"absolute",top:-20,left:0,fontSize:10,whiteSpace:"nowrap",color:"rgba(255,255,255,0.85)"},children:[Math.round(O.width),"\xD7",Math.round(O.height)]})]})})]})})}),(0,Ln.jsx)("div",{className:"me-video-fixed-controls me-video-crop-dial",style:{position:"relative",zIndex:3,width:"100%",maxWidth:420},children:(0,Ln.jsx)(R2,{value:C,min:-45,max:45,rangePerWidth:90,step:.5,onChange:te=>B(_e,te,!0),onCommit:()=>d(),format:te=>`${(_e+te).toFixed(1).replace(/\.0$/,"")}\xB0`})})]})}var Xn=Ar(Ta(),1),ut=Ar(Jo(),1);function V2(n,a=1024){return new Promise((o,l)=>{let s=URL.createObjectURL(n),d=new Image;d.onload=()=>{let m=Math.min(1,a/Math.max(d.naturalWidth,d.naturalHeight)),h=document.createElement("canvas");h.width=Math.max(1,Math.round(d.naturalWidth*m)),h.height=Math.max(1,Math.round(d.naturalHeight*m));let g=h.getContext("2d");if(!g){URL.revokeObjectURL(s),l(new Error("canvas \u4E0D\u53EF\u7528"));return}g.drawImage(d,0,0,h.width,h.height),URL.revokeObjectURL(s),o({dataUrl:h.toDataURL("image/png"),w:h.width,h:h.height})},d.onerror=()=>{URL.revokeObjectURL(s),l(new Error("\u56FE\u7247\u8BFB\u53D6\u5931\u8D25,\u8BF7\u6362\u4E00\u5F20"))},d.src=s})}var W2=["pen","eraser","line","arrow","rect","ellipse","text"],ug=["#ffffff","#ff4d4f","#ffa940","#fadb14","#52c41a","#40a9ff","#7c7cf0","#000000"],q2=["\u{1F60D}","\u{1F602}","\u{1F600}","\u{1F64F}","\u{1F44D}","\u2764\uFE0F","\u{1F525}","\u{1F389}","\u2728","\u{1F4AF}"],cg=n=>({height:32,padding:"0 10px",borderRadius:8,fontSize:12,border:"none",cursor:"pointer",background:n?"color-mix(in srgb, var(--me-accent, #7c7cf0) 18%, transparent)":"transparent",color:n?Re.accent:Re.muted,font:"inherit",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6}),Jm=()=>({width:28,height:28,borderRadius:6,border:"1px solid rgba(124,124,240,0.4)",display:"inline-flex",alignItems:"center",justifyContent:"center",padding:0,background:"rgba(20,20,22,0.88)",color:Re.fg,boxShadow:"0 4px 14px rgba(0,0,0,0.24)",cursor:"pointer"}),Z2={position:"absolute",top:34,right:0,zIndex:8,padding:8,borderRadius:8,border:"1px solid rgba(255,255,255,0.12)",background:"rgba(20,20,22,0.96)",boxShadow:"0 10px 28px rgba(0,0,0,0.32)",pointerEvents:"auto"};function oc({children:n}){return(0,ut.jsx)("svg",{className:"me-video-overlay-action-icon",viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:n})}function U2(){return(0,ut.jsxs)(oc,{children:[(0,ut.jsx)("path",{d:"M5 19l4.2-1 9.1-9.1a2 2 0 0 0-2.8-2.8L6.4 15.2 5 19z"}),(0,ut.jsx)("path",{d:"M13.8 7.8l2.4 2.4"})]})}function X2(){return(0,ut.jsxs)(oc,{children:[(0,ut.jsx)("rect",{x:"8",y:"8",width:"10",height:"10",rx:"1.8"}),(0,ut.jsx)("path",{d:"M6 14H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1"})]})}function K2(){return(0,ut.jsxs)(oc,{children:[(0,ut.jsx)("path",{d:"M5 7h14"}),(0,ut.jsx)("path",{d:"M9 7V5h6v2"}),(0,ut.jsx)("path",{d:"M8 10v8"}),(0,ut.jsx)("path",{d:"M12 10v8"}),(0,ut.jsx)("path",{d:"M16 10v8"}),(0,ut.jsx)("path",{d:"M7 7l1 13h8l1-13"})]})}function G2(){return(0,ut.jsxs)(oc,{children:[(0,ut.jsx)("path",{d:"M7 7a7 7 0 1 1-1.6 7.9"}),(0,ut.jsx)("path",{d:"M7 3v4h4"})]})}function Y2(){return(0,ut.jsx)("svg",{className:"me-video-overlay-action-icon me-video-overlay-resize-icon",viewBox:"0 0 1024 1024","aria-hidden":"true",focusable:"false",children:(0,ut.jsx)("path",{d:"M940.517894 1024l0.660311-0.683893h82.633135v-82.633135l0.18866-0.165078-0.18866-0.18866v-513.863019h-119.374695v394.488324L204.531159 121.049053H598.52425V1.674359H85.156464L83.482106 0l-1.674359 1.674359H1.674359v80.133388L0 83.482106l1.674359 1.674358V598.52425h119.351112V204.507577l699.433835 699.433835H426.961448v119.374695h512.872553l0.683893 0.683893z"})})}function Bi({children:n}){return(0,ut.jsx)("svg",{className:"me-video-overlay-tool-icon",viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:n})}function dg({id:n}){switch(n){case"pen":return(0,ut.jsxs)(Bi,{children:[(0,ut.jsx)("path",{d:"M4 20l4.5-1 9.6-9.6a2 2 0 0 0-2.8-2.8L5.7 16.2 4 20z"}),(0,ut.jsx)("path",{d:"M13.7 8.2l2.1 2.1"})]});case"eraser":return(0,ut.jsxs)(Bi,{children:[(0,ut.jsx)("path",{d:"M4 15l8.5-8.5a2 2 0 0 1 2.8 0l2.2 2.2a2 2 0 0 1 0 2.8L10 19H6.5L4 16.5V15z"}),(0,ut.jsx)("path",{d:"M9 11l4 4"}),(0,ut.jsx)("path",{d:"M11 19h8"})]});case"line":return(0,ut.jsx)(Bi,{children:(0,ut.jsx)("path",{d:"M5 19L19 5"})});case"arrow":return(0,ut.jsxs)(Bi,{children:[(0,ut.jsx)("path",{d:"M5 19L19 5"}),(0,ut.jsx)("path",{d:"M11 5h8v8"})]});case"rect":return(0,ut.jsx)(Bi,{children:(0,ut.jsx)("rect",{x:"5",y:"6",width:"14",height:"12",rx:"1.5"})});case"ellipse":return(0,ut.jsx)(Bi,{children:(0,ut.jsx)("ellipse",{cx:"12",cy:"12",rx:"7",ry:"5"})});case"text":return(0,ut.jsxs)(Bi,{children:[(0,ut.jsx)("path",{d:"M5 6h14"}),(0,ut.jsx)("path",{d:"M12 6v13"}),(0,ut.jsx)("path",{d:"M9 19h6"})]});case"pickImage":return(0,ut.jsxs)(Bi,{children:[(0,ut.jsx)("rect",{x:"5",y:"5",width:"14",height:"14",rx:"2"}),(0,ut.jsx)("path",{d:"M8 15l2.5-2.5L13 15l2-2 3 3"}),(0,ut.jsx)("circle",{cx:"9",cy:"9",r:"1"})]})}}function J2({videoEl:n,srcDims:a,canvasDims:o,state:l,mode:s,patchLive:d,commit:m,maxW:h=Number.POSITIVE_INFINITY,maxH:g=Number.POSITIVE_INFINITY,zoomPercent:v=null,t:w}){let W=(0,Xn.useRef)(null),S=(0,Xn.useRef)(null),J=(0,Xn.useRef)(null),Y=(0,Xn.useRef)(null),[ue,oe]=(0,Xn.useState)("pen"),[ge,Be]=(0,Xn.useState)("#ff4d4f"),[Te,de]=(0,Xn.useState)(6),[Ae,ve]=(0,Xn.useState)(-1),[P,k]=(0,Xn.useState)(""),[H,T]=(0,Xn.useState)(null),[_,le]=(0,Xn.useState)(null),[se,me]=(0,Xn.useState)(!1),O=(0,Xn.useRef)(null),$=(0,Xn.useRef)(-1),M=(0,Xn.useRef)(null),A=(0,Xn.useRef)(new Map),ee=(0,Xn.useRef)(()=>{}),Me=(0,Xn.useRef)(()=>{}),_e=(0,Xn.useRef)({x:.5,y:.5}),x=K=>{$.current=K,ve(K),Me.current()},C=oo(o,l),j=C.w?Math.min(h/C.w,g/C.h,1):1,B=v==null?j:v/100,G=Math.max(2,Math.round(C.w*B)),De=Math.max(2,Math.round(C.h*B)),Q=C.w?G/C.w:1,te=Number.isFinite(g)?Math.max(180,g+24):void 0,U=Number.isFinite(h)?Math.max(G,Math.round(h)):G,xe=Number.isFinite(g)?Math.max(De,Math.round(g)):De,Ce=l.overlays??[],Ze=Ae>=0?Ce[Ae]:void 0,et=Ze?tw(Ze,Q):null;(0,Xn.useEffect)(()=>{le(null),me(!1)},[Ae]);let lt=()=>{let K=J.current;K&&(_e.current={x:K.scrollWidth>K.clientWidth?(K.scrollLeft+K.clientWidth/2)/K.scrollWidth:.5,y:K.scrollHeight>K.clientHeight?(K.scrollTop+K.clientHeight/2)/K.scrollHeight:.5})};(0,Xn.useEffect)(()=>{let K=J.current;if(K)return K.addEventListener("scroll",lt,{passive:!0}),()=>K.removeEventListener("scroll",lt)},[]),(0,Xn.useLayoutEffect)(()=>{let K=J.current;if(!K)return;let Le=_e.current,Xe=requestAnimationFrame(()=>{K.scrollLeft=Math.max(0,K.scrollWidth*Le.x-K.clientWidth/2),K.scrollTop=Math.max(0,K.scrollHeight*Le.y-K.clientHeight/2),lt()});return()=>cancelAnimationFrame(Xe)},[G,De,U,xe]),(0,Xn.useEffect)(()=>{rc(Ce).then(K=>{A.current=K,Me.current()})},[Ce]),(0,Xn.useEffect)(()=>{let K=0,Le=0,Xe=Math.min(1,1100/C.w),Tt=()=>{let Z=W.current,fe=n;if(Z&&fe&&a.w&&C.w&&fe.readyState>=2){Xm(Z,fe,a,o,l,Xe,void 0,!1);let Ne=Z.getContext("2d");if(Ne){Ne.setTransform(Xe,0,0,Xe,0,0);let Je=_?Ce.filter((Et,D)=>D!==_.idx):Ce;nc(Ne,Je,A.current),O.current&&nc(Ne,[O.current],A.current),Ne.setTransform(1,0,0,1,0,0)}}},rn=()=>!!n&&!n.paused&&!n.ended,Ot=()=>{Le||K||(Le=requestAnimationFrame(()=>{Le=0,Tt()}))},nn=()=>{Tt(),K=rn()?requestAnimationFrame(nn):0},wn=()=>{K||(K=requestAnimationFrame(nn))};return ee.current=Tt,Me.current=Ot,Ot(),rn()&&wn(),n?.addEventListener("play",wn),n?.addEventListener("playing",wn),n?.addEventListener("pause",Ot),n?.addEventListener("seeked",Ot),n?.addEventListener("loadeddata",Ot),n?.addEventListener("timeupdate",Ot),()=>{ee.current===Tt&&(ee.current=()=>{}),Me.current===Ot&&(Me.current=()=>{}),cancelAnimationFrame(K),cancelAnimationFrame(Le),n?.removeEventListener("play",wn),n?.removeEventListener("playing",wn),n?.removeEventListener("pause",Ot),n?.removeEventListener("seeked",Ot),n?.removeEventListener("loadeddata",Ot),n?.removeEventListener("timeupdate",Ot)}},[n,a.w,a.h,o.w,o.h,C.w,C.h,l,Ce,Ae,_?.idx]);let ot=K=>{let Le=S.current.getBoundingClientRect();return{x:(K.clientX-Le.left)/Q,y:(K.clientY-Le.top)/Q}},gt=(K,Le,Xe)=>{let Tt=Ce[K];if(!Tt)return;let rn=mg(Tt),Ot=rn.x+rn.w/2,nn=rn.y+rn.h/2;M.current={startX:Le.x,startY:Le.y,orig:Tt,mode:Xe,baseW:Math.max(8,rn.w),baseDistance:Math.max(8,Math.hypot(Le.x-Ot,Le.y-nn)),centerX:Ot,centerY:nn,startAngle:Math.atan2(Le.y-nn,Le.x-Ot)*180/Math.PI,origRotation:da(Tt)},window.addEventListener("pointermove",st),window.addEventListener("pointerup",Ge)},Qt=K=>{let Le=qm(Ce,K.x,K.y,Math.max(8,12/Q));return x(Le),Le>=0?(gt(Le,K,"move"),!0):!1},_t=K=>{let Le=Ce[K];return!Le||Le.type!=="text"?!1:(x(K),me(!1),le({idx:K,value:Le.text,original:Le.text}),!0)},xt=K=>{K.preventDefault(),K.stopPropagation();let Le=ot(K),Xe=qm(Ce,Le.x,Le.y,Math.max(8,12/Q));Xe>=0&&_t(Xe)},Zt=K=>{if(H)return;K.preventDefault();let Le=ot(K);if(ue==="eraser"&&s==="annotate"){let Tt=qm(Ce,Le.x,Le.y,Math.max(8,12/Q));Tt>=0&&(m({overlays:Ce.filter((rn,Ot)=>Ot!==Tt)}),x(-1));return}if(Qt(Le)||s==="sticker")return;if(ue==="text"){T(Le);return}if(ue==="eraser")return;let Xe={color:ge,width:Te};O.current=ue==="pen"?{type:"pen",points:[Le.x,Le.y,Le.x+.01,Le.y+.01],...Xe}:ue==="line"||ue==="arrow"?{type:ue,x1:Le.x,y1:Le.y,x2:Le.x,y2:Le.y,...Xe}:{type:ue,x:Le.x,y:Le.y,w:1,h:1,...Xe},Me.current(),window.addEventListener("pointermove",tn),window.addEventListener("pointerup",_n)},tn=K=>{let Le=O.current;if(!Le)return;let Xe=ot(K);Le.type==="pen"?Le.points=[...Le.points,Xe.x,Xe.y]:Le.type==="line"||Le.type==="arrow"?(Le.x2=Xe.x,Le.y2=Xe.y):(Le.type==="rect"||Le.type==="ellipse")&&(Le.w=Xe.x-Le.x,Le.h=Xe.y-Le.y),Me.current()},_n=()=>{window.removeEventListener("pointermove",tn),window.removeEventListener("pointerup",_n);let K=O.current;if(O.current=null,Me.current(),!K||(K.type==="rect"||K.type==="ellipse")&&(Math.abs(K.w)<4||Math.abs(K.h)<4))return;let Le=K;(K.type==="rect"||K.type==="ellipse")&&(Le={...K,x:Math.min(K.x,K.x+K.w),y:Math.min(K.y,K.y+K.h),w:Math.abs(K.w),h:Math.abs(K.h)}),m({overlays:[...Ce,Le]})},st=K=>{let Le=M.current,Xe=$.current;if(!Le||Xe<0)return;let Tt=ot(K),rn=Le.origRotation+Math.atan2(Tt.y-Le.centerY,Tt.x-Le.centerX)*180/Math.PI-Le.startAngle,Ot=Le.mode==="scale"?Zm(Le.orig,Math.hypot(Tt.x-Le.centerX,Tt.y-Le.centerY)/Le.baseDistance):Le.mode==="rotate"?s2(Le.orig,ew(rn,Le)):ac(Le.orig,Tt.x-Le.startX,Tt.y-Le.startY);d({overlays:Ce.map((nn,wn)=>wn===Xe?Ot:nn)}),Me.current()},Ge=()=>{window.removeEventListener("pointermove",st),window.removeEventListener("pointerup",Ge),M.current&&m(),M.current=null},mt=(K,Le)=>{let Xe=Math.round(C.w*.14),Tt=Le?Q0(Le.w,Le.h,Xe):{w:Xe,h:Xe},rn={type:"sticker",x:Math.round(C.w/2-Tt.w/2),y:Math.round(C.h/2-Tt.h/2),w:Tt.w,h:Tt.h,emoji:K,src:Le?.src};x(Ce.length),m({overlays:[...Ce,rn]})},Rt=K=>{if(H&&K.trim()){let Le=Math.max(24,Math.round(C.w/18));m({overlays:[...Ce,{type:"text",x:H.x,y:H.y,text:K.trim(),color:ge,fontSize:Le}]})}T(null)},Vt=(K,Le)=>{let Xe=$.current;if(Xe<0||!Ce[Xe])return;let Tt=Ce.map((rn,Ot)=>Ot===Xe?K(rn):rn);Le==="commit"?m({overlays:Tt}):d({overlays:Tt})},kn=()=>{let K=$.current;if(K<0||!Ce[K])return;let Le=ac(Ce[K],24,24);x(Ce.length),m({overlays:[...Ce,Le]})},xn=()=>{let K=$.current;K<0||(m({overlays:Ce.filter((Le,Xe)=>Xe!==K)}),x(-1))},Pe=()=>{let K=$.current,Le=K>=0?Ce[K]:void 0;if(!(!Le||Le.type==="sticker")){if(Le.type==="text"){_t(K);return}le(null),me(Xe=>!Xe)}},dt=()=>{_&&Vt(K=>K.type==="text"?{...K,text:_.original}:K,"commit"),le(null)},yt=()=>{_&&m(),le(null)},pt=K=>{let Le=$.current,Xe=Ce[Le];!Xe||!lc(Xe)||Vt(Tt=>lc(Tt)?{...Tt,color:K}:Tt,"commit")},Mt=(K,Le)=>{Ze&&Qm(Ze)&&Vt(Xe=>Qm(Xe)?{...Xe,width:K}:Xe,Le)},dn=K=>{Be(K),pt(K)},Ut=K=>{de(K)},An=Ze&&lc(Ze)?Ze.color:ge;return(0,ut.jsxs)("div",{className:`me-video-overlay-view me-video-overlay-view-${s}`,style:{display:"flex",flexDirection:"column",alignItems:"center",gap:12},children:[(0,ut.jsx)("div",{ref:J,className:"me-video-canvas-scroll",style:{position:"relative",zIndex:0,width:"100%",maxWidth:"100%",maxHeight:te,overflow:"auto",overscrollBehavior:"contain",padding:8,boxSizing:"border-box"},children:(0,ut.jsx)("div",{className:"me-video-canvas-stage",style:{position:"relative",width:U,minWidth:"100%",minHeight:xe,display:"grid",placeItems:"center"},children:(0,ut.jsxs)("div",{ref:S,style:{position:"relative",width:G,flex:"0 0 auto",touchAction:"none"},children:[(0,ut.jsx)("canvas",{ref:W,style:{display:"block",borderRadius:8,width:"100%",height:"auto",cursor:s==="sticker"?"default":ue==="eraser"?"cell":"crosshair"},onPointerDown:Zt,onDoubleClick:xt}),H&&(0,ut.jsx)("input",{autoFocus:!0,style:{position:"absolute",left:H.x*Q,top:H.y*Q,background:"rgba(0,0,0,0.75)",border:`1px solid ${Re.accent}`,color:"#fff",minWidth:120,padding:"4px 8px",borderRadius:4,fontSize:14,outline:"none"},placeholder:w("overlay.textPlaceholder"),onKeyDown:K=>{K.key==="Enter"&&Rt(K.target.value),K.key==="Escape"&&T(null)},onBlur:K=>Rt(K.target.value)}),Ze&&et&&(0,ut.jsxs)("div",{className:"me-video-selection-frame",style:et.frameStyle,children:[(0,ut.jsx)("div",{className:"me-video-selection-handle",style:et.handleStyle,onPointerDown:K=>{K.preventDefault(),K.stopPropagation(),gt(Ae,ot(K),"scale")},children:(0,ut.jsx)(Y2,{})}),(0,ut.jsx)("div",{className:"me-video-selection-rotate-handle",style:et.rotateHandleStyle,onPointerDown:K=>{K.preventDefault(),K.stopPropagation(),gt(Ae,ot(K),"rotate")},children:(0,ut.jsx)(G2,{})}),(0,ut.jsxs)("div",{className:"me-video-overlay-actions",style:et.actionsStyle,onPointerDown:K=>K.stopPropagation(),children:[Ze.type!=="sticker"&&Ze.type!=="text"&&(0,ut.jsx)("button",{type:"button",title:w("overlay.editSelected"),"aria-label":w("overlay.editSelected"),onClick:Pe,style:Jm(),children:(0,ut.jsx)(U2,{})}),(0,ut.jsx)("button",{type:"button",title:w("overlay.copySelected"),"aria-label":w("overlay.copySelected"),onClick:kn,style:Jm(),children:(0,ut.jsx)(X2,{})}),(0,ut.jsx)("button",{type:"button",title:w("overlay.delSelected"),"aria-label":w("overlay.delSelected"),onClick:xn,style:Jm(),children:(0,ut.jsx)(K2,{})})]}),_&&Ze.type==="text"&&(0,ut.jsx)("textarea",{autoFocus:!0,className:"me-video-overlay-text-editor",value:_.value,onChange:K=>{let Le=K.target.value;le(Xe=>Xe&&{...Xe,value:Le}),Vt(Xe=>Xe.type==="text"?{...Xe,text:Le}:Xe,"live")},onBlur:yt,onKeyDown:K=>{K.key==="Enter"&&!K.shiftKey&&(K.preventDefault(),K.target.blur()),K.key==="Escape"&&dt()},style:{...et.textEditorStyle,color:Ze.color,fontFamily:"inherit",fontSize:Math.max(12,Ze.fontSize*Q),lineHeight:1.15,outline:"none"}}),se&&Ze.type!=="text"&&Ze.type!=="sticker"&&(0,ut.jsxs)("div",{className:"me-video-overlay-style-popover",style:{...Z2,...et.popoverCounterStyle,display:"flex",alignItems:"center",gap:8},children:[ug.map(K=>(0,ut.jsx)("button",{onClick:()=>pt(K),style:{width:18,height:18,borderRadius:"50%",background:K,outline:lc(Ze)&&Ze.color===K?`2px solid ${Re.accent}`:`1px solid ${Re.border}`,outlineOffset:2,border:"none",cursor:"pointer"}},K)),Qm(Ze)&&(0,ut.jsx)("input",{type:"range",min:2,max:24,step:1,value:Ze.width,onChange:K=>Mt(Number(K.target.value),"live"),onPointerUp:()=>m(),style:{width:90}})]})]})]})})}),s==="annotate"?(0,ut.jsxs)("div",{className:"me-video-fixed-controls me-video-overlay-controls",style:{position:"relative",zIndex:3,display:"flex",flexDirection:"column",alignItems:"center",gap:8,width:"100%"},children:[(0,ut.jsxs)("div",{className:"me-video-overlay-style-row",style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap",justifyContent:"center",fontSize:12,color:Re.muted},children:[(0,ut.jsx)("span",{style:{fontSize:11,color:Re.muted},children:w("overlay.color")}),ug.map(K=>(0,ut.jsx)("button",{onClick:()=>dn(K),style:{width:20,height:20,borderRadius:"50%",background:K,outline:An===K?`2px solid ${Re.accent}`:`1px solid ${Re.border}`,outlineOffset:2,border:"none",cursor:"pointer"}},K)),(0,ut.jsx)("span",{style:{fontSize:11,marginLeft:8,color:Re.muted},children:w("overlay.width")}),(0,ut.jsx)("input",{type:"range",min:2,max:24,step:1,value:Te,onChange:K=>Ut(Number(K.target.value))})]}),(0,ut.jsx)("div",{className:"me-video-overlay-tool-row",style:{display:"flex",alignItems:"center",gap:4,flexWrap:"wrap",justifyContent:"center"},children:W2.map(K=>(0,ut.jsxs)("button",{onClick:()=>{oe(K),x(-1)},style:cg(ue===K),children:[(0,ut.jsx)(dg,{id:K}),(0,ut.jsx)("span",{children:w(`overlay.${K}`)})]},K))})]}):(0,ut.jsxs)("div",{className:"me-video-fixed-controls me-video-sticker-controls",style:{position:"relative",zIndex:3,display:"flex",alignItems:"center",gap:8,flexWrap:"wrap",justifyContent:"center",width:"100%"},children:[(0,ut.jsxs)("button",{onClick:()=>Y.current?.click(),style:cg(!1),children:[(0,ut.jsx)(dg,{id:"pickImage"}),(0,ut.jsx)("span",{children:w("overlay.pickImage")})]}),(0,ut.jsx)("input",{ref:Y,type:"file",accept:"image/*",style:{display:"none"},onChange:K=>{let Le=K.target.files?.[0];if(K.target.value="",!!Le){if(!Le.type.startsWith("image/")){k(w("err.notImage"));return}k(""),V2(Le).then(Xe=>mt(void 0,{src:Xe.dataUrl,w:Xe.w,h:Xe.h})).catch(Xe=>k(Xe.message))}}}),q2.map(K=>(0,ut.jsx)("button",{onClick:()=>mt(K),style:{fontSize:24,lineHeight:1,padding:6,borderRadius:999,border:"none",background:"transparent",cursor:"pointer"},children:K},K)),(0,ut.jsx)("span",{style:{width:"100%",textAlign:"center",fontSize:11,color:Re.muted},children:w("overlay.hint")})]}),P&&(0,ut.jsx)("div",{style:{padding:"6px 12px",borderRadius:6,fontSize:12,background:"rgba(239,68,68,0.12)",color:"#fca5a5"},children:P})]})}function mg(n){return Ir(n)}function Q2(n){let a=n%360;return a>180&&(a-=360),a<-180&&(a+=360),a}function ew(n,a){let o=Q2(n);return a.zeroSnapped?Math.abs(o)<=7?0:(a.zeroSnapped=!1,n):Math.abs(o)<=2.5?(a.zeroSnapped=!0,0):n}function tw(n,a){let o=mg(n),l=12/Math.max(a,.001),s=Math.max(o.w,l),d=Math.max(o.h,l),m=o.x-Math.max(0,s-o.w)/2,h=o.y-Math.max(0,d-o.h)/2,g=6,v=da(n);return{bbox:{x:m,y:h,w:s,h:d},frameStyle:{position:"absolute",left:(m-g)*a,top:(h-g)*a,width:(s+g*2)*a,height:(d+g*2)*a,border:"1.5px dashed #7c7cf0",borderRadius:4,boxSizing:"border-box",pointerEvents:"none",zIndex:6,transform:v?`rotate(${v}deg)`:void 0,transformOrigin:"center"},handleStyle:{position:"absolute",width:20,height:20,right:-10,bottom:-10,borderRadius:999,background:"rgba(20,20,22,0.88)",border:"1.5px solid #7c7cf0",color:"#f4f4f7",boxShadow:"0 2px 8px rgba(0,0,0,0.32)",cursor:"nwse-resize",pointerEvents:"auto",touchAction:"none",display:"inline-flex",alignItems:"center",justifyContent:"center",zIndex:10},rotateHandleStyle:{position:"absolute",width:20,height:20,right:-10,top:-10,borderRadius:999,background:"rgba(20,20,22,0.88)",border:"1.5px solid #7c7cf0",color:"#f4f4f7",boxShadow:"0 2px 8px rgba(0,0,0,0.32)",cursor:"grab",pointerEvents:"auto",touchAction:"none",display:"inline-flex",alignItems:"center",justifyContent:"center"},actionsStyle:{position:"absolute",top:-40,left:"50%",display:"flex",alignItems:"center",justifyContent:"center",gap:6,pointerEvents:"auto",zIndex:9,transform:v?`translateX(-50%) rotate(${-v}deg)`:"translateX(-50%)",transformOrigin:"center bottom"},popoverCounterStyle:{transform:v?`rotate(${-v}deg)`:void 0,transformOrigin:"right top"},textEditorStyle:{position:"absolute",left:g*a,top:g*a,width:s*a,height:d*a,minWidth:40,minHeight:24,resize:"none",border:"1px solid rgba(124,124,240,0.7)",borderRadius:4,background:"rgba(20,20,22,0.22)",padding:2,boxSizing:"border-box",overflow:"hidden",pointerEvents:"auto",zIndex:11}}}function lc(n){return n.type!=="sticker"}function Qm(n){return n.type==="pen"||n.type==="line"||n.type==="arrow"||n.type==="rect"||n.type==="ellipse"}var el=Ar(Ta(),1),Sr=Ar(Jo(),1),ws=12;function fg(n){let a=Math.floor(n/60),o=n-a*60;return`${a}:${o.toFixed(2).padStart(5,"0")}`}function nw({open:n,onClose:a,videoSrcs:o,clips:l,canvasDims:s,state:d,duration:m,sampleThumb:h,fileName:g,t:v}){let[w,W]=(0,el.useState)(0),[S,J]=(0,el.useState)(!1),Y=(0,el.useRef)(new Map),[ue,oe]=(0,el.useState)(null),[ge,Be]=(0,el.useState)({w:2,h:2}),Te=P=>{let k=Y.current.get(P);return k||(k=document.createElement("video"),k.src=o[P]?.url??"",k.muted=!0,k.playsInline=!0,k.preload="auto",Y.current.set(P,k)),k},de=P=>{let k=Math.min(Math.max(0,P),Math.max(0,m-.01));W(k);let H=io(l,k);if(!H)return;let T=l[H.idx].srcIdx,_=Te(T);Be(o[T]?.dims??{w:2,h:2}),oe(_),_.readyState>=1?_.currentTime=H.srcTime:_.addEventListener("loadedmetadata",()=>{_.currentTime=H.srcTime},{once:!0})};if((0,el.useEffect)(()=>(n&&de(w),()=>{n&&(Y.current.forEach(P=>{try{P.pause(),P.removeAttribute("src"),P.load()}catch{}}),Y.current.clear())}),[n]),!n)return null;let Ae=async()=>{if(!(!ue||S)){J(!0);try{let P=document.createElement("canvas"),k=await rc(d.overlays??[]);Xm(P,ue,ge,s,d,1,k,!0);let H=await new Promise(le=>P.toBlob(se=>le(se),"image/jpeg",.92));if(!H)throw new Error(v("err.posterFailed"));let T=URL.createObjectURL(H),_=document.createElement("a");_.href=T,_.download=`${g}_poster.jpg`,document.body.appendChild(_),_.click(),_.remove(),setTimeout(()=>URL.revokeObjectURL(T),5e3),a()}finally{J(!1)}}},ve={padding:"8px 16px",borderRadius:8,fontSize:13,border:"none",cursor:"pointer",background:Re.chip,color:Re.muted,font:"inherit"};return(0,Sr.jsx)("div",{style:{position:"fixed",inset:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",padding:24,background:"rgba(0,0,0,0.7)",backdropFilter:"blur(4px)"},onClick:a,children:(0,Sr.jsxs)("div",{style:{borderRadius:16,padding:16,display:"flex",flexDirection:"column",gap:12,maxWidth:672,width:"100%",background:Re.surface,border:`1px solid ${Re.border}`},onClick:P=>P.stopPropagation(),children:[(0,Sr.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[(0,Sr.jsx)("span",{style:{fontSize:14,fontWeight:500,color:Re.fg},children:v("poster.title")}),(0,Sr.jsxs)("span",{style:{marginLeft:8,fontSize:11,fontVariantNumeric:"tabular-nums",color:Re.muted},children:[fg(w)," / ",fg(m)]}),(0,Sr.jsx)("div",{style:{flex:1}}),(0,Sr.jsx)("button",{onClick:a,style:{width:28,height:28,borderRadius:6,border:"none",background:"transparent",color:Re.muted,cursor:"pointer"},children:"\u2715"})]}),(0,Sr.jsx)("div",{style:{display:"flex",justifyContent:"center"},children:(0,Sr.jsx)(sg,{videoEl:ue,srcDims:ge,canvasDims:s,state:d,maxW:620,maxH:340})}),(0,Sr.jsx)("div",{style:{display:"flex",borderRadius:8,overflow:"hidden",height:44},children:Array.from({length:ws},(P,k)=>{let H=(k+.5)*(m/ws),T=Math.abs(w-H)<m/ws/2,_=h(H);return _?(0,Sr.jsx)("img",{src:_,alt:"",onClick:()=>de(H),style:{height:"100%",objectFit:"cover",cursor:"pointer",width:`${100/ws}%`,outline:T?`2px solid ${Re.accent}`:"none",outlineOffset:-2},draggable:!1},k):(0,Sr.jsx)("span",{style:{height:"100%",width:`${100/ws}%`,background:Re.chip},onClick:()=>de(H)},k)})}),(0,Sr.jsx)("input",{type:"range",min:0,max:Math.max(.1,m),step:.05,value:w,onChange:P=>de(Number(P.target.value)),style:{width:"100%"}}),(0,Sr.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:8},children:[(0,Sr.jsx)("button",{onClick:a,style:ve,children:v("act.cancel")}),(0,Sr.jsx)("button",{onClick:Ae,disabled:S,style:{padding:"8px 20px",borderRadius:8,fontSize:13,fontWeight:500,border:"none",cursor:"pointer",background:Re.accent,color:Re.accentFg,opacity:S?.6:1},children:v(S?"act.exporting":"act.exportPoster")})]})]})})}var ne=Ar(Jo(),1),rw=n=>Math.min(96,Math.max(12,Math.ceil(n/.5))),aw=4,iw=240,ow=80,lw=[.5,1,2,5,10,15,30,60],ef=10,tf=500,pg=[50,100,200],sw=["trim","crop","filter","annotate","sticker","resize"];function hg(n){return JSON.parse(JSON.stringify(n))}function sc(n){let a=Math.floor(n/60),o=n-a*60;return`${a}:${o.toFixed(1).padStart(4,"0")}`}function uw(n,a){if(a<1)return sc(n);let o=Math.floor(n/60),l=Math.round(n-o*60);return`${o}:${String(l).padStart(2,"0")}`}function uc(n){return Math.min(tf,Math.max(ef,Math.round(n)))}function cw(n,a,o=rw(a)){return new Promise(l=>{let s=document.createElement("video");s.src=n,s.muted=!0,s.preload="auto";let d=128,m=72,h=document.createElement("canvas");h.width=d,h.height=m;let g=h.getContext("2d");if(!g)return l([]);let v=[],w=0,W=()=>{if(w>=o)return l(v);s.currentTime=Math.min(Math.max(0,a-.05),(w+.5)*(a/o))};s.onseeked=()=>{let S=s.videoWidth/s.videoHeight||1,J=d/m,Y=s.videoWidth,ue=s.videoHeight,oe=0,ge=0;S>J?(Y=s.videoHeight*J,oe=(s.videoWidth-Y)/2):(ue=s.videoWidth/J,ge=(s.videoHeight-ue)/2),g.drawImage(s,oe,ge,Y,ue,0,0,d,m),v.push(h.toDataURL("image/jpeg",.5)),w++,W()},s.onloadedmetadata=W,s.onerror=()=>l(v)})}var dw=n=>({width:"var(--me-editor-tool-button-width, 72px)",minHeight:"var(--me-editor-tool-button-height, 66px)",padding:"8px 0",borderRadius:"var(--me-editor-tool-button-radius, 8px)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"var(--me-editor-tool-button-gap, 6px)",background:n?"color-mix(in srgb, var(--me-accent, #7c7cf0) 16%, transparent)":"transparent",color:n?"var(--me-accent, #7c7cf0)":Re.muted,border:"1px solid transparent",boxSizing:"border-box",cursor:"pointer",font:"inherit"}),mw={width:"var(--me-editor-tool-icon-size, 20px)",height:"var(--me-editor-tool-icon-size, 20px)",display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:1},fw={fontSize:"var(--me-editor-tool-label-size, 12px)",lineHeight:1.2},nr={background:Re.surface,color:Re.fg,border:"none",borderRadius:6,cursor:"pointer",font:"inherit"};function tl({children:n,viewBox:a="0 0 24 24"}){return(0,ne.jsx)("svg",{className:"me-video-tool-icon",viewBox:a,"aria-hidden":"true",focusable:"false",children:n})}function cc({children:n,viewBox:a="0 0 24 24"}){return(0,ne.jsx)("svg",{className:"me-video-history-icon",viewBox:a,"aria-hidden":"true",focusable:"false",children:n})}function pw(){return(0,ne.jsxs)(cc,{viewBox:"0 0 1024 1024",children:[(0,ne.jsx)("path",{d:"M495.7 313.1c-16.6 0-30 13.4-30 30v182.6c0 3.3 0.5 6.4 1.5 9.3 2.1 14.5 14.6 25.7 29.7 25.7h182.6c16.6 0 30-13.4 30-30s-13.4-30-30-30H525.7V343.1c0-16.6-13.4-30-30-30z",fill:"currentColor",stroke:"none"}),(0,ne.jsx)("path",{d:"M857.3 366.1c-18.9-44.6-45.9-84.7-80.3-119.1-34.4-34.4-74.5-61.4-119.1-80.3-46.2-19.5-95.3-29.5-145.9-29.5-44.8 0-88.7 7.8-130.3 23.3-40.3 14.9-77.4 36.6-110.4 64.3-47.2 39.6-83.8 90.2-106.6 146.6l-16.1-30c-7.8-14.6-26-20.1-40.6-12.2-14.6 7.8-20.1 26-12.2 40.6l51.1 95.1c0.3 0.6 0.7 1.2 1.1 1.8 0.2 0.4 0.5 0.7 0.7 1.1 0.1 0.2 0.3 0.4 0.4 0.7 5.8 7.9 14.8 12.2 24.2 12.2 4.8 0 9.7-1.2 14.2-3.6 0 0 0.1 0 0.1-0.1l95-51c14.6-7.8 20.1-26 12.2-40.6-7.8-14.6-26-20.1-40.6-12.2l-32.5 17.5c19.3-46.1 49.5-87.4 88.3-120 27.7-23.3 58.9-41.4 92.7-54 35-13 71.8-19.5 109.5-19.5 84.1 0 163.1 32.7 222.5 92.2s92.2 138.5 92.2 222.5-32.9 163.2-92.4 222.6-138.4 92.2-222.5 92.2-163.1-32.7-222.5-92.2c-11.7-11.7-30.7-11.7-42.4 0s-11.7 30.7 0 42.4c34.4 34.4 74.5 61.4 119.1 80.3 46.2 19.5 95.3 29.5 145.9 29.5s99.7-9.9 145.9-29.5c44.6-18.9 84.7-45.9 119.1-80.3 34.4-34.4 61.4-74.5 80.3-119.1 19.5-46.2 29.5-95.3 29.5-145.9s-10.1-99.5-29.6-145.8z",fill:"currentColor",stroke:"none"})]})}function hw(){return(0,ne.jsxs)(cc,{children:[(0,ne.jsx)("path",{d:"M9 7H5v4"}),(0,ne.jsx)("path",{d:"M5.4 10.5a7 7 0 0 1 11.9-2.7 7 7 0 0 1 0 8.4"})]})}function vw(){return(0,ne.jsxs)(cc,{children:[(0,ne.jsx)("path",{d:"M15 7h4v4"}),(0,ne.jsx)("path",{d:"M18.6 10.5A7 7 0 0 0 6.7 7.8a7 7 0 0 0 0 8.4"})]})}function gw(){return(0,ne.jsx)(cc,{children:(0,ne.jsx)("path",{d:"M6 4l12 8-6 1.5L9 20 6 4z"})})}function bw({open:n}){return(0,ne.jsx)("svg",{className:"me-video-preview-caret",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",style:{width:14,height:14,transform:n?"rotate(180deg)":void 0},children:(0,ne.jsx)("path",{d:"M4 6l4 4 4-4",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})}function vg({dir:n}){return(0,ne.jsx)("svg",{viewBox:"0 0 12 12",width:12,height:12,"aria-hidden":"true",focusable:"false",style:{display:"block",transform:n==="down"?"rotate(180deg)":void 0},children:(0,ne.jsx)("path",{d:"M3 7l3-3 3 3",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}function yw({id:n}){switch(n){case"trim":return(0,ne.jsx)(tl,{viewBox:"0 0 1024 1024",children:(0,ne.jsx)("path",{d:"M870.912 769.264941a26.352941 26.352941 0 0 1-23.070118 26.142118l-3.312941 0.210823h-228.382117a26.352941 26.352941 0 0 1-3.312942-52.525176l3.312942-0.180706 43.911529-0.030118V655.058824h-43.911529a26.352941 26.352941 0 0 1-3.312942-52.495059l3.312942-0.210824h202.029176v-193.264941h-202.029176a26.352941 26.352941 0 0 1-3.312942-52.495059l3.312942-0.210823h43.911529V268.528941h-43.911529a26.352941 26.352941 0 0 1-3.312942-52.495059l3.312942-0.180706h228.412235c13.432471 0 24.515765 10.029176 26.142117 23.04l0.210824 3.312942v527.058823z m-52.705882-114.206117h-105.411765v87.823058h105.411765V655.058824z m0-386.529883h-105.411765v87.853177h105.411765V268.528941zM150.588235 242.206118c0-13.432471 10.059294-24.545882 23.04-26.172236l3.312941-0.180706h228.382118a26.352941 26.352941 0 0 1 3.312941 52.495059l-3.312941 0.210824L361.411765 268.528941v87.853177h43.971764a26.352941 26.352941 0 0 1 3.312942 52.525176l-3.312942 0.180706h-202.089411V602.352941h202.089411a26.352941 26.352941 0 0 1 3.312942 52.495059l-3.312942 0.210824h-43.971764v87.823058h43.971764a26.352941 26.352941 0 0 1 3.312942 52.525177l-3.312942 0.210823H176.911059a26.352941 26.352941 0 0 1-26.142118-23.070117L150.588235 769.234824v-527.058824z m158.117647 412.852706h-105.411764v87.823058h105.411764V655.058824z m0-386.529883h-105.411764v87.853177h105.411764V268.528941zM510.735059 180.705882c13.432471 0 24.545882 10.059294 26.172235 23.04l0.180706 3.312942v70.26447a26.352941 26.352941 0 0 1-52.495059 3.312941l-0.210823-3.312941V207.058824c0-14.546824 11.806118-26.352941 26.352941-26.352942zM510.735059 356.382118c13.432471 0 24.545882 10.059294 26.172235 23.070117l0.180706 3.312941v70.264471a26.352941 26.352941 0 0 1-52.495059 3.312941l-0.210823-3.312941v-70.294588c0-14.546824 11.806118-26.352941 26.352941-26.352941zM510.735059 532.088471c13.432471 0 24.545882 10.029176 26.172235 23.04l0.180706 3.312941v70.26447a26.352941 26.352941 0 0 1-52.495059 3.312942l-0.210823-3.312942v-70.26447c0-14.576941 11.806118-26.352941 26.352941-26.352941zM510.735059 707.764706c13.432471 0 24.545882 10.059294 26.172235 23.04l0.180706 3.312941v70.264471a26.352941 26.352941 0 0 1-52.495059 3.312941l-0.210823-3.312941v-70.264471c0-14.546824 11.806118-26.352941 26.352941-26.352941z",fill:"currentColor",stroke:"none"})});case"crop":return(0,ne.jsxs)(tl,{children:[(0,ne.jsx)("path",{d:"M7 3v14a4 4 0 0 0 4 4h10"}),(0,ne.jsx)("path",{d:"M3 7h14a4 4 0 0 1 4 4v10"})]});case"filter":return(0,ne.jsxs)(tl,{children:[(0,ne.jsx)("circle",{cx:"8.5",cy:"8.5",r:"4.2"}),(0,ne.jsx)("circle",{cx:"15.5",cy:"8.5",r:"4.2"}),(0,ne.jsx)("circle",{cx:"12",cy:"15.5",r:"4.2"})]});case"annotate":return(0,ne.jsxs)(tl,{children:[(0,ne.jsx)("path",{d:"M4 20l4.6-1 9.8-9.8a2.1 2.1 0 0 0-3-3L5.6 16 4 20z"}),(0,ne.jsx)("path",{d:"M13.8 7.8l2.4 2.4"})]});case"sticker":return(0,ne.jsxs)(tl,{children:[(0,ne.jsx)("path",{d:"M6 5h12v8.5L13.5 18H6V5z"}),(0,ne.jsx)("path",{d:"M13.5 18v-4.5H18"}),(0,ne.jsx)("path",{d:"M9 9h.01"}),(0,ne.jsx)("path",{d:"M13 9h.01"}),(0,ne.jsx)("path",{d:"M9 12.5c1.4 1 2.6 1 4 0"})]});case"resize":return(0,ne.jsxs)(tl,{children:[(0,ne.jsx)("path",{d:"M4 9V4h5"}),(0,ne.jsx)("path",{d:"M20 15v5h-5"}),(0,ne.jsx)("path",{d:"M4 4l6 6"}),(0,ne.jsx)("path",{d:"M20 20l-6-6"})]})}}function xw({engine:n,client:a,source:o,t:l,onExported:s,onError:d,maxVideos:m=6,maxAudios:h=3}){let g=j2(n),v=O2(n),w=$2(n),W=(0,Ft.useRef)(null),S=(0,Ft.useRef)(null),J=(0,Ft.useRef)(null),Y=(0,Ft.useRef)(null),ue=(0,Ft.useRef)({x:.5,y:.5}),oe=(0,Ft.useRef)(null),ge=(0,Ft.useRef)(null),Be=(0,Ft.useRef)(null),Te=(0,Ft.useRef)(null),de=(0,Ft.useRef)(!1),Ae=(0,Ft.useRef)(null),ve=(0,Ft.useRef)(null),[P,k]=(0,Ft.useState)([]),[H,T]=(0,Ft.useState)([]),[_,le]=(0,Ft.useState)(0),[se,me]=(0,Ft.useState)(!1),[O,$]=(0,Ft.useState)(0),[M,A]=(0,Ft.useState)("trim"),[ee,Me]=(0,Ft.useState)({width:0,height:0}),[_e,x]=(0,Ft.useState)(!1),[C,j]=(0,Ft.useState)("brightness"),[B,G]=(0,Ft.useState)(""),[De,Q]=(0,Ft.useState)("fit"),[te,U]=(0,Ft.useState)(!1),[xe,Ce]=(0,Ft.useState)("100"),[Ze,et]=(0,Ft.useState)(!0),[lt,ot]=(0,Ft.useState)(""),[gt,Qt]=(0,Ft.useState)(!1),[_t,xt]=(0,Ft.useState)(!1),[Zt,tn]=(0,Ft.useState)(""),[_n,st]=(0,Ft.useState)(""),[Ge,mt]=(0,Ft.useState)(null),[Rt,Vt]=(0,Ft.useState)(null),[kn,xn]=(0,Ft.useState)(null),[Pe,dt]=(0,Ft.useState)(60),yt=(0,Ft.useRef)(60);yt.current=Pe;let pt=(0,Ft.useRef)([]),Mt=(0,Ft.useRef)([]),dn=(0,Ft.useRef)(g),Ut=(0,Ft.useRef)(!1),An=(0,Ft.useRef)(0),K=(0,Ft.useRef)(0),Le=(0,Ft.useRef)(null),Xe=(0,Ft.useRef)(!1),Tt=(0,Ft.useRef)(null),rn=(0,Ft.useRef)(0),Ot=(0,Ft.useRef)([]),nn=(0,Ft.useRef)(null),wn=(0,Ft.useRef)(()=>{});dn.current=g;let Z=g.clips,fe=(0,Ft.useRef)(Z);fe.current=Z;let Ne=ai(Z),Je=g.canvas,Et=g.audioClips??[],D=zm(Z,Et),V=P.length>0&&Z.length>0,Fe=P[Z[O]?.srcIdx]??P[0]??null,He=Fe?.el??null,Ye=Fe?.dims??{w:2,h:2},ct=N=>{K.current=N,$(I=>I===N?I:N)},kt=N=>{A(N)},rt=N=>{Te.current==null&&(Te.current=hg(N),x(!0))};(0,Ft.useLayoutEffect)(()=>{let N=S.current;if(!N)return;let I=0,we=()=>{I=0;let dr=N.getBoundingClientRect(),pr=window.getComputedStyle(N),na=parseFloat(pr.paddingLeft||"0")+parseFloat(pr.paddingRight||"0"),Pa=parseFloat(pr.paddingTop||"0")+parseFloat(pr.paddingBottom||"0"),fa=Math.max(0,Math.floor(dr.width-na)),Vr=Math.max(0,Math.floor(dr.height-Pa));if(fa<=0||Vr<=0){let hr=N.closest(".me-video-workspace");if(hr){let pa=window.getComputedStyle(hr),yr=hr.getBoundingClientRect(),ja=parseFloat(pa.paddingLeft||"0")+parseFloat(pa.paddingRight||"0"),fo=parseFloat(pa.paddingTop||"0")+parseFloat(pa.paddingBottom||"0"),oi=parseFloat(pa.columnGap||pa.gap||"0")||0,zs=hr.querySelector(".me-video-toolrail"),$i=hr.querySelector(".me-video-inspector-rail"),po=hr.querySelector(".me-video-trim-panel"),Oa=zs?zs.getBoundingClientRect():null,$a=$i&&!$i.hidden?$i.getBoundingClientRect():null,ho=po?po.getBoundingClientRect():null,Ps=Oa&&Oa.width>0?Oa.width:0,js=$a&&$a.width>0&&$a.height>0?$a.width:0,Os=ho&&ho.height>0?ho.height:0,pl=Ps>0?oi:0,Bc=js>0?oi:0,Dc=Os>0&&parseFloat(pa.rowGap||pa.gap||"0")||0;fa=fa>0?fa:Math.max(0,Math.floor(yr.width-ja-Ps-js-pl-Bc)),Vr=Vr>0?Vr:Math.max(0,Math.floor(yr.height-fo-Os-Dc))}}Me(hr=>hr.width===fa&&hr.height===Vr?hr:{width:fa,height:Vr})},tt=()=>{I||(I=requestAnimationFrame(we))},Qe=new ResizeObserver(tt),qt=N.closest(".me-video-workspace"),It=qt?qt.querySelector(".me-video-toolrail"):null,Kt=qt?qt.querySelector(".me-video-inspector-rail"):null,an=qt?qt.querySelector(".me-video-trim-panel"):null,Qn=typeof MutationObserver=="function"&&qt?new MutationObserver(tt):null;return Qe.observe(N),qt&&qt!==N&&Qe.observe(qt),It&&It!==N&&Qe.observe(It),Kt&&Kt!==N&&Qe.observe(Kt),an&&an!==N&&Qe.observe(an),Qn&&Qn.observe(qt,{childList:!0,subtree:!0}),tt(),()=>{I&&cancelAnimationFrame(I),Qn&&Qn.disconnect(),Qe.disconnect()}},[]),(0,Ft.useEffect)(()=>{if(!te)return;let N=I=>{Y.current?.contains(I.target)||U(!1)};return window.addEventListener("pointerdown",N),()=>window.removeEventListener("pointerdown",N)},[te]);let at=N=>{if(!N.type.startsWith("video/")){tn(l("err.notVideo"));return}if(pt.current.length>=m){tn(l("err.maxVideo",{max:m}));return}tn("");let I=URL.createObjectURL(N);Ot.current.push(I);let we=document.createElement("video");we.src=I,we.muted=!0,we.playsInline=!0,we.preload="auto",we.style.display="none",W.current?.appendChild(we),we.addEventListener("loadedmetadata",()=>{let tt={w:we.videoWidth,h:we.videoHeight},Qe=It=>{let Kt=n.registerVideoSource({duration:It,width:tt.w,height:tt.h});rt(n.getState()),pt.current=(()=>{let an=[...pt.current];return an[Kt]={file:N,url:I,el:we,duration:It,dims:tt,thumbs:[]},an})(),k(pt.current),setTimeout(()=>fn(),0),cw(I,It).then(an=>{pt.current=pt.current.map((Qn,dr)=>dr===Kt?{...Qn,thumbs:an}:Qn),k(pt.current)})};if(isFinite(we.duration)&&we.duration>0){Qe(we.duration);return}let qt=()=>{isFinite(we.duration)&&we.duration>0&&(we.removeEventListener("durationchange",qt),we.currentTime=0,Qe(we.duration))};we.addEventListener("durationchange",qt),we.currentTime=1e7},{once:!0}),we.addEventListener("error",()=>tn(l("err.videoLoad")),{once:!0})},Ke=N=>{if(!N.type.startsWith("audio/")&&!N.type.startsWith("video/")){tn(l("err.notAudio"));return}if(Mt.current.length>=h){tn(l("err.maxAudio",{max:h}));return}tn("");let I=URL.createObjectURL(N);Ot.current.push(I);let we=new Audio;we.src=I,we.preload="auto",we.addEventListener("loadedmetadata",()=>{let tt=n.registerAudioSource({duration:we.duration});Mt.current=(()=>{let Qe=[...Mt.current];return Qe[tt]={file:N,url:I,el:we,duration:we.duration},Qe})(),T(Mt.current)},{once:!0}),we.addEventListener("error",()=>tn(l("err.audioLoad")),{once:!0})},Nt=()=>{pt.current.forEach(N=>{N&&(N.el.pause(),N.el.remove())}),Mt.current.forEach(N=>N?.el.pause()),Ot.current.forEach(N=>URL.revokeObjectURL(N)),Ot.current=[],pt.current=[],Mt.current=[],Ut.current=!1,An.current=0,K.current=0,Xe.current=!1,Le.current=null,Tt.current=null,ve.current=null,Te.current=null,n.reset(Ju()),k([]),T([]),me(!1),le(0),$(0),A("trim"),G(""),Q("fit"),U(!1),Ce("100"),x(!1),st(""),mt(null),Vt(null),xn(null),Qt(!1),ot(""),tn("")};(0,Ft.useEffect)(()=>{!o||nn.current===o||(nn.current=o,Nt(),at(o))},[o]),(0,Ft.useEffect)(()=>{let N=Ot.current;return()=>{pt.current.forEach(I=>I?.el.pause()),Mt.current.forEach(I=>I?.el.pause()),N.forEach(I=>URL.revokeObjectURL(I))}},[]),(0,Ft.useEffect)(()=>{let N=P[0]?.thumbs;N?.length&&st(N[Math.floor(N.length/2)])},[P]);let Wt=N=>pt.current[fe.current[N]?.srcIdx],Ct=()=>{if(Xe.current)return;let N=K.current,I=fe.current[N],we=Wt(N);if(!I||!we)return;let tt=Math.min(Math.max(we.el.currentTime-I.in,0),vs(I)),Qe=Qu(fe.current,N)+tt;An.current=Qe,le(qt=>Math.abs(qt-Qe)>.004?Qe:qt)},bt=()=>{if(Xe.current)return;let N=fe.current,I=K.current,we=N[I],tt=Wt(I);if(!we||!tt)return;let Qe=tt.el;if(Qe.paused&&!Qe.ended)return;let qt=Qe.currentTime;if(Le.current!=null){let It=Le.current;It.el===Qe&&Math.abs(qt-It.t)<=.25&&(Le.current=null);return}if(qt>=we.out-.04){let It=N[I+1];if(It){let Kt=pt.current[It.srcIdx];if(!Kt)return;ct(I+1),Le.current={el:Kt.el,t:It.in},Kt.el===Qe?(Qe.currentTime=It.in,(Qe.ended||Qe.paused)&&Qe.play().catch(()=>{})):(Qe.muted=!0,Qe.pause(),Kt.el.muted=!dn.current.keepAudio,Kt.el.currentTime=It.in,Kt.el.play().catch(()=>{}))}else{Qe.pause(),Ut.current=!1,me(!1);let Kt=N[0],an=pt.current[Kt.srcIdx];ct(0),an&&(Le.current={el:an.el,t:Kt.in},an.el.currentTime=Kt.in)}}else if(qt>=we.out-1){let It=N[I+1];if(It){let Kt=pt.current[It.srcIdx];Kt&&Kt.el!==Qe&&Kt.el.paused&&Math.abs(Kt.el.currentTime-It.in)>.2&&(Kt.el.currentTime=It.in)}}},$t=()=>{let N=dn.current,I=fe.current[K.current]?.srcIdx;pt.current.forEach((Qe,qt)=>{if(!Qe)return;let It=!N.keepAudio||qt!==I;Qe.el.muted!==It&&(Qe.el.muted=It)});let we=An.current,tt=Ut.current&&!Xe.current;(N.audioClips??[]).forEach(Qe=>{let qt=Mt.current[Qe.srcIdx];if(!qt)return;let It=qt.el,Kt=Qe.out-Qe.in;if(tt&&we>=Qe.startAt&&we<Qe.startAt+Kt){let an=Qe.in+(we-Qe.startAt);Math.abs(It.currentTime-an)>.3&&(It.currentTime=an),It.volume=Math.min(1,Qe.volume),It.paused&&It.play().catch(()=>{})}else It.paused||It.pause()})},un=N=>{let I=fe.current,we=Math.min(Math.max(0,N),ai(I));An.current=we,le(we);let tt=io(I,we);if(!tt)return;let Qe=pt.current[I[tt.idx].srcIdx];if(!Qe)return;pt.current.forEach(It=>{It&&It.el!==Qe.el&&(It.el.muted=!0,It.el.paused||It.el.pause())}),Qe.el.muted=!dn.current.keepAudio,ct(tt.idx),Le.current=null;let qt=performance.now();qt-rn.current>60?(rn.current=qt,Qe.el.currentTime=tt.srcTime,Tt.current=null):Tt.current={el:Qe.el,t:tt.srcTime},wn.current()},pn=()=>{let N=fe.current;if(!N.length)return;if(Ut.current){Wt(K.current)?.el.pause(),Mt.current.forEach(Qe=>Qe?.el.pause()),Ut.current=!1,me(!1),wn.current();return}let I=An.current;I>=ai(N)-.05&&(I=0);let we=io(N,I);if(!we)return;let tt=pt.current[N[we.idx].srcIdx];tt&&(ct(we.idx),Le.current=null,tt.el.muted=!dn.current.keepAudio,tt.el.currentTime=we.srcTime,Ut.current=!0,me(!0),wn.current(),tt.el.play().catch(()=>{Ut.current=!1,me(!1)}))};(0,Ft.useEffect)(()=>{let N=0,I=()=>{N=0,Tt.current!=null&&performance.now()-rn.current>60&&(rn.current=performance.now(),Tt.current.el.currentTime=Tt.current.t,Tt.current=null),Ct(),Ut.current&&bt(),$t(),(Ut.current||Tt.current)&&(N=requestAnimationFrame(I))};return wn.current=()=>{N||(N=requestAnimationFrame(I))},wn.current(),()=>{wn.current=()=>{},cancelAnimationFrame(N)}},[]),(0,Ft.useEffect)(()=>{let N=()=>{Ct(),Ut.current&&bt(),$t()},I=P.map(we=>we?.el).filter(Boolean);return I.forEach(we=>{we.addEventListener("timeupdate",N),we.addEventListener("ended",N)}),()=>I.forEach(we=>{we.removeEventListener("timeupdate",N),we.removeEventListener("ended",N)})},[P]),(0,Ft.useEffect)(()=>{let N=io(Z,Math.min(An.current,Math.max(0,ai(Z)-.01)));ct(N?N.idx:0),Le.current=null,mt(I=>I!=null&&I>=(g.audioClips?.length??0)?null:I)},[Z,g.audioClips]),(0,Ft.useEffect)(()=>{Te.current==null&&g.clips.length>0&&rt(g)},[g]);let Lt=N=>{let I=ge.current;return!I||yt.current<=0?0:Math.max(0,(N-I.getBoundingClientRect().left)/yt.current)},Xt=N=>Math.min(iw,Math.max(aw,N)),en=(N,I,we)=>{let tt=Xt(N);tt!==yt.current&&(Ae.current={time:I,viewportX:we},yt.current=tt,dt(tt))},Tn=N=>{let I=oe.current;if(!I)return;let we=yt.current,tt=An.current*we,Qe=tt>=I.scrollLeft&&tt<=I.scrollLeft+I.clientWidth?An.current:(I.scrollLeft+I.clientWidth/2)/we;en(we*N,Qe,Qe*we-I.scrollLeft)},fn=()=>{let N=oe.current,I=zm(fe.current,dn.current.audioClips??[]);if(!N||I<=0)return;let we=Xt(N.clientWidth/I);if(we===yt.current){N.scrollLeft=0;return}Ae.current={time:0,viewportX:0},yt.current=we,dt(we)};(0,Ft.useLayoutEffect)(()=>{if(de.current)return;let N=oe.current;if(!N||D<=0)return;de.current=!0;let I=Xt(N.clientWidth/D);yt.current=I,dt(I)},[V,M,D]),(0,Ft.useLayoutEffect)(()=>{let N=Ae.current;if(!N)return;Ae.current=null;let I=oe.current;I&&(I.scrollLeft=Math.max(0,N.time*Pe-N.viewportX))},[Pe]),(0,Ft.useEffect)(()=>{let N=oe.current;if(!N)return;let I=we=>{if(we.ctrlKey||we.metaKey){we.preventDefault();let tt=we.clientX-N.getBoundingClientRect().left,Qe=yt.current;en(Qe*Math.pow(1.0015,-we.deltaY),(N.scrollLeft+tt)/Qe,tt)}else Math.abs(we.deltaY)>Math.abs(we.deltaX)&&(we.preventDefault(),N.scrollLeft+=we.deltaY)};return N.addEventListener("wheel",I,{passive:!1}),()=>N.removeEventListener("wheel",I)},[V,M]),(0,Ft.useEffect)(()=>{if(!se||Xe.current)return;let N=oe.current;if(!N||N.scrollWidth<=N.clientWidth)return;let I=_*Pe;(I<N.scrollLeft+20||I>N.scrollLeft+N.clientWidth-60)&&(N.scrollLeft=Math.max(0,I-N.clientWidth*.3))},[_,se,Pe]);let zn=N=>{let I=ve.current;if(!I)return;if(I.kind==="playhead"){un(Lt(N.clientX));return}let we=Lt(N.clientX);if(I.kind==="clipIn"||I.kind==="clipOut"){let Kt=I.orig[I.idx],an=pt.current[Kt.srcIdx],Qn=an?.duration??Kt.out,dr=Kt.in+(we-I.origStart);v({clips:M0(I.orig,I.idx,I.kind==="clipIn"?"in":"out",dr,Qn)}),an&&(Xe.current=!0,ct(I.idx),an.el.muted=!0,an.el.currentTime=Math.min(Math.max(dr,0),Qn));return}let tt=dn.current.audioClips??[],Qe=tt[I.idx];if(!Qe)return;let qt=Mt.current[Qe.srcIdx],It=ai(fe.current);if(I.kind==="audioMove")v({audioClips:tt.map((Kt,an)=>an===I.idx?gs({...Qe,startAt:I.origStartAt+(we-I.downT)},qt?.duration??Qe.out,It):Kt)});else if(I.kind==="audioIn"){let Kt=we-I.downT,an=gs({...Qe,in:I.origIn+Kt,startAt:Qe.startAt+(Math.min(Math.max(I.origIn+Kt,0),Qe.out-.1)-Qe.in)},qt?.duration??Qe.out,It);v({audioClips:tt.map((Qn,dr)=>dr===I.idx?an:Qn)})}else{let Kt=gs({...Qe,out:I.origOut+(we-I.downT)},qt?.duration??Qe.out,It);v({audioClips:tt.map((an,Qn)=>Qn===I.idx?Kt:an)})}},Dr=()=>{let N=ve.current&&ve.current.kind!=="playhead";ve.current=null,Xe.current=!1,window.removeEventListener("pointermove",zn),window.removeEventListener("pointerup",Dr),N&&w()},Hn=N=>I=>{I.preventDefault(),I.stopPropagation(),ve.current=N,window.addEventListener("pointermove",zn),window.addEventListener("pointerup",Dr),N.kind==="playhead"&&(Xe.current=!0,un(Lt(I.clientX)))},ur=N=>I=>{I.preventDefault(),I.stopPropagation();let we=Be.current,tt=Array.from(we?.querySelectorAll("[data-clipblock]")??[]).map(pr=>{let na=pr.getBoundingClientRect();return na.left+na.width/2}),Qe=I.clientX,qt=performance.now(),It=N,Kt=N,an=!1;ct(N),Vt(N),xn(N);let Qn=pr=>{Math.abs(pr.clientX-Qe)>4&&(an=!0);let na=0,Pa=1/0;tt.forEach((fa,Vr)=>{let hr=Math.abs(pr.clientX-fa);hr<Pa&&(Pa=hr,na=Vr)}),Kt=na,xn(na)},dr=()=>{window.removeEventListener("pointermove",Qn),window.removeEventListener("pointerup",dr),Vt(null),xn(null),an&&It!==Kt&&w({clips:F0(n.getState().clips,It,Kt)}),ct(Kt)};window.addEventListener("pointermove",Qn),window.addEventListener("pointerup",dr)},Zn=N=>{G(N);let I=Gm.find(tt=>tt.ratio===N);if(!I||Je.w<4){N||w({crop:void 0});return}let we=Go(Je.w,Je.h,g.rotation);w({crop:ec({w:we.w,h:we.h},I.value)})},Fr=async()=>{tn(""),ot(l("msg.processing")),Qt(!0);try{let N=await c2(n,pt.current.map(qt=>qt?.file),Mt.current.map(qt=>qt?.file)),I=await a.exportVideo(N),we=new Date,tt=[we.getHours(),we.getMinutes(),we.getSeconds()].map(qt=>String(qt).padStart(2,"0")).join(""),Qe=pt.current[0]?.file.name?.replace(/\.[^.]+$/,"")||"video";s?.(I,`${Qe}_edited_${tt}.mp4`),Qt(!1),ot(l("msg.done")),setTimeout(()=>ot(""),1500)}catch(N){Qt(!1),ot(""),tn(N.message),d?.(N)}},z=()=>{let N=Te.current;if(!N)return;pt.current.forEach(Qe=>{Qe&&(Qe.el.pause(),Qe.el.muted=!0)}),Mt.current.forEach(Qe=>Qe?.el.pause()),Ut.current=!1,me(!1),Xe.current=!1,Le.current=null,Tt.current=null,ve.current=null,mt(null),Vt(null),xn(null),G(""),Qt(!1),ot(""),tn("");let I=hg(N);n.reset(I);let we=I.clips[0],tt=we?pt.current[we.srcIdx]:null;ct(0),An.current=0,le(0),tt&&(tt.el.currentTime=we?.in??0,tt.el.muted=!I.keepAudio,wn.current())},ie=M==="crop"||M==="annotate"||M==="sticker",Oe=oo(Je,g),E=Ne,F=ee.width>0&&ee.width<=520?M==="trim"||M==="filter"?150:M==="sticker"?132:M==="annotate"?116:M==="crop"?78:M==="resize"?82:M==="filter"?92:72:M==="trim"||M==="filter"?220:M==="resize"?116:M==="filter"?110:96,p=S.current&&window.getComputedStyle(S.current).display==="contents"&&(M==="trim"||M==="filter")?0:F,b=V&&!ie?76:0,L=Math.max(240,ee.width),q=Math.max(160,ee.height-p-b),Ee=M==="crop"?Go(Je.w,Je.h,g.rotation):Oe,be=Ee.w?Math.max(1,Math.round(Math.min(L/Ee.w,q/Ee.h,1)*100)):100,je=De==="fit"?null:uc(De),ae=Math.max(2,Math.round(Oe.w*(je??be)/100)),ke=Math.max(2,Math.round(Oe.h*(je??be)/100)),Ve=je==null?"100%":Math.max(ae,L),We=Math.max(ke,q),ft=je??be,nt=uc(ft),it=De==="fit"?`${l("act.fit")} ${be}%`:`${ft}%`,ht=`${Oe.w} x ${Oe.h} px`,wt=N=>{Rn(),Q(N==="fit"?"fit":uc(N))},Bt=N=>{let I=uc(N);Ce(String(I)),wt(I)},jt=()=>{let N=Number(xe);if(!Number.isFinite(N)){Ce(String(nt));return}Bt(N)},on=N=>{let I=Number(xe);Bt((Number.isFinite(I)?I:nt)+N)};(0,Ft.useEffect)(()=>{Ce(String(nt))},[nt]),(0,Ft.useEffect)(()=>{if(!V)return;let N=I=>{if(I.defaultPrevented||!I.shiftKey||I.metaKey||I.ctrlKey||I.altKey)return;let we=I.target,tt=we?.tagName?.toLowerCase();if(tt==="input"||tt==="textarea"||tt==="select"||we?.isContentEditable)return;let Qe=I.key.toLowerCase();if(Qe==="f"){I.preventDefault(),wt("fit"),U(!1);return}let qt=Number(Qe)-1,It=pg[qt];It!=null&&(I.preventDefault(),wt(It),U(!1))};return window.addEventListener("keydown",N),()=>window.removeEventListener("keydown",N)},[V,nt]);let Rn=()=>{let N=J.current;N&&(ue.current={x:N.scrollWidth>N.clientWidth?(N.scrollLeft+N.clientWidth/2)/N.scrollWidth:.5,y:N.scrollHeight>N.clientHeight?(N.scrollTop+N.clientHeight/2)/N.scrollHeight:.5})};(0,Ft.useEffect)(()=>{let N=J.current;if(N)return N.addEventListener("scroll",Rn,{passive:!0}),()=>N.removeEventListener("scroll",Rn)},[V,M]),(0,Ft.useLayoutEffect)(()=>{let N=J.current;if(!N)return;let I=ue.current,we=requestAnimationFrame(()=>{N.scrollLeft=Math.max(0,N.scrollWidth*I.x-N.clientWidth/2),N.scrollTop=Math.max(0,N.scrollHeight*I.y-N.clientHeight/2),Rn()});return()=>cancelAnimationFrame(we)},[ae,ke,Ve,We]);let cr=(0,Ft.useMemo)(()=>{if(!isFinite(D)||D<=0||Pe<=0)return[];let N=lw.find(we=>we*Pe>=ow)??60;for(;D/N>1500;)N*=2;let I=[];for(let we=0;we<=D+1e-6;we+=N)I.push({x:we*Pe,label:uw(we,N)});return I},[D,Pe]),Mr=N=>{let I=P[N.srcIdx];if(!I?.thumbs.length||!I.duration)return[];let we=I.thumbs.length,tt=I.duration/we,Qe=Math.max(1,Math.ceil(8/(tt*Pe))),qt=Math.max(0,Math.floor(N.in/tt)),It=Math.min(we,Math.ceil(N.out/tt)),Kt=[];for(let an=qt-qt%Qe;an<It;an+=Qe)Kt.push({key:an,src:I.thumbs[Math.min(we-1,an)],left:(an*tt-N.in)*Pe,width:tt*Pe*Qe+.5});return Kt},ar=N=>{let I=io(fe.current,N);if(!I)return;let we=pt.current[fe.current[I.idx].srcIdx];if(!we?.thumbs.length||!we.duration)return;let tt=Math.min(we.thumbs.length-1,Math.max(0,Math.floor(I.srcTime/we.duration*we.thumbs.length)));return we.thumbs[tt]};return(0,ne.jsxs)("div",{className:"me-video-editor",style:{position:"relative",height:"100%",minHeight:0,display:"flex",flexDirection:"column",borderRadius:12,overflow:"hidden",background:Re.bg,border:`1px solid ${Re.border}`,color:Re.fg,fontSize:13,fontFamily:'-apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif',lineHeight:1.4},children:[(0,ne.jsxs)("div",{className:"me-video-topbar",style:{position:"relative",zIndex:30,overflow:"visible",display:"flex",alignItems:"center",padding:"8px 12px",borderBottom:`1px solid ${Re.border}`},children:[(0,ne.jsxs)("div",{className:"me-video-history",style:{display:"flex",alignItems:"center",gap:4},children:[(0,ne.jsx)("button",{onClick:z,disabled:!_e,style:{...nr,width:32,height:32,background:"transparent",color:Re.muted,opacity:_e?1:.4,display:"inline-flex",alignItems:"center",justifyContent:"center"},title:l("tip.resetOpened"),children:(0,ne.jsx)(pw,{})}),(0,ne.jsx)("button",{onClick:()=>n.undo(),disabled:!n.canUndo(),style:{...nr,width:32,height:32,background:"transparent",color:Re.muted,opacity:n.canUndo()?1:.4,display:"inline-flex",alignItems:"center",justifyContent:"center"},title:l("tip.undo"),children:(0,ne.jsx)(hw,{})}),(0,ne.jsx)("button",{onClick:()=>n.redo(),disabled:!n.canRedo(),style:{...nr,width:32,height:32,background:"transparent",color:Re.muted,opacity:n.canRedo()?1:.4,display:"inline-flex",alignItems:"center",justifyContent:"center"},title:l("tip.redo"),children:(0,ne.jsx)(vw,{})})]}),(0,ne.jsxs)("div",{className:"me-video-preview-zoom",style:{position:"absolute",zIndex:80,left:"50%",transform:"translateX(-50%)",display:"flex",alignItems:"center",gap:6,color:Re.muted,fontSize:12},children:[(0,ne.jsx)("span",{className:"me-video-preview-resolution",style:{minWidth:106,textAlign:"right",color:Re.muted,fontVariantNumeric:"tabular-nums",whiteSpace:"nowrap"},children:V?ht:"-- x -- px"}),(0,ne.jsx)("button",{type:"button",className:"me-video-preview-tool-button is-active",disabled:!V,title:l("tip.previewPointer"),"aria-label":l("tip.previewPointer"),style:{...nr,width:32,height:32,borderRadius:10,background:"color-mix(in srgb, var(--me-accent, #7c7cf0) 16%, transparent)",color:Re.accent,opacity:V?1:.45,display:"inline-flex",alignItems:"center",justifyContent:"center",padding:0},children:(0,ne.jsx)(gw,{})})]}),(0,ne.jsx)("div",{style:{flex:1}}),(0,ne.jsx)("button",{className:"me-video-poster",onClick:()=>{Ut.current&&pn(),xt(!0)},disabled:!V,style:{...nr,padding:"6px 12px",background:Re.chip,color:Re.muted,marginRight:8,opacity:V?1:.4},title:l("tip.poster"),children:l("act.poster")}),(0,ne.jsx)("button",{className:"me-video-done",onClick:Fr,disabled:gt||!!lt||!V,style:{padding:"6px 20px",borderRadius:8,fontSize:13,fontWeight:600,border:"none",cursor:"pointer",background:"var(--me-video-done-bg, var(--me-accent,#5b5bd6))",color:"var(--me-video-done-fg, var(--me-accent-fg,#fff))",opacity:gt||lt||!V?.6:1},children:gt?l("act.exporting"):l("act.exportPoster").replace("\u5C01\u9762","").replace(/\s*cover/i,"").trim()||"Done"})]}),(0,ne.jsxs)("div",{className:"me-video-workspace",style:{flex:"1 1 0",minHeight:0,display:"flex",alignItems:"stretch",gap:8,padding:12},children:[(0,ne.jsx)("div",{className:"me-video-toolrail",style:{position:"relative",zIndex:20,display:"flex",flexDirection:"column",gap:6,flexShrink:0},children:sw.map(N=>(0,ne.jsxs)("button",{className:M===N?"is-active":void 0,onClick:()=>kt(N),style:dw(M===N),children:[(0,ne.jsx)("span",{style:mw,children:(0,ne.jsx)(yw,{id:N})}),(0,ne.jsx)("span",{style:fw,children:l(`tool.${N}`)})]},N))}),(0,ne.jsxs)("div",{ref:S,className:"me-video-main",style:{position:"relative",zIndex:1,overflow:"hidden",flex:1,minWidth:0,minHeight:0,boxSizing:"border-box",display:"flex",flexDirection:"column",alignItems:"center"},children:[(0,ne.jsx)("div",{ref:W,style:{display:"none"}}),!V&&(0,ne.jsxs)("label",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:8,height:320,color:Re.muted,cursor:"pointer"},children:[(0,ne.jsx)("span",{style:{fontSize:32},children:"\u{1F3AC}"}),(0,ne.jsx)("span",{style:{...nr,background:Re.accent,color:Re.accentFg,padding:"8px 16px"},children:l("panel.pick")}),(0,ne.jsx)("input",{type:"file",accept:"video/*",style:{display:"none"},onChange:N=>{let I=N.target.files?.[0];I&&at(I),N.target.value=""}})]}),V&&!ie&&(0,ne.jsxs)("div",{className:"me-video-preview-shell",style:{width:"100%",flex:"1 1 auto",minHeight:0,display:"flex",flexDirection:"column",alignItems:"stretch",gap:12},children:[(0,ne.jsx)("div",{ref:J,className:"me-video-preview-scroll me-video-canvas-scroll",style:{position:"relative",zIndex:0,flex:"1 1 auto",minHeight:0,width:"100%",maxWidth:"100%",maxHeight:q,overflow:"auto",overscrollBehavior:"contain",padding:"14px 16px 10px",boxSizing:"border-box",background:"var(--me-surface)",borderRadius:18},children:(0,ne.jsx)("div",{className:"me-video-canvas-stage",style:{position:"relative",width:Ve,minWidth:"100%",minHeight:We,display:"grid",placeItems:"center"},children:(0,ne.jsx)(sg,{videoEl:He,srcDims:Ye,canvasDims:Je,state:g,maxW:L,maxH:q,zoomPercent:je,onClick:M==="trim"?pn:void 0})})}),(0,ne.jsxs)("div",{className:"me-video-preview-footer",style:{flexShrink:0,minHeight:58,padding:"0 14px",borderRadius:16,background:"var(--me-surface)",boxShadow:"0 12px 30px rgba(0,0,0,0.12)",display:"grid",gridTemplateColumns:"minmax(0,1fr) auto minmax(0,1fr)",alignItems:"center",gap:12,color:Re.fg},children:[(0,ne.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,minWidth:0,fontSize:13,fontVariantNumeric:"tabular-nums",whiteSpace:"nowrap",overflow:"hidden"},children:[(0,ne.jsx)("span",{style:{color:"#00c8ff",fontWeight:600},children:sc(_)}),(0,ne.jsx)("span",{style:{color:Re.muted},children:`/ ${sc(Ne)}`})]}),(0,ne.jsx)("button",{type:"button",onClick:pn,disabled:!V,style:{...nr,width:38,height:38,borderRadius:999,background:"color-mix(in srgb, var(--me-fg, #ededf0) 8%, transparent)",color:Re.fg,display:"inline-flex",alignItems:"center",justifyContent:"center",padding:0,opacity:V?1:.45},children:se?"\u23F8":"\u25B6"}),(0,ne.jsx)("div",{style:{display:"flex",justifyContent:"flex-end"},children:(0,ne.jsxs)("div",{className:"me-video-preview-zoom-menu",ref:Y,style:{position:"relative"},children:[(0,ne.jsxs)("button",{type:"button",onClick:()=>U(N=>!N),disabled:!V,title:l("tip.previewZoom"),"aria-label":l("tip.previewZoom"),style:{...nr,minWidth:112,height:38,padding:"0 10px 0 14px",borderRadius:12,background:"color-mix(in srgb, var(--me-fg, #ededf0) 8%, transparent)",color:V?Re.fg:Re.muted,opacity:V?1:.45,display:"inline-flex",alignItems:"center",justifyContent:"space-between",gap:8,fontSize:13,lineHeight:1},children:[(0,ne.jsx)("span",{children:it}),(0,ne.jsx)(bw,{open:te})]}),te&&(0,ne.jsxs)("div",{className:"me-video-preview-zoom-popover",style:{position:"absolute",right:0,bottom:50,zIndex:4e3,width:300,padding:14,borderRadius:12,border:`1px solid ${Re.border}`,background:"var(--me-surface)",boxShadow:"0 16px 42px rgba(0,0,0,0.18)",color:Re.fg},children:[(0,ne.jsx)("div",{style:{color:Re.muted,fontSize:12,marginBottom:10},children:l("lbl.zoomSize")}),(0,ne.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) 112px",gap:12,alignItems:"center"},children:[(0,ne.jsx)("input",{className:"me-video-preview-zoom-slider",type:"range",min:ef,max:tf,step:1,value:nt,onChange:N=>wt(Number(N.target.value)),"aria-label":l("tip.previewZoom"),style:{width:"100%",minWidth:0}}),(0,ne.jsxs)("span",{className:"me-video-preview-zoom-number",style:{height:34,borderRadius:9,background:Re.chip,display:"grid",gridTemplateColumns:"minmax(0, 1fr) auto 22px",alignItems:"center",overflow:"hidden",fontVariantNumeric:"tabular-nums",color:Re.fg},children:[(0,ne.jsx)("input",{className:"me-video-preview-zoom-input",type:"number",min:ef,max:tf,step:1,value:xe,onChange:N=>Ce(N.target.value.replace(/[^\d.]/g,"")),onBlur:jt,onKeyDown:N=>{N.key==="Enter"&&N.currentTarget.blur(),N.key==="Escape"&&(Ce(String(nt)),N.currentTarget.blur())},"aria-label":l("tip.previewZoom"),style:{width:"100%",minWidth:0,height:"100%",padding:"0 0 0 10px",border:0,outline:0,background:"transparent",color:Re.fg,font:"inherit",fontSize:13,textAlign:"right",fontVariantNumeric:"tabular-nums"}}),(0,ne.jsx)("span",{style:{padding:"0 4px 0 1px",fontSize:13},children:"%"}),(0,ne.jsxs)("span",{className:"me-video-preview-zoom-stepper",style:{width:22,height:"100%",display:"grid",gridTemplateRows:"1fr 1fr",borderLeft:`1px solid ${Re.border}`},children:[(0,ne.jsx)("button",{type:"button",onClick:()=>on(1),"aria-label":l("tip.zoomIn"),style:{...nr,width:22,height:17,minHeight:0,padding:0,borderRadius:0,background:"transparent",color:Re.muted,display:"inline-flex",alignItems:"center",justifyContent:"center"},children:(0,ne.jsx)(vg,{dir:"up"})}),(0,ne.jsx)("button",{type:"button",onClick:()=>on(-1),"aria-label":l("tip.zoomOut"),style:{...nr,width:22,height:17,minHeight:0,padding:0,borderRadius:0,background:"transparent",color:Re.muted,display:"inline-flex",alignItems:"center",justifyContent:"center"},children:(0,ne.jsx)(vg,{dir:"down"})})]})]})]}),(0,ne.jsx)("div",{style:{height:1,background:Re.border,margin:"14px 0 8px"}}),(0,ne.jsxs)("button",{type:"button",className:"me-video-preview-zoom-shortcut",onClick:()=>{wt("fit"),U(!1)},style:{...nr,width:"100%",height:32,justifyContent:"space-between",background:"transparent",color:Re.fg,display:"flex",alignItems:"center",padding:"0 2px",fontSize:13},children:[(0,ne.jsx)("span",{children:l("act.zoomFit")}),(0,ne.jsx)("span",{style:{color:Re.muted},children:l("kbd.fit")})]}),pg.map((N,I)=>(0,ne.jsxs)("button",{type:"button",className:"me-video-preview-zoom-shortcut",onClick:()=>{wt(N),U(!1)},style:{...nr,width:"100%",height:32,justifyContent:"space-between",background:"transparent",color:Re.fg,display:"flex",alignItems:"center",padding:"0 2px",fontSize:13},children:[(0,ne.jsx)("span",{children:l("act.zoomTo",{value:N})}),(0,ne.jsx)("span",{style:{color:Re.muted},children:`\u21E7 ${I+1}`})]},N))]})]})})]})]}),V&&M==="crop"&&(0,ne.jsx)(H2,{videoEl:He,srcDims:Ye,canvasDims:Je,state:g,patchLive:v,commit:w,ratioPreset:B,onRatioPreset:Zn,onConfirm:()=>A("trim"),maxW:L,maxH:q,zoomPercent:je,t:l}),V&&(M==="annotate"||M==="sticker")&&(0,ne.jsx)(J2,{videoEl:He,srcDims:Ye,canvasDims:Je,state:g,mode:M,patchLive:v,commit:w,maxW:L,maxH:q,zoomPercent:je,t:l}),V&&(M==="trim"||M==="filter")&&(0,ne.jsxs)("div",{className:"me-video-trim-panel",style:{width:"100%",marginTop:12},children:[(0,ne.jsxs)("div",{className:"me-video-trim-actions",style:{position:"relative",display:"flex",alignItems:"center",gap:8,marginBottom:8,padding:"6px 8px",borderRadius:8,background:Re.chip},children:[(0,ne.jsxs)("div",{className:"me-video-trim-action-btn",role:"button",tabIndex:0,onClick:()=>n.splitAtPlayhead(_),style:{...nr,padding:"0 14px",height:32,borderRadius:999,fontWeight:500,display:"flex",justifyContent:"center",alignItems:"center"},title:l("tip.split"),"aria-label":l("tip.split"),children:[(0,ne.jsx)("span",{className:"me-video-trim-action-icon","aria-hidden":"true",children:"\u2702"}),(0,ne.jsx)("span",{className:"me-video-trim-action-label",children:l("act.split")})]}),(0,ne.jsxs)("div",{className:"me-video-trim-action-btn",role:"button",tabIndex:Z[O]?0:-1,onClick:()=>{Z[O]&&n.duplicateClip(O)},"aria-disabled":Z[O]?"false":"true",style:{...nr,padding:"0 14px",height:32,borderRadius:999,fontWeight:500,display:"flex",justifyContent:"center",alignItems:"center",color:Z[O]?Re.fg:Re.muted,opacity:Z[O]?1:.5},title:l("tip.dupClip"),"aria-label":l("tip.dupClip"),children:[(0,ne.jsx)("span",{className:"me-video-trim-action-icon","aria-hidden":"true",children:"\u29C9"}),(0,ne.jsx)("span",{className:"me-video-trim-action-label",children:l("act.copy")})]}),(0,ne.jsxs)("div",{className:"me-video-trim-action-btn",role:"button",tabIndex:Z.length<=1?-1:0,onClick:()=>{Z.length>1&&n.removeClip(O)},"aria-disabled":Z.length<=1?"true":"false",style:{...nr,padding:"0 14px",height:32,borderRadius:999,fontWeight:500,display:"flex",justifyContent:"center",alignItems:"center",color:Z.length<=1?Re.muted:"#fca5a5",opacity:Z.length<=1?.5:1},title:l("tip.delClip"),"aria-label":l("tip.delClip"),children:[(0,ne.jsx)("span",{className:"me-video-trim-action-icon","aria-hidden":"true",children:"\u{1F5D1}"}),(0,ne.jsx)("span",{className:"me-video-trim-action-label",children:l("act.delete")})]}),(0,ne.jsx)("span",{style:{flex:1}}),(0,ne.jsxs)("div",{className:"me-video-timeline-zoom",style:{display:"flex",alignItems:"center",gap:4},children:[(0,ne.jsx)("button",{onClick:()=>Tn(1/1.4),style:{...nr,width:24,height:24,color:Re.muted},title:l("tip.zoomOut"),children:"\u2212"}),(0,ne.jsx)("button",{onClick:fn,style:{...nr,padding:"0 8px",height:24,fontSize:11,color:Re.muted},title:l("tip.fit"),children:l("act.fit")}),(0,ne.jsx)("button",{onClick:()=>Tn(1.4),style:{...nr,width:24,height:24,color:Re.muted},title:l("tip.zoomIn"),children:"\uFF0B"})]})]}),(0,ne.jsxs)("div",{className:"me-video-timeline-area",style:{display:"flex",alignItems:"flex-start",gap:4},children:[(0,ne.jsxs)("div",{style:{flexShrink:0,display:"flex",flexDirection:"column",width:34},children:[(0,ne.jsx)("div",{style:{height:22}}),(0,ne.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:64,marginTop:4},children:(0,ne.jsx)("button",{onClick:()=>n.setKeepAudio(!g.keepAudio),style:{...nr,width:32,height:32,borderRadius:999,background:Re.chip,opacity:g.keepAudio?1:.55},title:l("tip.keepAudio"),children:g.keepAudio?"\u{1F50A}":"\u{1F507}"})})]}),(0,ne.jsx)("div",{ref:oe,className:"me-video-timeline-scroll",style:{flex:1,minWidth:0,overflowX:"auto",overscrollBehaviorX:"contain"},children:(0,ne.jsxs)("div",{ref:ge,style:{position:"relative",width:D*Pe,minWidth:"100%"},children:[(0,ne.jsxs)("div",{style:{position:"relative",height:22,cursor:"pointer",touchAction:"none"},onPointerDown:Hn({kind:"playhead"}),children:[cr.map(N=>(0,ne.jsxs)("span",{children:[(0,ne.jsx)("span",{style:{position:"absolute",bottom:2,width:1,height:6,left:N.x,background:Re.border}}),(0,ne.jsx)("span",{style:{position:"absolute",bottom:0,fontSize:11,fontVariantNumeric:"tabular-nums",left:N.x+3,color:Re.muted},children:N.label})]},N.x)),E>0&&(0,ne.jsx)("span",{style:{position:"absolute",bottom:0,padding:"2px 6px",borderRadius:4,fontSize:11,fontVariantNumeric:"tabular-nums",fontWeight:500,whiteSpace:"nowrap",left:Math.min(Math.max(_*Pe,14),Math.max(14,E*Pe-14)),transform:"translateX(-50%)",background:Re.chip,border:`1px solid ${Re.border}`,color:Re.fg},children:sc(_)})]}),(0,ne.jsx)("div",{ref:Be,style:{position:"relative",marginTop:4,borderRadius:8,overflow:"hidden",height:64,background:Re.chip,cursor:"pointer"},onPointerDown:N=>{N.target===N.currentTarget&&Hn({kind:"playhead"})(N)},children:Z.map((N,I)=>(0,ne.jsxs)("div",{"data-clipblock":I,style:{position:"absolute",top:0,bottom:0,userSelect:"none",left:Qu(Z,I)*Pe,width:vs(N)*Pe,cursor:Rt===I?"grabbing":"grab",opacity:Rt!==null&&Rt!==I?.72:O===I?1:.82,transform:O===I?"translateY(-1px)":"none",zIndex:1,touchAction:"none"},onPointerDown:ur(I),children:[(0,ne.jsx)("div",{style:{position:"absolute",inset:0,overflow:"hidden",borderRadius:6},children:Mr(N).map(we=>(0,ne.jsx)("img",{src:we.src,alt:"",style:{position:"absolute",top:0,height:"100%",objectFit:"cover",left:we.left,width:we.width},draggable:!1},we.key))}),(0,ne.jsx)("div",{style:{position:"absolute",inset:0,pointerEvents:"none",border:`${O===I?3:2}px solid ${O===I?"#fff":"rgba(255,255,255,0.18)"}`,borderRadius:6,boxShadow:O===I?"0 0 0 1px rgba(255,255,255,0.26),0 10px 22px rgba(0,0,0,0.28)":kn===I&&Rt!==null&&kn!==Rt?"inset 4px 0 0 #fff":"none"}}),(0,ne.jsx)("span",{style:{position:"absolute",top:2,left:8,padding:"0 4px",height:16,borderRadius:999,fontSize:11,lineHeight:"16px",textAlign:"center",fontWeight:600,pointerEvents:"none",background:Re.accent,color:Re.accentFg},children:I+1}),(0,ne.jsx)("div",{style:{position:"absolute",top:0,bottom:0,left:0,width:10,cursor:"ew-resize",background:Re.accent,borderRadius:"6px 0 0 6px"},onPointerDown:Hn({kind:"clipIn",idx:I,orig:Z,origStart:Qu(Z,I)}),children:(0,ne.jsx)("div",{style:{position:"absolute",left:"50%",top:"50%",width:2,height:16,borderRadius:2,transform:"translate(-50%,-50%)",background:"rgba(255,255,255,0.85)"}})}),(0,ne.jsx)("div",{style:{position:"absolute",top:0,bottom:0,right:0,width:10,cursor:"ew-resize",background:Re.accent,borderRadius:"0 6px 6px 0"},onPointerDown:Hn({kind:"clipOut",idx:I,orig:Z,origStart:Qu(Z,I)}),children:(0,ne.jsx)("div",{style:{position:"absolute",left:"50%",top:"50%",width:2,height:16,borderRadius:2,transform:"translate(-50%,-50%)",background:"rgba(255,255,255,0.85)"}})})]},`clip-${I}`))}),(0,ne.jsxs)("div",{style:{position:"relative",marginTop:4,borderRadius:8,height:28,background:Re.chip,cursor:"pointer"},onPointerDown:N=>{N.target===N.currentTarget&&Hn({kind:"playhead"})(N)},children:[Et.length===0&&(0,ne.jsx)("span",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",paddingLeft:12,fontSize:11,color:Re.muted,pointerEvents:"none"},children:l("lbl.audioTrackHint")}),Et.map((N,I)=>{let we=Ge===I;return(0,ne.jsxs)("div",{style:{position:"absolute",top:2,bottom:2,borderRadius:4,userSelect:"none",left:N.startAt*Pe,width:Math.max(8,(N.out-N.in)*Pe),background:we?"rgba(52,211,153,0.5)":"rgba(52,211,153,0.3)",border:`1.5px solid ${Re.green}`,cursor:"grab",touchAction:"none"},onPointerDown:tt=>{mt(I),Hn({kind:"audioMove",idx:I,origStartAt:N.startAt,downT:Lt(tt.clientX)})(tt)},children:[(0,ne.jsxs)("span",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",paddingLeft:8,fontSize:11,overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",pointerEvents:"none",color:"#d1fae5"},children:["\u266A ",H[N.srcIdx]?.file.name??l("lbl.music")]}),(0,ne.jsx)("div",{style:{position:"absolute",top:0,bottom:0,left:0,width:6,cursor:"ew-resize",background:Re.green,borderRadius:"3px 0 0 3px"},onPointerDown:tt=>{mt(I),Hn({kind:"audioIn",idx:I,origIn:N.in,downT:Lt(tt.clientX)})(tt)}}),(0,ne.jsx)("div",{style:{position:"absolute",top:0,bottom:0,right:0,width:6,cursor:"ew-resize",background:Re.green,borderRadius:"0 3px 3px 0"},onPointerDown:tt=>{mt(I),Hn({kind:"audioOut",idx:I,origOut:N.out,downT:Lt(tt.clientX)})(tt)}})]},`au-${I}`)})]}),E>0&&(0,ne.jsx)("div",{style:{position:"absolute",top:0,bottom:0,pointerEvents:"none",left:_*Pe-1,width:2,background:"#fff",boxShadow:"0 0 4px rgba(0,0,0,0.8)",zIndex:30}})]})}),(0,ne.jsxs)("div",{style:{flexShrink:0,display:"flex",flexDirection:"column",width:44},children:[(0,ne.jsx)("div",{style:{height:22}}),(0,ne.jsxs)("label",{style:{display:"flex",alignItems:"center",justifyContent:"center",borderRadius:8,cursor:"pointer",fontSize:18,height:64,marginTop:4,border:`1.5px dashed ${Re.border}`,color:Re.muted},title:l("tip.addVideo"),children:["\uFF0B",(0,ne.jsx)("input",{type:"file",accept:"video/*",style:{display:"none"},onChange:N=>{let I=N.target.files?.[0];I&&at(I),N.target.value=""}})]}),(0,ne.jsxs)("label",{style:{display:"flex",alignItems:"center",justifyContent:"center",borderRadius:8,cursor:"pointer",fontSize:13,height:28,marginTop:4,border:`1.5px dashed ${Re.border}`,color:Re.muted},title:l("tip.addAudio"),children:["\u266A\uFF0B",(0,ne.jsx)("input",{type:"file",accept:"audio/*,video/*",style:{display:"none"},onChange:N=>{let I=N.target.files?.[0];I&&Ke(I),N.target.value=""}})]})]})]}),Ge!=null&&Et[Ge]&&(0,ne.jsxs)("div",{style:{marginTop:8,display:"flex",alignItems:"center",gap:12,padding:"8px 12px",borderRadius:8,fontSize:13,background:Re.chip,color:Re.muted},children:[(0,ne.jsxs)("span",{style:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",maxWidth:160},children:["\u266A ",H[Et[Ge].srcIdx]?.file.name??l("lbl.music")]}),(0,ne.jsx)("span",{style:{flexShrink:0},children:l("lbl.volume")}),(0,ne.jsx)("input",{type:"range",min:0,max:2,step:.1,value:Et[Ge].volume,onChange:N=>{let I=Number(N.target.value);v({audioClips:Et.map((we,tt)=>tt===Ge?{...we,volume:I}:we)})},onPointerUp:()=>w(),style:{width:144}}),(0,ne.jsxs)("span",{style:{fontVariantNumeric:"tabular-nums",width:40},children:[Math.round(Et[Ge].volume*100),"%"]}),(0,ne.jsx)("div",{style:{flex:1}}),(0,ne.jsx)("button",{onClick:()=>{w({audioClips:Et.filter((N,I)=>I!==Ge)}),mt(null)},style:{padding:"4px 8px",borderRadius:6,border:"none",cursor:"pointer",background:"rgba(239,68,68,0.15)",color:"#fca5a5"},children:l("act.deleteMusic")})]})]}),!1,V&&M==="resize"&&(0,ne.jsxs)("div",{style:{marginTop:16,display:"flex",flexDirection:"column",alignItems:"center",gap:12,width:"100%"},children:[(0,ne.jsx)("p",{style:{fontSize:11,marginBottom:-4,color:Re.muted},children:l("lbl.sizeSection")}),(0,ne.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,color:Re.muted},children:[(0,ne.jsx)("input",{type:"number",min:2,value:g.scale?.width??Oe.w,onChange:N=>{let I=Kn(Number(N.target.value)||2),we=Oe.w/Oe.h;w({scale:{width:I,height:Ze?Kn(I/we):g.scale?.height??Oe.h,fit:"cover"}})},style:{width:96,padding:"6px 8px",borderRadius:6,textAlign:"center",fontVariantNumeric:"tabular-nums",background:Re.chip,color:Re.fg,border:"none"}}),(0,ne.jsx)("span",{style:{fontSize:11},children:"W"}),(0,ne.jsx)("button",{onClick:()=>et(!Ze),style:{...nr,padding:"6px 8px",background:Re.chip},title:l("tip.lockAspect"),children:Ze?"\u{1F512}":"\u{1F513}"}),(0,ne.jsx)("span",{style:{fontSize:11},children:"H"}),(0,ne.jsx)("input",{type:"number",min:2,value:g.scale?.height??Oe.h,onChange:N=>{let I=Kn(Number(N.target.value)||2),we=Oe.w/Oe.h;w({scale:{width:Ze?Kn(I*we):g.scale?.width??Oe.w,height:I,fit:"cover"}})},style:{width:96,padding:"6px 8px",borderRadius:6,textAlign:"center",fontVariantNumeric:"tabular-nums",background:Re.chip,color:Re.fg,border:"none"}}),g.scale&&(0,ne.jsx)("button",{onClick:()=>{w({scale:void 0})},style:{...nr,padding:"6px 8px",fontSize:13,background:Re.chip},children:l("act.restore")})]}),(0,ne.jsxs)("p",{style:{fontSize:11,color:Re.muted},children:[l("lbl.currentOut"),":",g.scale?`${g.scale.width}\xD7${g.scale.height}`:`${Oe.w}\xD7${Oe.h}${l("lbl.noScale")}`," ",l("lbl.coverNote")]})]}),Zt&&(0,ne.jsx)("div",{style:{marginTop:12,padding:"8px 12px",borderRadius:6,fontSize:13,width:"100%",background:"rgba(239,68,68,0.12)",color:"#fca5a5"},children:Zt}),lt&&!gt&&(0,ne.jsx)("div",{style:{marginTop:12,fontSize:13,color:Re.accent},children:lt})]})]}),gt&&(0,ne.jsx)("div",{className:"me-video-export-loading",role:"status","aria-live":"polite","aria-busy":"true",style:{position:"absolute",inset:0,zIndex:120,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(3,3,3,0.58)",backdropFilter:"blur(3px)",pointerEvents:"auto"},children:(0,ne.jsxs)("div",{style:{minWidth:240,maxWidth:360,padding:"20px 24px",borderRadius:12,border:`1px solid ${Re.border}`,background:"rgba(20,20,22,0.94)",boxShadow:"0 18px 60px rgba(0,0,0,0.42)",color:Re.fg,display:"flex",flexDirection:"column",alignItems:"center",gap:10,textAlign:"center"},children:[(0,ne.jsx)("span",{className:"me-video-export-spinner","aria-hidden":"true"}),(0,ne.jsx)("strong",{style:{fontSize:15,fontWeight:600},children:lt}),(0,ne.jsx)("span",{style:{fontSize:12,lineHeight:1.5,color:Re.muted},children:l("msg.exportingHint")})]})}),(0,ne.jsx)(nw,{open:_t,onClose:()=>xt(!1),videoSrcs:P.map(N=>({url:N.url,dims:N.dims,duration:N.duration})),clips:Z,canvasDims:Je,state:g,duration:E,sampleThumb:ar,fileName:P[0]?.file.name??"video",t:l})]})}var ww={"--me-fg":"#ededf0","--me-fg-muted":"#9a9aa3","--me-bg":"#08080a","--me-surface":"#141416","--me-chip":"#1c1c20","--me-border":"#26262b","--me-border-strong":"#34343a","--me-accent":"#7c7cf0","--me-accent-hover":"#8f8ff5","--me-accent-fg":"#ffffff"},Ew={"--me-fg":"#0a0a0a","--me-fg-muted":"#6b6b76","--me-bg":"#ffffff","--me-surface":"#fafafa","--me-chip":"#f1f1f3","--me-border":"#e6e6e8","--me-border-strong":"#d4d4d8","--me-accent":"#5b5bd6","--me-accent-hover":"#4f4fc9","--me-accent-fg":"#ffffff"};function kw(n="auto"){return n!=="auto"?n:typeof window<"u"&&window.matchMedia?.("(prefers-color-scheme: light)").matches?"light":"dark"}function Cw(n,a={}){n.style.position||(n.style.position="relative");let o=document.createElement("div");o.style.cssText="width:100%;height:100%;min-height:0;flex:1 1 0",n.appendChild(o);let l=(0,D2.createRoot)(o),s=a.engine??new jm,d=a.client??Rx({baseUrl:a.baseUrl}),m=a,h=w=>{m={...m,...w};let W=m;W.client&&(d=W.client);let S={...kw(W.theme)==="light"?Ew:ww,width:"100%",height:"100%",minHeight:0,background:"var(--me-bg)",color:"var(--me-fg)"};l.render((0,og.createElement)("div",{style:S},(0,og.createElement)(xw,{engine:s,client:d,source:W.source,t:P2(W.locale??"zh"),onExported:W.onExported,onError:W.onError,maxVideos:W.maxVideos,maxAudios:W.maxAudios})))};h(a);let g=null,v=null;return{update(w){h(w)},destroy(){l.unmount(),v?.(),g?.dispose(),o.remove()}}}var dc='-apple-system, "PingFang SC", "Microsoft YaHei", sans-serif',gg=["Arial","Segoe UI","Microsoft YaHei","Microsoft JhengHei","PingFang SC","Helvetica","Verdana","Tahoma","Trebuchet MS","Georgia","Times New Roman","Courier New","NSimSun","SimSun","SimHei","KaiTi","FangSong","Noto Sans SC"],Sw={"Microsoft YaHei":"\u5FAE\u8F6F\u96C5\u9ED1","Microsoft JhengHei":"\u5FAE\u8F6F\u6B63\u9ED1\u4F53","PingFang SC":"\u82F9\u65B9",SimSun:"\u5B8B\u4F53",NSimSun:"\u65B0\u5B8B\u4F53",SimHei:"\u9ED1\u4F53",KaiTi:"\u6977\u4F53",FangSong:"\u4EFF\u5B8B","Noto Sans SC":"\u601D\u6E90\u9ED1\u4F53","Songti SC":"\u5B8B\u4F53-\u7B80","Heiti SC":"\u9ED1\u4F53-\u7B80","Kaiti SC":"\u6977\u4F53-\u7B80",STSong:"\u534E\u6587\u5B8B\u4F53",STHeiti:"\u534E\u6587\u9ED1\u4F53",STKaiti:"\u534E\u6587\u6977\u4F53",STFangsong:"\u534E\u6587\u4EFF\u5B8B",STZhongsong:"\u534E\u6587\u4E2D\u5B8B",YouYuan:"\u5E7C\u5706",LiSu:"\u96B6\u4E66"},Fw=["microsoft yahei","microsoft jhenghei","pingfang","simsun","nsimsun","simhei","kaiti","fangsong","noto sans sc","songti","heiti","stsong","stheiti","stkaiti","stfangsong","stzhongsong","youyuan","lisu"],bg={heading:{text:"Heading and some body",fontSize:120,width:600,fontWeight:"700",textAlign:"center",color:"#ffffff",backgroundColor:"transparent",borderColor:"#000000",borderWidth:0,boxShadow:{color:"rgba(0,0,0,0.35)",x:0,y:4,blur:18}},subtitle:{text:"Subtitle line",fontSize:72,width:560,fontWeight:"600",textAlign:"center",color:"#ffffff",backgroundColor:"transparent",borderColor:"#000000",borderWidth:0,boxShadow:{color:"rgba(0,0,0,0.28)",x:0,y:2,blur:12}},label:{text:"Label",fontSize:44,width:300,fontWeight:"700",textAlign:"center",color:"#ffffff",backgroundColor:"rgba(8,8,10,0.72)",borderColor:"#000000",borderWidth:0,boxShadow:{color:"rgba(0,0,0,0.18)",x:0,y:2,blur:8},paddingX:24,paddingY:16}},nf=[{key:"none",label:"Cut",short:"Cut",duration:0},{key:"fade",label:"Fade",short:"Fade",duration:.45},{key:"slide",label:"Slide",short:"Slide",duration:.45},{key:"wipe",label:"Wipe",short:"Wipe",duration:.45},{key:"flip",label:"Flip",short:"Flip",duration:.35},{key:"clockWipe",label:"Clock",short:"Clock",duration:.5},{key:"star",label:"Star",short:"Star",duration:.35},{key:"circle",label:"Circle",short:"Circle",duration:.45},{key:"rectangle",label:"Rectangle",short:"Rect",duration:.45}],yg=!1,xg=!1,fr="me-video-timeline-selectionchange",wg="Aa Sample 123",rf=null;function wa(){if(yg||typeof document>"u")return;const n=document.createElement("style");n.id="me-video-text-enhancer-style",n.textContent=`
|
|
12
12
|
.me-video-inspector-rail {
|
|
13
13
|
flex: 0 0 min(380px, 32vw);
|
|
14
14
|
min-width: 320px;
|
|
@@ -2042,7 +2042,7 @@ Error generating stack: `+i.message+`
|
|
|
2042
2042
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
2043
2043
|
}
|
|
2044
2044
|
}
|
|
2045
|
-
`,document.head.appendChild(n),xg=!0}function qe(n,a,o){return Math.min(Math.max(n,a),o)}function Es(n){if(!Number.isFinite(n))return 0;let a=n%360;return a>180&&(a-=360),a<-180&&(a+=360),Math.abs(a)<.001?0:a}function ks(n="auto"){return n!=="auto"?n:typeof window<"u"&&window.matchMedia?.("(prefers-color-scheme: light)").matches?"light":"dark"}function Eg(n){if(!n)return null;const a=String(n).toLowerCase();return a==="zh-hant"||/^zh-(tw|hk|mo)/.test(a)?"zh-Hant":a==="zh"||a.startsWith("zh-")?"zh":(a.startsWith("en"),"en")}function Qr(n){return Eg(n)||(typeof navigator<"u"?Eg(navigator.language)??"en":"en")}var af={en:{untitledText:"Untitled text",textPresets:{heading:"Heading and some body",subtitle:"Subtitle line",label:"Label"},text:{tool:"Text",addText:"Add text",moveOnCanvas:"Move on canvas",close:"Close",hint:"Match the reference text styling here first. This version renders text as a full-length overlay, so font, shadow, stroke, background and alignment will export exactly.",empty:"No text overlay yet. Add one to start editing.",heading:"Heading",subtitle:"Subtitle",label:"Label",placeholder:"Type your text",content:"Content",font:"Font",weight:"Weight",fontSize:"Font Size",boxWidth:"Box Width",color:"Color",background:"Background",stroke:"Stroke",strokeColor:"Stroke Color",opacity:"Opacity",shadowBlur:"Shadow Blur",align:"Align",duplicate:"Duplicate",delete:"Delete",addLabel:"Add label"},transitions:{tool:"Transitions",title:"Transitions",fadeAll:"Fade all",close:"Close",hint:"Pick a cut between clips on the timeline. These transitions are exported through ffmpeg xfade/acrossfade, so the result is baked into the final video.",empty:"Need at least 2 clips to place a transition. Split or duplicate a clip first.",duration:"Duration",clearSelected:"Clear selected",clearAll:"Clear all",cut:"Cut",instantCut:"Instant cut",selection:(n,a)=>`Between clip ${n} and clip ${a}`,selectionEmpty:"Open Trim to place transitions on the timeline.",boundary:(n,a,o)=>`${n}\u2192${a} ${o}`,boundaryTitle:(n,a)=>`Between clip ${n} and clip ${a}`,markerTitle:(n,a,o,l)=>`Clip ${n} \u2192 ${a}: ${o}${l?` (${l})`:""}`,options:{none:{label:"Cut",short:"Cut"},fade:{label:"Fade",short:"Fade"},slide:{label:"Slide",short:"Slide"},wipe:{label:"Wipe",short:"Wipe"},flip:{label:"Flip",short:"Flip"},clockWipe:{label:"Clock",short:"Clock"},star:{label:"Star",short:"Star"},circle:{label:"Circle",short:"Circle"},rectangle:{label:"Rectangle",short:"Rect"}}}},zh:{untitledText:"\u672A\u547D\u540D\u6587\u5B57",textPresets:{heading:"\u4E3B\u6807\u9898\u548C\u6B63\u6587",subtitle:"\u5B57\u5E55\u6587\u6848",label:"\u6807\u7B7E"},text:{tool:"\u6587\u5B57",addText:"\u6DFB\u52A0\u6587\u5B57",moveOnCanvas:"\u753B\u5E03\u5B9A\u4F4D",close:"\u5173\u95ED",hint:"\u5148\u5728\u8FD9\u91CC\u628A\u6587\u5B57\u6837\u5F0F\u8C03\u5230\u548C\u53C2\u8003\u4E00\u81F4\u3002\u8BE5\u7248\u672C\u4F1A\u628A\u6587\u5B57\u4F5C\u4E3A\u5B8C\u6574\u8986\u76D6\u5C42\u5BFC\u51FA\uFF0C\u5B57\u4F53\u3001\u9634\u5F71\u3001\u63CF\u8FB9\u3001\u80CC\u666F\u548C\u5BF9\u9F50\u65B9\u5F0F\u90FD\u4F1A\u88AB\u51C6\u786E\u4FDD\u7559\u3002",empty:"\u8FD8\u6CA1\u6709\u6587\u5B57\u56FE\u5C42\uFF0C\u5148\u6DFB\u52A0\u4E00\u4E2A\u5F00\u59CB\u7F16\u8F91\u3002",heading:"\u6807\u9898",subtitle:"\u5B57\u5E55",label:"\u6807\u7B7E",placeholder:"\u8F93\u5165\u6587\u5B57\u5185\u5BB9",content:"\u5185\u5BB9",font:"\u5B57\u4F53",weight:"\u5B57\u91CD",fontSize:"\u5B57\u53F7",boxWidth:"\u6587\u672C\u5BBD\u5EA6",color:"\u989C\u8272",background:"\u80CC\u666F",stroke:"\u63CF\u8FB9",strokeColor:"\u63CF\u8FB9\u989C\u8272",opacity:"\u900F\u660E\u5EA6",shadowBlur:"\u9634\u5F71\u6A21\u7CCA",align:"\u5BF9\u9F50",duplicate:"\u590D\u5236",delete:"\u5220\u9664",addLabel:"\u6DFB\u52A0\u6807\u7B7E"},transitions:{tool:"\u8F6C\u573A",title:"\u8F6C\u573A",fadeAll:"\u5168\u90E8\u6DE1\u5165\u6DE1\u51FA",close:"\u5173\u95ED",hint:"\u5728\u65F6\u95F4\u8F74\u4E0A\u9009\u62E9\u4E24\u4E2A\u7247\u6BB5\u4E4B\u95F4\u7684\u5207\u70B9\u3002\u8F6C\u573A\u4F1A\u901A\u8FC7 ffmpeg \u7684 xfade/acrossfade \u70D8\u7119\u8FDB\u6700\u7EC8\u5BFC\u51FA\u89C6\u9891\u3002",empty:"\u81F3\u5C11\u9700\u8981 2 \u4E2A\u7247\u6BB5\u624D\u80FD\u8BBE\u7F6E\u8F6C\u573A\u3002\u53EF\u4EE5\u5148\u5206\u5272\u6216\u590D\u5236\u7247\u6BB5\u3002",duration:"\u65F6\u957F",clearSelected:"\u6E05\u9664\u5F53\u524D",clearAll:"\u6E05\u9664\u5168\u90E8",cut:"\u786C\u5207",instantCut:"\u76F4\u63A5\u5207\u6362",selection:(n,a)=>`\u7B2C ${n} \u6BB5 \u2192 \u7B2C ${a} \u6BB5`,selectionEmpty:"\u6253\u5F00\u526A\u8F91\u5DE5\u5177\u540E\uFF0C\u53EF\u5728\u65F6\u95F4\u8F74\u4E0A\u8BBE\u7F6E\u8F6C\u573A\u3002",boundary:(n,a,o)=>`${n}\u2192${a} ${o}`,boundaryTitle:(n,a)=>`\u7B2C ${n} \u6BB5\u5230\u7B2C ${a} \u6BB5\u4E4B\u95F4`,markerTitle:(n,a,o,l)=>`\u7B2C ${n} \u6BB5 \u2192 \u7B2C ${a} \u6BB5\uFF1A${o}${l?`\uFF08${l}\uFF09`:""}`,options:{none:{label:"\u786C\u5207",short:"\u786C\u5207"},fade:{label:"\u6DE1\u5316",short:"\u6DE1\u5316"},slide:{label:"\u6ED1\u52A8",short:"\u6ED1\u52A8"},wipe:{label:"\u64E6\u9664",short:"\u64E6\u9664"},flip:{label:"\u7FFB\u8F6C",short:"\u7FFB\u8F6C"},clockWipe:{label:"\u65F6\u949F",short:"\u65F6\u949F"},star:{label:"\u661F\u5F62",short:"\u661F\u5F62"},circle:{label:"\u5706\u5F62",short:"\u5706\u5F62"},rectangle:{label:"\u77E9\u5F62",short:"\u77E9\u5F62"}}}},"zh-Hant":{untitledText:"\u672A\u547D\u540D\u6587\u5B57",textPresets:{heading:"\u4E3B\u6A19\u984C\u548C\u6B63\u6587",subtitle:"\u5B57\u5E55\u6587\u6848",label:"\u6A19\u7C64"},text:{tool:"\u6587\u5B57",addText:"\u65B0\u589E\u6587\u5B57",moveOnCanvas:"\u756B\u5E03\u5B9A\u4F4D",close:"\u95DC\u9589",hint:"\u5148\u5728\u9019\u88E1\u628A\u6587\u5B57\u6A23\u5F0F\u8ABF\u5230\u548C\u53C3\u8003\u4E00\u81F4\u3002\u9019\u500B\u7248\u672C\u6703\u628A\u6587\u5B57\u4F5C\u70BA\u5B8C\u6574\u8986\u84CB\u5C64\u5C0E\u51FA\uFF0C\u5B57\u9AD4\u3001\u9670\u5F71\u3001\u63CF\u908A\u3001\u80CC\u666F\u548C\u5C0D\u9F4A\u65B9\u5F0F\u90FD\u6703\u88AB\u6E96\u78BA\u4FDD\u7559\u3002",empty:"\u9084\u6C92\u6709\u6587\u5B57\u5716\u5C64\uFF0C\u5148\u65B0\u589E\u4E00\u500B\u958B\u59CB\u7DE8\u8F2F\u3002",heading:"\u6A19\u984C",subtitle:"\u5B57\u5E55",label:"\u6A19\u7C64",placeholder:"\u8F38\u5165\u6587\u5B57\u5167\u5BB9",content:"\u5167\u5BB9",font:"\u5B57\u9AD4",weight:"\u5B57\u91CD",fontSize:"\u5B57\u7D1A",boxWidth:"\u6587\u5B57\u5BEC\u5EA6",color:"\u984F\u8272",background:"\u80CC\u666F",stroke:"\u63CF\u908A",strokeColor:"\u63CF\u908A\u984F\u8272",opacity:"\u900F\u660E\u5EA6",shadowBlur:"\u9670\u5F71\u6A21\u7CCA",align:"\u5C0D\u9F4A",duplicate:"\u8907\u88FD",delete:"\u522A\u9664",addLabel:"\u65B0\u589E\u6A19\u7C64"},transitions:{tool:"\u8F49\u5834",title:"\u8F49\u5834",fadeAll:"\u5168\u90E8\u6DE1\u5316",close:"\u95DC\u9589",hint:"\u5728\u6642\u9593\u8EF8\u4E0A\u9078\u64C7\u5169\u500B\u7247\u6BB5\u4E4B\u9593\u7684\u5207\u9EDE\u3002\u8F49\u5834\u6703\u900F\u904E ffmpeg \u7684 xfade/acrossfade \u70D8\u7119\u9032\u6700\u7D42\u5C0E\u51FA\u5F71\u7247\u3002",empty:"\u81F3\u5C11\u9700\u8981 2 \u500B\u7247\u6BB5\u624D\u80FD\u8A2D\u5B9A\u8F49\u5834\u3002\u53EF\u4EE5\u5148\u5206\u5272\u6216\u8907\u88FD\u7247\u6BB5\u3002",duration:"\u6642\u9577",clearSelected:"\u6E05\u9664\u76EE\u524D",clearAll:"\u6E05\u9664\u5168\u90E8",cut:"\u786C\u5207",instantCut:"\u76F4\u63A5\u5207\u63DB",selection:(n,a)=>`\u7B2C ${n} \u6BB5 \u2192 \u7B2C ${a} \u6BB5`,selectionEmpty:"\u6253\u958B\u526A\u8F2F\u5DE5\u5177\u5F8C\uFF0C\u53EF\u5728\u6642\u9593\u8EF8\u4E0A\u8A2D\u5B9A\u8F49\u5834\u3002",boundary:(n,a,o)=>`${n}\u2192${a} ${o}`,boundaryTitle:(n,a)=>`\u7B2C ${n} \u6BB5\u5230\u7B2C ${a} \u6BB5\u4E4B\u9593`,markerTitle:(n,a,o,l)=>`\u7B2C ${n} \u6BB5 \u2192 \u7B2C ${a} \u6BB5\uFF1A${o}${l?`\uFF08${l}\uFF09`:""}`,options:{none:{label:"\u786C\u5207",short:"\u786C\u5207"},fade:{label:"\u6DE1\u5316",short:"\u6DE1\u5316"},slide:{label:"\u6ED1\u52D5",short:"\u6ED1\u52D5"},wipe:{label:"\u64E6\u9664",short:"\u64E6\u9664"},flip:{label:"\u7FFB\u8F49",short:"\u7FFB\u8F49"},clockWipe:{label:"\u6642\u9418",short:"\u6642\u9418"},star:{label:"\u661F\u5F62",short:"\u661F\u5F62"},circle:{label:"\u5713\u5F62",short:"\u5713\u5F62"},rectangle:{label:"\u77E9\u5F62",short:"\u77E9\u5F62"}}}}};function kg(n){const a=Qr(n);return af[a]??af.en}var Cg={en:{tool:"Effects",title:"Effects",close:"Close",hint:"Adjust color, tone, and finishing details here.",details:"Details",empty:"No effect settings yet."},zh:{tool:"\u7279\u6548",title:"\u7279\u6548",close:"\u5173\u95ED",hint:"\u5728\u8FD9\u91CC\u53EF\u4EE5\u8C03\u6574\u8272\u5F69\u3001\u660E\u5EA6\u548C\u6548\u679C\u7EC6\u8282\u3002",details:"\u7EC6\u8282\u8C03\u6574",empty:"\u6682\u65E0\u53EF\u8C03\u6574\u9879"},"zh-Hant":{tool:"\u7279\u6548",title:"\u7279\u6548",close:"\u95DC\u9589",hint:"\u5728\u9019\u88E1\u53EF\u4EE5\u8ABF\u6574\u8272\u5F69\u3001\u660E\u5EA6\u8207\u6548\u679C\u7D30\u7BC0\u3002",details:"\u7D30\u7BC0\u8ABF\u6574",empty:"\u66AB\u7121\u53EF\u8ABF\u6574\u9805"}};function Mw(n){const a=Qr(n);return Cg[a]??Cg.en}var Sg={en:{title:"Audio",close:"Close",source:"Source",speed:"Speed",duration:"Duration",volume:"Volume",fadeIn:"Fade In",fadeOut:"Fade Out",speedHint:"Speed can be adjusted here and will be used when exporting audio."},zh:{title:"\u97F3\u8F68",close:"\u5173\u95ED",source:"\u6765\u6E90",speed:"\u500D\u6570",duration:"\u65F6\u957F",volume:"\u97F3\u91CF",fadeIn:"\u6DE1\u5165\u65F6\u957F",fadeOut:"\u6DE1\u51FA\u65F6\u957F",speedHint:"\u8FD9\u91CC\u53EF\u4EE5\u76F4\u63A5\u8C03\u6574\u97F3\u9891\u500D\u6570\uFF0C\u5BFC\u51FA\u65F6\u4F1A\u6309\u8BE5\u500D\u6570\u5904\u7406\u3002"},"zh-Hant":{title:"\u97F3\u8ECC",close:"\u95DC\u9589",source:"\u4F86\u6E90",speed:"\u500D\u6578",duration:"\u6642\u9577",volume:"\u97F3\u91CF",fadeIn:"\u6DE1\u5165\u6642\u9577",fadeOut:"\u6DE1\u51FA\u6642\u9577",speedHint:"\u9019\u88E1\u53EF\u4EE5\u76F4\u63A5\u8ABF\u6574\u97F3\u8A0A\u500D\u6578\uFF0C\u5C0E\u51FA\u6642\u6703\u6309\u8A72\u500D\u6578\u8655\u7406\u3002"}};function Lw(n){const a=Qr(n);return Sg[a]??Sg.en}var Fg={en:{tool:"Adjust",title:"Adjust",close:"Close",hint:"Select an adjustment layer to edit its controls here.",details:"Details",placeholder:"Select an adjustment layer to start editing.",videoInfoHint:"Default video details are shown here when no adjustment layer is selected.",videoInfoTitle:"Video details",videoName:"Name",ratio:"Ratio",canvasSize:"Canvas",resolution:"Resolution",frameRate:"Frame rate",bitrate:"Bitrate",format:"Format",fileSize:"File size",codec:"Codec",sourceSize:"Source size",videoLength:"Duration",notAvailable:"-"},zh:{tool:"\u8C03\u8282",title:"\u8C03\u8282",close:"\u5173\u95ED",hint:"\u9009\u4E2D\u8C03\u8282\u56FE\u5C42\u540E\uFF0C\u53EF\u4EE5\u5728\u8FD9\u91CC\u7EE7\u7EED\u8C03\u6574\u53C2\u6570\u3002",details:"\u7EC6\u8282\u8C03\u6574",placeholder:"\u8BF7\u5148\u9009\u4E2D\u4E00\u4E2A\u8C03\u8282\u56FE\u5C42\u518D\u7EE7\u7EED\u7F16\u8F91\u3002",videoInfoHint:"\u5F53\u524D\u672A\u9009\u4E2D\u8C03\u8282\u56FE\u5C42\uFF0C\u8FD9\u91CC\u663E\u793A\u9ED8\u8BA4\u89C6\u9891\u4FE1\u606F\u3002",videoInfoTitle:"\u89C6\u9891\u4FE1\u606F",videoName:"\u540D\u79F0",ratio:"\u6BD4\u4F8B",canvasSize:"\u753B\u5E03\u5927\u5C0F",resolution:"\u5206\u8FA8\u7387",frameRate:"\u5E27\u7387",bitrate:"\u7801\u7387",format:"\u683C\u5F0F",fileSize:"\u6587\u4EF6\u5927\u5C0F",codec:"\u7F16\u7801",sourceSize:"\u6E90\u5C3A\u5BF8",videoLength:"\u89C6\u9891\u65F6\u957F",notAvailable:"-"},"zh-Hant":{tool:"\u8ABF\u7BC0",title:"\u8ABF\u7BC0",close:"\u95DC\u9589",hint:"\u9078\u4E2D\u8ABF\u7BC0\u5716\u5C64\u5F8C\uFF0C\u53EF\u4EE5\u5728\u9019\u88E1\u7E7C\u7E8C\u8ABF\u6574\u53C3\u6578\u3002",details:"\u7D30\u7BC0\u8ABF\u6574",placeholder:"\u8ACB\u5148\u9078\u4E2D\u4E00\u500B\u8ABF\u7BC0\u5716\u5C64\u518D\u7E7C\u7E8C\u7DE8\u8F2F\u3002",videoInfoHint:"\u76EE\u524D\u672A\u9078\u4E2D\u8ABF\u7BC0\u5716\u5C64\uFF0C\u9019\u88E1\u986F\u793A\u9810\u8A2D\u8996\u983B\u8CC7\u8A0A\u3002",videoInfoTitle:"\u8996\u983B\u8CC7\u8A0A",videoName:"\u540D\u7A31",ratio:"\u6BD4\u4F8B",canvasSize:"\u756B\u5E03\u5927\u5C0F",resolution:"\u89E3\u6790\u5EA6",frameRate:"\u5E40\u7387",bitrate:"\u78BC\u7387",format:"\u683C\u5F0F",fileSize:"\u6A94\u6848\u5927\u5C0F",codec:"\u7DE8\u78BC",sourceSize:"\u4F86\u6E90\u5C3A\u5BF8",videoLength:"\u8996\u983B\u6642\u9577",notAvailable:"-"}};function Aw(n){const a=Qr(n);return Fg[a]??Fg.en}function Nw(){return`<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false">
|
|
2045
|
+
`,document.head.appendChild(n),xg=!0}function qe(n,a,o){return Math.min(Math.max(n,a),o)}function Es(n){if(!Number.isFinite(n))return 0;let a=n%360;return a>180&&(a-=360),a<-180&&(a+=360),Math.abs(a)<.001?0:a}function ks(n="auto"){return n!=="auto"?n:typeof window<"u"&&window.matchMedia?.("(prefers-color-scheme: light)").matches?"light":"dark"}function Eg(n){if(!n)return null;const a=String(n).toLowerCase();return a==="zh-hant"||/^zh-(tw|hk|mo)/.test(a)?"zh-Hant":a==="zh"||a.startsWith("zh-")?"zh":(a.startsWith("en"),"en")}function Jr(n){return Eg(n)||(typeof navigator<"u"?Eg(navigator.language)??"en":"en")}var af={en:{untitledText:"Untitled text",textPresets:{heading:"Heading and some body",subtitle:"Subtitle line",label:"Label"},text:{tool:"Text",addText:"Add text",moveOnCanvas:"Move on canvas",close:"Close",hint:"Match the reference text styling here first. This version renders text as a full-length overlay, so font, shadow, stroke, background and alignment will export exactly.",empty:"No text overlay yet. Add one to start editing.",heading:"Heading",subtitle:"Subtitle",label:"Label",placeholder:"Type your text",content:"Content",font:"Font",weight:"Weight",fontSize:"Font Size",boxWidth:"Box Width",color:"Color",background:"Background",stroke:"Stroke",strokeColor:"Stroke Color",opacity:"Opacity",shadowBlur:"Shadow Blur",align:"Align",duplicate:"Duplicate",delete:"Delete",addLabel:"Add label"},transitions:{tool:"Transitions",title:"Transitions",fadeAll:"Fade all",close:"Close",hint:"Pick a cut between clips on the timeline. These transitions are exported through ffmpeg xfade/acrossfade, so the result is baked into the final video.",empty:"Need at least 2 clips to place a transition. Split or duplicate a clip first.",duration:"Duration",clearSelected:"Clear selected",clearAll:"Clear all",cut:"Cut",instantCut:"Instant cut",selection:(n,a)=>`Between clip ${n} and clip ${a}`,selectionEmpty:"Open Trim to place transitions on the timeline.",boundary:(n,a,o)=>`${n}\u2192${a} ${o}`,boundaryTitle:(n,a)=>`Between clip ${n} and clip ${a}`,markerTitle:(n,a,o,l)=>`Clip ${n} \u2192 ${a}: ${o}${l?` (${l})`:""}`,options:{none:{label:"Cut",short:"Cut"},fade:{label:"Fade",short:"Fade"},slide:{label:"Slide",short:"Slide"},wipe:{label:"Wipe",short:"Wipe"},flip:{label:"Flip",short:"Flip"},clockWipe:{label:"Clock",short:"Clock"},star:{label:"Star",short:"Star"},circle:{label:"Circle",short:"Circle"},rectangle:{label:"Rectangle",short:"Rect"}}}},zh:{untitledText:"\u672A\u547D\u540D\u6587\u5B57",textPresets:{heading:"\u4E3B\u6807\u9898\u548C\u6B63\u6587",subtitle:"\u5B57\u5E55\u6587\u6848",label:"\u6807\u7B7E"},text:{tool:"\u6587\u5B57",addText:"\u6DFB\u52A0\u6587\u5B57",moveOnCanvas:"\u753B\u5E03\u5B9A\u4F4D",close:"\u5173\u95ED",hint:"\u5148\u5728\u8FD9\u91CC\u628A\u6587\u5B57\u6837\u5F0F\u8C03\u5230\u548C\u53C2\u8003\u4E00\u81F4\u3002\u8BE5\u7248\u672C\u4F1A\u628A\u6587\u5B57\u4F5C\u4E3A\u5B8C\u6574\u8986\u76D6\u5C42\u5BFC\u51FA\uFF0C\u5B57\u4F53\u3001\u9634\u5F71\u3001\u63CF\u8FB9\u3001\u80CC\u666F\u548C\u5BF9\u9F50\u65B9\u5F0F\u90FD\u4F1A\u88AB\u51C6\u786E\u4FDD\u7559\u3002",empty:"\u8FD8\u6CA1\u6709\u6587\u5B57\u56FE\u5C42\uFF0C\u5148\u6DFB\u52A0\u4E00\u4E2A\u5F00\u59CB\u7F16\u8F91\u3002",heading:"\u6807\u9898",subtitle:"\u5B57\u5E55",label:"\u6807\u7B7E",placeholder:"\u8F93\u5165\u6587\u5B57\u5185\u5BB9",content:"\u5185\u5BB9",font:"\u5B57\u4F53",weight:"\u5B57\u91CD",fontSize:"\u5B57\u53F7",boxWidth:"\u6587\u672C\u5BBD\u5EA6",color:"\u989C\u8272",background:"\u80CC\u666F",stroke:"\u63CF\u8FB9",strokeColor:"\u63CF\u8FB9\u989C\u8272",opacity:"\u900F\u660E\u5EA6",shadowBlur:"\u9634\u5F71\u6A21\u7CCA",align:"\u5BF9\u9F50",duplicate:"\u590D\u5236",delete:"\u5220\u9664",addLabel:"\u6DFB\u52A0\u6807\u7B7E"},transitions:{tool:"\u8F6C\u573A",title:"\u8F6C\u573A",fadeAll:"\u5168\u90E8\u6DE1\u5165\u6DE1\u51FA",close:"\u5173\u95ED",hint:"\u5728\u65F6\u95F4\u8F74\u4E0A\u9009\u62E9\u4E24\u4E2A\u7247\u6BB5\u4E4B\u95F4\u7684\u5207\u70B9\u3002\u8F6C\u573A\u4F1A\u901A\u8FC7 ffmpeg \u7684 xfade/acrossfade \u70D8\u7119\u8FDB\u6700\u7EC8\u5BFC\u51FA\u89C6\u9891\u3002",empty:"\u81F3\u5C11\u9700\u8981 2 \u4E2A\u7247\u6BB5\u624D\u80FD\u8BBE\u7F6E\u8F6C\u573A\u3002\u53EF\u4EE5\u5148\u5206\u5272\u6216\u590D\u5236\u7247\u6BB5\u3002",duration:"\u65F6\u957F",clearSelected:"\u6E05\u9664\u5F53\u524D",clearAll:"\u6E05\u9664\u5168\u90E8",cut:"\u786C\u5207",instantCut:"\u76F4\u63A5\u5207\u6362",selection:(n,a)=>`\u7B2C ${n} \u6BB5 \u2192 \u7B2C ${a} \u6BB5`,selectionEmpty:"\u6253\u5F00\u526A\u8F91\u5DE5\u5177\u540E\uFF0C\u53EF\u5728\u65F6\u95F4\u8F74\u4E0A\u8BBE\u7F6E\u8F6C\u573A\u3002",boundary:(n,a,o)=>`${n}\u2192${a} ${o}`,boundaryTitle:(n,a)=>`\u7B2C ${n} \u6BB5\u5230\u7B2C ${a} \u6BB5\u4E4B\u95F4`,markerTitle:(n,a,o,l)=>`\u7B2C ${n} \u6BB5 \u2192 \u7B2C ${a} \u6BB5\uFF1A${o}${l?`\uFF08${l}\uFF09`:""}`,options:{none:{label:"\u786C\u5207",short:"\u786C\u5207"},fade:{label:"\u6DE1\u5316",short:"\u6DE1\u5316"},slide:{label:"\u6ED1\u52A8",short:"\u6ED1\u52A8"},wipe:{label:"\u64E6\u9664",short:"\u64E6\u9664"},flip:{label:"\u7FFB\u8F6C",short:"\u7FFB\u8F6C"},clockWipe:{label:"\u65F6\u949F",short:"\u65F6\u949F"},star:{label:"\u661F\u5F62",short:"\u661F\u5F62"},circle:{label:"\u5706\u5F62",short:"\u5706\u5F62"},rectangle:{label:"\u77E9\u5F62",short:"\u77E9\u5F62"}}}},"zh-Hant":{untitledText:"\u672A\u547D\u540D\u6587\u5B57",textPresets:{heading:"\u4E3B\u6A19\u984C\u548C\u6B63\u6587",subtitle:"\u5B57\u5E55\u6587\u6848",label:"\u6A19\u7C64"},text:{tool:"\u6587\u5B57",addText:"\u65B0\u589E\u6587\u5B57",moveOnCanvas:"\u756B\u5E03\u5B9A\u4F4D",close:"\u95DC\u9589",hint:"\u5148\u5728\u9019\u88E1\u628A\u6587\u5B57\u6A23\u5F0F\u8ABF\u5230\u548C\u53C3\u8003\u4E00\u81F4\u3002\u9019\u500B\u7248\u672C\u6703\u628A\u6587\u5B57\u4F5C\u70BA\u5B8C\u6574\u8986\u84CB\u5C64\u5C0E\u51FA\uFF0C\u5B57\u9AD4\u3001\u9670\u5F71\u3001\u63CF\u908A\u3001\u80CC\u666F\u548C\u5C0D\u9F4A\u65B9\u5F0F\u90FD\u6703\u88AB\u6E96\u78BA\u4FDD\u7559\u3002",empty:"\u9084\u6C92\u6709\u6587\u5B57\u5716\u5C64\uFF0C\u5148\u65B0\u589E\u4E00\u500B\u958B\u59CB\u7DE8\u8F2F\u3002",heading:"\u6A19\u984C",subtitle:"\u5B57\u5E55",label:"\u6A19\u7C64",placeholder:"\u8F38\u5165\u6587\u5B57\u5167\u5BB9",content:"\u5167\u5BB9",font:"\u5B57\u9AD4",weight:"\u5B57\u91CD",fontSize:"\u5B57\u7D1A",boxWidth:"\u6587\u5B57\u5BEC\u5EA6",color:"\u984F\u8272",background:"\u80CC\u666F",stroke:"\u63CF\u908A",strokeColor:"\u63CF\u908A\u984F\u8272",opacity:"\u900F\u660E\u5EA6",shadowBlur:"\u9670\u5F71\u6A21\u7CCA",align:"\u5C0D\u9F4A",duplicate:"\u8907\u88FD",delete:"\u522A\u9664",addLabel:"\u65B0\u589E\u6A19\u7C64"},transitions:{tool:"\u8F49\u5834",title:"\u8F49\u5834",fadeAll:"\u5168\u90E8\u6DE1\u5316",close:"\u95DC\u9589",hint:"\u5728\u6642\u9593\u8EF8\u4E0A\u9078\u64C7\u5169\u500B\u7247\u6BB5\u4E4B\u9593\u7684\u5207\u9EDE\u3002\u8F49\u5834\u6703\u900F\u904E ffmpeg \u7684 xfade/acrossfade \u70D8\u7119\u9032\u6700\u7D42\u5C0E\u51FA\u5F71\u7247\u3002",empty:"\u81F3\u5C11\u9700\u8981 2 \u500B\u7247\u6BB5\u624D\u80FD\u8A2D\u5B9A\u8F49\u5834\u3002\u53EF\u4EE5\u5148\u5206\u5272\u6216\u8907\u88FD\u7247\u6BB5\u3002",duration:"\u6642\u9577",clearSelected:"\u6E05\u9664\u76EE\u524D",clearAll:"\u6E05\u9664\u5168\u90E8",cut:"\u786C\u5207",instantCut:"\u76F4\u63A5\u5207\u63DB",selection:(n,a)=>`\u7B2C ${n} \u6BB5 \u2192 \u7B2C ${a} \u6BB5`,selectionEmpty:"\u6253\u958B\u526A\u8F2F\u5DE5\u5177\u5F8C\uFF0C\u53EF\u5728\u6642\u9593\u8EF8\u4E0A\u8A2D\u5B9A\u8F49\u5834\u3002",boundary:(n,a,o)=>`${n}\u2192${a} ${o}`,boundaryTitle:(n,a)=>`\u7B2C ${n} \u6BB5\u5230\u7B2C ${a} \u6BB5\u4E4B\u9593`,markerTitle:(n,a,o,l)=>`\u7B2C ${n} \u6BB5 \u2192 \u7B2C ${a} \u6BB5\uFF1A${o}${l?`\uFF08${l}\uFF09`:""}`,options:{none:{label:"\u786C\u5207",short:"\u786C\u5207"},fade:{label:"\u6DE1\u5316",short:"\u6DE1\u5316"},slide:{label:"\u6ED1\u52D5",short:"\u6ED1\u52D5"},wipe:{label:"\u64E6\u9664",short:"\u64E6\u9664"},flip:{label:"\u7FFB\u8F49",short:"\u7FFB\u8F49"},clockWipe:{label:"\u6642\u9418",short:"\u6642\u9418"},star:{label:"\u661F\u5F62",short:"\u661F\u5F62"},circle:{label:"\u5713\u5F62",short:"\u5713\u5F62"},rectangle:{label:"\u77E9\u5F62",short:"\u77E9\u5F62"}}}}};function kg(n){const a=Jr(n);return af[a]??af.en}var Cg={en:{tool:"Effects",title:"Effects",close:"Close",hint:"Adjust color, tone, and finishing details here.",details:"Details",empty:"No effect settings yet."},zh:{tool:"\u7279\u6548",title:"\u7279\u6548",close:"\u5173\u95ED",hint:"\u5728\u8FD9\u91CC\u53EF\u4EE5\u8C03\u6574\u8272\u5F69\u3001\u660E\u5EA6\u548C\u6548\u679C\u7EC6\u8282\u3002",details:"\u7EC6\u8282\u8C03\u6574",empty:"\u6682\u65E0\u53EF\u8C03\u6574\u9879"},"zh-Hant":{tool:"\u7279\u6548",title:"\u7279\u6548",close:"\u95DC\u9589",hint:"\u5728\u9019\u88E1\u53EF\u4EE5\u8ABF\u6574\u8272\u5F69\u3001\u660E\u5EA6\u8207\u6548\u679C\u7D30\u7BC0\u3002",details:"\u7D30\u7BC0\u8ABF\u6574",empty:"\u66AB\u7121\u53EF\u8ABF\u6574\u9805"}};function Mw(n){const a=Jr(n);return Cg[a]??Cg.en}var Sg={en:{title:"Audio",close:"Close",source:"Source",speed:"Speed",duration:"Duration",volume:"Volume",fadeIn:"Fade In",fadeOut:"Fade Out",speedHint:"Speed can be adjusted here and will be used when exporting audio."},zh:{title:"\u97F3\u8F68",close:"\u5173\u95ED",source:"\u6765\u6E90",speed:"\u500D\u6570",duration:"\u65F6\u957F",volume:"\u97F3\u91CF",fadeIn:"\u6DE1\u5165\u65F6\u957F",fadeOut:"\u6DE1\u51FA\u65F6\u957F",speedHint:"\u8FD9\u91CC\u53EF\u4EE5\u76F4\u63A5\u8C03\u6574\u97F3\u9891\u500D\u6570\uFF0C\u5BFC\u51FA\u65F6\u4F1A\u6309\u8BE5\u500D\u6570\u5904\u7406\u3002"},"zh-Hant":{title:"\u97F3\u8ECC",close:"\u95DC\u9589",source:"\u4F86\u6E90",speed:"\u500D\u6578",duration:"\u6642\u9577",volume:"\u97F3\u91CF",fadeIn:"\u6DE1\u5165\u6642\u9577",fadeOut:"\u6DE1\u51FA\u6642\u9577",speedHint:"\u9019\u88E1\u53EF\u4EE5\u76F4\u63A5\u8ABF\u6574\u97F3\u8A0A\u500D\u6578\uFF0C\u5C0E\u51FA\u6642\u6703\u6309\u8A72\u500D\u6578\u8655\u7406\u3002"}};function Lw(n){const a=Jr(n);return Sg[a]??Sg.en}var Fg={en:{tool:"Adjust",title:"Adjust",close:"Close",hint:"Select an adjustment layer to edit its controls here.",details:"Details",placeholder:"Select an adjustment layer to start editing.",videoInfoHint:"Default video details are shown here when no adjustment layer is selected.",videoInfoTitle:"Video details",videoName:"Name",ratio:"Ratio",canvasSize:"Canvas",resolution:"Resolution",frameRate:"Frame rate",bitrate:"Bitrate",format:"Format",fileSize:"File size",codec:"Codec",sourceSize:"Source size",videoLength:"Duration",notAvailable:"-"},zh:{tool:"\u8C03\u8282",title:"\u8C03\u8282",close:"\u5173\u95ED",hint:"\u9009\u4E2D\u8C03\u8282\u56FE\u5C42\u540E\uFF0C\u53EF\u4EE5\u5728\u8FD9\u91CC\u7EE7\u7EED\u8C03\u6574\u53C2\u6570\u3002",details:"\u7EC6\u8282\u8C03\u6574",placeholder:"\u8BF7\u5148\u9009\u4E2D\u4E00\u4E2A\u8C03\u8282\u56FE\u5C42\u518D\u7EE7\u7EED\u7F16\u8F91\u3002",videoInfoHint:"\u5F53\u524D\u672A\u9009\u4E2D\u8C03\u8282\u56FE\u5C42\uFF0C\u8FD9\u91CC\u663E\u793A\u9ED8\u8BA4\u89C6\u9891\u4FE1\u606F\u3002",videoInfoTitle:"\u89C6\u9891\u4FE1\u606F",videoName:"\u540D\u79F0",ratio:"\u6BD4\u4F8B",canvasSize:"\u753B\u5E03\u5927\u5C0F",resolution:"\u5206\u8FA8\u7387",frameRate:"\u5E27\u7387",bitrate:"\u7801\u7387",format:"\u683C\u5F0F",fileSize:"\u6587\u4EF6\u5927\u5C0F",codec:"\u7F16\u7801",sourceSize:"\u6E90\u5C3A\u5BF8",videoLength:"\u89C6\u9891\u65F6\u957F",notAvailable:"-"},"zh-Hant":{tool:"\u8ABF\u7BC0",title:"\u8ABF\u7BC0",close:"\u95DC\u9589",hint:"\u9078\u4E2D\u8ABF\u7BC0\u5716\u5C64\u5F8C\uFF0C\u53EF\u4EE5\u5728\u9019\u88E1\u7E7C\u7E8C\u8ABF\u6574\u53C3\u6578\u3002",details:"\u7D30\u7BC0\u8ABF\u6574",placeholder:"\u8ACB\u5148\u9078\u4E2D\u4E00\u500B\u8ABF\u7BC0\u5716\u5C64\u518D\u7E7C\u7E8C\u7DE8\u8F2F\u3002",videoInfoHint:"\u76EE\u524D\u672A\u9078\u4E2D\u8ABF\u7BC0\u5716\u5C64\uFF0C\u9019\u88E1\u986F\u793A\u9810\u8A2D\u8996\u983B\u8CC7\u8A0A\u3002",videoInfoTitle:"\u8996\u983B\u8CC7\u8A0A",videoName:"\u540D\u7A31",ratio:"\u6BD4\u4F8B",canvasSize:"\u756B\u5E03\u5927\u5C0F",resolution:"\u89E3\u6790\u5EA6",frameRate:"\u5E40\u7387",bitrate:"\u78BC\u7387",format:"\u683C\u5F0F",fileSize:"\u6A94\u6848\u5927\u5C0F",codec:"\u7DE8\u78BC",sourceSize:"\u4F86\u6E90\u5C3A\u5BF8",videoLength:"\u8996\u983B\u6642\u9577",notAvailable:"-"}};function Aw(n){const a=Jr(n);return Fg[a]??Fg.en}function Nw(){return`<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false">
|
|
2046
2046
|
<path d="M9 15l6-6" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round"/>
|
|
2047
2047
|
<path d="M7.6 16.4l-1.2 2.4a.7.7 0 0 0 .93.93L9.7 18.5" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"/>
|
|
2048
2048
|
<path d="M14.4 8.4l1.2-2.4a.7.7 0 0 1 .93-.93l1.47 1.47a.7.7 0 0 1-.05 1.04L15.6 8.8" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"/>
|
|
@@ -2054,7 +2054,7 @@ Error generating stack: `+i.message+`
|
|
|
2054
2054
|
<path d="M18 6v12" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/>
|
|
2055
2055
|
<rect x="4.2" y="8" width="3.6" height="4.8" rx="1.8" fill="currentColor"/>
|
|
2056
2056
|
<rect x="16.2" y="11.2" width="3.6" height="4.8" rx="1.8" fill="currentColor"/>
|
|
2057
|
-
</svg>`}function rl(n,a){const o=of(a),l=n.transitions.options[o.key]??n.transitions.options.none;return{...o,label:l.label,short:l.short}}function mc(n,a=af.en.untitledText){return String(n??"").replace(/\s+/g," ").trim()||a}function of(n){return nf.find(a=>a.key===n)??nf[0]}function zi(n){const a=Number(n)||0;return`${a.toFixed(a>=1?1:2).replace(/0+$/,"").replace(/\.$/,"")}s`}function _r(n){return Math.max(0,(Number(n?.out)||0)-(Number(n?.in)||0))}function uo(n){return qe(Number(n)||1,.5,2)}function Tw(n){return`${uo(n).toFixed(2)}x`}function Bw(n,a=1){const o=String(n??"").trim().replace(/x$/i,""),l=Number(o);return Number.isFinite(l)?uo(l):uo(a)}function zw(n,a=0){const o=String(n??"").trim().replace(/s$/i,""),l=Number(o);return Number.isFinite(l)?Math.max(0,l):Math.max(0,a)}function fc(n,a=.4,o=.4){const l=of(n?.type??"none"),s=Math.max(0,Math.min(1.2,a-.05,o-.05));if(l.key==="none"||s<=.05)return{type:"none",duration:0};const d=Number(n?.duration),m=qe(Number.isFinite(d)?d:l.duration,.1,s);return{type:l.key,duration:m}}function lf(n){const a=n?.clips??[],o=Math.max(0,a.length-1),l=Array.isArray(n?.transitions)?n.transitions:[],s=[];for(let d=0;d<o;d++)s.push(fc(l[d],_r(a[d]),_r(a[d+1])));return s}function Mg(n,a,o="heading"){const l=n.getState().canvas??{w:1080,h:1920},s=bg[o]??bg.heading,d=Math.min(s.width,Math.max(240,l.w-64)),m=Math.min(s.fontSize,Math.max(32,Math.round(l.w*.11))),h=qe(Math.round(l.h*.18),32,Math.max(32,l.h-180));return{type:"text",x:Math.round((l.w-d)/2),y:h,text:a.textPresets[o]??s.text,color:s.color,fontSize:m,fontFamily:"Arial",fontWeight:s.fontWeight,fontStyle:"normal",textAlign:s.textAlign,width:d,backgroundColor:s.backgroundColor,borderColor:s.borderColor,borderWidth:s.borderWidth,paddingX:s.paddingX??Math.max(14,Math.round(m*.18)),paddingY:s.paddingY??Math.max(10,Math.round(m*.14)),boxShadow:s.boxShadow?{...s.boxShadow}:void 0,lineHeight:1.1,textPreset:o,textDecoration:"",textTransform:void 0,animation:"none",rotation:0}}var Jr=3,jt=.5,ea=.1,Cs=99,sf=36,Lg=6;function Cn(n,a=0){return Number.isFinite(n?.startAt)?Math.max(0,Number(n.startAt)):Math.max(0,a)}function Tr(n,a=0,o=Jr){const l=Cn(n,a);return Number.isFinite(n?.endAt)?Math.max(l+jt,Number(n.endAt)):l+Math.max(jt,o)}function al(n,a=Jr){return Math.max(jt,Tr(n,0,a)-Cn(n,0))}function $n(n,a=0){return Number.isFinite(n?.timelineTrack)?qe(Math.round(Number(n.timelineTrack)),0,Cs):Math.max(0,a)}function Dw(n){return n==="pen"||n==="line"||n==="arrow"||n==="rect"||n==="ellipse"}function Ba(n){return Dw(n?.type)}function Ea(n){return n?.type==="text"||n?.type==="sticker"||n?.type==="filter"||n?.type==="adjust"||Ba(n)}function il(n){return n*(sf+Lg)}function uf(n){const a=Array.isArray(n)?n:n?.overlays;return[...new Set((a??[]).filter(o=>Ea(o)).map(o=>$n(o)))].sort((o,l)=>o-l)}function Ss(n){const a=new Map;return uf(n).forEach((o,l)=>{a.set(o,l)}),a}function jw(n){return uf(n).length}function Ow(n){const a=jw(n);return a?il(a-1)+sf:0}function Pw(n){return n instanceof HTMLElement&&(n.dataset.meTimelineCoverSlot==="true"||n.classList.contains("me-video-timeline-cover-slot"))}function $w(n){const a=n.querySelector(".me-video-timeline-scroll");return a instanceof HTMLElement?a:null}function Fs(n){const a=$w(n);return a?[...a.children].find(o=>o instanceof HTMLElement&&!Pw(o))??null:null}function Ag(n){const a=Fs(n)?.firstElementChild;return a instanceof HTMLElement?a:null}function Ms(n,a){const o=Fs(n);if(!o)return{timelineInner:null,timelineHost:null};o.style.position="relative";const l=o.firstElementChild,s=Ow(a),d=[];for(const v of o.children)v instanceof HTMLElement&&v.classList.contains("me-video-overlay-track-host")&&d.push(v);const m=[...o.children].find(v=>v!==l&&!(v instanceof HTMLElement&&v.classList.contains("me-video-overlay-track-host")))??null;if(!m)return d.forEach(v=>v.remove()),{timelineInner:o,timelineHost:null};const h=d.shift()??null;if(d.forEach(v=>v.remove()),s<=0)return h?.remove(),{timelineInner:o,timelineHost:null};const g=h??document.createElement("div");return h||(g.className="me-video-overlay-track-host"),g.style.height=`${s}px`,(g.parentElement!==o||g.nextElementSibling!==m)&&o.insertBefore(g,m),{timelineInner:o,timelineHost:g}}function Rw(n){return((Array.isArray(n)?n:n?.overlays)??[]).reduce((a,o)=>Ea(o)?Math.max(a,Tr(o)):a,0)}function Iw(n,a,o,l){return n<l-1e-6&&o<a-1e-6}function Hw(n,a,o,l,s){const d=qe(Math.round(Number(s)||0),0,Cs);return(n??[]).every((m,h)=>h===a||!Ea(m)||$n(m)!==d?!0:!Iw(o,l,Cn(m),Tr(m)))}function Nn(n,a,o,l,s,d,m){if(!n)return m;const h=n.getBoundingClientRect(),g=Math.max(0,d-h.top),v=uf(a),w=qe(Math.floor(g/(sf+Lg)),0,v.length),W=w<v.length?v[w]:qe((v[v.length-1]??-1)+1,0,Cs);return Hw(a,o,l,s,W)?W:m}function ma(n,a,o={}){const l=Cn(n,0),s=al(n),d=Number.isFinite(o.startAt)?Number(o.startAt):l,m=Number.isFinite(o.endAt)?Number(o.endAt):d+s,h=Math.max(0,d),g=Math.max(h+jt,m),v=Math.max(jt,Number(a)||Jr,g),w=qe(h,0,Math.max(0,v-jt)),W=qe(g,w+jt,Math.max(w+jt,v));return{startAt:w,endAt:W,timelineTrack:$n({timelineTrack:o.timelineTrack??n?.timelineTrack})}}function Ng(n,a=1){const o=Math.max(0,Math.round(Number(a)||0));return o?(n??[]).map(l=>Ea(l)?{...l,timelineTrack:qe($n(l)+o,0,Cs)}:l):[...n??[]]}function za(n){return Ng(n,1)}function _g(n){return(n.overlays??[]).map((a,o)=>({overlay:a,index:o})).filter(a=>a.overlay?.type==="text").sort((a,o)=>{const l=$n(a.overlay)-$n(o.overlay);if(l!==0)return l;const s=Cn(a.overlay)-Cn(o.overlay);return Math.abs(s)>1e-6?s:a.index-o.index})}function Tg(n){return(n.overlays??[]).map((a,o)=>({overlay:a,index:o})).filter(a=>a.overlay?.type==="sticker").sort((a,o)=>{const l=$n(a.overlay)-$n(o.overlay);if(l!==0)return l;const s=Cn(a.overlay)-Cn(o.overlay);return Math.abs(s)>1e-6?s:a.index-o.index})}function Bg(n){return(n.overlays??[]).map((a,o)=>({overlay:a,index:o})).filter(a=>a.overlay?.type==="filter").sort((a,o)=>{const l=$n(a.overlay)-$n(o.overlay);if(l!==0)return l;const s=Cn(a.overlay)-Cn(o.overlay);return Math.abs(s)>1e-6?s:a.index-o.index})}function zg(n){return(n.overlays??[]).map((a,o)=>({overlay:a,index:o})).filter(a=>a.overlay?.type==="adjust").sort((a,o)=>{const l=$n(a.overlay)-$n(o.overlay);if(l!==0)return l;const s=Cn(a.overlay)-Cn(o.overlay);return Math.abs(s)>1e-6?s:a.index-o.index})}function cf(n){return(n.overlays??[]).map((a,o)=>({overlay:a,index:o})).filter(a=>Ba(a.overlay)).sort((a,o)=>{const l=$n(a.overlay)-$n(o.overlay);if(l!==0)return l;const s=Cn(a.overlay)-Cn(o.overlay);return Math.abs(s)>1e-6?s:a.index-o.index})}function Vw(n){return(n.overlays??[]).map((a,o)=>({overlay:a,index:o})).filter(a=>Ea(a.overlay)).sort((a,o)=>{const l=$n(a.overlay)-$n(o.overlay);if(l!==0)return l;const s=Cn(a.overlay)-Cn(o.overlay);return Math.abs(s)>1e-6?s:a.index-o.index})}function Gn(n){return[...new Set((n??[]).map(a=>Number(a)).filter(a=>Number.isInteger(a)&&a>=0))].sort((a,o)=>a-o)}function pc(n){if(n.__meVideoTimelineSelectionStore)return n.__meVideoTimelineSelectionStore;const a={video:new Set,text:new Set,audio:new Set,anchors:{video:null,text:null,audio:null},initialized:!1};return n.__meVideoTimelineSelectionStore=a,a}function Ww(n,a){return a==="text"?n.text:a==="audio"?n.audio:n.video}function Dg(){return["video","text","audio"]}function Br(n,a){return Gn([...Ww(pc(n),a)])}function df(n,a){const o=Gn(a),l=Gn([...n]);return l.length===o.length&&l.every((s,d)=>s===o[d])?!1:(n.clear(),o.forEach(s=>n.add(s)),!0)}function qw(n){n.dispatchEvent(new CustomEvent(fr))}function Di(n,a={},o={}){const l=pc(n);let s=!1;if(Object.prototype.hasOwnProperty.call(a,"video")&&(s=df(l.video,a.video)||s),Object.prototype.hasOwnProperty.call(a,"text")&&(s=df(l.text,a.text)||s),Object.prototype.hasOwnProperty.call(a,"audio")&&(s=df(l.audio,a.audio)||s),Object.prototype.hasOwnProperty.call(o,"video")){const d=Number.isInteger(o.video)&&o.video>=0?o.video:null;l.anchors.video!==d&&(l.anchors.video=d,s=!0)}if(Object.prototype.hasOwnProperty.call(o,"text")){const d=Number.isInteger(o.text)&&o.text>=0?o.text:null;l.anchors.text!==d&&(l.anchors.text=d,s=!0)}if(Object.prototype.hasOwnProperty.call(o,"audio")){const d=Number.isInteger(o.audio)&&o.audio>=0?o.audio:null;l.anchors.audio!==d&&(l.anchors.audio=d,s=!0)}return s&&qw(n),l}function qn(n,a,o,l={}){const s=Gn(o),d={[a]:s},m={[a]:s.length?l.anchor??s[s.length-1]:null};if(!l.preserveOther)for(const h of Dg())h!==a&&(d[h]=[],m[h]=null);return Di(n,d,m),s}function mf(n){Di(n,{video:[],text:[],audio:[]},{video:null,text:null,audio:null})}function ff(n){return Br(n,"video").length>0||Br(n,"text").length>0||Br(n,"audio").length>0}function pf(n,a,o){const l=new Set(Gn(o)),s=Br(n,a),d=s.filter(m=>l.has(m));return s.length!==d.length&&Di(n,{[a]:d},{[a]:d.length?d[d.length-1]:null}),d}function gr(n,a,o,l,s=[]){const d=Gn(s),m=!!(l?.ctrlKey||l?.metaKey),h=!!l?.shiftKey,g=pc(n),v=Br(n,a);let w=v,W=o;if(h){const X=g.anchors[a],ue=d.indexOf(X),oe=d.indexOf(o);if(ue!==-1&&oe!==-1){const ge=Math.min(ue,oe),Be=Math.max(ue,oe),Te=d.slice(ge,Be+1);w=m?Gn([...v,...Te]):Te,W=X}else m?w=v.includes(o)?v.filter(ge=>ge!==o):[...v,o]:w=[o]}else m?w=v.includes(o)?v.filter(X=>X!==o):[...v,o]:w=[o];w=Gn(w);const S={[a]:w},Q={[a]:w.length?W:null};if(!m)for(const X of Dg())X!==a&&(S[X]=[],Q[X]=null);return Di(n,S,Q),w}function Yw(n,a){const o=pc(n);o.initialized||(o.initialized=!0)}function ol(n){const a=typeof n.getState=="function"?n.getState():null;return Math.max(typeof n.contentDuration=="function"?n.contentDuration():0,Rw(a),jt)}function hc(n){const a=String(n??"").trim();if(!a)return NaN;const o=a.split(":").map(s=>s.trim()).filter(Boolean);if(!o.length)return NaN;let l=0;for(const s of o){const d=Number(s);if(!Number.isFinite(d))return NaN;l=l*60+d}return l}function vc(n){return n instanceof HTMLElement?String(n.dataset.meRawTimeText||n.textContent||"").trim():""}function co(n){const a=Ag(n);if(a){const s=[...a.children].find(m=>m instanceof HTMLElement&&String(m.style.transform||"").includes("translateX(-50%)")),d=hc(vc(s));if(Number.isFinite(d))return d}const o=[...n.querySelectorAll(".me-video-trim-actions span")].find(s=>vc(s).includes("/")),l=vc(o);if(l){const s=hc(l.split("/")[0]);if(Number.isFinite(s))return s}return 0}function Ls(n,a){return pf(n,"video",(a??[]).map((o,l)=>l)).filter(o=>!!a[o])}function hf(n,a){return Br(n,"text").filter(o=>a.overlays?.[o]?.type==="text")}function jg(n,a){return Br(n,"text").filter(o=>a.overlays?.[o]?.type==="sticker")}function Og(n,a){return Br(n,"text").filter(o=>a.overlays?.[o]?.type==="filter")}function gc(n,a){return Br(n,"text").filter(o=>a.overlays?.[o]?.type==="adjust")}function Pg(n,a){return Br(n,"text").filter(o=>Ba(a.overlays?.[o]))}function As(n,a){const o=Vw(a).map(l=>l.index);return pf(n,"text",o).filter(l=>Ea(a.overlays?.[l]))}function ll(n,a){return pf(n,"audio",(a??[]).map((o,l)=>l)).filter(o=>!!a[o])}function Uw(n,a){const o=Gn(a).filter(d=>!!n[d]);if(!o.length)return{clips:n,selection:[],changed:!1};const l=o[o.length-1]+1,s=o.map(d=>({...n[d]}));return{clips:[...n.slice(0,l),...s,...n.slice(l)],selection:s.map((d,m)=>l+m),changed:!0}}function vf(n,a){const o=Gn(a).filter(m=>Ea(n[m]));if(!o.length)return{overlays:n,selection:[],changed:!1};const l=o.map(m=>{const h=n[m];return h?.type==="pen"?{...h,points:(h.points??[]).map((g,v)=>(v%2,(Number(g)||0)+24))}:h?.type==="line"||h?.type==="arrow"?{...h,x1:(Number(h.x1)||0)+24,y1:(Number(h.y1)||0)+24,x2:(Number(h.x2)||0)+24,y2:(Number(h.y2)||0)+24}:{...h,x:(Number(h.x)||0)+24,y:(Number(h.y)||0)+24}}),s=[...Ng(n,l.length),...l.map((m,h)=>({...m,timelineTrack:qe(h,0,Cs)}))],d=s.length-l.length;return{overlays:s,selection:l.map((m,h)=>d+h),changed:!0}}function Zw(n,a){const o=Gn(a).filter(d=>!!n[d]);if(!o.length)return{audioClips:n,selection:[],changed:!1};const l=o[o.length-1]+1,s=o.map(d=>{const m=n[d];return{...m,track:Number.isInteger(m?.track)&&m.track>=0?m.track:d,startAt:Math.max(0,(Number(m.startAt)||0)+.2)}});return{audioClips:[...n.slice(0,l),...s,...n.slice(l)],selection:s.map((d,m)=>l+m),changed:!0}}function Kw(n,a){const o=Gn(a).filter(s=>!!n[s]);if(!o.length||o.length>=n.length)return{clips:n,selection:o,changed:!1};const l=new Set(o);return{clips:n.filter((s,d)=>!l.has(d)),selection:[],changed:!0}}function gf(n,a){const o=new Set(Gn(a).filter(l=>Ea(n[l])));return o.size?{overlays:n.filter((l,s)=>!o.has(s)),selection:[],changed:!0}:{overlays:n,selection:[],changed:!1}}function Gw(n,a){const o=new Set(Gn(a).filter(l=>!!n[l]));return o.size?{audioClips:n.filter((l,s)=>!o.has(s)),selection:[],changed:!0}:{audioClips:n,selection:[],changed:!1}}function Xw(n,a,o){const l=new Set(Gn(a).filter(g=>!!n[g]));if(!l.size)return{clips:n,selection:[],changed:!1};let s=0,d=!1;const m=[],h=[];for(let g=0;g<n.length;g++){const v=n[g],w=Math.max(0,(Number(v?.out)||0)-(Number(v?.in)||0)),W=s+w;if(l.has(g)&&o>s+ea&&o<W-ea){const S=(Number(v.in)||0)+(o-s);h.push(m.length),m.push({...v,out:S}),h.push(m.length),m.push({...v,in:S}),d=!0}else l.has(g)&&h.push(m.length),m.push(v);s=W}return{clips:d?m:n,selection:d?h:Gn(a),changed:d}}function Qw(n,a,o,l){const s=new Set(Gn(a).filter(g=>Ea(n[g])));if(!s.size)return{overlays:n,selection:[],changed:!1};let d=!1;const m=[],h=[];for(let g=0;g<n.length;g++){const v=n[g];if(Ea(v)&&s.has(g)){const w=Cn(v),W=Tr(v,w),S=qe(l,w+jt,W-jt);if(S>w+1e-6&&S<W-1e-6){h.push(m.length),m.push({...v,...ma(v,o,{startAt:w,endAt:S,timelineTrack:$n(v)})}),h.push(m.length),m.push({...v,...ma(v,o,{startAt:S,endAt:W,timelineTrack:$n(v)})}),d=!0;continue}h.push(m.length)}m.push(v)}return{overlays:d?m:n,selection:d?h:Gn(a),changed:d}}function Jw(n,a,o){const l=new Set(Gn(a).filter(h=>!!n[h]));if(!l.size)return{audioClips:n,selection:[],changed:!1};let s=!1;const d=[],m=[];for(let h=0;h<n.length;h++){const g=n[h],v=Math.max(0,Number(g?.startAt)||0),w=_r(g),W=v+w;if(l.has(h)&&o>v+ea&&o<W-ea){const S=(Number(g.in)||0)+(o-v),Q=Math.max(0,S-(Number(g.in)||0)),X=Math.max(0,(Number(g.out)||0)-S);m.push(d.length),d.push({...g,track:Number.isInteger(g?.track)&&g.track>=0?g.track:h,out:S,fadeIn:Math.min(Number(g.fadeIn)||0,Q),fadeOut:0}),m.push(d.length),d.push({...g,track:Number.isInteger(g?.track)&&g.track>=0?g.track:h,in:S,startAt:o,fadeIn:0,fadeOut:Math.min(Number(g.fadeOut)||0,X)}),s=!0;continue}l.has(h)&&m.push(d.length),d.push(g)}return{audioClips:s?d:n,selection:s?m:Gn(a),changed:s}}function e5(n,a,o){const l=new Set(Gn(a));let s=0;for(let d=0;d<n.length;d++){const m=n[d],h=Math.max(0,(Number(m?.out)||0)-(Number(m?.in)||0)),g=s+h;if(l.has(d)&&o>s+ea&&o<g-ea)return!0;s=g}return!1}function t5(n,a,o){return Gn(a).some(l=>{const s=n[l];if(!Ea(s))return!1;const d=Cn(s),m=Tr(s,d);return o>d+jt&&o<m-jt})}function n5(n,a,o){return Gn(a).some(l=>{const s=n[l];if(!s)return!1;const d=Math.max(0,Number(s.startAt)||0),m=d+_r(s);return o>d+ea&&o<m-ea})}function r5(n,a){const o=a.getState(),l=o.clips??[],s=o.audioClips??[],d=o.overlays??[],m=Ls(n,l),h=ll(n,s),g=As(n,o);if(!m.length&&!h.length&&!g.length)return!1;let v=l,w=s,W=d,S=m,Q=h,X=g,ue=!1;if(m.length){const oe=Uw(v,m);v=oe.clips,S=oe.selection,ue=oe.changed||ue}if(h.length){const oe=Zw(w,h);w=oe.audioClips,Q=oe.selection,ue=oe.changed||ue}if(g.length){const oe=vf(W,g);W=oe.overlays,X=oe.selection,ue=oe.changed||ue}return ue?(a.commit({clips:v,audioClips:w,overlays:W}),Di(n,{video:S,audio:Q,text:X},{video:S.length?S[S.length-1]:null,audio:Q.length?Q[Q.length-1]:null,text:X.length?X[X.length-1]:null}),!0):!1}function $g(n,a){const o=a.getState(),l=o.clips??[],s=o.audioClips??[],d=o.overlays??[],m=Ls(n,l),h=ll(n,s),g=As(n,o);let v=l,w=s,W=d,S=m,Q=h,X=g,ue=!1;const oe=Kw(v,m);oe.changed&&(v=oe.clips,S=oe.selection,ue=!0);const ge=gf(W,g);ge.changed&&(W=ge.overlays,X=ge.selection,ue=!0);const Be=Gw(w,h);return Be.changed&&(w=Be.audioClips,Q=Be.selection,ue=!0),ue?(a.commit({clips:v,audioClips:w,overlays:W}),Di(n,{video:S,audio:Q,text:X},{video:S.length?S[S.length-1]:null,audio:Q.length?Q[Q.length-1]:null,text:X.length?X[X.length-1]:null}),!0):!1}function a5(n,a){const o=a.getState(),l=o.clips??[],s=o.audioClips??[],d=o.overlays??[],m=co(n),h=Ls(n,l),g=ll(n,s),v=As(n,o);let w=l,W=s,S=d,Q=h,X=g,ue=v,oe=!1;if(h.length){const ge=Xw(w,h,m);w=ge.clips,Q=ge.selection,oe=ge.changed||oe}if(g.length){const ge=Jw(W,g,m);W=ge.audioClips,X=ge.selection,oe=ge.changed||oe}if(v.length){const ge=Qw(S,v,Math.max(ol(a),m+jt),m);S=ge.overlays,ue=ge.selection,oe=ge.changed||oe}return oe?(a.commit({clips:w,audioClips:W,overlays:S}),Di(n,{video:Q,audio:X,text:ue},{video:Q.length?Q[Q.length-1]:null,audio:X.length?X[X.length-1]:null,text:ue.length?ue[ue.length-1]:null}),!0):!1}function bc(n,a){const o=document.createElement("div");o.className="me-video-text-field";const l=document.createElement("label");return l.textContent=n,o.append(l,a),o}function Hr(n){const a=document.createElement("button");return a.type="button",a.className="me-video-text-mini",a.textContent=n,a}function i5(n,a){const o=document.createElement("button");return o.type="button",o.className="me-video-text-preset",o.dataset.preset=a,o.textContent=n,o}var o5=[{value:"300",label:"Light"},{value:"400",label:"Regular"},{value:"500",label:"Medium"},{value:"600",label:"Semibold"},{value:"700",label:"Bold"},{value:"800",label:"Extra Bold"}],Rg={en:{content:"Content",preset:"Preset",styles:"Styles",size:"Size",fill:"Fill",decoration:"Decoration",italic:"Italic",underline:"Underline",strike:"Strike",case:"Case",caseNone:"None",uppercase:"Uppercase",lowercase:"Lowercase",capitalize:"Capitalize",alignLeft:"Left",alignCenter:"Center",alignRight:"Right",animations:"Animations",animation:"Animation",fontStroke:"Font stroke",fontShadow:"Font shadow",x:"X",y:"Y",blur:"Blur",transparent:"Transparent",none:"None"},zh:{content:"\u5185\u5BB9",preset:"\u9884\u8BBE",styles:"\u6837\u5F0F",size:"\u5927\u5C0F",fill:"\u586B\u5145",decoration:"\u4FEE\u9970",italic:"\u659C\u4F53",underline:"\u4E0B\u5212\u7EBF",strike:"\u5220\u9664\u7EBF",case:"\u5927\u5C0F\u5199",caseNone:"\u65E0",uppercase:"\u5168\u90E8\u5927\u5199",lowercase:"\u5168\u90E8\u5C0F\u5199",capitalize:"\u9996\u5B57\u6BCD\u5927\u5199",alignLeft:"\u5DE6\u5BF9\u9F50",alignCenter:"\u5C45\u4E2D",alignRight:"\u53F3\u5BF9\u9F50",animations:"\u52A8\u753B",animation:"\u52A8\u753B",fontStroke:"\u6587\u5B57\u63CF\u8FB9",fontShadow:"\u6587\u5B57\u9634\u5F71",x:"X",y:"Y",blur:"\u6A21\u7CCA",transparent:"\u900F\u660E",none:"\u65E0"},"zh-Hant":{content:"\u5167\u5BB9",preset:"\u9810\u8A2D",styles:"\u6A23\u5F0F",size:"\u5927\u5C0F",fill:"\u586B\u5145",decoration:"\u4FEE\u98FE",italic:"\u659C\u9AD4",underline:"\u5E95\u7DDA",strike:"\u522A\u9664\u7DDA",case:"\u5927\u5C0F\u5BEB",caseNone:"\u7121",uppercase:"\u5168\u90E8\u5927\u5BEB",lowercase:"\u5168\u90E8\u5C0F\u5BEB",capitalize:"\u9996\u5B57\u6BCD\u5927\u5BEB",alignLeft:"\u9760\u5DE6",alignCenter:"\u7F6E\u4E2D",alignRight:"\u9760\u53F3",animations:"\u52D5\u756B",animation:"\u52D5\u756B",fontStroke:"\u6587\u5B57\u63CF\u908A",fontShadow:"\u6587\u5B57\u9670\u5F71",x:"X",y:"Y",blur:"\u6A21\u7CCA",transparent:"\u900F\u660E",none:"\u7121"}},Ig={en:{tool:"Ratio",title:"Ratio & canvas size",restore:"Restore",close:"Close",commonPresets:"Platform ratio presets",customSize:"Custom resolution",fitMode:"Canvas fill mode",width:"Width (px)",height:"Height (px)",lockRatio:"Lock ratio",unlockRatio:"Unlock ratio",quickPortrait:"1080p Portrait",quickLandscape:"1080p Landscape",summary:"Current output",baseOutput:"Base output",cover:"Crop to fill",contain:"Fit inside",force:"Stretch to fill",coverHint:"Fills the canvas and crops any overflow.",containHint:"Keeps the full frame and may add letterboxing.",forceHint:"Stretches the frame to the target size without cropping.",cinematic:"Cinematic",tablet:"Tablet"},zh:{tool:"\u6BD4\u4F8B",title:"\u6BD4\u4F8B\u4E0E\u753B\u5E03\u5C3A\u5BF8",restore:"\u6062\u590D",close:"\u5173\u95ED",commonPresets:"\u5E73\u53F0\u6BD4\u4F8B\u9884\u8BBE",customSize:"\u81EA\u5B9A\u4E49\u5206\u8FA8\u7387",fitMode:"\u753B\u9762\u586B\u5145\u9009\u9879",width:"\u5BBD\u5EA6 (px)",height:"\u9AD8\u5EA6 (px)",lockRatio:"\u9501\u5B9A\u6BD4\u4F8B",unlockRatio:"\u89E3\u9501\u6BD4\u4F8B",quickPortrait:"1080p \u7AD6\u5C4F",quickLandscape:"1080p \u6A2A\u5C4F",summary:"\u5F53\u524D\u8F93\u51FA",baseOutput:"\u539F\u59CB\u8F93\u51FA",cover:"\u88C1\u526A\u94FA\u6EE1",contain:"\u5B8C\u6574\u663E\u793A",force:"\u62C9\u4F38\u94FA\u6EE1",coverHint:"\u94FA\u6EE1\u753B\u5E03\uFF0C\u591A\u4F59\u533A\u57DF\u4F1A\u88AB\u88C1\u526A\u3002",containHint:"\u5B8C\u6574\u4FDD\u7559\u753B\u9762\uFF0C\u53EF\u80FD\u51FA\u73B0\u7559\u767D\u3002",forceHint:"\u5F3A\u5236\u62C9\u4F38\u5230\u76EE\u6807\u5C3A\u5BF8\uFF0C\u4E0D\u88C1\u526A\u3002",cinematic:"\u7535\u5F71\u5BBD\u5C4F",tablet:"\u5E73\u677F"},"zh-Hant":{tool:"\u6BD4\u4F8B",title:"\u6BD4\u4F8B\u8207\u756B\u5E03\u5C3A\u5BF8",restore:"\u9084\u539F",close:"\u95DC\u9589",commonPresets:"\u5E73\u53F0\u6BD4\u4F8B\u9810\u8A2D",customSize:"\u81EA\u8A02\u89E3\u6790\u5EA6",fitMode:"\u756B\u9762\u586B\u5145\u9078\u9805",width:"\u5BEC\u5EA6 (px)",height:"\u9AD8\u5EA6 (px)",lockRatio:"\u9396\u5B9A\u6BD4\u4F8B",unlockRatio:"\u89E3\u9396\u6BD4\u4F8B",quickPortrait:"1080p \u76F4\u5F0F",quickLandscape:"1080p \u6A6B\u5F0F",summary:"\u76EE\u524D\u8F38\u51FA",baseOutput:"\u539F\u59CB\u8F38\u51FA",cover:"\u88C1\u5207\u92EA\u6EFF",contain:"\u5B8C\u6574\u986F\u793A",force:"\u62C9\u4F38\u92EA\u6EFF",coverHint:"\u92EA\u6EFF\u756B\u5E03\uFF0C\u591A\u9918\u5340\u57DF\u6703\u88AB\u88C1\u5207\u3002",containHint:"\u5B8C\u6574\u4FDD\u7559\u756B\u9762\uFF0C\u53EF\u80FD\u51FA\u73FE\u7559\u767D\u3002",forceHint:"\u5F37\u5236\u62C9\u4F38\u81F3\u76EE\u6A19\u5C3A\u5BF8\uFF0C\u4E0D\u88C1\u5207\u3002",cinematic:"\u96FB\u5F71\u5BEC\u87A2\u5E55",tablet:"\u5E73\u677F"}},l5=[{id:"facebook-post",platform:"Facebook",type:"Post",iconText:"f",iconTheme:"facebook",ratios:["1:1","4:5","16:9"]},{id:"facebook-story",platform:"Facebook",type:"Story",iconText:"f",iconTheme:"facebook",ratios:["9:16"]},{id:"instagram-post",platform:"Instagram",type:"Post",iconText:"IG",iconTheme:"instagram",ratios:["1:1","4:5","16:9"]},{id:"instagram-story",platform:"Instagram",type:"Story",iconText:"IG",iconTheme:"instagram",ratios:["9:16"]},{id:"tiktok-photo",platform:"TikTok",type:"Photo",iconText:"T",iconTheme:"tiktok",ratios:["1:1","4:5","9:16"]},{id:"x-post",platform:"X",type:"Post",iconText:"X",iconTheme:"x",ratios:["1:1","16:9"]},{id:"linkedin-post",platform:"LinkedIn",type:"Post",iconText:"in",iconTheme:"linkedin",ratios:["1:1","16:9"]},{id:"pinterest-post",platform:"Pinterest",type:"Post",iconText:"P",iconTheme:"pinterest",ratios:["2:3","1:1"]},{id:"reddit-media",platform:"Reddit",type:"Media",iconText:"R",iconTheme:"reddit",ratios:["1:1","16:9"]},{id:"threads-post",platform:"Threads",type:"Post",iconText:"@",iconTheme:"threads",ratios:["1:1","4:5","16:9"]},{id:"telegram-post",platform:"Telegram",type:"Post",iconText:"TG",iconTheme:"telegram",ratios:["1:1","16:9"]}],s5=["9:16","16:9","1:1","4:5","2:3","3:2"],Hg={en:{tool:"Sticker",title:"Stickers",uploadTitle:"Upload sticker",uploadHint:"Click or drop an image here",uploadFormats:"Supports PNG, JPG, WEBP, SVG",libraryTitle:"Built-in sticker library",classicTitle:"Classic stickers",vibeTitle:"Vibe stickers",shapeTitle:"Shape stickers",defaultLabel:"Sticker",uploadedLabel:"Image sticker",emojiLabel:"Emoji sticker"},zh:{tool:"\u8D34\u7EB8",title:"\u8D34\u7EB8",uploadTitle:"\u81EA\u5B9A\u4E49\u672C\u5730\u56FE\u7247\u8D34\u7EB8",uploadHint:"\u70B9\u51FB\u6216\u62D6\u62FD\u56FE\u7247\u5230\u8FD9\u91CC",uploadFormats:"\u652F\u6301 PNG\u3001JPG\u3001WEBP\u3001SVG",libraryTitle:"\u5185\u7F6E\u7ECF\u5178\u8D34\u7EB8\u5E93",classicTitle:"\u7ECF\u5178\u8D34\u7EB8",vibeTitle:"\u6C1B\u56F4\u8D34\u7EB8",shapeTitle:"\u5F62\u72B6\u8D34\u7EB8",defaultLabel:"\u8D34\u7EB8",uploadedLabel:"\u56FE\u7247\u8D34\u7EB8",emojiLabel:"\u8868\u60C5\u8D34\u7EB8"},"zh-Hant":{tool:"\u8CBC\u7D19",title:"\u8CBC\u7D19",uploadTitle:"\u81EA\u8A02\u672C\u6A5F\u5716\u7247\u8CBC\u7D19",uploadHint:"\u9EDE\u64CA\u6216\u62D6\u62FD\u5716\u7247\u5230\u9019\u88E1",uploadFormats:"\u652F\u63F4 PNG\u3001JPG\u3001WEBP\u3001SVG",libraryTitle:"\u5167\u5EFA\u7D93\u5178\u8CBC\u7D19\u5EAB",classicTitle:"\u7D93\u5178\u8CBC\u7D19",vibeTitle:"\u6C1B\u570D\u8CBC\u7D19",shapeTitle:"\u5F62\u72C0\u8CBC\u7D19",defaultLabel:"\u8CBC\u7D19",uploadedLabel:"\u5716\u7247\u8CBC\u7D19",emojiLabel:"\u8868\u60C5\u8CBC\u7D19"}},bf={en:{tool:"Color",title:"Color",filterTool:"Filter",filterTitle:"Filter",presets:"Filter presets",adjustments:"Adjustments",reset:"Reset",brightness:"Brightness",contrast:"Contrast",saturation:"Saturation",temperature:"Temperature",tint:"Tint",vibrance:"Vibrance",gamma:"Gamma",colorSection:"Color",toneSection:"Brightness",effectsSection:"Effects",highlights:"Highlights",shadows:"Shadows",whites:"Whites",blacks:"Blacks",lightSense:"Light Sense",sharpen:"Sharpen",clarity:"Clarity",grain:"Grain",fade:"Fade",vignette:"Vignette",presetNames:{none:"Normal",sepia:"Retro",cool:"Cold",warm:"Warm",vivid:"Cyber",bw:"B&W"}},zh:{tool:"\u8C03\u8272",title:"\u8C03\u8272",filterTool:"\u6EE4\u955C",filterTitle:"\u6EE4\u955C",presets:"\u6EE4\u955C\u9884\u8BBE",adjustments:"\u753B\u9762\u5FAE\u8C03",reset:"\u91CD\u7F6E",brightness:"\u4EAE\u5EA6",contrast:"\u5BF9\u6BD4\u5EA6",saturation:"\u9971\u548C\u5EA6",temperature:"\u8272\u6E29",tint:"\u8272\u8C03",vibrance:"\u81EA\u7136\u9971\u548C\u5EA6",gamma:"Gamma",colorSection:"\u8272\u5F69",toneSection:"\u660E\u5EA6",effectsSection:"\u6548\u679C",highlights:"\u9AD8\u5149",shadows:"\u9634\u5F71",whites:"\u767D\u8272",blacks:"\u9ED1\u8272",lightSense:"\u5149\u611F",sharpen:"\u9510\u5316",clarity:"\u6E05\u6670",grain:"\u9897\u7C92",fade:"\u892A\u8272",vignette:"\u6697\u89D2",presetNames:{none:"\u539F\u753B (Normal)",sepia:"\u590D\u53E4 (Retro)",cool:"\u51B7\u8272 (Cold)",warm:"\u6696\u9633 (Warm)",vivid:"\u8D5B\u535A (Cyber)",bw:"\u9ED1\u767D (B&W)"}},"zh-Hant":{tool:"\u8ABF\u8272",title:"\u8ABF\u8272",filterTool:"\u6FFE\u93E1",filterTitle:"\u6FFE\u93E1",presets:"\u6FFE\u93E1\u9810\u8A2D",adjustments:"\u756B\u9762\u5FAE\u8ABF",reset:"\u91CD\u8A2D",brightness:"\u4EAE\u5EA6",contrast:"\u5C0D\u6BD4\u5EA6",saturation:"\u98FD\u548C\u5EA6",temperature:"\u8272\u6EAB",tint:"\u8272\u8ABF",vibrance:"\u81EA\u7136\u98FD\u548C\u5EA6",gamma:"Gamma",colorSection:"\u8272\u5F69",toneSection:"\u660E\u5EA6",effectsSection:"\u6548\u679C",highlights:"\u9AD8\u5149",shadows:"\u9670\u5F71",whites:"\u767D\u8272",blacks:"\u9ED1\u8272",lightSense:"\u5149\u611F",sharpen:"\u92B3\u5316",clarity:"\u6E05\u6670",grain:"\u9846\u7C92",fade:"\u892A\u8272",vignette:"\u6697\u89D2",presetNames:{none:"\u539F\u756B (Normal)",sepia:"\u5FA9\u53E4 (Retro)",cool:"\u51B7\u8272 (Cold)",warm:"\u6696\u967D (Warm)",vivid:"\u8CFD\u535A (Cyber)",bw:"\u9ED1\u767D (B&W)"}}};function u5(n){const a=Qr(n);return{...Hg.en,...Hg[a]??{}}}function yf(n){const a=Qr(n),o=bf[a]??{};return{...bf.en,...o,presetNames:{...bf.en.presetNames,...o.presetNames??{}}}}function sl(n,a,o="rgba(255,255,255,0.16)"){let l="";return n==="triangle"?l=`<polygon points="128,28 224,220 32,220" fill="${a}" stroke="${o}" stroke-width="8" stroke-linejoin="round"/>`:n==="circle"?l=`<circle cx="128" cy="128" r="94" fill="${a}" stroke="${o}" stroke-width="8"/>`:n==="square"?l=`<rect x="40" y="40" width="176" height="176" rx="40" fill="${a}" stroke="${o}" stroke-width="8"/>`:n==="diamond"?l=`<polygon points="128,24 224,128 128,232 32,128" fill="${a}" stroke="${o}" stroke-width="8" stroke-linejoin="round"/>`:n==="star"?l=`<polygon points="128,24 154,92 228,96 170,142 188,220 128,176 68,220 86,142 28,96 102,92" fill="${a}" stroke="${o}" stroke-width="8" stroke-linejoin="round"/>`:n==="heart"?l=`<path d="M128 220c-7-7-18-16-30-27C64 165 38 141 38 102c0-28 20-50 48-50 18 0 33 10 42 24 9-14 24-24 42-24 28 0 48 22 48 50 0 39-26 63-60 91-12 11-23 20-30 27Z" fill="${a}" stroke="${o}" stroke-width="8" stroke-linejoin="round"/>`:l=`<rect x="40" y="40" width="176" height="176" rx="40" fill="${a}" stroke="${o}" stroke-width="8"/>`,`data:image/svg+xml;charset=UTF-8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256">${l}</svg>`)}`}function c5(n){return[{id:"classic",title:n.classicTitle,items:[{id:"heart-eyes",emoji:"\u{1F60D}",label:`${n.emojiLabel} 1`},{id:"joy",emoji:"\u{1F602}",label:`${n.emojiLabel} 2`},{id:"grin",emoji:"\u{1F603}",label:`${n.emojiLabel} 3`},{id:"pray",emoji:"\u{1F64F}",label:`${n.emojiLabel} 4`},{id:"thumbs-up",emoji:"\u{1F44D}",label:`${n.emojiLabel} 5`},{id:"hundred",emoji:"\u{1F4AF}",label:`${n.emojiLabel} 6`},{id:"cat-smile",emoji:"\u{1F63A}",label:`${n.emojiLabel} 7`},{id:"cat-happy",emoji:"\u{1F638}",label:`${n.emojiLabel} 8`},{id:"paw",emoji:"\u{1F43E}",label:`${n.emojiLabel} 9`},{id:"fish",emoji:"\u{1F41F}",label:`${n.emojiLabel} 10`}]},{id:"vibe",title:n.vibeTitle,items:[{id:"sparkles",emoji:"\u2728",label:`${n.emojiLabel} 5`},{id:"heart",emoji:"\u{1F497}",label:`${n.emojiLabel} 6`},{id:"fire",emoji:"\u{1F525}",label:`${n.emojiLabel} 7`},{id:"party",emoji:"\u{1F389}",label:`${n.emojiLabel} 8`}]},{id:"shape",title:n.shapeTitle,items:[{id:"triangle",src:sl("triangle","#f97316"),label:"Triangle"},{id:"circle",src:sl("circle","#22c55e"),label:"Circle"},{id:"square",src:sl("square","#3b82f6"),label:"Square"},{id:"diamond",src:sl("diamond","#8b5cf6"),label:"Diamond"},{id:"star",src:sl("star","#facc15"),label:"Star"},{id:"heart-shape",src:sl("heart","#fb7185"),label:"Heart"}]}]}function d5(n){const a=Qr(n),o={...Rg.en,...Rg[a]??{}};return o.searchFont||(o.searchFont=a==="zh-Hant"?"\u641C\u5C0B\u5B57\u9AD4...":a==="zh"?"\u641C\u7D22\u5B57\u4F53...":"Search font..."),o.loadingFonts||(o.loadingFonts=a==="zh-Hant"?"\u6B63\u5728\u8B80\u53D6\u5B57\u9AD4...":a==="zh"?"\u6B63\u5728\u8BFB\u53D6\u5B57\u4F53...":"Loading fonts..."),o.noFonts||(o.noFonts=a==="zh-Hant"?"\u627E\u4E0D\u5230\u5B57\u9AD4":a==="zh"?"\u6CA1\u6709\u627E\u5230\u5B57\u4F53":"No fonts found"),o.sampleText||(o.sampleText=wg),o}function m5(n){const a=Qr(n);return{...Ig.en,...Ig[a]??{}}}var Vg={en:{tool:"Annotate",title:"Annotate",hint:"Configure the annotation tools here.",tools:"Tools",color:"Color",custom:"Custom",width:"Line width",reset:"Reset",brush:"Brush",eraser:"Eraser",line:"Line",arrow:"Arrow",rectangle:"Rectangle",ellipse:"Ellipse"},zh:{tool:"\u6807\u6CE8",title:"\u6807\u6CE8",hint:"\u5728\u8FD9\u91CC\u914D\u7F6E\u6807\u6CE8\u5DE5\u5177\u7684\u6837\u5F0F\u53C2\u6570\u3002",tools:"\u5DE5\u5177",color:"\u989C\u8272",custom:"\u81EA\u5B9A\u4E49",width:"\u7EBF\u5BBD",reset:"\u91CD\u7F6E",brush:"\u753B\u7B14",eraser:"\u6A61\u76AE",line:"\u76F4\u7EBF",arrow:"\u7BAD\u5934",rectangle:"\u77E9\u5F62",ellipse:"\u692D\u5706"},"zh-Hant":{tool:"\u6A19\u8A3B",title:"\u6A19\u8A3B",hint:"\u5728\u9019\u88E1\u8A2D\u5B9A\u6A19\u8A3B\u5DE5\u5177\u7684\u6A23\u5F0F\u53C3\u6578\u3002",tools:"\u5DE5\u5177",color:"\u984F\u8272",custom:"\u81EA\u8A02",width:"\u7DDA\u5BEC",reset:"\u91CD\u8A2D",brush:"\u756B\u7B46",eraser:"\u6A61\u76AE",line:"\u76F4\u7DDA",arrow:"\u7BAD\u982D",rectangle:"\u77E9\u5F62",ellipse:"\u6A62\u5713"}};function f5(n){const a=Qr(n);return Vg[a]??Vg.en}var Wg=[{key:"brush"},{key:"eraser"},{key:"line"},{key:"arrow"},{key:"rectangle"},{key:"ellipse"}],Ns=2,_s=24,ul=14,p5={brush:"pen",line:"line",arrow:"arrow",rectangle:"rect",ellipse:"ellipse"},qg=["#ffffff","#ff4d4f","#ff7a45","#ffa940","#fadb14","#95de64","#52c41a","#13c2c2","#40a9ff","#2f54eb","#7c7cf0","#eb2f96","#722ed1","#000000"],ji={tool:"brush",color:"#ff4d4f",width:4};function h5(n){switch(n){case"eraser":return'<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M7.2 15.8 14.9 8a1.8 1.8 0 0 1 2.6 0l2.6 2.6a1.8 1.8 0 0 1 0 2.6l-5.3 5.3a2.4 2.4 0 0 1-1.7.7h-4a2.4 2.4 0 0 1-1.7-.7l-1-1a1.2 1.2 0 0 1 0-1.7Z" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linejoin="round"/><path d="M13.1 19.2h6.2" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/></svg>';case"line":return'<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M5 19 19 5" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round"/></svg>';case"arrow":return'<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M5 16 15 6" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round"/><path d="M10.5 6H15v4.5" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"/></svg>';case"rectangle":return'<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><rect x="5.5" y="5.5" width="13" height="13" rx="1.8" fill="none" stroke="currentColor" stroke-width="1.8"/></svg>';case"ellipse":return'<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><ellipse cx="12" cy="12" rx="6.6" ry="6.6" fill="none" stroke="currentColor" stroke-width="1.8"/></svg>';default:return'<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="m8.2 15.8 7.9-7.9a1.9 1.9 0 0 1 2.7 2.7l-7.9 7.9" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/><path d="M7.5 16.5c-.5 2.5-2.4 3.8-3.8 4 .2-1.5 1.5-3.3 4-3.8Z" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"/></svg>'}}function v5(){return'<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="m5 19 3.9-1 9.2-9.2a1.8 1.8 0 0 0 0-2.6l-.3-.3a1.8 1.8 0 0 0-2.6 0L6 15.1 5 19Z" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/><path d="m13.7 7.3 3 3" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/><path d="m5 19 3.3-3.3" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/></svg>'}function Yg(n,a){switch(n?.type){case"pen":return a.brush;case"line":return a.line;case"arrow":return a.arrow;case"rect":return a.rectangle;case"ellipse":return a.ellipse;default:return a.tool}}function yc(n=ji){const a=Wg.some(l=>l.key===n?.tool)?n.tool:ji.tool,o=Zg(n?.color);return{tool:a,color:o,width:qe(Math.round(Number(n?.width)||ji.width),Ns,_s)}}function xf(n,a){return n?.tool===a?.tool&&n?.color===a?.color&&Number(n?.width)===Number(a?.width)}function Ug(n){return xf(n,ji)}function g5(n){return`${qe(Math.round(Number(n)||ji.width),Ns,_s)}px`}function Zg(n){const a=String(n??"").trim().toLowerCase();return/^#?[0-9a-f]{3}$/.test(a)?`#${a.replace("#","").split("").map(o=>`${o}${o}`).join("")}`:/^#?[0-9a-f]{6}$/.test(a)?`#${a.replace("#","")}`:ji.color}function xc(n){const a=Zg(n);return{r:Number.parseInt(a.slice(1,3),16),g:Number.parseInt(a.slice(3,5),16),b:Number.parseInt(a.slice(5,7),16)}}function wc(n,a,o){return`#${[n,a,o].map(l=>qe(Math.round(Number(l)||0),0,255).toString(16).padStart(2,"0")).join("")}`}function wf(n,a,o){const l=qe(Number(n)||0,0,255)/255,s=qe(Number(a)||0,0,255)/255,d=qe(Number(o)||0,0,255)/255,m=Math.max(l,s,d),h=Math.min(l,s,d),g=m-h;let v=0;return g>0&&(m===l?v=60*((s-d)/g%6):m===s?v=60*((d-l)/g+2):v=60*((l-s)/g+4)),v<0&&(v+=360),{h:v,s:m<=0?0:g/m,v:m}}function Ef(n,a,o){const l=((Number(n)||0)%360+360)%360,s=qe(Number(a)||0,0,1),d=qe(Number(o)||0,0,1),m=d*s,h=l/60,g=m*(1-Math.abs(h%2-1));let v=0,w=0,W=0;h>=0&&h<1?(v=m,w=g):h<2?(v=g,w=m):h<3?(w=m,W=g):h<4?(w=g,W=m):h<5?(v=g,W=m):(v=m,W=g);const S=d-m;return{r:Math.round((v+S)*255),g:Math.round((w+S)*255),b:Math.round((W+S)*255)}}function b5(n){const a=Ef(n,1,1);return wc(a.r,a.g,a.b)}var y5=["none","sepia","cool","warm","vivid","bw"],cl={brightness:0,contrast:0,saturation:0,temperature:0,tint:0,vibrance:0,gamma:0,highlights:0,shadows:0,whites:0,blacks:0,lightSense:0,sharpen:0,clarity:0,grain:0,fade:0,vignette:0},kf=Object.keys(cl);function Kg(n){return[{title:n.colorSection,items:[{key:"temperature",label:n.temperature,format:"offset",min:-1,max:1},{key:"tint",label:n.tint,format:"offset",min:-1,max:1},{key:"saturation",label:n.saturation,format:"percent",min:-1,max:1},{key:"vibrance",label:n.vibrance,format:"offset",min:-1,max:1},{key:"gamma",label:n.gamma,format:"percent",min:-1,max:1}]},{title:n.toneSection,items:[{key:"brightness",label:n.brightness,format:"percent",min:-1,max:1},{key:"contrast",label:n.contrast,format:"percent",min:-1,max:1},{key:"highlights",label:n.highlights,format:"offset",min:-1,max:1},{key:"shadows",label:n.shadows,format:"offset",min:-1,max:1},{key:"whites",label:n.whites,format:"offset",min:-1,max:1},{key:"blacks",label:n.blacks,format:"offset",min:-1,max:1},{key:"lightSense",label:n.lightSense,format:"offset",min:-1,max:1}]},{title:n.effectsSection,items:[{key:"sharpen",label:n.sharpen,format:"amount",min:0,max:1},{key:"clarity",label:n.clarity,format:"amount",min:0,max:1},{key:"grain",label:n.grain,format:"amount",min:0,max:1},{key:"fade",label:n.fade,format:"amount",min:0,max:1},{key:"vignette",label:n.vignette,format:"amount",min:0,max:1}]}]}function x5(n){if(typeof n.applyMut=="function"){n.applyMut(a=>({...a,filters:{...a.filters,...cl}}));return}n.setFilters({...cl})}function w5(n){const a=new Map(P0.map(o=>[o.id,o]));return y5.map(o=>{if(o==="none")return{id:"",css:"",label:n.presetNames.none};const l=a.get(o);return l?{...l,label:n.presetNames[o]??l.label??o}:null}).filter(Boolean)}function Gg(n,a="percent"){if(a==="offset"){const o=Math.round((Number(n)||0)*100);return o>0?`+${o}`:`${o}`}return a==="amount"?`${Math.round((Number(n)||0)*100)}%`:`${Math.round((1+(Number(n)||0))*100)}%`}function Cf(n){return[n?.textContent,n?.getAttribute?.("title"),n?.getAttribute?.("aria-label")].filter(Boolean).join(" ").trim().toLowerCase()}function Sf(n){return n instanceof HTMLButtonElement?(n.dataset.meTrimHidden="true",n):n??null}function E5(n){return n instanceof HTMLButtonElement?(n.dataset.meAnnotateHidden="true",n):n??null}function Ec(n){const a=["trim","timeline","\u526A\u8F91","\u65F6\u95F4\u8F74"];return Sf(n.find(o=>{const l=Cf(o);return a.some(s=>l.includes(s))})??n[0]??null)}function k5(n){const a=["annotate","annotation","markup","draw","doodle","\u6807\u6CE8","\u5857\u9E26","\u5857\u9D09"];return E5(n.find(o=>{const l=Cf(o);return a.some(s=>l.includes(s))})??null)}function Xg(n,a,o){try{const l=document.createElement("canvas");l.width=208,l.height=118;const s=l.getContext("2d");if(!s)return"";const d=a/o,m=l.width/l.height;let h=0,g=0,v=a,w=o;return d>m?(v=o*m,h=(a-v)/2):d<m&&(w=a/m,g=(o-w)/2),s.drawImage(n,h,g,v,w,0,0,l.width,l.height),l.toDataURL("image/jpeg",.82)}catch{return""}}function C5(n){const a=n.querySelector(".me-video-canvas-stage canvas");if(a instanceof HTMLCanvasElement&&a.width>8&&a.height>8)return Xg(a,a.width,a.height);const o=n.querySelector("video");return o instanceof HTMLVideoElement&&o.videoWidth>8&&o.videoHeight>8?Xg(o,o.videoWidth,o.videoHeight):""}function S5(n){const a=String(n??"").split(":").map(s=>Number(s));if(a.length!==2)return null;const[o,l]=a;return!(o>0)||!(l>0)?null:o/l}function kc(n,a=1080){const o=S5(n)??1;return o>=1?{w:Math.max(2,Kn(a*o)),h:Math.max(2,Kn(a))}:{w:Math.max(2,Kn(a)),h:Math.max(2,Kn(a/o))}}function F5(){return l5.map(n=>({...n,ratios:n.ratios.map(a=>({ratio:a,...kc(a)}))}))}function Qg(n){return`${n.platform} ${n.type}`}function M5(n){switch(n.id){case"facebook-post":return"FB Post";case"facebook-story":return"FB Story";case"instagram-post":return"IG Post";case"instagram-story":return"IG Story";case"tiktok-photo":return"TikTok";case"x-post":return"X Post";case"linkedin-post":return"LinkedIn";case"pinterest-post":return"Pinterest";case"reddit-media":return"Reddit";case"threads-post":return"Threads";case"telegram-post":return"Telegram";default:return Qg(n)}}function L5(n){return s5.map(a=>{const o=kc(a),l=n.filter(s=>s.ratios.some(d=>d.ratio===a));return l.length?{ratio:a,...o,groups:l,hint:l.map(s=>Qg(s)).join(" / "),tags:l.map(s=>M5(s))}:null}).filter(Boolean)}function dl(n){return`${Math.max(2,Kn(n?.w??0))} x ${Math.max(2,Kn(n?.h??0))} px`}function Jg(n){const a=n?.canvas??{w:1080,h:1920};return oo(a,{...n,scale:void 0})}function Ts(n){return n?.scale?{w:Math.max(2,Kn(n.scale.width)),h:Math.max(2,Kn(n.scale.height))}:Jg(n)}function Ff(n){return n==="contain"||n==="force"?n:"cover"}function Oi(n,a){const o=Number(n),l=Number.isFinite(o)&&o>0?o:a;return Math.max(2,Kn(l||2))}function A5(n,a){const o=Math.max(2,Kn(a?.w??0)),l=Math.max(2,Kn(a?.h??0));return n.find(s=>Math.abs(s.w-o)<=2&&Math.abs(s.h-l)<=2)??null}function N5(n,a){switch(Ff(a)){case"contain":return n.containHint;case"force":return n.forceHint;default:return n.coverHint}}function Cc(n,a){n.replaceChildren();for(const o of a){const l=document.createElement("option");l.value=o.value,l.textContent=o.label,n.appendChild(l)}}function Bs(n=[],a=[]){const o=typeof Intl<"u"?new Intl.Collator(void 0,{sensitivity:"base",numeric:!0}):null,l=new Set;return[...n,...a].map(s=>String(s??"").trim()).filter(Boolean).filter(s=>{const d=s.toLowerCase();return l.has(d)?!1:(l.add(d),!0)}).sort((s,d)=>o?o.compare(s,d):s.localeCompare(d))}function Mf(n){return`"${String(n??"").replace(/\\/g,"\\\\").replace(/"/g,'\\"')}", ${dc}`}function Sc(n){const a=String(n??"").trim();return Sw[a]||a}function Lf(n){const a=String(n??"").trim(),o=Sc(a);return o&&o!==a?`${o} (${a})`:a}function _5(n){const a=String(n??"").trim();return`${a} ${Sc(a)} ${Lf(a)}`.toLowerCase()}function eb(n){return/[\u3400-\u9fff\uf900-\ufaff]/.test(String(n??""))}function T5(n){const a=String(n??"").trim().toLowerCase();return a?Fw.some(o=>a.includes(o))?!0:eb(Sc(n)):!1}function B5(n,a=!1){const o=Bs(n);if(!a)return o;const l=[],s=[];for(const d of o)T5(d)?l.push(d):s.push(d);return[...l,...s]}async function z5(){return rf||(rf=(async()=>{const n=Bs(gg);if(typeof window>"u"||typeof window.queryLocalFonts!="function")return n;try{const a=(await window.queryLocalFonts()).map(o=>o?.family||o?.fullName||"").filter(Boolean);return Bs(a,n)}catch{return n}})(),rf)}function D5(n){const a=document.createElement("div");a.className="me-video-font-picker";const o=document.createElement("button");o.type="button",o.className="me-video-font-picker-trigger";const l=document.createElement("span");l.className="me-video-font-picker-label";const s=document.createElement("span");s.className="me-video-font-picker-chevron",s.textContent="v",o.append(l,s);const d=document.createElement("div");d.className="me-video-font-picker-dropdown",d.hidden=!0;const m=document.createElement("label");m.className="me-video-font-picker-search";const h=document.createElement("span");h.className="me-video-font-picker-search-icon",h.innerHTML='<svg viewBox="0 0 16 16" fill="none" aria-hidden="true"><circle cx="7" cy="7" r="4.5" stroke="currentColor" stroke-width="1.4"></circle><path d="M10.5 10.5L14 14" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"></path></svg>';const g=document.createElement("input");g.type="search",g.className="me-video-font-picker-search-input",g.placeholder=n.searchFont,g.autocomplete="off",g.spellcheck=!1;const v=document.createElement("div");v.className="me-video-font-picker-list",m.append(h,g),d.append(m,v),a.append(o,d);let w=!1,W=!1,S=!1,Q="Arial",X=Bs(gg),ue=!1;const oe=typeof requestAnimationFrame=="function"?requestAnimationFrame:se=>setTimeout(se,0);function ge(){Q||(Q="Arial"),X=Bs(X,[Q])}function Be(se){const me=document.createElement("div");return me.className="me-video-font-picker-message",me.textContent=se,me}function Te(se){const me=document.createElement("button");me.type="button",me.className="me-video-font-picker-option",se===Q&&me.classList.add("is-active"),me.dataset.family=se;const P=document.createElement("span");P.className="me-video-font-picker-option-name",P.textContent=Lf(se),P.style.fontFamily=Mf(se);const $=document.createElement("span");return $.className="me-video-font-picker-option-preview",$.textContent=n.sampleText||wg,$.style.fontFamily=Mf(se),me.append(P,$),me.addEventListener("click",()=>{k(se),a.dispatchEvent(new CustomEvent("fontchange",{detail:{value:se}})),ve(!1),o.focus()}),me}function de(){const se=Q||"Arial";l.textContent=Sc(se),l.style.fontFamily=Mf(Q||"Arial"),o.title=Lf(se),o.disabled=W}function Ae(){if(v.replaceChildren(),!w)return;if(S){v.appendChild(Be(n.loadingFonts));return}ge();const se=String(g.value??"").trim().toLowerCase(),me=B5(X.filter(P=>!se||_5(P).includes(se)),ue);if(!me.length){v.appendChild(Be(n.noFonts));return}for(const P of me)v.appendChild(Te(P))}function ve(se){W&&se||(w=!!se,a.classList.toggle("is-open",w),d.hidden=!w,w?oe(()=>{g.focus(),g.select()}):g.value="",Ae())}async function j(){if(!S){S=!0,Ae();try{X=await z5(),ge()}finally{S=!1,Ae()}}}function k(se,{silent:me=!1}={}){Q=String(se??"").trim()||"Arial",ge(),de(),!me&&w&&Ae()}function H(){return Q||"Arial"}function T(se){W=!!se,W&&ve(!1),de(),g.disabled=W}function _(se){const me=eb(se);ue!==me&&(ue=me,w&&Ae())}function le(se){w&&(a.contains(se.target)||ve(!1))}return o.addEventListener("click",async()=>{const se=!w;ve(se),se&&await j()}),g.addEventListener("input",()=>Ae()),document.addEventListener("pointerdown",le,!0),k("Arial",{silent:!0}),T(!1),{wrap:a,setValue:k,getValue:H,setDisabled:T,setContextText:_,destroy(){document.removeEventListener("pointerdown",le,!0)}}}function j5(n){const a=String(n??"").trim().toLowerCase();return/^#([0-9a-f]{3}|[0-9a-f]{6})$/.test(a)?a.length===7?a:`#${a.slice(1).split("").map(o=>`${o}${o}`).join("")}`:null}function Pi(n,a="#ffffff"){const o=String(n??"").trim();if(!o)return a;if(o.toLowerCase()==="transparent")return"transparent";const l=j5(o);if(l)return l;const s=o.match(/^rgba?\(([^)]+)\)$/i);if(s){const d=s[1].split(",").slice(0,3).map(m=>qe(Math.round(Number(m.trim())||0),0,255));if(d.length===3)return`#${d.map(m=>m.toString(16).padStart(2,"0")).join("")}`}return a}function rr(n,a,o=""){const l=document.createElement("div");l.className=`me-video-text-row${o?` ${o}`:""}`;const s=document.createElement("label");return s.className="me-video-text-row-label",s.textContent=n,l.append(s,a),l}function ta(n){const a=document.createElement("section");a.className="me-video-text-section";const o=document.createElement("h4");o.className="me-video-text-section-title",o.textContent=n;const l=document.createElement("div");return l.className="me-video-text-section-body",a.append(o,l),{section:a,body:l,title:o}}function Fc({allowTransparent:n=!1,fallback:a="#ffffff",transparentLabel:o="Transparent"}={}){const l=document.createElement("div");l.className="me-video-text-color-control";const s=document.createElement("input");s.type="color",s.className="me-video-text-color-swatch",s.value=Pi(a,"#ffffff");const d=document.createElement("input");d.type="text",d.className="me-video-text-input me-video-text-color-text",d.spellcheck=!1,l.append(s,d);let m=null;n&&(m=document.createElement("button"),m.type="button",m.className="me-video-text-toggle me-video-text-transparent-toggle",m.textContent=o,l.appendChild(m));function h(){return l.dataset.transparent==="true"}function g(S){l.dataset.transparent=S?"true":"false",m?.classList.toggle("is-active",S),s.disabled=S,S?d.value="transparent":(!d.value||d.value==="transparent")&&(d.value=s.value||Pi(a,"#ffffff"))}function v(S){if(n&&String(S??"").trim().toLowerCase()==="transparent"){g(!0);return}const Q=Pi(S,Pi(a,"#ffffff"));s.value=Q==="transparent"?Pi(a,"#ffffff"):Q,d.value=Q==="transparent"?"transparent":Q,n&&g(Q==="transparent")}function w(){return n&&h()?"transparent":Pi(d.value||s.value,s.value||Pi(a,"#ffffff"))}function W(S){s.disabled=S||n&&h(),d.disabled=S,m&&(m.disabled=S)}return v(a),{wrap:l,swatch:s,text:d,transparentButton:m,setTransparent:g,setValue:v,getValue:w,setDisabled:W}}function Mc(n){const a=n.querySelector(".me-video-workspace");if(!a)return null;let o=a.querySelector(".me-video-inspector-rail");return o||(o=document.createElement("aside"),o.className="me-video-inspector-rail",o.hidden=!0,a.appendChild(o)),o}function Da(n,a){const o=Mc(n);return o?(a.parentElement!==o&&o.appendChild(a),o):null}function br(n){const a=Mc(n);if(!a)return;const o=[...a.children].some(l=>l instanceof HTMLElement&&!l.hidden);a.hidden=!o}function tb(n,a,o){const l=Mc(n);if(!(!l||!(a instanceof HTMLElement))){for(const s of l.children)if(!(!(s instanceof HTMLElement)||s===a)){if(o){s.dataset.meInspectorPrevHidden||(s.dataset.meInspectorPrevHidden=s.hidden?"true":"false"),s.hidden=!0;continue}Object.prototype.hasOwnProperty.call(s.dataset,"meInspectorPrevHidden")&&(s.hidden=s.dataset.meInspectorPrevHidden==="true",delete s.dataset.meInspectorPrevHidden)}}}function nb(n){return new Set(String(n??"").split(/\s+/).map(a=>a.trim()).filter(Boolean))}function O5(n){return[...n].join(" ").trim()}function P5(n,a,o,l){wa(),nl();const s=l(),d=kg(s),m=d.text,h=d5(s),g=document.createElement("div");g.className="me-video-text-panel",g.hidden=!0,n.appendChild(g);const v=document.createElement("div");v.className="me-video-text-toolbar";const w=document.createElement("strong");w.textContent=m.tool;const W=Hr(m.addText),S=Hr(m.moveOnCanvas),Q=Hr(m.duplicate),X=Hr(m.delete);X.classList.add("me-video-text-danger");const ue=Hr(m.close);v.append(w);const oe=document.createElement("div");oe.className="me-video-text-list";const ge=document.createElement("div");ge.className="me-video-text-empty",ge.textContent=m.empty;const Be=document.createElement("textarea");Be.className="me-video-text-input me-video-text-textarea",Be.placeholder=m.placeholder;const Te=document.createElement("select");Te.className="me-video-text-select",Cc(Te,[{value:"none",label:h.none},{value:"heading",label:m.heading},{value:"subtitle",label:m.subtitle},{value:"label",label:m.label}]);const de=D5(h),Ae=document.createElement("select");Ae.className="me-video-text-select",Cc(Ae,o5);const ve=document.createElement("input");ve.type="number",ve.min="8",ve.max="320",ve.step="1",ve.className="me-video-text-input";const j=Fc({fallback:"#ffffff"}),k=Fc({allowTransparent:!0,fallback:"#111111",transparentLabel:h.transparent}),H=document.createElement("div");H.className="me-video-text-inline";const T=[{value:"left",label:h.alignLeft},{value:"center",label:h.alignCenter},{value:"right",label:h.alignRight}].map(D=>{const ie=document.createElement("button");return ie.type="button",ie.className="me-video-text-align",ie.dataset.align=D.value,ie.textContent=D.label,H.appendChild(ie),{value:D.value,button:ie}}),_=document.createElement("div");_.className="me-video-text-toggle-group";const le=document.createElement("button");le.type="button",le.className="me-video-text-toggle is-italic",le.title=h.italic,le.textContent="I";const se=document.createElement("button");se.type="button",se.className="me-video-text-toggle is-underline",se.title=h.underline,se.textContent="U";const me=document.createElement("button");me.type="button",me.className="me-video-text-toggle is-strike",me.title=h.strike,me.textContent="S",_.append(le,se,me);const P=document.createElement("select");P.className="me-video-text-select",Cc(P,[{value:"none",label:h.caseNone},{value:"uppercase",label:h.uppercase},{value:"lowercase",label:h.lowercase},{value:"capitalize",label:h.capitalize}]);const $=document.createElement("div");$.className="me-video-text-slider-row";const M=document.createElement("input");M.type="number",M.min="0",M.max="100",M.step="1",M.className="me-video-text-input";const A=document.createElement("input");A.type="range",A.min="0",A.max="100",A.step="1",$.append(M,A);const ee=document.createElement("select");ee.className="me-video-text-select",Cc(ee,[{value:"none",label:h.none}]);const Me=Fc({fallback:"#000000"}),_e=document.createElement("input");_e.type="number",_e.min="0",_e.max="32",_e.step="1",_e.className="me-video-text-input";const x=Fc({fallback:"#000000"}),C=document.createElement("input");C.type="number",C.min="-80",C.max="80",C.step="1",C.className="me-video-text-input";const O=document.createElement("input");O.type="number",O.min="-80",O.max="80",O.step="1",O.className="me-video-text-input";const B=document.createElement("input");B.type="number",B.min="0",B.max="80",B.step="1",B.className="me-video-text-input";const G=document.createElement("div");G.className="me-video-text-section-body",G.append(rr(m.content,Be,"is-area"),rr(h.preset,Te));const ze=ta(h.styles);ze.body.append(rr(m.font,de.wrap),rr(m.weight,Ae),rr(h.size,ve),rr(m.color,j.wrap),rr(h.fill,k.wrap),rr(m.align,H),rr(h.decoration,_),rr(h.case,P),rr(m.opacity,$));const J=ta(h.animations);J.body.append(rr(h.animation,ee));const te=ta(h.fontStroke);te.body.append(rr(m.color,Me.wrap),rr(h.size,_e));const U=ta(h.fontShadow);U.body.append(rr(m.color,x.wrap),rr(h.x,C),rr(h.y,O),rr(h.blur,B)),g.append(v,ge,G,ze.section,J.section,te.section,U.section);let xe=null,Ce=null,Ye=null,et=null,lt=null,ot=null,gt=null,Jt=null,_t=!1,xt=null,Yt=!1,tn=!1;const _n="text",st=typeof requestAnimationFrame=="function"?requestAnimationFrame:D=>setTimeout(D,16),Ge=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>je()),mt=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>je()),Rt=[{key:"tl",x:0,y:0},{key:"tm",x:.5,y:0},{key:"tr",x:1,y:0},{key:"mr",x:1,y:.5},{key:"br",x:1,y:1},{key:"bm",x:.5,y:1},{key:"bl",x:0,y:1},{key:"ml",x:0,y:.5}],Vt={key:"rotate",x:.5,y:0};function kn(){Promise.resolve().then(()=>{tn=!1;const D=n.__meVideoEnhancerObserverLock??0;n.__meVideoEnhancerObserverLock=Math.max(0,D-1)})}function xn(D){tn=!0,n.__meVideoEnhancerObserverLock=(n.__meVideoEnhancerObserverLock??0)+1;try{return D()}finally{kn()}}function je(){Yt||(Yt=!0,st(()=>{Yt=!1,Lt()}))}function dt(D){const ie=!!D;if(ie===_t){Lt();return}_t=ie,_t&&n.dispatchEvent(new CustomEvent("me-video-inspector-open",{detail:{id:_n}})),Lt()}function yt(){return Ce?[...Ce.querySelectorAll("button")].filter(D=>D!==xe&&!D.classList.contains("me-video-text-tool")):[]}function pt(){yt()[0]?.click()}function Mt(){if(!xe)return;const D=ks(o());xe.dataset.theme=D}function dn(){Da(n,g),br(n)}function Ut(){g.hidden=!_t,xe&&xe.classList.toggle("is-active",_t),dn()}function An(D){if(!D.length){xt=null;return}const ie=hf(n,a.getState());xt=ie.length?ie[ie.length-1]:null}function K(){const D=a.getState().overlays??[];if(xt==null)return null;const ie=D[xt];return ie?.type==="text"?ie:null}function Le(){return ol(a)}function Ze(){return co(n)}function Tt(){if(!a.history?.present)return;const D=Ze(),ie=Number(a.history.present.__mePreviewTimelineTime);Math.abs((Number.isFinite(ie)?ie:-1)-D)<.001||(a.history={...a.history,present:{...a.history.present,__mePreviewTimelineTime:D}},typeof a.emit=="function"&&a.emit())}function rn(D,ie,Pe={}){const E=(a.getState().overlays??[])[D];!E||E.type!=="text"||a.updateOverlay(D,ma(E,Le(),ie),Pe)}function Pt(D){if(typeof a.applyMut=="function"){a.applyMut(Pe=>({...Pe,overlays:[...za(Pe.overlays),{...D,timelineTrack:0}]}));return}const ie=za(a.getState().overlays);a.commit?.({overlays:[...ie,{...D,timelineTrack:0}]})}function nn(D,ie={}){if(xt==null)return;const Pe=ie.preservePreset||Object.prototype.hasOwnProperty.call(D,"textPreset")?D:{...D,textPreset:"none"};a.updateOverlay(xt,Pe)}function wn(D="heading"){const ie=Le();let Pe=qe(Ze(),0,Math.max(0,ie-jt)),E=Math.min(ie,Pe+Jr);E-Pe<jt&&(Pe=qe(ie-Jr,0,Math.max(0,ie-jt)),E=Math.max(Pe+jt,ie));const F={...Mg(a,d,D),...ma(null,ie,{startAt:Pe,endAt:E,timelineTrack:0})};Pt(F);const p=a.getState().overlays??[];xt=p.length?p.length-1:null,xt!=null&&qn(n,"text",[xt]),pt(),dt(!0)}function Y(){const D=a.getState(),ie=vf(D.overlays??[],hf(n,D));ie.changed&&(a.commit({overlays:ie.overlays}),xt=ie.selection.length?ie.selection[ie.selection.length-1]:null,qn(n,"text",ie.selection),Lt())}function fe(){const D=a.getState(),ie=gf(D.overlays??[],hf(n,D));ie.changed&&(a.commit({overlays:ie.overlays}),xt=null,qn(n,"text",[]),Lt())}function Ne(D){if(!K()){wn(D);return}const ie=Mg(a,d,D);nn({text:ie.text,fontSize:ie.fontSize,width:ie.width,fontWeight:ie.fontWeight,fontFamily:ie.fontFamily,fontStyle:ie.fontStyle,textAlign:ie.textAlign,color:ie.color,backgroundColor:ie.backgroundColor,borderColor:ie.borderColor,borderWidth:ie.borderWidth,paddingX:ie.paddingX,paddingY:ie.paddingY,lineHeight:ie.lineHeight,boxShadow:ie.boxShadow?{...ie.boxShadow}:void 0,textDecoration:ie.textDecoration??"",textTransform:ie.textTransform,animation:"none",textPreset:D},{preservePreset:!0})}function Qe(){const{timelineInner:D,timelineHost:ie}=Ms(n,a.getState());if(!D||!ie){et?.remove(),et=null,Ge&<&&(Ge.unobserve(lt),lt=null),Ye=null;return}Ye=D,(!et||!et.isConnected||et.parentElement!==ie)&&(et?.remove(),et=document.createElement("div"),et.className="me-video-text-timeline me-video-overlay-timeline me-video-text-overlay-layer");for(const Pe of[...ie.children])Pe!==et&&Pe instanceof HTMLElement&&Pe.classList.contains("me-video-text-overlay-layer")&&Pe.remove();(et.parentElement!==ie||ie.lastElementChild!==et)&&ie.appendChild(et),Ge&<!==Ye&&(lt&&Ge.unobserve(lt),lt=Ye,Ge.observe(Ye))}function Et(){const D=n.querySelector(".me-video-canvas-stage");if(!D){gt?.remove(),gt=null,mt&&Jt&&(mt.unobserve(Jt),Jt=null),ot=null;return}ot=D,ot.style.position="relative",!gt||!gt.isConnected||gt.parentElement!==ot?(gt?.remove(),gt=document.createElement("div"),gt.className="me-video-text-canvas-layer",gt.addEventListener("pointerdown",ie=>{ie.target===gt&&(ie.preventDefault(),ie.stopPropagation())}),gt.addEventListener("click",ie=>{ie.target===gt&&(ie.preventDefault(),ie.stopPropagation(),xt=null,mf(n),_t?dt(!1):Lt())}),ot.appendChild(gt)):ot.lastElementChild!==gt&&ot.appendChild(gt),mt&&Jt!==ot&&(Jt&&mt.unobserve(Jt),Jt=ot,mt.observe(ot))}function z(){if(!ot)return null;const D=a.getState().canvas??{},ie=Math.max(1,Number(D.w)||0),Pe=Math.max(1,Number(D.h)||0);if(!ie||!Pe)return null;const E=ot.getBoundingClientRect(),F=ot.querySelector("canvas, video, img")||[...ot.children].find(Ee=>Ee!==gt)||null;let p=0,b=0,L=ot.clientWidth||ie,q=ot.clientHeight||Pe;if(F instanceof HTMLElement){const Ee=F.getBoundingClientRect();Ee.width>0&&Ee.height>0&&(p=Ee.left-E.left,b=Ee.top-E.top,L=Ee.width,q=Ee.height)}if(!(L>0&&q>0)){const Ee=ot.clientWidth||ie,be=ot.clientHeight||Pe,Oe=Math.min(Ee/ie,be/Pe)||1;L=ie*Oe,q=Pe*Oe,p=Math.max(0,(Ee-L)/2),b=Math.max(0,(be-q)/2)}return{stageLeft:E.left,stageTop:E.top,left:p,top:b,scaleX:L/ie,scaleY:q/Pe}}function V(D,ie){const Pe=Cn(D),E=Tr(D,Pe);return ie>=Pe-.001&&ie<=E+.001}function Fe(D,ie,Pe){const E=gr(n,"text",D,ie,Pe);xt=E.length?E[E.length-1]:null,dt(!0),Lt()}function He(D,ie,Pe){return{x:(D-Pe.stageLeft-Pe.left)/Pe.scaleX,y:(ie-Pe.stageTop-Pe.top)/Pe.scaleY}}function Xe(D,ie,Pe,E){return{x:Pe,y:E,fontSize:ie.fontSize,width:ie.width,paddingX:ie.paddingX,paddingY:ie.paddingY,borderWidth:ie.borderWidth,boxShadow:ie.boxShadow}}function ct(D,ie,Pe){const E=(a.getState().overlays??[])[D];if(!E||E.type!=="text")return;const F=a.getState().canvas??{w:1080,h:1920},p=Ir(E);if(!p)return;const b=ie.clientX,L=ie.clientY,q=Math.max(0,(Number(F.w)||0)-p.w),Ee=Math.max(0,(Number(F.h)||0)-p.h),be=(ke,Ve,We)=>{const ft=(ke-b)/Pe.scaleX,nt=(Ve-L)/Pe.scaleY,it=qe(p.x+ft,0,q),ht=qe(p.y+nt,0,Ee);a.updateOverlay(D,{x:it,y:ht},We?{transient:!0}:void 0)},Oe=ke=>{ke.preventDefault(),be(ke.clientX,ke.clientY,!0)},ae=ke=>{window.removeEventListener("pointermove",Oe),window.removeEventListener("pointerup",ae),window.removeEventListener("pointercancel",ae),be(ke.clientX,ke.clientY,!1)};window.addEventListener("pointermove",Oe),window.addEventListener("pointerup",ae),window.addEventListener("pointercancel",ae)}function kt(D,ie,Pe,E){const F=(a.getState().overlays??[])[D];if(!F||F.type!=="text")return;const p=Ir(F);if(!p)return;const b=a.getState().canvas??{w:1080,h:1920},L=ie.x===.5?.5:1-ie.x,q=ie.y===.5?.5:1-ie.y,Ee=p.x+p.w*L,be=p.y+p.h*q,Oe=Math.max(.1,24/Math.max(24,p.w),24/Math.max(24,p.h)),ae=ie.x===.5?1/0:Math.max(.1,(L===0?(Number(b.w)||0)-Ee:Ee)/Math.max(1,p.w)),ke=ie.y===.5?1/0:Math.max(.1,(q===0?(Number(b.h)||0)-be:be)/Math.max(1,p.h)),Ve=Math.max(Oe,Math.min(ae,ke,8)),We=(it,ht,wt)=>{const Bt=He(it,ht,E),Ot=[];ie.x!==.5&&Ot.push(Math.abs(Bt.x-Ee)/Math.max(1,p.w)),ie.y!==.5&&Ot.push(Math.abs(Bt.y-be)/Math.max(1,p.h));const on=Ot.length?Math.max(...Ot):1,Rn=qe(on,Oe,Ve),cr=Ym(F,Rn),Mr=Ir(cr);if(!Mr)return;const ar=Ee-Mr.w*L,N=be-Mr.h*q;a.updateOverlay(D,Xe(F,cr,ar,N),wt?{transient:!0}:void 0)},ft=it=>{it.preventDefault(),We(it.clientX,it.clientY,!0)},nt=it=>{window.removeEventListener("pointermove",ft),window.removeEventListener("pointerup",nt),window.removeEventListener("pointercancel",nt),We(it.clientX,it.clientY,!1)};window.addEventListener("pointermove",ft),window.addEventListener("pointerup",nt),window.addEventListener("pointercancel",nt)}function rt(D,ie,Pe){const E=(a.getState().overlays??[])[D];if(!E||E.type!=="text")return;const F=Ir(E);if(!F)return;const p=Pe.stageLeft+Pe.left+(F.x+F.w/2)*Pe.scaleX,b=Pe.stageTop+Pe.top+(F.y+F.h/2)*Pe.scaleY,L=Math.atan2(ie.clientY-b,ie.clientX-p),q=da(E),Ee=(ae,ke,Ve,We)=>{const ft=Math.atan2(ke-b,ae-p);let nt=Es(q+(ft-L)*180/Math.PI);We&&(nt=Math.round(nt/15)*15),a.updateOverlay(D,{rotation:nt},Ve?{transient:!0}:void 0)},be=ae=>{ae.preventDefault(),Ee(ae.clientX,ae.clientY,!0,ae.shiftKey)},Oe=ae=>{window.removeEventListener("pointermove",be),window.removeEventListener("pointerup",Oe),window.removeEventListener("pointercancel",Oe),Ee(ae.clientX,ae.clientY,!1,ae.shiftKey)};window.addEventListener("pointermove",be),window.addEventListener("pointerup",Oe),window.addEventListener("pointercancel",Oe)}function at(D,ie){if(Et(),!gt)return;gt.replaceChildren();const Pe=z();if(!Pe){gt.hidden=!0;return}gt.hidden=!1;const E=Ze(),F=D.map(b=>b.index),p=D.filter(b=>V(b.overlay,E));for(const b of p){const L=Ir(b.overlay);if(!L)continue;const q=document.createElement("button");q.type="button",q.className="me-video-text-canvas-hit";const Ee=ie.has(b.index),be=Ee&&xt===b.index;Ee&&q.classList.add("is-active"),q.title=mc(b.overlay.text,d.untitledText),q.style.left=`${Pe.left+L.x*Pe.scaleX}px`,q.style.top=`${Pe.top+L.y*Pe.scaleY}px`,q.style.width=`${Math.max(18,L.w*Pe.scaleX)}px`,q.style.height=`${Math.max(18,L.h*Pe.scaleY)}px`;const Oe=da(b.overlay);if(Oe&&(q.style.transform=`rotate(${Oe}deg)`,q.style.transformOrigin="center center"),q.addEventListener("pointerdown",ae=>{if(ae.preventDefault(),ae.stopPropagation(),ae.shiftKey||ae.ctrlKey||ae.metaKey){Fe(b.index,ae,F);return}xt=b.index,qn(n,"text",[b.index]),dt(!0),ct(b.index,ae,Pe)}),be){for(const ke of Rt){const Ve=document.createElement("span");Ve.className="me-video-text-canvas-handle",Ve.dataset.handle=ke.key,Ve.style.left=`${ke.x*100}%`,Ve.style.top=`${ke.y*100}%`,Ve.addEventListener("pointerdown",We=>{We.preventDefault(),We.stopPropagation(),xt=b.index,qn(n,"text",[b.index]),dt(!0),kt(b.index,ke,We,Pe)}),q.appendChild(Ve)}const ae=document.createElement("span");ae.className="me-video-text-canvas-handle",ae.dataset.handle=Vt.key,ae.style.left=`${Vt.x*100}%`,ae.style.top=`${Vt.y*100}%`,ae.addEventListener("pointerdown",ke=>{ke.preventDefault(),ke.stopPropagation(),xt=b.index,qn(n,"text",[b.index]),dt(!0),rt(b.index,ke,Pe)}),q.appendChild(ae)}gt.appendChild(q)}}function Ke(D,ie,Pe){if(!Ye)return;const E=(a.getState().overlays??[])[D];if(!E||E.type!=="text")return;if(Pe.shiftKey||Pe.ctrlKey||Pe.metaKey){Pe.preventDefault(),Pe.stopPropagation();const ke=gr(n,"text",D,Pe,_g(a.getState()).map(Ve=>Ve.index));xt=ke.length?ke[ke.length-1]:null,pt(),dt(!0);return}Pe.preventDefault(),Pe.stopPropagation(),xt=D,qn(n,"text",[D]),pt(),_t||dt(!0);const F=Le(),p=Math.max(Ye.clientWidth/F,.001),b=Cn(E),L=Tr(E,b),q=Math.max(jt,L-b),Ee=$n(E),be=Pe.clientX,Oe=ke=>{const Ve=(ke.clientX-be)/p,We=a.getState().overlays??[];if(ie==="move"){const it=Math.max(0,b+Ve),ht=it+q,wt=Nn(et,We,D,it,ht,ke.clientY,Ee);rn(D,{startAt:it,endAt:ht,timelineTrack:wt},{transient:!0});return}if(ie==="start"){const it=qe(b+Ve,0,L-jt),ht=Nn(et,We,D,it,L,ke.clientY,Ee);rn(D,{startAt:it,endAt:L,timelineTrack:ht},{transient:!0});return}const ft=Math.max(b+jt,L+Ve),nt=Nn(et,We,D,b,ft,ke.clientY,Ee);rn(D,{startAt:b,endAt:ft,timelineTrack:nt},{transient:!0})},ae=ke=>{window.removeEventListener("pointermove",Oe),window.removeEventListener("pointerup",ae),window.removeEventListener("pointercancel",ae);const Ve=(ke.clientX-be)/p,We=a.getState().overlays??[];if(ie==="move"){const it=Math.max(0,b+Ve),ht=it+q,wt=Nn(et,We,D,it,ht,ke.clientY,Ee);rn(D,{startAt:it,endAt:ht,timelineTrack:wt});return}if(ie==="start"){const it=qe(b+Ve,0,L-jt),ht=Nn(et,We,D,it,L,ke.clientY,Ee);rn(D,{startAt:it,endAt:L,timelineTrack:ht});return}const ft=Math.max(b+jt,L+Ve),nt=Nn(et,We,D,b,ft,ke.clientY,Ee);rn(D,{startAt:b,endAt:ft,timelineTrack:nt})};window.addEventListener("pointermove",Oe),window.addEventListener("pointerup",ae),window.addEventListener("pointercancel",ae),Lt()}function Nt(D,ie){if(Qe(),!et||!Ye||(et.replaceChildren(),et.hidden=D.length===0,!D.length))return;const Pe=Le(),E=Ye.clientWidth/Pe,F=Ss(a.getState()),p=new Map;for(const b of D){const L=$n(b.overlay),q=F.get(L)??L;let Ee=p.get(L);Ee||(Ee=document.createElement("div"),Ee.className="me-video-overlay-track-row",Ee.dataset.track=String(L),Ee.style.top=`${il(q)}px`,p.set(L,Ee),et.appendChild(Ee));const be=document.createElement("div");be.className="me-video-text-track-clip",ie.has(b.index)&&be.classList.add("is-active");const Oe=Cn(b.overlay),ae=al(b.overlay);be.style.left=`${Oe*E}px`,be.style.width=`${Math.max(36,ae*E)}px`;const ke=document.createElement("span");ke.className="me-video-text-track-icon",ke.textContent="Aa";const Ve=document.createElement("span");Ve.className="me-video-text-track-label",Ve.textContent=mc(b.overlay.text,d.untitledText),Ve.title=Ve.textContent;const We=document.createElement("span");We.className="me-video-text-track-handle is-start";const ft=document.createElement("span");ft.className="me-video-text-track-handle is-end",be.append(ke,Ve,We,ft),be.addEventListener("pointerdown",nt=>Ke(b.index,"move",nt)),We.addEventListener("pointerdown",nt=>Ke(b.index,"start",nt)),ft.addEventListener("pointerdown",nt=>Ke(b.index,"end",nt)),be.addEventListener("click",nt=>{if(nt.preventDefault(),nt.stopPropagation(),nt.shiftKey||nt.ctrlKey||nt.metaKey){pt(),Lt();return}const it=gr(n,"text",b.index,nt,D.map(ht=>ht.index));xt=it.length?it[it.length-1]:null,pt(),dt(!0),Lt()}),Ee.appendChild(be)}}function Wt(D,ie){oe.replaceChildren(),oe.hidden=D.length===0,ge.hidden=D.length>0;for(const Pe of D){const E=document.createElement("button");E.type="button",E.className="me-video-text-chip",ie.has(Pe.index)&&E.classList.add("is-active"),E.textContent=mc(Pe.overlay.text,d.untitledText),E.title=mc(Pe.overlay.text,d.untitledText),E.addEventListener("click",F=>{const p=gr(n,"text",Pe.index,F,D.map(b=>b.index));xt=p.length?p[p.length-1]:null,Lt()}),oe.appendChild(E)}}function Ct(D){Be.disabled=D,de.setDisabled(D),Ae.disabled=D,ve.disabled=D,T.forEach(({button:ie})=>ie.disabled=D),P.disabled=D,ee.disabled=D,M.disabled=D,A.disabled=D,_e.disabled=D,C.disabled=D,O.disabled=D,B.disabled=D,j.setDisabled(D),k.setDisabled(D),Me.setDisabled(D),x.setDisabled(D),Q.disabled=D,X.disabled=D,S.disabled=D,le.disabled=D,se.disabled=D,me.disabled=D}function bt(D){const ie=String(qe(Math.round(Number(D)||0),0,100));M.value=ie,A.value=ie}function $t(D){const ie=nb(D?.textDecoration);le.classList.toggle("is-active",!!D&&String(D.fontStyle??"normal")==="italic"),se.classList.toggle("is-active",!!D&&ie.has("underline")),me.classList.toggle("is-active",!!D&&ie.has("line-through"))}function un(D="left"){T.forEach(({value:ie,button:Pe})=>{})}function pn(D){if(Ct(!D),!D){Te.value="none",Be.value="",de.setContextText(""),de.setValue("Arial",{silent:!0}),Ae.value="700",ve.value="72",j.setValue("#ffffff"),k.setValue("transparent"),un("center"),P.value="none",ee.value="none",Me.setValue("#000000"),_e.value="0",x.setValue("#000000"),C.value="0",O.value="4",B.value="18",bt(100),$t(null);return}const ie=D.boxShadow??{};Te.value=String(D.textPreset??"none"),Be.value=String(D.text??""),de.setContextText(D.text??""),de.setValue(String(D.fontFamily??"Arial"),{silent:!0}),Ae.value=String(D.fontWeight??"700"),ve.value=String(Math.round(Number(D.fontSize)||72)),j.setValue(D.color??"#ffffff"),k.setValue(D.backgroundColor??"transparent"),un(D.textAlign==="right"||D.textAlign==="center"?D.textAlign:"left"),P.value=D.textTransform?String(D.textTransform):"none",ee.value=D.animation?String(D.animation):"none",Me.setValue(D.borderColor??"#000000"),_e.value=String(Math.round(Number(D.borderWidth)||0)),x.setValue(ie.color??"#000000"),C.value=String(Math.round(Number(ie.x)||0)),O.value=String(Math.round(Number(ie.y)||0)),B.value=String(Math.round(Number(ie.blur)||0)),bt(Number.isFinite(D.opacity)?D.opacity:100),$t(D)}function Lt(){xn(()=>{const D=_g(a.getState());An(D);const ie=new Set(Br(n,"text"));Nt(D,ie),at(D,ie),Wt(D,ie),pn(K()),Ut(),dn(),Mt()}),Tt()}function Zt(){xn(()=>{const D=n.querySelector(".me-video-toolrail");D&&(Ce=D,k5([...Ce.querySelectorAll("button")].filter(ie=>ie instanceof HTMLButtonElement&&ie!==xe&&!ie.classList.contains("me-video-text-tool"))),(!xe||!xe.isConnected)&&(xe=document.createElement("button"),xe.type="button",xe.className="me-video-text-tool",xe.innerHTML=`<span class="me-video-text-tool-icon">T</span><span class="me-video-text-tool-label">${m.tool}</span>`,xe.addEventListener("click",()=>{wn("heading")})),xe.isConnected||Ce.appendChild(xe),Mt(),dn())})}function en(D){return!!D&&(D===g||g.contains(D)||D===xe||D===et||et?.contains?.(D)||D===gt||gt?.contains?.(D))}function Tn(D){return D.some(ie=>{if(!en(ie.target))return!0;for(const Pe of ie.addedNodes)if(!en(Pe))return!0;for(const Pe of ie.removedNodes)if(!en(Pe))return!0;return!1})}function fn(D,ie){D.swatch.addEventListener("input",()=>{D.transparentButton&&D.wrap.dataset.transparent==="true"&&D.setTransparent(!1),D.text.value=D.swatch.value,ie(D.getValue())}),D.text.addEventListener("change",()=>{const Pe=String(D.text.value??"").trim();if(D.transparentButton&&Pe.toLowerCase()==="transparent"){D.setTransparent(!0),ie("transparent");return}const E=Pi(Pe,D.swatch.value||"#ffffff");D.swatch.value=E==="transparent"?D.swatch.value||"#ffffff":E,D.text.value=E,D.transparentButton&&D.setTransparent(!1),ie(E)}),D.transparentButton?.addEventListener("click",()=>{const Pe=D.wrap.dataset.transparent!=="true";D.setTransparent(Pe),ie(D.getValue())})}function Dn(D){const ie=K();if(!ie)return;const Pe={color:"#000000",x:0,y:4,blur:18,...ie.boxShadow??{}};nn({boxShadow:{...Pe,...D}})}function zr(D){const ie=K();if(!ie)return;const Pe=nb(ie.textDecoration);Pe.has(D)?Pe.delete(D):Pe.add(D),nn({textDecoration:O5(Pe)||void 0})}const Hn=new MutationObserver(D=>{tn||n.__meVideoEnhancerObserverLock||Tn(D)&&(Zt(),je())}),ur=D=>{D?.detail?.id!==_n&&_t&&(_t=!1,Lt())},Yn=()=>{Lt()};Hn.observe(n,{childList:!0,subtree:!0,characterData:!0}),n.addEventListener("me-video-inspector-open",ur),n.addEventListener(fr,Yn),window.addEventListener("resize",dn);const Fr=a.subscribe(()=>{Lt()});return W.addEventListener("click",()=>wn("heading")),S.addEventListener("click",()=>{pt(),dt(!0)}),Q.addEventListener("click",Y),X.addEventListener("click",fe),ue.addEventListener("click",()=>{dt(!1)}),Be.addEventListener("input",()=>{de.setContextText(Be.value),nn({text:Be.value})}),Te.addEventListener("change",()=>{if(Te.value==="none"){K()&&nn({textPreset:"none"},{preservePreset:!0});return}Ne(Te.value)}),de.wrap.addEventListener("fontchange",()=>nn({fontFamily:de.getValue()})),Ae.addEventListener("change",()=>nn({fontWeight:Ae.value})),ve.addEventListener("change",()=>nn({fontSize:qe(Number(ve.value)||72,8,320)})),fn(j,D=>nn({color:D})),fn(k,D=>nn({backgroundColor:D})),T.forEach(({value:D,button:ie})=>{ie.addEventListener("click",()=>{un(D),nn({textAlign:D})})}),P.addEventListener("change",()=>nn({textTransform:P.value==="none"?void 0:P.value})),ee.addEventListener("change",()=>nn({animation:ee.value==="none"?void 0:ee.value})),_e.addEventListener("change",()=>nn({borderWidth:qe(Number(_e.value)||0,0,32)})),fn(Me,D=>nn({borderColor:D})),fn(x,D=>Dn({color:D})),C.addEventListener("change",()=>Dn({x:qe(Number(C.value)||0,-80,80)})),O.addEventListener("change",()=>Dn({y:qe(Number(O.value)||0,-80,80)})),B.addEventListener("change",()=>Dn({blur:qe(Number(B.value)||0,0,80)})),M.addEventListener("input",()=>{const D=qe(Number(M.value)||0,0,100);bt(D),nn({opacity:D})}),A.addEventListener("input",()=>{const D=qe(Number(A.value)||0,0,100);bt(D),nn({opacity:D})}),le.addEventListener("click",()=>{const D=K();D&&nn({fontStyle:String(D.fontStyle??"normal")==="italic"?"normal":"italic"})}),se.addEventListener("click",()=>zr("underline")),me.addEventListener("click",()=>zr("line-through")),Zt(),Lt(),{destroy(){Hn.disconnect(),Ge&<&&Ge.unobserve(lt),mt&&Jt&&mt.unobserve(Jt),Fr(),n.removeEventListener("me-video-inspector-open",ur),n.removeEventListener(fr,Yn),window.removeEventListener("resize",dn),de.destroy(),xe?.remove(),et?.remove(),gt?.remove(),g.remove(),br(n)}}}function $5(n,a,o){wa(),nl();const l=u5(o()),s=c5(l),d=document.createElement("div");d.className="me-video-text-panel me-video-sticker-panel",d.hidden=!0,n.appendChild(d);const m=document.createElement("div");m.className="me-video-text-toolbar";const h=document.createElement("strong");h.textContent=l.title,m.append(h);const g=ta(l.uploadTitle),v=document.createElement("label");v.className="me-video-sticker-upload-zone";const w=document.createElement("span");w.className="me-video-sticker-upload-icon",w.textContent="\u{1F5BC}";const W=document.createElement("span");W.className="me-video-sticker-upload-text",W.textContent=l.uploadHint;const S=document.createElement("span");S.className="me-video-sticker-upload-subtext",S.textContent=l.uploadFormats;const Q=document.createElement("input");Q.type="file",Q.accept="image/png,image/jpeg,image/webp,image/svg+xml",v.append(w,W,S,Q),g.body.appendChild(v);const X=ta(l.libraryTitle),ue=document.createElement("div");ue.className="me-video-sticker-library",X.body.appendChild(ue),d.append(m,g.section,X.section);let oe=null,ge=null,Be=null,Te=null,de=null,Ae=null,ve=null,j=null,k=null,H=!1,T=null,_=!1,le=!1;const se="sticker",me=typeof requestAnimationFrame=="function"?requestAnimationFrame:Y=>setTimeout(Y,16),P=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>_e()),$=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>_e()),M=[{key:"tl",x:0,y:0},{key:"tm",x:.5,y:0},{key:"tr",x:1,y:0},{key:"mr",x:1,y:.5},{key:"br",x:1,y:1},{key:"bm",x:.5,y:1},{key:"bl",x:0,y:1},{key:"ml",x:0,y:.5}],A={key:"rotate",x:.5,y:0};function ee(){Promise.resolve().then(()=>{le=!1;const Y=n.__meVideoEnhancerObserverLock??0;n.__meVideoEnhancerObserverLock=Math.max(0,Y-1)})}function Me(Y){le=!0,n.__meVideoEnhancerObserverLock=(n.__meVideoEnhancerObserverLock??0)+1;try{return Y()}finally{ee()}}function _e(){_||(_=!0,me(()=>{_=!1,K()}))}function x(Y){const fe=!!Y;if(fe===H){K();return}H=fe,H&&n.dispatchEvent(new CustomEvent("me-video-inspector-open",{detail:{id:se}})),K()}function C(Y=ge){return Y?[...Y.children].filter(fe=>fe instanceof HTMLButtonElement&&!fe.classList.contains("me-video-text-tool")):[]}function O(Y){return[Y?.textContent,Y?.getAttribute?.("title"),Y?.getAttribute?.("aria-label")].filter(Boolean).join(" ").trim().toLowerCase()}function B(Y){const fe=["trim","timeline","\u526A\u8F91","\u65F6\u95F4\u8F74"];return Sf(Y.find(Ne=>{const Qe=O(Ne);return fe.some(Et=>Qe.includes(Et))})??Y[0]??null)}function G(Y){const fe=[l.tool,l.title,"sticker","stickers","\u8D34\u7EB8","\u8CBC\u7D19"].map(Ne=>String(Ne??"").trim().toLowerCase()).filter(Boolean);return Y.find(Ne=>{const Qe=O(Ne);return fe.some(Et=>Qe.includes(Et))})??Y[Math.min(5,Math.max(0,Y.length-1))]??null}function ze(){if(oe?.classList.toggle("is-active",H),!!Be&&H){Be.classList.remove("is-active");return}}function J(){Be&&(Be.classList.contains("is-active")||Be.click())}function te(){Da(n,d),br(n)}function U(){d.hidden=!H,ze(),te()}function xe(Y){if(!Y.length){T=null;return}const fe=jg(n,a.getState());T=fe.length?fe[fe.length-1]:null}function Ce(){return ol(a)}function Ye(){return co(n)}function et(){if(!a.history?.present)return;const Y=Ye(),fe=Number(a.history.present.__mePreviewTimelineTime);Math.abs((Number.isFinite(fe)?fe:-1)-Y)<.001||(a.history={...a.history,present:{...a.history.present,__mePreviewTimelineTime:Y}},typeof a.emit=="function"&&a.emit())}function lt(Y){return Y?.emoji?`${l.defaultLabel} ${Y.emoji}`:Y?.src?l.uploadedLabel:l.defaultLabel}function ot(Y){const fe=Ir(Y);if(!fe)return null;if(!Y?.emoji)return fe;const Ne=.84,Qe=fe.w*(1-Ne)/2,Et=fe.h*(1-Ne)/2;return{x:fe.x+Qe,y:fe.y+Et,w:fe.w*Ne,h:fe.h*Ne}}function gt(Y,fe){if(!Y?.emoji)return fe;const Ne=1/.84,Qe=(Ne-1)/2;return{x:fe.x-fe.w*Qe,y:fe.y-fe.h*Qe,w:fe.w*Ne,h:fe.h*Ne}}function Jt(Y,fe){const Ne=Math.max(1,Number(fe?.w)||1080),Qe=Math.max(1,Number(fe?.h)||1920),Et=qe(Number.isFinite(Y?.w)?Y.w:8,8,Math.max(8,Ne)),z=qe(Number.isFinite(Y?.h)?Y.h:8,8,Math.max(8,Qe));return{x:qe(Number.isFinite(Y?.x)?Y.x:0,0,Math.max(0,Ne-Et)),y:qe(Number.isFinite(Y?.y)?Y.y:0,0,Math.max(0,Qe-z)),w:Et,h:z}}function _t(Y){return Y?.emoji||"\u2726"}function xt(Y,fe,Ne={}){const Qe=(a.getState().overlays??[])[Y];!Qe||Qe.type!=="sticker"||a.updateOverlay(Y,ma(Qe,Ce(),fe),Ne)}function Yt(Y){if(typeof a.applyMut=="function"){a.applyMut(Ne=>({...Ne,overlays:[...za(Ne.overlays),{...Y,timelineTrack:0}]}));return}const fe=za(a.getState().overlays);a.commit?.({overlays:[...fe,{...Y,timelineTrack:0}]})}function tn(Y){return new Promise(fe=>{const Ne=new Image;Ne.onload=()=>fe({w:Ne.naturalWidth||256,h:Ne.naturalHeight||256}),Ne.onerror=()=>fe({w:256,h:256}),Ne.src=Y})}async function _n(Y){const fe=Ce();let Ne=qe(Ye(),0,Math.max(0,fe-jt)),Qe=Math.min(fe,Ne+Jr);Qe-Ne<jt&&(Ne=qe(fe-Jr,0,Math.max(0,fe-jt)),Qe=Math.max(Ne+jt,fe));const Et=a.getState().canvas??{w:1080,h:1920},z=Y.emoji?{w:256,h:256}:await tn(Y.src),V=Math.max(96,Math.round(Math.min(Et.w,Et.h)*.24)),Fe=J0(z.w,z.h,V),He={type:"sticker",x:Math.round((Et.w-Fe.w)/2),y:Math.round((Et.h-Fe.h)/2),w:Fe.w,h:Fe.h,rotation:0,...Y.emoji?{emoji:Y.emoji}:{src:Y.src},...ma(null,fe,{startAt:Ne,endAt:Qe,timelineTrack:0})};Yt(He);const Xe=a.getState().overlays??[];T=Xe.length?Xe.length-1:null,T!=null&&qn(n,"text",[T]),J(),x(!0)}async function st(Y){const fe=Y?.[0];if(!fe||!String(fe.type||"").startsWith("image/")&&!/\.(png|jpe?g|webp|svg)$/i.test(fe.name||""))return;const Ne=await new Promise((Qe,Et)=>{const z=new FileReader;z.onload=()=>Qe(String(z.result||"")),z.onerror=()=>Et(z.error||new Error("Failed to read sticker file")),z.readAsDataURL(fe)}).catch(()=>"");Ne&&(Q.value="",await _n({src:Ne}))}function Ge(){ue.replaceChildren();for(const Y of s){const fe=document.createElement("div");fe.className="me-video-sticker-library-group";const Ne=document.createElement("div");Ne.className="me-video-sticker-library-title",Ne.textContent=Y.title;const Qe=document.createElement("div");Qe.className="me-video-sticker-grid";for(const Et of Y.items){const z=document.createElement("button");if(z.type="button",z.className="me-video-sticker-card",z.title=Et.label,z.setAttribute("aria-label",Et.label),Et.emoji){const V=document.createElement("span");V.className="me-video-sticker-card-emoji",V.textContent=Et.emoji,z.appendChild(V)}else if(Et.src){const V=document.createElement("img");V.src=Et.src,V.alt=Et.label,z.appendChild(V)}z.addEventListener("click",()=>{_n(Et)}),Qe.appendChild(z)}fe.append(Ne,Qe),ue.appendChild(fe)}}function mt(){Me(()=>{const Y=n.querySelector(".me-video-toolrail");Y&&(ge=Y,(!oe||!oe.isConnected)&&(oe=document.createElement("button"),oe.type="button",oe.className="me-video-text-tool",oe.innerHTML=`<span class="me-video-text-tool-icon">\u2726</span><span class="me-video-text-tool-label">${l.tool}</span>`,oe.title=l.tool,oe.setAttribute("aria-label",l.tool),oe.addEventListener("click",()=>{const fe=!H;fe&&J(),x(fe)})),oe.isConnected||ge.appendChild(oe),te())})}function Rt(){const{timelineInner:Y,timelineHost:fe}=Ms(n,a.getState());if(!Y||!fe){de?.remove(),de=null,P&&Ae&&(P.unobserve(Ae),Ae=null),Te=null;return}Te=Y,(!de||!de.isConnected||de.parentElement!==fe)&&(de?.remove(),de=document.createElement("div"),de.className="me-video-text-timeline me-video-sticker-timeline me-video-overlay-timeline me-video-sticker-overlay-layer");for(const Ne of[...fe.children])Ne!==de&&Ne instanceof HTMLElement&&Ne.classList.contains("me-video-sticker-overlay-layer")&&Ne.remove();(de.parentElement!==fe||fe.lastElementChild!==de)&&fe.appendChild(de),P&&Ae!==Te&&(Ae&&P.unobserve(Ae),Ae=Te,P.observe(Te))}function Vt(){const Y=n.querySelector(".me-video-canvas-stage");if(!Y){j?.remove(),j=null,$&&k&&($.unobserve(k),k=null),ve=null;return}ve=Y,ve.style.position="relative",!j||!j.isConnected||j.parentElement!==ve?(j?.remove(),j=document.createElement("div"),j.className="me-video-text-canvas-layer me-video-sticker-canvas-layer",j.addEventListener("pointerdown",fe=>{fe.target===j&&(fe.preventDefault(),fe.stopPropagation())}),j.addEventListener("click",fe=>{fe.target===j&&(fe.preventDefault(),fe.stopPropagation(),T=null,mf(n),H?x(!1):K())}),ve.appendChild(j)):ve.lastElementChild!==j&&ve.appendChild(j),$&&k!==ve&&(k&&$.unobserve(k),k=ve,$.observe(ve))}function kn(){if(!ve)return null;const Y=a.getState().canvas??{},fe=Math.max(1,Number(Y.w)||0),Ne=Math.max(1,Number(Y.h)||0);if(!fe||!Ne)return null;const Qe=ve.getBoundingClientRect(),Et=ve.querySelector("canvas, video, img")||[...ve.children].find(Xe=>Xe!==j)||null;let z=0,V=0,Fe=ve.clientWidth||fe,He=ve.clientHeight||Ne;if(Et instanceof HTMLElement){const Xe=Et.getBoundingClientRect();Xe.width>0&&Xe.height>0&&(z=Xe.left-Qe.left,V=Xe.top-Qe.top,Fe=Xe.width,He=Xe.height)}if(!(Fe>0&&He>0)){const Xe=ve.clientWidth||fe,ct=ve.clientHeight||Ne,kt=Math.min(Xe/fe,ct/Ne)||1;Fe=fe*kt,He=Ne*kt,z=Math.max(0,(Xe-Fe)/2),V=Math.max(0,(ct-He)/2)}return{stageLeft:Qe.left,stageTop:Qe.top,left:z,top:V,scaleX:Fe/fe,scaleY:He/Ne}}function xn(Y,fe){const Ne=Cn(Y),Qe=Tr(Y,Ne);return fe>=Ne-.001&&fe<=Qe+.001}function je(Y,fe,Ne){const Qe=gr(n,"text",Y,fe,Ne);T=Qe.length?Qe[Qe.length-1]:null,x(!0),K()}function dt(Y,fe,Ne){return{x:(Y-Ne.stageLeft-Ne.left)/Ne.scaleX,y:(fe-Ne.stageTop-Ne.top)/Ne.scaleY}}function yt(Y,fe,Ne){const Qe=(a.getState().overlays??[])[Y];if(!Qe||Qe.type!=="sticker")return;const Et=a.getState().canvas??{w:1080,h:1920},z=Ir(Qe);if(!z)return;const V=fe.clientX,Fe=fe.clientY,He=Math.max(0,(Number(Et.w)||0)-z.w),Xe=Math.max(0,(Number(Et.h)||0)-z.h),ct=(at,Ke,Nt)=>{const Wt=(at-V)/Ne.scaleX,Ct=(Ke-Fe)/Ne.scaleY,bt=qe(z.x+Wt,0,He),$t=qe(z.y+Ct,0,Xe);a.updateOverlay(Y,{x:bt,y:$t},Nt?{transient:!0}:void 0)},kt=at=>{at.preventDefault(),ct(at.clientX,at.clientY,!0)},rt=at=>{window.removeEventListener("pointermove",kt),window.removeEventListener("pointerup",rt),window.removeEventListener("pointercancel",rt),ct(at.clientX,at.clientY,!1)};window.addEventListener("pointermove",kt),window.addEventListener("pointerup",rt),window.addEventListener("pointercancel",rt)}function pt(Y,fe,Ne,Qe){const Et=(a.getState().overlays??[])[Y];if(!Et||Et.type!=="sticker")return;const z=ot(Et);if(!z)return;const V=a.getState().canvas??{w:1080,h:1920},Fe=fe.x===.5?.5:1-fe.x,He=fe.y===.5?.5:1-fe.y,Xe=z.x+z.w*Fe,ct=z.y+z.h*He,kt=Math.max(.1,24/Math.max(24,z.w),24/Math.max(24,z.h)),rt=fe.x===.5?1/0:Math.max(.1,(Fe===0?(Number(V.w)||0)-Xe:Xe)/Math.max(1,z.w)),at=fe.y===.5?1/0:Math.max(.1,(He===0?(Number(V.h)||0)-ct:ct)/Math.max(1,z.h)),Ke=Math.max(kt,Math.min(rt,at,8)),Nt=(bt,$t,un)=>{const pn=dt(bt,$t,Qe),Lt=[];fe.x!==.5&&Lt.push(Math.abs(pn.x-Xe)/Math.max(1,z.w)),fe.y!==.5&&Lt.push(Math.abs(pn.y-ct)/Math.max(1,z.h));const Zt=Lt.filter(Number.isFinite),en=Zt.length?Math.max(...Zt):1,Tn=qe(en,kt,Ke),fn={x:Xe-z.w*Tn*Fe,y:ct-z.h*Tn*He,w:Math.max(8,z.w*Tn),h:Math.max(8,z.h*Tn)},Dn=Jt(gt(Et,fn),V);a.updateOverlay(Y,{x:Dn.x,y:Dn.y,w:Dn.w,h:Dn.h},un?{transient:!0}:void 0)},Wt=bt=>{bt.preventDefault(),Nt(bt.clientX,bt.clientY,!0)},Ct=bt=>{window.removeEventListener("pointermove",Wt),window.removeEventListener("pointerup",Ct),window.removeEventListener("pointercancel",Ct),Nt(bt.clientX,bt.clientY,!1)};window.addEventListener("pointermove",Wt),window.addEventListener("pointerup",Ct),window.addEventListener("pointercancel",Ct)}function Mt(Y,fe,Ne){const Qe=(a.getState().overlays??[])[Y];if(!Qe||Qe.type!=="sticker")return;const Et=ot(Qe);if(!Et)return;const z=Ne.stageLeft+Ne.left+(Et.x+Et.w/2)*Ne.scaleX,V=Ne.stageTop+Ne.top+(Et.y+Et.h/2)*Ne.scaleY,Fe=Math.atan2(fe.clientY-V,fe.clientX-z),He=da(Qe),Xe=(rt,at,Ke,Nt)=>{const Wt=Math.atan2(at-V,rt-z);let Ct=Es(He+(Wt-Fe)*180/Math.PI);Nt&&(Ct=Math.round(Ct/15)*15),a.updateOverlay(Y,{rotation:Ct},Ke?{transient:!0}:void 0)},ct=rt=>{rt.preventDefault(),Xe(rt.clientX,rt.clientY,!0,rt.shiftKey)},kt=rt=>{window.removeEventListener("pointermove",ct),window.removeEventListener("pointerup",kt),window.removeEventListener("pointercancel",kt),Xe(rt.clientX,rt.clientY,!1,rt.shiftKey)};window.addEventListener("pointermove",ct),window.addEventListener("pointerup",kt),window.addEventListener("pointercancel",kt)}function dn(Y,fe){if(Vt(),!j)return;j.replaceChildren();const Ne=kn();if(!Ne){j.hidden=!0;return}j.hidden=!1;const Qe=Ye(),Et=Y.map(V=>V.index),z=Y.filter(V=>xn(V.overlay,Qe));for(const V of z){const Fe=ot(V.overlay);if(!Fe)continue;const He=document.createElement("button");He.type="button",He.className="me-video-text-canvas-hit me-video-sticker-canvas-hit";const Xe=fe.has(V.index),ct=Xe&&T===V.index;Xe&&He.classList.add("is-active"),He.title=lt(V.overlay),He.style.left=`${Ne.left+Fe.x*Ne.scaleX}px`,He.style.top=`${Ne.top+Fe.y*Ne.scaleY}px`,He.style.width=`${Math.max(18,Fe.w*Ne.scaleX)}px`,He.style.height=`${Math.max(18,Fe.h*Ne.scaleY)}px`;const kt=da(V.overlay);if(kt&&(He.style.transform=`rotate(${kt}deg)`,He.style.transformOrigin="center center"),He.addEventListener("pointerdown",rt=>{if(rt.preventDefault(),rt.stopPropagation(),rt.shiftKey||rt.ctrlKey||rt.metaKey){je(V.index,rt,Et);return}T=V.index,qn(n,"text",[V.index]),x(!0),yt(V.index,rt,Ne)}),ct){for(const at of M){const Ke=document.createElement("span");Ke.className="me-video-text-canvas-handle",Ke.dataset.handle=at.key,Ke.style.left=`${at.x*100}%`,Ke.style.top=`${at.y*100}%`,Ke.addEventListener("pointerdown",Nt=>{Nt.preventDefault(),Nt.stopPropagation(),T=V.index,qn(n,"text",[V.index]),x(!0),pt(V.index,at,Nt,Ne)}),He.appendChild(Ke)}const rt=document.createElement("span");rt.className="me-video-text-canvas-handle",rt.dataset.handle=A.key,rt.style.left=`${A.x*100}%`,rt.style.top=`${A.y*100}%`,rt.addEventListener("pointerdown",at=>{at.preventDefault(),at.stopPropagation(),T=V.index,qn(n,"text",[V.index]),x(!0),Mt(V.index,at,Ne)}),He.appendChild(rt)}j.appendChild(He)}}function Ut(Y,fe,Ne){if(!Te)return;const Qe=(a.getState().overlays??[])[Y];if(!Qe||Qe.type!=="sticker")return;if(Ne.shiftKey||Ne.ctrlKey||Ne.metaKey){Ne.preventDefault(),Ne.stopPropagation();const at=gr(n,"text",Y,Ne,Tg(a.getState()).map(Ke=>Ke.index));T=at.length?at[at.length-1]:null,J(),x(!0);return}Ne.preventDefault(),Ne.stopPropagation(),T=Y,qn(n,"text",[Y]),J(),H||x(!0);const Et=Ce(),z=Math.max(Te.clientWidth/Et,.001),V=Cn(Qe),Fe=Tr(Qe,V),He=Math.max(jt,Fe-V),Xe=$n(Qe),ct=Ne.clientX,kt=at=>{const Ke=(at.clientX-ct)/z,Nt=a.getState().overlays??[];if(fe==="move"){const bt=Math.max(0,V+Ke),$t=bt+He,un=Nn(de,Nt,Y,bt,$t,at.clientY,Xe);xt(Y,{startAt:bt,endAt:$t,timelineTrack:un},{transient:!0});return}if(fe==="start"){const bt=qe(V+Ke,0,Fe-jt),$t=Nn(de,Nt,Y,bt,Fe,at.clientY,Xe);xt(Y,{startAt:bt,endAt:Fe,timelineTrack:$t},{transient:!0});return}const Wt=Math.max(V+jt,Fe+Ke),Ct=Nn(de,Nt,Y,V,Wt,at.clientY,Xe);xt(Y,{startAt:V,endAt:Wt,timelineTrack:Ct},{transient:!0})},rt=at=>{window.removeEventListener("pointermove",kt),window.removeEventListener("pointerup",rt),window.removeEventListener("pointercancel",rt);const Ke=(at.clientX-ct)/z,Nt=a.getState().overlays??[];if(fe==="move"){const bt=Math.max(0,V+Ke),$t=bt+He,un=Nn(de,Nt,Y,bt,$t,at.clientY,Xe);xt(Y,{startAt:bt,endAt:$t,timelineTrack:un});return}if(fe==="start"){const bt=qe(V+Ke,0,Fe-jt),$t=Nn(de,Nt,Y,bt,Fe,at.clientY,Xe);xt(Y,{startAt:bt,endAt:Fe,timelineTrack:$t});return}const Wt=Math.max(V+jt,Fe+Ke),Ct=Nn(de,Nt,Y,V,Wt,at.clientY,Xe);xt(Y,{startAt:V,endAt:Wt,timelineTrack:Ct})};window.addEventListener("pointermove",kt),window.addEventListener("pointerup",rt),window.addEventListener("pointercancel",rt),K()}function An(Y,fe){if(Rt(),!de||!Te||(de.replaceChildren(),de.hidden=Y.length===0,!Y.length))return;const Ne=Ce(),Qe=Te.clientWidth/Ne,Et=Ss(a.getState()),z=new Map;for(const V of Y){const Fe=$n(V.overlay),He=Et.get(Fe)??Fe;let Xe=z.get(Fe);Xe||(Xe=document.createElement("div"),Xe.className="me-video-overlay-track-row",Xe.dataset.track=String(Fe),Xe.style.top=`${il(He)}px`,z.set(Fe,Xe),de.appendChild(Xe));const ct=document.createElement("div");ct.className="me-video-text-track-clip me-video-sticker-track-clip",fe.has(V.index)&&ct.classList.add("is-active");const kt=Cn(V.overlay),rt=al(V.overlay);ct.style.left=`${kt*Qe}px`,ct.style.width=`${Math.max(36,rt*Qe)}px`;const at=document.createElement("span");at.className="me-video-text-track-icon",at.textContent=_t(V.overlay);const Ke=document.createElement("span");Ke.className="me-video-text-track-label",Ke.textContent=lt(V.overlay),Ke.title=Ke.textContent;const Nt=document.createElement("span");Nt.className="me-video-text-track-handle is-start";const Wt=document.createElement("span");Wt.className="me-video-text-track-handle is-end",ct.append(at,Ke,Nt,Wt),ct.addEventListener("pointerdown",Ct=>Ut(V.index,"move",Ct)),Nt.addEventListener("pointerdown",Ct=>Ut(V.index,"start",Ct)),Wt.addEventListener("pointerdown",Ct=>Ut(V.index,"end",Ct)),ct.addEventListener("click",Ct=>{if(Ct.preventDefault(),Ct.stopPropagation(),Ct.shiftKey||Ct.ctrlKey||Ct.metaKey){J(),K();return}const bt=gr(n,"text",V.index,Ct,Y.map($t=>$t.index));T=bt.length?bt[bt.length-1]:null,J(),x(!0),K()}),Xe.appendChild(ct)}}function K(){Me(()=>{mt();const Y=C().find(Qe=>Qe.classList.contains("is-active"))??null;H&&Y&&Y!==Be&&Y!==oe&&(J(),_e());const fe=Tg(a.getState());xe(fe);const Ne=new Set(jg(n,a.getState()));An(fe,Ne),dn(fe,Ne),U(),te()}),et()}function Le(Y){return!!Y&&(Y===d||d.contains(Y)||Y===oe||oe?.contains?.(Y)||Y===de||de?.contains?.(Y)||Y===j||j?.contains?.(Y))}function Ze(Y){return Y.some(fe=>{if(!Le(fe.target))return!0;for(const Ne of fe.addedNodes)if(!Le(Ne))return!0;for(const Ne of fe.removedNodes)if(!Le(Ne))return!0;return!1})}const Tt=new MutationObserver(Y=>{le||n.__meVideoEnhancerObserverLock||Ze(Y)&&(mt(),_e())}),rn=Y=>{Y?.detail?.id!==se&&H&&(H=!1,K())},Pt=()=>{K()},nn=Y=>{const fe=Y.target;if(!(fe instanceof Node)||!oe||!oe.contains(fe))return;Y.preventDefault(),Y.stopPropagation(),Y.stopImmediatePropagation?.();const Ne=!H;Ne&&(J(),_e()),x(Ne)};Tt.observe(n,{childList:!0,subtree:!0,characterData:!0}),n.addEventListener("me-video-inspector-open",rn),n.addEventListener(fr,Pt),n.addEventListener("click",nn,!0),window.addEventListener("resize",te);const wn=a.subscribe(()=>{K()});return Q.addEventListener("change",()=>{st(Q.files)}),v.addEventListener("dragenter",Y=>{Y.preventDefault(),v.classList.add("is-dragover")}),v.addEventListener("dragover",Y=>{Y.preventDefault(),v.classList.add("is-dragover")}),v.addEventListener("dragleave",Y=>{Y.target===v&&v.classList.remove("is-dragover")}),v.addEventListener("drop",Y=>{Y.preventDefault(),v.classList.remove("is-dragover"),st(Y.dataTransfer?.files)}),Ge(),mt=function(){Me(()=>{const Y=n.querySelector(".me-video-toolrail");if(!Y)return;ge=Y;const fe=C(ge);Be=B(fe),oe=G(fe),ze(),te()})},mt(),K(),{destroy(){Tt.disconnect(),P&&Ae&&P.unobserve(Ae),$&&k&&$.unobserve(k),wn(),n.removeEventListener("me-video-inspector-open",rn),n.removeEventListener(fr,Pt),n.removeEventListener("click",nn,!0),window.removeEventListener("resize",te),H=!1,ze(),de?.remove(),j?.remove(),d.remove(),br(n)}}}function R5(n,a,o){wa(),nl();const l=yf(o()),s=w5(l),d=new Map(s.map(z=>[String(z.id??""),z])),m=s.find(z=>z.id)?.id??"",h=document.createElement("div");h.className="me-video-text-panel me-video-color-panel me-video-filter-panel",h.hidden=!0,n.appendChild(h);const g=document.createElement("div");g.className="me-video-text-toolbar";const v=document.createElement("strong");v.textContent=l.filterTitle;const w=Hr(l.reset);g.append(v,w);const W=ta(l.presets),S=document.createElement("div");S.className="me-video-color-grid",W.body.appendChild(S);const Q=s.map(z=>{const V=document.createElement("button");V.type="button",V.className="me-video-color-card",V.dataset.presetId=z.id??"";const Fe=document.createElement("div");Fe.className="me-video-color-preview",Fe.style.filter=z.css||"none";const He=document.createElement("img");He.alt="",He.draggable=!1,He.hidden=!0,Fe.appendChild(He);const Xe=document.createElement("div");return Xe.className="me-video-color-card-title",Xe.textContent=z.label,V.append(Fe,Xe),S.appendChild(V),{entry:z,buttonEl:V,previewImage:He}});h.append(g,W.section);let X=null,ue=null,oe=null,ge=null,Be=null,Te=null,de=null,Ae=null,ve=null,j=null,k=null,H=null,T=!1,_=null,le=!1,se=!1,me="";const P="filter",$=typeof requestAnimationFrame=="function"?requestAnimationFrame:z=>setTimeout(z,16),M=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>C()),A=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>C()),ee=[{key:"tl",x:0,y:0},{key:"tm",x:.5,y:0},{key:"tr",x:1,y:0},{key:"mr",x:1,y:.5},{key:"br",x:1,y:1},{key:"bm",x:.5,y:1},{key:"bl",x:0,y:1},{key:"ml",x:0,y:.5}],Me={key:"rotate",x:.5,y:0};function _e(){Promise.resolve().then(()=>{se=!1;const z=n.__meVideoEnhancerObserverLock??0;n.__meVideoEnhancerObserverLock=Math.max(0,z-1)})}function x(z){se=!0,n.__meVideoEnhancerObserverLock=(n.__meVideoEnhancerObserverLock??0)+1;try{return z()}finally{_e()}}function C(){le||(le=!0,$(()=>{le=!1,Pt()}))}function O(z=ue){return z?[...z.children].filter(V=>V instanceof HTMLButtonElement&&V!==ge&&!V.classList.contains("me-video-text-tool")):[]}function B(z){const V=[l.filterTool,l.filterTitle,"filter","filters","\u6EE4\u955C","\u6FFE\u93E1"].map(Fe=>String(Fe??"").trim().toLowerCase()).filter(Boolean);return z.find(Fe=>{const He=Cf(Fe);return V.some(Xe=>He.includes(Xe))})??z[3]??null}function G(){oe&&(oe.classList.contains("is-active")||oe.click())}function ze(){Da(n,h),br(n)}function J(z){const V=!!z;if(V===T){Pt();return}T=V,T&&n.dispatchEvent(new CustomEvent("me-video-inspector-open",{detail:{id:P}})),Pt()}function te(){if(X?.classList.toggle("is-active",T),!!oe&&T){oe.classList.remove("is-active");return}}function U(){h.hidden=!T,te(),ze()}function xe(){const z=a.getState().overlays??[];if(_==null)return null;const V=z[_];return V?.type==="filter"?V:null}function Ce(){return ol(a)}function Ye(){return co(n)}function et(){if(!a.history?.present)return;const z=Ye(),V=Number(a.history.present.__mePreviewTimelineTime);Math.abs((Number.isFinite(V)?V:-1)-z)<.001||(a.history={...a.history,present:{...a.history.present,__mePreviewTimelineTime:z}},typeof a.emit=="function"&&a.emit())}function lt(z){if(!z.length){_=null;return}const V=Og(n,a.getState());_=V.length?V[V.length-1]:null}function ot(z){return String(z?.filterPreset??"").trim()}function gt(z){return d.get(ot(z))??null}function Jt(z){return gt(z)?.css||"none"}function _t(z){return gt(z)?.label||l.filterTitle}function xt(z){const V=Number(z?.w),Fe=Number(z?.h);return!(V>0)||!(Fe>0)?null:{x:Number(z?.x)||0,y:Number(z?.y)||0,w:Math.max(48,V),h:Math.max(48,Fe)}}function Yt(z,V){const Fe=xt(z);if(!Fe)return z;const He=Math.max(.1,Number(V)||1);return{...z,w:Math.max(48,Fe.w*He),h:Math.max(48,Fe.h*He)}}function tn(z,V,Fe={}){const He=(a.getState().overlays??[])[z];!He||He.type!=="filter"||a.updateOverlay(z,ma(He,Ce(),V),Fe)}function _n(z,V){_!=null&&a.updateOverlay(_,z,V)}function st(z){if(typeof a.applyMut=="function"){a.applyMut(Fe=>({...Fe,overlays:[...za(Fe.overlays),{...z,timelineTrack:0}]}));return}const V=za(a.getState().overlays);a.commit?.({overlays:[...V,{...z,timelineTrack:0}]})}function Ge(z=m){const V=a.getState().canvas??{w:1080,h:1920},Fe=qe(Math.round((Number(V.w)||1080)*.68),180,Math.max(180,(Number(V.w)||1080)-48)),He=qe(Math.round((Number(V.h)||1920)*.3),120,Math.max(120,(Number(V.h)||1920)-48));return{type:"filter",x:Math.round(((Number(V.w)||1080)-Fe)/2),y:Math.round(((Number(V.h)||1920)-He)/2),w:Fe,h:He,rotation:0,filterPreset:z||void 0}}function mt(z=m){const V=Ce();let Fe=qe(Ye(),0,Math.max(0,V-jt)),He=Math.min(V,Fe+Jr);He-Fe<jt&&(Fe=qe(V-Jr,0,Math.max(0,V-jt)),He=Math.max(Fe+jt,V));const Xe={...Ge(z),...ma(null,V,{startAt:Fe,endAt:He,timelineTrack:0})};st(Xe);const ct=a.getState().overlays??[];_=ct.length?ct.length-1:null,_!=null&&qn(n,"text",[_]),kn(!0),G(),J(!0)}function Rt(z){if(!xe()){mt(z);return}_n({filterPreset:z||void 0}),J(!0)}function Vt(z){if(z){if(!me){z.hidden=!0,z.removeAttribute("src");return}z.src!==me&&(z.src=me),z.hidden=!1}}function kn(z=!1){if(me&&!z)return;const V=C5(n);V&&(V===me&&!z||(me=V,Q.forEach(({previewImage:Fe})=>Vt(Fe))))}function xn(){xe()&&_n({filterPreset:void 0})}function je(){x(()=>{const z=n.querySelector(".me-video-toolrail");if(!z)return;ue=z;const V=O(ue);oe=Ec(V),Be=B(V),Be?(ge?.remove(),X=Be):((!ge||!ge.isConnected)&&(ge=document.createElement("button"),ge.type="button",ge.className="me-video-text-tool me-video-filter-tool",ge.innerHTML=`<span class="me-video-text-tool-icon">\u25A3</span><span class="me-video-text-tool-label">${l.filterTool}</span>`),ge.title=l.filterTool,ge.setAttribute("aria-label",l.filterTool),ge.isConnected?Be?.parentElement===ue&&ge.nextSibling!==Be&&ue.insertBefore(ge,Be):Be?.parentElement===ue?ue.insertBefore(ge,Be):ue.appendChild(ge),X=ge),X?.setAttribute?.("title",l.filterTool),X?.setAttribute?.("aria-label",l.filterTool),te(),ze()})}function dt(){const{timelineInner:z,timelineHost:V}=Ms(n,a.getState());if(!z||!V){de?.remove(),de=null,M&&Ae&&(M.unobserve(Ae),Ae=null),Te=null;return}Te=z,(!de||!de.isConnected||de.parentElement!==V)&&(de?.remove(),de=document.createElement("div"),de.className="me-video-text-timeline me-video-overlay-timeline me-video-filter-overlay-layer");for(const Fe of[...V.children])Fe!==de&&Fe instanceof HTMLElement&&Fe.classList.contains("me-video-filter-overlay-layer")&&Fe.remove();(de.parentElement!==V||V.lastElementChild!==de)&&V.appendChild(de),M&&Ae!==Te&&(Ae&&M.unobserve(Ae),Ae=Te,M.observe(Te))}function yt(){const z=n.querySelector(".me-video-canvas-stage");if(!z){j?.remove(),j=null,k?.remove(),k=null,A&&H&&(A.unobserve(H),H=null),ve=null;return}ve=z,ve.style.position="relative",(!j||!j.isConnected||j.parentElement!==ve)&&(j?.remove(),j=document.createElement("div"),j.className="me-video-filter-effect-layer",ve.appendChild(j)),(!k||!k.isConnected||k.parentElement!==ve)&&(k?.remove(),k=document.createElement("div"),k.className="me-video-filter-control-layer",ve.appendChild(k)),ve.lastElementChild!==k&&ve.appendChild(k),A&&H!==ve&&(H&&A.unobserve(H),H=ve,A.observe(ve))}function pt(){if(!ve)return null;const z=a.getState().canvas??{},V=Math.max(1,Number(z.w)||0),Fe=Math.max(1,Number(z.h)||0);if(!V||!Fe)return null;const He=ve.getBoundingClientRect(),Xe=ve.querySelector("canvas, video, img")||[...ve.children].find(Ke=>Ke!==j&&Ke!==k)||null;let ct=0,kt=0,rt=ve.clientWidth||V,at=ve.clientHeight||Fe;if(Xe instanceof HTMLElement){const Ke=Xe.getBoundingClientRect();Ke.width>0&&Ke.height>0&&(ct=Ke.left-He.left,kt=Ke.top-He.top,rt=Ke.width,at=Ke.height)}if(!(rt>0&&at>0)){const Ke=ve.clientWidth||V,Nt=ve.clientHeight||Fe,Wt=Math.min(Ke/V,Nt/Fe)||1;rt=V*Wt,at=Fe*Wt,ct=Math.max(0,(Ke-rt)/2),kt=Math.max(0,(Nt-at)/2)}return{stageLeft:He.left,stageTop:He.top,left:ct,top:kt,scaleX:rt/V,scaleY:at/Fe}}function Mt(z,V){const Fe=Cn(z),He=Tr(z,Fe);return V>=Fe-.001&&V<=He+.001}function dn(z,V,Fe){const He=gr(n,"text",z,V,Fe);_=He.length?He[He.length-1]:null,J(!0),Pt()}function Ut(z,V,Fe){return{x:(z-Fe.stageLeft-Fe.left)/Fe.scaleX,y:(V-Fe.stageTop-Fe.top)/Fe.scaleY}}function An(z,V,Fe){const He=(a.getState().overlays??[])[z];if(!He||He.type!=="filter")return;const Xe=a.getState().canvas??{w:1080,h:1920},ct=xt(He);if(!ct)return;const kt=V.clientX,rt=V.clientY,at=Math.max(0,(Number(Xe.w)||0)-ct.w),Ke=Math.max(0,(Number(Xe.h)||0)-ct.h),Nt=(bt,$t,un)=>{const pn=(bt-kt)/Fe.scaleX,Lt=($t-rt)/Fe.scaleY,Zt=qe(ct.x+pn,0,at),en=qe(ct.y+Lt,0,Ke);a.updateOverlay(z,{x:Zt,y:en},un?{transient:!0}:void 0)},Wt=bt=>{bt.preventDefault(),Nt(bt.clientX,bt.clientY,!0)},Ct=bt=>{window.removeEventListener("pointermove",Wt),window.removeEventListener("pointerup",Ct),window.removeEventListener("pointercancel",Ct),Nt(bt.clientX,bt.clientY,!1)};window.addEventListener("pointermove",Wt),window.addEventListener("pointerup",Ct),window.addEventListener("pointercancel",Ct)}function K(z,V,Fe,He){const Xe=(a.getState().overlays??[])[z];if(!Xe||Xe.type!=="filter")return;const ct=xt(Xe);if(!ct)return;const kt=a.getState().canvas??{w:1080,h:1920},rt=V.x===.5?.5:1-V.x,at=V.y===.5?.5:1-V.y,Ke=ct.x+ct.w*rt,Nt=ct.y+ct.h*at,Wt=Math.max(.1,48/Math.max(48,ct.w),48/Math.max(48,ct.h)),Ct=V.x===.5?1/0:Math.max(.1,(rt===0?(Number(kt.w)||0)-Ke:Ke)/Math.max(1,ct.w)),bt=V.y===.5?1/0:Math.max(.1,(at===0?(Number(kt.h)||0)-Nt:Nt)/Math.max(1,ct.h)),$t=Math.max(Wt,Math.min(Ct,bt,8)),un=(Zt,en,Tn)=>{const fn=Ut(Zt,en,He),Dn=[];V.x!==.5&&Dn.push(Math.abs(fn.x-Ke)/Math.max(1,ct.w)),V.y!==.5&&Dn.push(Math.abs(fn.y-Nt)/Math.max(1,ct.h));const zr=Dn.length?Math.max(...Dn):1,Hn=qe(zr,Wt,$t),ur=Yt(Xe,Hn),Yn=xt(ur);if(!Yn)return;const Fr=Ke-Yn.w*rt,D=Nt-Yn.h*at;a.updateOverlay(z,{x:Fr,y:D,w:Yn.w,h:Yn.h},Tn?{transient:!0}:void 0)},pn=Zt=>{Zt.preventDefault(),un(Zt.clientX,Zt.clientY,!0)},Lt=Zt=>{window.removeEventListener("pointermove",pn),window.removeEventListener("pointerup",Lt),window.removeEventListener("pointercancel",Lt),un(Zt.clientX,Zt.clientY,!1)};window.addEventListener("pointermove",pn),window.addEventListener("pointerup",Lt),window.addEventListener("pointercancel",Lt)}function Le(z,V,Fe){const He=(a.getState().overlays??[])[z];if(!He||He.type!=="filter")return;const Xe=xt(He);if(!Xe)return;const ct=Fe.stageLeft+Fe.left+(Xe.x+Xe.w/2)*Fe.scaleX,kt=Fe.stageTop+Fe.top+(Xe.y+Xe.h/2)*Fe.scaleY,rt=Math.atan2(V.clientY-kt,V.clientX-ct),at=da(He),Ke=(Ct,bt,$t,un)=>{const pn=Math.atan2(bt-kt,Ct-ct);let Lt=Es(at+(pn-rt)*180/Math.PI);un&&(Lt=Math.round(Lt/15)*15),a.updateOverlay(z,{rotation:Lt},$t?{transient:!0}:void 0)},Nt=Ct=>{Ct.preventDefault(),Ke(Ct.clientX,Ct.clientY,!0,Ct.shiftKey)},Wt=Ct=>{window.removeEventListener("pointermove",Nt),window.removeEventListener("pointerup",Wt),window.removeEventListener("pointercancel",Wt),Ke(Ct.clientX,Ct.clientY,!1,Ct.shiftKey)};window.addEventListener("pointermove",Nt),window.addEventListener("pointerup",Wt),window.addEventListener("pointercancel",Wt)}function Ze(z,V){if(yt(),!j||!k)return;if(j.replaceChildren(),k.replaceChildren(),!pt()){j.hidden=!0,k.hidden=!0;return}k.hidden=!0;const Fe=Ye();if(!z.filter(He=>Mt(He.overlay,Fe)).length){j.hidden=!0;return}j.hidden=!0}function Tt(z,V,Fe){if(!Te)return;const He=(a.getState().overlays??[])[z];if(!He||He.type!=="filter")return;if(Fe.shiftKey||Fe.ctrlKey||Fe.metaKey){Fe.preventDefault(),Fe.stopPropagation();const bt=gr(n,"text",z,Fe,Bg(a.getState()).map($t=>$t.index));_=bt.length?bt[bt.length-1]:null,G(),J(!0);return}Fe.preventDefault(),Fe.stopPropagation(),_=z,qn(n,"text",[z]),G(),T||J(!0);const Xe=Ce(),ct=Math.max(Te.clientWidth/Xe,.001),kt=Cn(He),rt=Tr(He,kt),at=Math.max(jt,rt-kt),Ke=$n(He),Nt=Fe.clientX,Wt=bt=>{const $t=(bt.clientX-Nt)/ct,un=a.getState().overlays??[];if(V==="move"){const Zt=Math.max(0,kt+$t),en=Zt+at,Tn=Nn(de,un,z,Zt,en,bt.clientY,Ke);tn(z,{startAt:Zt,endAt:en,timelineTrack:Tn},{transient:!0});return}if(V==="start"){const Zt=qe(kt+$t,0,rt-jt),en=Nn(de,un,z,Zt,rt,bt.clientY,Ke);tn(z,{startAt:Zt,endAt:rt,timelineTrack:en},{transient:!0});return}const pn=Math.max(kt+jt,rt+$t),Lt=Nn(de,un,z,kt,pn,bt.clientY,Ke);tn(z,{startAt:kt,endAt:pn,timelineTrack:Lt},{transient:!0})},Ct=bt=>{window.removeEventListener("pointermove",Wt),window.removeEventListener("pointerup",Ct),window.removeEventListener("pointercancel",Ct);const $t=(bt.clientX-Nt)/ct,un=a.getState().overlays??[];if(V==="move"){const Zt=Math.max(0,kt+$t),en=Zt+at,Tn=Nn(de,un,z,Zt,en,bt.clientY,Ke);tn(z,{startAt:Zt,endAt:en,timelineTrack:Tn});return}if(V==="start"){const Zt=qe(kt+$t,0,rt-jt),en=Nn(de,un,z,Zt,rt,bt.clientY,Ke);tn(z,{startAt:Zt,endAt:rt,timelineTrack:en});return}const pn=Math.max(kt+jt,rt+$t),Lt=Nn(de,un,z,kt,pn,bt.clientY,Ke);tn(z,{startAt:kt,endAt:pn,timelineTrack:Lt})};window.addEventListener("pointermove",Wt),window.addEventListener("pointerup",Ct),window.addEventListener("pointercancel",Ct),Pt()}function rn(z,V){if(dt(),!de||!Te||(de.replaceChildren(),de.hidden=z.length===0,!z.length))return;const Fe=Ce(),He=Te.clientWidth/Fe,Xe=Ss(a.getState()),ct=new Map;for(const kt of z){const rt=$n(kt.overlay),at=Xe.get(rt)??rt;let Ke=ct.get(rt);Ke||(Ke=document.createElement("div"),Ke.className="me-video-overlay-track-row",Ke.dataset.track=String(rt),Ke.style.top=`${il(at)}px`,ct.set(rt,Ke),de.appendChild(Ke));const Nt=document.createElement("div");Nt.className="me-video-text-track-clip me-video-filter-track-clip",V.has(kt.index)&&Nt.classList.add("is-active");const Wt=Cn(kt.overlay),Ct=al(kt.overlay);Nt.style.left=`${Wt*He}px`,Nt.style.width=`${Math.max(36,Ct*He)}px`;const bt=document.createElement("span");bt.className="me-video-text-track-icon",bt.textContent="Fx";const $t=document.createElement("span");$t.className="me-video-text-track-label",$t.textContent=_t(kt.overlay),$t.title=$t.textContent;const un=document.createElement("span");un.className="me-video-text-track-handle is-start";const pn=document.createElement("span");pn.className="me-video-text-track-handle is-end",Nt.append(bt,$t,un,pn),Nt.addEventListener("pointerdown",Lt=>Tt(kt.index,"move",Lt)),un.addEventListener("pointerdown",Lt=>Tt(kt.index,"start",Lt)),pn.addEventListener("pointerdown",Lt=>Tt(kt.index,"end",Lt)),Nt.addEventListener("click",Lt=>{if(Lt.preventDefault(),Lt.stopPropagation(),Lt.shiftKey||Lt.ctrlKey||Lt.metaKey){G(),Pt();return}const Zt=gr(n,"text",kt.index,Lt,z.map(en=>en.index));_=Zt.length?Zt[Zt.length-1]:null,G(),J(!0),Pt()}),Ke.appendChild(Nt)}}function Pt(){x(()=>{je(),kn();const z=Bg(a.getState());lt(z);const V=new Set(Og(n,a.getState()));rn(z,V),Ze(z,V);const Fe=ot(xe());Q.forEach(({entry:He,buttonEl:Xe,previewImage:ct})=>{Xe.classList.toggle("is-active",String(He.id??"")===Fe),Vt(ct)}),w.disabled=!Fe,U(),ze()}),et()}function nn(z){return!!z&&(z===h||h.contains(z)||z===X||X?.contains?.(z)||z===ge||ge?.contains?.(z)||z===de||de?.contains?.(z)||z===j||j?.contains?.(z)||z===k||k?.contains?.(z))}function wn(z){return z.some(V=>{if(!nn(V.target))return!0;for(const Fe of V.addedNodes)if(!nn(Fe))return!0;for(const Fe of V.removedNodes)if(!nn(Fe))return!0;return!1})}const Y=new MutationObserver(z=>{se||n.__meVideoEnhancerObserverLock||wn(z)&&(je(),C())}),fe=z=>{const V=z.target;!(V instanceof Node)||!X||!X.contains(V)||(z.preventDefault(),z.stopPropagation(),z.stopImmediatePropagation?.(),mt(m))},Ne=z=>{z?.detail?.id!==P&&T&&(T=!1,Pt())},Qe=()=>{Pt()};Y.observe(n,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["class","style","hidden"]}),n.addEventListener("me-video-inspector-open",Ne),n.addEventListener(fr,Qe),n.addEventListener("click",fe,!0),window.addEventListener("resize",ze);const Et=a.subscribe(()=>{Pt()});return Q.forEach(({entry:z,buttonEl:V})=>{V.addEventListener("click",()=>{Rt(z.id||"")})}),w.addEventListener("click",()=>{xn()}),je(),Pt(),{destroy(){Y.disconnect(),M&&Ae&&M.unobserve(Ae),A&&H&&A.unobserve(H),Et(),n.removeEventListener("me-video-inspector-open",Ne),n.removeEventListener(fr,Qe),n.removeEventListener("click",fe,!0),window.removeEventListener("resize",ze),ge?.remove(),de?.remove(),j?.remove(),k?.remove(),h.remove(),br(n)}}}function I5(n,a,o,l){wa();const s=yf(l()),d=Mw(l()),m=Kg(s),h=document.createElement("div");h.className="me-video-text-panel me-video-color-panel me-video-effects-panel",h.hidden=!0,n.appendChild(h);const g=document.createElement("div");g.className="me-video-text-toolbar";const v=document.createElement("strong");v.textContent=d.title;const w=Hr(s.reset),W=Hr(d.close);g.append(v,w,W),h.appendChild(g);const S=document.createElement("p");S.className="me-video-text-hint",S.textContent=d.hint,h.appendChild(S);const Q=m.map(J=>{const te=ta(J.title),U=J.items.map(xe=>{const Ce=document.createElement("div");Ce.className="me-video-color-slider-control";const Ye=document.createElement("span");Ye.className="me-video-color-slider-value";const et=document.createElement("input");return et.type="range",et.min=String(xe.min),et.max=String(xe.max),et.step="0.02",et.dataset.adjustment=xe.key,Ce.append(Ye,et),te.body.appendChild(rr(xe.label,Ce)),{...xe,value:Ye,range:et}});return h.appendChild(te.section),{...J,controls:U}});let X=null,ue=null,oe=null,ge=null,Be=!1,Te=!1,de=!1;const Ae="effects",ve=typeof requestAnimationFrame=="function"?requestAnimationFrame:J=>setTimeout(J,16);function j(){Promise.resolve().then(()=>{de=!1;const J=n.__meVideoEnhancerObserverLock??0;n.__meVideoEnhancerObserverLock=Math.max(0,J-1)})}function k(J){de=!0,n.__meVideoEnhancerObserverLock=(n.__meVideoEnhancerObserverLock??0)+1;try{return J()}finally{j()}}function H(){Te||(Te=!0,ve(()=>{Te=!1,Me()}))}function T(J=ue){return J?[...J.children].filter(te=>te instanceof HTMLButtonElement&&te!==X&&!te.classList.contains("me-video-text-tool")):[]}function _(){ge&&(ge.isConnected&&(ge.style.display=ge.dataset.meTrimDisplay??"",ge.hidden=ge.dataset.meTrimHidden==="true",delete ge.dataset.meTrimDisplay,delete ge.dataset.meTrimHidden),ge=null)}function le(J){if(!J){_();return}ge!==J&&(_(),J.classList.remove("is-active"),J.dataset.meTrimDisplay=J.style.display??"",J.dataset.meTrimHidden=J.hidden?"true":"false",J.hidden=!0,J.style.display="none",ge=J)}function se(){if(oe&&!oe.classList.contains("is-active")){oe.click();return}const J=T()[0];J&&!J.classList.contains("is-active")&&J.click()}function me(J){if(!X||!(J instanceof HTMLButtonElement))return;const te=J.getAttribute("style");te?X.setAttribute("style",te):X.removeAttribute("style"),X.hidden=!1,X.style.display=""}function P(){X&&(X.dataset.theme=ks(o()))}function $(){Da(n,h),br(n)}function M(J){const te=!!J;if(te===Be){Me();return}Be=te,Be&&n.dispatchEvent(new CustomEvent("me-video-inspector-open",{detail:{id:Ae}})),Me()}function A(){if(X?.classList.toggle("is-active",Be),!!oe&&Be){oe.classList.remove("is-active");return}}function ee(){h.hidden=!Be,A(),$()}function Me(){k(()=>{T().find(U=>U!==oe&&!U.hidden&&U.style.display!=="none"&&U.classList.contains("is-active"))&&(Be=!1),Be&&se();const J=a.getState().filters??{},te=kf.some(U=>Math.abs(Number(J[U])||0)>1e-4);Q.forEach(U=>{U.controls.forEach(xe=>{const Ce=qe(Number(J[xe.key])||0,xe.min,xe.max);xe.range.value=String(Ce),xe.value.textContent=Gg(Ce,xe.format)})}),w.disabled=!te,ee(),P()})}function _e(){k(()=>{const J=n.querySelector(".me-video-toolrail");if(!J)return;ue=J;const te=T(ue);oe=Ec(te),le(oe);const U=oe??te[0]??null;(!X||!X.isConnected)&&(X=document.createElement("button"),X.type="button",X.className="me-video-text-tool me-video-effects-tool",X.innerHTML=`<span class="me-video-text-tool-icon">${Nw()}</span><span class="me-video-text-tool-label">${d.tool}</span>`),X.setAttribute("title",d.tool),X.setAttribute("aria-label",d.tool),me(U),X.isConnected?U?.parentElement===ue&&X.nextSibling!==U&&ue.insertBefore(X,U):U?.parentElement===ue?ue.insertBefore(X,U):ue.appendChild(X),P(),A(),$()})}function x(J){return!!J&&(J===h||h.contains(J)||J===X||X?.contains?.(J))}function C(J){return J.some(te=>{if(!x(te.target))return!0;for(const U of te.addedNodes)if(!x(U))return!0;for(const U of te.removedNodes)if(!x(U))return!0;return!1})}const O=new MutationObserver(J=>{de||n.__meVideoEnhancerObserverLock||C(J)&&(_e(),H())}),B=J=>{J?.detail?.id!==Ae&&Be&&(Be=!1,Me())},G=J=>{const te=J.target;if(!(te instanceof Node)||!X||!X.contains(te))return;J.preventDefault(),J.stopPropagation(),J.stopImmediatePropagation?.();const U=!Be;U&&se(),M(U)};O.observe(n,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","hidden"]}),n.addEventListener("me-video-inspector-open",B),n.addEventListener("click",G,!0),window.addEventListener("resize",H);const ze=a.subscribe(()=>{H()});return Q.forEach(J=>{J.controls.forEach(te=>{te.range.addEventListener("input",()=>{const U=qe(Number(te.range.value)||0,te.min,te.max);te.value.textContent=Gg(U,te.format),a.setFilter(te.key,U,{transient:!0})}),te.range.addEventListener("change",()=>{const U=qe(Number(te.range.value)||0,te.min,te.max);a.setFilter(te.key,U)})})}),w.addEventListener("click",()=>{x5(a)}),W.addEventListener("click",()=>{M(!1)}),_e(),Me(),{destroy(){O.disconnect(),ze(),n.removeEventListener("me-video-inspector-open",B),n.removeEventListener("click",G,!0),window.removeEventListener("resize",H),_(),X?.remove(),h.remove(),br(n)}}}function H5(n,a,o,l){wa(),nl();const s=yf(l()),d=Aw(l()),m=Kg(s),h=new Set(["brightness","contrast","saturation","temperature","tint","vibrance","gamma","highlights","shadows","whites","blacks","lightSense"]);function g(E,F,p){return E==="percent"?{min:(1+F)*100,max:(1+p)*100}:{min:F*100,max:p*100}}function v(E,F){const p=Number(E)||0;return F==="percent"?(1+p)*100:p*100}function w(E,F){const p=Number(E)||0;return F==="percent"?p/100-1:p/100}function W(E,F){const p=Math.round(v(E,F)*10)/10;return Number.isInteger(p),String(p)}function S(E,F){let p=Math.abs(Math.round(Number(E)||0)),b=Math.abs(Math.round(Number(F)||0));for(;b;){const L=p%b;p=b,b=L}return p||1}function Q(E){const F=Math.max(1,Kn(E?.w??0)),p=Math.max(1,Kn(E?.h??0)),b=S(F,p);return`${F/b}:${p/b}`}function X(E){const F=Number(E);if(!(F>0))return d.notAvailable;const p=["B","KB","MB","GB","TB"];let b=F,L=0;for(;b>=1024&&L<p.length-1;)b/=1024,L+=1;const q=b>=100||L===0?0:b>=10?1:2;return`${b.toFixed(q)} ${p[L]}`}function ue(E){const F=Number(E);return F>0?`${F.toFixed(2)} fps`:d.notAvailable}function oe(E,F){const p=Number(E),b=Number(F);if(!(p>0)||!(b>0))return d.notAvailable;const L=p*8/b;return L>=1e6?`${(L/1e6).toFixed(2)} Mbps`:L>=1e3?`${Math.round(L/1e3)} Kbps`:`${Math.round(L)} bps`}function ge(E){const F=String(E?.file?.type||E?.type||E?.mime||"").trim();if(F.includes("/"))return F.split("/").pop().toUpperCase();const p=String(E?.file?.name||E?.name||"").trim().match(/\.([a-z0-9]+)$/i);return p?p[1].toUpperCase():d.notAvailable}function Be(E){return String(E?.codec||E?.videoCodec||E?.codecName||E?.encoding||"").trim()||d.notAvailable}function Te(E){const F=Math.max(0,Math.round(Number(E?.width??E?.dims?.w)||0)),p=Math.max(0,Math.round(Number(E?.height??E?.dims?.h)||0));return!(F>0)||!(p>0)?d.notAvailable:`${F} x ${p} px`}function de(){const E=a.getState().clips??[],F=Br(n,"video").filter(b=>!!E[b]),p=(E[F[F.length-1]]??E[0]??null)?.srcIdx??0;return{source:(typeof a.getVideoSource=="function"?a.getVideoSource(p):null)??a.videoSources?.[p]??a.videoSources?.[0]??null,sourceIndex:p}}function Ae(){const E=a.getState(),{source:F,sourceIndex:p}=de(),b=E.canvas??{w:1080,h:1920},L=Ts(E),q=Number(F?.frameRate??F?.fps)||30,Ee=Number(F?.duration)||mt()||0,be=Number(F?.file?.size??F?.size)||0;return{videoName:String(F?.file?.name||F?.name||"").trim()||(F?`video-${p+1}`:d.notAvailable),ratio:Q(L),canvasSize:dl(b),resolution:dl(L),frameRate:ue(q),bitrate:oe(be,Ee),format:ge(F),fileSize:X(be),codec:Be(F),sourceSize:Te(F),videoLength:zi(mt())}}const ve=document.createElement("div");ve.className="me-video-text-panel me-video-color-panel me-video-effects-panel me-video-feature-one-panel",ve.hidden=!0,n.appendChild(ve);const j=document.createElement("div");j.className="me-video-text-toolbar";const k=document.createElement("strong");k.textContent=d.title;const H=Hr(s.reset);j.append(k,H);const T=document.createElement("p");T.className="me-video-text-hint",T.textContent=d.hint;const _=document.createElement("div");_.className="me-video-text-empty",_.textContent=d.placeholder;const le=document.createElement("div");le.className="me-video-text-panel me-video-feature-one-info-panel",le.hidden=!0,n.appendChild(le);const se=document.createElement("div");se.className="me-video-text-toolbar";const me=document.createElement("strong");me.textContent=d.videoInfoTitle,se.append(me);const P=ta(d.videoInfoTitle);P.section.classList.add("me-video-feature-one-meta-section"),P.title.remove();const $=[{key:"videoName",label:d.videoName},{key:"ratio",label:d.ratio},{key:"canvasSize",label:d.canvasSize},{key:"resolution",label:d.resolution},{key:"frameRate",label:d.frameRate},{key:"bitrate",label:d.bitrate},{key:"format",label:d.format},{key:"fileSize",label:d.fileSize},{key:"codec",label:d.codec},{key:"sourceSize",label:d.sourceSize},{key:"videoLength",label:d.videoLength}].map(E=>{const F=document.createElement("div");return F.className="me-video-feature-one-meta-value",P.body.appendChild(rr(E.label,F)),{...E,valueEl:F}});ve.append(j,T,_),le.append(se,P.section);const M=m.map(E=>{const F=ta(E.title),p=E.items.map(b=>{const L=g(b.format,b.min,b.max),q=document.createElement("div");q.className="me-video-color-slider-control me-video-color-number-control";const Ee=document.createElement("input");Ee.type="range",Ee.min=String(b.min),Ee.max=String(b.max),Ee.step="0.01",Ee.dataset.adjustment=b.key;const be=document.createElement("input");return be.type="number",be.min=String(L.min),be.max=String(L.max),be.step="1",be.inputMode="decimal",be.dataset.adjustment=b.key,q.append(Ee,be),F.body.appendChild(rr(b.label,q)),{...b,range:Ee,input:be,displayMin:L.min,displayMax:L.max}});return ve.appendChild(F.section),{...E,section:F.section,controls:p}});let A=null,ee=null,Me=null,_e=null,x=null,C=null,O=null,B=null,G=null,ze=null,J=null,te=!1,U=null,xe=!1,Ce=!1;const Ye="adjust",et=typeof requestAnimationFrame=="function"?requestAnimationFrame:E=>setTimeout(E,16),lt=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>Yt()),ot=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>Yt()),gt=[{key:"tl",x:0,y:0},{key:"tm",x:.5,y:0},{key:"tr",x:1,y:0},{key:"mr",x:1,y:.5},{key:"br",x:1,y:1},{key:"bm",x:.5,y:1},{key:"bl",x:0,y:1},{key:"ml",x:0,y:.5}],Jt={key:"rotate",x:.5,y:0};function _t(){Promise.resolve().then(()=>{Ce=!1;const E=n.__meVideoEnhancerObserverLock??0;n.__meVideoEnhancerObserverLock=Math.max(0,E-1)})}function xt(E){Ce=!0,n.__meVideoEnhancerObserverLock=(n.__meVideoEnhancerObserverLock??0)+1;try{return E()}finally{_t()}}function Yt(){xe||(xe=!0,et(()=>{xe=!1,en()}))}function tn(E=ee){return E?[...E.children].filter(F=>F instanceof HTMLButtonElement&&F!==A&&!F.classList.contains("me-video-text-tool")):[]}function _n(){_e&&(_e.isConnected&&(_e.style.display=_e.dataset.meTrimDisplay??"",_e.hidden=_e.dataset.meTrimHidden==="true",delete _e.dataset.meTrimDisplay,delete _e.dataset.meTrimHidden),_e=null)}function st(E){if(!E){_n();return}_e!==E&&(_n(),E.classList.remove("is-active"),E.dataset.meTrimDisplay=E.style.display??"",E.dataset.meTrimHidden=E.hidden?"true":"false",E.hidden=!0,E.style.display="none",_e=E)}function Ge(){if(Me&&!Me.classList.contains("is-active")){Me.click();return}const E=tn()[0];E&&!E.classList.contains("is-active")&&E.click()}function mt(){return ol(a)}function Rt(){return co(n)}function Vt(){if(!a.history?.present)return;const E=Rt(),F=Number(a.history.present.__mePreviewTimelineTime);Math.abs((Number.isFinite(F)?F:-1)-E)<.001||(a.history={...a.history,present:{...a.history.present,__mePreviewTimelineTime:E}},typeof a.emit=="function"&&a.emit())}function kn(E){const F={...cl};for(const p of kf){const b=Number(E?.[p]);Number.isFinite(b)&&(F[p]=h.has(p)?qe(b,-1,1):qe(b,0,1))}return F}function xn(E){const F=kn(E);return kf.some(p=>Math.abs(Number(F[p])||0)>1e-4)}function je(E){const F=kn(E),p=[],b=Rm(F,"");return b&&p.push(b),Math.abs(F.vibrance)>1e-4&&p.push(`saturate(${(1+F.vibrance*.65).toFixed(3)})`),Math.abs(F.temperature)>1e-4&&(F.temperature>0&&p.push(`sepia(${Math.min(.36,F.temperature*.28).toFixed(3)})`),p.push(`hue-rotate(${(-F.temperature*14).toFixed(2)}deg)`)),Math.abs(F.tint)>1e-4&&p.push(`hue-rotate(${(F.tint*10).toFixed(2)}deg)`),Math.abs(F.gamma)>1e-4&&p.push(`brightness(${(1+F.gamma*.08).toFixed(3)})`),(F.clarity>1e-4||F.sharpen>1e-4)&&p.push(`contrast(${(1+F.clarity*.16+F.sharpen*.1).toFixed(3)})`),p.join(" ").trim()||"none"}function dt(E){const F=kn(E),p=[];if(F.fade>1e-4&&p.push(`linear-gradient(0deg, rgba(255,245,235,${(F.fade*.18).toFixed(3)}), rgba(255,245,235,${(F.fade*.18).toFixed(3)}))`),F.vignette>1e-4){const b=(.28+F.vignette*.3).toFixed(3),L=(.16+F.vignette*.22).toFixed(3);p.push(`radial-gradient(circle at center, rgba(0,0,0,0) ${b}, rgba(0,0,0,${L}) 100%)`)}return F.grain>1e-4&&p.push(`linear-gradient(135deg, rgba(255,255,255,${(F.grain*.05).toFixed(3)}) 0%, rgba(0,0,0,${(F.grain*.05).toFixed(3)}) 100%)`),p.join(", ")}function yt(){const E=a.getState().overlays??[];if(U==null)return null;const F=E[U];return F?.type==="adjust"?F:null}function pt(E){if(!E.length){U=null;return}const F=gc(n,a.getState());U=F.length?F[F.length-1]:null}function Mt(E){const F=Number(E?.w),p=Number(E?.h);return!(F>0)||!(p>0)?null:{x:Number(E?.x)||0,y:Number(E?.y)||0,w:Math.max(48,F),h:Math.max(48,p)}}function dn(E,F){const p=Mt(E);if(!p)return E;const b=Math.max(.1,Number(F)||1);return{...E,w:Math.max(48,p.w*b),h:Math.max(48,p.h*b)}}function Ut(E,F,p={}){const b=(a.getState().overlays??[])[E];!b||b.type!=="adjust"||a.updateOverlay(E,ma(b,mt(),F),p)}function An(E,F){U!=null&&a.updateOverlay(U,E,F)}function K(E){const F=a.getState().overlays??[],p=F.length;if(typeof a.applyMut=="function")return a.applyMut(L=>({...L,overlays:[...za(L.overlays),{...E,timelineTrack:0}]})),p;const b=za(F);return a.commit?.({overlays:[...b,{...E,timelineTrack:0}]}),p}function Le(){const E=a.getState().canvas??{w:1080,h:1920};return{type:"adjust",x:0,y:0,w:Math.max(1,Number(E.w)||1080),h:Math.max(1,Number(E.h)||1920),rotation:0,...cl}}function Ze(){const E=mt();let F=qe(Rt(),0,Math.max(0,E-jt)),p=Math.min(E,F+Jr);p-F<jt&&(F=qe(E-Jr,0,Math.max(0,E-jt)),p=Math.max(F+jt,E));const b={...Le(),...ma(null,E,{startAt:F,endAt:p,timelineTrack:0})},L=K(b);U=Number.isInteger(L)?L:null,qn(n,"text",U==null?[]:[U],{preserveOther:!0}),Ge(),pn(U!=null)}function Tt(){const E=a.getState(),F=vf(E.overlays??[],gc(n,E));F.changed&&(a.commit({overlays:F.overlays}),U=F.selection.length?F.selection[F.selection.length-1]:null,qn(n,"text",F.selection),en())}function rn(){const E=a.getState(),F=gf(E.overlays??[],gc(n,E));F.changed&&(a.commit({overlays:F.overlays}),U=null,qn(n,"text",[]),en())}function Pt(){yt()&&An({...cl})}function nn(E){if(!A||!(E instanceof HTMLButtonElement))return;const F=E.getAttribute("style");F?A.setAttribute("style",F):A.removeAttribute("style"),A.hidden=!1,A.style.display=""}function wn(){A&&(A.dataset.theme=ks(o()))}function Y(){Da(n,ve),Da(n,le),br(n)}function fe(){const{timelineInner:E,timelineHost:F}=Ms(n,a.getState());if(!E||!F){C?.remove(),C=null,lt&&O&&(lt.unobserve(O),O=null),x=null;return}x=E,(!C||!C.isConnected||C.parentElement!==F)&&(C?.remove(),C=document.createElement("div"),C.className="me-video-text-timeline me-video-overlay-timeline me-video-feature-one-overlay-layer");for(const p of[...F.children])p!==C&&p instanceof HTMLElement&&p.classList.contains("me-video-feature-one-overlay-layer")&&p.remove();(C.parentElement!==F||F.lastElementChild!==C)&&F.appendChild(C),lt&&O!==x&&(O&<.unobserve(O),O=x,lt.observe(x))}function Ne(){const E=n.querySelector(".me-video-canvas-stage");if(!E){G?.remove(),G=null,ze?.remove(),ze=null,ot&&J&&(ot.unobserve(J),J=null),B=null;return}B=E,B.style.position="relative",(!G||!G.isConnected||G.parentElement!==B)&&(G?.remove(),G=document.createElement("div"),G.className="me-video-filter-effect-layer",B.appendChild(G)),(!ze||!ze.isConnected||ze.parentElement!==B)&&(ze?.remove(),ze=document.createElement("div"),ze.className="me-video-filter-control-layer",B.appendChild(ze)),B.lastElementChild!==ze&&B.appendChild(ze),ot&&J!==B&&(J&&ot.unobserve(J),J=B,ot.observe(B))}function Qe(){if(!B)return null;const E=a.getState().canvas??{},F=Math.max(1,Number(E.w)||0),p=Math.max(1,Number(E.h)||0);if(!F||!p)return null;const b=B.getBoundingClientRect(),L=B.querySelector("canvas, video, img")||[...B.children].find(ae=>ae!==G&&ae!==ze)||null;let q=0,Ee=0,be=B.clientWidth||F,Oe=B.clientHeight||p;if(L instanceof HTMLElement){const ae=L.getBoundingClientRect();ae.width>0&&ae.height>0&&(q=ae.left-b.left,Ee=ae.top-b.top,be=ae.width,Oe=ae.height)}if(!(be>0&&Oe>0)){const ae=B.clientWidth||F,ke=B.clientHeight||p,Ve=Math.min(ae/F,ke/p)||1;be=F*Ve,Oe=p*Ve,q=Math.max(0,(ae-be)/2),Ee=Math.max(0,(ke-Oe)/2)}return{stageLeft:b.left,stageTop:b.top,left:q,top:Ee,scaleX:be/F,scaleY:Oe/p}}function Et(E,F){const p=Cn(E),b=Tr(E,p);return F>=p-.001&&F<=b+.001}function z(E,F,p){const b=gr(n,"text",E,F,p);U=b.length?b[b.length-1]:null,pn(!0),en()}function V(E,F,p){return{x:(E-p.stageLeft-p.left)/p.scaleX,y:(F-p.stageTop-p.top)/p.scaleY}}function Fe(E,F,p){const b=(a.getState().overlays??[])[E];if(!b||b.type!=="adjust")return;const L=a.getState().canvas??{w:1080,h:1920},q=Mt(b);if(!q)return;const Ee=F.clientX,be=F.clientY,Oe=Math.max(0,(Number(L.w)||0)-q.w),ae=Math.max(0,(Number(L.h)||0)-q.h),ke=(ft,nt,it)=>{const ht=(ft-Ee)/p.scaleX,wt=(nt-be)/p.scaleY,Bt=qe(q.x+ht,0,Oe),Ot=qe(q.y+wt,0,ae);a.updateOverlay(E,{x:Bt,y:Ot},it?{transient:!0}:void 0)},Ve=ft=>{ft.preventDefault(),ke(ft.clientX,ft.clientY,!0)},We=ft=>{window.removeEventListener("pointermove",Ve),window.removeEventListener("pointerup",We),window.removeEventListener("pointercancel",We),ke(ft.clientX,ft.clientY,!1)};window.addEventListener("pointermove",Ve),window.addEventListener("pointerup",We),window.addEventListener("pointercancel",We)}function He(E,F,p,b){const L=(a.getState().overlays??[])[E];if(!L||L.type!=="adjust")return;const q=Mt(L);if(!q)return;const Ee=a.getState().canvas??{w:1080,h:1920},be=F.x===.5?.5:1-F.x,Oe=F.y===.5?.5:1-F.y,ae=q.x+q.w*be,ke=q.y+q.h*Oe,Ve=Math.max(.1,48/Math.max(48,q.w),48/Math.max(48,q.h)),We=F.x===.5?1/0:Math.max(.1,(be===0?(Number(Ee.w)||0)-ae:ae)/Math.max(1,q.w)),ft=F.y===.5?1/0:Math.max(.1,(Oe===0?(Number(Ee.h)||0)-ke:ke)/Math.max(1,q.h)),nt=Math.max(Ve,Math.min(We,ft,8)),it=(Bt,Ot,on)=>{const Rn=V(Bt,Ot,b),cr=[];F.x!==.5&&cr.push(Math.abs(Rn.x-ae)/Math.max(1,q.w)),F.y!==.5&&cr.push(Math.abs(Rn.y-ke)/Math.max(1,q.h));const Mr=cr.length?Math.max(...cr):1,ar=qe(Mr,Ve,nt),N=dn(L,ar),I=Mt(N);if(!I)return;const we=ae-I.w*be,tt=ke-I.h*Oe;a.updateOverlay(E,{x:we,y:tt,w:I.w,h:I.h},on?{transient:!0}:void 0)},ht=Bt=>{Bt.preventDefault(),it(Bt.clientX,Bt.clientY,!0)},wt=Bt=>{window.removeEventListener("pointermove",ht),window.removeEventListener("pointerup",wt),window.removeEventListener("pointercancel",wt),it(Bt.clientX,Bt.clientY,!1)};window.addEventListener("pointermove",ht),window.addEventListener("pointerup",wt),window.addEventListener("pointercancel",wt)}function Xe(E,F,p){const b=(a.getState().overlays??[])[E];if(!b||b.type!=="adjust")return;const L=Mt(b);if(!L)return;const q=p.stageLeft+p.left+(L.x+L.w/2)*p.scaleX,Ee=p.stageTop+p.top+(L.y+L.h/2)*p.scaleY,be=Math.atan2(F.clientY-Ee,F.clientX-q),Oe=da(b),ae=(We,ft,nt,it)=>{const ht=Math.atan2(ft-Ee,We-q);let wt=Es(Oe+(ht-be)*180/Math.PI);it&&(wt=Math.round(wt/15)*15),a.updateOverlay(E,{rotation:wt},nt?{transient:!0}:void 0)},ke=We=>{We.preventDefault(),ae(We.clientX,We.clientY,!0,We.shiftKey)},Ve=We=>{window.removeEventListener("pointermove",ke),window.removeEventListener("pointerup",Ve),window.removeEventListener("pointercancel",Ve),ae(We.clientX,We.clientY,!1,We.shiftKey)};window.addEventListener("pointermove",ke),window.addEventListener("pointerup",Ve),window.addEventListener("pointercancel",Ve)}function ct(E,F){if(Ne(),!G||!ze)return;if(G.replaceChildren(),ze.replaceChildren(),!Qe()){G.hidden=!0,ze.hidden=!0;return}ze.hidden=!0;const p=Rt();if(!E.filter(b=>Et(b.overlay,p)).length){G.hidden=!0;return}G.hidden=!0}function kt(E,F,p){if(!x)return;const b=(a.getState().overlays??[])[E];if(!b||b.type!=="adjust")return;if(p.shiftKey||p.ctrlKey||p.metaKey){p.preventDefault(),p.stopPropagation();const ft=gr(n,"text",E,p,zg(a.getState()).map(nt=>nt.index));U=ft.length?ft[ft.length-1]:null,Ge(),pn(!0);return}p.preventDefault(),p.stopPropagation(),U=E,qn(n,"text",[E]),Ge(),te||pn(!0);const L=mt(),q=Math.max(x.clientWidth/L,.001),Ee=Cn(b),be=Tr(b,Ee),Oe=Math.max(jt,be-Ee),ae=$n(b),ke=p.clientX,Ve=ft=>{const nt=(ft.clientX-ke)/q,it=a.getState().overlays??[];if(F==="move"){const Bt=Math.max(0,Ee+nt),Ot=Bt+Oe,on=Nn(C,it,E,Bt,Ot,ft.clientY,ae);Ut(E,{startAt:Bt,endAt:Ot,timelineTrack:on},{transient:!0});return}if(F==="start"){const Bt=qe(Ee+nt,0,be-jt),Ot=Nn(C,it,E,Bt,be,ft.clientY,ae);Ut(E,{startAt:Bt,endAt:be,timelineTrack:Ot},{transient:!0});return}const ht=Math.max(Ee+jt,be+nt),wt=Nn(C,it,E,Ee,ht,ft.clientY,ae);Ut(E,{startAt:Ee,endAt:ht,timelineTrack:wt},{transient:!0})},We=ft=>{window.removeEventListener("pointermove",Ve),window.removeEventListener("pointerup",We),window.removeEventListener("pointercancel",We);const nt=(ft.clientX-ke)/q,it=a.getState().overlays??[];if(F==="move"){const Bt=Math.max(0,Ee+nt),Ot=Bt+Oe,on=Nn(C,it,E,Bt,Ot,ft.clientY,ae);Ut(E,{startAt:Bt,endAt:Ot,timelineTrack:on});return}if(F==="start"){const Bt=qe(Ee+nt,0,be-jt),Ot=Nn(C,it,E,Bt,be,ft.clientY,ae);Ut(E,{startAt:Bt,endAt:be,timelineTrack:Ot});return}const ht=Math.max(Ee+jt,be+nt),wt=Nn(C,it,E,Ee,ht,ft.clientY,ae);Ut(E,{startAt:Ee,endAt:ht,timelineTrack:wt})};window.addEventListener("pointermove",Ve),window.addEventListener("pointerup",We),window.addEventListener("pointercancel",We),en()}function rt(E,F){if(fe(),!C||!x||(C.replaceChildren(),C.hidden=E.length===0,!E.length))return;const p=mt(),b=x.clientWidth/p,L=Ss(a.getState()),q=new Map;for(const Ee of E){const be=$n(Ee.overlay),Oe=L.get(be)??be;let ae=q.get(be);ae||(ae=document.createElement("div"),ae.className="me-video-overlay-track-row",ae.dataset.track=String(be),ae.style.top=`${il(Oe)}px`,q.set(be,ae),C.appendChild(ae));const ke=document.createElement("div");ke.className="me-video-text-track-clip me-video-filter-track-clip",F.has(Ee.index)&&ke.classList.add("is-active");const Ve=Cn(Ee.overlay),We=al(Ee.overlay);ke.style.left=`${Ve*b}px`,ke.style.width=`${Math.max(36,We*b)}px`;const ft=document.createElement("span");ft.className="me-video-text-track-icon",ft.textContent="Adj";const nt=document.createElement("span");nt.className="me-video-text-track-label",nt.textContent=d.tool,nt.title=nt.textContent;const it=document.createElement("span");it.className="me-video-text-track-handle is-start";const ht=document.createElement("span");ht.className="me-video-text-track-handle is-end",ke.append(ft,nt,it,ht),ke.addEventListener("pointerdown",wt=>kt(Ee.index,"move",wt)),it.addEventListener("pointerdown",wt=>kt(Ee.index,"start",wt)),ht.addEventListener("pointerdown",wt=>kt(Ee.index,"end",wt)),ke.addEventListener("click",wt=>{if(wt.preventDefault(),wt.stopPropagation(),wt.shiftKey||wt.ctrlKey||wt.metaKey){Ge(),en();return}const Bt=gr(n,"text",Ee.index,wt,E.map(Ot=>Ot.index));U=Bt.length?Bt[Bt.length-1]:null,Ge(),pn(!0),en()}),ae.appendChild(ke)}}function at(E){M.forEach(F=>{F.controls.forEach(p=>{p.range.disabled=E,p.input.disabled=E})}),H.disabled=E}function Ke(){const E=Ae();$.forEach(F=>{const p=String(E[F.key]??d.notAvailable);F.valueEl.textContent=p,F.valueEl.title=p})}function Nt(E){const F=!!E;if(at(!F),H.hidden=!F,_.hidden=F,M.forEach(b=>{b.section.hidden=!F}),Ke(),!F)return;const p=kn(E);M.forEach(b=>{b.controls.forEach(L=>{const q=qe(Number(p[L.key])||0,L.min,L.max);L.range.value=String(q),L.input.value=W(q,L.format)})}),F&&(H.disabled=!xn(E))}function Wt(){return te&&!!yt()}function Ct(){return tn().some(E=>E!==Me&&!E.hidden&&E.style.display!=="none"&&E.classList.contains("is-active"))?!0:[...n.querySelectorAll(".me-video-toolrail .me-video-text-tool.is-active")].some(E=>E!==A)}function bt(){const E=Mc(n);return E instanceof HTMLElement?[...E.children].some(F=>F instanceof HTMLElement&&F!==ve&&F!==le&&!F.hidden):!1}function $t(){return te&&!!yt()&&!Ct()}function un(){const E=ll(n,a.getState().audioClips??[]).length>0;return!Ct()&&!bt()&&!E&&!yt()}function pn(E){const F=!!E;if(F===te){en();return}te=F,te&&n.dispatchEvent(new CustomEvent("me-video-inspector-open",{detail:{id:Ye}})),en()}function Lt(){te=!1,U=null,n.dispatchEvent(new CustomEvent("me-video-inspector-open",{detail:{id:"video-info"}})),ve.hidden=!0,Ke(),le.hidden=!1,fn(),Y()}function Zt(){ve.hidden=!$t(),le.hidden=!un(),fn(),Y()}function en(){xt(()=>{Ct()&&(te=!1),te&&Ge(),Tn();const E=zg(a.getState());pt(E);const F=new Set(gc(n,a.getState()));rt(E,F),ct(E,F),Nt(yt()),Zt(),wn()}),Vt()}function Tn(){xt(()=>{const E=n.querySelector(".me-video-toolrail");if(!E)return;ee=E;const F=tn(ee);Me=Ec(F),st(Me);const p=Me??F[0]??null;(!A||!A.isConnected)&&(A=document.createElement("button"),A.type="button",A.className="me-video-text-tool me-video-feature-one-tool",A.innerHTML=`<span class="me-video-text-tool-icon">${_w()}</span><span class="me-video-text-tool-label">${d.tool}</span>`,A.addEventListener("click",()=>{Ze()})),A.setAttribute("title",d.tool),A.setAttribute("aria-label",d.tool),nn(p),A.isConnected?p?.parentElement===ee&&A.nextSibling!==p&&ee.insertBefore(A,p):p?.parentElement===ee?ee.insertBefore(A,p):ee.appendChild(A),wn(),A.classList.toggle("is-active",Wt()),fn(),Y()})}function fn(){if(A?.classList.toggle("is-active",Wt()),!!Me){if(Wt()){Me.classList.remove("is-active");return}Me.classList.remove("is-active")}}function Dn(E){return!!E&&(E===ve||ve.contains(E)||E===le||le.contains(E)||E===A||A?.contains?.(E)||E===C||C?.contains?.(E)||E===G||G?.contains?.(E)||E===ze||ze?.contains?.(E))}function zr(E){return E.some(F=>{if(!Dn(F.target))return!0;for(const p of F.addedNodes)if(!Dn(p))return!0;for(const p of F.removedNodes)if(!Dn(p))return!0;return!1})}const Hn=new MutationObserver(E=>{Ce||n.__meVideoEnhancerObserverLock||zr(E)&&(Tn(),Yt())}),ur=E=>{E?.detail?.id===Ye||E?.detail?.id==="video-info"||(te=!1,ve.hidden=!0,le.hidden=!0,fn(),Y(),Yt())},Yn=E=>{const F=E.target;F instanceof Element&&F.closest(".me-video-toolrail button")&&Yt()},Fr=()=>{if(!ff(n)){Lt();return}en()};Hn.observe(n,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","hidden"]}),n.addEventListener("me-video-inspector-open",ur),n.addEventListener("click",Yn,!0),n.addEventListener(fr,Fr),window.addEventListener("resize",Y);const D=a.subscribe(()=>{en()});function ie(E){const F=Number(E.input.value);if(!Number.isFinite(F))return null;const p=qe(F,E.displayMin,E.displayMax),b=qe(w(p,E.format),E.min,E.max);return{displayValue:p,internalValue:b}}function Pe(E){const F=Number(E.range.value);if(!Number.isFinite(F))return null;const p=qe(F,E.min,E.max);return{internalValue:p,displayValue:qe(v(p,E.format),E.displayMin,E.displayMax)}}return M.forEach(E=>{E.controls.forEach(F=>{F.range.addEventListener("input",()=>{const p=Pe(F);p&&(F.input.value=W(p.internalValue,F.format),An({[F.key]:p.internalValue},{transient:!0}))}),F.range.addEventListener("change",()=>{const p=Pe(F);if(!p){en();return}F.input.value=W(p.internalValue,F.format),An({[F.key]:p.internalValue})}),F.input.addEventListener("input",()=>{const p=ie(F);p&&(F.range.value=String(p.internalValue),An({[F.key]:p.internalValue},{transient:!0}))}),F.input.addEventListener("change",()=>{const p=ie(F);if(!p){en();return}F.range.value=String(p.internalValue),F.input.value=W(p.internalValue,F.format),An({[F.key]:p.internalValue})}),F.input.addEventListener("blur",()=>{const p=ie(F);if(!p){en();return}F.range.value=String(p.internalValue),F.input.value=W(p.internalValue,F.format)})})}),H.addEventListener("click",()=>{Pt()}),Tn(),en(),{destroy(){Hn.disconnect(),D(),lt&&O&<.unobserve(O),ot&&J&&ot.unobserve(J),n.removeEventListener("me-video-inspector-open",ur),n.removeEventListener("click",Yn,!0),n.removeEventListener(fr,Fr),window.removeEventListener("resize",Y),_n(),A?.remove(),C?.remove(),G?.remove(),ze?.remove(),ve.remove(),le.remove(),br(n)}}}function V5(n,a,o){wa();const l=m5(o()),s=F5(),d=L5(s),m=document.createElement("div");m.className="me-video-text-panel me-video-ratio-panel",m.hidden=!0,n.appendChild(m);const h=document.createElement("div");h.className="me-video-text-toolbar";const g=document.createElement("strong");g.textContent=l.title,h.append(g);const v=ta(l.commonPresets),w=document.createElement("div");w.className="me-video-ratio-card-grid",v.body.appendChild(w);const W=ta(l.customSize),S=document.createElement("input");S.type="number",S.min="2",S.step="2",S.className="me-video-text-input";const Q=document.createElement("input");Q.type="number",Q.min="2",Q.step="2",Q.className="me-video-text-input";const X=bc(l.width,S),ue=bc(l.height,Q),oe=document.createElement("div");oe.className="me-video-ratio-dimension-grid";const ge=document.createElement("div");ge.className="me-video-ratio-cross",ge.textContent="x",oe.append(X,ge,ue);const Be=document.createElement("div");Be.className="me-video-ratio-lock-row";const Te=document.createElement("button");Te.type="button",Te.className="me-video-ratio-lock-toggle me-video-ratio-lock-inline";const de=document.createElement("button");de.type="button",de.className="me-video-ratio-quick",de.textContent=l.quickPortrait;const Ae=document.createElement("button");Ae.type="button",Ae.className="me-video-ratio-quick",Ae.textContent=l.quickLandscape,W.title.appendChild(Te),Be.append(de,Ae);const ve=document.createElement("p");ve.className="me-video-ratio-summary",W.body.append(oe,Be,ve);const j=ta(l.fitMode),k=document.createElement("div");k.className="me-video-ratio-fit-group";const H=[{fit:"cover",label:l.cover},{fit:"contain",label:l.contain},{fit:"force",label:l.force}].map(je=>{const dt=document.createElement("button");return dt.type="button",dt.className="me-video-ratio-fit-button",dt.dataset.fit=je.fit,dt.textContent=je.label,k.appendChild(dt),{fit:je.fit,button:dt}}),T=document.createElement("p");T.className="me-video-ratio-note",j.body.append(k,T),m.append(h,W.section,j.section,v.section);let _=null,le=null,se=null,me=null,P=null,$=!1,M=!0,A=!1,ee=!1;const Me="resize",_e=kc("9:16"),x=kc("16:9"),C=typeof requestAnimationFrame=="function"?requestAnimationFrame:je=>setTimeout(je,16);function O(){Promise.resolve().then(()=>{ee=!1;const je=n.__meVideoEnhancerObserverLock??0;n.__meVideoEnhancerObserverLock=Math.max(0,je-1)})}function B(je){ee=!0,n.__meVideoEnhancerObserverLock=(n.__meVideoEnhancerObserverLock??0)+1;try{return je()}finally{O()}}function G(){A||(A=!0,C(()=>{A=!1,Ge()}))}function ze(je=le){return je?[...je.children].filter(dt=>dt instanceof HTMLButtonElement&&dt!==_&&!dt.classList.contains("me-video-text-tool")):[]}function J(je){return[je?.textContent,je?.getAttribute?.("title"),je?.getAttribute?.("aria-label")].filter(Boolean).join(" ").trim().toLowerCase()}function te(je){const dt=["trim","timeline","\u526A\u8F91","\u65F6\u95F4\u8F74"];return Sf(je.find(yt=>{const pt=J(yt);return dt.some(Mt=>pt.includes(Mt))})??je[0]??null)}function U(){if(me&&$){me.classList.remove("is-active");return}}function xe(je){const dt=[l.tool,l.title,"ratio","resize","\u6BD4\u4F8B","\u756B\u5E03","\u753B\u5E03"].map(yt=>String(yt??"").trim().toLowerCase()).filter(Boolean);return je.find(yt=>{const pt=J(yt);return dt.some(Mt=>pt.includes(Mt))})??je[je.length-1]??null}function Ce(){P&&(P.isConnected&&(P.style.display=P.dataset.meResizeDisplay??"",P.hidden=P.dataset.meResizeHidden==="true",delete P.dataset.meResizeDisplay,delete P.dataset.meResizeHidden),P=null)}function Ye(je){if(!je){Ce();return}P!==je&&(Ce(),je.dataset.meResizeDisplay=je.style.display??"",je.dataset.meResizeHidden=je.hidden?"true":"false",je.hidden=!0,je.style.display="none",P=je)}function et(){me&&(me.classList.contains("is-active")||me.click())}function lt(){Da(n,m),br(n)}function ot(je){const dt=!!je;if(dt===$){Ge();return}$=dt,$&&n.dispatchEvent(new CustomEvent("me-video-inspector-open",{detail:{id:Me}})),Ge()}function gt(){const je=n.querySelector(".me-video-toolrail");if(!je)return;le=je;const dt=ze(le);me=te(dt),se=xe(dt),Ye(se),(!_||!_.isConnected)&&(_=document.createElement("button"),_.type="button",_.className="me-video-text-tool me-video-ratio-tool",_.innerHTML=`<span class="me-video-text-tool-icon">\u2922</span><span class="me-video-text-tool-label">${l.tool}</span>`,_.title=l.tool,_.setAttribute("aria-label",l.tool),_.addEventListener("click",()=>{const yt=!$;yt&&(et(),G()),ot(yt)})),_.isConnected?se?.parentElement===le&&_.nextSibling!==se&&le.insertBefore(_,se):se?.parentElement===le?le.insertBefore(_,se):le.appendChild(_),_.classList.toggle("is-active",$),U(),lt()}function Jt(){m.hidden=!$,_?.classList.toggle("is-active",$),U(),lt()}function _t(je=a.getState()){return Ff(je?.scale?.fit)}function xt(){Te.textContent=M?"\u{1F512}":"\u{1F513}",Te.title=M?l.lockRatio:l.unlockRatio,Te.setAttribute("aria-label",Te.title),Te.classList.toggle("is-active",M)}function Yt(je,dt,yt=_t(),pt=!1){const Mt={width:Oi(je,2),height:Oi(dt,2),fit:Ff(yt)};if(pt){a.patch({scale:Mt},{transient:!0});return}a.commit({scale:Mt})}function tn(je){const dt=Ts(a.getState()),yt=Oi(je,dt.w);if(!M)return{width:yt,height:Oi(Q.value,dt.h)};const pt=dt.w>0&&dt.h>0?dt.w/dt.h:1;return{width:yt,height:Oi(yt/pt,dt.h)}}function _n(je){const dt=Ts(a.getState()),yt=Oi(je,dt.h);if(!M)return{width:Oi(S.value,dt.w),height:yt};const pt=dt.w>0&&dt.h>0?dt.w/dt.h:1;return{width:Oi(yt*pt,dt.w),height:yt}}function st(je){const dt=A5(d,je);w.replaceChildren();for(const yt of d){const pt=document.createElement("button");pt.type="button",pt.className="me-video-ratio-preset-group",pt.title=`${yt.ratio} (${dl(yt)})`,dt&&dt.ratio===yt.ratio&&pt.classList.add("is-active");const Mt=document.createElement("div");Mt.className="me-video-ratio-preset-head";const dn=document.createElement("div");dn.className="me-video-ratio-preset-title";const Ut=document.createElement("strong");Ut.className="me-video-ratio-preset-ratio",Ut.textContent=yt.ratio;const An=document.createElement("span");An.className="me-video-ratio-preset-size",An.textContent=`(${dl(yt)})`,dn.append(Ut,An);const K=document.createElement("span");K.className="me-video-ratio-preset-marker",K.setAttribute("aria-hidden","true"),Mt.append(dn,K);const Le=document.createElement("p");Le.className="me-video-ratio-preset-hint",Le.textContent=yt.hint,pt.addEventListener("click",()=>{Yt(yt.w,yt.h,_t())}),pt.append(Mt,Le),w.appendChild(pt)}}function Ge(){B(()=>{gt();const je=a.getState(),dt=ze().find(dn=>dn.classList.contains("is-active"))??null;$&&dt&&dt!==me&&(et(),G());const yt=Ts(je),pt=Jg(je),Mt=_t(je);S.value=String(yt.w),Q.value=String(yt.h),xt(),ve.innerHTML=`<strong>${l.summary}:</strong> ${dl(yt)}${je.scale?` | ${l.baseOutput}: ${dl(pt)}`:""}`,T.textContent=N5(l,Mt),H.forEach(dn=>{dn.button.classList.toggle("is-active",dn.fit===Mt)}),st(yt),Jt()})}function mt(je){return!!je&&(je===m||m.contains(je))}function Rt(je){return je.some(dt=>{if(!mt(dt.target))return!0;for(const yt of dt.addedNodes)if(!mt(yt))return!0;for(const yt of dt.removedNodes)if(!mt(yt))return!0;return!1})}const Vt=new MutationObserver(je=>{ee||n.__meVideoEnhancerObserverLock||Rt(je)&&(B(()=>{gt()}),G())}),kn=je=>{je?.detail?.id!==Me&&($&&($=!1,Jt()),G())};Vt.observe(n,{childList:!0,subtree:!0}),n.addEventListener("me-video-inspector-open",kn),window.addEventListener("resize",G);const xn=a.subscribe(()=>{G()});return S.addEventListener("input",()=>{const je=tn(S.value);Yt(je.width,je.height,_t(),!0)}),S.addEventListener("change",()=>{const je=tn(S.value);Yt(je.width,je.height,_t())}),Q.addEventListener("input",()=>{const je=_n(Q.value);Yt(je.width,je.height,_t(),!0)}),Q.addEventListener("change",()=>{const je=_n(Q.value);Yt(je.width,je.height,_t())}),Te.addEventListener("click",()=>{M=!M,Ge()}),de.addEventListener("click",()=>{Yt(_e.w,_e.h,_t())}),Ae.addEventListener("click",()=>{Yt(x.w,x.h,_t())}),H.forEach(je=>{je.button.addEventListener("click",()=>{const dt=Ts(a.getState());Yt(dt.w,dt.h,je.fit)})}),gt(),Ge(),{destroy(){Vt.disconnect(),xn(),n.removeEventListener("me-video-inspector-open",kn),window.removeEventListener("resize",G),Ce(),_?.remove(),m.remove(),br(n)}}}function W5(n,a,o,l){wa(),nl();const s=kg(l()),d=s.transitions,m=document.createElement("div");m.className="me-video-text-panel me-video-transition-panel",m.hidden=!0,n.appendChild(m);const h=document.createElement("div");h.className="me-video-text-toolbar";const g=document.createElement("strong");g.textContent=d.title;const v=Hr(d.fadeAll),w=Hr(d.close);h.append(g,v,w);const W=document.createElement("p");W.className="me-video-text-hint",W.textContent=d.hint;const S=document.createElement("div");S.className="me-video-text-list";const Q=document.createElement("div");Q.className="me-video-text-empty",Q.textContent=d.empty;const X=document.createElement("div");X.className="me-video-transition-selection";const ue=document.createElement("div");ue.className="me-video-transition-grid";const oe=nf.map(st=>{const Ge=rl(s,st.key),mt=document.createElement("button");return mt.type="button",mt.className="me-video-transition-choice",mt.dataset.transition=st.key,mt.innerHTML=`<strong>${Ge.label}</strong><span>${st.key==="none"?d.instantCut:`${d.duration} ${zi(st.duration)}`}</span>`,ue.appendChild(mt),mt}),ge=document.createElement("input");ge.type="range",ge.min="0.1",ge.max="1.2",ge.step="0.05";const Be=document.createElement("div");Be.className="me-video-text-inline";const Te=document.createElement("span");Be.append(ge,Te);const de=bc(d.duration,Be);de.classList.add("is-span-2");const Ae=document.createElement("div");Ae.className="me-video-transition-actions";const ve=Hr(d.clearSelected),j=i5(d.clearAll,"clear");j.classList.add("me-video-text-cta"),Ae.append(j,ve),m.append(h,W,S,Q,X,ue,de,Ae);let k=null,H=null,T=null,_=null,le=null,se=!1,me=0,P=!1,$=!1;const M="transition",A=typeof requestAnimationFrame=="function"?requestAnimationFrame:st=>setTimeout(st,16),ee=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>x());function Me(){Promise.resolve().then(()=>{$=!1;const st=n.__meVideoEnhancerObserverLock??0;n.__meVideoEnhancerObserverLock=Math.max(0,st-1)})}function _e(st){$=!0,n.__meVideoEnhancerObserverLock=(n.__meVideoEnhancerObserverLock??0)+1;try{return st()}finally{Me()}}function x(){P||(P=!0,A(()=>{P=!1,gt()}))}function C(st){const Ge=!!st;if(Ge===se){gt();return}se=Ge,se&&n.dispatchEvent(new CustomEvent("me-video-inspector-open",{detail:{id:M}})),gt()}function O(){return H?[...H.querySelectorAll("button")].filter(st=>st!==k):[]}function B(){O()[0]?.click()}function G(){k&&(k.dataset.theme=ks(o()))}function ze(){Da(n,m),br(n)}function J(){m.hidden=!se,k&&k.classList.toggle("is-active",se),ze()}function te(st){const Ge=Math.max(0,(st.clips??[]).length-1);if(!Ge){me=0;return}me=qe(me,0,Ge-1)}function U(st,Ge=!1){if(Ge){a.patch({transitions:st},{transient:!0});return}a.commit({transitions:st})}function xe(st,Ge=!1){const mt=a.getState(),Rt=lf(mt),Vt=mt.clips??[];te(mt),!(!Rt.length||!Vt[me]||!Vt[me+1])&&(Rt[me]=fc({...Rt[me],...st},_r(Vt[me]),_r(Vt[me+1])),U(Rt,Ge))}function Ce(st){const Ge=a.getState(),mt=lf(Ge),Rt=Ge.clips??[];if(te(Ge),!mt.length||!Rt[me]||!Rt[me+1])return;const Vt=rl(s,st);mt[me]=fc({type:st,duration:st==="none"?0:mt[me]?.duration||Vt.duration},_r(Rt[me]),_r(Rt[me+1])),U(mt)}function Ye(st){const Ge=a.getState().clips??[];if(Ge.length<2)return;const mt=rl(s,st),Rt=[];for(let Vt=0;Vt<Ge.length-1;Vt++)Rt.push(fc({type:st,duration:st==="none"?0:mt.duration},_r(Ge[Vt]),_r(Ge[Vt+1])));U(Rt)}function et(){const st=Fs(n);if(!st){_?.remove(),_=null,ee&&le&&(ee.unobserve(le),le=null),T=null;return}T=st,T.style.position="relative",(!_||!_.isConnected||_.parentElement!==T)&&(_?.remove(),_=document.createElement("div"),_.className="me-video-transition-track",T.appendChild(_)),ee&&le!==T&&(le&&ee.unobserve(le),le=T,ee.observe(T))}function lt(st,Ge){S.replaceChildren();const mt=Math.max(0,(st.clips??[]).length-1);for(let Rt=0;Rt<mt;Rt++){const Vt=document.createElement("button");Vt.type="button",Vt.className="me-video-text-chip",Rt===me&&Vt.classList.add("is-active");const kn=Ge[Rt],xn=rl(s,kn?.type??"none");Vt.textContent=d.boundary(Rt+1,Rt+2,xn.short),Vt.title=d.boundaryTitle(Rt+1,Rt+2),Vt.addEventListener("click",()=>{me=Rt,B(),C(!0)}),S.appendChild(Vt)}}function ot(st,Ge){if(et(),!_||!T)return;_.replaceChildren();const mt=st.clips??[];if(mt.length<2)return;const Rt=Math.max(typeof a.contentDuration=="function"?a.contentDuration():0,.001),Vt=T.clientWidth/Rt;let kn=0;for(let xn=0;xn<mt.length-1;xn++){kn+=_r(mt[xn]);const je=Ge[xn],dt=rl(s,je?.type??"none"),yt=je?.type==="none",pt=document.createElement("button");pt.type="button",pt.className="me-video-transition-marker",yt&&pt.classList.add("is-cut-only"),je?.type!=="none"&&pt.classList.add("is-enabled"),xn===me&&pt.classList.add("is-active"),pt.style.left=`${kn*Vt}px`,pt.title=d.markerTitle(xn+1,xn+2,dt.label,je?.type!=="none"?zi(je.duration):"");const Mt=document.createElement("span");Mt.className="me-video-transition-pill",Mt.textContent=yt?"":dt.short,pt.appendChild(Mt),pt.addEventListener("click",()=>{me=xn,B(),C(!0)}),_.appendChild(pt)}}function gt(){_e(()=>{const st=a.getState(),Ge=lf(st);te(st),lt(st,Ge),ot(st,Ge);const mt=Ge[me]??null,Rt=rl(s,mt?.type??"none");Q.hidden=Ge.length>0,X.textContent=mt?d.selection(me+1,me+2):d.selectionEmpty,ge.disabled=!mt||Rt.key==="none",ve.disabled=!mt,j.disabled=Ge.length===0,v.disabled=Ge.length===0,ge.value=String(mt&&Rt.key!=="none"?mt.duration:of("fade").duration),Te.textContent=mt&&Rt.key!=="none"?zi(mt.duration):d.cut,oe.forEach(Vt=>{const kn=!!mt&&Vt.dataset.transition===Rt.key;Vt.classList.toggle("is-active",kn),Vt.disabled=!mt}),J(),ze(),G()})}function Jt(){_e(()=>{const st=n.querySelector(".me-video-toolrail");st&&(H=st,(!k||!k.isConnected)&&(k=document.createElement("button"),k.type="button",k.className="me-video-text-tool",k.innerHTML=`<span class="me-video-text-tool-icon">Fx</span><span class="me-video-text-tool-label">${d.tool}</span>`,k.addEventListener("click",()=>{const Ge=!se;Ge&&B(),C(Ge)})),k.isConnected||H.appendChild(k),G(),ze())})}function _t(st){return!!st&&(st===m||m.contains(st)||st===k||st===_||_?.contains(st))}function xt(st){return st.some(Ge=>{if(!_t(Ge.target))return!0;for(const mt of Ge.addedNodes)if(!_t(mt))return!0;for(const mt of Ge.removedNodes)if(!_t(mt))return!0;return!1})}const Yt=new MutationObserver(st=>{$||n.__meVideoEnhancerObserverLock||xt(st)&&(Jt(),x())}),tn=st=>{st?.detail?.id!==M&&se&&(se=!1,gt())};Yt.observe(n,{childList:!0,subtree:!0}),n.addEventListener("me-video-inspector-open",tn),window.addEventListener("resize",x);const _n=a.subscribe(()=>{x()});return oe.forEach(st=>{st.addEventListener("click",()=>{Ce(st.dataset.transition??"none")})}),ge.addEventListener("input",()=>{Te.textContent=zi(ge.value),xe({duration:Number(ge.value)||.4},!0)}),ge.addEventListener("change",()=>{xe({duration:Number(ge.value)||.4})}),v.addEventListener("click",()=>Ye("fade")),ve.addEventListener("click",()=>Ce("none")),j.addEventListener("click",()=>Ye("none")),w.addEventListener("click",()=>{C(!1)}),Jt(),gt(),{destroy(){Yt.disconnect(),_n(),ee?.disconnect(),n.removeEventListener("me-video-inspector-open",tn),window.removeEventListener("resize",x),k?.remove(),_?.remove(),m.remove(),br(n)}}}function q5(n,a,o){wa();const l=f5(o()),s=typeof requestAnimationFrame=="function"?requestAnimationFrame:p=>setTimeout(p,16),d=document.createElement("div");d.className="me-video-text-panel me-video-add-panel",d.hidden=!0,n.appendChild(d);const m=document.createElement("div");m.className="me-video-text-toolbar";const h=document.createElement("strong");h.textContent=l.title;const g=Hr(l.reset);m.append(h,g);const v=document.createElement("p");v.className="me-video-text-hint",v.textContent=l.hint;const w=document.createElement("div");w.className="me-video-add-body";const W=document.createElement("section");W.className="me-video-add-section";const S=document.createElement("div");S.className="me-video-add-section-head";const Q=document.createElement("span");Q.className="me-video-add-section-title",Q.textContent=l.tools,S.appendChild(Q);const X=document.createElement("div");X.className="me-video-add-tool-grid";const ue=document.createElement("section");ue.className="me-video-add-section";const oe=document.createElement("div");oe.className="me-video-add-section-head";const ge=document.createElement("span");ge.className="me-video-add-section-title",ge.textContent=l.color,oe.appendChild(ge);const Be=document.createElement("div");Be.className="me-video-add-color-grid";const Te=document.createElement("div");Te.className="me-video-add-custom-color";const de=document.createElement("div");de.className="me-video-add-custom-head";const Ae=document.createElement("div");Ae.className="me-video-add-custom-preview";const ve=document.createElement("span");ve.className="me-video-add-custom-label",ve.textContent=l.custom,de.append(Ae,ve);const j=document.createElement("div");j.className="me-video-add-spectrum";const k=document.createElement("span");k.className="me-video-add-spectrum-thumb",j.appendChild(k);const H=document.createElement("div");H.className="me-video-add-hue-row";const T=document.createElement("div");T.className="me-video-add-custom-preview";const _=document.createElement("input");_.type="range",_.min="0",_.max="360",_.step="1",_.className="me-video-add-hue-slider",H.append(T,_);const le=document.createElement("div");le.className="me-video-add-rgb-grid";const se={};["r","g","b"].forEach(p=>{const b=document.createElement("label");b.className="me-video-add-rgb-field";const L=document.createElement("input");L.type="number",L.min="0",L.max="255",L.step="1",L.inputMode="numeric",L.className="me-video-add-rgb-input";const q=document.createElement("span");q.className="me-video-add-rgb-label",q.textContent=p.toUpperCase(),b.append(L,q),le.appendChild(b),se[p]=L}),Te.append(de,j,H,le);const me=document.createElement("section");me.className="me-video-add-section";const P=document.createElement("div");P.className="me-video-add-section-head";const $=document.createElement("span");$.className="me-video-add-section-title",$.textContent=l.width;const M=document.createElement("span");M.className="me-video-add-section-value",P.append($,M);const A=document.createElement("input");A.type="range",A.min=String(Ns),A.max=String(_s),A.step="1",A.className="me-video-add-slider",W.append(S,X),ue.append(oe,Be,Te),me.append(P,A),w.append(W,ue,me),d.append(m,v,w);let ee=null,Me=null,_e=null,x=null,C=null,O=null,B=null,G=null,ze=null,J=!1,te=!1,U=null,xe=yc(),Ce=null,Ye=null,et=null,lt=0,ot=0;const gt="add",Jt=[{key:"tl",x:0,y:0},{key:"tm",x:.5,y:0},{key:"tr",x:1,y:0},{key:"ml",x:0,y:.5},{key:"mr",x:1,y:.5},{key:"bl",x:0,y:1},{key:"bm",x:.5,y:1},{key:"br",x:1,y:1}],_t={key:"rotate",x:.5,y:0},xt=typeof ResizeObserver=="function"?new ResizeObserver(()=>{Ze()}):null,Yt=typeof ResizeObserver=="function"?new ResizeObserver(()=>{Ze()}):null,tn=Wg.map(p=>{const b=document.createElement("button");return b.type="button",b.className="me-video-add-tool-card",b.dataset.tool=p.key,b.innerHTML=`<span class="me-video-add-tool-icon">${h5(p.key)}</span><span class="me-video-add-tool-label">${l[p.key]}</span>`,b.addEventListener("click",()=>{rn({tool:p.key})}),X.appendChild(b),b}),_n=qg.map(p=>{const b=document.createElement("button");return b.type="button",b.className="me-video-add-color-chip",b.dataset.color=p,b.dataset.tone=p==="#ffffff"?"light":"dark",b.style.background=p,b.title=p,b.setAttribute("aria-label",p),b.addEventListener("click",()=>{rn({color:p})}),Be.appendChild(b),b});function st(p,b,L){et?.();const q=p==="mouse"?["mousemove"]:["pointermove"],Ee=p==="mouse"?["mouseup"]:["pointerup","pointercancel"],be=ae=>{b(ae)},Oe=ae=>{q.forEach(ke=>window.removeEventListener(ke,be)),Ee.forEach(ke=>window.removeEventListener(ke,Oe)),et=null,L(ae)};et=()=>{q.forEach(ae=>window.removeEventListener(ae,be)),Ee.forEach(ae=>window.removeEventListener(ae,Oe))},q.forEach(ae=>window.addEventListener(ae,be)),Ee.forEach(ae=>window.addEventListener(ae,Oe))}function Ge(p,b){const L=j.getBoundingClientRect();if(!(L.width>0&&L.height>0))return;const q=qe((p-L.left)/L.width,0,1),Ee=1-qe((b-L.top)/L.height,0,1),be=xc(xe.color),Oe=wf(be.r,be.g,be.b),ae=Ef(Oe.h,q,Ee);rn({color:wc(ae.r,ae.g,ae.b)})}function mt(p){const b=typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now(),L=p.type==="mousedown"?"mouse":"pointer";if(L==="mouse"){if(b<ot)return}else ot=b+80;p.preventDefault(),p.stopPropagation(),Ge(p.clientX,p.clientY),st(L,q=>{q.preventDefault(),Ge(q.clientX,q.clientY)},()=>{})}function Rt(p){const b=xc(xe.color),L=wf(b.r,b.g,b.b),q=Ef(qe(Number(p)||0,0,360),L.s,L.v);rn({color:wc(q.r,q.g,q.b)})}function Vt(p,b){const L=xc(xe.color),q={r:L.r,g:L.g,b:L.b};Number.isFinite(Number(b))&&(q[p]=qe(Number(b),0,255)),rn({color:wc(q.r,q.g,q.b)})}function kn(){return(a.getState().overlays??[]).map((p,b)=>({overlay:p,index:b})).filter(p=>Ba(p.overlay))}function xn(){const p=a.getState().overlays??[];if(U==null)return null;const b=p[U];return Ba(b)?b:null}function je(){const p=xn();if(!p)return!1;const b=yc({tool:xe.tool,color:p.color,width:p.width});return xf(xe,b)?!1:(xe=b,!0)}function dt(p,b,L={}){if(!xn()||U==null)return;const q={};Object.prototype.hasOwnProperty.call(b,"color")&&(q.color=p.color),Object.prototype.hasOwnProperty.call(b,"width")&&(q.width=p.width),Object.keys(q).length&&a.updateOverlay(U,q,L)}function yt(){return ol(a)}function pt(){return co(n)}function Mt(p,b,L={}){const q=(a.getState().overlays??[])[p];Ba(q)&&a.updateOverlay(p,ma(q,yt(),b),L)}function dn(p){const b=a.getState().overlays??[],L=b.length;if(typeof a.applyMut=="function")return a.applyMut(Ee=>({...Ee,overlays:[...za(Ee.overlays),{...p,timelineTrack:0}]})),L;const q=za(b);return a.commit?.({overlays:[...q,{...p,timelineTrack:0}]}),L}function Ut(p){const b=yt();let L=qe(pt(),0,Math.max(0,b-jt)),q=Math.min(b,L+Jr);q-L<jt&&(L=qe(b-Jr,0,Math.max(0,b-jt)),q=Math.max(L+jt,b));const Ee={...p,...ma(null,b,{startAt:L,endAt:q,timelineTrack:0})},be=dn(Ee);U=Number.isInteger(be)?be:null,qn(n,"text",U==null?[]:[U]),Y(),z(!0)}function An(){const{timelineInner:p,timelineHost:b}=Ms(n,a.getState());if(!p||!b){G?.remove(),G=null,xt&&ze&&(xt.unobserve(ze),ze=null),B=null;return}B=p,(!G||!G.isConnected||G.parentElement!==b)&&(G?.remove(),G=document.createElement("div"),G.className="me-video-text-timeline me-video-overlay-timeline me-video-add-overlay-layer");for(const L of[...b.children])L!==G&&L instanceof HTMLElement&&L.classList.contains("me-video-add-overlay-layer")&&L.remove();(G.parentElement!==b||b.lastElementChild!==G)&&b.appendChild(G),xt&&ze!==B&&(ze&&xt.unobserve(ze),ze=B,xt.observe(B))}function K(p,b,L){if(!B)return;const q=(a.getState().overlays??[])[p];if(!Ba(q))return;if(L.shiftKey||L.ctrlKey||L.metaKey){L.preventDefault(),L.stopPropagation();const it=gr(n,"text",p,L,cf(a.getState()).map(ht=>ht.index));U=it.length?it[it.length-1]:null,Y(),z(!0);return}L.preventDefault(),L.stopPropagation(),U=p,qn(n,"text",[p]),Y(),J||z(!0);const Ee=yt(),be=Math.max(B.clientWidth/Ee,.001),Oe=Cn(q),ae=Tr(q,Oe),ke=Math.max(jt,ae-Oe),Ve=$n(q),We=L.clientX,ft=it=>{const ht=(it.clientX-We)/be,wt=a.getState().overlays??[];if(b==="move"){const on=Math.max(0,Oe+ht),Rn=on+ke,cr=Nn(G,wt,p,on,Rn,it.clientY,Ve);Mt(p,{startAt:on,endAt:Rn,timelineTrack:cr},{transient:!0});return}if(b==="start"){const on=qe(Oe+ht,0,ae-jt),Rn=Nn(G,wt,p,on,ae,it.clientY,Ve);Mt(p,{startAt:on,endAt:ae,timelineTrack:Rn},{transient:!0});return}const Bt=Math.max(Oe+jt,ae+ht),Ot=Nn(G,wt,p,Oe,Bt,it.clientY,Ve);Mt(p,{startAt:Oe,endAt:Bt,timelineTrack:Ot},{transient:!0})},nt=it=>{window.removeEventListener("pointermove",ft),window.removeEventListener("pointerup",nt),window.removeEventListener("pointercancel",nt);const ht=(it.clientX-We)/be,wt=a.getState().overlays??[];if(b==="move"){const on=Math.max(0,Oe+ht),Rn=on+ke,cr=Nn(G,wt,p,on,Rn,it.clientY,Ve);Mt(p,{startAt:on,endAt:Rn,timelineTrack:cr});return}if(b==="start"){const on=qe(Oe+ht,0,ae-jt),Rn=Nn(G,wt,p,on,ae,it.clientY,Ve);Mt(p,{startAt:on,endAt:ae,timelineTrack:Rn});return}const Bt=Math.max(Oe+jt,ae+ht),Ot=Nn(G,wt,p,Oe,Bt,it.clientY,Ve);Mt(p,{startAt:Oe,endAt:Bt,timelineTrack:Ot})};window.addEventListener("pointermove",ft),window.addEventListener("pointerup",nt),window.addEventListener("pointercancel",nt),Yn()}function Le(p,b){if(An(),!G||!B||(G.replaceChildren(),G.hidden=p.length===0,!p.length))return;const L=yt(),q=B.clientWidth/L,Ee=Ss(a.getState()),be=new Map;for(const Oe of p){const ae=$n(Oe.overlay),ke=Ee.get(ae)??ae;let Ve=be.get(ae);Ve||(Ve=document.createElement("div"),Ve.className="me-video-overlay-track-row",Ve.dataset.track=String(ae),Ve.style.top=`${il(ke)}px`,be.set(ae,Ve),G.appendChild(Ve));const We=document.createElement("div");We.className="me-video-text-track-clip me-video-add-track-clip",b.has(Oe.index)&&We.classList.add("is-active");const ft=Cn(Oe.overlay),nt=al(Oe.overlay);We.style.left=`${ft*q}px`,We.style.width=`${Math.max(36,nt*q)}px`;const it=document.createElement("span");it.className="me-video-text-track-icon",it.textContent="+";const ht=document.createElement("span");ht.className="me-video-text-track-label",ht.textContent=Yg(Oe.overlay,l),ht.title=ht.textContent;const wt=document.createElement("span");wt.className="me-video-text-track-handle is-start";const Bt=document.createElement("span");Bt.className="me-video-text-track-handle is-end",We.append(it,ht,wt,Bt),We.addEventListener("pointerdown",Ot=>K(Oe.index,"move",Ot)),wt.addEventListener("pointerdown",Ot=>K(Oe.index,"start",Ot)),Bt.addEventListener("pointerdown",Ot=>K(Oe.index,"end",Ot)),We.addEventListener("click",Ot=>{if(Ot.preventDefault(),Ot.stopPropagation(),Ot.shiftKey||Ot.ctrlKey||Ot.metaKey){Y(),Yn();return}const on=gr(n,"text",Oe.index,Ot,p.map(Rn=>Rn.index));U=on.length?on[on.length-1]:null,Y(),z(!0),Yn()}),Ve.appendChild(We)}}function Ze(){te||(te=!0,s(()=>{te=!1,Yn()}))}function Tt(){tn.forEach(L=>{L.classList.toggle("is-active",L.dataset.tool===xe.tool)}),_n.forEach(L=>{L.classList.toggle("is-active",L.dataset.color===xe.color)});const p=xc(xe.color),b=wf(p.r,p.g,p.b);Te.classList.toggle("is-active",!qg.includes(xe.color)),Te.style.setProperty("--me-add-color-current",xe.color),Te.style.setProperty("--me-add-color-hue",b5(b.h)),Ae.style.background=xe.color,T.style.background=xe.color,k.style.left=`${b.s*100}%`,k.style.top=`${(1-b.v)*100}%`,_.value=String(Math.round(b.h)),se.r.value=String(p.r),se.g.value=String(p.g),se.b.value=String(p.b),A.value=String(qe(Math.round(Number(xe.width)||ji.width),Ns,_s)),M.textContent=g5(xe.width),g.disabled=Ug(xe)}function rn(p,b={}){const L=yc({...xe,...p});if(xf(xe,L)){b.applyToSelected&&dt(L,p,b.overlayOptions);return}xe=L,b.applyToSelected!==!1&&dt(L,p,b.overlayOptions),Tt(),Ze()}function Pt(){if(Ug(xe)){Tt();return}xe=yc(),Tt(),Ze()}function nn(p=Me){return p?[...p.children].filter(b=>b instanceof HTMLButtonElement&&b!==ee&&!b.classList.contains("me-video-text-tool")):[]}function wn(){ee?.classList.toggle("is-active",J)}function Y(){_e&&(_e.classList.contains("is-active")||_e.click())}function fe(){Da(n,d),br(n)}function Ne(){Ce=null}function Qe(){Ye?.(),Ye=null,Ne()}function Et(){d.hidden=!J,wn(),fe()}function z(p){const b=!!p;if(b===J){Yn();return}J=b,J?(n.dispatchEvent(new CustomEvent("me-video-inspector-open",{detail:{id:gt}})),Y()):(Qe(),et?.(),et=null),Yn()}function V(){const p=n.querySelector(".me-video-toolrail");p&&(Me=p,_e=Ec(nn(p)),(!ee||!ee.isConnected)&&(ee=document.createElement("button"),ee.type="button",ee.className="me-video-text-tool me-video-add-tool",ee.innerHTML=`<span class="me-video-text-tool-icon">${v5()}</span><span class="me-video-text-tool-label">${l.tool}</span>`,ee.title=l.tool,ee.setAttribute("aria-label",l.tool),ee.addEventListener("click",()=>{const b=!J;b&&Y(),z(b)})),ee.isConnected?ee.parentElement===Me&&ee!==Me.lastElementChild&&Me.appendChild(ee):Me.appendChild(ee),Et())}function Fe(){const p=n.querySelector(".me-video-canvas-stage");if(!p){C?.remove(),C=null,Yt&&O&&(Yt.unobserve(O),O=null),x=null;return}x=p,x.style.position="relative",!C||!C.isConnected||C.parentElement!==x?(C?.remove(),C=document.createElement("div"),C.className="me-video-add-canvas-layer",C.addEventListener("pointerdown",ur),C.addEventListener("mousedown",ur),C.addEventListener("click",b=>{b.preventDefault(),b.stopPropagation()}),x.appendChild(C)):x.lastElementChild!==C&&x.appendChild(C),Yt&&O!==x&&(O&&Yt.unobserve(O),O=x,Yt.observe(x)),C.hidden=!J,C.dataset.tool=xe.tool}function He(){if(!x)return null;const p=a.getState().canvas??{},b=Math.max(1,Number(p.w)||0),L=Math.max(1,Number(p.h)||0);if(!b||!L)return null;const q=x.getBoundingClientRect(),Ee=x.querySelector("canvas, video, img")||[...x.children].find(Ve=>Ve!==C)||null;let be=0,Oe=0,ae=x.clientWidth||b,ke=x.clientHeight||L;if(Ee instanceof HTMLElement){const Ve=Ee.getBoundingClientRect();Ve.width>0&&Ve.height>0&&(be=Ve.left-q.left,Oe=Ve.top-q.top,ae=Ve.width,ke=Ve.height)}if(!(ae>0&&ke>0)){const Ve=x.clientWidth||b,We=x.clientHeight||L,ft=Math.min(Ve/b,We/L)||1;ae=b*ft,ke=L*ft,be=Math.max(0,(Ve-ae)/2),Oe=Math.max(0,(We-ke)/2)}return{stageLeft:q.left,stageTop:q.top,left:be,top:Oe,width:ae,height:ke,canvasWidth:b,canvasHeight:L,scaleX:ae/b,scaleY:ke/L}}function Xe(p,b,L){return{x:qe((p-L.stageLeft-L.left)/L.scaleX,0,L.canvasWidth),y:qe((b-L.stageTop-L.top)/L.scaleY,0,L.canvasHeight)}}function ct(p,b,L){return Number.isFinite(p?.clientX)&&Number.isFinite(p?.clientY)?Xe(p.clientX,p.clientY,b):L}function kt(p,b){return{x:Math.min(p.x,b.x),y:Math.min(p.y,b.y),w:Math.abs(b.x-p.x),h:Math.abs(b.y-p.y)}}function rt(p,b){const L=Cn(p),q=Tr(p,L);return b>=L-.001&&b<=q+.001}function at(p,b,L){const q=gr(n,"text",p,b,L);U=q.length?q[q.length-1]:null,z(!0),Yn()}function Ke(p,b,L,q,Ee){const be=Math.atan2(q-b,L-p),Oe=Math.max(12,Ee*3.5),ae=L-Oe*Math.cos(be-Math.PI/7),ke=q-Oe*Math.sin(be-Math.PI/7),Ve=L-Oe*Math.cos(be+Math.PI/7),We=q-Oe*Math.sin(be+Math.PI/7);return`M ${ae} ${ke} L ${L} ${q} L ${Ve} ${We}`}function Nt(p){if(!Array.isArray(p)||p.length<4)return"";let b=`M ${p[0]} ${p[1]}`;for(let L=2;L<p.length;L+=2)b+=` L ${p[L]} ${p[L+1]}`;return b}function Wt(p){const b=document.createElementNS("http://www.w3.org/2000/svg","svg");return b.classList.add("me-video-add-preview-svg"),b.setAttribute("viewBox",`0 0 ${p.canvasWidth} ${p.canvasHeight}`),b.setAttribute("width",String(p.width)),b.setAttribute("height",String(p.height)),b.style.left=`${p.left}px`,b.style.top=`${p.top}px`,b.style.width=`${p.width}px`,b.style.height=`${p.height}px`,b}function Ct(p,b,L){const q=document.createElementNS("http://www.w3.org/2000/svg",p);return q.classList.add("me-video-add-preview-shape"),q.setAttribute("stroke",b),q.setAttribute("stroke-width",String(L)),q}function bt(p){if(!Ce)return null;const b=Wt(p);if(Ce.type==="pen"){const L=Nt(Ce.points);if(!L)return b;const q=Ct("path",Ce.color,Ce.width);return q.setAttribute("d",L),b.appendChild(q),b}if(Ce.type==="line"||Ce.type==="arrow"){const L=Ct("line",Ce.color,Ce.width);if(L.setAttribute("x1",String(Ce.x1)),L.setAttribute("y1",String(Ce.y1)),L.setAttribute("x2",String(Ce.x2)),L.setAttribute("y2",String(Ce.y2)),b.appendChild(L),Ce.type==="arrow"){const q=Ct("path",Ce.color,Ce.width);q.setAttribute("d",Ke(Ce.x1,Ce.y1,Ce.x2,Ce.y2,Ce.width)),b.appendChild(q)}return b}if(Ce.type==="rect"){const L=Ct("rect",Ce.color,Ce.width);return L.setAttribute("x",String(Ce.x)),L.setAttribute("y",String(Ce.y)),L.setAttribute("width",String(Ce.w)),L.setAttribute("height",String(Ce.h)),b.appendChild(L),b}if(Ce.type==="ellipse"){const L=Ct("ellipse",Ce.color,Ce.width);return L.setAttribute("cx",String(Ce.x+Ce.w/2)),L.setAttribute("cy",String(Ce.y+Ce.h/2)),L.setAttribute("rx",String(Math.abs(Ce.w/2))),L.setAttribute("ry",String(Math.abs(Ce.h/2))),b.appendChild(L),b}return b}function $t(){if(Fe(),!C)return;const p=He();if(C.hidden=!J||!p,!J||!p){C.replaceChildren();return}C.dataset.tool=xe.tool,C.replaceChildren();const b=bt(p);b&&C.appendChild(b);const L=cf(a.getState()),q=new Set(Pg(n,a.getState())),Ee=pt(),be=L.map(ke=>ke.index),Oe=L.filter(ke=>rt(ke.overlay,Ee)),ae=xe.tool==="eraser"?[]:q.size?Oe.filter(ke=>q.has(ke.index)):Oe;for(const ke of ae){const Ve=Ir(ke.overlay);if(!Ve)continue;const We=document.createElement("button");We.type="button",We.className="me-video-text-canvas-hit";const ft=q.has(ke.index),nt=ft&&U===ke.index;ft&&We.classList.add("is-active"),We.title=Yg(ke.overlay,l),We.style.left=`${p.left+Ve.x*p.scaleX}px`,We.style.top=`${p.top+Ve.y*p.scaleY}px`,We.style.width=`${Math.max(18,Ve.w*p.scaleX)}px`,We.style.height=`${Math.max(18,Ve.h*p.scaleY)}px`;const it=da(ke.overlay);if(it&&(We.style.transform=`rotate(${it}deg)`,We.style.transformOrigin="center center"),We.addEventListener("pointerdown",ht=>{if(ht.preventDefault(),ht.stopPropagation(),ht.shiftKey||ht.ctrlKey||ht.metaKey){at(ke.index,ht,be);return}U=ke.index,qn(n,"text",[ke.index]),z(!0),un(ke.index,ht,p)}),nt){for(const wt of Jt){const Bt=document.createElement("span");Bt.className="me-video-text-canvas-handle",Bt.dataset.handle=wt.key,Bt.style.left=`${wt.x*100}%`,Bt.style.top=`${wt.y*100}%`,Bt.addEventListener("pointerdown",Ot=>{Ot.preventDefault(),Ot.stopPropagation(),U=ke.index,qn(n,"text",[ke.index]),z(!0),pn(ke.index,wt,Ot,p)}),We.appendChild(Bt)}const ht=document.createElement("span");ht.className="me-video-text-canvas-handle",ht.dataset.handle=_t.key,ht.style.left=`${_t.x*100}%`,ht.style.top=`${_t.y*100}%`,ht.addEventListener("pointerdown",wt=>{wt.preventDefault(),wt.stopPropagation(),U=ke.index,qn(n,"text",[ke.index]),z(!0),Lt(ke.index,wt,p)}),We.appendChild(ht)}C.appendChild(We)}}function un(p,b,L){const q=(a.getState().overlays??[])[p];if(!Ba(q))return;const Ee=a.getState().canvas??{w:1080,h:1920},be=Ir(q);if(!be)return;const Oe=b.clientX,ae=b.clientY,ke=Math.max(0,(Number(Ee.w)||0)-be.w),Ve=Math.max(0,(Number(Ee.h)||0)-be.h),We=(it,ht,wt)=>{const Bt=(it-Oe)/L.scaleX,Ot=(ht-ae)/L.scaleY,on=qe(be.x+Bt,0,ke),Rn=qe(be.y+Ot,0,Ve),cr=ac(q,on-be.x,Rn-be.y);a.updateOverlay(p,cr,wt?{transient:!0}:void 0)},ft=it=>{it.preventDefault(),We(it.clientX,it.clientY,!0)},nt=it=>{window.removeEventListener("pointermove",ft),window.removeEventListener("pointerup",nt),window.removeEventListener("pointercancel",nt),We(it.clientX,it.clientY,!1)};window.addEventListener("pointermove",ft),window.addEventListener("pointerup",nt),window.addEventListener("pointercancel",nt)}function pn(p,b,L,q){const Ee=(a.getState().overlays??[])[p];if(!Ba(Ee))return;const be=Ir(Ee);if(!be)return;const Oe=a.getState().canvas??{w:1080,h:1920},ae=b.x===.5?.5:1-b.x,ke=b.y===.5?.5:1-b.y,Ve=be.x+be.w*ae,We=be.y+be.h*ke,ft=Math.max(.1,24/Math.max(24,be.w),24/Math.max(24,be.h)),nt=b.x===.5?1/0:Math.max(.1,(ae===0?(Number(Oe.w)||0)-Ve:Ve)/Math.max(1,be.w)),it=b.y===.5?1/0:Math.max(.1,(ke===0?(Number(Oe.h)||0)-We:We)/Math.max(1,be.h)),ht=Math.max(ft,Math.min(nt,it,8)),wt=(on,Rn,cr)=>{const Mr=Xe(on,Rn,q),ar=[];b.x!==.5&&ar.push(Math.abs(Mr.x-Ve)/Math.max(1,be.w)),b.y!==.5&&ar.push(Math.abs(Mr.y-We)/Math.max(1,be.h));const N=ar.length?Math.max(...ar):1,I=qe(N,ft,ht),we=Ym(Ee,I),tt=Ir(we);if(!tt)return;const Je=Ve-tt.w*ae,qt=We-tt.h*ke,It=ac(we,Je-tt.x,qt-tt.y);a.updateOverlay(p,It,cr?{transient:!0}:void 0)},Bt=on=>{on.preventDefault(),wt(on.clientX,on.clientY,!0)},Ot=on=>{window.removeEventListener("pointermove",Bt),window.removeEventListener("pointerup",Ot),window.removeEventListener("pointercancel",Ot),wt(on.clientX,on.clientY,!1)};window.addEventListener("pointermove",Bt),window.addEventListener("pointerup",Ot),window.addEventListener("pointercancel",Ot)}function Lt(p,b,L){const q=(a.getState().overlays??[])[p];if(!Ba(q))return;const Ee=Ir(q);if(!Ee)return;const be=L.stageLeft+L.left+(Ee.x+Ee.w/2)*L.scaleX,Oe=L.stageTop+L.top+(Ee.y+Ee.h/2)*L.scaleY,ae=Math.atan2(b.clientY-Oe,b.clientX-be),ke=da(q),Ve=(nt,it,ht,wt)=>{const Bt=Math.atan2(it-Oe,nt-be);let Ot=Es(ke+(Bt-ae)*180/Math.PI);wt&&(Ot=Math.round(Ot/15)*15),a.updateOverlay(p,{rotation:Ot},ht?{transient:!0}:void 0)},We=nt=>{nt.preventDefault(),Ve(nt.clientX,nt.clientY,!0,nt.shiftKey)},ft=nt=>{window.removeEventListener("pointermove",We),window.removeEventListener("pointerup",ft),window.removeEventListener("pointercancel",ft),Ve(nt.clientX,nt.clientY,!1,nt.shiftKey)};window.addEventListener("pointermove",We),window.addEventListener("pointerup",ft),window.addEventListener("pointercancel",ft)}function Zt(p,b,L,q,Ee,be,Oe){const ae=Ee-L,ke=be-q,Ve=ae*ae+ke*ke||1,We=qe(((p-L)*ae+(b-q)*ke)/Ve,0,1),ft=L+We*ae,nt=q+We*ke;return(p-ft)**2+(b-nt)**2<=Oe*Oe}function en(p,b,L){if(!p)return!1;if(p.type==="pen"){for(let q=0;q+3<p.points.length;q+=2)if(Zt(b,L,p.points[q],p.points[q+1],p.points[q+2],p.points[q+3],ul+(Number(p.width)||0)/2))return!0;return!1}return p.type==="line"||p.type==="arrow"?Zt(b,L,p.x1,p.y1,p.x2,p.y2,ul+(Number(p.width)||0)/2):p.type==="rect"||p.type==="ellipse"?b>=p.x-ul&&b<=p.x+p.w+ul&&L>=p.y-ul&&L<=p.y+p.h+ul:!1}function Tn(p){const b=kn();for(let L=b.length-1;L>=0;L--)if(en(b[L].overlay,p.x,p.y)){a.removeOverlay(b[L].index),Ze();return}}function fn(p,b,L){Tn(p),Dn(L,q=>{q.preventDefault(),Tn(Xe(q.clientX,q.clientY,b))},()=>{})}function Dn(p,b,L){Qe();const q=p==="mouse"?["mousemove"]:["pointermove"],Ee=p==="mouse"?["mouseup"]:["pointerup","pointercancel"],be=ae=>{b(ae)},Oe=ae=>{q.forEach(ke=>window.removeEventListener(ke,be)),Ee.forEach(ke=>window.removeEventListener(ke,Oe)),Ye=null,L(ae)};Ye=()=>{q.forEach(ae=>window.removeEventListener(ae,be)),Ee.forEach(ae=>window.removeEventListener(ae,Oe))},q.forEach(ae=>window.addEventListener(ae,be)),Ee.forEach(ae=>window.addEventListener(ae,Oe))}function zr(p,b,L){const q=[p.x,p.y],Ee=be=>{const Oe=q[q.length-2],ae=q[q.length-1];Math.hypot(be.x-Oe,be.y-ae)<1||q.push(be.x,be.y)};Ce={type:"pen",points:[...q],color:xe.color,width:xe.width},$t(),Dn(L,be=>{be.preventDefault();const Oe=Xe(be.clientX,be.clientY,b);Ee(Oe),Ce={type:"pen",points:[...q],color:xe.color,width:xe.width},$t()},be=>{const Oe=ct(be,b,{x:q[q.length-2],y:q[q.length-1]});Ee(Oe);const ae=[...q];Ne(),$t(),!(ae.length<4)&&(Ut({type:"pen",points:ae,color:xe.color,width:xe.width,rotation:0}),Ze())})}function Hn(p,b,L,q){const Ee=p5[p];if(!Ee)return;const be=Oe=>{if(Ee==="line"||Ee==="arrow")return{type:Ee,x1:b.x,y1:b.y,x2:Oe.x,y2:Oe.y,color:xe.color,width:xe.width};const ae=kt(b,Oe);return{type:Ee,x:ae.x,y:ae.y,w:ae.w,h:ae.h,color:xe.color,width:xe.width}};Ce=be(b),$t(),Dn(q,Oe=>{Oe.preventDefault();const ae=Xe(Oe.clientX,Oe.clientY,L);Ce=be(ae),$t()},Oe=>{const ae=ct(Oe,L,b),ke=be(ae);Ne(),$t(),ke&&((ke.type==="line"||ke.type==="arrow")&&Math.hypot(ke.x2-ke.x1,ke.y2-ke.y1)<2||(ke.type==="rect"||ke.type==="ellipse")&&(ke.w<2||ke.h<2)||Ut({...ke,rotation:0}))})}function ur(p){if(!J)return;const b=typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now(),L=p.type==="mousedown"?"mouse":"pointer";if(L==="mouse"){if(b<lt)return}else lt=b+80;if(typeof p.button=="number"&&p.button!==0)return;p.preventDefault(),p.stopPropagation();const q=He();if(!q)return;const Ee=Xe(p.clientX,p.clientY,q);if(xe.tool==="eraser"){fn(Ee,q,L);return}if(xe.tool==="brush"){zr(Ee,q,L);return}Hn(xe.tool,Ee,q,L)}function Yn(){const p=Pg(n,a.getState());U=p.length?p[p.length-1]:null,je(),nn().find(b=>b!==_e&&!b.hidden&&b.style.display!=="none"&&b.classList.contains("is-active"))&&(J=!1,Qe()),J&&Y(),Tt(),Et(),$t(),Le(cf(a.getState()),new Set(p)),fe()}function Fr(p){return!!p&&(p===d||d.contains(p)||p===ee||ee?.contains?.(p)||p===G||G?.contains?.(p)||p===C||C?.contains?.(p))}function D(p){return p.some(b=>{if(!Fr(b.target))return!0;for(const L of b.addedNodes)if(!Fr(L))return!0;for(const L of b.removedNodes)if(!Fr(L))return!0;return!1})}const ie=new MutationObserver(p=>{D(p)&&(V(),Ze())}),Pe=p=>{p?.detail?.id!==gt&&J&&z(!1)},E=()=>{Ze()};ie.observe(n,{childList:!0,subtree:!0}),n.addEventListener("me-video-inspector-open",Pe),n.addEventListener(fr,E),window.addEventListener("resize",Ze);const F=a.subscribe(()=>{Ze()});return g.addEventListener("click",()=>{Pt()}),j.addEventListener("pointerdown",mt),j.addEventListener("mousedown",mt),_.addEventListener("input",()=>{Rt(_.value)}),Object.entries(se).forEach(([p,b])=>{b.addEventListener("input",()=>{Vt(p,b.value)})}),A.addEventListener("input",()=>{rn({width:qe(Number(A.value)||ji.width,Ns,_s)})}),V(),Yn(),{destroy(){ie.disconnect(),F(),Qe(),et?.(),et=null,xt&&ze&&xt.unobserve(ze),xt?.disconnect?.(),Yt&&O&&Yt.unobserve(O),Yt?.disconnect?.(),n.removeEventListener("me-video-inspector-open",Pe),n.removeEventListener(fr,E),window.removeEventListener("resize",Ze),ee?.remove(),G?.remove(),C?.remove(),d.remove(),br(n)}}}function Y5(n,a,o){wa();const l=Lw(o()),s=document.createElement("div");s.className="me-video-text-panel me-video-audio-panel",s.hidden=!0;const d=document.createElement("div");d.className="me-video-text-toolbar";const m=document.createElement("strong");m.textContent=l.title;const h=Hr(l.close);d.append(m,h);const g=document.createElement("div");g.className="me-video-audio-source";const v=document.createElement("div");v.className="me-video-text-grid";function w(U=""){const xe=document.createElement("input");return xe.type="text",xe.readOnly=!0,xe.className=["me-video-audio-value",U].filter(Boolean).join(" "),xe}function W(U,xe,Ce){const Ye=document.createElement("div");return Ye.className="me-video-text-inline",Ye.append(xe,Ce),bc(U,Ye)}const S=document.createElement("input");S.type="range",S.min="50",S.max="200",S.step="1",S.disabled=!1,S.value="100",S.title=l.speedHint;const Q=w("is-compact is-readonly");Q.readOnly=!1,Q.classList.remove("is-readonly"),Q.inputMode="decimal",Q.title=l.speedHint;const X=W(l.speed,S,Q),ue=document.createElement("input");ue.type="range",ue.min=String(ea),ue.max="1",ue.step="0.01",ue.disabled=!1,ue.value="1";const oe=w("is-readonly");oe.readOnly=!1,oe.classList.remove("is-readonly"),oe.inputMode="decimal";const ge=W(l.duration,ue,oe),Be=document.createElement("input");Be.type="range",Be.min="0",Be.max="2",Be.step="0.01";const Te=w(),de=W(l.volume,Be,Te),Ae=document.createElement("input");Ae.type="range",Ae.min="0",Ae.max="0.1",Ae.step="0.05";const ve=w(),j=W(l.fadeIn,Ae,ve),k=document.createElement("input");k.type="range",k.min="0",k.max="0.1",k.step="0.05";const H=w(),T=W(l.fadeOut,k,H);v.append(X,ge,de,j,T),s.append(d,g,v);let _=null,le=!1,se=!1;const me="audio",P=typeof requestAnimationFrame=="function"?requestAnimationFrame:U=>setTimeout(U,16);function $(U){const xe=Math.max(0,Number(U)||0);return xe<=1e-4?"-\u221EdB":`${(20*Math.log10(xe)).toFixed(1)}dB`}function M(){const U=n.querySelector(".me-video-trim-panel");if(U instanceof HTMLElement)for(const xe of[...U.children].slice(2))xe instanceof HTMLElement&&xe.querySelector('input[type="range"]')&&/♪/.test(xe.textContent??"")&&(xe.style.display="none")}function A(){s.hidden=!le,Da(n,s),tb(n,s,le),br(n)}function ee(U){const xe=!!U;if(xe===le){A();return}le=xe,le&&n.dispatchEvent(new CustomEvent("me-video-inspector-open",{detail:{id:me}})),A()}function Me(){Di(n,{audio:[]},{audio:null})}function _e(U,xe,Ce,Ye){let et=qe(Number(xe)||0,0,U),lt=qe(Number(Ce)||0,0,U);return et+lt<=U?{fadeIn:et,fadeOut:lt}:(Ye==="fadeOut"?et=Math.max(0,U-lt):lt=Math.max(0,U-et),{fadeIn:et,fadeOut:lt})}function x(U){const xe=a.getAudioSource?.(U?.srcIdx);return Math.max(_r(U),Number(xe?.duration)||0)}function C(U,xe=!1,Ce="fadeIn"){const Ye=a.getState(),et=Ye.audioClips??[];if(_==null||!et[_])return;const lt=et[_],ot=_r({...lt,...U}),gt=_e(ot,U.fadeIn??lt.fadeIn,U.fadeOut??lt.fadeOut,Ce),Jt=xt=>({...xt,...U,speed:uo(U.speed??xt.speed),volume:qe(Number(U.volume??xt.volume)||0,0,2),fadeIn:gt.fadeIn,fadeOut:gt.fadeOut}),_t=typeof a.patchAudio=="function"?a.patchAudio(Ye,_,Jt).audioClips??et:et.map((xt,Yt)=>Yt===_?Jt(xt):xt);if(xe){a.patch({audioClips:_t},{transient:!0});return}a.commit({audioClips:_t})}function O(U,xe=!1){const Ce=a.getState().audioClips??[];if(_==null||!Ce[_])return;const Ye=Ce[_],et=x(Ye),lt=Math.max(0,Number(Ye.in)||0),ot=Math.max(ea,et-lt),gt=qe(Number(U)||0,ea,ot);C({out:lt+gt},xe,"fadeIn")}function B(){if(M(),!(n.querySelector(".me-video-trim-panel")instanceof HTMLElement)){le&&ee(!1),_=null;return}const U=a.getState(),xe=U.audioClips??[],Ce=ll(n,xe),Ye=Ls(n,U.clips??[]),et=As(n,U),lt=Ce.length===1&&Ye.length===0&&et.length===0?Ce[0]:null;if(_=Number.isInteger(lt)&&xe[lt]?lt:null,_==null){le&&ee(!1);return}const ot=xe[_],gt=a.getAudioSource?.(ot.srcIdx),Jt=gt?.file?.name||gt?.name||`${l.source} ${_+1}`,_t=_r(ot),xt=Math.max(_t,Number(gt?.duration)||0),Yt=Math.max(_t,Math.max(ea,xt-Math.max(0,Number(ot.in)||0))),tn=uo(ot.speed),_n=qe(Number(ot.fadeIn)||0,0,_t),st=qe(Number(ot.fadeOut)||0,0,Math.max(0,_t-_n));g.textContent=`${l.source}: ${Jt}`,S.value=String(Math.round(tn*100)),Q.value=Tw(tn),ue.max=String(Yt),ue.value=String(qe(_t,ea,Yt)),oe.value=zi(_t),Be.value=String(qe(Number(ot.volume)||0,0,2)),Te.value=$(ot.volume),Ae.max=String(Math.max(.1,_t)),k.max=String(Math.max(.1,_t)),Ae.value=String(_n),k.value=String(st),ve.value=zi(_n),H.value=zi(st),Ae.disabled=_t<=1e-4,k.disabled=_t<=1e-4,ee(!0)}function G(){se||(se=!0,P(()=>{se=!1,B()}))}const ze=U=>{if(U?.detail?.id!==me){if(Br(n,"audio").length>0){Me();return}le&&ee(!1)}},J=new MutationObserver(()=>{G()});J.observe(n,{childList:!0,subtree:!0}),n.addEventListener("me-video-inspector-open",ze),n.addEventListener(fr,G);const te=a.subscribe(()=>{G()});return h.addEventListener("click",()=>{Me()}),S.addEventListener("input",()=>{C({speed:uo((Number(S.value)||100)/100)},!0,"fadeIn")}),S.addEventListener("change",()=>{C({speed:uo((Number(S.value)||100)/100)},!1,"fadeIn")}),Q.addEventListener("change",()=>{const U=_==null?null:(a.getState().audioClips??[])[_]??null;C({speed:Bw(Q.value,U?.speed??1)},!1,"fadeIn")}),Q.addEventListener("keydown",U=>{U.key==="Enter"&&(U.preventDefault(),Q.blur())}),ue.addEventListener("input",()=>{O(Number(ue.value)||0,!0)}),ue.addEventListener("change",()=>{O(Number(ue.value)||0,!1)}),oe.addEventListener("change",()=>{const U=_==null?null:(a.getState().audioClips??[])[_]??null;O(zw(oe.value,_r(U)),!1)}),oe.addEventListener("keydown",U=>{U.key==="Enter"&&(U.preventDefault(),oe.blur())}),Be.addEventListener("input",()=>{C({volume:Number(Be.value)||0},!0,"fadeIn")}),Be.addEventListener("change",()=>{C({volume:Number(Be.value)||0},!1,"fadeIn")}),Ae.addEventListener("input",()=>{C({fadeIn:Number(Ae.value)||0},!0,"fadeIn")}),Ae.addEventListener("change",()=>{C({fadeIn:Number(Ae.value)||0},!1,"fadeIn")}),k.addEventListener("input",()=>{C({fadeOut:Number(k.value)||0},!0,"fadeOut")}),k.addEventListener("change",()=>{C({fadeOut:Number(k.value)||0},!1,"fadeOut")}),B(),{destroy(){J.disconnect(),te(),n.removeEventListener("me-video-inspector-open",ze),n.removeEventListener(fr,G),tb(n,s,!1),s.remove(),br(n)}}}function U5(n,a,o=()=>null){wa();let l=!1,s=null,d=null,m=null,h=null;const g=typeof requestAnimationFrame=="function"?requestAnimationFrame:k=>setTimeout(k,16);function v(){l||(l=!0,g(()=>{l=!1,ve()}))}function w(){return Qr(typeof o=="function"?o():null)==="en"?"Cover":"\u5C01\u9762"}function W(k){return[k.textContent,k.title,k.getAttribute("aria-label"),k.getAttribute("data-tool"),k.getAttribute("data-testid")].filter(Boolean).join(" ").replace(/\s+/g," ").trim()}function S(k){if(!(k instanceof HTMLElement)||k===s||k.classList.contains("me-video-cover-set-btn")||k.classList.contains("me-video-cover-upload-btn")||k.closest(".me-video-timeline-area"))return!1;for(let T=k.parentElement,_=0;T&&_<8;_+=1,T=T.parentElement){const le=String(T.textContent||"");if(le.includes("\u9009\u62E9\u5C01\u9762\u5E27")||/(?:pick|select|choose)\s+(?:a\s+)?cover\s+frame/i.test(le))return!1}const H=W(k);return H?!!(H.includes("\u5C01\u9762")||/\b(cover|poster|thumbnail)\b/i.test(H)):!1}function Q(){const k=n.querySelector(".me-video-toolrail"),H=(k?[...k.querySelectorAll('button,[role="button"]')]:[]).find(S);return H instanceof HTMLElement?H:[...n.querySelectorAll('button,[role="button"]')].find(S)}function X(){const k=n.querySelector(".me-video-timeline-scroll");return k instanceof HTMLElement?k:null}function ue(k){return[...k.children].find(H=>H instanceof HTMLElement&&H!==h&&H.dataset.meTimelineCoverSlot!=="true")}function oe(k){const H=k?.querySelector("[data-clipblock]")?.parentElement;return H instanceof HTMLElement?H:null}function ge(k,H){return h instanceof HTMLElement||(h=document.createElement("div"),h.className="me-video-timeline-cover-slot",h.dataset.meTimelineCoverSlot="true"),k.style.display="flex",k.style.alignItems="flex-start",H instanceof HTMLElement&&(H.style.flex="0 0 auto"),(h.parentElement!==k||k.firstElementChild!==h)&&k.insertBefore(h,H??k.firstChild),h}function Be(){return s instanceof HTMLButtonElement||(s=document.createElement("button"),s.type="button",s.className="me-video-timeline-cover-proxy",s.innerHTML='<img alt="" draggable="false"><svg class="me-video-timeline-cover-proxy-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M4 20h16"/><path d="M6 18l9.5-9.5a2.1 2.1 0 0 1 3 3L9 21H5v-4z"/><path d="M14 6l4 4"/></svg><span class="me-video-timeline-cover-proxy-label"></span>',s.addEventListener("click",k=>{k.preventDefault(),k.stopPropagation(),m?.click()})),s}function Te(){typeof a?.commit=="function"&&a.commit({poster:void 0}),v()}function de(){return d instanceof HTMLButtonElement||(d=document.createElement("button"),d.type="button",d.className="me-video-timeline-cover-clear",d.innerHTML='<svg viewBox="0 0 12 12" aria-hidden="true"><path d="M3 3l6 6M9 3L3 9"/></svg>',d.addEventListener("click",k=>{k.preventDefault(),k.stopPropagation(),Te()})),d}function Ae(k,H,T){const _=w(),le=Be(),se=de(),me=le.querySelector(".me-video-timeline-cover-proxy-label");me&&(me.textContent=_);const P=le.querySelector("img"),$=typeof a?.getState=="function"?a.getState():{},M=$?.poster?.useAsVideoCover&&typeof $.poster.preview=="string"?$.poster.preview:"";P instanceof HTMLImageElement&&(M?P.src=M:P.removeAttribute("src")),le.classList.toggle("has-cover-image",!!M),le.title=k.title||k.getAttribute("aria-label")||_,le.setAttribute("aria-label",le.title),le.classList.toggle("is-active",k.classList.contains("is-active")||k.getAttribute("aria-pressed")==="true"),le.parentElement!==H&&H.insertBefore(le,H.firstChild),se.hidden=!M,se.title=Qr(typeof o=="function"?o():null)==="en"?"Remove cover":"\u53D6\u6D88\u5C01\u9762",se.setAttribute("aria-label",se.title),se.parentElement!==H&&H.appendChild(se),H.style.overflow="visible"}function ve(){const k=Q(),H=X(),T=H instanceof HTMLElement?ue(H):null,_=T instanceof HTMLElement?oe(T):null;if(!(k instanceof HTMLElement)||!(H instanceof HTMLElement)||!(T instanceof HTMLElement)||!(_ instanceof HTMLElement)){m&&(m.removeAttribute("data-me-cover-hidden"),m=null),s?.remove(),d?.remove(),h?.remove(),h=null;return}m&&m!==k&&m.removeAttribute("data-me-cover-hidden"),m=k,m.setAttribute("data-me-cover-hidden","true");const le=ge(H,T);Ae(k,le,_)}const j=new MutationObserver(()=>{v()});return j.observe(n,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","title","aria-label","aria-pressed"]}),v(),{destroy(){j.disconnect(),m?.removeAttribute("data-me-cover-hidden"),s?.remove(),d?.remove(),h?.remove()}}}function Z5(n,a,o=()=>null){wa();let l=!1,s=null,d=null,m=null;const h=typeof requestAnimationFrame=="function"?requestAnimationFrame:P=>setTimeout(P,16);function g(){l||(l=!0,h(()=>{l=!1,le()}))}function v(){return Qr(typeof o=="function"?o():null)==="en"}function w(){const P=[...n.querySelectorAll('[role="dialog"], [aria-modal="true"]')];for(const M of P){if(!(M instanceof HTMLElement))continue;const A=String(M.textContent||"");if(A.includes("\u9009\u62E9\u5C01\u9762\u5E27")||/(?:pick|select|choose)\s+(?:a\s+)?cover\s+frame/i.test(A))return{root:M}}const $=[...n.querySelectorAll("strong,h1,h2,h3,span,div")];for(const M of $){if(!(M instanceof HTMLElement))continue;const A=String(M.textContent||"").trim();if(!A.includes("\u9009\u62E9\u5C01\u9762\u5E27")&&!/(?:pick|select|choose)\s+(?:a\s+)?cover\s+frame/i.test(A))continue;let ee=M.parentElement;for(let Me=0;ee&&Me<8;Me+=1,ee=ee.parentElement){if(!(ee instanceof HTMLElement))continue;const _e=[...ee.querySelectorAll("button")],x=_e.some(B=>{const G=String(B.textContent||B.title||B.getAttribute("aria-label")||"").trim();return G.includes("\u53D6\u6D88")||/cancel/i.test(G)||G==="\xD7"||G==="\xD7"||G==="\u2715"||G==="\u2716"}),C=!!ee.querySelector('input[type="range"]'),O=!!ee.querySelector("video,canvas,img")||[...ee.querySelectorAll("div")].some(B=>/url\(["']?.+["']?\)/.test(String(B.style.backgroundImage||"")));if(C||O||x&&_e.length>2)return{root:ee}}}return null}function W(P){const $=[...P.querySelectorAll("button")].filter(A=>A instanceof HTMLButtonElement&&A!==s&&A!==d),M=$.find(A=>{const ee=String(A.textContent||A.title||"").trim();return ee.includes("\u5BFC\u51FA\u5C01\u9762")||/export\s+cover/i.test(ee)})??[...$].reverse().find(A=>{const ee=String(A.textContent||A.title||"").trim();return!ee.includes("\u53D6\u6D88")&&!/cancel/i.test(ee)&&ee!=="\xD7"&&ee!=="\xD7"})??null;return{row:M?.parentElement??[...P.querySelectorAll("div")].filter(A=>A instanceof HTMLElement).sort((A,ee)=>{const Me=A.getBoundingClientRect();return ee.getBoundingClientRect().bottom-Me.bottom}).find(A=>A.querySelector("button"))??null,primaryButton:M}}function S(P){const $=String(P.textContent||"").match(/(\d{1,2}:\d{2}(?:\.\d+)?)\s*\//);if($){const A=hc($[1]);if(Number.isFinite(A))return A}const M=P.querySelector('input[type="range"]');if(M instanceof HTMLInputElement){const A=Number(M.value);if(Number.isFinite(A))return Math.max(0,A)}return 0}function Q(P){return new Promise(($,M)=>{const A=new Image;A.onload=()=>$(A),A.onerror=M,A.src=P})}function X(P,$){const M=Math.max(1,Math.round(Number(P)||0)),A=Math.max(1,Math.round(Number($)||0));if(!M||!A)return null;const ee=Math.min(1,1920/Math.max(M,A));return{width:Math.max(1,Math.round(M*ee)),height:Math.max(1,Math.round(A*ee))}}function ue(P,$=null){const M=P instanceof HTMLImageElement?P.naturalWidth:P.videoWidth,A=P instanceof HTMLImageElement?P.naturalHeight:P.videoHeight;if(!M||!A)return"";const ee=$?X($.width,$.height):null,Me=ee?.width??M,_e=ee?.height??A,x=document.createElement("canvas");x.width=Me,x.height=_e;const C=x.getContext("2d");if(!C)return"";if(ee){const O=Math.max(Me/M,_e/A),B=Me/O,G=_e/O,ze=Math.max(0,(M-B)/2),J=Math.max(0,(A-G)/2);C.drawImage(P,ze,J,Math.min(M,B),Math.min(A,G),0,0,Me,_e)}else C.drawImage(P,0,0,M,A);return x.toDataURL("image/png")}async function oe(P){const $=String(P||"").trim();if(!$)return"";if(/^data:image\/(?:png|jpe?g);base64,/i.test($))return $;try{const M=await(await fetch($)).blob(),A=URL.createObjectURL(M);try{const ee=await Q(A);return ue(ee)}finally{URL.revokeObjectURL(A)}}catch{try{const M=await Q($);return ue(M)}catch{return""}}}async function ge(P){const $=P.getBoundingClientRect(),M=$.top+$.height*.68;function A(C){const O=C.getBoundingClientRect();return O.width<80||O.height<120||O.top>M?null:O}const ee=[...P.querySelectorAll("*")].map(C=>{if(!(C instanceof HTMLElement))return null;const O=A(C);if(!O)return null;const B=getComputedStyle(C).backgroundImage.match(/url\(["']?(.+?)["']?\)/);return B?{node:C,rect:O,src:B[1]}:null}).filter(Boolean).sort((C,O)=>O.rect.width*O.rect.height-C.rect.width*C.rect.height)[0];if(ee?.src){const C=await oe(ee.src);if(C)return C}const Me=[...P.querySelectorAll("canvas")].map(C=>{const O=A(C);return O?{node:C,rect:O}:null}).filter(Boolean).sort((C,O)=>O.rect.width*O.rect.height-C.rect.width*C.rect.height)[0]?.node;if(Me instanceof HTMLCanvasElement)try{return Me.toDataURL("image/png")}catch{return""}const _e=[...P.querySelectorAll("video")].map(C=>{const O=A(C);return C instanceof HTMLVideoElement&&O?{node:C,rect:O}:null}).filter(Boolean).sort((C,O)=>O.rect.width*O.rect.height-C.rect.width*C.rect.height)[0]?.node;if(_e instanceof HTMLVideoElement&&_e.videoWidth&&_e.videoHeight)try{const C=document.createElement("canvas");C.width=_e.videoWidth,C.height=_e.videoHeight;const O=C.getContext("2d");return O?(O.drawImage(_e,0,0,C.width,C.height),C.toDataURL("image/png")):""}catch{return""}const x=[...P.querySelectorAll("img")].map(C=>{const O=A(C);return C instanceof HTMLImageElement&&C.src&&O?{node:C,rect:O}:null}).filter(Boolean).sort((C,O)=>O.rect.width*O.rect.height-C.rect.width*C.rect.height)[0]?.node;if(x instanceof HTMLImageElement){try{const C=ue(x);if(C)return C}catch{}return oe(x.src)}return""}function Be(P){const $=P.getBoundingClientRect(),M=$.top+$.height*.68;function A(_e){const x=_e.getBoundingClientRect();return x.width<80||x.height<120||x.top>M?null:x}const ee=[];for(const _e of P.querySelectorAll("video,canvas,img")){const x=A(_e);x&&(_e instanceof HTMLVideoElement&&_e.videoWidth&&_e.videoHeight?ee.push({width:_e.videoWidth,height:_e.videoHeight,area:x.width*x.height}):_e instanceof HTMLCanvasElement&&_e.width&&_e.height?ee.push({width:_e.width,height:_e.height,area:x.width*x.height}):_e instanceof HTMLImageElement&&ee.push({width:_e.naturalWidth||x.width,height:_e.naturalHeight||x.height,area:x.width*x.height}))}const Me=ee.filter(_e=>_e.width>0&&_e.height>0).sort((_e,x)=>x.area-_e.area)[0];return Me?X(Me.width,Me.height):null}function Te(P){return new Promise(($,M)=>{const A=new FileReader;A.onload=()=>$(String(A.result||"")),A.onerror=()=>M(A.error),A.readAsDataURL(P)})}async function de(P,$){const M=String(P?.name||"");if(!(P&&(/^image\//.test(P.type||"")||/\.(png|jpe?g|webp|gif|bmp)$/i.test(M))))return"";const A=await Te(P);if(!A)return"";const ee=await Q(A);return ue(ee,Be($))}function Ae(P){function $(B){if(!(B instanceof HTMLElement))return!1;const G=B.getBoundingClientRect(),ze=getComputedStyle(B);return G.width>1&&G.height>1&&ze.display!=="none"&&ze.visibility!=="hidden"}function M(B,G,ze){for(let J=B;J instanceof HTMLElement&&J!==n.parentElement&&(ze.has(J)||(G.push(J),ze.add(J)),J!==n);J=J.parentElement);}const A=[],ee=new Set,Me=[...n.querySelectorAll("div")].filter(B=>{if(!(B instanceof HTMLElement)||!$(B))return!1;const G=String(B.textContent||"");if(!G.includes("\u9009\u62E9\u5C01\u9762\u5E27")&&!/(?:pick|select|choose)\s+(?:a\s+)?cover\s+frame/i.test(G))return!1;const ze=B.getBoundingClientRect();return ze.width>300&&ze.height>200}).sort((B,G)=>{const ze=B.getBoundingClientRect(),J=G.getBoundingClientRect();return ze.width*ze.height-J.width*J.height})[0];M(Me,A,ee),M(w()?.root,A,ee),M(P,A,ee);function _e(B){let G=!1;try{B.dispatchEvent(new MouseEvent("click",{bubbles:!0,cancelable:!0}))}catch{}try{B.click(),G=!0}catch{}const ze=Object.keys(B).find(te=>te.startsWith("__reactProps$")),J=ze?B[ze]?.onClick:null;if(typeof J=="function")try{J({currentTarget:B,target:B,nativeEvent:new MouseEvent("click",{bubbles:!0,cancelable:!0}),preventDefault(){},stopPropagation(){}}),G=!0}catch{}return G}const x=A.flatMap(B=>[...B.querySelectorAll("button")]),C=x.find(B=>{if(B===s||B===d)return!1;const G=String(B.textContent||B.title||B.getAttribute("aria-label")||"").trim();return G==="\xD7"||G==="\xD7"||G==="\u2715"||G==="\u2716"||G.includes("\u5173\u95ED")||/\b(close|dismiss)\b/i.test(G)});if(C instanceof HTMLButtonElement){_e(C);return}const O=x.find(B=>{if(B===s||B===d)return!1;const G=String(B.textContent||"").trim();return G==="\u53D6\u6D88"||/^cancel$/i.test(G)});if(O instanceof HTMLButtonElement){_e(O);return}document.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",bubbles:!0})),window.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",bubbles:!0}))}function ve(P,$){const M=S(P),A={time:M,useAsVideoCover:!0,...$?{preview:$}:{}};typeof a?.commit=="function"?a.commit({poster:A}):typeof a?.setPoster=="function"&&a.setPoster(M),Ae(P),h(()=>{const ee=w();ee?.root&&Ae(ee.root)}),g()}async function j(P){const $=await ge(P);ve(P,$)}async function k(P,$){const M=await de($,P);M&&ve(P,M)}function H(P){s instanceof HTMLButtonElement||(s=document.createElement("button"),s.type="button",s.className="me-video-cover-set-btn",s.addEventListener("click",async M=>{M.preventDefault(),M.stopPropagation();const A=w();if(A?.root){s.disabled=!0;try{await j(A.root)}finally{s.disabled=!1}}}));const $=!!(typeof a?.getState=="function"?a.getState():{})?.poster?.useAsVideoCover;return s.textContent=$?v()?"Cover set":"\u5DF2\u8BBE\u4E3A\u5C01\u9762":v()?"Set as cover":"\u8BBE\u4E3A\u5C01\u9762",s.classList.toggle("is-set",$),s.title=s.textContent,s.setAttribute("aria-label",s.textContent),s}function T(){return m instanceof HTMLInputElement||(m=document.createElement("input"),m.type="file",m.accept="image/png,image/jpeg,image/webp,image/*",m.hidden=!0,m.setAttribute("aria-hidden","true"),m.addEventListener("change",async()=>{const P=m.files?.[0];if(m.value="",!P)return;const $=w();if($?.root){d instanceof HTMLButtonElement&&(d.disabled=!0);try{await k($.root,P)}finally{d instanceof HTMLButtonElement&&(d.disabled=!1)}}}),n.appendChild(m)),m}function _(P){return d instanceof HTMLButtonElement||(d=document.createElement("button"),d.type="button",d.className="me-video-cover-upload-btn",d.addEventListener("click",$=>{$.preventDefault(),$.stopPropagation(),T().click()})),d.textContent=v()?"Upload cover":"\u4E0A\u4F20\u5C01\u9762",d.title=d.textContent,d.setAttribute("aria-label",d.textContent),d}function le(){const P=w();if(!P?.root){s?.remove(),d?.remove();return}const $=H(P.root),M=_(P.root),{row:A,primaryButton:ee}=W(P.root);if(!(A instanceof HTMLElement))return;const Me=ee instanceof HTMLElement&&ee.parentElement===A?ee:null;($.parentElement!==A||Me&&$.nextElementSibling!==Me)&&A.insertBefore($,Me),(M.parentElement!==A||M.nextElementSibling!==$)&&A.insertBefore(M,$)}const se=new MutationObserver(g);se.observe(n,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","hidden","value"]});const me=typeof a?.subscribe=="function"?a.subscribe(g):null;return g(),{destroy(){se.disconnect(),me?.(),s?.remove(),d?.remove(),m?.remove()}}}function K5(n,a,o=()=>null){nl();let l=!1;const s=typeof requestAnimationFrame=="function"?requestAnimationFrame:j=>setTimeout(j,16);function d(j){return!!j.closest(["[data-clipblock]","[data-audioclip]",".me-video-text-track-clip",".me-video-text-canvas-hit",".me-video-text-chip",".me-video-trim-action-btn",".me-video-transition-marker",".me-video-text-panel",".me-video-inspector-rail",".me-video-toolrail button",".me-video-timeline-zoom button","input","select","textarea","button","label"].join(","))}function m(j){return!!j.closest(["input","select","textarea",'[contenteditable="true"]','[contenteditable=""]'].join(","))}function h(){l||(l=!0,s(()=>{l=!1,ue()}))}function g(){const j=n.querySelector(".me-video-timeline-scroll");if(!(j instanceof HTMLElement))return;const k=Qr(typeof o=="function"?o():null);j.title=k==="en"?"Hold Ctrl or Shift to select multiple layers.":"\u6309\u4F4F Ctrl \u6216 Shift \u53EF\u591A\u9009\u56FE\u5C42\u3002"}function v(){const j=new Set(Br(n,"video"));for(const k of n.querySelectorAll("[data-clipblock]")){const H=Number(k.getAttribute("data-clipblock"));k.classList.toggle("me-video-multi-selected",Number.isInteger(H)&&j.has(H))}}function w(j=1/0){const k=Fs(n);if(!(k instanceof HTMLElement))return[];const H=[];for(const T of k.querySelectorAll("span")){if(!String(T.textContent??"").trim().startsWith("\u266A"))continue;const _=T.parentElement;!(_ instanceof HTMLElement)||H.includes(_)||H.push(_)}return Number.isFinite(j)?H.slice(0,Math.max(0,j)):H}function W(){const j=a.getState().audioClips??[],k=new Set(Br(n,"audio")),H=w(),T=H.slice(0,j.length);H.slice(j.length).forEach(_=>{_ instanceof HTMLElement&&(_.removeAttribute("data-audioclip"),_.classList.remove("me-video-multi-selected"),_.style.removeProperty("background"),_.style.removeProperty("border"),_.style.removeProperty("box-shadow"),_.style.removeProperty("color"),_.style.removeProperty("transform"),_.style.removeProperty("opacity"))}),T.forEach((_,le)=>{_.dataset.audioclip=String(le);const se=k.has(le),me=[..._.children].filter(x=>x instanceof HTMLElement),P=me.length>1?1:0,$=me[P]??null,M=me.filter((x,C)=>C!==P),A=[..._.querySelectorAll("span")],ee=se?"linear-gradient(180deg, rgba(34,197,94,0.96) 0%, rgba(21,128,61,0.94) 100%)":"linear-gradient(180deg, rgba(220,252,231,0.98) 0%, rgba(187,247,208,0.94) 100%)",Me=se?"2px solid rgba(21,128,61,0.96)":"2px solid rgba(34,197,94,0.5)",_e="#166534";_.classList.toggle("me-video-multi-selected",se),_.style.boxShadow=se?"0 0 0 2px rgba(34,197,94,0.22), 0 8px 18px rgba(22,101,52,0.16)":"0 1px 6px rgba(22,101,52,0.08)",_.style.background=ee,_.style.border=Me,_.style.color=_e,_.style.transform=se?"translateY(-1px)":"none",_.style.opacity=se?"1":"0.98",$ instanceof HTMLElement&&($.style.background=ee,$.style.border=Me,$.style.color=_e,$.style.boxShadow=se?"0 0 0 1px rgba(21,128,61,0.14), 0 8px 18px rgba(22,101,52,0.14)":"0 1px 6px rgba(22,101,52,0.08)"),M.forEach(x=>{x.style.background=se?"rgba(21,128,61,0.92)":"rgba(34,197,94,0.72)",x.style.opacity="1"}),A.forEach((x,C)=>{x.style.color=C===0?_e:"rgba(22,101,52,0.9)",x.style.opacity="1"})})}function S(){return[...n.querySelectorAll(".me-video-trim-actions .me-video-trim-action-btn")].map(j=>{if(!(j instanceof HTMLElement)||j.tagName.toLowerCase()!=="button")return j;const k=document.createElement("div");for(const H of[...j.attributes])H.name==="type"||H.name==="disabled"||k.setAttribute(H.name,H.value);return k.innerHTML=j.innerHTML,k.style.cssText=j.style.cssText,k.style.display="flex",k.style.justifyContent="center",k.style.alignItems="center",k.setAttribute("role","button"),k.tabIndex=j.disabled?-1:0,k.setAttribute("aria-disabled",j.disabled?"true":"false"),j.disabled&&(k.dataset.disabled="true"),j.replaceWith(k),k})}function Q(j,k,H,T){const _=S();if(_.length<3)return;const le=j.clips??[],se=j.audioClips??[],me=co(n),P=k.length>0||H.length>0||T.length>0,$=e5(le,k,me)||n5(se,H,me)||t5(j.overlays??[],T,me),M=P,A=H.length>0||T.length>0||k.length>0&&k.length<le.length,ee=[$,M,A];_.forEach((Me,_e)=>{const x=ee[_e];Me.setAttribute("aria-disabled",x?"false":"true"),Me.tabIndex=x?0:-1,x?delete Me.dataset.disabled:Me.dataset.disabled="true",Me.style.opacity=x?"1":"0.5",_e===2?(Me.style.color=x?"#dc2626":"var(--me-fg-muted, #9a9aa3)",Me.style.background="",Me.style.boxShadow=""):(Me.style.color=x?"var(--me-fg, #ededf0)":"var(--me-fg-muted, #9a9aa3)",Me.style.background="",Me.style.boxShadow="")})}function X(j){j===0?a5(n,a):j===1?r5(n,a):j===2&&$g(n,a),h()}function ue(){const j=a.getState();Yw(n,j),g();const k=Ls(n,j.clips??[]),H=ll(n,j.audioClips??[]),T=As(n,j);v(),W(),Q(j,k,H,T)}function oe(j){if(!(j.target instanceof Element))return;const k=j.target.closest("[data-clipblock]");if(!k||!n.contains(k))return;const H=Number(k.getAttribute("data-clipblock"));if(!Number.isInteger(H))return;const T=(a.getState().clips??[]).map((_,le)=>le);if(j.shiftKey||j.ctrlKey||j.metaKey){j.preventDefault(),j.stopPropagation(),gr(n,"video",H,j,T),h();return}qn(n,"video",[H]),h()}function ge(j){if(!(j.target instanceof Element))return;const k=j.target.closest("[data-audioclip]");if(!k||!n.contains(k))return;const H=Number(k.getAttribute("data-audioclip"));if(!Number.isInteger(H))return;const T=(a.getState().audioClips??[]).map((_,le)=>le);if(j.shiftKey||j.ctrlKey||j.metaKey){j.preventDefault(),j.stopPropagation(),gr(n,"audio",H,j,T),h();return}qn(n,"audio",[H]),h()}function Be(j){j.target instanceof Element&&n.contains(j.target)&&(d(j.target)||ff(n)&&(mf(n),h()))}function Te(j){if(!(j.target instanceof Element))return;const k=j.target.closest("[data-clipblock]");if(k&&n.contains(k)&&(j.shiftKey||j.ctrlKey||j.metaKey)){j.preventDefault(),j.stopPropagation();return}const H=j.target.closest(".me-video-trim-actions .me-video-trim-action-btn");if(!H||!n.contains(H))return;const T=[...n.querySelectorAll(".me-video-trim-actions .me-video-trim-action-btn")].indexOf(H);T!==-1&&(j.preventDefault(),j.stopPropagation(),H.getAttribute("aria-disabled")!=="true"&&X(T))}function de(j){if(!(j.target instanceof Element))return;if((j.key==="Delete"||j.key==="Backspace")&&!m(j.target)&&ff(n)){j.preventDefault(),j.stopPropagation(),$g(n,a),h();return}if(j.key!=="Enter"&&j.key!==" ")return;const k=j.target.closest(".me-video-trim-actions .me-video-trim-action-btn");if(!k||!n.contains(k))return;const H=[...n.querySelectorAll(".me-video-trim-actions .me-video-trim-action-btn")].indexOf(k);H!==-1&&(j.preventDefault(),j.stopPropagation(),k.getAttribute("aria-disabled")!=="true"&&X(H))}const Ae=new MutationObserver(()=>{h()});Ae.observe(n,{childList:!0,subtree:!0}),n.addEventListener("pointerdown",oe,!0),n.addEventListener("pointerdown",ge,!0),n.addEventListener("pointerdown",Be,!0),n.addEventListener("click",Te,!0),n.addEventListener("keydown",de,!0),n.addEventListener(fr,h),window.addEventListener("resize",h);const ve=a.subscribe(()=>{h()});return ue(),{destroy(){Ae.disconnect(),ve(),n.removeEventListener("pointerdown",oe,!0),n.removeEventListener("pointerdown",ge,!0),n.removeEventListener("pointerdown",Be,!0),n.removeEventListener("click",Te,!0),n.removeEventListener("keydown",de,!0),n.removeEventListener(fr,h),window.removeEventListener("resize",h)}}}var Lc=[{key:"480p",label:"480P",shortEdge:480},{key:"720p",label:"720P",shortEdge:720},{key:"1080p",label:"1080P",shortEdge:1080},{key:"2k",label:"2K",shortEdge:1440},{key:"4k",label:"4K",shortEdge:2160},{key:"8k",label:"8K",shortEdge:4320},{key:"source",label:"\u539F\u59CB"},{key:"custom",label:"\u81EA\u5B9A\u4E49"}],G5=[{key:"mov",label:"MOV",extension:"mov"},{key:"mp4",label:"MP4",extension:"mp4"},{key:"mxf",label:"MXF",extension:"mxf"}],X5=[24,25,30,50,60],Q5=[{key:"aac",label:"AAC"},{key:"mp3",label:"MP3"}],J5=[96,128,192,256,320],rb="me-video-export-enhancer-styles";function eE(){if(document.getElementById(rb))return;const n=document.createElement("style");n.id=rb,n.textContent=`
|
|
2057
|
+
</svg>`}function rl(n,a){const o=of(a),l=n.transitions.options[o.key]??n.transitions.options.none;return{...o,label:l.label,short:l.short}}function mc(n,a=af.en.untitledText){return String(n??"").replace(/\s+/g," ").trim()||a}function of(n){return nf.find(a=>a.key===n)??nf[0]}function Di(n){const a=Number(n)||0;return`${a.toFixed(a>=1?1:2).replace(/0+$/,"").replace(/\.$/,"")}s`}function _r(n){return Math.max(0,(Number(n?.out)||0)-(Number(n?.in)||0))}function uo(n){return qe(Number(n)||1,.5,2)}function Tw(n){return`${uo(n).toFixed(2)}x`}function Bw(n,a=1){const o=String(n??"").trim().replace(/x$/i,""),l=Number(o);return Number.isFinite(l)?uo(l):uo(a)}function Dw(n,a=0){const o=String(n??"").trim().replace(/s$/i,""),l=Number(o);return Number.isFinite(l)?Math.max(0,l):Math.max(0,a)}function fc(n,a=.4,o=.4){const l=of(n?.type??"none"),s=Math.max(0,Math.min(1.2,a-.05,o-.05));if(l.key==="none"||s<=.05)return{type:"none",duration:0};const d=Number(n?.duration),m=qe(Number.isFinite(d)?d:l.duration,.1,s);return{type:l.key,duration:m}}function lf(n){const a=n?.clips??[],o=Math.max(0,a.length-1),l=Array.isArray(n?.transitions)?n.transitions:[],s=[];for(let d=0;d<o;d++)s.push(fc(l[d],_r(a[d]),_r(a[d+1])));return s}function Mg(n,a,o="heading"){const l=n.getState().canvas??{w:1080,h:1920},s=bg[o]??bg.heading,d=Math.min(s.width,Math.max(240,l.w-64)),m=Math.min(s.fontSize,Math.max(32,Math.round(l.w*.11))),h=qe(Math.round(l.h*.18),32,Math.max(32,l.h-180));return{type:"text",x:Math.round((l.w-d)/2),y:h,text:a.textPresets[o]??s.text,color:s.color,fontSize:m,fontFamily:"Arial",fontWeight:s.fontWeight,fontStyle:"normal",textAlign:s.textAlign,width:d,backgroundColor:s.backgroundColor,borderColor:s.borderColor,borderWidth:s.borderWidth,paddingX:s.paddingX??Math.max(14,Math.round(m*.18)),paddingY:s.paddingY??Math.max(10,Math.round(m*.14)),boxShadow:s.boxShadow?{...s.boxShadow}:void 0,lineHeight:1.1,textPreset:o,textDecoration:"",textTransform:void 0,animation:"none",rotation:0}}var Qr=3,Pt=.5,ea=.1,Cs=99,sf=36,Lg=6;function Cn(n,a=0){return Number.isFinite(n?.startAt)?Math.max(0,Number(n.startAt)):Math.max(0,a)}function Tr(n,a=0,o=Qr){const l=Cn(n,a);return Number.isFinite(n?.endAt)?Math.max(l+Pt,Number(n.endAt)):l+Math.max(Pt,o)}function al(n,a=Qr){return Math.max(Pt,Tr(n,0,a)-Cn(n,0))}function $n(n,a=0){return Number.isFinite(n?.timelineTrack)?qe(Math.round(Number(n.timelineTrack)),0,Cs):Math.max(0,a)}function zw(n){return n==="pen"||n==="line"||n==="arrow"||n==="rect"||n==="ellipse"}function Ba(n){return zw(n?.type)}function Ea(n){return n?.type==="text"||n?.type==="sticker"||n?.type==="filter"||n?.type==="adjust"||Ba(n)}function il(n){return n*(sf+Lg)}function uf(n){const a=Array.isArray(n)?n:n?.overlays;return[...new Set((a??[]).filter(o=>Ea(o)).map(o=>$n(o)))].sort((o,l)=>o-l)}function Ss(n){const a=new Map;return uf(n).forEach((o,l)=>{a.set(o,l)}),a}function Pw(n){return uf(n).length}function jw(n){const a=Pw(n);return a?il(a-1)+sf:0}function Ow(n){return n instanceof HTMLElement&&(n.dataset.meTimelineCoverSlot==="true"||n.classList.contains("me-video-timeline-cover-slot"))}function $w(n){const a=n.querySelector(".me-video-timeline-scroll");return a instanceof HTMLElement?a:null}function Fs(n){const a=$w(n);return a?[...a.children].find(o=>o instanceof HTMLElement&&!Ow(o))??null:null}function Ag(n){const a=Fs(n)?.firstElementChild;return a instanceof HTMLElement?a:null}function Ms(n,a){const o=Fs(n);if(!o)return{timelineInner:null,timelineHost:null};o.style.position="relative";const l=o.firstElementChild,s=jw(a),d=[];for(const v of o.children)v instanceof HTMLElement&&v.classList.contains("me-video-overlay-track-host")&&d.push(v);const m=[...o.children].find(v=>v!==l&&!(v instanceof HTMLElement&&v.classList.contains("me-video-overlay-track-host")))??null;if(!m)return d.forEach(v=>v.remove()),{timelineInner:o,timelineHost:null};const h=d.shift()??null;if(d.forEach(v=>v.remove()),s<=0)return h?.remove(),{timelineInner:o,timelineHost:null};const g=h??document.createElement("div");return h||(g.className="me-video-overlay-track-host"),g.style.height=`${s}px`,(g.parentElement!==o||g.nextElementSibling!==m)&&o.insertBefore(g,m),{timelineInner:o,timelineHost:g}}function Rw(n){return((Array.isArray(n)?n:n?.overlays)??[]).reduce((a,o)=>Ea(o)?Math.max(a,Tr(o)):a,0)}function Iw(n,a,o,l){return n<l-1e-6&&o<a-1e-6}function Hw(n,a,o,l,s){const d=qe(Math.round(Number(s)||0),0,Cs);return(n??[]).every((m,h)=>h===a||!Ea(m)||$n(m)!==d?!0:!Iw(o,l,Cn(m),Tr(m)))}function Nn(n,a,o,l,s,d,m){if(!n)return m;const h=n.getBoundingClientRect(),g=Math.max(0,d-h.top),v=uf(a),w=qe(Math.floor(g/(sf+Lg)),0,v.length),W=w<v.length?v[w]:qe((v[v.length-1]??-1)+1,0,Cs);return Hw(a,o,l,s,W)?W:m}function ma(n,a,o={}){const l=Cn(n,0),s=al(n),d=Number.isFinite(o.startAt)?Number(o.startAt):l,m=Number.isFinite(o.endAt)?Number(o.endAt):d+s,h=Math.max(0,d),g=Math.max(h+Pt,m),v=Math.max(Pt,Number(a)||Qr,g),w=qe(h,0,Math.max(0,v-Pt)),W=qe(g,w+Pt,Math.max(w+Pt,v));return{startAt:w,endAt:W,timelineTrack:$n({timelineTrack:o.timelineTrack??n?.timelineTrack})}}function Ng(n,a=1){const o=Math.max(0,Math.round(Number(a)||0));return o?(n??[]).map(l=>Ea(l)?{...l,timelineTrack:qe($n(l)+o,0,Cs)}:l):[...n??[]]}function Da(n){return Ng(n,1)}function _g(n){return(n.overlays??[]).map((a,o)=>({overlay:a,index:o})).filter(a=>a.overlay?.type==="text").sort((a,o)=>{const l=$n(a.overlay)-$n(o.overlay);if(l!==0)return l;const s=Cn(a.overlay)-Cn(o.overlay);return Math.abs(s)>1e-6?s:a.index-o.index})}function Tg(n){return(n.overlays??[]).map((a,o)=>({overlay:a,index:o})).filter(a=>a.overlay?.type==="sticker").sort((a,o)=>{const l=$n(a.overlay)-$n(o.overlay);if(l!==0)return l;const s=Cn(a.overlay)-Cn(o.overlay);return Math.abs(s)>1e-6?s:a.index-o.index})}function Bg(n){return(n.overlays??[]).map((a,o)=>({overlay:a,index:o})).filter(a=>a.overlay?.type==="filter").sort((a,o)=>{const l=$n(a.overlay)-$n(o.overlay);if(l!==0)return l;const s=Cn(a.overlay)-Cn(o.overlay);return Math.abs(s)>1e-6?s:a.index-o.index})}function Dg(n){return(n.overlays??[]).map((a,o)=>({overlay:a,index:o})).filter(a=>a.overlay?.type==="adjust").sort((a,o)=>{const l=$n(a.overlay)-$n(o.overlay);if(l!==0)return l;const s=Cn(a.overlay)-Cn(o.overlay);return Math.abs(s)>1e-6?s:a.index-o.index})}function cf(n){return(n.overlays??[]).map((a,o)=>({overlay:a,index:o})).filter(a=>Ba(a.overlay)).sort((a,o)=>{const l=$n(a.overlay)-$n(o.overlay);if(l!==0)return l;const s=Cn(a.overlay)-Cn(o.overlay);return Math.abs(s)>1e-6?s:a.index-o.index})}function Vw(n){return(n.overlays??[]).map((a,o)=>({overlay:a,index:o})).filter(a=>Ea(a.overlay)).sort((a,o)=>{const l=$n(a.overlay)-$n(o.overlay);if(l!==0)return l;const s=Cn(a.overlay)-Cn(o.overlay);return Math.abs(s)>1e-6?s:a.index-o.index})}function Gn(n){return[...new Set((n??[]).map(a=>Number(a)).filter(a=>Number.isInteger(a)&&a>=0))].sort((a,o)=>a-o)}function pc(n){if(n.__meVideoTimelineSelectionStore)return n.__meVideoTimelineSelectionStore;const a={video:new Set,text:new Set,audio:new Set,anchors:{video:null,text:null,audio:null},initialized:!1};return n.__meVideoTimelineSelectionStore=a,a}function Ww(n,a){return a==="text"?n.text:a==="audio"?n.audio:n.video}function zg(){return["video","text","audio"]}function Br(n,a){return Gn([...Ww(pc(n),a)])}function df(n,a){const o=Gn(a),l=Gn([...n]);return l.length===o.length&&l.every((s,d)=>s===o[d])?!1:(n.clear(),o.forEach(s=>n.add(s)),!0)}function qw(n){n.dispatchEvent(new CustomEvent(fr))}function zi(n,a={},o={}){const l=pc(n);let s=!1;if(Object.prototype.hasOwnProperty.call(a,"video")&&(s=df(l.video,a.video)||s),Object.prototype.hasOwnProperty.call(a,"text")&&(s=df(l.text,a.text)||s),Object.prototype.hasOwnProperty.call(a,"audio")&&(s=df(l.audio,a.audio)||s),Object.prototype.hasOwnProperty.call(o,"video")){const d=Number.isInteger(o.video)&&o.video>=0?o.video:null;l.anchors.video!==d&&(l.anchors.video=d,s=!0)}if(Object.prototype.hasOwnProperty.call(o,"text")){const d=Number.isInteger(o.text)&&o.text>=0?o.text:null;l.anchors.text!==d&&(l.anchors.text=d,s=!0)}if(Object.prototype.hasOwnProperty.call(o,"audio")){const d=Number.isInteger(o.audio)&&o.audio>=0?o.audio:null;l.anchors.audio!==d&&(l.anchors.audio=d,s=!0)}return s&&qw(n),l}function qn(n,a,o,l={}){const s=Gn(o),d={[a]:s},m={[a]:s.length?l.anchor??s[s.length-1]:null};if(!l.preserveOther)for(const h of zg())h!==a&&(d[h]=[],m[h]=null);return zi(n,d,m),s}function mf(n){zi(n,{video:[],text:[],audio:[]},{video:null,text:null,audio:null})}function ff(n){return Br(n,"video").length>0||Br(n,"text").length>0||Br(n,"audio").length>0}function pf(n,a,o){const l=new Set(Gn(o)),s=Br(n,a),d=s.filter(m=>l.has(m));return s.length!==d.length&&zi(n,{[a]:d},{[a]:d.length?d[d.length-1]:null}),d}function gr(n,a,o,l,s=[]){const d=Gn(s),m=!!(l?.ctrlKey||l?.metaKey),h=!!l?.shiftKey,g=pc(n),v=Br(n,a);let w=v,W=o;if(h){const Y=g.anchors[a],ue=d.indexOf(Y),oe=d.indexOf(o);if(ue!==-1&&oe!==-1){const ge=Math.min(ue,oe),Be=Math.max(ue,oe),Te=d.slice(ge,Be+1);w=m?Gn([...v,...Te]):Te,W=Y}else m?w=v.includes(o)?v.filter(ge=>ge!==o):[...v,o]:w=[o]}else m?w=v.includes(o)?v.filter(Y=>Y!==o):[...v,o]:w=[o];w=Gn(w);const S={[a]:w},J={[a]:w.length?W:null};if(!m)for(const Y of zg())Y!==a&&(S[Y]=[],J[Y]=null);return zi(n,S,J),w}function Zw(n,a){const o=pc(n);o.initialized||(o.initialized=!0)}function ol(n){const a=typeof n.getState=="function"?n.getState():null;return Math.max(typeof n.contentDuration=="function"?n.contentDuration():0,Rw(a),Pt)}function hc(n){const a=String(n??"").trim();if(!a)return NaN;const o=a.split(":").map(s=>s.trim()).filter(Boolean);if(!o.length)return NaN;let l=0;for(const s of o){const d=Number(s);if(!Number.isFinite(d))return NaN;l=l*60+d}return l}function vc(n){return n instanceof HTMLElement?String(n.dataset.meRawTimeText||n.textContent||"").trim():""}function co(n){const a=Ag(n);if(a){const s=[...a.children].find(m=>m instanceof HTMLElement&&String(m.style.transform||"").includes("translateX(-50%)")),d=hc(vc(s));if(Number.isFinite(d))return d}const o=[...n.querySelectorAll(".me-video-trim-actions span")].find(s=>vc(s).includes("/")),l=vc(o);if(l){const s=hc(l.split("/")[0]);if(Number.isFinite(s))return s}return 0}function Ls(n,a){return pf(n,"video",(a??[]).map((o,l)=>l)).filter(o=>!!a[o])}function hf(n,a){return Br(n,"text").filter(o=>a.overlays?.[o]?.type==="text")}function Pg(n,a){return Br(n,"text").filter(o=>a.overlays?.[o]?.type==="sticker")}function jg(n,a){return Br(n,"text").filter(o=>a.overlays?.[o]?.type==="filter")}function gc(n,a){return Br(n,"text").filter(o=>a.overlays?.[o]?.type==="adjust")}function Og(n,a){return Br(n,"text").filter(o=>Ba(a.overlays?.[o]))}function As(n,a){const o=Vw(a).map(l=>l.index);return pf(n,"text",o).filter(l=>Ea(a.overlays?.[l]))}function ll(n,a){return pf(n,"audio",(a??[]).map((o,l)=>l)).filter(o=>!!a[o])}function Uw(n,a){const o=Gn(a).filter(d=>!!n[d]);if(!o.length)return{clips:n,selection:[],changed:!1};const l=o[o.length-1]+1,s=o.map(d=>({...n[d]}));return{clips:[...n.slice(0,l),...s,...n.slice(l)],selection:s.map((d,m)=>l+m),changed:!0}}function vf(n,a){const o=Gn(a).filter(m=>Ea(n[m]));if(!o.length)return{overlays:n,selection:[],changed:!1};const l=o.map(m=>{const h=n[m];return h?.type==="pen"?{...h,points:(h.points??[]).map((g,v)=>(v%2,(Number(g)||0)+24))}:h?.type==="line"||h?.type==="arrow"?{...h,x1:(Number(h.x1)||0)+24,y1:(Number(h.y1)||0)+24,x2:(Number(h.x2)||0)+24,y2:(Number(h.y2)||0)+24}:{...h,x:(Number(h.x)||0)+24,y:(Number(h.y)||0)+24}}),s=[...Ng(n,l.length),...l.map((m,h)=>({...m,timelineTrack:qe(h,0,Cs)}))],d=s.length-l.length;return{overlays:s,selection:l.map((m,h)=>d+h),changed:!0}}function Xw(n,a){const o=Gn(a).filter(d=>!!n[d]);if(!o.length)return{audioClips:n,selection:[],changed:!1};const l=o[o.length-1]+1,s=o.map(d=>{const m=n[d];return{...m,track:Number.isInteger(m?.track)&&m.track>=0?m.track:d,startAt:Math.max(0,(Number(m.startAt)||0)+.2)}});return{audioClips:[...n.slice(0,l),...s,...n.slice(l)],selection:s.map((d,m)=>l+m),changed:!0}}function Kw(n,a){const o=Gn(a).filter(s=>!!n[s]);if(!o.length||o.length>=n.length)return{clips:n,selection:o,changed:!1};const l=new Set(o);return{clips:n.filter((s,d)=>!l.has(d)),selection:[],changed:!0}}function gf(n,a){const o=new Set(Gn(a).filter(l=>Ea(n[l])));return o.size?{overlays:n.filter((l,s)=>!o.has(s)),selection:[],changed:!0}:{overlays:n,selection:[],changed:!1}}function Gw(n,a){const o=new Set(Gn(a).filter(l=>!!n[l]));return o.size?{audioClips:n.filter((l,s)=>!o.has(s)),selection:[],changed:!0}:{audioClips:n,selection:[],changed:!1}}function Yw(n,a,o){const l=new Set(Gn(a).filter(g=>!!n[g]));if(!l.size)return{clips:n,selection:[],changed:!1};let s=0,d=!1;const m=[],h=[];for(let g=0;g<n.length;g++){const v=n[g],w=Math.max(0,(Number(v?.out)||0)-(Number(v?.in)||0)),W=s+w;if(l.has(g)&&o>s+ea&&o<W-ea){const S=(Number(v.in)||0)+(o-s);h.push(m.length),m.push({...v,out:S}),h.push(m.length),m.push({...v,in:S}),d=!0}else l.has(g)&&h.push(m.length),m.push(v);s=W}return{clips:d?m:n,selection:d?h:Gn(a),changed:d}}function Jw(n,a,o,l){const s=new Set(Gn(a).filter(g=>Ea(n[g])));if(!s.size)return{overlays:n,selection:[],changed:!1};let d=!1;const m=[],h=[];for(let g=0;g<n.length;g++){const v=n[g];if(Ea(v)&&s.has(g)){const w=Cn(v),W=Tr(v,w),S=qe(l,w+Pt,W-Pt);if(S>w+1e-6&&S<W-1e-6){h.push(m.length),m.push({...v,...ma(v,o,{startAt:w,endAt:S,timelineTrack:$n(v)})}),h.push(m.length),m.push({...v,...ma(v,o,{startAt:S,endAt:W,timelineTrack:$n(v)})}),d=!0;continue}h.push(m.length)}m.push(v)}return{overlays:d?m:n,selection:d?h:Gn(a),changed:d}}function Qw(n,a,o){const l=new Set(Gn(a).filter(h=>!!n[h]));if(!l.size)return{audioClips:n,selection:[],changed:!1};let s=!1;const d=[],m=[];for(let h=0;h<n.length;h++){const g=n[h],v=Math.max(0,Number(g?.startAt)||0),w=_r(g),W=v+w;if(l.has(h)&&o>v+ea&&o<W-ea){const S=(Number(g.in)||0)+(o-v),J=Math.max(0,S-(Number(g.in)||0)),Y=Math.max(0,(Number(g.out)||0)-S);m.push(d.length),d.push({...g,track:Number.isInteger(g?.track)&&g.track>=0?g.track:h,out:S,fadeIn:Math.min(Number(g.fadeIn)||0,J),fadeOut:0}),m.push(d.length),d.push({...g,track:Number.isInteger(g?.track)&&g.track>=0?g.track:h,in:S,startAt:o,fadeIn:0,fadeOut:Math.min(Number(g.fadeOut)||0,Y)}),s=!0;continue}l.has(h)&&m.push(d.length),d.push(g)}return{audioClips:s?d:n,selection:s?m:Gn(a),changed:s}}function e5(n,a,o){const l=new Set(Gn(a));let s=0;for(let d=0;d<n.length;d++){const m=n[d],h=Math.max(0,(Number(m?.out)||0)-(Number(m?.in)||0)),g=s+h;if(l.has(d)&&o>s+ea&&o<g-ea)return!0;s=g}return!1}function t5(n,a,o){return Gn(a).some(l=>{const s=n[l];if(!Ea(s))return!1;const d=Cn(s),m=Tr(s,d);return o>d+Pt&&o<m-Pt})}function n5(n,a,o){return Gn(a).some(l=>{const s=n[l];if(!s)return!1;const d=Math.max(0,Number(s.startAt)||0),m=d+_r(s);return o>d+ea&&o<m-ea})}function r5(n,a){const o=a.getState(),l=o.clips??[],s=o.audioClips??[],d=o.overlays??[],m=Ls(n,l),h=ll(n,s),g=As(n,o);if(!m.length&&!h.length&&!g.length)return!1;let v=l,w=s,W=d,S=m,J=h,Y=g,ue=!1;if(m.length){const oe=Uw(v,m);v=oe.clips,S=oe.selection,ue=oe.changed||ue}if(h.length){const oe=Xw(w,h);w=oe.audioClips,J=oe.selection,ue=oe.changed||ue}if(g.length){const oe=vf(W,g);W=oe.overlays,Y=oe.selection,ue=oe.changed||ue}return ue?(a.commit({clips:v,audioClips:w,overlays:W}),zi(n,{video:S,audio:J,text:Y},{video:S.length?S[S.length-1]:null,audio:J.length?J[J.length-1]:null,text:Y.length?Y[Y.length-1]:null}),!0):!1}function $g(n,a){const o=a.getState(),l=o.clips??[],s=o.audioClips??[],d=o.overlays??[],m=Ls(n,l),h=ll(n,s),g=As(n,o);let v=l,w=s,W=d,S=m,J=h,Y=g,ue=!1;const oe=Kw(v,m);oe.changed&&(v=oe.clips,S=oe.selection,ue=!0);const ge=gf(W,g);ge.changed&&(W=ge.overlays,Y=ge.selection,ue=!0);const Be=Gw(w,h);return Be.changed&&(w=Be.audioClips,J=Be.selection,ue=!0),ue?(a.commit({clips:v,audioClips:w,overlays:W}),zi(n,{video:S,audio:J,text:Y},{video:S.length?S[S.length-1]:null,audio:J.length?J[J.length-1]:null,text:Y.length?Y[Y.length-1]:null}),!0):!1}function a5(n,a){const o=a.getState(),l=o.clips??[],s=o.audioClips??[],d=o.overlays??[],m=co(n),h=Ls(n,l),g=ll(n,s),v=As(n,o);let w=l,W=s,S=d,J=h,Y=g,ue=v,oe=!1;if(h.length){const ge=Yw(w,h,m);w=ge.clips,J=ge.selection,oe=ge.changed||oe}if(g.length){const ge=Qw(W,g,m);W=ge.audioClips,Y=ge.selection,oe=ge.changed||oe}if(v.length){const ge=Jw(S,v,Math.max(ol(a),m+Pt),m);S=ge.overlays,ue=ge.selection,oe=ge.changed||oe}return oe?(a.commit({clips:w,audioClips:W,overlays:S}),zi(n,{video:J,audio:Y,text:ue},{video:J.length?J[J.length-1]:null,audio:Y.length?Y[Y.length-1]:null,text:ue.length?ue[ue.length-1]:null}),!0):!1}function bc(n,a){const o=document.createElement("div");o.className="me-video-text-field";const l=document.createElement("label");return l.textContent=n,o.append(l,a),o}function Hr(n){const a=document.createElement("button");return a.type="button",a.className="me-video-text-mini",a.textContent=n,a}function i5(n,a){const o=document.createElement("button");return o.type="button",o.className="me-video-text-preset",o.dataset.preset=a,o.textContent=n,o}var o5=[{value:"300",label:"Light"},{value:"400",label:"Regular"},{value:"500",label:"Medium"},{value:"600",label:"Semibold"},{value:"700",label:"Bold"},{value:"800",label:"Extra Bold"}],Rg={en:{content:"Content",preset:"Preset",styles:"Styles",size:"Size",fill:"Fill",decoration:"Decoration",italic:"Italic",underline:"Underline",strike:"Strike",case:"Case",caseNone:"None",uppercase:"Uppercase",lowercase:"Lowercase",capitalize:"Capitalize",alignLeft:"Left",alignCenter:"Center",alignRight:"Right",animations:"Animations",animation:"Animation",fontStroke:"Font stroke",fontShadow:"Font shadow",x:"X",y:"Y",blur:"Blur",transparent:"Transparent",none:"None"},zh:{content:"\u5185\u5BB9",preset:"\u9884\u8BBE",styles:"\u6837\u5F0F",size:"\u5927\u5C0F",fill:"\u586B\u5145",decoration:"\u4FEE\u9970",italic:"\u659C\u4F53",underline:"\u4E0B\u5212\u7EBF",strike:"\u5220\u9664\u7EBF",case:"\u5927\u5C0F\u5199",caseNone:"\u65E0",uppercase:"\u5168\u90E8\u5927\u5199",lowercase:"\u5168\u90E8\u5C0F\u5199",capitalize:"\u9996\u5B57\u6BCD\u5927\u5199",alignLeft:"\u5DE6\u5BF9\u9F50",alignCenter:"\u5C45\u4E2D",alignRight:"\u53F3\u5BF9\u9F50",animations:"\u52A8\u753B",animation:"\u52A8\u753B",fontStroke:"\u6587\u5B57\u63CF\u8FB9",fontShadow:"\u6587\u5B57\u9634\u5F71",x:"X",y:"Y",blur:"\u6A21\u7CCA",transparent:"\u900F\u660E",none:"\u65E0"},"zh-Hant":{content:"\u5167\u5BB9",preset:"\u9810\u8A2D",styles:"\u6A23\u5F0F",size:"\u5927\u5C0F",fill:"\u586B\u5145",decoration:"\u4FEE\u98FE",italic:"\u659C\u9AD4",underline:"\u5E95\u7DDA",strike:"\u522A\u9664\u7DDA",case:"\u5927\u5C0F\u5BEB",caseNone:"\u7121",uppercase:"\u5168\u90E8\u5927\u5BEB",lowercase:"\u5168\u90E8\u5C0F\u5BEB",capitalize:"\u9996\u5B57\u6BCD\u5927\u5BEB",alignLeft:"\u9760\u5DE6",alignCenter:"\u7F6E\u4E2D",alignRight:"\u9760\u53F3",animations:"\u52D5\u756B",animation:"\u52D5\u756B",fontStroke:"\u6587\u5B57\u63CF\u908A",fontShadow:"\u6587\u5B57\u9670\u5F71",x:"X",y:"Y",blur:"\u6A21\u7CCA",transparent:"\u900F\u660E",none:"\u7121"}},Ig={en:{tool:"Ratio",title:"Ratio & canvas size",restore:"Restore",close:"Close",commonPresets:"Platform ratio presets",customSize:"Custom resolution",fitMode:"Canvas fill mode",width:"Width (px)",height:"Height (px)",lockRatio:"Lock ratio",unlockRatio:"Unlock ratio",quickPortrait:"1080p Portrait",quickLandscape:"1080p Landscape",summary:"Current output",baseOutput:"Base output",cover:"Crop to fill",contain:"Fit inside",force:"Stretch to fill",coverHint:"Fills the canvas and crops any overflow.",containHint:"Keeps the full frame and may add letterboxing.",forceHint:"Stretches the frame to the target size without cropping.",cinematic:"Cinematic",tablet:"Tablet"},zh:{tool:"\u6BD4\u4F8B",title:"\u6BD4\u4F8B\u4E0E\u753B\u5E03\u5C3A\u5BF8",restore:"\u6062\u590D",close:"\u5173\u95ED",commonPresets:"\u5E73\u53F0\u6BD4\u4F8B\u9884\u8BBE",customSize:"\u81EA\u5B9A\u4E49\u5206\u8FA8\u7387",fitMode:"\u753B\u9762\u586B\u5145\u9009\u9879",width:"\u5BBD\u5EA6 (px)",height:"\u9AD8\u5EA6 (px)",lockRatio:"\u9501\u5B9A\u6BD4\u4F8B",unlockRatio:"\u89E3\u9501\u6BD4\u4F8B",quickPortrait:"1080p \u7AD6\u5C4F",quickLandscape:"1080p \u6A2A\u5C4F",summary:"\u5F53\u524D\u8F93\u51FA",baseOutput:"\u539F\u59CB\u8F93\u51FA",cover:"\u88C1\u526A\u94FA\u6EE1",contain:"\u5B8C\u6574\u663E\u793A",force:"\u62C9\u4F38\u94FA\u6EE1",coverHint:"\u94FA\u6EE1\u753B\u5E03\uFF0C\u591A\u4F59\u533A\u57DF\u4F1A\u88AB\u88C1\u526A\u3002",containHint:"\u5B8C\u6574\u4FDD\u7559\u753B\u9762\uFF0C\u53EF\u80FD\u51FA\u73B0\u7559\u767D\u3002",forceHint:"\u5F3A\u5236\u62C9\u4F38\u5230\u76EE\u6807\u5C3A\u5BF8\uFF0C\u4E0D\u88C1\u526A\u3002",cinematic:"\u7535\u5F71\u5BBD\u5C4F",tablet:"\u5E73\u677F"},"zh-Hant":{tool:"\u6BD4\u4F8B",title:"\u6BD4\u4F8B\u8207\u756B\u5E03\u5C3A\u5BF8",restore:"\u9084\u539F",close:"\u95DC\u9589",commonPresets:"\u5E73\u53F0\u6BD4\u4F8B\u9810\u8A2D",customSize:"\u81EA\u8A02\u89E3\u6790\u5EA6",fitMode:"\u756B\u9762\u586B\u5145\u9078\u9805",width:"\u5BEC\u5EA6 (px)",height:"\u9AD8\u5EA6 (px)",lockRatio:"\u9396\u5B9A\u6BD4\u4F8B",unlockRatio:"\u89E3\u9396\u6BD4\u4F8B",quickPortrait:"1080p \u76F4\u5F0F",quickLandscape:"1080p \u6A6B\u5F0F",summary:"\u76EE\u524D\u8F38\u51FA",baseOutput:"\u539F\u59CB\u8F38\u51FA",cover:"\u88C1\u5207\u92EA\u6EFF",contain:"\u5B8C\u6574\u986F\u793A",force:"\u62C9\u4F38\u92EA\u6EFF",coverHint:"\u92EA\u6EFF\u756B\u5E03\uFF0C\u591A\u9918\u5340\u57DF\u6703\u88AB\u88C1\u5207\u3002",containHint:"\u5B8C\u6574\u4FDD\u7559\u756B\u9762\uFF0C\u53EF\u80FD\u51FA\u73FE\u7559\u767D\u3002",forceHint:"\u5F37\u5236\u62C9\u4F38\u81F3\u76EE\u6A19\u5C3A\u5BF8\uFF0C\u4E0D\u88C1\u5207\u3002",cinematic:"\u96FB\u5F71\u5BEC\u87A2\u5E55",tablet:"\u5E73\u677F"}},l5=[{id:"facebook-post",platform:"Facebook",type:"Post",iconText:"f",iconTheme:"facebook",ratios:["1:1","4:5","16:9"]},{id:"facebook-story",platform:"Facebook",type:"Story",iconText:"f",iconTheme:"facebook",ratios:["9:16"]},{id:"instagram-post",platform:"Instagram",type:"Post",iconText:"IG",iconTheme:"instagram",ratios:["1:1","4:5","16:9"]},{id:"instagram-story",platform:"Instagram",type:"Story",iconText:"IG",iconTheme:"instagram",ratios:["9:16"]},{id:"tiktok-photo",platform:"TikTok",type:"Photo",iconText:"T",iconTheme:"tiktok",ratios:["1:1","4:5","9:16"]},{id:"x-post",platform:"X",type:"Post",iconText:"X",iconTheme:"x",ratios:["1:1","16:9"]},{id:"linkedin-post",platform:"LinkedIn",type:"Post",iconText:"in",iconTheme:"linkedin",ratios:["1:1","16:9"]},{id:"pinterest-post",platform:"Pinterest",type:"Post",iconText:"P",iconTheme:"pinterest",ratios:["2:3","1:1"]},{id:"reddit-media",platform:"Reddit",type:"Media",iconText:"R",iconTheme:"reddit",ratios:["1:1","16:9"]},{id:"threads-post",platform:"Threads",type:"Post",iconText:"@",iconTheme:"threads",ratios:["1:1","4:5","16:9"]},{id:"telegram-post",platform:"Telegram",type:"Post",iconText:"TG",iconTheme:"telegram",ratios:["1:1","16:9"]}],s5=["9:16","16:9","1:1","4:5","2:3","3:2"],Hg={en:{tool:"Sticker",title:"Stickers",uploadTitle:"Upload sticker",uploadHint:"Click or drop an image here",uploadFormats:"Supports PNG, JPG, WEBP, SVG",libraryTitle:"Built-in sticker library",classicTitle:"Classic stickers",vibeTitle:"Vibe stickers",shapeTitle:"Shape stickers",defaultLabel:"Sticker",uploadedLabel:"Image sticker",emojiLabel:"Emoji sticker"},zh:{tool:"\u8D34\u7EB8",title:"\u8D34\u7EB8",uploadTitle:"\u81EA\u5B9A\u4E49\u672C\u5730\u56FE\u7247\u8D34\u7EB8",uploadHint:"\u70B9\u51FB\u6216\u62D6\u62FD\u56FE\u7247\u5230\u8FD9\u91CC",uploadFormats:"\u652F\u6301 PNG\u3001JPG\u3001WEBP\u3001SVG",libraryTitle:"\u5185\u7F6E\u7ECF\u5178\u8D34\u7EB8\u5E93",classicTitle:"\u7ECF\u5178\u8D34\u7EB8",vibeTitle:"\u6C1B\u56F4\u8D34\u7EB8",shapeTitle:"\u5F62\u72B6\u8D34\u7EB8",defaultLabel:"\u8D34\u7EB8",uploadedLabel:"\u56FE\u7247\u8D34\u7EB8",emojiLabel:"\u8868\u60C5\u8D34\u7EB8"},"zh-Hant":{tool:"\u8CBC\u7D19",title:"\u8CBC\u7D19",uploadTitle:"\u81EA\u8A02\u672C\u6A5F\u5716\u7247\u8CBC\u7D19",uploadHint:"\u9EDE\u64CA\u6216\u62D6\u62FD\u5716\u7247\u5230\u9019\u88E1",uploadFormats:"\u652F\u63F4 PNG\u3001JPG\u3001WEBP\u3001SVG",libraryTitle:"\u5167\u5EFA\u7D93\u5178\u8CBC\u7D19\u5EAB",classicTitle:"\u7D93\u5178\u8CBC\u7D19",vibeTitle:"\u6C1B\u570D\u8CBC\u7D19",shapeTitle:"\u5F62\u72C0\u8CBC\u7D19",defaultLabel:"\u8CBC\u7D19",uploadedLabel:"\u5716\u7247\u8CBC\u7D19",emojiLabel:"\u8868\u60C5\u8CBC\u7D19"}},bf={en:{tool:"Color",title:"Color",filterTool:"Filter",filterTitle:"Filter",presets:"Filter presets",adjustments:"Adjustments",reset:"Reset",brightness:"Brightness",contrast:"Contrast",saturation:"Saturation",temperature:"Temperature",tint:"Tint",vibrance:"Vibrance",gamma:"Gamma",colorSection:"Color",toneSection:"Brightness",effectsSection:"Effects",highlights:"Highlights",shadows:"Shadows",whites:"Whites",blacks:"Blacks",lightSense:"Light Sense",sharpen:"Sharpen",clarity:"Clarity",grain:"Grain",fade:"Fade",vignette:"Vignette",presetNames:{none:"Normal",sepia:"Retro",cool:"Cold",warm:"Warm",vivid:"Cyber",bw:"B&W"}},zh:{tool:"\u8C03\u8272",title:"\u8C03\u8272",filterTool:"\u6EE4\u955C",filterTitle:"\u6EE4\u955C",presets:"\u6EE4\u955C\u9884\u8BBE",adjustments:"\u753B\u9762\u5FAE\u8C03",reset:"\u91CD\u7F6E",brightness:"\u4EAE\u5EA6",contrast:"\u5BF9\u6BD4\u5EA6",saturation:"\u9971\u548C\u5EA6",temperature:"\u8272\u6E29",tint:"\u8272\u8C03",vibrance:"\u81EA\u7136\u9971\u548C\u5EA6",gamma:"Gamma",colorSection:"\u8272\u5F69",toneSection:"\u660E\u5EA6",effectsSection:"\u6548\u679C",highlights:"\u9AD8\u5149",shadows:"\u9634\u5F71",whites:"\u767D\u8272",blacks:"\u9ED1\u8272",lightSense:"\u5149\u611F",sharpen:"\u9510\u5316",clarity:"\u6E05\u6670",grain:"\u9897\u7C92",fade:"\u892A\u8272",vignette:"\u6697\u89D2",presetNames:{none:"\u539F\u753B (Normal)",sepia:"\u590D\u53E4 (Retro)",cool:"\u51B7\u8272 (Cold)",warm:"\u6696\u9633 (Warm)",vivid:"\u8D5B\u535A (Cyber)",bw:"\u9ED1\u767D (B&W)"}},"zh-Hant":{tool:"\u8ABF\u8272",title:"\u8ABF\u8272",filterTool:"\u6FFE\u93E1",filterTitle:"\u6FFE\u93E1",presets:"\u6FFE\u93E1\u9810\u8A2D",adjustments:"\u756B\u9762\u5FAE\u8ABF",reset:"\u91CD\u8A2D",brightness:"\u4EAE\u5EA6",contrast:"\u5C0D\u6BD4\u5EA6",saturation:"\u98FD\u548C\u5EA6",temperature:"\u8272\u6EAB",tint:"\u8272\u8ABF",vibrance:"\u81EA\u7136\u98FD\u548C\u5EA6",gamma:"Gamma",colorSection:"\u8272\u5F69",toneSection:"\u660E\u5EA6",effectsSection:"\u6548\u679C",highlights:"\u9AD8\u5149",shadows:"\u9670\u5F71",whites:"\u767D\u8272",blacks:"\u9ED1\u8272",lightSense:"\u5149\u611F",sharpen:"\u92B3\u5316",clarity:"\u6E05\u6670",grain:"\u9846\u7C92",fade:"\u892A\u8272",vignette:"\u6697\u89D2",presetNames:{none:"\u539F\u756B (Normal)",sepia:"\u5FA9\u53E4 (Retro)",cool:"\u51B7\u8272 (Cold)",warm:"\u6696\u967D (Warm)",vivid:"\u8CFD\u535A (Cyber)",bw:"\u9ED1\u767D (B&W)"}}};function u5(n){const a=Jr(n);return{...Hg.en,...Hg[a]??{}}}function yf(n){const a=Jr(n),o=bf[a]??{};return{...bf.en,...o,presetNames:{...bf.en.presetNames,...o.presetNames??{}}}}function sl(n,a,o="rgba(255,255,255,0.16)"){let l="";return n==="triangle"?l=`<polygon points="128,28 224,220 32,220" fill="${a}" stroke="${o}" stroke-width="8" stroke-linejoin="round"/>`:n==="circle"?l=`<circle cx="128" cy="128" r="94" fill="${a}" stroke="${o}" stroke-width="8"/>`:n==="square"?l=`<rect x="40" y="40" width="176" height="176" rx="40" fill="${a}" stroke="${o}" stroke-width="8"/>`:n==="diamond"?l=`<polygon points="128,24 224,128 128,232 32,128" fill="${a}" stroke="${o}" stroke-width="8" stroke-linejoin="round"/>`:n==="star"?l=`<polygon points="128,24 154,92 228,96 170,142 188,220 128,176 68,220 86,142 28,96 102,92" fill="${a}" stroke="${o}" stroke-width="8" stroke-linejoin="round"/>`:n==="heart"?l=`<path d="M128 220c-7-7-18-16-30-27C64 165 38 141 38 102c0-28 20-50 48-50 18 0 33 10 42 24 9-14 24-24 42-24 28 0 48 22 48 50 0 39-26 63-60 91-12 11-23 20-30 27Z" fill="${a}" stroke="${o}" stroke-width="8" stroke-linejoin="round"/>`:l=`<rect x="40" y="40" width="176" height="176" rx="40" fill="${a}" stroke="${o}" stroke-width="8"/>`,`data:image/svg+xml;charset=UTF-8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256">${l}</svg>`)}`}function c5(n){return[{id:"classic",title:n.classicTitle,items:[{id:"heart-eyes",emoji:"\u{1F60D}",label:`${n.emojiLabel} 1`},{id:"joy",emoji:"\u{1F602}",label:`${n.emojiLabel} 2`},{id:"grin",emoji:"\u{1F603}",label:`${n.emojiLabel} 3`},{id:"pray",emoji:"\u{1F64F}",label:`${n.emojiLabel} 4`},{id:"thumbs-up",emoji:"\u{1F44D}",label:`${n.emojiLabel} 5`},{id:"hundred",emoji:"\u{1F4AF}",label:`${n.emojiLabel} 6`},{id:"cat-smile",emoji:"\u{1F63A}",label:`${n.emojiLabel} 7`},{id:"cat-happy",emoji:"\u{1F638}",label:`${n.emojiLabel} 8`},{id:"paw",emoji:"\u{1F43E}",label:`${n.emojiLabel} 9`},{id:"fish",emoji:"\u{1F41F}",label:`${n.emojiLabel} 10`}]},{id:"vibe",title:n.vibeTitle,items:[{id:"sparkles",emoji:"\u2728",label:`${n.emojiLabel} 5`},{id:"heart",emoji:"\u{1F497}",label:`${n.emojiLabel} 6`},{id:"fire",emoji:"\u{1F525}",label:`${n.emojiLabel} 7`},{id:"party",emoji:"\u{1F389}",label:`${n.emojiLabel} 8`}]},{id:"shape",title:n.shapeTitle,items:[{id:"triangle",src:sl("triangle","#f97316"),label:"Triangle"},{id:"circle",src:sl("circle","#22c55e"),label:"Circle"},{id:"square",src:sl("square","#3b82f6"),label:"Square"},{id:"diamond",src:sl("diamond","#8b5cf6"),label:"Diamond"},{id:"star",src:sl("star","#facc15"),label:"Star"},{id:"heart-shape",src:sl("heart","#fb7185"),label:"Heart"}]}]}function d5(n){const a=Jr(n),o={...Rg.en,...Rg[a]??{}};return o.searchFont||(o.searchFont=a==="zh-Hant"?"\u641C\u5C0B\u5B57\u9AD4...":a==="zh"?"\u641C\u7D22\u5B57\u4F53...":"Search font..."),o.loadingFonts||(o.loadingFonts=a==="zh-Hant"?"\u6B63\u5728\u8B80\u53D6\u5B57\u9AD4...":a==="zh"?"\u6B63\u5728\u8BFB\u53D6\u5B57\u4F53...":"Loading fonts..."),o.noFonts||(o.noFonts=a==="zh-Hant"?"\u627E\u4E0D\u5230\u5B57\u9AD4":a==="zh"?"\u6CA1\u6709\u627E\u5230\u5B57\u4F53":"No fonts found"),o.sampleText||(o.sampleText=wg),o}function m5(n){const a=Jr(n);return{...Ig.en,...Ig[a]??{}}}var Vg={en:{tool:"Annotate",title:"Annotate",hint:"Configure the annotation tools here.",tools:"Tools",color:"Color",custom:"Custom",width:"Line width",reset:"Reset",brush:"Brush",eraser:"Eraser",line:"Line",arrow:"Arrow",rectangle:"Rectangle",ellipse:"Ellipse"},zh:{tool:"\u6807\u6CE8",title:"\u6807\u6CE8",hint:"\u5728\u8FD9\u91CC\u914D\u7F6E\u6807\u6CE8\u5DE5\u5177\u7684\u6837\u5F0F\u53C2\u6570\u3002",tools:"\u5DE5\u5177",color:"\u989C\u8272",custom:"\u81EA\u5B9A\u4E49",width:"\u7EBF\u5BBD",reset:"\u91CD\u7F6E",brush:"\u753B\u7B14",eraser:"\u6A61\u76AE",line:"\u76F4\u7EBF",arrow:"\u7BAD\u5934",rectangle:"\u77E9\u5F62",ellipse:"\u692D\u5706"},"zh-Hant":{tool:"\u6A19\u8A3B",title:"\u6A19\u8A3B",hint:"\u5728\u9019\u88E1\u8A2D\u5B9A\u6A19\u8A3B\u5DE5\u5177\u7684\u6A23\u5F0F\u53C3\u6578\u3002",tools:"\u5DE5\u5177",color:"\u984F\u8272",custom:"\u81EA\u8A02",width:"\u7DDA\u5BEC",reset:"\u91CD\u8A2D",brush:"\u756B\u7B46",eraser:"\u6A61\u76AE",line:"\u76F4\u7DDA",arrow:"\u7BAD\u982D",rectangle:"\u77E9\u5F62",ellipse:"\u6A62\u5713"}};function f5(n){const a=Jr(n);return Vg[a]??Vg.en}var Wg=[{key:"brush"},{key:"eraser"},{key:"line"},{key:"arrow"},{key:"rectangle"},{key:"ellipse"}],Ns=2,_s=24,ul=14,p5={brush:"pen",line:"line",arrow:"arrow",rectangle:"rect",ellipse:"ellipse"},qg=["#ffffff","#ff4d4f","#ff7a45","#ffa940","#fadb14","#95de64","#52c41a","#13c2c2","#40a9ff","#2f54eb","#7c7cf0","#eb2f96","#722ed1","#000000"],Pi={tool:"brush",color:"#ff4d4f",width:4};function h5(n){switch(n){case"eraser":return'<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M7.2 15.8 14.9 8a1.8 1.8 0 0 1 2.6 0l2.6 2.6a1.8 1.8 0 0 1 0 2.6l-5.3 5.3a2.4 2.4 0 0 1-1.7.7h-4a2.4 2.4 0 0 1-1.7-.7l-1-1a1.2 1.2 0 0 1 0-1.7Z" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linejoin="round"/><path d="M13.1 19.2h6.2" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/></svg>';case"line":return'<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M5 19 19 5" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round"/></svg>';case"arrow":return'<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M5 16 15 6" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round"/><path d="M10.5 6H15v4.5" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"/></svg>';case"rectangle":return'<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><rect x="5.5" y="5.5" width="13" height="13" rx="1.8" fill="none" stroke="currentColor" stroke-width="1.8"/></svg>';case"ellipse":return'<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><ellipse cx="12" cy="12" rx="6.6" ry="6.6" fill="none" stroke="currentColor" stroke-width="1.8"/></svg>';default:return'<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="m8.2 15.8 7.9-7.9a1.9 1.9 0 0 1 2.7 2.7l-7.9 7.9" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/><path d="M7.5 16.5c-.5 2.5-2.4 3.8-3.8 4 .2-1.5 1.5-3.3 4-3.8Z" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"/></svg>'}}function v5(){return'<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="m5 19 3.9-1 9.2-9.2a1.8 1.8 0 0 0 0-2.6l-.3-.3a1.8 1.8 0 0 0-2.6 0L6 15.1 5 19Z" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/><path d="m13.7 7.3 3 3" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/><path d="m5 19 3.3-3.3" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/></svg>'}function Zg(n,a){switch(n?.type){case"pen":return a.brush;case"line":return a.line;case"arrow":return a.arrow;case"rect":return a.rectangle;case"ellipse":return a.ellipse;default:return a.tool}}function yc(n=Pi){const a=Wg.some(l=>l.key===n?.tool)?n.tool:Pi.tool,o=Xg(n?.color);return{tool:a,color:o,width:qe(Math.round(Number(n?.width)||Pi.width),Ns,_s)}}function xf(n,a){return n?.tool===a?.tool&&n?.color===a?.color&&Number(n?.width)===Number(a?.width)}function Ug(n){return xf(n,Pi)}function g5(n){return`${qe(Math.round(Number(n)||Pi.width),Ns,_s)}px`}function Xg(n){const a=String(n??"").trim().toLowerCase();return/^#?[0-9a-f]{3}$/.test(a)?`#${a.replace("#","").split("").map(o=>`${o}${o}`).join("")}`:/^#?[0-9a-f]{6}$/.test(a)?`#${a.replace("#","")}`:Pi.color}function xc(n){const a=Xg(n);return{r:Number.parseInt(a.slice(1,3),16),g:Number.parseInt(a.slice(3,5),16),b:Number.parseInt(a.slice(5,7),16)}}function wc(n,a,o){return`#${[n,a,o].map(l=>qe(Math.round(Number(l)||0),0,255).toString(16).padStart(2,"0")).join("")}`}function wf(n,a,o){const l=qe(Number(n)||0,0,255)/255,s=qe(Number(a)||0,0,255)/255,d=qe(Number(o)||0,0,255)/255,m=Math.max(l,s,d),h=Math.min(l,s,d),g=m-h;let v=0;return g>0&&(m===l?v=60*((s-d)/g%6):m===s?v=60*((d-l)/g+2):v=60*((l-s)/g+4)),v<0&&(v+=360),{h:v,s:m<=0?0:g/m,v:m}}function Ef(n,a,o){const l=((Number(n)||0)%360+360)%360,s=qe(Number(a)||0,0,1),d=qe(Number(o)||0,0,1),m=d*s,h=l/60,g=m*(1-Math.abs(h%2-1));let v=0,w=0,W=0;h>=0&&h<1?(v=m,w=g):h<2?(v=g,w=m):h<3?(w=m,W=g):h<4?(w=g,W=m):h<5?(v=g,W=m):(v=m,W=g);const S=d-m;return{r:Math.round((v+S)*255),g:Math.round((w+S)*255),b:Math.round((W+S)*255)}}function b5(n){const a=Ef(n,1,1);return wc(a.r,a.g,a.b)}var y5=["none","sepia","cool","warm","vivid","bw"],cl={brightness:0,contrast:0,saturation:0,temperature:0,tint:0,vibrance:0,gamma:0,highlights:0,shadows:0,whites:0,blacks:0,lightSense:0,sharpen:0,clarity:0,grain:0,fade:0,vignette:0},kf=Object.keys(cl);function Kg(n){return[{title:n.colorSection,items:[{key:"temperature",label:n.temperature,format:"offset",min:-1,max:1},{key:"tint",label:n.tint,format:"offset",min:-1,max:1},{key:"saturation",label:n.saturation,format:"percent",min:-1,max:1},{key:"vibrance",label:n.vibrance,format:"offset",min:-1,max:1},{key:"gamma",label:n.gamma,format:"percent",min:-1,max:1}]},{title:n.toneSection,items:[{key:"brightness",label:n.brightness,format:"percent",min:-1,max:1},{key:"contrast",label:n.contrast,format:"percent",min:-1,max:1},{key:"highlights",label:n.highlights,format:"offset",min:-1,max:1},{key:"shadows",label:n.shadows,format:"offset",min:-1,max:1},{key:"whites",label:n.whites,format:"offset",min:-1,max:1},{key:"blacks",label:n.blacks,format:"offset",min:-1,max:1},{key:"lightSense",label:n.lightSense,format:"offset",min:-1,max:1}]},{title:n.effectsSection,items:[{key:"sharpen",label:n.sharpen,format:"amount",min:0,max:1},{key:"clarity",label:n.clarity,format:"amount",min:0,max:1},{key:"grain",label:n.grain,format:"amount",min:0,max:1},{key:"fade",label:n.fade,format:"amount",min:0,max:1},{key:"vignette",label:n.vignette,format:"amount",min:0,max:1}]}]}function x5(n){if(typeof n.applyMut=="function"){n.applyMut(a=>({...a,filters:{...a.filters,...cl}}));return}n.setFilters({...cl})}function w5(n){const a=new Map(O0.map(o=>[o.id,o]));return y5.map(o=>{if(o==="none")return{id:"",css:"",label:n.presetNames.none};const l=a.get(o);return l?{...l,label:n.presetNames[o]??l.label??o}:null}).filter(Boolean)}function Gg(n,a="percent"){if(a==="offset"){const o=Math.round((Number(n)||0)*100);return o>0?`+${o}`:`${o}`}return a==="amount"?`${Math.round((Number(n)||0)*100)}%`:`${Math.round((1+(Number(n)||0))*100)}%`}function Cf(n){return[n?.textContent,n?.getAttribute?.("title"),n?.getAttribute?.("aria-label")].filter(Boolean).join(" ").trim().toLowerCase()}function Sf(n){return n instanceof HTMLButtonElement?(n.dataset.meTrimHidden="true",n):n??null}function E5(n){return n instanceof HTMLButtonElement?(n.dataset.meAnnotateHidden="true",n):n??null}function Ec(n){const a=["trim","timeline","\u526A\u8F91","\u65F6\u95F4\u8F74"];return Sf(n.find(o=>{const l=Cf(o);return a.some(s=>l.includes(s))})??n[0]??null)}function k5(n){const a=["annotate","annotation","markup","draw","doodle","\u6807\u6CE8","\u5857\u9E26","\u5857\u9D09"];return E5(n.find(o=>{const l=Cf(o);return a.some(s=>l.includes(s))})??null)}function Yg(n,a,o){try{const l=document.createElement("canvas");l.width=208,l.height=118;const s=l.getContext("2d");if(!s)return"";const d=a/o,m=l.width/l.height;let h=0,g=0,v=a,w=o;return d>m?(v=o*m,h=(a-v)/2):d<m&&(w=a/m,g=(o-w)/2),s.drawImage(n,h,g,v,w,0,0,l.width,l.height),l.toDataURL("image/jpeg",.82)}catch{return""}}function C5(n){const a=n.querySelector(".me-video-canvas-stage canvas");if(a instanceof HTMLCanvasElement&&a.width>8&&a.height>8)return Yg(a,a.width,a.height);const o=n.querySelector("video");return o instanceof HTMLVideoElement&&o.videoWidth>8&&o.videoHeight>8?Yg(o,o.videoWidth,o.videoHeight):""}function S5(n){const a=String(n??"").split(":").map(s=>Number(s));if(a.length!==2)return null;const[o,l]=a;return!(o>0)||!(l>0)?null:o/l}function kc(n,a=1080){const o=S5(n)??1;return o>=1?{w:Math.max(2,Kn(a*o)),h:Math.max(2,Kn(a))}:{w:Math.max(2,Kn(a)),h:Math.max(2,Kn(a/o))}}function F5(){return l5.map(n=>({...n,ratios:n.ratios.map(a=>({ratio:a,...kc(a)}))}))}function Jg(n){return`${n.platform} ${n.type}`}function M5(n){switch(n.id){case"facebook-post":return"FB Post";case"facebook-story":return"FB Story";case"instagram-post":return"IG Post";case"instagram-story":return"IG Story";case"tiktok-photo":return"TikTok";case"x-post":return"X Post";case"linkedin-post":return"LinkedIn";case"pinterest-post":return"Pinterest";case"reddit-media":return"Reddit";case"threads-post":return"Threads";case"telegram-post":return"Telegram";default:return Jg(n)}}function L5(n){return s5.map(a=>{const o=kc(a),l=n.filter(s=>s.ratios.some(d=>d.ratio===a));return l.length?{ratio:a,...o,groups:l,hint:l.map(s=>Jg(s)).join(" / "),tags:l.map(s=>M5(s))}:null}).filter(Boolean)}function dl(n){return`${Math.max(2,Kn(n?.w??0))} x ${Math.max(2,Kn(n?.h??0))} px`}function Qg(n){const a=n?.canvas??{w:1080,h:1920};return oo(a,{...n,scale:void 0})}function Ts(n){return n?.scale?{w:Math.max(2,Kn(n.scale.width)),h:Math.max(2,Kn(n.scale.height))}:Qg(n)}function Ff(n){return n==="contain"||n==="force"?n:"cover"}function ji(n,a){const o=Number(n),l=Number.isFinite(o)&&o>0?o:a;return Math.max(2,Kn(l||2))}function A5(n,a){const o=Math.max(2,Kn(a?.w??0)),l=Math.max(2,Kn(a?.h??0));return n.find(s=>Math.abs(s.w-o)<=2&&Math.abs(s.h-l)<=2)??null}function N5(n,a){switch(Ff(a)){case"contain":return n.containHint;case"force":return n.forceHint;default:return n.coverHint}}function Cc(n,a){n.replaceChildren();for(const o of a){const l=document.createElement("option");l.value=o.value,l.textContent=o.label,n.appendChild(l)}}function Bs(n=[],a=[]){const o=typeof Intl<"u"?new Intl.Collator(void 0,{sensitivity:"base",numeric:!0}):null,l=new Set;return[...n,...a].map(s=>String(s??"").trim()).filter(Boolean).filter(s=>{const d=s.toLowerCase();return l.has(d)?!1:(l.add(d),!0)}).sort((s,d)=>o?o.compare(s,d):s.localeCompare(d))}function Mf(n){return`"${String(n??"").replace(/\\/g,"\\\\").replace(/"/g,'\\"')}", ${dc}`}function Sc(n){const a=String(n??"").trim();return Sw[a]||a}function Lf(n){const a=String(n??"").trim(),o=Sc(a);return o&&o!==a?`${o} (${a})`:a}function _5(n){const a=String(n??"").trim();return`${a} ${Sc(a)} ${Lf(a)}`.toLowerCase()}function eb(n){return/[\u3400-\u9fff\uf900-\ufaff]/.test(String(n??""))}function T5(n){const a=String(n??"").trim().toLowerCase();return a?Fw.some(o=>a.includes(o))?!0:eb(Sc(n)):!1}function B5(n,a=!1){const o=Bs(n);if(!a)return o;const l=[],s=[];for(const d of o)T5(d)?l.push(d):s.push(d);return[...l,...s]}async function D5(){return rf||(rf=(async()=>{const n=Bs(gg);if(typeof window>"u"||typeof window.queryLocalFonts!="function")return n;try{const a=(await window.queryLocalFonts()).map(o=>o?.family||o?.fullName||"").filter(Boolean);return Bs(a,n)}catch{return n}})(),rf)}function z5(n){const a=document.createElement("div");a.className="me-video-font-picker";const o=document.createElement("button");o.type="button",o.className="me-video-font-picker-trigger";const l=document.createElement("span");l.className="me-video-font-picker-label";const s=document.createElement("span");s.className="me-video-font-picker-chevron",s.textContent="v",o.append(l,s);const d=document.createElement("div");d.className="me-video-font-picker-dropdown",d.hidden=!0;const m=document.createElement("label");m.className="me-video-font-picker-search";const h=document.createElement("span");h.className="me-video-font-picker-search-icon",h.innerHTML='<svg viewBox="0 0 16 16" fill="none" aria-hidden="true"><circle cx="7" cy="7" r="4.5" stroke="currentColor" stroke-width="1.4"></circle><path d="M10.5 10.5L14 14" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"></path></svg>';const g=document.createElement("input");g.type="search",g.className="me-video-font-picker-search-input",g.placeholder=n.searchFont,g.autocomplete="off",g.spellcheck=!1;const v=document.createElement("div");v.className="me-video-font-picker-list",m.append(h,g),d.append(m,v),a.append(o,d);let w=!1,W=!1,S=!1,J="Arial",Y=Bs(gg),ue=!1;const oe=typeof requestAnimationFrame=="function"?requestAnimationFrame:se=>setTimeout(se,0);function ge(){J||(J="Arial"),Y=Bs(Y,[J])}function Be(se){const me=document.createElement("div");return me.className="me-video-font-picker-message",me.textContent=se,me}function Te(se){const me=document.createElement("button");me.type="button",me.className="me-video-font-picker-option",se===J&&me.classList.add("is-active"),me.dataset.family=se;const O=document.createElement("span");O.className="me-video-font-picker-option-name",O.textContent=Lf(se),O.style.fontFamily=Mf(se);const $=document.createElement("span");return $.className="me-video-font-picker-option-preview",$.textContent=n.sampleText||wg,$.style.fontFamily=Mf(se),me.append(O,$),me.addEventListener("click",()=>{k(se),a.dispatchEvent(new CustomEvent("fontchange",{detail:{value:se}})),ve(!1),o.focus()}),me}function de(){const se=J||"Arial";l.textContent=Sc(se),l.style.fontFamily=Mf(J||"Arial"),o.title=Lf(se),o.disabled=W}function Ae(){if(v.replaceChildren(),!w)return;if(S){v.appendChild(Be(n.loadingFonts));return}ge();const se=String(g.value??"").trim().toLowerCase(),me=B5(Y.filter(O=>!se||_5(O).includes(se)),ue);if(!me.length){v.appendChild(Be(n.noFonts));return}for(const O of me)v.appendChild(Te(O))}function ve(se){W&&se||(w=!!se,a.classList.toggle("is-open",w),d.hidden=!w,w?oe(()=>{g.focus(),g.select()}):g.value="",Ae())}async function P(){if(!S){S=!0,Ae();try{Y=await D5(),ge()}finally{S=!1,Ae()}}}function k(se,{silent:me=!1}={}){J=String(se??"").trim()||"Arial",ge(),de(),!me&&w&&Ae()}function H(){return J||"Arial"}function T(se){W=!!se,W&&ve(!1),de(),g.disabled=W}function _(se){const me=eb(se);ue!==me&&(ue=me,w&&Ae())}function le(se){w&&(a.contains(se.target)||ve(!1))}return o.addEventListener("click",async()=>{const se=!w;ve(se),se&&await P()}),g.addEventListener("input",()=>Ae()),document.addEventListener("pointerdown",le,!0),k("Arial",{silent:!0}),T(!1),{wrap:a,setValue:k,getValue:H,setDisabled:T,setContextText:_,destroy(){document.removeEventListener("pointerdown",le,!0)}}}function P5(n){const a=String(n??"").trim().toLowerCase();return/^#([0-9a-f]{3}|[0-9a-f]{6})$/.test(a)?a.length===7?a:`#${a.slice(1).split("").map(o=>`${o}${o}`).join("")}`:null}function Oi(n,a="#ffffff"){const o=String(n??"").trim();if(!o)return a;if(o.toLowerCase()==="transparent")return"transparent";const l=P5(o);if(l)return l;const s=o.match(/^rgba?\(([^)]+)\)$/i);if(s){const d=s[1].split(",").slice(0,3).map(m=>qe(Math.round(Number(m.trim())||0),0,255));if(d.length===3)return`#${d.map(m=>m.toString(16).padStart(2,"0")).join("")}`}return a}function rr(n,a,o=""){const l=document.createElement("div");l.className=`me-video-text-row${o?` ${o}`:""}`;const s=document.createElement("label");return s.className="me-video-text-row-label",s.textContent=n,l.append(s,a),l}function ta(n){const a=document.createElement("section");a.className="me-video-text-section";const o=document.createElement("h4");o.className="me-video-text-section-title",o.textContent=n;const l=document.createElement("div");return l.className="me-video-text-section-body",a.append(o,l),{section:a,body:l,title:o}}function Fc({allowTransparent:n=!1,fallback:a="#ffffff",transparentLabel:o="Transparent"}={}){const l=document.createElement("div");l.className="me-video-text-color-control";const s=document.createElement("input");s.type="color",s.className="me-video-text-color-swatch",s.value=Oi(a,"#ffffff");const d=document.createElement("input");d.type="text",d.className="me-video-text-input me-video-text-color-text",d.spellcheck=!1,l.append(s,d);let m=null;n&&(m=document.createElement("button"),m.type="button",m.className="me-video-text-toggle me-video-text-transparent-toggle",m.textContent=o,l.appendChild(m));function h(){return l.dataset.transparent==="true"}function g(S){l.dataset.transparent=S?"true":"false",m?.classList.toggle("is-active",S),s.disabled=S,S?d.value="transparent":(!d.value||d.value==="transparent")&&(d.value=s.value||Oi(a,"#ffffff"))}function v(S){if(n&&String(S??"").trim().toLowerCase()==="transparent"){g(!0);return}const J=Oi(S,Oi(a,"#ffffff"));s.value=J==="transparent"?Oi(a,"#ffffff"):J,d.value=J==="transparent"?"transparent":J,n&&g(J==="transparent")}function w(){return n&&h()?"transparent":Oi(d.value||s.value,s.value||Oi(a,"#ffffff"))}function W(S){s.disabled=S||n&&h(),d.disabled=S,m&&(m.disabled=S)}return v(a),{wrap:l,swatch:s,text:d,transparentButton:m,setTransparent:g,setValue:v,getValue:w,setDisabled:W}}function Mc(n){const a=n.querySelector(".me-video-workspace");if(!a)return null;let o=a.querySelector(".me-video-inspector-rail");return o||(o=document.createElement("aside"),o.className="me-video-inspector-rail",o.hidden=!0,a.appendChild(o)),o}function za(n,a){const o=Mc(n);return o?(a.parentElement!==o&&o.appendChild(a),o):null}function br(n){const a=Mc(n);if(!a)return;const o=[...a.children].some(l=>l instanceof HTMLElement&&!l.hidden);a.hidden=!o}function tb(n,a,o){const l=Mc(n);if(!(!l||!(a instanceof HTMLElement))){for(const s of l.children)if(!(!(s instanceof HTMLElement)||s===a)){if(o){s.dataset.meInspectorPrevHidden||(s.dataset.meInspectorPrevHidden=s.hidden?"true":"false"),s.hidden=!0;continue}Object.prototype.hasOwnProperty.call(s.dataset,"meInspectorPrevHidden")&&(s.hidden=s.dataset.meInspectorPrevHidden==="true",delete s.dataset.meInspectorPrevHidden)}}}function nb(n){return new Set(String(n??"").split(/\s+/).map(a=>a.trim()).filter(Boolean))}function j5(n){return[...n].join(" ").trim()}function O5(n,a,o,l){wa(),nl();const s=l(),d=kg(s),m=d.text,h=d5(s),g=document.createElement("div");g.className="me-video-text-panel",g.hidden=!0,n.appendChild(g);const v=document.createElement("div");v.className="me-video-text-toolbar";const w=document.createElement("strong");w.textContent=m.tool;const W=Hr(m.addText),S=Hr(m.moveOnCanvas),J=Hr(m.duplicate),Y=Hr(m.delete);Y.classList.add("me-video-text-danger");const ue=Hr(m.close);v.append(w);const oe=document.createElement("div");oe.className="me-video-text-list";const ge=document.createElement("div");ge.className="me-video-text-empty",ge.textContent=m.empty;const Be=document.createElement("textarea");Be.className="me-video-text-input me-video-text-textarea",Be.placeholder=m.placeholder;const Te=document.createElement("select");Te.className="me-video-text-select",Cc(Te,[{value:"none",label:h.none},{value:"heading",label:m.heading},{value:"subtitle",label:m.subtitle},{value:"label",label:m.label}]);const de=z5(h),Ae=document.createElement("select");Ae.className="me-video-text-select",Cc(Ae,o5);const ve=document.createElement("input");ve.type="number",ve.min="8",ve.max="320",ve.step="1",ve.className="me-video-text-input";const P=Fc({fallback:"#ffffff"}),k=Fc({allowTransparent:!0,fallback:"#111111",transparentLabel:h.transparent}),H=document.createElement("div");H.className="me-video-text-inline";const T=[{value:"left",label:h.alignLeft},{value:"center",label:h.alignCenter},{value:"right",label:h.alignRight}].map(z=>{const ie=document.createElement("button");return ie.type="button",ie.className="me-video-text-align",ie.dataset.align=z.value,ie.textContent=z.label,H.appendChild(ie),{value:z.value,button:ie}}),_=document.createElement("div");_.className="me-video-text-toggle-group";const le=document.createElement("button");le.type="button",le.className="me-video-text-toggle is-italic",le.title=h.italic,le.textContent="I";const se=document.createElement("button");se.type="button",se.className="me-video-text-toggle is-underline",se.title=h.underline,se.textContent="U";const me=document.createElement("button");me.type="button",me.className="me-video-text-toggle is-strike",me.title=h.strike,me.textContent="S",_.append(le,se,me);const O=document.createElement("select");O.className="me-video-text-select",Cc(O,[{value:"none",label:h.caseNone},{value:"uppercase",label:h.uppercase},{value:"lowercase",label:h.lowercase},{value:"capitalize",label:h.capitalize}]);const $=document.createElement("div");$.className="me-video-text-slider-row";const M=document.createElement("input");M.type="number",M.min="0",M.max="100",M.step="1",M.className="me-video-text-input";const A=document.createElement("input");A.type="range",A.min="0",A.max="100",A.step="1",$.append(M,A);const ee=document.createElement("select");ee.className="me-video-text-select",Cc(ee,[{value:"none",label:h.none}]);const Me=Fc({fallback:"#000000"}),_e=document.createElement("input");_e.type="number",_e.min="0",_e.max="32",_e.step="1",_e.className="me-video-text-input";const x=Fc({fallback:"#000000"}),C=document.createElement("input");C.type="number",C.min="-80",C.max="80",C.step="1",C.className="me-video-text-input";const j=document.createElement("input");j.type="number",j.min="-80",j.max="80",j.step="1",j.className="me-video-text-input";const B=document.createElement("input");B.type="number",B.min="0",B.max="80",B.step="1",B.className="me-video-text-input";const G=document.createElement("div");G.className="me-video-text-section-body",G.append(rr(m.content,Be,"is-area"),rr(h.preset,Te));const De=ta(h.styles);De.body.append(rr(m.font,de.wrap),rr(m.weight,Ae),rr(h.size,ve),rr(m.color,P.wrap),rr(h.fill,k.wrap),rr(m.align,H),rr(h.decoration,_),rr(h.case,O),rr(m.opacity,$));const Q=ta(h.animations);Q.body.append(rr(h.animation,ee));const te=ta(h.fontStroke);te.body.append(rr(m.color,Me.wrap),rr(h.size,_e));const U=ta(h.fontShadow);U.body.append(rr(m.color,x.wrap),rr(h.x,C),rr(h.y,j),rr(h.blur,B)),g.append(v,ge,G,De.section,Q.section,te.section,U.section);let xe=null,Ce=null,Ze=null,et=null,lt=null,ot=null,gt=null,Qt=null,_t=!1,xt=null,Zt=!1,tn=!1;const _n="text",st=typeof requestAnimationFrame=="function"?requestAnimationFrame:z=>setTimeout(z,16),Ge=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>Pe()),mt=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>Pe()),Rt=[{key:"tl",x:0,y:0},{key:"tm",x:.5,y:0},{key:"tr",x:1,y:0},{key:"mr",x:1,y:.5},{key:"br",x:1,y:1},{key:"bm",x:.5,y:1},{key:"bl",x:0,y:1},{key:"ml",x:0,y:.5}],Vt={key:"rotate",x:.5,y:0};function kn(){Promise.resolve().then(()=>{tn=!1;const z=n.__meVideoEnhancerObserverLock??0;n.__meVideoEnhancerObserverLock=Math.max(0,z-1)})}function xn(z){tn=!0,n.__meVideoEnhancerObserverLock=(n.__meVideoEnhancerObserverLock??0)+1;try{return z()}finally{kn()}}function Pe(){Zt||(Zt=!0,st(()=>{Zt=!1,Lt()}))}function dt(z){const ie=!!z;if(ie===_t){Lt();return}_t=ie,_t&&n.dispatchEvent(new CustomEvent("me-video-inspector-open",{detail:{id:_n}})),Lt()}function yt(){return Ce?[...Ce.querySelectorAll("button")].filter(z=>z!==xe&&!z.classList.contains("me-video-text-tool")):[]}function pt(){yt()[0]?.click()}function Mt(){if(!xe)return;const z=ks(o());xe.dataset.theme=z}function dn(){za(n,g),br(n)}function Ut(){g.hidden=!_t,xe&&xe.classList.toggle("is-active",_t),dn()}function An(z){if(!z.length){xt=null;return}const ie=hf(n,a.getState());xt=ie.length?ie[ie.length-1]:null}function K(){const z=a.getState().overlays??[];if(xt==null)return null;const ie=z[xt];return ie?.type==="text"?ie:null}function Le(){return ol(a)}function Xe(){return co(n)}function Tt(){if(!a.history?.present)return;const z=Xe(),ie=Number(a.history.present.__mePreviewTimelineTime);Math.abs((Number.isFinite(ie)?ie:-1)-z)<.001||(a.history={...a.history,present:{...a.history.present,__mePreviewTimelineTime:z}},typeof a.emit=="function"&&a.emit())}function rn(z,ie,Oe={}){const E=(a.getState().overlays??[])[z];!E||E.type!=="text"||a.updateOverlay(z,ma(E,Le(),ie),Oe)}function Ot(z){if(typeof a.applyMut=="function"){a.applyMut(Oe=>({...Oe,overlays:[...Da(Oe.overlays),{...z,timelineTrack:0}]}));return}const ie=Da(a.getState().overlays);a.commit?.({overlays:[...ie,{...z,timelineTrack:0}]})}function nn(z,ie={}){if(xt==null)return;const Oe=ie.preservePreset||Object.prototype.hasOwnProperty.call(z,"textPreset")?z:{...z,textPreset:"none"};a.updateOverlay(xt,Oe)}function wn(z="heading"){const ie=Le();let Oe=qe(Xe(),0,Math.max(0,ie-Pt)),E=Math.min(ie,Oe+Qr);E-Oe<Pt&&(Oe=qe(ie-Qr,0,Math.max(0,ie-Pt)),E=Math.max(Oe+Pt,ie));const F={...Mg(a,d,z),...ma(null,ie,{startAt:Oe,endAt:E,timelineTrack:0})};Ot(F);const p=a.getState().overlays??[];xt=p.length?p.length-1:null,xt!=null&&qn(n,"text",[xt]),pt(),dt(!0)}function Z(){const z=a.getState(),ie=vf(z.overlays??[],hf(n,z));ie.changed&&(a.commit({overlays:ie.overlays}),xt=ie.selection.length?ie.selection[ie.selection.length-1]:null,qn(n,"text",ie.selection),Lt())}function fe(){const z=a.getState(),ie=gf(z.overlays??[],hf(n,z));ie.changed&&(a.commit({overlays:ie.overlays}),xt=null,qn(n,"text",[]),Lt())}function Ne(z){if(!K()){wn(z);return}const ie=Mg(a,d,z);nn({text:ie.text,fontSize:ie.fontSize,width:ie.width,fontWeight:ie.fontWeight,fontFamily:ie.fontFamily,fontStyle:ie.fontStyle,textAlign:ie.textAlign,color:ie.color,backgroundColor:ie.backgroundColor,borderColor:ie.borderColor,borderWidth:ie.borderWidth,paddingX:ie.paddingX,paddingY:ie.paddingY,lineHeight:ie.lineHeight,boxShadow:ie.boxShadow?{...ie.boxShadow}:void 0,textDecoration:ie.textDecoration??"",textTransform:ie.textTransform,animation:"none",textPreset:z},{preservePreset:!0})}function Je(){const{timelineInner:z,timelineHost:ie}=Ms(n,a.getState());if(!z||!ie){et?.remove(),et=null,Ge&<&&(Ge.unobserve(lt),lt=null),Ze=null;return}Ze=z,(!et||!et.isConnected||et.parentElement!==ie)&&(et?.remove(),et=document.createElement("div"),et.className="me-video-text-timeline me-video-overlay-timeline me-video-text-overlay-layer");for(const Oe of[...ie.children])Oe!==et&&Oe instanceof HTMLElement&&Oe.classList.contains("me-video-text-overlay-layer")&&Oe.remove();(et.parentElement!==ie||ie.lastElementChild!==et)&&ie.appendChild(et),Ge&<!==Ze&&(lt&&Ge.unobserve(lt),lt=Ze,Ge.observe(Ze))}function Et(){const z=n.querySelector(".me-video-canvas-stage");if(!z){gt?.remove(),gt=null,mt&&Qt&&(mt.unobserve(Qt),Qt=null),ot=null;return}ot=z,ot.style.position="relative",!gt||!gt.isConnected||gt.parentElement!==ot?(gt?.remove(),gt=document.createElement("div"),gt.className="me-video-text-canvas-layer",gt.addEventListener("pointerdown",ie=>{ie.target===gt&&(ie.preventDefault(),ie.stopPropagation())}),gt.addEventListener("click",ie=>{ie.target===gt&&(ie.preventDefault(),ie.stopPropagation(),xt=null,mf(n),_t?dt(!1):Lt())}),ot.appendChild(gt)):ot.lastElementChild!==gt&&ot.appendChild(gt),mt&&Qt!==ot&&(Qt&&mt.unobserve(Qt),Qt=ot,mt.observe(ot))}function D(){if(!ot)return null;const z=a.getState().canvas??{},ie=Math.max(1,Number(z.w)||0),Oe=Math.max(1,Number(z.h)||0);if(!ie||!Oe)return null;const E=ot.getBoundingClientRect(),F=ot.querySelector("canvas, video, img")||[...ot.children].find(Ee=>Ee!==gt)||null;let p=0,b=0,L=ot.clientWidth||ie,q=ot.clientHeight||Oe;if(F instanceof HTMLElement){const Ee=F.getBoundingClientRect();Ee.width>0&&Ee.height>0&&(p=Ee.left-E.left,b=Ee.top-E.top,L=Ee.width,q=Ee.height)}if(!(L>0&&q>0)){const Ee=ot.clientWidth||ie,be=ot.clientHeight||Oe,je=Math.min(Ee/ie,be/Oe)||1;L=ie*je,q=Oe*je,p=Math.max(0,(Ee-L)/2),b=Math.max(0,(be-q)/2)}return{stageLeft:E.left,stageTop:E.top,left:p,top:b,scaleX:L/ie,scaleY:q/Oe}}function V(z,ie){const Oe=Cn(z),E=Tr(z,Oe);return ie>=Oe-.001&&ie<=E+.001}function Fe(z,ie,Oe){const E=gr(n,"text",z,ie,Oe);xt=E.length?E[E.length-1]:null,dt(!0),Lt()}function He(z,ie,Oe){return{x:(z-Oe.stageLeft-Oe.left)/Oe.scaleX,y:(ie-Oe.stageTop-Oe.top)/Oe.scaleY}}function Ye(z,ie,Oe,E){return{x:Oe,y:E,fontSize:ie.fontSize,width:ie.width,paddingX:ie.paddingX,paddingY:ie.paddingY,borderWidth:ie.borderWidth,boxShadow:ie.boxShadow}}function ct(z,ie,Oe){const E=(a.getState().overlays??[])[z];if(!E||E.type!=="text")return;const F=a.getState().canvas??{w:1080,h:1920},p=Ir(E);if(!p)return;const b=ie.clientX,L=ie.clientY,q=Math.max(0,(Number(F.w)||0)-p.w),Ee=Math.max(0,(Number(F.h)||0)-p.h),be=(ke,Ve,We)=>{const ft=(ke-b)/Oe.scaleX,nt=(Ve-L)/Oe.scaleY,it=qe(p.x+ft,0,q),ht=qe(p.y+nt,0,Ee);a.updateOverlay(z,{x:it,y:ht},We?{transient:!0}:void 0)},je=ke=>{ke.preventDefault(),be(ke.clientX,ke.clientY,!0)},ae=ke=>{window.removeEventListener("pointermove",je),window.removeEventListener("pointerup",ae),window.removeEventListener("pointercancel",ae),be(ke.clientX,ke.clientY,!1)};window.addEventListener("pointermove",je),window.addEventListener("pointerup",ae),window.addEventListener("pointercancel",ae)}function kt(z,ie,Oe,E){const F=(a.getState().overlays??[])[z];if(!F||F.type!=="text")return;const p=Ir(F);if(!p)return;const b=a.getState().canvas??{w:1080,h:1920},L=ie.x===.5?.5:1-ie.x,q=ie.y===.5?.5:1-ie.y,Ee=p.x+p.w*L,be=p.y+p.h*q,je=Math.max(.1,24/Math.max(24,p.w),24/Math.max(24,p.h)),ae=ie.x===.5?1/0:Math.max(.1,(L===0?(Number(b.w)||0)-Ee:Ee)/Math.max(1,p.w)),ke=ie.y===.5?1/0:Math.max(.1,(q===0?(Number(b.h)||0)-be:be)/Math.max(1,p.h)),Ve=Math.max(je,Math.min(ae,ke,8)),We=(it,ht,wt)=>{const Bt=He(it,ht,E),jt=[];ie.x!==.5&&jt.push(Math.abs(Bt.x-Ee)/Math.max(1,p.w)),ie.y!==.5&&jt.push(Math.abs(Bt.y-be)/Math.max(1,p.h));const on=jt.length?Math.max(...jt):1,Rn=qe(on,je,Ve),cr=Zm(F,Rn),Mr=Ir(cr);if(!Mr)return;const ar=Ee-Mr.w*L,N=be-Mr.h*q;a.updateOverlay(z,Ye(F,cr,ar,N),wt?{transient:!0}:void 0)},ft=it=>{it.preventDefault(),We(it.clientX,it.clientY,!0)},nt=it=>{window.removeEventListener("pointermove",ft),window.removeEventListener("pointerup",nt),window.removeEventListener("pointercancel",nt),We(it.clientX,it.clientY,!1)};window.addEventListener("pointermove",ft),window.addEventListener("pointerup",nt),window.addEventListener("pointercancel",nt)}function rt(z,ie,Oe){const E=(a.getState().overlays??[])[z];if(!E||E.type!=="text")return;const F=Ir(E);if(!F)return;const p=Oe.stageLeft+Oe.left+(F.x+F.w/2)*Oe.scaleX,b=Oe.stageTop+Oe.top+(F.y+F.h/2)*Oe.scaleY,L=Math.atan2(ie.clientY-b,ie.clientX-p),q=da(E),Ee=(ae,ke,Ve,We)=>{const ft=Math.atan2(ke-b,ae-p);let nt=Es(q+(ft-L)*180/Math.PI);We&&(nt=Math.round(nt/15)*15),a.updateOverlay(z,{rotation:nt},Ve?{transient:!0}:void 0)},be=ae=>{ae.preventDefault(),Ee(ae.clientX,ae.clientY,!0,ae.shiftKey)},je=ae=>{window.removeEventListener("pointermove",be),window.removeEventListener("pointerup",je),window.removeEventListener("pointercancel",je),Ee(ae.clientX,ae.clientY,!1,ae.shiftKey)};window.addEventListener("pointermove",be),window.addEventListener("pointerup",je),window.addEventListener("pointercancel",je)}function at(z,ie){if(Et(),!gt)return;gt.replaceChildren();const Oe=D();if(!Oe){gt.hidden=!0;return}gt.hidden=!1;const E=Xe(),F=z.map(b=>b.index),p=z.filter(b=>V(b.overlay,E));for(const b of p){const L=Ir(b.overlay);if(!L)continue;const q=document.createElement("button");q.type="button",q.className="me-video-text-canvas-hit";const Ee=ie.has(b.index),be=Ee&&xt===b.index;Ee&&q.classList.add("is-active"),q.title=mc(b.overlay.text,d.untitledText),q.style.left=`${Oe.left+L.x*Oe.scaleX}px`,q.style.top=`${Oe.top+L.y*Oe.scaleY}px`,q.style.width=`${Math.max(18,L.w*Oe.scaleX)}px`,q.style.height=`${Math.max(18,L.h*Oe.scaleY)}px`;const je=da(b.overlay);if(je&&(q.style.transform=`rotate(${je}deg)`,q.style.transformOrigin="center center"),q.addEventListener("pointerdown",ae=>{if(ae.preventDefault(),ae.stopPropagation(),ae.shiftKey||ae.ctrlKey||ae.metaKey){Fe(b.index,ae,F);return}xt=b.index,qn(n,"text",[b.index]),dt(!0),ct(b.index,ae,Oe)}),be){for(const ke of Rt){const Ve=document.createElement("span");Ve.className="me-video-text-canvas-handle",Ve.dataset.handle=ke.key,Ve.style.left=`${ke.x*100}%`,Ve.style.top=`${ke.y*100}%`,Ve.addEventListener("pointerdown",We=>{We.preventDefault(),We.stopPropagation(),xt=b.index,qn(n,"text",[b.index]),dt(!0),kt(b.index,ke,We,Oe)}),q.appendChild(Ve)}const ae=document.createElement("span");ae.className="me-video-text-canvas-handle",ae.dataset.handle=Vt.key,ae.style.left=`${Vt.x*100}%`,ae.style.top=`${Vt.y*100}%`,ae.addEventListener("pointerdown",ke=>{ke.preventDefault(),ke.stopPropagation(),xt=b.index,qn(n,"text",[b.index]),dt(!0),rt(b.index,ke,Oe)}),q.appendChild(ae)}gt.appendChild(q)}}function Ke(z,ie,Oe){if(!Ze)return;const E=(a.getState().overlays??[])[z];if(!E||E.type!=="text")return;if(Oe.shiftKey||Oe.ctrlKey||Oe.metaKey){Oe.preventDefault(),Oe.stopPropagation();const ke=gr(n,"text",z,Oe,_g(a.getState()).map(Ve=>Ve.index));xt=ke.length?ke[ke.length-1]:null,pt(),dt(!0);return}Oe.preventDefault(),Oe.stopPropagation(),xt=z,qn(n,"text",[z]),pt(),_t||dt(!0);const F=Le(),p=Math.max(Ze.clientWidth/F,.001),b=Cn(E),L=Tr(E,b),q=Math.max(Pt,L-b),Ee=$n(E),be=Oe.clientX,je=ke=>{const Ve=(ke.clientX-be)/p,We=a.getState().overlays??[];if(ie==="move"){const it=Math.max(0,b+Ve),ht=it+q,wt=Nn(et,We,z,it,ht,ke.clientY,Ee);rn(z,{startAt:it,endAt:ht,timelineTrack:wt},{transient:!0});return}if(ie==="start"){const it=qe(b+Ve,0,L-Pt),ht=Nn(et,We,z,it,L,ke.clientY,Ee);rn(z,{startAt:it,endAt:L,timelineTrack:ht},{transient:!0});return}const ft=Math.max(b+Pt,L+Ve),nt=Nn(et,We,z,b,ft,ke.clientY,Ee);rn(z,{startAt:b,endAt:ft,timelineTrack:nt},{transient:!0})},ae=ke=>{window.removeEventListener("pointermove",je),window.removeEventListener("pointerup",ae),window.removeEventListener("pointercancel",ae);const Ve=(ke.clientX-be)/p,We=a.getState().overlays??[];if(ie==="move"){const it=Math.max(0,b+Ve),ht=it+q,wt=Nn(et,We,z,it,ht,ke.clientY,Ee);rn(z,{startAt:it,endAt:ht,timelineTrack:wt});return}if(ie==="start"){const it=qe(b+Ve,0,L-Pt),ht=Nn(et,We,z,it,L,ke.clientY,Ee);rn(z,{startAt:it,endAt:L,timelineTrack:ht});return}const ft=Math.max(b+Pt,L+Ve),nt=Nn(et,We,z,b,ft,ke.clientY,Ee);rn(z,{startAt:b,endAt:ft,timelineTrack:nt})};window.addEventListener("pointermove",je),window.addEventListener("pointerup",ae),window.addEventListener("pointercancel",ae),Lt()}function Nt(z,ie){if(Je(),!et||!Ze||(et.replaceChildren(),et.hidden=z.length===0,!z.length))return;const Oe=Le(),E=Ze.clientWidth/Oe,F=Ss(a.getState()),p=new Map;for(const b of z){const L=$n(b.overlay),q=F.get(L)??L;let Ee=p.get(L);Ee||(Ee=document.createElement("div"),Ee.className="me-video-overlay-track-row",Ee.dataset.track=String(L),Ee.style.top=`${il(q)}px`,p.set(L,Ee),et.appendChild(Ee));const be=document.createElement("div");be.className="me-video-text-track-clip",ie.has(b.index)&&be.classList.add("is-active");const je=Cn(b.overlay),ae=al(b.overlay);be.style.left=`${je*E}px`,be.style.width=`${Math.max(36,ae*E)}px`;const ke=document.createElement("span");ke.className="me-video-text-track-icon",ke.textContent="Aa";const Ve=document.createElement("span");Ve.className="me-video-text-track-label",Ve.textContent=mc(b.overlay.text,d.untitledText),Ve.title=Ve.textContent;const We=document.createElement("span");We.className="me-video-text-track-handle is-start";const ft=document.createElement("span");ft.className="me-video-text-track-handle is-end",be.append(ke,Ve,We,ft),be.addEventListener("pointerdown",nt=>Ke(b.index,"move",nt)),We.addEventListener("pointerdown",nt=>Ke(b.index,"start",nt)),ft.addEventListener("pointerdown",nt=>Ke(b.index,"end",nt)),be.addEventListener("click",nt=>{if(nt.preventDefault(),nt.stopPropagation(),nt.shiftKey||nt.ctrlKey||nt.metaKey){pt(),Lt();return}const it=gr(n,"text",b.index,nt,z.map(ht=>ht.index));xt=it.length?it[it.length-1]:null,pt(),dt(!0),Lt()}),Ee.appendChild(be)}}function Wt(z,ie){oe.replaceChildren(),oe.hidden=z.length===0,ge.hidden=z.length>0;for(const Oe of z){const E=document.createElement("button");E.type="button",E.className="me-video-text-chip",ie.has(Oe.index)&&E.classList.add("is-active"),E.textContent=mc(Oe.overlay.text,d.untitledText),E.title=mc(Oe.overlay.text,d.untitledText),E.addEventListener("click",F=>{const p=gr(n,"text",Oe.index,F,z.map(b=>b.index));xt=p.length?p[p.length-1]:null,Lt()}),oe.appendChild(E)}}function Ct(z){Be.disabled=z,de.setDisabled(z),Ae.disabled=z,ve.disabled=z,T.forEach(({button:ie})=>ie.disabled=z),O.disabled=z,ee.disabled=z,M.disabled=z,A.disabled=z,_e.disabled=z,C.disabled=z,j.disabled=z,B.disabled=z,P.setDisabled(z),k.setDisabled(z),Me.setDisabled(z),x.setDisabled(z),J.disabled=z,Y.disabled=z,S.disabled=z,le.disabled=z,se.disabled=z,me.disabled=z}function bt(z){const ie=String(qe(Math.round(Number(z)||0),0,100));M.value=ie,A.value=ie}function $t(z){const ie=nb(z?.textDecoration);le.classList.toggle("is-active",!!z&&String(z.fontStyle??"normal")==="italic"),se.classList.toggle("is-active",!!z&&ie.has("underline")),me.classList.toggle("is-active",!!z&&ie.has("line-through"))}function un(z="left"){T.forEach(({value:ie,button:Oe})=>{})}function pn(z){if(Ct(!z),!z){Te.value="none",Be.value="",de.setContextText(""),de.setValue("Arial",{silent:!0}),Ae.value="700",ve.value="72",P.setValue("#ffffff"),k.setValue("transparent"),un("center"),O.value="none",ee.value="none",Me.setValue("#000000"),_e.value="0",x.setValue("#000000"),C.value="0",j.value="4",B.value="18",bt(100),$t(null);return}const ie=z.boxShadow??{};Te.value=String(z.textPreset??"none"),Be.value=String(z.text??""),de.setContextText(z.text??""),de.setValue(String(z.fontFamily??"Arial"),{silent:!0}),Ae.value=String(z.fontWeight??"700"),ve.value=String(Math.round(Number(z.fontSize)||72)),P.setValue(z.color??"#ffffff"),k.setValue(z.backgroundColor??"transparent"),un(z.textAlign==="right"||z.textAlign==="center"?z.textAlign:"left"),O.value=z.textTransform?String(z.textTransform):"none",ee.value=z.animation?String(z.animation):"none",Me.setValue(z.borderColor??"#000000"),_e.value=String(Math.round(Number(z.borderWidth)||0)),x.setValue(ie.color??"#000000"),C.value=String(Math.round(Number(ie.x)||0)),j.value=String(Math.round(Number(ie.y)||0)),B.value=String(Math.round(Number(ie.blur)||0)),bt(Number.isFinite(z.opacity)?z.opacity:100),$t(z)}function Lt(){xn(()=>{const z=_g(a.getState());An(z);const ie=new Set(Br(n,"text"));Nt(z,ie),at(z,ie),Wt(z,ie),pn(K()),Ut(),dn(),Mt()}),Tt()}function Xt(){xn(()=>{const z=n.querySelector(".me-video-toolrail");z&&(Ce=z,k5([...Ce.querySelectorAll("button")].filter(ie=>ie instanceof HTMLButtonElement&&ie!==xe&&!ie.classList.contains("me-video-text-tool"))),(!xe||!xe.isConnected)&&(xe=document.createElement("button"),xe.type="button",xe.className="me-video-text-tool",xe.innerHTML=`<span class="me-video-text-tool-icon">T</span><span class="me-video-text-tool-label">${m.tool}</span>`,xe.addEventListener("click",()=>{wn("heading")})),xe.isConnected||Ce.appendChild(xe),Mt(),dn())})}function en(z){return!!z&&(z===g||g.contains(z)||z===xe||z===et||et?.contains?.(z)||z===gt||gt?.contains?.(z))}function Tn(z){return z.some(ie=>{if(!en(ie.target))return!0;for(const Oe of ie.addedNodes)if(!en(Oe))return!0;for(const Oe of ie.removedNodes)if(!en(Oe))return!0;return!1})}function fn(z,ie){z.swatch.addEventListener("input",()=>{z.transparentButton&&z.wrap.dataset.transparent==="true"&&z.setTransparent(!1),z.text.value=z.swatch.value,ie(z.getValue())}),z.text.addEventListener("change",()=>{const Oe=String(z.text.value??"").trim();if(z.transparentButton&&Oe.toLowerCase()==="transparent"){z.setTransparent(!0),ie("transparent");return}const E=Oi(Oe,z.swatch.value||"#ffffff");z.swatch.value=E==="transparent"?z.swatch.value||"#ffffff":E,z.text.value=E,z.transparentButton&&z.setTransparent(!1),ie(E)}),z.transparentButton?.addEventListener("click",()=>{const Oe=z.wrap.dataset.transparent!=="true";z.setTransparent(Oe),ie(z.getValue())})}function zn(z){const ie=K();if(!ie)return;const Oe={color:"#000000",x:0,y:4,blur:18,...ie.boxShadow??{}};nn({boxShadow:{...Oe,...z}})}function Dr(z){const ie=K();if(!ie)return;const Oe=nb(ie.textDecoration);Oe.has(z)?Oe.delete(z):Oe.add(z),nn({textDecoration:j5(Oe)||void 0})}const Hn=new MutationObserver(z=>{tn||n.__meVideoEnhancerObserverLock||Tn(z)&&(Xt(),Pe())}),ur=z=>{z?.detail?.id!==_n&&_t&&(_t=!1,Lt())},Zn=()=>{Lt()};Hn.observe(n,{childList:!0,subtree:!0,characterData:!0}),n.addEventListener("me-video-inspector-open",ur),n.addEventListener(fr,Zn),window.addEventListener("resize",dn);const Fr=a.subscribe(()=>{Lt()});return W.addEventListener("click",()=>wn("heading")),S.addEventListener("click",()=>{pt(),dt(!0)}),J.addEventListener("click",Z),Y.addEventListener("click",fe),ue.addEventListener("click",()=>{dt(!1)}),Be.addEventListener("input",()=>{de.setContextText(Be.value),nn({text:Be.value})}),Te.addEventListener("change",()=>{if(Te.value==="none"){K()&&nn({textPreset:"none"},{preservePreset:!0});return}Ne(Te.value)}),de.wrap.addEventListener("fontchange",()=>nn({fontFamily:de.getValue()})),Ae.addEventListener("change",()=>nn({fontWeight:Ae.value})),ve.addEventListener("change",()=>nn({fontSize:qe(Number(ve.value)||72,8,320)})),fn(P,z=>nn({color:z})),fn(k,z=>nn({backgroundColor:z})),T.forEach(({value:z,button:ie})=>{ie.addEventListener("click",()=>{un(z),nn({textAlign:z})})}),O.addEventListener("change",()=>nn({textTransform:O.value==="none"?void 0:O.value})),ee.addEventListener("change",()=>nn({animation:ee.value==="none"?void 0:ee.value})),_e.addEventListener("change",()=>nn({borderWidth:qe(Number(_e.value)||0,0,32)})),fn(Me,z=>nn({borderColor:z})),fn(x,z=>zn({color:z})),C.addEventListener("change",()=>zn({x:qe(Number(C.value)||0,-80,80)})),j.addEventListener("change",()=>zn({y:qe(Number(j.value)||0,-80,80)})),B.addEventListener("change",()=>zn({blur:qe(Number(B.value)||0,0,80)})),M.addEventListener("input",()=>{const z=qe(Number(M.value)||0,0,100);bt(z),nn({opacity:z})}),A.addEventListener("input",()=>{const z=qe(Number(A.value)||0,0,100);bt(z),nn({opacity:z})}),le.addEventListener("click",()=>{const z=K();z&&nn({fontStyle:String(z.fontStyle??"normal")==="italic"?"normal":"italic"})}),se.addEventListener("click",()=>Dr("underline")),me.addEventListener("click",()=>Dr("line-through")),Xt(),Lt(),{destroy(){Hn.disconnect(),Ge&<&&Ge.unobserve(lt),mt&&Qt&&mt.unobserve(Qt),Fr(),n.removeEventListener("me-video-inspector-open",ur),n.removeEventListener(fr,Zn),window.removeEventListener("resize",dn),de.destroy(),xe?.remove(),et?.remove(),gt?.remove(),g.remove(),br(n)}}}function $5(n,a,o){wa(),nl();const l=u5(o()),s=c5(l),d=document.createElement("div");d.className="me-video-text-panel me-video-sticker-panel",d.hidden=!0,n.appendChild(d);const m=document.createElement("div");m.className="me-video-text-toolbar";const h=document.createElement("strong");h.textContent=l.title,m.append(h);const g=ta(l.uploadTitle),v=document.createElement("label");v.className="me-video-sticker-upload-zone";const w=document.createElement("span");w.className="me-video-sticker-upload-icon",w.textContent="\u{1F5BC}";const W=document.createElement("span");W.className="me-video-sticker-upload-text",W.textContent=l.uploadHint;const S=document.createElement("span");S.className="me-video-sticker-upload-subtext",S.textContent=l.uploadFormats;const J=document.createElement("input");J.type="file",J.accept="image/png,image/jpeg,image/webp,image/svg+xml",v.append(w,W,S,J),g.body.appendChild(v);const Y=ta(l.libraryTitle),ue=document.createElement("div");ue.className="me-video-sticker-library",Y.body.appendChild(ue),d.append(m,g.section,Y.section);let oe=null,ge=null,Be=null,Te=null,de=null,Ae=null,ve=null,P=null,k=null,H=!1,T=null,_=!1,le=!1;const se="sticker",me=typeof requestAnimationFrame=="function"?requestAnimationFrame:Z=>setTimeout(Z,16),O=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>_e()),$=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>_e()),M=[{key:"tl",x:0,y:0},{key:"tm",x:.5,y:0},{key:"tr",x:1,y:0},{key:"mr",x:1,y:.5},{key:"br",x:1,y:1},{key:"bm",x:.5,y:1},{key:"bl",x:0,y:1},{key:"ml",x:0,y:.5}],A={key:"rotate",x:.5,y:0};function ee(){Promise.resolve().then(()=>{le=!1;const Z=n.__meVideoEnhancerObserverLock??0;n.__meVideoEnhancerObserverLock=Math.max(0,Z-1)})}function Me(Z){le=!0,n.__meVideoEnhancerObserverLock=(n.__meVideoEnhancerObserverLock??0)+1;try{return Z()}finally{ee()}}function _e(){_||(_=!0,me(()=>{_=!1,K()}))}function x(Z){const fe=!!Z;if(fe===H){K();return}H=fe,H&&n.dispatchEvent(new CustomEvent("me-video-inspector-open",{detail:{id:se}})),K()}function C(Z=ge){return Z?[...Z.children].filter(fe=>fe instanceof HTMLButtonElement&&!fe.classList.contains("me-video-text-tool")):[]}function j(Z){return[Z?.textContent,Z?.getAttribute?.("title"),Z?.getAttribute?.("aria-label")].filter(Boolean).join(" ").trim().toLowerCase()}function B(Z){const fe=["trim","timeline","\u526A\u8F91","\u65F6\u95F4\u8F74"];return Sf(Z.find(Ne=>{const Je=j(Ne);return fe.some(Et=>Je.includes(Et))})??Z[0]??null)}function G(Z){const fe=[l.tool,l.title,"sticker","stickers","\u8D34\u7EB8","\u8CBC\u7D19"].map(Ne=>String(Ne??"").trim().toLowerCase()).filter(Boolean);return Z.find(Ne=>{const Je=j(Ne);return fe.some(Et=>Je.includes(Et))})??Z[Math.min(5,Math.max(0,Z.length-1))]??null}function De(){if(oe?.classList.toggle("is-active",H),!!Be&&H){Be.classList.remove("is-active");return}}function Q(){Be&&(Be.classList.contains("is-active")||Be.click())}function te(){za(n,d),br(n)}function U(){d.hidden=!H,De(),te()}function xe(Z){if(!Z.length){T=null;return}const fe=Pg(n,a.getState());T=fe.length?fe[fe.length-1]:null}function Ce(){return ol(a)}function Ze(){return co(n)}function et(){if(!a.history?.present)return;const Z=Ze(),fe=Number(a.history.present.__mePreviewTimelineTime);Math.abs((Number.isFinite(fe)?fe:-1)-Z)<.001||(a.history={...a.history,present:{...a.history.present,__mePreviewTimelineTime:Z}},typeof a.emit=="function"&&a.emit())}function lt(Z){return Z?.emoji?`${l.defaultLabel} ${Z.emoji}`:Z?.src?l.uploadedLabel:l.defaultLabel}function ot(Z){const fe=Ir(Z);if(!fe)return null;if(!Z?.emoji)return fe;const Ne=.84,Je=fe.w*(1-Ne)/2,Et=fe.h*(1-Ne)/2;return{x:fe.x+Je,y:fe.y+Et,w:fe.w*Ne,h:fe.h*Ne}}function gt(Z,fe){if(!Z?.emoji)return fe;const Ne=1/.84,Je=(Ne-1)/2;return{x:fe.x-fe.w*Je,y:fe.y-fe.h*Je,w:fe.w*Ne,h:fe.h*Ne}}function Qt(Z,fe){const Ne=Math.max(1,Number(fe?.w)||1080),Je=Math.max(1,Number(fe?.h)||1920),Et=qe(Number.isFinite(Z?.w)?Z.w:8,8,Math.max(8,Ne)),D=qe(Number.isFinite(Z?.h)?Z.h:8,8,Math.max(8,Je));return{x:qe(Number.isFinite(Z?.x)?Z.x:0,0,Math.max(0,Ne-Et)),y:qe(Number.isFinite(Z?.y)?Z.y:0,0,Math.max(0,Je-D)),w:Et,h:D}}function _t(Z){return Z?.emoji||"\u2726"}function xt(Z,fe,Ne={}){const Je=(a.getState().overlays??[])[Z];!Je||Je.type!=="sticker"||a.updateOverlay(Z,ma(Je,Ce(),fe),Ne)}function Zt(Z){if(typeof a.applyMut=="function"){a.applyMut(Ne=>({...Ne,overlays:[...Da(Ne.overlays),{...Z,timelineTrack:0}]}));return}const fe=Da(a.getState().overlays);a.commit?.({overlays:[...fe,{...Z,timelineTrack:0}]})}function tn(Z){return new Promise(fe=>{const Ne=new Image;Ne.onload=()=>fe({w:Ne.naturalWidth||256,h:Ne.naturalHeight||256}),Ne.onerror=()=>fe({w:256,h:256}),Ne.src=Z})}async function _n(Z){const fe=Ce();let Ne=qe(Ze(),0,Math.max(0,fe-Pt)),Je=Math.min(fe,Ne+Qr);Je-Ne<Pt&&(Ne=qe(fe-Qr,0,Math.max(0,fe-Pt)),Je=Math.max(Ne+Pt,fe));const Et=a.getState().canvas??{w:1080,h:1920},D=Z.emoji?{w:256,h:256}:await tn(Z.src),V=Math.max(96,Math.round(Math.min(Et.w,Et.h)*.24)),Fe=Q0(D.w,D.h,V),He={type:"sticker",x:Math.round((Et.w-Fe.w)/2),y:Math.round((Et.h-Fe.h)/2),w:Fe.w,h:Fe.h,rotation:0,...Z.emoji?{emoji:Z.emoji}:{src:Z.src},...ma(null,fe,{startAt:Ne,endAt:Je,timelineTrack:0})};Zt(He);const Ye=a.getState().overlays??[];T=Ye.length?Ye.length-1:null,T!=null&&qn(n,"text",[T]),Q(),x(!0)}async function st(Z){const fe=Z?.[0];if(!fe||!String(fe.type||"").startsWith("image/")&&!/\.(png|jpe?g|webp|svg)$/i.test(fe.name||""))return;const Ne=await new Promise((Je,Et)=>{const D=new FileReader;D.onload=()=>Je(String(D.result||"")),D.onerror=()=>Et(D.error||new Error("Failed to read sticker file")),D.readAsDataURL(fe)}).catch(()=>"");Ne&&(J.value="",await _n({src:Ne}))}function Ge(){ue.replaceChildren();for(const Z of s){const fe=document.createElement("div");fe.className="me-video-sticker-library-group";const Ne=document.createElement("div");Ne.className="me-video-sticker-library-title",Ne.textContent=Z.title;const Je=document.createElement("div");Je.className="me-video-sticker-grid";for(const Et of Z.items){const D=document.createElement("button");if(D.type="button",D.className="me-video-sticker-card",D.title=Et.label,D.setAttribute("aria-label",Et.label),Et.emoji){const V=document.createElement("span");V.className="me-video-sticker-card-emoji",V.textContent=Et.emoji,D.appendChild(V)}else if(Et.src){const V=document.createElement("img");V.src=Et.src,V.alt=Et.label,D.appendChild(V)}D.addEventListener("click",()=>{_n(Et)}),Je.appendChild(D)}fe.append(Ne,Je),ue.appendChild(fe)}}function mt(){Me(()=>{const Z=n.querySelector(".me-video-toolrail");Z&&(ge=Z,(!oe||!oe.isConnected)&&(oe=document.createElement("button"),oe.type="button",oe.className="me-video-text-tool",oe.innerHTML=`<span class="me-video-text-tool-icon">\u2726</span><span class="me-video-text-tool-label">${l.tool}</span>`,oe.title=l.tool,oe.setAttribute("aria-label",l.tool),oe.addEventListener("click",()=>{const fe=!H;fe&&Q(),x(fe)})),oe.isConnected||ge.appendChild(oe),te())})}function Rt(){const{timelineInner:Z,timelineHost:fe}=Ms(n,a.getState());if(!Z||!fe){de?.remove(),de=null,O&&Ae&&(O.unobserve(Ae),Ae=null),Te=null;return}Te=Z,(!de||!de.isConnected||de.parentElement!==fe)&&(de?.remove(),de=document.createElement("div"),de.className="me-video-text-timeline me-video-sticker-timeline me-video-overlay-timeline me-video-sticker-overlay-layer");for(const Ne of[...fe.children])Ne!==de&&Ne instanceof HTMLElement&&Ne.classList.contains("me-video-sticker-overlay-layer")&&Ne.remove();(de.parentElement!==fe||fe.lastElementChild!==de)&&fe.appendChild(de),O&&Ae!==Te&&(Ae&&O.unobserve(Ae),Ae=Te,O.observe(Te))}function Vt(){const Z=n.querySelector(".me-video-canvas-stage");if(!Z){P?.remove(),P=null,$&&k&&($.unobserve(k),k=null),ve=null;return}ve=Z,ve.style.position="relative",!P||!P.isConnected||P.parentElement!==ve?(P?.remove(),P=document.createElement("div"),P.className="me-video-text-canvas-layer me-video-sticker-canvas-layer",P.addEventListener("pointerdown",fe=>{fe.target===P&&(fe.preventDefault(),fe.stopPropagation())}),P.addEventListener("click",fe=>{fe.target===P&&(fe.preventDefault(),fe.stopPropagation(),T=null,mf(n),H?x(!1):K())}),ve.appendChild(P)):ve.lastElementChild!==P&&ve.appendChild(P),$&&k!==ve&&(k&&$.unobserve(k),k=ve,$.observe(ve))}function kn(){if(!ve)return null;const Z=a.getState().canvas??{},fe=Math.max(1,Number(Z.w)||0),Ne=Math.max(1,Number(Z.h)||0);if(!fe||!Ne)return null;const Je=ve.getBoundingClientRect(),Et=ve.querySelector("canvas, video, img")||[...ve.children].find(Ye=>Ye!==P)||null;let D=0,V=0,Fe=ve.clientWidth||fe,He=ve.clientHeight||Ne;if(Et instanceof HTMLElement){const Ye=Et.getBoundingClientRect();Ye.width>0&&Ye.height>0&&(D=Ye.left-Je.left,V=Ye.top-Je.top,Fe=Ye.width,He=Ye.height)}if(!(Fe>0&&He>0)){const Ye=ve.clientWidth||fe,ct=ve.clientHeight||Ne,kt=Math.min(Ye/fe,ct/Ne)||1;Fe=fe*kt,He=Ne*kt,D=Math.max(0,(Ye-Fe)/2),V=Math.max(0,(ct-He)/2)}return{stageLeft:Je.left,stageTop:Je.top,left:D,top:V,scaleX:Fe/fe,scaleY:He/Ne}}function xn(Z,fe){const Ne=Cn(Z),Je=Tr(Z,Ne);return fe>=Ne-.001&&fe<=Je+.001}function Pe(Z,fe,Ne){const Je=gr(n,"text",Z,fe,Ne);T=Je.length?Je[Je.length-1]:null,x(!0),K()}function dt(Z,fe,Ne){return{x:(Z-Ne.stageLeft-Ne.left)/Ne.scaleX,y:(fe-Ne.stageTop-Ne.top)/Ne.scaleY}}function yt(Z,fe,Ne){const Je=(a.getState().overlays??[])[Z];if(!Je||Je.type!=="sticker")return;const Et=a.getState().canvas??{w:1080,h:1920},D=Ir(Je);if(!D)return;const V=fe.clientX,Fe=fe.clientY,He=Math.max(0,(Number(Et.w)||0)-D.w),Ye=Math.max(0,(Number(Et.h)||0)-D.h),ct=(at,Ke,Nt)=>{const Wt=(at-V)/Ne.scaleX,Ct=(Ke-Fe)/Ne.scaleY,bt=qe(D.x+Wt,0,He),$t=qe(D.y+Ct,0,Ye);a.updateOverlay(Z,{x:bt,y:$t},Nt?{transient:!0}:void 0)},kt=at=>{at.preventDefault(),ct(at.clientX,at.clientY,!0)},rt=at=>{window.removeEventListener("pointermove",kt),window.removeEventListener("pointerup",rt),window.removeEventListener("pointercancel",rt),ct(at.clientX,at.clientY,!1)};window.addEventListener("pointermove",kt),window.addEventListener("pointerup",rt),window.addEventListener("pointercancel",rt)}function pt(Z,fe,Ne,Je){const Et=(a.getState().overlays??[])[Z];if(!Et||Et.type!=="sticker")return;const D=ot(Et);if(!D)return;const V=a.getState().canvas??{w:1080,h:1920},Fe=fe.x===.5?.5:1-fe.x,He=fe.y===.5?.5:1-fe.y,Ye=D.x+D.w*Fe,ct=D.y+D.h*He,kt=Math.max(.1,24/Math.max(24,D.w),24/Math.max(24,D.h)),rt=fe.x===.5?1/0:Math.max(.1,(Fe===0?(Number(V.w)||0)-Ye:Ye)/Math.max(1,D.w)),at=fe.y===.5?1/0:Math.max(.1,(He===0?(Number(V.h)||0)-ct:ct)/Math.max(1,D.h)),Ke=Math.max(kt,Math.min(rt,at,8)),Nt=(bt,$t,un)=>{const pn=dt(bt,$t,Je),Lt=[];fe.x!==.5&&Lt.push(Math.abs(pn.x-Ye)/Math.max(1,D.w)),fe.y!==.5&&Lt.push(Math.abs(pn.y-ct)/Math.max(1,D.h));const Xt=Lt.filter(Number.isFinite),en=Xt.length?Math.max(...Xt):1,Tn=qe(en,kt,Ke),fn={x:Ye-D.w*Tn*Fe,y:ct-D.h*Tn*He,w:Math.max(8,D.w*Tn),h:Math.max(8,D.h*Tn)},zn=Qt(gt(Et,fn),V);a.updateOverlay(Z,{x:zn.x,y:zn.y,w:zn.w,h:zn.h},un?{transient:!0}:void 0)},Wt=bt=>{bt.preventDefault(),Nt(bt.clientX,bt.clientY,!0)},Ct=bt=>{window.removeEventListener("pointermove",Wt),window.removeEventListener("pointerup",Ct),window.removeEventListener("pointercancel",Ct),Nt(bt.clientX,bt.clientY,!1)};window.addEventListener("pointermove",Wt),window.addEventListener("pointerup",Ct),window.addEventListener("pointercancel",Ct)}function Mt(Z,fe,Ne){const Je=(a.getState().overlays??[])[Z];if(!Je||Je.type!=="sticker")return;const Et=ot(Je);if(!Et)return;const D=Ne.stageLeft+Ne.left+(Et.x+Et.w/2)*Ne.scaleX,V=Ne.stageTop+Ne.top+(Et.y+Et.h/2)*Ne.scaleY,Fe=Math.atan2(fe.clientY-V,fe.clientX-D),He=da(Je),Ye=(rt,at,Ke,Nt)=>{const Wt=Math.atan2(at-V,rt-D);let Ct=Es(He+(Wt-Fe)*180/Math.PI);Nt&&(Ct=Math.round(Ct/15)*15),a.updateOverlay(Z,{rotation:Ct},Ke?{transient:!0}:void 0)},ct=rt=>{rt.preventDefault(),Ye(rt.clientX,rt.clientY,!0,rt.shiftKey)},kt=rt=>{window.removeEventListener("pointermove",ct),window.removeEventListener("pointerup",kt),window.removeEventListener("pointercancel",kt),Ye(rt.clientX,rt.clientY,!1,rt.shiftKey)};window.addEventListener("pointermove",ct),window.addEventListener("pointerup",kt),window.addEventListener("pointercancel",kt)}function dn(Z,fe){if(Vt(),!P)return;P.replaceChildren();const Ne=kn();if(!Ne){P.hidden=!0;return}P.hidden=!1;const Je=Ze(),Et=Z.map(V=>V.index),D=Z.filter(V=>xn(V.overlay,Je));for(const V of D){const Fe=ot(V.overlay);if(!Fe)continue;const He=document.createElement("button");He.type="button",He.className="me-video-text-canvas-hit me-video-sticker-canvas-hit";const Ye=fe.has(V.index),ct=Ye&&T===V.index;Ye&&He.classList.add("is-active"),He.title=lt(V.overlay),He.style.left=`${Ne.left+Fe.x*Ne.scaleX}px`,He.style.top=`${Ne.top+Fe.y*Ne.scaleY}px`,He.style.width=`${Math.max(18,Fe.w*Ne.scaleX)}px`,He.style.height=`${Math.max(18,Fe.h*Ne.scaleY)}px`;const kt=da(V.overlay);if(kt&&(He.style.transform=`rotate(${kt}deg)`,He.style.transformOrigin="center center"),He.addEventListener("pointerdown",rt=>{if(rt.preventDefault(),rt.stopPropagation(),rt.shiftKey||rt.ctrlKey||rt.metaKey){Pe(V.index,rt,Et);return}T=V.index,qn(n,"text",[V.index]),x(!0),yt(V.index,rt,Ne)}),ct){for(const at of M){const Ke=document.createElement("span");Ke.className="me-video-text-canvas-handle",Ke.dataset.handle=at.key,Ke.style.left=`${at.x*100}%`,Ke.style.top=`${at.y*100}%`,Ke.addEventListener("pointerdown",Nt=>{Nt.preventDefault(),Nt.stopPropagation(),T=V.index,qn(n,"text",[V.index]),x(!0),pt(V.index,at,Nt,Ne)}),He.appendChild(Ke)}const rt=document.createElement("span");rt.className="me-video-text-canvas-handle",rt.dataset.handle=A.key,rt.style.left=`${A.x*100}%`,rt.style.top=`${A.y*100}%`,rt.addEventListener("pointerdown",at=>{at.preventDefault(),at.stopPropagation(),T=V.index,qn(n,"text",[V.index]),x(!0),Mt(V.index,at,Ne)}),He.appendChild(rt)}P.appendChild(He)}}function Ut(Z,fe,Ne){if(!Te)return;const Je=(a.getState().overlays??[])[Z];if(!Je||Je.type!=="sticker")return;if(Ne.shiftKey||Ne.ctrlKey||Ne.metaKey){Ne.preventDefault(),Ne.stopPropagation();const at=gr(n,"text",Z,Ne,Tg(a.getState()).map(Ke=>Ke.index));T=at.length?at[at.length-1]:null,Q(),x(!0);return}Ne.preventDefault(),Ne.stopPropagation(),T=Z,qn(n,"text",[Z]),Q(),H||x(!0);const Et=Ce(),D=Math.max(Te.clientWidth/Et,.001),V=Cn(Je),Fe=Tr(Je,V),He=Math.max(Pt,Fe-V),Ye=$n(Je),ct=Ne.clientX,kt=at=>{const Ke=(at.clientX-ct)/D,Nt=a.getState().overlays??[];if(fe==="move"){const bt=Math.max(0,V+Ke),$t=bt+He,un=Nn(de,Nt,Z,bt,$t,at.clientY,Ye);xt(Z,{startAt:bt,endAt:$t,timelineTrack:un},{transient:!0});return}if(fe==="start"){const bt=qe(V+Ke,0,Fe-Pt),$t=Nn(de,Nt,Z,bt,Fe,at.clientY,Ye);xt(Z,{startAt:bt,endAt:Fe,timelineTrack:$t},{transient:!0});return}const Wt=Math.max(V+Pt,Fe+Ke),Ct=Nn(de,Nt,Z,V,Wt,at.clientY,Ye);xt(Z,{startAt:V,endAt:Wt,timelineTrack:Ct},{transient:!0})},rt=at=>{window.removeEventListener("pointermove",kt),window.removeEventListener("pointerup",rt),window.removeEventListener("pointercancel",rt);const Ke=(at.clientX-ct)/D,Nt=a.getState().overlays??[];if(fe==="move"){const bt=Math.max(0,V+Ke),$t=bt+He,un=Nn(de,Nt,Z,bt,$t,at.clientY,Ye);xt(Z,{startAt:bt,endAt:$t,timelineTrack:un});return}if(fe==="start"){const bt=qe(V+Ke,0,Fe-Pt),$t=Nn(de,Nt,Z,bt,Fe,at.clientY,Ye);xt(Z,{startAt:bt,endAt:Fe,timelineTrack:$t});return}const Wt=Math.max(V+Pt,Fe+Ke),Ct=Nn(de,Nt,Z,V,Wt,at.clientY,Ye);xt(Z,{startAt:V,endAt:Wt,timelineTrack:Ct})};window.addEventListener("pointermove",kt),window.addEventListener("pointerup",rt),window.addEventListener("pointercancel",rt),K()}function An(Z,fe){if(Rt(),!de||!Te||(de.replaceChildren(),de.hidden=Z.length===0,!Z.length))return;const Ne=Ce(),Je=Te.clientWidth/Ne,Et=Ss(a.getState()),D=new Map;for(const V of Z){const Fe=$n(V.overlay),He=Et.get(Fe)??Fe;let Ye=D.get(Fe);Ye||(Ye=document.createElement("div"),Ye.className="me-video-overlay-track-row",Ye.dataset.track=String(Fe),Ye.style.top=`${il(He)}px`,D.set(Fe,Ye),de.appendChild(Ye));const ct=document.createElement("div");ct.className="me-video-text-track-clip me-video-sticker-track-clip",fe.has(V.index)&&ct.classList.add("is-active");const kt=Cn(V.overlay),rt=al(V.overlay);ct.style.left=`${kt*Je}px`,ct.style.width=`${Math.max(36,rt*Je)}px`;const at=document.createElement("span");at.className="me-video-text-track-icon",at.textContent=_t(V.overlay);const Ke=document.createElement("span");Ke.className="me-video-text-track-label",Ke.textContent=lt(V.overlay),Ke.title=Ke.textContent;const Nt=document.createElement("span");Nt.className="me-video-text-track-handle is-start";const Wt=document.createElement("span");Wt.className="me-video-text-track-handle is-end",ct.append(at,Ke,Nt,Wt),ct.addEventListener("pointerdown",Ct=>Ut(V.index,"move",Ct)),Nt.addEventListener("pointerdown",Ct=>Ut(V.index,"start",Ct)),Wt.addEventListener("pointerdown",Ct=>Ut(V.index,"end",Ct)),ct.addEventListener("click",Ct=>{if(Ct.preventDefault(),Ct.stopPropagation(),Ct.shiftKey||Ct.ctrlKey||Ct.metaKey){Q(),K();return}const bt=gr(n,"text",V.index,Ct,Z.map($t=>$t.index));T=bt.length?bt[bt.length-1]:null,Q(),x(!0),K()}),Ye.appendChild(ct)}}function K(){Me(()=>{mt();const Z=C().find(Je=>Je.classList.contains("is-active"))??null;H&&Z&&Z!==Be&&Z!==oe&&(Q(),_e());const fe=Tg(a.getState());xe(fe);const Ne=new Set(Pg(n,a.getState()));An(fe,Ne),dn(fe,Ne),U(),te()}),et()}function Le(Z){return!!Z&&(Z===d||d.contains(Z)||Z===oe||oe?.contains?.(Z)||Z===de||de?.contains?.(Z)||Z===P||P?.contains?.(Z))}function Xe(Z){return Z.some(fe=>{if(!Le(fe.target))return!0;for(const Ne of fe.addedNodes)if(!Le(Ne))return!0;for(const Ne of fe.removedNodes)if(!Le(Ne))return!0;return!1})}const Tt=new MutationObserver(Z=>{le||n.__meVideoEnhancerObserverLock||Xe(Z)&&(mt(),_e())}),rn=Z=>{Z?.detail?.id!==se&&H&&(H=!1,K())},Ot=()=>{K()},nn=Z=>{const fe=Z.target;if(!(fe instanceof Node)||!oe||!oe.contains(fe))return;Z.preventDefault(),Z.stopPropagation(),Z.stopImmediatePropagation?.();const Ne=!H;Ne&&(Q(),_e()),x(Ne)};Tt.observe(n,{childList:!0,subtree:!0,characterData:!0}),n.addEventListener("me-video-inspector-open",rn),n.addEventListener(fr,Ot),n.addEventListener("click",nn,!0),window.addEventListener("resize",te);const wn=a.subscribe(()=>{K()});return J.addEventListener("change",()=>{st(J.files)}),v.addEventListener("dragenter",Z=>{Z.preventDefault(),v.classList.add("is-dragover")}),v.addEventListener("dragover",Z=>{Z.preventDefault(),v.classList.add("is-dragover")}),v.addEventListener("dragleave",Z=>{Z.target===v&&v.classList.remove("is-dragover")}),v.addEventListener("drop",Z=>{Z.preventDefault(),v.classList.remove("is-dragover"),st(Z.dataTransfer?.files)}),Ge(),mt=function(){Me(()=>{const Z=n.querySelector(".me-video-toolrail");if(!Z)return;ge=Z;const fe=C(ge);Be=B(fe),oe=G(fe),De(),te()})},mt(),K(),{destroy(){Tt.disconnect(),O&&Ae&&O.unobserve(Ae),$&&k&&$.unobserve(k),wn(),n.removeEventListener("me-video-inspector-open",rn),n.removeEventListener(fr,Ot),n.removeEventListener("click",nn,!0),window.removeEventListener("resize",te),H=!1,De(),de?.remove(),P?.remove(),d.remove(),br(n)}}}function R5(n,a,o){wa(),nl();const l=yf(o()),s=w5(l),d=new Map(s.map(D=>[String(D.id??""),D])),m=s.find(D=>D.id)?.id??"",h=document.createElement("div");h.className="me-video-text-panel me-video-color-panel me-video-filter-panel",h.hidden=!0,n.appendChild(h);const g=document.createElement("div");g.className="me-video-text-toolbar";const v=document.createElement("strong");v.textContent=l.filterTitle;const w=Hr(l.reset);g.append(v,w);const W=ta(l.presets),S=document.createElement("div");S.className="me-video-color-grid",W.body.appendChild(S);const J=s.map(D=>{const V=document.createElement("button");V.type="button",V.className="me-video-color-card",V.dataset.presetId=D.id??"";const Fe=document.createElement("div");Fe.className="me-video-color-preview",Fe.style.filter=D.css||"none";const He=document.createElement("img");He.alt="",He.draggable=!1,He.hidden=!0,Fe.appendChild(He);const Ye=document.createElement("div");return Ye.className="me-video-color-card-title",Ye.textContent=D.label,V.append(Fe,Ye),S.appendChild(V),{entry:D,buttonEl:V,previewImage:He}});h.append(g,W.section);let Y=null,ue=null,oe=null,ge=null,Be=null,Te=null,de=null,Ae=null,ve=null,P=null,k=null,H=null,T=!1,_=null,le=!1,se=!1,me="";const O="filter",$=typeof requestAnimationFrame=="function"?requestAnimationFrame:D=>setTimeout(D,16),M=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>C()),A=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>C()),ee=[{key:"tl",x:0,y:0},{key:"tm",x:.5,y:0},{key:"tr",x:1,y:0},{key:"mr",x:1,y:.5},{key:"br",x:1,y:1},{key:"bm",x:.5,y:1},{key:"bl",x:0,y:1},{key:"ml",x:0,y:.5}],Me={key:"rotate",x:.5,y:0};function _e(){Promise.resolve().then(()=>{se=!1;const D=n.__meVideoEnhancerObserverLock??0;n.__meVideoEnhancerObserverLock=Math.max(0,D-1)})}function x(D){se=!0,n.__meVideoEnhancerObserverLock=(n.__meVideoEnhancerObserverLock??0)+1;try{return D()}finally{_e()}}function C(){le||(le=!0,$(()=>{le=!1,Ot()}))}function j(D=ue){return D?[...D.children].filter(V=>V instanceof HTMLButtonElement&&V!==ge&&!V.classList.contains("me-video-text-tool")):[]}function B(D){const V=[l.filterTool,l.filterTitle,"filter","filters","\u6EE4\u955C","\u6FFE\u93E1"].map(Fe=>String(Fe??"").trim().toLowerCase()).filter(Boolean);return D.find(Fe=>{const He=Cf(Fe);return V.some(Ye=>He.includes(Ye))})??D[3]??null}function G(){oe&&(oe.classList.contains("is-active")||oe.click())}function De(){za(n,h),br(n)}function Q(D){const V=!!D;if(V===T){Ot();return}T=V,T&&n.dispatchEvent(new CustomEvent("me-video-inspector-open",{detail:{id:O}})),Ot()}function te(){if(Y?.classList.toggle("is-active",T),!!oe&&T){oe.classList.remove("is-active");return}}function U(){h.hidden=!T,te(),De()}function xe(){const D=a.getState().overlays??[];if(_==null)return null;const V=D[_];return V?.type==="filter"?V:null}function Ce(){return ol(a)}function Ze(){return co(n)}function et(){if(!a.history?.present)return;const D=Ze(),V=Number(a.history.present.__mePreviewTimelineTime);Math.abs((Number.isFinite(V)?V:-1)-D)<.001||(a.history={...a.history,present:{...a.history.present,__mePreviewTimelineTime:D}},typeof a.emit=="function"&&a.emit())}function lt(D){if(!D.length){_=null;return}const V=jg(n,a.getState());_=V.length?V[V.length-1]:null}function ot(D){return String(D?.filterPreset??"").trim()}function gt(D){return d.get(ot(D))??null}function Qt(D){return gt(D)?.css||"none"}function _t(D){return gt(D)?.label||l.filterTitle}function xt(D){const V=Number(D?.w),Fe=Number(D?.h);return!(V>0)||!(Fe>0)?null:{x:Number(D?.x)||0,y:Number(D?.y)||0,w:Math.max(48,V),h:Math.max(48,Fe)}}function Zt(D,V){const Fe=xt(D);if(!Fe)return D;const He=Math.max(.1,Number(V)||1);return{...D,w:Math.max(48,Fe.w*He),h:Math.max(48,Fe.h*He)}}function tn(D,V,Fe={}){const He=(a.getState().overlays??[])[D];!He||He.type!=="filter"||a.updateOverlay(D,ma(He,Ce(),V),Fe)}function _n(D,V){_!=null&&a.updateOverlay(_,D,V)}function st(D){if(typeof a.applyMut=="function"){a.applyMut(Fe=>({...Fe,overlays:[...Da(Fe.overlays),{...D,timelineTrack:0}]}));return}const V=Da(a.getState().overlays);a.commit?.({overlays:[...V,{...D,timelineTrack:0}]})}function Ge(D=m){const V=a.getState().canvas??{w:1080,h:1920},Fe=qe(Math.round((Number(V.w)||1080)*.68),180,Math.max(180,(Number(V.w)||1080)-48)),He=qe(Math.round((Number(V.h)||1920)*.3),120,Math.max(120,(Number(V.h)||1920)-48));return{type:"filter",x:Math.round(((Number(V.w)||1080)-Fe)/2),y:Math.round(((Number(V.h)||1920)-He)/2),w:Fe,h:He,rotation:0,filterPreset:D||void 0}}function mt(D=m){const V=Ce();let Fe=qe(Ze(),0,Math.max(0,V-Pt)),He=Math.min(V,Fe+Qr);He-Fe<Pt&&(Fe=qe(V-Qr,0,Math.max(0,V-Pt)),He=Math.max(Fe+Pt,V));const Ye={...Ge(D),...ma(null,V,{startAt:Fe,endAt:He,timelineTrack:0})};st(Ye);const ct=a.getState().overlays??[];_=ct.length?ct.length-1:null,_!=null&&qn(n,"text",[_]),kn(!0),G(),Q(!0)}function Rt(D){if(!xe()){mt(D);return}_n({filterPreset:D||void 0}),Q(!0)}function Vt(D){if(D){if(!me){D.hidden=!0,D.removeAttribute("src");return}D.src!==me&&(D.src=me),D.hidden=!1}}function kn(D=!1){if(me&&!D)return;const V=C5(n);V&&(V===me&&!D||(me=V,J.forEach(({previewImage:Fe})=>Vt(Fe))))}function xn(){xe()&&_n({filterPreset:void 0})}function Pe(){x(()=>{const D=n.querySelector(".me-video-toolrail");if(!D)return;ue=D;const V=j(ue);oe=Ec(V),Be=B(V),Be?(ge?.remove(),Y=Be):((!ge||!ge.isConnected)&&(ge=document.createElement("button"),ge.type="button",ge.className="me-video-text-tool me-video-filter-tool",ge.innerHTML=`<span class="me-video-text-tool-icon">\u25A3</span><span class="me-video-text-tool-label">${l.filterTool}</span>`),ge.title=l.filterTool,ge.setAttribute("aria-label",l.filterTool),ge.isConnected?Be?.parentElement===ue&&ge.nextSibling!==Be&&ue.insertBefore(ge,Be):Be?.parentElement===ue?ue.insertBefore(ge,Be):ue.appendChild(ge),Y=ge),Y?.setAttribute?.("title",l.filterTool),Y?.setAttribute?.("aria-label",l.filterTool),te(),De()})}function dt(){const{timelineInner:D,timelineHost:V}=Ms(n,a.getState());if(!D||!V){de?.remove(),de=null,M&&Ae&&(M.unobserve(Ae),Ae=null),Te=null;return}Te=D,(!de||!de.isConnected||de.parentElement!==V)&&(de?.remove(),de=document.createElement("div"),de.className="me-video-text-timeline me-video-overlay-timeline me-video-filter-overlay-layer");for(const Fe of[...V.children])Fe!==de&&Fe instanceof HTMLElement&&Fe.classList.contains("me-video-filter-overlay-layer")&&Fe.remove();(de.parentElement!==V||V.lastElementChild!==de)&&V.appendChild(de),M&&Ae!==Te&&(Ae&&M.unobserve(Ae),Ae=Te,M.observe(Te))}function yt(){const D=n.querySelector(".me-video-canvas-stage");if(!D){P?.remove(),P=null,k?.remove(),k=null,A&&H&&(A.unobserve(H),H=null),ve=null;return}ve=D,ve.style.position="relative",(!P||!P.isConnected||P.parentElement!==ve)&&(P?.remove(),P=document.createElement("div"),P.className="me-video-filter-effect-layer",ve.appendChild(P)),(!k||!k.isConnected||k.parentElement!==ve)&&(k?.remove(),k=document.createElement("div"),k.className="me-video-filter-control-layer",ve.appendChild(k)),ve.lastElementChild!==k&&ve.appendChild(k),A&&H!==ve&&(H&&A.unobserve(H),H=ve,A.observe(ve))}function pt(){if(!ve)return null;const D=a.getState().canvas??{},V=Math.max(1,Number(D.w)||0),Fe=Math.max(1,Number(D.h)||0);if(!V||!Fe)return null;const He=ve.getBoundingClientRect(),Ye=ve.querySelector("canvas, video, img")||[...ve.children].find(Ke=>Ke!==P&&Ke!==k)||null;let ct=0,kt=0,rt=ve.clientWidth||V,at=ve.clientHeight||Fe;if(Ye instanceof HTMLElement){const Ke=Ye.getBoundingClientRect();Ke.width>0&&Ke.height>0&&(ct=Ke.left-He.left,kt=Ke.top-He.top,rt=Ke.width,at=Ke.height)}if(!(rt>0&&at>0)){const Ke=ve.clientWidth||V,Nt=ve.clientHeight||Fe,Wt=Math.min(Ke/V,Nt/Fe)||1;rt=V*Wt,at=Fe*Wt,ct=Math.max(0,(Ke-rt)/2),kt=Math.max(0,(Nt-at)/2)}return{stageLeft:He.left,stageTop:He.top,left:ct,top:kt,scaleX:rt/V,scaleY:at/Fe}}function Mt(D,V){const Fe=Cn(D),He=Tr(D,Fe);return V>=Fe-.001&&V<=He+.001}function dn(D,V,Fe){const He=gr(n,"text",D,V,Fe);_=He.length?He[He.length-1]:null,Q(!0),Ot()}function Ut(D,V,Fe){return{x:(D-Fe.stageLeft-Fe.left)/Fe.scaleX,y:(V-Fe.stageTop-Fe.top)/Fe.scaleY}}function An(D,V,Fe){const He=(a.getState().overlays??[])[D];if(!He||He.type!=="filter")return;const Ye=a.getState().canvas??{w:1080,h:1920},ct=xt(He);if(!ct)return;const kt=V.clientX,rt=V.clientY,at=Math.max(0,(Number(Ye.w)||0)-ct.w),Ke=Math.max(0,(Number(Ye.h)||0)-ct.h),Nt=(bt,$t,un)=>{const pn=(bt-kt)/Fe.scaleX,Lt=($t-rt)/Fe.scaleY,Xt=qe(ct.x+pn,0,at),en=qe(ct.y+Lt,0,Ke);a.updateOverlay(D,{x:Xt,y:en},un?{transient:!0}:void 0)},Wt=bt=>{bt.preventDefault(),Nt(bt.clientX,bt.clientY,!0)},Ct=bt=>{window.removeEventListener("pointermove",Wt),window.removeEventListener("pointerup",Ct),window.removeEventListener("pointercancel",Ct),Nt(bt.clientX,bt.clientY,!1)};window.addEventListener("pointermove",Wt),window.addEventListener("pointerup",Ct),window.addEventListener("pointercancel",Ct)}function K(D,V,Fe,He){const Ye=(a.getState().overlays??[])[D];if(!Ye||Ye.type!=="filter")return;const ct=xt(Ye);if(!ct)return;const kt=a.getState().canvas??{w:1080,h:1920},rt=V.x===.5?.5:1-V.x,at=V.y===.5?.5:1-V.y,Ke=ct.x+ct.w*rt,Nt=ct.y+ct.h*at,Wt=Math.max(.1,48/Math.max(48,ct.w),48/Math.max(48,ct.h)),Ct=V.x===.5?1/0:Math.max(.1,(rt===0?(Number(kt.w)||0)-Ke:Ke)/Math.max(1,ct.w)),bt=V.y===.5?1/0:Math.max(.1,(at===0?(Number(kt.h)||0)-Nt:Nt)/Math.max(1,ct.h)),$t=Math.max(Wt,Math.min(Ct,bt,8)),un=(Xt,en,Tn)=>{const fn=Ut(Xt,en,He),zn=[];V.x!==.5&&zn.push(Math.abs(fn.x-Ke)/Math.max(1,ct.w)),V.y!==.5&&zn.push(Math.abs(fn.y-Nt)/Math.max(1,ct.h));const Dr=zn.length?Math.max(...zn):1,Hn=qe(Dr,Wt,$t),ur=Zt(Ye,Hn),Zn=xt(ur);if(!Zn)return;const Fr=Ke-Zn.w*rt,z=Nt-Zn.h*at;a.updateOverlay(D,{x:Fr,y:z,w:Zn.w,h:Zn.h},Tn?{transient:!0}:void 0)},pn=Xt=>{Xt.preventDefault(),un(Xt.clientX,Xt.clientY,!0)},Lt=Xt=>{window.removeEventListener("pointermove",pn),window.removeEventListener("pointerup",Lt),window.removeEventListener("pointercancel",Lt),un(Xt.clientX,Xt.clientY,!1)};window.addEventListener("pointermove",pn),window.addEventListener("pointerup",Lt),window.addEventListener("pointercancel",Lt)}function Le(D,V,Fe){const He=(a.getState().overlays??[])[D];if(!He||He.type!=="filter")return;const Ye=xt(He);if(!Ye)return;const ct=Fe.stageLeft+Fe.left+(Ye.x+Ye.w/2)*Fe.scaleX,kt=Fe.stageTop+Fe.top+(Ye.y+Ye.h/2)*Fe.scaleY,rt=Math.atan2(V.clientY-kt,V.clientX-ct),at=da(He),Ke=(Ct,bt,$t,un)=>{const pn=Math.atan2(bt-kt,Ct-ct);let Lt=Es(at+(pn-rt)*180/Math.PI);un&&(Lt=Math.round(Lt/15)*15),a.updateOverlay(D,{rotation:Lt},$t?{transient:!0}:void 0)},Nt=Ct=>{Ct.preventDefault(),Ke(Ct.clientX,Ct.clientY,!0,Ct.shiftKey)},Wt=Ct=>{window.removeEventListener("pointermove",Nt),window.removeEventListener("pointerup",Wt),window.removeEventListener("pointercancel",Wt),Ke(Ct.clientX,Ct.clientY,!1,Ct.shiftKey)};window.addEventListener("pointermove",Nt),window.addEventListener("pointerup",Wt),window.addEventListener("pointercancel",Wt)}function Xe(D,V){if(yt(),!P||!k)return;if(P.replaceChildren(),k.replaceChildren(),!pt()){P.hidden=!0,k.hidden=!0;return}k.hidden=!0;const Fe=Ze();if(!D.filter(He=>Mt(He.overlay,Fe)).length){P.hidden=!0;return}P.hidden=!0}function Tt(D,V,Fe){if(!Te)return;const He=(a.getState().overlays??[])[D];if(!He||He.type!=="filter")return;if(Fe.shiftKey||Fe.ctrlKey||Fe.metaKey){Fe.preventDefault(),Fe.stopPropagation();const bt=gr(n,"text",D,Fe,Bg(a.getState()).map($t=>$t.index));_=bt.length?bt[bt.length-1]:null,G(),Q(!0);return}Fe.preventDefault(),Fe.stopPropagation(),_=D,qn(n,"text",[D]),G(),T||Q(!0);const Ye=Ce(),ct=Math.max(Te.clientWidth/Ye,.001),kt=Cn(He),rt=Tr(He,kt),at=Math.max(Pt,rt-kt),Ke=$n(He),Nt=Fe.clientX,Wt=bt=>{const $t=(bt.clientX-Nt)/ct,un=a.getState().overlays??[];if(V==="move"){const Xt=Math.max(0,kt+$t),en=Xt+at,Tn=Nn(de,un,D,Xt,en,bt.clientY,Ke);tn(D,{startAt:Xt,endAt:en,timelineTrack:Tn},{transient:!0});return}if(V==="start"){const Xt=qe(kt+$t,0,rt-Pt),en=Nn(de,un,D,Xt,rt,bt.clientY,Ke);tn(D,{startAt:Xt,endAt:rt,timelineTrack:en},{transient:!0});return}const pn=Math.max(kt+Pt,rt+$t),Lt=Nn(de,un,D,kt,pn,bt.clientY,Ke);tn(D,{startAt:kt,endAt:pn,timelineTrack:Lt},{transient:!0})},Ct=bt=>{window.removeEventListener("pointermove",Wt),window.removeEventListener("pointerup",Ct),window.removeEventListener("pointercancel",Ct);const $t=(bt.clientX-Nt)/ct,un=a.getState().overlays??[];if(V==="move"){const Xt=Math.max(0,kt+$t),en=Xt+at,Tn=Nn(de,un,D,Xt,en,bt.clientY,Ke);tn(D,{startAt:Xt,endAt:en,timelineTrack:Tn});return}if(V==="start"){const Xt=qe(kt+$t,0,rt-Pt),en=Nn(de,un,D,Xt,rt,bt.clientY,Ke);tn(D,{startAt:Xt,endAt:rt,timelineTrack:en});return}const pn=Math.max(kt+Pt,rt+$t),Lt=Nn(de,un,D,kt,pn,bt.clientY,Ke);tn(D,{startAt:kt,endAt:pn,timelineTrack:Lt})};window.addEventListener("pointermove",Wt),window.addEventListener("pointerup",Ct),window.addEventListener("pointercancel",Ct),Ot()}function rn(D,V){if(dt(),!de||!Te||(de.replaceChildren(),de.hidden=D.length===0,!D.length))return;const Fe=Ce(),He=Te.clientWidth/Fe,Ye=Ss(a.getState()),ct=new Map;for(const kt of D){const rt=$n(kt.overlay),at=Ye.get(rt)??rt;let Ke=ct.get(rt);Ke||(Ke=document.createElement("div"),Ke.className="me-video-overlay-track-row",Ke.dataset.track=String(rt),Ke.style.top=`${il(at)}px`,ct.set(rt,Ke),de.appendChild(Ke));const Nt=document.createElement("div");Nt.className="me-video-text-track-clip me-video-filter-track-clip",V.has(kt.index)&&Nt.classList.add("is-active");const Wt=Cn(kt.overlay),Ct=al(kt.overlay);Nt.style.left=`${Wt*He}px`,Nt.style.width=`${Math.max(36,Ct*He)}px`;const bt=document.createElement("span");bt.className="me-video-text-track-icon",bt.textContent="Fx";const $t=document.createElement("span");$t.className="me-video-text-track-label",$t.textContent=_t(kt.overlay),$t.title=$t.textContent;const un=document.createElement("span");un.className="me-video-text-track-handle is-start";const pn=document.createElement("span");pn.className="me-video-text-track-handle is-end",Nt.append(bt,$t,un,pn),Nt.addEventListener("pointerdown",Lt=>Tt(kt.index,"move",Lt)),un.addEventListener("pointerdown",Lt=>Tt(kt.index,"start",Lt)),pn.addEventListener("pointerdown",Lt=>Tt(kt.index,"end",Lt)),Nt.addEventListener("click",Lt=>{if(Lt.preventDefault(),Lt.stopPropagation(),Lt.shiftKey||Lt.ctrlKey||Lt.metaKey){G(),Ot();return}const Xt=gr(n,"text",kt.index,Lt,D.map(en=>en.index));_=Xt.length?Xt[Xt.length-1]:null,G(),Q(!0),Ot()}),Ke.appendChild(Nt)}}function Ot(){x(()=>{Pe(),kn();const D=Bg(a.getState());lt(D);const V=new Set(jg(n,a.getState()));rn(D,V),Xe(D,V);const Fe=ot(xe());J.forEach(({entry:He,buttonEl:Ye,previewImage:ct})=>{Ye.classList.toggle("is-active",String(He.id??"")===Fe),Vt(ct)}),w.disabled=!Fe,U(),De()}),et()}function nn(D){return!!D&&(D===h||h.contains(D)||D===Y||Y?.contains?.(D)||D===ge||ge?.contains?.(D)||D===de||de?.contains?.(D)||D===P||P?.contains?.(D)||D===k||k?.contains?.(D))}function wn(D){return D.some(V=>{if(!nn(V.target))return!0;for(const Fe of V.addedNodes)if(!nn(Fe))return!0;for(const Fe of V.removedNodes)if(!nn(Fe))return!0;return!1})}const Z=new MutationObserver(D=>{se||n.__meVideoEnhancerObserverLock||wn(D)&&(Pe(),C())}),fe=D=>{const V=D.target;!(V instanceof Node)||!Y||!Y.contains(V)||(D.preventDefault(),D.stopPropagation(),D.stopImmediatePropagation?.(),mt(m))},Ne=D=>{D?.detail?.id!==O&&T&&(T=!1,Ot())},Je=()=>{Ot()};Z.observe(n,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["class","style","hidden"]}),n.addEventListener("me-video-inspector-open",Ne),n.addEventListener(fr,Je),n.addEventListener("click",fe,!0),window.addEventListener("resize",De);const Et=a.subscribe(()=>{Ot()});return J.forEach(({entry:D,buttonEl:V})=>{V.addEventListener("click",()=>{Rt(D.id||"")})}),w.addEventListener("click",()=>{xn()}),Pe(),Ot(),{destroy(){Z.disconnect(),M&&Ae&&M.unobserve(Ae),A&&H&&A.unobserve(H),Et(),n.removeEventListener("me-video-inspector-open",Ne),n.removeEventListener(fr,Je),n.removeEventListener("click",fe,!0),window.removeEventListener("resize",De),ge?.remove(),de?.remove(),P?.remove(),k?.remove(),h.remove(),br(n)}}}function I5(n,a,o,l){wa();const s=yf(l()),d=Mw(l()),m=Kg(s),h=document.createElement("div");h.className="me-video-text-panel me-video-color-panel me-video-effects-panel",h.hidden=!0,n.appendChild(h);const g=document.createElement("div");g.className="me-video-text-toolbar";const v=document.createElement("strong");v.textContent=d.title;const w=Hr(s.reset),W=Hr(d.close);g.append(v,w,W),h.appendChild(g);const S=document.createElement("p");S.className="me-video-text-hint",S.textContent=d.hint,h.appendChild(S);const J=m.map(Q=>{const te=ta(Q.title),U=Q.items.map(xe=>{const Ce=document.createElement("div");Ce.className="me-video-color-slider-control";const Ze=document.createElement("span");Ze.className="me-video-color-slider-value";const et=document.createElement("input");return et.type="range",et.min=String(xe.min),et.max=String(xe.max),et.step="0.02",et.dataset.adjustment=xe.key,Ce.append(Ze,et),te.body.appendChild(rr(xe.label,Ce)),{...xe,value:Ze,range:et}});return h.appendChild(te.section),{...Q,controls:U}});let Y=null,ue=null,oe=null,ge=null,Be=!1,Te=!1,de=!1;const Ae="effects",ve=typeof requestAnimationFrame=="function"?requestAnimationFrame:Q=>setTimeout(Q,16);function P(){Promise.resolve().then(()=>{de=!1;const Q=n.__meVideoEnhancerObserverLock??0;n.__meVideoEnhancerObserverLock=Math.max(0,Q-1)})}function k(Q){de=!0,n.__meVideoEnhancerObserverLock=(n.__meVideoEnhancerObserverLock??0)+1;try{return Q()}finally{P()}}function H(){Te||(Te=!0,ve(()=>{Te=!1,Me()}))}function T(Q=ue){return Q?[...Q.children].filter(te=>te instanceof HTMLButtonElement&&te!==Y&&!te.classList.contains("me-video-text-tool")):[]}function _(){ge&&(ge.isConnected&&(ge.style.display=ge.dataset.meTrimDisplay??"",ge.hidden=ge.dataset.meTrimHidden==="true",delete ge.dataset.meTrimDisplay,delete ge.dataset.meTrimHidden),ge=null)}function le(Q){if(!Q){_();return}ge!==Q&&(_(),Q.classList.remove("is-active"),Q.dataset.meTrimDisplay=Q.style.display??"",Q.dataset.meTrimHidden=Q.hidden?"true":"false",Q.hidden=!0,Q.style.display="none",ge=Q)}function se(){if(oe&&!oe.classList.contains("is-active")){oe.click();return}const Q=T()[0];Q&&!Q.classList.contains("is-active")&&Q.click()}function me(Q){if(!Y||!(Q instanceof HTMLButtonElement))return;const te=Q.getAttribute("style");te?Y.setAttribute("style",te):Y.removeAttribute("style"),Y.hidden=!1,Y.style.display=""}function O(){Y&&(Y.dataset.theme=ks(o()))}function $(){za(n,h),br(n)}function M(Q){const te=!!Q;if(te===Be){Me();return}Be=te,Be&&n.dispatchEvent(new CustomEvent("me-video-inspector-open",{detail:{id:Ae}})),Me()}function A(){if(Y?.classList.toggle("is-active",Be),!!oe&&Be){oe.classList.remove("is-active");return}}function ee(){h.hidden=!Be,A(),$()}function Me(){k(()=>{T().find(U=>U!==oe&&!U.hidden&&U.style.display!=="none"&&U.classList.contains("is-active"))&&(Be=!1),Be&&se();const Q=a.getState().filters??{},te=kf.some(U=>Math.abs(Number(Q[U])||0)>1e-4);J.forEach(U=>{U.controls.forEach(xe=>{const Ce=qe(Number(Q[xe.key])||0,xe.min,xe.max);xe.range.value=String(Ce),xe.value.textContent=Gg(Ce,xe.format)})}),w.disabled=!te,ee(),O()})}function _e(){k(()=>{const Q=n.querySelector(".me-video-toolrail");if(!Q)return;ue=Q;const te=T(ue);oe=Ec(te),le(oe);const U=oe??te[0]??null;(!Y||!Y.isConnected)&&(Y=document.createElement("button"),Y.type="button",Y.className="me-video-text-tool me-video-effects-tool",Y.innerHTML=`<span class="me-video-text-tool-icon">${Nw()}</span><span class="me-video-text-tool-label">${d.tool}</span>`),Y.setAttribute("title",d.tool),Y.setAttribute("aria-label",d.tool),me(U),Y.isConnected?U?.parentElement===ue&&Y.nextSibling!==U&&ue.insertBefore(Y,U):U?.parentElement===ue?ue.insertBefore(Y,U):ue.appendChild(Y),O(),A(),$()})}function x(Q){return!!Q&&(Q===h||h.contains(Q)||Q===Y||Y?.contains?.(Q))}function C(Q){return Q.some(te=>{if(!x(te.target))return!0;for(const U of te.addedNodes)if(!x(U))return!0;for(const U of te.removedNodes)if(!x(U))return!0;return!1})}const j=new MutationObserver(Q=>{de||n.__meVideoEnhancerObserverLock||C(Q)&&(_e(),H())}),B=Q=>{Q?.detail?.id!==Ae&&Be&&(Be=!1,Me())},G=Q=>{const te=Q.target;if(!(te instanceof Node)||!Y||!Y.contains(te))return;Q.preventDefault(),Q.stopPropagation(),Q.stopImmediatePropagation?.();const U=!Be;U&&se(),M(U)};j.observe(n,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","hidden"]}),n.addEventListener("me-video-inspector-open",B),n.addEventListener("click",G,!0),window.addEventListener("resize",H);const De=a.subscribe(()=>{H()});return J.forEach(Q=>{Q.controls.forEach(te=>{te.range.addEventListener("input",()=>{const U=qe(Number(te.range.value)||0,te.min,te.max);te.value.textContent=Gg(U,te.format),a.setFilter(te.key,U,{transient:!0})}),te.range.addEventListener("change",()=>{const U=qe(Number(te.range.value)||0,te.min,te.max);a.setFilter(te.key,U)})})}),w.addEventListener("click",()=>{x5(a)}),W.addEventListener("click",()=>{M(!1)}),_e(),Me(),{destroy(){j.disconnect(),De(),n.removeEventListener("me-video-inspector-open",B),n.removeEventListener("click",G,!0),window.removeEventListener("resize",H),_(),Y?.remove(),h.remove(),br(n)}}}function H5(n,a,o,l){wa(),nl();const s=yf(l()),d=Aw(l()),m=Kg(s),h=new Set(["brightness","contrast","saturation","temperature","tint","vibrance","gamma","highlights","shadows","whites","blacks","lightSense"]);function g(E,F,p){return E==="percent"?{min:(1+F)*100,max:(1+p)*100}:{min:F*100,max:p*100}}function v(E,F){const p=Number(E)||0;return F==="percent"?(1+p)*100:p*100}function w(E,F){const p=Number(E)||0;return F==="percent"?p/100-1:p/100}function W(E,F){const p=Math.round(v(E,F)*10)/10;return Number.isInteger(p),String(p)}function S(E,F){let p=Math.abs(Math.round(Number(E)||0)),b=Math.abs(Math.round(Number(F)||0));for(;b;){const L=p%b;p=b,b=L}return p||1}function J(E){const F=Math.max(1,Kn(E?.w??0)),p=Math.max(1,Kn(E?.h??0)),b=S(F,p);return`${F/b}:${p/b}`}function Y(E){const F=Number(E);if(!(F>0))return d.notAvailable;const p=["B","KB","MB","GB","TB"];let b=F,L=0;for(;b>=1024&&L<p.length-1;)b/=1024,L+=1;const q=b>=100||L===0?0:b>=10?1:2;return`${b.toFixed(q)} ${p[L]}`}function ue(E){const F=Number(E);return F>0?`${F.toFixed(2)} fps`:d.notAvailable}function oe(E,F){const p=Number(E),b=Number(F);if(!(p>0)||!(b>0))return d.notAvailable;const L=p*8/b;return L>=1e6?`${(L/1e6).toFixed(2)} Mbps`:L>=1e3?`${Math.round(L/1e3)} Kbps`:`${Math.round(L)} bps`}function ge(E){const F=String(E?.file?.type||E?.type||E?.mime||"").trim();if(F.includes("/"))return F.split("/").pop().toUpperCase();const p=String(E?.file?.name||E?.name||"").trim().match(/\.([a-z0-9]+)$/i);return p?p[1].toUpperCase():d.notAvailable}function Be(E){return String(E?.codec||E?.videoCodec||E?.codecName||E?.encoding||"").trim()||d.notAvailable}function Te(E){const F=Math.max(0,Math.round(Number(E?.width??E?.dims?.w)||0)),p=Math.max(0,Math.round(Number(E?.height??E?.dims?.h)||0));return!(F>0)||!(p>0)?d.notAvailable:`${F} x ${p} px`}function de(){const E=a.getState().clips??[],F=Br(n,"video").filter(b=>!!E[b]),p=(E[F[F.length-1]]??E[0]??null)?.srcIdx??0;return{source:(typeof a.getVideoSource=="function"?a.getVideoSource(p):null)??a.videoSources?.[p]??a.videoSources?.[0]??null,sourceIndex:p}}function Ae(){const E=a.getState(),{source:F,sourceIndex:p}=de(),b=E.canvas??{w:1080,h:1920},L=Ts(E),q=Number(F?.frameRate??F?.fps)||30,Ee=Number(F?.duration)||mt()||0,be=Number(F?.file?.size??F?.size)||0;return{videoName:String(F?.file?.name||F?.name||"").trim()||(F?`video-${p+1}`:d.notAvailable),ratio:J(L),canvasSize:dl(b),resolution:dl(L),frameRate:ue(q),bitrate:oe(be,Ee),format:ge(F),fileSize:Y(be),codec:Be(F),sourceSize:Te(F),videoLength:Di(mt())}}const ve=document.createElement("div");ve.className="me-video-text-panel me-video-color-panel me-video-effects-panel me-video-feature-one-panel",ve.hidden=!0,n.appendChild(ve);const P=document.createElement("div");P.className="me-video-text-toolbar";const k=document.createElement("strong");k.textContent=d.title;const H=Hr(s.reset);P.append(k,H);const T=document.createElement("p");T.className="me-video-text-hint",T.textContent=d.hint;const _=document.createElement("div");_.className="me-video-text-empty",_.textContent=d.placeholder;const le=document.createElement("div");le.className="me-video-text-panel me-video-feature-one-info-panel",le.hidden=!0,n.appendChild(le);const se=document.createElement("div");se.className="me-video-text-toolbar";const me=document.createElement("strong");me.textContent=d.videoInfoTitle,se.append(me);const O=ta(d.videoInfoTitle);O.section.classList.add("me-video-feature-one-meta-section"),O.title.remove();const $=[{key:"videoName",label:d.videoName},{key:"ratio",label:d.ratio},{key:"canvasSize",label:d.canvasSize},{key:"resolution",label:d.resolution},{key:"frameRate",label:d.frameRate},{key:"bitrate",label:d.bitrate},{key:"format",label:d.format},{key:"fileSize",label:d.fileSize},{key:"codec",label:d.codec},{key:"sourceSize",label:d.sourceSize},{key:"videoLength",label:d.videoLength}].map(E=>{const F=document.createElement("div");return F.className="me-video-feature-one-meta-value",O.body.appendChild(rr(E.label,F)),{...E,valueEl:F}});ve.append(P,T,_),le.append(se,O.section);const M=m.map(E=>{const F=ta(E.title),p=E.items.map(b=>{const L=g(b.format,b.min,b.max),q=document.createElement("div");q.className="me-video-color-slider-control me-video-color-number-control";const Ee=document.createElement("input");Ee.type="range",Ee.min=String(b.min),Ee.max=String(b.max),Ee.step="0.01",Ee.dataset.adjustment=b.key;const be=document.createElement("input");return be.type="number",be.min=String(L.min),be.max=String(L.max),be.step="1",be.inputMode="decimal",be.dataset.adjustment=b.key,q.append(Ee,be),F.body.appendChild(rr(b.label,q)),{...b,range:Ee,input:be,displayMin:L.min,displayMax:L.max}});return ve.appendChild(F.section),{...E,section:F.section,controls:p}});let A=null,ee=null,Me=null,_e=null,x=null,C=null,j=null,B=null,G=null,De=null,Q=null,te=!1,U=null,xe=!1,Ce=!1;const Ze="adjust",et=typeof requestAnimationFrame=="function"?requestAnimationFrame:E=>setTimeout(E,16),lt=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>Zt()),ot=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>Zt()),gt=[{key:"tl",x:0,y:0},{key:"tm",x:.5,y:0},{key:"tr",x:1,y:0},{key:"mr",x:1,y:.5},{key:"br",x:1,y:1},{key:"bm",x:.5,y:1},{key:"bl",x:0,y:1},{key:"ml",x:0,y:.5}],Qt={key:"rotate",x:.5,y:0};function _t(){Promise.resolve().then(()=>{Ce=!1;const E=n.__meVideoEnhancerObserverLock??0;n.__meVideoEnhancerObserverLock=Math.max(0,E-1)})}function xt(E){Ce=!0,n.__meVideoEnhancerObserverLock=(n.__meVideoEnhancerObserverLock??0)+1;try{return E()}finally{_t()}}function Zt(){xe||(xe=!0,et(()=>{xe=!1,en()}))}function tn(E=ee){return E?[...E.children].filter(F=>F instanceof HTMLButtonElement&&F!==A&&!F.classList.contains("me-video-text-tool")):[]}function _n(){_e&&(_e.isConnected&&(_e.style.display=_e.dataset.meTrimDisplay??"",_e.hidden=_e.dataset.meTrimHidden==="true",delete _e.dataset.meTrimDisplay,delete _e.dataset.meTrimHidden),_e=null)}function st(E){if(!E){_n();return}_e!==E&&(_n(),E.classList.remove("is-active"),E.dataset.meTrimDisplay=E.style.display??"",E.dataset.meTrimHidden=E.hidden?"true":"false",E.hidden=!0,E.style.display="none",_e=E)}function Ge(){if(Me&&!Me.classList.contains("is-active")){Me.click();return}const E=tn()[0];E&&!E.classList.contains("is-active")&&E.click()}function mt(){return ol(a)}function Rt(){return co(n)}function Vt(){if(!a.history?.present)return;const E=Rt(),F=Number(a.history.present.__mePreviewTimelineTime);Math.abs((Number.isFinite(F)?F:-1)-E)<.001||(a.history={...a.history,present:{...a.history.present,__mePreviewTimelineTime:E}},typeof a.emit=="function"&&a.emit())}function kn(E){const F={...cl};for(const p of kf){const b=Number(E?.[p]);Number.isFinite(b)&&(F[p]=h.has(p)?qe(b,-1,1):qe(b,0,1))}return F}function xn(E){const F=kn(E);return kf.some(p=>Math.abs(Number(F[p])||0)>1e-4)}function Pe(E){const F=kn(E),p=[],b=Rm(F,"");return b&&p.push(b),Math.abs(F.vibrance)>1e-4&&p.push(`saturate(${(1+F.vibrance*.65).toFixed(3)})`),Math.abs(F.temperature)>1e-4&&(F.temperature>0&&p.push(`sepia(${Math.min(.36,F.temperature*.28).toFixed(3)})`),p.push(`hue-rotate(${(-F.temperature*14).toFixed(2)}deg)`)),Math.abs(F.tint)>1e-4&&p.push(`hue-rotate(${(F.tint*10).toFixed(2)}deg)`),Math.abs(F.gamma)>1e-4&&p.push(`brightness(${(1+F.gamma*.08).toFixed(3)})`),(F.clarity>1e-4||F.sharpen>1e-4)&&p.push(`contrast(${(1+F.clarity*.16+F.sharpen*.1).toFixed(3)})`),p.join(" ").trim()||"none"}function dt(E){const F=kn(E),p=[];if(F.fade>1e-4&&p.push(`linear-gradient(0deg, rgba(255,245,235,${(F.fade*.18).toFixed(3)}), rgba(255,245,235,${(F.fade*.18).toFixed(3)}))`),F.vignette>1e-4){const b=(.28+F.vignette*.3).toFixed(3),L=(.16+F.vignette*.22).toFixed(3);p.push(`radial-gradient(circle at center, rgba(0,0,0,0) ${b}, rgba(0,0,0,${L}) 100%)`)}return F.grain>1e-4&&p.push(`linear-gradient(135deg, rgba(255,255,255,${(F.grain*.05).toFixed(3)}) 0%, rgba(0,0,0,${(F.grain*.05).toFixed(3)}) 100%)`),p.join(", ")}function yt(){const E=a.getState().overlays??[];if(U==null)return null;const F=E[U];return F?.type==="adjust"?F:null}function pt(E){if(!E.length){U=null;return}const F=gc(n,a.getState());U=F.length?F[F.length-1]:null}function Mt(E){const F=Number(E?.w),p=Number(E?.h);return!(F>0)||!(p>0)?null:{x:Number(E?.x)||0,y:Number(E?.y)||0,w:Math.max(48,F),h:Math.max(48,p)}}function dn(E,F){const p=Mt(E);if(!p)return E;const b=Math.max(.1,Number(F)||1);return{...E,w:Math.max(48,p.w*b),h:Math.max(48,p.h*b)}}function Ut(E,F,p={}){const b=(a.getState().overlays??[])[E];!b||b.type!=="adjust"||a.updateOverlay(E,ma(b,mt(),F),p)}function An(E,F){U!=null&&a.updateOverlay(U,E,F)}function K(E){const F=a.getState().overlays??[],p=F.length;if(typeof a.applyMut=="function")return a.applyMut(L=>({...L,overlays:[...Da(L.overlays),{...E,timelineTrack:0}]})),p;const b=Da(F);return a.commit?.({overlays:[...b,{...E,timelineTrack:0}]}),p}function Le(){const E=a.getState().canvas??{w:1080,h:1920};return{type:"adjust",x:0,y:0,w:Math.max(1,Number(E.w)||1080),h:Math.max(1,Number(E.h)||1920),rotation:0,...cl}}function Xe(){const E=mt();let F=qe(Rt(),0,Math.max(0,E-Pt)),p=Math.min(E,F+Qr);p-F<Pt&&(F=qe(E-Qr,0,Math.max(0,E-Pt)),p=Math.max(F+Pt,E));const b={...Le(),...ma(null,E,{startAt:F,endAt:p,timelineTrack:0})},L=K(b);U=Number.isInteger(L)?L:null,qn(n,"text",U==null?[]:[U],{preserveOther:!0}),Ge(),pn(U!=null)}function Tt(){const E=a.getState(),F=vf(E.overlays??[],gc(n,E));F.changed&&(a.commit({overlays:F.overlays}),U=F.selection.length?F.selection[F.selection.length-1]:null,qn(n,"text",F.selection),en())}function rn(){const E=a.getState(),F=gf(E.overlays??[],gc(n,E));F.changed&&(a.commit({overlays:F.overlays}),U=null,qn(n,"text",[]),en())}function Ot(){yt()&&An({...cl})}function nn(E){if(!A||!(E instanceof HTMLButtonElement))return;const F=E.getAttribute("style");F?A.setAttribute("style",F):A.removeAttribute("style"),A.hidden=!1,A.style.display=""}function wn(){A&&(A.dataset.theme=ks(o()))}function Z(){za(n,ve),za(n,le),br(n)}function fe(){const{timelineInner:E,timelineHost:F}=Ms(n,a.getState());if(!E||!F){C?.remove(),C=null,lt&&j&&(lt.unobserve(j),j=null),x=null;return}x=E,(!C||!C.isConnected||C.parentElement!==F)&&(C?.remove(),C=document.createElement("div"),C.className="me-video-text-timeline me-video-overlay-timeline me-video-feature-one-overlay-layer");for(const p of[...F.children])p!==C&&p instanceof HTMLElement&&p.classList.contains("me-video-feature-one-overlay-layer")&&p.remove();(C.parentElement!==F||F.lastElementChild!==C)&&F.appendChild(C),lt&&j!==x&&(j&<.unobserve(j),j=x,lt.observe(x))}function Ne(){const E=n.querySelector(".me-video-canvas-stage");if(!E){G?.remove(),G=null,De?.remove(),De=null,ot&&Q&&(ot.unobserve(Q),Q=null),B=null;return}B=E,B.style.position="relative",(!G||!G.isConnected||G.parentElement!==B)&&(G?.remove(),G=document.createElement("div"),G.className="me-video-filter-effect-layer",B.appendChild(G)),(!De||!De.isConnected||De.parentElement!==B)&&(De?.remove(),De=document.createElement("div"),De.className="me-video-filter-control-layer",B.appendChild(De)),B.lastElementChild!==De&&B.appendChild(De),ot&&Q!==B&&(Q&&ot.unobserve(Q),Q=B,ot.observe(B))}function Je(){if(!B)return null;const E=a.getState().canvas??{},F=Math.max(1,Number(E.w)||0),p=Math.max(1,Number(E.h)||0);if(!F||!p)return null;const b=B.getBoundingClientRect(),L=B.querySelector("canvas, video, img")||[...B.children].find(ae=>ae!==G&&ae!==De)||null;let q=0,Ee=0,be=B.clientWidth||F,je=B.clientHeight||p;if(L instanceof HTMLElement){const ae=L.getBoundingClientRect();ae.width>0&&ae.height>0&&(q=ae.left-b.left,Ee=ae.top-b.top,be=ae.width,je=ae.height)}if(!(be>0&&je>0)){const ae=B.clientWidth||F,ke=B.clientHeight||p,Ve=Math.min(ae/F,ke/p)||1;be=F*Ve,je=p*Ve,q=Math.max(0,(ae-be)/2),Ee=Math.max(0,(ke-je)/2)}return{stageLeft:b.left,stageTop:b.top,left:q,top:Ee,scaleX:be/F,scaleY:je/p}}function Et(E,F){const p=Cn(E),b=Tr(E,p);return F>=p-.001&&F<=b+.001}function D(E,F,p){const b=gr(n,"text",E,F,p);U=b.length?b[b.length-1]:null,pn(!0),en()}function V(E,F,p){return{x:(E-p.stageLeft-p.left)/p.scaleX,y:(F-p.stageTop-p.top)/p.scaleY}}function Fe(E,F,p){const b=(a.getState().overlays??[])[E];if(!b||b.type!=="adjust")return;const L=a.getState().canvas??{w:1080,h:1920},q=Mt(b);if(!q)return;const Ee=F.clientX,be=F.clientY,je=Math.max(0,(Number(L.w)||0)-q.w),ae=Math.max(0,(Number(L.h)||0)-q.h),ke=(ft,nt,it)=>{const ht=(ft-Ee)/p.scaleX,wt=(nt-be)/p.scaleY,Bt=qe(q.x+ht,0,je),jt=qe(q.y+wt,0,ae);a.updateOverlay(E,{x:Bt,y:jt},it?{transient:!0}:void 0)},Ve=ft=>{ft.preventDefault(),ke(ft.clientX,ft.clientY,!0)},We=ft=>{window.removeEventListener("pointermove",Ve),window.removeEventListener("pointerup",We),window.removeEventListener("pointercancel",We),ke(ft.clientX,ft.clientY,!1)};window.addEventListener("pointermove",Ve),window.addEventListener("pointerup",We),window.addEventListener("pointercancel",We)}function He(E,F,p,b){const L=(a.getState().overlays??[])[E];if(!L||L.type!=="adjust")return;const q=Mt(L);if(!q)return;const Ee=a.getState().canvas??{w:1080,h:1920},be=F.x===.5?.5:1-F.x,je=F.y===.5?.5:1-F.y,ae=q.x+q.w*be,ke=q.y+q.h*je,Ve=Math.max(.1,48/Math.max(48,q.w),48/Math.max(48,q.h)),We=F.x===.5?1/0:Math.max(.1,(be===0?(Number(Ee.w)||0)-ae:ae)/Math.max(1,q.w)),ft=F.y===.5?1/0:Math.max(.1,(je===0?(Number(Ee.h)||0)-ke:ke)/Math.max(1,q.h)),nt=Math.max(Ve,Math.min(We,ft,8)),it=(Bt,jt,on)=>{const Rn=V(Bt,jt,b),cr=[];F.x!==.5&&cr.push(Math.abs(Rn.x-ae)/Math.max(1,q.w)),F.y!==.5&&cr.push(Math.abs(Rn.y-ke)/Math.max(1,q.h));const Mr=cr.length?Math.max(...cr):1,ar=qe(Mr,Ve,nt),N=dn(L,ar),I=Mt(N);if(!I)return;const we=ae-I.w*be,tt=ke-I.h*je;a.updateOverlay(E,{x:we,y:tt,w:I.w,h:I.h},on?{transient:!0}:void 0)},ht=Bt=>{Bt.preventDefault(),it(Bt.clientX,Bt.clientY,!0)},wt=Bt=>{window.removeEventListener("pointermove",ht),window.removeEventListener("pointerup",wt),window.removeEventListener("pointercancel",wt),it(Bt.clientX,Bt.clientY,!1)};window.addEventListener("pointermove",ht),window.addEventListener("pointerup",wt),window.addEventListener("pointercancel",wt)}function Ye(E,F,p){const b=(a.getState().overlays??[])[E];if(!b||b.type!=="adjust")return;const L=Mt(b);if(!L)return;const q=p.stageLeft+p.left+(L.x+L.w/2)*p.scaleX,Ee=p.stageTop+p.top+(L.y+L.h/2)*p.scaleY,be=Math.atan2(F.clientY-Ee,F.clientX-q),je=da(b),ae=(We,ft,nt,it)=>{const ht=Math.atan2(ft-Ee,We-q);let wt=Es(je+(ht-be)*180/Math.PI);it&&(wt=Math.round(wt/15)*15),a.updateOverlay(E,{rotation:wt},nt?{transient:!0}:void 0)},ke=We=>{We.preventDefault(),ae(We.clientX,We.clientY,!0,We.shiftKey)},Ve=We=>{window.removeEventListener("pointermove",ke),window.removeEventListener("pointerup",Ve),window.removeEventListener("pointercancel",Ve),ae(We.clientX,We.clientY,!1,We.shiftKey)};window.addEventListener("pointermove",ke),window.addEventListener("pointerup",Ve),window.addEventListener("pointercancel",Ve)}function ct(E,F){if(Ne(),!G||!De)return;if(G.replaceChildren(),De.replaceChildren(),!Je()){G.hidden=!0,De.hidden=!0;return}De.hidden=!0;const p=Rt();if(!E.filter(b=>Et(b.overlay,p)).length){G.hidden=!0;return}G.hidden=!0}function kt(E,F,p){if(!x)return;const b=(a.getState().overlays??[])[E];if(!b||b.type!=="adjust")return;if(p.shiftKey||p.ctrlKey||p.metaKey){p.preventDefault(),p.stopPropagation();const ft=gr(n,"text",E,p,Dg(a.getState()).map(nt=>nt.index));U=ft.length?ft[ft.length-1]:null,Ge(),pn(!0);return}p.preventDefault(),p.stopPropagation(),U=E,qn(n,"text",[E]),Ge(),te||pn(!0);const L=mt(),q=Math.max(x.clientWidth/L,.001),Ee=Cn(b),be=Tr(b,Ee),je=Math.max(Pt,be-Ee),ae=$n(b),ke=p.clientX,Ve=ft=>{const nt=(ft.clientX-ke)/q,it=a.getState().overlays??[];if(F==="move"){const Bt=Math.max(0,Ee+nt),jt=Bt+je,on=Nn(C,it,E,Bt,jt,ft.clientY,ae);Ut(E,{startAt:Bt,endAt:jt,timelineTrack:on},{transient:!0});return}if(F==="start"){const Bt=qe(Ee+nt,0,be-Pt),jt=Nn(C,it,E,Bt,be,ft.clientY,ae);Ut(E,{startAt:Bt,endAt:be,timelineTrack:jt},{transient:!0});return}const ht=Math.max(Ee+Pt,be+nt),wt=Nn(C,it,E,Ee,ht,ft.clientY,ae);Ut(E,{startAt:Ee,endAt:ht,timelineTrack:wt},{transient:!0})},We=ft=>{window.removeEventListener("pointermove",Ve),window.removeEventListener("pointerup",We),window.removeEventListener("pointercancel",We);const nt=(ft.clientX-ke)/q,it=a.getState().overlays??[];if(F==="move"){const Bt=Math.max(0,Ee+nt),jt=Bt+je,on=Nn(C,it,E,Bt,jt,ft.clientY,ae);Ut(E,{startAt:Bt,endAt:jt,timelineTrack:on});return}if(F==="start"){const Bt=qe(Ee+nt,0,be-Pt),jt=Nn(C,it,E,Bt,be,ft.clientY,ae);Ut(E,{startAt:Bt,endAt:be,timelineTrack:jt});return}const ht=Math.max(Ee+Pt,be+nt),wt=Nn(C,it,E,Ee,ht,ft.clientY,ae);Ut(E,{startAt:Ee,endAt:ht,timelineTrack:wt})};window.addEventListener("pointermove",Ve),window.addEventListener("pointerup",We),window.addEventListener("pointercancel",We),en()}function rt(E,F){if(fe(),!C||!x||(C.replaceChildren(),C.hidden=E.length===0,!E.length))return;const p=mt(),b=x.clientWidth/p,L=Ss(a.getState()),q=new Map;for(const Ee of E){const be=$n(Ee.overlay),je=L.get(be)??be;let ae=q.get(be);ae||(ae=document.createElement("div"),ae.className="me-video-overlay-track-row",ae.dataset.track=String(be),ae.style.top=`${il(je)}px`,q.set(be,ae),C.appendChild(ae));const ke=document.createElement("div");ke.className="me-video-text-track-clip me-video-filter-track-clip",F.has(Ee.index)&&ke.classList.add("is-active");const Ve=Cn(Ee.overlay),We=al(Ee.overlay);ke.style.left=`${Ve*b}px`,ke.style.width=`${Math.max(36,We*b)}px`;const ft=document.createElement("span");ft.className="me-video-text-track-icon",ft.textContent="Adj";const nt=document.createElement("span");nt.className="me-video-text-track-label",nt.textContent=d.tool,nt.title=nt.textContent;const it=document.createElement("span");it.className="me-video-text-track-handle is-start";const ht=document.createElement("span");ht.className="me-video-text-track-handle is-end",ke.append(ft,nt,it,ht),ke.addEventListener("pointerdown",wt=>kt(Ee.index,"move",wt)),it.addEventListener("pointerdown",wt=>kt(Ee.index,"start",wt)),ht.addEventListener("pointerdown",wt=>kt(Ee.index,"end",wt)),ke.addEventListener("click",wt=>{if(wt.preventDefault(),wt.stopPropagation(),wt.shiftKey||wt.ctrlKey||wt.metaKey){Ge(),en();return}const Bt=gr(n,"text",Ee.index,wt,E.map(jt=>jt.index));U=Bt.length?Bt[Bt.length-1]:null,Ge(),pn(!0),en()}),ae.appendChild(ke)}}function at(E){M.forEach(F=>{F.controls.forEach(p=>{p.range.disabled=E,p.input.disabled=E})}),H.disabled=E}function Ke(){const E=Ae();$.forEach(F=>{const p=String(E[F.key]??d.notAvailable);F.valueEl.textContent=p,F.valueEl.title=p})}function Nt(E){const F=!!E;if(at(!F),H.hidden=!F,_.hidden=F,M.forEach(b=>{b.section.hidden=!F}),Ke(),!F)return;const p=kn(E);M.forEach(b=>{b.controls.forEach(L=>{const q=qe(Number(p[L.key])||0,L.min,L.max);L.range.value=String(q),L.input.value=W(q,L.format)})}),F&&(H.disabled=!xn(E))}function Wt(){return te&&!!yt()}function Ct(){return tn().some(E=>E!==Me&&!E.hidden&&E.style.display!=="none"&&E.classList.contains("is-active"))?!0:[...n.querySelectorAll(".me-video-toolrail .me-video-text-tool.is-active")].some(E=>E!==A)}function bt(){const E=Mc(n);return E instanceof HTMLElement?[...E.children].some(F=>F instanceof HTMLElement&&F!==ve&&F!==le&&!F.hidden):!1}function $t(){return te&&!!yt()&&!Ct()}function un(){const E=ll(n,a.getState().audioClips??[]).length>0;return!Ct()&&!bt()&&!E&&!yt()}function pn(E){const F=!!E;if(F===te){en();return}te=F,te&&n.dispatchEvent(new CustomEvent("me-video-inspector-open",{detail:{id:Ze}})),en()}function Lt(){te=!1,U=null,n.dispatchEvent(new CustomEvent("me-video-inspector-open",{detail:{id:"video-info"}})),ve.hidden=!0,Ke(),le.hidden=!1,fn(),Z()}function Xt(){ve.hidden=!$t(),le.hidden=!un(),fn(),Z()}function en(){xt(()=>{Ct()&&(te=!1),te&&Ge(),Tn();const E=Dg(a.getState());pt(E);const F=new Set(gc(n,a.getState()));rt(E,F),ct(E,F),Nt(yt()),Xt(),wn()}),Vt()}function Tn(){xt(()=>{const E=n.querySelector(".me-video-toolrail");if(!E)return;ee=E;const F=tn(ee);Me=Ec(F),st(Me);const p=Me??F[0]??null;(!A||!A.isConnected)&&(A=document.createElement("button"),A.type="button",A.className="me-video-text-tool me-video-feature-one-tool",A.innerHTML=`<span class="me-video-text-tool-icon">${_w()}</span><span class="me-video-text-tool-label">${d.tool}</span>`,A.addEventListener("click",()=>{Xe()})),A.setAttribute("title",d.tool),A.setAttribute("aria-label",d.tool),nn(p),A.isConnected?p?.parentElement===ee&&A.nextSibling!==p&&ee.insertBefore(A,p):p?.parentElement===ee?ee.insertBefore(A,p):ee.appendChild(A),wn(),A.classList.toggle("is-active",Wt()),fn(),Z()})}function fn(){if(A?.classList.toggle("is-active",Wt()),!!Me){if(Wt()){Me.classList.remove("is-active");return}Me.classList.remove("is-active")}}function zn(E){return!!E&&(E===ve||ve.contains(E)||E===le||le.contains(E)||E===A||A?.contains?.(E)||E===C||C?.contains?.(E)||E===G||G?.contains?.(E)||E===De||De?.contains?.(E))}function Dr(E){return E.some(F=>{if(!zn(F.target))return!0;for(const p of F.addedNodes)if(!zn(p))return!0;for(const p of F.removedNodes)if(!zn(p))return!0;return!1})}const Hn=new MutationObserver(E=>{Ce||n.__meVideoEnhancerObserverLock||Dr(E)&&(Tn(),Zt())}),ur=E=>{E?.detail?.id===Ze||E?.detail?.id==="video-info"||(te=!1,ve.hidden=!0,le.hidden=!0,fn(),Z(),Zt())},Zn=E=>{const F=E.target;F instanceof Element&&F.closest(".me-video-toolrail button")&&Zt()},Fr=()=>{if(!ff(n)){Lt();return}en()};Hn.observe(n,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","hidden"]}),n.addEventListener("me-video-inspector-open",ur),n.addEventListener("click",Zn,!0),n.addEventListener(fr,Fr),window.addEventListener("resize",Z);const z=a.subscribe(()=>{en()});function ie(E){const F=Number(E.input.value);if(!Number.isFinite(F))return null;const p=qe(F,E.displayMin,E.displayMax),b=qe(w(p,E.format),E.min,E.max);return{displayValue:p,internalValue:b}}function Oe(E){const F=Number(E.range.value);if(!Number.isFinite(F))return null;const p=qe(F,E.min,E.max);return{internalValue:p,displayValue:qe(v(p,E.format),E.displayMin,E.displayMax)}}return M.forEach(E=>{E.controls.forEach(F=>{F.range.addEventListener("input",()=>{const p=Oe(F);p&&(F.input.value=W(p.internalValue,F.format),An({[F.key]:p.internalValue},{transient:!0}))}),F.range.addEventListener("change",()=>{const p=Oe(F);if(!p){en();return}F.input.value=W(p.internalValue,F.format),An({[F.key]:p.internalValue})}),F.input.addEventListener("input",()=>{const p=ie(F);p&&(F.range.value=String(p.internalValue),An({[F.key]:p.internalValue},{transient:!0}))}),F.input.addEventListener("change",()=>{const p=ie(F);if(!p){en();return}F.range.value=String(p.internalValue),F.input.value=W(p.internalValue,F.format),An({[F.key]:p.internalValue})}),F.input.addEventListener("blur",()=>{const p=ie(F);if(!p){en();return}F.range.value=String(p.internalValue),F.input.value=W(p.internalValue,F.format)})})}),H.addEventListener("click",()=>{Ot()}),Tn(),en(),{destroy(){Hn.disconnect(),z(),lt&&j&<.unobserve(j),ot&&Q&&ot.unobserve(Q),n.removeEventListener("me-video-inspector-open",ur),n.removeEventListener("click",Zn,!0),n.removeEventListener(fr,Fr),window.removeEventListener("resize",Z),_n(),A?.remove(),C?.remove(),G?.remove(),De?.remove(),ve.remove(),le.remove(),br(n)}}}function V5(n,a,o){wa();const l=m5(o()),s=F5(),d=L5(s),m=document.createElement("div");m.className="me-video-text-panel me-video-ratio-panel",m.hidden=!0,n.appendChild(m);const h=document.createElement("div");h.className="me-video-text-toolbar";const g=document.createElement("strong");g.textContent=l.title,h.append(g);const v=ta(l.commonPresets),w=document.createElement("div");w.className="me-video-ratio-card-grid",v.body.appendChild(w);const W=ta(l.customSize),S=document.createElement("input");S.type="number",S.min="2",S.step="2",S.className="me-video-text-input";const J=document.createElement("input");J.type="number",J.min="2",J.step="2",J.className="me-video-text-input";const Y=bc(l.width,S),ue=bc(l.height,J),oe=document.createElement("div");oe.className="me-video-ratio-dimension-grid";const ge=document.createElement("div");ge.className="me-video-ratio-cross",ge.textContent="x",oe.append(Y,ge,ue);const Be=document.createElement("div");Be.className="me-video-ratio-lock-row";const Te=document.createElement("button");Te.type="button",Te.className="me-video-ratio-lock-toggle me-video-ratio-lock-inline";const de=document.createElement("button");de.type="button",de.className="me-video-ratio-quick",de.textContent=l.quickPortrait;const Ae=document.createElement("button");Ae.type="button",Ae.className="me-video-ratio-quick",Ae.textContent=l.quickLandscape,W.title.appendChild(Te),Be.append(de,Ae);const ve=document.createElement("p");ve.className="me-video-ratio-summary",W.body.append(oe,Be,ve);const P=ta(l.fitMode),k=document.createElement("div");k.className="me-video-ratio-fit-group";const H=[{fit:"cover",label:l.cover},{fit:"contain",label:l.contain},{fit:"force",label:l.force}].map(Pe=>{const dt=document.createElement("button");return dt.type="button",dt.className="me-video-ratio-fit-button",dt.dataset.fit=Pe.fit,dt.textContent=Pe.label,k.appendChild(dt),{fit:Pe.fit,button:dt}}),T=document.createElement("p");T.className="me-video-ratio-note",P.body.append(k,T),m.append(h,W.section,P.section,v.section);let _=null,le=null,se=null,me=null,O=null,$=!1,M=!0,A=!1,ee=!1;const Me="resize",_e=kc("9:16"),x=kc("16:9"),C=typeof requestAnimationFrame=="function"?requestAnimationFrame:Pe=>setTimeout(Pe,16);function j(){Promise.resolve().then(()=>{ee=!1;const Pe=n.__meVideoEnhancerObserverLock??0;n.__meVideoEnhancerObserverLock=Math.max(0,Pe-1)})}function B(Pe){ee=!0,n.__meVideoEnhancerObserverLock=(n.__meVideoEnhancerObserverLock??0)+1;try{return Pe()}finally{j()}}function G(){A||(A=!0,C(()=>{A=!1,Ge()}))}function De(Pe=le){return Pe?[...Pe.children].filter(dt=>dt instanceof HTMLButtonElement&&dt!==_&&!dt.classList.contains("me-video-text-tool")):[]}function Q(Pe){return[Pe?.textContent,Pe?.getAttribute?.("title"),Pe?.getAttribute?.("aria-label")].filter(Boolean).join(" ").trim().toLowerCase()}function te(Pe){const dt=["trim","timeline","\u526A\u8F91","\u65F6\u95F4\u8F74"];return Sf(Pe.find(yt=>{const pt=Q(yt);return dt.some(Mt=>pt.includes(Mt))})??Pe[0]??null)}function U(){if(me&&$){me.classList.remove("is-active");return}}function xe(Pe){const dt=[l.tool,l.title,"ratio","resize","\u6BD4\u4F8B","\u756B\u5E03","\u753B\u5E03"].map(yt=>String(yt??"").trim().toLowerCase()).filter(Boolean);return Pe.find(yt=>{const pt=Q(yt);return dt.some(Mt=>pt.includes(Mt))})??Pe[Pe.length-1]??null}function Ce(){O&&(O.isConnected&&(O.style.display=O.dataset.meResizeDisplay??"",O.hidden=O.dataset.meResizeHidden==="true",delete O.dataset.meResizeDisplay,delete O.dataset.meResizeHidden),O=null)}function Ze(Pe){if(!Pe){Ce();return}O!==Pe&&(Ce(),Pe.dataset.meResizeDisplay=Pe.style.display??"",Pe.dataset.meResizeHidden=Pe.hidden?"true":"false",Pe.hidden=!0,Pe.style.display="none",O=Pe)}function et(){me&&(me.classList.contains("is-active")||me.click())}function lt(){za(n,m),br(n)}function ot(Pe){const dt=!!Pe;if(dt===$){Ge();return}$=dt,$&&n.dispatchEvent(new CustomEvent("me-video-inspector-open",{detail:{id:Me}})),Ge()}function gt(){const Pe=n.querySelector(".me-video-toolrail");if(!Pe)return;le=Pe;const dt=De(le);me=te(dt),se=xe(dt),Ze(se),(!_||!_.isConnected)&&(_=document.createElement("button"),_.type="button",_.className="me-video-text-tool me-video-ratio-tool",_.innerHTML=`<span class="me-video-text-tool-icon">\u2922</span><span class="me-video-text-tool-label">${l.tool}</span>`,_.title=l.tool,_.setAttribute("aria-label",l.tool),_.addEventListener("click",()=>{const yt=!$;yt&&(et(),G()),ot(yt)})),_.isConnected?se?.parentElement===le&&_.nextSibling!==se&&le.insertBefore(_,se):se?.parentElement===le?le.insertBefore(_,se):le.appendChild(_),_.classList.toggle("is-active",$),U(),lt()}function Qt(){m.hidden=!$,_?.classList.toggle("is-active",$),U(),lt()}function _t(Pe=a.getState()){return Ff(Pe?.scale?.fit)}function xt(){Te.textContent=M?"\u{1F512}":"\u{1F513}",Te.title=M?l.lockRatio:l.unlockRatio,Te.setAttribute("aria-label",Te.title),Te.classList.toggle("is-active",M)}function Zt(Pe,dt,yt=_t(),pt=!1){const Mt={width:ji(Pe,2),height:ji(dt,2),fit:Ff(yt)};if(pt){a.patch({scale:Mt},{transient:!0});return}a.commit({scale:Mt})}function tn(Pe){const dt=Ts(a.getState()),yt=ji(Pe,dt.w);if(!M)return{width:yt,height:ji(J.value,dt.h)};const pt=dt.w>0&&dt.h>0?dt.w/dt.h:1;return{width:yt,height:ji(yt/pt,dt.h)}}function _n(Pe){const dt=Ts(a.getState()),yt=ji(Pe,dt.h);if(!M)return{width:ji(S.value,dt.w),height:yt};const pt=dt.w>0&&dt.h>0?dt.w/dt.h:1;return{width:ji(yt*pt,dt.w),height:yt}}function st(Pe){const dt=A5(d,Pe);w.replaceChildren();for(const yt of d){const pt=document.createElement("button");pt.type="button",pt.className="me-video-ratio-preset-group",pt.title=`${yt.ratio} (${dl(yt)})`,dt&&dt.ratio===yt.ratio&&pt.classList.add("is-active");const Mt=document.createElement("div");Mt.className="me-video-ratio-preset-head";const dn=document.createElement("div");dn.className="me-video-ratio-preset-title";const Ut=document.createElement("strong");Ut.className="me-video-ratio-preset-ratio",Ut.textContent=yt.ratio;const An=document.createElement("span");An.className="me-video-ratio-preset-size",An.textContent=`(${dl(yt)})`,dn.append(Ut,An);const K=document.createElement("span");K.className="me-video-ratio-preset-marker",K.setAttribute("aria-hidden","true"),Mt.append(dn,K);const Le=document.createElement("p");Le.className="me-video-ratio-preset-hint",Le.textContent=yt.hint,pt.addEventListener("click",()=>{Zt(yt.w,yt.h,_t())}),pt.append(Mt,Le),w.appendChild(pt)}}function Ge(){B(()=>{gt();const Pe=a.getState(),dt=De().find(dn=>dn.classList.contains("is-active"))??null;$&&dt&&dt!==me&&(et(),G());const yt=Ts(Pe),pt=Qg(Pe),Mt=_t(Pe);S.value=String(yt.w),J.value=String(yt.h),xt(),ve.innerHTML=`<strong>${l.summary}:</strong> ${dl(yt)}${Pe.scale?` | ${l.baseOutput}: ${dl(pt)}`:""}`,T.textContent=N5(l,Mt),H.forEach(dn=>{dn.button.classList.toggle("is-active",dn.fit===Mt)}),st(yt),Qt()})}function mt(Pe){return!!Pe&&(Pe===m||m.contains(Pe))}function Rt(Pe){return Pe.some(dt=>{if(!mt(dt.target))return!0;for(const yt of dt.addedNodes)if(!mt(yt))return!0;for(const yt of dt.removedNodes)if(!mt(yt))return!0;return!1})}const Vt=new MutationObserver(Pe=>{ee||n.__meVideoEnhancerObserverLock||Rt(Pe)&&(B(()=>{gt()}),G())}),kn=Pe=>{Pe?.detail?.id!==Me&&($&&($=!1,Qt()),G())};Vt.observe(n,{childList:!0,subtree:!0}),n.addEventListener("me-video-inspector-open",kn),window.addEventListener("resize",G);const xn=a.subscribe(()=>{G()});return S.addEventListener("input",()=>{const Pe=tn(S.value);Zt(Pe.width,Pe.height,_t(),!0)}),S.addEventListener("change",()=>{const Pe=tn(S.value);Zt(Pe.width,Pe.height,_t())}),J.addEventListener("input",()=>{const Pe=_n(J.value);Zt(Pe.width,Pe.height,_t(),!0)}),J.addEventListener("change",()=>{const Pe=_n(J.value);Zt(Pe.width,Pe.height,_t())}),Te.addEventListener("click",()=>{M=!M,Ge()}),de.addEventListener("click",()=>{Zt(_e.w,_e.h,_t())}),Ae.addEventListener("click",()=>{Zt(x.w,x.h,_t())}),H.forEach(Pe=>{Pe.button.addEventListener("click",()=>{const dt=Ts(a.getState());Zt(dt.w,dt.h,Pe.fit)})}),gt(),Ge(),{destroy(){Vt.disconnect(),xn(),n.removeEventListener("me-video-inspector-open",kn),window.removeEventListener("resize",G),Ce(),_?.remove(),m.remove(),br(n)}}}function W5(n,a,o,l){wa(),nl();const s=kg(l()),d=s.transitions,m=document.createElement("div");m.className="me-video-text-panel me-video-transition-panel",m.hidden=!0,n.appendChild(m);const h=document.createElement("div");h.className="me-video-text-toolbar";const g=document.createElement("strong");g.textContent=d.title;const v=Hr(d.fadeAll),w=Hr(d.close);h.append(g,v,w);const W=document.createElement("p");W.className="me-video-text-hint",W.textContent=d.hint;const S=document.createElement("div");S.className="me-video-text-list";const J=document.createElement("div");J.className="me-video-text-empty",J.textContent=d.empty;const Y=document.createElement("div");Y.className="me-video-transition-selection";const ue=document.createElement("div");ue.className="me-video-transition-grid";const oe=nf.map(st=>{const Ge=rl(s,st.key),mt=document.createElement("button");return mt.type="button",mt.className="me-video-transition-choice",mt.dataset.transition=st.key,mt.innerHTML=`<strong>${Ge.label}</strong><span>${st.key==="none"?d.instantCut:`${d.duration} ${Di(st.duration)}`}</span>`,ue.appendChild(mt),mt}),ge=document.createElement("input");ge.type="range",ge.min="0.1",ge.max="1.2",ge.step="0.05";const Be=document.createElement("div");Be.className="me-video-text-inline";const Te=document.createElement("span");Be.append(ge,Te);const de=bc(d.duration,Be);de.classList.add("is-span-2");const Ae=document.createElement("div");Ae.className="me-video-transition-actions";const ve=Hr(d.clearSelected),P=i5(d.clearAll,"clear");P.classList.add("me-video-text-cta"),Ae.append(P,ve),m.append(h,W,S,J,Y,ue,de,Ae);let k=null,H=null,T=null,_=null,le=null,se=!1,me=0,O=!1,$=!1;const M="transition",A=typeof requestAnimationFrame=="function"?requestAnimationFrame:st=>setTimeout(st,16),ee=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>x());function Me(){Promise.resolve().then(()=>{$=!1;const st=n.__meVideoEnhancerObserverLock??0;n.__meVideoEnhancerObserverLock=Math.max(0,st-1)})}function _e(st){$=!0,n.__meVideoEnhancerObserverLock=(n.__meVideoEnhancerObserverLock??0)+1;try{return st()}finally{Me()}}function x(){O||(O=!0,A(()=>{O=!1,gt()}))}function C(st){const Ge=!!st;if(Ge===se){gt();return}se=Ge,se&&n.dispatchEvent(new CustomEvent("me-video-inspector-open",{detail:{id:M}})),gt()}function j(){return H?[...H.querySelectorAll("button")].filter(st=>st!==k):[]}function B(){j()[0]?.click()}function G(){k&&(k.dataset.theme=ks(o()))}function De(){za(n,m),br(n)}function Q(){m.hidden=!se,k&&k.classList.toggle("is-active",se),De()}function te(st){const Ge=Math.max(0,(st.clips??[]).length-1);if(!Ge){me=0;return}me=qe(me,0,Ge-1)}function U(st,Ge=!1){if(Ge){a.patch({transitions:st},{transient:!0});return}a.commit({transitions:st})}function xe(st,Ge=!1){const mt=a.getState(),Rt=lf(mt),Vt=mt.clips??[];te(mt),!(!Rt.length||!Vt[me]||!Vt[me+1])&&(Rt[me]=fc({...Rt[me],...st},_r(Vt[me]),_r(Vt[me+1])),U(Rt,Ge))}function Ce(st){const Ge=a.getState(),mt=lf(Ge),Rt=Ge.clips??[];if(te(Ge),!mt.length||!Rt[me]||!Rt[me+1])return;const Vt=rl(s,st);mt[me]=fc({type:st,duration:st==="none"?0:mt[me]?.duration||Vt.duration},_r(Rt[me]),_r(Rt[me+1])),U(mt)}function Ze(st){const Ge=a.getState().clips??[];if(Ge.length<2)return;const mt=rl(s,st),Rt=[];for(let Vt=0;Vt<Ge.length-1;Vt++)Rt.push(fc({type:st,duration:st==="none"?0:mt.duration},_r(Ge[Vt]),_r(Ge[Vt+1])));U(Rt)}function et(){const st=Fs(n);if(!st){_?.remove(),_=null,ee&&le&&(ee.unobserve(le),le=null),T=null;return}T=st,T.style.position="relative",(!_||!_.isConnected||_.parentElement!==T)&&(_?.remove(),_=document.createElement("div"),_.className="me-video-transition-track",T.appendChild(_)),ee&&le!==T&&(le&&ee.unobserve(le),le=T,ee.observe(T))}function lt(st,Ge){S.replaceChildren();const mt=Math.max(0,(st.clips??[]).length-1);for(let Rt=0;Rt<mt;Rt++){const Vt=document.createElement("button");Vt.type="button",Vt.className="me-video-text-chip",Rt===me&&Vt.classList.add("is-active");const kn=Ge[Rt],xn=rl(s,kn?.type??"none");Vt.textContent=d.boundary(Rt+1,Rt+2,xn.short),Vt.title=d.boundaryTitle(Rt+1,Rt+2),Vt.addEventListener("click",()=>{me=Rt,B(),C(!0)}),S.appendChild(Vt)}}function ot(st,Ge){if(et(),!_||!T)return;_.replaceChildren();const mt=st.clips??[];if(mt.length<2)return;const Rt=Math.max(typeof a.contentDuration=="function"?a.contentDuration():0,.001),Vt=T.clientWidth/Rt;let kn=0;for(let xn=0;xn<mt.length-1;xn++){kn+=_r(mt[xn]);const Pe=Ge[xn],dt=rl(s,Pe?.type??"none"),yt=Pe?.type==="none",pt=document.createElement("button");pt.type="button",pt.className="me-video-transition-marker",yt&&pt.classList.add("is-cut-only"),Pe?.type!=="none"&&pt.classList.add("is-enabled"),xn===me&&pt.classList.add("is-active"),pt.style.left=`${kn*Vt}px`,pt.title=d.markerTitle(xn+1,xn+2,dt.label,Pe?.type!=="none"?Di(Pe.duration):"");const Mt=document.createElement("span");Mt.className="me-video-transition-pill",Mt.textContent=yt?"":dt.short,pt.appendChild(Mt),pt.addEventListener("click",()=>{me=xn,B(),C(!0)}),_.appendChild(pt)}}function gt(){_e(()=>{const st=a.getState(),Ge=lf(st);te(st),lt(st,Ge),ot(st,Ge);const mt=Ge[me]??null,Rt=rl(s,mt?.type??"none");J.hidden=Ge.length>0,Y.textContent=mt?d.selection(me+1,me+2):d.selectionEmpty,ge.disabled=!mt||Rt.key==="none",ve.disabled=!mt,P.disabled=Ge.length===0,v.disabled=Ge.length===0,ge.value=String(mt&&Rt.key!=="none"?mt.duration:of("fade").duration),Te.textContent=mt&&Rt.key!=="none"?Di(mt.duration):d.cut,oe.forEach(Vt=>{const kn=!!mt&&Vt.dataset.transition===Rt.key;Vt.classList.toggle("is-active",kn),Vt.disabled=!mt}),Q(),De(),G()})}function Qt(){_e(()=>{const st=n.querySelector(".me-video-toolrail");st&&(H=st,(!k||!k.isConnected)&&(k=document.createElement("button"),k.type="button",k.className="me-video-text-tool",k.innerHTML=`<span class="me-video-text-tool-icon">Fx</span><span class="me-video-text-tool-label">${d.tool}</span>`,k.addEventListener("click",()=>{const Ge=!se;Ge&&B(),C(Ge)})),k.isConnected||H.appendChild(k),G(),De())})}function _t(st){return!!st&&(st===m||m.contains(st)||st===k||st===_||_?.contains(st))}function xt(st){return st.some(Ge=>{if(!_t(Ge.target))return!0;for(const mt of Ge.addedNodes)if(!_t(mt))return!0;for(const mt of Ge.removedNodes)if(!_t(mt))return!0;return!1})}const Zt=new MutationObserver(st=>{$||n.__meVideoEnhancerObserverLock||xt(st)&&(Qt(),x())}),tn=st=>{st?.detail?.id!==M&&se&&(se=!1,gt())};Zt.observe(n,{childList:!0,subtree:!0}),n.addEventListener("me-video-inspector-open",tn),window.addEventListener("resize",x);const _n=a.subscribe(()=>{x()});return oe.forEach(st=>{st.addEventListener("click",()=>{Ce(st.dataset.transition??"none")})}),ge.addEventListener("input",()=>{Te.textContent=Di(ge.value),xe({duration:Number(ge.value)||.4},!0)}),ge.addEventListener("change",()=>{xe({duration:Number(ge.value)||.4})}),v.addEventListener("click",()=>Ze("fade")),ve.addEventListener("click",()=>Ce("none")),P.addEventListener("click",()=>Ze("none")),w.addEventListener("click",()=>{C(!1)}),Qt(),gt(),{destroy(){Zt.disconnect(),_n(),ee?.disconnect(),n.removeEventListener("me-video-inspector-open",tn),window.removeEventListener("resize",x),k?.remove(),_?.remove(),m.remove(),br(n)}}}function q5(n,a,o){wa();const l=f5(o()),s=typeof requestAnimationFrame=="function"?requestAnimationFrame:p=>setTimeout(p,16),d=document.createElement("div");d.className="me-video-text-panel me-video-add-panel",d.hidden=!0,n.appendChild(d);const m=document.createElement("div");m.className="me-video-text-toolbar";const h=document.createElement("strong");h.textContent=l.title;const g=Hr(l.reset);m.append(h,g);const v=document.createElement("p");v.className="me-video-text-hint",v.textContent=l.hint;const w=document.createElement("div");w.className="me-video-add-body";const W=document.createElement("section");W.className="me-video-add-section";const S=document.createElement("div");S.className="me-video-add-section-head";const J=document.createElement("span");J.className="me-video-add-section-title",J.textContent=l.tools,S.appendChild(J);const Y=document.createElement("div");Y.className="me-video-add-tool-grid";const ue=document.createElement("section");ue.className="me-video-add-section";const oe=document.createElement("div");oe.className="me-video-add-section-head";const ge=document.createElement("span");ge.className="me-video-add-section-title",ge.textContent=l.color,oe.appendChild(ge);const Be=document.createElement("div");Be.className="me-video-add-color-grid";const Te=document.createElement("div");Te.className="me-video-add-custom-color";const de=document.createElement("div");de.className="me-video-add-custom-head";const Ae=document.createElement("div");Ae.className="me-video-add-custom-preview";const ve=document.createElement("span");ve.className="me-video-add-custom-label",ve.textContent=l.custom,de.append(Ae,ve);const P=document.createElement("div");P.className="me-video-add-spectrum";const k=document.createElement("span");k.className="me-video-add-spectrum-thumb",P.appendChild(k);const H=document.createElement("div");H.className="me-video-add-hue-row";const T=document.createElement("div");T.className="me-video-add-custom-preview";const _=document.createElement("input");_.type="range",_.min="0",_.max="360",_.step="1",_.className="me-video-add-hue-slider",H.append(T,_);const le=document.createElement("div");le.className="me-video-add-rgb-grid";const se={};["r","g","b"].forEach(p=>{const b=document.createElement("label");b.className="me-video-add-rgb-field";const L=document.createElement("input");L.type="number",L.min="0",L.max="255",L.step="1",L.inputMode="numeric",L.className="me-video-add-rgb-input";const q=document.createElement("span");q.className="me-video-add-rgb-label",q.textContent=p.toUpperCase(),b.append(L,q),le.appendChild(b),se[p]=L}),Te.append(de,P,H,le);const me=document.createElement("section");me.className="me-video-add-section";const O=document.createElement("div");O.className="me-video-add-section-head";const $=document.createElement("span");$.className="me-video-add-section-title",$.textContent=l.width;const M=document.createElement("span");M.className="me-video-add-section-value",O.append($,M);const A=document.createElement("input");A.type="range",A.min=String(Ns),A.max=String(_s),A.step="1",A.className="me-video-add-slider",W.append(S,Y),ue.append(oe,Be,Te),me.append(O,A),w.append(W,ue,me),d.append(m,v,w);let ee=null,Me=null,_e=null,x=null,C=null,j=null,B=null,G=null,De=null,Q=!1,te=!1,U=null,xe=yc(),Ce=null,Ze=null,et=null,lt=0,ot=0;const gt="add",Qt=[{key:"tl",x:0,y:0},{key:"tm",x:.5,y:0},{key:"tr",x:1,y:0},{key:"ml",x:0,y:.5},{key:"mr",x:1,y:.5},{key:"bl",x:0,y:1},{key:"bm",x:.5,y:1},{key:"br",x:1,y:1}],_t={key:"rotate",x:.5,y:0},xt=typeof ResizeObserver=="function"?new ResizeObserver(()=>{Xe()}):null,Zt=typeof ResizeObserver=="function"?new ResizeObserver(()=>{Xe()}):null,tn=Wg.map(p=>{const b=document.createElement("button");return b.type="button",b.className="me-video-add-tool-card",b.dataset.tool=p.key,b.innerHTML=`<span class="me-video-add-tool-icon">${h5(p.key)}</span><span class="me-video-add-tool-label">${l[p.key]}</span>`,b.addEventListener("click",()=>{rn({tool:p.key})}),Y.appendChild(b),b}),_n=qg.map(p=>{const b=document.createElement("button");return b.type="button",b.className="me-video-add-color-chip",b.dataset.color=p,b.dataset.tone=p==="#ffffff"?"light":"dark",b.style.background=p,b.title=p,b.setAttribute("aria-label",p),b.addEventListener("click",()=>{rn({color:p})}),Be.appendChild(b),b});function st(p,b,L){et?.();const q=p==="mouse"?["mousemove"]:["pointermove"],Ee=p==="mouse"?["mouseup"]:["pointerup","pointercancel"],be=ae=>{b(ae)},je=ae=>{q.forEach(ke=>window.removeEventListener(ke,be)),Ee.forEach(ke=>window.removeEventListener(ke,je)),et=null,L(ae)};et=()=>{q.forEach(ae=>window.removeEventListener(ae,be)),Ee.forEach(ae=>window.removeEventListener(ae,je))},q.forEach(ae=>window.addEventListener(ae,be)),Ee.forEach(ae=>window.addEventListener(ae,je))}function Ge(p,b){const L=P.getBoundingClientRect();if(!(L.width>0&&L.height>0))return;const q=qe((p-L.left)/L.width,0,1),Ee=1-qe((b-L.top)/L.height,0,1),be=xc(xe.color),je=wf(be.r,be.g,be.b),ae=Ef(je.h,q,Ee);rn({color:wc(ae.r,ae.g,ae.b)})}function mt(p){const b=typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now(),L=p.type==="mousedown"?"mouse":"pointer";if(L==="mouse"){if(b<ot)return}else ot=b+80;p.preventDefault(),p.stopPropagation(),Ge(p.clientX,p.clientY),st(L,q=>{q.preventDefault(),Ge(q.clientX,q.clientY)},()=>{})}function Rt(p){const b=xc(xe.color),L=wf(b.r,b.g,b.b),q=Ef(qe(Number(p)||0,0,360),L.s,L.v);rn({color:wc(q.r,q.g,q.b)})}function Vt(p,b){const L=xc(xe.color),q={r:L.r,g:L.g,b:L.b};Number.isFinite(Number(b))&&(q[p]=qe(Number(b),0,255)),rn({color:wc(q.r,q.g,q.b)})}function kn(){return(a.getState().overlays??[]).map((p,b)=>({overlay:p,index:b})).filter(p=>Ba(p.overlay))}function xn(){const p=a.getState().overlays??[];if(U==null)return null;const b=p[U];return Ba(b)?b:null}function Pe(){const p=xn();if(!p)return!1;const b=yc({tool:xe.tool,color:p.color,width:p.width});return xf(xe,b)?!1:(xe=b,!0)}function dt(p,b,L={}){if(!xn()||U==null)return;const q={};Object.prototype.hasOwnProperty.call(b,"color")&&(q.color=p.color),Object.prototype.hasOwnProperty.call(b,"width")&&(q.width=p.width),Object.keys(q).length&&a.updateOverlay(U,q,L)}function yt(){return ol(a)}function pt(){return co(n)}function Mt(p,b,L={}){const q=(a.getState().overlays??[])[p];Ba(q)&&a.updateOverlay(p,ma(q,yt(),b),L)}function dn(p){const b=a.getState().overlays??[],L=b.length;if(typeof a.applyMut=="function")return a.applyMut(Ee=>({...Ee,overlays:[...Da(Ee.overlays),{...p,timelineTrack:0}]})),L;const q=Da(b);return a.commit?.({overlays:[...q,{...p,timelineTrack:0}]}),L}function Ut(p){const b=yt();let L=qe(pt(),0,Math.max(0,b-Pt)),q=Math.min(b,L+Qr);q-L<Pt&&(L=qe(b-Qr,0,Math.max(0,b-Pt)),q=Math.max(L+Pt,b));const Ee={...p,...ma(null,b,{startAt:L,endAt:q,timelineTrack:0})},be=dn(Ee);U=Number.isInteger(be)?be:null,qn(n,"text",U==null?[]:[U]),Z(),D(!0)}function An(){const{timelineInner:p,timelineHost:b}=Ms(n,a.getState());if(!p||!b){G?.remove(),G=null,xt&&De&&(xt.unobserve(De),De=null),B=null;return}B=p,(!G||!G.isConnected||G.parentElement!==b)&&(G?.remove(),G=document.createElement("div"),G.className="me-video-text-timeline me-video-overlay-timeline me-video-add-overlay-layer");for(const L of[...b.children])L!==G&&L instanceof HTMLElement&&L.classList.contains("me-video-add-overlay-layer")&&L.remove();(G.parentElement!==b||b.lastElementChild!==G)&&b.appendChild(G),xt&&De!==B&&(De&&xt.unobserve(De),De=B,xt.observe(B))}function K(p,b,L){if(!B)return;const q=(a.getState().overlays??[])[p];if(!Ba(q))return;if(L.shiftKey||L.ctrlKey||L.metaKey){L.preventDefault(),L.stopPropagation();const it=gr(n,"text",p,L,cf(a.getState()).map(ht=>ht.index));U=it.length?it[it.length-1]:null,Z(),D(!0);return}L.preventDefault(),L.stopPropagation(),U=p,qn(n,"text",[p]),Z(),Q||D(!0);const Ee=yt(),be=Math.max(B.clientWidth/Ee,.001),je=Cn(q),ae=Tr(q,je),ke=Math.max(Pt,ae-je),Ve=$n(q),We=L.clientX,ft=it=>{const ht=(it.clientX-We)/be,wt=a.getState().overlays??[];if(b==="move"){const on=Math.max(0,je+ht),Rn=on+ke,cr=Nn(G,wt,p,on,Rn,it.clientY,Ve);Mt(p,{startAt:on,endAt:Rn,timelineTrack:cr},{transient:!0});return}if(b==="start"){const on=qe(je+ht,0,ae-Pt),Rn=Nn(G,wt,p,on,ae,it.clientY,Ve);Mt(p,{startAt:on,endAt:ae,timelineTrack:Rn},{transient:!0});return}const Bt=Math.max(je+Pt,ae+ht),jt=Nn(G,wt,p,je,Bt,it.clientY,Ve);Mt(p,{startAt:je,endAt:Bt,timelineTrack:jt},{transient:!0})},nt=it=>{window.removeEventListener("pointermove",ft),window.removeEventListener("pointerup",nt),window.removeEventListener("pointercancel",nt);const ht=(it.clientX-We)/be,wt=a.getState().overlays??[];if(b==="move"){const on=Math.max(0,je+ht),Rn=on+ke,cr=Nn(G,wt,p,on,Rn,it.clientY,Ve);Mt(p,{startAt:on,endAt:Rn,timelineTrack:cr});return}if(b==="start"){const on=qe(je+ht,0,ae-Pt),Rn=Nn(G,wt,p,on,ae,it.clientY,Ve);Mt(p,{startAt:on,endAt:ae,timelineTrack:Rn});return}const Bt=Math.max(je+Pt,ae+ht),jt=Nn(G,wt,p,je,Bt,it.clientY,Ve);Mt(p,{startAt:je,endAt:Bt,timelineTrack:jt})};window.addEventListener("pointermove",ft),window.addEventListener("pointerup",nt),window.addEventListener("pointercancel",nt),Zn()}function Le(p,b){if(An(),!G||!B||(G.replaceChildren(),G.hidden=p.length===0,!p.length))return;const L=yt(),q=B.clientWidth/L,Ee=Ss(a.getState()),be=new Map;for(const je of p){const ae=$n(je.overlay),ke=Ee.get(ae)??ae;let Ve=be.get(ae);Ve||(Ve=document.createElement("div"),Ve.className="me-video-overlay-track-row",Ve.dataset.track=String(ae),Ve.style.top=`${il(ke)}px`,be.set(ae,Ve),G.appendChild(Ve));const We=document.createElement("div");We.className="me-video-text-track-clip me-video-add-track-clip",b.has(je.index)&&We.classList.add("is-active");const ft=Cn(je.overlay),nt=al(je.overlay);We.style.left=`${ft*q}px`,We.style.width=`${Math.max(36,nt*q)}px`;const it=document.createElement("span");it.className="me-video-text-track-icon",it.textContent="+";const ht=document.createElement("span");ht.className="me-video-text-track-label",ht.textContent=Zg(je.overlay,l),ht.title=ht.textContent;const wt=document.createElement("span");wt.className="me-video-text-track-handle is-start";const Bt=document.createElement("span");Bt.className="me-video-text-track-handle is-end",We.append(it,ht,wt,Bt),We.addEventListener("pointerdown",jt=>K(je.index,"move",jt)),wt.addEventListener("pointerdown",jt=>K(je.index,"start",jt)),Bt.addEventListener("pointerdown",jt=>K(je.index,"end",jt)),We.addEventListener("click",jt=>{if(jt.preventDefault(),jt.stopPropagation(),jt.shiftKey||jt.ctrlKey||jt.metaKey){Z(),Zn();return}const on=gr(n,"text",je.index,jt,p.map(Rn=>Rn.index));U=on.length?on[on.length-1]:null,Z(),D(!0),Zn()}),Ve.appendChild(We)}}function Xe(){te||(te=!0,s(()=>{te=!1,Zn()}))}function Tt(){tn.forEach(L=>{L.classList.toggle("is-active",L.dataset.tool===xe.tool)}),_n.forEach(L=>{L.classList.toggle("is-active",L.dataset.color===xe.color)});const p=xc(xe.color),b=wf(p.r,p.g,p.b);Te.classList.toggle("is-active",!qg.includes(xe.color)),Te.style.setProperty("--me-add-color-current",xe.color),Te.style.setProperty("--me-add-color-hue",b5(b.h)),Ae.style.background=xe.color,T.style.background=xe.color,k.style.left=`${b.s*100}%`,k.style.top=`${(1-b.v)*100}%`,_.value=String(Math.round(b.h)),se.r.value=String(p.r),se.g.value=String(p.g),se.b.value=String(p.b),A.value=String(qe(Math.round(Number(xe.width)||Pi.width),Ns,_s)),M.textContent=g5(xe.width),g.disabled=Ug(xe)}function rn(p,b={}){const L=yc({...xe,...p});if(xf(xe,L)){b.applyToSelected&&dt(L,p,b.overlayOptions);return}xe=L,b.applyToSelected!==!1&&dt(L,p,b.overlayOptions),Tt(),Xe()}function Ot(){if(Ug(xe)){Tt();return}xe=yc(),Tt(),Xe()}function nn(p=Me){return p?[...p.children].filter(b=>b instanceof HTMLButtonElement&&b!==ee&&!b.classList.contains("me-video-text-tool")):[]}function wn(){ee?.classList.toggle("is-active",Q)}function Z(){_e&&(_e.classList.contains("is-active")||_e.click())}function fe(){za(n,d),br(n)}function Ne(){Ce=null}function Je(){Ze?.(),Ze=null,Ne()}function Et(){d.hidden=!Q,wn(),fe()}function D(p){const b=!!p;if(b===Q){Zn();return}Q=b,Q?(n.dispatchEvent(new CustomEvent("me-video-inspector-open",{detail:{id:gt}})),Z()):(Je(),et?.(),et=null),Zn()}function V(){const p=n.querySelector(".me-video-toolrail");p&&(Me=p,_e=Ec(nn(p)),(!ee||!ee.isConnected)&&(ee=document.createElement("button"),ee.type="button",ee.className="me-video-text-tool me-video-add-tool",ee.innerHTML=`<span class="me-video-text-tool-icon">${v5()}</span><span class="me-video-text-tool-label">${l.tool}</span>`,ee.title=l.tool,ee.setAttribute("aria-label",l.tool),ee.addEventListener("click",()=>{const b=!Q;b&&Z(),D(b)})),ee.isConnected?ee.parentElement===Me&&ee!==Me.lastElementChild&&Me.appendChild(ee):Me.appendChild(ee),Et())}function Fe(){const p=n.querySelector(".me-video-canvas-stage");if(!p){C?.remove(),C=null,Zt&&j&&(Zt.unobserve(j),j=null),x=null;return}x=p,x.style.position="relative",!C||!C.isConnected||C.parentElement!==x?(C?.remove(),C=document.createElement("div"),C.className="me-video-add-canvas-layer",C.addEventListener("pointerdown",ur),C.addEventListener("mousedown",ur),C.addEventListener("click",b=>{b.preventDefault(),b.stopPropagation()}),x.appendChild(C)):x.lastElementChild!==C&&x.appendChild(C),Zt&&j!==x&&(j&&Zt.unobserve(j),j=x,Zt.observe(x)),C.hidden=!Q,C.dataset.tool=xe.tool}function He(){if(!x)return null;const p=a.getState().canvas??{},b=Math.max(1,Number(p.w)||0),L=Math.max(1,Number(p.h)||0);if(!b||!L)return null;const q=x.getBoundingClientRect(),Ee=x.querySelector("canvas, video, img")||[...x.children].find(Ve=>Ve!==C)||null;let be=0,je=0,ae=x.clientWidth||b,ke=x.clientHeight||L;if(Ee instanceof HTMLElement){const Ve=Ee.getBoundingClientRect();Ve.width>0&&Ve.height>0&&(be=Ve.left-q.left,je=Ve.top-q.top,ae=Ve.width,ke=Ve.height)}if(!(ae>0&&ke>0)){const Ve=x.clientWidth||b,We=x.clientHeight||L,ft=Math.min(Ve/b,We/L)||1;ae=b*ft,ke=L*ft,be=Math.max(0,(Ve-ae)/2),je=Math.max(0,(We-ke)/2)}return{stageLeft:q.left,stageTop:q.top,left:be,top:je,width:ae,height:ke,canvasWidth:b,canvasHeight:L,scaleX:ae/b,scaleY:ke/L}}function Ye(p,b,L){return{x:qe((p-L.stageLeft-L.left)/L.scaleX,0,L.canvasWidth),y:qe((b-L.stageTop-L.top)/L.scaleY,0,L.canvasHeight)}}function ct(p,b,L){return Number.isFinite(p?.clientX)&&Number.isFinite(p?.clientY)?Ye(p.clientX,p.clientY,b):L}function kt(p,b){return{x:Math.min(p.x,b.x),y:Math.min(p.y,b.y),w:Math.abs(b.x-p.x),h:Math.abs(b.y-p.y)}}function rt(p,b){const L=Cn(p),q=Tr(p,L);return b>=L-.001&&b<=q+.001}function at(p,b,L){const q=gr(n,"text",p,b,L);U=q.length?q[q.length-1]:null,D(!0),Zn()}function Ke(p,b,L,q,Ee){const be=Math.atan2(q-b,L-p),je=Math.max(12,Ee*3.5),ae=L-je*Math.cos(be-Math.PI/7),ke=q-je*Math.sin(be-Math.PI/7),Ve=L-je*Math.cos(be+Math.PI/7),We=q-je*Math.sin(be+Math.PI/7);return`M ${ae} ${ke} L ${L} ${q} L ${Ve} ${We}`}function Nt(p){if(!Array.isArray(p)||p.length<4)return"";let b=`M ${p[0]} ${p[1]}`;for(let L=2;L<p.length;L+=2)b+=` L ${p[L]} ${p[L+1]}`;return b}function Wt(p){const b=document.createElementNS("http://www.w3.org/2000/svg","svg");return b.classList.add("me-video-add-preview-svg"),b.setAttribute("viewBox",`0 0 ${p.canvasWidth} ${p.canvasHeight}`),b.setAttribute("width",String(p.width)),b.setAttribute("height",String(p.height)),b.style.left=`${p.left}px`,b.style.top=`${p.top}px`,b.style.width=`${p.width}px`,b.style.height=`${p.height}px`,b}function Ct(p,b,L){const q=document.createElementNS("http://www.w3.org/2000/svg",p);return q.classList.add("me-video-add-preview-shape"),q.setAttribute("stroke",b),q.setAttribute("stroke-width",String(L)),q}function bt(p){if(!Ce)return null;const b=Wt(p);if(Ce.type==="pen"){const L=Nt(Ce.points);if(!L)return b;const q=Ct("path",Ce.color,Ce.width);return q.setAttribute("d",L),b.appendChild(q),b}if(Ce.type==="line"||Ce.type==="arrow"){const L=Ct("line",Ce.color,Ce.width);if(L.setAttribute("x1",String(Ce.x1)),L.setAttribute("y1",String(Ce.y1)),L.setAttribute("x2",String(Ce.x2)),L.setAttribute("y2",String(Ce.y2)),b.appendChild(L),Ce.type==="arrow"){const q=Ct("path",Ce.color,Ce.width);q.setAttribute("d",Ke(Ce.x1,Ce.y1,Ce.x2,Ce.y2,Ce.width)),b.appendChild(q)}return b}if(Ce.type==="rect"){const L=Ct("rect",Ce.color,Ce.width);return L.setAttribute("x",String(Ce.x)),L.setAttribute("y",String(Ce.y)),L.setAttribute("width",String(Ce.w)),L.setAttribute("height",String(Ce.h)),b.appendChild(L),b}if(Ce.type==="ellipse"){const L=Ct("ellipse",Ce.color,Ce.width);return L.setAttribute("cx",String(Ce.x+Ce.w/2)),L.setAttribute("cy",String(Ce.y+Ce.h/2)),L.setAttribute("rx",String(Math.abs(Ce.w/2))),L.setAttribute("ry",String(Math.abs(Ce.h/2))),b.appendChild(L),b}return b}function $t(){if(Fe(),!C)return;const p=He();if(C.hidden=!Q||!p,!Q||!p){C.replaceChildren();return}C.dataset.tool=xe.tool,C.replaceChildren();const b=bt(p);b&&C.appendChild(b);const L=cf(a.getState()),q=new Set(Og(n,a.getState())),Ee=pt(),be=L.map(ke=>ke.index),je=L.filter(ke=>rt(ke.overlay,Ee)),ae=xe.tool==="eraser"?[]:q.size?je.filter(ke=>q.has(ke.index)):je;for(const ke of ae){const Ve=Ir(ke.overlay);if(!Ve)continue;const We=document.createElement("button");We.type="button",We.className="me-video-text-canvas-hit";const ft=q.has(ke.index),nt=ft&&U===ke.index;ft&&We.classList.add("is-active"),We.title=Zg(ke.overlay,l),We.style.left=`${p.left+Ve.x*p.scaleX}px`,We.style.top=`${p.top+Ve.y*p.scaleY}px`,We.style.width=`${Math.max(18,Ve.w*p.scaleX)}px`,We.style.height=`${Math.max(18,Ve.h*p.scaleY)}px`;const it=da(ke.overlay);if(it&&(We.style.transform=`rotate(${it}deg)`,We.style.transformOrigin="center center"),We.addEventListener("pointerdown",ht=>{if(ht.preventDefault(),ht.stopPropagation(),ht.shiftKey||ht.ctrlKey||ht.metaKey){at(ke.index,ht,be);return}U=ke.index,qn(n,"text",[ke.index]),D(!0),un(ke.index,ht,p)}),nt){for(const wt of Qt){const Bt=document.createElement("span");Bt.className="me-video-text-canvas-handle",Bt.dataset.handle=wt.key,Bt.style.left=`${wt.x*100}%`,Bt.style.top=`${wt.y*100}%`,Bt.addEventListener("pointerdown",jt=>{jt.preventDefault(),jt.stopPropagation(),U=ke.index,qn(n,"text",[ke.index]),D(!0),pn(ke.index,wt,jt,p)}),We.appendChild(Bt)}const ht=document.createElement("span");ht.className="me-video-text-canvas-handle",ht.dataset.handle=_t.key,ht.style.left=`${_t.x*100}%`,ht.style.top=`${_t.y*100}%`,ht.addEventListener("pointerdown",wt=>{wt.preventDefault(),wt.stopPropagation(),U=ke.index,qn(n,"text",[ke.index]),D(!0),Lt(ke.index,wt,p)}),We.appendChild(ht)}C.appendChild(We)}}function un(p,b,L){const q=(a.getState().overlays??[])[p];if(!Ba(q))return;const Ee=a.getState().canvas??{w:1080,h:1920},be=Ir(q);if(!be)return;const je=b.clientX,ae=b.clientY,ke=Math.max(0,(Number(Ee.w)||0)-be.w),Ve=Math.max(0,(Number(Ee.h)||0)-be.h),We=(it,ht,wt)=>{const Bt=(it-je)/L.scaleX,jt=(ht-ae)/L.scaleY,on=qe(be.x+Bt,0,ke),Rn=qe(be.y+jt,0,Ve),cr=ac(q,on-be.x,Rn-be.y);a.updateOverlay(p,cr,wt?{transient:!0}:void 0)},ft=it=>{it.preventDefault(),We(it.clientX,it.clientY,!0)},nt=it=>{window.removeEventListener("pointermove",ft),window.removeEventListener("pointerup",nt),window.removeEventListener("pointercancel",nt),We(it.clientX,it.clientY,!1)};window.addEventListener("pointermove",ft),window.addEventListener("pointerup",nt),window.addEventListener("pointercancel",nt)}function pn(p,b,L,q){const Ee=(a.getState().overlays??[])[p];if(!Ba(Ee))return;const be=Ir(Ee);if(!be)return;const je=a.getState().canvas??{w:1080,h:1920},ae=b.x===.5?.5:1-b.x,ke=b.y===.5?.5:1-b.y,Ve=be.x+be.w*ae,We=be.y+be.h*ke,ft=Math.max(.1,24/Math.max(24,be.w),24/Math.max(24,be.h)),nt=b.x===.5?1/0:Math.max(.1,(ae===0?(Number(je.w)||0)-Ve:Ve)/Math.max(1,be.w)),it=b.y===.5?1/0:Math.max(.1,(ke===0?(Number(je.h)||0)-We:We)/Math.max(1,be.h)),ht=Math.max(ft,Math.min(nt,it,8)),wt=(on,Rn,cr)=>{const Mr=Ye(on,Rn,q),ar=[];b.x!==.5&&ar.push(Math.abs(Mr.x-Ve)/Math.max(1,be.w)),b.y!==.5&&ar.push(Math.abs(Mr.y-We)/Math.max(1,be.h));const N=ar.length?Math.max(...ar):1,I=qe(N,ft,ht),we=Zm(Ee,I),tt=Ir(we);if(!tt)return;const Qe=Ve-tt.w*ae,qt=We-tt.h*ke,It=ac(we,Qe-tt.x,qt-tt.y);a.updateOverlay(p,It,cr?{transient:!0}:void 0)},Bt=on=>{on.preventDefault(),wt(on.clientX,on.clientY,!0)},jt=on=>{window.removeEventListener("pointermove",Bt),window.removeEventListener("pointerup",jt),window.removeEventListener("pointercancel",jt),wt(on.clientX,on.clientY,!1)};window.addEventListener("pointermove",Bt),window.addEventListener("pointerup",jt),window.addEventListener("pointercancel",jt)}function Lt(p,b,L){const q=(a.getState().overlays??[])[p];if(!Ba(q))return;const Ee=Ir(q);if(!Ee)return;const be=L.stageLeft+L.left+(Ee.x+Ee.w/2)*L.scaleX,je=L.stageTop+L.top+(Ee.y+Ee.h/2)*L.scaleY,ae=Math.atan2(b.clientY-je,b.clientX-be),ke=da(q),Ve=(nt,it,ht,wt)=>{const Bt=Math.atan2(it-je,nt-be);let jt=Es(ke+(Bt-ae)*180/Math.PI);wt&&(jt=Math.round(jt/15)*15),a.updateOverlay(p,{rotation:jt},ht?{transient:!0}:void 0)},We=nt=>{nt.preventDefault(),Ve(nt.clientX,nt.clientY,!0,nt.shiftKey)},ft=nt=>{window.removeEventListener("pointermove",We),window.removeEventListener("pointerup",ft),window.removeEventListener("pointercancel",ft),Ve(nt.clientX,nt.clientY,!1,nt.shiftKey)};window.addEventListener("pointermove",We),window.addEventListener("pointerup",ft),window.addEventListener("pointercancel",ft)}function Xt(p,b,L,q,Ee,be,je){const ae=Ee-L,ke=be-q,Ve=ae*ae+ke*ke||1,We=qe(((p-L)*ae+(b-q)*ke)/Ve,0,1),ft=L+We*ae,nt=q+We*ke;return(p-ft)**2+(b-nt)**2<=je*je}function en(p,b,L){if(!p)return!1;if(p.type==="pen"){for(let q=0;q+3<p.points.length;q+=2)if(Xt(b,L,p.points[q],p.points[q+1],p.points[q+2],p.points[q+3],ul+(Number(p.width)||0)/2))return!0;return!1}return p.type==="line"||p.type==="arrow"?Xt(b,L,p.x1,p.y1,p.x2,p.y2,ul+(Number(p.width)||0)/2):p.type==="rect"||p.type==="ellipse"?b>=p.x-ul&&b<=p.x+p.w+ul&&L>=p.y-ul&&L<=p.y+p.h+ul:!1}function Tn(p){const b=kn();for(let L=b.length-1;L>=0;L--)if(en(b[L].overlay,p.x,p.y)){a.removeOverlay(b[L].index),Xe();return}}function fn(p,b,L){Tn(p),zn(L,q=>{q.preventDefault(),Tn(Ye(q.clientX,q.clientY,b))},()=>{})}function zn(p,b,L){Je();const q=p==="mouse"?["mousemove"]:["pointermove"],Ee=p==="mouse"?["mouseup"]:["pointerup","pointercancel"],be=ae=>{b(ae)},je=ae=>{q.forEach(ke=>window.removeEventListener(ke,be)),Ee.forEach(ke=>window.removeEventListener(ke,je)),Ze=null,L(ae)};Ze=()=>{q.forEach(ae=>window.removeEventListener(ae,be)),Ee.forEach(ae=>window.removeEventListener(ae,je))},q.forEach(ae=>window.addEventListener(ae,be)),Ee.forEach(ae=>window.addEventListener(ae,je))}function Dr(p,b,L){const q=[p.x,p.y],Ee=be=>{const je=q[q.length-2],ae=q[q.length-1];Math.hypot(be.x-je,be.y-ae)<1||q.push(be.x,be.y)};Ce={type:"pen",points:[...q],color:xe.color,width:xe.width},$t(),zn(L,be=>{be.preventDefault();const je=Ye(be.clientX,be.clientY,b);Ee(je),Ce={type:"pen",points:[...q],color:xe.color,width:xe.width},$t()},be=>{const je=ct(be,b,{x:q[q.length-2],y:q[q.length-1]});Ee(je);const ae=[...q];Ne(),$t(),!(ae.length<4)&&(Ut({type:"pen",points:ae,color:xe.color,width:xe.width,rotation:0}),Xe())})}function Hn(p,b,L,q){const Ee=p5[p];if(!Ee)return;const be=je=>{if(Ee==="line"||Ee==="arrow")return{type:Ee,x1:b.x,y1:b.y,x2:je.x,y2:je.y,color:xe.color,width:xe.width};const ae=kt(b,je);return{type:Ee,x:ae.x,y:ae.y,w:ae.w,h:ae.h,color:xe.color,width:xe.width}};Ce=be(b),$t(),zn(q,je=>{je.preventDefault();const ae=Ye(je.clientX,je.clientY,L);Ce=be(ae),$t()},je=>{const ae=ct(je,L,b),ke=be(ae);Ne(),$t(),ke&&((ke.type==="line"||ke.type==="arrow")&&Math.hypot(ke.x2-ke.x1,ke.y2-ke.y1)<2||(ke.type==="rect"||ke.type==="ellipse")&&(ke.w<2||ke.h<2)||Ut({...ke,rotation:0}))})}function ur(p){if(!Q)return;const b=typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now(),L=p.type==="mousedown"?"mouse":"pointer";if(L==="mouse"){if(b<lt)return}else lt=b+80;if(typeof p.button=="number"&&p.button!==0)return;p.preventDefault(),p.stopPropagation();const q=He();if(!q)return;const Ee=Ye(p.clientX,p.clientY,q);if(xe.tool==="eraser"){fn(Ee,q,L);return}if(xe.tool==="brush"){Dr(Ee,q,L);return}Hn(xe.tool,Ee,q,L)}function Zn(){const p=Og(n,a.getState());U=p.length?p[p.length-1]:null,Pe(),nn().find(b=>b!==_e&&!b.hidden&&b.style.display!=="none"&&b.classList.contains("is-active"))&&(Q=!1,Je()),Q&&Z(),Tt(),Et(),$t(),Le(cf(a.getState()),new Set(p)),fe()}function Fr(p){return!!p&&(p===d||d.contains(p)||p===ee||ee?.contains?.(p)||p===G||G?.contains?.(p)||p===C||C?.contains?.(p))}function z(p){return p.some(b=>{if(!Fr(b.target))return!0;for(const L of b.addedNodes)if(!Fr(L))return!0;for(const L of b.removedNodes)if(!Fr(L))return!0;return!1})}const ie=new MutationObserver(p=>{z(p)&&(V(),Xe())}),Oe=p=>{p?.detail?.id!==gt&&Q&&D(!1)},E=()=>{Xe()};ie.observe(n,{childList:!0,subtree:!0}),n.addEventListener("me-video-inspector-open",Oe),n.addEventListener(fr,E),window.addEventListener("resize",Xe);const F=a.subscribe(()=>{Xe()});return g.addEventListener("click",()=>{Ot()}),P.addEventListener("pointerdown",mt),P.addEventListener("mousedown",mt),_.addEventListener("input",()=>{Rt(_.value)}),Object.entries(se).forEach(([p,b])=>{b.addEventListener("input",()=>{Vt(p,b.value)})}),A.addEventListener("input",()=>{rn({width:qe(Number(A.value)||Pi.width,Ns,_s)})}),V(),Zn(),{destroy(){ie.disconnect(),F(),Je(),et?.(),et=null,xt&&De&&xt.unobserve(De),xt?.disconnect?.(),Zt&&j&&Zt.unobserve(j),Zt?.disconnect?.(),n.removeEventListener("me-video-inspector-open",Oe),n.removeEventListener(fr,E),window.removeEventListener("resize",Xe),ee?.remove(),G?.remove(),C?.remove(),d.remove(),br(n)}}}function Z5(n,a,o){wa();const l=Lw(o()),s=document.createElement("div");s.className="me-video-text-panel me-video-audio-panel",s.hidden=!0;const d=document.createElement("div");d.className="me-video-text-toolbar";const m=document.createElement("strong");m.textContent=l.title;const h=Hr(l.close);d.append(m,h);const g=document.createElement("div");g.className="me-video-audio-source";const v=document.createElement("div");v.className="me-video-text-grid";function w(U=""){const xe=document.createElement("input");return xe.type="text",xe.readOnly=!0,xe.className=["me-video-audio-value",U].filter(Boolean).join(" "),xe}function W(U,xe,Ce){const Ze=document.createElement("div");return Ze.className="me-video-text-inline",Ze.append(xe,Ce),bc(U,Ze)}const S=document.createElement("input");S.type="range",S.min="50",S.max="200",S.step="1",S.disabled=!1,S.value="100",S.title=l.speedHint;const J=w("is-compact is-readonly");J.readOnly=!1,J.classList.remove("is-readonly"),J.inputMode="decimal",J.title=l.speedHint;const Y=W(l.speed,S,J),ue=document.createElement("input");ue.type="range",ue.min=String(ea),ue.max="1",ue.step="0.01",ue.disabled=!1,ue.value="1";const oe=w("is-readonly");oe.readOnly=!1,oe.classList.remove("is-readonly"),oe.inputMode="decimal";const ge=W(l.duration,ue,oe),Be=document.createElement("input");Be.type="range",Be.min="0",Be.max="2",Be.step="0.01";const Te=w(),de=W(l.volume,Be,Te),Ae=document.createElement("input");Ae.type="range",Ae.min="0",Ae.max="0.1",Ae.step="0.05";const ve=w(),P=W(l.fadeIn,Ae,ve),k=document.createElement("input");k.type="range",k.min="0",k.max="0.1",k.step="0.05";const H=w(),T=W(l.fadeOut,k,H);v.append(Y,ge,de,P,T),s.append(d,g,v);let _=null,le=!1,se=!1;const me="audio",O=typeof requestAnimationFrame=="function"?requestAnimationFrame:U=>setTimeout(U,16);function $(U){const xe=Math.max(0,Number(U)||0);return xe<=1e-4?"-\u221EdB":`${(20*Math.log10(xe)).toFixed(1)}dB`}function M(){const U=n.querySelector(".me-video-trim-panel");if(U instanceof HTMLElement)for(const xe of[...U.children].slice(2))xe instanceof HTMLElement&&xe.querySelector('input[type="range"]')&&/♪/.test(xe.textContent??"")&&(xe.style.display="none")}function A(){s.hidden=!le,za(n,s),tb(n,s,le),br(n)}function ee(U){const xe=!!U;if(xe===le){A();return}le=xe,le&&n.dispatchEvent(new CustomEvent("me-video-inspector-open",{detail:{id:me}})),A()}function Me(){zi(n,{audio:[]},{audio:null})}function _e(U,xe,Ce,Ze){let et=qe(Number(xe)||0,0,U),lt=qe(Number(Ce)||0,0,U);return et+lt<=U?{fadeIn:et,fadeOut:lt}:(Ze==="fadeOut"?et=Math.max(0,U-lt):lt=Math.max(0,U-et),{fadeIn:et,fadeOut:lt})}function x(U){const xe=a.getAudioSource?.(U?.srcIdx);return Math.max(_r(U),Number(xe?.duration)||0)}function C(U,xe=!1,Ce="fadeIn"){const Ze=a.getState(),et=Ze.audioClips??[];if(_==null||!et[_])return;const lt=et[_],ot=_r({...lt,...U}),gt=_e(ot,U.fadeIn??lt.fadeIn,U.fadeOut??lt.fadeOut,Ce),Qt=xt=>({...xt,...U,speed:uo(U.speed??xt.speed),volume:qe(Number(U.volume??xt.volume)||0,0,2),fadeIn:gt.fadeIn,fadeOut:gt.fadeOut}),_t=typeof a.patchAudio=="function"?a.patchAudio(Ze,_,Qt).audioClips??et:et.map((xt,Zt)=>Zt===_?Qt(xt):xt);if(xe){a.patch({audioClips:_t},{transient:!0});return}a.commit({audioClips:_t})}function j(U,xe=!1){const Ce=a.getState().audioClips??[];if(_==null||!Ce[_])return;const Ze=Ce[_],et=x(Ze),lt=Math.max(0,Number(Ze.in)||0),ot=Math.max(ea,et-lt),gt=qe(Number(U)||0,ea,ot);C({out:lt+gt},xe,"fadeIn")}function B(){if(M(),!(n.querySelector(".me-video-trim-panel")instanceof HTMLElement)){le&&ee(!1),_=null;return}const U=a.getState(),xe=U.audioClips??[],Ce=ll(n,xe),Ze=Ls(n,U.clips??[]),et=As(n,U),lt=Ce.length===1&&Ze.length===0&&et.length===0?Ce[0]:null;if(_=Number.isInteger(lt)&&xe[lt]?lt:null,_==null){le&&ee(!1);return}const ot=xe[_],gt=a.getAudioSource?.(ot.srcIdx),Qt=gt?.file?.name||gt?.name||`${l.source} ${_+1}`,_t=_r(ot),xt=Math.max(_t,Number(gt?.duration)||0),Zt=Math.max(_t,Math.max(ea,xt-Math.max(0,Number(ot.in)||0))),tn=uo(ot.speed),_n=qe(Number(ot.fadeIn)||0,0,_t),st=qe(Number(ot.fadeOut)||0,0,Math.max(0,_t-_n));g.textContent=`${l.source}: ${Qt}`,S.value=String(Math.round(tn*100)),J.value=Tw(tn),ue.max=String(Zt),ue.value=String(qe(_t,ea,Zt)),oe.value=Di(_t),Be.value=String(qe(Number(ot.volume)||0,0,2)),Te.value=$(ot.volume),Ae.max=String(Math.max(.1,_t)),k.max=String(Math.max(.1,_t)),Ae.value=String(_n),k.value=String(st),ve.value=Di(_n),H.value=Di(st),Ae.disabled=_t<=1e-4,k.disabled=_t<=1e-4,ee(!0)}function G(){se||(se=!0,O(()=>{se=!1,B()}))}const De=U=>{if(U?.detail?.id!==me){if(Br(n,"audio").length>0){Me();return}le&&ee(!1)}},Q=new MutationObserver(()=>{G()});Q.observe(n,{childList:!0,subtree:!0}),n.addEventListener("me-video-inspector-open",De),n.addEventListener(fr,G);const te=a.subscribe(()=>{G()});return h.addEventListener("click",()=>{Me()}),S.addEventListener("input",()=>{C({speed:uo((Number(S.value)||100)/100)},!0,"fadeIn")}),S.addEventListener("change",()=>{C({speed:uo((Number(S.value)||100)/100)},!1,"fadeIn")}),J.addEventListener("change",()=>{const U=_==null?null:(a.getState().audioClips??[])[_]??null;C({speed:Bw(J.value,U?.speed??1)},!1,"fadeIn")}),J.addEventListener("keydown",U=>{U.key==="Enter"&&(U.preventDefault(),J.blur())}),ue.addEventListener("input",()=>{j(Number(ue.value)||0,!0)}),ue.addEventListener("change",()=>{j(Number(ue.value)||0,!1)}),oe.addEventListener("change",()=>{const U=_==null?null:(a.getState().audioClips??[])[_]??null;j(Dw(oe.value,_r(U)),!1)}),oe.addEventListener("keydown",U=>{U.key==="Enter"&&(U.preventDefault(),oe.blur())}),Be.addEventListener("input",()=>{C({volume:Number(Be.value)||0},!0,"fadeIn")}),Be.addEventListener("change",()=>{C({volume:Number(Be.value)||0},!1,"fadeIn")}),Ae.addEventListener("input",()=>{C({fadeIn:Number(Ae.value)||0},!0,"fadeIn")}),Ae.addEventListener("change",()=>{C({fadeIn:Number(Ae.value)||0},!1,"fadeIn")}),k.addEventListener("input",()=>{C({fadeOut:Number(k.value)||0},!0,"fadeOut")}),k.addEventListener("change",()=>{C({fadeOut:Number(k.value)||0},!1,"fadeOut")}),B(),{destroy(){Q.disconnect(),te(),n.removeEventListener("me-video-inspector-open",De),n.removeEventListener(fr,G),tb(n,s,!1),s.remove(),br(n)}}}function U5(n,a,o=()=>null){wa();let l=!1,s=null,d=null,m=null,h=null;const g=typeof requestAnimationFrame=="function"?requestAnimationFrame:k=>setTimeout(k,16);function v(){l||(l=!0,g(()=>{l=!1,ve()}))}function w(){return Jr(typeof o=="function"?o():null)==="en"?"Cover":"\u5C01\u9762"}function W(k){return[k.textContent,k.title,k.getAttribute("aria-label"),k.getAttribute("data-tool"),k.getAttribute("data-testid")].filter(Boolean).join(" ").replace(/\s+/g," ").trim()}function S(k){if(!(k instanceof HTMLElement)||k===s||k.classList.contains("me-video-cover-set-btn")||k.classList.contains("me-video-cover-upload-btn")||k.closest(".me-video-timeline-area"))return!1;for(let T=k.parentElement,_=0;T&&_<8;_+=1,T=T.parentElement){const le=String(T.textContent||"");if(le.includes("\u9009\u62E9\u5C01\u9762\u5E27")||/(?:pick|select|choose)\s+(?:a\s+)?cover\s+frame/i.test(le))return!1}const H=W(k);return H?!!(H.includes("\u5C01\u9762")||/\b(cover|poster|thumbnail)\b/i.test(H)):!1}function J(){const k=n.querySelector(".me-video-toolrail"),H=(k?[...k.querySelectorAll('button,[role="button"]')]:[]).find(S);return H instanceof HTMLElement?H:[...n.querySelectorAll('button,[role="button"]')].find(S)}function Y(){const k=n.querySelector(".me-video-timeline-scroll");return k instanceof HTMLElement?k:null}function ue(k){return[...k.children].find(H=>H instanceof HTMLElement&&H!==h&&H.dataset.meTimelineCoverSlot!=="true")}function oe(k){const H=k?.querySelector("[data-clipblock]")?.parentElement;return H instanceof HTMLElement?H:null}function ge(k,H){return h instanceof HTMLElement||(h=document.createElement("div"),h.className="me-video-timeline-cover-slot",h.dataset.meTimelineCoverSlot="true"),k.style.display="flex",k.style.alignItems="flex-start",H instanceof HTMLElement&&(H.style.flex="0 0 auto"),(h.parentElement!==k||k.firstElementChild!==h)&&k.insertBefore(h,H??k.firstChild),h}function Be(){return s instanceof HTMLButtonElement||(s=document.createElement("button"),s.type="button",s.className="me-video-timeline-cover-proxy",s.innerHTML='<img alt="" draggable="false"><svg class="me-video-timeline-cover-proxy-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M4 20h16"/><path d="M6 18l9.5-9.5a2.1 2.1 0 0 1 3 3L9 21H5v-4z"/><path d="M14 6l4 4"/></svg><span class="me-video-timeline-cover-proxy-label"></span>',s.addEventListener("click",k=>{k.preventDefault(),k.stopPropagation(),m?.click()})),s}function Te(){typeof a?.commit=="function"&&a.commit({poster:void 0}),v()}function de(){return d instanceof HTMLButtonElement||(d=document.createElement("button"),d.type="button",d.className="me-video-timeline-cover-clear",d.innerHTML='<svg viewBox="0 0 12 12" aria-hidden="true"><path d="M3 3l6 6M9 3L3 9"/></svg>',d.addEventListener("click",k=>{k.preventDefault(),k.stopPropagation(),Te()})),d}function Ae(k,H,T){const _=w(),le=Be(),se=de(),me=le.querySelector(".me-video-timeline-cover-proxy-label");me&&(me.textContent=_);const O=le.querySelector("img"),$=typeof a?.getState=="function"?a.getState():{},M=$?.poster?.useAsVideoCover&&typeof $.poster.preview=="string"?$.poster.preview:"";O instanceof HTMLImageElement&&(M?O.src=M:O.removeAttribute("src")),le.classList.toggle("has-cover-image",!!M),le.title=k.title||k.getAttribute("aria-label")||_,le.setAttribute("aria-label",le.title),le.classList.toggle("is-active",k.classList.contains("is-active")||k.getAttribute("aria-pressed")==="true"),le.parentElement!==H&&H.insertBefore(le,H.firstChild),se.hidden=!M,se.title=Jr(typeof o=="function"?o():null)==="en"?"Remove cover":"\u53D6\u6D88\u5C01\u9762",se.setAttribute("aria-label",se.title),se.parentElement!==H&&H.appendChild(se),H.style.overflow="visible"}function ve(){const k=J(),H=Y(),T=H instanceof HTMLElement?ue(H):null,_=T instanceof HTMLElement?oe(T):null;if(!(k instanceof HTMLElement)||!(H instanceof HTMLElement)||!(T instanceof HTMLElement)||!(_ instanceof HTMLElement)){m&&(m.removeAttribute("data-me-cover-hidden"),m=null),s?.remove(),d?.remove(),h?.remove(),h=null;return}m&&m!==k&&m.removeAttribute("data-me-cover-hidden"),m=k,m.setAttribute("data-me-cover-hidden","true");const le=ge(H,T);Ae(k,le,_)}const P=new MutationObserver(()=>{v()});return P.observe(n,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","title","aria-label","aria-pressed"]}),v(),{destroy(){P.disconnect(),m?.removeAttribute("data-me-cover-hidden"),s?.remove(),d?.remove(),h?.remove()}}}function X5(n,a,o=()=>null){wa();let l=!1,s=null,d=null,m=null;const h=typeof requestAnimationFrame=="function"?requestAnimationFrame:O=>setTimeout(O,16);function g(){l||(l=!0,h(()=>{l=!1,le()}))}function v(){return Jr(typeof o=="function"?o():null)==="en"}function w(){const O=[...n.querySelectorAll('[role="dialog"], [aria-modal="true"]')];for(const M of O){if(!(M instanceof HTMLElement))continue;const A=String(M.textContent||"");if(A.includes("\u9009\u62E9\u5C01\u9762\u5E27")||/(?:pick|select|choose)\s+(?:a\s+)?cover\s+frame/i.test(A))return{root:M}}const $=[...n.querySelectorAll("strong,h1,h2,h3,span,div")];for(const M of $){if(!(M instanceof HTMLElement))continue;const A=String(M.textContent||"").trim();if(!A.includes("\u9009\u62E9\u5C01\u9762\u5E27")&&!/(?:pick|select|choose)\s+(?:a\s+)?cover\s+frame/i.test(A))continue;let ee=M.parentElement;for(let Me=0;ee&&Me<8;Me+=1,ee=ee.parentElement){if(!(ee instanceof HTMLElement))continue;const _e=[...ee.querySelectorAll("button")],x=_e.some(B=>{const G=String(B.textContent||B.title||B.getAttribute("aria-label")||"").trim();return G.includes("\u53D6\u6D88")||/cancel/i.test(G)||G==="\xD7"||G==="\xD7"||G==="\u2715"||G==="\u2716"}),C=!!ee.querySelector('input[type="range"]'),j=!!ee.querySelector("video,canvas,img")||[...ee.querySelectorAll("div")].some(B=>/url\(["']?.+["']?\)/.test(String(B.style.backgroundImage||"")));if(C||j||x&&_e.length>2)return{root:ee}}}return null}function W(O){const $=[...O.querySelectorAll("button")].filter(A=>A instanceof HTMLButtonElement&&A!==s&&A!==d),M=$.find(A=>{const ee=String(A.textContent||A.title||"").trim();return ee.includes("\u5BFC\u51FA\u5C01\u9762")||/export\s+cover/i.test(ee)})??[...$].reverse().find(A=>{const ee=String(A.textContent||A.title||"").trim();return!ee.includes("\u53D6\u6D88")&&!/cancel/i.test(ee)&&ee!=="\xD7"&&ee!=="\xD7"})??null;return{row:M?.parentElement??[...O.querySelectorAll("div")].filter(A=>A instanceof HTMLElement).sort((A,ee)=>{const Me=A.getBoundingClientRect();return ee.getBoundingClientRect().bottom-Me.bottom}).find(A=>A.querySelector("button"))??null,primaryButton:M}}function S(O){const $=String(O.textContent||"").match(/(\d{1,2}:\d{2}(?:\.\d+)?)\s*\//);if($){const A=hc($[1]);if(Number.isFinite(A))return A}const M=O.querySelector('input[type="range"]');if(M instanceof HTMLInputElement){const A=Number(M.value);if(Number.isFinite(A))return Math.max(0,A)}return 0}function J(O){return new Promise(($,M)=>{const A=new Image;A.onload=()=>$(A),A.onerror=M,A.src=O})}function Y(O,$){const M=Math.max(1,Math.round(Number(O)||0)),A=Math.max(1,Math.round(Number($)||0));if(!M||!A)return null;const ee=Math.min(1,1920/Math.max(M,A));return{width:Math.max(1,Math.round(M*ee)),height:Math.max(1,Math.round(A*ee))}}function ue(O,$=null){const M=O instanceof HTMLImageElement?O.naturalWidth:O.videoWidth,A=O instanceof HTMLImageElement?O.naturalHeight:O.videoHeight;if(!M||!A)return"";const ee=$?Y($.width,$.height):null,Me=ee?.width??M,_e=ee?.height??A,x=document.createElement("canvas");x.width=Me,x.height=_e;const C=x.getContext("2d");if(!C)return"";if(ee){const j=Math.max(Me/M,_e/A),B=Me/j,G=_e/j,De=Math.max(0,(M-B)/2),Q=Math.max(0,(A-G)/2);C.drawImage(O,De,Q,Math.min(M,B),Math.min(A,G),0,0,Me,_e)}else C.drawImage(O,0,0,M,A);return x.toDataURL("image/png")}async function oe(O){const $=String(O||"").trim();if(!$)return"";if(/^data:image\/(?:png|jpe?g);base64,/i.test($))return $;try{const M=await(await fetch($)).blob(),A=URL.createObjectURL(M);try{const ee=await J(A);return ue(ee)}finally{URL.revokeObjectURL(A)}}catch{try{const M=await J($);return ue(M)}catch{return""}}}async function ge(O){const $=O.getBoundingClientRect(),M=$.top+$.height*.68;function A(C){const j=C.getBoundingClientRect();return j.width<80||j.height<120||j.top>M?null:j}const ee=[...O.querySelectorAll("*")].map(C=>{if(!(C instanceof HTMLElement))return null;const j=A(C);if(!j)return null;const B=getComputedStyle(C).backgroundImage.match(/url\(["']?(.+?)["']?\)/);return B?{node:C,rect:j,src:B[1]}:null}).filter(Boolean).sort((C,j)=>j.rect.width*j.rect.height-C.rect.width*C.rect.height)[0];if(ee?.src){const C=await oe(ee.src);if(C)return C}const Me=[...O.querySelectorAll("canvas")].map(C=>{const j=A(C);return j?{node:C,rect:j}:null}).filter(Boolean).sort((C,j)=>j.rect.width*j.rect.height-C.rect.width*C.rect.height)[0]?.node;if(Me instanceof HTMLCanvasElement)try{return Me.toDataURL("image/png")}catch{return""}const _e=[...O.querySelectorAll("video")].map(C=>{const j=A(C);return C instanceof HTMLVideoElement&&j?{node:C,rect:j}:null}).filter(Boolean).sort((C,j)=>j.rect.width*j.rect.height-C.rect.width*C.rect.height)[0]?.node;if(_e instanceof HTMLVideoElement&&_e.videoWidth&&_e.videoHeight)try{const C=document.createElement("canvas");C.width=_e.videoWidth,C.height=_e.videoHeight;const j=C.getContext("2d");return j?(j.drawImage(_e,0,0,C.width,C.height),C.toDataURL("image/png")):""}catch{return""}const x=[...O.querySelectorAll("img")].map(C=>{const j=A(C);return C instanceof HTMLImageElement&&C.src&&j?{node:C,rect:j}:null}).filter(Boolean).sort((C,j)=>j.rect.width*j.rect.height-C.rect.width*C.rect.height)[0]?.node;if(x instanceof HTMLImageElement){try{const C=ue(x);if(C)return C}catch{}return oe(x.src)}return""}function Be(O){const $=O.getBoundingClientRect(),M=$.top+$.height*.68;function A(_e){const x=_e.getBoundingClientRect();return x.width<80||x.height<120||x.top>M?null:x}const ee=[];for(const _e of O.querySelectorAll("video,canvas,img")){const x=A(_e);x&&(_e instanceof HTMLVideoElement&&_e.videoWidth&&_e.videoHeight?ee.push({width:_e.videoWidth,height:_e.videoHeight,area:x.width*x.height}):_e instanceof HTMLCanvasElement&&_e.width&&_e.height?ee.push({width:_e.width,height:_e.height,area:x.width*x.height}):_e instanceof HTMLImageElement&&ee.push({width:_e.naturalWidth||x.width,height:_e.naturalHeight||x.height,area:x.width*x.height}))}const Me=ee.filter(_e=>_e.width>0&&_e.height>0).sort((_e,x)=>x.area-_e.area)[0];return Me?Y(Me.width,Me.height):null}function Te(O){return new Promise(($,M)=>{const A=new FileReader;A.onload=()=>$(String(A.result||"")),A.onerror=()=>M(A.error),A.readAsDataURL(O)})}async function de(O,$){const M=String(O?.name||"");if(!(O&&(/^image\//.test(O.type||"")||/\.(png|jpe?g|webp|gif|bmp)$/i.test(M))))return"";const A=await Te(O);if(!A)return"";const ee=await J(A);return ue(ee,Be($))}function Ae(O){function $(B){if(!(B instanceof HTMLElement))return!1;const G=B.getBoundingClientRect(),De=getComputedStyle(B);return G.width>1&&G.height>1&&De.display!=="none"&&De.visibility!=="hidden"}function M(B,G,De){for(let Q=B;Q instanceof HTMLElement&&Q!==n.parentElement&&(De.has(Q)||(G.push(Q),De.add(Q)),Q!==n);Q=Q.parentElement);}const A=[],ee=new Set,Me=[...n.querySelectorAll("div")].filter(B=>{if(!(B instanceof HTMLElement)||!$(B))return!1;const G=String(B.textContent||"");if(!G.includes("\u9009\u62E9\u5C01\u9762\u5E27")&&!/(?:pick|select|choose)\s+(?:a\s+)?cover\s+frame/i.test(G))return!1;const De=B.getBoundingClientRect();return De.width>300&&De.height>200}).sort((B,G)=>{const De=B.getBoundingClientRect(),Q=G.getBoundingClientRect();return De.width*De.height-Q.width*Q.height})[0];M(Me,A,ee),M(w()?.root,A,ee),M(O,A,ee);function _e(B){let G=!1;try{B.dispatchEvent(new MouseEvent("click",{bubbles:!0,cancelable:!0}))}catch{}try{B.click(),G=!0}catch{}const De=Object.keys(B).find(te=>te.startsWith("__reactProps$")),Q=De?B[De]?.onClick:null;if(typeof Q=="function")try{Q({currentTarget:B,target:B,nativeEvent:new MouseEvent("click",{bubbles:!0,cancelable:!0}),preventDefault(){},stopPropagation(){}}),G=!0}catch{}return G}const x=A.flatMap(B=>[...B.querySelectorAll("button")]),C=x.find(B=>{if(B===s||B===d)return!1;const G=String(B.textContent||B.title||B.getAttribute("aria-label")||"").trim();return G==="\xD7"||G==="\xD7"||G==="\u2715"||G==="\u2716"||G.includes("\u5173\u95ED")||/\b(close|dismiss)\b/i.test(G)});if(C instanceof HTMLButtonElement){_e(C);return}const j=x.find(B=>{if(B===s||B===d)return!1;const G=String(B.textContent||"").trim();return G==="\u53D6\u6D88"||/^cancel$/i.test(G)});if(j instanceof HTMLButtonElement){_e(j);return}document.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",bubbles:!0})),window.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",bubbles:!0}))}function ve(O,$){const M=S(O),A={time:M,useAsVideoCover:!0,...$?{preview:$}:{}};typeof a?.commit=="function"?a.commit({poster:A}):typeof a?.setPoster=="function"&&a.setPoster(M),Ae(O),h(()=>{const ee=w();ee?.root&&Ae(ee.root)}),g()}async function P(O){const $=await ge(O);ve(O,$)}async function k(O,$){const M=await de($,O);M&&ve(O,M)}function H(O){s instanceof HTMLButtonElement||(s=document.createElement("button"),s.type="button",s.className="me-video-cover-set-btn",s.addEventListener("click",async M=>{M.preventDefault(),M.stopPropagation();const A=w();if(A?.root){s.disabled=!0;try{await P(A.root)}finally{s.disabled=!1}}}));const $=!!(typeof a?.getState=="function"?a.getState():{})?.poster?.useAsVideoCover;return s.textContent=$?v()?"Cover set":"\u5DF2\u8BBE\u4E3A\u5C01\u9762":v()?"Set as cover":"\u8BBE\u4E3A\u5C01\u9762",s.classList.toggle("is-set",$),s.title=s.textContent,s.setAttribute("aria-label",s.textContent),s}function T(){return m instanceof HTMLInputElement||(m=document.createElement("input"),m.type="file",m.accept="image/png,image/jpeg,image/webp,image/*",m.hidden=!0,m.setAttribute("aria-hidden","true"),m.addEventListener("change",async()=>{const O=m.files?.[0];if(m.value="",!O)return;const $=w();if($?.root){d instanceof HTMLButtonElement&&(d.disabled=!0);try{await k($.root,O)}finally{d instanceof HTMLButtonElement&&(d.disabled=!1)}}}),n.appendChild(m)),m}function _(O){return d instanceof HTMLButtonElement||(d=document.createElement("button"),d.type="button",d.className="me-video-cover-upload-btn",d.addEventListener("click",$=>{$.preventDefault(),$.stopPropagation(),T().click()})),d.textContent=v()?"Upload cover":"\u4E0A\u4F20\u5C01\u9762",d.title=d.textContent,d.setAttribute("aria-label",d.textContent),d}function le(){const O=w();if(!O?.root){s?.remove(),d?.remove();return}const $=H(O.root),M=_(O.root),{row:A,primaryButton:ee}=W(O.root);if(!(A instanceof HTMLElement))return;const Me=ee instanceof HTMLElement&&ee.parentElement===A?ee:null;($.parentElement!==A||Me&&$.nextElementSibling!==Me)&&A.insertBefore($,Me),(M.parentElement!==A||M.nextElementSibling!==$)&&A.insertBefore(M,$)}const se=new MutationObserver(g);se.observe(n,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","hidden","value"]});const me=typeof a?.subscribe=="function"?a.subscribe(g):null;return g(),{destroy(){se.disconnect(),me?.(),s?.remove(),d?.remove(),m?.remove()}}}function K5(n,a,o=()=>null){nl();let l=!1;const s=typeof requestAnimationFrame=="function"?requestAnimationFrame:P=>setTimeout(P,16);function d(P){return!!P.closest(["[data-clipblock]","[data-audioclip]",".me-video-text-track-clip",".me-video-text-canvas-hit",".me-video-text-chip",".me-video-trim-action-btn",".me-video-transition-marker",".me-video-text-panel",".me-video-inspector-rail",".me-video-toolrail button",".me-video-timeline-zoom button","input","select","textarea","button","label"].join(","))}function m(P){return!!P.closest(["input","select","textarea",'[contenteditable="true"]','[contenteditable=""]'].join(","))}function h(){l||(l=!0,s(()=>{l=!1,ue()}))}function g(){const P=n.querySelector(".me-video-timeline-scroll");if(!(P instanceof HTMLElement))return;const k=Jr(typeof o=="function"?o():null);P.title=k==="en"?"Hold Ctrl or Shift to select multiple layers.":"\u6309\u4F4F Ctrl \u6216 Shift \u53EF\u591A\u9009\u56FE\u5C42\u3002"}function v(){const P=new Set(Br(n,"video"));for(const k of n.querySelectorAll("[data-clipblock]")){const H=Number(k.getAttribute("data-clipblock"));k.classList.toggle("me-video-multi-selected",Number.isInteger(H)&&P.has(H))}}function w(P=1/0){const k=Fs(n);if(!(k instanceof HTMLElement))return[];const H=[];for(const T of k.querySelectorAll("span")){if(!String(T.textContent??"").trim().startsWith("\u266A"))continue;const _=T.parentElement;!(_ instanceof HTMLElement)||H.includes(_)||H.push(_)}return Number.isFinite(P)?H.slice(0,Math.max(0,P)):H}function W(){const P=a.getState().audioClips??[],k=new Set(Br(n,"audio")),H=w(),T=H.slice(0,P.length);H.slice(P.length).forEach(_=>{_ instanceof HTMLElement&&(_.removeAttribute("data-audioclip"),_.classList.remove("me-video-multi-selected"),_.style.removeProperty("background"),_.style.removeProperty("border"),_.style.removeProperty("box-shadow"),_.style.removeProperty("color"),_.style.removeProperty("transform"),_.style.removeProperty("opacity"))}),T.forEach((_,le)=>{_.dataset.audioclip=String(le);const se=k.has(le),me=[..._.children].filter(x=>x instanceof HTMLElement),O=me.length>1?1:0,$=me[O]??null,M=me.filter((x,C)=>C!==O),A=[..._.querySelectorAll("span")],ee=se?"linear-gradient(180deg, rgba(34,197,94,0.96) 0%, rgba(21,128,61,0.94) 100%)":"linear-gradient(180deg, rgba(220,252,231,0.98) 0%, rgba(187,247,208,0.94) 100%)",Me=se?"2px solid rgba(21,128,61,0.96)":"2px solid rgba(34,197,94,0.5)",_e="#166534";_.classList.toggle("me-video-multi-selected",se),_.style.boxShadow=se?"0 0 0 2px rgba(34,197,94,0.22), 0 8px 18px rgba(22,101,52,0.16)":"0 1px 6px rgba(22,101,52,0.08)",_.style.background=ee,_.style.border=Me,_.style.color=_e,_.style.transform=se?"translateY(-1px)":"none",_.style.opacity=se?"1":"0.98",$ instanceof HTMLElement&&($.style.background=ee,$.style.border=Me,$.style.color=_e,$.style.boxShadow=se?"0 0 0 1px rgba(21,128,61,0.14), 0 8px 18px rgba(22,101,52,0.14)":"0 1px 6px rgba(22,101,52,0.08)"),M.forEach(x=>{x.style.background=se?"rgba(21,128,61,0.92)":"rgba(34,197,94,0.72)",x.style.opacity="1"}),A.forEach((x,C)=>{x.style.color=C===0?_e:"rgba(22,101,52,0.9)",x.style.opacity="1"})})}function S(){return[...n.querySelectorAll(".me-video-trim-actions .me-video-trim-action-btn")].map(P=>{if(!(P instanceof HTMLElement)||P.tagName.toLowerCase()!=="button")return P;const k=document.createElement("div");for(const H of[...P.attributes])H.name==="type"||H.name==="disabled"||k.setAttribute(H.name,H.value);return k.innerHTML=P.innerHTML,k.style.cssText=P.style.cssText,k.style.display="flex",k.style.justifyContent="center",k.style.alignItems="center",k.setAttribute("role","button"),k.tabIndex=P.disabled?-1:0,k.setAttribute("aria-disabled",P.disabled?"true":"false"),P.disabled&&(k.dataset.disabled="true"),P.replaceWith(k),k})}function J(P,k,H,T){const _=S();if(_.length<3)return;const le=P.clips??[],se=P.audioClips??[],me=co(n),O=k.length>0||H.length>0||T.length>0,$=e5(le,k,me)||n5(se,H,me)||t5(P.overlays??[],T,me),M=O,A=H.length>0||T.length>0||k.length>0&&k.length<le.length,ee=[$,M,A];_.forEach((Me,_e)=>{const x=ee[_e];Me.setAttribute("aria-disabled",x?"false":"true"),Me.tabIndex=x?0:-1,x?delete Me.dataset.disabled:Me.dataset.disabled="true",Me.style.opacity=x?"1":"0.5",_e===2?(Me.style.color=x?"#dc2626":"var(--me-fg-muted, #9a9aa3)",Me.style.background="",Me.style.boxShadow=""):(Me.style.color=x?"var(--me-fg, #ededf0)":"var(--me-fg-muted, #9a9aa3)",Me.style.background="",Me.style.boxShadow="")})}function Y(P){P===0?a5(n,a):P===1?r5(n,a):P===2&&$g(n,a),h()}function ue(){const P=a.getState();Zw(n,P),g();const k=Ls(n,P.clips??[]),H=ll(n,P.audioClips??[]),T=As(n,P);v(),W(),J(P,k,H,T)}function oe(P){if(!(P.target instanceof Element))return;const k=P.target.closest("[data-clipblock]");if(!k||!n.contains(k))return;const H=Number(k.getAttribute("data-clipblock"));if(!Number.isInteger(H))return;const T=(a.getState().clips??[]).map((_,le)=>le);if(P.shiftKey||P.ctrlKey||P.metaKey){P.preventDefault(),P.stopPropagation(),gr(n,"video",H,P,T),h();return}qn(n,"video",[H]),h()}function ge(P){if(!(P.target instanceof Element))return;const k=P.target.closest("[data-audioclip]");if(!k||!n.contains(k))return;const H=Number(k.getAttribute("data-audioclip"));if(!Number.isInteger(H))return;const T=(a.getState().audioClips??[]).map((_,le)=>le);if(P.shiftKey||P.ctrlKey||P.metaKey){P.preventDefault(),P.stopPropagation(),gr(n,"audio",H,P,T),h();return}qn(n,"audio",[H]),h()}function Be(P){P.target instanceof Element&&n.contains(P.target)&&(d(P.target)||ff(n)&&(mf(n),h()))}function Te(P){if(!(P.target instanceof Element))return;const k=P.target.closest("[data-clipblock]");if(k&&n.contains(k)&&(P.shiftKey||P.ctrlKey||P.metaKey)){P.preventDefault(),P.stopPropagation();return}const H=P.target.closest(".me-video-trim-actions .me-video-trim-action-btn");if(!H||!n.contains(H))return;const T=[...n.querySelectorAll(".me-video-trim-actions .me-video-trim-action-btn")].indexOf(H);T!==-1&&(P.preventDefault(),P.stopPropagation(),H.getAttribute("aria-disabled")!=="true"&&Y(T))}function de(P){if(!(P.target instanceof Element))return;if((P.key==="Delete"||P.key==="Backspace")&&!m(P.target)&&ff(n)){P.preventDefault(),P.stopPropagation(),$g(n,a),h();return}if(P.key!=="Enter"&&P.key!==" ")return;const k=P.target.closest(".me-video-trim-actions .me-video-trim-action-btn");if(!k||!n.contains(k))return;const H=[...n.querySelectorAll(".me-video-trim-actions .me-video-trim-action-btn")].indexOf(k);H!==-1&&(P.preventDefault(),P.stopPropagation(),k.getAttribute("aria-disabled")!=="true"&&Y(H))}const Ae=new MutationObserver(()=>{h()});Ae.observe(n,{childList:!0,subtree:!0}),n.addEventListener("pointerdown",oe,!0),n.addEventListener("pointerdown",ge,!0),n.addEventListener("pointerdown",Be,!0),n.addEventListener("click",Te,!0),n.addEventListener("keydown",de,!0),n.addEventListener(fr,h),window.addEventListener("resize",h);const ve=a.subscribe(()=>{h()});return ue(),{destroy(){Ae.disconnect(),ve(),n.removeEventListener("pointerdown",oe,!0),n.removeEventListener("pointerdown",ge,!0),n.removeEventListener("pointerdown",Be,!0),n.removeEventListener("click",Te,!0),n.removeEventListener("keydown",de,!0),n.removeEventListener(fr,h),window.removeEventListener("resize",h)}}}var Lc=[{key:"480p",label:"480P",shortEdge:480},{key:"720p",label:"720P",shortEdge:720},{key:"1080p",label:"1080P",shortEdge:1080},{key:"2k",label:"2K",shortEdge:1440},{key:"4k",label:"4K",shortEdge:2160},{key:"8k",label:"8K",shortEdge:4320},{key:"source",label:"\u539F\u59CB"},{key:"custom",label:"\u81EA\u5B9A\u4E49"}],G5=[{key:"mov",label:"MOV",extension:"mov"},{key:"mp4",label:"MP4",extension:"mp4"},{key:"mxf",label:"MXF",extension:"mxf"}],Y5=[24,25,30,50,60],J5=[{key:"aac",label:"AAC"},{key:"mp3",label:"MP3"}],Q5=[96,128,192,256,320],rb="me-video-export-enhancer-styles";function eE(){if(document.getElementById(rb))return;const n=document.createElement("style");n.id=rb,n.textContent=`
|
|
2058
2058
|
.me-video-export-overlay {
|
|
2059
2059
|
position: absolute;
|
|
2060
2060
|
inset: 0;
|
|
@@ -2339,7 +2339,7 @@ Error generating stack: `+i.message+`
|
|
|
2339
2339
|
justify-content: flex-end;
|
|
2340
2340
|
}
|
|
2341
2341
|
}
|
|
2342
|
-
`,document.head.appendChild(n)}function ab(n){return String(n??"").trim().replace(/\.[a-z0-9]+$/i,"")}function Af(n,a="video"){return String(n??"").replace(/[\\/:*?"<>|]+/g," ").replace(/\s+/g," ").trim()||a}function mo(n,a,o,l){const s=Math.round(Number(n));return Number.isFinite(s)?Math.min(o,Math.max(a,s)):l}function ml(n,a){const o=mo(n,2,8192,a);return o%2===0?o:o-1}function ib(n){return oo(n.canvas,n)}function tE(n){const a=Math.max(0,Math.round(Number(n)||0)),o=Math.floor(a/3600),l=Math.floor(a%3600/60),s=a%60;return o>0?s>0?`${o} \u5C0F\u65F6 ${l} \u5206 ${s} \u79D2`:`${o} \u5C0F\u65F6 ${l} \u5206`:l>0?s>0?`${l} \u5206 ${s} \u79D2`:`${l} \u5206`:`${s} \u79D2`}function nE(n){const a=Math.max(0,Number(n)||0);return a>=1024*1024*1024?`${(a/(1024*1024*1024)).toFixed(2).replace(/\.?0+$/,"")} GB`:a>=1024*1024?`${(a/(1024*1024)).toFixed(a>=10*1024*1024?0:1).replace(/\.?0+$/,"")} MB`:a>=1024?`${Math.round(a/1024)} KB`:`${Math.round(a)} B`}function Ac(n){return`${n.w}\xD7${n.h}`}function fl(n,a="mp4"){const o=String(n??"").toLowerCase();return o==="mov"||o==="mxf"||o==="mp4"?o:a}function rE(n,a="mp4"){const o=String(n??"").match(/\.([a-z0-9]+)$/i);return fl(o?.[1],a)}function aE(n,a,o,l){const s=Nc(n,a.key,o,l);return`${a.label} \xB7 ${Ac(s)}`}function Nc(n,a,o,l){const s=ib(n);if(a==="source")return s;if(a==="custom")return{w:ml(o,s.w),h:ml(l,s.h)};const d=Lc.find(g=>g.key===a);if(!d?.shortEdge)return s;const m=s.w>0&&s.h>0?s.w/s.h:1;if(s.w<=s.h){const g=ml(d.shortEdge,s.w);return{w:g,h:ml(g/m,s.h)}}const h=ml(d.shortEdge,s.h);return{w:ml(h*m,s.w),h}}function Nf(n,a){const o=Math.min(n.w,n.h);let l=2200;return o<=480?l=1400:o<=720?l=3200:o<=1080?l=6800:o<=1440?l=12e3:o<=2160?l=22e3:l=48e3,a>=50&&(l=Math.round(l*1.35)),l}function iE(n){const a=n.exportSettings;if(!a?.width||!a?.height)return"source";const o=Math.min(a.width,a.height);return Lc.find(l=>l.shortEdge&&Math.abs(l.shortEdge-o)<=6)?.key??"custom"}function oE(n,a,o){const l=String(a||o||"video.mp4"),s=fl(n.exportSettings?.format,rE(l,"mp4"));return`${Af(n.exportSettings?.fileName||ab(l),"video")}.${s}`}function ob(n,a,o){return typeof n.onExported!="function"?n:{...n,onExported(l,s){n.onExported(l,oE(a.getState(),s,o()))}}}function lE(n){let a=!1;const o=typeof requestAnimationFrame=="function"?requestAnimationFrame:g=>setTimeout(g,16),l=[".me-video-preview-footer span"].join(",");function s(g){return String(g??"").replace(/(\d+:\d{2})\.\d+/g,"$1")}function d(){for(const g of n.querySelectorAll(l)){if(g instanceof HTMLElement&&g.childElementCount>0)continue;const v=String(g.textContent??"");if(!/^\s*\d+:\d{2}(?:\.\d+)?(?:\s*\/\s*\d+:\d{2}(?:\.\d+)?)?\s*$/.test(v))continue;if(g instanceof HTMLElement){const W=String(g.dataset.meRawTimeText||""),S=s(W);(!W||v!==S)&&(g.dataset.meRawTimeText=v)}const w=s(v);w!==g.textContent&&(g.textContent=w)}}function m(){a||(a=!0,o(()=>{a=!1,d()}))}const h=new MutationObserver(()=>{m()});return h.observe(n,{childList:!0,subtree:!0,characterData:!0}),m(),{destroy(){h.disconnect()}}}function sE(n){let a=!1,o=null;const l=new Set,s=typeof requestAnimationFrame=="function"?requestAnimationFrame:v=>setTimeout(v,16);function d(v){!o||!(v instanceof HTMLElement)||l.has(v)||(o.observe(v),l.add(v))}function m(){const v=n.querySelector(".me-video-workspace");v instanceof HTMLElement&&v.style.setProperty("padding","0","important");const w=n.querySelector(".me-video-preview-shell");if(!(w instanceof HTMLElement))return;const W=w.querySelector(".me-video-preview-scroll");if(!(W instanceof HTMLElement))return;const S=w.querySelector(".me-video-preview-footer"),Q=W.querySelector(".me-video-canvas-stage"),X=S instanceof HTMLElement?Math.ceil(S.getBoundingClientRect().height):0,ue=Math.max(0,w.clientHeight-X);w.style.display="grid",w.style.gridTemplateRows=S instanceof HTMLElement?"minmax(0, 1fr) auto":"minmax(0, 1fr)",w.style.height="100%",w.style.minHeight="0",w.style.gap="0",w.style.overflow="hidden",w.style.boxSizing="border-box",W.style.alignSelf="stretch",W.style.justifySelf="stretch",W.style.flex="1 1 0",W.style.minHeight="0",W.style.maxHeight="none",W.style.height=ue>0?`${ue}px`:"100%",Q instanceof HTMLElement&&(Q.style.minHeight="100%",Q.style.boxSizing="border-box"),d(w),d(W),d(S),d(Q)}function h(){a||(a=!0,s(()=>{a=!1,m()}))}typeof ResizeObserver=="function"&&(o=new ResizeObserver(()=>{h()}));const g=new MutationObserver(()=>{h()});return g.observe(n,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style","class"]}),window.addEventListener("resize",h),h(),{destroy(){g.disconnect(),o?.disconnect?.(),window.removeEventListener("resize",h)}}}function uE(n,a){let o=!1,l=null;const s=typeof requestAnimationFrame=="function"?requestAnimationFrame:k=>setTimeout(k,16);function d(k,H){return Number.isInteger(k?.track)&&k.track>=0?k.track:H}function m(k){const H=[...new Set((k??[]).map(d))].sort((T,_)=>T-_);return H.length?H:[0]}function h(k){const H=m(k);return new Map(H.map((T,_)=>[T,_]))}function g(k,H){const T=m(k);return H<T.length?T[H]:Math.max(...T)+1}function v(k,H,T=!1){const _=Math.max(0,Math.round(Number(H)||0)),le=a.getState().audioClips??[],se=le[k];if(!se||d(se,k)===_)return;const me=le.map((P,$)=>$===k?{...P,track:_}:P);if(T){a.patch({audioClips:me},{transient:!0});return}a.commit({audioClips:me})}function w(){return Fs(n)}function W(k){if(!(k instanceof HTMLElement))return null;const H=[...k.children].filter(_=>_ instanceof HTMLElement),T=H.findIndex(_=>_.querySelector("[data-clipblock]"));return T===-1?null:H[T+1]instanceof HTMLElement?H[T+1]:null}function S(k,H=1/0){if(!(k instanceof HTMLElement))return[];const T=[...k.children].filter(_=>_ instanceof HTMLElement&&/♪/.test(_.textContent??"")&&!!_.querySelector("span"));return Number.isFinite(H)?T.slice(0,Math.max(0,H)):T}function Q(k,H){if(!(k instanceof HTMLElement)||!(H instanceof HTMLElement))return!1;let T=k;for(;T&&T!==H;){if(`${T.style?.cursor||""} ${typeof window<"u"&&window.getComputedStyle?window.getComputedStyle(T).cursor:""}`.includes("ew-resize"))return!0;T=T.parentElement}return!1}function X(k,H,T){if(!(k instanceof HTMLElement)||!Number.isFinite(T))return null;const _=k.getBoundingClientRect(),le=32,se=m(H).length,me=Math.floor(Math.max(0,T-_.top)/le),P=qe(me,0,se);return g(H,P)}function ue(){const k=a.getState().audioClips??[],H=n.querySelector(".me-video-timeline-area"),T=n.querySelector(".me-video-timeline-scroll"),_=n.querySelector(".me-video-trim-panel"),le=w(),se=W(le);if(!(H instanceof HTMLElement)||!(T instanceof HTMLElement)||!(se instanceof HTMLElement))return;const me=h(k),P=Math.max(1,me.size||k.length||1),$=32,M=P>0?P*28+Math.max(0,P-1)*4:28;H.style.setProperty("max-height","none","important"),H.style.setProperty("overflow","visible","important"),T.style.setProperty("overflow-y","visible","important"),_ instanceof HTMLElement&&_.style.setProperty("overflow","visible","important"),se.style.height=`${M}px`,se.style.minHeight=`${M}px`,se.style.overflow="visible";const A="color-mix(in srgb, var(--me-chip, #f1f1f3) 90%, var(--me-border, #d4d4d8) 10%)",ee="color-mix(in srgb, var(--me-fg, #374151) 82%, var(--me-fg-muted, #6b7280) 18%)",Me="transparent";se.style.background=P>1?`repeating-linear-gradient(to bottom, ${A} 0px, ${A} 28px, color-mix(in srgb, var(--me-border, #d4d4d8) 42%, transparent) 28px, color-mix(in srgb, var(--me-border, #d4d4d8) 42%, transparent) ${$}px)`:A,se.style.backgroundSize=`100% ${$}px`;const _e=S(se,k.length),x=new Set(_e),C=k.length===0;se.style.color=C?ee:"",[...se.children].forEach(B=>{if(B instanceof HTMLElement&&!x.has(B)){if(C){B.style.background="transparent",B.style.border="none",B.style.boxShadow="none",B.style.borderColor=Me,B.style.color=ee,B.querySelectorAll("span, label, button, strong, small").forEach(G=>{G instanceof HTMLElement&&(G.style.color=ee,G.style.background="transparent",G.style.border="none",G.style.borderColor=Me,G.style.boxShadow="none")});return}B.style.removeProperty("background"),B.style.removeProperty("border"),B.style.removeProperty("box-shadow"),B.style.removeProperty("border-color"),B.style.removeProperty("color"),B.querySelectorAll("span, label, button, strong, small").forEach(G=>{G instanceof HTMLElement&&(G.style.removeProperty("color"),G.style.removeProperty("background"),G.style.removeProperty("border"),G.style.removeProperty("border-color"),G.style.removeProperty("box-shadow"))})}}),_e.forEach((B,G)=>{const ze=k[G],J=d(ze,G),te=me.get(J)??G;B.style.top=`${te*$+2}px`,B.style.bottom="auto",B.style.height="24px"});const O=H.lastElementChild;if(O instanceof HTMLElement){const B=O.querySelectorAll("label")[1];B instanceof HTMLElement&&(B.style.height=`${M}px`,B.style.minHeight=`${M}px`,C?(B.style.background=A,B.style.border="none",B.style.borderColor=Me,B.style.boxShadow="none",B.style.color=ee,B.querySelectorAll("span, strong, small").forEach(G=>{G instanceof HTMLElement&&(G.style.color=ee,G.style.border="none")})):(B.style.removeProperty("background"),B.style.removeProperty("border"),B.style.removeProperty("border-color"),B.style.removeProperty("box-shadow"),B.style.removeProperty("color"),B.querySelectorAll("span, strong, small").forEach(G=>{G instanceof HTMLElement&&(G.style.removeProperty("color"),G.style.removeProperty("border"))})))}}function oe(){o||(o=!0,s(()=>{o=!1,ue()}))}function ge(k){if(k.button!==0||!(k.target instanceof Element))return;const H=k.target.closest("[data-audioclip]");if(!(H instanceof HTMLElement)||!n.contains(H)||Q(k.target,H))return;const T=Number(H.getAttribute("data-audioclip"));if(!Number.isInteger(T))return;const _=(a.getState().audioClips??[])[T];_&&(l={index:T,pointerId:k.pointerId,startTrack:d(_,T),currentTrack:d(_,T)})}function Be(k){if(!l||k.pointerId!==l.pointerId)return;const H=w(),T=W(H),_=a.getState().audioClips??[],le=X(T,_,k.clientY);!Number.isInteger(le)||le===l.currentTrack||(l.currentTrack=le,v(l.index,le,!0),oe())}function Te(k,H=!1){if(!l||k!==l.pointerId)return;const T=l;if(l=null,H){T.currentTrack!==T.startTrack&&v(T.index,T.startTrack,!1);return}T.currentTrack!==T.startTrack&&(v(T.index,T.currentTrack,!1),oe())}function de(k){Te(k.pointerId,!1)}function Ae(k){Te(k.pointerId,!0)}const ve=new MutationObserver(()=>{oe()});ve.observe(n,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style","class"]}),n.addEventListener(fr,oe),n.addEventListener("pointerdown",ge,!0),window.addEventListener("pointermove",Be),window.addEventListener("pointerup",de),window.addEventListener("pointercancel",Ae),window.addEventListener("resize",oe);const j=a.subscribe(()=>{oe()});return oe(),{destroy(){ve.disconnect(),j(),n.removeEventListener(fr,oe),n.removeEventListener("pointerdown",ge,!0),window.removeEventListener("resize",oe),window.removeEventListener("pointermove",Be),window.removeEventListener("pointerup",de),window.removeEventListener("pointercancel",Ae)}}}function cE(n){let a=!1;const o=typeof requestAnimationFrame=="function"?requestAnimationFrame:h=>setTimeout(h,16);function l(){a||(a=!0,o(()=>{a=!1,d()}))}function s(h){return String(h?.style?.transform||"").includes("translateX(-50%)")}function d(){const h=Ag(n);if(h instanceof HTMLElement)for(const g of[...h.children]){if(!(g instanceof HTMLElement)||s(g))continue;const v=hc(vc(g));Number.isFinite(v)&&Math.abs(v-Math.round(v))>.001?(g.dataset.meIntegerTickHidden="true",g.style.setProperty("display","none","important")):g.dataset.meIntegerTickHidden==="true"&&(g.style.removeProperty("display"),delete g.dataset.meIntegerTickHidden)}}const m=new MutationObserver(()=>{l()});return m.observe(n,{childList:!0,subtree:!0,characterData:!0}),n.addEventListener(fr,l),window.addEventListener("resize",l),l(),{destroy(){m.disconnect(),n.removeEventListener(fr,l),window.removeEventListener("resize",l)}}}var lb=!1;function dE(){if(lb||typeof document>"u")return;const n=document.createElement("style");n.id="me-video-trim-history-enhancer-style",n.textContent=`
|
|
2342
|
+
`,document.head.appendChild(n)}function ab(n){return String(n??"").trim().replace(/\.[a-z0-9]+$/i,"")}function Af(n,a="video"){return String(n??"").replace(/[\\/:*?"<>|]+/g," ").replace(/\s+/g," ").trim()||a}function mo(n,a,o,l){const s=Math.round(Number(n));return Number.isFinite(s)?Math.min(o,Math.max(a,s)):l}function ml(n,a){const o=mo(n,2,8192,a);return o%2===0?o:o-1}function ib(n){return oo(n.canvas,n)}function tE(n){const a=Math.max(0,Math.round(Number(n)||0)),o=Math.floor(a/3600),l=Math.floor(a%3600/60),s=a%60;return o>0?s>0?`${o} \u5C0F\u65F6 ${l} \u5206 ${s} \u79D2`:`${o} \u5C0F\u65F6 ${l} \u5206`:l>0?s>0?`${l} \u5206 ${s} \u79D2`:`${l} \u5206`:`${s} \u79D2`}function nE(n){const a=Math.max(0,Number(n)||0);return a>=1024*1024*1024?`${(a/(1024*1024*1024)).toFixed(2).replace(/\.?0+$/,"")} GB`:a>=1024*1024?`${(a/(1024*1024)).toFixed(a>=10*1024*1024?0:1).replace(/\.?0+$/,"")} MB`:a>=1024?`${Math.round(a/1024)} KB`:`${Math.round(a)} B`}function Ac(n){return`${n.w}\xD7${n.h}`}function fl(n,a="mp4"){const o=String(n??"").toLowerCase();return o==="mov"||o==="mxf"||o==="mp4"?o:a}function rE(n,a="mp4"){const o=String(n??"").match(/\.([a-z0-9]+)$/i);return fl(o?.[1],a)}function aE(n,a,o,l){const s=Nc(n,a.key,o,l);return`${a.label} \xB7 ${Ac(s)}`}function Nc(n,a,o,l){const s=ib(n);if(a==="source")return s;if(a==="custom")return{w:ml(o,s.w),h:ml(l,s.h)};const d=Lc.find(g=>g.key===a);if(!d?.shortEdge)return s;const m=s.w>0&&s.h>0?s.w/s.h:1;if(s.w<=s.h){const g=ml(d.shortEdge,s.w);return{w:g,h:ml(g/m,s.h)}}const h=ml(d.shortEdge,s.h);return{w:ml(h*m,s.w),h}}function Nf(n,a){const o=Math.min(n.w,n.h);let l=2200;return o<=480?l=1400:o<=720?l=3200:o<=1080?l=6800:o<=1440?l=12e3:o<=2160?l=22e3:l=48e3,a>=50&&(l=Math.round(l*1.35)),l}function iE(n){const a=n.exportSettings;if(!a?.width||!a?.height)return"source";const o=Math.min(a.width,a.height);return Lc.find(l=>l.shortEdge&&Math.abs(l.shortEdge-o)<=6)?.key??"custom"}function oE(n,a,o){const l=String(a||o||"video.mp4"),s=fl(n.exportSettings?.format,rE(l,"mp4"));return`${Af(n.exportSettings?.fileName||ab(l),"video")}.${s}`}function ob(n,a,o){return typeof n.onExported!="function"?n:{...n,onExported(l,s){n.onExported(l,oE(a.getState(),s,o()))}}}function lE(n){let a=!1;const o=typeof requestAnimationFrame=="function"?requestAnimationFrame:g=>setTimeout(g,16),l=[".me-video-preview-footer span"].join(",");function s(g){return String(g??"").replace(/(\d+:\d{2})\.\d+/g,"$1")}function d(){for(const g of n.querySelectorAll(l)){if(g instanceof HTMLElement&&g.childElementCount>0)continue;const v=String(g.textContent??"");if(!/^\s*\d+:\d{2}(?:\.\d+)?(?:\s*\/\s*\d+:\d{2}(?:\.\d+)?)?\s*$/.test(v))continue;if(g instanceof HTMLElement){const W=String(g.dataset.meRawTimeText||""),S=s(W);(!W||v!==S)&&(g.dataset.meRawTimeText=v)}const w=s(v);w!==g.textContent&&(g.textContent=w)}}function m(){a||(a=!0,o(()=>{a=!1,d()}))}const h=new MutationObserver(()=>{m()});return h.observe(n,{childList:!0,subtree:!0,characterData:!0}),m(),{destroy(){h.disconnect()}}}function sE(n){let a=!1,o=null;const l=new Set,s=typeof requestAnimationFrame=="function"?requestAnimationFrame:v=>setTimeout(v,16);function d(v){!o||!(v instanceof HTMLElement)||l.has(v)||(o.observe(v),l.add(v))}function m(){const v=n.querySelector(".me-video-workspace");v instanceof HTMLElement&&v.style.setProperty("padding","0","important");const w=n.querySelector(".me-video-preview-shell");if(!(w instanceof HTMLElement))return;const W=w.querySelector(".me-video-preview-scroll");if(!(W instanceof HTMLElement))return;const S=w.querySelector(".me-video-preview-footer"),J=W.querySelector(".me-video-canvas-stage"),Y=S instanceof HTMLElement?Math.ceil(S.getBoundingClientRect().height):0,ue=Math.max(0,w.clientHeight-Y);w.style.display="grid",w.style.gridTemplateRows=S instanceof HTMLElement?"minmax(0, 1fr) auto":"minmax(0, 1fr)",w.style.height="100%",w.style.minHeight="0",w.style.gap="0",w.style.overflow="hidden",w.style.boxSizing="border-box",W.style.alignSelf="stretch",W.style.justifySelf="stretch",W.style.flex="1 1 0",W.style.minHeight="0",W.style.maxHeight="none",W.style.height=ue>0?`${ue}px`:"100%",J instanceof HTMLElement&&(J.style.minHeight="100%",J.style.boxSizing="border-box"),d(w),d(W),d(S),d(J)}function h(){a||(a=!0,s(()=>{a=!1,m()}))}typeof ResizeObserver=="function"&&(o=new ResizeObserver(()=>{h()}));const g=new MutationObserver(()=>{h()});return g.observe(n,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style","class"]}),window.addEventListener("resize",h),h(),{destroy(){g.disconnect(),o?.disconnect?.(),window.removeEventListener("resize",h)}}}function uE(n,a){let o=!1,l=null;const s=typeof requestAnimationFrame=="function"?requestAnimationFrame:k=>setTimeout(k,16);function d(k,H){return Number.isInteger(k?.track)&&k.track>=0?k.track:H}function m(k){const H=[...new Set((k??[]).map(d))].sort((T,_)=>T-_);return H.length?H:[0]}function h(k){const H=m(k);return new Map(H.map((T,_)=>[T,_]))}function g(k,H){const T=m(k);return H<T.length?T[H]:Math.max(...T)+1}function v(k,H,T=!1){const _=Math.max(0,Math.round(Number(H)||0)),le=a.getState().audioClips??[],se=le[k];if(!se||d(se,k)===_)return;const me=le.map((O,$)=>$===k?{...O,track:_}:O);if(T){a.patch({audioClips:me},{transient:!0});return}a.commit({audioClips:me})}function w(){return Fs(n)}function W(k){if(!(k instanceof HTMLElement))return null;const H=[...k.children].filter(_=>_ instanceof HTMLElement),T=H.findIndex(_=>_.querySelector("[data-clipblock]"));return T===-1?null:H[T+1]instanceof HTMLElement?H[T+1]:null}function S(k,H=1/0){if(!(k instanceof HTMLElement))return[];const T=[...k.children].filter(_=>_ instanceof HTMLElement&&/♪/.test(_.textContent??"")&&!!_.querySelector("span"));return Number.isFinite(H)?T.slice(0,Math.max(0,H)):T}function J(k,H){if(!(k instanceof HTMLElement)||!(H instanceof HTMLElement))return!1;let T=k;for(;T&&T!==H;){if(`${T.style?.cursor||""} ${typeof window<"u"&&window.getComputedStyle?window.getComputedStyle(T).cursor:""}`.includes("ew-resize"))return!0;T=T.parentElement}return!1}function Y(k,H,T){if(!(k instanceof HTMLElement)||!Number.isFinite(T))return null;const _=k.getBoundingClientRect(),le=32,se=m(H).length,me=Math.floor(Math.max(0,T-_.top)/le),O=qe(me,0,se);return g(H,O)}function ue(){const k=a.getState().audioClips??[],H=n.querySelector(".me-video-timeline-area"),T=n.querySelector(".me-video-timeline-scroll"),_=n.querySelector(".me-video-trim-panel"),le=w(),se=W(le);if(!(H instanceof HTMLElement)||!(T instanceof HTMLElement)||!(se instanceof HTMLElement))return;const me=h(k),O=Math.max(1,me.size||k.length||1),$=32,M=O>0?O*28+Math.max(0,O-1)*4:28;H.style.setProperty("max-height","none","important"),H.style.setProperty("overflow","visible","important"),T.style.setProperty("overflow-y","visible","important"),_ instanceof HTMLElement&&_.style.setProperty("overflow","visible","important"),se.style.height=`${M}px`,se.style.minHeight=`${M}px`,se.style.overflow="visible";const A="color-mix(in srgb, var(--me-chip, #f1f1f3) 90%, var(--me-border, #d4d4d8) 10%)",ee="color-mix(in srgb, var(--me-fg, #374151) 82%, var(--me-fg-muted, #6b7280) 18%)",Me="transparent";se.style.background=O>1?`repeating-linear-gradient(to bottom, ${A} 0px, ${A} 28px, color-mix(in srgb, var(--me-border, #d4d4d8) 42%, transparent) 28px, color-mix(in srgb, var(--me-border, #d4d4d8) 42%, transparent) ${$}px)`:A,se.style.backgroundSize=`100% ${$}px`;const _e=S(se,k.length),x=new Set(_e),C=k.length===0;se.style.color=C?ee:"",[...se.children].forEach(B=>{if(B instanceof HTMLElement&&!x.has(B)){if(C){B.style.background="transparent",B.style.border="none",B.style.boxShadow="none",B.style.borderColor=Me,B.style.color=ee,B.querySelectorAll("span, label, button, strong, small").forEach(G=>{G instanceof HTMLElement&&(G.style.color=ee,G.style.background="transparent",G.style.border="none",G.style.borderColor=Me,G.style.boxShadow="none")});return}B.style.removeProperty("background"),B.style.removeProperty("border"),B.style.removeProperty("box-shadow"),B.style.removeProperty("border-color"),B.style.removeProperty("color"),B.querySelectorAll("span, label, button, strong, small").forEach(G=>{G instanceof HTMLElement&&(G.style.removeProperty("color"),G.style.removeProperty("background"),G.style.removeProperty("border"),G.style.removeProperty("border-color"),G.style.removeProperty("box-shadow"))})}}),_e.forEach((B,G)=>{const De=k[G],Q=d(De,G),te=me.get(Q)??G;B.style.top=`${te*$+2}px`,B.style.bottom="auto",B.style.height="24px"});const j=H.lastElementChild;if(j instanceof HTMLElement){const B=j.querySelectorAll("label")[1];B instanceof HTMLElement&&(B.style.height=`${M}px`,B.style.minHeight=`${M}px`,C?(B.style.background=A,B.style.border="none",B.style.borderColor=Me,B.style.boxShadow="none",B.style.color=ee,B.querySelectorAll("span, strong, small").forEach(G=>{G instanceof HTMLElement&&(G.style.color=ee,G.style.border="none")})):(B.style.removeProperty("background"),B.style.removeProperty("border"),B.style.removeProperty("border-color"),B.style.removeProperty("box-shadow"),B.style.removeProperty("color"),B.querySelectorAll("span, strong, small").forEach(G=>{G instanceof HTMLElement&&(G.style.removeProperty("color"),G.style.removeProperty("border"))})))}}function oe(){o||(o=!0,s(()=>{o=!1,ue()}))}function ge(k){if(k.button!==0||!(k.target instanceof Element))return;const H=k.target.closest("[data-audioclip]");if(!(H instanceof HTMLElement)||!n.contains(H)||J(k.target,H))return;const T=Number(H.getAttribute("data-audioclip"));if(!Number.isInteger(T))return;const _=(a.getState().audioClips??[])[T];_&&(l={index:T,pointerId:k.pointerId,startTrack:d(_,T),currentTrack:d(_,T)})}function Be(k){if(!l||k.pointerId!==l.pointerId)return;const H=w(),T=W(H),_=a.getState().audioClips??[],le=Y(T,_,k.clientY);!Number.isInteger(le)||le===l.currentTrack||(l.currentTrack=le,v(l.index,le,!0),oe())}function Te(k,H=!1){if(!l||k!==l.pointerId)return;const T=l;if(l=null,H){T.currentTrack!==T.startTrack&&v(T.index,T.startTrack,!1);return}T.currentTrack!==T.startTrack&&(v(T.index,T.currentTrack,!1),oe())}function de(k){Te(k.pointerId,!1)}function Ae(k){Te(k.pointerId,!0)}const ve=new MutationObserver(()=>{oe()});ve.observe(n,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style","class"]}),n.addEventListener(fr,oe),n.addEventListener("pointerdown",ge,!0),window.addEventListener("pointermove",Be),window.addEventListener("pointerup",de),window.addEventListener("pointercancel",Ae),window.addEventListener("resize",oe);const P=a.subscribe(()=>{oe()});return oe(),{destroy(){ve.disconnect(),P(),n.removeEventListener(fr,oe),n.removeEventListener("pointerdown",ge,!0),window.removeEventListener("resize",oe),window.removeEventListener("pointermove",Be),window.removeEventListener("pointerup",de),window.removeEventListener("pointercancel",Ae)}}}function cE(n){let a=!1;const o=typeof requestAnimationFrame=="function"?requestAnimationFrame:h=>setTimeout(h,16);function l(){a||(a=!0,o(()=>{a=!1,d()}))}function s(h){return String(h?.style?.transform||"").includes("translateX(-50%)")}function d(){const h=Ag(n);if(h instanceof HTMLElement)for(const g of[...h.children]){if(!(g instanceof HTMLElement)||s(g))continue;const v=hc(vc(g));Number.isFinite(v)&&Math.abs(v-Math.round(v))>.001?(g.dataset.meIntegerTickHidden="true",g.style.setProperty("display","none","important")):g.dataset.meIntegerTickHidden==="true"&&(g.style.removeProperty("display"),delete g.dataset.meIntegerTickHidden)}}const m=new MutationObserver(()=>{l()});return m.observe(n,{childList:!0,subtree:!0,characterData:!0}),n.addEventListener(fr,l),window.addEventListener("resize",l),l(),{destroy(){m.disconnect(),n.removeEventListener(fr,l),window.removeEventListener("resize",l)}}}var lb=!1;function dE(){if(lb||typeof document>"u")return;const n=document.createElement("style");n.id="me-video-trim-history-enhancer-style",n.textContent=`
|
|
2343
2343
|
.me-video-history[data-trim-proxy-hidden="true"] {
|
|
2344
2344
|
display: none !important;
|
|
2345
2345
|
}
|
|
@@ -2411,7 +2411,7 @@ Error generating stack: `+i.message+`
|
|
|
2411
2411
|
display: none;
|
|
2412
2412
|
}
|
|
2413
2413
|
}
|
|
2414
|
-
`,document.head.appendChild(n),lb=!0}function mE(n){dE();let a=!1,o=null;const l=typeof requestAnimationFrame=="function"?requestAnimationFrame:S=>setTimeout(S,16);function s(){return n.querySelector(".me-video-topbar .me-video-history")}function d(){const S=s();return S instanceof HTMLElement?[...S.querySelectorAll("button")]:[]}function m(S){o instanceof HTMLElement||(o=document.createElement("div"),o.className="me-video-trim-history-proxy");const
|
|
2414
|
+
`,document.head.appendChild(n),lb=!0}function mE(n){dE();let a=!1,o=null;const l=typeof requestAnimationFrame=="function"?requestAnimationFrame:S=>setTimeout(S,16);function s(){return n.querySelector(".me-video-topbar .me-video-history")}function d(){const S=s();return S instanceof HTMLElement?[...S.querySelectorAll("button")]:[]}function m(S){o instanceof HTMLElement||(o=document.createElement("div"),o.className="me-video-trim-history-proxy");const J=S.querySelector(".me-video-trim-action-btn");return o.parentElement!==S?S.insertBefore(o,J??S.firstChild):J&&o.nextElementSibling!==J&&S.insertBefore(o,J),o}function h(S,J){const Y=String(S??"").trim();if(!Y)return"";if(J===0){if(/\s/.test(Y))return Y.split(/\s+/)[0];if(Y.length>2)return Y.slice(0,2)}return Y}function g(S,J,Y){S.dataset.historyIndex=String(Y);const ue=S.querySelector(".me-video-trim-history-proxy-icon"),oe=S.querySelector(".me-video-trim-history-proxy-label");ue instanceof HTMLElement&&ue.innerHTML!==J.innerHTML&&(ue.innerHTML=J.innerHTML),S.disabled=J.disabled,S.title=J.title||"";const ge=J.getAttribute("aria-label"),Be=(ge||J.title||"").trim();oe instanceof HTMLElement&&(oe.textContent=h(Be,Y)),ge?S.setAttribute("aria-label",ge):S.removeAttribute("aria-label")}function v(){const S=s(),J=n.querySelector(".me-video-trim-actions");if(!(S instanceof HTMLElement)||!(J instanceof HTMLElement)){S?.removeAttribute("data-trim-proxy-hidden"),o?.remove();return}const Y=d();if(!Y.length){S.removeAttribute("data-trim-proxy-hidden"),o?.remove();return}S.setAttribute("data-trim-proxy-hidden","true");const ue=m(J),oe=[];for(Y.forEach((ge,Be)=>{let Te=ue.children[Be];if(!(Te instanceof HTMLButtonElement)){Te=document.createElement("button"),Te.type="button",Te.className="me-video-trim-history-proxy-btn";const de=document.createElement("span");de.className="me-video-trim-history-proxy-icon";const Ae=document.createElement("span");Ae.className="me-video-trim-history-proxy-label",Te.append(de,Ae),Te.addEventListener("click",()=>{const ve=d()[Be];!ve||ve.disabled||(ve.click(),w())}),ue.appendChild(Te)}g(Te,ge,Be),oe.push(Te)});ue.children.length>oe.length;)ue.lastElementChild?.remove()}function w(){a||(a=!0,l(()=>{a=!1,v()}))}const W=new MutationObserver(()=>{w()});return W.observe(n,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["disabled","style","class","hidden","title","aria-label"]}),window.addEventListener("resize",w),w(),{destroy(){W.disconnect(),window.removeEventListener("resize",w),s()?.removeAttribute("data-trim-proxy-hidden"),o?.remove()}}}function fE(n,a,o,l=()=>null){eE();const s=document.createElement("div");s.className="me-video-export-overlay",s.hidden=!0,s.innerHTML=`
|
|
2415
2415
|
<div class="me-video-export-card" role="dialog" aria-modal="true" aria-label="\u5BFC\u51FA\u8BBE\u7F6E">
|
|
2416
2416
|
<div class="me-video-export-head">
|
|
2417
2417
|
<strong class="me-video-export-title">\u5BFC\u51FA\u8BBE\u7F6E</strong>
|
|
@@ -2492,4 +2492,4 @@ Error generating stack: `+i.message+`
|
|
|
2492
2492
|
</div>
|
|
2493
2493
|
</div>
|
|
2494
2494
|
</div>
|
|
2495
|
-
`,n.appendChild(s);const d=s.querySelector(".me-video-export-close"),m=s.querySelector('[data-action="cancel"]'),h=s.querySelector('[data-action="confirm"]'),g=s.querySelector("img"),v=s.querySelector(".me-video-export-preview-empty"),w=s.querySelector(".me-video-export-preview-note"),W=s.querySelector(".me-video-export-summary-value"),S=s.querySelector("[data-custom-resolution]"),
|
|
2495
|
+
`,n.appendChild(s);const d=s.querySelector(".me-video-export-close"),m=s.querySelector('[data-action="cancel"]'),h=s.querySelector('[data-action="confirm"]'),g=s.querySelector("img"),v=s.querySelector(".me-video-export-preview-empty"),w=s.querySelector(".me-video-export-preview-note"),W=s.querySelector(".me-video-export-summary-value"),S=s.querySelector("[data-custom-resolution]"),J=s.querySelector('[data-field="title"]'),Y=s.querySelector('[data-field="resolutionPreset"]'),ue=s.querySelector('[data-field="customWidth"]'),oe=s.querySelector('[data-field="customHeight"]'),ge=s.querySelector('[data-field="customResolutionHint"]'),Be=s.querySelector('[data-field="format"]'),Te=s.querySelector('[data-field="frameRate"]'),de=s.querySelector('[data-field="bitrateMode"]'),Ae=s.querySelector('[data-field="videoBitrateKbps"]'),ve=s.querySelector('[data-field="videoBitrateHint"]'),P=s.querySelector('[data-field="audioCodec"]'),k=s.querySelector('[data-field="audioBitrateKbps"]'),H=new Map;for(const j of Lc){const B=document.createElement("option");B.value=j.key,B.textContent=j.label,Y.appendChild(B),H.set(j.key,B)}for(const j of G5){const B=document.createElement("option");B.value=j.key,B.textContent=j.label,Be.appendChild(B)}for(const j of Y5){const B=document.createElement("option");B.value=String(j),B.textContent=`${j} FPS`,Te.appendChild(B)}for(const j of J5){const B=document.createElement("option");B.value=j.key,B.textContent=j.label,P.appendChild(B)}for(const j of Q5){const B=document.createElement("option");B.value=String(j),B.textContent=`${j} kbps`,k.appendChild(B)}let T=null,_=!1;function le(){s.dataset.theme=ks(typeof l=="function"?l():null)}function se(){const j=n.querySelector(".me-video-canvas-stage canvas, .me-video-preview-scroll canvas");if(!(j instanceof HTMLCanvasElement))return"";try{return j.toDataURL("image/png")}catch{return""}}function me(){const j=se();if(j){g.src=j,g.hidden=!1,v.hidden=!0;return}g.hidden=!0,v.hidden=!1}function O(){const j=a.getState(),B=ib(j),G=iE(j),De=Nc(j,G,j.exportSettings?.width??B.w,j.exportSettings?.height??B.h),Q=mo(j.exportSettings?.frameRate,12,120,30),te=Nf(De,Q);return{title:Af(j.exportSettings?.fileName||ab(o()),"video"),resolutionPreset:G,customWidth:j.exportSettings?.width??B.w,customHeight:j.exportSettings?.height??B.h,format:fl(j.exportSettings?.format,"mp4"),frameRate:Q,bitrateMode:j.exportSettings?.videoBitrateKbps!=null?"custom":"auto",videoBitrateKbps:j.exportSettings?.videoBitrateKbps??te,audioCodec:j.exportSettings?.audioCodec??"aac",audioBitrateKbps:j.exportSettings?.audioBitrateKbps??192}}function $(){const j=a.getState(),B=mo(T.frameRate,12,120,30),G=Nc(j,T.resolutionPreset,T.customWidth,T.customHeight),De=Nf(G,B);return{fileName:Af(T.title,"video"),width:T.resolutionPreset==="source"?void 0:G.w,height:T.resolutionPreset==="source"?void 0:G.h,format:fl(T.format,"mp4"),frameRate:B,videoBitrateKbps:T.bitrateMode==="custom"?mo(T.videoBitrateKbps,100,5e4,De):void 0,audioBitrateKbps:mo(T.audioBitrateKbps,32,320,192),audioCodec:T.audioCodec==="mp3"?"mp3":"aac"}}function M(){if(!T)return;le();const j=a.getState(),B=Nc(j,T.resolutionPreset,T.customWidth,T.customHeight),G=Nf(B,T.frameRate),De=T.bitrateMode==="custom"?mo(T.videoBitrateKbps,100,5e4,G):G,Q=mo(T.audioBitrateKbps,32,320,192),te=Math.max(0,Number(a.contentDuration())||0),U=te>0?(De+Q)*1e3*te/8:0;for(const xe of Lc){const Ce=H.get(xe.key);Ce&&(Ce.textContent=aE(j,xe,T.customWidth,T.customHeight))}J.value=T.title,Y.value=T.resolutionPreset,ue.value=String(T.customWidth),oe.value=String(T.customHeight),Be.value=fl(T.format,"mp4"),Te.value=String(T.frameRate),de.value=T.bitrateMode,Ae.value=String(De),Ae.disabled=T.bitrateMode!=="custom",P.value=T.audioCodec,k.value=String(Q),S.dataset.active=T.resolutionPreset==="custom"?"true":"false",ge.textContent=T.resolutionPreset==="custom"?`\u5F53\u524D\u6309\u81EA\u5B9A\u4E49\u5927\u5C0F\u5BFC\u51FA\uFF1A${Ac(B)}`:`\u4FEE\u6539\u5BBD\u9AD8\u4F1A\u81EA\u52A8\u5207\u6362\u4E3A\u81EA\u5B9A\u4E49\u5927\u5C0F\uFF0C\u5F53\u524D\u9884\u8BBE\u8F93\u51FA\uFF1A${Ac(B)}`,ve.textContent=T.bitrateMode==="custom"?`\u5EFA\u8BAE\u503C ${G} kbps`:`\u81EA\u52A8\u7801\u7387\u5C06\u6309 ${G} kbps \u4F30\u7B97`,w.textContent=`\u8F93\u51FA\u5C3A\u5BF8 ${Ac(B)} \xB7 ${T.frameRate} FPS \xB7 ${fl(T.format,"mp4").toUpperCase()} \xB7 \u97F3\u9891 ${Q} kbps`,W.textContent=`\u65F6\u957F: ${tE(te)} | \u5927\u5C0F: ${nE(U)}\uFF08\u4F30\u8BA1\uFF09`,me()}function A(){le(),T=O(),s.hidden=!1,M()}function ee(){s.hidden=!0,T=null}function Me(){!T||!(n.querySelector(".me-video-done")instanceof HTMLButtonElement)||(a.commit({exportSettings:$()}),_=!0,ee(),requestAnimationFrame(()=>{const j=n.querySelector(".me-video-done");j instanceof HTMLButtonElement&&j.click()}))}function _e(j){if(!(j.target instanceof Element))return;const B=j.target.closest(".me-video-done");if(!(!B||!n.contains(B))&&!(!(B instanceof HTMLButtonElement)||B.disabled)){if(_){_=!1;return}j.preventDefault(),j.stopPropagation(),A()}}function x(j){j.key==="Escape"&&!s.hidden&&(j.preventDefault(),ee())}function C(j,B){T&&(T={...T,[j]:B},M())}return d.addEventListener("click",ee),m.addEventListener("click",ee),h.addEventListener("click",Me),s.addEventListener("click",j=>{j.target===s&&ee()}),J.addEventListener("input",()=>C("title",J.value)),Y.addEventListener("change",()=>C("resolutionPreset",Y.value)),Be.addEventListener("change",()=>C("format",Be.value)),ue.addEventListener("input",()=>{T&&(T={...T,resolutionPreset:"custom",customWidth:ue.value},M())}),oe.addEventListener("input",()=>{T&&(T={...T,resolutionPreset:"custom",customHeight:oe.value},M())}),Te.addEventListener("change",()=>C("frameRate",Te.value)),de.addEventListener("change",()=>C("bitrateMode",de.value)),Ae.addEventListener("input",()=>C("videoBitrateKbps",Ae.value)),P.addEventListener("change",()=>C("audioCodec",P.value)),k.addEventListener("change",()=>C("audioBitrateKbps",k.value)),n.addEventListener("click",_e,!0),window.addEventListener("keydown",x),{destroy(){n.removeEventListener("click",_e,!0),window.removeEventListener("keydown",x),s.remove()}}}function sb(n,a={}){const o=a.height??"100vh",l=()=>{document.fullscreenElement!==n&&n.style.setProperty("--me-editor-shell-height",o)};return l(),requestAnimationFrame(l),window.addEventListener("resize",l),document.addEventListener("fullscreenchange",l),()=>{window.removeEventListener("resize",l),document.removeEventListener("fullscreenchange",l)}}function pE(n,a={}){const{append:o=!0,backButton:l="\u8FD4\u56DE",className:s="editor-shell",fitToViewport:d=!0,height:m="auto",hostClassName:h="editor-host",actionsClassName:g="editor-actions",onBack:v}=a,w=document.createElement("div");w.className=s,m!=="auto"&&(w.style.height=m);const W=document.createElement("div");W.className=g;let S=null;l!==!1&&(l instanceof HTMLElement?S=l:(S=document.createElement("button"),S.type="button",S.className="btn btn-ghost",S.textContent=typeof l=="string"?l:"\u8FD4\u56DE"),S&&typeof v=="function"&&S.addEventListener("click",v),S&&W.appendChild(S));const J=document.createElement("div");J.className=h,w.append(W,J),o!==!1&&n.appendChild(w);const Y=d?sb(w):()=>{};return{shell:w,actions:W,host:J,backButton:S,destroy(){Y(),S&&typeof v=="function"&&S.removeEventListener("click",v),w.remove()}}}function hE(n,a={}){n.style.position||(n.style.position="relative");const o=document.createElement("div");o.style.cssText="position:relative;width:100%;height:100%;min-height:0;overflow:hidden",n.appendChild(o);const l=document.createElement("div");l.style.cssText="width:100%;height:100%;min-height:0",o.appendChild(l);const s=a.engine??new jm,d=()=>{const T=m.source;return T&&typeof T=="object"&&"name"in T&&typeof T.name=="string"?T.name:"video.mp4"};let m={...a,engine:s},h=Cw(l,ob(m,s,d));const g=O5(o,s,()=>m.theme,()=>m.locale),v=H5(o,s,()=>m.theme,()=>m.locale),w=R5(o,s,()=>m.locale),W=I5(o,s,()=>m.theme,()=>m.locale),S=$5(o,s,()=>m.locale),J=W5(o,s,()=>m.theme,()=>m.locale),Y=V5(o,s,()=>m.locale),ue=q5(o,s,()=>m.locale),oe=Z5(o,s,()=>m.locale),ge=U5(o,s,()=>m.locale),Be=X5(o,s,()=>m.locale),Te=K5(o,s,()=>m.locale),de=mE(o),Ae=sE(o),ve=lE(o),P=uE(o,s),k=cE(o),H=fE(o,s,d,()=>m.theme);return{update(T={}){m={...m,...T,engine:s},h.update(ob(m,s,d))},destroy(){H.destroy(),P.destroy(),ve.destroy(),Ae.destroy(),de.destroy(),k.destroy(),Te.destroy(),Be.destroy(),ge.destroy(),oe.destroy(),ue.destroy(),Y.destroy(),J.destroy(),S.destroy(),W.destroy(),w.destroy(),v.destroy(),g.destroy(),h.destroy(),o.remove()}}}export{jm as VideoEditorEngine,pE as createVideoEditorShell,sb as fitVideoEditorShellToViewport,hE as mountVideoEditor};
|