@inpageedit/core 0.5.4 → 0.7.0

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.
Files changed (77) hide show
  1. package/dist/CheckBox-D3rHnX7I.js +13 -0
  2. package/dist/CheckBox-D3rHnX7I.js.map +1 -0
  3. package/dist/IconQuickEdit-YVn1ANbm.js +27 -0
  4. package/dist/IconQuickEdit-YVn1ANbm.js.map +1 -0
  5. package/dist/InPageEdit.d.ts +7 -5
  6. package/dist/InputBox-BV4m05Xs.js +22 -0
  7. package/dist/InputBox-BV4m05Xs.js.map +1 -0
  8. package/dist/RadioBox-nJqWsxW2.js +13 -0
  9. package/dist/RadioBox-nJqWsxW2.js.map +1 -0
  10. package/dist/__test__/utils/constants.d.ts +2 -0
  11. package/dist/components/Icon/IconEdit.d.ts +2 -0
  12. package/dist/components/Icon/IconQuickEdit.d.ts +2 -0
  13. package/dist/components/MwUserLinks.d.ts +2 -0
  14. package/dist/components/index.js +13 -11
  15. package/dist/components/index.js.map +1 -1
  16. package/dist/{index-i-Uf0vuA.js → index-1JtE4urY.js} +490 -374
  17. package/dist/{index-i-Uf0vuA.js.map → index-1JtE4urY.js.map} +1 -1
  18. package/dist/{index-UyiZ7umI.js → index-2AEdgbUL.js} +4 -4
  19. package/dist/index-2AEdgbUL.js.map +1 -0
  20. package/dist/index-2kN4SKmT.js +116 -0
  21. package/dist/index-2kN4SKmT.js.map +1 -0
  22. package/dist/{index-BSjnoNn2.js → index-B3Bsg_nE.js} +5 -3
  23. package/dist/index-B3Bsg_nE.js.map +1 -0
  24. package/dist/index-BCMwmSfQ.js +295 -0
  25. package/dist/index-BCMwmSfQ.js.map +1 -0
  26. package/dist/{index-BedbUMp8.js → index-C0ci6Ll1.js} +14 -12
  27. package/dist/index-C0ci6Ll1.js.map +1 -0
  28. package/dist/index-CZnu6cRK.js +319 -0
  29. package/dist/index-CZnu6cRK.js.map +1 -0
  30. package/dist/{index-xJ2bdsOD.js → index-CheNjwas.js} +5 -5
  31. package/dist/{index-xJ2bdsOD.js.map → index-CheNjwas.js.map} +1 -1
  32. package/dist/{index-DtOC8Ck-.js → index-CrWxZ0yl.js} +66 -63
  33. package/dist/{index-DtOC8Ck-.js.map → index-CrWxZ0yl.js.map} +1 -1
  34. package/dist/{index-DNQjqBV-.js → index-DqfQ7hp6.js} +3359 -3037
  35. package/dist/index-DqfQ7hp6.js.map +1 -0
  36. package/dist/index-lZkYoUca.js +46 -0
  37. package/dist/index-lZkYoUca.js.map +1 -0
  38. package/dist/index-sfkutNHj.js +201 -0
  39. package/dist/index-sfkutNHj.js.map +1 -0
  40. package/dist/index.js +1 -1
  41. package/dist/makeCallable-LDU0xZMJ.js +40 -0
  42. package/dist/makeCallable-LDU0xZMJ.js.map +1 -0
  43. package/dist/models/WikiPage/index.d.ts +2 -2
  44. package/dist/models/WikiTitle/index.d.ts +87 -11
  45. package/dist/models/WikiTitle/index.spec.d.ts +1 -0
  46. package/dist/noop-ClDc6zv4.js +6 -0
  47. package/dist/noop-ClDc6zv4.js.map +1 -0
  48. package/dist/plugins/in-article-links/index.d.ts +33 -7
  49. package/dist/plugins/quick-delete/index.d.ts +47 -0
  50. package/dist/plugins/quick-diff/PluginQuickDiffCore.d.ts +4 -2
  51. package/dist/plugins/quick-diff/components/DiffTable.d.ts +17 -0
  52. package/dist/plugins/quick-preview/index.d.ts +6 -3
  53. package/dist/services/ApiService.d.ts +2 -2
  54. package/dist/services/ModalService/IPEModal.d.ts +1 -1
  55. package/dist/services/SiteMetadataService.d.ts +43 -4
  56. package/dist/services/WikiPageService.d.ts +2 -2
  57. package/dist/services/WikiTitleService.d.ts +14 -0
  58. package/dist/style.css +1 -1
  59. package/dist/types/SiteMetadata.d.ts +1 -1
  60. package/dist/utils/url.d.ts +24 -0
  61. package/lib/index.umd.js +28 -28
  62. package/lib/index.umd.js.map +1 -1
  63. package/lib/style.css +1 -1
  64. package/package.json +10 -1
  65. package/dist/InputBox-FIzJ-rPN.js +0 -30
  66. package/dist/InputBox-FIzJ-rPN.js.map +0 -1
  67. package/dist/RadioBox-CaA8VgLu.js +0 -54
  68. package/dist/RadioBox-CaA8VgLu.js.map +0 -1
  69. package/dist/index-BSjnoNn2.js.map +0 -1
  70. package/dist/index-BedbUMp8.js.map +0 -1
  71. package/dist/index-DNQjqBV-.js.map +0 -1
  72. package/dist/index-UyiZ7umI.js.map +0 -1
  73. package/dist/index-e7eyr1FL.js +0 -96
  74. package/dist/index-e7eyr1FL.js.map +0 -1
  75. package/dist/index-rMDuLpcz.js +0 -458
  76. package/dist/index-rMDuLpcz.js.map +0 -1
  77. package/dist/plugins/quick-edit/PluginQuickEditInArticleLinks.d.ts +0 -14
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 Lv=Object.defineProperty;var rf=le=>{throw TypeError(le)};var Nv=(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)=>Nv(le,typeof ye!="symbol"?ye+"":ye,Ie),Yo=(le,ye,Ie)=>ye.has(le)||rf("Cannot "+Ie);var sf=(le,ye,Ie)=>(Yo(le,ye,"read from private field"),Ie?Ie.call(le):ye.get(le)),Go=(le,ye,Ie)=>ye.has(le)?rf("Cannot add the same private member more than once"):ye instanceof WeakSet?ye.add(le):ye.set(le,Ie),of=(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,Mn,jn,Fn,Bn,Pe,st,At,lf,cf,uf,ff,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 df(){}ne(df,"noop");function $e(t){return t==null}ne($e,"isNullable");function hf(t){return!$e(t)}ne(hf,"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 It(t,e){return Object.fromEntries(Object.entries(t).map(([n,r])=>[n,e(r,n)]))}ne(It,"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 pf(t,e){if(!e)return{...t};const n={...t};for(const r of e)Reflect.deleteProperty(n,r);return n}ne(pf,"omit");function He(t,e,n){return Object.defineProperty(t,e,{writable:!0,value:n,enumerable:!1})}ne(He,"defineProperty");function mf(t,e){return e.every(n=>t.includes(n))}ne(mf,"contain");function gf(t,e){return t.filter(n=>e.includes(n))}ne(gf,"intersection");function yf(t,e){return t.filter(n=>!e.includes(n))}ne(yf,"difference");function vf(t,e){return Array.from(new Set([...t,...e]))}ne(vf,"union");function bf(t){return[...new Set(t)]}ne(bf,"deduplicate");function Ut(t,e){const n=t?.indexOf(e);return n>=0?(t.splice(n,1),!0):!1}ne(Ut,"remove");function _f(t){return Array.isArray(t)?t:$e(t)?[]:[t]}ne(_f,"makeArray");function Ht(t,e){return arguments.length===1?n=>Ht(t,n):t in globalThis&&e instanceof globalThis[t]||Object.prototype.toString.call(e).slice(8,-1)===t}ne(Ht,"is");function Kn(t){return Ht("ArrayBuffer",t)||Ht("SharedArrayBuffer",t)}ne(Kn,"isArrayBufferLike");function Xo(t){return Kn(t)||ArrayBuffer.isView(t)}ne(Xo,"isArrayBufferSource");var bt;(t=>{t.is=Kn,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")})(bt||(bt={})),bt.fromBase64,bt.toBase64,bt.fromHex,bt.toHex;function Rr(t,e=new Map){if(!t||typeof t!="object")return t;if(Ht("Date",t))return new Date(t.valueOf());if(Ht("RegExp",t))return new RegExp(t.source,t.flags);if(Kn(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(Ht("Date"),(i,s)=>i.valueOf()===s.valueOf())??r(Ht("RegExp"),(i,s)=>i.source===s.source&&i.flags===s.flags)??r(Kn,(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 wf(t){return t.charAt(0).toUpperCase()+t.slice(1)}ne(wf,"capitalize");function xf(t){return t.charAt(0).toLowerCase()+t.slice(1)}ne(xf,"uncapitalize");function Sf(t){return t.replace(/[_-][a-z]/g,e=>e.slice(1).toUpperCase())}ne(Sf,"camelCase");function Vi(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(Vi,"tokenize");function Ef(t){return Vi(t,[45,95],45)}ne(Ef,"paramCase");function $f(t){return Vi(t,[45,95],95)}ne($f,"snakeCase");function kf(t){return typeof t!="string"?`[${t.toString()}]`:/^[a-z_$][\w$]*$/i.test(t)?`.${t}`:`[${JSON.stringify(t)}]`}ne(kf,"formatProperty");function Zo(t){return t.replace(/\/$/,"")}ne(Zo,"trimSlash");function Cf(t){return t.startsWith("/")||(t="/"+t),Zo(t)}ne(Cf,"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(v){e=v}t.setTimezoneOffset=n,ne(n,"setTimezoneOffset");function r(){return e}t.getTimezoneOffset=r,ne(r,"getTimezoneOffset");function i(v=new Date,b){return typeof v=="number"&&(v=new Date(v)),b===void 0&&(b=e),Math.floor((v.valueOf()/t.minute-b)/1440)}t.getDateNumber=i,ne(i,"getDateNumber");function s(v,b){const A=new Date(v*t.day);return b===void 0&&(b=e),new Date(+A+b*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(v=>`(${o}${v})?`).join("")}$`);function l(v){const b=a.exec(v);return b?(parseFloat(b[1])*t.week||0)+(parseFloat(b[2])*t.day||0)+(parseFloat(b[3])*t.hour||0)+(parseFloat(b[4])*t.minute||0)+(parseFloat(b[5])*t.second||0):0}t.parseTime=l,ne(l,"parseTime");function u(v){const b=l(v);return b?v=Date.now()+b:/^\d{1,2}(:\d{1,2}){1,2}$/.test(v)?v=`${new Date().toLocaleDateString()}-${v}`:/^\d{1,2}-\d{1,2}-\d{1,2}(:\d{1,2}){1,2}$/.test(v)&&(v=`${new Date().getFullYear()}-${v}`),v?new Date(v):new Date}t.parseDate=u,ne(u,"parseDate");function c(v){const b=Math.abs(v);return b>=t.day-t.hour/2?Math.round(v/t.day)+"d":b>=t.hour-t.minute/2?Math.round(v/t.hour)+"h":b>=t.minute-t.second/2?Math.round(v/t.minute)+"m":b>=t.second?Math.round(v/t.second)+"s":v+"ms"}t.format=c,ne(c,"format");function f(v,b=2){return v.toString().padStart(b,"0")}t.toDigits=f,ne(f,"toDigits");function y(v,b=new Date){return v.replace("yyyy",b.getFullYear().toString()).replace("yy",b.getFullYear().toString().slice(2)).replace("MM",f(b.getMonth()+1)).replace("dd",f(b.getDate())).replace("hh",f(b.getHours())).replace("mm",f(b.getMinutes())).replace("ss",f(b.getSeconds())).replace("SSS",f(b.getMilliseconds(),3))}t.template=y,ne(y,"template")})(ea||(ea={}));var Of=Object.defineProperty,ie=(t,e)=>Of(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")},Pf=function*(){}.constructor,ta=async function*(){}.constructor;function Ki(t){return!(!t.prototype||t instanceof Pf||ta!==Function&&t instanceof ta)}ie(Ki,"isConstructor");function Yn(t,e){const n=t.Config||t.schema;return n&&t.schema!==!1&&(e=n(e)),e??{}}ie(Yn,"resolveConfig");function na(t){return[Map,Set,Date,Promise].some(e=>t instanceof e)}ie(na,"isUnproxyable");function Yi(t,e){if(t===Object.prototype)return e;const n=Object.create(Yi(Object.getPrototypeOf(t),e));for(const r of Reflect.ownKeys(t))Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r));return n}ie(Yi,"joinPrototype");function Gi(t){return t&&(typeof t=="object"||typeof t=="function")}ie(Gi,"isObject");function _t(t,e,n){if(!Gi(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(_t,"getTraceable");function Gn(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(Gn,"withProps");function Dr(t,e,n){return Gn(t,Object.defineProperty(Object.create(null),e,{value:n,writable:!1}))}ie(Dr,"withProp");function Ji(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(Ji,"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(...y){return Reflect.apply(f,this===c?l:this,y)}:f},"get"),apply:ie((l,u,c)=>Reflect.apply(l,_t(t,u),c.map(f=>_t(t,f))),"apply"),construct:ie((l,u,c)=>Reflect.construct(l,u.map(f=>_t(t,f)),c),"construct")})),_t(t,Reflect.apply(i,s,o))),"apply")})}ie(ra,"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=Ji(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"?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,Dr(t,Y.receiver,l));const u=Ji(t,s,n.property,l);return Reflect.set(s,o,a,u)},"set"),apply:ie((s,o,a)=>Qi(i,s,o,a),"apply")});return i}ie(Lr,"createTraceable");function Qi(t,e,n,r){return e[Y.invoke]?e[Y.invoke].apply(t,r):Reflect.apply(e,n,r)}ie(Qi,"applyTraceable");function Xi(t,e,n){const r=ie(function(...i){const s=Lr(r.ctx,r,n);return Qi(s,r,this,i)},"self");return He(r,"name",t),Object.setPrototypeOf(r,e)}ie(Xi,"createCallable");var Af=(dt=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(`
1
+ (function(le,ve){typeof exports=="object"&&typeof module<"u"?ve(exports):typeof define=="function"&&define.amd?define(["exports"],ve):(le=typeof globalThis<"u"?globalThis:le||self,ve(le.InPageEditBundle={}))})(this,function(le){"use strict";var pb=Object.defineProperty;var Ef=le=>{throw TypeError(le)};var mb=(le,ve,Ae)=>ve in le?pb(le,ve,{enumerable:!0,configurable:!0,writable:!0,value:Ae}):le[ve]=Ae;var te=(le,ve,Ae)=>mb(le,typeof ve!="symbol"?ve+"":ve,Ae),oa=(le,ve,Ae)=>ve.has(le)||Ef("Cannot "+Ae);var kf=(le,ve,Ae)=>(oa(le,ve,"read from private field"),Ae?Ae.call(le):ve.get(le)),aa=(le,ve,Ae)=>ve.has(le)?Ef("Cannot add the same private member more than once"):ve instanceof WeakSet?ve.add(le):ve.set(le,Ae),$f=(le,ve,Ae,ne)=>(oa(le,ve,"write to private field"),ne?ne.call(le,Ae):ve.set(le,Ae),Ae),Mr=(le,ve,Ae)=>(oa(le,ve,"access private method"),Ae);var dt,Fn,vn,Un,qn,Hn,zn,Oe,ot,Tt,Pf,Of,If,Af,Tr,yn;const ve=()=>{let t,e;return{promise:new Promise((r,i)=>{t=r,e=i}),resolve:t,reject:e}};Promise.withResolvers||(Promise.withResolvers=ve);var Ae=Object.defineProperty,ne=(t,e)=>Ae(t,"name",{value:e,configurable:!0});function Tf(){}ne(Tf,"noop");function ke(t){return t==null}ne(ke,"isNullable");function Rf(t){return!ke(t)}ne(Rf,"isNonNullable");function jr(t){return t&&typeof t=="object"&&!Array.isArray(t)}ne(jr,"isPlainObject");function la(t,e){return Object.fromEntries(Object.entries(t).filter(([n,r])=>e(n,r)))}ne(la,"filterKeys");function Rt(t,e){return Object.fromEntries(Object.entries(t).map(([n,r])=>[n,e(r,n)]))}ne(Rt,"mapValues");function ca(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(ca,"pick");function Nf(t,e){if(!e)return{...t};const n={...t};for(const r of e)Reflect.deleteProperty(n,r);return n}ne(Nf,"omit");function qe(t,e,n){return Object.defineProperty(t,e,{writable:!0,value:n,enumerable:!1})}ne(qe,"defineProperty");function Df(t,e){return e.every(n=>t.includes(n))}ne(Df,"contain");function Lf(t,e){return t.filter(n=>e.includes(n))}ne(Lf,"intersection");function Mf(t,e){return t.filter(n=>!e.includes(n))}ne(Mf,"difference");function jf(t,e){return Array.from(new Set([...t,...e]))}ne(jf,"union");function Bf(t){return[...new Set(t)]}ne(Bf,"deduplicate");function zt(t,e){const n=t?.indexOf(e);return n>=0?(t.splice(n,1),!0):!1}ne(zt,"remove");function Ff(t){return Array.isArray(t)?t:ke(t)?[]:[t]}ne(Ff,"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 Jn(t){return Wt("ArrayBuffer",t)||Wt("SharedArrayBuffer",t)}ne(Jn,"isArrayBufferLike");function ua(t){return Jn(t)||ArrayBuffer.isView(t)}ne(ua,"isArrayBufferSource");var bt;(t=>{t.is=Jn,t.isSource=ua;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")})(bt||(bt={})),bt.fromBase64,bt.toBase64,bt.fromHex,bt.toHex;function Br(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(Jn(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(Br,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(Br,null,[s.value,e])),Reflect.defineProperty(r,i,s)}return r}ne(Br,"clone");function on(t,e,n){if(t===e||!n&&ke(t)&&ke(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)=>on(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(Jn,(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=>on(t[i],e[i],n))}ne(on,"deepEqual");function Uf(t){return t.charAt(0).toUpperCase()+t.slice(1)}ne(Uf,"capitalize");function qf(t){return t.charAt(0).toLowerCase()+t.slice(1)}ne(qf,"uncapitalize");function Hf(t){return t.replace(/[_-][a-z]/g,e=>e.slice(1).toUpperCase())}ne(Hf,"camelCase");function es(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(es,"tokenize");function zf(t){return es(t,[45,95],45)}ne(zf,"paramCase");function Wf(t){return es(t,[45,95],95)}ne(Wf,"snakeCase");function Vf(t){return typeof t!="string"?`[${t.toString()}]`:/^[a-z_$][\w$]*$/i.test(t)?`.${t}`:`[${JSON.stringify(t)}]`}ne(Vf,"formatProperty");function fa(t){return t.replace(/\/$/,"")}ne(fa,"trimSlash");function Kf(t){return t.startsWith("/")||(t="/"+t),fa(t)}ne(Kf,"sanitize");var da;(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(v){e=v}t.setTimezoneOffset=n,ne(n,"setTimezoneOffset");function r(){return e}t.getTimezoneOffset=r,ne(r,"getTimezoneOffset");function i(v=new Date,b){return typeof v=="number"&&(v=new Date(v)),b===void 0&&(b=e),Math.floor((v.valueOf()/t.minute-b)/1440)}t.getDateNumber=i,ne(i,"getDateNumber");function s(v,b){const A=new Date(v*t.day);return b===void 0&&(b=e),new Date(+A+b*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(v=>`(${o}${v})?`).join("")}$`);function l(v){const b=a.exec(v);return b?(parseFloat(b[1])*t.week||0)+(parseFloat(b[2])*t.day||0)+(parseFloat(b[3])*t.hour||0)+(parseFloat(b[4])*t.minute||0)+(parseFloat(b[5])*t.second||0):0}t.parseTime=l,ne(l,"parseTime");function u(v){const b=l(v);return b?v=Date.now()+b:/^\d{1,2}(:\d{1,2}){1,2}$/.test(v)?v=`${new Date().toLocaleDateString()}-${v}`:/^\d{1,2}-\d{1,2}-\d{1,2}(:\d{1,2}){1,2}$/.test(v)&&(v=`${new Date().getFullYear()}-${v}`),v?new Date(v):new Date}t.parseDate=u,ne(u,"parseDate");function c(v){const b=Math.abs(v);return b>=t.day-t.hour/2?Math.round(v/t.day)+"d":b>=t.hour-t.minute/2?Math.round(v/t.hour)+"h":b>=t.minute-t.second/2?Math.round(v/t.minute)+"m":b>=t.second?Math.round(v/t.second)+"s":v+"ms"}t.format=c,ne(c,"format");function f(v,b=2){return v.toString().padStart(b,"0")}t.toDigits=f,ne(f,"toDigits");function y(v,b=new Date){return v.replace("yyyy",b.getFullYear().toString()).replace("yy",b.getFullYear().toString().slice(2)).replace("MM",f(b.getMonth()+1)).replace("dd",f(b.getDate())).replace("hh",f(b.getHours())).replace("mm",f(b.getMinutes())).replace("ss",f(b.getSeconds())).replace("SSS",f(b.getMilliseconds(),3))}t.template=y,ne(y,"template")})(da||(da={}));var Yf=Object.defineProperty,ie=(t,e)=>Yf(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")},Gf=function*(){}.constructor,ha=async function*(){}.constructor;function ts(t){return!(!t.prototype||t instanceof Gf||ha!==Function&&t instanceof ha)}ie(ts,"isConstructor");function Xn(t,e){const n=t.Config||t.schema;return n&&t.schema!==!1&&(e=n(e)),e??{}}ie(Xn,"resolveConfig");function pa(t){return[Map,Set,Date,Promise].some(e=>t instanceof e)}ie(pa,"isUnproxyable");function ns(t,e){if(t===Object.prototype)return e;const n=Object.create(ns(Object.getPrototypeOf(t),e));for(const r of Reflect.ownKeys(t))Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r));return n}ie(ns,"joinPrototype");function rs(t){return t&&(typeof t=="object"||typeof t=="function")}ie(rs,"isObject");function wt(t,e,n){if(!rs(e))return e;if(Object.hasOwn(e,Y.shadow))return Object.getPrototypeOf(e);const r=e[Y.tracker];return r?Ur(t,e,r,n):e}ie(wt,"getTraceable");function Zn(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(Zn,"withProps");function Fr(t,e,n){return Zn(t,Object.defineProperty(Object.create(null),e,{value:n,writable:!1}))}ie(Fr,"withProp");function is(t,e,n,r){if(!n)return r;const i=Reflect.getOwnPropertyDescriptor(e,n)?.value;return i?Fr(r,n,t.extend({[Y.shadow]:i})):r}ie(is,"createShadow");function ma(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(...y){return Reflect.apply(f,this===c?l:this,y)}: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(ma,"createShadowMethod");function Ur(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}`,Fr(t,Y.receiver,a));const l=is(t,s,n.property,a),u=Reflect.get(s,o,l),c=u?.[Y.tracker];return c?Ur(t,u,c):!r&&typeof u=="function"?ma(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,Fr(t,Y.receiver,l));const u=is(t,s,n.property,l);return Reflect.set(s,o,a,u)},"set"),apply:ie((s,o,a)=>ss(i,s,o,a),"apply")});return i}ie(Ur,"createTraceable");function ss(t,e,n,r){return e[Y.invoke]?e[Y.invoke].apply(t,r):Reflect.apply(e,n,r)}ie(ss,"applyTraceable");function os(t,e,n){const r=ie(function(...i){const s=Ur(r.ctx,r,n);return ss(s,r,this,i)},"self");return qe(r,"name",t),Object.setPrototypeOf(r,e)}ie(os,"createCallable");var Qf=(dt=class{constructor(e){this.ctx=e,qe(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 _t(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,Gi(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?Gn(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?Gn(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 _t(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 _t(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),Zi=Af;function es(t){return t!==null&&t!==!1&&t!==void 0}ie(es,"isBailed");var If=(Nn=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>"),()=>Ut(this.scope.disposables,i);if(r==="fork")return this.scope.runtime.forkables[o](i),this.scope.collect("event <fork>",()=>Ut(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===Zi.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=_t(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(es(n))return n}bail(...e){for(const n of this.dispatch("bail",e))if(es(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),Tf=If,ts=(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"}})(ts||(ts={}));var ia=(Mn=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 ts("INACTIVE_EFFECT")}effect(e,n){this.assertActive();const r=Ki(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,Ut(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(()=>(Ut(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),()=>Ut(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(v=>s.add(v));else{let v=!1;for(const b of u)v||(v=i(b));if(!v)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(Mn,"EffectScope"),Mn),Rf=(jn=class extends ia{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=Ut(r.disposables,this.dispose);return Ut(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=Yn(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),sa=(Fn=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(Ki(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 Rf(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=Yn(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(Fn,"MainScope"),Fn);function oa(t){return t&&typeof t=="object"&&typeof t.apply=="function"}ie(oa,"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(Gn(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 Df=(Bn=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 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=Yn(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(Bn,"Registry"),Bn),Lf=Df,Je=(Pe=class{static is(e){return!!e?.[Pe.is]}static associate(e,n){return e}constructor(e){e=Yn(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,Zi.handler);n.root=n,n.reflect=new Zi(n),n.registry=new Lf(n,e),n.lifecycle=new Tf(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(_t(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 yn=(st=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=Xi(r,Yi(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[st.invoke]?n=Xi(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(st,"Service"),te(st,"setup",Y.setup),te(st,"invoke",Y.invoke),te(st,"extend",Y.extend),te(st,"tracker",Y.tracker),te(st,"provide",Y.provide),te(st,"immediate",Y.immediate),st),Nf=Object.defineProperty,Mf=Object.getOwnPropertyNames,ue=(t,e)=>Nf(t,"name",{value:e,configurable:!0}),jf=(t,e)=>function(){return e||(0,t[Mf(t)[0]])((e={exports:{}}).exports,e),e.exports},Ff=jf({"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,S){let P="$";for(const R of S.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=S}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,S={}){return s.resolve(h,p,S)[0]},"schema");if(g.refs){const h=It(g.refs,P=>new s(P)),S=ue(P=>h[P],"getRef");for(const P in h){const R=h[P];R.sKey=S(R.sKey),R.inner=S(R.inner),R.list=R.list&&R.list.map(S),R.dict=R.dict&&It(R.dict,S)}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 S in p){const P=p[S];P?.$description||P?.$desc?h[S]=P.$description||P.$desc:typeof P=="string"&&(h[S]=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),S=a(h.meta.description,p);return Object.keys(S).length&&(h.meta.description=S),h.dict&&(h.dict=It(h.dict,(P,R)=>P.i18n(It(p,z=>l(z)?.[R]??z?.[R])))),h.list&&(h.list=h.list.map((P,R)=>P.i18n(It(p,(z={})=>Array.isArray(l(z))?l(z)[R]:Array.isArray(z)?z[R]:u(z))))),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 S=s(this);return S.meta={...S.meta,[p]:h},S},"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),S=Qo(p,["source","flags"]);return h.meta={...h.meta,pattern:S},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 S in p){const R=(this.type==="object"?this.dict[S]:this.inner)?.simplify(p[S]);(this.type==="dict"||!$e(R))&&(h[S]=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((S,P)=>{const R=this.type==="array"?this.inner:this.list[P],z=R?R.simplify(S):S;h.push(z)}),h}else if(this.type==="intersect"){const h={};for(const S of this.list)Object.assign(h,S.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,S={},P=!1){if(!h)return[p];if(S.ignore?.(p,h))return[p];if($e(p)&&h.type!=="lazy"){if(h.meta.required)throw new i("missing required value",S);let z=h,X=h.meta.default;for(;z?.type==="intersect"&&$e(X);)z=z.list[0],X=z?.meta.default;if($e(X))return[p];p=Rr(X)}const R=c[h.type];if(!R)throw new i(`unsupported type "${h.type}"`,S);try{return R(p,h,S,P)}catch(z){if(!h.meta.loose)throw z;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(()=>(S.inner[n]||(S.inner=S.builder(),S.inner.meta={...S.meta,...S.inner.meta}),S.inner.toJSON()),"toJSON"),S=new s({type:"lazy",builder:p,inner:{toJSON:h}});return S},"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 S=new Date(p);if(isNaN(+S))throw new i(`invalid date "${p}"`,h);return S},!0)])},"date"),s.regExp=ue(function(p=""){return s.union([s.is(RegExp),s.transform(s.string().role("regexp",{flag:p}),(h,S)=>{try{return new RegExp(h,p)}catch(P){throw new i(P.message,S)}},!0)])},"regExp"),s.arrayBuffer=ue(function(p){return s.union([s.is(ArrayBuffer),s.is(SharedArrayBuffer),s.transform(s.any(),(h,S)=>{if(bt.isSource(h))return bt.fromSource(h);throw new i(`expected ArrayBufferSource but got ${h}`,S)},!0),...p?[s.transform(s.string(),(h,S)=>{try{return p==="base64"?bt.fromBase64(h):bt.fromHex(h)}catch(P){throw new i(P.message,S)}},!0)]:[]])},"arrayBuffer"),s.extend("lazy",(g,p,h,S)=>(p.inner[n]||(p.inner=p.builder(),p.inner.meta={...p.meta,...p.inner.meta}),s.resolve(g,p.inner,h,S))),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,S,P=!1){const{max:R=1/0,min:z=-1/0}=p;if(g>R)throw new i(`expected ${h} <= ${R} but got ${g}`,S);if(g<z&&!P)throw new i(`expected ${h} >= ${z} but got ${g}`,S)}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 S=new RegExp(p.pattern.source,p.pattern.flags);if(!S.test(g))throw new i(`expect string to match regexp ${S}`,h)}return f(g.length,p,"string length",h),[g]});function y(g,p){const h=g.toString();if(h.includes("e"))return g*Math.pow(10,p);const S=h.indexOf(".");if(S===-1)return g*Math.pow(10,p);const P=h.slice(S+1),R=h.slice(0,S);return P.length<=p?+(R+P.padEnd(p,"0")):+(R+P.slice(0,p)+"."+P.slice(p))}ue(y,"decimalShift");function v(g,p,h){if(h=Math.abs(h),!/^\d+\.\d+$/.test(h.toString()))return(g-p)%h===0;const S=h.toString().indexOf("."),P=h.toString().slice(S+1).length;return Math.abs(y(g,P)-y(p,P))%y(h,P)===0}ue(v,"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:S}=p;if(S&&!v(g,p.min??0,S))throw new i(`expected number multiple of ${S} 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},S)=>{let P=0,R=[];if(typeof g=="number"){P=g;for(const z in p)g&p[z]&&R.push(z)}else if(Array.isArray(g)){R=g;for(const z of R){if(typeof z!="string")throw new i(`expected string but got ${z}`,S);z in p&&(P|=p[z])}}else throw new i(`expected number or array but got ${g}`,S);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 S=Object.getPrototypeOf(g);for(;S;){if(S.constructor?.name===p)return[g];S=Object.getPrototypeOf(S)}throw new i(`expected ${p} but got ${g}`,h)}});function b(g,p,h,S){try{const[P,R]=s.resolve(g[p],h,{...S,path:[...S.path||[],p]});return R!==void 0&&(g[p]=R),P}catch(P){if(!S?.autofix)throw P;return delete g[p],h.meta.default}}ue(b,"property"),s.extend("array",(g,{inner:p,meta:h},S)=>{if(!Array.isArray(g))throw new i(`expected array but got ${g}`,S);return f(g.length,h,"array length",S,!$e(p.meta.default)),[g.map((P,R)=>b(g,R,p,S))]}),s.extend("dict",(g,{inner:p,sKey:h},S,P)=>{if(!Tr(g))throw new i(`expected object but got ${g}`,S);const R={};for(const z in g){let X;try{X=s.resolve(z,h,S)[0]}catch(Ce){if(P)continue;throw Ce}R[X]=b(g,z,p,S),g[X]=g[z],z!==X&&delete g[z]}return[R]}),s.extend("tuple",(g,{list:p},h,S)=>{if(!Array.isArray(g))throw new i(`expected array but got ${g}`,h);const P=p.map((R,z)=>b(g,z,R,h));return S?[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,S)=>{if(!Tr(g))throw new i(`expected object but got ${g}`,h);const P={};for(const R in p){const z=b(g,R,p[R],h);(!$e(z)||R in g)&&(P[R]=z)}return S||A(P,g),[P]}),s.extend("union",(g,{list:p,toString:h},S,P)=>{for(const R of p)try{return s.resolve(g,R,S,P)}catch{}throw new i(`expected ${h()} but got ${JSON.stringify(g)}`,S)}),s.extend("intersect",(g,{list:p,toString:h},S,P)=>{if(!p.length)return[g];let R;for(const z of p){const X=s.resolve(g,z,S,!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)}`,S);if(typeof X=="object")A(R??(R={}),X);else if(R!==X)throw new i(`expected ${h()} but got ${JSON.stringify(g)}`,S)}}return!P&&Tr(g)&&A(R,g),[R]}),s.extend("transform",(g,{inner:p,callback:h,preserve:S},P)=>{const[R,z=g]=s.resolve(g,p,P,!0);return S?[h(R)]:[h(R),h(z)]});var U={};function L(g,p,h){U[g]=h,Object.assign(s,{[g](...S){const P=new s({type:g});return p.forEach((R,z)=>{switch(R){case"sKey":P.sKey=S[z]??s.string();break;case"inner":P.inner=s.from(S[z]);break;case"list":P.list=S[z].map(s.from);break;case"dict":P.dict=It(S[z],s.from);break;case"bits":{P.bits={};for(const X in S[z])typeof S[z][X]=="number"&&(P.bits[X]=S[z][X]);break}case"callback":{const X=P.callback=S[z];X.toJSON||(X.toJSON=()=>X.toString());break}case"constructor":{const X=P.constructor=S[z];typeof X=="function"&&(X.toJSON||(X.toJSON=()=>X.name));break}default:P[R]=S[z]}}),g==="object"||g==="dict"?P.meta.default={}:g==="array"||g==="tuple"?P.meta.default=[]:g==="bitset"&&(P.meta.default=0),P}})}ue(L,"defineMethod"),L("is",["constructor"],({constructor:g})=>typeof g=="function"?g.name:g),L("any",[],()=>"any"),L("never",[],()=>"never"),L("const",["value"],({value:g})=>typeof g=="string"?JSON.stringify(g):g),L("string",[],()=>"string"),L("number",[],()=>"number"),L("boolean",[],()=>"boolean"),L("bitset",["bits"],()=>"bitset"),L("function",[],()=>"function"),L("array",["inner"],({inner:g})=>`${g.toString(!0)}[]`),L("dict",["inner","sKey"],({inner:g,sKey:p})=>`{ [key: ${p.toString()}]: ${g.toString()} }`),L("tuple",["list"],({list:g})=>`[${g.map(p=>p.toString()).join(", ")}]`),L("object",["dict"],({dict:g})=>Object.keys(g).length===0?"{}":`{ ${Object.entries(g).map(([p,h])=>`${p}${h.meta.required?"":"?"}: ${h.toString()}`).join(", ")} }`),L("union",["list"],({list:g},p)=>{const h=g.map(({toString:S})=>S()).join(" | ");return p?`(${h})`:h}),L("intersect",["list"],({list:g})=>`${g.map(p=>p.toString(!0)).join(" & ")}`),L("transform",["inner","callback","preserve"],({inner:g},p)=>g.toString(p)),e.exports=s}});const Se=Ff();/**
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(!ke(n)&&!ke(i))throw new Error(`service ${e} has been registered`);const o=this.ctx;ke(n)||(s=o.effect(()=>()=>{o.set(e,void 0)})),pa(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,rs(n)&&(this.ctx[Y.store][s]={value:n,source:null},qe(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(ke(u))return u;const c=l?Zn(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?Zn(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(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 wt(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),as=Qf;function ls(t){return t!==null&&t!==!1&&t!==void 0}ie(ls,"isBailed");var Jf=(Fn=class{constructor(e){te(this,"isActive",!1);te(this,"_tasks",new Set);te(this,"_hooks",{});this.ctx=e,qe(this,Y.tracker,{associate:"lifecycle",property:"ctx"}),qe(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),qe(i,"name","event <dispose>"),()=>zt(this.scope.disposables,i);if(r==="fork")return this.scope.runtime.forkables[o](i),this.scope.collect("event <fork>",()=>zt(this.scope.runtime.forkables,i))}),Qe.static,e.scope);for(const r of["info","error","warning"])qe(this.on(`internal/${r}`,(i,...s)=>{this._hooks[`internal/${r}`].length>1}),Qe.static,e.scope);qe(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}),Qe.static,e.scope),qe(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}),Qe.static,e.scope);const n=ie((r,i)=>{if(!r.runtime.plugin)return!1;for(const s in r.runtime.inject)if(i===as.resolveInject(r.ctx,s)[0])return!0;return n(r.parent.scope,i)},"checkInject");qe(this.on("internal/inject",function(r){return n(this.scope,r)},{global:!0}),Qe.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?.[Qe.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(ls(n))return n}bail(...e){for(const n of this.dispatch("bail",e))if(ls(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(Fn,"Lifecycle"),Fn),Xf=Jf,cs=(vn=class extends Error{constructor(e,n){super(n??vn.Code[e]),this.code=e}},ie(vn,"CordisError"),vn);(t=>{t.Code={INACTIVE_EFFECT:"cannot create effect on inactive context"}})(cs||(cs={}));var ga=(Un=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 cs("INACTIVE_EFFECT")}effect(e,n){this.assertActive();const r=ts(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,zt(this.disposables,o),s(...a)},"wrapped");return this.disposables.push(o),typeof r=="function"?o:(r.dispose=o,r)}collect(e,n){const r=qe(()=>(zt(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||!ke(this.ctx.get(e)))}reset(){this.isActive=!1,this.disposables=this.disposables.splice(0).filter(e=>{if(this.uid!==null&&e[Qe.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),()=>zt(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]=!on(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(v=>s.add(v));else{let v=!1;for(const b of u)v||(v=i(b));if(!v)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(Un,"EffectScope"),Un),Zf=(qn=class extends ga{constructor(n,r,i,s){super(n,i);te(this,"dispose");this.runtime=r,this.dispose=qe(n.scope.collect(`fork <${n.runtime.name}>`,()=>{this.uid=null,this.reset(),this.context.emit("internal/fork",this);const o=zt(r.disposables,this.dispose);return zt(r.children,this)&&!r.children.length&&n.registry.delete(r.plugin),o}),Qe.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=Xn(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(qn,"ForkScope"),qn),va=(Hn=class extends ga{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(ts(this.plugin)){const i=new this.plugin(n,r),s=i[Qe.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 Zf(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=ze.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=Xn(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(Hn,"MainScope"),Hn);function ya(t){return t&&typeof t=="object"&&typeof t.apply=="function"}ie(ya,"isApplicable");function ze(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(Zn(this,{[r]:i}))})});else throw new Error("@Inject can only be used on class or class methods")}}ie(ze,"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")})(ze||(ze={}));var ed=(zn=class{constructor(e,n){te(this,"_counter",0);te(this,"_internal",new Map);te(this,"context");this.ctx=e,qe(this,Y.tracker,{associate:"registry",property:"ctx"}),this.context=e;const r=new va(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(ya(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=Xn(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 va(this.ctx,e,n,r),this.set(e,i),i.fork(this.ctx,n,r))}},ie(zn,"Registry"),zn),td=ed,Qe=(Oe=class{static is(e){return!!e?.[Oe.is]}static associate(e,n){return e}constructor(e){e=Xn(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,as.handler);n.root=n,n.reflect=new as(n),n.registry=new td(n,e),n.lifecycle=new Xf(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),qe(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(Oe,"Context"),te(Oe,"store",Y.store),te(Oe,"events",Y.events),te(Oe,"static",Y.static),te(Oe,"filter",Y.filter),te(Oe,"expose",Y.expose),te(Oe,"isolate",Y.isolate),te(Oe,"internal",Y.internal),te(Oe,"intercept",Y.intercept),te(Oe,"origin","ctx"),te(Oe,"current","ctx"),Oe.is[Symbol.toPrimitive]=()=>Symbol.for("cordis.is"),Oe.prototype[Oe.is]=!0,Oe);Qe.prototype[Qe.internal]=Object.create(null);var an=(ot=class{constructor(...e){te(this,"ctx");te(this,"name");te(this,"config");let n,r,i,s;Qe.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=os(r,ns(Object.getPrototypeOf(this),Function.prototype),a)),n?o.ctx=n:o[Y.setup](),o.name=r,o.config=s,qe(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 Qe}[Y.extend](e){let n;return this[ot.invoke]?n=os(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),nd=Object.defineProperty,rd=Object.getOwnPropertyNames,ue=(t,e)=>nd(t,"name",{value:e,configurable:!0}),id=(t,e)=>function(){return e||(0,t[rd(t)[0]])((e={exports:{}}).exports,e),e.exports},sd=id({"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,S){let O="$";for(const R of S.path||[])typeof R=="string"?O+="."+R:typeof R=="number"?O+="["+R+"]":typeof R=="symbol"&&(O+=`[Symbol(${R.toString()})]`);O.startsWith(".")&&(O=O.slice(1));super((O==="$"?"":`${O} `)+h);te(this,"name","ValidationError");this.options=S}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,S={}){return s.resolve(h,p,S)[0]},"schema");if(g.refs){const h=Rt(g.refs,O=>new s(O)),S=ue(O=>h[O],"getRef");for(const O in h){const R=h[O];R.sKey=S(R.sKey),R.inner=S(R.inner),R.list=R.list&&R.list.map(S),R.dict=R.dict&&Rt(R.dict,S)}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 S in p){const O=p[S];O?.$description||O?.$desc?h[S]=O.$description||O.$desc:typeof O=="string"&&(h[S]=O)}return h}ue(a,"mergeDesc");function l(g){return g?.$value??g?.$inner}ue(l,"getInner");function u(g){return la(g??{},p=>!p.startsWith("$"))}ue(u,"extractKeys"),s.prototype.i18n=ue(function(p){const h=s(this),S=a(h.meta.description,p);return Object.keys(S).length&&(h.meta.description=S),h.dict&&(h.dict=Rt(h.dict,(O,R)=>O.i18n(Rt(p,z=>l(z)?.[R]??z?.[R])))),h.list&&(h.list=h.list.map((O,R)=>O.i18n(Rt(p,(z={})=>Array.isArray(l(z))?l(z)[R]:Array.isArray(z)?z[R]:u(z))))),h.inner&&(h.inner=h.inner.i18n(Rt(p,O=>l(O)?l(O):u(O)))),h.sKey&&(h.sKey=h.sKey.i18n(Rt(p,O=>O?.$key))),h},"i18n"),s.prototype.extra=ue(function(p,h){const S=s(this);return S.meta={...S.meta,[p]:h},S},"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),S=ca(p,["source","flags"]);return h.meta={...h.meta,pattern:S},h},"pattern"),s.prototype.simplify=ue(function(p){if(on(p,this.meta.default,this.type==="dict"))return null;if(ke(p))return p;if(this.type==="object"||this.type==="dict"){const h={};for(const S in p){const R=(this.type==="object"?this.dict[S]:this.inner)?.simplify(p[S]);(this.type==="dict"||!ke(R))&&(h[S]=R)}return on(h,this.meta.default,this.type==="dict")?null:h}else if(this.type==="array"||this.type==="tuple"){const h=[];return p.forEach((S,O)=>{const R=this.type==="array"?this.inner:this.list[O],z=R?R.simplify(S):S;h.push(z)}),h}else if(this.type==="intersect"){const h={};for(const S of this.list)Object.assign(h,S.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,S={},O=!1){if(!h)return[p];if(S.ignore?.(p,h))return[p];if(ke(p)&&h.type!=="lazy"){if(h.meta.required)throw new i("missing required value",S);let z=h,X=h.meta.default;for(;z?.type==="intersect"&&ke(X);)z=z.list[0],X=z?.meta.default;if(ke(X))return[p];p=Br(X)}const R=c[h.type];if(!R)throw new i(`unsupported type "${h.type}"`,S);try{return R(p,h,S,O)}catch(z){if(!h.meta.loose)throw z;return[h.meta.default]}},"resolve"),s.from=ue(function(p){if(ke(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(()=>(S.inner[n]||(S.inner=S.builder(),S.inner.meta={...S.meta,...S.inner.meta}),S.inner.toJSON()),"toJSON"),S=new s({type:"lazy",builder:p,inner:{toJSON:h}});return S},"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 S=new Date(p);if(isNaN(+S))throw new i(`invalid date "${p}"`,h);return S},!0)])},"date"),s.regExp=ue(function(p=""){return s.union([s.is(RegExp),s.transform(s.string().role("regexp",{flag:p}),(h,S)=>{try{return new RegExp(h,p)}catch(O){throw new i(O.message,S)}},!0)])},"regExp"),s.arrayBuffer=ue(function(p){return s.union([s.is(ArrayBuffer),s.is(SharedArrayBuffer),s.transform(s.any(),(h,S)=>{if(bt.isSource(h))return bt.fromSource(h);throw new i(`expected ArrayBufferSource but got ${h}`,S)},!0),...p?[s.transform(s.string(),(h,S)=>{try{return p==="base64"?bt.fromBase64(h):bt.fromHex(h)}catch(O){throw new i(O.message,S)}},!0)]:[]])},"arrayBuffer"),s.extend("lazy",(g,p,h,S)=>(p.inner[n]||(p.inner=p.builder(),p.inner.meta={...p.meta,...p.inner.meta}),s.resolve(g,p.inner,h,S))),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(on(g,p))return[p];throw new i(`expected ${p} but got ${g}`,h)});function f(g,p,h,S,O=!1){const{max:R=1/0,min:z=-1/0}=p;if(g>R)throw new i(`expected ${h} <= ${R} but got ${g}`,S);if(g<z&&!O)throw new i(`expected ${h} >= ${z} but got ${g}`,S)}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 S=new RegExp(p.pattern.source,p.pattern.flags);if(!S.test(g))throw new i(`expect string to match regexp ${S}`,h)}return f(g.length,p,"string length",h),[g]});function y(g,p){const h=g.toString();if(h.includes("e"))return g*Math.pow(10,p);const S=h.indexOf(".");if(S===-1)return g*Math.pow(10,p);const O=h.slice(S+1),R=h.slice(0,S);return O.length<=p?+(R+O.padEnd(p,"0")):+(R+O.slice(0,p)+"."+O.slice(p))}ue(y,"decimalShift");function v(g,p,h){if(h=Math.abs(h),!/^\d+\.\d+$/.test(h.toString()))return(g-p)%h===0;const S=h.toString().indexOf("."),O=h.toString().slice(S+1).length;return Math.abs(y(g,O)-y(p,O))%y(h,O)===0}ue(v,"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:S}=p;if(S&&!v(g,p.min??0,S))throw new i(`expected number multiple of ${S} 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},S)=>{let O=0,R=[];if(typeof g=="number"){O=g;for(const z in p)g&p[z]&&R.push(z)}else if(Array.isArray(g)){R=g;for(const z of R){if(typeof z!="string")throw new i(`expected string but got ${z}`,S);z in p&&(O|=p[z])}}else throw new i(`expected number or array but got ${g}`,S);return O===h.default?[O]:[O,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(ke(g))throw new i(`expected ${p} but got ${g}`,h);let S=Object.getPrototypeOf(g);for(;S;){if(S.constructor?.name===p)return[g];S=Object.getPrototypeOf(S)}throw new i(`expected ${p} but got ${g}`,h)}});function b(g,p,h,S){try{const[O,R]=s.resolve(g[p],h,{...S,path:[...S.path||[],p]});return R!==void 0&&(g[p]=R),O}catch(O){if(!S?.autofix)throw O;return delete g[p],h.meta.default}}ue(b,"property"),s.extend("array",(g,{inner:p,meta:h},S)=>{if(!Array.isArray(g))throw new i(`expected array but got ${g}`,S);return f(g.length,h,"array length",S,!ke(p.meta.default)),[g.map((O,R)=>b(g,R,p,S))]}),s.extend("dict",(g,{inner:p,sKey:h},S,O)=>{if(!jr(g))throw new i(`expected object but got ${g}`,S);const R={};for(const z in g){let X;try{X=s.resolve(z,h,S)[0]}catch(Ce){if(O)continue;throw Ce}R[X]=b(g,z,p,S),g[X]=g[z],z!==X&&delete g[z]}return[R]}),s.extend("tuple",(g,{list:p},h,S)=>{if(!Array.isArray(g))throw new i(`expected array but got ${g}`,h);const O=p.map((R,z)=>b(g,z,R,h));return S?[O]:(O.push(...g.slice(p.length)),[O])});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,S)=>{if(!jr(g))throw new i(`expected object but got ${g}`,h);const O={};for(const R in p){const z=b(g,R,p[R],h);(!ke(z)||R in g)&&(O[R]=z)}return S||A(O,g),[O]}),s.extend("union",(g,{list:p,toString:h},S,O)=>{for(const R of p)try{return s.resolve(g,R,S,O)}catch{}throw new i(`expected ${h()} but got ${JSON.stringify(g)}`,S)}),s.extend("intersect",(g,{list:p,toString:h},S,O)=>{if(!p.length)return[g];let R;for(const z of p){const X=s.resolve(g,z,S,!0)[0];if(!ke(X))if(ke(R))R=X;else{if(typeof R!=typeof X)throw new i(`expected ${h()} but got ${JSON.stringify(g)}`,S);if(typeof X=="object")A(R??(R={}),X);else if(R!==X)throw new i(`expected ${h()} but got ${JSON.stringify(g)}`,S)}}return!O&&jr(g)&&A(R,g),[R]}),s.extend("transform",(g,{inner:p,callback:h,preserve:S},O)=>{const[R,z=g]=s.resolve(g,p,O,!0);return S?[h(R)]:[h(R),h(z)]});var U={};function D(g,p,h){U[g]=h,Object.assign(s,{[g](...S){const O=new s({type:g});return p.forEach((R,z)=>{switch(R){case"sKey":O.sKey=S[z]??s.string();break;case"inner":O.inner=s.from(S[z]);break;case"list":O.list=S[z].map(s.from);break;case"dict":O.dict=Rt(S[z],s.from);break;case"bits":{O.bits={};for(const X in S[z])typeof S[z][X]=="number"&&(O.bits[X]=S[z][X]);break}case"callback":{const X=O.callback=S[z];X.toJSON||(X.toJSON=()=>X.toString());break}case"constructor":{const X=O.constructor=S[z];typeof X=="function"&&(X.toJSON||(X.toJSON=()=>X.name));break}default:O[R]=S[z]}}),g==="object"||g==="dict"?O.meta.default={}:g==="array"||g==="tuple"?O.meta.default=[]:g==="bitset"&&(O.meta.default=0),O}})}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:S})=>S()).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 _e=sd();/**
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 ns=(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))(ns||{});const rs=globalThis||window,is=Symbol.for("__IPE_LOGGER_COLOR_MAP__");rs[is]||(rs[is]=new Map);const ss=rs[is];function Nr(t){let e=2166136261;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n),e=(e>>>0)*16777619;return e>>>0}const aa=[[350,360],[0,15],[15,30],[200,230],[230,250],[250,280],[280,310],[310,330],[140,160],[160,180]];function Bf(t,e){const n=aa.length,r=Nr(t)%n,[i,s]=aa[r],o=s-i,a=Nr(t+":"+e),l=i+a%(o||1),u=Nr(t+":s"),c=Nr(t+":l");let f,y;if(e==="name")f=62+u%18,y=30+c%12;else{const v=l>=0&&l<50||l>330&&l<360,b=l>=200&&l<=300;f=55+u%20,b?y=55+c%8:v?y=48+c%6:y=50+c%8,f<60&&(f+=5)}return`hsl(${l}, ${f}%, ${y}%)`}function Mr(t,e){if(e)return ss.set(t,e),e;const n=ss.get(t);if(n)return n;const r=t.startsWith("name:")?"name":"group",i=Bf(t,r);return ss.set(t,i),i}/**
10
+ */var us=(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))(us||{});const fs=globalThis||window,ds=Symbol.for("__IPE_LOGGER_COLOR_MAP__");fs[ds]||(fs[ds]=new Map);const hs=fs[ds];function qr(t){let e=2166136261;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n),e=(e>>>0)*16777619;return e>>>0}const ba=[[350,360],[0,15],[15,30],[200,230],[230,250],[250,280],[280,310],[310,330],[140,160],[160,180]];function od(t,e){const n=ba.length,r=qr(t)%n,[i,s]=ba[r],o=s-i,a=qr(t+":"+e),l=i+a%(o||1),u=qr(t+":s"),c=qr(t+":l");let f,y;if(e==="name")f=62+u%18,y=30+c%12;else{const v=l>=0&&l<50||l>330&&l<360,b=l>=200&&l<=300;f=55+u%20,b?y=55+c%8:v?y=48+c%6:y=50+c%8,f<60&&(f+=5)}return`hsl(${l}, ${f}%, ${y}%)`}function Hr(t,e){if(e)return hs.set(t,e),e;const n=hs.get(t);if(n)return n;const r=t.startsWith("name:")?"name":"group",i=od(t,r);return hs.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
- */let la=class af{constructor(e={}){this._custom=n=>{if(!this._enabled(n.level))return ca;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 Hf(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 af({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=Uf[e];if(!this._enabled(n.level))return ca;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;`,ua)}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;`,ua)}return[r,n]}};const ca=()=>{},ua="color:inherit; background:transparent; text-decoration:none;",Uf={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 Hf(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 fa(t){return new la(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 qf=class extends Qe{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(Wf(r))return!1;const i=Vf(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=Kf(u);c>o&&(o=c,a=c>.7)}catch{continue}return a}function Wf(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 Vf(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 Kf(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?!Yf(s)&&!Gf(s)&&n++:e-=.1}const r=n/t.length;return e*=r,Jf(t)&&(e*=1.1),Math.max(0,Math.min(1,e))}function Yf(t){return t>=0&&t<=31||t>=127&&t<=159}function Gf(t){return t>=57344&&t<=63743||t>=983040&&t<=1048573||t>=1048576&&t<=1114109}function Jf(t){return[/\b\w+\b/,/[.!?]+\s/,/\s+/,/[a-zA-Z]{3,}/,/[\u4e00-\u9fa5]+/,/\d+/].some(e=>e.test(t))}function jr(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 da(t,e={}){const n={};return Object.entries(t).forEach(([r,i])=>{i!=null&&(e.dropEmptyString&&i===""||(n[r]=i))}),n}let Jn=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 Qf(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/")||!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 Jn(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 Jn(t,l)}else{if(e==="stream")return new Jn(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:y}=await l.read();if(f)break;if(y&&(u=new Uint8Array([...u,...y]),n&&s>0)){const v=Math.min(u.length/s,1);n(v,u)}}const c=new Jn(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(),y=f[0],v=f[f.length-1];if(y==="{"&&v==="}"||y==="["&&v==="]")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 qf(`Request failed with status code ${t.status}`,c)}}}let Xf=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 Zf(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var os,ha;function ed(){if(ha)return os;ha=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),os=t,os}var td=ed();const nd=Zf(td),Fr=class en extends nd{constructor(e={}){super("request"),this.baseConfigs=e,this.hooks=[],this.interceptors={request:this.createInterceptor("beforeRequest"),response:this.createInterceptor("afterResponse")},this.create=en.create,this.dropUndefinedAndNull=da,this.checkIsPlainObject=jr,e={...en.DEFAULT_CONFIGS,...e},en.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,y=new URLSearchParams(c.searchParams);if(c.search="",a.url=c.href,a.query=this.mergeQuery(f,this.baseConfigs.query,y,n.query),c.search=Xf.makeQueryString(a.query),a.url=c.toString(),en.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 v;typeof a.body<"u"&&a.body!==null&&(a.body instanceof Blob||a.body instanceof FormData||a.body instanceof URLSearchParams?v=a.body:typeof a.body=="object"&&a.body!==null?(v=JSON.stringify(a.body),a.headers["content-type"]="application/json"):v=a.body),!((o=n.headers)!=null&&o["content-type"])&&v&&(v instanceof FormData||v instanceof URLSearchParams?delete a.headers["content-type"]:typeof v=="string"&&typeof a.body=="object"?a.headers["content-type"]="application/json":v instanceof Blob&&(a.headers["content-type"]=v.type)),a.body=v,a=await this.emit("afterBodyTransformed",a);const b=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:b?.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=S=>{clearTimeout(h),p(new Qe(nt.NETWORK_ERROR,"WebSocket connection failed",a))},I.onclose=S=>{S.code!==1e3&&(clearTimeout(h),p(new Qe(nt.NETWORK_ERROR,`WebSocket closed with code ${S.code}`,a)))}}),a.rawResponse=new Response,a.response=new Jn(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 L;try{b&&(L=setTimeout(()=>{b.abort()},U));const I=await(n.fetch||this.baseConfigs.fetch||globalThis.fetch)(a.rawRequest).catch(g=>{throw L&&clearTimeout(L),b!=null&&b.signal.aborted?new Qe(nt.TIMEOUT,`Request timed out after ${U}ms`,a):new Qe(nt.NETWORK_ERROR,g.message,a)});return L&&clearTimeout(L),a.rawResponse=I,a.response=await Qf(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 L&&clearTimeout(L),I}}mergeQuery(e,...n){const r={},i=s=>{s&&(jr(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(jr(s)){const o=da(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)=>(en.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 en({...this.baseConfigs,...e});return n.hooks=[...this.hooks],n}static create(e){return new en(e)}};Fr.DEFAULT_CONFIGS={baseURL:"",timeout:60*1e3,credentials:"same-origin",headers:{},query:{},responseType:void 0,fetch:globalThis.fetch},Fr.ALL_METHODS=["get","post","put","patch","delete","head","options","trace"],Fr.METHODS_WITHOUT_BODY=["get","head","options","trace"];let pa=Fr;/**
29
+ */let wa=class Cf{constructor(e={}){this._custom=n=>{if(!this._enabled(n.level))return _a;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&&Hr(`name:${this._name}`,this._nameColor),this._installBuiltinLevels();for(const n of Object.keys(this._dynamicLevels))this._installLevelGetter(n,this._dynamicLevels[n]);return ld(this)}get level(){return this._levelRef.value}set level(e){this._levelRef.value=e}group(e,n){return e&&Hr(`group:${e}`,n?.color),new Cf({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=ad[e];if(!this._enabled(n.level))return _a;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=Hr(`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;`,xa)}if(e&&(r+=` ${e}`),this._groupPath.length){const i=this._groupPath.join("/"),s=Hr(`group:${i}`);r+=` %c${i}%c`,n.push(`color:${s}; text-decoration: underline;`,xa)}return[r,n]}};const _a=()=>{},xa="color:inherit; background:transparent; text-decoration:none;",ad={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 ld(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 Sa(t){return new wa(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 Je extends Error{constructor(e,n,r,i){super(n,i),this.code=e,this.context=r,this.name="FexiosError"}}let cd=class extends Je{constructor(e,n,r){super(n.statusText,e,void 0,r),this.response=n,this.name="FexiosResponseError"}};function ud(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(fd(r))return!1;const i=dd(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=hd(u);c>o&&(o=c,a=c>.7)}catch{continue}return a}function fd(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 dd(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 hd(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?!pd(s)&&!md(s)&&n++:e-=.1}const r=n/t.length;return e*=r,gd(t)&&(e*=1.1),Math.max(0,Math.min(1,e))}function pd(t){return t>=0&&t<=31||t>=127&&t<=159}function md(t){return t>=57344&&t<=63743||t>=983040&&t<=1048573||t>=1048576&&t<=1114109}function gd(t){return[/\b\w+\b/,/[.!?]+\s/,/\s+/,/[a-zA-Z]{3,}/,/[\u4e00-\u9fa5]+/,/\d+/].some(e=>e.test(t))}function zr(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 Ea(t,e={}){const n={};return Object.entries(t).forEach(([r,i])=>{i!=null&&(e.dropEmptyString&&i===""||(n[r]=i))}),n}let er=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 vd(t,e,n){var r;if(t.bodyUsed)throw new Je(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/")||!ud(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 er(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 er(t,l)}else{if(e==="stream")return new er(t,t.body);{const l=(r=t.clone().body)==null?void 0:r.getReader();if(!l)throw new Je(nt.NO_BODY_READER,"Failed to get ReadableStream from response body");let u=new Uint8Array;for(;;){const{done:f,value:y}=await l.read();if(f)break;if(y&&(u=new Uint8Array([...u,...y]),n&&s>0)){const v=Math.min(u.length/s,1);n(v,u)}}const c=new er(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(),y=f[0],v=f[f.length-1];if(y==="{"&&v==="}"||y==="["&&v==="]")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 cd(`Request failed with status code ${t.status}`,c)}}}let yd=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 bd(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ps,ka;function wd(){if(ka)return ps;ka=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),ps=t,ps}var _d=wd();const xd=bd(_d),Wr=class sn extends xd{constructor(e={}){super("request"),this.baseConfigs=e,this.hooks=[],this.interceptors={request:this.createInterceptor("beforeRequest"),response:this.createInterceptor("afterResponse")},this.create=sn.create,this.dropUndefinedAndNull=Ea,this.checkIsPlainObject=zr,e={...sn.DEFAULT_CONFIGS,...e},sn.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,y=new URLSearchParams(c.searchParams);if(c.search="",a.url=c.href,a.query=this.mergeQuery(f,this.baseConfigs.query,y,n.query),c.search=yd.makeQueryString(a.query),a.url=c.toString(),sn.METHODS_WITHOUT_BODY.includes((s=a.method)==null?void 0:s.toLocaleLowerCase())&&a.body)throw new Je(nt.BODY_NOT_ALLOWED,`Request method "${a.method}" does not allow body`);a=await this.emit("beforeRequest",a);let v;typeof a.body<"u"&&a.body!==null&&(a.body instanceof Blob||a.body instanceof FormData||a.body instanceof URLSearchParams?v=a.body:typeof a.body=="object"&&a.body!==null?(v=JSON.stringify(a.body),a.headers["content-type"]="application/json"):v=a.body),!((o=n.headers)!=null&&o["content-type"])&&v&&(v instanceof FormData||v instanceof URLSearchParams?delete a.headers["content-type"]:typeof v=="string"&&typeof a.body=="object"?a.headers["content-type"]="application/json":v instanceof Blob&&(a.headers["content-type"]=v.type)),a.body=v,a=await this.emit("afterBodyTransformed",a);const b=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:b?.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(nt.TIMEOUT,`WebSocket connection timed out after ${U}ms`,a))},U);I.onopen=()=>{clearTimeout(h),g()},I.onerror=S=>{clearTimeout(h),p(new Je(nt.NETWORK_ERROR,"WebSocket connection failed",a))},I.onclose=S=>{S.code!==1e3&&(clearTimeout(h),p(new Je(nt.NETWORK_ERROR,`WebSocket closed with code ${S.code}`,a)))}}),a.rawResponse=new Response,a.response=new er(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(nt.NETWORK_ERROR,`WebSocket creation failed: ${I}`,a)}let D;try{b&&(D=setTimeout(()=>{b.abort()},U));const I=await(n.fetch||this.baseConfigs.fetch||globalThis.fetch)(a.rawRequest).catch(g=>{throw D&&clearTimeout(D),b!=null&&b.signal.aborted?new Je(nt.TIMEOUT,`Request timed out after ${U}ms`,a):new Je(nt.NETWORK_ERROR,g.message,a)});return D&&clearTimeout(D),a.rawResponse=I,a.response=await vd(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&&(zr(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(zr(s)){const o=Ea(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 Je(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 Je(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 Je(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)=>(sn.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 sn({...this.baseConfigs,...e});return n.hooks=[...this.hooks],n}static create(e){return new sn(e)}};Wr.DEFAULT_CONFIGS={baseURL:"",timeout:60*1e3,credentials:"same-origin",headers:{},query:{},responseType:void 0,fetch:globalThis.fetch},Wr.ALL_METHODS=["get","post","put","patch","delete","head","options","trace"],Wr.METHODS_WITHOUT_BODY=["get","head","options","trace"];let $a=Wr;/**
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 rd=pa.create,ma=rd();typeof globalThis<"u"?globalThis.fexios=ma:typeof window<"u"&&(window.fexios=ma);/**
35
+ */const Sd=$a.create,Ca=Sd();typeof globalThis<"u"?globalThis.fexios=Ca:typeof window<"u"&&(window.fexios=Ca);/**
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 ga=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(jr(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 pa({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 vn("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 vn)throw o;if(o?.ok===!1)return this.login(e,n,r,{...i,noCache:!0,retry:i.retry-1});throw new vn("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 vn("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 vn("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 vn("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)}};ga.INIT_DEFAULT_PARAMS={action:"query",errorformat:"plaintext",format:"json",formatversion:2};let id=ga,vn=class extends Error{constructor(e,n="",r){super(),this.code=e,this.message=n,this.cause=r,this.name="WikiSaikouError"}};/**
41
+ */const Pa=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(zr(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 $a({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 xn("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 xn)throw o;if(o?.ok===!1)return this.login(e,n,r,{...i,noCache:!0,retry:i.retry-1});throw new xn("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 xn("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 xn("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 xn("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)}};Pa.INIT_DEFAULT_PARAMS={action:"query",errorformat:"plaintext",format:"json",formatversion:2};let Ed=Pa,xn=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 ya=class extends id{};class sd{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 ya(r,{headers:{"x-api-user-agent":`InPageEdit-NEXT ${e.version}`}});e.set("api",i)}}class od extends yn{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 Br=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ad(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Ur(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 as={exports:{}};/*!
47
+ */let Oa=class extends Ed{};class kd{constructor(e,n={}){this.ctx=e,n?.baseURL?.startsWith("/")&&(n.baseURL=new URL(n.baseURL,location.origin).href);const r=new Oa(n.baseURL,{headers:{"x-api-user-agent":`InPageEdit-NEXT ${e.version}`,...n.headers},...n});e.set("api",r)}}class $d extends an{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()}}const Vr=Object.keys;function Cd(t){return typeof t=="boolean"}function Pd(t){return t&&typeof t.nodeType=="number"}function Kr(t){return typeof t=="string"}function Ia(t){return typeof t=="number"}function ln(t){return typeof t=="object"?t!==null:tr(t)}function tr(t){return typeof t=="function"}function Od(t){return!!(t&&t.isComponent)}function Id(t){return ln(t)&&typeof t.length=="number"&&typeof t.nodeType!="number"}function ms(t,e){if(t)for(const n of Vr(t))e(t[n],n)}function Ad(t){return ln(t)&&"current"in t}const gs={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 Td(t,e){return t+e.charAt(0).toUpperCase()+e.substring(1)}const Rd=["Webkit","ms","Moz","O"];Vr(gs).forEach(t=>{Rd.forEach(e=>{gs[Td(e,t)]=0})});const Nd=Symbol.for("jsx-dom:type");var Aa=function(t){return t.ShadowRoot="ShadowRoot",t}(Aa||{});function Dd(t){return t!=null&&t[Nd]===Aa.ShadowRoot}const Ld="http://www.w3.org/2000/svg",Md="http://www.w3.org/1999/xlink",jd="http://www.w3.org/XML/1998/namespace";function Ta(t){return!Cd(t)&&t!=null}function vs(t){return Array.isArray(t)?t.map(vs).filter(Boolean).join(" "):ln(t)?Symbol.iterator in t?vs(Array.from(t)):Vr(t).filter(e=>t[e]).join(" "):Ta(t)?""+t:""}const Bd={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},Fd=/^(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 Nt(t){const e=document.createDocumentFragment();return Yr(t.children,e),e}function Ud(t,e,n){e={...e,children:n};const r=new t(e),i=r.render();return"ref"in e&&ys(e.ref,r),i}function w(t,e){let{children:n,...r}=e;!r.namespaceURI&&Bd[t]===0&&(r={...r,namespaceURI:Ld});let i;if(Kr(t)){if(i=r.namespaceURI?document.createElementNS(r.namespaceURI,t):document.createElement(t),Wd(r,i),Yr(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;ys(r.ref,i)}else if(tr(t))ln(t.defaultProps)&&(r={...t.defaultProps,...r}),i=Od(t)?Ud(t,r,n):t({...r,children:n});else throw new TypeError(`Invalid JSX element type: ${t}`);return i}function qd(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(Kr(e)||Array.isArray(e))&&(r.unshift(e),e={}),e=e||{},e.children!=null&&!r.length&&({children:r,...e}=e),w(t,{...e,children:r},e.key)}function ys(t,e){Ad(t)?t.current=e:tr(t)&&t(e)}function Yr(t,e){if(Id(t))Hd(t,e);else if(Kr(t)||Ia(t))bs(document.createTextNode(t),e);else if(t===null)bs(document.createComment(""),e);else if(Pd(t))bs(t,e);else if(Dd(t)){const n=e.attachShadow(t.attr);Yr(t.children,n),ys(t.ref,n)}}function Hd(t,e){for(const n of[...t])Yr(n,e);return e}function bs(t,e){e instanceof window.HTMLTemplateElement?e.content.appendChild(t):e.appendChild(t)}function Gr(t,e){return t.replace(/[A-Z]/g,n=>e+n.toLowerCase())}function Ra(t,e){e==null||e===!1||(Array.isArray(e)?e.forEach(n=>Ra(t,n)):Kr(e)?t.setAttribute("style",e):ln(e)&&ms(e,(n,r)=>{r.indexOf("-")===0?t.style.setProperty(r,n):Ia(n)&&gs[r]!==0?t.style[r]=n+"px":t.style[r]=n}))}function zd(t,e,n){switch(t){case"xlinkActuate":case"xlinkArcrole":case"xlinkHref":case"xlinkRole":case"xlinkShow":case"xlinkTitle":case"xlinkType":Na(n,Md,Gr(t,":"),e);return;case"xmlnsXlink":Sn(n,Gr(t,":"),e);return;case"xmlBase":case"xmlLang":case"xmlSpace":Na(n,jd,Gr(t,":"),e);return}switch(t){case"htmlFor":Sn(n,"for",e);return;case"dataset":ms(e,(r,i)=>{r!=null&&(n.dataset[i]=r)});return;case"innerHTML":case"innerText":case"textContent":Ta(e)&&(n[t]=e);return;case"dangerouslySetInnerHTML":ln(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":tr(e)?e(n):Sn(n,"class",vs(e));return;case"ref":case"namespaceURI":return;case"style":Ra(n,e);return;case"on":case"onCapture":ms(e,(r,i)=>{n.addEventListener(i,r,t==="onCapture")});return}if(tr(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 ln(e)?n[t]=e:e===!0?Sn(n,t,""):e!==!1&&e!=null&&(n instanceof SVGElement&&!Fd.test(t)?Sn(n,Gr(t,"-"),e):Sn(n,t,e))}function Sn(t,e,n){t.setAttribute(e,n)}function Na(t,e,n,r){t.setAttributeNS(e,n,r)}function Wd(t,e){for(const n of Vr(t))zd(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 Vd=0;const Da=t=>`${t}-${++Vd}`;function nr(t){return t instanceof Node?t:document.createTextNode(String(t))}function Dt(t,e){if(!t)throw new Error(`${e??"Element"} not found`);return t}function La(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 Kd{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 Kd;class _s{constructor(e={}){this.backdropId=Da("ipe-modal-backdrop"),this.modalId=Da("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);const n=this.get$modal(),r=this.get$window();n.classList.remove("is-dragging"),r.style.animation="none",requestAnimationFrame(()=>{this.applyAnimation(!0)})},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 v=window.pageYOffset||document.documentElement.scrollTop,b=window.pageXOffset||document.documentElement.scrollLeft,A=window.innerWidth;r.style.top=`${v+60}px`,this.once("modal.show",()=>{r.style.left=`${b+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 v=We("button",{className:"ipe-modal-modal__close",attrs:{type:"button","aria-label":"Close"},html:"&times;"});v.addEventListener("click",()=>{let b=!0;typeof this.options.onClickClose=="function"?this.options.onClickClose(this)===!1&&(b=!1):this.options.onClickClose===!1&&(b=!1),b&&this.close()}),l.appendChild(v)}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"}),y=We("div",{className:"ipe-modal-modal__buttons ipe-modal-modal__buttons--right"});return c.append(f,y),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=y,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",v=>{this.options.outSideClose&&v.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){this.applyAnimation(!1),this.emit("modal.close"),this.emit("toast.close");const s=this.isAnimationDisabled()?0:this.options.animationSpeed??200;let o=!1;const a=()=>{o||(o=!0,this.destroy(),this.options.onClose?.(this))},l=(u,c)=>{const f=()=>{u.removeEventListener(c,f),a()};u.addEventListener(c,f,{once:!0})};return s>0&&this.$window?(l(this.$window,"transitionend"),l(this.$window,"animationend"),window.setTimeout(a,s+20)):window.setTimeout(a,s),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=cn.indexOf(this);e!==-1&&cn.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 Dt(this.$modal,"modal")}get$window(){return Dt(this.$window,"window")}get$header(){return Dt(this.$header,"header")}get$title(){return Dt(this.$title,"title")}get$content(){return Dt(this.$content,"content")}get$icons(){return Dt(this.$icons,"icons")}get$buttons(e){return e==="leftButtons"?Dt(this.$buttonsLeft,"leftButtons"):e==="rightButtons"?Dt(this.$buttonsRight,"rightButtons"):Dt(this.$footer,"buttons")}setTitle(e){const n=this.get$title();return n.innerHTML="",n.append(nr(e)),this}setContent(e,n="replace"){const r=this.get$content();return n==="replace"?(r.innerHTML="",r.append(nr(e))):n==="append"?r.append(nr(e)):r.prepend(nr(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=nr(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(e==="*")return i.forEach(a=>{this.keyMap.delete(a.id),a.parentElement?.removeChild(a)}),this.$footer&&(this.$footer.style.display="none"),this;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&&(n?r.listener!==n:!0)),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=La(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=La(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=Yd(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),cn.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=cn.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),[...cn].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 _s}static removeAll(){Xe.removeAll(),[...cn].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"),e.content??(e.content="Are you sure you want to perform this action?");const r=e.okBtn??{label:"OK",className:"is-primary is-ghost"},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 getDefaultNotifyIcon(e){switch(e){case"success":return w("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-circle-check",children:[w("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),w("path",{d:"M17 3.34a10 10 0 1 1 -14.995 8.984l-.005 -.324l.005 -.324a10 10 0 0 1 14.995 -8.336zm-1.293 5.953a1 1 0 0 0 -1.32 -.083l-.094 .083l-3.293 3.292l-1.293 -1.292l-.094 -.083a1 1 0 0 0 -1.403 1.403l.083 .094l2 2l.094 .083a1 1 0 0 0 1.226 0l.094 -.083l4 -4l.083 -.094a1 1 0 0 0 -.083 -1.32z"})]});case"error":return w("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-alert-triangle",children:[w("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),w("path",{d:"M12 1.67c.955 0 1.845 .467 2.39 1.247l.105 .16l8.114 13.548a2.914 2.914 0 0 1 -2.307 4.363l-.195 .008h-16.225a2.914 2.914 0 0 1 -2.582 -4.2l.099 -.185l8.11 -13.538a2.914 2.914 0 0 1 2.491 -1.403zm.01 13.33l-.127 .007a1 1 0 0 0 0 1.986l.117 .007l.127 -.007a1 1 0 0 0 0 -1.986l-.117 -.007zm-.01 -7a1 1 0 0 0 -.993 .883l-.007 .117v4l.007 .117a1 1 0 0 0 1.986 0l.007 -.117v-4l-.007 -.117a1 1 0 0 0 -.993 -.883z"})]});case"warning":return w("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-alert-circle",children:[w("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),w("path",{d:"M12 2c5.523 0 10 4.477 10 10a10 10 0 0 1 -19.995 .324l-.005 -.324l.004 -.28c.148 -5.393 4.566 -9.72 9.996 -9.72zm.01 13l-.127 .007a1 1 0 0 0 0 1.986l.117 .007l.127 -.007a1 1 0 0 0 0 -1.986l-.117 -.007zm-.01 -8a1 1 0 0 0 -.993 .883l-.007 .117v4l.007 .117a1 1 0 0 0 1.986 0l.007 -.117v-4l-.007 -.117a1 1 0 0 0 -.993 -.883z"})]});case"info":return w("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-info-circle",children:[w("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),w("path",{d:"M12 2c5.523 0 10 4.477 10 10a10 10 0 0 1 -19.995 .324l-.005 -.324l.004 -.28c.148 -5.393 4.566 -9.72 9.996 -9.72zm0 9h-1l-.117 .007a1 1 0 0 0 0 1.986l.117 .007v3l.007 .117a1 1 0 0 0 .876 .876l.117 .007h1l.117 -.007a1 1 0 0 0 .876 -.876l.007 -.117l-.007 -.117a1 1 0 0 0 -.764 -.857l-.112 -.02l-.117 -.006v-3l-.007 -.117a1 1 0 0 0 -.876 -.876l-.117 -.007zm.01 -3l-.127 .007a1 1 0 0 0 0 1.986l.117 .007l.127 -.007a1 1 0 0 0 0 -1.986l-.117 -.007z"})]});case"dialog":return w("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-message-dots",children:[w("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),w("path",{d:"M12 11v.01"}),w("path",{d:"M8 11v.01"}),w("path",{d:"M16 11v.01"}),w("path",{d:"M18 4a3 3 0 0 1 3 3v8a3 3 0 0 1 -3 3h-5l-5 3v-3h-2a3 3 0 0 1 -3 -3v-8a3 3 0 0 1 3 -3z"})]});case"confirm":return w("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-copy-check",children:[w("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),w("path",{d:"M18.333 6a3.667 3.667 0 0 1 3.667 3.667v8.666a3.667 3.667 0 0 1 -3.667 3.667h-8.666a3.667 3.667 0 0 1 -3.667 -3.667v-8.666a3.667 3.667 0 0 1 3.667 -3.667zm-3.333 -4c1.094 0 1.828 .533 2.374 1.514a1 1 0 1 1 -1.748 .972c-.221 -.398 -.342 -.486 -.626 -.486h-10c-.548 0 -1 .452 -1 1v9.998c0 .32 .154 .618 .407 .805l.1 .065a1 1 0 1 1 -.99 1.738a3 3 0 0 1 -1.517 -2.606v-10c0 -1.652 1.348 -3 3 -3zm1.293 9.293l-3.293 3.292l-1.293 -1.292a1 1 0 0 0 -1.414 1.414l2 2a1 1 0 0 0 1.414 0l4 -4a1 1 0 0 0 -1.414 -1.414"})]});default:return null}}static notify(e,n,r){var a,l,u,c;if(n?.overrideOther&&[...cn].forEach(f=>f.close()),typeof n.title>"u"){const f=e||"Notification";n.title=f[0].toUpperCase()+f.slice(1).toLowerCase()}const i=n.icon??this.getDefaultNotifyIcon(e);i&&(i instanceof Element&&i.classList.add("ipe-modal-notify-icon"),n.title=w(Nt,{children:[i,n.title]})),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.cancelBtn,n.okBtn,...n.buttons??[]].filter(Boolean);const s=`is-notify type-${e||"default"} ${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"})}}const cn=[];function Yd(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 Gd={ipe_progress:"_ipe_progress_so6hn_1"},Vt=t=>{const e=t.indeterminate??!0,n=w("div",{class:`${Gd.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 _s{constructor(e={}){e.className||(e.className=""),e.className+=" theme-ipe",e.modalAnimation||(e.modalAnimation={show:"ipe-modal-fade-in",hide:"ipe-modal-fade-out"}),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(w("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:w(Vt,{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 Qd{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)}}const Ma=t=>{if(!t)return new URLSearchParams;if(t instanceof URLSearchParams)return t;if(typeof t!="object"||t?.constructor!==Object)throw new TypeError("only plain object is supported");const e=new URLSearchParams;for(const[n,r]of Object.entries(t))if(r!=null){if(Array.isArray(r)){for(const i of r)e.append(n,i?.toString());continue}if(typeof r=="object"&&r!==null&&r.constructor===Object){for(const[i,s]of Object.entries(r))s!=null&&e.set(`${n}[${i}]`,s?.toString());continue}e.set(n,r?.toString())}return e},ja=(t,e,n)=>{const r=typeof t=="string"?new URL(t,window?.location?.origin):new URL(t),i=new URLSearchParams(r.search),s=Ma(e);for(const[o,a]of s.entries())i.set(o,a);return r.search=i.toString(),r.hash="",r};var Jd=Object.create,xs=Object.defineProperty,Xd=Object.getOwnPropertyDescriptor,Ba=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Fa=t=>{throw TypeError(t)},Zd=(t,e,n)=>e in t?xs(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,eh=(t,e)=>xs(t,"name",{value:e,configurable:!0}),th=t=>[,,,Jd(t?.[Ba("metadata")]??null)],nh=["class","method","getter","setter","accessor","field","value","get","set"],Ua=t=>t!==void 0&&typeof t!="function"?Fa("Function expected"):t,rh=(t,e,n,r,i)=>({kind:nh[t],name:e,metadata:r,addInitializer:s=>n._?Fa("Already initialized"):i.push(Ua(s||null))}),ih=(t,e)=>Zd(e,Ba("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,y=t[f]||(t[f]=[]),v=u&&(i=i.prototype,u<5&&(u>3||!c)&&Xd(i,n));eh(i,n);for(var b=r.length-1;b>=0;b--)l=rh(u,n,a={},t[3],y),o=(0,r[b])(i,l),a._=1,Ua(o)&&(i=o);return ih(t,i),v&&xs(i,n,v),c?u^4?s:v:i},qa,Ss,Ha;qa=[ze(["api","storage"])];class Qr extends(Ha=an){constructor(e){super(e,"sitemeta",!1),this.ctx=e,this._data=void 0,this.CACHE_TTL=1e3*60*60*24,this.VERSION=2,this.db=void 0,this.logger=void 0,this.queryData={meta:"siteinfo|userinfo",siprop:"general|specialpagealiases|namespacealiases|namespaces|magicwords",uiprop:"groups|rights|blockinfo|options"},this.mwConfig={get:(n,r)=>window?.mw?.config?.get?.(n,r)??r,has:n=>window?.mw?.config?.exists?.(n)??!1,get values(){return window?.mw?.config?.values||{}}},this.db=e.storage.createDatabse("sitemeta",this.CACHE_TTL,this.VERSION),this.logger=e.logger("SiteMetadataService")}get api(){return this.ctx.api}async start(){const e=await this.fetchFromCache();if(e)this.logger.info("Using cached metadata",e),this._data=e;else{const n=await this.fetchFromApi();this.saveToCache(n),this._data=n}this.ctx.set("getUrl",this.getUrl.bind(this)),this.ctx.set("getSciprtUrl",this.getSciprtUrl.bind(this)),this.ctx.set("getMainpageUrl",this.getMainpageUrl.bind(this))}computeSiteIdentity(){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 Reflect.defineProperty(this,"computeSiteIdentity",{value:()=>e,writable:!1,configurable:!1,enumerable:!0}),e}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=this.computeSiteIdentity(),n=this.mwConfig.get("wgUserId",0),r=await this.db.get(e);return r&&r.userinfo.id===n?r:(this.logger.info("UserID changed, invalidating cache"),this.invalidateCache(),null)}async saveToCache(e){const n=this.computeSiteIdentity();return this.db.set(n,e)}async invalidateCache(){const e=this.computeSiteIdentity();return this.db.delete(e)}get _raw(){return this._data}get general(){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}get baseUrl(){const e=this.general.server;return e.startsWith("//")?`${window?.location?.protocol||"https:"}//${e.slice(2)}`:e}get articlePath(){return this.general.articlepath}get scriptPath(){return this.general.scriptpath}get articleBaseUrl(){return`${this.baseUrl}${this.articlePath}`}get scriptBaseUrl(){return`${this.baseUrl}${this.scriptPath}`}getSciprtUrl(e="index"){return`${this.scriptBaseUrl}/${e.replace(/\.php$/,"")}.php`}getMainpageUrl(e){return ja(this._data.general.base,e).toString()}getUrl(e,n){const r=Ma(n);let i;return e===""?i=new URL(this.getSciprtUrl("index")):typeof e=="string"?i=new URL(`${this.articleBaseUrl.replace("$1",e)}`):(r.set("curid",e.toString()),i=new URL(this.getSciprtUrl("index"))),i.search=r.toString(),i.toString()}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}}Ss=th(Ha),Qr=oh(Ss,0,"SiteMetadataService",qa,Qr),sh(Ss,1,Qr);var Jr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ah(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Xr(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 Es={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 va;function ld(){return va||(va=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 Ur=="function"&&Ur;if(!c&&f)return f(u,!0);if(a)return a(u,!0);var y=new Error("Cannot find module '"+u+"'");throw y.code="MODULE_NOT_FOUND",y}var v=i[u]={exports:{}};r[u][0].call(v.exports,function(b){var A=r[u][1][b];return o(A||b)},v,v.exports,n,r,i,s)}return i[u].exports}for(var a=typeof Ur=="function"&&Ur,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(b),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=b,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(){b(),U.onreadystatechange=null,U.parentNode.removeChild(U),U=null},s.document.documentElement.appendChild(U)}:a=function(){setTimeout(b,0)};var y,v=[];function b(){y=!0;for(var U,L,I=v.length;I;){for(L=v,v=[],U=-1;++U<I;)L[U]();I=v.length}y=!1}r.exports=A;function A(U){v.push(U)===1&&!y&&a()}}).call(this,typeof Br<"u"?Br: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,S){if(typeof h!="function"&&this.state===u||typeof S!="function"&&this.state===l)return this;var P=new this.constructor(o);if(this.state!==c){var R=this.state===u?h:S;v(P,R,this.outcome)}else this.queue.push(new y(P,h,S));return P};function y(h,S,P){this.promise=h,typeof S=="function"&&(this.onFulfilled=S,this.callFulfilled=this.otherCallFulfilled),typeof P=="function"&&(this.onRejected=P,this.callRejected=this.otherCallRejected)}y.prototype.callFulfilled=function(h){a.resolve(this.promise,h)},y.prototype.otherCallFulfilled=function(h){v(this.promise,this.onFulfilled,h)},y.prototype.callRejected=function(h){a.reject(this.promise,h)},y.prototype.otherCallRejected=function(h){v(this.promise,this.onRejected,h)};function v(h,S,P){s(function(){var R;try{R=S(P)}catch(z){return a.reject(h,z)}R===h?a.reject(h,new TypeError("Cannot resolve promise with itself")):a.resolve(h,R)})}a.resolve=function(h,S){var P=U(b,S);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=S;for(var z=-1,X=h.queue.length;++z<X;)h.queue[z].callFulfilled(S)}return h},a.reject=function(h,S){h.state=l,h.outcome=S;for(var P=-1,R=h.queue.length;++P<R;)h.queue[P].callRejected(S);return h};function b(h){var S=h&&h.then;if(h&&(typeof h=="object"||typeof h=="function")&&typeof S=="function")return function(){S.apply(h,arguments)}}function A(h,S){var P=!1;function R(Te){P||(P=!0,a.reject(h,Te))}function z(Te){P||(P=!0,a.resolve(h,Te))}function X(){S(z,R)}var Ce=U(X);Ce.status==="error"&&R(Ce.value)}function U(h,S){var P={};try{P.value=h(S),P.status="success"}catch(R){P.status="error",P.value=R}return P}f.resolve=L;function L(h){return h instanceof this?h:a.resolve(new this(o),h)}f.reject=I;function I(h){var S=new this(o);return a.reject(S,h)}f.all=g;function g(h){var S=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 z=new Array(P),X=0,Ce=-1,Te=new this(o);++Ce<P;)tt(h[Ce],Ce);return Te;function tt(Ft,pn){S.resolve(Ft).then(Re,function(me){R||(R=!0,a.reject(Te,me))});function Re(me){z[pn]=me,++X===P&&!R&&(R=!0,a.resolve(Te,z))}}}f.race=p;function p(h){var S=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 z=-1,X=new this(o);++z<P;)Ce(h[z]);return X;function Ce(Te){S.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 Br<"u"?Br: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(E){if(E.name!=="TypeError")throw E;for(var m=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,C=new m,O=0;O<d.length;O+=1)C.append(d[O]);return C.getBlob(w.type)}}typeof Promise>"u"&&n(3);var f=Promise;function y(d,w){w&&d.then(function(m){w(null,m)},function(m){w(m)})}function v(d,w,m){typeof w=="function"&&d.then(w),typeof m=="function"&&d.catch(m)}function b(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",L=void 0,I={},g=Object.prototype.toString,p="readonly",h="readwrite";function S(d){for(var w=d.length,m=new ArrayBuffer(w),C=new Uint8Array(m),O=0;O<w;O++)C[O]=d.charCodeAt(O);return m}function P(d){return new f(function(w){var m=d.transaction(U,h),C=c([""]);m.objectStore(U).put(C,"key"),m.onabort=function(O){O.preventDefault(),O.stopPropagation(),w(!1)},m.oncomplete=function(){var O=navigator.userAgent.match(/Chrome\/(\d+)/),E=navigator.userAgent.match(/Edge\//);w(E||!O||parseInt(O[1],10)>=43)}}).catch(function(){return!1})}function R(d){return typeof L=="boolean"?f.resolve(L):P(d).then(function(w){return L=w,L})}function z(d){var w=I[d.name],m={};m.promise=new f(function(C,O){m.resolve=C,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],C=m.deferredOperations.pop();if(C)return C.reject(w),C.promise}function Te(d,w){return new f(function(m,C){if(I[d.name]=I[d.name]||ot(),d.db)if(w)z(d),d.db.close();else return m(d.db);var O=[d.name];w&&O.push(d.version);var E=l.open.apply(l,O);w&&(E.onupgradeneeded=function(D){var F=E.result;try{F.createObjectStore(d.storeName),D.oldVersion<=1&&F.createObjectStore(U)}catch(H){if(H.name!=="ConstraintError")throw H}}),E.onerror=function(D){D.preventDefault(),C(E.error)},E.onsuccess=function(){var D=E.result;D.onversionchange=function(F){F.target.close()},m(D),X(d)}})}function tt(d){return Te(d,!1)}function Ft(d){return Te(d,!0)}function pn(d,w){if(!d.db)return!0;var m=!d.db.objectStoreNames.contains(d.storeName),C=d.version<d.db.version,O=d.version>d.db.version;if(C&&(d.version,d.version=d.db.version),O||m){if(m){var E=d.db.version+1;E>d.version&&(d.version=E)}return!0}return!1}function Re(d){return new f(function(w,m){var C=new FileReader;C.onerror=m,C.onloadend=function(O){var E=btoa(O.target.result||"");w({__local_forage_encoded_blob:!0,data:E,type:d.type})},C.readAsBinaryString(d)})}function me(d){var w=S(atob(d.data));return c([w],{type:d.type})}function ve(d){return d&&d.__local_forage_encoded_blob}function Bt(d){var w=this,m=w._initReady().then(function(){var C=I[w._dbInfo.name];if(C&&C.dbReady)return C.dbReady});return v(m,d,d),m}function Hn(d){z(d);for(var w=I[d.name],m=w.forages,C=0;C<m.length;C++){var O=m[C];O._dbInfo.db&&(O._dbInfo.db.close(),O._dbInfo.db=null)}return d.db=null,tt(d).then(function(E){return d.db=E,pn(d)?Ft(d):E}).then(function(E){d.db=w.db=E;for(var D=0;D<m.length;D++)m[D]._dbInfo.db=E}).catch(function(E){throw Ce(d,E),E})}function je(d,w,m,C){C===void 0&&(C=1);try{var O=d.db.transaction(d.storeName,w);m(null,O)}catch(E){if(C>0&&(!d.db||E.name==="InvalidStateError"||E.name==="NotFoundError"))return f.resolve().then(function(){if(!d.db||E.name==="NotFoundError"&&!d.db.objectStoreNames.contains(d.storeName)&&d.version<=d.db.version)return d.db&&(d.version=d.db.version+1),Ft(d)}).then(function(){return Hn(d).then(function(){je(d,w,m,C-1)})}).catch(m);m(E)}}function ot(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function qi(d){var w=this,m={db:null};if(d)for(var C in d)m[C]=d[C];var O=I[m.name];O||(O=ot(),I[m.name]=O),O.forages.push(w),w._initReady||(w._initReady=w.ready,w.ready=Bt);var E=[];function D(){return f.resolve()}for(var F=0;F<O.forages.length;F++){var H=O.forages[F];H!==w&&E.push(H._initReady().catch(D))}var q=O.forages.slice(0);return f.all(E).then(function(){return m.db=O.db,tt(m)}).then(function(V){return m.db=V,pn(m,w._defaultConfig.version)?Ft(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=b(d);var C=new f(function(O,E){m.ready().then(function(){je(m._dbInfo,p,function(D,F){if(D)return E(D);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(){E(q.error)}}catch(V){E(V)}})}).catch(E)});return y(C,w),C}function qo(d,w){var m=this,C=new f(function(O,E){m.ready().then(function(){je(m._dbInfo,p,function(D,F){if(D)return E(D);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(){E(q.error)}}catch(Q){E(Q)}})}).catch(E)});return y(C,w),C}function mn(d,w,m){var C=this;d=b(d);var O=new f(function(E,D){var F;C.ready().then(function(){return F=C._dbInfo,g.call(w)==="[object Blob]"?R(F.db).then(function(H){return H?w:Re(w)}):w}).then(function(H){je(C._dbInfo,h,function(q,V){if(q)return D(q);try{var Q=V.objectStore(C._dbInfo.storeName);H===null&&(H=void 0);var ae=Q.put(H,d);V.oncomplete=function(){H===void 0&&(H=null),E(H)},V.onabort=V.onerror=function(){var ge=ae.error?ae.error:ae.transaction.error;D(ge)}}catch(ge){D(ge)}})}).catch(D)});return y(O,m),O}function qn(d,w){var m=this;d=b(d);var C=new f(function(O,E){m.ready().then(function(){je(m._dbInfo,h,function(D,F){if(D)return E(D);try{var H=F.objectStore(m._dbInfo.storeName),q=H.delete(d);F.oncomplete=function(){O()},F.onerror=function(){E(q.error)},F.onabort=function(){var V=q.error?q.error:q.transaction.error;E(V)}}catch(V){E(V)}})}).catch(E)});return y(C,w),C}function Cr(d){var w=this,m=new f(function(C,O){w.ready().then(function(){je(w._dbInfo,h,function(E,D){if(E)return O(E);try{var F=D.objectStore(w._dbInfo.storeName),H=F.clear();D.oncomplete=function(){C()},D.onabort=D.onerror=function(){var q=H.error?H.error:H.transaction.error;O(q)}}catch(q){O(q)}})}).catch(O)});return y(m,d),m}function zi(d){var w=this,m=new f(function(C,O){w.ready().then(function(){je(w._dbInfo,p,function(E,D){if(E)return O(E);try{var F=D.objectStore(w._dbInfo.storeName),H=F.count();H.onsuccess=function(){C(H.result)},H.onerror=function(){O(H.error)}}catch(q){O(q)}})}).catch(O)});return y(m,d),m}function gn(d,w){var m=this,C=new f(function(O,E){if(d<0){O(null);return}m.ready().then(function(){je(m._dbInfo,p,function(D,F){if(D)return E(D);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(){E(V.error)}}catch(Q){E(Q)}})}).catch(E)});return y(C,w),C}function Qu(d){var w=this,m=new f(function(C,O){w.ready().then(function(){je(w._dbInfo,p,function(E,D){if(E)return O(E);try{var F=D.objectStore(w._dbInfo.storeName),H=F.openKeyCursor(),q=[];H.onsuccess=function(){var V=H.result;if(!V){C(q);return}q.push(V.key),V.continue()},H.onerror=function(){O(H.error)}}catch(V){O(V)}})}).catch(O)});return y(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 C=this,O;if(!d.name)O=f.reject("Invalid arguments");else{var E=d.name===m.name&&C._dbInfo.db,D=E?f.resolve(C._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=D.then(function(F){if(F.objectStoreNames.contains(d.storeName)){var H=F.version+1;z(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=D.then(function(F){z(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 y(O,w),O}var k={_driver:"asyncStorage",_initStorage:qi,_support:u(),iterate:qo,getItem:Ho,setItem:mn,removeItem:qn,clear:Cr,length:zi,key:gn,keys:Qu,dropInstance:_};function T(){return typeof openDatabase=="function"}var N="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",M="~~local_forage_type~",j=/^~~local_forage_type~([^~]+)~/,G="__lfsc__:",K=G.length,W="arbf",B="blob",ee="si08",J="ui08",Z="uic8",re="si16",ce="si32",be="ur16",de="ui32",Fe="fl32",Be="fl64",at=K+W.length,lt=Object.prototype.toString;function Xt(d){var w=d.length*.75,m=d.length,C,O=0,E,D,F,H;d[d.length-1]==="="&&(w--,d[d.length-2]==="="&&w--);var q=new ArrayBuffer(w),V=new Uint8Array(q);for(C=0;C<m;C+=4)E=N.indexOf(d[C]),D=N.indexOf(d[C+1]),F=N.indexOf(d[C+2]),H=N.indexOf(d[C+3]),V[O++]=E<<2|D>>4,V[O++]=(D&15)<<4|F>>2,V[O++]=(F&3)<<6|H&63;return q}function zn(d){var w=new Uint8Array(d),m="",C;for(C=0;C<w.length;C+=3)m+=N[w[C]>>2],m+=N[(w[C]&3)<<4|w[C+1]>>4],m+=N[(w[C+1]&15)<<2|w[C+2]>>6],m+=N[w[C+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=lt.call(d)),d&&(m==="[object ArrayBuffer]"||d.buffer&&lt.call(d.buffer)==="[object ArrayBuffer]")){var C,O=G;d instanceof ArrayBuffer?(C=d,O+=W):(C=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+=de:m==="[object Float32Array]"?O+=Fe:m==="[object Float64Array]"?O+=Be:w(new Error("Failed to get type for BinaryArray"))),w(O+zn(C))}else if(m==="[object Blob]"){var E=new FileReader;E.onload=function(){var D=M+d.type+"~"+zn(this.result);w(G+B+D)},E.readAsArrayBuffer(d)}else try{w(JSON.stringify(d))}catch(D){w(null,D)}}function ht(d){if(d.substring(0,K)!==G)return JSON.parse(d);var w=d.substring(at),m=d.substring(K,at),C;if(m===B&&j.test(w)){var O=w.match(j);C=O[1],w=w.substring(O[0].length)}var E=Xt(w);switch(m){case W:return E;case B:return c([E],{type:C});case ee:return new Int8Array(E);case J:return new Uint8Array(E);case Z:return new Uint8ClampedArray(E);case re:return new Int16Array(E);case be:return new Uint16Array(E);case ce:return new Int32Array(E);case de:return new Uint32Array(E);case Fe:return new Float32Array(E);case Be:return new Float64Array(E);default:throw new Error("Unkown type: "+m)}}var Wn={serialize:Ye,deserialize:ht,stringToBuffer:Xt,bufferToString:zn};function Or(d,w,m,C){d.executeSql("CREATE TABLE IF NOT EXISTS "+w.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],m,C)}function Zy(d){var w=this,m={db:null};if(d)for(var C in d)m[C]=typeof d[C]!="string"?d[C].toString():d[C];var O=new f(function(E,D){try{m.db=openDatabase(m.name,String(m.version),m.description,m.size)}catch(F){return D(F)}m.db.transaction(function(F){Or(F,m,function(){w._dbInfo=m,E()},function(H,q){D(q)})},D)});return m.serializer=Wn,O}function Zt(d,w,m,C,O,E){d.executeSql(m,C,O,function(D,F){F.code===F.SYNTAX_ERR?D.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[w.storeName],function(H,q){q.rows.length?E(H,F):Or(H,w,function(){H.executeSql(m,C,O,E)},E)},E):E(D,F)},E)}function ev(d,w){var m=this;d=b(d);var C=new f(function(O,E){m.ready().then(function(){var D=m._dbInfo;D.db.transaction(function(F){Zt(F,D,"SELECT * FROM "+D.storeName+" WHERE key = ? LIMIT 1",[d],function(H,q){var V=q.rows.length?q.rows.item(0).value:null;V&&(V=D.serializer.deserialize(V)),O(V)},function(H,q){E(q)})})}).catch(E)});return y(C,w),C}function tv(d,w){var m=this,C=new f(function(O,E){m.ready().then(function(){var D=m._dbInfo;D.db.transaction(function(F){Zt(F,D,"SELECT * FROM "+D.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=D.serializer.deserialize(_e)),_e=d(_e,ge.key,ae+1),_e!==void 0){O(_e);return}}O()},function(H,q){E(q)})})}).catch(E)});return y(C,w),C}function Xu(d,w,m,C){var O=this;d=b(d);var E=new f(function(D,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(){D(H)},function(ge,_e){F(_e)})},function(ae){if(ae.code===ae.QUOTA_ERR){if(C>0){D(Xu.apply(O,[d,H,m,C-1]));return}F(ae)}})})}).catch(F)});return y(E,m),E}function nv(d,w,m){return Xu.apply(this,[d,w,m,1])}function rv(d,w){var m=this;d=b(d);var C=new f(function(O,E){m.ready().then(function(){var D=m._dbInfo;D.db.transaction(function(F){Zt(F,D,"DELETE FROM "+D.storeName+" WHERE key = ?",[d],function(){O()},function(H,q){E(q)})})}).catch(E)});return y(C,w),C}function iv(d){var w=this,m=new f(function(C,O){w.ready().then(function(){var E=w._dbInfo;E.db.transaction(function(D){Zt(D,E,"DELETE FROM "+E.storeName,[],function(){C()},function(F,H){O(H)})})}).catch(O)});return y(m,d),m}function sv(d){var w=this,m=new f(function(C,O){w.ready().then(function(){var E=w._dbInfo;E.db.transaction(function(D){Zt(D,E,"SELECT COUNT(key) as c FROM "+E.storeName,[],function(F,H){var q=H.rows.item(0).c;C(q)},function(F,H){O(H)})})}).catch(O)});return y(m,d),m}function ov(d,w){var m=this,C=new f(function(O,E){m.ready().then(function(){var D=m._dbInfo;D.db.transaction(function(F){Zt(F,D,"SELECT key FROM "+D.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){E(q)})})}).catch(E)});return y(C,w),C}function av(d){var w=this,m=new f(function(C,O){w.ready().then(function(){var E=w._dbInfo;E.db.transaction(function(D){Zt(D,E,"SELECT key FROM "+E.storeName,[],function(F,H){for(var q=[],V=0;V<H.rows.length;V++)q.push(H.rows.item(V).key);C(q)},function(F,H){O(H)})})}).catch(O)});return y(m,d),m}function lv(d){return new f(function(w,m){d.transaction(function(C){C.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(O,E){for(var D=[],F=0;F<E.rows.length;F++)D.push(E.rows.item(F).name);w({db:d,storeNames:D})},function(O,E){m(E)})},function(C){m(C)})})}function cv(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 C=this,O;return d.name?O=new f(function(E){var D;d.name===m.name?D=C._dbInfo.db:D=openDatabase(d.name,"","",0),d.storeName?E({db:D,storeNames:[d.storeName]}):E(lv(D))}).then(function(E){return new f(function(D,F){E.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=E.storeNames.length;Q<ae;Q++)V.push(q(E.storeNames[Q]));f.all(V).then(function(){D()}).catch(function(ge){F(ge)})},function(H){F(H)})})}):O=f.reject("Invalid arguments"),y(O,w),O}var uv={_driver:"webSQLStorage",_initStorage:Zy,_support:T(),iterate:tv,getItem:ev,setItem:nv,removeItem:rv,clear:iv,length:sv,key:ov,keys:av,dropInstance:cv};function fv(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function Zu(d,w){var m=d.name+"/";return d.storeName!==w.storeName&&(m+=d.storeName+"/"),m}function dv(){var d="_localforage_support_test";try{return localStorage.setItem(d,!0),localStorage.removeItem(d),!1}catch{return!0}}function hv(){return!dv()||localStorage.length>0}function pv(d){var w=this,m={};if(d)for(var C in d)m[C]=d[C];return m.keyPrefix=Zu(d,w._defaultConfig),hv()?(w._dbInfo=m,m.serializer=Wn,f.resolve()):f.reject()}function mv(d){var w=this,m=w.ready().then(function(){for(var C=w._dbInfo.keyPrefix,O=localStorage.length-1;O>=0;O--){var E=localStorage.key(O);E.indexOf(C)===0&&localStorage.removeItem(E)}});return y(m,d),m}function gv(d,w){var m=this;d=b(d);var C=m.ready().then(function(){var O=m._dbInfo,E=localStorage.getItem(O.keyPrefix+d);return E&&(E=O.serializer.deserialize(E)),E});return y(C,w),C}function yv(d,w){var m=this,C=m.ready().then(function(){for(var O=m._dbInfo,E=O.keyPrefix,D=E.length,F=localStorage.length,H=1,q=0;q<F;q++){var V=localStorage.key(q);if(V.indexOf(E)===0){var Q=localStorage.getItem(V);if(Q&&(Q=O.serializer.deserialize(Q)),Q=d(Q,V.substring(D),H++),Q!==void 0)return Q}}});return y(C,w),C}function vv(d,w){var m=this,C=m.ready().then(function(){var O=m._dbInfo,E;try{E=localStorage.key(d)}catch{E=null}return E&&(E=E.substring(O.keyPrefix.length)),E});return y(C,w),C}function bv(d){var w=this,m=w.ready().then(function(){for(var C=w._dbInfo,O=localStorage.length,E=[],D=0;D<O;D++){var F=localStorage.key(D);F.indexOf(C.keyPrefix)===0&&E.push(F.substring(C.keyPrefix.length))}return E});return y(m,d),m}function _v(d){var w=this,m=w.keys().then(function(C){return C.length});return y(m,d),m}function wv(d,w){var m=this;d=b(d);var C=m.ready().then(function(){var O=m._dbInfo;localStorage.removeItem(O.keyPrefix+d)});return y(C,w),C}function xv(d,w,m){var C=this;d=b(d);var O=C.ready().then(function(){w===void 0&&(w=null);var E=w;return new f(function(D,F){var H=C._dbInfo;H.serializer.serialize(w,function(q,V){if(V)F(V);else try{localStorage.setItem(H.keyPrefix+d,q),D(E)}catch(Q){(Q.name==="QuotaExceededError"||Q.name==="NS_ERROR_DOM_QUOTA_REACHED")&&F(Q),F(Q)}})})});return y(O,m),O}function Sv(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 C=this,O;return d.name?O=new f(function(E){d.storeName?E(Zu(d,C._defaultConfig)):E(d.name+"/")}).then(function(E){for(var D=localStorage.length-1;D>=0;D--){var F=localStorage.key(D);F.indexOf(E)===0&&localStorage.removeItem(F)}}):O=f.reject("Invalid arguments"),y(O,w),O}var Ev={_driver:"localStorageWrapper",_initStorage:pv,_support:fv(),iterate:yv,getItem:gv,setItem:xv,removeItem:wv,clear:mv,length:_v,key:vv,keys:bv,dropInstance:Sv},$v=function(w,m){return w===m||typeof w=="number"&&typeof m=="number"&&isNaN(w)&&isNaN(m)},kv=function(w,m){for(var C=w.length,O=0;O<C;){if($v(w[O],m))return!0;O++}return!1},ef=Array.isArray||function(d){return Object.prototype.toString.call(d)==="[object Array]"},Pr={},tf={},Vn={INDEXEDDB:k,WEBSQL:uv,LOCALSTORAGE:Ev},Cv=[Vn.INDEXEDDB._driver,Vn.WEBSQL._driver,Vn.LOCALSTORAGE._driver],Wi=["dropInstance"],zo=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Wi),Ov={description:"",driver:Cv.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Pv(d,w){d[w]=function(){var m=arguments;return d.ready().then(function(){return d[w].apply(d,m)})}}function Wo(){for(var d=1;d<arguments.length;d++){var w=arguments[d];if(w)for(var m in w)w.hasOwnProperty(m)&&(ef(w[m])?arguments[0][m]=w[m].slice():arguments[0][m]=w[m])}return arguments[0]}var Av=function(){function d(w){o(this,d);for(var m in Vn)if(Vn.hasOwnProperty(m)){var C=Vn[m],O=C._driver;this[m]=O,Pr[O]||this.defineDriver(C)}this._defaultConfig=Wo({},Ov),this._config=Wo({},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 C in m){if(C==="storeName"&&(m[C]=m[C].replace(/\W/g,"_")),C==="version"&&typeof m[C]!="number")return new Error("Database version must be a number.");this._config[C]=m[C]}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,C,O){var E=new f(function(D,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=zo.concat("_initStorage"),Q=0,ae=V.length;Q<ae;Q++){var ge=V[Q],_e=!kv(Wi,ge);if((_e||m[ge])&&typeof m[ge]!="function"){F(q);return}}var Ae=function(){for(var Ar=function(Rv){return function(){var Dv=new Error("Method "+Rv+" is not implemented by the current driver"),nf=f.reject(Dv);return y(nf,arguments[arguments.length-1]),nf}},Vo=0,Tv=Wi.length;Vo<Tv;Vo++){var Ko=Wi[Vo];m[Ko]||(m[Ko]=Ar(Ko))}};Ae();var Oe=function(Ar){Pr[H],Pr[H]=m,tf[H]=Ar,D()};"_support"in m?m._support&&typeof m._support=="function"?m._support().then(Oe,F):Oe(!!m._support):Oe(!0)}catch(pt){F(pt)}});return v(E,C,O),E},d.prototype.driver=function(){return this._driver||null},d.prototype.getDriver=function(m,C,O){var E=Pr[m]?f.resolve(Pr[m]):f.reject(new Error("Driver not found."));return v(E,C,O),E},d.prototype.getSerializer=function(m){var C=f.resolve(Wn);return v(C,m),C},d.prototype.ready=function(m){var C=this,O=C._driverSet.then(function(){return C._ready===null&&(C._ready=C._initDriver()),C._ready});return v(O,m,m),O},d.prototype.setDriver=function(m,C,O){var E=this;ef(m)||(m=[m]);var D=this._getSupportedDrivers(m);function F(){E._config.driver=E.driver()}function H(Q){return E._extend(Q),F(),E._ready=E._initStorage(E._config),E._ready}function q(Q){return function(){var ae=0;function ge(){for(;ae<Q.length;){var _e=Q[ae];return ae++,E._dbInfo=null,E._ready=null,E.getDriver(_e).then(H).catch(ge)}F();var Ae=new Error("No available storage method found.");return E._driverSet=f.reject(Ae),E._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=D[0];return E._dbInfo=null,E._ready=null,E.getDriver(Q).then(function(ae){E._driver=ae._driver,F(),E._wrapLibraryMethodsWithReady(),E._initDriver=q(D)})}).catch(function(){F();var Q=new Error("No available storage method found.");return E._driverSet=f.reject(Q),E._driverSet}),v(this._driverSet,C,O),this._driverSet},d.prototype.supports=function(m){return!!tf[m]},d.prototype._extend=function(m){Wo(this,m)},d.prototype._getSupportedDrivers=function(m){for(var C=[],O=0,E=m.length;O<E;O++){var D=m[O];this.supports(D)&&C.push(D)}return C},d.prototype._wrapLibraryMethodsWithReady=function(){for(var m=0,C=zo.length;m<C;m++)Pv(this,zo[m])},d.prototype.createInstance=function(m){return new d(m)},d}(),Iv=new Av;r.exports=Iv},{3:3}]},{},[4])(4)})}(as)),as.exports}var cd=ld();const ba=ad(cd);class ud extends yn{constructor(e){super(e,"storage",!1),e.set("localforage",ba)}get StorageManager(){return Hr}createDatabse(e,n,r){return new Hr("InPageEdit",e,n,r)}}const Un=class Un{constructor(e,n,r=Un.DEFAULT_TTL,i){this.dbName=e,this.storeName=n,this.ttl=r,this.version=i,this.db=Un.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=ba.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}};Un.DEFAULT_TTL=1/0,Un._cached_db_instances=new Map;let Hr=Un;var fd=Object.create,ls=Object.defineProperty,dd=Object.getOwnPropertyDescriptor,_a=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),wa=t=>{throw TypeError(t)},hd=(t,e,n)=>e in t?ls(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,pd=(t,e)=>ls(t,"name",{value:e,configurable:!0}),md=t=>[,,,fd(t?.[_a("metadata")]??null)],gd=["class","method","getter","setter","accessor","field","value","get","set"],xa=t=>t!==void 0&&typeof t!="function"?wa("Function expected"):t,yd=(t,e,n,r,i)=>({kind:gd[t],name:e,metadata:r,addInitializer:s=>n._?wa("Already initialized"):i.push(xa(s||null))}),vd=(t,e)=>hd(e,_a("metadata"),t[3]),bd=(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},_d=(t,e,n,r,i,s)=>{var o,a,l,u=e&7,c=!1,f=0,y=t[f]||(t[f]=[]),v=u&&(i=i.prototype,u<5&&(u>3||!c)&&dd(i,n));pd(i,n);for(var b=r.length-1;b>=0;b--)l=yd(u,n,a={},t[3],y),o=(0,r[b])(i,l),a._=1,xa(o)&&(i=o);return vd(t,i),v&&ls(i,n,v),c?u^4?s:v:i},Sa,cs,Ea;Sa=[Ge(["api","storage"])];class qr extends(Ea=yn){constructor(e){super(e,"sitemeta",!1),this.ctx=e,this._data=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.logger=this.ctx.logger("SiteMetadataService"),this.db=e.storage.createDatabse("sitemeta",this.CACHE_TTL,this.VERSION)}get api(){return this.ctx.api}get mwConfig(){return window?.mw?.config?.values}async start(){const e=await this.fetchFromCache();if(e){this.logger.info("Using cached metadata",e),this._data=e;return}const n=await this.fetchFromApi();this.saveToCache(n),this._data=n}computeSiteIdentity(){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 Reflect.defineProperty(this,"computeSiteIdentity",{value:()=>e,writable:!1,configurable:!1,enumerable:!0}),e}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=this.computeSiteIdentity(),n=this.mwConfig?.wgUserId||0,r=await this.db.get(e);return r&&r.userinfo.id===n?r:(this.logger.info("UserID changed, invalidating cache"),this.invalidateCache(),null)}async saveToCache(e){const n=this.computeSiteIdentity();return this.db.set(n,e)}async invalidateCache(){const e=this.computeSiteIdentity();return this.db.delete(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}}cs=md(Ea),qr=_d(cs,0,"SiteMetadataService",Sa,qr),bd(cs,1,qr);var mt=(t=>(t.preferences="preferences",t.watch="watch",t.unwatch="unwatch",t.nochange="nochange",t))(mt||{});const Bi=class Bi{constructor(e,n){this.pageInfo={...Bi.DEFAULT_PAGE_INFO,...e},this.api=n||new ya}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=mt.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||[]}};Bi.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 Qn=Bi;const Fo=class Fo extends yn{constructor(e){super(e,"wikiPage",!0),this.ctx=e}get WikiPage(){return Qn}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 Qn(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 Qn(e,this.ctx.api)}};Fo.inject=["api"];let us=Fo;const zr=Object.keys;function wd(t){return typeof t=="boolean"}function xd(t){return t&&typeof t.nodeType=="number"}function Wr(t){return typeof t=="string"}function $a(t){return typeof t=="number"}function nn(t){return typeof t=="object"?t!==null:Xn(t)}function Xn(t){return typeof t=="function"}function Sd(t){return!!(t&&t.isComponent)}function Ed(t){return nn(t)&&typeof t.length=="number"&&typeof t.nodeType!="number"}function fs(t,e){if(t)for(const n of zr(t))e(t[n],n)}function $d(t){return nn(t)&&"current"in t}const ds={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 kd(t,e){return t+e.charAt(0).toUpperCase()+e.substring(1)}const Cd=["Webkit","ms","Moz","O"];zr(ds).forEach(t=>{Cd.forEach(e=>{ds[kd(e,t)]=0})});const Od=Symbol.for("jsx-dom:type");var ka=function(t){return t.ShadowRoot="ShadowRoot",t}(ka||{});function Pd(t){return t!=null&&t[Od]===ka.ShadowRoot}const Ad="http://www.w3.org/2000/svg",Id="http://www.w3.org/1999/xlink",Td="http://www.w3.org/XML/1998/namespace";function Ca(t){return!wd(t)&&t!=null}function hs(t){return Array.isArray(t)?t.map(hs).filter(Boolean).join(" "):nn(t)?Symbol.iterator in t?hs(Array.from(t)):zr(t).filter(e=>t[e]).join(" "):Ca(t)?""+t:""}const Rd={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 bn(t){const e=document.createDocumentFragment();return Vr(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&&ps(e.ref,r),i}function x(t,e){let{children:n,...r}=e;!r.namespaceURI&&Rd[t]===0&&(r={...r,namespaceURI:Ad});let i;if(Wr(t)){if(i=r.namespaceURI?document.createElementNS(r.namespaceURI,t):document.createElement(t),Fd(r,i),Vr(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;ps(r.ref,i)}else if(Xn(t))nn(t.defaultProps)&&(r={...t.defaultProps,...r}),i=Sd(t)?Ld(t,r,n):t({...r,children:n});else throw new TypeError(`Invalid JSX element type: ${t}`);return i}function Nd(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),x(t,{...e,children:r},e.key)}function ps(t,e){$d(t)?t.current=e:Xn(t)&&t(e)}function Vr(t,e){if(Ed(t))Md(t,e);else if(Wr(t)||$a(t))ms(document.createTextNode(t),e);else if(t===null)ms(document.createComment(""),e);else if(xd(t))ms(t,e);else if(Pd(t)){const n=e.attachShadow(t.attr);Vr(t.children,n),ps(t.ref,n)}}function Md(t,e){for(const n of[...t])Vr(n,e);return e}function ms(t,e){e instanceof window.HTMLTemplateElement?e.content.appendChild(t):e.appendChild(t)}function Kr(t,e){return t.replace(/[A-Z]/g,n=>e+n.toLowerCase())}function Oa(t,e){e==null||e===!1||(Array.isArray(e)?e.forEach(n=>Oa(t,n)):Wr(e)?t.setAttribute("style",e):nn(e)&&fs(e,(n,r)=>{r.indexOf("-")===0?t.style.setProperty(r,n):$a(n)&&ds[r]!==0?t.style[r]=n+"px":t.style[r]=n}))}function jd(t,e,n){switch(t){case"xlinkActuate":case"xlinkArcrole":case"xlinkHref":case"xlinkRole":case"xlinkShow":case"xlinkTitle":case"xlinkType":Pa(n,Id,Kr(t,":"),e);return;case"xmlnsXlink":_n(n,Kr(t,":"),e);return;case"xmlBase":case"xmlLang":case"xmlSpace":Pa(n,Td,Kr(t,":"),e);return}switch(t){case"htmlFor":_n(n,"for",e);return;case"dataset":fs(e,(r,i)=>{r!=null&&(n.dataset[i]=r)});return;case"innerHTML":case"innerText":case"textContent":Ca(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":Xn(e)?e(n):_n(n,"class",hs(e));return;case"ref":case"namespaceURI":return;case"style":Oa(n,e);return;case"on":case"onCapture":fs(e,(r,i)=>{n.addEventListener(i,r,t==="onCapture")});return}if(Xn(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?_n(n,t,""):e!==!1&&e!=null&&(n instanceof SVGElement&&!Dd.test(t)?_n(n,Kr(t,"-"),e):_n(n,t,e))}function _n(t,e,n){t.setAttribute(e,n)}function Pa(t,e,n,r){t.setAttributeNS(e,n,r)}function Fd(t,e){for(const n of zr(t))jd(n,t[n],e);return e}var gs=(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))(gs||{});let Bd=0;const Aa=t=>`${t}-${++Bd}`;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 Ia(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 ze(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 Ud{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 Ud;class ys{constructor(e={}){this.backdropId=Aa("ipe-modal-backdrop"),this.modalId=Aa("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=gs,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);const n=this.get$modal(),r=this.get$window();n.classList.remove("is-dragging"),r.style.animation="none",requestAnimationFrame(()=>{this.applyAnimation(!0)})},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=ze("div",{className:"ipe-modal-backdrop",attrs:{id:this.backdropId,"data-modal-id":this.modalId}}));const r=ze("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 v=window.pageYOffset||document.documentElement.scrollTop,b=window.pageXOffset||document.documentElement.scrollLeft,A=window.innerWidth;r.style.top=`${v+60}px`,this.once("modal.show",()=>{r.style.left=`${b+A/2-r.offsetWidth/2}px`})}const i=ze("div",{className:`ipe-modal-modal__window size--${this.options.sizeClass||"auto"} plugin--${this.pluginName}`});i.modal=this;const s=ze("div",{className:"ipe-modal-modal__header"}),o=`${this.modalId}-title`,a=ze("h2",{className:"ipe-modal-modal__title",attrs:{id:o,role:"heading","aria-level":"2"}});r.setAttribute("aria-labelledby",o);const l=ze("div",{className:"ipe-modal-modal__icons"});if(this.options.closeIcon){const v=ze("button",{className:"ipe-modal-modal__close",attrs:{type:"button","aria-label":"Close"},html:"&times;"});v.addEventListener("click",()=>{let b=!0;typeof this.options.onClickClose=="function"?this.options.onClickClose(this)===!1&&(b=!1):this.options.onClickClose===!1&&(b=!1),b&&this.close()}),l.appendChild(v)}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=ze("div",{className:"ipe-modal-modal__content"}),c=ze("div",{className:"ipe-modal-modal__footer"}),f=ze("div",{className:"ipe-modal-modal__buttons ipe-modal-modal__buttons--left"}),y=ze("div",{className:"ipe-modal-modal__buttons ipe-modal-modal__buttons--right"});return c.append(f,y),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=y,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",v=>{this.options.outSideClose&&v.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){this.applyAnimation(!1),this.emit("modal.close"),this.emit("toast.close");const s=this.isAnimationDisabled()?0:this.options.animationSpeed??200;let o=!1;const a=()=>{o||(o=!0,this.destroy(),this.options.onClose?.(this))},l=(u,c)=>{const f=()=>{u.removeEventListener(c,f),a()};u.addEventListener(c,f,{once:!0})};return s>0&&this.$window?(l(this.$window,"transitionend"),l(this.$window,"animationend"),window.setTimeout(a,s+20)):window.setTimeout(a,s),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),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=ze("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"?ze("a"):ze("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&&(n?r.listener!==n:!0)),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=Ia(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=Ia(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=Hd(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=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=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 Xe.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()}),Xe.top()??new ys}static removeAll(){Xe.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"),e.content??(e.content="Are you sure you want to perform this action?");const r=e.okBtn??{label:"OK",className:"is-primary is-ghost"},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 getDefaultNotifyIcon(e){switch(e){case"success":return x("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-circle-check",children:[x("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),x("path",{d:"M17 3.34a10 10 0 1 1 -14.995 8.984l-.005 -.324l.005 -.324a10 10 0 0 1 14.995 -8.336zm-1.293 5.953a1 1 0 0 0 -1.32 -.083l-.094 .083l-3.293 3.292l-1.293 -1.292l-.094 -.083a1 1 0 0 0 -1.403 1.403l.083 .094l2 2l.094 .083a1 1 0 0 0 1.226 0l.094 -.083l4 -4l.083 -.094a1 1 0 0 0 -.083 -1.32z"})]});case"error":return x("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-alert-triangle",children:[x("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),x("path",{d:"M12 1.67c.955 0 1.845 .467 2.39 1.247l.105 .16l8.114 13.548a2.914 2.914 0 0 1 -2.307 4.363l-.195 .008h-16.225a2.914 2.914 0 0 1 -2.582 -4.2l.099 -.185l8.11 -13.538a2.914 2.914 0 0 1 2.491 -1.403zm.01 13.33l-.127 .007a1 1 0 0 0 0 1.986l.117 .007l.127 -.007a1 1 0 0 0 0 -1.986l-.117 -.007zm-.01 -7a1 1 0 0 0 -.993 .883l-.007 .117v4l.007 .117a1 1 0 0 0 1.986 0l.007 -.117v-4l-.007 -.117a1 1 0 0 0 -.993 -.883z"})]});case"warning":return x("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-alert-circle",children:[x("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),x("path",{d:"M12 2c5.523 0 10 4.477 10 10a10 10 0 0 1 -19.995 .324l-.005 -.324l.004 -.28c.148 -5.393 4.566 -9.72 9.996 -9.72zm.01 13l-.127 .007a1 1 0 0 0 0 1.986l.117 .007l.127 -.007a1 1 0 0 0 0 -1.986l-.117 -.007zm-.01 -8a1 1 0 0 0 -.993 .883l-.007 .117v4l.007 .117a1 1 0 0 0 1.986 0l.007 -.117v-4l-.007 -.117a1 1 0 0 0 -.993 -.883z"})]});case"info":return x("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-info-circle",children:[x("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),x("path",{d:"M12 2c5.523 0 10 4.477 10 10a10 10 0 0 1 -19.995 .324l-.005 -.324l.004 -.28c.148 -5.393 4.566 -9.72 9.996 -9.72zm0 9h-1l-.117 .007a1 1 0 0 0 0 1.986l.117 .007v3l.007 .117a1 1 0 0 0 .876 .876l.117 .007h1l.117 -.007a1 1 0 0 0 .876 -.876l.007 -.117l-.007 -.117a1 1 0 0 0 -.764 -.857l-.112 -.02l-.117 -.006v-3l-.007 -.117a1 1 0 0 0 -.876 -.876l-.117 -.007zm.01 -3l-.127 .007a1 1 0 0 0 0 1.986l.117 .007l.127 -.007a1 1 0 0 0 0 -1.986l-.117 -.007z"})]});case"dialog":return x("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-message-dots",children:[x("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),x("path",{d:"M12 11v.01"}),x("path",{d:"M8 11v.01"}),x("path",{d:"M16 11v.01"}),x("path",{d:"M18 4a3 3 0 0 1 3 3v8a3 3 0 0 1 -3 3h-5l-5 3v-3h-2a3 3 0 0 1 -3 -3v-8a3 3 0 0 1 3 -3z"})]});case"confirm":return x("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-copy-check",children:[x("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),x("path",{d:"M18.333 6a3.667 3.667 0 0 1 3.667 3.667v8.666a3.667 3.667 0 0 1 -3.667 3.667h-8.666a3.667 3.667 0 0 1 -3.667 -3.667v-8.666a3.667 3.667 0 0 1 3.667 -3.667zm-3.333 -4c1.094 0 1.828 .533 2.374 1.514a1 1 0 1 1 -1.748 .972c-.221 -.398 -.342 -.486 -.626 -.486h-10c-.548 0 -1 .452 -1 1v9.998c0 .32 .154 .618 .407 .805l.1 .065a1 1 0 1 1 -.99 1.738a3 3 0 0 1 -1.517 -2.606v-10c0 -1.652 1.348 -3 3 -3zm1.293 9.293l-3.293 3.292l-1.293 -1.292a1 1 0 0 0 -1.414 1.414l2 2a1 1 0 0 0 1.414 0l4 -4a1 1 0 0 0 -1.414 -1.414"})]});default:return null}}static notify(e,n,r){var a,l,u,c;if(n?.overrideOther&&[...rn].forEach(f=>f.close()),typeof n.title>"u"){const f=e||"Notification";n.title=f[0].toUpperCase()+f.slice(1).toLowerCase()}const i=n.icon??this.getDefaultNotifyIcon(e);i&&(i instanceof Element&&i.classList.add("ipe-modal-notify-icon"),n.title=x(bn,{children:[i,n.title]})),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.cancelBtn,n.okBtn,...n.buttons??[]].filter(Boolean);const s=`is-notify type-${e||"default"} ${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"})}}const rn=[];function Hd(t="top right"){const e="ipe-modal-toast-container",n=`${e}-${t.replace(/[\s-\.|\/]+/g,"-")}`;let r=document.getElementById(n);return r||(r=ze("div",{className:`${e} ${t}`,attrs:{id:n,"data-position":t}}),document.body.appendChild(r)),r}const qd={ipe_progress:"_ipe_progress_so6hn_1"},sn=t=>{const e=t.indeterminate??!0,n=x("div",{class:`${qd.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 Le extends ys{constructor(e={}){e.className||(e.className=""),e.className+=" theme-ipe",e.modalAnimation||(e.modalAnimation={show:"ipe-modal-fade-in",hide:"ipe-modal-fade-out"}),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(x("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:x(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=Le,this.IPEModalEvent=gs,this.show=Le.show.bind(Le),this.createObject=Le.createObject.bind(Le),this.close=Le.close.bind(Le),this.closeAll=Le.closeAll.bind(Le),this.removeAll=Le.removeAll.bind(Le),this.dialog=Le.dialog.bind(Le),this.confirm=Le.confirm.bind(Le),this.notify=Le.notify.bind(Le),e.set("modal",this)}}var vs=(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-next",t.HOME_URL="https://www.ipe.wiki/",t.UPDATE_LOGS_URL="https://www.ipe.wiki/changelogs/",t))(vs||{});/**
52
+ */var za;function lh(){return za||(za=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 Xr=="function"&&Xr;if(!c&&f)return f(u,!0);if(a)return a(u,!0);var y=new Error("Cannot find module '"+u+"'");throw y.code="MODULE_NOT_FOUND",y}var v=i[u]={exports:{}};r[u][0].call(v.exports,function(b){var A=r[u][1][b];return o(A||b)},v,v.exports,n,r,i,s)}return i[u].exports}for(var a=typeof Xr=="function"&&Xr,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(b),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=b,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(){b(),U.onreadystatechange=null,U.parentNode.removeChild(U),U=null},s.document.documentElement.appendChild(U)}:a=function(){setTimeout(b,0)};var y,v=[];function b(){y=!0;for(var U,D,I=v.length;I;){for(D=v,v=[],U=-1;++U<I;)D[U]();I=v.length}y=!1}r.exports=A;function A(U){v.push(U)===1&&!y&&a()}}).call(this,typeof Jr<"u"?Jr: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,S){if(typeof h!="function"&&this.state===u||typeof S!="function"&&this.state===l)return this;var O=new this.constructor(o);if(this.state!==c){var R=this.state===u?h:S;v(O,R,this.outcome)}else this.queue.push(new y(O,h,S));return O};function y(h,S,O){this.promise=h,typeof S=="function"&&(this.onFulfilled=S,this.callFulfilled=this.otherCallFulfilled),typeof O=="function"&&(this.onRejected=O,this.callRejected=this.otherCallRejected)}y.prototype.callFulfilled=function(h){a.resolve(this.promise,h)},y.prototype.otherCallFulfilled=function(h){v(this.promise,this.onFulfilled,h)},y.prototype.callRejected=function(h){a.reject(this.promise,h)},y.prototype.otherCallRejected=function(h){v(this.promise,this.onRejected,h)};function v(h,S,O){s(function(){var R;try{R=S(O)}catch(z){return a.reject(h,z)}R===h?a.reject(h,new TypeError("Cannot resolve promise with itself")):a.resolve(h,R)})}a.resolve=function(h,S){var O=U(b,S);if(O.status==="error")return a.reject(h,O.value);var R=O.value;if(R)A(h,R);else{h.state=u,h.outcome=S;for(var z=-1,X=h.queue.length;++z<X;)h.queue[z].callFulfilled(S)}return h},a.reject=function(h,S){h.state=l,h.outcome=S;for(var O=-1,R=h.queue.length;++O<R;)h.queue[O].callRejected(S);return h};function b(h){var S=h&&h.then;if(h&&(typeof h=="object"||typeof h=="function")&&typeof S=="function")return function(){S.apply(h,arguments)}}function A(h,S){var O=!1;function R(Te){O||(O=!0,a.reject(h,Te))}function z(Te){O||(O=!0,a.resolve(h,Te))}function X(){S(z,R)}var Ce=U(X);Ce.status==="error"&&R(Ce.value)}function U(h,S){var O={};try{O.value=h(S),O.status="success"}catch(R){O.status="error",O.value=R}return O}f.resolve=D;function D(h){return h instanceof this?h:a.resolve(new this(o),h)}f.reject=I;function I(h){var S=new this(o);return a.reject(S,h)}f.all=g;function g(h){var S=this;if(Object.prototype.toString.call(h)!=="[object Array]")return this.reject(new TypeError("must be an array"));var O=h.length,R=!1;if(!O)return this.resolve([]);for(var z=new Array(O),X=0,Ce=-1,Te=new this(o);++Ce<O;)tt(h[Ce],Ce);return Te;function tt(qt,bn){S.resolve(qt).then(Re,function(me){R||(R=!0,a.reject(Te,me))});function Re(me){z[bn]=me,++X===O&&!R&&(R=!0,a.resolve(Te,z))}}}f.race=p;function p(h){var S=this;if(Object.prototype.toString.call(h)!=="[object Array]")return this.reject(new TypeError("must be an array"));var O=h.length,R=!1;if(!O)return this.resolve([]);for(var z=-1,X=new this(o);++z<O;)Ce(h[z]);return X;function Ce(Te){S.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 Jr<"u"?Jr: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,x){if(!(d instanceof x))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),x=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!d||x)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function c(d,x){d=d||[],x=x||{};try{return new Blob(d,x)}catch(E){if(E.name!=="TypeError")throw E;for(var m=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,C=new m,P=0;P<d.length;P+=1)C.append(d[P]);return C.getBlob(x.type)}}typeof Promise>"u"&&n(3);var f=Promise;function y(d,x){x&&d.then(function(m){x(null,m)},function(m){x(m)})}function v(d,x,m){typeof x=="function"&&d.then(x),typeof m=="function"&&d.catch(m)}function b(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 S(d){for(var x=d.length,m=new ArrayBuffer(x),C=new Uint8Array(m),P=0;P<x;P++)C[P]=d.charCodeAt(P);return m}function O(d){return new f(function(x){var m=d.transaction(U,h),C=c([""]);m.objectStore(U).put(C,"key"),m.onabort=function(P){P.preventDefault(),P.stopPropagation(),x(!1)},m.oncomplete=function(){var P=navigator.userAgent.match(/Chrome\/(\d+)/),E=navigator.userAgent.match(/Edge\//);x(E||!P||parseInt(P[1],10)>=43)}}).catch(function(){return!1})}function R(d){return typeof D=="boolean"?f.resolve(D):O(d).then(function(x){return D=x,D})}function z(d){var x=I[d.name],m={};m.promise=new f(function(C,P){m.resolve=C,m.reject=P}),x.deferredOperations.push(m),x.dbReady?x.dbReady=x.dbReady.then(function(){return m.promise}):x.dbReady=m.promise}function X(d){var x=I[d.name],m=x.deferredOperations.pop();if(m)return m.resolve(),m.promise}function Ce(d,x){var m=I[d.name],C=m.deferredOperations.pop();if(C)return C.reject(x),C.promise}function Te(d,x){return new f(function(m,C){if(I[d.name]=I[d.name]||at(),d.db)if(x)z(d),d.db.close();else return m(d.db);var P=[d.name];x&&P.push(d.version);var E=l.open.apply(l,P);x&&(E.onupgradeneeded=function(N){var B=E.result;try{B.createObjectStore(d.storeName),N.oldVersion<=1&&B.createObjectStore(U)}catch(q){if(q.name!=="ConstraintError")throw q}}),E.onerror=function(N){N.preventDefault(),C(E.error)},E.onsuccess=function(){var N=E.result;N.onversionchange=function(B){B.target.close()},m(N),X(d)}})}function tt(d){return Te(d,!1)}function qt(d){return Te(d,!0)}function bn(d,x){if(!d.db)return!0;var m=!d.db.objectStoreNames.contains(d.storeName),C=d.version<d.db.version,P=d.version>d.db.version;if(C&&(d.version,d.version=d.db.version),P||m){if(m){var E=d.db.version+1;E>d.version&&(d.version=E)}return!0}return!1}function Re(d){return new f(function(x,m){var C=new FileReader;C.onerror=m,C.onloadend=function(P){var E=btoa(P.target.result||"");x({__local_forage_encoded_blob:!0,data:E,type:d.type})},C.readAsBinaryString(d)})}function me(d){var x=S(atob(d.data));return c([x],{type:d.type})}function ye(d){return d&&d.__local_forage_encoded_blob}function Ht(d){var x=this,m=x._initReady().then(function(){var C=I[x._dbInfo.name];if(C&&C.dbReady)return C.dbReady});return v(m,d,d),m}function Vn(d){z(d);for(var x=I[d.name],m=x.forages,C=0;C<m.length;C++){var P=m[C];P._dbInfo.db&&(P._dbInfo.db.close(),P._dbInfo.db=null)}return d.db=null,tt(d).then(function(E){return d.db=E,bn(d)?qt(d):E}).then(function(E){d.db=x.db=E;for(var N=0;N<m.length;N++)m[N]._dbInfo.db=E}).catch(function(E){throw Ce(d,E),E})}function je(d,x,m,C){C===void 0&&(C=1);try{var P=d.db.transaction(d.storeName,x);m(null,P)}catch(E){if(C>0&&(!d.db||E.name==="InvalidStateError"||E.name==="NotFoundError"))return f.resolve().then(function(){if(!d.db||E.name==="NotFoundError"&&!d.db.objectStoreNames.contains(d.storeName)&&d.version<=d.db.version)return d.db&&(d.version=d.db.version+1),qt(d)}).then(function(){return Vn(d).then(function(){je(d,x,m,C-1)})}).catch(m);m(E)}}function at(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Ji(d){var x=this,m={db:null};if(d)for(var C in d)m[C]=d[C];var P=I[m.name];P||(P=at(),I[m.name]=P),P.forages.push(x),x._initReady||(x._initReady=x.ready,x.ready=Ht);var E=[];function N(){return f.resolve()}for(var B=0;B<P.forages.length;B++){var q=P.forages[B];q!==x&&E.push(q._initReady().catch(N))}var H=P.forages.slice(0);return f.all(E).then(function(){return m.db=P.db,tt(m)}).then(function(V){return m.db=V,bn(m,x._defaultConfig.version)?qt(m):V}).then(function(V){m.db=P.db=V,x._dbInfo=m;for(var J=0;J<H.length;J++){var ae=H[J];ae!==x&&(ae._dbInfo.db=m.db,ae._dbInfo.version=m.version)}})}function ea(d,x){var m=this;d=b(d);var C=new f(function(P,E){m.ready().then(function(){je(m._dbInfo,p,function(N,B){if(N)return E(N);try{var q=B.objectStore(m._dbInfo.storeName),H=q.get(d);H.onsuccess=function(){var V=H.result;V===void 0&&(V=null),ye(V)&&(V=me(V)),P(V)},H.onerror=function(){E(H.error)}}catch(V){E(V)}})}).catch(E)});return y(C,x),C}function ta(d,x){var m=this,C=new f(function(P,E){m.ready().then(function(){je(m._dbInfo,p,function(N,B){if(N)return E(N);try{var q=B.objectStore(m._dbInfo.storeName),H=q.openCursor(),V=1;H.onsuccess=function(){var J=H.result;if(J){var ae=J.value;ye(ae)&&(ae=me(ae));var ge=d(ae,J.key,V++);ge!==void 0?P(ge):J.continue()}else P()},H.onerror=function(){E(H.error)}}catch(J){E(J)}})}).catch(E)});return y(C,x),C}function wn(d,x,m){var C=this;d=b(d);var P=new f(function(E,N){var B;C.ready().then(function(){return B=C._dbInfo,g.call(x)==="[object Blob]"?R(B.db).then(function(q){return q?x:Re(x)}):x}).then(function(q){je(C._dbInfo,h,function(H,V){if(H)return N(H);try{var J=V.objectStore(C._dbInfo.storeName);q===null&&(q=void 0);var ae=J.put(q,d);V.oncomplete=function(){q===void 0&&(q=null),E(q)},V.onabort=V.onerror=function(){var ge=ae.error?ae.error:ae.transaction.error;N(ge)}}catch(ge){N(ge)}})}).catch(N)});return y(P,m),P}function Kn(d,x){var m=this;d=b(d);var C=new f(function(P,E){m.ready().then(function(){je(m._dbInfo,h,function(N,B){if(N)return E(N);try{var q=B.objectStore(m._dbInfo.storeName),H=q.delete(d);B.oncomplete=function(){P()},B.onerror=function(){E(H.error)},B.onabort=function(){var V=H.error?H.error:H.transaction.error;E(V)}}catch(V){E(V)}})}).catch(E)});return y(C,x),C}function Rr(d){var x=this,m=new f(function(C,P){x.ready().then(function(){je(x._dbInfo,h,function(E,N){if(E)return P(E);try{var B=N.objectStore(x._dbInfo.storeName),q=B.clear();N.oncomplete=function(){C()},N.onabort=N.onerror=function(){var H=q.error?q.error:q.transaction.error;P(H)}}catch(H){P(H)}})}).catch(P)});return y(m,d),m}function Xi(d){var x=this,m=new f(function(C,P){x.ready().then(function(){je(x._dbInfo,p,function(E,N){if(E)return P(E);try{var B=N.objectStore(x._dbInfo.storeName),q=B.count();q.onsuccess=function(){C(q.result)},q.onerror=function(){P(q.error)}}catch(H){P(H)}})}).catch(P)});return y(m,d),m}function _n(d,x){var m=this,C=new f(function(P,E){if(d<0){P(null);return}m.ready().then(function(){je(m._dbInfo,p,function(N,B){if(N)return E(N);try{var q=B.objectStore(m._dbInfo.storeName),H=!1,V=q.openKeyCursor();V.onsuccess=function(){var J=V.result;if(!J){P(null);return}d===0||H?P(J.key):(H=!0,J.advance(d))},V.onerror=function(){E(V.error)}}catch(J){E(J)}})}).catch(E)});return y(C,x),C}function yf(d){var x=this,m=new f(function(C,P){x.ready().then(function(){je(x._dbInfo,p,function(E,N){if(E)return P(E);try{var B=N.objectStore(x._dbInfo.storeName),q=B.openKeyCursor(),H=[];q.onsuccess=function(){var V=q.result;if(!V){C(H);return}H.push(V.key),V.continue()},q.onerror=function(){P(q.error)}}catch(V){P(V)}})}).catch(P)});return y(m,d),m}function _(d,x){x=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 C=this,P;if(!d.name)P=f.reject("Invalid arguments");else{var E=d.name===m.name&&C._dbInfo.db,N=E?f.resolve(C._dbInfo.db):tt(d).then(function(B){var q=I[d.name],H=q.forages;q.db=B;for(var V=0;V<H.length;V++)H[V]._dbInfo.db=B;return B});d.storeName?P=N.then(function(B){if(B.objectStoreNames.contains(d.storeName)){var q=B.version+1;z(d);var H=I[d.name],V=H.forages;B.close();for(var J=0;J<V.length;J++){var ae=V[J];ae._dbInfo.db=null,ae._dbInfo.version=q}var ge=new f(function(we,Ie){var Pe=l.open(d.name,q);Pe.onerror=function(pt){var Lr=Pe.result;Lr.close(),Ie(pt)},Pe.onupgradeneeded=function(){var pt=Pe.result;pt.deleteObjectStore(d.storeName)},Pe.onsuccess=function(){var pt=Pe.result;pt.close(),we(pt)}});return ge.then(function(we){H.db=we;for(var Ie=0;Ie<V.length;Ie++){var Pe=V[Ie];Pe._dbInfo.db=we,X(Pe._dbInfo)}}).catch(function(we){throw(Ce(d,we)||f.resolve()).catch(function(){}),we})}}):P=N.then(function(B){z(d);var q=I[d.name],H=q.forages;B.close();for(var V=0;V<H.length;V++){var J=H[V];J._dbInfo.db=null}var ae=new f(function(ge,we){var Ie=l.deleteDatabase(d.name);Ie.onerror=function(){var Pe=Ie.result;Pe&&Pe.close(),we(Ie.error)},Ie.onblocked=function(){},Ie.onsuccess=function(){var Pe=Ie.result;Pe&&Pe.close(),ge(Pe)}});return ae.then(function(ge){q.db=ge;for(var we=0;we<H.length;we++){var Ie=H[we];X(Ie._dbInfo)}}).catch(function(ge){throw(Ce(d,ge)||f.resolve()).catch(function(){}),ge})})}return y(P,x),P}var k={_driver:"asyncStorage",_initStorage:Ji,_support:u(),iterate:ta,getItem:ea,setItem:wn,removeItem:Kn,clear:Rr,length:Xi,key:_n,keys:yf,dropInstance:_};function T(){return typeof openDatabase=="function"}var L="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",M="~~local_forage_type~",j=/^~~local_forage_type~([^~]+)~/,G="__lfsc__:",K=G.length,W="arbf",F="blob",ee="si08",Q="ui08",Z="uic8",re="si16",ce="si32",be="ur16",de="ui32",Be="fl32",Fe="fl64",lt=K+W.length,ct=Object.prototype.toString;function nn(d){var x=d.length*.75,m=d.length,C,P=0,E,N,B,q;d[d.length-1]==="="&&(x--,d[d.length-2]==="="&&x--);var H=new ArrayBuffer(x),V=new Uint8Array(H);for(C=0;C<m;C+=4)E=L.indexOf(d[C]),N=L.indexOf(d[C+1]),B=L.indexOf(d[C+2]),q=L.indexOf(d[C+3]),V[P++]=E<<2|N>>4,V[P++]=(N&15)<<4|B>>2,V[P++]=(B&3)<<6|q&63;return H}function Yn(d){var x=new Uint8Array(d),m="",C;for(C=0;C<x.length;C+=3)m+=L[x[C]>>2],m+=L[(x[C]&3)<<4|x[C+1]>>4],m+=L[(x[C+1]&15)<<2|x[C+2]>>6],m+=L[x[C+2]&63];return x.length%3===2?m=m.substring(0,m.length-1)+"=":x.length%3===1&&(m=m.substring(0,m.length-2)+"=="),m}function Ge(d,x){var m="";if(d&&(m=ct.call(d)),d&&(m==="[object ArrayBuffer]"||d.buffer&&ct.call(d.buffer)==="[object ArrayBuffer]")){var C,P=G;d instanceof ArrayBuffer?(C=d,P+=W):(C=d.buffer,m==="[object Int8Array]"?P+=ee:m==="[object Uint8Array]"?P+=Q:m==="[object Uint8ClampedArray]"?P+=Z:m==="[object Int16Array]"?P+=re:m==="[object Uint16Array]"?P+=be:m==="[object Int32Array]"?P+=ce:m==="[object Uint32Array]"?P+=de:m==="[object Float32Array]"?P+=Be:m==="[object Float64Array]"?P+=Fe:x(new Error("Failed to get type for BinaryArray"))),x(P+Yn(C))}else if(m==="[object Blob]"){var E=new FileReader;E.onload=function(){var N=M+d.type+"~"+Yn(this.result);x(G+F+N)},E.readAsArrayBuffer(d)}else try{x(JSON.stringify(d))}catch(N){x(null,N)}}function ht(d){if(d.substring(0,K)!==G)return JSON.parse(d);var x=d.substring(lt),m=d.substring(K,lt),C;if(m===F&&j.test(x)){var P=x.match(j);C=P[1],x=x.substring(P[0].length)}var E=nn(x);switch(m){case W:return E;case F:return c([E],{type:C});case ee:return new Int8Array(E);case Q:return new Uint8Array(E);case Z:return new Uint8ClampedArray(E);case re:return new Int16Array(E);case be:return new Uint16Array(E);case ce:return new Int32Array(E);case de:return new Uint32Array(E);case Be:return new Float32Array(E);case Fe:return new Float64Array(E);default:throw new Error("Unkown type: "+m)}}var Gn={serialize:Ge,deserialize:ht,stringToBuffer:nn,bufferToString:Yn};function Nr(d,x,m,C){d.executeSql("CREATE TABLE IF NOT EXISTS "+x.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],m,C)}function Ty(d){var x=this,m={db:null};if(d)for(var C in d)m[C]=typeof d[C]!="string"?d[C].toString():d[C];var P=new f(function(E,N){try{m.db=openDatabase(m.name,String(m.version),m.description,m.size)}catch(B){return N(B)}m.db.transaction(function(B){Nr(B,m,function(){x._dbInfo=m,E()},function(q,H){N(H)})},N)});return m.serializer=Gn,P}function rn(d,x,m,C,P,E){d.executeSql(m,C,P,function(N,B){B.code===B.SYNTAX_ERR?N.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[x.storeName],function(q,H){H.rows.length?E(q,B):Nr(q,x,function(){q.executeSql(m,C,P,E)},E)},E):E(N,B)},E)}function Ry(d,x){var m=this;d=b(d);var C=new f(function(P,E){m.ready().then(function(){var N=m._dbInfo;N.db.transaction(function(B){rn(B,N,"SELECT * FROM "+N.storeName+" WHERE key = ? LIMIT 1",[d],function(q,H){var V=H.rows.length?H.rows.item(0).value:null;V&&(V=N.serializer.deserialize(V)),P(V)},function(q,H){E(H)})})}).catch(E)});return y(C,x),C}function Ny(d,x){var m=this,C=new f(function(P,E){m.ready().then(function(){var N=m._dbInfo;N.db.transaction(function(B){rn(B,N,"SELECT * FROM "+N.storeName,[],function(q,H){for(var V=H.rows,J=V.length,ae=0;ae<J;ae++){var ge=V.item(ae),we=ge.value;if(we&&(we=N.serializer.deserialize(we)),we=d(we,ge.key,ae+1),we!==void 0){P(we);return}}P()},function(q,H){E(H)})})}).catch(E)});return y(C,x),C}function bf(d,x,m,C){var P=this;d=b(d);var E=new f(function(N,B){P.ready().then(function(){x===void 0&&(x=null);var q=x,H=P._dbInfo;H.serializer.serialize(x,function(V,J){J?B(J):H.db.transaction(function(ae){rn(ae,H,"INSERT OR REPLACE INTO "+H.storeName+" (key, value) VALUES (?, ?)",[d,V],function(){N(q)},function(ge,we){B(we)})},function(ae){if(ae.code===ae.QUOTA_ERR){if(C>0){N(bf.apply(P,[d,q,m,C-1]));return}B(ae)}})})}).catch(B)});return y(E,m),E}function Dy(d,x,m){return bf.apply(this,[d,x,m,1])}function Ly(d,x){var m=this;d=b(d);var C=new f(function(P,E){m.ready().then(function(){var N=m._dbInfo;N.db.transaction(function(B){rn(B,N,"DELETE FROM "+N.storeName+" WHERE key = ?",[d],function(){P()},function(q,H){E(H)})})}).catch(E)});return y(C,x),C}function My(d){var x=this,m=new f(function(C,P){x.ready().then(function(){var E=x._dbInfo;E.db.transaction(function(N){rn(N,E,"DELETE FROM "+E.storeName,[],function(){C()},function(B,q){P(q)})})}).catch(P)});return y(m,d),m}function jy(d){var x=this,m=new f(function(C,P){x.ready().then(function(){var E=x._dbInfo;E.db.transaction(function(N){rn(N,E,"SELECT COUNT(key) as c FROM "+E.storeName,[],function(B,q){var H=q.rows.item(0).c;C(H)},function(B,q){P(q)})})}).catch(P)});return y(m,d),m}function By(d,x){var m=this,C=new f(function(P,E){m.ready().then(function(){var N=m._dbInfo;N.db.transaction(function(B){rn(B,N,"SELECT key FROM "+N.storeName+" WHERE id = ? LIMIT 1",[d+1],function(q,H){var V=H.rows.length?H.rows.item(0).key:null;P(V)},function(q,H){E(H)})})}).catch(E)});return y(C,x),C}function Fy(d){var x=this,m=new f(function(C,P){x.ready().then(function(){var E=x._dbInfo;E.db.transaction(function(N){rn(N,E,"SELECT key FROM "+E.storeName,[],function(B,q){for(var H=[],V=0;V<q.rows.length;V++)H.push(q.rows.item(V).key);C(H)},function(B,q){P(q)})})}).catch(P)});return y(m,d),m}function Uy(d){return new f(function(x,m){d.transaction(function(C){C.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(P,E){for(var N=[],B=0;B<E.rows.length;B++)N.push(E.rows.item(B).name);x({db:d,storeNames:N})},function(P,E){m(E)})},function(C){m(C)})})}function qy(d,x){x=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 C=this,P;return d.name?P=new f(function(E){var N;d.name===m.name?N=C._dbInfo.db:N=openDatabase(d.name,"","",0),d.storeName?E({db:N,storeNames:[d.storeName]}):E(Uy(N))}).then(function(E){return new f(function(N,B){E.db.transaction(function(q){function H(ge){return new f(function(we,Ie){q.executeSql("DROP TABLE IF EXISTS "+ge,[],function(){we()},function(Pe,pt){Ie(pt)})})}for(var V=[],J=0,ae=E.storeNames.length;J<ae;J++)V.push(H(E.storeNames[J]));f.all(V).then(function(){N()}).catch(function(ge){B(ge)})},function(q){B(q)})})}):P=f.reject("Invalid arguments"),y(P,x),P}var Hy={_driver:"webSQLStorage",_initStorage:Ty,_support:T(),iterate:Ny,getItem:Ry,setItem:Dy,removeItem:Ly,clear:My,length:jy,key:By,keys:Fy,dropInstance:qy};function zy(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function wf(d,x){var m=d.name+"/";return d.storeName!==x.storeName&&(m+=d.storeName+"/"),m}function Wy(){var d="_localforage_support_test";try{return localStorage.setItem(d,!0),localStorage.removeItem(d),!1}catch{return!0}}function Vy(){return!Wy()||localStorage.length>0}function Ky(d){var x=this,m={};if(d)for(var C in d)m[C]=d[C];return m.keyPrefix=wf(d,x._defaultConfig),Vy()?(x._dbInfo=m,m.serializer=Gn,f.resolve()):f.reject()}function Yy(d){var x=this,m=x.ready().then(function(){for(var C=x._dbInfo.keyPrefix,P=localStorage.length-1;P>=0;P--){var E=localStorage.key(P);E.indexOf(C)===0&&localStorage.removeItem(E)}});return y(m,d),m}function Gy(d,x){var m=this;d=b(d);var C=m.ready().then(function(){var P=m._dbInfo,E=localStorage.getItem(P.keyPrefix+d);return E&&(E=P.serializer.deserialize(E)),E});return y(C,x),C}function Qy(d,x){var m=this,C=m.ready().then(function(){for(var P=m._dbInfo,E=P.keyPrefix,N=E.length,B=localStorage.length,q=1,H=0;H<B;H++){var V=localStorage.key(H);if(V.indexOf(E)===0){var J=localStorage.getItem(V);if(J&&(J=P.serializer.deserialize(J)),J=d(J,V.substring(N),q++),J!==void 0)return J}}});return y(C,x),C}function Jy(d,x){var m=this,C=m.ready().then(function(){var P=m._dbInfo,E;try{E=localStorage.key(d)}catch{E=null}return E&&(E=E.substring(P.keyPrefix.length)),E});return y(C,x),C}function Xy(d){var x=this,m=x.ready().then(function(){for(var C=x._dbInfo,P=localStorage.length,E=[],N=0;N<P;N++){var B=localStorage.key(N);B.indexOf(C.keyPrefix)===0&&E.push(B.substring(C.keyPrefix.length))}return E});return y(m,d),m}function Zy(d){var x=this,m=x.keys().then(function(C){return C.length});return y(m,d),m}function eb(d,x){var m=this;d=b(d);var C=m.ready().then(function(){var P=m._dbInfo;localStorage.removeItem(P.keyPrefix+d)});return y(C,x),C}function tb(d,x,m){var C=this;d=b(d);var P=C.ready().then(function(){x===void 0&&(x=null);var E=x;return new f(function(N,B){var q=C._dbInfo;q.serializer.serialize(x,function(H,V){if(V)B(V);else try{localStorage.setItem(q.keyPrefix+d,H),N(E)}catch(J){(J.name==="QuotaExceededError"||J.name==="NS_ERROR_DOM_QUOTA_REACHED")&&B(J),B(J)}})})});return y(P,m),P}function nb(d,x){if(x=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 C=this,P;return d.name?P=new f(function(E){d.storeName?E(wf(d,C._defaultConfig)):E(d.name+"/")}).then(function(E){for(var N=localStorage.length-1;N>=0;N--){var B=localStorage.key(N);B.indexOf(E)===0&&localStorage.removeItem(B)}}):P=f.reject("Invalid arguments"),y(P,x),P}var rb={_driver:"localStorageWrapper",_initStorage:Ky,_support:zy(),iterate:Qy,getItem:Gy,setItem:tb,removeItem:eb,clear:Yy,length:Zy,key:Jy,keys:Xy,dropInstance:nb},ib=function(x,m){return x===m||typeof x=="number"&&typeof m=="number"&&isNaN(x)&&isNaN(m)},sb=function(x,m){for(var C=x.length,P=0;P<C;){if(ib(x[P],m))return!0;P++}return!1},_f=Array.isArray||function(d){return Object.prototype.toString.call(d)==="[object Array]"},Dr={},xf={},Qn={INDEXEDDB:k,WEBSQL:Hy,LOCALSTORAGE:rb},ob=[Qn.INDEXEDDB._driver,Qn.WEBSQL._driver,Qn.LOCALSTORAGE._driver],Zi=["dropInstance"],na=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Zi),ab={description:"",driver:ob.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function lb(d,x){d[x]=function(){var m=arguments;return d.ready().then(function(){return d[x].apply(d,m)})}}function ra(){for(var d=1;d<arguments.length;d++){var x=arguments[d];if(x)for(var m in x)x.hasOwnProperty(m)&&(_f(x[m])?arguments[0][m]=x[m].slice():arguments[0][m]=x[m])}return arguments[0]}var cb=function(){function d(x){o(this,d);for(var m in Qn)if(Qn.hasOwnProperty(m)){var C=Qn[m],P=C._driver;this[m]=P,Dr[P]||this.defineDriver(C)}this._defaultConfig=ra({},ab),this._config=ra({},this._defaultConfig,x),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 C in m){if(C==="storeName"&&(m[C]=m[C].replace(/\W/g,"_")),C==="version"&&typeof m[C]!="number")return new Error("Database version must be a number.");this._config[C]=m[C]}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,C,P){var E=new f(function(N,B){try{var q=m._driver,H=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!m._driver){B(H);return}for(var V=na.concat("_initStorage"),J=0,ae=V.length;J<ae;J++){var ge=V[J],we=!sb(Zi,ge);if((we||m[ge])&&typeof m[ge]!="function"){B(H);return}}var Ie=function(){for(var Lr=function(db){return function(){var hb=new Error("Method "+db+" is not implemented by the current driver"),Sf=f.reject(hb);return y(Sf,arguments[arguments.length-1]),Sf}},ia=0,fb=Zi.length;ia<fb;ia++){var sa=Zi[ia];m[sa]||(m[sa]=Lr(sa))}};Ie();var Pe=function(Lr){Dr[q],Dr[q]=m,xf[q]=Lr,N()};"_support"in m?m._support&&typeof m._support=="function"?m._support().then(Pe,B):Pe(!!m._support):Pe(!0)}catch(pt){B(pt)}});return v(E,C,P),E},d.prototype.driver=function(){return this._driver||null},d.prototype.getDriver=function(m,C,P){var E=Dr[m]?f.resolve(Dr[m]):f.reject(new Error("Driver not found."));return v(E,C,P),E},d.prototype.getSerializer=function(m){var C=f.resolve(Gn);return v(C,m),C},d.prototype.ready=function(m){var C=this,P=C._driverSet.then(function(){return C._ready===null&&(C._ready=C._initDriver()),C._ready});return v(P,m,m),P},d.prototype.setDriver=function(m,C,P){var E=this;_f(m)||(m=[m]);var N=this._getSupportedDrivers(m);function B(){E._config.driver=E.driver()}function q(J){return E._extend(J),B(),E._ready=E._initStorage(E._config),E._ready}function H(J){return function(){var ae=0;function ge(){for(;ae<J.length;){var we=J[ae];return ae++,E._dbInfo=null,E._ready=null,E.getDriver(we).then(q).catch(ge)}B();var Ie=new Error("No available storage method found.");return E._driverSet=f.reject(Ie),E._driverSet}return ge()}}var V=this._driverSet!==null?this._driverSet.catch(function(){return f.resolve()}):f.resolve();return this._driverSet=V.then(function(){var J=N[0];return E._dbInfo=null,E._ready=null,E.getDriver(J).then(function(ae){E._driver=ae._driver,B(),E._wrapLibraryMethodsWithReady(),E._initDriver=H(N)})}).catch(function(){B();var J=new Error("No available storage method found.");return E._driverSet=f.reject(J),E._driverSet}),v(this._driverSet,C,P),this._driverSet},d.prototype.supports=function(m){return!!xf[m]},d.prototype._extend=function(m){ra(this,m)},d.prototype._getSupportedDrivers=function(m){for(var C=[],P=0,E=m.length;P<E;P++){var N=m[P];this.supports(N)&&C.push(N)}return C},d.prototype._wrapLibraryMethodsWithReady=function(){for(var m=0,C=na.length;m<C;m++)lb(this,na[m])},d.prototype.createInstance=function(m){return new d(m)},d}(),ub=new cb;r.exports=ub},{3:3}]},{},[4])(4)})}(Es)),Es.exports}var ch=lh();const Wa=ah(ch);class uh extends an{constructor(e){super(e,"storage",!1),e.set("localforage",Wa)}get StorageManager(){return Zr}createDatabse(e,n,r){return new Zr("InPageEdit",e,n,r)}}const Wn=class Wn{constructor(e,n,r=Wn.DEFAULT_TTL,i){this.dbName=e,this.storeName=n,this.ttl=r,this.version=i,this.db=Wn.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}};Wn.DEFAULT_TTL=1/0,Wn._cached_db_instances=new Map;let Zr=Wn;var mt=(t=>(t.preferences="preferences",t.watch="watch",t.unwatch="unwatch",t.nochange="nochange",t))(mt||{});const Yi=class Yi{constructor(e,n){this.pageInfo={...Yi.DEFAULT_PAGE_INFO,...e},this.api=n||new Oa}async fetchPageInfo(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=mt.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 reloadSelfInfo(){const e=await this.fetchPageInfo({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||[]}};Yi.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 rr=Yi;const Qo=class Qo extends an{constructor(e){super(e,"wikiPage",!0),this.ctx=e}get WikiPage(){return rr}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 rr(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 rr(e,this.ctx.api)}};Qo.inject=["api"];let ks=Qo;const Va=new WeakMap,_t={toDBKey:t=>t.replace(/ /g,"_"),toNormalText:t=>t.replace(/_/g," "),ensureCase:(t,e)=>e==="first-letter"?t.charAt(0).toUpperCase()+t.slice(1):t},En={normalizeSpecialPageName:t=>t.toLowerCase(),buildSpecialPageIndex:t=>{const e=new Map,n=new Map,r=new Map;for(const i of t.specialpagealiases){const s=i.realname;e.set(s,s);const o=En.normalizeSpecialPageName(s);r.set(o,s);for(const a of i.aliases){n.set(a,s);const l=En.normalizeSpecialPageName(a);r.set(l,s)}}return{byRealName:e,byAlias:n,byNormalized:r}},findSpecialPageRealName:(t,e)=>{const n=t.split("/")[0];let r=e.byRealName.get(n)??e.byAlias.get(n);if(r!==void 0)return r;const i=En.normalizeSpecialPageName(n);return e.byNormalized.get(i)??null}},xt={normalizeNamespaceText:t=>t.replace(/[_\s]+/g,"_").toLowerCase().replace(/^_+|_+$/g,""),buildIndex:t=>{const e=new Map,n=new Map,r=new Map,i=new Map;for(const[s,o]of Object.entries(t.namespaces)){const a=parseInt(s);e.set(o.name,a),n.set(o.canonical??"",a);const l=xt.normalizeNamespaceText(o.name),u=xt.normalizeNamespaceText(o.canonical??"");i.set(l,a),i.set(u,a)}for(const s of t.namespacealiases){r.set(s.alias,s.id);const o=xt.normalizeNamespaceText(s.alias);i.set(o,s.id)}return{byName:e,byCanonical:n,byAlias:r,byNormalized:i}},findNamespaceId:(t,e)=>{let n=e.byName.get(t)??e.byCanonical.get(t)??e.byAlias.get(t);if(n!==void 0)return n;const r=xt.normalizeNamespaceText(t);return e.byNormalized.get(r)??null},isTalkPage:t=>t%2===1&&t>0,getDefaultNamespaceInfo:t=>({id:t,name:"",canonical:"",case:"first-letter",content:!1,nonincludable:!1,subpages:!1})};function fh(t){const e=Va.get(t);if(e)return e;const n=xt.buildIndex(t),r=En.buildSpecialPageIndex(t),s=class s{constructor(a,l){this.newTitle=s.create.bind(s),this.toText=this.getPrefixedText.bind(this),this.toString=this.getPrefixedDBKey.bind(this),this._title=a||"",this._ns=l??0,l===void 0&&this.fixNSByTitle()}static create(a,l){return new s(a,l)}fixNSByTitle(){const a=this._title.indexOf(":");if(a===-1)return;if(a===0){this._title=this._title.substring(1);return}const l=this._title.substring(0,a),u=this._title.substring(a+1),c=xt.findNamespaceId(l,s._namespaceIndex);c!==null&&(this._title=u,this._ns=c)}getNamespaceInfo(){return s._meta.namespaces[this._ns]??xt.getDefaultNamespaceInfo(this._ns)}getMainDBKey(){const a=this.getNamespaceInfo();if(this._ns===-1){const l=En.findSpecialPageRealName(this._title,s._specialPageIndex);if(l){const u=this._title.includes("/")?this._title.substring(this._title.indexOf("/")):"",c=l+u;return _t.ensureCase(_t.toDBKey(c),a.case)}}return _t.ensureCase(_t.toDBKey(this._title),a.case)}getMainText(){const a=this.getNamespaceInfo();if(this._ns===-1){const l=En.findSpecialPageRealName(this._title,s._specialPageIndex);if(l){const u=this._title.includes("/")?this._title.substring(this._title.indexOf("/")):"",c=l+u;return _t.ensureCase(_t.toNormalText(c),a.case)}}return _t.ensureCase(_t.toNormalText(this._title),a.case)}getMainRootText(){return this.getMainText().split("/")[0]}getPrefixedDBKey(){return this._ns===0?this.getMainDBKey():`${this.getNamespaceDBKey()}:${this.getMainDBKey()}`}getPrefixedText(){return this._ns===0?this.getMainText():`${this.getNamespaceText()}:${this.getMainText()}`}getNamespaceId(){return this._ns}getNamespaceText(){return this.getNamespaceInfo().name??""}getNamespaceDBKey(){const a=this.getNamespaceInfo();return _t.ensureCase(_t.toDBKey(this.getNamespaceText()),a.case)}getSubjectPage(){if(xt.isTalkPage(this._ns)){const a=this._ns-1;return new s(this._title,a)}return this}getTalkPage(){if(xt.isTalkPage(this._ns))return this;if(this._ns<0)return null;const a=this._ns+1;return s._meta.namespaces[a.toString()]?new s(this._title,a):null}getURL(a){const l=s._meta.general.articlepath,u=this.getPrefixedDBKey(),c=l.replace("$1",u),f=new URL(c,s._meta.general.base);return a&&(a instanceof URLSearchParams?a:new URLSearchParams(a)).forEach((v,b)=>{f.searchParams.set(b,v)}),f}setTitle(a){return this._title=a,this._ns=0,this.fixNSByTitle(),this}setMainText(a){return this._title=a,this}setNamespaceText(a){const l=xt.findNamespaceId(a,s._namespaceIndex);return l!==null&&(this._ns=l),this}setNamespaceId(a){return this._ns=a,this}equals(a){return typeof a=="string"&&(a=new s(a)),this.getPrefixedDBKey()===a.getPrefixedDBKey()}isSpecial(a){if(this._ns!==-1)return!1;const l=new s(a,-1);return this.getMainRootText()===l.getMainRootText()}};s._meta=t,s._namespaceIndex=n,s._specialPageIndex=r;let i=s;return Va.set(t,i),i}const Jo=class Jo extends an{constructor(e){super(e,"wikiTitle",!0),this.ctx=e,this.WikiTitle=fh(this.ctx.sitemeta._raw)}create(e,n){return new this.WikiTitle(e,n)}};Jo.inject=["sitemeta"];let $s=Jo;var Cs=(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-next",t.HOME_URL="https://www.ipe.wiki/",t.UPDATE_LOGS_URL="https://www.ipe.wiki/changelogs/",t))(Cs||{});/**
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 $r=class $r extends Je{constructor(n){super();Go(this,At);this.version="0.5.4",this.Endpoints=vs,this.schema=Se,this.config={...$r.DEFAULT_CONFIG,...n},this.logger=fa({name:"IPE",color:"#33aaff",level:this.config.logLevel}),Ir(this,At,lf).call(this),Ir(this,At,uf).call(this),Ir(this,At,ff).call(this)}async useScope(n){const{promise:r,resolve:i}=ye();return this.inject(n,s=>{i(s)}),r}};At=new WeakSet,lf=async function(){this.plugin(sd,{baseURL:this.config.baseURL}),this.plugin(od),this.plugin(zd),this.plugin(ud),this.plugin(qr),this.plugin(us),Ir(this,At,cf).call(this,["api","resourceLoader","modal","storage","wikiPage"])},cf=function(n){if(typeof n=="string"&&(n=[n]),!Array.isArray(n)||n.length===0)return this;for(const r of n){const i=this[$r.internal][r];i?.type==="service"&&(i.builtin=!0)}return this},uf=async function(){[Promise.resolve().then(()=>ch).then(({PluginPreferences:r})=>r),Promise.resolve().then(()=>Dh).then(({PluginQuickEdit:r})=>r),Promise.resolve().then(()=>Wh).then(({PluginQuickMove:r})=>r),Promise.resolve().then(()=>np).then(({PluginQuickPreview:r})=>r),Promise.resolve().then(()=>Wp).then(({PluginQuickDiff:r})=>r),Promise.resolve().then(()=>Vp).then(({PluginQuickRedirect:r})=>r),Promise.resolve().then(()=>rm).then(({PluginToolbox:r})=>r)].forEach(async r=>{this.plugin(await r)})},ff=async function(){this.inject(["resourceLoader"],n=>{})},$r.DEFAULT_CONFIG={baseURL:"",legacyPreferences:{},logLevel:ns.info};let on=$r;function Wd(t){return t.charAt(0).toLowerCase()+t.slice(1)}function Vd(t){return Wd(t).replace(/-/g,"_").replace(/.[A-Z]+/g,e=>e[0]+"_"+e.slice(1).toLowerCase())}const Ui=class Ui{constructor(e,n=void 0,r){Go(this,kr);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.debug("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){of(this,kr,Vd(e).toUpperCase())}get name(){return sf(this,kr)}get logger(){return this.ctx.logger(this.name)}};kr=new WeakMap,Ui.inject=[],Ui.reusable=!1;let ct=Ui;window.RLQ||(window.RLQ=[]),window.__IPE_MODULES__||(window.__IPE_MODULES__=[]),Yd("InPageEdit#autoload",()=>{window.RLQ.push(Kd)});async function Kd(){typeof window?.ipe?.stop=="function"&&await window.ipe.stop();const t=window.InPageEdit||{},e=new on({baseURL:window.mw?.util.wikiScript("api"),legacyPreferences:t?.myPreferences||{}});if(window.InPageEdit=on,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(`${vs.HOME_URL}
61
+ */const Ar=class Ar extends Qe{constructor(n){super({name:"InPageEdit"});aa(this,Tt);this.version="0.7.0",this.Endpoints=Cs,this.schema=_e,this.config={...Ar.DEFAULT_CONFIG,...n},this.logger=Sa({name:"IPE",color:"#33aaff",level:this.config.logLevel}),Mr(this,Tt,Pf).call(this),Mr(this,Tt,If).call(this),Mr(this,Tt,Af).call(this)}async useScope(n){const{promise:r,resolve:i}=ve();return this.inject(n,s=>{i(s)}),r}};Tt=new WeakSet,Pf=async function(){this.plugin(kd,this.config.apiConfigs),this.plugin($d),this.plugin(Qd),this.plugin(uh),this.plugin(Qr),this.plugin(ks),this.plugin($s),Mr(this,Tt,Of).call(this,["api","resourceLoader","modal","storage","wikiPage","wikiTitle","sitemeta","getUrl","getSciprtUrl","getMainpageUrl"])},Of=function(n){if(typeof n=="string"&&(n=[n]),!Array.isArray(n)||n.length===0)return this;for(const r of n){const i=this[Ar.internal][r];i?.type==="service"&&(i.builtin=!0)}return this},If=async function(){[Promise.resolve().then(()=>$h).then(({PluginInArticleLinks:r})=>r),Promise.resolve().then(()=>Uh).then(({PluginPreferences:r})=>r),Promise.resolve().then(()=>tp).then(({PluginQuickEdit:r})=>r),Promise.resolve().then(()=>dp).then(({PluginQuickDelete:r})=>r),Promise.resolve().then(()=>Sp).then(({PluginQuickMove:r})=>r),Promise.resolve().then(()=>Np).then(({PluginQuickPreview:r})=>r),Promise.resolve().then(()=>Em).then(({PluginQuickDiff:r})=>r),Promise.resolve().then(()=>km).then(({PluginQuickRedirect:r})=>r),Promise.resolve().then(()=>Lm).then(({PluginToolbox:r})=>r)].forEach(async r=>{this.plugin(await r)})},Af=async function(){this.inject(["resourceLoader"],n=>{})},Ar.DEFAULT_CONFIG={apiConfigs:{},legacyPreferences:{},logLevel:us.info,autoloadStyles:!0};let un=Ar;function dh(t){return t.charAt(0).toLowerCase()+t.slice(1)}function hh(t){return dh(t).replace(/-/g,"_").replace(/.[A-Z]+/g,e=>e[0]+"_"+e.slice(1).toLowerCase())}const Gi=class Gi{constructor(e,n=void 0,r){aa(this,Tr);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.debug("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){$f(this,Tr,hh(e).toUpperCase())}get name(){return kf(this,Tr)}get logger(){return this.ctx.logger(this.name)}};Tr=new WeakMap,Gi.inject=[],Gi.reusable=!1;let rt=Gi;window.RLQ||(window.RLQ=[]),window.__IPE_MODULES__||(window.__IPE_MODULES__=[]),mh("InPageEdit#autoload",()=>{window.RLQ.push(ph)});async function ph(){typeof window?.ipe?.stop=="function"&&await window.ipe.stop();const t=window.InPageEdit||{},e=new un({apiConfigs:{baseURL:window.mw?.util.wikiScript("api")},legacyPreferences:t?.myPreferences||{}});if(window.InPageEdit=un,window.ipe=e,await e.start(),typeof window?.mw?.hook=="function"&&window.mw.hook("InPageEdit.ready").fire(e),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(`${Cs.HOME_URL}
62
62
  ____ ____ ______ ___ __
63
63
  / _/___ / __ \\____ _____ ____ / ____/___/ (_) /_
64
64
  / // __ \\/ /_/ / __ \`/ __ \`/ _ \\/ __/ / __ / / __/
65
65
  _/ // / / / ____/ /_/ / /_/ / __/ /___/ /_/ / / /_
66
66
  /___/_/ /_/_/ \\__,_/\\__, /\\___/_____/\\__,_/_/\\__/
67
- /____/ v`+e.version)}function Yd(t,e){const n=Symbol.for(t);return window[n]?!1:(window[n]=!0,e(),!0)}const Gd=t=>typeof t=="function";async function Jd(t){return Gd(t)?await t():t}const Qd=window?.location?.origin,Xd=({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(Qd)&&(r="_blank"),Nd(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 Zd=Object.create,bs=Object.defineProperty,eh=Object.getOwnPropertyDescriptor,Ta=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Ra=t=>{throw TypeError(t)},th=(t,e,n)=>e in t?bs(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,nh=(t,e)=>bs(t,"name",{value:e,configurable:!0}),rh=t=>[,,,Zd(t?.[Ta("metadata")]??null)],ih=["class","method","getter","setter","accessor","field","value","get","set"],Da=t=>t!==void 0&&typeof t!="function"?Ra("Function expected"):t,sh=(t,e,n,r,i)=>({kind:ih[t],name:e,metadata:r,addInitializer:s=>n._?Ra("Already initialized"):i.push(Da(s||null))}),oh=(t,e)=>th(e,Ta("metadata"),t[3]),ah=(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},lh=(t,e,n,r,i,s)=>{var o,a,l,u=e&7,c=!1,f=0,y=t[f]||(t[f]=[]),v=u&&(i=i.prototype,u<5&&(u>3||!c)&&eh(i,n));nh(i,n);for(var b=r.length-1;b>=0;b--)l=sh(u,n,a={},t[3],y),o=(0,r[b])(i,l),a._=1,Da(o)&&(i=o);return oh(t,i),v&&bs(i,n,v),c?u^4?s:v:i},La,_s,Na;La=[Ge(["sitemeta","storage"])];class Yr extends(Na=ct){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(x("div",{className:"prose",children:[x("h2",{children:"✏️ InPageEdit NEXT"}),x("i",{children:["v",this.ctx.version]}),x("h2",{children:"Portals"}),x("div",{style:"display: flex; flex-direction: column; gap: 1rem",children:[x("a",{href:this.ctx.Endpoints.HOME_URL,target:"_blank",style:{display:"block",width:"100%"},children:"Official Website & Help Center"}),x(Xd,{href:`${this.ctx.Endpoints.UPDATE_LOGS_URL}#${this.ctx.version}`,style:{display:"block",width:"100%"},children:"Update Logs"})]}),x("h2",{children:"Join us"}),x("ul",{children:[x("li",{children:[x("strong",{children:"GitHub"}),":"," ",x("a",{href:this.ctx.Endpoints.GITHUB_URL,target:"_blank",children:"inpageedit/inpageedit-next"})]}),x("li",{children:[x("strong",{children:"QQ Group"}),": 1026023666"]})]}),x("hr",{}),x("p",{children:"🚀 Modular, Extensible Supercharged Plugin for MediaWiki."}),x("p",{children:"InPageEdit-NEXT Copyright © 2025-present dragon-fish"})]})).role("raw-html")}).description(""),"about",{}),Promise.resolve().then(()=>Xy).then(e=>{const n=this.ctx.plugin(e.PluginPreferencesUI);this.addDisposeHandler(()=>{n.dispose()})})}async get(e,n){n??(n=()=>{const i=this.getDefaultValue(e);return this.logger.debug(e,`(fallback value: ${i})`),i});const r=await this.db.get(e,void 0);return r!==null?r:await Jd(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=>{try{const r=n.schema({});Object.entries(r).forEach(([i,s])=>{e[i]=s})}catch{}n.defaults&&Object.entries(n.defaults).forEach(([r,i])=>{e[r]=i})}),Object.entries(e).forEach(([n,r])=>{this._defaultPreferences[n]=r}),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=rh(Na),Yr=lh(_s,0,"PluginPreferences",La,Yr),ah(_s,1,Yr);const ch=Object.freeze(Object.defineProperty({__proto__:null,get PluginPreferences(){return Yr}},Symbol.toStringTag,{value:"Module"}));function Gr(t,e){return function(n){return n.PreferencesSchema=t,n.PreferencesDefaults=e,n}}var uh=Object.create,ws=Object.defineProperty,fh=Object.getOwnPropertyDescriptor,Ma=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),ja=t=>{throw TypeError(t)},dh=(t,e,n)=>e in t?ws(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,hh=(t,e)=>ws(t,"name",{value:e,configurable:!0}),ph=t=>[,,,uh(t?.[Ma("metadata")]??null)],mh=["class","method","getter","setter","accessor","field","value","get","set"],Fa=t=>t!==void 0&&typeof t!="function"?ja("Function expected"):t,gh=(t,e,n,r,i)=>({kind:mh[t],name:e,metadata:r,addInitializer:s=>n._?ja("Already initialized"):i.push(Fa(s||null))}),yh=(t,e)=>dh(e,Ma("metadata"),t[3]),vh=(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},bh=(t,e,n,r,i,s)=>{var o,a,l,u=e&7,c=!1,f=0,y=t[f]||(t[f]=[]),v=u&&(i=i.prototype,u<5&&(u>3||!c)&&fh(i,n));hh(i,n);for(var b=r.length-1;b>=0;b--)l=gh(u,n,a={},t[3],y),o=(0,r[b])(i,l),a._=1,Fa(o)&&(i=o);return yh(t,i),v&&ws(i,n,v),c?u^4?s:v:i},Ba,xs,Ua;Ba=[Ge(["sitemeta","quickEdit"]),Gr(Se.object({redLinkEdit:Se.boolean().description("Show quick edit entry after red links").default(!0)}).description("In-article quick edit links"),{redLinkEdit:!0})];class Jr extends(Ua=ct){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(e=>{e.find("a[href]").toArray().forEach(r=>{const i=this.checkEditAnchor(r);if(!i||r.dataset.ipeQuickEditLink)return;const s=x("a",{href:`#/IPE/quickEdit/${i.title}`,className:this.config.linkClassName,style:{userSelect:"none",marginLeft:"0.2em",verticalAlign:"middle"},onClick:o=>{o.preventDefault(),this.ctx.quickEdit.showModal(i)},children:x("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:[x("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),x("path",{d:"M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4"}),x("path",{d:"M13.5 6.5l4 4"}),x("path",{d:"M19 16l-2 3h4l-2 3"})]})});r.insertAdjacentElement("afterend",s),r.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")}}}xs=ph(Ua),Jr=bh(xs,0,"PluginQuickEditInArticleLinks",Ba,Jr),vh(xs,1,Jr);const _h=Symbol("@@apply"),wh=Symbol("@@ctor");function xh(t,e){if(typeof t!="object"||t===null||Array.isArray(t))throw new TypeError("instance is not an object");const n=(...s)=>{const o=t[e];if(typeof o!="function")throw new TypeError(`Property "${String(e)}" is not a function`);return o.apply(t,s)};n[_h]=n,n[wh]=t;const r=t?.constructor?.name;return r&&(n[Symbol.toStringTag]=r),new Proxy(n,{get(s,o,a){return o==="prototype"?Reflect.get(n,o,a):Reflect.get(t,o,t)},set(s,o,a){return Reflect.set(t,o,a)},has(s,o){return Reflect.has(t,o)},deleteProperty(s,o){return Reflect.deleteProperty(t,o)},ownKeys(){return Reflect.ownKeys(t)},getOwnPropertyDescriptor(s,o){return Object.getOwnPropertyDescriptor(t,o)},defineProperty(s,o,a){return Object.defineProperty(t,o,a)}})}const Qr={mbox:"_mbox_5x43w_1",title:"_title_5x43w_12",content:"_content_5x43w_19",close:"_close_5x43w_27"},Ss=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:y,resolve:v}=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(),v()}),y},f=x("div",{className:`theme-ipe ipe-mbox mbox-type-${e||"default"} ${Qr.mbox}`,...l,children:[u&&x("div",{className:`ipe-mbox-title ${Qr.title}`,...s,children:u}),x("div",{className:`ipe-mbox-content ${Qr.content}`,...o,children:a||r}),i&&x("a",{onClick:c,className:`ipe-mbox-close ${Qr.close}`,children:"×"})]});return f.close=c,f},Es=t=>{const{label:e,id:n,name:r,value:i,disabled:s,labelProps:o,inputProps:a,...l}=t;return x("div",{className:"theme-ipe ipe-input-box",...l,children:[x("label",{htmlFor:n,style:{display:"block"},...o,children:e}),x("input",{id:n,name:r,value:i,disabled:s,style:{width:"100%"},...a})]})},Ha=t=>{const{id:e,name:n,value:r,label:i,inputProps:s,labelProps:o,children:a,...l}=t;return x("label",{className:"theme-ipe ipe-radio-box",...l,children:[x("input",{type:"radio",id:e,name:n,value:r,...s}),x("span",{className:"ipe-checkbox-box"}),x("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 x("label",{className:"theme-ipe ipe-checkbox",...l,children:[x("input",{type:"checkbox",id:e,name:n,checked:i,...s}),x("span",{className:"ipe-checkbox-box"}),x("span",{...o,children:r||a})]})},qa=()=>{},Sh=(t=0)=>new Promise(e=>setTimeout(e,t));var Eh=Object.create,$s=Object.defineProperty,$h=Object.getOwnPropertyDescriptor,za=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Wa=t=>{throw TypeError(t)},kh=(t,e,n)=>e in t?$s(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Ch=(t,e)=>$s(t,"name",{value:e,configurable:!0}),Oh=t=>[,,,Eh(t?.[za("metadata")]??null)],Ph=["class","method","getter","setter","accessor","field","value","get","set"],Va=t=>t!==void 0&&typeof t!="function"?Wa("Function expected"):t,Ah=(t,e,n,r,i)=>({kind:Ph[t],name:e,metadata:r,addInitializer:s=>n._?Wa("Already initialized"):i.push(Va(s||null))}),Ih=(t,e)=>kh(e,za("metadata"),t[3]),Th=(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},Rh=(t,e,n,r,i,s)=>{var o,a,l,u=e&7,c=!1,f=0,y=t[f]||(t[f]=[]),v=u&&(i=i.prototype,u<5&&(u>3||!c)&&$h(i,n));Ch(i,n);for(var b=r.length-1;b>=0;b--)l=Ah(u,n,a={},t[3],y),o=(0,r[b])(i,l),a._=1,Va(o)&&(i=o);return Ih(t,i),v&&$s(i,n,v),c?u^4?s:v:i},Ka,ks,Ya;Ka=[Ge(["api","wikiPage","modal","preferences"]),Gr(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(mt.preferences).description("Follow my preferences"),Se.const(mt.nochange).description("Keep the current watchlist status"),Se.const(mt.watch).description("Add the page to watchlist"),Se.const(mt.unwatch).description("Remove the page from watchlist")]).description("Watchlist options").default(mt.preferences)}).description("Quick edit options").extra("category","edit"))];class Xr extends(Ya=ct){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},this.ctx.root.set("quickEdit",xh(this,"showModal"))}start(){this.ctx.inject(["toolbox"],e=>{this.injectToolbox(e),e.on("dispose",()=>{this.removeToolbox(e)})}),this.ctx.plugin(Jr)}async showModal(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("quick-edit/init-options",{ctx:this.ctx,options:o});const a=this.ctx.modal.createObject({className:"ipe-quickEdit",sizeClass:"large",center:!1,outSideClose:n}).init();a.setTitle(x(bn,{children:["Loading: ",x("u",{children:o.title})]})),a.setContent(x("section",{className:"ipe-quickEdit-loading",style:{height:"70vh",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"},children:x(sn,{})})),a.addButton({side:"right",type:"button",className:"is-danger is-ghost",label:"Cancel",method(){a.close()}}),a.show(),this.ctx.emit("quick-edit/show-modal",{ctx:this.ctx,modal:a,options:o});let l;try{if(l=await this.getWikiPageFromPayload(o),l.pageInfo.special)throw new Error("Special page is not editable")}catch(y){a.off(a.Event.Close),a.close(),this.ctx.modal.notify("error",{content:y instanceof Error?y.message:String(y)});return}a.setTitle(x(bn,{children:["Quick ",l.pageInfo.pageid===0?"Create":"Edit",":"," ",x("u",{children:l.pageInfo.title})]}));const u=[];l.pageInfo.pageid===0&&u.push(x(Ss,{title:"Attention",type:"important",children:x("p",{children:"This page does not exist."})})),l.pageInfo.pageid&&l.pageInfo.lastrevid!==l.revisions[0]?.revid&&u.push(x(Ss,{title:"Attention",type:"warning",children:x("p",{children:"You are editing a revision that is not the latest."})})),this.ctx.emit("quick-edit/edit-notice",{ctx:this.ctx,options:o,modal:a,wikiPage:l,editNotices:u});const c=x("form",{className:"ipe-quickEdit__form",children:[x("div",{className:"ipe-quickEdit__notices",children:u}),x("div",{className:"ipe-quickEdit__content",children:x("textarea",{className:"ipe-quickEdit__textarea",name:"text",id:"wpTextbox1",children:l.revisions[0]?.content||""})}),x("div",{class:"ipe-quickEdit__options",style:{display:"flex",flexDirection:"column",gap:"1rem",marginTop:"1rem"},children:[x(Es,{label:"Summary",id:"summary",name:"summary",value:o.editSummary}),x("div",{className:"ipe-input-box",children:[x("label",{htmlFor:"watchlist",style:{display:"block"},children:"Watchlist"}),x("div",{style:{display:"flex",gap:"1rem"},children:[mt.preferences,mt.nochange,mt.watch,mt.unwatch].map(y=>x(Ha,{name:"watchlist",value:y,inputProps:{checked:r===y},children:y},y))})]}),x("div",{style:{display:"flex",gap:"1rem"},children:[x(wn,{name:"minor",id:"minor",checked:o.editMinor,children:"Minor edit"}),x(wn,{name:"reloadAfterSave",id:"reloadAfterSave",checked:o.reloadAfterSave,children:"Reload after save"})]})]}),!1]});a.setContent(c),a.addButton({side:"left",className:"is-primary submit-btn",label:"Submit",method:()=>{const y=new FormData(c);a.setLoadingState(!0),this.handleSubmit({wikiPage:l,text:y.get("text"),summary:y.get("summary"),minor:y.get("minor")==="on",section:o.section,createonly:l.pageid===0,watchlist:r}).then(async()=>{a.setOptions({beforeClose:qa}),a.close(),this.ctx.modal.notify("success",{title:"Submission Successful",content:"Your changes have been saved."}),y.get("reloadAfterSave")&&(await Sh(500),location.reload())}).catch(v=>{this.ctx.modal.notify("error",{title:"Submission Error",content:v instanceof Error?v.message:String(v)}),a.setLoadingState(!1)})}},0),a.setOptions({beforeClose:()=>{const y=l.revisions[0]?.content||"";return(c.querySelector("textarea")?.value||"")===y?!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 Editing",className:"is-primary is-ghost"}},b=>(b&&(a.setOptions({beforeClose:qa}),a.close()),!0)),!1)}}),this.ctx.emit("quick-edit/wiki-page",{ctx:this.ctx,options:o,modal:a,wikiPage:l});const f=y=>c.querySelector("textarea")?.value===l.revisions[0]?.content?!0:(y.preventDefault(),"You have unsaved changes. Are you sure you want to leave?");window.addEventListener("beforeunload",f),a.on(a.Event.Close,()=>{window.removeEventListener("beforeunload",f)})}async handleSubmit(e){const n=e.wikiPage,r=e.summary||"",i=e.text||"",s=e.minor,o=e.createonly,a=e.watchlist,l=e.section;return n.edit({summary:r,text:i,watchlist:a,section:l},{minor:s,createonly:o})}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")}injectToolbox(e){e.toolbox.addButton({id:"quick-edit",group:"group1",index:0,icon:x("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:[x("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),x("path",{d:"M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1"}),x("path",{d:"M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415z"}),x("path",{d:"M16 5l3 3"})]}),tooltip:"Edit this page quickly",onClick:()=>this.showModal({revision:mw.config.get("wgRevisionId")})})}removeToolbox(e){e.toolbox.removeButton("quick-edit")}}ks=Oh(Ya),Xr=Rh(ks,0,"PluginQuickEdit",Ka,Xr),Th(ks,1,Xr);const Dh=Object.freeze(Object.defineProperty({__proto__:null,get PluginQuickEdit(){return Xr}},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"},Ga=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(b=>b&&b.disabled),c=()=>{if(!s[0]||!s[1]||u())return;const b=s[0],A=s[1],U=b.value,L=A.value;b.value=L,A.value=U,b.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=b=>{if(!a)return;const A=b??!a.disabled;a.disabled=!A,A&&s.forEach(U=>{U&&(U.disabled=!1)})},y=x("button",{type:"button","aria-label":"Swap values",onClick:c,disabled:u()||!n,ref:b=>a=b,children:x("svg",{ref:b=>l=b,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:[x("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),x("path",{d:"M20 10h-16l5.5 -6"}),x("path",{d:"M4 14h16l-5.5 6"})]})}),v=x("div",{className:`twin-swap-input ${er.twinSwapInput}`,...r,children:[i.map((b,A)=>{const{label:U,id:L,name:I,value:g,disabled:p,required:h,inputProps:S}=b,P=A===0,R=L||I;return x("div",{className:`${er.inputWrapper} ${P?er.inputLeft:er.inputRight}`,children:[U&&x("label",{htmlFor:R,children:U}),x("input",{ref:z=>s[A]=z,type:"text",id:R,name:I,value:g,disabled:p,required:h,...S})]})}),x("div",{className:er.swapButton,children:y})]});return v.swap=c,v.toggleEnableSwap=f,v};var Lh=Object.create,Cs=Object.defineProperty,Nh=Object.getOwnPropertyDescriptor,Ja=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Qa=t=>{throw TypeError(t)},Mh=(t,e,n)=>e in t?Cs(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,jh=(t,e)=>Cs(t,"name",{value:e,configurable:!0}),Fh=t=>[,,,Lh(t?.[Ja("metadata")]??null)],Bh=["class","method","getter","setter","accessor","field","value","get","set"],Xa=t=>t!==void 0&&typeof t!="function"?Qa("Function expected"):t,Uh=(t,e,n,r,i)=>({kind:Bh[t],name:e,metadata:r,addInitializer:s=>n._?Qa("Already initialized"):i.push(Xa(s||null))}),Hh=(t,e)=>Mh(e,Ja("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},zh=(t,e,n,r,i,s)=>{var o,a,l,u=e&7,c=!1,f=0,y=t[f]||(t[f]=[]),v=u&&(i=i.prototype,u<5&&(u>3||!c)&&Nh(i,n));jh(i,n);for(var b=r.length-1;b>=0;b--)l=Uh(u,n,a={},t[3],y),o=(0,r[b])(i,l),a._=1,Xa(o)&&(i=o);return Hh(t,i),v&&Cs(i,n,v),c?u^4?s:v:i},Za,Os,el;Za=[Ge(["modal","sitemeta"])];class Zr extends(el=ct){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:x("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:[x("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),x("path",{d:"M12 3a3 3 0 0 0 -3 3v12a3 3 0 0 0 3 3"}),x("path",{d:"M6 3a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3"}),x("path",{d:"M13 7h7a1 1 0 0 1 1 1v8a1 1 0 0 1 -1 1h-7"}),x("path",{d:"M5 7h-1a1 1 0 0 0 -1 1v8a1 1 0 0 0 1 1h1"}),x("path",{d:"M17 12h.01"}),x("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:x(sn,{}),className:"quick-move compact-buttons",sizeClass:"smallToMedium",center:!0}).init();let r=null;return n.setContent(x("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:[x(Ga,{inputs:[{label:"Move from",name:"from",value:e?.from,required:!0},{label:"Move to",name:"to",value:e?.to,required:!0}]}),x("div",{children:x(wn,{name:"movetalk",id:"movetalk",checked:e?.movetalk,children:"Move talk page"})}),x("div",{children:x(wn,{name:"movesubpages",id:"movesubpages",checked:e?.movesubpages,children:"Move subpage(s) (up to 100)"})}),this.ctx.sitemeta.hasRight("suppressredirect")&&x("div",{children:x(wn,{name:"noredirect",id:"noredirect",checked:e?.noredirect,children:"Move without leaving a redirect"})}),x(Es,{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)}}Os=Fh(el),Zr=zh(Os,0,"PluginQuickMove",Za,Zr),qh(Os,1,Zr);const Wh=Object.freeze(Object.defineProperty({__proto__:null,get PluginQuickMove(){return Zr}},Symbol.toStringTag,{value:"Module"}));var Vh=Object.create,Ps=Object.defineProperty,Kh=Object.getOwnPropertyDescriptor,tl=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),nl=t=>{throw TypeError(t)},Yh=(t,e,n)=>e in t?Ps(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Gh=(t,e)=>Ps(t,"name",{value:e,configurable:!0}),Jh=t=>[,,,Vh(t?.[tl("metadata")]??null)],Qh=["class","method","getter","setter","accessor","field","value","get","set"],rl=t=>t!==void 0&&typeof t!="function"?nl("Function expected"):t,Xh=(t,e,n,r,i)=>({kind:Qh[t],name:e,metadata:r,addInitializer:s=>n._?nl("Already initialized"):i.push(rl(s||null))}),Zh=(t,e)=>Yh(e,tl("metadata"),t[3]),ep=(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},tp=(t,e,n,r,i,s)=>{var o,a,l,u=e&7,c=!1,f=0,y=t[f]||(t[f]=[]),v=u&&(i=i.prototype,u<5&&(u>3||!c)&&Kh(i,n));Gh(i,n);for(var b=r.length-1;b>=0;b--)l=Xh(u,n,a={},t[3],y),o=(0,r[b])(i,l),a._=1,rl(o)&&(i=o);return Zh(t,i),v&&Ps(i,n,v),c?u^4?s:v:i},il,As,sl;il=[Ge(["api","wikiPage","modal"])];class ei extends(sl=ct){constructor(e){super(e,{},"quickPreview"),this.ctx=e}start(){this.ctx.set("quickPreview",this.quickPreview.bind(this)),this.ctx.on("quick-edit/wiki-page",this.injectQuickEdit.bind(this))}stop(){this.ctx.off("quick-edit/wiki-page",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(x(sn,{})),i.bringToFront(),this.ctx.emit("quick-preview/show-modal",{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(x("section",{children:x("div",{ref:l=>a=l,className:"mw-parser-output",innerHTML:o.text})})),window.mw?.hook("wikipage.content").fire($(a)),this.ctx.emit("quick-preview/loaded",{ctx:this.ctx,modal:i,wikiPage:r,text:e,parseData:o})}).catch(s=>{i.setTitle("Preview - Failed"),i.setContent(x(bn,{children:[x("p",{children:"Failed to preview"}),x("p",{children:s instanceof Error?s.message:String(s)})]}))}),i}}As=Jh(sl),ei=tp(As,0,"PluginQuickPreview",il,ei),ep(As,1,ei);const np=Object.freeze(Object.defineProperty({__proto__:null,get PluginQuickPreview(){return ei}},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,y=Date.now()+f,v=[{oldPos:-1,lastComponent:void 0}];let b=this.extractCommon(v[0],n,e,0,r);if(v[0].oldPos+1>=l&&b+1>=a)return o(this.buildValues(v[0].lastComponent,n,e));let A=-1/0,U=1/0;const L=()=>{for(let I=Math.max(A,-u);I<=Math.min(U,u);I+=2){let g;const p=v[I-1],h=v[I+1];p&&(v[I-1]=void 0);let S=!1;if(h){const R=h.oldPos-I;S=h&&0<=R&&R<a}const P=p&&p.oldPos+1<l;if(!S&&!P){v[I]=void 0;continue}if(!P||S&&p.oldPos<h.oldPos?g=this.addToPath(h,!0,!1,0,r):g=this.addToPath(p,!1,!0,1,r),b=this.extractCommon(g,n,e,I,r),g.oldPos+1>=l&&b+1>=a)return o(this.buildValues(g.lastComponent,n,e))||!0;v[I]=g,g.oldPos+1>=l&&(U=Math.min(U,I-1)),b+1>=a&&(A=Math.max(A,I+1))}u++};if(i)(function I(){setTimeout(function(){if(u>c||Date.now()>y)return i(void 0);L()||I()},0)})();else for(;u<=c&&Date.now()<=y;){const I=L();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(y,v){const b=r[u+v];return b.length>y.length?b:y}),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 rp extends Rt{}const ol=new rp;function al(t,e,n){return ol.diff(t,e,n)}function ll(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 cl(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 Is(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 Ts(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 Is(t,e,"")}function ti(t,e){return Ts(t,e,"")}function ul(t,e){return e.slice(0,ip(t,e))}function ip(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 sp(t){return t.includes(`\r
67
+ /____/ v`+e.version)}function mh(t,e){const n=Symbol.for(t);return window[n]?!1:(window[n]=!0,e(),!0)}function ir(t,e){return function(n){return n.PreferencesSchema=t,n.PreferencesDefaults=e,n}}const Ka=t=>w("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-pencil-bolt",...t,children:[w("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),w("path",{d:"M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4"}),w("path",{d:"M13.5 6.5l4 4"}),w("path",{d:"M19 16l-2 3h4l-2 3"})]});var gh=Object.create,Ps=Object.defineProperty,vh=Object.getOwnPropertyDescriptor,Ya=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Ga=t=>{throw TypeError(t)},yh=(t,e,n)=>e in t?Ps(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,bh=(t,e)=>Ps(t,"name",{value:e,configurable:!0}),wh=t=>[,,,gh(t?.[Ya("metadata")]??null)],_h=["class","method","getter","setter","accessor","field","value","get","set"],Qa=t=>t!==void 0&&typeof t!="function"?Ga("Function expected"):t,xh=(t,e,n,r,i)=>({kind:_h[t],name:e,metadata:r,addInitializer:s=>n._?Ga("Already initialized"):i.push(Qa(s||null))}),Sh=(t,e)=>yh(e,Ya("metadata"),t[3]),Eh=(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},kh=(t,e,n,r,i,s)=>{var o,a,l,u=e&7,c=!1,f=0,y=t[f]||(t[f]=[]),v=u&&(i=i.prototype,u<5&&(u>3||!c)&&vh(i,n));bh(i,n);for(var b=r.length-1;b>=0;b--)l=xh(u,n,a={},t[3],y),o=(0,r[b])(i,l),a._=1,Qa(o)&&(i=o);return Sh(t,i),v&&Ps(i,n,v),c?u^4?s:v:i},Ja,Os,Xa;Ja=[ze(["sitemeta","wikiTitle","preferences"]),ir(_e.object({"inArticleLinks.enable":_e.boolean().description("Whether to enable in-article links").default(!0),"inArticleLinks.quickDiff.enable":_e.boolean().description("Whether to enable in-article links for quick diff").default(!0),"inArticleLinks.quickEdit.enable":_e.boolean().description("Whether to enable in-article links for quick edit").default(!0),"inArticleLinks.quickEdit.redlinks":_e.boolean().description("Whether to show quick edit button for redlinks").default(!0)}).description("In-article links preferences").extra("category","in-article-links"))];let ei=(yn=class extends(Xa=rt){constructor(e){super(e,{wikiBaseUrl:e.sitemeta.baseUrl,wikiArticlePath:e.sitemeta.articlePath.replace("$1",""),wikiArticleBaseUrl:e.sitemeta.articleBaseUrl.replace("$1",""),wikiScriptBaseUrl:e.sitemeta.scriptBaseUrl,linkClassName:"ipe__in-article-link"},"InArticleLinks"),this._cachedAnchorInfo=new WeakMap,this.ctx.set("inArticleLinks",this),this.ctx.preferences.defineCategory({label:"In Article Links",name:"in-article-links",description:"In-article links preferences",index:9})}async start(){await this.ctx.preferences.get("inArticleLinks.quickEdit.enable")&&this.handleQuickEdit(),await this.ctx.preferences.get("inArticleLinks.quickDiff.enable")&&this.handleQuickDiff()}async stop(){}isWikiLink(e){return e.startsWith(this.config.wikiArticleBaseUrl)||e.startsWith(this.config.wikiScriptBaseUrl+"/index.php")}validateHrefAttr(e){return typeof e!="string"?!1:!yn.REG_SKIPPED_HREF.test(e)}parseAnchor(e){if(!(e instanceof HTMLAnchorElement))return null;const n=this._cachedAnchorInfo.get(e);if(n)return n;const r=e.getAttribute("href")||"";if(!this.validateHrefAttr(r))return null;const i=e.href||"",s=this.parseLink(i);if(!s)return null;const o={$el:e,kind:e.closest('[typeof^="mw:File"]')?"mw:File":"normal",external:e.classList.contains("external")||!!r.startsWith("http"),redlink:e.classList.contains("new")||s.params.has("redlink"),...s};return this._cachedAnchorInfo.set(e,o),o}parseLink(e){if(!e||typeof e=="string"&&!this.validateHrefAttr(e))return null;const n=ja(e);if(!this.isWikiLink(n.toString()))return null;const r=n.searchParams,i=n.hash.replace("#",""),s=r.get("action")||"view",o=n.pathname.endsWith(".php")?r.get("title"):(()=>{try{return decodeURI(n.pathname.substring(this.config.wikiArticlePath.length))}catch(a){return this.logger.error("parseLink",n,a),null}})();return o?{url:n,params:r,hash:i,action:s,title:this.ctx.wikiTitle.create(o)}:null}scanAnchors(e){const n=e.querySelectorAll("a[href]");return Array.from(n).map(r=>this.parseAnchor(r)).filter(r=>r!==null)}async handleQuickEdit(){let e=!1;const n=await this.ctx.preferences.get("inArticleLinks.quickEdit.redlinks");this.ctx.inject(["quickEdit"],r=>{e=!0,r.on("dispose",()=>{e=!1}),window?.mw?.hook?.("wikipage.content").add(i=>{if(!e)return;this.scanAnchors(i.get(0)).filter(({action:o,title:a,redlink:l})=>(["edit","create"].includes(o)||a.isSpecial("edit"))&&(n||!l)).forEach(({$el:o,title:a,params:l})=>{if(o.dataset.ipeEditMounted)return;if(o.dataset.ipeEditMounted="1",l.has("preload")||l.has("redo"))return this.ctx.logger.debug(o,"Not compatible with quick edit");let c;if(a.getNamespaceId()===-1){const I=a.getMainDBKey().split("/").slice(1).join("/")||"";if(a.isSpecial("edit"))c=I;else if(a.isSpecial("talkpage")){const g=a.newTitle(I).getTalkPage();if(!g)return this.ctx.logger.debug(o,"Talk page not found.");c=g.getPrefixedDBKey()}else if(a.isSpecial("mypage"))c=a.newTitle(this.ctx.sitemeta.userInfo.name,2).getPrefixedDBKey()+(I?`/${I}`:"");else if(a.isSpecial("mytalk"))c=a.newTitle(this.ctx.sitemeta.userInfo.name,3).getPrefixedDBKey()+(I?`/${I}`:"");else return this.ctx.logger.debug(o,"Special page cannot be edited")}else c=a.getPrefixedDBKey();const f=l.get("section")?.replace(/^T-/,"")||void 0,y=l.get("oldid"),v=l.has("redlink");let b;f==="new"?b="new":f&&/^\d+$/.test(f)&&(b=parseInt(f,10));const A=y?parseInt(y,10):void 0,U={title:c,section:b,revision:A,createOnly:v},D=w("a",{href:"#ipe://quick-edit/",dataset:U,className:`${this.config.linkClassName} ipe-quick-edit ${v?"ipe-quick-edit--create-only":""}`,style:{userSelect:"none",marginLeft:"0.2em",verticalAlign:"middle"},onClick:I=>{I.preventDefault(),r.quickEdit.showModal(U)},children:w(Ka,{style:"width: 1em; height: 1em"})});o.insertAdjacentElement("afterend",D)})})})}handleQuickDiff(){let e=!1;const n=r=>["prev","next","cur"].includes(r);this.ctx.inject(["quickDiff"],r=>{e=!0,r.on("dispose",()=>{e=!1}),window?.mw?.hook?.("wikipage.content").add(i=>{if(!e)return;this.scanAnchors(i.get(0)).filter(({params:o,title:a})=>o.has("diff")||a.isSpecial("diff")).forEach(({$el:o,title:a,params:l})=>{if(o.dataset.ipeDiffMounted)return;o.dataset.ipeDiffMounted="1";let u,c;if(a.getNamespaceId()===-1?[,u,c]=a.getMainDBKey().split("/"):(u=l.get("diff"),c=l.get("oldid")),!u||!c)return;const f={};n(u)?(f.fromrev=parseInt(c),f.torelative=u):(f.fromrev=parseInt(c),f.torev=parseInt(u)),o.addEventListener("click",y=>{y.preventDefault(),r.quickDiff.comparePages(f)})})})})}},yn.REG_SKIPPED_HREF=/^(#|javascript:|vbscript:|file:)/i,yn);Os=wh(Xa),ei=kh(Os,0,"PluginInArticleLinks",Ja,ei),Eh(Os,1,ei);const $h=Object.freeze(Object.defineProperty({__proto__:null,PluginInArticleLinks:ei},Symbol.toStringTag,{value:"Module"})),Ch=t=>typeof t=="function";async function Ph(t){return Ch(t)?await t():t}const Oh=window?.location?.origin,Ih=({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(Oh)&&(r="_blank"),qd(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 Ah=Object.create,Is=Object.defineProperty,Th=Object.getOwnPropertyDescriptor,Za=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),el=t=>{throw TypeError(t)},Rh=(t,e,n)=>e in t?Is(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Nh=(t,e)=>Is(t,"name",{value:e,configurable:!0}),Dh=t=>[,,,Ah(t?.[Za("metadata")]??null)],Lh=["class","method","getter","setter","accessor","field","value","get","set"],tl=t=>t!==void 0&&typeof t!="function"?el("Function expected"):t,Mh=(t,e,n,r,i)=>({kind:Lh[t],name:e,metadata:r,addInitializer:s=>n._?el("Already initialized"):i.push(tl(s||null))}),jh=(t,e)=>Rh(e,Za("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},Fh=(t,e,n,r,i,s)=>{var o,a,l,u=e&7,c=!1,f=0,y=t[f]||(t[f]=[]),v=u&&(i=i.prototype,u<5&&(u>3||!c)&&Th(i,n));Nh(i,n);for(var b=r.length-1;b>=0;b--)l=Mh(u,n,a={},t[3],y),o=(0,r[b])(i,l),a._=1,tl(o)&&(i=o);return jh(t,i),v&&Is(i,n,v),c?u^4?s:v:i},nl,As,rl;nl=[ze(["storage"])];class ti extends(rl=rt){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",_e.object({about:_e.const(w("div",{className:"prose",children:[w("h2",{children:"✏️ InPageEdit NEXT"}),w("i",{children:["v",this.ctx.version]}),w("h2",{children:"Portals"}),w("div",{style:"display: flex; flex-direction: column; gap: 1rem",children:[w("a",{href:this.ctx.Endpoints.HOME_URL,target:"_blank",style:{display:"block",width:"100%"},children:"Official Website & Help Center"}),w(Ih,{href:`${this.ctx.Endpoints.UPDATE_LOGS_URL}#${this.ctx.version}`,style:{display:"block",width:"100%"},children:"Update Logs"})]}),w("h2",{children:"Join us"}),w("ul",{children:[w("li",{children:[w("strong",{children:"GitHub"}),":"," ",w("a",{href:this.ctx.Endpoints.GITHUB_URL,target:"_blank",children:"inpageedit/inpageedit-next"})]}),w("li",{children:[w("strong",{children:"QQ Group"}),": 1026023666"]})]}),w("hr",{}),w("p",{children:"🚀 Modular, Extensible Supercharged Plugin for MediaWiki."}),w("p",{children:"InPageEdit-NEXT Copyright © 2025-present dragon-fish"})]})).role("raw-html")}).description(""),"about",{}),Promise.resolve().then(()=>Ay).then(e=>{const n=this.ctx.plugin(e.PluginPreferencesUI);this.addDisposeHandler(()=>{n.dispose()})})}async get(e,n){n??(n=()=>{const i=this.getDefaultValue(e);return this.logger.debug(e,`(fallback value: ${i})`),i});const r=await this.db.get(e,void 0);return r!==null?r:await Ph(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=>{try{const r=n.schema({});Object.entries(r).forEach(([i,s])=>{e[i]=s})}catch{}n.defaults&&Object.entries(n.defaults).forEach(([r,i])=>{e[r]=i})}),Object.entries(e).forEach(([n,r])=>{this._defaultPreferences[n]=r}),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:un?.PreferencesSchema||null,defaults:un?.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}}As=Dh(rl),ti=Fh(As,0,"PluginPreferences",nl,ti),Bh(As,1,ti);const Uh=Object.freeze(Object.defineProperty({__proto__:null,get PluginPreferences(){return ti}},Symbol.toStringTag,{value:"Module"})),qh=Symbol("@@apply"),Hh=Symbol("@@ctor");function Ts(t,e){if(typeof t!="object"||t===null||Array.isArray(t))throw new TypeError("instance is not an object");const n=(...s)=>{const o=t[e];if(typeof o!="function")throw new TypeError(`Property "${String(e)}" is not a function`);return o.apply(t,s)};n[qh]=n,n[Hh]=t;const r=t?.constructor?.name;return r&&(n[Symbol.toStringTag]=r),new Proxy(n,{get(s,o,a){return o==="prototype"?Reflect.get(n,o,a):Reflect.get(t,o,t)},set(s,o,a){return Reflect.set(t,o,a)},has(s,o){return Reflect.has(t,o)},deleteProperty(s,o){return Reflect.deleteProperty(t,o)},ownKeys(){return Reflect.ownKeys(t)},getOwnPropertyDescriptor(s,o){return Object.getOwnPropertyDescriptor(t,o)},defineProperty(s,o,a){return Object.defineProperty(t,o,a)}})}const ni={mbox:"_mbox_5x43w_1",title:"_title_5x43w_12",content:"_content_5x43w_19",close:"_close_5x43w_27"},sr=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:y,resolve:v}=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(),v()}),y},f=w("div",{className:`theme-ipe ipe-mbox mbox-type-${e||"default"} ${ni.mbox}`,...l,children:[u&&w("div",{className:`ipe-mbox-title ${ni.title}`,...s,children:u}),w("div",{className:`ipe-mbox-content ${ni.content}`,...o,children:a||r}),i&&w("a",{onClick:c,className:`ipe-mbox-close ${ni.close}`,children:"×"})]});return f.close=c,f},ri=t=>{const{label:e,id:n,name:r,value:i,disabled:s,labelProps:o,inputProps:a,...l}=t;return w("div",{className:"theme-ipe ipe-input-box",...l,children:[w("label",{htmlFor:n,style:{display:"block"},...o,children:e}),w("input",{id:n,name:r,value:i,disabled:s,style:{width:"100%"},...a})]})},il=t=>{const{id:e,name:n,value:r,label:i,inputProps:s,labelProps:o,children:a,...l}=t;return w("label",{className:"theme-ipe ipe-radio-box",...l,children:[w("input",{type:"radio",id:e,name:n,value:r,...s}),w("span",{className:"ipe-checkbox-box"}),w("span",{...o,children:i||a})]})},kn=t=>{const{id:e,name:n,label:r,checked:i,inputProps:s,labelProps:o,children:a,...l}=t;return w("label",{className:"theme-ipe ipe-checkbox",...l,children:[w("input",{type:"checkbox",id:e,name:n,checked:i,...s}),w("span",{className:"ipe-checkbox-box"}),w("span",{...o,children:r||a})]})},Rs=()=>{},zh=(t=0)=>new Promise(e=>setTimeout(e,t));var Wh=Object.create,Ns=Object.defineProperty,Vh=Object.getOwnPropertyDescriptor,sl=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),ol=t=>{throw TypeError(t)},Kh=(t,e,n)=>e in t?Ns(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Yh=(t,e)=>Ns(t,"name",{value:e,configurable:!0}),Gh=t=>[,,,Wh(t?.[sl("metadata")]??null)],Qh=["class","method","getter","setter","accessor","field","value","get","set"],al=t=>t!==void 0&&typeof t!="function"?ol("Function expected"):t,Jh=(t,e,n,r,i)=>({kind:Qh[t],name:e,metadata:r,addInitializer:s=>n._?ol("Already initialized"):i.push(al(s||null))}),Xh=(t,e)=>Kh(e,sl("metadata"),t[3]),Zh=(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},ep=(t,e,n,r,i,s)=>{var o,a,l,u=e&7,c=!1,f=0,y=t[f]||(t[f]=[]),v=u&&(i=i.prototype,u<5&&(u>3||!c)&&Vh(i,n));Yh(i,n);for(var b=r.length-1;b>=0;b--)l=Jh(u,n,a={},t[3],y),o=(0,r[b])(i,l),a._=1,al(o)&&(i=o);return Xh(t,i),v&&Ns(i,n,v),c?u^4?s:v:i},ll,Ds,cl;ll=[ze(["api","wikiPage","sitemeta","modal","preferences"]),ir(_e.object({editSummary:_e.string().description("Default edit summary for quick edits").default("[IPE-NEXT] Quick edit"),editMinor:_e.boolean().description("Whether to mark the edit as minor").default(!1),outSideClose:_e.boolean().description("Whether to close the modal outside").default(!0),watchList:_e.union([_e.const(mt.preferences).description("Follow my preferences"),_e.const(mt.nochange).description("Keep the current watchlist status"),_e.const(mt.watch).description("Add the page to watchlist"),_e.const(mt.unwatch).description("Remove the page from watchlist")]).description("Watchlist options").default(mt.preferences)}).description("Quick edit options").extra("category","edit"))];class ii extends(cl=rt){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},this.ctx.root.set("quickEdit",Ts(this,"showModal"))}start(){this.ctx.inject(["toolbox"],e=>{this.injectToolbox(e),e.on("dispose",()=>{this.removeToolbox(e)})})}async showModal(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:this.ctx.sitemeta.mwConfig.get("wgPageName"),pageId:this.ctx.sitemeta.mwConfig.get("wgArticleId"),revision:this.ctx.sitemeta.mwConfig.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("quick-edit/init-options",{ctx:this.ctx,options:o});const a=this.ctx.modal.createObject({className:"ipe-quickEdit",sizeClass:"large",center:!1,outSideClose:n}).init();a.setTitle(w(Nt,{children:["Loading: ",w("u",{children:o.title})]})),a.setContent(w("section",{className:"ipe-quickEdit-loading",style:{height:"70vh",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"},children:w(Vt,{})})),a.addButton({side:"right",type:"button",className:"is-danger is-ghost",label:"Cancel",method(){a.close()}}),a.show(),this.ctx.emit("quick-edit/show-modal",{ctx:this.ctx,modal:a,options:o});let l;try{if(l=await this.getWikiPageFromPayload(o),l.pageInfo.special)throw new Error("Special page is not editable")}catch(y){a.off(a.Event.Close),a.close(),this.ctx.modal.notify("error",{content:y instanceof Error?y.message:String(y)});return}a.setTitle(w(Nt,{children:["Quick ",l.pageInfo.pageid===0?"Create":"Edit",":"," ",w("u",{children:l.pageInfo.title})]}));const u=[];l.pageInfo.pageid===0&&u.push(w(sr,{title:"Attention",type:"important",children:w("p",{children:"This page does not exist."})})),l.pageInfo.pageid&&l.pageInfo.lastrevid!==l.revisions[0]?.revid&&u.push(w(sr,{title:"Attention",type:"warning",children:w("p",{children:["You are editing a ",w("em",{children:"historical version"}),"; the content is not the latest!"]})})),this.ctx.emit("quick-edit/edit-notice",{ctx:this.ctx,options:o,modal:a,wikiPage:l,editNotices:u});const c=w("form",{className:"ipe-quickEdit__form",children:[w("div",{className:"ipe-quickEdit__notices",children:u}),w("div",{className:"ipe-quickEdit__content",children:w("textarea",{className:"ipe-quickEdit__textarea",name:"text",id:"wpTextbox1",children:l.revisions[0]?.content||""})}),w("div",{class:"ipe-quickEdit__options",style:{display:"flex",flexDirection:"column",gap:"1rem",marginTop:"1rem"},children:[w(ri,{label:"Summary",id:"summary",name:"summary",value:o.editSummary}),w("div",{className:"ipe-input-box",children:[w("label",{htmlFor:"watchlist",style:{display:"block"},children:"Watchlist"}),w("div",{style:{display:"flex",gap:"1rem"},children:[mt.preferences,mt.nochange,mt.watch,mt.unwatch].map(y=>w(il,{name:"watchlist",value:y,inputProps:{checked:r===y},children:y},y))})]}),w("div",{style:{display:"flex",gap:"1rem"},children:[w(kn,{name:"minor",id:"minor",checked:o.editMinor,children:"Minor edit"}),w(kn,{name:"reloadAfterSave",id:"reloadAfterSave",checked:o.reloadAfterSave,children:"Reload after save"})]})]}),!1]});a.setContent(c),a.addButton({side:"left",className:"is-primary submit-btn",label:"Submit",method:()=>{const y=new FormData(c);a.setLoadingState(!0),this.handleSubmit({wikiPage:l,text:y.get("text"),summary:y.get("summary"),minor:y.get("minor")==="on",section:o.section,createonly:l.pageid===0,watchlist:r}).then(async()=>{a.setOptions({beforeClose:Rs}),a.close(),this.ctx.modal.notify("success",{title:"Submission Successful",content:"Your changes have been saved."}),y.get("reloadAfterSave")&&(await zh(500),location.reload())}).catch(v=>{this.ctx.modal.notify("error",{title:"Submission Error",content:v instanceof Error?v.message:String(v)}),a.setLoadingState(!1)})}},0),a.setOptions({beforeClose:()=>{const y=l.revisions[0]?.content||"";return(c.querySelector("textarea")?.value||"")===y?!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 Editing",className:"is-primary is-ghost"}},b=>(b&&(a.setOptions({beforeClose:Rs}),a.close()),!0)),!1)}}),this.ctx.emit("quick-edit/wiki-page",{ctx:this.ctx,options:o,modal:a,wikiPage:l});const f=y=>c.querySelector("textarea")?.value===l.revisions[0]?.content?!0:(y.preventDefault(),"You have unsaved changes. Are you sure you want to leave?");window.addEventListener("beforeunload",f),a.on(a.Event.Close,()=>{window.removeEventListener("beforeunload",f)})}async handleSubmit(e){const n=e.wikiPage,r=e.summary||"",i=e.text||"",s=e.minor,o=e.createonly,a=e.watchlist,l=e.section;return n.edit({summary:r,text:i,watchlist:a,section:l},{minor:s,createonly:o})}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")}injectToolbox(e){e.toolbox.addButton({id:"quick-edit",group:"group1",index:0,icon:w("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:[w("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),w("path",{d:"M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1"}),w("path",{d:"M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415z"}),w("path",{d:"M16 5l3 3"})]}),tooltip:"Edit this page quickly",onClick:()=>this.showModal({title:this.ctx.sitemeta.mwConfig.get("wgPageName"),pageId:this.ctx.sitemeta.mwConfig.get("wgArticleId"),revision:this.ctx.sitemeta.mwConfig.get("wgRevisionId")})})}removeToolbox(e){e.toolbox.removeButton("quick-edit")}}Ds=Gh(cl),ii=ep(Ds,0,"PluginQuickEdit",ll,ii),Zh(Ds,1,ii);const tp=Object.freeze(Object.defineProperty({__proto__:null,get PluginQuickEdit(){return ii}},Symbol.toStringTag,{value:"Module"}));var np=Object.create,Ls=Object.defineProperty,rp=Object.getOwnPropertyDescriptor,ul=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),fl=t=>{throw TypeError(t)},ip=(t,e,n)=>e in t?Ls(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,sp=(t,e)=>Ls(t,"name",{value:e,configurable:!0}),op=t=>[,,,np(t?.[ul("metadata")]??null)],ap=["class","method","getter","setter","accessor","field","value","get","set"],dl=t=>t!==void 0&&typeof t!="function"?fl("Function expected"):t,lp=(t,e,n,r,i)=>({kind:ap[t],name:e,metadata:r,addInitializer:s=>n._?fl("Already initialized"):i.push(dl(s||null))}),cp=(t,e)=>ip(e,ul("metadata"),t[3]),up=(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},fp=(t,e,n,r,i,s)=>{var o,a,l,u=e&7,c=!1,f=0,y=t[f]||(t[f]=[]),v=u&&(i=i.prototype,u<5&&(u>3||!c)&&rp(i,n));sp(i,n);for(var b=r.length-1;b>=0;b--)l=lp(u,n,a={},t[3],y),o=(0,r[b])(i,l),a._=1,dl(o)&&(i=o);return cp(t,i),v&&Ls(i,n,v),c?u^4?s:v:i},hl,Ms,pl;hl=[ze(["api","wikiPage","sitemeta","modal","preferences"]),ir(_e.object({deleteReason:_e.string().description("Default delete reason for quick delete").default("[IPE-NEXT] Quick delete")}).description("Quick delete options").extra("category","delete"))];class si extends(pl=rt){constructor(e){super(e,{},"quick-delete"),this.ctx=e,this.DEFAULT_OPTIONS={title:"",pageId:0,revision:0,deleteReason:"",reloadAfterDelete:!0},this.ctx.root.set("quickDelete",Ts(this,"showModal"))}start(){this.ctx.inject(["toolbox"],e=>{this.injectToolbox(e),e.on("dispose",()=>{this.removeToolbox(e)})}),this.ctx.preferences.defineCategory({label:"Delete",name:"delete",description:"Settings related to deleting pages",index:3})}async showModal(e){typeof e>"u"?e={}:typeof e=="string"&&(e={title:e}),!e.title&&!e.pageId&&!e.revision&&(this.logger.warn("None of the title, pageId or revision provided. Using defaults."),e={...e,title:this.ctx.sitemeta.mwConfig.get("wgPageName"),pageId:this.ctx.sitemeta.mwConfig.get("wgArticleId"),revision:this.ctx.sitemeta.mwConfig.get("wgRevisionId")});const n=typeof e.deleteReason=="string"?e.deleteReason:await this.ctx.preferences.get("deleteReason"),r={...this.DEFAULT_OPTIONS,deleteReason:n,...e};r.deleteReason||(r.deleteReason=await this.ctx.preferences.get("deleteReason")||""),r||this.ctx.emit("quick-delete/init-options",{ctx:this.ctx,options:r});const i=this.ctx.modal.createObject({className:"ipe-quickDelete",sizeClass:"small",center:!0}).init();i.setTitle(w(Nt,{children:["Loading: ",w("u",{children:r.title})]})),i.setContent(w(Vt,{})),i.addButton({side:"right",type:"button",className:"is-ghost",label:"Cancel",method(){i.close()}}),i.show(),this.ctx.emit("quick-delete/show-modal",{ctx:this.ctx,modal:i,options:r});let s;try{if(s=await this.getWikiPageFromPayload(r),s.pageInfo.special)throw new Error("Special page cannot be deleted");if(s.pageInfo.pageid===0)throw new Error("Page does not exist, cannot be deleted")}catch(l){i.off(i.Event.Close),i.close(),this.ctx.modal.notify("error",{content:l instanceof Error?l.message:String(l)});return}i.setTitle(w(Nt,{children:["Quick Delete: ",w("u",{children:s.pageInfo.title})]}));const o=[];s.userCan("delete")||o.push(w(sr,{title:"Permission Denied",type:"error",children:w("p",{children:"You do not have permission to delete this page."})})),s.pageInfo.protection&&s.pageInfo.protection.length>0&&o.push(w(sr,{title:"Warning",type:"warning",children:w("p",{children:"This page is protected and may has special use or purpose. Delete it at your own risk."})})),this.ctx.emit("quick-delete/delete-notice",{ctx:this.ctx,options:r,modal:i,wikiPage:s,deleteNotices:o});const a=w("form",{className:"ipe-quickDelete__form",children:[w("div",{className:"ipe-quickDelete__notices",children:o}),w("div",{className:"ipe-quickDelete__content",children:w("div",{className:"ipe-quickDelete__page-info",style:{padding:"1rem",backgroundColor:"#f8f9fa",border:"1px solid #dee2e6",borderRadius:"4px",marginBottom:"1rem"},children:w("ul",{children:[w("li",{children:[w("strong",{children:"Title:"})," ",s.pageInfo.title]}),w("li",{children:[w("strong",{children:"Page ID:"})," ",s.pageInfo.pageid]}),w("li",{children:[w("strong",{children:"Last Revision:"})," ",s.pageInfo.lastrevid]}),w("li",{children:[w("strong",{children:"Length:"})," ",s.pageInfo.length," characters"]})]})})}),w("div",{class:"ipe-quickDelete__options",style:{display:"flex",flexDirection:"column",gap:"1rem",marginTop:"1rem"},children:w(ri,{label:"Delete Reason",id:"reason",name:"reason",value:r.deleteReason,inputProps:{placeholder:"Enter reason for deletion...",required:!0}})}),!1]});i.setContent(a),i.addButton({side:"left",className:"is-danger submit-btn",label:"Delete Page",method:()=>{const u=new FormData(a).get("reason");if(!u||u.trim()===""){this.ctx.modal.notify("error",{title:"Missing Reason",content:"Please provide a reason for deletion."});return}this.ctx.modal.confirm({className:"is-danger",title:"Confirm Deletion",content:w(Nt,{children:w("p",{children:w("strong",{children:s.pageInfo.title})})}),center:!0,okBtn:{label:"Delete it now",className:"is-danger"},cancelBtn:{label:"Cancel",className:"is-ghost"}},c=>(c&&(i.setLoadingState(!0),this.handleSubmit({wikiPage:s,reason:u}).then(async()=>{i.setOptions({beforeClose:Rs}),i.close(),this.ctx.modal.notify("success",{title:"Deletion Successful",content:`The page "${s.pageInfo.title}" has been deleted.`})}).catch(f=>{this.ctx.modal.notify("error",{title:"Deletion Error",content:f instanceof Error?f.message:String(f)}),i.setLoadingState(!1)})),!0))}},0),this.ctx.emit("quick-delete/wiki-page",{ctx:this.ctx,options:r,modal:i,wikiPage:s})}async handleSubmit(e){const n=e.wikiPage,r=e.reason||"";return n.delete(r)}async getWikiPageFromPayload(e){if(e.revision)return this.ctx.wikiPage.newFromRevision(e.revision);if(e.pageId)return this.ctx.wikiPage.newFromPageId(e.pageId);if(e.title)return this.ctx.wikiPage.newFromTitle(e.title,!1);throw new Error("Invalid payload")}injectToolbox(e){e.toolbox.addButton({id:"quick-delete",group:"group2",icon:w("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-trash",children:[w("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),w("path",{d:"M4 7l16 0"}),w("path",{d:"M10 11l0 6"}),w("path",{d:"M14 11l0 6"}),w("path",{d:"M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"}),w("path",{d:"M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"})]}),tooltip:"Delete this page",onClick:()=>{this.ctx.sitemeta.hasAnyRight("delete")?this.showModal({title:this.ctx.sitemeta.mwConfig.get("wgPageName"),pageId:this.ctx.sitemeta.mwConfig.get("wgArticleId"),revision:this.ctx.sitemeta.mwConfig.get("wgRevisionId")}):this.ctx.modal.notify("error",{title:"Permission Denied",content:"You do not have permission to delete pages."})}})}removeToolbox(e){e.toolbox.removeButton("quick-delete")}}Ms=op(pl),si=fp(Ms,0,"PluginQuickDelete",hl,si),up(Ms,1,si);const dp=Object.freeze(Object.defineProperty({__proto__:null,get PluginQuickDelete(){return si}},Symbol.toStringTag,{value:"Module"})),or={twinSwapInput:"_twinSwapInput_1gdgl_9",inputWrapper:"_inputWrapper_1gdgl_23",inputLeft:"_inputLeft_1gdgl_27",inputRight:"_inputRight_1gdgl_30",swapButton:"_swapButton_1gdgl_46"},ml=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(b=>b&&b.disabled),c=()=>{if(!s[0]||!s[1]||u())return;const b=s[0],A=s[1],U=b.value,D=A.value;b.value=D,A.value=U,b.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=b=>{if(!a)return;const A=b??!a.disabled;a.disabled=!A,A&&s.forEach(U=>{U&&(U.disabled=!1)})},y=w("button",{type:"button","aria-label":"Swap values",onClick:c,disabled:u()||!n,ref:b=>a=b,children:w("svg",{ref:b=>l=b,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:[w("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),w("path",{d:"M20 10h-16l5.5 -6"}),w("path",{d:"M4 14h16l-5.5 6"})]})}),v=w("div",{className:`twin-swap-input ${or.twinSwapInput}`,...r,children:[i.map((b,A)=>{const{label:U,id:D,name:I,value:g,disabled:p,required:h,inputProps:S}=b,O=A===0,R=D||I;return w("div",{className:`${or.inputWrapper} ${O?or.inputLeft:or.inputRight}`,children:[U&&w("label",{htmlFor:R,children:U}),w("input",{ref:z=>s[A]=z,type:"text",id:R,name:I,value:g,disabled:p,required:h,...S})]})}),w("div",{className:or.swapButton,children:y})]});return v.swap=c,v.toggleEnableSwap=f,v};var hp=Object.create,js=Object.defineProperty,pp=Object.getOwnPropertyDescriptor,gl=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),vl=t=>{throw TypeError(t)},mp=(t,e,n)=>e in t?js(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,gp=(t,e)=>js(t,"name",{value:e,configurable:!0}),vp=t=>[,,,hp(t?.[gl("metadata")]??null)],yp=["class","method","getter","setter","accessor","field","value","get","set"],yl=t=>t!==void 0&&typeof t!="function"?vl("Function expected"):t,bp=(t,e,n,r,i)=>({kind:yp[t],name:e,metadata:r,addInitializer:s=>n._?vl("Already initialized"):i.push(yl(s||null))}),wp=(t,e)=>mp(e,gl("metadata"),t[3]),_p=(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},xp=(t,e,n,r,i,s)=>{var o,a,l,u=e&7,c=!1,f=0,y=t[f]||(t[f]=[]),v=u&&(i=i.prototype,u<5&&(u>3||!c)&&pp(i,n));gp(i,n);for(var b=r.length-1;b>=0;b--)l=bp(u,n,a={},t[3],y),o=(0,r[b])(i,l),a._=1,yl(o)&&(i=o);return wp(t,i),v&&js(i,n,v),c?u^4?s:v:i},bl,Bs,wl;bl=[ze(["modal","sitemeta"])];class oi extends(wl=rt){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:w("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:[w("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),w("path",{d:"M12 3a3 3 0 0 0 -3 3v12a3 3 0 0 0 3 3"}),w("path",{d:"M6 3a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3"}),w("path",{d:"M13 7h7a1 1 0 0 1 1 1v8a1 1 0 0 1 -1 1h-7"}),w("path",{d:"M5 7h-1a1 1 0 0 0 -1 1v8a1 1 0 0 0 1 1h1"}),w("path",{d:"M17 12h.01"}),w("path",{d:"M13 12h.01"})]}),tooltip:"Quick Move",group:"group1",index:1,onClick:()=>{this.quickMove(r?{lockFromField:!0,from:n}:{})}})}quickMove(e){const n=this.ctx.modal.createObject({title:"Quick Move",content:w(Vt,{}),className:"quick-move compact-buttons",sizeClass:"smallToMedium",center:!0}).init();let r=null;return n.setContent(w("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:[w(ml,{inputs:[{label:"Move from",name:"from",value:e?.from,required:!0},{label:"Move to",name:"to",value:e?.to,required:!0}]}),w("div",{children:w(kn,{name:"movetalk",id:"movetalk",checked:e?.movetalk,children:"Move talk page"})}),w("div",{children:w(kn,{name:"movesubpages",id:"movesubpages",checked:e?.movesubpages,children:"Move subpage(s) (up to 100)"})}),this.ctx.sitemeta.hasRight("suppressredirect")&&w("div",{children:w(kn,{name:"noredirect",id:"noredirect",checked:e?.noredirect,children:"Move without leaving a redirect"})}),w(ri,{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)}}Bs=vp(wl),oi=xp(Bs,0,"PluginQuickMove",bl,oi),_p(Bs,1,oi);const Sp=Object.freeze(Object.defineProperty({__proto__:null,get PluginQuickMove(){return oi}},Symbol.toStringTag,{value:"Module"}));var Ep=Object.create,Fs=Object.defineProperty,kp=Object.getOwnPropertyDescriptor,_l=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),xl=t=>{throw TypeError(t)},$p=(t,e,n)=>e in t?Fs(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Cp=(t,e)=>Fs(t,"name",{value:e,configurable:!0}),Pp=t=>[,,,Ep(t?.[_l("metadata")]??null)],Op=["class","method","getter","setter","accessor","field","value","get","set"],Sl=t=>t!==void 0&&typeof t!="function"?xl("Function expected"):t,Ip=(t,e,n,r,i)=>({kind:Op[t],name:e,metadata:r,addInitializer:s=>n._?xl("Already initialized"):i.push(Sl(s||null))}),Ap=(t,e)=>$p(e,_l("metadata"),t[3]),Tp=(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},Rp=(t,e,n,r,i,s)=>{var o,a,l,u=e&7,c=!1,f=0,y=t[f]||(t[f]=[]),v=u&&(i=i.prototype,u<5&&(u>3||!c)&&kp(i,n));Cp(i,n);for(var b=r.length-1;b>=0;b--)l=Ip(u,n,a={},t[3],y),o=(0,r[b])(i,l),a._=1,Sl(o)&&(i=o);return Ap(t,i),v&&Fs(i,n,v),c?u^4?s:v:i},El,Us,kl;El=[ze(["api","wikiPage","modal"])];class ai extends(kl=rt){constructor(e){super(e,{},"quickPreview"),this.ctx=e,this.ctx.set("quickPreview",Ts(this,"previewWikitext"))}start(){this.ctx.on("quick-edit/wiki-page",this.injectQuickEdit.bind(this)),this.ctx.on("quick-delete/wiki-page",this.injectQuickDelete.bind(this))}stop(){this.ctx.off("quick-edit/wiki-page",this.injectQuickEdit.bind(this)),this.ctx.off("quick-delete/wiki-page",this.injectQuickDelete.bind(this))}previewWikitext(e,n,r,i,s){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",center:!1,...s}).init()),i.show(),i.setTitle("Preview - Loading..."),i.setContent(w(Vt,{})),i.bringToFront(),this.ctx.emit("quick-preview/show-modal",{ctx:this.ctx,text:e,modal:i,wikiPage:r}),r.preview(e,n).then(o=>{const{data:{parse:a}}=o;i.setTitle(`Preview - ${a.title}`);let l=null;i.setContent(w("section",{children:w("div",{ref:u=>l=u,className:"mw-parser-output",innerHTML:a.text})})),window.mw?.hook("wikipage.content").fire($(l)),this.ctx.emit("quick-preview/loaded",{ctx:this.ctx,modal:i,wikiPage:r,text:e,parseData:a})}).catch(o=>{i.setTitle("Preview - Failed"),i.setContent(w(Nt,{children:[w("p",{children:"Failed to preview"}),w("p",{children:o instanceof Error?o.message:String(o)})]}))}),i}injectQuickEdit({ctx:e,modal:n,wikiPage:r}){let i;n.addButton({label:"Preview",side:"left",className:"btn btn-secondary",method:()=>{i=this.previewWikitext(n.get$content().querySelector('textarea[name="text"]')?.value||"",void 0,r,i,{backdrop:!1,draggable:!0})}},1),n.on(n.Event.Close,()=>{i?.destroy(),i=void 0})}injectQuickDelete({ctx:e,modal:n,wikiPage:r}){n.addButton({label:"Preview",side:"left",className:"btn btn-secondary",method:()=>{this.logger.warn("To be implemented: preview wikitext for quick delete")}},2)}}Us=Pp(kl),ai=Rp(Us,0,"PluginQuickPreview",El,ai),Tp(Us,1,ai);const Np=Object.freeze(Object.defineProperty({__proto__:null,get PluginQuickPreview(){return ai}},Symbol.toStringTag,{value:"Module"}));class Lt{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,y=Date.now()+f,v=[{oldPos:-1,lastComponent:void 0}];let b=this.extractCommon(v[0],n,e,0,r);if(v[0].oldPos+1>=l&&b+1>=a)return o(this.buildValues(v[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=v[I-1],h=v[I+1];p&&(v[I-1]=void 0);let S=!1;if(h){const R=h.oldPos-I;S=h&&0<=R&&R<a}const O=p&&p.oldPos+1<l;if(!S&&!O){v[I]=void 0;continue}if(!O||S&&p.oldPos<h.oldPos?g=this.addToPath(h,!0,!1,0,r):g=this.addToPath(p,!1,!0,1,r),b=this.extractCommon(g,n,e,I,r),g.oldPos+1>=l&&b+1>=a)return o(this.buildValues(g.lastComponent,n,e))||!0;v[I]=g,g.oldPos+1>=l&&(U=Math.min(U,I-1)),b+1>=a&&(A=Math.max(A,I+1))}u++};if(i)(function I(){setTimeout(function(){if(u>c||Date.now()>y)return i(void 0);D()||I()},0)})();else for(;u<=c&&Date.now()<=y;){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(y,v){const b=r[u+v];return b.length>y.length?b:y}),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 Dp extends Lt{}const $l=new Dp;function Cl(t,e,n){return $l.diff(t,e,n)}function Pl(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 Ol(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 qs(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 Hs(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 ar(t,e){return qs(t,e,"")}function li(t,e){return Hs(t,e,"")}function Il(t,e){return e.slice(0,Lp(t,e))}function Lp(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 Mp(t){return t.includes(`\r
68
68
  `)&&!t.startsWith(`
69
- `)&&!t.match(/[^\r]\n/)}function op(t){return!t.includes(`\r
69
+ `)&&!t.match(/[^\r]\n/)}function jp(t){return!t.includes(`\r
70
70
  `)&&t.includes(`
71
- `)}function nr(t){let e;for(e=t.length-1;e>=0&&t[e].match(/\s/);e--);return t.substring(e+1)}function qt(t){const e=t.match(/^\s*/);return e?e[0]:""}const ni="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}",ap=new RegExp(`[${ni}]+|\\s+|[^${ni}]`,"ug");class lp 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(ap)||[];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)&&hl(r,s,i,o),r=o,i=null,s=null)}),(i||s)&&hl(r,s,i,null),e}}const fl=new lp;function dl(t,e,n){return n?.ignoreWhitespace!=null&&!n.ignoreWhitespace?Rs(t,e,n):fl.diff(t,e,n)}function hl(t,e,n,r){if(e&&n){const i=qt(e.value),s=nr(e.value),o=qt(n.value),a=nr(n.value);if(t){const l=ll(i,o);t.value=Ts(t.value,o,l),e.value=tr(e.value,l),n.value=tr(n.value,l)}if(r){const l=cl(s,a);r.value=Is(r.value,a,l),e.value=ti(e.value,l),n.value=ti(n.value,l)}}else if(n){if(t){const i=qt(n.value);n.value=n.value.substring(i.length)}if(r){const i=qt(r.value);r.value=r.value.substring(i.length)}}else if(t&&r){const i=qt(r.value),s=qt(e.value),o=nr(e.value),a=ll(i,s);e.value=tr(e.value,a);const l=cl(tr(i,a),o);e.value=ti(e.value,l),r.value=Is(r.value,i,l),t.value=Ts(t.value,i,i.slice(0,i.length-l.length))}else if(r){const i=qt(r.value),s=nr(e.value),o=ul(s,i);e.value=ti(e.value,o)}else if(t){const i=nr(t.value),s=qt(e.value),o=ul(i,s);e.value=tr(e.value,o)}}class cp extends Rt{tokenize(e){const n=new RegExp(`(\\r?\\n)|[${ni}]+|[^\\S\\n\\r]+|[^${ni}]`,"ug");return e.match(n)||[]}}const pl=new cp;function Rs(t,e,n){return pl.diff(t,e,n)}function up(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 fp extends Rt{constructor(){super(...arguments),this.tokenize=gl}equals(e,n,r){return r.ignoreWhitespace?((!r.newlineIsToken||!e.includes(`
71
+ `)}function lr(t){let e;for(e=t.length-1;e>=0&&t[e].match(/\s/);e--);return t.substring(e+1)}function Kt(t){const e=t.match(/^\s*/);return e?e[0]:""}const ci="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}",Bp=new RegExp(`[${ci}]+|\\s+|[^${ci}]`,"ug");class Fp extends Lt{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(Bp)||[];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)&&Rl(r,s,i,o),r=o,i=null,s=null)}),(i||s)&&Rl(r,s,i,null),e}}const Al=new Fp;function Tl(t,e,n){return n?.ignoreWhitespace!=null&&!n.ignoreWhitespace?zs(t,e,n):Al.diff(t,e,n)}function Rl(t,e,n,r){if(e&&n){const i=Kt(e.value),s=lr(e.value),o=Kt(n.value),a=lr(n.value);if(t){const l=Pl(i,o);t.value=Hs(t.value,o,l),e.value=ar(e.value,l),n.value=ar(n.value,l)}if(r){const l=Ol(s,a);r.value=qs(r.value,a,l),e.value=li(e.value,l),n.value=li(n.value,l)}}else if(n){if(t){const i=Kt(n.value);n.value=n.value.substring(i.length)}if(r){const i=Kt(r.value);r.value=r.value.substring(i.length)}}else if(t&&r){const i=Kt(r.value),s=Kt(e.value),o=lr(e.value),a=Pl(i,s);e.value=ar(e.value,a);const l=Ol(ar(i,a),o);e.value=li(e.value,l),r.value=qs(r.value,i,l),t.value=Hs(t.value,i,i.slice(0,i.length-l.length))}else if(r){const i=Kt(r.value),s=lr(e.value),o=Il(s,i);e.value=li(e.value,o)}else if(t){const i=lr(t.value),s=Kt(e.value),o=Il(i,s);e.value=ar(e.value,o)}}class Up extends Lt{tokenize(e){const n=new RegExp(`(\\r?\\n)|[${ci}]+|[^\\S\\n\\r]+|[^${ci}]`,"ug");return e.match(n)||[]}}const Nl=new Up;function zs(t,e,n){return Nl.diff(t,e,n)}function qp(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 Hp extends Lt{constructor(){super(...arguments),this.tokenize=Ll}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 Ds=new fp;function ri(t,e,n){return Ds.diff(t,e,n)}function ml(t,e,n){return n=up(n,{ignoreWhitespace:!0}),Ds.diff(t,e,n)}function gl(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 dp(t){return t=="."||t=="!"||t=="?"}class hp 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(dp(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 yl=new hp;function vl(t,e,n){return yl.diff(t,e,n)}class pp extends Rt{tokenize(e){return e.split(/([{}:;,]|\s+)/)}}const bl=new pp;function _l(t,e,n){return bl.diff(t,e,n)}class mp extends Rt{constructor(){super(...arguments),this.tokenize=gl}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(ii(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 wl=new mp;function xl(t,e,n){return wl.diff(t,e,n)}function ii(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]=ii(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]=ii(t[l],e,n,r,l);e.pop(),n.pop()}else o=t;return o}class gp extends Rt{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}}const Sl=new gp;function El(t,e,n){return Sl.diff(t,e,n)}function $l(t){return Array.isArray(t)?t.map(e=>$l(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 kl(t){return Array.isArray(t)?t.map(e=>kl(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 yp(t){return Array.isArray(t)||(t=[t]),!t.some(e=>e.hunks.some(n=>n.lines.some(r=>!r.startsWith("\\")&&r.endsWith("\r"))))}function vp(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 Ls(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 y=0,v=0;for(;r<e.length&&(v<f.oldLines||y<f.newLines||!((a=e[r])===null||a===void 0)&&a.startsWith("\\"));r++){const b=e[r].length==0&&r!=e.length-1?" ":e[r][0];if(b==="+"||b==="-"||b===" "||b==="\\")f.lines.push(e[r]),b==="+"?y++:b==="-"?v++:b===" "&&(y++,v++);else throw new Error(`Hunk at line ${l+1} contained invalid line ${e[r]}`)}if(!y&&f.newLines===1&&(f.newLines=0),!v&&f.oldLines===1&&(f.oldLines=0),y!==f.newLines)throw new Error("Added line count did not match for hunk at line "+(l+1));if(v!==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 bp(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 Cl(t,e,n={}){let r;if(typeof e=="string"?r=Ls(e):Array.isArray(e)?r=e:r=[e],r.length>1)throw new Error("applyPatch only works with a single input.");return _p(t,r[0],n)}function _p(t,e,n={}){(n.autoConvertLineEndings||n.autoConvertLineEndings==null)&&(sp(t)&&yp(e)?e=$l(e):op(t)&&vp(e)&&(e=kl(e)));const r=t.split(`
77
- `),i=e.hunks,s=n.compareLine||((b,A,U,L)=>A===L),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 b=0;b<i[i.length-1].lines.length;b++){const A=i[i.length-1].lines[b];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(b,A,U,L=0,I=!0,g=[],p=0){let h=0,S=!1;for(;L<b.length;L++){const P=b[L],R=P.length>0?P[0]:" ",z=P.length>0?P.substr(1):P;if(R==="-")if(s(A+1,r[A],R,z))A++,h=0;else return!U||r[A]==null?null:(g[p]=r[A],f(b,A+1,U-1,L,!1,g,p+1));if(R==="+"){if(!I)return null;g[p]=z,p++,h=0,S=!0}if(R===" ")if(h++,g[p]=r[A],s(A+1,r[A],R,z))p++,I=!0,S=!1,A++;else return S||!U?null:r[A]&&(f(b,A+1,U-1,L+1,!1,g,p+1)||f(b,A+1,U-1,L,!1,g,p+1))||f(b,A,U-1,L+1,!1,g,p)}return p-=h,A-=h,g.length=p,{patchedLines:g,oldLineLastI:A-1}}const y=[];let v=0;for(let b=0;b<i.length;b++){const A=i[b];let U;const L=r.length-A.oldLines+o;let I;for(let g=0;g<=o;g++){I=A.oldStart+v-1;const p=bp(I,a,L);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++)y.push(r[g]);for(let g=0;g<U.patchedLines.length;g++){const p=U.patchedLines[g];y.push(p)}a=U.oldLineLastI+1,v=I+1-A.oldStart}for(let b=a;b<r.length;b++)y.push(r[b]);return y.join(`
78
- `)}function wp(t,e){const n=typeof t=="string"?Ls(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=Cl(a,s,e);e.patched(s,l,function(u){if(u)return e.complete(u);i()})})}i()}function Ol(t){return Array.isArray(t)?t.map(e=>Ol(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 Ns(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;ri(n,r,Object.assign(Object.assign({},a),{callback:f=>{const y=u(f);c(y)}}))}else return u(ri(n,r,a));function u(c){if(!c)return;c.push({value:"",lines:[]});function f(I){return I.map(function(g){return" "+g})}const y=[];let v=0,b=0,A=[],U=1,L=1;for(let I=0;I<c.length;I++){const g=c[I],p=g.lines||Sp(g.value);if(g.lines=p,g.added||g.removed){if(!v){const h=c[I-1];v=U,b=L,h&&(A=l>0?f(h.lines.slice(-l)):[],v-=A.length,b-=A.length)}for(const h of p)A.push((g.added?"+":"-")+h);g.added?L+=p.length:U+=p.length}else{if(v)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 S={oldStart:v,oldLines:U-v+h,newStart:b,newLines:L-b+h,lines:A};y.push(S),v=0,b=0,A=[]}U+=p.length,L+=p.length}}for(const I of y)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:y}}}function si(t){if(Array.isArray(t))return t.map(si).join(`
75
+ `)&&(n=n.slice(0,-1))),super.equals(e,n,r)}}const Ws=new Hp;function ui(t,e,n){return Ws.diff(t,e,n)}function Dl(t,e,n){return n=qp(n,{ignoreWhitespace:!0}),Ws.diff(t,e,n)}function Ll(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 zp(t){return t=="."||t=="!"||t=="?"}class Wp extends Lt{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(zp(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 Ml=new Wp;function jl(t,e,n){return Ml.diff(t,e,n)}class Vp extends Lt{tokenize(e){return e.split(/([{}:;,]|\s+)/)}}const Bl=new Vp;function Fl(t,e,n){return Bl.diff(t,e,n)}class Kp extends Lt{constructor(){super(...arguments),this.tokenize=Ll}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(fi(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 Ul=new Kp;function ql(t,e,n){return Ul.diff(t,e,n)}function fi(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]=fi(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]=fi(t[l],e,n,r,l);e.pop(),n.pop()}else o=t;return o}class Yp extends Lt{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}}const Hl=new Yp;function zl(t,e,n){return Hl.diff(t,e,n)}function Wl(t){return Array.isArray(t)?t.map(e=>Wl(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 Vl(t){return Array.isArray(t)?t.map(e=>Vl(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 Gp(t){return Array.isArray(t)||(t=[t]),!t.some(e=>e.hunks.some(n=>n.lines.some(r=>!r.startsWith("\\")&&r.endsWith("\r"))))}function Qp(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 Vs(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 y=0,v=0;for(;r<e.length&&(v<f.oldLines||y<f.newLines||!((a=e[r])===null||a===void 0)&&a.startsWith("\\"));r++){const b=e[r].length==0&&r!=e.length-1?" ":e[r][0];if(b==="+"||b==="-"||b===" "||b==="\\")f.lines.push(e[r]),b==="+"?y++:b==="-"?v++:b===" "&&(y++,v++);else throw new Error(`Hunk at line ${l+1} contained invalid line ${e[r]}`)}if(!y&&f.newLines===1&&(f.newLines=0),!v&&f.oldLines===1&&(f.oldLines=0),y!==f.newLines)throw new Error("Added line count did not match for hunk at line "+(l+1));if(v!==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 Jp(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 Kl(t,e,n={}){let r;if(typeof e=="string"?r=Vs(e):Array.isArray(e)?r=e:r=[e],r.length>1)throw new Error("applyPatch only works with a single input.");return Xp(t,r[0],n)}function Xp(t,e,n={}){(n.autoConvertLineEndings||n.autoConvertLineEndings==null)&&(Mp(t)&&Gp(e)?e=Wl(e):jp(t)&&Qp(e)&&(e=Vl(e)));const r=t.split(`
77
+ `),i=e.hunks,s=n.compareLine||((b,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 b=0;b<i[i.length-1].lines.length;b++){const A=i[i.length-1].lines[b];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(b,A,U,D=0,I=!0,g=[],p=0){let h=0,S=!1;for(;D<b.length;D++){const O=b[D],R=O.length>0?O[0]:" ",z=O.length>0?O.substr(1):O;if(R==="-")if(s(A+1,r[A],R,z))A++,h=0;else return!U||r[A]==null?null:(g[p]=r[A],f(b,A+1,U-1,D,!1,g,p+1));if(R==="+"){if(!I)return null;g[p]=z,p++,h=0,S=!0}if(R===" ")if(h++,g[p]=r[A],s(A+1,r[A],R,z))p++,I=!0,S=!1,A++;else return S||!U?null:r[A]&&(f(b,A+1,U-1,D+1,!1,g,p+1)||f(b,A+1,U-1,D,!1,g,p+1))||f(b,A,U-1,D+1,!1,g,p)}return p-=h,A-=h,g.length=p,{patchedLines:g,oldLineLastI:A-1}}const y=[];let v=0;for(let b=0;b<i.length;b++){const A=i[b];let U;const D=r.length-A.oldLines+o;let I;for(let g=0;g<=o;g++){I=A.oldStart+v-1;const p=Jp(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++)y.push(r[g]);for(let g=0;g<U.patchedLines.length;g++){const p=U.patchedLines[g];y.push(p)}a=U.oldLineLastI+1,v=I+1-A.oldStart}for(let b=a;b<r.length;b++)y.push(r[b]);return y.join(`
78
+ `)}function Zp(t,e){const n=typeof t=="string"?Vs(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=Kl(a,s,e);e.patched(s,l,function(u){if(u)return e.complete(u);i()})})}i()}function Yl(t){return Array.isArray(t)?t.map(e=>Yl(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 Ks(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;ui(n,r,Object.assign(Object.assign({},a),{callback:f=>{const y=u(f);c(y)}}))}else return u(ui(n,r,a));function u(c){if(!c)return;c.push({value:"",lines:[]});function f(I){return I.map(function(g){return" "+g})}const y=[];let v=0,b=0,A=[],U=1,D=1;for(let I=0;I<c.length;I++){const g=c[I],p=g.lines||tm(g.value);if(g.lines=p,g.added||g.removed){if(!v){const h=c[I-1];v=U,b=D,h&&(A=l>0?f(h.lines.slice(-l)):[],v-=A.length,b-=A.length)}for(const h of p)A.push((g.added?"+":"-")+h);g.added?D+=p.length:U+=p.length}else{if(v)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 O of f(p.slice(0,h)))A.push(O);const S={oldStart:v,oldLines:U-v+h,newStart:b,newLines:D-b+h,lines:A};y.push(S),v=0,b=0,A=[]}U+=p.length,D+=p.length}}for(const I of y)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:y}}}function di(t){if(Array.isArray(t))return t.map(di).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 Ms(t,e,n,r,i,s,o){if(typeof o=="function"&&(o={callback:o}),o?.callback){const{callback:a}=o;Ns(t,e,n,r,i,s,Object.assign(Object.assign({},o),{callback:l=>{a(l?si(l):void 0)}}))}else{const a=Ns(t,e,n,r,i,s,o);return a?si(a):void 0}}function xp(t,e,n,r,i,s){return Ms(t,t,e,n,r,i,s)}function Sp(t){const e=t.endsWith(`
82
+ `}function Ys(t,e,n,r,i,s,o){if(typeof o=="function"&&(o={callback:o}),o?.callback){const{callback:a}=o;Ks(t,e,n,r,i,s,Object.assign(Object.assign({},o),{callback:l=>{a(l?di(l):void 0)}}))}else{const a=Ks(t,e,n,r,i,s,o);return a?di(a):void 0}}function em(t,e,n,r,i,s){return Ys(t,t,e,n,r,i,s)}function tm(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 Ep(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 $p(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(kp(r.value)),r.added?e.push("</ins>"):r.removed&&e.push("</del>")}return e.join("")}function kp(t){let e=t;return e=e.replace(/&/g,"&amp;"),e=e.replace(/</g,"&lt;"),e=e.replace(/>/g,"&gt;"),e=e.replace(/"/g,"&quot;"),e}const Cp=Object.freeze(Object.defineProperty({__proto__:null,Diff:Rt,applyPatch:Cl,applyPatches:wp,arrayDiff:Sl,canonicalize:ii,characterDiff:ol,convertChangesToDMP:Ep,convertChangesToXML:$p,createPatch:xp,createTwoFilesPatch:Ms,cssDiff:bl,diffArrays:El,diffChars:al,diffCss:_l,diffJson:xl,diffLines:ri,diffSentences:vl,diffTrimmedLines:ml,diffWords:dl,diffWordsWithSpace:Rs,formatPatch:si,jsonDiff:wl,lineDiff:Ds,parsePatch:Ls,reversePatch:Ol,sentenceDiff:yl,structuredPatch:Ns,wordDiff:fl,wordsWithSpaceDiff:pl},Symbol.toStringTag,{value:"Module"}));class Op{constructor(e){this.ctx=e,this.JsDiff=Cp,this.diffChars=al,this.diffWords=dl,this.diffWordsWithSpace=Rs,this.diffLines=ri,this.diffTrimmedLines=ml,this.diffSentences=vl,this.diffCss=_l,this.diffJson=xl,this.diffArrays=El,this.createTwoFilesPatch=Ms,this.ctx.set("jsdiff",this)}}const Pp={"diff-container":"_diff-container_lq0si_2"},Ap=t=>{let{user:e,target:n}=t;const r=window.mw?.config?.get("wgArticlePath")||"/$1",i=s=>r.replace("$1",s);return x("span",{className:"mw-userlinks",children:[x("a",{href:i(`User:${e}`),className:"mw-userlink",target:n,children:e})," ",x("span",{className:"mw-usertoollinks",children:["(",x("a",{href:i(`User_talk:${e}`),className:"mw-usertoollinks-talk",target:n,children:"talk"})," | ",x("a",{href:i(`Special:Contributions/${e}`),className:"mw-usertoollinks-contribs",target:n,children:"contribs"})," | ",x("a",{href:i(`Special:Block/${e}`),className:"mw-usertoollinks-block",target:n,children:"block"}),")"]})]})},Ip=new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"medium"}).format,Pl=t=>{let e=["diff-title"];return t.type==="from"?e.push("diff-otitle"):t.type==="to"&&e.push("diff-ntitle"),!t.pageid||!t.userid?x("td",{colSpan:2,className:e,children:x("div",{className:"mw-diff-title--title",children:t.type==="from"?"Original content":t.type==="to"?"Your content":""})}):x("td",{colSpan:2,className:e,children:[x("div",{className:"mw-diff-title--title",children:t.pagetitle||t.timestamp}),x("div",{className:"mw-diff-title--user",children:t.username&&x(Ap,{user:t.username,target:"_blank"})}),x("div",{className:"mw-diff-title--timestamp",children:t.timestamp&&Ip(new Date(t.timestamp))}),x("div",{className:"mw-diff-title--comment",children:t.parsedcomment&&x(bn,{children:["(",x("i",{innerHTML:t.parsedcomment}),")"]})}),x("div",{className:"mw-diff-title--navigation"})]})},Tp=t=>{const{data:e,...n}=t,r=x("table",{className:"theme-ipe diff diff-type-table","data-mw":"interface",...n,children:[x("colgroup",{children:[x("col",{className:"diff-marker"}),x("col",{className:"diff-content"}),x("col",{className:"diff-marker"}),x("col",{className:"diff-content"})]}),x("tbody",{children:[x("tr",{children:[x(Pl,{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}),x(Pl,{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})]}),x("div",{id:"diffbody"}),x("tr",{className:"diff-size",style:{textAlign:"center"},children:[x("td",{colSpan:2,className:"diff-size-old",children:e.fromsize!==void 0&&`${e.fromsize} bytes`}),x("td",{colSpan:2,className:"diff-size-new",children:e.tosize!==void 0&&`${e.tosize} bytes`})]})]})]});return r.querySelector("#diffbody").outerHTML=e.body||x("tr",{children:x("td",{colSpan:4,children:x("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"5rem"},children:x("i",{children:"No changes"})})})}).outerHTML,r},Rp=(t,e=document)=>e.querySelector(t),Dp=(t,e=document)=>e.querySelectorAll(t);var Lp=Object.create,js=Object.defineProperty,Np=Object.getOwnPropertyDescriptor,Al=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Il=t=>{throw TypeError(t)},Mp=(t,e,n)=>e in t?js(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,jp=(t,e)=>js(t,"name",{value:e,configurable:!0}),Fp=t=>[,,,Lp(t?.[Al("metadata")]??null)],Bp=["class","method","getter","setter","accessor","field","value","get","set"],Tl=t=>t!==void 0&&typeof t!="function"?Il("Function expected"):t,Up=(t,e,n,r,i)=>({kind:Bp[t],name:e,metadata:r,addInitializer:s=>n._?Il("Already initialized"):i.push(Tl(s||null))}),Hp=(t,e)=>Mp(e,Al("metadata"),t[3]),qp=(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,y=t[f]||(t[f]=[]),v=u&&(i=i.prototype,u<5&&(u>3||!c)&&Np(i,n));jp(i,n);for(var b=r.length-1;b>=0;b--)l=Up(u,n,a={},t[3],y),o=(0,r[b])(i,l),a._=1,Tl(o)&&(i=o);return Hp(t,i),v&&js(i,n,v),c?u^4?s:v:i},Rl,Fs,Dl;const Ll=["diffChars","diffWords","diffSentences","diffLines","createTwoFilesPatch"];Rl=[Ge(["jsdiff"]),Gr(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(Ll.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 oi extends(Dl=ct){constructor(e){super(e,{},"quick-diff"),this.ctx=e,this.VALID_DIFF_TYPES=Ll,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("quick-edit/wiki-page",this.injectQuickEdit.bind(this)),window.RLQ.push(this.injectHistoryPage.bind(this))}stop(){this.ctx.off("quick-edit/wiki-page",this.injectQuickEdit.bind(this))}injectHistoryPage(){const e=Rp("#mw-history-compare");if(!e)return;Dp(".mw-history-compareselectedversions-button",e).forEach(r=>{r.after(x("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 s===o?this.ctx.modal.notify("info",{content:"No chages"}):(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=x("pre",{className:Pp["diff-container"]}),s=x("div",{style:{display:"flex",gap:"1em"},children:this.VALID_DIFF_TYPES.map((o,a)=>x(Ha,{name:"diffType",value:o,label:o,inputProps:{checked:a===0}}))});r.setContent(x("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(`
85
+ `);return e?n.pop():n.push(n.pop().slice(0,-1)),n}function nm(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 rm(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(im(r.value)),r.added?e.push("</ins>"):r.removed&&e.push("</del>")}return e.join("")}function im(t){let e=t;return e=e.replace(/&/g,"&amp;"),e=e.replace(/</g,"&lt;"),e=e.replace(/>/g,"&gt;"),e=e.replace(/"/g,"&quot;"),e}const sm=Object.freeze(Object.defineProperty({__proto__:null,Diff:Lt,applyPatch:Kl,applyPatches:Zp,arrayDiff:Hl,canonicalize:fi,characterDiff:$l,convertChangesToDMP:nm,convertChangesToXML:rm,createPatch:em,createTwoFilesPatch:Ys,cssDiff:Bl,diffArrays:zl,diffChars:Cl,diffCss:Fl,diffJson:ql,diffLines:ui,diffSentences:jl,diffTrimmedLines:Dl,diffWords:Tl,diffWordsWithSpace:zs,formatPatch:di,jsonDiff:Ul,lineDiff:Ws,parsePatch:Vs,reversePatch:Yl,sentenceDiff:Ml,structuredPatch:Ks,wordDiff:Al,wordsWithSpaceDiff:Nl},Symbol.toStringTag,{value:"Module"}));class om{constructor(e){this.ctx=e,this.JsDiff=sm,this.diffChars=Cl,this.diffWords=Tl,this.diffWordsWithSpace=zs,this.diffLines=ui,this.diffTrimmedLines=Dl,this.diffSentences=jl,this.diffCss=Fl,this.diffJson=ql,this.diffArrays=zl,this.createTwoFilesPatch=Ys,this.ctx.set("jsdiff",this)}}const am={"diff-container":"_diff-container_lq0si_2"},lm=t=>{let{user:e,target:n,ctx:r}=t;const i=r.getUrl.bind(r);return w("span",{className:"mw-userlinks",children:[w("a",{href:i(`User:${e}`),className:"mw-userlink",target:n,children:e})," ",w("span",{className:"mw-usertoollinks",children:["(",w("a",{href:i(`User_talk:${e}`),className:"mw-usertoollinks-talk",target:n,children:"talk"})," | ",w("a",{href:i(`Special:Contributions/${e}`),className:"mw-usertoollinks-contribs",target:n,children:"contribs"})," | ",w("a",{href:i(`Special:Block/${e}`),className:"mw-usertoollinks-block",target:n,children:"block"}),")"]})]})};var hi=(t=>(t.update="ipe:diff-table/update",t.edit="ipe:diff-table/edit",t))(hi||{});const cm=new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"medium"}).format,Gl=t=>{let e=["diff-title"];if(t.type==="from"?e.push("diff-otitle"):t.type==="to"&&e.push("diff-ntitle"),!t.pageid||!t.userid)return w("td",{colSpan:2,className:e,children:w("div",{className:"mw-diff-title--title",children:t.type==="from"?"Original content":t.type==="to"?"Your content":""})});const n=r=>{r.preventDefault(),r.target.dispatchEvent(new CustomEvent("ipe:diff-table/edit",{detail:{revid:t.revid},bubbles:!0}))};return w("td",{colSpan:2,className:e,children:[w("div",{className:"mw-diff-title--title",children:[t.pagetitle||t.timestamp,t.revid?` (rev#${t.revid})`:""]}),w("div",{className:"mw-diff-title--actions",children:w("a",{href:t.ctx.getUrl("",{action:"edit",oldid:t.revid}),onClick:n,children:[w(Ka,{style:"width: 1em; height: 1em"}),"Quick edit"]})}),w("div",{className:"mw-diff-title--user",children:t.username&&w(lm,{ctx:t.ctx,user:t.username,target:"_blank"})}),w("div",{className:"mw-diff-title--timestamp",children:t.timestamp&&cm(new Date(t.timestamp))}),w("div",{className:"mw-diff-title--comment",children:t.parsedcomment&&w(Nt,{children:["(",w("i",{innerHTML:t.parsedcomment}),")"]})})]})},um=t=>{const e=t.data;if(!e.prev&&!e.next)return null;const n=(r,i,s)=>{r.preventDefault(),r.target.dispatchEvent(new CustomEvent("ipe:diff-table/update",{detail:{fromrev:i,torev:s},bubbles:!0}))};return w("tr",{className:"mw-diff-title--navigation",children:[w("td",{colSpan:2,children:e.prev?w("a",{href:t.ctx.getUrl("",{diff:e.prev,oldid:e.fromrevid}),onClick:r=>n(r,e.prev,e.fromrevid),children:"← Previous"}):w("i",{children:"Oldest version"})}),w("td",{colSpan:2,children:e.next?w("a",{href:t.ctx.getUrl("",{diff:e.next,oldid:e.torevid}),onClick:r=>n(r,e.torevid,e.next),children:"Next →"}):w("i",{children:"Newest version"})})]})},fm=t=>{const{data:e,...n}=t,r=w("table",{className:"theme-ipe diff diff-type-table","data-mw":"interface",...n,children:[w("colgroup",{children:[w("col",{className:"diff-marker"}),w("col",{className:"diff-content"}),w("col",{className:"diff-marker"}),w("col",{className:"diff-content"})]}),w("tbody",{children:[w("tr",{children:[w(Gl,{ctx:t.ctx,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}),w(Gl,{ctx:t.ctx,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})]}),w(um,{data:e,ctx:t.ctx}),w("div",{id:"diffbody"}),w("tr",{className:"diff-size",style:{textAlign:"center"},children:[w("td",{colSpan:2,className:"diff-size-old",children:e.fromsize!==void 0&&`${e.fromsize} bytes`}),w("td",{colSpan:2,className:"diff-size-new",children:e.tosize!==void 0&&`${e.tosize} bytes`})]})]})]});return r.querySelector("#diffbody").outerHTML=e.body||w("tr",{children:w("td",{colSpan:4,children:w("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"5rem"},children:w("i",{children:"No changes"})})})}).outerHTML,r},dm=(t,e=document)=>e.querySelector(t),hm=(t,e=document)=>e.querySelectorAll(t);var pm=Object.create,Gs=Object.defineProperty,mm=Object.getOwnPropertyDescriptor,Ql=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Jl=t=>{throw TypeError(t)},gm=(t,e,n)=>e in t?Gs(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,vm=(t,e)=>Gs(t,"name",{value:e,configurable:!0}),ym=t=>[,,,pm(t?.[Ql("metadata")]??null)],bm=["class","method","getter","setter","accessor","field","value","get","set"],Xl=t=>t!==void 0&&typeof t!="function"?Jl("Function expected"):t,wm=(t,e,n,r,i)=>({kind:bm[t],name:e,metadata:r,addInitializer:s=>n._?Jl("Already initialized"):i.push(Xl(s||null))}),_m=(t,e)=>gm(e,Ql("metadata"),t[3]),xm=(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},Sm=(t,e,n,r,i,s)=>{var o,a,l,u=e&7,c=!1,f=0,y=t[f]||(t[f]=[]),v=u&&(i=i.prototype,u<5&&(u>3||!c)&&mm(i,n));vm(i,n);for(var b=r.length-1;b>=0;b--)l=wm(u,n,a={},t[3],y),o=(0,r[b])(i,l),a._=1,Xl(o)&&(i=o);return _m(t,i),v&&Gs(i,n,v),c?u^4?s:v:i},Zl,Qs,ec;const tc=["diffChars","diffWords","diffSentences","diffLines","createTwoFilesPatch"];Zl=[ze(["jsdiff","sitemeta","getUrl"]),ir(_e.object({"quickDiff.preferredCompareMode":_e.union([_e.const("jsDiff"),_e.const("mwApi")]).description("The preferred comparison mode for quick diff").default("mwApi"),"quickDiff.jsDiff.defaultType":_e.union(tc.map(t=>_e.const(t))).description("The default diff type for JsDiff").default("diffSentences")}).description("Quick Diff Preferences"),{"quickDiff.preferredCompareMode":"mwApi","quickDiff.jsDiff.defaultType":"diffSentences"})];class pi extends(ec=rt){constructor(e){super(e,{},"quick-diff"),this.ctx=e,this.VALID_DIFF_TYPES=tc,this.COMPARE_API_DEFAULT_OPTIONS={prop:["comment","diff","diffsize","ids","parsedcomment","size","timestamp","title","user","rel"].join("|"),difftype:"table"}}start(){this.ctx.set("quickDiff",this),this.ctx.on("quick-edit/wiki-page",this.injectQuickEdit.bind(this)),window.RLQ.push(this.injectHistoryPage.bind(this))}stop(){this.ctx.off("quick-edit/wiki-page",this.injectQuickEdit.bind(this))}injectHistoryPage(){const e=dm("#mw-history-compare");if(!e)return;hm(".mw-history-compareselectedversions-button",e).forEach(r=>{r.after(w("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 s===o?this.ctx.modal.notify("info",{content:"No chages"}):(r=this.comparePages({fromtitle:i,fromtext:s,totitle:i,totext:o,topst:!0},r,{backdrop:!1,draggable:!0}),r)}},2),e.on(e.Event.Close,()=>{r?.destroy(),r=void 0})}simpleTextDiff(e,n){const r=this.ctx.modal.show({title:"Quick Diff",className:"in-page-edit ipe-quickDiff"});r.show();const i=w("pre",{className:am["diff-container"]}),s=w("div",{style:{display:"flex",gap:"1em"},children:this.VALID_DIFF_TYPES.map((o,a)=>w(il,{name:"diffType",value:o,label:o,inputProps:{checked:a===0}}))});r.setContent(w("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(x(sn,{})),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(x("section",{children:x(Tp,{data:i})}))}).catch(r=>{n.setContent(x(Ss,{title:"Failed to load diff",type:"error",children:x("pre",{children:r instanceof Error?r.message:String(r)})}))}),n.show()}}Fs=Fp(Dl),oi=zp(Fs,0,"PluginQuickDiffCore",Rl,oi),qp(Fs,1,oi);const Bo=class Bo extends ct{constructor(e){super(e,{},"quick-diff-loader"),this.ctx=e,e.plugin(Op),e.plugin(oi)}};Bo.inject=["api","wikiPage","modal"];let Bs=Bo;const Wp=Object.freeze(Object.defineProperty({__proto__:null,PluginQuickDiff:Bs},Symbol.toStringTag,{value:"Module"})),Uo=class Uo extends ct{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:x("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:[x("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),x("path",{d:"M4 21v-4a3 3 0 0 1 3 -3h5"}),x("path",{d:"M9 17l3 -3l-3 -3"}),x("path",{d:"M14 3v4a1 1 0 0 0 1 1h4"}),x("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:x(sn,{}),className:"quick-redirect compact-buttons",sizeClass:"smallToMedium",center:!0}).init();let r=null;return n.setContent(x("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:[x(Ga,{inputs:[{label:"From",name:"from",value:e?.from,required:!0},{label:"To",name:"to",value:e?.to,required:!0}]}),x(Es,{label:"Reason",id:"reason",name:"reason",value:e?.reason}),x("div",{children:x(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}};Uo.inject=["api","wikiPage","modal"];let Us=Uo;const Vp=Object.freeze(Object.defineProperty({__proto__:null,PluginQuickRedirect:Us},Symbol.toStringTag,{value:"Module"}));var Kp=Object.create,Hs=Object.defineProperty,Yp=Object.getOwnPropertyDescriptor,Nl=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Ml=t=>{throw TypeError(t)},Gp=(t,e,n)=>e in t?Hs(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Jp=(t,e)=>Hs(t,"name",{value:e,configurable:!0}),Qp=t=>[,,,Kp(t?.[Nl("metadata")]??null)],Xp=["class","method","getter","setter","accessor","field","value","get","set"],jl=t=>t!==void 0&&typeof t!="function"?Ml("Function expected"):t,Zp=(t,e,n,r,i)=>({kind:Xp[t],name:e,metadata:r,addInitializer:s=>n._?Ml("Already initialized"):i.push(jl(s||null))}),em=(t,e)=>Gp(e,Nl("metadata"),t[3]),tm=(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},nm=(t,e,n,r,i,s)=>{var o,a,l,u=e&7,c=!1,f=0,y=t[f]||(t[f]=[]),v=u&&(i=i.prototype,u<5&&(u>3||!c)&&Yp(i,n));Jp(i,n);for(var b=r.length-1;b>=0;b--)l=Zp(u,n,a={},t[3],y),o=(0,r[b])(i,l),a._=1,jl(o)&&(i=o);return em(t,i),v&&Hs(i,n,v),c?u^4?s:v:i},Fl,qs,Bl;Fl=[Gr(Se.object({toolboxAlwaysShow:Se.boolean().description("Make the toolbox opened by default").default(!1)}).description("Toolbox preferences")),Ge(["preferences"])];class ai extends(Bl=yn){constructor(e){super(e,"toolbox",!1),this.ctx=e,this.container=void 0}async start(){this.container=this.createToolbox(),this.ctx.preferences.get("toolboxAlwaysShow").then(e=>{e&&this.container.classList.add("is-persistent")}),this.setupHoverLogic(),document.body.appendChild(this.container),this.updateButtonDelays()}stop(){this.container?.remove()}setupHoverLogic(){let e=null;const n=()=>this.container.classList.contains("is-persistent");this.container.addEventListener("mouseenter",()=>{e&&(clearTimeout(e),e=null),n()||this.container.classList.add("is-hovered")}),this.container.addEventListener("mouseleave",()=>{n()||(e=window.setTimeout(()=>{this.container.classList.remove("is-hovered")},150))})}calculateButtonDelay(e,n){if(n<=1)return 0;const r=.15,i=e/(n-1),s=r*Math.sqrt(i);return Math.round(s*1e3)/1e3}updateButtonDelays(){this.container.querySelectorAll(".btn-group").forEach(n=>{const r=n.querySelectorAll(".btn-tip-group"),i=r.length;r.forEach((s,o)=>{const a=this.calculateButtonDelay(o,i);s.style.setProperty("--transition-delay",`${a}s`),s.style.setProperty("--max-transition-delay","0.15s")})})}createToolbox(){return x("div",{id:"ipe-edit-toolbox",children:[x("ul",{className:"btn-group group1",style:{display:"flex",flexDirection:"column"}}),x("ul",{className:"btn-group group2",style:{display:"flex",flexDirection:"row"}}),x("button",{className:"ipe-toolbox-btn",id:"toolbox-toggler",onClick:()=>{const i=!this.container.classList.contains("is-persistent");this.container.classList.toggle("is-persistent",i),this.ctx.preferences.set("toolboxAlwaysShow",i)},children:x("svg",{xmlns:"http://www.w3.org/2000/svg",width:"448",height:"512",viewBox:"0 0 448 512",children:[x("rect",{width:"448",height:"512",fill:"none"}),x("path",{fill:"currentColor",d:"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32"})]})})]})}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 y=this.container.querySelector(".btn-group.group1"),v=this.container.querySelector(".btn-group.group2"),b=y?.children.length||0,A=v?.children.length||0;c=b<=A?y:v}else c=this.container.querySelector(`.btn-group.${r}`);if(!c)throw new Error(`Button group ${r} not found`);const f=x("li",{class:"btn-tip-group",id:n,onClick:a,children:[x("div",{class:"btn-tip",children:s}),x("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}),this.updateButtonDelays(),f}removeButton(e){this.container.querySelector(`.ipe-toolbox-btn#${e}`)?.remove(),this.ctx.emit("toolbox/button-removed",{ctx:this.ctx,id:e}),this.updateButtonDelays()}}qs=Qp(Bl),ai=nm(qs,0,"PluginToolbox",Fl,ai),tm(qs,1,ai);const rm=Object.freeze(Object.defineProperty({__proto__:null,get PluginToolbox(){return ai}},Symbol.toStringTag,{value:"Module"}));/**
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,r){return!n||n.isDestroyed?n=this.ctx.modal.createObject({title:"Loading diff...",content:"",className:"quick-diff",center:!1,...r}).init():n.removeButton("*"),n.setContent(w("section",{style:{height:"70vh",display:"flex",justifyContent:"center",alignItems:"center"},children:w(Vt,{})})),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(i=>{if(i.data?.error||i.data?.errors){const a=[i.data?.error,...i.data?.errors||[]].filter(Boolean);throw new Error(a.map(l=>l.info).join(`
88
+ `),{cause:i})}if(!i.data.compare)throw new Error("No compare data received",{cause:i});const{data:{compare:s}}=i;n.setTitle(s.fromtitle&&s.totitle?`${s.fromtitle}${s.fromrevid?` (${s.fromrevid})`:""} ⇔ ${s.totitle}${s.torevid?` (${s.torevid})`:""}`:"Differences");let o;n.setContent(w("section",{style:{minHeight:"70vh"},children:w(fm,{ref:a=>o=a,data:s,ctx:this.ctx})})),o.addEventListener(hi.update,a=>{a.stopPropagation(),this.comparePages({fromrev:a.detail.fromrev,torev:a.detail.torev},n,r)},{once:!0}),this.ctx.inject(["quickEdit"],a=>{const l=u=>{u.stopPropagation(),a.quickEdit({revision:u.detail.revid})};o.addEventListener(hi.edit,l),n.on(n.Event.Close,()=>{o.removeEventListener(hi.edit,l)})}),s.fromrevid&&s.torevid&&n.addButton({label:"Original Compare Page",side:"right",className:"btn btn-secondary",method:()=>{window.location.href=this.ctx.getUrl("",{oldid:s.fromrevid,diff:s.torevid})}})}).catch(i=>{n.setContent(w(sr,{title:"Failed to load diff",type:"error",children:w("pre",{children:i instanceof Error?i.message:String(i)})}))}),n.show()}}Qs=ym(ec),pi=Sm(Qs,0,"PluginQuickDiffCore",Zl,pi),xm(Qs,1,pi);const Xo=class Xo extends rt{constructor(e){super(e,{},"quick-diff-loader"),this.ctx=e,e.plugin(om),e.plugin(pi)}};Xo.inject=["api","wikiPage","modal"];let Js=Xo;const Em=Object.freeze(Object.defineProperty({__proto__:null,PluginQuickDiff:Js},Symbol.toStringTag,{value:"Module"})),Zo=class Zo extends rt{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:w("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:[w("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),w("path",{d:"M4 21v-4a3 3 0 0 1 3 -3h5"}),w("path",{d:"M9 17l3 -3l-3 -3"}),w("path",{d:"M14 3v4a1 1 0 0 0 1 1h4"}),w("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",index:2,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:w(Vt,{}),className:"quick-redirect compact-buttons",sizeClass:"smallToMedium",center:!0}).init();let r=null;return n.setContent(w("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:[w(ml,{inputs:[{label:"From",name:"from",value:e?.from,required:!0},{label:"To",name:"to",value:e?.to,required:!0}]}),w(ri,{label:"Reason",id:"reason",name:"reason",value:e?.reason}),w("div",{children:w(kn,{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}};Zo.inject=["api","wikiPage","modal"];let Xs=Zo;const km=Object.freeze(Object.defineProperty({__proto__:null,PluginQuickRedirect:Xs},Symbol.toStringTag,{value:"Module"}));var $m=Object.create,Zs=Object.defineProperty,Cm=Object.getOwnPropertyDescriptor,nc=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),rc=t=>{throw TypeError(t)},Pm=(t,e,n)=>e in t?Zs(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Om=(t,e)=>Zs(t,"name",{value:e,configurable:!0}),Im=t=>[,,,$m(t?.[nc("metadata")]??null)],Am=["class","method","getter","setter","accessor","field","value","get","set"],ic=t=>t!==void 0&&typeof t!="function"?rc("Function expected"):t,Tm=(t,e,n,r,i)=>({kind:Am[t],name:e,metadata:r,addInitializer:s=>n._?rc("Already initialized"):i.push(ic(s||null))}),Rm=(t,e)=>Pm(e,nc("metadata"),t[3]),Nm=(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},Dm=(t,e,n,r,i,s)=>{var o,a,l,u=e&7,c=!1,f=0,y=t[f]||(t[f]=[]),v=u&&(i=i.prototype,u<5&&(u>3||!c)&&Cm(i,n));Om(i,n);for(var b=r.length-1;b>=0;b--)l=Tm(u,n,a={},t[3],y),o=(0,r[b])(i,l),a._=1,ic(o)&&(i=o);return Rm(t,i),v&&Zs(i,n,v),c?u^4?s:v:i},sc,eo,oc;sc=[ir(_e.object({toolboxAlwaysShow:_e.boolean().description("Make the toolbox opened by default").default(!1)}).description("Toolbox preferences")),ze(["preferences"])];class mi extends(oc=an){constructor(e){super(e,"toolbox",!1),this.ctx=e,this.container=void 0}async start(){this.container=this.createToolbox(),this.ctx.preferences.get("toolboxAlwaysShow").then(e=>{e&&this.container.classList.add("is-persistent")}),this.setupHoverLogic(),document.body.appendChild(this.container),this.updateButtonDelays()}stop(){this.container?.remove()}setupHoverLogic(){let e=null;const n=()=>this.container.classList.contains("is-persistent");this.container.addEventListener("mouseenter",()=>{e&&(clearTimeout(e),e=null),n()||this.container.classList.add("is-hovered")}),this.container.addEventListener("mouseleave",()=>{n()||(e=window.setTimeout(()=>{this.container.classList.remove("is-hovered")},150))})}calculateButtonDelay(e,n){if(n<=1)return 0;const r=.15,i=e/(n-1),s=r*Math.sqrt(i);return Math.round(s*1e3)/1e3}updateButtonDelays(){this.container.querySelectorAll(".btn-group").forEach(n=>{const r=n.querySelectorAll(".btn-tip-group"),i=r.length;r.forEach((s,o)=>{const a=this.calculateButtonDelay(o,i);s.style.setProperty("--transition-delay",`${a}s`),s.style.setProperty("--max-transition-delay","0.15s")})})}createToolbox(){return w("div",{id:"ipe-edit-toolbox",children:[w("ul",{className:"btn-group group1",style:{display:"flex",flexDirection:"column"}}),w("ul",{className:"btn-group group2",style:{display:"flex",flexDirection:"row"}}),w("button",{className:"ipe-toolbox-btn",id:"toolbox-toggler",onClick:()=>{const i=!this.container.classList.contains("is-persistent");this.container.classList.toggle("is-persistent",i),this.ctx.preferences.set("toolboxAlwaysShow",i)},children:w("svg",{xmlns:"http://www.w3.org/2000/svg",width:"448",height:"512",viewBox:"0 0 448 512",children:[w("rect",{width:"448",height:"512",fill:"none"}),w("path",{fill:"currentColor",d:"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32"})]})})]})}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 y=this.container.querySelector(".btn-group.group1"),v=this.container.querySelector(".btn-group.group2"),b=y?.children.length||0,A=v?.children.length||0;c=b<=A?y:v}else c=this.container.querySelector(`.btn-group.${r}`);if(!c)throw new Error(`Button group ${r} not found`);const f=w("li",{class:"btn-tip-group",id:n,onClick:a,children:[w("div",{class:"btn-tip",children:s}),w("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}),this.updateButtonDelays(),f}removeButton(e){this.container.querySelector(`.ipe-toolbox-btn#${e}`)?.remove(),this.ctx.emit("toolbox/button-removed",{ctx:this.ctx,id:e}),this.updateButtonDelays()}}eo=Im(oc),mi=Dm(eo,0,"PluginToolbox",sc,mi),Nm(eo,1,mi);const Lm=Object.freeze(Object.defineProperty({__proto__:null,get PluginToolbox(){return mi}},Symbol.toStringTag,{value:"Module"}));/**
89
89
  * @vue/shared v3.5.22
90
90
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
91
91
  * @license MIT
92
- **/function zs(t){const e=Object.create(null);for(const n of t.split(","))e[n]=1;return n=>n in e}const he={},xn=[],wt=()=>{},Ul=()=>!1,li=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97),Ws=t=>t.startsWith("onUpdate:"),Ne=Object.assign,Vs=(t,e)=>{const n=t.indexOf(e);n>-1&&t.splice(n,1)},im=Object.prototype.hasOwnProperty,pe=(t,e)=>im.call(t,e),se=Array.isArray,Sn=t=>ci(t)==="[object Map]",Hl=t=>ci(t)==="[object Set]",oe=t=>typeof t=="function",ke=t=>typeof t=="string",zt=t=>typeof t=="symbol",xe=t=>t!==null&&typeof t=="object",ql=t=>(xe(t)||oe(t))&&oe(t.then)&&oe(t.catch),zl=Object.prototype.toString,ci=t=>zl.call(t),sm=t=>ci(t).slice(8,-1),Wl=t=>ci(t)==="[object Object]",Ks=t=>ke(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,rr=zs(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),ui=t=>{const e=Object.create(null);return n=>e[n]||(e[n]=t(n))},om=/-\w/g,Dt=ui(t=>t.replace(om,e=>e.slice(1).toUpperCase())),am=/\B([A-Z])/g,Wt=ui(t=>t.replace(am,"-$1").toLowerCase()),Vl=ui(t=>t.charAt(0).toUpperCase()+t.slice(1)),Ys=ui(t=>t?`on${Vl(t)}`:""),Ze=(t,e)=>!Object.is(t,e),Gs=(t,...e)=>{for(let n=0;n<t.length;n++)t[n](...e)},Kl=(t,e,n,r=!1)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,writable:r,value:n})},lm=t=>{const e=parseFloat(t);return isNaN(e)?t:e};let Yl;const fi=()=>Yl||(Yl=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Js(t){if(se(t)){const e={};for(let n=0;n<t.length;n++){const r=t[n],i=ke(r)?dm(r):Js(r);if(i)for(const s in i)e[s]=i[s]}return e}else if(ke(t)||xe(t))return t}const cm=/;(?![^(]*\))/g,um=/:([^]+)/,fm=/\/\*[^]*?\*\//g;function dm(t){const e={};return t.replace(fm,"").split(cm).forEach(n=>{if(n){const r=n.split(um);r.length>1&&(e[r[0].trim()]=r[1].trim())}}),e}function di(t){let e="";if(ke(t))e=t;else if(se(t))for(let n=0;n<t.length;n++){const r=di(t[n]);r&&(e+=r+" ")}else if(xe(t))for(const n in t)t[n]&&(e+=n+" ");return e.trim()}const hm=zs("itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly");function Gl(t){return!!t||t===""}const Jl=t=>!!(t&&t.__v_isRef===!0),Qs=t=>ke(t)?t:t==null?"":se(t)||xe(t)&&(t.toString===zl||!oe(t.toString))?Jl(t)?Qs(t.value):JSON.stringify(t,Ql,2):String(t),Ql=(t,e)=>Jl(e)?Ql(t,e.value):Sn(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((n,[r,i],s)=>(n[Xs(r,s)+" =>"]=i,n),{})}:Hl(e)?{[`Set(${e.size})`]:[...e.values()].map(n=>Xs(n))}:zt(e)?Xs(e):xe(e)&&!se(e)&&!Wl(e)?String(e):e,Xs=(t,e="")=>{var n;return zt(t)?`Symbol(${(n=t.description)!=null?n:e})`:t};/**
92
+ **/function to(t){const e=Object.create(null);for(const n of t.split(","))e[n]=1;return n=>n in e}const he={},$n=[],St=()=>{},ac=()=>!1,gi=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97),no=t=>t.startsWith("onUpdate:"),Le=Object.assign,ro=(t,e)=>{const n=t.indexOf(e);n>-1&&t.splice(n,1)},Mm=Object.prototype.hasOwnProperty,pe=(t,e)=>Mm.call(t,e),se=Array.isArray,Cn=t=>vi(t)==="[object Map]",lc=t=>vi(t)==="[object Set]",oe=t=>typeof t=="function",$e=t=>typeof t=="string",Yt=t=>typeof t=="symbol",Se=t=>t!==null&&typeof t=="object",cc=t=>(Se(t)||oe(t))&&oe(t.then)&&oe(t.catch),uc=Object.prototype.toString,vi=t=>uc.call(t),jm=t=>vi(t).slice(8,-1),fc=t=>vi(t)==="[object Object]",io=t=>$e(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,cr=to(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),yi=t=>{const e=Object.create(null);return n=>e[n]||(e[n]=t(n))},Bm=/-\w/g,Mt=yi(t=>t.replace(Bm,e=>e.slice(1).toUpperCase())),Fm=/\B([A-Z])/g,Gt=yi(t=>t.replace(Fm,"-$1").toLowerCase()),dc=yi(t=>t.charAt(0).toUpperCase()+t.slice(1)),so=yi(t=>t?`on${dc(t)}`:""),Ze=(t,e)=>!Object.is(t,e),oo=(t,...e)=>{for(let n=0;n<t.length;n++)t[n](...e)},hc=(t,e,n,r=!1)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,writable:r,value:n})},Um=t=>{const e=parseFloat(t);return isNaN(e)?t:e};let pc;const bi=()=>pc||(pc=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function ao(t){if(se(t)){const e={};for(let n=0;n<t.length;n++){const r=t[n],i=$e(r)?Wm(r):ao(r);if(i)for(const s in i)e[s]=i[s]}return e}else if($e(t)||Se(t))return t}const qm=/;(?![^(]*\))/g,Hm=/:([^]+)/,zm=/\/\*[^]*?\*\//g;function Wm(t){const e={};return t.replace(zm,"").split(qm).forEach(n=>{if(n){const r=n.split(Hm);r.length>1&&(e[r[0].trim()]=r[1].trim())}}),e}function wi(t){let e="";if($e(t))e=t;else if(se(t))for(let n=0;n<t.length;n++){const r=wi(t[n]);r&&(e+=r+" ")}else if(Se(t))for(const n in t)t[n]&&(e+=n+" ");return e.trim()}const Vm=to("itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly");function mc(t){return!!t||t===""}const gc=t=>!!(t&&t.__v_isRef===!0),lo=t=>$e(t)?t:t==null?"":se(t)||Se(t)&&(t.toString===uc||!oe(t.toString))?gc(t)?lo(t.value):JSON.stringify(t,vc,2):String(t),vc=(t,e)=>gc(e)?vc(t,e.value):Cn(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((n,[r,i],s)=>(n[co(r,s)+" =>"]=i,n),{})}:lc(e)?{[`Set(${e.size})`]:[...e.values()].map(n=>co(n))}:Yt(e)?co(e):Se(e)&&!se(e)&&!fc(e)?String(e):e,co=(t,e="")=>{var n;return Yt(t)?`Symbol(${(n=t.description)!=null?n:e})`:t};/**
93
93
  * @vue/reactivity v3.5.22
94
94
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
95
95
  * @license MIT
96
- **/let et;class pm{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 mm(){return et}let we;const Zs=new WeakSet;class Xl{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,Zs.has(this)&&(Zs.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||ec(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,sc(this),tc(this);const e=we,n=gt;we=this,gt=!0;try{return this.fn()}finally{nc(this),we=e,gt=n,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)ro(e);this.deps=this.depsTail=void 0,sc(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?Zs.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){no(this)&&this.run()}get dirty(){return no(this)}}let Zl=0,ir,sr;function ec(t,e=!1){if(t.flags|=8,e){t.next=sr,sr=t;return}t.next=ir,ir=t}function eo(){Zl++}function to(){if(--Zl>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 tc(t){for(let e=t.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function nc(t){let e,n=t.depsTail,r=n;for(;r;){const i=r.prevDep;r.version===-1?(r===n&&(n=i),ro(r),gm(r)):e=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=i}t.deps=e,t.depsTail=n}function no(t){for(let e=t.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(rc(e.dep.computed)||e.dep.version!==e.version))return!0;return!!t._dirty}function rc(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||!no(t))))return;t.flags|=2;const e=t.dep,n=we,r=gt;we=t,gt=!0;try{tc(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,gt=r,nc(t),t.flags&=-3}}function ro(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)ro(s,!0)}!e&&!--n.sc&&n.map&&n.map.delete(n.key)}function gm(t){const{prevDep:e,nextDep:n}=t;e&&(e.nextDep=n,t.prevDep=void 0),n&&(n.prevDep=e,t.nextDep=void 0)}let gt=!0;const ic=[];function xt(){ic.push(gt),gt=!1}function St(){const t=ic.pop();gt=t===void 0?!0:t}function sc(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 ym{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||!gt||we===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==we)n=this.activeLink=new ym(we,this),we.deps?(n.prevDep=we.depsTail,we.depsTail.nextDep=n,we.depsTail=n):we.deps=we.depsTail=n,oc(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){eo();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{to()}}}function oc(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)oc(r)}const n=t.dep.subs;n!==t&&(t.prevSub=n,n&&(n.nextSub=t)),t.dep.subs=t}}const io=new WeakMap,an=Symbol(""),so=Symbol(""),ar=Symbol("");function qe(t,e,n){if(gt&&we){let r=io.get(t);r||io.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 Lt(t,e,n,r,i,s){const o=io.get(t);if(!o){or++;return}const a=l=>{l&&l.trigger()};if(eo(),e==="clear")o.forEach(a);else{const l=se(t),u=l&&Ks(n);if(l&&n==="length"){const c=Number(r);o.forEach((f,y)=>{(y==="length"||y===ar||!zt(y)&&y>=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(an)),Sn(t)&&a(o.get(so)));break;case"delete":l||(a(o.get(an)),Sn(t)&&a(o.get(so)));break;case"set":Sn(t)&&a(o.get(an));break}}to()}function En(t){const e=fe(t);return e===t?e:(qe(e,"iterate",ar),ut(t)?e:e.map(Me))}function pi(t){return qe(t=fe(t),"iterate",ar),t}const vm={__proto__:null,[Symbol.iterator](){return oo(this,Symbol.iterator,Me)},concat(...t){return En(this).concat(...t.map(e=>se(e)?En(e):e))},entries(){return oo(this,"entries",t=>(t[1]=Me(t[1]),t))},every(t,e){return Nt(this,"every",t,e,void 0,arguments)},filter(t,e){return Nt(this,"filter",t,e,n=>n.map(Me),arguments)},find(t,e){return Nt(this,"find",t,e,Me,arguments)},findIndex(t,e){return Nt(this,"findIndex",t,e,void 0,arguments)},findLast(t,e){return Nt(this,"findLast",t,e,Me,arguments)},findLastIndex(t,e){return Nt(this,"findLastIndex",t,e,void 0,arguments)},forEach(t,e){return Nt(this,"forEach",t,e,void 0,arguments)},includes(...t){return ao(this,"includes",t)},indexOf(...t){return ao(this,"indexOf",t)},join(t){return En(this).join(t)},lastIndexOf(...t){return ao(this,"lastIndexOf",t)},map(t,e){return Nt(this,"map",t,e,void 0,arguments)},pop(){return lr(this,"pop")},push(...t){return lr(this,"push",t)},reduce(t,...e){return ac(this,"reduce",t,e)},reduceRight(t,...e){return ac(this,"reduceRight",t,e)},shift(){return lr(this,"shift")},some(t,e){return Nt(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 oo(this,"values",Me)}};function oo(t,e,n){const r=pi(t),i=r[e]();return r!==t&&!ut(t)&&(i._next=i.next,i.next=()=>{const s=i._next();return s.done||(s.value=n(s.value)),s}),i}const bm=Array.prototype;function Nt(t,e,n,r,i,s){const o=pi(t),a=o!==t&&!ut(t),l=o[e];if(l!==bm[e]){const f=l.apply(t,s);return a?Me(f):f}let u=n;o!==t&&(a?u=function(f,y){return n.call(this,Me(f),y,t)}:n.length>2&&(u=function(f,y){return n.call(this,f,y,t)}));const c=l.call(o,u,r);return a&&i?i(c):c}function ac(t,e,n,r){const i=pi(t);let s=n;return i!==t&&(ut(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,Me(a),l,t)}),i[e](s,...r)}function ao(t,e,n){const r=fe(t);qe(r,"iterate",ar);const i=r[e](...n);return(i===-1||i===!1)&&fo(n[0])?(n[0]=fe(n[0]),r[e](...n)):i}function lr(t,e,n=[]){xt(),eo();const r=fe(t)[e].apply(t,n);return to(),St(),r}const _m=zs("__proto__,__v_isRef,__isVue"),lc=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(zt));function wm(t){zt(t)||(t=String(t));const e=fe(this);return qe(e,"has",t),e.hasOwnProperty(t)}class cc{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?mc:pc:s?hc:dc).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(r)?e:void 0;const o=se(e);if(!i){let l;if(o&&(l=vm[n]))return l;if(n==="hasOwnProperty")return wm}const a=Reflect.get(e,n,De(e)?e:r);if((zt(n)?lc.has(n):_m(n))||(i||qe(e,"get",n),s))return a;if(De(a)){const l=o&&Ks(n)?a:a.value;return i&&xe(l)?uo(l):l}return xe(a)?i?uo(a):co(a):a}}class uc extends cc{constructor(e=!1){super(!1,e)}set(e,n,r,i){let s=e[n];if(!this._isShallow){const l=Vt(s);if(!ut(r)&&!Vt(r)&&(s=fe(s),r=fe(r)),!se(e)&&De(s)&&!De(r))return l||(s.value=r),!0}const o=se(e)&&Ks(n)?Number(n)<e.length:pe(e,n),a=Reflect.set(e,n,r,De(e)?e:i);return e===fe(i)&&(o?Ze(r,s)&&Lt(e,"set",n,r):Lt(e,"add",n,r)),a}deleteProperty(e,n){const r=pe(e,n);e[n];const i=Reflect.deleteProperty(e,n);return i&&r&&Lt(e,"delete",n,void 0),i}has(e,n){const r=Reflect.has(e,n);return(!zt(n)||!lc.has(n))&&qe(e,"has",n),r}ownKeys(e){return qe(e,"iterate",se(e)?"length":an),Reflect.ownKeys(e)}}class fc extends cc{constructor(e=!1){super(!0,e)}set(e,n){return!0}deleteProperty(e,n){return!0}}const xm=new uc,Sm=new fc,Em=new uc(!0),$m=new fc(!0),lo=t=>t,mi=t=>Reflect.getPrototypeOf(t);function km(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?lo:e?bi:Me;return!e&&qe(s,"iterate",l?so:an),{next(){const{value:f,done:y}=u.next();return y?{value:f,done:y}:{value:a?[c(f[0]),c(f[1])]:c(f),done:y}},[Symbol.iterator](){return this}}}}function gi(t){return function(...e){return t==="delete"?!1:t==="clear"?void 0:this}}function Cm(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}=mi(o),u=e?lo:t?bi:Me;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",an),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?lo:t?bi:Me;return!t&&qe(l,"iterate",an),a.forEach((c,f)=>i.call(s,u(c),u(f),o))}};return Ne(n,t?{add:gi("add"),set:gi("set"),delete:gi("delete"),clear:gi("clear")}:{add(i){!e&&!ut(i)&&!Vt(i)&&(i=fe(i));const s=fe(this);return mi(s).has.call(s,i)||(s.add(i),Lt(s,"add",i,i)),this},set(i,s){!e&&!ut(s)&&!Vt(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?Ze(s,c)&&Lt(o,"set",i,s):Lt(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&&Lt(s,"delete",i,void 0),u},clear(){const i=fe(this),s=i.size!==0,o=i.clear();return s&&Lt(i,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(i=>{n[i]=km(i,t,e)}),n}function yi(t,e){const n=Cm(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 Om={get:yi(!1,!1)},Pm={get:yi(!1,!0)},Am={get:yi(!0,!1)},Im={get:yi(!0,!0)},dc=new WeakMap,hc=new WeakMap,pc=new WeakMap,mc=new WeakMap;function Tm(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Rm(t){return t.__v_skip||!Object.isExtensible(t)?0:Tm(sm(t))}function co(t){return Vt(t)?t:vi(t,!1,xm,Om,dc)}function Dm(t){return vi(t,!1,Em,Pm,hc)}function uo(t){return vi(t,!0,Sm,Am,pc)}function Yv(t){return vi(t,!0,$m,Im,mc)}function vi(t,e,n,r,i){if(!xe(t)||t.__v_raw&&!(e&&t.__v_isReactive))return t;const s=Rm(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 Vt(t)?$n(t.__v_raw):!!(t&&t.__v_isReactive)}function Vt(t){return!!(t&&t.__v_isReadonly)}function ut(t){return!!(t&&t.__v_isShallow)}function fo(t){return t?!!t.__v_raw:!1}function fe(t){const e=t&&t.__v_raw;return e?fe(e):t}function Lm(t){return!pe(t,"__v_skip")&&Object.isExtensible(t)&&Kl(t,"__v_skip",!0),t}const Me=t=>xe(t)?co(t):t,bi=t=>xe(t)?uo(t):t;function De(t){return t?t.__v_isRef===!0:!1}function gc(t){return yc(t,!1)}function _i(t){return yc(t,!0)}function yc(t,e){return De(t)?t:new Nm(t,e)}class Nm{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:Me(e),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(e){const n=this._rawValue,r=this.__v_isShallow||ut(e)||Vt(e);e=r?e:fe(e),Ze(e,n)&&(this._rawValue=e,this._value=r?e:Me(e),this.dep.trigger())}}function vc(t){return De(t)?t.value:t}const Mm={get:(t,e,n)=>e==="__v_raw"?t:vc(Reflect.get(t,e,n)),set:(t,e,n,r)=>{const i=t[e];return De(i)&&!De(n)?(i.value=n,!0):Reflect.set(t,e,n,r)}};function bc(t){return $n(t)?t:new Proxy(t,Mm)}class jm{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 Fm(t){return new jm(t)}class Bm{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=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 ec(this,!0),!0}get value(){const e=this.dep.track();return rc(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function Um(t,e,n=!1){let r,i;return oe(t)?r=t:(r=t.get,i=t.set),new Bm(r,i,n)}const wi={},xi=new WeakMap;let ln;function Hm(t,e=!1,n=ln){if(n){let r=xi.get(n);r||xi.set(n,r=[]),r.push(t)}}function qm(t,e,n=he){const{immediate:r,deep:i,once:s,scheduler:o,augmentJob:a,call:l}=n,u=p=>i?p:ut(p)||i===!1||i===0?Kt(p,1):Kt(p);let c,f,y,v,b=!1,A=!1;if(De(t)?(f=()=>t.value,b=ut(t)):$n(t)?(f=()=>u(t),b=!0):se(t)?(A=!0,b=t.some(p=>$n(p)||ut(p)),f=()=>t.map(p=>{if(De(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(y){xt();try{y()}finally{St()}}const p=ln;ln=c;try{return l?l(t,3,[v]):t(v)}finally{ln=p}}:f=wt,e&&i){const p=f,h=i===!0?1/0:i;f=()=>Kt(p(),h)}const U=mm(),L=()=>{c.stop(),U&&U.active&&Vs(U.effects,c)};if(s&&e){const p=e;e=(...h)=>{p(...h),L()}}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||b||(A?h.some((S,P)=>Ze(S,I[P])):Ze(h,I))){y&&y();const S=ln;ln=c;try{const P=[h,I===wi?void 0:A&&I[0]===wi?[]:I,v];I=h,l?l(e,3,P):e(...P)}finally{ln=S}}}else c.run()};return a&&a(g),c=new Xl(f),c.scheduler=o?()=>o(g,!1):g,v=p=>Hm(p,!1,c),y=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(),L.pause=c.pause.bind(c),L.resume=c.resume.bind(c),L.stop=L,L}function Kt(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--,De(t))Kt(t.value,e,n);else if(se(t))for(let r=0;r<t.length;r++)Kt(t[r],e,n);else if(Hl(t)||Sn(t))t.forEach(r=>{Kt(r,e,n)});else if(Wl(t)){for(const r in t)Kt(t[r],e,n);for(const r of Object.getOwnPropertySymbols(t))Object.prototype.propertyIsEnumerable.call(t,r)&&Kt(t[r],e,n)}return t}/**
96
+ **/let et;class Km{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 Ym(){return et}let xe;const uo=new WeakSet;class yc{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,uo.has(this)&&(uo.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||wc(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,kc(this),_c(this);const e=xe,n=gt;xe=this,gt=!0;try{return this.fn()}finally{xc(this),xe=e,gt=n,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)mo(e);this.deps=this.depsTail=void 0,kc(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?uo.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){po(this)&&this.run()}get dirty(){return po(this)}}let bc=0,ur,fr;function wc(t,e=!1){if(t.flags|=8,e){t.next=fr,fr=t;return}t.next=ur,ur=t}function fo(){bc++}function ho(){if(--bc>0)return;if(fr){let e=fr;for(fr=void 0;e;){const n=e.next;e.next=void 0,e.flags&=-9,e=n}}let t;for(;ur;){let e=ur;for(ur=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 _c(t){for(let e=t.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function xc(t){let e,n=t.depsTail,r=n;for(;r;){const i=r.prevDep;r.version===-1?(r===n&&(n=i),mo(r),Gm(r)):e=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=i}t.deps=e,t.depsTail=n}function po(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===dr)||(t.globalVersion=dr,!t.isSSR&&t.flags&128&&(!t.deps&&!t._dirty||!po(t))))return;t.flags|=2;const e=t.dep,n=xe,r=gt;xe=t,gt=!0;try{_c(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{xe=n,gt=r,xc(t),t.flags&=-3}}function mo(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)mo(s,!0)}!e&&!--n.sc&&n.map&&n.map.delete(n.key)}function Gm(t){const{prevDep:e,nextDep:n}=t;e&&(e.nextDep=n,t.prevDep=void 0),n&&(n.prevDep=e,t.nextDep=void 0)}let gt=!0;const Ec=[];function Et(){Ec.push(gt),gt=!1}function kt(){const t=Ec.pop();gt=t===void 0?!0:t}function kc(t){const{cleanup:e}=t;if(t.cleanup=void 0,e){const n=xe;xe=void 0;try{e()}finally{xe=n}}}let dr=0;class Qm{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 _i{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(!xe||!gt||xe===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==xe)n=this.activeLink=new Qm(xe,this),xe.deps?(n.prevDep=xe.depsTail,xe.depsTail.nextDep=n,xe.depsTail=n):xe.deps=xe.depsTail=n,$c(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=xe.depsTail,n.nextDep=void 0,xe.depsTail.nextDep=n,xe.depsTail=n,xe.deps===n&&(xe.deps=r)}return n}trigger(e){this.version++,dr++,this.notify(e)}notify(e){fo();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{ho()}}}function $c(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)$c(r)}const n=t.dep.subs;n!==t&&(t.prevSub=n,n&&(n.nextSub=t)),t.dep.subs=t}}const go=new WeakMap,fn=Symbol(""),vo=Symbol(""),hr=Symbol("");function He(t,e,n){if(gt&&xe){let r=go.get(t);r||go.set(t,r=new Map);let i=r.get(n);i||(r.set(n,i=new _i),i.map=r,i.key=n),i.track()}}function jt(t,e,n,r,i,s){const o=go.get(t);if(!o){dr++;return}const a=l=>{l&&l.trigger()};if(fo(),e==="clear")o.forEach(a);else{const l=se(t),u=l&&io(n);if(l&&n==="length"){const c=Number(r);o.forEach((f,y)=>{(y==="length"||y===hr||!Yt(y)&&y>=c)&&a(f)})}else switch((n!==void 0||o.has(void 0))&&a(o.get(n)),u&&a(o.get(hr)),e){case"add":l?u&&a(o.get("length")):(a(o.get(fn)),Cn(t)&&a(o.get(vo)));break;case"delete":l||(a(o.get(fn)),Cn(t)&&a(o.get(vo)));break;case"set":Cn(t)&&a(o.get(fn));break}}ho()}function Pn(t){const e=fe(t);return e===t?e:(He(e,"iterate",hr),ut(t)?e:e.map(Me))}function xi(t){return He(t=fe(t),"iterate",hr),t}const Jm={__proto__:null,[Symbol.iterator](){return yo(this,Symbol.iterator,Me)},concat(...t){return Pn(this).concat(...t.map(e=>se(e)?Pn(e):e))},entries(){return yo(this,"entries",t=>(t[1]=Me(t[1]),t))},every(t,e){return Bt(this,"every",t,e,void 0,arguments)},filter(t,e){return Bt(this,"filter",t,e,n=>n.map(Me),arguments)},find(t,e){return Bt(this,"find",t,e,Me,arguments)},findIndex(t,e){return Bt(this,"findIndex",t,e,void 0,arguments)},findLast(t,e){return Bt(this,"findLast",t,e,Me,arguments)},findLastIndex(t,e){return Bt(this,"findLastIndex",t,e,void 0,arguments)},forEach(t,e){return Bt(this,"forEach",t,e,void 0,arguments)},includes(...t){return bo(this,"includes",t)},indexOf(...t){return bo(this,"indexOf",t)},join(t){return Pn(this).join(t)},lastIndexOf(...t){return bo(this,"lastIndexOf",t)},map(t,e){return Bt(this,"map",t,e,void 0,arguments)},pop(){return pr(this,"pop")},push(...t){return pr(this,"push",t)},reduce(t,...e){return Cc(this,"reduce",t,e)},reduceRight(t,...e){return Cc(this,"reduceRight",t,e)},shift(){return pr(this,"shift")},some(t,e){return Bt(this,"some",t,e,void 0,arguments)},splice(...t){return pr(this,"splice",t)},toReversed(){return Pn(this).toReversed()},toSorted(t){return Pn(this).toSorted(t)},toSpliced(...t){return Pn(this).toSpliced(...t)},unshift(...t){return pr(this,"unshift",t)},values(){return yo(this,"values",Me)}};function yo(t,e,n){const r=xi(t),i=r[e]();return r!==t&&!ut(t)&&(i._next=i.next,i.next=()=>{const s=i._next();return s.done||(s.value=n(s.value)),s}),i}const Xm=Array.prototype;function Bt(t,e,n,r,i,s){const o=xi(t),a=o!==t&&!ut(t),l=o[e];if(l!==Xm[e]){const f=l.apply(t,s);return a?Me(f):f}let u=n;o!==t&&(a?u=function(f,y){return n.call(this,Me(f),y,t)}:n.length>2&&(u=function(f,y){return n.call(this,f,y,t)}));const c=l.call(o,u,r);return a&&i?i(c):c}function Cc(t,e,n,r){const i=xi(t);let s=n;return i!==t&&(ut(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,Me(a),l,t)}),i[e](s,...r)}function bo(t,e,n){const r=fe(t);He(r,"iterate",hr);const i=r[e](...n);return(i===-1||i===!1)&&So(n[0])?(n[0]=fe(n[0]),r[e](...n)):i}function pr(t,e,n=[]){Et(),fo();const r=fe(t)[e].apply(t,n);return ho(),kt(),r}const Zm=to("__proto__,__v_isRef,__isVue"),Pc=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(Yt));function eg(t){Yt(t)||(t=String(t));const e=fe(this);return He(e,"has",t),e.hasOwnProperty(t)}class Oc{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?Dc:Nc:s?Rc:Tc).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(r)?e:void 0;const o=se(e);if(!i){let l;if(o&&(l=Jm[n]))return l;if(n==="hasOwnProperty")return eg}const a=Reflect.get(e,n,Ne(e)?e:r);if((Yt(n)?Pc.has(n):Zm(n))||(i||He(e,"get",n),s))return a;if(Ne(a)){const l=o&&io(n)?a:a.value;return i&&Se(l)?xo(l):l}return Se(a)?i?xo(a):_o(a):a}}class Ic extends Oc{constructor(e=!1){super(!1,e)}set(e,n,r,i){let s=e[n];if(!this._isShallow){const l=Qt(s);if(!ut(r)&&!Qt(r)&&(s=fe(s),r=fe(r)),!se(e)&&Ne(s)&&!Ne(r))return l||(s.value=r),!0}const o=se(e)&&io(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)&&jt(e,"set",n,r):jt(e,"add",n,r)),a}deleteProperty(e,n){const r=pe(e,n);e[n];const i=Reflect.deleteProperty(e,n);return i&&r&&jt(e,"delete",n,void 0),i}has(e,n){const r=Reflect.has(e,n);return(!Yt(n)||!Pc.has(n))&&He(e,"has",n),r}ownKeys(e){return He(e,"iterate",se(e)?"length":fn),Reflect.ownKeys(e)}}class Ac extends Oc{constructor(e=!1){super(!0,e)}set(e,n){return!0}deleteProperty(e,n){return!0}}const tg=new Ic,ng=new Ac,rg=new Ic(!0),ig=new Ac(!0),wo=t=>t,Si=t=>Reflect.getPrototypeOf(t);function sg(t,e,n){return function(...r){const i=this.__v_raw,s=fe(i),o=Cn(s),a=t==="entries"||t===Symbol.iterator&&o,l=t==="keys"&&o,u=i[t](...r),c=n?wo:e?Ci:Me;return!e&&He(s,"iterate",l?vo:fn),{next(){const{value:f,done:y}=u.next();return y?{value:f,done:y}:{value:a?[c(f[0]),c(f[1])]:c(f),done:y}},[Symbol.iterator](){return this}}}}function Ei(t){return function(...e){return t==="delete"?!1:t==="clear"?void 0:this}}function og(t,e){const n={get(i){const s=this.__v_raw,o=fe(s),a=fe(i);t||(Ze(i,a)&&He(o,"get",i),He(o,"get",a));const{has:l}=Si(o),u=e?wo:t?Ci:Me;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",fn),i.size},has(i){const s=this.__v_raw,o=fe(s),a=fe(i);return t||(Ze(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?wo:t?Ci:Me;return!t&&He(l,"iterate",fn),a.forEach((c,f)=>i.call(s,u(c),u(f),o))}};return Le(n,t?{add:Ei("add"),set:Ei("set"),delete:Ei("delete"),clear:Ei("clear")}:{add(i){!e&&!ut(i)&&!Qt(i)&&(i=fe(i));const s=fe(this);return Si(s).has.call(s,i)||(s.add(i),jt(s,"add",i,i)),this},set(i,s){!e&&!ut(s)&&!Qt(s)&&(s=fe(s));const o=fe(this),{has:a,get:l}=Si(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)&&jt(o,"set",i,s):jt(o,"add",i,s),this},delete(i){const s=fe(this),{has:o,get:a}=Si(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&&jt(s,"delete",i,void 0),u},clear(){const i=fe(this),s=i.size!==0,o=i.clear();return s&&jt(i,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(i=>{n[i]=sg(i,t,e)}),n}function ki(t,e){const n=og(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 ag={get:ki(!1,!1)},lg={get:ki(!1,!0)},cg={get:ki(!0,!1)},ug={get:ki(!0,!0)},Tc=new WeakMap,Rc=new WeakMap,Nc=new WeakMap,Dc=new WeakMap;function fg(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function dg(t){return t.__v_skip||!Object.isExtensible(t)?0:fg(jm(t))}function _o(t){return Qt(t)?t:$i(t,!1,tg,ag,Tc)}function hg(t){return $i(t,!1,rg,lg,Rc)}function xo(t){return $i(t,!0,ng,cg,Nc)}function Pb(t){return $i(t,!0,ig,ug,Dc)}function $i(t,e,n,r,i){if(!Se(t)||t.__v_raw&&!(e&&t.__v_isReactive))return t;const s=dg(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 On(t){return Qt(t)?On(t.__v_raw):!!(t&&t.__v_isReactive)}function Qt(t){return!!(t&&t.__v_isReadonly)}function ut(t){return!!(t&&t.__v_isShallow)}function So(t){return t?!!t.__v_raw:!1}function fe(t){const e=t&&t.__v_raw;return e?fe(e):t}function pg(t){return!pe(t,"__v_skip")&&Object.isExtensible(t)&&hc(t,"__v_skip",!0),t}const Me=t=>Se(t)?_o(t):t,Ci=t=>Se(t)?xo(t):t;function Ne(t){return t?t.__v_isRef===!0:!1}function Lc(t){return Mc(t,!1)}function Pi(t){return Mc(t,!0)}function Mc(t,e){return Ne(t)?t:new mg(t,e)}class mg{constructor(e,n){this.dep=new _i,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?e:fe(e),this._value=n?e:Me(e),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(e){const n=this._rawValue,r=this.__v_isShallow||ut(e)||Qt(e);e=r?e:fe(e),Ze(e,n)&&(this._rawValue=e,this._value=r?e:Me(e),this.dep.trigger())}}function jc(t){return Ne(t)?t.value:t}const gg={get:(t,e,n)=>e==="__v_raw"?t:jc(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 Bc(t){return On(t)?t:new Proxy(t,gg)}class vg{constructor(e){this.__v_isRef=!0,this._value=void 0;const n=this.dep=new _i,{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 yg(t){return new vg(t)}class bg{constructor(e,n,r){this.fn=e,this.setter=n,this._value=void 0,this.dep=new _i(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=dr-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&xe!==this)return wc(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 wg(t,e,n=!1){let r,i;return oe(t)?r=t:(r=t.get,i=t.set),new bg(r,i,n)}const Oi={},Ii=new WeakMap;let dn;function _g(t,e=!1,n=dn){if(n){let r=Ii.get(n);r||Ii.set(n,r=[]),r.push(t)}}function xg(t,e,n=he){const{immediate:r,deep:i,once:s,scheduler:o,augmentJob:a,call:l}=n,u=p=>i?p:ut(p)||i===!1||i===0?Jt(p,1):Jt(p);let c,f,y,v,b=!1,A=!1;if(Ne(t)?(f=()=>t.value,b=ut(t)):On(t)?(f=()=>u(t),b=!0):se(t)?(A=!0,b=t.some(p=>On(p)||ut(p)),f=()=>t.map(p=>{if(Ne(p))return p.value;if(On(p))return u(p);if(oe(p))return l?l(p,2):p()})):oe(t)?e?f=l?()=>l(t,2):t:f=()=>{if(y){Et();try{y()}finally{kt()}}const p=dn;dn=c;try{return l?l(t,3,[v]):t(v)}finally{dn=p}}:f=St,e&&i){const p=f,h=i===!0?1/0:i;f=()=>Jt(p(),h)}const U=Ym(),D=()=>{c.stop(),U&&U.active&&ro(U.effects,c)};if(s&&e){const p=e;e=(...h)=>{p(...h),D()}}let I=A?new Array(t.length).fill(Oi):Oi;const g=p=>{if(!(!(c.flags&1)||!c.dirty&&!p))if(e){const h=c.run();if(i||b||(A?h.some((S,O)=>Ze(S,I[O])):Ze(h,I))){y&&y();const S=dn;dn=c;try{const O=[h,I===Oi?void 0:A&&I[0]===Oi?[]:I,v];I=h,l?l(e,3,O):e(...O)}finally{dn=S}}}else c.run()};return a&&a(g),c=new yc(f),c.scheduler=o?()=>o(g,!1):g,v=p=>_g(p,!1,c),y=c.onStop=()=>{const p=Ii.get(c);if(p){if(l)l(p,4);else for(const h of p)h();Ii.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||!Se(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(lc(t)||Cn(t))t.forEach(r=>{Jt(r,e,n)});else if(fc(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
97
  * @vue/runtime-core v3.5.22
98
98
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
99
99
  * @license MIT
100
- **/const cr=[];let ho=!1;function Gv(t,...e){if(ho)return;ho=!0,xt();const n=cr.length?cr[cr.length-1].component:null,r=n&&n.appContext.config.warnHandler,i=zm();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 <${vu(n,s.type)}>`).join(`
100
+ **/const mr=[];let Eo=!1;function Ob(t,...e){if(Eo)return;Eo=!0,Et();const n=mr.length?mr[mr.length-1].component:null,r=n&&n.appContext.config.warnHandler,i=Sg();if(r)In(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 <${ju(n,s.type)}>`).join(`
101
101
  `),i]);else{const s=[`[Vue warn]: ${t}`,...e];i.length&&s.push(`
102
- `,...Wm(i))}St(),ho=!1}function zm(){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 Wm(t){const e=[];return t.forEach((n,r)=>{e.push(...r===0?[]:[`
103
- `],...Vm(n))}),e}function Vm({vnode:t,recurseCount:e}){const n=e>0?`... (${e} recursive calls)`:"",r=t.component?t.component.parent==null:!1,i=` at <${vu(t.component,t.type,r)}`,s=">"+n;return t.props?[i,...Km(t.props),s]:[i+s]}function Km(t){const e=[],n=Object.keys(t);return n.slice(0,3).forEach(r=>{e.push(..._c(r,t[r]))}),n.length>3&&e.push(" ..."),e}function _c(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}`]:De(e)?(e=_c(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){Si(i,e,n)}}function Et(t,e,n,r){if(oe(t)){const i=kn(t,e,n,r);return i&&ql(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||he;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(),kn(s,null,10,[t,l,u]),St();return}}Ym(t,n,i,r,o)}function Ym(t,e,n,r=!0,i=!1){if(i)throw t}const We=[];let $t=-1;const Cn=[];let Yt=null,On=0;const wc=Promise.resolve();let Ei=null;function $i(t){const e=Ei||wc;return t?e.then(this?t.bind(this):t):e}function Gm(t){let e=$t+1,n=We.length;for(;e<n;){const r=e+n>>>1,i=We[r],s=ur(i);s<t||s===t&&i.flags&2?e=r+1:n=r}return e}function po(t){if(!(t.flags&1)){const e=ur(t),n=We[We.length-1];!n||!(t.flags&2)&&e>=ur(n)?We.push(t):We.splice(Gm(e),0,t),t.flags|=1,xc()}}function xc(){Ei||(Ei=wc.then($c))}function Jm(t){se(t)?Cn.push(...t):Yt&&t.id===-1?Yt.splice(On+1,0,t):t.flags&1||(Cn.push(t),t.flags|=1),xc()}function Sc(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 Ec(t){if(Cn.length){const e=[...new Set(Cn)].sort((n,r)=>ur(n)-ur(r));if(Cn.length=0,Yt){Yt.push(...e);return}for(Yt=e,On=0;On<Yt.length;On++){const n=Yt[On];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}Yt=null,On=0}}const ur=t=>t.id==null?t.flags&2?-1:1/0:t.id;function $c(t){try{for($t=0;$t<We.length;$t++){const e=We[$t];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(;$t<We.length;$t++){const e=We[$t];e&&(e.flags&=-2)}$t=-1,We.length=0,Ec(),Ei=null,(We.length||Cn.length)&&$c()}}let kt=null,kc=null;function ki(t){const e=kt;return kt=t,kc=t&&t.type.__scopeId||null,e}function Qm(t,e=kt,n){if(!e||t._n)return t;const r=(...i)=>{r._d&&cu(-1);const s=ki(e);let o;try{o=t(...i)}finally{ki(s),r._d&&cu(1)}return o};return r._n=!0,r._c=!0,r._d=!0,r}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 Xm=Symbol("_vte"),Zm=t=>t.__isTeleport,eg=Symbol("_leaveCb");function mo(t,e){t.shapeFlag&6&&t.component?(t.transition=e,mo(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 Cc(t,e){return oe(t)?Ne({name:t.name},e,{setup:t}):t}function Oc(t){t.ids=[t.ids[0]+t.ids[2]+++"-",0,0]}function tg(t){const e=Oo(),n=_i(null);if(e){const i=e.refs===he?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 fr(t,e,n,r,i=!1){if(se(t)){t.forEach((b,A)=>fr(b,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?Ao(r.component):r.el,o=i?null:s,{i:a,r:l}=t,u=e&&e.r,c=a.refs===he?a.refs={}:a.refs,f=a.setupState,y=fe(f),v=f===he?Ul:b=>pe(y,b);if(u!=null&&u!==l){if(Pc(e),ke(u))c[u]=null,v(u)&&(f[u]=null);else if(De(u)){u.value=null;const b=e;b.k&&(c[b.k]=null)}}if(oe(l))kn(l,a,12,[o,c]);else{const b=ke(l),A=De(l);if(b||A){const U=()=>{if(t.f){const L=b?v(l)?f[l]:c[l]:l.value;if(i)se(L)&&Vs(L,s);else if(se(L))L.includes(s)||L.push(s);else if(b)c[l]=[s],v(l)&&(f[l]=c[l]);else{const I=[s];l.value=I,t.k&&(c[t.k]=I)}}else b?(c[l]=o,v(l)&&(f[l]=o)):A&&(l.value=o,t.k&&(c[t.k]=o))};if(o){const L=()=>{U(),Ci.delete(t)};L.id=-1,Ci.set(t,L),rt(L,n)}else Pc(t),U()}}}function Pc(t){const e=Ci.get(t);e&&(e.flags|=8,Ci.delete(t))}fi().requestIdleCallback,fi().cancelIdleCallback;const dr=t=>!!t.type.__asyncLoader,Ac=t=>t.type.__isKeepAlive;function ng(t,e){Ic(t,"a",e)}function rg(t,e){Ic(t,"da",e)}function Ic(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(Oi(e,r,n),n){let i=n.parent;for(;i&&i.parent;)Ac(i.parent.vnode)&&ig(r,e,n,i),i=i.parent}}function ig(t,e,n,r){const i=Oi(e,t,r,!0);Dc(()=>{Vs(r[e],i)},n)}function Oi(t,e,n=Ke,r=!1){if(n){const i=n[t]||(n[t]=[]),s=e.__weh||(e.__weh=(...o)=>{xt();const a=wr(n),l=Et(e,n,t,o);return a(),St(),l});return r?i.unshift(s):i.push(s),s}}const Mt=t=>(e,n=Ke)=>{(!xr||t==="sp")&&Oi(t,(...r)=>e(...r),n)},Tc=Mt("bm"),go=Mt("m"),sg=Mt("bu"),og=Mt("u"),Rc=Mt("bum"),Dc=Mt("um"),ag=Mt("sp"),lg=Mt("rtg"),cg=Mt("rtc");function ug(t,e=Ke){Oi("ec",t,e)}const fg=Symbol.for("v-ndc");function Lc(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=!ut(t),u=Vt(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(Me(t[c])):Me(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 yo=t=>t?mu(t)?Ao(t):yo(t.parent):null,hr=Ne(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=>yo(t.parent),$root:t=>yo(t.root),$host:t=>t.ce,$emit:t=>t.emit,$options:t=>Fc(t),$forceUpdate:t=>t.f||(t.f=()=>{po(t.update)}),$nextTick:t=>t.n||(t.n=$i.bind(t.proxy)),$watch:t=>Rg.bind(t)}),vo=(t,e)=>t!==he&&!t.__isScriptSetup&&pe(t,e),dg={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 v=o[e];if(v!==void 0)switch(v){case 1:return r[e];case 2:return i[e];case 4:return n[e];case 3:return s[e]}else{if(vo(r,e))return o[e]=1,r[e];if(i!==he&&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!==he&&pe(n,e))return o[e]=4,n[e];bo&&(o[e]=0)}}const c=hr[e];let f,y;if(c)return e==="$attrs"&&qe(t.attrs,"get",""),c(t);if((f=a.__cssModules)&&(f=f[e]))return f;if(n!==he&&pe(n,e))return o[e]=4,n[e];if(y=l.config.globalProperties,pe(y,e))return y[e]},set({_:t},e,n){const{data:r,setupState:i,ctx:s}=t;return vo(i,e)?(i[e]=n,!0):r!==he&&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!==he&&a[0]!=="$"&&pe(t,a)||vo(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 Pi(t){return se(t)?t.reduce((e,n)=>(e[n]=null,e),{}):t}function Nc(t,e){return!t||!e?t||e:se(t)&&se(e)?t.concat(e):Ne({},Pi(t),Pi(e))}let bo=!0;function hg(t){const e=Fc(t),n=t.proxy,r=t.ctx;bo=!1,e.beforeCreate&&Mc(e.beforeCreate,t,"bc");const{data:i,computed:s,methods:o,watch:a,provide:l,inject:u,created:c,beforeMount:f,mounted:y,beforeUpdate:v,updated:b,activated:A,deactivated:U,beforeDestroy:L,beforeUnmount:I,destroyed:g,unmounted:p,render:h,renderTracked:S,renderTriggered:P,errorCaptured:R,serverPrefetch:z,expose:X,inheritAttrs:Ce,components:Te,directives:tt,filters:Ft}=e;if(u&&pg(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=co(me))}if(bo=!0,s)for(const me in s){const ve=s[me],Bt=oe(ve)?ve.bind(n,n):oe(ve.get)?ve.get.bind(n,n):wt,Hn=!oe(ve)&&oe(ve.set)?ve.set.bind(n):wt,je=bu({get:Bt,set:Hn});Object.defineProperty(r,me,{enumerable:!0,configurable:!0,get:()=>je.value,set:ot=>je.value=ot})}if(a)for(const me in a)jc(a[me],r,n,me);if(l){const me=oe(l)?l.call(n):l;Reflect.ownKeys(me).forEach(ve=>{qc(ve,me[ve])})}c&&Mc(c,t,"c");function Re(me,ve){se(ve)?ve.forEach(Bt=>me(Bt.bind(n))):ve&&me(ve.bind(n))}if(Re(Tc,f),Re(go,y),Re(sg,v),Re(og,b),Re(ng,A),Re(rg,U),Re(ug,R),Re(cg,S),Re(lg,P),Re(Rc,I),Re(Dc,p),Re(ag,z),se(X))if(X.length){const me=t.exposed||(t.exposed={});X.forEach(ve=>{Object.defineProperty(me,ve,{get:()=>n[ve],set:Bt=>n[ve]=Bt,enumerable:!0})})}else t.exposed||(t.exposed={});h&&t.render===wt&&(t.render=h),Ce!=null&&(t.inheritAttrs=Ce),Te&&(t.components=Te),tt&&(t.directives=tt),z&&Oc(t)}function pg(t,e,n=wt){se(t)&&(t=_o(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),De(s)?Object.defineProperty(e,r,{enumerable:!0,configurable:!0,get:()=>s.value,set:o=>s.value=o}):e[r]=s}}function Mc(t,e,n){Et(se(t)?t.map(r=>r.bind(e.proxy)):t.bind(e.proxy),e,n)}function jc(t,e,n,r){let i=r.includes(".")?nu(n,r):()=>n[r];if(ke(t)){const s=e[t];oe(s)&&An(i,s)}else if(oe(t))An(i,t.bind(n));else if(xe(t))if(se(t))t.forEach(s=>jc(s,e,n,r));else{const s=oe(t.handler)?t.handler.bind(n):e[t.handler];oe(s)&&An(i,s,t)}}function Fc(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)),xe(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=mg[o]||n&&n[o];t[o]=a?a(t[o],e[o]):e[o]}return t}const mg={data:Bc,props:Uc,emits:Uc,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:yg,provide:Bc,inject:gg};function Bc(t,e){return e?t?function(){return Ne(oe(t)?t.call(this,this):t,oe(e)?e.call(this,this):e)}:e:t}function gg(t,e){return pr(_o(t),_o(e))}function _o(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?Ne(Object.create(null),t,e):e}function Uc(t,e){return t?se(t)&&se(e)?[...new Set([...t,...e])]:Ne(Object.create(null),Pi(t),Pi(e??{})):e}function yg(t,e){if(!t)return e;if(!e)return t;const n=Ne(Object.create(null),t);for(const r in e)n[r]=Ve(t[r],e[r]);return n}function Hc(){return{app:null,config:{isNativeTag:Ul,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 vg=0;function bg(t,e){return function(r,i=null){oe(r)||(r=Ne({},r)),i!=null&&!xe(i)&&(i=null);const s=Hc(),o=new WeakSet,a=[];let l=!1;const u=s.app={_uid:vg++,_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,y){if(!l){const v=u._ceVNode||Gt(r,i);return v.appContext=s,y===!0?y="svg":y===!1&&(y=void 0),t(v,c,y),l=!0,u._container=c,c.__vue_app__=u,Ao(v.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=Pn;Pn=u;try{return c()}finally{Pn=f}}};return u}}let Pn=null;function qc(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=Oo();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 zc={},Wc=()=>Object.create(zc),Vc=t=>Object.getPrototypeOf(t)===zc;function _g(t,e,n,r=!1){const i={},s=Wc();t.propsDefaults=Object.create(null),Kc(t,e,i,s);for(const o in t.propsOptions[0])o in i||(i[o]=void 0);n?t.props=r?i:Dm(i):t.type.props?t.props=i:t.props=s,t.attrs=s}function wg(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 y=c[f];if(Ii(t.emitsOptions,y))continue;const v=e[y];if(l)if(pe(s,y))v!==s[y]&&(s[y]=v,u=!0);else{const b=Dt(y);i[b]=wo(l,a,b,v,t,!1)}else v!==s[y]&&(s[y]=v,u=!0)}}}else{Kc(t,e,i,s)&&(u=!0);let c;for(const f in a)(!e||!pe(e,f)&&((c=Wt(f))===f||!pe(e,c)))&&(l?n&&(n[f]!==void 0||n[c]!==void 0)&&(i[f]=wo(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&&Lt(t.attrs,"set","")}function Kc(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=Dt(l))?!s||!s.includes(c)?n[c]=u:(a||(a={}))[c]=u:Ii(t.emitsOptions,l)||(!(l in r)||u!==r[l])&&(r[l]=u,o=!0)}if(s){const l=fe(n),u=a||he;for(let c=0;c<s.length;c++){const f=s[c];n[f]=wo(i,l,f,u[f],t,!pe(u,f))}}return o}function wo(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===Wt(n))&&(r=!0))}return r}const xg=new WeakMap;function Yc(t,e,n=!1){const r=n?xg: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[y,v]=Yc(f,e,!0);Ne(o,y),v&&a.push(...v)};!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=Dt(s[c]);Gc(f)&&(o[f]=he)}else if(s)for(const c in s){const f=Dt(c);if(Gc(f)){const y=s[c],v=o[f]=se(y)||oe(y)?{type:y}:Ne({},y),b=v.type;let A=!1,U=!0;if(se(b))for(let L=0;L<b.length;++L){const I=b[L],g=oe(I)&&I.name;if(g==="Boolean"){A=!0;break}else g==="String"&&(U=!1)}else A=oe(b)&&b.name==="Boolean";v[0]=A,v[1]=U,(A||pe(v,"default"))&&a.push(f)}}const u=[o,a];return xe(t)&&r.set(t,u),u}function Gc(t){return t[0]!=="$"&&!rr(t)}const xo=t=>t==="_"||t==="_ctx"||t==="$stable",So=t=>se(t)?t.map(Ct):[Ct(t)],Sg=(t,e,n)=>{if(e._n)return e;const r=Qm((...i)=>So(e(...i)),n);return r._c=!1,r},Jc=(t,e,n)=>{const r=t._ctx;for(const i in t){if(xo(i))continue;const s=t[i];if(oe(s))e[i]=Sg(i,s,r);else if(s!=null){const o=So(s);e[i]=()=>o}}},Qc=(t,e)=>{const n=So(e);t.slots.default=()=>n},Xc=(t,e,n)=>{for(const r in e)(n||!xo(r))&&(t[r]=e[r])},Eg=(t,e,n)=>{const r=t.slots=Wc();if(t.vnode.shapeFlag&32){const i=e._;i?(Xc(r,e,n),n&&Kl(r,"_",i,!0)):Jc(e,r)}else e&&Qc(t,e)},$g=(t,e,n)=>{const{vnode:r,slots:i}=t;let s=!0,o=he;if(r.shapeFlag&32){const a=e._;a?n&&a===1?s=!1:Xc(i,e,n):(s=!e.$stable,Jc(e,i)),o=e}else e&&(Qc(t,e),o={default:1});if(s)for(const a in i)!xo(a)&&o[a]==null&&delete i[a]},rt=Bg;function kg(t){return Cg(t)}function Cg(t,e){const n=fi();n.__VUE__=!0;const{insert:r,remove:i,patchProp:s,createElement:o,createText:a,createComment:l,setText:u,setElementText:c,parentNode:f,nextSibling:y,setScopeId:v=wt,insertStaticContent:b}=t,A=(_,k,T,N=null,M=null,j=null,G=void 0,K=null,W=!!k.dynamicChildren)=>{if(_===k)return;_&&!br(_,k)&&(N=qn(_),ot(_,M,j,!0),_=null),k.patchFlag===-2&&(W=!1,k.dynamicChildren=null);const{type:B,ref:ee,shapeFlag:J}=k;switch(B){case Ti:U(_,k,T,N);break;case In:L(_,k,T,N);break;case ko:_==null&&I(k,T,N,G);break;case yt:Te(_,k,T,N,M,j,G,K,W);break;default:J&1?h(_,k,T,N,M,j,G,K,W):J&6?tt(_,k,T,N,M,j,G,K,W):(J&64||J&128)&&B.process(_,k,T,N,M,j,G,K,W,gn)}ee!=null&&M?fr(ee,_&&_.ref,j,k||_,!k):ee==null&&_&&_.ref!=null&&fr(_.ref,null,j,_,!0)},U=(_,k,T,N)=>{if(_==null)r(k.el=a(k.children),T,N);else{const M=k.el=_.el;k.children!==_.children&&u(M,k.children)}},L=(_,k,T,N)=>{_==null?r(k.el=l(k.children||""),T,N):k.el=_.el},I=(_,k,T,N)=>{[_.el,_.anchor]=b(_.children,k,T,N,_.el,_.anchor)},g=({el:_,anchor:k},T,N)=>{let M;for(;_&&_!==k;)M=y(_),r(_,T,N),_=M;r(k,T,N)},p=({el:_,anchor:k})=>{let T;for(;_&&_!==k;)T=y(_),i(_),_=T;i(k)},h=(_,k,T,N,M,j,G,K,W)=>{k.type==="svg"?G="svg":k.type==="math"&&(G="mathml"),_==null?S(k,T,N,M,j,G,K,W):z(_,k,M,j,G,K,W)},S=(_,k,T,N,M,j,G,K)=>{let W,B;const{props:ee,shapeFlag:J,transition:Z,dirs:re}=_;if(W=_.el=o(_.type,j,ee&&ee.is,ee),J&8?c(W,_.children):J&16&&R(_.children,W,null,N,M,Eo(_,j),G,K),re&&cn(_,null,N,"created"),P(W,_,_.scopeId,G,N),ee){for(const be in ee)be!=="value"&&!rr(be)&&s(W,be,null,ee[be],j,N);"value"in ee&&s(W,"value",null,ee.value,j),(B=ee.onVnodeBeforeMount)&&Ot(B,N,_)}re&&cn(_,null,N,"beforeMount");const ce=Og(M,Z);ce&&Z.beforeEnter(W),r(W,k,T),((B=ee&&ee.onVnodeMounted)||ce||re)&&rt(()=>{B&&Ot(B,N,_),ce&&Z.enter(W),re&&cn(_,null,N,"mounted")},M)},P=(_,k,T,N,M)=>{if(T&&v(_,T),N)for(let j=0;j<N.length;j++)v(_,N[j]);if(M){let j=M.subTree;if(k===j||lu(j.type)&&(j.ssContent===k||j.ssFallback===k)){const G=M.vnode;P(_,G,G.scopeId,G.slotScopeIds,M.parent)}}},R=(_,k,T,N,M,j,G,K,W=0)=>{for(let B=W;B<_.length;B++){const ee=_[B]=K?Jt(_[B]):Ct(_[B]);A(null,ee,k,T,N,M,j,G,K)}},z=(_,k,T,N,M,j,G)=>{const K=k.el=_.el;let{patchFlag:W,dynamicChildren:B,dirs:ee}=k;W|=_.patchFlag&16;const J=_.props||he,Z=k.props||he;let re;if(T&&un(T,!1),(re=Z.onVnodeBeforeUpdate)&&Ot(re,T,k,_),ee&&cn(k,_,T,"beforeUpdate"),T&&un(T,!0),(J.innerHTML&&Z.innerHTML==null||J.textContent&&Z.textContent==null)&&c(K,""),B?X(_.dynamicChildren,B,K,T,N,Eo(k,M),j):G||ve(_,k,K,null,T,N,Eo(k,M),j,!1),W>0){if(W&16)Ce(K,J,Z,T,M);else if(W&2&&J.class!==Z.class&&s(K,"class",null,Z.class,M),W&4&&s(K,"style",J.style,Z.style,M),W&8){const ce=k.dynamicProps;for(let be=0;be<ce.length;be++){const de=ce[be],Fe=J[de],Be=Z[de];(Be!==Fe||de==="value")&&s(K,de,Fe,Be,M,T)}}W&1&&_.children!==k.children&&c(K,k.children)}else!G&&B==null&&Ce(K,J,Z,T,M);((re=Z.onVnodeUpdated)||ee)&&rt(()=>{re&&Ot(re,T,k,_),ee&&cn(k,_,T,"updated")},N)},X=(_,k,T,N,M,j,G)=>{for(let K=0;K<k.length;K++){const W=_[K],B=k[K],ee=W.el&&(W.type===yt||!br(W,B)||W.shapeFlag&198)?f(W.el):T;A(W,B,ee,null,N,M,j,G,!0)}},Ce=(_,k,T,N,M)=>{if(k!==T){if(k!==he)for(const j in k)!rr(j)&&!(j in T)&&s(_,j,k[j],null,M,N);for(const j in T){if(rr(j))continue;const G=T[j],K=k[j];G!==K&&j!=="value"&&s(_,j,K,G,M,N)}"value"in T&&s(_,"value",k.value,T.value,M)}},Te=(_,k,T,N,M,j,G,K,W)=>{const B=k.el=_?_.el:a(""),ee=k.anchor=_?_.anchor:a("");let{patchFlag:J,dynamicChildren:Z,slotScopeIds:re}=k;re&&(K=K?K.concat(re):re),_==null?(r(B,T,N),r(ee,T,N),R(k.children||[],T,ee,M,j,G,K,W)):J>0&&J&64&&Z&&_.dynamicChildren?(X(_.dynamicChildren,Z,T,M,j,G,K),(k.key!=null||M&&k===M.subTree)&&Zc(_,k,!0)):ve(_,k,T,ee,M,j,G,K,W)},tt=(_,k,T,N,M,j,G,K,W)=>{k.slotScopeIds=K,_==null?k.shapeFlag&512?M.ctx.activate(k,T,N,G,W):Ft(k,T,N,M,j,G,W):pn(_,k,W)},Ft=(_,k,T,N,M,j,G)=>{const K=_.component=Yg(_,N,M);if(Ac(_)&&(K.ctx.renderer=gn),Gg(K,!1,G),K.asyncDep){if(M&&M.registerDep(K,Re,G),!_.el){const W=K.subTree=Gt(In);L(null,W,k,T),_.placeholder=W.el}}else Re(K,_,k,T,M,j,G)},pn=(_,k,T)=>{const N=k.component=_.component;if(jg(_,k,T))if(N.asyncDep&&!N.asyncResolved){me(N,k,T);return}else N.next=k,N.update();else k.el=_.el,N.vnode=k},Re=(_,k,T,N,M,j,G)=>{const K=()=>{if(_.isMounted){let{next:J,bu:Z,u:re,parent:ce,vnode:be}=_;{const lt=eu(_);if(lt){J&&(J.el=be.el,me(_,J,G)),lt.asyncDep.then(()=>{_.isUnmounted||K()});return}}let de=J,Fe;un(_,!1),J?(J.el=be.el,me(_,J,G)):J=be,Z&&Gs(Z),(Fe=J.props&&J.props.onVnodeBeforeUpdate)&&Ot(Fe,ce,J,be),un(_,!0);const Be=ou(_),at=_.subTree;_.subTree=Be,A(at,Be,f(at.el),qn(at),_,M,j),J.el=Be.el,de===null&&Fg(_,Be.el),re&&rt(re,M),(Fe=J.props&&J.props.onVnodeUpdated)&&rt(()=>Ot(Fe,ce,J,be),M)}else{let J;const{el:Z,props:re}=k,{bm:ce,m:be,parent:de,root:Fe,type:Be}=_,at=dr(k);un(_,!1),ce&&Gs(ce),!at&&(J=re&&re.onVnodeBeforeMount)&&Ot(J,de,k),un(_,!0);{Fe.ce&&Fe.ce._def.shadowRoot!==!1&&Fe.ce._injectChildStyle(Be);const lt=_.subTree=ou(_);A(null,lt,T,N,_,M,j),k.el=lt.el}if(be&&rt(be,M),!at&&(J=re&&re.onVnodeMounted)){const lt=k;rt(()=>Ot(J,de,lt),M)}(k.shapeFlag&256||de&&dr(de.vnode)&&de.vnode.shapeFlag&256)&&_.a&&rt(_.a,M),_.isMounted=!0,k=T=N=null}};_.scope.on();const W=_.effect=new Xl(K);_.scope.off();const B=_.update=W.run.bind(W),ee=_.job=W.runIfDirty.bind(W);ee.i=_,ee.id=_.uid,W.scheduler=()=>po(ee),un(_,!0),B()},me=(_,k,T)=>{k.component=_;const N=_.vnode.props;_.vnode=k,_.next=null,wg(_,k.props,N,T),$g(_,k.children,T),xt(),Sc(_),St()},ve=(_,k,T,N,M,j,G,K,W=!1)=>{const B=_&&_.children,ee=_?_.shapeFlag:0,J=k.children,{patchFlag:Z,shapeFlag:re}=k;if(Z>0){if(Z&128){Hn(B,J,T,N,M,j,G,K,W);return}else if(Z&256){Bt(B,J,T,N,M,j,G,K,W);return}}re&8?(ee&16&&mn(B,M,j),J!==B&&c(T,J)):ee&16?re&16?Hn(B,J,T,N,M,j,G,K,W):mn(B,M,j,!0):(ee&8&&c(T,""),re&16&&R(J,T,N,M,j,G,K,W))},Bt=(_,k,T,N,M,j,G,K,W)=>{_=_||xn,k=k||xn;const B=_.length,ee=k.length,J=Math.min(B,ee);let Z;for(Z=0;Z<J;Z++){const re=k[Z]=W?Jt(k[Z]):Ct(k[Z]);A(_[Z],re,T,null,M,j,G,K,W)}B>ee?mn(_,M,j,!0,!1,J):R(k,T,N,M,j,G,K,W,J)},Hn=(_,k,T,N,M,j,G,K,W)=>{let B=0;const ee=k.length;let J=_.length-1,Z=ee-1;for(;B<=J&&B<=Z;){const re=_[B],ce=k[B]=W?Jt(k[B]):Ct(k[B]);if(br(re,ce))A(re,ce,T,null,M,j,G,K,W);else break;B++}for(;B<=J&&B<=Z;){const re=_[J],ce=k[Z]=W?Jt(k[Z]):Ct(k[Z]);if(br(re,ce))A(re,ce,T,null,M,j,G,K,W);else break;J--,Z--}if(B>J){if(B<=Z){const re=Z+1,ce=re<ee?k[re].el:N;for(;B<=Z;)A(null,k[B]=W?Jt(k[B]):Ct(k[B]),T,ce,M,j,G,K,W),B++}}else if(B>Z)for(;B<=J;)ot(_[B],M,j,!0),B++;else{const re=B,ce=B,be=new Map;for(B=ce;B<=Z;B++){const Ye=k[B]=W?Jt(k[B]):Ct(k[B]);Ye.key!=null&&be.set(Ye.key,B)}let de,Fe=0;const Be=Z-ce+1;let at=!1,lt=0;const Xt=new Array(Be);for(B=0;B<Be;B++)Xt[B]=0;for(B=re;B<=J;B++){const Ye=_[B];if(Fe>=Be){ot(Ye,M,j,!0);continue}let ht;if(Ye.key!=null)ht=be.get(Ye.key);else for(de=ce;de<=Z;de++)if(Xt[de-ce]===0&&br(Ye,k[de])){ht=de;break}ht===void 0?ot(Ye,M,j,!0):(Xt[ht-ce]=B+1,ht>=lt?lt=ht:at=!0,A(Ye,k[ht],T,null,M,j,G,K,W),Fe++)}const zn=at?Pg(Xt):xn;for(de=zn.length-1,B=Be-1;B>=0;B--){const Ye=ce+B,ht=k[Ye],Wn=k[Ye+1],Or=Ye+1<ee?Wn.el||Wn.placeholder:N;Xt[B]===0?A(null,ht,T,Or,M,j,G,K,W):at&&(de<0||B!==zn[de]?je(ht,T,Or,2):de--)}}},je=(_,k,T,N,M=null)=>{const{el:j,type:G,transition:K,children:W,shapeFlag:B}=_;if(B&6){je(_.component.subTree,k,T,N);return}if(B&128){_.suspense.move(k,T,N);return}if(B&64){G.move(_,k,T,gn);return}if(G===yt){r(j,k,T);for(let J=0;J<W.length;J++)je(W[J],k,T,N);r(_.anchor,k,T);return}if(G===ko){g(_,k,T);return}if(N!==2&&B&1&&K)if(N===0)K.beforeEnter(j),r(j,k,T),rt(()=>K.enter(j),M);else{const{leave:J,delayLeave:Z,afterLeave:re}=K,ce=()=>{_.ctx.isUnmounted?i(j):r(j,k,T)},be=()=>{j._isLeaving&&j[eg](!0),J(j,()=>{ce(),re&&re()})};Z?Z(j,ce,be):be()}else r(j,k,T)},ot=(_,k,T,N=!1,M=!1)=>{const{type:j,props:G,ref:K,children:W,dynamicChildren:B,shapeFlag:ee,patchFlag:J,dirs:Z,cacheIndex:re}=_;if(J===-2&&(M=!1),K!=null&&(xt(),fr(K,null,T,_,!0),St()),re!=null&&(k.renderCache[re]=void 0),ee&256){k.ctx.deactivate(_);return}const ce=ee&1&&Z,be=!dr(_);let de;if(be&&(de=G&&G.onVnodeBeforeUnmount)&&Ot(de,k,_),ee&6)qo(_.component,T,N);else{if(ee&128){_.suspense.unmount(T,N);return}ce&&cn(_,null,k,"beforeUnmount"),ee&64?_.type.remove(_,k,T,gn,N):B&&!B.hasOnce&&(j!==yt||J>0&&J&64)?mn(B,k,T,!1,!0):(j===yt&&J&384||!M&&ee&16)&&mn(W,k,T),N&&qi(_)}(be&&(de=G&&G.onVnodeUnmounted)||ce)&&rt(()=>{de&&Ot(de,k,_),ce&&cn(_,null,k,"unmounted")},T)},qi=_=>{const{type:k,el:T,anchor:N,transition:M}=_;if(k===yt){Ho(T,N);return}if(k===ko){p(_);return}const j=()=>{i(T),M&&!M.persisted&&M.afterLeave&&M.afterLeave()};if(_.shapeFlag&1&&M&&!M.persisted){const{leave:G,delayLeave:K}=M,W=()=>G(T,j);K?K(_.el,j,W):W()}else j()},Ho=(_,k)=>{let T;for(;_!==k;)T=y(_),i(_),_=T;i(k)},qo=(_,k,T)=>{const{bum:N,scope:M,job:j,subTree:G,um:K,m:W,a:B}=_;tu(W),tu(B),N&&Gs(N),M.stop(),j&&(j.flags|=8,ot(G,_,k,T)),K&&rt(K,k),rt(()=>{_.isUnmounted=!0},k)},mn=(_,k,T,N=!1,M=!1,j=0)=>{for(let G=j;G<_.length;G++)ot(_[G],k,T,N,M)},qn=_=>{if(_.shapeFlag&6)return qn(_.component.subTree);if(_.shapeFlag&128)return _.suspense.next();const k=y(_.anchor||_.el),T=k&&k[Xm];return T?y(T):k};let Cr=!1;const zi=(_,k,T)=>{_==null?k._vnode&&ot(k._vnode,null,null,!0):A(k._vnode||null,_,k,null,null,null,T),k._vnode=_,Cr||(Cr=!0,Sc(),Ec(),Cr=!1)},gn={p:A,um:ot,m:je,r:qi,mt:Ft,mc:R,pc:ve,pbc:X,n:qn,o:t};return{render:zi,hydrate:void 0,createApp:bg(zi)}}function Eo({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 Og(t,e){return(!t||t&&!t.pendingBranch)&&e&&!e.persisted}function Zc(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&&Zc(o,a)),a.type===Ti&&a.patchFlag!==-1&&(a.el=o.el),a.type===In&&!a.el&&(a.el=o.el)}}function Pg(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 eu(t){const e=t.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:eu(e)}function tu(t){if(t)for(let e=0;e<t.length;e++)t[e].flags|=8}const Ag=Symbol.for("v-scx"),Ig=()=>mr(Ag);function Tg(t,e){return $o(t,null,{flush:"sync"})}function An(t,e,n){return $o(t,e,n)}function $o(t,e,n=he){const{immediate:r,deep:i,flush:s,once:o}=n,a=Ne({},n),l=e&&r||!e&&s!=="post";let u;if(xr){if(s==="sync"){const v=Ig();u=v.__watcherHandles||(v.__watcherHandles=[])}else if(!l){const v=()=>{};return v.stop=wt,v.resume=wt,v.pause=wt,v}}const c=Ke;a.call=(v,b,A)=>Et(v,c,b,A);let f=!1;s==="post"?a.scheduler=v=>{rt(v,c&&c.suspense)}:s!=="sync"&&(f=!0,a.scheduler=(v,b)=>{b?v():po(v)}),a.augmentJob=v=>{e&&(v.flags|=4),f&&(v.flags|=2,c&&(v.id=c.uid,v.i=c))};const y=qm(t,e,a);return xr&&(u?u.push(y):l&&y()),y}function Rg(t,e,n){const r=this.proxy,i=ke(t)?t.includes(".")?nu(r,t):()=>r[t]:t.bind(r,r);let s;oe(e)?s=e:(s=e.handler,n=e);const o=wr(this),a=$o(i,s.bind(r),n);return o(),a}function nu(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 ru(t,e,n=he){const r=Oo(),i=Dt(e),s=Wt(e),o=iu(t,i),a=Fm((l,u)=>{let c,f=he,y;return Tg(()=>{const v=t[i];Ze(c,v)&&(c=v,u())}),{get(){return l(),n.get?n.get(c):c},set(v){const b=n.set?n.set(v):v;if(!Ze(b,c)&&!(f!==he&&Ze(v,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=v,u()),r.emit(`update:${e}`,b),Ze(v,b)&&Ze(v,f)&&!Ze(b,y)&&u(),f=v,y=b}}});return a[Symbol.iterator]=()=>{let l=0;return{next(){return l<2?{value:l++?o||he:a,done:!1}:{done:!0}}}},a}const iu=(t,e)=>e==="modelValue"||e==="model-value"?t.modelModifiers:t[`${e}Modifiers`]||t[`${Dt(e)}Modifiers`]||t[`${Wt(e)}Modifiers`];function Dg(t,e,...n){if(t.isUnmounted)return;const r=t.vnode.props||he;let i=n;const s=e.startsWith("update:"),o=s&&iu(r,e.slice(7));o&&(o.trim&&(i=n.map(c=>ke(c)?c.trim():c)),o.number&&(i=n.map(lm)));let a,l=r[a=Ys(e)]||r[a=Ys(Dt(e))];!l&&s&&(l=r[a=Ys(Wt(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 Lg=new WeakMap;function su(t,e,n=!1){const r=n?Lg: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=su(u,e,!0);c&&(a=!0,Ne(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):Ne(o,s),xe(t)&&r.set(t,o),o)}function Ii(t,e){return!t||!li(e)?!1:(e=e.slice(2).replace(/Once$/,""),pe(t,e[0].toLowerCase()+e.slice(1))||pe(t,Wt(e))||pe(t,e))}function Jv(){}function ou(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:y,setupState:v,ctx:b,inheritAttrs:A}=t,U=ki(t);let L,I;try{if(n.shapeFlag&4){const p=i||r,h=p;L=Ct(u.call(h,p,c,f,v,y,b)),I=a}else{const p=e;L=Ct(p.length>1?p(f,{attrs:a,slots:o,emit:l}):p(f,null)),I=e.props?a:Ng(a)}}catch(p){gr.length=0,Si(p,t,1),L=Gt(In)}let g=L;if(I&&A!==!1){const p=Object.keys(I),{shapeFlag:h}=g;p.length&&h&7&&(s&&p.some(Ws)&&(I=Mg(I,s)),g=Rn(g,I,!1,!0))}return n.dirs&&(g=Rn(g,null,!1,!0),g.dirs=g.dirs?g.dirs.concat(n.dirs):n.dirs),n.transition&&mo(g,n.transition),L=g,ki(U),L}const Ng=t=>{let e;for(const n in t)(n==="class"||n==="style"||li(n))&&((e||(e={}))[n]=t[n]);return e},Mg=(t,e)=>{const n={};for(const r in t)(!Ws(r)||!(r.slice(9)in e))&&(n[r]=t[r]);return n};function jg(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?au(r,o,u):!!o;if(l&8){const c=e.dynamicProps;for(let f=0;f<c.length;f++){const y=c[f];if(o[y]!==r[y]&&!Ii(u,y))return!0}}}else return(i||a)&&(!a||!a.$stable)?!0:r===o?!1:r?o?au(r,o,u):!0:!!o;return!1}function au(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]&&!Ii(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 lu=t=>t.__isSuspense;function Bg(t,e){e&&e.pendingBranch?se(t)?e.effects.push(...t):e.effects.push(t):Jm(t)}const yt=Symbol.for("v-fgt"),Ti=Symbol.for("v-txt"),In=Symbol.for("v-cmt"),ko=Symbol.for("v-stc"),gr=[];let it=null;function Tn(t=!1){gr.push(it=t?null:[])}function Ug(){gr.pop(),it=gr[gr.length-1]||null}let yr=1;function cu(t,e=!1){yr+=t,t<0&&it&&e&&(it.hasOnce=!0)}function uu(t){return t.dynamicChildren=yr>0?it||xn:null,Ug(),yr>0&&it&&it.push(t),t}function vr(t,e,n,r,i,s){return uu(_r(t,e,n,r,i,s,!0))}function Hg(t,e,n,r,i){return uu(Gt(t,e,n,r,i,!0))}function fu(t){return t?t.__v_isVNode===!0:!1}function br(t,e){return t.type===e.type&&t.key===e.key}const du=({key:t})=>t??null,Ri=({ref:t,ref_key:e,ref_for:n})=>(typeof t=="number"&&(t=""+t),t!=null?ke(t)||De(t)||oe(t)?{i:kt,r:t,k:e,f:!!n}:t:null);function _r(t,e=null,n=null,r=0,i=null,s=t===yt?0:1,o=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&du(e),ref:e&&Ri(e),scopeId:kc,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:kt};return a?(Co(l,n),s&128&&t.normalize(l)):n&&(l.shapeFlag|=ke(n)?8:16),yr>0&&!o&&it&&(l.patchFlag>0||s&6)&&l.patchFlag!==32&&it.push(l),l}const Gt=qg;function qg(t,e=null,n=null,r=0,i=null,s=!1){if((!t||t===fg)&&(t=In),fu(t)){const a=Rn(t,e,!0);return n&&Co(a,n),yr>0&&!s&&it&&(a.shapeFlag&6?it[it.indexOf(t)]=a:it.push(a)),a.patchFlag=-2,a}if(ny(t)&&(t=t.__vccOpts),e){e=zg(e);let{class:a,style:l}=e;a&&!ke(a)&&(e.class=di(a)),xe(l)&&(fo(l)&&!se(l)&&(l=Ne({},l)),e.style=Js(l))}const o=ke(t)?1:lu(t)?128:Zm(t)?64:xe(t)?4:oe(t)?2:0;return _r(t,e,n,r,i,o,s,!0)}function zg(t){return t?fo(t)||Vc(t)?Ne({},t):t:null}function Rn(t,e,n=!1,r=!1){const{props:i,ref:s,patchFlag:o,children:a,transition:l}=t,u=e?hu(i||{},e):i,c={__v_isVNode:!0,__v_skip:!0,type:t.type,props:u,key:u&&du(u),ref:e&&e.ref?n&&s?se(s)?s.concat(Ri(e)):[s,Ri(e)]:Ri(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!==yt?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&&Rn(t.ssContent),ssFallback:t.ssFallback&&Rn(t.ssFallback),placeholder:t.placeholder,el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce};return l&&r&&mo(c,l.clone(c)),c}function Wg(t=" ",e=0){return Gt(Ti,null,t,e)}function Ct(t){return t==null||typeof t=="boolean"?Gt(In):se(t)?Gt(yt,null,t.slice()):fu(t)?Jt(t):Gt(Ti,null,String(t))}function Jt(t){return t.el===null&&t.patchFlag!==-1||t.memo?t:Rn(t)}function Co(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),Co(t,i()),i._c&&(i._d=!0));return}else{n=32;const i=e._;!i&&!Vc(e)?e._ctx=kt:i===3&&kt&&(kt.slots._===1?e._=1:(e._=2,t.patchFlag|=1024))}else oe(e)?(e={default:e,_ctx:kt},n=32):(e=String(e),r&64?(n=16,e=[Wg(e)]):n=8);t.children=e,t.shapeFlag|=n}function hu(...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=di([e.class,r.class]));else if(i==="style")e.style=Js([e.style,r.style]);else if(li(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){Et(t,e,7,[n,r])}const Vg=Hc();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 pm(!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:Yc(r,i),emitsOptions:su(r,i),emit:null,emitted:null,propsDefaults:he,inheritAttrs:r.inheritAttrs,ctx:he,data:he,props:he,attrs:he,slots:he,refs:he,setupState:he,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=Dg.bind(null,s),t.ce&&t.ce(s),s}let Ke=null;const Oo=()=>Ke||kt;let Di,Po;{const t=fi(),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=>Ke=n),Po=e("__VUE_SSR_SETTERS__",n=>xr=n)}const wr=t=>{const e=Ke;return Di(t),t.scope.on(),()=>{t.scope.off(),Di(e)}},pu=()=>{Ke&&Ke.scope.off(),Di(null)};function mu(t){return t.vnode.shapeFlag&4}let xr=!1;function Gg(t,e=!1,n=!1){e&&Po(e);const{props:r,children:i}=t.vnode,s=mu(t);_g(t,r,s,e),Eg(t,i,n||e);const o=s?Jg(t,e):void 0;return e&&Po(!1),o}function Jg(t,e){const n=t.type;t.accessCache=Object.create(null),t.proxy=new Proxy(t.ctx,dg);const{setup:r}=n;if(r){xt();const i=t.setupContext=r.length>1?Xg(t):null,s=wr(t),o=kn(r,t,0,[t.props,i]),a=ql(o);if(St(),s(),(a||t.sp)&&!dr(t)&&Oc(t),a){if(o.then(pu,pu),e)return o.then(l=>{gu(t,l)}).catch(l=>{Si(l,t,0)});t.asyncDep=o}else gu(t,o)}else yu(t)}function gu(t,e,n){oe(e)?t.type.__ssrInlineRender?t.ssrRender=e:t.render=e:xe(e)&&(t.setupState=bc(e)),yu(t)}function yu(t,e,n){const r=t.type;t.render||(t.render=r.render||wt);{const i=wr(t);xt();try{hg(t)}finally{St(),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 Ao(t){return t.exposed?t.exposeProxy||(t.exposeProxy=new Proxy(bc(Lm(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 vu(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 bu=(t,e)=>Um(t,e,xr),ry="3.5.22";/**
102
+ `,...Eg(i))}kt(),Eo=!1}function Sg(){let t=mr[mr.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 Eg(t){const e=[];return t.forEach((n,r)=>{e.push(...r===0?[]:[`
103
+ `],...kg(n))}),e}function kg({vnode:t,recurseCount:e}){const n=e>0?`... (${e} recursive calls)`:"",r=t.component?t.component.parent==null:!1,i=` at <${ju(t.component,t.type,r)}`,s=">"+n;return t.props?[i,...$g(t.props),s]:[i+s]}function $g(t){const e=[],n=Object.keys(t);return n.slice(0,3).forEach(r=>{e.push(...Fc(r,t[r]))}),n.length>3&&e.push(" ..."),e}function Fc(t,e,n){return $e(e)?(e=JSON.stringify(e),n?e:[`${t}=${e}`]):typeof e=="number"||typeof e=="boolean"||e==null?n?e:[`${t}=${e}`]:Ne(e)?(e=Fc(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 In(t,e,n,r){try{return r?t(...r):t()}catch(i){Ai(i,e,n)}}function $t(t,e,n,r){if(oe(t)){const i=In(t,e,n,r);return i&&cc(i)&&i.catch(s=>{Ai(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 Ai(t,e,n,r=!0){const i=e?e.vnode:null,{errorHandler:s,throwUnhandledErrorInProduction:o}=e&&e.appContext.config||he;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){Et(),In(s,null,10,[t,l,u]),kt();return}}Cg(t,n,i,r,o)}function Cg(t,e,n,r=!0,i=!1){if(i)throw t}const Ve=[];let Ct=-1;const An=[];let Xt=null,Tn=0;const Uc=Promise.resolve();let Ti=null;function Ri(t){const e=Ti||Uc;return t?e.then(this?t.bind(this):t):e}function Pg(t){let e=Ct+1,n=Ve.length;for(;e<n;){const r=e+n>>>1,i=Ve[r],s=gr(i);s<t||s===t&&i.flags&2?e=r+1:n=r}return e}function ko(t){if(!(t.flags&1)){const e=gr(t),n=Ve[Ve.length-1];!n||!(t.flags&2)&&e>=gr(n)?Ve.push(t):Ve.splice(Pg(e),0,t),t.flags|=1,qc()}}function qc(){Ti||(Ti=Uc.then(Wc))}function Og(t){se(t)?An.push(...t):Xt&&t.id===-1?Xt.splice(Tn+1,0,t):t.flags&1||(An.push(t),t.flags|=1),qc()}function Hc(t,e,n=Ct+1){for(;n<Ve.length;n++){const r=Ve[n];if(r&&r.flags&2){if(t&&r.id!==t.uid)continue;Ve.splice(n,1),n--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function zc(t){if(An.length){const e=[...new Set(An)].sort((n,r)=>gr(n)-gr(r));if(An.length=0,Xt){Xt.push(...e);return}for(Xt=e,Tn=0;Tn<Xt.length;Tn++){const n=Xt[Tn];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}Xt=null,Tn=0}}const gr=t=>t.id==null?t.flags&2?-1:1/0:t.id;function Wc(t){try{for(Ct=0;Ct<Ve.length;Ct++){const e=Ve[Ct];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),In(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;Ct<Ve.length;Ct++){const e=Ve[Ct];e&&(e.flags&=-2)}Ct=-1,Ve.length=0,zc(),Ti=null,(Ve.length||An.length)&&Wc()}}let Pt=null,Vc=null;function Ni(t){const e=Pt;return Pt=t,Vc=t&&t.type.__scopeId||null,e}function Ig(t,e=Pt,n){if(!e||t._n)return t;const r=(...i)=>{r._d&&Ou(-1);const s=Ni(e);let o;try{o=t(...i)}finally{Ni(s),r._d&&Ou(1)}return o};return r._n=!0,r._c=!0,r._d=!0,r}function hn(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&&(Et(),$t(l,n,8,[t.el,a,t,e]),kt())}}const Ag=Symbol("_vte"),Tg=t=>t.__isTeleport,Rg=Symbol("_leaveCb");function $o(t,e){t.shapeFlag&6&&t.component?(t.transition=e,$o(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 Kc(t,e){return oe(t)?Le({name:t.name},e,{setup:t}):t}function Yc(t){t.ids=[t.ids[0]+t.ids[2]+++"-",0,0]}function Ng(t){const e=Bo(),n=Pi(null);if(e){const i=e.refs===he?e.refs={}:e.refs;Object.defineProperty(i,t,{enumerable:!0,get:()=>n.value,set:s=>n.value=s})}return n}const Di=new WeakMap;function vr(t,e,n,r,i=!1){if(se(t)){t.forEach((b,A)=>vr(b,e&&(se(e)?e[A]:e),n,r,i));return}if(yr(r)&&!i){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&vr(t,e,n,r.component.subTree);return}const s=r.shapeFlag&4?Uo(r.component):r.el,o=i?null:s,{i:a,r:l}=t,u=e&&e.r,c=a.refs===he?a.refs={}:a.refs,f=a.setupState,y=fe(f),v=f===he?ac:b=>pe(y,b);if(u!=null&&u!==l){if(Gc(e),$e(u))c[u]=null,v(u)&&(f[u]=null);else if(Ne(u)){u.value=null;const b=e;b.k&&(c[b.k]=null)}}if(oe(l))In(l,a,12,[o,c]);else{const b=$e(l),A=Ne(l);if(b||A){const U=()=>{if(t.f){const D=b?v(l)?f[l]:c[l]:l.value;if(i)se(D)&&ro(D,s);else if(se(D))D.includes(s)||D.push(s);else if(b)c[l]=[s],v(l)&&(f[l]=c[l]);else{const I=[s];l.value=I,t.k&&(c[t.k]=I)}}else b?(c[l]=o,v(l)&&(f[l]=o)):A&&(l.value=o,t.k&&(c[t.k]=o))};if(o){const D=()=>{U(),Di.delete(t)};D.id=-1,Di.set(t,D),it(D,n)}else Gc(t),U()}}}function Gc(t){const e=Di.get(t);e&&(e.flags|=8,Di.delete(t))}bi().requestIdleCallback,bi().cancelIdleCallback;const yr=t=>!!t.type.__asyncLoader,Qc=t=>t.type.__isKeepAlive;function Dg(t,e){Jc(t,"a",e)}function Lg(t,e){Jc(t,"da",e)}function Jc(t,e,n=Ye){const r=t.__wdc||(t.__wdc=()=>{let i=n;for(;i;){if(i.isDeactivated)return;i=i.parent}return t()});if(Li(e,r,n),n){let i=n.parent;for(;i&&i.parent;)Qc(i.parent.vnode)&&Mg(r,e,n,i),i=i.parent}}function Mg(t,e,n,r){const i=Li(e,t,r,!0);eu(()=>{ro(r[e],i)},n)}function Li(t,e,n=Ye,r=!1){if(n){const i=n[t]||(n[t]=[]),s=e.__weh||(e.__weh=(...o)=>{Et();const a=Cr(n),l=$t(e,n,t,o);return a(),kt(),l});return r?i.unshift(s):i.push(s),s}}const Ft=t=>(e,n=Ye)=>{(!Pr||t==="sp")&&Li(t,(...r)=>e(...r),n)},Xc=Ft("bm"),Co=Ft("m"),jg=Ft("bu"),Bg=Ft("u"),Zc=Ft("bum"),eu=Ft("um"),Fg=Ft("sp"),Ug=Ft("rtg"),qg=Ft("rtc");function Hg(t,e=Ye){Li("ec",t,e)}const zg=Symbol.for("v-ndc");function tu(t,e,n,r){let i;const s=n,o=se(t);if(o||$e(t)){const a=o&&On(t);let l=!1,u=!1;a&&(l=!ut(t),u=Qt(t),t=xi(t)),i=new Array(t.length);for(let c=0,f=t.length;c<f;c++)i[c]=e(l?u?Ci(Me(t[c])):Me(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 Po=t=>t?Du(t)?Uo(t):Po(t.parent):null,br=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=>Po(t.parent),$root:t=>Po(t.root),$host:t=>t.ce,$emit:t=>t.emit,$options:t=>su(t),$forceUpdate:t=>t.f||(t.f=()=>{ko(t.update)}),$nextTick:t=>t.n||(t.n=Ri.bind(t.proxy)),$watch:t=>dv.bind(t)}),Oo=(t,e)=>t!==he&&!t.__isScriptSetup&&pe(t,e),Wg={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 v=o[e];if(v!==void 0)switch(v){case 1:return r[e];case 2:return i[e];case 4:return n[e];case 3:return s[e]}else{if(Oo(r,e))return o[e]=1,r[e];if(i!==he&&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!==he&&pe(n,e))return o[e]=4,n[e];Io&&(o[e]=0)}}const c=br[e];let f,y;if(c)return e==="$attrs"&&He(t.attrs,"get",""),c(t);if((f=a.__cssModules)&&(f=f[e]))return f;if(n!==he&&pe(n,e))return o[e]=4,n[e];if(y=l.config.globalProperties,pe(y,e))return y[e]},set({_:t},e,n){const{data:r,setupState:i,ctx:s}=t;return Oo(i,e)?(i[e]=n,!0):r!==he&&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!==he&&a[0]!=="$"&&pe(t,a)||Oo(e,a)||(l=s[0])&&pe(l,a)||pe(r,a)||pe(br,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 Mi(t){return se(t)?t.reduce((e,n)=>(e[n]=null,e),{}):t}function nu(t,e){return!t||!e?t||e:se(t)&&se(e)?t.concat(e):Le({},Mi(t),Mi(e))}let Io=!0;function Vg(t){const e=su(t),n=t.proxy,r=t.ctx;Io=!1,e.beforeCreate&&ru(e.beforeCreate,t,"bc");const{data:i,computed:s,methods:o,watch:a,provide:l,inject:u,created:c,beforeMount:f,mounted:y,beforeUpdate:v,updated:b,activated:A,deactivated:U,beforeDestroy:D,beforeUnmount:I,destroyed:g,unmounted:p,render:h,renderTracked:S,renderTriggered:O,errorCaptured:R,serverPrefetch:z,expose:X,inheritAttrs:Ce,components:Te,directives:tt,filters:qt}=e;if(u&&Kg(u,r,null),o)for(const me in o){const ye=o[me];oe(ye)&&(r[me]=ye.bind(n))}if(i){const me=i.call(n,n);Se(me)&&(t.data=_o(me))}if(Io=!0,s)for(const me in s){const ye=s[me],Ht=oe(ye)?ye.bind(n,n):oe(ye.get)?ye.get.bind(n,n):St,Vn=!oe(ye)&&oe(ye.set)?ye.set.bind(n):St,je=Bu({get:Ht,set:Vn});Object.defineProperty(r,me,{enumerable:!0,configurable:!0,get:()=>je.value,set:at=>je.value=at})}if(a)for(const me in a)iu(a[me],r,n,me);if(l){const me=oe(l)?l.call(n):l;Reflect.ownKeys(me).forEach(ye=>{cu(ye,me[ye])})}c&&ru(c,t,"c");function Re(me,ye){se(ye)?ye.forEach(Ht=>me(Ht.bind(n))):ye&&me(ye.bind(n))}if(Re(Xc,f),Re(Co,y),Re(jg,v),Re(Bg,b),Re(Dg,A),Re(Lg,U),Re(Hg,R),Re(qg,S),Re(Ug,O),Re(Zc,I),Re(eu,p),Re(Fg,z),se(X))if(X.length){const me=t.exposed||(t.exposed={});X.forEach(ye=>{Object.defineProperty(me,ye,{get:()=>n[ye],set:Ht=>n[ye]=Ht,enumerable:!0})})}else t.exposed||(t.exposed={});h&&t.render===St&&(t.render=h),Ce!=null&&(t.inheritAttrs=Ce),Te&&(t.components=Te),tt&&(t.directives=tt),z&&Yc(t)}function Kg(t,e,n=St){se(t)&&(t=Ao(t));for(const r in t){const i=t[r];let s;Se(i)?"default"in i?s=_r(i.from||r,i.default,!0):s=_r(i.from||r):s=_r(i),Ne(s)?Object.defineProperty(e,r,{enumerable:!0,configurable:!0,get:()=>s.value,set:o=>s.value=o}):e[r]=s}}function ru(t,e,n){$t(se(t)?t.map(r=>r.bind(e.proxy)):t.bind(e.proxy),e,n)}function iu(t,e,n,r){let i=r.includes(".")?xu(n,r):()=>n[r];if($e(t)){const s=e[t];oe(s)&&Nn(i,s)}else if(oe(t))Nn(i,t.bind(n));else if(Se(t))if(se(t))t.forEach(s=>iu(s,e,n,r));else{const s=oe(t.handler)?t.handler.bind(n):e[t.handler];oe(s)&&Nn(i,s,t)}}function su(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=>ji(l,u,o,!0)),ji(l,e,o)),Se(e)&&s.set(e,l),l}function ji(t,e,n,r=!1){const{mixins:i,extends:s}=e;s&&ji(t,s,n,!0),i&&i.forEach(o=>ji(t,o,n,!0));for(const o in e)if(!(r&&o==="expose")){const a=Yg[o]||n&&n[o];t[o]=a?a(t[o],e[o]):e[o]}return t}const Yg={data:ou,props:au,emits:au,methods:wr,computed:wr,beforeCreate:Ke,created:Ke,beforeMount:Ke,mounted:Ke,beforeUpdate:Ke,updated:Ke,beforeDestroy:Ke,beforeUnmount:Ke,destroyed:Ke,unmounted:Ke,activated:Ke,deactivated:Ke,errorCaptured:Ke,serverPrefetch:Ke,components:wr,directives:wr,watch:Qg,provide:ou,inject:Gg};function ou(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 Gg(t,e){return wr(Ao(t),Ao(e))}function Ao(t){if(se(t)){const e={};for(let n=0;n<t.length;n++)e[t[n]]=t[n];return e}return t}function Ke(t,e){return t?[...new Set([].concat(t,e))]:e}function wr(t,e){return t?Le(Object.create(null),t,e):e}function au(t,e){return t?se(t)&&se(e)?[...new Set([...t,...e])]:Le(Object.create(null),Mi(t),Mi(e??{})):e}function Qg(t,e){if(!t)return e;if(!e)return t;const n=Le(Object.create(null),t);for(const r in e)n[r]=Ke(t[r],e[r]);return n}function lu(){return{app:null,config:{isNativeTag:ac,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 Jg=0;function Xg(t,e){return function(r,i=null){oe(r)||(r=Le({},r)),i!=null&&!Se(i)&&(i=null);const s=lu(),o=new WeakSet,a=[];let l=!1;const u=s.app={_uid:Jg++,_component:r,_props:i,_container:null,_context:s,_instance:null,version:Lv,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,y){if(!l){const v=u._ceVNode||Zt(r,i);return v.appContext=s,y===!0?y="svg":y===!1&&(y=void 0),t(v,c,y),l=!0,u._container=c,c.__vue_app__=u,Uo(v.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=Rn;Rn=u;try{return c()}finally{Rn=f}}};return u}}let Rn=null;function cu(t,e){if(Ye){let n=Ye.provides;const r=Ye.parent&&Ye.parent.provides;r===n&&(n=Ye.provides=Object.create(r)),n[t]=e}}function _r(t,e,n=!1){const r=Bo();if(r||Rn){let i=Rn?Rn._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 uu={},fu=()=>Object.create(uu),du=t=>Object.getPrototypeOf(t)===uu;function Zg(t,e,n,r=!1){const i={},s=fu();t.propsDefaults=Object.create(null),hu(t,e,i,s);for(const o in t.propsOptions[0])o in i||(i[o]=void 0);n?t.props=r?i:hg(i):t.type.props?t.props=i:t.props=s,t.attrs=s}function ev(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 y=c[f];if(Bi(t.emitsOptions,y))continue;const v=e[y];if(l)if(pe(s,y))v!==s[y]&&(s[y]=v,u=!0);else{const b=Mt(y);i[b]=To(l,a,b,v,t,!1)}else v!==s[y]&&(s[y]=v,u=!0)}}}else{hu(t,e,i,s)&&(u=!0);let c;for(const f in a)(!e||!pe(e,f)&&((c=Gt(f))===f||!pe(e,c)))&&(l?n&&(n[f]!==void 0||n[c]!==void 0)&&(i[f]=To(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&&jt(t.attrs,"set","")}function hu(t,e,n,r){const[i,s]=t.propsOptions;let o=!1,a;if(e)for(let l in e){if(cr(l))continue;const u=e[l];let c;i&&pe(i,c=Mt(l))?!s||!s.includes(c)?n[c]=u:(a||(a={}))[c]=u:Bi(t.emitsOptions,l)||(!(l in r)||u!==r[l])&&(r[l]=u,o=!0)}if(s){const l=fe(n),u=a||he;for(let c=0;c<s.length;c++){const f=s[c];n[f]=To(i,l,f,u[f],t,!pe(u,f))}}return o}function To(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=Cr(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===Gt(n))&&(r=!0))}return r}const tv=new WeakMap;function pu(t,e,n=!1){const r=n?tv: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[y,v]=pu(f,e,!0);Le(o,y),v&&a.push(...v)};!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,$n),$n;if(se(s))for(let c=0;c<s.length;c++){const f=Mt(s[c]);mu(f)&&(o[f]=he)}else if(s)for(const c in s){const f=Mt(c);if(mu(f)){const y=s[c],v=o[f]=se(y)||oe(y)?{type:y}:Le({},y),b=v.type;let A=!1,U=!0;if(se(b))for(let D=0;D<b.length;++D){const I=b[D],g=oe(I)&&I.name;if(g==="Boolean"){A=!0;break}else g==="String"&&(U=!1)}else A=oe(b)&&b.name==="Boolean";v[0]=A,v[1]=U,(A||pe(v,"default"))&&a.push(f)}}const u=[o,a];return Se(t)&&r.set(t,u),u}function mu(t){return t[0]!=="$"&&!cr(t)}const Ro=t=>t==="_"||t==="_ctx"||t==="$stable",No=t=>se(t)?t.map(Ot):[Ot(t)],nv=(t,e,n)=>{if(e._n)return e;const r=Ig((...i)=>No(e(...i)),n);return r._c=!1,r},gu=(t,e,n)=>{const r=t._ctx;for(const i in t){if(Ro(i))continue;const s=t[i];if(oe(s))e[i]=nv(i,s,r);else if(s!=null){const o=No(s);e[i]=()=>o}}},vu=(t,e)=>{const n=No(e);t.slots.default=()=>n},yu=(t,e,n)=>{for(const r in e)(n||!Ro(r))&&(t[r]=e[r])},rv=(t,e,n)=>{const r=t.slots=fu();if(t.vnode.shapeFlag&32){const i=e._;i?(yu(r,e,n),n&&hc(r,"_",i,!0)):gu(e,r)}else e&&vu(t,e)},iv=(t,e,n)=>{const{vnode:r,slots:i}=t;let s=!0,o=he;if(r.shapeFlag&32){const a=e._;a?n&&a===1?s=!1:yu(i,e,n):(s=!e.$stable,gu(e,i)),o=e}else e&&(vu(t,e),o={default:1});if(s)for(const a in i)!Ro(a)&&o[a]==null&&delete i[a]},it=bv;function sv(t){return ov(t)}function ov(t,e){const n=bi();n.__VUE__=!0;const{insert:r,remove:i,patchProp:s,createElement:o,createText:a,createComment:l,setText:u,setElementText:c,parentNode:f,nextSibling:y,setScopeId:v=St,insertStaticContent:b}=t,A=(_,k,T,L=null,M=null,j=null,G=void 0,K=null,W=!!k.dynamicChildren)=>{if(_===k)return;_&&!kr(_,k)&&(L=Kn(_),at(_,M,j,!0),_=null),k.patchFlag===-2&&(W=!1,k.dynamicChildren=null);const{type:F,ref:ee,shapeFlag:Q}=k;switch(F){case Fi:U(_,k,T,L);break;case Dn:D(_,k,T,L);break;case Mo:_==null&&I(k,T,L,G);break;case vt:Te(_,k,T,L,M,j,G,K,W);break;default:Q&1?h(_,k,T,L,M,j,G,K,W):Q&6?tt(_,k,T,L,M,j,G,K,W):(Q&64||Q&128)&&F.process(_,k,T,L,M,j,G,K,W,_n)}ee!=null&&M?vr(ee,_&&_.ref,j,k||_,!k):ee==null&&_&&_.ref!=null&&vr(_.ref,null,j,_,!0)},U=(_,k,T,L)=>{if(_==null)r(k.el=a(k.children),T,L);else{const M=k.el=_.el;k.children!==_.children&&u(M,k.children)}},D=(_,k,T,L)=>{_==null?r(k.el=l(k.children||""),T,L):k.el=_.el},I=(_,k,T,L)=>{[_.el,_.anchor]=b(_.children,k,T,L,_.el,_.anchor)},g=({el:_,anchor:k},T,L)=>{let M;for(;_&&_!==k;)M=y(_),r(_,T,L),_=M;r(k,T,L)},p=({el:_,anchor:k})=>{let T;for(;_&&_!==k;)T=y(_),i(_),_=T;i(k)},h=(_,k,T,L,M,j,G,K,W)=>{k.type==="svg"?G="svg":k.type==="math"&&(G="mathml"),_==null?S(k,T,L,M,j,G,K,W):z(_,k,M,j,G,K,W)},S=(_,k,T,L,M,j,G,K)=>{let W,F;const{props:ee,shapeFlag:Q,transition:Z,dirs:re}=_;if(W=_.el=o(_.type,j,ee&&ee.is,ee),Q&8?c(W,_.children):Q&16&&R(_.children,W,null,L,M,Do(_,j),G,K),re&&hn(_,null,L,"created"),O(W,_,_.scopeId,G,L),ee){for(const be in ee)be!=="value"&&!cr(be)&&s(W,be,null,ee[be],j,L);"value"in ee&&s(W,"value",null,ee.value,j),(F=ee.onVnodeBeforeMount)&&It(F,L,_)}re&&hn(_,null,L,"beforeMount");const ce=av(M,Z);ce&&Z.beforeEnter(W),r(W,k,T),((F=ee&&ee.onVnodeMounted)||ce||re)&&it(()=>{F&&It(F,L,_),ce&&Z.enter(W),re&&hn(_,null,L,"mounted")},M)},O=(_,k,T,L,M)=>{if(T&&v(_,T),L)for(let j=0;j<L.length;j++)v(_,L[j]);if(M){let j=M.subTree;if(k===j||Pu(j.type)&&(j.ssContent===k||j.ssFallback===k)){const G=M.vnode;O(_,G,G.scopeId,G.slotScopeIds,M.parent)}}},R=(_,k,T,L,M,j,G,K,W=0)=>{for(let F=W;F<_.length;F++){const ee=_[F]=K?en(_[F]):Ot(_[F]);A(null,ee,k,T,L,M,j,G,K)}},z=(_,k,T,L,M,j,G)=>{const K=k.el=_.el;let{patchFlag:W,dynamicChildren:F,dirs:ee}=k;W|=_.patchFlag&16;const Q=_.props||he,Z=k.props||he;let re;if(T&&pn(T,!1),(re=Z.onVnodeBeforeUpdate)&&It(re,T,k,_),ee&&hn(k,_,T,"beforeUpdate"),T&&pn(T,!0),(Q.innerHTML&&Z.innerHTML==null||Q.textContent&&Z.textContent==null)&&c(K,""),F?X(_.dynamicChildren,F,K,T,L,Do(k,M),j):G||ye(_,k,K,null,T,L,Do(k,M),j,!1),W>0){if(W&16)Ce(K,Q,Z,T,M);else if(W&2&&Q.class!==Z.class&&s(K,"class",null,Z.class,M),W&4&&s(K,"style",Q.style,Z.style,M),W&8){const ce=k.dynamicProps;for(let be=0;be<ce.length;be++){const de=ce[be],Be=Q[de],Fe=Z[de];(Fe!==Be||de==="value")&&s(K,de,Be,Fe,M,T)}}W&1&&_.children!==k.children&&c(K,k.children)}else!G&&F==null&&Ce(K,Q,Z,T,M);((re=Z.onVnodeUpdated)||ee)&&it(()=>{re&&It(re,T,k,_),ee&&hn(k,_,T,"updated")},L)},X=(_,k,T,L,M,j,G)=>{for(let K=0;K<k.length;K++){const W=_[K],F=k[K],ee=W.el&&(W.type===vt||!kr(W,F)||W.shapeFlag&198)?f(W.el):T;A(W,F,ee,null,L,M,j,G,!0)}},Ce=(_,k,T,L,M)=>{if(k!==T){if(k!==he)for(const j in k)!cr(j)&&!(j in T)&&s(_,j,k[j],null,M,L);for(const j in T){if(cr(j))continue;const G=T[j],K=k[j];G!==K&&j!=="value"&&s(_,j,K,G,M,L)}"value"in T&&s(_,"value",k.value,T.value,M)}},Te=(_,k,T,L,M,j,G,K,W)=>{const F=k.el=_?_.el:a(""),ee=k.anchor=_?_.anchor:a("");let{patchFlag:Q,dynamicChildren:Z,slotScopeIds:re}=k;re&&(K=K?K.concat(re):re),_==null?(r(F,T,L),r(ee,T,L),R(k.children||[],T,ee,M,j,G,K,W)):Q>0&&Q&64&&Z&&_.dynamicChildren?(X(_.dynamicChildren,Z,T,M,j,G,K),(k.key!=null||M&&k===M.subTree)&&bu(_,k,!0)):ye(_,k,T,ee,M,j,G,K,W)},tt=(_,k,T,L,M,j,G,K,W)=>{k.slotScopeIds=K,_==null?k.shapeFlag&512?M.ctx.activate(k,T,L,G,W):qt(k,T,L,M,j,G,W):bn(_,k,W)},qt=(_,k,T,L,M,j,G)=>{const K=_.component=Cv(_,L,M);if(Qc(_)&&(K.ctx.renderer=_n),Pv(K,!1,G),K.asyncDep){if(M&&M.registerDep(K,Re,G),!_.el){const W=K.subTree=Zt(Dn);D(null,W,k,T),_.placeholder=W.el}}else Re(K,_,k,T,M,j,G)},bn=(_,k,T)=>{const L=k.component=_.component;if(vv(_,k,T))if(L.asyncDep&&!L.asyncResolved){me(L,k,T);return}else L.next=k,L.update();else k.el=_.el,L.vnode=k},Re=(_,k,T,L,M,j,G)=>{const K=()=>{if(_.isMounted){let{next:Q,bu:Z,u:re,parent:ce,vnode:be}=_;{const ct=wu(_);if(ct){Q&&(Q.el=be.el,me(_,Q,G)),ct.asyncDep.then(()=>{_.isUnmounted||K()});return}}let de=Q,Be;pn(_,!1),Q?(Q.el=be.el,me(_,Q,G)):Q=be,Z&&oo(Z),(Be=Q.props&&Q.props.onVnodeBeforeUpdate)&&It(Be,ce,Q,be),pn(_,!0);const Fe=$u(_),lt=_.subTree;_.subTree=Fe,A(lt,Fe,f(lt.el),Kn(lt),_,M,j),Q.el=Fe.el,de===null&&yv(_,Fe.el),re&&it(re,M),(Be=Q.props&&Q.props.onVnodeUpdated)&&it(()=>It(Be,ce,Q,be),M)}else{let Q;const{el:Z,props:re}=k,{bm:ce,m:be,parent:de,root:Be,type:Fe}=_,lt=yr(k);pn(_,!1),ce&&oo(ce),!lt&&(Q=re&&re.onVnodeBeforeMount)&&It(Q,de,k),pn(_,!0);{Be.ce&&Be.ce._def.shadowRoot!==!1&&Be.ce._injectChildStyle(Fe);const ct=_.subTree=$u(_);A(null,ct,T,L,_,M,j),k.el=ct.el}if(be&&it(be,M),!lt&&(Q=re&&re.onVnodeMounted)){const ct=k;it(()=>It(Q,de,ct),M)}(k.shapeFlag&256||de&&yr(de.vnode)&&de.vnode.shapeFlag&256)&&_.a&&it(_.a,M),_.isMounted=!0,k=T=L=null}};_.scope.on();const W=_.effect=new yc(K);_.scope.off();const F=_.update=W.run.bind(W),ee=_.job=W.runIfDirty.bind(W);ee.i=_,ee.id=_.uid,W.scheduler=()=>ko(ee),pn(_,!0),F()},me=(_,k,T)=>{k.component=_;const L=_.vnode.props;_.vnode=k,_.next=null,ev(_,k.props,L,T),iv(_,k.children,T),Et(),Hc(_),kt()},ye=(_,k,T,L,M,j,G,K,W=!1)=>{const F=_&&_.children,ee=_?_.shapeFlag:0,Q=k.children,{patchFlag:Z,shapeFlag:re}=k;if(Z>0){if(Z&128){Vn(F,Q,T,L,M,j,G,K,W);return}else if(Z&256){Ht(F,Q,T,L,M,j,G,K,W);return}}re&8?(ee&16&&wn(F,M,j),Q!==F&&c(T,Q)):ee&16?re&16?Vn(F,Q,T,L,M,j,G,K,W):wn(F,M,j,!0):(ee&8&&c(T,""),re&16&&R(Q,T,L,M,j,G,K,W))},Ht=(_,k,T,L,M,j,G,K,W)=>{_=_||$n,k=k||$n;const F=_.length,ee=k.length,Q=Math.min(F,ee);let Z;for(Z=0;Z<Q;Z++){const re=k[Z]=W?en(k[Z]):Ot(k[Z]);A(_[Z],re,T,null,M,j,G,K,W)}F>ee?wn(_,M,j,!0,!1,Q):R(k,T,L,M,j,G,K,W,Q)},Vn=(_,k,T,L,M,j,G,K,W)=>{let F=0;const ee=k.length;let Q=_.length-1,Z=ee-1;for(;F<=Q&&F<=Z;){const re=_[F],ce=k[F]=W?en(k[F]):Ot(k[F]);if(kr(re,ce))A(re,ce,T,null,M,j,G,K,W);else break;F++}for(;F<=Q&&F<=Z;){const re=_[Q],ce=k[Z]=W?en(k[Z]):Ot(k[Z]);if(kr(re,ce))A(re,ce,T,null,M,j,G,K,W);else break;Q--,Z--}if(F>Q){if(F<=Z){const re=Z+1,ce=re<ee?k[re].el:L;for(;F<=Z;)A(null,k[F]=W?en(k[F]):Ot(k[F]),T,ce,M,j,G,K,W),F++}}else if(F>Z)for(;F<=Q;)at(_[F],M,j,!0),F++;else{const re=F,ce=F,be=new Map;for(F=ce;F<=Z;F++){const Ge=k[F]=W?en(k[F]):Ot(k[F]);Ge.key!=null&&be.set(Ge.key,F)}let de,Be=0;const Fe=Z-ce+1;let lt=!1,ct=0;const nn=new Array(Fe);for(F=0;F<Fe;F++)nn[F]=0;for(F=re;F<=Q;F++){const Ge=_[F];if(Be>=Fe){at(Ge,M,j,!0);continue}let ht;if(Ge.key!=null)ht=be.get(Ge.key);else for(de=ce;de<=Z;de++)if(nn[de-ce]===0&&kr(Ge,k[de])){ht=de;break}ht===void 0?at(Ge,M,j,!0):(nn[ht-ce]=F+1,ht>=ct?ct=ht:lt=!0,A(Ge,k[ht],T,null,M,j,G,K,W),Be++)}const Yn=lt?lv(nn):$n;for(de=Yn.length-1,F=Fe-1;F>=0;F--){const Ge=ce+F,ht=k[Ge],Gn=k[Ge+1],Nr=Ge+1<ee?Gn.el||Gn.placeholder:L;nn[F]===0?A(null,ht,T,Nr,M,j,G,K,W):lt&&(de<0||F!==Yn[de]?je(ht,T,Nr,2):de--)}}},je=(_,k,T,L,M=null)=>{const{el:j,type:G,transition:K,children:W,shapeFlag:F}=_;if(F&6){je(_.component.subTree,k,T,L);return}if(F&128){_.suspense.move(k,T,L);return}if(F&64){G.move(_,k,T,_n);return}if(G===vt){r(j,k,T);for(let Q=0;Q<W.length;Q++)je(W[Q],k,T,L);r(_.anchor,k,T);return}if(G===Mo){g(_,k,T);return}if(L!==2&&F&1&&K)if(L===0)K.beforeEnter(j),r(j,k,T),it(()=>K.enter(j),M);else{const{leave:Q,delayLeave:Z,afterLeave:re}=K,ce=()=>{_.ctx.isUnmounted?i(j):r(j,k,T)},be=()=>{j._isLeaving&&j[Rg](!0),Q(j,()=>{ce(),re&&re()})};Z?Z(j,ce,be):be()}else r(j,k,T)},at=(_,k,T,L=!1,M=!1)=>{const{type:j,props:G,ref:K,children:W,dynamicChildren:F,shapeFlag:ee,patchFlag:Q,dirs:Z,cacheIndex:re}=_;if(Q===-2&&(M=!1),K!=null&&(Et(),vr(K,null,T,_,!0),kt()),re!=null&&(k.renderCache[re]=void 0),ee&256){k.ctx.deactivate(_);return}const ce=ee&1&&Z,be=!yr(_);let de;if(be&&(de=G&&G.onVnodeBeforeUnmount)&&It(de,k,_),ee&6)ta(_.component,T,L);else{if(ee&128){_.suspense.unmount(T,L);return}ce&&hn(_,null,k,"beforeUnmount"),ee&64?_.type.remove(_,k,T,_n,L):F&&!F.hasOnce&&(j!==vt||Q>0&&Q&64)?wn(F,k,T,!1,!0):(j===vt&&Q&384||!M&&ee&16)&&wn(W,k,T),L&&Ji(_)}(be&&(de=G&&G.onVnodeUnmounted)||ce)&&it(()=>{de&&It(de,k,_),ce&&hn(_,null,k,"unmounted")},T)},Ji=_=>{const{type:k,el:T,anchor:L,transition:M}=_;if(k===vt){ea(T,L);return}if(k===Mo){p(_);return}const j=()=>{i(T),M&&!M.persisted&&M.afterLeave&&M.afterLeave()};if(_.shapeFlag&1&&M&&!M.persisted){const{leave:G,delayLeave:K}=M,W=()=>G(T,j);K?K(_.el,j,W):W()}else j()},ea=(_,k)=>{let T;for(;_!==k;)T=y(_),i(_),_=T;i(k)},ta=(_,k,T)=>{const{bum:L,scope:M,job:j,subTree:G,um:K,m:W,a:F}=_;_u(W),_u(F),L&&oo(L),M.stop(),j&&(j.flags|=8,at(G,_,k,T)),K&&it(K,k),it(()=>{_.isUnmounted=!0},k)},wn=(_,k,T,L=!1,M=!1,j=0)=>{for(let G=j;G<_.length;G++)at(_[G],k,T,L,M)},Kn=_=>{if(_.shapeFlag&6)return Kn(_.component.subTree);if(_.shapeFlag&128)return _.suspense.next();const k=y(_.anchor||_.el),T=k&&k[Ag];return T?y(T):k};let Rr=!1;const Xi=(_,k,T)=>{_==null?k._vnode&&at(k._vnode,null,null,!0):A(k._vnode||null,_,k,null,null,null,T),k._vnode=_,Rr||(Rr=!0,Hc(),zc(),Rr=!1)},_n={p:A,um:at,m:je,r:Ji,mt:qt,mc:R,pc:ye,pbc:X,n:Kn,o:t};return{render:Xi,hydrate:void 0,createApp:Xg(Xi)}}function Do({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 pn({effect:t,job:e},n){n?(t.flags|=32,e.flags|=4):(t.flags&=-33,e.flags&=-5)}function av(t,e){return(!t||t&&!t.pendingBranch)&&e&&!e.persisted}function bu(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]=en(i[s]),a.el=o.el),!n&&a.patchFlag!==-2&&bu(o,a)),a.type===Fi&&a.patchFlag!==-1&&(a.el=o.el),a.type===Dn&&!a.el&&(a.el=o.el)}}function lv(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 wu(t){const e=t.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:wu(e)}function _u(t){if(t)for(let e=0;e<t.length;e++)t[e].flags|=8}const cv=Symbol.for("v-scx"),uv=()=>_r(cv);function fv(t,e){return Lo(t,null,{flush:"sync"})}function Nn(t,e,n){return Lo(t,e,n)}function Lo(t,e,n=he){const{immediate:r,deep:i,flush:s,once:o}=n,a=Le({},n),l=e&&r||!e&&s!=="post";let u;if(Pr){if(s==="sync"){const v=uv();u=v.__watcherHandles||(v.__watcherHandles=[])}else if(!l){const v=()=>{};return v.stop=St,v.resume=St,v.pause=St,v}}const c=Ye;a.call=(v,b,A)=>$t(v,c,b,A);let f=!1;s==="post"?a.scheduler=v=>{it(v,c&&c.suspense)}:s!=="sync"&&(f=!0,a.scheduler=(v,b)=>{b?v():ko(v)}),a.augmentJob=v=>{e&&(v.flags|=4),f&&(v.flags|=2,c&&(v.id=c.uid,v.i=c))};const y=xg(t,e,a);return Pr&&(u?u.push(y):l&&y()),y}function dv(t,e,n){const r=this.proxy,i=$e(t)?t.includes(".")?xu(r,t):()=>r[t]:t.bind(r,r);let s;oe(e)?s=e:(s=e.handler,n=e);const o=Cr(this),a=Lo(i,s.bind(r),n);return o(),a}function xu(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=he){const r=Bo(),i=Mt(e),s=Gt(e),o=Eu(t,i),a=yg((l,u)=>{let c,f=he,y;return fv(()=>{const v=t[i];Ze(c,v)&&(c=v,u())}),{get(){return l(),n.get?n.get(c):c},set(v){const b=n.set?n.set(v):v;if(!Ze(b,c)&&!(f!==he&&Ze(v,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=v,u()),r.emit(`update:${e}`,b),Ze(v,b)&&Ze(v,f)&&!Ze(b,y)&&u(),f=v,y=b}}});return a[Symbol.iterator]=()=>{let l=0;return{next(){return l<2?{value:l++?o||he:a,done:!1}:{done:!0}}}},a}const Eu=(t,e)=>e==="modelValue"||e==="model-value"?t.modelModifiers:t[`${e}Modifiers`]||t[`${Mt(e)}Modifiers`]||t[`${Gt(e)}Modifiers`];function hv(t,e,...n){if(t.isUnmounted)return;const r=t.vnode.props||he;let i=n;const s=e.startsWith("update:"),o=s&&Eu(r,e.slice(7));o&&(o.trim&&(i=n.map(c=>$e(c)?c.trim():c)),o.number&&(i=n.map(Um)));let a,l=r[a=so(e)]||r[a=so(Mt(e))];!l&&s&&(l=r[a=so(Gt(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 pv=new WeakMap;function ku(t,e,n=!1){const r=n?pv: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=ku(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 Bi(t,e){return!t||!gi(e)?!1:(e=e.slice(2).replace(/Once$/,""),pe(t,e[0].toLowerCase()+e.slice(1))||pe(t,Gt(e))||pe(t,e))}function Ib(){}function $u(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:y,setupState:v,ctx:b,inheritAttrs:A}=t,U=Ni(t);let D,I;try{if(n.shapeFlag&4){const p=i||r,h=p;D=Ot(u.call(h,p,c,f,v,y,b)),I=a}else{const p=e;D=Ot(p.length>1?p(f,{attrs:a,slots:o,emit:l}):p(f,null)),I=e.props?a:mv(a)}}catch(p){xr.length=0,Ai(p,t,1),D=Zt(Dn)}let g=D;if(I&&A!==!1){const p=Object.keys(I),{shapeFlag:h}=g;p.length&&h&7&&(s&&p.some(no)&&(I=gv(I,s)),g=Mn(g,I,!1,!0))}return n.dirs&&(g=Mn(g,null,!1,!0),g.dirs=g.dirs?g.dirs.concat(n.dirs):n.dirs),n.transition&&$o(g,n.transition),D=g,Ni(U),D}const mv=t=>{let e;for(const n in t)(n==="class"||n==="style"||gi(n))&&((e||(e={}))[n]=t[n]);return e},gv=(t,e)=>{const n={};for(const r in t)(!no(r)||!(r.slice(9)in e))&&(n[r]=t[r]);return n};function vv(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 y=c[f];if(o[y]!==r[y]&&!Bi(u,y))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]&&!Bi(n,s))return!0}return!1}function yv({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 Pu=t=>t.__isSuspense;function bv(t,e){e&&e.pendingBranch?se(t)?e.effects.push(...t):e.effects.push(t):Og(t)}const vt=Symbol.for("v-fgt"),Fi=Symbol.for("v-txt"),Dn=Symbol.for("v-cmt"),Mo=Symbol.for("v-stc"),xr=[];let st=null;function Ln(t=!1){xr.push(st=t?null:[])}function wv(){xr.pop(),st=xr[xr.length-1]||null}let Sr=1;function Ou(t,e=!1){Sr+=t,t<0&&st&&e&&(st.hasOnce=!0)}function Iu(t){return t.dynamicChildren=Sr>0?st||$n:null,wv(),Sr>0&&st&&st.push(t),t}function Er(t,e,n,r,i,s){return Iu($r(t,e,n,r,i,s,!0))}function _v(t,e,n,r,i){return Iu(Zt(t,e,n,r,i,!0))}function Au(t){return t?t.__v_isVNode===!0:!1}function kr(t,e){return t.type===e.type&&t.key===e.key}const Tu=({key:t})=>t??null,Ui=({ref:t,ref_key:e,ref_for:n})=>(typeof t=="number"&&(t=""+t),t!=null?$e(t)||Ne(t)||oe(t)?{i:Pt,r:t,k:e,f:!!n}:t:null);function $r(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&&Tu(e),ref:e&&Ui(e),scopeId:Vc,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:Pt};return a?(jo(l,n),s&128&&t.normalize(l)):n&&(l.shapeFlag|=$e(n)?8:16),Sr>0&&!o&&st&&(l.patchFlag>0||s&6)&&l.patchFlag!==32&&st.push(l),l}const Zt=xv;function xv(t,e=null,n=null,r=0,i=null,s=!1){if((!t||t===zg)&&(t=Dn),Au(t)){const a=Mn(t,e,!0);return n&&jo(a,n),Sr>0&&!s&&st&&(a.shapeFlag&6?st[st.indexOf(t)]=a:st.push(a)),a.patchFlag=-2,a}if(Dv(t)&&(t=t.__vccOpts),e){e=Sv(e);let{class:a,style:l}=e;a&&!$e(a)&&(e.class=wi(a)),Se(l)&&(So(l)&&!se(l)&&(l=Le({},l)),e.style=ao(l))}const o=$e(t)?1:Pu(t)?128:Tg(t)?64:Se(t)?4:oe(t)?2:0;return $r(t,e,n,r,i,o,s,!0)}function Sv(t){return t?So(t)||du(t)?Le({},t):t:null}function Mn(t,e,n=!1,r=!1){const{props:i,ref:s,patchFlag:o,children:a,transition:l}=t,u=e?Ru(i||{},e):i,c={__v_isVNode:!0,__v_skip:!0,type:t.type,props:u,key:u&&Tu(u),ref:e&&e.ref?n&&s?se(s)?s.concat(Ui(e)):[s,Ui(e)]:Ui(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&&Mn(t.ssContent),ssFallback:t.ssFallback&&Mn(t.ssFallback),placeholder:t.placeholder,el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce};return l&&r&&$o(c,l.clone(c)),c}function Ev(t=" ",e=0){return Zt(Fi,null,t,e)}function Ot(t){return t==null||typeof t=="boolean"?Zt(Dn):se(t)?Zt(vt,null,t.slice()):Au(t)?en(t):Zt(Fi,null,String(t))}function en(t){return t.el===null&&t.patchFlag!==-1||t.memo?t:Mn(t)}function jo(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),jo(t,i()),i._c&&(i._d=!0));return}else{n=32;const i=e._;!i&&!du(e)?e._ctx=Pt:i===3&&Pt&&(Pt.slots._===1?e._=1:(e._=2,t.patchFlag|=1024))}else oe(e)?(e={default:e,_ctx:Pt},n=32):(e=String(e),r&64?(n=16,e=[Ev(e)]):n=8);t.children=e,t.shapeFlag|=n}function Ru(...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=wi([e.class,r.class]));else if(i==="style")e.style=ao([e.style,r.style]);else if(gi(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 It(t,e,n,r=null){$t(t,e,7,[n,r])}const kv=lu();let $v=0;function Cv(t,e,n){const r=t.type,i=(e?e.appContext:t.appContext)||kv,s={uid:$v++,vnode:t,type:r,parent:e,appContext:i,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Km(!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:pu(r,i),emitsOptions:ku(r,i),emit:null,emitted:null,propsDefaults:he,inheritAttrs:r.inheritAttrs,ctx:he,data:he,props:he,attrs:he,slots:he,refs:he,setupState:he,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=hv.bind(null,s),t.ce&&t.ce(s),s}let Ye=null;const Bo=()=>Ye||Pt;let qi,Fo;{const t=bi(),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)}};qi=e("__VUE_INSTANCE_SETTERS__",n=>Ye=n),Fo=e("__VUE_SSR_SETTERS__",n=>Pr=n)}const Cr=t=>{const e=Ye;return qi(t),t.scope.on(),()=>{t.scope.off(),qi(e)}},Nu=()=>{Ye&&Ye.scope.off(),qi(null)};function Du(t){return t.vnode.shapeFlag&4}let Pr=!1;function Pv(t,e=!1,n=!1){e&&Fo(e);const{props:r,children:i}=t.vnode,s=Du(t);Zg(t,r,s,e),rv(t,i,n||e);const o=s?Ov(t,e):void 0;return e&&Fo(!1),o}function Ov(t,e){const n=t.type;t.accessCache=Object.create(null),t.proxy=new Proxy(t.ctx,Wg);const{setup:r}=n;if(r){Et();const i=t.setupContext=r.length>1?Av(t):null,s=Cr(t),o=In(r,t,0,[t.props,i]),a=cc(o);if(kt(),s(),(a||t.sp)&&!yr(t)&&Yc(t),a){if(o.then(Nu,Nu),e)return o.then(l=>{Lu(t,l)}).catch(l=>{Ai(l,t,0)});t.asyncDep=o}else Lu(t,o)}else Mu(t)}function Lu(t,e,n){oe(e)?t.type.__ssrInlineRender?t.ssrRender=e:t.render=e:Se(e)&&(t.setupState=Bc(e)),Mu(t)}function Mu(t,e,n){const r=t.type;t.render||(t.render=r.render||St);{const i=Cr(t);Et();try{Vg(t)}finally{kt(),i()}}}const Iv={get(t,e){return He(t,"get",""),t[e]}};function Av(t){const e=n=>{t.exposed=n||{}};return{attrs:new Proxy(t.attrs,Iv),slots:t.slots,emit:t.emit,expose:e}}function Uo(t){return t.exposed?t.exposeProxy||(t.exposeProxy=new Proxy(Bc(pg(t.exposed)),{get(e,n){if(n in e)return e[n];if(n in br)return br[n](t)},has(e,n){return n in e||n in br}})):t.proxy}const Tv=/(?:^|[-_])\w/g,Rv=t=>t.replace(Tv,e=>e.toUpperCase()).replace(/[-_]/g,"");function Nv(t,e=!0){return oe(t)?t.displayName||t.name:t.name||e&&t.__name}function ju(t,e,n=!1){let r=Nv(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?Rv(r):n?"App":"Anonymous"}function Dv(t){return oe(t)&&"__vccOpts"in t}const Bu=(t,e)=>wg(t,e,Pr),Lv="3.5.22";/**
104
104
  * @vue/runtime-dom v3.5.22
105
105
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
106
106
  * @license MIT
107
- **/let Io;const _u=typeof window<"u"&&window.trustedTypes;if(_u)try{Io=_u.createPolicy("vue",{createHTML:t=>t})}catch{}const wu=Io?t=>Io.createHTML(t):t=>t,iy="http://www.w3.org/2000/svg",sy="http://www.w3.org/1998/Math/MathML",jt=typeof document<"u"?document:null,xu=jt&&jt.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"?jt.createElementNS(iy,t):e==="mathml"?jt.createElementNS(sy,t):n?jt.createElement(t,{is:n}):jt.createElement(t);return t==="select"&&r&&r.multiple!=null&&i.setAttribute("multiple",r.multiple),i},createText:t=>jt.createTextNode(t),createComment:t=>jt.createComment(t),setText:(t,e)=>{t.nodeValue=e},setElementText:(t,e)=>{t.textContent=e},parentNode:t=>t.parentNode,nextSibling:t=>t.nextSibling,querySelector:t=>jt.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{xu.innerHTML=wu(r==="svg"?`<svg>${t}</svg>`:r==="mathml"?`<math>${t}</math>`:t);const a=xu.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 Su=Symbol("_vod"),cy=Symbol("_vsh"),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&&Li(r,a,"")}else for(const o in e)n[o]==null&&Li(r,o,"");for(const o in n)o==="display"&&(s=!0),Li(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");Su in t&&(t[Su]=s?r.display:"",t[cy]&&(r.display="none"))}const Eu=/\s*!important$/;function Li(t,e,n){if(se(n))n.forEach(r=>Li(t,e,r));else if(n==null&&(n=""),e.startsWith("--"))t.setProperty(e,n);else{const r=hy(t,e);Eu.test(n)?t.setProperty(Wt(r),n.replace(Eu,""),"important"):t[r]=n}}const $u=["Webkit","Moz","ms"],To={};function hy(t,e){const n=To[e];if(n)return n;let r=Dt(e);if(r!=="filter"&&r in t)return To[e]=r;r=Vl(r);for(let i=0;i<$u.length;i++){const s=$u[i]+r;if(s in t)return To[e]=s}return e}const ku="http://www.w3.org/1999/xlink";function Cu(t,e,n,r,i,s=hm(e)){r&&e.startsWith("xlink:")?n==null?t.removeAttributeNS(ku,e.slice(6,e.length)):t.setAttributeNS(ku,e,n):n==null||s&&!Gl(n)?t.removeAttribute(e):t.setAttribute(e,s?"":zt(n)?String(n):n)}function Ou(t,e,n,r,i){if(e==="innerHTML"||e==="textContent"){n!=null&&(t[e]=e==="innerHTML"?wu(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=Gl(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 Pu=Symbol("_vei");function gy(t,e,n,r,i=null){const s=t[Pu]||(t[Pu]={}),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 Au=/(?:Once|Passive|Capture)$/;function yy(t){let e;if(Au.test(t)){e={};let r;for(;r=t.match(Au);)t=t.slice(0,t.length-r[0].length),e[r[0].toLowerCase()]=!0}return[t[2]===":"?t.slice(3):Wt(t.slice(2)),e]}let Ro=0;const vy=Promise.resolve(),by=()=>Ro||(vy.then(()=>Ro=0),Ro=Date.now());function _y(t,e){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;Et(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 Iu=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):li(e)?Ws(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))?(Ou(t,e,r),!t.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&Cu(t,e,r,o,s,e!=="value")):t._isVueCE&&(/[A-Z]/.test(e)||!ke(r))?Ou(t,Dt(e),r,s,e):(e==="true-value"?t._trueValue=r:e==="false-value"&&(t._falseValue=r),Cu(t,e,r,o))};function Sy(t,e,n,r){if(r)return!!(e==="innerHTML"||e==="textContent"||e in t&&Iu(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 Iu(e)&&ke(n)?!1:e in t}const Ey=Ne({patchProp:xy},oy);let Tu;function $y(){return Tu||(Tu=kg(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 Do=Symbol("IPEInjectKey"),Py=(t,e)=>(e?e.provide(Do,t):qc(Do,t),t),Ay=()=>{const t=mr(Do);if(!t)throw new Error("InPageEdit instance is not provided");return t},ft='@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}';/**
107
+ **/let qo;const Fu=typeof window<"u"&&window.trustedTypes;if(Fu)try{qo=Fu.createPolicy("vue",{createHTML:t=>t})}catch{}const Uu=qo?t=>qo.createHTML(t):t=>t,Mv="http://www.w3.org/2000/svg",jv="http://www.w3.org/1998/Math/MathML",Ut=typeof document<"u"?document:null,qu=Ut&&Ut.createElement("template"),Bv={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"?Ut.createElementNS(Mv,t):e==="mathml"?Ut.createElementNS(jv,t):n?Ut.createElement(t,{is:n}):Ut.createElement(t);return t==="select"&&r&&r.multiple!=null&&i.setAttribute("multiple",r.multiple),i},createText:t=>Ut.createTextNode(t),createComment:t=>Ut.createComment(t),setText:(t,e)=>{t.nodeValue=e},setElementText:(t,e)=>{t.textContent=e},parentNode:t=>t.parentNode,nextSibling:t=>t.nextSibling,querySelector:t=>Ut.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{qu.innerHTML=Uu(r==="svg"?`<svg>${t}</svg>`:r==="mathml"?`<math>${t}</math>`:t);const a=qu.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]}},Fv=Symbol("_vtc");function Uv(t,e,n){const r=t[Fv];r&&(e=(e?[e,...r]:[...r]).join(" ")),e==null?t.removeAttribute("class"):n?t.setAttribute("class",e):t.className=e}const Hu=Symbol("_vod"),qv=Symbol("_vsh"),Hv=Symbol(""),zv=/(?:^|;)\s*display\s*:/;function Wv(t,e,n){const r=t.style,i=$e(n);let s=!1;if(n&&!i){if(e)if($e(e))for(const o of e.split(";")){const a=o.slice(0,o.indexOf(":")).trim();n[a]==null&&Hi(r,a,"")}else for(const o in e)n[o]==null&&Hi(r,o,"");for(const o in n)o==="display"&&(s=!0),Hi(r,o,n[o])}else if(i){if(e!==n){const o=r[Hv];o&&(n+=";"+o),r.cssText=n,s=zv.test(n)}}else e&&t.removeAttribute("style");Hu in t&&(t[Hu]=s?r.display:"",t[qv]&&(r.display="none"))}const zu=/\s*!important$/;function Hi(t,e,n){if(se(n))n.forEach(r=>Hi(t,e,r));else if(n==null&&(n=""),e.startsWith("--"))t.setProperty(e,n);else{const r=Vv(t,e);zu.test(n)?t.setProperty(Gt(r),n.replace(zu,""),"important"):t[r]=n}}const Wu=["Webkit","Moz","ms"],Ho={};function Vv(t,e){const n=Ho[e];if(n)return n;let r=Mt(e);if(r!=="filter"&&r in t)return Ho[e]=r;r=dc(r);for(let i=0;i<Wu.length;i++){const s=Wu[i]+r;if(s in t)return Ho[e]=s}return e}const Vu="http://www.w3.org/1999/xlink";function Ku(t,e,n,r,i,s=Vm(e)){r&&e.startsWith("xlink:")?n==null?t.removeAttributeNS(Vu,e.slice(6,e.length)):t.setAttributeNS(Vu,e,n):n==null||s&&!mc(n)?t.removeAttribute(e):t.setAttribute(e,s?"":Yt(n)?String(n):n)}function Yu(t,e,n,r,i){if(e==="innerHTML"||e==="textContent"){n!=null&&(t[e]=e==="innerHTML"?Uu(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=mc(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 Kv(t,e,n,r){t.addEventListener(e,n,r)}function Yv(t,e,n,r){t.removeEventListener(e,n,r)}const Gu=Symbol("_vei");function Gv(t,e,n,r,i=null){const s=t[Gu]||(t[Gu]={}),o=s[e];if(r&&o)o.value=r;else{const[a,l]=Qv(e);if(r){const u=s[e]=Zv(r,i);Kv(t,a,u,l)}else o&&(Yv(t,a,o,l),s[e]=void 0)}}const Qu=/(?:Once|Passive|Capture)$/;function Qv(t){let e;if(Qu.test(t)){e={};let r;for(;r=t.match(Qu);)t=t.slice(0,t.length-r[0].length),e[r[0].toLowerCase()]=!0}return[t[2]===":"?t.slice(3):Gt(t.slice(2)),e]}let zo=0;const Jv=Promise.resolve(),Xv=()=>zo||(Jv.then(()=>zo=0),zo=Date.now());function Zv(t,e){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;$t(ey(r,n.value),e,5,[r])};return n.value=t,n.attached=Xv(),n}function ey(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 Ju=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>96&&t.charCodeAt(2)<123,ty=(t,e,n,r,i,s)=>{const o=i==="svg";e==="class"?Uv(t,r,o):e==="style"?Wv(t,n,r):gi(e)?no(e)||Gv(t,e,n,r,s):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):ny(t,e,r,o))?(Yu(t,e,r),!t.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&Ku(t,e,r,o,s,e!=="value")):t._isVueCE&&(/[A-Z]/.test(e)||!$e(r))?Yu(t,Mt(e),r,s,e):(e==="true-value"?t._trueValue=r:e==="false-value"&&(t._falseValue=r),Ku(t,e,r,o))};function ny(t,e,n,r){if(r)return!!(e==="innerHTML"||e==="textContent"||e in t&&Ju(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 Ju(e)&&$e(n)?!1:e in t}const ry=Le({patchProp:ty},Bv);let Xu;function iy(){return Xu||(Xu=sv(ry))}const sy=(...t)=>{const e=iy().createApp(...t),{mount:n}=e;return e.mount=r=>{const i=ay(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,oy(i));return i instanceof Element&&(i.removeAttribute("v-cloak"),i.setAttribute("data-v-app","")),o},e};function oy(t){if(t instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&t instanceof MathMLElement)return"mathml"}function ay(t){return $e(t)?document.querySelector(t):t}const Wo=Symbol("IPEInjectKey"),ly=(t,e)=>(e?e.provide(Wo,t):cu(Wo,t),t),cy=()=>{const t=_r(Wo);if(!t)throw new Error("InPageEdit instance is not provided");return t},ft='@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 Ru={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{}}},Sr=t=>t.map(String).join("."),Ty=t=>t.replace(/[^a-zA-Z0-9_-]/g,"_"),Qt=t=>`schema_${Ty(Sr(t)||"root")}`,fn=t=>Sr(t);function Lo(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 Du(t){return typeof t=="function"&&!!t?.type}function Lu(t){if(!t)throw new Error("schema is required");if(Du(t))return t;try{const e=Schema.from(t);if(Du(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 vt(t){return t?.meta??{}}function Ry(t){return t.length>0&&t.every(e=>e?.type==="const")}function Dn(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?Dn(i[0]):void 0}case"const":return e.value;case"date":return;default:return}}class Pt extends HTMLElement{constructor(){super(),this._path=[],this._i18n=Ru,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=Lu(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 Nu 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>${ft}</style>`;const e=vt(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(Lo("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",Nu);class Mu 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>${ft}</style>`;const e=this._schema?.type??"number",n=vt(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(Lo(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",Mu);class ju extends Pt{render(){this.$root.innerHTML=`<style>${ft}</style>`;const e=vt(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",ju);function Ni(t){return String(t).padStart(2,"0")}function Er(t){return`${t.getFullYear()}-${Ni(t.getMonth()+1)}-${Ni(t.getDate())}`}function No(t){return`${Ni(t.getHours())}:${Ni(t.getMinutes())}`}function Mi(t){return`${Er(t)}T${No(t)}`}class Fu extends Pt{render(){if(this.$input&&this.$root.contains(this.$input)){const o=vt(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=No(this._value):o==="datetime"&&(this.$input.value=Mi(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=Mi(a)))}else this._value||(this.$input.value="");return}this.$root.innerHTML=`<style>${ft}</style>`;const e=vt(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=No(this._value):i==="datetime"&&(r.value=Mi(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=Mi(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",Fu);class Bu extends Pt{render(){this.$root.innerHTML=`<style>${ft}</style>`;const e=vt(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",Bu);function Dy(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 Ln(t,e,n,r,i){const s=Dy(t),o=document.createElement(s);return o.schema=t,o.path=e,o.label=r,i&&(o.i18n=i),o.setValue?.(n),o}class Uu extends Pt{render(){this.$root.innerHTML=`<style>${ft}</style>`;const e=vt(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=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(Lo("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 y=document.createElement("option");y.value=String(f),y.textContent=c.type,s.appendChild(y)}),s.onchange=()=>{o=Number(s.value);const c=r[o],f=Dn(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=Ln(c,this._path,this._value,this._label);f.addEventListener("change",y=>{y.stopPropagation(),this.emitChange(y.detail.value)}),l.appendChild(f)};u(),n.appendChild(l)}this.$root.appendChild(n)}}Ee("schema-form-union",Uu);class Hu extends Pt{render(){this.$root.innerHTML=`<style>${ft}</style>`;const e=vt(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=Ln(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",Hu);class qu extends Pt{render(){this.$root.innerHTML=`<style>${ft}</style>`;const e=vt(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=Ln(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",qu);const Hi=class Hi extends Pt{constructor(){super(...arguments),this._itemIds=[]}generateItemId(){try{if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID()}catch{}return"i"+Hi._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=vt(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,y)=>{const v=[...this._path,y],b=document.createElement("div");b.className="row schema-collection-row";const A=this._itemIds[y];b.dataset.uid=A,b.setAttribute("data-path",Sr(v));const U=Ln(i,v,f,`${this._label??""}[${y}]`);U.addEventListener("change",h=>{h.stopPropagation();const S=s().slice();S[y]=h.detail.value,this._value=S,this.emitChange(S)});const L=document.createElement("div");L.className="actions";const I=document.createElement("button");I.type="button",I.className="btn",I.textContent=this._i18n.arrayMoveUp??"↑",I.onclick=()=>{if(y<=0)return;const h=this.capturePositions(r),S=s().slice();[S[y-1],S[y]]=[S[y],S[y-1]],[this._itemIds[y-1],this._itemIds[y]]=[this._itemIds[y],this._itemIds[y-1]],this._value=S,o(h),this.emitChange(S)};const g=document.createElement("button");g.type="button",g.className="btn",g.textContent=this._i18n.arrayMoveDown??"↓",g.onclick=()=>{const h=s();if(y>=h.length-1)return;const S=this.capturePositions(r),P=h.slice();[P[y+1],P[y]]=[P[y],P[y+1]],[this._itemIds[y+1],this._itemIds[y]]=[this._itemIds[y],this._itemIds[y+1]],this._value=P,o(S),this.emitChange(P)};const p=document.createElement("button");p.type="button",p.className="btn danger",p.textContent=this._i18n.arrayRemove??"×",p.onclick=()=>{b.classList.add("leaving");const h=250;let S=!1;const P=()=>{if(S)return;S=!0,clearTimeout(R);const z=s().filter((Ce,Te)=>Te!==y);this._itemIds.splice(y,1);const X=this.capturePositions(r);this._value=z,o(X),this.emitChange(z)};b.addEventListener("transitionend",P,{once:!0});const R=setTimeout(P,h+80)},L.append(I,g,p),b.appendChild(U),b.appendChild(L),r.appendChild(b),c&&c===A&&(b.classList.add("enter"),requestAnimationFrame(()=>{b.classList.add("enter-active")}),requestAnimationFrame(()=>{b.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=Dn(i);c.push(f);const y=this.generateItemId();this._itemIds.push(y),this._value=c,o(u,y),this.emitChange(c)};const l=document.createElement("div");l.className="actions",l.appendChild(a),n.appendChild(r),n.appendChild(l),this.$root.appendChild(n)}};Hi._idCounter=0;let ji=Hi;Ee("schema-form-array",ji);class zu extends Pt{render(){this.$root.innerHTML=`<style>${ft}</style>`;const e=vt(this._schema),n=this.makeFieldContainer("dict",e.description),r=document.createElement("div");r.className="group";const i=this._schema.inner,s=this._value??{},o=y=>`d_${y}`,a=()=>{const y={};return r.querySelectorAll(".kv").forEach(v=>{const b=v.dataset.uid;b&&(y[b]=v.getBoundingClientRect())}),y},l=y=>{r.querySelectorAll(".kv").forEach(v=>{const b=v.dataset.uid;if(!b)return;const A=y[b];if(!A)return;const U=v.getBoundingClientRect(),L=A.left-U.left,I=A.top-U.top;(L||I)&&(v.style.transition="none",v.style.transform=`translate(${L}px, ${I}px)`,requestAnimationFrame(()=>{v.style.transition="transform .25s ease",v.style.transform=""}))})},u=(y,v)=>{r.innerHTML="",Object.keys(s).forEach(b=>{const A=[...this._path,b],U=document.createElement("div");U.className="kv schema-collection-row",U.dataset.uid=o(b),U.setAttribute("data-path",Sr(A));const L=document.createElement("input");L.className="input",L.value=b,L.name=fn(A)+".__key",L.id=Qt(A)+"__key";const I=Ln(i,A,s[b],`${this._label??""}[${b}]`),g=document.createElement("button");g.type="button",g.className="btn danger",g.textContent=this._i18n.dictRemove??"×",g.onclick=()=>{const p=a();delete s[b];const h={...this._value??{}};delete h[b],this._value=h,u(p),this.emitChange(h)},L.onchange=()=>{const p=L.value.trim();if(!p||p===b||s[p]!==void 0)return;const h=a();s[p]=s[b],delete s[b];const S={...this._value??{}};S[p]=S[b],delete S[b],this._value=S,u(h),this.emitChange(S)},I.addEventListener("change",p=>{p.stopPropagation();const h={...this._value??{}};h[b]=p.detail.value,this._value=h,this.emitChange(h)}),U.append(L,I,g),r.appendChild(U),v===b&&(U.classList.add("enter"),requestAnimationFrame(()=>U.classList.add("enter-active")),requestAnimationFrame(()=>U.classList.remove("enter")))}),y&&l(y)};u();const c=document.createElement("button");c.type="button",c.className="btn primary",c.textContent=this._i18n.dictAdd??"+",c.onclick=()=>{let y=Object.keys(s).length+1,v=`k${y}`;for(;s[v]!==void 0;)v=`k${++y}`;const b=a();s[v]=Dn(i);const A={...this._value??{},[v]:s[v]};this._value=A,u(b,v),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",zu);class Wu extends HTMLElement{constructor(){super(),this._i18n={...Ru},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: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=Lu(e);try{this._state=this._schema(null,{autofix:!0})}catch{this._state=Dn(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=Dn(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=Ln(this._schema,[],this._state,this._i18n.rootLabel,this._i18n);e.appendChild(n)}}Ee("schema-form",Wu);function Ly(){Ee("schema-form",Wu),Ee("schema-form-string",Nu),Ee("schema-form-number",Mu),Ee("schema-form-boolean",ju),Ee("schema-form-date",Fu),Ee("schema-form-const",Bu),Ee("schema-form-union",Uu),Ee("schema-form-tuple",Hu),Ee("schema-form-object",qu),Ee("schema-form-array",ji),Ee("schema-form-dict",zu)}const Ny=Cc({__name:"SchemasteryFormVue",props:Nc({schema:{},value:{},validateOnChange:{type:Boolean,default:!1}},{schema:{required:!0},schemaModifiers:{},value:{required:!1,default:{}},valueModifiers:{}}),emits:Nc(["change"],["update:schema","update:value"]),setup(t,{expose:e,emit:n}){const r=ru(t,"schema"),i=ru(t,"value"),s=n,o=tg("elRef");let a=!1,l=!1;const u=c=>{if(l)return;const f=o.value,y=t.validateOnChange?f.getData({validate:!0}):c.detail.state;a=!0,i.value=y,$i(()=>{a=!1}),s("change",c.detail)};return Tc(()=>{Ly()}),go(()=>{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)}),Rc(()=>{o.value?.removeEventListener("form-change",u)}),An(()=>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}),An(()=>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 y=o.value;y.setData(c,{validate:!!f?.validate}),f?.emit&&(i.value=y.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)=>(Tn(),vr("schema-form",hu({ref_key:"elRef",ref:o},c.$attrs),null,16))}});function dn(t,e=new WeakMap){if(De(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 My={class:"preferences-ui-app"},jy={class:"tabs"},Fy=["onClick","data-value"],By={style:{"max-height":"20em",overflow:"auto"}},Uy=((t,e)=>{const n=t.__vccOpts||t;for(const[r,i]of e)n[r]=i;return n})(Cc({__name:"PreferencesForm",setup(t,{expose:e}){const n=Ay(),r=gc([]),i=gc(""),s=_i([]),o=bu(()=>s.value.map(u=>u.schema)),a=_i({}),l=_i({});return e({getValue(){return dn(l)}}),An(i,u=>{u&&(a.value=l.value,s.value=n.preferences.getConfigRegistries(u))},{immediate:!0}),go(async()=>{n.inject(["preferences"],async u=>{const c=await u.preferences.getAll();a.value=l.value=c,r.value=u.preferences.getConfigCategories(),i.value=r.value[0].name})}),(u,c)=>(Tn(),vr("div",My,[_r("div",jy,[(Tn(!0),vr(yt,null,Lc(r.value,f=>(Tn(),vr("a",{class:di(["tab",{active:i.value===f.name}]),key:f.name,onClick:y=>i.value=f.name,"data-value":f.name},Qs(f.label),11,Fy))),128))]),(Tn(!0),vr(yt,null,Lc(o.value,(f,y)=>(Tn(),Hg(vc(Ny),{key:`${i.value}-${y}`,schema:f,value:a.value,"onUpdate:value":c[0]||(c[0]=v=>l.value=v),"validate-on-change":!1,i18n:{rootLabel:""}},null,8,["schema","value"]))),128)),_r("details",null,[_r("pre",By,Qs(l.value),1)])]))}}),[["__scopeId","data-v-e89c782f"]]);var Hy=Object.create,Mo=Object.defineProperty,qy=Object.getOwnPropertyDescriptor,Vu=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Ku=t=>{throw TypeError(t)},zy=(t,e,n)=>e in t?Mo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Wy=(t,e)=>Mo(t,"name",{value:e,configurable:!0}),Vy=t=>[,,,Hy(t?.[Vu("metadata")]??null)],Ky=["class","method","getter","setter","accessor","field","value","get","set"],Yu=t=>t!==void 0&&typeof t!="function"?Ku("Function expected"):t,Yy=(t,e,n,r,i)=>({kind:Ky[t],name:e,metadata:r,addInitializer:s=>n._?Ku("Already initialized"):i.push(Yu(s||null))}),Gy=(t,e)=>zy(e,Vu("metadata"),t[3]),Jy=(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},Qy=(t,e,n,r,i,s)=>{var o,a,l,u=e&7,c=!1,f=0,y=t[f]||(t[f]=[]),v=u&&(i=i.prototype,u<5&&(u>3||!c)&&qy(i,n));Wy(i,n);for(var b=r.length-1;b>=0;b--)l=Yy(u,n,a={},t[3],y),o=(0,r[b])(i,l),a._=1,Yu(o)&&(i=o);return Gy(t,i),v&&Mo(i,n,v),c?u^4?s:v:i},Gu,jo,Ju;Gu=[Ge(["preferences","modal"])];class Fi extends(Ju=ct){constructor(e){super(e,{},"preferences-ui"),this.ctx=e,e.set("preferencesUI",this),e.inject(["toolbox"],n=>{n.toolbox.addButton({id:"preferences",icon:x("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:[x("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),x("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:x(bn,{children:x(sn,{})})});e.get$window().classList.add("dialog");const n=x("div",{id:"ipe-preferences-app",style:{minHeight:"65vh"}});e.setContent(n);const r=this.createFormApp(),i=r.mount(n);e.setButtons([{label:"Cancel",className:"is-danger is-ghost",method:()=>{e.close()}},{label:"Save",className:"is-primary is-ghost",method:()=>{const s=i.getValue();this.logger.info("saving preferences",s);try{Object.entries(s).forEach(([o,a])=>{this.ctx.preferences.set(o,a).catch(console.error)})}catch(o){this.logger.error("failed to save preferences",o)}e.close()}}]),e.on(e.Event.Close,()=>{this.logger.debug("preferences modal closed, vue app unmounting"),r.unmount()})}createFormApp(){const e=ky(Uy);return Py(this.ctx,e),e}}jo=Vy(Ju),Fi=Qy(jo,0,"PluginPreferencesUI",Gu,Fi),Jy(jo,1,Fi);const Xy=Object.freeze(Object.defineProperty({__proto__:null,get PluginPreferencesUI(){return Fi}},Symbol.toStringTag,{value:"Module"}));le.BasePlugin=ct,le.InPageEdit=on,le.Inject=Ge,le.Logger=la,le.LoggerLevel=ns,le.Schema=Se,le.Service=yn,le.createLogger=fa,Object.defineProperty(le,Symbol.toStringTag,{value:"Module"})});
124
+ */const Zu={arrayAdd:"+",arrayMoveUp:"↑",arrayMoveDown:"↓",arrayRemove:"×",dictAdd:"+",dictRemove:"×",rootLabel:"root"},Ee=(t,e)=>{customElements.get(t)||customElements.define(t,e)},uy=(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{}}},Or=t=>t.map(String).join("."),fy=t=>t.replace(/[^a-zA-Z0-9_-]/g,"_"),tn=t=>`schema_${fy(Or(t)||"root")}`,mn=t=>Or(t);function Vo(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 ef(t){return typeof t=="function"&&!!t?.type}function tf(t){if(!t)throw new Error("schema is required");if(ef(t))return t;try{const e=Schema.from(t);if(ef(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 dy(t){return t.length>0&&t.every(e=>e?.type==="const")}function jn(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?jn(i[0]):void 0}case"const":return e.value;case"date":return;default:return}}class At extends HTMLElement{constructor(){super(),this._path=[],this._i18n=Zu,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",Or(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=tf(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 nf extends At{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=mn(this._path),r.id=tn(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(Vo("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",nf);class rf extends At{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=mn(this._path),i.id=tn(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(Vo(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",rf);class sf extends At{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=mn(this._path),i.id=tn(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",sf);function zi(t){return String(t).padStart(2,"0")}function Ir(t){return`${t.getFullYear()}-${zi(t.getMonth()+1)}-${zi(t.getDate())}`}function Ko(t){return`${zi(t.getHours())}:${zi(t.getMinutes())}`}function Wi(t){return`${Ir(t)}T${Ko(t)}`}class of extends At{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=Ir(this._value):o==="time"?this.$input.value=Ko(this._value):o==="datetime"&&(this.$input.value=Wi(this._value));else if(typeof this._value=="string"&&o!=="time"){const a=new Date(this._value);isNaN(+a)||(o==="date"?this.$input.value=Ir(a):o==="datetime"&&(this.$input.value=Wi(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=mn(this._path),r.id=tn(this._path),this._value instanceof Date)i==="date"?r.value=Ir(this._value):i==="time"?r.value=Ko(this._value):i==="datetime"&&(r.value=Wi(this._value));else if(typeof this._value=="string"&&i!=="time"){const o=new Date(this._value);isNaN(+o)||(i==="date"?r.value=Ir(o):i==="datetime"&&(r.value=Wi(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",of);class af extends At{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=tn(this._path);const s=r.querySelector("label.label");s&&(s.htmlFor=i.id),r.appendChild(i),this.$root.appendChild(r)}}Ee("schema-form-const",af);function hy(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 Bn(t,e,n,r,i){const s=hy(t),o=document.createElement(s);return o.schema=t,o.path=e,o.label=r,i&&(o.i18n=i),o.setValue?.(n),o}class lf extends At{render(){this.$root.innerHTML=`<style>${ft}</style>`;const e=yt(this._schema),n=this.makeFieldContainer("union",e.description),r=this._schema.list||[];if(dy(r)){const i=document.createElement("select");i.className="input",i.name=mn(this._path),i.id=tn(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(Vo("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=mn(this._path)+".__type",s.id=tn(this._path)+"__type";let o=0;r.forEach((c,f)=>{const y=document.createElement("option");y.value=String(f),y.textContent=c.type,s.appendChild(y)}),s.onchange=()=>{o=Number(s.value);const c=r[o],f=jn(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=Bn(c,this._path,this._value,this._label);f.addEventListener("change",y=>{y.stopPropagation(),this.emitChange(y.detail.value)}),l.appendChild(f)};u(),n.appendChild(l)}this.$root.appendChild(n)}}Ee("schema-form-union",lf);class cf extends At{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=Bn(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",cf);class uf extends At{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=Bn(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",uf);const Qi=class Qi extends At{constructor(){super(...arguments),this._itemIds=[]}generateItemId(){try{if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID()}catch{}return"i"+Qi._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,y)=>{const v=[...this._path,y],b=document.createElement("div");b.className="row schema-collection-row";const A=this._itemIds[y];b.dataset.uid=A,b.setAttribute("data-path",Or(v));const U=Bn(i,v,f,`${this._label??""}[${y}]`);U.addEventListener("change",h=>{h.stopPropagation();const S=s().slice();S[y]=h.detail.value,this._value=S,this.emitChange(S)});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(y<=0)return;const h=this.capturePositions(r),S=s().slice();[S[y-1],S[y]]=[S[y],S[y-1]],[this._itemIds[y-1],this._itemIds[y]]=[this._itemIds[y],this._itemIds[y-1]],this._value=S,o(h),this.emitChange(S)};const g=document.createElement("button");g.type="button",g.className="btn",g.textContent=this._i18n.arrayMoveDown??"↓",g.onclick=()=>{const h=s();if(y>=h.length-1)return;const S=this.capturePositions(r),O=h.slice();[O[y+1],O[y]]=[O[y],O[y+1]],[this._itemIds[y+1],this._itemIds[y]]=[this._itemIds[y],this._itemIds[y+1]],this._value=O,o(S),this.emitChange(O)};const p=document.createElement("button");p.type="button",p.className="btn danger",p.textContent=this._i18n.arrayRemove??"×",p.onclick=()=>{b.classList.add("leaving");const h=250;let S=!1;const O=()=>{if(S)return;S=!0,clearTimeout(R);const z=s().filter((Ce,Te)=>Te!==y);this._itemIds.splice(y,1);const X=this.capturePositions(r);this._value=z,o(X),this.emitChange(z)};b.addEventListener("transitionend",O,{once:!0});const R=setTimeout(O,h+80)},D.append(I,g,p),b.appendChild(U),b.appendChild(D),r.appendChild(b),c&&c===A&&(b.classList.add("enter"),requestAnimationFrame(()=>{b.classList.add("enter-active")}),requestAnimationFrame(()=>{b.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=jn(i);c.push(f);const y=this.generateItemId();this._itemIds.push(y),this._value=c,o(u,y),this.emitChange(c)};const l=document.createElement("div");l.className="actions",l.appendChild(a),n.appendChild(r),n.appendChild(l),this.$root.appendChild(n)}};Qi._idCounter=0;let Vi=Qi;Ee("schema-form-array",Vi);class ff extends At{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=y=>`d_${y}`,a=()=>{const y={};return r.querySelectorAll(".kv").forEach(v=>{const b=v.dataset.uid;b&&(y[b]=v.getBoundingClientRect())}),y},l=y=>{r.querySelectorAll(".kv").forEach(v=>{const b=v.dataset.uid;if(!b)return;const A=y[b];if(!A)return;const U=v.getBoundingClientRect(),D=A.left-U.left,I=A.top-U.top;(D||I)&&(v.style.transition="none",v.style.transform=`translate(${D}px, ${I}px)`,requestAnimationFrame(()=>{v.style.transition="transform .25s ease",v.style.transform=""}))})},u=(y,v)=>{r.innerHTML="",Object.keys(s).forEach(b=>{const A=[...this._path,b],U=document.createElement("div");U.className="kv schema-collection-row",U.dataset.uid=o(b),U.setAttribute("data-path",Or(A));const D=document.createElement("input");D.className="input",D.value=b,D.name=mn(A)+".__key",D.id=tn(A)+"__key";const I=Bn(i,A,s[b],`${this._label??""}[${b}]`),g=document.createElement("button");g.type="button",g.className="btn danger",g.textContent=this._i18n.dictRemove??"×",g.onclick=()=>{const p=a();delete s[b];const h={...this._value??{}};delete h[b],this._value=h,u(p),this.emitChange(h)},D.onchange=()=>{const p=D.value.trim();if(!p||p===b||s[p]!==void 0)return;const h=a();s[p]=s[b],delete s[b];const S={...this._value??{}};S[p]=S[b],delete S[b],this._value=S,u(h),this.emitChange(S)},I.addEventListener("change",p=>{p.stopPropagation();const h={...this._value??{}};h[b]=p.detail.value,this._value=h,this.emitChange(h)}),U.append(D,I,g),r.appendChild(U),v===b&&(U.classList.add("enter"),requestAnimationFrame(()=>U.classList.add("enter-active")),requestAnimationFrame(()=>U.classList.remove("enter")))}),y&&l(y)};u();const c=document.createElement("button");c.type="button",c.className="btn primary",c.textContent=this._i18n.dictAdd??"+",c.onclick=()=>{let y=Object.keys(s).length+1,v=`k${y}`;for(;s[v]!==void 0;)v=`k${++y}`;const b=a();s[v]=jn(i);const A={...this._value??{},[v]:s[v]};this._value=A,u(b,v),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",ff);class df extends HTMLElement{constructor(){super(),this._i18n={...Zu},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:uy(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=tf(e);try{this._state=this._schema(null,{autofix:!0})}catch{this._state=jn(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=jn(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=Bn(this._schema,[],this._state,this._i18n.rootLabel,this._i18n);e.appendChild(n)}}Ee("schema-form",df);function py(){Ee("schema-form",df),Ee("schema-form-string",nf),Ee("schema-form-number",rf),Ee("schema-form-boolean",sf),Ee("schema-form-date",of),Ee("schema-form-const",af),Ee("schema-form-union",lf),Ee("schema-form-tuple",cf),Ee("schema-form-object",uf),Ee("schema-form-array",Vi),Ee("schema-form-dict",ff)}const my=Kc({__name:"SchemasteryFormVue",props:nu({schema:{},value:{},validateOnChange:{type:Boolean,default:!1}},{schema:{required:!0},schemaModifiers:{},value:{required:!1,default:{}},valueModifiers:{}}),emits:nu(["change"],["update:schema","update:value"]),setup(t,{expose:e,emit:n}){const r=Su(t,"schema"),i=Su(t,"value"),s=n,o=Ng("elRef");let a=!1,l=!1;const u=c=>{if(l)return;const f=o.value,y=t.validateOnChange?f.getData({validate:!0}):c.detail.state;a=!0,i.value=y,Ri(()=>{a=!1}),s("change",c.detail)};return Xc(()=>{py()}),Co(()=>{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)}),Zc(()=>{o.value?.removeEventListener("form-change",u)}),Nn(()=>r,c=>{a||o.value&&c&&o.value.schema!==c.value&&(l=!0,o.value.schema=c.value,Ri(()=>{l=!1}))},{deep:!0,immediate:!0}),Nn(()=>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}),Ri(()=>{l=!1}))},{deep:!0,immediate:!0}),e({setData(c,f){const y=o.value;y.setData(c,{validate:!!f?.validate}),f?.emit&&(i.value=y.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)=>(Ln(),Er("schema-form",Ru({ref_key:"elRef",ref:o},c.$attrs),null,16))}});function gn(t,e=new WeakMap){if(Ne(t))return gn(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,gn(o,e))}),i}if(t instanceof Set){const i=new Set;return e.set(t,i),Array.from(t).forEach(s=>{i.add(gn(s,e))}),i}if(Array.isArray(t)){const i=[];e.set(t,i);for(const s of t)i.push(gn(s,e));return i}const n=fe(t),r={};e.set(t,r);for(const i of Object.keys(n))r[i]=gn(n[i],e);for(const i of Object.getOwnPropertySymbols(n))r[i]=gn(n[i],e);return r}const gy={class:"preferences-ui-app"},vy={class:"tabs"},yy=["onClick","data-value"],by={style:{"max-height":"20em",overflow:"auto"}},wy=((t,e)=>{const n=t.__vccOpts||t;for(const[r,i]of e)n[r]=i;return n})(Kc({__name:"PreferencesForm",setup(t,{expose:e}){const n=cy(),r=Lc([]),i=Lc(""),s=Pi([]),o=Bu(()=>s.value.map(u=>u.schema)),a=Pi({}),l=Pi({});return e({getValue(){return gn(l)}}),Nn(i,u=>{u&&(a.value=l.value,s.value=n.preferences.getConfigRegistries(u))},{immediate:!0}),Co(async()=>{n.inject(["preferences"],async u=>{const c=await u.preferences.getAll();a.value=l.value=c,r.value=u.preferences.getConfigCategories(),i.value=r.value[0].name})}),(u,c)=>(Ln(),Er("div",gy,[$r("div",vy,[(Ln(!0),Er(vt,null,tu(r.value,f=>(Ln(),Er("a",{class:wi(["tab",{active:i.value===f.name}]),key:f.name,onClick:y=>i.value=f.name,"data-value":f.name},lo(f.label),11,yy))),128))]),(Ln(!0),Er(vt,null,tu(o.value,(f,y)=>(Ln(),_v(jc(my),{key:`${i.value}-${y}`,schema:f,value:a.value,"onUpdate:value":c[0]||(c[0]=v=>l.value=v),"validate-on-change":!1,i18n:{rootLabel:""}},null,8,["schema","value"]))),128)),$r("details",null,[$r("pre",by,lo(l.value),1)])]))}}),[["__scopeId","data-v-e89c782f"]]);var _y=Object.create,Yo=Object.defineProperty,xy=Object.getOwnPropertyDescriptor,hf=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),pf=t=>{throw TypeError(t)},Sy=(t,e,n)=>e in t?Yo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Ey=(t,e)=>Yo(t,"name",{value:e,configurable:!0}),ky=t=>[,,,_y(t?.[hf("metadata")]??null)],$y=["class","method","getter","setter","accessor","field","value","get","set"],mf=t=>t!==void 0&&typeof t!="function"?pf("Function expected"):t,Cy=(t,e,n,r,i)=>({kind:$y[t],name:e,metadata:r,addInitializer:s=>n._?pf("Already initialized"):i.push(mf(s||null))}),Py=(t,e)=>Sy(e,hf("metadata"),t[3]),Oy=(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},Iy=(t,e,n,r,i,s)=>{var o,a,l,u=e&7,c=!1,f=0,y=t[f]||(t[f]=[]),v=u&&(i=i.prototype,u<5&&(u>3||!c)&&xy(i,n));Ey(i,n);for(var b=r.length-1;b>=0;b--)l=Cy(u,n,a={},t[3],y),o=(0,r[b])(i,l),a._=1,mf(o)&&(i=o);return Py(t,i),v&&Yo(i,n,v),c?u^4?s:v:i},gf,Go,vf;gf=[ze(["preferences","modal"])];class Ki extends(vf=rt){constructor(e){super(e,{},"preferences-ui"),this.ctx=e,e.set("preferencesUI",this),e.inject(["toolbox"],n=>{n.toolbox.addButton({id:"preferences",icon:w("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:[w("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),w("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 Preferences",content:w(Nt,{children:w(Vt,{})})});e.get$window().classList.add("dialog");const n=w("div",{id:"ipe-preferences-app",style:{minHeight:"65vh"}});e.setContent(n);const r=this.createFormApp(),i=r.mount(n);e.setButtons([{label:"Cancel",className:"is-danger is-ghost",method:()=>{e.close()}},{label:"Save",className:"is-primary is-ghost",method:()=>{const s=i.getValue();this.logger.info("saving preferences",s);try{Object.entries(s).forEach(([o,a])=>{this.ctx.preferences.set(o,a).catch(console.error)})}catch(o){this.logger.error("failed to save preferences",o)}e.close(),this.ctx.modal.notify("success",{title:"Preferences Saved",content:w("p",{children:"Some settings may take effect after reloading the page."})})}}]),e.on(e.Event.Close,()=>{this.logger.debug("preferences modal closed, vue app unmounting"),r.unmount()})}createFormApp(){const e=sy(wy);return ly(this.ctx,e),e}}Go=ky(vf),Ki=Iy(Go,0,"PluginPreferencesUI",gf,Ki),Oy(Go,1,Ki);const Ay=Object.freeze(Object.defineProperty({__proto__:null,get PluginPreferencesUI(){return Ki}},Symbol.toStringTag,{value:"Module"}));le.BasePlugin=rt,le.InPageEdit=un,le.Inject=ze,le.Logger=wa,le.LoggerLevel=us,le.Schema=_e,le.Service=an,le.createLogger=Sa,Object.defineProperty(le,Symbol.toStringTag,{value:"Module"})});
125
125
  //# sourceMappingURL=index.umd.js.map