@inpageedit/core 0.5.0 → 0.5.1
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/LICENSE +20 -20
- package/README.md +55 -55
- package/dist/ActionButton-BgbTKTg7.js.map +1 -1
- package/dist/InputBox-FIzJ-rPN.js.map +1 -1
- package/dist/Preferences-Bg3J5Ur9.js.map +1 -1
- package/dist/RadioBox-CaA8VgLu.js.map +1 -1
- package/dist/components/index.js.map +1 -1
- package/dist/{index-z5MR2HJ2.js → index-BIgWRk98.js} +302 -296
- package/dist/index-BIgWRk98.js.map +1 -0
- package/dist/{index-jKU6cYcH.js → index-BMmKF_kG.js} +5 -5
- package/dist/index-BMmKF_kG.js.map +1 -0
- package/dist/index-Bh70Udzi.js.map +1 -1
- package/dist/index-CBphMyYJ.js +5170 -0
- package/dist/index-CBphMyYJ.js.map +1 -0
- package/dist/{index-mMAGhnbR.js → index-CJLKdEqr.js} +2 -2
- package/dist/index-CJLKdEqr.js.map +1 -0
- package/dist/{index-CUXLgVhg.js → index-CX5H4xCe.js} +2 -2
- package/dist/index-CX5H4xCe.js.map +1 -0
- package/dist/index-CvhkVj_L.js.map +1 -1
- package/dist/{index-D3yG7jFv.js → index-DNm9SNqM.js} +13 -13
- package/dist/{index-D3yG7jFv.js.map → index-DNm9SNqM.js.map} +1 -1
- package/dist/{index-BxR7MsNM.js → index-Djd6Ddcm.js} +26 -25
- package/dist/index-Djd6Ddcm.js.map +1 -0
- package/dist/{index-Bo1hNwWJ.js → index-Dk3xR25y.js} +6 -6
- package/dist/index-Dk3xR25y.js.map +1 -0
- package/dist/{index-K73DMVec.js → index-QF8lvEam.js} +5 -5
- package/dist/index-QF8lvEam.js.map +1 -0
- package/dist/index.js +9 -5139
- package/dist/index.js.map +1 -1
- package/dist/models/WikiPage/index.d.ts +5 -4
- package/dist/plugins/BasePlugin.d.ts +12 -4
- package/dist/sleep-DpyIipK-.js.map +1 -1
- package/dist/style.css +1 -1
- package/lib/index.umd.js +32 -32
- package/lib/index.umd.js.map +1 -1
- package/lib/style.css +1 -1
- package/package.json +20 -19
- package/dist/index-Bo1hNwWJ.js.map +0 -1
- package/dist/index-BxR7MsNM.js.map +0 -1
- package/dist/index-CUXLgVhg.js.map +0 -1
- package/dist/index-K73DMVec.js.map +0 -1
- package/dist/index-jKU6cYcH.js.map +0 -1
- package/dist/index-mMAGhnbR.js.map +0 -1
- package/dist/index-z5MR2HJ2.js.map +0 -1
package/lib/index.umd.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
(function(le,ye){typeof exports=="object"&&typeof module<"u"?ye(exports):typeof define=="function"&&define.amd?define(["exports"],ye):(le=typeof globalThis<"u"?globalThis:le||self,ye(le.InPageEditBundle={}))})(this,function(le){"use strict";var Rv=Object.defineProperty;var of=le=>{throw TypeError(le)};var Nv=(le,ye,Ie)=>ye in le?Rv(le,ye,{enumerable:!0,configurable:!0,writable:!0,value:Ie}):le[ye]=Ie;var te=(le,ye,Ie)=>Nv(le,typeof ye!="symbol"?ye+"":ye,Ie),Yo=(le,ye,Ie)=>ye.has(le)||of("Cannot "+Ie);var af=(le,ye,Ie)=>(Yo(le,ye,"read from private field"),Ie?Ie.call(le):ye.get(le)),Go=(le,ye,Ie)=>ye.has(le)?of("Cannot add the same private member more than once"):ye instanceof WeakSet?ye.add(le):ye.set(le,Ie),lf=(le,ye,Ie,ne)=>(Yo(le,ye,"write to private field"),ne?ne.call(le,Ie):ye.set(le,Ie),Ie),Ir=(le,ye,Ie)=>(Yo(le,ye,"access private method"),Ie);var dt,Nn,hn,Dn,Ln,jn,Mn,Pe,it,Pt,cf,uf,ff,df,kr;const ye=()=>{let t,e;return{promise:new Promise((r,i)=>{t=r,e=i}),resolve:t,reject:e}};Promise.withResolvers||(Promise.withResolvers=ye);var Ie=Object.defineProperty,ne=(t,e)=>Ie(t,"name",{value:e,configurable:!0});function hf(){}ne(hf,"noop");function $e(t){return t==null}ne($e,"isNullable");function pf(t){return!$e(t)}ne(pf,"isNonNullable");function Tr(t){return t&&typeof t=="object"&&!Array.isArray(t)}ne(Tr,"isPlainObject");function Jo(t,e){return Object.fromEntries(Object.entries(t).filter(([n,r])=>e(n,r)))}ne(Jo,"filterKeys");function At(t,e){return Object.fromEntries(Object.entries(t).map(([n,r])=>[n,e(r,n)]))}ne(At,"mapValues");function Qo(t,e,n){if(!e)return{...t};const r={};for(const i of e)(n||t[i]!==void 0)&&(r[i]=t[i]);return r}ne(Qo,"pick");function mf(t,e){if(!e)return{...t};const n={...t};for(const r of e)Reflect.deleteProperty(n,r);return n}ne(mf,"omit");function Ue(t,e,n){return Object.defineProperty(t,e,{writable:!0,value:n,enumerable:!1})}ne(Ue,"defineProperty");function gf(t,e){return e.every(n=>t.includes(n))}ne(gf,"contain");function yf(t,e){return t.filter(n=>e.includes(n))}ne(yf,"intersection");function vf(t,e){return t.filter(n=>!e.includes(n))}ne(vf,"difference");function bf(t,e){return Array.from(new Set([...t,...e]))}ne(bf,"union");function _f(t){return[...new Set(t)]}ne(_f,"deduplicate");function Ht(t,e){const n=t?.indexOf(e);return n>=0?(t.splice(n,1),!0):!1}ne(Ht,"remove");function wf(t){return Array.isArray(t)?t:$e(t)?[]:[t]}ne(wf,"makeArray");function qt(t,e){return arguments.length===1?n=>qt(t,n):t in globalThis&&e instanceof globalThis[t]||Object.prototype.toString.call(e).slice(8,-1)===t}ne(qt,"is");function zn(t){return qt("ArrayBuffer",t)||qt("SharedArrayBuffer",t)}ne(zn,"isArrayBufferLike");function Xo(t){return zn(t)||ArrayBuffer.isView(t)}ne(Xo,"isArrayBufferSource");var vt;(t=>{t.is=zn,t.isSource=Xo;function e(o){return ArrayBuffer.isView(o)?o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength):o}t.fromSource=e,ne(e,"fromSource");function n(o){if(typeof Buffer<"u")return Buffer.from(o).toString("base64");let a="";const l=new Uint8Array(o);for(let u=0;u<l.byteLength;u++)a+=String.fromCharCode(l[u]);return btoa(a)}t.toBase64=n,ne(n,"toBase64");function r(o){return typeof Buffer<"u"?e(Buffer.from(o,"base64")):Uint8Array.from(atob(o),a=>a.charCodeAt(0))}t.fromBase64=r,ne(r,"fromBase64");function i(o){return typeof Buffer<"u"?Buffer.from(o).toString("hex"):Array.from(new Uint8Array(o),a=>a.toString(16).padStart(2,"0")).join("")}t.toHex=i,ne(i,"toHex");function s(o){if(typeof Buffer<"u")return e(Buffer.from(o,"hex"));const a=o.length%2===0?o:o.slice(0,o.length-1),l=[];for(let u=0;u<a.length;u+=2)l.push(parseInt(`${a[u]}${a[u+1]}`,16));return Uint8Array.from(l).buffer}t.fromHex=s,ne(s,"fromHex")})(vt||(vt={})),vt.fromBase64,vt.toBase64,vt.fromHex,vt.toHex;function Rr(t,e=new Map){if(!t||typeof t!="object")return t;if(qt("Date",t))return new Date(t.valueOf());if(qt("RegExp",t))return new RegExp(t.source,t.flags);if(zn(t))return t.slice(0);if(ArrayBuffer.isView(t))return t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength);const n=e.get(t);if(n)return n;if(Array.isArray(t)){const i=[];return e.set(t,i),t.forEach((s,o)=>{i[o]=Reflect.apply(Rr,null,[s,e])}),i}const r=Object.create(Object.getPrototypeOf(t));e.set(t,r);for(const i of Reflect.ownKeys(t)){const s={...Reflect.getOwnPropertyDescriptor(t,i)};"value"in s&&(s.value=Reflect.apply(Rr,null,[s.value,e])),Reflect.defineProperty(r,i,s)}return r}ne(Rr,"clone");function tn(t,e,n){if(t===e||!n&&$e(t)&&$e(e))return!0;if(typeof t!=typeof e||typeof t!="object"||!t||!e)return!1;function r(i,s){return i(t)?i(e)?s(t,e):!1:i(e)?!1:void 0}return ne(r,"check"),r(Array.isArray,(i,s)=>i.length===s.length&&i.every((o,a)=>tn(o,s[a])))??r(qt("Date"),(i,s)=>i.valueOf()===s.valueOf())??r(qt("RegExp"),(i,s)=>i.source===s.source&&i.flags===s.flags)??r(zn,(i,s)=>{if(i.byteLength!==s.byteLength)return!1;const o=new Uint8Array(i),a=new Uint8Array(s);for(let l=0;l<o.length;l++)if(o[l]!==a[l])return!1;return!0})??Object.keys({...t,...e}).every(i=>tn(t[i],e[i],n))}ne(tn,"deepEqual");function xf(t){return t.charAt(0).toUpperCase()+t.slice(1)}ne(xf,"capitalize");function Sf(t){return t.charAt(0).toLowerCase()+t.slice(1)}ne(Sf,"uncapitalize");function Ef(t){return t.replace(/[_-][a-z]/g,e=>e.slice(1).toUpperCase())}ne(Ef,"camelCase");function Ji(t,e,n){const r=[];let i=0;for(let s=0;s<t.length;s++){const o=t.charCodeAt(s);if(o>=65&&o<=90){if(i===1){const a=t.charCodeAt(s+1);a>=97&&a<=122&&r.push(n),r.push(o+32)}else i!==0&&r.push(n),r.push(o+32);i=1}else o>=97&&o<=122?(r.push(o),i=2):e.includes(o)?(i!==0&&r.push(n),i=0):r.push(o)}return String.fromCharCode(...r)}ne(Ji,"tokenize");function $f(t){return Ji(t,[45,95],45)}ne($f,"paramCase");function kf(t){return Ji(t,[45,95],95)}ne(kf,"snakeCase");function Cf(t){return typeof t!="string"?`[${t.toString()}]`:/^[a-z_$][\w$]*$/i.test(t)?`.${t}`:`[${JSON.stringify(t)}]`}ne(Cf,"formatProperty");function Zo(t){return t.replace(/\/$/,"")}ne(Zo,"trimSlash");function Of(t){return t.startsWith("/")||(t="/"+t),Zo(t)}ne(Of,"sanitize");var ea;(t=>{t.millisecond=1,t.second=1e3,t.minute=t.second*60,t.hour=t.minute*60,t.day=t.hour*24,t.week=t.day*7;let e=new Date().getTimezoneOffset();function n(y){e=y}t.setTimezoneOffset=n,ne(n,"setTimezoneOffset");function r(){return e}t.getTimezoneOffset=r,ne(r,"getTimezoneOffset");function i(y=new Date,v){return typeof y=="number"&&(y=new Date(y)),v===void 0&&(v=e),Math.floor((y.valueOf()/t.minute-v)/1440)}t.getDateNumber=i,ne(i,"getDateNumber");function s(y,v){const A=new Date(y*t.day);return v===void 0&&(v=e),new Date(+A+v*t.minute)}t.fromDateNumber=s,ne(s,"fromDateNumber");const o=/\d+(?:\.\d+)?/.source,a=new RegExp(`^${["w(?:eek(?:s)?)?","d(?:ay(?:s)?)?","h(?:our(?:s)?)?","m(?:in(?:ute)?(?:s)?)?","s(?:ec(?:ond)?(?:s)?)?"].map(y=>`(${o}${y})?`).join("")}$`);function l(y){const v=a.exec(y);return v?(parseFloat(v[1])*t.week||0)+(parseFloat(v[2])*t.day||0)+(parseFloat(v[3])*t.hour||0)+(parseFloat(v[4])*t.minute||0)+(parseFloat(v[5])*t.second||0):0}t.parseTime=l,ne(l,"parseTime");function u(y){const v=l(y);return v?y=Date.now()+v:/^\d{1,2}(:\d{1,2}){1,2}$/.test(y)?y=`${new Date().toLocaleDateString()}-${y}`:/^\d{1,2}-\d{1,2}-\d{1,2}(:\d{1,2}){1,2}$/.test(y)&&(y=`${new Date().getFullYear()}-${y}`),y?new Date(y):new Date}t.parseDate=u,ne(u,"parseDate");function c(y){const v=Math.abs(y);return v>=t.day-t.hour/2?Math.round(y/t.day)+"d":v>=t.hour-t.minute/2?Math.round(y/t.hour)+"h":v>=t.minute-t.second/2?Math.round(y/t.minute)+"m":v>=t.second?Math.round(y/t.second)+"s":y+"ms"}t.format=c,ne(c,"format");function f(y,v=2){return y.toString().padStart(v,"0")}t.toDigits=f,ne(f,"toDigits");function b(y,v=new Date){return y.replace("yyyy",v.getFullYear().toString()).replace("yy",v.getFullYear().toString().slice(2)).replace("MM",f(v.getMonth()+1)).replace("dd",f(v.getDate())).replace("hh",f(v.getHours())).replace("mm",f(v.getMinutes())).replace("ss",f(v.getSeconds())).replace("SSS",f(v.getMilliseconds(),3))}t.template=b,ne(b,"template")})(ea||(ea={}));var Pf=Object.defineProperty,ie=(t,e)=>Pf(t,"name",{value:e,configurable:!0}),Y={shadow:Symbol.for("cordis.shadow"),receiver:Symbol.for("cordis.receiver"),original:Symbol.for("cordis.original"),store:Symbol.for("cordis.store"),events:Symbol.for("cordis.events"),static:Symbol.for("cordis.static"),filter:Symbol.for("cordis.filter"),expose:Symbol.for("cordis.expose"),isolate:Symbol.for("cordis.isolate"),internal:Symbol.for("cordis.internal"),intercept:Symbol.for("cordis.intercept"),setup:Symbol.for("cordis.setup"),invoke:Symbol.for("cordis.invoke"),extend:Symbol.for("cordis.extend"),tracker:Symbol.for("cordis.tracker"),provide:Symbol.for("cordis.provide"),immediate:Symbol.for("cordis.immediate")},Af=function*(){}.constructor,ta=async function*(){}.constructor;function Qi(t){return!(!t.prototype||t instanceof Af||ta!==Function&&t instanceof ta)}ie(Qi,"isConstructor");function Vn(t,e){const n=t.Config||t.schema;return n&&t.schema!==!1&&(e=n(e)),e??{}}ie(Vn,"resolveConfig");function na(t){return[Map,Set,Date,Promise].some(e=>t instanceof e)}ie(na,"isUnproxyable");function Xi(t,e){if(t===Object.prototype)return e;const n=Object.create(Xi(Object.getPrototypeOf(t),e));for(const r of Reflect.ownKeys(t))Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r));return n}ie(Xi,"joinPrototype");function Zi(t){return t&&(typeof t=="object"||typeof t=="function")}ie(Zi,"isObject");function bt(t,e,n){if(!Zi(e))return e;if(Object.hasOwn(e,Y.shadow))return Object.getPrototypeOf(e);const r=e[Y.tracker];return r?Dr(t,e,r,n):e}ie(bt,"getTraceable");function Kn(t,e){return e?new Proxy(t,{get:ie((n,r,i)=>r in e&&r!=="constructor"?Reflect.get(e,r,i):Reflect.get(n,r,i),"get"),set:ie((n,r,i,s)=>r in e&&r!=="constructor"?Reflect.set(e,r,i,s):Reflect.set(n,r,i,s),"set")}):t}ie(Kn,"withProps");function Nr(t,e,n){return Kn(t,Object.defineProperty(Object.create(null),e,{value:n,writable:!1}))}ie(Nr,"withProp");function es(t,e,n,r){if(!n)return r;const i=Reflect.getOwnPropertyDescriptor(e,n)?.value;return i?Nr(r,n,t.extend({[Y.shadow]:i})):r}ie(es,"createShadow");function ra(t,e,n,r){return new Proxy(e,{apply:ie((i,s,o)=>(s===n&&(s=r),o=o.map(a=>typeof a!="function"||a[Y.original]?a:new Proxy(a,{get:ie((l,u,c)=>{if(u===Y.original)return l;const f=Reflect.get(l,u,c);return u==="toString"&&f===Function.prototype.toString?function(...b){return Reflect.apply(f,this===c?l:this,b)}:f},"get"),apply:ie((l,u,c)=>Reflect.apply(l,bt(t,u),c.map(f=>bt(t,f))),"apply"),construct:ie((l,u,c)=>Reflect.construct(l,u.map(f=>bt(t,f)),c),"construct")})),bt(t,Reflect.apply(i,s,o))),"apply")})}ie(ra,"createShadowMethod");function Dr(t,e,n,r){t[Y.shadow]&&(t=Object.getPrototypeOf(t));const i=new Proxy(e,{get:ie((s,o,a)=>{if(o===Y.original)return s;if(o===n.property)return t;if(typeof o=="symbol")return Reflect.get(s,o,a);if(n.associate&&t[Y.internal][`${n.associate}.${o}`])return Reflect.get(t,`${n.associate}.${o}`,Nr(t,Y.receiver,a));const l=es(t,s,n.property,a),u=Reflect.get(s,o,l),c=u?.[Y.tracker];return c?Dr(t,u,c):!r&&typeof u=="function"?ra(t,u,a,l):u},"get"),set:ie((s,o,a,l)=>{if(o===Y.original||o===n.property)return!1;if(typeof o=="symbol")return Reflect.set(s,o,a,l);if(n.associate&&t[Y.internal][`${n.associate}.${o}`])return Reflect.set(t,`${n.associate}.${o}`,a,Nr(t,Y.receiver,l));const u=es(t,s,n.property,l);return Reflect.set(s,o,a,u)},"set"),apply:ie((s,o,a)=>ts(i,s,o,a),"apply")});return i}ie(Dr,"createTraceable");function ts(t,e,n,r){return e[Y.invoke]?e[Y.invoke].apply(t,r):Reflect.apply(e,n,r)}ie(ts,"applyTraceable");function ns(t,e,n){const r=ie(function(...i){const s=Dr(r.ctx,r,n);return ts(s,r,this,i)},"self");return Ue(r,"name",t),Object.setPrototypeOf(r,e)}ie(ns,"createCallable");var If=(dt=class{constructor(e){this.ctx=e,Ue(this,Y.tracker,{associate:"reflect",property:"ctx"}),this._mixin("reflect",["get","set","provide","accessor","mixin","alias"]),this._mixin("scope",["config","runtime","effect","collect","accept","decline"]),this._mixin("registry",["using","inject","plugin"]),this._mixin("lifecycle",["on","once","parallel","emit","serial","bail","start","stop"])}static resolveInject(e,n){let r=e[Y.internal][n];for(;r?.type==="alias";)n=r.name,r=e[Y.internal][n];return[n,r]}static checkInject(e,n,r){if(e=e[Y.shadow]??e,["prototype","then","registry","lifecycle"].includes(n)||n[0]==="$"||n[0]==="_"||!e.runtime.plugin||e.bail(e,"internal/inject",n))return;const i=r.stack.split(`
|
|
1
|
+
(function(le,ye){typeof exports=="object"&&typeof module<"u"?ye(exports):typeof define=="function"&&define.amd?define(["exports"],ye):(le=typeof globalThis<"u"?globalThis:le||self,ye(le.InPageEditBundle={}))})(this,function(le){"use strict";var Lv=Object.defineProperty;var lf=le=>{throw TypeError(le)};var jv=(le,ye,Ie)=>ye in le?Lv(le,ye,{enumerable:!0,configurable:!0,writable:!0,value:Ie}):le[ye]=Ie;var te=(le,ye,Ie)=>jv(le,typeof ye!="symbol"?ye+"":ye,Ie),Jo=(le,ye,Ie)=>ye.has(le)||lf("Cannot "+Ie);var cf=(le,ye,Ie)=>(Jo(le,ye,"read from private field"),Ie?Ie.call(le):ye.get(le)),Qo=(le,ye,Ie)=>ye.has(le)?lf("Cannot add the same private member more than once"):ye instanceof WeakSet?ye.add(le):ye.set(le,Ie),uf=(le,ye,Ie,ne)=>(Jo(le,ye,"write to private field"),ne?ne.call(le,Ie):ye.set(le,Ie),Ie),Tr=(le,ye,Ie)=>(Jo(le,ye,"access private method"),Ie);var pt,Dn,pn,Ln,jn,Mn,Fn,Pe,ot,At,df,hf,pf,mf,Cr;const ye=()=>{let t,e;return{promise:new Promise((r,i)=>{t=r,e=i}),resolve:t,reject:e}};Promise.withResolvers||(Promise.withResolvers=ye);var Ie=Object.defineProperty,ne=(t,e)=>Ie(t,"name",{value:e,configurable:!0});function gf(){}ne(gf,"noop");function $e(t){return t==null}ne($e,"isNullable");function yf(t){return!$e(t)}ne(yf,"isNonNullable");function Rr(t){return t&&typeof t=="object"&&!Array.isArray(t)}ne(Rr,"isPlainObject");function Xo(t,e){return Object.fromEntries(Object.entries(t).filter(([n,r])=>e(n,r)))}ne(Xo,"filterKeys");function It(t,e){return Object.fromEntries(Object.entries(t).map(([n,r])=>[n,e(r,n)]))}ne(It,"mapValues");function Zo(t,e,n){if(!e)return{...t};const r={};for(const i of e)(n||t[i]!==void 0)&&(r[i]=t[i]);return r}ne(Zo,"pick");function vf(t,e){if(!e)return{...t};const n={...t};for(const r of e)Reflect.deleteProperty(n,r);return n}ne(vf,"omit");function He(t,e,n){return Object.defineProperty(t,e,{writable:!0,value:n,enumerable:!1})}ne(He,"defineProperty");function bf(t,e){return e.every(n=>t.includes(n))}ne(bf,"contain");function _f(t,e){return t.filter(n=>e.includes(n))}ne(_f,"intersection");function wf(t,e){return t.filter(n=>!e.includes(n))}ne(wf,"difference");function xf(t,e){return Array.from(new Set([...t,...e]))}ne(xf,"union");function Sf(t){return[...new Set(t)]}ne(Sf,"deduplicate");function qt(t,e){const n=t?.indexOf(e);return n>=0?(t.splice(n,1),!0):!1}ne(qt,"remove");function Ef(t){return Array.isArray(t)?t:$e(t)?[]:[t]}ne(Ef,"makeArray");function Wt(t,e){return arguments.length===1?n=>Wt(t,n):t in globalThis&&e instanceof globalThis[t]||Object.prototype.toString.call(e).slice(8,-1)===t}ne(Wt,"is");function Vn(t){return Wt("ArrayBuffer",t)||Wt("SharedArrayBuffer",t)}ne(Vn,"isArrayBufferLike");function ea(t){return Vn(t)||ArrayBuffer.isView(t)}ne(ea,"isArrayBufferSource");var _t;(t=>{t.is=Vn,t.isSource=ea;function e(o){return ArrayBuffer.isView(o)?o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength):o}t.fromSource=e,ne(e,"fromSource");function n(o){if(typeof Buffer<"u")return Buffer.from(o).toString("base64");let a="";const l=new Uint8Array(o);for(let u=0;u<l.byteLength;u++)a+=String.fromCharCode(l[u]);return btoa(a)}t.toBase64=n,ne(n,"toBase64");function r(o){return typeof Buffer<"u"?e(Buffer.from(o,"base64")):Uint8Array.from(atob(o),a=>a.charCodeAt(0))}t.fromBase64=r,ne(r,"fromBase64");function i(o){return typeof Buffer<"u"?Buffer.from(o).toString("hex"):Array.from(new Uint8Array(o),a=>a.toString(16).padStart(2,"0")).join("")}t.toHex=i,ne(i,"toHex");function s(o){if(typeof Buffer<"u")return e(Buffer.from(o,"hex"));const a=o.length%2===0?o:o.slice(0,o.length-1),l=[];for(let u=0;u<a.length;u+=2)l.push(parseInt(`${a[u]}${a[u+1]}`,16));return Uint8Array.from(l).buffer}t.fromHex=s,ne(s,"fromHex")})(_t||(_t={})),_t.fromBase64,_t.toBase64,_t.fromHex,_t.toHex;function Nr(t,e=new Map){if(!t||typeof t!="object")return t;if(Wt("Date",t))return new Date(t.valueOf());if(Wt("RegExp",t))return new RegExp(t.source,t.flags);if(Vn(t))return t.slice(0);if(ArrayBuffer.isView(t))return t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength);const n=e.get(t);if(n)return n;if(Array.isArray(t)){const i=[];return e.set(t,i),t.forEach((s,o)=>{i[o]=Reflect.apply(Nr,null,[s,e])}),i}const r=Object.create(Object.getPrototypeOf(t));e.set(t,r);for(const i of Reflect.ownKeys(t)){const s={...Reflect.getOwnPropertyDescriptor(t,i)};"value"in s&&(s.value=Reflect.apply(Nr,null,[s.value,e])),Reflect.defineProperty(r,i,s)}return r}ne(Nr,"clone");function nn(t,e,n){if(t===e||!n&&$e(t)&&$e(e))return!0;if(typeof t!=typeof e||typeof t!="object"||!t||!e)return!1;function r(i,s){return i(t)?i(e)?s(t,e):!1:i(e)?!1:void 0}return ne(r,"check"),r(Array.isArray,(i,s)=>i.length===s.length&&i.every((o,a)=>nn(o,s[a])))??r(Wt("Date"),(i,s)=>i.valueOf()===s.valueOf())??r(Wt("RegExp"),(i,s)=>i.source===s.source&&i.flags===s.flags)??r(Vn,(i,s)=>{if(i.byteLength!==s.byteLength)return!1;const o=new Uint8Array(i),a=new Uint8Array(s);for(let l=0;l<o.length;l++)if(o[l]!==a[l])return!1;return!0})??Object.keys({...t,...e}).every(i=>nn(t[i],e[i],n))}ne(nn,"deepEqual");function $f(t){return t.charAt(0).toUpperCase()+t.slice(1)}ne($f,"capitalize");function kf(t){return t.charAt(0).toLowerCase()+t.slice(1)}ne(kf,"uncapitalize");function Cf(t){return t.replace(/[_-][a-z]/g,e=>e.slice(1).toUpperCase())}ne(Cf,"camelCase");function Xi(t,e,n){const r=[];let i=0;for(let s=0;s<t.length;s++){const o=t.charCodeAt(s);if(o>=65&&o<=90){if(i===1){const a=t.charCodeAt(s+1);a>=97&&a<=122&&r.push(n),r.push(o+32)}else i!==0&&r.push(n),r.push(o+32);i=1}else o>=97&&o<=122?(r.push(o),i=2):e.includes(o)?(i!==0&&r.push(n),i=0):r.push(o)}return String.fromCharCode(...r)}ne(Xi,"tokenize");function Of(t){return Xi(t,[45,95],45)}ne(Of,"paramCase");function Pf(t){return Xi(t,[45,95],95)}ne(Pf,"snakeCase");function Af(t){return typeof t!="string"?`[${t.toString()}]`:/^[a-z_$][\w$]*$/i.test(t)?`.${t}`:`[${JSON.stringify(t)}]`}ne(Af,"formatProperty");function ta(t){return t.replace(/\/$/,"")}ne(ta,"trimSlash");function If(t){return t.startsWith("/")||(t="/"+t),ta(t)}ne(If,"sanitize");var na;(t=>{t.millisecond=1,t.second=1e3,t.minute=t.second*60,t.hour=t.minute*60,t.day=t.hour*24,t.week=t.day*7;let e=new Date().getTimezoneOffset();function n(y){e=y}t.setTimezoneOffset=n,ne(n,"setTimezoneOffset");function r(){return e}t.getTimezoneOffset=r,ne(r,"getTimezoneOffset");function i(y=new Date,v){return typeof y=="number"&&(y=new Date(y)),v===void 0&&(v=e),Math.floor((y.valueOf()/t.minute-v)/1440)}t.getDateNumber=i,ne(i,"getDateNumber");function s(y,v){const A=new Date(y*t.day);return v===void 0&&(v=e),new Date(+A+v*t.minute)}t.fromDateNumber=s,ne(s,"fromDateNumber");const o=/\d+(?:\.\d+)?/.source,a=new RegExp(`^${["w(?:eek(?:s)?)?","d(?:ay(?:s)?)?","h(?:our(?:s)?)?","m(?:in(?:ute)?(?:s)?)?","s(?:ec(?:ond)?(?:s)?)?"].map(y=>`(${o}${y})?`).join("")}$`);function l(y){const v=a.exec(y);return v?(parseFloat(v[1])*t.week||0)+(parseFloat(v[2])*t.day||0)+(parseFloat(v[3])*t.hour||0)+(parseFloat(v[4])*t.minute||0)+(parseFloat(v[5])*t.second||0):0}t.parseTime=l,ne(l,"parseTime");function u(y){const v=l(y);return v?y=Date.now()+v:/^\d{1,2}(:\d{1,2}){1,2}$/.test(y)?y=`${new Date().toLocaleDateString()}-${y}`:/^\d{1,2}-\d{1,2}-\d{1,2}(:\d{1,2}){1,2}$/.test(y)&&(y=`${new Date().getFullYear()}-${y}`),y?new Date(y):new Date}t.parseDate=u,ne(u,"parseDate");function c(y){const v=Math.abs(y);return v>=t.day-t.hour/2?Math.round(y/t.day)+"d":v>=t.hour-t.minute/2?Math.round(y/t.hour)+"h":v>=t.minute-t.second/2?Math.round(y/t.minute)+"m":v>=t.second?Math.round(y/t.second)+"s":y+"ms"}t.format=c,ne(c,"format");function f(y,v=2){return y.toString().padStart(v,"0")}t.toDigits=f,ne(f,"toDigits");function b(y,v=new Date){return y.replace("yyyy",v.getFullYear().toString()).replace("yy",v.getFullYear().toString().slice(2)).replace("MM",f(v.getMonth()+1)).replace("dd",f(v.getDate())).replace("hh",f(v.getHours())).replace("mm",f(v.getMinutes())).replace("ss",f(v.getSeconds())).replace("SSS",f(v.getMilliseconds(),3))}t.template=b,ne(b,"template")})(na||(na={}));var Tf=Object.defineProperty,ie=(t,e)=>Tf(t,"name",{value:e,configurable:!0}),Y={shadow:Symbol.for("cordis.shadow"),receiver:Symbol.for("cordis.receiver"),original:Symbol.for("cordis.original"),store:Symbol.for("cordis.store"),events:Symbol.for("cordis.events"),static:Symbol.for("cordis.static"),filter:Symbol.for("cordis.filter"),expose:Symbol.for("cordis.expose"),isolate:Symbol.for("cordis.isolate"),internal:Symbol.for("cordis.internal"),intercept:Symbol.for("cordis.intercept"),setup:Symbol.for("cordis.setup"),invoke:Symbol.for("cordis.invoke"),extend:Symbol.for("cordis.extend"),tracker:Symbol.for("cordis.tracker"),provide:Symbol.for("cordis.provide"),immediate:Symbol.for("cordis.immediate")},Rf=function*(){}.constructor,ra=async function*(){}.constructor;function Zi(t){return!(!t.prototype||t instanceof Rf||ra!==Function&&t instanceof ra)}ie(Zi,"isConstructor");function Kn(t,e){const n=t.Config||t.schema;return n&&t.schema!==!1&&(e=n(e)),e??{}}ie(Kn,"resolveConfig");function ia(t){return[Map,Set,Date,Promise].some(e=>t instanceof e)}ie(ia,"isUnproxyable");function es(t,e){if(t===Object.prototype)return e;const n=Object.create(es(Object.getPrototypeOf(t),e));for(const r of Reflect.ownKeys(t))Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r));return n}ie(es,"joinPrototype");function ts(t){return t&&(typeof t=="object"||typeof t=="function")}ie(ts,"isObject");function wt(t,e,n){if(!ts(e))return e;if(Object.hasOwn(e,Y.shadow))return Object.getPrototypeOf(e);const r=e[Y.tracker];return r?Lr(t,e,r,n):e}ie(wt,"getTraceable");function Yn(t,e){return e?new Proxy(t,{get:ie((n,r,i)=>r in e&&r!=="constructor"?Reflect.get(e,r,i):Reflect.get(n,r,i),"get"),set:ie((n,r,i,s)=>r in e&&r!=="constructor"?Reflect.set(e,r,i,s):Reflect.set(n,r,i,s),"set")}):t}ie(Yn,"withProps");function Dr(t,e,n){return Yn(t,Object.defineProperty(Object.create(null),e,{value:n,writable:!1}))}ie(Dr,"withProp");function ns(t,e,n,r){if(!n)return r;const i=Reflect.getOwnPropertyDescriptor(e,n)?.value;return i?Dr(r,n,t.extend({[Y.shadow]:i})):r}ie(ns,"createShadow");function sa(t,e,n,r){return new Proxy(e,{apply:ie((i,s,o)=>(s===n&&(s=r),o=o.map(a=>typeof a!="function"||a[Y.original]?a:new Proxy(a,{get:ie((l,u,c)=>{if(u===Y.original)return l;const f=Reflect.get(l,u,c);return u==="toString"&&f===Function.prototype.toString?function(...b){return Reflect.apply(f,this===c?l:this,b)}:f},"get"),apply:ie((l,u,c)=>Reflect.apply(l,wt(t,u),c.map(f=>wt(t,f))),"apply"),construct:ie((l,u,c)=>Reflect.construct(l,u.map(f=>wt(t,f)),c),"construct")})),wt(t,Reflect.apply(i,s,o))),"apply")})}ie(sa,"createShadowMethod");function Lr(t,e,n,r){t[Y.shadow]&&(t=Object.getPrototypeOf(t));const i=new Proxy(e,{get:ie((s,o,a)=>{if(o===Y.original)return s;if(o===n.property)return t;if(typeof o=="symbol")return Reflect.get(s,o,a);if(n.associate&&t[Y.internal][`${n.associate}.${o}`])return Reflect.get(t,`${n.associate}.${o}`,Dr(t,Y.receiver,a));const l=ns(t,s,n.property,a),u=Reflect.get(s,o,l),c=u?.[Y.tracker];return c?Lr(t,u,c):!r&&typeof u=="function"?sa(t,u,a,l):u},"get"),set:ie((s,o,a,l)=>{if(o===Y.original||o===n.property)return!1;if(typeof o=="symbol")return Reflect.set(s,o,a,l);if(n.associate&&t[Y.internal][`${n.associate}.${o}`])return Reflect.set(t,`${n.associate}.${o}`,a,Dr(t,Y.receiver,l));const u=ns(t,s,n.property,l);return Reflect.set(s,o,a,u)},"set"),apply:ie((s,o,a)=>rs(i,s,o,a),"apply")});return i}ie(Lr,"createTraceable");function rs(t,e,n,r){return e[Y.invoke]?e[Y.invoke].apply(t,r):Reflect.apply(e,n,r)}ie(rs,"applyTraceable");function is(t,e,n){const r=ie(function(...i){const s=Lr(r.ctx,r,n);return rs(s,r,this,i)},"self");return He(r,"name",t),Object.setPrototypeOf(r,e)}ie(is,"createCallable");var Nf=(pt=class{constructor(e){this.ctx=e,He(this,Y.tracker,{associate:"reflect",property:"ctx"}),this._mixin("reflect",["get","set","provide","accessor","mixin","alias"]),this._mixin("scope",["config","runtime","effect","collect","accept","decline"]),this._mixin("registry",["using","inject","plugin"]),this._mixin("lifecycle",["on","once","parallel","emit","serial","bail","start","stop"])}static resolveInject(e,n){let r=e[Y.internal][n];for(;r?.type==="alias";)n=r.name,r=e[Y.internal][n];return[n,r]}static checkInject(e,n,r){if(e=e[Y.shadow]??e,["prototype","then","registry","lifecycle"].includes(n)||n[0]==="$"||n[0]==="_"||!e.runtime.plugin||e.bail(e,"internal/inject",n))return;const i=r.stack.split(`
|
|
2
2
|
`);i.splice(1,1),r.stack=i.join(`
|
|
3
|
-
`),e.emit(e,"internal/warning",r)}get(e){if(this.ctx[Y.internal][e]?.type!=="service")return;const r=this.ctx[Y.isolate][e],i=this.ctx[Y.store][r]?.value;return bt(this.ctx,i)}set(e,n){this.provide(e);const r=this.ctx[Y.isolate][e],i=this.ctx[Y.store][r]?.value;n??(n=void 0);let s=ie(()=>{},"dispose");if(i===n)return s;if(!$e(n)&&!$e(i))throw new Error(`service ${e} has been registered`);const o=this.ctx;$e(n)||(s=o.effect(()=>()=>{o.set(e,void 0)})),na(n)&&o.emit(o,"internal/warning",new Error(`service ${e} is an unproxyable object, which may lead to unexpected behavior`));const a=Object.create(o);return a[Y.filter]=l=>o[Y.isolate][e]===l[Y.isolate][e],o.emit(a,"internal/before-service",e,n),o[Y.store][r]={value:n,source:o},o.emit(a,"internal/service",e,i),s}provide(e,n,r){const i=this.ctx.root[Y.internal];if(e in i)return;const s=Symbol(e);i[e]={type:"service",builtin:r},this.ctx.root[Y.isolate][e]=s,Zi(n)&&(this.ctx[Y.store][s]={value:n,source:null},Ue(n,Y.tracker,{associate:e,property:"ctx"}))}_accessor(e,n){const r=this.ctx.root[Y.internal];return e in r?()=>{}:(r[e]={type:"accessor",...n},()=>delete this.ctx.root[Y.isolate][e])}accessor(e,n){this.ctx.scope.effect(()=>this._accessor(e,n))}alias(e,n){const r=this.ctx.root[Y.internal];if(!(e in r))for(const i of n)r[i]||(r[i]={type:"alias",name:e})}_mixin(e,n){const r=Array.isArray(n)?n.map(o=>[o,o]):Object.entries(n),i=typeof e=="string"?o=>o[e]:()=>e,s=r.map(([o,a])=>this._accessor(a,{get(l){const u=i(this);if($e(u))return u;const c=l?Kn(l,u):u,f=Reflect.get(u,o,c);return typeof f!="function"?f:f.bind(c??u)},set(l,u){const c=i(this),f=u?Kn(u,c):c;return Reflect.set(c,o,l,f)}}));return()=>s.forEach(o=>o())}mixin(e,n){this.ctx.scope.effect(()=>this._mixin(e,n))}trace(e){return bt(this.ctx,e)}bind(e){return new Proxy(e,{apply:ie((n,r,i)=>n.apply(this.trace(r),i.map(s=>this.trace(s))),"apply")})}},ie(dt,"ReflectService"),te(dt,"handler",{get:ie((e,n,r)=>{if(typeof n!="string")return Reflect.get(e,n,r);if(Reflect.has(e,n))return bt(r,Reflect.get(e,n,r),!0);const[i,s]=dt.resolveInject(e,n),o=new Error(`property ${i} is not registered, declare it as \`inject\` to suppress this warning`);return s?s.type==="accessor"?s.get.call(r,r[Y.receiver]):(s.builtin||dt.checkInject(r,i,o),r.reflect.get(i)):(dt.checkInject(r,i,o),Reflect.get(e,i,r))},"get"),set:ie((e,n,r,i)=>{if(typeof n!="string")return Reflect.set(e,n,r,i);const[s,o]=dt.resolveInject(e,n);return o?o.type==="accessor"?o.set?o.set.call(i,r,i[Y.receiver]):!1:(i.reflect.set(s,r),!0):Reflect.set(e,s,r,i)},"set"),has:ie((e,n)=>{if(typeof n!="string")return Reflect.has(e,n);if(Reflect.has(e,n))return!0;const[,r]=dt.resolveInject(e,n);return!!r},"has")}),dt),rs=If;function is(t){return t!==null&&t!==!1&&t!==void 0}ie(is,"isBailed");var Tf=(Nn=class{constructor(e){te(this,"isActive",!1);te(this,"_tasks",new Set);te(this,"_hooks",{});this.ctx=e,Ue(this,Y.tracker,{associate:"lifecycle",property:"ctx"}),Ue(this.on("internal/listener",function(r,i,s){const o=s.prepend?"unshift":"push";if(r==="ready")return this.lifecycle.isActive?(this.scope.ensure(async()=>i()),()=>!1):void 0;if(r==="dispose")return this.scope.disposables[o](i),Ue(i,"name","event <dispose>"),()=>Ht(this.scope.disposables,i);if(r==="fork")return this.scope.runtime.forkables[o](i),this.scope.collect("event <fork>",()=>Ht(this.scope.runtime.forkables,i))}),Ge.static,e.scope);for(const r of["info","error","warning"])Ue(this.on(`internal/${r}`,(i,...s)=>{this._hooks[`internal/${r}`].length>1}),Ge.static,e.scope);Ue(this.on("internal/before-service",function(r){for(const i of this.registry.values()){if(!i.inject[r]?.required)continue;const s=i.isReusable?i.children:[i];for(const o of s)this[Y.filter](o.ctx)&&(o.updateStatus(),o.reset())}},{global:!0}),Ge.static,e.scope),Ue(this.on("internal/service",function(r){for(const i of this.registry.values()){if(!i.inject[r]?.required)continue;const s=i.isReusable?i.children:[i];for(const o of s)this[Y.filter](o.ctx)&&o.start()}},{global:!0}),Ge.static,e.scope);const n=ie((r,i)=>{if(!r.runtime.plugin)return!1;for(const s in r.runtime.inject)if(i===rs.resolveInject(r.ctx,s)[0])return!0;return n(r.parent.scope,i)},"checkInject");Ue(this.on("internal/inject",function(r){return n(this.scope,r)},{global:!0}),Ge.static,e.scope)}async flush(){for(;this._tasks.size;)await Promise.all(Array.from(this._tasks))}filterHooks(e,n){return n=bt(this.ctx,n),e.slice().filter(r=>{const i=n?.[Ge.filter];return r.global||!i||i.call(n,r.ctx)})}*dispatch(e,n){const r=typeof n[0]=="object"||typeof n[0]=="function"?n.shift():null,i=n.shift();i!=="internal/event"&&this.emit("internal/event",e,i,n,r);for(const s of this.filterHooks(this._hooks[i]||[],r))yield s.callback.apply(r,n)}async parallel(...e){await Promise.all(this.dispatch("emit",e))}emit(...e){Array.from(this.dispatch("emit",e))}async serial(...e){for await(const n of this.dispatch("serial",e))if(is(n))return n}bail(...e){for(const n of this.dispatch("bail",e))if(is(n))return n}register(e,n,r,i){const s=i.prepend?"unshift":"push";return n[s]({ctx:this.ctx,callback:r,...i}),this.ctx.state.collect(e,()=>this.unregister(n,r))}unregister(e,n){const r=e.findIndex(i=>i.callback===n);if(r>=0)return e.splice(r,1),!0}on(e,n,r){var a;typeof r!="object"&&(r={prepend:r}),this.ctx.scope.assertActive(),n=this.ctx.reflect.bind(n);const i=this.bail(this.ctx,"internal/listener",e,n,r);if(i)return i;const s=(a=this._hooks)[e]||(a[e]=[]),o=typeof e=="string"?`event <${e}>`:"event (Symbol)";return this.register(o,s,n,r)}once(e,n,r){const i=this.on(e,function(...s){return i(),n.apply(this,s)},r);return i}async start(){this.isActive=!0;const e=this._hooks.ready||[];for(;e.length;){const{ctx:n,callback:r}=e.shift();n.scope.ensure(async()=>r())}await this.flush()}async stop(){this.isActive=!1,this.ctx.scope.reset()}},ie(Nn,"Lifecycle"),Nn),Rf=Tf,ss=(hn=class extends Error{constructor(e,n){super(n??hn.Code[e]),this.code=e}},ie(hn,"CordisError"),hn);(t=>{t.Code={INACTIVE_EFFECT:"cannot create effect on inactive context"}})(ss||(ss={}));var ia=(Dn=class{constructor(e,n){te(this,"uid");te(this,"ctx");te(this,"disposables",[]);te(this,"error");te(this,"status",0);te(this,"isActive",!1);te(this,"context");te(this,"proxy");te(this,"acceptors",[]);te(this,"tasks",new Set);te(this,"hasError",!1);this.parent=e,this.config=n,this.uid=e.registry?e.registry.counter:0,this.ctx=this.context=e.extend({scope:this}),this.proxy=new Proxy({},{get:ie((r,i)=>Reflect.get(this.config,i),"get")})}get _config(){return this.runtime.isReactive?this.proxy:this.config}assertActive(){if(!(this.uid!==null||this.isActive))throw new ss("INACTIVE_EFFECT")}effect(e,n){this.assertActive();const r=Qi(e)?new e(this.ctx,n):e(this.ctx,n);let i=!1;const s=typeof r=="function"?r:r.dispose.bind(r),o=ie((...a)=>{if(!i)return i=!0,Ht(this.disposables,o),s(...a)},"wrapped");return this.disposables.push(o),typeof r=="function"?o:(r.dispose=o,r)}collect(e,n){const r=Ue(()=>(Ht(this.disposables,r),n()),"name",e);return this.disposables.push(r),r}restart(){this.reset(),this.error=null,this.hasError=!1,this.status=0,this.start()}_getStatus(){return this.uid===null?4:this.hasError?3:this.tasks.size?1:this.ready?2:0}updateStatus(e){const n=this.status;e?.(),this.status=this._getStatus(),n!==this.status&&this.context.emit("internal/status",this,n)}ensure(e){const n=e().catch(r=>{this.context.emit(this.ctx,"internal/error",r),this.cancel(r)}).finally(()=>{this.updateStatus(()=>this.tasks.delete(n)),this.context.events._tasks.delete(n)});this.updateStatus(()=>this.tasks.add(n)),this.context.events._tasks.add(n)}cancel(e){this.error=e,this.updateStatus(()=>this.hasError=!0),this.reset()}get ready(){return Object.entries(this.runtime.inject).every(([e,n])=>!n.required||!$e(this.ctx.get(e)))}reset(){this.isActive=!1,this.disposables=this.disposables.splice(0).filter(e=>{if(this.uid!==null&&e[Ge.static]===this)return!0;(async()=>e())().catch(n=>{this.context.emit(this.ctx,"internal/error",n)})})}init(e){this.config?this.start():this.cancel(e)}start(){if(!this.ready||this.isActive||this.uid===null)return!0;this.isActive=!0,this.updateStatus(()=>this.hasError=!1)}accept(...e){const r={keys:Array.isArray(e[0])?e.shift():null,callback:e[0],...e[1]};return this.effect(()=>(this.acceptors.push(r),r.immediate&&r.callback?.(this.config),()=>Ht(this.acceptors,r)))}decline(e){return this.accept(e,()=>!0)}checkUpdate(e,n){if(n||!this.config)return[!0,!0];if(n===!1)return[!1,!1];const r=Object.create(null),i=ie(u=>{const c=r[u]??(r[u]=!tn(this.config[u],e[u]));return o||(o=c),c},"checkPropertyUpdate"),s=new Set;let o=!1,a=!1,l=this.runtime.isReactive||null;for(const{keys:u,callback:c,passive:f}of this.acceptors){if(!u)l||(l=!f);else if(f)u?.forEach(y=>s.add(y));else{let y=!1;for(const v of u)y||(y=i(v));if(!y)continue}c?.(e)&&(a=!0)}for(const u in{...this.config,...e})if(l!==!1&&!(u in r)&&!s.has(u)){const c=i(u);l===null&&(a||(a=c))}return[o,a]}},ie(Dn,"EffectScope"),Dn),Nf=(Ln=class extends ia{constructor(n,r,i,s){super(n,i);te(this,"dispose");this.runtime=r,this.dispose=Ue(n.scope.collect(`fork <${n.runtime.name}>`,()=>{this.uid=null,this.reset(),this.context.emit("internal/fork",this);const o=Ht(r.disposables,this.dispose);return Ht(r.children,this)&&!r.children.length&&n.registry.delete(r.plugin),o}),Ge.static,r),r.children.push(this),r.disposables.push(this.dispose),this.context.emit("internal/fork",this),this.init(s)}start(){if(super.start())return!0;for(const n of this.runtime.forkables)this.ensure(async()=>n(this.context,this._config))}update(n,r){const i=this.config,s=this.runtime.isForkable?this:this.runtime;if(s.config!==i)return;let o;try{o=Vn(this.runtime.plugin,n)}catch(u){return this.context.emit("internal/error",u),this.cancel(u)}const[a,l]=s.checkUpdate(o,r);this.context.emit("internal/before-update",this,n),this.config=o,s.config=o,a&&this.context.emit("internal/update",this,i),l&&s.restart()}},ie(Ln,"ForkScope"),Ln),sa=(jn=class extends ia{constructor(n,r,i,s){super(n,i);te(this,"value");te(this,"runtime",this);te(this,"schema");te(this,"name");te(this,"inject",Object.create(null));te(this,"forkables",[]);te(this,"children",[]);te(this,"isReusable",!1);te(this,"isReactive",!1);te(this,"apply",ie((n,r)=>{if(typeof this.plugin!="function")return this.plugin.apply(n,r);if(Qi(this.plugin)){const i=new this.plugin(n,r),s=i[Ge.expose];return s&&n.set(s,i),i.fork&&this.forkables.push(i.fork.bind(i)),i}else return this.plugin(n,r)},"apply"));this.plugin=r,r?(this.setup(),this.init(s)):(this.name="root",this.isActive=!0)}get isForkable(){return this.forkables.length>0}fork(n,r,i){return new Nf(n,this,r,i)}dispose(){return this.uid=null,this.reset(),this.context.emit("internal/runtime",this),!0}setup(){const{name:n}=this.plugin;n&&n!=="apply"&&(this.name=n),this.schema=this.plugin.Config||this.plugin.schema,this.inject=Ye.resolve(this.plugin.using||this.plugin.inject),this.isReusable=this.plugin.reusable,this.isReactive=this.plugin.reactive,this.context.emit("internal/runtime",this),this.isReusable&&this.forkables.push(this.apply)}reset(){super.reset();for(const n of this.children)n.reset()}start(){if(super.start())return!0;!this.isReusable&&this.plugin&&this.ensure(async()=>this.value=this.apply(this.ctx,this._config));for(const n of this.children)n.start()}update(n,r){if(this.isForkable){const u=new Error(`attempting to update forkable plugin "${this.plugin.name}", which may lead to unexpected behavior`);this.context.emit(this.ctx,"internal/warning",u)}const i=this.config;let s;try{s=Vn(this.runtime.plugin||this.context.constructor,n)}catch(u){return this.context.emit("internal/error",u),this.cancel(u)}const[o,a]=this.checkUpdate(s,r),l=this.children.find(u=>u.config===i);this.config=s,l&&(this.context.emit("internal/before-update",l,n),l.config=s,o&&this.context.emit("internal/update",l,i)),a&&this.restart()}},ie(jn,"MainScope"),jn);function oa(t){return t&&typeof t=="object"&&typeof t.apply=="function"}ie(oa,"isApplicable");function Ye(t){return function(e,n){if(n.kind==="class")e.inject=t;else if(n.kind==="method")n.addInitializer(function(){const r=this[Y.tracker]?.property;if(!r)throw new Error("missing context tracker");this[r].inject(t,i=>{e.call(Kn(this,{[r]:i}))})});else throw new Error("@Inject can only be used on class or class methods")}}ie(Ye,"Inject"),(t=>{function e(n){if(!n)return{};if(Array.isArray(n))return Object.fromEntries(n.map(o=>[o,{required:!0}]));const{required:r,optional:i,...s}=n;return Array.isArray(r)&&Object.assign(s,Object.fromEntries(r.map(o=>[o,{required:!0}]))),Array.isArray(i)&&Object.assign(s,Object.fromEntries(i.map(o=>[o,{required:!1}]))),s}t.resolve=e,ie(e,"resolve")})(Ye||(Ye={}));var Df=(Mn=class{constructor(e,n){te(this,"_counter",0);te(this,"_internal",new Map);te(this,"context");this.ctx=e,Ue(this,Y.tracker,{associate:"registry",property:"ctx"}),this.context=e;const r=new sa(e,null,n);e.scope=r,r.ctx=e,this.set(null,r)}get counter(){return++this._counter}get size(){return this._internal.size}resolve(e,n=!1){if(e===null||typeof e=="function")return e;if(oa(e))return e.apply;if(n)throw new Error('invalid plugin, expect function or object with an "apply" method, received '+typeof e)}get(e){const n=this.resolve(e);return n&&this._internal.get(n)}has(e){const n=this.resolve(e);return!!n&&this._internal.has(n)}set(e,n){const r=this.resolve(e);this._internal.set(r,n)}delete(e){const n=this.resolve(e),r=n&&this._internal.get(n);if(r)return this._internal.delete(n),r.dispose(),r}keys(){return this._internal.keys()}values(){return this._internal.values()}entries(){return this._internal.entries()}forEach(e){return this._internal.forEach(e)}using(e,n){return this.inject(e,n)}inject(e,n){return this.plugin({inject:e,apply:n,name:n.name})}plugin(e,n,r){if(this.resolve(e,!0),this.ctx.scope.assertActive(),!r)try{n=Vn(e,n)}catch(s){this.context.emit(this.ctx,"internal/error",s),r=s,n=null}let i=this.get(e);return i?(i.isForkable||this.context.emit(this.ctx,"internal/warning",new Error(`duplicate plugin detected: ${e.name}`)),i.fork(this.ctx,n,r)):(i=new sa(this.ctx,e,n,r),this.set(e,i),i.fork(this.ctx,n,r))}},ie(Mn,"Registry"),Mn),Lf=Df,Ge=(Pe=class{static is(e){return!!e?.[Pe.is]}static associate(e,n){return e}constructor(e){e=Vn(this.constructor,e),this[Y.store]=Object.create(null),this[Y.isolate]=Object.create(null),this[Y.internal]=Object.create(null),this[Y.intercept]=Object.create(null);const n=new Proxy(this,rs.handler);n.root=n,n.reflect=new rs(n),n.registry=new Lf(n,e),n.lifecycle=new Rf(n);const r=ie(i=>{if(i){r(Object.getPrototypeOf(i));for(const s of Object.getOwnPropertyNames(i)){const o=i[s].prototype?.constructor;o&&(n[i[s].key]=new o(n,e),Ue(n[i[s].key],"ctx",n))}}},"attach");return r(this[Y.internal]),n}[Symbol.for("nodejs.util.inspect.custom")](){return`Context <${this.name}>`}get name(){let e=this.runtime;for(;e&&!e.name;)e=e.parent.runtime;return e?.name}get events(){return this.lifecycle}get state(){return this.scope}extend(e={}){const n=Reflect.getOwnPropertyDescriptor(this,Y.shadow)?.value,r=Object.assign(Object.create(bt(this,this)),e);return n?Object.assign(Object.create(r),{[Y.shadow]:n}):r}isolate(e,n){const r=Object.create(this[Y.isolate]);return r[e]=n??Symbol(e),this.extend({[Y.isolate]:r})}intercept(e,n){const r=Object.create(this[Y.intercept]);return r[e]=n,this.extend({[Y.intercept]:r})}},ie(Pe,"Context"),te(Pe,"store",Y.store),te(Pe,"events",Y.events),te(Pe,"static",Y.static),te(Pe,"filter",Y.filter),te(Pe,"expose",Y.expose),te(Pe,"isolate",Y.isolate),te(Pe,"internal",Y.internal),te(Pe,"intercept",Y.intercept),te(Pe,"origin","ctx"),te(Pe,"current","ctx"),Pe.is[Symbol.toPrimitive]=()=>Symbol.for("cordis.is"),Pe.prototype[Pe.is]=!0,Pe);Ge.prototype[Ge.internal]=Object.create(null);var yn=(it=class{constructor(...e){te(this,"ctx");te(this,"name");te(this,"config");let n,r,i,s;Ge.is(e[0])?(n=e[0],typeof e[1]=="string"?(r=e[1],i=e[2]):s=e[1]):s=e[0],r??(r=this.constructor[Y.provide]),i??(i=this.constructor[Y.immediate]);let o=this;const a={associate:r,property:"ctx"};return o[Y.invoke]&&(o=ns(r,Xi(Object.getPrototypeOf(this),Function.prototype),a)),n?o.ctx=n:o[Y.setup](),o.name=r,o.config=s,Ue(o,Y.tracker,a),o.ctx.provide(r),o.ctx.runtime.name=r,i&&(n?o[Y.expose]=r:o.ctx.set(r,o)),o.ctx.on("ready",async()=>{await Promise.resolve(),await o.start(),i||o.ctx.set(r,o)}),o.ctx.on("dispose",()=>o.stop()),o}start(){}stop(){}[Y.filter](e){return e[Y.isolate][this.name]===this.ctx[Y.isolate][this.name]}[Y.setup](){this.ctx=new Ge}[Y.extend](e){let n;return this[it.invoke]?n=ns(this.name,this,this[Y.tracker]):n=Object.create(this),Object.assign(n,e)}static[Symbol.hasInstance](e){let n=e.constructor;for(;n;){if(n=n.prototype?.constructor,n===this)return!0;n=Object.getPrototypeOf(n)}return!1}},ie(it,"Service"),te(it,"setup",Y.setup),te(it,"invoke",Y.invoke),te(it,"extend",Y.extend),te(it,"tracker",Y.tracker),te(it,"provide",Y.provide),te(it,"immediate",Y.immediate),it),jf=Object.defineProperty,Mf=Object.getOwnPropertyNames,ue=(t,e)=>jf(t,"name",{value:e,configurable:!0}),Ff=(t,e)=>function(){return e||(0,t[Mf(t)[0]])((e={exports:{}}).exports,e),e.exports},Bf=Ff({"src/index.ts"(t,e){var I;var n=Symbol.for("schemastery"),r=Symbol.for("ValidationError");globalThis.__schemastery_index__??(globalThis.__schemastery_index__=0);var i=(I=class extends TypeError{constructor(h,x){let P="$";for(const R of x.path||[])typeof R=="string"?P+="."+R:typeof R=="number"?P+="["+R+"]":typeof R=="symbol"&&(P+=`[Symbol(${R.toString()})]`);P.startsWith(".")&&(P=P.slice(1));super((P==="$"?"":`${P} `)+h);te(this,"name","ValidationError");this.options=x}static is(h){return!!h?.[r]}},ue(I,"ValidationError"),I);Object.defineProperty(i.prototype,r,{value:!0});var s=ue(function(g){const p=ue(function(h,x={}){return s.resolve(h,p,x)[0]},"schema");if(g.refs){const h=At(g.refs,P=>new s(P)),x=ue(P=>h[P],"getRef");for(const P in h){const R=h[P];R.sKey=x(R.sKey),R.inner=x(R.inner),R.list=R.list&&R.list.map(x),R.dict=R.dict&&At(R.dict,x)}return h[g.uid]}if(Object.assign(p,g),typeof p.callback=="string")try{p.callback=new Function("return "+p.callback)()}catch{}return Object.defineProperty(p,"uid",{value:globalThis.__schemastery_index__++}),Object.setPrototypeOf(p,s.prototype),p.meta||(p.meta={}),p.toString=p.toString.bind(p),p},"Schema");s.prototype=Object.create(Function.prototype),s.prototype[n]=!0,s.ValidationError=i;var o;s.prototype.toJSON=ue(function(){var h;if(o)return o[h=this.uid]??(o[h]=JSON.parse(JSON.stringify({...this}))),this.uid;o={[this.uid]:{...this}},o[this.uid]=JSON.parse(JSON.stringify({...this}));const p={uid:this.uid,refs:o};return o=void 0,p},"toJSON"),s.prototype.set=ue(function(p,h){return this.dict[p]=h,this},"set"),s.prototype.push=ue(function(p){return this.list.push(p),this},"push");function a(g,p){const h=typeof g=="string"?{"":g}:{...g};for(const x in p){const P=p[x];P?.$description||P?.$desc?h[x]=P.$description||P.$desc:typeof P=="string"&&(h[x]=P)}return h}ue(a,"mergeDesc");function l(g){return g?.$value??g?.$inner}ue(l,"getInner");function u(g){return Jo(g??{},p=>!p.startsWith("$"))}ue(u,"extractKeys"),s.prototype.i18n=ue(function(p){const h=s(this),x=a(h.meta.description,p);return Object.keys(x).length&&(h.meta.description=x),h.dict&&(h.dict=At(h.dict,(P,R)=>P.i18n(At(p,W=>l(W)?.[R]??W?.[R])))),h.list&&(h.list=h.list.map((P,R)=>P.i18n(At(p,(W={})=>Array.isArray(l(W))?l(W)[R]:Array.isArray(W)?W[R]:u(W))))),h.inner&&(h.inner=h.inner.i18n(At(p,P=>l(P)?l(P):u(P)))),h.sKey&&(h.sKey=h.sKey.i18n(At(p,P=>P?.$key))),h},"i18n"),s.prototype.extra=ue(function(p,h){const x=s(this);return x.meta={...x.meta,[p]:h},x},"extra");for(const g of["required","disabled","collapse","hidden","loose"])Object.assign(s.prototype,{[g](p=!0){const h=s(this);return h.meta={...h.meta,[g]:p},h}});s.prototype.deprecated=ue(function(){var h;const p=s(this);return(h=p.meta).badges||(h.badges=[]),p.meta.badges.push({text:"deprecated",type:"danger"}),p},"deprecated"),s.prototype.experimental=ue(function(){var h;const p=s(this);return(h=p.meta).badges||(h.badges=[]),p.meta.badges.push({text:"experimental",type:"warning"}),p},"experimental"),s.prototype.pattern=ue(function(p){const h=s(this),x=Qo(p,["source","flags"]);return h.meta={...h.meta,pattern:x},h},"pattern"),s.prototype.simplify=ue(function(p){if(tn(p,this.meta.default,this.type==="dict"))return null;if($e(p))return p;if(this.type==="object"||this.type==="dict"){const h={};for(const x in p){const R=(this.type==="object"?this.dict[x]:this.inner)?.simplify(p[x]);(this.type==="dict"||!$e(R))&&(h[x]=R)}return tn(h,this.meta.default,this.type==="dict")?null:h}else if(this.type==="array"||this.type==="tuple"){const h=[];return p.forEach((x,P)=>{const R=this.type==="array"?this.inner:this.list[P],W=R?R.simplify(x):x;h.push(W)}),h}else if(this.type==="intersect"){const h={};for(const x of this.list)Object.assign(h,x.simplify(p));return h}else if(this.type==="union")for(const h of this.list)try{return s.resolve(p,h,{}),h.simplify(p)}catch{}return p},"simplify"),s.prototype.toString=ue(function(p){return U[this.type]?.(this,p)??`Schema<${this.type}>`},"toString"),s.prototype.role=ue(function(g,p){const h=s(this);return h.meta={...h.meta,role:g,extra:p},h},"role");for(const g of["default","link","comment","description","max","min","step"])Object.assign(s.prototype,{[g](p){const h=s(this);return h.meta={...h.meta,[g]:p},h}});var c={};s.extend=ue(function(p,h){c[p]=h},"extend"),s.resolve=ue(function(p,h,x={},P=!1){if(!h)return[p];if(x.ignore?.(p,h))return[p];if($e(p)&&h.type!=="lazy"){if(h.meta.required)throw new i("missing required value",x);let W=h,X=h.meta.default;for(;W?.type==="intersect"&&$e(X);)W=W.list[0],X=W?.meta.default;if($e(X))return[p];p=Rr(X)}const R=c[h.type];if(!R)throw new i(`unsupported type "${h.type}"`,x);try{return R(p,h,x,P)}catch(W){if(!h.meta.loose)throw W;return[h.meta.default]}},"resolve"),s.from=ue(function(p){if($e(p))return s.any();if(["string","number","boolean"].includes(typeof p))return s.const(p).required();if(p[n])return p;if(typeof p=="function")switch(p){case String:return s.string().required();case Number:return s.number().required();case Boolean:return s.boolean().required();case Function:return s.function().required();default:return s.is(p).required()}else throw new TypeError(`cannot infer schema from ${p}`)},"from"),s.lazy=ue(function(p){const h=ue(()=>(x.inner[n]||(x.inner=x.builder(),x.inner.meta={...x.meta,...x.inner.meta}),x.inner.toJSON()),"toJSON"),x=new s({type:"lazy",builder:p,inner:{toJSON:h}});return x},"lazy"),s.natural=ue(function(){return s.number().step(1).min(0)},"natural"),s.percent=ue(function(){return s.number().step(.01).min(0).max(1).role("slider")},"percent"),s.date=ue(function(){return s.union([s.is(Date),s.transform(s.string().role("datetime"),(p,h)=>{const x=new Date(p);if(isNaN(+x))throw new i(`invalid date "${p}"`,h);return x},!0)])},"date"),s.regExp=ue(function(p=""){return s.union([s.is(RegExp),s.transform(s.string().role("regexp",{flag:p}),(h,x)=>{try{return new RegExp(h,p)}catch(P){throw new i(P.message,x)}},!0)])},"regExp"),s.arrayBuffer=ue(function(p){return s.union([s.is(ArrayBuffer),s.is(SharedArrayBuffer),s.transform(s.any(),(h,x)=>{if(vt.isSource(h))return vt.fromSource(h);throw new i(`expected ArrayBufferSource but got ${h}`,x)},!0),...p?[s.transform(s.string(),(h,x)=>{try{return p==="base64"?vt.fromBase64(h):vt.fromHex(h)}catch(P){throw new i(P.message,x)}},!0)]:[]])},"arrayBuffer"),s.extend("lazy",(g,p,h,x)=>(p.inner[n]||(p.inner=p.builder(),p.inner.meta={...p.meta,...p.inner.meta}),s.resolve(g,p.inner,h,x))),s.extend("any",g=>[g]),s.extend("never",(g,p,h)=>{throw new i(`expected nullable but got ${g}`,h)}),s.extend("const",(g,{value:p},h)=>{if(tn(g,p))return[p];throw new i(`expected ${p} but got ${g}`,h)});function f(g,p,h,x,P=!1){const{max:R=1/0,min:W=-1/0}=p;if(g>R)throw new i(`expected ${h} <= ${R} but got ${g}`,x);if(g<W&&!P)throw new i(`expected ${h} >= ${W} but got ${g}`,x)}ue(f,"checkWithinRange"),s.extend("string",(g,{meta:p},h)=>{if(typeof g!="string")throw new i(`expected string but got ${g}`,h);if(p.pattern){const x=new RegExp(p.pattern.source,p.pattern.flags);if(!x.test(g))throw new i(`expect string to match regexp ${x}`,h)}return f(g.length,p,"string length",h),[g]});function b(g,p){const h=g.toString();if(h.includes("e"))return g*Math.pow(10,p);const x=h.indexOf(".");if(x===-1)return g*Math.pow(10,p);const P=h.slice(x+1),R=h.slice(0,x);return P.length<=p?+(R+P.padEnd(p,"0")):+(R+P.slice(0,p)+"."+P.slice(p))}ue(b,"decimalShift");function y(g,p,h){if(h=Math.abs(h),!/^\d+\.\d+$/.test(h.toString()))return(g-p)%h===0;const x=h.toString().indexOf("."),P=h.toString().slice(x+1).length;return Math.abs(b(g,P)-b(p,P))%b(h,P)===0}ue(y,"isMultipleOf"),s.extend("number",(g,{meta:p},h)=>{if(typeof g!="number")throw new i(`expected number but got ${g}`,h);f(g,p,"number",h);const{step:x}=p;if(x&&!y(g,p.min??0,x))throw new i(`expected number multiple of ${x} but got ${g}`,h);return[g]}),s.extend("boolean",(g,p,h)=>{if(typeof g=="boolean")return[g];throw new i(`expected boolean but got ${g}`,h)}),s.extend("bitset",(g,{bits:p,meta:h},x)=>{let P=0,R=[];if(typeof g=="number"){P=g;for(const W in p)g&p[W]&&R.push(W)}else if(Array.isArray(g)){R=g;for(const W of R){if(typeof W!="string")throw new i(`expected string but got ${W}`,x);W in p&&(P|=p[W])}}else throw new i(`expected number or array but got ${g}`,x);return P===h.default?[P]:[P,R]}),s.extend("function",(g,p,h)=>{if(typeof g=="function")return[g];throw new i(`expected function but got ${g}`,h)}),s.extend("is",(g,{constructor:p},h)=>{if(typeof p=="function"){if(g instanceof p)return[g];throw new i(`expected ${p.name} but got ${g}`,h)}else{if($e(g))throw new i(`expected ${p} but got ${g}`,h);let x=Object.getPrototypeOf(g);for(;x;){if(x.constructor?.name===p)return[g];x=Object.getPrototypeOf(x)}throw new i(`expected ${p} but got ${g}`,h)}});function v(g,p,h,x){try{const[P,R]=s.resolve(g[p],h,{...x,path:[...x.path||[],p]});return R!==void 0&&(g[p]=R),P}catch(P){if(!x?.autofix)throw P;return delete g[p],h.meta.default}}ue(v,"property"),s.extend("array",(g,{inner:p,meta:h},x)=>{if(!Array.isArray(g))throw new i(`expected array but got ${g}`,x);return f(g.length,h,"array length",x,!$e(p.meta.default)),[g.map((P,R)=>v(g,R,p,x))]}),s.extend("dict",(g,{inner:p,sKey:h},x,P)=>{if(!Tr(g))throw new i(`expected object but got ${g}`,x);const R={};for(const W in g){let X;try{X=s.resolve(W,h,x)[0]}catch(Ce){if(P)continue;throw Ce}R[X]=v(g,W,p,x),g[X]=g[W],W!==X&&delete g[W]}return[R]}),s.extend("tuple",(g,{list:p},h,x)=>{if(!Array.isArray(g))throw new i(`expected array but got ${g}`,h);const P=p.map((R,W)=>v(g,W,R,h));return x?[P]:(P.push(...g.slice(p.length)),[P])});function A(g,p){for(const h in p)h in g||(g[h]=p[h])}ue(A,"merge"),s.extend("object",(g,{dict:p},h,x)=>{if(!Tr(g))throw new i(`expected object but got ${g}`,h);const P={};for(const R in p){const W=v(g,R,p[R],h);(!$e(W)||R in g)&&(P[R]=W)}return x||A(P,g),[P]}),s.extend("union",(g,{list:p,toString:h},x,P)=>{for(const R of p)try{return s.resolve(g,R,x,P)}catch{}throw new i(`expected ${h()} but got ${JSON.stringify(g)}`,x)}),s.extend("intersect",(g,{list:p,toString:h},x,P)=>{let R;for(const W of p){const X=s.resolve(g,W,x,!0)[0];if(!$e(X))if($e(R))R=X;else{if(typeof R!=typeof X)throw new i(`expected ${h()} but got ${JSON.stringify(g)}`,x);if(typeof X=="object")A(R??(R={}),X);else if(R!==X)throw new i(`expected ${h()} but got ${JSON.stringify(g)}`,x)}}return!P&&Tr(g)&&A(R,g),[R]}),s.extend("transform",(g,{inner:p,callback:h,preserve:x},P)=>{const[R,W=g]=s.resolve(g,p,P,!0);return x?[h(R)]:[h(R),h(W)]});var U={};function D(g,p,h){U[g]=h,Object.assign(s,{[g](...x){const P=new s({type:g});return p.forEach((R,W)=>{switch(R){case"sKey":P.sKey=x[W]??s.string();break;case"inner":P.inner=s.from(x[W]);break;case"list":P.list=x[W].map(s.from);break;case"dict":P.dict=At(x[W],s.from);break;case"bits":{P.bits={};for(const X in x[W])typeof x[W][X]=="number"&&(P.bits[X]=x[W][X]);break}case"callback":{const X=P.callback=x[W];X.toJSON||(X.toJSON=()=>X.toString());break}case"constructor":{const X=P.constructor=x[W];typeof X=="function"&&(X.toJSON||(X.toJSON=()=>X.name));break}default:P[R]=x[W]}}),g==="object"||g==="dict"?P.meta.default={}:g==="array"||g==="tuple"?P.meta.default=[]:g==="bitset"&&(P.meta.default=0),P}})}ue(D,"defineMethod"),D("is",["constructor"],({constructor:g})=>typeof g=="function"?g.name:g),D("any",[],()=>"any"),D("never",[],()=>"never"),D("const",["value"],({value:g})=>typeof g=="string"?JSON.stringify(g):g),D("string",[],()=>"string"),D("number",[],()=>"number"),D("boolean",[],()=>"boolean"),D("bitset",["bits"],()=>"bitset"),D("function",[],()=>"function"),D("array",["inner"],({inner:g})=>`${g.toString(!0)}[]`),D("dict",["inner","sKey"],({inner:g,sKey:p})=>`{ [key: ${p.toString()}]: ${g.toString()} }`),D("tuple",["list"],({list:g})=>`[${g.map(p=>p.toString()).join(", ")}]`),D("object",["dict"],({dict:g})=>Object.keys(g).length===0?"{}":`{ ${Object.entries(g).map(([p,h])=>`${p}${h.meta.required?"":"?"}: ${h.toString()}`).join(", ")} }`),D("union",["list"],({list:g},p)=>{const h=g.map(({toString:x})=>x()).join(" | ");return p?`(${h})`:h}),D("intersect",["list"],({list:g})=>`${g.map(p=>p.toString(!0)).join(" & ")}`),D("transform",["inner","callback","preserve"],({inner:g},p)=>g.toString(p)),e.exports=s}});const xe=Bf();/**
|
|
3
|
+
`),e.emit(e,"internal/warning",r)}get(e){if(this.ctx[Y.internal][e]?.type!=="service")return;const r=this.ctx[Y.isolate][e],i=this.ctx[Y.store][r]?.value;return wt(this.ctx,i)}set(e,n){this.provide(e);const r=this.ctx[Y.isolate][e],i=this.ctx[Y.store][r]?.value;n??(n=void 0);let s=ie(()=>{},"dispose");if(i===n)return s;if(!$e(n)&&!$e(i))throw new Error(`service ${e} has been registered`);const o=this.ctx;$e(n)||(s=o.effect(()=>()=>{o.set(e,void 0)})),ia(n)&&o.emit(o,"internal/warning",new Error(`service ${e} is an unproxyable object, which may lead to unexpected behavior`));const a=Object.create(o);return a[Y.filter]=l=>o[Y.isolate][e]===l[Y.isolate][e],o.emit(a,"internal/before-service",e,n),o[Y.store][r]={value:n,source:o},o.emit(a,"internal/service",e,i),s}provide(e,n,r){const i=this.ctx.root[Y.internal];if(e in i)return;const s=Symbol(e);i[e]={type:"service",builtin:r},this.ctx.root[Y.isolate][e]=s,ts(n)&&(this.ctx[Y.store][s]={value:n,source:null},He(n,Y.tracker,{associate:e,property:"ctx"}))}_accessor(e,n){const r=this.ctx.root[Y.internal];return e in r?()=>{}:(r[e]={type:"accessor",...n},()=>delete this.ctx.root[Y.isolate][e])}accessor(e,n){this.ctx.scope.effect(()=>this._accessor(e,n))}alias(e,n){const r=this.ctx.root[Y.internal];if(!(e in r))for(const i of n)r[i]||(r[i]={type:"alias",name:e})}_mixin(e,n){const r=Array.isArray(n)?n.map(o=>[o,o]):Object.entries(n),i=typeof e=="string"?o=>o[e]:()=>e,s=r.map(([o,a])=>this._accessor(a,{get(l){const u=i(this);if($e(u))return u;const c=l?Yn(l,u):u,f=Reflect.get(u,o,c);return typeof f!="function"?f:f.bind(c??u)},set(l,u){const c=i(this),f=u?Yn(u,c):c;return Reflect.set(c,o,l,f)}}));return()=>s.forEach(o=>o())}mixin(e,n){this.ctx.scope.effect(()=>this._mixin(e,n))}trace(e){return wt(this.ctx,e)}bind(e){return new Proxy(e,{apply:ie((n,r,i)=>n.apply(this.trace(r),i.map(s=>this.trace(s))),"apply")})}},ie(pt,"ReflectService"),te(pt,"handler",{get:ie((e,n,r)=>{if(typeof n!="string")return Reflect.get(e,n,r);if(Reflect.has(e,n))return wt(r,Reflect.get(e,n,r),!0);const[i,s]=pt.resolveInject(e,n),o=new Error(`property ${i} is not registered, declare it as \`inject\` to suppress this warning`);return s?s.type==="accessor"?s.get.call(r,r[Y.receiver]):(s.builtin||pt.checkInject(r,i,o),r.reflect.get(i)):(pt.checkInject(r,i,o),Reflect.get(e,i,r))},"get"),set:ie((e,n,r,i)=>{if(typeof n!="string")return Reflect.set(e,n,r,i);const[s,o]=pt.resolveInject(e,n);return o?o.type==="accessor"?o.set?o.set.call(i,r,i[Y.receiver]):!1:(i.reflect.set(s,r),!0):Reflect.set(e,s,r,i)},"set"),has:ie((e,n)=>{if(typeof n!="string")return Reflect.has(e,n);if(Reflect.has(e,n))return!0;const[,r]=pt.resolveInject(e,n);return!!r},"has")}),pt),ss=Nf;function os(t){return t!==null&&t!==!1&&t!==void 0}ie(os,"isBailed");var Df=(Dn=class{constructor(e){te(this,"isActive",!1);te(this,"_tasks",new Set);te(this,"_hooks",{});this.ctx=e,He(this,Y.tracker,{associate:"lifecycle",property:"ctx"}),He(this.on("internal/listener",function(r,i,s){const o=s.prepend?"unshift":"push";if(r==="ready")return this.lifecycle.isActive?(this.scope.ensure(async()=>i()),()=>!1):void 0;if(r==="dispose")return this.scope.disposables[o](i),He(i,"name","event <dispose>"),()=>qt(this.scope.disposables,i);if(r==="fork")return this.scope.runtime.forkables[o](i),this.scope.collect("event <fork>",()=>qt(this.scope.runtime.forkables,i))}),Je.static,e.scope);for(const r of["info","error","warning"])He(this.on(`internal/${r}`,(i,...s)=>{this._hooks[`internal/${r}`].length>1}),Je.static,e.scope);He(this.on("internal/before-service",function(r){for(const i of this.registry.values()){if(!i.inject[r]?.required)continue;const s=i.isReusable?i.children:[i];for(const o of s)this[Y.filter](o.ctx)&&(o.updateStatus(),o.reset())}},{global:!0}),Je.static,e.scope),He(this.on("internal/service",function(r){for(const i of this.registry.values()){if(!i.inject[r]?.required)continue;const s=i.isReusable?i.children:[i];for(const o of s)this[Y.filter](o.ctx)&&o.start()}},{global:!0}),Je.static,e.scope);const n=ie((r,i)=>{if(!r.runtime.plugin)return!1;for(const s in r.runtime.inject)if(i===ss.resolveInject(r.ctx,s)[0])return!0;return n(r.parent.scope,i)},"checkInject");He(this.on("internal/inject",function(r){return n(this.scope,r)},{global:!0}),Je.static,e.scope)}async flush(){for(;this._tasks.size;)await Promise.all(Array.from(this._tasks))}filterHooks(e,n){return n=wt(this.ctx,n),e.slice().filter(r=>{const i=n?.[Je.filter];return r.global||!i||i.call(n,r.ctx)})}*dispatch(e,n){const r=typeof n[0]=="object"||typeof n[0]=="function"?n.shift():null,i=n.shift();i!=="internal/event"&&this.emit("internal/event",e,i,n,r);for(const s of this.filterHooks(this._hooks[i]||[],r))yield s.callback.apply(r,n)}async parallel(...e){await Promise.all(this.dispatch("emit",e))}emit(...e){Array.from(this.dispatch("emit",e))}async serial(...e){for await(const n of this.dispatch("serial",e))if(os(n))return n}bail(...e){for(const n of this.dispatch("bail",e))if(os(n))return n}register(e,n,r,i){const s=i.prepend?"unshift":"push";return n[s]({ctx:this.ctx,callback:r,...i}),this.ctx.state.collect(e,()=>this.unregister(n,r))}unregister(e,n){const r=e.findIndex(i=>i.callback===n);if(r>=0)return e.splice(r,1),!0}on(e,n,r){var a;typeof r!="object"&&(r={prepend:r}),this.ctx.scope.assertActive(),n=this.ctx.reflect.bind(n);const i=this.bail(this.ctx,"internal/listener",e,n,r);if(i)return i;const s=(a=this._hooks)[e]||(a[e]=[]),o=typeof e=="string"?`event <${e}>`:"event (Symbol)";return this.register(o,s,n,r)}once(e,n,r){const i=this.on(e,function(...s){return i(),n.apply(this,s)},r);return i}async start(){this.isActive=!0;const e=this._hooks.ready||[];for(;e.length;){const{ctx:n,callback:r}=e.shift();n.scope.ensure(async()=>r())}await this.flush()}async stop(){this.isActive=!1,this.ctx.scope.reset()}},ie(Dn,"Lifecycle"),Dn),Lf=Df,as=(pn=class extends Error{constructor(e,n){super(n??pn.Code[e]),this.code=e}},ie(pn,"CordisError"),pn);(t=>{t.Code={INACTIVE_EFFECT:"cannot create effect on inactive context"}})(as||(as={}));var oa=(Ln=class{constructor(e,n){te(this,"uid");te(this,"ctx");te(this,"disposables",[]);te(this,"error");te(this,"status",0);te(this,"isActive",!1);te(this,"context");te(this,"proxy");te(this,"acceptors",[]);te(this,"tasks",new Set);te(this,"hasError",!1);this.parent=e,this.config=n,this.uid=e.registry?e.registry.counter:0,this.ctx=this.context=e.extend({scope:this}),this.proxy=new Proxy({},{get:ie((r,i)=>Reflect.get(this.config,i),"get")})}get _config(){return this.runtime.isReactive?this.proxy:this.config}assertActive(){if(!(this.uid!==null||this.isActive))throw new as("INACTIVE_EFFECT")}effect(e,n){this.assertActive();const r=Zi(e)?new e(this.ctx,n):e(this.ctx,n);let i=!1;const s=typeof r=="function"?r:r.dispose.bind(r),o=ie((...a)=>{if(!i)return i=!0,qt(this.disposables,o),s(...a)},"wrapped");return this.disposables.push(o),typeof r=="function"?o:(r.dispose=o,r)}collect(e,n){const r=He(()=>(qt(this.disposables,r),n()),"name",e);return this.disposables.push(r),r}restart(){this.reset(),this.error=null,this.hasError=!1,this.status=0,this.start()}_getStatus(){return this.uid===null?4:this.hasError?3:this.tasks.size?1:this.ready?2:0}updateStatus(e){const n=this.status;e?.(),this.status=this._getStatus(),n!==this.status&&this.context.emit("internal/status",this,n)}ensure(e){const n=e().catch(r=>{this.context.emit(this.ctx,"internal/error",r),this.cancel(r)}).finally(()=>{this.updateStatus(()=>this.tasks.delete(n)),this.context.events._tasks.delete(n)});this.updateStatus(()=>this.tasks.add(n)),this.context.events._tasks.add(n)}cancel(e){this.error=e,this.updateStatus(()=>this.hasError=!0),this.reset()}get ready(){return Object.entries(this.runtime.inject).every(([e,n])=>!n.required||!$e(this.ctx.get(e)))}reset(){this.isActive=!1,this.disposables=this.disposables.splice(0).filter(e=>{if(this.uid!==null&&e[Je.static]===this)return!0;(async()=>e())().catch(n=>{this.context.emit(this.ctx,"internal/error",n)})})}init(e){this.config?this.start():this.cancel(e)}start(){if(!this.ready||this.isActive||this.uid===null)return!0;this.isActive=!0,this.updateStatus(()=>this.hasError=!1)}accept(...e){const r={keys:Array.isArray(e[0])?e.shift():null,callback:e[0],...e[1]};return this.effect(()=>(this.acceptors.push(r),r.immediate&&r.callback?.(this.config),()=>qt(this.acceptors,r)))}decline(e){return this.accept(e,()=>!0)}checkUpdate(e,n){if(n||!this.config)return[!0,!0];if(n===!1)return[!1,!1];const r=Object.create(null),i=ie(u=>{const c=r[u]??(r[u]=!nn(this.config[u],e[u]));return o||(o=c),c},"checkPropertyUpdate"),s=new Set;let o=!1,a=!1,l=this.runtime.isReactive||null;for(const{keys:u,callback:c,passive:f}of this.acceptors){if(!u)l||(l=!f);else if(f)u?.forEach(y=>s.add(y));else{let y=!1;for(const v of u)y||(y=i(v));if(!y)continue}c?.(e)&&(a=!0)}for(const u in{...this.config,...e})if(l!==!1&&!(u in r)&&!s.has(u)){const c=i(u);l===null&&(a||(a=c))}return[o,a]}},ie(Ln,"EffectScope"),Ln),jf=(jn=class extends oa{constructor(n,r,i,s){super(n,i);te(this,"dispose");this.runtime=r,this.dispose=He(n.scope.collect(`fork <${n.runtime.name}>`,()=>{this.uid=null,this.reset(),this.context.emit("internal/fork",this);const o=qt(r.disposables,this.dispose);return qt(r.children,this)&&!r.children.length&&n.registry.delete(r.plugin),o}),Je.static,r),r.children.push(this),r.disposables.push(this.dispose),this.context.emit("internal/fork",this),this.init(s)}start(){if(super.start())return!0;for(const n of this.runtime.forkables)this.ensure(async()=>n(this.context,this._config))}update(n,r){const i=this.config,s=this.runtime.isForkable?this:this.runtime;if(s.config!==i)return;let o;try{o=Kn(this.runtime.plugin,n)}catch(u){return this.context.emit("internal/error",u),this.cancel(u)}const[a,l]=s.checkUpdate(o,r);this.context.emit("internal/before-update",this,n),this.config=o,s.config=o,a&&this.context.emit("internal/update",this,i),l&&s.restart()}},ie(jn,"ForkScope"),jn),aa=(Mn=class extends oa{constructor(n,r,i,s){super(n,i);te(this,"value");te(this,"runtime",this);te(this,"schema");te(this,"name");te(this,"inject",Object.create(null));te(this,"forkables",[]);te(this,"children",[]);te(this,"isReusable",!1);te(this,"isReactive",!1);te(this,"apply",ie((n,r)=>{if(typeof this.plugin!="function")return this.plugin.apply(n,r);if(Zi(this.plugin)){const i=new this.plugin(n,r),s=i[Je.expose];return s&&n.set(s,i),i.fork&&this.forkables.push(i.fork.bind(i)),i}else return this.plugin(n,r)},"apply"));this.plugin=r,r?(this.setup(),this.init(s)):(this.name="root",this.isActive=!0)}get isForkable(){return this.forkables.length>0}fork(n,r,i){return new jf(n,this,r,i)}dispose(){return this.uid=null,this.reset(),this.context.emit("internal/runtime",this),!0}setup(){const{name:n}=this.plugin;n&&n!=="apply"&&(this.name=n),this.schema=this.plugin.Config||this.plugin.schema,this.inject=Ge.resolve(this.plugin.using||this.plugin.inject),this.isReusable=this.plugin.reusable,this.isReactive=this.plugin.reactive,this.context.emit("internal/runtime",this),this.isReusable&&this.forkables.push(this.apply)}reset(){super.reset();for(const n of this.children)n.reset()}start(){if(super.start())return!0;!this.isReusable&&this.plugin&&this.ensure(async()=>this.value=this.apply(this.ctx,this._config));for(const n of this.children)n.start()}update(n,r){if(this.isForkable){const u=new Error(`attempting to update forkable plugin "${this.plugin.name}", which may lead to unexpected behavior`);this.context.emit(this.ctx,"internal/warning",u)}const i=this.config;let s;try{s=Kn(this.runtime.plugin||this.context.constructor,n)}catch(u){return this.context.emit("internal/error",u),this.cancel(u)}const[o,a]=this.checkUpdate(s,r),l=this.children.find(u=>u.config===i);this.config=s,l&&(this.context.emit("internal/before-update",l,n),l.config=s,o&&this.context.emit("internal/update",l,i)),a&&this.restart()}},ie(Mn,"MainScope"),Mn);function la(t){return t&&typeof t=="object"&&typeof t.apply=="function"}ie(la,"isApplicable");function Ge(t){return function(e,n){if(n.kind==="class")e.inject=t;else if(n.kind==="method")n.addInitializer(function(){const r=this[Y.tracker]?.property;if(!r)throw new Error("missing context tracker");this[r].inject(t,i=>{e.call(Yn(this,{[r]:i}))})});else throw new Error("@Inject can only be used on class or class methods")}}ie(Ge,"Inject"),(t=>{function e(n){if(!n)return{};if(Array.isArray(n))return Object.fromEntries(n.map(o=>[o,{required:!0}]));const{required:r,optional:i,...s}=n;return Array.isArray(r)&&Object.assign(s,Object.fromEntries(r.map(o=>[o,{required:!0}]))),Array.isArray(i)&&Object.assign(s,Object.fromEntries(i.map(o=>[o,{required:!1}]))),s}t.resolve=e,ie(e,"resolve")})(Ge||(Ge={}));var Mf=(Fn=class{constructor(e,n){te(this,"_counter",0);te(this,"_internal",new Map);te(this,"context");this.ctx=e,He(this,Y.tracker,{associate:"registry",property:"ctx"}),this.context=e;const r=new aa(e,null,n);e.scope=r,r.ctx=e,this.set(null,r)}get counter(){return++this._counter}get size(){return this._internal.size}resolve(e,n=!1){if(e===null||typeof e=="function")return e;if(la(e))return e.apply;if(n)throw new Error('invalid plugin, expect function or object with an "apply" method, received '+typeof e)}get(e){const n=this.resolve(e);return n&&this._internal.get(n)}has(e){const n=this.resolve(e);return!!n&&this._internal.has(n)}set(e,n){const r=this.resolve(e);this._internal.set(r,n)}delete(e){const n=this.resolve(e),r=n&&this._internal.get(n);if(r)return this._internal.delete(n),r.dispose(),r}keys(){return this._internal.keys()}values(){return this._internal.values()}entries(){return this._internal.entries()}forEach(e){return this._internal.forEach(e)}using(e,n){return this.inject(e,n)}inject(e,n){return this.plugin({inject:e,apply:n,name:n.name})}plugin(e,n,r){if(this.resolve(e,!0),this.ctx.scope.assertActive(),!r)try{n=Kn(e,n)}catch(s){this.context.emit(this.ctx,"internal/error",s),r=s,n=null}let i=this.get(e);return i?(i.isForkable||this.context.emit(this.ctx,"internal/warning",new Error(`duplicate plugin detected: ${e.name}`)),i.fork(this.ctx,n,r)):(i=new aa(this.ctx,e,n,r),this.set(e,i),i.fork(this.ctx,n,r))}},ie(Fn,"Registry"),Fn),Ff=Mf,Je=(Pe=class{static is(e){return!!e?.[Pe.is]}static associate(e,n){return e}constructor(e){e=Kn(this.constructor,e),this[Y.store]=Object.create(null),this[Y.isolate]=Object.create(null),this[Y.internal]=Object.create(null),this[Y.intercept]=Object.create(null);const n=new Proxy(this,ss.handler);n.root=n,n.reflect=new ss(n),n.registry=new Ff(n,e),n.lifecycle=new Lf(n);const r=ie(i=>{if(i){r(Object.getPrototypeOf(i));for(const s of Object.getOwnPropertyNames(i)){const o=i[s].prototype?.constructor;o&&(n[i[s].key]=new o(n,e),He(n[i[s].key],"ctx",n))}}},"attach");return r(this[Y.internal]),n}[Symbol.for("nodejs.util.inspect.custom")](){return`Context <${this.name}>`}get name(){let e=this.runtime;for(;e&&!e.name;)e=e.parent.runtime;return e?.name}get events(){return this.lifecycle}get state(){return this.scope}extend(e={}){const n=Reflect.getOwnPropertyDescriptor(this,Y.shadow)?.value,r=Object.assign(Object.create(wt(this,this)),e);return n?Object.assign(Object.create(r),{[Y.shadow]:n}):r}isolate(e,n){const r=Object.create(this[Y.isolate]);return r[e]=n??Symbol(e),this.extend({[Y.isolate]:r})}intercept(e,n){const r=Object.create(this[Y.intercept]);return r[e]=n,this.extend({[Y.intercept]:r})}},ie(Pe,"Context"),te(Pe,"store",Y.store),te(Pe,"events",Y.events),te(Pe,"static",Y.static),te(Pe,"filter",Y.filter),te(Pe,"expose",Y.expose),te(Pe,"isolate",Y.isolate),te(Pe,"internal",Y.internal),te(Pe,"intercept",Y.intercept),te(Pe,"origin","ctx"),te(Pe,"current","ctx"),Pe.is[Symbol.toPrimitive]=()=>Symbol.for("cordis.is"),Pe.prototype[Pe.is]=!0,Pe);Je.prototype[Je.internal]=Object.create(null);var vn=(ot=class{constructor(...e){te(this,"ctx");te(this,"name");te(this,"config");let n,r,i,s;Je.is(e[0])?(n=e[0],typeof e[1]=="string"?(r=e[1],i=e[2]):s=e[1]):s=e[0],r??(r=this.constructor[Y.provide]),i??(i=this.constructor[Y.immediate]);let o=this;const a={associate:r,property:"ctx"};return o[Y.invoke]&&(o=is(r,es(Object.getPrototypeOf(this),Function.prototype),a)),n?o.ctx=n:o[Y.setup](),o.name=r,o.config=s,He(o,Y.tracker,a),o.ctx.provide(r),o.ctx.runtime.name=r,i&&(n?o[Y.expose]=r:o.ctx.set(r,o)),o.ctx.on("ready",async()=>{await Promise.resolve(),await o.start(),i||o.ctx.set(r,o)}),o.ctx.on("dispose",()=>o.stop()),o}start(){}stop(){}[Y.filter](e){return e[Y.isolate][this.name]===this.ctx[Y.isolate][this.name]}[Y.setup](){this.ctx=new Je}[Y.extend](e){let n;return this[ot.invoke]?n=is(this.name,this,this[Y.tracker]):n=Object.create(this),Object.assign(n,e)}static[Symbol.hasInstance](e){let n=e.constructor;for(;n;){if(n=n.prototype?.constructor,n===this)return!0;n=Object.getPrototypeOf(n)}return!1}},ie(ot,"Service"),te(ot,"setup",Y.setup),te(ot,"invoke",Y.invoke),te(ot,"extend",Y.extend),te(ot,"tracker",Y.tracker),te(ot,"provide",Y.provide),te(ot,"immediate",Y.immediate),ot),Bf=Object.defineProperty,Uf=Object.getOwnPropertyNames,ue=(t,e)=>Bf(t,"name",{value:e,configurable:!0}),Hf=(t,e)=>function(){return e||(0,t[Uf(t)[0]])((e={exports:{}}).exports,e),e.exports},qf=Hf({"src/index.ts"(t,e){var I;var n=Symbol.for("schemastery"),r=Symbol.for("ValidationError");globalThis.__schemastery_index__??(globalThis.__schemastery_index__=0);var i=(I=class extends TypeError{constructor(h,x){let P="$";for(const R of x.path||[])typeof R=="string"?P+="."+R:typeof R=="number"?P+="["+R+"]":typeof R=="symbol"&&(P+=`[Symbol(${R.toString()})]`);P.startsWith(".")&&(P=P.slice(1));super((P==="$"?"":`${P} `)+h);te(this,"name","ValidationError");this.options=x}static is(h){return!!h?.[r]}},ue(I,"ValidationError"),I);Object.defineProperty(i.prototype,r,{value:!0});var s=ue(function(g){const p=ue(function(h,x={}){return s.resolve(h,p,x)[0]},"schema");if(g.refs){const h=It(g.refs,P=>new s(P)),x=ue(P=>h[P],"getRef");for(const P in h){const R=h[P];R.sKey=x(R.sKey),R.inner=x(R.inner),R.list=R.list&&R.list.map(x),R.dict=R.dict&&It(R.dict,x)}return h[g.uid]}if(Object.assign(p,g),typeof p.callback=="string")try{p.callback=new Function("return "+p.callback)()}catch{}return Object.defineProperty(p,"uid",{value:globalThis.__schemastery_index__++}),Object.setPrototypeOf(p,s.prototype),p.meta||(p.meta={}),p.toString=p.toString.bind(p),p},"Schema");s.prototype=Object.create(Function.prototype),s.prototype[n]=!0,s.ValidationError=i;var o;s.prototype.toJSON=ue(function(){var h;if(o)return o[h=this.uid]??(o[h]=JSON.parse(JSON.stringify({...this}))),this.uid;o={[this.uid]:{...this}},o[this.uid]=JSON.parse(JSON.stringify({...this}));const p={uid:this.uid,refs:o};return o=void 0,p},"toJSON"),s.prototype.set=ue(function(p,h){return this.dict[p]=h,this},"set"),s.prototype.push=ue(function(p){return this.list.push(p),this},"push");function a(g,p){const h=typeof g=="string"?{"":g}:{...g};for(const x in p){const P=p[x];P?.$description||P?.$desc?h[x]=P.$description||P.$desc:typeof P=="string"&&(h[x]=P)}return h}ue(a,"mergeDesc");function l(g){return g?.$value??g?.$inner}ue(l,"getInner");function u(g){return Xo(g??{},p=>!p.startsWith("$"))}ue(u,"extractKeys"),s.prototype.i18n=ue(function(p){const h=s(this),x=a(h.meta.description,p);return Object.keys(x).length&&(h.meta.description=x),h.dict&&(h.dict=It(h.dict,(P,R)=>P.i18n(It(p,W=>l(W)?.[R]??W?.[R])))),h.list&&(h.list=h.list.map((P,R)=>P.i18n(It(p,(W={})=>Array.isArray(l(W))?l(W)[R]:Array.isArray(W)?W[R]:u(W))))),h.inner&&(h.inner=h.inner.i18n(It(p,P=>l(P)?l(P):u(P)))),h.sKey&&(h.sKey=h.sKey.i18n(It(p,P=>P?.$key))),h},"i18n"),s.prototype.extra=ue(function(p,h){const x=s(this);return x.meta={...x.meta,[p]:h},x},"extra");for(const g of["required","disabled","collapse","hidden","loose"])Object.assign(s.prototype,{[g](p=!0){const h=s(this);return h.meta={...h.meta,[g]:p},h}});s.prototype.deprecated=ue(function(){var h;const p=s(this);return(h=p.meta).badges||(h.badges=[]),p.meta.badges.push({text:"deprecated",type:"danger"}),p},"deprecated"),s.prototype.experimental=ue(function(){var h;const p=s(this);return(h=p.meta).badges||(h.badges=[]),p.meta.badges.push({text:"experimental",type:"warning"}),p},"experimental"),s.prototype.pattern=ue(function(p){const h=s(this),x=Zo(p,["source","flags"]);return h.meta={...h.meta,pattern:x},h},"pattern"),s.prototype.simplify=ue(function(p){if(nn(p,this.meta.default,this.type==="dict"))return null;if($e(p))return p;if(this.type==="object"||this.type==="dict"){const h={};for(const x in p){const R=(this.type==="object"?this.dict[x]:this.inner)?.simplify(p[x]);(this.type==="dict"||!$e(R))&&(h[x]=R)}return nn(h,this.meta.default,this.type==="dict")?null:h}else if(this.type==="array"||this.type==="tuple"){const h=[];return p.forEach((x,P)=>{const R=this.type==="array"?this.inner:this.list[P],W=R?R.simplify(x):x;h.push(W)}),h}else if(this.type==="intersect"){const h={};for(const x of this.list)Object.assign(h,x.simplify(p));return h}else if(this.type==="union")for(const h of this.list)try{return s.resolve(p,h,{}),h.simplify(p)}catch{}return p},"simplify"),s.prototype.toString=ue(function(p){return U[this.type]?.(this,p)??`Schema<${this.type}>`},"toString"),s.prototype.role=ue(function(g,p){const h=s(this);return h.meta={...h.meta,role:g,extra:p},h},"role");for(const g of["default","link","comment","description","max","min","step"])Object.assign(s.prototype,{[g](p){const h=s(this);return h.meta={...h.meta,[g]:p},h}});var c={};s.extend=ue(function(p,h){c[p]=h},"extend"),s.resolve=ue(function(p,h,x={},P=!1){if(!h)return[p];if(x.ignore?.(p,h))return[p];if($e(p)&&h.type!=="lazy"){if(h.meta.required)throw new i("missing required value",x);let W=h,X=h.meta.default;for(;W?.type==="intersect"&&$e(X);)W=W.list[0],X=W?.meta.default;if($e(X))return[p];p=Nr(X)}const R=c[h.type];if(!R)throw new i(`unsupported type "${h.type}"`,x);try{return R(p,h,x,P)}catch(W){if(!h.meta.loose)throw W;return[h.meta.default]}},"resolve"),s.from=ue(function(p){if($e(p))return s.any();if(["string","number","boolean"].includes(typeof p))return s.const(p).required();if(p[n])return p;if(typeof p=="function")switch(p){case String:return s.string().required();case Number:return s.number().required();case Boolean:return s.boolean().required();case Function:return s.function().required();default:return s.is(p).required()}else throw new TypeError(`cannot infer schema from ${p}`)},"from"),s.lazy=ue(function(p){const h=ue(()=>(x.inner[n]||(x.inner=x.builder(),x.inner.meta={...x.meta,...x.inner.meta}),x.inner.toJSON()),"toJSON"),x=new s({type:"lazy",builder:p,inner:{toJSON:h}});return x},"lazy"),s.natural=ue(function(){return s.number().step(1).min(0)},"natural"),s.percent=ue(function(){return s.number().step(.01).min(0).max(1).role("slider")},"percent"),s.date=ue(function(){return s.union([s.is(Date),s.transform(s.string().role("datetime"),(p,h)=>{const x=new Date(p);if(isNaN(+x))throw new i(`invalid date "${p}"`,h);return x},!0)])},"date"),s.regExp=ue(function(p=""){return s.union([s.is(RegExp),s.transform(s.string().role("regexp",{flag:p}),(h,x)=>{try{return new RegExp(h,p)}catch(P){throw new i(P.message,x)}},!0)])},"regExp"),s.arrayBuffer=ue(function(p){return s.union([s.is(ArrayBuffer),s.is(SharedArrayBuffer),s.transform(s.any(),(h,x)=>{if(_t.isSource(h))return _t.fromSource(h);throw new i(`expected ArrayBufferSource but got ${h}`,x)},!0),...p?[s.transform(s.string(),(h,x)=>{try{return p==="base64"?_t.fromBase64(h):_t.fromHex(h)}catch(P){throw new i(P.message,x)}},!0)]:[]])},"arrayBuffer"),s.extend("lazy",(g,p,h,x)=>(p.inner[n]||(p.inner=p.builder(),p.inner.meta={...p.meta,...p.inner.meta}),s.resolve(g,p.inner,h,x))),s.extend("any",g=>[g]),s.extend("never",(g,p,h)=>{throw new i(`expected nullable but got ${g}`,h)}),s.extend("const",(g,{value:p},h)=>{if(nn(g,p))return[p];throw new i(`expected ${p} but got ${g}`,h)});function f(g,p,h,x,P=!1){const{max:R=1/0,min:W=-1/0}=p;if(g>R)throw new i(`expected ${h} <= ${R} but got ${g}`,x);if(g<W&&!P)throw new i(`expected ${h} >= ${W} but got ${g}`,x)}ue(f,"checkWithinRange"),s.extend("string",(g,{meta:p},h)=>{if(typeof g!="string")throw new i(`expected string but got ${g}`,h);if(p.pattern){const x=new RegExp(p.pattern.source,p.pattern.flags);if(!x.test(g))throw new i(`expect string to match regexp ${x}`,h)}return f(g.length,p,"string length",h),[g]});function b(g,p){const h=g.toString();if(h.includes("e"))return g*Math.pow(10,p);const x=h.indexOf(".");if(x===-1)return g*Math.pow(10,p);const P=h.slice(x+1),R=h.slice(0,x);return P.length<=p?+(R+P.padEnd(p,"0")):+(R+P.slice(0,p)+"."+P.slice(p))}ue(b,"decimalShift");function y(g,p,h){if(h=Math.abs(h),!/^\d+\.\d+$/.test(h.toString()))return(g-p)%h===0;const x=h.toString().indexOf("."),P=h.toString().slice(x+1).length;return Math.abs(b(g,P)-b(p,P))%b(h,P)===0}ue(y,"isMultipleOf"),s.extend("number",(g,{meta:p},h)=>{if(typeof g!="number")throw new i(`expected number but got ${g}`,h);f(g,p,"number",h);const{step:x}=p;if(x&&!y(g,p.min??0,x))throw new i(`expected number multiple of ${x} but got ${g}`,h);return[g]}),s.extend("boolean",(g,p,h)=>{if(typeof g=="boolean")return[g];throw new i(`expected boolean but got ${g}`,h)}),s.extend("bitset",(g,{bits:p,meta:h},x)=>{let P=0,R=[];if(typeof g=="number"){P=g;for(const W in p)g&p[W]&&R.push(W)}else if(Array.isArray(g)){R=g;for(const W of R){if(typeof W!="string")throw new i(`expected string but got ${W}`,x);W in p&&(P|=p[W])}}else throw new i(`expected number or array but got ${g}`,x);return P===h.default?[P]:[P,R]}),s.extend("function",(g,p,h)=>{if(typeof g=="function")return[g];throw new i(`expected function but got ${g}`,h)}),s.extend("is",(g,{constructor:p},h)=>{if(typeof p=="function"){if(g instanceof p)return[g];throw new i(`expected ${p.name} but got ${g}`,h)}else{if($e(g))throw new i(`expected ${p} but got ${g}`,h);let x=Object.getPrototypeOf(g);for(;x;){if(x.constructor?.name===p)return[g];x=Object.getPrototypeOf(x)}throw new i(`expected ${p} but got ${g}`,h)}});function v(g,p,h,x){try{const[P,R]=s.resolve(g[p],h,{...x,path:[...x.path||[],p]});return R!==void 0&&(g[p]=R),P}catch(P){if(!x?.autofix)throw P;return delete g[p],h.meta.default}}ue(v,"property"),s.extend("array",(g,{inner:p,meta:h},x)=>{if(!Array.isArray(g))throw new i(`expected array but got ${g}`,x);return f(g.length,h,"array length",x,!$e(p.meta.default)),[g.map((P,R)=>v(g,R,p,x))]}),s.extend("dict",(g,{inner:p,sKey:h},x,P)=>{if(!Rr(g))throw new i(`expected object but got ${g}`,x);const R={};for(const W in g){let X;try{X=s.resolve(W,h,x)[0]}catch(Ce){if(P)continue;throw Ce}R[X]=v(g,W,p,x),g[X]=g[W],W!==X&&delete g[W]}return[R]}),s.extend("tuple",(g,{list:p},h,x)=>{if(!Array.isArray(g))throw new i(`expected array but got ${g}`,h);const P=p.map((R,W)=>v(g,W,R,h));return x?[P]:(P.push(...g.slice(p.length)),[P])});function A(g,p){for(const h in p)h in g||(g[h]=p[h])}ue(A,"merge"),s.extend("object",(g,{dict:p},h,x)=>{if(!Rr(g))throw new i(`expected object but got ${g}`,h);const P={};for(const R in p){const W=v(g,R,p[R],h);(!$e(W)||R in g)&&(P[R]=W)}return x||A(P,g),[P]}),s.extend("union",(g,{list:p,toString:h},x,P)=>{for(const R of p)try{return s.resolve(g,R,x,P)}catch{}throw new i(`expected ${h()} but got ${JSON.stringify(g)}`,x)}),s.extend("intersect",(g,{list:p,toString:h},x,P)=>{if(!p.length)return[g];let R;for(const W of p){const X=s.resolve(g,W,x,!0)[0];if(!$e(X))if($e(R))R=X;else{if(typeof R!=typeof X)throw new i(`expected ${h()} but got ${JSON.stringify(g)}`,x);if(typeof X=="object")A(R??(R={}),X);else if(R!==X)throw new i(`expected ${h()} but got ${JSON.stringify(g)}`,x)}}return!P&&Rr(g)&&A(R,g),[R]}),s.extend("transform",(g,{inner:p,callback:h,preserve:x},P)=>{const[R,W=g]=s.resolve(g,p,P,!0);return x?[h(R)]:[h(R),h(W)]});var U={};function D(g,p,h){U[g]=h,Object.assign(s,{[g](...x){const P=new s({type:g});return p.forEach((R,W)=>{switch(R){case"sKey":P.sKey=x[W]??s.string();break;case"inner":P.inner=s.from(x[W]);break;case"list":P.list=x[W].map(s.from);break;case"dict":P.dict=It(x[W],s.from);break;case"bits":{P.bits={};for(const X in x[W])typeof x[W][X]=="number"&&(P.bits[X]=x[W][X]);break}case"callback":{const X=P.callback=x[W];X.toJSON||(X.toJSON=()=>X.toString());break}case"constructor":{const X=P.constructor=x[W];typeof X=="function"&&(X.toJSON||(X.toJSON=()=>X.name));break}default:P[R]=x[W]}}),g==="object"||g==="dict"?P.meta.default={}:g==="array"||g==="tuple"?P.meta.default=[]:g==="bitset"&&(P.meta.default=0),P}})}ue(D,"defineMethod"),D("is",["constructor"],({constructor:g})=>typeof g=="function"?g.name:g),D("any",[],()=>"any"),D("never",[],()=>"never"),D("const",["value"],({value:g})=>typeof g=="string"?JSON.stringify(g):g),D("string",[],()=>"string"),D("number",[],()=>"number"),D("boolean",[],()=>"boolean"),D("bitset",["bits"],()=>"bitset"),D("function",[],()=>"function"),D("array",["inner"],({inner:g})=>`${g.toString(!0)}[]`),D("dict",["inner","sKey"],({inner:g,sKey:p})=>`{ [key: ${p.toString()}]: ${g.toString()} }`),D("tuple",["list"],({list:g})=>`[${g.map(p=>p.toString()).join(", ")}]`),D("object",["dict"],({dict:g})=>Object.keys(g).length===0?"{}":`{ ${Object.entries(g).map(([p,h])=>`${p}${h.meta.required?"":"?"}: ${h.toString()}`).join(", ")} }`),D("union",["list"],({list:g},p)=>{const h=g.map(({toString:x})=>x()).join(" | ");return p?`(${h})`:h}),D("intersect",["list"],({list:g})=>`${g.map(p=>p.toString(!0)).join(" & ")}`),D("transform",["inner","callback","preserve"],({inner:g},p)=>g.toString(p)),e.exports=s}});const Se=qf();/**
|
|
4
4
|
* @inpageedit/logger
|
|
5
5
|
*
|
|
6
6
|
* Flexible, Extensible Console Logger with Colored Labels and Hierarchical Loggers
|
|
7
7
|
*
|
|
8
8
|
* @author dragon-fish <dragon-fish@qq.com>
|
|
9
9
|
* @license MIT
|
|
10
|
-
*/var
|
|
10
|
+
*/var ls=(t=>(t[t.debug=-1]="debug",t[t.log=0]="log",t[t.info=1]="info",t[t.warn=2]="warn",t[t.error=3]="error",t[t.silent=4]="silent",t))(ls||{});const cs=globalThis||window,us=Symbol.for("__IPE_LOGGER_COLOR_MAP__");cs[us]||(cs[us]=new Map);const fs=cs[us];function jr(t){let e=2166136261;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n),e=(e>>>0)*16777619;return e>>>0}const ca=[[350,360],[0,15],[15,30],[200,230],[230,250],[250,280],[280,310],[310,330],[140,160],[160,180]];function Wf(t,e){const n=ca.length,r=jr(t)%n,[i,s]=ca[r],o=s-i,a=jr(t+":"+e),l=i+a%(o||1),u=jr(t+":s"),c=jr(t+":l");let f,b;if(e==="name")f=62+u%18,b=30+c%12;else{const y=l>=0&&l<50||l>330&&l<360,v=l>=200&&l<=300;f=55+u%20,v?b=55+c%8:y?b=48+c%6:b=50+c%8,f<60&&(f+=5)}return`hsl(${l}, ${f}%, ${b}%)`}function Mr(t,e){if(e)return fs.set(t,e),e;const n=fs.get(t);if(n)return n;const r=t.startsWith("name:")?"name":"group",i=Wf(t,r);return fs.set(t,i),i}/**
|
|
11
11
|
* @inpageedit/logger
|
|
12
12
|
* Flexible, Extensible Console Logger with Colored Labels and Hierarchical Loggers
|
|
13
13
|
*
|
|
@@ -26,30 +26,30 @@
|
|
|
26
26
|
* logger.defineLevel('success', { level: LoggerLevel.info, label: '✅', method: 'info' })
|
|
27
27
|
* logger.success('User created successfully')
|
|
28
28
|
* ```
|
|
29
|
-
*/class Mr{constructor(e={}){this._custom=n=>{if(!this._enabled(n.level))return la;const[r,i]=this._prefix(n.label);return this._consoleMethod(n.method).bind(console,r,...i)},this._name=e.name,this._nameColor=e.color,this._groupPath=e._groupPath?[...e._groupPath]:[],this._dynamicLevels={...e._dynamicLevels},this._levelRef=e._levelRef??{value:e.level??1},this._name&&jr(`name:${this._name}`,this._nameColor),this._installBuiltinLevels();for(const n of Object.keys(this._dynamicLevels))this._installLevelGetter(n,this._dynamicLevels[n]);return qf(this)}get level(){return this._levelRef.value}set level(e){this._levelRef.value=e}group(e,n){return e&&jr(`group:${e}`,n?.color),new Mr({name:this._name,color:this._nameColor,_groupPath:[...this._groupPath,e],_dynamicLevels:this._dynamicLevels,_levelRef:this._levelRef})}defineLevel(e,n){this._dynamicLevels[e]={...n},this._installLevelGetter(e,n)}get debug(){return this._method("debug")}get log(){return this._method("log")}get info(){return this._method("info")}get warn(){return this._method("warn")}get error(){return this._method("error")}_installBuiltinLevels(){}_installLevelGetter(e,n){Object.defineProperty(this,e,{configurable:!0,enumerable:!1,get:()=>this._custom(n)})}_method(e){const n=Hf[e];if(!this._enabled(n.level))return la;const[r,i]=this._prefix(n.label);return this._consoleMethod(e).bind(console,r,...i)}_consoleMethod(e){return(console[e]||console.log).bind(console)}_enabled(e){return e>=this._levelRef.value&&this._levelRef.value!==4}_prefix(e){const n=[];let r="";if(this._name){const i=jr(`name:${this._name}`,this._nameColor);r+=`%c${this._name}%c`,n.push(`background:${i}; color:#fff; padding:1px 4px; border-radius:2px; font-weight:700;`,ca)}if(e&&(r+=` ${e}`),this._groupPath.length){const i=this._groupPath.join("/"),s=jr(`group:${i}`);r+=` %c${i}%c`,n.push(`color:${s}; text-decoration: underline;`,ca)}return[r,n]}}const la=()=>{},ca="color:inherit; background:transparent; text-decoration:none;",Hf={debug:{level:-1,label:"",method:"debug"},log:{level:0,label:"",method:"log"},info:{level:1,label:"[I]",method:"info"},warn:{level:2,label:"[W]",method:"warn"},error:{level:3,label:"[E]",method:"error"}};function qf(t){const e=function(n,r){return t.group(n,r)};return new Proxy(e,{get(n,r,i){return t[r]},set(n,r,i){return t[r]=i,!0},apply(n,r,i){return t.group(i[0],i[1])},has(n,r){return r in t}})}function ua(t){return new Mr(t)}var tt=(t=>(t.BODY_USED="BODY_USED",t.NO_BODY_READER="NO_BODY_READER",t.TIMEOUT="TIMEOUT",t.NETWORK_ERROR="NETWORK_ERROR",t.BODY_NOT_ALLOWED="BODY_NOT_ALLOWED",t.HOOK_CONTEXT_CHANGED="HOOK_CONTEXT_CHANGED",t.ABORTED_BY_HOOK="ABORTED_BY_HOOK",t.INVALID_HOOK_CALLBACK="INVALID_HOOK_CALLBACK",t.UNEXPECTED_HOOK_RETURN="UNEXPECTED_HOOK_RETURN",t))(tt||{});class Je extends Error{constructor(e,n,r,i){super(n,i),this.code=e,this.context=r,this.name="FexiosError"}}let Wf=class extends Je{constructor(e,n,r){super(n.statusText,e,void 0,r),this.response=n,this.name="FexiosResponseError"}};function zf(t,e=2048){if(!(t instanceof Uint8Array))throw new TypeError("Input must be a Uint8Array");if(t.length===0)return!0;const n=Math.min(Math.max(t.length,256),e),r=t.slice(0,n);if(Vf(r))return!1;const i=Kf(r);if(i.nullByteRatio>.05||i.highByteRatio>.95)return!1;const s=["utf-8","utf-16le","utf-16be","iso-8859-1"];let o=-1,a=!1;for(const l of s)try{const u=new TextDecoder(l,{fatal:!0}).decode(r),c=Yf(u);c>o&&(o=c,a=c>.7)}catch{continue}return a}function Vf(t){if(t.length<4)return!1;const e=[[137,80,78,71],[255,216,255],[71,73,70],[37,80,68,70],[80,75,3,4],[80,75,5,6],[80,75,7,8],[127,69,76,70],[77,90],[202,254,186,190],[0,0,1,0],[82,73,70,70]];for(const n of e)if(t.length>=n.length){let r=!0;for(let i=0;i<n.length;i++)if(t[i]!==n[i]){r=!1;break}if(r)return!0}return!1}function Kf(t){let e=0,n=0,r=0;for(const i of t)i===0&&e++,i>127&&n++,(i<32&&i!==9&&i!==10&&i!==13||i===127)&&r++;return{nullByteRatio:e/t.length,highByteRatio:n/t.length,controlCharRatio:r/t.length}}function Yf(t){if(t.length===0)return 1;let e=1,n=0;for(let i=0;i<t.length;i++){const s=t[i].charCodeAt(0);s>=32&&s<=126||s===9||s===10||s===13||s===32?n++:s>127&&s<65534?!Gf(s)&&!Jf(s)&&n++:e-=.1}const r=n/t.length;return e*=r,Qf(t)&&(e*=1.1),Math.max(0,Math.min(1,e))}function Gf(t){return t>=0&&t<=31||t>=127&&t<=159}function Jf(t){return t>=57344&&t<=63743||t>=983040&&t<=1048573||t>=1048576&&t<=1114109}function Qf(t){return[/\b\w+\b/,/[.!?]+\s/,/\s+/,/[a-zA-Z]{3,}/,/[\u4e00-\u9fa5]+/,/\d+/].some(e=>e.test(t))}function us(t){if(typeof t!="object"||t===null||Object.prototype.toString.call(t)!=="[object Object]")return!1;const e=Object.getPrototypeOf(t);return e===Object.prototype||e===null}function fa(t,e={}){const n={};return Object.entries(t).forEach(([r,i])=>{i!=null&&(e.dropEmptyString&&i===""||(n[r]=i))}),n}class Yn{constructor(e,n,r){this.rawResponse=e,this.data=n,this.ok=e.ok,this.status=e.status,this.statusText=e.statusText,this.headers=e.headers,Object.entries(r||{}).forEach(([i,s])=>{this[i]=s})}}async function Xf(t,e,n){var r;if(t.bodyUsed)throw new Je(tt.BODY_USED,"Response body has already been used or locked");const i=t.headers.get("content-type")||"",s=Number(t.headers.get("content-length"))||0,o=(l,u)=>u==="json"||l.startsWith("application/json"),a=(l,u,c)=>c==="blob"||l.startsWith("image/")&&!l.startsWith("image/svg")||l.startsWith("video/")||l.startsWith("audio/")||!zf(u);if((t.status===101||t.status===426||t.headers.get("upgrade"))&&typeof globalThis.WebSocket<"u"){const l=new WebSocket(t.url);return await new Promise((u,c)=>{l.onopen=u,l.onerror=c}),new Yn(t,l,{ok:!0,status:101,statusText:"Switching Protocols"})}else if(i.startsWith("text/event-stream")&&!["text","json"].includes(e||"")&&typeof globalThis.EventSource<"u"){const l=new EventSource(t.url);return await new Promise((u,c)=>{l.onopen=u,l.onerror=c}),new Yn(t,l)}else{if(e==="stream")return new Yn(t,t.body);{const l=(r=t.clone().body)==null?void 0:r.getReader();if(!l)throw new Je(tt.NO_BODY_READER,"Failed to get ReadableStream from response body");let u=new Uint8Array;for(;;){const{done:f,value:b}=await l.read();if(f)break;if(b&&(u=new Uint8Array([...u,...b]),n&&s>0)){const y=Math.min(u.length/s,1);n(y,u)}}const c=new Yn(t,void 0);if(e==="arrayBuffer")return c.data=u.buffer,c;if(o(i,e))try{const f=new TextDecoder().decode(u);c.data=JSON.parse(f)}catch{}if(typeof c.data!="string"&&a(i,u,e)?c.data=new Blob([u],{type:t.headers.get("content-type")||void 0}):c.data=new TextDecoder().decode(u),typeof c.data=="string"&&e!=="text"){const f=c.data.trim(),b=f[0],y=f[f.length-1];if(b==="{"&&y==="}"||b==="["&&y==="]")try{c.data=JSON.parse(c.data)}catch{}}if(typeof c.data>"u"&&(c.data=u.length>0?u:void 0),c.ok)return c;throw new Wf(`Request failed with status code ${t.status}`,c)}}}let Zf=class{static makeSearchParams(e){const n=new URLSearchParams;return Object.entries(e).forEach(([r,i])=>{Array.isArray(i)?i.forEach(s=>n.append(r,String(s))):n.set(r,String(i))}),n}static makeQueryString(e){return this.makeSearchParams(e).toString()}};function ed(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var fs,da;function td(){if(da)return fs;da=1;function t(e){var n=this.constructor.prototype[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,this.constructor.prototype),Object.getOwnPropertyNames(n).forEach(function(i){Object.defineProperty(r,i,Object.getOwnPropertyDescriptor(n,i))}),r}return t.prototype=Object.create(Function.prototype),fs=t,fs}var nd=td();const rd=ed(nd);let ha=class Gi extends rd{constructor(e={}){super("request"),this.baseConfigs=e,this.hooks=[],this.DEFAULT_CONFIGS={baseURL:"",timeout:60*1e3,credentials:"same-origin",headers:{},query:{},responseType:void 0},this.ALL_METHODS=["get","post","put","patch","delete","head","options","trace"],this.METHODS_WITHOUT_BODY=["get","head","options","trace"],this.interceptors={request:this.createInterceptor("beforeRequest"),response:this.createInterceptor("afterResponse")},this.create=Gi.create,this.dropUndefinedAndNull=fa,this.checkIsPlainObject=us,this.ALL_METHODS.forEach(this.createMethodShortcut.bind(this))}async request(e,n){var r,i,s,o;let a=n=n||{};typeof e=="string"||e instanceof URL?a.url=e.toString():typeof e=="object"&&(a={...e,...a}),a=await this.emit("beforeInit",a);const l=n.baseURL||this.baseConfigs.baseURL||((r=globalThis.location)==null?void 0:r.href),u=l?new URL(l,(i=globalThis.location)==null?void 0:i.href):void 0,c=new URL(a.url.toString(),u);a.url=c.href,a.baseURL=u?u.href:c.origin,a.headers=this.mergeHeaders(this.baseConfigs.headers,n.headers);const f=u?.searchParams,b=new URLSearchParams(c.searchParams);if(c.search="",a.url=c.href,a.query=this.mergeQuery(f,this.baseConfigs.query,b,n.query),c.search=Zf.makeQueryString(a.query),a.url=c.toString(),this.METHODS_WITHOUT_BODY.includes((s=a.method)==null?void 0:s.toLocaleLowerCase())&&a.body)throw new Je(tt.BODY_NOT_ALLOWED,`Request method "${a.method}" does not allow body`);a=await this.emit("beforeRequest",a);let y;typeof a.body<"u"&&a.body!==null&&(a.body instanceof Blob||a.body instanceof FormData||a.body instanceof URLSearchParams?y=a.body:typeof a.body=="object"&&a.body!==null?(y=JSON.stringify(a.body),a.headers["content-type"]="application/json"):y=a.body),!((o=n.headers)!=null&&o["content-type"])&&y&&(y instanceof FormData||y instanceof URLSearchParams?delete a.headers["content-type"]:typeof y=="string"&&typeof a.body=="object"?a.headers["content-type"]="application/json":y instanceof Blob&&(a.headers["content-type"]=y.type)),a.body=y,a=await this.emit("afterBodyTransformed",a);const v=a.abortController||globalThis.AbortController?new AbortController:void 0,A=new Request(a.url,{method:a.method||"GET",credentials:a.credentials,cache:a.cache,mode:a.mode,headers:a.headers,body:a.body,signal:v?.signal});a.rawRequest=A,a=await this.emit("beforeActualFetch",a);const U=a.timeout||this.baseConfigs.timeout||60*1e3;if(a.url.startsWith("ws"))try{const I=new WebSocket(a.url);return await new Promise((g,p)=>{const h=setTimeout(()=>{p(new Je(tt.TIMEOUT,`WebSocket connection timed out after ${U}ms`,a))},U);I.onopen=()=>{clearTimeout(h),g()},I.onerror=x=>{clearTimeout(h),p(new Je(tt.NETWORK_ERROR,"WebSocket connection failed",a))},I.onclose=x=>{x.code!==1e3&&(clearTimeout(h),p(new Je(tt.NETWORK_ERROR,`WebSocket closed with code ${x.code}`,a)))}}),a.rawResponse=new Response,a.response=new Yn(a.rawResponse,I,{ok:!0,status:101,statusText:"Switching Protocols"}),a.data=I,a.headers=new Headers,this.emit("afterResponse",a)}catch(I){throw I instanceof Je?I:new Je(tt.NETWORK_ERROR,`WebSocket creation failed: ${I}`,a)}let D;try{v&&(D=setTimeout(()=>{v.abort()},U));const I=await fetch(a.rawRequest).catch(g=>{throw D&&clearTimeout(D),v!=null&&v.signal.aborted?new Je(tt.TIMEOUT,`Request timed out after ${U}ms`,a):new Je(tt.NETWORK_ERROR,g.message,a)});return D&&clearTimeout(D),a.rawResponse=I,a.response=await Xf(I,a.responseType,(g,p)=>{var h;(h=n?.onProgress)==null||h.call(n,g,p)}),a.data=a.response.data,a.headers=a.response.headers,this.emit("afterResponse",a)}catch(I){throw D&&clearTimeout(D),I}}mergeQuery(e,...n){const r={},i=s=>{s&&(us(s)?Object.entries(s).forEach(([o,a])=>{a==null?delete r[o]:Array.isArray(a)?(o.endsWith("[]"),r[o]=a.map(String)):r[o]=String(a)}):new URLSearchParams(s).forEach((o,a)=>{r[a]=o}))};return i(e),n.forEach(i),r}mergeHeaders(e,...n){const r={},i=new Headers(e);for(const s of n)if(s!=null)if(us(s)){const o=fa(s);if(Object.keys(o).length===0)continue;new Headers(o).forEach((a,l)=>{i.set(l,a)})}else new Headers(s).forEach((o,a)=>{i.set(a,o)});return i.forEach((s,o)=>{r[o]=s}),r}async emit(e,n){const r=this.hooks.filter(i=>i.event===e);try{let i=0;for(const s of r){const o=`${e}#${s.action.name||`anonymous#${i}`}`,a=Symbol("FexiosHookContext");n[a]=a;const l=await s.action.call(this,n);if(l===!1)throw new Je(tt.ABORTED_BY_HOOK,`Request aborted by hook "${o}"`,n);if(typeof l=="object"&&l[a]===a)n=l;else{const u=globalThis["".concat("console")];try{throw new Je(tt.HOOK_CONTEXT_CHANGED,`Hook "${o}" should return the original FexiosContext or return false to abort the request, but got "${l}".`)}catch(c){u.warn(c.stack||c)}}delete n[a],i++}}catch(i){return Promise.reject(i)}return n}on(e,n,r=!1){if(typeof n!="function")throw new Je(tt.INVALID_HOOK_CALLBACK,`Hook should be a function, but got "${typeof n}"`);return this.hooks[r?"unshift":"push"]({event:e,action:n}),this}off(e,n){return e==="*"||!e?this.hooks=this.hooks.filter(r=>r.action!==n):this.hooks=this.hooks.filter(r=>r.event!==e||r.action!==n),this}createInterceptor(e){return{handlers:()=>this.hooks.filter(n=>n.event===e).map(n=>n.action),use:(n,r=!1)=>this.on(e,n,r),clear:()=>{this.hooks=this.hooks.filter(n=>n.event!==e)}}}createMethodShortcut(e){return Object.defineProperty(this,e,{value:(n,r,i)=>(this.METHODS_WITHOUT_BODY.includes(e.toLocaleLowerCase())?i=r:(i=i||{},i.body=r),this.request(n,{...i,method:e}))}),this}extends(e){const n=new Gi({...this.baseConfigs,...e});return n.hooks=[...this.hooks],n}static create(e){return new Gi(e)}};/**
|
|
29
|
+
*/let ua=class ff{constructor(e={}){this._custom=n=>{if(!this._enabled(n.level))return fa;const[r,i]=this._prefix(n.label);return this._consoleMethod(n.method).bind(console,r,...i)},this._name=e.name,this._nameColor=e.color,this._groupPath=e._groupPath?[...e._groupPath]:[],this._dynamicLevels={...e._dynamicLevels},this._levelRef=e._levelRef??{value:e.level??1},this._name&&Mr(`name:${this._name}`,this._nameColor),this._installBuiltinLevels();for(const n of Object.keys(this._dynamicLevels))this._installLevelGetter(n,this._dynamicLevels[n]);return Vf(this)}get level(){return this._levelRef.value}set level(e){this._levelRef.value=e}group(e,n){return e&&Mr(`group:${e}`,n?.color),new ff({name:this._name,color:this._nameColor,_groupPath:[...this._groupPath,e],_dynamicLevels:this._dynamicLevels,_levelRef:this._levelRef})}defineLevel(e,n){this._dynamicLevels[e]={...n},this._installLevelGetter(e,n)}get debug(){return this._method("debug")}get log(){return this._method("log")}get info(){return this._method("info")}get warn(){return this._method("warn")}get error(){return this._method("error")}_installBuiltinLevels(){}_installLevelGetter(e,n){Object.defineProperty(this,e,{configurable:!0,enumerable:!1,get:()=>this._custom(n)})}_method(e){const n=zf[e];if(!this._enabled(n.level))return fa;const[r,i]=this._prefix(n.label);return this._consoleMethod(e).bind(console,r,...i)}_consoleMethod(e){return(console[e]||console.log).bind(console)}_enabled(e){return e>=this._levelRef.value&&this._levelRef.value!==4}_prefix(e){const n=[];let r="";if(this._name){const i=Mr(`name:${this._name}`,this._nameColor);r+=`%c${this._name}%c`,n.push(`background:${i}; color:#fff; padding:1px 4px; border-radius:2px; font-weight:700;`,da)}if(e&&(r+=` ${e}`),this._groupPath.length){const i=this._groupPath.join("/"),s=Mr(`group:${i}`);r+=` %c${i}%c`,n.push(`color:${s}; text-decoration: underline;`,da)}return[r,n]}};const fa=()=>{},da="color:inherit; background:transparent; text-decoration:none;",zf={debug:{level:-1,label:"",method:"debug"},log:{level:0,label:"",method:"log"},info:{level:1,label:"[I]",method:"info"},warn:{level:2,label:"[W]",method:"warn"},error:{level:3,label:"[E]",method:"error"}};function Vf(t){const e=function(n,r){return t.group(n,r)};return new Proxy(e,{get(n,r,i){return t[r]},set(n,r,i){return t[r]=i,!0},apply(n,r,i){return t.group(i[0],i[1])},has(n,r){return r in t}})}function ha(t){return new ua(t)}var nt=(t=>(t.BODY_USED="BODY_USED",t.NO_BODY_READER="NO_BODY_READER",t.TIMEOUT="TIMEOUT",t.NETWORK_ERROR="NETWORK_ERROR",t.BODY_NOT_ALLOWED="BODY_NOT_ALLOWED",t.HOOK_CONTEXT_CHANGED="HOOK_CONTEXT_CHANGED",t.ABORTED_BY_HOOK="ABORTED_BY_HOOK",t.INVALID_HOOK_CALLBACK="INVALID_HOOK_CALLBACK",t.UNEXPECTED_HOOK_RETURN="UNEXPECTED_HOOK_RETURN",t))(nt||{});class Qe extends Error{constructor(e,n,r,i){super(n,i),this.code=e,this.context=r,this.name="FexiosError"}}let Kf=class extends Qe{constructor(e,n,r){super(n.statusText,e,void 0,r),this.response=n,this.name="FexiosResponseError"}};function Yf(t,e=2048){if(!(t instanceof Uint8Array))throw new TypeError("Input must be a Uint8Array");if(t.length===0)return!0;const n=Math.min(Math.max(t.length,256),e),r=t.slice(0,n);if(Gf(r))return!1;const i=Jf(r);if(i.nullByteRatio>.05||i.highByteRatio>.95)return!1;const s=["utf-8","utf-16le","utf-16be","iso-8859-1"];let o=-1,a=!1;for(const l of s)try{const u=new TextDecoder(l,{fatal:!0}).decode(r),c=Qf(u);c>o&&(o=c,a=c>.7)}catch{continue}return a}function Gf(t){if(t.length<4)return!1;const e=[[137,80,78,71],[255,216,255],[71,73,70],[37,80,68,70],[80,75,3,4],[80,75,5,6],[80,75,7,8],[127,69,76,70],[77,90],[202,254,186,190],[0,0,1,0],[82,73,70,70]];for(const n of e)if(t.length>=n.length){let r=!0;for(let i=0;i<n.length;i++)if(t[i]!==n[i]){r=!1;break}if(r)return!0}return!1}function Jf(t){let e=0,n=0,r=0;for(const i of t)i===0&&e++,i>127&&n++,(i<32&&i!==9&&i!==10&&i!==13||i===127)&&r++;return{nullByteRatio:e/t.length,highByteRatio:n/t.length,controlCharRatio:r/t.length}}function Qf(t){if(t.length===0)return 1;let e=1,n=0;for(let i=0;i<t.length;i++){const s=t[i].charCodeAt(0);s>=32&&s<=126||s===9||s===10||s===13||s===32?n++:s>127&&s<65534?!Xf(s)&&!Zf(s)&&n++:e-=.1}const r=n/t.length;return e*=r,ed(t)&&(e*=1.1),Math.max(0,Math.min(1,e))}function Xf(t){return t>=0&&t<=31||t>=127&&t<=159}function Zf(t){return t>=57344&&t<=63743||t>=983040&&t<=1048573||t>=1048576&&t<=1114109}function ed(t){return[/\b\w+\b/,/[.!?]+\s/,/\s+/,/[a-zA-Z]{3,}/,/[\u4e00-\u9fa5]+/,/\d+/].some(e=>e.test(t))}function Fr(t){if(typeof t!="object"||t===null||Object.prototype.toString.call(t)!=="[object Object]")return!1;const e=Object.getPrototypeOf(t);return e===Object.prototype||e===null}function pa(t,e={}){const n={};return Object.entries(t).forEach(([r,i])=>{i!=null&&(e.dropEmptyString&&i===""||(n[r]=i))}),n}let Gn=class{constructor(e,n,r){this.rawResponse=e,this.data=n,this.ok=e.ok,this.status=e.status,this.statusText=e.statusText,this.headers=e.headers,Object.entries(r||{}).forEach(([i,s])=>{this[i]=s})}};async function td(t,e,n){var r;if(t.bodyUsed)throw new Qe(nt.BODY_USED,"Response body has already been used or locked");const i=t.headers.get("content-type")||"",s=Number(t.headers.get("content-length"))||0,o=(l,u)=>u==="json"||l.startsWith("application/json"),a=(l,u,c)=>c==="blob"||l.startsWith("image/")&&!l.startsWith("image/svg")||l.startsWith("video/")||l.startsWith("audio/")||!Yf(u);if((t.status===101||t.status===426||t.headers.get("upgrade"))&&typeof globalThis.WebSocket<"u"){const l=new WebSocket(t.url);return await new Promise((u,c)=>{l.onopen=u,l.onerror=c}),new Gn(t,l,{ok:!0,status:101,statusText:"Switching Protocols"})}else if(i.startsWith("text/event-stream")&&!["text","json"].includes(e||"")&&typeof globalThis.EventSource<"u"){const l=new EventSource(t.url);return await new Promise((u,c)=>{l.onopen=u,l.onerror=c}),new Gn(t,l)}else{if(e==="stream")return new Gn(t,t.body);{const l=(r=t.clone().body)==null?void 0:r.getReader();if(!l)throw new Qe(nt.NO_BODY_READER,"Failed to get ReadableStream from response body");let u=new Uint8Array;for(;;){const{done:f,value:b}=await l.read();if(f)break;if(b&&(u=new Uint8Array([...u,...b]),n&&s>0)){const y=Math.min(u.length/s,1);n(y,u)}}const c=new Gn(t,void 0);if(e==="arrayBuffer")return c.data=u.buffer,c;if(o(i,e))try{const f=new TextDecoder().decode(u);c.data=JSON.parse(f)}catch{}if(typeof c.data!="string"&&a(i,u,e)?c.data=new Blob([u],{type:t.headers.get("content-type")||void 0}):c.data=new TextDecoder().decode(u),typeof c.data=="string"&&e!=="text"){const f=c.data.trim(),b=f[0],y=f[f.length-1];if(b==="{"&&y==="}"||b==="["&&y==="]")try{c.data=JSON.parse(c.data)}catch{}}if(typeof c.data>"u"&&(c.data=u.length>0?u:void 0),c.ok)return c;throw new Kf(`Request failed with status code ${t.status}`,c)}}}let nd=class{static makeSearchParams(e){const n=new URLSearchParams;return Object.entries(e).forEach(([r,i])=>{Array.isArray(i)?i.forEach(s=>n.append(r,String(s))):n.set(r,String(i))}),n}static makeQueryString(e){return this.makeSearchParams(e).toString()}};function rd(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ds,ma;function id(){if(ma)return ds;ma=1;function t(e){var n=this.constructor.prototype[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,this.constructor.prototype),Object.getOwnPropertyNames(n).forEach(function(i){Object.defineProperty(r,i,Object.getOwnPropertyDescriptor(n,i))}),r}return t.prototype=Object.create(Function.prototype),ds=t,ds}var sd=id();const od=rd(sd),Br=class tn extends od{constructor(e={}){super("request"),this.baseConfigs=e,this.hooks=[],this.interceptors={request:this.createInterceptor("beforeRequest"),response:this.createInterceptor("afterResponse")},this.create=tn.create,this.dropUndefinedAndNull=pa,this.checkIsPlainObject=Fr,e={...tn.DEFAULT_CONFIGS,...e},tn.ALL_METHODS.forEach(this.createMethodShortcut.bind(this))}async request(e,n){var r,i,s,o;let a=n=n||{};typeof e=="string"||e instanceof URL?a.url=e.toString():typeof e=="object"&&(a={...e,...a}),a=await this.emit("beforeInit",a);const l=n.baseURL||this.baseConfigs.baseURL||((r=globalThis.location)==null?void 0:r.href),u=l?new URL(l,(i=globalThis.location)==null?void 0:i.href):void 0,c=new URL(a.url.toString(),u);a.url=c.href,a.baseURL=u?u.href:c.origin,a.headers=this.mergeHeaders(this.baseConfigs.headers,n.headers);const f=u?.searchParams,b=new URLSearchParams(c.searchParams);if(c.search="",a.url=c.href,a.query=this.mergeQuery(f,this.baseConfigs.query,b,n.query),c.search=nd.makeQueryString(a.query),a.url=c.toString(),tn.METHODS_WITHOUT_BODY.includes((s=a.method)==null?void 0:s.toLocaleLowerCase())&&a.body)throw new Qe(nt.BODY_NOT_ALLOWED,`Request method "${a.method}" does not allow body`);a=await this.emit("beforeRequest",a);let y;typeof a.body<"u"&&a.body!==null&&(a.body instanceof Blob||a.body instanceof FormData||a.body instanceof URLSearchParams?y=a.body:typeof a.body=="object"&&a.body!==null?(y=JSON.stringify(a.body),a.headers["content-type"]="application/json"):y=a.body),!((o=n.headers)!=null&&o["content-type"])&&y&&(y instanceof FormData||y instanceof URLSearchParams?delete a.headers["content-type"]:typeof y=="string"&&typeof a.body=="object"?a.headers["content-type"]="application/json":y instanceof Blob&&(a.headers["content-type"]=y.type)),a.body=y,a=await this.emit("afterBodyTransformed",a);const v=a.abortController||globalThis.AbortController?new AbortController:void 0,A=new Request(a.url,{method:a.method||"GET",credentials:a.credentials,cache:a.cache,mode:a.mode,headers:a.headers,body:a.body,signal:v?.signal});a.rawRequest=A,a=await this.emit("beforeActualFetch",a);const U=a.timeout||this.baseConfigs.timeout||60*1e3;if(a.url.startsWith("ws"))try{const I=new WebSocket(a.url);return await new Promise((g,p)=>{const h=setTimeout(()=>{p(new Qe(nt.TIMEOUT,`WebSocket connection timed out after ${U}ms`,a))},U);I.onopen=()=>{clearTimeout(h),g()},I.onerror=x=>{clearTimeout(h),p(new Qe(nt.NETWORK_ERROR,"WebSocket connection failed",a))},I.onclose=x=>{x.code!==1e3&&(clearTimeout(h),p(new Qe(nt.NETWORK_ERROR,`WebSocket closed with code ${x.code}`,a)))}}),a.rawResponse=new Response,a.response=new Gn(a.rawResponse,I,{ok:!0,status:101,statusText:"Switching Protocols"}),a.data=I,a.headers=new Headers,this.emit("afterResponse",a)}catch(I){throw I instanceof Qe?I:new Qe(nt.NETWORK_ERROR,`WebSocket creation failed: ${I}`,a)}let D;try{v&&(D=setTimeout(()=>{v.abort()},U));const I=await(n.fetch||this.baseConfigs.fetch||globalThis.fetch)(a.rawRequest).catch(g=>{throw D&&clearTimeout(D),v!=null&&v.signal.aborted?new Qe(nt.TIMEOUT,`Request timed out after ${U}ms`,a):new Qe(nt.NETWORK_ERROR,g.message,a)});return D&&clearTimeout(D),a.rawResponse=I,a.response=await td(I,a.responseType,(g,p)=>{var h;(h=n?.onProgress)==null||h.call(n,g,p)}),a.data=a.response.data,a.headers=a.response.headers,this.emit("afterResponse",a)}catch(I){throw D&&clearTimeout(D),I}}mergeQuery(e,...n){const r={},i=s=>{s&&(Fr(s)?Object.entries(s).forEach(([o,a])=>{a==null?delete r[o]:Array.isArray(a)?(o.endsWith("[]"),r[o]=a.map(String)):r[o]=String(a)}):new URLSearchParams(s).forEach((o,a)=>{r[a]=o}))};return i(e),n.forEach(i),r}mergeHeaders(e,...n){const r={},i=new Headers(e);for(const s of n)if(s!=null)if(Fr(s)){const o=pa(s);if(Object.keys(o).length===0)continue;new Headers(o).forEach((a,l)=>{i.set(l,a)})}else new Headers(s).forEach((o,a)=>{i.set(a,o)});return i.forEach((s,o)=>{r[o]=s}),r}async emit(e,n){const r=this.hooks.filter(i=>i.event===e);try{let i=0;for(const s of r){const o=`${e}#${s.action.name||`anonymous#${i}`}`,a=Symbol("FexiosHookContext");n[a]=a;let l=await s.action.call(this,n);if(l===void 0&&(l=n),l===!1)throw new Qe(nt.ABORTED_BY_HOOK,`Request aborted by hook "${o}"`,n);if(typeof l=="object"&&l[a]===a)n=l;else{const u=globalThis["".concat("console")];try{throw new Qe(nt.HOOK_CONTEXT_CHANGED,`Hook "${o}" should return the original FexiosContext or return false to abort the request, but got "${l}".`)}catch(c){u.warn(c.stack||c)}}delete n[a],i++}}catch(i){return Promise.reject(i)}return n}on(e,n,r=!1){if(typeof n!="function")throw new Qe(nt.INVALID_HOOK_CALLBACK,`Hook should be a function, but got "${typeof n}"`);return this.hooks[r?"unshift":"push"]({event:e,action:n}),this}off(e,n){return e==="*"||!e?this.hooks=this.hooks.filter(r=>r.action!==n):this.hooks=this.hooks.filter(r=>r.event!==e||r.action!==n),this}createInterceptor(e){return{handlers:()=>this.hooks.filter(n=>n.event===e).map(n=>n.action),use:(n,r=!1)=>this.on(e,n,r),clear:()=>{this.hooks=this.hooks.filter(n=>n.event!==e)}}}createMethodShortcut(e){return Object.defineProperty(this,e,{value:(n,r,i)=>(tn.METHODS_WITHOUT_BODY.includes(e.toLocaleLowerCase())?i=r:(i=i||{},i.body=r),this.request(n,{...i,method:e}))}),this}extends(e){const n=new tn({...this.baseConfigs,...e});return n.hooks=[...this.hooks],n}static create(e){return new tn(e)}};Br.DEFAULT_CONFIGS={baseURL:"",timeout:60*1e3,credentials:"same-origin",headers:{},query:{},responseType:void 0,fetch:globalThis.fetch},Br.ALL_METHODS=["get","post","put","patch","delete","head","options","trace"],Br.METHODS_WITHOUT_BODY=["get","head","options","trace"];let ga=Br;/**
|
|
30
30
|
* Fexios
|
|
31
31
|
* @desc Fetch based HTTP client with similar API to axios for browser and Node.js
|
|
32
32
|
*
|
|
33
33
|
* @license MIT
|
|
34
34
|
* @author dragon-fish <dragon-fish@qq.com>
|
|
35
|
-
*/const
|
|
35
|
+
*/const ad=ga.create,ya=ad();typeof globalThis<"u"?globalThis.fexios=ya:typeof window<"u"&&(window.fexios=ya);/**
|
|
36
36
|
* MediaWiki Api
|
|
37
37
|
* Provides the API call methods similar to `mw.Api` at non-mw environments
|
|
38
38
|
*
|
|
39
39
|
* @author Dragon-Fish <dragon-fish@qq.com>
|
|
40
40
|
* @license MIT
|
|
41
|
-
*/const
|
|
41
|
+
*/const va=class Ue{constructor(e,n,r){if(this.baseURL=e,this.version="5.2.0",this.normalizeParamValue=Ue.normalizeParamValue,this.normalizeBody=Ue.normalizeBody,this.isMediaWikiApiError=Ue.isMediaWikiApiError,this.extractMediaWikiErrors=Ue.extractMediaWikiErrors,this.isBadTokenError=Ue.isBadTokenError,!e&&typeof window=="object"&&window.mediaWiki){const{wgServer:i,wgScriptPath:s}=window.mediaWiki?.config?.get(["wgServer","wgScriptPath"])||{};typeof i=="string"&&typeof s=="string"&&(e=`${i}${s}/api.php`)}if(typeof e!="string")throw new Error("baseURL is undefined");this.baseURL=e,this.tokens={},this.defaultParams={...Ue.INIT_DEFAULT_PARAMS,...r},this.defaultOptions={responseType:"json",...n},this.request=Ue.createRequestHandler(this.baseURL)}setBaseURL(e){return this.request.baseConfigs.baseURL=e,this}static normalizeParamValue(e){return Array.isArray(e)?e.join("|"):typeof e=="boolean"||e===null?e?"1":void 0:typeof e=="number"?""+e:e}static normalizeBody(e){const n=r=>r&&(r instanceof URLSearchParams||r instanceof FormData);if(e!=null){if(n(e))return e.forEach((r,i)=>{const s=Ue.normalizeParamValue(r);s==null?e.delete(i):s!==r&&e.set(i,s)}),e;if(Fr(e))return e=Object.fromEntries(Object.entries(e).map(([r,i])=>[r,Ue.normalizeParamValue(i)]).filter(([r,i])=>i!=null)),Object.values(e).some(r=>r instanceof File||r instanceof Blob)?(e=new FormData,Object.entries(e).forEach(([r,i])=>{e.append(r,i)})):e=new URLSearchParams(e),e}}static createRequestHandler(e){const n=new ga({baseURL:e,responseType:"json"});return n.on("beforeInit",r=>{if(r.method?.toLowerCase()!=="post")return r;if(r.body===void 0||r.body===null)return r.body=void 0,r;const i=r.body=Ue.normalizeBody(r.body),s=new URLSearchParams(r.query);return i.has("format")&&s.delete("format"),i.has("formatversion")&&s.delete("formatversion"),i.has("action")&&s.delete("action"),i.has("origin")&&(s.set("origin",""+i.get("origin")),i.delete("origin")),r.query=Object.fromEntries(s.entries()),r}),n.on("beforeInit",r=>(r.query=Ue.normalizeBody(r.query)||{},r)),n.on("beforeRequest",r=>{const i=new URL(r.url),s=i.searchParams;if(globalThis.location&&(!s.has("origin")&&location.origin!==new URL(e).origin?(s.set("origin",location.origin),n.baseConfigs.credentials="include",n.baseConfigs.mode="cors"):location.origin===new URL(e).origin&&(s.delete("origin"),n.baseConfigs.credentials=void 0,n.baseConfigs.mode=void 0)),i.searchParams.has("origin")){const o=encodeURIComponent(i.searchParams.get("origin")||"").replace(/\./g,"%2E");r.query={},i.searchParams.delete("origin"),r.url=`${i}${i.search?"&":"?"}origin=${o}`}return r}),n}get(e,n){return this.request.get("",{...this.defaultOptions,query:{...this.defaultParams,...this.defaultOptions.query,...e},...n})}post(e,n){return this.request.post("",e,{...this.defaultOptions,query:{...this.defaultParams,...this.defaultOptions.query},...n})}async login(e,n,r,i){if(this.defaultOptions.credentials="include",i=i||{},i.retry??(i.retry=3),i.retry<1)throw new bn("LOGIN_RETRY_LIMIT_EXCEEDED","The limit of the number of times to automatically re-login has been exceeded");let s;try{const o=await this.postWithToken("login",{action:"login",lgname:e,lgpassword:n,...r},{tokenName:"lgtoken",...i});if(o?.data?.login)s=o.data;else throw o}catch(o){if(o instanceof bn)throw o;if(o?.ok===!1)return this.login(e,n,r,{...i,noCache:!0,retry:i.retry-1});throw new bn("HTTP_ERROR","The server returns an error, but it doesn't seem to be caused by MediaWiki",o)}if(s?.login?.result!=="Success")throw new bn("LOGIN_FAILED",s?.login?.reason?.text||s?.login?.result||"Login failed with unknown reason",s);return s.login}async getUserInfo(){const{data:e}=await this.get({action:"query",meta:"userinfo",uiprop:["groups","rights","blockinfo"]});return e?.query?.userinfo}async getTokens(e=["csrf"]){this.defaultOptions.credentials="include";const{data:n}=await this.get({action:"query",meta:"tokens",type:e});return this.tokens={...this.tokens,...n.query.tokens},this.tokens}async token(e="csrf",n=!1){return(!this.tokens[`${e}token`]||n)&&(delete this.tokens[`${e}token`],await this.getTokens([e])),this.tokens[`${e}token`]}async postWithToken(e,n,r){const{tokenName:i="token",retry:s=3,noCache:o=!1}=r||{};if(s<1)throw new bn("TOKEN_RETRY_LIMIT_EXCEEDED","The limit of the number of times to automatically re-acquire the token has been exceeded");const a=await this.token(e,o),l=()=>this.postWithToken(e,n,{tokenName:i,retry:s-1,noCache:!0});return this.post({[i]:a,...n}).then(u=>{const c=u.data;return Ue.isBadTokenError(c)?l():u}).catch(u=>{const c=u.data;if(Ue.isBadTokenError(c)||u?.ok===!1)return l();if(typeof c=="object"&&c!==null)return Promise.reject(c);throw new bn("HTTP_ERROR","The server returns an error, but it doesn’t seem to be caused by MediaWiki",u)})}postWithEditToken(e){return this.postWithToken("csrf",e)}async getMessages(e,n="zh",r){const{data:i}=await this.get({action:"query",meta:"allmessages",ammessages:e,amlang:n,...r}),s={};return i.query.allmessages.forEach(function(o){o.missing||(s[o.name]=o.content)}),s}async parseWikitext(e,n,r,i){const{data:s}=await this.post({action:"parse",title:n,text:e,...r},i);return s.parse.text}static extractResponseDataFromAny(e){return e?.response?.data||e?.data||e||void 0}static isMediaWikiApiError(e){const n=Ue.extractResponseDataFromAny(e);return typeof n=="object"&&n!==null&&("error"in n||"errors"in n)}static extractMediaWikiErrors(e){const n=Ue.extractResponseDataFromAny(e);if(typeof n!="object"||n===null)return[];const r=n?.error,i=n?.errors,s=[];return r&&s.push(r),Array.isArray(i)&&s.push(...i),s}static isBadTokenError(e){return Ue.extractMediaWikiErrors(e).some(n=>n.code==="badtoken")||["NeedToken","WrongToken"].includes(e?.login?.result)}};va.INIT_DEFAULT_PARAMS={action:"query",errorformat:"plaintext",format:"json",formatversion:2};let ld=va,bn=class extends Error{constructor(e,n="",r){super(),this.code=e,this.message=n,this.cause=r,this.name="WikiSaikouError"}};/**
|
|
42
42
|
* MediaWiki Api
|
|
43
43
|
* Provides the API call methods similar to `mw.Api` at non-mw environments
|
|
44
44
|
*
|
|
45
45
|
* @author Dragon-Fish <dragon-fish@qq.com>
|
|
46
46
|
* @license MIT
|
|
47
|
-
*/let
|
|
47
|
+
*/let ba=class extends ld{};class cd{constructor(e,n){this.ctx=e;let r=typeof n?.baseURL=="string"?n.baseURL:n?.baseURL?.toString();r?.startsWith("/")&&(r=new URL(r,location.origin).href);const i=new ba(r,{headers:{"x-api-user-agent":`InPageEdit-NEXT ${e.version}`}});e.set("api",i)}}class ud extends vn{constructor(e){super(e,"resourceLoader",!0),this.ctx=e}stop(){}loadScript(e,n){if(!e)return Promise.resolve(null);const r=`script:${e}`,i=document.querySelector(`[data-ipe="${r}"]`);return i?Promise.resolve(i):new Promise((o,a)=>{const l=document.createElement("script");l.src=e,l.dataset.ipe=r,n&&Object.entries(n).forEach(([u,c])=>{typeof c>"u"||c===!1||c===null?l.removeAttribute(u):l.setAttribute(u,c)}),document.body.appendChild(l),l.onload=()=>o(l),l.onerror=u=>a(u)})}loadStyle(e,n){if(!e)return Promise.resolve(null);const r=`style:${e}`,i=document.querySelector(`[data-ipe="${r}"]`);return i?Promise.resolve(i):new Promise((o,a)=>{const l=document.createElement("link");l.rel="stylesheet",l.href=e,l.dataset.ipe=r,n&&Object.entries(n).forEach(([c,f])=>{typeof f>"u"||f===!1||f===null?l.removeAttribute(c):l.setAttribute(c,f)}),(document.querySelector('meta[name="ipe-styles"]')||(()=>{const c=document.createElement("meta");return c.id="ipe-styles",c.name="ipe-styles",document.head.insertAdjacentElement("afterbegin",c),c})()).before(l),l.onload=()=>o(l),l.onerror=c=>a(c)})}resolveImportPath(e){if(e.startsWith("http")||e.startsWith("//"))return e;const n=document.currentScript?.src;if(!n)return`https://unpkg.com/mediawiki-inpageedit@latest/dist/${e}`;const r=new URL(n);return r.pathname.endsWith(".js")||(r.pathname=r.pathname+"/"),new URL(e,r.toString()).toString()}}var Ur=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function fd(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Hr(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var hs={exports:{}};/*!
|
|
48
48
|
localForage -- Offline Storage, Improved
|
|
49
49
|
Version 1.10.0
|
|
50
50
|
https://localforage.github.io/localForage
|
|
51
51
|
(c) 2013-2017 Mozilla, Apache License 2.0
|
|
52
|
-
*/var ya;function cd(){return ya||(ya=1,function(t,e){(function(n){t.exports=n()})(function(){return function n(r,i,s){function o(u,c){if(!i[u]){if(!r[u]){var f=typeof Br=="function"&&Br;if(!c&&f)return f(u,!0);if(a)return a(u,!0);var b=new Error("Cannot find module '"+u+"'");throw b.code="MODULE_NOT_FOUND",b}var y=i[u]={exports:{}};r[u][0].call(y.exports,function(v){var A=r[u][1][v];return o(A||v)},y,y.exports,n,r,i,s)}return i[u].exports}for(var a=typeof Br=="function"&&Br,l=0;l<s.length;l++)o(s[l]);return o}({1:[function(n,r,i){(function(s){var o=s.MutationObserver||s.WebKitMutationObserver,a;if(o){var l=0,u=new o(v),c=s.document.createTextNode("");u.observe(c,{characterData:!0}),a=function(){c.data=l=++l%2}}else if(!s.setImmediate&&typeof s.MessageChannel<"u"){var f=new s.MessageChannel;f.port1.onmessage=v,a=function(){f.port2.postMessage(0)}}else"document"in s&&"onreadystatechange"in s.document.createElement("script")?a=function(){var U=s.document.createElement("script");U.onreadystatechange=function(){v(),U.onreadystatechange=null,U.parentNode.removeChild(U),U=null},s.document.documentElement.appendChild(U)}:a=function(){setTimeout(v,0)};var b,y=[];function v(){b=!0;for(var U,D,I=y.length;I;){for(D=y,y=[],U=-1;++U<I;)D[U]();I=y.length}b=!1}r.exports=A;function A(U){y.push(U)===1&&!b&&a()}}).call(this,typeof Fr<"u"?Fr:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(n,r,i){var s=n(1);function o(){}var a={},l=["REJECTED"],u=["FULFILLED"],c=["PENDING"];r.exports=f;function f(h){if(typeof h!="function")throw new TypeError("resolver must be a function");this.state=c,this.queue=[],this.outcome=void 0,h!==o&&A(this,h)}f.prototype.catch=function(h){return this.then(null,h)},f.prototype.then=function(h,x){if(typeof h!="function"&&this.state===u||typeof x!="function"&&this.state===l)return this;var P=new this.constructor(o);if(this.state!==c){var R=this.state===u?h:x;y(P,R,this.outcome)}else this.queue.push(new b(P,h,x));return P};function b(h,x,P){this.promise=h,typeof x=="function"&&(this.onFulfilled=x,this.callFulfilled=this.otherCallFulfilled),typeof P=="function"&&(this.onRejected=P,this.callRejected=this.otherCallRejected)}b.prototype.callFulfilled=function(h){a.resolve(this.promise,h)},b.prototype.otherCallFulfilled=function(h){y(this.promise,this.onFulfilled,h)},b.prototype.callRejected=function(h){a.reject(this.promise,h)},b.prototype.otherCallRejected=function(h){y(this.promise,this.onRejected,h)};function y(h,x,P){s(function(){var R;try{R=x(P)}catch(W){return a.reject(h,W)}R===h?a.reject(h,new TypeError("Cannot resolve promise with itself")):a.resolve(h,R)})}a.resolve=function(h,x){var P=U(v,x);if(P.status==="error")return a.reject(h,P.value);var R=P.value;if(R)A(h,R);else{h.state=u,h.outcome=x;for(var W=-1,X=h.queue.length;++W<X;)h.queue[W].callFulfilled(x)}return h},a.reject=function(h,x){h.state=l,h.outcome=x;for(var P=-1,R=h.queue.length;++P<R;)h.queue[P].callRejected(x);return h};function v(h){var x=h&&h.then;if(h&&(typeof h=="object"||typeof h=="function")&&typeof x=="function")return function(){x.apply(h,arguments)}}function A(h,x){var P=!1;function R(Te){P||(P=!0,a.reject(h,Te))}function W(Te){P||(P=!0,a.resolve(h,Te))}function X(){x(W,R)}var Ce=U(X);Ce.status==="error"&&R(Ce.value)}function U(h,x){var P={};try{P.value=h(x),P.status="success"}catch(R){P.status="error",P.value=R}return P}f.resolve=D;function D(h){return h instanceof this?h:a.resolve(new this(o),h)}f.reject=I;function I(h){var x=new this(o);return a.reject(x,h)}f.all=g;function g(h){var x=this;if(Object.prototype.toString.call(h)!=="[object Array]")return this.reject(new TypeError("must be an array"));var P=h.length,R=!1;if(!P)return this.resolve([]);for(var W=new Array(P),X=0,Ce=-1,Te=new this(o);++Ce<P;)et(h[Ce],Ce);return Te;function et(Bt,pn){x.resolve(Bt).then(Re,function(me){R||(R=!0,a.reject(Te,me))});function Re(me){W[pn]=me,++X===P&&!R&&(R=!0,a.resolve(Te,W))}}}f.race=p;function p(h){var x=this;if(Object.prototype.toString.call(h)!=="[object Array]")return this.reject(new TypeError("must be an array"));var P=h.length,R=!1;if(!P)return this.resolve([]);for(var W=-1,X=new this(o);++W<P;)Ce(h[W]);return X;function Ce(Te){x.resolve(Te).then(function(et){R||(R=!0,a.resolve(X,et))},function(et){R||(R=!0,a.reject(X,et))})}}},{1:1}],3:[function(n,r,i){(function(s){typeof s.Promise!="function"&&(s.Promise=n(2))}).call(this,typeof Fr<"u"?Fr:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(n,r,i){var s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(d){return typeof d}:function(d){return d&&typeof Symbol=="function"&&d.constructor===Symbol&&d!==Symbol.prototype?"symbol":typeof d};function o(d,w){if(!(d instanceof w))throw new TypeError("Cannot call a class as a function")}function a(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch{return}}var l=a();function u(){try{if(!l||!l.open)return!1;var d=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),w=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!d||w)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function c(d,w){d=d||[],w=w||{};try{return new Blob(d,w)}catch(S){if(S.name!=="TypeError")throw S;for(var m=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,k=new m,O=0;O<d.length;O+=1)k.append(d[O]);return k.getBlob(w.type)}}typeof Promise>"u"&&n(3);var f=Promise;function b(d,w){w&&d.then(function(m){w(null,m)},function(m){w(m)})}function y(d,w,m){typeof w=="function"&&d.then(w),typeof m=="function"&&d.catch(m)}function v(d){return typeof d!="string"&&(d=String(d)),d}function A(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var U="local-forage-detect-blob-support",D=void 0,I={},g=Object.prototype.toString,p="readonly",h="readwrite";function x(d){for(var w=d.length,m=new ArrayBuffer(w),k=new Uint8Array(m),O=0;O<w;O++)k[O]=d.charCodeAt(O);return m}function P(d){return new f(function(w){var m=d.transaction(U,h),k=c([""]);m.objectStore(U).put(k,"key"),m.onabort=function(O){O.preventDefault(),O.stopPropagation(),w(!1)},m.oncomplete=function(){var O=navigator.userAgent.match(/Chrome\/(\d+)/),S=navigator.userAgent.match(/Edge\//);w(S||!O||parseInt(O[1],10)>=43)}}).catch(function(){return!1})}function R(d){return typeof D=="boolean"?f.resolve(D):P(d).then(function(w){return D=w,D})}function W(d){var w=I[d.name],m={};m.promise=new f(function(k,O){m.resolve=k,m.reject=O}),w.deferredOperations.push(m),w.dbReady?w.dbReady=w.dbReady.then(function(){return m.promise}):w.dbReady=m.promise}function X(d){var w=I[d.name],m=w.deferredOperations.pop();if(m)return m.resolve(),m.promise}function Ce(d,w){var m=I[d.name],k=m.deferredOperations.pop();if(k)return k.reject(w),k.promise}function Te(d,w){return new f(function(m,k){if(I[d.name]=I[d.name]||st(),d.db)if(w)W(d),d.db.close();else return m(d.db);var O=[d.name];w&&O.push(d.version);var S=l.open.apply(l,O);w&&(S.onupgradeneeded=function(N){var F=S.result;try{F.createObjectStore(d.storeName),N.oldVersion<=1&&F.createObjectStore(U)}catch(H){if(H.name!=="ConstraintError")throw H}}),S.onerror=function(N){N.preventDefault(),k(S.error)},S.onsuccess=function(){var N=S.result;N.onversionchange=function(F){F.target.close()},m(N),X(d)}})}function et(d){return Te(d,!1)}function Bt(d){return Te(d,!0)}function pn(d,w){if(!d.db)return!0;var m=!d.db.objectStoreNames.contains(d.storeName),k=d.version<d.db.version,O=d.version>d.db.version;if(k&&(d.version,d.version=d.db.version),O||m){if(m){var S=d.db.version+1;S>d.version&&(d.version=S)}return!0}return!1}function Re(d){return new f(function(w,m){var k=new FileReader;k.onerror=m,k.onloadend=function(O){var S=btoa(O.target.result||"");w({__local_forage_encoded_blob:!0,data:S,type:d.type})},k.readAsBinaryString(d)})}function me(d){var w=x(atob(d.data));return c([w],{type:d.type})}function ve(d){return d&&d.__local_forage_encoded_blob}function Ut(d){var w=this,m=w._initReady().then(function(){var k=I[w._dbInfo.name];if(k&&k.dbReady)return k.dbReady});return y(m,d,d),m}function Bn(d){W(d);for(var w=I[d.name],m=w.forages,k=0;k<m.length;k++){var O=m[k];O._dbInfo.db&&(O._dbInfo.db.close(),O._dbInfo.db=null)}return d.db=null,et(d).then(function(S){return d.db=S,pn(d)?Bt(d):S}).then(function(S){d.db=w.db=S;for(var N=0;N<m.length;N++)m[N]._dbInfo.db=S}).catch(function(S){throw Ce(d,S),S})}function Me(d,w,m,k){k===void 0&&(k=1);try{var O=d.db.transaction(d.storeName,w);m(null,O)}catch(S){if(k>0&&(!d.db||S.name==="InvalidStateError"||S.name==="NotFoundError"))return f.resolve().then(function(){if(!d.db||S.name==="NotFoundError"&&!d.db.objectStoreNames.contains(d.storeName)&&d.version<=d.db.version)return d.db&&(d.version=d.db.version+1),Bt(d)}).then(function(){return Bn(d).then(function(){Me(d,w,m,k-1)})}).catch(m);m(S)}}function st(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Vi(d){var w=this,m={db:null};if(d)for(var k in d)m[k]=d[k];var O=I[m.name];O||(O=st(),I[m.name]=O),O.forages.push(w),w._initReady||(w._initReady=w.ready,w.ready=Ut);var S=[];function N(){return f.resolve()}for(var F=0;F<O.forages.length;F++){var H=O.forages[F];H!==w&&S.push(H._initReady().catch(N))}var q=O.forages.slice(0);return f.all(S).then(function(){return m.db=O.db,et(m)}).then(function(V){return m.db=V,pn(m,w._defaultConfig.version)?Bt(m):V}).then(function(V){m.db=O.db=V,w._dbInfo=m;for(var Q=0;Q<q.length;Q++){var ae=q[Q];ae!==w&&(ae._dbInfo.db=m.db,ae._dbInfo.version=m.version)}})}function Ho(d,w){var m=this;d=v(d);var k=new f(function(O,S){m.ready().then(function(){Me(m._dbInfo,p,function(N,F){if(N)return S(N);try{var H=F.objectStore(m._dbInfo.storeName),q=H.get(d);q.onsuccess=function(){var V=q.result;V===void 0&&(V=null),ve(V)&&(V=me(V)),O(V)},q.onerror=function(){S(q.error)}}catch(V){S(V)}})}).catch(S)});return b(k,w),k}function qo(d,w){var m=this,k=new f(function(O,S){m.ready().then(function(){Me(m._dbInfo,p,function(N,F){if(N)return S(N);try{var H=F.objectStore(m._dbInfo.storeName),q=H.openCursor(),V=1;q.onsuccess=function(){var Q=q.result;if(Q){var ae=Q.value;ve(ae)&&(ae=me(ae));var ge=d(ae,Q.key,V++);ge!==void 0?O(ge):Q.continue()}else O()},q.onerror=function(){S(q.error)}}catch(Q){S(Q)}})}).catch(S)});return b(k,w),k}function mn(d,w,m){var k=this;d=v(d);var O=new f(function(S,N){var F;k.ready().then(function(){return F=k._dbInfo,g.call(w)==="[object Blob]"?R(F.db).then(function(H){return H?w:Re(w)}):w}).then(function(H){Me(k._dbInfo,h,function(q,V){if(q)return N(q);try{var Q=V.objectStore(k._dbInfo.storeName);H===null&&(H=void 0);var ae=Q.put(H,d);V.oncomplete=function(){H===void 0&&(H=null),S(H)},V.onabort=V.onerror=function(){var ge=ae.error?ae.error:ae.transaction.error;N(ge)}}catch(ge){N(ge)}})}).catch(N)});return b(O,m),O}function Un(d,w){var m=this;d=v(d);var k=new f(function(O,S){m.ready().then(function(){Me(m._dbInfo,h,function(N,F){if(N)return S(N);try{var H=F.objectStore(m._dbInfo.storeName),q=H.delete(d);F.oncomplete=function(){O()},F.onerror=function(){S(q.error)},F.onabort=function(){var V=q.error?q.error:q.transaction.error;S(V)}}catch(V){S(V)}})}).catch(S)});return b(k,w),k}function Cr(d){var w=this,m=new f(function(k,O){w.ready().then(function(){Me(w._dbInfo,h,function(S,N){if(S)return O(S);try{var F=N.objectStore(w._dbInfo.storeName),H=F.clear();N.oncomplete=function(){k()},N.onabort=N.onerror=function(){var q=H.error?H.error:H.transaction.error;O(q)}}catch(q){O(q)}})}).catch(O)});return b(m,d),m}function Ki(d){var w=this,m=new f(function(k,O){w.ready().then(function(){Me(w._dbInfo,p,function(S,N){if(S)return O(S);try{var F=N.objectStore(w._dbInfo.storeName),H=F.count();H.onsuccess=function(){k(H.result)},H.onerror=function(){O(H.error)}}catch(q){O(q)}})}).catch(O)});return b(m,d),m}function gn(d,w){var m=this,k=new f(function(O,S){if(d<0){O(null);return}m.ready().then(function(){Me(m._dbInfo,p,function(N,F){if(N)return S(N);try{var H=F.objectStore(m._dbInfo.storeName),q=!1,V=H.openKeyCursor();V.onsuccess=function(){var Q=V.result;if(!Q){O(null);return}d===0||q?O(Q.key):(q=!0,Q.advance(d))},V.onerror=function(){S(V.error)}}catch(Q){S(Q)}})}).catch(S)});return b(k,w),k}function Zu(d){var w=this,m=new f(function(k,O){w.ready().then(function(){Me(w._dbInfo,p,function(S,N){if(S)return O(S);try{var F=N.objectStore(w._dbInfo.storeName),H=F.openKeyCursor(),q=[];H.onsuccess=function(){var V=H.result;if(!V){k(q);return}q.push(V.key),V.continue()},H.onerror=function(){O(H.error)}}catch(V){O(V)}})}).catch(O)});return b(m,d),m}function _(d,w){w=A.apply(this,arguments);var m=this.config();d=typeof d!="function"&&d||{},d.name||(d.name=d.name||m.name,d.storeName=d.storeName||m.storeName);var k=this,O;if(!d.name)O=f.reject("Invalid arguments");else{var S=d.name===m.name&&k._dbInfo.db,N=S?f.resolve(k._dbInfo.db):et(d).then(function(F){var H=I[d.name],q=H.forages;H.db=F;for(var V=0;V<q.length;V++)q[V]._dbInfo.db=F;return F});d.storeName?O=N.then(function(F){if(F.objectStoreNames.contains(d.storeName)){var H=F.version+1;W(d);var q=I[d.name],V=q.forages;F.close();for(var Q=0;Q<V.length;Q++){var ae=V[Q];ae._dbInfo.db=null,ae._dbInfo.version=H}var ge=new f(function(_e,Ae){var Oe=l.open(d.name,H);Oe.onerror=function(pt){var Ar=Oe.result;Ar.close(),Ae(pt)},Oe.onupgradeneeded=function(){var pt=Oe.result;pt.deleteObjectStore(d.storeName)},Oe.onsuccess=function(){var pt=Oe.result;pt.close(),_e(pt)}});return ge.then(function(_e){q.db=_e;for(var Ae=0;Ae<V.length;Ae++){var Oe=V[Ae];Oe._dbInfo.db=_e,X(Oe._dbInfo)}}).catch(function(_e){throw(Ce(d,_e)||f.resolve()).catch(function(){}),_e})}}):O=N.then(function(F){W(d);var H=I[d.name],q=H.forages;F.close();for(var V=0;V<q.length;V++){var Q=q[V];Q._dbInfo.db=null}var ae=new f(function(ge,_e){var Ae=l.deleteDatabase(d.name);Ae.onerror=function(){var Oe=Ae.result;Oe&&Oe.close(),_e(Ae.error)},Ae.onblocked=function(){},Ae.onsuccess=function(){var Oe=Ae.result;Oe&&Oe.close(),ge(Oe)}});return ae.then(function(ge){H.db=ge;for(var _e=0;_e<q.length;_e++){var Ae=q[_e];X(Ae._dbInfo)}}).catch(function(ge){throw(Ce(d,ge)||f.resolve()).catch(function(){}),ge})})}return b(O,w),O}var E={_driver:"asyncStorage",_initStorage:Vi,_support:u(),iterate:qo,getItem:Ho,setItem:mn,removeItem:Un,clear:Cr,length:Ki,key:gn,keys:Zu,dropInstance:_};function T(){return typeof openDatabase=="function"}var L="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",j="~~local_forage_type~",M=/^~~local_forage_type~([^~]+)~/,G="__lfsc__:",K=G.length,z="arbf",B="blob",ee="si08",J="ui08",Z="uic8",re="si16",ce="si32",be="ur16",he="ui32",Fe="fl32",Be="fl64",ot=K+z.length,at=Object.prototype.toString;function Xt(d){var w=d.length*.75,m=d.length,k,O=0,S,N,F,H;d[d.length-1]==="="&&(w--,d[d.length-2]==="="&&w--);var q=new ArrayBuffer(w),V=new Uint8Array(q);for(k=0;k<m;k+=4)S=L.indexOf(d[k]),N=L.indexOf(d[k+1]),F=L.indexOf(d[k+2]),H=L.indexOf(d[k+3]),V[O++]=S<<2|N>>4,V[O++]=(N&15)<<4|F>>2,V[O++]=(F&3)<<6|H&63;return q}function Hn(d){var w=new Uint8Array(d),m="",k;for(k=0;k<w.length;k+=3)m+=L[w[k]>>2],m+=L[(w[k]&3)<<4|w[k+1]>>4],m+=L[(w[k+1]&15)<<2|w[k+2]>>6],m+=L[w[k+2]&63];return w.length%3===2?m=m.substring(0,m.length-1)+"=":w.length%3===1&&(m=m.substring(0,m.length-2)+"=="),m}function Ke(d,w){var m="";if(d&&(m=at.call(d)),d&&(m==="[object ArrayBuffer]"||d.buffer&&at.call(d.buffer)==="[object ArrayBuffer]")){var k,O=G;d instanceof ArrayBuffer?(k=d,O+=z):(k=d.buffer,m==="[object Int8Array]"?O+=ee:m==="[object Uint8Array]"?O+=J:m==="[object Uint8ClampedArray]"?O+=Z:m==="[object Int16Array]"?O+=re:m==="[object Uint16Array]"?O+=be:m==="[object Int32Array]"?O+=ce:m==="[object Uint32Array]"?O+=he:m==="[object Float32Array]"?O+=Fe:m==="[object Float64Array]"?O+=Be:w(new Error("Failed to get type for BinaryArray"))),w(O+Hn(k))}else if(m==="[object Blob]"){var S=new FileReader;S.onload=function(){var N=j+d.type+"~"+Hn(this.result);w(G+B+N)},S.readAsArrayBuffer(d)}else try{w(JSON.stringify(d))}catch(N){w(null,N)}}function ht(d){if(d.substring(0,K)!==G)return JSON.parse(d);var w=d.substring(ot),m=d.substring(K,ot),k;if(m===B&&M.test(w)){var O=w.match(M);k=O[1],w=w.substring(O[0].length)}var S=Xt(w);switch(m){case z:return S;case B:return c([S],{type:k});case ee:return new Int8Array(S);case J:return new Uint8Array(S);case Z:return new Uint8ClampedArray(S);case re:return new Int16Array(S);case be:return new Uint16Array(S);case ce:return new Int32Array(S);case he:return new Uint32Array(S);case Fe:return new Float32Array(S);case Be:return new Float64Array(S);default:throw new Error("Unkown type: "+m)}}var qn={serialize:Ke,deserialize:ht,stringToBuffer:Xt,bufferToString:Hn};function Or(d,w,m,k){d.executeSql("CREATE TABLE IF NOT EXISTS "+w.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],m,k)}function Qy(d){var w=this,m={db:null};if(d)for(var k in d)m[k]=typeof d[k]!="string"?d[k].toString():d[k];var O=new f(function(S,N){try{m.db=openDatabase(m.name,String(m.version),m.description,m.size)}catch(F){return N(F)}m.db.transaction(function(F){Or(F,m,function(){w._dbInfo=m,S()},function(H,q){N(q)})},N)});return m.serializer=qn,O}function Zt(d,w,m,k,O,S){d.executeSql(m,k,O,function(N,F){F.code===F.SYNTAX_ERR?N.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[w.storeName],function(H,q){q.rows.length?S(H,F):Or(H,w,function(){H.executeSql(m,k,O,S)},S)},S):S(N,F)},S)}function Xy(d,w){var m=this;d=v(d);var k=new f(function(O,S){m.ready().then(function(){var N=m._dbInfo;N.db.transaction(function(F){Zt(F,N,"SELECT * FROM "+N.storeName+" WHERE key = ? LIMIT 1",[d],function(H,q){var V=q.rows.length?q.rows.item(0).value:null;V&&(V=N.serializer.deserialize(V)),O(V)},function(H,q){S(q)})})}).catch(S)});return b(k,w),k}function Zy(d,w){var m=this,k=new f(function(O,S){m.ready().then(function(){var N=m._dbInfo;N.db.transaction(function(F){Zt(F,N,"SELECT * FROM "+N.storeName,[],function(H,q){for(var V=q.rows,Q=V.length,ae=0;ae<Q;ae++){var ge=V.item(ae),_e=ge.value;if(_e&&(_e=N.serializer.deserialize(_e)),_e=d(_e,ge.key,ae+1),_e!==void 0){O(_e);return}}O()},function(H,q){S(q)})})}).catch(S)});return b(k,w),k}function ef(d,w,m,k){var O=this;d=v(d);var S=new f(function(N,F){O.ready().then(function(){w===void 0&&(w=null);var H=w,q=O._dbInfo;q.serializer.serialize(w,function(V,Q){Q?F(Q):q.db.transaction(function(ae){Zt(ae,q,"INSERT OR REPLACE INTO "+q.storeName+" (key, value) VALUES (?, ?)",[d,V],function(){N(H)},function(ge,_e){F(_e)})},function(ae){if(ae.code===ae.QUOTA_ERR){if(k>0){N(ef.apply(O,[d,H,m,k-1]));return}F(ae)}})})}).catch(F)});return b(S,m),S}function ev(d,w,m){return ef.apply(this,[d,w,m,1])}function tv(d,w){var m=this;d=v(d);var k=new f(function(O,S){m.ready().then(function(){var N=m._dbInfo;N.db.transaction(function(F){Zt(F,N,"DELETE FROM "+N.storeName+" WHERE key = ?",[d],function(){O()},function(H,q){S(q)})})}).catch(S)});return b(k,w),k}function nv(d){var w=this,m=new f(function(k,O){w.ready().then(function(){var S=w._dbInfo;S.db.transaction(function(N){Zt(N,S,"DELETE FROM "+S.storeName,[],function(){k()},function(F,H){O(H)})})}).catch(O)});return b(m,d),m}function rv(d){var w=this,m=new f(function(k,O){w.ready().then(function(){var S=w._dbInfo;S.db.transaction(function(N){Zt(N,S,"SELECT COUNT(key) as c FROM "+S.storeName,[],function(F,H){var q=H.rows.item(0).c;k(q)},function(F,H){O(H)})})}).catch(O)});return b(m,d),m}function iv(d,w){var m=this,k=new f(function(O,S){m.ready().then(function(){var N=m._dbInfo;N.db.transaction(function(F){Zt(F,N,"SELECT key FROM "+N.storeName+" WHERE id = ? LIMIT 1",[d+1],function(H,q){var V=q.rows.length?q.rows.item(0).key:null;O(V)},function(H,q){S(q)})})}).catch(S)});return b(k,w),k}function sv(d){var w=this,m=new f(function(k,O){w.ready().then(function(){var S=w._dbInfo;S.db.transaction(function(N){Zt(N,S,"SELECT key FROM "+S.storeName,[],function(F,H){for(var q=[],V=0;V<H.rows.length;V++)q.push(H.rows.item(V).key);k(q)},function(F,H){O(H)})})}).catch(O)});return b(m,d),m}function ov(d){return new f(function(w,m){d.transaction(function(k){k.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(O,S){for(var N=[],F=0;F<S.rows.length;F++)N.push(S.rows.item(F).name);w({db:d,storeNames:N})},function(O,S){m(S)})},function(k){m(k)})})}function av(d,w){w=A.apply(this,arguments);var m=this.config();d=typeof d!="function"&&d||{},d.name||(d.name=d.name||m.name,d.storeName=d.storeName||m.storeName);var k=this,O;return d.name?O=new f(function(S){var N;d.name===m.name?N=k._dbInfo.db:N=openDatabase(d.name,"","",0),d.storeName?S({db:N,storeNames:[d.storeName]}):S(ov(N))}).then(function(S){return new f(function(N,F){S.db.transaction(function(H){function q(ge){return new f(function(_e,Ae){H.executeSql("DROP TABLE IF EXISTS "+ge,[],function(){_e()},function(Oe,pt){Ae(pt)})})}for(var V=[],Q=0,ae=S.storeNames.length;Q<ae;Q++)V.push(q(S.storeNames[Q]));f.all(V).then(function(){N()}).catch(function(ge){F(ge)})},function(H){F(H)})})}):O=f.reject("Invalid arguments"),b(O,w),O}var lv={_driver:"webSQLStorage",_initStorage:Qy,_support:T(),iterate:Zy,getItem:Xy,setItem:ev,removeItem:tv,clear:nv,length:rv,key:iv,keys:sv,dropInstance:av};function cv(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function tf(d,w){var m=d.name+"/";return d.storeName!==w.storeName&&(m+=d.storeName+"/"),m}function uv(){var d="_localforage_support_test";try{return localStorage.setItem(d,!0),localStorage.removeItem(d),!1}catch{return!0}}function fv(){return!uv()||localStorage.length>0}function dv(d){var w=this,m={};if(d)for(var k in d)m[k]=d[k];return m.keyPrefix=tf(d,w._defaultConfig),fv()?(w._dbInfo=m,m.serializer=qn,f.resolve()):f.reject()}function hv(d){var w=this,m=w.ready().then(function(){for(var k=w._dbInfo.keyPrefix,O=localStorage.length-1;O>=0;O--){var S=localStorage.key(O);S.indexOf(k)===0&&localStorage.removeItem(S)}});return b(m,d),m}function pv(d,w){var m=this;d=v(d);var k=m.ready().then(function(){var O=m._dbInfo,S=localStorage.getItem(O.keyPrefix+d);return S&&(S=O.serializer.deserialize(S)),S});return b(k,w),k}function mv(d,w){var m=this,k=m.ready().then(function(){for(var O=m._dbInfo,S=O.keyPrefix,N=S.length,F=localStorage.length,H=1,q=0;q<F;q++){var V=localStorage.key(q);if(V.indexOf(S)===0){var Q=localStorage.getItem(V);if(Q&&(Q=O.serializer.deserialize(Q)),Q=d(Q,V.substring(N),H++),Q!==void 0)return Q}}});return b(k,w),k}function gv(d,w){var m=this,k=m.ready().then(function(){var O=m._dbInfo,S;try{S=localStorage.key(d)}catch{S=null}return S&&(S=S.substring(O.keyPrefix.length)),S});return b(k,w),k}function yv(d){var w=this,m=w.ready().then(function(){for(var k=w._dbInfo,O=localStorage.length,S=[],N=0;N<O;N++){var F=localStorage.key(N);F.indexOf(k.keyPrefix)===0&&S.push(F.substring(k.keyPrefix.length))}return S});return b(m,d),m}function vv(d){var w=this,m=w.keys().then(function(k){return k.length});return b(m,d),m}function bv(d,w){var m=this;d=v(d);var k=m.ready().then(function(){var O=m._dbInfo;localStorage.removeItem(O.keyPrefix+d)});return b(k,w),k}function _v(d,w,m){var k=this;d=v(d);var O=k.ready().then(function(){w===void 0&&(w=null);var S=w;return new f(function(N,F){var H=k._dbInfo;H.serializer.serialize(w,function(q,V){if(V)F(V);else try{localStorage.setItem(H.keyPrefix+d,q),N(S)}catch(Q){(Q.name==="QuotaExceededError"||Q.name==="NS_ERROR_DOM_QUOTA_REACHED")&&F(Q),F(Q)}})})});return b(O,m),O}function wv(d,w){if(w=A.apply(this,arguments),d=typeof d!="function"&&d||{},!d.name){var m=this.config();d.name=d.name||m.name,d.storeName=d.storeName||m.storeName}var k=this,O;return d.name?O=new f(function(S){d.storeName?S(tf(d,k._defaultConfig)):S(d.name+"/")}).then(function(S){for(var N=localStorage.length-1;N>=0;N--){var F=localStorage.key(N);F.indexOf(S)===0&&localStorage.removeItem(F)}}):O=f.reject("Invalid arguments"),b(O,w),O}var xv={_driver:"localStorageWrapper",_initStorage:dv,_support:cv(),iterate:mv,getItem:pv,setItem:_v,removeItem:bv,clear:hv,length:vv,key:gv,keys:yv,dropInstance:wv},Sv=function(w,m){return w===m||typeof w=="number"&&typeof m=="number"&&isNaN(w)&&isNaN(m)},Ev=function(w,m){for(var k=w.length,O=0;O<k;){if(Sv(w[O],m))return!0;O++}return!1},nf=Array.isArray||function(d){return Object.prototype.toString.call(d)==="[object Array]"},Pr={},rf={},Wn={INDEXEDDB:E,WEBSQL:lv,LOCALSTORAGE:xv},$v=[Wn.INDEXEDDB._driver,Wn.WEBSQL._driver,Wn.LOCALSTORAGE._driver],Yi=["dropInstance"],Wo=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Yi),kv={description:"",driver:$v.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Cv(d,w){d[w]=function(){var m=arguments;return d.ready().then(function(){return d[w].apply(d,m)})}}function zo(){for(var d=1;d<arguments.length;d++){var w=arguments[d];if(w)for(var m in w)w.hasOwnProperty(m)&&(nf(w[m])?arguments[0][m]=w[m].slice():arguments[0][m]=w[m])}return arguments[0]}var Ov=function(){function d(w){o(this,d);for(var m in Wn)if(Wn.hasOwnProperty(m)){var k=Wn[m],O=k._driver;this[m]=O,Pr[O]||this.defineDriver(k)}this._defaultConfig=zo({},kv),this._config=zo({},this._defaultConfig,w),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return d.prototype.config=function(m){if((typeof m>"u"?"undefined":s(m))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var k in m){if(k==="storeName"&&(m[k]=m[k].replace(/\W/g,"_")),k==="version"&&typeof m[k]!="number")return new Error("Database version must be a number.");this._config[k]=m[k]}return"driver"in m&&m.driver?this.setDriver(this._config.driver):!0}else return typeof m=="string"?this._config[m]:this._config},d.prototype.defineDriver=function(m,k,O){var S=new f(function(N,F){try{var H=m._driver,q=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!m._driver){F(q);return}for(var V=Wo.concat("_initStorage"),Q=0,ae=V.length;Q<ae;Q++){var ge=V[Q],_e=!Ev(Yi,ge);if((_e||m[ge])&&typeof m[ge]!="function"){F(q);return}}var Ae=function(){for(var Ar=function(Iv){return function(){var Tv=new Error("Method "+Iv+" is not implemented by the current driver"),sf=f.reject(Tv);return b(sf,arguments[arguments.length-1]),sf}},Vo=0,Av=Yi.length;Vo<Av;Vo++){var Ko=Yi[Vo];m[Ko]||(m[Ko]=Ar(Ko))}};Ae();var Oe=function(Ar){Pr[H],Pr[H]=m,rf[H]=Ar,N()};"_support"in m?m._support&&typeof m._support=="function"?m._support().then(Oe,F):Oe(!!m._support):Oe(!0)}catch(pt){F(pt)}});return y(S,k,O),S},d.prototype.driver=function(){return this._driver||null},d.prototype.getDriver=function(m,k,O){var S=Pr[m]?f.resolve(Pr[m]):f.reject(new Error("Driver not found."));return y(S,k,O),S},d.prototype.getSerializer=function(m){var k=f.resolve(qn);return y(k,m),k},d.prototype.ready=function(m){var k=this,O=k._driverSet.then(function(){return k._ready===null&&(k._ready=k._initDriver()),k._ready});return y(O,m,m),O},d.prototype.setDriver=function(m,k,O){var S=this;nf(m)||(m=[m]);var N=this._getSupportedDrivers(m);function F(){S._config.driver=S.driver()}function H(Q){return S._extend(Q),F(),S._ready=S._initStorage(S._config),S._ready}function q(Q){return function(){var ae=0;function ge(){for(;ae<Q.length;){var _e=Q[ae];return ae++,S._dbInfo=null,S._ready=null,S.getDriver(_e).then(H).catch(ge)}F();var Ae=new Error("No available storage method found.");return S._driverSet=f.reject(Ae),S._driverSet}return ge()}}var V=this._driverSet!==null?this._driverSet.catch(function(){return f.resolve()}):f.resolve();return this._driverSet=V.then(function(){var Q=N[0];return S._dbInfo=null,S._ready=null,S.getDriver(Q).then(function(ae){S._driver=ae._driver,F(),S._wrapLibraryMethodsWithReady(),S._initDriver=q(N)})}).catch(function(){F();var Q=new Error("No available storage method found.");return S._driverSet=f.reject(Q),S._driverSet}),y(this._driverSet,k,O),this._driverSet},d.prototype.supports=function(m){return!!rf[m]},d.prototype._extend=function(m){zo(this,m)},d.prototype._getSupportedDrivers=function(m){for(var k=[],O=0,S=m.length;O<S;O++){var N=m[O];this.supports(N)&&k.push(N)}return k},d.prototype._wrapLibraryMethodsWithReady=function(){for(var m=0,k=Wo.length;m<k;m++)Cv(this,Wo[m])},d.prototype.createInstance=function(m){return new d(m)},d}(),Pv=new Ov;r.exports=Pv},{3:3}]},{},[4])(4)})}(ds)),ds.exports}var ud=cd();const va=ld(ud);class fd extends yn{constructor(e){super(e,"storage",!1),e.set("localforage",va)}get StorageManager(){return Ur}createDatabse(e,n,r){return new Ur("InPageEdit",e,n,r)}}const Fn=class Fn{constructor(e,n,r=Fn.DEFAULT_TTL,i){this.dbName=e,this.storeName=n,this.ttl=r,this.version=i,this.db=Fn.createDatabase(e,n),this.keys=this.db.keys.bind(this.db)}static createDatabase(e,n){const r=`${e}:${n}`;if(this._cached_db_instances.has(r))return this._cached_db_instances.get(r);const i=va.createInstance({name:e,storeName:n});return this._cached_db_instances.set(r,i),i}async get(e,n=this.ttl,r){const i=await this.loadFromDB(e),s=this.checkIfExpired(i,n);if(!i||s){if(typeof r=="function"){const o=await r();return this.set(e,o).then(()=>o)}return null}return i.value}async set(e,n){return n===null||typeof n>"u"?this.delete(e):this.db.setItem(e,{time:Date.now(),value:n,version:this.version})}async has(e,n=this.ttl){const r=await this.loadFromDB(e),i=this.checkIfExpired(r,n);return r!==null&&!i}async delete(e){return this.db.removeItem(e)}async iterate(e){return await this.db.iterate((n,r)=>{e(n.value,r)})}async loadFromDB(e){const n=await this.db.getItem(e);if(!n)return null;if(typeof n.time!="number"||typeof n.value>"u"){try{this.delete(e)}catch{}return null}if(typeof this.version=="number"&&n.version!==this.version){try{this.delete(e)}catch{}return null}return n}checkIfExpired(e,n=this.ttl){return e?Date.now()-e.time>n:!1}async clear(){return await this.db.clear(),this}};Fn.DEFAULT_TTL=1/0,Fn._cached_db_instances=new Map;let Ur=Fn;var dd=Object.create,hs=Object.defineProperty,hd=Object.getOwnPropertyDescriptor,ba=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),_a=t=>{throw TypeError(t)},pd=(t,e,n)=>e in t?hs(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,md=(t,e)=>hs(t,"name",{value:e,configurable:!0}),gd=t=>[,,,dd(t?.[ba("metadata")]??null)],yd=["class","method","getter","setter","accessor","field","value","get","set"],wa=t=>t!==void 0&&typeof t!="function"?_a("Function expected"):t,vd=(t,e,n,r,i)=>({kind:yd[t],name:e,metadata:r,addInitializer:s=>n._?_a("Already initialized"):i.push(wa(s||null))}),bd=(t,e)=>pd(e,ba("metadata"),t[3]),_d=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},wd=(t,e,n,r,i,s)=>{var o,a,l,u=e&7,c=!1,f=0,b=t[f]||(t[f]=[]),y=u&&(i=i.prototype,u<5&&(u>3||!c)&&hd(i,n));md(i,n);for(var v=r.length-1;v>=0;v--)l=vd(u,n,a={},t[3],b),o=(0,r[v])(i,l),a._=1,wa(o)&&(i=o);return bd(t,i),y&&hs(i,n,y),c?u^4?s:y:i},xa,ps,Sa;xa=[Ye(["api","storage"])];class Hr extends(Sa=yn){constructor(e){super(e,"sitemeta",!1),this.ctx=e,this._data=void 0,this.siteIdentity=void 0,this.CACHE_TTL=1e3*60*60*24,this.VERSION=2,this.db=void 0,this.queryData={meta:"siteinfo|userinfo",siprop:"general|specialpagealiases|namespacealiases|namespaces|magicwords",uiprop:"groups|rights|blockinfo|options"},this.db=e.storage.createDatabse("sitemeta",this.CACHE_TTL,this.VERSION)}get api(){return this.ctx.api}get mwConfig(){return mw.config.values}async start(){const e=await this.fetchFromCache();if(e){this.ctx.logger("SiteMetadataService").info("Using cached metadata"),this._data=e;return}const n=await this.fetchFromApi();this.saveToCache(n),this._data=n}async computeSiteIdentity(){if(this.siteIdentity)return this.siteIdentity;let e;if(!window.mw?.config)e=new URL(location.href).origin;else{const{wgServer:n,wgArticlePath:r}=window.mw.config.get();e=`${n}${r}`}return this.siteIdentity=e,this.siteIdentity}async fetchFromApi(){return this.api.get({action:"query",...this.queryData}).then(({data:e})=>{if(typeof e?.query?.general>"u")throw new Error("Invalid siteinfo");return e.query}).catch(e=>(this.ctx.logger.error("[InPageEdit]","fetchMetadata error",e),Promise.reject(e)))}async fetchFromCache(){const e=await this.computeSiteIdentity();return this.db.get(e)}async saveToCache(e){const n=await this.computeSiteIdentity();return this.db.set(n,e)}get _raw(){return this._data}get siteInfo(){return this._data.general}get specialPageAliases(){return this._data.specialpagealiases}get namespaceAliases(){return this._data.namespacealiases}get namespaces(){return this._data.namespaces}get namespaceMap(){const e=Object.values(this.namespaces).map(n=>({id:n.id,canonical:n.canonical,aliases:this.namespaceAliases.filter(r=>r.id===n.id).map(r=>r.alias)})).sort((n,r)=>n.id-r.id);return Reflect.defineProperty(this,"namespaceMap",{value:e,writable:!1,configurable:!1,enumerable:!0}),e}get magicWords(){return this._data.magicwords}get userInfo(){return this._data.userinfo}get userOptions(){return this.userInfo.options}get isUserBlocked(){return this.userInfo.blockedbyid&&this.userInfo.blockexpiry&&new Date(this.userInfo.blockexpiry).getTime()>Date.now()}get userGroups(){return this.userInfo.groups}get userRights(){return this.userInfo.rights}hasRight(e){return this.userRights.includes(e)}hasAnyRight(...e){return e.some(n=>this.hasRight(n))}hasEveryRights(...e){return e.every(n=>this.hasRight(n))}inGroup(e){return this.userGroups.includes(e)}inAnyGroup(...e){return this.userGroups.some(n=>e.includes(n))}getBlockInfo(){return this.isUserBlocked?{blockid:this.userInfo.blockid,blockedby:this.userInfo.blockedbyid,blockedbyid:this.userInfo.blockedbyid,blockreason:this.userInfo.blockreason,blockedtimestamp:this.userInfo.blockedtimestamp,blockexpiry:this.userInfo.blockexpiry}:null}}ps=gd(Sa),Hr=wd(ps,0,"SiteMetadataService",xa,Hr),_d(ps,1,Hr);const qi=class qi{constructor(e,n){this.pageInfo={...qi.DEFAULT_PAGE_INFO,...e},this.api=n||new ga}async getPageInfo(e){const{data:{query:{pages:[n]}}}=await this.api.get({action:"query",prop:"info|templates|transcludedin|images|pageimages|revisions",inprop:"protection|url|varianttitles",intestactions:"edit|move|delete",tllimit:"max",tilimit:"max",imlimit:"max",piprop:"thumbnail|name|original",pithumbsize:"200",pilimit:"max",rvprop:"ids|timestamp|flags|comment|user|content",...e});return n.revisions?.forEach(r=>{if(typeof r.slots=="object"){const i=r.slots.main;i&&(r.content=i.content,r.contentmodel=i.contentmodel,r.contentformat=i.contentformat)}}),n}async parse(e){return this.api.post({action:"parse",page:this.pageInfo.title,prop:"text|langlinks|categories|links|templates|images|externallinks|sections|revid|displaytitle|iwlinks|properties|parsewarnings",...e})}async preview(e,n){return this.parse({action:"parse",page:void 0,title:this.title,text:e,pst:1,preview:1,disableeditsection:1,disablelimitreport:1,...n})}async edit(e,n){const{text:r,prependtext:i,appendtext:s,summary:o="",watchlist:a="preferences"}=e;return this.api.postWithEditToken({action:"edit",title:this.title,starttimestamp:this.pageInfo.touched,basetimestamp:this.revisions[0]?.timestamp,text:r,prependtext:i,appendtext:s,summary:o,watchlist:a,...n})}async createOnly(e,n){return this.edit(e,{createonly:1,...n})}async delete(e,n){return this.api.postWithEditToken({action:"delete",pageid:this.pageInfo.pageid,reason:e,...n})}async moveTo(e,n,r){return this.api.postWithEditToken({action:"move",from:this.pageInfo.title,to:e,reason:n,movetalk:1,movesubpages:1,...r})}userCan(e){return this.pageInfo?.actions?.[e]}userCanEdit(){return this.userCan("edit")}async refetch(){const e=await this.getPageInfo({pageids:this.pageInfo.pageid,titles:this.pageInfo.title}),n=(this.pageInfo.revisions||[]).concat(e.revisions||[]).sort((r,i)=>r.revid-i.revid).reduce((r,i)=>(r.find(s=>s.revid===i.revid)||r.push(i),r),[]);return this.pageInfo=e,this.pageInfo.revisions=n,this}get pageid(){return this.pageInfo.pageid}get title(){return this.pageInfo.title}get ns(){return this.pageInfo.ns}get contentmodel(){return this.pageInfo.contentmodel}get fullurl(){return this.pageInfo.fullurl}get canonicalurl(){return this.pageInfo.canonicalurl}get editurl(){return this.pageInfo.editurl}get revisions(){return this.pageInfo.revisions||[]}get templates(){return this.pageInfo.templates||[]}get images(){return this.pageInfo.images||[]}};qi.DEFAULT_PAGE_INFO={pageid:0,ns:0,title:"",contentmodel:"wikitext",pagelanguage:"",pagelanguagehtmlcode:"",pagelanguagedir:"ltr",touched:new Date().toISOString(),lastrevid:0,length:0,protection:[],restrictiontypes:[],fullurl:"",canonicalurl:"",editurl:"",varianttitles:{},actions:{edit:!0,move:!1,delete:!1},revisions:[],templates:[],images:[]};let Gn=qi;const Fo=class Fo extends yn{constructor(e){super(e,"wikiPage",!0),this.ctx=e}get WikiPage(){return Gn}async createInstance(e){const{data:{query:{pages:[n]}}}=await this.ctx.api.get({action:"query",prop:"info|templates|transcludedin|images|pageimages|revisions",inprop:"protection|url|varianttitles",intestactions:"edit|move|delete",tllimit:"max",tilimit:"max",imlimit:"max",piprop:"thumbnail|name|original",pithumbsize:"200",pilimit:"max",rvprop:"ids|timestamp|user|userid|content",...e});return new Gn(n,this.ctx.api)}async newFromTitle(e,n=!1,r){return this.createInstance({titles:e,converttitles:n,rvsection:r})}async newFromPageId(e,n){return this.createInstance({pageids:e,rvsection:n})}async newFromRevision(e,n){return this.createInstance({revids:e,rvsection:n})}newBlankPage(e={}){return new Gn(e,this.ctx.api)}};Fo.inject=["api"];let ms=Fo;const qr=Object.keys;function xd(t){return typeof t=="boolean"}function Sd(t){return t&&typeof t.nodeType=="number"}function Wr(t){return typeof t=="string"}function Ea(t){return typeof t=="number"}function nn(t){return typeof t=="object"?t!==null:Jn(t)}function Jn(t){return typeof t=="function"}function Ed(t){return!!(t&&t.isComponent)}function $d(t){return nn(t)&&typeof t.length=="number"&&typeof t.nodeType!="number"}function gs(t,e){if(t)for(const n of qr(t))e(t[n],n)}function kd(t){return nn(t)&&"current"in t}const ys={animationIterationCount:0,borderImageOutset:0,borderImageSlice:0,borderImageWidth:0,boxFlex:0,boxFlexGroup:0,boxOrdinalGroup:0,columnCount:0,columns:0,flex:0,flexGrow:0,flexPositive:0,flexShrink:0,flexNegative:0,flexOrder:0,gridArea:0,gridRow:0,gridRowEnd:0,gridRowSpan:0,gridRowStart:0,gridColumn:0,gridColumnEnd:0,gridColumnSpan:0,gridColumnStart:0,fontWeight:0,lineClamp:0,lineHeight:0,opacity:0,order:0,orphans:0,tabSize:0,widows:0,zIndex:0,zoom:0,fillOpacity:0,floodOpacity:0,stopOpacity:0,strokeDasharray:0,strokeDashoffset:0,strokeMiterlimit:0,strokeOpacity:0,strokeWidth:0};function Cd(t,e){return t+e.charAt(0).toUpperCase()+e.substring(1)}const Od=["Webkit","ms","Moz","O"];qr(ys).forEach(t=>{Od.forEach(e=>{ys[Cd(e,t)]=0})});const Pd=Symbol.for("jsx-dom:type");var $a=function(t){return t.ShadowRoot="ShadowRoot",t}($a||{});function Ad(t){return t!=null&&t[Pd]===$a.ShadowRoot}const Id="http://www.w3.org/2000/svg",Td="http://www.w3.org/1999/xlink",Rd="http://www.w3.org/XML/1998/namespace";function ka(t){return!xd(t)&&t!=null}function vs(t){return Array.isArray(t)?t.map(vs).filter(Boolean).join(" "):nn(t)?Symbol.iterator in t?vs(Array.from(t)):qr(t).filter(e=>t[e]).join(" "):ka(t)?""+t:""}const Nd={animate:0,circle:0,clipPath:0,defs:0,desc:0,ellipse:0,feBlend:0,feColorMatrix:0,feComponentTransfer:0,feComposite:0,feConvolveMatrix:0,feDiffuseLighting:0,feDisplacementMap:0,feDistantLight:0,feFlood:0,feFuncA:0,feFuncB:0,feFuncG:0,feFuncR:0,feGaussianBlur:0,feImage:0,feMerge:0,feMergeNode:0,feMorphology:0,feOffset:0,fePointLight:0,feSpecularLighting:0,feSpotLight:0,feTile:0,feTurbulence:0,filter:0,foreignObject:0,g:0,image:0,line:0,linearGradient:0,marker:0,mask:0,metadata:0,path:0,pattern:0,polygon:0,polyline:0,radialGradient:0,rect:0,stop:0,svg:0,switch:0,symbol:0,text:0,textPath:0,tspan:0,use:0,view:0},Dd=/^(a(ll|t|u)|base[FP]|c(al|lipPathU|on)|di|ed|ex|filter[RU]|g(lyphR|r)|ke|l(en|im)|ma(rker[HUW]|s)|n|pat|pr|point[^e]|re[^n]|s[puy]|st[^or]|ta|textL|vi|xC|y|z)/;function Qn(t){const e=document.createDocumentFragment();return zr(t.children,e),e}function Ld(t,e,n){e={...e,children:n};const r=new t(e),i=r.render();return"ref"in e&&bs(e.ref,r),i}function C(t,e){let{children:n,...r}=e;!r.namespaceURI&&Nd[t]===0&&(r={...r,namespaceURI:Id});let i;if(Wr(t)){if(i=r.namespaceURI?document.createElementNS(r.namespaceURI,t):document.createElement(t),Bd(r,i),zr(n,i),i instanceof window.HTMLSelectElement&&r.value!=null)if(r.multiple===!0&&Array.isArray(r.value)){const s=r.value.map(o=>String(o));i.querySelectorAll("option").forEach(o=>o.selected=s.includes(o.value))}else i.value=r.value;bs(r.ref,i)}else if(Jn(t))nn(t.defaultProps)&&(r={...t.defaultProps,...r}),i=Ed(t)?Ld(t,r,n):t({...r,children:n});else throw new TypeError(`Invalid JSX element type: ${t}`);return i}function jd(t,e){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return(Wr(e)||Array.isArray(e))&&(r.unshift(e),e={}),e=e||{},e.children!=null&&!r.length&&({children:r,...e}=e),C(t,{...e,children:r},e.key)}function bs(t,e){kd(t)?t.current=e:Jn(t)&&t(e)}function zr(t,e){if($d(t))Md(t,e);else if(Wr(t)||Ea(t))_s(document.createTextNode(t),e);else if(t===null)_s(document.createComment(""),e);else if(Sd(t))_s(t,e);else if(Ad(t)){const n=e.attachShadow(t.attr);zr(t.children,n),bs(t.ref,n)}}function Md(t,e){for(const n of[...t])zr(n,e);return e}function _s(t,e){e instanceof window.HTMLTemplateElement?e.content.appendChild(t):e.appendChild(t)}function Vr(t,e){return t.replace(/[A-Z]/g,n=>e+n.toLowerCase())}function Ca(t,e){e==null||e===!1||(Array.isArray(e)?e.forEach(n=>Ca(t,n)):Wr(e)?t.setAttribute("style",e):nn(e)&&gs(e,(n,r)=>{r.indexOf("-")===0?t.style.setProperty(r,n):Ea(n)&&ys[r]!==0?t.style[r]=n+"px":t.style[r]=n}))}function Fd(t,e,n){switch(t){case"xlinkActuate":case"xlinkArcrole":case"xlinkHref":case"xlinkRole":case"xlinkShow":case"xlinkTitle":case"xlinkType":Oa(n,Td,Vr(t,":"),e);return;case"xmlnsXlink":bn(n,Vr(t,":"),e);return;case"xmlBase":case"xmlLang":case"xmlSpace":Oa(n,Rd,Vr(t,":"),e);return}switch(t){case"htmlFor":bn(n,"for",e);return;case"dataset":gs(e,(r,i)=>{r!=null&&(n.dataset[i]=r)});return;case"innerHTML":case"innerText":case"textContent":ka(e)&&(n[t]=e);return;case"dangerouslySetInnerHTML":nn(e)&&(n.innerHTML=e.__html);return;case"value":if(e==null||n instanceof window.HTMLSelectElement)return;if(n instanceof window.HTMLTextAreaElement){n.value=e;return}break;case"spellCheck":n.spellcheck=e;return;case"class":case"className":Jn(e)?e(n):bn(n,"class",vs(e));return;case"ref":case"namespaceURI":return;case"style":Ca(n,e);return;case"on":case"onCapture":gs(e,(r,i)=>{n.addEventListener(i,r,t==="onCapture")});return}if(Jn(e)){if(t[0]==="o"&&t[1]==="n"){let r=t.toLowerCase();const i=r.endsWith("capture");if(r==="ondoubleclick"?r="ondblclick":i&&r==="ondoubleclickcapture"&&(r="ondblclickcapture"),!i&&n[r]===null)n[r]=e;else if(i)n.addEventListener(r.substring(2,r.length-7),e,!0);else{let s;r in window?s=r.substring(2):s=r[2]+t.slice(3),n.addEventListener(s,e)}}}else nn(e)?n[t]=e:e===!0?bn(n,t,""):e!==!1&&e!=null&&(n instanceof SVGElement&&!Dd.test(t)?bn(n,Vr(t,"-"),e):bn(n,t,e))}function bn(t,e,n){t.setAttribute(e,n)}function Oa(t,e,n,r){t.setAttributeNS(e,n,r)}function Bd(t,e){for(const n of qr(t))Fd(n,t[n],e);return e}var ws=(t=>(t.Init="modal.init",t.BeforeShow="modal.beforeShow",t.Show="modal.show",t.BeforeClose="modal.beforeClose",t.Close="modal.close",t.Destroy="modal.destroy",t.ToastShow="toast.show",t.ToastClose="toast.close",t))(ws||{});let Ud=0;const Pa=t=>`${t}-${++Ud}`;function Xn(t){return t instanceof Node?t:document.createTextNode(String(t))}function It(t,e){if(!t)throw new Error(`${e??"Element"} not found`);return t}function Aa(t){const e=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(",");return Array.from(t.querySelectorAll(e)).filter(n=>!!(n.offsetWidth||n.offsetHeight||n.getClientRects().length))}function qe(t,e={}){const n=document.createElement(t);if(e.className&&(n.className=e.className),e.html!=null&&(n.innerHTML=e.html),e.text!=null&&(n.textContent=e.text),e.attrs)for(const[r,i]of Object.entries(e.attrs))n.setAttribute(r,i);return n}class Hd{constructor(){this.zBase=1e3,this.stack=[]}push(e){this.stack.push(e),this.syncZ()}remove(e){this.stack=this.stack.filter(n=>n!==e),this.syncZ()}top(){return this.stack[this.stack.length-1]}closeAll(e,n){const r=new Set((Array.isArray(n)?n:n?[n]:[]).map(String)),i=new Set((Array.isArray(e)?e:e?[e]:[]).map(String));[...this.stack].reverse().forEach(s=>{const o=s.modalId,a=i.size?i.has(s.pluginName):!0,l=r.has(o);a&&!l&&s.close()})}removeAll(){[...this.stack].forEach(e=>e.destroy()),this.stack=[]}syncZ(){this.stack.forEach((e,n)=>e.setZIndex(this.zBase+n*2))}lockBodyScroll(){document.documentElement.classList.add("ipe-modal-no-scroll")}unlockBodyScroll(){document.documentElement.classList.remove("ipe-modal-no-scroll")}}const Qe=new Hd,Wi=class Wi{constructor(e={}){this.backdropId=Pa("ipe-modal-backdrop"),this.modalId=Pa("ipe-modal"),this.numberId=this.modalId.split("-")[1],this._isDestroyed=!1,this.pluginName="normalModal",this.buttonElsLeft=[],this.buttonElsRight=[],this.keyMap=new Map,this.isOpen=!1,this.isToast=!1,this.isDragging=!1,this.dragStartX=0,this.dragStartY=0,this.modalStartX=0,this.modalStartY=0,this.Event=ws,this.DEFAULT_OPTIONS={className:"",sizeClass:"auto",center:!0,fitScreen:!1,closeIcon:!0,bodyScroll:!1,outSideClose:!0,backdrop:!0,animation:!1,animationSpeed:200},this._hooks=[],this.startCloseTimer=n=>{this.stopCloseTimer(),this.closeTimer=window.setTimeout(()=>this.close(),n)},this.stopCloseTimer=()=>{this.closeTimer&&window.clearTimeout(this.closeTimer),this.closeTimer=void 0},this.onDragMove=n=>{if(!this.isDragging)return;n.preventDefault();const r=n.clientX-this.dragStartX,i=n.clientY-this.dragStartY,s=this.get$modal(),o=this.modalStartX+r,a=this.modalStartY+i;s.style.left=`${o}px`,s.style.top=`${a}px`},this.onDragEnd=()=>{if(!this.isDragging)return;this.isDragging=!1,document.removeEventListener("pointermove",this.onDragMove),document.removeEventListener("pointerup",this.onDragEnd),this.get$modal().classList.remove("is-dragging")},this.options={...this.DEFAULT_OPTIONS,...e},this.options.backdrop===!1&&e.bodyScroll===void 0&&(this.options.bodyScroll=!0)}get isDestroyed(){return this._isDestroyed}init(){if(this.$modal)return this;const e=this.options.backdrop!==!1;let n;e&&(n=qe("div",{className:"ipe-modal-backdrop",attrs:{id:this.backdropId,"data-modal-id":this.modalId}}));const r=qe("div",{className:"ipe-modal-modal",attrs:{id:this.modalId,role:"dialog","aria-modal":"true",tabindex:"-1"}});if(r.modal=this,!e){r.classList.add("no-backdrop");const y=window.pageYOffset||document.documentElement.scrollTop,v=window.pageXOffset||document.documentElement.scrollLeft,A=window.innerWidth;r.style.top=`${y+60}px`,this.once("modal.show",()=>{r.style.left=`${v+A/2-r.offsetWidth/2}px`})}const i=qe("div",{className:`ipe-modal-modal__window size--${this.options.sizeClass||"auto"} plugin--${this.pluginName}`});i.modal=this;const s=qe("div",{className:"ipe-modal-modal__header"}),o=`${this.modalId}-title`,a=qe("h2",{className:"ipe-modal-modal__title",attrs:{id:o,role:"heading","aria-level":"2"}});r.setAttribute("aria-labelledby",o);const l=qe("div",{className:"ipe-modal-modal__icons"});if(this.options.closeIcon){const y=qe("button",{className:"ipe-modal-modal__close",attrs:{type:"button","aria-label":"Close"},html:"×"});y.addEventListener("click",()=>{let v=!0;typeof this.options.onClickClose=="function"?this.options.onClickClose(this)===!1&&(v=!1):this.options.onClickClose===!1&&(v=!1),v&&this.close()}),l.appendChild(y)}s.append(a,l),!e&&this.options.draggable&&(s.style.cursor="move",s.style.userSelect="none",s.addEventListener("pointerdown",this.onDragStart.bind(this)));const u=qe("div",{className:"ipe-modal-modal__content"}),c=qe("div",{className:"ipe-modal-modal__footer"}),f=qe("div",{className:"ipe-modal-modal__buttons ipe-modal-modal__buttons--left"}),b=qe("div",{className:"ipe-modal-modal__buttons ipe-modal-modal__buttons--right"});return c.append(f,b),i.append(s,u,c),r.appendChild(i),this.$backdrop=n,this.$modal=r,this.$window=i,this.$header=s,this.$title=a,this.$icons=l,this.$content=u,this.$footer=c,this.$buttonsLeft=f,this.$buttonsRight=b,this.options.title&&this.setTitle(this.options.title),this.options.content&&this.setContent(this.options.content),this.options.buttons?.length?this.setButtons(this.options.buttons):c.style.display="none",this.options.center&&this.$modal.classList.add("is-centered"),this.options.fitScreen&&this.$modal.classList.add("is-fullscreen"),this.options.iconButtons&&this.$header.classList.add("has-icon-buttons"),this.options.className&&this.$window.classList.add(...this.options.className.split(/[\s\.#+]+/g).filter(Boolean)),typeof this.options.fixedHeight=="number"?this.$window.style.height=`${Math.max(0,this.options.fixedHeight)}px`:this.options.fixedHeight===!0&&this.$window.classList.add("is-fixed-height"),n&&n.addEventListener("pointerdown",y=>{this.options.outSideClose&&y.target===n&&this.close()}),this.onKeyDown=this.onKeyDown.bind(this),this.emit("modal.init"),this}show(){if(this.$modal||this.init(),!this.$modal)throw new Error("Failed to initialize modal");if(this.isOpen)return this;{const r=this.emit("modal.beforeShow",!0),i=this.options.beforeShow?this.options.beforeShow(this)!==!1:!0;if(!r||!i)return this}this.lastFocused=document.activeElement??null,this.$backdrop&&document.body.appendChild(this.$backdrop),document.body.appendChild(this.$modal),this.shouldLockBodyOnOpen()&&Qe.lockBodyScroll(),requestAnimationFrame(()=>{this.$backdrop?.classList.add("is-open"),this.$modal.classList.add("is-open"),this.applyAnimation(!0),this.focusFirst()}),document.addEventListener("keydown",this.onKeyDown),Qe.push(this),this.isOpen=!0,this.options.onShow?.(this),this.emit("modal.show");const e=typeof this.options.closeAfter=="number"?this.options.closeAfter:this.options.closeAfter?.time,n=typeof this.options.closeAfter=="number"?!0:this.options.closeAfter?.resetOnHover;return e&&(this.startCloseTimer(e),n&&(this.$window?.addEventListener("mouseenter",this.stopCloseTimer),this.$window?.addEventListener("mouseleave",()=>this.startCloseTimer(e)))),this}close(){if(!this.isOpen)return this;{const s=this.emit("modal.beforeClose",!0),o=this.options.beforeClose?this.options.beforeClose(this)!==!1:!0;if(!s||!o)return this}if(this.isToast)return this.emit("modal.close"),this.emit("toast.close"),this.destroy(),this.options.onClose?.(this),this;this.applyAnimation(!1),this.$backdrop?.classList.remove("is-open"),this.$modal?.classList.remove("is-open"),this.emit("modal.close");const e=this.isAnimationDisabled()?0:this.options.animationSpeed??200;let n=!1;const r=()=>{n||(n=!0,this.destroy(),this.options.onClose?.(this))},i=(s,o)=>{const a=()=>{s.removeEventListener(o,a),r()};s.addEventListener(o,a,{once:!0})};return e>0&&this.$window?(i(this.$window,"transitionend"),i(this.$window,"animationend"),window.setTimeout(r,e+20)):window.setTimeout(r,e),this}destroy(){if(this._isDestroyed)return this;if(this.stopCloseTimer(),document.removeEventListener("keydown",this.onKeyDown),this.isDragging&&this.onDragEnd(),this.$window?.removeEventListener("mouseenter",this.stopCloseTimer),this.isToast){this.$window?.parentElement&&this.$window.parentElement.removeChild(this.$window);const e=rn.indexOf(this);e!==-1&&rn.splice(e,1)}else this.$backdrop?.parentElement&&this.$backdrop.parentElement.removeChild(this.$backdrop),this.$modal?.parentElement&&this.$modal.parentElement.removeChild(this.$modal),Qe.remove(this),this.shouldUnlockBodyOnClose()&&Qe.unlockBodyScroll();return this.isOpen=!1,this.lastFocused?.focus?.(),this.emit("modal.destroy"),this._isDestroyed=!0,this}get$backdrop(){return this.$backdrop}get$modal(){return It(this.$modal,"modal")}get$window(){return It(this.$window,"window")}get$header(){return It(this.$header,"header")}get$title(){return It(this.$title,"title")}get$content(){return It(this.$content,"content")}get$icons(){return It(this.$icons,"icons")}get$buttons(e){return e==="leftButtons"?It(this.$buttonsLeft,"leftButtons"):e==="rightButtons"?It(this.$buttonsRight,"rightButtons"):It(this.$footer,"buttons")}setTitle(e){const n=this.get$title();return n.innerHTML="",n.append(Xn(e)),this}setContent(e,n="replace"){const r=this.get$content();return n==="replace"?(r.innerHTML="",r.append(Xn(e))):n==="append"?r.append(Xn(e)):r.prepend(Xn(e)),this}setIcons(e){const n=this.get$icons();n.innerHTML="";for(const r of e){const i=qe("button",{className:`ipe-modal-modal__icon ${r.className}`,attrs:{type:"button"}});i.addEventListener("click",r.method),n.appendChild(i)}return this}setButtons(e,n){const r=this.$buttonsLeft,i=this.$buttonsRight;[r,i].forEach(o=>o.innerHTML=""),this.buttonElsLeft=[],this.buttonElsRight=[],this.keyMap.clear();const s=n??this.$footer;if(s===this.$footer)e.forEach(o=>this.addButton(o)),e.length===0&&(this.$footer.style.display="none");else{s.innerHTML="";for(const o of e){const a=this.generateButton(o);s.appendChild(a)}}return this}generateButton(e){const n=e.type??"button",r=n==="link"?qe("a"):qe("button",{attrs:{type:"button"}});e.id&&(r.id=e.id),r.className=`ipe-modal-btn ${e.className??""}`.trim();const i=Xn(e.label??"OK");if(r.append(i),n==="link"&&e.href&&(r.href=e.href),e.method&&r.addEventListener("click",s=>{if(r._ipe_tmpDisabled){s.preventDefault(),s.stopPropagation();return}e.method.call(r,s,this)}),typeof e.closeAfter=="number"&&e.closeAfter>=0&&r.addEventListener("click",()=>{window.setTimeout(()=>this.close(),e.closeAfter)}),typeof e.enableAfter=="number"&&e.enableAfter>0){n==="button"&&r.setAttribute("disabled","true"),r._ipe_tmpDisabled=!0,r.setAttribute("aria-disabled","true");const s=()=>{n==="button"&&r.removeAttribute("disabled"),delete r._ipe_tmpDisabled,r.removeAttribute("aria-disabled")};window.setTimeout(s,e.enableAfter)}return e.keyPress&&this.keyMap.set(String(e.keyPress).toLowerCase(),r),r}addButton(e,n){this.$footer&&(this.$footer.style.display="");const r=e.side??"right",i=r==="left"?this.$buttonsLeft:this.$buttonsRight,s=r==="left"?this.buttonElsLeft:this.buttonElsRight,o=this.generateButton(e),a=Math.max(0,Math.min(n??s.length,s.length));return a>=i.children.length?i.appendChild(o):i.insertBefore(o,i.children[a]),s.splice(a,0,o),this}removeButton(e){const n=this.buttonElsLeft,r=this.buttonElsRight,i=[...n,...r];let s=null;if(typeof e=="number"?s=i[e]??null:typeof e=="string"?s=i.find(a=>a.id===e)??null:e instanceof HTMLElement&&(s=i.find(a=>a===e)??null),!s)return this;for(const[a,l]of this.keyMap.entries())l===s&&this.keyMap.delete(a);let o=n.indexOf(s);return o!==-1?(n.splice(o,1),s.parentElement?.removeChild(s)):(o=r.indexOf(s),o!==-1&&(r.splice(o,1),s.parentElement?.removeChild(s))),n.length===0&&r.length===0&&this.$footer&&(this.$footer.style.display="none"),this}changePreviewState(){return this.get$modal().classList.toggle("is-fullscreen"),this}setModalHeight(e,n="height"){const r=this.get$window(),i=Math.max(0,window.innerHeight-e);return r.style[n]=`${i}px`,i}setOptions(e,n){return typeof e=="string"?this.options[e]=n:Object.assign(this.options,e),this}setPluginName(e){return this.$window&&(this.$window.className=this.$window.className.replace(`plugin--${this.pluginName}`,`plugin--${e}`)),this.pluginName=e,this}applyAnimation(e){const n=this.get$modal(),r=this.get$window(),i=this.$backdrop,s=this.options.modalAnimation??this.options.animation,o=typeof s=="string"?s:s&&(e?s.show:s.hide),a=this.options.backdropAnimation??this.options.animation,l=typeof a=="string"?a:a&&(e?a.show:a.hide);!o||o===!1?(n.style.transition="none",r.style.animation="none",r.style.removeProperty("--ipe-modal-anim")):(n.style.removeProperty("transition"),r.style.setProperty("--ipe-modal-anim",o)),i&&(!l||l===!1?i.style.transition="none":i.style.removeProperty("transition"))}on(e,n){return this._hooks.push({type:e,listener:n}),()=>this.off(e,n)}off(e,n){return this._hooks=this._hooks.filter(r=>r.type!==e||r.listener!==n),this}once(e,n){const r=this.on(e,i=>(r(),n(i)));return r}emit(e,n){const r=this._hooks.filter(l=>l.type===e);let i=!0;for(const l of r){const u=new CustomEvent(e,{detail:this,cancelable:n}),c=l.listener(u);if(u.defaultPrevented&&(i=!1),c===!1&&(i=!1),!i)break}const s=this.$modal??document.body,o=new CustomEvent(e,{detail:this,cancelable:n});return(!s.dispatchEvent(o)||o.defaultPrevented)&&(i=!1),i}focusFirst(){const e=this.get$modal(),n=Aa(e);n.length?n[0].focus():e.focus({preventScroll:!0})}onKeyDown(e){if(Qe.top()!==this)return;if(e.key==="Escape"){e.preventDefault(),this.close();return}const n=this.get$modal();if(!n.contains(document.activeElement))return;if(e.key==="Tab"){const i=Aa(n);if(!i.length)return;const s=i[0],o=i[i.length-1],a=document.activeElement;e.shiftKey&&a===s?(e.preventDefault(),o.focus()):!e.shiftKey&&a===o&&(e.preventDefault(),s.focus())}const r=this.keyMap.get(e.key.toLowerCase());r&&r.click()}setZIndex(e){this.$backdrop&&(this.$backdrop.style.zIndex=String(e)),this.$modal&&(this.$modal.style.zIndex=String(e+1))}bringToFront(){return Qe.remove(this),Qe.push(this),this}isAnimationDisabled(){const e=this.options.modalAnimation??this.options.animation;return e===!1||e==null}shouldLockBodyOnOpen(){return this.options.backdrop===!1||this.options.bodyScroll!==!1?!1:!Qe.stack.some(n=>n!==this&&n.options.backdrop!==!1&&n.options.bodyScroll===!1)}shouldUnlockBodyOnClose(){return this.options.backdrop===!1||this.options.bodyScroll!==!1?!1:!Qe.stack.some(n=>n!==this&&n.options.backdrop!==!1&&n.options.bodyScroll===!1)}onDragStart(e){if(this.options.backdrop!==!1||!this.options.draggable)return;e.preventDefault(),this.isDragging=!0,this.bringToFront(),this.dragStartX=e.clientX,this.dragStartY=e.clientY;const n=this.get$modal(),r=n.getBoundingClientRect();this.modalStartX=r.left+window.pageXOffset,this.modalStartY=r.top+window.pageYOffset,n.style.transform="none",n.style.left=`${this.modalStartX}px`,n.style.top=`${this.modalStartY}px`,document.addEventListener("pointermove",this.onDragMove),document.addEventListener("pointerup",this.onDragEnd),n.classList.add("is-dragging")}showToast(e){this.$window||this.init();const n=qd(e.position??"top right"),r=this.get$window();this.isToast=!0,r.style.pointerEvents="auto",this.applyAnimation(!0),n.appendChild(r);const i=(typeof this.options.closeAfter=="number"?this.options.closeAfter:this.options.closeAfter?.time)??3e3,s=(typeof this.options.closeAfter=="number"?!0:this.options.closeAfter?.resetOnHover)??!0;return i>0&&(this.startCloseTimer(i),s&&(r.addEventListener("mouseenter",this.stopCloseTimer),r.addEventListener("mouseleave",()=>this.startCloseTimer(i)))),this.isOpen=!0,this.options.onShow?.(this),rn.push(this),this.emit("toast.show"),this.emit("modal.show"),this}static show(e,n){return new this(e).init().show()}static createObject(e,n){return new this(e)}static close(e){if(!e){const s=Qe.top();return s?.close(),s}const n=typeof e=="string"?e:e.id,r=Qe.stack.find(s=>s.modalId===n);if(r)return r.close(),r;const i=rn.find(s=>s.modalId===n);return i?.close(),i}static closeAll(e,n){const r=new Set((Array.isArray(n)?n:n?[n]:[]).map(String)),i=new Set((Array.isArray(e)?e:e?[e]:[]).map(String));return Qe.closeAll(e,n),[...rn].forEach(s=>{const o=s.modalId,a=i.size?i.has(s.pluginName):!0,l=r.has(o);a&&!l&&s.close()}),Qe.top()??new Wi}static removeAll(){Qe.removeAll(),[...rn].forEach(e=>e.destroy())}static dialog(e,n){const r=new this({sizeClass:"dialog",buttons:[{label:"OK",className:"is-primary",method:(i,s)=>{n?.(i,s),i.defaultPrevented||r.close()},keyPress:"Enter"}],...e});return r.init().show()}static confirm(e,n){e.title??(e.title="Confirm");const r=e.okBtn??{label:"OK",className:"is-primary"},i=e.cancelBtn??{label:"Cancel",className:"is-danger is-ghost"},s=new this({sizeClass:"dialog",...e,buttons:[{label:i.label,className:i.className,keyPress:"n",method:()=>s.close()},{label:r.label,className:r.className,keyPress:"y",method:o=>{n?.(o,s),o.defaultPrevented||s.close()}}]});return s.init().show()}static notify(e,n,r){var a,l,u,c;n?.overrideOther&&[...rn].forEach(f=>f.close()),typeof n.title>"u"&&(n.title=e[0].toUpperCase()+e.slice(1).toLowerCase());const i=this.notifyIcons[e];n.title=`${i} ${n.title}`.trimStart(),n.okBtn&&((a=n.okBtn).label??(a.label="OK"),(l=n.okBtn).className??(l.className="is-primary is-ghost ok-btn"),n.okBtn.method=()=>{r?.(!0),o.close()}),n.cancelBtn&&((u=n.cancelBtn).label??(u.label="Cancel"),(c=n.cancelBtn).className??(c.className="is-danger is-ghost cancel-btn"),n.cancelBtn.method=()=>{r?.(!1),o.close()}),n.buttons=[n.okBtn,n.cancelBtn,...n.buttons??[]].filter(Boolean);const s=`is-${e||"dialog"} is-toast compact-buttons ${n.className??""}`,o=new this({...n,className:s,sizeClass:"auto",center:!1,fitScreen:!1,closeIcon:!0,outSideClose:!1,bodyScroll:!0,animation:n.animation??{show:"fadeIn",hide:"fadeOut"},buttons:n.buttons??[]});return o.setPluginName("toast"),o.showToast({position:n.position??"top right"})}};Wi.notifyIcons={success:"✅",error:"❌",warning:"⚠️",info:"ℹ️",dialog:"💬",confirm:"💬"};let xs=Wi;const rn=[];function qd(t="top right"){const e="ipe-modal-toast-container",n=`${e}-${t.replace(/[\s-\.|\/]+/g,"-")}`;let r=document.getElementById(n);return r||(r=qe("div",{className:`${e} ${t}`,attrs:{id:n,"data-position":t}}),document.body.appendChild(r)),r}const Wd={ipe_progress:"_ipe_progress_so6hn_1"},sn=t=>{const e=t.indeterminate??!0,n=C("div",{class:`${Wd.ipe_progress}`,"data-indeterminate":`${e}`,style:{width:"100%","--progress":t.progress?`${t.progress}%`:"0%"},...t});return n.setProgress=r=>{typeof r=="number"?(n.dataset.indeterminate="false",n.style.setProperty("--progress",`${r}%`)):(n.dataset.indeterminate="true",n.style.setProperty("--progress","0%"))},n};class De extends xs{constructor(e={}){e.className||(e.className=""),e.className+=" theme-ipe",super(e)}setLoadingState(e){if(this.get$window().classList.toggle("loading",e),e){const n=this.get$window().querySelectorAll("input:not([disabled]),button:not([disabled])");this._tmpDisabledActiveInputs=n,n.forEach(r=>{r.disabled=!0}),this.get$content().append(C("div",{id:"ipe-modalLoadingWrapper",style:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:"rgba(255, 255, 255, 0.5)",zIndex:2e3},children:C(sn,{style:{width:"80%",maxWidth:"800px"}})}))}else{this.get$window().querySelector("#ipe-modalLoadingWrapper")?.remove();const n=this._tmpDisabledActiveInputs;n&&n.forEach(r=>{r.disabled=!1})}}}class zd{constructor(e){this.ctx=e,this.IPEModal=De,this.IPEModalEvent=ws,this.show=De.show.bind(De),this.createObject=De.createObject.bind(De),this.close=De.close.bind(De),this.closeAll=De.closeAll.bind(De),this.removeAll=De.removeAll.bind(De),this.dialog=De.dialog.bind(De),this.confirm=De.confirm.bind(De),this.notify=De.notify.bind(De),e.set("modal",this)}}var Ss=(t=>(t.ANALYTICS_API_BASE="https://analytics.ipe.wiki/api",t.ANALYTICS_DASH_URL="https://analytics.ipe.wiki",t.GITHUB_URL="https://github.com/inpageedit/inpageedit-v2",t.HOME_URL="https://www.ipe.wiki/",t.PLUGIN_CDN_BASE="https://ipe-plugins.js.org",t.PLUGIN_HOME_URL="https://github.com/inpageedit/Plugins",t.SPECIAL_NOTICE_JSON="https://ipe-plugins.js.org/specialNotice.json",t.UPDATE_LOGS_URL="https://www.ipe.wiki/update/",t))(Ss||{});/**
|
|
52
|
+
*/var _a;function dd(){return _a||(_a=1,function(t,e){(function(n){t.exports=n()})(function(){return function n(r,i,s){function o(u,c){if(!i[u]){if(!r[u]){var f=typeof Hr=="function"&&Hr;if(!c&&f)return f(u,!0);if(a)return a(u,!0);var b=new Error("Cannot find module '"+u+"'");throw b.code="MODULE_NOT_FOUND",b}var y=i[u]={exports:{}};r[u][0].call(y.exports,function(v){var A=r[u][1][v];return o(A||v)},y,y.exports,n,r,i,s)}return i[u].exports}for(var a=typeof Hr=="function"&&Hr,l=0;l<s.length;l++)o(s[l]);return o}({1:[function(n,r,i){(function(s){var o=s.MutationObserver||s.WebKitMutationObserver,a;if(o){var l=0,u=new o(v),c=s.document.createTextNode("");u.observe(c,{characterData:!0}),a=function(){c.data=l=++l%2}}else if(!s.setImmediate&&typeof s.MessageChannel<"u"){var f=new s.MessageChannel;f.port1.onmessage=v,a=function(){f.port2.postMessage(0)}}else"document"in s&&"onreadystatechange"in s.document.createElement("script")?a=function(){var U=s.document.createElement("script");U.onreadystatechange=function(){v(),U.onreadystatechange=null,U.parentNode.removeChild(U),U=null},s.document.documentElement.appendChild(U)}:a=function(){setTimeout(v,0)};var b,y=[];function v(){b=!0;for(var U,D,I=y.length;I;){for(D=y,y=[],U=-1;++U<I;)D[U]();I=y.length}b=!1}r.exports=A;function A(U){y.push(U)===1&&!b&&a()}}).call(this,typeof Ur<"u"?Ur:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(n,r,i){var s=n(1);function o(){}var a={},l=["REJECTED"],u=["FULFILLED"],c=["PENDING"];r.exports=f;function f(h){if(typeof h!="function")throw new TypeError("resolver must be a function");this.state=c,this.queue=[],this.outcome=void 0,h!==o&&A(this,h)}f.prototype.catch=function(h){return this.then(null,h)},f.prototype.then=function(h,x){if(typeof h!="function"&&this.state===u||typeof x!="function"&&this.state===l)return this;var P=new this.constructor(o);if(this.state!==c){var R=this.state===u?h:x;y(P,R,this.outcome)}else this.queue.push(new b(P,h,x));return P};function b(h,x,P){this.promise=h,typeof x=="function"&&(this.onFulfilled=x,this.callFulfilled=this.otherCallFulfilled),typeof P=="function"&&(this.onRejected=P,this.callRejected=this.otherCallRejected)}b.prototype.callFulfilled=function(h){a.resolve(this.promise,h)},b.prototype.otherCallFulfilled=function(h){y(this.promise,this.onFulfilled,h)},b.prototype.callRejected=function(h){a.reject(this.promise,h)},b.prototype.otherCallRejected=function(h){y(this.promise,this.onRejected,h)};function y(h,x,P){s(function(){var R;try{R=x(P)}catch(W){return a.reject(h,W)}R===h?a.reject(h,new TypeError("Cannot resolve promise with itself")):a.resolve(h,R)})}a.resolve=function(h,x){var P=U(v,x);if(P.status==="error")return a.reject(h,P.value);var R=P.value;if(R)A(h,R);else{h.state=u,h.outcome=x;for(var W=-1,X=h.queue.length;++W<X;)h.queue[W].callFulfilled(x)}return h},a.reject=function(h,x){h.state=l,h.outcome=x;for(var P=-1,R=h.queue.length;++P<R;)h.queue[P].callRejected(x);return h};function v(h){var x=h&&h.then;if(h&&(typeof h=="object"||typeof h=="function")&&typeof x=="function")return function(){x.apply(h,arguments)}}function A(h,x){var P=!1;function R(Te){P||(P=!0,a.reject(h,Te))}function W(Te){P||(P=!0,a.resolve(h,Te))}function X(){x(W,R)}var Ce=U(X);Ce.status==="error"&&R(Ce.value)}function U(h,x){var P={};try{P.value=h(x),P.status="success"}catch(R){P.status="error",P.value=R}return P}f.resolve=D;function D(h){return h instanceof this?h:a.resolve(new this(o),h)}f.reject=I;function I(h){var x=new this(o);return a.reject(x,h)}f.all=g;function g(h){var x=this;if(Object.prototype.toString.call(h)!=="[object Array]")return this.reject(new TypeError("must be an array"));var P=h.length,R=!1;if(!P)return this.resolve([]);for(var W=new Array(P),X=0,Ce=-1,Te=new this(o);++Ce<P;)tt(h[Ce],Ce);return Te;function tt(Ut,mn){x.resolve(Ut).then(Re,function(me){R||(R=!0,a.reject(Te,me))});function Re(me){W[mn]=me,++X===P&&!R&&(R=!0,a.resolve(Te,W))}}}f.race=p;function p(h){var x=this;if(Object.prototype.toString.call(h)!=="[object Array]")return this.reject(new TypeError("must be an array"));var P=h.length,R=!1;if(!P)return this.resolve([]);for(var W=-1,X=new this(o);++W<P;)Ce(h[W]);return X;function Ce(Te){x.resolve(Te).then(function(tt){R||(R=!0,a.resolve(X,tt))},function(tt){R||(R=!0,a.reject(X,tt))})}}},{1:1}],3:[function(n,r,i){(function(s){typeof s.Promise!="function"&&(s.Promise=n(2))}).call(this,typeof Ur<"u"?Ur:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(n,r,i){var s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(d){return typeof d}:function(d){return d&&typeof Symbol=="function"&&d.constructor===Symbol&&d!==Symbol.prototype?"symbol":typeof d};function o(d,w){if(!(d instanceof w))throw new TypeError("Cannot call a class as a function")}function a(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch{return}}var l=a();function u(){try{if(!l||!l.open)return!1;var d=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),w=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!d||w)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function c(d,w){d=d||[],w=w||{};try{return new Blob(d,w)}catch(S){if(S.name!=="TypeError")throw S;for(var m=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,k=new m,O=0;O<d.length;O+=1)k.append(d[O]);return k.getBlob(w.type)}}typeof Promise>"u"&&n(3);var f=Promise;function b(d,w){w&&d.then(function(m){w(null,m)},function(m){w(m)})}function y(d,w,m){typeof w=="function"&&d.then(w),typeof m=="function"&&d.catch(m)}function v(d){return typeof d!="string"&&(d=String(d)),d}function A(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var U="local-forage-detect-blob-support",D=void 0,I={},g=Object.prototype.toString,p="readonly",h="readwrite";function x(d){for(var w=d.length,m=new ArrayBuffer(w),k=new Uint8Array(m),O=0;O<w;O++)k[O]=d.charCodeAt(O);return m}function P(d){return new f(function(w){var m=d.transaction(U,h),k=c([""]);m.objectStore(U).put(k,"key"),m.onabort=function(O){O.preventDefault(),O.stopPropagation(),w(!1)},m.oncomplete=function(){var O=navigator.userAgent.match(/Chrome\/(\d+)/),S=navigator.userAgent.match(/Edge\//);w(S||!O||parseInt(O[1],10)>=43)}}).catch(function(){return!1})}function R(d){return typeof D=="boolean"?f.resolve(D):P(d).then(function(w){return D=w,D})}function W(d){var w=I[d.name],m={};m.promise=new f(function(k,O){m.resolve=k,m.reject=O}),w.deferredOperations.push(m),w.dbReady?w.dbReady=w.dbReady.then(function(){return m.promise}):w.dbReady=m.promise}function X(d){var w=I[d.name],m=w.deferredOperations.pop();if(m)return m.resolve(),m.promise}function Ce(d,w){var m=I[d.name],k=m.deferredOperations.pop();if(k)return k.reject(w),k.promise}function Te(d,w){return new f(function(m,k){if(I[d.name]=I[d.name]||at(),d.db)if(w)W(d),d.db.close();else return m(d.db);var O=[d.name];w&&O.push(d.version);var S=l.open.apply(l,O);w&&(S.onupgradeneeded=function(N){var F=S.result;try{F.createObjectStore(d.storeName),N.oldVersion<=1&&F.createObjectStore(U)}catch(H){if(H.name!=="ConstraintError")throw H}}),S.onerror=function(N){N.preventDefault(),k(S.error)},S.onsuccess=function(){var N=S.result;N.onversionchange=function(F){F.target.close()},m(N),X(d)}})}function tt(d){return Te(d,!1)}function Ut(d){return Te(d,!0)}function mn(d,w){if(!d.db)return!0;var m=!d.db.objectStoreNames.contains(d.storeName),k=d.version<d.db.version,O=d.version>d.db.version;if(k&&(d.version,d.version=d.db.version),O||m){if(m){var S=d.db.version+1;S>d.version&&(d.version=S)}return!0}return!1}function Re(d){return new f(function(w,m){var k=new FileReader;k.onerror=m,k.onloadend=function(O){var S=btoa(O.target.result||"");w({__local_forage_encoded_blob:!0,data:S,type:d.type})},k.readAsBinaryString(d)})}function me(d){var w=x(atob(d.data));return c([w],{type:d.type})}function ve(d){return d&&d.__local_forage_encoded_blob}function Ht(d){var w=this,m=w._initReady().then(function(){var k=I[w._dbInfo.name];if(k&&k.dbReady)return k.dbReady});return y(m,d,d),m}function Un(d){W(d);for(var w=I[d.name],m=w.forages,k=0;k<m.length;k++){var O=m[k];O._dbInfo.db&&(O._dbInfo.db.close(),O._dbInfo.db=null)}return d.db=null,tt(d).then(function(S){return d.db=S,mn(d)?Ut(d):S}).then(function(S){d.db=w.db=S;for(var N=0;N<m.length;N++)m[N]._dbInfo.db=S}).catch(function(S){throw Ce(d,S),S})}function Me(d,w,m,k){k===void 0&&(k=1);try{var O=d.db.transaction(d.storeName,w);m(null,O)}catch(S){if(k>0&&(!d.db||S.name==="InvalidStateError"||S.name==="NotFoundError"))return f.resolve().then(function(){if(!d.db||S.name==="NotFoundError"&&!d.db.objectStoreNames.contains(d.storeName)&&d.version<=d.db.version)return d.db&&(d.version=d.db.version+1),Ut(d)}).then(function(){return Un(d).then(function(){Me(d,w,m,k-1)})}).catch(m);m(S)}}function at(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Gi(d){var w=this,m={db:null};if(d)for(var k in d)m[k]=d[k];var O=I[m.name];O||(O=at(),I[m.name]=O),O.forages.push(w),w._initReady||(w._initReady=w.ready,w.ready=Ht);var S=[];function N(){return f.resolve()}for(var F=0;F<O.forages.length;F++){var H=O.forages[F];H!==w&&S.push(H._initReady().catch(N))}var q=O.forages.slice(0);return f.all(S).then(function(){return m.db=O.db,tt(m)}).then(function(V){return m.db=V,mn(m,w._defaultConfig.version)?Ut(m):V}).then(function(V){m.db=O.db=V,w._dbInfo=m;for(var Q=0;Q<q.length;Q++){var ae=q[Q];ae!==w&&(ae._dbInfo.db=m.db,ae._dbInfo.version=m.version)}})}function Wo(d,w){var m=this;d=v(d);var k=new f(function(O,S){m.ready().then(function(){Me(m._dbInfo,p,function(N,F){if(N)return S(N);try{var H=F.objectStore(m._dbInfo.storeName),q=H.get(d);q.onsuccess=function(){var V=q.result;V===void 0&&(V=null),ve(V)&&(V=me(V)),O(V)},q.onerror=function(){S(q.error)}}catch(V){S(V)}})}).catch(S)});return b(k,w),k}function zo(d,w){var m=this,k=new f(function(O,S){m.ready().then(function(){Me(m._dbInfo,p,function(N,F){if(N)return S(N);try{var H=F.objectStore(m._dbInfo.storeName),q=H.openCursor(),V=1;q.onsuccess=function(){var Q=q.result;if(Q){var ae=Q.value;ve(ae)&&(ae=me(ae));var ge=d(ae,Q.key,V++);ge!==void 0?O(ge):Q.continue()}else O()},q.onerror=function(){S(q.error)}}catch(Q){S(Q)}})}).catch(S)});return b(k,w),k}function gn(d,w,m){var k=this;d=v(d);var O=new f(function(S,N){var F;k.ready().then(function(){return F=k._dbInfo,g.call(w)==="[object Blob]"?R(F.db).then(function(H){return H?w:Re(w)}):w}).then(function(H){Me(k._dbInfo,h,function(q,V){if(q)return N(q);try{var Q=V.objectStore(k._dbInfo.storeName);H===null&&(H=void 0);var ae=Q.put(H,d);V.oncomplete=function(){H===void 0&&(H=null),S(H)},V.onabort=V.onerror=function(){var ge=ae.error?ae.error:ae.transaction.error;N(ge)}}catch(ge){N(ge)}})}).catch(N)});return b(O,m),O}function Hn(d,w){var m=this;d=v(d);var k=new f(function(O,S){m.ready().then(function(){Me(m._dbInfo,h,function(N,F){if(N)return S(N);try{var H=F.objectStore(m._dbInfo.storeName),q=H.delete(d);F.oncomplete=function(){O()},F.onerror=function(){S(q.error)},F.onabort=function(){var V=q.error?q.error:q.transaction.error;S(V)}}catch(V){S(V)}})}).catch(S)});return b(k,w),k}function Or(d){var w=this,m=new f(function(k,O){w.ready().then(function(){Me(w._dbInfo,h,function(S,N){if(S)return O(S);try{var F=N.objectStore(w._dbInfo.storeName),H=F.clear();N.oncomplete=function(){k()},N.onabort=N.onerror=function(){var q=H.error?H.error:H.transaction.error;O(q)}}catch(q){O(q)}})}).catch(O)});return b(m,d),m}function Ji(d){var w=this,m=new f(function(k,O){w.ready().then(function(){Me(w._dbInfo,p,function(S,N){if(S)return O(S);try{var F=N.objectStore(w._dbInfo.storeName),H=F.count();H.onsuccess=function(){k(H.result)},H.onerror=function(){O(H.error)}}catch(q){O(q)}})}).catch(O)});return b(m,d),m}function yn(d,w){var m=this,k=new f(function(O,S){if(d<0){O(null);return}m.ready().then(function(){Me(m._dbInfo,p,function(N,F){if(N)return S(N);try{var H=F.objectStore(m._dbInfo.storeName),q=!1,V=H.openKeyCursor();V.onsuccess=function(){var Q=V.result;if(!Q){O(null);return}d===0||q?O(Q.key):(q=!0,Q.advance(d))},V.onerror=function(){S(V.error)}}catch(Q){S(Q)}})}).catch(S)});return b(k,w),k}function tf(d){var w=this,m=new f(function(k,O){w.ready().then(function(){Me(w._dbInfo,p,function(S,N){if(S)return O(S);try{var F=N.objectStore(w._dbInfo.storeName),H=F.openKeyCursor(),q=[];H.onsuccess=function(){var V=H.result;if(!V){k(q);return}q.push(V.key),V.continue()},H.onerror=function(){O(H.error)}}catch(V){O(V)}})}).catch(O)});return b(m,d),m}function _(d,w){w=A.apply(this,arguments);var m=this.config();d=typeof d!="function"&&d||{},d.name||(d.name=d.name||m.name,d.storeName=d.storeName||m.storeName);var k=this,O;if(!d.name)O=f.reject("Invalid arguments");else{var S=d.name===m.name&&k._dbInfo.db,N=S?f.resolve(k._dbInfo.db):tt(d).then(function(F){var H=I[d.name],q=H.forages;H.db=F;for(var V=0;V<q.length;V++)q[V]._dbInfo.db=F;return F});d.storeName?O=N.then(function(F){if(F.objectStoreNames.contains(d.storeName)){var H=F.version+1;W(d);var q=I[d.name],V=q.forages;F.close();for(var Q=0;Q<V.length;Q++){var ae=V[Q];ae._dbInfo.db=null,ae._dbInfo.version=H}var ge=new f(function(_e,Ae){var Oe=l.open(d.name,H);Oe.onerror=function(gt){var Ir=Oe.result;Ir.close(),Ae(gt)},Oe.onupgradeneeded=function(){var gt=Oe.result;gt.deleteObjectStore(d.storeName)},Oe.onsuccess=function(){var gt=Oe.result;gt.close(),_e(gt)}});return ge.then(function(_e){q.db=_e;for(var Ae=0;Ae<V.length;Ae++){var Oe=V[Ae];Oe._dbInfo.db=_e,X(Oe._dbInfo)}}).catch(function(_e){throw(Ce(d,_e)||f.resolve()).catch(function(){}),_e})}}):O=N.then(function(F){W(d);var H=I[d.name],q=H.forages;F.close();for(var V=0;V<q.length;V++){var Q=q[V];Q._dbInfo.db=null}var ae=new f(function(ge,_e){var Ae=l.deleteDatabase(d.name);Ae.onerror=function(){var Oe=Ae.result;Oe&&Oe.close(),_e(Ae.error)},Ae.onblocked=function(){},Ae.onsuccess=function(){var Oe=Ae.result;Oe&&Oe.close(),ge(Oe)}});return ae.then(function(ge){H.db=ge;for(var _e=0;_e<q.length;_e++){var Ae=q[_e];X(Ae._dbInfo)}}).catch(function(ge){throw(Ce(d,ge)||f.resolve()).catch(function(){}),ge})})}return b(O,w),O}var E={_driver:"asyncStorage",_initStorage:Gi,_support:u(),iterate:zo,getItem:Wo,setItem:gn,removeItem:Hn,clear:Or,length:Ji,key:yn,keys:tf,dropInstance:_};function T(){return typeof openDatabase=="function"}var L="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",j="~~local_forage_type~",M=/^~~local_forage_type~([^~]+)~/,G="__lfsc__:",K=G.length,z="arbf",B="blob",ee="si08",J="ui08",Z="uic8",re="si16",ce="si32",be="ur16",he="ui32",Fe="fl32",Be="fl64",lt=K+z.length,ct=Object.prototype.toString;function Zt(d){var w=d.length*.75,m=d.length,k,O=0,S,N,F,H;d[d.length-1]==="="&&(w--,d[d.length-2]==="="&&w--);var q=new ArrayBuffer(w),V=new Uint8Array(q);for(k=0;k<m;k+=4)S=L.indexOf(d[k]),N=L.indexOf(d[k+1]),F=L.indexOf(d[k+2]),H=L.indexOf(d[k+3]),V[O++]=S<<2|N>>4,V[O++]=(N&15)<<4|F>>2,V[O++]=(F&3)<<6|H&63;return q}function qn(d){var w=new Uint8Array(d),m="",k;for(k=0;k<w.length;k+=3)m+=L[w[k]>>2],m+=L[(w[k]&3)<<4|w[k+1]>>4],m+=L[(w[k+1]&15)<<2|w[k+2]>>6],m+=L[w[k+2]&63];return w.length%3===2?m=m.substring(0,m.length-1)+"=":w.length%3===1&&(m=m.substring(0,m.length-2)+"=="),m}function Ye(d,w){var m="";if(d&&(m=ct.call(d)),d&&(m==="[object ArrayBuffer]"||d.buffer&&ct.call(d.buffer)==="[object ArrayBuffer]")){var k,O=G;d instanceof ArrayBuffer?(k=d,O+=z):(k=d.buffer,m==="[object Int8Array]"?O+=ee:m==="[object Uint8Array]"?O+=J:m==="[object Uint8ClampedArray]"?O+=Z:m==="[object Int16Array]"?O+=re:m==="[object Uint16Array]"?O+=be:m==="[object Int32Array]"?O+=ce:m==="[object Uint32Array]"?O+=he:m==="[object Float32Array]"?O+=Fe:m==="[object Float64Array]"?O+=Be:w(new Error("Failed to get type for BinaryArray"))),w(O+qn(k))}else if(m==="[object Blob]"){var S=new FileReader;S.onload=function(){var N=j+d.type+"~"+qn(this.result);w(G+B+N)},S.readAsArrayBuffer(d)}else try{w(JSON.stringify(d))}catch(N){w(null,N)}}function mt(d){if(d.substring(0,K)!==G)return JSON.parse(d);var w=d.substring(lt),m=d.substring(K,lt),k;if(m===B&&M.test(w)){var O=w.match(M);k=O[1],w=w.substring(O[0].length)}var S=Zt(w);switch(m){case z:return S;case B:return c([S],{type:k});case ee:return new Int8Array(S);case J:return new Uint8Array(S);case Z:return new Uint8ClampedArray(S);case re:return new Int16Array(S);case be:return new Uint16Array(S);case ce:return new Int32Array(S);case he:return new Uint32Array(S);case Fe:return new Float32Array(S);case Be:return new Float64Array(S);default:throw new Error("Unkown type: "+m)}}var Wn={serialize:Ye,deserialize:mt,stringToBuffer:Zt,bufferToString:qn};function Pr(d,w,m,k){d.executeSql("CREATE TABLE IF NOT EXISTS "+w.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],m,k)}function ev(d){var w=this,m={db:null};if(d)for(var k in d)m[k]=typeof d[k]!="string"?d[k].toString():d[k];var O=new f(function(S,N){try{m.db=openDatabase(m.name,String(m.version),m.description,m.size)}catch(F){return N(F)}m.db.transaction(function(F){Pr(F,m,function(){w._dbInfo=m,S()},function(H,q){N(q)})},N)});return m.serializer=Wn,O}function en(d,w,m,k,O,S){d.executeSql(m,k,O,function(N,F){F.code===F.SYNTAX_ERR?N.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[w.storeName],function(H,q){q.rows.length?S(H,F):Pr(H,w,function(){H.executeSql(m,k,O,S)},S)},S):S(N,F)},S)}function tv(d,w){var m=this;d=v(d);var k=new f(function(O,S){m.ready().then(function(){var N=m._dbInfo;N.db.transaction(function(F){en(F,N,"SELECT * FROM "+N.storeName+" WHERE key = ? LIMIT 1",[d],function(H,q){var V=q.rows.length?q.rows.item(0).value:null;V&&(V=N.serializer.deserialize(V)),O(V)},function(H,q){S(q)})})}).catch(S)});return b(k,w),k}function nv(d,w){var m=this,k=new f(function(O,S){m.ready().then(function(){var N=m._dbInfo;N.db.transaction(function(F){en(F,N,"SELECT * FROM "+N.storeName,[],function(H,q){for(var V=q.rows,Q=V.length,ae=0;ae<Q;ae++){var ge=V.item(ae),_e=ge.value;if(_e&&(_e=N.serializer.deserialize(_e)),_e=d(_e,ge.key,ae+1),_e!==void 0){O(_e);return}}O()},function(H,q){S(q)})})}).catch(S)});return b(k,w),k}function nf(d,w,m,k){var O=this;d=v(d);var S=new f(function(N,F){O.ready().then(function(){w===void 0&&(w=null);var H=w,q=O._dbInfo;q.serializer.serialize(w,function(V,Q){Q?F(Q):q.db.transaction(function(ae){en(ae,q,"INSERT OR REPLACE INTO "+q.storeName+" (key, value) VALUES (?, ?)",[d,V],function(){N(H)},function(ge,_e){F(_e)})},function(ae){if(ae.code===ae.QUOTA_ERR){if(k>0){N(nf.apply(O,[d,H,m,k-1]));return}F(ae)}})})}).catch(F)});return b(S,m),S}function rv(d,w,m){return nf.apply(this,[d,w,m,1])}function iv(d,w){var m=this;d=v(d);var k=new f(function(O,S){m.ready().then(function(){var N=m._dbInfo;N.db.transaction(function(F){en(F,N,"DELETE FROM "+N.storeName+" WHERE key = ?",[d],function(){O()},function(H,q){S(q)})})}).catch(S)});return b(k,w),k}function sv(d){var w=this,m=new f(function(k,O){w.ready().then(function(){var S=w._dbInfo;S.db.transaction(function(N){en(N,S,"DELETE FROM "+S.storeName,[],function(){k()},function(F,H){O(H)})})}).catch(O)});return b(m,d),m}function ov(d){var w=this,m=new f(function(k,O){w.ready().then(function(){var S=w._dbInfo;S.db.transaction(function(N){en(N,S,"SELECT COUNT(key) as c FROM "+S.storeName,[],function(F,H){var q=H.rows.item(0).c;k(q)},function(F,H){O(H)})})}).catch(O)});return b(m,d),m}function av(d,w){var m=this,k=new f(function(O,S){m.ready().then(function(){var N=m._dbInfo;N.db.transaction(function(F){en(F,N,"SELECT key FROM "+N.storeName+" WHERE id = ? LIMIT 1",[d+1],function(H,q){var V=q.rows.length?q.rows.item(0).key:null;O(V)},function(H,q){S(q)})})}).catch(S)});return b(k,w),k}function lv(d){var w=this,m=new f(function(k,O){w.ready().then(function(){var S=w._dbInfo;S.db.transaction(function(N){en(N,S,"SELECT key FROM "+S.storeName,[],function(F,H){for(var q=[],V=0;V<H.rows.length;V++)q.push(H.rows.item(V).key);k(q)},function(F,H){O(H)})})}).catch(O)});return b(m,d),m}function cv(d){return new f(function(w,m){d.transaction(function(k){k.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(O,S){for(var N=[],F=0;F<S.rows.length;F++)N.push(S.rows.item(F).name);w({db:d,storeNames:N})},function(O,S){m(S)})},function(k){m(k)})})}function uv(d,w){w=A.apply(this,arguments);var m=this.config();d=typeof d!="function"&&d||{},d.name||(d.name=d.name||m.name,d.storeName=d.storeName||m.storeName);var k=this,O;return d.name?O=new f(function(S){var N;d.name===m.name?N=k._dbInfo.db:N=openDatabase(d.name,"","",0),d.storeName?S({db:N,storeNames:[d.storeName]}):S(cv(N))}).then(function(S){return new f(function(N,F){S.db.transaction(function(H){function q(ge){return new f(function(_e,Ae){H.executeSql("DROP TABLE IF EXISTS "+ge,[],function(){_e()},function(Oe,gt){Ae(gt)})})}for(var V=[],Q=0,ae=S.storeNames.length;Q<ae;Q++)V.push(q(S.storeNames[Q]));f.all(V).then(function(){N()}).catch(function(ge){F(ge)})},function(H){F(H)})})}):O=f.reject("Invalid arguments"),b(O,w),O}var fv={_driver:"webSQLStorage",_initStorage:ev,_support:T(),iterate:nv,getItem:tv,setItem:rv,removeItem:iv,clear:sv,length:ov,key:av,keys:lv,dropInstance:uv};function dv(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function rf(d,w){var m=d.name+"/";return d.storeName!==w.storeName&&(m+=d.storeName+"/"),m}function hv(){var d="_localforage_support_test";try{return localStorage.setItem(d,!0),localStorage.removeItem(d),!1}catch{return!0}}function pv(){return!hv()||localStorage.length>0}function mv(d){var w=this,m={};if(d)for(var k in d)m[k]=d[k];return m.keyPrefix=rf(d,w._defaultConfig),pv()?(w._dbInfo=m,m.serializer=Wn,f.resolve()):f.reject()}function gv(d){var w=this,m=w.ready().then(function(){for(var k=w._dbInfo.keyPrefix,O=localStorage.length-1;O>=0;O--){var S=localStorage.key(O);S.indexOf(k)===0&&localStorage.removeItem(S)}});return b(m,d),m}function yv(d,w){var m=this;d=v(d);var k=m.ready().then(function(){var O=m._dbInfo,S=localStorage.getItem(O.keyPrefix+d);return S&&(S=O.serializer.deserialize(S)),S});return b(k,w),k}function vv(d,w){var m=this,k=m.ready().then(function(){for(var O=m._dbInfo,S=O.keyPrefix,N=S.length,F=localStorage.length,H=1,q=0;q<F;q++){var V=localStorage.key(q);if(V.indexOf(S)===0){var Q=localStorage.getItem(V);if(Q&&(Q=O.serializer.deserialize(Q)),Q=d(Q,V.substring(N),H++),Q!==void 0)return Q}}});return b(k,w),k}function bv(d,w){var m=this,k=m.ready().then(function(){var O=m._dbInfo,S;try{S=localStorage.key(d)}catch{S=null}return S&&(S=S.substring(O.keyPrefix.length)),S});return b(k,w),k}function _v(d){var w=this,m=w.ready().then(function(){for(var k=w._dbInfo,O=localStorage.length,S=[],N=0;N<O;N++){var F=localStorage.key(N);F.indexOf(k.keyPrefix)===0&&S.push(F.substring(k.keyPrefix.length))}return S});return b(m,d),m}function wv(d){var w=this,m=w.keys().then(function(k){return k.length});return b(m,d),m}function xv(d,w){var m=this;d=v(d);var k=m.ready().then(function(){var O=m._dbInfo;localStorage.removeItem(O.keyPrefix+d)});return b(k,w),k}function Sv(d,w,m){var k=this;d=v(d);var O=k.ready().then(function(){w===void 0&&(w=null);var S=w;return new f(function(N,F){var H=k._dbInfo;H.serializer.serialize(w,function(q,V){if(V)F(V);else try{localStorage.setItem(H.keyPrefix+d,q),N(S)}catch(Q){(Q.name==="QuotaExceededError"||Q.name==="NS_ERROR_DOM_QUOTA_REACHED")&&F(Q),F(Q)}})})});return b(O,m),O}function Ev(d,w){if(w=A.apply(this,arguments),d=typeof d!="function"&&d||{},!d.name){var m=this.config();d.name=d.name||m.name,d.storeName=d.storeName||m.storeName}var k=this,O;return d.name?O=new f(function(S){d.storeName?S(rf(d,k._defaultConfig)):S(d.name+"/")}).then(function(S){for(var N=localStorage.length-1;N>=0;N--){var F=localStorage.key(N);F.indexOf(S)===0&&localStorage.removeItem(F)}}):O=f.reject("Invalid arguments"),b(O,w),O}var $v={_driver:"localStorageWrapper",_initStorage:mv,_support:dv(),iterate:vv,getItem:yv,setItem:Sv,removeItem:xv,clear:gv,length:wv,key:bv,keys:_v,dropInstance:Ev},kv=function(w,m){return w===m||typeof w=="number"&&typeof m=="number"&&isNaN(w)&&isNaN(m)},Cv=function(w,m){for(var k=w.length,O=0;O<k;){if(kv(w[O],m))return!0;O++}return!1},sf=Array.isArray||function(d){return Object.prototype.toString.call(d)==="[object Array]"},Ar={},of={},zn={INDEXEDDB:E,WEBSQL:fv,LOCALSTORAGE:$v},Ov=[zn.INDEXEDDB._driver,zn.WEBSQL._driver,zn.LOCALSTORAGE._driver],Qi=["dropInstance"],Vo=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Qi),Pv={description:"",driver:Ov.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Av(d,w){d[w]=function(){var m=arguments;return d.ready().then(function(){return d[w].apply(d,m)})}}function Ko(){for(var d=1;d<arguments.length;d++){var w=arguments[d];if(w)for(var m in w)w.hasOwnProperty(m)&&(sf(w[m])?arguments[0][m]=w[m].slice():arguments[0][m]=w[m])}return arguments[0]}var Iv=function(){function d(w){o(this,d);for(var m in zn)if(zn.hasOwnProperty(m)){var k=zn[m],O=k._driver;this[m]=O,Ar[O]||this.defineDriver(k)}this._defaultConfig=Ko({},Pv),this._config=Ko({},this._defaultConfig,w),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return d.prototype.config=function(m){if((typeof m>"u"?"undefined":s(m))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var k in m){if(k==="storeName"&&(m[k]=m[k].replace(/\W/g,"_")),k==="version"&&typeof m[k]!="number")return new Error("Database version must be a number.");this._config[k]=m[k]}return"driver"in m&&m.driver?this.setDriver(this._config.driver):!0}else return typeof m=="string"?this._config[m]:this._config},d.prototype.defineDriver=function(m,k,O){var S=new f(function(N,F){try{var H=m._driver,q=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!m._driver){F(q);return}for(var V=Vo.concat("_initStorage"),Q=0,ae=V.length;Q<ae;Q++){var ge=V[Q],_e=!Cv(Qi,ge);if((_e||m[ge])&&typeof m[ge]!="function"){F(q);return}}var Ae=function(){for(var Ir=function(Nv){return function(){var Dv=new Error("Method "+Nv+" is not implemented by the current driver"),af=f.reject(Dv);return b(af,arguments[arguments.length-1]),af}},Yo=0,Rv=Qi.length;Yo<Rv;Yo++){var Go=Qi[Yo];m[Go]||(m[Go]=Ir(Go))}};Ae();var Oe=function(Ir){Ar[H],Ar[H]=m,of[H]=Ir,N()};"_support"in m?m._support&&typeof m._support=="function"?m._support().then(Oe,F):Oe(!!m._support):Oe(!0)}catch(gt){F(gt)}});return y(S,k,O),S},d.prototype.driver=function(){return this._driver||null},d.prototype.getDriver=function(m,k,O){var S=Ar[m]?f.resolve(Ar[m]):f.reject(new Error("Driver not found."));return y(S,k,O),S},d.prototype.getSerializer=function(m){var k=f.resolve(Wn);return y(k,m),k},d.prototype.ready=function(m){var k=this,O=k._driverSet.then(function(){return k._ready===null&&(k._ready=k._initDriver()),k._ready});return y(O,m,m),O},d.prototype.setDriver=function(m,k,O){var S=this;sf(m)||(m=[m]);var N=this._getSupportedDrivers(m);function F(){S._config.driver=S.driver()}function H(Q){return S._extend(Q),F(),S._ready=S._initStorage(S._config),S._ready}function q(Q){return function(){var ae=0;function ge(){for(;ae<Q.length;){var _e=Q[ae];return ae++,S._dbInfo=null,S._ready=null,S.getDriver(_e).then(H).catch(ge)}F();var Ae=new Error("No available storage method found.");return S._driverSet=f.reject(Ae),S._driverSet}return ge()}}var V=this._driverSet!==null?this._driverSet.catch(function(){return f.resolve()}):f.resolve();return this._driverSet=V.then(function(){var Q=N[0];return S._dbInfo=null,S._ready=null,S.getDriver(Q).then(function(ae){S._driver=ae._driver,F(),S._wrapLibraryMethodsWithReady(),S._initDriver=q(N)})}).catch(function(){F();var Q=new Error("No available storage method found.");return S._driverSet=f.reject(Q),S._driverSet}),y(this._driverSet,k,O),this._driverSet},d.prototype.supports=function(m){return!!of[m]},d.prototype._extend=function(m){Ko(this,m)},d.prototype._getSupportedDrivers=function(m){for(var k=[],O=0,S=m.length;O<S;O++){var N=m[O];this.supports(N)&&k.push(N)}return k},d.prototype._wrapLibraryMethodsWithReady=function(){for(var m=0,k=Vo.length;m<k;m++)Av(this,Vo[m])},d.prototype.createInstance=function(m){return new d(m)},d}(),Tv=new Iv;r.exports=Tv},{3:3}]},{},[4])(4)})}(hs)),hs.exports}var hd=dd();const wa=fd(hd);class pd extends vn{constructor(e){super(e,"storage",!1),e.set("localforage",wa)}get StorageManager(){return qr}createDatabse(e,n,r){return new qr("InPageEdit",e,n,r)}}const Bn=class Bn{constructor(e,n,r=Bn.DEFAULT_TTL,i){this.dbName=e,this.storeName=n,this.ttl=r,this.version=i,this.db=Bn.createDatabase(e,n),this.keys=this.db.keys.bind(this.db)}static createDatabase(e,n){const r=`${e}:${n}`;if(this._cached_db_instances.has(r))return this._cached_db_instances.get(r);const i=wa.createInstance({name:e,storeName:n});return this._cached_db_instances.set(r,i),i}async get(e,n=this.ttl,r){const i=await this.loadFromDB(e),s=this.checkIfExpired(i,n);if(!i||s){if(typeof r=="function"){const o=await r();return this.set(e,o).then(()=>o)}return null}return i.value}async set(e,n){return n===null||typeof n>"u"?this.delete(e):this.db.setItem(e,{time:Date.now(),value:n,version:this.version})}async has(e,n=this.ttl){const r=await this.loadFromDB(e),i=this.checkIfExpired(r,n);return r!==null&&!i}async delete(e){return this.db.removeItem(e)}async iterate(e){return await this.db.iterate((n,r)=>{e(n.value,r)})}async loadFromDB(e){const n=await this.db.getItem(e);if(!n)return null;if(typeof n.time!="number"||typeof n.value>"u"){try{this.delete(e)}catch{}return null}if(typeof this.version=="number"&&n.version!==this.version){try{this.delete(e)}catch{}return null}return n}checkIfExpired(e,n=this.ttl){return e?Date.now()-e.time>n:!1}async clear(){return await this.db.clear(),this}};Bn.DEFAULT_TTL=1/0,Bn._cached_db_instances=new Map;let qr=Bn;var md=Object.create,ps=Object.defineProperty,gd=Object.getOwnPropertyDescriptor,xa=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Sa=t=>{throw TypeError(t)},yd=(t,e,n)=>e in t?ps(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,vd=(t,e)=>ps(t,"name",{value:e,configurable:!0}),bd=t=>[,,,md(t?.[xa("metadata")]??null)],_d=["class","method","getter","setter","accessor","field","value","get","set"],Ea=t=>t!==void 0&&typeof t!="function"?Sa("Function expected"):t,wd=(t,e,n,r,i)=>({kind:_d[t],name:e,metadata:r,addInitializer:s=>n._?Sa("Already initialized"):i.push(Ea(s||null))}),xd=(t,e)=>yd(e,xa("metadata"),t[3]),Sd=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},Ed=(t,e,n,r,i,s)=>{var o,a,l,u=e&7,c=!1,f=0,b=t[f]||(t[f]=[]),y=u&&(i=i.prototype,u<5&&(u>3||!c)&&gd(i,n));vd(i,n);for(var v=r.length-1;v>=0;v--)l=wd(u,n,a={},t[3],b),o=(0,r[v])(i,l),a._=1,Ea(o)&&(i=o);return xd(t,i),y&&ps(i,n,y),c?u^4?s:y:i},$a,ms,ka;$a=[Ge(["api","storage"])];class Wr extends(ka=vn){constructor(e){super(e,"sitemeta",!1),this.ctx=e,this._data=void 0,this.siteIdentity=void 0,this.CACHE_TTL=1e3*60*60*24,this.VERSION=2,this.db=void 0,this.queryData={meta:"siteinfo|userinfo",siprop:"general|specialpagealiases|namespacealiases|namespaces|magicwords",uiprop:"groups|rights|blockinfo|options"},this.db=e.storage.createDatabse("sitemeta",this.CACHE_TTL,this.VERSION)}get api(){return this.ctx.api}get mwConfig(){return mw.config.values}async start(){const e=await this.fetchFromCache();if(e){this.ctx.logger("SiteMetadataService").info("Using cached metadata"),this._data=e;return}const n=await this.fetchFromApi();this.saveToCache(n),this._data=n}async computeSiteIdentity(){if(this.siteIdentity)return this.siteIdentity;let e;if(!window.mw?.config)e=new URL(location.href).origin;else{const{wgServer:n,wgArticlePath:r}=window.mw.config.get();e=`${n}${r}`}return this.siteIdentity=e,this.siteIdentity}async fetchFromApi(){return this.api.get({action:"query",...this.queryData}).then(({data:e})=>{if(typeof e?.query?.general>"u")throw new Error("Invalid siteinfo");return e.query}).catch(e=>(this.ctx.logger.error("[InPageEdit]","fetchMetadata error",e),Promise.reject(e)))}async fetchFromCache(){const e=await this.computeSiteIdentity();return this.db.get(e)}async saveToCache(e){const n=await this.computeSiteIdentity();return this.db.set(n,e)}get _raw(){return this._data}get siteInfo(){return this._data.general}get specialPageAliases(){return this._data.specialpagealiases}get namespaceAliases(){return this._data.namespacealiases}get namespaces(){return this._data.namespaces}get namespaceMap(){const e=Object.values(this.namespaces).map(n=>({id:n.id,canonical:n.canonical,aliases:this.namespaceAliases.filter(r=>r.id===n.id).map(r=>r.alias)})).sort((n,r)=>n.id-r.id);return Reflect.defineProperty(this,"namespaceMap",{value:e,writable:!1,configurable:!1,enumerable:!0}),e}get magicWords(){return this._data.magicwords}get userInfo(){return this._data.userinfo}get userOptions(){return this.userInfo.options}get isUserBlocked(){return this.userInfo.blockedbyid&&this.userInfo.blockexpiry&&new Date(this.userInfo.blockexpiry).getTime()>Date.now()}get userGroups(){return this.userInfo.groups}get userRights(){return this.userInfo.rights}hasRight(e){return this.userRights.includes(e)}hasAnyRight(...e){return e.some(n=>this.hasRight(n))}hasEveryRights(...e){return e.every(n=>this.hasRight(n))}inGroup(e){return this.userGroups.includes(e)}inAnyGroup(...e){return this.userGroups.some(n=>e.includes(n))}getBlockInfo(){return this.isUserBlocked?{blockid:this.userInfo.blockid,blockedby:this.userInfo.blockedbyid,blockedbyid:this.userInfo.blockedbyid,blockreason:this.userInfo.blockreason,blockedtimestamp:this.userInfo.blockedtimestamp,blockexpiry:this.userInfo.blockexpiry}:null}}ms=bd(ka),Wr=Ed(ms,0,"SiteMetadataService",$a,Wr),Sd(ms,1,Wr);var rt=(t=>(t.preferences="preferences",t.watch="watch",t.unwatch="unwatch",t.nochange="nochange",t))(rt||{});const zi=class zi{constructor(e,n){this.pageInfo={...zi.DEFAULT_PAGE_INFO,...e},this.api=n||new ba}async getPageInfo(e){const{data:{query:{pages:[n]}}}=await this.api.get({action:"query",prop:"info|templates|transcludedin|images|pageimages|revisions",inprop:"protection|url|varianttitles",intestactions:"edit|move|delete",tllimit:"max",tilimit:"max",imlimit:"max",piprop:"thumbnail|name|original",pithumbsize:"200",pilimit:"max",rvprop:"ids|timestamp|flags|comment|user|content",...e});return n.revisions?.forEach(r=>{if(typeof r.slots=="object"){const i=r.slots.main;i&&(r.content=i.content,r.contentmodel=i.contentmodel,r.contentformat=i.contentformat)}}),n}async parse(e){return this.api.post({action:"parse",page:this.pageInfo.title,prop:"text|langlinks|categories|links|templates|images|externallinks|sections|revid|displaytitle|iwlinks|properties|parsewarnings",...e})}async preview(e,n){return this.parse({action:"parse",page:void 0,title:this.title,text:e,pst:1,preview:1,disableeditsection:1,disablelimitreport:1,...n})}async edit(e,n){const{text:r,prependtext:i,appendtext:s,summary:o="",watchlist:a=rt.preferences,section:l}=e;return this.api.postWithEditToken({action:"edit",title:this.title,starttimestamp:this.pageInfo.touched,basetimestamp:this.revisions[0]?.timestamp,text:r,prependtext:i,appendtext:s,summary:o,watchlist:a,section:l,...n})}async createOnly(e,n){return this.edit(e,{createonly:1,...n})}async delete(e,n){return this.api.postWithEditToken({action:"delete",pageid:this.pageInfo.pageid,reason:e,...n})}async moveTo(e,n,r){return this.api.postWithEditToken({action:"move",from:this.pageInfo.title,to:e,reason:n,movetalk:1,movesubpages:1,...r})}userCan(e){return this.pageInfo?.actions?.[e]}userCanEdit(){return this.userCan("edit")}async refetch(){const e=await this.getPageInfo({pageids:this.pageInfo.pageid,titles:this.pageInfo.title}),n=(this.pageInfo.revisions||[]).concat(e.revisions||[]).sort((r,i)=>r.revid-i.revid).reduce((r,i)=>(r.find(s=>s.revid===i.revid)||r.push(i),r),[]);return this.pageInfo=e,this.pageInfo.revisions=n,this}get pageid(){return this.pageInfo.pageid}get title(){return this.pageInfo.title}get ns(){return this.pageInfo.ns}get contentmodel(){return this.pageInfo.contentmodel}get fullurl(){return this.pageInfo.fullurl}get canonicalurl(){return this.pageInfo.canonicalurl}get editurl(){return this.pageInfo.editurl}get revisions(){return this.pageInfo.revisions||[]}get templates(){return this.pageInfo.templates||[]}get images(){return this.pageInfo.images||[]}};zi.DEFAULT_PAGE_INFO={pageid:0,ns:0,title:"",contentmodel:"wikitext",pagelanguage:"",pagelanguagehtmlcode:"",pagelanguagedir:"ltr",touched:new Date().toISOString(),lastrevid:0,length:0,protection:[],restrictiontypes:[],fullurl:"",canonicalurl:"",editurl:"",varianttitles:{},actions:{edit:!0,move:!1,delete:!1},revisions:[],templates:[],images:[]};let Jn=zi;const Uo=class Uo extends vn{constructor(e){super(e,"wikiPage",!0),this.ctx=e}get WikiPage(){return Jn}async createInstance(e){const{data:{query:{pages:[n]}}}=await this.ctx.api.get({action:"query",prop:"info|templates|transcludedin|images|pageimages|revisions",inprop:"protection|url|varianttitles",intestactions:"edit|move|delete",tllimit:"max",tilimit:"max",imlimit:"max",piprop:"thumbnail|name|original",pithumbsize:"200",pilimit:"max",rvprop:"ids|timestamp|user|userid|content",...e});return new Jn(n,this.ctx.api)}async newFromTitle(e,n=!1,r){return this.createInstance({titles:e,converttitles:n,rvsection:r})}async newFromPageId(e,n){return this.createInstance({pageids:e,rvsection:n})}async newFromRevision(e,n){return this.createInstance({revids:e,rvsection:n})}newBlankPage(e={}){return new Jn(e,this.ctx.api)}};Uo.inject=["api"];let gs=Uo;const zr=Object.keys;function $d(t){return typeof t=="boolean"}function kd(t){return t&&typeof t.nodeType=="number"}function Vr(t){return typeof t=="string"}function Ca(t){return typeof t=="number"}function rn(t){return typeof t=="object"?t!==null:Qn(t)}function Qn(t){return typeof t=="function"}function Cd(t){return!!(t&&t.isComponent)}function Od(t){return rn(t)&&typeof t.length=="number"&&typeof t.nodeType!="number"}function ys(t,e){if(t)for(const n of zr(t))e(t[n],n)}function Pd(t){return rn(t)&&"current"in t}const vs={animationIterationCount:0,borderImageOutset:0,borderImageSlice:0,borderImageWidth:0,boxFlex:0,boxFlexGroup:0,boxOrdinalGroup:0,columnCount:0,columns:0,flex:0,flexGrow:0,flexPositive:0,flexShrink:0,flexNegative:0,flexOrder:0,gridArea:0,gridRow:0,gridRowEnd:0,gridRowSpan:0,gridRowStart:0,gridColumn:0,gridColumnEnd:0,gridColumnSpan:0,gridColumnStart:0,fontWeight:0,lineClamp:0,lineHeight:0,opacity:0,order:0,orphans:0,tabSize:0,widows:0,zIndex:0,zoom:0,fillOpacity:0,floodOpacity:0,stopOpacity:0,strokeDasharray:0,strokeDashoffset:0,strokeMiterlimit:0,strokeOpacity:0,strokeWidth:0};function Ad(t,e){return t+e.charAt(0).toUpperCase()+e.substring(1)}const Id=["Webkit","ms","Moz","O"];zr(vs).forEach(t=>{Id.forEach(e=>{vs[Ad(e,t)]=0})});const Td=Symbol.for("jsx-dom:type");var Oa=function(t){return t.ShadowRoot="ShadowRoot",t}(Oa||{});function Rd(t){return t!=null&&t[Td]===Oa.ShadowRoot}const Nd="http://www.w3.org/2000/svg",Dd="http://www.w3.org/1999/xlink",Ld="http://www.w3.org/XML/1998/namespace";function Pa(t){return!$d(t)&&t!=null}function bs(t){return Array.isArray(t)?t.map(bs).filter(Boolean).join(" "):rn(t)?Symbol.iterator in t?bs(Array.from(t)):zr(t).filter(e=>t[e]).join(" "):Pa(t)?""+t:""}const jd={animate:0,circle:0,clipPath:0,defs:0,desc:0,ellipse:0,feBlend:0,feColorMatrix:0,feComponentTransfer:0,feComposite:0,feConvolveMatrix:0,feDiffuseLighting:0,feDisplacementMap:0,feDistantLight:0,feFlood:0,feFuncA:0,feFuncB:0,feFuncG:0,feFuncR:0,feGaussianBlur:0,feImage:0,feMerge:0,feMergeNode:0,feMorphology:0,feOffset:0,fePointLight:0,feSpecularLighting:0,feSpotLight:0,feTile:0,feTurbulence:0,filter:0,foreignObject:0,g:0,image:0,line:0,linearGradient:0,marker:0,mask:0,metadata:0,path:0,pattern:0,polygon:0,polyline:0,radialGradient:0,rect:0,stop:0,svg:0,switch:0,symbol:0,text:0,textPath:0,tspan:0,use:0,view:0},Md=/^(a(ll|t|u)|base[FP]|c(al|lipPathU|on)|di|ed|ex|filter[RU]|g(lyphR|r)|ke|l(en|im)|ma(rker[HUW]|s)|n|pat|pr|point[^e]|re[^n]|s[puy]|st[^or]|ta|textL|vi|xC|y|z)/;function Xn(t){const e=document.createDocumentFragment();return Kr(t.children,e),e}function Fd(t,e,n){e={...e,children:n};const r=new t(e),i=r.render();return"ref"in e&&_s(e.ref,r),i}function C(t,e){let{children:n,...r}=e;!r.namespaceURI&&jd[t]===0&&(r={...r,namespaceURI:Nd});let i;if(Vr(t)){if(i=r.namespaceURI?document.createElementNS(r.namespaceURI,t):document.createElement(t),qd(r,i),Kr(n,i),i instanceof window.HTMLSelectElement&&r.value!=null)if(r.multiple===!0&&Array.isArray(r.value)){const s=r.value.map(o=>String(o));i.querySelectorAll("option").forEach(o=>o.selected=s.includes(o.value))}else i.value=r.value;_s(r.ref,i)}else if(Qn(t))rn(t.defaultProps)&&(r={...t.defaultProps,...r}),i=Cd(t)?Fd(t,r,n):t({...r,children:n});else throw new TypeError(`Invalid JSX element type: ${t}`);return i}function Bd(t,e){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return(Vr(e)||Array.isArray(e))&&(r.unshift(e),e={}),e=e||{},e.children!=null&&!r.length&&({children:r,...e}=e),C(t,{...e,children:r},e.key)}function _s(t,e){Pd(t)?t.current=e:Qn(t)&&t(e)}function Kr(t,e){if(Od(t))Ud(t,e);else if(Vr(t)||Ca(t))ws(document.createTextNode(t),e);else if(t===null)ws(document.createComment(""),e);else if(kd(t))ws(t,e);else if(Rd(t)){const n=e.attachShadow(t.attr);Kr(t.children,n),_s(t.ref,n)}}function Ud(t,e){for(const n of[...t])Kr(n,e);return e}function ws(t,e){e instanceof window.HTMLTemplateElement?e.content.appendChild(t):e.appendChild(t)}function Yr(t,e){return t.replace(/[A-Z]/g,n=>e+n.toLowerCase())}function Aa(t,e){e==null||e===!1||(Array.isArray(e)?e.forEach(n=>Aa(t,n)):Vr(e)?t.setAttribute("style",e):rn(e)&&ys(e,(n,r)=>{r.indexOf("-")===0?t.style.setProperty(r,n):Ca(n)&&vs[r]!==0?t.style[r]=n+"px":t.style[r]=n}))}function Hd(t,e,n){switch(t){case"xlinkActuate":case"xlinkArcrole":case"xlinkHref":case"xlinkRole":case"xlinkShow":case"xlinkTitle":case"xlinkType":Ia(n,Dd,Yr(t,":"),e);return;case"xmlnsXlink":_n(n,Yr(t,":"),e);return;case"xmlBase":case"xmlLang":case"xmlSpace":Ia(n,Ld,Yr(t,":"),e);return}switch(t){case"htmlFor":_n(n,"for",e);return;case"dataset":ys(e,(r,i)=>{r!=null&&(n.dataset[i]=r)});return;case"innerHTML":case"innerText":case"textContent":Pa(e)&&(n[t]=e);return;case"dangerouslySetInnerHTML":rn(e)&&(n.innerHTML=e.__html);return;case"value":if(e==null||n instanceof window.HTMLSelectElement)return;if(n instanceof window.HTMLTextAreaElement){n.value=e;return}break;case"spellCheck":n.spellcheck=e;return;case"class":case"className":Qn(e)?e(n):_n(n,"class",bs(e));return;case"ref":case"namespaceURI":return;case"style":Aa(n,e);return;case"on":case"onCapture":ys(e,(r,i)=>{n.addEventListener(i,r,t==="onCapture")});return}if(Qn(e)){if(t[0]==="o"&&t[1]==="n"){let r=t.toLowerCase();const i=r.endsWith("capture");if(r==="ondoubleclick"?r="ondblclick":i&&r==="ondoubleclickcapture"&&(r="ondblclickcapture"),!i&&n[r]===null)n[r]=e;else if(i)n.addEventListener(r.substring(2,r.length-7),e,!0);else{let s;r in window?s=r.substring(2):s=r[2]+t.slice(3),n.addEventListener(s,e)}}}else rn(e)?n[t]=e:e===!0?_n(n,t,""):e!==!1&&e!=null&&(n instanceof SVGElement&&!Md.test(t)?_n(n,Yr(t,"-"),e):_n(n,t,e))}function _n(t,e,n){t.setAttribute(e,n)}function Ia(t,e,n,r){t.setAttributeNS(e,n,r)}function qd(t,e){for(const n of zr(t))Hd(n,t[n],e);return e}var xs=(t=>(t.Init="modal.init",t.BeforeShow="modal.beforeShow",t.Show="modal.show",t.BeforeClose="modal.beforeClose",t.Close="modal.close",t.Destroy="modal.destroy",t.ToastShow="toast.show",t.ToastClose="toast.close",t))(xs||{});let Wd=0;const Ta=t=>`${t}-${++Wd}`;function Zn(t){return t instanceof Node?t:document.createTextNode(String(t))}function Tt(t,e){if(!t)throw new Error(`${e??"Element"} not found`);return t}function Ra(t){const e=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(",");return Array.from(t.querySelectorAll(e)).filter(n=>!!(n.offsetWidth||n.offsetHeight||n.getClientRects().length))}function We(t,e={}){const n=document.createElement(t);if(e.className&&(n.className=e.className),e.html!=null&&(n.innerHTML=e.html),e.text!=null&&(n.textContent=e.text),e.attrs)for(const[r,i]of Object.entries(e.attrs))n.setAttribute(r,i);return n}class zd{constructor(){this.zBase=1e3,this.stack=[]}push(e){this.stack.push(e),this.syncZ()}remove(e){this.stack=this.stack.filter(n=>n!==e),this.syncZ()}top(){return this.stack[this.stack.length-1]}closeAll(e,n){const r=new Set((Array.isArray(n)?n:n?[n]:[]).map(String)),i=new Set((Array.isArray(e)?e:e?[e]:[]).map(String));[...this.stack].reverse().forEach(s=>{const o=s.modalId,a=i.size?i.has(s.pluginName):!0,l=r.has(o);a&&!l&&s.close()})}removeAll(){[...this.stack].forEach(e=>e.destroy()),this.stack=[]}syncZ(){this.stack.forEach((e,n)=>e.setZIndex(this.zBase+n*2))}lockBodyScroll(){document.documentElement.classList.add("ipe-modal-no-scroll")}unlockBodyScroll(){document.documentElement.classList.remove("ipe-modal-no-scroll")}}const Xe=new zd,Vi=class Vi{constructor(e={}){this.backdropId=Ta("ipe-modal-backdrop"),this.modalId=Ta("ipe-modal"),this.numberId=this.modalId.split("-")[1],this._isDestroyed=!1,this.pluginName="normalModal",this.buttonElsLeft=[],this.buttonElsRight=[],this.keyMap=new Map,this.isOpen=!1,this.isToast=!1,this.isDragging=!1,this.dragStartX=0,this.dragStartY=0,this.modalStartX=0,this.modalStartY=0,this.Event=xs,this.DEFAULT_OPTIONS={className:"",sizeClass:"auto",center:!0,fitScreen:!1,closeIcon:!0,bodyScroll:!1,outSideClose:!0,backdrop:!0,animation:!1,animationSpeed:200},this._hooks=[],this.startCloseTimer=n=>{this.stopCloseTimer(),this.closeTimer=window.setTimeout(()=>this.close(),n)},this.stopCloseTimer=()=>{this.closeTimer&&window.clearTimeout(this.closeTimer),this.closeTimer=void 0},this.onDragMove=n=>{if(!this.isDragging)return;n.preventDefault();const r=n.clientX-this.dragStartX,i=n.clientY-this.dragStartY,s=this.get$modal(),o=this.modalStartX+r,a=this.modalStartY+i;s.style.left=`${o}px`,s.style.top=`${a}px`},this.onDragEnd=()=>{if(!this.isDragging)return;this.isDragging=!1,document.removeEventListener("pointermove",this.onDragMove),document.removeEventListener("pointerup",this.onDragEnd),this.get$modal().classList.remove("is-dragging")},this.options={...this.DEFAULT_OPTIONS,...e},this.options.backdrop===!1&&e.bodyScroll===void 0&&(this.options.bodyScroll=!0)}get isDestroyed(){return this._isDestroyed}init(){if(this.$modal)return this;const e=this.options.backdrop!==!1;let n;e&&(n=We("div",{className:"ipe-modal-backdrop",attrs:{id:this.backdropId,"data-modal-id":this.modalId}}));const r=We("div",{className:"ipe-modal-modal",attrs:{id:this.modalId,role:"dialog","aria-modal":"true",tabindex:"-1"}});if(r.modal=this,!e){r.classList.add("no-backdrop");const y=window.pageYOffset||document.documentElement.scrollTop,v=window.pageXOffset||document.documentElement.scrollLeft,A=window.innerWidth;r.style.top=`${y+60}px`,this.once("modal.show",()=>{r.style.left=`${v+A/2-r.offsetWidth/2}px`})}const i=We("div",{className:`ipe-modal-modal__window size--${this.options.sizeClass||"auto"} plugin--${this.pluginName}`});i.modal=this;const s=We("div",{className:"ipe-modal-modal__header"}),o=`${this.modalId}-title`,a=We("h2",{className:"ipe-modal-modal__title",attrs:{id:o,role:"heading","aria-level":"2"}});r.setAttribute("aria-labelledby",o);const l=We("div",{className:"ipe-modal-modal__icons"});if(this.options.closeIcon){const y=We("button",{className:"ipe-modal-modal__close",attrs:{type:"button","aria-label":"Close"},html:"×"});y.addEventListener("click",()=>{let v=!0;typeof this.options.onClickClose=="function"?this.options.onClickClose(this)===!1&&(v=!1):this.options.onClickClose===!1&&(v=!1),v&&this.close()}),l.appendChild(y)}s.append(a,l),!e&&this.options.draggable&&(s.style.cursor="move",s.style.userSelect="none",s.addEventListener("pointerdown",this.onDragStart.bind(this)));const u=We("div",{className:"ipe-modal-modal__content"}),c=We("div",{className:"ipe-modal-modal__footer"}),f=We("div",{className:"ipe-modal-modal__buttons ipe-modal-modal__buttons--left"}),b=We("div",{className:"ipe-modal-modal__buttons ipe-modal-modal__buttons--right"});return c.append(f,b),i.append(s,u,c),r.appendChild(i),this.$backdrop=n,this.$modal=r,this.$window=i,this.$header=s,this.$title=a,this.$icons=l,this.$content=u,this.$footer=c,this.$buttonsLeft=f,this.$buttonsRight=b,this.options.title&&this.setTitle(this.options.title),this.options.content&&this.setContent(this.options.content),this.options.buttons?.length?this.setButtons(this.options.buttons):c.style.display="none",this.options.center&&this.$modal.classList.add("is-centered"),this.options.fitScreen&&this.$modal.classList.add("is-fullscreen"),this.options.iconButtons&&this.$header.classList.add("has-icon-buttons"),this.options.className&&this.$window.classList.add(...this.options.className.split(/[\s\.#+]+/g).filter(Boolean)),typeof this.options.fixedHeight=="number"?this.$window.style.height=`${Math.max(0,this.options.fixedHeight)}px`:this.options.fixedHeight===!0&&this.$window.classList.add("is-fixed-height"),n&&n.addEventListener("pointerdown",y=>{this.options.outSideClose&&y.target===n&&this.close()}),this.onKeyDown=this.onKeyDown.bind(this),this.emit("modal.init"),this}show(){if(this.$modal||this.init(),!this.$modal)throw new Error("Failed to initialize modal");if(this.isOpen)return this;{const r=this.emit("modal.beforeShow",!0),i=this.options.beforeShow?this.options.beforeShow(this)!==!1:!0;if(!r||!i)return this}this.lastFocused=document.activeElement??null,this.$backdrop&&document.body.appendChild(this.$backdrop),document.body.appendChild(this.$modal),this.shouldLockBodyOnOpen()&&Xe.lockBodyScroll(),requestAnimationFrame(()=>{this.$backdrop?.classList.add("is-open"),this.$modal.classList.add("is-open"),this.applyAnimation(!0),this.focusFirst()}),document.addEventListener("keydown",this.onKeyDown),Xe.push(this),this.isOpen=!0,this.options.onShow?.(this),this.emit("modal.show");const e=typeof this.options.closeAfter=="number"?this.options.closeAfter:this.options.closeAfter?.time,n=typeof this.options.closeAfter=="number"?!0:this.options.closeAfter?.resetOnHover;return e&&(this.startCloseTimer(e),n&&(this.$window?.addEventListener("mouseenter",this.stopCloseTimer),this.$window?.addEventListener("mouseleave",()=>this.startCloseTimer(e)))),this}close(){if(!this.isOpen)return this;{const s=this.emit("modal.beforeClose",!0),o=this.options.beforeClose?this.options.beforeClose(this)!==!1:!0;if(!s||!o)return this}if(this.isToast)return this.emit("modal.close"),this.emit("toast.close"),this.destroy(),this.options.onClose?.(this),this;this.applyAnimation(!1),this.$backdrop?.classList.remove("is-open"),this.$modal?.classList.remove("is-open"),this.emit("modal.close");const e=this.isAnimationDisabled()?0:this.options.animationSpeed??200;let n=!1;const r=()=>{n||(n=!0,this.destroy(),this.options.onClose?.(this))},i=(s,o)=>{const a=()=>{s.removeEventListener(o,a),r()};s.addEventListener(o,a,{once:!0})};return e>0&&this.$window?(i(this.$window,"transitionend"),i(this.$window,"animationend"),window.setTimeout(r,e+20)):window.setTimeout(r,e),this}destroy(){if(this._isDestroyed)return this;if(this.stopCloseTimer(),document.removeEventListener("keydown",this.onKeyDown),this.isDragging&&this.onDragEnd(),this.$window?.removeEventListener("mouseenter",this.stopCloseTimer),this.isToast){this.$window?.parentElement&&this.$window.parentElement.removeChild(this.$window);const e=sn.indexOf(this);e!==-1&&sn.splice(e,1)}else this.$backdrop?.parentElement&&this.$backdrop.parentElement.removeChild(this.$backdrop),this.$modal?.parentElement&&this.$modal.parentElement.removeChild(this.$modal),Xe.remove(this),this.shouldUnlockBodyOnClose()&&Xe.unlockBodyScroll();return this.isOpen=!1,this.lastFocused?.focus?.(),this.emit("modal.destroy"),this._isDestroyed=!0,this}get$backdrop(){return this.$backdrop}get$modal(){return Tt(this.$modal,"modal")}get$window(){return Tt(this.$window,"window")}get$header(){return Tt(this.$header,"header")}get$title(){return Tt(this.$title,"title")}get$content(){return Tt(this.$content,"content")}get$icons(){return Tt(this.$icons,"icons")}get$buttons(e){return e==="leftButtons"?Tt(this.$buttonsLeft,"leftButtons"):e==="rightButtons"?Tt(this.$buttonsRight,"rightButtons"):Tt(this.$footer,"buttons")}setTitle(e){const n=this.get$title();return n.innerHTML="",n.append(Zn(e)),this}setContent(e,n="replace"){const r=this.get$content();return n==="replace"?(r.innerHTML="",r.append(Zn(e))):n==="append"?r.append(Zn(e)):r.prepend(Zn(e)),this}setIcons(e){const n=this.get$icons();n.innerHTML="";for(const r of e){const i=We("button",{className:`ipe-modal-modal__icon ${r.className}`,attrs:{type:"button"}});i.addEventListener("click",r.method),n.appendChild(i)}return this}setButtons(e,n){const r=this.$buttonsLeft,i=this.$buttonsRight;[r,i].forEach(o=>o.innerHTML=""),this.buttonElsLeft=[],this.buttonElsRight=[],this.keyMap.clear();const s=n??this.$footer;if(s===this.$footer)e.forEach(o=>this.addButton(o)),e.length===0&&(this.$footer.style.display="none");else{s.innerHTML="";for(const o of e){const a=this.generateButton(o);s.appendChild(a)}}return this}generateButton(e){const n=e.type??"button",r=n==="link"?We("a"):We("button",{attrs:{type:"button"}});e.id&&(r.id=e.id),r.className=`ipe-modal-btn ${e.className??""}`.trim();const i=Zn(e.label??"OK");if(r.append(i),n==="link"&&e.href&&(r.href=e.href),e.method&&r.addEventListener("click",s=>{if(r._ipe_tmpDisabled){s.preventDefault(),s.stopPropagation();return}e.method.call(r,s,this)}),typeof e.closeAfter=="number"&&e.closeAfter>=0&&r.addEventListener("click",()=>{window.setTimeout(()=>this.close(),e.closeAfter)}),typeof e.enableAfter=="number"&&e.enableAfter>0){n==="button"&&r.setAttribute("disabled","true"),r._ipe_tmpDisabled=!0,r.setAttribute("aria-disabled","true");const s=()=>{n==="button"&&r.removeAttribute("disabled"),delete r._ipe_tmpDisabled,r.removeAttribute("aria-disabled")};window.setTimeout(s,e.enableAfter)}return e.keyPress&&this.keyMap.set(String(e.keyPress).toLowerCase(),r),r}addButton(e,n){this.$footer&&(this.$footer.style.display="");const r=e.side??"right",i=r==="left"?this.$buttonsLeft:this.$buttonsRight,s=r==="left"?this.buttonElsLeft:this.buttonElsRight,o=this.generateButton(e),a=Math.max(0,Math.min(n??s.length,s.length));return a>=i.children.length?i.appendChild(o):i.insertBefore(o,i.children[a]),s.splice(a,0,o),this}removeButton(e){const n=this.buttonElsLeft,r=this.buttonElsRight,i=[...n,...r];let s=null;if(typeof e=="number"?s=i[e]??null:typeof e=="string"?s=i.find(a=>a.id===e)??null:e instanceof HTMLElement&&(s=i.find(a=>a===e)??null),!s)return this;for(const[a,l]of this.keyMap.entries())l===s&&this.keyMap.delete(a);let o=n.indexOf(s);return o!==-1?(n.splice(o,1),s.parentElement?.removeChild(s)):(o=r.indexOf(s),o!==-1&&(r.splice(o,1),s.parentElement?.removeChild(s))),n.length===0&&r.length===0&&this.$footer&&(this.$footer.style.display="none"),this}changePreviewState(){return this.get$modal().classList.toggle("is-fullscreen"),this}setModalHeight(e,n="height"){const r=this.get$window(),i=Math.max(0,window.innerHeight-e);return r.style[n]=`${i}px`,i}setOptions(e,n){return typeof e=="string"?this.options[e]=n:Object.assign(this.options,e),this}setPluginName(e){return this.$window&&(this.$window.className=this.$window.className.replace(`plugin--${this.pluginName}`,`plugin--${e}`)),this.pluginName=e,this}applyAnimation(e){const n=this.get$modal(),r=this.get$window(),i=this.$backdrop,s=this.options.modalAnimation??this.options.animation,o=typeof s=="string"?s:s&&(e?s.show:s.hide),a=this.options.backdropAnimation??this.options.animation,l=typeof a=="string"?a:a&&(e?a.show:a.hide);!o||o===!1?(n.style.transition="none",r.style.animation="none",r.style.removeProperty("--ipe-modal-anim")):(n.style.removeProperty("transition"),r.style.setProperty("--ipe-modal-anim",o)),i&&(!l||l===!1?i.style.transition="none":i.style.removeProperty("transition"))}on(e,n){return this._hooks.push({type:e,listener:n}),()=>this.off(e,n)}off(e,n){return this._hooks=this._hooks.filter(r=>r.type!==e||r.listener!==n),this}once(e,n){const r=this.on(e,i=>(r(),n(i)));return r}emit(e,n){const r=this._hooks.filter(l=>l.type===e);let i=!0;for(const l of r){const u=new CustomEvent(e,{detail:this,cancelable:n}),c=l.listener(u);if(u.defaultPrevented&&(i=!1),c===!1&&(i=!1),!i)break}const s=this.$modal??document.body,o=new CustomEvent(e,{detail:this,cancelable:n});return(!s.dispatchEvent(o)||o.defaultPrevented)&&(i=!1),i}focusFirst(){const e=this.get$modal(),n=Ra(e);n.length?n[0].focus():e.focus({preventScroll:!0})}onKeyDown(e){if(Xe.top()!==this)return;if(e.key==="Escape"){e.preventDefault(),this.close();return}const n=this.get$modal();if(!n.contains(document.activeElement))return;if(e.key==="Tab"){const i=Ra(n);if(!i.length)return;const s=i[0],o=i[i.length-1],a=document.activeElement;e.shiftKey&&a===s?(e.preventDefault(),o.focus()):!e.shiftKey&&a===o&&(e.preventDefault(),s.focus())}const r=this.keyMap.get(e.key.toLowerCase());r&&r.click()}setZIndex(e){this.$backdrop&&(this.$backdrop.style.zIndex=String(e)),this.$modal&&(this.$modal.style.zIndex=String(e+1))}bringToFront(){return Xe.remove(this),Xe.push(this),this}isAnimationDisabled(){const e=this.options.modalAnimation??this.options.animation;return e===!1||e==null}shouldLockBodyOnOpen(){return this.options.backdrop===!1||this.options.bodyScroll!==!1?!1:!Xe.stack.some(n=>n!==this&&n.options.backdrop!==!1&&n.options.bodyScroll===!1)}shouldUnlockBodyOnClose(){return this.options.backdrop===!1||this.options.bodyScroll!==!1?!1:!Xe.stack.some(n=>n!==this&&n.options.backdrop!==!1&&n.options.bodyScroll===!1)}onDragStart(e){if(this.options.backdrop!==!1||!this.options.draggable)return;e.preventDefault(),this.isDragging=!0,this.bringToFront(),this.dragStartX=e.clientX,this.dragStartY=e.clientY;const n=this.get$modal(),r=n.getBoundingClientRect();this.modalStartX=r.left+window.pageXOffset,this.modalStartY=r.top+window.pageYOffset,n.style.transform="none",n.style.left=`${this.modalStartX}px`,n.style.top=`${this.modalStartY}px`,document.addEventListener("pointermove",this.onDragMove),document.addEventListener("pointerup",this.onDragEnd),n.classList.add("is-dragging")}showToast(e){this.$window||this.init();const n=Vd(e.position??"top right"),r=this.get$window();this.isToast=!0,r.style.pointerEvents="auto",this.applyAnimation(!0),n.appendChild(r);const i=(typeof this.options.closeAfter=="number"?this.options.closeAfter:this.options.closeAfter?.time)??3e3,s=(typeof this.options.closeAfter=="number"?!0:this.options.closeAfter?.resetOnHover)??!0;return i>0&&(this.startCloseTimer(i),s&&(r.addEventListener("mouseenter",this.stopCloseTimer),r.addEventListener("mouseleave",()=>this.startCloseTimer(i)))),this.isOpen=!0,this.options.onShow?.(this),sn.push(this),this.emit("toast.show"),this.emit("modal.show"),this}static show(e,n){return new this(e).init().show()}static createObject(e,n){return new this(e)}static close(e){if(!e){const s=Xe.top();return s?.close(),s}const n=typeof e=="string"?e:e.id,r=Xe.stack.find(s=>s.modalId===n);if(r)return r.close(),r;const i=sn.find(s=>s.modalId===n);return i?.close(),i}static closeAll(e,n){const r=new Set((Array.isArray(n)?n:n?[n]:[]).map(String)),i=new Set((Array.isArray(e)?e:e?[e]:[]).map(String));return Xe.closeAll(e,n),[...sn].forEach(s=>{const o=s.modalId,a=i.size?i.has(s.pluginName):!0,l=r.has(o);a&&!l&&s.close()}),Xe.top()??new Vi}static removeAll(){Xe.removeAll(),[...sn].forEach(e=>e.destroy())}static dialog(e,n){const r=new this({sizeClass:"dialog",buttons:[{label:"OK",className:"is-primary",method:(i,s)=>{n?.(i,s),i.defaultPrevented||r.close()},keyPress:"Enter"}],...e});return r.init().show()}static confirm(e,n){e.title??(e.title="Confirm");const r=e.okBtn??{label:"OK",className:"is-primary"},i=e.cancelBtn??{label:"Cancel",className:"is-danger is-ghost"},s=new this({sizeClass:"dialog",...e,buttons:[{label:i.label,className:i.className,keyPress:"n",method:()=>s.close()},{label:r.label,className:r.className,keyPress:"y",method:o=>{n?.(o,s),o.defaultPrevented||s.close()}}]});return s.init().show()}static notify(e,n,r){var a,l,u,c;n?.overrideOther&&[...sn].forEach(f=>f.close()),typeof n.title>"u"&&(n.title=e[0].toUpperCase()+e.slice(1).toLowerCase());const i=this.notifyIcons[e];n.title=`${i} ${n.title}`.trimStart(),n.okBtn&&((a=n.okBtn).label??(a.label="OK"),(l=n.okBtn).className??(l.className="is-primary is-ghost ok-btn"),n.okBtn.method=()=>{r?.(!0),o.close()}),n.cancelBtn&&((u=n.cancelBtn).label??(u.label="Cancel"),(c=n.cancelBtn).className??(c.className="is-danger is-ghost cancel-btn"),n.cancelBtn.method=()=>{r?.(!1),o.close()}),n.buttons=[n.okBtn,n.cancelBtn,...n.buttons??[]].filter(Boolean);const s=`is-${e||"dialog"} is-toast compact-buttons ${n.className??""}`,o=new this({...n,className:s,sizeClass:"auto",center:!1,fitScreen:!1,closeIcon:!0,outSideClose:!1,bodyScroll:!0,animation:n.animation??{show:"fadeIn",hide:"fadeOut"},buttons:n.buttons??[]});return o.setPluginName("toast"),o.showToast({position:n.position??"top right"})}};Vi.notifyIcons={success:"✅",error:"❌",warning:"⚠️",info:"ℹ️",dialog:"💬",confirm:"💬"};let Ss=Vi;const sn=[];function Vd(t="top right"){const e="ipe-modal-toast-container",n=`${e}-${t.replace(/[\s-\.|\/]+/g,"-")}`;let r=document.getElementById(n);return r||(r=We("div",{className:`${e} ${t}`,attrs:{id:n,"data-position":t}}),document.body.appendChild(r)),r}const Kd={ipe_progress:"_ipe_progress_so6hn_1"},on=t=>{const e=t.indeterminate??!0,n=C("div",{class:`${Kd.ipe_progress}`,"data-indeterminate":`${e}`,style:{width:"100%","--progress":t.progress?`${t.progress}%`:"0%"},...t});return n.setProgress=r=>{typeof r=="number"?(n.dataset.indeterminate="false",n.style.setProperty("--progress",`${r}%`)):(n.dataset.indeterminate="true",n.style.setProperty("--progress","0%"))},n};class De extends Ss{constructor(e={}){e.className||(e.className=""),e.className+=" theme-ipe",super(e)}setLoadingState(e){if(this.get$window().classList.toggle("loading",e),e){const n=this.get$window().querySelectorAll("input:not([disabled]),button:not([disabled])");this._tmpDisabledActiveInputs=n,n.forEach(r=>{r.disabled=!0}),this.get$content().append(C("div",{id:"ipe-modalLoadingWrapper",style:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:"rgba(255, 255, 255, 0.5)",zIndex:2e3},children:C(on,{style:{width:"80%",maxWidth:"800px"}})}))}else{this.get$window().querySelector("#ipe-modalLoadingWrapper")?.remove();const n=this._tmpDisabledActiveInputs;n&&n.forEach(r=>{r.disabled=!1})}}}class Yd{constructor(e){this.ctx=e,this.IPEModal=De,this.IPEModalEvent=xs,this.show=De.show.bind(De),this.createObject=De.createObject.bind(De),this.close=De.close.bind(De),this.closeAll=De.closeAll.bind(De),this.removeAll=De.removeAll.bind(De),this.dialog=De.dialog.bind(De),this.confirm=De.confirm.bind(De),this.notify=De.notify.bind(De),e.set("modal",this)}}var Es=(t=>(t.ANALYTICS_API_BASE="https://analytics.ipe.wiki/api",t.ANALYTICS_DASH_URL="https://analytics.ipe.wiki",t.GITHUB_URL="https://github.com/inpageedit/inpageedit-v2",t.HOME_URL="https://www.ipe.wiki/",t.PLUGIN_CDN_BASE="https://ipe-plugins.js.org",t.PLUGIN_HOME_URL="https://github.com/inpageedit/Plugins",t.SPECIAL_NOTICE_JSON="https://ipe-plugins.js.org/specialNotice.json",t.UPDATE_LOGS_URL="https://www.ipe.wiki/update/",t))(Es||{});/**
|
|
53
53
|
* ✏️ InPageEdit NEXT
|
|
54
54
|
*
|
|
55
55
|
* 🚀 Modular, Extensible Supercharged Plugin for MediaWiki
|
|
@@ -58,53 +58,53 @@
|
|
|
58
58
|
* @license MIT
|
|
59
59
|
* @see https://github.com/inpageedit/inpageedit-next
|
|
60
60
|
* @see https://www.ipe.wiki/
|
|
61
|
-
*/const
|
|
61
|
+
*/const kr=class kr extends Je{constructor(n){super();Qo(this,At);this.version="0.5.1",this.Endpoints=Es,this.schema=Se,this.config={...kr.DEFAULT_CONFIG,...n},this.logger=ha({name:"IPE",color:"#33aaff",level:this.config.logLevel}),Tr(this,At,df).call(this),Tr(this,At,pf).call(this),Tr(this,At,mf).call(this)}async useScope(n){const{promise:r,resolve:i}=ye();return this.inject(n,s=>{i(s)}),r}};At=new WeakSet,df=async function(){this.plugin(cd,{baseURL:this.config.baseURL}),this.plugin(ud),this.plugin(Yd),this.plugin(pd),this.plugin(Wr),this.plugin(gs),Tr(this,At,hf).call(this,["api","resourceLoader","modal","storage","wikiPage"])},hf=function(n){if(typeof n=="string"&&(n=[n]),!Array.isArray(n)||n.length===0)return this;for(const r of n){const i=this[kr.internal][r];i?.type==="service"&&(i.builtin=!0)}return this},pf=async function(){[Promise.resolve().then(()=>uh).then(({PluginPreferences:r})=>r),Promise.resolve().then(()=>Ih).then(({PluginQuickEdit:r})=>r),Promise.resolve().then(()=>Hh).then(({PluginQuickMove:r})=>r),Promise.resolve().then(()=>Zh).then(({PluginQuickPreview:r})=>r),Promise.resolve().then(()=>Hp).then(({PluginQuickDiff:r})=>r),Promise.resolve().then(()=>qp).then(({PluginQuickRedirect:r})=>r),Promise.resolve().then(()=>em).then(({PluginToolbox:r})=>r)].forEach(async r=>{this.plugin(await r)})},mf=async function(){this.inject(["resourceLoader"],n=>{})},kr.DEFAULT_CONFIG={baseURL:"",legacyPreferences:{},logLevel:ls.info};let an=kr;function Gd(t){return t.charAt(0).toLowerCase()+t.slice(1)}function Jd(t){return Gd(t).replace(/-/g,"_").replace(/.[A-Z]+/g,e=>e[0]+"_"+e.slice(1).toLowerCase())}const Ki=class Ki{constructor(e,n=void 0,r){Qo(this,Cr);this.ctx=e,this.disposeHandlers=[],this.name=r||this.constructor.name,this.config=n||{};const{promise:i,resolve:s,reject:o}=Promise.withResolvers();queueMicrotask(()=>{try{const a=this.start();a&&typeof a.then=="function"?a.then(()=>s()).catch(l=>{this.logger.error("Plugin start failed",l),o(l)}):s()}catch(a){this.logger.error("Plugin start threw synchronously",a),o(a)}i.then(()=>{this.logger.info("Plugin started")}),i.catch(a=>{this.logger.error("Plugin start failed",a),this.ctx.scope.dispose()})}),this.ctx.once("dispose",()=>{this.disposeHandlers.forEach(a=>a(this.ctx)),this.stop(),this.logger.info("Plugin disposed")})}start(){}stop(){}addDisposeHandler(e){this.disposeHandlers.push(e)}removeDisposeHandler(e){this.disposeHandlers=this.disposeHandlers.filter(n=>n!==e)}set name(e){uf(this,Cr,Jd(e).toUpperCase())}get name(){return cf(this,Cr)}get logger(){return this.ctx.logger(this.name)}};Cr=new WeakMap,Ki.inject=[],Ki.reusable=!1;let ut=Ki;window.RLQ||(window.RLQ=[]),window.__IPE_MODULES__||(window.__IPE_MODULES__=[]),Xd("InPageEdit#autoload",()=>{window.RLQ.push(Qd)});async function Qd(){typeof window?.ipe?.stop=="function"&&await window.ipe.stop();const t=window.InPageEdit||{},e=new an({baseURL:window.mw?.util.wikiScript("api"),legacyPreferences:t?.myPreferences||{}});if(window.InPageEdit=an,window.ipe=e,window.mw.hook("InPageEdit.ready").fire(e),await e.start(),Array.isArray(window.__IPE_MODULES__)){const n=[];for(;window.__IPE_MODULES__.length;)try{const r=window.__IPE_MODULES__.shift();typeof r=="function"&&r?.(e),n.push(r)}catch{}window.__IPE_MODULES__={push:r=>{typeof r=="function"&&r(e),n.push(r)}},e.on("dispose",()=>{window.__IPE_MODULES__=n})}e.logger("AUTOLOAD").info(`${Es.HOME_URL}
|
|
62
62
|
____ ____ ______ ___ __
|
|
63
63
|
/ _/___ / __ \\____ _____ ____ / ____/___/ (_) /_
|
|
64
64
|
/ // __ \\/ /_/ / __ \`/ __ \`/ _ \\/ __/ / __ / / __/
|
|
65
65
|
_/ // / / / ____/ /_/ / /_/ / __/ /___/ /_/ / / /_
|
|
66
66
|
/___/_/ /_/_/ \\__,_/\\__, /\\___/_____/\\__,_/_/\\__/
|
|
67
|
-
/____/ v`+e.version)}function Gd(t,e){const n=Symbol.for(t);return window[n]?!1:(window[n]=!0,e(),!0)}const Jd=window?.location?.origin,Ia=({type:t,tag:e,href:n,target:r,children:i,...s})=>(e=e||(n?"a":"button"),typeof r>"u"&&n&&n.startsWith("http")&&!n.startsWith(Jd)&&(r="_blank"),jd(e,{className:`theme-ipe ipe-action-button ipe-modal-btn is-${t||"default"}`,href:e==="a"?n:void 0,target:e==="a"?r:void 0,"data-href":e!=="a"?n:void 0,...s},i));var Qd=Object.create,Es=Object.defineProperty,Xd=Object.getOwnPropertyDescriptor,Ta=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Ra=t=>{throw TypeError(t)},Zd=(t,e,n)=>e in t?Es(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,eh=(t,e)=>Es(t,"name",{value:e,configurable:!0}),th=t=>[,,,Qd(t?.[Ta("metadata")]??null)],nh=["class","method","getter","setter","accessor","field","value","get","set"],Na=t=>t!==void 0&&typeof t!="function"?Ra("Function expected"):t,rh=(t,e,n,r,i)=>({kind:nh[t],name:e,metadata:r,addInitializer:s=>n._?Ra("Already initialized"):i.push(Na(s||null))}),ih=(t,e)=>Zd(e,Ta("metadata"),t[3]),sh=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},oh=(t,e,n,r,i,s)=>{var o,a,l,u=e&7,c=!1,f=0,b=t[f]||(t[f]=[]),y=u&&(i=i.prototype,u<5&&(u>3||!c)&&Xd(i,n));eh(i,n);for(var v=r.length-1;v>=0;v--)l=rh(u,n,a={},t[3],b),o=(0,r[v])(i,l),a._=1,Na(o)&&(i=o);return ih(t,i),y&&Es(i,n,y),c?u^4?s:y:i},Da,$s,La;Da=[Ye(["sitemeta","storage"])];class Kr extends(La=_t){constructor(e){super(e,{},"preferences"),this.ctx=e,this.db=void 0,this.customRegistries=[],this.categoryDefinitions=[],this._defaultPreferences={},this.db=e.storage.createDatabse("preferences",1/0),this.ctx.set("preferences",this)}async start(){this.defineCategory({name:"general",label:"General",description:"General settings"}),this.defineCategory({name:"edit",label:"Editing",description:"Settings related to editing content"}),this.defineCategory({name:"about",label:"About",description:"About InPageEdit",index:99}),this.registerCustomConfig("about",xe.object({about:xe.const(C("div",{className:"prose",children:[C("h2",{children:"✏️ InPageEdit NEXT"}),C("i",{children:["v",this.ctx.version]}),C("h2",{children:"Portal"}),C("div",{style:"display: flex; flex-direction: column; gap: 1rem",children:[C(Ia,{href:"https://www.ipe.wiki",style:{display:"block",width:"100%"},children:"Official Website & Help Center"}),C(Ia,{href:"https://www.ipe.wiki/update/",style:{display:"block",width:"100%"},children:"Update Logs"})]}),C("h2",{children:"Join us"}),C("ul",{children:[C("li",{children:[C("strong",{children:"GitHub"}),":"," ",C("a",{href:"https://github.com/inpageedit/inpageedit-next",target:"_blank",children:"inpageedit/inpageedit-next"})]}),C("li",{children:[C("strong",{children:"QQ Group"}),": 1026023666"]})]}),C("hr",{}),C("p",{children:"🚀 Modular, Extensible Supercharged Plugin for MediaWiki."}),C("p",{children:"InPageEdit-NEXT Copyright © 2025-present dragon-fish"})]})).role("raw-html")}).description(""),"about",{}),Promise.resolve().then(()=>Jy).then(e=>{const n=this.ctx.plugin(e.PluginPreferencesUI);this.addDisposeHandler(()=>{n.dispose()})})}get(e,n){return n||(n=()=>{const i=this.getDefaultValue(e);return this.logger.info("default value used",i),i}),this.db.get(e,void 0,n)}getDefaultValue(e){var n;return(n=this._defaultPreferences)[e]??(n[e]=this.loadDefaultConfigs()[e])}set(e,n){const r=this.getDefaultValue(e);return n===r?this.db.delete(e):this.db.set(e,n)}async getAll(){const e=this.loadDefaultConfigs();return await this.db.iterate((n,r)=>{e[r]=n}),e}loadDefaultConfigs(){const e={};return this.getConfigRegistries().forEach(n=>{n.defaults&&Object.entries(n.defaults).forEach(([r,i])=>{e[r]=i,this._defaultPreferences[r]=i})}),e}registerCustomConfig(e,n,r,i){return this.customRegistries.push({name:e,schema:n,category:r,defaults:i}),this}getConfigRegistries(e){return Array.from(this.ctx.registry.entries()).map(([n,r])=>n===null?{name:"root",schema:on?.PreferencesSchema||null,defaults:on?.PreferencesDefaults||{}}:{name:n.name,schema:n?.PreferencesSchema||null,defaults:n?.PreferencesDefaults||{}}).filter(n=>n.schema!==null).map(n=>({...n,category:n.schema.meta.category||"general"})).concat(this.customRegistries).filter(n=>!e||n.category===e)}defineCategory(e){const n=this.categoryDefinitions.findIndex(r=>r.name===e.name);return n<0?this.categoryDefinitions.push(e):this.categoryDefinitions[n]=e,this.categoryDefinitions.sort((r,i)=>(r.index??0)-(i.index??0)),this}getConfigCategories(){return this.categoryDefinitions}}$s=th(La),Kr=oh($s,0,"PluginPreferences",Da,Kr),sh($s,1,Kr);const ah=Object.freeze(Object.defineProperty({__proto__:null,get PluginPreferences(){return Kr}},Symbol.toStringTag,{value:"Module"}));var lt=(t=>(t.preferences="preferences",t.watch="watch",t.unwatch="unwatch",t.nochange="nochange",t))(lt||{});function Yr(t,e){return function(n){return n.PreferencesSchema=t,n.PreferencesDefaults=e,n}}var lh=Object.create,ks=Object.defineProperty,ch=Object.getOwnPropertyDescriptor,ja=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Ma=t=>{throw TypeError(t)},uh=(t,e,n)=>e in t?ks(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,fh=(t,e)=>ks(t,"name",{value:e,configurable:!0}),dh=t=>[,,,lh(t?.[ja("metadata")]??null)],hh=["class","method","getter","setter","accessor","field","value","get","set"],Fa=t=>t!==void 0&&typeof t!="function"?Ma("Function expected"):t,ph=(t,e,n,r,i)=>({kind:hh[t],name:e,metadata:r,addInitializer:s=>n._?Ma("Already initialized"):i.push(Fa(s||null))}),mh=(t,e)=>uh(e,ja("metadata"),t[3]),gh=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},yh=(t,e,n,r,i,s)=>{var o,a,l,u=e&7,c=!1,f=0,b=t[f]||(t[f]=[]),y=u&&(i=i.prototype,u<5&&(u>3||!c)&&ch(i,n));fh(i,n);for(var v=r.length-1;v>=0;v--)l=ph(u,n,a={},t[3],b),o=(0,r[v])(i,l),a._=1,Fa(o)&&(i=o);return mh(t,i),y&&ks(i,n,y),c?u^4?s:y:i},Ba,Cs,Ua;Ba=[Ye(["sitemeta","quickEdit"]),Yr(xe.object({redLinkEdit:xe.boolean().description("Show quick edit entry after red links").default(!0)}).description("In-article quick edit links"),{redLinkEdit:!0})];class Gr extends(Ua=_t){constructor(e){const n=e.sitemeta.mwConfig,r=n.wgArticlePath.replace("$1",""),i=`${location.protocol}//${n.wgServer.split("//")[1]}`;super(e,{wikiBaseUrl:i,wikiArticlePath:r,wikiArticleBaseUrl:`${i}${r}`,wikiScriptBaseUrl:`${i}${n.wgScriptPath}`,linkClassName:"ipe-quickEdit__in-article-link"},"QuickEditInArticleLinks")}async start(){mw.hook("wikipage.content").add(()=>{document.querySelectorAll("#mw-content-text a[href]").forEach(n=>{const r=this.checkEditAnchor(n);if(!r||n.dataset.ipeQuickEditLink)return;const i=C("a",{href:`#/IPE/quickEdit/${r.title}`,className:this.config.linkClassName,style:{userSelect:"none",marginLeft:"0.2em",verticalAlign:"middle"},onClick:s=>{s.preventDefault(),this.ctx.quickEdit(r)},children:C("svg",{style:"width: 1em; height: 1em",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-pencil-bolt",children:[C("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),C("path",{d:"M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4"}),C("path",{d:"M13.5 6.5l4 4"}),C("path",{d:"M19 16l-2 3h4l-2 3"})]})});n.insertAdjacentElement("afterend",i),n.dataset.ipeQuickEditLink="true"})})}stop(){document.querySelectorAll(`.${this.config.linkClassName}`).forEach(e=>e.remove())}checkEditAnchor(e){if(!(e instanceof HTMLAnchorElement))return null;const n=e.href||"";if(!n.startsWith(this.config.wikiArticleBaseUrl)&&!n.startsWith(this.config.wikiScriptBaseUrl))return null;const r=new URL(n),i=r.searchParams,s=i.get("action")||"view",o=i.get("title")||decodeURI(r.pathname.substring(this.config.wikiArticlePath.length))||"",a=i.get("section")?.replace(/^T-/,"")||void 0,l=i.get("oldid");if(!o||o.endsWith(".php")||!["edit","editsource","editredlink","submit"].includes(s)||i.get("undo")||i.get("preload"))return null;let u;return a==="new"?u="new":a&&/^\d+$/.test(a)&&(u=parseInt(a,10)),{title:o,section:u,revision:parseInt(""+l,10)||0,createOnly:!!i.get("redlink")}}}Cs=dh(Ua),Gr=yh(Cs,0,"PluginQuickEditInArticleLinks",Ba,Gr),gh(Cs,1,Gr);const Jr={mbox:"_mbox_5x43w_1",title:"_title_5x43w_12",content:"_content_5x43w_19",close:"_close_5x43w_27"},Ha=t=>{const{type:e="default",title:n,content:r,closeable:i=!0,titleProps:s,contentProps:o,children:a,...l}=t;let u=n;typeof n>"u"&&e!=="default"&&(u=e[0].toUpperCase()+e.slice(1).toLowerCase());const c=async()=>{if(!f)return Promise.resolve();const{promise:b,resolve:y}=Promise.withResolvers();return f.animate([{opacity:"1",height:f.clientHeight+"px"},{opacity:"0",height:"0px",margin:"0px"}],{duration:300,easing:"ease"}).addEventListener("finish",()=>{f.remove(),y()}),b},f=C("div",{className:`theme-ipe ipe-mbox mbox-type-${e||"default"} ${Jr.mbox}`,...l,children:[u&&C("div",{className:`ipe-mbox-title ${Jr.title}`,...s,children:u}),C("div",{className:`ipe-mbox-content ${Jr.content}`,...o,children:a||r}),i&&C("a",{onClick:c,className:`ipe-mbox-close ${Jr.close}`,children:"×"})]});return f.close=c,f},Os=t=>{const{label:e,id:n,name:r,value:i,disabled:s,labelProps:o,inputProps:a,...l}=t;return C("div",{className:"theme-ipe ipe-input-box",...l,children:[C("label",{htmlFor:n,style:{display:"block"},...o,children:e}),C("input",{id:n,name:r,value:i,disabled:s,style:{width:"100%"},...a})]})},qa=t=>{const{id:e,name:n,value:r,label:i,inputProps:s,labelProps:o,children:a,...l}=t;return C("label",{className:"theme-ipe ipe-radio-box",...l,children:[C("input",{type:"radio",id:e,name:n,value:r,...s}),C("span",{className:"ipe-checkbox-box"}),C("span",{...o,children:i||a})]})},_n=t=>{const{id:e,name:n,label:r,checked:i,inputProps:s,labelProps:o,children:a,...l}=t;return C("label",{className:"theme-ipe ipe-checkbox",...l,children:[C("input",{type:"checkbox",id:e,name:n,checked:i,...s}),C("span",{className:"ipe-checkbox-box"}),C("span",{...o,children:r||a})]})},Wa=()=>{},za=(t=0)=>new Promise(e=>setTimeout(e,t));var vh=Object.create,Ps=Object.defineProperty,bh=Object.getOwnPropertyDescriptor,Va=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Ka=t=>{throw TypeError(t)},_h=(t,e,n)=>e in t?Ps(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,wh=(t,e)=>Ps(t,"name",{value:e,configurable:!0}),xh=t=>[,,,vh(t?.[Va("metadata")]??null)],Sh=["class","method","getter","setter","accessor","field","value","get","set"],Ya=t=>t!==void 0&&typeof t!="function"?Ka("Function expected"):t,Eh=(t,e,n,r,i)=>({kind:Sh[t],name:e,metadata:r,addInitializer:s=>n._?Ka("Already initialized"):i.push(Ya(s||null))}),$h=(t,e)=>_h(e,Va("metadata"),t[3]),kh=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},Ch=(t,e,n,r,i,s)=>{var o,a,l,u=e&7,c=!1,f=0,b=t[f]||(t[f]=[]),y=u&&(i=i.prototype,u<5&&(u>3||!c)&&bh(i,n));wh(i,n);for(var v=r.length-1;v>=0;v--)l=Eh(u,n,a={},t[3],b),o=(0,r[v])(i,l),a._=1,Ya(o)&&(i=o);return $h(t,i),y&&Ps(i,n,y),c?u^4?s:y:i},Ga,As,Ja;Ga=[Ye(["api","wikiPage","modal","preferences"]),Yr(xe.object({editSummary:xe.string().description("Default edit summary for quick edits").default("[IPE-NEXT] Quick edit"),editMinor:xe.boolean().description("Whether to mark the edit as minor").default(!1),outSideClose:xe.boolean().description("Whether to close the modal outside").default(!0),watchList:xe.union([xe.const(lt.preferences).description("Follow my preferences"),xe.const(lt.nochange).description("Keep the current watchlist status"),xe.const(lt.watch).description("Add the page to watchlist"),xe.const(lt.unwatch).description("Remove the page from watchlist")]).description("Watchlist options").default(lt.preferences)}).description("Quick edit options").extra("category","edit"),{editSummary:"[IPE-NEXT] Quick edit",editMinor:!1,outSideClose:!0,watchList:lt.preferences})];class Qr extends(Ja=_t){constructor(e){super(e,{},"quick-edit"),this.ctx=e,this.DEFAULT_OPTIONS={title:"",pageId:0,revision:0,section:void 0,editMinor:!1,editSummary:"",createOnly:!1,reloadAfterSave:!0}}start(){this.ctx.root.set("quickEdit",this.quickEdit.bind(this)),this.ctx.inject(["toolbox"],e=>{this.injectToolbox(e),e.on("dispose",()=>{this.removeToolbox(e)})}),this.ctx.plugin(Gr)}async quickEdit(e){typeof e>"u"?e={}:typeof e=="string"&&(e={title:e}),e?.page&&(e.title=e.page,delete e.page),!e.title&&!e.pageId&&!e.revision&&(this.logger.warn("None of the title, pageId or revision provided. Using defaults."),e={...e,title:mw.config.get("wgPageName"),pageId:mw.config.get("wgArticleId"),revision:mw.config.get("wgRevisionId")});const n=await this.ctx.preferences.get("outSideClose"),r=await this.ctx.preferences.get("watchList"),i=typeof e.editSummary=="string"?e.editSummary:await this.ctx.preferences.get("editSummary"),s=typeof e.editMinor=="boolean"?e.editMinor:await this.ctx.preferences.get("editMinor"),o={...this.DEFAULT_OPTIONS,editSummary:i,editMinor:s,...e};o.editSummary||(o.editSummary=await this.ctx.preferences.get("editSummary")||""),o||this.ctx.emit("quickEdit/initOptions",{ctx:this.ctx,options:o});const a=this.ctx.modal.createObject({className:"ipe-quickEdit",sizeClass:"large",center:!1,outSideClose:n}).init();a.setTitle(C(Qn,{children:["Loading: ",C("u",{children:o.title})]})),a.setContent(C("section",{className:"ipe-quickEdit-loading",style:{height:"70vh",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"},children:C(sn,{})})),a.addButton({side:"right",type:"button",className:"is-danger is-ghost",label:"Cancel",method(){a.close()}}),a.show(),this.ctx.emit("quickEdit/showModal",{ctx:this.ctx,modal:a,options:o});let l;try{l=await this.getWikiPageFromPayload(o)}catch(f){a.close(),this.ctx.modal.notify("error",{title:"Error",content:f instanceof Error?f.message:String(f)});return}a.setTitle(C(Qn,{children:["Quick ",l.pageInfo.pageid===0?"Create":"Edit",":"," ",C("u",{children:l.pageInfo.title})]}));const u=C("form",{className:"ipe-quickEdit-form",children:[l.pageInfo.pageid===0&&C(Ha,{title:"Attention",type:"important",children:C("p",{children:"This page does not exist."})}),C("textarea",{className:"editArea",name:"text",id:"wpTextbox1",children:l.revisions[0]?.content||""}),C("div",{class:"ipe-quickEdit-options",style:{display:"flex",flexDirection:"column",gap:"1rem",marginTop:"1rem"},children:[C(Os,{label:"Summary",id:"summary",name:"summary",value:o.editSummary}),C("div",{className:"ipe-input-box",children:[C("label",{htmlFor:"watchlist",style:{display:"block"},children:"Watchlist"}),C("div",{style:{display:"flex",gap:"1rem"},children:[lt.preferences,lt.nochange,lt.watch,lt.unwatch].map(f=>C(qa,{name:"watchlist",value:f,inputProps:{checked:r===f},children:f},f))})]}),C("div",{style:{display:"flex",gap:"1rem"},children:[C(_n,{name:"minor",id:"minor",checked:o.editMinor,children:"Minor edit"}),C(_n,{name:"reloadAfterSave",id:"reloadAfterSave",checked:o.reloadAfterSave,children:"Reload after save"})]})]}),!1]});a.setContent(u),a.addButton({side:"left",className:"is-primary submit-btn",label:"Submit",method:()=>{const f=new FormData(u);a.setLoadingState(!0),this.handleSubmit({ctx:this.ctx,modal:a,wikiPage:l,options:o},{text:f.get("text"),summary:f.get("summary"),minor:f.get("minor")==="on"}).then(async()=>{a.setOptions({beforeClose:Wa}),a.close(),this.ctx.modal.notify("success",{title:"Submission Successful",content:"Your changes have been saved."}),f.get("reloadAfterSave")&&(await za(500),location.reload())}).catch(b=>{this.ctx.modal.notify("error",{title:"Submission Error",content:b instanceof Error?b.message:String(b)}),a.setLoadingState(!1)})}},0),a.setOptions({beforeClose:()=>{const f=l.revisions[0]?.content||"";return(u.querySelector("textarea")?.value||"")===f?!0:(this.ctx.modal.confirm({className:"is-primary",title:"Unsaved Changes",content:"All edit contents will be lost after closing the modal. Are you sure you want to close?",center:!0,okBtn:{label:"Give Up",className:"is-danger is-ghost"},cancelBtn:{label:"Continue",className:"is-primary is-ghost"}},y=>(y&&(a.setOptions({beforeClose:Wa}),a.close()),!0)),!1)}}),this.ctx.emit("quickEdit/wikiPage",{ctx:this.ctx,options:o,modal:a,wikiPage:l});const c=f=>u.querySelector("textarea")?.value===l.revisions[0]?.content?!0:(f.preventDefault(),"You have unsaved changes. Are you sure you want to leave?");window.addEventListener("beforeunload",c),a.on(a.Event.Close,()=>{window.removeEventListener("beforeunload",c)})}handleSubmit(e,n){const r=n.summary||"",i=n.text||"",s=n.minor||!1,o=n.createonly||!1,a=n.watchlist||lt.nochange;return e.wikiPage.edit({summary:r,text:i,watchlist:a},{minor:s,createonly:o})}injectToolbox(e){e.toolbox.addButton({id:"quick-edit",group:"group1",index:0,icon:C("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-edit",children:[C("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),C("path",{d:"M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1"}),C("path",{d:"M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415z"}),C("path",{d:"M16 5l3 3"})]}),tooltip:"Edit this page quickly",onClick:()=>this.quickEdit()})}async getWikiPageFromPayload(e){if(e.revision)return this.ctx.wikiPage.newFromRevision(e.revision,e.section);if(e.pageId)return this.ctx.wikiPage.newFromPageId(e.pageId,e.section);if(e.title)return this.ctx.wikiPage.newFromTitle(e.title,!1,e.section);throw new Error("Invalid payload")}removeToolbox(e){e.toolbox.removeButton("quick-edit")}}As=xh(Ja),Qr=Ch(As,0,"PluginQuickEdit",Ga,Qr),kh(As,1,Qr);const Oh=Object.freeze(Object.defineProperty({__proto__:null,get PluginQuickEdit(){return Qr}},Symbol.toStringTag,{value:"Module"})),Zn={twinSwapInput:"_twinSwapInput_1gdgl_9",inputWrapper:"_inputWrapper_1gdgl_23",inputLeft:"_inputLeft_1gdgl_27",inputRight:"_inputRight_1gdgl_30",swapButton:"_swapButton_1gdgl_46"},Qa=t=>{const{inputs:e,enableSwap:n=!0,...r}=t,i=e?.length===2?e:[e?.[0]??{},e?.[1]??{}],s=[null,null];let o=0,a=null,l=null;const u=()=>s.some(v=>v&&v.disabled),c=()=>{if(!s[0]||!s[1]||u())return;const v=s[0],A=s[1],U=v.value,D=A.value;v.value=D,A.value=U,v.dispatchEvent(new Event("change")),A.dispatchEvent(new Event("change")),o++,l&&(l.style.transform=`rotateY(${o*-180}deg)`,l.style.transition="transform 200ms ease")},f=v=>{if(!a)return;const A=v??!a.disabled;a.disabled=!A,A&&s.forEach(U=>{U&&(U.disabled=!1)})},b=C("button",{type:"button","aria-label":"Swap values",onClick:c,disabled:u()||!n,ref:v=>a=v,children:C("svg",{ref:v=>l=v,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon-tabler icons-tabler-outline icon-tabler-transfer",children:[C("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),C("path",{d:"M20 10h-16l5.5 -6"}),C("path",{d:"M4 14h16l-5.5 6"})]})}),y=C("div",{className:`twin-swap-input ${Zn.twinSwapInput}`,...r,children:[i.map((v,A)=>{const{label:U,id:D,name:I,value:g,disabled:p,required:h,inputProps:x}=v,P=A===0,R=D||I;return C("div",{className:`${Zn.inputWrapper} ${P?Zn.inputLeft:Zn.inputRight}`,children:[U&&C("label",{htmlFor:R,children:U}),C("input",{ref:W=>s[A]=W,type:"text",id:R,name:I,value:g,disabled:p,required:h,...x})]})}),C("div",{className:Zn.swapButton,children:b})]});return y.swap=c,y.toggleEnableSwap=f,y};var Ph=Object.create,Is=Object.defineProperty,Ah=Object.getOwnPropertyDescriptor,Xa=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Za=t=>{throw TypeError(t)},Ih=(t,e,n)=>e in t?Is(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Th=(t,e)=>Is(t,"name",{value:e,configurable:!0}),Rh=t=>[,,,Ph(t?.[Xa("metadata")]??null)],Nh=["class","method","getter","setter","accessor","field","value","get","set"],el=t=>t!==void 0&&typeof t!="function"?Za("Function expected"):t,Dh=(t,e,n,r,i)=>({kind:Nh[t],name:e,metadata:r,addInitializer:s=>n._?Za("Already initialized"):i.push(el(s||null))}),Lh=(t,e)=>Ih(e,Xa("metadata"),t[3]),jh=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},Mh=(t,e,n,r,i,s)=>{var o,a,l,u=e&7,c=!1,f=0,b=t[f]||(t[f]=[]),y=u&&(i=i.prototype,u<5&&(u>3||!c)&&Ah(i,n));Th(i,n);for(var v=r.length-1;v>=0;v--)l=Dh(u,n,a={},t[3],b),o=(0,r[v])(i,l),a._=1,el(o)&&(i=o);return Lh(t,i),y&&Is(i,n,y),c?u^4?s:y:i},tl,Ts,nl;tl=[Ye(["modal","sitemeta"])];class Xr extends(nl=_t){constructor(e){super(e,{},"quick-move"),this.ctx=e,e.set("quickMove",this.quickMove.bind(this)),e.set("movePage",this.movePage.bind(this))}start(){this.ctx.inject(["toolbox"],e=>{this.injectToolbox(e)})}injectToolbox(e){const n=window.mw?.config.get("wgPageName")||"",r=window.mw?.config.get("wgIsProbablyEditable");e.toolbox.addButton({id:"quick-move",icon:C("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-forms",children:[C("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),C("path",{d:"M12 3a3 3 0 0 0 -3 3v12a3 3 0 0 0 3 3"}),C("path",{d:"M6 3a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3"}),C("path",{d:"M13 7h7a1 1 0 0 1 1 1v8a1 1 0 0 1 -1 1h-7"}),C("path",{d:"M5 7h-1a1 1 0 0 0 -1 1v8a1 1 0 0 0 1 1h1"}),C("path",{d:"M17 12h.01"}),C("path",{d:"M13 12h.01"})]}),tooltip:"Quick Move",group:"group2",onClick:()=>{this.quickMove(r?{lockFromField:!0,from:n}:{})}})}quickMove(e){const n=this.ctx.modal.createObject({title:"Quick Move",content:C(sn,{}),className:"quick-move compact-buttons",sizeClass:"medium",center:!0}).init();let r=null;return n.setContent(C("form",{ref:i=>r=i,style:{display:"flex",flexDirection:"column",gap:"1rem"},onSubmit:i=>{if(i.preventDefault(),r?.checkValidity(),!r?.reportValidity())return;const s=new FormData(r),o={from:s.get("from")?.toString().trim(),to:s.get("to")?.toString().trim(),reason:s.get("reason")||"",movetalk:s.get("movetalk")==="on",movesubpages:s.get("movesubpages")==="on",noredirect:s.get("noredirect")==="on"};if(!o.from||!o.to){this.ctx.modal.notify("error",{title:"Failed to move",content:"From and to are required."});return}n.setLoadingState(!0),this.movePage(o).then(()=>{location.reload()}).catch(a=>{n.setLoadingState(!1),this.ctx.modal.notify("error",{title:"Failed to move",content:a instanceof Error?a.message:String(a)})})},children:[C(Qa,{inputs:[{label:"Move from",name:"from",value:e?.from,required:!0},{label:"Move to",name:"to",value:e?.to,required:!0}]}),C("div",{children:C(_n,{name:"movetalk",id:"movetalk",checked:e?.movetalk,children:"Move talk page"})}),C("div",{children:C(_n,{name:"movesubpages",id:"movesubpages",checked:e?.movesubpages,children:"Move subpage(s) (up to 100)"})}),this.ctx.sitemeta.hasRight("suppressredirect")&&C("div",{children:C(_n,{name:"noredirect",id:"noredirect",checked:e?.noredirect,children:"Move without leaving a redirect"})}),C(Os,{label:"Reason",id:"reason",name:"reason",value:e?.reason})]})),n.setButtons([{label:"Move",className:"is-primary is-ghost",method:()=>{r?.dispatchEvent(new Event("submit"))}}]),n.show()}async movePage(e){const{from:n,to:r,reason:i="",...s}=e;if(!n||!r)throw new Error("From and to titles are required.");if(n===r)throw new Error("From and to titles cannot be the same.");return(await this.ctx.wikiPage.newFromTitle(n)).moveTo(r,i,s)}}Ts=Rh(nl),Xr=Mh(Ts,0,"PluginQuickMove",tl,Xr),jh(Ts,1,Xr);const Fh=Object.freeze(Object.defineProperty({__proto__:null,get PluginQuickMove(){return Xr}},Symbol.toStringTag,{value:"Module"}));var Bh=Object.create,Rs=Object.defineProperty,Uh=Object.getOwnPropertyDescriptor,rl=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),il=t=>{throw TypeError(t)},Hh=(t,e,n)=>e in t?Rs(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,qh=(t,e)=>Rs(t,"name",{value:e,configurable:!0}),Wh=t=>[,,,Bh(t?.[rl("metadata")]??null)],zh=["class","method","getter","setter","accessor","field","value","get","set"],sl=t=>t!==void 0&&typeof t!="function"?il("Function expected"):t,Vh=(t,e,n,r,i)=>({kind:zh[t],name:e,metadata:r,addInitializer:s=>n._?il("Already initialized"):i.push(sl(s||null))}),Kh=(t,e)=>Hh(e,rl("metadata"),t[3]),Yh=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},Gh=(t,e,n,r,i,s)=>{var o,a,l,u=e&7,c=!1,f=0,b=t[f]||(t[f]=[]),y=u&&(i=i.prototype,u<5&&(u>3||!c)&&Uh(i,n));qh(i,n);for(var v=r.length-1;v>=0;v--)l=Vh(u,n,a={},t[3],b),o=(0,r[v])(i,l),a._=1,sl(o)&&(i=o);return Kh(t,i),y&&Rs(i,n,y),c?u^4?s:y:i},ol,Ns,al;ol=[Ye(["api","wikiPage","modal"])];class Zr extends(al=_t){constructor(e){super(e,{},"quickPreview"),this.ctx=e}start(){this.ctx.set("quickPreview",this.quickPreview.bind(this)),this.ctx.on("quickEdit/wikiPage",this.injectQuickEdit.bind(this))}stop(){this.ctx.off("quickEdit/wikiPage",this.injectQuickEdit.bind(this))}injectQuickEdit({ctx:e,modal:n,wikiPage:r}){let i;n.addButton({label:"Preview",side:"left",className:"btn btn-secondary",method:()=>{i=this.quickPreview(n.get$content().querySelector('textarea[name="text"]')?.value||"",void 0,r,i)}},2)}quickPreview(e,n,r,i){return r||(r=this.ctx.wikiPage.newBlankPage({title:"API"})),(!i||i.isDestroyed)&&(i=this.ctx.modal.createObject({className:"in-page-edit ipe-quickPreview",sizeClass:"large",backdrop:!1,draggable:!0}).init()),i.show(),i.setTitle("Preview loading..."),i.setContent(C(sn,{})),i.bringToFront(),this.ctx.emit("quickPreview/showModal",{ctx:this.ctx,text:e,modal:i,wikiPage:r}),r.preview(e,n).then(s=>{const{data:{parse:o}}=s;i.setTitle(`Preview - ${o.title}`);let a=null;i.setContent(C("section",{children:C("div",{ref:l=>a=l,className:"mw-parser-output",innerHTML:o.text})})),window.mw?.hook("wikipage.content").fire($(a)),this.ctx.emit("quickPreview/loaded",{ctx:this.ctx,modal:i,wikiPage:r,text:e,parseData:o})}).catch(s=>{i.setTitle("Preview failed"),i.setContent(C(Qn,{children:[C("p",{children:"Failed to preview"}),C("p",{children:s instanceof Error?s.message:String(s)})]}))}),i}}Ns=Wh(al),Zr=Gh(Ns,0,"PluginQuickPreview",ol,Zr),Yh(Ns,1,Zr);const Jh=Object.freeze(Object.defineProperty({__proto__:null,get PluginQuickPreview(){return Zr}},Symbol.toStringTag,{value:"Module"}));class Tt{diff(e,n,r={}){let i;typeof r=="function"?(i=r,r={}):"callback"in r&&(i=r.callback);const s=this.castInput(e,r),o=this.castInput(n,r),a=this.removeEmpty(this.tokenize(s,r)),l=this.removeEmpty(this.tokenize(o,r));return this.diffWithOptionsObj(a,l,r,i)}diffWithOptionsObj(e,n,r,i){var s;const o=I=>{if(I=this.postProcess(I,r),i){setTimeout(function(){i(I)},0);return}else return I},a=n.length,l=e.length;let u=1,c=a+l;r.maxEditLength!=null&&(c=Math.min(c,r.maxEditLength));const f=(s=r.timeout)!==null&&s!==void 0?s:1/0,b=Date.now()+f,y=[{oldPos:-1,lastComponent:void 0}];let v=this.extractCommon(y[0],n,e,0,r);if(y[0].oldPos+1>=l&&v+1>=a)return o(this.buildValues(y[0].lastComponent,n,e));let A=-1/0,U=1/0;const D=()=>{for(let I=Math.max(A,-u);I<=Math.min(U,u);I+=2){let g;const p=y[I-1],h=y[I+1];p&&(y[I-1]=void 0);let x=!1;if(h){const R=h.oldPos-I;x=h&&0<=R&&R<a}const P=p&&p.oldPos+1<l;if(!x&&!P){y[I]=void 0;continue}if(!P||x&&p.oldPos<h.oldPos?g=this.addToPath(h,!0,!1,0,r):g=this.addToPath(p,!1,!0,1,r),v=this.extractCommon(g,n,e,I,r),g.oldPos+1>=l&&v+1>=a)return o(this.buildValues(g.lastComponent,n,e))||!0;y[I]=g,g.oldPos+1>=l&&(U=Math.min(U,I-1)),v+1>=a&&(A=Math.max(A,I+1))}u++};if(i)(function I(){setTimeout(function(){if(u>c||Date.now()>b)return i(void 0);D()||I()},0)})();else for(;u<=c&&Date.now()<=b;){const I=D();if(I)return I}}addToPath(e,n,r,i,s){const o=e.lastComponent;return o&&!s.oneChangePerToken&&o.added===n&&o.removed===r?{oldPos:e.oldPos+i,lastComponent:{count:o.count+1,added:n,removed:r,previousComponent:o.previousComponent}}:{oldPos:e.oldPos+i,lastComponent:{count:1,added:n,removed:r,previousComponent:o}}}extractCommon(e,n,r,i,s){const o=n.length,a=r.length;let l=e.oldPos,u=l-i,c=0;for(;u+1<o&&l+1<a&&this.equals(r[l+1],n[u+1],s);)u++,l++,c++,s.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return c&&!s.oneChangePerToken&&(e.lastComponent={count:c,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=l,u}equals(e,n,r){return r.comparator?r.comparator(e,n):e===n||!!r.ignoreCase&&e.toLowerCase()===n.toLowerCase()}removeEmpty(e){const n=[];for(let r=0;r<e.length;r++)e[r]&&n.push(e[r]);return n}castInput(e,n){return e}tokenize(e,n){return Array.from(e)}join(e){return e.join("")}postProcess(e,n){return e}get useLongestToken(){return!1}buildValues(e,n,r){const i=[];let s;for(;e;)i.push(e),s=e.previousComponent,delete e.previousComponent,e=s;i.reverse();const o=i.length;let a=0,l=0,u=0;for(;a<o;a++){const c=i[a];if(c.removed)c.value=this.join(r.slice(u,u+c.count)),u+=c.count;else{if(!c.added&&this.useLongestToken){let f=n.slice(l,l+c.count);f=f.map(function(b,y){const v=r[u+y];return v.length>b.length?v:b}),c.value=this.join(f)}else c.value=this.join(n.slice(l,l+c.count));l+=c.count,c.added||(u+=c.count)}}return i}}class Qh extends Tt{}const ll=new Qh;function cl(t,e,n){return ll.diff(t,e,n)}function ul(t,e){let n;for(n=0;n<t.length&&n<e.length;n++)if(t[n]!=e[n])return t.slice(0,n);return t.slice(0,n)}function fl(t,e){let n;if(!t||!e||t[t.length-1]!=e[e.length-1])return"";for(n=0;n<t.length&&n<e.length;n++)if(t[t.length-(n+1)]!=e[e.length-(n+1)])return t.slice(-n);return t.slice(-n)}function Ds(t,e,n){if(t.slice(0,e.length)!=e)throw Error(`string ${JSON.stringify(t)} doesn't start with prefix ${JSON.stringify(e)}; this is a bug`);return n+t.slice(e.length)}function Ls(t,e,n){if(!e)return t+n;if(t.slice(-e.length)!=e)throw Error(`string ${JSON.stringify(t)} doesn't end with suffix ${JSON.stringify(e)}; this is a bug`);return t.slice(0,-e.length)+n}function er(t,e){return Ds(t,e,"")}function ei(t,e){return Ls(t,e,"")}function dl(t,e){return e.slice(0,Xh(t,e))}function Xh(t,e){let n=0;t.length>e.length&&(n=t.length-e.length);let r=e.length;t.length<e.length&&(r=t.length);const i=Array(r);let s=0;i[0]=0;for(let o=1;o<r;o++){for(e[o]==e[s]?i[o]=i[s]:i[o]=s;s>0&&e[o]!=e[s];)s=i[s];e[o]==e[s]&&s++}s=0;for(let o=n;o<t.length;o++){for(;s>0&&t[o]!=e[s];)s=i[s];t[o]==e[s]&&s++}return s}function Zh(t){return t.includes(`\r
|
|
67
|
+
/____/ v`+e.version)}function Xd(t,e){const n=Symbol.for(t);return window[n]?!1:(window[n]=!0,e(),!0)}const Zd=window?.location?.origin,Na=({type:t,tag:e,href:n,target:r,children:i,...s})=>(e=e||(n?"a":"button"),typeof r>"u"&&n&&n.startsWith("http")&&!n.startsWith(Zd)&&(r="_blank"),Bd(e,{className:`theme-ipe ipe-action-button ipe-modal-btn is-${t||"default"}`,href:e==="a"?n:void 0,target:e==="a"?r:void 0,"data-href":e!=="a"?n:void 0,...s},i));var eh=Object.create,$s=Object.defineProperty,th=Object.getOwnPropertyDescriptor,Da=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),La=t=>{throw TypeError(t)},nh=(t,e,n)=>e in t?$s(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,rh=(t,e)=>$s(t,"name",{value:e,configurable:!0}),ih=t=>[,,,eh(t?.[Da("metadata")]??null)],sh=["class","method","getter","setter","accessor","field","value","get","set"],ja=t=>t!==void 0&&typeof t!="function"?La("Function expected"):t,oh=(t,e,n,r,i)=>({kind:sh[t],name:e,metadata:r,addInitializer:s=>n._?La("Already initialized"):i.push(ja(s||null))}),ah=(t,e)=>nh(e,Da("metadata"),t[3]),lh=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},ch=(t,e,n,r,i,s)=>{var o,a,l,u=e&7,c=!1,f=0,b=t[f]||(t[f]=[]),y=u&&(i=i.prototype,u<5&&(u>3||!c)&&th(i,n));rh(i,n);for(var v=r.length-1;v>=0;v--)l=oh(u,n,a={},t[3],b),o=(0,r[v])(i,l),a._=1,ja(o)&&(i=o);return ah(t,i),y&&$s(i,n,y),c?u^4?s:y:i},Ma,ks,Fa;Ma=[Ge(["sitemeta","storage"])];class Gr extends(Fa=ut){constructor(e){super(e,{},"preferences"),this.ctx=e,this.db=void 0,this.customRegistries=[],this.categoryDefinitions=[],this._defaultPreferences={},this.db=e.storage.createDatabse("preferences",1/0),this.ctx.set("preferences",this)}async start(){this.defineCategory({name:"general",label:"General",description:"General settings"}),this.defineCategory({name:"edit",label:"Editing",description:"Settings related to editing content"}),this.defineCategory({name:"about",label:"About",description:"About InPageEdit",index:99}),this.registerCustomConfig("about",Se.object({about:Se.const(C("div",{className:"prose",children:[C("h2",{children:"✏️ InPageEdit NEXT"}),C("i",{children:["v",this.ctx.version]}),C("h2",{children:"Portal"}),C("div",{style:"display: flex; flex-direction: column; gap: 1rem",children:[C(Na,{href:"https://www.ipe.wiki",style:{display:"block",width:"100%"},children:"Official Website & Help Center"}),C(Na,{href:"https://www.ipe.wiki/update/",style:{display:"block",width:"100%"},children:"Update Logs"})]}),C("h2",{children:"Join us"}),C("ul",{children:[C("li",{children:[C("strong",{children:"GitHub"}),":"," ",C("a",{href:"https://github.com/inpageedit/inpageedit-next",target:"_blank",children:"inpageedit/inpageedit-next"})]}),C("li",{children:[C("strong",{children:"QQ Group"}),": 1026023666"]})]}),C("hr",{}),C("p",{children:"🚀 Modular, Extensible Supercharged Plugin for MediaWiki."}),C("p",{children:"InPageEdit-NEXT Copyright © 2025-present dragon-fish"})]})).role("raw-html")}).description(""),"about",{}),Promise.resolve().then(()=>Zy).then(e=>{const n=this.ctx.plugin(e.PluginPreferencesUI);this.addDisposeHandler(()=>{n.dispose()})})}get(e,n){return n||(n=()=>{const i=this.getDefaultValue(e);return this.logger.info("default value used",i),i}),this.db.get(e,void 0,n)}getDefaultValue(e){var n;return(n=this._defaultPreferences)[e]??(n[e]=this.loadDefaultConfigs()[e])}set(e,n){const r=this.getDefaultValue(e);return n===r?this.db.delete(e):this.db.set(e,n)}async getAll(){const e=this.loadDefaultConfigs();return await this.db.iterate((n,r)=>{e[r]=n}),e}loadDefaultConfigs(){const e={};return this.getConfigRegistries().forEach(n=>{n.defaults&&Object.entries(n.defaults).forEach(([r,i])=>{e[r]=i,this._defaultPreferences[r]=i})}),e}registerCustomConfig(e,n,r,i){return this.customRegistries.push({name:e,schema:n,category:r,defaults:i}),this}getConfigRegistries(e){return Array.from(this.ctx.registry.entries()).map(([n,r])=>n===null?{name:"root",schema:an?.PreferencesSchema||null,defaults:an?.PreferencesDefaults||{}}:{name:n.name,schema:n?.PreferencesSchema||null,defaults:n?.PreferencesDefaults||{}}).filter(n=>n.schema!==null).map(n=>({...n,category:n.schema.meta.category||"general"})).concat(this.customRegistries).filter(n=>!e||n.category===e)}defineCategory(e){const n=this.categoryDefinitions.findIndex(r=>r.name===e.name);return n<0?this.categoryDefinitions.push(e):this.categoryDefinitions[n]=e,this.categoryDefinitions.sort((r,i)=>(r.index??0)-(i.index??0)),this}getConfigCategories(){return this.categoryDefinitions}}ks=ih(Fa),Gr=ch(ks,0,"PluginPreferences",Ma,Gr),lh(ks,1,Gr);const uh=Object.freeze(Object.defineProperty({__proto__:null,get PluginPreferences(){return Gr}},Symbol.toStringTag,{value:"Module"}));function Jr(t,e){return function(n){return n.PreferencesSchema=t,n.PreferencesDefaults=e,n}}var fh=Object.create,Cs=Object.defineProperty,dh=Object.getOwnPropertyDescriptor,Ba=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Ua=t=>{throw TypeError(t)},hh=(t,e,n)=>e in t?Cs(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ph=(t,e)=>Cs(t,"name",{value:e,configurable:!0}),mh=t=>[,,,fh(t?.[Ba("metadata")]??null)],gh=["class","method","getter","setter","accessor","field","value","get","set"],Ha=t=>t!==void 0&&typeof t!="function"?Ua("Function expected"):t,yh=(t,e,n,r,i)=>({kind:gh[t],name:e,metadata:r,addInitializer:s=>n._?Ua("Already initialized"):i.push(Ha(s||null))}),vh=(t,e)=>hh(e,Ba("metadata"),t[3]),bh=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},_h=(t,e,n,r,i,s)=>{var o,a,l,u=e&7,c=!1,f=0,b=t[f]||(t[f]=[]),y=u&&(i=i.prototype,u<5&&(u>3||!c)&&dh(i,n));ph(i,n);for(var v=r.length-1;v>=0;v--)l=yh(u,n,a={},t[3],b),o=(0,r[v])(i,l),a._=1,Ha(o)&&(i=o);return vh(t,i),y&&Cs(i,n,y),c?u^4?s:y:i},qa,Os,Wa;qa=[Ge(["sitemeta","quickEdit"]),Jr(Se.object({redLinkEdit:Se.boolean().description("Show quick edit entry after red links").default(!0)}).description("In-article quick edit links"),{redLinkEdit:!0})];class Qr extends(Wa=ut){constructor(e){const n=e.sitemeta.mwConfig,r=n.wgArticlePath.replace("$1",""),i=`${location.protocol}//${n.wgServer.split("//")[1]}`;super(e,{wikiBaseUrl:i,wikiArticlePath:r,wikiArticleBaseUrl:`${i}${r}`,wikiScriptBaseUrl:`${i}${n.wgScriptPath}`,linkClassName:"ipe-quickEdit__in-article-link"},"QuickEditInArticleLinks")}async start(){mw.hook("wikipage.content").add(()=>{document.querySelectorAll("#mw-content-text a[href]").forEach(n=>{const r=this.checkEditAnchor(n);if(!r||n.dataset.ipeQuickEditLink)return;const i=C("a",{href:`#/IPE/quickEdit/${r.title}`,className:this.config.linkClassName,style:{userSelect:"none",marginLeft:"0.2em",verticalAlign:"middle"},onClick:s=>{s.preventDefault(),this.ctx.quickEdit(r)},children:C("svg",{style:"width: 1em; height: 1em",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-pencil-bolt",children:[C("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),C("path",{d:"M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4"}),C("path",{d:"M13.5 6.5l4 4"}),C("path",{d:"M19 16l-2 3h4l-2 3"})]})});n.insertAdjacentElement("afterend",i),n.dataset.ipeQuickEditLink="true"})})}stop(){document.querySelectorAll(`.${this.config.linkClassName}`).forEach(e=>e.remove())}checkEditAnchor(e){if(!(e instanceof HTMLAnchorElement))return null;const n=e.href||"";if(!n.startsWith(this.config.wikiArticleBaseUrl)&&!n.startsWith(this.config.wikiScriptBaseUrl))return null;const r=new URL(n),i=r.searchParams,s=i.get("action")||"view",o=i.get("title")||decodeURI(r.pathname.substring(this.config.wikiArticlePath.length))||"",a=i.get("section")?.replace(/^T-/,"")||void 0,l=i.get("oldid");if(!o||o.endsWith(".php")||!["edit","editsource","editredlink","submit"].includes(s)||i.get("undo")||i.get("preload"))return null;let u;return a==="new"?u="new":a&&/^\d+$/.test(a)&&(u=parseInt(a,10)),{title:o,section:u,revision:parseInt(""+l,10)||0,createOnly:!!i.get("redlink")}}}Os=mh(Wa),Qr=_h(Os,0,"PluginQuickEditInArticleLinks",qa,Qr),bh(Os,1,Qr);const Xr={mbox:"_mbox_5x43w_1",title:"_title_5x43w_12",content:"_content_5x43w_19",close:"_close_5x43w_27"},za=t=>{const{type:e="default",title:n,content:r,closeable:i=!0,titleProps:s,contentProps:o,children:a,...l}=t;let u=n;typeof n>"u"&&e!=="default"&&(u=e[0].toUpperCase()+e.slice(1).toLowerCase());const c=async()=>{if(!f)return Promise.resolve();const{promise:b,resolve:y}=Promise.withResolvers();return f.animate([{opacity:"1",height:f.clientHeight+"px"},{opacity:"0",height:"0px",margin:"0px"}],{duration:300,easing:"ease"}).addEventListener("finish",()=>{f.remove(),y()}),b},f=C("div",{className:`theme-ipe ipe-mbox mbox-type-${e||"default"} ${Xr.mbox}`,...l,children:[u&&C("div",{className:`ipe-mbox-title ${Xr.title}`,...s,children:u}),C("div",{className:`ipe-mbox-content ${Xr.content}`,...o,children:a||r}),i&&C("a",{onClick:c,className:`ipe-mbox-close ${Xr.close}`,children:"×"})]});return f.close=c,f},Ps=t=>{const{label:e,id:n,name:r,value:i,disabled:s,labelProps:o,inputProps:a,...l}=t;return C("div",{className:"theme-ipe ipe-input-box",...l,children:[C("label",{htmlFor:n,style:{display:"block"},...o,children:e}),C("input",{id:n,name:r,value:i,disabled:s,style:{width:"100%"},...a})]})},Va=t=>{const{id:e,name:n,value:r,label:i,inputProps:s,labelProps:o,children:a,...l}=t;return C("label",{className:"theme-ipe ipe-radio-box",...l,children:[C("input",{type:"radio",id:e,name:n,value:r,...s}),C("span",{className:"ipe-checkbox-box"}),C("span",{...o,children:i||a})]})},wn=t=>{const{id:e,name:n,label:r,checked:i,inputProps:s,labelProps:o,children:a,...l}=t;return C("label",{className:"theme-ipe ipe-checkbox",...l,children:[C("input",{type:"checkbox",id:e,name:n,checked:i,...s}),C("span",{className:"ipe-checkbox-box"}),C("span",{...o,children:r||a})]})},Ka=()=>{},Ya=(t=0)=>new Promise(e=>setTimeout(e,t));var wh=Object.create,As=Object.defineProperty,xh=Object.getOwnPropertyDescriptor,Ga=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Ja=t=>{throw TypeError(t)},Sh=(t,e,n)=>e in t?As(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Eh=(t,e)=>As(t,"name",{value:e,configurable:!0}),$h=t=>[,,,wh(t?.[Ga("metadata")]??null)],kh=["class","method","getter","setter","accessor","field","value","get","set"],Qa=t=>t!==void 0&&typeof t!="function"?Ja("Function expected"):t,Ch=(t,e,n,r,i)=>({kind:kh[t],name:e,metadata:r,addInitializer:s=>n._?Ja("Already initialized"):i.push(Qa(s||null))}),Oh=(t,e)=>Sh(e,Ga("metadata"),t[3]),Ph=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},Ah=(t,e,n,r,i,s)=>{var o,a,l,u=e&7,c=!1,f=0,b=t[f]||(t[f]=[]),y=u&&(i=i.prototype,u<5&&(u>3||!c)&&xh(i,n));Eh(i,n);for(var v=r.length-1;v>=0;v--)l=Ch(u,n,a={},t[3],b),o=(0,r[v])(i,l),a._=1,Qa(o)&&(i=o);return Oh(t,i),y&&As(i,n,y),c?u^4?s:y:i},Xa,Is,Za;Xa=[Ge(["api","wikiPage","modal","preferences"]),Jr(Se.object({editSummary:Se.string().description("Default edit summary for quick edits").default("[IPE-NEXT] Quick edit"),editMinor:Se.boolean().description("Whether to mark the edit as minor").default(!1),outSideClose:Se.boolean().description("Whether to close the modal outside").default(!0),watchList:Se.union([Se.const(rt.preferences).description("Follow my preferences"),Se.const(rt.nochange).description("Keep the current watchlist status"),Se.const(rt.watch).description("Add the page to watchlist"),Se.const(rt.unwatch).description("Remove the page from watchlist")]).description("Watchlist options").default(rt.preferences)}).description("Quick edit options").extra("category","edit"),{editSummary:"[IPE-NEXT] Quick edit",editMinor:!1,outSideClose:!0,watchList:rt.preferences})];class Zr extends(Za=ut){constructor(e){super(e,{},"quick-edit"),this.ctx=e,this.DEFAULT_OPTIONS={title:"",pageId:0,revision:0,section:void 0,editMinor:!1,editSummary:"",createOnly:!1,reloadAfterSave:!0}}start(){this.ctx.root.set("quickEdit",this.quickEdit.bind(this)),this.ctx.inject(["toolbox"],e=>{this.injectToolbox(e),e.on("dispose",()=>{this.removeToolbox(e)})}),this.ctx.plugin(Qr)}async quickEdit(e){typeof e>"u"?e={}:typeof e=="string"&&(e={title:e}),e?.page&&(e.title=e.page,delete e.page),!e.title&&!e.pageId&&!e.revision&&(this.logger.warn("None of the title, pageId or revision provided. Using defaults."),e={...e,title:mw.config.get("wgPageName"),pageId:mw.config.get("wgArticleId"),revision:mw.config.get("wgRevisionId")});const n=await this.ctx.preferences.get("outSideClose"),r=await this.ctx.preferences.get("watchList"),i=typeof e.editSummary=="string"?e.editSummary:await this.ctx.preferences.get("editSummary"),s=typeof e.editMinor=="boolean"?e.editMinor:await this.ctx.preferences.get("editMinor"),o={...this.DEFAULT_OPTIONS,editSummary:i,editMinor:s,...e};o.editSummary||(o.editSummary=await this.ctx.preferences.get("editSummary")||""),o||this.ctx.emit("quickEdit/initOptions",{ctx:this.ctx,options:o});const a=this.ctx.modal.createObject({className:"ipe-quickEdit",sizeClass:"large",center:!1,outSideClose:n}).init();a.setTitle(C(Xn,{children:["Loading: ",C("u",{children:o.title})]})),a.setContent(C("section",{className:"ipe-quickEdit-loading",style:{height:"70vh",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"},children:C(on,{})})),a.addButton({side:"right",type:"button",className:"is-danger is-ghost",label:"Cancel",method(){a.close()}}),a.show(),this.ctx.emit("quickEdit/showModal",{ctx:this.ctx,modal:a,options:o});let l;try{l=await this.getWikiPageFromPayload(o)}catch(f){a.close(),this.ctx.modal.notify("error",{title:"Error",content:f instanceof Error?f.message:String(f)});return}a.setTitle(C(Xn,{children:["Quick ",l.pageInfo.pageid===0?"Create":"Edit",":"," ",C("u",{children:l.pageInfo.title})]}));const u=C("form",{className:"ipe-quickEdit-form",children:[l.pageInfo.pageid===0&&C(za,{title:"Attention",type:"important",children:C("p",{children:"This page does not exist."})}),C("textarea",{className:"editArea",name:"text",id:"wpTextbox1",children:l.revisions[0]?.content||""}),C("div",{class:"ipe-quickEdit-options",style:{display:"flex",flexDirection:"column",gap:"1rem",marginTop:"1rem"},children:[C(Ps,{label:"Summary",id:"summary",name:"summary",value:o.editSummary}),C("div",{className:"ipe-input-box",children:[C("label",{htmlFor:"watchlist",style:{display:"block"},children:"Watchlist"}),C("div",{style:{display:"flex",gap:"1rem"},children:[rt.preferences,rt.nochange,rt.watch,rt.unwatch].map(f=>C(Va,{name:"watchlist",value:f,inputProps:{checked:r===f},children:f},f))})]}),C("div",{style:{display:"flex",gap:"1rem"},children:[C(wn,{name:"minor",id:"minor",checked:o.editMinor,children:"Minor edit"}),C(wn,{name:"reloadAfterSave",id:"reloadAfterSave",checked:o.reloadAfterSave,children:"Reload after save"})]})]}),!1]});a.setContent(u),a.addButton({side:"left",className:"is-primary submit-btn",label:"Submit",method:()=>{const f=new FormData(u);a.setLoadingState(!0),this.handleSubmit({ctx:this.ctx,modal:a,wikiPage:l,options:o},{text:f.get("text"),summary:f.get("summary"),minor:f.get("minor")==="on"}).then(async()=>{a.setOptions({beforeClose:Ka}),a.close(),this.ctx.modal.notify("success",{title:"Submission Successful",content:"Your changes have been saved."}),f.get("reloadAfterSave")&&(await Ya(500),location.reload())}).catch(b=>{this.ctx.modal.notify("error",{title:"Submission Error",content:b instanceof Error?b.message:String(b)}),a.setLoadingState(!1)})}},0),a.setOptions({beforeClose:()=>{const f=l.revisions[0]?.content||"";return(u.querySelector("textarea")?.value||"")===f?!0:(this.ctx.modal.confirm({className:"is-primary",title:"Unsaved Changes",content:"All edit contents will be lost after closing the modal. Are you sure you want to close?",center:!0,okBtn:{label:"Give Up",className:"is-danger is-ghost"},cancelBtn:{label:"Continue",className:"is-primary is-ghost"}},y=>(y&&(a.setOptions({beforeClose:Ka}),a.close()),!0)),!1)}}),this.ctx.emit("quickEdit/wikiPage",{ctx:this.ctx,options:o,modal:a,wikiPage:l});const c=f=>u.querySelector("textarea")?.value===l.revisions[0]?.content?!0:(f.preventDefault(),"You have unsaved changes. Are you sure you want to leave?");window.addEventListener("beforeunload",c),a.on(a.Event.Close,()=>{window.removeEventListener("beforeunload",c)})}handleSubmit(e,n){const r=n.summary||"",i=n.text||"",s=n.minor||!1,o=n.createonly||!1,a=n.watchlist||rt.nochange,l=e.options.section;return e.wikiPage.edit({summary:r,text:i,watchlist:a,section:l},{minor:s,createonly:o})}injectToolbox(e){e.toolbox.addButton({id:"quick-edit",group:"group1",index:0,icon:C("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-edit",children:[C("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),C("path",{d:"M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1"}),C("path",{d:"M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415z"}),C("path",{d:"M16 5l3 3"})]}),tooltip:"Edit this page quickly",onClick:()=>this.quickEdit()})}async getWikiPageFromPayload(e){if(e.revision)return this.ctx.wikiPage.newFromRevision(e.revision,e.section);if(e.pageId)return this.ctx.wikiPage.newFromPageId(e.pageId,e.section);if(e.title)return this.ctx.wikiPage.newFromTitle(e.title,!1,e.section);throw new Error("Invalid payload")}removeToolbox(e){e.toolbox.removeButton("quick-edit")}}Is=$h(Za),Zr=Ah(Is,0,"PluginQuickEdit",Xa,Zr),Ph(Is,1,Zr);const Ih=Object.freeze(Object.defineProperty({__proto__:null,get PluginQuickEdit(){return Zr}},Symbol.toStringTag,{value:"Module"})),er={twinSwapInput:"_twinSwapInput_1gdgl_9",inputWrapper:"_inputWrapper_1gdgl_23",inputLeft:"_inputLeft_1gdgl_27",inputRight:"_inputRight_1gdgl_30",swapButton:"_swapButton_1gdgl_46"},el=t=>{const{inputs:e,enableSwap:n=!0,...r}=t,i=e?.length===2?e:[e?.[0]??{},e?.[1]??{}],s=[null,null];let o=0,a=null,l=null;const u=()=>s.some(v=>v&&v.disabled),c=()=>{if(!s[0]||!s[1]||u())return;const v=s[0],A=s[1],U=v.value,D=A.value;v.value=D,A.value=U,v.dispatchEvent(new Event("change")),A.dispatchEvent(new Event("change")),o++,l&&(l.style.transform=`rotateY(${o*-180}deg)`,l.style.transition="transform 200ms ease")},f=v=>{if(!a)return;const A=v??!a.disabled;a.disabled=!A,A&&s.forEach(U=>{U&&(U.disabled=!1)})},b=C("button",{type:"button","aria-label":"Swap values",onClick:c,disabled:u()||!n,ref:v=>a=v,children:C("svg",{ref:v=>l=v,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon-tabler icons-tabler-outline icon-tabler-transfer",children:[C("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),C("path",{d:"M20 10h-16l5.5 -6"}),C("path",{d:"M4 14h16l-5.5 6"})]})}),y=C("div",{className:`twin-swap-input ${er.twinSwapInput}`,...r,children:[i.map((v,A)=>{const{label:U,id:D,name:I,value:g,disabled:p,required:h,inputProps:x}=v,P=A===0,R=D||I;return C("div",{className:`${er.inputWrapper} ${P?er.inputLeft:er.inputRight}`,children:[U&&C("label",{htmlFor:R,children:U}),C("input",{ref:W=>s[A]=W,type:"text",id:R,name:I,value:g,disabled:p,required:h,...x})]})}),C("div",{className:er.swapButton,children:b})]});return y.swap=c,y.toggleEnableSwap=f,y};var Th=Object.create,Ts=Object.defineProperty,Rh=Object.getOwnPropertyDescriptor,tl=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),nl=t=>{throw TypeError(t)},Nh=(t,e,n)=>e in t?Ts(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Dh=(t,e)=>Ts(t,"name",{value:e,configurable:!0}),Lh=t=>[,,,Th(t?.[tl("metadata")]??null)],jh=["class","method","getter","setter","accessor","field","value","get","set"],rl=t=>t!==void 0&&typeof t!="function"?nl("Function expected"):t,Mh=(t,e,n,r,i)=>({kind:jh[t],name:e,metadata:r,addInitializer:s=>n._?nl("Already initialized"):i.push(rl(s||null))}),Fh=(t,e)=>Nh(e,tl("metadata"),t[3]),Bh=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},Uh=(t,e,n,r,i,s)=>{var o,a,l,u=e&7,c=!1,f=0,b=t[f]||(t[f]=[]),y=u&&(i=i.prototype,u<5&&(u>3||!c)&&Rh(i,n));Dh(i,n);for(var v=r.length-1;v>=0;v--)l=Mh(u,n,a={},t[3],b),o=(0,r[v])(i,l),a._=1,rl(o)&&(i=o);return Fh(t,i),y&&Ts(i,n,y),c?u^4?s:y:i},il,Rs,sl;il=[Ge(["modal","sitemeta"])];class ei extends(sl=ut){constructor(e){super(e,{},"quick-move"),this.ctx=e,e.set("quickMove",this.quickMove.bind(this)),e.set("movePage",this.movePage.bind(this))}start(){this.ctx.inject(["toolbox"],e=>{this.injectToolbox(e)})}injectToolbox(e){const n=window.mw?.config.get("wgPageName")||"",r=window.mw?.config.get("wgIsProbablyEditable");e.toolbox.addButton({id:"quick-move",icon:C("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-forms",children:[C("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),C("path",{d:"M12 3a3 3 0 0 0 -3 3v12a3 3 0 0 0 3 3"}),C("path",{d:"M6 3a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3"}),C("path",{d:"M13 7h7a1 1 0 0 1 1 1v8a1 1 0 0 1 -1 1h-7"}),C("path",{d:"M5 7h-1a1 1 0 0 0 -1 1v8a1 1 0 0 0 1 1h1"}),C("path",{d:"M17 12h.01"}),C("path",{d:"M13 12h.01"})]}),tooltip:"Quick Move",group:"group2",onClick:()=>{this.quickMove(r?{lockFromField:!0,from:n}:{})}})}quickMove(e){const n=this.ctx.modal.createObject({title:"Quick Move",content:C(on,{}),className:"quick-move compact-buttons",sizeClass:"medium",center:!0}).init();let r=null;return n.setContent(C("form",{ref:i=>r=i,style:{display:"flex",flexDirection:"column",gap:"1rem"},onSubmit:i=>{if(i.preventDefault(),r?.checkValidity(),!r?.reportValidity())return;const s=new FormData(r),o={from:s.get("from")?.toString().trim(),to:s.get("to")?.toString().trim(),reason:s.get("reason")||"",movetalk:s.get("movetalk")==="on",movesubpages:s.get("movesubpages")==="on",noredirect:s.get("noredirect")==="on"};if(!o.from||!o.to){this.ctx.modal.notify("error",{title:"Failed to move",content:"From and to are required."});return}n.setLoadingState(!0),this.movePage(o).then(()=>{location.reload()}).catch(a=>{n.setLoadingState(!1),this.ctx.modal.notify("error",{title:"Failed to move",content:a instanceof Error?a.message:String(a)})})},children:[C(el,{inputs:[{label:"Move from",name:"from",value:e?.from,required:!0},{label:"Move to",name:"to",value:e?.to,required:!0}]}),C("div",{children:C(wn,{name:"movetalk",id:"movetalk",checked:e?.movetalk,children:"Move talk page"})}),C("div",{children:C(wn,{name:"movesubpages",id:"movesubpages",checked:e?.movesubpages,children:"Move subpage(s) (up to 100)"})}),this.ctx.sitemeta.hasRight("suppressredirect")&&C("div",{children:C(wn,{name:"noredirect",id:"noredirect",checked:e?.noredirect,children:"Move without leaving a redirect"})}),C(Ps,{label:"Reason",id:"reason",name:"reason",value:e?.reason})]})),n.setButtons([{label:"Move",className:"is-primary is-ghost",method:()=>{r?.dispatchEvent(new Event("submit"))}}]),n.show()}async movePage(e){const{from:n,to:r,reason:i="",...s}=e;if(!n||!r)throw new Error("From and to titles are required.");if(n===r)throw new Error("From and to titles cannot be the same.");return(await this.ctx.wikiPage.newFromTitle(n)).moveTo(r,i,s)}}Rs=Lh(sl),ei=Uh(Rs,0,"PluginQuickMove",il,ei),Bh(Rs,1,ei);const Hh=Object.freeze(Object.defineProperty({__proto__:null,get PluginQuickMove(){return ei}},Symbol.toStringTag,{value:"Module"}));var qh=Object.create,Ns=Object.defineProperty,Wh=Object.getOwnPropertyDescriptor,ol=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),al=t=>{throw TypeError(t)},zh=(t,e,n)=>e in t?Ns(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Vh=(t,e)=>Ns(t,"name",{value:e,configurable:!0}),Kh=t=>[,,,qh(t?.[ol("metadata")]??null)],Yh=["class","method","getter","setter","accessor","field","value","get","set"],ll=t=>t!==void 0&&typeof t!="function"?al("Function expected"):t,Gh=(t,e,n,r,i)=>({kind:Yh[t],name:e,metadata:r,addInitializer:s=>n._?al("Already initialized"):i.push(ll(s||null))}),Jh=(t,e)=>zh(e,ol("metadata"),t[3]),Qh=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},Xh=(t,e,n,r,i,s)=>{var o,a,l,u=e&7,c=!1,f=0,b=t[f]||(t[f]=[]),y=u&&(i=i.prototype,u<5&&(u>3||!c)&&Wh(i,n));Vh(i,n);for(var v=r.length-1;v>=0;v--)l=Gh(u,n,a={},t[3],b),o=(0,r[v])(i,l),a._=1,ll(o)&&(i=o);return Jh(t,i),y&&Ns(i,n,y),c?u^4?s:y:i},cl,Ds,ul;cl=[Ge(["api","wikiPage","modal"])];class ti extends(ul=ut){constructor(e){super(e,{},"quickPreview"),this.ctx=e}start(){this.ctx.set("quickPreview",this.quickPreview.bind(this)),this.ctx.on("quickEdit/wikiPage",this.injectQuickEdit.bind(this))}stop(){this.ctx.off("quickEdit/wikiPage",this.injectQuickEdit.bind(this))}injectQuickEdit({ctx:e,modal:n,wikiPage:r}){let i;n.addButton({label:"Preview",side:"left",className:"btn btn-secondary",method:()=>{i=this.quickPreview(n.get$content().querySelector('textarea[name="text"]')?.value||"",void 0,r,i)}},2)}quickPreview(e,n,r,i){return r||(r=this.ctx.wikiPage.newBlankPage({title:"API"})),(!i||i.isDestroyed)&&(i=this.ctx.modal.createObject({className:"in-page-edit ipe-quickPreview",sizeClass:"large",backdrop:!1,draggable:!0}).init()),i.show(),i.setTitle("Preview loading..."),i.setContent(C(on,{})),i.bringToFront(),this.ctx.emit("quickPreview/showModal",{ctx:this.ctx,text:e,modal:i,wikiPage:r}),r.preview(e,n).then(s=>{const{data:{parse:o}}=s;i.setTitle(`Preview - ${o.title}`);let a=null;i.setContent(C("section",{children:C("div",{ref:l=>a=l,className:"mw-parser-output",innerHTML:o.text})})),window.mw?.hook("wikipage.content").fire($(a)),this.ctx.emit("quickPreview/loaded",{ctx:this.ctx,modal:i,wikiPage:r,text:e,parseData:o})}).catch(s=>{i.setTitle("Preview failed"),i.setContent(C(Xn,{children:[C("p",{children:"Failed to preview"}),C("p",{children:s instanceof Error?s.message:String(s)})]}))}),i}}Ds=Kh(ul),ti=Xh(Ds,0,"PluginQuickPreview",cl,ti),Qh(Ds,1,ti);const Zh=Object.freeze(Object.defineProperty({__proto__:null,get PluginQuickPreview(){return ti}},Symbol.toStringTag,{value:"Module"}));class Rt{diff(e,n,r={}){let i;typeof r=="function"?(i=r,r={}):"callback"in r&&(i=r.callback);const s=this.castInput(e,r),o=this.castInput(n,r),a=this.removeEmpty(this.tokenize(s,r)),l=this.removeEmpty(this.tokenize(o,r));return this.diffWithOptionsObj(a,l,r,i)}diffWithOptionsObj(e,n,r,i){var s;const o=I=>{if(I=this.postProcess(I,r),i){setTimeout(function(){i(I)},0);return}else return I},a=n.length,l=e.length;let u=1,c=a+l;r.maxEditLength!=null&&(c=Math.min(c,r.maxEditLength));const f=(s=r.timeout)!==null&&s!==void 0?s:1/0,b=Date.now()+f,y=[{oldPos:-1,lastComponent:void 0}];let v=this.extractCommon(y[0],n,e,0,r);if(y[0].oldPos+1>=l&&v+1>=a)return o(this.buildValues(y[0].lastComponent,n,e));let A=-1/0,U=1/0;const D=()=>{for(let I=Math.max(A,-u);I<=Math.min(U,u);I+=2){let g;const p=y[I-1],h=y[I+1];p&&(y[I-1]=void 0);let x=!1;if(h){const R=h.oldPos-I;x=h&&0<=R&&R<a}const P=p&&p.oldPos+1<l;if(!x&&!P){y[I]=void 0;continue}if(!P||x&&p.oldPos<h.oldPos?g=this.addToPath(h,!0,!1,0,r):g=this.addToPath(p,!1,!0,1,r),v=this.extractCommon(g,n,e,I,r),g.oldPos+1>=l&&v+1>=a)return o(this.buildValues(g.lastComponent,n,e))||!0;y[I]=g,g.oldPos+1>=l&&(U=Math.min(U,I-1)),v+1>=a&&(A=Math.max(A,I+1))}u++};if(i)(function I(){setTimeout(function(){if(u>c||Date.now()>b)return i(void 0);D()||I()},0)})();else for(;u<=c&&Date.now()<=b;){const I=D();if(I)return I}}addToPath(e,n,r,i,s){const o=e.lastComponent;return o&&!s.oneChangePerToken&&o.added===n&&o.removed===r?{oldPos:e.oldPos+i,lastComponent:{count:o.count+1,added:n,removed:r,previousComponent:o.previousComponent}}:{oldPos:e.oldPos+i,lastComponent:{count:1,added:n,removed:r,previousComponent:o}}}extractCommon(e,n,r,i,s){const o=n.length,a=r.length;let l=e.oldPos,u=l-i,c=0;for(;u+1<o&&l+1<a&&this.equals(r[l+1],n[u+1],s);)u++,l++,c++,s.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return c&&!s.oneChangePerToken&&(e.lastComponent={count:c,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=l,u}equals(e,n,r){return r.comparator?r.comparator(e,n):e===n||!!r.ignoreCase&&e.toLowerCase()===n.toLowerCase()}removeEmpty(e){const n=[];for(let r=0;r<e.length;r++)e[r]&&n.push(e[r]);return n}castInput(e,n){return e}tokenize(e,n){return Array.from(e)}join(e){return e.join("")}postProcess(e,n){return e}get useLongestToken(){return!1}buildValues(e,n,r){const i=[];let s;for(;e;)i.push(e),s=e.previousComponent,delete e.previousComponent,e=s;i.reverse();const o=i.length;let a=0,l=0,u=0;for(;a<o;a++){const c=i[a];if(c.removed)c.value=this.join(r.slice(u,u+c.count)),u+=c.count;else{if(!c.added&&this.useLongestToken){let f=n.slice(l,l+c.count);f=f.map(function(b,y){const v=r[u+y];return v.length>b.length?v:b}),c.value=this.join(f)}else c.value=this.join(n.slice(l,l+c.count));l+=c.count,c.added||(u+=c.count)}}return i}}class ep extends Rt{}const fl=new ep;function dl(t,e,n){return fl.diff(t,e,n)}function hl(t,e){let n;for(n=0;n<t.length&&n<e.length;n++)if(t[n]!=e[n])return t.slice(0,n);return t.slice(0,n)}function pl(t,e){let n;if(!t||!e||t[t.length-1]!=e[e.length-1])return"";for(n=0;n<t.length&&n<e.length;n++)if(t[t.length-(n+1)]!=e[e.length-(n+1)])return t.slice(-n);return t.slice(-n)}function Ls(t,e,n){if(t.slice(0,e.length)!=e)throw Error(`string ${JSON.stringify(t)} doesn't start with prefix ${JSON.stringify(e)}; this is a bug`);return n+t.slice(e.length)}function js(t,e,n){if(!e)return t+n;if(t.slice(-e.length)!=e)throw Error(`string ${JSON.stringify(t)} doesn't end with suffix ${JSON.stringify(e)}; this is a bug`);return t.slice(0,-e.length)+n}function tr(t,e){return Ls(t,e,"")}function ni(t,e){return js(t,e,"")}function ml(t,e){return e.slice(0,tp(t,e))}function tp(t,e){let n=0;t.length>e.length&&(n=t.length-e.length);let r=e.length;t.length<e.length&&(r=t.length);const i=Array(r);let s=0;i[0]=0;for(let o=1;o<r;o++){for(e[o]==e[s]?i[o]=i[s]:i[o]=s;s>0&&e[o]!=e[s];)s=i[s];e[o]==e[s]&&s++}s=0;for(let o=n;o<t.length;o++){for(;s>0&&t[o]!=e[s];)s=i[s];t[o]==e[s]&&s++}return s}function np(t){return t.includes(`\r
|
|
68
68
|
`)&&!t.startsWith(`
|
|
69
|
-
`)&&!t.match(/[^\r]\n/)}function
|
|
69
|
+
`)&&!t.match(/[^\r]\n/)}function rp(t){return!t.includes(`\r
|
|
70
70
|
`)&&t.includes(`
|
|
71
|
-
`)}function
|
|
71
|
+
`)}function nr(t){let e;for(e=t.length-1;e>=0&&t[e].match(/\s/);e--);return t.substring(e+1)}function zt(t){const e=t.match(/^\s*/);return e?e[0]:""}const ri="a-zA-Z0-9_\\u{C0}-\\u{FF}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}",ip=new RegExp(`[${ri}]+|\\s+|[^${ri}]`,"ug");class sp extends Rt{equals(e,n,r){return r.ignoreCase&&(e=e.toLowerCase(),n=n.toLowerCase()),e.trim()===n.trim()}tokenize(e,n={}){let r;if(n.intlSegmenter){const o=n.intlSegmenter;if(o.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');r=Array.from(o.segment(e),a=>a.segment)}else r=e.match(ip)||[];const i=[];let s=null;return r.forEach(o=>{/\s/.test(o)?s==null?i.push(o):i.push(i.pop()+o):s!=null&&/\s/.test(s)?i[i.length-1]==s?i.push(i.pop()+o):i.push(s+o):i.push(o),s=o}),i}join(e){return e.map((n,r)=>r==0?n:n.replace(/^\s+/,"")).join("")}postProcess(e,n){if(!e||n.oneChangePerToken)return e;let r=null,i=null,s=null;return e.forEach(o=>{o.added?i=o:o.removed?s=o:((i||s)&&vl(r,s,i,o),r=o,i=null,s=null)}),(i||s)&&vl(r,s,i,null),e}}const gl=new sp;function yl(t,e,n){return n?.ignoreWhitespace!=null&&!n.ignoreWhitespace?Ms(t,e,n):gl.diff(t,e,n)}function vl(t,e,n,r){if(e&&n){const i=zt(e.value),s=nr(e.value),o=zt(n.value),a=nr(n.value);if(t){const l=hl(i,o);t.value=js(t.value,o,l),e.value=tr(e.value,l),n.value=tr(n.value,l)}if(r){const l=pl(s,a);r.value=Ls(r.value,a,l),e.value=ni(e.value,l),n.value=ni(n.value,l)}}else if(n){if(t){const i=zt(n.value);n.value=n.value.substring(i.length)}if(r){const i=zt(r.value);r.value=r.value.substring(i.length)}}else if(t&&r){const i=zt(r.value),s=zt(e.value),o=nr(e.value),a=hl(i,s);e.value=tr(e.value,a);const l=pl(tr(i,a),o);e.value=ni(e.value,l),r.value=Ls(r.value,i,l),t.value=js(t.value,i,i.slice(0,i.length-l.length))}else if(r){const i=zt(r.value),s=nr(e.value),o=ml(s,i);e.value=ni(e.value,o)}else if(t){const i=nr(t.value),s=zt(e.value),o=ml(i,s);e.value=tr(e.value,o)}}class op extends Rt{tokenize(e){const n=new RegExp(`(\\r?\\n)|[${ri}]+|[^\\S\\n\\r]+|[^${ri}]`,"ug");return e.match(n)||[]}}const bl=new op;function Ms(t,e,n){return bl.diff(t,e,n)}function ap(t,e){if(typeof t=="function")e.callback=t;else if(t)for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}class lp extends Rt{constructor(){super(...arguments),this.tokenize=wl}equals(e,n,r){return r.ignoreWhitespace?((!r.newlineIsToken||!e.includes(`
|
|
72
72
|
`))&&(e=e.trim()),(!r.newlineIsToken||!n.includes(`
|
|
73
73
|
`))&&(n=n.trim())):r.ignoreNewlineAtEof&&!r.newlineIsToken&&(e.endsWith(`
|
|
74
74
|
`)&&(e=e.slice(0,-1)),n.endsWith(`
|
|
75
|
-
`)&&(n=n.slice(0,-1))),super.equals(e,n,r)}}const
|
|
76
|
-
`));const n=[],r=t.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let i=0;i<r.length;i++){const s=r[i];i%2&&!e.newlineIsToken?n[n.length-1]+=s:n.push(s)}return n}function
|
|
77
|
-
`),i=e.hunks,s=n.compareLine||((v,A,U,D)=>A===D),o=n.fuzzFactor||0;let a=0;if(o<0||!Number.isInteger(o))throw new Error("fuzzFactor must be a non-negative integer");if(!i.length)return t;let l="",u=!1,c=!1;for(let v=0;v<i[i.length-1].lines.length;v++){const A=i[i.length-1].lines[v];A[0]=="\\"&&(l[0]=="+"?u=!0:l[0]=="-"&&(c=!0)),l=A}if(u){if(c){if(!o&&r[r.length-1]=="")return!1}else if(r[r.length-1]=="")r.pop();else if(!o)return!1}else if(c){if(r[r.length-1]!="")r.push("");else if(!o)return!1}function f(v,A,U,D=0,I=!0,g=[],p=0){let h=0,x=!1;for(;D<v.length;D++){const P=v[D],R=P.length>0?P[0]:" ",W=P.length>0?P.substr(1):P;if(R==="-")if(s(A+1,r[A],R,W))A++,h=0;else return!U||r[A]==null?null:(g[p]=r[A],f(v,A+1,U-1,D,!1,g,p+1));if(R==="+"){if(!I)return null;g[p]=W,p++,h=0,x=!0}if(R===" ")if(h++,g[p]=r[A],s(A+1,r[A],R,W))p++,I=!0,x=!1,A++;else return x||!U?null:r[A]&&(f(v,A+1,U-1,D+1,!1,g,p+1)||f(v,A+1,U-1,D,!1,g,p+1))||f(v,A,U-1,D+1,!1,g,p)}return p-=h,A-=h,g.length=p,{patchedLines:g,oldLineLastI:A-1}}const b=[];let y=0;for(let v=0;v<i.length;v++){const A=i[v];let U;const D=r.length-A.oldLines+o;let I;for(let g=0;g<=o;g++){I=A.oldStart+y-1;const p=
|
|
78
|
-
`)}function
|
|
79
|
-
`)?I.lines[g]=I.lines[g].slice(0,-1):(I.lines.splice(g+1,0,"\"),g++);return{oldFileName:t,newFileName:e,oldHeader:i,newHeader:s,hunks:b}}}function
|
|
75
|
+
`)&&(n=n.slice(0,-1))),super.equals(e,n,r)}}const Fs=new lp;function ii(t,e,n){return Fs.diff(t,e,n)}function _l(t,e,n){return n=ap(n,{ignoreWhitespace:!0}),Fs.diff(t,e,n)}function wl(t,e){e.stripTrailingCr&&(t=t.replace(/\r\n/g,`
|
|
76
|
+
`));const n=[],r=t.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let i=0;i<r.length;i++){const s=r[i];i%2&&!e.newlineIsToken?n[n.length-1]+=s:n.push(s)}return n}function cp(t){return t=="."||t=="!"||t=="?"}class up extends Rt{tokenize(e){var n;const r=[];let i=0;for(let s=0;s<e.length;s++){if(s==e.length-1){r.push(e.slice(i));break}if(cp(e[s])&&e[s+1].match(/\s/)){for(r.push(e.slice(i,s+1)),s=i=s+1;!((n=e[s+1])===null||n===void 0)&&n.match(/\s/);)s++;r.push(e.slice(i,s+1)),i=s+1}}return r}}const xl=new up;function Sl(t,e,n){return xl.diff(t,e,n)}class fp extends Rt{tokenize(e){return e.split(/([{}:;,]|\s+)/)}}const El=new fp;function $l(t,e,n){return El.diff(t,e,n)}class dp extends Rt{constructor(){super(...arguments),this.tokenize=wl}get useLongestToken(){return!0}castInput(e,n){const{undefinedReplacement:r,stringifyReplacer:i=(s,o)=>typeof o>"u"?r:o}=n;return typeof e=="string"?e:JSON.stringify(si(e,null,null,i),null," ")}equals(e,n,r){return super.equals(e.replace(/,([\r\n])/g,"$1"),n.replace(/,([\r\n])/g,"$1"),r)}}const kl=new dp;function Cl(t,e,n){return kl.diff(t,e,n)}function si(t,e,n,r,i){e=e||[],n=n||[],r&&(t=r(i===void 0?"":i,t));let s;for(s=0;s<e.length;s+=1)if(e[s]===t)return n[s];let o;if(Object.prototype.toString.call(t)==="[object Array]"){for(e.push(t),o=new Array(t.length),n.push(o),s=0;s<t.length;s+=1)o[s]=si(t[s],e,n,r,String(s));return e.pop(),n.pop(),o}if(t&&t.toJSON&&(t=t.toJSON()),typeof t=="object"&&t!==null){e.push(t),o={},n.push(o);const a=[];let l;for(l in t)Object.prototype.hasOwnProperty.call(t,l)&&a.push(l);for(a.sort(),s=0;s<a.length;s+=1)l=a[s],o[l]=si(t[l],e,n,r,l);e.pop(),n.pop()}else o=t;return o}class hp extends Rt{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}}const Ol=new hp;function Pl(t,e,n){return Ol.diff(t,e,n)}function Al(t){return Array.isArray(t)?t.map(e=>Al(e)):Object.assign(Object.assign({},t),{hunks:t.hunks.map(e=>Object.assign(Object.assign({},e),{lines:e.lines.map((n,r)=>{var i;return n.startsWith("\\")||n.endsWith("\r")||!((i=e.lines[r+1])===null||i===void 0)&&i.startsWith("\\")?n:n+"\r"})}))})}function Il(t){return Array.isArray(t)?t.map(e=>Il(e)):Object.assign(Object.assign({},t),{hunks:t.hunks.map(e=>Object.assign(Object.assign({},e),{lines:e.lines.map(n=>n.endsWith("\r")?n.substring(0,n.length-1):n)}))})}function pp(t){return Array.isArray(t)||(t=[t]),!t.some(e=>e.hunks.some(n=>n.lines.some(r=>!r.startsWith("\\")&&r.endsWith("\r"))))}function mp(t){return Array.isArray(t)||(t=[t]),t.some(e=>e.hunks.some(n=>n.lines.some(r=>r.endsWith("\r"))))&&t.every(e=>e.hunks.every(n=>n.lines.every((r,i)=>{var s;return r.startsWith("\\")||r.endsWith("\r")||((s=n.lines[i+1])===null||s===void 0?void 0:s.startsWith("\\"))})))}function Bs(t){const e=t.split(/\n/),n=[];let r=0;function i(){const a={};for(n.push(a);r<e.length;){const l=e[r];if(/^(---|\+\+\+|@@)\s/.test(l))break;const u=/^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(l);u&&(a.index=u[1]),r++}for(s(a),s(a),a.hunks=[];r<e.length;){const l=e[r];if(/^(Index:\s|diff\s|---\s|\+\+\+\s|===================================================================)/.test(l))break;if(/^@@/.test(l))a.hunks.push(o());else{if(l)throw new Error("Unknown line "+(r+1)+" "+JSON.stringify(l));r++}}}function s(a){const l=/^(---|\+\+\+)\s+(.*)\r?$/.exec(e[r]);if(l){const u=l[2].split(" ",2),c=(u[1]||"").trim();let f=u[0].replace(/\\\\/g,"\\");/^".*"$/.test(f)&&(f=f.substr(1,f.length-2)),l[1]==="---"?(a.oldFileName=f,a.oldHeader=c):(a.newFileName=f,a.newHeader=c),r++}}function o(){var a;const l=r,u=e[r++],c=u.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/),f={oldStart:+c[1],oldLines:typeof c[2]>"u"?1:+c[2],newStart:+c[3],newLines:typeof c[4]>"u"?1:+c[4],lines:[]};f.oldLines===0&&(f.oldStart+=1),f.newLines===0&&(f.newStart+=1);let b=0,y=0;for(;r<e.length&&(y<f.oldLines||b<f.newLines||!((a=e[r])===null||a===void 0)&&a.startsWith("\\"));r++){const v=e[r].length==0&&r!=e.length-1?" ":e[r][0];if(v==="+"||v==="-"||v===" "||v==="\\")f.lines.push(e[r]),v==="+"?b++:v==="-"?y++:v===" "&&(b++,y++);else throw new Error(`Hunk at line ${l+1} contained invalid line ${e[r]}`)}if(!b&&f.newLines===1&&(f.newLines=0),!y&&f.oldLines===1&&(f.oldLines=0),b!==f.newLines)throw new Error("Added line count did not match for hunk at line "+(l+1));if(y!==f.oldLines)throw new Error("Removed line count did not match for hunk at line "+(l+1));return f}for(;r<e.length;)i();return n}function gp(t,e,n){let r=!0,i=!1,s=!1,o=1;return function a(){if(r&&!s){if(i?o++:r=!1,t+o<=n)return t+o;s=!0}if(!i)return s||(r=!0),e<=t-o?t-o++:(i=!0,a())}}function Tl(t,e,n={}){let r;if(typeof e=="string"?r=Bs(e):Array.isArray(e)?r=e:r=[e],r.length>1)throw new Error("applyPatch only works with a single input.");return yp(t,r[0],n)}function yp(t,e,n={}){(n.autoConvertLineEndings||n.autoConvertLineEndings==null)&&(np(t)&&pp(e)?e=Al(e):rp(t)&&mp(e)&&(e=Il(e)));const r=t.split(`
|
|
77
|
+
`),i=e.hunks,s=n.compareLine||((v,A,U,D)=>A===D),o=n.fuzzFactor||0;let a=0;if(o<0||!Number.isInteger(o))throw new Error("fuzzFactor must be a non-negative integer");if(!i.length)return t;let l="",u=!1,c=!1;for(let v=0;v<i[i.length-1].lines.length;v++){const A=i[i.length-1].lines[v];A[0]=="\\"&&(l[0]=="+"?u=!0:l[0]=="-"&&(c=!0)),l=A}if(u){if(c){if(!o&&r[r.length-1]=="")return!1}else if(r[r.length-1]=="")r.pop();else if(!o)return!1}else if(c){if(r[r.length-1]!="")r.push("");else if(!o)return!1}function f(v,A,U,D=0,I=!0,g=[],p=0){let h=0,x=!1;for(;D<v.length;D++){const P=v[D],R=P.length>0?P[0]:" ",W=P.length>0?P.substr(1):P;if(R==="-")if(s(A+1,r[A],R,W))A++,h=0;else return!U||r[A]==null?null:(g[p]=r[A],f(v,A+1,U-1,D,!1,g,p+1));if(R==="+"){if(!I)return null;g[p]=W,p++,h=0,x=!0}if(R===" ")if(h++,g[p]=r[A],s(A+1,r[A],R,W))p++,I=!0,x=!1,A++;else return x||!U?null:r[A]&&(f(v,A+1,U-1,D+1,!1,g,p+1)||f(v,A+1,U-1,D,!1,g,p+1))||f(v,A,U-1,D+1,!1,g,p)}return p-=h,A-=h,g.length=p,{patchedLines:g,oldLineLastI:A-1}}const b=[];let y=0;for(let v=0;v<i.length;v++){const A=i[v];let U;const D=r.length-A.oldLines+o;let I;for(let g=0;g<=o;g++){I=A.oldStart+y-1;const p=gp(I,a,D);for(;I!==void 0&&(U=f(A.lines,I,g),!U);I=p());if(U)break}if(!U)return!1;for(let g=a;g<I;g++)b.push(r[g]);for(let g=0;g<U.patchedLines.length;g++){const p=U.patchedLines[g];b.push(p)}a=U.oldLineLastI+1,y=I+1-A.oldStart}for(let v=a;v<r.length;v++)b.push(r[v]);return b.join(`
|
|
78
|
+
`)}function vp(t,e){const n=typeof t=="string"?Bs(t):t;let r=0;function i(){const s=n[r++];if(!s)return e.complete();e.loadFile(s,function(o,a){if(o)return e.complete(o);const l=Tl(a,s,e);e.patched(s,l,function(u){if(u)return e.complete(u);i()})})}i()}function Rl(t){return Array.isArray(t)?t.map(e=>Rl(e)).reverse():Object.assign(Object.assign({},t),{oldFileName:t.newFileName,oldHeader:t.newHeader,newFileName:t.oldFileName,newHeader:t.oldHeader,hunks:t.hunks.map(e=>({oldLines:e.newLines,oldStart:e.newStart,newLines:e.oldLines,newStart:e.oldStart,lines:e.lines.map(n=>n.startsWith("-")?`+${n.slice(1)}`:n.startsWith("+")?`-${n.slice(1)}`:n)}))})}function Us(t,e,n,r,i,s,o){let a;o?typeof o=="function"?a={callback:o}:a=o:a={},typeof a.context>"u"&&(a.context=4);const l=a.context;if(a.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(a.callback){const{callback:c}=a;ii(n,r,Object.assign(Object.assign({},a),{callback:f=>{const b=u(f);c(b)}}))}else return u(ii(n,r,a));function u(c){if(!c)return;c.push({value:"",lines:[]});function f(I){return I.map(function(g){return" "+g})}const b=[];let y=0,v=0,A=[],U=1,D=1;for(let I=0;I<c.length;I++){const g=c[I],p=g.lines||_p(g.value);if(g.lines=p,g.added||g.removed){if(!y){const h=c[I-1];y=U,v=D,h&&(A=l>0?f(h.lines.slice(-l)):[],y-=A.length,v-=A.length)}for(const h of p)A.push((g.added?"+":"-")+h);g.added?D+=p.length:U+=p.length}else{if(y)if(p.length<=l*2&&I<c.length-2)for(const h of f(p))A.push(h);else{const h=Math.min(p.length,l);for(const P of f(p.slice(0,h)))A.push(P);const x={oldStart:y,oldLines:U-y+h,newStart:v,newLines:D-v+h,lines:A};b.push(x),y=0,v=0,A=[]}U+=p.length,D+=p.length}}for(const I of b)for(let g=0;g<I.lines.length;g++)I.lines[g].endsWith(`
|
|
79
|
+
`)?I.lines[g]=I.lines[g].slice(0,-1):(I.lines.splice(g+1,0,"\"),g++);return{oldFileName:t,newFileName:e,oldHeader:i,newHeader:s,hunks:b}}}function oi(t){if(Array.isArray(t))return t.map(oi).join(`
|
|
80
80
|
`);const e=[];t.oldFileName==t.newFileName&&e.push("Index: "+t.oldFileName),e.push("==================================================================="),e.push("--- "+t.oldFileName+(typeof t.oldHeader>"u"?"":" "+t.oldHeader)),e.push("+++ "+t.newFileName+(typeof t.newHeader>"u"?"":" "+t.newHeader));for(let n=0;n<t.hunks.length;n++){const r=t.hunks[n];r.oldLines===0&&(r.oldStart-=1),r.newLines===0&&(r.newStart-=1),e.push("@@ -"+r.oldStart+","+r.oldLines+" +"+r.newStart+","+r.newLines+" @@");for(const i of r.lines)e.push(i)}return e.join(`
|
|
81
81
|
`)+`
|
|
82
|
-
`}function
|
|
82
|
+
`}function Hs(t,e,n,r,i,s,o){if(typeof o=="function"&&(o={callback:o}),o?.callback){const{callback:a}=o;Us(t,e,n,r,i,s,Object.assign(Object.assign({},o),{callback:l=>{a(l?oi(l):void 0)}}))}else{const a=Us(t,e,n,r,i,s,o);return a?oi(a):void 0}}function bp(t,e,n,r,i,s){return Hs(t,t,e,n,r,i,s)}function _p(t){const e=t.endsWith(`
|
|
83
83
|
`),n=t.split(`
|
|
84
84
|
`).map(r=>r+`
|
|
85
|
-
`);return e?n.pop():n.push(n.pop().slice(0,-1)),n}function
|
|
85
|
+
`);return e?n.pop():n.push(n.pop().slice(0,-1)),n}function wp(t){const e=[];let n,r;for(let i=0;i<t.length;i++)n=t[i],n.added?r=1:n.removed?r=-1:r=0,e.push([r,n.value]);return e}function xp(t){const e=[];for(let n=0;n<t.length;n++){const r=t[n];r.added?e.push("<ins>"):r.removed&&e.push("<del>"),e.push(Sp(r.value)),r.added?e.push("</ins>"):r.removed&&e.push("</del>")}return e.join("")}function Sp(t){let e=t;return e=e.replace(/&/g,"&"),e=e.replace(/</g,"<"),e=e.replace(/>/g,">"),e=e.replace(/"/g,"""),e}const Ep=Object.freeze(Object.defineProperty({__proto__:null,Diff:Rt,applyPatch:Tl,applyPatches:vp,arrayDiff:Ol,canonicalize:si,characterDiff:fl,convertChangesToDMP:wp,convertChangesToXML:xp,createPatch:bp,createTwoFilesPatch:Hs,cssDiff:El,diffArrays:Pl,diffChars:dl,diffCss:$l,diffJson:Cl,diffLines:ii,diffSentences:Sl,diffTrimmedLines:_l,diffWords:yl,diffWordsWithSpace:Ms,formatPatch:oi,jsonDiff:kl,lineDiff:Fs,parsePatch:Bs,reversePatch:Rl,sentenceDiff:xl,structuredPatch:Us,wordDiff:gl,wordsWithSpaceDiff:bl},Symbol.toStringTag,{value:"Module"}));class $p{constructor(e){this.ctx=e,this.JsDiff=Ep,this.diffChars=dl,this.diffWords=yl,this.diffWordsWithSpace=Ms,this.diffLines=ii,this.diffTrimmedLines=_l,this.diffSentences=Sl,this.diffCss=$l,this.diffJson=Cl,this.diffArrays=Pl,this.createTwoFilesPatch=Hs,this.ctx.set("jsdiff",this)}}const kp={"diff-container":"_diff-container_lq0si_2"},Cp=t=>{let{user:e,target:n}=t;const r=window.mw?.config?.get("wgArticlePath")||"/$1",i=s=>r.replace("$1",s);return C("span",{className:"mw-userlinks",children:[C("a",{href:i(`User:${e}`),className:"mw-userlink",target:n,children:e})," ",C("span",{className:"mw-usertoollinks",children:["(",C("a",{href:i(`User_talk:${e}`),className:"mw-usertoollinks-talk",target:n,children:"talk"})," | ",C("a",{href:i(`Special:Contributions/${e}`),className:"mw-usertoollinks-contribs",target:n,children:"contribs"})," | ",C("a",{href:i(`Special:Block/${e}`),className:"mw-usertoollinks-block",target:n,children:"block"}),")"]})]})},Op=new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"medium"}).format,Nl=t=>{let e=["diff-title"];return t.type==="from"?e.push("diff-otitle"):t.type==="to"&&e.push("diff-ntitle"),!t.pageid||!t.userid?C("td",{colSpan:2,className:e,children:C("div",{className:"mw-diff-title--title",children:t.type==="from"?"Original content":t.type==="to"?"Your content":""})}):C("td",{colSpan:2,className:e,children:[C("div",{className:"mw-diff-title--title",children:t.pagetitle||t.timestamp}),C("div",{className:"mw-diff-title--user",children:t.username&&C(Cp,{user:t.username,target:"_blank"})}),C("div",{className:"mw-diff-title--timestamp",children:t.timestamp&&Op(new Date(t.timestamp))}),C("div",{className:"mw-diff-title--comment",children:t.parsedcomment&&C(Xn,{children:["(",C("i",{innerHTML:t.parsedcomment}),")"]})}),C("div",{className:"mw-diff-title--navigation"})]})},Pp=t=>{const{data:e,...n}=t,r=C("table",{className:"theme-ipe diff diff-type-table","data-mw":"interface",...n,children:[C("colgroup",{children:[C("col",{className:"diff-marker"}),C("col",{className:"diff-content"}),C("col",{className:"diff-marker"}),C("col",{className:"diff-content"})]}),C("tbody",{children:[C("tr",{children:[C(Nl,{type:"from",pageid:e.fromid,pagetitle:e.fromtitle,revid:e.fromrevid,size:e.fromsize,timestamp:e.fromtimestamp,username:e.fromuser,userid:e.fromuserid,comment:e.fromcomment,parsedcomment:e.fromparsedcomment}),C(Nl,{type:"to",pageid:e.toid,pagetitle:e.totitle,revid:e.torevid,size:e.tosize,timestamp:e.totimestamp,username:e.touser,userid:e.touserid,comment:e.tocomment,parsedcomment:e.toparsedcomment})]}),C("div",{id:"diffbody"}),C("tr",{className:"diff-size",style:{textAlign:"center"},children:[C("td",{colSpan:2,className:"diff-size-old",children:e.fromsize!==void 0&&`${e.fromsize} bytes`}),C("td",{colSpan:2,className:"diff-size-new",children:e.tosize!==void 0&&`${e.tosize} bytes`})]})]})]});return r.querySelector("#diffbody").outerHTML=e.body||C("tr",{children:C("td",{colSpan:4,children:C("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"5rem"},children:C("i",{children:"No changes"})})})}).outerHTML,r},Ap=(t,e=document)=>e.querySelector(t),Ip=(t,e=document)=>e.querySelectorAll(t);var Tp=Object.create,qs=Object.defineProperty,Rp=Object.getOwnPropertyDescriptor,Dl=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Ll=t=>{throw TypeError(t)},Np=(t,e,n)=>e in t?qs(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Dp=(t,e)=>qs(t,"name",{value:e,configurable:!0}),Lp=t=>[,,,Tp(t?.[Dl("metadata")]??null)],jp=["class","method","getter","setter","accessor","field","value","get","set"],jl=t=>t!==void 0&&typeof t!="function"?Ll("Function expected"):t,Mp=(t,e,n,r,i)=>({kind:jp[t],name:e,metadata:r,addInitializer:s=>n._?Ll("Already initialized"):i.push(jl(s||null))}),Fp=(t,e)=>Np(e,Dl("metadata"),t[3]),Bp=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},Up=(t,e,n,r,i,s)=>{var o,a,l,u=e&7,c=!1,f=0,b=t[f]||(t[f]=[]),y=u&&(i=i.prototype,u<5&&(u>3||!c)&&Rp(i,n));Dp(i,n);for(var v=r.length-1;v>=0;v--)l=Mp(u,n,a={},t[3],b),o=(0,r[v])(i,l),a._=1,jl(o)&&(i=o);return Fp(t,i),y&&qs(i,n,y),c?u^4?s:y:i},Ml,Ws,Fl;const Bl=["diffChars","diffWords","diffSentences","diffLines","createTwoFilesPatch"];Ml=[Ge(["jsdiff"]),Jr(Se.object({"quickDiff.preferredCompareMode":Se.union([Se.const("jsDiff"),Se.const("mwApi")]).description("The preferred comparison mode for quick diff").default("mwApi"),"quickDiff.jsDiff.defaultType":Se.union(Bl.map(t=>Se.const(t))).description("The default diff type for JsDiff").default("diffSentences")}).description("Quick Diff Preferences"),{"quickDiff.preferredCompareMode":"mwApi","quickDiff.jsDiff.defaultType":"diffSentences"})];class ai extends(Fl=ut){constructor(e){super(e,{},"quick-diff"),this.ctx=e,this.VALID_DIFF_TYPES=Bl,this.COMPARE_API_DEFAULT_OPTIONS={prop:["comment","diff","diffsize","ids","parsedcomment","size","timestamp","title","user"].join("|"),difftype:"table"}}start(){this.ctx.set("quickDiff",this),this.ctx.on("quickEdit/wikiPage",this.injectQuickEdit.bind(this)),window.RLQ.push(this.injectHistoryPage.bind(this))}stop(){this.ctx.off("quickEdit/wikiPage",this.injectQuickEdit.bind(this))}injectHistoryPage(){const e=Ap("#mw-history-compare");if(!e)return;Ip(".mw-history-compareselectedversions-button",e).forEach(r=>{r.after(C("button",{className:"cdx-button",onClick:i=>{i.preventDefault();const s=new FormData(e),o=Number(s.get("oldid"))||0,a=Number(s.get("diff"))||0;if(!s.get("title")||!o||!a)return this.logger.warn("Missing title or revision IDs");this.comparePages({fromrev:o,torev:a})},children:"Quick Diff"}))})}injectQuickEdit({modal:e,wikiPage:n}){if(n.pageid===0)return;let r;e.addButton({label:"Diff",side:"left",className:"btn btn-secondary",method:()=>{const i=n.title,s=n.revisions?.[0]?.content||"",o=e.get$content().querySelector('textarea[name="text"]')?.value||"";return r=this.comparePages({fromtitle:i,fromtext:s,totitle:i,totext:o},r),r}},1)}simpleTextDiff(e,n){const r=this.ctx.modal.show({title:"Quick Diff",className:"in-page-edit ipe-quickDiff"});r.show();const i=C("pre",{className:kp["diff-container"]}),s=C("div",{style:{display:"flex",gap:"1em"},children:this.VALID_DIFF_TYPES.map((o,a)=>C(Va,{name:"diffType",value:o,label:o,inputProps:{checked:a===0}}))});r.setContent(C("section",{children:[s,i]})),s.querySelectorAll('input[name="diffType"]').forEach(o=>{o.addEventListener("change",()=>{const a=this.renderJsDiff(e,n,o.value);i.textContent="",i.appendChild(a)})}),s.querySelector('input[name="diffType"]').dispatchEvent(new Event("change"))}renderJsDiff(e,n,r="diffSentences"){const i=document.createDocumentFragment();let s;if(r==="createTwoFilesPatch"){let o=!1;s=this.ctx.jsdiff.createTwoFilesPatch("original.txt","modified.txt",e,n).split(`
|
|
86
86
|
`).map(function(a){const l={value:a+`
|
|
87
|
-
`};return a.startsWith("@@")?(l.chunkHeader=!0,o=!0):o&&(a.startsWith("-")?l.removed=!0:a.startsWith("+")&&(l.added=!0)),l})}else{const o=this.ctx.jsdiff[r];if(!o)throw new Error(`Missing DiffEngine for ${r}`);s=o(e,n)}if(!Array.isArray(s))throw new Error("Missing diff result");for(let o=0;o<s.length;o++){if(s[o].added&&s[o+1]&&s[o+1].removed){const l=s[o];s[o]=s[o+1],s[o+1]=l}let a;s[o].removed?(a=document.createElement("del"),a.appendChild(document.createTextNode(s[o].value))):s[o].added?(a=document.createElement("ins"),a.appendChild(document.createTextNode(s[o].value))):s[o].chunkHeader?(a=document.createElement("span"),a.setAttribute("class","chunk-header"),a.appendChild(document.createTextNode(s[o].value))):a=document.createTextNode(s[o].value),i.appendChild(a)}return i}comparePages(e,n){return(!n||n.isDestroyed)&&(n=this.ctx.modal.createObject({title:"Loading diff...",content:"",className:"quick-diff",backdrop:!1,draggable:!0}).init()),n.setContent(C(
|
|
88
|
-
`),{cause:r})}if(!r.data.compare)throw new Error("No compare data received",{cause:r});const{data:{compare:i}}=r;n.setTitle(i.fromtitle&&i.totitle?`${i.fromtitle} ⇔ ${i.totitle}`:"Differences"),n.setContent(C("section",{children:C(
|
|
89
|
-
* @vue/shared v3.5.
|
|
87
|
+
`};return a.startsWith("@@")?(l.chunkHeader=!0,o=!0):o&&(a.startsWith("-")?l.removed=!0:a.startsWith("+")&&(l.added=!0)),l})}else{const o=this.ctx.jsdiff[r];if(!o)throw new Error(`Missing DiffEngine for ${r}`);s=o(e,n)}if(!Array.isArray(s))throw new Error("Missing diff result");for(let o=0;o<s.length;o++){if(s[o].added&&s[o+1]&&s[o+1].removed){const l=s[o];s[o]=s[o+1],s[o+1]=l}let a;s[o].removed?(a=document.createElement("del"),a.appendChild(document.createTextNode(s[o].value))):s[o].added?(a=document.createElement("ins"),a.appendChild(document.createTextNode(s[o].value))):s[o].chunkHeader?(a=document.createElement("span"),a.setAttribute("class","chunk-header"),a.appendChild(document.createTextNode(s[o].value))):a=document.createTextNode(s[o].value),i.appendChild(a)}return i}comparePages(e,n){return(!n||n.isDestroyed)&&(n=this.ctx.modal.createObject({title:"Loading diff...",content:"",className:"quick-diff",backdrop:!1,draggable:!0}).init()),n.setContent(C(on,{})),n.bringToFront(),window.mw&&mw.loader.getState("mediawiki.diff.styles")!=="ready"&&mw.loader.load(["mediawiki.diff.styles"]),this.ctx.api.post({...this.COMPARE_API_DEFAULT_OPTIONS,...e,action:"compare",format:"json",formatversion:2}).then(r=>{if(r.data?.error||r.data?.errors){const s=[r.data?.error,...r.data?.errors||[]].filter(Boolean);throw new Error(s.map(o=>o.info).join(`
|
|
88
|
+
`),{cause:r})}if(!r.data.compare)throw new Error("No compare data received",{cause:r});const{data:{compare:i}}=r;n.setTitle(i.fromtitle&&i.totitle?`${i.fromtitle} ⇔ ${i.totitle}`:"Differences"),n.setContent(C("section",{children:C(Pp,{data:i})}))}).catch(r=>{n.setContent(C(za,{title:"Failed to load diff",type:"error",children:C("pre",{children:r instanceof Error?r.message:String(r)})}))}),n.show()}}Ws=Lp(Fl),ai=Up(Ws,0,"PluginQuickDiffCore",Ml,ai),Bp(Ws,1,ai);const Ho=class Ho extends ut{constructor(e){super(e,{},"quick-diff-loader"),this.ctx=e,e.plugin($p),e.plugin(ai)}};Ho.inject=["api","wikiPage","modal"];let zs=Ho;const Hp=Object.freeze(Object.defineProperty({__proto__:null,PluginQuickDiff:zs},Symbol.toStringTag,{value:"Module"})),qo=class qo extends ut{constructor(e){super(e,{},"quick-redirect"),this.ctx=e}start(){this.ctx.set("quickRedirect",this.quickRedirect.bind(this)),this.ctx.set("redirectPage",this.redirectPage.bind(this));const e=window.mw?.config.get("wgPageName")||"",n=window.mw?.config.get("wgIsProbablyEditable");this.ctx.inject(["toolbox"],r=>{this.ctx=r,r.toolbox.addButton({id:"quick-redirect",icon:C("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-file-symlink",children:[C("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),C("path",{d:"M4 21v-4a3 3 0 0 1 3 -3h5"}),C("path",{d:"M9 17l3 -3l-3 -3"}),C("path",{d:"M14 3v4a1 1 0 0 0 1 1h4"}),C("path",{d:"M5 11v-6a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2h-9.5"})]}),tooltip:"Quick Redirect",group:"group1",onClick:()=>{this.quickRedirect(n?{to:e}:{})}}),this.addDisposeHandler(i=>{i.toolbox.removeButton("quick-redirect")})})}stop(){}quickRedirect(e){const n=this.ctx.modal.createObject({title:"Quick Redirect",content:C(on,{}),className:"quick-redirect compact-buttons",sizeClass:"medium",center:!0}).init();let r=null;return n.setContent(C("form",{ref:i=>r=i,style:{display:"flex",flexDirection:"column",gap:"1rem"},onSubmit:i=>{if(i.preventDefault(),r?.checkValidity(),!r?.reportValidity())return;const s=new FormData(r),o={from:s.get("from")?.toString().trim(),to:s.get("to")?.toString().trim(),reason:s.get("reason")||"",overwrite:s.get("overwrite")==="on"};if(!o.from||!o.to){this.ctx.modal.notify("error",{title:"Failed to redirect",content:"From and to are required."});return}n.setLoadingState(!0),this.redirectPage(o).then(a=>{n.close(),this.ctx.modal.notify("success",{title:"Redirect successful",content:"The redirect has been created."})}).catch(a=>{n.setLoadingState(!1),this.ctx.modal.notify("error",{title:"Failed to redirect",content:a instanceof Error?a.message:String(a)})})},children:[C(el,{inputs:[{label:"From",name:"from",value:e?.from,required:!0},{label:"To",name:"to",value:e?.to,required:!0}]}),C(Ps,{label:"Reason",id:"reason",name:"reason",value:e?.reason}),C("div",{children:C(wn,{name:"overwrite",id:"overwrite",checked:e?.overwrite,children:"Force create redirect even if the from page already exists"})})]})),n.setButtons([{label:"Create Redirect",className:"is-primary is-ghost",method:()=>{r?.dispatchEvent(new Event("submit"))}}]),n.show()}async redirectPage(e){const{from:n,to:r,reason:i="",overwrite:s=!1}=e,o=await this.ctx.wikiPage.newBlankPage({title:n}),a=`#REDIRECT [[:${r}]]`,l=await o.edit({text:a,summary:i},{createonly:!s});if(l.data?.errors)throw new Error(l.data.errors[0].text,{cause:l});return l}};qo.inject=["api","wikiPage","modal"];let Vs=qo;const qp=Object.freeze(Object.defineProperty({__proto__:null,PluginQuickRedirect:Vs},Symbol.toStringTag,{value:"Module"}));var Wp=Object.create,Ks=Object.defineProperty,zp=Object.getOwnPropertyDescriptor,Ul=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Hl=t=>{throw TypeError(t)},Vp=(t,e,n)=>e in t?Ks(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Kp=(t,e)=>Ks(t,"name",{value:e,configurable:!0}),Yp=t=>[,,,Wp(t?.[Ul("metadata")]??null)],Gp=["class","method","getter","setter","accessor","field","value","get","set"],ql=t=>t!==void 0&&typeof t!="function"?Hl("Function expected"):t,Jp=(t,e,n,r,i)=>({kind:Gp[t],name:e,metadata:r,addInitializer:s=>n._?Hl("Already initialized"):i.push(ql(s||null))}),Qp=(t,e)=>Vp(e,Ul("metadata"),t[3]),Xp=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},Zp=(t,e,n,r,i,s)=>{var o,a,l,u=e&7,c=!1,f=0,b=t[f]||(t[f]=[]),y=u&&(i=i.prototype,u<5&&(u>3||!c)&&zp(i,n));Kp(i,n);for(var v=r.length-1;v>=0;v--)l=Jp(u,n,a={},t[3],b),o=(0,r[v])(i,l),a._=1,ql(o)&&(i=o);return Qp(t,i),y&&Ks(i,n,y),c?u^4?s:y:i},Wl,Ys,zl;Wl=[Jr(Se.object({toolboxAlwaysShow:Se.boolean().description("Make the toolbox opened by default").default(!1)}).description("Toolbox preferences"),{toolboxAlwaysShow:!1}),Ge(["preferences"])];class li extends(zl=vn){constructor(e){super(e,"toolbox",!1),this.ctx=e,this.container=void 0,this.forceShow=!1}async start(){mw&&mw.config.get("wgIsArticle")===!1&&!this.forceShow?this.container=this.createIndicatorForNotArticlePage():this.container=this.createToolbox(),document.body.appendChild(this.container),await Ya(0),this.ctx.preferences.get("toolboxAlwaysShow").then(e=>{e&&(this.container.querySelector("#toolbox-toggle")?.classList.add("opened"),this.container.querySelectorAll(".btn-group").forEach(n=>{n.classList.add("opened")}))})}stop(){this.container?.remove()}createToolbox(){const n=C("div",{id:"ipe-edit-toolbox",children:[C("ul",{className:"btn-group group1",style:{display:"flex",flexDirection:"column"}}),C("ul",{className:"btn-group group2",style:{display:"flex",flexDirection:"row"}}),C("button",{className:"ipe-toolbox-btn",id:"toolbox-toggle",onClick:function(r){const i=this.classList.contains("opened");this.classList.toggle("opened",!i),n.querySelectorAll(".btn-group").forEach(s=>{s.classList.toggle("opened",!i)})},children:C("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-plus",children:[C("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),C("path",{d:"M12 5l0 14"}),C("path",{d:"M5 12l14 0"})]})})]});return n}createIndicatorForNotArticlePage(){return C("div",{id:"ipe-edit-toolbox",children:C("div",{id:"ipe-toolbox-placeholder",style:"width: 0.75rem; height: 0.75rem; border-radius: 50%; background: #3f51b5; color: #fff; pointer-events: none;",children:C("svg",{style:"width: 0.5em; height: 0.5em; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"4","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-check",children:[C("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),C("path",{d:"M5 12l5 5l10 -10"})]})})})}normalizeButtonId(e){return e||(e=Math.random().toString(36).substring(2,8)),`ipe-toolbox__${e.trim()}`.replace(/\s\.#/g,"-")}addButton(e){let{id:n,group:r,icon:i,tooltip:s,buttonProps:o,onClick:a,index:l}=e;n=this.normalizeButtonId(n);const u=this.container.querySelector(`#${n}`);u&&(this.ctx.logger("toolbox").warn(`Button with id ${n} already exists, replacing it.`),u.remove());let c=null;if(typeof r>"u"||r==="auto"){const b=this.container.querySelector(".btn-group.group1"),y=this.container.querySelector(".btn-group.group2"),v=b?.children.length||0,A=y?.children.length||0;c=v<=A?b:y}else c=this.container.querySelector(`.btn-group.${r}`);if(!c)throw new Error(`Button group ${r} not found`);const f=C("li",{class:"btn-tip-group",id:n,onClick:a,children:[C("div",{class:"btn-tip",children:s}),C("button",{id:`${n}-btn`,class:"ipe-toolbox-btn",...o,children:i})]});return typeof l=="number"?l<=0?c.prepend(f):l>=c.children.length?c.appendChild(f):c.children[l]?.before(f):c.appendChild(f),this.ctx.emit("toolbox/button/added",{ctx:this.ctx,button:f}),f}removeButton(e){this.container.querySelector(`.ipe-toolbox-btn#${e}`)?.remove(),this.ctx.emit("toolbox/button/removed",{ctx:this.ctx,id:e})}}Ys=Yp(zl),li=Zp(Ys,0,"PluginToolbox",Wl,li),Xp(Ys,1,li);const em=Object.freeze(Object.defineProperty({__proto__:null,get PluginToolbox(){return li}},Symbol.toStringTag,{value:"Module"}));/**
|
|
89
|
+
* @vue/shared v3.5.22
|
|
90
90
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
91
91
|
* @license MIT
|
|
92
|
-
**/function
|
|
93
|
-
* @vue/reactivity v3.5.
|
|
92
|
+
**/function Gs(t){const e=Object.create(null);for(const n of t.split(","))e[n]=1;return n=>n in e}const de={},xn=[],xt=()=>{},Vl=()=>!1,ci=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97),Js=t=>t.startsWith("onUpdate:"),Le=Object.assign,Qs=(t,e)=>{const n=t.indexOf(e);n>-1&&t.splice(n,1)},tm=Object.prototype.hasOwnProperty,pe=(t,e)=>tm.call(t,e),se=Array.isArray,Sn=t=>ui(t)==="[object Map]",Kl=t=>ui(t)==="[object Set]",oe=t=>typeof t=="function",ke=t=>typeof t=="string",Vt=t=>typeof t=="symbol",xe=t=>t!==null&&typeof t=="object",Yl=t=>(xe(t)||oe(t))&&oe(t.then)&&oe(t.catch),Gl=Object.prototype.toString,ui=t=>Gl.call(t),nm=t=>ui(t).slice(8,-1),Jl=t=>ui(t)==="[object Object]",Xs=t=>ke(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,rr=Gs(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),fi=t=>{const e=Object.create(null);return n=>e[n]||(e[n]=t(n))},rm=/-\w/g,Nt=fi(t=>t.replace(rm,e=>e.slice(1).toUpperCase())),im=/\B([A-Z])/g,Kt=fi(t=>t.replace(im,"-$1").toLowerCase()),Ql=fi(t=>t.charAt(0).toUpperCase()+t.slice(1)),Zs=fi(t=>t?`on${Ql(t)}`:""),Ze=(t,e)=>!Object.is(t,e),eo=(t,...e)=>{for(let n=0;n<t.length;n++)t[n](...e)},Xl=(t,e,n,r=!1)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,writable:r,value:n})},sm=t=>{const e=parseFloat(t);return isNaN(e)?t:e};let Zl;const di=()=>Zl||(Zl=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function to(t){if(se(t)){const e={};for(let n=0;n<t.length;n++){const r=t[n],i=ke(r)?cm(r):to(r);if(i)for(const s in i)e[s]=i[s]}return e}else if(ke(t)||xe(t))return t}const om=/;(?![^(]*\))/g,am=/:([^]+)/,lm=/\/\*[^]*?\*\//g;function cm(t){const e={};return t.replace(lm,"").split(om).forEach(n=>{if(n){const r=n.split(am);r.length>1&&(e[r[0].trim()]=r[1].trim())}}),e}function hi(t){let e="";if(ke(t))e=t;else if(se(t))for(let n=0;n<t.length;n++){const r=hi(t[n]);r&&(e+=r+" ")}else if(xe(t))for(const n in t)t[n]&&(e+=n+" ");return e.trim()}const um=Gs("itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly");function ec(t){return!!t||t===""}const tc=t=>!!(t&&t.__v_isRef===!0),pi=t=>ke(t)?t:t==null?"":se(t)||xe(t)&&(t.toString===Gl||!oe(t.toString))?tc(t)?pi(t.value):JSON.stringify(t,nc,2):String(t),nc=(t,e)=>tc(e)?nc(t,e.value):Sn(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((n,[r,i],s)=>(n[no(r,s)+" =>"]=i,n),{})}:Kl(e)?{[`Set(${e.size})`]:[...e.values()].map(n=>no(n))}:Vt(e)?no(e):xe(e)&&!se(e)&&!Jl(e)?String(e):e,no=(t,e="")=>{var n;return Vt(t)?`Symbol(${(n=t.description)!=null?n:e})`:t};/**
|
|
93
|
+
* @vue/reactivity v3.5.22
|
|
94
94
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
95
95
|
* @license MIT
|
|
96
|
-
**/let Ze;class lm{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.parent=Ze,!e&&Ze&&(this.index=(Ze.scopes||(Ze.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,n;if(this.scopes)for(e=0,n=this.scopes.length;e<n;e++)this.scopes[e].pause();for(e=0,n=this.effects.length;e<n;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,n;if(this.scopes)for(e=0,n=this.scopes.length;e<n;e++)this.scopes[e].resume();for(e=0,n=this.effects.length;e<n;e++)this.effects[e].resume()}}run(e){if(this._active){const n=Ze;try{return Ze=this,e()}finally{Ze=n}}}on(){++this._on===1&&(this.prevScope=Ze,Ze=this)}off(){this._on>0&&--this._on===0&&(Ze=this.prevScope,this.prevScope=void 0)}stop(e){if(this._active){this._active=!1;let n,r;for(n=0,r=this.effects.length;n<r;n++)this.effects[n].stop();for(this.effects.length=0,n=0,r=this.cleanups.length;n<r;n++)this.cleanups[n]();if(this.cleanups.length=0,this.scopes){for(n=0,r=this.scopes.length;n<r;n++)this.scopes[n].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){const i=this.parent.scopes.pop();i&&i!==this&&(this.parent.scopes[this.index]=i,i.index=this.index)}this.parent=void 0}}}function cm(){return Ze}let we;const no=new WeakSet;class ec{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,Ze&&Ze.active&&Ze.effects.push(this)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,no.has(this)&&(no.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||nc(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,ac(this),rc(this);const e=we,n=mt;we=this,mt=!0;try{return this.fn()}finally{ic(this),we=e,mt=n,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)oo(e);this.deps=this.depsTail=void 0,ac(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?no.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){so(this)&&this.run()}get dirty(){return so(this)}}let tc=0,rr,ir;function nc(t,e=!1){if(t.flags|=8,e){t.next=ir,ir=t;return}t.next=rr,rr=t}function ro(){tc++}function io(){if(--tc>0)return;if(ir){let e=ir;for(ir=void 0;e;){const n=e.next;e.next=void 0,e.flags&=-9,e=n}}let t;for(;rr;){let e=rr;for(rr=void 0;e;){const n=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(r){t||(t=r)}e=n}}if(t)throw t}function rc(t){for(let e=t.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function ic(t){let e,n=t.depsTail,r=n;for(;r;){const i=r.prevDep;r.version===-1?(r===n&&(n=i),oo(r),um(r)):e=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=i}t.deps=e,t.depsTail=n}function so(t){for(let e=t.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(sc(e.dep.computed)||e.dep.version!==e.version))return!0;return!!t._dirty}function sc(t){if(t.flags&4&&!(t.flags&16)||(t.flags&=-17,t.globalVersion===sr)||(t.globalVersion=sr,!t.isSSR&&t.flags&128&&(!t.deps&&!t._dirty||!so(t))))return;t.flags|=2;const e=t.dep,n=we,r=mt;we=t,mt=!0;try{rc(t);const i=t.fn(t._value);(e.version===0||Xe(i,t._value))&&(t.flags|=128,t._value=i,e.version++)}catch(i){throw e.version++,i}finally{we=n,mt=r,ic(t),t.flags&=-3}}function oo(t,e=!1){const{dep:n,prevSub:r,nextSub:i}=t;if(r&&(r.nextSub=i,t.prevSub=void 0),i&&(i.prevSub=r,t.nextSub=void 0),n.subs===t&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let s=n.computed.deps;s;s=s.nextDep)oo(s,!0)}!e&&!--n.sc&&n.map&&n.map.delete(n.key)}function um(t){const{prevDep:e,nextDep:n}=t;e&&(e.nextDep=n,t.prevDep=void 0),n&&(n.prevDep=e,t.nextDep=void 0)}let mt=!0;const oc=[];function xt(){oc.push(mt),mt=!1}function St(){const t=oc.pop();mt=t===void 0?!0:t}function ac(t){const{cleanup:e}=t;if(t.cleanup=void 0,e){const n=we;we=void 0;try{e()}finally{we=n}}}let sr=0;class fm{constructor(e,n){this.sub=e,this.dep=n,this.version=n.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class hi{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!we||!mt||we===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==we)n=this.activeLink=new fm(we,this),we.deps?(n.prevDep=we.depsTail,we.depsTail.nextDep=n,we.depsTail=n):we.deps=we.depsTail=n,lc(n);else if(n.version===-1&&(n.version=this.version,n.nextDep)){const r=n.nextDep;r.prevDep=n.prevDep,n.prevDep&&(n.prevDep.nextDep=r),n.prevDep=we.depsTail,n.nextDep=void 0,we.depsTail.nextDep=n,we.depsTail=n,we.deps===n&&(we.deps=r)}return n}trigger(e){this.version++,sr++,this.notify(e)}notify(e){ro();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{io()}}}function lc(t){if(t.dep.sc++,t.sub.flags&4){const e=t.dep.computed;if(e&&!t.dep.subs){e.flags|=20;for(let r=e.deps;r;r=r.nextDep)lc(r)}const n=t.dep.subs;n!==t&&(t.prevSub=n,n&&(n.nextSub=t)),t.dep.subs=t}}const ao=new WeakMap,an=Symbol(""),lo=Symbol(""),or=Symbol("");function He(t,e,n){if(mt&&we){let r=ao.get(t);r||ao.set(t,r=new Map);let i=r.get(n);i||(r.set(n,i=new hi),i.map=r,i.key=n),i.track()}}function Nt(t,e,n,r,i,s){const o=ao.get(t);if(!o){sr++;return}const a=l=>{l&&l.trigger()};if(ro(),e==="clear")o.forEach(a);else{const l=se(t),u=l&&Qs(n);if(l&&n==="length"){const c=Number(r);o.forEach((f,b)=>{(b==="length"||b===or||!zt(b)&&b>=c)&&a(f)})}else switch((n!==void 0||o.has(void 0))&&a(o.get(n)),u&&a(o.get(or)),e){case"add":l?u&&a(o.get("length")):(a(o.get(an)),xn(t)&&a(o.get(lo)));break;case"delete":l||(a(o.get(an)),xn(t)&&a(o.get(lo)));break;case"set":xn(t)&&a(o.get(an));break}}io()}function Sn(t){const e=fe(t);return e===t?e:(He(e,"iterate",or),ct(t)?e:e.map(je))}function pi(t){return He(t=fe(t),"iterate",or),t}const dm={__proto__:null,[Symbol.iterator](){return co(this,Symbol.iterator,je)},concat(...t){return Sn(this).concat(...t.map(e=>se(e)?Sn(e):e))},entries(){return co(this,"entries",t=>(t[1]=je(t[1]),t))},every(t,e){return Dt(this,"every",t,e,void 0,arguments)},filter(t,e){return Dt(this,"filter",t,e,n=>n.map(je),arguments)},find(t,e){return Dt(this,"find",t,e,je,arguments)},findIndex(t,e){return Dt(this,"findIndex",t,e,void 0,arguments)},findLast(t,e){return Dt(this,"findLast",t,e,je,arguments)},findLastIndex(t,e){return Dt(this,"findLastIndex",t,e,void 0,arguments)},forEach(t,e){return Dt(this,"forEach",t,e,void 0,arguments)},includes(...t){return uo(this,"includes",t)},indexOf(...t){return uo(this,"indexOf",t)},join(t){return Sn(this).join(t)},lastIndexOf(...t){return uo(this,"lastIndexOf",t)},map(t,e){return Dt(this,"map",t,e,void 0,arguments)},pop(){return ar(this,"pop")},push(...t){return ar(this,"push",t)},reduce(t,...e){return cc(this,"reduce",t,e)},reduceRight(t,...e){return cc(this,"reduceRight",t,e)},shift(){return ar(this,"shift")},some(t,e){return Dt(this,"some",t,e,void 0,arguments)},splice(...t){return ar(this,"splice",t)},toReversed(){return Sn(this).toReversed()},toSorted(t){return Sn(this).toSorted(t)},toSpliced(...t){return Sn(this).toSpliced(...t)},unshift(...t){return ar(this,"unshift",t)},values(){return co(this,"values",je)}};function co(t,e,n){const r=pi(t),i=r[e]();return r!==t&&!ct(t)&&(i._next=i.next,i.next=()=>{const s=i._next();return s.value&&(s.value=n(s.value)),s}),i}const hm=Array.prototype;function Dt(t,e,n,r,i,s){const o=pi(t),a=o!==t&&!ct(t),l=o[e];if(l!==hm[e]){const f=l.apply(t,s);return a?je(f):f}let u=n;o!==t&&(a?u=function(f,b){return n.call(this,je(f),b,t)}:n.length>2&&(u=function(f,b){return n.call(this,f,b,t)}));const c=l.call(o,u,r);return a&&i?i(c):c}function cc(t,e,n,r){const i=pi(t);let s=n;return i!==t&&(ct(t)?n.length>3&&(s=function(o,a,l){return n.call(this,o,a,l,t)}):s=function(o,a,l){return n.call(this,o,je(a),l,t)}),i[e](s,...r)}function uo(t,e,n){const r=fe(t);He(r,"iterate",or);const i=r[e](...n);return(i===-1||i===!1)&&po(n[0])?(n[0]=fe(n[0]),r[e](...n)):i}function ar(t,e,n=[]){xt(),ro();const r=fe(t)[e].apply(t,n);return io(),St(),r}const pm=Ys("__proto__,__v_isRef,__isVue"),uc=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(zt));function mm(t){zt(t)||(t=String(t));const e=fe(this);return He(e,"has",t),e.hasOwnProperty(t)}class fc{constructor(e=!1,n=!1){this._isReadonly=e,this._isShallow=n}get(e,n,r){if(n==="__v_skip")return e.__v_skip;const i=this._isReadonly,s=this._isShallow;if(n==="__v_isReactive")return!i;if(n==="__v_isReadonly")return i;if(n==="__v_isShallow")return s;if(n==="__v_raw")return r===(i?s?yc:gc:s?mc:pc).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(r)?e:void 0;const o=se(e);if(!i){let l;if(o&&(l=dm[n]))return l;if(n==="hasOwnProperty")return mm}const a=Reflect.get(e,n,Ne(e)?e:r);return(zt(n)?uc.has(n):pm(n))||(i||He(e,"get",n),s)?a:Ne(a)?o&&Qs(n)?a:a.value:Se(a)?i?vc(a):ho(a):a}}class dc extends fc{constructor(e=!1){super(!1,e)}set(e,n,r,i){let s=e[n];if(!this._isShallow){const l=Kt(s);if(!ct(r)&&!Kt(r)&&(s=fe(s),r=fe(r)),!se(e)&&Ne(s)&&!Ne(r))return l||(s.value=r),!0}const o=se(e)&&Qs(n)?Number(n)<e.length:pe(e,n),a=Reflect.set(e,n,r,Ne(e)?e:i);return e===fe(i)&&(o?Xe(r,s)&&Nt(e,"set",n,r):Nt(e,"add",n,r)),a}deleteProperty(e,n){const r=pe(e,n);e[n];const i=Reflect.deleteProperty(e,n);return i&&r&&Nt(e,"delete",n,void 0),i}has(e,n){const r=Reflect.has(e,n);return(!zt(n)||!uc.has(n))&&He(e,"has",n),r}ownKeys(e){return He(e,"iterate",se(e)?"length":an),Reflect.ownKeys(e)}}class hc extends fc{constructor(e=!1){super(!0,e)}set(e,n){return!0}deleteProperty(e,n){return!0}}const gm=new dc,ym=new hc,vm=new dc(!0),bm=new hc(!0),fo=t=>t,mi=t=>Reflect.getPrototypeOf(t);function _m(t,e,n){return function(...r){const i=this.__v_raw,s=fe(i),o=xn(s),a=t==="entries"||t===Symbol.iterator&&o,l=t==="keys"&&o,u=i[t](...r),c=n?fo:e?bi:je;return!e&&He(s,"iterate",l?lo:an),{next(){const{value:f,done:b}=u.next();return b?{value:f,done:b}:{value:a?[c(f[0]),c(f[1])]:c(f),done:b}},[Symbol.iterator](){return this}}}}function gi(t){return function(...e){return t==="delete"?!1:t==="clear"?void 0:this}}function wm(t,e){const n={get(i){const s=this.__v_raw,o=fe(s),a=fe(i);t||(Xe(i,a)&&He(o,"get",i),He(o,"get",a));const{has:l}=mi(o),u=e?fo:t?bi:je;if(l.call(o,i))return u(s.get(i));if(l.call(o,a))return u(s.get(a));s!==o&&s.get(i)},get size(){const i=this.__v_raw;return!t&&He(fe(i),"iterate",an),i.size},has(i){const s=this.__v_raw,o=fe(s),a=fe(i);return t||(Xe(i,a)&&He(o,"has",i),He(o,"has",a)),i===a?s.has(i):s.has(i)||s.has(a)},forEach(i,s){const o=this,a=o.__v_raw,l=fe(a),u=e?fo:t?bi:je;return!t&&He(l,"iterate",an),a.forEach((c,f)=>i.call(s,u(c),u(f),o))}};return Le(n,t?{add:gi("add"),set:gi("set"),delete:gi("delete"),clear:gi("clear")}:{add(i){!e&&!ct(i)&&!Kt(i)&&(i=fe(i));const s=fe(this);return mi(s).has.call(s,i)||(s.add(i),Nt(s,"add",i,i)),this},set(i,s){!e&&!ct(s)&&!Kt(s)&&(s=fe(s));const o=fe(this),{has:a,get:l}=mi(o);let u=a.call(o,i);u||(i=fe(i),u=a.call(o,i));const c=l.call(o,i);return o.set(i,s),u?Xe(s,c)&&Nt(o,"set",i,s):Nt(o,"add",i,s),this},delete(i){const s=fe(this),{has:o,get:a}=mi(s);let l=o.call(s,i);l||(i=fe(i),l=o.call(s,i)),a&&a.call(s,i);const u=s.delete(i);return l&&Nt(s,"delete",i,void 0),u},clear(){const i=fe(this),s=i.size!==0,o=i.clear();return s&&Nt(i,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(i=>{n[i]=_m(i,t,e)}),n}function yi(t,e){const n=wm(t,e);return(r,i,s)=>i==="__v_isReactive"?!t:i==="__v_isReadonly"?t:i==="__v_raw"?r:Reflect.get(pe(n,i)&&i in r?n:r,i,s)}const xm={get:yi(!1,!1)},Sm={get:yi(!1,!0)},Em={get:yi(!0,!1)},$m={get:yi(!0,!0)},pc=new WeakMap,mc=new WeakMap,gc=new WeakMap,yc=new WeakMap;function km(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Cm(t){return t.__v_skip||!Object.isExtensible(t)?0:km(Zp(t))}function ho(t){return Kt(t)?t:vi(t,!1,gm,xm,pc)}function Om(t){return vi(t,!1,vm,Sm,mc)}function vc(t){return vi(t,!0,ym,Em,gc)}function Vv(t){return vi(t,!0,bm,$m,yc)}function vi(t,e,n,r,i){if(!Se(t)||t.__v_raw&&!(e&&t.__v_isReactive))return t;const s=Cm(t);if(s===0)return t;const o=i.get(t);if(o)return o;const a=new Proxy(t,s===2?r:n);return i.set(t,a),a}function En(t){return Kt(t)?En(t.__v_raw):!!(t&&t.__v_isReactive)}function Kt(t){return!!(t&&t.__v_isReadonly)}function ct(t){return!!(t&&t.__v_isShallow)}function po(t){return t?!!t.__v_raw:!1}function fe(t){const e=t&&t.__v_raw;return e?fe(e):t}function Pm(t){return!pe(t,"__v_skip")&&Object.isExtensible(t)&&Gl(t,"__v_skip",!0),t}const je=t=>Se(t)?ho(t):t,bi=t=>Se(t)?vc(t):t;function Ne(t){return t?t.__v_isRef===!0:!1}function _i(t){return bc(t,!1)}function Am(t){return bc(t,!0)}function bc(t,e){return Ne(t)?t:new Im(t,e)}class Im{constructor(e,n){this.dep=new hi,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?e:fe(e),this._value=n?e:je(e),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(e){const n=this._rawValue,r=this.__v_isShallow||ct(e)||Kt(e);e=r?e:fe(e),Xe(e,n)&&(this._rawValue=e,this._value=r?e:je(e),this.dep.trigger())}}function _c(t){return Ne(t)?t.value:t}const Tm={get:(t,e,n)=>e==="__v_raw"?t:_c(Reflect.get(t,e,n)),set:(t,e,n,r)=>{const i=t[e];return Ne(i)&&!Ne(n)?(i.value=n,!0):Reflect.set(t,e,n,r)}};function wc(t){return En(t)?t:new Proxy(t,Tm)}class Rm{constructor(e){this.__v_isRef=!0,this._value=void 0;const n=this.dep=new hi,{get:r,set:i}=e(n.track.bind(n),n.trigger.bind(n));this._get=r,this._set=i}get value(){return this._value=this._get()}set value(e){this._set(e)}}function Nm(t){return new Rm(t)}class Dm{constructor(e,n,r){this.fn=e,this.setter=n,this._value=void 0,this.dep=new hi(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=sr-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&we!==this)return nc(this,!0),!0}get value(){const e=this.dep.track();return sc(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function Lm(t,e,n=!1){let r,i;return oe(t)?r=t:(r=t.get,i=t.set),new Dm(r,i,n)}const wi={},xi=new WeakMap;let ln;function jm(t,e=!1,n=ln){if(n){let r=xi.get(n);r||xi.set(n,r=[]),r.push(t)}}function Mm(t,e,n=de){const{immediate:r,deep:i,once:s,scheduler:o,augmentJob:a,call:l}=n,u=p=>i?p:ct(p)||i===!1||i===0?Lt(p,1):Lt(p);let c,f,b,y,v=!1,A=!1;if(Ne(t)?(f=()=>t.value,v=ct(t)):En(t)?(f=()=>u(t),v=!0):se(t)?(A=!0,v=t.some(p=>En(p)||ct(p)),f=()=>t.map(p=>{if(Ne(p))return p.value;if(En(p))return u(p);if(oe(p))return l?l(p,2):p()})):oe(t)?e?f=l?()=>l(t,2):t:f=()=>{if(b){xt();try{b()}finally{St()}}const p=ln;ln=c;try{return l?l(t,3,[y]):t(y)}finally{ln=p}}:f=wt,e&&i){const p=f,h=i===!0?1/0:i;f=()=>Lt(p(),h)}const U=cm(),D=()=>{c.stop(),U&&U.active&&Js(U.effects,c)};if(s&&e){const p=e;e=(...h)=>{p(...h),D()}}let I=A?new Array(t.length).fill(wi):wi;const g=p=>{if(!(!(c.flags&1)||!c.dirty&&!p))if(e){const h=c.run();if(i||v||(A?h.some((x,P)=>Xe(x,I[P])):Xe(h,I))){b&&b();const x=ln;ln=c;try{const P=[h,I===wi?void 0:A&&I[0]===wi?[]:I,y];I=h,l?l(e,3,P):e(...P)}finally{ln=x}}}else c.run()};return a&&a(g),c=new ec(f),c.scheduler=o?()=>o(g,!1):g,y=p=>jm(p,!1,c),b=c.onStop=()=>{const p=xi.get(c);if(p){if(l)l(p,4);else for(const h of p)h();xi.delete(c)}},e?r?g(!0):I=c.run():o?o(g.bind(null,!0),!0):c.run(),D.pause=c.pause.bind(c),D.resume=c.resume.bind(c),D.stop=D,D}function Lt(t,e=1/0,n){if(e<=0||!Se(t)||t.__v_skip||(n=n||new Map,(n.get(t)||0)>=e))return t;if(n.set(t,e),e--,Ne(t))Lt(t.value,e,n);else if(se(t))for(let r=0;r<t.length;r++)Lt(t[r],e,n);else if(Wl(t)||xn(t))t.forEach(r=>{Lt(r,e,n)});else if(Kl(t)){for(const r in t)Lt(t[r],e,n);for(const r of Object.getOwnPropertySymbols(t))Object.prototype.propertyIsEnumerable.call(t,r)&&Lt(t[r],e,n)}return t}/**
|
|
97
|
-
* @vue/runtime-core v3.5.
|
|
96
|
+
**/let et;class fm{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.parent=et,!e&&et&&(this.index=(et.scopes||(et.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,n;if(this.scopes)for(e=0,n=this.scopes.length;e<n;e++)this.scopes[e].pause();for(e=0,n=this.effects.length;e<n;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,n;if(this.scopes)for(e=0,n=this.scopes.length;e<n;e++)this.scopes[e].resume();for(e=0,n=this.effects.length;e<n;e++)this.effects[e].resume()}}run(e){if(this._active){const n=et;try{return et=this,e()}finally{et=n}}}on(){++this._on===1&&(this.prevScope=et,et=this)}off(){this._on>0&&--this._on===0&&(et=this.prevScope,this.prevScope=void 0)}stop(e){if(this._active){this._active=!1;let n,r;for(n=0,r=this.effects.length;n<r;n++)this.effects[n].stop();for(this.effects.length=0,n=0,r=this.cleanups.length;n<r;n++)this.cleanups[n]();if(this.cleanups.length=0,this.scopes){for(n=0,r=this.scopes.length;n<r;n++)this.scopes[n].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){const i=this.parent.scopes.pop();i&&i!==this&&(this.parent.scopes[this.index]=i,i.index=this.index)}this.parent=void 0}}}function dm(){return et}let we;const ro=new WeakSet;class rc{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,et&&et.active&&et.effects.push(this)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,ro.has(this)&&(ro.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||sc(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,uc(this),oc(this);const e=we,n=yt;we=this,yt=!0;try{return this.fn()}finally{ac(this),we=e,yt=n,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)ao(e);this.deps=this.depsTail=void 0,uc(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?ro.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){oo(this)&&this.run()}get dirty(){return oo(this)}}let ic=0,ir,sr;function sc(t,e=!1){if(t.flags|=8,e){t.next=sr,sr=t;return}t.next=ir,ir=t}function io(){ic++}function so(){if(--ic>0)return;if(sr){let e=sr;for(sr=void 0;e;){const n=e.next;e.next=void 0,e.flags&=-9,e=n}}let t;for(;ir;){let e=ir;for(ir=void 0;e;){const n=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(r){t||(t=r)}e=n}}if(t)throw t}function oc(t){for(let e=t.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function ac(t){let e,n=t.depsTail,r=n;for(;r;){const i=r.prevDep;r.version===-1?(r===n&&(n=i),ao(r),hm(r)):e=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=i}t.deps=e,t.depsTail=n}function oo(t){for(let e=t.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(lc(e.dep.computed)||e.dep.version!==e.version))return!0;return!!t._dirty}function lc(t){if(t.flags&4&&!(t.flags&16)||(t.flags&=-17,t.globalVersion===or)||(t.globalVersion=or,!t.isSSR&&t.flags&128&&(!t.deps&&!t._dirty||!oo(t))))return;t.flags|=2;const e=t.dep,n=we,r=yt;we=t,yt=!0;try{oc(t);const i=t.fn(t._value);(e.version===0||Ze(i,t._value))&&(t.flags|=128,t._value=i,e.version++)}catch(i){throw e.version++,i}finally{we=n,yt=r,ac(t),t.flags&=-3}}function ao(t,e=!1){const{dep:n,prevSub:r,nextSub:i}=t;if(r&&(r.nextSub=i,t.prevSub=void 0),i&&(i.prevSub=r,t.nextSub=void 0),n.subs===t&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let s=n.computed.deps;s;s=s.nextDep)ao(s,!0)}!e&&!--n.sc&&n.map&&n.map.delete(n.key)}function hm(t){const{prevDep:e,nextDep:n}=t;e&&(e.nextDep=n,t.prevDep=void 0),n&&(n.prevDep=e,t.nextDep=void 0)}let yt=!0;const cc=[];function St(){cc.push(yt),yt=!1}function Et(){const t=cc.pop();yt=t===void 0?!0:t}function uc(t){const{cleanup:e}=t;if(t.cleanup=void 0,e){const n=we;we=void 0;try{e()}finally{we=n}}}let or=0;class pm{constructor(e,n){this.sub=e,this.dep=n,this.version=n.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class mi{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!we||!yt||we===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==we)n=this.activeLink=new pm(we,this),we.deps?(n.prevDep=we.depsTail,we.depsTail.nextDep=n,we.depsTail=n):we.deps=we.depsTail=n,fc(n);else if(n.version===-1&&(n.version=this.version,n.nextDep)){const r=n.nextDep;r.prevDep=n.prevDep,n.prevDep&&(n.prevDep.nextDep=r),n.prevDep=we.depsTail,n.nextDep=void 0,we.depsTail.nextDep=n,we.depsTail=n,we.deps===n&&(we.deps=r)}return n}trigger(e){this.version++,or++,this.notify(e)}notify(e){io();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{so()}}}function fc(t){if(t.dep.sc++,t.sub.flags&4){const e=t.dep.computed;if(e&&!t.dep.subs){e.flags|=20;for(let r=e.deps;r;r=r.nextDep)fc(r)}const n=t.dep.subs;n!==t&&(t.prevSub=n,n&&(n.nextSub=t)),t.dep.subs=t}}const lo=new WeakMap,ln=Symbol(""),co=Symbol(""),ar=Symbol("");function qe(t,e,n){if(yt&&we){let r=lo.get(t);r||lo.set(t,r=new Map);let i=r.get(n);i||(r.set(n,i=new mi),i.map=r,i.key=n),i.track()}}function Dt(t,e,n,r,i,s){const o=lo.get(t);if(!o){or++;return}const a=l=>{l&&l.trigger()};if(io(),e==="clear")o.forEach(a);else{const l=se(t),u=l&&Xs(n);if(l&&n==="length"){const c=Number(r);o.forEach((f,b)=>{(b==="length"||b===ar||!Vt(b)&&b>=c)&&a(f)})}else switch((n!==void 0||o.has(void 0))&&a(o.get(n)),u&&a(o.get(ar)),e){case"add":l?u&&a(o.get("length")):(a(o.get(ln)),Sn(t)&&a(o.get(co)));break;case"delete":l||(a(o.get(ln)),Sn(t)&&a(o.get(co)));break;case"set":Sn(t)&&a(o.get(ln));break}}so()}function En(t){const e=fe(t);return e===t?e:(qe(e,"iterate",ar),ft(t)?e:e.map(je))}function gi(t){return qe(t=fe(t),"iterate",ar),t}const mm={__proto__:null,[Symbol.iterator](){return uo(this,Symbol.iterator,je)},concat(...t){return En(this).concat(...t.map(e=>se(e)?En(e):e))},entries(){return uo(this,"entries",t=>(t[1]=je(t[1]),t))},every(t,e){return Lt(this,"every",t,e,void 0,arguments)},filter(t,e){return Lt(this,"filter",t,e,n=>n.map(je),arguments)},find(t,e){return Lt(this,"find",t,e,je,arguments)},findIndex(t,e){return Lt(this,"findIndex",t,e,void 0,arguments)},findLast(t,e){return Lt(this,"findLast",t,e,je,arguments)},findLastIndex(t,e){return Lt(this,"findLastIndex",t,e,void 0,arguments)},forEach(t,e){return Lt(this,"forEach",t,e,void 0,arguments)},includes(...t){return fo(this,"includes",t)},indexOf(...t){return fo(this,"indexOf",t)},join(t){return En(this).join(t)},lastIndexOf(...t){return fo(this,"lastIndexOf",t)},map(t,e){return Lt(this,"map",t,e,void 0,arguments)},pop(){return lr(this,"pop")},push(...t){return lr(this,"push",t)},reduce(t,...e){return dc(this,"reduce",t,e)},reduceRight(t,...e){return dc(this,"reduceRight",t,e)},shift(){return lr(this,"shift")},some(t,e){return Lt(this,"some",t,e,void 0,arguments)},splice(...t){return lr(this,"splice",t)},toReversed(){return En(this).toReversed()},toSorted(t){return En(this).toSorted(t)},toSpliced(...t){return En(this).toSpliced(...t)},unshift(...t){return lr(this,"unshift",t)},values(){return uo(this,"values",je)}};function uo(t,e,n){const r=gi(t),i=r[e]();return r!==t&&!ft(t)&&(i._next=i.next,i.next=()=>{const s=i._next();return s.done||(s.value=n(s.value)),s}),i}const gm=Array.prototype;function Lt(t,e,n,r,i,s){const o=gi(t),a=o!==t&&!ft(t),l=o[e];if(l!==gm[e]){const f=l.apply(t,s);return a?je(f):f}let u=n;o!==t&&(a?u=function(f,b){return n.call(this,je(f),b,t)}:n.length>2&&(u=function(f,b){return n.call(this,f,b,t)}));const c=l.call(o,u,r);return a&&i?i(c):c}function dc(t,e,n,r){const i=gi(t);let s=n;return i!==t&&(ft(t)?n.length>3&&(s=function(o,a,l){return n.call(this,o,a,l,t)}):s=function(o,a,l){return n.call(this,o,je(a),l,t)}),i[e](s,...r)}function fo(t,e,n){const r=fe(t);qe(r,"iterate",ar);const i=r[e](...n);return(i===-1||i===!1)&&go(n[0])?(n[0]=fe(n[0]),r[e](...n)):i}function lr(t,e,n=[]){St(),io();const r=fe(t)[e].apply(t,n);return so(),Et(),r}const ym=Gs("__proto__,__v_isRef,__isVue"),hc=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(Vt));function vm(t){Vt(t)||(t=String(t));const e=fe(this);return qe(e,"has",t),e.hasOwnProperty(t)}class pc{constructor(e=!1,n=!1){this._isReadonly=e,this._isShallow=n}get(e,n,r){if(n==="__v_skip")return e.__v_skip;const i=this._isReadonly,s=this._isShallow;if(n==="__v_isReactive")return!i;if(n==="__v_isReadonly")return i;if(n==="__v_isShallow")return s;if(n==="__v_raw")return r===(i?s?_c:bc:s?vc:yc).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(r)?e:void 0;const o=se(e);if(!i){let l;if(o&&(l=mm[n]))return l;if(n==="hasOwnProperty")return vm}const a=Reflect.get(e,n,Ne(e)?e:r);if((Vt(n)?hc.has(n):ym(n))||(i||qe(e,"get",n),s))return a;if(Ne(a)){const l=o&&Xs(n)?a:a.value;return i&&xe(l)?mo(l):l}return xe(a)?i?mo(a):po(a):a}}class mc extends pc{constructor(e=!1){super(!1,e)}set(e,n,r,i){let s=e[n];if(!this._isShallow){const l=Yt(s);if(!ft(r)&&!Yt(r)&&(s=fe(s),r=fe(r)),!se(e)&&Ne(s)&&!Ne(r))return l||(s.value=r),!0}const o=se(e)&&Xs(n)?Number(n)<e.length:pe(e,n),a=Reflect.set(e,n,r,Ne(e)?e:i);return e===fe(i)&&(o?Ze(r,s)&&Dt(e,"set",n,r):Dt(e,"add",n,r)),a}deleteProperty(e,n){const r=pe(e,n);e[n];const i=Reflect.deleteProperty(e,n);return i&&r&&Dt(e,"delete",n,void 0),i}has(e,n){const r=Reflect.has(e,n);return(!Vt(n)||!hc.has(n))&&qe(e,"has",n),r}ownKeys(e){return qe(e,"iterate",se(e)?"length":ln),Reflect.ownKeys(e)}}class gc extends pc{constructor(e=!1){super(!0,e)}set(e,n){return!0}deleteProperty(e,n){return!0}}const bm=new mc,_m=new gc,wm=new mc(!0),xm=new gc(!0),ho=t=>t,yi=t=>Reflect.getPrototypeOf(t);function Sm(t,e,n){return function(...r){const i=this.__v_raw,s=fe(i),o=Sn(s),a=t==="entries"||t===Symbol.iterator&&o,l=t==="keys"&&o,u=i[t](...r),c=n?ho:e?wi:je;return!e&&qe(s,"iterate",l?co:ln),{next(){const{value:f,done:b}=u.next();return b?{value:f,done:b}:{value:a?[c(f[0]),c(f[1])]:c(f),done:b}},[Symbol.iterator](){return this}}}}function vi(t){return function(...e){return t==="delete"?!1:t==="clear"?void 0:this}}function Em(t,e){const n={get(i){const s=this.__v_raw,o=fe(s),a=fe(i);t||(Ze(i,a)&&qe(o,"get",i),qe(o,"get",a));const{has:l}=yi(o),u=e?ho:t?wi:je;if(l.call(o,i))return u(s.get(i));if(l.call(o,a))return u(s.get(a));s!==o&&s.get(i)},get size(){const i=this.__v_raw;return!t&&qe(fe(i),"iterate",ln),i.size},has(i){const s=this.__v_raw,o=fe(s),a=fe(i);return t||(Ze(i,a)&&qe(o,"has",i),qe(o,"has",a)),i===a?s.has(i):s.has(i)||s.has(a)},forEach(i,s){const o=this,a=o.__v_raw,l=fe(a),u=e?ho:t?wi:je;return!t&&qe(l,"iterate",ln),a.forEach((c,f)=>i.call(s,u(c),u(f),o))}};return Le(n,t?{add:vi("add"),set:vi("set"),delete:vi("delete"),clear:vi("clear")}:{add(i){!e&&!ft(i)&&!Yt(i)&&(i=fe(i));const s=fe(this);return yi(s).has.call(s,i)||(s.add(i),Dt(s,"add",i,i)),this},set(i,s){!e&&!ft(s)&&!Yt(s)&&(s=fe(s));const o=fe(this),{has:a,get:l}=yi(o);let u=a.call(o,i);u||(i=fe(i),u=a.call(o,i));const c=l.call(o,i);return o.set(i,s),u?Ze(s,c)&&Dt(o,"set",i,s):Dt(o,"add",i,s),this},delete(i){const s=fe(this),{has:o,get:a}=yi(s);let l=o.call(s,i);l||(i=fe(i),l=o.call(s,i)),a&&a.call(s,i);const u=s.delete(i);return l&&Dt(s,"delete",i,void 0),u},clear(){const i=fe(this),s=i.size!==0,o=i.clear();return s&&Dt(i,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(i=>{n[i]=Sm(i,t,e)}),n}function bi(t,e){const n=Em(t,e);return(r,i,s)=>i==="__v_isReactive"?!t:i==="__v_isReadonly"?t:i==="__v_raw"?r:Reflect.get(pe(n,i)&&i in r?n:r,i,s)}const $m={get:bi(!1,!1)},km={get:bi(!1,!0)},Cm={get:bi(!0,!1)},Om={get:bi(!0,!0)},yc=new WeakMap,vc=new WeakMap,bc=new WeakMap,_c=new WeakMap;function Pm(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Am(t){return t.__v_skip||!Object.isExtensible(t)?0:Pm(nm(t))}function po(t){return Yt(t)?t:_i(t,!1,bm,$m,yc)}function Im(t){return _i(t,!1,wm,km,vc)}function mo(t){return _i(t,!0,_m,Cm,bc)}function Gv(t){return _i(t,!0,xm,Om,_c)}function _i(t,e,n,r,i){if(!xe(t)||t.__v_raw&&!(e&&t.__v_isReactive))return t;const s=Am(t);if(s===0)return t;const o=i.get(t);if(o)return o;const a=new Proxy(t,s===2?r:n);return i.set(t,a),a}function $n(t){return Yt(t)?$n(t.__v_raw):!!(t&&t.__v_isReactive)}function Yt(t){return!!(t&&t.__v_isReadonly)}function ft(t){return!!(t&&t.__v_isShallow)}function go(t){return t?!!t.__v_raw:!1}function fe(t){const e=t&&t.__v_raw;return e?fe(e):t}function Tm(t){return!pe(t,"__v_skip")&&Object.isExtensible(t)&&Xl(t,"__v_skip",!0),t}const je=t=>xe(t)?po(t):t,wi=t=>xe(t)?mo(t):t;function Ne(t){return t?t.__v_isRef===!0:!1}function xi(t){return wc(t,!1)}function Rm(t){return wc(t,!0)}function wc(t,e){return Ne(t)?t:new Nm(t,e)}class Nm{constructor(e,n){this.dep=new mi,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?e:fe(e),this._value=n?e:je(e),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(e){const n=this._rawValue,r=this.__v_isShallow||ft(e)||Yt(e);e=r?e:fe(e),Ze(e,n)&&(this._rawValue=e,this._value=r?e:je(e),this.dep.trigger())}}function xc(t){return Ne(t)?t.value:t}const Dm={get:(t,e,n)=>e==="__v_raw"?t:xc(Reflect.get(t,e,n)),set:(t,e,n,r)=>{const i=t[e];return Ne(i)&&!Ne(n)?(i.value=n,!0):Reflect.set(t,e,n,r)}};function Sc(t){return $n(t)?t:new Proxy(t,Dm)}class Lm{constructor(e){this.__v_isRef=!0,this._value=void 0;const n=this.dep=new mi,{get:r,set:i}=e(n.track.bind(n),n.trigger.bind(n));this._get=r,this._set=i}get value(){return this._value=this._get()}set value(e){this._set(e)}}function jm(t){return new Lm(t)}class Mm{constructor(e,n,r){this.fn=e,this.setter=n,this._value=void 0,this.dep=new mi(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=or-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&we!==this)return sc(this,!0),!0}get value(){const e=this.dep.track();return lc(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function Fm(t,e,n=!1){let r,i;return oe(t)?r=t:(r=t.get,i=t.set),new Mm(r,i,n)}const Si={},Ei=new WeakMap;let cn;function Bm(t,e=!1,n=cn){if(n){let r=Ei.get(n);r||Ei.set(n,r=[]),r.push(t)}}function Um(t,e,n=de){const{immediate:r,deep:i,once:s,scheduler:o,augmentJob:a,call:l}=n,u=p=>i?p:ft(p)||i===!1||i===0?jt(p,1):jt(p);let c,f,b,y,v=!1,A=!1;if(Ne(t)?(f=()=>t.value,v=ft(t)):$n(t)?(f=()=>u(t),v=!0):se(t)?(A=!0,v=t.some(p=>$n(p)||ft(p)),f=()=>t.map(p=>{if(Ne(p))return p.value;if($n(p))return u(p);if(oe(p))return l?l(p,2):p()})):oe(t)?e?f=l?()=>l(t,2):t:f=()=>{if(b){St();try{b()}finally{Et()}}const p=cn;cn=c;try{return l?l(t,3,[y]):t(y)}finally{cn=p}}:f=xt,e&&i){const p=f,h=i===!0?1/0:i;f=()=>jt(p(),h)}const U=dm(),D=()=>{c.stop(),U&&U.active&&Qs(U.effects,c)};if(s&&e){const p=e;e=(...h)=>{p(...h),D()}}let I=A?new Array(t.length).fill(Si):Si;const g=p=>{if(!(!(c.flags&1)||!c.dirty&&!p))if(e){const h=c.run();if(i||v||(A?h.some((x,P)=>Ze(x,I[P])):Ze(h,I))){b&&b();const x=cn;cn=c;try{const P=[h,I===Si?void 0:A&&I[0]===Si?[]:I,y];I=h,l?l(e,3,P):e(...P)}finally{cn=x}}}else c.run()};return a&&a(g),c=new rc(f),c.scheduler=o?()=>o(g,!1):g,y=p=>Bm(p,!1,c),b=c.onStop=()=>{const p=Ei.get(c);if(p){if(l)l(p,4);else for(const h of p)h();Ei.delete(c)}},e?r?g(!0):I=c.run():o?o(g.bind(null,!0),!0):c.run(),D.pause=c.pause.bind(c),D.resume=c.resume.bind(c),D.stop=D,D}function jt(t,e=1/0,n){if(e<=0||!xe(t)||t.__v_skip||(n=n||new Map,(n.get(t)||0)>=e))return t;if(n.set(t,e),e--,Ne(t))jt(t.value,e,n);else if(se(t))for(let r=0;r<t.length;r++)jt(t[r],e,n);else if(Kl(t)||Sn(t))t.forEach(r=>{jt(r,e,n)});else if(Jl(t)){for(const r in t)jt(t[r],e,n);for(const r of Object.getOwnPropertySymbols(t))Object.prototype.propertyIsEnumerable.call(t,r)&&jt(t[r],e,n)}return t}/**
|
|
97
|
+
* @vue/runtime-core v3.5.22
|
|
98
98
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
99
99
|
* @license MIT
|
|
100
|
-
**/const
|
|
100
|
+
**/const cr=[];let yo=!1;function Jv(t,...e){if(yo)return;yo=!0,St();const n=cr.length?cr[cr.length-1].component:null,r=n&&n.appContext.config.warnHandler,i=Hm();if(r)kn(r,n,11,[t+e.map(s=>{var o,a;return(a=(o=s.toString)==null?void 0:o.call(s))!=null?a:JSON.stringify(s)}).join(""),n&&n.proxy,i.map(({vnode:s})=>`at <${xu(n,s.type)}>`).join(`
|
|
101
101
|
`),i]);else{const s=[`[Vue warn]: ${t}`,...e];i.length&&s.push(`
|
|
102
|
-
`,...
|
|
103
|
-
`],...Um(n))}),e}function Um({vnode:t,recurseCount:e}){const n=e>0?`... (${e} recursive calls)`:"",r=t.component?t.component.parent==null:!1,i=` at <${_u(t.component,t.type,r)}`,s=">"+n;return t.props?[i,...Hm(t.props),s]:[i+s]}function Hm(t){const e=[],n=Object.keys(t);return n.slice(0,3).forEach(r=>{e.push(...xc(r,t[r]))}),n.length>3&&e.push(" ..."),e}function xc(t,e,n){return ke(e)?(e=JSON.stringify(e),n?e:[`${t}=${e}`]):typeof e=="number"||typeof e=="boolean"||e==null?n?e:[`${t}=${e}`]:Ne(e)?(e=xc(t,fe(e.value),!0),n?e:[`${t}=Ref<`,e,">"]):oe(e)?[`${t}=fn${e.name?`<${e.name}>`:""}`]:(e=fe(e),n?e:[`${t}=`,e])}function $n(t,e,n,r){try{return r?t(...r):t()}catch(i){Si(i,e,n)}}function Et(t,e,n,r){if(oe(t)){const i=$n(t,e,n,r);return i&&zl(i)&&i.catch(s=>{Si(s,e,n)}),i}if(se(t)){const i=[];for(let s=0;s<t.length;s++)i.push(Et(t[s],e,n,r));return i}}function Si(t,e,n,r=!0){const i=e?e.vnode:null,{errorHandler:s,throwUnhandledErrorInProduction:o}=e&&e.appContext.config||de;if(e){let a=e.parent;const l=e.proxy,u=`https://vuejs.org/error-reference/#runtime-${n}`;for(;a;){const c=a.ec;if(c){for(let f=0;f<c.length;f++)if(c[f](t,l,u)===!1)return}a=a.parent}if(s){xt(),$n(s,null,10,[t,l,u]),St();return}}qm(t,n,i,r,o)}function qm(t,e,n,r=!0,i=!1){if(i)throw t}const We=[];let $t=-1;const kn=[];let Yt=null,Cn=0;const Sc=Promise.resolve();let Ei=null;function $i(t){const e=Ei||Sc;return t?e.then(this?t.bind(this):t):e}function Wm(t){let e=$t+1,n=We.length;for(;e<n;){const r=e+n>>>1,i=We[r],s=cr(i);s<t||s===t&&i.flags&2?e=r+1:n=r}return e}function go(t){if(!(t.flags&1)){const e=cr(t),n=We[We.length-1];!n||!(t.flags&2)&&e>=cr(n)?We.push(t):We.splice(Wm(e),0,t),t.flags|=1,Ec()}}function Ec(){Ei||(Ei=Sc.then(Cc))}function zm(t){se(t)?kn.push(...t):Yt&&t.id===-1?Yt.splice(Cn+1,0,t):t.flags&1||(kn.push(t),t.flags|=1),Ec()}function $c(t,e,n=$t+1){for(;n<We.length;n++){const r=We[n];if(r&&r.flags&2){if(t&&r.id!==t.uid)continue;We.splice(n,1),n--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function kc(t){if(kn.length){const e=[...new Set(kn)].sort((n,r)=>cr(n)-cr(r));if(kn.length=0,Yt){Yt.push(...e);return}for(Yt=e,Cn=0;Cn<Yt.length;Cn++){const n=Yt[Cn];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}Yt=null,Cn=0}}const cr=t=>t.id==null?t.flags&2?-1:1/0:t.id;function Cc(t){try{for($t=0;$t<We.length;$t++){const e=We[$t];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),$n(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;$t<We.length;$t++){const e=We[$t];e&&(e.flags&=-2)}$t=-1,We.length=0,kc(),Ei=null,(We.length||kn.length)&&Cc()}}let ut=null,Oc=null;function ki(t){const e=ut;return ut=t,Oc=t&&t.type.__scopeId||null,e}function Vm(t,e=ut,n){if(!e||t._n)return t;const r=(...i)=>{r._d&&fu(-1);const s=ki(e);let o;try{o=t(...i)}finally{ki(s),r._d&&fu(1)}return o};return r._n=!0,r._c=!0,r._d=!0,r}function Km(t,e){if(ut===null)return t;const n=Li(ut),r=t.dirs||(t.dirs=[]);for(let i=0;i<e.length;i++){let[s,o,a,l=de]=e[i];s&&(oe(s)&&(s={mounted:s,updated:s}),s.deep&&Lt(o),r.push({dir:s,instance:n,value:o,oldValue:void 0,arg:a,modifiers:l}))}return t}function cn(t,e,n,r){const i=t.dirs,s=e&&e.dirs;for(let o=0;o<i.length;o++){const a=i[o];s&&(a.oldValue=s[o].value);let l=a.dir[r];l&&(xt(),Et(l,n,8,[t.el,a,t,e]),St())}}const Ym=Symbol("_vte"),Gm=t=>t.__isTeleport,Jm=Symbol("_leaveCb");function yo(t,e){t.shapeFlag&6&&t.component?(t.transition=e,yo(t.component.subTree,e)):t.shapeFlag&128?(t.ssContent.transition=e.clone(t.ssContent),t.ssFallback.transition=e.clone(t.ssFallback)):t.transition=e}function Pc(t,e){return oe(t)?Le({name:t.name},e,{setup:t}):t}function Ac(t){t.ids=[t.ids[0]+t.ids[2]+++"-",0,0]}function Qm(t){const e=Po(),n=Am(null);if(e){const i=e.refs===de?e.refs={}:e.refs;Object.defineProperty(i,t,{enumerable:!0,get:()=>n.value,set:s=>n.value=s})}return n}const Ci=new WeakMap;function ur(t,e,n,r,i=!1){if(se(t)){t.forEach((v,A)=>ur(v,e&&(se(e)?e[A]:e),n,r,i));return}if(fr(r)&&!i){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&ur(t,e,n,r.component.subTree);return}const s=r.shapeFlag&4?Li(r.component):r.el,o=i?null:s,{i:a,r:l}=t,u=e&&e.r,c=a.refs===de?a.refs={}:a.refs,f=a.setupState,b=fe(f),y=f===de?ql:v=>pe(b,v);if(u!=null&&u!==l){if(Ic(e),ke(u))c[u]=null,y(u)&&(f[u]=null);else if(Ne(u)){u.value=null;const v=e;v.k&&(c[v.k]=null)}}if(oe(l))$n(l,a,12,[o,c]);else{const v=ke(l),A=Ne(l);if(v||A){const U=()=>{if(t.f){const D=v?y(l)?f[l]:c[l]:l.value;if(i)se(D)&&Js(D,s);else if(se(D))D.includes(s)||D.push(s);else if(v)c[l]=[s],y(l)&&(f[l]=c[l]);else{const I=[s];l.value=I,t.k&&(c[t.k]=I)}}else v?(c[l]=o,y(l)&&(f[l]=o)):A&&(l.value=o,t.k&&(c[t.k]=o))};if(o){const D=()=>{U(),Ci.delete(t)};D.id=-1,Ci.set(t,D),nt(D,n)}else Ic(t),U()}}}function Ic(t){const e=Ci.get(t);e&&(e.flags|=8,Ci.delete(t))}ui().requestIdleCallback,ui().cancelIdleCallback;const fr=t=>!!t.type.__asyncLoader,Tc=t=>t.type.__isKeepAlive;function Xm(t,e){Rc(t,"a",e)}function Zm(t,e){Rc(t,"da",e)}function Rc(t,e,n=Ve){const r=t.__wdc||(t.__wdc=()=>{let i=n;for(;i;){if(i.isDeactivated)return;i=i.parent}return t()});if(Oi(e,r,n),n){let i=n.parent;for(;i&&i.parent;)Tc(i.parent.vnode)&&eg(r,e,n,i),i=i.parent}}function eg(t,e,n,r){const i=Oi(e,t,r,!0);Lc(()=>{Js(r[e],i)},n)}function Oi(t,e,n=Ve,r=!1){if(n){const i=n[t]||(n[t]=[]),s=e.__weh||(e.__weh=(...o)=>{xt();const a=_r(n),l=Et(e,n,t,o);return a(),St(),l});return r?i.unshift(s):i.push(s),s}}const jt=t=>(e,n=Ve)=>{(!wr||t==="sp")&&Oi(t,(...r)=>e(...r),n)},Nc=jt("bm"),vo=jt("m"),tg=jt("bu"),ng=jt("u"),Dc=jt("bum"),Lc=jt("um"),rg=jt("sp"),ig=jt("rtg"),sg=jt("rtc");function og(t,e=Ve){Oi("ec",t,e)}const ag=Symbol.for("v-ndc");function jc(t,e,n,r){let i;const s=n,o=se(t);if(o||ke(t)){const a=o&&En(t);let l=!1,u=!1;a&&(l=!ct(t),u=Kt(t),t=pi(t)),i=new Array(t.length);for(let c=0,f=t.length;c<f;c++)i[c]=e(l?u?bi(je(t[c])):je(t[c]):t[c],c,void 0,s)}else if(typeof t=="number"){i=new Array(t);for(let a=0;a<t;a++)i[a]=e(a+1,a,void 0,s)}else if(Se(t))if(t[Symbol.iterator])i=Array.from(t,(a,l)=>e(a,l,void 0,s));else{const a=Object.keys(t);i=new Array(a.length);for(let l=0,u=a.length;l<u;l++){const c=a[l];i[l]=e(t[c],c,l,s)}}else i=[];return i}const bo=t=>t?yu(t)?Li(t):bo(t.parent):null,dr=Le(Object.create(null),{$:t=>t,$el:t=>t.vnode.el,$data:t=>t.data,$props:t=>t.props,$attrs:t=>t.attrs,$slots:t=>t.slots,$refs:t=>t.refs,$parent:t=>bo(t.parent),$root:t=>bo(t.root),$host:t=>t.ce,$emit:t=>t.emit,$options:t=>Uc(t),$forceUpdate:t=>t.f||(t.f=()=>{go(t.update)}),$nextTick:t=>t.n||(t.n=$i.bind(t.proxy)),$watch:t=>Ag.bind(t)}),_o=(t,e)=>t!==de&&!t.__isScriptSetup&&pe(t,e),lg={get({_:t},e){if(e==="__v_skip")return!0;const{ctx:n,setupState:r,data:i,props:s,accessCache:o,type:a,appContext:l}=t;let u;if(e[0]!=="$"){const y=o[e];if(y!==void 0)switch(y){case 1:return r[e];case 2:return i[e];case 4:return n[e];case 3:return s[e]}else{if(_o(r,e))return o[e]=1,r[e];if(i!==de&&pe(i,e))return o[e]=2,i[e];if((u=t.propsOptions[0])&&pe(u,e))return o[e]=3,s[e];if(n!==de&&pe(n,e))return o[e]=4,n[e];wo&&(o[e]=0)}}const c=dr[e];let f,b;if(c)return e==="$attrs"&&He(t.attrs,"get",""),c(t);if((f=a.__cssModules)&&(f=f[e]))return f;if(n!==de&&pe(n,e))return o[e]=4,n[e];if(b=l.config.globalProperties,pe(b,e))return b[e]},set({_:t},e,n){const{data:r,setupState:i,ctx:s}=t;return _o(i,e)?(i[e]=n,!0):r!==de&&pe(r,e)?(r[e]=n,!0):pe(t.props,e)||e[0]==="$"&&e.slice(1)in t?!1:(s[e]=n,!0)},has({_:{data:t,setupState:e,accessCache:n,ctx:r,appContext:i,propsOptions:s,type:o}},a){let l,u;return!!(n[a]||t!==de&&a[0]!=="$"&&pe(t,a)||_o(e,a)||(l=s[0])&&pe(l,a)||pe(r,a)||pe(dr,a)||pe(i.config.globalProperties,a)||(u=o.__cssModules)&&u[a])},defineProperty(t,e,n){return n.get!=null?t._.accessCache[e]=0:pe(n,"value")&&this.set(t,e,n.value,null),Reflect.defineProperty(t,e,n)}};function Pi(t){return se(t)?t.reduce((e,n)=>(e[n]=null,e),{}):t}function Mc(t,e){return!t||!e?t||e:se(t)&&se(e)?t.concat(e):Le({},Pi(t),Pi(e))}let wo=!0;function cg(t){const e=Uc(t),n=t.proxy,r=t.ctx;wo=!1,e.beforeCreate&&Fc(e.beforeCreate,t,"bc");const{data:i,computed:s,methods:o,watch:a,provide:l,inject:u,created:c,beforeMount:f,mounted:b,beforeUpdate:y,updated:v,activated:A,deactivated:U,beforeDestroy:D,beforeUnmount:I,destroyed:g,unmounted:p,render:h,renderTracked:x,renderTriggered:P,errorCaptured:R,serverPrefetch:W,expose:X,inheritAttrs:Ce,components:Te,directives:et,filters:Bt}=e;if(u&&ug(u,r,null),o)for(const me in o){const ve=o[me];oe(ve)&&(r[me]=ve.bind(n))}if(i){const me=i.call(n,n);Se(me)&&(t.data=ho(me))}if(wo=!0,s)for(const me in s){const ve=s[me],Ut=oe(ve)?ve.bind(n,n):oe(ve.get)?ve.get.bind(n,n):wt,Bn=!oe(ve)&&oe(ve.set)?ve.set.bind(n):wt,Me=wu({get:Ut,set:Bn});Object.defineProperty(r,me,{enumerable:!0,configurable:!0,get:()=>Me.value,set:st=>Me.value=st})}if(a)for(const me in a)Bc(a[me],r,n,me);if(l){const me=oe(l)?l.call(n):l;Reflect.ownKeys(me).forEach(ve=>{zc(ve,me[ve])})}c&&Fc(c,t,"c");function Re(me,ve){se(ve)?ve.forEach(Ut=>me(Ut.bind(n))):ve&&me(ve.bind(n))}if(Re(Nc,f),Re(vo,b),Re(tg,y),Re(ng,v),Re(Xm,A),Re(Zm,U),Re(og,R),Re(sg,x),Re(ig,P),Re(Dc,I),Re(Lc,p),Re(rg,W),se(X))if(X.length){const me=t.exposed||(t.exposed={});X.forEach(ve=>{Object.defineProperty(me,ve,{get:()=>n[ve],set:Ut=>n[ve]=Ut,enumerable:!0})})}else t.exposed||(t.exposed={});h&&t.render===wt&&(t.render=h),Ce!=null&&(t.inheritAttrs=Ce),Te&&(t.components=Te),et&&(t.directives=et),W&&Ac(t)}function ug(t,e,n=wt){se(t)&&(t=xo(t));for(const r in t){const i=t[r];let s;Se(i)?"default"in i?s=pr(i.from||r,i.default,!0):s=pr(i.from||r):s=pr(i),Ne(s)?Object.defineProperty(e,r,{enumerable:!0,configurable:!0,get:()=>s.value,set:o=>s.value=o}):e[r]=s}}function Fc(t,e,n){Et(se(t)?t.map(r=>r.bind(e.proxy)):t.bind(e.proxy),e,n)}function Bc(t,e,n,r){let i=r.includes(".")?iu(n,r):()=>n[r];if(ke(t)){const s=e[t];oe(s)&&mr(i,s)}else if(oe(t))mr(i,t.bind(n));else if(Se(t))if(se(t))t.forEach(s=>Bc(s,e,n,r));else{const s=oe(t.handler)?t.handler.bind(n):e[t.handler];oe(s)&&mr(i,s,t)}}function Uc(t){const e=t.type,{mixins:n,extends:r}=e,{mixins:i,optionsCache:s,config:{optionMergeStrategies:o}}=t.appContext,a=s.get(e);let l;return a?l=a:!i.length&&!n&&!r?l=e:(l={},i.length&&i.forEach(u=>Ai(l,u,o,!0)),Ai(l,e,o)),Se(e)&&s.set(e,l),l}function Ai(t,e,n,r=!1){const{mixins:i,extends:s}=e;s&&Ai(t,s,n,!0),i&&i.forEach(o=>Ai(t,o,n,!0));for(const o in e)if(!(r&&o==="expose")){const a=fg[o]||n&&n[o];t[o]=a?a(t[o],e[o]):e[o]}return t}const fg={data:Hc,props:qc,emits:qc,methods:hr,computed:hr,beforeCreate:ze,created:ze,beforeMount:ze,mounted:ze,beforeUpdate:ze,updated:ze,beforeDestroy:ze,beforeUnmount:ze,destroyed:ze,unmounted:ze,activated:ze,deactivated:ze,errorCaptured:ze,serverPrefetch:ze,components:hr,directives:hr,watch:hg,provide:Hc,inject:dg};function Hc(t,e){return e?t?function(){return Le(oe(t)?t.call(this,this):t,oe(e)?e.call(this,this):e)}:e:t}function dg(t,e){return hr(xo(t),xo(e))}function xo(t){if(se(t)){const e={};for(let n=0;n<t.length;n++)e[t[n]]=t[n];return e}return t}function ze(t,e){return t?[...new Set([].concat(t,e))]:e}function hr(t,e){return t?Le(Object.create(null),t,e):e}function qc(t,e){return t?se(t)&&se(e)?[...new Set([...t,...e])]:Le(Object.create(null),Pi(t),Pi(e??{})):e}function hg(t,e){if(!t)return e;if(!e)return t;const n=Le(Object.create(null),t);for(const r in e)n[r]=ze(t[r],e[r]);return n}function Wc(){return{app:null,config:{isNativeTag:ql,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let pg=0;function mg(t,e){return function(r,i=null){oe(r)||(r=Le({},r)),i!=null&&!Se(i)&&(i=null);const s=Wc(),o=new WeakSet,a=[];let l=!1;const u=s.app={_uid:pg++,_component:r,_props:i,_container:null,_context:s,_instance:null,version:ey,get config(){return s.config},set config(c){},use(c,...f){return o.has(c)||(c&&oe(c.install)?(o.add(c),c.install(u,...f)):oe(c)&&(o.add(c),c(u,...f))),u},mixin(c){return s.mixins.includes(c)||s.mixins.push(c),u},component(c,f){return f?(s.components[c]=f,u):s.components[c]},directive(c,f){return f?(s.directives[c]=f,u):s.directives[c]},mount(c,f,b){if(!l){const y=u._ceVNode||Gt(r,i);return y.appContext=s,b===!0?b="svg":b===!1&&(b=void 0),t(y,c,b),l=!0,u._container=c,c.__vue_app__=u,Li(y.component)}},onUnmount(c){a.push(c)},unmount(){l&&(Et(a,u._instance,16),t(null,u._container),delete u._container.__vue_app__)},provide(c,f){return s.provides[c]=f,u},runWithContext(c){const f=On;On=u;try{return c()}finally{On=f}}};return u}}let On=null;function zc(t,e){if(Ve){let n=Ve.provides;const r=Ve.parent&&Ve.parent.provides;r===n&&(n=Ve.provides=Object.create(r)),n[t]=e}}function pr(t,e,n=!1){const r=Po();if(r||On){let i=On?On._context.provides:r?r.parent==null||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(i&&t in i)return i[t];if(arguments.length>1)return n&&oe(e)?e.call(r&&r.proxy):e}}const Vc={},Kc=()=>Object.create(Vc),Yc=t=>Object.getPrototypeOf(t)===Vc;function gg(t,e,n,r=!1){const i={},s=Kc();t.propsDefaults=Object.create(null),Gc(t,e,i,s);for(const o in t.propsOptions[0])o in i||(i[o]=void 0);n?t.props=r?i:Om(i):t.type.props?t.props=i:t.props=s,t.attrs=s}function yg(t,e,n,r){const{props:i,attrs:s,vnode:{patchFlag:o}}=t,a=fe(i),[l]=t.propsOptions;let u=!1;if((r||o>0)&&!(o&16)){if(o&8){const c=t.vnode.dynamicProps;for(let f=0;f<c.length;f++){let b=c[f];if(Ti(t.emitsOptions,b))continue;const y=e[b];if(l)if(pe(s,b))y!==s[b]&&(s[b]=y,u=!0);else{const v=Rt(b);i[v]=So(l,a,v,y,t,!1)}else y!==s[b]&&(s[b]=y,u=!0)}}}else{Gc(t,e,i,s)&&(u=!0);let c;for(const f in a)(!e||!pe(e,f)&&((c=Vt(f))===f||!pe(e,c)))&&(l?n&&(n[f]!==void 0||n[c]!==void 0)&&(i[f]=So(l,a,f,void 0,t,!0)):delete i[f]);if(s!==a)for(const f in s)(!e||!pe(e,f))&&(delete s[f],u=!0)}u&&Nt(t.attrs,"set","")}function Gc(t,e,n,r){const[i,s]=t.propsOptions;let o=!1,a;if(e)for(let l in e){if(nr(l))continue;const u=e[l];let c;i&&pe(i,c=Rt(l))?!s||!s.includes(c)?n[c]=u:(a||(a={}))[c]=u:Ti(t.emitsOptions,l)||(!(l in r)||u!==r[l])&&(r[l]=u,o=!0)}if(s){const l=fe(n),u=a||de;for(let c=0;c<s.length;c++){const f=s[c];n[f]=So(i,l,f,u[f],t,!pe(u,f))}}return o}function So(t,e,n,r,i,s){const o=t[n];if(o!=null){const a=pe(o,"default");if(a&&r===void 0){const l=o.default;if(o.type!==Function&&!o.skipFactory&&oe(l)){const{propsDefaults:u}=i;if(n in u)r=u[n];else{const c=_r(i);r=u[n]=l.call(null,e),c()}}else r=l;i.ce&&i.ce._setProp(n,r)}o[0]&&(s&&!a?r=!1:o[1]&&(r===""||r===Vt(n))&&(r=!0))}return r}const vg=new WeakMap;function Jc(t,e,n=!1){const r=n?vg:e.propsCache,i=r.get(t);if(i)return i;const s=t.props,o={},a=[];let l=!1;if(!oe(t)){const c=f=>{l=!0;const[b,y]=Jc(f,e,!0);Le(o,b),y&&a.push(...y)};!n&&e.mixins.length&&e.mixins.forEach(c),t.extends&&c(t.extends),t.mixins&&t.mixins.forEach(c)}if(!s&&!l)return Se(t)&&r.set(t,wn),wn;if(se(s))for(let c=0;c<s.length;c++){const f=Rt(s[c]);Qc(f)&&(o[f]=de)}else if(s)for(const c in s){const f=Rt(c);if(Qc(f)){const b=s[c],y=o[f]=se(b)||oe(b)?{type:b}:Le({},b),v=y.type;let A=!1,U=!0;if(se(v))for(let D=0;D<v.length;++D){const I=v[D],g=oe(I)&&I.name;if(g==="Boolean"){A=!0;break}else g==="String"&&(U=!1)}else A=oe(v)&&v.name==="Boolean";y[0]=A,y[1]=U,(A||pe(y,"default"))&&a.push(f)}}const u=[o,a];return Se(t)&&r.set(t,u),u}function Qc(t){return t[0]!=="$"&&!nr(t)}const Eo=t=>t==="_"||t==="_ctx"||t==="$stable",$o=t=>se(t)?t.map(kt):[kt(t)],bg=(t,e,n)=>{if(e._n)return e;const r=Vm((...i)=>$o(e(...i)),n);return r._c=!1,r},Xc=(t,e,n)=>{const r=t._ctx;for(const i in t){if(Eo(i))continue;const s=t[i];if(oe(s))e[i]=bg(i,s,r);else if(s!=null){const o=$o(s);e[i]=()=>o}}},Zc=(t,e)=>{const n=$o(e);t.slots.default=()=>n},eu=(t,e,n)=>{for(const r in e)(n||!Eo(r))&&(t[r]=e[r])},_g=(t,e,n)=>{const r=t.slots=Kc();if(t.vnode.shapeFlag&32){const i=e._;i?(eu(r,e,n),n&&Gl(r,"_",i,!0)):Xc(e,r)}else e&&Zc(t,e)},wg=(t,e,n)=>{const{vnode:r,slots:i}=t;let s=!0,o=de;if(r.shapeFlag&32){const a=e._;a?n&&a===1?s=!1:eu(i,e,n):(s=!e.$stable,Xc(e,i)),o=e}else e&&(Zc(t,e),o={default:1});if(s)for(const a in i)!Eo(a)&&o[a]==null&&delete i[a]},nt=jg;function xg(t){return Sg(t)}function Sg(t,e){const n=ui();n.__VUE__=!0;const{insert:r,remove:i,patchProp:s,createElement:o,createText:a,createComment:l,setText:u,setElementText:c,parentNode:f,nextSibling:b,setScopeId:y=wt,insertStaticContent:v}=t,A=(_,E,T,L=null,j=null,M=null,G=void 0,K=null,z=!!E.dynamicChildren)=>{if(_===E)return;_&&!br(_,E)&&(L=Un(_),st(_,j,M,!0),_=null),E.patchFlag===-2&&(z=!1,E.dynamicChildren=null);const{type:B,ref:ee,shapeFlag:J}=E;switch(B){case Ri:U(_,E,T,L);break;case Pn:D(_,E,T,L);break;case Co:_==null&&I(E,T,L,G);break;case gt:Te(_,E,T,L,j,M,G,K,z);break;default:J&1?h(_,E,T,L,j,M,G,K,z):J&6?et(_,E,T,L,j,M,G,K,z):(J&64||J&128)&&B.process(_,E,T,L,j,M,G,K,z,gn)}ee!=null&&j?ur(ee,_&&_.ref,M,E||_,!E):ee==null&&_&&_.ref!=null&&ur(_.ref,null,M,_,!0)},U=(_,E,T,L)=>{if(_==null)r(E.el=a(E.children),T,L);else{const j=E.el=_.el;E.children!==_.children&&u(j,E.children)}},D=(_,E,T,L)=>{_==null?r(E.el=l(E.children||""),T,L):E.el=_.el},I=(_,E,T,L)=>{[_.el,_.anchor]=v(_.children,E,T,L,_.el,_.anchor)},g=({el:_,anchor:E},T,L)=>{let j;for(;_&&_!==E;)j=b(_),r(_,T,L),_=j;r(E,T,L)},p=({el:_,anchor:E})=>{let T;for(;_&&_!==E;)T=b(_),i(_),_=T;i(E)},h=(_,E,T,L,j,M,G,K,z)=>{E.type==="svg"?G="svg":E.type==="math"&&(G="mathml"),_==null?x(E,T,L,j,M,G,K,z):W(_,E,j,M,G,K,z)},x=(_,E,T,L,j,M,G,K)=>{let z,B;const{props:ee,shapeFlag:J,transition:Z,dirs:re}=_;if(z=_.el=o(_.type,M,ee&&ee.is,ee),J&8?c(z,_.children):J&16&&R(_.children,z,null,L,j,ko(_,M),G,K),re&&cn(_,null,L,"created"),P(z,_,_.scopeId,G,L),ee){for(const be in ee)be!=="value"&&!nr(be)&&s(z,be,null,ee[be],M,L);"value"in ee&&s(z,"value",null,ee.value,M),(B=ee.onVnodeBeforeMount)&&Ct(B,L,_)}re&&cn(_,null,L,"beforeMount");const ce=Eg(j,Z);ce&&Z.beforeEnter(z),r(z,E,T),((B=ee&&ee.onVnodeMounted)||ce||re)&&nt(()=>{B&&Ct(B,L,_),ce&&Z.enter(z),re&&cn(_,null,L,"mounted")},j)},P=(_,E,T,L,j)=>{if(T&&y(_,T),L)for(let M=0;M<L.length;M++)y(_,L[M]);if(j){let M=j.subTree;if(E===M||uu(M.type)&&(M.ssContent===E||M.ssFallback===E)){const G=j.vnode;P(_,G,G.scopeId,G.slotScopeIds,j.parent)}}},R=(_,E,T,L,j,M,G,K,z=0)=>{for(let B=z;B<_.length;B++){const ee=_[B]=K?Jt(_[B]):kt(_[B]);A(null,ee,E,T,L,j,M,G,K)}},W=(_,E,T,L,j,M,G)=>{const K=E.el=_.el;let{patchFlag:z,dynamicChildren:B,dirs:ee}=E;z|=_.patchFlag&16;const J=_.props||de,Z=E.props||de;let re;if(T&&un(T,!1),(re=Z.onVnodeBeforeUpdate)&&Ct(re,T,E,_),ee&&cn(E,_,T,"beforeUpdate"),T&&un(T,!0),(J.innerHTML&&Z.innerHTML==null||J.textContent&&Z.textContent==null)&&c(K,""),B?X(_.dynamicChildren,B,K,T,L,ko(E,j),M):G||ve(_,E,K,null,T,L,ko(E,j),M,!1),z>0){if(z&16)Ce(K,J,Z,T,j);else if(z&2&&J.class!==Z.class&&s(K,"class",null,Z.class,j),z&4&&s(K,"style",J.style,Z.style,j),z&8){const ce=E.dynamicProps;for(let be=0;be<ce.length;be++){const he=ce[be],Fe=J[he],Be=Z[he];(Be!==Fe||he==="value")&&s(K,he,Fe,Be,j,T)}}z&1&&_.children!==E.children&&c(K,E.children)}else!G&&B==null&&Ce(K,J,Z,T,j);((re=Z.onVnodeUpdated)||ee)&&nt(()=>{re&&Ct(re,T,E,_),ee&&cn(E,_,T,"updated")},L)},X=(_,E,T,L,j,M,G)=>{for(let K=0;K<E.length;K++){const z=_[K],B=E[K],ee=z.el&&(z.type===gt||!br(z,B)||z.shapeFlag&198)?f(z.el):T;A(z,B,ee,null,L,j,M,G,!0)}},Ce=(_,E,T,L,j)=>{if(E!==T){if(E!==de)for(const M in E)!nr(M)&&!(M in T)&&s(_,M,E[M],null,j,L);for(const M in T){if(nr(M))continue;const G=T[M],K=E[M];G!==K&&M!=="value"&&s(_,M,K,G,j,L)}"value"in T&&s(_,"value",E.value,T.value,j)}},Te=(_,E,T,L,j,M,G,K,z)=>{const B=E.el=_?_.el:a(""),ee=E.anchor=_?_.anchor:a("");let{patchFlag:J,dynamicChildren:Z,slotScopeIds:re}=E;re&&(K=K?K.concat(re):re),_==null?(r(B,T,L),r(ee,T,L),R(E.children||[],T,ee,j,M,G,K,z)):J>0&&J&64&&Z&&_.dynamicChildren?(X(_.dynamicChildren,Z,T,j,M,G,K),(E.key!=null||j&&E===j.subTree)&&tu(_,E,!0)):ve(_,E,T,ee,j,M,G,K,z)},et=(_,E,T,L,j,M,G,K,z)=>{E.slotScopeIds=K,_==null?E.shapeFlag&512?j.ctx.activate(E,T,L,G,z):Bt(E,T,L,j,M,G,z):pn(_,E,z)},Bt=(_,E,T,L,j,M,G)=>{const K=_.component=zg(_,L,j);if(Tc(_)&&(K.ctx.renderer=gn),Vg(K,!1,G),K.asyncDep){if(j&&j.registerDep(K,Re,G),!_.el){const z=K.subTree=Gt(Pn);D(null,z,E,T),_.placeholder=z.el}}else Re(K,_,E,T,j,M,G)},pn=(_,E,T)=>{const L=E.component=_.component;if(Dg(_,E,T))if(L.asyncDep&&!L.asyncResolved){me(L,E,T);return}else L.next=E,L.update();else E.el=_.el,L.vnode=E},Re=(_,E,T,L,j,M,G)=>{const K=()=>{if(_.isMounted){let{next:J,bu:Z,u:re,parent:ce,vnode:be}=_;{const at=nu(_);if(at){J&&(J.el=be.el,me(_,J,G)),at.asyncDep.then(()=>{_.isUnmounted||K()});return}}let he=J,Fe;un(_,!1),J?(J.el=be.el,me(_,J,G)):J=be,Z&&Zs(Z),(Fe=J.props&&J.props.onVnodeBeforeUpdate)&&Ct(Fe,ce,J,be),un(_,!0);const Be=lu(_),ot=_.subTree;_.subTree=Be,A(ot,Be,f(ot.el),Un(ot),_,j,M),J.el=Be.el,he===null&&Lg(_,Be.el),re&&nt(re,j),(Fe=J.props&&J.props.onVnodeUpdated)&&nt(()=>Ct(Fe,ce,J,be),j)}else{let J;const{el:Z,props:re}=E,{bm:ce,m:be,parent:he,root:Fe,type:Be}=_,ot=fr(E);un(_,!1),ce&&Zs(ce),!ot&&(J=re&&re.onVnodeBeforeMount)&&Ct(J,he,E),un(_,!0);{Fe.ce&&Fe.ce._def.shadowRoot!==!1&&Fe.ce._injectChildStyle(Be);const at=_.subTree=lu(_);A(null,at,T,L,_,j,M),E.el=at.el}if(be&&nt(be,j),!ot&&(J=re&&re.onVnodeMounted)){const at=E;nt(()=>Ct(J,he,at),j)}(E.shapeFlag&256||he&&fr(he.vnode)&&he.vnode.shapeFlag&256)&&_.a&&nt(_.a,j),_.isMounted=!0,E=T=L=null}};_.scope.on();const z=_.effect=new ec(K);_.scope.off();const B=_.update=z.run.bind(z),ee=_.job=z.runIfDirty.bind(z);ee.i=_,ee.id=_.uid,z.scheduler=()=>go(ee),un(_,!0),B()},me=(_,E,T)=>{E.component=_;const L=_.vnode.props;_.vnode=E,_.next=null,yg(_,E.props,L,T),wg(_,E.children,T),xt(),$c(_),St()},ve=(_,E,T,L,j,M,G,K,z=!1)=>{const B=_&&_.children,ee=_?_.shapeFlag:0,J=E.children,{patchFlag:Z,shapeFlag:re}=E;if(Z>0){if(Z&128){Bn(B,J,T,L,j,M,G,K,z);return}else if(Z&256){Ut(B,J,T,L,j,M,G,K,z);return}}re&8?(ee&16&&mn(B,j,M),J!==B&&c(T,J)):ee&16?re&16?Bn(B,J,T,L,j,M,G,K,z):mn(B,j,M,!0):(ee&8&&c(T,""),re&16&&R(J,T,L,j,M,G,K,z))},Ut=(_,E,T,L,j,M,G,K,z)=>{_=_||wn,E=E||wn;const B=_.length,ee=E.length,J=Math.min(B,ee);let Z;for(Z=0;Z<J;Z++){const re=E[Z]=z?Jt(E[Z]):kt(E[Z]);A(_[Z],re,T,null,j,M,G,K,z)}B>ee?mn(_,j,M,!0,!1,J):R(E,T,L,j,M,G,K,z,J)},Bn=(_,E,T,L,j,M,G,K,z)=>{let B=0;const ee=E.length;let J=_.length-1,Z=ee-1;for(;B<=J&&B<=Z;){const re=_[B],ce=E[B]=z?Jt(E[B]):kt(E[B]);if(br(re,ce))A(re,ce,T,null,j,M,G,K,z);else break;B++}for(;B<=J&&B<=Z;){const re=_[J],ce=E[Z]=z?Jt(E[Z]):kt(E[Z]);if(br(re,ce))A(re,ce,T,null,j,M,G,K,z);else break;J--,Z--}if(B>J){if(B<=Z){const re=Z+1,ce=re<ee?E[re].el:L;for(;B<=Z;)A(null,E[B]=z?Jt(E[B]):kt(E[B]),T,ce,j,M,G,K,z),B++}}else if(B>Z)for(;B<=J;)st(_[B],j,M,!0),B++;else{const re=B,ce=B,be=new Map;for(B=ce;B<=Z;B++){const Ke=E[B]=z?Jt(E[B]):kt(E[B]);Ke.key!=null&&be.set(Ke.key,B)}let he,Fe=0;const Be=Z-ce+1;let ot=!1,at=0;const Xt=new Array(Be);for(B=0;B<Be;B++)Xt[B]=0;for(B=re;B<=J;B++){const Ke=_[B];if(Fe>=Be){st(Ke,j,M,!0);continue}let ht;if(Ke.key!=null)ht=be.get(Ke.key);else for(he=ce;he<=Z;he++)if(Xt[he-ce]===0&&br(Ke,E[he])){ht=he;break}ht===void 0?st(Ke,j,M,!0):(Xt[ht-ce]=B+1,ht>=at?at=ht:ot=!0,A(Ke,E[ht],T,null,j,M,G,K,z),Fe++)}const Hn=ot?$g(Xt):wn;for(he=Hn.length-1,B=Be-1;B>=0;B--){const Ke=ce+B,ht=E[Ke],qn=E[Ke+1],Or=Ke+1<ee?qn.el||qn.placeholder:L;Xt[B]===0?A(null,ht,T,Or,j,M,G,K,z):ot&&(he<0||B!==Hn[he]?Me(ht,T,Or,2):he--)}}},Me=(_,E,T,L,j=null)=>{const{el:M,type:G,transition:K,children:z,shapeFlag:B}=_;if(B&6){Me(_.component.subTree,E,T,L);return}if(B&128){_.suspense.move(E,T,L);return}if(B&64){G.move(_,E,T,gn);return}if(G===gt){r(M,E,T);for(let J=0;J<z.length;J++)Me(z[J],E,T,L);r(_.anchor,E,T);return}if(G===Co){g(_,E,T);return}if(L!==2&&B&1&&K)if(L===0)K.beforeEnter(M),r(M,E,T),nt(()=>K.enter(M),j);else{const{leave:J,delayLeave:Z,afterLeave:re}=K,ce=()=>{_.ctx.isUnmounted?i(M):r(M,E,T)},be=()=>{M._isLeaving&&M[Jm](!0),J(M,()=>{ce(),re&&re()})};Z?Z(M,ce,be):be()}else r(M,E,T)},st=(_,E,T,L=!1,j=!1)=>{const{type:M,props:G,ref:K,children:z,dynamicChildren:B,shapeFlag:ee,patchFlag:J,dirs:Z,cacheIndex:re}=_;if(J===-2&&(j=!1),K!=null&&(xt(),ur(K,null,T,_,!0),St()),re!=null&&(E.renderCache[re]=void 0),ee&256){E.ctx.deactivate(_);return}const ce=ee&1&&Z,be=!fr(_);let he;if(be&&(he=G&&G.onVnodeBeforeUnmount)&&Ct(he,E,_),ee&6)qo(_.component,T,L);else{if(ee&128){_.suspense.unmount(T,L);return}ce&&cn(_,null,E,"beforeUnmount"),ee&64?_.type.remove(_,E,T,gn,L):B&&!B.hasOnce&&(M!==gt||J>0&&J&64)?mn(B,E,T,!1,!0):(M===gt&&J&384||!j&&ee&16)&&mn(z,E,T),L&&Vi(_)}(be&&(he=G&&G.onVnodeUnmounted)||ce)&&nt(()=>{he&&Ct(he,E,_),ce&&cn(_,null,E,"unmounted")},T)},Vi=_=>{const{type:E,el:T,anchor:L,transition:j}=_;if(E===gt){Ho(T,L);return}if(E===Co){p(_);return}const M=()=>{i(T),j&&!j.persisted&&j.afterLeave&&j.afterLeave()};if(_.shapeFlag&1&&j&&!j.persisted){const{leave:G,delayLeave:K}=j,z=()=>G(T,M);K?K(_.el,M,z):z()}else M()},Ho=(_,E)=>{let T;for(;_!==E;)T=b(_),i(_),_=T;i(E)},qo=(_,E,T)=>{const{bum:L,scope:j,job:M,subTree:G,um:K,m:z,a:B}=_;ru(z),ru(B),L&&Zs(L),j.stop(),M&&(M.flags|=8,st(G,_,E,T)),K&&nt(K,E),nt(()=>{_.isUnmounted=!0},E)},mn=(_,E,T,L=!1,j=!1,M=0)=>{for(let G=M;G<_.length;G++)st(_[G],E,T,L,j)},Un=_=>{if(_.shapeFlag&6)return Un(_.component.subTree);if(_.shapeFlag&128)return _.suspense.next();const E=b(_.anchor||_.el),T=E&&E[Ym];return T?b(T):E};let Cr=!1;const Ki=(_,E,T)=>{_==null?E._vnode&&st(E._vnode,null,null,!0):A(E._vnode||null,_,E,null,null,null,T),E._vnode=_,Cr||(Cr=!0,$c(),kc(),Cr=!1)},gn={p:A,um:st,m:Me,r:Vi,mt:Bt,mc:R,pc:ve,pbc:X,n:Un,o:t};return{render:Ki,hydrate:void 0,createApp:mg(Ki)}}function ko({type:t,props:e},n){return n==="svg"&&t==="foreignObject"||n==="mathml"&&t==="annotation-xml"&&e&&e.encoding&&e.encoding.includes("html")?void 0:n}function un({effect:t,job:e},n){n?(t.flags|=32,e.flags|=4):(t.flags&=-33,e.flags&=-5)}function Eg(t,e){return(!t||t&&!t.pendingBranch)&&e&&!e.persisted}function tu(t,e,n=!1){const r=t.children,i=e.children;if(se(r)&&se(i))for(let s=0;s<r.length;s++){const o=r[s];let a=i[s];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=i[s]=Jt(i[s]),a.el=o.el),!n&&a.patchFlag!==-2&&tu(o,a)),a.type===Ri&&a.patchFlag!==-1&&(a.el=o.el),a.type===Pn&&!a.el&&(a.el=o.el)}}function $g(t){const e=t.slice(),n=[0];let r,i,s,o,a;const l=t.length;for(r=0;r<l;r++){const u=t[r];if(u!==0){if(i=n[n.length-1],t[i]<u){e[r]=i,n.push(r);continue}for(s=0,o=n.length-1;s<o;)a=s+o>>1,t[n[a]]<u?s=a+1:o=a;u<t[n[s]]&&(s>0&&(e[r]=n[s-1]),n[s]=r)}}for(s=n.length,o=n[s-1];s-- >0;)n[s]=o,o=e[o];return n}function nu(t){const e=t.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:nu(e)}function ru(t){if(t)for(let e=0;e<t.length;e++)t[e].flags|=8}const kg=Symbol.for("v-scx"),Cg=()=>pr(kg);function Og(t,e){return Ii(t,null,e)}function Pg(t,e){return Ii(t,null,{flush:"sync"})}function mr(t,e,n){return Ii(t,e,n)}function Ii(t,e,n=de){const{immediate:r,deep:i,flush:s,once:o}=n,a=Le({},n),l=e&&r||!e&&s!=="post";let u;if(wr){if(s==="sync"){const y=Cg();u=y.__watcherHandles||(y.__watcherHandles=[])}else if(!l){const y=()=>{};return y.stop=wt,y.resume=wt,y.pause=wt,y}}const c=Ve;a.call=(y,v,A)=>Et(y,c,v,A);let f=!1;s==="post"?a.scheduler=y=>{nt(y,c&&c.suspense)}:s!=="sync"&&(f=!0,a.scheduler=(y,v)=>{v?y():go(y)}),a.augmentJob=y=>{e&&(y.flags|=4),f&&(y.flags|=2,c&&(y.id=c.uid,y.i=c))};const b=Mm(t,e,a);return wr&&(u?u.push(b):l&&b()),b}function Ag(t,e,n){const r=this.proxy,i=ke(t)?t.includes(".")?iu(r,t):()=>r[t]:t.bind(r,r);let s;oe(e)?s=e:(s=e.handler,n=e);const o=_r(this),a=Ii(i,s.bind(r),n);return o(),a}function iu(t,e){const n=e.split(".");return()=>{let r=t;for(let i=0;i<n.length&&r;i++)r=r[n[i]];return r}}function su(t,e,n=de){const r=Po(),i=Rt(e),s=Vt(e),o=ou(t,i),a=Nm((l,u)=>{let c,f=de,b;return Pg(()=>{const y=t[i];Xe(c,y)&&(c=y,u())}),{get(){return l(),n.get?n.get(c):c},set(y){const v=n.set?n.set(y):y;if(!Xe(v,c)&&!(f!==de&&Xe(y,f)))return;const A=r.vnode.props;A&&(e in A||i in A||s in A)&&(`onUpdate:${e}`in A||`onUpdate:${i}`in A||`onUpdate:${s}`in A)||(c=y,u()),r.emit(`update:${e}`,v),Xe(y,v)&&Xe(y,f)&&!Xe(v,b)&&u(),f=y,b=v}}});return a[Symbol.iterator]=()=>{let l=0;return{next(){return l<2?{value:l++?o||de:a,done:!1}:{done:!0}}}},a}const ou=(t,e)=>e==="modelValue"||e==="model-value"?t.modelModifiers:t[`${e}Modifiers`]||t[`${Rt(e)}Modifiers`]||t[`${Vt(e)}Modifiers`];function Ig(t,e,...n){if(t.isUnmounted)return;const r=t.vnode.props||de;let i=n;const s=e.startsWith("update:"),o=s&&ou(r,e.slice(7));o&&(o.trim&&(i=n.map(c=>ke(c)?c.trim():c)),o.number&&(i=n.map(nm)));let a,l=r[a=Xs(e)]||r[a=Xs(Rt(e))];!l&&s&&(l=r[a=Xs(Vt(e))]),l&&Et(l,t,6,i);const u=r[a+"Once"];if(u){if(!t.emitted)t.emitted={};else if(t.emitted[a])return;t.emitted[a]=!0,Et(u,t,6,i)}}const Tg=new WeakMap;function au(t,e,n=!1){const r=n?Tg:e.emitsCache,i=r.get(t);if(i!==void 0)return i;const s=t.emits;let o={},a=!1;if(!oe(t)){const l=u=>{const c=au(u,e,!0);c&&(a=!0,Le(o,c))};!n&&e.mixins.length&&e.mixins.forEach(l),t.extends&&l(t.extends),t.mixins&&t.mixins.forEach(l)}return!s&&!a?(Se(t)&&r.set(t,null),null):(se(s)?s.forEach(l=>o[l]=null):Le(o,s),Se(t)&&r.set(t,o),o)}function Ti(t,e){return!t||!ai(e)?!1:(e=e.slice(2).replace(/Once$/,""),pe(t,e[0].toLowerCase()+e.slice(1))||pe(t,Vt(e))||pe(t,e))}function Yv(){}function lu(t){const{type:e,vnode:n,proxy:r,withProxy:i,propsOptions:[s],slots:o,attrs:a,emit:l,render:u,renderCache:c,props:f,data:b,setupState:y,ctx:v,inheritAttrs:A}=t,U=ki(t);let D,I;try{if(n.shapeFlag&4){const p=i||r,h=p;D=kt(u.call(h,p,c,f,y,b,v)),I=a}else{const p=e;D=kt(p.length>1?p(f,{attrs:a,slots:o,emit:l}):p(f,null)),I=e.props?a:Rg(a)}}catch(p){gr.length=0,Si(p,t,1),D=Gt(Pn)}let g=D;if(I&&A!==!1){const p=Object.keys(I),{shapeFlag:h}=g;p.length&&h&7&&(s&&p.some(Gs)&&(I=Ng(I,s)),g=In(g,I,!1,!0))}return n.dirs&&(g=In(g,null,!1,!0),g.dirs=g.dirs?g.dirs.concat(n.dirs):n.dirs),n.transition&&yo(g,n.transition),D=g,ki(U),D}const Rg=t=>{let e;for(const n in t)(n==="class"||n==="style"||ai(n))&&((e||(e={}))[n]=t[n]);return e},Ng=(t,e)=>{const n={};for(const r in t)(!Gs(r)||!(r.slice(9)in e))&&(n[r]=t[r]);return n};function Dg(t,e,n){const{props:r,children:i,component:s}=t,{props:o,children:a,patchFlag:l}=e,u=s.emitsOptions;if(e.dirs||e.transition)return!0;if(n&&l>=0){if(l&1024)return!0;if(l&16)return r?cu(r,o,u):!!o;if(l&8){const c=e.dynamicProps;for(let f=0;f<c.length;f++){const b=c[f];if(o[b]!==r[b]&&!Ti(u,b))return!0}}}else return(i||a)&&(!a||!a.$stable)?!0:r===o?!1:r?o?cu(r,o,u):!0:!!o;return!1}function cu(t,e,n){const r=Object.keys(e);if(r.length!==Object.keys(t).length)return!0;for(let i=0;i<r.length;i++){const s=r[i];if(e[s]!==t[s]&&!Ti(n,s))return!0}return!1}function Lg({vnode:t,parent:e},n){for(;e;){const r=e.subTree;if(r.suspense&&r.suspense.activeBranch===t&&(r.el=t.el),r===t)(t=e.vnode).el=n,e=e.parent;else break}}const uu=t=>t.__isSuspense;function jg(t,e){e&&e.pendingBranch?se(t)?e.effects.push(...t):e.effects.push(t):zm(t)}const gt=Symbol.for("v-fgt"),Ri=Symbol.for("v-txt"),Pn=Symbol.for("v-cmt"),Co=Symbol.for("v-stc"),gr=[];let rt=null;function An(t=!1){gr.push(rt=t?null:[])}function Mg(){gr.pop(),rt=gr[gr.length-1]||null}let yr=1;function fu(t,e=!1){yr+=t,t<0&&rt&&e&&(rt.hasOnce=!0)}function du(t){return t.dynamicChildren=yr>0?rt||wn:null,Mg(),yr>0&&rt&&rt.push(t),t}function vr(t,e,n,r,i,s){return du(Mt(t,e,n,r,i,s,!0))}function Fg(t,e,n,r,i){return du(Gt(t,e,n,r,i,!0))}function hu(t){return t?t.__v_isVNode===!0:!1}function br(t,e){return t.type===e.type&&t.key===e.key}const pu=({key:t})=>t??null,Ni=({ref:t,ref_key:e,ref_for:n})=>(typeof t=="number"&&(t=""+t),t!=null?ke(t)||Ne(t)||oe(t)?{i:ut,r:t,k:e,f:!!n}:t:null);function Mt(t,e=null,n=null,r=0,i=null,s=t===gt?0:1,o=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&pu(e),ref:e&&Ni(e),scopeId:Oc,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:s,patchFlag:r,dynamicProps:i,dynamicChildren:null,appContext:null,ctx:ut};return a?(Oo(l,n),s&128&&t.normalize(l)):n&&(l.shapeFlag|=ke(n)?8:16),yr>0&&!o&&rt&&(l.patchFlag>0||s&6)&&l.patchFlag!==32&&rt.push(l),l}const Gt=Bg;function Bg(t,e=null,n=null,r=0,i=null,s=!1){if((!t||t===ag)&&(t=Pn),hu(t)){const a=In(t,e,!0);return n&&Oo(a,n),yr>0&&!s&&rt&&(a.shapeFlag&6?rt[rt.indexOf(t)]=a:rt.push(a)),a.patchFlag=-2,a}if(Zg(t)&&(t=t.__vccOpts),e){e=Ug(e);let{class:a,style:l}=e;a&&!ke(a)&&(e.class=fi(a)),Se(l)&&(po(l)&&!se(l)&&(l=Le({},l)),e.style=eo(l))}const o=ke(t)?1:uu(t)?128:Gm(t)?64:Se(t)?4:oe(t)?2:0;return Mt(t,e,n,r,i,o,s,!0)}function Ug(t){return t?po(t)||Yc(t)?Le({},t):t:null}function In(t,e,n=!1,r=!1){const{props:i,ref:s,patchFlag:o,children:a,transition:l}=t,u=e?mu(i||{},e):i,c={__v_isVNode:!0,__v_skip:!0,type:t.type,props:u,key:u&&pu(u),ref:e&&e.ref?n&&s?se(s)?s.concat(Ni(e)):[s,Ni(e)]:Ni(e):s,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:a,target:t.target,targetStart:t.targetStart,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:e&&t.type!==gt?o===-1?16:o|16:o,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:l,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&In(t.ssContent),ssFallback:t.ssFallback&&In(t.ssFallback),placeholder:t.placeholder,el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce};return l&&r&&yo(c,l.clone(c)),c}function Hg(t=" ",e=0){return Gt(Ri,null,t,e)}function kt(t){return t==null||typeof t=="boolean"?Gt(Pn):se(t)?Gt(gt,null,t.slice()):hu(t)?Jt(t):Gt(Ri,null,String(t))}function Jt(t){return t.el===null&&t.patchFlag!==-1||t.memo?t:In(t)}function Oo(t,e){let n=0;const{shapeFlag:r}=t;if(e==null)e=null;else if(se(e))n=16;else if(typeof e=="object")if(r&65){const i=e.default;i&&(i._c&&(i._d=!1),Oo(t,i()),i._c&&(i._d=!0));return}else{n=32;const i=e._;!i&&!Yc(e)?e._ctx=ut:i===3&&ut&&(ut.slots._===1?e._=1:(e._=2,t.patchFlag|=1024))}else oe(e)?(e={default:e,_ctx:ut},n=32):(e=String(e),r&64?(n=16,e=[Hg(e)]):n=8);t.children=e,t.shapeFlag|=n}function mu(...t){const e={};for(let n=0;n<t.length;n++){const r=t[n];for(const i in r)if(i==="class")e.class!==r.class&&(e.class=fi([e.class,r.class]));else if(i==="style")e.style=eo([e.style,r.style]);else if(ai(i)){const s=e[i],o=r[i];o&&s!==o&&!(se(s)&&s.includes(o))&&(e[i]=s?[].concat(s,o):o)}else i!==""&&(e[i]=r[i])}return e}function Ct(t,e,n,r=null){Et(t,e,7,[n,r])}const qg=Wc();let Wg=0;function zg(t,e,n){const r=t.type,i=(e?e.appContext:t.appContext)||qg,s={uid:Wg++,vnode:t,type:r,parent:e,appContext:i,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new lm(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:e?e.provides:Object.create(i.provides),ids:e?e.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:Jc(r,i),emitsOptions:au(r,i),emit:null,emitted:null,propsDefaults:de,inheritAttrs:r.inheritAttrs,ctx:de,data:de,props:de,attrs:de,slots:de,refs:de,setupState:de,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return s.ctx={_:s},s.root=e?e.root:s,s.emit=Ig.bind(null,s),t.ce&&t.ce(s),s}let Ve=null;const Po=()=>Ve||ut;let Di,Ao;{const t=ui(),e=(n,r)=>{let i;return(i=t[n])||(i=t[n]=[]),i.push(r),s=>{i.length>1?i.forEach(o=>o(s)):i[0](s)}};Di=e("__VUE_INSTANCE_SETTERS__",n=>Ve=n),Ao=e("__VUE_SSR_SETTERS__",n=>wr=n)}const _r=t=>{const e=Ve;return Di(t),t.scope.on(),()=>{t.scope.off(),Di(e)}},gu=()=>{Ve&&Ve.scope.off(),Di(null)};function yu(t){return t.vnode.shapeFlag&4}let wr=!1;function Vg(t,e=!1,n=!1){e&&Ao(e);const{props:r,children:i}=t.vnode,s=yu(t);gg(t,r,s,e),_g(t,i,n||e);const o=s?Kg(t,e):void 0;return e&&Ao(!1),o}function Kg(t,e){const n=t.type;t.accessCache=Object.create(null),t.proxy=new Proxy(t.ctx,lg);const{setup:r}=n;if(r){xt();const i=t.setupContext=r.length>1?Gg(t):null,s=_r(t),o=$n(r,t,0,[t.props,i]),a=zl(o);if(St(),s(),(a||t.sp)&&!fr(t)&&Ac(t),a){if(o.then(gu,gu),e)return o.then(l=>{vu(t,l)}).catch(l=>{Si(l,t,0)});t.asyncDep=o}else vu(t,o)}else bu(t)}function vu(t,e,n){oe(e)?t.type.__ssrInlineRender?t.ssrRender=e:t.render=e:Se(e)&&(t.setupState=wc(e)),bu(t)}function bu(t,e,n){const r=t.type;t.render||(t.render=r.render||wt);{const i=_r(t);xt();try{cg(t)}finally{St(),i()}}}const Yg={get(t,e){return He(t,"get",""),t[e]}};function Gg(t){const e=n=>{t.exposed=n||{}};return{attrs:new Proxy(t.attrs,Yg),slots:t.slots,emit:t.emit,expose:e}}function Li(t){return t.exposed?t.exposeProxy||(t.exposeProxy=new Proxy(wc(Pm(t.exposed)),{get(e,n){if(n in e)return e[n];if(n in dr)return dr[n](t)},has(e,n){return n in e||n in dr}})):t.proxy}const Jg=/(?:^|[-_])\w/g,Qg=t=>t.replace(Jg,e=>e.toUpperCase()).replace(/[-_]/g,"");function Xg(t,e=!0){return oe(t)?t.displayName||t.name:t.name||e&&t.__name}function _u(t,e,n=!1){let r=Xg(e);if(!r&&e.__file){const i=e.__file.match(/([^/\\]+)\.\w+$/);i&&(r=i[1])}if(!r&&t&&t.parent){const i=s=>{for(const o in s)if(s[o]===e)return o};r=i(t.components||t.parent.type.components)||i(t.appContext.components)}return r?Qg(r):n?"App":"Anonymous"}function Zg(t){return oe(t)&&"__vccOpts"in t}const wu=(t,e)=>Lm(t,e,wr),ey="3.5.21";/**
|
|
104
|
-
* @vue/runtime-dom v3.5.
|
|
102
|
+
`,...qm(i))}Et(),yo=!1}function Hm(){let t=cr[cr.length-1];if(!t)return[];const e=[];for(;t;){const n=e[0];n&&n.vnode===t?n.recurseCount++:e.push({vnode:t,recurseCount:0});const r=t.component&&t.component.parent;t=r&&r.vnode}return e}function qm(t){const e=[];return t.forEach((n,r)=>{e.push(...r===0?[]:[`
|
|
103
|
+
`],...Wm(n))}),e}function Wm({vnode:t,recurseCount:e}){const n=e>0?`... (${e} recursive calls)`:"",r=t.component?t.component.parent==null:!1,i=` at <${xu(t.component,t.type,r)}`,s=">"+n;return t.props?[i,...zm(t.props),s]:[i+s]}function zm(t){const e=[],n=Object.keys(t);return n.slice(0,3).forEach(r=>{e.push(...Ec(r,t[r]))}),n.length>3&&e.push(" ..."),e}function Ec(t,e,n){return ke(e)?(e=JSON.stringify(e),n?e:[`${t}=${e}`]):typeof e=="number"||typeof e=="boolean"||e==null?n?e:[`${t}=${e}`]:Ne(e)?(e=Ec(t,fe(e.value),!0),n?e:[`${t}=Ref<`,e,">"]):oe(e)?[`${t}=fn${e.name?`<${e.name}>`:""}`]:(e=fe(e),n?e:[`${t}=`,e])}function kn(t,e,n,r){try{return r?t(...r):t()}catch(i){$i(i,e,n)}}function $t(t,e,n,r){if(oe(t)){const i=kn(t,e,n,r);return i&&Yl(i)&&i.catch(s=>{$i(s,e,n)}),i}if(se(t)){const i=[];for(let s=0;s<t.length;s++)i.push($t(t[s],e,n,r));return i}}function $i(t,e,n,r=!0){const i=e?e.vnode:null,{errorHandler:s,throwUnhandledErrorInProduction:o}=e&&e.appContext.config||de;if(e){let a=e.parent;const l=e.proxy,u=`https://vuejs.org/error-reference/#runtime-${n}`;for(;a;){const c=a.ec;if(c){for(let f=0;f<c.length;f++)if(c[f](t,l,u)===!1)return}a=a.parent}if(s){St(),kn(s,null,10,[t,l,u]),Et();return}}Vm(t,n,i,r,o)}function Vm(t,e,n,r=!0,i=!1){if(i)throw t}const ze=[];let kt=-1;const Cn=[];let Gt=null,On=0;const $c=Promise.resolve();let ki=null;function Ci(t){const e=ki||$c;return t?e.then(this?t.bind(this):t):e}function Km(t){let e=kt+1,n=ze.length;for(;e<n;){const r=e+n>>>1,i=ze[r],s=ur(i);s<t||s===t&&i.flags&2?e=r+1:n=r}return e}function vo(t){if(!(t.flags&1)){const e=ur(t),n=ze[ze.length-1];!n||!(t.flags&2)&&e>=ur(n)?ze.push(t):ze.splice(Km(e),0,t),t.flags|=1,kc()}}function kc(){ki||(ki=$c.then(Pc))}function Ym(t){se(t)?Cn.push(...t):Gt&&t.id===-1?Gt.splice(On+1,0,t):t.flags&1||(Cn.push(t),t.flags|=1),kc()}function Cc(t,e,n=kt+1){for(;n<ze.length;n++){const r=ze[n];if(r&&r.flags&2){if(t&&r.id!==t.uid)continue;ze.splice(n,1),n--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function Oc(t){if(Cn.length){const e=[...new Set(Cn)].sort((n,r)=>ur(n)-ur(r));if(Cn.length=0,Gt){Gt.push(...e);return}for(Gt=e,On=0;On<Gt.length;On++){const n=Gt[On];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}Gt=null,On=0}}const ur=t=>t.id==null?t.flags&2?-1:1/0:t.id;function Pc(t){try{for(kt=0;kt<ze.length;kt++){const e=ze[kt];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),kn(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;kt<ze.length;kt++){const e=ze[kt];e&&(e.flags&=-2)}kt=-1,ze.length=0,Oc(),ki=null,(ze.length||Cn.length)&&Pc()}}let dt=null,Ac=null;function Oi(t){const e=dt;return dt=t,Ac=t&&t.type.__scopeId||null,e}function Gm(t,e=dt,n){if(!e||t._n)return t;const r=(...i)=>{r._d&&hu(-1);const s=Oi(e);let o;try{o=t(...i)}finally{Oi(s),r._d&&hu(1)}return o};return r._n=!0,r._c=!0,r._d=!0,r}function Jm(t,e){if(dt===null)return t;const n=Mi(dt),r=t.dirs||(t.dirs=[]);for(let i=0;i<e.length;i++){let[s,o,a,l=de]=e[i];s&&(oe(s)&&(s={mounted:s,updated:s}),s.deep&&jt(o),r.push({dir:s,instance:n,value:o,oldValue:void 0,arg:a,modifiers:l}))}return t}function un(t,e,n,r){const i=t.dirs,s=e&&e.dirs;for(let o=0;o<i.length;o++){const a=i[o];s&&(a.oldValue=s[o].value);let l=a.dir[r];l&&(St(),$t(l,n,8,[t.el,a,t,e]),Et())}}const Qm=Symbol("_vte"),Xm=t=>t.__isTeleport,Zm=Symbol("_leaveCb");function bo(t,e){t.shapeFlag&6&&t.component?(t.transition=e,bo(t.component.subTree,e)):t.shapeFlag&128?(t.ssContent.transition=e.clone(t.ssContent),t.ssFallback.transition=e.clone(t.ssFallback)):t.transition=e}function Ic(t,e){return oe(t)?Le({name:t.name},e,{setup:t}):t}function Tc(t){t.ids=[t.ids[0]+t.ids[2]+++"-",0,0]}function eg(t){const e=Io(),n=Rm(null);if(e){const i=e.refs===de?e.refs={}:e.refs;Object.defineProperty(i,t,{enumerable:!0,get:()=>n.value,set:s=>n.value=s})}return n}const Pi=new WeakMap;function fr(t,e,n,r,i=!1){if(se(t)){t.forEach((v,A)=>fr(v,e&&(se(e)?e[A]:e),n,r,i));return}if(dr(r)&&!i){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&fr(t,e,n,r.component.subTree);return}const s=r.shapeFlag&4?Mi(r.component):r.el,o=i?null:s,{i:a,r:l}=t,u=e&&e.r,c=a.refs===de?a.refs={}:a.refs,f=a.setupState,b=fe(f),y=f===de?Vl:v=>pe(b,v);if(u!=null&&u!==l){if(Rc(e),ke(u))c[u]=null,y(u)&&(f[u]=null);else if(Ne(u)){u.value=null;const v=e;v.k&&(c[v.k]=null)}}if(oe(l))kn(l,a,12,[o,c]);else{const v=ke(l),A=Ne(l);if(v||A){const U=()=>{if(t.f){const D=v?y(l)?f[l]:c[l]:l.value;if(i)se(D)&&Qs(D,s);else if(se(D))D.includes(s)||D.push(s);else if(v)c[l]=[s],y(l)&&(f[l]=c[l]);else{const I=[s];l.value=I,t.k&&(c[t.k]=I)}}else v?(c[l]=o,y(l)&&(f[l]=o)):A&&(l.value=o,t.k&&(c[t.k]=o))};if(o){const D=()=>{U(),Pi.delete(t)};D.id=-1,Pi.set(t,D),it(D,n)}else Rc(t),U()}}}function Rc(t){const e=Pi.get(t);e&&(e.flags|=8,Pi.delete(t))}di().requestIdleCallback,di().cancelIdleCallback;const dr=t=>!!t.type.__asyncLoader,Nc=t=>t.type.__isKeepAlive;function tg(t,e){Dc(t,"a",e)}function ng(t,e){Dc(t,"da",e)}function Dc(t,e,n=Ke){const r=t.__wdc||(t.__wdc=()=>{let i=n;for(;i;){if(i.isDeactivated)return;i=i.parent}return t()});if(Ai(e,r,n),n){let i=n.parent;for(;i&&i.parent;)Nc(i.parent.vnode)&&rg(r,e,n,i),i=i.parent}}function rg(t,e,n,r){const i=Ai(e,t,r,!0);Mc(()=>{Qs(r[e],i)},n)}function Ai(t,e,n=Ke,r=!1){if(n){const i=n[t]||(n[t]=[]),s=e.__weh||(e.__weh=(...o)=>{St();const a=wr(n),l=$t(e,n,t,o);return a(),Et(),l});return r?i.unshift(s):i.push(s),s}}const Mt=t=>(e,n=Ke)=>{(!xr||t==="sp")&&Ai(t,(...r)=>e(...r),n)},Lc=Mt("bm"),_o=Mt("m"),ig=Mt("bu"),sg=Mt("u"),jc=Mt("bum"),Mc=Mt("um"),og=Mt("sp"),ag=Mt("rtg"),lg=Mt("rtc");function cg(t,e=Ke){Ai("ec",t,e)}const ug=Symbol.for("v-ndc");function Fc(t,e,n,r){let i;const s=n,o=se(t);if(o||ke(t)){const a=o&&$n(t);let l=!1,u=!1;a&&(l=!ft(t),u=Yt(t),t=gi(t)),i=new Array(t.length);for(let c=0,f=t.length;c<f;c++)i[c]=e(l?u?wi(je(t[c])):je(t[c]):t[c],c,void 0,s)}else if(typeof t=="number"){i=new Array(t);for(let a=0;a<t;a++)i[a]=e(a+1,a,void 0,s)}else if(xe(t))if(t[Symbol.iterator])i=Array.from(t,(a,l)=>e(a,l,void 0,s));else{const a=Object.keys(t);i=new Array(a.length);for(let l=0,u=a.length;l<u;l++){const c=a[l];i[l]=e(t[c],c,l,s)}}else i=[];return i}const wo=t=>t?bu(t)?Mi(t):wo(t.parent):null,hr=Le(Object.create(null),{$:t=>t,$el:t=>t.vnode.el,$data:t=>t.data,$props:t=>t.props,$attrs:t=>t.attrs,$slots:t=>t.slots,$refs:t=>t.refs,$parent:t=>wo(t.parent),$root:t=>wo(t.root),$host:t=>t.ce,$emit:t=>t.emit,$options:t=>qc(t),$forceUpdate:t=>t.f||(t.f=()=>{vo(t.update)}),$nextTick:t=>t.n||(t.n=Ci.bind(t.proxy)),$watch:t=>Rg.bind(t)}),xo=(t,e)=>t!==de&&!t.__isScriptSetup&&pe(t,e),fg={get({_:t},e){if(e==="__v_skip")return!0;const{ctx:n,setupState:r,data:i,props:s,accessCache:o,type:a,appContext:l}=t;let u;if(e[0]!=="$"){const y=o[e];if(y!==void 0)switch(y){case 1:return r[e];case 2:return i[e];case 4:return n[e];case 3:return s[e]}else{if(xo(r,e))return o[e]=1,r[e];if(i!==de&&pe(i,e))return o[e]=2,i[e];if((u=t.propsOptions[0])&&pe(u,e))return o[e]=3,s[e];if(n!==de&&pe(n,e))return o[e]=4,n[e];So&&(o[e]=0)}}const c=hr[e];let f,b;if(c)return e==="$attrs"&&qe(t.attrs,"get",""),c(t);if((f=a.__cssModules)&&(f=f[e]))return f;if(n!==de&&pe(n,e))return o[e]=4,n[e];if(b=l.config.globalProperties,pe(b,e))return b[e]},set({_:t},e,n){const{data:r,setupState:i,ctx:s}=t;return xo(i,e)?(i[e]=n,!0):r!==de&&pe(r,e)?(r[e]=n,!0):pe(t.props,e)||e[0]==="$"&&e.slice(1)in t?!1:(s[e]=n,!0)},has({_:{data:t,setupState:e,accessCache:n,ctx:r,appContext:i,propsOptions:s,type:o}},a){let l,u;return!!(n[a]||t!==de&&a[0]!=="$"&&pe(t,a)||xo(e,a)||(l=s[0])&&pe(l,a)||pe(r,a)||pe(hr,a)||pe(i.config.globalProperties,a)||(u=o.__cssModules)&&u[a])},defineProperty(t,e,n){return n.get!=null?t._.accessCache[e]=0:pe(n,"value")&&this.set(t,e,n.value,null),Reflect.defineProperty(t,e,n)}};function Ii(t){return se(t)?t.reduce((e,n)=>(e[n]=null,e),{}):t}function Bc(t,e){return!t||!e?t||e:se(t)&&se(e)?t.concat(e):Le({},Ii(t),Ii(e))}let So=!0;function dg(t){const e=qc(t),n=t.proxy,r=t.ctx;So=!1,e.beforeCreate&&Uc(e.beforeCreate,t,"bc");const{data:i,computed:s,methods:o,watch:a,provide:l,inject:u,created:c,beforeMount:f,mounted:b,beforeUpdate:y,updated:v,activated:A,deactivated:U,beforeDestroy:D,beforeUnmount:I,destroyed:g,unmounted:p,render:h,renderTracked:x,renderTriggered:P,errorCaptured:R,serverPrefetch:W,expose:X,inheritAttrs:Ce,components:Te,directives:tt,filters:Ut}=e;if(u&&hg(u,r,null),o)for(const me in o){const ve=o[me];oe(ve)&&(r[me]=ve.bind(n))}if(i){const me=i.call(n,n);xe(me)&&(t.data=po(me))}if(So=!0,s)for(const me in s){const ve=s[me],Ht=oe(ve)?ve.bind(n,n):oe(ve.get)?ve.get.bind(n,n):xt,Un=!oe(ve)&&oe(ve.set)?ve.set.bind(n):xt,Me=Su({get:Ht,set:Un});Object.defineProperty(r,me,{enumerable:!0,configurable:!0,get:()=>Me.value,set:at=>Me.value=at})}if(a)for(const me in a)Hc(a[me],r,n,me);if(l){const me=oe(l)?l.call(n):l;Reflect.ownKeys(me).forEach(ve=>{Kc(ve,me[ve])})}c&&Uc(c,t,"c");function Re(me,ve){se(ve)?ve.forEach(Ht=>me(Ht.bind(n))):ve&&me(ve.bind(n))}if(Re(Lc,f),Re(_o,b),Re(ig,y),Re(sg,v),Re(tg,A),Re(ng,U),Re(cg,R),Re(lg,x),Re(ag,P),Re(jc,I),Re(Mc,p),Re(og,W),se(X))if(X.length){const me=t.exposed||(t.exposed={});X.forEach(ve=>{Object.defineProperty(me,ve,{get:()=>n[ve],set:Ht=>n[ve]=Ht,enumerable:!0})})}else t.exposed||(t.exposed={});h&&t.render===xt&&(t.render=h),Ce!=null&&(t.inheritAttrs=Ce),Te&&(t.components=Te),tt&&(t.directives=tt),W&&Tc(t)}function hg(t,e,n=xt){se(t)&&(t=Eo(t));for(const r in t){const i=t[r];let s;xe(i)?"default"in i?s=mr(i.from||r,i.default,!0):s=mr(i.from||r):s=mr(i),Ne(s)?Object.defineProperty(e,r,{enumerable:!0,configurable:!0,get:()=>s.value,set:o=>s.value=o}):e[r]=s}}function Uc(t,e,n){$t(se(t)?t.map(r=>r.bind(e.proxy)):t.bind(e.proxy),e,n)}function Hc(t,e,n,r){let i=r.includes(".")?ou(n,r):()=>n[r];if(ke(t)){const s=e[t];oe(s)&&gr(i,s)}else if(oe(t))gr(i,t.bind(n));else if(xe(t))if(se(t))t.forEach(s=>Hc(s,e,n,r));else{const s=oe(t.handler)?t.handler.bind(n):e[t.handler];oe(s)&&gr(i,s,t)}}function qc(t){const e=t.type,{mixins:n,extends:r}=e,{mixins:i,optionsCache:s,config:{optionMergeStrategies:o}}=t.appContext,a=s.get(e);let l;return a?l=a:!i.length&&!n&&!r?l=e:(l={},i.length&&i.forEach(u=>Ti(l,u,o,!0)),Ti(l,e,o)),xe(e)&&s.set(e,l),l}function Ti(t,e,n,r=!1){const{mixins:i,extends:s}=e;s&&Ti(t,s,n,!0),i&&i.forEach(o=>Ti(t,o,n,!0));for(const o in e)if(!(r&&o==="expose")){const a=pg[o]||n&&n[o];t[o]=a?a(t[o],e[o]):e[o]}return t}const pg={data:Wc,props:zc,emits:zc,methods:pr,computed:pr,beforeCreate:Ve,created:Ve,beforeMount:Ve,mounted:Ve,beforeUpdate:Ve,updated:Ve,beforeDestroy:Ve,beforeUnmount:Ve,destroyed:Ve,unmounted:Ve,activated:Ve,deactivated:Ve,errorCaptured:Ve,serverPrefetch:Ve,components:pr,directives:pr,watch:gg,provide:Wc,inject:mg};function Wc(t,e){return e?t?function(){return Le(oe(t)?t.call(this,this):t,oe(e)?e.call(this,this):e)}:e:t}function mg(t,e){return pr(Eo(t),Eo(e))}function Eo(t){if(se(t)){const e={};for(let n=0;n<t.length;n++)e[t[n]]=t[n];return e}return t}function Ve(t,e){return t?[...new Set([].concat(t,e))]:e}function pr(t,e){return t?Le(Object.create(null),t,e):e}function zc(t,e){return t?se(t)&&se(e)?[...new Set([...t,...e])]:Le(Object.create(null),Ii(t),Ii(e??{})):e}function gg(t,e){if(!t)return e;if(!e)return t;const n=Le(Object.create(null),t);for(const r in e)n[r]=Ve(t[r],e[r]);return n}function Vc(){return{app:null,config:{isNativeTag:Vl,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let yg=0;function vg(t,e){return function(r,i=null){oe(r)||(r=Le({},r)),i!=null&&!xe(i)&&(i=null);const s=Vc(),o=new WeakSet,a=[];let l=!1;const u=s.app={_uid:yg++,_component:r,_props:i,_container:null,_context:s,_instance:null,version:ry,get config(){return s.config},set config(c){},use(c,...f){return o.has(c)||(c&&oe(c.install)?(o.add(c),c.install(u,...f)):oe(c)&&(o.add(c),c(u,...f))),u},mixin(c){return s.mixins.includes(c)||s.mixins.push(c),u},component(c,f){return f?(s.components[c]=f,u):s.components[c]},directive(c,f){return f?(s.directives[c]=f,u):s.directives[c]},mount(c,f,b){if(!l){const y=u._ceVNode||Jt(r,i);return y.appContext=s,b===!0?b="svg":b===!1&&(b=void 0),t(y,c,b),l=!0,u._container=c,c.__vue_app__=u,Mi(y.component)}},onUnmount(c){a.push(c)},unmount(){l&&($t(a,u._instance,16),t(null,u._container),delete u._container.__vue_app__)},provide(c,f){return s.provides[c]=f,u},runWithContext(c){const f=Pn;Pn=u;try{return c()}finally{Pn=f}}};return u}}let Pn=null;function Kc(t,e){if(Ke){let n=Ke.provides;const r=Ke.parent&&Ke.parent.provides;r===n&&(n=Ke.provides=Object.create(r)),n[t]=e}}function mr(t,e,n=!1){const r=Io();if(r||Pn){let i=Pn?Pn._context.provides:r?r.parent==null||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(i&&t in i)return i[t];if(arguments.length>1)return n&&oe(e)?e.call(r&&r.proxy):e}}const Yc={},Gc=()=>Object.create(Yc),Jc=t=>Object.getPrototypeOf(t)===Yc;function bg(t,e,n,r=!1){const i={},s=Gc();t.propsDefaults=Object.create(null),Qc(t,e,i,s);for(const o in t.propsOptions[0])o in i||(i[o]=void 0);n?t.props=r?i:Im(i):t.type.props?t.props=i:t.props=s,t.attrs=s}function _g(t,e,n,r){const{props:i,attrs:s,vnode:{patchFlag:o}}=t,a=fe(i),[l]=t.propsOptions;let u=!1;if((r||o>0)&&!(o&16)){if(o&8){const c=t.vnode.dynamicProps;for(let f=0;f<c.length;f++){let b=c[f];if(Ni(t.emitsOptions,b))continue;const y=e[b];if(l)if(pe(s,b))y!==s[b]&&(s[b]=y,u=!0);else{const v=Nt(b);i[v]=$o(l,a,v,y,t,!1)}else y!==s[b]&&(s[b]=y,u=!0)}}}else{Qc(t,e,i,s)&&(u=!0);let c;for(const f in a)(!e||!pe(e,f)&&((c=Kt(f))===f||!pe(e,c)))&&(l?n&&(n[f]!==void 0||n[c]!==void 0)&&(i[f]=$o(l,a,f,void 0,t,!0)):delete i[f]);if(s!==a)for(const f in s)(!e||!pe(e,f))&&(delete s[f],u=!0)}u&&Dt(t.attrs,"set","")}function Qc(t,e,n,r){const[i,s]=t.propsOptions;let o=!1,a;if(e)for(let l in e){if(rr(l))continue;const u=e[l];let c;i&&pe(i,c=Nt(l))?!s||!s.includes(c)?n[c]=u:(a||(a={}))[c]=u:Ni(t.emitsOptions,l)||(!(l in r)||u!==r[l])&&(r[l]=u,o=!0)}if(s){const l=fe(n),u=a||de;for(let c=0;c<s.length;c++){const f=s[c];n[f]=$o(i,l,f,u[f],t,!pe(u,f))}}return o}function $o(t,e,n,r,i,s){const o=t[n];if(o!=null){const a=pe(o,"default");if(a&&r===void 0){const l=o.default;if(o.type!==Function&&!o.skipFactory&&oe(l)){const{propsDefaults:u}=i;if(n in u)r=u[n];else{const c=wr(i);r=u[n]=l.call(null,e),c()}}else r=l;i.ce&&i.ce._setProp(n,r)}o[0]&&(s&&!a?r=!1:o[1]&&(r===""||r===Kt(n))&&(r=!0))}return r}const wg=new WeakMap;function Xc(t,e,n=!1){const r=n?wg:e.propsCache,i=r.get(t);if(i)return i;const s=t.props,o={},a=[];let l=!1;if(!oe(t)){const c=f=>{l=!0;const[b,y]=Xc(f,e,!0);Le(o,b),y&&a.push(...y)};!n&&e.mixins.length&&e.mixins.forEach(c),t.extends&&c(t.extends),t.mixins&&t.mixins.forEach(c)}if(!s&&!l)return xe(t)&&r.set(t,xn),xn;if(se(s))for(let c=0;c<s.length;c++){const f=Nt(s[c]);Zc(f)&&(o[f]=de)}else if(s)for(const c in s){const f=Nt(c);if(Zc(f)){const b=s[c],y=o[f]=se(b)||oe(b)?{type:b}:Le({},b),v=y.type;let A=!1,U=!0;if(se(v))for(let D=0;D<v.length;++D){const I=v[D],g=oe(I)&&I.name;if(g==="Boolean"){A=!0;break}else g==="String"&&(U=!1)}else A=oe(v)&&v.name==="Boolean";y[0]=A,y[1]=U,(A||pe(y,"default"))&&a.push(f)}}const u=[o,a];return xe(t)&&r.set(t,u),u}function Zc(t){return t[0]!=="$"&&!rr(t)}const ko=t=>t==="_"||t==="_ctx"||t==="$stable",Co=t=>se(t)?t.map(Ct):[Ct(t)],xg=(t,e,n)=>{if(e._n)return e;const r=Gm((...i)=>Co(e(...i)),n);return r._c=!1,r},eu=(t,e,n)=>{const r=t._ctx;for(const i in t){if(ko(i))continue;const s=t[i];if(oe(s))e[i]=xg(i,s,r);else if(s!=null){const o=Co(s);e[i]=()=>o}}},tu=(t,e)=>{const n=Co(e);t.slots.default=()=>n},nu=(t,e,n)=>{for(const r in e)(n||!ko(r))&&(t[r]=e[r])},Sg=(t,e,n)=>{const r=t.slots=Gc();if(t.vnode.shapeFlag&32){const i=e._;i?(nu(r,e,n),n&&Xl(r,"_",i,!0)):eu(e,r)}else e&&tu(t,e)},Eg=(t,e,n)=>{const{vnode:r,slots:i}=t;let s=!0,o=de;if(r.shapeFlag&32){const a=e._;a?n&&a===1?s=!1:nu(i,e,n):(s=!e.$stable,eu(e,i)),o=e}else e&&(tu(t,e),o={default:1});if(s)for(const a in i)!ko(a)&&o[a]==null&&delete i[a]},it=Bg;function $g(t){return kg(t)}function kg(t,e){const n=di();n.__VUE__=!0;const{insert:r,remove:i,patchProp:s,createElement:o,createText:a,createComment:l,setText:u,setElementText:c,parentNode:f,nextSibling:b,setScopeId:y=xt,insertStaticContent:v}=t,A=(_,E,T,L=null,j=null,M=null,G=void 0,K=null,z=!!E.dynamicChildren)=>{if(_===E)return;_&&!_r(_,E)&&(L=Hn(_),at(_,j,M,!0),_=null),E.patchFlag===-2&&(z=!1,E.dynamicChildren=null);const{type:B,ref:ee,shapeFlag:J}=E;switch(B){case Di:U(_,E,T,L);break;case An:D(_,E,T,L);break;case Po:_==null&&I(E,T,L,G);break;case vt:Te(_,E,T,L,j,M,G,K,z);break;default:J&1?h(_,E,T,L,j,M,G,K,z):J&6?tt(_,E,T,L,j,M,G,K,z):(J&64||J&128)&&B.process(_,E,T,L,j,M,G,K,z,yn)}ee!=null&&j?fr(ee,_&&_.ref,M,E||_,!E):ee==null&&_&&_.ref!=null&&fr(_.ref,null,M,_,!0)},U=(_,E,T,L)=>{if(_==null)r(E.el=a(E.children),T,L);else{const j=E.el=_.el;E.children!==_.children&&u(j,E.children)}},D=(_,E,T,L)=>{_==null?r(E.el=l(E.children||""),T,L):E.el=_.el},I=(_,E,T,L)=>{[_.el,_.anchor]=v(_.children,E,T,L,_.el,_.anchor)},g=({el:_,anchor:E},T,L)=>{let j;for(;_&&_!==E;)j=b(_),r(_,T,L),_=j;r(E,T,L)},p=({el:_,anchor:E})=>{let T;for(;_&&_!==E;)T=b(_),i(_),_=T;i(E)},h=(_,E,T,L,j,M,G,K,z)=>{E.type==="svg"?G="svg":E.type==="math"&&(G="mathml"),_==null?x(E,T,L,j,M,G,K,z):W(_,E,j,M,G,K,z)},x=(_,E,T,L,j,M,G,K)=>{let z,B;const{props:ee,shapeFlag:J,transition:Z,dirs:re}=_;if(z=_.el=o(_.type,M,ee&&ee.is,ee),J&8?c(z,_.children):J&16&&R(_.children,z,null,L,j,Oo(_,M),G,K),re&&un(_,null,L,"created"),P(z,_,_.scopeId,G,L),ee){for(const be in ee)be!=="value"&&!rr(be)&&s(z,be,null,ee[be],M,L);"value"in ee&&s(z,"value",null,ee.value,M),(B=ee.onVnodeBeforeMount)&&Ot(B,L,_)}re&&un(_,null,L,"beforeMount");const ce=Cg(j,Z);ce&&Z.beforeEnter(z),r(z,E,T),((B=ee&&ee.onVnodeMounted)||ce||re)&&it(()=>{B&&Ot(B,L,_),ce&&Z.enter(z),re&&un(_,null,L,"mounted")},j)},P=(_,E,T,L,j)=>{if(T&&y(_,T),L)for(let M=0;M<L.length;M++)y(_,L[M]);if(j){let M=j.subTree;if(E===M||du(M.type)&&(M.ssContent===E||M.ssFallback===E)){const G=j.vnode;P(_,G,G.scopeId,G.slotScopeIds,j.parent)}}},R=(_,E,T,L,j,M,G,K,z=0)=>{for(let B=z;B<_.length;B++){const ee=_[B]=K?Qt(_[B]):Ct(_[B]);A(null,ee,E,T,L,j,M,G,K)}},W=(_,E,T,L,j,M,G)=>{const K=E.el=_.el;let{patchFlag:z,dynamicChildren:B,dirs:ee}=E;z|=_.patchFlag&16;const J=_.props||de,Z=E.props||de;let re;if(T&&fn(T,!1),(re=Z.onVnodeBeforeUpdate)&&Ot(re,T,E,_),ee&&un(E,_,T,"beforeUpdate"),T&&fn(T,!0),(J.innerHTML&&Z.innerHTML==null||J.textContent&&Z.textContent==null)&&c(K,""),B?X(_.dynamicChildren,B,K,T,L,Oo(E,j),M):G||ve(_,E,K,null,T,L,Oo(E,j),M,!1),z>0){if(z&16)Ce(K,J,Z,T,j);else if(z&2&&J.class!==Z.class&&s(K,"class",null,Z.class,j),z&4&&s(K,"style",J.style,Z.style,j),z&8){const ce=E.dynamicProps;for(let be=0;be<ce.length;be++){const he=ce[be],Fe=J[he],Be=Z[he];(Be!==Fe||he==="value")&&s(K,he,Fe,Be,j,T)}}z&1&&_.children!==E.children&&c(K,E.children)}else!G&&B==null&&Ce(K,J,Z,T,j);((re=Z.onVnodeUpdated)||ee)&&it(()=>{re&&Ot(re,T,E,_),ee&&un(E,_,T,"updated")},L)},X=(_,E,T,L,j,M,G)=>{for(let K=0;K<E.length;K++){const z=_[K],B=E[K],ee=z.el&&(z.type===vt||!_r(z,B)||z.shapeFlag&198)?f(z.el):T;A(z,B,ee,null,L,j,M,G,!0)}},Ce=(_,E,T,L,j)=>{if(E!==T){if(E!==de)for(const M in E)!rr(M)&&!(M in T)&&s(_,M,E[M],null,j,L);for(const M in T){if(rr(M))continue;const G=T[M],K=E[M];G!==K&&M!=="value"&&s(_,M,K,G,j,L)}"value"in T&&s(_,"value",E.value,T.value,j)}},Te=(_,E,T,L,j,M,G,K,z)=>{const B=E.el=_?_.el:a(""),ee=E.anchor=_?_.anchor:a("");let{patchFlag:J,dynamicChildren:Z,slotScopeIds:re}=E;re&&(K=K?K.concat(re):re),_==null?(r(B,T,L),r(ee,T,L),R(E.children||[],T,ee,j,M,G,K,z)):J>0&&J&64&&Z&&_.dynamicChildren?(X(_.dynamicChildren,Z,T,j,M,G,K),(E.key!=null||j&&E===j.subTree)&&ru(_,E,!0)):ve(_,E,T,ee,j,M,G,K,z)},tt=(_,E,T,L,j,M,G,K,z)=>{E.slotScopeIds=K,_==null?E.shapeFlag&512?j.ctx.activate(E,T,L,G,z):Ut(E,T,L,j,M,G,z):mn(_,E,z)},Ut=(_,E,T,L,j,M,G)=>{const K=_.component=Yg(_,L,j);if(Nc(_)&&(K.ctx.renderer=yn),Gg(K,!1,G),K.asyncDep){if(j&&j.registerDep(K,Re,G),!_.el){const z=K.subTree=Jt(An);D(null,z,E,T),_.placeholder=z.el}}else Re(K,_,E,T,j,M,G)},mn=(_,E,T)=>{const L=E.component=_.component;if(Mg(_,E,T))if(L.asyncDep&&!L.asyncResolved){me(L,E,T);return}else L.next=E,L.update();else E.el=_.el,L.vnode=E},Re=(_,E,T,L,j,M,G)=>{const K=()=>{if(_.isMounted){let{next:J,bu:Z,u:re,parent:ce,vnode:be}=_;{const ct=iu(_);if(ct){J&&(J.el=be.el,me(_,J,G)),ct.asyncDep.then(()=>{_.isUnmounted||K()});return}}let he=J,Fe;fn(_,!1),J?(J.el=be.el,me(_,J,G)):J=be,Z&&eo(Z),(Fe=J.props&&J.props.onVnodeBeforeUpdate)&&Ot(Fe,ce,J,be),fn(_,!0);const Be=uu(_),lt=_.subTree;_.subTree=Be,A(lt,Be,f(lt.el),Hn(lt),_,j,M),J.el=Be.el,he===null&&Fg(_,Be.el),re&&it(re,j),(Fe=J.props&&J.props.onVnodeUpdated)&&it(()=>Ot(Fe,ce,J,be),j)}else{let J;const{el:Z,props:re}=E,{bm:ce,m:be,parent:he,root:Fe,type:Be}=_,lt=dr(E);fn(_,!1),ce&&eo(ce),!lt&&(J=re&&re.onVnodeBeforeMount)&&Ot(J,he,E),fn(_,!0);{Fe.ce&&Fe.ce._def.shadowRoot!==!1&&Fe.ce._injectChildStyle(Be);const ct=_.subTree=uu(_);A(null,ct,T,L,_,j,M),E.el=ct.el}if(be&&it(be,j),!lt&&(J=re&&re.onVnodeMounted)){const ct=E;it(()=>Ot(J,he,ct),j)}(E.shapeFlag&256||he&&dr(he.vnode)&&he.vnode.shapeFlag&256)&&_.a&&it(_.a,j),_.isMounted=!0,E=T=L=null}};_.scope.on();const z=_.effect=new rc(K);_.scope.off();const B=_.update=z.run.bind(z),ee=_.job=z.runIfDirty.bind(z);ee.i=_,ee.id=_.uid,z.scheduler=()=>vo(ee),fn(_,!0),B()},me=(_,E,T)=>{E.component=_;const L=_.vnode.props;_.vnode=E,_.next=null,_g(_,E.props,L,T),Eg(_,E.children,T),St(),Cc(_),Et()},ve=(_,E,T,L,j,M,G,K,z=!1)=>{const B=_&&_.children,ee=_?_.shapeFlag:0,J=E.children,{patchFlag:Z,shapeFlag:re}=E;if(Z>0){if(Z&128){Un(B,J,T,L,j,M,G,K,z);return}else if(Z&256){Ht(B,J,T,L,j,M,G,K,z);return}}re&8?(ee&16&&gn(B,j,M),J!==B&&c(T,J)):ee&16?re&16?Un(B,J,T,L,j,M,G,K,z):gn(B,j,M,!0):(ee&8&&c(T,""),re&16&&R(J,T,L,j,M,G,K,z))},Ht=(_,E,T,L,j,M,G,K,z)=>{_=_||xn,E=E||xn;const B=_.length,ee=E.length,J=Math.min(B,ee);let Z;for(Z=0;Z<J;Z++){const re=E[Z]=z?Qt(E[Z]):Ct(E[Z]);A(_[Z],re,T,null,j,M,G,K,z)}B>ee?gn(_,j,M,!0,!1,J):R(E,T,L,j,M,G,K,z,J)},Un=(_,E,T,L,j,M,G,K,z)=>{let B=0;const ee=E.length;let J=_.length-1,Z=ee-1;for(;B<=J&&B<=Z;){const re=_[B],ce=E[B]=z?Qt(E[B]):Ct(E[B]);if(_r(re,ce))A(re,ce,T,null,j,M,G,K,z);else break;B++}for(;B<=J&&B<=Z;){const re=_[J],ce=E[Z]=z?Qt(E[Z]):Ct(E[Z]);if(_r(re,ce))A(re,ce,T,null,j,M,G,K,z);else break;J--,Z--}if(B>J){if(B<=Z){const re=Z+1,ce=re<ee?E[re].el:L;for(;B<=Z;)A(null,E[B]=z?Qt(E[B]):Ct(E[B]),T,ce,j,M,G,K,z),B++}}else if(B>Z)for(;B<=J;)at(_[B],j,M,!0),B++;else{const re=B,ce=B,be=new Map;for(B=ce;B<=Z;B++){const Ye=E[B]=z?Qt(E[B]):Ct(E[B]);Ye.key!=null&&be.set(Ye.key,B)}let he,Fe=0;const Be=Z-ce+1;let lt=!1,ct=0;const Zt=new Array(Be);for(B=0;B<Be;B++)Zt[B]=0;for(B=re;B<=J;B++){const Ye=_[B];if(Fe>=Be){at(Ye,j,M,!0);continue}let mt;if(Ye.key!=null)mt=be.get(Ye.key);else for(he=ce;he<=Z;he++)if(Zt[he-ce]===0&&_r(Ye,E[he])){mt=he;break}mt===void 0?at(Ye,j,M,!0):(Zt[mt-ce]=B+1,mt>=ct?ct=mt:lt=!0,A(Ye,E[mt],T,null,j,M,G,K,z),Fe++)}const qn=lt?Og(Zt):xn;for(he=qn.length-1,B=Be-1;B>=0;B--){const Ye=ce+B,mt=E[Ye],Wn=E[Ye+1],Pr=Ye+1<ee?Wn.el||Wn.placeholder:L;Zt[B]===0?A(null,mt,T,Pr,j,M,G,K,z):lt&&(he<0||B!==qn[he]?Me(mt,T,Pr,2):he--)}}},Me=(_,E,T,L,j=null)=>{const{el:M,type:G,transition:K,children:z,shapeFlag:B}=_;if(B&6){Me(_.component.subTree,E,T,L);return}if(B&128){_.suspense.move(E,T,L);return}if(B&64){G.move(_,E,T,yn);return}if(G===vt){r(M,E,T);for(let J=0;J<z.length;J++)Me(z[J],E,T,L);r(_.anchor,E,T);return}if(G===Po){g(_,E,T);return}if(L!==2&&B&1&&K)if(L===0)K.beforeEnter(M),r(M,E,T),it(()=>K.enter(M),j);else{const{leave:J,delayLeave:Z,afterLeave:re}=K,ce=()=>{_.ctx.isUnmounted?i(M):r(M,E,T)},be=()=>{M._isLeaving&&M[Zm](!0),J(M,()=>{ce(),re&&re()})};Z?Z(M,ce,be):be()}else r(M,E,T)},at=(_,E,T,L=!1,j=!1)=>{const{type:M,props:G,ref:K,children:z,dynamicChildren:B,shapeFlag:ee,patchFlag:J,dirs:Z,cacheIndex:re}=_;if(J===-2&&(j=!1),K!=null&&(St(),fr(K,null,T,_,!0),Et()),re!=null&&(E.renderCache[re]=void 0),ee&256){E.ctx.deactivate(_);return}const ce=ee&1&&Z,be=!dr(_);let he;if(be&&(he=G&&G.onVnodeBeforeUnmount)&&Ot(he,E,_),ee&6)zo(_.component,T,L);else{if(ee&128){_.suspense.unmount(T,L);return}ce&&un(_,null,E,"beforeUnmount"),ee&64?_.type.remove(_,E,T,yn,L):B&&!B.hasOnce&&(M!==vt||J>0&&J&64)?gn(B,E,T,!1,!0):(M===vt&&J&384||!j&&ee&16)&&gn(z,E,T),L&&Gi(_)}(be&&(he=G&&G.onVnodeUnmounted)||ce)&&it(()=>{he&&Ot(he,E,_),ce&&un(_,null,E,"unmounted")},T)},Gi=_=>{const{type:E,el:T,anchor:L,transition:j}=_;if(E===vt){Wo(T,L);return}if(E===Po){p(_);return}const M=()=>{i(T),j&&!j.persisted&&j.afterLeave&&j.afterLeave()};if(_.shapeFlag&1&&j&&!j.persisted){const{leave:G,delayLeave:K}=j,z=()=>G(T,M);K?K(_.el,M,z):z()}else M()},Wo=(_,E)=>{let T;for(;_!==E;)T=b(_),i(_),_=T;i(E)},zo=(_,E,T)=>{const{bum:L,scope:j,job:M,subTree:G,um:K,m:z,a:B}=_;su(z),su(B),L&&eo(L),j.stop(),M&&(M.flags|=8,at(G,_,E,T)),K&&it(K,E),it(()=>{_.isUnmounted=!0},E)},gn=(_,E,T,L=!1,j=!1,M=0)=>{for(let G=M;G<_.length;G++)at(_[G],E,T,L,j)},Hn=_=>{if(_.shapeFlag&6)return Hn(_.component.subTree);if(_.shapeFlag&128)return _.suspense.next();const E=b(_.anchor||_.el),T=E&&E[Qm];return T?b(T):E};let Or=!1;const Ji=(_,E,T)=>{_==null?E._vnode&&at(E._vnode,null,null,!0):A(E._vnode||null,_,E,null,null,null,T),E._vnode=_,Or||(Or=!0,Cc(),Oc(),Or=!1)},yn={p:A,um:at,m:Me,r:Gi,mt:Ut,mc:R,pc:ve,pbc:X,n:Hn,o:t};return{render:Ji,hydrate:void 0,createApp:vg(Ji)}}function Oo({type:t,props:e},n){return n==="svg"&&t==="foreignObject"||n==="mathml"&&t==="annotation-xml"&&e&&e.encoding&&e.encoding.includes("html")?void 0:n}function fn({effect:t,job:e},n){n?(t.flags|=32,e.flags|=4):(t.flags&=-33,e.flags&=-5)}function Cg(t,e){return(!t||t&&!t.pendingBranch)&&e&&!e.persisted}function ru(t,e,n=!1){const r=t.children,i=e.children;if(se(r)&&se(i))for(let s=0;s<r.length;s++){const o=r[s];let a=i[s];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=i[s]=Qt(i[s]),a.el=o.el),!n&&a.patchFlag!==-2&&ru(o,a)),a.type===Di&&a.patchFlag!==-1&&(a.el=o.el),a.type===An&&!a.el&&(a.el=o.el)}}function Og(t){const e=t.slice(),n=[0];let r,i,s,o,a;const l=t.length;for(r=0;r<l;r++){const u=t[r];if(u!==0){if(i=n[n.length-1],t[i]<u){e[r]=i,n.push(r);continue}for(s=0,o=n.length-1;s<o;)a=s+o>>1,t[n[a]]<u?s=a+1:o=a;u<t[n[s]]&&(s>0&&(e[r]=n[s-1]),n[s]=r)}}for(s=n.length,o=n[s-1];s-- >0;)n[s]=o,o=e[o];return n}function iu(t){const e=t.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:iu(e)}function su(t){if(t)for(let e=0;e<t.length;e++)t[e].flags|=8}const Pg=Symbol.for("v-scx"),Ag=()=>mr(Pg);function Ig(t,e){return Ri(t,null,e)}function Tg(t,e){return Ri(t,null,{flush:"sync"})}function gr(t,e,n){return Ri(t,e,n)}function Ri(t,e,n=de){const{immediate:r,deep:i,flush:s,once:o}=n,a=Le({},n),l=e&&r||!e&&s!=="post";let u;if(xr){if(s==="sync"){const y=Ag();u=y.__watcherHandles||(y.__watcherHandles=[])}else if(!l){const y=()=>{};return y.stop=xt,y.resume=xt,y.pause=xt,y}}const c=Ke;a.call=(y,v,A)=>$t(y,c,v,A);let f=!1;s==="post"?a.scheduler=y=>{it(y,c&&c.suspense)}:s!=="sync"&&(f=!0,a.scheduler=(y,v)=>{v?y():vo(y)}),a.augmentJob=y=>{e&&(y.flags|=4),f&&(y.flags|=2,c&&(y.id=c.uid,y.i=c))};const b=Um(t,e,a);return xr&&(u?u.push(b):l&&b()),b}function Rg(t,e,n){const r=this.proxy,i=ke(t)?t.includes(".")?ou(r,t):()=>r[t]:t.bind(r,r);let s;oe(e)?s=e:(s=e.handler,n=e);const o=wr(this),a=Ri(i,s.bind(r),n);return o(),a}function ou(t,e){const n=e.split(".");return()=>{let r=t;for(let i=0;i<n.length&&r;i++)r=r[n[i]];return r}}function au(t,e,n=de){const r=Io(),i=Nt(e),s=Kt(e),o=lu(t,i),a=jm((l,u)=>{let c,f=de,b;return Tg(()=>{const y=t[i];Ze(c,y)&&(c=y,u())}),{get(){return l(),n.get?n.get(c):c},set(y){const v=n.set?n.set(y):y;if(!Ze(v,c)&&!(f!==de&&Ze(y,f)))return;const A=r.vnode.props;A&&(e in A||i in A||s in A)&&(`onUpdate:${e}`in A||`onUpdate:${i}`in A||`onUpdate:${s}`in A)||(c=y,u()),r.emit(`update:${e}`,v),Ze(y,v)&&Ze(y,f)&&!Ze(v,b)&&u(),f=y,b=v}}});return a[Symbol.iterator]=()=>{let l=0;return{next(){return l<2?{value:l++?o||de:a,done:!1}:{done:!0}}}},a}const lu=(t,e)=>e==="modelValue"||e==="model-value"?t.modelModifiers:t[`${e}Modifiers`]||t[`${Nt(e)}Modifiers`]||t[`${Kt(e)}Modifiers`];function Ng(t,e,...n){if(t.isUnmounted)return;const r=t.vnode.props||de;let i=n;const s=e.startsWith("update:"),o=s&&lu(r,e.slice(7));o&&(o.trim&&(i=n.map(c=>ke(c)?c.trim():c)),o.number&&(i=n.map(sm)));let a,l=r[a=Zs(e)]||r[a=Zs(Nt(e))];!l&&s&&(l=r[a=Zs(Kt(e))]),l&&$t(l,t,6,i);const u=r[a+"Once"];if(u){if(!t.emitted)t.emitted={};else if(t.emitted[a])return;t.emitted[a]=!0,$t(u,t,6,i)}}const Dg=new WeakMap;function cu(t,e,n=!1){const r=n?Dg:e.emitsCache,i=r.get(t);if(i!==void 0)return i;const s=t.emits;let o={},a=!1;if(!oe(t)){const l=u=>{const c=cu(u,e,!0);c&&(a=!0,Le(o,c))};!n&&e.mixins.length&&e.mixins.forEach(l),t.extends&&l(t.extends),t.mixins&&t.mixins.forEach(l)}return!s&&!a?(xe(t)&&r.set(t,null),null):(se(s)?s.forEach(l=>o[l]=null):Le(o,s),xe(t)&&r.set(t,o),o)}function Ni(t,e){return!t||!ci(e)?!1:(e=e.slice(2).replace(/Once$/,""),pe(t,e[0].toLowerCase()+e.slice(1))||pe(t,Kt(e))||pe(t,e))}function Qv(){}function uu(t){const{type:e,vnode:n,proxy:r,withProxy:i,propsOptions:[s],slots:o,attrs:a,emit:l,render:u,renderCache:c,props:f,data:b,setupState:y,ctx:v,inheritAttrs:A}=t,U=Oi(t);let D,I;try{if(n.shapeFlag&4){const p=i||r,h=p;D=Ct(u.call(h,p,c,f,y,b,v)),I=a}else{const p=e;D=Ct(p.length>1?p(f,{attrs:a,slots:o,emit:l}):p(f,null)),I=e.props?a:Lg(a)}}catch(p){yr.length=0,$i(p,t,1),D=Jt(An)}let g=D;if(I&&A!==!1){const p=Object.keys(I),{shapeFlag:h}=g;p.length&&h&7&&(s&&p.some(Js)&&(I=jg(I,s)),g=Tn(g,I,!1,!0))}return n.dirs&&(g=Tn(g,null,!1,!0),g.dirs=g.dirs?g.dirs.concat(n.dirs):n.dirs),n.transition&&bo(g,n.transition),D=g,Oi(U),D}const Lg=t=>{let e;for(const n in t)(n==="class"||n==="style"||ci(n))&&((e||(e={}))[n]=t[n]);return e},jg=(t,e)=>{const n={};for(const r in t)(!Js(r)||!(r.slice(9)in e))&&(n[r]=t[r]);return n};function Mg(t,e,n){const{props:r,children:i,component:s}=t,{props:o,children:a,patchFlag:l}=e,u=s.emitsOptions;if(e.dirs||e.transition)return!0;if(n&&l>=0){if(l&1024)return!0;if(l&16)return r?fu(r,o,u):!!o;if(l&8){const c=e.dynamicProps;for(let f=0;f<c.length;f++){const b=c[f];if(o[b]!==r[b]&&!Ni(u,b))return!0}}}else return(i||a)&&(!a||!a.$stable)?!0:r===o?!1:r?o?fu(r,o,u):!0:!!o;return!1}function fu(t,e,n){const r=Object.keys(e);if(r.length!==Object.keys(t).length)return!0;for(let i=0;i<r.length;i++){const s=r[i];if(e[s]!==t[s]&&!Ni(n,s))return!0}return!1}function Fg({vnode:t,parent:e},n){for(;e;){const r=e.subTree;if(r.suspense&&r.suspense.activeBranch===t&&(r.el=t.el),r===t)(t=e.vnode).el=n,e=e.parent;else break}}const du=t=>t.__isSuspense;function Bg(t,e){e&&e.pendingBranch?se(t)?e.effects.push(...t):e.effects.push(t):Ym(t)}const vt=Symbol.for("v-fgt"),Di=Symbol.for("v-txt"),An=Symbol.for("v-cmt"),Po=Symbol.for("v-stc"),yr=[];let st=null;function In(t=!1){yr.push(st=t?null:[])}function Ug(){yr.pop(),st=yr[yr.length-1]||null}let vr=1;function hu(t,e=!1){vr+=t,t<0&&st&&e&&(st.hasOnce=!0)}function pu(t){return t.dynamicChildren=vr>0?st||xn:null,Ug(),vr>0&&st&&st.push(t),t}function br(t,e,n,r,i,s){return pu(Ft(t,e,n,r,i,s,!0))}function Hg(t,e,n,r,i){return pu(Jt(t,e,n,r,i,!0))}function mu(t){return t?t.__v_isVNode===!0:!1}function _r(t,e){return t.type===e.type&&t.key===e.key}const gu=({key:t})=>t??null,Li=({ref:t,ref_key:e,ref_for:n})=>(typeof t=="number"&&(t=""+t),t!=null?ke(t)||Ne(t)||oe(t)?{i:dt,r:t,k:e,f:!!n}:t:null);function Ft(t,e=null,n=null,r=0,i=null,s=t===vt?0:1,o=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&gu(e),ref:e&&Li(e),scopeId:Ac,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:s,patchFlag:r,dynamicProps:i,dynamicChildren:null,appContext:null,ctx:dt};return a?(Ao(l,n),s&128&&t.normalize(l)):n&&(l.shapeFlag|=ke(n)?8:16),vr>0&&!o&&st&&(l.patchFlag>0||s&6)&&l.patchFlag!==32&&st.push(l),l}const Jt=qg;function qg(t,e=null,n=null,r=0,i=null,s=!1){if((!t||t===ug)&&(t=An),mu(t)){const a=Tn(t,e,!0);return n&&Ao(a,n),vr>0&&!s&&st&&(a.shapeFlag&6?st[st.indexOf(t)]=a:st.push(a)),a.patchFlag=-2,a}if(ny(t)&&(t=t.__vccOpts),e){e=Wg(e);let{class:a,style:l}=e;a&&!ke(a)&&(e.class=hi(a)),xe(l)&&(go(l)&&!se(l)&&(l=Le({},l)),e.style=to(l))}const o=ke(t)?1:du(t)?128:Xm(t)?64:xe(t)?4:oe(t)?2:0;return Ft(t,e,n,r,i,o,s,!0)}function Wg(t){return t?go(t)||Jc(t)?Le({},t):t:null}function Tn(t,e,n=!1,r=!1){const{props:i,ref:s,patchFlag:o,children:a,transition:l}=t,u=e?yu(i||{},e):i,c={__v_isVNode:!0,__v_skip:!0,type:t.type,props:u,key:u&&gu(u),ref:e&&e.ref?n&&s?se(s)?s.concat(Li(e)):[s,Li(e)]:Li(e):s,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:a,target:t.target,targetStart:t.targetStart,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:e&&t.type!==vt?o===-1?16:o|16:o,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:l,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&Tn(t.ssContent),ssFallback:t.ssFallback&&Tn(t.ssFallback),placeholder:t.placeholder,el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce};return l&&r&&bo(c,l.clone(c)),c}function zg(t=" ",e=0){return Jt(Di,null,t,e)}function Ct(t){return t==null||typeof t=="boolean"?Jt(An):se(t)?Jt(vt,null,t.slice()):mu(t)?Qt(t):Jt(Di,null,String(t))}function Qt(t){return t.el===null&&t.patchFlag!==-1||t.memo?t:Tn(t)}function Ao(t,e){let n=0;const{shapeFlag:r}=t;if(e==null)e=null;else if(se(e))n=16;else if(typeof e=="object")if(r&65){const i=e.default;i&&(i._c&&(i._d=!1),Ao(t,i()),i._c&&(i._d=!0));return}else{n=32;const i=e._;!i&&!Jc(e)?e._ctx=dt:i===3&&dt&&(dt.slots._===1?e._=1:(e._=2,t.patchFlag|=1024))}else oe(e)?(e={default:e,_ctx:dt},n=32):(e=String(e),r&64?(n=16,e=[zg(e)]):n=8);t.children=e,t.shapeFlag|=n}function yu(...t){const e={};for(let n=0;n<t.length;n++){const r=t[n];for(const i in r)if(i==="class")e.class!==r.class&&(e.class=hi([e.class,r.class]));else if(i==="style")e.style=to([e.style,r.style]);else if(ci(i)){const s=e[i],o=r[i];o&&s!==o&&!(se(s)&&s.includes(o))&&(e[i]=s?[].concat(s,o):o)}else i!==""&&(e[i]=r[i])}return e}function Ot(t,e,n,r=null){$t(t,e,7,[n,r])}const Vg=Vc();let Kg=0;function Yg(t,e,n){const r=t.type,i=(e?e.appContext:t.appContext)||Vg,s={uid:Kg++,vnode:t,type:r,parent:e,appContext:i,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new fm(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:e?e.provides:Object.create(i.provides),ids:e?e.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:Xc(r,i),emitsOptions:cu(r,i),emit:null,emitted:null,propsDefaults:de,inheritAttrs:r.inheritAttrs,ctx:de,data:de,props:de,attrs:de,slots:de,refs:de,setupState:de,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return s.ctx={_:s},s.root=e?e.root:s,s.emit=Ng.bind(null,s),t.ce&&t.ce(s),s}let Ke=null;const Io=()=>Ke||dt;let ji,To;{const t=di(),e=(n,r)=>{let i;return(i=t[n])||(i=t[n]=[]),i.push(r),s=>{i.length>1?i.forEach(o=>o(s)):i[0](s)}};ji=e("__VUE_INSTANCE_SETTERS__",n=>Ke=n),To=e("__VUE_SSR_SETTERS__",n=>xr=n)}const wr=t=>{const e=Ke;return ji(t),t.scope.on(),()=>{t.scope.off(),ji(e)}},vu=()=>{Ke&&Ke.scope.off(),ji(null)};function bu(t){return t.vnode.shapeFlag&4}let xr=!1;function Gg(t,e=!1,n=!1){e&&To(e);const{props:r,children:i}=t.vnode,s=bu(t);bg(t,r,s,e),Sg(t,i,n||e);const o=s?Jg(t,e):void 0;return e&&To(!1),o}function Jg(t,e){const n=t.type;t.accessCache=Object.create(null),t.proxy=new Proxy(t.ctx,fg);const{setup:r}=n;if(r){St();const i=t.setupContext=r.length>1?Xg(t):null,s=wr(t),o=kn(r,t,0,[t.props,i]),a=Yl(o);if(Et(),s(),(a||t.sp)&&!dr(t)&&Tc(t),a){if(o.then(vu,vu),e)return o.then(l=>{_u(t,l)}).catch(l=>{$i(l,t,0)});t.asyncDep=o}else _u(t,o)}else wu(t)}function _u(t,e,n){oe(e)?t.type.__ssrInlineRender?t.ssrRender=e:t.render=e:xe(e)&&(t.setupState=Sc(e)),wu(t)}function wu(t,e,n){const r=t.type;t.render||(t.render=r.render||xt);{const i=wr(t);St();try{dg(t)}finally{Et(),i()}}}const Qg={get(t,e){return qe(t,"get",""),t[e]}};function Xg(t){const e=n=>{t.exposed=n||{}};return{attrs:new Proxy(t.attrs,Qg),slots:t.slots,emit:t.emit,expose:e}}function Mi(t){return t.exposed?t.exposeProxy||(t.exposeProxy=new Proxy(Sc(Tm(t.exposed)),{get(e,n){if(n in e)return e[n];if(n in hr)return hr[n](t)},has(e,n){return n in e||n in hr}})):t.proxy}const Zg=/(?:^|[-_])\w/g,ey=t=>t.replace(Zg,e=>e.toUpperCase()).replace(/[-_]/g,"");function ty(t,e=!0){return oe(t)?t.displayName||t.name:t.name||e&&t.__name}function xu(t,e,n=!1){let r=ty(e);if(!r&&e.__file){const i=e.__file.match(/([^/\\]+)\.\w+$/);i&&(r=i[1])}if(!r&&t&&t.parent){const i=s=>{for(const o in s)if(s[o]===e)return o};r=i(t.components||t.parent.type.components)||i(t.appContext.components)}return r?ey(r):n?"App":"Anonymous"}function ny(t){return oe(t)&&"__vccOpts"in t}const Su=(t,e)=>Fm(t,e,xr),ry="3.5.22";/**
|
|
104
|
+
* @vue/runtime-dom v3.5.22
|
|
105
105
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
106
106
|
* @license MIT
|
|
107
|
-
**/let
|
|
107
|
+
**/let Ro;const Eu=typeof window<"u"&&window.trustedTypes;if(Eu)try{Ro=Eu.createPolicy("vue",{createHTML:t=>t})}catch{}const $u=Ro?t=>Ro.createHTML(t):t=>t,iy="http://www.w3.org/2000/svg",sy="http://www.w3.org/1998/Math/MathML",Bt=typeof document<"u"?document:null,ku=Bt&&Bt.createElement("template"),oy={insert:(t,e,n)=>{e.insertBefore(t,n||null)},remove:t=>{const e=t.parentNode;e&&e.removeChild(t)},createElement:(t,e,n,r)=>{const i=e==="svg"?Bt.createElementNS(iy,t):e==="mathml"?Bt.createElementNS(sy,t):n?Bt.createElement(t,{is:n}):Bt.createElement(t);return t==="select"&&r&&r.multiple!=null&&i.setAttribute("multiple",r.multiple),i},createText:t=>Bt.createTextNode(t),createComment:t=>Bt.createComment(t),setText:(t,e)=>{t.nodeValue=e},setElementText:(t,e)=>{t.textContent=e},parentNode:t=>t.parentNode,nextSibling:t=>t.nextSibling,querySelector:t=>Bt.querySelector(t),setScopeId(t,e){t.setAttribute(e,"")},insertStaticContent(t,e,n,r,i,s){const o=n?n.previousSibling:e.lastChild;if(i&&(i===s||i.nextSibling))for(;e.insertBefore(i.cloneNode(!0),n),!(i===s||!(i=i.nextSibling)););else{ku.innerHTML=$u(r==="svg"?`<svg>${t}</svg>`:r==="mathml"?`<math>${t}</math>`:t);const a=ku.content;if(r==="svg"||r==="mathml"){const l=a.firstChild;for(;l.firstChild;)a.appendChild(l.firstChild);a.removeChild(l)}e.insertBefore(a,n)}return[o?o.nextSibling:e.firstChild,n?n.previousSibling:e.lastChild]}},ay=Symbol("_vtc");function ly(t,e,n){const r=t[ay];r&&(e=(e?[e,...r]:[...r]).join(" ")),e==null?t.removeAttribute("class"):n?t.setAttribute("class",e):t.className=e}const Fi=Symbol("_vod"),Cu=Symbol("_vsh"),cy={name:"show",beforeMount(t,{value:e},{transition:n}){t[Fi]=t.style.display==="none"?"":t.style.display,n&&e?n.beforeEnter(t):Sr(t,e)},mounted(t,{value:e},{transition:n}){n&&e&&n.enter(t)},updated(t,{value:e,oldValue:n},{transition:r}){!e!=!n&&(r?e?(r.beforeEnter(t),Sr(t,!0),r.enter(t)):r.leave(t,()=>{Sr(t,!1)}):Sr(t,e))},beforeUnmount(t,{value:e}){Sr(t,e)}};function Sr(t,e){t.style.display=e?t[Fi]:"none",t[Cu]=!e}const uy=Symbol(""),fy=/(?:^|;)\s*display\s*:/;function dy(t,e,n){const r=t.style,i=ke(n);let s=!1;if(n&&!i){if(e)if(ke(e))for(const o of e.split(";")){const a=o.slice(0,o.indexOf(":")).trim();n[a]==null&&Bi(r,a,"")}else for(const o in e)n[o]==null&&Bi(r,o,"");for(const o in n)o==="display"&&(s=!0),Bi(r,o,n[o])}else if(i){if(e!==n){const o=r[uy];o&&(n+=";"+o),r.cssText=n,s=fy.test(n)}}else e&&t.removeAttribute("style");Fi in t&&(t[Fi]=s?r.display:"",t[Cu]&&(r.display="none"))}const Ou=/\s*!important$/;function Bi(t,e,n){if(se(n))n.forEach(r=>Bi(t,e,r));else if(n==null&&(n=""),e.startsWith("--"))t.setProperty(e,n);else{const r=hy(t,e);Ou.test(n)?t.setProperty(Kt(r),n.replace(Ou,""),"important"):t[r]=n}}const Pu=["Webkit","Moz","ms"],No={};function hy(t,e){const n=No[e];if(n)return n;let r=Nt(e);if(r!=="filter"&&r in t)return No[e]=r;r=Ql(r);for(let i=0;i<Pu.length;i++){const s=Pu[i]+r;if(s in t)return No[e]=s}return e}const Au="http://www.w3.org/1999/xlink";function Iu(t,e,n,r,i,s=um(e)){r&&e.startsWith("xlink:")?n==null?t.removeAttributeNS(Au,e.slice(6,e.length)):t.setAttributeNS(Au,e,n):n==null||s&&!ec(n)?t.removeAttribute(e):t.setAttribute(e,s?"":Vt(n)?String(n):n)}function Tu(t,e,n,r,i){if(e==="innerHTML"||e==="textContent"){n!=null&&(t[e]=e==="innerHTML"?$u(n):n);return}const s=t.tagName;if(e==="value"&&s!=="PROGRESS"&&!s.includes("-")){const a=s==="OPTION"?t.getAttribute("value")||"":t.value,l=n==null?t.type==="checkbox"?"on":"":String(n);(a!==l||!("_value"in t))&&(t.value=l),n==null&&t.removeAttribute(e),t._value=n;return}let o=!1;if(n===""||n==null){const a=typeof t[e];a==="boolean"?n=ec(n):n==null&&a==="string"?(n="",o=!0):a==="number"&&(n=0,o=!0)}try{t[e]=n}catch{}o&&t.removeAttribute(i||e)}function py(t,e,n,r){t.addEventListener(e,n,r)}function my(t,e,n,r){t.removeEventListener(e,n,r)}const Ru=Symbol("_vei");function gy(t,e,n,r,i=null){const s=t[Ru]||(t[Ru]={}),o=s[e];if(r&&o)o.value=r;else{const[a,l]=yy(e);if(r){const u=s[e]=_y(r,i);py(t,a,u,l)}else o&&(my(t,a,o,l),s[e]=void 0)}}const Nu=/(?:Once|Passive|Capture)$/;function yy(t){let e;if(Nu.test(t)){e={};let r;for(;r=t.match(Nu);)t=t.slice(0,t.length-r[0].length),e[r[0].toLowerCase()]=!0}return[t[2]===":"?t.slice(3):Kt(t.slice(2)),e]}let Do=0;const vy=Promise.resolve(),by=()=>Do||(vy.then(()=>Do=0),Do=Date.now());function _y(t,e){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;$t(wy(r,n.value),e,5,[r])};return n.value=t,n.attached=by(),n}function wy(t,e){if(se(e)){const n=t.stopImmediatePropagation;return t.stopImmediatePropagation=()=>{n.call(t),t._stopped=!0},e.map(r=>i=>!i._stopped&&r&&r(i))}else return e}const Du=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>96&&t.charCodeAt(2)<123,xy=(t,e,n,r,i,s)=>{const o=i==="svg";e==="class"?ly(t,r,o):e==="style"?dy(t,n,r):ci(e)?Js(e)||gy(t,e,n,r,s):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):Sy(t,e,r,o))?(Tu(t,e,r),!t.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&Iu(t,e,r,o,s,e!=="value")):t._isVueCE&&(/[A-Z]/.test(e)||!ke(r))?Tu(t,Nt(e),r,s,e):(e==="true-value"?t._trueValue=r:e==="false-value"&&(t._falseValue=r),Iu(t,e,r,o))};function Sy(t,e,n,r){if(r)return!!(e==="innerHTML"||e==="textContent"||e in t&&Du(e)&&oe(n));if(e==="spellcheck"||e==="draggable"||e==="translate"||e==="autocorrect"||e==="form"||e==="list"&&t.tagName==="INPUT"||e==="type"&&t.tagName==="TEXTAREA")return!1;if(e==="width"||e==="height"){const i=t.tagName;if(i==="IMG"||i==="VIDEO"||i==="CANVAS"||i==="SOURCE")return!1}return Du(e)&&ke(n)?!1:e in t}const Ey=Le({patchProp:xy},oy);let Lu;function $y(){return Lu||(Lu=$g(Ey))}const ky=(...t)=>{const e=$y().createApp(...t),{mount:n}=e;return e.mount=r=>{const i=Oy(r);if(!i)return;const s=e._component;!oe(s)&&!s.render&&!s.template&&(s.template=i.innerHTML),i.nodeType===1&&(i.textContent="");const o=n(i,!1,Cy(i));return i instanceof Element&&(i.removeAttribute("v-cloak"),i.setAttribute("data-v-app","")),o},e};function Cy(t){if(t instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&t instanceof MathMLElement)return"mathml"}function Oy(t){return ke(t)?document.querySelector(t):t}const Lo=Symbol("IPEInjectKey"),Py=(t,e)=>(e?e.provide(Lo,t):Kc(Lo,t),t),Ay=()=>{const t=mr(Lo);if(!t)throw new Error("InPageEdit instance is not provided");return t},ht='@charset "UTF-8";:host{all:initial;font-family:var(--schema-font-family, ui-sans-serif, system-ui, -apple-system)}*,*:before,*:after{box-sizing:border-box}:host{color:var(--schema-color-fg, #111827)}:host{--schema-radius: var(--schema-radius, 10px)}.wrapper{display:block;background:var(--schema-color-bg, #ffffff)}.form{display:grid;gap:12px}.field{display:grid;gap:6px;padding:8px 10px;border:1px solid var(--schema-color-muted, #e5e7eb);border-radius:var(--schema-radius);background:var(--schema-surface, #fff)}.label{font-size:12px;color:var(--schema-color-muted-text, #6b7280)}.input,select,textarea{width:100%;padding:8px 10px;border-radius:8px;border:1px solid var(--schema-color-muted, #e5e7eb);background:var(--schema-input-bg, #fff);color:inherit}.checkbox{display:inline-flex;align-items:center;gap:8px}.helper{font-size:12px;color:var(--schema-color-muted-text, #6b7280)}.row{display:grid;gap:8px}.actions{display:flex;gap:8px}.btn{padding:6px 10px;border:1px solid var(--schema-color-muted, #e5e7eb);background:var(--schema-btn-bg, #f8fafc);border-radius:8px;cursor:pointer}.btn.primary{background:var(--schema-color-primary, #2563eb);color:#fff;border-color:transparent}.btn:disabled{opacity:.5;cursor:not-allowed}.btn.danger{background:var(--schema-color-danger, #dc2626);color:#fff;border-color:transparent}.group{display:grid;gap:10px;border-left:3px solid var(--schema-color-muted, #e5e7eb);padding-left:10px}.kv{display:grid;grid-template-columns:1fr 1fr auto;gap:8px;align-items:center}.badge{display:inline-flex;padding:2px 6px;border-radius:999px;font-size:11px;background:var(--schema-badge-bg, #eef2ff);color:var(--schema-badge-fg, #4f46e5)}.hidden{display:none!important}.toolbar{display:flex;gap:6px}.schema-collection-row{position:relative;transition:transform var(--schema-collection-transition-duration, .25s) var(--schema-collection-transition-ease, ease),opacity var(--schema-collection-transition-duration, .25s) var(--schema-collection-transition-ease, ease)}.schema-collection-row.enter{opacity:0}.schema-collection-row.enter.enter-active{opacity:1}.schema-collection-row.leaving{opacity:0}.field.schema-type-array .group,.field.schema-type-array .group .row{position:relative}';/**
|
|
108
108
|
* SchemaForm
|
|
109
109
|
* 一个基于 Schemastery 的 Web Components 表单生成器
|
|
110
110
|
*
|
|
@@ -121,5 +121,5 @@
|
|
|
121
121
|
* @license MIT
|
|
122
122
|
* @author dragon-fish
|
|
123
123
|
* @author @openai/gpt-5
|
|
124
|
-
*/const Du={arrayAdd:"+",arrayMoveUp:"↑",arrayMoveDown:"↓",arrayRemove:"×",dictAdd:"+",dictRemove:"×",rootLabel:"root"},Ee=(t,e)=>{customElements.get(t)||customElements.define(t,e)},Oy=(t,e,n)=>{if(!e.length)return;let r=t,i=null,s=null;for(let a=0;a<e.length-1;a++){const l=e[a];let u=r?.[l];u==null?(u=typeof e[a+1]=="number"?[]:{},r[l]=u):typeof u!="object"&&(u=typeof e[a+1]=="number"?[]:{},r[l]=u),i=r,s=l,r=u}const o=e[e.length-1];if(r==null||typeof r!="object"){const a=typeof o=="number"?[]:{};if(i)i[s]=a,r=a;else return}try{r[o]=n}catch{try{const a=Array.isArray(r)?r.slice():{...r};a[o]=n,i&&(i[s]=a)}catch{}}},Sr=t=>t.map(String).join("."),Py=t=>t.replace(/[^a-zA-Z0-9_-]/g,"_"),Qt=t=>`schema_${Py(Sr(t)||"root")}`,fn=t=>Sr(t);function Do(t,e){if(e==null)return e;switch(t){case"number":case"natural":case"percent":{if(e==="")return;const n=Number(e);return Number.isNaN(n)?void 0:n}case"boolean":return!!e;case"date":{if(!e)return;const n=new Date(e);return Number.isNaN(+n)?void 0:n}case"const":case"string":default:return e}}function Lu(t){return typeof t=="function"&&!!t?.type}function ju(t){if(!t)throw new Error("schema is required");if(Lu(t))return t;try{const e=Schema.from(t);if(Lu(e))return e}catch{}if(t?.type){const e=t.type;if(Schema[e])return Schema[e](t.inner??t.list??t.dict)}throw new Error("无法从传入对象生成 Schemastery 实例,请传入 schema 或 schema.toJSON() 的结果。")}function yt(t){return t?.meta??{}}function Ay(t){return t.length>0&&t.every(e=>e?.type==="const")}function Tn(t){if(!t)return;const e=t,n=e.meta||{};if(Object.prototype.hasOwnProperty.call(n,"default"))return n.default;const r=e.type;try{const i=t();if(i!==void 0)return i}catch{}switch(r){case"string":return"";case"number":case"natural":case"percent":return 0;case"boolean":return!1;case"array":return[];case"tuple":return[];case"object":return{};case"dict":return{};case"union":{const i=e.list||[];return i.length?Tn(i[0]):void 0}case"const":return e.value;case"date":return;default:return}}class Ot extends HTMLElement{constructor(){super(),this._path=[],this._i18n=Du,this.$root=this.attachShadow({mode:"open"});const e=document.createElement("style");e.textContent=ft,this.$root.appendChild(e)}makeFieldContainer(e,n){const r=document.createElement("div");if(r.className=`field schema-form-item schema-type-${e}`,r.setAttribute("data-path",Sr(this._path)),this._label){const i=document.createElement("label");i.className="label",i.textContent=this._label,r.appendChild(i)}if(n){const i=document.createElement("div");i.className="helper",i.textContent=n,r.appendChild(i)}return r}set schema(e){this._schema=ju(e),this.render()}get schema(){return this._schema}set path(e){this._path=e??[],this.render()}get path(){return this._path}set label(e){this._label=e,this.render()}get label(){return this._label}set i18n(e){e&&(this._i18n={...this._i18n,...e}),this.render()}get i18n(){return this._i18n}setValue(e){this._value=e,this.render()}getValue(){return this._value}emitChange(e){this._value=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{path:this._path,value:e}}))}}class Mu extends Ot{render(){if(this.$input&&this.$root.contains(this.$input)){const s=this._value??"";this.$input.value!==s&&document.activeElement!==this.$input&&(this.$input.value=s);return}this.$root.innerHTML=`<style>${ft}</style>`;const e=yt(this._schema),n=this.makeFieldContainer("string",e.description),r=document.createElement("input");this.$input=r,r.className="input",r.type="text",r.name=fn(this._path),r.id=Qt(this._path),e?.pattern?.source&&(r.pattern=e.pattern.source),e?.max!=null&&(r.maxLength=e.max),r.value=this._value??"",r.oninput=()=>this.emitChange(Do("string",r.value));const i=n.querySelector("label.label");i&&(i.htmlFor=r.id),n.appendChild(r),this.$root.appendChild(n)}}Ee("schema-form-string",Mu);class Fu extends Ot{render(){if(this.$input&&this.$root.contains(this.$input)){const o=this._value??"";this.$input.value!==String(o)&&document.activeElement!==this.$input&&(this.$input.value=o);return}this.$root.innerHTML=`<style>${ft}</style>`;const e=this._schema?.type??"number",n=yt(this._schema),r=this.makeFieldContainer("number",n.description),i=document.createElement("input");this.$input=i,i.className="input",i.name=fn(this._path),i.id=Qt(this._path),n?.min!=null&&(i.min=String(n.min)),n?.max!=null&&(i.max=String(n.max)),n?.step!=null&&(i.step=String(n.step)),e==="percent"&&!i.step&&(i.step="0.01"),i.value=this._value??"",i.oninput=()=>this.emitChange(Do(e,i.value));const s=r.querySelector("label.label");s&&(s.htmlFor=i.id),n.role==="slider"?i.type="range":i.type="number",r.appendChild(i),this.$root.appendChild(r)}}Ee("schema-form-number",Fu);class Bu extends Ot{render(){this.$root.innerHTML=`<style>${ft}</style>`;const e=yt(this._schema),n=this.makeFieldContainer("boolean",e.description),r=document.createElement("label");r.className="checkbox";const i=document.createElement("input");i.type="checkbox",i.checked=!!this._value,i.name=fn(this._path),i.id=Qt(this._path);const s=document.createElement("span");s.textContent=this._label??"",i.onchange=()=>this.emitChange(i.checked);const o=n.querySelector("label.label");o&&(o.htmlFor=i.id),r.append(i,s),n.appendChild(r),this.$root.appendChild(n)}}Ee("schema-form-boolean",Bu);function Fi(t){return String(t).padStart(2,"0")}function Er(t){return`${t.getFullYear()}-${Fi(t.getMonth()+1)}-${Fi(t.getDate())}`}function Lo(t){return`${Fi(t.getHours())}:${Fi(t.getMinutes())}`}function Bi(t){return`${Er(t)}T${Lo(t)}`}class Uu extends Ot{render(){if(this.$input&&this.$root.contains(this.$input)){const o=yt(this._schema).role||"date";if(document.activeElement!==this.$input)if(this._value instanceof Date)o==="date"?this.$input.value=Er(this._value):o==="time"?this.$input.value=Lo(this._value):o==="datetime"&&(this.$input.value=Bi(this._value));else if(typeof this._value=="string"&&o!=="time"){const a=new Date(this._value);isNaN(+a)||(o==="date"?this.$input.value=Er(a):o==="datetime"&&(this.$input.value=Bi(a)))}else this._value||(this.$input.value="");return}this.$root.innerHTML=`<style>${ft}</style>`;const e=yt(this._schema),n=this.makeFieldContainer("date",e.description),r=document.createElement("input");this.$input=r,r.className="input";const i=e.role||"date";if(i==="datetime"?r.type="datetime-local":i==="time"?r.type="time":r.type="date",r.name=fn(this._path),r.id=Qt(this._path),this._value instanceof Date)i==="date"?r.value=Er(this._value):i==="time"?r.value=Lo(this._value):i==="datetime"&&(r.value=Bi(this._value));else if(typeof this._value=="string"&&i!=="time"){const o=new Date(this._value);isNaN(+o)||(i==="date"?r.value=Er(o):i==="datetime"&&(r.value=Bi(o)))}r.oninput=()=>{e.role;let o;if(!r.value)o=void 0;else{const a=new Date(r.value);o=Number.isNaN(+a)?void 0:a}this.emitChange(o)};const s=n.querySelector("label.label");s&&(s.htmlFor=r.id),n.appendChild(r),this.$root.appendChild(n)}}Ee("schema-form-date",Uu);class Hu extends Ot{render(){this.$root.innerHTML=`<style>${ft}</style>`;const e=yt(this._schema),n=this._schema.value;if(e.role==="raw-html"){if(n instanceof Node){this.$root.appendChild(n);return}const o=document.createElement("div");o.innerHTML=String(n),this.$root.appendChild(o);return}const r=this.makeFieldContainer("const",e.description),i=document.createElement("section");i.className="const content",i.textContent=String(n),i.id=Qt(this._path);const s=r.querySelector("label.label");s&&(s.htmlFor=i.id),r.appendChild(i),this.$root.appendChild(r)}}Ee("schema-form-const",Hu);function Iy(t){switch(t.type){case"string":return"schema-form-string";case"number":case"natural":case"percent":return"schema-form-number";case"boolean":return"schema-form-boolean";case"date":return"schema-form-date";case"const":return"schema-form-const";case"array":return"schema-form-array";case"object":return"schema-form-object";case"tuple":return"schema-form-tuple";case"dict":return"schema-form-dict";case"union":{const e=t.list||[];return e.length===2&&e[0]?.type==="is"&&e[0]?.constructor===Date&&e[1]?.type==="transform"&&(e[1]?.inner?.meta?.role==="datetime"||e[1]?.inner?.meta?.role==="date"||e[1]?.inner?.meta?.role==="time")?"schema-form-date":"schema-form-union"}default:return"schema-form-string"}}function Rn(t,e,n,r,i){const s=Iy(t),o=document.createElement(s);return o.schema=t,o.path=e,o.label=r,i&&(o.i18n=i),o.setValue?.(n),o}class qu extends Ot{render(){this.$root.innerHTML=`<style>${ft}</style>`;const e=yt(this._schema),n=this.makeFieldContainer("union",e.description),r=this._schema.list||[];if(Ay(r)){const i=document.createElement("select");i.className="input",i.name=fn(this._path),i.id=Qt(this._path),r.forEach(o=>{const a=document.createElement("option");a.value=String(o.value),a.textContent=String(o.value),this._value===o.value&&(a.selected=!0),i.appendChild(a)}),i.onchange=()=>this.emitChange(Do("string",i.value));const s=n.querySelector("label.label");s&&(s.htmlFor=i.id),n.appendChild(i)}else{const i=document.createElement("div");i.className="toolbar";const s=document.createElement("select");s.className="input",s.name=fn(this._path)+".__type",s.id=Qt(this._path)+"__type";let o=0;r.forEach((c,f)=>{const b=document.createElement("option");b.value=String(f),b.textContent=c.type,s.appendChild(b)}),s.onchange=()=>{o=Number(s.value);const c=r[o],f=Tn(c);this.emitChange(f),u()};const a=n.querySelector("label.label");a&&(a.htmlFor=s.id),i.appendChild(s),n.appendChild(i);const l=document.createElement("div");l.className="group";const u=()=>{l.innerHTML="";const c=r[o],f=Rn(c,this._path,this._value,this._label);f.addEventListener("change",b=>{b.stopPropagation(),this.emitChange(b.detail.value)}),l.appendChild(f)};u(),n.appendChild(l)}this.$root.appendChild(n)}}Ee("schema-form-union",qu);class Wu extends Ot{render(){this.$root.innerHTML=`<style>${ft}</style>`;const e=yt(this._schema),n=this.makeFieldContainer("tuple",e.description),r=document.createElement("div");r.className="group";const i=Array.isArray(this._value)?this._value:[];(this._schema.list||[]).forEach((s,o)=>{const a=Rn(s,[...this._path,o],i[o],`${this._label??""}[${o}]`);a.addEventListener("change",l=>{l.stopPropagation();const u=Array.isArray(this._value)?this._value.slice():[];u[o]=l.detail.value,this.emitChange(u)}),r.appendChild(a)}),n.appendChild(r),this.$root.appendChild(n)}}Ee("schema-form-tuple",Wu);class zu extends Ot{render(){this.$root.innerHTML=`<style>${ft}</style>`;const e=yt(this._schema),n=this.makeFieldContainer("object",e.description),r=document.createElement("div");r.className="group";const i=this._schema.dict||{};Object.keys(i).forEach(s=>{if(i[s]?.meta?.hidden)return;const o=(this._value??{})[s],a=Rn(i[s],[...this._path,s],o,s);a.addEventListener("change",l=>{l.stopPropagation();const u={...this._value??{}};u[s]=l.detail.value,this.emitChange(u)}),r.appendChild(a)}),n.appendChild(r),this.$root.appendChild(n)}}Ee("schema-form-object",zu);const zi=class zi extends Ot{constructor(){super(...arguments),this._itemIds=[]}generateItemId(){try{if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID()}catch{}return"i"+zi._idCounter++}ensureItemIds(e){for(;this._itemIds.length<e;)this._itemIds.push(this.generateItemId());this._itemIds.length>e&&(this._itemIds.length=e)}capturePositions(e){const n={};return e.querySelectorAll(".row").forEach(r=>{const i=r.dataset.uid;i&&(n[i]=r.getBoundingClientRect())}),n}playFLIP(e,n){Array.from(e.querySelectorAll(".row")).forEach(r=>{const i=r.dataset.uid;if(!i)return;const s=n[i];if(!s)return;const o=r.getBoundingClientRect(),a=s.left-o.left,l=s.top-o.top;(a||l)&&(r.style.transition="none",r.style.transform=`translate(${a}px, ${l}px)`,requestAnimationFrame(()=>{r.style.transition="transform .25s ease",r.style.transform=""}))})}render(){this.$root.innerHTML=`<style>${ft}</style>`;const e=yt(this._schema),n=this.makeFieldContainer("array",e.description),r=document.createElement("div");r.className="group";const i=this._schema.inner,s=()=>Array.isArray(this._value)?this._value:[];this.ensureItemIds(s().length);const o=(u,c)=>{r.innerHTML="",s().forEach((f,b)=>{const y=[...this._path,b],v=document.createElement("div");v.className="row schema-collection-row";const A=this._itemIds[b];v.dataset.uid=A,v.setAttribute("data-path",Sr(y));const U=Rn(i,y,f,`${this._label??""}[${b}]`);U.addEventListener("change",h=>{h.stopPropagation();const x=s().slice();x[b]=h.detail.value,this._value=x,this.emitChange(x)});const D=document.createElement("div");D.className="actions";const I=document.createElement("button");I.type="button",I.className="btn",I.textContent=this._i18n.arrayMoveUp??"↑",I.onclick=()=>{if(b<=0)return;const h=this.capturePositions(r),x=s().slice();[x[b-1],x[b]]=[x[b],x[b-1]],[this._itemIds[b-1],this._itemIds[b]]=[this._itemIds[b],this._itemIds[b-1]],this._value=x,o(h),this.emitChange(x)};const g=document.createElement("button");g.type="button",g.className="btn",g.textContent=this._i18n.arrayMoveDown??"↓",g.onclick=()=>{const h=s();if(b>=h.length-1)return;const x=this.capturePositions(r),P=h.slice();[P[b+1],P[b]]=[P[b],P[b+1]],[this._itemIds[b+1],this._itemIds[b]]=[this._itemIds[b],this._itemIds[b+1]],this._value=P,o(x),this.emitChange(P)};const p=document.createElement("button");p.type="button",p.className="btn danger",p.textContent=this._i18n.arrayRemove??"×",p.onclick=()=>{v.classList.add("leaving");const h=250;let x=!1;const P=()=>{if(x)return;x=!0,clearTimeout(R);const W=s().filter((Ce,Te)=>Te!==b);this._itemIds.splice(b,1);const X=this.capturePositions(r);this._value=W,o(X),this.emitChange(W)};v.addEventListener("transitionend",P,{once:!0});const R=setTimeout(P,h+80)},D.append(I,g,p),v.appendChild(U),v.appendChild(D),r.appendChild(v),c&&c===A&&(v.classList.add("enter"),requestAnimationFrame(()=>{v.classList.add("enter-active")}),requestAnimationFrame(()=>{v.classList.remove("enter")}))}),u&&this.playFLIP(r,u)};o();const a=document.createElement("button");a.type="button",a.className="btn primary",a.textContent=this._i18n.arrayAdd??"+",a.onclick=()=>{const u=this.capturePositions(r),c=s().slice(),f=Tn(i);c.push(f);const b=this.generateItemId();this._itemIds.push(b),this._value=c,o(u,b),this.emitChange(c)};const l=document.createElement("div");l.className="actions",l.appendChild(a),n.appendChild(r),n.appendChild(l),this.$root.appendChild(n)}};zi._idCounter=0;let Ui=zi;Ee("schema-form-array",Ui);class Vu extends Ot{render(){this.$root.innerHTML=`<style>${ft}</style>`;const e=yt(this._schema),n=this.makeFieldContainer("dict",e.description),r=document.createElement("div");r.className="group";const i=this._schema.inner,s=this._value??{},o=b=>`d_${b}`,a=()=>{const b={};return r.querySelectorAll(".kv").forEach(y=>{const v=y.dataset.uid;v&&(b[v]=y.getBoundingClientRect())}),b},l=b=>{r.querySelectorAll(".kv").forEach(y=>{const v=y.dataset.uid;if(!v)return;const A=b[v];if(!A)return;const U=y.getBoundingClientRect(),D=A.left-U.left,I=A.top-U.top;(D||I)&&(y.style.transition="none",y.style.transform=`translate(${D}px, ${I}px)`,requestAnimationFrame(()=>{y.style.transition="transform .25s ease",y.style.transform=""}))})},u=(b,y)=>{r.innerHTML="",Object.keys(s).forEach(v=>{const A=[...this._path,v],U=document.createElement("div");U.className="kv schema-collection-row",U.dataset.uid=o(v),U.setAttribute("data-path",Sr(A));const D=document.createElement("input");D.className="input",D.value=v,D.name=fn(A)+".__key",D.id=Qt(A)+"__key";const I=Rn(i,A,s[v],`${this._label??""}[${v}]`),g=document.createElement("button");g.type="button",g.className="btn danger",g.textContent=this._i18n.dictRemove??"×",g.onclick=()=>{const p=a();delete s[v];const h={...this._value??{}};delete h[v],this._value=h,u(p),this.emitChange(h)},D.onchange=()=>{const p=D.value.trim();if(!p||p===v||s[p]!==void 0)return;const h=a();s[p]=s[v],delete s[v];const x={...this._value??{}};x[p]=x[v],delete x[v],this._value=x,u(h),this.emitChange(x)},I.addEventListener("change",p=>{p.stopPropagation();const h={...this._value??{}};h[v]=p.detail.value,this._value=h,this.emitChange(h)}),U.append(D,I,g),r.appendChild(U),y===v&&(U.classList.add("enter"),requestAnimationFrame(()=>U.classList.add("enter-active")),requestAnimationFrame(()=>U.classList.remove("enter")))}),b&&l(b)};u();const c=document.createElement("button");c.type="button",c.className="btn primary",c.textContent=this._i18n.dictAdd??"+",c.onclick=()=>{let b=Object.keys(s).length+1,y=`k${b}`;for(;s[y]!==void 0;)y=`k${++b}`;const v=a();s[y]=Tn(i);const A={...this._value??{},[y]:s[y]};this._value=A,u(v,y),this.emitChange(A)};const f=document.createElement("div");f.className="actions",f.appendChild(c),n.appendChild(r),n.appendChild(f),this.$root.appendChild(n)}}Ee("schema-form-dict",Vu);class Ku extends HTMLElement{constructor(){super(),this._i18n={...Du},this.$root=this.attachShadow({mode:"open"});const e=document.createElement("style");e.textContent=ft,this.$root.appendChild(e);const n=document.createElement("div");n.className="wrapper",n.innerHTML='<form class="form" part="form"></form>',this.$root.appendChild(n),this.addEventListener("change",r=>{if(!r?.detail)return;const{path:i,value:s}=r.detail;Array.isArray(i)&&i.length===0?this._state=s:Oy(this._state??(this._state={}),i,s),this.dispatchEvent(new CustomEvent("form-change",{detail:{path:i,value:s,state:this._state}}))})}set schema(e){this._schema=ju(e);try{this._state=this._schema(null,{autofix:!0})}catch{this._state=Tn(this._schema)}this.render()}get schema(){return this._schema}set schemaJSON(e){this.schema=e}get schemaJSON(){return this._schema?.toJSON?.()}setData(e,n={validate:!0,autofix:!0}){if(!this._schema)throw new Error("请先设置 schema");const r=n.validate?this._schema(e??null,{autofix:n.autofix}):e;this._state=r,this.render()}getData(e={validate:!0,autofix:!0}){if(!this._schema)throw new Error("请先设置 schema");const n=this._state;return e.validate?this._schema(n??null,{autofix:e.autofix}):n}reset(){try{this._state=this._schema(null,{autofix:!0})}catch{this._state=Tn(this._schema)}this.render()}refresh(){this.render()}set i18n(e){this._i18n={...this._i18n,...e},this.render()}get i18n(){return this._i18n}render(){if(!this._schema)return;const e=this.$root.querySelector("form");e.innerHTML="";const n=Rn(this._schema,[],this._state,this._i18n.rootLabel,this._i18n);e.appendChild(n)}}Ee("schema-form",Ku);function Ty(){Ee("schema-form",Ku),Ee("schema-form-string",Mu),Ee("schema-form-number",Fu),Ee("schema-form-boolean",Bu),Ee("schema-form-date",Uu),Ee("schema-form-const",Hu),Ee("schema-form-union",qu),Ee("schema-form-tuple",Wu),Ee("schema-form-object",zu),Ee("schema-form-array",Ui),Ee("schema-form-dict",Vu)}const Ry=Pc({__name:"SchemasteryFormVue",props:Mc({schema:{},value:{},validateOnChange:{type:Boolean,default:!1}},{schema:{required:!0},schemaModifiers:{},value:{required:!1,default:{}},valueModifiers:{}}),emits:Mc(["change"],["update:schema","update:value"]),setup(t,{expose:e,emit:n}){const r=su(t,"schema"),i=su(t,"value"),s=n,o=Qm("elRef");let a=!1,l=!1;const u=c=>{if(l)return;const f=o.value,b=t.validateOnChange?f.getData({validate:!0}):c.detail.state;a=!0,i.value=b,$i(()=>{a=!1}),s("change",c.detail)};return Nc(()=>{Ty()}),vo(()=>{const c=o.value;r.value&&(c.schema=r.value),i.value!==void 0&&c.setData(i.value,{validate:!1,autofix:!0}),c.addEventListener("form-change",u)}),Dc(()=>{o.value?.removeEventListener("form-change",u)}),mr(()=>r,c=>{a||o.value&&c&&o.value.schema!==c.value&&(l=!0,o.value.schema=c.value,$i(()=>{l=!1}))},{deep:!0,immediate:!0}),mr(()=>i,c=>{if(a||!o.value||c.value===void 0)return;const f=o.value.getData({validate:!1});JSON.stringify(f)!==JSON.stringify(c.value)&&(l=!0,o.value.setData(c.value,{validate:!1}),$i(()=>{l=!1}))},{deep:!0,immediate:!0}),e({setData(c,f){const b=o.value;b.setData(c,{validate:!!f?.validate}),f?.emit&&(i.value=b.getData({validate:!!f?.validate}))},getData(c){return o.value.getData(c)},setSchema(c,f=!0){o.value.schema=c,f&&(r.value=c)},refresh(){o.value.refresh()},reset(){o.value.reset()},el:o}),(c,f)=>(An(),vr("schema-form",mu({ref_key:"elRef",ref:o},c.$attrs),null,16))}});function dn(t,e=new WeakMap){if(Ne(t))return dn(t.value,e);if(t===null||typeof t!="object")return t;if(e.has(t))return e.get(t);if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(t instanceof Map){const i=new Map;return e.set(t,i),Array.from(t.entries()).forEach(([s,o])=>{i.set(s,dn(o,e))}),i}if(t instanceof Set){const i=new Set;return e.set(t,i),Array.from(t).forEach(s=>{i.add(dn(s,e))}),i}if(Array.isArray(t)){const i=[];e.set(t,i);for(const s of t)i.push(dn(s,e));return i}const n=fe(t),r={};e.set(t,r);for(const i of Object.keys(n))r[i]=dn(n[i],e);for(const i of Object.getOwnPropertySymbols(n))r[i]=dn(n[i],e);return r}const Ny={class:"preferences-ui-app"},Dy={class:"tabs"},Ly=["onClick","data-value"],jy={style:{"max-height":"20em",overflow:"auto"}},My={style:{"max-height":"20em",overflow:"auto"}},Fy=((t,e)=>{const n=t.__vccOpts||t;for(const[r,i]of e)n[r]=i;return n})(Pc({__name:"PreferencesForm",setup(t,{expose:e}){const n=Cy(),r=_i([]),i=_i(""),s=wu(()=>a.value.find(l=>l.category===i.value)?.schema),o=_i({}),a=_i([]);return e({getValue(){return dn(o)}}),Og(()=>{i.value&&(a.value=n.preferences.getConfigRegistries(i.value))}),vo(async()=>{n.inject(["preferences"],async l=>{o.value=await l.preferences.getAll(),r.value=l.preferences.getConfigCategories(),i.value=r.value[0].name})}),(l,u)=>(An(),vr("div",Ny,[Mt("div",Dy,[(An(!0),vr(gt,null,jc(r.value,c=>(An(),vr("a",{class:fi(["tab",{active:i.value===c.name}]),key:c.name,onClick:f=>i.value=c.name,"data-value":c.name},di(c.label),11,Ly))),128))]),(An(!0),vr(gt,null,jc(a.value,c=>Km((An(),Fg(_c(Ry),{key:c.name,schema:c.schema,value:o.value,"onUpdate:value":u[0]||(u[0]=f=>o.value=f),"validate-on-change":!1,i18n:{rootLabel:""}},null,8,["schema","value"])),[[oy,i.value===c.category]])),128)),Mt("details",null,[u[1]||(u[1]=Mt("summary",null,"Debug Info",-1)),u[2]||(u[2]=Mt("h3",null,"Active Schema",-1)),Mt("pre",jy,di(s.value?.toJSON()),1),u[3]||(u[3]=Mt("h3",null,"Value",-1)),Mt("pre",My,di(o.value),1)])]))}}),[["__scopeId","data-v-1f988771"]]);var By=Object.create,jo=Object.defineProperty,Uy=Object.getOwnPropertyDescriptor,Yu=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Gu=t=>{throw TypeError(t)},Hy=(t,e,n)=>e in t?jo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,qy=(t,e)=>jo(t,"name",{value:e,configurable:!0}),Wy=t=>[,,,By(t?.[Yu("metadata")]??null)],zy=["class","method","getter","setter","accessor","field","value","get","set"],Ju=t=>t!==void 0&&typeof t!="function"?Gu("Function expected"):t,Vy=(t,e,n,r,i)=>({kind:zy[t],name:e,metadata:r,addInitializer:s=>n._?Gu("Already initialized"):i.push(Ju(s||null))}),Ky=(t,e)=>Hy(e,Yu("metadata"),t[3]),Yy=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},Gy=(t,e,n,r,i,s)=>{var o,a,l,u=e&7,c=!1,f=0,b=t[f]||(t[f]=[]),y=u&&(i=i.prototype,u<5&&(u>3||!c)&&Uy(i,n));qy(i,n);for(var v=r.length-1;v>=0;v--)l=Vy(u,n,a={},t[3],b),o=(0,r[v])(i,l),a._=1,Ju(o)&&(i=o);return Ky(t,i),y&&jo(i,n,y),c?u^4?s:y:i},Qu,Mo,Xu;Qu=[Ye(["preferences","modal"])];class Hi extends(Xu=_t){constructor(e){super(e,{},"preferences-ui"),this.ctx=e,e.set("preferencesUI",this),e.inject(["toolbox"],n=>{n.toolbox.addButton({id:"preferences",icon:C("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"icon icon-tabler icons-tabler-filled icon-tabler-settings",children:[C("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),C("path",{d:"M14.647 4.081a.724 .724 0 0 0 1.08 .448c2.439 -1.485 5.23 1.305 3.745 3.744a.724 .724 0 0 0 .447 1.08c2.775 .673 2.775 4.62 0 5.294a.724 .724 0 0 0 -.448 1.08c1.485 2.439 -1.305 5.23 -3.744 3.745a.724 .724 0 0 0 -1.08 .447c-.673 2.775 -4.62 2.775 -5.294 0a.724 .724 0 0 0 -1.08 -.448c-2.439 1.485 -5.23 -1.305 -3.745 -3.744a.724 .724 0 0 0 -.447 -1.08c-2.775 -.673 -2.775 -4.62 0 -5.294a.724 .724 0 0 0 .448 -1.08c-1.485 -2.439 1.305 -5.23 3.744 -3.745a.722 .722 0 0 0 1.08 -.447c.673 -2.775 4.62 -2.775 5.294 0zm-2.647 4.919a3 3 0 1 0 0 6a3 3 0 0 0 0 -6z"})]}),tooltip:"Open preferences",group:"group2",index:1/0,onClick:()=>this.showModal()}),this.addDisposeHandler(()=>{n.toolbox.removeButton("preferences")})})}showModal(){const e=this.ctx.modal.show({className:"ipe-preference compact-buttons",sizeClass:"small",outSideClose:!1,center:!0,title:"InPageEdit Prefrences",content:C(Qn,{children:C(sn,{})})});e.get$window().classList.add("dialog");const n=C("div",{id:"ipe-preferences-app",style:{minHeight:"65vh"}});e.setContent(n);const r=this.createFormApp(),i=r.mount(n);e.setButtons([{label:"Save",className:"is-primary is-ghost",method:()=>{const s=i.getValue();Object.entries(s).forEach(([o,a])=>{this.ctx.preferences.set(o,a).catch(console.error)}),e.close()}},{label:"Cancel",className:"is-danger is-ghost",method:()=>{e.close()}}]),e.on(e.Event.Close,()=>{this.logger.log("preferences modal closed, vue app unmounting"),r.unmount()})}createFormApp(){const e=Sy(Fy);return ky(this.ctx,e),e}}Mo=Wy(Xu),Hi=Gy(Mo,0,"PluginPreferencesUI",Qu,Hi),Yy(Mo,1,Hi);const Jy=Object.freeze(Object.defineProperty({__proto__:null,get PluginPreferencesUI(){return Hi}},Symbol.toStringTag,{value:"Module"}));le.BasePlugin=_t,le.InPageEdit=on,le.Inject=Ye,le.Logger=Mr,le.LoggerLevel=os,le.Schema=xe,le.Service=yn,le.createLogger=ua,Object.defineProperty(le,Symbol.toStringTag,{value:"Module"})});
|
|
124
|
+
*/const ju={arrayAdd:"+",arrayMoveUp:"↑",arrayMoveDown:"↓",arrayRemove:"×",dictAdd:"+",dictRemove:"×",rootLabel:"root"},Ee=(t,e)=>{customElements.get(t)||customElements.define(t,e)},Iy=(t,e,n)=>{if(!e.length)return;let r=t,i=null,s=null;for(let a=0;a<e.length-1;a++){const l=e[a];let u=r?.[l];u==null?(u=typeof e[a+1]=="number"?[]:{},r[l]=u):typeof u!="object"&&(u=typeof e[a+1]=="number"?[]:{},r[l]=u),i=r,s=l,r=u}const o=e[e.length-1];if(r==null||typeof r!="object"){const a=typeof o=="number"?[]:{};if(i)i[s]=a,r=a;else return}try{r[o]=n}catch{try{const a=Array.isArray(r)?r.slice():{...r};a[o]=n,i&&(i[s]=a)}catch{}}},Er=t=>t.map(String).join("."),Ty=t=>t.replace(/[^a-zA-Z0-9_-]/g,"_"),Xt=t=>`schema_${Ty(Er(t)||"root")}`,dn=t=>Er(t);function jo(t,e){if(e==null)return e;switch(t){case"number":case"natural":case"percent":{if(e==="")return;const n=Number(e);return Number.isNaN(n)?void 0:n}case"boolean":return!!e;case"date":{if(!e)return;const n=new Date(e);return Number.isNaN(+n)?void 0:n}case"const":case"string":default:return e}}function Mu(t){return typeof t=="function"&&!!t?.type}function Fu(t){if(!t)throw new Error("schema is required");if(Mu(t))return t;try{const e=Schema.from(t);if(Mu(e))return e}catch{}if(t?.type){const e=t.type;if(Schema[e])return Schema[e](t.inner??t.list??t.dict)}throw new Error("无法从传入对象生成 Schemastery 实例,请传入 schema 或 schema.toJSON() 的结果。")}function bt(t){return t?.meta??{}}function Ry(t){return t.length>0&&t.every(e=>e?.type==="const")}function Rn(t){if(!t)return;const e=t,n=e.meta||{};if(Object.prototype.hasOwnProperty.call(n,"default"))return n.default;const r=e.type;try{const i=t();if(i!==void 0)return i}catch{}switch(r){case"string":return"";case"number":case"natural":case"percent":return 0;case"boolean":return!1;case"array":return[];case"tuple":return[];case"object":return{};case"dict":return{};case"union":{const i=e.list||[];return i.length?Rn(i[0]):void 0}case"const":return e.value;case"date":return;default:return}}class Pt extends HTMLElement{constructor(){super(),this._path=[],this._i18n=ju,this.$root=this.attachShadow({mode:"open"});const e=document.createElement("style");e.textContent=ht,this.$root.appendChild(e)}makeFieldContainer(e,n){const r=document.createElement("div");if(r.className=`field schema-form-item schema-type-${e}`,r.setAttribute("data-path",Er(this._path)),this._label){const i=document.createElement("label");i.className="label",i.textContent=this._label,r.appendChild(i)}if(n){const i=document.createElement("div");i.className="helper",i.textContent=n,r.appendChild(i)}return r}set schema(e){this._schema=Fu(e),this.render()}get schema(){return this._schema}set path(e){this._path=e??[],this.render()}get path(){return this._path}set label(e){this._label=e,this.render()}get label(){return this._label}set i18n(e){e&&(this._i18n={...this._i18n,...e}),this.render()}get i18n(){return this._i18n}setValue(e){this._value=e,this.render()}getValue(){return this._value}emitChange(e){this._value=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{path:this._path,value:e}}))}}class Bu extends Pt{render(){if(this.$input&&this.$root.contains(this.$input)){const s=this._value??"";this.$input.value!==s&&document.activeElement!==this.$input&&(this.$input.value=s);return}this.$root.innerHTML=`<style>${ht}</style>`;const e=bt(this._schema),n=this.makeFieldContainer("string",e.description),r=document.createElement("input");this.$input=r,r.className="input",r.type="text",r.name=dn(this._path),r.id=Xt(this._path),e?.pattern?.source&&(r.pattern=e.pattern.source),e?.max!=null&&(r.maxLength=e.max),r.value=this._value??"",r.oninput=()=>this.emitChange(jo("string",r.value));const i=n.querySelector("label.label");i&&(i.htmlFor=r.id),n.appendChild(r),this.$root.appendChild(n)}}Ee("schema-form-string",Bu);class Uu extends Pt{render(){if(this.$input&&this.$root.contains(this.$input)){const o=this._value??"";this.$input.value!==String(o)&&document.activeElement!==this.$input&&(this.$input.value=o);return}this.$root.innerHTML=`<style>${ht}</style>`;const e=this._schema?.type??"number",n=bt(this._schema),r=this.makeFieldContainer("number",n.description),i=document.createElement("input");this.$input=i,i.className="input",i.name=dn(this._path),i.id=Xt(this._path),n?.min!=null&&(i.min=String(n.min)),n?.max!=null&&(i.max=String(n.max)),n?.step!=null&&(i.step=String(n.step)),e==="percent"&&!i.step&&(i.step="0.01"),i.value=this._value??"",i.oninput=()=>this.emitChange(jo(e,i.value));const s=r.querySelector("label.label");s&&(s.htmlFor=i.id),n.role==="slider"?i.type="range":i.type="number",r.appendChild(i),this.$root.appendChild(r)}}Ee("schema-form-number",Uu);class Hu extends Pt{render(){this.$root.innerHTML=`<style>${ht}</style>`;const e=bt(this._schema),n=this.makeFieldContainer("boolean",e.description),r=document.createElement("label");r.className="checkbox";const i=document.createElement("input");i.type="checkbox",i.checked=!!this._value,i.name=dn(this._path),i.id=Xt(this._path);const s=document.createElement("span");s.textContent=this._label??"",i.onchange=()=>this.emitChange(i.checked);const o=n.querySelector("label.label");o&&(o.htmlFor=i.id),r.append(i,s),n.appendChild(r),this.$root.appendChild(n)}}Ee("schema-form-boolean",Hu);function Ui(t){return String(t).padStart(2,"0")}function $r(t){return`${t.getFullYear()}-${Ui(t.getMonth()+1)}-${Ui(t.getDate())}`}function Mo(t){return`${Ui(t.getHours())}:${Ui(t.getMinutes())}`}function Hi(t){return`${$r(t)}T${Mo(t)}`}class qu extends Pt{render(){if(this.$input&&this.$root.contains(this.$input)){const o=bt(this._schema).role||"date";if(document.activeElement!==this.$input)if(this._value instanceof Date)o==="date"?this.$input.value=$r(this._value):o==="time"?this.$input.value=Mo(this._value):o==="datetime"&&(this.$input.value=Hi(this._value));else if(typeof this._value=="string"&&o!=="time"){const a=new Date(this._value);isNaN(+a)||(o==="date"?this.$input.value=$r(a):o==="datetime"&&(this.$input.value=Hi(a)))}else this._value||(this.$input.value="");return}this.$root.innerHTML=`<style>${ht}</style>`;const e=bt(this._schema),n=this.makeFieldContainer("date",e.description),r=document.createElement("input");this.$input=r,r.className="input";const i=e.role||"date";if(i==="datetime"?r.type="datetime-local":i==="time"?r.type="time":r.type="date",r.name=dn(this._path),r.id=Xt(this._path),this._value instanceof Date)i==="date"?r.value=$r(this._value):i==="time"?r.value=Mo(this._value):i==="datetime"&&(r.value=Hi(this._value));else if(typeof this._value=="string"&&i!=="time"){const o=new Date(this._value);isNaN(+o)||(i==="date"?r.value=$r(o):i==="datetime"&&(r.value=Hi(o)))}r.oninput=()=>{e.role;let o;if(!r.value)o=void 0;else{const a=new Date(r.value);o=Number.isNaN(+a)?void 0:a}this.emitChange(o)};const s=n.querySelector("label.label");s&&(s.htmlFor=r.id),n.appendChild(r),this.$root.appendChild(n)}}Ee("schema-form-date",qu);class Wu extends Pt{render(){this.$root.innerHTML=`<style>${ht}</style>`;const e=bt(this._schema),n=this._schema.value;if(e.role==="raw-html"){if(n instanceof Node){this.$root.appendChild(n);return}const o=document.createElement("div");o.innerHTML=String(n),this.$root.appendChild(o);return}const r=this.makeFieldContainer("const",e.description),i=document.createElement("section");i.className="const content",i.textContent=String(n),i.id=Xt(this._path);const s=r.querySelector("label.label");s&&(s.htmlFor=i.id),r.appendChild(i),this.$root.appendChild(r)}}Ee("schema-form-const",Wu);function Ny(t){switch(t.type){case"string":return"schema-form-string";case"number":case"natural":case"percent":return"schema-form-number";case"boolean":return"schema-form-boolean";case"date":return"schema-form-date";case"const":return"schema-form-const";case"array":return"schema-form-array";case"object":return"schema-form-object";case"tuple":return"schema-form-tuple";case"dict":return"schema-form-dict";case"union":{const e=t.list||[];return e.length===2&&e[0]?.type==="is"&&e[0]?.constructor===Date&&e[1]?.type==="transform"&&(e[1]?.inner?.meta?.role==="datetime"||e[1]?.inner?.meta?.role==="date"||e[1]?.inner?.meta?.role==="time")?"schema-form-date":"schema-form-union"}default:return"schema-form-string"}}function Nn(t,e,n,r,i){const s=Ny(t),o=document.createElement(s);return o.schema=t,o.path=e,o.label=r,i&&(o.i18n=i),o.setValue?.(n),o}class zu extends Pt{render(){this.$root.innerHTML=`<style>${ht}</style>`;const e=bt(this._schema),n=this.makeFieldContainer("union",e.description),r=this._schema.list||[];if(Ry(r)){const i=document.createElement("select");i.className="input",i.name=dn(this._path),i.id=Xt(this._path),r.forEach(o=>{const a=document.createElement("option");a.value=String(o.value),a.textContent=String(o.value),this._value===o.value&&(a.selected=!0),i.appendChild(a)}),i.onchange=()=>this.emitChange(jo("string",i.value));const s=n.querySelector("label.label");s&&(s.htmlFor=i.id),n.appendChild(i)}else{const i=document.createElement("div");i.className="toolbar";const s=document.createElement("select");s.className="input",s.name=dn(this._path)+".__type",s.id=Xt(this._path)+"__type";let o=0;r.forEach((c,f)=>{const b=document.createElement("option");b.value=String(f),b.textContent=c.type,s.appendChild(b)}),s.onchange=()=>{o=Number(s.value);const c=r[o],f=Rn(c);this.emitChange(f),u()};const a=n.querySelector("label.label");a&&(a.htmlFor=s.id),i.appendChild(s),n.appendChild(i);const l=document.createElement("div");l.className="group";const u=()=>{l.innerHTML="";const c=r[o],f=Nn(c,this._path,this._value,this._label);f.addEventListener("change",b=>{b.stopPropagation(),this.emitChange(b.detail.value)}),l.appendChild(f)};u(),n.appendChild(l)}this.$root.appendChild(n)}}Ee("schema-form-union",zu);class Vu extends Pt{render(){this.$root.innerHTML=`<style>${ht}</style>`;const e=bt(this._schema),n=this.makeFieldContainer("tuple",e.description),r=document.createElement("div");r.className="group";const i=Array.isArray(this._value)?this._value:[];(this._schema.list||[]).forEach((s,o)=>{const a=Nn(s,[...this._path,o],i[o],`${this._label??""}[${o}]`);a.addEventListener("change",l=>{l.stopPropagation();const u=Array.isArray(this._value)?this._value.slice():[];u[o]=l.detail.value,this.emitChange(u)}),r.appendChild(a)}),n.appendChild(r),this.$root.appendChild(n)}}Ee("schema-form-tuple",Vu);class Ku extends Pt{render(){this.$root.innerHTML=`<style>${ht}</style>`;const e=bt(this._schema),n=this.makeFieldContainer("object",e.description),r=document.createElement("div");r.className="group";const i=this._schema.dict||{};Object.keys(i).forEach(s=>{if(i[s]?.meta?.hidden)return;const o=(this._value??{})[s],a=Nn(i[s],[...this._path,s],o,s);a.addEventListener("change",l=>{l.stopPropagation();const u={...this._value??{}};u[s]=l.detail.value,this.emitChange(u)}),r.appendChild(a)}),n.appendChild(r),this.$root.appendChild(n)}}Ee("schema-form-object",Ku);const Yi=class Yi extends Pt{constructor(){super(...arguments),this._itemIds=[]}generateItemId(){try{if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID()}catch{}return"i"+Yi._idCounter++}ensureItemIds(e){for(;this._itemIds.length<e;)this._itemIds.push(this.generateItemId());this._itemIds.length>e&&(this._itemIds.length=e)}capturePositions(e){const n={};return e.querySelectorAll(".row").forEach(r=>{const i=r.dataset.uid;i&&(n[i]=r.getBoundingClientRect())}),n}playFLIP(e,n){Array.from(e.querySelectorAll(".row")).forEach(r=>{const i=r.dataset.uid;if(!i)return;const s=n[i];if(!s)return;const o=r.getBoundingClientRect(),a=s.left-o.left,l=s.top-o.top;(a||l)&&(r.style.transition="none",r.style.transform=`translate(${a}px, ${l}px)`,requestAnimationFrame(()=>{r.style.transition="transform .25s ease",r.style.transform=""}))})}render(){this.$root.innerHTML=`<style>${ht}</style>`;const e=bt(this._schema),n=this.makeFieldContainer("array",e.description),r=document.createElement("div");r.className="group";const i=this._schema.inner,s=()=>Array.isArray(this._value)?this._value:[];this.ensureItemIds(s().length);const o=(u,c)=>{r.innerHTML="",s().forEach((f,b)=>{const y=[...this._path,b],v=document.createElement("div");v.className="row schema-collection-row";const A=this._itemIds[b];v.dataset.uid=A,v.setAttribute("data-path",Er(y));const U=Nn(i,y,f,`${this._label??""}[${b}]`);U.addEventListener("change",h=>{h.stopPropagation();const x=s().slice();x[b]=h.detail.value,this._value=x,this.emitChange(x)});const D=document.createElement("div");D.className="actions";const I=document.createElement("button");I.type="button",I.className="btn",I.textContent=this._i18n.arrayMoveUp??"↑",I.onclick=()=>{if(b<=0)return;const h=this.capturePositions(r),x=s().slice();[x[b-1],x[b]]=[x[b],x[b-1]],[this._itemIds[b-1],this._itemIds[b]]=[this._itemIds[b],this._itemIds[b-1]],this._value=x,o(h),this.emitChange(x)};const g=document.createElement("button");g.type="button",g.className="btn",g.textContent=this._i18n.arrayMoveDown??"↓",g.onclick=()=>{const h=s();if(b>=h.length-1)return;const x=this.capturePositions(r),P=h.slice();[P[b+1],P[b]]=[P[b],P[b+1]],[this._itemIds[b+1],this._itemIds[b]]=[this._itemIds[b],this._itemIds[b+1]],this._value=P,o(x),this.emitChange(P)};const p=document.createElement("button");p.type="button",p.className="btn danger",p.textContent=this._i18n.arrayRemove??"×",p.onclick=()=>{v.classList.add("leaving");const h=250;let x=!1;const P=()=>{if(x)return;x=!0,clearTimeout(R);const W=s().filter((Ce,Te)=>Te!==b);this._itemIds.splice(b,1);const X=this.capturePositions(r);this._value=W,o(X),this.emitChange(W)};v.addEventListener("transitionend",P,{once:!0});const R=setTimeout(P,h+80)},D.append(I,g,p),v.appendChild(U),v.appendChild(D),r.appendChild(v),c&&c===A&&(v.classList.add("enter"),requestAnimationFrame(()=>{v.classList.add("enter-active")}),requestAnimationFrame(()=>{v.classList.remove("enter")}))}),u&&this.playFLIP(r,u)};o();const a=document.createElement("button");a.type="button",a.className="btn primary",a.textContent=this._i18n.arrayAdd??"+",a.onclick=()=>{const u=this.capturePositions(r),c=s().slice(),f=Rn(i);c.push(f);const b=this.generateItemId();this._itemIds.push(b),this._value=c,o(u,b),this.emitChange(c)};const l=document.createElement("div");l.className="actions",l.appendChild(a),n.appendChild(r),n.appendChild(l),this.$root.appendChild(n)}};Yi._idCounter=0;let qi=Yi;Ee("schema-form-array",qi);class Yu extends Pt{render(){this.$root.innerHTML=`<style>${ht}</style>`;const e=bt(this._schema),n=this.makeFieldContainer("dict",e.description),r=document.createElement("div");r.className="group";const i=this._schema.inner,s=this._value??{},o=b=>`d_${b}`,a=()=>{const b={};return r.querySelectorAll(".kv").forEach(y=>{const v=y.dataset.uid;v&&(b[v]=y.getBoundingClientRect())}),b},l=b=>{r.querySelectorAll(".kv").forEach(y=>{const v=y.dataset.uid;if(!v)return;const A=b[v];if(!A)return;const U=y.getBoundingClientRect(),D=A.left-U.left,I=A.top-U.top;(D||I)&&(y.style.transition="none",y.style.transform=`translate(${D}px, ${I}px)`,requestAnimationFrame(()=>{y.style.transition="transform .25s ease",y.style.transform=""}))})},u=(b,y)=>{r.innerHTML="",Object.keys(s).forEach(v=>{const A=[...this._path,v],U=document.createElement("div");U.className="kv schema-collection-row",U.dataset.uid=o(v),U.setAttribute("data-path",Er(A));const D=document.createElement("input");D.className="input",D.value=v,D.name=dn(A)+".__key",D.id=Xt(A)+"__key";const I=Nn(i,A,s[v],`${this._label??""}[${v}]`),g=document.createElement("button");g.type="button",g.className="btn danger",g.textContent=this._i18n.dictRemove??"×",g.onclick=()=>{const p=a();delete s[v];const h={...this._value??{}};delete h[v],this._value=h,u(p),this.emitChange(h)},D.onchange=()=>{const p=D.value.trim();if(!p||p===v||s[p]!==void 0)return;const h=a();s[p]=s[v],delete s[v];const x={...this._value??{}};x[p]=x[v],delete x[v],this._value=x,u(h),this.emitChange(x)},I.addEventListener("change",p=>{p.stopPropagation();const h={...this._value??{}};h[v]=p.detail.value,this._value=h,this.emitChange(h)}),U.append(D,I,g),r.appendChild(U),y===v&&(U.classList.add("enter"),requestAnimationFrame(()=>U.classList.add("enter-active")),requestAnimationFrame(()=>U.classList.remove("enter")))}),b&&l(b)};u();const c=document.createElement("button");c.type="button",c.className="btn primary",c.textContent=this._i18n.dictAdd??"+",c.onclick=()=>{let b=Object.keys(s).length+1,y=`k${b}`;for(;s[y]!==void 0;)y=`k${++b}`;const v=a();s[y]=Rn(i);const A={...this._value??{},[y]:s[y]};this._value=A,u(v,y),this.emitChange(A)};const f=document.createElement("div");f.className="actions",f.appendChild(c),n.appendChild(r),n.appendChild(f),this.$root.appendChild(n)}}Ee("schema-form-dict",Yu);class Gu extends HTMLElement{constructor(){super(),this._i18n={...ju},this.$root=this.attachShadow({mode:"open"});const e=document.createElement("style");e.textContent=ht,this.$root.appendChild(e);const n=document.createElement("div");n.className="wrapper",n.innerHTML='<form class="form" part="form"></form>',this.$root.appendChild(n),this.addEventListener("change",r=>{if(!r?.detail)return;const{path:i,value:s}=r.detail;Array.isArray(i)&&i.length===0?this._state=s:Iy(this._state??(this._state={}),i,s),this.dispatchEvent(new CustomEvent("form-change",{detail:{path:i,value:s,state:this._state}}))})}set schema(e){this._schema=Fu(e);try{this._state=this._schema(null,{autofix:!0})}catch{this._state=Rn(this._schema)}this.render()}get schema(){return this._schema}set schemaJSON(e){this.schema=e}get schemaJSON(){return this._schema?.toJSON?.()}setData(e,n={validate:!0,autofix:!0}){if(!this._schema)throw new Error("请先设置 schema");const r=n.validate?this._schema(e??null,{autofix:n.autofix}):e;this._state=r,this.render()}getData(e={validate:!0,autofix:!0}){if(!this._schema)throw new Error("请先设置 schema");const n=this._state;return e.validate?this._schema(n??null,{autofix:e.autofix}):n}reset(){try{this._state=this._schema(null,{autofix:!0})}catch{this._state=Rn(this._schema)}this.render()}refresh(){this.render()}set i18n(e){this._i18n={...this._i18n,...e},this.render()}get i18n(){return this._i18n}render(){if(!this._schema)return;const e=this.$root.querySelector("form");e.innerHTML="";const n=Nn(this._schema,[],this._state,this._i18n.rootLabel,this._i18n);e.appendChild(n)}}Ee("schema-form",Gu);function Dy(){Ee("schema-form",Gu),Ee("schema-form-string",Bu),Ee("schema-form-number",Uu),Ee("schema-form-boolean",Hu),Ee("schema-form-date",qu),Ee("schema-form-const",Wu),Ee("schema-form-union",zu),Ee("schema-form-tuple",Vu),Ee("schema-form-object",Ku),Ee("schema-form-array",qi),Ee("schema-form-dict",Yu)}const Ly=Ic({__name:"SchemasteryFormVue",props:Bc({schema:{},value:{},validateOnChange:{type:Boolean,default:!1}},{schema:{required:!0},schemaModifiers:{},value:{required:!1,default:{}},valueModifiers:{}}),emits:Bc(["change"],["update:schema","update:value"]),setup(t,{expose:e,emit:n}){const r=au(t,"schema"),i=au(t,"value"),s=n,o=eg("elRef");let a=!1,l=!1;const u=c=>{if(l)return;const f=o.value,b=t.validateOnChange?f.getData({validate:!0}):c.detail.state;a=!0,i.value=b,Ci(()=>{a=!1}),s("change",c.detail)};return Lc(()=>{Dy()}),_o(()=>{const c=o.value;r.value&&(c.schema=r.value),i.value!==void 0&&c.setData(i.value,{validate:!1,autofix:!0}),c.addEventListener("form-change",u)}),jc(()=>{o.value?.removeEventListener("form-change",u)}),gr(()=>r,c=>{a||o.value&&c&&o.value.schema!==c.value&&(l=!0,o.value.schema=c.value,Ci(()=>{l=!1}))},{deep:!0,immediate:!0}),gr(()=>i,c=>{if(a||!o.value||c.value===void 0)return;const f=o.value.getData({validate:!1});JSON.stringify(f)!==JSON.stringify(c.value)&&(l=!0,o.value.setData(c.value,{validate:!1}),Ci(()=>{l=!1}))},{deep:!0,immediate:!0}),e({setData(c,f){const b=o.value;b.setData(c,{validate:!!f?.validate}),f?.emit&&(i.value=b.getData({validate:!!f?.validate}))},getData(c){return o.value.getData(c)},setSchema(c,f=!0){o.value.schema=c,f&&(r.value=c)},refresh(){o.value.refresh()},reset(){o.value.reset()},el:o}),(c,f)=>(In(),br("schema-form",yu({ref_key:"elRef",ref:o},c.$attrs),null,16))}});function hn(t,e=new WeakMap){if(Ne(t))return hn(t.value,e);if(t===null||typeof t!="object")return t;if(e.has(t))return e.get(t);if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(t instanceof Map){const i=new Map;return e.set(t,i),Array.from(t.entries()).forEach(([s,o])=>{i.set(s,hn(o,e))}),i}if(t instanceof Set){const i=new Set;return e.set(t,i),Array.from(t).forEach(s=>{i.add(hn(s,e))}),i}if(Array.isArray(t)){const i=[];e.set(t,i);for(const s of t)i.push(hn(s,e));return i}const n=fe(t),r={};e.set(t,r);for(const i of Object.keys(n))r[i]=hn(n[i],e);for(const i of Object.getOwnPropertySymbols(n))r[i]=hn(n[i],e);return r}const jy={class:"preferences-ui-app"},My={class:"tabs"},Fy=["onClick","data-value"],By={style:{"max-height":"20em",overflow:"auto"}},Uy={style:{"max-height":"20em",overflow:"auto"}},Hy=((t,e)=>{const n=t.__vccOpts||t;for(const[r,i]of e)n[r]=i;return n})(Ic({__name:"PreferencesForm",setup(t,{expose:e}){const n=Ay(),r=xi([]),i=xi(""),s=Su(()=>a.value.find(l=>l.category===i.value)?.schema),o=xi({}),a=xi([]);return e({getValue(){return hn(o)}}),Ig(()=>{i.value&&(a.value=n.preferences.getConfigRegistries(i.value))}),_o(async()=>{n.inject(["preferences"],async l=>{o.value=await l.preferences.getAll(),r.value=l.preferences.getConfigCategories(),i.value=r.value[0].name})}),(l,u)=>(In(),br("div",jy,[Ft("div",My,[(In(!0),br(vt,null,Fc(r.value,c=>(In(),br("a",{class:hi(["tab",{active:i.value===c.name}]),key:c.name,onClick:f=>i.value=c.name,"data-value":c.name},pi(c.label),11,Fy))),128))]),(In(!0),br(vt,null,Fc(a.value,c=>Jm((In(),Hg(xc(Ly),{key:c.name,schema:c.schema,value:o.value,"onUpdate:value":u[0]||(u[0]=f=>o.value=f),"validate-on-change":!1,i18n:{rootLabel:""}},null,8,["schema","value"])),[[cy,i.value===c.category]])),128)),Ft("details",null,[u[1]||(u[1]=Ft("summary",null,"Debug Info",-1)),u[2]||(u[2]=Ft("h3",null,"Active Schema",-1)),Ft("pre",By,pi(s.value?.toJSON()),1),u[3]||(u[3]=Ft("h3",null,"Value",-1)),Ft("pre",Uy,pi(o.value),1)])]))}}),[["__scopeId","data-v-a338c085"]]);var qy=Object.create,Fo=Object.defineProperty,Wy=Object.getOwnPropertyDescriptor,Ju=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Qu=t=>{throw TypeError(t)},zy=(t,e,n)=>e in t?Fo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Vy=(t,e)=>Fo(t,"name",{value:e,configurable:!0}),Ky=t=>[,,,qy(t?.[Ju("metadata")]??null)],Yy=["class","method","getter","setter","accessor","field","value","get","set"],Xu=t=>t!==void 0&&typeof t!="function"?Qu("Function expected"):t,Gy=(t,e,n,r,i)=>({kind:Yy[t],name:e,metadata:r,addInitializer:s=>n._?Qu("Already initialized"):i.push(Xu(s||null))}),Jy=(t,e)=>zy(e,Ju("metadata"),t[3]),Qy=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},Xy=(t,e,n,r,i,s)=>{var o,a,l,u=e&7,c=!1,f=0,b=t[f]||(t[f]=[]),y=u&&(i=i.prototype,u<5&&(u>3||!c)&&Wy(i,n));Vy(i,n);for(var v=r.length-1;v>=0;v--)l=Gy(u,n,a={},t[3],b),o=(0,r[v])(i,l),a._=1,Xu(o)&&(i=o);return Jy(t,i),y&&Fo(i,n,y),c?u^4?s:y:i},Zu,Bo,ef;Zu=[Ge(["preferences","modal"])];class Wi extends(ef=ut){constructor(e){super(e,{},"preferences-ui"),this.ctx=e,e.set("preferencesUI",this),e.inject(["toolbox"],n=>{n.toolbox.addButton({id:"preferences",icon:C("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"icon icon-tabler icons-tabler-filled icon-tabler-settings",children:[C("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),C("path",{d:"M14.647 4.081a.724 .724 0 0 0 1.08 .448c2.439 -1.485 5.23 1.305 3.745 3.744a.724 .724 0 0 0 .447 1.08c2.775 .673 2.775 4.62 0 5.294a.724 .724 0 0 0 -.448 1.08c1.485 2.439 -1.305 5.23 -3.744 3.745a.724 .724 0 0 0 -1.08 .447c-.673 2.775 -4.62 2.775 -5.294 0a.724 .724 0 0 0 -1.08 -.448c-2.439 1.485 -5.23 -1.305 -3.745 -3.744a.724 .724 0 0 0 -.447 -1.08c-2.775 -.673 -2.775 -4.62 0 -5.294a.724 .724 0 0 0 .448 -1.08c-1.485 -2.439 1.305 -5.23 3.744 -3.745a.722 .722 0 0 0 1.08 -.447c.673 -2.775 4.62 -2.775 5.294 0zm-2.647 4.919a3 3 0 1 0 0 6a3 3 0 0 0 0 -6z"})]}),tooltip:"Open preferences",group:"group2",index:1/0,onClick:()=>this.showModal()}),this.addDisposeHandler(()=>{n.toolbox.removeButton("preferences")})})}showModal(){const e=this.ctx.modal.show({className:"ipe-preference compact-buttons",sizeClass:"small",outSideClose:!1,center:!0,title:"InPageEdit Prefrences",content:C(Xn,{children:C(on,{})})});e.get$window().classList.add("dialog");const n=C("div",{id:"ipe-preferences-app",style:{minHeight:"65vh"}});e.setContent(n);const r=this.createFormApp(),i=r.mount(n);e.setButtons([{label:"Save",className:"is-primary is-ghost",method:()=>{const s=i.getValue();Object.entries(s).forEach(([o,a])=>{this.ctx.preferences.set(o,a).catch(console.error)}),e.close()}},{label:"Cancel",className:"is-danger is-ghost",method:()=>{e.close()}}]),e.on(e.Event.Close,()=>{this.logger.log("preferences modal closed, vue app unmounting"),r.unmount()})}createFormApp(){const e=ky(Hy);return Py(this.ctx,e),e}}Bo=Ky(ef),Wi=Xy(Bo,0,"PluginPreferencesUI",Zu,Wi),Qy(Bo,1,Wi);const Zy=Object.freeze(Object.defineProperty({__proto__:null,get PluginPreferencesUI(){return Wi}},Symbol.toStringTag,{value:"Module"}));le.BasePlugin=ut,le.InPageEdit=an,le.Inject=Ge,le.Logger=ua,le.LoggerLevel=ls,le.Schema=Se,le.Service=vn,le.createLogger=ha,Object.defineProperty(le,Symbol.toStringTag,{value:"Module"})});
|
|
125
125
|
//# sourceMappingURL=index.umd.js.map
|