1var t,e,i,n=t=>{throw TypeError(t)},a=(t,e,i)=>e.has(t)||n("Cannot "+i),s=(t,e,i)=>(a(t,e,"read from private field"),i?i.call(t):e.get(t)),r=(t,e,i)=>e.has(t)?n("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,i),l=(t,e,i,n)=>(a(t,e,"write to private field"),n?n.call(t,i):e.set(t,i),i);import{C as o}from"./bluetti.Component.DCUZfk5_.min.js";import{f as c}from"./bluetti.utils.BXYEwbPH.min.js";import"./bluetti.modulepreload-polyfill.YP0FEG5d.min.js";import{P as u,F as d}from"./bluetti.constants.DkBBy2jB.min.js";const h=window.Shopify||{},f=h.shop.split(".myshopify")[0],p=h.locale||"en";t=new WeakMap,e=new WeakMap,i=new WeakMap;const m=new class{constructor(n=u){r(this,t),r(this,e,null),r(this,i,null),l(this,t,new d(`${n}`)),s(this,t).setHeaders(this.getDefaultHeaders())}getDefaultHeaders(t=""){return{"Content-Type":"application/json",shop:f,language:p,...t&&{Authorization:`Bearer ${t}`}}}async getBuyGiftDetail(){s(this,e)&&s(this,e).abort("åæ¶ä¹åç getBuyGiftDetail 请æ±"),l(this,e,new AbortController);try{const{code:i,data:n}=await s(this,t).get("/activityapi/buygift/detail",{signal:s(this,e).signal});return 0!==i?null:n}catch(i){if("AbortError"===i.name)return null;throw i}}async postBuyGiftInfo(e){if(!e)throw new Error("请æ±ä½ä¸è½ä¸ºç©º");if("object"!=typeof e)throw new TypeError("请æ±ä½å¿
é¡»æ¯å¯¹è±¡ç±»å");s(this,i)&&s(this,i).abort("åæ¶ä¹åç postBuyGiftInfo 请æ±"),l(this,i,new AbortController);try{const{code:n,data:a}=await s(this,t).post("/activityapi/buygift/gifts",e,{signal:s(this,i).signal});return 0!==n?null:a}catch(n){if("AbortError"===n.name)return null;throw n}}};window.customElements.define("bluetti-buygift",class extends o{get bluettiCart(){return document.querySelector("#bluettiCart")}static get observedAttributes(){return["data-cart"]}
1async render(){var t,e,i,n;const{"data-cart":a}=this.props||{};if(!(null==(t=null==a?void 0:a.items)?void 0:t.length)||0===a.item_count)return void(this.innerHTML="");const s=await m.getBuyGiftDetail()||{status:0,detail:null};if(!s||1!==s.status)return this.innerHTML="",window.Shopify.disableCheckout=!1,void(null==(e=this.bluettiCart)||e.setCartStatus("loaded"));window.Shopify.disableCheckout=!0;const r=a.items.map(t=>({vId:t.variant_id,qty:t.quantity})),l=await m.postBuyGiftInfo({lineItems:r});if(!l||!Array.isArray(l.gifts)||0===l.gifts.length)return this.innerHTML="",window.Shopify.disableCheckout=!1,void(null==(i=this.bluettiCart)||i.setCartStatus("loaded"));const o=l.gifts.filter(t=>t.qty>0&&!t.insufficientStock).map(t=>this.generateGiftItemTemplate({...t,...s})).join("");this.innerHTML=o,null==(n=this.bluettiCart)||n.setCartStatus("loaded")}generateGiftItemTemplate(t){const{title:e,image:i,giftIcon:n,tag:a,qty:s,compareAtPrice:r}=t;return`\n <div class="relative rounded-2xl border !border-[#B8D7F7] bg-[#F0F7FD] p-6">\n <div class="flex items-center gap-4">\n <div class="aspect-[1/1] h-20 w-20 flex-shrink-0">\n <img src="${i}" alt="${e}" width="200" height="200" loading="lazy" class="w-full h-full object-cover">\n </div>\n\n <div class="flex-grow space-y-2">\n ${n&&""!==n&&a&&""!==a?`\n <div class="inline-flex items-center gap-0.5 rounded-md bg-primary-400 p-0.5 px-2 text-white">\n <div class="h-4 w-4 flex-shrink-0">\n <img\n class="h-full w-full object-cover"\n src="${n}"\n alt="${a}"\n width="24"\n height="24"\n loading="lazy"\n >\n </div>\n <span class="text-xs font-medium">${a}</span>\n </div>\n `:""}\n\n <h2 class="line-clamp-2 text-base font-semibold text-black">\n ${e}\n </h2>\n <div class="flex items-center justify-between gap-3">\n <span class="text-base text-neutral-500 line-through">\n ${c(100*r)}\n </span>\n <span class="text-base text-black"> x${s} </span>\n </div>\n </div>\n </div>\n </div>\n `}});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.