create-caspian-app 0.2.0-beta.18 → 0.2.0-beta.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
var Jt=Object.defineProperty,ei=(t,e,s)=>e in t?Jt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,x=(t,e,s)=>ei(t,"symbol"!=typeof e?e+"":e,s);class ti{constructor(t){x(this,"hooks",[]),x(this,"currentIndex",0),x(this,"onStateChange"),x(this,"pendingLayoutEffects",[]),x(this,"pendingEffects",[]),x(this,"pendingUpdate",!1),x(this,"hasScheduledRender",!1),x(this,"batchedUpdates",new Set),x(this,"portalRegistrations",[]),x(this,"disposed",!1),this.onStateChange=t}loadState(t){this.hooks=[...t]}getHooks(){return this.hooks}prepareRender(){this.disposed||(this.currentIndex=0,this.pendingLayoutEffects=[],this.pendingEffects=[],this.portalRegistrations=[])}runLayoutEffects(){this.disposed||this.pendingLayoutEffects.forEach(t=>t()),this.pendingLayoutEffects=[]}runEffects(){this.disposed||this.pendingEffects.forEach(t=>t()),this.pendingEffects=[]}dispose(){this.disposed||(this.disposed=!0,this.pendingLayoutEffects=[],this.pendingEffects=[],this.pendingUpdate=!1,this.hasScheduledRender=!1,this.batchedUpdates.clear(),this.portalRegistrations=[],this.hooks.forEach(t=>{if(!t||"object"!=typeof t)return;const e=t.cleanup;if("function"==typeof e)try{e()}finally{t.cleanup=void 0}}),this.hooks=[],this.currentIndex=0)}usePortal(t,e){const s=this.currentIndex++;void 0===this.hooks[s]&&(this.hooks[s]={sourceParent:null});const i=this.hooks[s];return this.portalRegistrations.push({ref:t,target:e??null,info:i}),i}getPortalRegistrations(){return this.portalRegistrations}useState(t){const e=this.currentIndex++;if(void 0===this.hooks[e]){const s=this.hooks,i=e,n=this.batchedUpdates,r=()=>this.scheduleUpdate(),a=t=>{let e=t;"function"==typeof t&&(e=t(s[i].__state)),s[i].__state!==e&&(s[i].__state=e,n.add(i),r())};this.hooks[e]={__state:t,__setter:a}}const s=this.hooks[e];if("object"!=typeof s||null===s||!("__state"in s)){const t=s,i=this.hooks,n=e,r=this.batchedUpdates,a=()=>this.scheduleUpdate(),o=t=>{let e=t;"function"==typeof t&&(e=t(i[n].__state)),i[n].__state!==e&&(i[n].__state=e,r.add(n),a())};this.hooks[e]={__state:t,__setter:o}}return[this.hooks[e].__state,this.hooks[e].__setter]}scheduleUpdate(){this.disposed||(this.hasScheduledRender=!0,this.pendingUpdate||(this.pendingUpdate=!0,queueMicrotask(()=>{if(this.pendingUpdate=!1,this.disposed)return this.hasScheduledRender=!1,void this.batchedUpdates.clear();this.hasScheduledRender&&(this.hasScheduledRender=!1,this.batchedUpdates.clear(),this.onStateChange())})))}useRef(t=null){const e=this.currentIndex++;return void 0===this.hooks[e]&&(this.hooks[e]={current:t}),this.hooks[e]}useMemo(t,e){const s=this.currentIndex++,i=this.hooks[s];if(!i||this.areDepsDifferent(i.deps,e)){const i=t();return this.hooks[s]={value:i,deps:e},i}return i.value}useCallback(t,e){const s=this.currentIndex++,i=this.hooks[s];return!i||this.areDepsDifferent(i.deps,e)?(this.hooks[s]={callback:t,deps:e},t):i.callback}useReducer(t,e){const s=this.currentIndex++;if(void 0===this.hooks[s]){const i={state:e,reducer:t,dispatch:null};i.dispatch=t=>{const e=i.reducer(i.state,t);i.state!==e&&(i.state=e,this.scheduleUpdate())},this.hooks[s]=i}const i=this.hooks[s];return[i.state,i.dispatch]}useEffect(t,e){const s=this.currentIndex++,i=this.hooks[s];(!i||!e||!i.deps||this.areDepsDifferent(i.deps,e))&&this.pendingEffects.push(()=>{null!=i&&i.cleanup&&i.cleanup();const n=t();this.hooks[s]={deps:e,cleanup:"function"==typeof n?n:void 0}})}useLayoutEffect(t,e){const s=this.currentIndex++,i=this.hooks[s];(!i||!e||!i.deps||this.areDepsDifferent(i.deps,e))&&this.pendingLayoutEffects.push(()=>{null!=i&&i.cleanup&&i.cleanup();const n=t();this.hooks[s]={deps:e,cleanup:"function"==typeof n?n:void 0}})}areDepsDifferent(t,e){return t.length!==e.length||e.some((e,s)=>!Object.is(e,t[s]))}}class E{static saveState(t,e){t&&this.states.set(t,e)}static getState(t){return this.states.get(t)}static removeState(t){this.states.delete(t)}static saveScope(t,e){this.scopes.set(t,e)}static getScope(t){return this.scopes.get(t)}static getRootAncestor(t){let e=t;const s=new Set;for(;e&&!s.has(e);){s.add(e);const t=this.parents.get(e);if(!t)return e;e=t}return null}static resolveComponentId(t,e=null){if(!t)return null;if("app"!==t)return t;const s=new Set;let i=e,n=null;for(;i&&!s.has(i);){if(s.add(i),i.startsWith("page_"))return i;const t=this.parents.get(i)??null;if(!t){n=i;break}i=t}if(n)return n;for(const[t,e]of this.parents.entries())if(null===e&&this.scopes.has(t))return t;const r=this.scopes.keys().next().value;return"string"==typeof r?r:null}static getResolvedScope(t,e=null){const s=this.resolveComponentId(t,e);return s?this.scopes.get(s):void 0}static getResolvedScopeWithAncestors(t,e=null){const s=this.resolveComponentId(t,e);if(!s)return;const i=new Set,n=[];let r=s;for(;r&&!i.has(r);){i.add(r);const t=this.scopes.get(r);t&&n.push(t),r=this.parents.get(r)??null}return 0!==n.length?Object.assign({},...n.reverse()):void 0}static removeScope(t){this.scopes.delete(t)}static registerInstance(t,e){var s;const i=this.instances.get(t);i&&i!==e&&(null==(s=i.destroy)||s.call(i)),this.instances.set(t,e)}static getInstance(t){return this.instances.get(t)}static removeInstance(t){this.instances.delete(t)}static saveParent(t,e){t&&this.parents.set(t,e)}static getParent(t){return this.parents.get(t)}static removeParent(t){if(!this.parents.has(t))return;const e=this.parents.get(t)??null;this.parents.forEach((s,i)=>{s===t&&this.parents.set(i,e)}),this.parents.delete(t)}static saveContextValues(t,e){const s=this.contextValues.get(t)??new Map,i=new Set;return s.forEach((t,s)=>{e.has(s)||i.add(s)}),e.forEach((t,e)=>{s.has(e)&&Object.is(s.get(e),t)||i.add(e)}),e.size>0?this.contextValues.set(t,new Map(e)):this.contextValues.delete(t),Array.from(i)}static resolveContext(t,e){let s=t;for(;s;){const t=this.contextValues.get(s);if(null!=t&&t.has(e))return{providerId:s,value:t.get(e)};s=this.parents.get(s)??null}return{providerId:null,value:e.defaultValue}}static updateContextDependencies(t,e){const s=new Set(e),i=this.consumerContexts.get(t)??new Set;i.forEach(e=>{s.has(e)||this.removeContextConsumer(e,t)}),s.forEach(e=>{i.has(e)||this.addContextConsumer(e,t)}),s.size>0?this.consumerContexts.set(t,s):this.consumerContexts.delete(t)}static getConsumersForContextsInSubtree(t,e){const s=new Set;for(const i of e){const e=this.contextConsumers.get(i);e&&e.forEach(e=>{e!==t&&this.isAncestor(t,e)&&s.add(e)})}return s}static removeContextTracking(t){const e=this.contextValues.get(t),s=e?this.getConsumersForContextsInSubtree(t,e.keys()):new Set;this.contextValues.delete(t);const i=this.consumerContexts.get(t);return i&&(i.forEach(e=>{this.removeContextConsumer(e,t)}),this.consumerContexts.delete(t)),this.removeParent(t),s}static saveTemplate(t,e){this.templates.has(t)||this.templates.set(t,e)}static getTemplate(t){return this.templates.get(t)}static saveOwnedTemplates(t,e){this.ownedTemplateData.has(t)||this.ownedTemplateData.set(t,e)}static getOwnedTemplates(t){return this.ownedTemplateData.get(t)}static clear(){this.states.clear(),this.scopes.clear(),this.instances.clear(),this.parents.clear(),this.templates.clear(),this.ownedTemplateData.clear(),this.contextValues.clear(),this.consumerContexts.clear(),this.contextConsumers.clear()}static getStats(){return{states:this.states.size,scopes:this.scopes.size,instances:this.instances.size,parents:this.parents.size,templates:this.templates.size,ownedData:this.ownedTemplateData.size,contextValues:this.contextValues.size,contextConsumers:this.contextConsumers.size}}static addContextConsumer(t,e){const s=this.contextConsumers.get(t)??new Set;s.add(e),this.contextConsumers.set(t,s)}static removeContextConsumer(t,e){const s=this.contextConsumers.get(t);s&&(s.delete(e),0===s.size&&this.contextConsumers.delete(t))}static isAncestor(t,e){let s=this.parents.get(e)??null;for(;s;){if(s===t)return!0;s=this.parents.get(s)??null}return!1}}function nt(t){return t.includes("-")?t.replace(/-([a-z])/g,t=>t[1].toUpperCase()):t}x(E,"states",new Map),x(E,"scopes",new Map),x(E,"instances",new Map),x(E,"parents",new Map),x(E,"templates",new Map),x(E,"ownedTemplateData",new Map),x(E,"contextValues",new Map),x(E,"consumerContexts",new Map),x(E,"contextConsumers",new Map);const at=new WeakMap;function ue(t){const e=at.get(t);if(e)return e;const s=Object.keys(t),i={keys:s,keySig:s.join("\0")};return at.set(t,i),i}function ce(t,e){const s=new Array(e.length);for(let i=0;i<e.length;i++)s[i]=t[e[i]];return s}const de=new Map,ii=500;let Be=null;function te(t){if(!t.includes("&"))return t;if(de.has(t))return de.get(t);Be||(Be=document.createElement("textarea"));const e=Be;e.innerHTML=t;let s=e.value,i=0;for(;s.includes("&")&&i++<10;){e.innerHTML=s;const t=e.value;if(t===s)break;s=t}if(de.size>=ii){const t=de.keys().next().value;void 0!==t&&de.delete(t)}return de.set(t,s),s}function si(t,e){if(t===e)return!0;if(!t||!e||"object"!=typeof t||"object"!=typeof e)return!1;const s=Object.keys(t),i=s.length;let n=0;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&(n++,n>i))return!1;if(n!==i)return!1;for(let n=0;n<i;n++){const i=s[n];if(t[i]!==e[i])return!1}return!0}class ri{constructor(t,e,s){x(this,"root"),x(this,"getScope"),x(this,"canBindElement"),x(this,"handlerCache",new Map),this.root=t,this.getScope=e,this.canBindElement=s??(t=>this.isRootOwnedElement(t))}clearCache(){this.handlerCache.clear()}resolveEventOwnerScope(t){const e=this.root.getAttribute("pp-component");return E.getResolvedScopeWithAncestors(t,e)}bindEvents(t){(t||this.fallbackCollectEventElements()).forEach(t=>{this.canBindElement(t)&&this.bindElementEvents(t)})}isRootOwnedElement(t){var e;if(t===this.root)return!0;let s=t.closest("[pp-component]");return t===s&&(s=(null==(e=t.parentElement)?void 0:e.closest("[pp-component]"))??null),s===this.root}bindElementEvents(t){const e=t.getAttribute("pp-event-owner");e&&t.removeAttribute("pp-event-owner");const s=[];Array.from(t.attributes).forEach(i=>{if(i.name.startsWith("on")&&!i.name.includes("-")){const n=i.name.slice(2).toLowerCase();let r=i.value.trim();const a=r.match(/^\{([\s\S]*)\}$/);a&&(r=a[1].trim()),s.push(i.name);const o=`__pp_bound_${n}`;if(t[o]===r)return;t[o]=r;const h=t[`__pp_handler_${n}`];h&&t.removeEventListener(n,h);const c=s=>{var i;if(e){const i=this.resolveEventOwnerScope(e);if(i)return void this.executeHandlerWithScope(r,s,i,t)}let n=t.closest("[pp-component]");n===t&&(n=(null==(i=t.parentElement)?void 0:i.closest("[pp-component]"))??null);const a=(null==n?void 0:n.getAttribute("pp-component"))||null;if(a){const e=E.getScope(a);if(e)return void this.executeHandlerWithScope(r,s,e,t)}this.executeHandler(r,s,t)};t[`__pp_handler_${n}`]=c,t.addEventListener(n,c)}}),s.forEach(e=>{t.removeAttribute(e)})}fallbackCollectEventElements(){const t=new Set,e=this.root.attributes;for(let s=0;s<e.length;s++)if(e[s].name.startsWith("on")&&!e[s].name.includes("-")){t.add(this.root);break}const s=this.root.querySelectorAll("*");for(let e=0;e<s.length;e++){const i=s[e],n=i.attributes;for(let e=0;e<n.length;e++)if(n[e].name.startsWith("on")&&!n[e].name.includes("-")){t.add(i);break}}return t}executeHandler(t,e,s){this.executeHandlerWithScope(t,e,this.getScope(),s)}executeHandlerWithScope(t,e,s,i){const n=ue(s),r=n.keys,a=ce(s,r);try{const s=this.getCompiledHandler(t,r,n.keySig).call(i??e.currentTarget??null,...a,e);"function"==typeof s&&s(e)}catch(e){console.error("[PP-ERROR] Handler failed:",e),console.error("Code:",t)}}getCompiledHandler(t,e,s){const i=t+"|"+s;if(!this.handlerCache.has(i)){if(this.handlerCache.size>500){const t=this.handlerCache.keys().next().value;t&&this.handlerCache.delete(t)}const s="\n const e = event;\n const $event = event;\n const target = event?.target;\n const currentTarget = event?.currentTarget;\n const el = event?.currentTarget;\n ";let n;try{n=new Function(...e,"event",`"use strict";${s} return (${t})`)}catch{n=new Function(...e,"event",`"use strict";${s} ${t}`)}this.handlerCache.set(i,n)}return this.handlerCache.get(i)}}var ni=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,80,3,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,343,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,726,6,110,6,6,9,4759,9,787719,239],xt=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,2,60,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,42,9,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,496,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191],ai="·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・",gt="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-Ა-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-Ꟑꟑꟓꟕ-ꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",He={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},Ue="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",oi={5:Ue,"5module":Ue+" export import",6:Ue+" const class extends export import super"},ui=/^in(stanceof)?$/,ci=new RegExp("["+gt+"]"),hi=new RegExp("["+gt+ai+"]");function Ke(t,e){for(var s=65536,i=0;i<e.length;i+=2){if((s+=e[i])>t)return!1;if((s+=e[i+1])>=t)return!0}return!1}function Q(t,e){return t<65?36===t:t<91||(t<97?95===t:t<123||(t<=65535?t>=170&&ci.test(String.fromCharCode(t)):!1!==e&&Ke(t,xt)))}function ae(t,e){return t<48?36===t:t<58||!(t<65)&&(t<91||(t<97?95===t:t<123||(t<=65535?t>=170&&hi.test(String.fromCharCode(t)):!1!==e&&(Ke(t,xt)||Ke(t,ni)))))}var A=function(t,e){void 0===e&&(e={}),this.label=t,this.keyword=e.keyword,this.beforeExpr=!!e.beforeExpr,this.startsExpr=!!e.startsExpr,this.isLoop=!!e.isLoop,this.isAssign=!!e.isAssign,this.prefix=!!e.prefix,this.postfix=!!e.postfix,this.binop=e.binop||null,this.updateContext=null};function j(t,e){return new A(t,{beforeExpr:!0,binop:e})}var W={beforeExpr:!0},H={startsExpr:!0},Ye={};function _(t,e){return void 0===e&&(e={}),e.keyword=t,Ye[t]=new A(t,e)}var o={num:new A("num",H),regexp:new A("regexp",H),string:new A("string",H),name:new A("name",H),privateId:new A("privateId",H),eof:new A("eof"),bracketL:new A("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new A("]"),braceL:new A("{",{beforeExpr:!0,startsExpr:!0}),braceR:new A("}"),parenL:new A("(",{beforeExpr:!0,startsExpr:!0}),parenR:new A(")"),comma:new A(",",W),semi:new A(";",W),colon:new A(":",W),dot:new A("."),question:new A("?",W),questionDot:new A("?."),arrow:new A("=>",W),template:new A("template"),invalidTemplate:new A("invalidTemplate"),ellipsis:new A("...",W),backQuote:new A("`",H),dollarBraceL:new A("${",{beforeExpr:!0,startsExpr:!0}),eq:new A("=",{beforeExpr:!0,isAssign:!0}),assign:new A("_=",{beforeExpr:!0,isAssign:!0}),incDec:new A("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new A("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:j("||",1),logicalAND:j("&&",2),bitwiseOR:j("|",3),bitwiseXOR:j("^",4),bitwiseAND:j("&",5),equality:j("==/!=/===/!==",6),relational:j("</>/<=/>=",7),bitShift:j("<</>>/>>>",8),plusMin:new A("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:j("%",10),star:j("*",10),slash:j("/",10),starstar:new A("**",{beforeExpr:!0}),coalesce:j("??",1),_break:_("break"),_case:_("case",W),_catch:_("catch"),_continue:_("continue"),_debugger:_("debugger"),_default:_("default",W),_do:_("do",{isLoop:!0,beforeExpr:!0}),_else:_("else",W),_finally:_("finally"),_for:_("for",{isLoop:!0}),_function:_("function",H),_if:_("if"),_return:_("return",W),_switch:_("switch"),_throw:_("throw",W),_try:_("try"),_var:_("var"),_const:_("const"),_while:_("while",{isLoop:!0}),_with:_("with"),_new:_("new",{beforeExpr:!0,startsExpr:!0}),_this:_("this",H),_super:_("super",H),_class:_("class",H),_extends:_("extends",W),_export:_("export"),_import:_("import",H),_null:_("null",H),_true:_("true",H),_false:_("false",H),_in:_("in",{beforeExpr:!0,binop:7}),_instanceof:_("instanceof",{beforeExpr:!0,binop:7}),_typeof:_("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:_("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:_("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},U=/\r\n?|\n|\u2028|\u2029/,li=new RegExp(U.source,"g");function ge(t){return 10===t||13===t||8232===t||8233===t}function vt(t,e,s){void 0===s&&(s=t.length);for(var i=e;i<s;i++){var n=t.charCodeAt(i);if(ge(n))return i<s-1&&13===n&&10===t.charCodeAt(i+1)?i+2:i+1}return-1}var bt=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,D=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,yt=Object.prototype,pi=yt.hasOwnProperty,fi=yt.toString,ve=Object.hasOwn||function(t,e){return pi.call(t,e)},ot=Array.isArray||function(t){return"[object Array]"===fi.call(t)},ut=Object.create(null);function ne(t){return ut[t]||(ut[t]=new RegExp("^(?:"+t.replace(/ /g,"|")+")$"))}function ie(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}var di=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,we=function(t,e){this.line=t,this.column=e};we.prototype.offset=function(t){return new we(this.line,this.column+t)};var Le=function(t,e,s){this.start=e,this.end=s,null!==t.sourceFile&&(this.source=t.sourceFile)};function Ct(t,e){for(var s=1,i=0;;){var n=vt(t,i,e);if(n<0)return new we(s,e-i);++s,i=n}}var $e={ecmaVersion:null,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},ct=!1;function mi(t){var e={};for(var s in $e)e[s]=t&&ve(t,s)?t[s]:$e[s];if("latest"===e.ecmaVersion?e.ecmaVersion=1e8:null==e.ecmaVersion?(!ct&&"object"==typeof console&&console.warn&&(ct=!0,console.warn("Since Acorn 8.0.0, options.ecmaVersion is required.\nDefaulting to 2020, but this will stop working in the future.")),e.ecmaVersion=11):e.ecmaVersion>=2015&&(e.ecmaVersion-=2009),null==e.allowReserved&&(e.allowReserved=e.ecmaVersion<5),(!t||null==t.allowHashBang)&&(e.allowHashBang=e.ecmaVersion>=14),ot(e.onToken)){var i=e.onToken;e.onToken=function(t){return i.push(t)}}return ot(e.onComment)&&(e.onComment=xi(e,e.onComment)),e}function xi(t,e){return function(s,i,n,r,a,o){var h={type:s?"Block":"Line",value:i,start:n,end:r};t.locations&&(h.loc=new Le(this,a,o)),t.ranges&&(h.range=[n,r]),e.push(h)}}var _e=1,be=2,Ze=4,St=8,Je=16,Et=32,Ve=64,wt=128,pe=256,ke=512,Oe=_e|be|pe;function et(t,e){return be|(t?Ze:0)|(e?St:0)}var Ie=0,tt=1,re=2,_t=3,kt=4,At=5,R=function(t,e,s){this.options=t=mi(t),this.sourceFile=t.sourceFile,this.keywords=ne(oi[t.ecmaVersion>=6?6:"module"===t.sourceType?"5module":5]);var i="";!0!==t.allowReserved&&(i=He[t.ecmaVersion>=6?6:5===t.ecmaVersion?5:3],"module"===t.sourceType&&(i+=" await")),this.reservedWords=ne(i);var n=(i?i+" ":"")+He.strict;this.reservedWordsStrict=ne(n),this.reservedWordsStrictBind=ne(n+" "+He.strictBind),this.input=String(e),this.containsEsc=!1,s?(this.pos=s,this.lineStart=this.input.lastIndexOf("\n",s-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(U).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=o.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule="module"===t.sourceType,this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),0===this.pos&&t.allowHashBang&&"#!"===this.input.slice(0,2)&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(_e),this.regexpState=null,this.privateNameStack=[]},Y={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},inClassStaticBlock:{configurable:!0}};R.prototype.parse=function(){var t=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(t)},Y.inFunction.get=function(){return(this.currentVarScope().flags&be)>0},Y.inGenerator.get=function(){return(this.currentVarScope().flags&St)>0},Y.inAsync.get=function(){return(this.currentVarScope().flags&Ze)>0},Y.canAwait.get=function(){for(var t=this.scopeStack.length-1;t>=0;t--){var e=this.scopeStack[t].flags;if(e&(pe|ke))return!1;if(e&be)return(e&Ze)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},Y.allowSuper.get=function(){return(this.currentThisScope().flags&Ve)>0||this.options.allowSuperOutsideMethod},Y.allowDirectSuper.get=function(){return(this.currentThisScope().flags&wt)>0},Y.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},Y.allowNewDotTarget.get=function(){for(var t=this.scopeStack.length-1;t>=0;t--){var e=this.scopeStack[t].flags;if(e&(pe|ke)||e&be&&!(e&Je))return!0}return!1},Y.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&pe)>0},R.extend=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];for(var s=this,i=0;i<t.length;i++)s=t[i](s);return s},R.parse=function(t,e){return new this(e,t).parse()},R.parseExpressionAt=function(t,e,s){var i=new this(s,t,e);return i.nextToken(),i.parseExpression()},R.tokenizer=function(t,e){return new this(e,t)},Object.defineProperties(R.prototype,Y);var B=R.prototype,gi=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;B.strictDirective=function(t){if(this.options.ecmaVersion<5)return!1;for(;;){D.lastIndex=t,t+=D.exec(this.input)[0].length;var e=gi.exec(this.input.slice(t));if(!e)return!1;if("use strict"===(e[1]||e[2])){D.lastIndex=t+e[0].length;var s=D.exec(this.input),i=s.index+s[0].length,n=this.input.charAt(i);return";"===n||"}"===n||U.test(s[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(n)||"!"===n&&"="===this.input.charAt(i+1))}t+=e[0].length,D.lastIndex=t,t+=D.exec(this.input)[0].length,";"===this.input[t]&&t++}},B.eat=function(t){return this.type===t&&(this.next(),!0)},B.isContextual=function(t){return this.type===o.name&&this.value===t&&!this.containsEsc},B.eatContextual=function(t){return!!this.isContextual(t)&&(this.next(),!0)},B.expectContextual=function(t){this.eatContextual(t)||this.unexpected()},B.canInsertSemicolon=function(){return this.type===o.eof||this.type===o.braceR||U.test(this.input.slice(this.lastTokEnd,this.start))},B.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},B.semicolon=function(){!this.eat(o.semi)&&!this.insertSemicolon()&&this.unexpected()},B.afterTrailingComma=function(t,e){if(this.type===t)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),e||this.next(),!0},B.expect=function(t){this.eat(t)||this.unexpected()},B.unexpected=function(t){this.raise(t??this.start,"Unexpected token")};var Me=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};B.checkPatternErrors=function(t,e){if(t){t.trailingComma>-1&&this.raiseRecoverable(t.trailingComma,"Comma is not permitted after the rest element");var s=e?t.parenthesizedAssign:t.parenthesizedBind;s>-1&&this.raiseRecoverable(s,e?"Assigning to rvalue":"Parenthesized pattern")}},B.checkExpressionErrors=function(t,e){if(!t)return!1;var s=t.shorthandAssign,i=t.doubleProto;if(!e)return s>=0||i>=0;s>=0&&this.raise(s,"Shorthand property assignments are valid only in destructuring patterns"),i>=0&&this.raiseRecoverable(i,"Redefinition of __proto__ property")},B.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,"Yield expression cannot be a default value"),this.awaitPos&&this.raise(this.awaitPos,"Await expression cannot be a default value")},B.isSimpleAssignTarget=function(t){return"ParenthesizedExpression"===t.type?this.isSimpleAssignTarget(t.expression):"Identifier"===t.type||"MemberExpression"===t.type};var b=R.prototype;b.parseTopLevel=function(t){var e=Object.create(null);for(t.body||(t.body=[]);this.type!==o.eof;){var s=this.parseStatement(null,!0,e);t.body.push(s)}if(this.inModule)for(var i=0,n=Object.keys(this.undefinedExports);i<n.length;i+=1){var r=n[i];this.raiseRecoverable(this.undefinedExports[r].start,"Export '"+r+"' is not defined")}return this.adaptDirectivePrologue(t.body),this.next(),t.sourceType=this.options.sourceType,this.finishNode(t,"Program")};var it={kind:"loop"},vi={kind:"switch"};b.isLet=function(t){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;D.lastIndex=this.pos;var e=D.exec(this.input),s=this.pos+e[0].length,i=this.input.charCodeAt(s);if(91===i||92===i)return!0;if(t)return!1;if(123===i||i>55295&&i<56320)return!0;if(Q(i,!0)){for(var n=s+1;ae(i=this.input.charCodeAt(n),!0);)++n;if(92===i||i>55295&&i<56320)return!0;var r=this.input.slice(s,n);if(!ui.test(r))return!0}return!1},b.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;D.lastIndex=this.pos;var t,e=D.exec(this.input),s=this.pos+e[0].length;return!(U.test(this.input.slice(this.pos,s))||"function"!==this.input.slice(s,s+8)||s+8!==this.input.length&&(ae(t=this.input.charCodeAt(s+8))||t>55295&&t<56320))},b.isUsingKeyword=function(t,e){if(this.options.ecmaVersion<17||!this.isContextual(t?"await":"using"))return!1;D.lastIndex=this.pos;var s=D.exec(this.input),i=this.pos+s[0].length;if(U.test(this.input.slice(this.pos,i)))return!1;if(t){var n,r=i+5;if("using"!==this.input.slice(i,r)||r===this.input.length||ae(n=this.input.charCodeAt(r))||n>55295&&n<56320)return!1;D.lastIndex=r;var a=D.exec(this.input);if(a&&U.test(this.input.slice(r,r+a[0].length)))return!1}if(e){var o,h=i+2;if(!("of"!==this.input.slice(i,h)||h!==this.input.length&&(ae(o=this.input.charCodeAt(h))||o>55295&&o<56320)))return!1}var c=this.input.charCodeAt(i);return Q(c,!0)||92===c},b.isAwaitUsing=function(t){return this.isUsingKeyword(!0,t)},b.isUsing=function(t){return this.isUsingKeyword(!1,t)},b.parseStatement=function(t,e,s){var i,n=this.type,r=this.startNode();switch(this.isLet(t)&&(n=o._var,i="let"),n){case o._break:case o._continue:return this.parseBreakContinueStatement(r,n.keyword);case o._debugger:return this.parseDebuggerStatement(r);case o._do:return this.parseDoStatement(r);case o._for:return this.parseForStatement(r);case o._function:return t&&(this.strict||"if"!==t&&"label"!==t)&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(r,!1,!t);case o._class:return t&&this.unexpected(),this.parseClass(r,!0);case o._if:return this.parseIfStatement(r);case o._return:return this.parseReturnStatement(r);case o._switch:return this.parseSwitchStatement(r);case o._throw:return this.parseThrowStatement(r);case o._try:return this.parseTryStatement(r);case o._const:case o._var:return i=i||this.value,t&&"var"!==i&&this.unexpected(),this.parseVarStatement(r,i);case o._while:return this.parseWhileStatement(r);case o._with:return this.parseWithStatement(r);case o.braceL:return this.parseBlock(!0,r);case o.semi:return this.parseEmptyStatement(r);case o._export:case o._import:if(this.options.ecmaVersion>10&&n===o._import){D.lastIndex=this.pos;var a=D.exec(this.input),h=this.pos+a[0].length,c=this.input.charCodeAt(h);if(40===c||46===c)return this.parseExpressionStatement(r,this.parseExpression())}return this.options.allowImportExportEverywhere||(e||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),n===o._import?this.parseImport(r):this.parseExport(r,s);default:if(this.isAsyncFunction())return t&&this.unexpected(),this.next(),this.parseFunctionStatement(r,!0,!t);var l=this.isAwaitUsing(!1)?"await using":this.isUsing(!1)?"using":null;if(l)return e&&"script"===this.options.sourceType&&this.raise(this.start,"Using declaration cannot appear in the top level when source type is `script`"),"await using"===l&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.next(),this.parseVar(r,!1,l),this.semicolon(),this.finishNode(r,"VariableDeclaration");var p=this.value,u=this.parseExpression();return n===o.name&&"Identifier"===u.type&&this.eat(o.colon)?this.parseLabeledStatement(r,p,u,t):this.parseExpressionStatement(r,u)}},b.parseBreakContinueStatement=function(t,e){var s="break"===e;this.next(),this.eat(o.semi)||this.insertSemicolon()?t.label=null:this.type!==o.name?this.unexpected():(t.label=this.parseIdent(),this.semicolon());for(var i=0;i<this.labels.length;++i){var n=this.labels[i];if((null==t.label||n.name===t.label.name)&&(null!=n.kind&&(s||"loop"===n.kind)||t.label&&s))break}return i===this.labels.length&&this.raise(t.start,"Unsyntactic "+e),this.finishNode(t,s?"BreakStatement":"ContinueStatement")},b.parseDebuggerStatement=function(t){return this.next(),this.semicolon(),this.finishNode(t,"DebuggerStatement")},b.parseDoStatement=function(t){return this.next(),this.labels.push(it),t.body=this.parseStatement("do"),this.labels.pop(),this.expect(o._while),t.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(o.semi):this.semicolon(),this.finishNode(t,"DoWhileStatement")},b.parseForStatement=function(t){this.next();var e=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(it),this.enterScope(0),this.expect(o.parenL),this.type===o.semi)return e>-1&&this.unexpected(e),this.parseFor(t,null);var s=this.isLet();if(this.type===o._var||this.type===o._const||s){var i=this.startNode(),n=s?"let":this.value;return this.next(),this.parseVar(i,!0,n),this.finishNode(i,"VariableDeclaration"),this.parseForAfterInit(t,i,e)}var r=this.isContextual("let"),a=!1,h=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(h){var c=this.startNode();return this.next(),"await using"===h&&this.next(),this.parseVar(c,!0,h),this.finishNode(c,"VariableDeclaration"),this.parseForAfterInit(t,c,e)}var l=this.containsEsc,p=new Me,u=this.start,d=e>-1?this.parseExprSubscripts(p,"await"):this.parseExpression(!0,p);return this.type===o._in||(a=this.options.ecmaVersion>=6&&this.isContextual("of"))?(e>-1?(this.type===o._in&&this.unexpected(e),t.await=!0):a&&this.options.ecmaVersion>=8&&(d.start!==u||l||"Identifier"!==d.type||"async"!==d.name?this.options.ecmaVersion>=9&&(t.await=!1):this.unexpected()),r&&a&&this.raise(d.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(d,!1,p),this.checkLValPattern(d),this.parseForIn(t,d)):(this.checkExpressionErrors(p,!0),e>-1&&this.unexpected(e),this.parseFor(t,d))},b.parseForAfterInit=function(t,e,s){return(this.type===o._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&1===e.declarations.length?(this.options.ecmaVersion>=9&&(this.type===o._in?s>-1&&this.unexpected(s):t.await=s>-1),this.parseForIn(t,e)):(s>-1&&this.unexpected(s),this.parseFor(t,e))},b.parseFunctionStatement=function(t,e,s){return this.next(),this.parseFunction(t,Ee|(s?0:ze),!1,e)},b.parseIfStatement=function(t){return this.next(),t.test=this.parseParenExpression(),t.consequent=this.parseStatement("if"),t.alternate=this.eat(o._else)?this.parseStatement("if"):null,this.finishNode(t,"IfStatement")},b.parseReturnStatement=function(t){return!this.inFunction&&!this.options.allowReturnOutsideFunction&&this.raise(this.start,"'return' outside of function"),this.next(),this.eat(o.semi)||this.insertSemicolon()?t.argument=null:(t.argument=this.parseExpression(),this.semicolon()),this.finishNode(t,"ReturnStatement")},b.parseSwitchStatement=function(t){this.next(),t.discriminant=this.parseParenExpression(),t.cases=[],this.expect(o.braceL),this.labels.push(vi),this.enterScope(0);for(var e,s=!1;this.type!==o.braceR;)if(this.type===o._case||this.type===o._default){var i=this.type===o._case;e&&this.finishNode(e,"SwitchCase"),t.cases.push(e=this.startNode()),e.consequent=[],this.next(),i?e.test=this.parseExpression():(s&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),s=!0,e.test=null),this.expect(o.colon)}else e||this.unexpected(),e.consequent.push(this.parseStatement(null));return this.exitScope(),e&&this.finishNode(e,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(t,"SwitchStatement")},b.parseThrowStatement=function(t){return this.next(),U.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),t.argument=this.parseExpression(),this.semicolon(),this.finishNode(t,"ThrowStatement")};var bi=[];b.parseCatchClauseParam=function(){var t=this.parseBindingAtom(),e="Identifier"===t.type;return this.enterScope(e?Et:0),this.checkLValPattern(t,e?kt:re),this.expect(o.parenR),t},b.parseTryStatement=function(t){if(this.next(),t.block=this.parseBlock(),t.handler=null,this.type===o._catch){var e=this.startNode();this.next(),this.eat(o.parenL)?e.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),e.param=null,this.enterScope(0)),e.body=this.parseBlock(!1),this.exitScope(),t.handler=this.finishNode(e,"CatchClause")}return t.finalizer=this.eat(o._finally)?this.parseBlock():null,!t.handler&&!t.finalizer&&this.raise(t.start,"Missing catch or finally clause"),this.finishNode(t,"TryStatement")},b.parseVarStatement=function(t,e,s){return this.next(),this.parseVar(t,!1,e,s),this.semicolon(),this.finishNode(t,"VariableDeclaration")},b.parseWhileStatement=function(t){return this.next(),t.test=this.parseParenExpression(),this.labels.push(it),t.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(t,"WhileStatement")},b.parseWithStatement=function(t){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),t.object=this.parseParenExpression(),t.body=this.parseStatement("with"),this.finishNode(t,"WithStatement")},b.parseEmptyStatement=function(t){return this.next(),this.finishNode(t,"EmptyStatement")},b.parseLabeledStatement=function(t,e,s,i){for(var n=0,r=this.labels;n<r.length;n+=1){r[n].name===e&&this.raise(s.start,"Label '"+e+"' is already declared")}for(var a=this.type.isLoop?"loop":this.type===o._switch?"switch":null,h=this.labels.length-1;h>=0;h--){var c=this.labels[h];if(c.statementStart!==t.start)break;c.statementStart=this.start,c.kind=a}return this.labels.push({name:e,kind:a,statementStart:this.start}),t.body=this.parseStatement(i?-1===i.indexOf("label")?i+"label":i:"label"),this.labels.pop(),t.label=s,this.finishNode(t,"LabeledStatement")},b.parseExpressionStatement=function(t,e){return t.expression=e,this.semicolon(),this.finishNode(t,"ExpressionStatement")},b.parseBlock=function(t,e,s){for(void 0===t&&(t=!0),void 0===e&&(e=this.startNode()),e.body=[],this.expect(o.braceL),t&&this.enterScope(0);this.type!==o.braceR;){var i=this.parseStatement(null);e.body.push(i)}return s&&(this.strict=!1),this.next(),t&&this.exitScope(),this.finishNode(e,"BlockStatement")},b.parseFor=function(t,e){return t.init=e,this.expect(o.semi),t.test=this.type===o.semi?null:this.parseExpression(),this.expect(o.semi),t.update=this.type===o.parenR?null:this.parseExpression(),this.expect(o.parenR),t.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(t,"ForStatement")},b.parseForIn=function(t,e){var s=this.type===o._in;return this.next(),"VariableDeclaration"===e.type&&null!=e.declarations[0].init&&(!s||this.options.ecmaVersion<8||this.strict||"var"!==e.kind||"Identifier"!==e.declarations[0].id.type)&&this.raise(e.start,(s?"for-in":"for-of")+" loop variable declaration may not have an initializer"),t.left=e,t.right=s?this.parseExpression():this.parseMaybeAssign(),this.expect(o.parenR),t.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(t,s?"ForInStatement":"ForOfStatement")},b.parseVar=function(t,e,s,i){for(t.declarations=[],t.kind=s;;){var n=this.startNode();if(this.parseVarId(n,s),this.eat(o.eq)?n.init=this.parseMaybeAssign(e):i||"const"!==s||this.type===o._in||this.options.ecmaVersion>=6&&this.isContextual("of")?i||"using"!==s&&"await using"!==s||!(this.options.ecmaVersion>=17)||this.type===o._in||this.isContextual("of")?i||"Identifier"===n.id.type||e&&(this.type===o._in||this.isContextual("of"))?n.init=null:this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):this.raise(this.lastTokEnd,"Missing initializer in "+s+" declaration"):this.unexpected(),t.declarations.push(this.finishNode(n,"VariableDeclarator")),!this.eat(o.comma))break}return t},b.parseVarId=function(t,e){t.id="using"===e||"await using"===e?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(t.id,"var"===e?tt:re,!1)};var Ee=1,ze=2,Pt=4;function yi(t,e){var s=e.key.name,i=t[s],n="true";return"MethodDefinition"===e.type&&("get"===e.kind||"set"===e.kind)&&(n=(e.static?"s":"i")+e.kind),"iget"===i&&"iset"===n||"iset"===i&&"iget"===n||"sget"===i&&"sset"===n||"sset"===i&&"sget"===n?(t[s]="true",!1):!!i||(t[s]=n,!1)}function Te(t,e){var s=t.computed,i=t.key;return!s&&("Identifier"===i.type&&i.name===e||"Literal"===i.type&&i.value===e)}b.parseFunction=function(t,e,s,i,n){this.initFunction(t),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!i)&&(this.type===o.star&&e&ze&&this.unexpected(),t.generator=this.eat(o.star)),this.options.ecmaVersion>=8&&(t.async=!!i),e&Ee&&(t.id=e&Pt&&this.type!==o.name?null:this.parseIdent(),t.id&&!(e&ze)&&this.checkLValSimple(t.id,this.strict||t.generator||t.async?this.treatFunctionsAsVar?tt:re:_t));var r=this.yieldPos,a=this.awaitPos,h=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(et(t.async,t.generator)),e&Ee||(t.id=this.type===o.name?this.parseIdent():null),this.parseFunctionParams(t),this.parseFunctionBody(t,s,!1,n),this.yieldPos=r,this.awaitPos=a,this.awaitIdentPos=h,this.finishNode(t,e&Ee?"FunctionDeclaration":"FunctionExpression")},b.parseFunctionParams=function(t){this.expect(o.parenL),t.params=this.parseBindingList(o.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},b.parseClass=function(t,e){this.next();var s=this.strict;this.strict=!0,this.parseClassId(t,e),this.parseClassSuper(t);var i=this.enterClassBody(),n=this.startNode(),r=!1;for(n.body=[],this.expect(o.braceL);this.type!==o.braceR;){var a=this.parseClassElement(null!==t.superClass);a&&(n.body.push(a),"MethodDefinition"===a.type&&"constructor"===a.kind?(r&&this.raiseRecoverable(a.start,"Duplicate constructor in the same class"),r=!0):a.key&&"PrivateIdentifier"===a.key.type&&yi(i,a)&&this.raiseRecoverable(a.key.start,"Identifier '#"+a.key.name+"' has already been declared"))}return this.strict=s,this.next(),t.body=this.finishNode(n,"ClassBody"),this.exitClassBody(),this.finishNode(t,e?"ClassDeclaration":"ClassExpression")},b.parseClassElement=function(t){if(this.eat(o.semi))return null;var e=this.options.ecmaVersion,s=this.startNode(),i="",n=!1,r=!1,a="method",h=!1;if(this.eatContextual("static")){if(e>=13&&this.eat(o.braceL))return this.parseClassStaticBlock(s),s;this.isClassElementNameStart()||this.type===o.star?h=!0:i="static"}if(s.static=h,!i&&e>=8&&this.eatContextual("async")&&(!this.isClassElementNameStart()&&this.type!==o.star||this.canInsertSemicolon()?i="async":r=!0),!i&&(e>=9||!r)&&this.eat(o.star)&&(n=!0),!i&&!r&&!n){var c=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?a=c:i=c)}if(i?(s.computed=!1,s.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),s.key.name=i,this.finishNode(s.key,"Identifier")):this.parseClassElementName(s),e<13||this.type===o.parenL||"method"!==a||n||r){var l=!s.static&&Te(s,"constructor"),p=l&&t;l&&"method"!==a&&this.raise(s.key.start,"Constructor can't have get/set modifier"),s.kind=l?"constructor":a,this.parseClassMethod(s,n,r,p)}else this.parseClassField(s);return s},b.isClassElementNameStart=function(){return this.type===o.name||this.type===o.privateId||this.type===o.num||this.type===o.string||this.type===o.bracketL||this.type.keyword},b.parseClassElementName=function(t){this.type===o.privateId?("constructor"===this.value&&this.raise(this.start,"Classes can't have an element named '#constructor'"),t.computed=!1,t.key=this.parsePrivateIdent()):this.parsePropertyName(t)},b.parseClassMethod=function(t,e,s,i){var n=t.key;"constructor"===t.kind?(e&&this.raise(n.start,"Constructor can't be a generator"),s&&this.raise(n.start,"Constructor can't be an async method")):t.static&&Te(t,"prototype")&&this.raise(n.start,"Classes may not have a static property named prototype");var r=t.value=this.parseMethod(e,s,i);return"get"===t.kind&&0!==r.params.length&&this.raiseRecoverable(r.start,"getter should have no params"),"set"===t.kind&&1!==r.params.length&&this.raiseRecoverable(r.start,"setter should have exactly one param"),"set"===t.kind&&"RestElement"===r.params[0].type&&this.raiseRecoverable(r.params[0].start,"Setter cannot use rest params"),this.finishNode(t,"MethodDefinition")},b.parseClassField=function(t){return Te(t,"constructor")?this.raise(t.key.start,"Classes can't have a field named 'constructor'"):t.static&&Te(t,"prototype")&&this.raise(t.key.start,"Classes can't have a static field named 'prototype'"),this.eat(o.eq)?(this.enterScope(ke|Ve),t.value=this.parseMaybeAssign(),this.exitScope()):t.value=null,this.semicolon(),this.finishNode(t,"PropertyDefinition")},b.parseClassStaticBlock=function(t){t.body=[];var e=this.labels;for(this.labels=[],this.enterScope(pe|Ve);this.type!==o.braceR;){var s=this.parseStatement(null);t.body.push(s)}return this.next(),this.exitScope(),this.labels=e,this.finishNode(t,"StaticBlock")},b.parseClassId=function(t,e){this.type===o.name?(t.id=this.parseIdent(),e&&this.checkLValSimple(t.id,re,!1)):(!0===e&&this.unexpected(),t.id=null)},b.parseClassSuper=function(t){t.superClass=this.eat(o._extends)?this.parseExprSubscripts(null,!1):null},b.enterClassBody=function(){var t={declared:Object.create(null),used:[]};return this.privateNameStack.push(t),t.declared},b.exitClassBody=function(){var t=this.privateNameStack.pop(),e=t.declared,s=t.used;if(this.options.checkPrivateFields)for(var i=this.privateNameStack.length,n=0===i?null:this.privateNameStack[i-1],r=0;r<s.length;++r){var a=s[r];ve(e,a.name)||(n?n.used.push(a):this.raiseRecoverable(a.start,"Private field '#"+a.name+"' must be declared in an enclosing class"))}},b.parseExportAllDeclaration=function(t,e){return this.options.ecmaVersion>=11&&(this.eatContextual("as")?(t.exported=this.parseModuleExportName(),this.checkExport(e,t.exported,this.lastTokStart)):t.exported=null),this.expectContextual("from"),this.type!==o.string&&this.unexpected(),t.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(t.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(t,"ExportAllDeclaration")},b.parseExport=function(t,e){if(this.next(),this.eat(o.star))return this.parseExportAllDeclaration(t,e);if(this.eat(o._default))return this.checkExport(e,"default",this.lastTokStart),t.declaration=this.parseExportDefaultDeclaration(),this.finishNode(t,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())t.declaration=this.parseExportDeclaration(t),"VariableDeclaration"===t.declaration.type?this.checkVariableExport(e,t.declaration.declarations):this.checkExport(e,t.declaration.id,t.declaration.id.start),t.specifiers=[],t.source=null,this.options.ecmaVersion>=16&&(t.attributes=[]);else{if(t.declaration=null,t.specifiers=this.parseExportSpecifiers(e),this.eatContextual("from"))this.type!==o.string&&this.unexpected(),t.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(t.attributes=this.parseWithClause());else{for(var s=0,i=t.specifiers;s<i.length;s+=1){var n=i[s];this.checkUnreserved(n.local),this.checkLocalExport(n.local),"Literal"===n.local.type&&this.raise(n.local.start,"A string literal cannot be used as an exported binding without `from`.")}t.source=null,this.options.ecmaVersion>=16&&(t.attributes=[])}this.semicolon()}return this.finishNode(t,"ExportNamedDeclaration")},b.parseExportDeclaration=function(t){return this.parseStatement(null)},b.parseExportDefaultDeclaration=function(){var t;if(this.type===o._function||(t=this.isAsyncFunction())){var e=this.startNode();return this.next(),t&&this.next(),this.parseFunction(e,Ee|Pt,!1,t)}if(this.type===o._class){var s=this.startNode();return this.parseClass(s,"nullableID")}var i=this.parseMaybeAssign();return this.semicolon(),i},b.checkExport=function(t,e,s){t&&("string"!=typeof e&&(e="Identifier"===e.type?e.name:e.value),ve(t,e)&&this.raiseRecoverable(s,"Duplicate export '"+e+"'"),t[e]=!0)},b.checkPatternExport=function(t,e){var s=e.type;if("Identifier"===s)this.checkExport(t,e,e.start);else if("ObjectPattern"===s)for(var i=0,n=e.properties;i<n.length;i+=1){var r=n[i];this.checkPatternExport(t,r)}else if("ArrayPattern"===s)for(var a=0,o=e.elements;a<o.length;a+=1){var h=o[a];h&&this.checkPatternExport(t,h)}else"Property"===s?this.checkPatternExport(t,e.value):"AssignmentPattern"===s?this.checkPatternExport(t,e.left):"RestElement"===s&&this.checkPatternExport(t,e.argument)},b.checkVariableExport=function(t,e){if(t)for(var s=0,i=e;s<i.length;s+=1){var n=i[s];this.checkPatternExport(t,n.id)}},b.shouldParseExportStatement=function(){return"var"===this.type.keyword||"const"===this.type.keyword||"class"===this.type.keyword||"function"===this.type.keyword||this.isLet()||this.isAsyncFunction()},b.parseExportSpecifier=function(t){var e=this.startNode();return e.local=this.parseModuleExportName(),e.exported=this.eatContextual("as")?this.parseModuleExportName():e.local,this.checkExport(t,e.exported,e.exported.start),this.finishNode(e,"ExportSpecifier")},b.parseExportSpecifiers=function(t){var e=[],s=!0;for(this.expect(o.braceL);!this.eat(o.braceR);){if(s)s=!1;else if(this.expect(o.comma),this.afterTrailingComma(o.braceR))break;e.push(this.parseExportSpecifier(t))}return e},b.parseImport=function(t){return this.next(),this.type===o.string?(t.specifiers=bi,t.source=this.parseExprAtom()):(t.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),t.source=this.type===o.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(t.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(t,"ImportDeclaration")},b.parseImportSpecifier=function(){var t=this.startNode();return t.imported=this.parseModuleExportName(),this.eatContextual("as")?t.local=this.parseIdent():(this.checkUnreserved(t.imported),t.local=t.imported),this.checkLValSimple(t.local,re),this.finishNode(t,"ImportSpecifier")},b.parseImportDefaultSpecifier=function(){var t=this.startNode();return t.local=this.parseIdent(),this.checkLValSimple(t.local,re),this.finishNode(t,"ImportDefaultSpecifier")},b.parseImportNamespaceSpecifier=function(){var t=this.startNode();return this.next(),this.expectContextual("as"),t.local=this.parseIdent(),this.checkLValSimple(t.local,re),this.finishNode(t,"ImportNamespaceSpecifier")},b.parseImportSpecifiers=function(){var t=[],e=!0;if(this.type===o.name&&(t.push(this.parseImportDefaultSpecifier()),!this.eat(o.comma)))return t;if(this.type===o.star)return t.push(this.parseImportNamespaceSpecifier()),t;for(this.expect(o.braceL);!this.eat(o.braceR);){if(e)e=!1;else if(this.expect(o.comma),this.afterTrailingComma(o.braceR))break;t.push(this.parseImportSpecifier())}return t},b.parseWithClause=function(){var t=[];if(!this.eat(o._with))return t;this.expect(o.braceL);for(var e={},s=!0;!this.eat(o.braceR);){if(s)s=!1;else if(this.expect(o.comma),this.afterTrailingComma(o.braceR))break;var i=this.parseImportAttribute(),n="Identifier"===i.key.type?i.key.name:i.key.value;ve(e,n)&&this.raiseRecoverable(i.key.start,"Duplicate attribute key '"+n+"'"),e[n]=!0,t.push(i)}return t},b.parseImportAttribute=function(){var t=this.startNode();return t.key=this.type===o.string?this.parseExprAtom():this.parseIdent("never"!==this.options.allowReserved),this.expect(o.colon),this.type!==o.string&&this.unexpected(),t.value=this.parseExprAtom(),this.finishNode(t,"ImportAttribute")},b.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===o.string){var t=this.parseLiteral(this.value);return di.test(t.value)&&this.raise(t.start,"An export name cannot include a lone surrogate."),t}return this.parseIdent(!0)},b.adaptDirectivePrologue=function(t){for(var e=0;e<t.length&&this.isDirectiveCandidate(t[e]);++e)t[e].directive=t[e].expression.raw.slice(1,-1)},b.isDirectiveCandidate=function(t){return this.options.ecmaVersion>=5&&"ExpressionStatement"===t.type&&"Literal"===t.expression.type&&"string"==typeof t.expression.value&&('"'===this.input[t.start]||"'"===this.input[t.start])};var $=R.prototype;$.toAssignable=function(t,e,s){if(this.options.ecmaVersion>=6&&t)switch(t.type){case"Identifier":this.inAsync&&"await"===t.name&&this.raise(t.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":t.type="ObjectPattern",s&&this.checkPatternErrors(s,!0);for(var i=0,n=t.properties;i<n.length;i+=1){var r=n[i];this.toAssignable(r,e),"RestElement"===r.type&&("ArrayPattern"===r.argument.type||"ObjectPattern"===r.argument.type)&&this.raise(r.argument.start,"Unexpected token")}break;case"Property":"init"!==t.kind&&this.raise(t.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(t.value,e);break;case"ArrayExpression":t.type="ArrayPattern",s&&this.checkPatternErrors(s,!0),this.toAssignableList(t.elements,e);break;case"SpreadElement":t.type="RestElement",this.toAssignable(t.argument,e),"AssignmentPattern"===t.argument.type&&this.raise(t.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":"="!==t.operator&&this.raise(t.left.end,"Only '=' operator can be used for specifying default value."),t.type="AssignmentPattern",delete t.operator,this.toAssignable(t.left,e);break;case"ParenthesizedExpression":this.toAssignable(t.expression,e,s);break;case"ChainExpression":this.raiseRecoverable(t.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!e)break;default:this.raise(t.start,"Assigning to rvalue")}else s&&this.checkPatternErrors(s,!0);return t},$.toAssignableList=function(t,e){for(var s=t.length,i=0;i<s;i++){var n=t[i];n&&this.toAssignable(n,e)}if(s){var r=t[s-1];6===this.options.ecmaVersion&&e&&r&&"RestElement"===r.type&&"Identifier"!==r.argument.type&&this.unexpected(r.argument.start)}return t},$.parseSpread=function(t){var e=this.startNode();return this.next(),e.argument=this.parseMaybeAssign(!1,t),this.finishNode(e,"SpreadElement")},$.parseRestBinding=function(){var t=this.startNode();return this.next(),6===this.options.ecmaVersion&&this.type!==o.name&&this.unexpected(),t.argument=this.parseBindingAtom(),this.finishNode(t,"RestElement")},$.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case o.bracketL:var t=this.startNode();return this.next(),t.elements=this.parseBindingList(o.bracketR,!0,!0),this.finishNode(t,"ArrayPattern");case o.braceL:return this.parseObj(!0)}return this.parseIdent()},$.parseBindingList=function(t,e,s,i){for(var n=[],r=!0;!this.eat(t);)if(r?r=!1:this.expect(o.comma),e&&this.type===o.comma)n.push(null);else{if(s&&this.afterTrailingComma(t))break;if(this.type===o.ellipsis){var a=this.parseRestBinding();this.parseBindingListItem(a),n.push(a),this.type===o.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(t);break}n.push(this.parseAssignableListItem(i))}return n},$.parseAssignableListItem=function(t){var e=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(e),e},$.parseBindingListItem=function(t){return t},$.parseMaybeDefault=function(t,e,s){if(s=s||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(o.eq))return s;var i=this.startNodeAt(t,e);return i.left=s,i.right=this.parseMaybeAssign(),this.finishNode(i,"AssignmentPattern")},$.checkLValSimple=function(t,e,s){void 0===e&&(e=Ie);var i=e!==Ie;switch(t.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(t.name)&&this.raiseRecoverable(t.start,(i?"Binding ":"Assigning to ")+t.name+" in strict mode"),i&&(e===re&&"let"===t.name&&this.raiseRecoverable(t.start,"let is disallowed as a lexically bound name"),s&&(ve(s,t.name)&&this.raiseRecoverable(t.start,"Argument name clash"),s[t.name]=!0),e!==At&&this.declareName(t.name,e,t.start));break;case"ChainExpression":this.raiseRecoverable(t.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":i&&this.raiseRecoverable(t.start,"Binding member expression");break;case"ParenthesizedExpression":return i&&this.raiseRecoverable(t.start,"Binding parenthesized expression"),this.checkLValSimple(t.expression,e,s);default:this.raise(t.start,(i?"Binding":"Assigning to")+" rvalue")}},$.checkLValPattern=function(t,e,s){switch(void 0===e&&(e=Ie),t.type){case"ObjectPattern":for(var i=0,n=t.properties;i<n.length;i+=1){var r=n[i];this.checkLValInnerPattern(r,e,s)}break;case"ArrayPattern":for(var a=0,o=t.elements;a<o.length;a+=1){var h=o[a];h&&this.checkLValInnerPattern(h,e,s)}break;default:this.checkLValSimple(t,e,s)}},$.checkLValInnerPattern=function(t,e,s){switch(void 0===e&&(e=Ie),t.type){case"Property":this.checkLValInnerPattern(t.value,e,s);break;case"AssignmentPattern":this.checkLValPattern(t.left,e,s);break;case"RestElement":this.checkLValPattern(t.argument,e,s);break;default:this.checkLValPattern(t,e,s)}};var G=function(t,e,s,i,n){this.token=t,this.isExpr=!!e,this.preserveSpace=!!s,this.override=i,this.generator=!!n},T={b_stat:new G("{",!1),b_expr:new G("{",!0),b_tmpl:new G("${",!1),p_stat:new G("(",!1),p_expr:new G("(",!0),q_tmpl:new G("`",!0,!0,function(t){return t.tryReadTemplateToken()}),f_stat:new G("function",!1),f_expr:new G("function",!0),f_expr_gen:new G("function",!0,!1,null,!0),f_gen:new G("function",!1,!1,null,!0)},ye=R.prototype;ye.initialContext=function(){return[T.b_stat]},ye.curContext=function(){return this.context[this.context.length-1]},ye.braceIsBlock=function(t){var e=this.curContext();return e===T.f_expr||e===T.f_stat||(t!==o.colon||e!==T.b_stat&&e!==T.b_expr?t===o._return||t===o.name&&this.exprAllowed?U.test(this.input.slice(this.lastTokEnd,this.start)):t===o._else||t===o.semi||t===o.eof||t===o.parenR||t===o.arrow||(t===o.braceL?e===T.b_stat:t!==o._var&&t!==o._const&&t!==o.name&&!this.exprAllowed):!e.isExpr)},ye.inGeneratorContext=function(){for(var t=this.context.length-1;t>=1;t--){var e=this.context[t];if("function"===e.token)return e.generator}return!1},ye.updateContext=function(t){var e,s=this.type;s.keyword&&t===o.dot?this.exprAllowed=!1:(e=s.updateContext)?e.call(this,t):this.exprAllowed=s.beforeExpr},ye.overrideContext=function(t){this.curContext()!==t&&(this.context[this.context.length-1]=t)},o.parenR.updateContext=o.braceR.updateContext=function(){if(1!==this.context.length){var t=this.context.pop();t===T.b_stat&&"function"===this.curContext().token&&(t=this.context.pop()),this.exprAllowed=!t.isExpr}else this.exprAllowed=!0},o.braceL.updateContext=function(t){this.context.push(this.braceIsBlock(t)?T.b_stat:T.b_expr),this.exprAllowed=!0},o.dollarBraceL.updateContext=function(){this.context.push(T.b_tmpl),this.exprAllowed=!0},o.parenL.updateContext=function(t){var e=t===o._if||t===o._for||t===o._with||t===o._while;this.context.push(e?T.p_stat:T.p_expr),this.exprAllowed=!0},o.incDec.updateContext=function(){},o._function.updateContext=o._class.updateContext=function(t){!t.beforeExpr||t===o._else||t===o.semi&&this.curContext()!==T.p_stat||t===o._return&&U.test(this.input.slice(this.lastTokEnd,this.start))||(t===o.colon||t===o.braceL)&&this.curContext()===T.b_stat?this.context.push(T.f_stat):this.context.push(T.f_expr),this.exprAllowed=!1},o.colon.updateContext=function(){"function"===this.curContext().token&&this.context.pop(),this.exprAllowed=!0},o.backQuote.updateContext=function(){this.curContext()===T.q_tmpl?this.context.pop():this.context.push(T.q_tmpl),this.exprAllowed=!1},o.star.updateContext=function(t){if(t===o._function){var e=this.context.length-1;this.context[e]===T.f_expr?this.context[e]=T.f_expr_gen:this.context[e]=T.f_gen}this.exprAllowed=!0},o.name.updateContext=function(t){var e=!1;this.options.ecmaVersion>=6&&t!==o.dot&&("of"===this.value&&!this.exprAllowed||"yield"===this.value&&this.inGeneratorContext())&&(e=!0),this.exprAllowed=e};var S=R.prototype;function It(t){return"Identifier"===t.type||"ParenthesizedExpression"===t.type&&It(t.expression)}function Ge(t){return"MemberExpression"===t.type&&"PrivateIdentifier"===t.property.type||"ChainExpression"===t.type&&Ge(t.expression)||"ParenthesizedExpression"===t.type&&Ge(t.expression)}S.checkPropClash=function(t,e,s){if(!(this.options.ecmaVersion>=9&&"SpreadElement"===t.type||this.options.ecmaVersion>=6&&(t.computed||t.method||t.shorthand))){var i,n=t.key;switch(n.type){case"Identifier":i=n.name;break;case"Literal":i=String(n.value);break;default:return}var r=t.kind;if(this.options.ecmaVersion>=6)return void("__proto__"===i&&"init"===r&&(e.proto&&(s?s.doubleProto<0&&(s.doubleProto=n.start):this.raiseRecoverable(n.start,"Redefinition of __proto__ property")),e.proto=!0));var a=e[i="$"+i];if(a)("init"===r?this.strict&&a.init||a.get||a.set:a.init||a[r])&&this.raiseRecoverable(n.start,"Redefinition of property");else a=e[i]={init:!1,get:!1,set:!1};a[r]=!0}},S.parseExpression=function(t,e){var s=this.start,i=this.startLoc,n=this.parseMaybeAssign(t,e);if(this.type===o.comma){var r=this.startNodeAt(s,i);for(r.expressions=[n];this.eat(o.comma);)r.expressions.push(this.parseMaybeAssign(t,e));return this.finishNode(r,"SequenceExpression")}return n},S.parseMaybeAssign=function(t,e,s){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(t);this.exprAllowed=!1}var i=!1,n=-1,r=-1,a=-1;e?(n=e.parenthesizedAssign,r=e.trailingComma,a=e.doubleProto,e.parenthesizedAssign=e.trailingComma=-1):(e=new Me,i=!0);var h=this.start,c=this.startLoc;(this.type===o.parenL||this.type===o.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait="await"===t);var l=this.parseMaybeConditional(t,e);if(s&&(l=s.call(this,l,h,c)),this.type.isAssign){var p=this.startNodeAt(h,c);return p.operator=this.value,this.type===o.eq&&(l=this.toAssignable(l,!1,e)),i||(e.parenthesizedAssign=e.trailingComma=e.doubleProto=-1),e.shorthandAssign>=l.start&&(e.shorthandAssign=-1),this.type===o.eq?this.checkLValPattern(l):this.checkLValSimple(l),p.left=l,this.next(),p.right=this.parseMaybeAssign(t),a>-1&&(e.doubleProto=a),this.finishNode(p,"AssignmentExpression")}return i&&this.checkExpressionErrors(e,!0),n>-1&&(e.parenthesizedAssign=n),r>-1&&(e.trailingComma=r),l},S.parseMaybeConditional=function(t,e){var s=this.start,i=this.startLoc,n=this.parseExprOps(t,e);if(this.checkExpressionErrors(e))return n;if(this.eat(o.question)){var r=this.startNodeAt(s,i);return r.test=n,r.consequent=this.parseMaybeAssign(),this.expect(o.colon),r.alternate=this.parseMaybeAssign(t),this.finishNode(r,"ConditionalExpression")}return n},S.parseExprOps=function(t,e){var s=this.start,i=this.startLoc,n=this.parseMaybeUnary(e,!1,!1,t);return this.checkExpressionErrors(e)||n.start===s&&"ArrowFunctionExpression"===n.type?n:this.parseExprOp(n,s,i,-1,t)},S.parseExprOp=function(t,e,s,i,n){var r=this.type.binop;if(null!=r&&(!n||this.type!==o._in)&&r>i){var a=this.type===o.logicalOR||this.type===o.logicalAND,h=this.type===o.coalesce;h&&(r=o.logicalAND.binop);var c=this.value;this.next();var l=this.start,p=this.startLoc,u=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,n),l,p,r,n),d=this.buildBinary(e,s,t,u,c,a||h);return(a&&this.type===o.coalesce||h&&(this.type===o.logicalOR||this.type===o.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(d,e,s,i,n)}return t},S.buildBinary=function(t,e,s,i,n,r){"PrivateIdentifier"===i.type&&this.raise(i.start,"Private identifier can only be left side of binary expression");var a=this.startNodeAt(t,e);return a.left=s,a.operator=n,a.right=i,this.finishNode(a,r?"LogicalExpression":"BinaryExpression")},S.parseMaybeUnary=function(t,e,s,i){var n,r=this.start,a=this.startLoc;if(this.isContextual("await")&&this.canAwait)n=this.parseAwait(i),e=!0;else if(this.type.prefix){var h=this.startNode(),c=this.type===o.incDec;h.operator=this.value,h.prefix=!0,this.next(),h.argument=this.parseMaybeUnary(null,!0,c,i),this.checkExpressionErrors(t,!0),c?this.checkLValSimple(h.argument):this.strict&&"delete"===h.operator&&It(h.argument)?this.raiseRecoverable(h.start,"Deleting local variable in strict mode"):"delete"===h.operator&&Ge(h.argument)?this.raiseRecoverable(h.start,"Private fields can not be deleted"):e=!0,n=this.finishNode(h,c?"UpdateExpression":"UnaryExpression")}else if(e||this.type!==o.privateId){if(n=this.parseExprSubscripts(t,i),this.checkExpressionErrors(t))return n;for(;this.type.postfix&&!this.canInsertSemicolon();){var l=this.startNodeAt(r,a);l.operator=this.value,l.prefix=!1,l.argument=n,this.checkLValSimple(n),this.next(),n=this.finishNode(l,"UpdateExpression")}}else(i||0===this.privateNameStack.length)&&this.options.checkPrivateFields&&this.unexpected(),n=this.parsePrivateIdent(),this.type!==o._in&&this.unexpected();return s||!this.eat(o.starstar)?n:e?void this.unexpected(this.lastTokStart):this.buildBinary(r,a,n,this.parseMaybeUnary(null,!1,!1,i),"**",!1)},S.parseExprSubscripts=function(t,e){var s=this.start,i=this.startLoc,n=this.parseExprAtom(t,e);if("ArrowFunctionExpression"===n.type&&")"!==this.input.slice(this.lastTokStart,this.lastTokEnd))return n;var r=this.parseSubscripts(n,s,i,!1,e);return t&&"MemberExpression"===r.type&&(t.parenthesizedAssign>=r.start&&(t.parenthesizedAssign=-1),t.parenthesizedBind>=r.start&&(t.parenthesizedBind=-1),t.trailingComma>=r.start&&(t.trailingComma=-1)),r},S.parseSubscripts=function(t,e,s,i,n){for(var r=this.options.ecmaVersion>=8&&"Identifier"===t.type&&"async"===t.name&&this.lastTokEnd===t.end&&!this.canInsertSemicolon()&&t.end-t.start===5&&this.potentialArrowAt===t.start,a=!1;;){var o=this.parseSubscript(t,e,s,i,r,a,n);if(o.optional&&(a=!0),o===t||"ArrowFunctionExpression"===o.type){if(a){var h=this.startNodeAt(e,s);h.expression=o,o=this.finishNode(h,"ChainExpression")}return o}t=o}},S.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(o.arrow)},S.parseSubscriptAsyncArrow=function(t,e,s,i){return this.parseArrowExpression(this.startNodeAt(t,e),s,!0,i)},S.parseSubscript=function(t,e,s,i,n,r,a){var h=this.options.ecmaVersion>=11,c=h&&this.eat(o.questionDot);i&&c&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var l=this.eat(o.bracketL);if(l||c&&this.type!==o.parenL&&this.type!==o.backQuote||this.eat(o.dot)){var p=this.startNodeAt(e,s);p.object=t,l?(p.property=this.parseExpression(),this.expect(o.bracketR)):this.type===o.privateId&&"Super"!==t.type?p.property=this.parsePrivateIdent():p.property=this.parseIdent("never"!==this.options.allowReserved),p.computed=!!l,h&&(p.optional=c),t=this.finishNode(p,"MemberExpression")}else if(!i&&this.eat(o.parenL)){var u=new Me,d=this.yieldPos,f=this.awaitPos,m=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var g=this.parseExprList(o.parenR,this.options.ecmaVersion>=8,!1,u);if(n&&!c&&this.shouldParseAsyncArrow())return this.checkPatternErrors(u,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=d,this.awaitPos=f,this.awaitIdentPos=m,this.parseSubscriptAsyncArrow(e,s,g,a);this.checkExpressionErrors(u,!0),this.yieldPos=d||this.yieldPos,this.awaitPos=f||this.awaitPos,this.awaitIdentPos=m||this.awaitIdentPos;var v=this.startNodeAt(e,s);v.callee=t,v.arguments=g,h&&(v.optional=c),t=this.finishNode(v,"CallExpression")}else if(this.type===o.backQuote){(c||r)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var x=this.startNodeAt(e,s);x.tag=t,x.quasi=this.parseTemplate({isTagged:!0}),t=this.finishNode(x,"TaggedTemplateExpression")}return t},S.parseExprAtom=function(t,e,s){this.type===o.slash&&this.readRegexp();var i,n=this.potentialArrowAt===this.start;switch(this.type){case o._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),i=this.startNode(),this.next(),this.type===o.parenL&&!this.allowDirectSuper&&this.raise(i.start,"super() call outside constructor of a subclass"),this.type!==o.dot&&this.type!==o.bracketL&&this.type!==o.parenL&&this.unexpected(),this.finishNode(i,"Super");case o._this:return i=this.startNode(),this.next(),this.finishNode(i,"ThisExpression");case o.name:var r=this.start,a=this.startLoc,h=this.containsEsc,c=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!h&&"async"===c.name&&!this.canInsertSemicolon()&&this.eat(o._function))return this.overrideContext(T.f_expr),this.parseFunction(this.startNodeAt(r,a),0,!1,!0,e);if(n&&!this.canInsertSemicolon()){if(this.eat(o.arrow))return this.parseArrowExpression(this.startNodeAt(r,a),[c],!1,e);if(this.options.ecmaVersion>=8&&"async"===c.name&&this.type===o.name&&!h&&(!this.potentialArrowInForAwait||"of"!==this.value||this.containsEsc))return c=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(o.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(r,a),[c],!0,e)}return c;case o.regexp:var l=this.value;return(i=this.parseLiteral(l.value)).regex={pattern:l.pattern,flags:l.flags},i;case o.num:case o.string:return this.parseLiteral(this.value);case o._null:case o._true:case o._false:return(i=this.startNode()).value=this.type===o._null?null:this.type===o._true,i.raw=this.type.keyword,this.next(),this.finishNode(i,"Literal");case o.parenL:var p=this.start,u=this.parseParenAndDistinguishExpression(n,e);return t&&(t.parenthesizedAssign<0&&!this.isSimpleAssignTarget(u)&&(t.parenthesizedAssign=p),t.parenthesizedBind<0&&(t.parenthesizedBind=p)),u;case o.bracketL:return i=this.startNode(),this.next(),i.elements=this.parseExprList(o.bracketR,!0,!0,t),this.finishNode(i,"ArrayExpression");case o.braceL:return this.overrideContext(T.b_expr),this.parseObj(!1,t);case o._function:return i=this.startNode(),this.next(),this.parseFunction(i,0);case o._class:return this.parseClass(this.startNode(),!1);case o._new:return this.parseNew();case o.backQuote:return this.parseTemplate();case o._import:return this.options.ecmaVersion>=11?this.parseExprImport(s):this.unexpected();default:return this.parseExprAtomDefault()}},S.parseExprAtomDefault=function(){this.unexpected()},S.parseExprImport=function(t){var e=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===o.parenL&&!t)return this.parseDynamicImport(e);if(this.type===o.dot){var s=this.startNodeAt(e.start,e.loc&&e.loc.start);return s.name="import",e.meta=this.finishNode(s,"Identifier"),this.parseImportMeta(e)}this.unexpected()},S.parseDynamicImport=function(t){if(this.next(),t.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(o.parenR)?t.options=null:(this.expect(o.comma),this.afterTrailingComma(o.parenR)?t.options=null:(t.options=this.parseMaybeAssign(),this.eat(o.parenR)||(this.expect(o.comma),this.afterTrailingComma(o.parenR)||this.unexpected())));else if(!this.eat(o.parenR)){var e=this.start;this.eat(o.comma)&&this.eat(o.parenR)?this.raiseRecoverable(e,"Trailing comma is not allowed in import()"):this.unexpected(e)}return this.finishNode(t,"ImportExpression")},S.parseImportMeta=function(t){this.next();var e=this.containsEsc;return t.property=this.parseIdent(!0),"meta"!==t.property.name&&this.raiseRecoverable(t.property.start,"The only valid meta property for import is 'import.meta'"),e&&this.raiseRecoverable(t.start,"'import.meta' must not contain escaped characters"),"module"!==this.options.sourceType&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(t.start,"Cannot use 'import.meta' outside a module"),this.finishNode(t,"MetaProperty")},S.parseLiteral=function(t){var e=this.startNode();return e.value=t,e.raw=this.input.slice(this.start,this.end),110===e.raw.charCodeAt(e.raw.length-1)&&(e.bigint=null!=e.value?e.value.toString():e.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(e,"Literal")},S.parseParenExpression=function(){this.expect(o.parenL);var t=this.parseExpression();return this.expect(o.parenR),t},S.shouldParseArrow=function(t){return!this.canInsertSemicolon()},S.parseParenAndDistinguishExpression=function(t,e){var s,i=this.start,n=this.startLoc,r=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var a,h=this.start,c=this.startLoc,l=[],p=!0,u=!1,d=new Me,f=this.yieldPos,m=this.awaitPos;for(this.yieldPos=0,this.awaitPos=0;this.type!==o.parenR;){if(p?p=!1:this.expect(o.comma),r&&this.afterTrailingComma(o.parenR,!0)){u=!0;break}if(this.type===o.ellipsis){a=this.start,l.push(this.parseParenItem(this.parseRestBinding())),this.type===o.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}l.push(this.parseMaybeAssign(!1,d,this.parseParenItem))}var g=this.lastTokEnd,v=this.lastTokEndLoc;if(this.expect(o.parenR),t&&this.shouldParseArrow(l)&&this.eat(o.arrow))return this.checkPatternErrors(d,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=f,this.awaitPos=m,this.parseParenArrowList(i,n,l,e);(!l.length||u)&&this.unexpected(this.lastTokStart),a&&this.unexpected(a),this.checkExpressionErrors(d,!0),this.yieldPos=f||this.yieldPos,this.awaitPos=m||this.awaitPos,l.length>1?((s=this.startNodeAt(h,c)).expressions=l,this.finishNodeAt(s,"SequenceExpression",g,v)):s=l[0]}else s=this.parseParenExpression();if(this.options.preserveParens){var x=this.startNodeAt(i,n);return x.expression=s,this.finishNode(x,"ParenthesizedExpression")}return s},S.parseParenItem=function(t){return t},S.parseParenArrowList=function(t,e,s,i){return this.parseArrowExpression(this.startNodeAt(t,e),s,!1,i)};var Ci=[];S.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var t=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===o.dot){var e=this.startNodeAt(t.start,t.loc&&t.loc.start);e.name="new",t.meta=this.finishNode(e,"Identifier"),this.next();var s=this.containsEsc;return t.property=this.parseIdent(!0),"target"!==t.property.name&&this.raiseRecoverable(t.property.start,"The only valid meta property for new is 'new.target'"),s&&this.raiseRecoverable(t.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(t.start,"'new.target' can only be used in functions and class static block"),this.finishNode(t,"MetaProperty")}var i=this.start,n=this.startLoc;return t.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),i,n,!0,!1),this.eat(o.parenL)?t.arguments=this.parseExprList(o.parenR,this.options.ecmaVersion>=8,!1):t.arguments=Ci,this.finishNode(t,"NewExpression")},S.parseTemplateElement=function(t){var e=t.isTagged,s=this.startNode();return this.type===o.invalidTemplate?(e||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),s.value={raw:this.value.replace(/\r\n?/g,"\n"),cooked:null}):s.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,"\n"),cooked:this.value},this.next(),s.tail=this.type===o.backQuote,this.finishNode(s,"TemplateElement")},S.parseTemplate=function(t){void 0===t&&(t={});var e=t.isTagged;void 0===e&&(e=!1);var s=this.startNode();this.next(),s.expressions=[];var i=this.parseTemplateElement({isTagged:e});for(s.quasis=[i];!i.tail;)this.type===o.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(o.dollarBraceL),s.expressions.push(this.parseExpression()),this.expect(o.braceR),s.quasis.push(i=this.parseTemplateElement({isTagged:e}));return this.next(),this.finishNode(s,"TemplateLiteral")},S.isAsyncProp=function(t){return!t.computed&&"Identifier"===t.key.type&&"async"===t.key.name&&(this.type===o.name||this.type===o.num||this.type===o.string||this.type===o.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===o.star)&&!U.test(this.input.slice(this.lastTokEnd,this.start))},S.parseObj=function(t,e){var s=this.startNode(),i=!0,n={};for(s.properties=[],this.next();!this.eat(o.braceR);){if(i)i=!1;else if(this.expect(o.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(o.braceR))break;var r=this.parseProperty(t,e);t||this.checkPropClash(r,n,e),s.properties.push(r)}return this.finishNode(s,t?"ObjectPattern":"ObjectExpression")},S.parseProperty=function(t,e){var s,i,n,r,a=this.startNode();if(this.options.ecmaVersion>=9&&this.eat(o.ellipsis))return t?(a.argument=this.parseIdent(!1),this.type===o.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.finishNode(a,"RestElement")):(a.argument=this.parseMaybeAssign(!1,e),this.type===o.comma&&e&&e.trailingComma<0&&(e.trailingComma=this.start),this.finishNode(a,"SpreadElement"));this.options.ecmaVersion>=6&&(a.method=!1,a.shorthand=!1,(t||e)&&(n=this.start,r=this.startLoc),t||(s=this.eat(o.star)));var h=this.containsEsc;return this.parsePropertyName(a),!t&&!h&&this.options.ecmaVersion>=8&&!s&&this.isAsyncProp(a)?(i=!0,s=this.options.ecmaVersion>=9&&this.eat(o.star),this.parsePropertyName(a)):i=!1,this.parsePropertyValue(a,t,s,i,n,r,e,h),this.finishNode(a,"Property")},S.parseGetterSetter=function(t){var e=t.key.name;this.parsePropertyName(t),t.value=this.parseMethod(!1),t.kind=e;var s="get"===t.kind?0:1;if(t.value.params.length!==s){var i=t.value.start;"get"===t.kind?this.raiseRecoverable(i,"getter should have no params"):this.raiseRecoverable(i,"setter should have exactly one param")}else"set"===t.kind&&"RestElement"===t.value.params[0].type&&this.raiseRecoverable(t.value.params[0].start,"Setter cannot use rest params")},S.parsePropertyValue=function(t,e,s,i,n,r,a,h){(s||i)&&this.type===o.colon&&this.unexpected(),this.eat(o.colon)?(t.value=e?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,a),t.kind="init"):this.options.ecmaVersion>=6&&this.type===o.parenL?(e&&this.unexpected(),t.method=!0,t.value=this.parseMethod(s,i),t.kind="init"):e||h||!(this.options.ecmaVersion>=5)||t.computed||"Identifier"!==t.key.type||"get"!==t.key.name&&"set"!==t.key.name||this.type===o.comma||this.type===o.braceR||this.type===o.eq?this.options.ecmaVersion>=6&&!t.computed&&"Identifier"===t.key.type?((s||i)&&this.unexpected(),this.checkUnreserved(t.key),"await"===t.key.name&&!this.awaitIdentPos&&(this.awaitIdentPos=n),e?t.value=this.parseMaybeDefault(n,r,this.copyNode(t.key)):this.type===o.eq&&a?(a.shorthandAssign<0&&(a.shorthandAssign=this.start),t.value=this.parseMaybeDefault(n,r,this.copyNode(t.key))):t.value=this.copyNode(t.key),t.kind="init",t.shorthand=!0):this.unexpected():((s||i)&&this.unexpected(),this.parseGetterSetter(t))},S.parsePropertyName=function(t){if(this.options.ecmaVersion>=6){if(this.eat(o.bracketL))return t.computed=!0,t.key=this.parseMaybeAssign(),this.expect(o.bracketR),t.key;t.computed=!1}return t.key=this.type===o.num||this.type===o.string?this.parseExprAtom():this.parseIdent("never"!==this.options.allowReserved)},S.initFunction=function(t){t.id=null,this.options.ecmaVersion>=6&&(t.generator=t.expression=!1),this.options.ecmaVersion>=8&&(t.async=!1)},S.parseMethod=function(t,e,s){var i=this.startNode(),n=this.yieldPos,r=this.awaitPos,a=this.awaitIdentPos;return this.initFunction(i),this.options.ecmaVersion>=6&&(i.generator=t),this.options.ecmaVersion>=8&&(i.async=!!e),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(et(e,i.generator)|Ve|(s?wt:0)),this.expect(o.parenL),i.params=this.parseBindingList(o.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(i,!1,!0,!1),this.yieldPos=n,this.awaitPos=r,this.awaitIdentPos=a,this.finishNode(i,"FunctionExpression")},S.parseArrowExpression=function(t,e,s,i){var n=this.yieldPos,r=this.awaitPos,a=this.awaitIdentPos;return this.enterScope(et(s,!1)|Je),this.initFunction(t),this.options.ecmaVersion>=8&&(t.async=!!s),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,t.params=this.toAssignableList(e,!0),this.parseFunctionBody(t,!0,!1,i),this.yieldPos=n,this.awaitPos=r,this.awaitIdentPos=a,this.finishNode(t,"ArrowFunctionExpression")},S.parseFunctionBody=function(t,e,s,i){var n=e&&this.type!==o.braceL,r=this.strict,a=!1;if(n)t.body=this.parseMaybeAssign(i),t.expression=!0,this.checkParams(t,!1);else{var h=this.options.ecmaVersion>=7&&!this.isSimpleParamList(t.params);(!r||h)&&((a=this.strictDirective(this.end))&&h&&this.raiseRecoverable(t.start,"Illegal 'use strict' directive in function with non-simple parameter list"));var c=this.labels;this.labels=[],a&&(this.strict=!0),this.checkParams(t,!r&&!a&&!e&&!s&&this.isSimpleParamList(t.params)),this.strict&&t.id&&this.checkLValSimple(t.id,At),t.body=this.parseBlock(!1,void 0,a&&!r),t.expression=!1,this.adaptDirectivePrologue(t.body.body),this.labels=c}this.exitScope()},S.isSimpleParamList=function(t){for(var e=0,s=t;e<s.length;e+=1){if("Identifier"!==s[e].type)return!1}return!0},S.checkParams=function(t,e){for(var s=Object.create(null),i=0,n=t.params;i<n.length;i+=1){var r=n[i];this.checkLValInnerPattern(r,tt,e?null:s)}},S.parseExprList=function(t,e,s,i){for(var n=[],r=!0;!this.eat(t);){if(r)r=!1;else if(this.expect(o.comma),e&&this.afterTrailingComma(t))break;var a=void 0;s&&this.type===o.comma?a=null:this.type===o.ellipsis?(a=this.parseSpread(i),i&&this.type===o.comma&&i.trailingComma<0&&(i.trailingComma=this.start)):a=this.parseMaybeAssign(!1,i),n.push(a)}return n},S.checkUnreserved=function(t){var e=t.start,s=t.end,i=t.name;(this.inGenerator&&"yield"===i&&this.raiseRecoverable(e,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&"await"===i&&this.raiseRecoverable(e,"Cannot use 'await' as identifier inside an async function"),!(this.currentThisScope().flags&Oe)&&"arguments"===i&&this.raiseRecoverable(e,"Cannot use 'arguments' in class field initializer"),this.inClassStaticBlock&&("arguments"===i||"await"===i)&&this.raise(e,"Cannot use "+i+" in class static initialization block"),this.keywords.test(i)&&this.raise(e,"Unexpected keyword '"+i+"'"),this.options.ecmaVersion<6&&-1!==this.input.slice(e,s).indexOf("\\"))||(this.strict?this.reservedWordsStrict:this.reservedWords).test(i)&&(!this.inAsync&&"await"===i&&this.raiseRecoverable(e,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(e,"The keyword '"+i+"' is reserved"))},S.parseIdent=function(t){var e=this.parseIdentNode();return this.next(!!t),this.finishNode(e,"Identifier"),t||(this.checkUnreserved(e),"await"===e.name&&!this.awaitIdentPos&&(this.awaitIdentPos=e.start)),e},S.parseIdentNode=function(){var t=this.startNode();return this.type===o.name?t.name=this.value:this.type.keyword?(t.name=this.type.keyword,("class"===t.name||"function"===t.name)&&(this.lastTokEnd!==this.lastTokStart+1||46!==this.input.charCodeAt(this.lastTokStart))&&this.context.pop(),this.type=o.name):this.unexpected(),t},S.parsePrivateIdent=function(){var t=this.startNode();return this.type===o.privateId?t.name=this.value:this.unexpected(),this.next(),this.finishNode(t,"PrivateIdentifier"),this.options.checkPrivateFields&&(0===this.privateNameStack.length?this.raise(t.start,"Private field '#"+t.name+"' must be declared in an enclosing class"):this.privateNameStack[this.privateNameStack.length-1].used.push(t)),t},S.parseYield=function(t){this.yieldPos||(this.yieldPos=this.start);var e=this.startNode();return this.next(),this.type===o.semi||this.canInsertSemicolon()||this.type!==o.star&&!this.type.startsExpr?(e.delegate=!1,e.argument=null):(e.delegate=this.eat(o.star),e.argument=this.parseMaybeAssign(t)),this.finishNode(e,"YieldExpression")},S.parseAwait=function(t){this.awaitPos||(this.awaitPos=this.start);var e=this.startNode();return this.next(),e.argument=this.parseMaybeUnary(null,!0,!1,t),this.finishNode(e,"AwaitExpression")};var Ne=R.prototype;Ne.raise=function(t,e){var s=Ct(this.input,t);e+=" ("+s.line+":"+s.column+")",this.sourceFile&&(e+=" in "+this.sourceFile);var i=new SyntaxError(e);throw i.pos=t,i.loc=s,i.raisedAt=this.pos,i},Ne.raiseRecoverable=Ne.raise,Ne.curPosition=function(){if(this.options.locations)return new we(this.curLine,this.pos-this.lineStart)};var oe=R.prototype,Si=function(t){this.flags=t,this.var=[],this.lexical=[],this.functions=[]};oe.enterScope=function(t){this.scopeStack.push(new Si(t))},oe.exitScope=function(){this.scopeStack.pop()},oe.treatFunctionsAsVarInScope=function(t){return t.flags&be||!this.inModule&&t.flags&_e},oe.declareName=function(t,e,s){var i=!1;if(e===re){var n=this.currentScope();i=n.lexical.indexOf(t)>-1||n.functions.indexOf(t)>-1||n.var.indexOf(t)>-1,n.lexical.push(t),this.inModule&&n.flags&_e&&delete this.undefinedExports[t]}else if(e===kt){this.currentScope().lexical.push(t)}else if(e===_t){var r=this.currentScope();i=this.treatFunctionsAsVar?r.lexical.indexOf(t)>-1:r.lexical.indexOf(t)>-1||r.var.indexOf(t)>-1,r.functions.push(t)}else for(var a=this.scopeStack.length-1;a>=0;--a){var o=this.scopeStack[a];if(o.lexical.indexOf(t)>-1&&!(o.flags&Et&&o.lexical[0]===t)||!this.treatFunctionsAsVarInScope(o)&&o.functions.indexOf(t)>-1){i=!0;break}if(o.var.push(t),this.inModule&&o.flags&_e&&delete this.undefinedExports[t],o.flags&Oe)break}i&&this.raiseRecoverable(s,"Identifier '"+t+"' has already been declared")},oe.checkLocalExport=function(t){-1===this.scopeStack[0].lexical.indexOf(t.name)&&-1===this.scopeStack[0].var.indexOf(t.name)&&(this.undefinedExports[t.name]=t)},oe.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},oe.currentVarScope=function(){for(var t=this.scopeStack.length-1;;t--){var e=this.scopeStack[t];if(e.flags&(Oe|ke|pe))return e}},oe.currentThisScope=function(){for(var t=this.scopeStack.length-1;;t--){var e=this.scopeStack[t];if(e.flags&(Oe|ke|pe)&&!(e.flags&Je))return e}};var De=function(t,e,s){this.type="",this.start=e,this.end=0,t.options.locations&&(this.loc=new Le(t,s)),t.options.directSourceFile&&(this.sourceFile=t.options.directSourceFile),t.options.ranges&&(this.range=[e,0])},Ae=R.prototype;function Tt(t,e,s,i){return t.type=e,t.end=s,this.options.locations&&(t.loc.end=i),this.options.ranges&&(t.range[1]=s),t}Ae.startNode=function(){return new De(this,this.start,this.startLoc)},Ae.startNodeAt=function(t,e){return new De(this,t,e)},Ae.finishNode=function(t,e){return Tt.call(this,t,e,this.lastTokEnd,this.lastTokEndLoc)},Ae.finishNodeAt=function(t,e,s,i){return Tt.call(this,t,e,s,i)},Ae.copyNode=function(t){var e=new De(this,t.start,this.startLoc);for(var s in t)e[s]=t[s];return e};var Ei="Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sunu Sunuwar Todhri Todr Tulu_Tigalari Tutg Unknown Zzzz",Nt="ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS",Rt=Nt+" Extended_Pictographic",Lt=Rt,Vt=Rt+" EBase EComp EMod EPres ExtPict",Ot=Vt,wi=Vt,_i={9:Nt,10:Rt,11:Rt,12:Vt,13:Vt,14:wi},ki="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",Ai={9:"",10:"",11:"",12:"",13:"",14:ki},ht="Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu",Mt="Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb",Dt=Mt+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",Ft=Dt+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",Bt=Ft+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",Ht=Bt+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",Pi=Ht+" "+Ei,Ii={9:Mt,10:Dt,11:Ft,12:Bt,13:Ht,14:Pi},Ut={};function Ti(t){var e=Ut[t]={binary:ne(_i[t]+" "+ht),binaryOfStrings:ne(Ai[t]),nonBinary:{General_Category:ne(ht),Script:ne(Ii[t])}};e.nonBinary.Script_Extensions=e.nonBinary.Script,e.nonBinary.gc=e.nonBinary.General_Category,e.nonBinary.sc=e.nonBinary.Script,e.nonBinary.scx=e.nonBinary.Script_Extensions}for(var qe=0,lt=[9,10,11,12,13,14];qe<lt.length;qe+=1){var Ni=lt[qe];Ti(Ni)}var v=R.prototype,Re=function(t,e){this.parent=t,this.base=e||this};Re.prototype.separatedFrom=function(t){for(var e=this;e;e=e.parent)for(var s=t;s;s=s.parent)if(e.base===s.base&&e!==s)return!0;return!1},Re.prototype.sibling=function(){return new Re(this.parent,this.base)};var Z=function(t){this.parser=t,this.validFlags="gim"+(t.options.ecmaVersion>=6?"uy":"")+(t.options.ecmaVersion>=9?"s":"")+(t.options.ecmaVersion>=13?"d":"")+(t.options.ecmaVersion>=15?"v":""),this.unicodeProperties=Ut[t.options.ecmaVersion>=14?14:t.options.ecmaVersion],this.source="",this.flags="",this.start=0,this.switchU=!1,this.switchV=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue="",this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=Object.create(null),this.backReferenceNames=[],this.branchID=null};function Ri(t){for(var e in t)return!0;return!1}function Li(t){return 105===t||109===t||115===t}function qt(t){return 36===t||t>=40&&t<=43||46===t||63===t||t>=91&&t<=94||t>=123&&t<=125}function Vi(t){return Q(t,!0)||36===t||95===t}function Oi(t){return ae(t,!0)||36===t||95===t||8204===t||8205===t}function jt(t){return t>=65&&t<=90||t>=97&&t<=122}function Mi(t){return t>=0&&t<=1114111}Z.prototype.reset=function(t,e,s){var i=-1!==s.indexOf("v"),n=-1!==s.indexOf("u");this.start=0|t,this.source=e+"",this.flags=s,i&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=n&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=n&&this.parser.options.ecmaVersion>=9)},Z.prototype.raise=function(t){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+t)},Z.prototype.at=function(t,e){void 0===e&&(e=!1);var s=this.source,i=s.length;if(t>=i)return-1;var n=s.charCodeAt(t);if(!e&&!this.switchU||n<=55295||n>=57344||t+1>=i)return n;var r=s.charCodeAt(t+1);return r>=56320&&r<=57343?(n<<10)+r-56613888:n},Z.prototype.nextIndex=function(t,e){void 0===e&&(e=!1);var s=this.source,i=s.length;if(t>=i)return i;var n,r=s.charCodeAt(t);return!e&&!this.switchU||r<=55295||r>=57344||t+1>=i||(n=s.charCodeAt(t+1))<56320||n>57343?t+1:t+2},Z.prototype.current=function(t){return void 0===t&&(t=!1),this.at(this.pos,t)},Z.prototype.lookahead=function(t){return void 0===t&&(t=!1),this.at(this.nextIndex(this.pos,t),t)},Z.prototype.advance=function(t){void 0===t&&(t=!1),this.pos=this.nextIndex(this.pos,t)},Z.prototype.eat=function(t,e){return void 0===e&&(e=!1),this.current(e)===t&&(this.advance(e),!0)},Z.prototype.eatChars=function(t,e){void 0===e&&(e=!1);for(var s=this.pos,i=0,n=t;i<n.length;i+=1){var r=n[i],a=this.at(s,e);if(-1===a||a!==r)return!1;s=this.nextIndex(s,e)}return this.pos=s,!0},v.validateRegExpFlags=function(t){for(var e=t.validFlags,s=t.flags,i=!1,n=!1,r=0;r<s.length;r++){var a=s.charAt(r);-1===e.indexOf(a)&&this.raise(t.start,"Invalid regular expression flag"),s.indexOf(a,r+1)>-1&&this.raise(t.start,"Duplicate regular expression flag"),"u"===a&&(i=!0),"v"===a&&(n=!0)}this.options.ecmaVersion>=15&&i&&n&&this.raise(t.start,"Invalid regular expression flag")},v.validateRegExpPattern=function(t){this.regexp_pattern(t),!t.switchN&&this.options.ecmaVersion>=9&&Ri(t.groupNames)&&(t.switchN=!0,this.regexp_pattern(t))},v.regexp_pattern=function(t){t.pos=0,t.lastIntValue=0,t.lastStringValue="",t.lastAssertionIsQuantifiable=!1,t.numCapturingParens=0,t.maxBackReference=0,t.groupNames=Object.create(null),t.backReferenceNames.length=0,t.branchID=null,this.regexp_disjunction(t),t.pos!==t.source.length&&(t.eat(41)&&t.raise("Unmatched ')'"),(t.eat(93)||t.eat(125))&&t.raise("Lone quantifier brackets")),t.maxBackReference>t.numCapturingParens&&t.raise("Invalid escape");for(var e=0,s=t.backReferenceNames;e<s.length;e+=1){var i=s[e];t.groupNames[i]||t.raise("Invalid named capture referenced")}},v.regexp_disjunction=function(t){var e=this.options.ecmaVersion>=16;for(e&&(t.branchID=new Re(t.branchID,null)),this.regexp_alternative(t);t.eat(124);)e&&(t.branchID=t.branchID.sibling()),this.regexp_alternative(t);e&&(t.branchID=t.branchID.parent),this.regexp_eatQuantifier(t,!0)&&t.raise("Nothing to repeat"),t.eat(123)&&t.raise("Lone quantifier brackets")},v.regexp_alternative=function(t){for(;t.pos<t.source.length&&this.regexp_eatTerm(t););},v.regexp_eatTerm=function(t){return this.regexp_eatAssertion(t)?(t.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(t)&&t.switchU&&t.raise("Invalid quantifier"),!0):!!(t.switchU?this.regexp_eatAtom(t):this.regexp_eatExtendedAtom(t))&&(this.regexp_eatQuantifier(t),!0)},v.regexp_eatAssertion=function(t){var e=t.pos;if(t.lastAssertionIsQuantifiable=!1,t.eat(94)||t.eat(36))return!0;if(t.eat(92)){if(t.eat(66)||t.eat(98))return!0;t.pos=e}if(t.eat(40)&&t.eat(63)){var s=!1;if(this.options.ecmaVersion>=9&&(s=t.eat(60)),t.eat(61)||t.eat(33))return this.regexp_disjunction(t),t.eat(41)||t.raise("Unterminated group"),t.lastAssertionIsQuantifiable=!s,!0}return t.pos=e,!1},v.regexp_eatQuantifier=function(t,e){return void 0===e&&(e=!1),!!this.regexp_eatQuantifierPrefix(t,e)&&(t.eat(63),!0)},v.regexp_eatQuantifierPrefix=function(t,e){return t.eat(42)||t.eat(43)||t.eat(63)||this.regexp_eatBracedQuantifier(t,e)},v.regexp_eatBracedQuantifier=function(t,e){var s=t.pos;if(t.eat(123)){var i=0,n=-1;if(this.regexp_eatDecimalDigits(t)&&(i=t.lastIntValue,t.eat(44)&&this.regexp_eatDecimalDigits(t)&&(n=t.lastIntValue),t.eat(125)))return-1!==n&&n<i&&!e&&t.raise("numbers out of order in {} quantifier"),!0;t.switchU&&!e&&t.raise("Incomplete quantifier"),t.pos=s}return!1},v.regexp_eatAtom=function(t){return this.regexp_eatPatternCharacters(t)||t.eat(46)||this.regexp_eatReverseSolidusAtomEscape(t)||this.regexp_eatCharacterClass(t)||this.regexp_eatUncapturingGroup(t)||this.regexp_eatCapturingGroup(t)},v.regexp_eatReverseSolidusAtomEscape=function(t){var e=t.pos;if(t.eat(92)){if(this.regexp_eatAtomEscape(t))return!0;t.pos=e}return!1},v.regexp_eatUncapturingGroup=function(t){var e=t.pos;if(t.eat(40)){if(t.eat(63)){if(this.options.ecmaVersion>=16){var s=this.regexp_eatModifiers(t),i=t.eat(45);if(s||i){for(var n=0;n<s.length;n++){var r=s.charAt(n);s.indexOf(r,n+1)>-1&&t.raise("Duplicate regular expression modifiers")}if(i){var a=this.regexp_eatModifiers(t);!s&&!a&&58===t.current()&&t.raise("Invalid regular expression modifiers");for(var o=0;o<a.length;o++){var h=a.charAt(o);(a.indexOf(h,o+1)>-1||s.indexOf(h)>-1)&&t.raise("Duplicate regular expression modifiers")}}}}if(t.eat(58)){if(this.regexp_disjunction(t),t.eat(41))return!0;t.raise("Unterminated group")}}t.pos=e}return!1},v.regexp_eatCapturingGroup=function(t){if(t.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(t):63===t.current()&&t.raise("Invalid group"),this.regexp_disjunction(t),t.eat(41))return t.numCapturingParens+=1,!0;t.raise("Unterminated group")}return!1},v.regexp_eatModifiers=function(t){for(var e="",s=0;-1!==(s=t.current())&&Li(s);)e+=ie(s),t.advance();return e},v.regexp_eatExtendedAtom=function(t){return t.eat(46)||this.regexp_eatReverseSolidusAtomEscape(t)||this.regexp_eatCharacterClass(t)||this.regexp_eatUncapturingGroup(t)||this.regexp_eatCapturingGroup(t)||this.regexp_eatInvalidBracedQuantifier(t)||this.regexp_eatExtendedPatternCharacter(t)},v.regexp_eatInvalidBracedQuantifier=function(t){return this.regexp_eatBracedQuantifier(t,!0)&&t.raise("Nothing to repeat"),!1},v.regexp_eatSyntaxCharacter=function(t){var e=t.current();return!!qt(e)&&(t.lastIntValue=e,t.advance(),!0)},v.regexp_eatPatternCharacters=function(t){for(var e=t.pos,s=0;-1!==(s=t.current())&&!qt(s);)t.advance();return t.pos!==e},v.regexp_eatExtendedPatternCharacter=function(t){var e=t.current();return!(-1===e||36===e||e>=40&&e<=43||46===e||63===e||91===e||94===e||124===e)&&(t.advance(),!0)},v.regexp_groupSpecifier=function(t){if(t.eat(63)){this.regexp_eatGroupName(t)||t.raise("Invalid group");var e=this.options.ecmaVersion>=16,s=t.groupNames[t.lastStringValue];if(s)if(e)for(var i=0,n=s;i<n.length;i+=1){n[i].separatedFrom(t.branchID)||t.raise("Duplicate capture group name")}else t.raise("Duplicate capture group name");e?(s||(t.groupNames[t.lastStringValue]=[])).push(t.branchID):t.groupNames[t.lastStringValue]=!0}},v.regexp_eatGroupName=function(t){if(t.lastStringValue="",t.eat(60)){if(this.regexp_eatRegExpIdentifierName(t)&&t.eat(62))return!0;t.raise("Invalid capture group name")}return!1},v.regexp_eatRegExpIdentifierName=function(t){if(t.lastStringValue="",this.regexp_eatRegExpIdentifierStart(t)){for(t.lastStringValue+=ie(t.lastIntValue);this.regexp_eatRegExpIdentifierPart(t);)t.lastStringValue+=ie(t.lastIntValue);return!0}return!1},v.regexp_eatRegExpIdentifierStart=function(t){var e=t.pos,s=this.options.ecmaVersion>=11,i=t.current(s);return t.advance(s),92===i&&this.regexp_eatRegExpUnicodeEscapeSequence(t,s)&&(i=t.lastIntValue),Vi(i)?(t.lastIntValue=i,!0):(t.pos=e,!1)},v.regexp_eatRegExpIdentifierPart=function(t){var e=t.pos,s=this.options.ecmaVersion>=11,i=t.current(s);return t.advance(s),92===i&&this.regexp_eatRegExpUnicodeEscapeSequence(t,s)&&(i=t.lastIntValue),Oi(i)?(t.lastIntValue=i,!0):(t.pos=e,!1)},v.regexp_eatAtomEscape=function(t){return!!(this.regexp_eatBackReference(t)||this.regexp_eatCharacterClassEscape(t)||this.regexp_eatCharacterEscape(t)||t.switchN&&this.regexp_eatKGroupName(t))||(t.switchU&&(99===t.current()&&t.raise("Invalid unicode escape"),t.raise("Invalid escape")),!1)},v.regexp_eatBackReference=function(t){var e=t.pos;if(this.regexp_eatDecimalEscape(t)){var s=t.lastIntValue;if(t.switchU)return s>t.maxBackReference&&(t.maxBackReference=s),!0;if(s<=t.numCapturingParens)return!0;t.pos=e}return!1},v.regexp_eatKGroupName=function(t){if(t.eat(107)){if(this.regexp_eatGroupName(t))return t.backReferenceNames.push(t.lastStringValue),!0;t.raise("Invalid named reference")}return!1},v.regexp_eatCharacterEscape=function(t){return this.regexp_eatControlEscape(t)||this.regexp_eatCControlLetter(t)||this.regexp_eatZero(t)||this.regexp_eatHexEscapeSequence(t)||this.regexp_eatRegExpUnicodeEscapeSequence(t,!1)||!t.switchU&&this.regexp_eatLegacyOctalEscapeSequence(t)||this.regexp_eatIdentityEscape(t)},v.regexp_eatCControlLetter=function(t){var e=t.pos;if(t.eat(99)){if(this.regexp_eatControlLetter(t))return!0;t.pos=e}return!1},v.regexp_eatZero=function(t){return 48===t.current()&&!Fe(t.lookahead())&&(t.lastIntValue=0,t.advance(),!0)},v.regexp_eatControlEscape=function(t){var e=t.current();return 116===e?(t.lastIntValue=9,t.advance(),!0):110===e?(t.lastIntValue=10,t.advance(),!0):118===e?(t.lastIntValue=11,t.advance(),!0):102===e?(t.lastIntValue=12,t.advance(),!0):114===e&&(t.lastIntValue=13,t.advance(),!0)},v.regexp_eatControlLetter=function(t){var e=t.current();return!!jt(e)&&(t.lastIntValue=e%32,t.advance(),!0)},v.regexp_eatRegExpUnicodeEscapeSequence=function(t,e){void 0===e&&(e=!1);var s=t.pos,i=e||t.switchU;if(t.eat(117)){if(this.regexp_eatFixedHexDigits(t,4)){var n=t.lastIntValue;if(i&&n>=55296&&n<=56319){var r=t.pos;if(t.eat(92)&&t.eat(117)&&this.regexp_eatFixedHexDigits(t,4)){var a=t.lastIntValue;if(a>=56320&&a<=57343)return t.lastIntValue=1024*(n-55296)+(a-56320)+65536,!0}t.pos=r,t.lastIntValue=n}return!0}if(i&&t.eat(123)&&this.regexp_eatHexDigits(t)&&t.eat(125)&&Mi(t.lastIntValue))return!0;i&&t.raise("Invalid unicode escape"),t.pos=s}return!1},v.regexp_eatIdentityEscape=function(t){if(t.switchU)return!!this.regexp_eatSyntaxCharacter(t)||!!t.eat(47)&&(t.lastIntValue=47,!0);var e=t.current();return!(99===e||t.switchN&&107===e)&&(t.lastIntValue=e,t.advance(),!0)},v.regexp_eatDecimalEscape=function(t){t.lastIntValue=0;var e=t.current();if(e>=49&&e<=57){do{t.lastIntValue=10*t.lastIntValue+(e-48),t.advance()}while((e=t.current())>=48&&e<=57);return!0}return!1};var Wt=0,se=1,K=2;function Di(t){return 100===t||68===t||115===t||83===t||119===t||87===t}function Kt(t){return jt(t)||95===t}function Fi(t){return Kt(t)||Fe(t)}function Bi(t){return 33===t||t>=35&&t<=38||t>=42&&t<=44||46===t||t>=58&&t<=64||94===t||96===t||126===t}function Hi(t){return 40===t||41===t||45===t||47===t||t>=91&&t<=93||t>=123&&t<=125}function Ui(t){return 33===t||35===t||37===t||38===t||44===t||45===t||t>=58&&t<=62||64===t||96===t||126===t}function Fe(t){return t>=48&&t<=57}function $t(t){return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}function zt(t){return t>=65&&t<=70?t-65+10:t>=97&&t<=102?t-97+10:t-48}function Gt(t){return t>=48&&t<=55}v.regexp_eatCharacterClassEscape=function(t){var e=t.current();if(Di(e))return t.lastIntValue=-1,t.advance(),se;var s=!1;if(t.switchU&&this.options.ecmaVersion>=9&&((s=80===e)||112===e)){var i;if(t.lastIntValue=-1,t.advance(),t.eat(123)&&(i=this.regexp_eatUnicodePropertyValueExpression(t))&&t.eat(125))return s&&i===K&&t.raise("Invalid property name"),i;t.raise("Invalid property name")}return Wt},v.regexp_eatUnicodePropertyValueExpression=function(t){var e=t.pos;if(this.regexp_eatUnicodePropertyName(t)&&t.eat(61)){var s=t.lastStringValue;if(this.regexp_eatUnicodePropertyValue(t)){var i=t.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(t,s,i),se}}if(t.pos=e,this.regexp_eatLoneUnicodePropertyNameOrValue(t)){var n=t.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(t,n)}return Wt},v.regexp_validateUnicodePropertyNameAndValue=function(t,e,s){ve(t.unicodeProperties.nonBinary,e)||t.raise("Invalid property name"),t.unicodeProperties.nonBinary[e].test(s)||t.raise("Invalid property value")},v.regexp_validateUnicodePropertyNameOrValue=function(t,e){return t.unicodeProperties.binary.test(e)?se:t.switchV&&t.unicodeProperties.binaryOfStrings.test(e)?K:void t.raise("Invalid property name")},v.regexp_eatUnicodePropertyName=function(t){var e=0;for(t.lastStringValue="";Kt(e=t.current());)t.lastStringValue+=ie(e),t.advance();return""!==t.lastStringValue},v.regexp_eatUnicodePropertyValue=function(t){var e=0;for(t.lastStringValue="";Fi(e=t.current());)t.lastStringValue+=ie(e),t.advance();return""!==t.lastStringValue},v.regexp_eatLoneUnicodePropertyNameOrValue=function(t){return this.regexp_eatUnicodePropertyValue(t)},v.regexp_eatCharacterClass=function(t){if(t.eat(91)){var e=t.eat(94),s=this.regexp_classContents(t);return t.eat(93)||t.raise("Unterminated character class"),e&&s===K&&t.raise("Negated character class may contain strings"),!0}return!1},v.regexp_classContents=function(t){return 93===t.current()?se:t.switchV?this.regexp_classSetExpression(t):(this.regexp_nonEmptyClassRanges(t),se)},v.regexp_nonEmptyClassRanges=function(t){for(;this.regexp_eatClassAtom(t);){var e=t.lastIntValue;if(t.eat(45)&&this.regexp_eatClassAtom(t)){var s=t.lastIntValue;t.switchU&&(-1===e||-1===s)&&t.raise("Invalid character class"),-1!==e&&-1!==s&&e>s&&t.raise("Range out of order in character class")}}},v.regexp_eatClassAtom=function(t){var e=t.pos;if(t.eat(92)){if(this.regexp_eatClassEscape(t))return!0;if(t.switchU){var s=t.current();(99===s||Gt(s))&&t.raise("Invalid class escape"),t.raise("Invalid escape")}t.pos=e}var i=t.current();return 93!==i&&(t.lastIntValue=i,t.advance(),!0)},v.regexp_eatClassEscape=function(t){var e=t.pos;if(t.eat(98))return t.lastIntValue=8,!0;if(t.switchU&&t.eat(45))return t.lastIntValue=45,!0;if(!t.switchU&&t.eat(99)){if(this.regexp_eatClassControlLetter(t))return!0;t.pos=e}return this.regexp_eatCharacterClassEscape(t)||this.regexp_eatCharacterEscape(t)},v.regexp_classSetExpression=function(t){var e,s=se;if(!this.regexp_eatClassSetRange(t))if(e=this.regexp_eatClassSetOperand(t)){e===K&&(s=K);for(var i=t.pos;t.eatChars([38,38]);)38!==t.current()&&(e=this.regexp_eatClassSetOperand(t))?e!==K&&(s=se):t.raise("Invalid character in character class");if(i!==t.pos)return s;for(;t.eatChars([45,45]);)this.regexp_eatClassSetOperand(t)||t.raise("Invalid character in character class");if(i!==t.pos)return s}else t.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(t)){if(!(e=this.regexp_eatClassSetOperand(t)))return s;e===K&&(s=K)}},v.regexp_eatClassSetRange=function(t){var e=t.pos;if(this.regexp_eatClassSetCharacter(t)){var s=t.lastIntValue;if(t.eat(45)&&this.regexp_eatClassSetCharacter(t)){var i=t.lastIntValue;return-1!==s&&-1!==i&&s>i&&t.raise("Range out of order in character class"),!0}t.pos=e}return!1},v.regexp_eatClassSetOperand=function(t){return this.regexp_eatClassSetCharacter(t)?se:this.regexp_eatClassStringDisjunction(t)||this.regexp_eatNestedClass(t)},v.regexp_eatNestedClass=function(t){var e=t.pos;if(t.eat(91)){var s=t.eat(94),i=this.regexp_classContents(t);if(t.eat(93))return s&&i===K&&t.raise("Negated character class may contain strings"),i;t.pos=e}if(t.eat(92)){var n=this.regexp_eatCharacterClassEscape(t);if(n)return n;t.pos=e}return null},v.regexp_eatClassStringDisjunction=function(t){var e=t.pos;if(t.eatChars([92,113])){if(t.eat(123)){var s=this.regexp_classStringDisjunctionContents(t);if(t.eat(125))return s}else t.raise("Invalid escape");t.pos=e}return null},v.regexp_classStringDisjunctionContents=function(t){for(var e=this.regexp_classString(t);t.eat(124);)this.regexp_classString(t)===K&&(e=K);return e},v.regexp_classString=function(t){for(var e=0;this.regexp_eatClassSetCharacter(t);)e++;return 1===e?se:K},v.regexp_eatClassSetCharacter=function(t){var e=t.pos;if(t.eat(92))return!(!this.regexp_eatCharacterEscape(t)&&!this.regexp_eatClassSetReservedPunctuator(t))||(t.eat(98)?(t.lastIntValue=8,!0):(t.pos=e,!1));var s=t.current();return!(s<0||s===t.lookahead()&&Bi(s)||Hi(s))&&(t.advance(),t.lastIntValue=s,!0)},v.regexp_eatClassSetReservedPunctuator=function(t){var e=t.current();return!!Ui(e)&&(t.lastIntValue=e,t.advance(),!0)},v.regexp_eatClassControlLetter=function(t){var e=t.current();return!(!Fe(e)&&95!==e)&&(t.lastIntValue=e%32,t.advance(),!0)},v.regexp_eatHexEscapeSequence=function(t){var e=t.pos;if(t.eat(120)){if(this.regexp_eatFixedHexDigits(t,2))return!0;t.switchU&&t.raise("Invalid escape"),t.pos=e}return!1},v.regexp_eatDecimalDigits=function(t){var e=t.pos,s=0;for(t.lastIntValue=0;Fe(s=t.current());)t.lastIntValue=10*t.lastIntValue+(s-48),t.advance();return t.pos!==e},v.regexp_eatHexDigits=function(t){var e=t.pos,s=0;for(t.lastIntValue=0;$t(s=t.current());)t.lastIntValue=16*t.lastIntValue+zt(s),t.advance();return t.pos!==e},v.regexp_eatLegacyOctalEscapeSequence=function(t){if(this.regexp_eatOctalDigit(t)){var e=t.lastIntValue;if(this.regexp_eatOctalDigit(t)){var s=t.lastIntValue;e<=3&&this.regexp_eatOctalDigit(t)?t.lastIntValue=64*e+8*s+t.lastIntValue:t.lastIntValue=8*e+s}else t.lastIntValue=e;return!0}return!1},v.regexp_eatOctalDigit=function(t){var e=t.current();return Gt(e)?(t.lastIntValue=e-48,t.advance(),!0):(t.lastIntValue=0,!1)},v.regexp_eatFixedHexDigits=function(t,e){var s=t.pos;t.lastIntValue=0;for(var i=0;i<e;++i){var n=t.current();if(!$t(n))return t.pos=s,!1;t.lastIntValue=16*t.lastIntValue+zt(n),t.advance()}return!0};var st=function(t){this.type=t.type,this.value=t.value,this.start=t.start,this.end=t.end,t.options.locations&&(this.loc=new Le(t,t.startLoc,t.endLoc)),t.options.ranges&&(this.range=[t.start,t.end])},w=R.prototype;function qi(t,e){return e?parseInt(t,8):parseFloat(t.replace(/_/g,""))}function Xt(t){return"function"!=typeof BigInt?null:BigInt(t.replace(/_/g,""))}w.next=function(t){!t&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword),this.options.onToken&&this.options.onToken(new st(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},w.getToken=function(){return this.next(),new st(this)},typeof Symbol<"u"&&(w[Symbol.iterator]=function(){var t=this;return{next:function(){var e=t.getToken();return{done:e.type===o.eof,value:e}}}}),w.nextToken=function(){var t=this.curContext();return(!t||!t.preserveSpace)&&this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length?this.finishToken(o.eof):t.override?t.override(this):void this.readToken(this.fullCharCodeAtPos())},w.readToken=function(t){return Q(t,this.options.ecmaVersion>=6)||92===t?this.readWord():this.getTokenFromCode(t)},w.fullCharCodeAtPos=function(){var t=this.input.charCodeAt(this.pos);if(t<=55295||t>=56320)return t;var e=this.input.charCodeAt(this.pos+1);return e<=56319||e>=57344?t:(t<<10)+e-56613888},w.skipBlockComment=function(){var t=this.options.onComment&&this.curPosition(),e=this.pos,s=this.input.indexOf("*/",this.pos+=2);if(-1===s&&this.raise(this.pos-2,"Unterminated comment"),this.pos=s+2,this.options.locations)for(var i=void 0,n=e;(i=vt(this.input,n,this.pos))>-1;)++this.curLine,n=this.lineStart=i;this.options.onComment&&this.options.onComment(!0,this.input.slice(e+2,s),e,this.pos,t,this.curPosition())},w.skipLineComment=function(t){for(var e=this.pos,s=this.options.onComment&&this.curPosition(),i=this.input.charCodeAt(this.pos+=t);this.pos<this.input.length&&!ge(i);)i=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(e+t,this.pos),e,this.pos,s,this.curPosition())},w.skipSpace=function(){t:for(;this.pos<this.input.length;){var t=this.input.charCodeAt(this.pos);switch(t){case 32:case 160:++this.pos;break;case 13:10===this.input.charCodeAt(this.pos+1)&&++this.pos;case 10:case 8232:case 8233:++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos);break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break t}break;default:if(!(t>8&&t<14||t>=5760&&bt.test(String.fromCharCode(t))))break t;++this.pos}}},w.finishToken=function(t,e){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var s=this.type;this.type=t,this.value=e,this.updateContext(s)},w.readToken_dot=function(){var t=this.input.charCodeAt(this.pos+1);if(t>=48&&t<=57)return this.readNumber(!0);var e=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&46===t&&46===e?(this.pos+=3,this.finishToken(o.ellipsis)):(++this.pos,this.finishToken(o.dot))},w.readToken_slash=function(){var t=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):61===t?this.finishOp(o.assign,2):this.finishOp(o.slash,1)},w.readToken_mult_modulo_exp=function(t){var e=this.input.charCodeAt(this.pos+1),s=1,i=42===t?o.star:o.modulo;return this.options.ecmaVersion>=7&&42===t&&42===e&&(++s,i=o.starstar,e=this.input.charCodeAt(this.pos+2)),61===e?this.finishOp(o.assign,s+1):this.finishOp(i,s)},w.readToken_pipe_amp=function(t){var e=this.input.charCodeAt(this.pos+1);if(e===t){if(this.options.ecmaVersion>=12)if(61===this.input.charCodeAt(this.pos+2))return this.finishOp(o.assign,3);return this.finishOp(124===t?o.logicalOR:o.logicalAND,2)}return 61===e?this.finishOp(o.assign,2):this.finishOp(124===t?o.bitwiseOR:o.bitwiseAND,1)},w.readToken_caret=function(){return 61===this.input.charCodeAt(this.pos+1)?this.finishOp(o.assign,2):this.finishOp(o.bitwiseXOR,1)},w.readToken_plus_min=function(t){var e=this.input.charCodeAt(this.pos+1);return e===t?45!==e||this.inModule||62!==this.input.charCodeAt(this.pos+2)||0!==this.lastTokEnd&&!U.test(this.input.slice(this.lastTokEnd,this.pos))?this.finishOp(o.incDec,2):(this.skipLineComment(3),this.skipSpace(),this.nextToken()):61===e?this.finishOp(o.assign,2):this.finishOp(o.plusMin,1)},w.readToken_lt_gt=function(t){var e=this.input.charCodeAt(this.pos+1),s=1;return e===t?(s=62===t&&62===this.input.charCodeAt(this.pos+2)?3:2,61===this.input.charCodeAt(this.pos+s)?this.finishOp(o.assign,s+1):this.finishOp(o.bitShift,s)):33!==e||60!==t||this.inModule||45!==this.input.charCodeAt(this.pos+2)||45!==this.input.charCodeAt(this.pos+3)?(61===e&&(s=2),this.finishOp(o.relational,s)):(this.skipLineComment(4),this.skipSpace(),this.nextToken())},w.readToken_eq_excl=function(t){var e=this.input.charCodeAt(this.pos+1);return 61===e?this.finishOp(o.equality,61===this.input.charCodeAt(this.pos+2)?3:2):61===t&&62===e&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(o.arrow)):this.finishOp(61===t?o.eq:o.prefix,1)},w.readToken_question=function(){var t=this.options.ecmaVersion;if(t>=11){var e=this.input.charCodeAt(this.pos+1);if(46===e){var s=this.input.charCodeAt(this.pos+2);if(s<48||s>57)return this.finishOp(o.questionDot,2)}if(63===e){if(t>=12)if(61===this.input.charCodeAt(this.pos+2))return this.finishOp(o.assign,3);return this.finishOp(o.coalesce,2)}}return this.finishOp(o.question,1)},w.readToken_numberSign=function(){var t=35;if(this.options.ecmaVersion>=13&&(++this.pos,Q(t=this.fullCharCodeAtPos(),!0)||92===t))return this.finishToken(o.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+ie(t)+"'")},w.getTokenFromCode=function(t){switch(t){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(o.parenL);case 41:return++this.pos,this.finishToken(o.parenR);case 59:return++this.pos,this.finishToken(o.semi);case 44:return++this.pos,this.finishToken(o.comma);case 91:return++this.pos,this.finishToken(o.bracketL);case 93:return++this.pos,this.finishToken(o.bracketR);case 123:return++this.pos,this.finishToken(o.braceL);case 125:return++this.pos,this.finishToken(o.braceR);case 58:return++this.pos,this.finishToken(o.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(o.backQuote);case 48:var e=this.input.charCodeAt(this.pos+1);if(120===e||88===e)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(111===e||79===e)return this.readRadixNumber(8);if(98===e||66===e)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(t);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(t);case 124:case 38:return this.readToken_pipe_amp(t);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(t);case 60:case 62:return this.readToken_lt_gt(t);case 61:case 33:return this.readToken_eq_excl(t);case 63:return this.readToken_question();case 126:return this.finishOp(o.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+ie(t)+"'")},w.finishOp=function(t,e){var s=this.input.slice(this.pos,this.pos+e);return this.pos+=e,this.finishToken(t,s)},w.readRegexp=function(){for(var t,e,s=this.pos;;){this.pos>=this.input.length&&this.raise(s,"Unterminated regular expression");var i=this.input.charAt(this.pos);if(U.test(i)&&this.raise(s,"Unterminated regular expression"),t)t=!1;else{if("["===i)e=!0;else if("]"===i&&e)e=!1;else if("/"===i&&!e)break;t="\\"===i}++this.pos}var n=this.input.slice(s,this.pos);++this.pos;var r=this.pos,a=this.readWord1();this.containsEsc&&this.unexpected(r);var h=this.regexpState||(this.regexpState=new Z(this));h.reset(s,n,a),this.validateRegExpFlags(h),this.validateRegExpPattern(h);var c=null;try{c=new RegExp(n,a)}catch{}return this.finishToken(o.regexp,{pattern:n,flags:a,value:c})},w.readInt=function(t,e,s){for(var i=this.options.ecmaVersion>=12&&void 0===e,n=s&&48===this.input.charCodeAt(this.pos),r=this.pos,a=0,o=0,h=0,c=e??1/0;h<c;++h,++this.pos){var l=this.input.charCodeAt(this.pos),p=void 0;if(i&&95===l)n&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals"),95===o&&this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore"),0===h&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits"),o=l;else{if((p=l>=97?l-97+10:l>=65?l-65+10:l>=48&&l<=57?l-48:1/0)>=t)break;o=l,a=a*t+p}}return i&&95===o&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===r||null!=e&&this.pos-r!==e?null:a},w.readRadixNumber=function(t){var e=this.pos;this.pos+=2;var s=this.readInt(t);return null==s&&this.raise(this.start+2,"Expected number in radix "+t),this.options.ecmaVersion>=11&&110===this.input.charCodeAt(this.pos)?(s=Xt(this.input.slice(e,this.pos)),++this.pos):Q(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(o.num,s)},w.readNumber=function(t){var e=this.pos;!t&&null===this.readInt(10,void 0,!0)&&this.raise(e,"Invalid number");var s=this.pos-e>=2&&48===this.input.charCodeAt(e);s&&this.strict&&this.raise(e,"Invalid number");var i=this.input.charCodeAt(this.pos);if(!s&&!t&&this.options.ecmaVersion>=11&&110===i){var n=Xt(this.input.slice(e,this.pos));return++this.pos,Q(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(o.num,n)}s&&/[89]/.test(this.input.slice(e,this.pos))&&(s=!1),46===i&&!s&&(++this.pos,this.readInt(10),i=this.input.charCodeAt(this.pos)),(69===i||101===i)&&!s&&((43===(i=this.input.charCodeAt(++this.pos))||45===i)&&++this.pos,null===this.readInt(10)&&this.raise(e,"Invalid number")),Q(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var r=qi(this.input.slice(e,this.pos),s);return this.finishToken(o.num,r)},w.readCodePoint=function(){var t;if(123===this.input.charCodeAt(this.pos)){this.options.ecmaVersion<6&&this.unexpected();var e=++this.pos;t=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,t>1114111&&this.invalidStringToken(e,"Code point out of bounds")}else t=this.readHexChar(4);return t},w.readString=function(t){for(var e="",s=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var i=this.input.charCodeAt(this.pos);if(i===t)break;92===i?(e+=this.input.slice(s,this.pos),e+=this.readEscapedChar(!1),s=this.pos):8232===i||8233===i?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(ge(i)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return e+=this.input.slice(s,this.pos++),this.finishToken(o.string,e)};var Qt={};w.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(t){if(t!==Qt)throw t;this.readInvalidTemplateToken()}this.inTemplateElement=!1},w.invalidStringToken=function(t,e){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw Qt;this.raise(t,e)},w.readTmplToken=function(){for(var t="",e=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var s=this.input.charCodeAt(this.pos);if(96===s||36===s&&123===this.input.charCodeAt(this.pos+1))return this.pos!==this.start||this.type!==o.template&&this.type!==o.invalidTemplate?(t+=this.input.slice(e,this.pos),this.finishToken(o.template,t)):36===s?(this.pos+=2,this.finishToken(o.dollarBraceL)):(++this.pos,this.finishToken(o.backQuote));if(92===s)t+=this.input.slice(e,this.pos),t+=this.readEscapedChar(!0),e=this.pos;else if(ge(s)){switch(t+=this.input.slice(e,this.pos),++this.pos,s){case 13:10===this.input.charCodeAt(this.pos)&&++this.pos;case 10:t+="\n";break;default:t+=String.fromCharCode(s)}this.options.locations&&(++this.curLine,this.lineStart=this.pos),e=this.pos}else++this.pos}},w.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case"\\":++this.pos;break;case"$":if("{"!==this.input[this.pos+1])break;case"`":return this.finishToken(o.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":"\n"===this.input[this.pos+1]&&++this.pos;case"\n":case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1}this.raise(this.start,"Unterminated template")},w.readEscapedChar=function(t){var e=this.input.charCodeAt(++this.pos);switch(++this.pos,e){case 110:return"\n";case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return ie(this.readCodePoint());case 116:return"\t";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:10===this.input.charCodeAt(this.pos)&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,"Invalid escape sequence"),t){var s=this.pos-1;this.invalidStringToken(s,"Invalid escape sequence in template string")}default:if(e>=48&&e<=55){var i=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],n=parseInt(i,8);return n>255&&(i=i.slice(0,-1),n=parseInt(i,8)),this.pos+=i.length-1,e=this.input.charCodeAt(this.pos),("0"!==i||56===e||57===e)&&(this.strict||t)&&this.invalidStringToken(this.pos-1-i.length,t?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(n)}return ge(e)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(e)}},w.readHexChar=function(t){var e=this.pos,s=this.readInt(16,t);return null===s&&this.invalidStringToken(e,"Bad character escape sequence"),s},w.readWord1=function(){this.containsEsc=!1;for(var t="",e=!0,s=this.pos,i=this.options.ecmaVersion>=6;this.pos<this.input.length;){var n=this.fullCharCodeAtPos();if(ae(n,i))this.pos+=n<=65535?1:2;else{if(92!==n)break;this.containsEsc=!0,t+=this.input.slice(s,this.pos);var r=this.pos;117!==this.input.charCodeAt(++this.pos)&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var a=this.readCodePoint();(e?Q:ae)(a,i)||this.invalidStringToken(r,"Invalid Unicode escape"),t+=ie(a),s=this.pos}e=!1}return t+this.input.slice(s,this.pos)},w.readWord=function(){var t=this.readWord1(),e=o.name;return this.keywords.test(t)&&(e=Ye[t]),this.finishToken(e,t)};var ji="8.15.0";function je(t,e){return R.parse(t,e)}function Wi(t,e,s){return R.parseExpressionAt(t,e,s)}function We(t,e,s,i,n){var r=[];s||(s=m),function t(i,n,a){var o=a||i.type,h=i!==r[r.length-1];h&&r.push(i),s[o](i,n,t),e[o]&&e[o](i,n||r,r),h&&r.pop()}(t,i,n)}function rt(t,e,s){s(t,e)}function fe(t,e,s){}R.acorn={Parser:R,version:ji,defaultOptions:$e,Position:we,SourceLocation:Le,getLineInfo:Ct,Node:De,TokenType:A,tokTypes:o,keywordTypes:Ye,TokContext:G,tokContexts:T,isIdentifierChar:ae,isIdentifierStart:Q,Token:st,isNewLine:ge,lineBreak:U,lineBreakG:li,nonASCIIwhitespace:bt};var m={};m.Program=m.BlockStatement=m.StaticBlock=function(t,e,s){for(var i=0,n=t.body;i<n.length;i+=1){s(n[i],e,"Statement")}},m.Statement=rt,m.EmptyStatement=fe,m.ExpressionStatement=m.ParenthesizedExpression=m.ChainExpression=function(t,e,s){return s(t.expression,e,"Expression")},m.IfStatement=function(t,e,s){s(t.test,e,"Expression"),s(t.consequent,e,"Statement"),t.alternate&&s(t.alternate,e,"Statement")},m.LabeledStatement=function(t,e,s){return s(t.body,e,"Statement")},m.BreakStatement=m.ContinueStatement=fe,m.WithStatement=function(t,e,s){s(t.object,e,"Expression"),s(t.body,e,"Statement")},m.SwitchStatement=function(t,e,s){s(t.discriminant,e,"Expression");for(var i=0,n=t.cases;i<n.length;i+=1){s(n[i],e)}},m.SwitchCase=function(t,e,s){t.test&&s(t.test,e,"Expression");for(var i=0,n=t.consequent;i<n.length;i+=1){s(n[i],e,"Statement")}},m.ReturnStatement=m.YieldExpression=m.AwaitExpression=function(t,e,s){t.argument&&s(t.argument,e,"Expression")},m.ThrowStatement=m.SpreadElement=function(t,e,s){return s(t.argument,e,"Expression")},m.TryStatement=function(t,e,s){s(t.block,e,"Statement"),t.handler&&s(t.handler,e),t.finalizer&&s(t.finalizer,e,"Statement")},m.CatchClause=function(t,e,s){t.param&&s(t.param,e,"Pattern"),s(t.body,e,"Statement")},m.WhileStatement=m.DoWhileStatement=function(t,e,s){s(t.test,e,"Expression"),s(t.body,e,"Statement")},m.ForStatement=function(t,e,s){t.init&&s(t.init,e,"ForInit"),t.test&&s(t.test,e,"Expression"),t.update&&s(t.update,e,"Expression"),s(t.body,e,"Statement")},m.ForInStatement=m.ForOfStatement=function(t,e,s){s(t.left,e,"ForInit"),s(t.right,e,"Expression"),s(t.body,e,"Statement")},m.ForInit=function(t,e,s){"VariableDeclaration"===t.type?s(t,e):s(t,e,"Expression")},m.DebuggerStatement=fe,m.FunctionDeclaration=function(t,e,s){return s(t,e,"Function")},m.VariableDeclaration=function(t,e,s){for(var i=0,n=t.declarations;i<n.length;i+=1){s(n[i],e)}},m.VariableDeclarator=function(t,e,s){s(t.id,e,"Pattern"),t.init&&s(t.init,e,"Expression")},m.Function=function(t,e,s){t.id&&s(t.id,e,"Pattern");for(var i=0,n=t.params;i<n.length;i+=1){s(n[i],e,"Pattern")}s(t.body,e,t.expression?"Expression":"Statement")},m.Pattern=function(t,e,s){"Identifier"===t.type?s(t,e,"VariablePattern"):"MemberExpression"===t.type?s(t,e,"MemberPattern"):s(t,e)},m.VariablePattern=fe,m.MemberPattern=rt,m.RestElement=function(t,e,s){return s(t.argument,e,"Pattern")},m.ArrayPattern=function(t,e,s){for(var i=0,n=t.elements;i<n.length;i+=1){var r=n[i];r&&s(r,e,"Pattern")}},m.ObjectPattern=function(t,e,s){for(var i=0,n=t.properties;i<n.length;i+=1){var r=n[i];"Property"===r.type?(r.computed&&s(r.key,e,"Expression"),s(r.value,e,"Pattern")):"RestElement"===r.type&&s(r.argument,e,"Pattern")}},m.Expression=rt,m.ThisExpression=m.Super=m.MetaProperty=fe,m.ArrayExpression=function(t,e,s){for(var i=0,n=t.elements;i<n.length;i+=1){var r=n[i];r&&s(r,e,"Expression")}},m.ObjectExpression=function(t,e,s){for(var i=0,n=t.properties;i<n.length;i+=1){s(n[i],e)}},m.FunctionExpression=m.ArrowFunctionExpression=m.FunctionDeclaration,m.SequenceExpression=function(t,e,s){for(var i=0,n=t.expressions;i<n.length;i+=1){s(n[i],e,"Expression")}},m.TemplateLiteral=function(t,e,s){for(var i=0,n=t.quasis;i<n.length;i+=1){s(n[i],e)}for(var r=0,a=t.expressions;r<a.length;r+=1){s(a[r],e,"Expression")}},m.TemplateElement=fe,m.UnaryExpression=m.UpdateExpression=function(t,e,s){s(t.argument,e,"Expression")},m.BinaryExpression=m.LogicalExpression=function(t,e,s){s(t.left,e,"Expression"),s(t.right,e,"Expression")},m.AssignmentExpression=m.AssignmentPattern=function(t,e,s){s(t.left,e,"Pattern"),s(t.right,e,"Expression")},m.ConditionalExpression=function(t,e,s){s(t.test,e,"Expression"),s(t.consequent,e,"Expression"),s(t.alternate,e,"Expression")},m.NewExpression=m.CallExpression=function(t,e,s){if(s(t.callee,e,"Expression"),t.arguments)for(var i=0,n=t.arguments;i<n.length;i+=1){s(n[i],e,"Expression")}},m.MemberExpression=function(t,e,s){s(t.object,e,"Expression"),t.computed&&s(t.property,e,"Expression")},m.ExportNamedDeclaration=m.ExportDefaultDeclaration=function(t,e,s){t.declaration&&s(t.declaration,e,"ExportNamedDeclaration"===t.type||t.declaration.id?"Statement":"Expression"),t.source&&s(t.source,e,"Expression")},m.ExportAllDeclaration=function(t,e,s){t.exported&&s(t.exported,e),s(t.source,e,"Expression")},m.ImportDeclaration=function(t,e,s){for(var i=0,n=t.specifiers;i<n.length;i+=1){s(n[i],e)}s(t.source,e,"Expression")},m.ImportExpression=function(t,e,s){s(t.source,e,"Expression")},m.ImportSpecifier=m.ImportDefaultSpecifier=m.ImportNamespaceSpecifier=m.Identifier=m.PrivateIdentifier=m.Literal=fe,m.TaggedTemplateExpression=function(t,e,s){s(t.tag,e,"Expression"),s(t.quasi,e,"Expression")},m.ClassDeclaration=m.ClassExpression=function(t,e,s){return s(t,e,"Class")},m.Class=function(t,e,s){t.id&&s(t.id,e,"Pattern"),t.superClass&&s(t.superClass,e,"Expression"),s(t.body,e)},m.ClassBody=function(t,e,s){for(var i=0,n=t.body;i<n.length;i+=1){s(n[i],e)}},m.MethodDefinition=m.PropertyDefinition=m.Property=function(t,e,s){t.computed&&s(t.key,e,"Expression"),t.value&&s(t.value,e,"Expression")};class q{static pruneCache(t){t.size>this.MAX_CACHE_SIZE&&Array.from(t.keys()).slice(0,t.size-this.MAX_CACHE_SIZE/2).forEach(e=>t.delete(e))}static clearCaches(){this.expressionCache.clear(),this.variableCache.clear(),this.bindingsCache.clear(),this.loopVariableCache.clear()}static extractStateBindings(t){if(this.bindingsCache.has(t))return[...this.bindingsCache.get(t)];const e=new Set;try{We(je(t,{ecmaVersion:2020}),{FunctionDeclaration(t,s){s.length<=2&&t.id&&t.id.name&&e.add(t.id.name)},VariableDeclaration(t,s){s.length>2||t.declarations.forEach(t=>{var s,i,n,r,a;"CallExpression"!==(null==(s=t.init)?void 0:s.type)||"pp"!==(null==(n=null==(i=t.init.callee)?void 0:i.object)?void 0:n.name)||"state"!==(null==(a=null==(r=t.init.callee)?void 0:r.property)?void 0:a.name)?("Identifier"===t.id.type&&e.add(t.id.name),"ObjectPattern"===t.id.type&&t.id.properties.forEach(t=>{var s,i;"Property"===t.type&&"Identifier"===(null==(s=t.value)?void 0:s.type)&&e.add(t.value.name),"RestElement"===t.type&&"Identifier"===(null==(i=t.argument)?void 0:i.type)&&e.add(t.argument.name)})):"ArrayPattern"===t.id.type&&t.id.elements.forEach(t=>{"Identifier"===(null==t?void 0:t.type)&&e.add(t.name)})})}})}catch(t){console.error("[PP-ERROR] AstParser Failed",t)}const s=Array.from(e);return this.pruneCache(this.bindingsCache),this.bindingsCache.set(t,s),s}static extractUsedVariables(t,e){const s=t+"|"+Array.from(e).sort().join(",");if(this.variableCache.has(s))return new Set(this.variableCache.get(s));const i=new Set;try{We(je(`(${t})`,{ecmaVersion:2020}),{Identifier(t,s){if(!e.has(t.name)){if(s.length>1){const e=s[s.length-2];if("MemberExpression"===e.type&&e.property===t&&!e.computed||"Property"===e.type&&e.key===t&&!e.computed&&!e.shorthand)return}i.add(t.name)}}})}catch{}return this.pruneCache(this.variableCache),this.variableCache.set(s,i),new Set(i)}static isValidExpression(t){if(!t.trim())return!1;if(this.expressionCache.has(t))return this.expressionCache.get(t);let e=!1;try{Wi(`(${t})`,0,{ecmaVersion:2020}),e=!0}catch{e=!1}return this.pruneCache(this.expressionCache),this.expressionCache.set(t,e),e}static analyzeLoopVariableUsage(t,e){const s=t+"|"+e;if(this.loopVariableCache.has(s))return[...this.loopVariableCache.get(s)];const i=[];try{We(je(t,{ecmaVersion:2020}),{Identifier(t,s){if(t.name!==e)return;let n=!1,r=!1,a=t.start,o=t.end;if(s.length>=2){const e=s[s.length-2];if("MemberExpression"===e.type&&e.property===t&&!e.computed||"Property"===e.type&&e.key===t&&!e.computed&&!e.shorthand)return;if("Property"===e.type&&e.shorthand&&(n=!0,s.length>=3)){const t=s[s.length-3];"ObjectExpression"===t.type&&1===t.properties.length&&(r=!0,a=t.start,o=t.end)}}i.push({start:a,end:o,isShorthand:n,isUnwrap:r})}})}catch{}return this.pruneCache(this.loopVariableCache),this.loopVariableCache.set(s,i),[...i]}}x(q,"expressionCache",new Map),x(q,"variableCache",new Map),x(q,"bindingsCache",new Map),x(q,"loopVariableCache",new Map),x(q,"MAX_CACHE_SIZE",1e3);const pt=new Set(["class","for","while","if","else","return","function","var","let","const","import","export","this","debugger","delete","typeof","void","new","in","instanceof","do","try","catch","finally","switch","case","default","break","continue","yield","await","with","super","enum","extends","implements","interface","package","private","protected","public","static"]),Ki=new Set(["Array","Object","String","Number","Boolean","Math","JSON","Date","RegExp","Error","Map","Set","WeakMap","WeakSet","Promise","Symbol","BigInt","parseInt","parseFloat","isNaN","isFinite","encodeURI","decodeURI","encodeURIComponent","decodeURIComponent","console","window","document","undefined","null","NaN","Infinity","pp","true","false","setTimeout","setInterval","clearTimeout","clearInterval","requestAnimationFrame","cancelAnimationFrame","fetch","alert","confirm","prompt"]),Yt=new Set(["hidden","disabled","checked","selected","readonly","required","open","autofocus","multiple","ismap","noValidate","defer","async","autoplay","controls","loop","muted","default","reversed","scoped","seamless","sortable","translate","draggable","contenteditable","spellcheck"]);class xe{static escapeTemplateLiteralText(t){return t.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${")}static escapeTemplateLiteralTextPreservingInterpolations(t){let e="",s=0,i=0;for(;s<t.length;){if("$"===t[s]&&"{"===t[s+1]){const n=this.findClosingBrace(t,s+1);if(-1!==n){e+=this.escapeTemplateLiteralText(t.slice(i,s)),e+=t.slice(s,n+1),s=n+1,i=s;continue}}s++}return e+=this.escapeTemplateLiteralText(t.slice(i)),e}static clearCache(){this.cache.clear()}static pruneCache(){if(this.cache.size>this.MAX_CACHE_SIZE){const t=this.cache.size-Math.floor(this.MAX_CACHE_SIZE/2);let e=0;for(const s of this.cache.keys()){if(e>=t)break;this.cache.delete(s),e++}}}static transformSpreadAttributes(t){const e=new Map;let s=0;const i=document.createElement("template");i.innerHTML=t;const n=t=>{if(t.nodeType===Node.ELEMENT_NODE){const i=t;if(Array.from(i.childNodes).forEach(n),i.hasAttribute("pp-spread")){const t=i.getAttribute("pp-spread")||"";i.removeAttribute("pp-spread");const n=t.match(/^\s*\{\s*\.\.\.(.+?)\s*\}\s*$/);if(n){const t=te(n[1].trim()),r=`___pp_spread_${s++}___`,a=`\${ (() => {\n const __obj = ${t};\n if (!__obj || typeof __obj !== 'object') return '';\n return Object.entries(__obj)\n .map(([k, v]) => {\n if (v == null) return '';\n const __escapedValue = String(v)\n .split('&').join('&')\n .split('"').join('"')\n .split('<').join('<');\n return k + '="' + __escapedValue + '"';\n })\n .filter(Boolean)\n .join(' ');\n })() }`;e.set(r,a),i.setAttribute(r,"")}}}};return Array.from(i.content.childNodes).forEach(n),{html:i.innerHTML,spreadReplacements:e}}static expandSpreadPlaceholders(t,e){let s=t;return e.forEach((t,e)=>{s=s.split(`${e}=""`).join(t),s=s.split(e).join(t)}),s}static transformRefAttributes(t){if(!t.includes("pp-ref"))return t;const e=document.createElement("template");e.innerHTML=t;const s=document.createTreeWalker(e.content,NodeFilter.SHOW_ELEMENT);let i=s.nextNode();for(;i;){const t=i;if(t.hasAttribute("pp-ref")){const e=(t.getAttribute("pp-ref")||"").match(/^\s*\{([\s\S]+)\}\s*$/);if(e){const s=te(e[1].trim());t.removeAttribute("pp-ref"),t.setAttribute("data-pp-ref",`{ __pp_ref(${s}) }`)}}i=s.nextNode()}return e.innerHTML}static transformComponentTags(t){const e=document.createElement("template");e.innerHTML=t;const s=t=>{if(t.nodeType!==Node.ELEMENT_NODE)return;const e=t,i=e.tagName.toLowerCase();if(Array.from(e.childNodes).forEach(s),i.includes(".")){const t=document.createDocumentFragment();for(t.appendChild(document.createTextNode(`{${i}}`));e.firstChild;)t.appendChild(e.firstChild);e.replaceWith(t)}};return Array.from(e.content.childNodes).forEach(s),e.innerHTML}static normalizeTextareaValueAttributes(t){if(!t.includes("<textarea")||!t.includes("value="))return t;const e=document.createElement("template");return e.innerHTML=t,e.content.querySelectorAll("textarea").forEach(t=>{const e=t,s=e.getAttribute("value");null!==s&&(e.textContent=s,e.removeAttribute("value"))}),e.innerHTML}static compile(t,e){const s=(t||"").replace(/\r\n/g,"\n").replace(/\r/g,"\n"),i=t=>{let e=2166136261;for(let s=0;s<t.length;s++)e^=t.charCodeAt(s),e=e+((e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24))>>>0;return e.toString(16).padStart(8,"0")},n=e.join("\0"),r=`t${i(s)}|k${i(n)}|n${e.length}`;if(this.cache.has(r))return this.cache.get(r);const{maskedTemplate:a,placeholders:o}=this.maskComplexComponents(s),{maskedHtml:h,placeholders:c}=this.maskLiteralElements(a,"style","STYLE"),l=this.transformComponentTags(h),p=this.normalizeTextareaValueAttributes(l),{html:u,spreadReplacements:d}=this.transformSpreadAttributes(p),f=this.transformRefAttributes(u),{html:m,loopReplacements:g}=this.processStructuralDirectives(f);let v=this.transformBooleanAttributes(m);(()=>{let t=!0;for(;t;)t=!1,g.forEach((e,s)=>{const i=v;v=v.split("${"+s+"}").join("${"+e+"}"),v=v.split(s).join("{ "+e+" }"),v!==i&&(t=!0)})})();const x=new Set;let y="return `",b=0,E="";for(;b<v.length;){const t=v[b];if("o"===t||"O"===t){const t=v.slice(b,b+20).toLowerCase().match(/^on\w+\s*=\s*(["'])/);if(t){const e=v.slice(b,b+t[0].length),s=e[e.length-1];let i=b+t[0].length;for(;i<v.length&&(v[i]!==s||"\\"===v[i-1]);)i++;E+=v.slice(b,i+1),b=i+1;continue}}if("{"===t){const t=this.findClosingBrace(v,b);if(-1!==t){const e=v.slice(b+1,t),s=te(e);if(q.isValidExpression(s)){y+=this.escapeTemplateLiteralText(E),E="";const e=q.extractUsedVariables(s,Ki);for(const t of e)/^___PP_LOOP_\d+___$/.test(t)||x.add(t);const i=s.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g," ");y+=`\${ (() => {\n try {\n const __res = (${s});\n // React pattern: ignore booleans, null, and undefined\n if (typeof __res === 'boolean' || __res == null) return '';\n // React pattern: join arrays without commas\n if (Array.isArray(__res)) return __res.join('');\n return __res;\n } catch(e) {\n console.error("[PP-ERROR] Template Expression Failed: \\"${i}\\"", e);\n return '';\n }\n })() }`,b=t+1;continue}e.trim().length>0&&console.warn(`[PP-WARN] Interpolation skipped. Invalid Syntax in: "{${s}}"`)}}E+=t,b++}y+=this.escapeTemplateLiteralText(E),y+="`;",y=this.expandSpreadPlaceholders(y,d);const _=Array.from(new Set([...e,...x]));try{const t=new Function(..._,y),e=(...e)=>{let s=t(...e);return s=this.restorePlaceholders(s,c),o.forEach((t,e)=>{s=s.replace(e,t)}),s};return this.pruneCache(),this.cache.set(r,e),e}catch(t){return console.error("[PP-ERROR] Compilation Failed",t),()=>"Error in Template"}}static maskLiteralElements(t,e,s){const i=document.createElement("template");i.innerHTML=t;const n=new Map;let r=0;return i.content.querySelectorAll(e).forEach(t=>{const e=`__PP_${s}_${r++}__`;n.set(e,t.outerHTML),t.replaceWith(document.createTextNode(e))}),{maskedHtml:i.innerHTML,placeholders:n}}static restorePlaceholders(t,e){let s=t;return e.forEach((t,e)=>{s=s.replace(e,t)}),s}static transformBooleanAttributes(t){let e="",s=0;for(;s<t.length;){let i=!1;for(const n of Yt){const r=`${n}="{`,a=`${n}='{`;if(t.startsWith(r,s)){i=!0;const a=s+r.length-1,o=this.findClosingBrace(t,a);if(-1!==o&&'"'===t[o+1]){e+=`{ (${te(t.slice(a+1,o))}) ? '${n}' : '' }`,s=o+2;break}}else if(t.startsWith(a,s)){i=!0;const r=s+a.length-1,o=this.findClosingBrace(t,r);if(-1!==o&&"'"===t[o+1]){e+=`{ (${te(t.slice(r+1,o))}) ? '${n}' : '' }`,s=o+2;break}}}i||(e+=t[s],s++)}return e}static captureLoopVariablesInEventHandlers(t,e,s,i,n=!1,r=[]){let a="",o=0;for(;o<t.length;){const h=t.slice(o,o+40).toLowerCase().match(/^on\w+\s*=\s*(["'])/);if(h){const c=h[0].length,l=t.slice(o,o+c),p=l[l.length-1],u=o+c;let d=u;for(;d<t.length&&(t[d]!==p||"\\"===t[d-1]);)d++;const f=l.slice(0,-2).trim();let m=t.slice(u,d);m=this.rewriteLoopEventHandlerCode(m,e,s,i,n,r),a+=`${f}=${p}${m}${p}`,o=d+1;continue}a+=t[o],o++}return a}static rewriteLoopEventHandlerCode(t,e,s,i,n,r=[]){const a=t.match(/^\{([\s\S]*)\}$/),o=a?a[1]:t;let h=s,c=o;r.forEach(t=>{h=this.applyLoopContextRewrites(h,t),c=this.applyLoopContextRewrites(c,t)});const l={iterator:e,collectionName:h,indexVar:i,userDefinedIndex:n};return c=this.applyLoopContextRewrites(c,l),[...r,l].forEach(t=>{const e=this.getLoopIndexToken(t.indexVar);c=c.split(e).join(`\${${t.indexVar}}`)}),a?`{${c}}`:c}static getLoopIndexToken(t){return`__PP_LOOP_IDX_${t}__`}static applyLoopContextRewrites(t,e){const s=this.getLoopIndexToken(e.indexVar);let i=t;return e.userDefinedIndex&&(i=this.replaceLoopIdentifierUsages(i,e.indexVar,s)),this.replaceLoopIdentifierUsages(i,e.iterator,`(${e.collectionName})[${s}]`)}static replaceLoopIdentifierUsages(t,e,s){const i=q.analyzeLoopVariableUsage(t,e).slice().sort((t,e)=>e.start-t.start);if(0===i.length)return t;let n=t;return i.forEach(t=>{const i=t.isShorthand?this.buildShorthandReplacement(e,s,t.isUnwrap):s;n=n.slice(0,t.start)+i+n.slice(t.end)}),n}static buildShorthandReplacement(t,e,s){return s?`{ ${t}: ${e} }`:`${t}: ${e}`}static processStructuralDirectives(t){if(!t.includes("pp-for"))return{html:t,loopReplacements:new Map};const e=document.createElement("template");e.innerHTML=t;const s=new Map;let i=0,n=0;const r=(t,e=[])=>{const a=Array.from(t.childNodes);for(const t of a){if(t.nodeType!==Node.ELEMENT_NODE)continue;const a=t;if("TEMPLATE"===a.tagName){const t=a,o=t.getAttribute("pp-for")||"";let h=null;if(t.hasAttribute("pp-for")){const t=o.match(/^\s*\(\s*(.+?)\s*,\s*(.+?)\s*\)\s+in\s+(.+?)\s*$/),e=o.match(/^\s*(.+?)\s+in\s+(.+?)\s*$/);let s,i,r,a=!1;if(t)s=t[1].trim(),i=t[2].trim(),r=t[3].trim(),a=!0;else{if(!e)continue;s=e[1].trim(),r=e[2].trim(),i="__pp_idx_"+n++}h={iterator:s,collectionName:r,indexVar:i,userDefinedIndex:a}}if(r(t.content,h?[...e,h]:e),h){const{iterator:n,collectionName:r,indexVar:a,userDefinedIndex:o}=h;let c=t.innerHTML;c=this.transformComponentTags(c),c=this.transformRefAttributes(c),c=this.captureLoopVariablesInEventHandlers(c,n,r,a,o,e),c=c.replace(/___PP_LOOP_\d+___/g,t=>"${"+t+"}"),c=c.replace(/\r/g,""),c=this.transformBooleanAttributes(c),c=this.transformInterpolations(c),c=this.escapeTemplateLiteralTextPreservingInterpolations(c);const l=`(Array.isArray(${r}) ? ${r} : []).map(${`(${n}, ${a})`} => \`${c}\`).join('')`,p=`___PP_LOOP_${i++}___`;s.set(p,l),t.replaceWith(document.createTextNode(p));continue}continue}r(a,e)}};return r(e.content),{html:e.innerHTML,loopReplacements:s}}static transformInterpolations(t){let e="",s=0;for(;s<t.length;){if("o"===t[s]||"O"===t[s]){const i=t.slice(s,s+20).toLowerCase().match(/^on\w+\s*=\s*(["'])/);if(i){const n=t.slice(s,s+i[0].length),r=n[n.length-1];let a=s+i[0].length;for(;a<t.length&&(t[a]!==r||"\\"===t[a-1]);)a++;e+=t.slice(s,a+1),s=a+1;continue}}if("{"===t[s]){if(s>0&&"$"===t[s-1]){e+="{",s++;continue}const i=this.findClosingBrace(t,s);if(-1!==i){const n=te(t.slice(s+1,i));if(q.isValidExpression(n)){e+="${"+n+"}",s=i+1;continue}}}e+=t[s],s++}return e}static maskComplexComponents(t){if(!t.includes("pp-component="))return{maskedTemplate:t,placeholders:new Map};const e=document.createElement("template");e.innerHTML=t;const s=new Map;let i=0;const n=t=>{if(t instanceof Element&&t.hasAttribute("pp-component")){const e=!!t.querySelector('script[type="text/pp"]'),n=!!t.querySelector("template[pp-owner]");if(e||n){const e=`__PP_CHILD_${i++}__`;return s.set(e,t.outerHTML),void t.replaceWith(document.createTextNode(e))}}Array.from(t.children).forEach(t=>n(t))};return n(e.content),{maskedTemplate:e.innerHTML,placeholders:s}}static findClosingBrace(t,e){let s=0,i=null;for(let n=e;n<t.length;n++){const e=t[n];let r=!1;if(n>0&&"\\"===t[n-1]){let e=0,s=n-1;for(;s>=0&&"\\"===t[s];)e++,s--;e%2!=0&&(r=!0)}if(i)e===i&&!r&&(i=null);else if(r||'"'!==e&&"'"!==e&&"`"!==e)if("{"!==e||r){if("}"===e&&!r&&(s--,0===s))return n}else s++;else i=e}return-1}}x(xe,"cache",new Map),x(xe,"MAX_CACHE_SIZE",200);const ft=new Set(["data-state","style"]),$i=["script","domDiff","bindEvents","bindRefs","bootstrapNested","portals","restoreFocus","layoutEffects","effects","total"];function dt(){return typeof performance<"u"&&"function"==typeof performance.now?performance.now():Date.now()}const V=class t{constructor(t){x(this,"el"),x(this,"id"),x(this,"rawTemplate"),x(this,"renderFunction"),x(this,"templateFn",null),x(this,"hooksSystem"),x(this,"eventManager"),x(this,"latestScope",{}),x(this,"__ppRefStore",new Map),x(this,"__ppPrevRefStore",null),x(this,"__ppRefSeq",0),x(this,"isRendering",!1),x(this,"props",{}),x(this,"ownedChildren",new Map),x(this,"lastRenderedHtml",""),x(this,"renderCount",0),x(this,"trackedPortals",new Map),x(this,"parentId",null),x(this,"initialChildrenHtml",""),x(this,"pendingEventElements",new Set),x(this,"traversalCache",null),x(this,"pendingProvidedContexts",new Map),x(this,"pendingContextTokens",new Set),x(this,"contextRefreshPending",!1),x(this,"_lastRawScopeKeySig",""),x(this,"_lastSortedKeys",[]),x(this,"_lastSortedScopeKeySig",""),x(this,"_cachedHooksAPI",null),x(this,"_propFnCache",new Map),x(this,"_interpolationFnCache",new Map),x(this,"_scopeEvalFnCache",new Map),x(this,"_refEvalFnCache",new Map),this.el=t,this.id=this.el.getAttribute("pp-component")||"",this.id||(this.id="anon_"+Math.random().toString(36).substring(2,9),this.el.setAttribute("pp-component",this.id)),this.props=Array.from(this.el.attributes).reduce((t,e)=>{const s=e.name;if(s.startsWith("on")||"pp-component"===s)return t;const i=nt(s);return pt.has(i)||(t[i]=e.value),t},{}),E.registerInstance(this.id,this),this.syncParentId(),this.props=this.computePropsFromAttributes();let e=E.getTemplate(this.id);const s=E.getOwnedTemplates(this.id);e?s&&(this.ownedChildren=s):(this.extractOwnedTemplates(),e=this.el.innerHTML,E.saveTemplate(this.id,e),E.saveOwnedTemplates(this.id,this.ownedChildren)),this.initialChildrenHtml=e,this.props.children=this.initialChildrenHtml,this.hooksSystem=new ti(()=>{this.isRendering||this.render()});const i=E.getState(this.id);i&&this.hooksSystem.loadState(i);const n=document.createElement("template");n.innerHTML=this.initialChildrenHtml;const r=this.findOwnScript(n.content),a=(null==r?void 0:r.textContent)||"";r&&r.remove(),this.rawTemplate=n.innerHTML,this.renderFunction=this.createRenderFunction(a),this.eventManager=new ri(this.el,()=>this.latestScope,t=>this.isManagedEventElement(t)),this.render()}syncParentId(){var t;const e=null==(t=this.el.parentElement)?void 0:t.closest("[pp-component]");this.parentId=e?e.getAttribute("pp-component"):null,E.saveParent(this.id,this.parentId)}static setPerfEnabled(t){this.perfEnabled=t}static getPerfEnabled(){return this.perfEnabled}static resetPerfStats(){this.perfStats.clear()}static getPerfStats(){return Object.fromEntries(this.perfStats.entries())}static createEmptyPerfEntry(){const t={};return $i.forEach(e=>{t[e]={count:0,totalMs:0,maxMs:0}}),{renderCount:0,phases:t}}recordPerfPhase(e,s){if(!t.perfEnabled)return;let i=t.perfStats.get(this.id);i||(i=t.createEmptyPerfEntry(),t.perfStats.set(this.id,i));const n=i.phases[e];n.count++,n.totalMs+=s,n.maxMs=Math.max(n.maxMs,s)}startPerfTimer(){return t.perfEnabled?dt():0}endPerfTimer(e,s){t.perfEnabled&&this.recordPerfPhase(e,dt()-s)}findOwnScript(t){const e=Array.from(t.children);for(const t of e){if("script"===t.tagName.toLowerCase()&&"text/pp"===t.getAttribute("type"))return t;if(t.hasAttribute("pp-component"))continue;const e=this.findOwnScript(t);if(e)return e}return null}interpolateAttrString(t,e){const s=ue(e),i=s.keys,n=ce(e,i),r=s.keySig;return t.replace(/\{([\s\S]*?)\}/g,(t,e)=>{const s=te(String(e).trim());try{const t=this.getCachedFunction(this._interpolationFnCache,s,i,r,300)(...n);return"boolean"==typeof t||null==t?"":Array.isArray(t)?t.join(""):String(t)}catch(t){return console.warn(`[PP-WARN] Failed attribute interpolation for {${s}}`,t),""}})}applyAttributeInterpolations(t,e){const s=ue(e),i=s.keys,n=ce(e,i),r=s.keySig;for(const s of Array.from(t.attributes)){const a=s.name;if("pp-component"===a||a.startsWith("on"))continue;const o=s.value;if(!o.includes("{"))continue;if(!/^\s*\{[\s\S]*\}\s*$/.test(o)){const s=this.interpolateAttrString(o,e);s!==o&&t.setAttribute(a,s);continue}const h=o.match(/^\s*\{([\s\S]*)\}\s*$/);if(!h)continue;const c=te(h[1].trim());if(!q.isValidExpression(c))continue;let l;try{l=this.getCachedFunction(this._scopeEvalFnCache,c,i,r,300)(...n)}catch(t){console.error(`[PP-ERROR] Failed to eval "${c}"`,t);continue}if(Yt.has(a.toLowerCase())){l?t.setAttribute(a,""):t.removeAttribute(a);continue}const p=typeof l;null==l?t.removeAttribute(a):("string"===p||"number"===p||"boolean"===p||"bigint"===p)&&t.setAttribute(a,String(l))}}computePropsFromAttributes(){const t=this.parentId?E.getScope(this.parentId):void 0,e=t?ue(t):null,s=(null==e?void 0:e.keys)??[],i=t?ce(t,s):[],n=this.el.__ppRawBindings,r=new Set([...Array.from(this.el.attributes).map(t=>t.name),...n?Object.keys(n):[]]),a=(null==e?void 0:e.keySig)??"",o=e=>{if(t)try{const t=e+"|"+a;let n=this._propFnCache.get(t);if(!n){if(n=new Function(...s,`"use strict"; return (${e});`),this._propFnCache.size>200){const t=this._propFnCache.keys().next().value;void 0!==t&&this._propFnCache.delete(t)}this._propFnCache.set(t,n)}return n(...i)}catch(t){return void console.warn(`[PP-WARN] Failed to evaluate prop expression "{${e}}" for component "${this.id}"`,t)}};return Array.from(r).reduce((e,s)=>{if(s.startsWith("on")&&!s.includes("-")||"pp-component"===s)return e;const i=nt(s);if(pt.has(i))return e;const r=this.el.attributes.getNamedItem(s),a=(null==n?void 0:n[s])??(null==r?void 0:r.value);if(void 0===a)return e;if(""===a)return e[i]=!0,e;if(t){const s=a.match(/^\s*\{([\s\S]*)\}\s*$/);if(s){const t=te(s[1].trim());if(q.isValidExpression(t))return e[i]=o(t),e}if(a.includes("{"))return e[i]=this.interpolateAttrString(a,t),e}return e[i]=a,e},{})}refreshPropsFromParent(){const t=this.computePropsFromAttributes();t.children=this.initialChildrenHtml,si(this.props,t)&&0===this.ownedChildren.size?this.bootstrapNestedComponents():(this.props=t,this.isRendering||this.render())}extractOwnedTemplates(){const t=this.el.querySelectorAll("template[pp-owner]");let e=0;t.forEach(t=>{var s;if((null==(s=t.parentElement)?void 0:s.closest("[pp-component]"))!==this.el)return;const i=t.getAttribute("pp-owner");if(i&&i!==this.id){const s=`__PP_OWNED_${this.id}_${e++}__`;this.ownedChildren.set(s,{ownerId:i,content:t.innerHTML});const n=document.createTextNode(s);t.replaceWith(n)}})}maskNestedOwnedTemplates(t){const e=new Map,s=document.createElement("template");s.innerHTML=t;let i=0;const n=s.content.querySelectorAll("[pp-component] > template[pp-owner]");for(const t of Array.from(n)){const s=`__PP_NESTED_TPL_${i++}__`;e.set(s,t.outerHTML),t.replaceWith(document.createTextNode(s))}return{content:s.innerHTML,placeholders:e}}resolveOwnedTemplateOwner(t,e=this.id){const s=E.resolveComponentId(t,e);if(!s)return null;const i=E.getResolvedScopeWithAncestors(t,e);return i?{ownerId:s,scope:i}:null}resolveOwnedChildren(t){if(!t.includes("__PP_OWNED_"))return t;this.ownedChildren.forEach((e,s)=>{const i=this.resolveOwnedTemplateOwner(e.ownerId);if(i){const{content:n,placeholders:r}=this.maskNestedOwnedTemplates(e.content),a=ue(i.scope).keys,o=ce(i.scope,a);let h=xe.compile(n,a)(...o);for(const[t,e]of r)h=h.replace(t,e);h=this.markOwnedEventHandlers(h,i.ownerId),t=t.replace(s,h)}else t=t.replace(s,e.content)});const e=/__PP_OWNED_([^_]+(?:_[^_]+)*)_(\d+)__/g;let s;for(;null!==(s=e.exec(t));){const i=s[0],n=s[1],r=E.getOwnedTemplates(n);if(r&&r.has(i)){const s=r.get(i),a=this.resolveOwnedTemplateOwner(s.ownerId,n);if(a){const{content:e,placeholders:n}=this.maskNestedOwnedTemplates(s.content),r=ue(a.scope).keys,o=ce(a.scope,r);let h=xe.compile(e,r)(...o);for(const[t,e]of n)h=h.replace(t,e);h=this.markOwnedEventHandlers(h,a.ownerId),t=t.replace(i,h)}else t=t.replace(i,s.content);e.lastIndex=0}}return t}markOwnedEventHandlers(t,e){const s=document.createElement("template");s.innerHTML=t;const i=document.createTreeWalker(s.content,NodeFilter.SHOW_ELEMENT);let n=i.nextNode();for(;n;){const t=n;Array.from(t.attributes).some(t=>t.name.startsWith("on"))&&t.setAttribute("pp-event-owner",e),n=i.nextNode()}return s.innerHTML}getCachedFunction(t,e,s,i,n){const r=e+"|"+i;let a=t.get(r);if(!a){if(a=new Function(...s,`"use strict"; return (${e});`),t.size>n){const e=t.keys().next().value;void 0!==e&&t.delete(e)}t.set(r,a)}return a}createRenderFunction(t){const e=q.extractStateBindings(t);return new Function("pp",`\n "use strict";\n ${t}\n return { ${e.join(", ")} };\n `)}unmountPreviousRefs(){if(this.__ppPrevRefStore){for(const t of this.__ppPrevRefStore.values())try{"function"==typeof t?t(null):t&&"object"==typeof t&&"current"in t&&(t.current=null)}catch(t){console.warn("[PP-WARN] Ref cleanup failed",t)}this.__ppPrevRefStore=null}}createRefCaptureFunction(){return this.__ppRefStore=new Map,this.__ppRefSeq=0,t=>{const e=`ppref_${this.id}_${++this.__ppRefSeq}`;return this.__ppRefStore.set(e,t),e}}consumeContext(t){return this.pendingContextTokens.add(t),E.resolveContext(this.parentId,t).value}provideContext(t,e){this.pendingProvidedContexts.set(t,e)}requestContextRefresh(){this.contextRefreshPending||(this.contextRefreshPending=!0,queueMicrotask(()=>{if(this.contextRefreshPending=!1,E.getInstance(this.id)===this){if(this.isRendering)return void this.requestContextRefresh();this.forceUpdate()}}))}refreshContextConsumers(t){var e;for(const s of t){const t=E.getInstance(s);null==(e=null==t?void 0:t.requestContextRefresh)||e.call(t)}}makeHooksAPI(){return this._cachedHooksAPI?this._cachedHooksAPI.props=this.props:this._cachedHooksAPI={state:t=>this.hooksSystem.useState(t),effect:(t,e)=>this.hooksSystem.useEffect(t,e),layoutEffect:(t,e)=>this.hooksSystem.useLayoutEffect(t,e),ref:(t=null)=>this.hooksSystem.useRef(t),memo:(t,e)=>this.hooksSystem.useMemo(t,e),callback:(t,e)=>this.hooksSystem.useCallback(t,e),reducer:(t,e)=>this.hooksSystem.useReducer(t,e),context:t=>this.consumeContext(t),provideContext:(t,e)=>this.provideContext(t,e),portal:(t,e)=>this.hooksSystem.usePortal(t,e),props:this.props},this._cachedHooksAPI}syncTrackedPortals(t){if(0===this.trackedPortals.size)return;const e=this.hooksSystem.getPortalRegistrations();if(0===e.length)return;const s=new Map,i=new Map;t.querySelectorAll("*").forEach(t=>{const e=t,n=e.getAttribute("data-pp-ref");if(n){const t=s.get(n);t?t.push(e):s.set(n,[e])}const r=e.getAttribute("pp-ref");if(r){const t=i.get(r);t?t.push(e):i.set(r,[e])}});const n=new Map;for(const[t,e]of this.__ppRefStore.entries()){if(!e||"object"!=typeof e||!("current"in e))continue;const s=e,i=n.get(s);i?i.push(t):n.set(s,[t])}const r=new Map;for(const[t,e]of Object.entries(this.latestScope)){if(!e||"object"!=typeof e||!("current"in e))continue;const s=e,i=r.get(s);i?i.push(t):r.set(s,[t])}const a=(t,e)=>{for(const s of e){const e=t.get(s);if(!e||0===e.length)continue;const i=e.shift()??null;if(0===e.length&&t.delete(s),i)return i}return null},o=[];for(const t of e){const e=t.ref.current;if(!e||!this.trackedPortals.has(e))continue;const h=n.get(t.ref)??[];let c=a(s,h);if(!c){const e=r.get(t.ref)??[];c=a(i,e)}if(!c)continue;const l=this.trackedPortals.get(e);o.push({liveElement:e,sourceElement:c,placeholderText:l.placeholder.data||`pp-portal:${this.id}`})}0!==o.length&&(o.forEach(({sourceElement:t,placeholderText:e})=>{t.replaceWith(document.createComment(e))}),o.forEach(({liveElement:t,sourceElement:e})=>{this.morphTrackedPortalRoot(t,e)}))}morphTrackedPortalRoot(t,e){if(t.tagName!==e.tagName){const s=t.parentNode;if(!s)return;const i=e.cloneNode(!0),n=this.trackedPortals.get(t);return s.replaceChild(i,t),this.collectEventElements(i),void(n&&(this.trackedPortals.delete(t),this.trackedPortals.set(i,{...n,element:i})))}this.syncAttributes(t,e,!0),this.hasEventAttributes(t)&&this.pendingEventElements.add(t),this.morphChildren(t,e)}applyPortals(){const t=this.hooksSystem.getPortalRegistrations(),e=new Set;let s=!1;for(const i of t){const t=i.ref.current;if(!t)continue;const n=i.target??document.body;e.add(t);const r=this.trackedPortals.get(t);if(null!=r&&r.placeholder.parentNode){r.target!==n&&(n.appendChild(t),r.target=n,s=!0);continue}null===i.info.sourceParent&&t.parentNode instanceof Element&&(i.info.sourceParent=t.parentNode);const a=document.createComment(`pp-portal:${this.id}`);t.parentNode&&t.parentNode.insertBefore(a,t),n.appendChild(t),s=!0,this.trackedPortals.set(t,{element:t,placeholder:a,target:n})}for(const[t,i]of this.trackedPortals)e.has(t)||(i.placeholder.parentNode?(i.placeholder.parentNode.insertBefore(t,i.placeholder),i.placeholder.remove()):t.parentNode&&t.remove(),this.trackedPortals.delete(t),s=!0);s&&this.invalidateTraversalCache()}render(){var e;if(this.isRendering)return;this.isRendering=!0,this.renderCount++;const s=this.startPerfTimer();if(t.perfEnabled){let e=t.perfStats.get(this.id);e||(e=t.createEmptyPerfEntry(),t.perfStats.set(this.id,e)),e.renderCount++}try{this.unmountPreviousRefs(),this.pendingProvidedContexts=new Map,this.pendingContextTokens=new Set;const t=this.saveFocusState();this.hooksSystem.prepareRender();const s=this.makeHooksAPI(),i=globalThis.pp,n=(null==(e=null==i?void 0:i.createComponentRuntime)?void 0:e.call(i,s))??s,r=this.startPerfTimer(),a=this.renderFunction(n);this.endPerfTimer("script",r),E.saveState(this.id,this.hooksSystem.getHooks()),this.latestScope={...this.props,...a},this.latestScope.__pp_ref=this.createRefCaptureFunction(),E.saveScope(this.id,this.latestScope);const o=ue(this.latestScope),h=o.keys,c=o.keySig;let l,p;c===this._lastRawScopeKeySig?(l=this._lastSortedKeys,p=this._lastSortedScopeKeySig):(l=h.length>1?[...h].sort():h.slice(),p=l.join("\0"),this._lastRawScopeKeySig=c,this._lastSortedKeys=l,this._lastSortedScopeKeySig=p);const u=ce(this.latestScope,l);this.templateFn||(this.templateFn=xe.compile(this.rawTemplate,l));let d=this.templateFn(...u);if(d=this.resolveOwnedChildren(d),this.lastRenderedHtml!==d){const t=this.startPerfTimer();this.applyDomDiff(d),this.endPerfTimer("domDiff",t),this.lastRenderedHtml=d}if(this.hasEventAttributes(this.el)&&this.pendingEventElements.add(this.el),this.pendingEventElements.size>0){const t=this.pendingEventElements;this.pendingEventElements=new Set;const e=this.startPerfTimer();this.eventManager.bindEvents(t),this.endPerfTimer("bindEvents",e)}const f=this.startPerfTimer();this.bindRefs(l,u,p),this.endPerfTimer("bindRefs",f);const m=E.saveContextValues(this.id,this.pendingProvidedContexts);E.updateContextDependencies(this.id,this.pendingContextTokens);const g=m.length>0?E.getConsumersForContextsInSubtree(this.id,m):null;this.__ppPrevRefStore=new Map(this.__ppRefStore);const v=this.startPerfTimer();this.bootstrapNestedComponents(),this.endPerfTimer("bootstrapNested",v);const x=this.startPerfTimer();this.applyPortals(),this.endPerfTimer("portals",x);const y=this.startPerfTimer();this.restoreFocusState(t),this.endPerfTimer("restoreFocus",y);const b=this.startPerfTimer();this.hooksSystem.runLayoutEffects(),this.endPerfTimer("layoutEffects",b);const _=this.startPerfTimer();this.hooksSystem.runEffects(),this.endPerfTimer("effects",_),null!=g&&g.size&&this.refreshContextConsumers(g)}catch(t){console.error("[PP-ERROR] Render Cycle Failed",t)}finally{this.endPerfTimer("total",s),this.isRendering=!1}}applyDomDiff(t){if(typeof SVGElement<"u"&&this.el instanceof SVGElement){const e=(new DOMParser).parseFromString(`<svg xmlns="http://www.w3.org/2000/svg">${t}</svg>`,"image/svg+xml").documentElement,s=document.createDocumentFragment();return Array.from(e.childNodes).forEach(t=>{s.appendChild(document.importNode(t,!0))}),this.morphChildren(this.el,s),void this.invalidateTraversalCache()}const e=document.createElement("template");e.innerHTML=t;const s=e.content;this.syncTrackedPortals(s),this.morphChildren(this.el,s),this.invalidateTraversalCache()}isInsideTrackedPortal(t){for(const[e]of this.trackedPortals)if(e===t||e.contains(t))return!0;return!1}createNestedBoundaryId(e){return t.nestedBoundarySequence+=1,`${e}__pp${t.nestedBoundarySequence.toString(36)}`}getBoundaryBaseId(t){const e=t,s=t.getAttribute("pp-component");return!e.__ppBaseComponentId&&s&&(e.__ppBaseComponentId=s),e.__ppBaseComponentId??s}ensureBoundaryIdentity(t){var e;const s=t,i=t.getAttribute("pp-component")||"";if(s.__ppRuntimeComponentId)return i!==s.__ppRuntimeComponentId&&t.setAttribute("pp-component",s.__ppRuntimeComponentId),s.__ppBaseComponentId||(s.__ppBaseComponentId=i||s.__ppRuntimeComponentId),s.__ppRuntimeComponentId;if(!i)return"";s.__ppBaseComponentId=i;const n=E.getInstance(i);if(n&&n.el&&n.el!==t){if(n.el.isConnected){const e=this.createNestedBoundaryId(i);return s.__ppRuntimeComponentId=e,t.setAttribute("pp-component",e),e}null==(e=n.destroy)||e.call(n)}return s.__ppRuntimeComponentId=i,i}syncNestedBoundaryAttributes(t,e){const s=e.getAttribute("pp-component"),i=this.getBoundaryBaseId(t);if(!s||i&&s!==i)return!1;this.syncAttributes(t,e,!1,!0);const n=t;return n.__ppRuntimeComponentId&&t.getAttribute("pp-component")!==n.__ppRuntimeComponentId&&t.setAttribute("pp-component",n.__ppRuntimeComponentId),!0}morphChildren(t,e){if(this.hasKeyedDirectChildren(t)||this.hasKeyedDirectChildren(e))return void this.morphKeyedChildren(t,e);let s=t.firstChild,i=e.firstChild;for(;s||i;){const e=(null==s?void 0:s.nextSibling)??null,n=(null==i?void 0:i.nextSibling)??null;if(i){if(!s){const e=i.cloneNode(!0);t.appendChild(e),e.nodeType===Node.ELEMENT_NODE&&this.collectEventElements(e),i=n;continue}if(s.nodeType!==i.nodeType){const r=i.cloneNode(!0);t.replaceChild(r,s),r.nodeType===Node.ELEMENT_NODE&&this.collectEventElements(r),s=e,i=n;continue}if(s.nodeType!==Node.TEXT_NODE){if(s.nodeType===Node.ELEMENT_NODE){const r=s,a=i;if(r.tagName!==a.tagName){const r=i.cloneNode(!0);t.replaceChild(r,s),r.nodeType===Node.ELEMENT_NODE&&this.collectEventElements(r),s=e,i=n;continue}if(r.hasAttribute("pp-component")&&r!==this.el){if(!this.syncNestedBoundaryAttributes(r,a)){const r=i.cloneNode(!0);t.replaceChild(r,s),r.nodeType===Node.ELEMENT_NODE&&this.collectEventElements(r),s=e,i=n;continue}this.hasEventAttributes(r)&&this.pendingEventElements.add(r),s=e,i=n;continue}const o=this.isInsideTrackedPortal(r);this.syncAttributes(r,a,o),this.hasEventAttributes(r)&&this.pendingEventElements.add(r),this.morphChildren(r,a)}s=e,i=n}else s.textContent!==i.textContent&&(s.textContent=i.textContent),s=e,i=n}else s&&t.removeChild(s),s=e}}hasKeyedDirectChildren(t){const e=t.childNodes;for(let t=0;t<e.length;t++){const s=e[t];if(null!==this.getNodeKey(s))return!0}return!1}getNodeKey(t){if(t.nodeType!==Node.ELEMENT_NODE)return null;const e=t.getAttribute("key");return e&&e.length>0?e:null}areNodesCompatible(t,e){if(t.nodeType!==e.nodeType)return!1;if(t.nodeType!==Node.ELEMENT_NODE)return!0;const s=e;if(t.tagName!==s.tagName)return!1;const i=this.getNodeKey(t),n=this.getNodeKey(e);return null===i&&null===n||null!==i&&i===n}morphKeyedChildren(t,e){const s=Array.from(t.childNodes),i=Array.from(e.childNodes),n=this.collectDuplicateKeys(i),r=new Map,a=[];n.length>0&&console.warn(`[PP-WARN] Duplicate key values detected: ${n.join(", ")}`),s.forEach(t=>{const e=this.getNodeKey(t);if(null===e)return void a.push(t);const s=r.get(e);s?s.push(t):r.set(e,[t])});let o=t.firstChild;i.forEach(e=>{const s=this.getNodeKey(e);let i;if(null!==s){const t=r.get(s);for(;t&&t.length>0;){const s=t.shift();if(this.areNodesCompatible(s,e)){i=s;break}a.push(s)}}else{const t=a.findIndex(t=>this.areNodesCompatible(t,e));-1!==t&&(i=a.splice(t,1)[0])}if(i)i!==o&&t.insertBefore(i,o);else{const s=e.cloneNode(!0);t.insertBefore(s,o),s.nodeType===Node.ELEMENT_NODE&&this.collectEventElements(s),i=s}this.morphNode(i,e),o=i.nextSibling}),a.forEach(e=>{e.parentNode===t&&t.removeChild(e)}),r.forEach(e=>{e.forEach(e=>{e.parentNode===t&&t.removeChild(e)})})}collectDuplicateKeys(t){const e=new Set,s=new Set;return t.forEach(t=>{const i=this.getNodeKey(t);if(null!==i){if(e.has(i))return void s.add(i);e.add(i)}}),Array.from(s.values())}morphNode(t,e){if(t.nodeType!==e.nodeType){const s=t.parentNode;if(!s)return;const i=e.cloneNode(!0);return s.replaceChild(i,t),void(i.nodeType===Node.ELEMENT_NODE&&this.collectEventElements(i))}if(t.nodeType===Node.TEXT_NODE)return void(t.textContent!==e.textContent&&(t.textContent=e.textContent));if(t.nodeType!==Node.ELEMENT_NODE)return;const s=t,i=e;if(s.tagName!==i.tagName){const t=s.parentNode;if(!t)return;const i=e.cloneNode(!0);return t.replaceChild(i,s),void(i.nodeType===Node.ELEMENT_NODE&&this.collectEventElements(i))}if(s.hasAttribute("pp-component")&&s!==this.el){if(!this.syncNestedBoundaryAttributes(s,i)){const t=s.parentNode;if(!t)return;const i=e.cloneNode(!0);return t.replaceChild(i,s),void(i.nodeType===Node.ELEMENT_NODE&&this.collectEventElements(i))}return void(this.hasEventAttributes(s)&&this.pendingEventElements.add(s))}const n=this.isInsideTrackedPortal(s);this.syncAttributes(s,i,n),this.hasEventAttributes(s)&&this.pendingEventElements.add(s),this.morphChildren(s,i)}collectEventElements(t){this.hasEventAttributes(t)&&this.pendingEventElements.add(t);for(let e=0;e<t.children.length;e++)this.collectEventElements(t.children[e])}hasEventAttributes(t){const e=t.attributes;for(let t=0;t<e.length;t++)if(e[t].name.startsWith("on")&&!e[t].name.includes("-"))return!0;return!1}isManagedEventElement(t){if(this.isElementOwnedByTree(t,this.el))return!0;for(const[e]of this.trackedPortals)if(this.isElementOwnedByTree(t,e))return!0;return!1}isElementOwnedByTree(t,e){if(t===e)return!0;if(!e.contains(t))return!1;let s=t,i=!0;for(;s&&s!==e;){if(!i&&s.hasAttribute("pp-component"))return!1;s=s.parentElement,i=!1}return s===e}walkOwnedBoundaryElements(t){const e=this.getTraversalCache();for(let s=0;s<e.childBoundaries.length;s++)t(e.childBoundaries[s],!0)}invalidateTraversalCache(){this.traversalCache=null}getTraversalCache(){if(this.traversalCache)return this.traversalCache;const t=[],e=[],s=[],i=[],n=new Set,r=[],a=(t,e)=>{if(e)r.push(t);else for(let e=t.children.length-1;e>=0;e--)r.push(t.children[e])};a(this.el,!1);for(const[t]of this.trackedPortals)a(t,!0);for(;r.length>0;){const a=r.pop();if(n.has(a))continue;n.add(a);const o=a,h=a.hasAttribute("pp-component");if(t.push(o),(a.hasAttribute("data-pp-ref")||a.hasAttribute("pp-ref")||o.__ppRefCaptureId||o.__ppRefExpr)&&i.push(o),(a instanceof HTMLInputElement||a instanceof HTMLTextAreaElement||a instanceof HTMLSelectElement)&&s.push(o),h)e.push(o);else for(let t=a.children.length-1;t>=0;t--)r.push(a.children[t])}return this.traversalCache={ownedElements:t,childBoundaries:e,managedInputs:s,refElements:i},this.traversalCache}collectManagedInputs(){return this.getTraversalCache().managedInputs}syncAttributes(t,e,s=!1,i=!1){const n=t.attributes;for(let r=n.length-1;r>=0;r--){const a=n[r].name;if(!(i&&"pp-component"===a||e.hasAttribute(a))){if(s&&ft.has(a))continue;t.removeAttribute(a),"data-pp-ref"===a&&delete t.__ppRefCaptureId,"pp-ref"===a&&delete t.__ppRefExpr}}const r=e.attributes;for(let e=0;e<r.length;e++){const n=r[e];s&&ft.has(n.name)||i&&"pp-component"===n.name||(t.getAttribute(n.name)!==n.value&&t.setAttribute(n.name,n.value),"value"===n.name&&(t instanceof HTMLInputElement||t instanceof HTMLSelectElement||t instanceof HTMLTextAreaElement)&&t.value!=n.value&&(t.value=n.value))}if(t instanceof HTMLTextAreaElement&&e instanceof HTMLTextAreaElement){const s=e.getAttribute("value"),i=s??e.value,n=s??e.defaultValue;t.value!==i&&(t.value=i),t.defaultValue!==n&&(t.defaultValue=n)}}bindRefs(t,e,s){const i=this.getTraversalCache();for(let n=0;n<i.refElements.length;n++){const r=i.refElements[n],a=r,o=r.getAttribute("data-pp-ref");let h=null;if(o?(r.removeAttribute("data-pp-ref"),a.__ppRefCaptureId=o,h=o):a.__ppRefCaptureId&&this.__ppRefStore.has(a.__ppRefCaptureId)?h=a.__ppRefCaptureId:a.__ppRefCaptureId&&delete a.__ppRefCaptureId,h){const t=this.__ppRefStore.get(h);if("function"==typeof t)try{t(r)}catch(t){console.warn(`[PP-WARN] Ref callback threw for id="${h}"`,t)}else t&&"object"==typeof t&&"current"in t?t.current=r:o&&console.warn(`[PP-WARN] Missing captured ref for id="${h}"`)}const c=r.getAttribute("pp-ref");let l=c;if(c?a.__ppRefExpr=c:a.__ppRefExpr&&(l=a.__ppRefExpr),!l)continue;c&&r.removeAttribute("pp-ref");const p=this.latestScope[l];if(p&&"object"==typeof p&&"current"in p)p.current=r;else if("function"!=typeof p)try{const i=this.getCachedFunction(this._refEvalFnCache,l,t,s,200)(...e);"function"==typeof i?i(r):i&&"object"==typeof i&&"current"in i&&(i.current=r)}catch(t){console.warn(`[PP-WARN] Could not resolve pp-ref="${l}"`,t)}else try{p(r)}catch(t){console.warn(`[PP-WARN] pp-ref function threw for "${l}"`,t)}}}bootstrapNestedComponents(){this.walkOwnedBoundaryElements((e,s)=>{if(!s)return;const i=this.ensureBoundaryIdentity(e);if(!i)return;if(e.__ppRawBindings){const t=e.__ppRawBindings;for(const[s,i]of Object.entries(t))e.setAttribute(s,i)}else{const t={};for(const s of Array.from(e.attributes))s.value.includes("{")&&"pp-component"!==s.name&&!s.name.startsWith("on")&&(t[s.name]=s.value);e.__ppRawBindings=t}this.applyAttributeInterpolations(e,this.latestScope);const n=E.getInstance(i);if(null!=n&&n.refreshPropsFromParent)return n.parentId=this.id,E.saveParent(i,this.id),n.el!==e&&(!e.__ppRawBindings&&n.el.__ppRawBindings&&(e.__ppRawBindings=n.el.__ppRawBindings),n.el=e),void n.refreshPropsFromParent();E.getState(i)||new t(e)})}saveFocusState(){const t=document.activeElement;if(!t)return null;const e=this.el.contains(t),s=!e&&Array.from(this.trackedPortals.values()).some(e=>e.element.contains(t));if(!e&&!s)return null;const i=this.collectManagedInputs().indexOf(t);if(-1===i)return null;const n=this.getTextSelectionState(t);return{element:t,index:i,selectionStart:n.selectionStart,selectionEnd:n.selectionEnd}}isTextSelectionControl(t){return t instanceof HTMLTextAreaElement||t instanceof HTMLInputElement&&["text","search","url","tel","password"].includes(t.type)}getTextSelectionState(t){if(!this.isTextSelectionControl(t))return{selectionStart:null,selectionEnd:null};try{return{selectionStart:t.selectionStart,selectionEnd:t.selectionEnd}}catch{return{selectionStart:null,selectionEnd:null}}}restoreFocusState(t){if(!t)return;const e=t.element,s=e&&e.isConnected&&(this.el.contains(e)||Array.from(this.trackedPortals.values()).some(t=>t.element.contains(e)))?e:this.collectManagedInputs()[t.index];if(s&&(s.focus(),null!==t.selectionStart&&null!==t.selectionEnd&&this.isTextSelectionControl(s)))try{s.setSelectionRange(t.selectionStart,t.selectionEnd)}catch(t){console.warn("Could not restore cursor position",t)}}forceUpdate(){this.lastRenderedHtml="",this.render()}destroy(){for(const[,t]of this.trackedPortals)t.element.parentNode&&t.element.remove(),t.placeholder.parentNode&&t.placeholder.remove();this.trackedPortals.clear();const t=E.removeContextTracking(this.id);this.hooksSystem.dispose(),this.eventManager.clearCache(),E.removeState(this.id),E.removeScope(this.id),E.removeInstance(this.id),t.forEach(t=>{var e;const s=E.getInstance(t);null==(e=null==s?void 0:s.requestContextRefresh)||e.call(s)})}};x(V,"nestedBoundarySequence",0),x(V,"perfEnabled",!1),x(V,"perfStats",new Map);let le=V;const mt={bootstrap:()=>{document.querySelectorAll("[pp-component]").forEach(t=>{new le(t)})}},me=class t{constructor(){x(this,"activeAbortController",null),x(this,"navigationEnabled",!1),x(this,"boundHandleLinkClick",null),x(this,"boundHandlePopState",null),x(this,"isNavigating",!1),x(this,"RESET_SCROLL_ATTR","pp-reset-scroll"),x(this,"mounted",!1)}mount(){this.mounted||(this.mounted=!0,this.disableTransitions(),mt.bootstrap(),this.restoreBodyAccessibility(),this.enableTransitions(),this.enableSPANavigation())}createComponentRuntime(e){const s={};for(const e of t.PUBLIC_METHODS){const t=this[e];"function"==typeof t?s[e]=t.bind(this):void 0!==t&&(s[e]=t)}return Object.assign({},s,e)}createContext(t){return Object.freeze({id:Symbol("pp.context"),defaultValue:t})}enablePerf(){le.setPerfEnabled(!0)}disablePerf(){le.setPerfEnabled(!1)}getPerfStats(){return le.getPerfStats()}resetPerfStats(){le.resetPerfStats()}getCsrfToken(){const t=document.cookie.match(/(?:^|;\s*)pp_csrf=([^;]*)/);return t?decodeURIComponent(t[1]):""}disableTransitions(){const t=document.createElement("style");t.id="pp-disable-transitions",t.textContent="\n *, *::before, *::after {\n transition: none !important;\n animation: none !important;\n }\n ",document.head.insertBefore(t,document.head.firstChild)}enableTransitions(){const t=document.getElementById("pp-disable-transitions");t&&t.remove()}restoreBodyAccessibility(){document.body.style.transition="",document.body.style.opacity="1",document.body.style.pointerEvents="auto",document.body.style.userSelect="auto",document.body.removeAttribute("inert"),document.body.setAttribute("aria-busy","false")}static resetInstance(){this.instance&&(this.instance.navigationEnabled&&this.instance.disableSPANavigation(),this.instance.activeAbortController&&(this.instance.activeAbortController.abort(),this.instance.activeAbortController=null),this.instance=null)}static getInstance(){return this.instance||(this.instance=new t),this.instance}enableSPANavigation(){this.navigationEnabled||"true"!==document.body.getAttribute("pp-spa")||(this.navigationEnabled=!0,this.boundHandleLinkClick=this.handleLinkClick.bind(this),this.boundHandlePopState=this.handlePopState.bind(this),document.addEventListener("click",this.boundHandleLinkClick),window.addEventListener("popstate",this.boundHandlePopState))}disableSPANavigation(){this.navigationEnabled=!1,this.boundHandleLinkClick&&(document.removeEventListener("click",this.boundHandleLinkClick),this.boundHandleLinkClick=null),this.boundHandlePopState&&(window.removeEventListener("popstate",this.boundHandlePopState),this.boundHandlePopState=null)}handleLinkClick(t){if(!this.navigationEnabled)return;const e=t.target.closest("a");if(e&&e.href)try{const s=new URL(e.href),i=s.origin!==window.location.origin,n=s.pathname===window.location.pathname&&s.search===window.location.search,r="false"===e.getAttribute("pp-spa");if(i||"_blank"===e.target||e.hasAttribute("download")||r||t.ctrlKey||t.metaKey||t.shiftKey||t.altKey)return;if(t.preventDefault(),n){const e=s.hash;if(e){t.preventDefault(),history.pushState(null,"",s.pathname+s.search+e);const i=document.querySelector(e);return void(i&&i.scrollIntoView({behavior:"smooth"}))}}this.navigateTo(s.pathname+s.search+s.hash)}catch(t){console.error("Link click navigation error:",t)}}async handlePopState(){const t=window.location.pathname+window.location.search+window.location.hash;await this.navigateTo(t,!1)}async navigateTo(t,e=!0){this.isNavigating=!0;const s=this.saveScrollPositions();try{this.dispatchNavigationEvent("start",t),await this.showLoadingTransition();const i=await this.fetchPageContent(t);if("hardReload"in i)return void(window.location.href=i.hardReload);if("redirect"in i)return void await this.navigateTo(i.redirect,e);const n=i;this.updateBrowserHistory(t,e);const r=document.getElementById("loading-file-1B87E"),a="startViewTransition"in document,o=this.getResetScrollConfig(n);!r&&a?await this.updatePageContentWithViewTransition(n):await this.updatePageContent(n),this.resetGlobalCaches(),mt.bootstrap(),this.handleScrollRestoration(s,o),await this.handleNavigationCompletion(),this.dispatchNavigationEvent("complete",t)}catch(e){this.handleNavigationError(t,e)}finally{this.isNavigating=!1}}resetGlobalCaches(){E.clear(),q.clearCaches(),xe.clearCache()}getResetScrollConfig(t){if("true"===t.body.getAttribute(this.RESET_SCROLL_ATTR))return{mode:"global",resetElementKeys:new Set,resetWindow:!1};const e=t.querySelectorAll(`[${this.RESET_SCROLL_ATTR}]`),s=new Set;let i=!1;if(e.length>0)for(const t of Array.from(e))if("true"===t.getAttribute(this.RESET_SCROLL_ATTR)){const e=this.getElementKeyFromElement(t);s.add(e),i=!0}return i||s.size>0?{mode:"none",resetElementKeys:s,resetWindow:i}:{mode:"none",resetElementKeys:new Set,resetWindow:!1}}getElementKeyFromElement(t){return t.id?t.id:t.className?t.className:t.tagName}handleScrollRestoration(t,e){requestAnimationFrame(()=>{if("global"===e.mode)return window.scrollTo(0,0),document.documentElement.scrollTop=0,document.documentElement.scrollLeft=0,void document.querySelectorAll("*").forEach(t=>{(t.scrollTop||t.scrollLeft)&&(t.scrollTop=0,t.scrollLeft=0)});if(e.resetWindow)window.scrollTo(0,0),document.documentElement.scrollTop=0,document.documentElement.scrollLeft=0;else{const e=t.window;e&&window.scrollTo(e.scrollLeft,e.scrollTop)}document.querySelectorAll("*").forEach(s=>{const i=s.tagName.toLowerCase();if(e.resetWindow&&("html"===i||"body"===i))return;const n=this.getElementKey(s);e.resetElementKeys.has(n)?(s.scrollTop=0,s.scrollLeft=0):t[n]&&(s.scrollTop=t[n].scrollTop,s.scrollLeft=t[n].scrollLeft)})})}saveScrollPositions(){const t={window:{scrollTop:window.scrollY||document.documentElement.scrollTop,scrollLeft:window.scrollX||document.documentElement.scrollLeft}};return document.querySelectorAll("*").forEach(e=>{(e.scrollTop||e.scrollLeft)&&(t[this.getElementKey(e)]={scrollTop:e.scrollTop,scrollLeft:e.scrollLeft})}),t}getElementKey(t){return t.id||t.className||t.tagName}async updatePageContentWithViewTransition(t){t.title&&(document.title=t.title);const e=t.body.innerHTML;if(this.syncBodyAttributes(t.body),this.isNavigating||!document.startViewTransition)return void(document.body.innerHTML=e);const s=document.startViewTransition(()=>{document.body.innerHTML=e});try{await s.finished}catch(t){console.warn("View transition failed, continuing anyway:",t)}}dispatchNavigationEvent(t,e,s){const i=`pp:navigation:${t}`,n=s?{url:e,error:s}:{url:e};document.dispatchEvent(new CustomEvent(i,{detail:n}))}async showLoadingTransition(){const t=document.getElementById("loading-file-1B87E");if(t){const e=this.findLoadingElement(t,window.location.pathname);if(e)return void await this.updateContentWithTransition(e)}const e=document.querySelector("[pp-loading-content='true']")||document.body;e&&!("startViewTransition"in document)&&await this.fadeOut(e,250)}async fetchPageContent(t){const e=new URL(t,window.location.origin).hash,s=await fetch(t,{headers:{"X-Requested-With":"XMLHttpRequest","X-PP-Navigation":"true","X-PulsePoint-Wire":"true",Accept:"text/html"}});if(!s.ok)throw new Error(`Navigation failed: ${s.status} ${s.statusText}`);const i=s.headers.get("X-PP-Root-Layout"),n=document.querySelector('meta[name="pp-root-layout"]'),r=n?n.getAttribute("content"):null;if(i&&r&&i!==r)return{hardReload:t};if(s.redirected){const t=new URL(s.url);if(e&&t.searchParams.has("next")){const s=t.searchParams.get("next");s&&!s.includes("#")&&t.searchParams.set("next",s+e)}return{redirect:t.pathname+t.search+t.hash}}const a=this.getRedirectUrlFromResponse(s);if(a)return{redirect:a};const o=await s.text();return(new DOMParser).parseFromString(o,"text/html")}getRedirectUrlFromResponse(t){const e=t.headers.get("X-PP-Redirect");if(e)return e;const s=t.headers.get("Location"),i=t.status;return s&&i>=300&&i<400?s:null}updateBrowserHistory(t,e){e&&history.pushState(null,"",t)}async updatePageContent(t){t.title&&(document.title=t.title);const e=t.body;this.syncBodyAttributes(e),document.body.innerHTML=e.innerHTML}syncBodyAttributes(t){t&&(Array.from(document.body.attributes).forEach(t=>{"style"!==t.name&&document.body.removeAttribute(t.name)}),Array.from(t.attributes).forEach(t=>{"style"!==t.name&&document.body.setAttribute(t.name,t.value)}))}async handleNavigationCompletion(){const t=document.querySelector("[pp-loading-content='true']")||document.body;this.fadeIn(t,150),setTimeout(()=>{this.restoreBodyAccessibility()},50);const e=window.location.hash;e&&requestAnimationFrame(()=>{const t=document.querySelector(e);t&&t.scrollIntoView({behavior:"smooth"})})}handleNavigationError(t,e){console.error("Navigation error:",e),this.restoreBodyAccessibility(),this.dispatchNavigationEvent("error",t,e),window.location.href=t}findLoadingElement(t,e){let s=e;for(;;){const e=t.querySelector(`div[pp-loading-url='${s}']`);if(e)return e;if("/"===s)break;const i=s.lastIndexOf("/");s=i<=0?"/":s.substring(0,i)}return t.querySelector("div[pp-loading-url='/' ]")}async updateContentWithTransition(t){const e=document.querySelector("[pp-loading-content='true']")||document.body;if(!e)return;const{fadeIn:s,fadeOut:i}=this.parseTransition(t);await this.fadeOut(e,i),e.innerHTML=t.innerHTML,this.fadeIn(e,s)}parseTransition(t){let e=250,s=250;const i=t.querySelector("[pp-loading-transition]"),n=null==i?void 0:i.getAttribute("pp-loading-transition");if(n){let t=JSON.parse(n);t&&"object"==typeof t?(e=this.parseTime(t.fadeIn??e),s=this.parseTime(t.fadeOut??s)):console.warn("pp-loading-transition is not valid JSON → default values (250 ms) will be used. String:",n)}return{fadeIn:e,fadeOut:s}}fadeOut(t,e){return new Promise(s=>{t.style.transition=`opacity ${e}ms ease-out`,setTimeout(()=>{t.style.transition="",s()},e)})}fadeIn(t,e){t.style.transition=`opacity ${e}ms ease-in`,setTimeout(()=>{t.style.transition=""},e)}parseTime(t){if("number"==typeof t)return t;const e=t.match(/^(\d+)(ms|s|m)?$/);if(e){const t=parseInt(e[1],10);switch(e[2]||"ms"){case"ms":default:return t;case"s":return 1e3*t;case"m":return 60*t*1e3}}return 0}async redirect(t){if(t)try{const e=new URL(t,window.location.origin);e.origin!==window.location.origin?window.location.href=t:this.navigationEnabled?await this.navigateTo(e.pathname+e.search+e.hash):window.location.href=t}catch(t){console.error("Redirect error:",t)}}async rpc(t,e={},s=!1){let i=null;const n="boolean"==typeof s?{abortPrevious:s}:s;try{n.abortPrevious&&this.activeAbortController&&(this.activeAbortController.abort(),this.activeAbortController=null),i=new AbortController,n.abortPrevious&&(this.activeAbortController=i);const s=window.location.pathname.replace(/\/+$/,"")||"/",r={"X-CSRF-Token":this.getCsrfToken(),"X-PP-RPC":"true","X-PulsePoint-Wire":"true","X-PP-Function":t,"X-Requested-With":"XMLHttpRequest",Accept:"application/json, text/event-stream"};let a;if(Object.values(e).some(t=>t instanceof File||t instanceof FileList&&t.length>0)){const t=new FormData;for(const[s,i]of Object.entries(e))i instanceof File?t.append(s,i):i instanceof FileList?Array.from(i).forEach(e=>t.append(s,e)):null!=i&&t.append(s,"object"==typeof i?JSON.stringify(i):String(i));if(n.onUploadProgress)return await this.xhrFunction({url:s,headers:r,body:t,controller:i,options:n});a={method:"POST",headers:r,body:t,signal:i.signal}}else a={method:"POST",headers:{...r,"Content-Type":"application/json"},body:JSON.stringify(e),signal:i.signal};const o=await fetch(s,a);if(401===o.status)throw new Error("Authentication required");if(403===o.status)throw new Error("Permission denied");if(!o.ok){const t=await o.json().catch(()=>null);throw t||415!==o.status?new Error((null==t?void 0:t.error)||`Request failed: ${o.status} ${o.statusText}`):new Error("Server rejected data format (415).")}const h=this.getRedirectUrlFromResponse(o);return h?(await this.redirect(h),{redirected:!0,to:h}):(this.activeAbortController===i&&(this.activeAbortController=null),(o.headers.get("Content-Type")||"").includes("text/event-stream")&&o.body?(n.onStream||console.warn("RPC returned a stream, but no onStream handler provided."),void await this.handleStream(o.body,n)):await o.json())}catch(t){if(this.activeAbortController===i&&(this.activeAbortController=null),t instanceof Error&&"AbortError"===t.name)return console.log("Request was cancelled"),{cancelled:!0};if(n.onStreamError)return void n.onStreamError(t);throw console.error("RPC error:",t),t}}xhrFunction(t){const{url:e,headers:s,body:i,controller:n,options:r}=t;return new Promise((t,a)=>{const o=new XMLHttpRequest;o.open("POST",e,!0);for(const[t,e]of Object.entries(s))o.setRequestHeader(t,e);const h=()=>{try{o.abort()}catch{}};n.signal.addEventListener("abort",h,{once:!0}),o.upload&&r.onUploadProgress&&(o.upload.onprogress=t=>{var e;const s=t.lengthComputable?t.total:null,i=t.lengthComputable&&t.total>0?Math.min(100,Math.max(0,t.loaded/t.total*100)):null;null==(e=r.onUploadProgress)||e.call(r,{loaded:t.loaded,total:s,percent:i})}),o.onerror=()=>{n.signal.removeEventListener("abort",h),a(new Error("Network error (XHR upload)."))},o.onload=async()=>{var e,s;if(n.signal.removeEventListener("abort",h),401===o.status)return a(new Error("Authentication required"));if(403===o.status)return a(new Error("Permission denied"));if(o.status<200||o.status>=300){let t=`Request failed: ${o.status} ${o.statusText}`;try{const e=JSON.parse(o.responseText||"{}");t=(null==e?void 0:e.error)||(null==e?void 0:e.message)||t}catch{}return a(new Error(t))}const i=o.getResponseHeader("X-PP-Redirect")||(o.status>=300&&o.status<400?o.getResponseHeader("Location"):null);if(i)try{return await this.redirect(i),null==(e=r.onUploadComplete)||e.call(r),t({redirected:!0,to:i})}catch(t){return a(t)}const c=o.responseText??"";let l=c;try{l=JSON.parse(c)}catch{}null==(s=r.onUploadComplete)||s.call(r),t(l)};try{o.send(i)}catch(t){n.signal.removeEventListener("abort",h),a(t)}})}async handleStream(t,e){const s=t.getReader(),i=new TextDecoder;let n="";try{for(;;){const{done:t,value:r}=await s.read();if(t){e.onStreamComplete&&e.onStreamComplete();break}n+=i.decode(r,{stream:!0});const a=n.split("\n");n=a.pop()||"";for(const t of a)if(""!==t.trim()&&t.startsWith("data: ")){const s=t.slice(6);let i=s;try{("true"===s||"false"===s||"null"===s||!isNaN(Number(s))||s.startsWith("{")||s.startsWith("[")||s.startsWith('"'))&&(i=JSON.parse(s))}catch{}e.onStream&&e.onStream(i)}}}catch(t){if(!e.onStreamError)throw t;e.onStreamError(t)}finally{s.releaseLock()}}};x(me,"instance",null),x(me,"PUBLIC_METHODS",["createContext","mount","redirect","rpc","enablePerf","disablePerf","getPerfStats","resetPerfStats"]);let Xe=me;const he=class t{constructor(){x(this,"listeners",[])}static getInstance(){return t.instance||(t.instance=new t),t.instance}get params(){return new URLSearchParams(window.location.search)}get(t){return this.params.get(t)}set(t,e){const s=this.params;s.set(t,e),this.updateURL(s)}delete(t){const e=this.params;e.delete(t),this.updateURL(e)}replace(t){const e=new URLSearchParams;for(const s in t){const i=t[s];null!==i&&e.set(s,i)}this.updateURL(e,!0)}updateURL(t,e=!1){const s=`${window.location.pathname}?${t.toString()}`;e?history.replaceState(null,"",s):history.pushState(null,"",s),this.notifyListeners(t)}listen(t){this.listeners.push(t)}notifyListeners(t){for(const e of this.listeners)e(t)}enablePopStateListener(){window.addEventListener("popstate",()=>{this.notifyListeners(this.params)})}};x(he,"instance",null);let Qe=he;function Zt(t,e,s=window,i=!0){let n=null;if(Object.defineProperty(s,t,{get(){if(null!==n)return n;if(e&&"object"==typeof e&&!Array.isArray(e)&&"getInstance"in e&&"function"==typeof e.getInstance)return n=e.getInstance(),n;if("function"!=typeof e)return n=e,n;try{return n=e.getInstance(),n}catch{return n=e,n}},set(e){null===e?n=null:console.warn(`Cannot override global ${t}`)},configurable:!0,enumerable:!0}),i)try{s[t]}catch(e){console.error(`Failed to initialize ${t}:`,e)}}Zt("pp",{getInstance:()=>{var t;const e=Xe.getInstance();return"loading"!==document.readyState?null==(t=e.mount)||t.call(e):document.addEventListener("DOMContentLoaded",()=>{var t;return null==(t=e.mount)?void 0:t.call(e)},{once:!0}),e}}),Zt("searchParams",Qe);export{mt as ComponentInit,Xe as PPUtilities,Qe as SearchParamsManager};
|
|
1
|
+
var ii=Object.defineProperty,si=(t,e,s)=>e in t?ii(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,x=(t,e,s)=>si(t,"symbol"!=typeof e?e+"":e,s);class ri{constructor(t){x(this,"hooks",[]),x(this,"currentIndex",0),x(this,"onStateChange"),x(this,"pendingLayoutEffects",[]),x(this,"pendingEffects",[]),x(this,"pendingUpdate",!1),x(this,"hasScheduledRender",!1),x(this,"batchedUpdates",new Set),x(this,"portalRegistrations",[]),x(this,"disposed",!1),this.onStateChange=t}loadState(t){this.hooks=[...t]}getHooks(){return this.hooks}prepareRender(){this.disposed||(this.currentIndex=0,this.pendingLayoutEffects=[],this.pendingEffects=[],this.portalRegistrations=[])}runLayoutEffects(){this.disposed||this.pendingLayoutEffects.forEach(t=>t()),this.pendingLayoutEffects=[]}runEffects(){this.disposed||this.pendingEffects.forEach(t=>t()),this.pendingEffects=[]}dispose(){this.disposed||(this.disposed=!0,this.pendingLayoutEffects=[],this.pendingEffects=[],this.pendingUpdate=!1,this.hasScheduledRender=!1,this.batchedUpdates.clear(),this.portalRegistrations=[],this.hooks.forEach(t=>{if(!t||"object"!=typeof t)return;const e=t.cleanup;if("function"==typeof e)try{e()}finally{t.cleanup=void 0}}),this.hooks=[],this.currentIndex=0)}usePortal(t,e){const s=this.currentIndex++;void 0===this.hooks[s]&&(this.hooks[s]={sourceParent:null});const i=this.hooks[s];return this.portalRegistrations.push({ref:t,target:e??null,info:i}),i}getPortalRegistrations(){return this.portalRegistrations}useState(t){const e=this.currentIndex++;if(void 0===this.hooks[e]){const s=this.hooks,i=e,n=this.batchedUpdates,r=()=>this.scheduleUpdate(),a=t=>{let e=t;"function"==typeof t&&(e=t(s[i].__state)),s[i].__state!==e&&(s[i].__state=e,n.add(i),r())};this.hooks[e]={__state:t,__setter:a}}const s=this.hooks[e];if("object"!=typeof s||null===s||!("__state"in s)){const t=s,i=this.hooks,n=e,r=this.batchedUpdates,a=()=>this.scheduleUpdate(),o=t=>{let e=t;"function"==typeof t&&(e=t(i[n].__state)),i[n].__state!==e&&(i[n].__state=e,r.add(n),a())};this.hooks[e]={__state:t,__setter:o}}return[this.hooks[e].__state,this.hooks[e].__setter]}scheduleUpdate(){this.disposed||(this.hasScheduledRender=!0,this.pendingUpdate||(this.pendingUpdate=!0,queueMicrotask(()=>{if(this.pendingUpdate=!1,this.disposed)return this.hasScheduledRender=!1,void this.batchedUpdates.clear();this.hasScheduledRender&&(this.hasScheduledRender=!1,this.batchedUpdates.clear(),this.onStateChange())})))}useRef(t=null){const e=this.currentIndex++;return void 0===this.hooks[e]&&(this.hooks[e]={current:t}),this.hooks[e]}useMemo(t,e){const s=this.currentIndex++,i=this.hooks[s];if(!i||this.areDepsDifferent(i.deps,e)){const i=t();return this.hooks[s]={value:i,deps:e},i}return i.value}useCallback(t,e){const s=this.currentIndex++,i=this.hooks[s];return!i||this.areDepsDifferent(i.deps,e)?(this.hooks[s]={callback:t,deps:e},t):i.callback}useReducer(t,e){const s=this.currentIndex++;if(void 0===this.hooks[s]){const i={state:e,reducer:t,dispatch:null};i.dispatch=t=>{const e=i.reducer(i.state,t);i.state!==e&&(i.state=e,this.scheduleUpdate())},this.hooks[s]=i}const i=this.hooks[s];return[i.state,i.dispatch]}useEffect(t,e){const s=this.currentIndex++,i=this.hooks[s];(!i||!e||!i.deps||this.areDepsDifferent(i.deps,e))&&this.pendingEffects.push(()=>{null!=i&&i.cleanup&&i.cleanup();const n=t();this.hooks[s]={deps:e,cleanup:"function"==typeof n?n:void 0}})}useLayoutEffect(t,e){const s=this.currentIndex++,i=this.hooks[s];(!i||!e||!i.deps||this.areDepsDifferent(i.deps,e))&&this.pendingLayoutEffects.push(()=>{null!=i&&i.cleanup&&i.cleanup();const n=t();this.hooks[s]={deps:e,cleanup:"function"==typeof n?n:void 0}})}areDepsDifferent(t,e){return t.length!==e.length||e.some((e,s)=>!Object.is(e,t[s]))}}class E{static saveState(t,e){t&&this.states.set(t,e)}static getState(t){return this.states.get(t)}static removeState(t){this.states.delete(t)}static saveScope(t,e){this.scopes.set(t,e)}static getScope(t){return this.scopes.get(t)}static getRootAncestor(t){let e=t;const s=new Set;for(;e&&!s.has(e);){s.add(e);const t=this.parents.get(e);if(!t)return e;e=t}return null}static resolveComponentId(t,e=null){if(!t)return null;if("app"!==t)return t;const s=new Set;let i=e,n=null;for(;i&&!s.has(i);){if(s.add(i),i.startsWith("page_"))return i;const t=this.parents.get(i)??null;if(!t){n=i;break}i=t}if(n)return n;for(const[t,e]of this.parents.entries())if(null===e&&this.scopes.has(t))return t;const r=this.scopes.keys().next().value;return"string"==typeof r?r:null}static getResolvedScope(t,e=null){const s=this.resolveComponentId(t,e);return s?this.scopes.get(s):void 0}static getResolvedScopeWithAncestors(t,e=null){const s=this.resolveComponentId(t,e);if(!s)return;const i=new Set,n=[];let r=s;for(;r&&!i.has(r);){i.add(r);const t=this.scopes.get(r);t&&n.push(t),r=this.parents.get(r)??null}return 0!==n.length?Object.assign({},...n.reverse()):void 0}static removeScope(t){this.scopes.delete(t)}static registerInstance(t,e){var s;const i=this.instances.get(t);i&&i!==e&&(null==(s=i.destroy)||s.call(i)),this.instances.set(t,e)}static getInstance(t){return this.instances.get(t)}static removeInstance(t){this.instances.delete(t)}static saveParent(t,e){t&&this.parents.set(t,e)}static getParent(t){return this.parents.get(t)}static removeParent(t){if(!this.parents.has(t))return;const e=this.parents.get(t)??null;this.parents.forEach((s,i)=>{s===t&&this.parents.set(i,e)}),this.parents.delete(t)}static saveContextValues(t,e){const s=this.contextValues.get(t)??new Map,i=new Set;return s.forEach((t,s)=>{e.has(s)||i.add(s)}),e.forEach((t,e)=>{s.has(e)&&Object.is(s.get(e),t)||i.add(e)}),e.size>0?this.contextValues.set(t,new Map(e)):this.contextValues.delete(t),Array.from(i)}static resolveContext(t,e){let s=t;for(;s;){const t=this.contextValues.get(s);if(null!=t&&t.has(e))return{providerId:s,value:t.get(e)};s=this.parents.get(s)??null}return{providerId:null,value:e.defaultValue}}static updateContextDependencies(t,e){const s=new Set(e),i=this.consumerContexts.get(t)??new Set;i.forEach(e=>{s.has(e)||this.removeContextConsumer(e,t)}),s.forEach(e=>{i.has(e)||this.addContextConsumer(e,t)}),s.size>0?this.consumerContexts.set(t,s):this.consumerContexts.delete(t)}static getConsumersForContextsInSubtree(t,e){const s=new Set;for(const i of e){const e=this.contextConsumers.get(i);e&&e.forEach(e=>{e!==t&&this.isAncestor(t,e)&&s.add(e)})}return s}static removeContextTracking(t){const e=this.contextValues.get(t),s=e?this.getConsumersForContextsInSubtree(t,e.keys()):new Set;this.contextValues.delete(t);const i=this.consumerContexts.get(t);return i&&(i.forEach(e=>{this.removeContextConsumer(e,t)}),this.consumerContexts.delete(t)),this.removeParent(t),s}static saveTemplate(t,e){this.templates.has(t)||this.templates.set(t,e)}static getTemplate(t){return this.templates.get(t)}static saveOwnedTemplates(t,e){this.ownedTemplateData.has(t)||this.ownedTemplateData.set(t,e)}static getOwnedTemplates(t){return this.ownedTemplateData.get(t)}static clear(){this.states.clear(),this.scopes.clear(),this.instances.clear(),this.parents.clear(),this.templates.clear(),this.ownedTemplateData.clear(),this.contextValues.clear(),this.consumerContexts.clear(),this.contextConsumers.clear()}static getStats(){return{states:this.states.size,scopes:this.scopes.size,instances:this.instances.size,parents:this.parents.size,templates:this.templates.size,ownedData:this.ownedTemplateData.size,contextValues:this.contextValues.size,contextConsumers:this.contextConsumers.size}}static addContextConsumer(t,e){const s=this.contextConsumers.get(t)??new Set;s.add(e),this.contextConsumers.set(t,s)}static removeContextConsumer(t,e){const s=this.contextConsumers.get(t);s&&(s.delete(e),0===s.size&&this.contextConsumers.delete(t))}static isAncestor(t,e){let s=this.parents.get(e)??null;for(;s;){if(s===t)return!0;s=this.parents.get(s)??null}return!1}}function ot(t){return t.includes("-")?t.replace(/-([a-z])/g,t=>t[1].toUpperCase()):t}x(E,"states",new Map),x(E,"scopes",new Map),x(E,"instances",new Map),x(E,"parents",new Map),x(E,"templates",new Map),x(E,"ownedTemplateData",new Map),x(E,"contextValues",new Map),x(E,"consumerContexts",new Map),x(E,"contextConsumers",new Map);const ut=new WeakMap;function de(t){const e=ut.get(t);if(e)return e;const s=Object.keys(t),i={keys:s,keySig:s.join("\0")};return ut.set(t,i),i}function me(t,e){const s=new Array(e.length);for(let i=0;i<e.length;i++)s[i]=t[e[i]];return s}const fe=new Map,ni=500;let He=null;function ie(t){if(!t.includes("&"))return t;if(fe.has(t))return fe.get(t);He||(He=document.createElement("textarea"));const e=He;e.innerHTML=t;let s=e.value,i=0;for(;s.includes("&")&&i++<10;){e.innerHTML=s;const t=e.value;if(t===s)break;s=t}if(fe.size>=ni){const t=fe.keys().next().value;void 0!==t&&fe.delete(t)}return fe.set(t,s),s}const te="data-pp-fragment-root";function vt(t){const e=String(t??"").trim().toLowerCase();switch(e){case"table":return{prefix:`<table ${te}="">`,suffix:"</table>",rootSelector:`table[${te}]`};case"thead":case"tbody":case"tfoot":return{prefix:`<table><${e} ${te}="">`,suffix:`</${e}></table>`,rootSelector:`${e}[${te}]`};case"tr":return{prefix:`<table><tbody><tr ${te}="">`,suffix:"</tr></tbody></table>",rootSelector:`tr[${te}]`};case"colgroup":return{prefix:`<table><colgroup ${te}="">`,suffix:"</colgroup></table>",rootSelector:`colgroup[${te}]`};default:return{prefix:"",suffix:"",rootSelector:null}}}function ai(t){const e=vt(t);return{wrap:t=>`${e.prefix}${t}${e.suffix}`,unwrap:t=>{if(!e.prefix&&!e.suffix)return t;const s=document.createElement("template");if(s.innerHTML=t,e.rootSelector){const t=s.content.querySelector(e.rootSelector);if(t)return t.innerHTML}return t}}}function Ue(t,e){const s=vt(e),i=document.createElement("template");if(i.innerHTML=`${s.prefix}${t}${s.suffix}`,!s.rootSelector)return{root:i.content,toHtml:()=>i.innerHTML};const n=i.content.querySelector(s.rootSelector);return n?(n.removeAttribute(te),{root:n,toHtml:()=>n.innerHTML}):{root:i.content,toHtml:()=>i.innerHTML}}function oi(t,e){if(t===e)return!0;if(!t||!e||"object"!=typeof t||"object"!=typeof e)return!1;const s=Object.keys(t),i=s.length;let n=0;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&(n++,n>i))return!1;if(n!==i)return!1;for(let n=0;n<i;n++){const i=s[n];if(t[i]!==e[i])return!1}return!0}class ui{constructor(t,e,s){x(this,"root"),x(this,"getScope"),x(this,"canBindElement"),x(this,"handlerCache",new Map),this.root=t,this.getScope=e,this.canBindElement=s??(t=>this.isRootOwnedElement(t))}clearCache(){this.handlerCache.clear()}resolveEventOwnerScope(t){const e=this.root.getAttribute("pp-component");return E.getResolvedScopeWithAncestors(t,e)}bindEvents(t){(t||this.fallbackCollectEventElements()).forEach(t=>{this.canBindElement(t)&&this.bindElementEvents(t)})}isRootOwnedElement(t){var e;if(t===this.root)return!0;let s=t.closest("[pp-component]");return t===s&&(s=(null==(e=t.parentElement)?void 0:e.closest("[pp-component]"))??null),s===this.root}bindElementEvents(t){const e=t.getAttribute("pp-event-owner");e&&t.removeAttribute("pp-event-owner");const s=[];Array.from(t.attributes).forEach(i=>{if(i.name.startsWith("on")&&!i.name.includes("-")){const n=i.name.slice(2).toLowerCase();let r=i.value.trim();const a=r.match(/^\{([\s\S]*)\}$/);a&&(r=a[1].trim()),s.push(i.name);const o=`__pp_bound_${n}`;if(t[o]===r)return;t[o]=r;const h=t[`__pp_handler_${n}`];h&&t.removeEventListener(n,h);const c=s=>{var i;if(e){const i=this.resolveEventOwnerScope(e);if(i)return void this.executeHandlerWithScope(r,s,i,t)}let n=t.closest("[pp-component]");n===t&&(n=(null==(i=t.parentElement)?void 0:i.closest("[pp-component]"))??null);const a=(null==n?void 0:n.getAttribute("pp-component"))||null;if(a){const e=E.getScope(a);if(e)return void this.executeHandlerWithScope(r,s,e,t)}this.executeHandler(r,s,t)};t[`__pp_handler_${n}`]=c,t.addEventListener(n,c)}}),s.forEach(e=>{t.removeAttribute(e)})}fallbackCollectEventElements(){const t=new Set,e=this.root.attributes;for(let s=0;s<e.length;s++)if(e[s].name.startsWith("on")&&!e[s].name.includes("-")){t.add(this.root);break}const s=this.root.querySelectorAll("*");for(let e=0;e<s.length;e++){const i=s[e],n=i.attributes;for(let e=0;e<n.length;e++)if(n[e].name.startsWith("on")&&!n[e].name.includes("-")){t.add(i);break}}return t}executeHandler(t,e,s){this.executeHandlerWithScope(t,e,this.getScope(),s)}executeHandlerWithScope(t,e,s,i){const n=de(s),r=n.keys,a=me(s,r);try{const s=this.getCompiledHandler(t,r,n.keySig).call(i??e.currentTarget??null,...a,e);"function"==typeof s&&s(e)}catch(e){console.error("[PP-ERROR] Handler failed:",e),console.error("Code:",t)}}getCompiledHandler(t,e,s){const i=t+"|"+s;if(!this.handlerCache.has(i)){if(this.handlerCache.size>500){const t=this.handlerCache.keys().next().value;t&&this.handlerCache.delete(t)}const s="\n const e = event;\n const $event = event;\n const target = event?.target;\n const currentTarget = event?.currentTarget;\n const el = event?.currentTarget;\n ";let n;try{n=new Function(...e,"event",`"use strict";${s} return (${t})`)}catch{n=new Function(...e,"event",`"use strict";${s} ${t}`)}this.handlerCache.set(i,n)}return this.handlerCache.get(i)}}var ci=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,80,3,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,343,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,726,6,110,6,6,9,4759,9,787719,239],bt=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,2,60,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,42,9,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,496,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191],hi="·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・",yt="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-Ა-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-Ꟑꟑꟓꟕ-ꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",qe={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},je="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",li={5:je,"5module":je+" export import",6:je+" const class extends export import super"},pi=/^in(stanceof)?$/,fi=new RegExp("["+yt+"]"),di=new RegExp("["+yt+hi+"]");function ze(t,e){for(var s=65536,i=0;i<e.length;i+=2){if((s+=e[i])>t)return!1;if((s+=e[i+1])>=t)return!0}return!1}function Q(t,e){return t<65?36===t:t<91||(t<97?95===t:t<123||(t<=65535?t>=170&&fi.test(String.fromCharCode(t)):!1!==e&&ze(t,bt)))}function oe(t,e){return t<48?36===t:t<58||!(t<65)&&(t<91||(t<97?95===t:t<123||(t<=65535?t>=170&&di.test(String.fromCharCode(t)):!1!==e&&(ze(t,bt)||ze(t,ci)))))}var k=function(t,e){void 0===e&&(e={}),this.label=t,this.keyword=e.keyword,this.beforeExpr=!!e.beforeExpr,this.startsExpr=!!e.startsExpr,this.isLoop=!!e.isLoop,this.isAssign=!!e.isAssign,this.prefix=!!e.prefix,this.postfix=!!e.postfix,this.binop=e.binop||null,this.updateContext=null};function j(t,e){return new k(t,{beforeExpr:!0,binop:e})}var W={beforeExpr:!0},H={startsExpr:!0},Je={};function _(t,e){return void 0===e&&(e={}),e.keyword=t,Je[t]=new k(t,e)}var o={num:new k("num",H),regexp:new k("regexp",H),string:new k("string",H),name:new k("name",H),privateId:new k("privateId",H),eof:new k("eof"),bracketL:new k("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new k("]"),braceL:new k("{",{beforeExpr:!0,startsExpr:!0}),braceR:new k("}"),parenL:new k("(",{beforeExpr:!0,startsExpr:!0}),parenR:new k(")"),comma:new k(",",W),semi:new k(";",W),colon:new k(":",W),dot:new k("."),question:new k("?",W),questionDot:new k("?."),arrow:new k("=>",W),template:new k("template"),invalidTemplate:new k("invalidTemplate"),ellipsis:new k("...",W),backQuote:new k("`",H),dollarBraceL:new k("${",{beforeExpr:!0,startsExpr:!0}),eq:new k("=",{beforeExpr:!0,isAssign:!0}),assign:new k("_=",{beforeExpr:!0,isAssign:!0}),incDec:new k("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new k("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:j("||",1),logicalAND:j("&&",2),bitwiseOR:j("|",3),bitwiseXOR:j("^",4),bitwiseAND:j("&",5),equality:j("==/!=/===/!==",6),relational:j("</>/<=/>=",7),bitShift:j("<</>>/>>>",8),plusMin:new k("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:j("%",10),star:j("*",10),slash:j("/",10),starstar:new k("**",{beforeExpr:!0}),coalesce:j("??",1),_break:_("break"),_case:_("case",W),_catch:_("catch"),_continue:_("continue"),_debugger:_("debugger"),_default:_("default",W),_do:_("do",{isLoop:!0,beforeExpr:!0}),_else:_("else",W),_finally:_("finally"),_for:_("for",{isLoop:!0}),_function:_("function",H),_if:_("if"),_return:_("return",W),_switch:_("switch"),_throw:_("throw",W),_try:_("try"),_var:_("var"),_const:_("const"),_while:_("while",{isLoop:!0}),_with:_("with"),_new:_("new",{beforeExpr:!0,startsExpr:!0}),_this:_("this",H),_super:_("super",H),_class:_("class",H),_extends:_("extends",W),_export:_("export"),_import:_("import",H),_null:_("null",H),_true:_("true",H),_false:_("false",H),_in:_("in",{beforeExpr:!0,binop:7}),_instanceof:_("instanceof",{beforeExpr:!0,binop:7}),_typeof:_("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:_("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:_("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},U=/\r\n?|\n|\u2028|\u2029/,mi=new RegExp(U.source,"g");function ge(t){return 10===t||13===t||8232===t||8233===t}function Ct(t,e,s){void 0===s&&(s=t.length);for(var i=e;i<s;i++){var n=t.charCodeAt(i);if(ge(n))return i<s-1&&13===n&&10===t.charCodeAt(i+1)?i+2:i+1}return-1}var St=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,F=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,Et=Object.prototype,xi=Et.hasOwnProperty,gi=Et.toString,ve=Object.hasOwn||function(t,e){return xi.call(t,e)},ct=Array.isArray||function(t){return"[object Array]"===gi.call(t)},ht=Object.create(null);function ae(t){return ht[t]||(ht[t]=new RegExp("^(?:"+t.replace(/ /g,"|")+")$"))}function se(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}var vi=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,we=function(t,e){this.line=t,this.column=e};we.prototype.offset=function(t){return new we(this.line,this.column+t)};var Ve=function(t,e,s){this.start=e,this.end=s,null!==t.sourceFile&&(this.source=t.sourceFile)};function wt(t,e){for(var s=1,i=0;;){var n=Ct(t,i,e);if(n<0)return new we(s,e-i);++s,i=n}}var Ge={ecmaVersion:null,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},lt=!1;function bi(t){var e={};for(var s in Ge)e[s]=t&&ve(t,s)?t[s]:Ge[s];if("latest"===e.ecmaVersion?e.ecmaVersion=1e8:null==e.ecmaVersion?(!lt&&"object"==typeof console&&console.warn&&(lt=!0,console.warn("Since Acorn 8.0.0, options.ecmaVersion is required.\nDefaulting to 2020, but this will stop working in the future.")),e.ecmaVersion=11):e.ecmaVersion>=2015&&(e.ecmaVersion-=2009),null==e.allowReserved&&(e.allowReserved=e.ecmaVersion<5),(!t||null==t.allowHashBang)&&(e.allowHashBang=e.ecmaVersion>=14),ct(e.onToken)){var i=e.onToken;e.onToken=function(t){return i.push(t)}}return ct(e.onComment)&&(e.onComment=yi(e,e.onComment)),e}function yi(t,e){return function(s,i,n,r,a,o){var h={type:s?"Block":"Line",value:i,start:n,end:r};t.locations&&(h.loc=new Ve(this,a,o)),t.ranges&&(h.range=[n,r]),e.push(h)}}var _e=1,be=2,et=4,_t=8,tt=16,kt=32,Oe=64,At=128,le=256,Ae=512,Me=_e|be|le;function it(t,e){return be|(t?et:0)|(e?_t:0)}var Te=0,st=1,ne=2,Pt=3,It=4,Tt=5,R=function(t,e,s){this.options=t=bi(t),this.sourceFile=t.sourceFile,this.keywords=ae(li[t.ecmaVersion>=6?6:"module"===t.sourceType?"5module":5]);var i="";!0!==t.allowReserved&&(i=qe[t.ecmaVersion>=6?6:5===t.ecmaVersion?5:3],"module"===t.sourceType&&(i+=" await")),this.reservedWords=ae(i);var n=(i?i+" ":"")+qe.strict;this.reservedWordsStrict=ae(n),this.reservedWordsStrictBind=ae(n+" "+qe.strictBind),this.input=String(e),this.containsEsc=!1,s?(this.pos=s,this.lineStart=this.input.lastIndexOf("\n",s-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(U).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=o.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule="module"===t.sourceType,this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),0===this.pos&&t.allowHashBang&&"#!"===this.input.slice(0,2)&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(_e),this.regexpState=null,this.privateNameStack=[]},Y={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},inClassStaticBlock:{configurable:!0}};R.prototype.parse=function(){var t=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(t)},Y.inFunction.get=function(){return(this.currentVarScope().flags&be)>0},Y.inGenerator.get=function(){return(this.currentVarScope().flags&_t)>0},Y.inAsync.get=function(){return(this.currentVarScope().flags&et)>0},Y.canAwait.get=function(){for(var t=this.scopeStack.length-1;t>=0;t--){var e=this.scopeStack[t].flags;if(e&(le|Ae))return!1;if(e&be)return(e&et)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},Y.allowSuper.get=function(){return(this.currentThisScope().flags&Oe)>0||this.options.allowSuperOutsideMethod},Y.allowDirectSuper.get=function(){return(this.currentThisScope().flags&At)>0},Y.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},Y.allowNewDotTarget.get=function(){for(var t=this.scopeStack.length-1;t>=0;t--){var e=this.scopeStack[t].flags;if(e&(le|Ae)||e&be&&!(e&tt))return!0}return!1},Y.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&le)>0},R.extend=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];for(var s=this,i=0;i<t.length;i++)s=t[i](s);return s},R.parse=function(t,e){return new this(e,t).parse()},R.parseExpressionAt=function(t,e,s){var i=new this(s,t,e);return i.nextToken(),i.parseExpression()},R.tokenizer=function(t,e){return new this(e,t)},Object.defineProperties(R.prototype,Y);var B=R.prototype,Ci=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;B.strictDirective=function(t){if(this.options.ecmaVersion<5)return!1;for(;;){F.lastIndex=t,t+=F.exec(this.input)[0].length;var e=Ci.exec(this.input.slice(t));if(!e)return!1;if("use strict"===(e[1]||e[2])){F.lastIndex=t+e[0].length;var s=F.exec(this.input),i=s.index+s[0].length,n=this.input.charAt(i);return";"===n||"}"===n||U.test(s[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(n)||"!"===n&&"="===this.input.charAt(i+1))}t+=e[0].length,F.lastIndex=t,t+=F.exec(this.input)[0].length,";"===this.input[t]&&t++}},B.eat=function(t){return this.type===t&&(this.next(),!0)},B.isContextual=function(t){return this.type===o.name&&this.value===t&&!this.containsEsc},B.eatContextual=function(t){return!!this.isContextual(t)&&(this.next(),!0)},B.expectContextual=function(t){this.eatContextual(t)||this.unexpected()},B.canInsertSemicolon=function(){return this.type===o.eof||this.type===o.braceR||U.test(this.input.slice(this.lastTokEnd,this.start))},B.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},B.semicolon=function(){!this.eat(o.semi)&&!this.insertSemicolon()&&this.unexpected()},B.afterTrailingComma=function(t,e){if(this.type===t)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),e||this.next(),!0},B.expect=function(t){this.eat(t)||this.unexpected()},B.unexpected=function(t){this.raise(t??this.start,"Unexpected token")};var Fe=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};B.checkPatternErrors=function(t,e){if(t){t.trailingComma>-1&&this.raiseRecoverable(t.trailingComma,"Comma is not permitted after the rest element");var s=e?t.parenthesizedAssign:t.parenthesizedBind;s>-1&&this.raiseRecoverable(s,e?"Assigning to rvalue":"Parenthesized pattern")}},B.checkExpressionErrors=function(t,e){if(!t)return!1;var s=t.shorthandAssign,i=t.doubleProto;if(!e)return s>=0||i>=0;s>=0&&this.raise(s,"Shorthand property assignments are valid only in destructuring patterns"),i>=0&&this.raiseRecoverable(i,"Redefinition of __proto__ property")},B.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,"Yield expression cannot be a default value"),this.awaitPos&&this.raise(this.awaitPos,"Await expression cannot be a default value")},B.isSimpleAssignTarget=function(t){return"ParenthesizedExpression"===t.type?this.isSimpleAssignTarget(t.expression):"Identifier"===t.type||"MemberExpression"===t.type};var b=R.prototype;b.parseTopLevel=function(t){var e=Object.create(null);for(t.body||(t.body=[]);this.type!==o.eof;){var s=this.parseStatement(null,!0,e);t.body.push(s)}if(this.inModule)for(var i=0,n=Object.keys(this.undefinedExports);i<n.length;i+=1){var r=n[i];this.raiseRecoverable(this.undefinedExports[r].start,"Export '"+r+"' is not defined")}return this.adaptDirectivePrologue(t.body),this.next(),t.sourceType=this.options.sourceType,this.finishNode(t,"Program")};var rt={kind:"loop"},Si={kind:"switch"};b.isLet=function(t){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;F.lastIndex=this.pos;var e=F.exec(this.input),s=this.pos+e[0].length,i=this.input.charCodeAt(s);if(91===i||92===i)return!0;if(t)return!1;if(123===i||i>55295&&i<56320)return!0;if(Q(i,!0)){for(var n=s+1;oe(i=this.input.charCodeAt(n),!0);)++n;if(92===i||i>55295&&i<56320)return!0;var r=this.input.slice(s,n);if(!pi.test(r))return!0}return!1},b.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;F.lastIndex=this.pos;var t,e=F.exec(this.input),s=this.pos+e[0].length;return!(U.test(this.input.slice(this.pos,s))||"function"!==this.input.slice(s,s+8)||s+8!==this.input.length&&(oe(t=this.input.charCodeAt(s+8))||t>55295&&t<56320))},b.isUsingKeyword=function(t,e){if(this.options.ecmaVersion<17||!this.isContextual(t?"await":"using"))return!1;F.lastIndex=this.pos;var s=F.exec(this.input),i=this.pos+s[0].length;if(U.test(this.input.slice(this.pos,i)))return!1;if(t){var n,r=i+5;if("using"!==this.input.slice(i,r)||r===this.input.length||oe(n=this.input.charCodeAt(r))||n>55295&&n<56320)return!1;F.lastIndex=r;var a=F.exec(this.input);if(a&&U.test(this.input.slice(r,r+a[0].length)))return!1}if(e){var o,h=i+2;if(!("of"!==this.input.slice(i,h)||h!==this.input.length&&(oe(o=this.input.charCodeAt(h))||o>55295&&o<56320)))return!1}var c=this.input.charCodeAt(i);return Q(c,!0)||92===c},b.isAwaitUsing=function(t){return this.isUsingKeyword(!0,t)},b.isUsing=function(t){return this.isUsingKeyword(!1,t)},b.parseStatement=function(t,e,s){var i,n=this.type,r=this.startNode();switch(this.isLet(t)&&(n=o._var,i="let"),n){case o._break:case o._continue:return this.parseBreakContinueStatement(r,n.keyword);case o._debugger:return this.parseDebuggerStatement(r);case o._do:return this.parseDoStatement(r);case o._for:return this.parseForStatement(r);case o._function:return t&&(this.strict||"if"!==t&&"label"!==t)&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(r,!1,!t);case o._class:return t&&this.unexpected(),this.parseClass(r,!0);case o._if:return this.parseIfStatement(r);case o._return:return this.parseReturnStatement(r);case o._switch:return this.parseSwitchStatement(r);case o._throw:return this.parseThrowStatement(r);case o._try:return this.parseTryStatement(r);case o._const:case o._var:return i=i||this.value,t&&"var"!==i&&this.unexpected(),this.parseVarStatement(r,i);case o._while:return this.parseWhileStatement(r);case o._with:return this.parseWithStatement(r);case o.braceL:return this.parseBlock(!0,r);case o.semi:return this.parseEmptyStatement(r);case o._export:case o._import:if(this.options.ecmaVersion>10&&n===o._import){F.lastIndex=this.pos;var a=F.exec(this.input),h=this.pos+a[0].length,c=this.input.charCodeAt(h);if(40===c||46===c)return this.parseExpressionStatement(r,this.parseExpression())}return this.options.allowImportExportEverywhere||(e||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),n===o._import?this.parseImport(r):this.parseExport(r,s);default:if(this.isAsyncFunction())return t&&this.unexpected(),this.next(),this.parseFunctionStatement(r,!0,!t);var l=this.isAwaitUsing(!1)?"await using":this.isUsing(!1)?"using":null;if(l)return e&&"script"===this.options.sourceType&&this.raise(this.start,"Using declaration cannot appear in the top level when source type is `script`"),"await using"===l&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.next(),this.parseVar(r,!1,l),this.semicolon(),this.finishNode(r,"VariableDeclaration");var p=this.value,u=this.parseExpression();return n===o.name&&"Identifier"===u.type&&this.eat(o.colon)?this.parseLabeledStatement(r,p,u,t):this.parseExpressionStatement(r,u)}},b.parseBreakContinueStatement=function(t,e){var s="break"===e;this.next(),this.eat(o.semi)||this.insertSemicolon()?t.label=null:this.type!==o.name?this.unexpected():(t.label=this.parseIdent(),this.semicolon());for(var i=0;i<this.labels.length;++i){var n=this.labels[i];if((null==t.label||n.name===t.label.name)&&(null!=n.kind&&(s||"loop"===n.kind)||t.label&&s))break}return i===this.labels.length&&this.raise(t.start,"Unsyntactic "+e),this.finishNode(t,s?"BreakStatement":"ContinueStatement")},b.parseDebuggerStatement=function(t){return this.next(),this.semicolon(),this.finishNode(t,"DebuggerStatement")},b.parseDoStatement=function(t){return this.next(),this.labels.push(rt),t.body=this.parseStatement("do"),this.labels.pop(),this.expect(o._while),t.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(o.semi):this.semicolon(),this.finishNode(t,"DoWhileStatement")},b.parseForStatement=function(t){this.next();var e=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(rt),this.enterScope(0),this.expect(o.parenL),this.type===o.semi)return e>-1&&this.unexpected(e),this.parseFor(t,null);var s=this.isLet();if(this.type===o._var||this.type===o._const||s){var i=this.startNode(),n=s?"let":this.value;return this.next(),this.parseVar(i,!0,n),this.finishNode(i,"VariableDeclaration"),this.parseForAfterInit(t,i,e)}var r=this.isContextual("let"),a=!1,h=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(h){var c=this.startNode();return this.next(),"await using"===h&&this.next(),this.parseVar(c,!0,h),this.finishNode(c,"VariableDeclaration"),this.parseForAfterInit(t,c,e)}var l=this.containsEsc,p=new Fe,u=this.start,d=e>-1?this.parseExprSubscripts(p,"await"):this.parseExpression(!0,p);return this.type===o._in||(a=this.options.ecmaVersion>=6&&this.isContextual("of"))?(e>-1?(this.type===o._in&&this.unexpected(e),t.await=!0):a&&this.options.ecmaVersion>=8&&(d.start!==u||l||"Identifier"!==d.type||"async"!==d.name?this.options.ecmaVersion>=9&&(t.await=!1):this.unexpected()),r&&a&&this.raise(d.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(d,!1,p),this.checkLValPattern(d),this.parseForIn(t,d)):(this.checkExpressionErrors(p,!0),e>-1&&this.unexpected(e),this.parseFor(t,d))},b.parseForAfterInit=function(t,e,s){return(this.type===o._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&1===e.declarations.length?(this.options.ecmaVersion>=9&&(this.type===o._in?s>-1&&this.unexpected(s):t.await=s>-1),this.parseForIn(t,e)):(s>-1&&this.unexpected(s),this.parseFor(t,e))},b.parseFunctionStatement=function(t,e,s){return this.next(),this.parseFunction(t,Ee|(s?0:Xe),!1,e)},b.parseIfStatement=function(t){return this.next(),t.test=this.parseParenExpression(),t.consequent=this.parseStatement("if"),t.alternate=this.eat(o._else)?this.parseStatement("if"):null,this.finishNode(t,"IfStatement")},b.parseReturnStatement=function(t){return!this.inFunction&&!this.options.allowReturnOutsideFunction&&this.raise(this.start,"'return' outside of function"),this.next(),this.eat(o.semi)||this.insertSemicolon()?t.argument=null:(t.argument=this.parseExpression(),this.semicolon()),this.finishNode(t,"ReturnStatement")},b.parseSwitchStatement=function(t){this.next(),t.discriminant=this.parseParenExpression(),t.cases=[],this.expect(o.braceL),this.labels.push(Si),this.enterScope(0);for(var e,s=!1;this.type!==o.braceR;)if(this.type===o._case||this.type===o._default){var i=this.type===o._case;e&&this.finishNode(e,"SwitchCase"),t.cases.push(e=this.startNode()),e.consequent=[],this.next(),i?e.test=this.parseExpression():(s&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),s=!0,e.test=null),this.expect(o.colon)}else e||this.unexpected(),e.consequent.push(this.parseStatement(null));return this.exitScope(),e&&this.finishNode(e,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(t,"SwitchStatement")},b.parseThrowStatement=function(t){return this.next(),U.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),t.argument=this.parseExpression(),this.semicolon(),this.finishNode(t,"ThrowStatement")};var Ei=[];b.parseCatchClauseParam=function(){var t=this.parseBindingAtom(),e="Identifier"===t.type;return this.enterScope(e?kt:0),this.checkLValPattern(t,e?It:ne),this.expect(o.parenR),t},b.parseTryStatement=function(t){if(this.next(),t.block=this.parseBlock(),t.handler=null,this.type===o._catch){var e=this.startNode();this.next(),this.eat(o.parenL)?e.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),e.param=null,this.enterScope(0)),e.body=this.parseBlock(!1),this.exitScope(),t.handler=this.finishNode(e,"CatchClause")}return t.finalizer=this.eat(o._finally)?this.parseBlock():null,!t.handler&&!t.finalizer&&this.raise(t.start,"Missing catch or finally clause"),this.finishNode(t,"TryStatement")},b.parseVarStatement=function(t,e,s){return this.next(),this.parseVar(t,!1,e,s),this.semicolon(),this.finishNode(t,"VariableDeclaration")},b.parseWhileStatement=function(t){return this.next(),t.test=this.parseParenExpression(),this.labels.push(rt),t.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(t,"WhileStatement")},b.parseWithStatement=function(t){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),t.object=this.parseParenExpression(),t.body=this.parseStatement("with"),this.finishNode(t,"WithStatement")},b.parseEmptyStatement=function(t){return this.next(),this.finishNode(t,"EmptyStatement")},b.parseLabeledStatement=function(t,e,s,i){for(var n=0,r=this.labels;n<r.length;n+=1){r[n].name===e&&this.raise(s.start,"Label '"+e+"' is already declared")}for(var a=this.type.isLoop?"loop":this.type===o._switch?"switch":null,h=this.labels.length-1;h>=0;h--){var c=this.labels[h];if(c.statementStart!==t.start)break;c.statementStart=this.start,c.kind=a}return this.labels.push({name:e,kind:a,statementStart:this.start}),t.body=this.parseStatement(i?-1===i.indexOf("label")?i+"label":i:"label"),this.labels.pop(),t.label=s,this.finishNode(t,"LabeledStatement")},b.parseExpressionStatement=function(t,e){return t.expression=e,this.semicolon(),this.finishNode(t,"ExpressionStatement")},b.parseBlock=function(t,e,s){for(void 0===t&&(t=!0),void 0===e&&(e=this.startNode()),e.body=[],this.expect(o.braceL),t&&this.enterScope(0);this.type!==o.braceR;){var i=this.parseStatement(null);e.body.push(i)}return s&&(this.strict=!1),this.next(),t&&this.exitScope(),this.finishNode(e,"BlockStatement")},b.parseFor=function(t,e){return t.init=e,this.expect(o.semi),t.test=this.type===o.semi?null:this.parseExpression(),this.expect(o.semi),t.update=this.type===o.parenR?null:this.parseExpression(),this.expect(o.parenR),t.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(t,"ForStatement")},b.parseForIn=function(t,e){var s=this.type===o._in;return this.next(),"VariableDeclaration"===e.type&&null!=e.declarations[0].init&&(!s||this.options.ecmaVersion<8||this.strict||"var"!==e.kind||"Identifier"!==e.declarations[0].id.type)&&this.raise(e.start,(s?"for-in":"for-of")+" loop variable declaration may not have an initializer"),t.left=e,t.right=s?this.parseExpression():this.parseMaybeAssign(),this.expect(o.parenR),t.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(t,s?"ForInStatement":"ForOfStatement")},b.parseVar=function(t,e,s,i){for(t.declarations=[],t.kind=s;;){var n=this.startNode();if(this.parseVarId(n,s),this.eat(o.eq)?n.init=this.parseMaybeAssign(e):i||"const"!==s||this.type===o._in||this.options.ecmaVersion>=6&&this.isContextual("of")?i||"using"!==s&&"await using"!==s||!(this.options.ecmaVersion>=17)||this.type===o._in||this.isContextual("of")?i||"Identifier"===n.id.type||e&&(this.type===o._in||this.isContextual("of"))?n.init=null:this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):this.raise(this.lastTokEnd,"Missing initializer in "+s+" declaration"):this.unexpected(),t.declarations.push(this.finishNode(n,"VariableDeclarator")),!this.eat(o.comma))break}return t},b.parseVarId=function(t,e){t.id="using"===e||"await using"===e?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(t.id,"var"===e?st:ne,!1)};var Ee=1,Xe=2,Nt=4;function wi(t,e){var s=e.key.name,i=t[s],n="true";return"MethodDefinition"===e.type&&("get"===e.kind||"set"===e.kind)&&(n=(e.static?"s":"i")+e.kind),"iget"===i&&"iset"===n||"iset"===i&&"iget"===n||"sget"===i&&"sset"===n||"sset"===i&&"sget"===n?(t[s]="true",!1):!!i||(t[s]=n,!1)}function Ne(t,e){var s=t.computed,i=t.key;return!s&&("Identifier"===i.type&&i.name===e||"Literal"===i.type&&i.value===e)}b.parseFunction=function(t,e,s,i,n){this.initFunction(t),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!i)&&(this.type===o.star&&e&Xe&&this.unexpected(),t.generator=this.eat(o.star)),this.options.ecmaVersion>=8&&(t.async=!!i),e&Ee&&(t.id=e&Nt&&this.type!==o.name?null:this.parseIdent(),t.id&&!(e&Xe)&&this.checkLValSimple(t.id,this.strict||t.generator||t.async?this.treatFunctionsAsVar?st:ne:Pt));var r=this.yieldPos,a=this.awaitPos,h=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(it(t.async,t.generator)),e&Ee||(t.id=this.type===o.name?this.parseIdent():null),this.parseFunctionParams(t),this.parseFunctionBody(t,s,!1,n),this.yieldPos=r,this.awaitPos=a,this.awaitIdentPos=h,this.finishNode(t,e&Ee?"FunctionDeclaration":"FunctionExpression")},b.parseFunctionParams=function(t){this.expect(o.parenL),t.params=this.parseBindingList(o.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},b.parseClass=function(t,e){this.next();var s=this.strict;this.strict=!0,this.parseClassId(t,e),this.parseClassSuper(t);var i=this.enterClassBody(),n=this.startNode(),r=!1;for(n.body=[],this.expect(o.braceL);this.type!==o.braceR;){var a=this.parseClassElement(null!==t.superClass);a&&(n.body.push(a),"MethodDefinition"===a.type&&"constructor"===a.kind?(r&&this.raiseRecoverable(a.start,"Duplicate constructor in the same class"),r=!0):a.key&&"PrivateIdentifier"===a.key.type&&wi(i,a)&&this.raiseRecoverable(a.key.start,"Identifier '#"+a.key.name+"' has already been declared"))}return this.strict=s,this.next(),t.body=this.finishNode(n,"ClassBody"),this.exitClassBody(),this.finishNode(t,e?"ClassDeclaration":"ClassExpression")},b.parseClassElement=function(t){if(this.eat(o.semi))return null;var e=this.options.ecmaVersion,s=this.startNode(),i="",n=!1,r=!1,a="method",h=!1;if(this.eatContextual("static")){if(e>=13&&this.eat(o.braceL))return this.parseClassStaticBlock(s),s;this.isClassElementNameStart()||this.type===o.star?h=!0:i="static"}if(s.static=h,!i&&e>=8&&this.eatContextual("async")&&(!this.isClassElementNameStart()&&this.type!==o.star||this.canInsertSemicolon()?i="async":r=!0),!i&&(e>=9||!r)&&this.eat(o.star)&&(n=!0),!i&&!r&&!n){var c=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?a=c:i=c)}if(i?(s.computed=!1,s.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),s.key.name=i,this.finishNode(s.key,"Identifier")):this.parseClassElementName(s),e<13||this.type===o.parenL||"method"!==a||n||r){var l=!s.static&&Ne(s,"constructor"),p=l&&t;l&&"method"!==a&&this.raise(s.key.start,"Constructor can't have get/set modifier"),s.kind=l?"constructor":a,this.parseClassMethod(s,n,r,p)}else this.parseClassField(s);return s},b.isClassElementNameStart=function(){return this.type===o.name||this.type===o.privateId||this.type===o.num||this.type===o.string||this.type===o.bracketL||this.type.keyword},b.parseClassElementName=function(t){this.type===o.privateId?("constructor"===this.value&&this.raise(this.start,"Classes can't have an element named '#constructor'"),t.computed=!1,t.key=this.parsePrivateIdent()):this.parsePropertyName(t)},b.parseClassMethod=function(t,e,s,i){var n=t.key;"constructor"===t.kind?(e&&this.raise(n.start,"Constructor can't be a generator"),s&&this.raise(n.start,"Constructor can't be an async method")):t.static&&Ne(t,"prototype")&&this.raise(n.start,"Classes may not have a static property named prototype");var r=t.value=this.parseMethod(e,s,i);return"get"===t.kind&&0!==r.params.length&&this.raiseRecoverable(r.start,"getter should have no params"),"set"===t.kind&&1!==r.params.length&&this.raiseRecoverable(r.start,"setter should have exactly one param"),"set"===t.kind&&"RestElement"===r.params[0].type&&this.raiseRecoverable(r.params[0].start,"Setter cannot use rest params"),this.finishNode(t,"MethodDefinition")},b.parseClassField=function(t){return Ne(t,"constructor")?this.raise(t.key.start,"Classes can't have a field named 'constructor'"):t.static&&Ne(t,"prototype")&&this.raise(t.key.start,"Classes can't have a static field named 'prototype'"),this.eat(o.eq)?(this.enterScope(Ae|Oe),t.value=this.parseMaybeAssign(),this.exitScope()):t.value=null,this.semicolon(),this.finishNode(t,"PropertyDefinition")},b.parseClassStaticBlock=function(t){t.body=[];var e=this.labels;for(this.labels=[],this.enterScope(le|Oe);this.type!==o.braceR;){var s=this.parseStatement(null);t.body.push(s)}return this.next(),this.exitScope(),this.labels=e,this.finishNode(t,"StaticBlock")},b.parseClassId=function(t,e){this.type===o.name?(t.id=this.parseIdent(),e&&this.checkLValSimple(t.id,ne,!1)):(!0===e&&this.unexpected(),t.id=null)},b.parseClassSuper=function(t){t.superClass=this.eat(o._extends)?this.parseExprSubscripts(null,!1):null},b.enterClassBody=function(){var t={declared:Object.create(null),used:[]};return this.privateNameStack.push(t),t.declared},b.exitClassBody=function(){var t=this.privateNameStack.pop(),e=t.declared,s=t.used;if(this.options.checkPrivateFields)for(var i=this.privateNameStack.length,n=0===i?null:this.privateNameStack[i-1],r=0;r<s.length;++r){var a=s[r];ve(e,a.name)||(n?n.used.push(a):this.raiseRecoverable(a.start,"Private field '#"+a.name+"' must be declared in an enclosing class"))}},b.parseExportAllDeclaration=function(t,e){return this.options.ecmaVersion>=11&&(this.eatContextual("as")?(t.exported=this.parseModuleExportName(),this.checkExport(e,t.exported,this.lastTokStart)):t.exported=null),this.expectContextual("from"),this.type!==o.string&&this.unexpected(),t.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(t.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(t,"ExportAllDeclaration")},b.parseExport=function(t,e){if(this.next(),this.eat(o.star))return this.parseExportAllDeclaration(t,e);if(this.eat(o._default))return this.checkExport(e,"default",this.lastTokStart),t.declaration=this.parseExportDefaultDeclaration(),this.finishNode(t,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())t.declaration=this.parseExportDeclaration(t),"VariableDeclaration"===t.declaration.type?this.checkVariableExport(e,t.declaration.declarations):this.checkExport(e,t.declaration.id,t.declaration.id.start),t.specifiers=[],t.source=null,this.options.ecmaVersion>=16&&(t.attributes=[]);else{if(t.declaration=null,t.specifiers=this.parseExportSpecifiers(e),this.eatContextual("from"))this.type!==o.string&&this.unexpected(),t.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(t.attributes=this.parseWithClause());else{for(var s=0,i=t.specifiers;s<i.length;s+=1){var n=i[s];this.checkUnreserved(n.local),this.checkLocalExport(n.local),"Literal"===n.local.type&&this.raise(n.local.start,"A string literal cannot be used as an exported binding without `from`.")}t.source=null,this.options.ecmaVersion>=16&&(t.attributes=[])}this.semicolon()}return this.finishNode(t,"ExportNamedDeclaration")},b.parseExportDeclaration=function(t){return this.parseStatement(null)},b.parseExportDefaultDeclaration=function(){var t;if(this.type===o._function||(t=this.isAsyncFunction())){var e=this.startNode();return this.next(),t&&this.next(),this.parseFunction(e,Ee|Nt,!1,t)}if(this.type===o._class){var s=this.startNode();return this.parseClass(s,"nullableID")}var i=this.parseMaybeAssign();return this.semicolon(),i},b.checkExport=function(t,e,s){t&&("string"!=typeof e&&(e="Identifier"===e.type?e.name:e.value),ve(t,e)&&this.raiseRecoverable(s,"Duplicate export '"+e+"'"),t[e]=!0)},b.checkPatternExport=function(t,e){var s=e.type;if("Identifier"===s)this.checkExport(t,e,e.start);else if("ObjectPattern"===s)for(var i=0,n=e.properties;i<n.length;i+=1){var r=n[i];this.checkPatternExport(t,r)}else if("ArrayPattern"===s)for(var a=0,o=e.elements;a<o.length;a+=1){var h=o[a];h&&this.checkPatternExport(t,h)}else"Property"===s?this.checkPatternExport(t,e.value):"AssignmentPattern"===s?this.checkPatternExport(t,e.left):"RestElement"===s&&this.checkPatternExport(t,e.argument)},b.checkVariableExport=function(t,e){if(t)for(var s=0,i=e;s<i.length;s+=1){var n=i[s];this.checkPatternExport(t,n.id)}},b.shouldParseExportStatement=function(){return"var"===this.type.keyword||"const"===this.type.keyword||"class"===this.type.keyword||"function"===this.type.keyword||this.isLet()||this.isAsyncFunction()},b.parseExportSpecifier=function(t){var e=this.startNode();return e.local=this.parseModuleExportName(),e.exported=this.eatContextual("as")?this.parseModuleExportName():e.local,this.checkExport(t,e.exported,e.exported.start),this.finishNode(e,"ExportSpecifier")},b.parseExportSpecifiers=function(t){var e=[],s=!0;for(this.expect(o.braceL);!this.eat(o.braceR);){if(s)s=!1;else if(this.expect(o.comma),this.afterTrailingComma(o.braceR))break;e.push(this.parseExportSpecifier(t))}return e},b.parseImport=function(t){return this.next(),this.type===o.string?(t.specifiers=Ei,t.source=this.parseExprAtom()):(t.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),t.source=this.type===o.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(t.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(t,"ImportDeclaration")},b.parseImportSpecifier=function(){var t=this.startNode();return t.imported=this.parseModuleExportName(),this.eatContextual("as")?t.local=this.parseIdent():(this.checkUnreserved(t.imported),t.local=t.imported),this.checkLValSimple(t.local,ne),this.finishNode(t,"ImportSpecifier")},b.parseImportDefaultSpecifier=function(){var t=this.startNode();return t.local=this.parseIdent(),this.checkLValSimple(t.local,ne),this.finishNode(t,"ImportDefaultSpecifier")},b.parseImportNamespaceSpecifier=function(){var t=this.startNode();return this.next(),this.expectContextual("as"),t.local=this.parseIdent(),this.checkLValSimple(t.local,ne),this.finishNode(t,"ImportNamespaceSpecifier")},b.parseImportSpecifiers=function(){var t=[],e=!0;if(this.type===o.name&&(t.push(this.parseImportDefaultSpecifier()),!this.eat(o.comma)))return t;if(this.type===o.star)return t.push(this.parseImportNamespaceSpecifier()),t;for(this.expect(o.braceL);!this.eat(o.braceR);){if(e)e=!1;else if(this.expect(o.comma),this.afterTrailingComma(o.braceR))break;t.push(this.parseImportSpecifier())}return t},b.parseWithClause=function(){var t=[];if(!this.eat(o._with))return t;this.expect(o.braceL);for(var e={},s=!0;!this.eat(o.braceR);){if(s)s=!1;else if(this.expect(o.comma),this.afterTrailingComma(o.braceR))break;var i=this.parseImportAttribute(),n="Identifier"===i.key.type?i.key.name:i.key.value;ve(e,n)&&this.raiseRecoverable(i.key.start,"Duplicate attribute key '"+n+"'"),e[n]=!0,t.push(i)}return t},b.parseImportAttribute=function(){var t=this.startNode();return t.key=this.type===o.string?this.parseExprAtom():this.parseIdent("never"!==this.options.allowReserved),this.expect(o.colon),this.type!==o.string&&this.unexpected(),t.value=this.parseExprAtom(),this.finishNode(t,"ImportAttribute")},b.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===o.string){var t=this.parseLiteral(this.value);return vi.test(t.value)&&this.raise(t.start,"An export name cannot include a lone surrogate."),t}return this.parseIdent(!0)},b.adaptDirectivePrologue=function(t){for(var e=0;e<t.length&&this.isDirectiveCandidate(t[e]);++e)t[e].directive=t[e].expression.raw.slice(1,-1)},b.isDirectiveCandidate=function(t){return this.options.ecmaVersion>=5&&"ExpressionStatement"===t.type&&"Literal"===t.expression.type&&"string"==typeof t.expression.value&&('"'===this.input[t.start]||"'"===this.input[t.start])};var K=R.prototype;K.toAssignable=function(t,e,s){if(this.options.ecmaVersion>=6&&t)switch(t.type){case"Identifier":this.inAsync&&"await"===t.name&&this.raise(t.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":t.type="ObjectPattern",s&&this.checkPatternErrors(s,!0);for(var i=0,n=t.properties;i<n.length;i+=1){var r=n[i];this.toAssignable(r,e),"RestElement"===r.type&&("ArrayPattern"===r.argument.type||"ObjectPattern"===r.argument.type)&&this.raise(r.argument.start,"Unexpected token")}break;case"Property":"init"!==t.kind&&this.raise(t.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(t.value,e);break;case"ArrayExpression":t.type="ArrayPattern",s&&this.checkPatternErrors(s,!0),this.toAssignableList(t.elements,e);break;case"SpreadElement":t.type="RestElement",this.toAssignable(t.argument,e),"AssignmentPattern"===t.argument.type&&this.raise(t.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":"="!==t.operator&&this.raise(t.left.end,"Only '=' operator can be used for specifying default value."),t.type="AssignmentPattern",delete t.operator,this.toAssignable(t.left,e);break;case"ParenthesizedExpression":this.toAssignable(t.expression,e,s);break;case"ChainExpression":this.raiseRecoverable(t.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!e)break;default:this.raise(t.start,"Assigning to rvalue")}else s&&this.checkPatternErrors(s,!0);return t},K.toAssignableList=function(t,e){for(var s=t.length,i=0;i<s;i++){var n=t[i];n&&this.toAssignable(n,e)}if(s){var r=t[s-1];6===this.options.ecmaVersion&&e&&r&&"RestElement"===r.type&&"Identifier"!==r.argument.type&&this.unexpected(r.argument.start)}return t},K.parseSpread=function(t){var e=this.startNode();return this.next(),e.argument=this.parseMaybeAssign(!1,t),this.finishNode(e,"SpreadElement")},K.parseRestBinding=function(){var t=this.startNode();return this.next(),6===this.options.ecmaVersion&&this.type!==o.name&&this.unexpected(),t.argument=this.parseBindingAtom(),this.finishNode(t,"RestElement")},K.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case o.bracketL:var t=this.startNode();return this.next(),t.elements=this.parseBindingList(o.bracketR,!0,!0),this.finishNode(t,"ArrayPattern");case o.braceL:return this.parseObj(!0)}return this.parseIdent()},K.parseBindingList=function(t,e,s,i){for(var n=[],r=!0;!this.eat(t);)if(r?r=!1:this.expect(o.comma),e&&this.type===o.comma)n.push(null);else{if(s&&this.afterTrailingComma(t))break;if(this.type===o.ellipsis){var a=this.parseRestBinding();this.parseBindingListItem(a),n.push(a),this.type===o.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(t);break}n.push(this.parseAssignableListItem(i))}return n},K.parseAssignableListItem=function(t){var e=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(e),e},K.parseBindingListItem=function(t){return t},K.parseMaybeDefault=function(t,e,s){if(s=s||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(o.eq))return s;var i=this.startNodeAt(t,e);return i.left=s,i.right=this.parseMaybeAssign(),this.finishNode(i,"AssignmentPattern")},K.checkLValSimple=function(t,e,s){void 0===e&&(e=Te);var i=e!==Te;switch(t.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(t.name)&&this.raiseRecoverable(t.start,(i?"Binding ":"Assigning to ")+t.name+" in strict mode"),i&&(e===ne&&"let"===t.name&&this.raiseRecoverable(t.start,"let is disallowed as a lexically bound name"),s&&(ve(s,t.name)&&this.raiseRecoverable(t.start,"Argument name clash"),s[t.name]=!0),e!==Tt&&this.declareName(t.name,e,t.start));break;case"ChainExpression":this.raiseRecoverable(t.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":i&&this.raiseRecoverable(t.start,"Binding member expression");break;case"ParenthesizedExpression":return i&&this.raiseRecoverable(t.start,"Binding parenthesized expression"),this.checkLValSimple(t.expression,e,s);default:this.raise(t.start,(i?"Binding":"Assigning to")+" rvalue")}},K.checkLValPattern=function(t,e,s){switch(void 0===e&&(e=Te),t.type){case"ObjectPattern":for(var i=0,n=t.properties;i<n.length;i+=1){var r=n[i];this.checkLValInnerPattern(r,e,s)}break;case"ArrayPattern":for(var a=0,o=t.elements;a<o.length;a+=1){var h=o[a];h&&this.checkLValInnerPattern(h,e,s)}break;default:this.checkLValSimple(t,e,s)}},K.checkLValInnerPattern=function(t,e,s){switch(void 0===e&&(e=Te),t.type){case"Property":this.checkLValInnerPattern(t.value,e,s);break;case"AssignmentPattern":this.checkLValPattern(t.left,e,s);break;case"RestElement":this.checkLValPattern(t.argument,e,s);break;default:this.checkLValPattern(t,e,s)}};var G=function(t,e,s,i,n){this.token=t,this.isExpr=!!e,this.preserveSpace=!!s,this.override=i,this.generator=!!n},T={b_stat:new G("{",!1),b_expr:new G("{",!0),b_tmpl:new G("${",!1),p_stat:new G("(",!1),p_expr:new G("(",!0),q_tmpl:new G("`",!0,!0,function(t){return t.tryReadTemplateToken()}),f_stat:new G("function",!1),f_expr:new G("function",!0),f_expr_gen:new G("function",!0,!1,null,!0),f_gen:new G("function",!1,!1,null,!0)},ye=R.prototype;ye.initialContext=function(){return[T.b_stat]},ye.curContext=function(){return this.context[this.context.length-1]},ye.braceIsBlock=function(t){var e=this.curContext();return e===T.f_expr||e===T.f_stat||(t!==o.colon||e!==T.b_stat&&e!==T.b_expr?t===o._return||t===o.name&&this.exprAllowed?U.test(this.input.slice(this.lastTokEnd,this.start)):t===o._else||t===o.semi||t===o.eof||t===o.parenR||t===o.arrow||(t===o.braceL?e===T.b_stat:t!==o._var&&t!==o._const&&t!==o.name&&!this.exprAllowed):!e.isExpr)},ye.inGeneratorContext=function(){for(var t=this.context.length-1;t>=1;t--){var e=this.context[t];if("function"===e.token)return e.generator}return!1},ye.updateContext=function(t){var e,s=this.type;s.keyword&&t===o.dot?this.exprAllowed=!1:(e=s.updateContext)?e.call(this,t):this.exprAllowed=s.beforeExpr},ye.overrideContext=function(t){this.curContext()!==t&&(this.context[this.context.length-1]=t)},o.parenR.updateContext=o.braceR.updateContext=function(){if(1!==this.context.length){var t=this.context.pop();t===T.b_stat&&"function"===this.curContext().token&&(t=this.context.pop()),this.exprAllowed=!t.isExpr}else this.exprAllowed=!0},o.braceL.updateContext=function(t){this.context.push(this.braceIsBlock(t)?T.b_stat:T.b_expr),this.exprAllowed=!0},o.dollarBraceL.updateContext=function(){this.context.push(T.b_tmpl),this.exprAllowed=!0},o.parenL.updateContext=function(t){var e=t===o._if||t===o._for||t===o._with||t===o._while;this.context.push(e?T.p_stat:T.p_expr),this.exprAllowed=!0},o.incDec.updateContext=function(){},o._function.updateContext=o._class.updateContext=function(t){!t.beforeExpr||t===o._else||t===o.semi&&this.curContext()!==T.p_stat||t===o._return&&U.test(this.input.slice(this.lastTokEnd,this.start))||(t===o.colon||t===o.braceL)&&this.curContext()===T.b_stat?this.context.push(T.f_stat):this.context.push(T.f_expr),this.exprAllowed=!1},o.colon.updateContext=function(){"function"===this.curContext().token&&this.context.pop(),this.exprAllowed=!0},o.backQuote.updateContext=function(){this.curContext()===T.q_tmpl?this.context.pop():this.context.push(T.q_tmpl),this.exprAllowed=!1},o.star.updateContext=function(t){if(t===o._function){var e=this.context.length-1;this.context[e]===T.f_expr?this.context[e]=T.f_expr_gen:this.context[e]=T.f_gen}this.exprAllowed=!0},o.name.updateContext=function(t){var e=!1;this.options.ecmaVersion>=6&&t!==o.dot&&("of"===this.value&&!this.exprAllowed||"yield"===this.value&&this.inGeneratorContext())&&(e=!0),this.exprAllowed=e};var C=R.prototype;function Rt(t){return"Identifier"===t.type||"ParenthesizedExpression"===t.type&&Rt(t.expression)}function Qe(t){return"MemberExpression"===t.type&&"PrivateIdentifier"===t.property.type||"ChainExpression"===t.type&&Qe(t.expression)||"ParenthesizedExpression"===t.type&&Qe(t.expression)}C.checkPropClash=function(t,e,s){if(!(this.options.ecmaVersion>=9&&"SpreadElement"===t.type||this.options.ecmaVersion>=6&&(t.computed||t.method||t.shorthand))){var i,n=t.key;switch(n.type){case"Identifier":i=n.name;break;case"Literal":i=String(n.value);break;default:return}var r=t.kind;if(this.options.ecmaVersion>=6)return void("__proto__"===i&&"init"===r&&(e.proto&&(s?s.doubleProto<0&&(s.doubleProto=n.start):this.raiseRecoverable(n.start,"Redefinition of __proto__ property")),e.proto=!0));var a=e[i="$"+i];if(a)("init"===r?this.strict&&a.init||a.get||a.set:a.init||a[r])&&this.raiseRecoverable(n.start,"Redefinition of property");else a=e[i]={init:!1,get:!1,set:!1};a[r]=!0}},C.parseExpression=function(t,e){var s=this.start,i=this.startLoc,n=this.parseMaybeAssign(t,e);if(this.type===o.comma){var r=this.startNodeAt(s,i);for(r.expressions=[n];this.eat(o.comma);)r.expressions.push(this.parseMaybeAssign(t,e));return this.finishNode(r,"SequenceExpression")}return n},C.parseMaybeAssign=function(t,e,s){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(t);this.exprAllowed=!1}var i=!1,n=-1,r=-1,a=-1;e?(n=e.parenthesizedAssign,r=e.trailingComma,a=e.doubleProto,e.parenthesizedAssign=e.trailingComma=-1):(e=new Fe,i=!0);var h=this.start,c=this.startLoc;(this.type===o.parenL||this.type===o.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait="await"===t);var l=this.parseMaybeConditional(t,e);if(s&&(l=s.call(this,l,h,c)),this.type.isAssign){var p=this.startNodeAt(h,c);return p.operator=this.value,this.type===o.eq&&(l=this.toAssignable(l,!1,e)),i||(e.parenthesizedAssign=e.trailingComma=e.doubleProto=-1),e.shorthandAssign>=l.start&&(e.shorthandAssign=-1),this.type===o.eq?this.checkLValPattern(l):this.checkLValSimple(l),p.left=l,this.next(),p.right=this.parseMaybeAssign(t),a>-1&&(e.doubleProto=a),this.finishNode(p,"AssignmentExpression")}return i&&this.checkExpressionErrors(e,!0),n>-1&&(e.parenthesizedAssign=n),r>-1&&(e.trailingComma=r),l},C.parseMaybeConditional=function(t,e){var s=this.start,i=this.startLoc,n=this.parseExprOps(t,e);if(this.checkExpressionErrors(e))return n;if(this.eat(o.question)){var r=this.startNodeAt(s,i);return r.test=n,r.consequent=this.parseMaybeAssign(),this.expect(o.colon),r.alternate=this.parseMaybeAssign(t),this.finishNode(r,"ConditionalExpression")}return n},C.parseExprOps=function(t,e){var s=this.start,i=this.startLoc,n=this.parseMaybeUnary(e,!1,!1,t);return this.checkExpressionErrors(e)||n.start===s&&"ArrowFunctionExpression"===n.type?n:this.parseExprOp(n,s,i,-1,t)},C.parseExprOp=function(t,e,s,i,n){var r=this.type.binop;if(null!=r&&(!n||this.type!==o._in)&&r>i){var a=this.type===o.logicalOR||this.type===o.logicalAND,h=this.type===o.coalesce;h&&(r=o.logicalAND.binop);var c=this.value;this.next();var l=this.start,p=this.startLoc,u=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,n),l,p,r,n),d=this.buildBinary(e,s,t,u,c,a||h);return(a&&this.type===o.coalesce||h&&(this.type===o.logicalOR||this.type===o.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(d,e,s,i,n)}return t},C.buildBinary=function(t,e,s,i,n,r){"PrivateIdentifier"===i.type&&this.raise(i.start,"Private identifier can only be left side of binary expression");var a=this.startNodeAt(t,e);return a.left=s,a.operator=n,a.right=i,this.finishNode(a,r?"LogicalExpression":"BinaryExpression")},C.parseMaybeUnary=function(t,e,s,i){var n,r=this.start,a=this.startLoc;if(this.isContextual("await")&&this.canAwait)n=this.parseAwait(i),e=!0;else if(this.type.prefix){var h=this.startNode(),c=this.type===o.incDec;h.operator=this.value,h.prefix=!0,this.next(),h.argument=this.parseMaybeUnary(null,!0,c,i),this.checkExpressionErrors(t,!0),c?this.checkLValSimple(h.argument):this.strict&&"delete"===h.operator&&Rt(h.argument)?this.raiseRecoverable(h.start,"Deleting local variable in strict mode"):"delete"===h.operator&&Qe(h.argument)?this.raiseRecoverable(h.start,"Private fields can not be deleted"):e=!0,n=this.finishNode(h,c?"UpdateExpression":"UnaryExpression")}else if(e||this.type!==o.privateId){if(n=this.parseExprSubscripts(t,i),this.checkExpressionErrors(t))return n;for(;this.type.postfix&&!this.canInsertSemicolon();){var l=this.startNodeAt(r,a);l.operator=this.value,l.prefix=!1,l.argument=n,this.checkLValSimple(n),this.next(),n=this.finishNode(l,"UpdateExpression")}}else(i||0===this.privateNameStack.length)&&this.options.checkPrivateFields&&this.unexpected(),n=this.parsePrivateIdent(),this.type!==o._in&&this.unexpected();return s||!this.eat(o.starstar)?n:e?void this.unexpected(this.lastTokStart):this.buildBinary(r,a,n,this.parseMaybeUnary(null,!1,!1,i),"**",!1)},C.parseExprSubscripts=function(t,e){var s=this.start,i=this.startLoc,n=this.parseExprAtom(t,e);if("ArrowFunctionExpression"===n.type&&")"!==this.input.slice(this.lastTokStart,this.lastTokEnd))return n;var r=this.parseSubscripts(n,s,i,!1,e);return t&&"MemberExpression"===r.type&&(t.parenthesizedAssign>=r.start&&(t.parenthesizedAssign=-1),t.parenthesizedBind>=r.start&&(t.parenthesizedBind=-1),t.trailingComma>=r.start&&(t.trailingComma=-1)),r},C.parseSubscripts=function(t,e,s,i,n){for(var r=this.options.ecmaVersion>=8&&"Identifier"===t.type&&"async"===t.name&&this.lastTokEnd===t.end&&!this.canInsertSemicolon()&&t.end-t.start===5&&this.potentialArrowAt===t.start,a=!1;;){var o=this.parseSubscript(t,e,s,i,r,a,n);if(o.optional&&(a=!0),o===t||"ArrowFunctionExpression"===o.type){if(a){var h=this.startNodeAt(e,s);h.expression=o,o=this.finishNode(h,"ChainExpression")}return o}t=o}},C.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(o.arrow)},C.parseSubscriptAsyncArrow=function(t,e,s,i){return this.parseArrowExpression(this.startNodeAt(t,e),s,!0,i)},C.parseSubscript=function(t,e,s,i,n,r,a){var h=this.options.ecmaVersion>=11,c=h&&this.eat(o.questionDot);i&&c&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var l=this.eat(o.bracketL);if(l||c&&this.type!==o.parenL&&this.type!==o.backQuote||this.eat(o.dot)){var p=this.startNodeAt(e,s);p.object=t,l?(p.property=this.parseExpression(),this.expect(o.bracketR)):this.type===o.privateId&&"Super"!==t.type?p.property=this.parsePrivateIdent():p.property=this.parseIdent("never"!==this.options.allowReserved),p.computed=!!l,h&&(p.optional=c),t=this.finishNode(p,"MemberExpression")}else if(!i&&this.eat(o.parenL)){var u=new Fe,d=this.yieldPos,f=this.awaitPos,m=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var g=this.parseExprList(o.parenR,this.options.ecmaVersion>=8,!1,u);if(n&&!c&&this.shouldParseAsyncArrow())return this.checkPatternErrors(u,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=d,this.awaitPos=f,this.awaitIdentPos=m,this.parseSubscriptAsyncArrow(e,s,g,a);this.checkExpressionErrors(u,!0),this.yieldPos=d||this.yieldPos,this.awaitPos=f||this.awaitPos,this.awaitIdentPos=m||this.awaitIdentPos;var x=this.startNodeAt(e,s);x.callee=t,x.arguments=g,h&&(x.optional=c),t=this.finishNode(x,"CallExpression")}else if(this.type===o.backQuote){(c||r)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var v=this.startNodeAt(e,s);v.tag=t,v.quasi=this.parseTemplate({isTagged:!0}),t=this.finishNode(v,"TaggedTemplateExpression")}return t},C.parseExprAtom=function(t,e,s){this.type===o.slash&&this.readRegexp();var i,n=this.potentialArrowAt===this.start;switch(this.type){case o._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),i=this.startNode(),this.next(),this.type===o.parenL&&!this.allowDirectSuper&&this.raise(i.start,"super() call outside constructor of a subclass"),this.type!==o.dot&&this.type!==o.bracketL&&this.type!==o.parenL&&this.unexpected(),this.finishNode(i,"Super");case o._this:return i=this.startNode(),this.next(),this.finishNode(i,"ThisExpression");case o.name:var r=this.start,a=this.startLoc,h=this.containsEsc,c=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!h&&"async"===c.name&&!this.canInsertSemicolon()&&this.eat(o._function))return this.overrideContext(T.f_expr),this.parseFunction(this.startNodeAt(r,a),0,!1,!0,e);if(n&&!this.canInsertSemicolon()){if(this.eat(o.arrow))return this.parseArrowExpression(this.startNodeAt(r,a),[c],!1,e);if(this.options.ecmaVersion>=8&&"async"===c.name&&this.type===o.name&&!h&&(!this.potentialArrowInForAwait||"of"!==this.value||this.containsEsc))return c=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(o.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(r,a),[c],!0,e)}return c;case o.regexp:var l=this.value;return(i=this.parseLiteral(l.value)).regex={pattern:l.pattern,flags:l.flags},i;case o.num:case o.string:return this.parseLiteral(this.value);case o._null:case o._true:case o._false:return(i=this.startNode()).value=this.type===o._null?null:this.type===o._true,i.raw=this.type.keyword,this.next(),this.finishNode(i,"Literal");case o.parenL:var p=this.start,u=this.parseParenAndDistinguishExpression(n,e);return t&&(t.parenthesizedAssign<0&&!this.isSimpleAssignTarget(u)&&(t.parenthesizedAssign=p),t.parenthesizedBind<0&&(t.parenthesizedBind=p)),u;case o.bracketL:return i=this.startNode(),this.next(),i.elements=this.parseExprList(o.bracketR,!0,!0,t),this.finishNode(i,"ArrayExpression");case o.braceL:return this.overrideContext(T.b_expr),this.parseObj(!1,t);case o._function:return i=this.startNode(),this.next(),this.parseFunction(i,0);case o._class:return this.parseClass(this.startNode(),!1);case o._new:return this.parseNew();case o.backQuote:return this.parseTemplate();case o._import:return this.options.ecmaVersion>=11?this.parseExprImport(s):this.unexpected();default:return this.parseExprAtomDefault()}},C.parseExprAtomDefault=function(){this.unexpected()},C.parseExprImport=function(t){var e=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===o.parenL&&!t)return this.parseDynamicImport(e);if(this.type===o.dot){var s=this.startNodeAt(e.start,e.loc&&e.loc.start);return s.name="import",e.meta=this.finishNode(s,"Identifier"),this.parseImportMeta(e)}this.unexpected()},C.parseDynamicImport=function(t){if(this.next(),t.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(o.parenR)?t.options=null:(this.expect(o.comma),this.afterTrailingComma(o.parenR)?t.options=null:(t.options=this.parseMaybeAssign(),this.eat(o.parenR)||(this.expect(o.comma),this.afterTrailingComma(o.parenR)||this.unexpected())));else if(!this.eat(o.parenR)){var e=this.start;this.eat(o.comma)&&this.eat(o.parenR)?this.raiseRecoverable(e,"Trailing comma is not allowed in import()"):this.unexpected(e)}return this.finishNode(t,"ImportExpression")},C.parseImportMeta=function(t){this.next();var e=this.containsEsc;return t.property=this.parseIdent(!0),"meta"!==t.property.name&&this.raiseRecoverable(t.property.start,"The only valid meta property for import is 'import.meta'"),e&&this.raiseRecoverable(t.start,"'import.meta' must not contain escaped characters"),"module"!==this.options.sourceType&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(t.start,"Cannot use 'import.meta' outside a module"),this.finishNode(t,"MetaProperty")},C.parseLiteral=function(t){var e=this.startNode();return e.value=t,e.raw=this.input.slice(this.start,this.end),110===e.raw.charCodeAt(e.raw.length-1)&&(e.bigint=null!=e.value?e.value.toString():e.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(e,"Literal")},C.parseParenExpression=function(){this.expect(o.parenL);var t=this.parseExpression();return this.expect(o.parenR),t},C.shouldParseArrow=function(t){return!this.canInsertSemicolon()},C.parseParenAndDistinguishExpression=function(t,e){var s,i=this.start,n=this.startLoc,r=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var a,h=this.start,c=this.startLoc,l=[],p=!0,u=!1,d=new Fe,f=this.yieldPos,m=this.awaitPos;for(this.yieldPos=0,this.awaitPos=0;this.type!==o.parenR;){if(p?p=!1:this.expect(o.comma),r&&this.afterTrailingComma(o.parenR,!0)){u=!0;break}if(this.type===o.ellipsis){a=this.start,l.push(this.parseParenItem(this.parseRestBinding())),this.type===o.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}l.push(this.parseMaybeAssign(!1,d,this.parseParenItem))}var g=this.lastTokEnd,x=this.lastTokEndLoc;if(this.expect(o.parenR),t&&this.shouldParseArrow(l)&&this.eat(o.arrow))return this.checkPatternErrors(d,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=f,this.awaitPos=m,this.parseParenArrowList(i,n,l,e);(!l.length||u)&&this.unexpected(this.lastTokStart),a&&this.unexpected(a),this.checkExpressionErrors(d,!0),this.yieldPos=f||this.yieldPos,this.awaitPos=m||this.awaitPos,l.length>1?((s=this.startNodeAt(h,c)).expressions=l,this.finishNodeAt(s,"SequenceExpression",g,x)):s=l[0]}else s=this.parseParenExpression();if(this.options.preserveParens){var v=this.startNodeAt(i,n);return v.expression=s,this.finishNode(v,"ParenthesizedExpression")}return s},C.parseParenItem=function(t){return t},C.parseParenArrowList=function(t,e,s,i){return this.parseArrowExpression(this.startNodeAt(t,e),s,!1,i)};var _i=[];C.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var t=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===o.dot){var e=this.startNodeAt(t.start,t.loc&&t.loc.start);e.name="new",t.meta=this.finishNode(e,"Identifier"),this.next();var s=this.containsEsc;return t.property=this.parseIdent(!0),"target"!==t.property.name&&this.raiseRecoverable(t.property.start,"The only valid meta property for new is 'new.target'"),s&&this.raiseRecoverable(t.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(t.start,"'new.target' can only be used in functions and class static block"),this.finishNode(t,"MetaProperty")}var i=this.start,n=this.startLoc;return t.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),i,n,!0,!1),this.eat(o.parenL)?t.arguments=this.parseExprList(o.parenR,this.options.ecmaVersion>=8,!1):t.arguments=_i,this.finishNode(t,"NewExpression")},C.parseTemplateElement=function(t){var e=t.isTagged,s=this.startNode();return this.type===o.invalidTemplate?(e||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),s.value={raw:this.value.replace(/\r\n?/g,"\n"),cooked:null}):s.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,"\n"),cooked:this.value},this.next(),s.tail=this.type===o.backQuote,this.finishNode(s,"TemplateElement")},C.parseTemplate=function(t){void 0===t&&(t={});var e=t.isTagged;void 0===e&&(e=!1);var s=this.startNode();this.next(),s.expressions=[];var i=this.parseTemplateElement({isTagged:e});for(s.quasis=[i];!i.tail;)this.type===o.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(o.dollarBraceL),s.expressions.push(this.parseExpression()),this.expect(o.braceR),s.quasis.push(i=this.parseTemplateElement({isTagged:e}));return this.next(),this.finishNode(s,"TemplateLiteral")},C.isAsyncProp=function(t){return!t.computed&&"Identifier"===t.key.type&&"async"===t.key.name&&(this.type===o.name||this.type===o.num||this.type===o.string||this.type===o.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===o.star)&&!U.test(this.input.slice(this.lastTokEnd,this.start))},C.parseObj=function(t,e){var s=this.startNode(),i=!0,n={};for(s.properties=[],this.next();!this.eat(o.braceR);){if(i)i=!1;else if(this.expect(o.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(o.braceR))break;var r=this.parseProperty(t,e);t||this.checkPropClash(r,n,e),s.properties.push(r)}return this.finishNode(s,t?"ObjectPattern":"ObjectExpression")},C.parseProperty=function(t,e){var s,i,n,r,a=this.startNode();if(this.options.ecmaVersion>=9&&this.eat(o.ellipsis))return t?(a.argument=this.parseIdent(!1),this.type===o.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.finishNode(a,"RestElement")):(a.argument=this.parseMaybeAssign(!1,e),this.type===o.comma&&e&&e.trailingComma<0&&(e.trailingComma=this.start),this.finishNode(a,"SpreadElement"));this.options.ecmaVersion>=6&&(a.method=!1,a.shorthand=!1,(t||e)&&(n=this.start,r=this.startLoc),t||(s=this.eat(o.star)));var h=this.containsEsc;return this.parsePropertyName(a),!t&&!h&&this.options.ecmaVersion>=8&&!s&&this.isAsyncProp(a)?(i=!0,s=this.options.ecmaVersion>=9&&this.eat(o.star),this.parsePropertyName(a)):i=!1,this.parsePropertyValue(a,t,s,i,n,r,e,h),this.finishNode(a,"Property")},C.parseGetterSetter=function(t){var e=t.key.name;this.parsePropertyName(t),t.value=this.parseMethod(!1),t.kind=e;var s="get"===t.kind?0:1;if(t.value.params.length!==s){var i=t.value.start;"get"===t.kind?this.raiseRecoverable(i,"getter should have no params"):this.raiseRecoverable(i,"setter should have exactly one param")}else"set"===t.kind&&"RestElement"===t.value.params[0].type&&this.raiseRecoverable(t.value.params[0].start,"Setter cannot use rest params")},C.parsePropertyValue=function(t,e,s,i,n,r,a,h){(s||i)&&this.type===o.colon&&this.unexpected(),this.eat(o.colon)?(t.value=e?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,a),t.kind="init"):this.options.ecmaVersion>=6&&this.type===o.parenL?(e&&this.unexpected(),t.method=!0,t.value=this.parseMethod(s,i),t.kind="init"):e||h||!(this.options.ecmaVersion>=5)||t.computed||"Identifier"!==t.key.type||"get"!==t.key.name&&"set"!==t.key.name||this.type===o.comma||this.type===o.braceR||this.type===o.eq?this.options.ecmaVersion>=6&&!t.computed&&"Identifier"===t.key.type?((s||i)&&this.unexpected(),this.checkUnreserved(t.key),"await"===t.key.name&&!this.awaitIdentPos&&(this.awaitIdentPos=n),e?t.value=this.parseMaybeDefault(n,r,this.copyNode(t.key)):this.type===o.eq&&a?(a.shorthandAssign<0&&(a.shorthandAssign=this.start),t.value=this.parseMaybeDefault(n,r,this.copyNode(t.key))):t.value=this.copyNode(t.key),t.kind="init",t.shorthand=!0):this.unexpected():((s||i)&&this.unexpected(),this.parseGetterSetter(t))},C.parsePropertyName=function(t){if(this.options.ecmaVersion>=6){if(this.eat(o.bracketL))return t.computed=!0,t.key=this.parseMaybeAssign(),this.expect(o.bracketR),t.key;t.computed=!1}return t.key=this.type===o.num||this.type===o.string?this.parseExprAtom():this.parseIdent("never"!==this.options.allowReserved)},C.initFunction=function(t){t.id=null,this.options.ecmaVersion>=6&&(t.generator=t.expression=!1),this.options.ecmaVersion>=8&&(t.async=!1)},C.parseMethod=function(t,e,s){var i=this.startNode(),n=this.yieldPos,r=this.awaitPos,a=this.awaitIdentPos;return this.initFunction(i),this.options.ecmaVersion>=6&&(i.generator=t),this.options.ecmaVersion>=8&&(i.async=!!e),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(it(e,i.generator)|Oe|(s?At:0)),this.expect(o.parenL),i.params=this.parseBindingList(o.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(i,!1,!0,!1),this.yieldPos=n,this.awaitPos=r,this.awaitIdentPos=a,this.finishNode(i,"FunctionExpression")},C.parseArrowExpression=function(t,e,s,i){var n=this.yieldPos,r=this.awaitPos,a=this.awaitIdentPos;return this.enterScope(it(s,!1)|tt),this.initFunction(t),this.options.ecmaVersion>=8&&(t.async=!!s),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,t.params=this.toAssignableList(e,!0),this.parseFunctionBody(t,!0,!1,i),this.yieldPos=n,this.awaitPos=r,this.awaitIdentPos=a,this.finishNode(t,"ArrowFunctionExpression")},C.parseFunctionBody=function(t,e,s,i){var n=e&&this.type!==o.braceL,r=this.strict,a=!1;if(n)t.body=this.parseMaybeAssign(i),t.expression=!0,this.checkParams(t,!1);else{var h=this.options.ecmaVersion>=7&&!this.isSimpleParamList(t.params);(!r||h)&&((a=this.strictDirective(this.end))&&h&&this.raiseRecoverable(t.start,"Illegal 'use strict' directive in function with non-simple parameter list"));var c=this.labels;this.labels=[],a&&(this.strict=!0),this.checkParams(t,!r&&!a&&!e&&!s&&this.isSimpleParamList(t.params)),this.strict&&t.id&&this.checkLValSimple(t.id,Tt),t.body=this.parseBlock(!1,void 0,a&&!r),t.expression=!1,this.adaptDirectivePrologue(t.body.body),this.labels=c}this.exitScope()},C.isSimpleParamList=function(t){for(var e=0,s=t;e<s.length;e+=1){if("Identifier"!==s[e].type)return!1}return!0},C.checkParams=function(t,e){for(var s=Object.create(null),i=0,n=t.params;i<n.length;i+=1){var r=n[i];this.checkLValInnerPattern(r,st,e?null:s)}},C.parseExprList=function(t,e,s,i){for(var n=[],r=!0;!this.eat(t);){if(r)r=!1;else if(this.expect(o.comma),e&&this.afterTrailingComma(t))break;var a=void 0;s&&this.type===o.comma?a=null:this.type===o.ellipsis?(a=this.parseSpread(i),i&&this.type===o.comma&&i.trailingComma<0&&(i.trailingComma=this.start)):a=this.parseMaybeAssign(!1,i),n.push(a)}return n},C.checkUnreserved=function(t){var e=t.start,s=t.end,i=t.name;(this.inGenerator&&"yield"===i&&this.raiseRecoverable(e,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&"await"===i&&this.raiseRecoverable(e,"Cannot use 'await' as identifier inside an async function"),!(this.currentThisScope().flags&Me)&&"arguments"===i&&this.raiseRecoverable(e,"Cannot use 'arguments' in class field initializer"),this.inClassStaticBlock&&("arguments"===i||"await"===i)&&this.raise(e,"Cannot use "+i+" in class static initialization block"),this.keywords.test(i)&&this.raise(e,"Unexpected keyword '"+i+"'"),this.options.ecmaVersion<6&&-1!==this.input.slice(e,s).indexOf("\\"))||(this.strict?this.reservedWordsStrict:this.reservedWords).test(i)&&(!this.inAsync&&"await"===i&&this.raiseRecoverable(e,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(e,"The keyword '"+i+"' is reserved"))},C.parseIdent=function(t){var e=this.parseIdentNode();return this.next(!!t),this.finishNode(e,"Identifier"),t||(this.checkUnreserved(e),"await"===e.name&&!this.awaitIdentPos&&(this.awaitIdentPos=e.start)),e},C.parseIdentNode=function(){var t=this.startNode();return this.type===o.name?t.name=this.value:this.type.keyword?(t.name=this.type.keyword,("class"===t.name||"function"===t.name)&&(this.lastTokEnd!==this.lastTokStart+1||46!==this.input.charCodeAt(this.lastTokStart))&&this.context.pop(),this.type=o.name):this.unexpected(),t},C.parsePrivateIdent=function(){var t=this.startNode();return this.type===o.privateId?t.name=this.value:this.unexpected(),this.next(),this.finishNode(t,"PrivateIdentifier"),this.options.checkPrivateFields&&(0===this.privateNameStack.length?this.raise(t.start,"Private field '#"+t.name+"' must be declared in an enclosing class"):this.privateNameStack[this.privateNameStack.length-1].used.push(t)),t},C.parseYield=function(t){this.yieldPos||(this.yieldPos=this.start);var e=this.startNode();return this.next(),this.type===o.semi||this.canInsertSemicolon()||this.type!==o.star&&!this.type.startsExpr?(e.delegate=!1,e.argument=null):(e.delegate=this.eat(o.star),e.argument=this.parseMaybeAssign(t)),this.finishNode(e,"YieldExpression")},C.parseAwait=function(t){this.awaitPos||(this.awaitPos=this.start);var e=this.startNode();return this.next(),e.argument=this.parseMaybeUnary(null,!0,!1,t),this.finishNode(e,"AwaitExpression")};var Re=R.prototype;Re.raise=function(t,e){var s=wt(this.input,t);e+=" ("+s.line+":"+s.column+")",this.sourceFile&&(e+=" in "+this.sourceFile);var i=new SyntaxError(e);throw i.pos=t,i.loc=s,i.raisedAt=this.pos,i},Re.raiseRecoverable=Re.raise,Re.curPosition=function(){if(this.options.locations)return new we(this.curLine,this.pos-this.lineStart)};var ue=R.prototype,ki=function(t){this.flags=t,this.var=[],this.lexical=[],this.functions=[]};ue.enterScope=function(t){this.scopeStack.push(new ki(t))},ue.exitScope=function(){this.scopeStack.pop()},ue.treatFunctionsAsVarInScope=function(t){return t.flags&be||!this.inModule&&t.flags&_e},ue.declareName=function(t,e,s){var i=!1;if(e===ne){var n=this.currentScope();i=n.lexical.indexOf(t)>-1||n.functions.indexOf(t)>-1||n.var.indexOf(t)>-1,n.lexical.push(t),this.inModule&&n.flags&_e&&delete this.undefinedExports[t]}else if(e===It){this.currentScope().lexical.push(t)}else if(e===Pt){var r=this.currentScope();i=this.treatFunctionsAsVar?r.lexical.indexOf(t)>-1:r.lexical.indexOf(t)>-1||r.var.indexOf(t)>-1,r.functions.push(t)}else for(var a=this.scopeStack.length-1;a>=0;--a){var o=this.scopeStack[a];if(o.lexical.indexOf(t)>-1&&!(o.flags&kt&&o.lexical[0]===t)||!this.treatFunctionsAsVarInScope(o)&&o.functions.indexOf(t)>-1){i=!0;break}if(o.var.push(t),this.inModule&&o.flags&_e&&delete this.undefinedExports[t],o.flags&Me)break}i&&this.raiseRecoverable(s,"Identifier '"+t+"' has already been declared")},ue.checkLocalExport=function(t){-1===this.scopeStack[0].lexical.indexOf(t.name)&&-1===this.scopeStack[0].var.indexOf(t.name)&&(this.undefinedExports[t.name]=t)},ue.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},ue.currentVarScope=function(){for(var t=this.scopeStack.length-1;;t--){var e=this.scopeStack[t];if(e.flags&(Me|Ae|le))return e}},ue.currentThisScope=function(){for(var t=this.scopeStack.length-1;;t--){var e=this.scopeStack[t];if(e.flags&(Me|Ae|le)&&!(e.flags&tt))return e}};var De=function(t,e,s){this.type="",this.start=e,this.end=0,t.options.locations&&(this.loc=new Ve(t,s)),t.options.directSourceFile&&(this.sourceFile=t.options.directSourceFile),t.options.ranges&&(this.range=[e,0])},Pe=R.prototype;function Lt(t,e,s,i){return t.type=e,t.end=s,this.options.locations&&(t.loc.end=i),this.options.ranges&&(t.range[1]=s),t}Pe.startNode=function(){return new De(this,this.start,this.startLoc)},Pe.startNodeAt=function(t,e){return new De(this,t,e)},Pe.finishNode=function(t,e){return Lt.call(this,t,e,this.lastTokEnd,this.lastTokEndLoc)},Pe.finishNodeAt=function(t,e,s,i){return Lt.call(this,t,e,s,i)},Pe.copyNode=function(t){var e=new De(this,t.start,this.startLoc);for(var s in t)e[s]=t[s];return e};var Ai="Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sunu Sunuwar Todhri Todr Tulu_Tigalari Tutg Unknown Zzzz",Vt="ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS",Ot=Vt+" Extended_Pictographic",Mt=Ot,Ft=Ot+" EBase EComp EMod EPres ExtPict",Dt=Ft,Pi=Ft,Ii={9:Vt,10:Ot,11:Ot,12:Ft,13:Ft,14:Pi},Ti="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",Ni={9:"",10:"",11:"",12:"",13:"",14:Ti},pt="Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu",Bt="Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb",Ht=Bt+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",Ut=Ht+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",qt=Ut+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",jt=qt+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",Ri=jt+" "+Ai,Li={9:Bt,10:Ht,11:Ut,12:qt,13:jt,14:Ri},Wt={};function Vi(t){var e=Wt[t]={binary:ae(Ii[t]+" "+pt),binaryOfStrings:ae(Ni[t]),nonBinary:{General_Category:ae(pt),Script:ae(Li[t])}};e.nonBinary.Script_Extensions=e.nonBinary.Script,e.nonBinary.gc=e.nonBinary.General_Category,e.nonBinary.sc=e.nonBinary.Script,e.nonBinary.scx=e.nonBinary.Script_Extensions}for(var We=0,ft=[9,10,11,12,13,14];We<ft.length;We+=1){var Oi=ft[We];Vi(Oi)}var v=R.prototype,Le=function(t,e){this.parent=t,this.base=e||this};Le.prototype.separatedFrom=function(t){for(var e=this;e;e=e.parent)for(var s=t;s;s=s.parent)if(e.base===s.base&&e!==s)return!0;return!1},Le.prototype.sibling=function(){return new Le(this.parent,this.base)};var Z=function(t){this.parser=t,this.validFlags="gim"+(t.options.ecmaVersion>=6?"uy":"")+(t.options.ecmaVersion>=9?"s":"")+(t.options.ecmaVersion>=13?"d":"")+(t.options.ecmaVersion>=15?"v":""),this.unicodeProperties=Wt[t.options.ecmaVersion>=14?14:t.options.ecmaVersion],this.source="",this.flags="",this.start=0,this.switchU=!1,this.switchV=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue="",this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=Object.create(null),this.backReferenceNames=[],this.branchID=null};function Mi(t){for(var e in t)return!0;return!1}function Fi(t){return 105===t||109===t||115===t}function $t(t){return 36===t||t>=40&&t<=43||46===t||63===t||t>=91&&t<=94||t>=123&&t<=125}function Di(t){return Q(t,!0)||36===t||95===t}function Bi(t){return oe(t,!0)||36===t||95===t||8204===t||8205===t}function Kt(t){return t>=65&&t<=90||t>=97&&t<=122}function Hi(t){return t>=0&&t<=1114111}Z.prototype.reset=function(t,e,s){var i=-1!==s.indexOf("v"),n=-1!==s.indexOf("u");this.start=0|t,this.source=e+"",this.flags=s,i&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=n&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=n&&this.parser.options.ecmaVersion>=9)},Z.prototype.raise=function(t){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+t)},Z.prototype.at=function(t,e){void 0===e&&(e=!1);var s=this.source,i=s.length;if(t>=i)return-1;var n=s.charCodeAt(t);if(!e&&!this.switchU||n<=55295||n>=57344||t+1>=i)return n;var r=s.charCodeAt(t+1);return r>=56320&&r<=57343?(n<<10)+r-56613888:n},Z.prototype.nextIndex=function(t,e){void 0===e&&(e=!1);var s=this.source,i=s.length;if(t>=i)return i;var n,r=s.charCodeAt(t);return!e&&!this.switchU||r<=55295||r>=57344||t+1>=i||(n=s.charCodeAt(t+1))<56320||n>57343?t+1:t+2},Z.prototype.current=function(t){return void 0===t&&(t=!1),this.at(this.pos,t)},Z.prototype.lookahead=function(t){return void 0===t&&(t=!1),this.at(this.nextIndex(this.pos,t),t)},Z.prototype.advance=function(t){void 0===t&&(t=!1),this.pos=this.nextIndex(this.pos,t)},Z.prototype.eat=function(t,e){return void 0===e&&(e=!1),this.current(e)===t&&(this.advance(e),!0)},Z.prototype.eatChars=function(t,e){void 0===e&&(e=!1);for(var s=this.pos,i=0,n=t;i<n.length;i+=1){var r=n[i],a=this.at(s,e);if(-1===a||a!==r)return!1;s=this.nextIndex(s,e)}return this.pos=s,!0},v.validateRegExpFlags=function(t){for(var e=t.validFlags,s=t.flags,i=!1,n=!1,r=0;r<s.length;r++){var a=s.charAt(r);-1===e.indexOf(a)&&this.raise(t.start,"Invalid regular expression flag"),s.indexOf(a,r+1)>-1&&this.raise(t.start,"Duplicate regular expression flag"),"u"===a&&(i=!0),"v"===a&&(n=!0)}this.options.ecmaVersion>=15&&i&&n&&this.raise(t.start,"Invalid regular expression flag")},v.validateRegExpPattern=function(t){this.regexp_pattern(t),!t.switchN&&this.options.ecmaVersion>=9&&Mi(t.groupNames)&&(t.switchN=!0,this.regexp_pattern(t))},v.regexp_pattern=function(t){t.pos=0,t.lastIntValue=0,t.lastStringValue="",t.lastAssertionIsQuantifiable=!1,t.numCapturingParens=0,t.maxBackReference=0,t.groupNames=Object.create(null),t.backReferenceNames.length=0,t.branchID=null,this.regexp_disjunction(t),t.pos!==t.source.length&&(t.eat(41)&&t.raise("Unmatched ')'"),(t.eat(93)||t.eat(125))&&t.raise("Lone quantifier brackets")),t.maxBackReference>t.numCapturingParens&&t.raise("Invalid escape");for(var e=0,s=t.backReferenceNames;e<s.length;e+=1){var i=s[e];t.groupNames[i]||t.raise("Invalid named capture referenced")}},v.regexp_disjunction=function(t){var e=this.options.ecmaVersion>=16;for(e&&(t.branchID=new Le(t.branchID,null)),this.regexp_alternative(t);t.eat(124);)e&&(t.branchID=t.branchID.sibling()),this.regexp_alternative(t);e&&(t.branchID=t.branchID.parent),this.regexp_eatQuantifier(t,!0)&&t.raise("Nothing to repeat"),t.eat(123)&&t.raise("Lone quantifier brackets")},v.regexp_alternative=function(t){for(;t.pos<t.source.length&&this.regexp_eatTerm(t););},v.regexp_eatTerm=function(t){return this.regexp_eatAssertion(t)?(t.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(t)&&t.switchU&&t.raise("Invalid quantifier"),!0):!!(t.switchU?this.regexp_eatAtom(t):this.regexp_eatExtendedAtom(t))&&(this.regexp_eatQuantifier(t),!0)},v.regexp_eatAssertion=function(t){var e=t.pos;if(t.lastAssertionIsQuantifiable=!1,t.eat(94)||t.eat(36))return!0;if(t.eat(92)){if(t.eat(66)||t.eat(98))return!0;t.pos=e}if(t.eat(40)&&t.eat(63)){var s=!1;if(this.options.ecmaVersion>=9&&(s=t.eat(60)),t.eat(61)||t.eat(33))return this.regexp_disjunction(t),t.eat(41)||t.raise("Unterminated group"),t.lastAssertionIsQuantifiable=!s,!0}return t.pos=e,!1},v.regexp_eatQuantifier=function(t,e){return void 0===e&&(e=!1),!!this.regexp_eatQuantifierPrefix(t,e)&&(t.eat(63),!0)},v.regexp_eatQuantifierPrefix=function(t,e){return t.eat(42)||t.eat(43)||t.eat(63)||this.regexp_eatBracedQuantifier(t,e)},v.regexp_eatBracedQuantifier=function(t,e){var s=t.pos;if(t.eat(123)){var i=0,n=-1;if(this.regexp_eatDecimalDigits(t)&&(i=t.lastIntValue,t.eat(44)&&this.regexp_eatDecimalDigits(t)&&(n=t.lastIntValue),t.eat(125)))return-1!==n&&n<i&&!e&&t.raise("numbers out of order in {} quantifier"),!0;t.switchU&&!e&&t.raise("Incomplete quantifier"),t.pos=s}return!1},v.regexp_eatAtom=function(t){return this.regexp_eatPatternCharacters(t)||t.eat(46)||this.regexp_eatReverseSolidusAtomEscape(t)||this.regexp_eatCharacterClass(t)||this.regexp_eatUncapturingGroup(t)||this.regexp_eatCapturingGroup(t)},v.regexp_eatReverseSolidusAtomEscape=function(t){var e=t.pos;if(t.eat(92)){if(this.regexp_eatAtomEscape(t))return!0;t.pos=e}return!1},v.regexp_eatUncapturingGroup=function(t){var e=t.pos;if(t.eat(40)){if(t.eat(63)){if(this.options.ecmaVersion>=16){var s=this.regexp_eatModifiers(t),i=t.eat(45);if(s||i){for(var n=0;n<s.length;n++){var r=s.charAt(n);s.indexOf(r,n+1)>-1&&t.raise("Duplicate regular expression modifiers")}if(i){var a=this.regexp_eatModifiers(t);!s&&!a&&58===t.current()&&t.raise("Invalid regular expression modifiers");for(var o=0;o<a.length;o++){var h=a.charAt(o);(a.indexOf(h,o+1)>-1||s.indexOf(h)>-1)&&t.raise("Duplicate regular expression modifiers")}}}}if(t.eat(58)){if(this.regexp_disjunction(t),t.eat(41))return!0;t.raise("Unterminated group")}}t.pos=e}return!1},v.regexp_eatCapturingGroup=function(t){if(t.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(t):63===t.current()&&t.raise("Invalid group"),this.regexp_disjunction(t),t.eat(41))return t.numCapturingParens+=1,!0;t.raise("Unterminated group")}return!1},v.regexp_eatModifiers=function(t){for(var e="",s=0;-1!==(s=t.current())&&Fi(s);)e+=se(s),t.advance();return e},v.regexp_eatExtendedAtom=function(t){return t.eat(46)||this.regexp_eatReverseSolidusAtomEscape(t)||this.regexp_eatCharacterClass(t)||this.regexp_eatUncapturingGroup(t)||this.regexp_eatCapturingGroup(t)||this.regexp_eatInvalidBracedQuantifier(t)||this.regexp_eatExtendedPatternCharacter(t)},v.regexp_eatInvalidBracedQuantifier=function(t){return this.regexp_eatBracedQuantifier(t,!0)&&t.raise("Nothing to repeat"),!1},v.regexp_eatSyntaxCharacter=function(t){var e=t.current();return!!$t(e)&&(t.lastIntValue=e,t.advance(),!0)},v.regexp_eatPatternCharacters=function(t){for(var e=t.pos,s=0;-1!==(s=t.current())&&!$t(s);)t.advance();return t.pos!==e},v.regexp_eatExtendedPatternCharacter=function(t){var e=t.current();return!(-1===e||36===e||e>=40&&e<=43||46===e||63===e||91===e||94===e||124===e)&&(t.advance(),!0)},v.regexp_groupSpecifier=function(t){if(t.eat(63)){this.regexp_eatGroupName(t)||t.raise("Invalid group");var e=this.options.ecmaVersion>=16,s=t.groupNames[t.lastStringValue];if(s)if(e)for(var i=0,n=s;i<n.length;i+=1){n[i].separatedFrom(t.branchID)||t.raise("Duplicate capture group name")}else t.raise("Duplicate capture group name");e?(s||(t.groupNames[t.lastStringValue]=[])).push(t.branchID):t.groupNames[t.lastStringValue]=!0}},v.regexp_eatGroupName=function(t){if(t.lastStringValue="",t.eat(60)){if(this.regexp_eatRegExpIdentifierName(t)&&t.eat(62))return!0;t.raise("Invalid capture group name")}return!1},v.regexp_eatRegExpIdentifierName=function(t){if(t.lastStringValue="",this.regexp_eatRegExpIdentifierStart(t)){for(t.lastStringValue+=se(t.lastIntValue);this.regexp_eatRegExpIdentifierPart(t);)t.lastStringValue+=se(t.lastIntValue);return!0}return!1},v.regexp_eatRegExpIdentifierStart=function(t){var e=t.pos,s=this.options.ecmaVersion>=11,i=t.current(s);return t.advance(s),92===i&&this.regexp_eatRegExpUnicodeEscapeSequence(t,s)&&(i=t.lastIntValue),Di(i)?(t.lastIntValue=i,!0):(t.pos=e,!1)},v.regexp_eatRegExpIdentifierPart=function(t){var e=t.pos,s=this.options.ecmaVersion>=11,i=t.current(s);return t.advance(s),92===i&&this.regexp_eatRegExpUnicodeEscapeSequence(t,s)&&(i=t.lastIntValue),Bi(i)?(t.lastIntValue=i,!0):(t.pos=e,!1)},v.regexp_eatAtomEscape=function(t){return!!(this.regexp_eatBackReference(t)||this.regexp_eatCharacterClassEscape(t)||this.regexp_eatCharacterEscape(t)||t.switchN&&this.regexp_eatKGroupName(t))||(t.switchU&&(99===t.current()&&t.raise("Invalid unicode escape"),t.raise("Invalid escape")),!1)},v.regexp_eatBackReference=function(t){var e=t.pos;if(this.regexp_eatDecimalEscape(t)){var s=t.lastIntValue;if(t.switchU)return s>t.maxBackReference&&(t.maxBackReference=s),!0;if(s<=t.numCapturingParens)return!0;t.pos=e}return!1},v.regexp_eatKGroupName=function(t){if(t.eat(107)){if(this.regexp_eatGroupName(t))return t.backReferenceNames.push(t.lastStringValue),!0;t.raise("Invalid named reference")}return!1},v.regexp_eatCharacterEscape=function(t){return this.regexp_eatControlEscape(t)||this.regexp_eatCControlLetter(t)||this.regexp_eatZero(t)||this.regexp_eatHexEscapeSequence(t)||this.regexp_eatRegExpUnicodeEscapeSequence(t,!1)||!t.switchU&&this.regexp_eatLegacyOctalEscapeSequence(t)||this.regexp_eatIdentityEscape(t)},v.regexp_eatCControlLetter=function(t){var e=t.pos;if(t.eat(99)){if(this.regexp_eatControlLetter(t))return!0;t.pos=e}return!1},v.regexp_eatZero=function(t){return 48===t.current()&&!Be(t.lookahead())&&(t.lastIntValue=0,t.advance(),!0)},v.regexp_eatControlEscape=function(t){var e=t.current();return 116===e?(t.lastIntValue=9,t.advance(),!0):110===e?(t.lastIntValue=10,t.advance(),!0):118===e?(t.lastIntValue=11,t.advance(),!0):102===e?(t.lastIntValue=12,t.advance(),!0):114===e&&(t.lastIntValue=13,t.advance(),!0)},v.regexp_eatControlLetter=function(t){var e=t.current();return!!Kt(e)&&(t.lastIntValue=e%32,t.advance(),!0)},v.regexp_eatRegExpUnicodeEscapeSequence=function(t,e){void 0===e&&(e=!1);var s=t.pos,i=e||t.switchU;if(t.eat(117)){if(this.regexp_eatFixedHexDigits(t,4)){var n=t.lastIntValue;if(i&&n>=55296&&n<=56319){var r=t.pos;if(t.eat(92)&&t.eat(117)&&this.regexp_eatFixedHexDigits(t,4)){var a=t.lastIntValue;if(a>=56320&&a<=57343)return t.lastIntValue=1024*(n-55296)+(a-56320)+65536,!0}t.pos=r,t.lastIntValue=n}return!0}if(i&&t.eat(123)&&this.regexp_eatHexDigits(t)&&t.eat(125)&&Hi(t.lastIntValue))return!0;i&&t.raise("Invalid unicode escape"),t.pos=s}return!1},v.regexp_eatIdentityEscape=function(t){if(t.switchU)return!!this.regexp_eatSyntaxCharacter(t)||!!t.eat(47)&&(t.lastIntValue=47,!0);var e=t.current();return!(99===e||t.switchN&&107===e)&&(t.lastIntValue=e,t.advance(),!0)},v.regexp_eatDecimalEscape=function(t){t.lastIntValue=0;var e=t.current();if(e>=49&&e<=57){do{t.lastIntValue=10*t.lastIntValue+(e-48),t.advance()}while((e=t.current())>=48&&e<=57);return!0}return!1};var zt=0,re=1,$=2;function Ui(t){return 100===t||68===t||115===t||83===t||119===t||87===t}function Gt(t){return Kt(t)||95===t}function qi(t){return Gt(t)||Be(t)}function ji(t){return 33===t||t>=35&&t<=38||t>=42&&t<=44||46===t||t>=58&&t<=64||94===t||96===t||126===t}function Wi(t){return 40===t||41===t||45===t||47===t||t>=91&&t<=93||t>=123&&t<=125}function $i(t){return 33===t||35===t||37===t||38===t||44===t||45===t||t>=58&&t<=62||64===t||96===t||126===t}function Be(t){return t>=48&&t<=57}function Xt(t){return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}function Qt(t){return t>=65&&t<=70?t-65+10:t>=97&&t<=102?t-97+10:t-48}function Yt(t){return t>=48&&t<=55}v.regexp_eatCharacterClassEscape=function(t){var e=t.current();if(Ui(e))return t.lastIntValue=-1,t.advance(),re;var s=!1;if(t.switchU&&this.options.ecmaVersion>=9&&((s=80===e)||112===e)){var i;if(t.lastIntValue=-1,t.advance(),t.eat(123)&&(i=this.regexp_eatUnicodePropertyValueExpression(t))&&t.eat(125))return s&&i===$&&t.raise("Invalid property name"),i;t.raise("Invalid property name")}return zt},v.regexp_eatUnicodePropertyValueExpression=function(t){var e=t.pos;if(this.regexp_eatUnicodePropertyName(t)&&t.eat(61)){var s=t.lastStringValue;if(this.regexp_eatUnicodePropertyValue(t)){var i=t.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(t,s,i),re}}if(t.pos=e,this.regexp_eatLoneUnicodePropertyNameOrValue(t)){var n=t.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(t,n)}return zt},v.regexp_validateUnicodePropertyNameAndValue=function(t,e,s){ve(t.unicodeProperties.nonBinary,e)||t.raise("Invalid property name"),t.unicodeProperties.nonBinary[e].test(s)||t.raise("Invalid property value")},v.regexp_validateUnicodePropertyNameOrValue=function(t,e){return t.unicodeProperties.binary.test(e)?re:t.switchV&&t.unicodeProperties.binaryOfStrings.test(e)?$:void t.raise("Invalid property name")},v.regexp_eatUnicodePropertyName=function(t){var e=0;for(t.lastStringValue="";Gt(e=t.current());)t.lastStringValue+=se(e),t.advance();return""!==t.lastStringValue},v.regexp_eatUnicodePropertyValue=function(t){var e=0;for(t.lastStringValue="";qi(e=t.current());)t.lastStringValue+=se(e),t.advance();return""!==t.lastStringValue},v.regexp_eatLoneUnicodePropertyNameOrValue=function(t){return this.regexp_eatUnicodePropertyValue(t)},v.regexp_eatCharacterClass=function(t){if(t.eat(91)){var e=t.eat(94),s=this.regexp_classContents(t);return t.eat(93)||t.raise("Unterminated character class"),e&&s===$&&t.raise("Negated character class may contain strings"),!0}return!1},v.regexp_classContents=function(t){return 93===t.current()?re:t.switchV?this.regexp_classSetExpression(t):(this.regexp_nonEmptyClassRanges(t),re)},v.regexp_nonEmptyClassRanges=function(t){for(;this.regexp_eatClassAtom(t);){var e=t.lastIntValue;if(t.eat(45)&&this.regexp_eatClassAtom(t)){var s=t.lastIntValue;t.switchU&&(-1===e||-1===s)&&t.raise("Invalid character class"),-1!==e&&-1!==s&&e>s&&t.raise("Range out of order in character class")}}},v.regexp_eatClassAtom=function(t){var e=t.pos;if(t.eat(92)){if(this.regexp_eatClassEscape(t))return!0;if(t.switchU){var s=t.current();(99===s||Yt(s))&&t.raise("Invalid class escape"),t.raise("Invalid escape")}t.pos=e}var i=t.current();return 93!==i&&(t.lastIntValue=i,t.advance(),!0)},v.regexp_eatClassEscape=function(t){var e=t.pos;if(t.eat(98))return t.lastIntValue=8,!0;if(t.switchU&&t.eat(45))return t.lastIntValue=45,!0;if(!t.switchU&&t.eat(99)){if(this.regexp_eatClassControlLetter(t))return!0;t.pos=e}return this.regexp_eatCharacterClassEscape(t)||this.regexp_eatCharacterEscape(t)},v.regexp_classSetExpression=function(t){var e,s=re;if(!this.regexp_eatClassSetRange(t))if(e=this.regexp_eatClassSetOperand(t)){e===$&&(s=$);for(var i=t.pos;t.eatChars([38,38]);)38!==t.current()&&(e=this.regexp_eatClassSetOperand(t))?e!==$&&(s=re):t.raise("Invalid character in character class");if(i!==t.pos)return s;for(;t.eatChars([45,45]);)this.regexp_eatClassSetOperand(t)||t.raise("Invalid character in character class");if(i!==t.pos)return s}else t.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(t)){if(!(e=this.regexp_eatClassSetOperand(t)))return s;e===$&&(s=$)}},v.regexp_eatClassSetRange=function(t){var e=t.pos;if(this.regexp_eatClassSetCharacter(t)){var s=t.lastIntValue;if(t.eat(45)&&this.regexp_eatClassSetCharacter(t)){var i=t.lastIntValue;return-1!==s&&-1!==i&&s>i&&t.raise("Range out of order in character class"),!0}t.pos=e}return!1},v.regexp_eatClassSetOperand=function(t){return this.regexp_eatClassSetCharacter(t)?re:this.regexp_eatClassStringDisjunction(t)||this.regexp_eatNestedClass(t)},v.regexp_eatNestedClass=function(t){var e=t.pos;if(t.eat(91)){var s=t.eat(94),i=this.regexp_classContents(t);if(t.eat(93))return s&&i===$&&t.raise("Negated character class may contain strings"),i;t.pos=e}if(t.eat(92)){var n=this.regexp_eatCharacterClassEscape(t);if(n)return n;t.pos=e}return null},v.regexp_eatClassStringDisjunction=function(t){var e=t.pos;if(t.eatChars([92,113])){if(t.eat(123)){var s=this.regexp_classStringDisjunctionContents(t);if(t.eat(125))return s}else t.raise("Invalid escape");t.pos=e}return null},v.regexp_classStringDisjunctionContents=function(t){for(var e=this.regexp_classString(t);t.eat(124);)this.regexp_classString(t)===$&&(e=$);return e},v.regexp_classString=function(t){for(var e=0;this.regexp_eatClassSetCharacter(t);)e++;return 1===e?re:$},v.regexp_eatClassSetCharacter=function(t){var e=t.pos;if(t.eat(92))return!(!this.regexp_eatCharacterEscape(t)&&!this.regexp_eatClassSetReservedPunctuator(t))||(t.eat(98)?(t.lastIntValue=8,!0):(t.pos=e,!1));var s=t.current();return!(s<0||s===t.lookahead()&&ji(s)||Wi(s))&&(t.advance(),t.lastIntValue=s,!0)},v.regexp_eatClassSetReservedPunctuator=function(t){var e=t.current();return!!$i(e)&&(t.lastIntValue=e,t.advance(),!0)},v.regexp_eatClassControlLetter=function(t){var e=t.current();return!(!Be(e)&&95!==e)&&(t.lastIntValue=e%32,t.advance(),!0)},v.regexp_eatHexEscapeSequence=function(t){var e=t.pos;if(t.eat(120)){if(this.regexp_eatFixedHexDigits(t,2))return!0;t.switchU&&t.raise("Invalid escape"),t.pos=e}return!1},v.regexp_eatDecimalDigits=function(t){var e=t.pos,s=0;for(t.lastIntValue=0;Be(s=t.current());)t.lastIntValue=10*t.lastIntValue+(s-48),t.advance();return t.pos!==e},v.regexp_eatHexDigits=function(t){var e=t.pos,s=0;for(t.lastIntValue=0;Xt(s=t.current());)t.lastIntValue=16*t.lastIntValue+Qt(s),t.advance();return t.pos!==e},v.regexp_eatLegacyOctalEscapeSequence=function(t){if(this.regexp_eatOctalDigit(t)){var e=t.lastIntValue;if(this.regexp_eatOctalDigit(t)){var s=t.lastIntValue;e<=3&&this.regexp_eatOctalDigit(t)?t.lastIntValue=64*e+8*s+t.lastIntValue:t.lastIntValue=8*e+s}else t.lastIntValue=e;return!0}return!1},v.regexp_eatOctalDigit=function(t){var e=t.current();return Yt(e)?(t.lastIntValue=e-48,t.advance(),!0):(t.lastIntValue=0,!1)},v.regexp_eatFixedHexDigits=function(t,e){var s=t.pos;t.lastIntValue=0;for(var i=0;i<e;++i){var n=t.current();if(!Xt(n))return t.pos=s,!1;t.lastIntValue=16*t.lastIntValue+Qt(n),t.advance()}return!0};var nt=function(t){this.type=t.type,this.value=t.value,this.start=t.start,this.end=t.end,t.options.locations&&(this.loc=new Ve(t,t.startLoc,t.endLoc)),t.options.ranges&&(this.range=[t.start,t.end])},w=R.prototype;function Ki(t,e){return e?parseInt(t,8):parseFloat(t.replace(/_/g,""))}function Zt(t){return"function"!=typeof BigInt?null:BigInt(t.replace(/_/g,""))}w.next=function(t){!t&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword),this.options.onToken&&this.options.onToken(new nt(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},w.getToken=function(){return this.next(),new nt(this)},typeof Symbol<"u"&&(w[Symbol.iterator]=function(){var t=this;return{next:function(){var e=t.getToken();return{done:e.type===o.eof,value:e}}}}),w.nextToken=function(){var t=this.curContext();return(!t||!t.preserveSpace)&&this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length?this.finishToken(o.eof):t.override?t.override(this):void this.readToken(this.fullCharCodeAtPos())},w.readToken=function(t){return Q(t,this.options.ecmaVersion>=6)||92===t?this.readWord():this.getTokenFromCode(t)},w.fullCharCodeAtPos=function(){var t=this.input.charCodeAt(this.pos);if(t<=55295||t>=56320)return t;var e=this.input.charCodeAt(this.pos+1);return e<=56319||e>=57344?t:(t<<10)+e-56613888},w.skipBlockComment=function(){var t=this.options.onComment&&this.curPosition(),e=this.pos,s=this.input.indexOf("*/",this.pos+=2);if(-1===s&&this.raise(this.pos-2,"Unterminated comment"),this.pos=s+2,this.options.locations)for(var i=void 0,n=e;(i=Ct(this.input,n,this.pos))>-1;)++this.curLine,n=this.lineStart=i;this.options.onComment&&this.options.onComment(!0,this.input.slice(e+2,s),e,this.pos,t,this.curPosition())},w.skipLineComment=function(t){for(var e=this.pos,s=this.options.onComment&&this.curPosition(),i=this.input.charCodeAt(this.pos+=t);this.pos<this.input.length&&!ge(i);)i=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(e+t,this.pos),e,this.pos,s,this.curPosition())},w.skipSpace=function(){t:for(;this.pos<this.input.length;){var t=this.input.charCodeAt(this.pos);switch(t){case 32:case 160:++this.pos;break;case 13:10===this.input.charCodeAt(this.pos+1)&&++this.pos;case 10:case 8232:case 8233:++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos);break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break t}break;default:if(!(t>8&&t<14||t>=5760&&St.test(String.fromCharCode(t))))break t;++this.pos}}},w.finishToken=function(t,e){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var s=this.type;this.type=t,this.value=e,this.updateContext(s)},w.readToken_dot=function(){var t=this.input.charCodeAt(this.pos+1);if(t>=48&&t<=57)return this.readNumber(!0);var e=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&46===t&&46===e?(this.pos+=3,this.finishToken(o.ellipsis)):(++this.pos,this.finishToken(o.dot))},w.readToken_slash=function(){var t=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):61===t?this.finishOp(o.assign,2):this.finishOp(o.slash,1)},w.readToken_mult_modulo_exp=function(t){var e=this.input.charCodeAt(this.pos+1),s=1,i=42===t?o.star:o.modulo;return this.options.ecmaVersion>=7&&42===t&&42===e&&(++s,i=o.starstar,e=this.input.charCodeAt(this.pos+2)),61===e?this.finishOp(o.assign,s+1):this.finishOp(i,s)},w.readToken_pipe_amp=function(t){var e=this.input.charCodeAt(this.pos+1);if(e===t){if(this.options.ecmaVersion>=12)if(61===this.input.charCodeAt(this.pos+2))return this.finishOp(o.assign,3);return this.finishOp(124===t?o.logicalOR:o.logicalAND,2)}return 61===e?this.finishOp(o.assign,2):this.finishOp(124===t?o.bitwiseOR:o.bitwiseAND,1)},w.readToken_caret=function(){return 61===this.input.charCodeAt(this.pos+1)?this.finishOp(o.assign,2):this.finishOp(o.bitwiseXOR,1)},w.readToken_plus_min=function(t){var e=this.input.charCodeAt(this.pos+1);return e===t?45!==e||this.inModule||62!==this.input.charCodeAt(this.pos+2)||0!==this.lastTokEnd&&!U.test(this.input.slice(this.lastTokEnd,this.pos))?this.finishOp(o.incDec,2):(this.skipLineComment(3),this.skipSpace(),this.nextToken()):61===e?this.finishOp(o.assign,2):this.finishOp(o.plusMin,1)},w.readToken_lt_gt=function(t){var e=this.input.charCodeAt(this.pos+1),s=1;return e===t?(s=62===t&&62===this.input.charCodeAt(this.pos+2)?3:2,61===this.input.charCodeAt(this.pos+s)?this.finishOp(o.assign,s+1):this.finishOp(o.bitShift,s)):33!==e||60!==t||this.inModule||45!==this.input.charCodeAt(this.pos+2)||45!==this.input.charCodeAt(this.pos+3)?(61===e&&(s=2),this.finishOp(o.relational,s)):(this.skipLineComment(4),this.skipSpace(),this.nextToken())},w.readToken_eq_excl=function(t){var e=this.input.charCodeAt(this.pos+1);return 61===e?this.finishOp(o.equality,61===this.input.charCodeAt(this.pos+2)?3:2):61===t&&62===e&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(o.arrow)):this.finishOp(61===t?o.eq:o.prefix,1)},w.readToken_question=function(){var t=this.options.ecmaVersion;if(t>=11){var e=this.input.charCodeAt(this.pos+1);if(46===e){var s=this.input.charCodeAt(this.pos+2);if(s<48||s>57)return this.finishOp(o.questionDot,2)}if(63===e){if(t>=12)if(61===this.input.charCodeAt(this.pos+2))return this.finishOp(o.assign,3);return this.finishOp(o.coalesce,2)}}return this.finishOp(o.question,1)},w.readToken_numberSign=function(){var t=35;if(this.options.ecmaVersion>=13&&(++this.pos,Q(t=this.fullCharCodeAtPos(),!0)||92===t))return this.finishToken(o.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+se(t)+"'")},w.getTokenFromCode=function(t){switch(t){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(o.parenL);case 41:return++this.pos,this.finishToken(o.parenR);case 59:return++this.pos,this.finishToken(o.semi);case 44:return++this.pos,this.finishToken(o.comma);case 91:return++this.pos,this.finishToken(o.bracketL);case 93:return++this.pos,this.finishToken(o.bracketR);case 123:return++this.pos,this.finishToken(o.braceL);case 125:return++this.pos,this.finishToken(o.braceR);case 58:return++this.pos,this.finishToken(o.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(o.backQuote);case 48:var e=this.input.charCodeAt(this.pos+1);if(120===e||88===e)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(111===e||79===e)return this.readRadixNumber(8);if(98===e||66===e)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(t);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(t);case 124:case 38:return this.readToken_pipe_amp(t);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(t);case 60:case 62:return this.readToken_lt_gt(t);case 61:case 33:return this.readToken_eq_excl(t);case 63:return this.readToken_question();case 126:return this.finishOp(o.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+se(t)+"'")},w.finishOp=function(t,e){var s=this.input.slice(this.pos,this.pos+e);return this.pos+=e,this.finishToken(t,s)},w.readRegexp=function(){for(var t,e,s=this.pos;;){this.pos>=this.input.length&&this.raise(s,"Unterminated regular expression");var i=this.input.charAt(this.pos);if(U.test(i)&&this.raise(s,"Unterminated regular expression"),t)t=!1;else{if("["===i)e=!0;else if("]"===i&&e)e=!1;else if("/"===i&&!e)break;t="\\"===i}++this.pos}var n=this.input.slice(s,this.pos);++this.pos;var r=this.pos,a=this.readWord1();this.containsEsc&&this.unexpected(r);var h=this.regexpState||(this.regexpState=new Z(this));h.reset(s,n,a),this.validateRegExpFlags(h),this.validateRegExpPattern(h);var c=null;try{c=new RegExp(n,a)}catch{}return this.finishToken(o.regexp,{pattern:n,flags:a,value:c})},w.readInt=function(t,e,s){for(var i=this.options.ecmaVersion>=12&&void 0===e,n=s&&48===this.input.charCodeAt(this.pos),r=this.pos,a=0,o=0,h=0,c=e??1/0;h<c;++h,++this.pos){var l=this.input.charCodeAt(this.pos),p=void 0;if(i&&95===l)n&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals"),95===o&&this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore"),0===h&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits"),o=l;else{if((p=l>=97?l-97+10:l>=65?l-65+10:l>=48&&l<=57?l-48:1/0)>=t)break;o=l,a=a*t+p}}return i&&95===o&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===r||null!=e&&this.pos-r!==e?null:a},w.readRadixNumber=function(t){var e=this.pos;this.pos+=2;var s=this.readInt(t);return null==s&&this.raise(this.start+2,"Expected number in radix "+t),this.options.ecmaVersion>=11&&110===this.input.charCodeAt(this.pos)?(s=Zt(this.input.slice(e,this.pos)),++this.pos):Q(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(o.num,s)},w.readNumber=function(t){var e=this.pos;!t&&null===this.readInt(10,void 0,!0)&&this.raise(e,"Invalid number");var s=this.pos-e>=2&&48===this.input.charCodeAt(e);s&&this.strict&&this.raise(e,"Invalid number");var i=this.input.charCodeAt(this.pos);if(!s&&!t&&this.options.ecmaVersion>=11&&110===i){var n=Zt(this.input.slice(e,this.pos));return++this.pos,Q(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(o.num,n)}s&&/[89]/.test(this.input.slice(e,this.pos))&&(s=!1),46===i&&!s&&(++this.pos,this.readInt(10),i=this.input.charCodeAt(this.pos)),(69===i||101===i)&&!s&&((43===(i=this.input.charCodeAt(++this.pos))||45===i)&&++this.pos,null===this.readInt(10)&&this.raise(e,"Invalid number")),Q(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var r=Ki(this.input.slice(e,this.pos),s);return this.finishToken(o.num,r)},w.readCodePoint=function(){var t;if(123===this.input.charCodeAt(this.pos)){this.options.ecmaVersion<6&&this.unexpected();var e=++this.pos;t=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,t>1114111&&this.invalidStringToken(e,"Code point out of bounds")}else t=this.readHexChar(4);return t},w.readString=function(t){for(var e="",s=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var i=this.input.charCodeAt(this.pos);if(i===t)break;92===i?(e+=this.input.slice(s,this.pos),e+=this.readEscapedChar(!1),s=this.pos):8232===i||8233===i?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(ge(i)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return e+=this.input.slice(s,this.pos++),this.finishToken(o.string,e)};var Jt={};w.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(t){if(t!==Jt)throw t;this.readInvalidTemplateToken()}this.inTemplateElement=!1},w.invalidStringToken=function(t,e){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw Jt;this.raise(t,e)},w.readTmplToken=function(){for(var t="",e=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var s=this.input.charCodeAt(this.pos);if(96===s||36===s&&123===this.input.charCodeAt(this.pos+1))return this.pos!==this.start||this.type!==o.template&&this.type!==o.invalidTemplate?(t+=this.input.slice(e,this.pos),this.finishToken(o.template,t)):36===s?(this.pos+=2,this.finishToken(o.dollarBraceL)):(++this.pos,this.finishToken(o.backQuote));if(92===s)t+=this.input.slice(e,this.pos),t+=this.readEscapedChar(!0),e=this.pos;else if(ge(s)){switch(t+=this.input.slice(e,this.pos),++this.pos,s){case 13:10===this.input.charCodeAt(this.pos)&&++this.pos;case 10:t+="\n";break;default:t+=String.fromCharCode(s)}this.options.locations&&(++this.curLine,this.lineStart=this.pos),e=this.pos}else++this.pos}},w.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case"\\":++this.pos;break;case"$":if("{"!==this.input[this.pos+1])break;case"`":return this.finishToken(o.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":"\n"===this.input[this.pos+1]&&++this.pos;case"\n":case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1}this.raise(this.start,"Unterminated template")},w.readEscapedChar=function(t){var e=this.input.charCodeAt(++this.pos);switch(++this.pos,e){case 110:return"\n";case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return se(this.readCodePoint());case 116:return"\t";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:10===this.input.charCodeAt(this.pos)&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,"Invalid escape sequence"),t){var s=this.pos-1;this.invalidStringToken(s,"Invalid escape sequence in template string")}default:if(e>=48&&e<=55){var i=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],n=parseInt(i,8);return n>255&&(i=i.slice(0,-1),n=parseInt(i,8)),this.pos+=i.length-1,e=this.input.charCodeAt(this.pos),("0"!==i||56===e||57===e)&&(this.strict||t)&&this.invalidStringToken(this.pos-1-i.length,t?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(n)}return ge(e)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(e)}},w.readHexChar=function(t){var e=this.pos,s=this.readInt(16,t);return null===s&&this.invalidStringToken(e,"Bad character escape sequence"),s},w.readWord1=function(){this.containsEsc=!1;for(var t="",e=!0,s=this.pos,i=this.options.ecmaVersion>=6;this.pos<this.input.length;){var n=this.fullCharCodeAtPos();if(oe(n,i))this.pos+=n<=65535?1:2;else{if(92!==n)break;this.containsEsc=!0,t+=this.input.slice(s,this.pos);var r=this.pos;117!==this.input.charCodeAt(++this.pos)&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var a=this.readCodePoint();(e?Q:oe)(a,i)||this.invalidStringToken(r,"Invalid Unicode escape"),t+=se(a),s=this.pos}e=!1}return t+this.input.slice(s,this.pos)},w.readWord=function(){var t=this.readWord1(),e=o.name;return this.keywords.test(t)&&(e=Je[t]),this.finishToken(e,t)};var zi="8.15.0";function $e(t,e){return R.parse(t,e)}function Gi(t,e,s){return R.parseExpressionAt(t,e,s)}function Ke(t,e,s,i,n){var r=[];s||(s=m),function t(i,n,a){var o=a||i.type,h=i!==r[r.length-1];h&&r.push(i),s[o](i,n,t),e[o]&&e[o](i,n||r,r),h&&r.pop()}(t,i,n)}function at(t,e,s){s(t,e)}function pe(t,e,s){}R.acorn={Parser:R,version:zi,defaultOptions:Ge,Position:we,SourceLocation:Ve,getLineInfo:wt,Node:De,TokenType:k,tokTypes:o,keywordTypes:Je,TokContext:G,tokContexts:T,isIdentifierChar:oe,isIdentifierStart:Q,Token:nt,isNewLine:ge,lineBreak:U,lineBreakG:mi,nonASCIIwhitespace:St};var m={};m.Program=m.BlockStatement=m.StaticBlock=function(t,e,s){for(var i=0,n=t.body;i<n.length;i+=1){s(n[i],e,"Statement")}},m.Statement=at,m.EmptyStatement=pe,m.ExpressionStatement=m.ParenthesizedExpression=m.ChainExpression=function(t,e,s){return s(t.expression,e,"Expression")},m.IfStatement=function(t,e,s){s(t.test,e,"Expression"),s(t.consequent,e,"Statement"),t.alternate&&s(t.alternate,e,"Statement")},m.LabeledStatement=function(t,e,s){return s(t.body,e,"Statement")},m.BreakStatement=m.ContinueStatement=pe,m.WithStatement=function(t,e,s){s(t.object,e,"Expression"),s(t.body,e,"Statement")},m.SwitchStatement=function(t,e,s){s(t.discriminant,e,"Expression");for(var i=0,n=t.cases;i<n.length;i+=1){s(n[i],e)}},m.SwitchCase=function(t,e,s){t.test&&s(t.test,e,"Expression");for(var i=0,n=t.consequent;i<n.length;i+=1){s(n[i],e,"Statement")}},m.ReturnStatement=m.YieldExpression=m.AwaitExpression=function(t,e,s){t.argument&&s(t.argument,e,"Expression")},m.ThrowStatement=m.SpreadElement=function(t,e,s){return s(t.argument,e,"Expression")},m.TryStatement=function(t,e,s){s(t.block,e,"Statement"),t.handler&&s(t.handler,e),t.finalizer&&s(t.finalizer,e,"Statement")},m.CatchClause=function(t,e,s){t.param&&s(t.param,e,"Pattern"),s(t.body,e,"Statement")},m.WhileStatement=m.DoWhileStatement=function(t,e,s){s(t.test,e,"Expression"),s(t.body,e,"Statement")},m.ForStatement=function(t,e,s){t.init&&s(t.init,e,"ForInit"),t.test&&s(t.test,e,"Expression"),t.update&&s(t.update,e,"Expression"),s(t.body,e,"Statement")},m.ForInStatement=m.ForOfStatement=function(t,e,s){s(t.left,e,"ForInit"),s(t.right,e,"Expression"),s(t.body,e,"Statement")},m.ForInit=function(t,e,s){"VariableDeclaration"===t.type?s(t,e):s(t,e,"Expression")},m.DebuggerStatement=pe,m.FunctionDeclaration=function(t,e,s){return s(t,e,"Function")},m.VariableDeclaration=function(t,e,s){for(var i=0,n=t.declarations;i<n.length;i+=1){s(n[i],e)}},m.VariableDeclarator=function(t,e,s){s(t.id,e,"Pattern"),t.init&&s(t.init,e,"Expression")},m.Function=function(t,e,s){t.id&&s(t.id,e,"Pattern");for(var i=0,n=t.params;i<n.length;i+=1){s(n[i],e,"Pattern")}s(t.body,e,t.expression?"Expression":"Statement")},m.Pattern=function(t,e,s){"Identifier"===t.type?s(t,e,"VariablePattern"):"MemberExpression"===t.type?s(t,e,"MemberPattern"):s(t,e)},m.VariablePattern=pe,m.MemberPattern=at,m.RestElement=function(t,e,s){return s(t.argument,e,"Pattern")},m.ArrayPattern=function(t,e,s){for(var i=0,n=t.elements;i<n.length;i+=1){var r=n[i];r&&s(r,e,"Pattern")}},m.ObjectPattern=function(t,e,s){for(var i=0,n=t.properties;i<n.length;i+=1){var r=n[i];"Property"===r.type?(r.computed&&s(r.key,e,"Expression"),s(r.value,e,"Pattern")):"RestElement"===r.type&&s(r.argument,e,"Pattern")}},m.Expression=at,m.ThisExpression=m.Super=m.MetaProperty=pe,m.ArrayExpression=function(t,e,s){for(var i=0,n=t.elements;i<n.length;i+=1){var r=n[i];r&&s(r,e,"Expression")}},m.ObjectExpression=function(t,e,s){for(var i=0,n=t.properties;i<n.length;i+=1){s(n[i],e)}},m.FunctionExpression=m.ArrowFunctionExpression=m.FunctionDeclaration,m.SequenceExpression=function(t,e,s){for(var i=0,n=t.expressions;i<n.length;i+=1){s(n[i],e,"Expression")}},m.TemplateLiteral=function(t,e,s){for(var i=0,n=t.quasis;i<n.length;i+=1){s(n[i],e)}for(var r=0,a=t.expressions;r<a.length;r+=1){s(a[r],e,"Expression")}},m.TemplateElement=pe,m.UnaryExpression=m.UpdateExpression=function(t,e,s){s(t.argument,e,"Expression")},m.BinaryExpression=m.LogicalExpression=function(t,e,s){s(t.left,e,"Expression"),s(t.right,e,"Expression")},m.AssignmentExpression=m.AssignmentPattern=function(t,e,s){s(t.left,e,"Pattern"),s(t.right,e,"Expression")},m.ConditionalExpression=function(t,e,s){s(t.test,e,"Expression"),s(t.consequent,e,"Expression"),s(t.alternate,e,"Expression")},m.NewExpression=m.CallExpression=function(t,e,s){if(s(t.callee,e,"Expression"),t.arguments)for(var i=0,n=t.arguments;i<n.length;i+=1){s(n[i],e,"Expression")}},m.MemberExpression=function(t,e,s){s(t.object,e,"Expression"),t.computed&&s(t.property,e,"Expression")},m.ExportNamedDeclaration=m.ExportDefaultDeclaration=function(t,e,s){t.declaration&&s(t.declaration,e,"ExportNamedDeclaration"===t.type||t.declaration.id?"Statement":"Expression"),t.source&&s(t.source,e,"Expression")},m.ExportAllDeclaration=function(t,e,s){t.exported&&s(t.exported,e),s(t.source,e,"Expression")},m.ImportDeclaration=function(t,e,s){for(var i=0,n=t.specifiers;i<n.length;i+=1){s(n[i],e)}s(t.source,e,"Expression")},m.ImportExpression=function(t,e,s){s(t.source,e,"Expression")},m.ImportSpecifier=m.ImportDefaultSpecifier=m.ImportNamespaceSpecifier=m.Identifier=m.PrivateIdentifier=m.Literal=pe,m.TaggedTemplateExpression=function(t,e,s){s(t.tag,e,"Expression"),s(t.quasi,e,"Expression")},m.ClassDeclaration=m.ClassExpression=function(t,e,s){return s(t,e,"Class")},m.Class=function(t,e,s){t.id&&s(t.id,e,"Pattern"),t.superClass&&s(t.superClass,e,"Expression"),s(t.body,e)},m.ClassBody=function(t,e,s){for(var i=0,n=t.body;i<n.length;i+=1){s(n[i],e)}},m.MethodDefinition=m.PropertyDefinition=m.Property=function(t,e,s){t.computed&&s(t.key,e,"Expression"),t.value&&s(t.value,e,"Expression")};class q{static pruneCache(t){t.size>this.MAX_CACHE_SIZE&&Array.from(t.keys()).slice(0,t.size-this.MAX_CACHE_SIZE/2).forEach(e=>t.delete(e))}static clearCaches(){this.expressionCache.clear(),this.variableCache.clear(),this.bindingsCache.clear(),this.loopVariableCache.clear()}static extractStateBindings(t){if(this.bindingsCache.has(t))return[...this.bindingsCache.get(t)];const e=new Set;try{Ke($e(t,{ecmaVersion:2020}),{FunctionDeclaration(t,s){s.length<=2&&t.id&&t.id.name&&e.add(t.id.name)},VariableDeclaration(t,s){s.length>2||t.declarations.forEach(t=>{var s,i,n,r,a;"CallExpression"!==(null==(s=t.init)?void 0:s.type)||"pp"!==(null==(n=null==(i=t.init.callee)?void 0:i.object)?void 0:n.name)||"state"!==(null==(a=null==(r=t.init.callee)?void 0:r.property)?void 0:a.name)?("Identifier"===t.id.type&&e.add(t.id.name),"ObjectPattern"===t.id.type&&t.id.properties.forEach(t=>{var s,i;"Property"===t.type&&"Identifier"===(null==(s=t.value)?void 0:s.type)&&e.add(t.value.name),"RestElement"===t.type&&"Identifier"===(null==(i=t.argument)?void 0:i.type)&&e.add(t.argument.name)})):"ArrayPattern"===t.id.type&&t.id.elements.forEach(t=>{"Identifier"===(null==t?void 0:t.type)&&e.add(t.name)})})}})}catch(t){console.error("[PP-ERROR] AstParser Failed",t)}const s=Array.from(e);return this.pruneCache(this.bindingsCache),this.bindingsCache.set(t,s),s}static extractUsedVariables(t,e){const s=t+"|"+Array.from(e).sort().join(",");if(this.variableCache.has(s))return new Set(this.variableCache.get(s));const i=new Set;try{Ke($e(`(${t})`,{ecmaVersion:2020}),{Identifier(t,s){if(!e.has(t.name)){if(s.length>1){const e=s[s.length-2];if("MemberExpression"===e.type&&e.property===t&&!e.computed||"Property"===e.type&&e.key===t&&!e.computed&&!e.shorthand)return}i.add(t.name)}}})}catch{}return this.pruneCache(this.variableCache),this.variableCache.set(s,i),new Set(i)}static isValidExpression(t){if(!t.trim())return!1;if(this.expressionCache.has(t))return this.expressionCache.get(t);let e=!1;try{Gi(`(${t})`,0,{ecmaVersion:2020}),e=!0}catch{e=!1}return this.pruneCache(this.expressionCache),this.expressionCache.set(t,e),e}static analyzeLoopVariableUsage(t,e){const s=t+"|"+e;if(this.loopVariableCache.has(s))return[...this.loopVariableCache.get(s)];const i=[];try{Ke($e(t,{ecmaVersion:2020}),{Identifier(t,s){if(t.name!==e)return;let n=!1,r=!1,a=t.start,o=t.end;if(s.length>=2){const e=s[s.length-2];if("MemberExpression"===e.type&&e.property===t&&!e.computed||"Property"===e.type&&e.key===t&&!e.computed&&!e.shorthand)return;if("Property"===e.type&&e.shorthand&&(n=!0,s.length>=3)){const t=s[s.length-3];"ObjectExpression"===t.type&&1===t.properties.length&&(r=!0,a=t.start,o=t.end)}}i.push({start:a,end:o,isShorthand:n,isUnwrap:r})}})}catch{}return this.pruneCache(this.loopVariableCache),this.loopVariableCache.set(s,i),[...i]}}x(q,"expressionCache",new Map),x(q,"variableCache",new Map),x(q,"bindingsCache",new Map),x(q,"loopVariableCache",new Map),x(q,"MAX_CACHE_SIZE",1e3);const dt=new Set(["class","for","while","if","else","return","function","var","let","const","import","export","this","debugger","delete","typeof","void","new","in","instanceof","do","try","catch","finally","switch","case","default","break","continue","yield","await","with","super","enum","extends","implements","interface","package","private","protected","public","static"]),Xi=new Set(["Array","Object","String","Number","Boolean","Math","JSON","Date","RegExp","Error","Map","Set","WeakMap","WeakSet","Promise","Symbol","BigInt","parseInt","parseFloat","isNaN","isFinite","encodeURI","decodeURI","encodeURIComponent","decodeURIComponent","console","window","document","undefined","null","NaN","Infinity","pp","true","false","setTimeout","setInterval","clearTimeout","clearInterval","requestAnimationFrame","cancelAnimationFrame","fetch","alert","confirm","prompt"]),ei=new Set(["hidden","disabled","checked","selected","readonly","required","open","autofocus","multiple","ismap","noValidate","defer","async","autoplay","controls","loop","muted","default","reversed","scoped","seamless","sortable","translate","draggable","contenteditable","spellcheck"]);class ke{static escapeTemplateLiteralText(t){return t.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${")}static escapeTemplateLiteralTextPreservingInterpolations(t){let e="",s=0,i=0;for(;s<t.length;){if("$"===t[s]&&"{"===t[s+1]){const n=this.findClosingBrace(t,s+1);if(-1!==n){e+=this.escapeTemplateLiteralText(t.slice(i,s)),e+=t.slice(s,n+1),s=n+1,i=s;continue}}s++}return e+=this.escapeTemplateLiteralText(t.slice(i)),e}static clearCache(){this.cache.clear()}static pruneCache(){if(this.cache.size>this.MAX_CACHE_SIZE){const t=this.cache.size-Math.floor(this.MAX_CACHE_SIZE/2);let e=0;for(const s of this.cache.keys()){if(e>=t)break;this.cache.delete(s),e++}}}static transformSpreadAttributes(t){const e=new Map;let s=0;const i=document.createElement("template");i.innerHTML=t;const n=t=>{if(t.nodeType===Node.ELEMENT_NODE){const i=t;if(Array.from(i.childNodes).forEach(n),i.hasAttribute("pp-spread")){const t=i.getAttribute("pp-spread")||"";i.removeAttribute("pp-spread");const n=t.match(/^\s*\{\s*\.\.\.(.+?)\s*\}\s*$/);if(n){const t=ie(n[1].trim()),r=`___pp_spread_${s++}___`,a=`\${ (() => {\n const __obj = ${t};\n if (!__obj || typeof __obj !== 'object') return '';\n return Object.entries(__obj)\n .map(([k, v]) => {\n if (v == null) return '';\n const __escapedValue = String(v)\n .split('&').join('&')\n .split('"').join('"')\n .split('<').join('<');\n return k + '="' + __escapedValue + '"';\n })\n .filter(Boolean)\n .join(' ');\n })() }`;e.set(r,a),i.setAttribute(r,"")}}}};return Array.from(i.content.childNodes).forEach(n),{html:i.innerHTML,spreadReplacements:e}}static expandSpreadPlaceholders(t,e){let s=t;return e.forEach((t,e)=>{s=s.split(`${e}=""`).join(t),s=s.split(e).join(t)}),s}static transformRefAttributes(t){if(!t.includes("pp-ref"))return t;const e=document.createElement("template");e.innerHTML=t;const s=document.createTreeWalker(e.content,NodeFilter.SHOW_ELEMENT);let i=s.nextNode();for(;i;){const t=i;if(t.hasAttribute("pp-ref")){const e=(t.getAttribute("pp-ref")||"").match(/^\s*\{([\s\S]+)\}\s*$/);if(e){const s=ie(e[1].trim());t.removeAttribute("pp-ref"),t.setAttribute("data-pp-ref",`{ __pp_ref(${s}) }`)}}i=s.nextNode()}return e.innerHTML}static transformComponentTags(t){const e=document.createElement("template");e.innerHTML=t;const s=t=>{if(t.nodeType!==Node.ELEMENT_NODE)return;const e=t,i=e.tagName.toLowerCase();if(Array.from(e.childNodes).forEach(s),i.includes(".")){const t=document.createDocumentFragment();for(t.appendChild(document.createTextNode(`{${i}}`));e.firstChild;)t.appendChild(e.firstChild);e.replaceWith(t)}};return Array.from(e.content.childNodes).forEach(s),e.innerHTML}static normalizeTextareaValueAttributes(t){if(!t.includes("<textarea")||!t.includes("value="))return t;const e=document.createElement("template");return e.innerHTML=t,e.content.querySelectorAll("textarea").forEach(t=>{const e=t,s=e.getAttribute("value");null!==s&&(e.textContent=s,e.removeAttribute("value"))}),e.innerHTML}static compile(t,e){const s=(t||"").replace(/\r\n/g,"\n").replace(/\r/g,"\n"),i=t=>{let e=2166136261;for(let s=0;s<t.length;s++)e^=t.charCodeAt(s),e=e+((e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24))>>>0;return e.toString(16).padStart(8,"0")},n=e.join("\0"),r=`t${i(s)}|k${i(n)}|n${e.length}`;if(this.cache.has(r))return this.cache.get(r);const{maskedTemplate:a,placeholders:o}=this.maskComplexComponents(s),{maskedHtml:h,placeholders:c}=this.maskLiteralElements(a,"style","STYLE"),l=this.transformComponentTags(h),p=this.normalizeTextareaValueAttributes(l),{html:u,spreadReplacements:d}=this.transformSpreadAttributes(p),f=this.transformRefAttributes(u),{html:m,loopReplacements:g}=this.processStructuralDirectives(f);let x=this.transformBooleanAttributes(m);(()=>{let t=!0;for(;t;)t=!1,g.forEach((e,s)=>{const i=x;x=x.split("${"+s+"}").join("${"+e+"}"),x=x.split(s).join("{ "+e+" }"),x!==i&&(t=!0)})})();const v=new Set;let y="return `",b=0,E="";for(;b<x.length;){const t=x[b];if("o"===t||"O"===t){const t=x.slice(b,b+20).toLowerCase().match(/^on\w+\s*=\s*(["'])/);if(t){const e=x.slice(b,b+t[0].length),s=e[e.length-1];let i=b+t[0].length;for(;i<x.length&&(x[i]!==s||"\\"===x[i-1]);)i++;E+=x.slice(b,i+1),b=i+1;continue}}if("{"===t){const t=this.findClosingBrace(x,b);if(-1!==t){const e=x.slice(b+1,t),s=ie(e);if(q.isValidExpression(s)){y+=this.escapeTemplateLiteralText(E),E="";const e=q.extractUsedVariables(s,Xi);for(const t of e)/^___PP_LOOP_\d+___$/.test(t)||v.add(t);const i=s.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g," ");y+=`\${ (() => {\n try {\n const __res = (${s});\n // React pattern: ignore booleans, null, and undefined\n if (typeof __res === 'boolean' || __res == null) return '';\n // React pattern: join arrays without commas\n if (Array.isArray(__res)) return __res.join('');\n return __res;\n } catch(e) {\n console.error("[PP-ERROR] Template Expression Failed: \\"${i}\\"", e);\n return '';\n }\n })() }`,b=t+1;continue}e.trim().length>0&&console.warn(`[PP-WARN] Interpolation skipped. Invalid Syntax in: "{${s}}"`)}}E+=t,b++}y+=this.escapeTemplateLiteralText(E),y+="`;",y=this.expandSpreadPlaceholders(y,d);const C=Array.from(new Set([...e,...v]));try{const t=new Function(...C,y),e=(...e)=>{let s=t(...e);return s=this.restorePlaceholders(s,c),o.forEach((t,e)=>{s=s.replace(e,t)}),s};return this.pruneCache(),this.cache.set(r,e),e}catch(t){return console.error("[PP-ERROR] Compilation Failed",t),()=>"Error in Template"}}static maskLiteralElements(t,e,s){const i=document.createElement("template");i.innerHTML=t;const n=new Map;let r=0;return i.content.querySelectorAll(e).forEach(t=>{const e=`__PP_${s}_${r++}__`;n.set(e,t.outerHTML),t.replaceWith(document.createTextNode(e))}),{maskedHtml:i.innerHTML,placeholders:n}}static restorePlaceholders(t,e){let s=t;return e.forEach((t,e)=>{s=s.replace(e,t)}),s}static transformBooleanAttributes(t){let e="",s=0;for(;s<t.length;){let i=!1;for(const n of ei){const r=`${n}="{`,a=`${n}='{`;if(t.startsWith(r,s)){i=!0;const a=s+r.length-1,o=this.findClosingBrace(t,a);if(-1!==o&&'"'===t[o+1]){e+=`{ (${ie(t.slice(a+1,o))}) ? '${n}' : '' }`,s=o+2;break}}else if(t.startsWith(a,s)){i=!0;const r=s+a.length-1,o=this.findClosingBrace(t,r);if(-1!==o&&"'"===t[o+1]){e+=`{ (${ie(t.slice(r+1,o))}) ? '${n}' : '' }`,s=o+2;break}}}i||(e+=t[s],s++)}return e}static captureLoopVariablesInEventHandlers(t,e,s,i,n=!1,r=[]){let a="",o=0;for(;o<t.length;){const h=t.slice(o,o+40).toLowerCase().match(/^on\w+\s*=\s*(["'])/);if(h){const c=h[0].length,l=t.slice(o,o+c),p=l[l.length-1],u=o+c;let d=u;for(;d<t.length&&(t[d]!==p||"\\"===t[d-1]);)d++;const f=l.slice(0,-2).trim();let m=t.slice(u,d);m=this.rewriteLoopEventHandlerCode(m,e,s,i,n,r),a+=`${f}=${p}${m}${p}`,o=d+1;continue}a+=t[o],o++}return a}static rewriteLoopEventHandlerCode(t,e,s,i,n,r=[]){const a=t.match(/^\{([\s\S]*)\}$/),o=a?a[1]:t;let h=s,c=o;r.forEach(t=>{h=this.applyLoopContextRewrites(h,t),c=this.applyLoopContextRewrites(c,t)});const l={iterator:e,collectionName:h,indexVar:i,userDefinedIndex:n};return c=this.applyLoopContextRewrites(c,l),[...r,l].forEach(t=>{const e=this.getLoopIndexToken(t.indexVar);c=c.split(e).join(`\${${t.indexVar}}`)}),a?`{${c}}`:c}static getLoopIndexToken(t){return`__PP_LOOP_IDX_${t}__`}static applyLoopContextRewrites(t,e){const s=this.getLoopIndexToken(e.indexVar);let i=t;return e.userDefinedIndex&&(i=this.replaceLoopIdentifierUsages(i,e.indexVar,s)),this.replaceLoopIdentifierUsages(i,e.iterator,`(${e.collectionName})[${s}]`)}static replaceLoopIdentifierUsages(t,e,s){const i=q.analyzeLoopVariableUsage(t,e).slice().sort((t,e)=>e.start-t.start);if(0===i.length)return t;let n=t;return i.forEach(t=>{const i=t.isShorthand?this.buildShorthandReplacement(e,s,t.isUnwrap):s;n=n.slice(0,t.start)+i+n.slice(t.end)}),n}static buildShorthandReplacement(t,e,s){return s?`{ ${t}: ${e} }`:`${t}: ${e}`}static processStructuralDirectives(t){if(!t.includes("pp-for"))return{html:t,loopReplacements:new Map};const e=document.createElement("template");e.innerHTML=t;const s=new Map;let i=0,n=0;const r=(t,e=[])=>{const a=Array.from(t.childNodes);for(const t of a){if(t.nodeType!==Node.ELEMENT_NODE)continue;const a=t;if("TEMPLATE"===a.tagName){const t=a,o=t.getAttribute("pp-for")||"";let h=null;if(t.hasAttribute("pp-for")){const t=o.match(/^\s*\(\s*(.+?)\s*,\s*(.+?)\s*\)\s+in\s+(.+?)\s*$/),e=o.match(/^\s*(.+?)\s+in\s+(.+?)\s*$/);let s,i,r,a=!1;if(t)s=t[1].trim(),i=t[2].trim(),r=t[3].trim(),a=!0;else{if(!e)continue;s=e[1].trim(),r=e[2].trim(),i="__pp_idx_"+n++}h={iterator:s,collectionName:r,indexVar:i,userDefinedIndex:a}}if(r(t.content,h?[...e,h]:e),h){const{iterator:n,collectionName:r,indexVar:a,userDefinedIndex:o}=h;let c=t.innerHTML;c=this.transformComponentTags(c),c=this.transformRefAttributes(c),c=this.captureLoopVariablesInEventHandlers(c,n,r,a,o,e),c=c.replace(/___PP_LOOP_\d+___/g,t=>"${"+t+"}"),c=c.replace(/\r/g,""),c=this.transformBooleanAttributes(c),c=this.transformInterpolations(c),c=this.escapeTemplateLiteralTextPreservingInterpolations(c);const l=`(Array.isArray(${r}) ? ${r} : []).map(${`(${n}, ${a})`} => \`${c}\`).join('')`,p=`___PP_LOOP_${i++}___`;s.set(p,l),t.replaceWith(document.createTextNode(p));continue}continue}r(a,e)}};return r(e.content),{html:e.innerHTML,loopReplacements:s}}static transformInterpolations(t){let e="",s=0;for(;s<t.length;){if("o"===t[s]||"O"===t[s]){const i=t.slice(s,s+20).toLowerCase().match(/^on\w+\s*=\s*(["'])/);if(i){const n=t.slice(s,s+i[0].length),r=n[n.length-1];let a=s+i[0].length;for(;a<t.length&&(t[a]!==r||"\\"===t[a-1]);)a++;e+=t.slice(s,a+1),s=a+1;continue}}if("{"===t[s]){if(s>0&&"$"===t[s-1]){e+="{",s++;continue}const i=this.findClosingBrace(t,s);if(-1!==i){const n=ie(t.slice(s+1,i));if(q.isValidExpression(n)){e+="${"+n+"}",s=i+1;continue}}}e+=t[s],s++}return e}static maskComplexComponents(t){if(!t.includes("pp-component="))return{maskedTemplate:t,placeholders:new Map};const e=document.createElement("template");e.innerHTML=t;const s=new Map;let i=0;const n=t=>{if(t instanceof Element&&t.hasAttribute("pp-component")){const e=!!t.querySelector('script[type="text/pp"]'),n=!!t.querySelector("template[pp-owner]");if(e||n){const e=`__PP_CHILD_${i++}__`;return s.set(e,t.outerHTML),void t.replaceWith(document.createTextNode(e))}}Array.from(t.children).forEach(t=>n(t))};return n(e.content),{maskedTemplate:e.innerHTML,placeholders:s}}static findClosingBrace(t,e){let s=0,i=null;for(let n=e;n<t.length;n++){const e=t[n];let r=!1;if(n>0&&"\\"===t[n-1]){let e=0,s=n-1;for(;s>=0&&"\\"===t[s];)e++,s--;e%2!=0&&(r=!0)}if(i)e===i&&!r&&(i=null);else if(r||'"'!==e&&"'"!==e&&"`"!==e)if("{"!==e||r){if("}"===e&&!r&&(s--,0===s))return n}else s++;else i=e}return-1}}x(ke,"cache",new Map),x(ke,"MAX_CACHE_SIZE",200);const mt=new Set(["data-state","style"]),Qi=["script","domDiff","bindEvents","bindRefs","bootstrapNested","portals","restoreFocus","layoutEffects","effects","total"];function xt(){return typeof performance<"u"&&"function"==typeof performance.now?performance.now():Date.now()}const V=class t{constructor(t){x(this,"el"),x(this,"id"),x(this,"rawTemplate"),x(this,"renderFunction"),x(this,"templateFn",null),x(this,"hooksSystem"),x(this,"eventManager"),x(this,"latestScope",{}),x(this,"__ppRefStore",new Map),x(this,"__ppPrevRefStore",null),x(this,"__ppRefSeq",0),x(this,"isRendering",!1),x(this,"props",{}),x(this,"ownedChildren",new Map),x(this,"lastRenderedHtml",""),x(this,"renderCount",0),x(this,"trackedPortals",new Map),x(this,"parentId",null),x(this,"initialChildrenHtml",""),x(this,"pendingEventElements",new Set),x(this,"traversalCache",null),x(this,"pendingProvidedContexts",new Map),x(this,"pendingContextTokens",new Set),x(this,"contextRefreshPending",!1),x(this,"_lastRawScopeKeySig",""),x(this,"_lastSortedKeys",[]),x(this,"_lastSortedScopeKeySig",""),x(this,"_cachedHooksAPI",null),x(this,"_propFnCache",new Map),x(this,"_interpolationFnCache",new Map),x(this,"_scopeEvalFnCache",new Map),x(this,"_refEvalFnCache",new Map),this.el=t,this.id=this.el.getAttribute("pp-component")||"",this.id||(this.id="anon_"+Math.random().toString(36).substring(2,9),this.el.setAttribute("pp-component",this.id)),this.props=Array.from(this.el.attributes).reduce((t,e)=>{const s=e.name;if(s.startsWith("on")||"pp-component"===s)return t;const i=ot(s);return dt.has(i)||(t[i]=e.value),t},{}),E.registerInstance(this.id,this),this.syncParentId(),this.props=this.computePropsFromAttributes();let e=E.getTemplate(this.id);const s=E.getOwnedTemplates(this.id);e?s&&(this.ownedChildren=s):(this.extractOwnedTemplates(),e=this.el.innerHTML,E.saveTemplate(this.id,e),E.saveOwnedTemplates(this.id,this.ownedChildren)),this.initialChildrenHtml=e,this.props.children=this.initialChildrenHtml,this.hooksSystem=new ri(()=>{this.isRendering||this.render()});const i=E.getState(this.id);i&&this.hooksSystem.loadState(i);const n=Ue(this.initialChildrenHtml,this.el.tagName.toLowerCase()),r=this.findOwnScript(n.root),a=(null==r?void 0:r.textContent)||"";r&&r.remove(),this.rawTemplate=n.toHtml(),this.renderFunction=this.createRenderFunction(a),this.eventManager=new ui(this.el,()=>this.latestScope,t=>this.isManagedEventElement(t)),this.render()}syncParentId(){var t;const e=null==(t=this.el.parentElement)?void 0:t.closest("[pp-component]");this.parentId=e?e.getAttribute("pp-component"):null,E.saveParent(this.id,this.parentId)}static setPerfEnabled(t){this.perfEnabled=t}static getPerfEnabled(){return this.perfEnabled}static resetPerfStats(){this.perfStats.clear()}static getPerfStats(){return Object.fromEntries(this.perfStats.entries())}static createEmptyPerfEntry(){const t={};return Qi.forEach(e=>{t[e]={count:0,totalMs:0,maxMs:0}}),{renderCount:0,phases:t}}recordPerfPhase(e,s){if(!t.perfEnabled)return;let i=t.perfStats.get(this.id);i||(i=t.createEmptyPerfEntry(),t.perfStats.set(this.id,i));const n=i.phases[e];n.count++,n.totalMs+=s,n.maxMs=Math.max(n.maxMs,s)}startPerfTimer(){return t.perfEnabled?xt():0}endPerfTimer(e,s){t.perfEnabled&&this.recordPerfPhase(e,xt()-s)}findOwnScript(t){const e=Array.from(t.children);for(const t of e){if("script"===t.tagName.toLowerCase()&&"text/pp"===t.getAttribute("type"))return t;if(t.hasAttribute("pp-component"))continue;const e=this.findOwnScript(t);if(e)return e}return null}interpolateAttrString(t,e){const s=de(e),i=s.keys,n=me(e,i),r=s.keySig;return t.replace(/\{([\s\S]*?)\}/g,(t,e)=>{const s=ie(String(e).trim());try{const t=this.getCachedFunction(this._interpolationFnCache,s,i,r,300)(...n);return"boolean"==typeof t||null==t?"":Array.isArray(t)?t.join(""):String(t)}catch(t){return console.warn(`[PP-WARN] Failed attribute interpolation for {${s}}`,t),""}})}applyAttributeInterpolations(t,e){const s=de(e),i=s.keys,n=me(e,i),r=s.keySig;for(const s of Array.from(t.attributes)){const a=s.name;if("pp-component"===a||a.startsWith("on"))continue;const o=s.value;if(!o.includes("{"))continue;if(!/^\s*\{[\s\S]*\}\s*$/.test(o)){const s=this.interpolateAttrString(o,e);s!==o&&t.setAttribute(a,s);continue}const h=o.match(/^\s*\{([\s\S]*)\}\s*$/);if(!h)continue;const c=ie(h[1].trim());if(!q.isValidExpression(c))continue;let l;try{l=this.getCachedFunction(this._scopeEvalFnCache,c,i,r,300)(...n)}catch(t){console.error(`[PP-ERROR] Failed to eval "${c}"`,t);continue}if(ei.has(a.toLowerCase())){l?t.setAttribute(a,""):t.removeAttribute(a);continue}const p=typeof l;null==l?t.removeAttribute(a):("string"===p||"number"===p||"boolean"===p||"bigint"===p)&&t.setAttribute(a,String(l))}}computePropsFromAttributes(){const t=this.parentId?E.getScope(this.parentId):void 0,e=t?de(t):null,s=(null==e?void 0:e.keys)??[],i=t?me(t,s):[],n=this.el.__ppRawBindings,r=new Set([...Array.from(this.el.attributes).map(t=>t.name),...n?Object.keys(n):[]]),a=(null==e?void 0:e.keySig)??"",o=e=>{if(t)try{const t=e+"|"+a;let n=this._propFnCache.get(t);if(!n){if(n=new Function(...s,`"use strict"; return (${e});`),this._propFnCache.size>200){const t=this._propFnCache.keys().next().value;void 0!==t&&this._propFnCache.delete(t)}this._propFnCache.set(t,n)}return n(...i)}catch(t){return void console.warn(`[PP-WARN] Failed to evaluate prop expression "{${e}}" for component "${this.id}"`,t)}};return Array.from(r).reduce((e,s)=>{if(s.startsWith("on")&&!s.includes("-")||"pp-component"===s)return e;const i=ot(s);if(dt.has(i))return e;const r=this.el.attributes.getNamedItem(s),a=(null==n?void 0:n[s])??(null==r?void 0:r.value);if(void 0===a)return e;if(""===a)return e[i]=!0,e;if(t){const s=a.match(/^\s*\{([\s\S]*)\}\s*$/);if(s){const t=ie(s[1].trim());if(q.isValidExpression(t))return e[i]=o(t),e}if(a.includes("{"))return e[i]=this.interpolateAttrString(a,t),e}return e[i]=a,e},{})}refreshPropsFromParent(){const t=this.computePropsFromAttributes();t.children=this.initialChildrenHtml,oi(this.props,t)&&0===this.ownedChildren.size?this.bootstrapNestedComponents():(this.props=t,this.isRendering||this.render())}extractOwnedTemplates(){const t=this.el.querySelectorAll("template[pp-owner]");let e=0;t.forEach(t=>{var s,i;if((null==(s=t.parentElement)?void 0:s.closest("[pp-component]"))!==this.el)return;const n=t.getAttribute("pp-owner");if(n&&n!==this.id){const s=`__PP_OWNED_${this.id}_${e++}__`;this.ownedChildren.set(s,{ownerId:n,content:t.innerHTML,contextTag:(null==(i=t.parentElement)?void 0:i.tagName.toLowerCase())??null});const r=document.createComment(s);t.replaceWith(r)}})}replaceOwnedPlaceholder(t,e,s){const i=`\x3c!--${e}--\x3e`;return t.includes(i)?t.replace(i,s):t.replace(e,s)}maskNestedOwnedTemplates(t,e=null){const s=new Map,i=Ue(t,e);let n=0;const r=i.root.querySelectorAll("[pp-component] > template[pp-owner]");for(const t of Array.from(r)){const e=`__PP_NESTED_TPL_${n++}__`;s.set(e,t.outerHTML),t.replaceWith(document.createComment(e))}return{content:i.toHtml(),placeholders:s}}restoreMaskedOwnedTemplates(t,e){if(0===e.size)return;const s=document.createTreeWalker(t,NodeFilter.SHOW_COMMENT),i=[];let n=s.nextNode();for(;n;){const t=n,r=e.get(t.data||"");if(r){const e=document.createElement("template");e.innerHTML=r;const s=e.content.firstChild;s&&i.push({node:t,replacement:s})}n=s.nextNode()}i.forEach(({node:t,replacement:e})=>{t.replaceWith(e)})}renderOwnedContent(t,e,s){const{content:i,placeholders:n}=this.maskNestedOwnedTemplates(t.content,t.contextTag),r=de(s).keys,a=me(s,r),o=ai(t.contextTag),h=ke.compile(o.wrap(i),r);let c=o.unwrap(h(...a));for(const[t,e]of n)c=this.replaceOwnedPlaceholder(c,t,e);return this.markOwnedEventHandlers(c,e)}resolveOwnedTemplateOwner(t,e=this.id){const s=E.resolveComponentId(t,e);if(!s)return null;const i=E.getResolvedScopeWithAncestors(t,e);return i?{ownerId:s,scope:i}:null}resolveOwnedChildren(t){if(!t.includes("__PP_OWNED_"))return t;this.ownedChildren.forEach((e,s)=>{const i=this.resolveOwnedTemplateOwner(e.ownerId);if(i){const n=this.renderOwnedContent(e,i.ownerId,i.scope);t=this.replaceOwnedPlaceholder(t,s,n)}else t=this.replaceOwnedPlaceholder(t,s,e.content)});const e=/__PP_OWNED_([^_]+(?:_[^_]+)*)_(\d+)__/g;let s;for(;null!==(s=e.exec(t));){const i=s[0],n=s[1],r=E.getOwnedTemplates(n);if(r&&r.has(i)){const s=r.get(i),a=this.resolveOwnedTemplateOwner(s.ownerId,n);if(a){const e=this.renderOwnedContent(s,a.ownerId,a.scope);t=this.replaceOwnedPlaceholder(t,i,e)}else t=this.replaceOwnedPlaceholder(t,i,s.content);e.lastIndex=0}}return t}markOwnedEventHandlers(t,e){const s=document.createElement("template");s.innerHTML=t;const i=document.createTreeWalker(s.content,NodeFilter.SHOW_ELEMENT);let n=i.nextNode();for(;n;){const t=n;Array.from(t.attributes).some(t=>t.name.startsWith("on"))&&t.setAttribute("pp-event-owner",e),n=i.nextNode()}return s.innerHTML}getCachedFunction(t,e,s,i,n){const r=e+"|"+i;let a=t.get(r);if(!a){if(a=new Function(...s,`"use strict"; return (${e});`),t.size>n){const e=t.keys().next().value;void 0!==e&&t.delete(e)}t.set(r,a)}return a}createRenderFunction(t){const e=q.extractStateBindings(t);return new Function("pp",`\n "use strict";\n ${t}\n return { ${e.join(", ")} };\n `)}unmountPreviousRefs(){if(this.__ppPrevRefStore){for(const t of this.__ppPrevRefStore.values())try{"function"==typeof t?t(null):t&&"object"==typeof t&&"current"in t&&(t.current=null)}catch(t){console.warn("[PP-WARN] Ref cleanup failed",t)}this.__ppPrevRefStore=null}}createRefCaptureFunction(){return this.__ppRefStore=new Map,this.__ppRefSeq=0,t=>{const e=`ppref_${this.id}_${++this.__ppRefSeq}`;return this.__ppRefStore.set(e,t),e}}consumeContext(t){return this.pendingContextTokens.add(t),E.resolveContext(this.parentId,t).value}provideContext(t,e){this.pendingProvidedContexts.set(t,e)}requestContextRefresh(){this.contextRefreshPending||(this.contextRefreshPending=!0,queueMicrotask(()=>{if(this.contextRefreshPending=!1,E.getInstance(this.id)===this){if(this.isRendering)return void this.requestContextRefresh();this.forceUpdate()}}))}refreshContextConsumers(t){var e;for(const s of t){const t=E.getInstance(s);null==(e=null==t?void 0:t.requestContextRefresh)||e.call(t)}}makeHooksAPI(){return this._cachedHooksAPI?this._cachedHooksAPI.props=this.props:this._cachedHooksAPI={state:t=>this.hooksSystem.useState(t),effect:(t,e)=>this.hooksSystem.useEffect(t,e),layoutEffect:(t,e)=>this.hooksSystem.useLayoutEffect(t,e),ref:(t=null)=>this.hooksSystem.useRef(t),memo:(t,e)=>this.hooksSystem.useMemo(t,e),callback:(t,e)=>this.hooksSystem.useCallback(t,e),reducer:(t,e)=>this.hooksSystem.useReducer(t,e),context:t=>this.consumeContext(t),provideContext:(t,e)=>this.provideContext(t,e),portal:(t,e)=>this.hooksSystem.usePortal(t,e),props:this.props},this._cachedHooksAPI}syncTrackedPortals(t){if(0===this.trackedPortals.size)return;const e=this.hooksSystem.getPortalRegistrations();if(0===e.length)return;const s=new Map,i=new Map;t.querySelectorAll("*").forEach(t=>{const e=t,n=e.getAttribute("data-pp-ref");if(n){const t=s.get(n);t?t.push(e):s.set(n,[e])}const r=e.getAttribute("pp-ref");if(r){const t=i.get(r);t?t.push(e):i.set(r,[e])}});const n=new Map;for(const[t,e]of this.__ppRefStore.entries()){if(!e||"object"!=typeof e||!("current"in e))continue;const s=e,i=n.get(s);i?i.push(t):n.set(s,[t])}const r=new Map;for(const[t,e]of Object.entries(this.latestScope)){if(!e||"object"!=typeof e||!("current"in e))continue;const s=e,i=r.get(s);i?i.push(t):r.set(s,[t])}const a=(t,e)=>{for(const s of e){const e=t.get(s);if(!e||0===e.length)continue;const i=e.shift()??null;if(0===e.length&&t.delete(s),i)return i}return null},o=[];for(const t of e){const e=t.ref.current;if(!e||!this.trackedPortals.has(e))continue;const h=n.get(t.ref)??[];let c=a(s,h);if(!c){const e=r.get(t.ref)??[];c=a(i,e)}if(!c)continue;const l=this.trackedPortals.get(e);o.push({liveElement:e,sourceElement:c,placeholderText:l.placeholder.data||`pp-portal:${this.id}`})}0!==o.length&&(o.forEach(({sourceElement:t,placeholderText:e})=>{t.replaceWith(document.createComment(e))}),o.forEach(({liveElement:t,sourceElement:e})=>{this.morphTrackedPortalRoot(t,e)}))}morphTrackedPortalRoot(t,e){if(t.tagName!==e.tagName){const s=t.parentNode;if(!s)return;const i=e.cloneNode(!0),n=this.trackedPortals.get(t);return s.replaceChild(i,t),this.collectEventElements(i),void(n&&(this.trackedPortals.delete(t),this.trackedPortals.set(i,{...n,element:i})))}this.syncAttributes(t,e,!0),this.hasEventAttributes(t)&&this.pendingEventElements.add(t),this.morphChildren(t,e)}applyPortals(){const t=this.hooksSystem.getPortalRegistrations(),e=new Set;let s=!1;for(const i of t){const t=i.ref.current;if(!t)continue;const n=i.target??document.body;e.add(t);const r=this.trackedPortals.get(t);if(null!=r&&r.placeholder.parentNode){r.target!==n&&(n.appendChild(t),r.target=n,s=!0);continue}null===i.info.sourceParent&&t.parentNode instanceof Element&&(i.info.sourceParent=t.parentNode);const a=document.createComment(`pp-portal:${this.id}`);t.parentNode&&t.parentNode.insertBefore(a,t),n.appendChild(t),s=!0,this.trackedPortals.set(t,{element:t,placeholder:a,target:n})}for(const[t,i]of this.trackedPortals)e.has(t)||(i.placeholder.parentNode?(i.placeholder.parentNode.insertBefore(t,i.placeholder),i.placeholder.remove()):t.parentNode&&t.remove(),this.trackedPortals.delete(t),s=!0);s&&this.invalidateTraversalCache()}render(){var e;if(this.isRendering)return;this.isRendering=!0,this.renderCount++;const s=this.startPerfTimer();if(t.perfEnabled){let e=t.perfStats.get(this.id);e||(e=t.createEmptyPerfEntry(),t.perfStats.set(this.id,e)),e.renderCount++}try{this.unmountPreviousRefs(),this.pendingProvidedContexts=new Map,this.pendingContextTokens=new Set;const t=this.saveFocusState();this.hooksSystem.prepareRender();const s=this.makeHooksAPI(),i=globalThis.pp,n=(null==(e=null==i?void 0:i.createComponentRuntime)?void 0:e.call(i,s))??s,r=this.startPerfTimer(),a=this.renderFunction(n);this.endPerfTimer("script",r),E.saveState(this.id,this.hooksSystem.getHooks()),this.latestScope={...this.props,...a},this.latestScope.__pp_ref=this.createRefCaptureFunction(),E.saveScope(this.id,this.latestScope);const o=de(this.latestScope),h=o.keys,c=o.keySig;let l,p;c===this._lastRawScopeKeySig?(l=this._lastSortedKeys,p=this._lastSortedScopeKeySig):(l=h.length>1?[...h].sort():h.slice(),p=l.join("\0"),this._lastRawScopeKeySig=c,this._lastSortedKeys=l,this._lastSortedScopeKeySig=p);const u=me(this.latestScope,l);this.templateFn||(this.templateFn=ke.compile(this.rawTemplate,l));let d=this.templateFn(...u);if(d=this.resolveOwnedChildren(d),this.lastRenderedHtml!==d){const t=this.startPerfTimer();this.applyDomDiff(d),this.endPerfTimer("domDiff",t),this.lastRenderedHtml=d}if(this.hasEventAttributes(this.el)&&this.pendingEventElements.add(this.el),this.pendingEventElements.size>0){const t=this.pendingEventElements;this.pendingEventElements=new Set;const e=this.startPerfTimer();this.eventManager.bindEvents(t),this.endPerfTimer("bindEvents",e)}const f=this.startPerfTimer();this.bindRefs(l,u,p),this.endPerfTimer("bindRefs",f);const m=E.saveContextValues(this.id,this.pendingProvidedContexts);E.updateContextDependencies(this.id,this.pendingContextTokens);const g=m.length>0?E.getConsumersForContextsInSubtree(this.id,m):null;this.__ppPrevRefStore=new Map(this.__ppRefStore);const x=this.startPerfTimer();this.bootstrapNestedComponents(),this.endPerfTimer("bootstrapNested",x);const v=this.startPerfTimer();this.applyPortals(),this.endPerfTimer("portals",v);const y=this.startPerfTimer();this.restoreFocusState(t),this.endPerfTimer("restoreFocus",y);const b=this.startPerfTimer();this.hooksSystem.runLayoutEffects(),this.endPerfTimer("layoutEffects",b);const C=this.startPerfTimer();this.hooksSystem.runEffects(),this.endPerfTimer("effects",C),null!=g&&g.size&&this.refreshContextConsumers(g)}catch(t){console.error("[PP-ERROR] Render Cycle Failed",t)}finally{this.endPerfTimer("total",s),this.isRendering=!1}}applyDomDiff(t){if(typeof SVGElement<"u"&&this.el instanceof SVGElement){const e=(new DOMParser).parseFromString(`<svg xmlns="http://www.w3.org/2000/svg">${t}</svg>`,"image/svg+xml").documentElement,s=document.createDocumentFragment();return Array.from(e.childNodes).forEach(t=>{s.appendChild(document.importNode(t,!0))}),this.morphChildren(this.el,s),void this.invalidateTraversalCache()}const{content:e,placeholders:s}=this.maskNestedOwnedTemplates(t,this.el.tagName.toLowerCase()),i=Ue(e,this.el.tagName.toLowerCase()).root;this.restoreMaskedOwnedTemplates(i,s),this.syncTrackedPortals(i),this.morphChildren(this.el,i),this.invalidateTraversalCache()}isInsideTrackedPortal(t){for(const[e]of this.trackedPortals)if(e===t||e.contains(t))return!0;return!1}createNestedBoundaryId(e){return t.nestedBoundarySequence+=1,`${e}__pp${t.nestedBoundarySequence.toString(36)}`}getBoundaryBaseId(t){const e=t,s=t.getAttribute("pp-component");return!e.__ppBaseComponentId&&s&&(e.__ppBaseComponentId=s),e.__ppBaseComponentId??s}ensureBoundaryIdentity(t){var e;const s=t,i=t.getAttribute("pp-component")||"";if(s.__ppRuntimeComponentId)return i!==s.__ppRuntimeComponentId&&t.setAttribute("pp-component",s.__ppRuntimeComponentId),s.__ppBaseComponentId||(s.__ppBaseComponentId=i||s.__ppRuntimeComponentId),s.__ppRuntimeComponentId;if(!i)return"";s.__ppBaseComponentId=i;const n=E.getInstance(i);if(n&&n.el&&n.el!==t){if(n.el.isConnected){const e=this.createNestedBoundaryId(i);return s.__ppRuntimeComponentId=e,t.setAttribute("pp-component",e),e}null==(e=n.destroy)||e.call(n)}return s.__ppRuntimeComponentId=i,i}syncNestedBoundaryAttributes(t,e){const s=e.getAttribute("pp-component"),i=this.getBoundaryBaseId(t);if(!s||i&&s!==i)return!1;this.syncAttributes(t,e,!1,!0);const n=t;return n.__ppRuntimeComponentId&&t.getAttribute("pp-component")!==n.__ppRuntimeComponentId&&t.setAttribute("pp-component",n.__ppRuntimeComponentId),!0}morphChildren(t,e){if(this.hasKeyedDirectChildren(t)||this.hasKeyedDirectChildren(e))return void this.morphKeyedChildren(t,e);let s=t.firstChild,i=e.firstChild;for(;s||i;){const e=(null==s?void 0:s.nextSibling)??null,n=(null==i?void 0:i.nextSibling)??null;if(i){if(!s){const e=i.cloneNode(!0);t.appendChild(e),e.nodeType===Node.ELEMENT_NODE&&this.collectEventElements(e),i=n;continue}if(s.nodeType!==i.nodeType){const r=i.cloneNode(!0);t.replaceChild(r,s),r.nodeType===Node.ELEMENT_NODE&&this.collectEventElements(r),s=e,i=n;continue}if(s.nodeType!==Node.TEXT_NODE){if(s.nodeType===Node.ELEMENT_NODE){const r=s,a=i;if(r.tagName!==a.tagName){const r=i.cloneNode(!0);t.replaceChild(r,s),r.nodeType===Node.ELEMENT_NODE&&this.collectEventElements(r),s=e,i=n;continue}if(r.hasAttribute("pp-component")&&r!==this.el){if(!this.syncNestedBoundaryAttributes(r,a)){const r=i.cloneNode(!0);t.replaceChild(r,s),r.nodeType===Node.ELEMENT_NODE&&this.collectEventElements(r),s=e,i=n;continue}this.hasEventAttributes(r)&&this.pendingEventElements.add(r),s=e,i=n;continue}const o=this.isInsideTrackedPortal(r);this.syncAttributes(r,a,o),this.hasEventAttributes(r)&&this.pendingEventElements.add(r),this.morphChildren(r,a)}s=e,i=n}else s.textContent!==i.textContent&&(s.textContent=i.textContent),s=e,i=n}else s&&t.removeChild(s),s=e}}hasKeyedDirectChildren(t){const e=t.childNodes;for(let t=0;t<e.length;t++){const s=e[t];if(null!==this.getNodeKey(s))return!0}return!1}getNodeKey(t){if(t.nodeType!==Node.ELEMENT_NODE)return null;const e=t.getAttribute("key");return e&&e.length>0?e:null}areNodesCompatible(t,e){if(t.nodeType!==e.nodeType)return!1;if(t.nodeType!==Node.ELEMENT_NODE)return!0;const s=e;if(t.tagName!==s.tagName)return!1;const i=this.getNodeKey(t),n=this.getNodeKey(e);return null===i&&null===n||null!==i&&i===n}morphKeyedChildren(t,e){const s=Array.from(t.childNodes),i=Array.from(e.childNodes),n=this.collectDuplicateKeys(i),r=new Map,a=[];n.length>0&&console.warn(`[PP-WARN] Duplicate key values detected: ${n.join(", ")}`),s.forEach(t=>{const e=this.getNodeKey(t);if(null===e)return void a.push(t);const s=r.get(e);s?s.push(t):r.set(e,[t])});let o=t.firstChild;i.forEach(e=>{const s=this.getNodeKey(e);let i;if(null!==s){const t=r.get(s);for(;t&&t.length>0;){const s=t.shift();if(this.areNodesCompatible(s,e)){i=s;break}a.push(s)}}else{const t=a.findIndex(t=>this.areNodesCompatible(t,e));-1!==t&&(i=a.splice(t,1)[0])}if(i)i!==o&&t.insertBefore(i,o);else{const s=e.cloneNode(!0);t.insertBefore(s,o),s.nodeType===Node.ELEMENT_NODE&&this.collectEventElements(s),i=s}this.morphNode(i,e),o=i.nextSibling}),a.forEach(e=>{e.parentNode===t&&t.removeChild(e)}),r.forEach(e=>{e.forEach(e=>{e.parentNode===t&&t.removeChild(e)})})}collectDuplicateKeys(t){const e=new Set,s=new Set;return t.forEach(t=>{const i=this.getNodeKey(t);if(null!==i){if(e.has(i))return void s.add(i);e.add(i)}}),Array.from(s.values())}morphNode(t,e){if(t.nodeType!==e.nodeType){const s=t.parentNode;if(!s)return;const i=e.cloneNode(!0);return s.replaceChild(i,t),void(i.nodeType===Node.ELEMENT_NODE&&this.collectEventElements(i))}if(t.nodeType===Node.TEXT_NODE)return void(t.textContent!==e.textContent&&(t.textContent=e.textContent));if(t.nodeType!==Node.ELEMENT_NODE)return;const s=t,i=e;if(s.tagName!==i.tagName){const t=s.parentNode;if(!t)return;const i=e.cloneNode(!0);return t.replaceChild(i,s),void(i.nodeType===Node.ELEMENT_NODE&&this.collectEventElements(i))}if(s.hasAttribute("pp-component")&&s!==this.el){if(!this.syncNestedBoundaryAttributes(s,i)){const t=s.parentNode;if(!t)return;const i=e.cloneNode(!0);return t.replaceChild(i,s),void(i.nodeType===Node.ELEMENT_NODE&&this.collectEventElements(i))}return void(this.hasEventAttributes(s)&&this.pendingEventElements.add(s))}const n=this.isInsideTrackedPortal(s);this.syncAttributes(s,i,n),this.hasEventAttributes(s)&&this.pendingEventElements.add(s),this.morphChildren(s,i)}collectEventElements(t){this.hasEventAttributes(t)&&this.pendingEventElements.add(t);for(let e=0;e<t.children.length;e++)this.collectEventElements(t.children[e])}hasEventAttributes(t){const e=t.attributes;for(let t=0;t<e.length;t++)if(e[t].name.startsWith("on")&&!e[t].name.includes("-"))return!0;return!1}isManagedEventElement(t){if(this.isElementOwnedByTree(t,this.el))return!0;for(const[e]of this.trackedPortals)if(this.isElementOwnedByTree(t,e))return!0;return!1}isElementOwnedByTree(t,e){if(t===e)return!0;if(!e.contains(t))return!1;let s=t,i=!0;for(;s&&s!==e;){if(!i&&s.hasAttribute("pp-component"))return!1;s=s.parentElement,i=!1}return s===e}walkOwnedBoundaryElements(t){const e=this.getTraversalCache();for(let s=0;s<e.childBoundaries.length;s++)t(e.childBoundaries[s],!0)}invalidateTraversalCache(){this.traversalCache=null}getTraversalCache(){if(this.traversalCache)return this.traversalCache;const t=[],e=[],s=[],i=[],n=new Set,r=[],a=(t,e)=>{if(e)r.push(t);else for(let e=t.children.length-1;e>=0;e--)r.push(t.children[e])};a(this.el,!1);for(const[t]of this.trackedPortals)a(t,!0);for(;r.length>0;){const a=r.pop();if(n.has(a))continue;n.add(a);const o=a,h=a.hasAttribute("pp-component");if(t.push(o),(a.hasAttribute("data-pp-ref")||a.hasAttribute("pp-ref")||o.__ppRefCaptureId||o.__ppRefExpr)&&i.push(o),(a instanceof HTMLInputElement||a instanceof HTMLTextAreaElement||a instanceof HTMLSelectElement)&&s.push(o),h)e.push(o);else for(let t=a.children.length-1;t>=0;t--)r.push(a.children[t])}return this.traversalCache={ownedElements:t,childBoundaries:e,managedInputs:s,refElements:i},this.traversalCache}collectManagedInputs(){return this.getTraversalCache().managedInputs}syncAttributes(t,e,s=!1,i=!1){const n=t.attributes;for(let r=n.length-1;r>=0;r--){const a=n[r].name;if(!(i&&"pp-component"===a||e.hasAttribute(a))){if(s&&mt.has(a))continue;t.removeAttribute(a),"data-pp-ref"===a&&delete t.__ppRefCaptureId,"pp-ref"===a&&delete t.__ppRefExpr}}const r=e.attributes;for(let e=0;e<r.length;e++){const n=r[e];s&&mt.has(n.name)||i&&"pp-component"===n.name||(t.getAttribute(n.name)!==n.value&&t.setAttribute(n.name,n.value),"value"===n.name&&(t instanceof HTMLInputElement||t instanceof HTMLSelectElement||t instanceof HTMLTextAreaElement)&&t.value!=n.value&&(t.value=n.value))}if(t instanceof HTMLTextAreaElement&&e instanceof HTMLTextAreaElement){const s=e.getAttribute("value"),i=s??e.value,n=s??e.defaultValue;t.value!==i&&(t.value=i),t.defaultValue!==n&&(t.defaultValue=n)}}bindRefs(t,e,s){const i=this.getTraversalCache();for(let n=0;n<i.refElements.length;n++){const r=i.refElements[n],a=r,o=r.getAttribute("data-pp-ref");let h=null;if(o?(r.removeAttribute("data-pp-ref"),a.__ppRefCaptureId=o,h=o):a.__ppRefCaptureId&&this.__ppRefStore.has(a.__ppRefCaptureId)?h=a.__ppRefCaptureId:a.__ppRefCaptureId&&delete a.__ppRefCaptureId,h){const t=this.__ppRefStore.get(h);if("function"==typeof t)try{t(r)}catch(t){console.warn(`[PP-WARN] Ref callback threw for id="${h}"`,t)}else t&&"object"==typeof t&&"current"in t?t.current=r:o&&console.warn(`[PP-WARN] Missing captured ref for id="${h}"`)}const c=r.getAttribute("pp-ref");let l=c;if(c?a.__ppRefExpr=c:a.__ppRefExpr&&(l=a.__ppRefExpr),!l)continue;c&&r.removeAttribute("pp-ref");const p=this.latestScope[l];if(p&&"object"==typeof p&&"current"in p)p.current=r;else if("function"!=typeof p)try{const i=this.getCachedFunction(this._refEvalFnCache,l,t,s,200)(...e);"function"==typeof i?i(r):i&&"object"==typeof i&&"current"in i&&(i.current=r)}catch(t){console.warn(`[PP-WARN] Could not resolve pp-ref="${l}"`,t)}else try{p(r)}catch(t){console.warn(`[PP-WARN] pp-ref function threw for "${l}"`,t)}}}bootstrapNestedComponents(){this.walkOwnedBoundaryElements((e,s)=>{if(!s)return;const i=this.ensureBoundaryIdentity(e);if(!i)return;if(e.__ppRawBindings){const t=e.__ppRawBindings;for(const[s,i]of Object.entries(t))e.setAttribute(s,i)}else{const t={};for(const s of Array.from(e.attributes))s.value.includes("{")&&"pp-component"!==s.name&&!s.name.startsWith("on")&&(t[s.name]=s.value);e.__ppRawBindings=t}this.applyAttributeInterpolations(e,this.latestScope);const n=E.getInstance(i);if(null!=n&&n.refreshPropsFromParent)return n.parentId=this.id,E.saveParent(i,this.id),n.el!==e&&(!e.__ppRawBindings&&n.el.__ppRawBindings&&(e.__ppRawBindings=n.el.__ppRawBindings),n.el=e),void n.refreshPropsFromParent();E.getState(i)||new t(e)})}saveFocusState(){const t=document.activeElement;if(!t)return null;const e=this.el.contains(t),s=!e&&Array.from(this.trackedPortals.values()).some(e=>e.element.contains(t));if(!e&&!s)return null;const i=this.collectManagedInputs().indexOf(t);if(-1===i)return null;const n=this.getTextSelectionState(t);return{element:t,index:i,selectionStart:n.selectionStart,selectionEnd:n.selectionEnd}}isTextSelectionControl(t){return t instanceof HTMLTextAreaElement||t instanceof HTMLInputElement&&["text","search","url","tel","password"].includes(t.type)}getTextSelectionState(t){if(!this.isTextSelectionControl(t))return{selectionStart:null,selectionEnd:null};try{return{selectionStart:t.selectionStart,selectionEnd:t.selectionEnd}}catch{return{selectionStart:null,selectionEnd:null}}}restoreFocusState(t){if(!t)return;const e=t.element,s=e&&e.isConnected&&(this.el.contains(e)||Array.from(this.trackedPortals.values()).some(t=>t.element.contains(e)))?e:this.collectManagedInputs()[t.index];if(s&&(s.focus(),null!==t.selectionStart&&null!==t.selectionEnd&&this.isTextSelectionControl(s)))try{s.setSelectionRange(t.selectionStart,t.selectionEnd)}catch(t){console.warn("Could not restore cursor position",t)}}forceUpdate(){this.lastRenderedHtml="",this.render()}destroy(){for(const[,t]of this.trackedPortals)t.element.parentNode&&t.element.remove(),t.placeholder.parentNode&&t.placeholder.remove();this.trackedPortals.clear();const t=E.removeContextTracking(this.id);this.hooksSystem.dispose(),this.eventManager.clearCache(),E.removeState(this.id),E.removeScope(this.id),E.removeInstance(this.id),t.forEach(t=>{var e;const s=E.getInstance(t);null==(e=null==s?void 0:s.requestContextRefresh)||e.call(s)})}};x(V,"nestedBoundarySequence",0),x(V,"perfEnabled",!1),x(V,"perfStats",new Map);let he=V;const gt={bootstrap:()=>{document.querySelectorAll("[pp-component]").forEach(t=>{new he(t)})}},xe=class t{constructor(){x(this,"activeAbortController",null),x(this,"navigationEnabled",!1),x(this,"boundHandleLinkClick",null),x(this,"boundHandlePopState",null),x(this,"isNavigating",!1),x(this,"RESET_SCROLL_ATTR","pp-reset-scroll"),x(this,"mounted",!1)}mount(){this.mounted||(this.mounted=!0,this.disableTransitions(),gt.bootstrap(),this.restoreBodyAccessibility(),this.enableTransitions(),this.enableSPANavigation())}createComponentRuntime(e){const s={};for(const e of t.PUBLIC_METHODS){const t=this[e];"function"==typeof t?s[e]=t.bind(this):void 0!==t&&(s[e]=t)}return Object.assign({},s,e)}createContext(t){return Object.freeze({id:Symbol("pp.context"),defaultValue:t})}enablePerf(){he.setPerfEnabled(!0)}disablePerf(){he.setPerfEnabled(!1)}getPerfStats(){return he.getPerfStats()}resetPerfStats(){he.resetPerfStats()}getCsrfToken(){const t=document.cookie.match(/(?:^|;\s*)pp_csrf=([^;]*)/);return t?decodeURIComponent(t[1]):""}disableTransitions(){const t=document.createElement("style");t.id="pp-disable-transitions",t.textContent="\n *, *::before, *::after {\n transition: none !important;\n animation: none !important;\n }\n ",document.head.insertBefore(t,document.head.firstChild)}enableTransitions(){const t=document.getElementById("pp-disable-transitions");t&&t.remove()}restoreBodyAccessibility(){document.body.style.transition="",document.body.style.opacity="1",document.body.style.pointerEvents="auto",document.body.style.userSelect="auto",document.body.removeAttribute("inert"),document.body.setAttribute("aria-busy","false")}static resetInstance(){this.instance&&(this.instance.navigationEnabled&&this.instance.disableSPANavigation(),this.instance.activeAbortController&&(this.instance.activeAbortController.abort(),this.instance.activeAbortController=null),this.instance=null)}static getInstance(){return this.instance||(this.instance=new t),this.instance}enableSPANavigation(){this.navigationEnabled||"true"!==document.body.getAttribute("pp-spa")||(this.navigationEnabled=!0,this.boundHandleLinkClick=this.handleLinkClick.bind(this),this.boundHandlePopState=this.handlePopState.bind(this),document.addEventListener("click",this.boundHandleLinkClick),window.addEventListener("popstate",this.boundHandlePopState))}disableSPANavigation(){this.navigationEnabled=!1,this.boundHandleLinkClick&&(document.removeEventListener("click",this.boundHandleLinkClick),this.boundHandleLinkClick=null),this.boundHandlePopState&&(window.removeEventListener("popstate",this.boundHandlePopState),this.boundHandlePopState=null)}handleLinkClick(t){if(!this.navigationEnabled)return;const e=t.target.closest("a");if(e&&e.href)try{const s=new URL(e.href),i=s.origin!==window.location.origin,n=s.pathname===window.location.pathname&&s.search===window.location.search,r="false"===e.getAttribute("pp-spa");if(i||"_blank"===e.target||e.hasAttribute("download")||r||t.ctrlKey||t.metaKey||t.shiftKey||t.altKey)return;if(t.preventDefault(),n){const e=s.hash;if(e){t.preventDefault(),history.pushState(null,"",s.pathname+s.search+e);const i=document.querySelector(e);return void(i&&i.scrollIntoView({behavior:"smooth"}))}}this.navigateTo(s.pathname+s.search+s.hash)}catch(t){console.error("Link click navigation error:",t)}}async handlePopState(){const t=window.location.pathname+window.location.search+window.location.hash;await this.navigateTo(t,!1)}async navigateTo(t,e=!0){this.isNavigating=!0;const s=this.saveScrollPositions();try{this.dispatchNavigationEvent("start",t),await this.showLoadingTransition();const i=await this.fetchPageContent(t);if("hardReload"in i)return void(window.location.href=i.hardReload);if("redirect"in i)return void await this.navigateTo(i.redirect,e);const n=i;this.updateBrowserHistory(t,e);const r=document.getElementById("loading-file-1B87E"),a="startViewTransition"in document,o=this.getResetScrollConfig(n);!r&&a?await this.updatePageContentWithViewTransition(n):await this.updatePageContent(n),this.resetGlobalCaches(),gt.bootstrap(),this.handleScrollRestoration(s,o),await this.handleNavigationCompletion(),this.dispatchNavigationEvent("complete",t)}catch(e){this.handleNavigationError(t,e)}finally{this.isNavigating=!1}}resetGlobalCaches(){E.clear(),q.clearCaches(),ke.clearCache()}getResetScrollConfig(t){if("true"===t.body.getAttribute(this.RESET_SCROLL_ATTR))return{mode:"global",resetElementKeys:new Set,resetWindow:!1};const e=t.querySelectorAll(`[${this.RESET_SCROLL_ATTR}]`),s=new Set;let i=!1;if(e.length>0)for(const t of Array.from(e))if("true"===t.getAttribute(this.RESET_SCROLL_ATTR)){const e=this.getElementKeyFromElement(t);s.add(e),i=!0}return i||s.size>0?{mode:"none",resetElementKeys:s,resetWindow:i}:{mode:"none",resetElementKeys:new Set,resetWindow:!1}}getElementKeyFromElement(t){return t.id?t.id:t.className?t.className:t.tagName}handleScrollRestoration(t,e){requestAnimationFrame(()=>{if("global"===e.mode)return window.scrollTo(0,0),document.documentElement.scrollTop=0,document.documentElement.scrollLeft=0,void document.querySelectorAll("*").forEach(t=>{(t.scrollTop||t.scrollLeft)&&(t.scrollTop=0,t.scrollLeft=0)});if(e.resetWindow)window.scrollTo(0,0),document.documentElement.scrollTop=0,document.documentElement.scrollLeft=0;else{const e=t.window;e&&window.scrollTo(e.scrollLeft,e.scrollTop)}document.querySelectorAll("*").forEach(s=>{const i=s.tagName.toLowerCase();if(e.resetWindow&&("html"===i||"body"===i))return;const n=this.getElementKey(s);e.resetElementKeys.has(n)?(s.scrollTop=0,s.scrollLeft=0):t[n]&&(s.scrollTop=t[n].scrollTop,s.scrollLeft=t[n].scrollLeft)})})}saveScrollPositions(){const t={window:{scrollTop:window.scrollY||document.documentElement.scrollTop,scrollLeft:window.scrollX||document.documentElement.scrollLeft}};return document.querySelectorAll("*").forEach(e=>{(e.scrollTop||e.scrollLeft)&&(t[this.getElementKey(e)]={scrollTop:e.scrollTop,scrollLeft:e.scrollLeft})}),t}getElementKey(t){return t.id||t.className||t.tagName}async updatePageContentWithViewTransition(t){t.title&&(document.title=t.title);const e=t.body.innerHTML;if(this.syncBodyAttributes(t.body),this.isNavigating||!document.startViewTransition)return void(document.body.innerHTML=e);const s=document.startViewTransition(()=>{document.body.innerHTML=e});try{await s.finished}catch(t){console.warn("View transition failed, continuing anyway:",t)}}dispatchNavigationEvent(t,e,s){const i=`pp:navigation:${t}`,n=s?{url:e,error:s}:{url:e};document.dispatchEvent(new CustomEvent(i,{detail:n}))}async showLoadingTransition(){const t=document.getElementById("loading-file-1B87E");if(t){const e=this.findLoadingElement(t,window.location.pathname);if(e)return void await this.updateContentWithTransition(e)}const e=document.querySelector("[pp-loading-content='true']")||document.body;e&&!("startViewTransition"in document)&&await this.fadeOut(e,250)}async fetchPageContent(t){const e=new URL(t,window.location.origin).hash,s=await fetch(t,{headers:{"X-Requested-With":"XMLHttpRequest","X-PP-Navigation":"true","X-PulsePoint-Wire":"true",Accept:"text/html"}});if(!s.ok)throw new Error(`Navigation failed: ${s.status} ${s.statusText}`);const i=s.headers.get("X-PP-Root-Layout"),n=document.querySelector('meta[name="pp-root-layout"]'),r=n?n.getAttribute("content"):null;if(i&&r&&i!==r)return{hardReload:t};if(s.redirected){const t=new URL(s.url);if(e&&t.searchParams.has("next")){const s=t.searchParams.get("next");s&&!s.includes("#")&&t.searchParams.set("next",s+e)}return{redirect:t.pathname+t.search+t.hash}}const a=this.getRedirectUrlFromResponse(s);if(a)return{redirect:a};const o=await s.text();return(new DOMParser).parseFromString(o,"text/html")}getRedirectUrlFromResponse(t){const e=t.headers.get("X-PP-Redirect");if(e)return e;const s=t.headers.get("Location"),i=t.status;return s&&i>=300&&i<400?s:null}updateBrowserHistory(t,e){e&&history.pushState(null,"",t)}async updatePageContent(t){t.title&&(document.title=t.title);const e=t.body;this.syncBodyAttributes(e),document.body.innerHTML=e.innerHTML}syncBodyAttributes(t){t&&(Array.from(document.body.attributes).forEach(t=>{"style"!==t.name&&document.body.removeAttribute(t.name)}),Array.from(t.attributes).forEach(t=>{"style"!==t.name&&document.body.setAttribute(t.name,t.value)}))}async handleNavigationCompletion(){const t=document.querySelector("[pp-loading-content='true']")||document.body;this.fadeIn(t,150),setTimeout(()=>{this.restoreBodyAccessibility()},50);const e=window.location.hash;e&&requestAnimationFrame(()=>{const t=document.querySelector(e);t&&t.scrollIntoView({behavior:"smooth"})})}handleNavigationError(t,e){console.error("Navigation error:",e),this.restoreBodyAccessibility(),this.dispatchNavigationEvent("error",t,e),window.location.href=t}findLoadingElement(t,e){let s=e;for(;;){const e=t.querySelector(`div[pp-loading-url='${s}']`);if(e)return e;if("/"===s)break;const i=s.lastIndexOf("/");s=i<=0?"/":s.substring(0,i)}return t.querySelector("div[pp-loading-url='/' ]")}async updateContentWithTransition(t){const e=document.querySelector("[pp-loading-content='true']")||document.body;if(!e)return;const{fadeIn:s,fadeOut:i}=this.parseTransition(t);await this.fadeOut(e,i),e.innerHTML=t.innerHTML,this.fadeIn(e,s)}parseTransition(t){let e=250,s=250;const i=t.querySelector("[pp-loading-transition]"),n=null==i?void 0:i.getAttribute("pp-loading-transition");if(n){let t=JSON.parse(n);t&&"object"==typeof t?(e=this.parseTime(t.fadeIn??e),s=this.parseTime(t.fadeOut??s)):console.warn("pp-loading-transition is not valid JSON → default values (250 ms) will be used. String:",n)}return{fadeIn:e,fadeOut:s}}fadeOut(t,e){return new Promise(s=>{t.style.transition=`opacity ${e}ms ease-out`,setTimeout(()=>{t.style.transition="",s()},e)})}fadeIn(t,e){t.style.transition=`opacity ${e}ms ease-in`,setTimeout(()=>{t.style.transition=""},e)}parseTime(t){if("number"==typeof t)return t;const e=t.match(/^(\d+)(ms|s|m)?$/);if(e){const t=parseInt(e[1],10);switch(e[2]||"ms"){case"ms":default:return t;case"s":return 1e3*t;case"m":return 60*t*1e3}}return 0}async redirect(t){if(t)try{const e=new URL(t,window.location.origin);e.origin!==window.location.origin?window.location.href=t:this.navigationEnabled?await this.navigateTo(e.pathname+e.search+e.hash):window.location.href=t}catch(t){console.error("Redirect error:",t)}}async rpc(t,e={},s=!1){let i=null;const n="boolean"==typeof s?{abortPrevious:s}:s;try{n.abortPrevious&&this.activeAbortController&&(this.activeAbortController.abort(),this.activeAbortController=null),i=new AbortController,n.abortPrevious&&(this.activeAbortController=i);const s=window.location.pathname.replace(/\/+$/,"")||"/",r={"X-CSRF-Token":this.getCsrfToken(),"X-PP-RPC":"true","X-PulsePoint-Wire":"true","X-PP-Function":t,"X-Requested-With":"XMLHttpRequest",Accept:"application/json, text/event-stream"};let a;if(Object.values(e).some(t=>t instanceof File||t instanceof FileList&&t.length>0)){const t=new FormData;for(const[s,i]of Object.entries(e))i instanceof File?t.append(s,i):i instanceof FileList?Array.from(i).forEach(e=>t.append(s,e)):null!=i&&t.append(s,"object"==typeof i?JSON.stringify(i):String(i));if(n.onUploadProgress)return await this.xhrFunction({url:s,headers:r,body:t,controller:i,options:n});a={method:"POST",headers:r,body:t,signal:i.signal}}else a={method:"POST",headers:{...r,"Content-Type":"application/json"},body:JSON.stringify(e),signal:i.signal};const o=await fetch(s,a);if(401===o.status)throw new Error("Authentication required");if(403===o.status)throw new Error("Permission denied");if(!o.ok){const t=await o.json().catch(()=>null);throw t||415!==o.status?new Error((null==t?void 0:t.error)||`Request failed: ${o.status} ${o.statusText}`):new Error("Server rejected data format (415).")}const h=this.getRedirectUrlFromResponse(o);return h?(await this.redirect(h),{redirected:!0,to:h}):(this.activeAbortController===i&&(this.activeAbortController=null),(o.headers.get("Content-Type")||"").includes("text/event-stream")&&o.body?(n.onStream||console.warn("RPC returned a stream, but no onStream handler provided."),void await this.handleStream(o.body,n)):await o.json())}catch(t){if(this.activeAbortController===i&&(this.activeAbortController=null),t instanceof Error&&"AbortError"===t.name)return console.log("Request was cancelled"),{cancelled:!0};if(n.onStreamError)return void n.onStreamError(t);throw console.error("RPC error:",t),t}}xhrFunction(t){const{url:e,headers:s,body:i,controller:n,options:r}=t;return new Promise((t,a)=>{const o=new XMLHttpRequest;o.open("POST",e,!0);for(const[t,e]of Object.entries(s))o.setRequestHeader(t,e);const h=()=>{try{o.abort()}catch{}};n.signal.addEventListener("abort",h,{once:!0}),o.upload&&r.onUploadProgress&&(o.upload.onprogress=t=>{var e;const s=t.lengthComputable?t.total:null,i=t.lengthComputable&&t.total>0?Math.min(100,Math.max(0,t.loaded/t.total*100)):null;null==(e=r.onUploadProgress)||e.call(r,{loaded:t.loaded,total:s,percent:i})}),o.onerror=()=>{n.signal.removeEventListener("abort",h),a(new Error("Network error (XHR upload)."))},o.onload=async()=>{var e,s;if(n.signal.removeEventListener("abort",h),401===o.status)return a(new Error("Authentication required"));if(403===o.status)return a(new Error("Permission denied"));if(o.status<200||o.status>=300){let t=`Request failed: ${o.status} ${o.statusText}`;try{const e=JSON.parse(o.responseText||"{}");t=(null==e?void 0:e.error)||(null==e?void 0:e.message)||t}catch{}return a(new Error(t))}const i=o.getResponseHeader("X-PP-Redirect")||(o.status>=300&&o.status<400?o.getResponseHeader("Location"):null);if(i)try{return await this.redirect(i),null==(e=r.onUploadComplete)||e.call(r),t({redirected:!0,to:i})}catch(t){return a(t)}const c=o.responseText??"";let l=c;try{l=JSON.parse(c)}catch{}null==(s=r.onUploadComplete)||s.call(r),t(l)};try{o.send(i)}catch(t){n.signal.removeEventListener("abort",h),a(t)}})}async handleStream(t,e){const s=t.getReader(),i=new TextDecoder;let n="";try{for(;;){const{done:t,value:r}=await s.read();if(t){e.onStreamComplete&&e.onStreamComplete();break}n+=i.decode(r,{stream:!0});const a=n.split("\n");n=a.pop()||"";for(const t of a)if(""!==t.trim()&&t.startsWith("data: ")){const s=t.slice(6);let i=s;try{("true"===s||"false"===s||"null"===s||!isNaN(Number(s))||s.startsWith("{")||s.startsWith("[")||s.startsWith('"'))&&(i=JSON.parse(s))}catch{}e.onStream&&e.onStream(i)}}}catch(t){if(!e.onStreamError)throw t;e.onStreamError(t)}finally{s.releaseLock()}}};x(xe,"instance",null),x(xe,"PUBLIC_METHODS",["createContext","mount","redirect","rpc","enablePerf","disablePerf","getPerfStats","resetPerfStats"]);let Ye=xe;const ce=class t{constructor(){x(this,"listeners",[])}static getInstance(){return t.instance||(t.instance=new t),t.instance}get params(){return new URLSearchParams(window.location.search)}get(t){return this.params.get(t)}set(t,e){const s=this.params;s.set(t,e),this.updateURL(s)}delete(t){const e=this.params;e.delete(t),this.updateURL(e)}replace(t){const e=new URLSearchParams;for(const s in t){const i=t[s];null!==i&&e.set(s,i)}this.updateURL(e,!0)}updateURL(t,e=!1){const s=`${window.location.pathname}?${t.toString()}`;e?history.replaceState(null,"",s):history.pushState(null,"",s),this.notifyListeners(t)}listen(t){this.listeners.push(t)}notifyListeners(t){for(const e of this.listeners)e(t)}enablePopStateListener(){window.addEventListener("popstate",()=>{this.notifyListeners(this.params)})}};x(ce,"instance",null);let Ze=ce;function ti(t,e,s=window,i=!0){let n=null;if(Object.defineProperty(s,t,{get(){if(null!==n)return n;if(e&&"object"==typeof e&&!Array.isArray(e)&&"getInstance"in e&&"function"==typeof e.getInstance)return n=e.getInstance(),n;if("function"!=typeof e)return n=e,n;try{return n=e.getInstance(),n}catch{return n=e,n}},set(e){null===e?n=null:console.warn(`Cannot override global ${t}`)},configurable:!0,enumerable:!0}),i)try{s[t]}catch(e){console.error(`Failed to initialize ${t}:`,e)}}ti("pp",{getInstance:()=>{var t;const e=Ye.getInstance();return"loading"!==document.readyState?null==(t=e.mount)||t.call(e):document.addEventListener("DOMContentLoaded",()=>{var t;return null==(t=e.mount)?void 0:t.call(e)},{once:!0}),e}}),ti("searchParams",Ze);export{gt as ComponentInit,Ye as PPUtilities,Ze as SearchParamsManager};
|