@quicktvui/naddons 1.0.0-alpha.12 → 1.0.0-alpha.13

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.
@@ -13,6 +13,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<im
13
13
  currentInput?: string | undefined;
14
14
  autofocus?: boolean | undefined;
15
15
  requestFocus?: boolean | undefined;
16
+ keyboardType?: number | undefined;
17
+ rememberKeyboardType?: boolean | undefined;
16
18
  }>>, {
17
19
  getNativeNode: () => any;
18
20
  requestFocus: (...args: any[]) => void;
@@ -34,6 +36,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<im
34
36
  currentInput?: string | undefined;
35
37
  autofocus?: boolean | undefined;
36
38
  requestFocus?: boolean | undefined;
39
+ keyboardType?: number | undefined;
40
+ rememberKeyboardType?: boolean | undefined;
37
41
  }>>> & Readonly<{
38
42
  onOnInputChanged?: ((payload?: any) => any) | undefined;
39
43
  onOnKeyPressed?: ((payload?: any) => any) | undefined;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("vue"),$=require("@extscreen/es3-vue"),L=require("@extscreen/es3-core"),ee="QtGridTabs",B=c.defineComponent({__name:"GridTabs",props:{protocolVersion:{},tabsData:{},actionPayload:{},hsvHue:{default:-2}},emits:["onTabSelected","onTabNeedsData","onLoadMore","onItemPresence","onTabFocused","onItemClick","onItemFocused","onProtocolMismatch","onScroll","onScrollStateChanged"],setup(o,{expose:r}){const v=c.ref(),p=q(),b=ee+"_Plugin",l=(p.isPluginActive?b:ee).replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase().replace(/^-/,""),y=M(l,p.pluginPackageName||"com.quicktvui.plugin.glintui");return r({getNativeNode:()=>{var i,s;return((s=(i=v.value)==null?void 0:i.getNativeNode)==null?void 0:s.call(i))||v.value},dispatchAction:(...i)=>{var u,E;const s=((E=(u=v.value)==null?void 0:u.getNativeNode)==null?void 0:E.call(u))||v.value;s&&$.Native.callUIFunction(s,"dispatchAction",i)},scrollToTop:(...i)=>{var u,E;const s=((E=(u=v.value)==null?void 0:u.getNativeNode)==null?void 0:E.call(u))||v.value;s&&$.Native.callUIFunction(s,"scrollToTop",i)}}),(i,s)=>(c.openBlock(),c.createBlock(c.unref(y),c.mergeProps({ref_key:"nativeRef",ref:v,protocolVersion:o.protocolVersion,tabsData:o.tabsData,actionPayload:o.actionPayload,hsvHue:o.hsvHue,onOnTabSelected:s[0]||(s[0]=u=>i.$emit("onTabSelected",u.nativeEvent)),onOnTabNeedsData:s[1]||(s[1]=u=>i.$emit("onTabNeedsData",u.nativeEvent)),onOnLoadMore:s[2]||(s[2]=u=>i.$emit("onLoadMore",u.nativeEvent)),onOnItemPresence:s[3]||(s[3]=u=>i.$emit("onItemPresence",u.nativeEvent)),onOnTabFocused:s[4]||(s[4]=u=>i.$emit("onTabFocused",u.nativeEvent)),onOnItemClick:s[5]||(s[5]=u=>i.$emit("onItemClick",u.nativeEvent)),onOnItemFocused:s[6]||(s[6]=u=>i.$emit("onItemFocused",u.nativeEvent)),onOnProtocolMismatch:s[7]||(s[7]=u=>i.$emit("onProtocolMismatch",u.nativeEvent)),onOnScroll:s[8]||(s[8]=u=>i.$emit("onScroll",u.nativeEvent)),onOnScrollStateChanged:s[9]||(s[9]=u=>i.$emit("onScrollStateChanged",u.nativeEvent))},i.$attrs),{default:c.withCtx(()=>[c.renderSlot(i.$slots,"default")]),_:3},16,["protocolVersion","tabsData","actionPayload","hsvHue"]))}});let U;var re;try{const o=require("@extscreen/es3-vue");U=o.registerElement||((re=o.default)==null?void 0:re.registerElement)}catch{}const ce={install:o=>{if(!globalThis.__QtGridTabs_registered)if(U){const r=(v,p)=>{U(v,{component:{name:p?"QtGridTabs_Plugin":"QtGridTabs",processEventData(b,m){const l=b.handler||b,y=m||(l==null?void 0:l.nativeParams)||{};return l&&(l.nativeEvent=y),l}}})};r("qt-grid-tabs",!1),r("qt-grid-tabs-plugin",!0),r("QtGridTabs",!1),r("QtGridTabs_Plugin",!0),r("gt-tabs",!1),r("gt-tabs-plugin",!0),globalThis.__QtGridTabs_registered=!0,console.log("[@quicktvui/naddons] Successfully registered Native tag:","QtGridTabs")}else console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue");o.component("GridTabs",B),o.component("qt-grid-tabs",B),o.component("gt-tabs",B)}};function ye(o,r){const v=c.ref(""),p=c.shallowRef([]),b=c.shallowRef([]);let m=!1,l=!1;const y="__virtual_single_tab__";let i="";const s=c.ref({}),u=t=>{const e=Array.isArray(t)?t:[t],n=JSON.stringify(e);if(l&&o.value){if(typeof o.value.dispatchAction=="function"){console.log("[useGridTabs] Calling Wrapper dispatchAction directly"),o.value.dispatchAction(n);return}let a=o.value;typeof o.value.getNativeNode=="function"?a=o.value.getNativeNode()||o.value:o.value.nativeRef&&(a=o.value.nativeRef),a?(console.log("[useGridTabs] Calling Native.callUIFunction(dispatchAction)"),$.Native.callUIFunction(a,"dispatchAction",[n])):console.warn("[useGridTabs] Native target is null or undefined, cannot call dispatchAction")}},E=(t,e)=>{if(!t)return!1;let n=!0;return t.id||(console.error(`[useGridTabs] ❌ 数据格式错误 (${e}): 卡片缺失必填字段 'id'。每个卡片必须有唯一标识才能进行后续更新!`,t),n=!1),t.viewType||(console.error(`[useGridTabs] ❌ 数据格式错误 (${e}): 卡片缺失必填字段 'viewType' (id: ${t.id||"未知"})。必须指定 Native 注册的视图类型或 Portal 标识!`,t),n=!1),n},X=(t,e)=>{if(!t)return!1;let n=!0;return t.tabId||(console.error(`[useGridTabs] ❌ 数据格式错误 (${e}): Tab 缺失必填字段 'tabId'。每个 Tab 必须有唯一标识!`,t),n=!1),(t.title===void 0||t.title===null)&&console.warn(`[useGridTabs] ⚠️ 数据格式警告 (${e}): Tab 缺失 'title' 字段 (tabId: ${t.tabId||"未知"}),导航栏可能显示为空。`,t),n},x=(t,e)=>{if(!t||t.length===0)return;A.clear();const n=t[0].hasOwnProperty("tabId")||t[0].hasOwnProperty("items")&&Array.isArray(t[0].items);m=e==="1d",e==="1d"&&n?console.error("[useGridTabs] ❌ 赋值错误: 你正在向 `items.value` (一维瀑布流) 赋值二维 Tabs 数据结构!请改用 `tabs.value = ...`"):e==="2d"&&!n&&console.error("[useGridTabs] ❌ 赋值错误: 你正在向 `tabs.value` (二维导航) 赋值一维卡片列表数据结构!请改用 `items.value = ...`"),e==="1d"?t.forEach((a,d)=>E(a,`items.value[${d}]`)):t.forEach((a,d)=>{X(a,`tabs.value[${d}]`),a.items&&Array.isArray(a.items)&&a.items.forEach((f,g)=>E(f,`tabs.value[${d}].items[${g}]`))}),l=!0,O()},A=new Set,O=(t="unknown")=>{if(!l){console.warn("[useGridTabs] triggerRootUpdate skipped because isInitialized is false");return}let e={protocolVersion:"1.28.0",gridBasis:(r==null?void 0:r.gridBasis)??30,unitType:(r==null?void 0:r.unitType)??"px",contentConfig:(r==null?void 0:r.contentConfig)??(r==null?void 0:r.layoutConfig)??{box:{padding:[0,60,60,60]},navContentGapNormal:0,itemGap:24},navConfig:(r==null?void 0:r.navConfig)??{dock:"left",mode:"fixed",renderType:"smart-hybrid",box:{size:[200,0]},expandedBox:{size:[300,0]}},cacheConfig:(r==null?void 0:r.cacheConfig)??{offscreenPageLimit:1,prefetchOffset:2,preLoadEnabled:!1,strategy:"data_priority"},animationConfig:(r==null?void 0:r.animationConfig)??{duration:300,easing:"ease-out"},interactionStrategy:(r==null?void 0:r.interactionStrategy)??{defaultFocus:"nav",interceptBack:!0,backMode:"home-first",autoScrollToTop:!0,edgeScrollProtection:.5},focusConfig:(r==null?void 0:r.focusConfig)??{boundaryLock:{left:!1,right:!1,top:!1,bottom:!1}},themeConfig:r==null?void 0:r.themeConfig,referenceResolution:(r==null?void 0:r.referenceResolution)??{w:1920,h:1080}},n=[];m?(e.navConfig={...e.navConfig,renderType:"none"},n=[{tabId:y,title:"Virtual Tab",hidden:!0,items:b.value}]):n=p.value;const a=JSON.stringify({page_spec:e,tabs:n});if(v.value==="")console.log(`[useGridTabs] triggerRootUpdate: Initializing tabsDataStr (length=${a.length})`),v.value=a,i=a;else{if(i===a){console.log("[useGridTabs] triggerRootUpdate: Data unchanged, skipping RELOAD_TABS");return}console.log(`[useGridTabs] triggerRootUpdate: Sending RELOAD_TABS action directly to Native (length=${a.length})`),v.value=a,i=a,u({op:"RELOAD_TABS",payload:{pageSpec:e,page_spec:e,tabs:n}})}},F=t=>{if(!t||typeof t!="object"||t.__isGridTabsProxy)return t;t.content&&typeof t.content=="object"&&!t.content.__isGridTabsProxy&&(t.content=new Proxy(t.content,{set(n,a,d,f){const g=Reflect.set(n,a,d,f);return t.id&&l&&u({op:"UPDATE_ITEM",itemId:t.id,payload:t}),g}}),Object.defineProperty(t.content,"__isGridTabsProxy",{value:!0,enumerable:!1}),Object.defineProperty(t.content,"__v_skip",{value:!0,enumerable:!1})),t.subItems&&Array.isArray(t.subItems)&&!t.subItems.__isGridTabsProxy&&(t.subItems=P(t.subItems,t.id),Object.defineProperty(t.subItems,"__isGridTabsProxy",{value:!0,enumerable:!1}),Object.defineProperty(t.subItems,"__v_skip",{value:!0,enumerable:!1}));const e=new Proxy(t,{set(n,a,d,f){const g=Reflect.set(n,a,d,f);return n.id&&l&&u({op:"UPDATE_ITEM",itemId:n.id,payload:n}),g}});return Object.defineProperty(e,"__isGridTabsProxy",{value:!0,enumerable:!1}),Object.defineProperty(e,"__v_skip",{value:!0,enumerable:!1}),e},P=(t,e)=>{for(let n=0;n<t.length;n++)t[n]=F(t[n]);return new Proxy(t,{get(n,a,d){return a==="push"?(...f)=>{f.forEach((R,me)=>E(R,`push(${me})`)),l||console.error("[useGridTabs] ❌ 时机错误: 在底层还未完成初始化时调用了 push()。请先对 items.value 或 tabs.value 进行全量赋值!");const g=f.map(R=>F(R)),k=Array.prototype.push.apply(n,g);return u({op:"APPEND_SUB_ITEMS",itemId:e,payload:{subItems:g}}),k}:a==="splice"?(...f)=>{const g=f.length>=2&&f[0]===0&&f[1]===n.length,k=Array.prototype.splice.apply(n,f);return l&&g&&e!==y?u({op:"UPDATE_TAB_STATE",itemId:e,payload:{action:"clear_items"}}):l&&O("items array spliced"),k}:Reflect.get(n,a,d)},set(n,a,d,f){if(a!=="length"&&!isNaN(Number(a))){l||console.error(`[useGridTabs] ❌ 时机错误: 在底层还未完成初始化时直接修改了索引 [${String(a)}]。请先对 items.value 或 tabs.value 进行全量赋值!`),E(d,`索引赋值 [${String(a)}]`);const g=F(d),k=Reflect.set(n,a,g,f);return g&&g.id&&u({op:"UPDATE_ITEM",itemId:g.id,payload:g}),k}return Reflect.set(n,a,d,f)}})},T=t=>(t.items&&Array.isArray(t.items)&&!t.items.__isGridTabsProxy&&(t.items=P(t.items,t.tabId),Object.defineProperty(t.items,"__isGridTabsProxy",{value:!0,enumerable:!1})),new Proxy(t,{set(e,n,a,d){if(n==="items"){let g=a;return Array.isArray(a)&&!a.__isGridTabsProxy&&(g=P(a,e.tabId),Object.defineProperty(g,"__isGridTabsProxy",{value:!0,enumerable:!1})),Reflect.set(e,n,g,d)}else if(n==="loadState"){const g=Reflect.set(e,n,a,d);return l&&e.tabId&&u({op:"UPDATE_TAB_STATE",itemId:e.tabId,payload:{loadState:a}}),g}return Reflect.set(e,n,a,d)}})),w=t=>{const e=t.map(n=>T(n));return new Proxy(e,{set(n,a,d,f){if(a!=="length"&&!isNaN(Number(a))){let g=d;d.__isGridTabsProxy||(g=T(d),Object.defineProperty(g,"__isGridTabsProxy",{value:!0,enumerable:!1}));const k=Reflect.set(n,a,g,f);return O(),k}return Reflect.set(n,a,d,f)}})};c.watch(p,(t,e)=>{if(console.log("[useGridTabs] watch(tabs) triggered:",{newTabs:t,isInitialized:l}),!t||t.length===0){v.value="",i="",l=!1;return}if(t.__isGridTabsProxy)console.log("[useGridTabs] newTabs is ALREADY a proxy, triggering root update"),O();else{console.log("[useGridTabs] newTabs is NOT a proxy, performing full deduceModeAndInitialize & wrapping");const n=w(t);Object.defineProperty(n,"__isGridTabsProxy",{value:!0,enumerable:!1}),x(n,"2d"),p.value=n}},{flush:"sync",deep:!1}),c.watch(b,(t,e)=>{if(console.log("[useGridTabs] watch(items) triggered:",{newItems:t,isInitialized:l}),!t||t.length===0){v.value="",i="",l=!1;return}if(t.__isGridTabsProxy)console.log("[useGridTabs] newItems is ALREADY a proxy, triggering root update"),O();else{console.log("[useGridTabs] newItems is NOT a proxy, performing full deduceModeAndInitialize & wrapping");const n=P(t,y);Object.defineProperty(n,"__isGridTabsProxy",{value:!0,enumerable:!1}),x(n,"1d"),b.value=n}},{flush:"sync",deep:!1});const h={},S=()=>{console.log("[useGridTabs] resetInitialization called manually"),l=!1,A.clear();for(const t in h)delete h[t]},N=t=>{if(!t||t.length===0){v.value="",l=!1;return}t[0].hasOwnProperty("tabId")||t[0].hasOwnProperty("items")&&Array.isArray(t[0].items)?p.value=t:b.value=t},_=t=>{s.value=t},G=c.computed(()=>({tabsData:v.value,onTabNeedsData:async(...t)=>{let e=t[0];if(e&&e.nativeEvent&&(e=e.nativeEvent),!s.value.onTabNeedsData)return;const{tabId:n,index:a,reason:d}=e;if(A.has(n)){console.log(`[useGridTabs] onTabNeedsData SKIP: tabId=${n} 已经发起过请求,防止死循环`);return}A.add(n);try{const f=await s.value.onTabNeedsData(n,a,d);if(f&&Array.isArray(f))if(h[n]=1,f.length>0){const g=p.value.find(k=>k.tabId===n);g&&(g.items?g.items.length>0&&g.items.splice(0,g.items.length):g.items=[],g.items.push(...f),g.loadState="ready",u({op:"UPDATE_TAB_STATE",itemId:n,payload:{loadState:"ready"}}))}else console.warn(`[useGridTabs] ⚠️ 警告: onTabNeedsData(tabId="${n}") 返回了空数组 []!`),console.warn("👉 如果你已经在此函数内手动调用了 push() 来追加数据,请在最后 return null 或 undefined。"),console.warn("👉 如果该 Tab 确实没有数据,返回 [] 可能会导致底层的 Header 等已有元素被清空,请注意检查。"),console.warn("👉 框架已为您拦截此次空数组覆盖,保留了当前的 DOM 结构。")}catch(f){console.error("[useGridTabs] onTabNeedsData 执行失败:",f),A.delete(n)}},onLoadMore:async(...t)=>{let e=t[0];if(e&&e.nativeEvent&&(e=e.nativeEvent),!s.value.onLoadMore)return;const{tabId:n,itemId:a}=e,f=(h[n]||1)+1;console.log(`[useGridTabs] 拦截到底层 onLoadMore,强行接管页码: tabId=${n}, pageNo=${f}`);try{const g=await s.value.onLoadMore(n,f,a);if(g&&Array.isArray(g))if(g.length>0)if(h[n]=f,m)b.value.push(...g);else{const k=p.value.find(R=>R.tabId===n);k&&k.items&&k.items.push(...g)}else console.warn(`[useGridTabs] ⚠️ 警告: onLoadMore(tabId="${n}", pageNo="${f}") 返回了空数组 []!`),console.warn('👉 如果这是你的最后一页数据,推荐在卡片列表中追加一个 type="no_more" 的 footer 卡片,而不是仅仅返回空。'),console.warn("👉 框架已忽略本次空数据追加,且不会自增页码。")}catch(g){console.error("[useGridTabs] onLoadMore 业务层请求失败:",g)}},onItemPresence:(...t)=>{let e=t[0];if(console.log("[useGridTabs] ⚡️ bindings caught onItemPresence:",e),s.value.onItemPresence)try{let n=typeof e=="string"?e:(e==null?void 0:e.nativeEvent)||e;n&&typeof n.data=="string"&&(n=n.data);const a=typeof n=="string"?JSON.parse(n):n;a&&a.type==="VIEW_PRESENCE_BATCH"&&Array.isArray(a.payload)?a.payload.forEach(d=>{d.itemId&&typeof d.itemId=="string"&&d.itemId.startsWith("fallback_pos_")&&console.warn(`[useGridTabs] ⚠️ 警告:检测到列表项曝光 (index=${d.index}),但未配置 itemId。请检查传入的 items 数组,务必为每个数据项指定唯一的 itemId,否则底层无法准确进行去重与曝光上报。`),s.value.onItemPresence(d)}):s.value.onItemPresence(a)}catch(n){console.error("[useGridTabs] Failed to parse onItemPresence event payload:",n),s.value.onItemPresence(e)}},onTabSelected:(...t)=>{let e=t[0];e&&e.nativeEvent&&(e=e.nativeEvent),s.value.onTabSelected&&s.value.onTabSelected(e)},onItemClick:(...t)=>{let e=t[0];if(console.log("[useGridTabs] RAW onItemClick intercepted from Native:",e),e&&e.nativeEvent&&(e=e.nativeEvent),s.value.onItemClick)try{let n=typeof e=="string"?e:(e==null?void 0:e.data)||e;console.log("[useGridTabs] Parsed eventStr:",n);const a=typeof n=="string"?JSON.parse(n):n;s.value.onItemClick(a)}catch(n){console.error("[useGridTabs] Failed to parse onItemClick event payload:",n),s.value.onItemClick(e)}else console.warn("[useGridTabs] onItemClick triggered but NO callback registered in callbacksRef!")},onItemFocused:(...t)=>{let e=t[0];if(e&&e.nativeEvent&&(e=e.nativeEvent),s.value.onItemFocused)try{let n=typeof e=="string"?e:(e==null?void 0:e.data)||e;const a=typeof n=="string"?JSON.parse(n):n;s.value.onItemFocused(a)}catch(n){console.error("[useGridTabs] Failed to parse onItemFocused event payload:",n),s.value.onItemFocused(e)}},onTabFocused:(...t)=>{let e=t[0];e&&e.nativeEvent&&(e=e.nativeEvent),s.value.onTabFocused&&s.value.onTabFocused(e)},onScroll:(...t)=>{let e=t[0];if(e&&e.nativeEvent&&(e=e.nativeEvent),s.value.onScroll)try{const n=(e==null?void 0:e.data)||e;s.value.onScroll(n)}catch{s.value.onScroll(e)}},onScrollStateChanged:(...t)=>{let e=t[0];if(e&&e.nativeEvent&&(e=e.nativeEvent),s.value.onScrollStateChanged)try{const n=(e==null?void 0:e.data)||e;s.value.onScrollStateChanged(n)}catch{s.value.onScrollStateChanged(e)}}}));return{tabsDataStr:v,bindings:G,tabs:p,items:b,initData:N,setCallbacks:_,updateItem:(t,e)=>{if(!l){console.error("[useGridTabs] ❌ 时机错误: 尚未初始化数据,无法调用 updateItem");return}u({op:"UPDATE_ITEM",itemId:t,payload:e});const n=a=>{for(const d in e)d==="content"&&a.content?Object.assign(a.content,e.content):a[d]=e[d]};if(m){const a=b.value.find(d=>d.id===t);a&&n(a)}else for(const a of p.value)if(a.items){const d=a.items.find(f=>f.id===t);if(d){n(d);break}}},dispatchAction:u,resetInitialization:S,getFocusState:async()=>new Promise((t,e)=>{let n=o.value;typeof o.value.getNativeNode=="function"?n=o.value.getNativeNode()||o.value:o.value.nativeRef&&(n=o.value.nativeRef),$.Native.callUIFunction(n,"getFocusState",[],a=>{try{const d=typeof a=="string"?JSON.parse(a):a;t(d)}catch(d){e(d)}})}),getItemRect:async t=>new Promise((e,n)=>{let a=o.value;typeof o.value.getNativeNode=="function"?a=o.value.getNativeNode()||o.value:o.value.nativeRef&&(a=o.value.nativeRef),$.Native.callUIFunction(a,"getItemRect",[t],d=>{try{const f=typeof d=="string"?JSON.parse(d):d;e(f)}catch(f){n(f)}})})}}const te="QtKeyboard",j=c.defineComponent({__name:"Keyboard",props:{backgroundColor:{},backgroundGradient:{},textColor:{},weakTextColor:{},focusBackgroundColor:{},focusTextColor:{},placeholder:{},textFullKeyboard:{},textT9Keyboard:{},textClear:{},textDelete:{},currentInput:{},autofocus:{type:Boolean},requestFocus:{type:Boolean}},emits:["onInputChanged","onKeyPressed"],setup(o,{expose:r}){const v=c.ref(),p=q(),b=te+"_Plugin",l=(p.isPluginActive?b:te).replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase().replace(/^-/,""),y=M(l,p.pluginPackageName||"com.quicktvui.plugin.extraui","com.quicktvui.plugin.extraui.ExtraUIPluginApp");return r({getNativeNode:()=>{var i,s;return((s=(i=v.value)==null?void 0:i.getNativeNode)==null?void 0:s.call(i))||v.value},requestFocus:(...i)=>{var u,E;const s=((E=(u=v.value)==null?void 0:u.getNativeNode)==null?void 0:E.call(u))||v.value;s&&$.Native.callUIFunction(s,"requestFocus",i)}}),(i,s)=>(c.openBlock(),c.createBlock(c.unref(y),c.mergeProps({ref_key:"nativeRef",ref:v,backgroundColor:o.backgroundColor,backgroundGradient:o.backgroundGradient,textColor:o.textColor,weakTextColor:o.weakTextColor,focusBackgroundColor:o.focusBackgroundColor,focusTextColor:o.focusTextColor,placeholder:o.placeholder,textFullKeyboard:o.textFullKeyboard,textT9Keyboard:o.textT9Keyboard,textClear:o.textClear,textDelete:o.textDelete,currentInput:o.currentInput,autofocus:o.autofocus,requestFocus:o.requestFocus,onOnInputChanged:s[0]||(s[0]=u=>i.$emit("onInputChanged",u.nativeEvent)),onOnKeyPressed:s[1]||(s[1]=u=>i.$emit("onKeyPressed",u.nativeEvent))},i.$attrs),{default:c.withCtx(()=>[c.renderSlot(i.$slots,"default")]),_:3},16,["backgroundColor","backgroundGradient","textColor","weakTextColor","focusBackgroundColor","focusTextColor","placeholder","textFullKeyboard","textT9Keyboard","textClear","textDelete","currentInput","autofocus","requestFocus"]))}});let K;var ae;try{const o=require("@extscreen/es3-vue");K=o.registerElement||((ae=o.default)==null?void 0:ae.registerElement)}catch{}const ue={install:o=>{if(!globalThis.__QtKeyboard_registered)if(K){const r=(v,p)=>{K(v,{component:{name:p?"QtKeyboard_Plugin":"QtKeyboard",processEventData(b,m){const l=b.handler||b,y=m||(l==null?void 0:l.nativeParams)||{};return l&&(l.nativeEvent=y),l}}})};r("qt-keyboard",!1),r("qt-keyboard-plugin",!0),r("QtKeyboard",!1),r("QtKeyboard_Plugin",!0),globalThis.__QtKeyboard_registered=!0,console.log("[@quicktvui/naddons] Successfully registered Native tag:","QtKeyboard")}else console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue");o.component("Keyboard",j),o.component("qt-keyboard",j)}},ne="QtPortalPool",V=c.defineComponent({__name:"PortalPool",setup(o,{expose:r}){const v=c.ref(),p=q(),b=ne+"_Plugin",l=(p.isPluginActive?b:ne).replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase().replace(/^-/,""),y=M(l,p.pluginPackageName||"com.quicktvui.plugin.glintui");return r({getNativeNode:()=>{var i,s;return((s=(i=v.value)==null?void 0:i.getNativeNode)==null?void 0:s.call(i))||v.value}}),(i,s)=>(c.openBlock(),c.createBlock(c.unref(y),c.mergeProps({ref_key:"nativeRef",ref:v},i.$attrs),{default:c.withCtx(()=>[c.renderSlot(i.$slots,"default")]),_:3},16))}});let z;var ie;try{const o=require("@extscreen/es3-vue");z=o.registerElement||((ie=o.default)==null?void 0:ie.registerElement)}catch{}const de={install:o=>{if(!globalThis.__QtPortalPool_registered)if(z){const r=(v,p)=>{z(v,{component:{name:p?"QtPortalPool_Plugin":"QtPortalPool",processEventData(b,m){const l=b.handler||b,y=m||(l==null?void 0:l.nativeParams)||{};return l&&(l.nativeEvent=y),l}}})};r("qt-portal-pool",!1),r("qt-portal-pool-plugin",!0),r("QtPortalPool",!1),r("QtPortalPool_Plugin",!0),globalThis.__QtPortalPool_registered=!0,console.log("[@quicktvui/naddons] Successfully registered Native tag:","QtPortalPool")}else console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue");o.component("PortalPool",V),o.component("qt-portal-pool",V)}},oe="QtPortalItem",W=c.defineComponent({__name:"PortalItem",props:{portalId:{}},setup(o,{expose:r}){const v=c.ref(),p=q(),b=oe+"_Plugin",l=(p.isPluginActive?b:oe).replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase().replace(/^-/,""),y=M(l,p.pluginPackageName||"com.quicktvui.plugin.glintui");return r({getNativeNode:()=>{var i,s;return((s=(i=v.value)==null?void 0:i.getNativeNode)==null?void 0:s.call(i))||v.value}}),(i,s)=>(c.openBlock(),c.createBlock(c.unref(y),c.mergeProps({ref_key:"nativeRef",ref:v,portalId:o.portalId},i.$attrs),{default:c.withCtx(()=>[c.renderSlot(i.$slots,"default")]),_:3},16,["portalId"]))}});let H;var le;try{const o=require("@extscreen/es3-vue");H=o.registerElement||((le=o.default)==null?void 0:le.registerElement)}catch{}const ve={install:o=>{if(!globalThis.__QtPortalItem_registered)if(H){const r=(v,p)=>{H(v,{component:{name:p?"QtPortalItem_Plugin":"QtPortalItem",processEventData(b,m){const l=b.handler||b,y=m||(l==null?void 0:l.nativeParams)||{};return l&&(l.nativeEvent=y),l}}})};r("qt-portal-item",!1),r("qt-portal-item-plugin",!0),r("QtPortalItem",!1),r("QtPortalItem_Plugin",!0),globalThis.__QtPortalItem_registered=!0,console.log("[@quicktvui/naddons] Successfully registered Native tag:","QtPortalItem")}else console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue");o.component("PortalItem",W),o.component("qt-portal-item",W)}},se="QtHsvBackground",Z=c.defineComponent({__name:"HsvBackground",props:{hue:{default:-2}},setup(o,{expose:r}){const v=c.ref(),p=q(),b=se+"_Plugin",l=(p.isPluginActive?b:se).replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase().replace(/^-/,""),y=M(l,p.pluginPackageName||"com.quicktvui.plugin.glintui");return r({getNativeNode:()=>{var i,s;return((s=(i=v.value)==null?void 0:i.getNativeNode)==null?void 0:s.call(i))||v.value}}),(i,s)=>(c.openBlock(),c.createBlock(c.unref(y),c.mergeProps({ref_key:"nativeRef",ref:v,hue:o.hue},i.$attrs),{default:c.withCtx(()=>[c.renderSlot(i.$slots,"default")]),_:3},16,["hue"]))}}),ge={install(o){o.component("qt-hsv-background",Z),o.component("HsvBackground",Z)}},fe={skipPluginCheck:!1},Q=new Set;function M(o,r,v){return c.defineComponent({name:`${o}AsyncWrapper`,inheritAttrs:!1,props:{skipPluginCheck:{type:Boolean,default:!1}},setup(p,{slots:b,attrs:m,expose:l}){const y=c.ref("loading"),i=c.ref(""),s=c.ref(),u=globalThis.__VUE_INSTANCE__;l({getNativeNode:()=>{let P=s.value;return!P&&u&&u.vnode&&u.vnode.el&&(P=u.vnode.el,P.childNodes&&P.childNodes.length>0&&(P=P.childNodes[0])),P},nativeRef:s});let x=null,A=null;try{x=L.useES(),A=L.useESPlugin()}catch(P){console.warn("[withAsyncPlugin] 获取 useES 或 useESPlugin 失败,可能处于非 ES 环境。",P)}const O=async()=>{if(!x||typeof x.isComponentRegistered!="function")return console.log("[withAsyncPlugin] es.isComponentRegistered 不可用"),!1;try{const P=await x.isComponentRegistered(o);if(console.log(`[withAsyncPlugin] isComponentRegistered('${o}') 返回:`,P),P===!0||P&&typeof P=="object"&&(P.registered===!0||P.isRegistered===!0))return!0;try{const T=await $.Native.callNativeWithPromise("ExtendModule","getCoreSDKInfo");if(T&&T.core_version){const w=T.core_version;console.log(`[withAsyncPlugin] 当前引擎核心版本: ${w}`);const h=w.split(".").map(S=>parseInt(S,10));if(h.length>=3&&!isNaN(h[0])&&!isNaN(h[1])&&!isNaN(h[2]))if(h[0]*1e6+h[1]*1e3+h[2]>=1011205){console.log(`[withAsyncPlugin] 引擎 >= 1.11.205,使用 ExtendModule 检查 Controller: ${o}`);const N=o.split("-").map(I=>I.charAt(0).toUpperCase()+I.slice(1)).join("");console.log(`[withAsyncPlugin] 同时检查原名和驼峰名: ${o}, ${N}`);const[_,G]=await Promise.all([$.Native.callNativeWithPromise("ExtendModule","isComponentRegistered",o).catch(()=>!1),$.Native.callNativeWithPromise("ExtendModule","isComponentRegistered",N).catch(()=>!1)]);if(console.log(`[withAsyncPlugin] ExtendModule.isComponentRegistered 返回: [${_}, ${G}]`),_===!0||G===!0)return!0}else console.log(`[withAsyncPlugin] 引擎版本 ${w} < 1.11.205,跳过 ExtendModule 检查`);else console.log(`[withAsyncPlugin] 无法解析引擎版本号: ${w}`)}}catch(T){console.log("[withAsyncPlugin] 获取引擎版本或检查 Controller 失败:",T)}return!1}catch(P){return console.warn("[withAsyncPlugin] 检查组件注册状态异常:",P),!1}},F=async()=>{if(fe.skipPluginCheck||p.skipPluginCheck){console.log(`[withAsyncPlugin] 跳过 ${o} 插件检查 (skipPluginCheck = true)`),y.value="ready";return}if(!r){y.value="ready";return}const P=await O();if(console.log(`[withAsyncPlugin] 拦截检查 - ${o} 是否已注册:`,P),P||Q.has(r)){y.value="ready",Q.add(r),console.log("[withAsyncPlugin] 组件已注册,跳过安装流程");return}if(!A){console.warn(`[withAsyncPlugin] 无法获取 useESPlugin 实例,可能处于内置 AAR 环境或非插件环境,尝试直接渲染 ${o}`),y.value="ready";return}console.log(`[withAsyncPlugin] 开始动态安装插件: ${r}`);try{await new Promise((T,w)=>{let h;const S={onPluginInstallSuccess(N,_,G){N===r&&(clearTimeout(h),A.removeListener(S),console.log(`[withAsyncPlugin] 安装成功 pkg=${N} 状态码=${_}`),_==1003||_==1001?(v?(console.log(`[withAsyncPlugin] 触发反射初始化: ${v}`),$.Native.callNative("EsNativeModule","callReflect",{entry:{from:v,method:"setup"}})):console.log("[withAsyncPlugin] 安装成功,跳过反射初始化(无 pluginInitClass)"),T()):w(new Error(`安装失败 pkg=${N} status=${_} msg=${G}`)))},onPluginInstallError(N,_,G){N===r&&(clearTimeout(h),A.removeListener(S),w(new Error(`安装失败 pkg=${N} status=${_} msg=${G}`)))}};A.addListener({pkg:r},S),h=setTimeout(()=>{A.removeListener(S),w(new Error(`插件安装超时: ${r}`))},8e3),typeof A.installPlugin=="function"?A.installPlugin({pkg:r}):typeof A.install=="function"?A.install(r):w(new Error("当前运行时不支持 install / installPlugin"))}),await c.nextTick(),Q.add(r),y.value="ready"}catch(T){console.error("[withAsyncPlugin] 插件加载失败:",T),i.value=(T==null?void 0:T.message)||String(T),y.value="error"}};return c.onMounted(()=>{F()}),()=>{const P={display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",...m.style||{}};m.width!==void 0&&!P.width&&(P.width=typeof m.width=="number"?`${m.width}px`:m.width),m.height!==void 0&&!P.height&&(P.height=typeof m.height=="number"?`${m.height}px`:m.height);const T=m.class?`qt-plugin-container ${m.class}`:"qt-plugin-container",w={class:T,style:P,clipChildren:!1,clipPadding:!1,clipToPadding:!1};if(y.value==="loading")return c.h("div",w,[c.h("div",{style:{color:"white",fontSize:"30px"}},"插件加载中...")]);if(y.value==="error")return c.h("div",w,[c.h("div",{style:{color:"white",fontSize:"30px",backgroundColor:"rgba(255,0,0,0.5)"}},`插件加载失败: ${i.value}`)]);const h={},S={};for(const[I,C]of Object.entries(m))if(I.startsWith("on")&&typeof C=="function"){let D=I;I.startsWith("onOn")&&(D="on"+I.slice(4)),S[D]=C}else if(I.startsWith("on")&&Array.isArray(C)){let D=I;I.startsWith("onOn")&&(D="on"+I.slice(4)),S[D]=C}else I.startsWith("onOn")||(h[I]=C);const N={...h,...S,class:T,style:P,ref:I=>{s.value=I}},_=N.tabsData||"",G=N.actionPayload||"";return console.log("[withAsyncPlugin] 最终准备传递给 h() 的属性键集合:",Object.keys(N),"tabsData.length=",_.length,"actionPayload.length=",G.length),c.h(o,N,b.default?b.default():[])}}})}const Y=Symbol("AddonEnvContext"),pe={isPluginActive:!1,nameSuffix:"",pluginPackageName:"com.quicktvui.plugin.glintui",builtInVersions:{}};async function Pe(o="com.quicktvui.plugin.glintui",r="_Plugin"){const v=L.useES();let p={};try{const i=await $.Native.callNativeModule("AddonEnvModule","getBuiltInVersions",[]);i&&typeof i=="object"&&(p=i)}catch(i){console.warn("[AddonProvider] Failed to fetch built-in versions from AddonEnvModule",i)}const b=`QtGridTabs${r}`,m=v.isComponentRegistered(b),l=m instanceof Promise?await m:m,y={isPluginActive:l,nameSuffix:l?r:"",pluginPackageName:l?`${o}.ext`:o,builtInVersions:p};return console.info("[AddonProvider] Environment initialized:",y),y}let J=c.ref(pe);function he(o){J.value=o,c.provide(Y,J)}function q(){var o;return((o=c.inject(Y,J))==null?void 0:o.value)||pe}const be={install:o=>{o.use(ce),o.use(ue),o.use(de),o.use(ve),o.use(ge)}};exports.ADDON_ENV_CONTEXT_KEY=Y;exports.GridTabs=B;exports.GridTabsPlugin=ce;exports.HsvBackground=Z;exports.HsvBackgroundPlugin=ge;exports.Keyboard=j;exports.KeyboardPlugin=ue;exports.PortalItem=W;exports.PortalItemPlugin=ve;exports.PortalPool=V;exports.PortalPoolPlugin=de;exports.QuickTVUINAddons=be;exports.QuickTVUINAddonsConfig=fe;exports.default=be;exports.initAddonEnv=Pe;exports.provideAddonEnv=he;exports.useAddonEnv=q;exports.useGridTabs=ye;exports.withAsyncPlugin=M;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("vue"),x=require("@extscreen/es3-vue"),U=require("@extscreen/es3-core"),ee="QtGridTabs",Q=i.defineComponent({__name:"GridTabs",props:{protocolVersion:{},tabsData:{},actionPayload:{},hsvHue:{default:-2}},emits:["onTabSelected","onTabNeedsData","onLoadMore","onItemPresence","onTabFocused","onItemClick","onItemFocused","onProtocolMismatch","onScroll","onScrollStateChanged"],setup(o,{expose:s}){const v=i.ref(),g=q(),p=ee+"_Plugin",u=(g.isPluginActive?p:ee).replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase().replace(/^-/,""),m=M(u,g.pluginPackageName||"com.quicktvui.plugin.glintui");return s({getNativeNode:()=>{var l,a;return((a=(l=v.value)==null?void 0:l.getNativeNode)==null?void 0:a.call(l))||v.value},dispatchAction:(...l)=>{var c,h;const a=((h=(c=v.value)==null?void 0:c.getNativeNode)==null?void 0:h.call(c))||v.value;a&&x.Native.callUIFunction(a,"dispatchAction",l)},scrollToTop:(...l)=>{var c,h;const a=((h=(c=v.value)==null?void 0:c.getNativeNode)==null?void 0:h.call(c))||v.value;a&&x.Native.callUIFunction(a,"scrollToTop",l)}}),(l,a)=>(i.openBlock(),i.createBlock(i.unref(m),i.mergeProps({ref_key:"nativeRef",ref:v,protocolVersion:o.protocolVersion,tabsData:o.tabsData,actionPayload:o.actionPayload,hsvHue:o.hsvHue,onOnTabSelected:a[0]||(a[0]=c=>l.$emit("onTabSelected",c.nativeEvent)),onOnTabNeedsData:a[1]||(a[1]=c=>l.$emit("onTabNeedsData",c.nativeEvent)),onOnLoadMore:a[2]||(a[2]=c=>l.$emit("onLoadMore",c.nativeEvent)),onOnItemPresence:a[3]||(a[3]=c=>l.$emit("onItemPresence",c.nativeEvent)),onOnTabFocused:a[4]||(a[4]=c=>l.$emit("onTabFocused",c.nativeEvent)),onOnItemClick:a[5]||(a[5]=c=>l.$emit("onItemClick",c.nativeEvent)),onOnItemFocused:a[6]||(a[6]=c=>l.$emit("onItemFocused",c.nativeEvent)),onOnProtocolMismatch:a[7]||(a[7]=c=>l.$emit("onProtocolMismatch",c.nativeEvent)),onOnScroll:a[8]||(a[8]=c=>l.$emit("onScroll",c.nativeEvent)),onOnScrollStateChanged:a[9]||(a[9]=c=>l.$emit("onScrollStateChanged",c.nativeEvent))},l.$attrs),{default:i.withCtx(()=>[i.renderSlot(l.$slots,"default")]),_:3},16,["protocolVersion","tabsData","actionPayload","hsvHue"]))}});let K;var re;try{const o=require("@extscreen/es3-vue");K=o.registerElement||((re=o.default)==null?void 0:re.registerElement)}catch{}const ce={install:o=>{if(!globalThis.__QtGridTabs_registered)if(K){const s=(v,g)=>{K(v,{component:{name:g?"QtGridTabs_Plugin":"QtGridTabs",processEventData(p,y){const u=p.handler||p,m=y||(u==null?void 0:u.nativeParams)||{};return u&&(u.nativeEvent=m),u}}})};s("qt-grid-tabs",!1),s("qt-grid-tabs-plugin",!0),s("QtGridTabs",!1),s("QtGridTabs_Plugin",!0),s("gt-tabs",!1),s("gt-tabs-plugin",!0),globalThis.__QtGridTabs_registered=!0,console.log("[@quicktvui/naddons] Successfully registered Native tag:","QtGridTabs")}else console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue");o.component("GridTabs",Q),o.component("qt-grid-tabs",Q),o.component("gt-tabs",Q)}};function me(o,s){const v=i.ref(""),g=i.shallowRef([]),p=i.shallowRef([]);let y=!1,u=!1;const m="__virtual_single_tab__";let l="";const a=i.ref({}),c=t=>{const e=Array.isArray(t)?t:[t],n=JSON.stringify(e);if(u&&o.value){if(typeof o.value.dispatchAction=="function"){console.log("[useGridTabs] Calling Wrapper dispatchAction directly"),o.value.dispatchAction(n);return}let r=o.value;typeof o.value.getNativeNode=="function"?r=o.value.getNativeNode()||o.value:o.value.nativeRef&&(r=o.value.nativeRef),r?(console.log("[useGridTabs] Calling Native.callUIFunction(dispatchAction)"),x.Native.callUIFunction(r,"dispatchAction",[n])):console.warn("[useGridTabs] Native target is null or undefined, cannot call dispatchAction")}},h=(t,e)=>{if(!t)return!1;let n=!0;return t.id||(console.error(`[useGridTabs] ❌ 数据格式错误 (${e}): 卡片缺失必填字段 'id'。每个卡片必须有唯一标识才能进行后续更新!`,t),n=!1),t.viewType||(console.error(`[useGridTabs] ❌ 数据格式错误 (${e}): 卡片缺失必填字段 'viewType' (id: ${t.id||"未知"})。必须指定 Native 注册的视图类型或 Portal 标识!`,t),n=!1),n},A=(t,e)=>{if(!t)return!1;let n=!0;return t.tabId||(console.error(`[useGridTabs] ❌ 数据格式错误 (${e}): Tab 缺失必填字段 'tabId'。每个 Tab 必须有唯一标识!`,t),n=!1),(t.title===void 0||t.title===null)&&console.warn(`[useGridTabs] ⚠️ 数据格式警告 (${e}): Tab 缺失 'title' 字段 (tabId: ${t.tabId||"未知"}),导航栏可能显示为空。`,t),n},_=(t,e)=>{if(!t||t.length===0)return;I.clear();const n=t[0].hasOwnProperty("tabId")||t[0].hasOwnProperty("items")&&Array.isArray(t[0].items);y=e==="1d",e==="1d"&&n?console.error("[useGridTabs] ❌ 赋值错误: 你正在向 `items.value` (一维瀑布流) 赋值二维 Tabs 数据结构!请改用 `tabs.value = ...`"):e==="2d"&&!n&&console.error("[useGridTabs] ❌ 赋值错误: 你正在向 `tabs.value` (二维导航) 赋值一维卡片列表数据结构!请改用 `items.value = ...`"),e==="1d"?t.forEach((r,d)=>h(r,`items.value[${d}]`)):t.forEach((r,d)=>{A(r,`tabs.value[${d}]`),r.items&&Array.isArray(r.items)&&r.items.forEach((b,f)=>h(b,`tabs.value[${d}].items[${f}]`))}),u=!0,C()},I=new Set,C=(t="unknown")=>{if(!u){console.warn("[useGridTabs] triggerRootUpdate skipped because isInitialized is false");return}let e={protocolVersion:"1.28.0",gridBasis:(s==null?void 0:s.gridBasis)??30,unitType:(s==null?void 0:s.unitType)??"px",contentConfig:(s==null?void 0:s.contentConfig)??(s==null?void 0:s.layoutConfig)??{box:{padding:[0,60,60,60]},navContentGapNormal:0,itemGap:24},navConfig:(s==null?void 0:s.navConfig)??{dock:"left",mode:"fixed",renderType:"smart-hybrid",box:{size:[200,0]},expandedBox:{size:[300,0]}},cacheConfig:(s==null?void 0:s.cacheConfig)??{offscreenPageLimit:1,prefetchOffset:2,preLoadEnabled:!1,strategy:"data_priority"},animationConfig:(s==null?void 0:s.animationConfig)??{duration:300,easing:"ease-out"},interactionStrategy:(s==null?void 0:s.interactionStrategy)??{defaultFocus:"nav",interceptBack:!0,backMode:"home-first",autoScrollToTop:!0,edgeScrollProtection:.5},focusConfig:(s==null?void 0:s.focusConfig)??{boundaryLock:{left:!1,right:!1,top:!1,bottom:!1}},themeConfig:s==null?void 0:s.themeConfig,referenceResolution:(s==null?void 0:s.referenceResolution)??{w:1920,h:1080}},n=[];y?(e.navConfig={...e.navConfig,renderType:"none"},n=[{tabId:m,title:"Virtual Tab",hidden:!0,items:p.value}]):n=g.value;const r=JSON.stringify({page_spec:e,tabs:n});if(v.value==="")console.log(`[useGridTabs] triggerRootUpdate: Initializing tabsDataStr (length=${r.length})`),v.value=r,l=r;else{if(l===r){console.log("[useGridTabs] triggerRootUpdate: Data unchanged, skipping RELOAD_TABS");return}console.log(`[useGridTabs] triggerRootUpdate: Sending RELOAD_TABS action directly to Native (length=${r.length})`),v.value=r,l=r,c({op:"RELOAD_TABS",payload:{pageSpec:e,page_spec:e,tabs:n}})}},R=t=>{if(!t||typeof t!="object"||t.__isGridTabsProxy)return t;t.content&&typeof t.content=="object"&&!t.content.__isGridTabsProxy&&(t.content=new Proxy(t.content,{set(n,r,d,b){const f=Reflect.set(n,r,d,b);return t.id&&u&&c({op:"UPDATE_ITEM",itemId:t.id,payload:t}),f}}),Object.defineProperty(t.content,"__isGridTabsProxy",{value:!0,enumerable:!1}),Object.defineProperty(t.content,"__v_skip",{value:!0,enumerable:!1})),t.subItems&&Array.isArray(t.subItems)&&!t.subItems.__isGridTabsProxy&&(t.subItems=P(t.subItems,t.id),Object.defineProperty(t.subItems,"__isGridTabsProxy",{value:!0,enumerable:!1}),Object.defineProperty(t.subItems,"__v_skip",{value:!0,enumerable:!1}));const e=new Proxy(t,{set(n,r,d,b){const f=Reflect.set(n,r,d,b);return n.id&&u&&c({op:"UPDATE_ITEM",itemId:n.id,payload:n}),f}});return Object.defineProperty(e,"__isGridTabsProxy",{value:!0,enumerable:!1}),Object.defineProperty(e,"__v_skip",{value:!0,enumerable:!1}),e},P=(t,e)=>{for(let n=0;n<t.length;n++)t[n]=R(t[n]);return new Proxy(t,{get(n,r,d){return r==="push"?(...b)=>{b.forEach((B,ye)=>h(B,`push(${ye})`)),u||console.error("[useGridTabs] ❌ 时机错误: 在底层还未完成初始化时调用了 push()。请先对 items.value 或 tabs.value 进行全量赋值!");const f=b.map(B=>R(B)),S=Array.prototype.push.apply(n,f);return c({op:"APPEND_SUB_ITEMS",itemId:e,payload:{subItems:f}}),S}:r==="splice"?(...b)=>{const f=b.length>=2&&b[0]===0&&b[1]===n.length,S=Array.prototype.splice.apply(n,b);return u&&f&&e!==m?c({op:"UPDATE_TAB_STATE",itemId:e,payload:{action:"clear_items"}}):u&&C("items array spliced"),S}:Reflect.get(n,r,d)},set(n,r,d,b){if(r!=="length"&&!isNaN(Number(r))){u||console.error(`[useGridTabs] ❌ 时机错误: 在底层还未完成初始化时直接修改了索引 [${String(r)}]。请先对 items.value 或 tabs.value 进行全量赋值!`),h(d,`索引赋值 [${String(r)}]`);const f=R(d),S=Reflect.set(n,r,f,b);return f&&f.id&&c({op:"UPDATE_ITEM",itemId:f.id,payload:f}),S}return Reflect.set(n,r,d,b)}})},N=t=>(t.items&&Array.isArray(t.items)&&!t.items.__isGridTabsProxy&&(t.items=P(t.items,t.tabId),Object.defineProperty(t.items,"__isGridTabsProxy",{value:!0,enumerable:!1})),new Proxy(t,{set(e,n,r,d){if(n==="items"){let f=r;return Array.isArray(r)&&!r.__isGridTabsProxy&&(f=P(r,e.tabId),Object.defineProperty(f,"__isGridTabsProxy",{value:!0,enumerable:!1})),Reflect.set(e,n,f,d)}else if(n==="loadState"){const f=Reflect.set(e,n,r,d);return u&&e.tabId&&c({op:"UPDATE_TAB_STATE",itemId:e.tabId,payload:{loadState:r}}),f}return Reflect.set(e,n,r,d)}})),w=t=>{const e=t.map(n=>N(n));return new Proxy(e,{set(n,r,d,b){if(r!=="length"&&!isNaN(Number(r))){let f=d;d.__isGridTabsProxy||(f=N(d),Object.defineProperty(f,"__isGridTabsProxy",{value:!0,enumerable:!1}));const S=Reflect.set(n,r,f,b);return C(),S}return Reflect.set(n,r,d,b)}})};i.watch(g,(t,e)=>{if(console.log("[useGridTabs] watch(tabs) triggered:",{newTabs:t,isInitialized:u}),!t||t.length===0){v.value="",l="",u=!1;return}if(t.__isGridTabsProxy)console.log("[useGridTabs] newTabs is ALREADY a proxy, triggering root update"),C();else{console.log("[useGridTabs] newTabs is NOT a proxy, performing full deduceModeAndInitialize & wrapping");const n=w(t);Object.defineProperty(n,"__isGridTabsProxy",{value:!0,enumerable:!1}),_(n,"2d"),g.value=n}},{flush:"sync",deep:!1}),i.watch(p,(t,e)=>{if(console.log("[useGridTabs] watch(items) triggered:",{newItems:t,isInitialized:u}),!t||t.length===0){v.value="",l="",u=!1;return}if(t.__isGridTabsProxy)console.log("[useGridTabs] newItems is ALREADY a proxy, triggering root update"),C();else{console.log("[useGridTabs] newItems is NOT a proxy, performing full deduceModeAndInitialize & wrapping");const n=P(t,m);Object.defineProperty(n,"__isGridTabsProxy",{value:!0,enumerable:!1}),_(n,"1d"),p.value=n}},{flush:"sync",deep:!1});const T={},$=()=>{console.log("[useGridTabs] resetInitialization called manually"),u=!1,I.clear();for(const t in T)delete T[t]},E=t=>{if(!t||t.length===0){v.value="",u=!1;return}t[0].hasOwnProperty("tabId")||t[0].hasOwnProperty("items")&&Array.isArray(t[0].items)?g.value=t:p.value=t},G=t=>{a.value=t},O=i.computed(()=>({tabsData:v.value,onTabNeedsData:async(...t)=>{let e=t[0];if(e&&e.nativeEvent&&(e=e.nativeEvent),!a.value.onTabNeedsData)return;const{tabId:n,index:r,reason:d}=e;if(I.has(n)){console.log(`[useGridTabs] onTabNeedsData SKIP: tabId=${n} 已经发起过请求,防止死循环`);return}I.add(n);try{const b=await a.value.onTabNeedsData(n,r,d);if(b&&Array.isArray(b))if(T[n]=1,b.length>0){const f=g.value.find(S=>S.tabId===n);f&&(f.items?f.items.length>0&&f.items.splice(0,f.items.length):f.items=[],f.items.push(...b),f.loadState="ready",c({op:"UPDATE_TAB_STATE",itemId:n,payload:{loadState:"ready"}}))}else console.warn(`[useGridTabs] ⚠️ 警告: onTabNeedsData(tabId="${n}") 返回了空数组 []!`),console.warn("👉 如果你已经在此函数内手动调用了 push() 来追加数据,请在最后 return null 或 undefined。"),console.warn("👉 如果该 Tab 确实没有数据,返回 [] 可能会导致底层的 Header 等已有元素被清空,请注意检查。"),console.warn("👉 框架已为您拦截此次空数组覆盖,保留了当前的 DOM 结构。")}catch(b){console.error("[useGridTabs] onTabNeedsData 执行失败:",b),I.delete(n)}},onLoadMore:async(...t)=>{let e=t[0];if(e&&e.nativeEvent&&(e=e.nativeEvent),!a.value.onLoadMore)return;const{tabId:n,itemId:r}=e,b=(T[n]||1)+1;console.log(`[useGridTabs] 拦截到底层 onLoadMore,强行接管页码: tabId=${n}, pageNo=${b}`);try{const f=await a.value.onLoadMore(n,b,r);if(f&&Array.isArray(f))if(f.length>0)if(T[n]=b,y)p.value.push(...f);else{const S=g.value.find(B=>B.tabId===n);S&&S.items&&S.items.push(...f)}else console.warn(`[useGridTabs] ⚠️ 警告: onLoadMore(tabId="${n}", pageNo="${b}") 返回了空数组 []!`),console.warn('👉 如果这是你的最后一页数据,推荐在卡片列表中追加一个 type="no_more" 的 footer 卡片,而不是仅仅返回空。'),console.warn("👉 框架已忽略本次空数据追加,且不会自增页码。")}catch(f){console.error("[useGridTabs] onLoadMore 业务层请求失败:",f)}},onItemPresence:(...t)=>{let e=t[0];if(console.log("[useGridTabs] ⚡️ bindings caught onItemPresence:",e),a.value.onItemPresence)try{let n=typeof e=="string"?e:(e==null?void 0:e.nativeEvent)||e;n&&typeof n.data=="string"&&(n=n.data);const r=typeof n=="string"?JSON.parse(n):n;r&&r.type==="VIEW_PRESENCE_BATCH"&&Array.isArray(r.payload)?r.payload.forEach(d=>{d.itemId&&typeof d.itemId=="string"&&d.itemId.startsWith("fallback_pos_")&&console.warn(`[useGridTabs] ⚠️ 警告:检测到列表项曝光 (index=${d.index}),但未配置 itemId。请检查传入的 items 数组,务必为每个数据项指定唯一的 itemId,否则底层无法准确进行去重与曝光上报。`),a.value.onItemPresence(d)}):a.value.onItemPresence(r)}catch(n){console.error("[useGridTabs] Failed to parse onItemPresence event payload:",n),a.value.onItemPresence(e)}},onTabSelected:(...t)=>{let e=t[0];e&&e.nativeEvent&&(e=e.nativeEvent),a.value.onTabSelected&&a.value.onTabSelected(e)},onItemClick:(...t)=>{let e=t[0];if(console.log("[useGridTabs] RAW onItemClick intercepted from Native:",e),e&&e.nativeEvent&&(e=e.nativeEvent),a.value.onItemClick)try{let n=typeof e=="string"?e:(e==null?void 0:e.data)||e;console.log("[useGridTabs] Parsed eventStr:",n);const r=typeof n=="string"?JSON.parse(n):n;a.value.onItemClick(r)}catch(n){console.error("[useGridTabs] Failed to parse onItemClick event payload:",n),a.value.onItemClick(e)}else console.warn("[useGridTabs] onItemClick triggered but NO callback registered in callbacksRef!")},onItemFocused:(...t)=>{let e=t[0];if(e&&e.nativeEvent&&(e=e.nativeEvent),a.value.onItemFocused)try{let n=typeof e=="string"?e:(e==null?void 0:e.data)||e;const r=typeof n=="string"?JSON.parse(n):n;a.value.onItemFocused(r)}catch(n){console.error("[useGridTabs] Failed to parse onItemFocused event payload:",n),a.value.onItemFocused(e)}},onTabFocused:(...t)=>{let e=t[0];e&&e.nativeEvent&&(e=e.nativeEvent),a.value.onTabFocused&&a.value.onTabFocused(e)},onScroll:(...t)=>{let e=t[0];if(e&&e.nativeEvent&&(e=e.nativeEvent),a.value.onScroll)try{const n=(e==null?void 0:e.data)||e;a.value.onScroll(n)}catch{a.value.onScroll(e)}},onScrollStateChanged:(...t)=>{let e=t[0];if(e&&e.nativeEvent&&(e=e.nativeEvent),a.value.onScrollStateChanged)try{const n=(e==null?void 0:e.data)||e;a.value.onScrollStateChanged(n)}catch{a.value.onScrollStateChanged(e)}}}));return{tabsDataStr:v,bindings:O,tabs:g,items:p,initData:E,setCallbacks:G,updateItem:(t,e)=>{if(!u){console.error("[useGridTabs] ❌ 时机错误: 尚未初始化数据,无法调用 updateItem");return}c({op:"UPDATE_ITEM",itemId:t,payload:e});const n=r=>{for(const d in e)d==="content"&&r.content?Object.assign(r.content,e.content):r[d]=e[d]};if(y){const r=p.value.find(d=>d.id===t);r&&n(r)}else for(const r of g.value)if(r.items){const d=r.items.find(b=>b.id===t);if(d){n(d);break}}},dispatchAction:c,resetInitialization:$,getFocusState:async()=>new Promise((t,e)=>{let n=o.value;typeof o.value.getNativeNode=="function"?n=o.value.getNativeNode()||o.value:o.value.nativeRef&&(n=o.value.nativeRef),x.Native.callUIFunction(n,"getFocusState",[],r=>{try{const d=typeof r=="string"?JSON.parse(r):r;t(d)}catch(d){e(d)}})}),getItemRect:async t=>new Promise((e,n)=>{let r=o.value;typeof o.value.getNativeNode=="function"?r=o.value.getNativeNode()||o.value:o.value.nativeRef&&(r=o.value.nativeRef),x.Native.callUIFunction(r,"getItemRect",[t],d=>{try{const b=typeof d=="string"?JSON.parse(d):d;e(b)}catch(b){n(b)}})})}}const te="QtKeyboard",j=i.defineComponent({__name:"Keyboard",props:{backgroundColor:{},backgroundGradient:{},textColor:{},weakTextColor:{},focusBackgroundColor:{},focusTextColor:{},placeholder:{},textFullKeyboard:{},textT9Keyboard:{},textClear:{},textDelete:{},currentInput:{},autofocus:{type:Boolean},requestFocus:{type:Boolean},keyboardType:{},rememberKeyboardType:{type:Boolean}},emits:["onInputChanged","onKeyPressed"],setup(o,{expose:s,emit:v}){const g=i.ref(),p=q(),y=te+"_Plugin",m=(p.isPluginActive?y:te).replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase().replace(/^-/,""),l=M(m,p.pluginPackageName||"com.quicktvui.plugin.extraui","com.quicktvui.plugin.extraui.ExtraUIPluginApp"),a=o;return i.onMounted(()=>{(a.autofocus||a.requestFocus)&&setTimeout(()=>{var h,A;const c=((A=(h=g.value)==null?void 0:h.getNativeNode)==null?void 0:A.call(h))||g.value;c&&x.Native.callUIFunction(c,"requestFocus",[!0])},300)}),i.watch(()=>a.requestFocus,c=>{c&&setTimeout(()=>{var A,_;const h=((_=(A=g.value)==null?void 0:A.getNativeNode)==null?void 0:_.call(A))||g.value;h&&x.Native.callUIFunction(h,"requestFocus",[!0])},300)}),s({getNativeNode:()=>{var c,h;return((h=(c=g.value)==null?void 0:c.getNativeNode)==null?void 0:h.call(c))||g.value},requestFocus:(...c)=>{var A,_;const h=((_=(A=g.value)==null?void 0:A.getNativeNode)==null?void 0:_.call(A))||g.value;h&&x.Native.callUIFunction(h,"requestFocus",c)}}),(c,h)=>(i.openBlock(),i.createBlock(i.unref(l),i.mergeProps({ref_key:"nativeRef",ref:g,backgroundColor:o.backgroundColor,backgroundGradient:o.backgroundGradient,textColor:o.textColor,weakTextColor:o.weakTextColor,focusBackgroundColor:o.focusBackgroundColor,focusTextColor:o.focusTextColor,placeholder:o.placeholder,textFullKeyboard:o.textFullKeyboard,textT9Keyboard:o.textT9Keyboard,textClear:o.textClear,textDelete:o.textDelete,currentInput:o.currentInput,autofocus:o.autofocus,requestFocus:o.requestFocus,keyboardType:o.keyboardType,rememberKeyboardType:o.rememberKeyboardType??!0,onOnInputChanged:h[0]||(h[0]=A=>c.$emit("onInputChanged",A.nativeEvent)),onOnKeyPressed:h[1]||(h[1]=A=>c.$emit("onKeyPressed",A.nativeEvent))},c.$attrs),{default:i.withCtx(()=>[i.renderSlot(c.$slots,"default")]),_:3},16,["backgroundColor","backgroundGradient","textColor","weakTextColor","focusBackgroundColor","focusTextColor","placeholder","textFullKeyboard","textT9Keyboard","textClear","textDelete","currentInput","autofocus","requestFocus","keyboardType","rememberKeyboardType"]))}});let V;var ae;try{const o=require("@extscreen/es3-vue");V=o.registerElement||((ae=o.default)==null?void 0:ae.registerElement)}catch{}const ue={install:o=>{if(!globalThis.__QtKeyboard_registered)if(V){const s=(v,g)=>{V(v,{component:{name:g?"QtKeyboard_Plugin":"QtKeyboard",processEventData(p,y){const u=p.handler||p,m=y||(u==null?void 0:u.nativeParams)||{};return u&&(u.nativeEvent=m),u}}})};s("qt-keyboard",!1),s("qt-keyboard-plugin",!0),s("QtKeyboard",!1),s("QtKeyboard_Plugin",!0),globalThis.__QtKeyboard_registered=!0,console.log("[@quicktvui/naddons] Successfully registered Native tag:","QtKeyboard")}else console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue");o.component("Keyboard",j),o.component("qt-keyboard",j)}},ne="QtPortalPool",z=i.defineComponent({__name:"PortalPool",setup(o,{expose:s}){const v=i.ref(),g=q(),p=ne+"_Plugin",u=(g.isPluginActive?p:ne).replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase().replace(/^-/,""),m=M(u,g.pluginPackageName||"com.quicktvui.plugin.glintui");return s({getNativeNode:()=>{var l,a;return((a=(l=v.value)==null?void 0:l.getNativeNode)==null?void 0:a.call(l))||v.value}}),(l,a)=>(i.openBlock(),i.createBlock(i.unref(m),i.mergeProps({ref_key:"nativeRef",ref:v},l.$attrs),{default:i.withCtx(()=>[i.renderSlot(l.$slots,"default")]),_:3},16))}});let W;var ie;try{const o=require("@extscreen/es3-vue");W=o.registerElement||((ie=o.default)==null?void 0:ie.registerElement)}catch{}const de={install:o=>{if(!globalThis.__QtPortalPool_registered)if(W){const s=(v,g)=>{W(v,{component:{name:g?"QtPortalPool_Plugin":"QtPortalPool",processEventData(p,y){const u=p.handler||p,m=y||(u==null?void 0:u.nativeParams)||{};return u&&(u.nativeEvent=m),u}}})};s("qt-portal-pool",!1),s("qt-portal-pool-plugin",!0),s("QtPortalPool",!1),s("QtPortalPool_Plugin",!0),globalThis.__QtPortalPool_registered=!0,console.log("[@quicktvui/naddons] Successfully registered Native tag:","QtPortalPool")}else console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue");o.component("PortalPool",z),o.component("qt-portal-pool",z)}},oe="QtPortalItem",H=i.defineComponent({__name:"PortalItem",props:{portalId:{}},setup(o,{expose:s}){const v=i.ref(),g=q(),p=oe+"_Plugin",u=(g.isPluginActive?p:oe).replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase().replace(/^-/,""),m=M(u,g.pluginPackageName||"com.quicktvui.plugin.glintui");return s({getNativeNode:()=>{var l,a;return((a=(l=v.value)==null?void 0:l.getNativeNode)==null?void 0:a.call(l))||v.value}}),(l,a)=>(i.openBlock(),i.createBlock(i.unref(m),i.mergeProps({ref_key:"nativeRef",ref:v,portalId:o.portalId},l.$attrs),{default:i.withCtx(()=>[i.renderSlot(l.$slots,"default")]),_:3},16,["portalId"]))}});let Z;var le;try{const o=require("@extscreen/es3-vue");Z=o.registerElement||((le=o.default)==null?void 0:le.registerElement)}catch{}const ve={install:o=>{if(!globalThis.__QtPortalItem_registered)if(Z){const s=(v,g)=>{Z(v,{component:{name:g?"QtPortalItem_Plugin":"QtPortalItem",processEventData(p,y){const u=p.handler||p,m=y||(u==null?void 0:u.nativeParams)||{};return u&&(u.nativeEvent=m),u}}})};s("qt-portal-item",!1),s("qt-portal-item-plugin",!0),s("QtPortalItem",!1),s("QtPortalItem_Plugin",!0),globalThis.__QtPortalItem_registered=!0,console.log("[@quicktvui/naddons] Successfully registered Native tag:","QtPortalItem")}else console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue");o.component("PortalItem",H),o.component("qt-portal-item",H)}},se="QtHsvBackground",J=i.defineComponent({__name:"HsvBackground",props:{hue:{default:-2}},setup(o,{expose:s}){const v=i.ref(),g=q(),p=se+"_Plugin",u=(g.isPluginActive?p:se).replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase().replace(/^-/,""),m=M(u,g.pluginPackageName||"com.quicktvui.plugin.glintui");return s({getNativeNode:()=>{var l,a;return((a=(l=v.value)==null?void 0:l.getNativeNode)==null?void 0:a.call(l))||v.value}}),(l,a)=>(i.openBlock(),i.createBlock(i.unref(m),i.mergeProps({ref_key:"nativeRef",ref:v,hue:o.hue},l.$attrs),{default:i.withCtx(()=>[i.renderSlot(l.$slots,"default")]),_:3},16,["hue"]))}}),ge={install(o){o.component("qt-hsv-background",J),o.component("HsvBackground",J)}},fe={skipPluginCheck:!1},L=new Set;function M(o,s,v){return i.defineComponent({name:`${o}AsyncWrapper`,inheritAttrs:!1,props:{skipPluginCheck:{type:Boolean,default:!1}},setup(g,{slots:p,attrs:y,expose:u}){const m=i.ref("loading"),l=i.ref(""),a=i.ref(),c=globalThis.__VUE_INSTANCE__;u({getNativeNode:()=>{let P=a.value;return!P&&c&&c.vnode&&c.vnode.el&&(P=c.vnode.el,P.childNodes&&P.childNodes.length>0&&(P=P.childNodes[0])),P},nativeRef:a});let _=null,I=null;try{_=U.useES(),I=U.useESPlugin()}catch(P){console.warn("[withAsyncPlugin] 获取 useES 或 useESPlugin 失败,可能处于非 ES 环境。",P)}const C=async()=>{if(!_||typeof _.isComponentRegistered!="function")return console.log("[withAsyncPlugin] es.isComponentRegistered 不可用"),!1;try{const P=await _.isComponentRegistered(o);if(console.log(`[withAsyncPlugin] isComponentRegistered('${o}') 返回:`,P),P===!0||P&&typeof P=="object"&&(P.registered===!0||P.isRegistered===!0))return!0;try{const N=await x.Native.callNativeWithPromise("ExtendModule","getCoreSDKInfo");if(N&&N.core_version){const w=N.core_version;console.log(`[withAsyncPlugin] 当前引擎核心版本: ${w}`);const T=w.split(".").map($=>parseInt($,10));if(T.length>=3&&!isNaN(T[0])&&!isNaN(T[1])&&!isNaN(T[2]))if(T[0]*1e6+T[1]*1e3+T[2]>=1011205){console.log(`[withAsyncPlugin] 引擎 >= 1.11.205,使用 ExtendModule 检查 Controller: ${o}`);const E=o.split("-").map(k=>k.charAt(0).toUpperCase()+k.slice(1)).join("");console.log(`[withAsyncPlugin] 同时检查原名和驼峰名: ${o}, ${E}`);const[G,O]=await Promise.all([x.Native.callNativeWithPromise("ExtendModule","isComponentRegistered",o).catch(()=>!1),x.Native.callNativeWithPromise("ExtendModule","isComponentRegistered",E).catch(()=>!1)]);if(console.log(`[withAsyncPlugin] ExtendModule.isComponentRegistered 返回: [${G}, ${O}]`),G===!0||O===!0)return!0}else console.log(`[withAsyncPlugin] 引擎版本 ${w} < 1.11.205,跳过 ExtendModule 检查`);else console.log(`[withAsyncPlugin] 无法解析引擎版本号: ${w}`)}}catch(N){console.log("[withAsyncPlugin] 获取引擎版本或检查 Controller 失败:",N)}return!1}catch(P){return console.warn("[withAsyncPlugin] 检查组件注册状态异常:",P),!1}},R=async()=>{if(fe.skipPluginCheck||g.skipPluginCheck){console.log(`[withAsyncPlugin] 跳过 ${o} 插件检查 (skipPluginCheck = true)`),m.value="ready";return}if(!s){m.value="ready";return}const P=await C();if(console.log(`[withAsyncPlugin] 拦截检查 - ${o} 是否已注册:`,P),P||L.has(s)){m.value="ready",L.add(s),console.log("[withAsyncPlugin] 组件已注册,跳过安装流程");return}if(!I){console.warn(`[withAsyncPlugin] 无法获取 useESPlugin 实例,可能处于内置 AAR 环境或非插件环境,尝试直接渲染 ${o}`),m.value="ready";return}console.log(`[withAsyncPlugin] 开始动态安装插件: ${s}`);try{await new Promise((N,w)=>{let T;const $={onPluginInstallSuccess(E,G,O){E===s&&(clearTimeout(T),I.removeListener($),console.log(`[withAsyncPlugin] 安装成功 pkg=${E} 状态码=${G}`),G==1003||G==1001?(v?(console.log(`[withAsyncPlugin] 触发反射初始化: ${v}`),x.Native.callNative("EsNativeModule","callReflect",{entry:{from:v,method:"setup"}})):console.log("[withAsyncPlugin] 安装成功,跳过反射初始化(无 pluginInitClass)"),N()):w(new Error(`安装失败 pkg=${E} status=${G} msg=${O}`)))},onPluginInstallError(E,G,O){E===s&&(clearTimeout(T),I.removeListener($),w(new Error(`安装失败 pkg=${E} status=${G} msg=${O}`)))}};I.addListener({pkg:s},$),T=setTimeout(()=>{I.removeListener($),w(new Error(`插件安装超时: ${s}`))},8e3),typeof I.installPlugin=="function"?I.installPlugin({pkg:s}):typeof I.install=="function"?I.install(s):w(new Error("当前运行时不支持 install / installPlugin"))}),await i.nextTick(),L.add(s),m.value="ready"}catch(N){console.error("[withAsyncPlugin] 插件加载失败:",N),l.value=(N==null?void 0:N.message)||String(N),m.value="error"}};return i.onMounted(()=>{R()}),()=>{const P={display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",...y.style||{}};y.width!==void 0&&!P.width&&(P.width=typeof y.width=="number"?`${y.width}px`:y.width),y.height!==void 0&&!P.height&&(P.height=typeof y.height=="number"?`${y.height}px`:y.height);const N=y.class?`qt-plugin-container ${y.class}`:"qt-plugin-container",w={class:N,style:P,clipChildren:!1,clipPadding:!1,clipToPadding:!1};if(m.value==="loading")return i.h("div",w,[i.h("div",{style:{color:"white",fontSize:"30px"}},"插件加载中...")]);if(m.value==="error")return i.h("div",w,[i.h("div",{style:{color:"white",fontSize:"30px",backgroundColor:"rgba(255,0,0,0.5)"}},`插件加载失败: ${l.value}`)]);const T={},$={};for(const[k,D]of Object.entries(y))if(k.startsWith("on")&&typeof D=="function"){let F=k;k.startsWith("onOn")&&(F="on"+k.slice(4)),$[F]=D}else if(k.startsWith("on")&&Array.isArray(D)){let F=k;k.startsWith("onOn")&&(F="on"+k.slice(4)),$[F]=D}else k.startsWith("onOn")||(T[k]=D);const E={...T,...$,class:N,style:P,ref:k=>{a.value=k}},G=E.tabsData||"",O=E.actionPayload||"";return console.log("[withAsyncPlugin] 最终准备传递给 h() 的属性键集合:",Object.keys(E),"tabsData.length=",G.length,"actionPayload.length=",O.length),i.h(o,E,p.default?p.default():[])}}})}const X=Symbol("AddonEnvContext"),be={isPluginActive:!1,nameSuffix:"",pluginPackageName:"com.quicktvui.plugin.glintui",builtInVersions:{}};async function Pe(o="com.quicktvui.plugin.glintui",s="_Plugin"){const v=U.useES();let g={};try{const l=await x.Native.callNativeModule("AddonEnvModule","getBuiltInVersions",[]);l&&typeof l=="object"&&(g=l)}catch(l){console.warn("[AddonProvider] Failed to fetch built-in versions from AddonEnvModule",l)}const p=`QtGridTabs${s}`,y=v.isComponentRegistered(p),u=y instanceof Promise?await y:y,m={isPluginActive:u,nameSuffix:u?s:"",pluginPackageName:u?`${o}.ext`:o,builtInVersions:g};return console.info("[AddonProvider] Environment initialized:",m),m}let Y=i.ref(be);function he(o){Y.value=o,i.provide(X,Y)}function q(){var o;return((o=i.inject(X,Y))==null?void 0:o.value)||be}const pe={install:o=>{o.use(ce),o.use(ue),o.use(de),o.use(ve),o.use(ge)}};exports.ADDON_ENV_CONTEXT_KEY=X;exports.GridTabs=Q;exports.GridTabsPlugin=ce;exports.HsvBackground=J;exports.HsvBackgroundPlugin=ge;exports.Keyboard=j;exports.KeyboardPlugin=ue;exports.PortalItem=H;exports.PortalItemPlugin=ve;exports.PortalPool=z;exports.PortalPoolPlugin=de;exports.QuickTVUINAddons=pe;exports.QuickTVUINAddonsConfig=fe;exports.default=pe;exports.initAddonEnv=Pe;exports.provideAddonEnv=he;exports.useAddonEnv=q;exports.useGridTabs=me;exports.withAsyncPlugin=M;