@snabcentr/vue-ui-lib 5.9.0 → 5.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- (function(j,W){typeof exports=="object"&&typeof module<"u"?W(exports,require("@snabcentr/common-lib"),require("lodash-es"),require("vue"),require("date-fns"),require("pinia"),require("naive-ui"),require("libphonenumber-js"),require("ts-case-convert"),require("vue-tel-input")):typeof define=="function"&&define.amd?define(["exports","@snabcentr/common-lib","lodash-es","vue","date-fns","pinia","naive-ui","libphonenumber-js","ts-case-convert","vue-tel-input"],W):(j=typeof globalThis<"u"?globalThis:j||self,W(j.SC_VueUiLib={},j["@snabcentr/common-lib"],j["lodash-es"],j.Vue,j["date-fns"],j.pinia,j["naive-ui"],j["libphonenumber-js"],j["ts-case-convert"],j["vue-tel-input"]))})(this,(function(j,W,V,t,Be,Pm,I,Br,Ns,Fm){"use strict";var ET=Object.defineProperty;var Tm=j=>{throw TypeError(j)};var RT=(j,W,V)=>W in j?ET(j,W,{enumerable:!0,configurable:!0,writable:!0,value:V}):j[W]=V;var B=(j,W,V)=>RT(j,typeof W!="symbol"?W+"":W,V),$m=(j,W,V)=>W.has(j)||Tm("Cannot "+V);var qt=(j,W,V)=>($m(j,W,"read from private field"),V?V.call(j):W.get(j)),Wl=(j,W,V)=>W.has(j)?Tm("Cannot add the same private member more than once"):W instanceof WeakSet?W.add(j):W.set(j,V),Em=(j,W,V,t)=>($m(j,W,"write to private field"),t?t.call(j,V):W.set(j,V),V);var qi,St,Cs;const Nr="Чтобы изменить, включите режим управления",Ts="Товар, который нужно предлагать клиенту",$s="Категория, которую нужно предлагать клиенту",Ft=class Ft{static init(e,i){Ft.messagesService&&Ft.notificationsService||(Ft.messagesService=e,Ft.notificationsService=i)}static getMessagesService(){if(!Ft.messagesService)throw new Error("UI provider is not initialized.");return Ft.messagesService}static getNotificationsService(){if(!Ft.notificationsService)throw new Error("UI provider is not initialized.");return Ft.notificationsService}static showNotificationsForErrorResponseData(e,i={}){var r,o;if(V.isEmpty(e.errors)){const s=(o=(r=e.rawError)==null?void 0:r.config)==null?void 0:o.url,a=s?` [ ${s} ]`:"";Ft.notificationsService?Ft.notificationsService.error({title:"Ошибка выполнения/обработки запроса",content:e.message,meta:`#${e.status}${a}: ${e.statusText}`,duration:3e3}):console.log("Show notification error response data: UI provider is not initialized.",e)}else{const s=[];for(const a in e.errors)Object.prototype.hasOwnProperty.call(i,a)?i[a]=new W.FieldValidationResultData(e.errors[a].toString(),"error"):s.push(e.errors[a].toString());Ft.showErrorMessages(s)}}static showErrorMessages(e){const{messagesService:i,notificationsService:r}=Ft;e.length===1&&i?i.error(e[0]):e.length>1&&r?r.error({title:"Ошибки выполнения запроса",meta:`Всего ошибок: ${e.length}`,content:()=>t.h("ul",{style:{maxHeight:"240px",overflowY:"auto",margin:0,paddingLeft:"1.25em",listStyleType:"disc"}},e.map(o=>t.h("li",o)))}):e.length>0&&console.log("Show notification error response data: UI provider is not initialized.",e)}};B(Ft,"messagesService"),B(Ft,"notificationsService");let Tr=Ft;const $r=new WeakMap,Vm=async n=>{const e=navigator.clipboard;if(e!=null&&e.writeText){await e.writeText(n);return}const i=document.createElement("textarea");i.value=n,i.style.position="fixed",i.style.opacity="0",document.body.append(i),i.select();const r=document.execCommand("copy");if(i.remove(),!r)throw new Error("Не удалось скопировать через execCommand.")},ql=async n=>{const e=V.isNil(n)?"":String(n);if(e)try{await Vm(e),Tr.getNotificationsService().success({title:"Готово",description:`Скопировано в буфер обмена: ${e}`,duration:2e3})}catch{Tr.getNotificationsService().error({title:"Ошибка",description:"Не удалось скопировать в буфер обмена.",duration:3e3})}},Mm=n=>n.tagName==="BUTTON"||n.getAttribute("role")==="button"||!!n.closest("button"),Im=(n,e)=>e.modifiers.click?"click":e.modifiers.dblclick?"dblclick":Mm(n)?"click":"dblclick",Xl={mounted(n,e){n.style.setProperty("cursor","pointer");const i=Im(n,e),r=o=>{var a;i==="dblclick"&&(o.preventDefault(),(a=globalThis.getSelection())==null||a.removeAllRanges());const s=$r.get(n);ql(s==null?void 0:s.value).catch(V.noop)};$r.set(n,{value:e.value,eventName:i,handler:r}),n.addEventListener(i,r)},updated(n,e){const i=$r.get(n);i&&(i.value=e.value)},beforeUnmount(n){const e=$r.get(n);e&&(n.removeEventListener(e.eventName,e.handler),$r.delete(n))}},Am=new Set(["checkbox","radio","range","button","submit","reset","file","color","image","hidden"]),Om=".n-base-selection, .n-date-picker, .n-time-picker, .n-color-picker",lo=new WeakMap,Yl=n=>!Am.has(n.type)&&!n.disabled&&!n.readOnly&&n.closest(Om)===null&&n.getClientRects().length>0,Ul=n=>{var a;if(n.key!=="Enter"&&n.code!=="Enter"||n.shiftKey||n.isComposing)return;const{target:e}=n;if(!(e instanceof HTMLInputElement)||!Yl(e))return;n.preventDefault();const i=n.currentTarget,r=[...i.querySelectorAll("input")].filter(l=>Yl(l)),o=r.indexOf(e);if(o===-1)return;const s=r.at(o+1);if(s){s.focus(),s.select();return}(a=lo.get(i))==null||a()},ai={mounted(n,e){lo.set(n,e.value),n.addEventListener("keydown",Ul)},updated(n,e){lo.set(n,e.value)},unmounted(n){n.removeEventListener("keydown",Ul),lo.delete(n)}};var ct=(n=>(n.NotInStock="not_in_stock",n.OnOrder="on_order",n.LargeOrder="large_order",n.NextDayDelivery="next_day_delivery",n))(ct||{});const Es={color:"#4b5563",backgroundColor:"#e5e7eb",textOnBackgroundColor:"#1f2937"},Kl=new Map([[W.OrderStatusEnum.New,{color:"#15803d",backgroundColor:"#bbf7d0",textOnBackgroundColor:"#166534"}],[W.OrderStatusEnum.Processing,{color:"#ea580c",backgroundColor:"#fed7aa",textOnBackgroundColor:"#9a3412"}],[W.OrderStatusEnum.AwaitingSupplyProducts,{color:"#ca8a04",backgroundColor:"#fef08a",textOnBackgroundColor:"#854d0e"}],[W.OrderStatusEnum.InvoiceIssued,{color:"#1d4ed8",backgroundColor:"#bfdbfe",textOnBackgroundColor:"#1e40af"}],[W.OrderStatusEnum.ProcessingOnStock,{color:"#0e7490",backgroundColor:"#a5f3fc",textOnBackgroundColor:"#155e75"}],[W.OrderStatusEnum.OrderUpdated,{color:"#6d28d9",backgroundColor:"#ddd6fe",textOnBackgroundColor:"#5b21b6"}],[W.OrderStatusEnum.Finished,{color:"#475569",backgroundColor:"#e2e8f0",textOnBackgroundColor:"#1e293b"}],[W.OrderStatusEnum.Canceled,{color:"#b91c1c",backgroundColor:"#fecaca",textOnBackgroundColor:"#991b1b"}],[W.OrderStatusEnum.Error,{color:"#991b1b",backgroundColor:"#fca5a5",textOnBackgroundColor:"#7f1d1d"}]]),ki=n=>Kl.get(n)??Es,Gl=n=>{const e=ki(n);return{color:e.backgroundColor,textColor:e.textOnBackgroundColor,borderColor:e.color}},Zl=n=>{const e=ki(n);return{"--sc-order-status-color":e.color,"--sc-order-status-bg":e.backgroundColor,"--sc-order-status-text":e.textOnBackgroundColor}},Rs=new Map([[ct.NotInStock,{color:"#ef4444",backgroundColor:"#f7ff00",textOnBackgroundColor:"#ff0000"}],[ct.OnOrder,{color:"#ca8a04",backgroundColor:"#f7ff00",textOnBackgroundColor:"#ff0000"}],[ct.LargeOrder,{color:"#ef2929",backgroundColor:"#ef2929",textOnBackgroundColor:"#ffffff"}],[ct.NextDayDelivery,{color:"#ef2929",backgroundColor:"#ef2929",textOnBackgroundColor:"#ffffff"}]]),Ql=new Map([[ct.NotInStock,"Нет в наличии"],[ct.OnOrder,"Под заказ"],[ct.LargeOrder,"Крупный заказ"],[ct.NextDayDelivery,"Доставка на завтра"]]),co=[...Rs.keys()],Er=n=>Rs.get(n)??Es,Ps=n=>Ql.get(n)??n,Fs=n=>{const e=[];return n.isNotInStock&&e.push(ct.NotInStock),n.isOnOrder&&e.push(ct.OnOrder),n.isLargeOrder&&e.push(ct.LargeOrder),!V.isNil(n.delivery.date)&&Be.isTomorrow(new Date(n.delivery.date))&&e.push(ct.NextDayDelivery),e};var Ie=(n=>(n.AttachedUser="attached_user",n.ClientInfo="client_info",n.ClientInfoShort="client_info_short",n.CreatedAt="created_at",n.ClientCity="client_city",n.DeliveryInfo="delivery_info",n.DeliveryDate="delivery_date",n.Id="id",n.PaymentType="payment_type",n.SalesDirections="sales_directions",n.Status="status",n.actions="actions",n))(Ie||{}),Xe=(n=>(n.phone="phone",n.tablet="tablet",n.laptop="laptop",n))(Xe||{});const Ct=class Ct{static init(){Ct.isInitialized||(Ct.isInitialized=!0,Ct.windowResizeHandler(),window.addEventListener("resize",Ct.windowResizeHandler))}static destroy(){window.removeEventListener("resize",Ct.windowResizeHandler),Ct.isInitialized=!1}static getDeviceTypeByResolution(){const e=W.useBaseConfigStateStore().config.deviceTypeByResolution;return window.innerWidth<e.tablet?Xe.phone:window.innerWidth<e.laptop?Xe.tablet:Xe.laptop}static initRefDependingOnDeviceResolution(e,i,r){const o=t.ref(r);return Ct.setRefValueDependingOnDeviceResolution(o,e,i,r),Ct.refsDependingOnDeviceResolution.push({r:o,phoneValue:e,tabletValue:i,defaultValue:r}),o}static isPhoneDevice(){return Ct.getDeviceTypeByResolution()===Xe.phone}static isTabletDevice(){return Ct.getDeviceTypeByResolution()===Xe.tablet}static isLaptopDevice(){return Ct.getDeviceTypeByResolution()===Xe.laptop}static setRefValueDependingOnDeviceResolution(e,i,r,o){switch(Ct.getDeviceTypeByResolution()){case Xe.phone:e.value=i;break;case Xe.tablet:e.value=r;break;default:e.value=o;break}}static windowResizeHandler(){V.forEach(Ct.refsDependingOnDeviceResolution,e=>{Ct.setRefValueDependingOnDeviceResolution(e.r,e.phoneValue,e.tabletValue,e.defaultValue)})}};B(Ct,"isInitialized",!1),B(Ct,"refsDependingOnDeviceResolution",[]);let Ue=Ct;function Jl(){try{return Ue.getDeviceTypeByResolution()}catch(n){return console.error(n),Xe.laptop}}function zm(){const n=t.ref(Jl()),e=t.computed(()=>n.value===Xe.phone||n.value===Xe.tablet),i=()=>{n.value=Jl()};return t.onMounted(()=>{window.addEventListener("resize",i)}),t.onUnmounted(()=>{window.removeEventListener("resize",i)}),{isCompactLayout:e}}const Dm="(hover: hover) and (pointer: fine)",uo=()=>{const n=V.isFunction(globalThis.matchMedia)?globalThis.matchMedia(Dm):void 0,e=t.ref(n?n.matches:!0),i=r=>{e.value=r.matches};return n==null||n.addEventListener("change",i),t.onScopeDispose(()=>{n==null||n.removeEventListener("change",i)},!0),t.readonly(e)};class Vs{static getLabel(e){switch(e){case W.AddressQualityEnum.Incomplete:return"Неполный адрес";case W.AddressQualityEnum.Undetermined:return"Полнота адреса не определена";default:return}}}const Lm=".sc-versions-list";function Hm(n,e,i){const r=document.querySelectorAll(Lm);if(r.length===0)return;const o=r[0],s=`${n}:`;if(V.some(o.querySelectorAll("li"),l=>V.startsWith(V.trim(l.textContent||""),s)))return;const a=document.createElement("li");a.append(document.createTextNode(`${s} ${e} от ${Be.format(i,"dd.MM.yyyy")}`)),o.append(a)}class Ci{static isVnodeEmpty(e){return e.every(i=>i.type===t.Comment||i.type===t.Text&&V.isString(i.children)&&!i.children.trim()?!0:i.type===t.Fragment&&Ci.isVnodeEmpty(i.children))}static hasSlotContent(e){return e?!Ci.isVnodeEmpty(e()):!1}}class ir{static getDefaultCurrency(){var i;if(!Pm.getActivePinia())return;const e=W.useBaseConfigStateStore().getConfig().defaultCurrency;return(i=W.useReferencesStore().currencyReference)==null?void 0:i.find(r=>r.signature===e)}static getPrecision(e){var i;return(e==null?void 0:e.precision)??((i=ir.getDefaultCurrency())==null?void 0:i.precision)}}const Wm={readAsFileData(n){return new Promise((e,i)=>{const r=new FileReader;r.addEventListener("load",()=>{e({name:n.name,content:r.result})}),r.addEventListener("error",()=>{i(new Error(`Не удалось прочитать файл «${n.name}».`))}),r.readAsDataURL(n)})}};class li{static isDeleted(e){return!!(e.deletedAt&&!Be.isFuture(e.deletedAt))}static getFormatEntityName(e){return li.isDeleted(e)?`${e.name} (Удалён)`:e.name}}const ft=(n,e=!1)=>{const{key:i}=n;if(!["Backspace","Delete","Tab","Escape","Enter","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(i)&&!((n.ctrlKey||n.metaKey)&&["a","c","v","x","z","ф","с","м","ч","я"].includes(i.toLowerCase()))){if(e&&i==="-"){const r=n.target;if((r.selectionStart??0)===0&&!r.value.includes("-"))return}/^\d$/.test(i)||n.preventDefault()}},fo=(n,e=".",i=!1)=>{const{key:r}=n,o=n.target;["Backspace","Delete","Tab","Escape","Enter","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(r)||(n.ctrlKey||n.metaKey)&&["a","c","v","x","z","ф","с","м","ч","я"].includes(r.toLowerCase())||i&&r==="-"&&!o.value.includes("-")&&((o.selectionStart??0)===0||o.value.length===0)||(r===e||r===(e==="."?",":"."))&&!o.value.includes(e)&&!o.value.includes(e==="."?",":".")||/^\d$/.test(r)||n.preventDefault()},ht=n=>n?Number.parseFloat(n.replace(",",".")):null,dt=(n,e)=>{n[e]={}},He=n=>{const e=n.target;setTimeout(()=>{e.select()},100)},Ye=class Ye{static getDecimalsCount(e){if(!Number.isFinite(e)||Number.isInteger(e))return 0;const[i,r]=V.split(e.toString(),"e"),o=V.split(i,"."),s=o.length>1?o[1].length:0;return Math.max(s-(Number(r)||0),0)}static normalize(e){return Number.isFinite(e)?Number(e.toPrecision(Ye.significantDigits)):e}static multiplyByStep(e,i){return V.round(e*i,Ye.getDecimalsCount(i)+Ye.getDecimalsCount(e))}static divideByStep(e,i){return Ye.normalize(e/i)}static isMultipleOf(e,i){const r=e/i;return Math.abs(r-Math.round(r))<Ye.epsilon}static isLessOrEqual(e,i){return e<=i+Ye.epsilon}static roundCoordinate(e){return V.round(e,Ye.coordinateFractionDigits)}static roundMoney(e,i=ir.getPrecision()){return i===void 0?Ye.normalize(e):V.round(e,i)}static floorMoney(e,i=ir.getPrecision()){return i===void 0?Ye.normalize(e):V.floor(e,i)}static roundPercent(e,i=Ye.percentFractionDigits){return V.round(e,i)}static formatMoney(e,i=ir.getPrecision()){let r=Ye.moneyFormatters.get(i);return r||(r=new Intl.NumberFormat("ru-RU",{style:"decimal",minimumFractionDigits:i,maximumFractionDigits:i}),Ye.moneyFormatters.set(i,r)),r.format(Ye.normalize(e))}static formatPercent(e,i=Ye.percentDisplayFractionDigits){return new Intl.NumberFormat("ru-RU",{style:"decimal",maximumFractionDigits:i}).format(e)}static formatArea(e){return Ye.areaFormatter.format(e)}};B(Ye,"percentFractionDigits",5),B(Ye,"percentDisplayFractionDigits",2),B(Ye,"areaFractionDigits",4),B(Ye,"coordinateFractionDigits",6),B(Ye,"significantDigits",12),B(Ye,"epsilon",1e-6),B(Ye,"moneyFormatters",new Map),B(Ye,"areaFormatter",new Intl.NumberFormat("ru-RU",{style:"decimal",maximumFractionDigits:Ye.areaFractionDigits}));let Ve=Ye;function ec(n){return n.itemCount&&n.itemCount>0?`Всего ${n.itemCount} записей`:""}class wt{static convertReferencesToOptionsList(e,i=!1,r=!1,o=!1,s=void 0,a=void 0){let l=e.map(c=>({label:s?s(c):li.getFormatEntityName(c),value:c.id,item:c,disabled:a?a(c):!1}));return i&&(l=l.map(c=>`${c.label}-[${c.value}]`).sort().map(c=>l.find(d=>c===`${d.label}-[${d.value}]`))),r===!1?[...o?[{label:"",value:-1,disabled:!0}]:[],...l]:[...o?[{type:"group",label:"-",key:"default_group",children:[{label:"-- Отсутствует --",value:-1,disabled:!0}]}]:[],...Object.values(V.groupBy(l,r.key)).filter(c=>c.length>0).map(c=>{const d=c[0],u=V.isString(r.key)?V.get(d,r.key):r.key(c),f=V.isString(r.label)?V.get(d,r.label):r.label(c);return{type:"group",label:V.isEmpty(f)?"- Не определено -":f,key:`group_${u}`,children:c}})]}static convertReferencesToSelectOptionsList(e,i=!1,r=!1,o=!1,s=void 0,a=void 0){return wt.convertReferencesToOptionsList(e,i,r,o,s,a)}static convertReferencesToAutocompleteOptionsList(e,i=!1,r=!1,o=!1,s=void 0,a=void 0){return wt.convertReferencesToOptionsList(e,i,r,o,s,a)}}const jm={required:{required:!0,type:"any",trigger:["blur","input"],message:"Это поле обязательно для заполнения"}},ce={required:{type:"number",required:!0,trigger:["blur","input"],message:"Это поле обязательно для заполнения"},min(n){return{type:"number",min:n,trigger:["blur","input"],message:`Минимальное значение: ${n}`}},max(n){return{type:"number",max:n,trigger:["blur","input"],message:`Максимальное значение: ${n}`}},step(n){return{type:"number",trigger:["blur","input"],validator:(e,i)=>i===null||Ve.isMultipleOf(i,n)?!0:new Error(`Значение должно быть кратно ${n}`)}}},qm={required:{required:!0,type:"date",trigger:["blur","input"],message:"Это поле обязательно для заполнения"}},We={serverValidation(n){return{validator:(e,i)=>i===null?!0:n?new Error(n):!0}}},Ms=n=>{var e;return((e=n.properties)==null?void 0:e.files)??[]},tc=n=>{var e,i;return!!((e=n.properties)!=null&&e.description)||!!((i=n.properties)!=null&&i.specification)||Ms(n).length>0},ji=class ji{static isM2Category(e){var i;return((i=e.properties)==null?void 0:i.allowSetM2ClientPrice)??!1}static findReferenceProduct(e){var i;return(i=e.products)==null?void 0:i.find(r=>{var o,s,a;return((o=r.category)==null?void 0:o.id)===e.id&&(!!((s=r.properties)!=null&&s.length)||!!((a=r.properties)!=null&&a.width))})}static getSquare(e){var i,r;return(((i=e.properties)==null?void 0:i.width)??ji.defaultLinearSizeMm)*(((r=e.properties)==null?void 0:r.length)??ji.defaultLinearSizeMm)/1e6}static toM2Cost(e,i){return e/ji.getSquare(i)}static calculateM2Cost(e,i,r){var s,a;const o=V.isNil(i)?e.retailCost??e.cost:(a=(s=e.priceCoefficients)==null?void 0:s.find(l=>l.coefficient.id===i.id))==null?void 0:a.cost;return V.isNil(o)?void 0:ji.toM2Cost(o*(1+(r??0)/100),e)}};B(ji,"defaultLinearSizeMm",1e3);let vi=ji;const Xm={},Ym=t.defineComponent({...Xm,__name:"button-with-confirm-action",props:{disabled:{type:Boolean,default:!1},dialogTitle:{default:""},dialogContent:{default:""},disableConfirm:{type:Boolean,default:!1},popoverText:{default:""},type:{default:"default"},size:{default:"small"},quaternary:{type:Boolean,default:!1},circle:{type:Boolean,default:!1},ghost:{type:Boolean,default:!1},loading:{type:Boolean,default:!1}},emits:["accept"],setup(n,{emit:e}){const i=n,r=e,o=t.ref(!1),s=()=>{r("accept",()=>{o.value=!1})},a=()=>{i.disableConfirm?s():o.value=!0};return(l,c)=>{const d=I.NButton,u=I.NPopover,f=I.NModal;return t.openBlock(),t.createElementBlock("div",null,[t.createVNode(u,{disabled:n.popoverText.length===0,placement:"bottom"},{trigger:t.withCtx(()=>[t.createVNode(d,{disabled:n.disabled,ghost:n.ghost,loading:n.loading,size:n.size,type:n.type,quaternary:n.quaternary,circle:n.circle,onClick:a},{default:t.withCtx(()=>[t.renderSlot(l.$slots,"default")]),_:3},8,["disabled","ghost","loading","size","type","quaternary","circle"])]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(n.popoverText),1)]),_:3},8,["disabled"]),t.createVNode(f,{show:o.value,"onUpdate:show":c[1]||(c[1]=h=>o.value=h),content:n.dialogContent,closable:!1,"mask-closable":!1,"show-icon":!1,title:n.dialogTitle,"action-class":"",preset:"dialog"},{action:t.withCtx(()=>[t.createVNode(d,{type:"primary",class:"px-8",onClick:s},{default:t.withCtx(()=>[...c[2]||(c[2]=[t.createTextVNode(" Да ",-1)])]),_:1}),t.createVNode(d,{type:"default",onClick:c[0]||(c[0]=h=>o.value=!1)},{default:t.withCtx(()=>[...c[3]||(c[3]=[t.createTextVNode(" Отмена ",-1)])]),_:1})]),_:1},8,["show","content","title"])])}}}),Um={class:"flex gap-2 overflow-x-auto max-sm:flex-nowrap sm:flex-wrap sm:overflow-visible"},Km={},Gm=t.defineComponent({...Km,__name:"chip-group",props:{items:{},modelValue:{}},emits:["update:modelValue"],setup(n,{emit:e}){const i=e;return(r,o)=>(t.openBlock(),t.createElementBlock("div",Um,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.items,s=>(t.openBlock(),t.createBlock(t.unref(I.NButton),{key:s.key,class:"shrink-0",round:"",size:"small",type:n.modelValue===s.key?"primary":"default",onClick:a=>i("update:modelValue",s.key)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(s.label),1)]),_:2},1032,["type","onClick"]))),128))]))}}),Zm={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Qm(n,e){return t.openBlock(),t.createElementBlock("svg",Zm,[...e[0]||(e[0]=[t.createElementVNode("circle",{cx:"256",cy:"256",r:"48",fill:"currentColor"},null,-1),t.createElementVNode("circle",{cx:"256",cy:"416",r:"48",fill:"currentColor"},null,-1),t.createElementVNode("circle",{cx:"256",cy:"96",r:"48",fill:"currentColor"},null,-1)])])}const Is=t.markRaw({name:"ion-ellipsis-vertical-sharp",render:Qm}),Jm={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function ep(n,e){return t.openBlock(),t.createElementBlock("svg",Jm,[...e[0]||(e[0]=[t.createElementVNode("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[t.createElementVNode("path",{d:"M7 7H6a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2-2v-1"}),t.createElementVNode("path",{d:"M20.385 6.585a2.1 2.1 0 0 0-2.97-2.97L9 12v3h3zM16 5l3 3"})],-1)])])}const nc=t.markRaw({name:"tabler-edit",render:ep}),tp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function np(n,e){return t.openBlock(),t.createElementBlock("svg",tp,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M258.9 48C141.92 46.42 46.42 141.92 48 258.9c1.56 112.19 92.91 203.54 205.1 205.1c117 1.6 212.48-93.9 210.88-210.88C462.44 140.91 371.09 49.56 258.9 48m-16.79 192.47l51.55-59a16 16 0 0 1 24.1 21.06l-51.55 59a16 16 0 1 1-24.1-21.06m-38.86 90.85a16 16 0 0 1-22.62 0l-47.95-48a16 16 0 1 1 22.64-22.62l48 48a16 16 0 0 1-.07 22.62m176.8-128.79l-111.88 128a16 16 0 0 1-11.51 5.47h-.54a16 16 0 0 1-11.32-4.69l-47.94-48a16 16 0 1 1 22.64-22.62l29.8 29.83a8 8 0 0 0 11.68-.39l95-108.66a16 16 0 0 1 24.1 21.06Z"},null,-1)])])}const ic=t.markRaw({name:"ion-checkmark-done-circle",render:np}),ip={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function rp(n,e){return t.openBlock(),t.createElementBlock("svg",ip,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32",d:"M448 256c0-106-86-192-192-192S64 150 64 256s86 192 192 192s192-86 192-192Z"},null,-1),t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M368 192L256.13 320l-47.95-48m-16.23 48L144 272m161.71-80l-51.55 59"},null,-1)])])}const rc=t.markRaw({name:"ion-checkmark-done-circle-outline",render:rp}),op={viewBox:"0 0 32 32",width:"1.2em",height:"1.2em"};function sp(n,e){return t.openBlock(),t.createElementBlock("svg",op,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M22.15 3.237c-1.93-1.93-5.185-1.403-6.406 1.04l-3.175 6.35a1.5 1.5 0 0 1-.868.752L6.72 13.04a2 2 0 0 0-.782 3.312l4.149 4.149L4 26.586v1.415h1.414l6.086-6.086l4.149 4.149a2 2 0 0 0 3.311-.782l1.661-4.983a1.5 1.5 0 0 1 .752-.867l6.351-3.175c2.442-1.222 2.97-4.476 1.04-6.407zM17.533 5.17a2 2 0 0 1 3.203-.52l6.614 6.614a2 2 0 0 1-.52 3.203l-6.351 3.175a3.5 3.5 0 0 0-1.755 2.024l-1.661 4.982l-9.712-9.711l4.983-1.661a3.5 3.5 0 0 0 2.024-1.755z"},null,-1)])])}const ap=t.markRaw({name:"fluent-pin32-regular",render:sp}),lp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function cp(n,e){return t.openBlock(),t.createElementBlock("svg",lp,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M255.66 112c-77.94 0-157.89 45.11-220.83 135.33a16 16 0 0 0-.27 17.77C82.92 340.8 161.8 400 255.66 400c92.84 0 173.34-59.38 221.79-135.25a16.14 16.14 0 0 0 0-17.47C428.89 172.28 347.8 112 255.66 112"},null,-1),t.createElementVNode("circle",{cx:"256",cy:"256",r:"80",fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32"},null,-1)])])}const dp=t.markRaw({name:"ion-eye-outline",render:cp}),up={viewBox:"0 0 32 32",width:"1.2em",height:"1.2em"};function fp(n,e){return t.openBlock(),t.createElementBlock("svg",up,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M15.744 4.276c1.221-2.442 4.476-2.97 6.406-1.04l6.614 6.614c1.93 1.93 1.402 5.186-1.04 6.406l-6.35 3.176a1.5 1.5 0 0 0-.753.867l-1.66 4.983a2 2 0 0 1-3.312.782l-4.149-4.15l-6.086 6.087H4v-1.415l6.086-6.085l-4.149-4.15a2 2 0 0 1 .782-3.31l4.982-1.662a1.5 1.5 0 0 0 .868-.752z"},null,-1)])])}const hp=t.markRaw({name:"fluent-pin32-filled",render:fp}),mp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function pp(n,e){return t.openBlock(),t.createElementBlock("svg",mp,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M352 48H160a48 48 0 0 0-48 48v368l144-128l144 128V96a48 48 0 0 0-48-48"},null,-1)])])}const gp=t.markRaw({name:"ion-bookmark-outline",render:pp}),yp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function bp(n,e){return t.openBlock(),t.createElementBlock("svg",yp,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"m63.998 86.005l21.998-21.998L447.999 426.01l-21.998 21.998zM259.34 192.09l60.57 60.57a64.07 64.07 0 0 0-60.57-60.57m-6.68 127.82l-60.57-60.57a64.07 64.07 0 0 0 60.57 60.57"},null,-1),t.createElementVNode("path",{fill:"currentColor",d:"M256 352a96 96 0 0 1-92.6-121.34l-69.07-69.08C66.12 187.42 39.24 221.14 16 256c26.42 44 62.56 89.24 100.2 115.18C159.38 400.92 206.33 416 255.76 416A233.5 233.5 0 0 0 335 402.2l-53.61-53.6A95.8 95.8 0 0 1 256 352m0-192a96 96 0 0 1 92.6 121.34L419.26 352c29.15-26.25 56.07-61.56 76.74-96c-26.38-43.43-62.9-88.56-101.18-114.82C351.1 111.2 304.31 96 255.76 96a222.9 222.9 0 0 0-78.21 14.29l53.11 53.11A95.8 95.8 0 0 1 256 160"},null,-1)])])}const _p=t.markRaw({name:"ion-eye-off-sharp",render:bp}),wp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function xp(n,e){return t.openBlock(),t.createElementBlock("svg",wp,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"48",d:"m184 112l144 144l-144 144"},null,-1)])])}const kp=t.markRaw({name:"ion-chevron-forward-outline",render:xp}),Cp=["data-name"],vp={class:"sc-collapse-item-header flex flex-row gap-2.5"},Sp={class:"sc-collapse-item-arrow flex-none cursor-pointer pt-1.5"},Bp={key:0},Np={class:"sc-collapse-item-pre-arrow flex flex-none flex-row gap-1"},Tp={class:"flex flex-1 flex-col"},$p={key:0,class:"sc-collapse-item-sub-title flex-1"},Ep={key:1,class:"sc-collapse-item-title-extra flex-none"},Rp={key:0,class:"sc-collapse-item-content"},Pp={},Fp=t.defineComponent({...Pp,__name:"collapse-item",props:{name:{default:""},title:{default:""},disabled:{type:Boolean,default:!1}},emits:["header:click"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.inject("itemHeaderClickHandler",V.noop),a=t.inject("defaultExpandedNames",[]),l=t.inject("expandedNames",[]),c=V.some(a,g=>g===r.name),d=t.computed(()=>V.some(l,g=>g===r.name)),u=t.ref(c),f=()=>{r.disabled||(u.value=d.value||!u.value,o("header:click",r.name,u.value),s(r.name,u.value))};return e({expand:()=>{!r.disabled&&!u.value&&(u.value=!0,o("header:click",r.name,u.value),s(r.name,u.value))},toggle:()=>{r.disabled||f()},collapse:()=>{!r.disabled&&u.value&&!d.value&&(u.value=!1,o("header:click",r.name,u.value),s(r.name,u.value))},expanded:t.readonly(u)}),(g,b)=>{const y=kp;return t.openBlock(),t.createElementBlock("div",{"data-name":n.name,class:t.normalizeClass([{"cursor-not-allowed text-gray-400":n.disabled},"sc-collapse-item flex flex-col p-2"])},[t.createElementVNode("div",vp,[t.createElementVNode("div",Sp,[t.createElementVNode("div",{class:t.normalizeClass({"rotate-90":u.value}),onClick:f},[t.renderSlot(g.$slots,"arrow",{},()=>[t.createVNode(y)],!0)],2)]),t.unref(Ci).hasSlotContent(g.$slots["pre-arrow"])?(t.openBlock(),t.createElementBlock("div",Bp,[t.createElementVNode("div",Np,[t.renderSlot(g.$slots,"pre-arrow",{},void 0,!0)])])):t.createCommentVNode("",!0),t.createElementVNode("div",Tp,[t.createElementVNode("div",{class:"sc-collapse-item-title flex flex-1 cursor-pointer flex-col text-lg font-semibold",onClick:f},[t.renderSlot(g.$slots,"header",{},()=>[t.createTextVNode(t.toDisplayString(n.title),1)],!0)]),t.unref(Ci).hasSlotContent(g.$slots["sub-header"])?(t.openBlock(),t.createElementBlock("div",$p,[t.renderSlot(g.$slots,"sub-header",{},void 0,!0)])):t.createCommentVNode("",!0)]),t.unref(Ci).hasSlotContent(g.$slots["header-extra"])?(t.openBlock(),t.createElementBlock("div",Ep,[t.renderSlot(g.$slots,"header-extra",{},void 0,!0)])):t.createCommentVNode("",!0)]),t.createVNode(t.Transition,{name:"fade"},{default:t.withCtx(()=>[d.value||u.value?(t.openBlock(),t.createElementBlock("div",Rp,[t.renderSlot(g.$slots,"default",{},void 0,!0)])):t.createCommentVNode("",!0)]),_:3})],10,Cp)}}}),gn=(n,e)=>{const i=n.__vccOpts||n;for(const[r,o]of e)i[r]=o;return i},oc=gn(Fp,[["__scopeId","data-v-22a74c45"]]),Vp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Mp(n,e){return t.openBlock(),t.createElementBlock("svg",Vp,[...e[0]||(e[0]=[t.createElementVNode("circle",{cx:"176",cy:"416",r:"16",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),t.createElementVNode("circle",{cx:"400",cy:"416",r:"16",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M48 80h64l48 272h256"},null,-1),t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M160 288h249.44a8 8 0 0 0 7.85-6.43l28.8-144a8 8 0 0 0-7.85-9.57H128"},null,-1)])])}const sc=t.markRaw({name:"ion-cart-outline",render:Mp}),Rr=Symbol(),Ip={Button:{border:"1px solid grey"},Card:{paddingMedium:"1rem"},Checkbox:{border:"1px solid rgb(12, 88, 32)"},Common:{borderRadius:"0.5rem",borderRadiusSmall:"0.25rem",fontWeight:"500",fontWeightStrong:"600",fontSize:"0.75rem",fontSizeMedium:"0.75rem",fontSizeLarge:"0.8125rem",lineHeight:"1.25rem",heightSmall:"24px",heightMedium:"30px",heightTiny:"20px",heightLarge:"36px",heightHuge:"42px",primaryColor:"#FFCC40FF",primaryColorHover:"#FFE49BFF",primaryColorPressed:"#FFBB00FF",primaryColorSuppl:"#FCC42AFF",successColor:"#4AC99BFF",successColorHover:"#4AC99BBF",successColorPressed:"#21AA78FF",errorColor:"#F45725FF",errorColorHover:"#F4572599",textColorBase:"#191C30E5",textColorDisabled:"#191C30E5"},DataTable:{borderColor:"rgb(207, 207, 207)",lineHeight:1.4,tdColorHover:"rgb(250,250,250)",thColor:"rgb(231, 231, 231)",thFontWeight:400,thPaddingMedium:"8px",tdPaddingMedium:"8px",thTextColor:"rgb(22, 0, 108)"},Drawer:{closeIconColor:"rgba(31, 34, 37, 1)",closeIconColorHover:"rgba(10, 157, 5, 1)"},Form:{marginBottom:0,lineHeight:1,labelFontSizeTopMedium:"0.75rem",labelHeightMedium:"20px",labelFontWeight:500,labelTextColor:"rgba(27, 31, 59, 0.65)",labelPaddingVertical:"0",labelPaddingHorizontal:"0"},Input:{paddingMedium:"0.5rem",fontSizeMedium:"0.9125rem",lineHeight:"1.25rem",lineHeightTextarea:"1.25rem",border:"1px solid #E0E0E0",borderRadius:"0.5rem",iconSize:"1,125rem"},Tabs:{tabFontSizeMedium:"0.9375rem",tabColorSegment:"#FFCC40FF",tabBorderColor:"#CCCCCCFF"}},Ap={class:"flex flex-col-reverse gap-2.5 sm:flex-row"},Op={class:"inline-flex"},zp={},ac=t.defineComponent({...zp,__name:"product-actions",props:{eventEmitter:{},showProductAddToCartButton:{type:[Boolean,String,Function],default:!1},showProductEditButton:{type:[Boolean,String,Function],default:!1},showProductRequiredButton:{type:[Boolean,String,Function],default:!1},productContextButtonsConfig:{type:Function,default:void 0},product:{}},setup(n){const e=n,i=t.inject(Rr,"medium"),r=uo(),o=t.computed(()=>V.isFunction(e.showProductAddToCartButton)?e.showProductAddToCartButton(e.product):e.showProductAddToCartButton),s=t.computed(()=>V.isFunction(e.showProductEditButton)?e.showProductEditButton(e.product):e.showProductEditButton),a=t.computed(()=>V.isFunction(e.showProductRequiredButton)?e.showProductRequiredButton(e.product):e.showProductRequiredButton),l=t.computed(()=>a.value==="disabled"?`${Ts}. ${Nr}`:Ts),c=t.computed(()=>V.isNil(e.productContextButtonsConfig)?[]:V.isFunction(e.productContextButtonsConfig)?e.productContextButtonsConfig(e.product):e.productContextButtonsConfig),d=()=>{e.eventEmitter.emit("product:add-to-cart",{product:e.product})},u=()=>{e.eventEmitter.emit("product:edit",{product:e.product})},f=()=>{e.eventEmitter.emit("product:required",{product:e.product})},h=p=>{e.eventEmitter.emit("product:context-select",{product:e.product,key:p})};return(p,m)=>{var k;const g=rc,b=ic,y=I.NButton,_=I.NTooltip,x=nc,w=sc,C=Is,N=I.NDropdown;return t.openBlock(),t.createElementBlock("div",Ap,[a.value?(t.openBlock(),t.createBlock(_,{key:0,placement:"bottom",trigger:"hover",disabled:!t.unref(r)},{trigger:t.withCtx(()=>[t.createElementVNode("span",Op,[t.createVNode(y,{ghost:!0,size:t.unref(i),disabled:a.value==="disabled",type:n.product.isRequired?"primary":"default",onClick:f},{default:t.withCtx(()=>[n.product.isRequired?(t.openBlock(),t.createBlock(b,{key:1})):(t.openBlock(),t.createBlock(g,{key:0}))]),_:1},8,["size","disabled","type"])])]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(l.value),1)]),_:1},8,["disabled"])):t.createCommentVNode("",!0),s.value?(t.openBlock(),t.createBlock(_,{key:1,placement:"bottom",trigger:"hover",disabled:!t.unref(r)},{trigger:t.withCtx(()=>[t.createVNode(y,{ghost:!0,size:t.unref(i),type:"primary",disabled:s.value==="disabled",onClick:u},{default:t.withCtx(()=>[t.createVNode(x)]),_:1},8,["size","disabled"])]),default:t.withCtx(()=>[m[0]||(m[0]=t.createTextVNode(" Редактировать ",-1))]),_:1},8,["disabled"])):t.createCommentVNode("",!0),o.value?(t.openBlock(),t.createBlock(_,{key:2,placement:"bottom",trigger:"hover",disabled:!t.unref(r)},{trigger:t.withCtx(()=>[t.createVNode(y,{ghost:!0,size:t.unref(i),disabled:o.value==="disabled",type:"primary",onClick:d},{default:t.withCtx(()=>[t.createVNode(w)]),_:1},8,["size","disabled"])]),default:t.withCtx(()=>[m[1]||(m[1]=t.createTextVNode(" Добавить в корзину ",-1))]),_:1},8,["disabled"])):t.createCommentVNode("",!0),((k=c.value)==null?void 0:k.length)>0?(t.openBlock(),t.createBlock(N,{key:3,options:c.value,size:t.unref(i),trigger:"click",onSelect:h},{default:t.withCtx(()=>[t.createVNode(y,{ghost:!0,size:t.unref(i),type:"primary"},{default:t.withCtx(()=>[t.createVNode(C)]),_:1},8,["size"])]),_:1},8,["options","size"])):t.createCommentVNode("",!0)])}}}),Dp={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Lp(n,e){return t.openBlock(),t.createElementBlock("svg",Dp,[...e[0]||(e[0]=[t.createElementVNode("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[t.createElementVNode("path",{d:"M12 8v4l2 2"}),t.createElementVNode("path",{d:"M3.05 11a9 9 0 1 1 .5 4m-.5 5v-5h5"})],-1)])])}const Hp=t.markRaw({name:"tabler-history",render:Lp}),Wp={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function jp(n,e){return t.openBlock(),t.createElementBlock("svg",Wp,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"m18.5 3.5l2 2l-15 15l-2-2zM7 4c1.66 0 3 1.34 3 3s-1.34 3-3 3s-3-1.34-3-3s1.34-3 3-3m10 10c1.66 0 3 1.34 3 3s-1.34 3-3 3s-3-1.34-3-3s1.34-3 3-3M7 6c-.55 0-1 .45-1 1s.45 1 1 1s1-.45 1-1s-.45-1-1-1m10 10c-.55 0-1 .45-1 1s.45 1 1 1s1-.45 1-1s-.45-1-1-1"},null,-1)])])}const qp=t.markRaw({name:"mdi-percent-outline",render:jp}),Xp={class:"flex flex-row gap-1"},Yp={key:0,class:"flex gap-1"},Up={key:0,class:"flex text-nowrap text-sm line-through"},Kp={key:1,class:"flex flex-row text-nowrap text-sm"},Gp={key:2,class:"flex flex-row gap-1 text-nowrap text-sm text-gray-600"},Zp={},ci=t.defineComponent({...Zp,__name:"product-cost",props:{product:{},additionalThroughFieldName:{},costFieldName:{},eventEmitter:{},allowPriceClick:{type:[Boolean,Function],default:!1},showTag:{type:Boolean,default:!1},showQuantityUnit:{type:Boolean,default:!1},showCurrency:{type:Boolean,default:!1},showCostDate:{type:Boolean,default:!1},showPriceHistory:{type:Boolean,default:!1},currencyRates:{default:void 0}},setup(n){var w;const e=n,i=uo(),r=t.computed(()=>"product"in e.product),o=t.computed(()=>"discount"in e.product&&e.product.discount?li.getFormatEntityName(e.product.discount):""),s=t.computed(()=>"product"in e.product?e.product.product:e.product),a=t.computed(()=>V.isNil(f.value)?"":e.showQuantityUnit?V.compact([s.value.currency.symbol,s.value.unit.name]).join("/"):e.showCurrency?s.value.currency.symbol:""),l=t.computed(()=>e.showQuantityUnit?V.compact(["₽",s.value.unit.name]).join("/"):e.showCurrency?"₽":""),c=t.computed(()=>V.find(s.value.priceCoefficients,["coefficient.slug",e.costFieldName])),d=t.computed(()=>{const C=V.find(s.value.priceCoefficients,["coefficient.slug","k0"]);return c.value||!C||V.isNil(f.value)||V.isNil(C.cost)?!1:f.value<C.cost}),u=((w=W.useBaseConfigStateStore().getConfig())==null?void 0:w.defaultCurrency)??"RUB",f=t.computed(()=>c.value?c.value.cost:V.get(e.product,e.costFieldName)),h=t.computed(()=>e.additionalThroughFieldName?V.get(e.product,e.additionalThroughFieldName):void 0),p=t.computed(()=>s.value.costDate?Be.format(s.value.costDate,W.useBaseConfigStateStore().config.dateFormats.uiDate):void 0),m=t.computed(()=>e.currencyRates||s.value.currency.signature===u?e.currencyRates:{[s.value.currency.signature]:s.value.costRub/s.value.cost}),g=t.computed(()=>(V.isFunction(e.allowPriceClick)?e.allowPriceClick(s.value):e.allowPriceClick)&&!V.isNil(f.value)),b=t.computed(()=>V.isNil(f.value)?"-":Ve.formatMoney(Number.parseFloat(f.value),s.value.currency.precision)),y=t.computed(()=>{if(s.value.currency.signature===u||!m.value||!m.value[s.value.currency.signature])return null;const C=m.value[s.value.currency.signature];return Ve.formatMoney(Number.parseFloat(f.value)*C)}),_=t.computed(()=>V.isNil(h.value)?null:Ve.formatMoney(h.value,s.value.currency.precision)),x=t.computed(()=>{if(!h.value||!f.value||h.value===f.value||f.value===0)return null;const C=(f.value-h.value)/h.value*100;return Ve.formatPercent(C)});return(C,N)=>{var P;const k=I.NTag,$=I.NTooltip,v=qp,E=Hp;return t.openBlock(),t.createElementBlock("div",Xp,[n.showTag?(t.openBlock(),t.createBlock($,{key:0},{trigger:t.withCtx(()=>[t.createVNode(k,{round:"",bordered:!1,size:"small",class:t.normalizeClass(["text-slate-600",{"font-bold":!c.value}])},{default:t.withCtx(()=>{var F;return[t.createTextVNode(t.toDisplayString(((F=c.value)==null?void 0:F.coefficient.slug)??"Ц"),1)]}),_:1},8,["class"])]),default:t.withCtx(()=>{var F;return[t.createTextVNode(" "+t.toDisplayString(((F=c.value)==null?void 0:F.coefficient.name)??"Розничная цена"),1)]}),_:1})):t.createCommentVNode("",!0),t.createElementVNode("div",{class:t.normalizeClass({"!text-red-600":d.value})},[h.value&&h.value!==f.value||x.value?(t.openBlock(),t.createElementBlock("div",Yp,[h.value&&h.value!==f.value?(t.openBlock(),t.createElementBlock("span",Up,t.toDisplayString(_.value)+" "+t.toDisplayString(a.value),1)):t.createCommentVNode("",!0),x.value?(t.openBlock(),t.createElementBlock("span",{key:1,class:t.normalizeClass(["flex text-nowrap text-sm text-gray-600",{"!text-red-600":d.value}])}," ("+t.toDisplayString(x.value)+"%) ",3)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),t.createElementVNode("span",{class:t.normalizeClass(["whitespace-nowrap text-base flex items-center gap-1",{"text-gray-600":(P=c.value)==null?void 0:P.readOnly,"font-bold":!c.value&&!r.value}])},[t.createElementVNode("span",{class:t.normalizeClass({"text-nowrap":!0,"cursor-pointer underline decoration-dashed":g.value&&n.eventEmitter}),onClick:N[0]||(N[0]=()=>{var F;g.value&&((F=n.eventEmitter)==null||F.emit("cost:click",{product:s.value,cost:f.value}))})},t.toDisplayString(b.value),3),t.createTextVNode(" "+t.toDisplayString(a.value)+" ",1),f.value&&!c.value&&"discount"in n.product&&n.product.discount?(t.openBlock(),t.createBlock($,{key:0},{trigger:t.withCtx(()=>[t.createVNode(v,{class:"text-sm text-black bg-amber-400 rounded p-px"})]),default:t.withCtx(()=>[t.createElementVNode("span",null,' На продукт действует скидка "'+t.toDisplayString(o.value)+'"; ',1)]),_:1})):t.createCommentVNode("",!0)],2),y.value?(t.openBlock(),t.createElementBlock("span",Kp," ~ "+t.toDisplayString(y.value)+" "+t.toDisplayString(l.value),1)):t.createCommentVNode("",!0),n.showCostDate&&!t.unref(V.isNil)(p.value)?(t.openBlock(),t.createElementBlock("span",Gp,[t.createTextVNode(t.toDisplayString(p.value)+" ",1),n.showPriceHistory&&n.eventEmitter?(t.openBlock(),t.createBlock($,{key:0,placement:"top-end",disabled:!t.unref(i)},{trigger:t.withCtx(()=>[t.createVNode(E,{class:"cursor-pointer",onClick:N[1]||(N[1]=F=>{var R;return(R=n.eventEmitter)==null?void 0:R.emit("cost:show-price-history",{product:s.value})})})]),default:t.withCtx(()=>[N[2]||(N[2]=t.createTextVNode(" История цен ",-1))]),_:1},8,["disabled"])):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)],2)])}}}),Qp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Jp(n,e){return t.openBlock(),t.createElementBlock("svg",Qp,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32",d:"M248 64C146.39 64 64 146.39 64 248s82.39 184 184 184s184-82.39 184-184S349.61 64 248 64Z"},null,-1),t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M220 220h32v116"},null,-1),t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-miterlimit":"10","stroke-width":"32",d:"M208 340h88"},null,-1),t.createElementVNode("path",{fill:"currentColor",d:"M248 130a26 26 0 1 0 26 26a26 26 0 0 0-26-26"},null,-1)])])}const ho=t.markRaw({name:"ion-information-circle-outline",render:Jp}),eg={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function tg(n,e){return t.openBlock(),t.createElementBlock("svg",eg,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M450.29 112H142c-34 0-62 27.51-62 61.33v245.34c0 33.82 28 61.33 62 61.33h308c34 0 62-26.18 62-60V173.33c0-33.82-27.68-61.33-61.71-61.33m-77.15 61.34a46 46 0 1 1-46.28 46a46.19 46.19 0 0 1 46.28-46.01Zm-231.55 276c-17 0-29.86-13.75-29.86-30.66v-64.83l90.46-80.79a46.54 46.54 0 0 1 63.44 1.83L328.27 337l-113 112.33ZM480 418.67a30.67 30.67 0 0 1-30.71 30.66H259L376.08 333a46.24 46.24 0 0 1 59.44-.16L480 370.59Z"},null,-1),t.createElementVNode("path",{fill:"currentColor",d:"M384 32H64A64 64 0 0 0 0 96v256a64.11 64.11 0 0 0 48 62V152a72 72 0 0 1 72-72h326a64.11 64.11 0 0 0-62-48"},null,-1)])])}const lc=t.markRaw({name:"ion-images",render:tg}),ng={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function ig(n,e){return t.openBlock(),t.createElementBlock("svg",ng,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M256 56C145.72 56 56 145.72 56 256s89.72 200 200 200s200-89.72 200-200S366.28 56 256 56m0 82a26 26 0 1 1-26 26a26 26 0 0 1 26-26m48 226h-88a16 16 0 0 1 0-32h28v-88h-16a16 16 0 0 1 0-32h32a16 16 0 0 1 16 16v104h28a16 16 0 0 1 0 32"},null,-1)])])}const rg=t.markRaw({name:"ion-information-circle",render:ig}),og={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function sg(n,e){return t.openBlock(),t.createElementBlock("svg",og,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M400 480a16 16 0 0 1-10.63-4L256 357.41L122.63 476A16 16 0 0 1 96 464V96a64.07 64.07 0 0 1 64-64h192a64.07 64.07 0 0 1 64 64v368a16 16 0 0 1-16 16"},null,-1)])])}const ag=t.markRaw({name:"ion-bookmark",render:sg});/*!
1
+ (function(j,W){typeof exports=="object"&&typeof module<"u"?W(exports,require("@snabcentr/common-lib"),require("lodash-es"),require("vue"),require("date-fns"),require("pinia"),require("naive-ui"),require("libphonenumber-js"),require("ts-case-convert"),require("vue-tel-input")):typeof define=="function"&&define.amd?define(["exports","@snabcentr/common-lib","lodash-es","vue","date-fns","pinia","naive-ui","libphonenumber-js","ts-case-convert","vue-tel-input"],W):(j=typeof globalThis<"u"?globalThis:j||self,W(j.SC_VueUiLib={},j["@snabcentr/common-lib"],j["lodash-es"],j.Vue,j["date-fns"],j.pinia,j["naive-ui"],j["libphonenumber-js"],j["ts-case-convert"],j["vue-tel-input"]))})(this,(function(j,W,V,t,Be,Pm,I,Br,Ns,Fm){"use strict";var PT=Object.defineProperty;var Tm=j=>{throw TypeError(j)};var FT=(j,W,V)=>W in j?PT(j,W,{enumerable:!0,configurable:!0,writable:!0,value:V}):j[W]=V;var B=(j,W,V)=>FT(j,typeof W!="symbol"?W+"":W,V),$m=(j,W,V)=>W.has(j)||Tm("Cannot "+V);var qt=(j,W,V)=>($m(j,W,"read from private field"),V?V.call(j):W.get(j)),Wl=(j,W,V)=>W.has(j)?Tm("Cannot add the same private member more than once"):W instanceof WeakSet?W.add(j):W.set(j,V),Em=(j,W,V,t)=>($m(j,W,"write to private field"),t?t.call(j,V):W.set(j,V),V);var qi,St,Cs;const Nr="Чтобы изменить, включите режим управления",Ts="Товар, который нужно предлагать клиенту",$s="Категория, которую нужно предлагать клиенту",Ft=class Ft{static init(e,i){Ft.messagesService&&Ft.notificationsService||(Ft.messagesService=e,Ft.notificationsService=i)}static getMessagesService(){if(!Ft.messagesService)throw new Error("UI provider is not initialized.");return Ft.messagesService}static getNotificationsService(){if(!Ft.notificationsService)throw new Error("UI provider is not initialized.");return Ft.notificationsService}static showNotificationsForErrorResponseData(e,i={}){var r,o;if(V.isEmpty(e.errors)){const s=(o=(r=e.rawError)==null?void 0:r.config)==null?void 0:o.url,a=s?` [ ${s} ]`:"";Ft.notificationsService?Ft.notificationsService.error({title:"Ошибка выполнения/обработки запроса",content:e.message,meta:`#${e.status}${a}: ${e.statusText}`,duration:3e3}):console.log("Show notification error response data: UI provider is not initialized.",e)}else{const s=[];for(const a in e.errors)Object.prototype.hasOwnProperty.call(i,a)?i[a]=new W.FieldValidationResultData(e.errors[a].toString(),"error"):s.push(e.errors[a].toString());Ft.showErrorMessages(s)}}static showErrorMessages(e){const{messagesService:i,notificationsService:r}=Ft;e.length===1&&i?i.error(e[0]):e.length>1&&r?r.error({title:"Ошибки выполнения запроса",meta:`Всего ошибок: ${e.length}`,content:()=>t.h("ul",{style:{maxHeight:"240px",overflowY:"auto",margin:0,paddingLeft:"1.25em",listStyleType:"disc"}},e.map(o=>t.h("li",o)))}):e.length>0&&console.log("Show notification error response data: UI provider is not initialized.",e)}};B(Ft,"messagesService"),B(Ft,"notificationsService");let Tr=Ft;const $r=new WeakMap,Vm=async n=>{const e=navigator.clipboard;if(e!=null&&e.writeText){await e.writeText(n);return}const i=document.createElement("textarea");i.value=n,i.style.position="fixed",i.style.opacity="0",document.body.append(i),i.select();const r=document.execCommand("copy");if(i.remove(),!r)throw new Error("Не удалось скопировать через execCommand.")},ql=async n=>{const e=V.isNil(n)?"":String(n);if(e)try{await Vm(e),Tr.getNotificationsService().success({title:"Готово",description:`Скопировано в буфер обмена: ${e}`,duration:2e3})}catch{Tr.getNotificationsService().error({title:"Ошибка",description:"Не удалось скопировать в буфер обмена.",duration:3e3})}},Mm=n=>n.tagName==="BUTTON"||n.getAttribute("role")==="button"||!!n.closest("button"),Im=(n,e)=>e.modifiers.click?"click":e.modifiers.dblclick?"dblclick":Mm(n)?"click":"dblclick",Xl={mounted(n,e){n.style.setProperty("cursor","pointer");const i=Im(n,e),r=o=>{var a;i==="dblclick"&&(o.preventDefault(),(a=globalThis.getSelection())==null||a.removeAllRanges());const s=$r.get(n);ql(s==null?void 0:s.value).catch(V.noop)};$r.set(n,{value:e.value,eventName:i,handler:r}),n.addEventListener(i,r)},updated(n,e){const i=$r.get(n);i&&(i.value=e.value)},beforeUnmount(n){const e=$r.get(n);e&&(n.removeEventListener(e.eventName,e.handler),$r.delete(n))}},Am=new Set(["checkbox","radio","range","button","submit","reset","file","color","image","hidden"]),Om=".n-base-selection, .n-date-picker, .n-time-picker, .n-color-picker",lo=new WeakMap,Yl=n=>!Am.has(n.type)&&!n.disabled&&!n.readOnly&&n.closest(Om)===null&&n.getClientRects().length>0,Ul=n=>{var a;if(n.key!=="Enter"&&n.code!=="Enter"||n.shiftKey||n.isComposing)return;const{target:e}=n;if(!(e instanceof HTMLInputElement)||!Yl(e))return;n.preventDefault();const i=n.currentTarget,r=[...i.querySelectorAll("input")].filter(l=>Yl(l)),o=r.indexOf(e);if(o===-1)return;const s=r.at(o+1);if(s){s.focus(),s.select();return}(a=lo.get(i))==null||a()},ai={mounted(n,e){lo.set(n,e.value),n.addEventListener("keydown",Ul)},updated(n,e){lo.set(n,e.value)},unmounted(n){n.removeEventListener("keydown",Ul),lo.delete(n)}};var ct=(n=>(n.NotInStock="not_in_stock",n.OnOrder="on_order",n.LargeOrder="large_order",n.NextDayDelivery="next_day_delivery",n))(ct||{});const Es={color:"#4b5563",backgroundColor:"#e5e7eb",textOnBackgroundColor:"#1f2937"},Kl=new Map([[W.OrderStatusEnum.New,{color:"#15803d",backgroundColor:"#bbf7d0",textOnBackgroundColor:"#166534"}],[W.OrderStatusEnum.Processing,{color:"#ea580c",backgroundColor:"#fed7aa",textOnBackgroundColor:"#9a3412"}],[W.OrderStatusEnum.AwaitingSupplyProducts,{color:"#ca8a04",backgroundColor:"#fef08a",textOnBackgroundColor:"#854d0e"}],[W.OrderStatusEnum.InvoiceIssued,{color:"#1d4ed8",backgroundColor:"#bfdbfe",textOnBackgroundColor:"#1e40af"}],[W.OrderStatusEnum.ProcessingOnStock,{color:"#0e7490",backgroundColor:"#a5f3fc",textOnBackgroundColor:"#155e75"}],[W.OrderStatusEnum.OrderUpdated,{color:"#6d28d9",backgroundColor:"#ddd6fe",textOnBackgroundColor:"#5b21b6"}],[W.OrderStatusEnum.Finished,{color:"#475569",backgroundColor:"#e2e8f0",textOnBackgroundColor:"#1e293b"}],[W.OrderStatusEnum.Canceled,{color:"#b91c1c",backgroundColor:"#fecaca",textOnBackgroundColor:"#991b1b"}],[W.OrderStatusEnum.Error,{color:"#991b1b",backgroundColor:"#fca5a5",textOnBackgroundColor:"#7f1d1d"}]]),ki=n=>Kl.get(n)??Es,Gl=n=>{const e=ki(n);return{color:e.backgroundColor,textColor:e.textOnBackgroundColor,borderColor:e.color}},Zl=n=>{const e=ki(n);return{"--sc-order-status-color":e.color,"--sc-order-status-bg":e.backgroundColor,"--sc-order-status-text":e.textOnBackgroundColor}},Rs=new Map([[ct.NotInStock,{color:"#ef4444",backgroundColor:"#f7ff00",textOnBackgroundColor:"#ff0000"}],[ct.OnOrder,{color:"#ca8a04",backgroundColor:"#f7ff00",textOnBackgroundColor:"#ff0000"}],[ct.LargeOrder,{color:"#ef2929",backgroundColor:"#ef2929",textOnBackgroundColor:"#ffffff"}],[ct.NextDayDelivery,{color:"#ef2929",backgroundColor:"#ef2929",textOnBackgroundColor:"#ffffff"}]]),Ql=new Map([[ct.NotInStock,"Нет в наличии"],[ct.OnOrder,"Под заказ"],[ct.LargeOrder,"Крупный заказ"],[ct.NextDayDelivery,"Доставка на завтра"]]),co=[...Rs.keys()],Er=n=>Rs.get(n)??Es,Ps=n=>Ql.get(n)??n,Fs=n=>{const e=[];return n.isNotInStock&&e.push(ct.NotInStock),n.isOnOrder&&e.push(ct.OnOrder),n.isLargeOrder&&e.push(ct.LargeOrder),!V.isNil(n.delivery.date)&&Be.isTomorrow(new Date(n.delivery.date))&&e.push(ct.NextDayDelivery),e};var Ie=(n=>(n.AttachedUser="attached_user",n.ClientInfo="client_info",n.ClientInfoShort="client_info_short",n.CreatedAt="created_at",n.ClientCity="client_city",n.DeliveryInfo="delivery_info",n.DeliveryDate="delivery_date",n.Id="id",n.PaymentType="payment_type",n.SalesDirections="sales_directions",n.Status="status",n.actions="actions",n))(Ie||{}),Xe=(n=>(n.phone="phone",n.tablet="tablet",n.laptop="laptop",n))(Xe||{});const Ct=class Ct{static init(){Ct.isInitialized||(Ct.isInitialized=!0,Ct.windowResizeHandler(),window.addEventListener("resize",Ct.windowResizeHandler))}static destroy(){window.removeEventListener("resize",Ct.windowResizeHandler),Ct.isInitialized=!1}static getDeviceTypeByResolution(){const e=W.useBaseConfigStateStore().config.deviceTypeByResolution;return window.innerWidth<e.tablet?Xe.phone:window.innerWidth<e.laptop?Xe.tablet:Xe.laptop}static initRefDependingOnDeviceResolution(e,i,r){const o=t.ref(r);return Ct.setRefValueDependingOnDeviceResolution(o,e,i,r),Ct.refsDependingOnDeviceResolution.push({r:o,phoneValue:e,tabletValue:i,defaultValue:r}),o}static isPhoneDevice(){return Ct.getDeviceTypeByResolution()===Xe.phone}static isTabletDevice(){return Ct.getDeviceTypeByResolution()===Xe.tablet}static isLaptopDevice(){return Ct.getDeviceTypeByResolution()===Xe.laptop}static setRefValueDependingOnDeviceResolution(e,i,r,o){switch(Ct.getDeviceTypeByResolution()){case Xe.phone:e.value=i;break;case Xe.tablet:e.value=r;break;default:e.value=o;break}}static windowResizeHandler(){V.forEach(Ct.refsDependingOnDeviceResolution,e=>{Ct.setRefValueDependingOnDeviceResolution(e.r,e.phoneValue,e.tabletValue,e.defaultValue)})}};B(Ct,"isInitialized",!1),B(Ct,"refsDependingOnDeviceResolution",[]);let Ue=Ct;function Jl(){try{return Ue.getDeviceTypeByResolution()}catch(n){return console.error(n),Xe.laptop}}function zm(){const n=t.ref(Jl()),e=t.computed(()=>n.value===Xe.phone||n.value===Xe.tablet),i=()=>{n.value=Jl()};return t.onMounted(()=>{window.addEventListener("resize",i)}),t.onUnmounted(()=>{window.removeEventListener("resize",i)}),{isCompactLayout:e}}const Dm="(hover: hover) and (pointer: fine)",uo=()=>{const n=V.isFunction(globalThis.matchMedia)?globalThis.matchMedia(Dm):void 0,e=t.ref(n?n.matches:!0),i=r=>{e.value=r.matches};return n==null||n.addEventListener("change",i),t.onScopeDispose(()=>{n==null||n.removeEventListener("change",i)},!0),t.readonly(e)};class Vs{static getLabel(e){switch(e){case W.AddressQualityEnum.Incomplete:return"Неполный адрес";case W.AddressQualityEnum.Undetermined:return"Полнота адреса не определена";default:return}}}const Lm=".sc-versions-list";function Hm(n,e,i){const r=document.querySelectorAll(Lm);if(r.length===0)return;const o=r[0],s=`${n}:`;if(V.some(o.querySelectorAll("li"),l=>V.startsWith(V.trim(l.textContent||""),s)))return;const a=document.createElement("li");a.append(document.createTextNode(`${s} ${e} от ${Be.format(i,"dd.MM.yyyy")}`)),o.append(a)}class Ci{static isVnodeEmpty(e){return e.every(i=>i.type===t.Comment||i.type===t.Text&&V.isString(i.children)&&!i.children.trim()?!0:i.type===t.Fragment&&Ci.isVnodeEmpty(i.children))}static hasSlotContent(e){return e?!Ci.isVnodeEmpty(e()):!1}}class ir{static getDefaultCurrency(){var i;if(!Pm.getActivePinia())return;const e=W.useBaseConfigStateStore().getConfig().defaultCurrency;return(i=W.useReferencesStore().currencyReference)==null?void 0:i.find(r=>r.signature===e)}static getPrecision(e){var i;return(e==null?void 0:e.precision)??((i=ir.getDefaultCurrency())==null?void 0:i.precision)}}const Wm={readAsFileData(n){return new Promise((e,i)=>{const r=new FileReader;r.addEventListener("load",()=>{e({name:n.name,content:r.result})}),r.addEventListener("error",()=>{i(new Error(`Не удалось прочитать файл «${n.name}».`))}),r.readAsDataURL(n)})}};class li{static isDeleted(e){return!!(e.deletedAt&&!Be.isFuture(e.deletedAt))}static getFormatEntityName(e){return li.isDeleted(e)?`${e.name} (Удалён)`:e.name}}const ft=(n,e=!1)=>{const{key:i}=n;if(!["Backspace","Delete","Tab","Escape","Enter","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(i)&&!((n.ctrlKey||n.metaKey)&&["a","c","v","x","z","ф","с","м","ч","я"].includes(i.toLowerCase()))){if(e&&i==="-"){const r=n.target;if((r.selectionStart??0)===0&&!r.value.includes("-"))return}/^\d$/.test(i)||n.preventDefault()}},fo=(n,e=".",i=!1)=>{const{key:r}=n,o=n.target;["Backspace","Delete","Tab","Escape","Enter","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(r)||(n.ctrlKey||n.metaKey)&&["a","c","v","x","z","ф","с","м","ч","я"].includes(r.toLowerCase())||i&&r==="-"&&!o.value.includes("-")&&((o.selectionStart??0)===0||o.value.length===0)||(r===e||r===(e==="."?",":"."))&&!o.value.includes(e)&&!o.value.includes(e==="."?",":".")||/^\d$/.test(r)||n.preventDefault()},ht=n=>n?Number.parseFloat(n.replace(",",".")):null,dt=(n,e)=>{n[e]={}},He=n=>{const e=n.target;setTimeout(()=>{e.select()},100)},Ye=class Ye{static getDecimalsCount(e){if(!Number.isFinite(e)||Number.isInteger(e))return 0;const[i,r]=V.split(e.toString(),"e"),o=V.split(i,"."),s=o.length>1?o[1].length:0;return Math.max(s-(Number(r)||0),0)}static normalize(e){return Number.isFinite(e)?Number(e.toPrecision(Ye.significantDigits)):e}static multiplyByStep(e,i){return V.round(e*i,Ye.getDecimalsCount(i)+Ye.getDecimalsCount(e))}static divideByStep(e,i){return Ye.normalize(e/i)}static isMultipleOf(e,i){const r=e/i;return Math.abs(r-Math.round(r))<Ye.epsilon}static isLessOrEqual(e,i){return e<=i+Ye.epsilon}static roundCoordinate(e){return V.round(e,Ye.coordinateFractionDigits)}static roundMoney(e,i=ir.getPrecision()){return i===void 0?Ye.normalize(e):V.round(e,i)}static floorMoney(e,i=ir.getPrecision()){return i===void 0?Ye.normalize(e):V.floor(e,i)}static roundPercent(e,i=Ye.percentFractionDigits){return V.round(e,i)}static formatMoney(e,i=ir.getPrecision()){let r=Ye.moneyFormatters.get(i);return r||(r=new Intl.NumberFormat("ru-RU",{style:"decimal",minimumFractionDigits:i,maximumFractionDigits:i}),Ye.moneyFormatters.set(i,r)),r.format(Ye.normalize(e))}static formatPercent(e,i=Ye.percentDisplayFractionDigits){return new Intl.NumberFormat("ru-RU",{style:"decimal",maximumFractionDigits:i}).format(e)}static formatArea(e){return Ye.areaFormatter.format(e)}};B(Ye,"percentFractionDigits",5),B(Ye,"percentDisplayFractionDigits",2),B(Ye,"areaFractionDigits",4),B(Ye,"coordinateFractionDigits",6),B(Ye,"significantDigits",12),B(Ye,"epsilon",1e-6),B(Ye,"moneyFormatters",new Map),B(Ye,"areaFormatter",new Intl.NumberFormat("ru-RU",{style:"decimal",maximumFractionDigits:Ye.areaFractionDigits}));let Ve=Ye;function ec(n){return n.itemCount&&n.itemCount>0?`Всего ${n.itemCount} записей`:""}class wt{static convertReferencesToOptionsList(e,i=!1,r=!1,o=!1,s=void 0,a=void 0){let l=e.map(c=>({label:s?s(c):li.getFormatEntityName(c),value:c.id,item:c,disabled:a?a(c):!1}));return i&&(l=l.map(c=>`${c.label}-[${c.value}]`).sort().map(c=>l.find(d=>c===`${d.label}-[${d.value}]`))),r===!1?[...o?[{label:"",value:-1,disabled:!0}]:[],...l]:[...o?[{type:"group",label:"-",key:"default_group",children:[{label:"-- Отсутствует --",value:-1,disabled:!0}]}]:[],...Object.values(V.groupBy(l,r.key)).filter(c=>c.length>0).map(c=>{const d=c[0],u=V.isString(r.key)?V.get(d,r.key):r.key(c),f=V.isString(r.label)?V.get(d,r.label):r.label(c);return{type:"group",label:V.isEmpty(f)?"- Не определено -":f,key:`group_${u}`,children:c}})]}static convertReferencesToSelectOptionsList(e,i=!1,r=!1,o=!1,s=void 0,a=void 0){return wt.convertReferencesToOptionsList(e,i,r,o,s,a)}static convertReferencesToAutocompleteOptionsList(e,i=!1,r=!1,o=!1,s=void 0,a=void 0){return wt.convertReferencesToOptionsList(e,i,r,o,s,a)}}const jm={required:{required:!0,type:"any",trigger:["blur","input"],message:"Это поле обязательно для заполнения"}},ce={required:{type:"number",required:!0,trigger:["blur","input"],message:"Это поле обязательно для заполнения"},min(n){return{type:"number",min:n,trigger:["blur","input"],message:`Минимальное значение: ${n}`}},max(n){return{type:"number",max:n,trigger:["blur","input"],message:`Максимальное значение: ${n}`}},step(n){return{type:"number",trigger:["blur","input"],validator:(e,i)=>i===null||Ve.isMultipleOf(i,n)?!0:new Error(`Значение должно быть кратно ${n}`)}}},qm={required:{required:!0,type:"date",trigger:["blur","input"],message:"Это поле обязательно для заполнения"}},We={serverValidation(n){return{validator:(e,i)=>i===null?!0:n?new Error(n):!0}}},Ms=n=>{var e;return((e=n.properties)==null?void 0:e.files)??[]},tc=n=>{var e,i;return!!((e=n.properties)!=null&&e.description)||!!((i=n.properties)!=null&&i.specification)||Ms(n).length>0},ji=class ji{static isM2Category(e){var i;return((i=e.properties)==null?void 0:i.allowSetM2ClientPrice)??!1}static findReferenceProduct(e){var i;return(i=e.products)==null?void 0:i.find(r=>{var o,s,a;return((o=r.category)==null?void 0:o.id)===e.id&&(!!((s=r.properties)!=null&&s.length)||!!((a=r.properties)!=null&&a.width))})}static getSquare(e){var i,r;return(((i=e.properties)==null?void 0:i.width)??ji.defaultLinearSizeMm)*(((r=e.properties)==null?void 0:r.length)??ji.defaultLinearSizeMm)/1e6}static toM2Cost(e,i){return e/ji.getSquare(i)}static calculateM2Cost(e,i,r){var s,a;const o=V.isNil(i)?e.retailCost??e.cost:(a=(s=e.priceCoefficients)==null?void 0:s.find(l=>l.coefficient.id===i.id))==null?void 0:a.cost;return V.isNil(o)?void 0:ji.toM2Cost(o*(1+(r??0)/100),e)}};B(ji,"defaultLinearSizeMm",1e3);let vi=ji;const Xm={},Ym=t.defineComponent({...Xm,__name:"button-with-confirm-action",props:{disabled:{type:Boolean,default:!1},dialogTitle:{default:""},dialogContent:{default:""},disableConfirm:{type:Boolean,default:!1},popoverText:{default:""},type:{default:"default"},size:{default:"small"},quaternary:{type:Boolean,default:!1},circle:{type:Boolean,default:!1},ghost:{type:Boolean,default:!1},loading:{type:Boolean,default:!1}},emits:["accept"],setup(n,{emit:e}){const i=n,r=e,o=t.ref(!1),s=()=>{r("accept",()=>{o.value=!1})},a=()=>{i.disableConfirm?s():o.value=!0};return(l,c)=>{const d=I.NButton,u=I.NPopover,f=I.NModal;return t.openBlock(),t.createElementBlock("div",null,[t.createVNode(u,{disabled:n.popoverText.length===0,placement:"bottom"},{trigger:t.withCtx(()=>[t.createVNode(d,{disabled:n.disabled,ghost:n.ghost,loading:n.loading,size:n.size,type:n.type,quaternary:n.quaternary,circle:n.circle,onClick:a},{default:t.withCtx(()=>[t.renderSlot(l.$slots,"default")]),_:3},8,["disabled","ghost","loading","size","type","quaternary","circle"])]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(n.popoverText),1)]),_:3},8,["disabled"]),t.createVNode(f,{show:o.value,"onUpdate:show":c[1]||(c[1]=h=>o.value=h),content:n.dialogContent,closable:!1,"mask-closable":!1,"show-icon":!1,title:n.dialogTitle,"action-class":"",preset:"dialog"},{action:t.withCtx(()=>[t.createVNode(d,{type:"primary",class:"px-8",onClick:s},{default:t.withCtx(()=>[...c[2]||(c[2]=[t.createTextVNode(" Да ",-1)])]),_:1}),t.createVNode(d,{type:"default",onClick:c[0]||(c[0]=h=>o.value=!1)},{default:t.withCtx(()=>[...c[3]||(c[3]=[t.createTextVNode(" Отмена ",-1)])]),_:1})]),_:1},8,["show","content","title"])])}}}),Um={class:"flex gap-2 overflow-x-auto max-sm:flex-nowrap sm:flex-wrap sm:overflow-visible"},Km={},Gm=t.defineComponent({...Km,__name:"chip-group",props:{items:{},modelValue:{}},emits:["update:modelValue"],setup(n,{emit:e}){const i=e;return(r,o)=>(t.openBlock(),t.createElementBlock("div",Um,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.items,s=>(t.openBlock(),t.createBlock(t.unref(I.NButton),{key:s.key,class:"shrink-0",round:"",size:"small",type:n.modelValue===s.key?"primary":"default",onClick:a=>i("update:modelValue",s.key)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(s.label),1)]),_:2},1032,["type","onClick"]))),128))]))}}),Zm={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Qm(n,e){return t.openBlock(),t.createElementBlock("svg",Zm,[...e[0]||(e[0]=[t.createElementVNode("circle",{cx:"256",cy:"256",r:"48",fill:"currentColor"},null,-1),t.createElementVNode("circle",{cx:"256",cy:"416",r:"48",fill:"currentColor"},null,-1),t.createElementVNode("circle",{cx:"256",cy:"96",r:"48",fill:"currentColor"},null,-1)])])}const Is=t.markRaw({name:"ion-ellipsis-vertical-sharp",render:Qm}),Jm={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function ep(n,e){return t.openBlock(),t.createElementBlock("svg",Jm,[...e[0]||(e[0]=[t.createElementVNode("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[t.createElementVNode("path",{d:"M7 7H6a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2-2v-1"}),t.createElementVNode("path",{d:"M20.385 6.585a2.1 2.1 0 0 0-2.97-2.97L9 12v3h3zM16 5l3 3"})],-1)])])}const nc=t.markRaw({name:"tabler-edit",render:ep}),tp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function np(n,e){return t.openBlock(),t.createElementBlock("svg",tp,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M258.9 48C141.92 46.42 46.42 141.92 48 258.9c1.56 112.19 92.91 203.54 205.1 205.1c117 1.6 212.48-93.9 210.88-210.88C462.44 140.91 371.09 49.56 258.9 48m-16.79 192.47l51.55-59a16 16 0 0 1 24.1 21.06l-51.55 59a16 16 0 1 1-24.1-21.06m-38.86 90.85a16 16 0 0 1-22.62 0l-47.95-48a16 16 0 1 1 22.64-22.62l48 48a16 16 0 0 1-.07 22.62m176.8-128.79l-111.88 128a16 16 0 0 1-11.51 5.47h-.54a16 16 0 0 1-11.32-4.69l-47.94-48a16 16 0 1 1 22.64-22.62l29.8 29.83a8 8 0 0 0 11.68-.39l95-108.66a16 16 0 0 1 24.1 21.06Z"},null,-1)])])}const ic=t.markRaw({name:"ion-checkmark-done-circle",render:np}),ip={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function rp(n,e){return t.openBlock(),t.createElementBlock("svg",ip,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32",d:"M448 256c0-106-86-192-192-192S64 150 64 256s86 192 192 192s192-86 192-192Z"},null,-1),t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M368 192L256.13 320l-47.95-48m-16.23 48L144 272m161.71-80l-51.55 59"},null,-1)])])}const rc=t.markRaw({name:"ion-checkmark-done-circle-outline",render:rp}),op={viewBox:"0 0 32 32",width:"1.2em",height:"1.2em"};function sp(n,e){return t.openBlock(),t.createElementBlock("svg",op,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M22.15 3.237c-1.93-1.93-5.185-1.403-6.406 1.04l-3.175 6.35a1.5 1.5 0 0 1-.868.752L6.72 13.04a2 2 0 0 0-.782 3.312l4.149 4.149L4 26.586v1.415h1.414l6.086-6.086l4.149 4.149a2 2 0 0 0 3.311-.782l1.661-4.983a1.5 1.5 0 0 1 .752-.867l6.351-3.175c2.442-1.222 2.97-4.476 1.04-6.407zM17.533 5.17a2 2 0 0 1 3.203-.52l6.614 6.614a2 2 0 0 1-.52 3.203l-6.351 3.175a3.5 3.5 0 0 0-1.755 2.024l-1.661 4.982l-9.712-9.711l4.983-1.661a3.5 3.5 0 0 0 2.024-1.755z"},null,-1)])])}const ap=t.markRaw({name:"fluent-pin32-regular",render:sp}),lp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function cp(n,e){return t.openBlock(),t.createElementBlock("svg",lp,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M255.66 112c-77.94 0-157.89 45.11-220.83 135.33a16 16 0 0 0-.27 17.77C82.92 340.8 161.8 400 255.66 400c92.84 0 173.34-59.38 221.79-135.25a16.14 16.14 0 0 0 0-17.47C428.89 172.28 347.8 112 255.66 112"},null,-1),t.createElementVNode("circle",{cx:"256",cy:"256",r:"80",fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32"},null,-1)])])}const dp=t.markRaw({name:"ion-eye-outline",render:cp}),up={viewBox:"0 0 32 32",width:"1.2em",height:"1.2em"};function fp(n,e){return t.openBlock(),t.createElementBlock("svg",up,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M15.744 4.276c1.221-2.442 4.476-2.97 6.406-1.04l6.614 6.614c1.93 1.93 1.402 5.186-1.04 6.406l-6.35 3.176a1.5 1.5 0 0 0-.753.867l-1.66 4.983a2 2 0 0 1-3.312.782l-4.149-4.15l-6.086 6.087H4v-1.415l6.086-6.085l-4.149-4.15a2 2 0 0 1 .782-3.31l4.982-1.662a1.5 1.5 0 0 0 .868-.752z"},null,-1)])])}const hp=t.markRaw({name:"fluent-pin32-filled",render:fp}),mp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function pp(n,e){return t.openBlock(),t.createElementBlock("svg",mp,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M352 48H160a48 48 0 0 0-48 48v368l144-128l144 128V96a48 48 0 0 0-48-48"},null,-1)])])}const gp=t.markRaw({name:"ion-bookmark-outline",render:pp}),yp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function bp(n,e){return t.openBlock(),t.createElementBlock("svg",yp,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"m63.998 86.005l21.998-21.998L447.999 426.01l-21.998 21.998zM259.34 192.09l60.57 60.57a64.07 64.07 0 0 0-60.57-60.57m-6.68 127.82l-60.57-60.57a64.07 64.07 0 0 0 60.57 60.57"},null,-1),t.createElementVNode("path",{fill:"currentColor",d:"M256 352a96 96 0 0 1-92.6-121.34l-69.07-69.08C66.12 187.42 39.24 221.14 16 256c26.42 44 62.56 89.24 100.2 115.18C159.38 400.92 206.33 416 255.76 416A233.5 233.5 0 0 0 335 402.2l-53.61-53.6A95.8 95.8 0 0 1 256 352m0-192a96 96 0 0 1 92.6 121.34L419.26 352c29.15-26.25 56.07-61.56 76.74-96c-26.38-43.43-62.9-88.56-101.18-114.82C351.1 111.2 304.31 96 255.76 96a222.9 222.9 0 0 0-78.21 14.29l53.11 53.11A95.8 95.8 0 0 1 256 160"},null,-1)])])}const _p=t.markRaw({name:"ion-eye-off-sharp",render:bp}),wp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function xp(n,e){return t.openBlock(),t.createElementBlock("svg",wp,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"48",d:"m184 112l144 144l-144 144"},null,-1)])])}const kp=t.markRaw({name:"ion-chevron-forward-outline",render:xp}),Cp=["data-name"],vp={class:"sc-collapse-item-header flex flex-row gap-2.5"},Sp={class:"sc-collapse-item-arrow flex-none cursor-pointer pt-1.5"},Bp={key:0},Np={class:"sc-collapse-item-pre-arrow flex flex-none flex-row gap-1"},Tp={class:"flex flex-1 flex-col"},$p={key:0,class:"sc-collapse-item-sub-title flex-1"},Ep={key:1,class:"sc-collapse-item-title-extra flex-none"},Rp={key:0,class:"sc-collapse-item-content"},Pp={},Fp=t.defineComponent({...Pp,__name:"collapse-item",props:{name:{default:""},title:{default:""},disabled:{type:Boolean,default:!1}},emits:["header:click"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.inject("itemHeaderClickHandler",V.noop),a=t.inject("defaultExpandedNames",[]),l=t.inject("expandedNames",[]),c=V.some(a,g=>g===r.name),d=t.computed(()=>V.some(l,g=>g===r.name)),u=t.ref(c),f=()=>{r.disabled||(u.value=d.value||!u.value,o("header:click",r.name,u.value),s(r.name,u.value))};return e({expand:()=>{!r.disabled&&!u.value&&(u.value=!0,o("header:click",r.name,u.value),s(r.name,u.value))},toggle:()=>{r.disabled||f()},collapse:()=>{!r.disabled&&u.value&&!d.value&&(u.value=!1,o("header:click",r.name,u.value),s(r.name,u.value))},expanded:t.readonly(u)}),(g,b)=>{const y=kp;return t.openBlock(),t.createElementBlock("div",{"data-name":n.name,class:t.normalizeClass([{"cursor-not-allowed text-gray-400":n.disabled},"sc-collapse-item flex flex-col p-2"])},[t.createElementVNode("div",vp,[t.createElementVNode("div",Sp,[t.createElementVNode("div",{class:t.normalizeClass({"rotate-90":u.value}),onClick:f},[t.renderSlot(g.$slots,"arrow",{},()=>[t.createVNode(y)],!0)],2)]),t.unref(Ci).hasSlotContent(g.$slots["pre-arrow"])?(t.openBlock(),t.createElementBlock("div",Bp,[t.createElementVNode("div",Np,[t.renderSlot(g.$slots,"pre-arrow",{},void 0,!0)])])):t.createCommentVNode("",!0),t.createElementVNode("div",Tp,[t.createElementVNode("div",{class:"sc-collapse-item-title flex flex-1 cursor-pointer flex-col text-lg font-semibold",onClick:f},[t.renderSlot(g.$slots,"header",{},()=>[t.createTextVNode(t.toDisplayString(n.title),1)],!0)]),t.unref(Ci).hasSlotContent(g.$slots["sub-header"])?(t.openBlock(),t.createElementBlock("div",$p,[t.renderSlot(g.$slots,"sub-header",{},void 0,!0)])):t.createCommentVNode("",!0)]),t.unref(Ci).hasSlotContent(g.$slots["header-extra"])?(t.openBlock(),t.createElementBlock("div",Ep,[t.renderSlot(g.$slots,"header-extra",{},void 0,!0)])):t.createCommentVNode("",!0)]),t.createVNode(t.Transition,{name:"fade"},{default:t.withCtx(()=>[d.value||u.value?(t.openBlock(),t.createElementBlock("div",Rp,[t.renderSlot(g.$slots,"default",{},void 0,!0)])):t.createCommentVNode("",!0)]),_:3})],10,Cp)}}}),dn=(n,e)=>{const i=n.__vccOpts||n;for(const[r,o]of e)i[r]=o;return i},oc=dn(Fp,[["__scopeId","data-v-22a74c45"]]),Vp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Mp(n,e){return t.openBlock(),t.createElementBlock("svg",Vp,[...e[0]||(e[0]=[t.createElementVNode("circle",{cx:"176",cy:"416",r:"16",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),t.createElementVNode("circle",{cx:"400",cy:"416",r:"16",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M48 80h64l48 272h256"},null,-1),t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M160 288h249.44a8 8 0 0 0 7.85-6.43l28.8-144a8 8 0 0 0-7.85-9.57H128"},null,-1)])])}const sc=t.markRaw({name:"ion-cart-outline",render:Mp}),Rr=Symbol(),Ip={Button:{border:"1px solid grey"},Card:{paddingMedium:"1rem"},Checkbox:{border:"1px solid rgb(12, 88, 32)"},Common:{borderRadius:"0.5rem",borderRadiusSmall:"0.25rem",fontWeight:"500",fontWeightStrong:"600",fontSize:"0.75rem",fontSizeMedium:"0.75rem",fontSizeLarge:"0.8125rem",lineHeight:"1.25rem",heightSmall:"24px",heightMedium:"30px",heightTiny:"20px",heightLarge:"36px",heightHuge:"42px",primaryColor:"#FFCC40FF",primaryColorHover:"#FFE49BFF",primaryColorPressed:"#FFBB00FF",primaryColorSuppl:"#FCC42AFF",successColor:"#4AC99BFF",successColorHover:"#4AC99BBF",successColorPressed:"#21AA78FF",errorColor:"#F45725FF",errorColorHover:"#F4572599",textColorBase:"#191C30E5",textColorDisabled:"#191C30E5"},DataTable:{borderColor:"rgb(207, 207, 207)",lineHeight:1.4,tdColorHover:"rgb(250,250,250)",thColor:"rgb(231, 231, 231)",thFontWeight:400,thPaddingMedium:"8px",tdPaddingMedium:"8px",thTextColor:"rgb(22, 0, 108)"},Drawer:{closeIconColor:"rgba(31, 34, 37, 1)",closeIconColorHover:"rgba(10, 157, 5, 1)"},Form:{marginBottom:0,lineHeight:1,labelFontSizeTopMedium:"0.75rem",labelHeightMedium:"20px",labelFontWeight:500,labelTextColor:"rgba(27, 31, 59, 0.65)",labelPaddingVertical:"0",labelPaddingHorizontal:"0"},Input:{paddingMedium:"0.5rem",fontSizeMedium:"0.9125rem",lineHeight:"1.25rem",lineHeightTextarea:"1.25rem",border:"1px solid #E0E0E0",borderRadius:"0.5rem",iconSize:"1,125rem"},Tabs:{tabFontSizeMedium:"0.9375rem",tabColorSegment:"#FFCC40FF",tabBorderColor:"#CCCCCCFF"}},Ap={class:"flex flex-col-reverse gap-2.5 sm:flex-row"},Op={class:"inline-flex"},zp={},ac=t.defineComponent({...zp,__name:"product-actions",props:{eventEmitter:{},showProductAddToCartButton:{type:[Boolean,String,Function],default:!1},showProductEditButton:{type:[Boolean,String,Function],default:!1},showProductRequiredButton:{type:[Boolean,String,Function],default:!1},productContextButtonsConfig:{type:Function,default:void 0},product:{}},setup(n){const e=n,i=t.inject(Rr,"medium"),r=uo(),o=t.computed(()=>V.isFunction(e.showProductAddToCartButton)?e.showProductAddToCartButton(e.product):e.showProductAddToCartButton),s=t.computed(()=>V.isFunction(e.showProductEditButton)?e.showProductEditButton(e.product):e.showProductEditButton),a=t.computed(()=>V.isFunction(e.showProductRequiredButton)?e.showProductRequiredButton(e.product):e.showProductRequiredButton),l=t.computed(()=>a.value==="disabled"?`${Ts}. ${Nr}`:Ts),c=t.computed(()=>V.isNil(e.productContextButtonsConfig)?[]:V.isFunction(e.productContextButtonsConfig)?e.productContextButtonsConfig(e.product):e.productContextButtonsConfig),d=()=>{e.eventEmitter.emit("product:add-to-cart",{product:e.product})},u=()=>{e.eventEmitter.emit("product:edit",{product:e.product})},f=()=>{e.eventEmitter.emit("product:required",{product:e.product})},h=p=>{e.eventEmitter.emit("product:context-select",{product:e.product,key:p})};return(p,m)=>{var k;const g=rc,b=ic,y=I.NButton,_=I.NTooltip,x=nc,w=sc,C=Is,N=I.NDropdown;return t.openBlock(),t.createElementBlock("div",Ap,[a.value?(t.openBlock(),t.createBlock(_,{key:0,placement:"bottom",trigger:"hover",disabled:!t.unref(r)},{trigger:t.withCtx(()=>[t.createElementVNode("span",Op,[t.createVNode(y,{ghost:!0,size:t.unref(i),disabled:a.value==="disabled",type:n.product.isRequired?"primary":"default",onClick:f},{default:t.withCtx(()=>[n.product.isRequired?(t.openBlock(),t.createBlock(b,{key:1})):(t.openBlock(),t.createBlock(g,{key:0}))]),_:1},8,["size","disabled","type"])])]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(l.value),1)]),_:1},8,["disabled"])):t.createCommentVNode("",!0),s.value?(t.openBlock(),t.createBlock(_,{key:1,placement:"bottom",trigger:"hover",disabled:!t.unref(r)},{trigger:t.withCtx(()=>[t.createVNode(y,{ghost:!0,size:t.unref(i),type:"primary",disabled:s.value==="disabled",onClick:u},{default:t.withCtx(()=>[t.createVNode(x)]),_:1},8,["size","disabled"])]),default:t.withCtx(()=>[m[0]||(m[0]=t.createTextVNode(" Редактировать ",-1))]),_:1},8,["disabled"])):t.createCommentVNode("",!0),o.value?(t.openBlock(),t.createBlock(_,{key:2,placement:"bottom",trigger:"hover",disabled:!t.unref(r)},{trigger:t.withCtx(()=>[t.createVNode(y,{ghost:!0,size:t.unref(i),disabled:o.value==="disabled",type:"primary",onClick:d},{default:t.withCtx(()=>[t.createVNode(w)]),_:1},8,["size","disabled"])]),default:t.withCtx(()=>[m[1]||(m[1]=t.createTextVNode(" Добавить в корзину ",-1))]),_:1},8,["disabled"])):t.createCommentVNode("",!0),((k=c.value)==null?void 0:k.length)>0?(t.openBlock(),t.createBlock(N,{key:3,options:c.value,size:t.unref(i),trigger:"click",onSelect:h},{default:t.withCtx(()=>[t.createVNode(y,{ghost:!0,size:t.unref(i),type:"primary"},{default:t.withCtx(()=>[t.createVNode(C)]),_:1},8,["size"])]),_:1},8,["options","size"])):t.createCommentVNode("",!0)])}}}),Dp={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Lp(n,e){return t.openBlock(),t.createElementBlock("svg",Dp,[...e[0]||(e[0]=[t.createElementVNode("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[t.createElementVNode("path",{d:"M12 8v4l2 2"}),t.createElementVNode("path",{d:"M3.05 11a9 9 0 1 1 .5 4m-.5 5v-5h5"})],-1)])])}const Hp=t.markRaw({name:"tabler-history",render:Lp}),Wp={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function jp(n,e){return t.openBlock(),t.createElementBlock("svg",Wp,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"m18.5 3.5l2 2l-15 15l-2-2zM7 4c1.66 0 3 1.34 3 3s-1.34 3-3 3s-3-1.34-3-3s1.34-3 3-3m10 10c1.66 0 3 1.34 3 3s-1.34 3-3 3s-3-1.34-3-3s1.34-3 3-3M7 6c-.55 0-1 .45-1 1s.45 1 1 1s1-.45 1-1s-.45-1-1-1m10 10c-.55 0-1 .45-1 1s.45 1 1 1s1-.45 1-1s-.45-1-1-1"},null,-1)])])}const qp=t.markRaw({name:"mdi-percent-outline",render:jp}),Xp={class:"flex flex-row gap-1"},Yp={key:0,class:"flex gap-1"},Up={key:0,class:"flex text-nowrap text-sm line-through"},Kp={key:1,class:"flex flex-row text-nowrap text-sm"},Gp={key:2,class:"flex flex-row gap-1 text-nowrap text-sm text-gray-600"},Zp={},ci=t.defineComponent({...Zp,__name:"product-cost",props:{product:{},additionalThroughFieldName:{},costFieldName:{},eventEmitter:{},allowPriceClick:{type:[Boolean,Function],default:!1},showTag:{type:Boolean,default:!1},showQuantityUnit:{type:Boolean,default:!1},showCurrency:{type:Boolean,default:!1},showCostDate:{type:Boolean,default:!1},showPriceHistory:{type:Boolean,default:!1},currencyRates:{default:void 0}},setup(n){var w;const e=n,i=uo(),r=t.computed(()=>"product"in e.product),o=t.computed(()=>"discount"in e.product&&e.product.discount?li.getFormatEntityName(e.product.discount):""),s=t.computed(()=>"product"in e.product?e.product.product:e.product),a=t.computed(()=>V.isNil(f.value)?"":e.showQuantityUnit?V.compact([s.value.currency.symbol,s.value.unit.name]).join("/"):e.showCurrency?s.value.currency.symbol:""),l=t.computed(()=>e.showQuantityUnit?V.compact(["₽",s.value.unit.name]).join("/"):e.showCurrency?"₽":""),c=t.computed(()=>V.find(s.value.priceCoefficients,["coefficient.slug",e.costFieldName])),d=t.computed(()=>{const C=V.find(s.value.priceCoefficients,["coefficient.slug","k0"]);return c.value||!C||V.isNil(f.value)||V.isNil(C.cost)?!1:f.value<C.cost}),u=((w=W.useBaseConfigStateStore().getConfig())==null?void 0:w.defaultCurrency)??"RUB",f=t.computed(()=>c.value?c.value.cost:V.get(e.product,e.costFieldName)),h=t.computed(()=>e.additionalThroughFieldName?V.get(e.product,e.additionalThroughFieldName):void 0),p=t.computed(()=>s.value.costDate?Be.format(s.value.costDate,W.useBaseConfigStateStore().config.dateFormats.uiDate):void 0),m=t.computed(()=>e.currencyRates||s.value.currency.signature===u?e.currencyRates:{[s.value.currency.signature]:s.value.costRub/s.value.cost}),g=t.computed(()=>(V.isFunction(e.allowPriceClick)?e.allowPriceClick(s.value):e.allowPriceClick)&&!V.isNil(f.value)),b=t.computed(()=>V.isNil(f.value)?"-":Ve.formatMoney(Number.parseFloat(f.value),s.value.currency.precision)),y=t.computed(()=>{if(s.value.currency.signature===u||!m.value||!m.value[s.value.currency.signature])return null;const C=m.value[s.value.currency.signature];return Ve.formatMoney(Number.parseFloat(f.value)*C)}),_=t.computed(()=>V.isNil(h.value)?null:Ve.formatMoney(h.value,s.value.currency.precision)),x=t.computed(()=>{if(!h.value||!f.value||h.value===f.value||f.value===0)return null;const C=(f.value-h.value)/h.value*100;return Ve.formatPercent(C)});return(C,N)=>{var P;const k=I.NTag,$=I.NTooltip,v=qp,E=Hp;return t.openBlock(),t.createElementBlock("div",Xp,[n.showTag?(t.openBlock(),t.createBlock($,{key:0},{trigger:t.withCtx(()=>[t.createVNode(k,{round:"",bordered:!1,size:"small",class:t.normalizeClass(["text-slate-600",{"font-bold":!c.value}])},{default:t.withCtx(()=>{var F;return[t.createTextVNode(t.toDisplayString(((F=c.value)==null?void 0:F.coefficient.slug)??"Ц"),1)]}),_:1},8,["class"])]),default:t.withCtx(()=>{var F;return[t.createTextVNode(" "+t.toDisplayString(((F=c.value)==null?void 0:F.coefficient.name)??"Розничная цена"),1)]}),_:1})):t.createCommentVNode("",!0),t.createElementVNode("div",{class:t.normalizeClass({"!text-red-600":d.value})},[h.value&&h.value!==f.value||x.value?(t.openBlock(),t.createElementBlock("div",Yp,[h.value&&h.value!==f.value?(t.openBlock(),t.createElementBlock("span",Up,t.toDisplayString(_.value)+" "+t.toDisplayString(a.value),1)):t.createCommentVNode("",!0),x.value?(t.openBlock(),t.createElementBlock("span",{key:1,class:t.normalizeClass(["flex text-nowrap text-sm text-gray-600",{"!text-red-600":d.value}])}," ("+t.toDisplayString(x.value)+"%) ",3)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),t.createElementVNode("span",{class:t.normalizeClass(["whitespace-nowrap text-base flex items-center gap-1",{"text-gray-600":(P=c.value)==null?void 0:P.readOnly,"font-bold":!c.value&&!r.value}])},[t.createElementVNode("span",{class:t.normalizeClass({"text-nowrap":!0,"cursor-pointer underline decoration-dashed":g.value&&n.eventEmitter}),onClick:N[0]||(N[0]=()=>{var F;g.value&&((F=n.eventEmitter)==null||F.emit("cost:click",{product:s.value,cost:f.value}))})},t.toDisplayString(b.value),3),t.createTextVNode(" "+t.toDisplayString(a.value)+" ",1),f.value&&!c.value&&"discount"in n.product&&n.product.discount?(t.openBlock(),t.createBlock($,{key:0},{trigger:t.withCtx(()=>[t.createVNode(v,{class:"text-sm text-black bg-amber-400 rounded p-px"})]),default:t.withCtx(()=>[t.createElementVNode("span",null,' На продукт действует скидка "'+t.toDisplayString(o.value)+'"; ',1)]),_:1})):t.createCommentVNode("",!0)],2),y.value?(t.openBlock(),t.createElementBlock("span",Kp," ~ "+t.toDisplayString(y.value)+" "+t.toDisplayString(l.value),1)):t.createCommentVNode("",!0),n.showCostDate&&!t.unref(V.isNil)(p.value)?(t.openBlock(),t.createElementBlock("span",Gp,[t.createTextVNode(t.toDisplayString(p.value)+" ",1),n.showPriceHistory&&n.eventEmitter?(t.openBlock(),t.createBlock($,{key:0,placement:"top-end",disabled:!t.unref(i)},{trigger:t.withCtx(()=>[t.createVNode(E,{class:"cursor-pointer",onClick:N[1]||(N[1]=F=>{var R;return(R=n.eventEmitter)==null?void 0:R.emit("cost:show-price-history",{product:s.value})})})]),default:t.withCtx(()=>[N[2]||(N[2]=t.createTextVNode(" История цен ",-1))]),_:1},8,["disabled"])):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)],2)])}}}),Qp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Jp(n,e){return t.openBlock(),t.createElementBlock("svg",Qp,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32",d:"M248 64C146.39 64 64 146.39 64 248s82.39 184 184 184s184-82.39 184-184S349.61 64 248 64Z"},null,-1),t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M220 220h32v116"},null,-1),t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-miterlimit":"10","stroke-width":"32",d:"M208 340h88"},null,-1),t.createElementVNode("path",{fill:"currentColor",d:"M248 130a26 26 0 1 0 26 26a26 26 0 0 0-26-26"},null,-1)])])}const ho=t.markRaw({name:"ion-information-circle-outline",render:Jp}),eg={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function tg(n,e){return t.openBlock(),t.createElementBlock("svg",eg,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M450.29 112H142c-34 0-62 27.51-62 61.33v245.34c0 33.82 28 61.33 62 61.33h308c34 0 62-26.18 62-60V173.33c0-33.82-27.68-61.33-61.71-61.33m-77.15 61.34a46 46 0 1 1-46.28 46a46.19 46.19 0 0 1 46.28-46.01Zm-231.55 276c-17 0-29.86-13.75-29.86-30.66v-64.83l90.46-80.79a46.54 46.54 0 0 1 63.44 1.83L328.27 337l-113 112.33ZM480 418.67a30.67 30.67 0 0 1-30.71 30.66H259L376.08 333a46.24 46.24 0 0 1 59.44-.16L480 370.59Z"},null,-1),t.createElementVNode("path",{fill:"currentColor",d:"M384 32H64A64 64 0 0 0 0 96v256a64.11 64.11 0 0 0 48 62V152a72 72 0 0 1 72-72h326a64.11 64.11 0 0 0-62-48"},null,-1)])])}const lc=t.markRaw({name:"ion-images",render:tg}),ng={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function ig(n,e){return t.openBlock(),t.createElementBlock("svg",ng,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M256 56C145.72 56 56 145.72 56 256s89.72 200 200 200s200-89.72 200-200S366.28 56 256 56m0 82a26 26 0 1 1-26 26a26 26 0 0 1 26-26m48 226h-88a16 16 0 0 1 0-32h28v-88h-16a16 16 0 0 1 0-32h32a16 16 0 0 1 16 16v104h28a16 16 0 0 1 0 32"},null,-1)])])}const rg=t.markRaw({name:"ion-information-circle",render:ig}),og={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function sg(n,e){return t.openBlock(),t.createElementBlock("svg",og,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M400 480a16 16 0 0 1-10.63-4L256 357.41L122.63 476A16 16 0 0 1 96 464V96a64.07 64.07 0 0 1 64-64h192a64.07 64.07 0 0 1 64 64v368a16 16 0 0 1-16 16"},null,-1)])])}const ag=t.markRaw({name:"ion-bookmark",render:sg});/*!
2
2
  * lightgallery | 2.9.0 | October 1st 2025
3
3
  * http://www.lightgalleryjs.com/
4
4
  * Copyright (c) 2020 Sachin Neravath;
@@ -37,7 +37,7 @@
37
37
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
38
38
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
39
39
  PERFORMANCE OF THIS SOFTWARE.
40
- ***************************************************************************** */var po=function(){return po=Object.assign||function(e){for(var i,r=1,o=arguments.length;r<o;r++){i=arguments[r];for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e},po.apply(this,arguments)},dg={scale:1,zoom:!0,infiniteZoom:!0,actualSize:!0,showZoomInOutIcons:!1,actualSizeIcons:{zoomIn:"lg-zoom-in",zoomOut:"lg-zoom-out"},enableZoomAfter:300,zoomPluginStrings:{zoomIn:"Zoom in",zoomOut:"Zoom out",viewActualSize:"View actual size"}},jn={containerResize:"lgContainerResize",beforeOpen:"lgBeforeOpen",afterOpen:"lgAfterOpen",slideItemLoad:"lgSlideItemLoad",afterSlide:"lgAfterSlide",rotateLeft:"lgRotateLeft",rotateRight:"lgRotateRight",flipHorizontal:"lgFlipHorizontal",flipVertical:"lgFlipVertical"},As=500,ug=(function(){function n(e,i){return this.core=e,this.$LG=i,this.settings=po(po({},dg),this.core.settings),this}return n.prototype.buildTemplates=function(){var e=this.settings.showZoomInOutIcons?'<button id="'+this.core.getIdName("lg-zoom-in")+'" type="button" aria-label="'+this.settings.zoomPluginStrings.zoomIn+'" class="lg-zoom-in lg-icon"></button><button id="'+this.core.getIdName("lg-zoom-out")+'" type="button" aria-label="'+this.settings.zoomPluginStrings.zoomOut+'" class="lg-zoom-out lg-icon"></button>':"";this.settings.actualSize&&(e+='<button id="'+this.core.getIdName("lg-actual-size")+'" type="button" aria-label="'+this.settings.zoomPluginStrings.viewActualSize+'" class="'+this.settings.actualSizeIcons.zoomIn+' lg-icon"></button>'),this.core.outer.addClass("lg-use-transition-for-zoom"),this.core.$toolbar.first().append(e)},n.prototype.enableZoom=function(e){var i=this,r=this.settings.enableZoomAfter+e.detail.delay;this.$LG("body").first().hasClass("lg-from-hash")&&e.detail.delay?r=0:this.$LG("body").first().removeClass("lg-from-hash"),this.zoomableTimeout=setTimeout(function(){i.isImageSlide(i.core.index)&&(i.core.getSlideItem(e.detail.index).addClass("lg-zoomable"),e.detail.index===i.core.index&&i.setZoomEssentials())},r+30)},n.prototype.enableZoomOnSlideItemLoad=function(){this.core.LGel.on(jn.slideItemLoad+".zoom",this.enableZoom.bind(this))},n.prototype.getDragCords=function(e){return{x:e.pageX,y:e.pageY}},n.prototype.getSwipeCords=function(e){var i=e.touches[0].pageX,r=e.touches[0].pageY;return{x:i,y:r}},n.prototype.getDragAllowedAxises=function(e,i){if(!this.containerRect)return{allowX:!1,allowY:!1};var r=this.core.getSlideItem(this.core.index).find(".lg-image").first().get(),o=0,s=0,a=r.getBoundingClientRect();e?(o=r.offsetHeight*e,s=r.offsetWidth*e):i?(o=a.height+i*a.height,s=a.width+i*a.width):(o=a.height,s=a.width);var l=o>this.containerRect.height,c=s>this.containerRect.width;return{allowX:c,allowY:l}},n.prototype.setZoomEssentials=function(){this.containerRect=this.core.$content.get().getBoundingClientRect()},n.prototype.zoomImage=function(e,i,r,o){if(!(!this.containerRect||Math.abs(i)<=0)){var s=this.containerRect.width/2+this.containerRect.left,a=this.containerRect.height/2+this.containerRect.top+this.scrollTop,l,c;e===1&&(this.positionChanged=!1);var d=this.getDragAllowedAxises(0,i),u=d.allowY,f=d.allowX;this.positionChanged&&(l=this.left/(this.scale-i),c=this.top/(this.scale-i),this.pageX=s-l,this.pageY=a-c,this.positionChanged=!1);var h=this.getPossibleSwipeDragCords(i),p,m,g=s-this.pageX,b=a-this.pageY;if(e-i>1){var y=(e-i)/Math.abs(i);g=(i<0?-g:g)+this.left*(y+(i<0?-1:1)),b=(i<0?-b:b)+this.top*(y+(i<0?-1:1)),p=g/y,m=b/y}else{var y=(e-i)*i;p=g*y,m=b*y}r&&(f?this.isBeyondPossibleLeft(p,h.minX)?p=h.minX:this.isBeyondPossibleRight(p,h.maxX)&&(p=h.maxX):e>1&&(p<h.minX?p=h.minX:p>h.maxX&&(p=h.maxX)),u?this.isBeyondPossibleTop(m,h.minY)?m=h.minY:this.isBeyondPossibleBottom(m,h.maxY)&&(m=h.maxY):e>1&&(m<h.minY?m=h.minY:m>h.maxY&&(m=h.maxY))),this.setZoomStyles({x:p,y:m,scale:e}),this.left=p,this.top=m,o&&this.setZoomImageSize()}},n.prototype.resetImageTranslate=function(e){if(this.isImageSlide(e)){var i=this.core.getSlideItem(e).find(".lg-image").first();this.imageReset=!1,i.removeClass("reset-transition reset-transition-y reset-transition-x"),this.core.outer.removeClass("lg-actual-size"),i.css("width","auto").css("height","auto"),setTimeout(function(){i.removeClass("no-transition")},10)}},n.prototype.setZoomImageSize=function(){var e=this,i=this.core.getSlideItem(this.core.index).find(".lg-image").first();setTimeout(function(){var r=e.getCurrentImageActualSizeScale();e.scale>=r&&(i.addClass("no-transition"),e.imageReset=!0)},As),setTimeout(function(){var r=e.getCurrentImageActualSizeScale();if(e.scale>=r){var o=e.getDragAllowedAxises(e.scale);i.css("width",i.get().naturalWidth+"px").css("height",i.get().naturalHeight+"px"),e.core.outer.addClass("lg-actual-size"),o.allowX&&o.allowY?i.addClass("reset-transition"):o.allowX&&!o.allowY?i.addClass("reset-transition-x"):!o.allowX&&o.allowY&&i.addClass("reset-transition-y")}},As+50)},n.prototype.setZoomStyles=function(e){var i=this.core.getSlideItem(this.core.index).find(".lg-img-wrap").first(),r=this.core.getSlideItem(this.core.index).find(".lg-image").first(),o=this.core.outer.find(".lg-current .lg-dummy-img").first();this.scale=e.scale,r.css("transform","scale3d("+e.scale+", "+e.scale+", 1)"),o.css("transform","scale3d("+e.scale+", "+e.scale+", 1)");var s="translate3d("+e.x+"px, "+e.y+"px, 0)";i.css("transform",s)},n.prototype.setActualSize=function(e,i){var r=this;if(!this.zoomInProgress){this.zoomInProgress=!0;var o=this.core.galleryItems[this.core.index];this.resetImageTranslate(e),setTimeout(function(){if(!(!o.src||r.core.outer.hasClass("lg-first-slide-loading"))){var s=r.getCurrentImageActualSizeScale(),a=r.scale;r.core.outer.hasClass("lg-zoomed")?r.scale=1:r.scale=r.getScale(s),r.setPageCords(i),r.beginZoom(r.scale),r.zoomImage(r.scale,r.scale-a,!0,!0)}},50),setTimeout(function(){r.core.outer.removeClass("lg-grabbing").addClass("lg-grab")},60),setTimeout(function(){r.zoomInProgress=!1},As+110)}},n.prototype.getNaturalWidth=function(e){var i=this.core.getSlideItem(e).find(".lg-image").first(),r=this.core.galleryItems[e].width;return r?parseFloat(r):i.get().naturalWidth},n.prototype.getActualSizeScale=function(e,i){var r,o;return e>=i?(r=e/i,o=r||2):o=1,o},n.prototype.getCurrentImageActualSizeScale=function(){var e=this.core.getSlideItem(this.core.index).find(".lg-image").first(),i=e.get().offsetWidth,r=this.getNaturalWidth(this.core.index)||i;return this.getActualSizeScale(r,i)},n.prototype.getPageCords=function(e){var i={};if(e)i.x=e.pageX||e.touches[0].pageX,i.y=e.pageY||e.touches[0].pageY;else{var r=this.core.$content.get().getBoundingClientRect();i.x=r.width/2+r.left,i.y=r.height/2+this.scrollTop+r.top}return i},n.prototype.setPageCords=function(e){var i=this.getPageCords(e);this.pageX=i.x,this.pageY=i.y},n.prototype.manageActualPixelClassNames=function(){var e=this.core.getElementById("lg-actual-size");e.removeClass(this.settings.actualSizeIcons.zoomIn).addClass(this.settings.actualSizeIcons.zoomOut)},n.prototype.beginZoom=function(e){return this.core.outer.removeClass("lg-zoom-drag-transition lg-zoom-dragging"),e>1?(this.core.outer.addClass("lg-zoomed"),this.manageActualPixelClassNames()):this.resetZoom(),e>1},n.prototype.getScale=function(e){var i=this.getCurrentImageActualSizeScale();return e<1?e=1:e>i&&(e=i),e},n.prototype.init=function(){var e=this;if(this.settings.zoom){this.buildTemplates(),this.enableZoomOnSlideItemLoad();var i=null;this.core.outer.on("dblclick.lg",function(r){e.$LG(r.target).hasClass("lg-image")&&e.setActualSize(e.core.index,r)}),this.core.outer.on("touchstart.lg",function(r){var o=e.$LG(r.target);r.touches.length===1&&o.hasClass("lg-image")&&(i?(clearTimeout(i),i=null,r.preventDefault(),e.setActualSize(e.core.index,r)):i=setTimeout(function(){i=null},300))}),this.core.LGel.on(jn.containerResize+".zoom "+jn.rotateRight+".zoom "+jn.rotateLeft+".zoom "+jn.flipHorizontal+".zoom "+jn.flipVertical+".zoom",function(){if(!(!e.core.lgOpened||!e.isImageSlide(e.core.index)||e.core.touchAction)){var r=e.core.getSlideItem(e.core.index).find(".lg-img-wrap").first();e.top=0,e.left=0,e.setZoomEssentials(),e.setZoomSwipeStyles(r,{x:0,y:0}),e.positionChanged=!0}}),this.$LG(window).on("scroll.lg.zoom.global"+this.core.lgId,function(){e.core.lgOpened&&(e.scrollTop=e.$LG(window).scrollTop())}),this.core.getElementById("lg-zoom-out").on("click.lg",function(){if(e.isImageSlide(e.core.index)){var r=0;e.imageReset&&(e.resetImageTranslate(e.core.index),r=50),setTimeout(function(){var o=e.scale-e.settings.scale;o<1&&(o=1),e.beginZoom(o),e.zoomImage(o,-e.settings.scale,!0,!e.settings.infiniteZoom)},r)}}),this.core.getElementById("lg-zoom-in").on("click.lg",function(){e.zoomIn()}),this.core.getElementById("lg-actual-size").on("click.lg",function(){e.setActualSize(e.core.index)}),this.core.LGel.on(jn.beforeOpen+".zoom",function(){e.core.outer.find(".lg-item").removeClass("lg-zoomable")}),this.core.LGel.on(jn.afterOpen+".zoom",function(){e.scrollTop=e.$LG(window).scrollTop(),e.pageX=e.core.outer.width()/2,e.pageY=e.core.outer.height()/2+e.scrollTop,e.scale=1}),this.core.LGel.on(jn.afterSlide+".zoom",function(r){var o=r.detail.prevIndex;e.scale=1,e.positionChanged=!1,e.zoomInProgress=!1,e.resetZoom(o),e.resetImageTranslate(o),e.isImageSlide(e.core.index)&&e.setZoomEssentials()}),this.zoomDrag(),this.pinchZoom(),this.zoomSwipe(),this.zoomableTimeout=!1,this.positionChanged=!1,this.zoomInProgress=!1}},n.prototype.zoomIn=function(){if(this.isImageSlide(this.core.index)){var e=this.scale+this.settings.scale;this.settings.infiniteZoom||(e=this.getScale(e)),this.beginZoom(e),this.zoomImage(e,Math.min(this.settings.scale,e-this.scale),!0,!this.settings.infiniteZoom)}},n.prototype.resetZoom=function(e){this.core.outer.removeClass("lg-zoomed lg-zoom-drag-transition");var i=this.core.getElementById("lg-actual-size"),r=this.core.getSlideItem(e!==void 0?e:this.core.index);i.removeClass(this.settings.actualSizeIcons.zoomOut).addClass(this.settings.actualSizeIcons.zoomIn),r.find(".lg-img-wrap").first().removeAttr("style"),r.find(".lg-image").first().removeAttr("style"),this.scale=1,this.left=0,this.top=0,this.setPageCords()},n.prototype.getTouchDistance=function(e){return Math.sqrt((e.touches[0].pageX-e.touches[1].pageX)*(e.touches[0].pageX-e.touches[1].pageX)+(e.touches[0].pageY-e.touches[1].pageY)*(e.touches[0].pageY-e.touches[1].pageY))},n.prototype.pinchZoom=function(){var e=this,i=0,r=!1,o=1,s=0,a=this.core.getSlideItem(this.core.index);this.core.outer.on("touchstart.lg",function(l){if(a=e.core.getSlideItem(e.core.index),!!e.isImageSlide(e.core.index)&&l.touches.length===2){if(l.preventDefault(),e.core.outer.hasClass("lg-first-slide-loading"))return;o=e.scale||1,e.core.outer.removeClass("lg-zoom-drag-transition lg-zoom-dragging"),e.setPageCords(l),e.resetImageTranslate(e.core.index),e.core.touchAction="pinch",i=e.getTouchDistance(l)}}),this.core.$inner.on("touchmove.lg",function(l){if(l.touches.length===2&&e.core.touchAction==="pinch"&&(e.$LG(l.target).hasClass("lg-item")||a.get().contains(l.target))){l.preventDefault();var c=e.getTouchDistance(l),d=i-c;if(!r&&Math.abs(d)>5&&(r=!0),r){s=e.scale;var u=Math.max(1,o+-d*.02);e.scale=Math.round((u+Number.EPSILON)*100)/100;var f=e.scale-s;e.zoomImage(e.scale,Math.round((f+Number.EPSILON)*100)/100,!1,!1)}}}),this.core.$inner.on("touchend.lg",function(l){if(e.core.touchAction==="pinch"&&(e.$LG(l.target).hasClass("lg-item")||a.get().contains(l.target))){if(r=!1,i=0,e.scale<=1)e.resetZoom();else{var c=e.getCurrentImageActualSizeScale();if(e.scale>=c){var d=c-e.scale;d===0&&(d=.01),e.zoomImage(c,d,!1,!0)}e.manageActualPixelClassNames(),e.core.outer.addClass("lg-zoomed")}e.core.touchAction=void 0}})},n.prototype.touchendZoom=function(e,i,r,o,s){var a=i.x-e.x,l=i.y-e.y,c=Math.abs(a)/s+1,d=Math.abs(l)/s+1;c>2&&(c+=1),d>2&&(d+=1),a=a*c,l=l*d;var u=this.core.getSlideItem(this.core.index).find(".lg-img-wrap").first(),f={};f.x=this.left+a,f.y=this.top+l;var h=this.getPossibleSwipeDragCords();(Math.abs(a)>15||Math.abs(l)>15)&&(o&&(this.isBeyondPossibleTop(f.y,h.minY)?f.y=h.minY:this.isBeyondPossibleBottom(f.y,h.maxY)&&(f.y=h.maxY)),r&&(this.isBeyondPossibleLeft(f.x,h.minX)?f.x=h.minX:this.isBeyondPossibleRight(f.x,h.maxX)&&(f.x=h.maxX)),o?this.top=f.y:f.y=this.top,r?this.left=f.x:f.x=this.left,this.setZoomSwipeStyles(u,f),this.positionChanged=!0)},n.prototype.getZoomSwipeCords=function(e,i,r,o,s){var a={};if(o){if(a.y=this.top+(i.y-e.y),this.isBeyondPossibleTop(a.y,s.minY)){var l=s.minY-a.y;a.y=s.minY-l/6}else if(this.isBeyondPossibleBottom(a.y,s.maxY)){var c=a.y-s.maxY;a.y=s.maxY+c/6}}else a.y=this.top;if(r){if(a.x=this.left+(i.x-e.x),this.isBeyondPossibleLeft(a.x,s.minX)){var d=s.minX-a.x;a.x=s.minX-d/6}else if(this.isBeyondPossibleRight(a.x,s.maxX)){var u=a.x-s.maxX;a.x=s.maxX+u/6}}else a.x=this.left;return a},n.prototype.isBeyondPossibleLeft=function(e,i){return e>=i},n.prototype.isBeyondPossibleRight=function(e,i){return e<=i},n.prototype.isBeyondPossibleTop=function(e,i){return e>=i},n.prototype.isBeyondPossibleBottom=function(e,i){return e<=i},n.prototype.isImageSlide=function(e){var i=this.core.galleryItems[e];return this.core.getSlideType(i)==="image"},n.prototype.getPossibleSwipeDragCords=function(e){var i=this.core.getSlideItem(this.core.index).find(".lg-image").first(),r=this.core.mediaContainerPosition.bottom,o=i.get().getBoundingClientRect(),s=o.height,a=o.width;e&&(s=s+e*s,a=a+e*a);var l=(s-this.containerRect.height)/2,c=(this.containerRect.height-s)/2+r,d=(a-this.containerRect.width)/2,u=(this.containerRect.width-a)/2,f={minY:l,maxY:c,minX:d,maxX:u};return f},n.prototype.setZoomSwipeStyles=function(e,i){e.css("transform","translate3d("+i.x+"px, "+i.y+"px, 0)")},n.prototype.zoomSwipe=function(){var e=this,i={},r={},o=!1,s=!1,a=!1,l=new Date,c=new Date,d,u,f=this.core.getSlideItem(this.core.index);this.core.$inner.on("touchstart.lg",function(h){if(e.isImageSlide(e.core.index)&&(f=e.core.getSlideItem(e.core.index),(e.$LG(h.target).hasClass("lg-item")||f.get().contains(h.target))&&h.touches.length===1&&e.core.outer.hasClass("lg-zoomed"))){h.preventDefault(),l=new Date,e.core.touchAction="zoomSwipe",u=e.core.getSlideItem(e.core.index).find(".lg-img-wrap").first();var p=e.getDragAllowedAxises(0);a=p.allowY,s=p.allowX,(s||a)&&(i=e.getSwipeCords(h)),d=e.getPossibleSwipeDragCords(),e.core.outer.addClass("lg-zoom-dragging lg-zoom-drag-transition")}}),this.core.$inner.on("touchmove.lg",function(h){if(h.touches.length===1&&e.core.touchAction==="zoomSwipe"&&(e.$LG(h.target).hasClass("lg-item")||f.get().contains(h.target))){h.preventDefault(),e.core.touchAction="zoomSwipe",r=e.getSwipeCords(h);var p=e.getZoomSwipeCords(i,r,s,a,d);(Math.abs(r.x-i.x)>15||Math.abs(r.y-i.y)>15)&&(o=!0,e.setZoomSwipeStyles(u,p))}}),this.core.$inner.on("touchend.lg",function(h){if(e.core.touchAction==="zoomSwipe"&&(e.$LG(h.target).hasClass("lg-item")||f.get().contains(h.target))){if(h.preventDefault(),e.core.touchAction=void 0,e.core.outer.removeClass("lg-zoom-dragging"),!o)return;o=!1,c=new Date;var p=c.valueOf()-l.valueOf();e.touchendZoom(i,r,s,a,p)}})},n.prototype.zoomDrag=function(){var e=this,i={},r={},o=!1,s=!1,a=!1,l=!1,c,d,u,f;this.core.outer.on("mousedown.lg.zoom",function(h){if(e.isImageSlide(e.core.index)){var p=e.core.getSlideItem(e.core.index);if(e.$LG(h.target).hasClass("lg-item")||p.get().contains(h.target)){c=new Date,f=e.core.getSlideItem(e.core.index).find(".lg-img-wrap").first();var m=e.getDragAllowedAxises(0);l=m.allowY,a=m.allowX,e.core.outer.hasClass("lg-zoomed")&&e.$LG(h.target).hasClass("lg-object")&&(a||l)&&(h.preventDefault(),i=e.getDragCords(h),u=e.getPossibleSwipeDragCords(),o=!0,e.core.outer.removeClass("lg-grab").addClass("lg-grabbing lg-zoom-drag-transition lg-zoom-dragging"))}}}),this.$LG(window).on("mousemove.lg.zoom.global"+this.core.lgId,function(h){if(o){s=!0,r=e.getDragCords(h);var p=e.getZoomSwipeCords(i,r,a,l,u);e.setZoomSwipeStyles(f,p)}}),this.$LG(window).on("mouseup.lg.zoom.global"+this.core.lgId,function(h){if(o){if(d=new Date,o=!1,e.core.outer.removeClass("lg-zoom-dragging"),s&&(i.x!==r.x||i.y!==r.y)){r=e.getDragCords(h);var p=d.valueOf()-c.valueOf();e.touchendZoom(i,r,a,l,p)}s=!1}e.core.outer.removeClass("lg-grabbing").addClass("lg-grab")})},n.prototype.closeGallery=function(){this.resetZoom(),this.zoomInProgress=!1},n.prototype.destroy=function(){this.$LG(window).off(".lg.zoom.global"+this.core.lgId),this.core.LGel.off(".lg.zoom"),this.core.LGel.off(".zoom"),clearTimeout(this.zoomableTimeout),this.zoomableTimeout=!1},n})();const fg={ref:"gallery-container",class:"lightgallery-wrapper"},hg={},cc=t.defineComponent({...hg,__name:"lightgallery",props:{settings:{},onAfterAppendSlide:{type:Function},onInit:{type:Function},onHasVideo:{type:Function},onContainerResize:{type:Function},onAfterAppendSubHtml:{type:Function},onBeforeOpen:{type:Function},onAfterOpen:{type:Function},onSlideItemLoad:{type:Function},onBeforeSlide:{type:Function},onAfterSlide:{type:Function},onPosterClick:{type:Function},onDragStart:{type:Function},onDragMove:{type:Function},onDragEnd:{type:Function},onBeforeNextSlide:{type:Function},onBeforePrevSlide:{type:Function},onBeforeClose:{type:Function},onAfterClose:{type:Function},onRotateLeft:{type:Function},onRotateRight:{type:Function},onFlipHorizontal:{type:Function},onFlipVertical:{type:Function}},setup(n){const e=n,i={lgAfterAppendSlide:e.onAfterAppendSlide,lgInit:e.onInit,lgHasVideo:e.onHasVideo,lgContainerResize:e.onContainerResize,lgAfterAppendSubHtml:e.onAfterAppendSubHtml,lgBeforeOpen:e.onBeforeOpen,lgAfterOpen:e.onAfterOpen,lgSlideItemLoad:e.onSlideItemLoad,lgBeforeSlide:e.onBeforeSlide,lgAfterSlide:e.onAfterSlide,lgPosterClick:e.onPosterClick,lgDragStart:e.onDragStart,lgDragMove:e.onDragMove,lgDragEnd:e.onDragEnd,lgBeforeNextSlide:e.onBeforeNextSlide,lgBeforePrevSlide:e.onBeforePrevSlide,lgBeforeClose:e.onBeforeClose,lgAfterClose:e.onAfterClose,lgRotateLeft:e.onRotateLeft,lgRotateRight:e.onRotateRight,lgFlipHorizontal:e.onFlipHorizontal,lgFlipVertical:e.onFlipVertical},r=t.useTemplateRef("gallery-container"),o=t.ref(null);return t.onMounted(async()=>{if(!r.value)return;const s=await import("lightgallery");o.value=s.default(r.value,{...e.settings}),V.forOwn(i,(a,l)=>{var c;a&&((c=r.value)==null||c.addEventListener(l,a))})}),t.onBeforeUnmount(()=>{var s;o.value&&((s=o.value)==null||s.destroy(),o.value=null)}),(s,a)=>(t.openBlock(),t.createElementBlock("div",fg,[t.renderSlot(s.$slots,"default")],512))}}),mg=["href"],pg=["src","alt"],gg={},dc=t.defineComponent({...gg,__name:"image-gallery",props:{images:{}},setup(n,{expose:e}){const i=t.ref(!1),r=t.ref(!1),o=t.ref({plugins:[cg,ug],addClass:"sc-lg-container",licenseKey:"0000-0000-000-0000",strings:{closeGallery:"Закрыть",download:"Скачать",mediaLoadingFailed:"Ошибка загрузки контента...",nextSlide:"Следующее изображение",playVideo:"Воспроизвести видео",previousSlide:"Предыдущее изображение",toggleMaximize:"Расширить"}}),s=()=>window.innerWidth*(Ue.getDeviceTypeByResolution()===Xe.phone?.7:.8),a=t.ref(s()),l=()=>{a.value=s()},c=()=>{i.value=!0};return t.onUnmounted(()=>{window.removeEventListener("resize",l)}),e({show:c}),window.addEventListener("resize",l),(d,u)=>{const f=lc,h=I.NPopover;return t.openBlock(),t.createBlock(h,{trigger:"manual",show:i.value,class:"sc-image",placement:"top-start",onClickoutside:u[3]||(u[3]=()=>{r.value||(i.value=!1)})},{trigger:t.withCtx(()=>[t.createElementVNode("div",{class:"inline-flex",onClick:u[0]||(u[0]=p=>i.value=!i.value)},[t.renderSlot(d.$slots,"default",{},()=>[t.createVNode(f)])])]),default:t.withCtx(()=>[t.createVNode(cc,{settings:o.value,style:t.normalizeStyle(`max-width: ${a.value}px`),class:"flex flex-row overflow-x-scroll",onAfterOpen:u[1]||(u[1]=()=>{r.value=!0}),onAfterClose:u[2]||(u[2]=()=>{r.value=!1,i.value=!1})},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.images,(p,m)=>(t.openBlock(),t.createElementBlock("a",{key:m,href:p.image},[t.createElementVNode("img",{src:p.preview,alt:`Изображение #${m+1}`},null,8,pg)],8,mg))),128))]),_:1},8,["settings","style"])]),_:3},8,["show"])}}}),yg={class:"text-sm grid grid-cols-[auto_auto] gap-x-3 gap-y-1 items-baseline"},bg={class:"pr-3"},_g={class:"text-right"},wg={},xg=t.defineComponent({...wg,__name:"product-stock-count",props:{product:{}},setup(n){return(e,i)=>{const r=ho,o=I.NPopover;return t.openBlock(),t.createBlock(o,{trigger:"click",placement:"top-start",class:"sc-stock-count"},{trigger:t.withCtx(()=>[t.renderSlot(e.$slots,"default",{},()=>[t.createVNode(r)])]),default:t.withCtx(()=>[t.createElementVNode("div",yg,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.product.stockCount,(s,a)=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:a},[t.createElementVNode("span",bg,t.toDisplayString(s.warehouse.name),1),t.createElementVNode("span",_g,[t.createTextVNode(t.toDisplayString(s.count??"В наличии")+" ",1),s.count?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createTextVNode(t.toDisplayString(n.product.unit.name),1)],64)):t.createCommentVNode("",!0)])],64))),128))])]),_:3})}}}),kg=["innerHTML"],Cg=["innerHTML"],vg={class:"m-0 flex list-none flex-col gap-1 p-0 text-sm"},Sg=["href"],Bg={key:1,class:"text-sm text-gray-500"},Ng={},Os=t.defineComponent({...Ng,__name:"product-info-content",props:{product:{},size:{default:"medium"},maxHeight:{default:void 0},activeTab:{default:void 0}},setup(n){const e=n,i=t.computed(()=>e.maxHeight?{maxHeight:e.maxHeight}:void 0),r=t.computed(()=>{var c;return((c=e.product.properties)==null?void 0:c.description)??""}),o=t.computed(()=>{var c;return((c=e.product.properties)==null?void 0:c.specification)??""}),s=t.computed(()=>Ms(e.product)),a=t.computed(()=>[r.value?"description":null,o.value?"specification":null,s.value.length>0?"files":null].filter(c=>c!==null)),l=t.ref(e.activeTab&&a.value.includes(e.activeTab)?e.activeTab:a.value[0]);return(c,d)=>{const u=I.NScrollbar,f=I.NTabPane,h=I.NTabs;return a.value.length>0?(t.openBlock(),t.createBlock(h,{key:0,value:l.value,"onUpdate:value":d[0]||(d[0]=p=>l.value=p),size:n.size,type:"line",class:"sc-product-info-content"},{default:t.withCtx(()=>[r.value?(t.openBlock(),t.createBlock(f,{key:0,name:"description",tab:"Описание"},{default:t.withCtx(()=>[t.createVNode(u,{style:t.normalizeStyle(i.value)},{default:t.withCtx(()=>[t.createElementVNode("div",{class:"sc-product-info-html",innerHTML:r.value},null,8,kg)]),_:1},8,["style"])]),_:1})):t.createCommentVNode("",!0),o.value?(t.openBlock(),t.createBlock(f,{key:1,name:"specification",tab:"Характеристики"},{default:t.withCtx(()=>[t.createVNode(u,{style:t.normalizeStyle(i.value)},{default:t.withCtx(()=>[t.createElementVNode("div",{class:"sc-product-info-html",innerHTML:o.value},null,8,Cg)]),_:1},8,["style"])]),_:1})):t.createCommentVNode("",!0),s.value.length>0?(t.openBlock(),t.createBlock(f,{key:2,name:"files",tab:`Файлы (${s.value.length})`},{default:t.withCtx(()=>[t.createVNode(u,{style:t.normalizeStyle(i.value)},{default:t.withCtx(()=>[t.createElementVNode("ul",vg,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(s.value,p=>(t.openBlock(),t.createElementBlock("li",{key:p.id},[t.createElementVNode("a",{href:p.url,target:"_blank",rel:"noopener"},t.toDisplayString(p.typeName),9,Sg)]))),128))])]),_:1},8,["style"])]),_:1},8,["tab"])):t.createCommentVNode("",!0)]),_:1},8,["value","size"])):(t.openBlock(),t.createElementBlock("span",Bg," Описание, характеристики и файлы не заданы. "))}}}),Tg={key:0,class:"flex flex-row gap-2.5"},$g={key:1,class:"flex flex-row flex-wrap justify-end gap-2.5"},Eg={},zs=t.defineComponent({...Eg,__name:"base-dialog",props:{show:{type:Boolean},title:{},sizes:{default:()=>({phone:{size:"small",scale:.98},tablet:{size:"small",scale:.9},default:{size:"medium",scale:.7}})},modalWidth:{default:void 0},processing:{type:Boolean,default:!1},valid:{type:Boolean,default:!0},acceptButton:{default:()=>({show:!0,text:"ОК"})},cancelButton:{default:()=>({show:!0,text:"Отмена"})},trapFocus:{type:Boolean,default:!0}},emits:["update:show","opening","closing","accept","processing:cancel"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.ref(r.show),a=t.ref(r.processing),l=Ue.initRefDependingOnDeviceResolution(r.sizes.phone.size,r.sizes.tablet.size,r.sizes.default.size),c=Ue.initRefDependingOnDeviceResolution(r.sizes.phone.scale,r.sizes.tablet.scale,r.sizes.default.scale),d=t.computed(()=>r.modalWidth??window.innerWidth*c.value),u=()=>{o("opening"),s.value=!0,o("update:show",s.value)},f=(p="other",m=!1)=>{if(a.value&&!m){o("processing:cancel",_=>{a.value=_});return}let g=!1;o("closing",p,()=>{g=!0}),g||(s.value=!1,o("update:show",s.value))},h=()=>{o("accept",m=>{a.value=m})};return t.watch(()=>r.show,p=>{p?u():f("other",!0)}),t.watch(()=>r.processing,p=>{a.value=p}),e({open:u,close:f,acceptHandler:h}),(p,m)=>{const g=I.NButton,b=I.NModal;return t.openBlock(),t.createBlock(b,{loading:a.value,show:s.value,"show-icon":!1,size:t.unref(l),style:t.normalizeStyle(`width: ${d.value}px`),title:n.title,"trap-focus":n.trapFocus??!0,"action-class":p.$slots["extra-action"]?"grid grid-cols-2 !justify-between":void 0,preset:"dialog",onClose:m[1]||(m[1]=y=>f("header")),onEsc:m[2]||(m[2]=y=>f("esc")),onMaskClick:m[3]||(m[3]=y=>f("mask"))},t.createSlots({default:t.withCtx(()=>[t.renderSlot(p.$slots,"default")]),_:2},[p.$slots.header?{name:"header",fn:t.withCtx(()=>[t.renderSlot(p.$slots,"header")]),key:"0"}:void 0,p.$slots.action||p.$slots["extra-action"]||n.acceptButton.show||n.cancelButton.show?{name:"action",fn:t.withCtx(()=>[p.$slots["extra-action"]?(t.openBlock(),t.createElementBlock("div",Tg,[t.renderSlot(p.$slots,"extra-action")])):t.createCommentVNode("",!0),p.$slots.action||n.acceptButton.show||n.cancelButton.show?(t.openBlock(),t.createElementBlock("div",$g,[t.renderSlot(p.$slots,"action",{disabled:a.value}),n.acceptButton.show??!0?(t.openBlock(),t.createBlock(g,{key:0,disabled:a.value||!n.valid,loading:a.value,size:t.unref(l),type:"primary",onClick:h},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(n.acceptButton.text??"ОК"),1)]),_:1},8,["disabled","loading","size"])):t.createCommentVNode("",!0),n.cancelButton.show??!0?(t.openBlock(),t.createBlock(g,{key:1,disabled:a.value,size:t.unref(l),type:"default",onClick:m[0]||(m[0]=y=>f("footer"))},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(n.cancelButton.text??"Отмена"),1)]),_:1},8,["disabled","size"])):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)]),key:"1"}:void 0]),1032,["loading","show","size","style","title","trap-focus","action-class"])}}}),Rg={class:"flex flex-col gap-3"},Pg={class:"text-xs text-gray-500"},Fg={},uc=t.defineComponent({...Fg,__name:"product-info-dialog",props:{product:{},show:{type:Boolean,default:!1},activeTab:{default:void 0}},emits:["update:show"],setup(n,{emit:e}){const i=e,r=()=>{i("update:show",!1)};return(o,s)=>(t.openBlock(),t.createBlock(zs,{show:n.show,title:n.product.name,"accept-button":{show:!1},"cancel-button":{show:!0,text:"Закрыть"},"trap-focus":!1,onClosing:r},{default:t.withCtx(()=>[t.createElementVNode("div",Rg,[t.createElementVNode("span",Pg,"Артикул: "+t.toDisplayString(n.product.code),1),t.createVNode(Os,{product:n.product,"active-tab":n.activeTab,"max-height":"60vh"},null,8,["product","active-tab"])])]),_:1},8,["show","title"]))}}),Vg={class:"flex flex-col gap-2"},Mg={class:"flex justify-end border-0 border-t border-solid border-gray-200 pt-2"},Ig={},fc=t.defineComponent({...Ig,__name:"product-info-popover",props:{product:{}},setup(n){const e=t.ref(!1),i=t.ref(!1),r=t.ref(!1),o=()=>{e.value=!1,i.value=!0,r.value=!0};return(s,a)=>{const l=ho,c=I.NButton,d=I.NPopover;return t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createVNode(d,{show:e.value,"onUpdate:show":a[0]||(a[0]=u=>e.value=u),width:560,style:{maxWidth:"calc(100vw - 2rem)"},trigger:"click",placement:"bottom-start",class:"sc-product-info-popover"},{trigger:t.withCtx(()=>[t.renderSlot(s.$slots,"default",{},()=>[t.createVNode(l,{title:"Описание и характеристики",class:"cursor-pointer"})])]),default:t.withCtx(()=>[t.createElementVNode("div",Vg,[t.createVNode(Os,{product:n.product,size:"small","max-height":"16rem"},null,8,["product"]),t.createElementVNode("div",Mg,[t.createVNode(c,{text:"",type:"info",size:"small",onClick:o},{default:t.withCtx(()=>[...a[2]||(a[2]=[t.createTextVNode(" Открыть полностью ",-1)])]),_:1})])])]),_:3},8,["show"]),i.value?(t.openBlock(),t.createBlock(uc,{key:0,show:r.value,"onUpdate:show":a[1]||(a[1]=u=>r.value=u),product:n.product},null,8,["show","product"])):t.createCommentVNode("",!0)],64)}}}),Ag={class:"flex flex-row justify-between"},Og={key:0,class:"inline-flex flex-row gap-0.5 mr-2 align-sub"},zg={key:1},Dg={class:"ml-2 align-sub"},Lg={class:"flex cursor-pointer flex-row gap-2 whitespace-nowrap"},Hg={key:2,class:"ml-2 align-sub"},Wg={class:"@container"},jg={class:"text-sc-dark-grey @sm:grid-cols-2 @2xl:grid-cols-3 grid grid-cols-1 gap-1 text-sm"},qg={key:0,class:"sc-supplier-sku col-span-2 whitespace-nowrap text-wrap sm:col-span-3"},Xg={class:"text-sc-dark-grey"},Yg={key:1,class:"sc-product-code col-start-1 whitespace-nowrap"},Ug={class:"text-gray-600"},Kg={class:"flex cursor-pointer flex-row gap-1 whitespace-nowrap"},Gg={key:3,class:"underline decoration-dashed"},Zg={key:4,class:"sc-product-pack whitespace-nowrap"},Qg={class:"text-gray-600"},Jg={key:5,class:"sc-product-planning-incoming-date col-span-2 col-start-1 mt-1.5 text-wrap"},ey={class:"text-gray-600"},ty={key:0,class:"mt-3 flex flex-row gap-3 pb-2 text-base xl:text-lg"},ny={key:0},iy={class:"sc-product-properties m-0 mt-3 list-inside list-disc p-0 pl-1.5 text-xs text-gray-500"},ry={},go=t.defineComponent({...ry,__name:"product-name",props:{product:{},eventEmitter:{},showSlugs:{type:Boolean,default:!1},showProperties:{type:Boolean,default:!1},showCode:{type:Boolean,default:!0},showProductCosts:{type:[Boolean,Function],default:!1},showPlanningDates:{type:Boolean,default:!0},showProductInfoButton:{type:[Boolean,Function],default:!1},showPriceHistory:{type:Boolean,default:!1},showCostDate:{type:Boolean,default:!1},allowNameClick:{type:[Boolean,Function],default:!1},allowPriceClick:{type:[Boolean,Function],default:!1},currencyRates:{default:void 0},showAdditionalSaleIcon:{type:Boolean,default:!1},showProductAddToCartButton:{type:[Boolean,String,Function],default:!1},showProductEditButton:{type:[Boolean,String,Function],default:!1},showProductRequiredButton:{type:[Boolean,String,Function],default:!1},productContextButtonsConfig:{type:Function,default:void 0}},setup(n,{expose:e}){const i=n,r=t.computed(()=>V.isFunction(i.showProductCosts)?i.showProductCosts(i.product):i.showProductCosts),o=t.computed(()=>V.sortBy(i.product.priceCoefficients,["coefficient.slug"])),s=t.computed(()=>{var h,p;return(p=(h=i.product)==null?void 0:h.properties)==null?void 0:p.planingIncomingDate}),a=t.useTemplateRef("image-gallery"),l=()=>{var h;(h=a.value)==null||h.show()},c=t.computed(()=>V.isFunction(i.allowNameClick)?i.allowNameClick(i.product):i.allowNameClick),d=t.computed(()=>(V.isFunction(i.showProductInfoButton)?i.showProductInfoButton(i.product):i.showProductInfoButton)&&tc(i.product)),u=t.computed(()=>{var h;return i.showProductAddToCartButton||i.showProductEditButton||i.showProductRequiredButton||(((h=i.productContextButtonsConfig)==null?void 0:h.length)??0)>0}),f=()=>{var h;c.value&&((h=i.eventEmitter)==null||h.emit("product:name-click",{product:i.product,exposedMethods:{showProductImagesPreview:l}}))};return e({showProductImagesPreview:l}),(h,p)=>{var k,$,v,E;const m=ag,g=I.NTooltip,b=sc,y=rg,_=lc,x=I.NText,w=ac,C=ho,N=I.NScrollbar;return t.openBlock(),t.createElementBlock("div",null,[t.createElementVNode("div",Ag,[t.createVNode(x,{type:"info",class:"sc-product-name text-balance text-base font-medium text-black"},{default:t.withCtx(()=>{var P,F,R,M;return[(P=n.product)!=null&&P.isFavorite||(F=n.product)!=null&&F.isPreviouslyOrdered||n.showAdditionalSaleIcon?(t.openBlock(),t.createElementBlock("div",Og,[((R=n.product)==null?void 0:R.isFavorite)??!1?(t.openBlock(),t.createBlock(g,{key:0,placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>[t.createVNode(m,{class:"!text-yellow-300"})]),default:t.withCtx(()=>[p[0]||(p[0]=t.createTextVNode(" Избранный товар ",-1))]),_:1})):t.createCommentVNode("",!0),((M=n.product)==null?void 0:M.isPreviouslyOrdered)??!1?(t.openBlock(),t.createBlock(g,{key:1,placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>[t.createVNode(b,{class:"!text-green-700"})]),default:t.withCtx(()=>[p[1]||(p[1]=t.createTextVNode(" Ранее заказанный товар ",-1))]),_:1})):t.createCommentVNode("",!0),n.showAdditionalSaleIcon?(t.openBlock(),t.createBlock(g,{key:2,placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>[t.createVNode(y,{class:"!text-green-500"})]),default:t.withCtx(()=>[p[2]||(p[2]=t.createTextVNode(" Дополнительная продажа ",-1))]),_:1})):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),t.createElementVNode("span",{class:t.normalizeClass({"cursor-pointer":c.value&&n.eventEmitter,"text-gray-400 line-through":n.product.isHidden}),onClick:f},t.toDisplayString(n.product.name),3),n.product.onOrder?(t.openBlock(),t.createElementBlock("span",zg," [Под заказ] ")):t.createCommentVNode("",!0),t.createElementVNode("span",Dg,[n.product.images&&n.product.images.length>0?(t.openBlock(),t.createBlock(dc,{key:0,ref:"image-gallery",images:n.product.images},{default:t.withCtx(()=>[t.createElementVNode("div",Lg,[t.createVNode(_)])]),_:1},8,["images"])):t.createCommentVNode("",!0)]),d.value?(t.openBlock(),t.createElementBlock("span",Hg,[t.createVNode(fc,{product:n.product},null,8,["product"])])):t.createCommentVNode("",!0)]}),_:1}),u.value?(t.openBlock(),t.createBlock(w,{key:0,product:n.product,"event-emitter":n.eventEmitter,"show-product-add-to-cart-button":n.showProductAddToCartButton,"show-product-edit-button":n.showProductEditButton,"show-product-required-button":n.showProductRequiredButton,"product-context-buttons-config":n.productContextButtonsConfig},null,8,["product","event-emitter","show-product-add-to-cart-button","show-product-edit-button","show-product-required-button","product-context-buttons-config"])):t.createCommentVNode("",!0)]),t.createElementVNode("div",Wg,[t.createElementVNode("div",jg,[n.product.supplierSku?(t.openBlock(),t.createElementBlock("div",qg,[p[3]||(p[3]=t.createTextVNode(" Артикул производителя/поставщика: ",-1)),t.createElementVNode("span",Xg,t.toDisplayString(n.product.supplierSku),1)])):t.createCommentVNode("",!0),n.showCode?(t.openBlock(),t.createElementBlock("span",Yg,[p[4]||(p[4]=t.createTextVNode(" Артикул: ",-1)),t.createElementVNode("span",Ug,t.toDisplayString(n.product.code),1)])):t.createCommentVNode("",!0),n.product.stockCount&&n.product.stockCount.length>0?(t.openBlock(),t.createBlock(xg,{key:2,product:n.product},{default:t.withCtx(()=>[t.createElementVNode("span",Kg,[p[5]||(p[5]=t.createElementVNode("span",{class:"underline decoration-dashed"},"В наличии",-1)),t.createVNode(C,{class:"mt-0.5"})])]),_:1},8,["product"])):(t.openBlock(),t.createElementBlock("span",Gg," Нет в наличии ")),n.product.pack??(($=(k=n.product)==null?void 0:k.properties)==null?void 0:$.pack)?(t.openBlock(),t.createElementBlock("span",Zg,[p[6]||(p[6]=t.createTextVNode(" Норма упаковки: ",-1)),t.createElementVNode("span",Qg,t.toDisplayString(n.product.pack??((E=(v=n.product)==null?void 0:v.properties)==null?void 0:E.pack)),1)])):t.createCommentVNode("",!0),n.showPlanningDates&&s.value?(t.openBlock(),t.createElementBlock("span",Jg,[p[7]||(p[7]=t.createTextVNode(" Планируемая дата поступления на основной склад: ",-1)),t.createElementVNode("span",ey,t.toDisplayString(s.value),1)])):t.createCommentVNode("",!0)])]),t.createVNode(N,{"x-scrollable":""},{default:t.withCtx(()=>[r.value?(t.openBlock(),t.createElementBlock("div",ty,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.value,P=>(t.openBlock(),t.createBlock(ci,{key:P.coefficient.slug,product:n.product,"cost-field-name":P.coefficient.slug??"","event-emitter":n.eventEmitter,"allow-price-click":n.allowPriceClick,"show-tag":!0,"show-price-history":n.showPriceHistory,"currency-rates":n.currencyRates},null,8,["product","cost-field-name","event-emitter","allow-price-click","show-price-history","currency-rates"]))),128)),t.createVNode(ci,{product:n.product,"event-emitter":n.eventEmitter,"allow-price-click":n.allowPriceClick,"show-tag":!0,"show-quantity-unit":!0,"show-cost-date":n.showCostDate,"show-price-history":n.showPriceHistory,"currency-rates":n.currencyRates,"cost-field-name":"cost","additional-through-field-name":"retailCost",style:{"background-color":"var(--n-merged-td-color)"},class:"sticky right-0 border-0 border-l-2 border-solid border-gray-300 pl-2"},null,8,["product","event-emitter","allow-price-click","show-cost-date","show-price-history","currency-rates"])])):t.createCommentVNode("",!0)]),_:1}),n.showSlugs||n.showProperties?(t.openBlock(),t.createElementBlock("div",ny,[t.createElementVNode("ul",iy,[n.showSlugs?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList({id:n.product.id,slug:n.product.slug},(P,F)=>(t.openBlock(),t.createElementBlock("li",{key:F}," ("+t.toDisplayString(F)+"): "+t.toDisplayString(P),1))),128)):t.createCommentVNode("",!0),n.showProperties?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:1},t.renderList(n.product.properties,(P,F)=>(t.openBlock(),t.createElementBlock("li",{key:F}," ("+t.toDisplayString(F)+"): "+t.toDisplayString(P),1))),128)):t.createCommentVNode("",!0)])])):t.createCommentVNode("",!0)])}}}),oy=(n,e,i)=>({key:n,title:e,className:"align-top",resizable:!0,render:r=>t.h(ci,{product:r,costFieldName:n,eventEmitter:i.eventEmitter,allowPriceClick:i.allowPriceClick,currencyRates:i.currencyRates})}),sy=(n,e)=>{if(n.length===0)return[];const i=[],r={};switch(V.isNil(e.isProductItemSelected)||i.push({key:"checkbox",title:"",className:"align-top",width:"32",render:o=>{var s,a;return t.h(I.NCheckbox,{checked:!!((s=e.isProductItemSelected)!=null&&s.call(e,o)),disabled:((a=e.isProductItemSelected)==null?void 0:a.call(e,o))==="disabled",onUpdateChecked:l=>{e.eventEmitter.emit("product:checked",{product:o,checked:l})}})}}),Ue.getDeviceTypeByResolution()){case Xe.phone:case Xe.tablet:i.push({key:"name",title:"Наименование",className:"align-top",render:o=>t.h(go,{product:o,eventEmitter:e.eventEmitter,showSlugs:e.showSlugs,showProperties:e.showProperties,showProductCosts:e.showProductCosts,allowNameClick:e.allowNameClick,allowPriceClick:e.allowPriceClick,showPriceHistory:e.showPriceHistory,showCostDate:e.showCostDate,showProductInfoButton:e.showProductInfoButton,showProductAddToCartButton:e.showProductAddToCartButton,showProductEditButton:e.showProductEditButton,showProductRequiredButton:e.showProductRequiredButton,currencyRates:e.currencyRates,productContextButtonsConfig:e.productContextButtonsConfig})});break;default:i.push({key:"name",title:"Наименование",className:"align-top",resizable:!0,render:o=>t.h(go,{product:o,eventEmitter:e.eventEmitter,showSlugs:e.showSlugs,showProperties:e.showProperties,allowNameClick:e.allowNameClick,allowPriceClick:e.allowPriceClick,showPriceHistory:e.showPriceHistory,showCostDate:e.showCostDate,showProductInfoButton:e.showProductInfoButton,currencyRates:e.currencyRates})}),e.showProductCosts&&(V.forEach(n,o=>{V.forEach(o.priceCoefficients,s=>{r[s.coefficient.slug??""]||(r[s.coefficient.slug??""]=s.coefficient)})}),V.forEach(V.sortBy(r,["slug"]),o=>{i.push(oy(o.slug??"",o.name,e))}),i.push({key:"cost",title:"Цена",className:"align-top",resizable:!0,render:o=>t.h(ci,{product:o,costFieldName:"cost",additionalThroughFieldName:"retailCost",eventEmitter:e.eventEmitter,allowPriceClick:e.allowPriceClick,showQuantityUnit:!0,showPriceHistory:e.showPriceHistory,showCostDate:e.showCostDate,currencyRates:e.currencyRates})})),(e.showProductEditButton||e.showProductRequiredButton||e.showProductAddToCartButton||!V.isNil(e.productContextButtonsConfig))&&i.push({key:"actions",title:"",className:"align-top",width:"50",render:o=>t.h(ac,{product:o,eventEmitter:e.eventEmitter,showProductAddToCartButton:e.showProductAddToCartButton,showProductEditButton:e.showProductEditButton,showProductRequiredButton:e.showProductRequiredButton,productContextButtonsConfig:e.productContextButtonsConfig})});break}return i},ay={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function ly(n,e){return t.openBlock(),t.createElementBlock("svg",ay,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",d:"M296 64h-80a7.91 7.91 0 0 0-8 8v24h96V72a7.91 7.91 0 0 0-8-8"},null,-1),t.createElementVNode("path",{fill:"currentColor",d:"M432 96h-96V72a40 40 0 0 0-40-40h-80a40 40 0 0 0-40 40v24H80a16 16 0 0 0 0 32h17l19 304.92c1.42 26.85 22 47.08 48 47.08h184c26.13 0 46.3-19.78 48-47l19-305h17a16 16 0 0 0 0-32M192.57 416H192a16 16 0 0 1-16-15.43l-8-224a16 16 0 1 1 32-1.14l8 224A16 16 0 0 1 192.57 416M272 400a16 16 0 0 1-32 0V176a16 16 0 0 1 32 0Zm32-304h-96V72a7.91 7.91 0 0 1 8-8h80a7.91 7.91 0 0 1 8 8Zm32 304.57A16 16 0 0 1 320 416h-.58A16 16 0 0 1 304 399.43l8-224a16 16 0 1 1 32 1.14Z"},null,-1)])])}const yo=t.markRaw({name:"ion-trash",render:ly}),cy={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function dy(n,e){return t.openBlock(),t.createElementBlock("svg",cy,[...e[0]||(e[0]=[t.createElementVNode("path",{d:"M448 224H288V64h-64v160H64v64h160v160h64V288h160z",fill:"currentColor"},null,-1)])])}const hc=t.markRaw({name:"ion-plus",render:dy}),uy={key:0,class:"flex w-fit items-center gap-2"},fy={key:1,class:"flex flex-wrap gap-1"},hy={key:0},my={key:2},py={},Fr=t.defineComponent({...py,__name:"configurators-product-info",props:{isProductSearching:{type:Boolean,default:!1},product:{default:void 0},validation:{default:void 0}},setup(n){const e=n,i=t.computed(()=>{var r,o;return(o=(r=e.product)==null?void 0:r.properties)==null?void 0:o.planingProductionDate});return(r,o)=>{const s=I.NSpin,a=I.NText;return n.isProductSearching?(t.openBlock(),t.createElementBlock("div",uy,[t.createVNode(s,{size:17,class:"w-fit"}),o[0]||(o[0]=t.createElementVNode("div",null,"Выполняется поиск товара ...",-1))])):n.product&&!n.product.isNewRec()?(t.openBlock(),t.createElementBlock("div",fy,[t.createElementVNode("div",null,t.toDisplayString(n.product.code)+" - "+t.toDisplayString(n.product.name)+" - "+t.toDisplayString(t.unref(Ve).formatMoney(n.product.costRub))+" ₽ / "+t.toDisplayString(n.product.unit.name),1),i.value?(t.openBlock(),t.createElementBlock("div",hy,"(Планируемая дата производства: "+t.toDisplayString(i.value)+")",1)):t.createCommentVNode("",!0)])):n.validation?(t.openBlock(),t.createElementBlock("div",my,[t.createVNode(a,{type:n.validation.validationStatus},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(n.validation.feedback),1)]),_:1},8,["type"])])):t.createCommentVNode("",!0)}}}),gy={class:"flex flex-col gap-4"},yy={class:"flex flex-col gap-2"},by={class:"mt-8 font-bold"},_y={class:"grid grow grid-cols-2 items-start gap-2"},wy={key:2,class:"text-red-500 text-sm"},xy={key:3,class:"text-red-500 text-sm mb-2"},ky={class:"flex flex-col gap-4"},Cy={key:1},vy={class:"text-lg font-semibold"},Sy={class:"flex gap-3"},By={},Ny=t.defineComponent({...By,__name:"kozyrek-configurator-params-form",props:{value:{},settings:{},previewParams:{},isProductSearching:{type:Boolean,default:!1},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0},selectTemplateIndex:{}},emits:["update:value","update:params","submit","click:add-line","click:remove-line","click:save-template"],setup(n,{expose:e,emit:i}){var b;const r=n,o=i,s=t.useTemplateRef("form-reference"),a=t.ref(!1),l=t.ref(V.cloneDeep(r.value)),c=t.computed(()=>{var _,x,w;const y={"configuratorParams.length":[ce.required,ce.min(r.settings.stripMinLength),ce.max(r.settings.stripMaxLength||Number.MAX_VALUE),ce.step(r.settings.lengthStep),We.serverValidation((_=r.validation.length)==null?void 0:_.feedback)],quantity:[ce.required,ce.min(1),ce.step(1),We.serverValidation((x=r.validation.quantity)==null?void 0:x.feedback)],marker:[We.serverValidation((w=r.validation.marker)==null?void 0:w.feedback)]};return V.forEach(l.value.configuratorParams.linesWidths,(C,N)=>{var v;const $=l.value.configuratorParams.linesWidths.length>1?r.settings.minLineWidth:r.settings.stripMinWidth;y[`configuratorParams.linesWidths.${N}`]=[ce.required,ce.min($),ce.max(r.settings.maxLineWidth),ce.step(r.settings.lineWidthStep),We.serverValidation((v=r.validation[`lines_widths[${N+1}]`])==null?void 0:v.feedback)]}),V.forEach(l.value.configuratorParams.linesAngles,(C,N)=>{var k;y[`configuratorParams.linesAngles.${N}`]=[ce.required,ce.min(r.settings.minLineAngle),ce.max(r.settings.maxLineAngle),ce.step(r.settings.lineAngleStep),We.serverValidation((k=r.validation[`lines_angles[${N+1}]`])==null?void 0:k.feedback)]}),y}),d=t.ref(r.settings.canSetDopProdaga??!1),u=t.computed(()=>{var C;const{length:y}=l.value.configuratorParams,{quantity:_}=l.value,x=((C=l.value.product)==null?void 0:C.costRub)||0;if(!y||!_||x===0)return null;const w=y/1e3;return Ve.formatMoney(x*_*w)}),f=t.computed(()=>V.reduce(l.value.configuratorParams.linesWidths,(y,_)=>y+(_||0),0)),h=t.computed(()=>{const y=f.value;return y>=r.settings.stripMinWidth&&y<=r.settings.stripMaxWidth}),p=t.computed(()=>{const{configuratorParams:y}=l.value,_=V.every(y.linesWidths,N=>!!(N&&N>0)),x=V.every(y.linesAngles,N=>!V.isNil(N)),w=!!(l.value.quantity&&l.value.quantity>0),C=y.length>0&&y.length>0;return _&&x&&w&&C&&h.value}),m=()=>{t.nextTick(()=>{var y;(y=s.value)==null||y.validate(_=>{_||(o("update:params",l.value.configuratorParams),g("configuratorParams",l.value.configuratorParams))}).catch(V.noop)})},g=(y,_)=>{const x=new W.OrderItemBase(l.value);x[y]=_,y==="configuratorParams"&&(x.product=new W.ClientProduct),o("update:value",x)};return t.watch(()=>r.previewParams,y=>{l.value.configuratorParams.linesWidths=y.linesWidths,l.value.configuratorParams.linesAngles=y.linesAngles},{deep:!0}),t.watch(()=>r.value,y=>{l.value=V.cloneDeep(y)},{deep:!0}),e({validate:(b=s.value)==null?void 0:b.validate,formReference:s}),(y,_)=>{const x=hc,w=yo,C=I.NCheckbox;return t.withDirectives((t.openBlock(),t.createBlock(t.unref(I.NForm),{ref:"form-reference",model:l.value,rules:c.value,class:"flex flex-col gap-4 sc-hide-empty-feedback-message"},{default:t.withCtx(()=>{var N;return[t.createElementVNode("div",gy,[_[21]||(_[21]=t.createElementVNode("span",{class:"w-full font-bold"},"Ширина участка, мм / Угол сгиба, ° (А)",-1)),n.settings.startTailConfigs&&n.settings.startTailConfigs.length>0?(t.openBlock(),t.createBlock(t.unref(I.NFormItem),{key:0,required:!0,"show-feedback":!1,label:"Тип стартового капельника"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NSelect),{value:l.value.configuratorParams.startTailType,"onUpdate:value":[_[0]||(_[0]=k=>l.value.configuratorParams.startTailType=k),m],options:n.settings.startTailConfigs.map(({label:k},$)=>({label:k,value:$})),placeholder:"Тип стартового капельника"},null,8,["value","options"])]),_:1})):t.createCommentVNode("",!0),t.createElementVNode("div",yy,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.value.configuratorParams.linesAngles,(k,$)=>(t.openBlock(),t.createElementBlock("div",{key:$,class:"flex items-start gap-2"},[t.createElementVNode("div",by,t.toDisplayString($+1),1),t.createElementVNode("div",_y,[t.createVNode(t.unref(I.NFormItem),{path:`configuratorParams.linesWidths.${$}`,label:"Ширина, мм"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:l.value.configuratorParams.linesWidths[$],"onUpdate:value":[v=>l.value.configuratorParams.linesWidths[$]=v,_[2]||(_[2]=v=>m())],parse:t.unref(ht),"show-button":!1,class:"w-full",onKeydown:_[1]||(_[1]=v=>t.unref(ft)(v)),onInput:v=>t.unref(dt)(n.validation,`lines_widths[${$+1}]`),onFocus:t.unref(He)},null,8,["value","onUpdate:value","parse","onInput","onFocus"])]),_:2},1032,["path"]),t.createVNode(t.unref(I.NFormItem),{path:`configuratorParams.linesAngles.${$}`,label:"Угол сгиба, °"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:l.value.configuratorParams.linesAngles[$],"onUpdate:value":[v=>l.value.configuratorParams.linesAngles[$]=v,_[4]||(_[4]=v=>m())],parse:t.unref(ht),"show-button":!1,class:"w-full",onKeydown:_[3]||(_[3]=v=>t.unref(ft)(v,!0)),onInput:v=>t.unref(dt)(n.validation,`lines_angles[${$+1}]`),onFocus:t.unref(He)},null,8,["value","onUpdate:value","parse","onInput","onFocus"])]),_:2},1032,["path"])]),t.createVNode(t.unref(I.NFormItem),{label:void 0,"show-feedback":!1,required:!0,class:"shrink-0"},{default:t.withCtx(()=>[n.settings.showOnlyTemplates?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(t.unref(I.NButton),{key:0,size:"medium",onClick:v=>o("click:add-line",$)},{default:t.withCtx(()=>[t.createVNode(x)]),_:1},8,["onClick"])),n.settings.showOnlyTemplates?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(t.unref(I.NButton),{key:1,disabled:l.value.configuratorParams.linesWidths.length===1,size:"medium",class:"ml-2",onClick:v=>o("click:remove-line",$)},{default:t.withCtx(()=>[t.createVNode(w)]),_:1},8,["disabled","onClick"]))]),_:2},1024)]))),128))]),n.settings.endTailConfigs&&n.settings.endTailConfigs.length>0?(t.openBlock(),t.createBlock(t.unref(I.NFormItem),{key:1,label:"Тип конечного капельника","show-feedback":!1,required:!0},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NSelect),{value:l.value.configuratorParams.endTailType,"onUpdate:value":[_[5]||(_[5]=k=>l.value.configuratorParams.endTailType=k),m],options:n.settings.endTailConfigs.map(({label:k},$)=>({label:k,value:$})),placeholder:"Тип конечного капельника"},null,8,["value","options"])]),_:1})):t.createCommentVNode("",!0),t.createVNode(Fr,{"is-product-searching":n.isProductSearching,product:l.value.product,validation:n.validation.product},null,8,["is-product-searching","product","validation"]),h.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",wy," Суммарная ширина участков гиба должна быть от "+t.toDisplayString(n.settings.stripMinWidth)+" до "+t.toDisplayString(n.settings.stripMaxWidth)+" мм., текущая ширина: "+t.toDisplayString(f.value)+" мм. ",1)),p.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",xy," Пожалуйста, заполните все обязательные поля корректно. ")),n.settings.allowSaveTemplates&&n.selectTemplateIndex===((N=n.settings.allTemplates)==null?void 0:N.length)-1?(t.openBlock(),t.createBlock(t.unref(I.NButton),{key:4,type:"tertiary",class:"self-start",loading:a.value,onClick:_[6]||(_[6]=k=>o("click:save-template"))},{default:t.withCtx(()=>[..._[20]||(_[20]=[t.createTextVNode(" Сохранить шаблон ",-1)])]),_:1},8,["loading"])):t.createCommentVNode("",!0)]),t.createElementVNode("div",ky,[t.createVNode(t.unref(I.NFormItem),{label:"С какой стороны изделие будет иметь цвет","show-feedback":!1},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NSelect),{value:l.value.configuratorParams.colorSide,"onUpdate:value":[_[7]||(_[7]=k=>l.value.configuratorParams.colorSide=k),m],options:[{label:"Цвет сверху",value:"top"},{label:" Цвет снизу",value:"bottom"}],placeholder:"С какой стороны изделие будет иметь цвет"},null,8,["value"])]),_:1}),t.createVNode(t.unref(I.NFormItem),{path:"configuratorParams.length",label:`Метраж${n.settings.stripMinLength?" от "+n.settings.stripMinLength:""}${n.settings.stripMaxLength?" до "+n.settings.stripMaxLength:""} мм`},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:l.value.configuratorParams.length,"onUpdate:value":[_[8]||(_[8]=k=>l.value.configuratorParams.length=k),_[11]||(_[11]=k=>m())],parse:t.unref(ht),"show-button":!1,placeholder:"Введите метраж",class:"w-full",onKeydown:_[9]||(_[9]=k=>t.unref(ft)(k)),onInput:_[10]||(_[10]=k=>t.unref(dt)(n.validation,"length")),onFocus:t.unref(He)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),t.createVNode(t.unref(I.NFormItem),{path:"quantity",label:"Количество"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:l.value.quantity,"onUpdate:value":[_[12]||(_[12]=k=>l.value.quantity=k),_[15]||(_[15]=k=>g("quantity",k??0))],"show-button":!1,placeholder:"Введите количество",class:"w-full",onKeydown:_[13]||(_[13]=k=>t.unref(ft)(k,!1)),onInput:_[14]||(_[14]=k=>t.unref(dt)(n.validation,"quantity")),onFocus:t.unref(He)},null,8,["value","onFocus"])]),_:1}),t.createVNode(t.unref(I.NFormItem),{path:"marker",label:"Маркировка"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInput),{value:l.value.marker??null,placeholder:"Введите маркировку",onInput:_[16]||(_[16]=k=>t.unref(dt)(n.validation,"marker")),"onUpdate:value":_[17]||(_[17]=k=>{l.value.marker=k??null,g("marker",k??null)}),onFocus:t.unref(He)},null,8,["value","onFocus"])]),_:1}),d.value?(t.openBlock(),t.createBlock(C,{key:0,checked:l.value.isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":_[18]||(_[18]=k=>{l.value.isAdditionalSale=k??!1,g("isAdditionalSale",k??!1)})},{default:t.withCtx(()=>[..._[22]||(_[22]=[t.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):t.createCommentVNode("",!0),u.value?(t.openBlock(),t.createElementBlock("div",Cy,[_[23]||(_[23]=t.createTextVNode(" ИТОГО: ",-1)),t.createElementVNode("span",vy,t.toDisplayString(u.value)+" ₽",1)])):t.createCommentVNode("",!0),t.createElementVNode("div",Sy,[t.createVNode(t.unref(I.NButton),{loading:n.isSubmitProcessing,disabled:!p.value||l.value.product.isNewRec(),type:"primary",class:"self-start",onClick:_[19]||(_[19]=k=>o("submit",l.value))},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(l.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["loading","disabled"])])])]}),_:1},8,["model","rules"])),[[t.unref(ai),()=>o("submit",l.value)]])}}}),mc=gn(Ny,[["__scopeId","data-v-e9c8af59"]]);var pc=Object.defineProperty,Ty=Object.defineProperties,$y=Object.getOwnPropertyDescriptors,gc=Object.getOwnPropertySymbols,Ey=Object.prototype.hasOwnProperty,Ry=Object.prototype.propertyIsEnumerable,yc=n=>{throw TypeError(n)},Ds=(n,e,i)=>e in n?pc(n,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[e]=i,Vr=(n,e)=>{for(var i in e||(e={}))Ey.call(e,i)&&Ds(n,i,e[i]);if(gc)for(var i of gc(e))Ry.call(e,i)&&Ds(n,i,e[i]);return n},Ls=(n,e)=>Ty(n,$y(e)),bc=(n,e)=>{for(var i in e)pc(n,i,{get:e[i],enumerable:!0})},S=(n,e,i)=>Ds(n,typeof e!="symbol"?e+"":e,i),_c=(n,e,i)=>e.has(n)||yc("Cannot "+i),Xt=(n,e,i)=>(_c(n,e,"read from private field"),i?i.call(n):e.get(n)),wc=(n,e,i)=>e.has(n)?yc("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,i),Py=(n,e,i,r)=>(_c(n,e,"write to private field"),e.set(n,i),i),At={Image:null,isHeadless:!1,shim:function(n,e){return n.tagName=n.nodeName=e||"canvas",n.nodeType=1,n.getAttribute=function(i){return this[i]},n.setAttribute=function(i,r){return this[i]=r,this},n},polyfill:function(n,e){return At.shim(n),typeof e<"u"&&(At.Image=e),At.isHeadless=!0,n}},xc={};bc(xc,{Curve:()=>rr,getAnchorsFromArcData:()=>My,getComponentOnCubicBezier:()=>Mr,getControlPoints:()=>Pc,getCurveBoundingBox:()=>$c,getCurveFromPoints:()=>Rc,getCurveLength:()=>Tc,getReflection:()=>qs,integrate:()=>Ec,subdivide:()=>js});var kc={};bc(kc,{HALF_PI:()=>mt,NumArray:()=>Bn,TWO_PI:()=>ot,decomposeMatrix:()=>Si,getComputedMatrix:()=>Hs,getEffectiveStrokeWidth:()=>Nn,getPoT:()=>Sc,lerp:()=>Ot,mod:()=>ut,setMatrix:()=>vc,toFixed:()=>ze});var Je;typeof window<"u"?Je=window:typeof global<"u"?Je=global:typeof self<"u"&&(Je=self);var Cc,ot=Math.PI*2,mt=Math.PI*.5;function Si(n,e,i,r,o,s){let a;return arguments.length<=1?(a=n.a,e=n.b,i=n.c,r=n.d,o=n.e,s=n.f):a=n,{translateX:o,translateY:s,scaleX:Math.sqrt(a*a+e*e),scaleY:Math.sqrt(i*i+r*r),rotation:180*Math.atan2(e,a)/Math.PI}}function vc(n){Cc=n}function Hs(n,e){e=e&&e.identity()||new Cc;let i=n;const r=[];for(;i&&i._matrix;)r.push(i._matrix),i=i.parent;r.reverse();for(let o=0;o<r.length;o++){const a=r[o].elements;e.multiply(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8])}return e}function Ot(n,e,i){return i*(e-n)+n}var Ws=[2,4,8,16,32,64,128,256,512,1024,2048,4096];function Sc(n){let e=0;for(;Ws[e]&&Ws[e]<n;)e++;return Ws[e]}function ut(n,e){for(;n<0;)n+=e;return n%e}var Bn=Je.Float32Array||Array,Fy=Math.floor;function ze(n){return Fy(n*1e6)/1e6}function Nn(n,e){const i=n._linewidth;if(n.strokeAttenuation)return i;e||(e=n.worldMatrix||Hs(n));const r=Si(e.elements[0],e.elements[3],e.elements[1],e.elements[4],e.elements[2],e.elements[5]),o=Math.max(Math.abs(r.scaleX),Math.abs(r.scaleY));return o>0?i/o:i}var ne={move:"M",line:"L",curve:"C",arc:"A",close:"Z"},ee=class{constructor(){S(this,"_events",{}),S(this,"_bound",!1)}addEventListener(e,i){return(this._events[e]||(this._events[e]=[])).push(i),this._bound=!0,this}on(){return this.addEventListener.apply(this,arguments)}bind(){return this.addEventListener.apply(this,arguments)}removeEventListener(e,i){if(!this._events)return this;if(!e&&!i)return this._events={},this._bound=!1,this;const r=e?[e]:Object.keys(this._events);for(let o=0,s=r.length;o<s;o++){e=r[o];let a=this._events[e];if(a){let l=[];if(i)for(let c=0,d=a.length;c<d;c++){let u=a[c];u=u.handler?u.handler:u,i!==u&&l.push(u)}this._events[e]=l}}return this}off(){return this.removeEventListener.apply(this,arguments)}unbind(){return this.removeEventListener.apply(this,arguments)}dispatchEvent(e){if(!this._events)return this;const i=Array.prototype.slice.call(arguments,1),r=this._events[e];if(r)for(let o=0;o<r.length;o++)r[o].call(this,...i);return this}trigger(){return this.dispatchEvent.apply(this,arguments)}listen(e,i,r){const o=this;e&&(s.obj=e,s.name=i,s.handler=r,e.on(i,s));function s(){r.apply(o,arguments)}return o}ignore(e,i,r){return e.off(i,r),this}};S(ee,"Types",{play:"play",pause:"pause",update:"update",render:"render",resize:"resize",change:"change",remove:"remove",insert:"insert",order:"order",load:"load"}),S(ee,"Methods",["addEventListener","on","removeEventListener","off","unbind","dispatchEvent","trigger","listen","ignore"]);var Bc={x:{enumerable:!0,get:function(){return this._x},set:function(n){this._x!==n&&(this._x=n,this._bound&&this.dispatchEvent(ee.Types.change))}},y:{enumerable:!0,get:function(){return this._y},set:function(n){this._y!==n&&(this._y=n,this._bound&&this.dispatchEvent(ee.Types.change))}}},yn=class vr extends ee{constructor(e=0,i=0){super(),S(this,"_x",0),S(this,"_y",0);for(let r in Bc)Object.defineProperty(this,r,Bc[r]);this.x=e,this.y=i}static add(e,i){return new vr(e.x+i.x,e.y+i.y)}static sub(e,i){return new vr(e.x-i.x,e.y-i.y)}static subtract(e,i){return vr.sub(e,i)}static ratioBetween(e,i){return(e.x*i.x+e.y*i.y)/(e.length()*i.length())}static angleBetween(e,i){if(arguments.length>=4){const s=arguments[0]-arguments[2],a=arguments[1]-arguments[3];return Math.atan2(a,s)}const r=e.x-i.x,o=e.y-i.y;return Math.atan2(o,r)}static distanceBetween(e,i){return Math.sqrt(vr.distanceBetweenSquared(e,i))}static distanceBetweenSquared(e,i){const r=e.x-i.x,o=e.y-i.y;return r*r+o*o}set(e,i){return this.x=e,this.y=i,this}copy(e){return this.x=e.x,this.y=e.y,this}clear(){return this.x=0,this.y=0,this}clone(){return new vr(this.x,this.y)}add(e,i){return arguments.length<=0?this:(arguments.length<=1?typeof e=="number"?(this.x+=e,this.y+=e):e&&typeof e.x=="number"&&typeof e.y=="number"&&(this.x+=e.x,this.y+=e.y):(this.x+=e,this.y+=i),this)}addSelf(e){return this.add.apply(this,arguments)}sub(e,i){return arguments.length<=0?this:(arguments.length<=1?typeof e=="number"?(this.x-=e,this.y-=e):e&&typeof e.x=="number"&&typeof e.y=="number"&&(this.x-=e.x,this.y-=e.y):(this.x-=e,this.y-=i),this)}subtract(){return this.sub.apply(this,arguments)}subSelf(e){return this.sub.apply(this,arguments)}subtractSelf(e){return this.sub.apply(this,arguments)}multiply(e,i){return arguments.length<=0?this:(arguments.length<=1?typeof e=="number"?(this.x*=e,this.y*=e):e&&typeof e.x=="number"&&typeof e.y=="number"&&(this.x*=e.x,this.y*=e.y):(this.x*=e,this.y*=i),this)}multiplySelf(e){return this.multiply.apply(this,arguments)}multiplyScalar(e){return this.multiply(e)}divide(e,i){return arguments.length<=0?this:(arguments.length<=1?typeof e=="number"?(this.x/=e,this.y/=e):e&&typeof e.x=="number"&&typeof e.y=="number"&&(this.x/=e.x,this.y/=e.y):(this.x/=e,this.y/=i),isNaN(this.x)&&(this.x=0),isNaN(this.y)&&(this.y=0),this)}divideSelf(e){return this.divide.apply(this,arguments)}divideScalar(e){return this.divide(e)}negate(){return this.multiply(-1)}dot(e){return this.x*e.x+this.y*e.y}length(){return Math.sqrt(this.lengthSquared())}lengthSquared(){return this.x*this.x+this.y*this.y}normalize(){return this.divideScalar(this.length())}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const i=this.x-e.x,r=this.y-e.y;return i*i+r*r}setLength(e){return this.normalize().multiplyScalar(e)}equals(e,i){return i=typeof i>"u"?1e-4:i,this.distanceTo(e)<i}lerp(e,i){const r=(e.x-this.x)*i+this.x,o=(e.y-this.y)*i+this.y;return this.set(r,o)}isZero(e){return e=typeof e>"u"?1e-4:e,this.length()<e}toString(){return this.x+", "+this.y}toObject(){return{x:ze(this.x),y:ze(this.y)}}rotate(e){const i=this.x,r=this.y,o=Math.cos(e),s=Math.sin(e);return this.x=i*o-r*s,this.y=i*s+r*o,this}};S(yn,"zero",new yn),S(yn,"left",new yn(-1,0)),S(yn,"right",new yn(1,0)),S(yn,"up",new yn(0,-1)),S(yn,"down",new yn(0,1));var ie=yn,Ee=class Bs extends ie{constructor(e=0,i=0,r=0,o=0,s=0,a=0,l=ne.move){super(e,i),S(this,"controls",{left:new ie,right:new ie}),S(this,"_command",ne.move),S(this,"_relative",!0),S(this,"_rx",0),S(this,"_ry",0),S(this,"_xAxisRotation",0),S(this,"_largeArcFlag",0),S(this,"_sweepFlag",1);for(let d in Nc)Object.defineProperty(this,d,Nc[d]);this.command=l,this.relative=!0;const c=Bs.makeBroadcast(this);this.controls.left.set(r,o).addEventListener(ee.Types.change,c),this.controls.right.set(s,a).addEventListener(ee.Types.change,c)}static makeBroadcast(e){return i;function i(){e._bound&&e.dispatchEvent(ee.Types.change)}}static fromObject(e){return new Bs().copy(e)}copy(e){return this.x=e.x,this.y=e.y,typeof e.command=="string"&&(this.command=e.command),e.controls&&(e.controls.left&&this.controls.left.copy(e.controls.left),e.controls.right&&this.controls.right.copy(e.controls.right)),typeof e.relative=="boolean"&&(this.relative=e.relative),typeof e.rx=="number"&&(this.rx=e.rx),typeof e.ry=="number"&&(this.ry=e.ry),typeof e.xAxisRotation=="number"&&(this.xAxisRotation=e.xAxisRotation),typeof e.largeArcFlag=="number"&&(this.largeArcFlag=e.largeArcFlag),typeof e.sweepFlag=="number"&&(this.sweepFlag=e.sweepFlag),this}clone(){return new Bs().copy(this)}toObject(){return{x:ze(this.x),y:ze(this.y),command:this.command,relative:this.relative,controls:{left:this.controls.left.toObject(),right:this.controls.right.toObject()},rx:ze(this.rx),ry:ze(this.ry),xAxisRotation:ze(this.xAxisRotation),largeArcFlag:ze(this.largeArcFlag),sweepFlag:ze(this.sweepFlag)}}toString(){return JSON.stringify(this.toObject())}},Nc={command:{enumerable:!0,get:function(){return this._command},set:function(n){this._command!==n&&(this._command=n,this._bound&&this.dispatchEvent(ee.Types.change))}},relative:{enumerable:!0,get:function(){return this._relative},set:function(n){this._relative!==!!n&&(this._relative=!!n,this._bound&&this.dispatchEvent(ee.Types.change))}},rx:{enumerable:!0,get:function(){return this._rx},set:function(n){this._rx!==n&&(this._rx=n,this._bound&&this.dispatchEvent(ee.Types.change))}},ry:{enumerable:!0,get:function(){return this._ry},set:function(n){this._ry!==n&&(this._ry=n,this._bound&&this.dispatchEvent(ee.Types.change))}},xAxisRotation:{enumerable:!0,get:function(){return this._xAxisRotation},set:function(n){this._xAxisRotation!==n&&(this._xAxisRotation=n,this._bound&&this.dispatchEvent(ee.Types.change))}},largeArcFlag:{enumerable:!0,get:function(){return this._largeArcFlag},set:function(n){this._largeArcFlag!==n&&(this._largeArcFlag=n,this._bound&&this.dispatchEvent(ee.Types.change))}},sweepFlag:{get:function(){return this._sweepFlag},set:function(n){this._sweepFlag!==n&&(this._sweepFlag=n,this._bound&&this.dispatchEvent(ee.Types.change))}}},Vy=0,Bt={NextFrameId:null,Types:{webgl:"WebGLRenderer",svg:"SVGRenderer",canvas:"CanvasRenderer"},Version:"v0.8.23",PublishDate:"2025-12-22T19:59:24.486Z",Identifier:"two-",Resolution:12,AutoCalculateImportedMatrices:!0,Instances:[],uniqueId:function(){return Vy++}},rr={CollinearityEpsilon:Math.pow(10,-30),RecursionLimit:16,CuspLimit:0,Tolerance:{distance:.25,angle:0,epsilon:Number.EPSILON},abscissas:[[.5773502691896],[0,.7745966692415],[.3399810435849,.8611363115941],[0,.5384693101057,.9061798459387],[.2386191860832,.6612093864663,.9324695142032],[0,.4058451513774,.7415311855994,.9491079123428],[.1834346424956,.5255324099163,.7966664774136,.9602898564975],[0,.3242534234038,.6133714327006,.8360311073266,.9681602395076],[.1488743389816,.4333953941292,.679409568299,.865063366689,.9739065285172],[0,.2695431559523,.5190961292068,.730152005574,.8870625997681,.9782286581461],[.1252334085115,.3678314989982,.5873179542866,.7699026741943,.9041172563705,.9815606342467],[0,.2304583159551,.4484927510364,.6423493394403,.8015780907333,.917598399223,.9841830547186],[.1080549487073,.3191123689279,.5152486363582,.6872929048117,.8272013150698,.9284348836636,.9862838086968],[0,.2011940939974,.3941513470776,.5709721726085,.7244177313602,.8482065834104,.9372733924007,.9879925180205],[.0950125098376,.2816035507793,.4580167776572,.6178762444026,.755404408355,.8656312023878,.9445750230732,.9894009349916]],weights:[[1],[.8888888888889,.5555555555556],[.6521451548625,.3478548451375],[.5688888888889,.4786286704994,.2369268850562],[.4679139345727,.3607615730481,.1713244923792],[.4179591836735,.3818300505051,.2797053914893,.1294849661689],[.3626837833784,.3137066458779,.2223810344534,.1012285362904],[.3302393550013,.31234707704,.2606106964029,.1806481606949,.0812743883616],[.2955242247148,.26926671931,.219086362516,.1494513491506,.0666713443087],[.2729250867779,.2628045445102,.233193764592,.1862902109277,.1255803694649,.0556685671162],[.2491470458134,.2334925365384,.2031674267231,.1600783285433,.1069393259953,.0471753363865],[.2325515532309,.2262831802629,.2078160475369,.1781459807619,.1388735102198,.0921214998377,.0404840047653],[.2152638534632,.2051984637213,.1855383974779,.1572031671582,.1215185706879,.0801580871598,.0351194603318],[.2025782419256,.1984314853271,.1861610000156,.166269205817,.1395706779262,.1071592204672,.0703660474881,.0307532419961],[.1894506104551,.1826034150449,.169156519395,.1495959888166,.1246289712555,.0951585116825,.0622535239386,.0271524594118]]};function Mr(n,e,i,r,o){const s=1-n;return s*s*s*e+3*s*s*n*i+3*s*n*n*r+n*n*n*o}function js(n,e,i,r,o,s,a,l,c){c=c||rr.RecursionLimit;const d=c+1;if(Math.abs(n-a)<.001&&Math.abs(e-l)<.001)return[new Ee(a,l)];const u=[];for(let f=0;f<d;f++){const h=f/d,p=Mr(h,n,i,o,a),m=Mr(h,e,r,s,l);u.push(new Ee(p,m))}return u}function Tc(n,e,i,r,o,s,a,l,c){if(n===i&&e===r&&o===a&&s===l){const b=a-n,y=l-e;return Math.sqrt(b*b+y*y)}const d=9*(i-o)+3*(a-n),u=6*(n+o)-12*i,f=3*(i-n),h=9*(r-s)+3*(l-e),p=6*(e+s)-12*r,m=3*(r-e);function g(b){const y=(d*b+u)*b+f,_=(h*b+p)*b+m;return Math.sqrt(y*y+_*_)}return Ec(g,0,1,c||rr.RecursionLimit)}function $c(n,e,i,r,o,s,a,l){const c=[],d=[[],[]];let u,f,h,p,m,g,b,y;for(let C=0;C<2;++C){if(C===0?(f=6*n-12*i+6*o,u=-3*n+9*i-9*o+3*a,h=3*i-3*n):(f=6*e-12*r+6*s,u=-3*e+9*r-9*s+3*l,h=3*r-3*e),Math.abs(u)<.001){if(Math.abs(f)<.001)continue;p=-h/f,0<p&&p<1&&c.push(p);continue}b=f*f-4*h*u,y=Math.sqrt(b),!(b<0)&&(m=(-f+y)/(2*u),0<m&&m<1&&c.push(m),g=(-f-y)/(2*u),0<g&&g<1&&c.push(g))}let _=c.length,x=_,w;for(;_--;)p=c[_],w=1-p,d[0][_]=w*w*w*n+3*w*w*p*i+3*w*p*p*o+p*p*p*a,d[1][_]=w*w*w*e+3*w*w*p*r+3*w*p*p*s+p*p*p*l;return d[0][x]=n,d[1][x]=e,d[0][x+1]=a,d[1][x+1]=l,d[0].length=d[1].length=x+2,{min:{x:Math.min.apply(0,d[0]),y:Math.min.apply(0,d[1])},max:{x:Math.max.apply(0,d[0]),y:Math.max.apply(0,d[1])}}}function Ec(n,e,i,r){let o=rr.abscissas[r-2],s=rr.weights[r-2],a=.5*(i-e),l=a+e,c=0,d=r+1>>1,u=r&1?s[c++]*n(l):0;for(;c<d;){const f=a*o[c];u+=s[c++]*(n(l+f)+n(l-f))}return a*u}function Rc(n,e){const i=n.length,r=i-1;for(let o=0;o<i;o++){const s=n[o],a=e?ut(o-1,i):Math.max(o-1,0),l=e?ut(o+1,i):Math.min(o+1,r),c=n[a],d=s,u=n[l];Pc(c,d,u),d.command=o===0?ne.move:ne.curve}}function Pc(n,e,i){const r=ie.angleBetween(n,e),o=ie.angleBetween(i,e);let s=ie.distanceBetween(n,e),a=ie.distanceBetween(i,e),l=(r+o)/2;return s<.001||a<.001?(typeof e.relative=="boolean"&&!e.relative&&(e.controls.left.copy(e),e.controls.right.copy(e)),e):(s*=.33,a*=.33,o<r?l+=mt:l-=mt,e.controls.left.x=Math.cos(l)*s,e.controls.left.y=Math.sin(l)*s,l-=Math.PI,e.controls.right.x=Math.cos(l)*a,e.controls.right.y=Math.sin(l)*a,typeof e.relative=="boolean"&&!e.relative&&(e.controls.left.x+=e.x,e.controls.left.y+=e.y,e.controls.right.x+=e.x,e.controls.right.y+=e.y),e)}function qs(n,e,i){return new ie(2*n.x-(e.x+n.x)-(i?n.x:0),2*n.y-(e.y+n.y)-(i?n.y:0))}function My(n,e,i,r,o,s,a){const l=Bt.Resolution;for(let c=0;c<l;c++){let d=(c+1)/l;a&&(d=1-d);const u=d*s+o,f=i*Math.cos(u),h=r*Math.sin(u),p=new Ee(f,h);p.command=ne.line}}var Fc=Array.prototype.slice;function Iy(n){if(n==null)return!1;const e=n.length;return typeof e=="number"&&e>=0&&e<4294967296}var re={isNaN:function(n){return typeof n=="number"&&n!==+n},isElement:function(n){return!!(n&&n.nodeType===1)},isObject:function(n){const e=typeof n;return e==="function"||e==="object"&&!!n},isFunction:function(n){return typeof n=="function"},extend:function(n){const e=Fc.call(arguments,1);for(let i=0;i<e.length;i++){const r=e[i];for(let o in r)n[o]=r[o]}return n},defaults:function(n){const e=Fc.call(arguments,1);for(let i=0;i<e.length;i++){const r=e[i];for(let o in r)n[o]===void 0&&(n[o]=r[o])}return n},each:function(n,e,i){const r=i||this,o=!Iy(n)&&Object.keys(n),s=(o||n).length;for(let a=0;a<s;a++){const l=o?o[a]:a;e.call(r,n[l],l,n)}return n},performance:Je.performance&&Je.performance.now?Je.performance:Date},tn={hasEventListeners:typeof Je.addEventListener=="function",bind:function(n,e,i,r){return this.hasEventListeners?n.addEventListener(e,i,!!r):n.attachEvent("on"+e,i),tn},unbind:function(n,e,i,r){return tn.hasEventListeners?n.removeEventListeners(e,i,!!r):n.detachEvent("on"+e,i),tn},getRequestAnimationFrame:function(){const n=["ms","moz","webkit","o"];let e=0,i=Je.requestAnimationFrame;if(!i){for(let o=0;o<n.length;o++)i=Je[n[o]+"RequestAnimationFrame"]||i;i=i||r}function r(o,s){const a=new Date().getTime(),l=Math.max(0,16-(a-e)),c=Je.setTimeout(d,l);e=a+l;function d(){o(a+l)}return c}return i}},or=Je.document?Je.document.createElement("div"):{};or.id="help-two-load",Object.defineProperty(tn,"temp",{enumerable:!0,get:function(){return re.isElement(or)&&!Je.document.head.contains(or)&&(or.style.display="none",Je.document.head.appendChild(or)),or}});var Yt=class extends Error{constructor(e){super(),S(this,"name","Two.js"),S(this,"message"),this.message=e}},Ay=Je.devicePixelRatio||1;function Oy(n){return n.webkitBackingStorePixelRatio||n.mozBackingStorePixelRatio||n.msBackingStorePixelRatio||n.oBackingStorePixelRatio||n.backingStorePixelRatio||1}function Xs(n){return Ay/Oy(n)}var bo=class{constructor(){S(this,"map",{})}add(e,i){return this.map[e]=i,this}remove(e){return delete this.map[e],this}get(e){return this.map[e]}contains(e){return e in this.map}},Nt,di=class extends Array{constructor(){super(),wc(this,Nt,new ee),arguments[0]&&Array.isArray(arguments[0])?arguments[0].length>0&&this.push.apply(this,arguments[0]):arguments.length>0&&this.push.apply(this,arguments)}get _events(){return Xt(this,Nt)}set _events(e){Py(this,Nt,e)}get _bound(){return Xt(this,Nt)._bound}set _bound(e){Xt(this,Nt)._bound=e}addEventListener(){var e;return(e=Xt(this,Nt).addEventListener)==null?void 0:e.apply(this,arguments)}on(){var e;return(e=Xt(this,Nt).on)==null?void 0:e.apply(this,arguments)}bind(){var e;return(e=Xt(this,Nt).bind)==null?void 0:e.apply(this,arguments)}removeEventListener(){var e;return(e=Xt(this,Nt).removeEventListener)==null?void 0:e.apply(this,arguments)}off(){var e;return(e=Xt(this,Nt).off)==null?void 0:e.apply(this,arguments)}unbind(){var e;return(e=Xt(this,Nt).unbind)==null?void 0:e.apply(this,arguments)}dispatchEvent(){var e;return(e=Xt(this,Nt).dispatchEvent)==null?void 0:e.apply(this,arguments)}trigger(){var e;return(e=Xt(this,Nt).trigger)==null?void 0:e.apply(this,arguments)}listen(){var e;return(e=Xt(this,Nt).listen)==null?void 0:e.apply(this,arguments)}ignore(){var e;return(e=Xt(this,Nt).ignore)==null?void 0:e.apply(this,arguments)}pop(){const e=super.pop.apply(this,arguments);return this.trigger(ee.Types.remove,[e]),e}shift(){const e=super.shift.apply(this,arguments);return this.trigger(ee.Types.remove,[e]),e}push(){const e=super.push.apply(this,arguments);return this.trigger(ee.Types.insert,arguments),e}unshift(){const e=super.unshift.apply(this,arguments);return this.trigger(ee.Types.insert,arguments),e}splice(){const e=super.splice.apply(this,arguments);if(this.trigger(ee.Types.remove,e),arguments.length>2){const i=this.slice(arguments[0],arguments[0]+arguments.length-2);this.trigger(ee.Types.insert,i),this.trigger(ee.Types.order)}return e}sort(){return super.sort.apply(this,arguments),this.trigger(ee.Types.order),this}reverse(){return super.reverse.apply(this,arguments),this.trigger(ee.Types.order),this}indexOf(){return super.indexOf.apply(this,arguments)}map(e,i){const r=[];for(let o=0;o<this.length;o++){const s=this[o];let a;i?a=e.call(i,s,o):a=e(s,o),r.push(a)}return r}};Nt=new WeakMap;var Vc=class Rm extends ee{constructor(){super(),S(this,"_flagId",!1),S(this,"_flagClassName",!1),S(this,"_renderer",{}),S(this,"_id",Bt.Identifier+Bt.uniqueId()),S(this,"_className",""),S(this,"classList",[]);for(let e in Mc)Object.defineProperty(this,e,Mc[e])}static fromObject(e){const i=new Rm().copy(e);return"id"in e&&(i.id=e.id),i}flagReset(){return this._flagId=this._flagClassName=!1,this}copy(e){return e.renderer&&typeof e.renderer.type=="string"&&(this.renderer.type=e.renderer.type),typeof e.className=="string"&&(this.className=e.className),this}toObject(){return{renderer:{type:this.renderer.type},id:this.id,className:this.className}}dispose(){if(typeof this.unbind=="function"&&this.unbind(),this._renderer){if(this._renderer.elem&&this._renderer.elem.parentNode&&(this._renderer.elem.parentNode.removeChild(this._renderer.elem),delete this._renderer.elem),this.type==="WebGLRenderer"&&this.renderer.ctx){const i=this.renderer.ctx;this._renderer.texture&&(i.deleteTexture(this._renderer.texture),delete this._renderer.texture),this._renderer.positionBuffer&&(i.deleteBuffer(this._renderer.positionBuffer),delete this._renderer.positionBuffer),this._renderer.effect&&(this._renderer.effect=null)}this.type==="CanvasRenderer"&&this._renderer.context&&delete this._renderer.context}const e=this._renderer.type;return this._renderer={type:e},this}};S(Vc,"Properties",["renderer","id","className"]);var sr=Vc,Mc={renderer:{enumerable:!1,get:function(){return this._renderer}},id:{enumerable:!0,get:function(){return this._id},set:function(n){const e=this._id;n!==this._id&&(this._id=n,this._flagId=!0,this.parent&&(delete this.parent.children.ids[e],this.parent.children.ids[this._id]=this))}},className:{enumerable:!0,get:function(){return this._className},set:function(n){this._className!==n&&(this._flagClassName=!0,this.classList=n.split(/\s+?/),this._className=n)}}},_o,Ic={video:/\.(mp4|webm|ogg)$/i,image:/\.(jpe?g|png|gif|tiff|webp)$/i,effect:/texture|gradient/i};Je.document&&(_o=document.createElement("a"));var bn=class an extends sr{constructor(e,i){super(),S(this,"_flagSrc",!1),S(this,"_flagImage",!1),S(this,"_flagVideo",!1),S(this,"_flagLoaded",!1),S(this,"_flagRepeat",!1),S(this,"_flagOffset",!1),S(this,"_flagScale",!1),S(this,"_src",""),S(this,"_image",null),S(this,"_loaded",!1),S(this,"_repeat","no-repeat"),S(this,"_scale",1),S(this,"_offset",null);for(let r in Ac)Object.defineProperty(this,r,Ac[r]);if(this._renderer.type="texture",this._renderer.flagOffset=zy.bind(this),this._renderer.flagScale=Dy.bind(this),this.loaded=!1,this.repeat="no-repeat",this.offset=new ie,typeof i=="function"){const r=(function(){this.unbind(ee.Types.load,r),typeof i=="function"&&i()}).bind(this);this.bind(ee.Types.load,r)}if(typeof e=="string")this.src=e;else if(typeof e=="object"){const r=Object.prototype.toString.call(e);(r==="[object HTMLImageElement]"||r==="[object HTMLCanvasElement]"||r==="[object HTMLVideoElement]"||r==="[object Image]")&&(this.image=e)}this._update()}fromObject(e){const i=new an().copy(e);return"id"in e&&(i.id=e.id),i}static getAbsoluteURL(e){return _o?(_o.href=e,_o.href):e}static loadHeadlessBuffer(e,i){e.image.onload=i,e.image.src=e.src}static getTag(e){return e&&e.nodeName&&e.nodeName.toLowerCase()||"img"}static getImage(e){const i=an.getAbsoluteURL(e);if(an.ImageRegistry.contains(i))return an.ImageRegistry.get(i);let r;return At.Image?(r=new At.Image,At.shim(r,"img")):Je.document?Ic.video.test(i)?r=document.createElement("video"):r=document.createElement("img"):console.warn("Two.js: no prototypical image defined for Two.Texture"),r.crossOrigin="anonymous",r.referrerPolicy="no-referrer",r}static load(e,i){let r=e.image,o=an.getTag(r);e._flagImage&&(/canvas/i.test(o)?an.Register.canvas(e,i):(e._src=!At.isHeadless&&r.getAttribute("two-src")||r.src,an.Register[o](e,i))),e._flagSrc&&(r||(r=an.getImage(e.src),e.image=r),o=an.getTag(r),an.Register[o](e,i))}clone(){const e=new an(this.src);return e.repeat=this.repeat,e.offset.copy(this.offset),e.scale=this.scale,e}copy(e){return this.src=e.src,this.repeat=e.repeat,this.offset=typeof e.offset=="number"||e.offset instanceof ie?e.offset:new ie().copy(e.offset),this.scale=typeof e.scale=="number"||e.scale instanceof ie?e.scale:new ie().copy(e.scale),this}toObject(){const e=super.toObject.call(this);return e.renderer.type="texture",e.src=this.src,e.repeat=this.repeat,e.offset=this.offset.toObject(),e.scale=typeof this.scale=="number"?this.scale:this.scale.toObject(),e}_update(){return(this._flagSrc||this._flagImage)&&(this.trigger(ee.Types.change),(this._flagSrc||this._flagImage)&&(this.loaded=!1,an.load(this,(function(){this.loaded=!0,this.trigger(ee.Types.change).trigger(ee.Types.load)}).bind(this)))),this._image&&this._image.readyState>=4&&(this._flagVideo=!0),this}flagReset(){return this._flagSrc=this._flagImage=this._flagLoaded=this._flagRepeat=this._flagVideo=this._flagScale=this._flagOffset=!1,super.flagReset.call(this),this}dispose(){if(super.dispose(),"elem"in this._renderer){const e=this._renderer.elem;e.parentNode.removeChild(e)}return"effect"in this._renderer&&(this._renderer.effect=null),this}};S(bn,"Properties",["src","loaded","repeat","scale","offset","image"]),S(bn,"RegularExpressions",Ic),S(bn,"ImageRegistry",new bo),S(bn,"Register",{canvas:function(n,e){n._src="#"+n.id,bn.ImageRegistry.add(n.src,n.image),typeof e=="function"&&e()},img:function(n,e){const i=n.image,r=function(s){!At.isHeadless&&i.removeEventListener&&typeof i.removeEventListener=="function"&&(i.removeEventListener("load",r,!1),i.removeEventListener("error",o,!1)),typeof e=="function"&&e()},o=function(s){throw!At.isHeadless&&typeof i.removeEventListener=="function"&&(i.removeEventListener("load",r,!1),i.removeEventListener("error",o,!1)),new Yt("unable to load "+n.src)};typeof i.width=="number"&&i.width>0&&typeof i.height=="number"&&i.height>0?r():!At.isHeadless&&typeof i.addEventListener=="function"&&(i.addEventListener("load",r,!1),i.addEventListener("error",o,!1)),n._src=bn.getAbsoluteURL(n._src),!(!At.isHeadless&&i&&i.getAttribute("two-src"))&&(At.isHeadless||i.setAttribute("two-src",n.src),bn.ImageRegistry.add(n.src,i),At.isHeadless?bn.loadHeadlessBuffer(n,r):n.image.src=n.src)},video:function(n,e){if(At.isHeadless)throw new Yt("video textures are not implemented in headless environments.");const i=function(o){n.image.removeEventListener("canplaythrough",i,!1),n.image.removeEventListener("error",r,!1),n.image.width=n.image.videoWidth,n.image.height=n.image.videoHeight,typeof e=="function"&&e()},r=function(o){throw n.image.removeEventListener("canplaythrough",i,!1),n.image.removeEventListener("error",r,!1),new Yt("unable to load "+n.src)};n._src=bn.getAbsoluteURL(n._src),n.image.getAttribute("two-src")||(n.image.setAttribute("two-src",n.src),bn.ImageRegistry.add(n.src,n.image)),n.image.readyState>=4?i():(n.image.addEventListener("canplaythrough",i,!1),n.image.addEventListener("error",r,!1),n.image.src=n.src,n.image.load())}});var De=bn,Ac={src:{enumerable:!0,get:function(){return this._src},set:function(n){this._src=n,this._flagSrc=!0}},loaded:{enumerable:!0,get:function(){return this._loaded},set:function(n){this._loaded=n,this._flagLoaded=!0}},repeat:{enumerable:!0,get:function(){return this._repeat},set:function(n){this._repeat=n,this._flagRepeat=!0}},image:{enumerable:!0,get:function(){return this._image},set:function(n){const e=De.getTag(n);let i;switch(e){case"canvas":i="#"+n.id;break;default:i=n.src}De.ImageRegistry.contains(i)?this._image=De.ImageRegistry.get(n.src):this._image=n,this._flagImage=!0}},offset:{enumerable:!0,get:function(){return this._offset},set:function(n){this._offset&&this._offset.unbind(ee.Types.change,this._renderer.flagOffset),this._offset=n,this._offset.bind(ee.Types.change,this._renderer.flagOffset),this._flagOffset=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(n){this._scale instanceof ie&&this._scale.unbind(ee.Types.change,this._renderer.flagScale),this._scale=n,this._scale instanceof ie&&this._scale.bind(ee.Types.change,this._renderer.flagScale),this._flagScale=!0}}};function zy(){this._flagOffset=!0}function Dy(){this._flagScale=!0}var Ys=class Sn extends sr{constructor(e,i,r){super(),S(this,"_flagOffset",!0),S(this,"_flagOpacity",!0),S(this,"_flagColor",!0),S(this,"_offset",0),S(this,"_opacity",1),S(this,"_color","#fff");for(let o in Oc)Object.defineProperty(this,o,Oc[o]);this._renderer.type="stop",this.offset=typeof e=="number"?e:Sn.Index<=0?0:1,this.opacity=typeof r=="number"?r:1,this.color=typeof i=="string"?i:Sn.Index<=0?"#fff":"#000",Sn.Index=(Sn.Index+1)%2}static fromObject(e){const i=new Sn().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<Sn.Properties.length;i++){const r=Sn.Properties[i];r in e&&(this[r]=e[r])}return this}clone(e){const i=new Sn;return re.each(Sn.Properties,function(r){i[r]=this[r]},this),e&&e.stops&&e.stops.push(i),i}toObject(){const e=super.toObject.call(this);return e.renderer.type="stop",re.each(Sn.Properties,i=>{e[i]=this[i]},this),e}flagReset(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,super.flagReset.call(this),this}};S(Ys,"Index",0),S(Ys,"Properties",["offset","opacity","color"]);var ui=Ys,Oc={offset:{enumerable:!0,get:function(){return this._offset},set:function(n){this._offset=n,this._flagOffset=!0,this.parent&&(this.parent._flagStops=!0)}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(n){this._opacity=n,this._flagOpacity=!0,this.parent&&(this.parent._flagStops=!0)}},color:{enumerable:!0,get:function(){return this._color},set:function(n){this._color=n,this._flagColor=!0,this.parent&&(this.parent._flagStops=!0)}}},Us=class Ki extends sr{constructor(e){super(),S(this,"_flagStops",!1),S(this,"_flagSpread",!1),S(this,"_flagUnits",!1),S(this,"_spread",""),S(this,"_units","");for(let i in zc)Object.defineProperty(this,i,zc[i]);this._renderer.type="gradient",this._renderer.flagStops=Ly.bind(this),this._renderer.bindStops=Hy.bind(this),this._renderer.unbindStops=Wy.bind(this),this.spread="pad",this.units="objectBoundingBox",e&&(this.stops=e)}static fromObject(e){let i=e.stops;i&&i.length>0&&(i=i.map(o=>o instanceof ui?o:new ui().copy(o)));const r=new Ki(i).copy(e);return"id"in e&&(r.id=e.id),r}clone(e){const i=this.stops.map(o=>o.clone()),r=new Ki(i);return re.each(Ki.Properties,o=>{r[o]=this[o]},this),e&&e.add(r),r}copy(e){super.copy.call(this,e);for(let i=0;i<Ki.Properties.length;i++){const r=Ki.Properties[i];r in e&&(this[r]=e[r])}return this}toObject(){const e={stops:this.stops.map(i=>i.toObject())};return re.each(Ki.Properties,i=>{e[i]=this[i]},this),e}_update(){return(this._flagSpread||this._flagStops)&&this.trigger(ee.Types.change),this}flagReset(){return this._flagSpread=this._flagUnits=this._flagStops=!1,super.flagReset.call(this),this}dispose(){if("elem"in this._renderer){const e=this._renderer.elem;e.parentNode.removeChild(e)}return"effect"in this._renderer&&(this._renderer.effect=null),this}};S(Us,"Stop",ui),S(Us,"Properties",["spread","stops","units"]);var pt=Us,zc={spread:{enumerable:!0,get:function(){return this._spread},set:function(n){this._spread=n,this._flagSpread=!0}},units:{enumerable:!0,get:function(){return this._units},set:function(n){this._units=n,this._flagUnits=!0}},stops:{enumerable:!0,get:function(){return this._stops},set:function(n){const e=this._renderer.bindStops,i=this._renderer.unbindStops;this._stops&&this._stops.unbind(ee.Types.insert,e).unbind(ee.Types.remove,i),this._stops=new di((n||[]).slice(0)),this._stops.bind(ee.Types.insert,e).bind(ee.Types.remove,i),e(this._stops)}}};function Ly(){this._flagStops=!0}function Hy(n){let e=n.length;for(;e--;)n[e].bind(ee.Types.change,this._renderer.flagStops),n[e].parent=this;this._renderer.flagStops()}function Wy(n){let e=n.length;for(;e--;)n[e].unbind(ee.Types.change,this._renderer.flagStops),delete n[e].parent;this._renderer.flagStops()}var Ks=class ro extends pt{constructor(e,i,r,o,s){super(s),S(this,"_flagEndPoints",!1),S(this,"_left",null),S(this,"_right",null);for(let a in Dc)Object.defineProperty(this,a,Dc[a]);this._renderer.type="linear-gradient",this._renderer.flagEndPoints=jy.bind(this),this.left=new ie,this.right=new ie,typeof e=="number"&&(this.left.x=e),typeof i=="number"&&(this.left.y=i),typeof r=="number"&&(this.right.x=r),typeof o=="number"&&(this.right.y=o)}static fromObject(e){const i=new ro().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<ro.Properties.length;i++){const r=ro.Properties[i];r in e&&(this[r]=e[r]instanceof ie?e[r]:new ie().copy(e[r]))}return this}clone(e){const i=this.stops.map(function(o){return o.clone()}),r=new ro(this.left._x,this.left._y,this.right._x,this.right._y,i);return re.each(pt.Properties,function(o){r[o]=this[o]},this),e&&e.add(r),r}toObject(){const e=super.toObject.call(this);return e.left=this.left.toObject(),e.right=this.right.toObject(),e}_update(){return(this._flagEndPoints||this._flagSpread||this._flagStops)&&this.trigger(ee.Types.change),this}flagReset(){return this._flagEndPoints=!1,super.flagReset.call(this),this}};S(Ks,"Stop",ui),S(Ks,"Properties",["left","right"]);var et=Ks,Dc={left:{enumerable:!0,get:function(){return this._left},set:function(n){this._left instanceof ie&&this._left.unbind(ee.Types.change,this._renderer.flagEndPoints),this._left=n,this._left.bind(ee.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}},right:{enumerable:!0,get:function(){return this._right},set:function(n){this._right instanceof ie&&this._right.unbind(ee.Types.change,this._renderer.flagEndPoints),this._right=n,this._right.bind(ee.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}}};function jy(){this._flagEndPoints=!0}var Gs=class Gi extends pt{constructor(e,i,r,o,s,a){super(o),S(this,"_flagRadius",!1),S(this,"_flagCenter",!1),S(this,"_flagFocal",!1),S(this,"_radius",0),S(this,"_center",null),S(this,"_focal",null);for(let l in Lc)Object.defineProperty(this,l,Lc[l]);this._renderer.type="radial-gradient",this._renderer.flagCenter=qy.bind(this),this._renderer.flagFocal=Xy.bind(this),this.center=new ie,this.radius=typeof r=="number"?r:1,this.focal=new ie,typeof e=="number"&&(this.center.x=e),typeof i=="number"&&(this.center.y=i),this.focal.copy(this.center),typeof s=="number"&&(this.focal.x=s),typeof a=="number"&&(this.focal.y=a)}static fromObject(e){const i=new Gi().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<Gi.Properties.length;i++){const r=Gi.Properties[i];r in e&&(/(center|focal)i/.test(r)?this[r]=e[r]instanceof ie?e[r]:new ie().copy(e[r]):typeof e[r]=="number"&&(this[r]=e[MediaKeySystemAccess]))}return this}clone(e){const i=this.stops.map(function(o){return o.clone()}),r=new Gi(this.center._x,this.center._y,this._radius,i,this.focal._x,this.focal._y);return re.each(pt.Properties.concat(Gi.Properties),function(o){r[o]=this[o]},this),e&&e.add(r),r}toObject(){const e=super.toObject.call(this);return re.each(Gi.Properties,function(i){e[i]=this[i]},this),e.center=this.center.toObject(),e.focal=this.focal.toObject(),e}_update(){return(this._flagRadius||this._flatCenter||this._flagFocal||this._flagSpread||this._flagStops)&&this.trigger(ee.Types.change),this}flagReset(){return this._flagRadius=this._flagCenter=this._flagFocal=!1,super.flagReset.call(this),this}};S(Gs,"Stop",ui),S(Gs,"Properties",["center","radius","focal"]);var tt=Gs,Lc={radius:{enumerable:!0,get:function(){return this._radius},set:function(n){this._radius=n,this._flagRadius=!0}},center:{enumerable:!0,get:function(){return this._center},set:function(n){this._center&&this._center.unbind(ee.Types.change,this._renderer.flagCenter),this._center=n,this._center.bind(ee.Types.change,this._renderer.flagCenter),this._flagCenter=!0}},focal:{enumerable:!0,get:function(){return this._focal},set:function(n){this._focal&&this._focal.unbind(ee.Types.change,this._renderer.flagFocal),this._focal=n,this._focal.bind(ee.Types.change,this._renderer.flagFocal),this._flagFocal=!0}}};function qy(){this._flagCenter=!0}function Xy(){this._flagFocal=!0}function Hc(n,e){if(e===0||e===1)return!0;const r=n._length*e;let o=0;for(let s=0;s<n._lengths.length;s++){const a=n._lengths[s];if(o>=r)return r-o>=0;o+=a}return!1}function wo(n,e){const i=n._length;if(e<=0)return 0;if(e>=i)return n._lengths.length-1;for(let r=0,o=0;r<n._lengths.length;r++){if(o+n._lengths[r]>=e)return e-=o,Math.max(r-1,0)+e/n._lengths[r];o+=n._lengths[r]}return-1}function Wc(n,e,i){let r,o,s,a,l,c,d,u;const f=e.controls&&e.controls.right,h=n.controls&&n.controls.left;return r=e.x,l=e.y,o=(f||e).x,c=(f||e).y,s=(h||n).x,d=(h||n).y,a=n.x,u=n.y,f&&e._relative&&(o+=e.x,c+=e.y),h&&n._relative&&(s+=n.x,d+=n.y),Tc(r,l,o,c,s,d,a,u,i)}function Zs(n,e,i){let r,o,s,a,l,c,d,u;const f=e.controls&&e.controls.right,h=n.controls&&n.controls.left;return r=e.x,l=e.y,o=(f||e).x,c=(f||e).y,s=(h||n).x,d=(h||n).y,a=n.x,u=n.y,f&&e._relative&&(o+=e.x,c+=e.y),h&&n._relative&&(s+=n.x,d+=n.y),js(r,l,o,c,s,d,a,u,i)}function Bi(n){switch(n.renderer.type){case"texture":return De.fromObject(n);case"gradient":return pt.fromObject(n);case"linear-gradient":return et.fromObject(n);case"radial-gradient":return tt.fromObject(n)}return n}var Yy=Math.cos,Uy=Math.sin,jc=Math.tan,Qs=[],qc=class ln extends ee{constructor(e,i,r,o,s,a){super(),S(this,"elements",new Bn(9)),S(this,"manual",!1);let l=e;Array.isArray(l)||(l=Array.prototype.slice.call(arguments)),this.identity(),l.length>0&&this.set(l)}static Multiply(e,i,r){if(i.length<=3){const N=e;let k,$,v;const E=i[0]||0,P=i[1]||0,F=i[2]||0;return k=N[0]*E+N[1]*P+N[2]*F,$=N[3]*E+N[4]*P+N[5]*F,v=N[6]*E+N[7]*P+N[8]*F,[k,$,v]}const o=e[0],s=e[1],a=e[2],l=e[3],c=e[4],d=e[5],u=e[6],f=e[7],h=e[8],p=i[0],m=i[1],g=i[2],b=i[3],y=i[4],_=i[5],x=i[6],w=i[7],C=i[8];return r=r||new Bn(9),r[0]=o*p+s*b+a*x,r[1]=o*m+s*y+a*w,r[2]=o*g+s*_+a*C,r[3]=l*p+c*b+d*x,r[4]=l*m+c*y+d*w,r[5]=l*g+c*_+d*C,r[6]=u*p+f*b+h*x,r[7]=u*m+f*y+h*w,r[8]=u*g+f*_+h*C,r}static fromObject(e){return new ln().copy(e)}set(e,i,r,o,s,a,l,c,d){if(typeof i>"u"){const u=e;e=u[0],i=u[1],r=u[2],o=u[3],s=u[4],a=u[5],l=u[6],c=u[7],d=u[8]}return this.elements[0]=e,this.elements[1]=i,this.elements[2]=r,this.elements[3]=o,this.elements[4]=s,this.elements[5]=a,this.elements[6]=l,this.elements[7]=c,this.elements[8]=d,this.trigger(ee.Types.change)}copy(e){return this.elements[0]=e.elements[0],this.elements[1]=e.elements[1],this.elements[2]=e.elements[2],this.elements[3]=e.elements[3],this.elements[4]=e.elements[4],this.elements[5]=e.elements[5],this.elements[6]=e.elements[6],this.elements[7]=e.elements[7],this.elements[8]=e.elements[8],this.manual=e.manual,this.trigger(ee.Types.change)}identity(){return this.elements[0]=ln.Identity[0],this.elements[1]=ln.Identity[1],this.elements[2]=ln.Identity[2],this.elements[3]=ln.Identity[3],this.elements[4]=ln.Identity[4],this.elements[5]=ln.Identity[5],this.elements[6]=ln.Identity[6],this.elements[7]=ln.Identity[7],this.elements[8]=ln.Identity[8],this.trigger(ee.Types.change)}multiply(e,i,r,o,s,a,l,c,d){if(typeof i>"u")return this.elements[0]*=e,this.elements[1]*=e,this.elements[2]*=e,this.elements[3]*=e,this.elements[4]*=e,this.elements[5]*=e,this.elements[6]*=e,this.elements[7]*=e,this.elements[8]*=e,this.trigger(ee.Types.change);if(typeof r>"u"&&(r=1),typeof o>"u"){e=e||0,i=i||0,r=r||0,s=this.elements;const M=s[0]*e+s[1]*i+s[2]*r,X=s[3]*e+s[4]*i+s[5]*r,G=s[6]*e+s[7]*i+s[8]*r;return[M,X,G]}const u=this.elements,f=[e,i,r,o,s,a,l,c,d],h=u[0],p=u[1],m=u[2],g=u[3],b=u[4],y=u[5],_=u[6],x=u[7],w=u[8],C=f[0],N=f[1],k=f[2],$=f[3],v=f[4],E=f[5],P=f[6],F=f[7],R=f[8];return this.elements[0]=h*C+p*$+m*P,this.elements[1]=h*N+p*v+m*F,this.elements[2]=h*k+p*E+m*R,this.elements[3]=g*C+b*$+y*P,this.elements[4]=g*N+b*v+y*F,this.elements[5]=g*k+b*E+y*R,this.elements[6]=_*C+x*$+w*P,this.elements[7]=_*N+x*v+w*F,this.elements[8]=_*k+x*E+w*R,this.trigger(ee.Types.change)}inverse(e){const i=this.elements;e=e||new ln;const r=i[0],o=i[1],s=i[2],a=i[3],l=i[4],c=i[5],d=i[6],u=i[7],f=i[8],h=f*l-c*u,p=-f*a+c*d,m=u*a-l*d;let g=r*h+o*p+s*m;return g?(g=1/g,e.elements[0]=h*g,e.elements[1]=(-f*o+s*u)*g,e.elements[2]=(c*o-s*l)*g,e.elements[3]=p*g,e.elements[4]=(f*r-s*d)*g,e.elements[5]=(-c*r+s*a)*g,e.elements[6]=m*g,e.elements[7]=(-u*r+o*d)*g,e.elements[8]=(l*r-o*a)*g,e):null}scale(e,i){return arguments.length<=1&&(i=e),this.multiply(e,0,0,0,i,0,0,0,1)}rotate(e){const i=Yy(e),r=Uy(e);return this.multiply(i,-r,0,r,i,0,0,0,1)}translate(e,i){return this.multiply(1,0,e,0,1,i,0,0,1)}skewX(e){const i=jc(e);return this.multiply(1,i,0,0,1,0,0,0,1)}skewY(e){const i=jc(e);return this.multiply(1,0,0,i,1,0,0,0,1)}toString(e){return Qs.length=0,this.toTransformArray(e,Qs),Qs.map(ze).join(" ")}toTransformArray(e,i){const r=this.elements,o=!!i,s=r[0],a=r[1],l=r[2],c=r[3],d=r[4],u=r[5];if(e){const f=r[6],h=r[7],p=r[8];if(o){i[0]=s,i[1]=c,i[2]=f,i[3]=a,i[4]=d,i[5]=h,i[6]=l,i[7]=u,i[8]=p;return}return[s,c,f,a,d,h,l,u,p]}if(o){i[0]=s,i[1]=c,i[2]=a,i[3]=d,i[4]=l,i[5]=u;return}return[s,c,a,d,l,u]}toArray(e,i){const r=this.elements,o=!!i,s=r[0],a=r[1],l=r[2],c=r[3],d=r[4],u=r[5];if(e){const f=r[6],h=r[7],p=r[8];if(o){i[0]=s,i[1]=a,i[2]=l,i[3]=c,i[4]=d,i[5]=u,i[6]=f,i[7]=h,i[8]=p;return}return[s,a,l,c,d,u,f,h,p]}if(o){i[0]=s,i[1]=a,i[2]=l,i[3]=c,i[4]=d,i[5]=u;return}return[s,a,l,c,d,u]}toObject(){return{renderer:{type:"matrix"},elements:this.toArray(!0),manual:!!this.manual}}clone(){return new ln().copy(this)}};S(qc,"Identity",[1,0,0,0,1,0,0,0,1]);var Ni=qc;vc(Ni);var Xc=class jl extends sr{constructor(){super(),S(this,"_flagMatrix",!0),S(this,"_flagScale",!1),S(this,"_matrix",null),S(this,"_worldMatrix",null),S(this,"_position",null),S(this,"_rotation",0),S(this,"_scale",1),S(this,"_skewX",0),S(this,"_skewY",0);for(let e in xo)Object.defineProperty(this,e,xo[e]);this._renderer.flagMatrix=Yc.bind(this),this.isShape=!0,this.matrix=new Ni,this.worldMatrix=new Ni,this.position=new ie,this.rotation=0,this.scale=1,this.skewX=0,this.skewY=0}static fromObject(e){const i=new jl().copy(e);return"id"in e&&(i.id=e.id),i}get renderer(){return this._renderer}set renderer(e){this._renderer=e}get translation(){return xo.position.get.apply(this,arguments)}set translation(e){xo.position.set.apply(this,arguments)}addTo(e){return e.add(this),this}remove(){return this.parent?(this.parent.remove(this),this):this}contains(e,i,r){const o=r||{},s=o.ignoreVisibility===!0;if(!s&&"visible"in this&&this.visible===!1||!s&&"opacity"in this&&typeof this.opacity=="number"&&this.opacity<=0||typeof this.getBoundingClientRect!="function")return!1;const a=typeof o.tolerance=="number"?o.tolerance:0;this._update(!0);const l=this.getBoundingClientRect();return l?e>=l.left-a&&e<=l.right+a&&i>=l.top-a&&i<=l.bottom+a:!1}copy(e){return super.copy.call(this,e),"position"in e&&(e.position instanceof ie?this.position=e.position:this.position.copy(e.position)),"rotation"in e&&(this.rotation=e.rotation),"scale"in e&&(this.scale=typeof e.scale=="number"||e.scale instanceof ie?e.scale:new ie(e.scale.x,e.scale.y)),"skewX"in e&&(this.skewX=e.skewX),"skewY"in e&&(this.skewY=e.skewY),"matrix"in e&&e.matrix.manual&&(this.matrix.copy(e.matrix),this.matrix.manual=!0),this}clone(e){const i=new jl;return i.position.copy(this.position),i.rotation=this.rotation,i.scale=this.scale,i.skewX=this.skewX,i.skewY=this.skewY,this.matrix.manual&&i.matrix.copy(this.matrix),e&&e.add(i),i._update()}toObject(){const e=super.toObject.call(this);return e.renderer={type:"shape"},e.isShape=!0,e.translation=this.translation.toObject(),e.rotation=this.translation.rotation,e.scale=this.scale instanceof ie?this.scale.toObject():this.scale,e.skewX=this.skewX,e.skewY=this.skewY,e.matrix=this.matrix.toObject(),e}dispose(){super.dispose(),typeof this.translation=="object"&&typeof this.translation.unbind=="function"&&this.translation.unbind(),typeof this.scale=="object"&&typeof this.scale.unbind=="function"&&this.scale.unbind()}_update(e){return!this._matrix.manual&&this._flagMatrix&&(this._matrix.identity().translate(this.position.x,this.position.y),this._matrix.rotate(this.rotation),this._scale instanceof ie?this._matrix.scale(this._scale.x,this._scale.y):this._matrix.scale(this._scale),this._matrix.skewX(this.skewX),this._matrix.skewY(this.skewY)),e&&this.parent&&this.parent._update&&this.parent._update(),this}flagReset(){return this._flagMatrix=this._flagScale=!1,super.flagReset.call(this),this}};S(Xc,"Properties",["position","rotation","scale","skewX","skewY","matrix","worldMatrix"]);var qn=Xc,xo={position:{enumerable:!0,get:function(){return this._position},set:function(n){this._position&&this._position.unbind(ee.Types.change,this._renderer.flagMatrix),this._position=n,this._position.bind(ee.Types.change,this._renderer.flagMatrix),Yc.call(this)}},rotation:{enumerable:!0,get:function(){return this._rotation},set:function(n){this._rotation=n,this._flagMatrix=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(n){this._scale instanceof ie&&this._scale.unbind(ee.Types.change,this._renderer.flagMatrix),this._scale=n,this._scale instanceof ie&&this._scale.bind(ee.Types.change,this._renderer.flagMatrix),this._flagMatrix=!0,this._flagScale=!0}},skewX:{enumerable:!0,get:function(){return this._skewX},set:function(n){this._skewX=n,this._flagMatrix=!0}},skewY:{enumerable:!0,get:function(){return this._skewY},set:function(n){this._skewY=n,this._flagMatrix=!0}},matrix:{enumerable:!0,get:function(){return this._matrix},set:function(n){this._matrix=n,this._flagMatrix=!0}},worldMatrix:{enumerable:!0,get:function(){return Hs(this,this._worldMatrix),this._worldMatrix},set:function(n){this._worldMatrix=n}}};function Yc(){this._flagMatrix=!0}var Uc=/^(?:none|transparent)$/i,Ky=8,Js=Number.EPSILON;function Xn(n,e){return{x:n,y:e}}function ko(n,e,i=Js){return Math.abs(n.x-e.x)<=i&&Math.abs(n.y-e.y)<=i}function Kc(n,e,i,r){const o=n*i+e*r,s=Math.sqrt(n*n+e*e)*Math.sqrt(i*i+r*r)||1e-12;let a=Math.acos(Math.max(-1,Math.min(1,o/s)));return n*r-e*i<0&&(a=-a),a}function Gy(n,e,i){if(!n)return[Xn(e.x,e.y)];let r=e.rx,o=e.ry;if(!(r&&o))return[Xn(e.x,e.y)];const s=(e.xAxisRotation||0)*Math.PI/180,a=e.largeArcFlag?1:0,l=e.sweepFlag?1:0;r=Math.abs(r),o=Math.abs(o);const c=n.x,d=n.y,u=e.x,f=e.y,h=(c-u)/2,p=(d-f)/2,m=Math.cos(s),g=Math.sin(s);let b=m*h+g*p,y=-g*h+m*p,_=r*r,x=o*o;const w=b*b/_+y*y/x;if(w>1){const A=Math.sqrt(w);r*=A,o*=A,_=r*r,x=o*o}const C=_*y*y+x*b*b,N=C===0?0:(_*x-C)/C;let k=Math.sqrt(Math.max(0,N));a===l&&(k=-k);const $=k*r*y/o,v=-k*o*b/r,E=m*$-g*v+(c+u)/2,P=g*$+m*v+(d+f)/2,F=Kc(1,0,(b-$)/r,(y-v)/o),R=Kc((b-$)/r,(y-v)/o,(-b-$)/r,(-y-v)/o)%ot,M=F+R,X=l===0,G=(()=>{const A=M-F,Y=Math.abs(A)<Number.EPSILON;let H=ut(A,ot);return H<Number.EPSILON&&(H=Y?0:ot),X&&!Y&&(H=H===ot?-ot:H-ot),H})(),Z=Math.max(Bt.Resolution,Math.max(i*2,1)),O=[];for(let A=1;A<=Z;A++){const Y=A/Z,H=F+Y*G;let T=E+r*Math.cos(H),D=P+o*Math.sin(H);if(s!==0){const K=T-E,J=D-P,U=Math.cos(s),q=Math.sin(s);T=K*U-J*q+E,D=K*q+J*U+P}O.push(Xn(T,D))}return O}function Zy(n,e=Ky){const i=[],r=[],o=n._renderer&&n._renderer.vertices&&n._renderer.vertices.length>0?n._renderer.vertices:n.vertices;if(!o||o.length===0)return{polygons:i,segments:r};const s=Math.max(1,Math.floor(e));let a=null,l=null,c=null,d=null;const u=(h=!1)=>{if(a){if(h&&l&&c&&!ko(l,c)){const p=Xn(l.x,l.y);r.push({a:c,b:p}),a.push(p),c=p}a.length>=3&&l&&c&&ko(l,c)&&i.push(a),a=null,l=null,c=null}},f=h=>{if(!c){c=h,a&&a.push(h);return}ko(c,h)||(r.push({a:c,b:h}),a&&a.push(h),c=h)};for(let h=0;h<o.length;h++){const p=o[h],m=p.command||(h===0?ne.move:ne.line);if(m===ne.move){u(!1);const g=Xn(p.x,p.y);a=[g],l=g,c=g,d=p;continue}if(d||(d=o[Math.max(h-1,0)]),m===ne.line)f(Xn(p.x,p.y));else if(m===ne.curve){const g=Zs(p,d,s);for(let b=1;b<g.length;b++){const y=g[b];f(Xn(y.x,y.y))}f(Xn(p.x,p.y))}else if(m===ne.arc){const g=Gy(d,p,s);for(let b=0;b<g.length;b++)f(g[b])}else if(m===ne.close){u(!0),d=p;continue}else f(Xn(p.x,p.y));d=p}if(a){const h=!!n._closed||!!n.closed||l&&c&&!ko(l,c);u(h)}return{polygons:i,segments:r}}function Qy(n,e,i){let r=!1;for(let o=0;o<n.length;o++){const s=n[o];if(!s||s.length<3)continue;let a=s.length-1;for(let l=0;l<s.length;l++){const c=s[a],d=s[l];d.y>i!=c.y>i&&e<(c.x-d.x)*(i-d.y)/(c.y-d.y||1e-12)+d.x&&(r=!r),a=l}}return r}function Jy(n,e,i,r){const o=r.x-i.x,s=r.y-i.y;if(Math.abs(o)<Js&&Math.abs(s)<Js){const h=n-i.x,p=e-i.y;return h*h+p*p}const a=((n-i.x)*o+(e-i.y)*s)/(o*o+s*s),l=Math.max(0,Math.min(1,a)),c=i.x+l*o,d=i.y+l*s,u=n-c,f=e-d;return u*u+f*f}function e0(n,e,i){if(!n||n.length===0)return 1/0;let r=1/0;for(let o=0;o<n.length;o++){const s=n[o],a=Jy(e,i,s.a,s.b);a<r&&(r=a)}return Math.sqrt(r)}function t0(n,e){if(typeof e=="boolean")return e;const i=n.fill;return!i&&i!==0?!1:typeof i=="string"?!Uc.test(i):!0}function n0(n,e){const i=typeof n.linewidth=="number"?n.linewidth:n._linewidth||0;if(typeof e=="boolean")return e&&i>0;if(!(i>0))return!1;const r=n.stroke;return!r&&r!==0?!1:typeof r=="string"?!Uc.test(r):!0}function i0(n,e,i,r=0){if(!n)return!1;const o=n.left-r,s=n.right+r,a=n.top-r,l=n.bottom+r;return e>=o&&e<=s&&i>=a&&i<=l}var Co=Number.EPSILON;function vo(n){return typeof n.relative!="boolean"||!!n.relative}function _n(n,e,i,r){const o=n.controls;if(!(!o||!o[e])){if(Math.abs(i)<Co&&Math.abs(r)<Co){vo(n)?o[e].clear():o[e].set(n.x,n.y);return}vo(n)?o[e].set(i,r):o[e].set(n.x+i,n.y+r)}}function Ut(n,e){_n(n,e,0,0)}function r0(n,e){const i=n.controls;return!i||!i[e]?{x:0,y:0}:vo(n)?{x:i[e].x,y:i[e].y}:{x:i[e].x-n.x,y:i[e].y-n.y}}function ar(n,e){const i=r0(n,e);return Math.abs(i.x)>Co||Math.abs(i.y)>Co}function So(n){n.command===ne.move||n.command===ne.close||(n.command=ar(n,"left")||ar(n,"right")?ne.curve:ne.line)}function Gc(n,e){typeof e.relative=="boolean"&&(n.relative=e.relative)}function o0(n,e){return ar(e,"right")||ar(n,"left")||ar(n,"right")||ar(e,"left")||n.command===ne.curve||e.command===ne.curve}function lr(n,e,i){return{x:Ot(n.x,e.x,i),y:Ot(n.y,e.y,i)}}function Zc(n,e){const i=n.controls&&n.controls[e];return i?vo(n)?{x:n.x+i.x,y:n.y+i.y}:{x:i.x,y:i.y}:{x:n.x,y:n.y}}function s0(n,e,i){const r=n.controls&&n.controls.right,o=e.controls&&e.controls.left,s={x:n.x,y:n.y},a=r?Zc(n,"right"):Vr({},s),l={x:e.x,y:e.y},c=o?Zc(e,"left"):Vr({},l),d=lr(s,a,i),u=lr(a,c,i),f=lr(c,l,i),h=lr(d,u,i),p=lr(u,f,i),m=lr(h,p,i),g=new Ee(m.x,m.y);return Gc(g,n),_n(g,"left",h.x-m.x,h.y-m.y),_n(g,"right",p.x-m.x,p.y-m.y),g.command=ne.curve,{anchor:g,startOut:d,endIn:f}}function a0(n,e,i,r,o,s){const a=n.length,l=i-e+1;let c=l-1,d=o?Math.min(l,4):1,u=d,f=d;if(r||(u=Math.min(1,e),f=Math.min(1,a-i-1)),c+=u+f,c<=1)return;const h=new Array(c+1);for(let k=0,$=e-u;k<=c;k+=1,$+=1){const v=ut($,a);h[k]=n[v]}let p=h[0].x+2*h[1].x,m=h[0].y+2*h[1].y,g=2;const b=c-1,y=[p],_=[m],x=[g],w=new Array(c+1),C=new Array(c+1);for(let k=1;k<c;k+=1){const $=k<b,v=$||s?1:2,E=$?4:s?2:7,P=$?4:s?3:8,F=$?2:s?0:1,R=v/g;g=x[k]=E-R,p=y[k]=P*h[k].x+F*h[k+1].x-R*p,m=_[k]=P*h[k].y+F*h[k+1].y-R*m}w[b]=y[b]/x[b],C[b]=_[b]/x[b];for(let k=c-2;k>=0;k-=1)w[k]=(y[k]-w[k+1])/x[k],C[k]=(_[k]-C[k+1])/x[k];w[c]=(3*h[c].x-w[b])/2,C[c]=(3*h[c].y-C[b])/2;const N=c-f;for(let k=u,$=e;k<=N;k+=1,$+=1){const v=ut($,a),E=n[v],P=w[k]-E.x,F=C[k]-E.y;o||k<N?_n(E,"right",P,F):Ut(E,"right"),o||k>u?_n(E,"left",-P,-F):Ut(E,"left"),So(E)}}function l0(n,e,i,r,o,s){const a=e||n,l=n,c=i||n,d=ie.distanceBetween(a,l),u=ie.distanceBetween(l,c),f=r===void 0?.5:r,h=Math.pow(d,f),p=Math.pow(u,f),m=h*h,g=p*p;if(!o&&e){const b=2*g+3*p*h+m,y=3*p*(p+h);if(y!==0){const _=(g*a.x+b*l.x-m*c.x)/y-l.x,x=(g*a.y+b*l.y-m*c.y)/y-l.y;_n(n,"left",_,x)}else Ut(n,"left")}else Ut(n,"left");if(!s&&i){const b=2*m+3*h*p+g,y=3*h*(h+p);if(y!==0){const _=(m*c.x+b*l.x-g*a.x)/y-l.x,x=(m*c.y+b*l.y-g*a.y)/y-l.y;_n(n,"right",_,x)}else Ut(n,"right")}else Ut(n,"right");So(n)}function c0(n,e,i,r,o,s){if(!(e&&i)){e||Ut(n,"left"),i||Ut(n,"right"),So(n);return}const a=e,l=n,c=i,d=ie.distanceBetween(a,l),u=ie.distanceBetween(l,c),f=d+u,h=r===void 0?.4:r,p={x:a.x-c.x,y:a.y-c.y};if(!o&&f!==0){const m=h*d/f;_n(n,"left",p.x*m,p.y*m)}else Ut(n,"left");if(!s&&f!==0){const m=h*d/f-h;_n(n,"right",p.x*m,p.y*m)}else Ut(n,"right");So(n)}function d0(n,e,i,r,o,s){const a=s.type,l=s.factor,c=n.length;for(let d=e;d<=i;d+=1){const u=ut(d,c),f=n[u];if(f.command===ne.move){Ut(f,"left"),Ut(f,"right");continue}const h=d===e&&!o?null:d-1,p=d===i&&!o?null:d+1,m=h===null?null:n[ut(h,c)],g=p===null?null:n[ut(p,c)],b=h===null,y=p===null;a==="geometric"?c0(f,m,g,l,b,y):l0(f,m,g,l,b,y)}}var cr=Math.min,dr=Math.max,u0=Math.ceil,f0=Math.floor,h0=new ie,m0=new Ni,ea=class wi extends qn{constructor(e,i,r,o){super(),S(this,"_flagVertices",!0),S(this,"_flagLength",!0),S(this,"_flagFill",!0),S(this,"_flagStroke",!0),S(this,"_flagLinewidth",!0),S(this,"_flagOpacity",!0),S(this,"_flagVisible",!0),S(this,"_flagCap",!0),S(this,"_flagJoin",!0),S(this,"_flagMiter",!0),S(this,"_flagStrokeAttenuation",!0),S(this,"_flagMask",!1),S(this,"_flagClip",!1),S(this,"_length",0),S(this,"_fill","#fff"),S(this,"_stroke","#000"),S(this,"_linewidth",1),S(this,"_opacity",1),S(this,"_visible",!0),S(this,"_cap","round"),S(this,"_join","round"),S(this,"_miter",4),S(this,"_closed",!0),S(this,"_curved",!1),S(this,"_automatic",!0),S(this,"_beginning",0),S(this,"_ending",1),S(this,"_mask",null),S(this,"_clip",!1),S(this,"_dashes",null),S(this,"_strokeAttenuation",!0);for(let s in Qc)Object.defineProperty(this,s,Qc[s]);this._renderer.type="path",this._renderer.flagVertices=Jc.bind(this),this._renderer.bindVertices=ed.bind(this),this._renderer.unbindVertices=td.bind(this),this._renderer.flagFill=nd.bind(this),this._renderer.flagStroke=id.bind(this),this._renderer.vertices=[],this._renderer.collection=[],this.closed=!!i,this.curved=!!r,this.beginning=0,this.ending=1,this.fill="#fff",this.stroke="#000",this.linewidth=1,this.opacity=1,this.className="",this.visible=!0,this.cap="butt",this.join="miter",this.miter=4,this.vertices=e,this.automatic=!o,this.dashes=[],this.dashes.offset=0}static fromObject(e){const i=typeof e.fill=="string"?e.fill:Bi(e.fill),r=typeof e.stroke=="string"?e.stroke:Bi(e.stroke),o=new wi().copy(Ls(Vr({},e),{fill:i,stroke:r}));return"id"in e&&(o.id=e.id),o}copy(e){if(super.copy.call(this,e),e.vertices){this.vertices=[];for(let i=0;i<e.vertices.length;i++){const r=e.vertices[i];r instanceof Ee?this.vertices.push(e.vertices[i].clone()):this.vertices.push(new Ee().copy(r))}}for(let i=0;i<wi.Properties.length;i++){const r=wi.Properties[i];r in e&&(this[r]=e[r])}return this}clone(e){const i=new wi;for(let r=0;r<this.vertices.length;r++)i.vertices.push(this.vertices[r].clone());for(let r=0;r<wi.Properties.length;r++){const o=wi.Properties[r];i[o]=this[o]}return i.className=this.className,i.translation.copy(this.translation),i.rotation=this.rotation,i.scale=this.scale,i.skewX=this.skewX,i.skewY=this.skewY,this.matrix.manual&&i.matrix.copy(this.matrix),e&&e.add(i),i._update()}toObject(){const e=super.toObject.call(this);return e.renderer.type="path",e.vertices=this.vertices.map(i=>i.toObject()),re.each(wi.Properties,i=>{typeof this[i]<"u"&&(this[i].toObject?e[i]=this[i].toObject():e[i]=this[i])},this),e}dispose(){if(super.dispose(),this.vertices&&typeof this.vertices.unbind=="function")try{this.vertices.unbind()}catch{}if(this.vertices)for(let e=0;e<this.vertices.length;e++){const i=this.vertices[e];typeof i.unbind=="function"&&i.unbind(),i.controls&&(i.controls.left&&typeof i.controls.left.unbind=="function"&&i.controls.left.unbind(),i.controls.right&&typeof i.controls.right.unbind=="function"&&i.controls.right.unbind())}return typeof this.fill=="object"&&typeof this.fill.dispose=="function"?this.fill.dispose():typeof this.fill=="object"&&typeof this.fill.unbind=="function"&&this.fill.unbind(),typeof this.stroke=="object"&&typeof this.stroke.dispose=="function"?this.stroke.dispose():typeof this.stroke=="object"&&typeof this.stroke.unbind=="function"&&this.stroke.unbind(),this}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}corner(){const e=this.getBoundingClientRect(!0),i=e.width/2,r=e.height/2,o=e.left+e.width/2,s=e.top+e.height/2;for(let a=0;a<this.vertices.length;a++){const l=this.vertices[a];l.x-=o,l.y-=s,l.x+=i,l.y+=r}return this.mask&&(this.mask.translation.x-=o,this.mask.translation.x+=i,this.mask.translation.y-=s,this.mask.translation.y+=r),this}center(){const e=this.getBoundingClientRect(!0),i=e.left+e.width/2-this.translation.x,r=e.top+e.height/2-this.translation.y;for(let o=0;o<this.vertices.length;o++){const s=this.vertices[o];s.x-=i,s.y-=r}return this.mask&&(this.mask.translation.x-=i,this.mask.translation.y-=r),this}getBoundingClientRect(e){let i,r,o,s,a,l,c=1/0,d=-1/0,u=1/0,f=-1/0;if(this._update(!0),i=e?this.matrix:this.worldMatrix,r=(this.linewidth||0)/2,o=this._renderer.vertices.length,this.linewidth>0||this.stroke&&!/(transparent|none)/i.test(this.stroke))if(this.matrix.manual){const{scaleX:h,scaleY:p}=Si(i.elements[0],i.elements[3],i.elements[1],i.elements[4],i.elements[2],i.elements[5]);typeof h=="number"&&typeof p=="number"&&(r=Math.max(h,p)*(this.linewidth||0)/2)}else r*=typeof this.scale=="number"?this.scale:Math.max(this.scale.x,this.scale.y);if(o<=0)return{width:0,height:0};for(s=0;s<o;s++){l=this._renderer.vertices[s],a=this._renderer.vertices[(s+o-1)%o];const[h,p]=i.multiply(a.x,a.y),[m,g]=i.multiply(l.x,l.y);if(a.controls&&l.controls){let b=a.controls.right.x,y=a.controls.right.y;a.relative&&(b+=a.x,y+=a.y);let[_,x]=i.multiply(b,y),w=l.controls.left.x,C=l.controls.left.y;l.relative&&(w+=l.x,C+=l.y);let[N,k]=i.multiply(w,C);const $=$c(h,p,_,x,N,k,m,g);u=cr($.min.y-r,u),c=cr($.min.x-r,c),d=dr($.max.x+r,d),f=dr($.max.y+r,f)}else s<=1&&(u=cr(p-r,u),c=cr(h-r,c),d=dr(h+r,d),f=dr(p+r,f)),u=cr(g-r,u),c=cr(m-r,c),d=dr(m+r,d),f=dr(g+r,f)}return{top:u,left:c,right:d,bottom:f,width:d-c,height:f-u}}contains(e,i,r){const o=r||{},s=o.ignoreVisibility===!0;if(!s&&this.visible===!1||!s&&typeof this.opacity=="number"&&this.opacity<=0)return!1;const a=typeof o.tolerance=="number"?o.tolerance:0;this._update(!0);const l=this.getBoundingClientRect();if(!l||e<l.left-a||e>l.right+a||i<l.top-a||i>l.bottom+a)return!1;const c=this.worldMatrix,d=c&&c.inverse(m0);if(!d)return super.contains(e,i,o);const[u,f]=d.multiply(e,i,1),h=typeof o.precision=="number"&&!Number.isNaN(o.precision)?Math.max(1,Math.floor(o.precision)):8,p=t0(this,o.fill),m=n0(this,o.stroke),{polygons:g,segments:b}=Zy(this,h);if(p&&g.length>0&&Qy(g,u,f))return!0;if(m&&b.length>0){const y=typeof this.linewidth=="number"?this.linewidth:0;if(y>0&&e0(b,u,f)<=y/2+a)return!0}return!p&&!m?super.contains(e,i,o):p&&g.length===0?super.contains(e,i,o):!1}getPointAt(e,i){let r,o,s,a,l,c,d,u,f,h,p,m,g,b,y,_=this.length*Math.min(Math.max(e,0),1);const x=this.vertices.length,w=x-1;let C=null,N=null;for(let Z=0,O=this._lengths.length,A=0;Z<O;Z++){if(A+this._lengths[Z]>=_){this._closed?(r=ut(Z,x),o=ut(Z-1,x),Z===0&&(r=o,o=Z)):(r=Z,o=Math.min(Math.max(Z-1,0),w)),C=this.vertices[r],N=this.vertices[o],_-=A,this._lengths[Z]!==0?e=_/this._lengths[Z]:e=0;break}A+=this._lengths[Z]}if(C===null||N===null)return null;if(C){if(!N)return C}else return N;y=N.controls&&N.controls.right,b=C.controls&&C.controls.left,l=N.x,h=N.y,c=(y||N).x,p=(y||N).y,d=(b||C).x,m=(b||C).y,u=C.x,g=C.y,y&&N.relative&&(c+=N.x,p+=N.y),b&&C.relative&&(d+=C.x,m+=C.y),a=Mr(e,l,c,d,u),f=Mr(e,h,p,m,g);const k=Ot(l,c,e),$=Ot(h,p,e),v=Ot(c,d,e),E=Ot(p,m,e),P=Ot(d,u,e),F=Ot(m,g,e),R=Ot(k,v,e),M=Ot($,E,e),X=Ot(v,P,e),G=Ot(E,F,e);return re.isObject(i)?(i.x=a,i.y=f,i instanceof Ee&&(i.controls.left.x=R,i.controls.left.y=M,i.controls.right.x=X,i.controls.right.y=G,(typeof i.relative!="boolean"||i.relative)&&(i.controls.left.x-=a,i.controls.left.y-=f,i.controls.right.x-=a,i.controls.right.y-=f)),i.t=e,i):(s=new Ee(a,f,R-a,M-f,X-a,G-f,this._curved?ne.curve:ne.line),s.t=e,s)}plot(){if(this.curved)return Rc(this._collection,this.closed),this;for(let e=0;e<this._collection.length;e++)this._collection[e].command=e===0?ne.move:ne.line;return this}smooth(e){const i=e||{},r=i.type||"continuous",o=this._collection,s=o.length;if(s<2)return this;const a=this._closed||s>0&&o[s-1]&&o[s-1].command===ne.close,l=(h,p)=>{if(h==null)return p;if(typeof h=="number"){if(a)return ut(h,s);let g=h;return g<0&&(g+=s),Math.min(Math.max(g,0),s-1)}const m=o.indexOf(h);return m!==-1?m:p},c=a&&i.from===void 0&&i.to===void 0;let d=l(i.from,0),u=l(i.to,s-1);if(d>u)if(a)d-=s;else{const h=d;d=u,u=h}const f=u-d+1;for(let h=0;h<f;h+=1){const p=ut(d+h,s),m=o[p],g=!a&&p===0;m.command===ne.move&&!g&&(m.command=ne.line)}if(r==="continuous"||r==="asymmetric")a0(o,d,u,a,c,r==="asymmetric");else if(r==="catmull-rom"||r==="geometric"){const h={type:r,factor:i.factor};d0(o,d,u,a,c,h)}else throw new Error(`Path.smooth does not support type "${r}". Try 'continuous', 'asymmetric', 'catmull-rom', or 'geometric'.`);return this._automatic=!1,this._flagVertices=!0,this._flagLength=!0,this}subdivide(e){this._update();const i=this.vertices,r=i.length;if(r<2)return this;const o=[];let s=null,a=null;for(let l=0;l<r;l+=1){const c=i[l];if(!s||c.command===ne.move){const u=c.clone();o.push(u),s=c,a=c;continue}if(o0(c,s)){const f=Zs(c,s,e).length,h=o[o.length-1];let p=h.clone(),m=c.clone(),g=h,b=0;if(f<=1){const y=c.clone();o.push(y)}else{for(let _=1;_<f;_+=1){const x=_/f,w=1-b,C=w<=Number.EPSILON?x:(x-b)/w,N=s0(p,m,C);_n(g,"right",N.startOut.x-g.x,N.startOut.y-g.y);const k=N.anchor;o.push(k),g=k,p=k.clone(),b=x,_n(m,"left",N.endIn.x-m.x,N.endIn.y-m.y)}const y=c.clone();y.controls.left.copy(m.controls.left),o.push(y)}}else{const u=Zs(c,s,e);for(let h=1;h<u.length;h+=1){const p=u[h];Gc(p,s),Ut(p,"left"),Ut(p,"right"),p.command=ne.line,o.push(p)}const f=c.clone();o.push(f)}s=c,c.command===ne.close&&(s=a)}return this._automatic=!1,this._curved=!1,this.vertices=o,this}_updateLength(e,i){i||this._update();const o=this.vertices.length-1;let s=this.vertices[o],a=0;return typeof this._lengths>"u"&&(this._lengths=[]),re.each(this.vertices,function(l,c){if(c<=0||l.command===ne.move){s=l,this._lengths[c]=0;return}this._lengths[c]=Wc(l,s,e),a+=this._lengths[c],s=l},this),this._length=a,this._flagLength=!1,this}_update(){if(this._flagVertices){this._automatic&&this.plot(),this._flagLength&&this._updateLength(void 0,!0);const e=this._collection.length,i=this._closed,r=Math.min(this._beginning,this._ending),o=Math.max(this._beginning,this._ending),s=wo(this,r*this._length),a=wo(this,o*this._length),l=u0(s),c=f0(a);let d,u,f,h,p,m;for(this._renderer.vertices.length=0,m=0;m<e;m++)this._renderer.collection.length<=m&&this._renderer.collection.push(new Ee),m>c&&!u?(p=this._renderer.collection[m].copy(this._collection[m]),this.getPointAt(o,p),p.command=this._renderer.collection[m].command,this._renderer.vertices.push(p),u=p,f=this._collection[m-1],f&&f.controls&&(p.relative?p.controls.right.clear():p.controls.right.copy(p),f.relative?this._renderer.collection[m-1].controls.right.copy(f.controls.right).lerp(ie.zero,1-p.t):this._renderer.collection[m-1].controls.right.copy(f.controls.right).lerp(f,1-p.t))):m>=l&&m<=c&&(p=this._renderer.collection[m].copy(this._collection[m]),this._renderer.vertices.push(p),m===c&&Hc(this,o)?(u=p,!i&&u.controls&&(u.relative?u.controls.right.clear():u.controls.right.copy(u))):m===l&&Hc(this,r)&&(d=p,d.command=ne.move,!i&&d.controls&&(d.relative?d.controls.left.clear():d.controls.left.copy(d))));l>0&&!d&&(m=l-1,p=this._renderer.collection[m].copy(this._collection[m]),this.getPointAt(r,p),p.command=ne.move,this._renderer.vertices.unshift(p),h=this._collection[m+1],h&&h.controls&&(p.controls.left.clear(),h.relative?this._renderer.collection[m+1].controls.left.copy(h.controls.left).lerp(ie.zero,p.t):(h0.copy(h),this._renderer.collection[m+1].controls.left.copy(h.controls.left).lerp(h,p.t))))}return qn.prototype._update.apply(this,arguments),this}flagReset(){return this._flagVertices=this._flagLength=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagCap=this._flagJoin=this._flagMiter=this._flagClip=this._flagStrokeAttenuation=!1,qn.prototype.flagReset.call(this),this}};S(ea,"Properties",["fill","stroke","linewidth","opacity","visible","cap","join","miter","closed","curved","automatic","beginning","ending","dashes","strokeAttenuation"]),S(ea,"Utils",{getCurveLength:Wc});var Pe=ea,Qc={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(n){this._linewidth=n,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(n){this._opacity=n,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(n){this._visible=n,this._flagVisible=!0}},cap:{enumerable:!0,get:function(){return this._cap},set:function(n){this._cap=n,this._flagCap=!0}},join:{enumerable:!0,get:function(){return this._join},set:function(n){this._join=n,this._flagJoin=!0}},miter:{enumerable:!0,get:function(){return this._miter},set:function(n){this._miter=n,this._flagMiter=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(n){(this._fill instanceof pt||this._fill instanceof et||this._fill instanceof tt||this._fill instanceof De)&&this._fill.unbind(ee.Types.change,this._renderer.flagFill),this._fill=n,this._flagFill=!0,(this._fill instanceof pt||this._fill instanceof et||this._fill instanceof tt||this._fill instanceof De)&&this._fill.bind(ee.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(n){(this._stroke instanceof pt||this._stroke instanceof et||this._stroke instanceof tt||this._stroke instanceof De)&&this._stroke.unbind(ee.Types.change,this._renderer.flagStroke),this._stroke=n,this._flagStroke=!0,(this._stroke instanceof pt||this._stroke instanceof et||this._stroke instanceof tt||this._stroke instanceof De)&&this._stroke.bind(ee.Types.change,this._renderer.flagStroke)}},length:{get:function(){return this._flagLength&&this._updateLength(),this._length}},closed:{enumerable:!0,get:function(){return this._closed},set:function(n){this._closed=!!n,this._flagVertices=!0}},curved:{enumerable:!0,get:function(){return this._curved},set:function(n){this._curved=!!n,this._flagVertices=!0}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(n){if(n===this._automatic)return;this._automatic=!!n;const e=this._automatic?"ignore":"listen";re.each(this.vertices,function(i){i[e]()})}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(n){this._beginning=n,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(n){this._ending=n,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(n){const e=this._renderer.bindVertices,i=this._renderer.unbindVertices;this._collection&&this._collection.unbind(ee.Types.insert,e).unbind(ee.Types.remove,i),n instanceof di?this._collection=n:this._collection=new di(n||[]),this._collection.bind(ee.Types.insert,e).bind(ee.Types.remove,i),e(this._collection)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(n){this._mask=n,this._flagMask=!0,re.isObject(n)&&!n.clip&&(n.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(n){this._clip=n,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(n){typeof n.offset!="number"&&(n.offset=this.dashes&&this._dashes.offset||0),this._dashes=n}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(n){this._strokeAttenuation=!!n,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};function Jc(){this._flagVertices=!0,this._flagLength=!0,this.parent&&(this.parent._flagLength=!0)}function ed(n){let e=n.length;for(;e--;)n[e].bind(ee.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function td(n){let e=n.length;for(;e--;)n[e].unbind(ee.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function nd(){this._flagFill=!0}function id(){this._flagStroke=!0}var rd=class oo extends Pe{constructor(e,i,r,o){const s=[new Ee,new Ee,new Ee,new Ee];super(s,!0,!1,!0),S(this,"_flagWidth",!1),S(this,"_flagHeight",!1),S(this,"_width",0),S(this,"_height",0),S(this,"_origin",null),this._renderer.type="rectangle";for(let a in od)Object.defineProperty(this,a,od[a]);this.width=typeof r=="number"?r:1,this.height=typeof o=="number"?o:1,this.origin=new ie,typeof e=="number"&&(this.translation.x=e),typeof i=="number"&&(this.translation.y=i),this._update()}static fromObject(e){const i=new oo().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<oo.Properties.length;i++){const r=oo.Properties[i];r in e&&(typeof e[r]=="number"?this[r]=e[r]:this[r]instanceof ie&&this[r].copy(e[r]))}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){const e=this._width/2,i=this._height/2;!this._closed&&this.vertices.length===4&&this.vertices.push(new Ee),this.vertices[0].set(-e,-i).sub(this._origin).command=ne.move,this.vertices[1].set(e,-i).sub(this._origin).command=ne.line,this.vertices[2].set(e,i).sub(this._origin).command=ne.line,this.vertices[3].set(-e,i).sub(this._origin).command=ne.line,this.vertices[4]&&(this.vertices[4].set(-e,-i).sub(this._origin).command=ne.line)}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(e){const i=new oo(0,0,this.width,this.height);i.translation.copy(this.translation),i.rotation=this.rotation,i.scale=this.scale,i.skewX=this.skewX,i.skewY=this.skewY,this.matrix.manual&&i.matrix.copy(this.matrix);for(let r=0;r<Pe.Properties.length;r++){const o=Pe.Properties[r];i[o]instanceof ie?i[o].copy(this[o]):i[o]=this[o]}return e&&e.add(i),i}toObject(){const e=super.toObject.call(this);return e.renderer.type="rectangle",e.width=this.width,e.height=this.height,e.origin=this.origin.toObject(),e}};S(rd,"Properties",["width","height","origin"]);var fi=rd,od={width:{enumerable:!0,get:function(){return this._width},set:function(n){this._width=n,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(n){this._height=n,this._flagHeight=!0}},origin:{enumerable:!0,get:function(){return this._origin},set:function(n){this._origin&&this._origin.unbind(ee.Types.change,this._renderer.flagVertices),this._origin=n,this._origin.bind(ee.Types.change,this._renderer.flagVertices),this._renderer.flagVertices()}}},sd=class so extends fi{constructor(e,i,r,o,s,a){super(i,r,0,0),S(this,"_flagTexture",!1),S(this,"_flagColumns",!1),S(this,"_flagRows",!1),S(this,"_flagFrameRate",!1),S(this,"_flagIndex",!1),S(this,"_amount",1),S(this,"_duration",0),S(this,"_startTime",0),S(this,"_playing",!1),S(this,"_firstFrame",0),S(this,"_lastFrame",0),S(this,"_loop",!0),S(this,"_texture",null),S(this,"_columns",1),S(this,"_rows",1),S(this,"_frameRate",0),S(this,"_index",0),S(this,"_origin",null),this._renderer.type="sprite";for(let l in ad)Object.defineProperty(this,l,ad[l]);this.noStroke(),this.noFill(),e instanceof De?this.texture=e:typeof e=="string"&&(this.texture=new De(e)),this.origin=new ie,this._update(),typeof o=="number"&&(this.columns=o),typeof s=="number"&&(this.rows=s),typeof a=="number"&&(this.frameRate=a),this.index=0}static fromObject(e){const i=new so().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<so.Properties.length;i++){const r=so.Properties[i];r in e&&(this[r]=e[r])}return this}play(e,i,r){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=re.performance.now(),typeof e=="number"&&(this._firstFrame=e),typeof i=="number"&&(this._lastFrame=i),typeof r=="function"?this._onLastFrame=r:delete this._onLastFrame,this._index!==this._firstFrame&&(this._startTime-=1e3*Math.abs(this._index-this._firstFrame)/this._frameRate),this}pause(){return this._playing=!1,this}stop(){return this._playing=!1,this._index=0,this}clone(e){const i=new so(this.texture,this.translation.x,this.translation.y,this.columns,this.rows,this.frameRate);return this.playing&&i.play(this._firstFrame,this._lastFrame),i.loop=this.loop,i.firstFrame=this.firstFrame,i.lastFrame=this.lastFrame,e&&e.add(i),i}toObject(){const e=super.toObject.call(this);return e.renderer.type="sprite",e.texture=this.texture.toObject(),e.columns=this.columns,e.rows=this.rows,e.frameRate=this.frameRate,e.index=this.index,e.firstFrame=this.firstFrame,e.lastFrame=this.lastFrame,e.loop=this.loop,e}dispose(){return super.dispose(),this._playing&&(this._playing=!1),this._onLastFrame=null,this._startTime=0,this._texture&&typeof this._texture.dispose=="function"?this._texture.dispose():this._texture&&typeof this._texture.unbind=="function"&&this._texture.unbind(),this}_update(){const e=this._texture,i=this._columns,r=this._rows;let o,s,a,l,c,d,u,f,h;if(e&&((this._flagColumns||this._flagRows)&&(this._amount=this._columns*this._rows),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._flagTexture&&(this.fill=e),e.loaded)){u=e.image.width,f=e.image.height,o=u/i,s=f/r,l=this._amount,this.width!==o&&(this.width=o),this.height!==s&&(this.height=s),this._playing&&this._frameRate>0&&(re.isNaN(this._lastFrame)&&(this._lastFrame=l-1),a=re.performance.now()-this._startTime,h=this._lastFrame+1,c=1e3*(h-this._firstFrame)/this._frameRate,this._loop?a=a%c:a=Math.min(a,c),d=Ot(this._firstFrame,h,a/c),d=Math.floor(d),d!==this._index&&(this._index=d,d>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()));const p=this._index%i,m=Math.floor(this._index/i),g=-o*p+(u-o)/2,b=-s*m+(f-s)/2;g!==e.offset.x&&(e.offset.x=g),b!==e.offset.y&&(e.offset.y=b)}return super._update.call(this),this}flagReset(){return this._flagTexture=this._flagColumns=this._flagRows=this._flagFrameRate=!1,super.flagReset.call(this),this}};S(sd,"Properties",["texture","columns","rows","frameRate","index","firstFrame","lastFrame","loop"]);var Bo=sd,ad={texture:{enumerable:!0,get:function(){return this._texture},set:function(n){this._texture=n,this._flagTexture=!0}},columns:{enumerable:!0,get:function(){return this._columns},set:function(n){this._columns=n,this._flagColumns=!0}},rows:{enumerable:!0,get:function(){return this._rows},set:function(n){this._rows=n,this._flagRows=!0}},frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(n){this._frameRate=n,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(n){this._index=n,this._flagIndex=!0}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(n){this._firstFrame=n}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(n){this._lastFrame=n}},loop:{enumerable:!0,get:function(){return this._loop},set:function(n){this._loop=!!n}}},ta,ld=class extends di{constructor(e){e=Array.isArray(e)?e:Array.prototype.slice.call(arguments),super(e),wc(this,ta,{}),this.attach(e),this.on(ee.Types.insert,this.attach),this.on(ee.Types.remove,this.detach)}get ids(){return Xt(this,ta)}attach(e){for(let i=0;i<e.length;i++){const r=e[i];r&&r.id&&(this.ids[r.id]=r)}return this}detach(e){for(let i=0;i<e.length;i++)delete this.ids[e[i].id];return this}};ta=new WeakMap;var cd=class Zi extends Pe{constructor(e,i,r,o,s,a,l){const c=l||Bt.Resolution*3,d=[];for(let u=0;u<c;u++)d.push(new Ee);super(d,!0,!1,!0),S(this,"_flagStartAngle",!1),S(this,"_flagEndAngle",!1),S(this,"_flagInnerRadius",!1),S(this,"_flagOuterRadius",!1),S(this,"_startAngle",0),S(this,"_endAngle",ot),S(this,"_innerRadius",0),S(this,"_outerRadius",0),this._renderer.type="arc-segment";for(let u in dd)Object.defineProperty(this,u,dd[u]);typeof r=="number"&&(this.innerRadius=r),typeof o=="number"&&(this.outerRadius=o),typeof s=="number"&&(this.startAngle=s),typeof a=="number"&&(this.endAngle=a),this._update(),typeof e=="number"&&(this.translation.x=e),typeof i=="number"&&(this.translation.y=i)}static fromObject(e){const i=new Zi().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<Zi.Properties.length;i++){const r=Zi.Properties[i];r in e&&typeof e[r]=="number"&&(this[r]=e[r])}return this}_update(){if(this._flagVertices||this._flagStartAngle||this._flagEndAngle||this._flagInnerRadius||this._flagOuterRadius){const e=this._startAngle,i=this._endAngle,r=this._innerRadius,o=this._outerRadius,s=ut(e,ot)===ut(i,ot),a=r>0,l=this.vertices;let c=a?l.length/2:l.length,d,u=0,f,h,p,m,g,b,y,_,x;for(s?c--:a||(c-=2),f=0,h=c-1;f<c;f++){switch(p=f/h,m=l[u],g=p*(i-e)+e,b=(i-e)/c,y=o*Math.cos(g),_=o*Math.sin(g),f){case 0:d=ne.move;break;default:d=ne.curve}m.command=d,m.x=y,m.y=_,m.controls.left.clear(),m.controls.right.clear(),m.command===ne.curve&&(x=o*b/Math.PI,m.controls.left.x=x*Math.cos(g-mt),m.controls.left.y=x*Math.sin(g-mt),m.controls.right.x=x*Math.cos(g+mt),m.controls.right.y=x*Math.sin(g+mt),f===1&&m.controls.left.multiplyScalar(2),f===h&&m.controls.right.multiplyScalar(2)),u++}if(a){for(s?(l[u].command=ne.close,u++):(c--,h=c-1),f=0;f<c;f++)p=f/h,m=l[u],g=(1-p)*(i-e)+e,b=(i-e)/c,y=r*Math.cos(g),_=r*Math.sin(g),d=ne.curve,f<=0&&(d=s?ne.move:ne.line),m.command=d,m.x=y,m.y=_,m.controls.left.clear(),m.controls.right.clear(),m.command===ne.curve&&(x=r*b/Math.PI,m.controls.left.x=x*Math.cos(g+mt),m.controls.left.y=x*Math.sin(g+mt),m.controls.right.x=x*Math.cos(g-mt),m.controls.right.y=x*Math.sin(g-mt),f===1&&m.controls.left.multiplyScalar(2),f===h&&m.controls.right.multiplyScalar(2)),u++;l[u].copy(l[0]),l[u].command=ne.line}else s||(l[u].command=ne.line,l[u].x=0,l[u].y=0,u++,l[u].copy(l[0]),l[u].command=ne.line)}return super._update.call(this),this}flagReset(){return super.flagReset.call(this),this._flagStartAngle=this._flagEndAngle=this._flagInnerRadius=this._flagOuterRadius=!1,this}clone(e){const i=this.innerRadius,r=this.outerRadius,o=this.startAngle,s=this.endAngle,a=this.vertices.length,l=new Zi(0,0,i,r,o,s,a);l.translation.copy(this.translation),l.rotation=this.rotation,l.scale=this.scale,l.skewX=this.skewX,l.skewY=this.skewY,this.matrix.manual&&l.matrix.copy(this.matrix);for(let c=0;c<Pe.Properties.length;c++){const d=Pe.Properties[c];l[d]=this[d]}return e&&e.add(l),l}toObject(){const e=super.toObject.call(this);e.renderer.type="arc-segment";for(let i=0;i<Zi.Properties.length;i++){const r=Zi.Properties[i];e[r]=this[r]}return e}};S(cd,"Properties",["startAngle","endAngle","innerRadius","outerRadius"]);var na=cd,dd={startAngle:{enumerable:!0,get:function(){return this._startAngle},set:function(n){this._startAngle=n,this._flagStartAngle=!0}},endAngle:{enumerable:!0,get:function(){return this._endAngle},set:function(n){this._endAngle=n,this._flagEndAngle=!0}},innerRadius:{enumerable:!0,get:function(){return this._innerRadius},set:function(n){this._innerRadius=n,this._flagInnerRadius=!0}},outerRadius:{enumerable:!0,get:function(){return this._outerRadius},set:function(n){this._outerRadius=n,this._flagOuterRadius=!0}}},ia=Math.cos,ra=Math.sin,ud=class Qi extends Pe{constructor(e,i,r,o){const s=o?Math.max(o,2):4,a=[];for(let l=0;l<s;l++)a.push(new Ee(0,0,0,0,0,0));super(a,!0,!0,!0),S(this,"_flagRadius",!1),S(this,"_radius",0),this._renderer.type="circle";for(let l in fd)Object.defineProperty(this,l,fd[l]);typeof r=="number"&&(this.radius=r),this._update(),typeof e=="number"&&(this.translation.x=e),typeof i=="number"&&(this.translation.y=i)}static fromObject(e){const i=new Qi().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<Qi.Properties.length;i++){const r=Qi.Properties[i];r in e&&typeof e[r]=="number"&&(this[r]=e[r])}return this}_update(){if(this._flagVertices||this._flagRadius){let e=this.vertices.length;!this._closed&&e>2&&(e-=1);const i=4/3*Math.tan(Math.PI/(e*2)),r=this._radius,o=r*i;for(let s=0;s<this.vertices.length;s++){const l=s/e*ot,c=r*ia(l),d=r*ra(l),u=o*ia(l-mt),f=o*ra(l-mt),h=o*ia(l+mt),p=o*ra(l+mt),m=this.vertices[s];m.command=s===0?ne.move:ne.curve,m.set(c,d),m.controls.left.set(u,f),m.controls.right.set(h,p)}}return super._update.call(this),this}flagReset(){return this._flagRadius=!1,super.flagReset.call(this),this}clone(e){const i=new Qi(0,0,this.radius,this.vertices.length);i.translation.copy(this.translation),i.rotation=this.rotation,i.scale=this.scale,i.skewX=this.skewX,i.skewY=this.skewY,this.matrix.manual&&i.matrix.copy(this.matrix);for(let r=0;r<Pe.Properties.length;r++){const o=Pe.Properties[r];i[o]=this[o]}return e&&e.add(i),i}toObject(){const e=super.toObject.call(this);e.renderer.type="circle";for(let i=0;i<Qi.Properties.length;i++){const r=Qi.Properties[i];e[r]=this[r]}return e}};S(ud,"Properties",["radius"]);var No=ud,fd={radius:{enumerable:!0,get:function(){return this._radius},set:function(n){this._radius=n,this._flagRadius=!0}}},oa=Math.cos,sa=Math.sin,hd=class Ji extends Pe{constructor(e,i,r,o,s){typeof o!="number"&&typeof r=="number"&&(o=r);const a=s?Math.max(s,2):4,l=[];for(let c=0;c<a;c++)l.push(new Ee);super(l,!0,!0,!0),S(this,"_flagWidth",!1),S(this,"_flagHeight",!1),S(this,"_width",0),S(this,"_height",0),this._renderer.type="ellipse";for(let c in md)Object.defineProperty(this,c,md[c]);typeof r=="number"&&(this.width=r*2),typeof o=="number"&&(this.height=o*2),this._update(),typeof e=="number"&&(this.translation.x=e),typeof i=="number"&&(this.translation.y=i)}static fromObject(e){const i=new Ji().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<Ji.Properties.length;i++){const r=Ji.Properties[i];r in e&&typeof e[r]=="number"&&(this[r]=e[r])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){let e=this.vertices.length;!this._closed&&e>2&&(e-=1);const i=4/3*Math.tan(Math.PI/(this.vertices.length*2)),r=this._width/2,o=this._height/2;for(let s=0;s<this.vertices.length;s++){const l=s/e*ot,c=r*oa(l),d=o*sa(l),u=r*i*oa(l-mt),f=o*i*sa(l-mt),h=r*i*oa(l+mt),p=o*i*sa(l+mt),m=this.vertices[s];m.command=s===0?ne.move:ne.curve,m.set(c,d),m.controls.left.set(u,f),m.controls.right.set(h,p)}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(e){const i=this.width/2,r=this.height/2,o=this.vertices.length,s=new Ji(0,0,i,r,o);s.translation.copy(this.translation),s.rotation=this.rotation,s.scale=this.scale,s.skewX=this.skewX,s.skewY=this.skewY,this.matrix.manual&&s.matrix.copy(this.matrix);for(let a=0;a<Pe.Properties.length;a++){const l=Pe.Properties[a];s[l]=this[l]}return e&&e.add(s),s}toObject(){const e=super.toObject.call(this);e.renderer.type="ellipse";for(let i=0;i<Ji.Properties.length;i++){const r=Ji.Properties[i];e[r]=this[r]}return e}};S(hd,"Properties",["width","height"]);var To=hd,md={width:{enumerable:!0,get:function(){return this._width},set:function(n){this._width=n,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(n){this._height=n,this._flagHeight=!0}}},p0=Math.ceil,g0=Math.floor,pd=class xi extends qn{constructor(e){super(),S(this,"_flagVertices",!0),S(this,"_flagLength",!0),S(this,"_flagFill",!0),S(this,"_flagStroke",!0),S(this,"_flagLinewidth",!0),S(this,"_flagOpacity",!0),S(this,"_flagVisible",!0),S(this,"_flagSize",!0),S(this,"_flagSizeAttenuation",!0),S(this,"_flagStrokeAttenuation",!0),S(this,"_length",0),S(this,"_fill","#fff"),S(this,"_stroke","#000"),S(this,"_linewidth",1),S(this,"_opacity",1),S(this,"_visible",!0),S(this,"_size",1),S(this,"_sizeAttenuation",!1),S(this,"_beginning",0),S(this,"_ending",1),S(this,"_dashes",null),S(this,"_strokeAttenuation",!0),S(this,"noFill",Pe.prototype.noFill),S(this,"noStroke",Pe.prototype.noStroke),S(this,"corner",Pe.prototype.corner),S(this,"center",Pe.prototype.center),S(this,"getBoundingClientRect",Pe.prototype.getBoundingClientRect),S(this,"_updateLength",Pe.prototype._updateLength);for(let i in gd)Object.defineProperty(this,i,gd[i]);this._renderer.type="points",this._renderer.flagVertices=Jc.bind(this),this._renderer.bindVertices=ed.bind(this),this._renderer.unbindVertices=td.bind(this),this._renderer.flagFill=nd.bind(this),this._renderer.flagStroke=id.bind(this),this._renderer.vertices=null,this._renderer.collection=null,this.size=1,this.sizeAttenuation=!1,this.beginning=0,this.ending=1,this.fill="#fff",this.stroke="#000",this.linewidth=1,this.opacity=1,this.className="",this.visible=!0,this.vertices=e,this.dashes=[],this.dashes.offset=0}static fromObject(e){const i=typeof e.fill=="string"?e.fill:Bi(e.fill),r=typeof e.stroke=="string"?e.stroke:Bi(e.stroke),o=new xi().copy(Ls(Vr({},e),{fill:i,stroke:r}));return"id"in e&&(o.id=e.id),o}copy(e){super.copy.call(this,e);for(let i=0;i<e.vertices.length;i++){const r=e.vertices[i];r instanceof Ee?this.vertices.push(e.vertices[i].clone()):this.vertices.push(new Ee().copy(r))}for(let i=0;i<xi.Properties.length;i++){const r=xi.Properties[i];r in e&&(this[r]=e[r])}return this}clone(e){const i=new xi;for(let r=0;r<this.vertices.length;r++)i.vertices.push(this.vertices[r].clone());for(let r=0;r<xi.Properties.length;r++){const o=xi.Properties[r];i[o]=this[o]}return i.className=this.className,i.translation.copy(this.translation),i.rotation=this.rotation,i.scale=this.scale,i.skewX=this.skewX,i.skewY=this.skewY,this.matrix.manual&&i.matrix.copy(this.matrix),e&&e.add(i),i._update()}toObject(){const e=super.toObject.call(this);return e.renderer.type="points",e.vertices=this.vertices.map(i=>i.toObject()),re.each(xi.Properties,function(i){typeof this[i]<"u"&&(this[i].toObject?e[i]=this[i].toObject():e[i]=this[i])},this),e}dispose(){if(super.dispose(),this.vertices&&typeof this.vertices.unbind=="function")try{this.vertices.unbind()}catch{}if(this.vertices)for(let e=0;e<this.vertices.length;e++){const i=this.vertices[e];typeof i.unbind=="function"&&i.unbind()}return typeof this.fill=="object"&&typeof this.fill.dispose=="function"?this.fill.dispose():typeof this.fill=="object"&&typeof this.fill.unbind=="function"&&this.fill.unbind(),typeof this.stroke=="object"&&typeof this.stroke.dispose=="function"?this.stroke.dispose():typeof this.stroke=="object"&&typeof this.stroke.unbind=="function"&&this.stroke.unbind(),this}subdivide(e){this._update();let i=[];for(let r=0;r<this.vertices.length;r++){const o=this.vertices[r],s=this.vertices[r-1];if(!s)continue;const a=o.x,l=o.y,c=s.x,d=s.y,u=js(a,l,a,l,c,d,c,d,e);i=i.concat(u)}return this.vertices=i,this}_update(){if(this._flagVertices){this._flagLength&&this._updateLength(void 0,!0);const e=Math.min(this._beginning,this._ending),i=Math.max(this._beginning,this._ending),r=wo(this,e*this._length),o=wo(this,i*this._length),s=p0(r),a=g0(o);let l=0,c;this._renderer.vertices=[],this._renderer.collection=[];for(let d=0;d<this._collection.length;d++)d>=s&&d<=a&&(c=this._collection[d],this._renderer.collection.push(c),this._renderer.vertices[l*2+0]=c.x,this._renderer.vertices[l*2+1]=c.y,l++)}return super._update.apply(this,arguments),this}flagReset(){return this._flagVertices=this._flagLength=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagSize=this._flagSizeAttenuation=!1,super.flagReset.call(this),this}};S(pd,"Properties",["fill","stroke","linewidth","opacity","visible","size","sizeAttenuation","beginning","ending","dashes","strokeAttenuation"]);var aa=pd,gd={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(n){this._linewidth=n,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(n){this._opacity=n,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(n){this._visible=n,this._flagVisible=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(n){this._size=n,this._flagSize=!0}},sizeAttenuation:{enumerable:!0,get:function(){return this._sizeAttenuation},set:function(n){this._sizeAttenuation=n,this._flagSizeAttenuation=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(n){(this._fill instanceof pt||this._fill instanceof et||this._fill instanceof tt||this._fill instanceof De)&&this._fill.unbind(ee.Types.change,this._renderer.flagFill),this._fill=n,this._flagFill=!0,(this._fill instanceof pt||this._fill instanceof et||this._fill instanceof tt||this._fill instanceof De)&&this._fill.bind(ee.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(n){(this._stroke instanceof pt||this._stroke instanceof et||this._stroke instanceof tt||this._stroke instanceof De)&&this._stroke.unbind(ee.Types.change,this._renderer.flagStroke),this._stroke=n,this._flagStroke=!0,(this._stroke instanceof pt||this._stroke instanceof et||this._stroke instanceof tt||this._stroke instanceof De)&&this._stroke.bind(ee.Types.change,this._renderer.flagStroke)}},length:{get:function(){return this._flagLength&&this._updateLength(),this._length}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(n){this._beginning=n,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(n){this._ending=n,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(n){const e=this._renderer.bindVertices,i=this._renderer.unbindVertices;this._collection&&this._collection.unbind(ee.Types.insert,e).unbind(ee.Types.remove,i),n instanceof di?this._collection=n:this._collection=new di(n||[]),this._collection.bind(ee.Types.insert,e).bind(ee.Types.remove,i),e(this._collection)}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(n){typeof n.offset!="number"&&(n.offset=this.dashes&&this._dashes.offset||0),this._dashes=n}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(n){this._strokeAttenuation=!!n,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}},y0=Math.cos,b0=Math.sin,yd=class er extends Pe{constructor(e,i,r,o){o=Math.max(o||0,3),super(),S(this,"_flagWidth",!1),S(this,"_flagHeight",!1),S(this,"_flagSides",!1),S(this,"_radius",0),S(this,"_width",0),S(this,"_height",0),S(this,"_sides",0),this._renderer.type="polygon";for(let s in bd)Object.defineProperty(this,s,bd[s]);this.closed=!0,this.automatic=!1,typeof r=="number"&&(this.radius=r),typeof o=="number"&&(this.sides=o),this._update(),typeof e=="number"&&(this.translation.x=e),typeof i=="number"&&(this.translation.y=i)}static fromObject(e){const i=new er().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<er.Properties.length;i++){const r=er.Properties[i];r in e&&typeof e[r]=="number"&&(this[r]=e[r])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagSides){const e=this._sides,i=e+1;let r=this.vertices.length;r>e&&(this.vertices.splice(e-1,r-e),r=e);for(let o=0;o<i;o++){const s=(o+.5)/e,a=ot*s+Math.PI/2,l=this._width*y0(a)/2,c=this._height*b0(a)/2;o>=r?this.vertices.push(new Ee(l,c)):this.vertices[o].set(l,c),this.vertices[o].command=o===0?ne.move:ne.line}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=this._flagSides=!1,super.flagReset.call(this),this}clone(e){const i=new er(0,0,0,this.sides);i.translation.copy(this.translation),i.rotation=this.rotation,i.scale=this.scale,i.skewX=this.skewX,i.skewY=this.skewY,i.width=this.width,i.height=this.height,this.matrix.manual&&i.matrix.copy(this.matrix);for(let r=0;r<Pe.Properties.length;r++){const o=Pe.Properties[r];i[o]=this[o]}return e&&e.add(i),i}toObject(){const e=super.toObject.call(this);e.renderer.type="polygon";for(let i=0;i<er.Properties.length;i++){const r=er.Properties[i];e[r]=this[r]}return e}};S(yd,"Properties",["width","height","sides"]);var la=yd,bd={radius:{enumerable:!0,get:function(){return this._radius},set:function(n){this._radius=n,this.width=n*2,this.height=n*2}},width:{enumerable:!0,get:function(){return this._width},set:function(n){this._width=n,this._flagWidth=!0,this._radius=Math.max(this.width,this.height)/2}},height:{enumerable:!0,get:function(){return this._height},set:function(n){this._height=n,this._flagHeight=!0,this._radius=Math.max(this.width,this.height)/2}},sides:{enumerable:!0,get:function(){return this._sides},set:function(n){this._sides=n,this._flagSides=!0}}},_d=class tr extends Pe{constructor(e,i,r,o,s){typeof s>"u"&&typeof r=="number"&&typeof o=="number"&&(s=Math.floor(Math.min(r,o)/12));const a=[];for(let l=0;l<10;l++)a.push(new Ee(0,0,0,0,0,0,l===0?ne.move:ne.curve));super(a),S(this,"_flagWidth",!1),S(this,"_flagHeight",!1),S(this,"_flagRadius",!1),S(this,"_width",0),S(this,"_height",0),S(this,"_radius",12),this._renderer.type="rounded-rectangle";for(let l in wd)Object.defineProperty(this,l,wd[l]);this.closed=!0,this.automatic=!1,this._renderer.flagRadius=_0.bind(this),typeof r=="number"&&(this.width=r),typeof o=="number"&&(this.height=o),(typeof s=="number"||s instanceof ie)&&(this.radius=s),this._update(),typeof e=="number"&&(this.translation.x=e),typeof i=="number"&&(this.translation.y=i)}static fromObject(e){const i=new tr().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<tr.Properties.length;i++){const r=tr.Properties[i];if(r in e){const o=e[r];/radius/i.test(r)?this[r]=typeof o=="number"||o instanceof ie?o:new ie().copy(o):typeof o=="number"&&(this[r]=o)}}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagRadius){const e=this._width,i=this._height;let r,o;this._radius instanceof ie?(r=this._radius.x,o=this._radius.y):(r=this._radius,o=this._radius);let s,a=e/2,l=i/2;s=this.vertices[0],s.x=-(a-r),s.y=-l,s=this.vertices[1],s.x=a-r,s.y=-l,s.controls.left.clear(),s.controls.right.x=r,s.controls.right.y=0,s=this.vertices[2],s.x=a,s.y=-(l-o),s.controls.right.clear(),s.controls.left.clear(),s=this.vertices[3],s.x=a,s.y=l-o,s.controls.left.clear(),s.controls.right.x=0,s.controls.right.y=o,s=this.vertices[4],s.x=a-r,s.y=l,s.controls.right.clear(),s.controls.left.clear(),s=this.vertices[5],s.x=-(a-r),s.y=l,s.controls.left.clear(),s.controls.right.x=-r,s.controls.right.y=0,s=this.vertices[6],s.x=-a,s.y=l-o,s.controls.left.clear(),s.controls.right.clear(),s=this.vertices[7],s.x=-a,s.y=-(l-o),s.controls.left.clear(),s.controls.right.x=0,s.controls.right.y=-o,s=this.vertices[8],s.x=-(a-r),s.y=-l,s.controls.left.clear(),s.controls.right.clear(),s=this.vertices[9],s.copy(this.vertices[8])}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=this._flagRadius=!1,super.flagReset.call(this),this}clone(e){const i=this.width,r=this.height,o=this.radius,s=new tr(0,0,i,r,o);s.translation.copy(this.translation),s.rotation=this.rotation,s.scale=this.scale,s.skewX=this.skewX,s.skewY=this.skewY,this.matrix.manual&&s.matrix.copy(this.matrix);for(let a=0;a<Pe.Properties.length;a++){const l=Pe.Properties[a];s[l]=this[l]}return e&&e.add(s),s}toObject(){const e=super.toObject.call(this);e.renderer.type="rounded-rectangle";for(let i=0;i<tr.Properties.length;i++){const r=tr.Properties[i];e[r]=this[r]}return e.radius=typeof this.radius=="number"?this.radius:this.radius.toObject(),e}};S(_d,"Properties",["width","height","radius"]);var $o=_d,wd={width:{enumerable:!0,get:function(){return this._width},set:function(n){this._width=n,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(n){this._height=n,this._flagHeight=!0}},radius:{enumerable:!0,get:function(){return this._radius},set:function(n){this._radius instanceof ie&&this._radius.unbind(ee.Types.change,this._renderer.flagRadius),this._radius=n,this._radius instanceof ie&&this._radius.bind(ee.Types.change,this._renderer.flagRadius),this._flagRadius=!0}}};function _0(){this._flagRadius=!0}var w0=Math.cos,x0=Math.sin,xd=class nr extends Pe{constructor(e,i,r,o,s){arguments.length<=3&&(o=r,r=o/2),(typeof s!="number"||s<=0)&&(s=5),super(),S(this,"_flagInnerRadius",!1),S(this,"_flagOuterRadius",!1),S(this,"_flagSides",!1),S(this,"_innerRadius",0),S(this,"_outerRadius",0),S(this,"_sides",0),this._renderer.type="star";for(let a in kd)Object.defineProperty(this,a,kd[a]);this.closed=!0,this.automatic=!1,typeof r=="number"&&(this.innerRadius=r),typeof o=="number"&&(this.outerRadius=o),typeof s=="number"&&(this.sides=s),this._update(),typeof e=="number"&&(this.translation.x=e),typeof i=="number"&&(this.translation.y=i)}static fromObject(e){const i=new nr().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<nr.Properties.length;i++){const r=nr.Properties[i];r in e&&typeof e[r]=="number"&&(this[r]=e[r])}return this}_update(){if(this._flagVertices||this._flagInnerRadius||this._flagOuterRadius||this._flagSides){const e=this._sides*2,i=e+1;let r=this.vertices.length;r>e&&(this.vertices.splice(e-1,r-e),r=e);for(let o=0;o<i;o++){const s=(o+.5)/e,a=ot*s,l=(o%2?this._outerRadius:this._innerRadius)/2,c=l*w0(a),d=l*x0(a);o>=r?this.vertices.push(new Ee(c,d)):this.vertices[o].set(c,d),this.vertices[o].command=o===0?ne.move:ne.line}}return super._update.call(this),this}flagReset(){return this._flagInnerRadius=this._flagOuterRadius=this._flagSides=!1,super.flagReset.call(this),this}clone(e){const i=this.innerRadius,r=this.outerRadius,o=this.sides,s=new nr(0,0,i,r,o);s.translation.copy(this.translation),s.rotation=this.rotation,s.scale=this.scale,s.skewX=this.skewX,s.skewY=this.skewY,this.matrix.manual&&s.matrix.copy(this.matrix);for(let a=0;a<Pe.Properties.length;a++){const l=Pe.Properties[a];s[l]=this[l]}return e&&e.add(s),s}toObject(){const e=super.toObject.call(this);e.renderer.type="star";for(let i=0;i<nr.Properties.length;i++){const r=nr.Properties[i];e[r]=this[r]}return e}};S(xd,"Properties",["innerRadius","outerRadius","sides"]);var ca=xd,kd={innerRadius:{enumerable:!0,get:function(){return this._innerRadius},set:function(n){this._innerRadius=n,this._flagInnerRadius=!0}},outerRadius:{enumerable:!0,get:function(){return this._outerRadius},set:function(n){this._outerRadius=n,this._flagOuterRadius=!0}},sides:{enumerable:!0,get:function(){return this._sides},set:function(n){this._sides=n,this._flagSides=!0}}},da,Cd=Math.min,vd=Math.max;Je.document&&(da=document.createElement("canvas"));var ua=class cn extends qn{constructor(e,i,r,o){super(),S(this,"_flagValue",!0),S(this,"_flagFamily",!0),S(this,"_flagSize",!0),S(this,"_flagLeading",!0),S(this,"_flagAlignment",!0),S(this,"_flagBaseline",!0),S(this,"_flagStyle",!0),S(this,"_flagWeight",!0),S(this,"_flagDecoration",!0),S(this,"_flagFill",!0),S(this,"_flagStroke",!0),S(this,"_flagLinewidth",!0),S(this,"_flagOpacity",!0),S(this,"_flagVisible",!0),S(this,"_flagMask",!1),S(this,"_flagClip",!1),S(this,"_flagDirection",!0),S(this,"_flagStrokeAttenuation",!0),S(this,"_value",""),S(this,"_family","sans-serif"),S(this,"_size",13),S(this,"_leading",17),S(this,"_alignment","center"),S(this,"_baseline","middle"),S(this,"_style","normal"),S(this,"_weight",500),S(this,"_decoration","none"),S(this,"_direction","ltr"),S(this,"_fill","#000"),S(this,"_stroke","none"),S(this,"_linewidth",1),S(this,"_opacity",1),S(this,"_visible",!0),S(this,"_mask",null),S(this,"_clip",!1),S(this,"_dashes",null),S(this,"_strokeAttenuation",!0);for(let s in Sd)Object.defineProperty(this,s,Sd[s]);if(this._renderer.type="text",this._renderer.flagFill=k0.bind(this),this._renderer.flagStroke=C0.bind(this),this.value=e,typeof i=="number"&&(this.translation.x=i),typeof r=="number"&&(this.translation.y=r),this.dashes=[],this.dashes.offset=0,!re.isObject(o))return this;for(let s=0;s<cn.Properties.length;s++){const a=cn.Properties[s];a in o&&(this[a]=o[a])}}static Measure(e){if(da){const i=da.getContext("2d");i.font=[e._style,e._weight,`${e._size}px/${e._leading}px`,e._family].join(" ");const r=i.measureText(e.value,0,0),o=r.actualBoundingBoxDescent+r.actualBoundingBoxAscent;return{width:r.width,height:o}}else{const i=this.value.length*this.size*cn.Ratio,r=this.leading;return console.warn("Two.Text: unable to accurately measure text, so using an approximation."),{width:i,height:r}}}static fromObject(e){const i=typeof e.fill=="string"?e.fill:Bi(e.fill),r=typeof e.stroke=="string"?e.stroke:Bi(e.stroke),o=new cn().copy(Ls(Vr({},e),{fill:i,stroke:r}));return"id"in e&&(o.id=e.id),o}copy(e){super.copy.call(this,e);for(let i=0;i<cn.Properties.length;i++){const r=cn.Properties[i];r in e&&(this[r]=e[r])}return this}clone(e){const i=new cn(this.value);i.translation.copy(this.translation),i.rotation=this.rotation,i.scale=this.scale;for(let r=0;r<cn.Properties.length;r++){const o=cn.Properties[r];i[o]=this[o]}return this.matrix.manual&&i.matrix.copy(this.matrix),e&&e.add(i),i._update()}toObject(){const e=super.toObject.call(this);e.renderer.type="text";for(let i=0;i<cn.Properties.length;i++){const r=cn.Properties[i];e[r]=this[r]}return e}dispose(){return super.dispose(),typeof this.fill=="object"&&typeof this.fill.dispose=="function"?this.fill.dispose():typeof this.fill=="object"&&typeof this.fill.unbind=="function"&&this.fill.unbind(),typeof this.stroke=="object"&&typeof this.stroke.dispose=="function"?this.stroke.dispose():typeof this.stroke=="object"&&typeof this.stroke.unbind=="function"&&this.stroke.unbind(),this}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}getBoundingClientRect(e){let i,r,o,s,a;this._update(!0),i=e?this.matrix:this.worldMatrix;const{width:l,height:c}=cn.Measure(this),d=(this._linewidth||0)/2;switch(this.alignment){case"left":r=-d,o=l+d;break;case"right":r=-(l+d),o=d;break;default:r=-(l/2+d),o=l/2+d}switch(this.baseline){case"middle":s=-(c/2+d),a=c/2+d;break;default:s=-(c+d),a=d}const[u,f]=i.multiply(r,s),[h,p]=i.multiply(r,a),[m,g]=i.multiply(o,s),[b,y]=i.multiply(o,a);return s=Cd(f,p,g,y),r=Cd(u,h,m,b),o=vd(u,h,m,b),a=vd(f,p,g,y),{top:s,left:r,right:o,bottom:a,width:o-r,height:a-s}}flagReset(){return super.flagReset.call(this),this._flagValue=this._flagFamily=this._flagSize=this._flagLeading=this._flagAlignment=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagClip=this._flagDecoration=this._flagClassName=this._flagBaseline=this._flagWeight=this._flagStyle=this._flagDirection=!1,this}};S(ua,"Ratio",.6),S(ua,"Properties",["value","family","size","leading","alignment","linewidth","style","weight","decoration","direction","baseline","opacity","visible","fill","stroke","dashes","strokeAttenuation"]);var Tn=ua,Sd={value:{enumerable:!0,get:function(){return this._value},set:function(n){this._value=n,this._flagValue=!0}},family:{enumerable:!0,get:function(){return this._family},set:function(n){this._family=n,this._flagFamily=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(n){this._size=n,this._flagSize=!0}},leading:{enumerable:!0,get:function(){return this._leading},set:function(n){this._leading=n,this._flagLeading=!0}},alignment:{enumerable:!0,get:function(){return this._alignment},set:function(n){this._alignment=n,this._flagAlignment=!0}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(n){this._linewidth=n,this._flagLinewidth=!0}},style:{enumerable:!0,get:function(){return this._style},set:function(n){this._style=n,this._flagStyle=!0}},weight:{enumerable:!0,get:function(){return this._weight},set:function(n){this._weight=n,this._flagWeight=!0}},decoration:{enumerable:!0,get:function(){return this._decoration},set:function(n){this._decoration=n,this._flagDecoration=!0}},direction:{enumerable:!0,get:function(){return this._direction},set:function(n){this._direction=n,this._flagDirection=!0}},baseline:{enumerable:!0,get:function(){return this._baseline},set:function(n){this._baseline=n,this._flagBaseline=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(n){this._opacity=n,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(n){this._visible=n,this._flagVisible=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(n){(this._fill instanceof pt||this._fill instanceof et||this._fill instanceof tt||this._fill instanceof De)&&this._fill.unbind(ee.Types.change,this._renderer.flagFill),this._fill=n,this._flagFill=!0,(this._fill instanceof pt||this._fill instanceof et||this._fill instanceof tt||this._fill instanceof De)&&this._fill.bind(ee.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(n){(this._stroke instanceof pt||this._stroke instanceof et||this._stroke instanceof tt||this._stroke instanceof De)&&this._stroke.unbind(ee.Types.change,this._renderer.flagStroke),this._stroke=n,this._flagStroke=!0,(this._stroke instanceof pt||this._stroke instanceof et||this._stroke instanceof tt||this._stroke instanceof De)&&this._stroke.bind(ee.Types.change,this._renderer.flagStroke)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(n){this._mask=n,this._flagMask=!0,re.isObject(n)&&!n.clip&&(n.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(n){this._clip=n,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(n){typeof n.offset!="number"&&(n.offset=this.dashes&&this._dashes.offset||0),this._dashes=n}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(n){this._strokeAttenuation=!!n,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};function k0(){this._flagFill=!0}function C0(){this._flagStroke=!0}var fa=class Sr extends fi{constructor(e,i,r,o){super(i,r,0,0),S(this,"_flagTextures",!1),S(this,"_flagFrameRate",!1),S(this,"_flagIndex",!1),S(this,"_amount",1),S(this,"_duration",0),S(this,"_index",0),S(this,"_startTime",0),S(this,"_playing",!1),S(this,"_firstFrame",0),S(this,"_lastFrame",0),S(this,"_loop",!0),S(this,"_textures",null),S(this,"_frameRate",0),S(this,"_origin",null),this._renderer.type="image-sequence";for(let s in Bd)Object.defineProperty(this,s,Bd[s]);this._renderer.flagTextures=v0.bind(this),this._renderer.bindTextures=S0.bind(this),this._renderer.unbindTextures=B0.bind(this),this.noStroke(),this.noFill(),Array.isArray(e)?this.textures=e.map(Nd.bind(this)):typeof e=="string"&&(this.textures=[Nd(e)]),this.origin=new ie,this._update(),typeof o=="number"?this.frameRate=o:this.frameRate=Sr.DefaultFrameRate,this.index=0}static fromObject(e){const i=new Sr().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<Sr.Properties.length;i++){const r=Sr.Properties[i];r in e&&(this[r]=e[r])}return this}play(e,i,r){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=re.performance.now(),typeof e=="number"&&(this._firstFrame=e),typeof i=="number"&&(this._lastFrame=i),typeof r=="function"?this._onLastFrame=r:delete this._onLastFrame,this._index!==this._firstFrame&&(this._startTime-=1e3*Math.abs(this._index-this._firstFrame)/this._frameRate),this}pause(){return this._playing=!1,this}stop(){return this._playing=!1,this._index=this._firstFrame,this}clone(e){const i=new Sr(this.textures,this.translation.x,this.translation.y,this.frameRate);return i._loop=this._loop,this._playing&&i.play(),e&&e.add(i),i}toObject(){const e=super.toObject.call(this);return e.renderer.type="image-sequence",e.textures=this.textures.map(function(i){return i.toObject()}),e.frameRate=this.frameRate,e.index=this.index,e.firstFrame=this.firstFrame,e.lastFrame=this.lastFrame,e.loop=this.loop,e}dispose(){if(super.dispose(),this._playing&&(this._playing=!1),this._onLastFrame=null,this.textures&&typeof this.textures.unbind=="function")try{this.textures.unbind()}catch{}if(this.textures)for(let e=0;e<this.textures.length;e++){const i=this.textures[e];typeof i.dispose=="function"?i.dispose():typeof i.unbind=="function"&&i.unbind()}return this}_update(){const e=this._textures;let i,r,o,s,a,l,c,d;return e&&(this._flagTextures&&(this._amount=e.length),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._playing&&this._frameRate>0?(s=this._amount,re.isNaN(this._lastFrame)&&(this._lastFrame=s-1),o=re.performance.now()-this._startTime,d=this._lastFrame+1,a=1e3*(d-this._firstFrame)/this._frameRate,this._loop?o=o%a:o=Math.min(o,a),c=Ot(this._firstFrame,d,o/a),c=Math.floor(c),c!==this._index&&(this._index=c,l=e[this._index],l.loaded&&(i=l.image.width,r=l.image.height,this.width!==i&&(this.width=i),this.height!==r&&(this.height=r),this.fill=l,c>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()))):(this._flagIndex||!(this.fill instanceof De))&&(l=e[this._index],l.loaded&&(i=l.image.width,r=l.image.height,this.width!==i&&(this.width=i),this.height!==r&&(this.height=r)),this.fill=l)),super._update.call(this),this}flagReset(){return this._flagTextures=this._flagFrameRate=!1,super.flagReset.call(this),this}};S(fa,"Properties",["textures","frameRate","index","firstFrame","lastFrame","loop"]),S(fa,"DefaultFrameRate",30);var ha=fa,Bd={frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(n){this._frameRate=n,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(n){this._index=n,this._flagIndex=!0}},textures:{enumerable:!0,get:function(){return this._textures},set:function(n){const e=this._renderer.bindTextures,i=this._renderer.unbindTextures;this._textures&&this._textures.unbind(ee.Types.insert,e).unbind(ee.Types.remove,i),this._textures=new di((n||[]).slice(0)),this._textures.bind(ee.Types.insert,e).bind(ee.Types.remove,i),e(this._textures)}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(n){this._firstFrame=n}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(n){this._lastFrame=n}},loop:{enumerable:!0,get:function(){return this._loop},set:function(n){this._loop=!!n}}};function v0(){this._flagTextures=!0}function S0(n){let e=n.length;for(;e--;)n[e].bind(ee.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function B0(n){let e=n.length;for(;e--;)n[e].unbind(ee.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function Nd(n){if(n instanceof De)return n;if(typeof n=="string")return new De(n)}var Eo=Math.min,Ro=Math.max,N0={getShapesAtPoint:{results:[],hitOptions:{},context:{x:0,y:0,visibleOnly:!0,results:null},single:[],empty:[]}},ma=class pn extends qn{constructor(e){super(),S(this,"_flagAdditions",!1),S(this,"_flagSubtractions",!1),S(this,"_flagOrder",!1),S(this,"_flagOpacity",!0),S(this,"_flagBeginning",!1),S(this,"_flagEnding",!1),S(this,"_flagLength",!1),S(this,"_flagMask",!1),S(this,"_fill","#fff"),S(this,"_stroke","#000"),S(this,"_linewidth",1),S(this,"_opacity",1),S(this,"_visible",!0),S(this,"_cap","round"),S(this,"_join","round"),S(this,"_miter",4),S(this,"_closed",!0),S(this,"_curved",!1),S(this,"_automatic",!0),S(this,"_beginning",0),S(this,"_ending",1),S(this,"_length",0),S(this,"_mask",null),S(this,"_strokeAttenuation",!0);for(let i in Td)Object.defineProperty(this,i,Td[i]);this._renderer.type="group",this.additions=[],this.subtractions=[],this.children=Array.isArray(e)?e:Array.prototype.slice.call(arguments)}static InsertChildren(e){for(let i=0;i<e.length;i++)$d.call(this,e[i],this)}static RemoveChildren(e){for(let i=0;i<e.length;i++)$d.call(this,e[i])}static OrderChildren(e){this._flagOrder=!0}static fromObject(e){const i=new pn;for(let o=0;o<pn.Properties.length;o++){const s=pn.Properties[o];s in e&&(/(fill|stroke)/i.test(s)?i[s]=typeof e[s]=="string"?e[s]:Bi(e[s]):i[s]=e[s])}return"mask"in e&&(i.mask=r(e.mask)),"id"in e&&(i.id=e.id),i.children=e.children.map(r),i;function r(o){if(o&&o.renderer)switch(o.renderer.type){case"arc-segment":return na.fromObject(o);case"circle":return No.fromObject(o);case"element":return sr.fromObject(o);case"ellipse":return To.fromObject(o);case"group":return pn.fromObject(o);case"image":return Image.fromObject(o);case"image-sequence":return ha.fromObject(o);case"path":return Pe.fromObject(o);case"points":return aa.fromObject(o);case"polygon":return la.fromObject(o);case"rectangle":return fi.fromObject(o);case"rounded-rectangle":return $o.fromObject(o);case"shape":return qn.fromObject(o);case"sprite":return Bo.fromObject(o);case"star":return ca.fromObject(o);case"text":return Tn.fromObject(o)}return o}}static IsVisible(e,i){if(!i)return!0;let r=e;for(;r;){if(typeof r.visible=="boolean"&&!r.visible||typeof r.opacity=="number"&&r.opacity<=0)return!1;r=r.parent}return!0}static VisitForHitTest(e,i,r,o,s,a,l){const c=e&&e.children;if(!c)return!1;const d=i.results;for(let u=c.length-1;u>=0;u--){const f=c[u];if(!f||!pn.IsVisible(f,i.visibleOnly))continue;const h=typeof f.getBoundingClientRect=="function"?f.getBoundingClientRect():null;if(!(h&&!i0(h,i.x,i.y,a))){if(f instanceof pn){if(r&&(!o||o(f))&&typeof f.contains=="function"&&f.contains(i.x,i.y,s)&&(d.push(f),l)||pn.VisitForHitTest(f,i,r,o,s,a,l))return!0;continue}if(f instanceof qn&&!(o&&!o(f))&&typeof f.contains=="function"&&f.contains(i.x,i.y,s)&&(d.push(f),l))return!0}}return!1}copy(e){super.copy.call(this,e),console.warn("Two.js: attempting to copy group. Two.Group.children copying not supported.");for(let i=0;i<pn.Properties.length;i++){const r=pn.Properties[i];r in e&&(this[r]=e[r])}return this}clone(e){const i=new pn,r=this.children.map(function(o){return o.clone()});return i.add(r),i.opacity=this.opacity,this.mask&&(i.mask=this.mask),i.translation.copy(this.translation),i.rotation=this.rotation,i.scale=this.scale,i.className=this.className,this.matrix.manual&&i.matrix.copy(this.matrix),e&&e.add(i),i._update()}toObject(){const e=super.toObject.call(this);return e.renderer.type="group",e.children=[],e.opacity=this.opacity,e.className=this.className,e.mask=this.mask?this.mask.toObject():null,re.each(this.children,(i,r)=>{e.children[r]=i.toObject()},this),e}dispose(){if(super.dispose(),this.children)for(let e=0;e<this.children.length;e++){const i=this.children[e];typeof i.dispose=="function"&&i.dispose()}if(this.children&&typeof this.children.unbind=="function")try{this.children.unbind()}catch{}return this}getShapesAtPoint(e,i,r){const o=r||{},{results:s,hitOptions:a,context:l,single:c,empty:d}=N0.getShapesAtPoint;s.length=0;const u=o.mode==="deepest"||o.deepest?"deepest":"all",f=o.visibleOnly!==!1,h=!!o.includeGroups,p=typeof o.filter=="function"?o.filter:null,m=typeof o.tolerance=="number"?o.tolerance:0;typeof o.precision=="number"?a.precision=o.precision:delete a.precision,typeof o.fill<"u"?a.fill=o.fill:delete a.fill,typeof o.stroke<"u"?a.stroke=o.stroke:delete a.stroke,a.tolerance=m,a.ignoreVisibility=!f;const g=u==="deepest";if(l.x=e,l.y=i,l.visibleOnly=f,l.results=s,pn.VisitForHitTest(this,l,h,p,a,m,g),g){if(s.length>0){const y=s[0];return s.length=0,c[0]=y,c.length=1,c}return d.length=0,d}const b=s.slice();return s.length=0,b}corner(){const e=this.getBoundingClientRect(!0);for(let i=0;i<this.children.length;i++){const r=this.children[i];r.translation.x-=e.left,r.translation.y-=e.top}return this.mask&&(this.mask.translation.x-=e.left,this.mask.translation.y-=e.top),this}center(){const e=this.getBoundingClientRect(!0),i=e.left+e.width/2-this.translation.x,r=e.top+e.height/2-this.translation.y;for(let o=0;o<this.children.length;o++){const s=this.children[o];s.isShape&&(s.translation.x-=i,s.translation.y-=r)}return this.mask&&(this.mask.translation.x-=i,this.mask.translation.y-=r),this}getById(e){let i=null;function r(o){if(o.id===e)return o;if(o.children){if(o.children.ids[e])return o.children.ids[e];for(let s=0;s<o.children.length;s++)if(i=r(o.children[s]),i)return i}return null}return r(this)}getByClassName(e){const i=[];function r(o){if(Array.prototype.indexOf.call(o.classList,e)>=0&&i.push(o),o.children)for(let s=0;s<o.children.length;s++){const a=o.children[s];r(a)}return i}return r(this)}getByType(e){const i=[];function r(o){if(o instanceof e&&i.push(o),o.children)for(let s=0;s<o.children.length;s++){const a=o.children[s];r(a)}return i}return r(this)}add(e){e instanceof Array?e=e.slice():e=Array.prototype.slice.call(arguments);for(let i=0;i<e.length;i++){const r=e[i];if(!(r&&r.id))continue;const o=Array.prototype.indexOf.call(this.children,r);o>=0&&this.children.splice(o,1),this.children.push(r)}return this}remove(e){const i=arguments.length,r=this.parent;if(i<=0&&r)return r.remove(this),this;e instanceof Array?e=e.slice():e=Array.prototype.slice.call(arguments);for(let o=0;o<e.length;o++){const s=e[o];if(!s||!this.children.ids[s.id])continue;const a=this.children.indexOf(s);a>=0&&this.children.splice(a,1)}return this}getBoundingClientRect(e){let i,r,o,s,a,l;this._update(!0);let c=1/0,d=-1/0,u=1/0,f=-1/0;const h=/texture|gradient/i;r=e?this.matrix:this.worldMatrix;for(let p=0;p<this.children.length;p++){const m=this.children[p];if(!(!m.visible||h.test(m._renderer.type))&&(i=m.getBoundingClientRect(e),o=typeof i.top!="number"||re.isNaN(i.top)||!isFinite(i.top),s=typeof i.left!="number"||re.isNaN(i.left)||!isFinite(i.left),a=typeof i.right!="number"||re.isNaN(i.right)||!isFinite(i.right),l=typeof i.bottom!="number"||re.isNaN(i.bottom)||!isFinite(i.bottom),!(o||s||a||l)))if(e){const[g,b]=r.multiply(i.left,i.top),[y,_]=r.multiply(i.right,i.top),[x,w]=r.multiply(i.left,i.bottom),[C,N]=r.multiply(i.right,i.bottom);u=Eo(b,_,w,N,u),c=Eo(g,y,x,C,c),d=Ro(g,y,x,C,d),f=Ro(b,_,w,N,f)}else u=Eo(i.top,u),c=Eo(i.left,c),d=Ro(i.right,d),f=Ro(i.bottom,f)}return{top:u,left:c,right:d,bottom:f,width:d-c,height:f-u}}noFill(){return this.children.forEach(function(e){e.noFill()}),this}noStroke(){return this.children.forEach(function(e){e.noStroke()}),this}subdivide(){const e=arguments;return this.children.forEach(function(i){i.subdivide.apply(i,e)}),this}_update(){let e,i,r;if(this._flagBeginning||this._flagEnding){const o=Math.min(this._beginning,this._ending),s=Math.max(this._beginning,this._ending),a=this.length;let l=0;const c=o*a,d=s*a;for(e=0;e<this.children.length;e++)r=this.children[e],i=r.length,c>l+i?(r.beginning=1,r.ending=1):d<l?(r.beginning=0,r.ending=0):c>l&&c<l+i?(r.beginning=(c-l)/i,r.ending=1):d>l&&d<l+i?(r.beginning=0,r.ending=(d-l)/i):(r.beginning=0,r.ending=1),l+=i}return super._update.apply(this,arguments)}flagReset(){return this._flagAdditions&&(this.additions.length=0,this._flagAdditions=!1),this._flagSubtractions&&(this.subtractions.length=0,this._flagSubtractions=!1),this._flagOrder=this._flagMask=this._flagOpacity=this._flagBeginning=this._flagEnding=!1,super.flagReset.call(this),this}};S(ma,"Children",ld),S(ma,"Properties",["fill","stroke","linewidth","cap","join","miter","closed","curved","automatic"]);var xt=ma,Td={visible:{enumerable:!0,get:function(){return this._visible},set:function(n){this._flagVisible=this._visible!==n||this._flagVisible,this._visible=n}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(n){this._flagOpacity=this._opacity!==n||this._flagOpacity,this._opacity=n}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(n){this._flagBeginning=this._beginning!==n||this._flagBeginning,this._beginning=n}},ending:{enumerable:!0,get:function(){return this._ending},set:function(n){this._flagEnding=this._ending!==n||this._flagEnding,this._ending=n}},length:{enumerable:!0,get:function(){if(this._flagLength||this._length<=0){if(this._length=0,!this.children)return this._length;for(let n=0;n<this.children.length;n++){const e=this.children[n];this._length+=e.length}}return this._length}},fill:{enumerable:!0,get:function(){return this._fill},set:function(n){this._fill=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.fill=n}}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(n){this._stroke=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.stroke=n}}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(n){this._linewidth=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.linewidth=n}}},join:{enumerable:!0,get:function(){return this._join},set:function(n){this._join=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.join=n}}},miter:{enumerable:!0,get:function(){return this._miter},set:function(n){this._miter=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.miter=n}}},cap:{enumerable:!0,get:function(){return this._cap},set:function(n){this._cap=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.cap=n}}},closed:{enumerable:!0,get:function(){return this._closed},set:function(n){this._closed=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.closed=n}}},curved:{enumerable:!0,get:function(){return this._curved},set:function(n){this._curved=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.curved=n}}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(n){this._automatic=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.automatic=n}}},children:{enumerable:!0,get:function(){return this._children},set:function(n){const e=xt.InsertChildren.bind(this),i=xt.RemoveChildren.bind(this),r=xt.OrderChildren.bind(this);this._children&&(this._children.unbind(),this._children.length>0&&i(this._children)),this._children=new ld(n),this._children.bind(ee.Types.insert,e),this._children.bind(ee.Types.remove,i),this._children.bind(ee.Types.order,r),n.length>0&&e(n)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(n){this._mask=n,this._flagMask=!0,re.isObject(n)&&!n.clip&&(n.clip=!0)}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(n){this._strokeAttenuation=!!n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.strokeAttenuation!==void 0&&(i.strokeAttenuation=n)}}}};function $d(n,e){const i=n.parent;let r;if(i===e){o();return}if(i&&i.children.ids[n.id]&&(r=Array.prototype.indexOf.call(i.children,n),i.children.splice(r,1),s()),e){o();return}s(),i._flagAdditions&&i.additions.length===0&&(i._flagAdditions=!1),i._flagSubtractions&&i.subtractions.length===0&&(i._flagSubtractions=!1),delete n.parent;function o(){e.subtractions.length>0&&(r=Array.prototype.indexOf.call(e.subtractions,n),r>=0&&e.subtractions.splice(r,1)),e.additions.length>0&&(r=Array.prototype.indexOf.call(e.additions,n),r>=0&&e.additions.splice(r,1)),n.parent=e,e.additions.push(n),e._flagAdditions=!0}function s(){r=Array.prototype.indexOf.call(i.additions,n),r>=0&&i.additions.splice(r,1),r=Array.prototype.indexOf.call(i.subtractions,n),r<0&&(i.subtractions.push(n),i._flagSubtractions=!0)}}var Po=class extends Pe{constructor(e,i,r,o){const s=[new Ee(e,i),new Ee(r,o)];super(s);for(let a in Ed)Object.defineProperty(this,a,Ed[a]);this.vertices[0].command=ne.move,this.vertices[1].command=ne.line,this.automatic=!1}};S(Po,"Properties",["left","right"]);var Ed={left:{enumerable:!0,get:function(){return this.vertices[0]},set:function(n){if(re.isObject(n))this.vertices.splice(0,1,n),this.vertices[0].command=ne.move;else{const e=new Yt("Two.Line.left argument is not an object.");console.warn(e.name,e.message)}}},right:{enumerable:!0,get:function(){return this.vertices[1]},set:function(n){if(re.isObject(n))this.vertices.splice(1,1,n),this.vertices[1].command=ne.line;else{const e=new Yt("Two.Line.right argument is not an object.");console.warn(e.name,e.message)}}}},$n={path:/[+-]?(?:\d*\.\d+|\d+)(?:[eE][+-]\d+)?/g,cssBackgroundImage:/url\(['"]?#([\w\d-_]*)['"]?\)/i,unitSuffix:/[a-zA-Z%]*/i},T0={start:"left",middle:"center",end:"right"},Rd=["id","class","transform","xmlns","viewBox"],$0=["x","y","width","height","href","xlink:href"];function E0(n){return T0[n]}function R0(n){const e=n.getAttribute("dominant-baseline"),i=n.getAttribute("alignment-baseline");return e||i}function Ir(n){return n.replace(/svg:/gi,"").toLowerCase()}function Pd(n,e){if(e.x+=n.translateX,e.y+=n.translateY,e.x*=n.scaleX,e.y*=n.scaleY,n.rotation!==0){const i=e.length();e.x=i*Math.cos(n.rotation),e.y=i*Math.sin(n.rotation)}}function P0(n,e){e||(e={});const i=n.split(";");for(let r=0;r<i.length;r++){const o=i[r].split(":"),s=o[0],a=o[1];if(typeof s>"u"||typeof a>"u")continue;const l=s.replace(/\s/g,""),c=a.replace(/\s/g,"");e[l]=c}return e}function F0(n){const e={},i=V0(n),r=Math.max(i.length,n.style.length);for(let o=0;o<r;o++){const s=n.style[o],a=i[o];s&&(e[s]=n.style[s]),a&&(e[a]=n.getAttribute(a))}return e}function V0(n){const e=n.getAttributeNames();for(let i=0;i<Rd.length;i++){const r=Rd[i],o=Array.prototype.indexOf.call(e,r);o>=0&&e.splice(o,1)}return e}function M0(n,e){const i=e.split(/[\s,]/),r=-parseFloat(i[0]),o=-parseFloat(i[1]),s=parseFloat(i[2]),a=parseFloat(i[3]);if(r&&o)for(let f=0;f<n.children.length;f++){const h=n.children[f];"translation"in h?h.translation.add(r,o):"x"in h?h.x=r:"y"in h&&(h.y=o)}const l=typeof n.x=="number",c=typeof n.y=="number",d=typeof n.width=="number",u=typeof n.height=="number";return l&&(n.translation.x+=n.x),c&&(n.translation.y+=n.y),(d||u)&&(n.scale=new ie(1,1)),d&&(n.scale.x=n.width/s),u&&(n.scale.y=n.height/a),n.mask=new fi(0,0,s,a),n.mask.origin.set(-s/2,-a/2),n}function dn(n,e,i){const r={},o={},s={};let a,l,c,d,u,f,h,p,m,g,b,y,_,x,w,C,N;if(n===null)return r;if(Je.getComputedStyle){const k=Je.getComputedStyle(n);for(a=k.length;a--;)c=k[a],d=k[c],typeof d<"u"&&(r[c]=d)}for(a=0;a<n.attributes.length;a++)f=n.attributes[a],/style/i.test(f.nodeName)?P0(f.value,s):o[f.nodeName]=f.value;typeof r.opacity<"u"&&(r["stroke-opacity"]=r.opacity,r["fill-opacity"]=r.opacity,delete r.opacity),i&&re.defaults(r,i),re.extend(r,s,o),r.visible=!(typeof r.display>"u"&&/none/i.test(r.display))||typeof r.visibility>"u"&&/hidden/i.test(r.visibility);for(c in r)switch(d=r[c],c){case"gradientTransform":if(/none/i.test(d)||(l=n.gradientTransform&&n.gradientTransform.baseVal&&n.gradientTransform.baseVal.length>0?n.gradientTransform.baseVal[0].matrix:n.getCTM?n.getCTM():null,l===null))break;switch(h=Si(l),e._renderer.type){case"linear-gradient":Pd(h,e.left),Pd(h,e.right);break;case"radial-gradient":e.center.x+=h.translateX,e.center.y+=h.translateY,e.focal.x+=h.translateX,e.focal.y+=h.translateY,e.radius*=Math.max(h.scaleX,h.scaleY);break}break;case"transform":if(/none/i.test(d)||(l=n.transform&&n.transform.baseVal&&n.transform.baseVal.length>0?n.transform.baseVal[0].matrix:n.getCTM?n.getCTM():null,l===null))break;h=Si(l),e.translation.set(h.translateX,h.translateY),e.rotation=Math.PI*(h.rotation/180),e.scale=new ie(h.scaleX,h.scaleY),p=parseFloat((r.x+"").replace("px")),m=parseFloat((r.y+"").replace("px")),p&&(e.translation.x=p),m&&(e.translation.y=m);break;case"visible":if(e instanceof xt){e._visible=d;break}e.visible=d;break;case"stroke-linecap":if(e instanceof xt){e._cap=d;break}e.cap=d;break;case"stroke-linejoin":if(e instanceof xt){e._join=d;break}e.join=d;break;case"stroke-miterlimit":if(e instanceof xt){e._miter=d;break}e.miter=d;break;case"stroke-width":if(e instanceof xt){e._linewidth=parseFloat(d);break}e.linewidth=parseFloat(d);break;case"opacity":case"stroke-opacity":case"fill-opacity":if(e instanceof xt){e._opacity=parseFloat(d);break}e.opacity=parseFloat(d);break;case"clip-path":if($n.cssBackgroundImage.test(d)&&(g=d.replace($n.cssBackgroundImage,"$1"),Ze.defs.current&&Ze.defs.current.contains(g)&&(y=Ze.defs.current.get(g),y&&y.childNodes.length>0)))switch(y=y.childNodes[0],_=Ir(y.nodeName),e.mask=Ze[_].call(this,y,{}),e._renderer.type){case"text":case"path":e.position.add(e.mask.position),e.mask.position.clear();break}break;case"fill":case"stroke":u=(e instanceof xt?"_":"")+c,$n.cssBackgroundImage.test(d)?(g=d.replace($n.cssBackgroundImage,"$1"),Ze.defs.current&&Ze.defs.current.contains(g)?(y=Ze.defs.current.get(g),y.object||(_=Ir(y.nodeName),y.object=Ze[_].call(this,y,{})),y=y.object):(b=A0(this),y=b.getById(g)),e[u]=y):e[u]=d;break;case"id":e.id=d;break;case"class":case"className":e.classList=d.split(" "),e._flagClassName=!0;break;case"x":case"y":if(x=e instanceof pt,w=e instanceof et,C=e instanceof tt,x||w||C)break;d.match("[a-z%]$")&&!d.endsWith("px")&&(N=new Yt("only pixel values are supported with the "+c+" attribute."),console.warn(N.name,N.message)),e.translation[c]=parseFloat(d);break;case"font-family":e instanceof Tn&&(e.family=d);break;case"font-size":e instanceof Tn&&(d.match("[a-z%]$")&&!d.endsWith("px")&&(N=new Yt("only pixel values are supported with the "+c+" attribute."),console.warn(N.name,N.message)),e.size=parseFloat(d));break;case"font-weight":e instanceof Tn&&(e.weight=d);break;case"font-style":e instanceof Tn&&(e.style=d);break;case"text-decoration":e instanceof Tn&&(e.decoration=d);break;case"line-height":e instanceof Tn&&(e.leading=d);break}return Object.keys(n.dataset).length&&(e.dataset=n.dataset),r}function I0(n,e){for(let i=0,r=n.childNodes.length;i<r;i++){const o=n.childNodes[i];!o.id||Ir(n.nodeName)==="#text"||e.add(o.id,o)}}function A0(n){for(;n.parent;)n=n.parent;return n.scene}var Ze={svg:function(n){const e=Ze.defs.current=new bo,i=n.getElementsByTagName("defs");for(let m=0;m<i.length;m++)I0(i[m],e);const r=Ze.g.call(this,n),o=n.getAttribute("viewBox"),s=n.getAttribute("x"),a=n.getAttribute("y"),l=n.getAttribute("width"),c=n.getAttribute("height");r.defs=e;const d=o!==null,u=s!==null,f=a!==null,h=l!==null,p=c!==null;return u&&(r.x=parseFloat(s.replace($n.unitSuffix,""))),f&&(r.y=parseFloat(a.replace($n.unitSuffix,""))),h&&(r.width=parseFloat(l.replace($n.unitSuffix,""))),p&&(r.height=parseFloat(c.replace($n.unitSuffix,""))),d&&M0(r,o),delete Ze.defs.current,r},defs:function(n){return null},use:function(n,e){let i;const r=n.getAttribute("href")||n.getAttribute("xlink:href");if(!r)return i=new Yt("encountered <use /> with no href."),console.warn(i.name,i.message),null;const o=r.slice(1);if(!Ze.defs.current.contains(o))return i=new Yt("unable to find element for reference "+r+"."),console.warn(i.name,i.message),null;const a=Ze.defs.current.get(o).cloneNode(!0);for(let c=0;c<n.attributes.length;c++){const d=n.attributes[c],u=$0.includes(d.nodeName),f=!a.hasAttribute(d.nodeName);(u||f)&&a.setAttribute(d.nodeName,d.value)}const l=Ir(a.nodeName);return Ze[l].call(this,a,e)},g:function(n,e){const i=new xt;dn.call(this,n,i,e),this.add(i);const r=F0.call(this,n);for(let o=0,s=n.childNodes.length;o<s;o++){const a=n.childNodes[o],l=a.nodeName;if(!l)return;const c=Ir(l);if(c in Ze){const d=Ze[c].call(i,a,r);d&&!d.parent&&i.add(d)}}return i},polygon:function(n,e){let i;typeof n=="string"?i=n:i=n.getAttribute("points");const r=[];i.replace(/(-?[\d.eE-]+)[,|\s](-?[\d.eE-]+)/g,function(s,a,l){r.push(new Ee(parseFloat(a),parseFloat(l)))});const o=new Pe(r,!0);return o.stroke="none",o.fill="black",dn.call(this,n,o,e),o},polyline:function(n,e){const i=Ze.polygon.call(this,n,e);return i.closed=!1,i},path:function(n,e){let i;typeof n=="string"?(i=n,n=null):i=n.getAttribute("d");let r=[],o=!1,s=!1;if(i){let l=new Ee,c,d,u=i.match(/[a-df-z][^a-df-z]*/gi);const f=u.length-1;re.each(u.slice(0),function(h,p){const m=h.slice(1).trim().match($n.path),g=h[0],b=g.toLowerCase();let y,_,x,w,C;const N=[];switch(p===0&&(u=[]),b){case"h":case"v":m.length>1&&(y=1);break;case"m":case"l":case"t":m.length>2&&(y=2);break;case"s":case"q":m.length>4&&(y=4);break;case"c":m.length>6&&(y=6);break;case"a":m.length>7&&(y=7);break}if(y){for(_=0,x=m.length,C=0;_<x;_+=y){if(w=g,C>0)switch(g){case"m":w="l";break;case"M":w="L";break}N.push(w+m.slice(_,_+y).join(" ")),C++}u=Array.prototype.concat.apply(u,N)}else u.push(h)}),re.each(u,function(h,p){let m,g,b;const y=h[0],_=y.toLowerCase();d=h.slice(1).trim().match($n.path),s=y===_;let x,w,C,N,k,$,v,E,P,F,R,M,X,G,Z,O,A;switch(_){case"z":if(p>=f)o=!0;else{g=l.x,b=l.y,m=new Ee(g,b,void 0,void 0,void 0,void 0,ne.close);for(let Y=r.length-1;Y>=0;Y--){const H=r[Y];if(/m/i.test(H.command)){l=H;break}}}break;case"m":case"l":c=void 0,g=parseFloat(d[0]),b=parseFloat(d[1]),m=new Ee(g,b,void 0,void 0,void 0,void 0,/m/i.test(_)?ne.move:ne.line),s&&m.addSelf(l),l=m;break;case"h":case"v":F=/h/i.test(_)?"x":"y",R=/x/i.test(F)?"y":"x",m=new Ee(void 0,void 0,void 0,void 0,void 0,void 0,ne.line),m[F]=parseFloat(d[0]),m[R]=l[R],s&&(m[F]+=l[F]),l=m;break;case"c":case"s":x=l.x,w=l.y,c||(c=new ie),/c/i.test(_)?(C=parseFloat(d[0]),N=parseFloat(d[1]),k=parseFloat(d[2]),$=parseFloat(d[3]),v=parseFloat(d[4]),E=parseFloat(d[5])):(P=qs(l,c,s),C=P.x,N=P.y,k=parseFloat(d[0]),$=parseFloat(d[1]),v=parseFloat(d[2]),E=parseFloat(d[3])),s&&(C+=x,N+=w,k+=x,$+=w,v+=x,E+=w),l.controls.right.set(C-l.x,N-l.y),m=new Ee(v,E,k-v,$-E,void 0,void 0,ne.curve),l=m,c=m.controls.left;break;case"t":case"q":x=l.x,w=l.y,c||(c=new ie),/q/i.test(_)?(C=parseFloat(d[0]),N=parseFloat(d[1]),k=parseFloat(d[0]),$=parseFloat(d[1]),v=parseFloat(d[2]),E=parseFloat(d[3])):(P=qs(l,c,s),C=P.x,N=P.y,k=P.x,$=P.y,v=parseFloat(d[0]),E=parseFloat(d[1])),s&&(C+=x,N+=w,k+=x,$+=w,v+=x,E+=w),l.controls.right.set((C-l.x)*.33,(N-l.y)*.33),m=new Ee(v,E,k-v,$-E,void 0,void 0,ne.curve),l=m,c=m.controls.left;break;case"a":x=l.x,w=l.y,X=parseFloat(d[0]),G=parseFloat(d[1]),Z=parseFloat(d[2]),O=parseFloat(d[3]),A=parseFloat(d[4]),v=parseFloat(d[5]),E=parseFloat(d[6]),s&&(v+=x,E+=w),M=new Ee(v,E),M.command=ne.arc,M.rx=X,M.ry=G,M.xAxisRotation=Z,M.largeArcFlag=O,M.sweepFlag=A,m=M,l=M,c=void 0;break}m&&(Array.isArray(m)?r=r.concat(m):r.push(m))})}i=new Pe(r,o,void 0,!0),i.stroke="none",i.fill="black";const a=i.getBoundingClientRect(!0);return a.centroid={x:a.left+a.width/2,y:a.top+a.height/2},re.each(i.vertices,function(l){l.subSelf(a.centroid)}),dn.call(this,n,i,e),i.translation.addSelf(a.centroid),i},circle:function(n,e){const i=parseFloat(n.getAttribute("cx")),r=parseFloat(n.getAttribute("cy")),o=parseFloat(n.getAttribute("r")),s=new No(0,0,o);return s.stroke="none",s.fill="black",dn.call(this,n,s,e),s.translation.x=i,s.translation.y=r,s},ellipse:function(n,e){const i=parseFloat(n.getAttribute("cx")),r=parseFloat(n.getAttribute("cy")),o=parseFloat(n.getAttribute("rx")),s=parseFloat(n.getAttribute("ry")),a=new To(0,0,o,s);return a.stroke="none",a.fill="black",dn.call(this,n,a,e),a.translation.x=i,a.translation.y=r,a},rect:function(n,e){const i=parseFloat(n.getAttribute("rx")),r=parseFloat(n.getAttribute("ry"));if(!re.isNaN(i)||!re.isNaN(r))return Ze["rounded-rect"](n);const o=parseFloat(n.getAttribute("width")),s=parseFloat(n.getAttribute("height")),a=o/2,l=s/2,c=new fi(0,0,o,s);return c.stroke="none",c.fill="black",dn.call(this,n,c,e),c.translation.x+=a,c.translation.y+=l,c},"rounded-rect":function(n,e){const i=parseFloat(n.getAttribute("rx"))||0,r=parseFloat(n.getAttribute("ry"))||0,o=parseFloat(n.getAttribute("width")),s=parseFloat(n.getAttribute("height")),a=o/2,l=s/2,c=new ie(i,r),d=new $o(0,0,o,s,c);return d.stroke="none",d.fill="black",dn.call(this,n,d,e),d.translation.x+=a,d.translation.y+=l,d},line:function(n,e){const i=parseFloat(n.getAttribute("x1")),r=parseFloat(n.getAttribute("y1")),o=parseFloat(n.getAttribute("x2")),s=parseFloat(n.getAttribute("y2")),a=new Po(i,r,o,s).noFill();return dn.call(this,n,a,e),a},lineargradient:function(n,e){let i=n.getAttribute("gradientUnits"),r=n.getAttribute("spreadMethod");i||(i="objectBoundingBox"),r||(r="pad");let o=parseFloat(n.getAttribute("x1")||0),s=parseFloat(n.getAttribute("y1")||0),a=parseFloat(n.getAttribute("x2")||0),l=parseFloat(n.getAttribute("y2")||0);const c=(a+o)/2,d=(l+s)/2;/userSpaceOnUse/i.test(i)&&(o-=c,s-=d,a-=c,l-=d);const u=[];for(let h=0;h<n.children.length;h++){const p=n.children[h];let m=p.getAttribute("offset");/%/gi.test(m)&&(m=parseFloat(m.replace(/%/gi,""))/100),m=parseFloat(m);let g=p.getAttribute("stop-color"),b=p.getAttribute("stop-opacity"),y=p.getAttribute("style"),_;g===null&&(_=y?y.match(/stop-color:\s?([#a-fA-F0-9]*)/):!1,g=_&&_.length>1?_[1]:void 0),b===null?(_=y?y.match(/stop-opacity:\s?([0-9.-]*)/):!1,b=_&&_.length>1?parseFloat(_[1]):1):b=parseFloat(b),u.push(new ui(m,g,b))}const f=new et(o,s,a,l,u);return f.spread=r,f.units=i,dn.call(this,n,f,e),f},radialgradient:function(n,e){let i=n.getAttribute("gradientUnits"),r=n.getAttribute("spreadMethod");i||(i="objectBoundingBox"),r||(r="pad");let o=parseFloat(n.getAttribute("cx"))||0,s=parseFloat(n.getAttribute("cy"))||0,a=parseFloat(n.getAttribute("r")),l=parseFloat(n.getAttribute("fx")),c=parseFloat(n.getAttribute("fy"));re.isNaN(l)&&(l=o),re.isNaN(c)&&(c=s);const d=Math.abs(o+l)/2,u=Math.abs(s+c)/2;/userSpaceOnUse/i.test(i)&&(o-=d,s-=u,l-=d,c-=u);const f=[];for(let p=0;p<n.children.length;p++){const m=n.children[p];let g=m.getAttribute("offset");/%/gi.test(g)&&(g=parseFloat(g.replace(/%/gi,""))/100),g=parseFloat(g);let b=m.getAttribute("stop-color"),y=m.getAttribute("stop-opacity"),_=m.getAttribute("style"),x;b===null&&(x=_?_.match(/stop-color:\s?([#a-fA-F0-9]*)/):!1,b=x&&x.length>1?x[1]:void 0),y===null?(x=_?_.match(/stop-opacity:\s?([0-9.-]*)/):!1,y=x&&x.length>1?parseFloat(x[1]):1):y=parseFloat(y),f.push(new ui(g,b,y))}const h=new tt(o,s,a,f,l,c);return h.spread=r,h.units=i,dn.call(this,n,h,e),h},text:function(n,e){const i=E0(n.getAttribute("text-anchor"))||"left",r=R0(n)||"baseline";let o="";n.childNodes.length>0&&n.childNodes[0].tagName==="TSPAN"?o=n.childNodes[0].textContent:o=n.textContent;const s=new Tn(o);return dn.call(this,n,s,e),s.alignment=i,s.baseline=r,s},clippath:function(n,e){return Ze.defs.current&&!Ze.defs.current.contains(n.id)&&Ze.defs.current.add(n.id,n),null},image:function(n,e){let i;const r=n.getAttribute("href")||n.getAttribute("xlink:href");if(!r)return i=new Yt("encountered <image /> with no href."),console.warn(i.name,i.message),null;const o=parseFloat(n.getAttribute("x"))||0,s=parseFloat(n.getAttribute("y"))||0,a=parseFloat(n.getAttribute("width")),l=parseFloat(n.getAttribute("height")),c=new Bo(r,o,s);return re.isNaN(a)||(c.width=a),re.isNaN(l)||(c.height=l),dn.call(this,n,c,e),c}};function Fd(n,e){const i=new XMLHttpRequest;return i.open("GET",n),i.onreadystatechange=function(){i.readyState===4&&i.status===200&&e(i.responseText)},i.send(),i}var pa=class Wn extends fi{constructor(e,i,r,o,s,a){super(i,r,o||1,s||1),S(this,"_flagTexture",!1),S(this,"_flagMode",!1),S(this,"_texture",null),S(this,"_mode","fill"),this._renderer.type="image";for(let l in Md)Object.defineProperty(this,l,Md[l]);this.noStroke(),this.noFill(),e instanceof De?this.texture=e:typeof e=="string"&&(this.texture=new De(e)),typeof a=="string"&&(this.mode=a),this._update()}static fromObject(e){const i=new Wn().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<Wn.Properties.length;i++){const r=Wn.Properties[i];r in e&&(this[r]=e[r])}return this}clone(e){const i=new Wn(this.texture,this.translation.x,this.translation.y,this.width,this.height);return e&&e.add(i),i}toObject(){const e=super.toObject.call(this);return e.renderer.type="image",e.texture=this.texture.toObject(),e.mode=this.mode,e}dispose(){return super.dispose(),this._texture&&typeof this._texture.dispose=="function"?this._texture.dispose():this._texture&&typeof this._texture.unbind=="function"&&this._texture.unbind(),this}_update(){const e=this._texture;if(e&&(this._flagTexture&&(this.fill=e),e.loaded)){const i=e.image.width,r=e.image.height,o=this.width,s=this.height,a=o/i,l=s/r;switch(this._mode){case Wn.Modes.fill:{const c=Math.max(a,l);e.scale=c,e.offset.x=0,e.offset.y=0,e.repeat="repeat";break}case Wn.Modes.fit:{const c=Math.min(a,l);e.scale=c,e.offset.x=0,e.offset.y=0,e.repeat="no-repeat";break}case Wn.Modes.crop:break;case Wn.Modes.tile:{e.offset.x=(i-o)/2,e.offset.y=(r-s)/2,e.repeat="repeat";break}case Wn.Modes.stretch:default:e.scale=new ie(a,l),e.offset.x=0,e.offset.y=0,e.repeat="repeat"}}return super._update.call(this),this}flagReset(){return super.flagReset.call(this),this._flagTexture=this._flagMode=!1,this}};S(pa,"Modes",{fill:"fill",fit:"fit",crop:"crop",tile:"tile",stretch:"stretch"}),S(pa,"Properties",["texture","mode"]);var Vd=pa,Md={texture:{enumerable:!0,get:function(){return this._texture},set:function(n){this._texture=n,this._flagTexture=!0}},mode:{enumerable:!0,get:function(){return this._mode},set:function(n){this._mode=n,this._flagMode=!0}}},ga=[],ya=Math.max,O0=Math.min,Id=Math.abs,Fo=Math.sin,Vo=Math.cos,z0=Math.acos,Mo=Math.sqrt,Me={isHidden:/(undefined|none|transparent)/i,alignments:{left:"start",middle:"center",right:"end"},baselines:{top:"top",middle:"middle",bottom:"bottom",baseline:"alphabetic"},getRendererType:function(n){return n in Me?n:"path"},group:{renderChild:function(n){const e=Me.getRendererType(n._renderer.type);Me[e].render.call(n,this.ctx,!0,this.clip)},render:function(n){if(!this._visible)return this;re.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const e=this._matrix.elements,i=this.parent;this._renderer.opacity=this._opacity*(i&&i._renderer?i._renderer.opacity:1);const r=this._mask,o=Io(e),s=!o||!!r;if(this._renderer.context||(this._renderer.context={}),this._renderer.context.ctx=n,s&&(n.save(),o||n.transform(e[0],e[3],e[1],e[4],e[2],e[5])),r){const a=Me.getRendererType(r._renderer.type);Me[a].render.call(r,n,!0)}if(this._opacity>0&&this._scale!==0)for(let a=0;a<this.children.length;a++){const l=this.children[a],c=Me.getRendererType(l._renderer.type);Me[c].render.call(l,n)}return s&&n.restore(),re.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},path:{render:function(n,e,i){let r,o,s,a,l,c,d,u,f,h,p,m,g,b,y,_,x,w,C,N,k,$,v,E,P,F,R,M,X,G,Z,O,A,Y;if(Y=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,X=this._mask,G=this._clip,l=this._opacity*(Y||1),c=this._visible,!e&&(!c||G||l===0))return this;if(re.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),r=this._matrix.elements,o=this._stroke,s=this._linewidth,a=this._fill,d=this._cap,u=this._join,f=this._miter,h=this._closed,p=this._renderer.vertices,m=p.length,g=m-1,Z=Io(r),A=this.dashes,Z||(n.save(),n.transform(r[0],r[3],r[1],r[4],r[2],r[5])),X){const L=Me.getRendererType(X._renderer.type);Me[L].render.call(X,n,!0)}if(a)if(typeof a=="string")n.fillStyle=a;else{const L=Me.getRendererType(a._renderer.type);Me[L].render.call(a,n,this),n.fillStyle=a._renderer.effect}if(o){if(typeof o=="string")n.strokeStyle=o;else{const L=Me.getRendererType(o._renderer.type);Me[L].render.call(o,n,this),n.strokeStyle=o._renderer.effect}s&&(n.lineWidth=Nn(this)),f&&(n.miterLimit=f),u&&(n.lineJoin=u),!h&&d&&(n.lineCap=d)}typeof l=="number"&&(n.globalAlpha=l),A&&A.length>0&&(n.lineDashOffset=A.offset||0,n.setLineDash(A)),n.beginPath();let H,T,D,K,J,U,q;for(let L=0;L<m;L++)switch(_=p[L],R=_.x,M=_.y,_.command){case ne.close:n.closePath();break;case ne.arc:H=_.rx,T=_.ry,D=_.xAxisRotation,K=_.largeArcFlag,J=_.sweepFlag,b=h?ut(L-1,m):ya(L-1,0),y=p[b],U=y.x,q=y.y,Me.renderSvgArcCommand(n,U,q,H,T,K,J,D,R,M);break;case ne.curve:b=h?ut(L-1,m):Math.max(L-1,0),y=p[b],v=y.controls&&y.controls.right||ie.zero,E=_.controls&&_.controls.left||ie.zero,y._relative?(k=v.x+y.x,$=v.y+y.y):(k=v.x,$=v.y),_._relative?(C=E.x+_.x,N=E.y+_.y):(C=E.x,N=E.y),n.bezierCurveTo(k,$,C,N,R,M),L>=g&&h&&(x=w,P=_.controls&&_.controls.right||ie.zero,F=x.controls&&x.controls.left||ie.zero,_._relative?(k=P.x+_.x,$=P.y+_.y):(k=P.x,$=P.y),x._relative?(C=F.x+x.x,N=F.y+x.y):(C=F.x,N=F.y),R=x.x,M=x.y,n.bezierCurveTo(k,$,C,N,R,M));break;case ne.line:n.lineTo(R,M);break;case ne.move:w=_,n.moveTo(R,M);break}return h&&n.closePath(),!G&&!i&&(Me.isHidden.test(a)||(O=a._renderer&&a._renderer.offset,O&&(n.save(),n.translate(-a._renderer.offset.x,-a._renderer.offset.y),n.scale(a._renderer.scale.x,a._renderer.scale.y)),n.fill(),O&&n.restore()),Me.isHidden.test(o)||(O=o._renderer&&o._renderer.offset,O&&(n.save(),n.translate(-o._renderer.offset.x,-o._renderer.offset.y),n.scale(o._renderer.scale.x,o._renderer.scale.y),n.lineWidth=s/o._renderer.scale.x),n.stroke(),O&&n.restore())),Z||n.restore(),G&&!i&&n.clip(),A&&A.length>0&&n.setLineDash(ga),re.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},points:{render:function(n,e,i){let r,o,s,a,l,c,d,u,f,h,p,m,g,b,y,_;if(_=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,l=this._opacity*(_||1),c=this._visible,!e&&(!c||l===0))return this;if(re.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),r=this._matrix.elements,o=this._stroke,s=this._linewidth,a=this._fill,u=this._renderer.collection,f=u.length,g=Io(r),y=this.dashes,d=this._size,g||(n.save(),n.transform(r[0],r[3],r[1],r[4],r[2],r[5])),a)if(typeof a=="string")n.fillStyle=a;else{const C=Me.getRendererType(a._renderer.type);Me[C].render.call(a,n,this),n.fillStyle=a._renderer.effect}if(o){if(typeof o=="string")n.strokeStyle=o;else{const C=Me.getRendererType(o._renderer.type);Me[C].render.call(o,n,this),n.strokeStyle=o._renderer.effect}s&&(n.lineWidth=Nn(this))}typeof l=="number"&&(n.globalAlpha=l),y&&y.length>0&&(n.lineDashOffset=y.offset||0,n.setLineDash(y)),n.beginPath();let x=d*.5,w;this._sizeAttenuation||(w=this.worldMatrix.elements,w=Si(w[0],w[3],w[1],w[4],w[2],w[5]),x/=Math.max(w.scaleX,w.scaleY));for(let C=0;C<f;C++)h=u[C],p=h.x,m=h.y,n.moveTo(p+x,m),n.arc(p,m,x,0,ot);return i||(Me.isHidden.test(a)||(b=a._renderer&&a._renderer.offset,b&&(n.save(),n.translate(-a._renderer.offset.x,-a._renderer.offset.y),n.scale(a._renderer.scale.x,a._renderer.scale.y)),n.fill(),b&&n.restore()),Me.isHidden.test(o)||(b=o._renderer&&o._renderer.offset,b&&(n.save(),n.translate(-o._renderer.offset.x,-o._renderer.offset.y),n.scale(o._renderer.scale.x,o._renderer.scale.y),n.lineWidth=s/o._renderer.scale.x),n.stroke(),b&&n.restore())),g||n.restore(),y&&y.length>0&&n.setLineDash(ga),re.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},text:{render:function(n,e,i){const r=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,o=this._opacity*r,s=this._visible,a=this._mask,l=this._clip;if(!e&&(!s||l||o===0))return this;re.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const c=this._matrix.elements,d=this._stroke,u=this._linewidth,f=this._fill,h=this._decoration,p=this._direction,m=Io(c),g=f._renderer&&f._renderer.offset&&d._renderer&&d._renderer.offset,b=this.dashes,y=Me.alignments[this._alignment]||this._alignment,_=Me.baselines[this._baseline]||this._baseline;let x,w,C,N,k,$,v,E,P,F,R;if(m||(n.save(),n.transform(c[0],c[3],c[1],c[4],c[2],c[5])),a){const M=Me.getRendererType(a._renderer.type);Me[M].render.call(a,n,!0)}if(g||(n.font=[this._style,this._weight,this._size+"px/"+this._leading+"px",this._family].join(" ")),n.textAlign=y,n.textBaseline=_,n.direction=p,f)if(typeof f=="string")n.fillStyle=f;else{const M=Me.getRendererType(f._renderer.type);Me[M].render.call(f,n,this),n.fillStyle=f._renderer.effect}if(d){if(typeof d=="string")n.strokeStyle=d;else{const M=Me.getRendererType(d._renderer.type);Me[M].render.call(d,n,this),n.strokeStyle=d._renderer.effect}u&&(n.lineWidth=Nn(this))}if(typeof o=="number"&&(n.globalAlpha=o),b&&b.length>0&&(n.lineDashOffset=b.offset||0,n.setLineDash(b)),!l&&!i&&(Me.isHidden.test(f)||(f._renderer&&f._renderer.offset?($=f._renderer.scale.x,v=f._renderer.scale.y,n.save(),n.translate(-f._renderer.offset.x,-f._renderer.offset.y),n.scale($,v),x=this._size/f._renderer.scale.y,w=this._leading/f._renderer.scale.y,n.font=[this._style,this._weight,x+"px/",w+"px",this._family].join(" "),C=f._renderer.offset.x/f._renderer.scale.x,N=f._renderer.offset.y/f._renderer.scale.y,n.fillText(this.value,C,N),n.restore()):n.fillText(this.value,0,0)),Me.isHidden.test(d)||(d._renderer&&d._renderer.offset?($=d._renderer.scale.x,v=d._renderer.scale.y,n.save(),n.translate(-d._renderer.offset.x,-d._renderer.offset.y),n.scale($,v),x=this._size/d._renderer.scale.y,w=this._leading/d._renderer.scale.y,n.font=[this._style,this._weight,x+"px/",w+"px",this._family].join(" "),C=d._renderer.offset.x/d._renderer.scale.x,N=d._renderer.offset.y/d._renderer.scale.y,k=u/d._renderer.scale.x,n.lineWidth=k,n.strokeText(this.value,C,N),n.restore()):n.strokeText(this.value,0,0))),/(underline|strikethrough)/i.test(h)){const M=n.measureText(this.value);let X=1;switch(h){case"underline":P=M.actualBoundingBoxDescent,R=M.actualBoundingBoxDescent;break;case"strikethrough":P=0,R=0,X=.5;break}switch(_){case"top":P+=this._size*X,R+=this._size*X;break;case"baseline":case"bottom":P-=this._size*X,R-=this._size*X;break}switch(y){case"left":case"start":E=0,F=M.width;break;case"right":case"end":E=-M.width,F=0;break;default:E=-M.width/2,F=M.width/2}n.lineWidth=Math.max(Math.floor(this._size/15),1),n.strokeStyle=n.fillStyle,n.beginPath(),n.moveTo(E,P),n.lineTo(F,R),n.stroke()}return m||n.restore(),l&&!i&&n.clip(),b&&b.length>0&&n.setLineDash(ga),re.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},"linear-gradient":{render:function(n,e){if(e){if(re.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),!this._renderer.effect||this._flagEndPoints||this._flagStops||this._flagUnits){let i,r=this.left._x,o=this.left._y,s=this.right._x,a=this.right._y;/objectBoundingBox/i.test(this._units)&&(i=e.getBoundingClientRect(!0),r=(r-.5)*i.width,o=(o-.5)*i.height,s=(s-.5)*i.width,a=(a-.5)*i.height),this._renderer.effect=n.createLinearGradient(r,o,s,a);for(let l=0;l<this.stops.length;l++){const c=this.stops[l];this._renderer.effect.addColorStop(c._offset,c._color)}}return re.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},"radial-gradient":{render:function(n,e){if(e){if(re.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),!this._renderer.effect||this._flagCenter||this._flagFocal||this._flagRadius||this._flagStops||this._flagUnits){let i,r=this.center._x,o=this.center._y,s=this.focal._x,a=this.focal._y,l=this._radius;/objectBoundingBox/i.test(this._units)&&(i=e.getBoundingClientRect(!0),r=(r-.5)*i.width*.5,o=(o-.5)*i.height*.5,s=(s-.5)*i.width*.5,a=(a-.5)*i.height*.5,l*=Math.min(i.width,i.height)),this._renderer.effect=n.createRadialGradient(r,o,0,s,a,l);for(let c=0;c<this.stops.length;c++){const d=this.stops[c];this._renderer.effect.addColorStop(d._offset,d._color)}}return re.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},texture:{render:function(n){re.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const e=this.image;return(!this._renderer.effect||(this._flagLoaded||this._flagImage||this._flagVideo||this._flagRepeat)&&this.loaded)&&(this._renderer.effect=n.createPattern(this.image,this._repeat)),(this._flagOffset||this._flagLoaded||this._flagScale)&&(this._renderer.offset instanceof ie||(this._renderer.offset=new ie),this._renderer.offset.x=-this._offset.x,this._renderer.offset.y=-this._offset.y,e&&(this._renderer.offset.x+=e.width/2,this._renderer.offset.y+=e.height/2,this._scale instanceof ie?(this._renderer.offset.x*=this._scale.x,this._renderer.offset.y*=this._scale.y):(this._renderer.offset.x*=this._scale,this._renderer.offset.y*=this._scale))),(this._flagScale||this._flagLoaded)&&(this._renderer.scale instanceof ie||(this._renderer.scale=new ie),this._scale instanceof ie?this._renderer.scale.copy(this._scale):this._renderer.scale.set(this._scale,this._scale)),re.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},renderSvgArcCommand:function(n,e,i,r,o,s,a,l,c,d){l=l*Math.PI/180,r=Id(r),o=Id(o);const u=(e-c)/2,f=(i-d)/2,h=Vo(l)*u+Fo(l)*f,p=-Fo(l)*u+Vo(l)*f,m=h*h,g=p*p;let b=r*r,y=o*o;const _=m/b+g/y;if(_>1){const M=Mo(_);r=M*r,o=M*o,b=r*r,y=o*o}const x=b*g+y*m,w=(b*y-x)/x;let C=Mo(ya(0,w));s===a&&(C=-C);const N=C*r*p/o,k=-C*o*h/r,$=Vo(l)*N-Fo(l)*k+(e+c)/2,v=Fo(l)*N+Vo(l)*k+(i+d)/2,E=Ad(1,0,(h-N)/r,(p-k)/o),P=Ad((h-N)/r,(p-k)/o,(-h-N)/r,(-p-k)/o)%ot,F=E+P;D0(n,$,v,r,o,E,F,a===0,l)}},Tt=class extends ee{constructor(n){super();const e=n.smoothing!==!1;this.domElement=n.domElement||document.createElement("canvas"),this.ctx=this.domElement.getContext("2d"),this.overdraw=n.overdraw||!1,typeof this.ctx.imageSmoothingEnabled<"u"&&(this.ctx.imageSmoothingEnabled=e),this.scene=new xt,this.scene.parent=this}setSize(n,e,i){return this.width=n,this.height=e,this.ratio=typeof i>"u"?Xs(this.ctx):i,this.domElement.width=n*this.ratio,this.domElement.height=e*this.ratio,this.domElement.style&&re.extend(this.domElement.style,{width:n+"px",height:e+"px"}),this.trigger(ee.Types.resize,n,e,i)}render(){const n=this.ratio===1;return n||(this.ctx.save(),this.ctx.scale(this.ratio,this.ratio)),this.overdraw||this.ctx.clearRect(0,0,this.width,this.height),Me.group.render.call(this.scene,this.ctx),n||this.ctx.restore(),this}};S(Tt,"Utils",Me);function D0(n,e,i,r,o,s,a,l,c){const d=a-s,u=rr.Tolerance.epsilon,f=Math.abs(d)<u;let h=ut(d,ot);h<u&&(f?h=0:h=ot),l===!0&&!f&&(h===ot?h=-ot:h=h-ot);for(let p=0;p<Bt.Resolution;p++){const m=p/(Bt.Resolution-1),g=s+m*h;let b=e+r*Math.cos(g),y=i+o*Math.sin(g);if(c!==0){const _=Math.cos(c),x=Math.sin(c),w=b-e,C=y-i;b=w*_-C*x+e,y=w*x+C*_+i}n.lineTo(b,y)}}function Ad(n,e,i,r){const o=n*i+e*r,s=Mo(n*n+e*e)*Mo(i*i+r*r);let a=z0(ya(-1,O0(1,o/s)));return n*r-e*i<0&&(a=-a),a}function Io(n){return n[0]===1&&n[3]===0&&n[1]===0&&n[4]===1&&n[2]===0&&n[5]===0}var he={version:1.1,ns:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink",alignments:{left:"start",center:"middle",right:"end"},baselines:{top:"hanging",middle:"middle",bottom:"ideographic",baseline:"alphabetic"},createElement:function(n,e){const i=n,r=document.createElementNS(he.ns,i);return i==="svg"&&(e=re.defaults(e||{},{version:he.version})),e&&Object.keys(e).length>0&&he.setAttributes(r,e),r},setAttributes:function(n,e){const i=Object.keys(e);for(let r=0;r<i.length;r++)/href/.test(i[r])?n.setAttributeNS(he.xlink,i[r],e[i[r]]):n.setAttribute(i[r],e[i[r]]);return this},removeAttributes:function(n,e){for(let i in e)n.removeAttribute(i);return this},toString:function(n,e){let i=n.length,r=i-1,o,s="";for(let a=0;a<i;a++){const l=n[a],c=e?ut(a-1,i):Math.max(a-1,0),d=n[c];let u,f,h,p,m,g,b,y,_,x,w,C,N,k,$,v=ze(l.x),E=ze(l.y);switch(l.command){case ne.close:u=ne.close;break;case ne.arc:w=l.rx,C=l.ry,N=l.xAxisRotation,k=l.largeArcFlag,$=l.sweepFlag,u=ne.arc+" "+w+" "+C+" "+N+" "+k+" "+$+" "+v+" "+E;break;case ne.curve:b=d.controls&&d.controls.right||ie.zero,y=l.controls&&l.controls.left||ie.zero,d.relative?(h=ze(b.x+d.x),p=ze(b.y+d.y)):(h=ze(b.x),p=ze(b.y)),l.relative?(m=ze(y.x+l.x),g=ze(y.y+l.y)):(m=ze(y.x),g=ze(y.y)),u=(a===0?ne.move:ne.curve)+" "+h+" "+p+" "+m+" "+g+" "+v+" "+E;break;case ne.move:o=l,u=ne.move+" "+v+" "+E;break;default:u=l.command+" "+v+" "+E}a>=r&&e&&(l.command===ne.curve&&(f=o,_=l.controls&&l.controls.right||l,x=f.controls&&f.controls.left||f,l.relative?(h=ze(_.x+l.x),p=ze(_.y+l.y)):(h=ze(_.x),p=ze(_.y)),f.relative?(m=ze(x.x+f.x),g=ze(x.y+f.y)):(m=ze(x.x),g=ze(x.y)),v=ze(f.x),E=ze(f.y),u+=" C "+h+" "+p+" "+m+" "+g+" "+v+" "+E),l.command!==ne.close&&(u+=" Z")),s+=u+" "}return s},pointsToString:function(n,e){let i="";const r=e*.5;for(let o=0;o<n.length;o++){const s=n[o].x,a=n[o].y-r;i+=ne.move+" "+s+" "+a+" ",i+="a "+r+" "+r+" 0 1 0 0.001 0 Z"}return i},getClip:function(n,e){let i=n._renderer.clip;return i||(i=n._renderer.clip=he.createElement("clipPath",{"clip-rule":"nonzero"})),i.parentNode===null&&e.defs.appendChild(i),i},getRendererType:function(n){return n in he?n:"path"},defs:{update:function(n){const{defs:e}=n;if(e._flagUpdate){const i=Array.prototype.slice.call(e.children,0);for(let r=0;r<i.length;r++){const o=i[r],s=o.id,a=`[fill="url(#${s})"],[stroke="url(#${s})"],[clip-path="url(#${s})"]`;n.querySelector(a)||e.removeChild(o)}e._flagUpdate=!1}}},group:{appendChild:function(n){const e=n._renderer.elem;if(!e)return;const i=e.nodeName;!i||/(radial|linear)gradient/i.test(i)||n._clip||this.elem.appendChild(e)},removeChild:function(n){const e=n._renderer.elem;!e||e.parentNode!=this.elem||!e.nodeName||n._clip||this.elem.removeChild(e)},orderChild:function(n){this.elem.appendChild(n._renderer.elem)},renderChild:function(n){const e=he.getRendererType(n._renderer.type);he[e].render.call(n,this)},render:function(n){if(!this._visible&&!this._flagVisible||this._opacity===0&&!this._flagOpacity)return this;re.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),this._renderer.elem||(this._renderer.elem=he.createElement("g",{id:this.id}),n.appendChild(this._renderer.elem));const e=this._matrix.manual||this._flagMatrix,i={domElement:n,elem:this._renderer.elem};e&&this._renderer.elem.setAttribute("transform","matrix("+this._matrix.toString()+")");for(let r=0;r<this.children.length;r++){const o=this.children[r],s=he.getRendererType(o._renderer.type);he[s].render.call(o,n)}if(this._flagId&&this._renderer.elem.setAttribute("id",this._id),this._flagOpacity&&this._renderer.elem.setAttribute("opacity",this._opacity),this._flagVisible&&this._renderer.elem.setAttribute("display",this._visible?"inline":"none"),this._flagClassName&&this._renderer.elem.setAttribute("class",this.classList.join(" ")),this._flagAdditions&&this.additions.forEach(he.group.appendChild,i),this._flagSubtractions&&this.subtractions.forEach(he.group.removeChild,i),this._flagOrder&&this.children.forEach(he.group.orderChild,i),this._flagMask)if(this._mask){const r=he.getRendererType(this._mask._renderer.type);he[r].render.call(this._mask,n),this._renderer.elem.setAttribute("clip-path","url(#"+this._mask.id+")")}else this._renderer.elem.removeAttribute("clip-path");return this.dataset&&Object.assign(this._renderer.elem.dataset,this.dataset),re.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},path:{render:function(n){if(this._opacity===0&&!this._flagOpacity)return this;re.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const e={};if((this._matrix.manual||this._flagMatrix)&&(e.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(e.id=this._id),this._flagVertices){const r=he.toString(this._renderer.vertices,this._closed);e.d=r}if(this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();const r=he.getRendererType(this._fill._renderer.type);he[r].render.call(this._fill,n,!0)}if(this._flagFill&&(e.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill,this._renderer.hasFillEffect&&typeof this._fill.id>"u"&&(n.defs._flagUpdate=!0,delete this._renderer.hasFillEffect)),this._stroke&&this._stroke._renderer){this._renderer.hasStrokeEffect=!0,this._stroke._update();const r=he.getRendererType(this._stroke._renderer.type);he[r].render.call(this._stroke,n,!0)}if(this._flagStroke&&(e.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke,this._renderer.hasStrokeEffect&&typeof this._stroke.id>"u"&&(n.defs._flagUpdate=!0,delete this._renderer.hasStrokeEffect)),this._flagLinewidth&&(e["stroke-width"]=Nn(this)),this._flagOpacity&&(e["stroke-opacity"]=this._opacity,e["fill-opacity"]=this._opacity),this._flagClassName&&(e.class=this.classList.join(" ")),this._flagVisible&&(e.visibility=this._visible?"visible":"hidden"),this._flagCap&&(e["stroke-linecap"]=this._cap),this._flagJoin&&(e["stroke-linejoin"]=this._join),this._flagMiter&&(e["stroke-miterlimit"]=this._miter),this.dashes&&this.dashes.length>0&&(e["stroke-dasharray"]=this.dashes.join(" "),e["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?he.setAttributes(this._renderer.elem,e):(e.id=this._id,this._renderer.elem=he.createElement("path",e),n.appendChild(this._renderer.elem)),this._flagClip){const r=he.getClip(this,n),o=this._renderer.elem;this._clip?(o.removeAttribute("id"),r.setAttribute("id",this.id),r.appendChild(o)):(r.removeAttribute("id"),o.setAttribute("id",this.id),this.parent._renderer.elem.appendChild(o))}if(this._flagMask)if(this._mask){const r=he.getRendererType(this._mask._renderer.type);he[r].render.call(this._mask,n),this._renderer.elem.setAttribute("clip-path","url(#"+this._mask.id+")")}else this._renderer.elem.removeAttribute("clip-path");return re.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},points:{render:function(n){if(this._opacity===0&&!this._flagOpacity)return this;re.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const e={};if((this._matrix.manual||this._flagMatrix)&&(e.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(e.id=this._id),this._flagVertices||this._flagSize||this._flagSizeAttenuation){let r=this._size;if(!this._sizeAttenuation){const s=this.worldMatrix.elements,a=Si(s[0],s[3],s[1],s[4],s[2],s[5]);r/=Math.max(a.scaleX,a.scaleY)}const o=he.pointsToString(this._renderer.collection,r);e.d=o}if(this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();const r=he.getRendererType(this._fill._renderer.type);he[r].render.call(this._fill,n,!0)}if(this._flagFill&&(e.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill,this._renderer.hasFillEffect&&typeof this._fill.id>"u"&&(n.defs._flagUpdate=!0,delete this._renderer.hasFillEffect)),this._stroke&&this._stroke._renderer){this._renderer.hasStrokeEffect=!0,this._stroke._update();const r=he.getRendererType(this._stroke._renderer.type);he[r].render.call(this._stroke,n,!0)}return this._flagStroke&&(e.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke,this._renderer.hasStrokeEffect&&typeof this._stroke.id>"u"&&(n.defs._flagUpdate=!0,delete this._renderer.hasStrokeEffect)),this._flagLinewidth&&(e["stroke-width"]=Nn(this)),this._flagOpacity&&(e["stroke-opacity"]=this._opacity,e["fill-opacity"]=this._opacity),this._flagClassName&&(e.class=this.classList.join(" ")),this._flagVisible&&(e.visibility=this._visible?"visible":"hidden"),this.dashes&&this.dashes.length>0&&(e["stroke-dasharray"]=this.dashes.join(" "),e["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?he.setAttributes(this._renderer.elem,e):(e.id=this._id,this._renderer.elem=he.createElement("path",e),n.appendChild(this._renderer.elem)),re.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},text:{render:function(n){this._update();const e={};if((this._matrix.manual||this._flagMatrix)&&(e.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(e.id=this._id),this._flagFamily&&(e["font-family"]=this._family),this._flagSize&&(e["font-size"]=this._size),this._flagLeading&&(e["line-height"]=this._leading),this._flagAlignment&&(e["text-anchor"]=he.alignments[this._alignment]||this._alignment),this._flagBaseline&&(e["dominant-baseline"]=he.baselines[this._baseline]||this._baseline),this._flagStyle&&(e["font-style"]=this._style),this._flagWeight&&(e["font-weight"]=this._weight),this._flagDecoration&&(e["text-decoration"]=this._decoration),this._flagDirection&&(e.direction=this._direction),this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();const r=he.getRendererType(this._fill._renderer.type);he[r].render.call(this._fill,n,!0)}if(this._flagFill&&(e.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill,this._renderer.hasFillEffect&&typeof this._fill.id>"u"&&(n.defs._flagUpdate=!0,delete this._renderer.hasFillEffect)),this._stroke&&this._stroke._renderer){this._renderer.hasStrokeEffect=!0,this._stroke._update();const r=he.getRendererType(this._stroke._renderer.type);he[r].render.call(this._stroke,n,!0)}if(this._flagStroke&&(e.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke,this._renderer.hasStrokeEffect&&typeof this._stroke.id>"u"&&(n.defs._flagUpdate=!0,delete this._renderer.hasStrokeEffect)),this._flagLinewidth&&(e["stroke-width"]=Nn(this)),this._flagOpacity&&(e.opacity=this._opacity),this._flagClassName&&(e.class=this.classList.join(" ")),this._flagVisible&&(e.visibility=this._visible?"visible":"hidden"),this.dashes&&this.dashes.length>0&&(e["stroke-dasharray"]=this.dashes.join(" "),e["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?he.setAttributes(this._renderer.elem,e):(e.id=this._id,this._renderer.elem=he.createElement("text",e),n.appendChild(this._renderer.elem)),this._flagClip){const r=he.getClip(this,n),o=this._renderer.elem;this._clip?(o.removeAttribute("id"),r.setAttribute("id",this.id),r.appendChild(o)):(r.removeAttribute("id"),o.setAttribute("id",this.id),this.parent._renderer.elem.appendChild(o))}if(this._flagMask)if(this._mask){const r=he.getRendererType(this._mask._renderer.type);he[r].render.call(this._mask,n),this._renderer.elem.setAttribute("clip-path","url(#"+this._mask.id+")")}else this._renderer.elem.removeAttribute("clip-path");return this._flagValue&&(this._renderer.elem.textContent=this._value),this.flagReset()}},"linear-gradient":{render:function(n,e){re.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),e||this._update();const i={};if(this._flagId&&(i.id=this._id),this._flagEndPoints&&(i.x1=this.left._x,i.y1=this.left._y,i.x2=this.right._x,i.y2=this.right._y),this._flagSpread&&(i.spreadMethod=this._spread),this._flagUnits&&(i.gradientUnits=this._units),this._renderer.elem?he.setAttributes(this._renderer.elem,i):(i.id=this._id,this._renderer.elem=he.createElement("linearGradient",i)),this._renderer.elem.parentNode===null&&n.defs.appendChild(this._renderer.elem),this._flagStops){const r=this._renderer.elem.childNodes.length!==this.stops.length;if(r)for(;this._renderer.elem.lastChild;)this._renderer.elem.removeChild(this._renderer.elem.lastChild);for(let o=0;o<this.stops.length;o++){const s=this.stops[o],a={};s._flagOffset&&(a.offset=100*s._offset+"%"),s._flagColor&&(a["stop-color"]=s._color),s._flagOpacity&&(a["stop-opacity"]=s._opacity),s._renderer.elem?he.setAttributes(s._renderer.elem,a):s._renderer.elem=he.createElement("stop",a),r&&this._renderer.elem.appendChild(s._renderer.elem),s.flagReset()}}return re.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},"radial-gradient":{render:function(n,e){re.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),e||this._update();const i={};if(this._flagId&&(i.id=this._id),this._flagCenter&&(i.cx=this.center._x,i.cy=this.center._y),this._flagFocal&&(i.fx=this.focal._x,i.fy=this.focal._y),this._flagRadius&&(i.r=this._radius),this._flagSpread&&(i.spreadMethod=this._spread),this._flagUnits&&(i.gradientUnits=this._units),this._renderer.elem?he.setAttributes(this._renderer.elem,i):(i.id=this._id,this._renderer.elem=he.createElement("radialGradient",i)),this._renderer.elem.parentNode===null&&n.defs.appendChild(this._renderer.elem),this._flagStops){const r=this._renderer.elem.childNodes.length!==this.stops.length;if(r)for(;this._renderer.elem.lastChild;)this._renderer.elem.removeChild(this._renderer.elem.lastChild);for(let o=0;o<this.stops.length;o++){const s=this.stops[o],a={};s._flagOffset&&(a.offset=100*s._offset+"%"),s._flagColor&&(a["stop-color"]=s._color),s._flagOpacity&&(a["stop-opacity"]=s._opacity),s._renderer.elem?he.setAttributes(s._renderer.elem,a):s._renderer.elem=he.createElement("stop",a),r&&this._renderer.elem.appendChild(s._renderer.elem),s.flagReset()}}return re.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},texture:{render:function(n,e){re.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),e||this._update();const i={},r={x:0,y:0},o=this.image;if(this._flagId&&(i.id=this._id),this._flagLoaded&&this.loaded)switch(o.nodeName.toLowerCase()){case"canvas":r.href=r["xlink:href"]=o.toDataURL("image/png");break;case"img":case"image":r.href=r["xlink:href"]=this.src;break}if((this._flagOffset||this._flagLoaded||this._flagScale)&&(i.x=this._offset.x,i.y=this._offset.y,o&&(i.x-=o.width/2,i.y-=o.height/2,this._scale instanceof ie?(i.x*=this._scale.x,i.y*=this._scale.y):(i.x*=this._scale,i.y*=this._scale)),i.x>0&&(i.x*=-1),i.y>0&&(i.y*=-1)),(this._flagScale||this._flagLoaded||this._flagRepeat)&&(i.width=0,i.height=0,o)){switch(i.width=o.width,i.height=o.height,this._repeat){case"no-repeat":i.width+=1,i.height+=1;break}this._scale instanceof ie?(i.width*=this._scale.x,i.height*=this._scale.y):(i.width*=this._scale,i.height*=this._scale),/no-repeat/i.test(this._repeat)?r.preserveAspectRatio="xMidYMid":r.preserveAspectRatio="none",r.width=i.width,r.height=i.height}return(this._flagScale||this._flagLoaded)&&(this._renderer.image?he.setAttributes(this._renderer.image,r):this._renderer.image=he.createElement("image",r)),this._renderer.elem?Object.keys(i).length!==0&&he.setAttributes(this._renderer.elem,i):(i.id=this._id,i.patternUnits="userSpaceOnUse",this._renderer.elem=he.createElement("pattern",i)),this._renderer.elem.parentNode===null&&n.defs.appendChild(this._renderer.elem),this._renderer.elem&&this._renderer.image&&!this._renderer.appended&&(this._renderer.elem.appendChild(this._renderer.image),this._renderer.appended=!0),re.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},Od=class extends ee{constructor(n){super(),this.domElement=n.domElement||he.createElement("svg"),this.scene=new xt,this.scene.parent=this,this.defs=he.createElement("defs"),this.defs._flagUpdate=!1,this.domElement.appendChild(this.defs),this.domElement.defs=this.defs,this.domElement.style.overflow="hidden"}setSize(n,e){return this.width=n,this.height=e,he.setAttributes(this.domElement,{width:n,height:e}),this.trigger(ee.Types.resize,n,e)}render(){return he.group.render.call(this.scene,this.domElement),he.defs.update(this.domElement),this}};S(Od,"Utils",he);var un={create:function(n,e,i){const r=n.createShader(n[i]);if(n.shaderSource(r,e),n.compileShader(r),!n.getShaderParameter(r,n.COMPILE_STATUS)){const s=n.getShaderInfoLog(r);throw n.deleteShader(r),new Yt("unable to compile shader "+r+": "+s)}return r},types:{vertex:"VERTEX_SHADER",fragment:"FRAGMENT_SHADER"},path:{vertex:`
40
+ ***************************************************************************** */var po=function(){return po=Object.assign||function(e){for(var i,r=1,o=arguments.length;r<o;r++){i=arguments[r];for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e},po.apply(this,arguments)},dg={scale:1,zoom:!0,infiniteZoom:!0,actualSize:!0,showZoomInOutIcons:!1,actualSizeIcons:{zoomIn:"lg-zoom-in",zoomOut:"lg-zoom-out"},enableZoomAfter:300,zoomPluginStrings:{zoomIn:"Zoom in",zoomOut:"Zoom out",viewActualSize:"View actual size"}},jn={containerResize:"lgContainerResize",beforeOpen:"lgBeforeOpen",afterOpen:"lgAfterOpen",slideItemLoad:"lgSlideItemLoad",afterSlide:"lgAfterSlide",rotateLeft:"lgRotateLeft",rotateRight:"lgRotateRight",flipHorizontal:"lgFlipHorizontal",flipVertical:"lgFlipVertical"},As=500,ug=(function(){function n(e,i){return this.core=e,this.$LG=i,this.settings=po(po({},dg),this.core.settings),this}return n.prototype.buildTemplates=function(){var e=this.settings.showZoomInOutIcons?'<button id="'+this.core.getIdName("lg-zoom-in")+'" type="button" aria-label="'+this.settings.zoomPluginStrings.zoomIn+'" class="lg-zoom-in lg-icon"></button><button id="'+this.core.getIdName("lg-zoom-out")+'" type="button" aria-label="'+this.settings.zoomPluginStrings.zoomOut+'" class="lg-zoom-out lg-icon"></button>':"";this.settings.actualSize&&(e+='<button id="'+this.core.getIdName("lg-actual-size")+'" type="button" aria-label="'+this.settings.zoomPluginStrings.viewActualSize+'" class="'+this.settings.actualSizeIcons.zoomIn+' lg-icon"></button>'),this.core.outer.addClass("lg-use-transition-for-zoom"),this.core.$toolbar.first().append(e)},n.prototype.enableZoom=function(e){var i=this,r=this.settings.enableZoomAfter+e.detail.delay;this.$LG("body").first().hasClass("lg-from-hash")&&e.detail.delay?r=0:this.$LG("body").first().removeClass("lg-from-hash"),this.zoomableTimeout=setTimeout(function(){i.isImageSlide(i.core.index)&&(i.core.getSlideItem(e.detail.index).addClass("lg-zoomable"),e.detail.index===i.core.index&&i.setZoomEssentials())},r+30)},n.prototype.enableZoomOnSlideItemLoad=function(){this.core.LGel.on(jn.slideItemLoad+".zoom",this.enableZoom.bind(this))},n.prototype.getDragCords=function(e){return{x:e.pageX,y:e.pageY}},n.prototype.getSwipeCords=function(e){var i=e.touches[0].pageX,r=e.touches[0].pageY;return{x:i,y:r}},n.prototype.getDragAllowedAxises=function(e,i){if(!this.containerRect)return{allowX:!1,allowY:!1};var r=this.core.getSlideItem(this.core.index).find(".lg-image").first().get(),o=0,s=0,a=r.getBoundingClientRect();e?(o=r.offsetHeight*e,s=r.offsetWidth*e):i?(o=a.height+i*a.height,s=a.width+i*a.width):(o=a.height,s=a.width);var l=o>this.containerRect.height,c=s>this.containerRect.width;return{allowX:c,allowY:l}},n.prototype.setZoomEssentials=function(){this.containerRect=this.core.$content.get().getBoundingClientRect()},n.prototype.zoomImage=function(e,i,r,o){if(!(!this.containerRect||Math.abs(i)<=0)){var s=this.containerRect.width/2+this.containerRect.left,a=this.containerRect.height/2+this.containerRect.top+this.scrollTop,l,c;e===1&&(this.positionChanged=!1);var d=this.getDragAllowedAxises(0,i),u=d.allowY,f=d.allowX;this.positionChanged&&(l=this.left/(this.scale-i),c=this.top/(this.scale-i),this.pageX=s-l,this.pageY=a-c,this.positionChanged=!1);var h=this.getPossibleSwipeDragCords(i),p,m,g=s-this.pageX,b=a-this.pageY;if(e-i>1){var y=(e-i)/Math.abs(i);g=(i<0?-g:g)+this.left*(y+(i<0?-1:1)),b=(i<0?-b:b)+this.top*(y+(i<0?-1:1)),p=g/y,m=b/y}else{var y=(e-i)*i;p=g*y,m=b*y}r&&(f?this.isBeyondPossibleLeft(p,h.minX)?p=h.minX:this.isBeyondPossibleRight(p,h.maxX)&&(p=h.maxX):e>1&&(p<h.minX?p=h.minX:p>h.maxX&&(p=h.maxX)),u?this.isBeyondPossibleTop(m,h.minY)?m=h.minY:this.isBeyondPossibleBottom(m,h.maxY)&&(m=h.maxY):e>1&&(m<h.minY?m=h.minY:m>h.maxY&&(m=h.maxY))),this.setZoomStyles({x:p,y:m,scale:e}),this.left=p,this.top=m,o&&this.setZoomImageSize()}},n.prototype.resetImageTranslate=function(e){if(this.isImageSlide(e)){var i=this.core.getSlideItem(e).find(".lg-image").first();this.imageReset=!1,i.removeClass("reset-transition reset-transition-y reset-transition-x"),this.core.outer.removeClass("lg-actual-size"),i.css("width","auto").css("height","auto"),setTimeout(function(){i.removeClass("no-transition")},10)}},n.prototype.setZoomImageSize=function(){var e=this,i=this.core.getSlideItem(this.core.index).find(".lg-image").first();setTimeout(function(){var r=e.getCurrentImageActualSizeScale();e.scale>=r&&(i.addClass("no-transition"),e.imageReset=!0)},As),setTimeout(function(){var r=e.getCurrentImageActualSizeScale();if(e.scale>=r){var o=e.getDragAllowedAxises(e.scale);i.css("width",i.get().naturalWidth+"px").css("height",i.get().naturalHeight+"px"),e.core.outer.addClass("lg-actual-size"),o.allowX&&o.allowY?i.addClass("reset-transition"):o.allowX&&!o.allowY?i.addClass("reset-transition-x"):!o.allowX&&o.allowY&&i.addClass("reset-transition-y")}},As+50)},n.prototype.setZoomStyles=function(e){var i=this.core.getSlideItem(this.core.index).find(".lg-img-wrap").first(),r=this.core.getSlideItem(this.core.index).find(".lg-image").first(),o=this.core.outer.find(".lg-current .lg-dummy-img").first();this.scale=e.scale,r.css("transform","scale3d("+e.scale+", "+e.scale+", 1)"),o.css("transform","scale3d("+e.scale+", "+e.scale+", 1)");var s="translate3d("+e.x+"px, "+e.y+"px, 0)";i.css("transform",s)},n.prototype.setActualSize=function(e,i){var r=this;if(!this.zoomInProgress){this.zoomInProgress=!0;var o=this.core.galleryItems[this.core.index];this.resetImageTranslate(e),setTimeout(function(){if(!(!o.src||r.core.outer.hasClass("lg-first-slide-loading"))){var s=r.getCurrentImageActualSizeScale(),a=r.scale;r.core.outer.hasClass("lg-zoomed")?r.scale=1:r.scale=r.getScale(s),r.setPageCords(i),r.beginZoom(r.scale),r.zoomImage(r.scale,r.scale-a,!0,!0)}},50),setTimeout(function(){r.core.outer.removeClass("lg-grabbing").addClass("lg-grab")},60),setTimeout(function(){r.zoomInProgress=!1},As+110)}},n.prototype.getNaturalWidth=function(e){var i=this.core.getSlideItem(e).find(".lg-image").first(),r=this.core.galleryItems[e].width;return r?parseFloat(r):i.get().naturalWidth},n.prototype.getActualSizeScale=function(e,i){var r,o;return e>=i?(r=e/i,o=r||2):o=1,o},n.prototype.getCurrentImageActualSizeScale=function(){var e=this.core.getSlideItem(this.core.index).find(".lg-image").first(),i=e.get().offsetWidth,r=this.getNaturalWidth(this.core.index)||i;return this.getActualSizeScale(r,i)},n.prototype.getPageCords=function(e){var i={};if(e)i.x=e.pageX||e.touches[0].pageX,i.y=e.pageY||e.touches[0].pageY;else{var r=this.core.$content.get().getBoundingClientRect();i.x=r.width/2+r.left,i.y=r.height/2+this.scrollTop+r.top}return i},n.prototype.setPageCords=function(e){var i=this.getPageCords(e);this.pageX=i.x,this.pageY=i.y},n.prototype.manageActualPixelClassNames=function(){var e=this.core.getElementById("lg-actual-size");e.removeClass(this.settings.actualSizeIcons.zoomIn).addClass(this.settings.actualSizeIcons.zoomOut)},n.prototype.beginZoom=function(e){return this.core.outer.removeClass("lg-zoom-drag-transition lg-zoom-dragging"),e>1?(this.core.outer.addClass("lg-zoomed"),this.manageActualPixelClassNames()):this.resetZoom(),e>1},n.prototype.getScale=function(e){var i=this.getCurrentImageActualSizeScale();return e<1?e=1:e>i&&(e=i),e},n.prototype.init=function(){var e=this;if(this.settings.zoom){this.buildTemplates(),this.enableZoomOnSlideItemLoad();var i=null;this.core.outer.on("dblclick.lg",function(r){e.$LG(r.target).hasClass("lg-image")&&e.setActualSize(e.core.index,r)}),this.core.outer.on("touchstart.lg",function(r){var o=e.$LG(r.target);r.touches.length===1&&o.hasClass("lg-image")&&(i?(clearTimeout(i),i=null,r.preventDefault(),e.setActualSize(e.core.index,r)):i=setTimeout(function(){i=null},300))}),this.core.LGel.on(jn.containerResize+".zoom "+jn.rotateRight+".zoom "+jn.rotateLeft+".zoom "+jn.flipHorizontal+".zoom "+jn.flipVertical+".zoom",function(){if(!(!e.core.lgOpened||!e.isImageSlide(e.core.index)||e.core.touchAction)){var r=e.core.getSlideItem(e.core.index).find(".lg-img-wrap").first();e.top=0,e.left=0,e.setZoomEssentials(),e.setZoomSwipeStyles(r,{x:0,y:0}),e.positionChanged=!0}}),this.$LG(window).on("scroll.lg.zoom.global"+this.core.lgId,function(){e.core.lgOpened&&(e.scrollTop=e.$LG(window).scrollTop())}),this.core.getElementById("lg-zoom-out").on("click.lg",function(){if(e.isImageSlide(e.core.index)){var r=0;e.imageReset&&(e.resetImageTranslate(e.core.index),r=50),setTimeout(function(){var o=e.scale-e.settings.scale;o<1&&(o=1),e.beginZoom(o),e.zoomImage(o,-e.settings.scale,!0,!e.settings.infiniteZoom)},r)}}),this.core.getElementById("lg-zoom-in").on("click.lg",function(){e.zoomIn()}),this.core.getElementById("lg-actual-size").on("click.lg",function(){e.setActualSize(e.core.index)}),this.core.LGel.on(jn.beforeOpen+".zoom",function(){e.core.outer.find(".lg-item").removeClass("lg-zoomable")}),this.core.LGel.on(jn.afterOpen+".zoom",function(){e.scrollTop=e.$LG(window).scrollTop(),e.pageX=e.core.outer.width()/2,e.pageY=e.core.outer.height()/2+e.scrollTop,e.scale=1}),this.core.LGel.on(jn.afterSlide+".zoom",function(r){var o=r.detail.prevIndex;e.scale=1,e.positionChanged=!1,e.zoomInProgress=!1,e.resetZoom(o),e.resetImageTranslate(o),e.isImageSlide(e.core.index)&&e.setZoomEssentials()}),this.zoomDrag(),this.pinchZoom(),this.zoomSwipe(),this.zoomableTimeout=!1,this.positionChanged=!1,this.zoomInProgress=!1}},n.prototype.zoomIn=function(){if(this.isImageSlide(this.core.index)){var e=this.scale+this.settings.scale;this.settings.infiniteZoom||(e=this.getScale(e)),this.beginZoom(e),this.zoomImage(e,Math.min(this.settings.scale,e-this.scale),!0,!this.settings.infiniteZoom)}},n.prototype.resetZoom=function(e){this.core.outer.removeClass("lg-zoomed lg-zoom-drag-transition");var i=this.core.getElementById("lg-actual-size"),r=this.core.getSlideItem(e!==void 0?e:this.core.index);i.removeClass(this.settings.actualSizeIcons.zoomOut).addClass(this.settings.actualSizeIcons.zoomIn),r.find(".lg-img-wrap").first().removeAttr("style"),r.find(".lg-image").first().removeAttr("style"),this.scale=1,this.left=0,this.top=0,this.setPageCords()},n.prototype.getTouchDistance=function(e){return Math.sqrt((e.touches[0].pageX-e.touches[1].pageX)*(e.touches[0].pageX-e.touches[1].pageX)+(e.touches[0].pageY-e.touches[1].pageY)*(e.touches[0].pageY-e.touches[1].pageY))},n.prototype.pinchZoom=function(){var e=this,i=0,r=!1,o=1,s=0,a=this.core.getSlideItem(this.core.index);this.core.outer.on("touchstart.lg",function(l){if(a=e.core.getSlideItem(e.core.index),!!e.isImageSlide(e.core.index)&&l.touches.length===2){if(l.preventDefault(),e.core.outer.hasClass("lg-first-slide-loading"))return;o=e.scale||1,e.core.outer.removeClass("lg-zoom-drag-transition lg-zoom-dragging"),e.setPageCords(l),e.resetImageTranslate(e.core.index),e.core.touchAction="pinch",i=e.getTouchDistance(l)}}),this.core.$inner.on("touchmove.lg",function(l){if(l.touches.length===2&&e.core.touchAction==="pinch"&&(e.$LG(l.target).hasClass("lg-item")||a.get().contains(l.target))){l.preventDefault();var c=e.getTouchDistance(l),d=i-c;if(!r&&Math.abs(d)>5&&(r=!0),r){s=e.scale;var u=Math.max(1,o+-d*.02);e.scale=Math.round((u+Number.EPSILON)*100)/100;var f=e.scale-s;e.zoomImage(e.scale,Math.round((f+Number.EPSILON)*100)/100,!1,!1)}}}),this.core.$inner.on("touchend.lg",function(l){if(e.core.touchAction==="pinch"&&(e.$LG(l.target).hasClass("lg-item")||a.get().contains(l.target))){if(r=!1,i=0,e.scale<=1)e.resetZoom();else{var c=e.getCurrentImageActualSizeScale();if(e.scale>=c){var d=c-e.scale;d===0&&(d=.01),e.zoomImage(c,d,!1,!0)}e.manageActualPixelClassNames(),e.core.outer.addClass("lg-zoomed")}e.core.touchAction=void 0}})},n.prototype.touchendZoom=function(e,i,r,o,s){var a=i.x-e.x,l=i.y-e.y,c=Math.abs(a)/s+1,d=Math.abs(l)/s+1;c>2&&(c+=1),d>2&&(d+=1),a=a*c,l=l*d;var u=this.core.getSlideItem(this.core.index).find(".lg-img-wrap").first(),f={};f.x=this.left+a,f.y=this.top+l;var h=this.getPossibleSwipeDragCords();(Math.abs(a)>15||Math.abs(l)>15)&&(o&&(this.isBeyondPossibleTop(f.y,h.minY)?f.y=h.minY:this.isBeyondPossibleBottom(f.y,h.maxY)&&(f.y=h.maxY)),r&&(this.isBeyondPossibleLeft(f.x,h.minX)?f.x=h.minX:this.isBeyondPossibleRight(f.x,h.maxX)&&(f.x=h.maxX)),o?this.top=f.y:f.y=this.top,r?this.left=f.x:f.x=this.left,this.setZoomSwipeStyles(u,f),this.positionChanged=!0)},n.prototype.getZoomSwipeCords=function(e,i,r,o,s){var a={};if(o){if(a.y=this.top+(i.y-e.y),this.isBeyondPossibleTop(a.y,s.minY)){var l=s.minY-a.y;a.y=s.minY-l/6}else if(this.isBeyondPossibleBottom(a.y,s.maxY)){var c=a.y-s.maxY;a.y=s.maxY+c/6}}else a.y=this.top;if(r){if(a.x=this.left+(i.x-e.x),this.isBeyondPossibleLeft(a.x,s.minX)){var d=s.minX-a.x;a.x=s.minX-d/6}else if(this.isBeyondPossibleRight(a.x,s.maxX)){var u=a.x-s.maxX;a.x=s.maxX+u/6}}else a.x=this.left;return a},n.prototype.isBeyondPossibleLeft=function(e,i){return e>=i},n.prototype.isBeyondPossibleRight=function(e,i){return e<=i},n.prototype.isBeyondPossibleTop=function(e,i){return e>=i},n.prototype.isBeyondPossibleBottom=function(e,i){return e<=i},n.prototype.isImageSlide=function(e){var i=this.core.galleryItems[e];return this.core.getSlideType(i)==="image"},n.prototype.getPossibleSwipeDragCords=function(e){var i=this.core.getSlideItem(this.core.index).find(".lg-image").first(),r=this.core.mediaContainerPosition.bottom,o=i.get().getBoundingClientRect(),s=o.height,a=o.width;e&&(s=s+e*s,a=a+e*a);var l=(s-this.containerRect.height)/2,c=(this.containerRect.height-s)/2+r,d=(a-this.containerRect.width)/2,u=(this.containerRect.width-a)/2,f={minY:l,maxY:c,minX:d,maxX:u};return f},n.prototype.setZoomSwipeStyles=function(e,i){e.css("transform","translate3d("+i.x+"px, "+i.y+"px, 0)")},n.prototype.zoomSwipe=function(){var e=this,i={},r={},o=!1,s=!1,a=!1,l=new Date,c=new Date,d,u,f=this.core.getSlideItem(this.core.index);this.core.$inner.on("touchstart.lg",function(h){if(e.isImageSlide(e.core.index)&&(f=e.core.getSlideItem(e.core.index),(e.$LG(h.target).hasClass("lg-item")||f.get().contains(h.target))&&h.touches.length===1&&e.core.outer.hasClass("lg-zoomed"))){h.preventDefault(),l=new Date,e.core.touchAction="zoomSwipe",u=e.core.getSlideItem(e.core.index).find(".lg-img-wrap").first();var p=e.getDragAllowedAxises(0);a=p.allowY,s=p.allowX,(s||a)&&(i=e.getSwipeCords(h)),d=e.getPossibleSwipeDragCords(),e.core.outer.addClass("lg-zoom-dragging lg-zoom-drag-transition")}}),this.core.$inner.on("touchmove.lg",function(h){if(h.touches.length===1&&e.core.touchAction==="zoomSwipe"&&(e.$LG(h.target).hasClass("lg-item")||f.get().contains(h.target))){h.preventDefault(),e.core.touchAction="zoomSwipe",r=e.getSwipeCords(h);var p=e.getZoomSwipeCords(i,r,s,a,d);(Math.abs(r.x-i.x)>15||Math.abs(r.y-i.y)>15)&&(o=!0,e.setZoomSwipeStyles(u,p))}}),this.core.$inner.on("touchend.lg",function(h){if(e.core.touchAction==="zoomSwipe"&&(e.$LG(h.target).hasClass("lg-item")||f.get().contains(h.target))){if(h.preventDefault(),e.core.touchAction=void 0,e.core.outer.removeClass("lg-zoom-dragging"),!o)return;o=!1,c=new Date;var p=c.valueOf()-l.valueOf();e.touchendZoom(i,r,s,a,p)}})},n.prototype.zoomDrag=function(){var e=this,i={},r={},o=!1,s=!1,a=!1,l=!1,c,d,u,f;this.core.outer.on("mousedown.lg.zoom",function(h){if(e.isImageSlide(e.core.index)){var p=e.core.getSlideItem(e.core.index);if(e.$LG(h.target).hasClass("lg-item")||p.get().contains(h.target)){c=new Date,f=e.core.getSlideItem(e.core.index).find(".lg-img-wrap").first();var m=e.getDragAllowedAxises(0);l=m.allowY,a=m.allowX,e.core.outer.hasClass("lg-zoomed")&&e.$LG(h.target).hasClass("lg-object")&&(a||l)&&(h.preventDefault(),i=e.getDragCords(h),u=e.getPossibleSwipeDragCords(),o=!0,e.core.outer.removeClass("lg-grab").addClass("lg-grabbing lg-zoom-drag-transition lg-zoom-dragging"))}}}),this.$LG(window).on("mousemove.lg.zoom.global"+this.core.lgId,function(h){if(o){s=!0,r=e.getDragCords(h);var p=e.getZoomSwipeCords(i,r,a,l,u);e.setZoomSwipeStyles(f,p)}}),this.$LG(window).on("mouseup.lg.zoom.global"+this.core.lgId,function(h){if(o){if(d=new Date,o=!1,e.core.outer.removeClass("lg-zoom-dragging"),s&&(i.x!==r.x||i.y!==r.y)){r=e.getDragCords(h);var p=d.valueOf()-c.valueOf();e.touchendZoom(i,r,a,l,p)}s=!1}e.core.outer.removeClass("lg-grabbing").addClass("lg-grab")})},n.prototype.closeGallery=function(){this.resetZoom(),this.zoomInProgress=!1},n.prototype.destroy=function(){this.$LG(window).off(".lg.zoom.global"+this.core.lgId),this.core.LGel.off(".lg.zoom"),this.core.LGel.off(".zoom"),clearTimeout(this.zoomableTimeout),this.zoomableTimeout=!1},n})();const fg={ref:"gallery-container",class:"lightgallery-wrapper"},hg={},cc=t.defineComponent({...hg,__name:"lightgallery",props:{settings:{},onAfterAppendSlide:{type:Function},onInit:{type:Function},onHasVideo:{type:Function},onContainerResize:{type:Function},onAfterAppendSubHtml:{type:Function},onBeforeOpen:{type:Function},onAfterOpen:{type:Function},onSlideItemLoad:{type:Function},onBeforeSlide:{type:Function},onAfterSlide:{type:Function},onPosterClick:{type:Function},onDragStart:{type:Function},onDragMove:{type:Function},onDragEnd:{type:Function},onBeforeNextSlide:{type:Function},onBeforePrevSlide:{type:Function},onBeforeClose:{type:Function},onAfterClose:{type:Function},onRotateLeft:{type:Function},onRotateRight:{type:Function},onFlipHorizontal:{type:Function},onFlipVertical:{type:Function}},setup(n){const e=n,i={lgAfterAppendSlide:e.onAfterAppendSlide,lgInit:e.onInit,lgHasVideo:e.onHasVideo,lgContainerResize:e.onContainerResize,lgAfterAppendSubHtml:e.onAfterAppendSubHtml,lgBeforeOpen:e.onBeforeOpen,lgAfterOpen:e.onAfterOpen,lgSlideItemLoad:e.onSlideItemLoad,lgBeforeSlide:e.onBeforeSlide,lgAfterSlide:e.onAfterSlide,lgPosterClick:e.onPosterClick,lgDragStart:e.onDragStart,lgDragMove:e.onDragMove,lgDragEnd:e.onDragEnd,lgBeforeNextSlide:e.onBeforeNextSlide,lgBeforePrevSlide:e.onBeforePrevSlide,lgBeforeClose:e.onBeforeClose,lgAfterClose:e.onAfterClose,lgRotateLeft:e.onRotateLeft,lgRotateRight:e.onRotateRight,lgFlipHorizontal:e.onFlipHorizontal,lgFlipVertical:e.onFlipVertical},r=t.useTemplateRef("gallery-container"),o=t.ref(null);return t.onMounted(async()=>{if(!r.value)return;const s=await import("lightgallery");o.value=s.default(r.value,{...e.settings}),V.forOwn(i,(a,l)=>{var c;a&&((c=r.value)==null||c.addEventListener(l,a))})}),t.onBeforeUnmount(()=>{var s;o.value&&((s=o.value)==null||s.destroy(),o.value=null)}),(s,a)=>(t.openBlock(),t.createElementBlock("div",fg,[t.renderSlot(s.$slots,"default")],512))}}),mg=["href"],pg=["src","alt"],gg={},dc=t.defineComponent({...gg,__name:"image-gallery",props:{images:{}},setup(n,{expose:e}){const i=t.ref(!1),r=t.ref(!1),o=t.ref({plugins:[cg,ug],addClass:"sc-lg-container",licenseKey:"0000-0000-000-0000",strings:{closeGallery:"Закрыть",download:"Скачать",mediaLoadingFailed:"Ошибка загрузки контента...",nextSlide:"Следующее изображение",playVideo:"Воспроизвести видео",previousSlide:"Предыдущее изображение",toggleMaximize:"Расширить"}}),s=()=>window.innerWidth*(Ue.getDeviceTypeByResolution()===Xe.phone?.7:.8),a=t.ref(s()),l=()=>{a.value=s()},c=()=>{i.value=!0};return t.onUnmounted(()=>{window.removeEventListener("resize",l)}),e({show:c}),window.addEventListener("resize",l),(d,u)=>{const f=lc,h=I.NPopover;return t.openBlock(),t.createBlock(h,{trigger:"manual",show:i.value,class:"sc-image",placement:"top-start",onClickoutside:u[3]||(u[3]=()=>{r.value||(i.value=!1)})},{trigger:t.withCtx(()=>[t.createElementVNode("div",{class:"inline-flex",onClick:u[0]||(u[0]=p=>i.value=!i.value)},[t.renderSlot(d.$slots,"default",{},()=>[t.createVNode(f)])])]),default:t.withCtx(()=>[t.createVNode(cc,{settings:o.value,style:t.normalizeStyle(`max-width: ${a.value}px`),class:"flex flex-row overflow-x-scroll",onAfterOpen:u[1]||(u[1]=()=>{r.value=!0}),onAfterClose:u[2]||(u[2]=()=>{r.value=!1,i.value=!1})},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.images,(p,m)=>(t.openBlock(),t.createElementBlock("a",{key:m,href:p.image},[t.createElementVNode("img",{src:p.preview,alt:`Изображение #${m+1}`},null,8,pg)],8,mg))),128))]),_:1},8,["settings","style"])]),_:3},8,["show"])}}}),yg={class:"text-sm grid grid-cols-[auto_auto] gap-x-3 gap-y-1 items-baseline"},bg={class:"pr-3"},_g={class:"text-right"},wg={},xg=t.defineComponent({...wg,__name:"product-stock-count",props:{product:{}},setup(n){return(e,i)=>{const r=ho,o=I.NPopover;return t.openBlock(),t.createBlock(o,{trigger:"click",placement:"top-start",class:"sc-stock-count"},{trigger:t.withCtx(()=>[t.renderSlot(e.$slots,"default",{},()=>[t.createVNode(r)])]),default:t.withCtx(()=>[t.createElementVNode("div",yg,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.product.stockCount,(s,a)=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:a},[t.createElementVNode("span",bg,t.toDisplayString(s.warehouse.name),1),t.createElementVNode("span",_g,[t.createTextVNode(t.toDisplayString(s.count??"В наличии")+" ",1),s.count?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createTextVNode(t.toDisplayString(n.product.unit.name),1)],64)):t.createCommentVNode("",!0)])],64))),128))])]),_:3})}}}),kg=["innerHTML"],Cg=["innerHTML"],vg={class:"m-0 flex list-none flex-col gap-1 p-0 text-sm"},Sg=["href"],Bg={key:1,class:"text-sm text-gray-500"},Ng={},Os=t.defineComponent({...Ng,__name:"product-info-content",props:{product:{},size:{default:"medium"},maxHeight:{default:void 0},activeTab:{default:void 0}},setup(n){const e=n,i=t.computed(()=>e.maxHeight?{maxHeight:e.maxHeight}:void 0),r=t.computed(()=>{var c;return((c=e.product.properties)==null?void 0:c.description)??""}),o=t.computed(()=>{var c;return((c=e.product.properties)==null?void 0:c.specification)??""}),s=t.computed(()=>Ms(e.product)),a=t.computed(()=>[r.value?"description":null,o.value?"specification":null,s.value.length>0?"files":null].filter(c=>c!==null)),l=t.ref(e.activeTab&&a.value.includes(e.activeTab)?e.activeTab:a.value[0]);return(c,d)=>{const u=I.NScrollbar,f=I.NTabPane,h=I.NTabs;return a.value.length>0?(t.openBlock(),t.createBlock(h,{key:0,value:l.value,"onUpdate:value":d[0]||(d[0]=p=>l.value=p),size:n.size,type:"line",class:"sc-product-info-content"},{default:t.withCtx(()=>[r.value?(t.openBlock(),t.createBlock(f,{key:0,name:"description",tab:"Описание"},{default:t.withCtx(()=>[t.createVNode(u,{style:t.normalizeStyle(i.value)},{default:t.withCtx(()=>[t.createElementVNode("div",{class:"sc-product-info-html",innerHTML:r.value},null,8,kg)]),_:1},8,["style"])]),_:1})):t.createCommentVNode("",!0),o.value?(t.openBlock(),t.createBlock(f,{key:1,name:"specification",tab:"Характеристики"},{default:t.withCtx(()=>[t.createVNode(u,{style:t.normalizeStyle(i.value)},{default:t.withCtx(()=>[t.createElementVNode("div",{class:"sc-product-info-html",innerHTML:o.value},null,8,Cg)]),_:1},8,["style"])]),_:1})):t.createCommentVNode("",!0),s.value.length>0?(t.openBlock(),t.createBlock(f,{key:2,name:"files",tab:`Файлы (${s.value.length})`},{default:t.withCtx(()=>[t.createVNode(u,{style:t.normalizeStyle(i.value)},{default:t.withCtx(()=>[t.createElementVNode("ul",vg,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(s.value,p=>(t.openBlock(),t.createElementBlock("li",{key:p.id},[t.createElementVNode("a",{href:p.url,target:"_blank",rel:"noopener"},t.toDisplayString(p.typeName),9,Sg)]))),128))])]),_:1},8,["style"])]),_:1},8,["tab"])):t.createCommentVNode("",!0)]),_:1},8,["value","size"])):(t.openBlock(),t.createElementBlock("span",Bg," Описание, характеристики и файлы не заданы. "))}}}),Tg={key:0,class:"flex flex-row gap-2.5"},$g={key:1,class:"flex flex-row flex-wrap justify-end gap-2.5"},Eg={},zs=t.defineComponent({...Eg,__name:"base-dialog",props:{show:{type:Boolean},title:{},sizes:{default:()=>({phone:{size:"small",scale:.98},tablet:{size:"small",scale:.9},default:{size:"medium",scale:.7}})},modalWidth:{default:void 0},processing:{type:Boolean,default:!1},valid:{type:Boolean,default:!0},acceptButton:{default:()=>({show:!0,text:"ОК"})},cancelButton:{default:()=>({show:!0,text:"Отмена"})},trapFocus:{type:Boolean,default:!0}},emits:["update:show","opening","closing","accept","processing:cancel"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.ref(r.show),a=t.ref(r.processing),l=Ue.initRefDependingOnDeviceResolution(r.sizes.phone.size,r.sizes.tablet.size,r.sizes.default.size),c=Ue.initRefDependingOnDeviceResolution(r.sizes.phone.scale,r.sizes.tablet.scale,r.sizes.default.scale),d=t.computed(()=>r.modalWidth??window.innerWidth*c.value),u=()=>{o("opening"),s.value=!0,o("update:show",s.value)},f=(p="other",m=!1)=>{if(a.value&&!m){o("processing:cancel",_=>{a.value=_});return}let g=!1;o("closing",p,()=>{g=!0}),g||(s.value=!1,o("update:show",s.value))},h=()=>{o("accept",m=>{a.value=m})};return t.watch(()=>r.show,p=>{p?u():f("other",!0)}),t.watch(()=>r.processing,p=>{a.value=p}),e({open:u,close:f,acceptHandler:h}),(p,m)=>{const g=I.NButton,b=I.NModal;return t.openBlock(),t.createBlock(b,{loading:a.value,show:s.value,"show-icon":!1,size:t.unref(l),style:t.normalizeStyle(`width: ${d.value}px`),title:n.title,"trap-focus":n.trapFocus??!0,"action-class":p.$slots["extra-action"]?"grid grid-cols-2 !justify-between":void 0,preset:"dialog",onClose:m[1]||(m[1]=y=>f("header")),onEsc:m[2]||(m[2]=y=>f("esc")),onMaskClick:m[3]||(m[3]=y=>f("mask"))},t.createSlots({default:t.withCtx(()=>[t.renderSlot(p.$slots,"default")]),_:2},[p.$slots.header?{name:"header",fn:t.withCtx(()=>[t.renderSlot(p.$slots,"header")]),key:"0"}:void 0,p.$slots.action||p.$slots["extra-action"]||n.acceptButton.show||n.cancelButton.show?{name:"action",fn:t.withCtx(()=>[p.$slots["extra-action"]?(t.openBlock(),t.createElementBlock("div",Tg,[t.renderSlot(p.$slots,"extra-action")])):t.createCommentVNode("",!0),p.$slots.action||n.acceptButton.show||n.cancelButton.show?(t.openBlock(),t.createElementBlock("div",$g,[t.renderSlot(p.$slots,"action",{disabled:a.value}),n.acceptButton.show??!0?(t.openBlock(),t.createBlock(g,{key:0,disabled:a.value||!n.valid,loading:a.value,size:t.unref(l),type:"primary",onClick:h},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(n.acceptButton.text??"ОК"),1)]),_:1},8,["disabled","loading","size"])):t.createCommentVNode("",!0),n.cancelButton.show??!0?(t.openBlock(),t.createBlock(g,{key:1,disabled:a.value,size:t.unref(l),type:"default",onClick:m[0]||(m[0]=y=>f("footer"))},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(n.cancelButton.text??"Отмена"),1)]),_:1},8,["disabled","size"])):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)]),key:"1"}:void 0]),1032,["loading","show","size","style","title","trap-focus","action-class"])}}}),Rg={class:"flex flex-col gap-3"},Pg={class:"text-xs text-gray-500"},Fg={},uc=t.defineComponent({...Fg,__name:"product-info-dialog",props:{product:{},show:{type:Boolean,default:!1},activeTab:{default:void 0}},emits:["update:show"],setup(n,{emit:e}){const i=e,r=()=>{i("update:show",!1)};return(o,s)=>(t.openBlock(),t.createBlock(zs,{show:n.show,title:n.product.name,"accept-button":{show:!1},"cancel-button":{show:!0,text:"Закрыть"},"trap-focus":!1,onClosing:r},{default:t.withCtx(()=>[t.createElementVNode("div",Rg,[t.createElementVNode("span",Pg,"Артикул: "+t.toDisplayString(n.product.code),1),t.createVNode(Os,{product:n.product,"active-tab":n.activeTab,"max-height":"60vh"},null,8,["product","active-tab"])])]),_:1},8,["show","title"]))}}),Vg={class:"flex flex-col gap-2"},Mg={class:"flex justify-end border-0 border-t border-solid border-gray-200 pt-2"},Ig={},fc=t.defineComponent({...Ig,__name:"product-info-popover",props:{product:{}},setup(n){const e=t.ref(!1),i=t.ref(!1),r=t.ref(!1),o=()=>{e.value=!1,i.value=!0,r.value=!0};return(s,a)=>{const l=ho,c=I.NButton,d=I.NPopover;return t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createVNode(d,{show:e.value,"onUpdate:show":a[0]||(a[0]=u=>e.value=u),width:560,style:{maxWidth:"calc(100vw - 2rem)"},trigger:"click",placement:"bottom-start",class:"sc-product-info-popover"},{trigger:t.withCtx(()=>[t.renderSlot(s.$slots,"default",{},()=>[t.createVNode(l,{title:"Описание и характеристики",class:"cursor-pointer"})])]),default:t.withCtx(()=>[t.createElementVNode("div",Vg,[t.createVNode(Os,{product:n.product,size:"small","max-height":"16rem"},null,8,["product"]),t.createElementVNode("div",Mg,[t.createVNode(c,{text:"",type:"info",size:"small",onClick:o},{default:t.withCtx(()=>[...a[2]||(a[2]=[t.createTextVNode(" Открыть полностью ",-1)])]),_:1})])])]),_:3},8,["show"]),i.value?(t.openBlock(),t.createBlock(uc,{key:0,show:r.value,"onUpdate:show":a[1]||(a[1]=u=>r.value=u),product:n.product},null,8,["show","product"])):t.createCommentVNode("",!0)],64)}}}),Ag={class:"flex flex-row justify-between"},Og={key:0,class:"inline-flex flex-row gap-0.5 mr-2 align-sub"},zg={key:1},Dg={class:"ml-2 align-sub"},Lg={class:"flex cursor-pointer flex-row gap-2 whitespace-nowrap"},Hg={key:2,class:"ml-2 align-sub"},Wg={class:"@container"},jg={class:"text-sc-dark-grey @sm:grid-cols-2 @2xl:grid-cols-3 grid grid-cols-1 gap-1 text-sm"},qg={key:0,class:"sc-supplier-sku col-span-full whitespace-nowrap text-wrap"},Xg={class:"text-sc-dark-grey"},Yg={key:1,class:"sc-product-code col-start-1 whitespace-nowrap"},Ug={class:"text-gray-600"},Kg={class:"flex cursor-pointer flex-row gap-1 whitespace-nowrap"},Gg={key:3,class:"underline decoration-dashed"},Zg={key:4,class:"sc-product-pack whitespace-nowrap"},Qg={class:"text-gray-600"},Jg={key:5,class:"sc-product-planning-incoming-date col-span-full mt-1.5 text-wrap"},ey={class:"text-gray-600"},ty={key:0,class:"mt-3 flex flex-row gap-3 pb-2 text-base xl:text-lg"},ny={key:0},iy={class:"sc-product-properties m-0 mt-3 list-inside list-disc p-0 pl-1.5 text-xs text-gray-500"},ry={},go=t.defineComponent({...ry,__name:"product-name",props:{product:{},eventEmitter:{},showSlugs:{type:Boolean,default:!1},showProperties:{type:Boolean,default:!1},showCode:{type:Boolean,default:!0},showProductCosts:{type:[Boolean,Function],default:!1},showPlanningDates:{type:Boolean,default:!0},showProductInfoButton:{type:[Boolean,Function],default:!1},showPriceHistory:{type:Boolean,default:!1},showCostDate:{type:Boolean,default:!1},allowNameClick:{type:[Boolean,Function],default:!1},allowPriceClick:{type:[Boolean,Function],default:!1},currencyRates:{default:void 0},showAdditionalSaleIcon:{type:Boolean,default:!1},showProductAddToCartButton:{type:[Boolean,String,Function],default:!1},showProductEditButton:{type:[Boolean,String,Function],default:!1},showProductRequiredButton:{type:[Boolean,String,Function],default:!1},productContextButtonsConfig:{type:Function,default:void 0}},setup(n,{expose:e}){const i=n,r=t.computed(()=>V.isFunction(i.showProductCosts)?i.showProductCosts(i.product):i.showProductCosts),o=t.computed(()=>V.sortBy(i.product.priceCoefficients,["coefficient.slug"])),s=t.computed(()=>{var h,p;return(p=(h=i.product)==null?void 0:h.properties)==null?void 0:p.planingIncomingDate}),a=t.useTemplateRef("image-gallery"),l=()=>{var h;(h=a.value)==null||h.show()},c=t.computed(()=>V.isFunction(i.allowNameClick)?i.allowNameClick(i.product):i.allowNameClick),d=t.computed(()=>(V.isFunction(i.showProductInfoButton)?i.showProductInfoButton(i.product):i.showProductInfoButton)&&tc(i.product)),u=t.computed(()=>{var h;return i.showProductAddToCartButton||i.showProductEditButton||i.showProductRequiredButton||(((h=i.productContextButtonsConfig)==null?void 0:h.length)??0)>0}),f=()=>{var h;c.value&&((h=i.eventEmitter)==null||h.emit("product:name-click",{product:i.product,exposedMethods:{showProductImagesPreview:l}}))};return e({showProductImagesPreview:l}),(h,p)=>{var k,$,v,E;const m=ag,g=I.NTooltip,b=sc,y=rg,_=lc,x=I.NText,w=ac,C=ho,N=I.NScrollbar;return t.openBlock(),t.createElementBlock("div",null,[t.createElementVNode("div",Ag,[t.createVNode(x,{type:"info",class:"sc-product-name text-balance text-base font-medium text-black"},{default:t.withCtx(()=>{var P,F,R,M;return[(P=n.product)!=null&&P.isFavorite||(F=n.product)!=null&&F.isPreviouslyOrdered||n.showAdditionalSaleIcon?(t.openBlock(),t.createElementBlock("div",Og,[((R=n.product)==null?void 0:R.isFavorite)??!1?(t.openBlock(),t.createBlock(g,{key:0,placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>[t.createVNode(m,{class:"!text-yellow-300"})]),default:t.withCtx(()=>[p[0]||(p[0]=t.createTextVNode(" Избранный товар ",-1))]),_:1})):t.createCommentVNode("",!0),((M=n.product)==null?void 0:M.isPreviouslyOrdered)??!1?(t.openBlock(),t.createBlock(g,{key:1,placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>[t.createVNode(b,{class:"!text-green-700"})]),default:t.withCtx(()=>[p[1]||(p[1]=t.createTextVNode(" Ранее заказанный товар ",-1))]),_:1})):t.createCommentVNode("",!0),n.showAdditionalSaleIcon?(t.openBlock(),t.createBlock(g,{key:2,placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>[t.createVNode(y,{class:"!text-green-500"})]),default:t.withCtx(()=>[p[2]||(p[2]=t.createTextVNode(" Дополнительная продажа ",-1))]),_:1})):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),t.createElementVNode("span",{class:t.normalizeClass({"cursor-pointer":c.value&&n.eventEmitter,"text-gray-400 line-through":n.product.isHidden}),onClick:f},t.toDisplayString(n.product.name),3),n.product.onOrder?(t.openBlock(),t.createElementBlock("span",zg," [Под заказ] ")):t.createCommentVNode("",!0),t.createElementVNode("span",Dg,[n.product.images&&n.product.images.length>0?(t.openBlock(),t.createBlock(dc,{key:0,ref:"image-gallery",images:n.product.images},{default:t.withCtx(()=>[t.createElementVNode("div",Lg,[t.createVNode(_)])]),_:1},8,["images"])):t.createCommentVNode("",!0)]),d.value?(t.openBlock(),t.createElementBlock("span",Hg,[t.createVNode(fc,{product:n.product},null,8,["product"])])):t.createCommentVNode("",!0)]}),_:1}),u.value?(t.openBlock(),t.createBlock(w,{key:0,product:n.product,"event-emitter":n.eventEmitter,"show-product-add-to-cart-button":n.showProductAddToCartButton,"show-product-edit-button":n.showProductEditButton,"show-product-required-button":n.showProductRequiredButton,"product-context-buttons-config":n.productContextButtonsConfig},null,8,["product","event-emitter","show-product-add-to-cart-button","show-product-edit-button","show-product-required-button","product-context-buttons-config"])):t.createCommentVNode("",!0)]),t.createElementVNode("div",Wg,[t.createElementVNode("div",jg,[n.product.supplierSku?(t.openBlock(),t.createElementBlock("div",qg,[p[3]||(p[3]=t.createTextVNode(" Артикул производителя/поставщика: ",-1)),t.createElementVNode("span",Xg,t.toDisplayString(n.product.supplierSku),1)])):t.createCommentVNode("",!0),n.showCode?(t.openBlock(),t.createElementBlock("span",Yg,[p[4]||(p[4]=t.createTextVNode(" Артикул: ",-1)),t.createElementVNode("span",Ug,t.toDisplayString(n.product.code),1)])):t.createCommentVNode("",!0),n.product.stockCount&&n.product.stockCount.length>0?(t.openBlock(),t.createBlock(xg,{key:2,product:n.product},{default:t.withCtx(()=>[t.createElementVNode("span",Kg,[p[5]||(p[5]=t.createElementVNode("span",{class:"underline decoration-dashed"},"В наличии",-1)),t.createVNode(C,{class:"mt-0.5"})])]),_:1},8,["product"])):(t.openBlock(),t.createElementBlock("span",Gg," Нет в наличии ")),n.product.pack??(($=(k=n.product)==null?void 0:k.properties)==null?void 0:$.pack)?(t.openBlock(),t.createElementBlock("span",Zg,[p[6]||(p[6]=t.createTextVNode(" Норма упаковки: ",-1)),t.createElementVNode("span",Qg,t.toDisplayString(n.product.pack??((E=(v=n.product)==null?void 0:v.properties)==null?void 0:E.pack)),1)])):t.createCommentVNode("",!0),n.showPlanningDates&&s.value?(t.openBlock(),t.createElementBlock("span",Jg,[p[7]||(p[7]=t.createTextVNode(" Планируемая дата поступления на основной склад: ",-1)),t.createElementVNode("span",ey,t.toDisplayString(s.value),1)])):t.createCommentVNode("",!0)])]),t.createVNode(N,{"x-scrollable":""},{default:t.withCtx(()=>[r.value?(t.openBlock(),t.createElementBlock("div",ty,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.value,P=>(t.openBlock(),t.createBlock(ci,{key:P.coefficient.slug,product:n.product,"cost-field-name":P.coefficient.slug??"","event-emitter":n.eventEmitter,"allow-price-click":n.allowPriceClick,"show-tag":!0,"show-price-history":n.showPriceHistory,"currency-rates":n.currencyRates},null,8,["product","cost-field-name","event-emitter","allow-price-click","show-price-history","currency-rates"]))),128)),t.createVNode(ci,{product:n.product,"event-emitter":n.eventEmitter,"allow-price-click":n.allowPriceClick,"show-tag":!0,"show-quantity-unit":!0,"show-cost-date":n.showCostDate,"show-price-history":n.showPriceHistory,"currency-rates":n.currencyRates,"cost-field-name":"cost","additional-through-field-name":"retailCost",style:{"background-color":"var(--n-merged-td-color)"},class:"sticky right-0 border-0 border-l-2 border-solid border-gray-300 pl-2"},null,8,["product","event-emitter","allow-price-click","show-cost-date","show-price-history","currency-rates"])])):t.createCommentVNode("",!0)]),_:1}),n.showSlugs||n.showProperties?(t.openBlock(),t.createElementBlock("div",ny,[t.createElementVNode("ul",iy,[n.showSlugs?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList({id:n.product.id,slug:n.product.slug},(P,F)=>(t.openBlock(),t.createElementBlock("li",{key:F}," ("+t.toDisplayString(F)+"): "+t.toDisplayString(P),1))),128)):t.createCommentVNode("",!0),n.showProperties?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:1},t.renderList(n.product.properties,(P,F)=>(t.openBlock(),t.createElementBlock("li",{key:F}," ("+t.toDisplayString(F)+"): "+t.toDisplayString(P),1))),128)):t.createCommentVNode("",!0)])])):t.createCommentVNode("",!0)])}}}),oy=(n,e,i)=>({key:n,title:e,className:"align-top",resizable:!0,render:r=>t.h(ci,{product:r,costFieldName:n,eventEmitter:i.eventEmitter,allowPriceClick:i.allowPriceClick,currencyRates:i.currencyRates})}),sy=(n,e)=>{if(n.length===0)return[];const i=[],r={};switch(V.isNil(e.isProductItemSelected)||i.push({key:"checkbox",title:"",className:"align-top",width:"32",render:o=>{var s,a;return t.h(I.NCheckbox,{checked:!!((s=e.isProductItemSelected)!=null&&s.call(e,o)),disabled:((a=e.isProductItemSelected)==null?void 0:a.call(e,o))==="disabled",onUpdateChecked:l=>{e.eventEmitter.emit("product:checked",{product:o,checked:l})}})}}),Ue.getDeviceTypeByResolution()){case Xe.phone:case Xe.tablet:i.push({key:"name",title:"Наименование",className:"align-top",render:o=>t.h(go,{product:o,eventEmitter:e.eventEmitter,showSlugs:e.showSlugs,showProperties:e.showProperties,showProductCosts:e.showProductCosts,allowNameClick:e.allowNameClick,allowPriceClick:e.allowPriceClick,showPriceHistory:e.showPriceHistory,showCostDate:e.showCostDate,showProductInfoButton:e.showProductInfoButton,showProductAddToCartButton:e.showProductAddToCartButton,showProductEditButton:e.showProductEditButton,showProductRequiredButton:e.showProductRequiredButton,currencyRates:e.currencyRates,productContextButtonsConfig:e.productContextButtonsConfig})});break;default:i.push({key:"name",title:"Наименование",className:"align-top",resizable:!0,render:o=>t.h(go,{product:o,eventEmitter:e.eventEmitter,showSlugs:e.showSlugs,showProperties:e.showProperties,allowNameClick:e.allowNameClick,allowPriceClick:e.allowPriceClick,showPriceHistory:e.showPriceHistory,showCostDate:e.showCostDate,showProductInfoButton:e.showProductInfoButton,currencyRates:e.currencyRates})}),e.showProductCosts&&(V.forEach(n,o=>{V.forEach(o.priceCoefficients,s=>{r[s.coefficient.slug??""]||(r[s.coefficient.slug??""]=s.coefficient)})}),V.forEach(V.sortBy(r,["slug"]),o=>{i.push(oy(o.slug??"",o.name,e))}),i.push({key:"cost",title:"Цена",className:"align-top",resizable:!0,render:o=>t.h(ci,{product:o,costFieldName:"cost",additionalThroughFieldName:"retailCost",eventEmitter:e.eventEmitter,allowPriceClick:e.allowPriceClick,showQuantityUnit:!0,showPriceHistory:e.showPriceHistory,showCostDate:e.showCostDate,currencyRates:e.currencyRates})})),(e.showProductEditButton||e.showProductRequiredButton||e.showProductAddToCartButton||!V.isNil(e.productContextButtonsConfig))&&i.push({key:"actions",title:"",className:"align-top",width:"50",render:o=>t.h(ac,{product:o,eventEmitter:e.eventEmitter,showProductAddToCartButton:e.showProductAddToCartButton,showProductEditButton:e.showProductEditButton,showProductRequiredButton:e.showProductRequiredButton,productContextButtonsConfig:e.productContextButtonsConfig})});break}return i},ay={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function ly(n,e){return t.openBlock(),t.createElementBlock("svg",ay,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",d:"M296 64h-80a7.91 7.91 0 0 0-8 8v24h96V72a7.91 7.91 0 0 0-8-8"},null,-1),t.createElementVNode("path",{fill:"currentColor",d:"M432 96h-96V72a40 40 0 0 0-40-40h-80a40 40 0 0 0-40 40v24H80a16 16 0 0 0 0 32h17l19 304.92c1.42 26.85 22 47.08 48 47.08h184c26.13 0 46.3-19.78 48-47l19-305h17a16 16 0 0 0 0-32M192.57 416H192a16 16 0 0 1-16-15.43l-8-224a16 16 0 1 1 32-1.14l8 224A16 16 0 0 1 192.57 416M272 400a16 16 0 0 1-32 0V176a16 16 0 0 1 32 0Zm32-304h-96V72a7.91 7.91 0 0 1 8-8h80a7.91 7.91 0 0 1 8 8Zm32 304.57A16 16 0 0 1 320 416h-.58A16 16 0 0 1 304 399.43l8-224a16 16 0 1 1 32 1.14Z"},null,-1)])])}const yo=t.markRaw({name:"ion-trash",render:ly}),cy={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function dy(n,e){return t.openBlock(),t.createElementBlock("svg",cy,[...e[0]||(e[0]=[t.createElementVNode("path",{d:"M448 224H288V64h-64v160H64v64h160v160h64V288h160z",fill:"currentColor"},null,-1)])])}const hc=t.markRaw({name:"ion-plus",render:dy}),uy={key:0,class:"flex w-fit items-center gap-2"},fy={key:1,class:"flex flex-wrap gap-1"},hy={key:0},my={key:2},py={},Fr=t.defineComponent({...py,__name:"configurators-product-info",props:{isProductSearching:{type:Boolean,default:!1},product:{default:void 0},validation:{default:void 0}},setup(n){const e=n,i=t.computed(()=>{var r,o;return(o=(r=e.product)==null?void 0:r.properties)==null?void 0:o.planingProductionDate});return(r,o)=>{const s=I.NSpin,a=I.NText;return n.isProductSearching?(t.openBlock(),t.createElementBlock("div",uy,[t.createVNode(s,{size:17,class:"w-fit"}),o[0]||(o[0]=t.createElementVNode("div",null,"Выполняется поиск товара ...",-1))])):n.product&&!n.product.isNewRec()?(t.openBlock(),t.createElementBlock("div",fy,[t.createElementVNode("div",null,t.toDisplayString(n.product.code)+" - "+t.toDisplayString(n.product.name)+" - "+t.toDisplayString(t.unref(Ve).formatMoney(n.product.costRub))+" ₽ / "+t.toDisplayString(n.product.unit.name),1),i.value?(t.openBlock(),t.createElementBlock("div",hy,"(Планируемая дата производства: "+t.toDisplayString(i.value)+")",1)):t.createCommentVNode("",!0)])):n.validation?(t.openBlock(),t.createElementBlock("div",my,[t.createVNode(a,{type:n.validation.validationStatus},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(n.validation.feedback),1)]),_:1},8,["type"])])):t.createCommentVNode("",!0)}}}),gy={class:"flex flex-col gap-4"},yy={class:"flex flex-col gap-2"},by={class:"mt-8 font-bold"},_y={class:"grid grow grid-cols-2 items-start gap-2"},wy={key:2,class:"text-red-500 text-sm"},xy={key:3,class:"text-red-500 text-sm mb-2"},ky={class:"flex flex-col gap-4"},Cy={key:1},vy={class:"text-lg font-semibold"},Sy={class:"flex gap-3"},By={},Ny=t.defineComponent({...By,__name:"kozyrek-configurator-params-form",props:{value:{},settings:{},previewParams:{},isProductSearching:{type:Boolean,default:!1},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0},selectTemplateIndex:{}},emits:["update:value","update:params","submit","click:add-line","click:remove-line","click:save-template"],setup(n,{expose:e,emit:i}){var b;const r=n,o=i,s=t.useTemplateRef("form-reference"),a=t.ref(!1),l=t.ref(V.cloneDeep(r.value)),c=t.computed(()=>{var _,x,w;const y={"configuratorParams.length":[ce.required,ce.min(r.settings.stripMinLength),ce.max(r.settings.stripMaxLength||Number.MAX_VALUE),ce.step(r.settings.lengthStep),We.serverValidation((_=r.validation.length)==null?void 0:_.feedback)],quantity:[ce.required,ce.min(1),ce.step(1),We.serverValidation((x=r.validation.quantity)==null?void 0:x.feedback)],marker:[We.serverValidation((w=r.validation.marker)==null?void 0:w.feedback)]};return V.forEach(l.value.configuratorParams.linesWidths,(C,N)=>{var v;const $=l.value.configuratorParams.linesWidths.length>1?r.settings.minLineWidth:r.settings.stripMinWidth;y[`configuratorParams.linesWidths.${N}`]=[ce.required,ce.min($),ce.max(r.settings.maxLineWidth),ce.step(r.settings.lineWidthStep),We.serverValidation((v=r.validation[`lines_widths[${N+1}]`])==null?void 0:v.feedback)]}),V.forEach(l.value.configuratorParams.linesAngles,(C,N)=>{var k;y[`configuratorParams.linesAngles.${N}`]=[ce.required,ce.min(r.settings.minLineAngle),ce.max(r.settings.maxLineAngle),ce.step(r.settings.lineAngleStep),We.serverValidation((k=r.validation[`lines_angles[${N+1}]`])==null?void 0:k.feedback)]}),y}),d=t.ref(r.settings.canSetDopProdaga??!1),u=t.computed(()=>{var C;const{length:y}=l.value.configuratorParams,{quantity:_}=l.value,x=((C=l.value.product)==null?void 0:C.costRub)||0;if(!y||!_||x===0)return null;const w=y/1e3;return Ve.formatMoney(x*_*w)}),f=t.computed(()=>V.reduce(l.value.configuratorParams.linesWidths,(y,_)=>y+(_||0),0)),h=t.computed(()=>{const y=f.value;return y>=r.settings.stripMinWidth&&y<=r.settings.stripMaxWidth}),p=t.computed(()=>{const{configuratorParams:y}=l.value,_=V.every(y.linesWidths,N=>!!(N&&N>0)),x=V.every(y.linesAngles,N=>!V.isNil(N)),w=!!(l.value.quantity&&l.value.quantity>0),C=y.length>0&&y.length>0;return _&&x&&w&&C&&h.value}),m=()=>{t.nextTick(()=>{var y;(y=s.value)==null||y.validate(_=>{_||(o("update:params",l.value.configuratorParams),g("configuratorParams",l.value.configuratorParams))}).catch(V.noop)})},g=(y,_)=>{const x=new W.OrderItemBase(l.value);x[y]=_,y==="configuratorParams"&&(x.product=new W.ClientProduct),o("update:value",x)};return t.watch(()=>r.previewParams,y=>{l.value.configuratorParams.linesWidths=y.linesWidths,l.value.configuratorParams.linesAngles=y.linesAngles},{deep:!0}),t.watch(()=>r.value,y=>{l.value=V.cloneDeep(y)},{deep:!0}),e({validate:(b=s.value)==null?void 0:b.validate,formReference:s}),(y,_)=>{const x=hc,w=yo,C=I.NCheckbox;return t.withDirectives((t.openBlock(),t.createBlock(t.unref(I.NForm),{ref:"form-reference",model:l.value,rules:c.value,class:"flex flex-col gap-4 sc-hide-empty-feedback-message"},{default:t.withCtx(()=>{var N;return[t.createElementVNode("div",gy,[_[21]||(_[21]=t.createElementVNode("span",{class:"w-full font-bold"},"Ширина участка, мм / Угол сгиба, ° (А)",-1)),n.settings.startTailConfigs&&n.settings.startTailConfigs.length>0?(t.openBlock(),t.createBlock(t.unref(I.NFormItem),{key:0,required:!0,"show-feedback":!1,label:"Тип стартового капельника"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NSelect),{value:l.value.configuratorParams.startTailType,"onUpdate:value":[_[0]||(_[0]=k=>l.value.configuratorParams.startTailType=k),m],options:n.settings.startTailConfigs.map(({label:k},$)=>({label:k,value:$})),placeholder:"Тип стартового капельника"},null,8,["value","options"])]),_:1})):t.createCommentVNode("",!0),t.createElementVNode("div",yy,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.value.configuratorParams.linesAngles,(k,$)=>(t.openBlock(),t.createElementBlock("div",{key:$,class:"flex items-start gap-2"},[t.createElementVNode("div",by,t.toDisplayString($+1),1),t.createElementVNode("div",_y,[t.createVNode(t.unref(I.NFormItem),{path:`configuratorParams.linesWidths.${$}`,label:"Ширина, мм"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:l.value.configuratorParams.linesWidths[$],"onUpdate:value":[v=>l.value.configuratorParams.linesWidths[$]=v,_[2]||(_[2]=v=>m())],parse:t.unref(ht),"show-button":!1,class:"w-full",onKeydown:_[1]||(_[1]=v=>t.unref(ft)(v)),onInput:v=>t.unref(dt)(n.validation,`lines_widths[${$+1}]`),onFocus:t.unref(He)},null,8,["value","onUpdate:value","parse","onInput","onFocus"])]),_:2},1032,["path"]),t.createVNode(t.unref(I.NFormItem),{path:`configuratorParams.linesAngles.${$}`,label:"Угол сгиба, °"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:l.value.configuratorParams.linesAngles[$],"onUpdate:value":[v=>l.value.configuratorParams.linesAngles[$]=v,_[4]||(_[4]=v=>m())],parse:t.unref(ht),"show-button":!1,class:"w-full",onKeydown:_[3]||(_[3]=v=>t.unref(ft)(v,!0)),onInput:v=>t.unref(dt)(n.validation,`lines_angles[${$+1}]`),onFocus:t.unref(He)},null,8,["value","onUpdate:value","parse","onInput","onFocus"])]),_:2},1032,["path"])]),t.createVNode(t.unref(I.NFormItem),{label:void 0,"show-feedback":!1,required:!0,class:"shrink-0"},{default:t.withCtx(()=>[n.settings.showOnlyTemplates?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(t.unref(I.NButton),{key:0,size:"medium",onClick:v=>o("click:add-line",$)},{default:t.withCtx(()=>[t.createVNode(x)]),_:1},8,["onClick"])),n.settings.showOnlyTemplates?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(t.unref(I.NButton),{key:1,disabled:l.value.configuratorParams.linesWidths.length===1,size:"medium",class:"ml-2",onClick:v=>o("click:remove-line",$)},{default:t.withCtx(()=>[t.createVNode(w)]),_:1},8,["disabled","onClick"]))]),_:2},1024)]))),128))]),n.settings.endTailConfigs&&n.settings.endTailConfigs.length>0?(t.openBlock(),t.createBlock(t.unref(I.NFormItem),{key:1,label:"Тип конечного капельника","show-feedback":!1,required:!0},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NSelect),{value:l.value.configuratorParams.endTailType,"onUpdate:value":[_[5]||(_[5]=k=>l.value.configuratorParams.endTailType=k),m],options:n.settings.endTailConfigs.map(({label:k},$)=>({label:k,value:$})),placeholder:"Тип конечного капельника"},null,8,["value","options"])]),_:1})):t.createCommentVNode("",!0),t.createVNode(Fr,{"is-product-searching":n.isProductSearching,product:l.value.product,validation:n.validation.product},null,8,["is-product-searching","product","validation"]),h.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",wy," Суммарная ширина участков гиба должна быть от "+t.toDisplayString(n.settings.stripMinWidth)+" до "+t.toDisplayString(n.settings.stripMaxWidth)+" мм., текущая ширина: "+t.toDisplayString(f.value)+" мм. ",1)),p.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",xy," Пожалуйста, заполните все обязательные поля корректно. ")),n.settings.allowSaveTemplates&&n.selectTemplateIndex===((N=n.settings.allTemplates)==null?void 0:N.length)-1?(t.openBlock(),t.createBlock(t.unref(I.NButton),{key:4,type:"tertiary",class:"self-start",loading:a.value,onClick:_[6]||(_[6]=k=>o("click:save-template"))},{default:t.withCtx(()=>[..._[20]||(_[20]=[t.createTextVNode(" Сохранить шаблон ",-1)])]),_:1},8,["loading"])):t.createCommentVNode("",!0)]),t.createElementVNode("div",ky,[t.createVNode(t.unref(I.NFormItem),{label:"С какой стороны изделие будет иметь цвет","show-feedback":!1},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NSelect),{value:l.value.configuratorParams.colorSide,"onUpdate:value":[_[7]||(_[7]=k=>l.value.configuratorParams.colorSide=k),m],options:[{label:"Цвет сверху",value:"top"},{label:" Цвет снизу",value:"bottom"}],placeholder:"С какой стороны изделие будет иметь цвет"},null,8,["value"])]),_:1}),t.createVNode(t.unref(I.NFormItem),{path:"configuratorParams.length",label:`Метраж${n.settings.stripMinLength?" от "+n.settings.stripMinLength:""}${n.settings.stripMaxLength?" до "+n.settings.stripMaxLength:""} мм`},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:l.value.configuratorParams.length,"onUpdate:value":[_[8]||(_[8]=k=>l.value.configuratorParams.length=k),_[11]||(_[11]=k=>m())],parse:t.unref(ht),"show-button":!1,placeholder:"Введите метраж",class:"w-full",onKeydown:_[9]||(_[9]=k=>t.unref(ft)(k)),onInput:_[10]||(_[10]=k=>t.unref(dt)(n.validation,"length")),onFocus:t.unref(He)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),t.createVNode(t.unref(I.NFormItem),{path:"quantity",label:"Количество"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:l.value.quantity,"onUpdate:value":[_[12]||(_[12]=k=>l.value.quantity=k),_[15]||(_[15]=k=>g("quantity",k??0))],"show-button":!1,placeholder:"Введите количество",class:"w-full",onKeydown:_[13]||(_[13]=k=>t.unref(ft)(k,!1)),onInput:_[14]||(_[14]=k=>t.unref(dt)(n.validation,"quantity")),onFocus:t.unref(He)},null,8,["value","onFocus"])]),_:1}),t.createVNode(t.unref(I.NFormItem),{path:"marker",label:"Маркировка"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInput),{value:l.value.marker??null,placeholder:"Введите маркировку",onInput:_[16]||(_[16]=k=>t.unref(dt)(n.validation,"marker")),"onUpdate:value":_[17]||(_[17]=k=>{l.value.marker=k??null,g("marker",k??null)}),onFocus:t.unref(He)},null,8,["value","onFocus"])]),_:1}),d.value?(t.openBlock(),t.createBlock(C,{key:0,checked:l.value.isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":_[18]||(_[18]=k=>{l.value.isAdditionalSale=k??!1,g("isAdditionalSale",k??!1)})},{default:t.withCtx(()=>[..._[22]||(_[22]=[t.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):t.createCommentVNode("",!0),u.value?(t.openBlock(),t.createElementBlock("div",Cy,[_[23]||(_[23]=t.createTextVNode(" ИТОГО: ",-1)),t.createElementVNode("span",vy,t.toDisplayString(u.value)+" ₽",1)])):t.createCommentVNode("",!0),t.createElementVNode("div",Sy,[t.createVNode(t.unref(I.NButton),{loading:n.isSubmitProcessing,disabled:!p.value||l.value.product.isNewRec(),type:"primary",class:"self-start",onClick:_[19]||(_[19]=k=>o("submit",l.value))},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(l.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["loading","disabled"])])])]}),_:1},8,["model","rules"])),[[t.unref(ai),()=>o("submit",l.value)]])}}}),mc=dn(Ny,[["__scopeId","data-v-e9c8af59"]]);var pc=Object.defineProperty,Ty=Object.defineProperties,$y=Object.getOwnPropertyDescriptors,gc=Object.getOwnPropertySymbols,Ey=Object.prototype.hasOwnProperty,Ry=Object.prototype.propertyIsEnumerable,yc=n=>{throw TypeError(n)},Ds=(n,e,i)=>e in n?pc(n,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[e]=i,Vr=(n,e)=>{for(var i in e||(e={}))Ey.call(e,i)&&Ds(n,i,e[i]);if(gc)for(var i of gc(e))Ry.call(e,i)&&Ds(n,i,e[i]);return n},Ls=(n,e)=>Ty(n,$y(e)),bc=(n,e)=>{for(var i in e)pc(n,i,{get:e[i],enumerable:!0})},S=(n,e,i)=>Ds(n,typeof e!="symbol"?e+"":e,i),_c=(n,e,i)=>e.has(n)||yc("Cannot "+i),Xt=(n,e,i)=>(_c(n,e,"read from private field"),i?i.call(n):e.get(n)),wc=(n,e,i)=>e.has(n)?yc("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,i),Py=(n,e,i,r)=>(_c(n,e,"write to private field"),e.set(n,i),i),At={Image:null,isHeadless:!1,shim:function(n,e){return n.tagName=n.nodeName=e||"canvas",n.nodeType=1,n.getAttribute=function(i){return this[i]},n.setAttribute=function(i,r){return this[i]=r,this},n},polyfill:function(n,e){return At.shim(n),typeof e<"u"&&(At.Image=e),At.isHeadless=!0,n}},xc={};bc(xc,{Curve:()=>rr,getAnchorsFromArcData:()=>My,getComponentOnCubicBezier:()=>Mr,getControlPoints:()=>Pc,getCurveBoundingBox:()=>$c,getCurveFromPoints:()=>Rc,getCurveLength:()=>Tc,getReflection:()=>qs,integrate:()=>Ec,subdivide:()=>js});var kc={};bc(kc,{HALF_PI:()=>mt,NumArray:()=>Bn,TWO_PI:()=>ot,decomposeMatrix:()=>Si,getComputedMatrix:()=>Hs,getEffectiveStrokeWidth:()=>Nn,getPoT:()=>Sc,lerp:()=>Ot,mod:()=>ut,setMatrix:()=>vc,toFixed:()=>ze});var Je;typeof window<"u"?Je=window:typeof global<"u"?Je=global:typeof self<"u"&&(Je=self);var Cc,ot=Math.PI*2,mt=Math.PI*.5;function Si(n,e,i,r,o,s){let a;return arguments.length<=1?(a=n.a,e=n.b,i=n.c,r=n.d,o=n.e,s=n.f):a=n,{translateX:o,translateY:s,scaleX:Math.sqrt(a*a+e*e),scaleY:Math.sqrt(i*i+r*r),rotation:180*Math.atan2(e,a)/Math.PI}}function vc(n){Cc=n}function Hs(n,e){e=e&&e.identity()||new Cc;let i=n;const r=[];for(;i&&i._matrix;)r.push(i._matrix),i=i.parent;r.reverse();for(let o=0;o<r.length;o++){const a=r[o].elements;e.multiply(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8])}return e}function Ot(n,e,i){return i*(e-n)+n}var Ws=[2,4,8,16,32,64,128,256,512,1024,2048,4096];function Sc(n){let e=0;for(;Ws[e]&&Ws[e]<n;)e++;return Ws[e]}function ut(n,e){for(;n<0;)n+=e;return n%e}var Bn=Je.Float32Array||Array,Fy=Math.floor;function ze(n){return Fy(n*1e6)/1e6}function Nn(n,e){const i=n._linewidth;if(n.strokeAttenuation)return i;e||(e=n.worldMatrix||Hs(n));const r=Si(e.elements[0],e.elements[3],e.elements[1],e.elements[4],e.elements[2],e.elements[5]),o=Math.max(Math.abs(r.scaleX),Math.abs(r.scaleY));return o>0?i/o:i}var ne={move:"M",line:"L",curve:"C",arc:"A",close:"Z"},ee=class{constructor(){S(this,"_events",{}),S(this,"_bound",!1)}addEventListener(e,i){return(this._events[e]||(this._events[e]=[])).push(i),this._bound=!0,this}on(){return this.addEventListener.apply(this,arguments)}bind(){return this.addEventListener.apply(this,arguments)}removeEventListener(e,i){if(!this._events)return this;if(!e&&!i)return this._events={},this._bound=!1,this;const r=e?[e]:Object.keys(this._events);for(let o=0,s=r.length;o<s;o++){e=r[o];let a=this._events[e];if(a){let l=[];if(i)for(let c=0,d=a.length;c<d;c++){let u=a[c];u=u.handler?u.handler:u,i!==u&&l.push(u)}this._events[e]=l}}return this}off(){return this.removeEventListener.apply(this,arguments)}unbind(){return this.removeEventListener.apply(this,arguments)}dispatchEvent(e){if(!this._events)return this;const i=Array.prototype.slice.call(arguments,1),r=this._events[e];if(r)for(let o=0;o<r.length;o++)r[o].call(this,...i);return this}trigger(){return this.dispatchEvent.apply(this,arguments)}listen(e,i,r){const o=this;e&&(s.obj=e,s.name=i,s.handler=r,e.on(i,s));function s(){r.apply(o,arguments)}return o}ignore(e,i,r){return e.off(i,r),this}};S(ee,"Types",{play:"play",pause:"pause",update:"update",render:"render",resize:"resize",change:"change",remove:"remove",insert:"insert",order:"order",load:"load"}),S(ee,"Methods",["addEventListener","on","removeEventListener","off","unbind","dispatchEvent","trigger","listen","ignore"]);var Bc={x:{enumerable:!0,get:function(){return this._x},set:function(n){this._x!==n&&(this._x=n,this._bound&&this.dispatchEvent(ee.Types.change))}},y:{enumerable:!0,get:function(){return this._y},set:function(n){this._y!==n&&(this._y=n,this._bound&&this.dispatchEvent(ee.Types.change))}}},yn=class vr extends ee{constructor(e=0,i=0){super(),S(this,"_x",0),S(this,"_y",0);for(let r in Bc)Object.defineProperty(this,r,Bc[r]);this.x=e,this.y=i}static add(e,i){return new vr(e.x+i.x,e.y+i.y)}static sub(e,i){return new vr(e.x-i.x,e.y-i.y)}static subtract(e,i){return vr.sub(e,i)}static ratioBetween(e,i){return(e.x*i.x+e.y*i.y)/(e.length()*i.length())}static angleBetween(e,i){if(arguments.length>=4){const s=arguments[0]-arguments[2],a=arguments[1]-arguments[3];return Math.atan2(a,s)}const r=e.x-i.x,o=e.y-i.y;return Math.atan2(o,r)}static distanceBetween(e,i){return Math.sqrt(vr.distanceBetweenSquared(e,i))}static distanceBetweenSquared(e,i){const r=e.x-i.x,o=e.y-i.y;return r*r+o*o}set(e,i){return this.x=e,this.y=i,this}copy(e){return this.x=e.x,this.y=e.y,this}clear(){return this.x=0,this.y=0,this}clone(){return new vr(this.x,this.y)}add(e,i){return arguments.length<=0?this:(arguments.length<=1?typeof e=="number"?(this.x+=e,this.y+=e):e&&typeof e.x=="number"&&typeof e.y=="number"&&(this.x+=e.x,this.y+=e.y):(this.x+=e,this.y+=i),this)}addSelf(e){return this.add.apply(this,arguments)}sub(e,i){return arguments.length<=0?this:(arguments.length<=1?typeof e=="number"?(this.x-=e,this.y-=e):e&&typeof e.x=="number"&&typeof e.y=="number"&&(this.x-=e.x,this.y-=e.y):(this.x-=e,this.y-=i),this)}subtract(){return this.sub.apply(this,arguments)}subSelf(e){return this.sub.apply(this,arguments)}subtractSelf(e){return this.sub.apply(this,arguments)}multiply(e,i){return arguments.length<=0?this:(arguments.length<=1?typeof e=="number"?(this.x*=e,this.y*=e):e&&typeof e.x=="number"&&typeof e.y=="number"&&(this.x*=e.x,this.y*=e.y):(this.x*=e,this.y*=i),this)}multiplySelf(e){return this.multiply.apply(this,arguments)}multiplyScalar(e){return this.multiply(e)}divide(e,i){return arguments.length<=0?this:(arguments.length<=1?typeof e=="number"?(this.x/=e,this.y/=e):e&&typeof e.x=="number"&&typeof e.y=="number"&&(this.x/=e.x,this.y/=e.y):(this.x/=e,this.y/=i),isNaN(this.x)&&(this.x=0),isNaN(this.y)&&(this.y=0),this)}divideSelf(e){return this.divide.apply(this,arguments)}divideScalar(e){return this.divide(e)}negate(){return this.multiply(-1)}dot(e){return this.x*e.x+this.y*e.y}length(){return Math.sqrt(this.lengthSquared())}lengthSquared(){return this.x*this.x+this.y*this.y}normalize(){return this.divideScalar(this.length())}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const i=this.x-e.x,r=this.y-e.y;return i*i+r*r}setLength(e){return this.normalize().multiplyScalar(e)}equals(e,i){return i=typeof i>"u"?1e-4:i,this.distanceTo(e)<i}lerp(e,i){const r=(e.x-this.x)*i+this.x,o=(e.y-this.y)*i+this.y;return this.set(r,o)}isZero(e){return e=typeof e>"u"?1e-4:e,this.length()<e}toString(){return this.x+", "+this.y}toObject(){return{x:ze(this.x),y:ze(this.y)}}rotate(e){const i=this.x,r=this.y,o=Math.cos(e),s=Math.sin(e);return this.x=i*o-r*s,this.y=i*s+r*o,this}};S(yn,"zero",new yn),S(yn,"left",new yn(-1,0)),S(yn,"right",new yn(1,0)),S(yn,"up",new yn(0,-1)),S(yn,"down",new yn(0,1));var ie=yn,Ee=class Bs extends ie{constructor(e=0,i=0,r=0,o=0,s=0,a=0,l=ne.move){super(e,i),S(this,"controls",{left:new ie,right:new ie}),S(this,"_command",ne.move),S(this,"_relative",!0),S(this,"_rx",0),S(this,"_ry",0),S(this,"_xAxisRotation",0),S(this,"_largeArcFlag",0),S(this,"_sweepFlag",1);for(let d in Nc)Object.defineProperty(this,d,Nc[d]);this.command=l,this.relative=!0;const c=Bs.makeBroadcast(this);this.controls.left.set(r,o).addEventListener(ee.Types.change,c),this.controls.right.set(s,a).addEventListener(ee.Types.change,c)}static makeBroadcast(e){return i;function i(){e._bound&&e.dispatchEvent(ee.Types.change)}}static fromObject(e){return new Bs().copy(e)}copy(e){return this.x=e.x,this.y=e.y,typeof e.command=="string"&&(this.command=e.command),e.controls&&(e.controls.left&&this.controls.left.copy(e.controls.left),e.controls.right&&this.controls.right.copy(e.controls.right)),typeof e.relative=="boolean"&&(this.relative=e.relative),typeof e.rx=="number"&&(this.rx=e.rx),typeof e.ry=="number"&&(this.ry=e.ry),typeof e.xAxisRotation=="number"&&(this.xAxisRotation=e.xAxisRotation),typeof e.largeArcFlag=="number"&&(this.largeArcFlag=e.largeArcFlag),typeof e.sweepFlag=="number"&&(this.sweepFlag=e.sweepFlag),this}clone(){return new Bs().copy(this)}toObject(){return{x:ze(this.x),y:ze(this.y),command:this.command,relative:this.relative,controls:{left:this.controls.left.toObject(),right:this.controls.right.toObject()},rx:ze(this.rx),ry:ze(this.ry),xAxisRotation:ze(this.xAxisRotation),largeArcFlag:ze(this.largeArcFlag),sweepFlag:ze(this.sweepFlag)}}toString(){return JSON.stringify(this.toObject())}},Nc={command:{enumerable:!0,get:function(){return this._command},set:function(n){this._command!==n&&(this._command=n,this._bound&&this.dispatchEvent(ee.Types.change))}},relative:{enumerable:!0,get:function(){return this._relative},set:function(n){this._relative!==!!n&&(this._relative=!!n,this._bound&&this.dispatchEvent(ee.Types.change))}},rx:{enumerable:!0,get:function(){return this._rx},set:function(n){this._rx!==n&&(this._rx=n,this._bound&&this.dispatchEvent(ee.Types.change))}},ry:{enumerable:!0,get:function(){return this._ry},set:function(n){this._ry!==n&&(this._ry=n,this._bound&&this.dispatchEvent(ee.Types.change))}},xAxisRotation:{enumerable:!0,get:function(){return this._xAxisRotation},set:function(n){this._xAxisRotation!==n&&(this._xAxisRotation=n,this._bound&&this.dispatchEvent(ee.Types.change))}},largeArcFlag:{enumerable:!0,get:function(){return this._largeArcFlag},set:function(n){this._largeArcFlag!==n&&(this._largeArcFlag=n,this._bound&&this.dispatchEvent(ee.Types.change))}},sweepFlag:{get:function(){return this._sweepFlag},set:function(n){this._sweepFlag!==n&&(this._sweepFlag=n,this._bound&&this.dispatchEvent(ee.Types.change))}}},Vy=0,Bt={NextFrameId:null,Types:{webgl:"WebGLRenderer",svg:"SVGRenderer",canvas:"CanvasRenderer"},Version:"v0.8.23",PublishDate:"2025-12-22T19:59:24.486Z",Identifier:"two-",Resolution:12,AutoCalculateImportedMatrices:!0,Instances:[],uniqueId:function(){return Vy++}},rr={CollinearityEpsilon:Math.pow(10,-30),RecursionLimit:16,CuspLimit:0,Tolerance:{distance:.25,angle:0,epsilon:Number.EPSILON},abscissas:[[.5773502691896],[0,.7745966692415],[.3399810435849,.8611363115941],[0,.5384693101057,.9061798459387],[.2386191860832,.6612093864663,.9324695142032],[0,.4058451513774,.7415311855994,.9491079123428],[.1834346424956,.5255324099163,.7966664774136,.9602898564975],[0,.3242534234038,.6133714327006,.8360311073266,.9681602395076],[.1488743389816,.4333953941292,.679409568299,.865063366689,.9739065285172],[0,.2695431559523,.5190961292068,.730152005574,.8870625997681,.9782286581461],[.1252334085115,.3678314989982,.5873179542866,.7699026741943,.9041172563705,.9815606342467],[0,.2304583159551,.4484927510364,.6423493394403,.8015780907333,.917598399223,.9841830547186],[.1080549487073,.3191123689279,.5152486363582,.6872929048117,.8272013150698,.9284348836636,.9862838086968],[0,.2011940939974,.3941513470776,.5709721726085,.7244177313602,.8482065834104,.9372733924007,.9879925180205],[.0950125098376,.2816035507793,.4580167776572,.6178762444026,.755404408355,.8656312023878,.9445750230732,.9894009349916]],weights:[[1],[.8888888888889,.5555555555556],[.6521451548625,.3478548451375],[.5688888888889,.4786286704994,.2369268850562],[.4679139345727,.3607615730481,.1713244923792],[.4179591836735,.3818300505051,.2797053914893,.1294849661689],[.3626837833784,.3137066458779,.2223810344534,.1012285362904],[.3302393550013,.31234707704,.2606106964029,.1806481606949,.0812743883616],[.2955242247148,.26926671931,.219086362516,.1494513491506,.0666713443087],[.2729250867779,.2628045445102,.233193764592,.1862902109277,.1255803694649,.0556685671162],[.2491470458134,.2334925365384,.2031674267231,.1600783285433,.1069393259953,.0471753363865],[.2325515532309,.2262831802629,.2078160475369,.1781459807619,.1388735102198,.0921214998377,.0404840047653],[.2152638534632,.2051984637213,.1855383974779,.1572031671582,.1215185706879,.0801580871598,.0351194603318],[.2025782419256,.1984314853271,.1861610000156,.166269205817,.1395706779262,.1071592204672,.0703660474881,.0307532419961],[.1894506104551,.1826034150449,.169156519395,.1495959888166,.1246289712555,.0951585116825,.0622535239386,.0271524594118]]};function Mr(n,e,i,r,o){const s=1-n;return s*s*s*e+3*s*s*n*i+3*s*n*n*r+n*n*n*o}function js(n,e,i,r,o,s,a,l,c){c=c||rr.RecursionLimit;const d=c+1;if(Math.abs(n-a)<.001&&Math.abs(e-l)<.001)return[new Ee(a,l)];const u=[];for(let f=0;f<d;f++){const h=f/d,p=Mr(h,n,i,o,a),m=Mr(h,e,r,s,l);u.push(new Ee(p,m))}return u}function Tc(n,e,i,r,o,s,a,l,c){if(n===i&&e===r&&o===a&&s===l){const b=a-n,y=l-e;return Math.sqrt(b*b+y*y)}const d=9*(i-o)+3*(a-n),u=6*(n+o)-12*i,f=3*(i-n),h=9*(r-s)+3*(l-e),p=6*(e+s)-12*r,m=3*(r-e);function g(b){const y=(d*b+u)*b+f,_=(h*b+p)*b+m;return Math.sqrt(y*y+_*_)}return Ec(g,0,1,c||rr.RecursionLimit)}function $c(n,e,i,r,o,s,a,l){const c=[],d=[[],[]];let u,f,h,p,m,g,b,y;for(let C=0;C<2;++C){if(C===0?(f=6*n-12*i+6*o,u=-3*n+9*i-9*o+3*a,h=3*i-3*n):(f=6*e-12*r+6*s,u=-3*e+9*r-9*s+3*l,h=3*r-3*e),Math.abs(u)<.001){if(Math.abs(f)<.001)continue;p=-h/f,0<p&&p<1&&c.push(p);continue}b=f*f-4*h*u,y=Math.sqrt(b),!(b<0)&&(m=(-f+y)/(2*u),0<m&&m<1&&c.push(m),g=(-f-y)/(2*u),0<g&&g<1&&c.push(g))}let _=c.length,x=_,w;for(;_--;)p=c[_],w=1-p,d[0][_]=w*w*w*n+3*w*w*p*i+3*w*p*p*o+p*p*p*a,d[1][_]=w*w*w*e+3*w*w*p*r+3*w*p*p*s+p*p*p*l;return d[0][x]=n,d[1][x]=e,d[0][x+1]=a,d[1][x+1]=l,d[0].length=d[1].length=x+2,{min:{x:Math.min.apply(0,d[0]),y:Math.min.apply(0,d[1])},max:{x:Math.max.apply(0,d[0]),y:Math.max.apply(0,d[1])}}}function Ec(n,e,i,r){let o=rr.abscissas[r-2],s=rr.weights[r-2],a=.5*(i-e),l=a+e,c=0,d=r+1>>1,u=r&1?s[c++]*n(l):0;for(;c<d;){const f=a*o[c];u+=s[c++]*(n(l+f)+n(l-f))}return a*u}function Rc(n,e){const i=n.length,r=i-1;for(let o=0;o<i;o++){const s=n[o],a=e?ut(o-1,i):Math.max(o-1,0),l=e?ut(o+1,i):Math.min(o+1,r),c=n[a],d=s,u=n[l];Pc(c,d,u),d.command=o===0?ne.move:ne.curve}}function Pc(n,e,i){const r=ie.angleBetween(n,e),o=ie.angleBetween(i,e);let s=ie.distanceBetween(n,e),a=ie.distanceBetween(i,e),l=(r+o)/2;return s<.001||a<.001?(typeof e.relative=="boolean"&&!e.relative&&(e.controls.left.copy(e),e.controls.right.copy(e)),e):(s*=.33,a*=.33,o<r?l+=mt:l-=mt,e.controls.left.x=Math.cos(l)*s,e.controls.left.y=Math.sin(l)*s,l-=Math.PI,e.controls.right.x=Math.cos(l)*a,e.controls.right.y=Math.sin(l)*a,typeof e.relative=="boolean"&&!e.relative&&(e.controls.left.x+=e.x,e.controls.left.y+=e.y,e.controls.right.x+=e.x,e.controls.right.y+=e.y),e)}function qs(n,e,i){return new ie(2*n.x-(e.x+n.x)-(i?n.x:0),2*n.y-(e.y+n.y)-(i?n.y:0))}function My(n,e,i,r,o,s,a){const l=Bt.Resolution;for(let c=0;c<l;c++){let d=(c+1)/l;a&&(d=1-d);const u=d*s+o,f=i*Math.cos(u),h=r*Math.sin(u),p=new Ee(f,h);p.command=ne.line}}var Fc=Array.prototype.slice;function Iy(n){if(n==null)return!1;const e=n.length;return typeof e=="number"&&e>=0&&e<4294967296}var re={isNaN:function(n){return typeof n=="number"&&n!==+n},isElement:function(n){return!!(n&&n.nodeType===1)},isObject:function(n){const e=typeof n;return e==="function"||e==="object"&&!!n},isFunction:function(n){return typeof n=="function"},extend:function(n){const e=Fc.call(arguments,1);for(let i=0;i<e.length;i++){const r=e[i];for(let o in r)n[o]=r[o]}return n},defaults:function(n){const e=Fc.call(arguments,1);for(let i=0;i<e.length;i++){const r=e[i];for(let o in r)n[o]===void 0&&(n[o]=r[o])}return n},each:function(n,e,i){const r=i||this,o=!Iy(n)&&Object.keys(n),s=(o||n).length;for(let a=0;a<s;a++){const l=o?o[a]:a;e.call(r,n[l],l,n)}return n},performance:Je.performance&&Je.performance.now?Je.performance:Date},tn={hasEventListeners:typeof Je.addEventListener=="function",bind:function(n,e,i,r){return this.hasEventListeners?n.addEventListener(e,i,!!r):n.attachEvent("on"+e,i),tn},unbind:function(n,e,i,r){return tn.hasEventListeners?n.removeEventListeners(e,i,!!r):n.detachEvent("on"+e,i),tn},getRequestAnimationFrame:function(){const n=["ms","moz","webkit","o"];let e=0,i=Je.requestAnimationFrame;if(!i){for(let o=0;o<n.length;o++)i=Je[n[o]+"RequestAnimationFrame"]||i;i=i||r}function r(o,s){const a=new Date().getTime(),l=Math.max(0,16-(a-e)),c=Je.setTimeout(d,l);e=a+l;function d(){o(a+l)}return c}return i}},or=Je.document?Je.document.createElement("div"):{};or.id="help-two-load",Object.defineProperty(tn,"temp",{enumerable:!0,get:function(){return re.isElement(or)&&!Je.document.head.contains(or)&&(or.style.display="none",Je.document.head.appendChild(or)),or}});var Yt=class extends Error{constructor(e){super(),S(this,"name","Two.js"),S(this,"message"),this.message=e}},Ay=Je.devicePixelRatio||1;function Oy(n){return n.webkitBackingStorePixelRatio||n.mozBackingStorePixelRatio||n.msBackingStorePixelRatio||n.oBackingStorePixelRatio||n.backingStorePixelRatio||1}function Xs(n){return Ay/Oy(n)}var bo=class{constructor(){S(this,"map",{})}add(e,i){return this.map[e]=i,this}remove(e){return delete this.map[e],this}get(e){return this.map[e]}contains(e){return e in this.map}},Nt,di=class extends Array{constructor(){super(),wc(this,Nt,new ee),arguments[0]&&Array.isArray(arguments[0])?arguments[0].length>0&&this.push.apply(this,arguments[0]):arguments.length>0&&this.push.apply(this,arguments)}get _events(){return Xt(this,Nt)}set _events(e){Py(this,Nt,e)}get _bound(){return Xt(this,Nt)._bound}set _bound(e){Xt(this,Nt)._bound=e}addEventListener(){var e;return(e=Xt(this,Nt).addEventListener)==null?void 0:e.apply(this,arguments)}on(){var e;return(e=Xt(this,Nt).on)==null?void 0:e.apply(this,arguments)}bind(){var e;return(e=Xt(this,Nt).bind)==null?void 0:e.apply(this,arguments)}removeEventListener(){var e;return(e=Xt(this,Nt).removeEventListener)==null?void 0:e.apply(this,arguments)}off(){var e;return(e=Xt(this,Nt).off)==null?void 0:e.apply(this,arguments)}unbind(){var e;return(e=Xt(this,Nt).unbind)==null?void 0:e.apply(this,arguments)}dispatchEvent(){var e;return(e=Xt(this,Nt).dispatchEvent)==null?void 0:e.apply(this,arguments)}trigger(){var e;return(e=Xt(this,Nt).trigger)==null?void 0:e.apply(this,arguments)}listen(){var e;return(e=Xt(this,Nt).listen)==null?void 0:e.apply(this,arguments)}ignore(){var e;return(e=Xt(this,Nt).ignore)==null?void 0:e.apply(this,arguments)}pop(){const e=super.pop.apply(this,arguments);return this.trigger(ee.Types.remove,[e]),e}shift(){const e=super.shift.apply(this,arguments);return this.trigger(ee.Types.remove,[e]),e}push(){const e=super.push.apply(this,arguments);return this.trigger(ee.Types.insert,arguments),e}unshift(){const e=super.unshift.apply(this,arguments);return this.trigger(ee.Types.insert,arguments),e}splice(){const e=super.splice.apply(this,arguments);if(this.trigger(ee.Types.remove,e),arguments.length>2){const i=this.slice(arguments[0],arguments[0]+arguments.length-2);this.trigger(ee.Types.insert,i),this.trigger(ee.Types.order)}return e}sort(){return super.sort.apply(this,arguments),this.trigger(ee.Types.order),this}reverse(){return super.reverse.apply(this,arguments),this.trigger(ee.Types.order),this}indexOf(){return super.indexOf.apply(this,arguments)}map(e,i){const r=[];for(let o=0;o<this.length;o++){const s=this[o];let a;i?a=e.call(i,s,o):a=e(s,o),r.push(a)}return r}};Nt=new WeakMap;var Vc=class Rm extends ee{constructor(){super(),S(this,"_flagId",!1),S(this,"_flagClassName",!1),S(this,"_renderer",{}),S(this,"_id",Bt.Identifier+Bt.uniqueId()),S(this,"_className",""),S(this,"classList",[]);for(let e in Mc)Object.defineProperty(this,e,Mc[e])}static fromObject(e){const i=new Rm().copy(e);return"id"in e&&(i.id=e.id),i}flagReset(){return this._flagId=this._flagClassName=!1,this}copy(e){return e.renderer&&typeof e.renderer.type=="string"&&(this.renderer.type=e.renderer.type),typeof e.className=="string"&&(this.className=e.className),this}toObject(){return{renderer:{type:this.renderer.type},id:this.id,className:this.className}}dispose(){if(typeof this.unbind=="function"&&this.unbind(),this._renderer){if(this._renderer.elem&&this._renderer.elem.parentNode&&(this._renderer.elem.parentNode.removeChild(this._renderer.elem),delete this._renderer.elem),this.type==="WebGLRenderer"&&this.renderer.ctx){const i=this.renderer.ctx;this._renderer.texture&&(i.deleteTexture(this._renderer.texture),delete this._renderer.texture),this._renderer.positionBuffer&&(i.deleteBuffer(this._renderer.positionBuffer),delete this._renderer.positionBuffer),this._renderer.effect&&(this._renderer.effect=null)}this.type==="CanvasRenderer"&&this._renderer.context&&delete this._renderer.context}const e=this._renderer.type;return this._renderer={type:e},this}};S(Vc,"Properties",["renderer","id","className"]);var sr=Vc,Mc={renderer:{enumerable:!1,get:function(){return this._renderer}},id:{enumerable:!0,get:function(){return this._id},set:function(n){const e=this._id;n!==this._id&&(this._id=n,this._flagId=!0,this.parent&&(delete this.parent.children.ids[e],this.parent.children.ids[this._id]=this))}},className:{enumerable:!0,get:function(){return this._className},set:function(n){this._className!==n&&(this._flagClassName=!0,this.classList=n.split(/\s+?/),this._className=n)}}},_o,Ic={video:/\.(mp4|webm|ogg)$/i,image:/\.(jpe?g|png|gif|tiff|webp)$/i,effect:/texture|gradient/i};Je.document&&(_o=document.createElement("a"));var bn=class an extends sr{constructor(e,i){super(),S(this,"_flagSrc",!1),S(this,"_flagImage",!1),S(this,"_flagVideo",!1),S(this,"_flagLoaded",!1),S(this,"_flagRepeat",!1),S(this,"_flagOffset",!1),S(this,"_flagScale",!1),S(this,"_src",""),S(this,"_image",null),S(this,"_loaded",!1),S(this,"_repeat","no-repeat"),S(this,"_scale",1),S(this,"_offset",null);for(let r in Ac)Object.defineProperty(this,r,Ac[r]);if(this._renderer.type="texture",this._renderer.flagOffset=zy.bind(this),this._renderer.flagScale=Dy.bind(this),this.loaded=!1,this.repeat="no-repeat",this.offset=new ie,typeof i=="function"){const r=(function(){this.unbind(ee.Types.load,r),typeof i=="function"&&i()}).bind(this);this.bind(ee.Types.load,r)}if(typeof e=="string")this.src=e;else if(typeof e=="object"){const r=Object.prototype.toString.call(e);(r==="[object HTMLImageElement]"||r==="[object HTMLCanvasElement]"||r==="[object HTMLVideoElement]"||r==="[object Image]")&&(this.image=e)}this._update()}fromObject(e){const i=new an().copy(e);return"id"in e&&(i.id=e.id),i}static getAbsoluteURL(e){return _o?(_o.href=e,_o.href):e}static loadHeadlessBuffer(e,i){e.image.onload=i,e.image.src=e.src}static getTag(e){return e&&e.nodeName&&e.nodeName.toLowerCase()||"img"}static getImage(e){const i=an.getAbsoluteURL(e);if(an.ImageRegistry.contains(i))return an.ImageRegistry.get(i);let r;return At.Image?(r=new At.Image,At.shim(r,"img")):Je.document?Ic.video.test(i)?r=document.createElement("video"):r=document.createElement("img"):console.warn("Two.js: no prototypical image defined for Two.Texture"),r.crossOrigin="anonymous",r.referrerPolicy="no-referrer",r}static load(e,i){let r=e.image,o=an.getTag(r);e._flagImage&&(/canvas/i.test(o)?an.Register.canvas(e,i):(e._src=!At.isHeadless&&r.getAttribute("two-src")||r.src,an.Register[o](e,i))),e._flagSrc&&(r||(r=an.getImage(e.src),e.image=r),o=an.getTag(r),an.Register[o](e,i))}clone(){const e=new an(this.src);return e.repeat=this.repeat,e.offset.copy(this.offset),e.scale=this.scale,e}copy(e){return this.src=e.src,this.repeat=e.repeat,this.offset=typeof e.offset=="number"||e.offset instanceof ie?e.offset:new ie().copy(e.offset),this.scale=typeof e.scale=="number"||e.scale instanceof ie?e.scale:new ie().copy(e.scale),this}toObject(){const e=super.toObject.call(this);return e.renderer.type="texture",e.src=this.src,e.repeat=this.repeat,e.offset=this.offset.toObject(),e.scale=typeof this.scale=="number"?this.scale:this.scale.toObject(),e}_update(){return(this._flagSrc||this._flagImage)&&(this.trigger(ee.Types.change),(this._flagSrc||this._flagImage)&&(this.loaded=!1,an.load(this,(function(){this.loaded=!0,this.trigger(ee.Types.change).trigger(ee.Types.load)}).bind(this)))),this._image&&this._image.readyState>=4&&(this._flagVideo=!0),this}flagReset(){return this._flagSrc=this._flagImage=this._flagLoaded=this._flagRepeat=this._flagVideo=this._flagScale=this._flagOffset=!1,super.flagReset.call(this),this}dispose(){if(super.dispose(),"elem"in this._renderer){const e=this._renderer.elem;e.parentNode.removeChild(e)}return"effect"in this._renderer&&(this._renderer.effect=null),this}};S(bn,"Properties",["src","loaded","repeat","scale","offset","image"]),S(bn,"RegularExpressions",Ic),S(bn,"ImageRegistry",new bo),S(bn,"Register",{canvas:function(n,e){n._src="#"+n.id,bn.ImageRegistry.add(n.src,n.image),typeof e=="function"&&e()},img:function(n,e){const i=n.image,r=function(s){!At.isHeadless&&i.removeEventListener&&typeof i.removeEventListener=="function"&&(i.removeEventListener("load",r,!1),i.removeEventListener("error",o,!1)),typeof e=="function"&&e()},o=function(s){throw!At.isHeadless&&typeof i.removeEventListener=="function"&&(i.removeEventListener("load",r,!1),i.removeEventListener("error",o,!1)),new Yt("unable to load "+n.src)};typeof i.width=="number"&&i.width>0&&typeof i.height=="number"&&i.height>0?r():!At.isHeadless&&typeof i.addEventListener=="function"&&(i.addEventListener("load",r,!1),i.addEventListener("error",o,!1)),n._src=bn.getAbsoluteURL(n._src),!(!At.isHeadless&&i&&i.getAttribute("two-src"))&&(At.isHeadless||i.setAttribute("two-src",n.src),bn.ImageRegistry.add(n.src,i),At.isHeadless?bn.loadHeadlessBuffer(n,r):n.image.src=n.src)},video:function(n,e){if(At.isHeadless)throw new Yt("video textures are not implemented in headless environments.");const i=function(o){n.image.removeEventListener("canplaythrough",i,!1),n.image.removeEventListener("error",r,!1),n.image.width=n.image.videoWidth,n.image.height=n.image.videoHeight,typeof e=="function"&&e()},r=function(o){throw n.image.removeEventListener("canplaythrough",i,!1),n.image.removeEventListener("error",r,!1),new Yt("unable to load "+n.src)};n._src=bn.getAbsoluteURL(n._src),n.image.getAttribute("two-src")||(n.image.setAttribute("two-src",n.src),bn.ImageRegistry.add(n.src,n.image)),n.image.readyState>=4?i():(n.image.addEventListener("canplaythrough",i,!1),n.image.addEventListener("error",r,!1),n.image.src=n.src,n.image.load())}});var De=bn,Ac={src:{enumerable:!0,get:function(){return this._src},set:function(n){this._src=n,this._flagSrc=!0}},loaded:{enumerable:!0,get:function(){return this._loaded},set:function(n){this._loaded=n,this._flagLoaded=!0}},repeat:{enumerable:!0,get:function(){return this._repeat},set:function(n){this._repeat=n,this._flagRepeat=!0}},image:{enumerable:!0,get:function(){return this._image},set:function(n){const e=De.getTag(n);let i;switch(e){case"canvas":i="#"+n.id;break;default:i=n.src}De.ImageRegistry.contains(i)?this._image=De.ImageRegistry.get(n.src):this._image=n,this._flagImage=!0}},offset:{enumerable:!0,get:function(){return this._offset},set:function(n){this._offset&&this._offset.unbind(ee.Types.change,this._renderer.flagOffset),this._offset=n,this._offset.bind(ee.Types.change,this._renderer.flagOffset),this._flagOffset=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(n){this._scale instanceof ie&&this._scale.unbind(ee.Types.change,this._renderer.flagScale),this._scale=n,this._scale instanceof ie&&this._scale.bind(ee.Types.change,this._renderer.flagScale),this._flagScale=!0}}};function zy(){this._flagOffset=!0}function Dy(){this._flagScale=!0}var Ys=class Sn extends sr{constructor(e,i,r){super(),S(this,"_flagOffset",!0),S(this,"_flagOpacity",!0),S(this,"_flagColor",!0),S(this,"_offset",0),S(this,"_opacity",1),S(this,"_color","#fff");for(let o in Oc)Object.defineProperty(this,o,Oc[o]);this._renderer.type="stop",this.offset=typeof e=="number"?e:Sn.Index<=0?0:1,this.opacity=typeof r=="number"?r:1,this.color=typeof i=="string"?i:Sn.Index<=0?"#fff":"#000",Sn.Index=(Sn.Index+1)%2}static fromObject(e){const i=new Sn().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<Sn.Properties.length;i++){const r=Sn.Properties[i];r in e&&(this[r]=e[r])}return this}clone(e){const i=new Sn;return re.each(Sn.Properties,function(r){i[r]=this[r]},this),e&&e.stops&&e.stops.push(i),i}toObject(){const e=super.toObject.call(this);return e.renderer.type="stop",re.each(Sn.Properties,i=>{e[i]=this[i]},this),e}flagReset(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,super.flagReset.call(this),this}};S(Ys,"Index",0),S(Ys,"Properties",["offset","opacity","color"]);var ui=Ys,Oc={offset:{enumerable:!0,get:function(){return this._offset},set:function(n){this._offset=n,this._flagOffset=!0,this.parent&&(this.parent._flagStops=!0)}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(n){this._opacity=n,this._flagOpacity=!0,this.parent&&(this.parent._flagStops=!0)}},color:{enumerable:!0,get:function(){return this._color},set:function(n){this._color=n,this._flagColor=!0,this.parent&&(this.parent._flagStops=!0)}}},Us=class Ki extends sr{constructor(e){super(),S(this,"_flagStops",!1),S(this,"_flagSpread",!1),S(this,"_flagUnits",!1),S(this,"_spread",""),S(this,"_units","");for(let i in zc)Object.defineProperty(this,i,zc[i]);this._renderer.type="gradient",this._renderer.flagStops=Ly.bind(this),this._renderer.bindStops=Hy.bind(this),this._renderer.unbindStops=Wy.bind(this),this.spread="pad",this.units="objectBoundingBox",e&&(this.stops=e)}static fromObject(e){let i=e.stops;i&&i.length>0&&(i=i.map(o=>o instanceof ui?o:new ui().copy(o)));const r=new Ki(i).copy(e);return"id"in e&&(r.id=e.id),r}clone(e){const i=this.stops.map(o=>o.clone()),r=new Ki(i);return re.each(Ki.Properties,o=>{r[o]=this[o]},this),e&&e.add(r),r}copy(e){super.copy.call(this,e);for(let i=0;i<Ki.Properties.length;i++){const r=Ki.Properties[i];r in e&&(this[r]=e[r])}return this}toObject(){const e={stops:this.stops.map(i=>i.toObject())};return re.each(Ki.Properties,i=>{e[i]=this[i]},this),e}_update(){return(this._flagSpread||this._flagStops)&&this.trigger(ee.Types.change),this}flagReset(){return this._flagSpread=this._flagUnits=this._flagStops=!1,super.flagReset.call(this),this}dispose(){if("elem"in this._renderer){const e=this._renderer.elem;e.parentNode.removeChild(e)}return"effect"in this._renderer&&(this._renderer.effect=null),this}};S(Us,"Stop",ui),S(Us,"Properties",["spread","stops","units"]);var pt=Us,zc={spread:{enumerable:!0,get:function(){return this._spread},set:function(n){this._spread=n,this._flagSpread=!0}},units:{enumerable:!0,get:function(){return this._units},set:function(n){this._units=n,this._flagUnits=!0}},stops:{enumerable:!0,get:function(){return this._stops},set:function(n){const e=this._renderer.bindStops,i=this._renderer.unbindStops;this._stops&&this._stops.unbind(ee.Types.insert,e).unbind(ee.Types.remove,i),this._stops=new di((n||[]).slice(0)),this._stops.bind(ee.Types.insert,e).bind(ee.Types.remove,i),e(this._stops)}}};function Ly(){this._flagStops=!0}function Hy(n){let e=n.length;for(;e--;)n[e].bind(ee.Types.change,this._renderer.flagStops),n[e].parent=this;this._renderer.flagStops()}function Wy(n){let e=n.length;for(;e--;)n[e].unbind(ee.Types.change,this._renderer.flagStops),delete n[e].parent;this._renderer.flagStops()}var Ks=class ro extends pt{constructor(e,i,r,o,s){super(s),S(this,"_flagEndPoints",!1),S(this,"_left",null),S(this,"_right",null);for(let a in Dc)Object.defineProperty(this,a,Dc[a]);this._renderer.type="linear-gradient",this._renderer.flagEndPoints=jy.bind(this),this.left=new ie,this.right=new ie,typeof e=="number"&&(this.left.x=e),typeof i=="number"&&(this.left.y=i),typeof r=="number"&&(this.right.x=r),typeof o=="number"&&(this.right.y=o)}static fromObject(e){const i=new ro().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<ro.Properties.length;i++){const r=ro.Properties[i];r in e&&(this[r]=e[r]instanceof ie?e[r]:new ie().copy(e[r]))}return this}clone(e){const i=this.stops.map(function(o){return o.clone()}),r=new ro(this.left._x,this.left._y,this.right._x,this.right._y,i);return re.each(pt.Properties,function(o){r[o]=this[o]},this),e&&e.add(r),r}toObject(){const e=super.toObject.call(this);return e.left=this.left.toObject(),e.right=this.right.toObject(),e}_update(){return(this._flagEndPoints||this._flagSpread||this._flagStops)&&this.trigger(ee.Types.change),this}flagReset(){return this._flagEndPoints=!1,super.flagReset.call(this),this}};S(Ks,"Stop",ui),S(Ks,"Properties",["left","right"]);var et=Ks,Dc={left:{enumerable:!0,get:function(){return this._left},set:function(n){this._left instanceof ie&&this._left.unbind(ee.Types.change,this._renderer.flagEndPoints),this._left=n,this._left.bind(ee.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}},right:{enumerable:!0,get:function(){return this._right},set:function(n){this._right instanceof ie&&this._right.unbind(ee.Types.change,this._renderer.flagEndPoints),this._right=n,this._right.bind(ee.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}}};function jy(){this._flagEndPoints=!0}var Gs=class Gi extends pt{constructor(e,i,r,o,s,a){super(o),S(this,"_flagRadius",!1),S(this,"_flagCenter",!1),S(this,"_flagFocal",!1),S(this,"_radius",0),S(this,"_center",null),S(this,"_focal",null);for(let l in Lc)Object.defineProperty(this,l,Lc[l]);this._renderer.type="radial-gradient",this._renderer.flagCenter=qy.bind(this),this._renderer.flagFocal=Xy.bind(this),this.center=new ie,this.radius=typeof r=="number"?r:1,this.focal=new ie,typeof e=="number"&&(this.center.x=e),typeof i=="number"&&(this.center.y=i),this.focal.copy(this.center),typeof s=="number"&&(this.focal.x=s),typeof a=="number"&&(this.focal.y=a)}static fromObject(e){const i=new Gi().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<Gi.Properties.length;i++){const r=Gi.Properties[i];r in e&&(/(center|focal)i/.test(r)?this[r]=e[r]instanceof ie?e[r]:new ie().copy(e[r]):typeof e[r]=="number"&&(this[r]=e[MediaKeySystemAccess]))}return this}clone(e){const i=this.stops.map(function(o){return o.clone()}),r=new Gi(this.center._x,this.center._y,this._radius,i,this.focal._x,this.focal._y);return re.each(pt.Properties.concat(Gi.Properties),function(o){r[o]=this[o]},this),e&&e.add(r),r}toObject(){const e=super.toObject.call(this);return re.each(Gi.Properties,function(i){e[i]=this[i]},this),e.center=this.center.toObject(),e.focal=this.focal.toObject(),e}_update(){return(this._flagRadius||this._flatCenter||this._flagFocal||this._flagSpread||this._flagStops)&&this.trigger(ee.Types.change),this}flagReset(){return this._flagRadius=this._flagCenter=this._flagFocal=!1,super.flagReset.call(this),this}};S(Gs,"Stop",ui),S(Gs,"Properties",["center","radius","focal"]);var tt=Gs,Lc={radius:{enumerable:!0,get:function(){return this._radius},set:function(n){this._radius=n,this._flagRadius=!0}},center:{enumerable:!0,get:function(){return this._center},set:function(n){this._center&&this._center.unbind(ee.Types.change,this._renderer.flagCenter),this._center=n,this._center.bind(ee.Types.change,this._renderer.flagCenter),this._flagCenter=!0}},focal:{enumerable:!0,get:function(){return this._focal},set:function(n){this._focal&&this._focal.unbind(ee.Types.change,this._renderer.flagFocal),this._focal=n,this._focal.bind(ee.Types.change,this._renderer.flagFocal),this._flagFocal=!0}}};function qy(){this._flagCenter=!0}function Xy(){this._flagFocal=!0}function Hc(n,e){if(e===0||e===1)return!0;const r=n._length*e;let o=0;for(let s=0;s<n._lengths.length;s++){const a=n._lengths[s];if(o>=r)return r-o>=0;o+=a}return!1}function wo(n,e){const i=n._length;if(e<=0)return 0;if(e>=i)return n._lengths.length-1;for(let r=0,o=0;r<n._lengths.length;r++){if(o+n._lengths[r]>=e)return e-=o,Math.max(r-1,0)+e/n._lengths[r];o+=n._lengths[r]}return-1}function Wc(n,e,i){let r,o,s,a,l,c,d,u;const f=e.controls&&e.controls.right,h=n.controls&&n.controls.left;return r=e.x,l=e.y,o=(f||e).x,c=(f||e).y,s=(h||n).x,d=(h||n).y,a=n.x,u=n.y,f&&e._relative&&(o+=e.x,c+=e.y),h&&n._relative&&(s+=n.x,d+=n.y),Tc(r,l,o,c,s,d,a,u,i)}function Zs(n,e,i){let r,o,s,a,l,c,d,u;const f=e.controls&&e.controls.right,h=n.controls&&n.controls.left;return r=e.x,l=e.y,o=(f||e).x,c=(f||e).y,s=(h||n).x,d=(h||n).y,a=n.x,u=n.y,f&&e._relative&&(o+=e.x,c+=e.y),h&&n._relative&&(s+=n.x,d+=n.y),js(r,l,o,c,s,d,a,u,i)}function Bi(n){switch(n.renderer.type){case"texture":return De.fromObject(n);case"gradient":return pt.fromObject(n);case"linear-gradient":return et.fromObject(n);case"radial-gradient":return tt.fromObject(n)}return n}var Yy=Math.cos,Uy=Math.sin,jc=Math.tan,Qs=[],qc=class ln extends ee{constructor(e,i,r,o,s,a){super(),S(this,"elements",new Bn(9)),S(this,"manual",!1);let l=e;Array.isArray(l)||(l=Array.prototype.slice.call(arguments)),this.identity(),l.length>0&&this.set(l)}static Multiply(e,i,r){if(i.length<=3){const N=e;let k,$,v;const E=i[0]||0,P=i[1]||0,F=i[2]||0;return k=N[0]*E+N[1]*P+N[2]*F,$=N[3]*E+N[4]*P+N[5]*F,v=N[6]*E+N[7]*P+N[8]*F,[k,$,v]}const o=e[0],s=e[1],a=e[2],l=e[3],c=e[4],d=e[5],u=e[6],f=e[7],h=e[8],p=i[0],m=i[1],g=i[2],b=i[3],y=i[4],_=i[5],x=i[6],w=i[7],C=i[8];return r=r||new Bn(9),r[0]=o*p+s*b+a*x,r[1]=o*m+s*y+a*w,r[2]=o*g+s*_+a*C,r[3]=l*p+c*b+d*x,r[4]=l*m+c*y+d*w,r[5]=l*g+c*_+d*C,r[6]=u*p+f*b+h*x,r[7]=u*m+f*y+h*w,r[8]=u*g+f*_+h*C,r}static fromObject(e){return new ln().copy(e)}set(e,i,r,o,s,a,l,c,d){if(typeof i>"u"){const u=e;e=u[0],i=u[1],r=u[2],o=u[3],s=u[4],a=u[5],l=u[6],c=u[7],d=u[8]}return this.elements[0]=e,this.elements[1]=i,this.elements[2]=r,this.elements[3]=o,this.elements[4]=s,this.elements[5]=a,this.elements[6]=l,this.elements[7]=c,this.elements[8]=d,this.trigger(ee.Types.change)}copy(e){return this.elements[0]=e.elements[0],this.elements[1]=e.elements[1],this.elements[2]=e.elements[2],this.elements[3]=e.elements[3],this.elements[4]=e.elements[4],this.elements[5]=e.elements[5],this.elements[6]=e.elements[6],this.elements[7]=e.elements[7],this.elements[8]=e.elements[8],this.manual=e.manual,this.trigger(ee.Types.change)}identity(){return this.elements[0]=ln.Identity[0],this.elements[1]=ln.Identity[1],this.elements[2]=ln.Identity[2],this.elements[3]=ln.Identity[3],this.elements[4]=ln.Identity[4],this.elements[5]=ln.Identity[5],this.elements[6]=ln.Identity[6],this.elements[7]=ln.Identity[7],this.elements[8]=ln.Identity[8],this.trigger(ee.Types.change)}multiply(e,i,r,o,s,a,l,c,d){if(typeof i>"u")return this.elements[0]*=e,this.elements[1]*=e,this.elements[2]*=e,this.elements[3]*=e,this.elements[4]*=e,this.elements[5]*=e,this.elements[6]*=e,this.elements[7]*=e,this.elements[8]*=e,this.trigger(ee.Types.change);if(typeof r>"u"&&(r=1),typeof o>"u"){e=e||0,i=i||0,r=r||0,s=this.elements;const M=s[0]*e+s[1]*i+s[2]*r,X=s[3]*e+s[4]*i+s[5]*r,G=s[6]*e+s[7]*i+s[8]*r;return[M,X,G]}const u=this.elements,f=[e,i,r,o,s,a,l,c,d],h=u[0],p=u[1],m=u[2],g=u[3],b=u[4],y=u[5],_=u[6],x=u[7],w=u[8],C=f[0],N=f[1],k=f[2],$=f[3],v=f[4],E=f[5],P=f[6],F=f[7],R=f[8];return this.elements[0]=h*C+p*$+m*P,this.elements[1]=h*N+p*v+m*F,this.elements[2]=h*k+p*E+m*R,this.elements[3]=g*C+b*$+y*P,this.elements[4]=g*N+b*v+y*F,this.elements[5]=g*k+b*E+y*R,this.elements[6]=_*C+x*$+w*P,this.elements[7]=_*N+x*v+w*F,this.elements[8]=_*k+x*E+w*R,this.trigger(ee.Types.change)}inverse(e){const i=this.elements;e=e||new ln;const r=i[0],o=i[1],s=i[2],a=i[3],l=i[4],c=i[5],d=i[6],u=i[7],f=i[8],h=f*l-c*u,p=-f*a+c*d,m=u*a-l*d;let g=r*h+o*p+s*m;return g?(g=1/g,e.elements[0]=h*g,e.elements[1]=(-f*o+s*u)*g,e.elements[2]=(c*o-s*l)*g,e.elements[3]=p*g,e.elements[4]=(f*r-s*d)*g,e.elements[5]=(-c*r+s*a)*g,e.elements[6]=m*g,e.elements[7]=(-u*r+o*d)*g,e.elements[8]=(l*r-o*a)*g,e):null}scale(e,i){return arguments.length<=1&&(i=e),this.multiply(e,0,0,0,i,0,0,0,1)}rotate(e){const i=Yy(e),r=Uy(e);return this.multiply(i,-r,0,r,i,0,0,0,1)}translate(e,i){return this.multiply(1,0,e,0,1,i,0,0,1)}skewX(e){const i=jc(e);return this.multiply(1,i,0,0,1,0,0,0,1)}skewY(e){const i=jc(e);return this.multiply(1,0,0,i,1,0,0,0,1)}toString(e){return Qs.length=0,this.toTransformArray(e,Qs),Qs.map(ze).join(" ")}toTransformArray(e,i){const r=this.elements,o=!!i,s=r[0],a=r[1],l=r[2],c=r[3],d=r[4],u=r[5];if(e){const f=r[6],h=r[7],p=r[8];if(o){i[0]=s,i[1]=c,i[2]=f,i[3]=a,i[4]=d,i[5]=h,i[6]=l,i[7]=u,i[8]=p;return}return[s,c,f,a,d,h,l,u,p]}if(o){i[0]=s,i[1]=c,i[2]=a,i[3]=d,i[4]=l,i[5]=u;return}return[s,c,a,d,l,u]}toArray(e,i){const r=this.elements,o=!!i,s=r[0],a=r[1],l=r[2],c=r[3],d=r[4],u=r[5];if(e){const f=r[6],h=r[7],p=r[8];if(o){i[0]=s,i[1]=a,i[2]=l,i[3]=c,i[4]=d,i[5]=u,i[6]=f,i[7]=h,i[8]=p;return}return[s,a,l,c,d,u,f,h,p]}if(o){i[0]=s,i[1]=a,i[2]=l,i[3]=c,i[4]=d,i[5]=u;return}return[s,a,l,c,d,u]}toObject(){return{renderer:{type:"matrix"},elements:this.toArray(!0),manual:!!this.manual}}clone(){return new ln().copy(this)}};S(qc,"Identity",[1,0,0,0,1,0,0,0,1]);var Ni=qc;vc(Ni);var Xc=class jl extends sr{constructor(){super(),S(this,"_flagMatrix",!0),S(this,"_flagScale",!1),S(this,"_matrix",null),S(this,"_worldMatrix",null),S(this,"_position",null),S(this,"_rotation",0),S(this,"_scale",1),S(this,"_skewX",0),S(this,"_skewY",0);for(let e in xo)Object.defineProperty(this,e,xo[e]);this._renderer.flagMatrix=Yc.bind(this),this.isShape=!0,this.matrix=new Ni,this.worldMatrix=new Ni,this.position=new ie,this.rotation=0,this.scale=1,this.skewX=0,this.skewY=0}static fromObject(e){const i=new jl().copy(e);return"id"in e&&(i.id=e.id),i}get renderer(){return this._renderer}set renderer(e){this._renderer=e}get translation(){return xo.position.get.apply(this,arguments)}set translation(e){xo.position.set.apply(this,arguments)}addTo(e){return e.add(this),this}remove(){return this.parent?(this.parent.remove(this),this):this}contains(e,i,r){const o=r||{},s=o.ignoreVisibility===!0;if(!s&&"visible"in this&&this.visible===!1||!s&&"opacity"in this&&typeof this.opacity=="number"&&this.opacity<=0||typeof this.getBoundingClientRect!="function")return!1;const a=typeof o.tolerance=="number"?o.tolerance:0;this._update(!0);const l=this.getBoundingClientRect();return l?e>=l.left-a&&e<=l.right+a&&i>=l.top-a&&i<=l.bottom+a:!1}copy(e){return super.copy.call(this,e),"position"in e&&(e.position instanceof ie?this.position=e.position:this.position.copy(e.position)),"rotation"in e&&(this.rotation=e.rotation),"scale"in e&&(this.scale=typeof e.scale=="number"||e.scale instanceof ie?e.scale:new ie(e.scale.x,e.scale.y)),"skewX"in e&&(this.skewX=e.skewX),"skewY"in e&&(this.skewY=e.skewY),"matrix"in e&&e.matrix.manual&&(this.matrix.copy(e.matrix),this.matrix.manual=!0),this}clone(e){const i=new jl;return i.position.copy(this.position),i.rotation=this.rotation,i.scale=this.scale,i.skewX=this.skewX,i.skewY=this.skewY,this.matrix.manual&&i.matrix.copy(this.matrix),e&&e.add(i),i._update()}toObject(){const e=super.toObject.call(this);return e.renderer={type:"shape"},e.isShape=!0,e.translation=this.translation.toObject(),e.rotation=this.translation.rotation,e.scale=this.scale instanceof ie?this.scale.toObject():this.scale,e.skewX=this.skewX,e.skewY=this.skewY,e.matrix=this.matrix.toObject(),e}dispose(){super.dispose(),typeof this.translation=="object"&&typeof this.translation.unbind=="function"&&this.translation.unbind(),typeof this.scale=="object"&&typeof this.scale.unbind=="function"&&this.scale.unbind()}_update(e){return!this._matrix.manual&&this._flagMatrix&&(this._matrix.identity().translate(this.position.x,this.position.y),this._matrix.rotate(this.rotation),this._scale instanceof ie?this._matrix.scale(this._scale.x,this._scale.y):this._matrix.scale(this._scale),this._matrix.skewX(this.skewX),this._matrix.skewY(this.skewY)),e&&this.parent&&this.parent._update&&this.parent._update(),this}flagReset(){return this._flagMatrix=this._flagScale=!1,super.flagReset.call(this),this}};S(Xc,"Properties",["position","rotation","scale","skewX","skewY","matrix","worldMatrix"]);var qn=Xc,xo={position:{enumerable:!0,get:function(){return this._position},set:function(n){this._position&&this._position.unbind(ee.Types.change,this._renderer.flagMatrix),this._position=n,this._position.bind(ee.Types.change,this._renderer.flagMatrix),Yc.call(this)}},rotation:{enumerable:!0,get:function(){return this._rotation},set:function(n){this._rotation=n,this._flagMatrix=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(n){this._scale instanceof ie&&this._scale.unbind(ee.Types.change,this._renderer.flagMatrix),this._scale=n,this._scale instanceof ie&&this._scale.bind(ee.Types.change,this._renderer.flagMatrix),this._flagMatrix=!0,this._flagScale=!0}},skewX:{enumerable:!0,get:function(){return this._skewX},set:function(n){this._skewX=n,this._flagMatrix=!0}},skewY:{enumerable:!0,get:function(){return this._skewY},set:function(n){this._skewY=n,this._flagMatrix=!0}},matrix:{enumerable:!0,get:function(){return this._matrix},set:function(n){this._matrix=n,this._flagMatrix=!0}},worldMatrix:{enumerable:!0,get:function(){return Hs(this,this._worldMatrix),this._worldMatrix},set:function(n){this._worldMatrix=n}}};function Yc(){this._flagMatrix=!0}var Uc=/^(?:none|transparent)$/i,Ky=8,Js=Number.EPSILON;function Xn(n,e){return{x:n,y:e}}function ko(n,e,i=Js){return Math.abs(n.x-e.x)<=i&&Math.abs(n.y-e.y)<=i}function Kc(n,e,i,r){const o=n*i+e*r,s=Math.sqrt(n*n+e*e)*Math.sqrt(i*i+r*r)||1e-12;let a=Math.acos(Math.max(-1,Math.min(1,o/s)));return n*r-e*i<0&&(a=-a),a}function Gy(n,e,i){if(!n)return[Xn(e.x,e.y)];let r=e.rx,o=e.ry;if(!(r&&o))return[Xn(e.x,e.y)];const s=(e.xAxisRotation||0)*Math.PI/180,a=e.largeArcFlag?1:0,l=e.sweepFlag?1:0;r=Math.abs(r),o=Math.abs(o);const c=n.x,d=n.y,u=e.x,f=e.y,h=(c-u)/2,p=(d-f)/2,m=Math.cos(s),g=Math.sin(s);let b=m*h+g*p,y=-g*h+m*p,_=r*r,x=o*o;const w=b*b/_+y*y/x;if(w>1){const A=Math.sqrt(w);r*=A,o*=A,_=r*r,x=o*o}const C=_*y*y+x*b*b,N=C===0?0:(_*x-C)/C;let k=Math.sqrt(Math.max(0,N));a===l&&(k=-k);const $=k*r*y/o,v=-k*o*b/r,E=m*$-g*v+(c+u)/2,P=g*$+m*v+(d+f)/2,F=Kc(1,0,(b-$)/r,(y-v)/o),R=Kc((b-$)/r,(y-v)/o,(-b-$)/r,(-y-v)/o)%ot,M=F+R,X=l===0,G=(()=>{const A=M-F,Y=Math.abs(A)<Number.EPSILON;let H=ut(A,ot);return H<Number.EPSILON&&(H=Y?0:ot),X&&!Y&&(H=H===ot?-ot:H-ot),H})(),Z=Math.max(Bt.Resolution,Math.max(i*2,1)),O=[];for(let A=1;A<=Z;A++){const Y=A/Z,H=F+Y*G;let T=E+r*Math.cos(H),D=P+o*Math.sin(H);if(s!==0){const K=T-E,J=D-P,U=Math.cos(s),q=Math.sin(s);T=K*U-J*q+E,D=K*q+J*U+P}O.push(Xn(T,D))}return O}function Zy(n,e=Ky){const i=[],r=[],o=n._renderer&&n._renderer.vertices&&n._renderer.vertices.length>0?n._renderer.vertices:n.vertices;if(!o||o.length===0)return{polygons:i,segments:r};const s=Math.max(1,Math.floor(e));let a=null,l=null,c=null,d=null;const u=(h=!1)=>{if(a){if(h&&l&&c&&!ko(l,c)){const p=Xn(l.x,l.y);r.push({a:c,b:p}),a.push(p),c=p}a.length>=3&&l&&c&&ko(l,c)&&i.push(a),a=null,l=null,c=null}},f=h=>{if(!c){c=h,a&&a.push(h);return}ko(c,h)||(r.push({a:c,b:h}),a&&a.push(h),c=h)};for(let h=0;h<o.length;h++){const p=o[h],m=p.command||(h===0?ne.move:ne.line);if(m===ne.move){u(!1);const g=Xn(p.x,p.y);a=[g],l=g,c=g,d=p;continue}if(d||(d=o[Math.max(h-1,0)]),m===ne.line)f(Xn(p.x,p.y));else if(m===ne.curve){const g=Zs(p,d,s);for(let b=1;b<g.length;b++){const y=g[b];f(Xn(y.x,y.y))}f(Xn(p.x,p.y))}else if(m===ne.arc){const g=Gy(d,p,s);for(let b=0;b<g.length;b++)f(g[b])}else if(m===ne.close){u(!0),d=p;continue}else f(Xn(p.x,p.y));d=p}if(a){const h=!!n._closed||!!n.closed||l&&c&&!ko(l,c);u(h)}return{polygons:i,segments:r}}function Qy(n,e,i){let r=!1;for(let o=0;o<n.length;o++){const s=n[o];if(!s||s.length<3)continue;let a=s.length-1;for(let l=0;l<s.length;l++){const c=s[a],d=s[l];d.y>i!=c.y>i&&e<(c.x-d.x)*(i-d.y)/(c.y-d.y||1e-12)+d.x&&(r=!r),a=l}}return r}function Jy(n,e,i,r){const o=r.x-i.x,s=r.y-i.y;if(Math.abs(o)<Js&&Math.abs(s)<Js){const h=n-i.x,p=e-i.y;return h*h+p*p}const a=((n-i.x)*o+(e-i.y)*s)/(o*o+s*s),l=Math.max(0,Math.min(1,a)),c=i.x+l*o,d=i.y+l*s,u=n-c,f=e-d;return u*u+f*f}function e0(n,e,i){if(!n||n.length===0)return 1/0;let r=1/0;for(let o=0;o<n.length;o++){const s=n[o],a=Jy(e,i,s.a,s.b);a<r&&(r=a)}return Math.sqrt(r)}function t0(n,e){if(typeof e=="boolean")return e;const i=n.fill;return!i&&i!==0?!1:typeof i=="string"?!Uc.test(i):!0}function n0(n,e){const i=typeof n.linewidth=="number"?n.linewidth:n._linewidth||0;if(typeof e=="boolean")return e&&i>0;if(!(i>0))return!1;const r=n.stroke;return!r&&r!==0?!1:typeof r=="string"?!Uc.test(r):!0}function i0(n,e,i,r=0){if(!n)return!1;const o=n.left-r,s=n.right+r,a=n.top-r,l=n.bottom+r;return e>=o&&e<=s&&i>=a&&i<=l}var Co=Number.EPSILON;function vo(n){return typeof n.relative!="boolean"||!!n.relative}function _n(n,e,i,r){const o=n.controls;if(!(!o||!o[e])){if(Math.abs(i)<Co&&Math.abs(r)<Co){vo(n)?o[e].clear():o[e].set(n.x,n.y);return}vo(n)?o[e].set(i,r):o[e].set(n.x+i,n.y+r)}}function Ut(n,e){_n(n,e,0,0)}function r0(n,e){const i=n.controls;return!i||!i[e]?{x:0,y:0}:vo(n)?{x:i[e].x,y:i[e].y}:{x:i[e].x-n.x,y:i[e].y-n.y}}function ar(n,e){const i=r0(n,e);return Math.abs(i.x)>Co||Math.abs(i.y)>Co}function So(n){n.command===ne.move||n.command===ne.close||(n.command=ar(n,"left")||ar(n,"right")?ne.curve:ne.line)}function Gc(n,e){typeof e.relative=="boolean"&&(n.relative=e.relative)}function o0(n,e){return ar(e,"right")||ar(n,"left")||ar(n,"right")||ar(e,"left")||n.command===ne.curve||e.command===ne.curve}function lr(n,e,i){return{x:Ot(n.x,e.x,i),y:Ot(n.y,e.y,i)}}function Zc(n,e){const i=n.controls&&n.controls[e];return i?vo(n)?{x:n.x+i.x,y:n.y+i.y}:{x:i.x,y:i.y}:{x:n.x,y:n.y}}function s0(n,e,i){const r=n.controls&&n.controls.right,o=e.controls&&e.controls.left,s={x:n.x,y:n.y},a=r?Zc(n,"right"):Vr({},s),l={x:e.x,y:e.y},c=o?Zc(e,"left"):Vr({},l),d=lr(s,a,i),u=lr(a,c,i),f=lr(c,l,i),h=lr(d,u,i),p=lr(u,f,i),m=lr(h,p,i),g=new Ee(m.x,m.y);return Gc(g,n),_n(g,"left",h.x-m.x,h.y-m.y),_n(g,"right",p.x-m.x,p.y-m.y),g.command=ne.curve,{anchor:g,startOut:d,endIn:f}}function a0(n,e,i,r,o,s){const a=n.length,l=i-e+1;let c=l-1,d=o?Math.min(l,4):1,u=d,f=d;if(r||(u=Math.min(1,e),f=Math.min(1,a-i-1)),c+=u+f,c<=1)return;const h=new Array(c+1);for(let k=0,$=e-u;k<=c;k+=1,$+=1){const v=ut($,a);h[k]=n[v]}let p=h[0].x+2*h[1].x,m=h[0].y+2*h[1].y,g=2;const b=c-1,y=[p],_=[m],x=[g],w=new Array(c+1),C=new Array(c+1);for(let k=1;k<c;k+=1){const $=k<b,v=$||s?1:2,E=$?4:s?2:7,P=$?4:s?3:8,F=$?2:s?0:1,R=v/g;g=x[k]=E-R,p=y[k]=P*h[k].x+F*h[k+1].x-R*p,m=_[k]=P*h[k].y+F*h[k+1].y-R*m}w[b]=y[b]/x[b],C[b]=_[b]/x[b];for(let k=c-2;k>=0;k-=1)w[k]=(y[k]-w[k+1])/x[k],C[k]=(_[k]-C[k+1])/x[k];w[c]=(3*h[c].x-w[b])/2,C[c]=(3*h[c].y-C[b])/2;const N=c-f;for(let k=u,$=e;k<=N;k+=1,$+=1){const v=ut($,a),E=n[v],P=w[k]-E.x,F=C[k]-E.y;o||k<N?_n(E,"right",P,F):Ut(E,"right"),o||k>u?_n(E,"left",-P,-F):Ut(E,"left"),So(E)}}function l0(n,e,i,r,o,s){const a=e||n,l=n,c=i||n,d=ie.distanceBetween(a,l),u=ie.distanceBetween(l,c),f=r===void 0?.5:r,h=Math.pow(d,f),p=Math.pow(u,f),m=h*h,g=p*p;if(!o&&e){const b=2*g+3*p*h+m,y=3*p*(p+h);if(y!==0){const _=(g*a.x+b*l.x-m*c.x)/y-l.x,x=(g*a.y+b*l.y-m*c.y)/y-l.y;_n(n,"left",_,x)}else Ut(n,"left")}else Ut(n,"left");if(!s&&i){const b=2*m+3*h*p+g,y=3*h*(h+p);if(y!==0){const _=(m*c.x+b*l.x-g*a.x)/y-l.x,x=(m*c.y+b*l.y-g*a.y)/y-l.y;_n(n,"right",_,x)}else Ut(n,"right")}else Ut(n,"right");So(n)}function c0(n,e,i,r,o,s){if(!(e&&i)){e||Ut(n,"left"),i||Ut(n,"right"),So(n);return}const a=e,l=n,c=i,d=ie.distanceBetween(a,l),u=ie.distanceBetween(l,c),f=d+u,h=r===void 0?.4:r,p={x:a.x-c.x,y:a.y-c.y};if(!o&&f!==0){const m=h*d/f;_n(n,"left",p.x*m,p.y*m)}else Ut(n,"left");if(!s&&f!==0){const m=h*d/f-h;_n(n,"right",p.x*m,p.y*m)}else Ut(n,"right");So(n)}function d0(n,e,i,r,o,s){const a=s.type,l=s.factor,c=n.length;for(let d=e;d<=i;d+=1){const u=ut(d,c),f=n[u];if(f.command===ne.move){Ut(f,"left"),Ut(f,"right");continue}const h=d===e&&!o?null:d-1,p=d===i&&!o?null:d+1,m=h===null?null:n[ut(h,c)],g=p===null?null:n[ut(p,c)],b=h===null,y=p===null;a==="geometric"?c0(f,m,g,l,b,y):l0(f,m,g,l,b,y)}}var cr=Math.min,dr=Math.max,u0=Math.ceil,f0=Math.floor,h0=new ie,m0=new Ni,ea=class wi extends qn{constructor(e,i,r,o){super(),S(this,"_flagVertices",!0),S(this,"_flagLength",!0),S(this,"_flagFill",!0),S(this,"_flagStroke",!0),S(this,"_flagLinewidth",!0),S(this,"_flagOpacity",!0),S(this,"_flagVisible",!0),S(this,"_flagCap",!0),S(this,"_flagJoin",!0),S(this,"_flagMiter",!0),S(this,"_flagStrokeAttenuation",!0),S(this,"_flagMask",!1),S(this,"_flagClip",!1),S(this,"_length",0),S(this,"_fill","#fff"),S(this,"_stroke","#000"),S(this,"_linewidth",1),S(this,"_opacity",1),S(this,"_visible",!0),S(this,"_cap","round"),S(this,"_join","round"),S(this,"_miter",4),S(this,"_closed",!0),S(this,"_curved",!1),S(this,"_automatic",!0),S(this,"_beginning",0),S(this,"_ending",1),S(this,"_mask",null),S(this,"_clip",!1),S(this,"_dashes",null),S(this,"_strokeAttenuation",!0);for(let s in Qc)Object.defineProperty(this,s,Qc[s]);this._renderer.type="path",this._renderer.flagVertices=Jc.bind(this),this._renderer.bindVertices=ed.bind(this),this._renderer.unbindVertices=td.bind(this),this._renderer.flagFill=nd.bind(this),this._renderer.flagStroke=id.bind(this),this._renderer.vertices=[],this._renderer.collection=[],this.closed=!!i,this.curved=!!r,this.beginning=0,this.ending=1,this.fill="#fff",this.stroke="#000",this.linewidth=1,this.opacity=1,this.className="",this.visible=!0,this.cap="butt",this.join="miter",this.miter=4,this.vertices=e,this.automatic=!o,this.dashes=[],this.dashes.offset=0}static fromObject(e){const i=typeof e.fill=="string"?e.fill:Bi(e.fill),r=typeof e.stroke=="string"?e.stroke:Bi(e.stroke),o=new wi().copy(Ls(Vr({},e),{fill:i,stroke:r}));return"id"in e&&(o.id=e.id),o}copy(e){if(super.copy.call(this,e),e.vertices){this.vertices=[];for(let i=0;i<e.vertices.length;i++){const r=e.vertices[i];r instanceof Ee?this.vertices.push(e.vertices[i].clone()):this.vertices.push(new Ee().copy(r))}}for(let i=0;i<wi.Properties.length;i++){const r=wi.Properties[i];r in e&&(this[r]=e[r])}return this}clone(e){const i=new wi;for(let r=0;r<this.vertices.length;r++)i.vertices.push(this.vertices[r].clone());for(let r=0;r<wi.Properties.length;r++){const o=wi.Properties[r];i[o]=this[o]}return i.className=this.className,i.translation.copy(this.translation),i.rotation=this.rotation,i.scale=this.scale,i.skewX=this.skewX,i.skewY=this.skewY,this.matrix.manual&&i.matrix.copy(this.matrix),e&&e.add(i),i._update()}toObject(){const e=super.toObject.call(this);return e.renderer.type="path",e.vertices=this.vertices.map(i=>i.toObject()),re.each(wi.Properties,i=>{typeof this[i]<"u"&&(this[i].toObject?e[i]=this[i].toObject():e[i]=this[i])},this),e}dispose(){if(super.dispose(),this.vertices&&typeof this.vertices.unbind=="function")try{this.vertices.unbind()}catch{}if(this.vertices)for(let e=0;e<this.vertices.length;e++){const i=this.vertices[e];typeof i.unbind=="function"&&i.unbind(),i.controls&&(i.controls.left&&typeof i.controls.left.unbind=="function"&&i.controls.left.unbind(),i.controls.right&&typeof i.controls.right.unbind=="function"&&i.controls.right.unbind())}return typeof this.fill=="object"&&typeof this.fill.dispose=="function"?this.fill.dispose():typeof this.fill=="object"&&typeof this.fill.unbind=="function"&&this.fill.unbind(),typeof this.stroke=="object"&&typeof this.stroke.dispose=="function"?this.stroke.dispose():typeof this.stroke=="object"&&typeof this.stroke.unbind=="function"&&this.stroke.unbind(),this}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}corner(){const e=this.getBoundingClientRect(!0),i=e.width/2,r=e.height/2,o=e.left+e.width/2,s=e.top+e.height/2;for(let a=0;a<this.vertices.length;a++){const l=this.vertices[a];l.x-=o,l.y-=s,l.x+=i,l.y+=r}return this.mask&&(this.mask.translation.x-=o,this.mask.translation.x+=i,this.mask.translation.y-=s,this.mask.translation.y+=r),this}center(){const e=this.getBoundingClientRect(!0),i=e.left+e.width/2-this.translation.x,r=e.top+e.height/2-this.translation.y;for(let o=0;o<this.vertices.length;o++){const s=this.vertices[o];s.x-=i,s.y-=r}return this.mask&&(this.mask.translation.x-=i,this.mask.translation.y-=r),this}getBoundingClientRect(e){let i,r,o,s,a,l,c=1/0,d=-1/0,u=1/0,f=-1/0;if(this._update(!0),i=e?this.matrix:this.worldMatrix,r=(this.linewidth||0)/2,o=this._renderer.vertices.length,this.linewidth>0||this.stroke&&!/(transparent|none)/i.test(this.stroke))if(this.matrix.manual){const{scaleX:h,scaleY:p}=Si(i.elements[0],i.elements[3],i.elements[1],i.elements[4],i.elements[2],i.elements[5]);typeof h=="number"&&typeof p=="number"&&(r=Math.max(h,p)*(this.linewidth||0)/2)}else r*=typeof this.scale=="number"?this.scale:Math.max(this.scale.x,this.scale.y);if(o<=0)return{width:0,height:0};for(s=0;s<o;s++){l=this._renderer.vertices[s],a=this._renderer.vertices[(s+o-1)%o];const[h,p]=i.multiply(a.x,a.y),[m,g]=i.multiply(l.x,l.y);if(a.controls&&l.controls){let b=a.controls.right.x,y=a.controls.right.y;a.relative&&(b+=a.x,y+=a.y);let[_,x]=i.multiply(b,y),w=l.controls.left.x,C=l.controls.left.y;l.relative&&(w+=l.x,C+=l.y);let[N,k]=i.multiply(w,C);const $=$c(h,p,_,x,N,k,m,g);u=cr($.min.y-r,u),c=cr($.min.x-r,c),d=dr($.max.x+r,d),f=dr($.max.y+r,f)}else s<=1&&(u=cr(p-r,u),c=cr(h-r,c),d=dr(h+r,d),f=dr(p+r,f)),u=cr(g-r,u),c=cr(m-r,c),d=dr(m+r,d),f=dr(g+r,f)}return{top:u,left:c,right:d,bottom:f,width:d-c,height:f-u}}contains(e,i,r){const o=r||{},s=o.ignoreVisibility===!0;if(!s&&this.visible===!1||!s&&typeof this.opacity=="number"&&this.opacity<=0)return!1;const a=typeof o.tolerance=="number"?o.tolerance:0;this._update(!0);const l=this.getBoundingClientRect();if(!l||e<l.left-a||e>l.right+a||i<l.top-a||i>l.bottom+a)return!1;const c=this.worldMatrix,d=c&&c.inverse(m0);if(!d)return super.contains(e,i,o);const[u,f]=d.multiply(e,i,1),h=typeof o.precision=="number"&&!Number.isNaN(o.precision)?Math.max(1,Math.floor(o.precision)):8,p=t0(this,o.fill),m=n0(this,o.stroke),{polygons:g,segments:b}=Zy(this,h);if(p&&g.length>0&&Qy(g,u,f))return!0;if(m&&b.length>0){const y=typeof this.linewidth=="number"?this.linewidth:0;if(y>0&&e0(b,u,f)<=y/2+a)return!0}return!p&&!m?super.contains(e,i,o):p&&g.length===0?super.contains(e,i,o):!1}getPointAt(e,i){let r,o,s,a,l,c,d,u,f,h,p,m,g,b,y,_=this.length*Math.min(Math.max(e,0),1);const x=this.vertices.length,w=x-1;let C=null,N=null;for(let Z=0,O=this._lengths.length,A=0;Z<O;Z++){if(A+this._lengths[Z]>=_){this._closed?(r=ut(Z,x),o=ut(Z-1,x),Z===0&&(r=o,o=Z)):(r=Z,o=Math.min(Math.max(Z-1,0),w)),C=this.vertices[r],N=this.vertices[o],_-=A,this._lengths[Z]!==0?e=_/this._lengths[Z]:e=0;break}A+=this._lengths[Z]}if(C===null||N===null)return null;if(C){if(!N)return C}else return N;y=N.controls&&N.controls.right,b=C.controls&&C.controls.left,l=N.x,h=N.y,c=(y||N).x,p=(y||N).y,d=(b||C).x,m=(b||C).y,u=C.x,g=C.y,y&&N.relative&&(c+=N.x,p+=N.y),b&&C.relative&&(d+=C.x,m+=C.y),a=Mr(e,l,c,d,u),f=Mr(e,h,p,m,g);const k=Ot(l,c,e),$=Ot(h,p,e),v=Ot(c,d,e),E=Ot(p,m,e),P=Ot(d,u,e),F=Ot(m,g,e),R=Ot(k,v,e),M=Ot($,E,e),X=Ot(v,P,e),G=Ot(E,F,e);return re.isObject(i)?(i.x=a,i.y=f,i instanceof Ee&&(i.controls.left.x=R,i.controls.left.y=M,i.controls.right.x=X,i.controls.right.y=G,(typeof i.relative!="boolean"||i.relative)&&(i.controls.left.x-=a,i.controls.left.y-=f,i.controls.right.x-=a,i.controls.right.y-=f)),i.t=e,i):(s=new Ee(a,f,R-a,M-f,X-a,G-f,this._curved?ne.curve:ne.line),s.t=e,s)}plot(){if(this.curved)return Rc(this._collection,this.closed),this;for(let e=0;e<this._collection.length;e++)this._collection[e].command=e===0?ne.move:ne.line;return this}smooth(e){const i=e||{},r=i.type||"continuous",o=this._collection,s=o.length;if(s<2)return this;const a=this._closed||s>0&&o[s-1]&&o[s-1].command===ne.close,l=(h,p)=>{if(h==null)return p;if(typeof h=="number"){if(a)return ut(h,s);let g=h;return g<0&&(g+=s),Math.min(Math.max(g,0),s-1)}const m=o.indexOf(h);return m!==-1?m:p},c=a&&i.from===void 0&&i.to===void 0;let d=l(i.from,0),u=l(i.to,s-1);if(d>u)if(a)d-=s;else{const h=d;d=u,u=h}const f=u-d+1;for(let h=0;h<f;h+=1){const p=ut(d+h,s),m=o[p],g=!a&&p===0;m.command===ne.move&&!g&&(m.command=ne.line)}if(r==="continuous"||r==="asymmetric")a0(o,d,u,a,c,r==="asymmetric");else if(r==="catmull-rom"||r==="geometric"){const h={type:r,factor:i.factor};d0(o,d,u,a,c,h)}else throw new Error(`Path.smooth does not support type "${r}". Try 'continuous', 'asymmetric', 'catmull-rom', or 'geometric'.`);return this._automatic=!1,this._flagVertices=!0,this._flagLength=!0,this}subdivide(e){this._update();const i=this.vertices,r=i.length;if(r<2)return this;const o=[];let s=null,a=null;for(let l=0;l<r;l+=1){const c=i[l];if(!s||c.command===ne.move){const u=c.clone();o.push(u),s=c,a=c;continue}if(o0(c,s)){const f=Zs(c,s,e).length,h=o[o.length-1];let p=h.clone(),m=c.clone(),g=h,b=0;if(f<=1){const y=c.clone();o.push(y)}else{for(let _=1;_<f;_+=1){const x=_/f,w=1-b,C=w<=Number.EPSILON?x:(x-b)/w,N=s0(p,m,C);_n(g,"right",N.startOut.x-g.x,N.startOut.y-g.y);const k=N.anchor;o.push(k),g=k,p=k.clone(),b=x,_n(m,"left",N.endIn.x-m.x,N.endIn.y-m.y)}const y=c.clone();y.controls.left.copy(m.controls.left),o.push(y)}}else{const u=Zs(c,s,e);for(let h=1;h<u.length;h+=1){const p=u[h];Gc(p,s),Ut(p,"left"),Ut(p,"right"),p.command=ne.line,o.push(p)}const f=c.clone();o.push(f)}s=c,c.command===ne.close&&(s=a)}return this._automatic=!1,this._curved=!1,this.vertices=o,this}_updateLength(e,i){i||this._update();const o=this.vertices.length-1;let s=this.vertices[o],a=0;return typeof this._lengths>"u"&&(this._lengths=[]),re.each(this.vertices,function(l,c){if(c<=0||l.command===ne.move){s=l,this._lengths[c]=0;return}this._lengths[c]=Wc(l,s,e),a+=this._lengths[c],s=l},this),this._length=a,this._flagLength=!1,this}_update(){if(this._flagVertices){this._automatic&&this.plot(),this._flagLength&&this._updateLength(void 0,!0);const e=this._collection.length,i=this._closed,r=Math.min(this._beginning,this._ending),o=Math.max(this._beginning,this._ending),s=wo(this,r*this._length),a=wo(this,o*this._length),l=u0(s),c=f0(a);let d,u,f,h,p,m;for(this._renderer.vertices.length=0,m=0;m<e;m++)this._renderer.collection.length<=m&&this._renderer.collection.push(new Ee),m>c&&!u?(p=this._renderer.collection[m].copy(this._collection[m]),this.getPointAt(o,p),p.command=this._renderer.collection[m].command,this._renderer.vertices.push(p),u=p,f=this._collection[m-1],f&&f.controls&&(p.relative?p.controls.right.clear():p.controls.right.copy(p),f.relative?this._renderer.collection[m-1].controls.right.copy(f.controls.right).lerp(ie.zero,1-p.t):this._renderer.collection[m-1].controls.right.copy(f.controls.right).lerp(f,1-p.t))):m>=l&&m<=c&&(p=this._renderer.collection[m].copy(this._collection[m]),this._renderer.vertices.push(p),m===c&&Hc(this,o)?(u=p,!i&&u.controls&&(u.relative?u.controls.right.clear():u.controls.right.copy(u))):m===l&&Hc(this,r)&&(d=p,d.command=ne.move,!i&&d.controls&&(d.relative?d.controls.left.clear():d.controls.left.copy(d))));l>0&&!d&&(m=l-1,p=this._renderer.collection[m].copy(this._collection[m]),this.getPointAt(r,p),p.command=ne.move,this._renderer.vertices.unshift(p),h=this._collection[m+1],h&&h.controls&&(p.controls.left.clear(),h.relative?this._renderer.collection[m+1].controls.left.copy(h.controls.left).lerp(ie.zero,p.t):(h0.copy(h),this._renderer.collection[m+1].controls.left.copy(h.controls.left).lerp(h,p.t))))}return qn.prototype._update.apply(this,arguments),this}flagReset(){return this._flagVertices=this._flagLength=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagCap=this._flagJoin=this._flagMiter=this._flagClip=this._flagStrokeAttenuation=!1,qn.prototype.flagReset.call(this),this}};S(ea,"Properties",["fill","stroke","linewidth","opacity","visible","cap","join","miter","closed","curved","automatic","beginning","ending","dashes","strokeAttenuation"]),S(ea,"Utils",{getCurveLength:Wc});var Pe=ea,Qc={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(n){this._linewidth=n,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(n){this._opacity=n,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(n){this._visible=n,this._flagVisible=!0}},cap:{enumerable:!0,get:function(){return this._cap},set:function(n){this._cap=n,this._flagCap=!0}},join:{enumerable:!0,get:function(){return this._join},set:function(n){this._join=n,this._flagJoin=!0}},miter:{enumerable:!0,get:function(){return this._miter},set:function(n){this._miter=n,this._flagMiter=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(n){(this._fill instanceof pt||this._fill instanceof et||this._fill instanceof tt||this._fill instanceof De)&&this._fill.unbind(ee.Types.change,this._renderer.flagFill),this._fill=n,this._flagFill=!0,(this._fill instanceof pt||this._fill instanceof et||this._fill instanceof tt||this._fill instanceof De)&&this._fill.bind(ee.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(n){(this._stroke instanceof pt||this._stroke instanceof et||this._stroke instanceof tt||this._stroke instanceof De)&&this._stroke.unbind(ee.Types.change,this._renderer.flagStroke),this._stroke=n,this._flagStroke=!0,(this._stroke instanceof pt||this._stroke instanceof et||this._stroke instanceof tt||this._stroke instanceof De)&&this._stroke.bind(ee.Types.change,this._renderer.flagStroke)}},length:{get:function(){return this._flagLength&&this._updateLength(),this._length}},closed:{enumerable:!0,get:function(){return this._closed},set:function(n){this._closed=!!n,this._flagVertices=!0}},curved:{enumerable:!0,get:function(){return this._curved},set:function(n){this._curved=!!n,this._flagVertices=!0}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(n){if(n===this._automatic)return;this._automatic=!!n;const e=this._automatic?"ignore":"listen";re.each(this.vertices,function(i){i[e]()})}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(n){this._beginning=n,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(n){this._ending=n,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(n){const e=this._renderer.bindVertices,i=this._renderer.unbindVertices;this._collection&&this._collection.unbind(ee.Types.insert,e).unbind(ee.Types.remove,i),n instanceof di?this._collection=n:this._collection=new di(n||[]),this._collection.bind(ee.Types.insert,e).bind(ee.Types.remove,i),e(this._collection)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(n){this._mask=n,this._flagMask=!0,re.isObject(n)&&!n.clip&&(n.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(n){this._clip=n,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(n){typeof n.offset!="number"&&(n.offset=this.dashes&&this._dashes.offset||0),this._dashes=n}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(n){this._strokeAttenuation=!!n,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};function Jc(){this._flagVertices=!0,this._flagLength=!0,this.parent&&(this.parent._flagLength=!0)}function ed(n){let e=n.length;for(;e--;)n[e].bind(ee.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function td(n){let e=n.length;for(;e--;)n[e].unbind(ee.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function nd(){this._flagFill=!0}function id(){this._flagStroke=!0}var rd=class oo extends Pe{constructor(e,i,r,o){const s=[new Ee,new Ee,new Ee,new Ee];super(s,!0,!1,!0),S(this,"_flagWidth",!1),S(this,"_flagHeight",!1),S(this,"_width",0),S(this,"_height",0),S(this,"_origin",null),this._renderer.type="rectangle";for(let a in od)Object.defineProperty(this,a,od[a]);this.width=typeof r=="number"?r:1,this.height=typeof o=="number"?o:1,this.origin=new ie,typeof e=="number"&&(this.translation.x=e),typeof i=="number"&&(this.translation.y=i),this._update()}static fromObject(e){const i=new oo().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<oo.Properties.length;i++){const r=oo.Properties[i];r in e&&(typeof e[r]=="number"?this[r]=e[r]:this[r]instanceof ie&&this[r].copy(e[r]))}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){const e=this._width/2,i=this._height/2;!this._closed&&this.vertices.length===4&&this.vertices.push(new Ee),this.vertices[0].set(-e,-i).sub(this._origin).command=ne.move,this.vertices[1].set(e,-i).sub(this._origin).command=ne.line,this.vertices[2].set(e,i).sub(this._origin).command=ne.line,this.vertices[3].set(-e,i).sub(this._origin).command=ne.line,this.vertices[4]&&(this.vertices[4].set(-e,-i).sub(this._origin).command=ne.line)}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(e){const i=new oo(0,0,this.width,this.height);i.translation.copy(this.translation),i.rotation=this.rotation,i.scale=this.scale,i.skewX=this.skewX,i.skewY=this.skewY,this.matrix.manual&&i.matrix.copy(this.matrix);for(let r=0;r<Pe.Properties.length;r++){const o=Pe.Properties[r];i[o]instanceof ie?i[o].copy(this[o]):i[o]=this[o]}return e&&e.add(i),i}toObject(){const e=super.toObject.call(this);return e.renderer.type="rectangle",e.width=this.width,e.height=this.height,e.origin=this.origin.toObject(),e}};S(rd,"Properties",["width","height","origin"]);var fi=rd,od={width:{enumerable:!0,get:function(){return this._width},set:function(n){this._width=n,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(n){this._height=n,this._flagHeight=!0}},origin:{enumerable:!0,get:function(){return this._origin},set:function(n){this._origin&&this._origin.unbind(ee.Types.change,this._renderer.flagVertices),this._origin=n,this._origin.bind(ee.Types.change,this._renderer.flagVertices),this._renderer.flagVertices()}}},sd=class so extends fi{constructor(e,i,r,o,s,a){super(i,r,0,0),S(this,"_flagTexture",!1),S(this,"_flagColumns",!1),S(this,"_flagRows",!1),S(this,"_flagFrameRate",!1),S(this,"_flagIndex",!1),S(this,"_amount",1),S(this,"_duration",0),S(this,"_startTime",0),S(this,"_playing",!1),S(this,"_firstFrame",0),S(this,"_lastFrame",0),S(this,"_loop",!0),S(this,"_texture",null),S(this,"_columns",1),S(this,"_rows",1),S(this,"_frameRate",0),S(this,"_index",0),S(this,"_origin",null),this._renderer.type="sprite";for(let l in ad)Object.defineProperty(this,l,ad[l]);this.noStroke(),this.noFill(),e instanceof De?this.texture=e:typeof e=="string"&&(this.texture=new De(e)),this.origin=new ie,this._update(),typeof o=="number"&&(this.columns=o),typeof s=="number"&&(this.rows=s),typeof a=="number"&&(this.frameRate=a),this.index=0}static fromObject(e){const i=new so().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<so.Properties.length;i++){const r=so.Properties[i];r in e&&(this[r]=e[r])}return this}play(e,i,r){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=re.performance.now(),typeof e=="number"&&(this._firstFrame=e),typeof i=="number"&&(this._lastFrame=i),typeof r=="function"?this._onLastFrame=r:delete this._onLastFrame,this._index!==this._firstFrame&&(this._startTime-=1e3*Math.abs(this._index-this._firstFrame)/this._frameRate),this}pause(){return this._playing=!1,this}stop(){return this._playing=!1,this._index=0,this}clone(e){const i=new so(this.texture,this.translation.x,this.translation.y,this.columns,this.rows,this.frameRate);return this.playing&&i.play(this._firstFrame,this._lastFrame),i.loop=this.loop,i.firstFrame=this.firstFrame,i.lastFrame=this.lastFrame,e&&e.add(i),i}toObject(){const e=super.toObject.call(this);return e.renderer.type="sprite",e.texture=this.texture.toObject(),e.columns=this.columns,e.rows=this.rows,e.frameRate=this.frameRate,e.index=this.index,e.firstFrame=this.firstFrame,e.lastFrame=this.lastFrame,e.loop=this.loop,e}dispose(){return super.dispose(),this._playing&&(this._playing=!1),this._onLastFrame=null,this._startTime=0,this._texture&&typeof this._texture.dispose=="function"?this._texture.dispose():this._texture&&typeof this._texture.unbind=="function"&&this._texture.unbind(),this}_update(){const e=this._texture,i=this._columns,r=this._rows;let o,s,a,l,c,d,u,f,h;if(e&&((this._flagColumns||this._flagRows)&&(this._amount=this._columns*this._rows),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._flagTexture&&(this.fill=e),e.loaded)){u=e.image.width,f=e.image.height,o=u/i,s=f/r,l=this._amount,this.width!==o&&(this.width=o),this.height!==s&&(this.height=s),this._playing&&this._frameRate>0&&(re.isNaN(this._lastFrame)&&(this._lastFrame=l-1),a=re.performance.now()-this._startTime,h=this._lastFrame+1,c=1e3*(h-this._firstFrame)/this._frameRate,this._loop?a=a%c:a=Math.min(a,c),d=Ot(this._firstFrame,h,a/c),d=Math.floor(d),d!==this._index&&(this._index=d,d>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()));const p=this._index%i,m=Math.floor(this._index/i),g=-o*p+(u-o)/2,b=-s*m+(f-s)/2;g!==e.offset.x&&(e.offset.x=g),b!==e.offset.y&&(e.offset.y=b)}return super._update.call(this),this}flagReset(){return this._flagTexture=this._flagColumns=this._flagRows=this._flagFrameRate=!1,super.flagReset.call(this),this}};S(sd,"Properties",["texture","columns","rows","frameRate","index","firstFrame","lastFrame","loop"]);var Bo=sd,ad={texture:{enumerable:!0,get:function(){return this._texture},set:function(n){this._texture=n,this._flagTexture=!0}},columns:{enumerable:!0,get:function(){return this._columns},set:function(n){this._columns=n,this._flagColumns=!0}},rows:{enumerable:!0,get:function(){return this._rows},set:function(n){this._rows=n,this._flagRows=!0}},frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(n){this._frameRate=n,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(n){this._index=n,this._flagIndex=!0}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(n){this._firstFrame=n}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(n){this._lastFrame=n}},loop:{enumerable:!0,get:function(){return this._loop},set:function(n){this._loop=!!n}}},ta,ld=class extends di{constructor(e){e=Array.isArray(e)?e:Array.prototype.slice.call(arguments),super(e),wc(this,ta,{}),this.attach(e),this.on(ee.Types.insert,this.attach),this.on(ee.Types.remove,this.detach)}get ids(){return Xt(this,ta)}attach(e){for(let i=0;i<e.length;i++){const r=e[i];r&&r.id&&(this.ids[r.id]=r)}return this}detach(e){for(let i=0;i<e.length;i++)delete this.ids[e[i].id];return this}};ta=new WeakMap;var cd=class Zi extends Pe{constructor(e,i,r,o,s,a,l){const c=l||Bt.Resolution*3,d=[];for(let u=0;u<c;u++)d.push(new Ee);super(d,!0,!1,!0),S(this,"_flagStartAngle",!1),S(this,"_flagEndAngle",!1),S(this,"_flagInnerRadius",!1),S(this,"_flagOuterRadius",!1),S(this,"_startAngle",0),S(this,"_endAngle",ot),S(this,"_innerRadius",0),S(this,"_outerRadius",0),this._renderer.type="arc-segment";for(let u in dd)Object.defineProperty(this,u,dd[u]);typeof r=="number"&&(this.innerRadius=r),typeof o=="number"&&(this.outerRadius=o),typeof s=="number"&&(this.startAngle=s),typeof a=="number"&&(this.endAngle=a),this._update(),typeof e=="number"&&(this.translation.x=e),typeof i=="number"&&(this.translation.y=i)}static fromObject(e){const i=new Zi().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<Zi.Properties.length;i++){const r=Zi.Properties[i];r in e&&typeof e[r]=="number"&&(this[r]=e[r])}return this}_update(){if(this._flagVertices||this._flagStartAngle||this._flagEndAngle||this._flagInnerRadius||this._flagOuterRadius){const e=this._startAngle,i=this._endAngle,r=this._innerRadius,o=this._outerRadius,s=ut(e,ot)===ut(i,ot),a=r>0,l=this.vertices;let c=a?l.length/2:l.length,d,u=0,f,h,p,m,g,b,y,_,x;for(s?c--:a||(c-=2),f=0,h=c-1;f<c;f++){switch(p=f/h,m=l[u],g=p*(i-e)+e,b=(i-e)/c,y=o*Math.cos(g),_=o*Math.sin(g),f){case 0:d=ne.move;break;default:d=ne.curve}m.command=d,m.x=y,m.y=_,m.controls.left.clear(),m.controls.right.clear(),m.command===ne.curve&&(x=o*b/Math.PI,m.controls.left.x=x*Math.cos(g-mt),m.controls.left.y=x*Math.sin(g-mt),m.controls.right.x=x*Math.cos(g+mt),m.controls.right.y=x*Math.sin(g+mt),f===1&&m.controls.left.multiplyScalar(2),f===h&&m.controls.right.multiplyScalar(2)),u++}if(a){for(s?(l[u].command=ne.close,u++):(c--,h=c-1),f=0;f<c;f++)p=f/h,m=l[u],g=(1-p)*(i-e)+e,b=(i-e)/c,y=r*Math.cos(g),_=r*Math.sin(g),d=ne.curve,f<=0&&(d=s?ne.move:ne.line),m.command=d,m.x=y,m.y=_,m.controls.left.clear(),m.controls.right.clear(),m.command===ne.curve&&(x=r*b/Math.PI,m.controls.left.x=x*Math.cos(g+mt),m.controls.left.y=x*Math.sin(g+mt),m.controls.right.x=x*Math.cos(g-mt),m.controls.right.y=x*Math.sin(g-mt),f===1&&m.controls.left.multiplyScalar(2),f===h&&m.controls.right.multiplyScalar(2)),u++;l[u].copy(l[0]),l[u].command=ne.line}else s||(l[u].command=ne.line,l[u].x=0,l[u].y=0,u++,l[u].copy(l[0]),l[u].command=ne.line)}return super._update.call(this),this}flagReset(){return super.flagReset.call(this),this._flagStartAngle=this._flagEndAngle=this._flagInnerRadius=this._flagOuterRadius=!1,this}clone(e){const i=this.innerRadius,r=this.outerRadius,o=this.startAngle,s=this.endAngle,a=this.vertices.length,l=new Zi(0,0,i,r,o,s,a);l.translation.copy(this.translation),l.rotation=this.rotation,l.scale=this.scale,l.skewX=this.skewX,l.skewY=this.skewY,this.matrix.manual&&l.matrix.copy(this.matrix);for(let c=0;c<Pe.Properties.length;c++){const d=Pe.Properties[c];l[d]=this[d]}return e&&e.add(l),l}toObject(){const e=super.toObject.call(this);e.renderer.type="arc-segment";for(let i=0;i<Zi.Properties.length;i++){const r=Zi.Properties[i];e[r]=this[r]}return e}};S(cd,"Properties",["startAngle","endAngle","innerRadius","outerRadius"]);var na=cd,dd={startAngle:{enumerable:!0,get:function(){return this._startAngle},set:function(n){this._startAngle=n,this._flagStartAngle=!0}},endAngle:{enumerable:!0,get:function(){return this._endAngle},set:function(n){this._endAngle=n,this._flagEndAngle=!0}},innerRadius:{enumerable:!0,get:function(){return this._innerRadius},set:function(n){this._innerRadius=n,this._flagInnerRadius=!0}},outerRadius:{enumerable:!0,get:function(){return this._outerRadius},set:function(n){this._outerRadius=n,this._flagOuterRadius=!0}}},ia=Math.cos,ra=Math.sin,ud=class Qi extends Pe{constructor(e,i,r,o){const s=o?Math.max(o,2):4,a=[];for(let l=0;l<s;l++)a.push(new Ee(0,0,0,0,0,0));super(a,!0,!0,!0),S(this,"_flagRadius",!1),S(this,"_radius",0),this._renderer.type="circle";for(let l in fd)Object.defineProperty(this,l,fd[l]);typeof r=="number"&&(this.radius=r),this._update(),typeof e=="number"&&(this.translation.x=e),typeof i=="number"&&(this.translation.y=i)}static fromObject(e){const i=new Qi().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<Qi.Properties.length;i++){const r=Qi.Properties[i];r in e&&typeof e[r]=="number"&&(this[r]=e[r])}return this}_update(){if(this._flagVertices||this._flagRadius){let e=this.vertices.length;!this._closed&&e>2&&(e-=1);const i=4/3*Math.tan(Math.PI/(e*2)),r=this._radius,o=r*i;for(let s=0;s<this.vertices.length;s++){const l=s/e*ot,c=r*ia(l),d=r*ra(l),u=o*ia(l-mt),f=o*ra(l-mt),h=o*ia(l+mt),p=o*ra(l+mt),m=this.vertices[s];m.command=s===0?ne.move:ne.curve,m.set(c,d),m.controls.left.set(u,f),m.controls.right.set(h,p)}}return super._update.call(this),this}flagReset(){return this._flagRadius=!1,super.flagReset.call(this),this}clone(e){const i=new Qi(0,0,this.radius,this.vertices.length);i.translation.copy(this.translation),i.rotation=this.rotation,i.scale=this.scale,i.skewX=this.skewX,i.skewY=this.skewY,this.matrix.manual&&i.matrix.copy(this.matrix);for(let r=0;r<Pe.Properties.length;r++){const o=Pe.Properties[r];i[o]=this[o]}return e&&e.add(i),i}toObject(){const e=super.toObject.call(this);e.renderer.type="circle";for(let i=0;i<Qi.Properties.length;i++){const r=Qi.Properties[i];e[r]=this[r]}return e}};S(ud,"Properties",["radius"]);var No=ud,fd={radius:{enumerable:!0,get:function(){return this._radius},set:function(n){this._radius=n,this._flagRadius=!0}}},oa=Math.cos,sa=Math.sin,hd=class Ji extends Pe{constructor(e,i,r,o,s){typeof o!="number"&&typeof r=="number"&&(o=r);const a=s?Math.max(s,2):4,l=[];for(let c=0;c<a;c++)l.push(new Ee);super(l,!0,!0,!0),S(this,"_flagWidth",!1),S(this,"_flagHeight",!1),S(this,"_width",0),S(this,"_height",0),this._renderer.type="ellipse";for(let c in md)Object.defineProperty(this,c,md[c]);typeof r=="number"&&(this.width=r*2),typeof o=="number"&&(this.height=o*2),this._update(),typeof e=="number"&&(this.translation.x=e),typeof i=="number"&&(this.translation.y=i)}static fromObject(e){const i=new Ji().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<Ji.Properties.length;i++){const r=Ji.Properties[i];r in e&&typeof e[r]=="number"&&(this[r]=e[r])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){let e=this.vertices.length;!this._closed&&e>2&&(e-=1);const i=4/3*Math.tan(Math.PI/(this.vertices.length*2)),r=this._width/2,o=this._height/2;for(let s=0;s<this.vertices.length;s++){const l=s/e*ot,c=r*oa(l),d=o*sa(l),u=r*i*oa(l-mt),f=o*i*sa(l-mt),h=r*i*oa(l+mt),p=o*i*sa(l+mt),m=this.vertices[s];m.command=s===0?ne.move:ne.curve,m.set(c,d),m.controls.left.set(u,f),m.controls.right.set(h,p)}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(e){const i=this.width/2,r=this.height/2,o=this.vertices.length,s=new Ji(0,0,i,r,o);s.translation.copy(this.translation),s.rotation=this.rotation,s.scale=this.scale,s.skewX=this.skewX,s.skewY=this.skewY,this.matrix.manual&&s.matrix.copy(this.matrix);for(let a=0;a<Pe.Properties.length;a++){const l=Pe.Properties[a];s[l]=this[l]}return e&&e.add(s),s}toObject(){const e=super.toObject.call(this);e.renderer.type="ellipse";for(let i=0;i<Ji.Properties.length;i++){const r=Ji.Properties[i];e[r]=this[r]}return e}};S(hd,"Properties",["width","height"]);var To=hd,md={width:{enumerable:!0,get:function(){return this._width},set:function(n){this._width=n,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(n){this._height=n,this._flagHeight=!0}}},p0=Math.ceil,g0=Math.floor,pd=class xi extends qn{constructor(e){super(),S(this,"_flagVertices",!0),S(this,"_flagLength",!0),S(this,"_flagFill",!0),S(this,"_flagStroke",!0),S(this,"_flagLinewidth",!0),S(this,"_flagOpacity",!0),S(this,"_flagVisible",!0),S(this,"_flagSize",!0),S(this,"_flagSizeAttenuation",!0),S(this,"_flagStrokeAttenuation",!0),S(this,"_length",0),S(this,"_fill","#fff"),S(this,"_stroke","#000"),S(this,"_linewidth",1),S(this,"_opacity",1),S(this,"_visible",!0),S(this,"_size",1),S(this,"_sizeAttenuation",!1),S(this,"_beginning",0),S(this,"_ending",1),S(this,"_dashes",null),S(this,"_strokeAttenuation",!0),S(this,"noFill",Pe.prototype.noFill),S(this,"noStroke",Pe.prototype.noStroke),S(this,"corner",Pe.prototype.corner),S(this,"center",Pe.prototype.center),S(this,"getBoundingClientRect",Pe.prototype.getBoundingClientRect),S(this,"_updateLength",Pe.prototype._updateLength);for(let i in gd)Object.defineProperty(this,i,gd[i]);this._renderer.type="points",this._renderer.flagVertices=Jc.bind(this),this._renderer.bindVertices=ed.bind(this),this._renderer.unbindVertices=td.bind(this),this._renderer.flagFill=nd.bind(this),this._renderer.flagStroke=id.bind(this),this._renderer.vertices=null,this._renderer.collection=null,this.size=1,this.sizeAttenuation=!1,this.beginning=0,this.ending=1,this.fill="#fff",this.stroke="#000",this.linewidth=1,this.opacity=1,this.className="",this.visible=!0,this.vertices=e,this.dashes=[],this.dashes.offset=0}static fromObject(e){const i=typeof e.fill=="string"?e.fill:Bi(e.fill),r=typeof e.stroke=="string"?e.stroke:Bi(e.stroke),o=new xi().copy(Ls(Vr({},e),{fill:i,stroke:r}));return"id"in e&&(o.id=e.id),o}copy(e){super.copy.call(this,e);for(let i=0;i<e.vertices.length;i++){const r=e.vertices[i];r instanceof Ee?this.vertices.push(e.vertices[i].clone()):this.vertices.push(new Ee().copy(r))}for(let i=0;i<xi.Properties.length;i++){const r=xi.Properties[i];r in e&&(this[r]=e[r])}return this}clone(e){const i=new xi;for(let r=0;r<this.vertices.length;r++)i.vertices.push(this.vertices[r].clone());for(let r=0;r<xi.Properties.length;r++){const o=xi.Properties[r];i[o]=this[o]}return i.className=this.className,i.translation.copy(this.translation),i.rotation=this.rotation,i.scale=this.scale,i.skewX=this.skewX,i.skewY=this.skewY,this.matrix.manual&&i.matrix.copy(this.matrix),e&&e.add(i),i._update()}toObject(){const e=super.toObject.call(this);return e.renderer.type="points",e.vertices=this.vertices.map(i=>i.toObject()),re.each(xi.Properties,function(i){typeof this[i]<"u"&&(this[i].toObject?e[i]=this[i].toObject():e[i]=this[i])},this),e}dispose(){if(super.dispose(),this.vertices&&typeof this.vertices.unbind=="function")try{this.vertices.unbind()}catch{}if(this.vertices)for(let e=0;e<this.vertices.length;e++){const i=this.vertices[e];typeof i.unbind=="function"&&i.unbind()}return typeof this.fill=="object"&&typeof this.fill.dispose=="function"?this.fill.dispose():typeof this.fill=="object"&&typeof this.fill.unbind=="function"&&this.fill.unbind(),typeof this.stroke=="object"&&typeof this.stroke.dispose=="function"?this.stroke.dispose():typeof this.stroke=="object"&&typeof this.stroke.unbind=="function"&&this.stroke.unbind(),this}subdivide(e){this._update();let i=[];for(let r=0;r<this.vertices.length;r++){const o=this.vertices[r],s=this.vertices[r-1];if(!s)continue;const a=o.x,l=o.y,c=s.x,d=s.y,u=js(a,l,a,l,c,d,c,d,e);i=i.concat(u)}return this.vertices=i,this}_update(){if(this._flagVertices){this._flagLength&&this._updateLength(void 0,!0);const e=Math.min(this._beginning,this._ending),i=Math.max(this._beginning,this._ending),r=wo(this,e*this._length),o=wo(this,i*this._length),s=p0(r),a=g0(o);let l=0,c;this._renderer.vertices=[],this._renderer.collection=[];for(let d=0;d<this._collection.length;d++)d>=s&&d<=a&&(c=this._collection[d],this._renderer.collection.push(c),this._renderer.vertices[l*2+0]=c.x,this._renderer.vertices[l*2+1]=c.y,l++)}return super._update.apply(this,arguments),this}flagReset(){return this._flagVertices=this._flagLength=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagSize=this._flagSizeAttenuation=!1,super.flagReset.call(this),this}};S(pd,"Properties",["fill","stroke","linewidth","opacity","visible","size","sizeAttenuation","beginning","ending","dashes","strokeAttenuation"]);var aa=pd,gd={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(n){this._linewidth=n,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(n){this._opacity=n,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(n){this._visible=n,this._flagVisible=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(n){this._size=n,this._flagSize=!0}},sizeAttenuation:{enumerable:!0,get:function(){return this._sizeAttenuation},set:function(n){this._sizeAttenuation=n,this._flagSizeAttenuation=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(n){(this._fill instanceof pt||this._fill instanceof et||this._fill instanceof tt||this._fill instanceof De)&&this._fill.unbind(ee.Types.change,this._renderer.flagFill),this._fill=n,this._flagFill=!0,(this._fill instanceof pt||this._fill instanceof et||this._fill instanceof tt||this._fill instanceof De)&&this._fill.bind(ee.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(n){(this._stroke instanceof pt||this._stroke instanceof et||this._stroke instanceof tt||this._stroke instanceof De)&&this._stroke.unbind(ee.Types.change,this._renderer.flagStroke),this._stroke=n,this._flagStroke=!0,(this._stroke instanceof pt||this._stroke instanceof et||this._stroke instanceof tt||this._stroke instanceof De)&&this._stroke.bind(ee.Types.change,this._renderer.flagStroke)}},length:{get:function(){return this._flagLength&&this._updateLength(),this._length}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(n){this._beginning=n,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(n){this._ending=n,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(n){const e=this._renderer.bindVertices,i=this._renderer.unbindVertices;this._collection&&this._collection.unbind(ee.Types.insert,e).unbind(ee.Types.remove,i),n instanceof di?this._collection=n:this._collection=new di(n||[]),this._collection.bind(ee.Types.insert,e).bind(ee.Types.remove,i),e(this._collection)}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(n){typeof n.offset!="number"&&(n.offset=this.dashes&&this._dashes.offset||0),this._dashes=n}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(n){this._strokeAttenuation=!!n,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}},y0=Math.cos,b0=Math.sin,yd=class er extends Pe{constructor(e,i,r,o){o=Math.max(o||0,3),super(),S(this,"_flagWidth",!1),S(this,"_flagHeight",!1),S(this,"_flagSides",!1),S(this,"_radius",0),S(this,"_width",0),S(this,"_height",0),S(this,"_sides",0),this._renderer.type="polygon";for(let s in bd)Object.defineProperty(this,s,bd[s]);this.closed=!0,this.automatic=!1,typeof r=="number"&&(this.radius=r),typeof o=="number"&&(this.sides=o),this._update(),typeof e=="number"&&(this.translation.x=e),typeof i=="number"&&(this.translation.y=i)}static fromObject(e){const i=new er().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<er.Properties.length;i++){const r=er.Properties[i];r in e&&typeof e[r]=="number"&&(this[r]=e[r])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagSides){const e=this._sides,i=e+1;let r=this.vertices.length;r>e&&(this.vertices.splice(e-1,r-e),r=e);for(let o=0;o<i;o++){const s=(o+.5)/e,a=ot*s+Math.PI/2,l=this._width*y0(a)/2,c=this._height*b0(a)/2;o>=r?this.vertices.push(new Ee(l,c)):this.vertices[o].set(l,c),this.vertices[o].command=o===0?ne.move:ne.line}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=this._flagSides=!1,super.flagReset.call(this),this}clone(e){const i=new er(0,0,0,this.sides);i.translation.copy(this.translation),i.rotation=this.rotation,i.scale=this.scale,i.skewX=this.skewX,i.skewY=this.skewY,i.width=this.width,i.height=this.height,this.matrix.manual&&i.matrix.copy(this.matrix);for(let r=0;r<Pe.Properties.length;r++){const o=Pe.Properties[r];i[o]=this[o]}return e&&e.add(i),i}toObject(){const e=super.toObject.call(this);e.renderer.type="polygon";for(let i=0;i<er.Properties.length;i++){const r=er.Properties[i];e[r]=this[r]}return e}};S(yd,"Properties",["width","height","sides"]);var la=yd,bd={radius:{enumerable:!0,get:function(){return this._radius},set:function(n){this._radius=n,this.width=n*2,this.height=n*2}},width:{enumerable:!0,get:function(){return this._width},set:function(n){this._width=n,this._flagWidth=!0,this._radius=Math.max(this.width,this.height)/2}},height:{enumerable:!0,get:function(){return this._height},set:function(n){this._height=n,this._flagHeight=!0,this._radius=Math.max(this.width,this.height)/2}},sides:{enumerable:!0,get:function(){return this._sides},set:function(n){this._sides=n,this._flagSides=!0}}},_d=class tr extends Pe{constructor(e,i,r,o,s){typeof s>"u"&&typeof r=="number"&&typeof o=="number"&&(s=Math.floor(Math.min(r,o)/12));const a=[];for(let l=0;l<10;l++)a.push(new Ee(0,0,0,0,0,0,l===0?ne.move:ne.curve));super(a),S(this,"_flagWidth",!1),S(this,"_flagHeight",!1),S(this,"_flagRadius",!1),S(this,"_width",0),S(this,"_height",0),S(this,"_radius",12),this._renderer.type="rounded-rectangle";for(let l in wd)Object.defineProperty(this,l,wd[l]);this.closed=!0,this.automatic=!1,this._renderer.flagRadius=_0.bind(this),typeof r=="number"&&(this.width=r),typeof o=="number"&&(this.height=o),(typeof s=="number"||s instanceof ie)&&(this.radius=s),this._update(),typeof e=="number"&&(this.translation.x=e),typeof i=="number"&&(this.translation.y=i)}static fromObject(e){const i=new tr().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<tr.Properties.length;i++){const r=tr.Properties[i];if(r in e){const o=e[r];/radius/i.test(r)?this[r]=typeof o=="number"||o instanceof ie?o:new ie().copy(o):typeof o=="number"&&(this[r]=o)}}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagRadius){const e=this._width,i=this._height;let r,o;this._radius instanceof ie?(r=this._radius.x,o=this._radius.y):(r=this._radius,o=this._radius);let s,a=e/2,l=i/2;s=this.vertices[0],s.x=-(a-r),s.y=-l,s=this.vertices[1],s.x=a-r,s.y=-l,s.controls.left.clear(),s.controls.right.x=r,s.controls.right.y=0,s=this.vertices[2],s.x=a,s.y=-(l-o),s.controls.right.clear(),s.controls.left.clear(),s=this.vertices[3],s.x=a,s.y=l-o,s.controls.left.clear(),s.controls.right.x=0,s.controls.right.y=o,s=this.vertices[4],s.x=a-r,s.y=l,s.controls.right.clear(),s.controls.left.clear(),s=this.vertices[5],s.x=-(a-r),s.y=l,s.controls.left.clear(),s.controls.right.x=-r,s.controls.right.y=0,s=this.vertices[6],s.x=-a,s.y=l-o,s.controls.left.clear(),s.controls.right.clear(),s=this.vertices[7],s.x=-a,s.y=-(l-o),s.controls.left.clear(),s.controls.right.x=0,s.controls.right.y=-o,s=this.vertices[8],s.x=-(a-r),s.y=-l,s.controls.left.clear(),s.controls.right.clear(),s=this.vertices[9],s.copy(this.vertices[8])}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=this._flagRadius=!1,super.flagReset.call(this),this}clone(e){const i=this.width,r=this.height,o=this.radius,s=new tr(0,0,i,r,o);s.translation.copy(this.translation),s.rotation=this.rotation,s.scale=this.scale,s.skewX=this.skewX,s.skewY=this.skewY,this.matrix.manual&&s.matrix.copy(this.matrix);for(let a=0;a<Pe.Properties.length;a++){const l=Pe.Properties[a];s[l]=this[l]}return e&&e.add(s),s}toObject(){const e=super.toObject.call(this);e.renderer.type="rounded-rectangle";for(let i=0;i<tr.Properties.length;i++){const r=tr.Properties[i];e[r]=this[r]}return e.radius=typeof this.radius=="number"?this.radius:this.radius.toObject(),e}};S(_d,"Properties",["width","height","radius"]);var $o=_d,wd={width:{enumerable:!0,get:function(){return this._width},set:function(n){this._width=n,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(n){this._height=n,this._flagHeight=!0}},radius:{enumerable:!0,get:function(){return this._radius},set:function(n){this._radius instanceof ie&&this._radius.unbind(ee.Types.change,this._renderer.flagRadius),this._radius=n,this._radius instanceof ie&&this._radius.bind(ee.Types.change,this._renderer.flagRadius),this._flagRadius=!0}}};function _0(){this._flagRadius=!0}var w0=Math.cos,x0=Math.sin,xd=class nr extends Pe{constructor(e,i,r,o,s){arguments.length<=3&&(o=r,r=o/2),(typeof s!="number"||s<=0)&&(s=5),super(),S(this,"_flagInnerRadius",!1),S(this,"_flagOuterRadius",!1),S(this,"_flagSides",!1),S(this,"_innerRadius",0),S(this,"_outerRadius",0),S(this,"_sides",0),this._renderer.type="star";for(let a in kd)Object.defineProperty(this,a,kd[a]);this.closed=!0,this.automatic=!1,typeof r=="number"&&(this.innerRadius=r),typeof o=="number"&&(this.outerRadius=o),typeof s=="number"&&(this.sides=s),this._update(),typeof e=="number"&&(this.translation.x=e),typeof i=="number"&&(this.translation.y=i)}static fromObject(e){const i=new nr().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<nr.Properties.length;i++){const r=nr.Properties[i];r in e&&typeof e[r]=="number"&&(this[r]=e[r])}return this}_update(){if(this._flagVertices||this._flagInnerRadius||this._flagOuterRadius||this._flagSides){const e=this._sides*2,i=e+1;let r=this.vertices.length;r>e&&(this.vertices.splice(e-1,r-e),r=e);for(let o=0;o<i;o++){const s=(o+.5)/e,a=ot*s,l=(o%2?this._outerRadius:this._innerRadius)/2,c=l*w0(a),d=l*x0(a);o>=r?this.vertices.push(new Ee(c,d)):this.vertices[o].set(c,d),this.vertices[o].command=o===0?ne.move:ne.line}}return super._update.call(this),this}flagReset(){return this._flagInnerRadius=this._flagOuterRadius=this._flagSides=!1,super.flagReset.call(this),this}clone(e){const i=this.innerRadius,r=this.outerRadius,o=this.sides,s=new nr(0,0,i,r,o);s.translation.copy(this.translation),s.rotation=this.rotation,s.scale=this.scale,s.skewX=this.skewX,s.skewY=this.skewY,this.matrix.manual&&s.matrix.copy(this.matrix);for(let a=0;a<Pe.Properties.length;a++){const l=Pe.Properties[a];s[l]=this[l]}return e&&e.add(s),s}toObject(){const e=super.toObject.call(this);e.renderer.type="star";for(let i=0;i<nr.Properties.length;i++){const r=nr.Properties[i];e[r]=this[r]}return e}};S(xd,"Properties",["innerRadius","outerRadius","sides"]);var ca=xd,kd={innerRadius:{enumerable:!0,get:function(){return this._innerRadius},set:function(n){this._innerRadius=n,this._flagInnerRadius=!0}},outerRadius:{enumerable:!0,get:function(){return this._outerRadius},set:function(n){this._outerRadius=n,this._flagOuterRadius=!0}},sides:{enumerable:!0,get:function(){return this._sides},set:function(n){this._sides=n,this._flagSides=!0}}},da,Cd=Math.min,vd=Math.max;Je.document&&(da=document.createElement("canvas"));var ua=class cn extends qn{constructor(e,i,r,o){super(),S(this,"_flagValue",!0),S(this,"_flagFamily",!0),S(this,"_flagSize",!0),S(this,"_flagLeading",!0),S(this,"_flagAlignment",!0),S(this,"_flagBaseline",!0),S(this,"_flagStyle",!0),S(this,"_flagWeight",!0),S(this,"_flagDecoration",!0),S(this,"_flagFill",!0),S(this,"_flagStroke",!0),S(this,"_flagLinewidth",!0),S(this,"_flagOpacity",!0),S(this,"_flagVisible",!0),S(this,"_flagMask",!1),S(this,"_flagClip",!1),S(this,"_flagDirection",!0),S(this,"_flagStrokeAttenuation",!0),S(this,"_value",""),S(this,"_family","sans-serif"),S(this,"_size",13),S(this,"_leading",17),S(this,"_alignment","center"),S(this,"_baseline","middle"),S(this,"_style","normal"),S(this,"_weight",500),S(this,"_decoration","none"),S(this,"_direction","ltr"),S(this,"_fill","#000"),S(this,"_stroke","none"),S(this,"_linewidth",1),S(this,"_opacity",1),S(this,"_visible",!0),S(this,"_mask",null),S(this,"_clip",!1),S(this,"_dashes",null),S(this,"_strokeAttenuation",!0);for(let s in Sd)Object.defineProperty(this,s,Sd[s]);if(this._renderer.type="text",this._renderer.flagFill=k0.bind(this),this._renderer.flagStroke=C0.bind(this),this.value=e,typeof i=="number"&&(this.translation.x=i),typeof r=="number"&&(this.translation.y=r),this.dashes=[],this.dashes.offset=0,!re.isObject(o))return this;for(let s=0;s<cn.Properties.length;s++){const a=cn.Properties[s];a in o&&(this[a]=o[a])}}static Measure(e){if(da){const i=da.getContext("2d");i.font=[e._style,e._weight,`${e._size}px/${e._leading}px`,e._family].join(" ");const r=i.measureText(e.value,0,0),o=r.actualBoundingBoxDescent+r.actualBoundingBoxAscent;return{width:r.width,height:o}}else{const i=this.value.length*this.size*cn.Ratio,r=this.leading;return console.warn("Two.Text: unable to accurately measure text, so using an approximation."),{width:i,height:r}}}static fromObject(e){const i=typeof e.fill=="string"?e.fill:Bi(e.fill),r=typeof e.stroke=="string"?e.stroke:Bi(e.stroke),o=new cn().copy(Ls(Vr({},e),{fill:i,stroke:r}));return"id"in e&&(o.id=e.id),o}copy(e){super.copy.call(this,e);for(let i=0;i<cn.Properties.length;i++){const r=cn.Properties[i];r in e&&(this[r]=e[r])}return this}clone(e){const i=new cn(this.value);i.translation.copy(this.translation),i.rotation=this.rotation,i.scale=this.scale;for(let r=0;r<cn.Properties.length;r++){const o=cn.Properties[r];i[o]=this[o]}return this.matrix.manual&&i.matrix.copy(this.matrix),e&&e.add(i),i._update()}toObject(){const e=super.toObject.call(this);e.renderer.type="text";for(let i=0;i<cn.Properties.length;i++){const r=cn.Properties[i];e[r]=this[r]}return e}dispose(){return super.dispose(),typeof this.fill=="object"&&typeof this.fill.dispose=="function"?this.fill.dispose():typeof this.fill=="object"&&typeof this.fill.unbind=="function"&&this.fill.unbind(),typeof this.stroke=="object"&&typeof this.stroke.dispose=="function"?this.stroke.dispose():typeof this.stroke=="object"&&typeof this.stroke.unbind=="function"&&this.stroke.unbind(),this}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}getBoundingClientRect(e){let i,r,o,s,a;this._update(!0),i=e?this.matrix:this.worldMatrix;const{width:l,height:c}=cn.Measure(this),d=(this._linewidth||0)/2;switch(this.alignment){case"left":r=-d,o=l+d;break;case"right":r=-(l+d),o=d;break;default:r=-(l/2+d),o=l/2+d}switch(this.baseline){case"middle":s=-(c/2+d),a=c/2+d;break;default:s=-(c+d),a=d}const[u,f]=i.multiply(r,s),[h,p]=i.multiply(r,a),[m,g]=i.multiply(o,s),[b,y]=i.multiply(o,a);return s=Cd(f,p,g,y),r=Cd(u,h,m,b),o=vd(u,h,m,b),a=vd(f,p,g,y),{top:s,left:r,right:o,bottom:a,width:o-r,height:a-s}}flagReset(){return super.flagReset.call(this),this._flagValue=this._flagFamily=this._flagSize=this._flagLeading=this._flagAlignment=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagClip=this._flagDecoration=this._flagClassName=this._flagBaseline=this._flagWeight=this._flagStyle=this._flagDirection=!1,this}};S(ua,"Ratio",.6),S(ua,"Properties",["value","family","size","leading","alignment","linewidth","style","weight","decoration","direction","baseline","opacity","visible","fill","stroke","dashes","strokeAttenuation"]);var Tn=ua,Sd={value:{enumerable:!0,get:function(){return this._value},set:function(n){this._value=n,this._flagValue=!0}},family:{enumerable:!0,get:function(){return this._family},set:function(n){this._family=n,this._flagFamily=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(n){this._size=n,this._flagSize=!0}},leading:{enumerable:!0,get:function(){return this._leading},set:function(n){this._leading=n,this._flagLeading=!0}},alignment:{enumerable:!0,get:function(){return this._alignment},set:function(n){this._alignment=n,this._flagAlignment=!0}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(n){this._linewidth=n,this._flagLinewidth=!0}},style:{enumerable:!0,get:function(){return this._style},set:function(n){this._style=n,this._flagStyle=!0}},weight:{enumerable:!0,get:function(){return this._weight},set:function(n){this._weight=n,this._flagWeight=!0}},decoration:{enumerable:!0,get:function(){return this._decoration},set:function(n){this._decoration=n,this._flagDecoration=!0}},direction:{enumerable:!0,get:function(){return this._direction},set:function(n){this._direction=n,this._flagDirection=!0}},baseline:{enumerable:!0,get:function(){return this._baseline},set:function(n){this._baseline=n,this._flagBaseline=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(n){this._opacity=n,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(n){this._visible=n,this._flagVisible=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(n){(this._fill instanceof pt||this._fill instanceof et||this._fill instanceof tt||this._fill instanceof De)&&this._fill.unbind(ee.Types.change,this._renderer.flagFill),this._fill=n,this._flagFill=!0,(this._fill instanceof pt||this._fill instanceof et||this._fill instanceof tt||this._fill instanceof De)&&this._fill.bind(ee.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(n){(this._stroke instanceof pt||this._stroke instanceof et||this._stroke instanceof tt||this._stroke instanceof De)&&this._stroke.unbind(ee.Types.change,this._renderer.flagStroke),this._stroke=n,this._flagStroke=!0,(this._stroke instanceof pt||this._stroke instanceof et||this._stroke instanceof tt||this._stroke instanceof De)&&this._stroke.bind(ee.Types.change,this._renderer.flagStroke)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(n){this._mask=n,this._flagMask=!0,re.isObject(n)&&!n.clip&&(n.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(n){this._clip=n,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(n){typeof n.offset!="number"&&(n.offset=this.dashes&&this._dashes.offset||0),this._dashes=n}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(n){this._strokeAttenuation=!!n,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};function k0(){this._flagFill=!0}function C0(){this._flagStroke=!0}var fa=class Sr extends fi{constructor(e,i,r,o){super(i,r,0,0),S(this,"_flagTextures",!1),S(this,"_flagFrameRate",!1),S(this,"_flagIndex",!1),S(this,"_amount",1),S(this,"_duration",0),S(this,"_index",0),S(this,"_startTime",0),S(this,"_playing",!1),S(this,"_firstFrame",0),S(this,"_lastFrame",0),S(this,"_loop",!0),S(this,"_textures",null),S(this,"_frameRate",0),S(this,"_origin",null),this._renderer.type="image-sequence";for(let s in Bd)Object.defineProperty(this,s,Bd[s]);this._renderer.flagTextures=v0.bind(this),this._renderer.bindTextures=S0.bind(this),this._renderer.unbindTextures=B0.bind(this),this.noStroke(),this.noFill(),Array.isArray(e)?this.textures=e.map(Nd.bind(this)):typeof e=="string"&&(this.textures=[Nd(e)]),this.origin=new ie,this._update(),typeof o=="number"?this.frameRate=o:this.frameRate=Sr.DefaultFrameRate,this.index=0}static fromObject(e){const i=new Sr().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<Sr.Properties.length;i++){const r=Sr.Properties[i];r in e&&(this[r]=e[r])}return this}play(e,i,r){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=re.performance.now(),typeof e=="number"&&(this._firstFrame=e),typeof i=="number"&&(this._lastFrame=i),typeof r=="function"?this._onLastFrame=r:delete this._onLastFrame,this._index!==this._firstFrame&&(this._startTime-=1e3*Math.abs(this._index-this._firstFrame)/this._frameRate),this}pause(){return this._playing=!1,this}stop(){return this._playing=!1,this._index=this._firstFrame,this}clone(e){const i=new Sr(this.textures,this.translation.x,this.translation.y,this.frameRate);return i._loop=this._loop,this._playing&&i.play(),e&&e.add(i),i}toObject(){const e=super.toObject.call(this);return e.renderer.type="image-sequence",e.textures=this.textures.map(function(i){return i.toObject()}),e.frameRate=this.frameRate,e.index=this.index,e.firstFrame=this.firstFrame,e.lastFrame=this.lastFrame,e.loop=this.loop,e}dispose(){if(super.dispose(),this._playing&&(this._playing=!1),this._onLastFrame=null,this.textures&&typeof this.textures.unbind=="function")try{this.textures.unbind()}catch{}if(this.textures)for(let e=0;e<this.textures.length;e++){const i=this.textures[e];typeof i.dispose=="function"?i.dispose():typeof i.unbind=="function"&&i.unbind()}return this}_update(){const e=this._textures;let i,r,o,s,a,l,c,d;return e&&(this._flagTextures&&(this._amount=e.length),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._playing&&this._frameRate>0?(s=this._amount,re.isNaN(this._lastFrame)&&(this._lastFrame=s-1),o=re.performance.now()-this._startTime,d=this._lastFrame+1,a=1e3*(d-this._firstFrame)/this._frameRate,this._loop?o=o%a:o=Math.min(o,a),c=Ot(this._firstFrame,d,o/a),c=Math.floor(c),c!==this._index&&(this._index=c,l=e[this._index],l.loaded&&(i=l.image.width,r=l.image.height,this.width!==i&&(this.width=i),this.height!==r&&(this.height=r),this.fill=l,c>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()))):(this._flagIndex||!(this.fill instanceof De))&&(l=e[this._index],l.loaded&&(i=l.image.width,r=l.image.height,this.width!==i&&(this.width=i),this.height!==r&&(this.height=r)),this.fill=l)),super._update.call(this),this}flagReset(){return this._flagTextures=this._flagFrameRate=!1,super.flagReset.call(this),this}};S(fa,"Properties",["textures","frameRate","index","firstFrame","lastFrame","loop"]),S(fa,"DefaultFrameRate",30);var ha=fa,Bd={frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(n){this._frameRate=n,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(n){this._index=n,this._flagIndex=!0}},textures:{enumerable:!0,get:function(){return this._textures},set:function(n){const e=this._renderer.bindTextures,i=this._renderer.unbindTextures;this._textures&&this._textures.unbind(ee.Types.insert,e).unbind(ee.Types.remove,i),this._textures=new di((n||[]).slice(0)),this._textures.bind(ee.Types.insert,e).bind(ee.Types.remove,i),e(this._textures)}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(n){this._firstFrame=n}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(n){this._lastFrame=n}},loop:{enumerable:!0,get:function(){return this._loop},set:function(n){this._loop=!!n}}};function v0(){this._flagTextures=!0}function S0(n){let e=n.length;for(;e--;)n[e].bind(ee.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function B0(n){let e=n.length;for(;e--;)n[e].unbind(ee.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function Nd(n){if(n instanceof De)return n;if(typeof n=="string")return new De(n)}var Eo=Math.min,Ro=Math.max,N0={getShapesAtPoint:{results:[],hitOptions:{},context:{x:0,y:0,visibleOnly:!0,results:null},single:[],empty:[]}},ma=class gn extends qn{constructor(e){super(),S(this,"_flagAdditions",!1),S(this,"_flagSubtractions",!1),S(this,"_flagOrder",!1),S(this,"_flagOpacity",!0),S(this,"_flagBeginning",!1),S(this,"_flagEnding",!1),S(this,"_flagLength",!1),S(this,"_flagMask",!1),S(this,"_fill","#fff"),S(this,"_stroke","#000"),S(this,"_linewidth",1),S(this,"_opacity",1),S(this,"_visible",!0),S(this,"_cap","round"),S(this,"_join","round"),S(this,"_miter",4),S(this,"_closed",!0),S(this,"_curved",!1),S(this,"_automatic",!0),S(this,"_beginning",0),S(this,"_ending",1),S(this,"_length",0),S(this,"_mask",null),S(this,"_strokeAttenuation",!0);for(let i in Td)Object.defineProperty(this,i,Td[i]);this._renderer.type="group",this.additions=[],this.subtractions=[],this.children=Array.isArray(e)?e:Array.prototype.slice.call(arguments)}static InsertChildren(e){for(let i=0;i<e.length;i++)$d.call(this,e[i],this)}static RemoveChildren(e){for(let i=0;i<e.length;i++)$d.call(this,e[i])}static OrderChildren(e){this._flagOrder=!0}static fromObject(e){const i=new gn;for(let o=0;o<gn.Properties.length;o++){const s=gn.Properties[o];s in e&&(/(fill|stroke)/i.test(s)?i[s]=typeof e[s]=="string"?e[s]:Bi(e[s]):i[s]=e[s])}return"mask"in e&&(i.mask=r(e.mask)),"id"in e&&(i.id=e.id),i.children=e.children.map(r),i;function r(o){if(o&&o.renderer)switch(o.renderer.type){case"arc-segment":return na.fromObject(o);case"circle":return No.fromObject(o);case"element":return sr.fromObject(o);case"ellipse":return To.fromObject(o);case"group":return gn.fromObject(o);case"image":return Image.fromObject(o);case"image-sequence":return ha.fromObject(o);case"path":return Pe.fromObject(o);case"points":return aa.fromObject(o);case"polygon":return la.fromObject(o);case"rectangle":return fi.fromObject(o);case"rounded-rectangle":return $o.fromObject(o);case"shape":return qn.fromObject(o);case"sprite":return Bo.fromObject(o);case"star":return ca.fromObject(o);case"text":return Tn.fromObject(o)}return o}}static IsVisible(e,i){if(!i)return!0;let r=e;for(;r;){if(typeof r.visible=="boolean"&&!r.visible||typeof r.opacity=="number"&&r.opacity<=0)return!1;r=r.parent}return!0}static VisitForHitTest(e,i,r,o,s,a,l){const c=e&&e.children;if(!c)return!1;const d=i.results;for(let u=c.length-1;u>=0;u--){const f=c[u];if(!f||!gn.IsVisible(f,i.visibleOnly))continue;const h=typeof f.getBoundingClientRect=="function"?f.getBoundingClientRect():null;if(!(h&&!i0(h,i.x,i.y,a))){if(f instanceof gn){if(r&&(!o||o(f))&&typeof f.contains=="function"&&f.contains(i.x,i.y,s)&&(d.push(f),l)||gn.VisitForHitTest(f,i,r,o,s,a,l))return!0;continue}if(f instanceof qn&&!(o&&!o(f))&&typeof f.contains=="function"&&f.contains(i.x,i.y,s)&&(d.push(f),l))return!0}}return!1}copy(e){super.copy.call(this,e),console.warn("Two.js: attempting to copy group. Two.Group.children copying not supported.");for(let i=0;i<gn.Properties.length;i++){const r=gn.Properties[i];r in e&&(this[r]=e[r])}return this}clone(e){const i=new gn,r=this.children.map(function(o){return o.clone()});return i.add(r),i.opacity=this.opacity,this.mask&&(i.mask=this.mask),i.translation.copy(this.translation),i.rotation=this.rotation,i.scale=this.scale,i.className=this.className,this.matrix.manual&&i.matrix.copy(this.matrix),e&&e.add(i),i._update()}toObject(){const e=super.toObject.call(this);return e.renderer.type="group",e.children=[],e.opacity=this.opacity,e.className=this.className,e.mask=this.mask?this.mask.toObject():null,re.each(this.children,(i,r)=>{e.children[r]=i.toObject()},this),e}dispose(){if(super.dispose(),this.children)for(let e=0;e<this.children.length;e++){const i=this.children[e];typeof i.dispose=="function"&&i.dispose()}if(this.children&&typeof this.children.unbind=="function")try{this.children.unbind()}catch{}return this}getShapesAtPoint(e,i,r){const o=r||{},{results:s,hitOptions:a,context:l,single:c,empty:d}=N0.getShapesAtPoint;s.length=0;const u=o.mode==="deepest"||o.deepest?"deepest":"all",f=o.visibleOnly!==!1,h=!!o.includeGroups,p=typeof o.filter=="function"?o.filter:null,m=typeof o.tolerance=="number"?o.tolerance:0;typeof o.precision=="number"?a.precision=o.precision:delete a.precision,typeof o.fill<"u"?a.fill=o.fill:delete a.fill,typeof o.stroke<"u"?a.stroke=o.stroke:delete a.stroke,a.tolerance=m,a.ignoreVisibility=!f;const g=u==="deepest";if(l.x=e,l.y=i,l.visibleOnly=f,l.results=s,gn.VisitForHitTest(this,l,h,p,a,m,g),g){if(s.length>0){const y=s[0];return s.length=0,c[0]=y,c.length=1,c}return d.length=0,d}const b=s.slice();return s.length=0,b}corner(){const e=this.getBoundingClientRect(!0);for(let i=0;i<this.children.length;i++){const r=this.children[i];r.translation.x-=e.left,r.translation.y-=e.top}return this.mask&&(this.mask.translation.x-=e.left,this.mask.translation.y-=e.top),this}center(){const e=this.getBoundingClientRect(!0),i=e.left+e.width/2-this.translation.x,r=e.top+e.height/2-this.translation.y;for(let o=0;o<this.children.length;o++){const s=this.children[o];s.isShape&&(s.translation.x-=i,s.translation.y-=r)}return this.mask&&(this.mask.translation.x-=i,this.mask.translation.y-=r),this}getById(e){let i=null;function r(o){if(o.id===e)return o;if(o.children){if(o.children.ids[e])return o.children.ids[e];for(let s=0;s<o.children.length;s++)if(i=r(o.children[s]),i)return i}return null}return r(this)}getByClassName(e){const i=[];function r(o){if(Array.prototype.indexOf.call(o.classList,e)>=0&&i.push(o),o.children)for(let s=0;s<o.children.length;s++){const a=o.children[s];r(a)}return i}return r(this)}getByType(e){const i=[];function r(o){if(o instanceof e&&i.push(o),o.children)for(let s=0;s<o.children.length;s++){const a=o.children[s];r(a)}return i}return r(this)}add(e){e instanceof Array?e=e.slice():e=Array.prototype.slice.call(arguments);for(let i=0;i<e.length;i++){const r=e[i];if(!(r&&r.id))continue;const o=Array.prototype.indexOf.call(this.children,r);o>=0&&this.children.splice(o,1),this.children.push(r)}return this}remove(e){const i=arguments.length,r=this.parent;if(i<=0&&r)return r.remove(this),this;e instanceof Array?e=e.slice():e=Array.prototype.slice.call(arguments);for(let o=0;o<e.length;o++){const s=e[o];if(!s||!this.children.ids[s.id])continue;const a=this.children.indexOf(s);a>=0&&this.children.splice(a,1)}return this}getBoundingClientRect(e){let i,r,o,s,a,l;this._update(!0);let c=1/0,d=-1/0,u=1/0,f=-1/0;const h=/texture|gradient/i;r=e?this.matrix:this.worldMatrix;for(let p=0;p<this.children.length;p++){const m=this.children[p];if(!(!m.visible||h.test(m._renderer.type))&&(i=m.getBoundingClientRect(e),o=typeof i.top!="number"||re.isNaN(i.top)||!isFinite(i.top),s=typeof i.left!="number"||re.isNaN(i.left)||!isFinite(i.left),a=typeof i.right!="number"||re.isNaN(i.right)||!isFinite(i.right),l=typeof i.bottom!="number"||re.isNaN(i.bottom)||!isFinite(i.bottom),!(o||s||a||l)))if(e){const[g,b]=r.multiply(i.left,i.top),[y,_]=r.multiply(i.right,i.top),[x,w]=r.multiply(i.left,i.bottom),[C,N]=r.multiply(i.right,i.bottom);u=Eo(b,_,w,N,u),c=Eo(g,y,x,C,c),d=Ro(g,y,x,C,d),f=Ro(b,_,w,N,f)}else u=Eo(i.top,u),c=Eo(i.left,c),d=Ro(i.right,d),f=Ro(i.bottom,f)}return{top:u,left:c,right:d,bottom:f,width:d-c,height:f-u}}noFill(){return this.children.forEach(function(e){e.noFill()}),this}noStroke(){return this.children.forEach(function(e){e.noStroke()}),this}subdivide(){const e=arguments;return this.children.forEach(function(i){i.subdivide.apply(i,e)}),this}_update(){let e,i,r;if(this._flagBeginning||this._flagEnding){const o=Math.min(this._beginning,this._ending),s=Math.max(this._beginning,this._ending),a=this.length;let l=0;const c=o*a,d=s*a;for(e=0;e<this.children.length;e++)r=this.children[e],i=r.length,c>l+i?(r.beginning=1,r.ending=1):d<l?(r.beginning=0,r.ending=0):c>l&&c<l+i?(r.beginning=(c-l)/i,r.ending=1):d>l&&d<l+i?(r.beginning=0,r.ending=(d-l)/i):(r.beginning=0,r.ending=1),l+=i}return super._update.apply(this,arguments)}flagReset(){return this._flagAdditions&&(this.additions.length=0,this._flagAdditions=!1),this._flagSubtractions&&(this.subtractions.length=0,this._flagSubtractions=!1),this._flagOrder=this._flagMask=this._flagOpacity=this._flagBeginning=this._flagEnding=!1,super.flagReset.call(this),this}};S(ma,"Children",ld),S(ma,"Properties",["fill","stroke","linewidth","cap","join","miter","closed","curved","automatic"]);var xt=ma,Td={visible:{enumerable:!0,get:function(){return this._visible},set:function(n){this._flagVisible=this._visible!==n||this._flagVisible,this._visible=n}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(n){this._flagOpacity=this._opacity!==n||this._flagOpacity,this._opacity=n}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(n){this._flagBeginning=this._beginning!==n||this._flagBeginning,this._beginning=n}},ending:{enumerable:!0,get:function(){return this._ending},set:function(n){this._flagEnding=this._ending!==n||this._flagEnding,this._ending=n}},length:{enumerable:!0,get:function(){if(this._flagLength||this._length<=0){if(this._length=0,!this.children)return this._length;for(let n=0;n<this.children.length;n++){const e=this.children[n];this._length+=e.length}}return this._length}},fill:{enumerable:!0,get:function(){return this._fill},set:function(n){this._fill=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.fill=n}}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(n){this._stroke=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.stroke=n}}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(n){this._linewidth=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.linewidth=n}}},join:{enumerable:!0,get:function(){return this._join},set:function(n){this._join=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.join=n}}},miter:{enumerable:!0,get:function(){return this._miter},set:function(n){this._miter=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.miter=n}}},cap:{enumerable:!0,get:function(){return this._cap},set:function(n){this._cap=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.cap=n}}},closed:{enumerable:!0,get:function(){return this._closed},set:function(n){this._closed=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.closed=n}}},curved:{enumerable:!0,get:function(){return this._curved},set:function(n){this._curved=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.curved=n}}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(n){this._automatic=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.automatic=n}}},children:{enumerable:!0,get:function(){return this._children},set:function(n){const e=xt.InsertChildren.bind(this),i=xt.RemoveChildren.bind(this),r=xt.OrderChildren.bind(this);this._children&&(this._children.unbind(),this._children.length>0&&i(this._children)),this._children=new ld(n),this._children.bind(ee.Types.insert,e),this._children.bind(ee.Types.remove,i),this._children.bind(ee.Types.order,r),n.length>0&&e(n)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(n){this._mask=n,this._flagMask=!0,re.isObject(n)&&!n.clip&&(n.clip=!0)}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(n){this._strokeAttenuation=!!n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.strokeAttenuation!==void 0&&(i.strokeAttenuation=n)}}}};function $d(n,e){const i=n.parent;let r;if(i===e){o();return}if(i&&i.children.ids[n.id]&&(r=Array.prototype.indexOf.call(i.children,n),i.children.splice(r,1),s()),e){o();return}s(),i._flagAdditions&&i.additions.length===0&&(i._flagAdditions=!1),i._flagSubtractions&&i.subtractions.length===0&&(i._flagSubtractions=!1),delete n.parent;function o(){e.subtractions.length>0&&(r=Array.prototype.indexOf.call(e.subtractions,n),r>=0&&e.subtractions.splice(r,1)),e.additions.length>0&&(r=Array.prototype.indexOf.call(e.additions,n),r>=0&&e.additions.splice(r,1)),n.parent=e,e.additions.push(n),e._flagAdditions=!0}function s(){r=Array.prototype.indexOf.call(i.additions,n),r>=0&&i.additions.splice(r,1),r=Array.prototype.indexOf.call(i.subtractions,n),r<0&&(i.subtractions.push(n),i._flagSubtractions=!0)}}var Po=class extends Pe{constructor(e,i,r,o){const s=[new Ee(e,i),new Ee(r,o)];super(s);for(let a in Ed)Object.defineProperty(this,a,Ed[a]);this.vertices[0].command=ne.move,this.vertices[1].command=ne.line,this.automatic=!1}};S(Po,"Properties",["left","right"]);var Ed={left:{enumerable:!0,get:function(){return this.vertices[0]},set:function(n){if(re.isObject(n))this.vertices.splice(0,1,n),this.vertices[0].command=ne.move;else{const e=new Yt("Two.Line.left argument is not an object.");console.warn(e.name,e.message)}}},right:{enumerable:!0,get:function(){return this.vertices[1]},set:function(n){if(re.isObject(n))this.vertices.splice(1,1,n),this.vertices[1].command=ne.line;else{const e=new Yt("Two.Line.right argument is not an object.");console.warn(e.name,e.message)}}}},$n={path:/[+-]?(?:\d*\.\d+|\d+)(?:[eE][+-]\d+)?/g,cssBackgroundImage:/url\(['"]?#([\w\d-_]*)['"]?\)/i,unitSuffix:/[a-zA-Z%]*/i},T0={start:"left",middle:"center",end:"right"},Rd=["id","class","transform","xmlns","viewBox"],$0=["x","y","width","height","href","xlink:href"];function E0(n){return T0[n]}function R0(n){const e=n.getAttribute("dominant-baseline"),i=n.getAttribute("alignment-baseline");return e||i}function Ir(n){return n.replace(/svg:/gi,"").toLowerCase()}function Pd(n,e){if(e.x+=n.translateX,e.y+=n.translateY,e.x*=n.scaleX,e.y*=n.scaleY,n.rotation!==0){const i=e.length();e.x=i*Math.cos(n.rotation),e.y=i*Math.sin(n.rotation)}}function P0(n,e){e||(e={});const i=n.split(";");for(let r=0;r<i.length;r++){const o=i[r].split(":"),s=o[0],a=o[1];if(typeof s>"u"||typeof a>"u")continue;const l=s.replace(/\s/g,""),c=a.replace(/\s/g,"");e[l]=c}return e}function F0(n){const e={},i=V0(n),r=Math.max(i.length,n.style.length);for(let o=0;o<r;o++){const s=n.style[o],a=i[o];s&&(e[s]=n.style[s]),a&&(e[a]=n.getAttribute(a))}return e}function V0(n){const e=n.getAttributeNames();for(let i=0;i<Rd.length;i++){const r=Rd[i],o=Array.prototype.indexOf.call(e,r);o>=0&&e.splice(o,1)}return e}function M0(n,e){const i=e.split(/[\s,]/),r=-parseFloat(i[0]),o=-parseFloat(i[1]),s=parseFloat(i[2]),a=parseFloat(i[3]);if(r&&o)for(let f=0;f<n.children.length;f++){const h=n.children[f];"translation"in h?h.translation.add(r,o):"x"in h?h.x=r:"y"in h&&(h.y=o)}const l=typeof n.x=="number",c=typeof n.y=="number",d=typeof n.width=="number",u=typeof n.height=="number";return l&&(n.translation.x+=n.x),c&&(n.translation.y+=n.y),(d||u)&&(n.scale=new ie(1,1)),d&&(n.scale.x=n.width/s),u&&(n.scale.y=n.height/a),n.mask=new fi(0,0,s,a),n.mask.origin.set(-s/2,-a/2),n}function un(n,e,i){const r={},o={},s={};let a,l,c,d,u,f,h,p,m,g,b,y,_,x,w,C,N;if(n===null)return r;if(Je.getComputedStyle){const k=Je.getComputedStyle(n);for(a=k.length;a--;)c=k[a],d=k[c],typeof d<"u"&&(r[c]=d)}for(a=0;a<n.attributes.length;a++)f=n.attributes[a],/style/i.test(f.nodeName)?P0(f.value,s):o[f.nodeName]=f.value;typeof r.opacity<"u"&&(r["stroke-opacity"]=r.opacity,r["fill-opacity"]=r.opacity,delete r.opacity),i&&re.defaults(r,i),re.extend(r,s,o),r.visible=!(typeof r.display>"u"&&/none/i.test(r.display))||typeof r.visibility>"u"&&/hidden/i.test(r.visibility);for(c in r)switch(d=r[c],c){case"gradientTransform":if(/none/i.test(d)||(l=n.gradientTransform&&n.gradientTransform.baseVal&&n.gradientTransform.baseVal.length>0?n.gradientTransform.baseVal[0].matrix:n.getCTM?n.getCTM():null,l===null))break;switch(h=Si(l),e._renderer.type){case"linear-gradient":Pd(h,e.left),Pd(h,e.right);break;case"radial-gradient":e.center.x+=h.translateX,e.center.y+=h.translateY,e.focal.x+=h.translateX,e.focal.y+=h.translateY,e.radius*=Math.max(h.scaleX,h.scaleY);break}break;case"transform":if(/none/i.test(d)||(l=n.transform&&n.transform.baseVal&&n.transform.baseVal.length>0?n.transform.baseVal[0].matrix:n.getCTM?n.getCTM():null,l===null))break;h=Si(l),e.translation.set(h.translateX,h.translateY),e.rotation=Math.PI*(h.rotation/180),e.scale=new ie(h.scaleX,h.scaleY),p=parseFloat((r.x+"").replace("px")),m=parseFloat((r.y+"").replace("px")),p&&(e.translation.x=p),m&&(e.translation.y=m);break;case"visible":if(e instanceof xt){e._visible=d;break}e.visible=d;break;case"stroke-linecap":if(e instanceof xt){e._cap=d;break}e.cap=d;break;case"stroke-linejoin":if(e instanceof xt){e._join=d;break}e.join=d;break;case"stroke-miterlimit":if(e instanceof xt){e._miter=d;break}e.miter=d;break;case"stroke-width":if(e instanceof xt){e._linewidth=parseFloat(d);break}e.linewidth=parseFloat(d);break;case"opacity":case"stroke-opacity":case"fill-opacity":if(e instanceof xt){e._opacity=parseFloat(d);break}e.opacity=parseFloat(d);break;case"clip-path":if($n.cssBackgroundImage.test(d)&&(g=d.replace($n.cssBackgroundImage,"$1"),Ze.defs.current&&Ze.defs.current.contains(g)&&(y=Ze.defs.current.get(g),y&&y.childNodes.length>0)))switch(y=y.childNodes[0],_=Ir(y.nodeName),e.mask=Ze[_].call(this,y,{}),e._renderer.type){case"text":case"path":e.position.add(e.mask.position),e.mask.position.clear();break}break;case"fill":case"stroke":u=(e instanceof xt?"_":"")+c,$n.cssBackgroundImage.test(d)?(g=d.replace($n.cssBackgroundImage,"$1"),Ze.defs.current&&Ze.defs.current.contains(g)?(y=Ze.defs.current.get(g),y.object||(_=Ir(y.nodeName),y.object=Ze[_].call(this,y,{})),y=y.object):(b=A0(this),y=b.getById(g)),e[u]=y):e[u]=d;break;case"id":e.id=d;break;case"class":case"className":e.classList=d.split(" "),e._flagClassName=!0;break;case"x":case"y":if(x=e instanceof pt,w=e instanceof et,C=e instanceof tt,x||w||C)break;d.match("[a-z%]$")&&!d.endsWith("px")&&(N=new Yt("only pixel values are supported with the "+c+" attribute."),console.warn(N.name,N.message)),e.translation[c]=parseFloat(d);break;case"font-family":e instanceof Tn&&(e.family=d);break;case"font-size":e instanceof Tn&&(d.match("[a-z%]$")&&!d.endsWith("px")&&(N=new Yt("only pixel values are supported with the "+c+" attribute."),console.warn(N.name,N.message)),e.size=parseFloat(d));break;case"font-weight":e instanceof Tn&&(e.weight=d);break;case"font-style":e instanceof Tn&&(e.style=d);break;case"text-decoration":e instanceof Tn&&(e.decoration=d);break;case"line-height":e instanceof Tn&&(e.leading=d);break}return Object.keys(n.dataset).length&&(e.dataset=n.dataset),r}function I0(n,e){for(let i=0,r=n.childNodes.length;i<r;i++){const o=n.childNodes[i];!o.id||Ir(n.nodeName)==="#text"||e.add(o.id,o)}}function A0(n){for(;n.parent;)n=n.parent;return n.scene}var Ze={svg:function(n){const e=Ze.defs.current=new bo,i=n.getElementsByTagName("defs");for(let m=0;m<i.length;m++)I0(i[m],e);const r=Ze.g.call(this,n),o=n.getAttribute("viewBox"),s=n.getAttribute("x"),a=n.getAttribute("y"),l=n.getAttribute("width"),c=n.getAttribute("height");r.defs=e;const d=o!==null,u=s!==null,f=a!==null,h=l!==null,p=c!==null;return u&&(r.x=parseFloat(s.replace($n.unitSuffix,""))),f&&(r.y=parseFloat(a.replace($n.unitSuffix,""))),h&&(r.width=parseFloat(l.replace($n.unitSuffix,""))),p&&(r.height=parseFloat(c.replace($n.unitSuffix,""))),d&&M0(r,o),delete Ze.defs.current,r},defs:function(n){return null},use:function(n,e){let i;const r=n.getAttribute("href")||n.getAttribute("xlink:href");if(!r)return i=new Yt("encountered <use /> with no href."),console.warn(i.name,i.message),null;const o=r.slice(1);if(!Ze.defs.current.contains(o))return i=new Yt("unable to find element for reference "+r+"."),console.warn(i.name,i.message),null;const a=Ze.defs.current.get(o).cloneNode(!0);for(let c=0;c<n.attributes.length;c++){const d=n.attributes[c],u=$0.includes(d.nodeName),f=!a.hasAttribute(d.nodeName);(u||f)&&a.setAttribute(d.nodeName,d.value)}const l=Ir(a.nodeName);return Ze[l].call(this,a,e)},g:function(n,e){const i=new xt;un.call(this,n,i,e),this.add(i);const r=F0.call(this,n);for(let o=0,s=n.childNodes.length;o<s;o++){const a=n.childNodes[o],l=a.nodeName;if(!l)return;const c=Ir(l);if(c in Ze){const d=Ze[c].call(i,a,r);d&&!d.parent&&i.add(d)}}return i},polygon:function(n,e){let i;typeof n=="string"?i=n:i=n.getAttribute("points");const r=[];i.replace(/(-?[\d.eE-]+)[,|\s](-?[\d.eE-]+)/g,function(s,a,l){r.push(new Ee(parseFloat(a),parseFloat(l)))});const o=new Pe(r,!0);return o.stroke="none",o.fill="black",un.call(this,n,o,e),o},polyline:function(n,e){const i=Ze.polygon.call(this,n,e);return i.closed=!1,i},path:function(n,e){let i;typeof n=="string"?(i=n,n=null):i=n.getAttribute("d");let r=[],o=!1,s=!1;if(i){let l=new Ee,c,d,u=i.match(/[a-df-z][^a-df-z]*/gi);const f=u.length-1;re.each(u.slice(0),function(h,p){const m=h.slice(1).trim().match($n.path),g=h[0],b=g.toLowerCase();let y,_,x,w,C;const N=[];switch(p===0&&(u=[]),b){case"h":case"v":m.length>1&&(y=1);break;case"m":case"l":case"t":m.length>2&&(y=2);break;case"s":case"q":m.length>4&&(y=4);break;case"c":m.length>6&&(y=6);break;case"a":m.length>7&&(y=7);break}if(y){for(_=0,x=m.length,C=0;_<x;_+=y){if(w=g,C>0)switch(g){case"m":w="l";break;case"M":w="L";break}N.push(w+m.slice(_,_+y).join(" ")),C++}u=Array.prototype.concat.apply(u,N)}else u.push(h)}),re.each(u,function(h,p){let m,g,b;const y=h[0],_=y.toLowerCase();d=h.slice(1).trim().match($n.path),s=y===_;let x,w,C,N,k,$,v,E,P,F,R,M,X,G,Z,O,A;switch(_){case"z":if(p>=f)o=!0;else{g=l.x,b=l.y,m=new Ee(g,b,void 0,void 0,void 0,void 0,ne.close);for(let Y=r.length-1;Y>=0;Y--){const H=r[Y];if(/m/i.test(H.command)){l=H;break}}}break;case"m":case"l":c=void 0,g=parseFloat(d[0]),b=parseFloat(d[1]),m=new Ee(g,b,void 0,void 0,void 0,void 0,/m/i.test(_)?ne.move:ne.line),s&&m.addSelf(l),l=m;break;case"h":case"v":F=/h/i.test(_)?"x":"y",R=/x/i.test(F)?"y":"x",m=new Ee(void 0,void 0,void 0,void 0,void 0,void 0,ne.line),m[F]=parseFloat(d[0]),m[R]=l[R],s&&(m[F]+=l[F]),l=m;break;case"c":case"s":x=l.x,w=l.y,c||(c=new ie),/c/i.test(_)?(C=parseFloat(d[0]),N=parseFloat(d[1]),k=parseFloat(d[2]),$=parseFloat(d[3]),v=parseFloat(d[4]),E=parseFloat(d[5])):(P=qs(l,c,s),C=P.x,N=P.y,k=parseFloat(d[0]),$=parseFloat(d[1]),v=parseFloat(d[2]),E=parseFloat(d[3])),s&&(C+=x,N+=w,k+=x,$+=w,v+=x,E+=w),l.controls.right.set(C-l.x,N-l.y),m=new Ee(v,E,k-v,$-E,void 0,void 0,ne.curve),l=m,c=m.controls.left;break;case"t":case"q":x=l.x,w=l.y,c||(c=new ie),/q/i.test(_)?(C=parseFloat(d[0]),N=parseFloat(d[1]),k=parseFloat(d[0]),$=parseFloat(d[1]),v=parseFloat(d[2]),E=parseFloat(d[3])):(P=qs(l,c,s),C=P.x,N=P.y,k=P.x,$=P.y,v=parseFloat(d[0]),E=parseFloat(d[1])),s&&(C+=x,N+=w,k+=x,$+=w,v+=x,E+=w),l.controls.right.set((C-l.x)*.33,(N-l.y)*.33),m=new Ee(v,E,k-v,$-E,void 0,void 0,ne.curve),l=m,c=m.controls.left;break;case"a":x=l.x,w=l.y,X=parseFloat(d[0]),G=parseFloat(d[1]),Z=parseFloat(d[2]),O=parseFloat(d[3]),A=parseFloat(d[4]),v=parseFloat(d[5]),E=parseFloat(d[6]),s&&(v+=x,E+=w),M=new Ee(v,E),M.command=ne.arc,M.rx=X,M.ry=G,M.xAxisRotation=Z,M.largeArcFlag=O,M.sweepFlag=A,m=M,l=M,c=void 0;break}m&&(Array.isArray(m)?r=r.concat(m):r.push(m))})}i=new Pe(r,o,void 0,!0),i.stroke="none",i.fill="black";const a=i.getBoundingClientRect(!0);return a.centroid={x:a.left+a.width/2,y:a.top+a.height/2},re.each(i.vertices,function(l){l.subSelf(a.centroid)}),un.call(this,n,i,e),i.translation.addSelf(a.centroid),i},circle:function(n,e){const i=parseFloat(n.getAttribute("cx")),r=parseFloat(n.getAttribute("cy")),o=parseFloat(n.getAttribute("r")),s=new No(0,0,o);return s.stroke="none",s.fill="black",un.call(this,n,s,e),s.translation.x=i,s.translation.y=r,s},ellipse:function(n,e){const i=parseFloat(n.getAttribute("cx")),r=parseFloat(n.getAttribute("cy")),o=parseFloat(n.getAttribute("rx")),s=parseFloat(n.getAttribute("ry")),a=new To(0,0,o,s);return a.stroke="none",a.fill="black",un.call(this,n,a,e),a.translation.x=i,a.translation.y=r,a},rect:function(n,e){const i=parseFloat(n.getAttribute("rx")),r=parseFloat(n.getAttribute("ry"));if(!re.isNaN(i)||!re.isNaN(r))return Ze["rounded-rect"](n);const o=parseFloat(n.getAttribute("width")),s=parseFloat(n.getAttribute("height")),a=o/2,l=s/2,c=new fi(0,0,o,s);return c.stroke="none",c.fill="black",un.call(this,n,c,e),c.translation.x+=a,c.translation.y+=l,c},"rounded-rect":function(n,e){const i=parseFloat(n.getAttribute("rx"))||0,r=parseFloat(n.getAttribute("ry"))||0,o=parseFloat(n.getAttribute("width")),s=parseFloat(n.getAttribute("height")),a=o/2,l=s/2,c=new ie(i,r),d=new $o(0,0,o,s,c);return d.stroke="none",d.fill="black",un.call(this,n,d,e),d.translation.x+=a,d.translation.y+=l,d},line:function(n,e){const i=parseFloat(n.getAttribute("x1")),r=parseFloat(n.getAttribute("y1")),o=parseFloat(n.getAttribute("x2")),s=parseFloat(n.getAttribute("y2")),a=new Po(i,r,o,s).noFill();return un.call(this,n,a,e),a},lineargradient:function(n,e){let i=n.getAttribute("gradientUnits"),r=n.getAttribute("spreadMethod");i||(i="objectBoundingBox"),r||(r="pad");let o=parseFloat(n.getAttribute("x1")||0),s=parseFloat(n.getAttribute("y1")||0),a=parseFloat(n.getAttribute("x2")||0),l=parseFloat(n.getAttribute("y2")||0);const c=(a+o)/2,d=(l+s)/2;/userSpaceOnUse/i.test(i)&&(o-=c,s-=d,a-=c,l-=d);const u=[];for(let h=0;h<n.children.length;h++){const p=n.children[h];let m=p.getAttribute("offset");/%/gi.test(m)&&(m=parseFloat(m.replace(/%/gi,""))/100),m=parseFloat(m);let g=p.getAttribute("stop-color"),b=p.getAttribute("stop-opacity"),y=p.getAttribute("style"),_;g===null&&(_=y?y.match(/stop-color:\s?([#a-fA-F0-9]*)/):!1,g=_&&_.length>1?_[1]:void 0),b===null?(_=y?y.match(/stop-opacity:\s?([0-9.-]*)/):!1,b=_&&_.length>1?parseFloat(_[1]):1):b=parseFloat(b),u.push(new ui(m,g,b))}const f=new et(o,s,a,l,u);return f.spread=r,f.units=i,un.call(this,n,f,e),f},radialgradient:function(n,e){let i=n.getAttribute("gradientUnits"),r=n.getAttribute("spreadMethod");i||(i="objectBoundingBox"),r||(r="pad");let o=parseFloat(n.getAttribute("cx"))||0,s=parseFloat(n.getAttribute("cy"))||0,a=parseFloat(n.getAttribute("r")),l=parseFloat(n.getAttribute("fx")),c=parseFloat(n.getAttribute("fy"));re.isNaN(l)&&(l=o),re.isNaN(c)&&(c=s);const d=Math.abs(o+l)/2,u=Math.abs(s+c)/2;/userSpaceOnUse/i.test(i)&&(o-=d,s-=u,l-=d,c-=u);const f=[];for(let p=0;p<n.children.length;p++){const m=n.children[p];let g=m.getAttribute("offset");/%/gi.test(g)&&(g=parseFloat(g.replace(/%/gi,""))/100),g=parseFloat(g);let b=m.getAttribute("stop-color"),y=m.getAttribute("stop-opacity"),_=m.getAttribute("style"),x;b===null&&(x=_?_.match(/stop-color:\s?([#a-fA-F0-9]*)/):!1,b=x&&x.length>1?x[1]:void 0),y===null?(x=_?_.match(/stop-opacity:\s?([0-9.-]*)/):!1,y=x&&x.length>1?parseFloat(x[1]):1):y=parseFloat(y),f.push(new ui(g,b,y))}const h=new tt(o,s,a,f,l,c);return h.spread=r,h.units=i,un.call(this,n,h,e),h},text:function(n,e){const i=E0(n.getAttribute("text-anchor"))||"left",r=R0(n)||"baseline";let o="";n.childNodes.length>0&&n.childNodes[0].tagName==="TSPAN"?o=n.childNodes[0].textContent:o=n.textContent;const s=new Tn(o);return un.call(this,n,s,e),s.alignment=i,s.baseline=r,s},clippath:function(n,e){return Ze.defs.current&&!Ze.defs.current.contains(n.id)&&Ze.defs.current.add(n.id,n),null},image:function(n,e){let i;const r=n.getAttribute("href")||n.getAttribute("xlink:href");if(!r)return i=new Yt("encountered <image /> with no href."),console.warn(i.name,i.message),null;const o=parseFloat(n.getAttribute("x"))||0,s=parseFloat(n.getAttribute("y"))||0,a=parseFloat(n.getAttribute("width")),l=parseFloat(n.getAttribute("height")),c=new Bo(r,o,s);return re.isNaN(a)||(c.width=a),re.isNaN(l)||(c.height=l),un.call(this,n,c,e),c}};function Fd(n,e){const i=new XMLHttpRequest;return i.open("GET",n),i.onreadystatechange=function(){i.readyState===4&&i.status===200&&e(i.responseText)},i.send(),i}var pa=class Wn extends fi{constructor(e,i,r,o,s,a){super(i,r,o||1,s||1),S(this,"_flagTexture",!1),S(this,"_flagMode",!1),S(this,"_texture",null),S(this,"_mode","fill"),this._renderer.type="image";for(let l in Md)Object.defineProperty(this,l,Md[l]);this.noStroke(),this.noFill(),e instanceof De?this.texture=e:typeof e=="string"&&(this.texture=new De(e)),typeof a=="string"&&(this.mode=a),this._update()}static fromObject(e){const i=new Wn().copy(e);return"id"in e&&(i.id=e.id),i}copy(e){super.copy.call(this,e);for(let i=0;i<Wn.Properties.length;i++){const r=Wn.Properties[i];r in e&&(this[r]=e[r])}return this}clone(e){const i=new Wn(this.texture,this.translation.x,this.translation.y,this.width,this.height);return e&&e.add(i),i}toObject(){const e=super.toObject.call(this);return e.renderer.type="image",e.texture=this.texture.toObject(),e.mode=this.mode,e}dispose(){return super.dispose(),this._texture&&typeof this._texture.dispose=="function"?this._texture.dispose():this._texture&&typeof this._texture.unbind=="function"&&this._texture.unbind(),this}_update(){const e=this._texture;if(e&&(this._flagTexture&&(this.fill=e),e.loaded)){const i=e.image.width,r=e.image.height,o=this.width,s=this.height,a=o/i,l=s/r;switch(this._mode){case Wn.Modes.fill:{const c=Math.max(a,l);e.scale=c,e.offset.x=0,e.offset.y=0,e.repeat="repeat";break}case Wn.Modes.fit:{const c=Math.min(a,l);e.scale=c,e.offset.x=0,e.offset.y=0,e.repeat="no-repeat";break}case Wn.Modes.crop:break;case Wn.Modes.tile:{e.offset.x=(i-o)/2,e.offset.y=(r-s)/2,e.repeat="repeat";break}case Wn.Modes.stretch:default:e.scale=new ie(a,l),e.offset.x=0,e.offset.y=0,e.repeat="repeat"}}return super._update.call(this),this}flagReset(){return super.flagReset.call(this),this._flagTexture=this._flagMode=!1,this}};S(pa,"Modes",{fill:"fill",fit:"fit",crop:"crop",tile:"tile",stretch:"stretch"}),S(pa,"Properties",["texture","mode"]);var Vd=pa,Md={texture:{enumerable:!0,get:function(){return this._texture},set:function(n){this._texture=n,this._flagTexture=!0}},mode:{enumerable:!0,get:function(){return this._mode},set:function(n){this._mode=n,this._flagMode=!0}}},ga=[],ya=Math.max,O0=Math.min,Id=Math.abs,Fo=Math.sin,Vo=Math.cos,z0=Math.acos,Mo=Math.sqrt,Me={isHidden:/(undefined|none|transparent)/i,alignments:{left:"start",middle:"center",right:"end"},baselines:{top:"top",middle:"middle",bottom:"bottom",baseline:"alphabetic"},getRendererType:function(n){return n in Me?n:"path"},group:{renderChild:function(n){const e=Me.getRendererType(n._renderer.type);Me[e].render.call(n,this.ctx,!0,this.clip)},render:function(n){if(!this._visible)return this;re.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const e=this._matrix.elements,i=this.parent;this._renderer.opacity=this._opacity*(i&&i._renderer?i._renderer.opacity:1);const r=this._mask,o=Io(e),s=!o||!!r;if(this._renderer.context||(this._renderer.context={}),this._renderer.context.ctx=n,s&&(n.save(),o||n.transform(e[0],e[3],e[1],e[4],e[2],e[5])),r){const a=Me.getRendererType(r._renderer.type);Me[a].render.call(r,n,!0)}if(this._opacity>0&&this._scale!==0)for(let a=0;a<this.children.length;a++){const l=this.children[a],c=Me.getRendererType(l._renderer.type);Me[c].render.call(l,n)}return s&&n.restore(),re.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},path:{render:function(n,e,i){let r,o,s,a,l,c,d,u,f,h,p,m,g,b,y,_,x,w,C,N,k,$,v,E,P,F,R,M,X,G,Z,O,A,Y;if(Y=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,X=this._mask,G=this._clip,l=this._opacity*(Y||1),c=this._visible,!e&&(!c||G||l===0))return this;if(re.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),r=this._matrix.elements,o=this._stroke,s=this._linewidth,a=this._fill,d=this._cap,u=this._join,f=this._miter,h=this._closed,p=this._renderer.vertices,m=p.length,g=m-1,Z=Io(r),A=this.dashes,Z||(n.save(),n.transform(r[0],r[3],r[1],r[4],r[2],r[5])),X){const L=Me.getRendererType(X._renderer.type);Me[L].render.call(X,n,!0)}if(a)if(typeof a=="string")n.fillStyle=a;else{const L=Me.getRendererType(a._renderer.type);Me[L].render.call(a,n,this),n.fillStyle=a._renderer.effect}if(o){if(typeof o=="string")n.strokeStyle=o;else{const L=Me.getRendererType(o._renderer.type);Me[L].render.call(o,n,this),n.strokeStyle=o._renderer.effect}s&&(n.lineWidth=Nn(this)),f&&(n.miterLimit=f),u&&(n.lineJoin=u),!h&&d&&(n.lineCap=d)}typeof l=="number"&&(n.globalAlpha=l),A&&A.length>0&&(n.lineDashOffset=A.offset||0,n.setLineDash(A)),n.beginPath();let H,T,D,K,J,U,q;for(let L=0;L<m;L++)switch(_=p[L],R=_.x,M=_.y,_.command){case ne.close:n.closePath();break;case ne.arc:H=_.rx,T=_.ry,D=_.xAxisRotation,K=_.largeArcFlag,J=_.sweepFlag,b=h?ut(L-1,m):ya(L-1,0),y=p[b],U=y.x,q=y.y,Me.renderSvgArcCommand(n,U,q,H,T,K,J,D,R,M);break;case ne.curve:b=h?ut(L-1,m):Math.max(L-1,0),y=p[b],v=y.controls&&y.controls.right||ie.zero,E=_.controls&&_.controls.left||ie.zero,y._relative?(k=v.x+y.x,$=v.y+y.y):(k=v.x,$=v.y),_._relative?(C=E.x+_.x,N=E.y+_.y):(C=E.x,N=E.y),n.bezierCurveTo(k,$,C,N,R,M),L>=g&&h&&(x=w,P=_.controls&&_.controls.right||ie.zero,F=x.controls&&x.controls.left||ie.zero,_._relative?(k=P.x+_.x,$=P.y+_.y):(k=P.x,$=P.y),x._relative?(C=F.x+x.x,N=F.y+x.y):(C=F.x,N=F.y),R=x.x,M=x.y,n.bezierCurveTo(k,$,C,N,R,M));break;case ne.line:n.lineTo(R,M);break;case ne.move:w=_,n.moveTo(R,M);break}return h&&n.closePath(),!G&&!i&&(Me.isHidden.test(a)||(O=a._renderer&&a._renderer.offset,O&&(n.save(),n.translate(-a._renderer.offset.x,-a._renderer.offset.y),n.scale(a._renderer.scale.x,a._renderer.scale.y)),n.fill(),O&&n.restore()),Me.isHidden.test(o)||(O=o._renderer&&o._renderer.offset,O&&(n.save(),n.translate(-o._renderer.offset.x,-o._renderer.offset.y),n.scale(o._renderer.scale.x,o._renderer.scale.y),n.lineWidth=s/o._renderer.scale.x),n.stroke(),O&&n.restore())),Z||n.restore(),G&&!i&&n.clip(),A&&A.length>0&&n.setLineDash(ga),re.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},points:{render:function(n,e,i){let r,o,s,a,l,c,d,u,f,h,p,m,g,b,y,_;if(_=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,l=this._opacity*(_||1),c=this._visible,!e&&(!c||l===0))return this;if(re.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),r=this._matrix.elements,o=this._stroke,s=this._linewidth,a=this._fill,u=this._renderer.collection,f=u.length,g=Io(r),y=this.dashes,d=this._size,g||(n.save(),n.transform(r[0],r[3],r[1],r[4],r[2],r[5])),a)if(typeof a=="string")n.fillStyle=a;else{const C=Me.getRendererType(a._renderer.type);Me[C].render.call(a,n,this),n.fillStyle=a._renderer.effect}if(o){if(typeof o=="string")n.strokeStyle=o;else{const C=Me.getRendererType(o._renderer.type);Me[C].render.call(o,n,this),n.strokeStyle=o._renderer.effect}s&&(n.lineWidth=Nn(this))}typeof l=="number"&&(n.globalAlpha=l),y&&y.length>0&&(n.lineDashOffset=y.offset||0,n.setLineDash(y)),n.beginPath();let x=d*.5,w;this._sizeAttenuation||(w=this.worldMatrix.elements,w=Si(w[0],w[3],w[1],w[4],w[2],w[5]),x/=Math.max(w.scaleX,w.scaleY));for(let C=0;C<f;C++)h=u[C],p=h.x,m=h.y,n.moveTo(p+x,m),n.arc(p,m,x,0,ot);return i||(Me.isHidden.test(a)||(b=a._renderer&&a._renderer.offset,b&&(n.save(),n.translate(-a._renderer.offset.x,-a._renderer.offset.y),n.scale(a._renderer.scale.x,a._renderer.scale.y)),n.fill(),b&&n.restore()),Me.isHidden.test(o)||(b=o._renderer&&o._renderer.offset,b&&(n.save(),n.translate(-o._renderer.offset.x,-o._renderer.offset.y),n.scale(o._renderer.scale.x,o._renderer.scale.y),n.lineWidth=s/o._renderer.scale.x),n.stroke(),b&&n.restore())),g||n.restore(),y&&y.length>0&&n.setLineDash(ga),re.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},text:{render:function(n,e,i){const r=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,o=this._opacity*r,s=this._visible,a=this._mask,l=this._clip;if(!e&&(!s||l||o===0))return this;re.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const c=this._matrix.elements,d=this._stroke,u=this._linewidth,f=this._fill,h=this._decoration,p=this._direction,m=Io(c),g=f._renderer&&f._renderer.offset&&d._renderer&&d._renderer.offset,b=this.dashes,y=Me.alignments[this._alignment]||this._alignment,_=Me.baselines[this._baseline]||this._baseline;let x,w,C,N,k,$,v,E,P,F,R;if(m||(n.save(),n.transform(c[0],c[3],c[1],c[4],c[2],c[5])),a){const M=Me.getRendererType(a._renderer.type);Me[M].render.call(a,n,!0)}if(g||(n.font=[this._style,this._weight,this._size+"px/"+this._leading+"px",this._family].join(" ")),n.textAlign=y,n.textBaseline=_,n.direction=p,f)if(typeof f=="string")n.fillStyle=f;else{const M=Me.getRendererType(f._renderer.type);Me[M].render.call(f,n,this),n.fillStyle=f._renderer.effect}if(d){if(typeof d=="string")n.strokeStyle=d;else{const M=Me.getRendererType(d._renderer.type);Me[M].render.call(d,n,this),n.strokeStyle=d._renderer.effect}u&&(n.lineWidth=Nn(this))}if(typeof o=="number"&&(n.globalAlpha=o),b&&b.length>0&&(n.lineDashOffset=b.offset||0,n.setLineDash(b)),!l&&!i&&(Me.isHidden.test(f)||(f._renderer&&f._renderer.offset?($=f._renderer.scale.x,v=f._renderer.scale.y,n.save(),n.translate(-f._renderer.offset.x,-f._renderer.offset.y),n.scale($,v),x=this._size/f._renderer.scale.y,w=this._leading/f._renderer.scale.y,n.font=[this._style,this._weight,x+"px/",w+"px",this._family].join(" "),C=f._renderer.offset.x/f._renderer.scale.x,N=f._renderer.offset.y/f._renderer.scale.y,n.fillText(this.value,C,N),n.restore()):n.fillText(this.value,0,0)),Me.isHidden.test(d)||(d._renderer&&d._renderer.offset?($=d._renderer.scale.x,v=d._renderer.scale.y,n.save(),n.translate(-d._renderer.offset.x,-d._renderer.offset.y),n.scale($,v),x=this._size/d._renderer.scale.y,w=this._leading/d._renderer.scale.y,n.font=[this._style,this._weight,x+"px/",w+"px",this._family].join(" "),C=d._renderer.offset.x/d._renderer.scale.x,N=d._renderer.offset.y/d._renderer.scale.y,k=u/d._renderer.scale.x,n.lineWidth=k,n.strokeText(this.value,C,N),n.restore()):n.strokeText(this.value,0,0))),/(underline|strikethrough)/i.test(h)){const M=n.measureText(this.value);let X=1;switch(h){case"underline":P=M.actualBoundingBoxDescent,R=M.actualBoundingBoxDescent;break;case"strikethrough":P=0,R=0,X=.5;break}switch(_){case"top":P+=this._size*X,R+=this._size*X;break;case"baseline":case"bottom":P-=this._size*X,R-=this._size*X;break}switch(y){case"left":case"start":E=0,F=M.width;break;case"right":case"end":E=-M.width,F=0;break;default:E=-M.width/2,F=M.width/2}n.lineWidth=Math.max(Math.floor(this._size/15),1),n.strokeStyle=n.fillStyle,n.beginPath(),n.moveTo(E,P),n.lineTo(F,R),n.stroke()}return m||n.restore(),l&&!i&&n.clip(),b&&b.length>0&&n.setLineDash(ga),re.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},"linear-gradient":{render:function(n,e){if(e){if(re.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),!this._renderer.effect||this._flagEndPoints||this._flagStops||this._flagUnits){let i,r=this.left._x,o=this.left._y,s=this.right._x,a=this.right._y;/objectBoundingBox/i.test(this._units)&&(i=e.getBoundingClientRect(!0),r=(r-.5)*i.width,o=(o-.5)*i.height,s=(s-.5)*i.width,a=(a-.5)*i.height),this._renderer.effect=n.createLinearGradient(r,o,s,a);for(let l=0;l<this.stops.length;l++){const c=this.stops[l];this._renderer.effect.addColorStop(c._offset,c._color)}}return re.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},"radial-gradient":{render:function(n,e){if(e){if(re.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),!this._renderer.effect||this._flagCenter||this._flagFocal||this._flagRadius||this._flagStops||this._flagUnits){let i,r=this.center._x,o=this.center._y,s=this.focal._x,a=this.focal._y,l=this._radius;/objectBoundingBox/i.test(this._units)&&(i=e.getBoundingClientRect(!0),r=(r-.5)*i.width*.5,o=(o-.5)*i.height*.5,s=(s-.5)*i.width*.5,a=(a-.5)*i.height*.5,l*=Math.min(i.width,i.height)),this._renderer.effect=n.createRadialGradient(r,o,0,s,a,l);for(let c=0;c<this.stops.length;c++){const d=this.stops[c];this._renderer.effect.addColorStop(d._offset,d._color)}}return re.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},texture:{render:function(n){re.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const e=this.image;return(!this._renderer.effect||(this._flagLoaded||this._flagImage||this._flagVideo||this._flagRepeat)&&this.loaded)&&(this._renderer.effect=n.createPattern(this.image,this._repeat)),(this._flagOffset||this._flagLoaded||this._flagScale)&&(this._renderer.offset instanceof ie||(this._renderer.offset=new ie),this._renderer.offset.x=-this._offset.x,this._renderer.offset.y=-this._offset.y,e&&(this._renderer.offset.x+=e.width/2,this._renderer.offset.y+=e.height/2,this._scale instanceof ie?(this._renderer.offset.x*=this._scale.x,this._renderer.offset.y*=this._scale.y):(this._renderer.offset.x*=this._scale,this._renderer.offset.y*=this._scale))),(this._flagScale||this._flagLoaded)&&(this._renderer.scale instanceof ie||(this._renderer.scale=new ie),this._scale instanceof ie?this._renderer.scale.copy(this._scale):this._renderer.scale.set(this._scale,this._scale)),re.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},renderSvgArcCommand:function(n,e,i,r,o,s,a,l,c,d){l=l*Math.PI/180,r=Id(r),o=Id(o);const u=(e-c)/2,f=(i-d)/2,h=Vo(l)*u+Fo(l)*f,p=-Fo(l)*u+Vo(l)*f,m=h*h,g=p*p;let b=r*r,y=o*o;const _=m/b+g/y;if(_>1){const M=Mo(_);r=M*r,o=M*o,b=r*r,y=o*o}const x=b*g+y*m,w=(b*y-x)/x;let C=Mo(ya(0,w));s===a&&(C=-C);const N=C*r*p/o,k=-C*o*h/r,$=Vo(l)*N-Fo(l)*k+(e+c)/2,v=Fo(l)*N+Vo(l)*k+(i+d)/2,E=Ad(1,0,(h-N)/r,(p-k)/o),P=Ad((h-N)/r,(p-k)/o,(-h-N)/r,(-p-k)/o)%ot,F=E+P;D0(n,$,v,r,o,E,F,a===0,l)}},Tt=class extends ee{constructor(n){super();const e=n.smoothing!==!1;this.domElement=n.domElement||document.createElement("canvas"),this.ctx=this.domElement.getContext("2d"),this.overdraw=n.overdraw||!1,typeof this.ctx.imageSmoothingEnabled<"u"&&(this.ctx.imageSmoothingEnabled=e),this.scene=new xt,this.scene.parent=this}setSize(n,e,i){return this.width=n,this.height=e,this.ratio=typeof i>"u"?Xs(this.ctx):i,this.domElement.width=n*this.ratio,this.domElement.height=e*this.ratio,this.domElement.style&&re.extend(this.domElement.style,{width:n+"px",height:e+"px"}),this.trigger(ee.Types.resize,n,e,i)}render(){const n=this.ratio===1;return n||(this.ctx.save(),this.ctx.scale(this.ratio,this.ratio)),this.overdraw||this.ctx.clearRect(0,0,this.width,this.height),Me.group.render.call(this.scene,this.ctx),n||this.ctx.restore(),this}};S(Tt,"Utils",Me);function D0(n,e,i,r,o,s,a,l,c){const d=a-s,u=rr.Tolerance.epsilon,f=Math.abs(d)<u;let h=ut(d,ot);h<u&&(f?h=0:h=ot),l===!0&&!f&&(h===ot?h=-ot:h=h-ot);for(let p=0;p<Bt.Resolution;p++){const m=p/(Bt.Resolution-1),g=s+m*h;let b=e+r*Math.cos(g),y=i+o*Math.sin(g);if(c!==0){const _=Math.cos(c),x=Math.sin(c),w=b-e,C=y-i;b=w*_-C*x+e,y=w*x+C*_+i}n.lineTo(b,y)}}function Ad(n,e,i,r){const o=n*i+e*r,s=Mo(n*n+e*e)*Mo(i*i+r*r);let a=z0(ya(-1,O0(1,o/s)));return n*r-e*i<0&&(a=-a),a}function Io(n){return n[0]===1&&n[3]===0&&n[1]===0&&n[4]===1&&n[2]===0&&n[5]===0}var he={version:1.1,ns:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink",alignments:{left:"start",center:"middle",right:"end"},baselines:{top:"hanging",middle:"middle",bottom:"ideographic",baseline:"alphabetic"},createElement:function(n,e){const i=n,r=document.createElementNS(he.ns,i);return i==="svg"&&(e=re.defaults(e||{},{version:he.version})),e&&Object.keys(e).length>0&&he.setAttributes(r,e),r},setAttributes:function(n,e){const i=Object.keys(e);for(let r=0;r<i.length;r++)/href/.test(i[r])?n.setAttributeNS(he.xlink,i[r],e[i[r]]):n.setAttribute(i[r],e[i[r]]);return this},removeAttributes:function(n,e){for(let i in e)n.removeAttribute(i);return this},toString:function(n,e){let i=n.length,r=i-1,o,s="";for(let a=0;a<i;a++){const l=n[a],c=e?ut(a-1,i):Math.max(a-1,0),d=n[c];let u,f,h,p,m,g,b,y,_,x,w,C,N,k,$,v=ze(l.x),E=ze(l.y);switch(l.command){case ne.close:u=ne.close;break;case ne.arc:w=l.rx,C=l.ry,N=l.xAxisRotation,k=l.largeArcFlag,$=l.sweepFlag,u=ne.arc+" "+w+" "+C+" "+N+" "+k+" "+$+" "+v+" "+E;break;case ne.curve:b=d.controls&&d.controls.right||ie.zero,y=l.controls&&l.controls.left||ie.zero,d.relative?(h=ze(b.x+d.x),p=ze(b.y+d.y)):(h=ze(b.x),p=ze(b.y)),l.relative?(m=ze(y.x+l.x),g=ze(y.y+l.y)):(m=ze(y.x),g=ze(y.y)),u=(a===0?ne.move:ne.curve)+" "+h+" "+p+" "+m+" "+g+" "+v+" "+E;break;case ne.move:o=l,u=ne.move+" "+v+" "+E;break;default:u=l.command+" "+v+" "+E}a>=r&&e&&(l.command===ne.curve&&(f=o,_=l.controls&&l.controls.right||l,x=f.controls&&f.controls.left||f,l.relative?(h=ze(_.x+l.x),p=ze(_.y+l.y)):(h=ze(_.x),p=ze(_.y)),f.relative?(m=ze(x.x+f.x),g=ze(x.y+f.y)):(m=ze(x.x),g=ze(x.y)),v=ze(f.x),E=ze(f.y),u+=" C "+h+" "+p+" "+m+" "+g+" "+v+" "+E),l.command!==ne.close&&(u+=" Z")),s+=u+" "}return s},pointsToString:function(n,e){let i="";const r=e*.5;for(let o=0;o<n.length;o++){const s=n[o].x,a=n[o].y-r;i+=ne.move+" "+s+" "+a+" ",i+="a "+r+" "+r+" 0 1 0 0.001 0 Z"}return i},getClip:function(n,e){let i=n._renderer.clip;return i||(i=n._renderer.clip=he.createElement("clipPath",{"clip-rule":"nonzero"})),i.parentNode===null&&e.defs.appendChild(i),i},getRendererType:function(n){return n in he?n:"path"},defs:{update:function(n){const{defs:e}=n;if(e._flagUpdate){const i=Array.prototype.slice.call(e.children,0);for(let r=0;r<i.length;r++){const o=i[r],s=o.id,a=`[fill="url(#${s})"],[stroke="url(#${s})"],[clip-path="url(#${s})"]`;n.querySelector(a)||e.removeChild(o)}e._flagUpdate=!1}}},group:{appendChild:function(n){const e=n._renderer.elem;if(!e)return;const i=e.nodeName;!i||/(radial|linear)gradient/i.test(i)||n._clip||this.elem.appendChild(e)},removeChild:function(n){const e=n._renderer.elem;!e||e.parentNode!=this.elem||!e.nodeName||n._clip||this.elem.removeChild(e)},orderChild:function(n){this.elem.appendChild(n._renderer.elem)},renderChild:function(n){const e=he.getRendererType(n._renderer.type);he[e].render.call(n,this)},render:function(n){if(!this._visible&&!this._flagVisible||this._opacity===0&&!this._flagOpacity)return this;re.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),this._renderer.elem||(this._renderer.elem=he.createElement("g",{id:this.id}),n.appendChild(this._renderer.elem));const e=this._matrix.manual||this._flagMatrix,i={domElement:n,elem:this._renderer.elem};e&&this._renderer.elem.setAttribute("transform","matrix("+this._matrix.toString()+")");for(let r=0;r<this.children.length;r++){const o=this.children[r],s=he.getRendererType(o._renderer.type);he[s].render.call(o,n)}if(this._flagId&&this._renderer.elem.setAttribute("id",this._id),this._flagOpacity&&this._renderer.elem.setAttribute("opacity",this._opacity),this._flagVisible&&this._renderer.elem.setAttribute("display",this._visible?"inline":"none"),this._flagClassName&&this._renderer.elem.setAttribute("class",this.classList.join(" ")),this._flagAdditions&&this.additions.forEach(he.group.appendChild,i),this._flagSubtractions&&this.subtractions.forEach(he.group.removeChild,i),this._flagOrder&&this.children.forEach(he.group.orderChild,i),this._flagMask)if(this._mask){const r=he.getRendererType(this._mask._renderer.type);he[r].render.call(this._mask,n),this._renderer.elem.setAttribute("clip-path","url(#"+this._mask.id+")")}else this._renderer.elem.removeAttribute("clip-path");return this.dataset&&Object.assign(this._renderer.elem.dataset,this.dataset),re.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},path:{render:function(n){if(this._opacity===0&&!this._flagOpacity)return this;re.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const e={};if((this._matrix.manual||this._flagMatrix)&&(e.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(e.id=this._id),this._flagVertices){const r=he.toString(this._renderer.vertices,this._closed);e.d=r}if(this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();const r=he.getRendererType(this._fill._renderer.type);he[r].render.call(this._fill,n,!0)}if(this._flagFill&&(e.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill,this._renderer.hasFillEffect&&typeof this._fill.id>"u"&&(n.defs._flagUpdate=!0,delete this._renderer.hasFillEffect)),this._stroke&&this._stroke._renderer){this._renderer.hasStrokeEffect=!0,this._stroke._update();const r=he.getRendererType(this._stroke._renderer.type);he[r].render.call(this._stroke,n,!0)}if(this._flagStroke&&(e.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke,this._renderer.hasStrokeEffect&&typeof this._stroke.id>"u"&&(n.defs._flagUpdate=!0,delete this._renderer.hasStrokeEffect)),this._flagLinewidth&&(e["stroke-width"]=Nn(this)),this._flagOpacity&&(e["stroke-opacity"]=this._opacity,e["fill-opacity"]=this._opacity),this._flagClassName&&(e.class=this.classList.join(" ")),this._flagVisible&&(e.visibility=this._visible?"visible":"hidden"),this._flagCap&&(e["stroke-linecap"]=this._cap),this._flagJoin&&(e["stroke-linejoin"]=this._join),this._flagMiter&&(e["stroke-miterlimit"]=this._miter),this.dashes&&this.dashes.length>0&&(e["stroke-dasharray"]=this.dashes.join(" "),e["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?he.setAttributes(this._renderer.elem,e):(e.id=this._id,this._renderer.elem=he.createElement("path",e),n.appendChild(this._renderer.elem)),this._flagClip){const r=he.getClip(this,n),o=this._renderer.elem;this._clip?(o.removeAttribute("id"),r.setAttribute("id",this.id),r.appendChild(o)):(r.removeAttribute("id"),o.setAttribute("id",this.id),this.parent._renderer.elem.appendChild(o))}if(this._flagMask)if(this._mask){const r=he.getRendererType(this._mask._renderer.type);he[r].render.call(this._mask,n),this._renderer.elem.setAttribute("clip-path","url(#"+this._mask.id+")")}else this._renderer.elem.removeAttribute("clip-path");return re.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},points:{render:function(n){if(this._opacity===0&&!this._flagOpacity)return this;re.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const e={};if((this._matrix.manual||this._flagMatrix)&&(e.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(e.id=this._id),this._flagVertices||this._flagSize||this._flagSizeAttenuation){let r=this._size;if(!this._sizeAttenuation){const s=this.worldMatrix.elements,a=Si(s[0],s[3],s[1],s[4],s[2],s[5]);r/=Math.max(a.scaleX,a.scaleY)}const o=he.pointsToString(this._renderer.collection,r);e.d=o}if(this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();const r=he.getRendererType(this._fill._renderer.type);he[r].render.call(this._fill,n,!0)}if(this._flagFill&&(e.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill,this._renderer.hasFillEffect&&typeof this._fill.id>"u"&&(n.defs._flagUpdate=!0,delete this._renderer.hasFillEffect)),this._stroke&&this._stroke._renderer){this._renderer.hasStrokeEffect=!0,this._stroke._update();const r=he.getRendererType(this._stroke._renderer.type);he[r].render.call(this._stroke,n,!0)}return this._flagStroke&&(e.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke,this._renderer.hasStrokeEffect&&typeof this._stroke.id>"u"&&(n.defs._flagUpdate=!0,delete this._renderer.hasStrokeEffect)),this._flagLinewidth&&(e["stroke-width"]=Nn(this)),this._flagOpacity&&(e["stroke-opacity"]=this._opacity,e["fill-opacity"]=this._opacity),this._flagClassName&&(e.class=this.classList.join(" ")),this._flagVisible&&(e.visibility=this._visible?"visible":"hidden"),this.dashes&&this.dashes.length>0&&(e["stroke-dasharray"]=this.dashes.join(" "),e["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?he.setAttributes(this._renderer.elem,e):(e.id=this._id,this._renderer.elem=he.createElement("path",e),n.appendChild(this._renderer.elem)),re.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},text:{render:function(n){this._update();const e={};if((this._matrix.manual||this._flagMatrix)&&(e.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(e.id=this._id),this._flagFamily&&(e["font-family"]=this._family),this._flagSize&&(e["font-size"]=this._size),this._flagLeading&&(e["line-height"]=this._leading),this._flagAlignment&&(e["text-anchor"]=he.alignments[this._alignment]||this._alignment),this._flagBaseline&&(e["dominant-baseline"]=he.baselines[this._baseline]||this._baseline),this._flagStyle&&(e["font-style"]=this._style),this._flagWeight&&(e["font-weight"]=this._weight),this._flagDecoration&&(e["text-decoration"]=this._decoration),this._flagDirection&&(e.direction=this._direction),this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();const r=he.getRendererType(this._fill._renderer.type);he[r].render.call(this._fill,n,!0)}if(this._flagFill&&(e.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill,this._renderer.hasFillEffect&&typeof this._fill.id>"u"&&(n.defs._flagUpdate=!0,delete this._renderer.hasFillEffect)),this._stroke&&this._stroke._renderer){this._renderer.hasStrokeEffect=!0,this._stroke._update();const r=he.getRendererType(this._stroke._renderer.type);he[r].render.call(this._stroke,n,!0)}if(this._flagStroke&&(e.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke,this._renderer.hasStrokeEffect&&typeof this._stroke.id>"u"&&(n.defs._flagUpdate=!0,delete this._renderer.hasStrokeEffect)),this._flagLinewidth&&(e["stroke-width"]=Nn(this)),this._flagOpacity&&(e.opacity=this._opacity),this._flagClassName&&(e.class=this.classList.join(" ")),this._flagVisible&&(e.visibility=this._visible?"visible":"hidden"),this.dashes&&this.dashes.length>0&&(e["stroke-dasharray"]=this.dashes.join(" "),e["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?he.setAttributes(this._renderer.elem,e):(e.id=this._id,this._renderer.elem=he.createElement("text",e),n.appendChild(this._renderer.elem)),this._flagClip){const r=he.getClip(this,n),o=this._renderer.elem;this._clip?(o.removeAttribute("id"),r.setAttribute("id",this.id),r.appendChild(o)):(r.removeAttribute("id"),o.setAttribute("id",this.id),this.parent._renderer.elem.appendChild(o))}if(this._flagMask)if(this._mask){const r=he.getRendererType(this._mask._renderer.type);he[r].render.call(this._mask,n),this._renderer.elem.setAttribute("clip-path","url(#"+this._mask.id+")")}else this._renderer.elem.removeAttribute("clip-path");return this._flagValue&&(this._renderer.elem.textContent=this._value),this.flagReset()}},"linear-gradient":{render:function(n,e){re.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),e||this._update();const i={};if(this._flagId&&(i.id=this._id),this._flagEndPoints&&(i.x1=this.left._x,i.y1=this.left._y,i.x2=this.right._x,i.y2=this.right._y),this._flagSpread&&(i.spreadMethod=this._spread),this._flagUnits&&(i.gradientUnits=this._units),this._renderer.elem?he.setAttributes(this._renderer.elem,i):(i.id=this._id,this._renderer.elem=he.createElement("linearGradient",i)),this._renderer.elem.parentNode===null&&n.defs.appendChild(this._renderer.elem),this._flagStops){const r=this._renderer.elem.childNodes.length!==this.stops.length;if(r)for(;this._renderer.elem.lastChild;)this._renderer.elem.removeChild(this._renderer.elem.lastChild);for(let o=0;o<this.stops.length;o++){const s=this.stops[o],a={};s._flagOffset&&(a.offset=100*s._offset+"%"),s._flagColor&&(a["stop-color"]=s._color),s._flagOpacity&&(a["stop-opacity"]=s._opacity),s._renderer.elem?he.setAttributes(s._renderer.elem,a):s._renderer.elem=he.createElement("stop",a),r&&this._renderer.elem.appendChild(s._renderer.elem),s.flagReset()}}return re.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},"radial-gradient":{render:function(n,e){re.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),e||this._update();const i={};if(this._flagId&&(i.id=this._id),this._flagCenter&&(i.cx=this.center._x,i.cy=this.center._y),this._flagFocal&&(i.fx=this.focal._x,i.fy=this.focal._y),this._flagRadius&&(i.r=this._radius),this._flagSpread&&(i.spreadMethod=this._spread),this._flagUnits&&(i.gradientUnits=this._units),this._renderer.elem?he.setAttributes(this._renderer.elem,i):(i.id=this._id,this._renderer.elem=he.createElement("radialGradient",i)),this._renderer.elem.parentNode===null&&n.defs.appendChild(this._renderer.elem),this._flagStops){const r=this._renderer.elem.childNodes.length!==this.stops.length;if(r)for(;this._renderer.elem.lastChild;)this._renderer.elem.removeChild(this._renderer.elem.lastChild);for(let o=0;o<this.stops.length;o++){const s=this.stops[o],a={};s._flagOffset&&(a.offset=100*s._offset+"%"),s._flagColor&&(a["stop-color"]=s._color),s._flagOpacity&&(a["stop-opacity"]=s._opacity),s._renderer.elem?he.setAttributes(s._renderer.elem,a):s._renderer.elem=he.createElement("stop",a),r&&this._renderer.elem.appendChild(s._renderer.elem),s.flagReset()}}return re.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},texture:{render:function(n,e){re.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),e||this._update();const i={},r={x:0,y:0},o=this.image;if(this._flagId&&(i.id=this._id),this._flagLoaded&&this.loaded)switch(o.nodeName.toLowerCase()){case"canvas":r.href=r["xlink:href"]=o.toDataURL("image/png");break;case"img":case"image":r.href=r["xlink:href"]=this.src;break}if((this._flagOffset||this._flagLoaded||this._flagScale)&&(i.x=this._offset.x,i.y=this._offset.y,o&&(i.x-=o.width/2,i.y-=o.height/2,this._scale instanceof ie?(i.x*=this._scale.x,i.y*=this._scale.y):(i.x*=this._scale,i.y*=this._scale)),i.x>0&&(i.x*=-1),i.y>0&&(i.y*=-1)),(this._flagScale||this._flagLoaded||this._flagRepeat)&&(i.width=0,i.height=0,o)){switch(i.width=o.width,i.height=o.height,this._repeat){case"no-repeat":i.width+=1,i.height+=1;break}this._scale instanceof ie?(i.width*=this._scale.x,i.height*=this._scale.y):(i.width*=this._scale,i.height*=this._scale),/no-repeat/i.test(this._repeat)?r.preserveAspectRatio="xMidYMid":r.preserveAspectRatio="none",r.width=i.width,r.height=i.height}return(this._flagScale||this._flagLoaded)&&(this._renderer.image?he.setAttributes(this._renderer.image,r):this._renderer.image=he.createElement("image",r)),this._renderer.elem?Object.keys(i).length!==0&&he.setAttributes(this._renderer.elem,i):(i.id=this._id,i.patternUnits="userSpaceOnUse",this._renderer.elem=he.createElement("pattern",i)),this._renderer.elem.parentNode===null&&n.defs.appendChild(this._renderer.elem),this._renderer.elem&&this._renderer.image&&!this._renderer.appended&&(this._renderer.elem.appendChild(this._renderer.image),this._renderer.appended=!0),re.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},Od=class extends ee{constructor(n){super(),this.domElement=n.domElement||he.createElement("svg"),this.scene=new xt,this.scene.parent=this,this.defs=he.createElement("defs"),this.defs._flagUpdate=!1,this.domElement.appendChild(this.defs),this.domElement.defs=this.defs,this.domElement.style.overflow="hidden"}setSize(n,e){return this.width=n,this.height=e,he.setAttributes(this.domElement,{width:n,height:e}),this.trigger(ee.Types.resize,n,e)}render(){return he.group.render.call(this.scene,this.domElement),he.defs.update(this.domElement),this}};S(Od,"Utils",he);var fn={create:function(n,e,i){const r=n.createShader(n[i]);if(n.shaderSource(r,e),n.compileShader(r),!n.getShaderParameter(r,n.COMPILE_STATUS)){const s=n.getShaderInfoLog(r);throw n.deleteShader(r),new Yt("unable to compile shader "+r+": "+s)}return r},types:{vertex:"VERTEX_SHADER",fragment:"FRAGMENT_SHADER"},path:{vertex:`
41
41
  precision mediump float;
42
42
  attribute vec2 a_position;
43
43
 
@@ -100,7 +100,7 @@
100
100
  }
101
101
  gl_FragColor = texel;
102
102
  }
103
- `}},Ao=Ni.Multiply,L0=[1,0,0,0,1,0,0,0,1],hi=new Bn(9),H0=Tt.Utils,zd=new ie,ba=new Bn([0,0,1,0,0,1,0,1,1,0,1,1]),Se={precision:.9,isHidden:/(undefined|none|transparent)/i,canvas:Je.document?Je.document.createElement("canvas"):{getContext:function(){}},alignments:{left:"start",middle:"center",right:"end"},matrix:new Ni,group:{removeChild:function(n,e){if(n.children)for(let i=0;i<n.children.length;i++)Se.group.removeChild(n.children[i],e);n._renderer.texture&&(e.deleteTexture(n._renderer.texture),delete n._renderer.texture),n._renderer.positionBuffer&&(e.deleteBuffer(n._renderer.positionBuffer),delete n._renderer.positionBuffer)},render:function(n,e){if(!this._visible)return;re.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const i=this.parent,r=i._matrix&&i._matrix.manual||i._flagMatrix,o=this._matrix.manual||this._flagMatrix;if((r||o)&&(this._renderer.matrix||(this._renderer.matrix=new Bn(9)),this._matrix.toTransformArray(!0,hi),Ao(hi,i._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof ie||(this._renderer.scale=new ie),this._scale instanceof ie?(this._renderer.scale.x=this._scale.x,this._renderer.scale.y=this._scale.y):(this._renderer.scale.x=this._scale,this._renderer.scale.y=this._scale),/renderer/i.test(i._renderer.type)||(this._renderer.scale.x*=i._renderer.scale.x,this._renderer.scale.y*=i._renderer.scale.y),r&&(this._flagMatrix=!0)),this._mask){n.clear(n.STENCIL_BUFFER_BIT),n.enable(n.STENCIL_TEST),n.stencilFunc(n.ALWAYS,1,0),n.stencilOp(n.KEEP,n.KEEP,n.REPLACE),n.colorMask(!1,!1,!1,!1);const a=Tt.Utils.getRendererType(this._mask._renderer.type);Se[a].render.call(this._mask,n,e,this),n.stencilFunc(n.EQUAL,1,255),n.stencilOp(n.KEEP,n.KEEP,n.KEEP),n.colorMask(!0,!0,!0,!0)}this._flagOpacity=i._flagOpacity||this._flagOpacity,this._renderer.opacity=this._opacity*(i&&i._renderer?i._renderer.opacity:1);let s;if(this._flagSubtractions)for(s=0;s<this.subtractions.length;s++)Se.group.removeChild(this.subtractions[s],n);for(s=0;s<this.children.length;s++){const a=this.children[s],l=Tt.Utils.getRendererType(a._renderer.type);Se[l].render.call(a,n,e)}return this._mask&&n.disable(n.STENCIL_TEST),re.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},path:{updateCanvas:function(n,e){let i,r,o,s,a,l,c,d,u,f,h,p,m,g;const b=e._renderer.vertices,y=this.canvas,_=this.ctx,x=n.renderer.ratio,w=zd.copy(e._renderer.scale).multiply(x),C=e._stroke,N=e._linewidth,k=e._fill,$=e._renderer.opacity||e._opacity,v=e._cap,E=e._join,P=e._miter,F=e._closed,R=e.dashes,M=b.length,X=M-1;y.width=Math.max(Math.ceil(e._renderer.rect.width*w.x),1),y.height=Math.max(Math.ceil(e._renderer.rect.height*w.y),1);const G=e._renderer.rect.centroid,Z=G.x,O=G.y;if(_.clearRect(0,0,y.width,y.height),k)if(typeof k=="string")_.fillStyle=k;else{const q=Tt.Utils.getRendererType(k._renderer.type);Se[q].render.call(k,_,e),_.fillStyle=k._renderer.effect}if(C){if(typeof C=="string")_.strokeStyle=C;else{const q=Tt.Utils.getRendererType(C._renderer.type);Se[q].render.call(C,_,e),_.strokeStyle=C._renderer.effect}N&&(_.lineWidth=Nn(e)),P&&(_.miterLimit=P),E&&(_.lineJoin=E),!F&&v&&(_.lineCap=v)}typeof $=="number"&&(_.globalAlpha=$),R&&R.length>0&&(_.lineDashOffset=R.offset||0,_.setLineDash(R));let A,Y,H,T,D,K,J,U;_.save(),_.scale(w.x,w.y),_.translate(Z,O),_.beginPath();for(let q=0;q<b.length;q++){const L=b[q];switch(p=L.x,m=L.y,L.command){case ne.close:_.closePath();break;case ne.arc:Y=L.rx,H=L.ry,T=L.xAxisRotation,D=L.largeArcFlag,K=L.sweepFlag,i=F?ut(q-1,M):Math.max(q-1,0),r=b[i],J=r.x,U=r.y,H0.renderSvgArcCommand(_,J,U,Y,H,D,K,T,p,m);break;case ne.curve:i=F?ut(q-1,M):Math.max(q-1,0),r=b[i],d=r.controls&&r.controls.right||ie.zero,u=L.controls&&L.controls.left||ie.zero,r._relative?(l=d.x+r.x,c=d.y+r.y):(l=d.x,c=d.y),L._relative?(s=u.x+L.x,a=u.y+L.y):(s=u.x,a=u.y),_.bezierCurveTo(l,c,s,a,p,m),q>=X&&F&&(o=A,f=L.controls&&L.controls.right||ie.zero,h=o.controls&&o.controls.left||ie.zero,L._relative?(l=f.x+L.x,c=f.y+L.y):(l=f.x,c=f.y),o._relative?(s=h.x+o.x,a=h.y+o.y):(s=h.x,a=h.y),p=o.x,m=o.y,_.bezierCurveTo(l,c,s,a,p,m));break;case ne.line:_.lineTo(p,m);break;case ne.move:A=L,_.moveTo(p,m);break}}F&&_.closePath(),Se.isHidden.test(k)||(g=k._renderer&&k._renderer.offset,g&&(_.save(),_.translate(-k._renderer.offset.x,-k._renderer.offset.y),_.scale(k._renderer.scale.x,k._renderer.scale.y)),_.fill(),g&&_.restore()),Se.isHidden.test(C)||(g=C._renderer&&C._renderer.offset,g&&(_.save(),_.translate(-C._renderer.offset.x,-C._renderer.offset.y),_.scale(C._renderer.scale.x,C._renderer.scale.y),_.lineWidth=N/C._renderer.scale.x),_.stroke(),g&&_.restore()),_.restore()},getBoundingClientRect:function(n,e,i){let r=1/0,o=-1/0,s=1/0,a=-1/0,l,c;n.forEach(function(d){const u=d.x,f=d.y,h=d.controls;let p,m,g,b,y,_;s=Math.min(f,s),r=Math.min(u,r),o=Math.max(u,o),a=Math.max(f,a),d.controls&&(y=h.left,_=h.right,!(!y||!_)&&(p=d._relative?y.x+u:y.x,m=d._relative?y.y+f:y.y,g=d._relative?_.x+u:_.x,b=d._relative?_.y+f:_.y,!(!p||!m||!g||!b)&&(s=Math.min(m,b,s),r=Math.min(p,g,r),o=Math.max(p,g,o),a=Math.max(m,b,a))))}),typeof e=="number"&&(s-=e,r-=e,o+=e,a+=e),l=o-r,c=a-s,i.top=s,i.left=r,i.right=o,i.bottom=a,i.width=l,i.height=c,i.centroid||(i.centroid={}),i.centroid.x=-r,i.centroid.y=-s},render:function(n,e,i){if(!this._visible||!this._opacity)return this;re.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const r=i||this.parent,o=Tt.Utils.getRendererType(this._renderer.type),s=e[o],a=r._matrix.manual||r._flagMatrix,l=this._matrix.manual||this._flagMatrix,c=this._renderer.parent!==r,d=this._flagVertices||this._flagFill||this._fill instanceof et&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof tt&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof De&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof et&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof tt&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof De&&(this._stroke._flagLoaded&&this._stroke.loaded||this._stroke._flagImage||this._stroke._flagVideo||this._stroke._flagRepeat||this._stroke._flagOffset||this._fill._flagScale)||this._flagStroke||this._flagLinewidth||this._flagOpacity||r._flagOpacity||this._flagVisible||this._flagCap||this._flagJoin||this._flagMiter||this._flagScale||this.dashes&&this.dashes.length>0||!this._renderer.texture;if(a||l||c){this._renderer.matrix||(this._renderer.matrix=new Bn(9)),this._matrix.toTransformArray(!0,hi),Ao(hi,r._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof ie||(this._renderer.scale=new ie);let f,h;this._scale instanceof ie?(f=this._scale.x*r._renderer.scale.x,h=this._scale.y*r._renderer.scale.y):(f=this._scale*r._renderer.scale.x,h=this._scale*r._renderer.scale.y),this._renderer.scale.x=f<0?-f:f,this._renderer.scale.y=h<0?-h:h,c&&(this._renderer.parent=r)}if(this._mask){n.clear(n.STENCIL_BUFFER_BIT),n.enable(n.STENCIL_TEST),n.stencilFunc(n.ALWAYS,1,0),n.stencilOp(n.KEEP,n.KEEP,n.REPLACE),n.colorMask(!1,!1,!1,!1);const f=Tt.Utils.getRendererType(this._mask._renderer.type);Se[f].render.call(this._mask,n,e,this),n.stencilFunc(n.EQUAL,1,255),n.stencilOp(n.KEEP,n.KEEP,n.KEEP),n.colorMask(!0,!0,!0,!0)}if(d?(this._renderer.rect||(this._renderer.rect={}),this._renderer.opacity=this._opacity*r._renderer.opacity,Se.path.getBoundingClientRect(this._renderer.vertices,this._linewidth,this._renderer.rect),Se.updateTexture.call(Se,n,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!i||!this._renderer.texture)return this;e.current!==s&&(n.useProgram(s),n.bindBuffer(n.ARRAY_BUFFER,e.buffers.position),n.vertexAttribPointer(s.position,2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(s.position),n.bufferData(n.ARRAY_BUFFER,ba,n.STATIC_DRAW),e.resolution.flagged||n.uniform2f(n.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),e.current=s),e.resolution.flagged&&n.uniform2f(n.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),n.bindTexture(n.TEXTURE_2D,this._renderer.texture);const u=this._renderer.rect;return n.uniformMatrix3fv(s.matrix,!1,this._renderer.matrix),n.uniform4f(s.rect,u.left,u.top,u.right,u.bottom),n.drawArrays(n.TRIANGLES,0,6),this._mask&&n.disable(n.STENCIL_TEST),re.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},points:{updateCanvas:function(n,e){let i;const r=this.canvas,o=this.ctx,s=n.renderer.ratio,a=e._stroke,l=e._linewidth,c=e._fill,d=e._renderer.opacity||e._opacity,u=e.dashes,f=e._size*s;let h=f;Se.isHidden.test(a)||(h+=l),r.width=Sc(h),r.height=r.width;const p=h/r.width,m=r.width/2,g=r.height/2;if(o.clearRect(0,0,r.width,r.height),c)if(typeof c=="string")o.fillStyle=c;else{const b=Tt.Utils.getRendererType(c._renderer.type);Se[b].render.call(c,o,e),o.fillStyle=c._renderer.effect}if(a){if(typeof a=="string")o.strokeStyle=a;else{const b=Tt.Utils.getRendererType(a._renderer.type);Se[b].render.call(a,o,e),o.strokeStyle=a._renderer.effect}l&&(o.lineWidth=Nn(e)/p)}typeof d=="number"&&(o.globalAlpha=d),u&&u.length>0&&(o.lineDashOffset=u.offset||0,o.setLineDash(u)),o.save(),o.translate(m,g),o.scale(Se.precision,Se.precision),o.beginPath(),o.arc(0,0,f/p*.5,0,ot),o.restore(),closed&&o.closePath(),Se.isHidden.test(c)||(i=c._renderer&&c._renderer.offset,i&&(o.save(),o.translate(-c._renderer.offset.x,-c._renderer.offset.y),o.scale(c._renderer.scale.x,c._renderer.scale.y)),o.fill(),i&&o.restore()),Se.isHidden.test(a)||(i=a._renderer&&a._renderer.offset,i&&(o.save(),o.translate(-a._renderer.offset.x,-a._renderer.offset.y),o.scale(a._renderer.scale.x,a._renderer.scale.y),o.lineWidth=l/a._renderer.scale.x),o.stroke(),i&&o.restore())},render:function(n,e,i){if(!this._visible||!this._opacity)return this;re.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();let r=this._size;const o=i||this.parent,s=e[this._renderer.type],a=this._sizeAttenuation,l=this._stroke,c=this._linewidth,d=o._matrix.manual||o._flagMatrix,u=this._matrix.manual||this._flagMatrix,f=this._renderer.parent!==o,h=this._renderer.vertices,p=this._renderer.collection.length,m=this._flagVertices,g=this._flagFill||this._fill instanceof et&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof tt&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof De&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof et&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof tt&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof De&&(this._stroke._flagLoaded&&this._stroke.loaded||this._stroke._flagImage||this._stroke._flagVideo||this._stroke._flagRepeat||this._stroke._flagOffset||this._fill._flagScale)||this._flagStroke||this._flagLinewidth||this._flagOpacity||o._flagOpacity||this._flagVisible||this._flagScale||this.dashes&&this.dashes.length>0||!this._renderer.texture;if(d||u||f){this._renderer.matrix||(this._renderer.matrix=new Bn(9)),this._matrix.toTransformArray(!0,hi),Ao(hi,o._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof ie||(this._renderer.scale=new ie);let b,y;this._scale instanceof ie?(b=this._scale.x*o._renderer.scale.x,y=this._scale.y*o._renderer.scale.y):(b=this._scale*o._renderer.scale.x,y=this._scale*o._renderer.scale.y),this._renderer.scale.x=b<0?-b:b,this._renderer.scale.y=y<0?-y:y,f&&(this._renderer.parent=o)}if(m){const b=this._renderer.positionBuffer;b&&n.deleteBuffer(b),this._renderer.positionBuffer=n.createBuffer(),n.bindBuffer(n.ARRAY_BUFFER,this._renderer.positionBuffer),n.vertexAttribPointer(s.position,2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(s.position),n.bufferData(n.ARRAY_BUFFER,h,n.STATIC_DRAW)}return g?(this._renderer.opacity=this._opacity*o._renderer.opacity,Se.updateTexture.call(Se,n,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!i||!this._renderer.texture?this:(Se.isHidden.test(l)||(r+=c),r/=Se.precision,a&&(r*=Math.max(this._renderer.scale.x,this._renderer.scale.y)),e.current!==s&&(n.useProgram(s),e.resolution.flagged||n.uniform2f(n.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),e.current=s),e.resolution.flagged&&n.uniform2f(n.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),n.bindTexture(n.TEXTURE_2D,this._renderer.texture),n.uniformMatrix3fv(s.matrix,!1,this._renderer.matrix),n.uniform1f(s.size,r*e.resolution.ratio),n.drawArrays(n.POINTS,0,p),re.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset())}},text:{updateCanvas:function(n,e){const i=this.canvas,r=this.ctx,o=n.renderer.ratio,s=zd.copy(e._renderer.scale).multiply(o),a=e._stroke,l=e._linewidth,c=e._fill,d=e._renderer.opacity||e._opacity,u=e.dashes,f=e._decoration,h=e._direction;i.width=Math.max(Math.ceil(e._renderer.rect.width*s.x),1),i.height=Math.max(Math.ceil(e._renderer.rect.height*s.y),1);const p=e._renderer.rect.centroid,m=p.x,g=p.y;let b,y,_,x,w,C,N,k,$,v,E;const P=c._renderer&&c._renderer.offset&&a._renderer&&a._renderer.offset;if(r.clearRect(0,0,i.width,i.height),P||(r.font=[e._style,e._weight,e._size+"px/"+e._leading+"px",e._family].join(" ")),r.textAlign="center",r.textBaseline="middle",r.textDirection=h,c)if(typeof c=="string")r.fillStyle=c;else{const F=Tt.Utils.getRendererType(c._renderer.type);Se[F].render.call(c,r,e),r.fillStyle=c._renderer.effect}if(a){if(typeof a=="string")r.strokeStyle=a;else{const F=Tt.Utils.getRendererType(a._renderer.type);Se[F].render.call(a,r,e),r.strokeStyle=a._renderer.effect}l&&(r.lineWidth=Nn(e))}if(typeof d=="number"&&(r.globalAlpha=d),u&&u.length>0&&(r.lineDashOffset=u.offset||0,r.setLineDash(u)),r.save(),r.scale(s.x,s.y),r.translate(m,g),Se.isHidden.test(c)||(c._renderer&&c._renderer.offset?(C=c._renderer.scale.x,N=c._renderer.scale.y,r.save(),r.translate(-c._renderer.offset.x,-c._renderer.offset.y),r.scale(C,N),b=e._size/c._renderer.scale.y,y=e._leading/c._renderer.scale.y,r.font=[e._style,e._weight,b+"px/",y+"px",e._family].join(" "),_=c._renderer.offset.x/c._renderer.scale.x,x=c._renderer.offset.y/c._renderer.scale.y,r.fillText(e.value,_,x),r.restore()):r.fillText(e.value,0,0)),Se.isHidden.test(a)||(a._renderer&&a._renderer.offset?(C=a._renderer.scale.x,N=a._renderer.scale.y,r.save(),r.translate(-a._renderer.offset.x,-a._renderer.offset.y),r.scale(C,N),b=e._size/a._renderer.scale.y,y=e._leading/a._renderer.scale.y,r.font=[e._style,e._weight,b+"px/",y+"px",e._family].join(" "),_=a._renderer.offset.x/a._renderer.scale.x,x=a._renderer.offset.y/a._renderer.scale.y,w=l/a._renderer.scale.x,r.lineWidth=w,r.strokeText(e.value,_,x),r.restore()):r.strokeText(e.value,0,0)),/(underline|strikethrough)/i.test(f)){const F=r.measureText(e.value);switch(f){case"underline":$=F.actualBoundingBoxDescent,E=F.actualBoundingBoxDescent;break;case"strikethrough":$=0,E=0;break}k=-F.width/2,v=F.width/2,r.lineWidth=Math.max(Math.floor(e._size/15),1),r.strokeStyle=r.fillStyle,r.beginPath(),r.moveTo(k,$),r.lineTo(v,E),r.stroke()}r.restore()},getBoundingClientRect:function(n,e){const i=Se.ctx;i.font=[n._style,n._weight,n._size+"px/"+n._leading+"px",n._family].join(" "),i.textAlign="center",i.textBaseline=Tt.Utils.baselines[n._baseline]||n._baseline;const r=i.measureText(n._value);let o=r.width,s=1.15*(r.actualBoundingBoxAscent+r.actualBoundingBoxDescent);this._linewidth&&!Se.isHidden.test(this._stroke)&&(o+=this._linewidth*2,s+=this._linewidth*2);const a=o/2,l=s/2;switch(Se.alignments[n._alignment]||n._alignment){case Se.alignments.left:n.direction==="ltr"?(e.left=0,e.right=o):(e.left=-o,e.right=0);break;case Se.alignments.right:n.direction==="ltr"?(e.left=-o,e.right=0):(e.left=0,e.right=o);break;default:e.left=-a,e.right=a}switch(n._baseline){case"bottom":e.top=-s,e.bottom=0;break;case"top":e.top=0,e.bottom=s;break;case"baseline":e.top=-l*1.5,e.bottom=l*.5;break;default:e.top=-l,e.bottom=l}e.width=o,e.height=s,e.centroid||(e.centroid={}),e.centroid.x=a,e.centroid.y=l},render:function(n,e,i){if(!this._visible||!this._opacity)return this;re.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const r=i||this.parent,o=e[this._renderer.type],s=r._matrix.manual||r._flagMatrix,a=this._matrix.manual||this._flagMatrix,l=this._renderer.parent!==r,c=this._flagVertices||this._flagFill||this._fill instanceof et&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof tt&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof De&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof et&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof tt&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof De&&(this._stroke._flagLoaded&&this._stroke.loaded||this._stroke._flagImage||this._stroke._flagVideo||this._stroke._flagRepeat||this._stroke._flagOffset||this._fill._flagScale)||this._flagStroke||this._flagLinewidth||this._flagOpacity||r._flagOpacity||this._flagVisible||this._flagScale||this._flagValue||this._flagFamily||this._flagSize||this._flagLeading||this._flagAlignment||this._flagBaseline||this._flagStyle||this._flagWeight||this._flagDecoration||this.dashes&&this.dashes.length>0||!this._renderer.texture;if(s||a||l){this._renderer.matrix||(this._renderer.matrix=new Bn(9)),this._matrix.toTransformArray(!0,hi),Ao(hi,r._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof ie||(this._renderer.scale=new ie);let u,f;this._scale instanceof ie?(u=this._scale.x*r._renderer.scale.x,f=this._scale.y*r._renderer.scale.y):(u=this._scale*r._renderer.scale.x,f=this._scale*r._renderer.scale.y),this._renderer.scale.x=u<0?-u:u,this._renderer.scale.y=f<0?-f:f,l&&(this._renderer.parent=r)}if(this._mask){n.clear(n.STENCIL_BUFFER_BIT),n.enable(n.STENCIL_TEST),n.stencilFunc(n.ALWAYS,1,0),n.stencilOp(n.KEEP,n.KEEP,n.REPLACE),n.colorMask(!1,!1,!1,!1);const u=Tt.Utils.getRendererType(this._mask._renderer.type);Se[u].render.call(this._mask,n,e,this),n.stencilFunc(n.EQUAL,1,255),n.stencilOp(n.KEEP,n.KEEP,n.KEEP),n.colorMask(!0,!0,!0,!0)}if(c?(this._renderer.rect||(this._renderer.rect={}),this._renderer.opacity=this._opacity*r._renderer.opacity,Se.text.getBoundingClientRect(this,this._renderer.rect),Se.updateTexture.call(Se,n,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!i||!this._renderer.texture)return this;e.current!==o&&(n.useProgram(o),n.bindBuffer(n.ARRAY_BUFFER,e.buffers.position),n.vertexAttribPointer(o.position,2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(o.position),n.bufferData(n.ARRAY_BUFFER,ba,n.STATIC_DRAW),e.resolution.flagged||n.uniform2f(n.getUniformLocation(o,"u_resolution"),e.resolution.width,e.resolution.height),e.current=o),e.resolution.flagged&&n.uniform2f(n.getUniformLocation(o,"u_resolution"),e.resolution.width,e.resolution.height),n.bindTexture(n.TEXTURE_2D,this._renderer.texture);const d=this._renderer.rect;return n.uniformMatrix3fv(o.matrix,!1,this._renderer.matrix),n.uniform4f(o.rect,d.left,d.top,d.right,d.bottom),n.drawArrays(n.TRIANGLES,0,6),this._mask&&n.disable(n.STENCIL_TEST),re.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},"linear-gradient":{render:function(n,e){if(!(!n.canvas.getContext("2d")||!e)){if(re.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),!this._renderer.effect||this._flagEndPoints||this._flagStops||this._flagUnits){let i,r=this.left._x,o=this.left._y,s=this.right._x,a=this.right._y;/objectBoundingBox/i.test(this._units)&&(i=e.getBoundingClientRect(!0),r=(r-.5)*i.width,o=(o-.5)*i.height,s=(s-.5)*i.width,a=(a-.5)*i.height),this._renderer.effect=n.createLinearGradient(r,o,s,a);for(let l=0;l<this.stops.length;l++){const c=this.stops[l];this._renderer.effect.addColorStop(c._offset,c._color)}}return re.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},"radial-gradient":{render:function(n,e){if(!(!n.canvas.getContext("2d")||!e)){if(re.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),!this._renderer.effect||this._flagCenter||this._flagFocal||this._flagRadius||this._flagStops||this._flagUnits){let i,r=this.center._x,o=this.center._y,s=this.focal._x,a=this.focal._y,l=this._radius;/objectBoundingBox/i.test(this._units)&&(i=e.getBoundingClientRect(!0),r=(r-.5)*i.width*.5,o=(o-.5)*i.height*.5,s=(s-.5)*i.width*.5,a=(a-.5)*i.height*.5,l*=Math.min(i.width,i.height)),this._renderer.effect=n.createRadialGradient(r,o,0,s,a,l);for(let c=0;c<this.stops.length;c++){const d=this.stops[c];this._renderer.effect.addColorStop(d._offset,d._color)}}return re.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},texture:{render:function(n,e){if(!n.canvas.getContext("2d"))return;re.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const i=this.image;if((this._flagLoaded||this._flagImage||this._flagVideo||this._flagRepeat)&&this.loaded)this._renderer.effect=n.createPattern(i,this._repeat);else if(!this._renderer.effect)return this.flagReset();if((this._flagOffset||this._flagLoaded||this._flagScale)&&(this._renderer.offset instanceof ie||(this._renderer.offset=new ie),this._renderer.offset.x=-this._offset.x,this._renderer.offset.y=-this._offset.y,i&&(this._renderer.offset.x+=i.width/2,this._renderer.offset.y+=i.height/2,this._scale instanceof ie?(this._renderer.offset.x*=this._scale.x,this._renderer.offset.y*=this._scale.y):(this._renderer.offset.x*=this._scale,this._renderer.offset.y*=this._scale))),this._flagScale||this._flagLoaded){this._renderer.scale instanceof ie||(this._renderer.scale=new ie);let r,o;this._scale instanceof ie?(r=this._scale.x,o=this._scale.y):(r=this._scale,o=this._scale),this._renderer.scale.x=r<0?-r:r,this._renderer.scale.y=o<0?-o:o}return re.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},updateTexture:function(n,e){const i=Tt.Utils.getRendererType(e._renderer.type);if(this[i].updateCanvas.call(Se,n,e),this.canvas.width<=0||this.canvas.height<=0){e._renderer.texture&&n.deleteTexture(e._renderer.texture),delete e._renderer.texture;return}e._renderer.texture||(e._renderer.texture=n.createTexture()),n.bindTexture(n.TEXTURE_2D,e._renderer.texture),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,this.canvas),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR)},program:{create:function(n,e){let i,r,o;if(i=n.createProgram(),re.each(e,function(s){n.attachShader(i,s)}),n.linkProgram(i),r=n.getProgramParameter(i,n.LINK_STATUS),!r)throw o=n.getProgramInfoLog(i),n.deleteProgram(i),new Yt("unable to link program: "+o);return i}},extensions:{init:function(n){const e={},i=["EXT_texture_filter_anisotropic","WEBGL_compressed_texture_s3tc","OES_texture_float_linear","WEBGL_multisampled_render_to_texture"];for(let r=0;r<i.length;r++){const o=i[r];e[o]=Se.extensions.get(n,o)}return e},get:function(n,e){return n.getExtension(e)||n.getExtension(`MOZ_${e}`)||n.getExtension(`WEBKIT_${e}`)}},TextureRegistry:new bo};Se.ctx=Se.canvas.getContext("2d");var Dd=class extends ee{constructor(n){super();let e,i,r,o;if(this.domElement=n.domElement||document.createElement("canvas"),typeof n.offscreenElement<"u"&&(Se.canvas=n.offscreenElement,Se.ctx=Se.canvas.getContext("2d")),this.scene=new xt,this.scene.parent=this,this._renderer={type:"renderer",matrix:new Bn(L0),scale:1,opacity:1},this._flagMatrix=!0,n=re.defaults(n||{},{antialias:!1,alpha:!0,premultipliedAlpha:!0,stencil:!0,preserveDrawingBuffer:!0,overdraw:!1}),this.overdraw=n.overdraw,e=this.ctx=this.domElement.getContext("webgl",n)||this.domElement.getContext("experimental-webgl",n),!this.ctx)throw new Yt("unable to create a webgl context. Try using another renderer.");r=un.create(e,un.path.vertex,un.types.vertex),o=un.create(e,un.path.fragment,un.types.fragment),this.programs={current:null,buffers:{position:e.createBuffer()},resolution:{width:0,height:0,ratio:1,flagged:!1}},i=this.programs.path=Se.program.create(e,[r,o]),this.programs.text=this.programs.path,e.extensions=Se.extensions.init(e),e.renderer=this,i.position=e.getAttribLocation(i,"a_position"),i.matrix=e.getUniformLocation(i,"u_matrix"),i.rect=e.getUniformLocation(i,"u_rect");const s=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,s),e.vertexAttribPointer(i.position,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(i.position),e.bufferData(e.ARRAY_BUFFER,ba,e.STATIC_DRAW),r=un.create(e,un.points.vertex,un.types.vertex),o=un.create(e,un.points.fragment,un.types.fragment),i=this.programs.points=Se.program.create(e,[r,o]),i.position=e.getAttribLocation(i,"a_position"),i.matrix=e.getUniformLocation(i,"u_matrix"),i.size=e.getUniformLocation(i,"u_size"),e.enable(e.BLEND),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA)}setSize(n,e,i){let r,o;const s=this.ctx;return this.width=n,this.height=e,this.ratio=typeof i>"u"?Xs(s):i,this.domElement.width=n*this.ratio,this.domElement.height=e*this.ratio,re.isObject(this.domElement.style)&&re.extend(this.domElement.style,{width:n+"px",height:e+"px"}),this._renderer.matrix[0]=this._renderer.matrix[4]=this._renderer.scale=this.ratio,this._flagMatrix=!0,r=n*this.ratio,o=e*this.ratio,s.viewport(0,0,r,o),this.programs.resolution.width=r,this.programs.resolution.height=o,this.programs.resolution.ratio=this.ratio,this.programs.resolution.flagged=!0,this.trigger(ee.Types.resize,n,e,i)}render(){const n=this.ctx;return this.overdraw||n.clear(n.COLOR_BUFFER_BIT),Se.group.render.call(this.scene,n,this.programs),this._flagMatrix=!1,this.programs.resolution.flagged=!0,this}};S(Dd,"Utils",Se);var W0=re.extend({Error:Yt,getRatio:Xs,read:Ze,xhr:Fd},re,At,xc,kc),Te=class ao{constructor(e){S(this,"_events",new ee),S(this,"type",""),S(this,"renderer",null),S(this,"scene",null),S(this,"width",0),S(this,"height",0),S(this,"frameCount",0),S(this,"timeDelta",0),S(this,"playing",!1);const i=re.defaults(e||{},{fullscreen:!1,fitted:!1,width:640,height:480,type:ao.Types.svg,autostart:!1});if(re.each(i,function(r,o){/fullscreen/i.test(o)||/autostart/i.test(o)||(this[o]=r)},this),re.isElement(i.domElement)){const r=i.domElement.tagName.toLowerCase();/^(CanvasRenderer-canvas|WebGLRenderer-canvas|SVGRenderer-svg)$/.test(this.type+"-"+r)||(this.type=ao.Types[r])}this.renderer=new ao[this.type](this),this.setPlaying(i.autostart),this.frameCount=0,i.fullscreen?(this.fit=j0.bind(this),this.fit.domElement=window,this.fit.attached=!0,re.extend(document.body.style,{overflow:"hidden",margin:0,padding:0,top:0,left:0,right:0,bottom:0,position:"fixed"}),re.extend(this.renderer.domElement.style,{display:"block",top:0,left:0,right:0,bottom:0,position:"fixed"}),tn.bind(this.fit.domElement,"resize",this.fit),this.fit()):i.fitted?(this.fit=q0.bind(this),re.extend(this.renderer.domElement.style,{display:"block"})):typeof i.width=="number"&&typeof i.height=="number"&&(this.renderer.setSize(i.width,i.height,this.ratio),this.width=i.width,this.height=i.height),this.renderer.bind(ee.Types.resize,X0.bind(this)),this.scene=this.renderer.scene,ao.Instances.push(this),i.autostart&&Ar.init()}get _bound(){return this._events._bound}set _bound(e){this._events._bound=e}addEventListener(){var e;return(e=this._events.addEventListener)==null?void 0:e.apply(this,arguments)}on(){var e;return(e=this._events.addEventListener)==null?void 0:e.apply(this,arguments)}bind(){var e;return(e=this._events.addEventListener)==null?void 0:e.apply(this,arguments)}removeEventListener(){var e;return(e=this._events.removeEventListener)==null?void 0:e.apply(this,arguments)}off(){var e;return(e=this._events.removeEventListener)==null?void 0:e.apply(this,arguments)}unbind(){var e;return(e=this._events.removeEventListener)==null?void 0:e.apply(this,arguments)}dispatchEvent(){var e;return(e=this._events.dispatchEvent)==null?void 0:e.apply(this,arguments)}trigger(){var e;return(e=this._events.dispatchEvent)==null?void 0:e.apply(this,arguments)}listen(){var e;return(e=this._events.listen)==null?void 0:e.apply(this,arguments)}ignore(){var e;return(e=this._events.ignore)==null?void 0:e.apply(this,arguments)}appendTo(e){return e.appendChild(this.renderer.domElement),this.fit&&(this.fit.domElement!==window&&(this.fit.domElement=e,this.fit.attached=!1),this.update()),this}play(){return this.playing=!0,Ar.init(),this.trigger(ee.Types.play)}pause(){return this.playing=!1,this.trigger(ee.Types.pause)}setPlaying(e){this.playing=e}release(e){let i,r,o;if(typeof e>"u")return this.release(this.scene);if(typeof e.unbind=="function"&&e.unbind(),typeof e.fill=="object"&&typeof e.fill.unbind=="function"&&e.fill.unbind(),typeof e.stroke=="object"&&typeof e.stroke.unbind=="function"&&e.stroke.unbind(),e.vertices){if(typeof e.vertices.unbind=="function")try{e.vertices.unbind()}catch{}for(i=0;i<e.vertices.length;i++)r=e.vertices[i],typeof r.unbind=="function"&&r.unbind(),r.controls&&(r.controls.left&&typeof r.controls.left.unbind=="function"&&r.controls.left.unbind(),r.controls.right&&typeof r.controls.right.unbind=="function"&&r.controls.right.unbind())}if(e.children){for(i=0;i<e.children.length;i++)o=e.children[i],this.release(o);if(typeof e.children.unbind=="function")try{e.children.unbind()}catch{}}if(e._renderer){if(e._renderer.elem&&e._renderer.elem.parentNode&&(e._renderer.elem.parentNode.removeChild(e._renderer.elem),delete e._renderer.elem),this.type==="WebGLRenderer"&&this.renderer.ctx){const s=this.renderer.ctx;e._renderer.texture&&(s.deleteTexture(e._renderer.texture),delete e._renderer.texture),e._renderer.positionBuffer&&(s.deleteBuffer(e._renderer.positionBuffer),delete e._renderer.positionBuffer),e._renderer.effect&&(e._renderer.effect=null)}this.type==="CanvasRenderer"&&e._renderer.context&&delete e._renderer.context}return e}getShapesAtPoint(e,i,r){return this.scene&&typeof this.scene.getShapesAtPoint=="function"?this.scene.getShapesAtPoint(e,i,r):[]}update(){const e=!!this._lastFrame,i=re.performance.now();e&&(this.timeDelta=parseFloat((i-this._lastFrame).toFixed(3))),this._lastFrame=i,this.fit&&this.fit.domElement&&!this.fit.attached&&(tn.bind(this.fit.domElement,"resize",this.fit),this.fit.attached=!0,this.fit());const r=this.width,o=this.height,s=this.renderer;return(r!==s.width||o!==s.height)&&s.setSize(r,o,this.ratio),this.trigger(ee.Types.update,this.frameCount,this.timeDelta),this.render()}render(){return this.renderer.render(),this.trigger(ee.Types.render,this.frameCount++)}add(e){return e instanceof Array||(e=Array.prototype.slice.call(arguments)),this.scene.add(e),this}remove(e){return e instanceof Array||(e=Array.prototype.slice.call(arguments)),this.scene.remove(e),this}clear(){return this.scene.remove(this.scene.children),this}makeLine(e,i,r,o){const s=new Po(e,i,r,o);return this.scene.add(s),s}makeArrow(e,i,r,o,s){const a=typeof s=="number"?s:10,l=Math.atan2(o-i,r-e),c=[new Ee(e,i,void 0,void 0,void 0,void 0,ne.move),new Ee(r,o,void 0,void 0,void 0,void 0,ne.line),new Ee(r-a*Math.cos(l-Math.PI/4),o-a*Math.sin(l-Math.PI/4),void 0,void 0,void 0,void 0,ne.line),new Ee(r,o,void 0,void 0,void 0,void 0,ne.move),new Ee(r-a*Math.cos(l+Math.PI/4),o-a*Math.sin(l+Math.PI/4),void 0,void 0,void 0,void 0,ne.line)],d=new Pe(c,!1,!1,!0);return d.noFill(),d.cap="round",d.join="round",this.scene.add(d),d}makeRectangle(e,i,r,o){const s=new fi(e,i,r,o);return this.scene.add(s),s}makeRoundedRectangle(e,i,r,o,s){const a=new $o(e,i,r,o,s);return this.scene.add(a),a}makeCircle(e,i,r,o){const s=new No(e,i,r,o);return this.scene.add(s),s}makeEllipse(e,i,r,o,s){const a=new To(e,i,r,o,s);return this.scene.add(a),a}makeStar(e,i,r,o,s){const a=new ca(e,i,r,o,s);return this.scene.add(a),a}makeCurve(e){const i=arguments.length;if(!Array.isArray(e)){e=[];for(let a=0;a<i;a+=2){const l=arguments[a];if(typeof l!="number")break;const c=arguments[a+1];e.push(new Ee(l,c))}}const r=arguments[i-1],o=new Pe(e,!(typeof r=="boolean"&&r),!0),s=o.getBoundingClientRect();return o.center().translation.set(s.left+s.width/2,s.top+s.height/2),this.scene.add(o),o}makePolygon(e,i,r,o){const s=new la(e,i,r,o);return this.scene.add(s),s}makeArcSegment(e,i,r,o,s,a,l){const c=new na(e,i,r,o,s,a,l);return this.scene.add(c),c}makePoints(e){const i=arguments.length;let r=e;if(!Array.isArray(e)){r=[];for(let s=0;s<i;s+=2){const a=arguments[s];if(typeof a!="number")break;const l=arguments[s+1];r.push(new ie(a,l))}}const o=new aa(r);return this.scene.add(o),o}makePath(e){const i=arguments.length;let r=e;if(!Array.isArray(e)){r=[];for(let l=0;l<i;l+=2){const c=arguments[l];if(typeof c!="number")break;const d=arguments[l+1];r.push(new Ee(c,d))}}const o=arguments[i-1],s=new Pe(r,!(typeof o=="boolean"&&o)),a=s.getBoundingClientRect();return typeof a.top=="number"&&typeof a.left=="number"&&typeof a.right=="number"&&typeof a.bottom=="number"&&s.center().translation.set(a.left+a.width/2,a.top+a.height/2),this.scene.add(s),s}makeText(e,i,r,o){const s=new Tn(e,i,r,o);return this.add(s),s}makeLinearGradient(e,i,r,o){const s=Array.prototype.slice.call(arguments,4),a=new et(e,i,r,o,s);return this.add(a),a}makeRadialGradient(e,i,r){const o=Array.prototype.slice.call(arguments,3),s=new tt(e,i,r,o);return this.add(s),s}makeSprite(e,i,r,o,s,a,l){const c=new Bo(e,i,r,o,s,a);return l&&c.play(),this.add(c),c}makeImage(e,i,r,o,s,a){const l=new Vd(e,i,r,o,s,a);return this.add(l),l}makeImageSequence(e,i,r,o,s){const a=new ha(e,i,r,o);return s&&a.play(),this.add(a),a}makeTexture(e,i){return new De(e,i)}makeGroup(e){e instanceof Array||(e=Array.prototype.slice.call(arguments));const i=new xt;return this.scene.add(i),i.add(e),i}interpret(e,i,r){const o=e.tagName.toLowerCase();if(r=typeof r<"u"?r:!0,!(o in Ze))return null;const s=Ze[o].call(this,e);return r?this.add(i&&s instanceof xt?s.children:s):s.parent&&s.remove(),s}load(e,i){const r=new xt;let o,s,a;const l=(function(c){for(tn.temp.innerHTML=c,s=0;s<tn.temp.children.length;s++)o=tn.temp.children[s],a=this.interpret(o,!1,!1),a!==null&&r.add(a);if(typeof i=="function"){const d=tn.temp.children.length<=1?tn.temp.children[0]:tn.temp.children;i(r,d)}}).bind(this);return/\.svg$/i.test(e)?(Fd(e,l),r):(l(e),r)}};S(Te,"NextFrameId",Bt.NextFrameId),S(Te,"Types",Bt.Types),S(Te,"Version",Bt.Version),S(Te,"PublishDate",Bt.PublishDate),S(Te,"Identifier",Bt.Identifier),S(Te,"Resolution",Bt.Resolution),S(Te,"AutoCalculateImportedMatrices",Bt.AutoCalculateImportedMatrices),S(Te,"Instances",Bt.Instances),S(Te,"uniqueId",Bt.uniqueId),S(Te,"Anchor",Ee),S(Te,"Collection",di),S(Te,"Events",ee),S(Te,"Group",xt),S(Te,"Matrix",Ni),S(Te,"Path",Pe),S(Te,"Registry",bo),S(Te,"Element",sr),S(Te,"Shape",qn),S(Te,"Text",Tn),S(Te,"Vector",ie),S(Te,"Gradient",pt),S(Te,"Image",Vd),S(Te,"ImageSequence",ha),S(Te,"LinearGradient",et),S(Te,"RadialGradient",tt),S(Te,"Sprite",Bo),S(Te,"Stop",ui),S(Te,"Texture",De),S(Te,"ArcSegment",na),S(Te,"Circle",No),S(Te,"Ellipse",To),S(Te,"Line",Po),S(Te,"Points",aa),S(Te,"Polygon",la),S(Te,"Rectangle",fi),S(Te,"RoundedRectangle",$o),S(Te,"Star",ca),S(Te,"CanvasRenderer",Tt),S(Te,"SVGRenderer",Od),S(Te,"WebGLRenderer",Dd),S(Te,"Commands",ne),S(Te,"Utils",W0);var En=Te;function j0(){const n=document.body.getBoundingClientRect(),e=this.width=n.width,i=this.height=n.height;this.renderer.setSize(e,i,this.ratio)}function q0(){const n=this.renderer.domElement.parentElement;if(!n){console.warn("Two.js: Attempting to fit to parent, but no parent found.");return}const e=n.getBoundingClientRect(),i=this.width=e.width,r=this.height=e.height;this.renderer.setSize(i,r,this.ratio)}function X0(n,e){this.width=n,this.height=e,this.trigger(ee.Types.resize,n,e)}var Ar=tn.getRequestAnimationFrame();function Ld(){for(let n=0;n<En.Instances.length;n++){const e=En.Instances[n];e.playing&&e.update()}En.NextFrameId=Ar(Ld)}Ar.init=function(){Ld(),Ar.init=function(){}};let Rn;typeof window<"u"?Rn=window:typeof global<"u"?Rn=global:typeof self<"u"&&(Rn=self);let Hd;const nn=Math.PI*2,kt=Math.PI*.5;function Y0(n,e,i,r,o,s){let a;return arguments.length<=1?(a=n.a,e=n.b,i=n.c,r=n.d,o=n.e,s=n.f):a=n,{translateX:o,translateY:s,scaleX:Math.sqrt(a*a+e*e),scaleY:Math.sqrt(i*i+r*r),rotation:180*Math.atan2(e,a)/Math.PI}}function U0(n){Hd=n}function K0(n,e){e=e&&e.identity()||new Hd;let i=n;const r=[];for(;i&&i._matrix;)r.push(i._matrix),i=i.parent;r.reverse();for(let o=0;o<r.length;o++){const a=r[o].elements;e.multiply(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8])}return e}function Kt(n,e,i){return i*(e-n)+n}function Gt(n,e){for(;n<0;)n+=e;return n%e}const Wd=Rn.Float32Array||Array,G0=Math.floor;function Pn(n){return G0(n*1e6)/1e6}const me={move:"M",line:"L",curve:"C",arc:"A",close:"Z"};class te{constructor(){B(this,"_events",{});B(this,"_bound",!1)}addEventListener(e,i){return(this._events[e]||(this._events[e]=[])).push(i),this._bound=!0,this}on(){return this.addEventListener.apply(this,arguments)}bind(){return this.addEventListener.apply(this,arguments)}removeEventListener(e,i){if(!this._events)return this;if(!e&&!i)return this._events={},this._bound=!1,this;const r=e?[e]:Object.keys(this._events);for(let o=0,s=r.length;o<s;o++){e=r[o];let a=this._events[e];if(a){let l=[];if(i)for(let c=0,d=a.length;c<d;c++){let u=a[c];u=u.handler?u.handler:u,i!==u&&l.push(u)}this._events[e]=l}}return this}off(){return this.removeEventListener.apply(this,arguments)}unbind(){return this.removeEventListener.apply(this,arguments)}dispatchEvent(e){if(!this._events)return this;const i=Array.prototype.slice.call(arguments,1),r=this._events[e];if(r)for(let o=0;o<r.length;o++)r[o].call(this,...i);return this}trigger(){return this.dispatchEvent.apply(this,arguments)}listen(e,i,r){const o=this;e&&(s.obj=e,s.name=i,s.handler=r,e.on(i,s));function s(){r.apply(o,arguments)}return o}ignore(e,i,r){return e.off(i,r),this}}B(te,"Types",{play:"play",pause:"pause",update:"update",render:"render",resize:"resize",change:"change",remove:"remove",insert:"insert",order:"order",load:"load"}),B(te,"Methods",["addEventListener","on","removeEventListener","off","unbind","dispatchEvent","trigger","listen","ignore"]);const jd={x:{enumerable:!0,get:function(){return this._x},set:function(n){this._x!==n&&(this._x=n,this._bound&&this.dispatchEvent(te.Types.change))}},y:{enumerable:!0,get:function(){return this._y},set:function(n){this._y!==n&&(this._y=n,this._bound&&this.dispatchEvent(te.Types.change))}}},vt=class vt extends te{constructor(i=0,r=0){super();B(this,"_x",0);B(this,"_y",0);for(let o in jd)Object.defineProperty(this,o,jd[o]);this.x=i,this.y=r}static add(i,r){return new vt(i.x+r.x,i.y+r.y)}static sub(i,r){return new vt(i.x-r.x,i.y-r.y)}static subtract(i,r){return vt.sub(i,r)}static ratioBetween(i,r){return(i.x*r.x+i.y*r.y)/(i.length()*r.length())}static angleBetween(i,r){if(arguments.length>=4){const a=arguments[0]-arguments[2],l=arguments[1]-arguments[3];return Math.atan2(l,a)}const o=i.x-r.x,s=i.y-r.y;return Math.atan2(s,o)}static distanceBetween(i,r){return Math.sqrt(vt.distanceBetweenSquared(i,r))}static distanceBetweenSquared(i,r){const o=i.x-r.x,s=i.y-r.y;return o*o+s*s}set(i,r){return this.x=i,this.y=r,this}copy(i){return this.x=i.x,this.y=i.y,this}clear(){return this.x=0,this.y=0,this}clone(){return new vt(this.x,this.y)}add(i,r){return arguments.length<=0?this:(arguments.length<=1?typeof i=="number"?(this.x+=i,this.y+=i):i&&typeof i.x=="number"&&typeof i.y=="number"&&(this.x+=i.x,this.y+=i.y):(this.x+=i,this.y+=r),this)}addSelf(i){return this.add.apply(this,arguments)}sub(i,r){return arguments.length<=0?this:(arguments.length<=1?typeof i=="number"?(this.x-=i,this.y-=i):i&&typeof i.x=="number"&&typeof i.y=="number"&&(this.x-=i.x,this.y-=i.y):(this.x-=i,this.y-=r),this)}subtract(){return this.sub.apply(this,arguments)}subSelf(i){return this.sub.apply(this,arguments)}subtractSelf(i){return this.sub.apply(this,arguments)}multiply(i,r){return arguments.length<=0?this:(arguments.length<=1?typeof i=="number"?(this.x*=i,this.y*=i):i&&typeof i.x=="number"&&typeof i.y=="number"&&(this.x*=i.x,this.y*=i.y):(this.x*=i,this.y*=r),this)}multiplySelf(i){return this.multiply.apply(this,arguments)}multiplyScalar(i){return this.multiply(i)}divide(i,r){return arguments.length<=0?this:(arguments.length<=1?typeof i=="number"?(this.x/=i,this.y/=i):i&&typeof i.x=="number"&&typeof i.y=="number"&&(this.x/=i.x,this.y/=i.y):(this.x/=i,this.y/=r),isNaN(this.x)&&(this.x=0),isNaN(this.y)&&(this.y=0),this)}divideSelf(i){return this.divide.apply(this,arguments)}divideScalar(i){return this.divide(i)}negate(){return this.multiply(-1)}dot(i){return this.x*i.x+this.y*i.y}length(){return Math.sqrt(this.lengthSquared())}lengthSquared(){return this.x*this.x+this.y*this.y}normalize(){return this.divideScalar(this.length())}distanceTo(i){return Math.sqrt(this.distanceToSquared(i))}distanceToSquared(i){const r=this.x-i.x,o=this.y-i.y;return r*r+o*o}setLength(i){return this.normalize().multiplyScalar(i)}equals(i,r){return r=typeof r>"u"?1e-4:r,this.distanceTo(i)<r}lerp(i,r){const o=(i.x-this.x)*r+this.x,s=(i.y-this.y)*r+this.y;return this.set(o,s)}isZero(i){return i=typeof i>"u"?1e-4:i,this.length()<i}toString(){return this.x+", "+this.y}toObject(){return{x:Pn(this.x),y:Pn(this.y)}}rotate(i){const r=this.x,o=this.y,s=Math.cos(i),a=Math.sin(i);return this.x=r*s-o*a,this.y=r*a+o*s,this}};B(vt,"zero",new vt),B(vt,"left",new vt(-1,0)),B(vt,"right",new vt(1,0)),B(vt,"up",new vt(0,-1)),B(vt,"down",new vt(0,1));let be=vt;class Ae extends be{constructor(i=0,r=0,o=0,s=0,a=0,l=0,c=me.move){super(i,r);B(this,"controls",{left:new be,right:new be});B(this,"_command",me.move);B(this,"_relative",!0);B(this,"_rx",0);B(this,"_ry",0);B(this,"_xAxisRotation",0);B(this,"_largeArcFlag",0);B(this,"_sweepFlag",1);for(let u in qd)Object.defineProperty(this,u,qd[u]);this.command=c,this.relative=!0;const d=Ae.makeBroadcast(this);this.controls.left.set(o,s).addEventListener(te.Types.change,d),this.controls.right.set(a,l).addEventListener(te.Types.change,d)}static makeBroadcast(i){return r;function r(){i._bound&&i.dispatchEvent(te.Types.change)}}static fromObject(i){return new Ae().copy(i)}copy(i){return this.x=i.x,this.y=i.y,typeof i.command=="string"&&(this.command=i.command),i.controls&&(i.controls.left&&this.controls.left.copy(i.controls.left),i.controls.right&&this.controls.right.copy(i.controls.right)),typeof i.relative=="boolean"&&(this.relative=i.relative),typeof i.rx=="number"&&(this.rx=i.rx),typeof i.ry=="number"&&(this.ry=i.ry),typeof i.xAxisRotation=="number"&&(this.xAxisRotation=i.xAxisRotation),typeof i.largeArcFlag=="number"&&(this.largeArcFlag=i.largeArcFlag),typeof i.sweepFlag=="number"&&(this.sweepFlag=i.sweepFlag),this}clone(){return new Ae().copy(this)}toObject(){return{x:Pn(this.x),y:Pn(this.y),command:this.command,relative:this.relative,controls:{left:this.controls.left.toObject(),right:this.controls.right.toObject()},rx:Pn(this.rx),ry:Pn(this.ry),xAxisRotation:Pn(this.xAxisRotation),largeArcFlag:Pn(this.largeArcFlag),sweepFlag:Pn(this.sweepFlag)}}toString(){return JSON.stringify(this.toObject())}}const qd={command:{enumerable:!0,get:function(){return this._command},set:function(n){this._command!==n&&(this._command=n,this._bound&&this.dispatchEvent(te.Types.change))}},relative:{enumerable:!0,get:function(){return this._relative},set:function(n){this._relative!==!!n&&(this._relative=!!n,this._bound&&this.dispatchEvent(te.Types.change))}},rx:{enumerable:!0,get:function(){return this._rx},set:function(n){this._rx!==n&&(this._rx=n,this._bound&&this.dispatchEvent(te.Types.change))}},ry:{enumerable:!0,get:function(){return this._ry},set:function(n){this._ry!==n&&(this._ry=n,this._bound&&this.dispatchEvent(te.Types.change))}},xAxisRotation:{enumerable:!0,get:function(){return this._xAxisRotation},set:function(n){this._xAxisRotation!==n&&(this._xAxisRotation=n,this._bound&&this.dispatchEvent(te.Types.change))}},largeArcFlag:{enumerable:!0,get:function(){return this._largeArcFlag},set:function(n){this._largeArcFlag!==n&&(this._largeArcFlag=n,this._bound&&this.dispatchEvent(te.Types.change))}},sweepFlag:{get:function(){return this._sweepFlag},set:function(n){this._sweepFlag!==n&&(this._sweepFlag=n,this._bound&&this.dispatchEvent(te.Types.change))}}};let Z0=0;const Oo={NextFrameId:null,Types:{webgl:"WebGLRenderer",svg:"SVGRenderer",canvas:"CanvasRenderer"},Version:"<%= version %>",PublishDate:"<%= publishDate %>",Identifier:"two-",Resolution:12,AutoCalculateImportedMatrices:!0,Instances:[],uniqueId:function(){return Z0++}},zo={RecursionLimit:16,abscissas:[[.5773502691896],[0,.7745966692415],[.3399810435849,.8611363115941],[0,.5384693101057,.9061798459387],[.2386191860832,.6612093864663,.9324695142032],[0,.4058451513774,.7415311855994,.9491079123428],[.1834346424956,.5255324099163,.7966664774136,.9602898564975],[0,.3242534234038,.6133714327006,.8360311073266,.9681602395076],[.1488743389816,.4333953941292,.679409568299,.865063366689,.9739065285172],[0,.2695431559523,.5190961292068,.730152005574,.8870625997681,.9782286581461],[.1252334085115,.3678314989982,.5873179542866,.7699026741943,.9041172563705,.9815606342467],[0,.2304583159551,.4484927510364,.6423493394403,.8015780907333,.917598399223,.9841830547186],[.1080549487073,.3191123689279,.5152486363582,.6872929048117,.8272013150698,.9284348836636,.9862838086968],[0,.2011940939974,.3941513470776,.5709721726085,.7244177313602,.8482065834104,.9372733924007,.9879925180205],[.0950125098376,.2816035507793,.4580167776572,.6178762444026,.755404408355,.8656312023878,.9445750230732,.9894009349916]],weights:[[1],[.8888888888889,.5555555555556],[.6521451548625,.3478548451375],[.5688888888889,.4786286704994,.2369268850562],[.4679139345727,.3607615730481,.1713244923792],[.4179591836735,.3818300505051,.2797053914893,.1294849661689],[.3626837833784,.3137066458779,.2223810344534,.1012285362904],[.3302393550013,.31234707704,.2606106964029,.1806481606949,.0812743883616],[.2955242247148,.26926671931,.219086362516,.1494513491506,.0666713443087],[.2729250867779,.2628045445102,.233193764592,.1862902109277,.1255803694649,.0556685671162],[.2491470458134,.2334925365384,.2031674267231,.1600783285433,.1069393259953,.0471753363865],[.2325515532309,.2262831802629,.2078160475369,.1781459807619,.1388735102198,.0921214998377,.0404840047653],[.2152638534632,.2051984637213,.1855383974779,.1572031671582,.1215185706879,.0801580871598,.0351194603318],[.2025782419256,.1984314853271,.1861610000156,.166269205817,.1395706779262,.1071592204672,.0703660474881,.0307532419961],[.1894506104551,.1826034150449,.169156519395,.1495959888166,.1246289712555,.0951585116825,.0622535239386,.0271524594118]]};function Do(n,e,i,r,o){const s=1-n;return s*s*s*e+3*s*s*n*i+3*s*n*n*r+n*n*n*o}function Xd(n,e,i,r,o,s,a,l,c){c=c||zo.RecursionLimit;const d=c+1;if(Math.abs(n-a)<.001&&Math.abs(e-l)<.001)return[new Ae(a,l)];const u=[];for(let f=0;f<d;f++){const h=f/d,p=Do(h,n,i,o,a),m=Do(h,e,r,s,l);u.push(new Ae(p,m))}return u}function Q0(n,e,i,r,o,s,a,l,c){if(n===i&&e===r&&o===a&&s===l){const b=a-n,y=l-e;return Math.sqrt(b*b+y*y)}const d=9*(i-o)+3*(a-n),u=6*(n+o)-12*i,f=3*(i-n),h=9*(r-s)+3*(l-e),p=6*(e+s)-12*r,m=3*(r-e);function g(b){const y=(d*b+u)*b+f,_=(h*b+p)*b+m;return Math.sqrt(y*y+_*_)}return e1(g,0,1,c||zo.RecursionLimit)}function J0(n,e,i,r,o,s,a,l){const c=[],d=[[],[]];let u,f,h,p,m,g,b,y;for(let C=0;C<2;++C){if(C===0?(f=6*n-12*i+6*o,u=-3*n+9*i-9*o+3*a,h=3*i-3*n):(f=6*e-12*r+6*s,u=-3*e+9*r-9*s+3*l,h=3*r-3*e),Math.abs(u)<.001){if(Math.abs(f)<.001)continue;p=-h/f,0<p&&p<1&&c.push(p);continue}b=f*f-4*h*u,y=Math.sqrt(b),!(b<0)&&(m=(-f+y)/(2*u),0<m&&m<1&&c.push(m),g=(-f-y)/(2*u),0<g&&g<1&&c.push(g))}let _=c.length,x=_,w;for(;_--;)p=c[_],w=1-p,d[0][_]=w*w*w*n+3*w*w*p*i+3*w*p*p*o+p*p*p*a,d[1][_]=w*w*w*e+3*w*w*p*r+3*w*p*p*s+p*p*p*l;return d[0][x]=n,d[1][x]=e,d[0][x+1]=a,d[1][x+1]=l,d[0].length=d[1].length=x+2,{min:{x:Math.min.apply(0,d[0]),y:Math.min.apply(0,d[1])},max:{x:Math.max.apply(0,d[0]),y:Math.max.apply(0,d[1])}}}function e1(n,e,i,r){let o=zo.abscissas[r-2],s=zo.weights[r-2],a=.5*(i-e),l=a+e,c=0,d=r+1>>1,u=r&1?s[c++]*n(l):0;for(;c<d;){const f=a*o[c];u+=s[c++]*(n(l+f)+n(l-f))}return a*u}function t1(n,e){const i=n.length,r=i-1;for(let o=0;o<i;o++){const s=n[o],a=e?Gt(o-1,i):Math.max(o-1,0),l=e?Gt(o+1,i):Math.min(o+1,r),c=n[a],d=s,u=n[l];n1(c,d,u),d.command=o===0?me.move:me.curve}}function n1(n,e,i){const r=be.angleBetween(n,e),o=be.angleBetween(i,e);let s=be.distanceBetween(n,e),a=be.distanceBetween(i,e),l=(r+o)/2;return s<.001||a<.001?(typeof e.relative=="boolean"&&!e.relative&&(e.controls.left.copy(e),e.controls.right.copy(e)),e):(s*=.33,a*=.33,o<r?l+=kt:l-=kt,e.controls.left.x=Math.cos(l)*s,e.controls.left.y=Math.sin(l)*s,l-=Math.PI,e.controls.right.x=Math.cos(l)*a,e.controls.right.y=Math.sin(l)*a,typeof e.relative=="boolean"&&!e.relative&&(e.controls.left.x+=e.x,e.controls.left.y+=e.y,e.controls.right.x+=e.x,e.controls.right.y+=e.y),e)}let Or=(qi=class extends te{constructor(){super();B(this,"_flagId",!1);B(this,"_flagClassName",!1);B(this,"_renderer",{});B(this,"_id",Oo.Identifier+Oo.uniqueId());B(this,"_className","");B(this,"classList",[]);for(let i in Yd)Object.defineProperty(this,i,Yd[i])}static fromObject(i){const r=new qi().copy(i);return"id"in i&&(r.id=i.id),r}flagReset(){return this._flagId=this._flagClassName=!1,this}copy(i){return i.renderer&&typeof i.renderer.type=="string"&&(this.renderer.type=i.renderer.type),typeof i.className=="string"&&(this.className=i.className),this}toObject(){return{renderer:{type:this.renderer.type},id:this.id,className:this.className}}dispose(){if(typeof this.unbind=="function"&&this.unbind(),this._renderer){if(this._renderer.elem&&this._renderer.elem.parentNode&&(this._renderer.elem.parentNode.removeChild(this._renderer.elem),delete this._renderer.elem),this.type==="WebGLRenderer"&&this.renderer.ctx){const r=this.renderer.ctx;this._renderer.texture&&(r.deleteTexture(this._renderer.texture),delete this._renderer.texture),this._renderer.positionBuffer&&(r.deleteBuffer(this._renderer.positionBuffer),delete this._renderer.positionBuffer),this._renderer.effect&&(this._renderer.effect=null)}this.type==="CanvasRenderer"&&this._renderer.context&&delete this._renderer.context}const i=this._renderer.type;return this._renderer={type:i},this}},B(qi,"Properties",["renderer","id","className"]),qi);const Yd={renderer:{enumerable:!1,get:function(){return this._renderer}},id:{enumerable:!0,get:function(){return this._id},set:function(n){const e=this._id;n!==this._id&&(this._id=n,this._flagId=!0,this.parent&&(delete this.parent.children.ids[e],this.parent.children.ids[this._id]=this))}},className:{enumerable:!0,get:function(){return this._className},set:function(n){this._className!==n&&(this._flagClassName=!0,this.classList=n.split(/\s+?/),this._className=n)}}};class Lo extends Error{constructor(i){super();B(this,"name","Two.js");B(this,"message");this.message=i}}class i1{constructor(){B(this,"map",{})}add(e,i){return this.map[e]=i,this}remove(e){return delete this.map[e],this}get(e){return this.map[e]}contains(e){return e in this.map}}let Ho;const Ud={video:/\.(mp4|webm|ogg)$/i,image:/\.(jpe?g|png|gif|tiff|webp)$/i,effect:/texture|gradient/i};Rn.document&&(Ho=document.createElement("a"));const it=class it extends Or{constructor(i,r){super();B(this,"_flagSrc",!1);B(this,"_flagImage",!1);B(this,"_flagVideo",!1);B(this,"_flagLoaded",!1);B(this,"_flagRepeat",!1);B(this,"_flagOffset",!1);B(this,"_flagScale",!1);B(this,"_src","");B(this,"_image",null);B(this,"_loaded",!1);B(this,"_repeat","no-repeat");B(this,"_scale",1);B(this,"_offset",null);for(let o in Kd)Object.defineProperty(this,o,Kd[o]);if(this._renderer.type="texture",this._renderer.flagOffset=r1.bind(this),this._renderer.flagScale=o1.bind(this),this.loaded=!1,this.repeat="no-repeat",this.offset=new be,typeof r=="function"){const o=(function(){this.unbind(te.Types.load,o),typeof r=="function"&&r()}).bind(this);this.bind(te.Types.load,o)}if(typeof i=="string")this.src=i;else if(typeof i=="object"){const o=Object.prototype.toString.call(i);(o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]"||o==="[object HTMLVideoElement]"||o==="[object Image]")&&(this.image=i)}this._update()}fromObject(i){const r=new it().copy(i);return"id"in i&&(r.id=i.id),r}static getAbsoluteURL(i){return Ho?(Ho.href=i,Ho.href):i}static loadHeadlessBuffer(i,r){i.image.onload=r,i.image.src=i.src}static getTag(i){return i&&i.nodeName&&i.nodeName.toLowerCase()||"img"}static getImage(i){const r=it.getAbsoluteURL(i);if(it.ImageRegistry.contains(r))return it.ImageRegistry.get(r);let o;return Rn.document?Ud.video.test(r)?o=document.createElement("video"):o=document.createElement("img"):console.warn("Two.js: no prototypical image defined for Two.Texture"),o.crossOrigin="anonymous",o.referrerPolicy="no-referrer",o}static load(i,r){let o=i.image,s=it.getTag(o);i._flagImage&&(/canvas/i.test(s)?it.Register.canvas(i,r):(i._src=o.getAttribute("two-src")||o.src,it.Register[s](i,r))),i._flagSrc&&(o||(o=it.getImage(i.src),i.image=o),s=it.getTag(o),it.Register[s](i,r))}clone(){const i=new it(this.src);return i.repeat=this.repeat,i.offset.copy(this.offset),i.scale=this.scale,i}copy(i){return this.src=i.src,this.repeat=i.repeat,this.offset=typeof i.offset=="number"||i.offset instanceof be?i.offset:new be().copy(i.offset),this.scale=typeof i.scale=="number"||i.scale instanceof be?i.scale:new be().copy(i.scale),this}toObject(){const i=super.toObject.call(this);return i.renderer.type="texture",i.src=this.src,i.repeat=this.repeat,i.offset=this.offset.toObject(),i.scale=typeof this.scale=="number"?this.scale:this.scale.toObject(),i}_update(){return(this._flagSrc||this._flagImage)&&(this.trigger(te.Types.change),(this._flagSrc||this._flagImage)&&(this.loaded=!1,it.load(this,(function(){this.loaded=!0,this.trigger(te.Types.change).trigger(te.Types.load)}).bind(this)))),this._image&&this._image.readyState>=4&&(this._flagVideo=!0),this}flagReset(){return this._flagSrc=this._flagImage=this._flagLoaded=this._flagRepeat=this._flagVideo=this._flagScale=this._flagOffset=!1,super.flagReset.call(this),this}dispose(){if(super.dispose(),"elem"in this._renderer){const i=this._renderer.elem;i.parentNode.removeChild(i)}return"effect"in this._renderer&&(this._renderer.effect=null),this}};B(it,"Properties",["src","loaded","repeat","scale","offset","image"]),B(it,"RegularExpressions",Ud),B(it,"ImageRegistry",new i1),B(it,"Register",{canvas:function(i,r){i._src="#"+i.id,it.ImageRegistry.add(i.src,i.image),typeof r=="function"&&r()},img:function(i,r){const o=i.image,s=function(l){o.removeEventListener&&typeof o.removeEventListener=="function"&&(o.removeEventListener("load",s,!1),o.removeEventListener("error",a,!1)),typeof r=="function"&&r()},a=function(l){throw typeof o.removeEventListener=="function"&&(o.removeEventListener("load",s,!1),o.removeEventListener("error",a,!1)),new Lo("unable to load "+i.src)};typeof o.width=="number"&&o.width>0&&typeof o.height=="number"&&o.height>0?s():typeof o.addEventListener=="function"&&(o.addEventListener("load",s,!1),o.addEventListener("error",a,!1)),i._src=it.getAbsoluteURL(i._src),!(o&&o.getAttribute("two-src"))&&(o.setAttribute("two-src",i.src),it.ImageRegistry.add(i.src,o),i.image.src=i.src)},video:function(i,r){const o=function(a){i.image.removeEventListener("canplaythrough",o,!1),i.image.removeEventListener("error",s,!1),i.image.width=i.image.videoWidth,i.image.height=i.image.videoHeight,typeof r=="function"&&r()},s=function(a){throw i.image.removeEventListener("canplaythrough",o,!1),i.image.removeEventListener("error",s,!1),new Lo("unable to load "+i.src)};i._src=it.getAbsoluteURL(i._src),i.image.getAttribute("two-src")||(i.image.setAttribute("two-src",i.src),it.ImageRegistry.add(i.src,i.image)),i.image.readyState>=4?o():(i.image.addEventListener("canplaythrough",o,!1),i.image.addEventListener("error",s,!1),i.image.src=i.src,i.image.load())}});let nt=it;const Kd={src:{enumerable:!0,get:function(){return this._src},set:function(n){this._src=n,this._flagSrc=!0}},loaded:{enumerable:!0,get:function(){return this._loaded},set:function(n){this._loaded=n,this._flagLoaded=!0}},repeat:{enumerable:!0,get:function(){return this._repeat},set:function(n){this._repeat=n,this._flagRepeat=!0}},image:{enumerable:!0,get:function(){return this._image},set:function(n){const e=nt.getTag(n);let i;switch(e){case"canvas":i="#"+n.id;break;default:i=n.src}nt.ImageRegistry.contains(i)?this._image=nt.ImageRegistry.get(n.src):this._image=n,this._flagImage=!0}},offset:{enumerable:!0,get:function(){return this._offset},set:function(n){this._offset&&this._offset.unbind(te.Types.change,this._renderer.flagOffset),this._offset=n,this._offset.bind(te.Types.change,this._renderer.flagOffset),this._flagOffset=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(n){this._scale instanceof be&&this._scale.unbind(te.Types.change,this._renderer.flagScale),this._scale=n,this._scale instanceof be&&this._scale.bind(te.Types.change,this._renderer.flagScale),this._flagScale=!0}}};function r1(){this._flagOffset=!0}function o1(){this._flagScale=!0}class Ti extends Array{constructor(){super();Wl(this,St,new te);arguments[0]&&Array.isArray(arguments[0])?arguments[0].length>0&&this.push.apply(this,arguments[0]):arguments.length>0&&this.push.apply(this,arguments)}get _events(){return qt(this,St)}set _events(i){Em(this,St,i)}get _bound(){return qt(this,St)._bound}set _bound(i){qt(this,St)._bound=i}addEventListener(){var i;return(i=qt(this,St).addEventListener)==null?void 0:i.apply(this,arguments)}on(){var i;return(i=qt(this,St).on)==null?void 0:i.apply(this,arguments)}bind(){var i;return(i=qt(this,St).bind)==null?void 0:i.apply(this,arguments)}removeEventListener(){var i;return(i=qt(this,St).removeEventListener)==null?void 0:i.apply(this,arguments)}off(){var i;return(i=qt(this,St).off)==null?void 0:i.apply(this,arguments)}unbind(){var i;return(i=qt(this,St).unbind)==null?void 0:i.apply(this,arguments)}dispatchEvent(){var i;return(i=qt(this,St).dispatchEvent)==null?void 0:i.apply(this,arguments)}trigger(){var i;return(i=qt(this,St).trigger)==null?void 0:i.apply(this,arguments)}listen(){var i;return(i=qt(this,St).listen)==null?void 0:i.apply(this,arguments)}ignore(){var i;return(i=qt(this,St).ignore)==null?void 0:i.apply(this,arguments)}pop(){const i=super.pop.apply(this,arguments);return this.trigger(te.Types.remove,[i]),i}shift(){const i=super.shift.apply(this,arguments);return this.trigger(te.Types.remove,[i]),i}push(){const i=super.push.apply(this,arguments);return this.trigger(te.Types.insert,arguments),i}unshift(){const i=super.unshift.apply(this,arguments);return this.trigger(te.Types.insert,arguments),i}splice(){const i=super.splice.apply(this,arguments);if(this.trigger(te.Types.remove,i),arguments.length>2){const r=this.slice(arguments[0],arguments[0]+arguments.length-2);this.trigger(te.Types.insert,r),this.trigger(te.Types.order)}return i}sort(){return super.sort.apply(this,arguments),this.trigger(te.Types.order),this}reverse(){return super.reverse.apply(this,arguments),this.trigger(te.Types.order),this}indexOf(){return super.indexOf.apply(this,arguments)}map(i,r){const o=[];for(let s=0;s<this.length;s++){const a=this[s];let l;r?l=i.call(r,a,s):l=i(a,s),o.push(l)}return o}}St=new WeakMap;const Gd=Array.prototype.slice;function s1(n){if(n==null)return!1;const e=n.length;return typeof e=="number"&&e>=0&&e<4294967296}const je={isNaN:function(n){return typeof n=="number"&&n!==+n},isElement:function(n){return!!(n&&n.nodeType===1)},isObject:function(n){const e=typeof n;return e==="function"||e==="object"&&!!n},isFunction:function(n){return typeof n=="function"},extend:function(n){const e=Gd.call(arguments,1);for(let i=0;i<e.length;i++){const r=e[i];for(let o in r)n[o]=r[o]}return n},defaults:function(n){const e=Gd.call(arguments,1);for(let i=0;i<e.length;i++){const r=e[i];for(let o in r)n[o]===void 0&&(n[o]=r[o])}return n},each:function(n,e,i){const r=i||this,o=!s1(n)&&Object.keys(n),s=(o||n).length;for(let a=0;a<s;a++){const l=o?o[a]:a;e.call(r,n[l],l,n)}return n},performance:Rn.performance&&Rn.performance.now?Rn.performance:Date},Jt=class Jt extends Or{constructor(i,r,o){super();B(this,"_flagOffset",!0);B(this,"_flagOpacity",!0);B(this,"_flagColor",!0);B(this,"_offset",0);B(this,"_opacity",1);B(this,"_color","#fff");for(let s in Zd)Object.defineProperty(this,s,Zd[s]);this._renderer.type="stop",this.offset=typeof i=="number"?i:Jt.Index<=0?0:1,this.opacity=typeof o=="number"?o:1,this.color=typeof r=="string"?r:Jt.Index<=0?"#fff":"#000",Jt.Index=(Jt.Index+1)%2}static fromObject(i){const r=new Jt().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<Jt.Properties.length;r++){const o=Jt.Properties[r];o in i&&(this[o]=i[o])}return this}clone(i){const r=new Jt;return je.each(Jt.Properties,function(o){r[o]=this[o]},this),i&&i.stops&&i.stops.push(r),r}toObject(){const i=super.toObject.call(this);return i.renderer.type="stop",je.each(Jt.Properties,r=>{i[r]=this[r]},this),i}flagReset(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,super.flagReset.call(this),this}};B(Jt,"Index",0),B(Jt,"Properties",["offset","opacity","color"]);let $i=Jt;const Zd={offset:{enumerable:!0,get:function(){return this._offset},set:function(n){this._offset=n,this._flagOffset=!0,this.parent&&(this.parent._flagStops=!0)}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(n){this._opacity=n,this._flagOpacity=!0,this.parent&&(this.parent._flagStops=!0)}},color:{enumerable:!0,get:function(){return this._color},set:function(n){this._color=n,this._flagColor=!0,this.parent&&(this.parent._flagStops=!0)}}},On=class On extends Or{constructor(i){super();B(this,"_flagStops",!1);B(this,"_flagSpread",!1);B(this,"_flagUnits",!1);B(this,"_spread","");B(this,"_units","");for(let r in Qd)Object.defineProperty(this,r,Qd[r]);this._renderer.type="gradient",this._renderer.flagStops=a1.bind(this),this._renderer.bindStops=l1.bind(this),this._renderer.unbindStops=c1.bind(this),this.spread="pad",this.units="objectBoundingBox",i&&(this.stops=i)}static fromObject(i){let r=i.stops;r&&r.length>0&&(r=r.map(s=>s instanceof $i?s:new $i().copy(s)));const o=new On(r).copy(i);return"id"in i&&(o.id=i.id),o}clone(i){const r=this.stops.map(s=>s.clone()),o=new On(r);return je.each(On.Properties,s=>{o[s]=this[s]},this),i&&i.add(o),o}copy(i){super.copy.call(this,i);for(let r=0;r<On.Properties.length;r++){const o=On.Properties[r];o in i&&(this[o]=i[o])}return this}toObject(){const i={stops:this.stops.map(r=>r.toObject())};return je.each(On.Properties,r=>{i[r]=this[r]},this),i}_update(){return(this._flagSpread||this._flagStops)&&this.trigger(te.Types.change),this}flagReset(){return this._flagSpread=this._flagUnits=this._flagStops=!1,super.flagReset.call(this),this}dispose(){if("elem"in this._renderer){const i=this._renderer.elem;i.parentNode.removeChild(i)}return"effect"in this._renderer&&(this._renderer.effect=null),this}};B(On,"Stop",$i),B(On,"Properties",["spread","stops","units"]);let gt=On;const Qd={spread:{enumerable:!0,get:function(){return this._spread},set:function(n){this._spread=n,this._flagSpread=!0}},units:{enumerable:!0,get:function(){return this._units},set:function(n){this._units=n,this._flagUnits=!0}},stops:{enumerable:!0,get:function(){return this._stops},set:function(n){const e=this._renderer.bindStops,i=this._renderer.unbindStops;this._stops&&this._stops.unbind(te.Types.insert,e).unbind(te.Types.remove,i),this._stops=new Ti((n||[]).slice(0)),this._stops.bind(te.Types.insert,e).bind(te.Types.remove,i),e(this._stops)}}};function a1(){this._flagStops=!0}function l1(n){let e=n.length;for(;e--;)n[e].bind(te.Types.change,this._renderer.flagStops),n[e].parent=this;this._renderer.flagStops()}function c1(n){let e=n.length;for(;e--;)n[e].unbind(te.Types.change,this._renderer.flagStops),delete n[e].parent;this._renderer.flagStops()}const _i=class _i extends gt{constructor(i,r,o,s,a){super(a);B(this,"_flagEndPoints",!1);B(this,"_left",null);B(this,"_right",null);for(let l in Jd)Object.defineProperty(this,l,Jd[l]);this._renderer.type="linear-gradient",this._renderer.flagEndPoints=d1.bind(this),this.left=new be,this.right=new be,typeof i=="number"&&(this.left.x=i),typeof r=="number"&&(this.left.y=r),typeof o=="number"&&(this.right.x=o),typeof s=="number"&&(this.right.y=s)}static fromObject(i){const r=new _i().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<_i.Properties.length;r++){const o=_i.Properties[r];o in i&&(this[o]=i[o]instanceof be?i[o]:new be().copy(i[o]))}return this}clone(i){const r=this.stops.map(function(s){return s.clone()}),o=new _i(this.left._x,this.left._y,this.right._x,this.right._y,r);return je.each(gt.Properties,function(s){o[s]=this[s]},this),i&&i.add(o),o}toObject(){const i=super.toObject.call(this);return i.left=this.left.toObject(),i.right=this.right.toObject(),i}_update(){return(this._flagEndPoints||this._flagSpread||this._flagStops)&&this.trigger(te.Types.change),this}flagReset(){return this._flagEndPoints=!1,super.flagReset.call(this),this}};B(_i,"Stop",$i),B(_i,"Properties",["left","right"]);let zt=_i;const Jd={left:{enumerable:!0,get:function(){return this._left},set:function(n){this._left instanceof be&&this._left.unbind(te.Types.change,this._renderer.flagEndPoints),this._left=n,this._left.bind(te.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}},right:{enumerable:!0,get:function(){return this._right},set:function(n){this._right instanceof be&&this._right.unbind(te.Types.change,this._renderer.flagEndPoints),this._right=n,this._right.bind(te.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}}};function d1(){this._flagEndPoints=!0}const zn=class zn extends gt{constructor(i,r,o,s,a,l){super(s);B(this,"_flagRadius",!1);B(this,"_flagCenter",!1);B(this,"_flagFocal",!1);B(this,"_radius",0);B(this,"_center",null);B(this,"_focal",null);for(let c in eu)Object.defineProperty(this,c,eu[c]);this._renderer.type="radial-gradient",this._renderer.flagCenter=u1.bind(this),this._renderer.flagFocal=f1.bind(this),this.center=new be,this.radius=typeof o=="number"?o:1,this.focal=new be,typeof i=="number"&&(this.center.x=i),typeof r=="number"&&(this.center.y=r),this.focal.copy(this.center),typeof a=="number"&&(this.focal.x=a),typeof l=="number"&&(this.focal.y=l)}static fromObject(i){const r=new zn().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<zn.Properties.length;r++){const o=zn.Properties[r];o in i&&(/(center|focal)i/.test(o)?this[o]=i[o]instanceof be?i[o]:new be().copy(i[o]):typeof i[o]=="number"&&(this[o]=i[MediaKeySystemAccess]))}return this}clone(i){const r=this.stops.map(function(s){return s.clone()}),o=new zn(this.center._x,this.center._y,this._radius,r,this.focal._x,this.focal._y);return je.each(gt.Properties.concat(zn.Properties),function(s){o[s]=this[s]},this),i&&i.add(o),o}toObject(){const i=super.toObject.call(this);return je.each(zn.Properties,function(r){i[r]=this[r]},this),i.center=this.center.toObject(),i.focal=this.focal.toObject(),i}_update(){return(this._flagRadius||this._flatCenter||this._flagFocal||this._flagSpread||this._flagStops)&&this.trigger(te.Types.change),this}flagReset(){return this._flagRadius=this._flagCenter=this._flagFocal=!1,super.flagReset.call(this),this}};B(zn,"Stop",$i),B(zn,"Properties",["center","radius","focal"]);let Dt=zn;const eu={radius:{enumerable:!0,get:function(){return this._radius},set:function(n){this._radius=n,this._flagRadius=!0}},center:{enumerable:!0,get:function(){return this._center},set:function(n){this._center&&this._center.unbind(te.Types.change,this._renderer.flagCenter),this._center=n,this._center.bind(te.Types.change,this._renderer.flagCenter),this._flagCenter=!0}},focal:{enumerable:!0,get:function(){return this._focal},set:function(n){this._focal&&this._focal.unbind(te.Types.change,this._renderer.flagFocal),this._focal=n,this._focal.bind(te.Types.change,this._renderer.flagFocal),this._flagFocal=!0}}};function u1(){this._flagCenter=!0}function f1(){this._flagFocal=!0}function tu(n,e){if(e===0||e===1)return!0;const r=n._length*e;let o=0;for(let s=0;s<n._lengths.length;s++){const a=n._lengths[s];if(o>=r)return r-o>=0;o+=a}return!1}function Wo(n,e){const i=n._length;if(e<=0)return 0;if(e>=i)return n._lengths.length-1;for(let r=0,o=0;r<n._lengths.length;r++){if(o+n._lengths[r]>=e)return e-=o,Math.max(r-1,0)+e/n._lengths[r];o+=n._lengths[r]}return-1}function nu(n,e,i){let r,o,s,a,l,c,d,u;const f=e.controls&&e.controls.right,h=n.controls&&n.controls.left;return r=e.x,l=e.y,o=(f||e).x,c=(f||e).y,s=(h||n).x,d=(h||n).y,a=n.x,u=n.y,f&&e._relative&&(o+=e.x,c+=e.y),h&&n._relative&&(s+=n.x,d+=n.y),Q0(r,l,o,c,s,d,a,u,i)}function _a(n,e,i){let r,o,s,a,l,c,d,u;const f=e.controls&&e.controls.right,h=n.controls&&n.controls.left;return r=e.x,l=e.y,o=(f||e).x,c=(f||e).y,s=(h||n).x,d=(h||n).y,a=n.x,u=n.y,f&&e._relative&&(o+=e.x,c+=e.y),h&&n._relative&&(s+=n.x,d+=n.y),Xd(r,l,o,c,s,d,a,u,i)}function Ei(n){switch(n.renderer.type){case"texture":return nt.fromObject(n);case"gradient":return gt.fromObject(n);case"linear-gradient":return zt.fromObject(n);case"radial-gradient":return Dt.fromObject(n)}return n}const h1=Math.cos,m1=Math.sin,iu=Math.tan,wa=[],Ht=class Ht extends te{constructor(i,r,o,s,a,l){super();B(this,"elements",new Wd(9));B(this,"manual",!1);let c=i;Array.isArray(c)||(c=Array.prototype.slice.call(arguments)),this.identity(),c.length>0&&this.set(c)}static Multiply(i,r,o){if(r.length<=3){const k=i;let $,v,E;const P=r[0]||0,F=r[1]||0,R=r[2]||0;return $=k[0]*P+k[1]*F+k[2]*R,v=k[3]*P+k[4]*F+k[5]*R,E=k[6]*P+k[7]*F+k[8]*R,[$,v,E]}const s=i[0],a=i[1],l=i[2],c=i[3],d=i[4],u=i[5],f=i[6],h=i[7],p=i[8],m=r[0],g=r[1],b=r[2],y=r[3],_=r[4],x=r[5],w=r[6],C=r[7],N=r[8];return o=o||new Wd(9),o[0]=s*m+a*y+l*w,o[1]=s*g+a*_+l*C,o[2]=s*b+a*x+l*N,o[3]=c*m+d*y+u*w,o[4]=c*g+d*_+u*C,o[5]=c*b+d*x+u*N,o[6]=f*m+h*y+p*w,o[7]=f*g+h*_+p*C,o[8]=f*b+h*x+p*N,o}static fromObject(i){return new Ht().copy(i)}set(i,r,o,s,a,l,c,d,u){if(typeof r>"u"){const f=i;i=f[0],r=f[1],o=f[2],s=f[3],a=f[4],l=f[5],c=f[6],d=f[7],u=f[8]}return this.elements[0]=i,this.elements[1]=r,this.elements[2]=o,this.elements[3]=s,this.elements[4]=a,this.elements[5]=l,this.elements[6]=c,this.elements[7]=d,this.elements[8]=u,this.trigger(te.Types.change)}copy(i){return this.elements[0]=i.elements[0],this.elements[1]=i.elements[1],this.elements[2]=i.elements[2],this.elements[3]=i.elements[3],this.elements[4]=i.elements[4],this.elements[5]=i.elements[5],this.elements[6]=i.elements[6],this.elements[7]=i.elements[7],this.elements[8]=i.elements[8],this.manual=i.manual,this.trigger(te.Types.change)}identity(){return this.elements[0]=Ht.Identity[0],this.elements[1]=Ht.Identity[1],this.elements[2]=Ht.Identity[2],this.elements[3]=Ht.Identity[3],this.elements[4]=Ht.Identity[4],this.elements[5]=Ht.Identity[5],this.elements[6]=Ht.Identity[6],this.elements[7]=Ht.Identity[7],this.elements[8]=Ht.Identity[8],this.trigger(te.Types.change)}multiply(i,r,o,s,a,l,c,d,u){if(typeof r>"u")return this.elements[0]*=i,this.elements[1]*=i,this.elements[2]*=i,this.elements[3]*=i,this.elements[4]*=i,this.elements[5]*=i,this.elements[6]*=i,this.elements[7]*=i,this.elements[8]*=i,this.trigger(te.Types.change);if(typeof o>"u"&&(o=1),typeof s>"u"){i=i||0,r=r||0,o=o||0,a=this.elements;const X=a[0]*i+a[1]*r+a[2]*o,G=a[3]*i+a[4]*r+a[5]*o,Z=a[6]*i+a[7]*r+a[8]*o;return[X,G,Z]}const f=this.elements,h=[i,r,o,s,a,l,c,d,u],p=f[0],m=f[1],g=f[2],b=f[3],y=f[4],_=f[5],x=f[6],w=f[7],C=f[8],N=h[0],k=h[1],$=h[2],v=h[3],E=h[4],P=h[5],F=h[6],R=h[7],M=h[8];return this.elements[0]=p*N+m*v+g*F,this.elements[1]=p*k+m*E+g*R,this.elements[2]=p*$+m*P+g*M,this.elements[3]=b*N+y*v+_*F,this.elements[4]=b*k+y*E+_*R,this.elements[5]=b*$+y*P+_*M,this.elements[6]=x*N+w*v+C*F,this.elements[7]=x*k+w*E+C*R,this.elements[8]=x*$+w*P+C*M,this.trigger(te.Types.change)}inverse(i){const r=this.elements;i=i||new Ht;const o=r[0],s=r[1],a=r[2],l=r[3],c=r[4],d=r[5],u=r[6],f=r[7],h=r[8],p=h*c-d*f,m=-h*l+d*u,g=f*l-c*u;let b=o*p+s*m+a*g;return b?(b=1/b,i.elements[0]=p*b,i.elements[1]=(-h*s+a*f)*b,i.elements[2]=(d*s-a*c)*b,i.elements[3]=m*b,i.elements[4]=(h*o-a*u)*b,i.elements[5]=(-d*o+a*l)*b,i.elements[6]=g*b,i.elements[7]=(-f*o+s*u)*b,i.elements[8]=(c*o-s*l)*b,i):null}scale(i,r){return arguments.length<=1&&(r=i),this.multiply(i,0,0,0,r,0,0,0,1)}rotate(i){const r=h1(i),o=m1(i);return this.multiply(r,-o,0,o,r,0,0,0,1)}translate(i,r){return this.multiply(1,0,i,0,1,r,0,0,1)}skewX(i){const r=iu(i);return this.multiply(1,r,0,0,1,0,0,0,1)}skewY(i){const r=iu(i);return this.multiply(1,0,0,r,1,0,0,0,1)}toString(i){return wa.length=0,this.toTransformArray(i,wa),wa.map(Pn).join(" ")}toTransformArray(i,r){const o=this.elements,s=!!r,a=o[0],l=o[1],c=o[2],d=o[3],u=o[4],f=o[5];if(i){const h=o[6],p=o[7],m=o[8];if(s){r[0]=a,r[1]=d,r[2]=h,r[3]=l,r[4]=u,r[5]=p,r[6]=c,r[7]=f,r[8]=m;return}return[a,d,h,l,u,p,c,f,m]}if(s){r[0]=a,r[1]=d,r[2]=l,r[3]=u,r[4]=c,r[5]=f;return}return[a,d,l,u,c,f]}toArray(i,r){const o=this.elements,s=!!r,a=o[0],l=o[1],c=o[2],d=o[3],u=o[4],f=o[5];if(i){const h=o[6],p=o[7],m=o[8];if(s){r[0]=a,r[1]=l,r[2]=c,r[3]=d,r[4]=u,r[5]=f,r[6]=h,r[7]=p,r[8]=m;return}return[a,l,c,d,u,f,h,p,m]}if(s){r[0]=a,r[1]=l,r[2]=c,r[3]=d,r[4]=u,r[5]=f;return}return[a,l,c,d,u,f]}toObject(){return{renderer:{type:"matrix"},elements:this.toArray(!0),manual:!!this.manual}}clone(){return new Ht().copy(this)}};B(Ht,"Identity",[1,0,0,0,1,0,0,0,1]);let ur=Ht;U0(ur);const io=class io extends Or{constructor(){super();B(this,"_flagMatrix",!0);B(this,"_flagScale",!1);B(this,"_matrix",null);B(this,"_worldMatrix",null);B(this,"_position",null);B(this,"_rotation",0);B(this,"_scale",1);B(this,"_skewX",0);B(this,"_skewY",0);for(let i in jo)Object.defineProperty(this,i,jo[i]);this._renderer.flagMatrix=ru.bind(this),this.isShape=!0,this.matrix=new ur,this.worldMatrix=new ur,this.position=new be,this.rotation=0,this.scale=1,this.skewX=0,this.skewY=0}static fromObject(i){const r=new io().copy(i);return"id"in i&&(r.id=i.id),r}get renderer(){return this._renderer}set renderer(i){this._renderer=i}get translation(){return jo.position.get.apply(this,arguments)}set translation(i){jo.position.set.apply(this,arguments)}addTo(i){return i.add(this),this}remove(){return this.parent?(this.parent.remove(this),this):this}contains(i,r,o){const s=o||{},a=s.ignoreVisibility===!0;if(!a&&"visible"in this&&this.visible===!1||!a&&"opacity"in this&&typeof this.opacity=="number"&&this.opacity<=0||typeof this.getBoundingClientRect!="function")return!1;const l=typeof s.tolerance=="number"?s.tolerance:0;this._update(!0);const c=this.getBoundingClientRect();return c?i>=c.left-l&&i<=c.right+l&&r>=c.top-l&&r<=c.bottom+l:!1}copy(i){return super.copy.call(this,i),"position"in i&&(i.position instanceof be?this.position=i.position:this.position.copy(i.position)),"rotation"in i&&(this.rotation=i.rotation),"scale"in i&&(this.scale=typeof i.scale=="number"||i.scale instanceof be?i.scale:new be(i.scale.x,i.scale.y)),"skewX"in i&&(this.skewX=i.skewX),"skewY"in i&&(this.skewY=i.skewY),"matrix"in i&&i.matrix.manual&&(this.matrix.copy(i.matrix),this.matrix.manual=!0),this}clone(i){const r=new io;return r.position.copy(this.position),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix),i&&i.add(r),r._update()}toObject(){const i=super.toObject.call(this);return i.renderer={type:"shape"},i.isShape=!0,i.translation=this.translation.toObject(),i.rotation=this.translation.rotation,i.scale=this.scale instanceof be?this.scale.toObject():this.scale,i.skewX=this.skewX,i.skewY=this.skewY,i.matrix=this.matrix.toObject(),i}dispose(){super.dispose(),typeof this.translation=="object"&&typeof this.translation.unbind=="function"&&this.translation.unbind(),typeof this.scale=="object"&&typeof this.scale.unbind=="function"&&this.scale.unbind()}_update(i){return!this._matrix.manual&&this._flagMatrix&&(this._matrix.identity().translate(this.position.x,this.position.y),this._matrix.rotate(this.rotation),this._scale instanceof be?this._matrix.scale(this._scale.x,this._scale.y):this._matrix.scale(this._scale),this._matrix.skewX(this.skewX),this._matrix.skewY(this.skewY)),i&&this.parent&&this.parent._update&&this.parent._update(),this}flagReset(){return this._flagMatrix=this._flagScale=!1,super.flagReset.call(this),this}};B(io,"Properties",["position","rotation","scale","skewX","skewY","matrix","worldMatrix"]);let Fn=io;const jo={position:{enumerable:!0,get:function(){return this._position},set:function(n){this._position&&this._position.unbind(te.Types.change,this._renderer.flagMatrix),this._position=n,this._position.bind(te.Types.change,this._renderer.flagMatrix),ru.call(this)}},rotation:{enumerable:!0,get:function(){return this._rotation},set:function(n){this._rotation=n,this._flagMatrix=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(n){this._scale instanceof be&&this._scale.unbind(te.Types.change,this._renderer.flagMatrix),this._scale=n,this._scale instanceof be&&this._scale.bind(te.Types.change,this._renderer.flagMatrix),this._flagMatrix=!0,this._flagScale=!0}},skewX:{enumerable:!0,get:function(){return this._skewX},set:function(n){this._skewX=n,this._flagMatrix=!0}},skewY:{enumerable:!0,get:function(){return this._skewY},set:function(n){this._skewY=n,this._flagMatrix=!0}},matrix:{enumerable:!0,get:function(){return this._matrix},set:function(n){this._matrix=n,this._flagMatrix=!0}},worldMatrix:{enumerable:!0,get:function(){return K0(this,this._worldMatrix),this._worldMatrix},set:function(n){this._worldMatrix=n}}};function ru(){this._flagMatrix=!0}const ou=/^(?:none|transparent)$/i,p1=8,xa=Number.EPSILON;function Yn(n,e){return{x:n,y:e}}function qo(n,e,i=xa){return Math.abs(n.x-e.x)<=i&&Math.abs(n.y-e.y)<=i}function su(n,e,i,r){const o=n*i+e*r,s=Math.sqrt(n*n+e*e)*Math.sqrt(i*i+r*r)||1e-12;let a=Math.acos(Math.max(-1,Math.min(1,o/s)));return n*r-e*i<0&&(a=-a),a}function g1(n,e,i){if(!n)return[Yn(e.x,e.y)];let r=e.rx,o=e.ry;if(!(r&&o))return[Yn(e.x,e.y)];const s=(e.xAxisRotation||0)*Math.PI/180,a=e.largeArcFlag?1:0,l=e.sweepFlag?1:0;r=Math.abs(r),o=Math.abs(o);const c=n.x,d=n.y,u=e.x,f=e.y,h=(c-u)/2,p=(d-f)/2,m=Math.cos(s),g=Math.sin(s);let b=m*h+g*p,y=-g*h+m*p,_=r*r,x=o*o;const w=b*b/_+y*y/x;if(w>1){const A=Math.sqrt(w);r*=A,o*=A,_=r*r,x=o*o}const C=_*y*y+x*b*b,N=C===0?0:(_*x-C)/C;let k=Math.sqrt(Math.max(0,N));a===l&&(k=-k);const $=k*r*y/o,v=-k*o*b/r,E=m*$-g*v+(c+u)/2,P=g*$+m*v+(d+f)/2,F=su(1,0,(b-$)/r,(y-v)/o),R=su((b-$)/r,(y-v)/o,(-b-$)/r,(-y-v)/o)%nn,M=F+R,X=l===0,G=(()=>{const A=M-F,Y=Math.abs(A)<Number.EPSILON;let H=Gt(A,nn);return H<Number.EPSILON&&(H=Y?0:nn),X&&!Y&&(H=H===nn?-nn:H-nn),H})(),Z=Math.max(Oo.Resolution,Math.max(i*2,1)),O=[];for(let A=1;A<=Z;A++){const Y=A/Z,H=F+Y*G;let T=E+r*Math.cos(H),D=P+o*Math.sin(H);if(s!==0){const K=T-E,J=D-P,U=Math.cos(s),q=Math.sin(s);T=K*U-J*q+E,D=K*q+J*U+P}O.push(Yn(T,D))}return O}function y1(n,e=p1){const i=[],r=[],o=n._renderer&&n._renderer.vertices&&n._renderer.vertices.length>0?n._renderer.vertices:n.vertices;if(!o||o.length===0)return{polygons:i,segments:r};const s=Math.max(1,Math.floor(e));let a=null,l=null,c=null,d=null;const u=(h=!1)=>{if(a){if(h&&l&&c&&!qo(l,c)){const p=Yn(l.x,l.y);r.push({a:c,b:p}),a.push(p),c=p}a.length>=3&&l&&c&&qo(l,c)&&i.push(a),a=null,l=null,c=null}},f=h=>{if(!c){c=h,a&&a.push(h);return}qo(c,h)||(r.push({a:c,b:h}),a&&a.push(h),c=h)};for(let h=0;h<o.length;h++){const p=o[h],m=p.command||(h===0?me.move:me.line);if(m===me.move){u(!1);const g=Yn(p.x,p.y);a=[g],l=g,c=g,d=p;continue}if(d||(d=o[Math.max(h-1,0)]),m===me.line)f(Yn(p.x,p.y));else if(m===me.curve){const g=_a(p,d,s);for(let b=1;b<g.length;b++){const y=g[b];f(Yn(y.x,y.y))}f(Yn(p.x,p.y))}else if(m===me.arc){const g=g1(d,p,s);for(let b=0;b<g.length;b++)f(g[b])}else if(m===me.close){u(!0),d=p;continue}else f(Yn(p.x,p.y));d=p}if(a){const h=!!n._closed||!!n.closed||l&&c&&!qo(l,c);u(h)}return{polygons:i,segments:r}}function b1(n,e,i){let r=!1;for(let o=0;o<n.length;o++){const s=n[o];if(!s||s.length<3)continue;let a=s.length-1;for(let l=0;l<s.length;l++){const c=s[a],d=s[l];d.y>i!=c.y>i&&e<(c.x-d.x)*(i-d.y)/(c.y-d.y||1e-12)+d.x&&(r=!r),a=l}}return r}function _1(n,e,i,r){const o=r.x-i.x,s=r.y-i.y;if(Math.abs(o)<xa&&Math.abs(s)<xa){const h=n-i.x,p=e-i.y;return h*h+p*p}const a=((n-i.x)*o+(e-i.y)*s)/(o*o+s*s),l=Math.max(0,Math.min(1,a)),c=i.x+l*o,d=i.y+l*s,u=n-c,f=e-d;return u*u+f*f}function w1(n,e,i){if(!n||n.length===0)return 1/0;let r=1/0;for(let o=0;o<n.length;o++){const s=n[o],a=_1(e,i,s.a,s.b);a<r&&(r=a)}return Math.sqrt(r)}function x1(n,e){if(typeof e=="boolean")return e;const i=n.fill;return!i&&i!==0?!1:typeof i=="string"?!ou.test(i):!0}function k1(n,e){const i=typeof n.linewidth=="number"?n.linewidth:n._linewidth||0;if(typeof e=="boolean")return e&&i>0;if(!(i>0))return!1;const r=n.stroke;return!r&&r!==0?!1:typeof r=="string"?!ou.test(r):!0}function C1(n,e,i,r=0){if(!n)return!1;const o=n.left-r,s=n.right+r,a=n.top-r,l=n.bottom+r;return e>=o&&e<=s&&i>=a&&i<=l}const Xo=Number.EPSILON;function Yo(n){return typeof n.relative!="boolean"||!!n.relative}function wn(n,e,i,r){const o=n.controls;if(!(!o||!o[e])){if(Math.abs(i)<Xo&&Math.abs(r)<Xo){Yo(n)?o[e].clear():o[e].set(n.x,n.y);return}Yo(n)?o[e].set(i,r):o[e].set(n.x+i,n.y+r)}}function Zt(n,e){wn(n,e,0,0)}function v1(n,e){const i=n.controls;return!i||!i[e]?{x:0,y:0}:Yo(n)?{x:i[e].x,y:i[e].y}:{x:i[e].x-n.x,y:i[e].y-n.y}}function fr(n,e){const i=v1(n,e);return Math.abs(i.x)>Xo||Math.abs(i.y)>Xo}function Uo(n){n.command===me.move||n.command===me.close||(n.command=fr(n,"left")||fr(n,"right")?me.curve:me.line)}function au(n,e){typeof e.relative=="boolean"&&(n.relative=e.relative)}function S1(n,e){return fr(e,"right")||fr(n,"left")||fr(n,"right")||fr(e,"left")||n.command===me.curve||e.command===me.curve}function hr(n,e,i){return{x:Kt(n.x,e.x,i),y:Kt(n.y,e.y,i)}}function lu(n,e){const i=n.controls&&n.controls[e];return i?Yo(n)?{x:n.x+i.x,y:n.y+i.y}:{x:i.x,y:i.y}:{x:n.x,y:n.y}}function B1(n,e,i){const r=n.controls&&n.controls.right,o=e.controls&&e.controls.left,s={x:n.x,y:n.y},a=r?lu(n,"right"):{...s},l={x:e.x,y:e.y},c=o?lu(e,"left"):{...l},d=hr(s,a,i),u=hr(a,c,i),f=hr(c,l,i),h=hr(d,u,i),p=hr(u,f,i),m=hr(h,p,i),g=new Ae(m.x,m.y);return au(g,n),wn(g,"left",h.x-m.x,h.y-m.y),wn(g,"right",p.x-m.x,p.y-m.y),g.command=me.curve,{anchor:g,startOut:d,endIn:f}}function N1(n,e,i,r,o,s){const a=n.length,l=i-e+1;let c=l-1,d=o?Math.min(l,4):1,u=d,f=d;if(r||(u=Math.min(1,e),f=Math.min(1,a-i-1)),c+=u+f,c<=1)return;const h=new Array(c+1);for(let k=0,$=e-u;k<=c;k+=1,$+=1){const v=Gt($,a);h[k]=n[v]}let p=h[0].x+2*h[1].x,m=h[0].y+2*h[1].y,g=2;const b=c-1,y=[p],_=[m],x=[g],w=new Array(c+1),C=new Array(c+1);for(let k=1;k<c;k+=1){const $=k<b,v=$||s?1:2,E=$?4:s?2:7,P=$?4:s?3:8,F=$?2:s?0:1,R=v/g;g=x[k]=E-R,p=y[k]=P*h[k].x+F*h[k+1].x-R*p,m=_[k]=P*h[k].y+F*h[k+1].y-R*m}w[b]=y[b]/x[b],C[b]=_[b]/x[b];for(let k=c-2;k>=0;k-=1)w[k]=(y[k]-w[k+1])/x[k],C[k]=(_[k]-C[k+1])/x[k];w[c]=(3*h[c].x-w[b])/2,C[c]=(3*h[c].y-C[b])/2;const N=c-f;for(let k=u,$=e;k<=N;k+=1,$+=1){const v=Gt($,a),E=n[v],P=w[k]-E.x,F=C[k]-E.y;o||k<N?wn(E,"right",P,F):Zt(E,"right"),o||k>u?wn(E,"left",-P,-F):Zt(E,"left"),Uo(E)}}function T1(n,e,i,r,o,s){const a=e||n,l=n,c=i||n,d=be.distanceBetween(a,l),u=be.distanceBetween(l,c),f=r===void 0?.5:r,h=Math.pow(d,f),p=Math.pow(u,f),m=h*h,g=p*p;if(!o&&e){const b=2*g+3*p*h+m,y=3*p*(p+h);if(y!==0){const _=(g*a.x+b*l.x-m*c.x)/y-l.x,x=(g*a.y+b*l.y-m*c.y)/y-l.y;wn(n,"left",_,x)}else Zt(n,"left")}else Zt(n,"left");if(!s&&i){const b=2*m+3*h*p+g,y=3*h*(h+p);if(y!==0){const _=(m*c.x+b*l.x-g*a.x)/y-l.x,x=(m*c.y+b*l.y-g*a.y)/y-l.y;wn(n,"right",_,x)}else Zt(n,"right")}else Zt(n,"right");Uo(n)}function $1(n,e,i,r,o,s){if(!(e&&i)){e||Zt(n,"left"),i||Zt(n,"right"),Uo(n);return}const a=e,l=n,c=i,d=be.distanceBetween(a,l),u=be.distanceBetween(l,c),f=d+u,h=r===void 0?.4:r,p={x:a.x-c.x,y:a.y-c.y};if(!o&&f!==0){const m=h*d/f;wn(n,"left",p.x*m,p.y*m)}else Zt(n,"left");if(!s&&f!==0){const m=h*d/f-h;wn(n,"right",p.x*m,p.y*m)}else Zt(n,"right");Uo(n)}function E1(n,e,i,r,o,s){const a=s.type,l=s.factor,c=n.length;for(let d=e;d<=i;d+=1){const u=Gt(d,c),f=n[u];if(f.command===me.move){Zt(f,"left"),Zt(f,"right");continue}const h=d===e&&!o?null:d-1,p=d===i&&!o?null:d+1,m=h===null?null:n[Gt(h,c)],g=p===null?null:n[Gt(p,c)],b=h===null,y=p===null;a==="geometric"?$1(f,m,g,l,b,y):T1(f,m,g,l,b,y)}}const mr=Math.min,pr=Math.max,R1=Math.ceil,P1=Math.floor,F1=new be,V1=new ur,Cn=class Cn extends Fn{constructor(i,r,o,s){super();B(this,"_flagVertices",!0);B(this,"_flagLength",!0);B(this,"_flagFill",!0);B(this,"_flagStroke",!0);B(this,"_flagLinewidth",!0);B(this,"_flagOpacity",!0);B(this,"_flagVisible",!0);B(this,"_flagCap",!0);B(this,"_flagJoin",!0);B(this,"_flagMiter",!0);B(this,"_flagStrokeAttenuation",!0);B(this,"_flagMask",!1);B(this,"_flagClip",!1);B(this,"_length",0);B(this,"_fill","#fff");B(this,"_stroke","#000");B(this,"_linewidth",1);B(this,"_opacity",1);B(this,"_visible",!0);B(this,"_cap","round");B(this,"_join","round");B(this,"_miter",4);B(this,"_closed",!0);B(this,"_curved",!1);B(this,"_automatic",!0);B(this,"_beginning",0);B(this,"_ending",1);B(this,"_mask",null);B(this,"_clip",!1);B(this,"_dashes",null);B(this,"_strokeAttenuation",!0);for(let a in cu)Object.defineProperty(this,a,cu[a]);this._renderer.type="path",this._renderer.flagVertices=du.bind(this),this._renderer.bindVertices=uu.bind(this),this._renderer.unbindVertices=fu.bind(this),this._renderer.flagFill=hu.bind(this),this._renderer.flagStroke=mu.bind(this),this._renderer.vertices=[],this._renderer.collection=[],this.closed=!!r,this.curved=!!o,this.beginning=0,this.ending=1,this.fill="#fff",this.stroke="#000",this.linewidth=1,this.opacity=1,this.className="",this.visible=!0,this.cap="butt",this.join="miter",this.miter=4,this.vertices=i,this.automatic=!s,this.dashes=[],this.dashes.offset=0}static fromObject(i){const r=typeof i.fill=="string"?i.fill:Ei(i.fill),o=typeof i.stroke=="string"?i.stroke:Ei(i.stroke),s=new Cn().copy({...i,fill:r,stroke:o});return"id"in i&&(s.id=i.id),s}copy(i){if(super.copy.call(this,i),i.vertices){this.vertices=[];for(let r=0;r<i.vertices.length;r++){const o=i.vertices[r];o instanceof Ae?this.vertices.push(i.vertices[r].clone()):this.vertices.push(new Ae().copy(o))}}for(let r=0;r<Cn.Properties.length;r++){const o=Cn.Properties[r];o in i&&(this[o]=i[o])}return this}clone(i){const r=new Cn;for(let o=0;o<this.vertices.length;o++)r.vertices.push(this.vertices[o].clone());for(let o=0;o<Cn.Properties.length;o++){const s=Cn.Properties[o];r[s]=this[s]}return r.className=this.className,r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix),i&&i.add(r),r._update()}toObject(){const i=super.toObject.call(this);return i.renderer.type="path",i.vertices=this.vertices.map(r=>r.toObject()),je.each(Cn.Properties,r=>{typeof this[r]<"u"&&(this[r].toObject?i[r]=this[r].toObject():i[r]=this[r])},this),i}dispose(){if(super.dispose(),this.vertices&&typeof this.vertices.unbind=="function")try{this.vertices.unbind()}catch{}if(this.vertices)for(let i=0;i<this.vertices.length;i++){const r=this.vertices[i];typeof r.unbind=="function"&&r.unbind(),r.controls&&(r.controls.left&&typeof r.controls.left.unbind=="function"&&r.controls.left.unbind(),r.controls.right&&typeof r.controls.right.unbind=="function"&&r.controls.right.unbind())}return typeof this.fill=="object"&&typeof this.fill.dispose=="function"?this.fill.dispose():typeof this.fill=="object"&&typeof this.fill.unbind=="function"&&this.fill.unbind(),typeof this.stroke=="object"&&typeof this.stroke.dispose=="function"?this.stroke.dispose():typeof this.stroke=="object"&&typeof this.stroke.unbind=="function"&&this.stroke.unbind(),this}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}corner(){const i=this.getBoundingClientRect(!0),r=i.width/2,o=i.height/2,s=i.left+i.width/2,a=i.top+i.height/2;for(let l=0;l<this.vertices.length;l++){const c=this.vertices[l];c.x-=s,c.y-=a,c.x+=r,c.y+=o}return this.mask&&(this.mask.translation.x-=s,this.mask.translation.x+=r,this.mask.translation.y-=a,this.mask.translation.y+=o),this}center(){const i=this.getBoundingClientRect(!0),r=i.left+i.width/2-this.translation.x,o=i.top+i.height/2-this.translation.y;for(let s=0;s<this.vertices.length;s++){const a=this.vertices[s];a.x-=r,a.y-=o}return this.mask&&(this.mask.translation.x-=r,this.mask.translation.y-=o),this}getBoundingClientRect(i){let r,o,s,a,l,c,d=1/0,u=-1/0,f=1/0,h=-1/0;if(this._update(!0),r=i?this.matrix:this.worldMatrix,o=(this.linewidth||0)/2,s=this._renderer.vertices.length,this.linewidth>0||this.stroke&&!/(transparent|none)/i.test(this.stroke))if(this.matrix.manual){const{scaleX:p,scaleY:m}=Y0(r.elements[0],r.elements[3],r.elements[1],r.elements[4],r.elements[2],r.elements[5]);typeof p=="number"&&typeof m=="number"&&(o=Math.max(p,m)*(this.linewidth||0)/2)}else o*=typeof this.scale=="number"?this.scale:Math.max(this.scale.x,this.scale.y);if(s<=0)return{width:0,height:0};for(a=0;a<s;a++){c=this._renderer.vertices[a],l=this._renderer.vertices[(a+s-1)%s];const[p,m]=r.multiply(l.x,l.y),[g,b]=r.multiply(c.x,c.y);if(l.controls&&c.controls){let y=l.controls.right.x,_=l.controls.right.y;l.relative&&(y+=l.x,_+=l.y);let[x,w]=r.multiply(y,_),C=c.controls.left.x,N=c.controls.left.y;c.relative&&(C+=c.x,N+=c.y);let[k,$]=r.multiply(C,N);const v=J0(p,m,x,w,k,$,g,b);f=mr(v.min.y-o,f),d=mr(v.min.x-o,d),u=pr(v.max.x+o,u),h=pr(v.max.y+o,h)}else a<=1&&(f=mr(m-o,f),d=mr(p-o,d),u=pr(p+o,u),h=pr(m+o,h)),f=mr(b-o,f),d=mr(g-o,d),u=pr(g+o,u),h=pr(b+o,h)}return{top:f,left:d,right:u,bottom:h,width:u-d,height:h-f}}contains(i,r,o){const s=o||{},a=s.ignoreVisibility===!0;if(!a&&this.visible===!1||!a&&typeof this.opacity=="number"&&this.opacity<=0)return!1;const l=typeof s.tolerance=="number"?s.tolerance:0;this._update(!0);const c=this.getBoundingClientRect();if(!c||i<c.left-l||i>c.right+l||r<c.top-l||r>c.bottom+l)return!1;const d=this.worldMatrix,u=d&&d.inverse(V1);if(!u)return super.contains(i,r,s);const[f,h]=u.multiply(i,r,1),p=typeof s.precision=="number"&&!Number.isNaN(s.precision)?Math.max(1,Math.floor(s.precision)):8,m=x1(this,s.fill),g=k1(this,s.stroke),{polygons:b,segments:y}=y1(this,p);if(m&&b.length>0&&b1(b,f,h))return!0;if(g&&y.length>0){const _=typeof this.linewidth=="number"?this.linewidth:0;if(_>0&&w1(y,f,h)<=_/2+l)return!0}return!m&&!g?super.contains(i,r,s):m&&b.length===0?super.contains(i,r,s):!1}getPointAt(i,r){let o,s,a,l,c,d,u,f,h,p,m,g,b,y,_,x=this.length*Math.min(Math.max(i,0),1);const w=this.vertices.length,C=w-1;let N=null,k=null;for(let O=0,A=this._lengths.length,Y=0;O<A;O++){if(Y+this._lengths[O]>=x){this._closed?(o=Gt(O,w),s=Gt(O-1,w),O===0&&(o=s,s=O)):(o=O,s=Math.min(Math.max(O-1,0),C)),N=this.vertices[o],k=this.vertices[s],x-=Y,this._lengths[O]!==0?i=x/this._lengths[O]:i=0;break}Y+=this._lengths[O]}if(N===null||k===null)return null;if(N){if(!k)return N}else return k;_=k.controls&&k.controls.right,y=N.controls&&N.controls.left,c=k.x,p=k.y,d=(_||k).x,m=(_||k).y,u=(y||N).x,g=(y||N).y,f=N.x,b=N.y,_&&k.relative&&(d+=k.x,m+=k.y),y&&N.relative&&(u+=N.x,g+=N.y),l=Do(i,c,d,u,f),h=Do(i,p,m,g,b);const $=Kt(c,d,i),v=Kt(p,m,i),E=Kt(d,u,i),P=Kt(m,g,i),F=Kt(u,f,i),R=Kt(g,b,i),M=Kt($,E,i),X=Kt(v,P,i),G=Kt(E,F,i),Z=Kt(P,R,i);return je.isObject(r)?(r.x=l,r.y=h,r instanceof Ae&&(r.controls.left.x=M,r.controls.left.y=X,r.controls.right.x=G,r.controls.right.y=Z,(typeof r.relative!="boolean"||r.relative)&&(r.controls.left.x-=l,r.controls.left.y-=h,r.controls.right.x-=l,r.controls.right.y-=h)),r.t=i,r):(a=new Ae(l,h,M-l,X-h,G-l,Z-h,this._curved?me.curve:me.line),a.t=i,a)}plot(){if(this.curved)return t1(this._collection,this.closed),this;for(let i=0;i<this._collection.length;i++)this._collection[i].command=i===0?me.move:me.line;return this}smooth(i){const r=i||{},o=r.type||"continuous",s=this._collection,a=s.length;if(a<2)return this;const l=this._closed||a>0&&s[a-1]&&s[a-1].command===me.close,c=(p,m)=>{if(p==null)return m;if(typeof p=="number"){if(l)return Gt(p,a);let b=p;return b<0&&(b+=a),Math.min(Math.max(b,0),a-1)}const g=s.indexOf(p);return g!==-1?g:m},d=l&&r.from===void 0&&r.to===void 0;let u=c(r.from,0),f=c(r.to,a-1);if(u>f)if(l)u-=a;else{const p=u;u=f,f=p}const h=f-u+1;for(let p=0;p<h;p+=1){const m=Gt(u+p,a),g=s[m],b=!l&&m===0;g.command===me.move&&!b&&(g.command=me.line)}if(o==="continuous"||o==="asymmetric")N1(s,u,f,l,d,o==="asymmetric");else if(o==="catmull-rom"||o==="geometric"){const p={type:o,factor:r.factor};E1(s,u,f,l,d,p)}else throw new Error(`Path.smooth does not support type "${o}". Try 'continuous', 'asymmetric', 'catmull-rom', or 'geometric'.`);return this._automatic=!1,this._flagVertices=!0,this._flagLength=!0,this}subdivide(i){this._update();const r=this.vertices,o=r.length;if(o<2)return this;const s=[];let a=null,l=null;for(let c=0;c<o;c+=1){const d=r[c];if(!a||d.command===me.move){const f=d.clone();s.push(f),a=d,l=d;continue}if(S1(d,a)){const h=_a(d,a,i).length,p=s[s.length-1];let m=p.clone(),g=d.clone(),b=p,y=0;if(h<=1){const _=d.clone();s.push(_)}else{for(let x=1;x<h;x+=1){const w=x/h,C=1-y,N=C<=Number.EPSILON?w:(w-y)/C,k=B1(m,g,N);wn(b,"right",k.startOut.x-b.x,k.startOut.y-b.y);const $=k.anchor;s.push($),b=$,m=$.clone(),y=w,wn(g,"left",k.endIn.x-g.x,k.endIn.y-g.y)}const _=d.clone();_.controls.left.copy(g.controls.left),s.push(_)}}else{const f=_a(d,a,i);for(let p=1;p<f.length;p+=1){const m=f[p];au(m,a),Zt(m,"left"),Zt(m,"right"),m.command=me.line,s.push(m)}const h=d.clone();s.push(h)}a=d,d.command===me.close&&(a=l)}return this._automatic=!1,this._curved=!1,this.vertices=s,this}_updateLength(i,r){r||this._update();const s=this.vertices.length-1;let a=this.vertices[s],l=0;return typeof this._lengths>"u"&&(this._lengths=[]),je.each(this.vertices,function(c,d){if(d<=0||c.command===me.move){a=c,this._lengths[d]=0;return}this._lengths[d]=nu(c,a,i),l+=this._lengths[d],a=c},this),this._length=l,this._flagLength=!1,this}_update(){if(this._flagVertices){this._automatic&&this.plot(),this._flagLength&&this._updateLength(void 0,!0);const i=this._collection.length,r=this._closed,o=Math.min(this._beginning,this._ending),s=Math.max(this._beginning,this._ending),a=Wo(this,o*this._length),l=Wo(this,s*this._length),c=R1(a),d=P1(l);let u,f,h,p,m,g;for(this._renderer.vertices.length=0,g=0;g<i;g++)this._renderer.collection.length<=g&&this._renderer.collection.push(new Ae),g>d&&!f?(m=this._renderer.collection[g].copy(this._collection[g]),this.getPointAt(s,m),m.command=this._renderer.collection[g].command,this._renderer.vertices.push(m),f=m,h=this._collection[g-1],h&&h.controls&&(m.relative?m.controls.right.clear():m.controls.right.copy(m),h.relative?this._renderer.collection[g-1].controls.right.copy(h.controls.right).lerp(be.zero,1-m.t):this._renderer.collection[g-1].controls.right.copy(h.controls.right).lerp(h,1-m.t))):g>=c&&g<=d&&(m=this._renderer.collection[g].copy(this._collection[g]),this._renderer.vertices.push(m),g===d&&tu(this,s)?(f=m,!r&&f.controls&&(f.relative?f.controls.right.clear():f.controls.right.copy(f))):g===c&&tu(this,o)&&(u=m,u.command=me.move,!r&&u.controls&&(u.relative?u.controls.left.clear():u.controls.left.copy(u))));c>0&&!u&&(g=c-1,m=this._renderer.collection[g].copy(this._collection[g]),this.getPointAt(o,m),m.command=me.move,this._renderer.vertices.unshift(m),p=this._collection[g+1],p&&p.controls&&(m.controls.left.clear(),p.relative?this._renderer.collection[g+1].controls.left.copy(p.controls.left).lerp(be.zero,m.t):(F1.copy(p),this._renderer.collection[g+1].controls.left.copy(p.controls.left).lerp(p,m.t))))}return Fn.prototype._update.apply(this,arguments),this}flagReset(){return this._flagVertices=this._flagLength=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagCap=this._flagJoin=this._flagMiter=this._flagClip=this._flagStrokeAttenuation=!1,Fn.prototype.flagReset.call(this),this}};B(Cn,"Properties",["fill","stroke","linewidth","opacity","visible","cap","join","miter","closed","curved","automatic","beginning","ending","dashes","strokeAttenuation"]),B(Cn,"Utils",{getCurveLength:nu});let Oe=Cn;const cu={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(n){this._linewidth=n,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(n){this._opacity=n,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(n){this._visible=n,this._flagVisible=!0}},cap:{enumerable:!0,get:function(){return this._cap},set:function(n){this._cap=n,this._flagCap=!0}},join:{enumerable:!0,get:function(){return this._join},set:function(n){this._join=n,this._flagJoin=!0}},miter:{enumerable:!0,get:function(){return this._miter},set:function(n){this._miter=n,this._flagMiter=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(n){(this._fill instanceof gt||this._fill instanceof zt||this._fill instanceof Dt||this._fill instanceof nt)&&this._fill.unbind(te.Types.change,this._renderer.flagFill),this._fill=n,this._flagFill=!0,(this._fill instanceof gt||this._fill instanceof zt||this._fill instanceof Dt||this._fill instanceof nt)&&this._fill.bind(te.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(n){(this._stroke instanceof gt||this._stroke instanceof zt||this._stroke instanceof Dt||this._stroke instanceof nt)&&this._stroke.unbind(te.Types.change,this._renderer.flagStroke),this._stroke=n,this._flagStroke=!0,(this._stroke instanceof gt||this._stroke instanceof zt||this._stroke instanceof Dt||this._stroke instanceof nt)&&this._stroke.bind(te.Types.change,this._renderer.flagStroke)}},length:{get:function(){return this._flagLength&&this._updateLength(),this._length}},closed:{enumerable:!0,get:function(){return this._closed},set:function(n){this._closed=!!n,this._flagVertices=!0}},curved:{enumerable:!0,get:function(){return this._curved},set:function(n){this._curved=!!n,this._flagVertices=!0}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(n){if(n===this._automatic)return;this._automatic=!!n;const e=this._automatic?"ignore":"listen";je.each(this.vertices,function(i){i[e]()})}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(n){this._beginning=n,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(n){this._ending=n,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(n){const e=this._renderer.bindVertices,i=this._renderer.unbindVertices;this._collection&&this._collection.unbind(te.Types.insert,e).unbind(te.Types.remove,i),n instanceof Ti?this._collection=n:this._collection=new Ti(n||[]),this._collection.bind(te.Types.insert,e).bind(te.Types.remove,i),e(this._collection)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(n){this._mask=n,this._flagMask=!0,je.isObject(n)&&!n.clip&&(n.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(n){this._clip=n,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(n){typeof n.offset!="number"&&(n.offset=this.dashes&&this._dashes.offset||0),this._dashes=n}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(n){this._strokeAttenuation=!!n,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};function du(){this._flagVertices=!0,this._flagLength=!0,this.parent&&(this.parent._flagLength=!0)}function uu(n){let e=n.length;for(;e--;)n[e].bind(te.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function fu(n){let e=n.length;for(;e--;)n[e].unbind(te.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function hu(){this._flagFill=!0}function mu(){this._flagStroke=!0}const M1=Math.ceil,I1=Math.floor,Dn=class Dn extends Fn{constructor(i){super();B(this,"_flagVertices",!0);B(this,"_flagLength",!0);B(this,"_flagFill",!0);B(this,"_flagStroke",!0);B(this,"_flagLinewidth",!0);B(this,"_flagOpacity",!0);B(this,"_flagVisible",!0);B(this,"_flagSize",!0);B(this,"_flagSizeAttenuation",!0);B(this,"_flagStrokeAttenuation",!0);B(this,"_length",0);B(this,"_fill","#fff");B(this,"_stroke","#000");B(this,"_linewidth",1);B(this,"_opacity",1);B(this,"_visible",!0);B(this,"_size",1);B(this,"_sizeAttenuation",!1);B(this,"_beginning",0);B(this,"_ending",1);B(this,"_dashes",null);B(this,"_strokeAttenuation",!0);B(this,"noFill",Oe.prototype.noFill);B(this,"noStroke",Oe.prototype.noStroke);B(this,"corner",Oe.prototype.corner);B(this,"center",Oe.prototype.center);B(this,"getBoundingClientRect",Oe.prototype.getBoundingClientRect);B(this,"_updateLength",Oe.prototype._updateLength);for(let r in pu)Object.defineProperty(this,r,pu[r]);this._renderer.type="points",this._renderer.flagVertices=du.bind(this),this._renderer.bindVertices=uu.bind(this),this._renderer.unbindVertices=fu.bind(this),this._renderer.flagFill=hu.bind(this),this._renderer.flagStroke=mu.bind(this),this._renderer.vertices=null,this._renderer.collection=null,this.size=1,this.sizeAttenuation=!1,this.beginning=0,this.ending=1,this.fill="#fff",this.stroke="#000",this.linewidth=1,this.opacity=1,this.className="",this.visible=!0,this.vertices=i,this.dashes=[],this.dashes.offset=0}static fromObject(i){const r=typeof i.fill=="string"?i.fill:Ei(i.fill),o=typeof i.stroke=="string"?i.stroke:Ei(i.stroke),s=new Dn().copy({...i,fill:r,stroke:o});return"id"in i&&(s.id=i.id),s}copy(i){super.copy.call(this,i);for(let r=0;r<i.vertices.length;r++){const o=i.vertices[r];o instanceof Ae?this.vertices.push(i.vertices[r].clone()):this.vertices.push(new Ae().copy(o))}for(let r=0;r<Dn.Properties.length;r++){const o=Dn.Properties[r];o in i&&(this[o]=i[o])}return this}clone(i){const r=new Dn;for(let o=0;o<this.vertices.length;o++)r.vertices.push(this.vertices[o].clone());for(let o=0;o<Dn.Properties.length;o++){const s=Dn.Properties[o];r[s]=this[s]}return r.className=this.className,r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix),i&&i.add(r),r._update()}toObject(){const i=super.toObject.call(this);return i.renderer.type="points",i.vertices=this.vertices.map(r=>r.toObject()),je.each(Dn.Properties,function(r){typeof this[r]<"u"&&(this[r].toObject?i[r]=this[r].toObject():i[r]=this[r])},this),i}dispose(){if(super.dispose(),this.vertices&&typeof this.vertices.unbind=="function")try{this.vertices.unbind()}catch{}if(this.vertices)for(let i=0;i<this.vertices.length;i++){const r=this.vertices[i];typeof r.unbind=="function"&&r.unbind()}return typeof this.fill=="object"&&typeof this.fill.dispose=="function"?this.fill.dispose():typeof this.fill=="object"&&typeof this.fill.unbind=="function"&&this.fill.unbind(),typeof this.stroke=="object"&&typeof this.stroke.dispose=="function"?this.stroke.dispose():typeof this.stroke=="object"&&typeof this.stroke.unbind=="function"&&this.stroke.unbind(),this}subdivide(i){this._update();let r=[];for(let o=0;o<this.vertices.length;o++){const s=this.vertices[o],a=this.vertices[o-1];if(!a)continue;const l=s.x,c=s.y,d=a.x,u=a.y,f=Xd(l,c,l,c,d,u,d,u,i);r=r.concat(f)}return this.vertices=r,this}_update(){if(this._flagVertices){this._flagLength&&this._updateLength(void 0,!0);const i=Math.min(this._beginning,this._ending),r=Math.max(this._beginning,this._ending),o=Wo(this,i*this._length),s=Wo(this,r*this._length),a=M1(o),l=I1(s);let c=0,d;this._renderer.vertices=[],this._renderer.collection=[];for(let u=0;u<this._collection.length;u++)u>=a&&u<=l&&(d=this._collection[u],this._renderer.collection.push(d),this._renderer.vertices[c*2+0]=d.x,this._renderer.vertices[c*2+1]=d.y,c++)}return super._update.apply(this,arguments),this}flagReset(){return this._flagVertices=this._flagLength=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagSize=this._flagSizeAttenuation=!1,super.flagReset.call(this),this}};B(Dn,"Properties",["fill","stroke","linewidth","opacity","visible","size","sizeAttenuation","beginning","ending","dashes","strokeAttenuation"]);let Ko=Dn;const pu={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(n){this._linewidth=n,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(n){this._opacity=n,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(n){this._visible=n,this._flagVisible=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(n){this._size=n,this._flagSize=!0}},sizeAttenuation:{enumerable:!0,get:function(){return this._sizeAttenuation},set:function(n){this._sizeAttenuation=n,this._flagSizeAttenuation=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(n){(this._fill instanceof gt||this._fill instanceof zt||this._fill instanceof Dt||this._fill instanceof nt)&&this._fill.unbind(te.Types.change,this._renderer.flagFill),this._fill=n,this._flagFill=!0,(this._fill instanceof gt||this._fill instanceof zt||this._fill instanceof Dt||this._fill instanceof nt)&&this._fill.bind(te.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(n){(this._stroke instanceof gt||this._stroke instanceof zt||this._stroke instanceof Dt||this._stroke instanceof nt)&&this._stroke.unbind(te.Types.change,this._renderer.flagStroke),this._stroke=n,this._flagStroke=!0,(this._stroke instanceof gt||this._stroke instanceof zt||this._stroke instanceof Dt||this._stroke instanceof nt)&&this._stroke.bind(te.Types.change,this._renderer.flagStroke)}},length:{get:function(){return this._flagLength&&this._updateLength(),this._length}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(n){this._beginning=n,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(n){this._ending=n,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(n){const e=this._renderer.bindVertices,i=this._renderer.unbindVertices;this._collection&&this._collection.unbind(te.Types.insert,e).unbind(te.Types.remove,i),n instanceof Ti?this._collection=n:this._collection=new Ti(n||[]),this._collection.bind(te.Types.insert,e).bind(te.Types.remove,i),e(this._collection)}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(n){typeof n.offset!="number"&&(n.offset=this.dashes&&this._dashes.offset||0),this._dashes=n}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(n){this._strokeAttenuation=!!n,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};class gu extends Ti{constructor(i){i=Array.isArray(i)?i:Array.prototype.slice.call(arguments);super(i);Wl(this,Cs,{});this.attach(i),this.on(te.Types.insert,this.attach),this.on(te.Types.remove,this.detach)}get ids(){return qt(this,Cs)}attach(i){for(let r=0;r<i.length;r++){const o=i[r];o&&o.id&&(this.ids[o.id]=o)}return this}detach(i){for(let r=0;r<i.length;r++)delete this.ids[i[r].id];return this}}Cs=new WeakMap;const Qn=class Qn extends Oe{constructor(i,r,o,s,a,l,c){const d=c||Oo.Resolution*3,u=[];for(let f=0;f<d;f++)u.push(new Ae);super(u,!0,!1,!0);B(this,"_flagStartAngle",!1);B(this,"_flagEndAngle",!1);B(this,"_flagInnerRadius",!1);B(this,"_flagOuterRadius",!1);B(this,"_startAngle",0);B(this,"_endAngle",nn);B(this,"_innerRadius",0);B(this,"_outerRadius",0);this._renderer.type="arc-segment";for(let f in yu)Object.defineProperty(this,f,yu[f]);typeof o=="number"&&(this.innerRadius=o),typeof s=="number"&&(this.outerRadius=s),typeof a=="number"&&(this.startAngle=a),typeof l=="number"&&(this.endAngle=l),this._update(),typeof i=="number"&&(this.translation.x=i),typeof r=="number"&&(this.translation.y=r)}static fromObject(i){const r=new Qn().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<Qn.Properties.length;r++){const o=Qn.Properties[r];o in i&&typeof i[o]=="number"&&(this[o]=i[o])}return this}_update(){if(this._flagVertices||this._flagStartAngle||this._flagEndAngle||this._flagInnerRadius||this._flagOuterRadius){const i=this._startAngle,r=this._endAngle,o=this._innerRadius,s=this._outerRadius,a=Gt(i,nn)===Gt(r,nn),l=o>0,c=this.vertices;let d=l?c.length/2:c.length,u,f=0,h,p,m,g,b,y,_,x,w;for(a?d--:l||(d-=2),h=0,p=d-1;h<d;h++){switch(m=h/p,g=c[f],b=m*(r-i)+i,y=(r-i)/d,_=s*Math.cos(b),x=s*Math.sin(b),h){case 0:u=me.move;break;default:u=me.curve}g.command=u,g.x=_,g.y=x,g.controls.left.clear(),g.controls.right.clear(),g.command===me.curve&&(w=s*y/Math.PI,g.controls.left.x=w*Math.cos(b-kt),g.controls.left.y=w*Math.sin(b-kt),g.controls.right.x=w*Math.cos(b+kt),g.controls.right.y=w*Math.sin(b+kt),h===1&&g.controls.left.multiplyScalar(2),h===p&&g.controls.right.multiplyScalar(2)),f++}if(l){for(a?(c[f].command=me.close,f++):(d--,p=d-1),h=0;h<d;h++)m=h/p,g=c[f],b=(1-m)*(r-i)+i,y=(r-i)/d,_=o*Math.cos(b),x=o*Math.sin(b),u=me.curve,h<=0&&(u=a?me.move:me.line),g.command=u,g.x=_,g.y=x,g.controls.left.clear(),g.controls.right.clear(),g.command===me.curve&&(w=o*y/Math.PI,g.controls.left.x=w*Math.cos(b+kt),g.controls.left.y=w*Math.sin(b+kt),g.controls.right.x=w*Math.cos(b-kt),g.controls.right.y=w*Math.sin(b-kt),h===1&&g.controls.left.multiplyScalar(2),h===p&&g.controls.right.multiplyScalar(2)),f++;c[f].copy(c[0]),c[f].command=me.line}else a||(c[f].command=me.line,c[f].x=0,c[f].y=0,f++,c[f].copy(c[0]),c[f].command=me.line)}return super._update.call(this),this}flagReset(){return super.flagReset.call(this),this._flagStartAngle=this._flagEndAngle=this._flagInnerRadius=this._flagOuterRadius=!1,this}clone(i){const r=this.innerRadius,o=this.outerRadius,s=this.startAngle,a=this.endAngle,l=this.vertices.length,c=new Qn(0,0,r,o,s,a,l);c.translation.copy(this.translation),c.rotation=this.rotation,c.scale=this.scale,c.skewX=this.skewX,c.skewY=this.skewY,this.matrix.manual&&c.matrix.copy(this.matrix);for(let d=0;d<Oe.Properties.length;d++){const u=Oe.Properties[d];c[u]=this[u]}return i&&i.add(c),c}toObject(){const i=super.toObject.call(this);i.renderer.type="arc-segment";for(let r=0;r<Qn.Properties.length;r++){const o=Qn.Properties[r];i[o]=this[o]}return i}};B(Qn,"Properties",["startAngle","endAngle","innerRadius","outerRadius"]);let ka=Qn;const yu={startAngle:{enumerable:!0,get:function(){return this._startAngle},set:function(n){this._startAngle=n,this._flagStartAngle=!0}},endAngle:{enumerable:!0,get:function(){return this._endAngle},set:function(n){this._endAngle=n,this._flagEndAngle=!0}},innerRadius:{enumerable:!0,get:function(){return this._innerRadius},set:function(n){this._innerRadius=n,this._flagInnerRadius=!0}},outerRadius:{enumerable:!0,get:function(){return this._outerRadius},set:function(n){this._outerRadius=n,this._flagOuterRadius=!0}}},Ca=Math.cos,va=Math.sin,Jn=class Jn extends Oe{constructor(i,r,o,s){const a=s?Math.max(s,2):4,l=[];for(let c=0;c<a;c++)l.push(new Ae(0,0,0,0,0,0));super(l,!0,!0,!0);B(this,"_flagRadius",!1);B(this,"_radius",0);this._renderer.type="circle";for(let c in bu)Object.defineProperty(this,c,bu[c]);typeof o=="number"&&(this.radius=o),this._update(),typeof i=="number"&&(this.translation.x=i),typeof r=="number"&&(this.translation.y=r)}static fromObject(i){const r=new Jn().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<Jn.Properties.length;r++){const o=Jn.Properties[r];o in i&&typeof i[o]=="number"&&(this[o]=i[o])}return this}_update(){if(this._flagVertices||this._flagRadius){let i=this.vertices.length;!this._closed&&i>2&&(i-=1);const r=4/3*Math.tan(Math.PI/(i*2)),o=this._radius,s=o*r;for(let a=0;a<this.vertices.length;a++){const c=a/i*nn,d=o*Ca(c),u=o*va(c),f=s*Ca(c-kt),h=s*va(c-kt),p=s*Ca(c+kt),m=s*va(c+kt),g=this.vertices[a];g.command=a===0?me.move:me.curve,g.set(d,u),g.controls.left.set(f,h),g.controls.right.set(p,m)}}return super._update.call(this),this}flagReset(){return this._flagRadius=!1,super.flagReset.call(this),this}clone(i){const r=new Jn(0,0,this.radius,this.vertices.length);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix);for(let o=0;o<Oe.Properties.length;o++){const s=Oe.Properties[o];r[s]=this[s]}return i&&i.add(r),r}toObject(){const i=super.toObject.call(this);i.renderer.type="circle";for(let r=0;r<Jn.Properties.length;r++){const o=Jn.Properties[r];i[o]=this[o]}return i}};B(Jn,"Properties",["radius"]);let Sa=Jn;const bu={radius:{enumerable:!0,get:function(){return this._radius},set:function(n){this._radius=n,this._flagRadius=!0}}},Ba=Math.cos,Na=Math.sin,ei=class ei extends Oe{constructor(i,r,o,s,a){typeof s!="number"&&typeof o=="number"&&(s=o);const l=a?Math.max(a,2):4,c=[];for(let d=0;d<l;d++)c.push(new Ae);super(c,!0,!0,!0);B(this,"_flagWidth",!1);B(this,"_flagHeight",!1);B(this,"_width",0);B(this,"_height",0);this._renderer.type="ellipse";for(let d in _u)Object.defineProperty(this,d,_u[d]);typeof o=="number"&&(this.width=o*2),typeof s=="number"&&(this.height=s*2),this._update(),typeof i=="number"&&(this.translation.x=i),typeof r=="number"&&(this.translation.y=r)}static fromObject(i){const r=new ei().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<ei.Properties.length;r++){const o=ei.Properties[r];o in i&&typeof i[o]=="number"&&(this[o]=i[o])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){let i=this.vertices.length;!this._closed&&i>2&&(i-=1);const r=4/3*Math.tan(Math.PI/(this.vertices.length*2)),o=this._width/2,s=this._height/2;for(let a=0;a<this.vertices.length;a++){const c=a/i*nn,d=o*Ba(c),u=s*Na(c),f=o*r*Ba(c-kt),h=s*r*Na(c-kt),p=o*r*Ba(c+kt),m=s*r*Na(c+kt),g=this.vertices[a];g.command=a===0?me.move:me.curve,g.set(d,u),g.controls.left.set(f,h),g.controls.right.set(p,m)}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(i){const r=this.width/2,o=this.height/2,s=this.vertices.length,a=new ei(0,0,r,o,s);a.translation.copy(this.translation),a.rotation=this.rotation,a.scale=this.scale,a.skewX=this.skewX,a.skewY=this.skewY,this.matrix.manual&&a.matrix.copy(this.matrix);for(let l=0;l<Oe.Properties.length;l++){const c=Oe.Properties[l];a[c]=this[c]}return i&&i.add(a),a}toObject(){const i=super.toObject.call(this);i.renderer.type="ellipse";for(let r=0;r<ei.Properties.length;r++){const o=ei.Properties[r];i[o]=this[o]}return i}};B(ei,"Properties",["width","height"]);let Ta=ei;const _u={width:{enumerable:!0,get:function(){return this._width},set:function(n){this._width=n,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(n){this._height=n,this._flagHeight=!0}}},A1=Math.cos,O1=Math.sin,ti=class ti extends Oe{constructor(i,r,o,s){s=Math.max(s||0,3);super();B(this,"_flagWidth",!1);B(this,"_flagHeight",!1);B(this,"_flagSides",!1);B(this,"_radius",0);B(this,"_width",0);B(this,"_height",0);B(this,"_sides",0);this._renderer.type="polygon";for(let a in wu)Object.defineProperty(this,a,wu[a]);this.closed=!0,this.automatic=!1,typeof o=="number"&&(this.radius=o),typeof s=="number"&&(this.sides=s),this._update(),typeof i=="number"&&(this.translation.x=i),typeof r=="number"&&(this.translation.y=r)}static fromObject(i){const r=new ti().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<ti.Properties.length;r++){const o=ti.Properties[r];o in i&&typeof i[o]=="number"&&(this[o]=i[o])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagSides){const i=this._sides,r=i+1;let o=this.vertices.length;o>i&&(this.vertices.splice(i-1,o-i),o=i);for(let s=0;s<r;s++){const a=(s+.5)/i,l=nn*a+Math.PI/2,c=this._width*A1(l)/2,d=this._height*O1(l)/2;s>=o?this.vertices.push(new Ae(c,d)):this.vertices[s].set(c,d),this.vertices[s].command=s===0?me.move:me.line}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=this._flagSides=!1,super.flagReset.call(this),this}clone(i){const r=new ti(0,0,0,this.sides);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,r.width=this.width,r.height=this.height,this.matrix.manual&&r.matrix.copy(this.matrix);for(let o=0;o<Oe.Properties.length;o++){const s=Oe.Properties[o];r[s]=this[s]}return i&&i.add(r),r}toObject(){const i=super.toObject.call(this);i.renderer.type="polygon";for(let r=0;r<ti.Properties.length;r++){const o=ti.Properties[r];i[o]=this[o]}return i}};B(ti,"Properties",["width","height","sides"]);let $a=ti;const wu={radius:{enumerable:!0,get:function(){return this._radius},set:function(n){this._radius=n,this.width=n*2,this.height=n*2}},width:{enumerable:!0,get:function(){return this._width},set:function(n){this._width=n,this._flagWidth=!0,this._radius=Math.max(this.width,this.height)/2}},height:{enumerable:!0,get:function(){return this._height},set:function(n){this._height=n,this._flagHeight=!0,this._radius=Math.max(this.width,this.height)/2}},sides:{enumerable:!0,get:function(){return this._sides},set:function(n){this._sides=n,this._flagSides=!0}}},Xi=class Xi extends Oe{constructor(i,r,o,s){const a=[new Ae,new Ae,new Ae,new Ae];super(a,!0,!1,!0);B(this,"_flagWidth",!1);B(this,"_flagHeight",!1);B(this,"_width",0);B(this,"_height",0);B(this,"_origin",null);this._renderer.type="rectangle";for(let l in xu)Object.defineProperty(this,l,xu[l]);this.width=typeof o=="number"?o:1,this.height=typeof s=="number"?s:1,this.origin=new be,typeof i=="number"&&(this.translation.x=i),typeof r=="number"&&(this.translation.y=r),this._update()}static fromObject(i){const r=new Xi().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<Xi.Properties.length;r++){const o=Xi.Properties[r];o in i&&(typeof i[o]=="number"?this[o]=i[o]:this[o]instanceof be&&this[o].copy(i[o]))}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){const i=this._width/2,r=this._height/2;!this._closed&&this.vertices.length===4&&this.vertices.push(new Ae),this.vertices[0].set(-i,-r).sub(this._origin).command=me.move,this.vertices[1].set(i,-r).sub(this._origin).command=me.line,this.vertices[2].set(i,r).sub(this._origin).command=me.line,this.vertices[3].set(-i,r).sub(this._origin).command=me.line,this.vertices[4]&&(this.vertices[4].set(-i,-r).sub(this._origin).command=me.line)}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(i){const r=new Xi(0,0,this.width,this.height);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix);for(let o=0;o<Oe.Properties.length;o++){const s=Oe.Properties[o];r[s]instanceof be?r[s].copy(this[s]):r[s]=this[s]}return i&&i.add(r),r}toObject(){const i=super.toObject.call(this);return i.renderer.type="rectangle",i.width=this.width,i.height=this.height,i.origin=this.origin.toObject(),i}};B(Xi,"Properties",["width","height","origin"]);let zr=Xi;const xu={width:{enumerable:!0,get:function(){return this._width},set:function(n){this._width=n,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(n){this._height=n,this._flagHeight=!0}},origin:{enumerable:!0,get:function(){return this._origin},set:function(n){this._origin&&this._origin.unbind(te.Types.change,this._renderer.flagVertices),this._origin=n,this._origin.bind(te.Types.change,this._renderer.flagVertices),this._renderer.flagVertices()}}},ni=class ni extends Oe{constructor(i,r,o,s,a){typeof a>"u"&&typeof o=="number"&&typeof s=="number"&&(a=Math.floor(Math.min(o,s)/12));const l=[];for(let c=0;c<10;c++)l.push(new Ae(0,0,0,0,0,0,c===0?me.move:me.curve));super(l);B(this,"_flagWidth",!1);B(this,"_flagHeight",!1);B(this,"_flagRadius",!1);B(this,"_width",0);B(this,"_height",0);B(this,"_radius",12);this._renderer.type="rounded-rectangle";for(let c in ku)Object.defineProperty(this,c,ku[c]);this.closed=!0,this.automatic=!1,this._renderer.flagRadius=z1.bind(this),typeof o=="number"&&(this.width=o),typeof s=="number"&&(this.height=s),(typeof a=="number"||a instanceof be)&&(this.radius=a),this._update(),typeof i=="number"&&(this.translation.x=i),typeof r=="number"&&(this.translation.y=r)}static fromObject(i){const r=new ni().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<ni.Properties.length;r++){const o=ni.Properties[r];if(o in i){const s=i[o];/radius/i.test(o)?this[o]=typeof s=="number"||s instanceof be?s:new be().copy(s):typeof s=="number"&&(this[o]=s)}}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagRadius){const i=this._width,r=this._height;let o,s;this._radius instanceof be?(o=this._radius.x,s=this._radius.y):(o=this._radius,s=this._radius);let a,l=i/2,c=r/2;a=this.vertices[0],a.x=-(l-o),a.y=-c,a=this.vertices[1],a.x=l-o,a.y=-c,a.controls.left.clear(),a.controls.right.x=o,a.controls.right.y=0,a=this.vertices[2],a.x=l,a.y=-(c-s),a.controls.right.clear(),a.controls.left.clear(),a=this.vertices[3],a.x=l,a.y=c-s,a.controls.left.clear(),a.controls.right.x=0,a.controls.right.y=s,a=this.vertices[4],a.x=l-o,a.y=c,a.controls.right.clear(),a.controls.left.clear(),a=this.vertices[5],a.x=-(l-o),a.y=c,a.controls.left.clear(),a.controls.right.x=-o,a.controls.right.y=0,a=this.vertices[6],a.x=-l,a.y=c-s,a.controls.left.clear(),a.controls.right.clear(),a=this.vertices[7],a.x=-l,a.y=-(c-s),a.controls.left.clear(),a.controls.right.x=0,a.controls.right.y=-s,a=this.vertices[8],a.x=-(l-o),a.y=-c,a.controls.left.clear(),a.controls.right.clear(),a=this.vertices[9],a.copy(this.vertices[8])}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=this._flagRadius=!1,super.flagReset.call(this),this}clone(i){const r=this.width,o=this.height,s=this.radius,a=new ni(0,0,r,o,s);a.translation.copy(this.translation),a.rotation=this.rotation,a.scale=this.scale,a.skewX=this.skewX,a.skewY=this.skewY,this.matrix.manual&&a.matrix.copy(this.matrix);for(let l=0;l<Oe.Properties.length;l++){const c=Oe.Properties[l];a[c]=this[c]}return i&&i.add(a),a}toObject(){const i=super.toObject.call(this);i.renderer.type="rounded-rectangle";for(let r=0;r<ni.Properties.length;r++){const o=ni.Properties[r];i[o]=this[o]}return i.radius=typeof this.radius=="number"?this.radius:this.radius.toObject(),i}};B(ni,"Properties",["width","height","radius"]);let Ea=ni;const ku={width:{enumerable:!0,get:function(){return this._width},set:function(n){this._width=n,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(n){this._height=n,this._flagHeight=!0}},radius:{enumerable:!0,get:function(){return this._radius},set:function(n){this._radius instanceof be&&this._radius.unbind(te.Types.change,this._renderer.flagRadius),this._radius=n,this._radius instanceof be&&this._radius.bind(te.Types.change,this._renderer.flagRadius),this._flagRadius=!0}}};function z1(){this._flagRadius=!0}const D1=Math.cos,L1=Math.sin,ii=class ii extends Oe{constructor(i,r,o,s,a){arguments.length<=3&&(s=o,o=s/2),(typeof a!="number"||a<=0)&&(a=5);super();B(this,"_flagInnerRadius",!1);B(this,"_flagOuterRadius",!1);B(this,"_flagSides",!1);B(this,"_innerRadius",0);B(this,"_outerRadius",0);B(this,"_sides",0);this._renderer.type="star";for(let l in Cu)Object.defineProperty(this,l,Cu[l]);this.closed=!0,this.automatic=!1,typeof o=="number"&&(this.innerRadius=o),typeof s=="number"&&(this.outerRadius=s),typeof a=="number"&&(this.sides=a),this._update(),typeof i=="number"&&(this.translation.x=i),typeof r=="number"&&(this.translation.y=r)}static fromObject(i){const r=new ii().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<ii.Properties.length;r++){const o=ii.Properties[r];o in i&&typeof i[o]=="number"&&(this[o]=i[o])}return this}_update(){if(this._flagVertices||this._flagInnerRadius||this._flagOuterRadius||this._flagSides){const i=this._sides*2,r=i+1;let o=this.vertices.length;o>i&&(this.vertices.splice(i-1,o-i),o=i);for(let s=0;s<r;s++){const a=(s+.5)/i,l=nn*a,c=(s%2?this._outerRadius:this._innerRadius)/2,d=c*D1(l),u=c*L1(l);s>=o?this.vertices.push(new Ae(d,u)):this.vertices[s].set(d,u),this.vertices[s].command=s===0?me.move:me.line}}return super._update.call(this),this}flagReset(){return this._flagInnerRadius=this._flagOuterRadius=this._flagSides=!1,super.flagReset.call(this),this}clone(i){const r=this.innerRadius,o=this.outerRadius,s=this.sides,a=new ii(0,0,r,o,s);a.translation.copy(this.translation),a.rotation=this.rotation,a.scale=this.scale,a.skewX=this.skewX,a.skewY=this.skewY,this.matrix.manual&&a.matrix.copy(this.matrix);for(let l=0;l<Oe.Properties.length;l++){const c=Oe.Properties[l];a[c]=this[c]}return i&&i.add(a),a}toObject(){const i=super.toObject.call(this);i.renderer.type="star";for(let r=0;r<ii.Properties.length;r++){const o=ii.Properties[r];i[o]=this[o]}return i}};B(ii,"Properties",["innerRadius","outerRadius","sides"]);let Ra=ii;const Cu={innerRadius:{enumerable:!0,get:function(){return this._innerRadius},set:function(n){this._innerRadius=n,this._flagInnerRadius=!0}},outerRadius:{enumerable:!0,get:function(){return this._outerRadius},set:function(n){this._outerRadius=n,this._flagOuterRadius=!0}},sides:{enumerable:!0,get:function(){return this._sides},set:function(n){this._sides=n,this._flagSides=!0}}};let Pa;const vu=Math.min,Su=Math.max;Rn.document&&(Pa=document.createElement("canvas"));const Vt=class Vt extends Fn{constructor(i,r,o,s){super();B(this,"_flagValue",!0);B(this,"_flagFamily",!0);B(this,"_flagSize",!0);B(this,"_flagLeading",!0);B(this,"_flagAlignment",!0);B(this,"_flagBaseline",!0);B(this,"_flagStyle",!0);B(this,"_flagWeight",!0);B(this,"_flagDecoration",!0);B(this,"_flagFill",!0);B(this,"_flagStroke",!0);B(this,"_flagLinewidth",!0);B(this,"_flagOpacity",!0);B(this,"_flagVisible",!0);B(this,"_flagMask",!1);B(this,"_flagClip",!1);B(this,"_flagDirection",!0);B(this,"_flagStrokeAttenuation",!0);B(this,"_value","");B(this,"_family","sans-serif");B(this,"_size",13);B(this,"_leading",17);B(this,"_alignment","center");B(this,"_baseline","middle");B(this,"_style","normal");B(this,"_weight",500);B(this,"_decoration","none");B(this,"_direction","ltr");B(this,"_fill","#000");B(this,"_stroke","none");B(this,"_linewidth",1);B(this,"_opacity",1);B(this,"_visible",!0);B(this,"_mask",null);B(this,"_clip",!1);B(this,"_dashes",null);B(this,"_strokeAttenuation",!0);for(let a in Bu)Object.defineProperty(this,a,Bu[a]);if(this._renderer.type="text",this._renderer.flagFill=H1.bind(this),this._renderer.flagStroke=W1.bind(this),this.value=i,typeof r=="number"&&(this.translation.x=r),typeof o=="number"&&(this.translation.y=o),this.dashes=[],this.dashes.offset=0,!je.isObject(s))return this;for(let a=0;a<Vt.Properties.length;a++){const l=Vt.Properties[a];l in s&&(this[l]=s[l])}}static Measure(i){if(Pa){const r=Pa.getContext("2d");r.font=[i._style,i._weight,`${i._size}px/${i._leading}px`,i._family].join(" ");const o=r.measureText(i.value,0,0),s=o.actualBoundingBoxDescent+o.actualBoundingBoxAscent;return{width:o.width,height:s}}else{const r=this.value.length*this.size*Vt.Ratio,o=this.leading;return console.warn("Two.Text: unable to accurately measure text, so using an approximation."),{width:r,height:o}}}static fromObject(i){const r=typeof i.fill=="string"?i.fill:Ei(i.fill),o=typeof i.stroke=="string"?i.stroke:Ei(i.stroke),s=new Vt().copy({...i,fill:r,stroke:o});return"id"in i&&(s.id=i.id),s}copy(i){super.copy.call(this,i);for(let r=0;r<Vt.Properties.length;r++){const o=Vt.Properties[r];o in i&&(this[o]=i[o])}return this}clone(i){const r=new Vt(this.value);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale;for(let o=0;o<Vt.Properties.length;o++){const s=Vt.Properties[o];r[s]=this[s]}return this.matrix.manual&&r.matrix.copy(this.matrix),i&&i.add(r),r._update()}toObject(){const i=super.toObject.call(this);i.renderer.type="text";for(let r=0;r<Vt.Properties.length;r++){const o=Vt.Properties[r];i[o]=this[o]}return i}dispose(){return super.dispose(),typeof this.fill=="object"&&typeof this.fill.dispose=="function"?this.fill.dispose():typeof this.fill=="object"&&typeof this.fill.unbind=="function"&&this.fill.unbind(),typeof this.stroke=="object"&&typeof this.stroke.dispose=="function"?this.stroke.dispose():typeof this.stroke=="object"&&typeof this.stroke.unbind=="function"&&this.stroke.unbind(),this}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}getBoundingClientRect(i){let r,o,s,a,l;this._update(!0),r=i?this.matrix:this.worldMatrix;const{width:c,height:d}=Vt.Measure(this),u=(this._linewidth||0)/2;switch(this.alignment){case"left":o=-u,s=c+u;break;case"right":o=-(c+u),s=u;break;default:o=-(c/2+u),s=c/2+u}switch(this.baseline){case"middle":a=-(d/2+u),l=d/2+u;break;default:a=-(d+u),l=u}const[f,h]=r.multiply(o,a),[p,m]=r.multiply(o,l),[g,b]=r.multiply(s,a),[y,_]=r.multiply(s,l);return a=vu(h,m,b,_),o=vu(f,p,g,y),s=Su(f,p,g,y),l=Su(h,m,b,_),{top:a,left:o,right:s,bottom:l,width:s-o,height:l-a}}flagReset(){return super.flagReset.call(this),this._flagValue=this._flagFamily=this._flagSize=this._flagLeading=this._flagAlignment=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagClip=this._flagDecoration=this._flagClassName=this._flagBaseline=this._flagWeight=this._flagStyle=this._flagDirection=!1,this}};B(Vt,"Ratio",.6),B(Vt,"Properties",["value","family","size","leading","alignment","linewidth","style","weight","decoration","direction","baseline","opacity","visible","fill","stroke","dashes","strokeAttenuation"]);let gr=Vt;const Bu={value:{enumerable:!0,get:function(){return this._value},set:function(n){this._value=n,this._flagValue=!0}},family:{enumerable:!0,get:function(){return this._family},set:function(n){this._family=n,this._flagFamily=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(n){this._size=n,this._flagSize=!0}},leading:{enumerable:!0,get:function(){return this._leading},set:function(n){this._leading=n,this._flagLeading=!0}},alignment:{enumerable:!0,get:function(){return this._alignment},set:function(n){this._alignment=n,this._flagAlignment=!0}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(n){this._linewidth=n,this._flagLinewidth=!0}},style:{enumerable:!0,get:function(){return this._style},set:function(n){this._style=n,this._flagStyle=!0}},weight:{enumerable:!0,get:function(){return this._weight},set:function(n){this._weight=n,this._flagWeight=!0}},decoration:{enumerable:!0,get:function(){return this._decoration},set:function(n){this._decoration=n,this._flagDecoration=!0}},direction:{enumerable:!0,get:function(){return this._direction},set:function(n){this._direction=n,this._flagDirection=!0}},baseline:{enumerable:!0,get:function(){return this._baseline},set:function(n){this._baseline=n,this._flagBaseline=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(n){this._opacity=n,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(n){this._visible=n,this._flagVisible=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(n){(this._fill instanceof gt||this._fill instanceof zt||this._fill instanceof Dt||this._fill instanceof nt)&&this._fill.unbind(te.Types.change,this._renderer.flagFill),this._fill=n,this._flagFill=!0,(this._fill instanceof gt||this._fill instanceof zt||this._fill instanceof Dt||this._fill instanceof nt)&&this._fill.bind(te.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(n){(this._stroke instanceof gt||this._stroke instanceof zt||this._stroke instanceof Dt||this._stroke instanceof nt)&&this._stroke.unbind(te.Types.change,this._renderer.flagStroke),this._stroke=n,this._flagStroke=!0,(this._stroke instanceof gt||this._stroke instanceof zt||this._stroke instanceof Dt||this._stroke instanceof nt)&&this._stroke.bind(te.Types.change,this._renderer.flagStroke)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(n){this._mask=n,this._flagMask=!0,je.isObject(n)&&!n.clip&&(n.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(n){this._clip=n,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(n){typeof n.offset!="number"&&(n.offset=this.dashes&&this._dashes.offset||0),this._dashes=n}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(n){this._strokeAttenuation=!!n,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};function H1(){this._flagFill=!0}function W1(){this._flagStroke=!0}const ri=class ri extends zr{constructor(i,r,o,s){super(r,o,0,0);B(this,"_flagTextures",!1);B(this,"_flagFrameRate",!1);B(this,"_flagIndex",!1);B(this,"_amount",1);B(this,"_duration",0);B(this,"_index",0);B(this,"_startTime",0);B(this,"_playing",!1);B(this,"_firstFrame",0);B(this,"_lastFrame",0);B(this,"_loop",!0);B(this,"_textures",null);B(this,"_frameRate",0);B(this,"_origin",null);this._renderer.type="image-sequence";for(let a in Nu)Object.defineProperty(this,a,Nu[a]);this._renderer.flagTextures=j1.bind(this),this._renderer.bindTextures=q1.bind(this),this._renderer.unbindTextures=X1.bind(this),this.noStroke(),this.noFill(),Array.isArray(i)?this.textures=i.map(Tu.bind(this)):typeof i=="string"&&(this.textures=[Tu(i)]),this.origin=new be,this._update(),typeof s=="number"?this.frameRate=s:this.frameRate=ri.DefaultFrameRate,this.index=0}static fromObject(i){const r=new ri().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<ri.Properties.length;r++){const o=ri.Properties[r];o in i&&(this[o]=i[o])}return this}play(i,r,o){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=je.performance.now(),typeof i=="number"&&(this._firstFrame=i),typeof r=="number"&&(this._lastFrame=r),typeof o=="function"?this._onLastFrame=o:delete this._onLastFrame,this._index!==this._firstFrame&&(this._startTime-=1e3*Math.abs(this._index-this._firstFrame)/this._frameRate),this}pause(){return this._playing=!1,this}stop(){return this._playing=!1,this._index=this._firstFrame,this}clone(i){const r=new ri(this.textures,this.translation.x,this.translation.y,this.frameRate);return r._loop=this._loop,this._playing&&r.play(),i&&i.add(r),r}toObject(){const i=super.toObject.call(this);return i.renderer.type="image-sequence",i.textures=this.textures.map(function(r){return r.toObject()}),i.frameRate=this.frameRate,i.index=this.index,i.firstFrame=this.firstFrame,i.lastFrame=this.lastFrame,i.loop=this.loop,i}dispose(){if(super.dispose(),this._playing&&(this._playing=!1),this._onLastFrame=null,this.textures&&typeof this.textures.unbind=="function")try{this.textures.unbind()}catch{}if(this.textures)for(let i=0;i<this.textures.length;i++){const r=this.textures[i];typeof r.dispose=="function"?r.dispose():typeof r.unbind=="function"&&r.unbind()}return this}_update(){const i=this._textures;let r,o,s,a,l,c,d,u;return i&&(this._flagTextures&&(this._amount=i.length),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._playing&&this._frameRate>0?(a=this._amount,je.isNaN(this._lastFrame)&&(this._lastFrame=a-1),s=je.performance.now()-this._startTime,u=this._lastFrame+1,l=1e3*(u-this._firstFrame)/this._frameRate,this._loop?s=s%l:s=Math.min(s,l),d=Kt(this._firstFrame,u,s/l),d=Math.floor(d),d!==this._index&&(this._index=d,c=i[this._index],c.loaded&&(r=c.image.width,o=c.image.height,this.width!==r&&(this.width=r),this.height!==o&&(this.height=o),this.fill=c,d>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()))):(this._flagIndex||!(this.fill instanceof nt))&&(c=i[this._index],c.loaded&&(r=c.image.width,o=c.image.height,this.width!==r&&(this.width=r),this.height!==o&&(this.height=o)),this.fill=c)),super._update.call(this),this}flagReset(){return this._flagTextures=this._flagFrameRate=!1,super.flagReset.call(this),this}};B(ri,"Properties",["textures","frameRate","index","firstFrame","lastFrame","loop"]),B(ri,"DefaultFrameRate",30);let Fa=ri;const Nu={frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(n){this._frameRate=n,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(n){this._index=n,this._flagIndex=!0}},textures:{enumerable:!0,get:function(){return this._textures},set:function(n){const e=this._renderer.bindTextures,i=this._renderer.unbindTextures;this._textures&&this._textures.unbind(te.Types.insert,e).unbind(te.Types.remove,i),this._textures=new Ti((n||[]).slice(0)),this._textures.bind(te.Types.insert,e).bind(te.Types.remove,i),e(this._textures)}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(n){this._firstFrame=n}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(n){this._lastFrame=n}},loop:{enumerable:!0,get:function(){return this._loop},set:function(n){this._loop=!!n}}};function j1(){this._flagTextures=!0}function q1(n){let e=n.length;for(;e--;)n[e].bind(te.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function X1(n){let e=n.length;for(;e--;)n[e].unbind(te.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function Tu(n){if(n instanceof nt)return n;if(typeof n=="string")return new nt(n)}const Yi=class Yi extends zr{constructor(i,r,o,s,a,l){super(r,o,0,0);B(this,"_flagTexture",!1);B(this,"_flagColumns",!1);B(this,"_flagRows",!1);B(this,"_flagFrameRate",!1);B(this,"_flagIndex",!1);B(this,"_amount",1);B(this,"_duration",0);B(this,"_startTime",0);B(this,"_playing",!1);B(this,"_firstFrame",0);B(this,"_lastFrame",0);B(this,"_loop",!0);B(this,"_texture",null);B(this,"_columns",1);B(this,"_rows",1);B(this,"_frameRate",0);B(this,"_index",0);B(this,"_origin",null);this._renderer.type="sprite";for(let c in $u)Object.defineProperty(this,c,$u[c]);this.noStroke(),this.noFill(),i instanceof nt?this.texture=i:typeof i=="string"&&(this.texture=new nt(i)),this.origin=new be,this._update(),typeof s=="number"&&(this.columns=s),typeof a=="number"&&(this.rows=a),typeof l=="number"&&(this.frameRate=l),this.index=0}static fromObject(i){const r=new Yi().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<Yi.Properties.length;r++){const o=Yi.Properties[r];o in i&&(this[o]=i[o])}return this}play(i,r,o){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=je.performance.now(),typeof i=="number"&&(this._firstFrame=i),typeof r=="number"&&(this._lastFrame=r),typeof o=="function"?this._onLastFrame=o:delete this._onLastFrame,this._index!==this._firstFrame&&(this._startTime-=1e3*Math.abs(this._index-this._firstFrame)/this._frameRate),this}pause(){return this._playing=!1,this}stop(){return this._playing=!1,this._index=0,this}clone(i){const r=new Yi(this.texture,this.translation.x,this.translation.y,this.columns,this.rows,this.frameRate);return this.playing&&r.play(this._firstFrame,this._lastFrame),r.loop=this.loop,r.firstFrame=this.firstFrame,r.lastFrame=this.lastFrame,i&&i.add(r),r}toObject(){const i=super.toObject.call(this);return i.renderer.type="sprite",i.texture=this.texture.toObject(),i.columns=this.columns,i.rows=this.rows,i.frameRate=this.frameRate,i.index=this.index,i.firstFrame=this.firstFrame,i.lastFrame=this.lastFrame,i.loop=this.loop,i}dispose(){return super.dispose(),this._playing&&(this._playing=!1),this._onLastFrame=null,this._startTime=0,this._texture&&typeof this._texture.dispose=="function"?this._texture.dispose():this._texture&&typeof this._texture.unbind=="function"&&this._texture.unbind(),this}_update(){const i=this._texture,r=this._columns,o=this._rows;let s,a,l,c,d,u,f,h,p;if(i&&((this._flagColumns||this._flagRows)&&(this._amount=this._columns*this._rows),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._flagTexture&&(this.fill=i),i.loaded)){f=i.image.width,h=i.image.height,s=f/r,a=h/o,c=this._amount,this.width!==s&&(this.width=s),this.height!==a&&(this.height=a),this._playing&&this._frameRate>0&&(je.isNaN(this._lastFrame)&&(this._lastFrame=c-1),l=je.performance.now()-this._startTime,p=this._lastFrame+1,d=1e3*(p-this._firstFrame)/this._frameRate,this._loop?l=l%d:l=Math.min(l,d),u=Kt(this._firstFrame,p,l/d),u=Math.floor(u),u!==this._index&&(this._index=u,u>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()));const m=this._index%r,g=Math.floor(this._index/r),b=-s*m+(f-s)/2,y=-a*g+(h-a)/2;b!==i.offset.x&&(i.offset.x=b),y!==i.offset.y&&(i.offset.y=y)}return super._update.call(this),this}flagReset(){return this._flagTexture=this._flagColumns=this._flagRows=this._flagFrameRate=!1,super.flagReset.call(this),this}};B(Yi,"Properties",["texture","columns","rows","frameRate","index","firstFrame","lastFrame","loop"]);let Va=Yi;const $u={texture:{enumerable:!0,get:function(){return this._texture},set:function(n){this._texture=n,this._flagTexture=!0}},columns:{enumerable:!0,get:function(){return this._columns},set:function(n){this._columns=n,this._flagColumns=!0}},rows:{enumerable:!0,get:function(){return this._rows},set:function(n){this._rows=n,this._flagRows=!0}},frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(n){this._frameRate=n,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(n){this._index=n,this._flagIndex=!0}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(n){this._firstFrame=n}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(n){this._lastFrame=n}},loop:{enumerable:!0,get:function(){return this._loop},set:function(n){this._loop=!!n}}},Go=Math.min,Zo=Math.max,Y1={getShapesAtPoint:{results:[],hitOptions:{},context:{x:0,y:0,visibleOnly:!0,results:null},single:[],empty:[]}},Wt=class Wt extends Fn{constructor(i){super();B(this,"_flagAdditions",!1);B(this,"_flagSubtractions",!1);B(this,"_flagOrder",!1);B(this,"_flagOpacity",!0);B(this,"_flagBeginning",!1);B(this,"_flagEnding",!1);B(this,"_flagLength",!1);B(this,"_flagMask",!1);B(this,"_fill","#fff");B(this,"_stroke","#000");B(this,"_linewidth",1);B(this,"_opacity",1);B(this,"_visible",!0);B(this,"_cap","round");B(this,"_join","round");B(this,"_miter",4);B(this,"_closed",!0);B(this,"_curved",!1);B(this,"_automatic",!0);B(this,"_beginning",0);B(this,"_ending",1);B(this,"_length",0);B(this,"_mask",null);B(this,"_strokeAttenuation",!0);for(let r in Eu)Object.defineProperty(this,r,Eu[r]);this._renderer.type="group",this.additions=[],this.subtractions=[],this.children=Array.isArray(i)?i:Array.prototype.slice.call(arguments)}static InsertChildren(i){for(let r=0;r<i.length;r++)Ru.call(this,i[r],this)}static RemoveChildren(i){for(let r=0;r<i.length;r++)Ru.call(this,i[r])}static OrderChildren(i){this._flagOrder=!0}static fromObject(i){const r=new Wt;for(let s=0;s<Wt.Properties.length;s++){const a=Wt.Properties[s];a in i&&(/(fill|stroke)/i.test(a)?r[a]=typeof i[a]=="string"?i[a]:Ei(i[a]):r[a]=i[a])}return"mask"in i&&(r.mask=o(i.mask)),"id"in i&&(r.id=i.id),r.children=i.children.map(o),r;function o(s){if(s&&s.renderer)switch(s.renderer.type){case"arc-segment":return ka.fromObject(s);case"circle":return Sa.fromObject(s);case"element":return Or.fromObject(s);case"ellipse":return Ta.fromObject(s);case"group":return Wt.fromObject(s);case"image":return Image.fromObject(s);case"image-sequence":return Fa.fromObject(s);case"path":return Oe.fromObject(s);case"points":return Ko.fromObject(s);case"polygon":return $a.fromObject(s);case"rectangle":return zr.fromObject(s);case"rounded-rectangle":return Ea.fromObject(s);case"shape":return Fn.fromObject(s);case"sprite":return Va.fromObject(s);case"star":return Ra.fromObject(s);case"text":return gr.fromObject(s)}return s}}static IsVisible(i,r){if(!r)return!0;let o=i;for(;o;){if(typeof o.visible=="boolean"&&!o.visible||typeof o.opacity=="number"&&o.opacity<=0)return!1;o=o.parent}return!0}static VisitForHitTest(i,r,o,s,a,l,c){const d=i&&i.children;if(!d)return!1;const u=r.results;for(let f=d.length-1;f>=0;f--){const h=d[f];if(!h||!Wt.IsVisible(h,r.visibleOnly))continue;const p=typeof h.getBoundingClientRect=="function"?h.getBoundingClientRect():null;if(!(p&&!C1(p,r.x,r.y,l))){if(h instanceof Wt){if(o&&(!s||s(h))&&typeof h.contains=="function"&&h.contains(r.x,r.y,a)&&(u.push(h),c)||Wt.VisitForHitTest(h,r,o,s,a,l,c))return!0;continue}if(h instanceof Fn&&!(s&&!s(h))&&typeof h.contains=="function"&&h.contains(r.x,r.y,a)&&(u.push(h),c))return!0}}return!1}copy(i){super.copy.call(this,i),console.warn("Two.js: attempting to copy group. Two.Group.children copying not supported.");for(let r=0;r<Wt.Properties.length;r++){const o=Wt.Properties[r];o in i&&(this[o]=i[o])}return this}clone(i){const r=new Wt,o=this.children.map(function(s){return s.clone()});return r.add(o),r.opacity=this.opacity,this.mask&&(r.mask=this.mask),r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.className=this.className,this.matrix.manual&&r.matrix.copy(this.matrix),i&&i.add(r),r._update()}toObject(){const i=super.toObject.call(this);return i.renderer.type="group",i.children=[],i.opacity=this.opacity,i.className=this.className,i.mask=this.mask?this.mask.toObject():null,je.each(this.children,(r,o)=>{i.children[o]=r.toObject()},this),i}dispose(){if(super.dispose(),this.children)for(let i=0;i<this.children.length;i++){const r=this.children[i];typeof r.dispose=="function"&&r.dispose()}if(this.children&&typeof this.children.unbind=="function")try{this.children.unbind()}catch{}return this}getShapesAtPoint(i,r,o){const s=o||{},{results:a,hitOptions:l,context:c,single:d,empty:u}=Y1.getShapesAtPoint;a.length=0;const f=s.mode==="deepest"||s.deepest?"deepest":"all",h=s.visibleOnly!==!1,p=!!s.includeGroups,m=typeof s.filter=="function"?s.filter:null,g=typeof s.tolerance=="number"?s.tolerance:0;typeof s.precision=="number"?l.precision=s.precision:delete l.precision,typeof s.fill<"u"?l.fill=s.fill:delete l.fill,typeof s.stroke<"u"?l.stroke=s.stroke:delete l.stroke,l.tolerance=g,l.ignoreVisibility=!h;const b=f==="deepest";if(c.x=i,c.y=r,c.visibleOnly=h,c.results=a,Wt.VisitForHitTest(this,c,p,m,l,g,b),b){if(a.length>0){const _=a[0];return a.length=0,d[0]=_,d.length=1,d}return u.length=0,u}const y=a.slice();return a.length=0,y}corner(){const i=this.getBoundingClientRect(!0);for(let r=0;r<this.children.length;r++){const o=this.children[r];o.translation.x-=i.left,o.translation.y-=i.top}return this.mask&&(this.mask.translation.x-=i.left,this.mask.translation.y-=i.top),this}center(){const i=this.getBoundingClientRect(!0),r=i.left+i.width/2-this.translation.x,o=i.top+i.height/2-this.translation.y;for(let s=0;s<this.children.length;s++){const a=this.children[s];a.isShape&&(a.translation.x-=r,a.translation.y-=o)}return this.mask&&(this.mask.translation.x-=r,this.mask.translation.y-=o),this}getById(i){let r=null;function o(s){if(s.id===i)return s;if(s.children){if(s.children.ids[i])return s.children.ids[i];for(let a=0;a<s.children.length;a++)if(r=o(s.children[a]),r)return r}return null}return o(this)}getByClassName(i){const r=[];function o(s){if(Array.prototype.indexOf.call(s.classList,i)>=0&&r.push(s),s.children)for(let a=0;a<s.children.length;a++){const l=s.children[a];o(l)}return r}return o(this)}getByType(i){const r=[];function o(s){if(s instanceof i&&r.push(s),s.children)for(let a=0;a<s.children.length;a++){const l=s.children[a];o(l)}return r}return o(this)}add(i){i instanceof Array?i=i.slice():i=Array.prototype.slice.call(arguments);for(let r=0;r<i.length;r++){const o=i[r];if(!(o&&o.id))continue;const s=Array.prototype.indexOf.call(this.children,o);s>=0&&this.children.splice(s,1),this.children.push(o)}return this}remove(i){const r=arguments.length,o=this.parent;if(r<=0&&o)return o.remove(this),this;i instanceof Array?i=i.slice():i=Array.prototype.slice.call(arguments);for(let s=0;s<i.length;s++){const a=i[s];if(!a||!this.children.ids[a.id])continue;const l=this.children.indexOf(a);l>=0&&this.children.splice(l,1)}return this}getBoundingClientRect(i){let r,o,s,a,l,c;this._update(!0);let d=1/0,u=-1/0,f=1/0,h=-1/0;const p=/texture|gradient/i;o=i?this.matrix:this.worldMatrix;for(let m=0;m<this.children.length;m++){const g=this.children[m];if(!(!g.visible||p.test(g._renderer.type))&&(r=g.getBoundingClientRect(i),s=typeof r.top!="number"||je.isNaN(r.top)||!isFinite(r.top),a=typeof r.left!="number"||je.isNaN(r.left)||!isFinite(r.left),l=typeof r.right!="number"||je.isNaN(r.right)||!isFinite(r.right),c=typeof r.bottom!="number"||je.isNaN(r.bottom)||!isFinite(r.bottom),!(s||a||l||c)))if(i){const[b,y]=o.multiply(r.left,r.top),[_,x]=o.multiply(r.right,r.top),[w,C]=o.multiply(r.left,r.bottom),[N,k]=o.multiply(r.right,r.bottom);f=Go(y,x,C,k,f),d=Go(b,_,w,N,d),u=Zo(b,_,w,N,u),h=Zo(y,x,C,k,h)}else f=Go(r.top,f),d=Go(r.left,d),u=Zo(r.right,u),h=Zo(r.bottom,h)}return{top:f,left:d,right:u,bottom:h,width:u-d,height:h-f}}noFill(){return this.children.forEach(function(i){i.noFill()}),this}noStroke(){return this.children.forEach(function(i){i.noStroke()}),this}subdivide(){const i=arguments;return this.children.forEach(function(r){r.subdivide.apply(r,i)}),this}_update(){let i,r,o;if(this._flagBeginning||this._flagEnding){const s=Math.min(this._beginning,this._ending),a=Math.max(this._beginning,this._ending),l=this.length;let c=0;const d=s*l,u=a*l;for(i=0;i<this.children.length;i++)o=this.children[i],r=o.length,d>c+r?(o.beginning=1,o.ending=1):u<c?(o.beginning=0,o.ending=0):d>c&&d<c+r?(o.beginning=(d-c)/r,o.ending=1):u>c&&u<c+r?(o.beginning=0,o.ending=(u-c)/r):(o.beginning=0,o.ending=1),c+=r}return super._update.apply(this,arguments)}flagReset(){return this._flagAdditions&&(this.additions.length=0,this._flagAdditions=!1),this._flagSubtractions&&(this.subtractions.length=0,this._flagSubtractions=!1),this._flagOrder=this._flagMask=this._flagOpacity=this._flagBeginning=this._flagEnding=!1,super.flagReset.call(this),this}};B(Wt,"Children",gu),B(Wt,"Properties",["fill","stroke","linewidth","cap","join","miter","closed","curved","automatic"]);let Un=Wt;const Eu={visible:{enumerable:!0,get:function(){return this._visible},set:function(n){this._flagVisible=this._visible!==n||this._flagVisible,this._visible=n}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(n){this._flagOpacity=this._opacity!==n||this._flagOpacity,this._opacity=n}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(n){this._flagBeginning=this._beginning!==n||this._flagBeginning,this._beginning=n}},ending:{enumerable:!0,get:function(){return this._ending},set:function(n){this._flagEnding=this._ending!==n||this._flagEnding,this._ending=n}},length:{enumerable:!0,get:function(){if(this._flagLength||this._length<=0){if(this._length=0,!this.children)return this._length;for(let n=0;n<this.children.length;n++){const e=this.children[n];this._length+=e.length}}return this._length}},fill:{enumerable:!0,get:function(){return this._fill},set:function(n){this._fill=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.fill=n}}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(n){this._stroke=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.stroke=n}}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(n){this._linewidth=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.linewidth=n}}},join:{enumerable:!0,get:function(){return this._join},set:function(n){this._join=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.join=n}}},miter:{enumerable:!0,get:function(){return this._miter},set:function(n){this._miter=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.miter=n}}},cap:{enumerable:!0,get:function(){return this._cap},set:function(n){this._cap=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.cap=n}}},closed:{enumerable:!0,get:function(){return this._closed},set:function(n){this._closed=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.closed=n}}},curved:{enumerable:!0,get:function(){return this._curved},set:function(n){this._curved=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.curved=n}}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(n){this._automatic=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.automatic=n}}},children:{enumerable:!0,get:function(){return this._children},set:function(n){const e=Un.InsertChildren.bind(this),i=Un.RemoveChildren.bind(this),r=Un.OrderChildren.bind(this);this._children&&(this._children.unbind(),this._children.length>0&&i(this._children)),this._children=new gu(n),this._children.bind(te.Types.insert,e),this._children.bind(te.Types.remove,i),this._children.bind(te.Types.order,r),n.length>0&&e(n)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(n){this._mask=n,this._flagMask=!0,je.isObject(n)&&!n.clip&&(n.clip=!0)}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(n){this._strokeAttenuation=!!n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.strokeAttenuation!==void 0&&(i.strokeAttenuation=n)}}}};function Ru(n,e){const i=n.parent;let r;if(i===e){o();return}if(i&&i.children.ids[n.id]&&(r=Array.prototype.indexOf.call(i.children,n),i.children.splice(r,1),s()),e){o();return}s(),i._flagAdditions&&i.additions.length===0&&(i._flagAdditions=!1),i._flagSubtractions&&i.subtractions.length===0&&(i._flagSubtractions=!1),delete n.parent;function o(){e.subtractions.length>0&&(r=Array.prototype.indexOf.call(e.subtractions,n),r>=0&&e.subtractions.splice(r,1)),e.additions.length>0&&(r=Array.prototype.indexOf.call(e.additions,n),r>=0&&e.additions.splice(r,1)),n.parent=e,e.additions.push(n),e._flagAdditions=!0}function s(){r=Array.prototype.indexOf.call(i.additions,n),r>=0&&i.additions.splice(r,1),r=Array.prototype.indexOf.call(i.subtractions,n),r<0&&(i.subtractions.push(n),i._flagSubtractions=!0)}}class Qo extends Oe{constructor(e,i,r,o){const s=[new Ae(e,i),new Ae(r,o)];super(s);for(let a in Pu)Object.defineProperty(this,a,Pu[a]);this.vertices[0].command=me.move,this.vertices[1].command=me.line,this.automatic=!1}}B(Qo,"Properties",["left","right"]);const Pu={left:{enumerable:!0,get:function(){return this.vertices[0]},set:function(n){if(je.isObject(n))this.vertices.splice(0,1,n),this.vertices[0].command=me.move;else{const e=new Lo("Two.Line.left argument is not an object.");console.warn(e.name,e.message)}}},right:{enumerable:!0,get:function(){return this.vertices[1]},set:function(n){if(je.isObject(n))this.vertices.splice(1,1,n),this.vertices[1].command=me.line;else{const e=new Lo("Two.Line.right argument is not an object.");console.warn(e.name,e.message)}}}};class Ma{constructor(e=0,i=0){this.x=e,this.y=i}}class Vn{constructor(e=10,i=0,r="A"){B(this,"start",new Ma);B(this,"end",new Ma);this.width=e,this.angle=i,this.label=r}}const Ke={line:{color:"#000",size:5},previewLine:{color:"#000",size:2},anchorPoint:{color:"#FF8000",size:12,strokeSize:20},lineLabel:{color:"#FF8000",size:22,rotation:-.5},angleLabel:{size:22,color:"#088c00",rotation:-.5},colorSideLabel:{size:20,color:"#439227"}},U1={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function K1(n,e){return t.openBlock(),t.createElementBlock("svg",U1,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"m289.94 256l95-95A24 24 0 0 0 351 127l-95 95l-95-95a24 24 0 0 0-34 34l95 95l-95 95a24 24 0 1 0 34 34l95-95l95 95a24 24 0 0 0 34-34Z"},null,-1)])])}const Jo=t.markRaw({name:"ion-close",render:K1}),G1={class:"mr-3 flex flex-col gap-2"},Z1=["onClick"],Q1={class:"h-full p-2"},J1={},eb=t.defineComponent({...J1,__name:"kozyrek-configurator-templates",props:{settings:{},selectTemplateIndex:{}},emits:["template:select","init-draw-template","remove-custom-template"],setup(n,{emit:e}){const i=n,r=t.ref(!1),o=t.useTemplateRef("drawing-template-containers"),s=t.useTemplateRef("drawing-custom-template-containers"),a=e,l=c=>{r.value=!0,a("remove-custom-template",c,()=>{r.value=!1})};return t.onMounted(()=>{var c,d;(c=i.settings.templates)==null||c.forEach((u,f)=>{var p;const h=(p=o.value)==null?void 0:p.at(f);h&&a("init-draw-template",h,u)}),(d=i.settings.customTemplates)==null||d.forEach((u,f)=>{var p;const h=(p=s.value)==null?void 0:p.at(f);h&&a("init-draw-template",h,u)})}),t.watch(()=>[...i.settings.customTemplates],(c,d)=>{t.nextTick(()=>{c.forEach((u,f)=>{var h;if(!(d!=null&&d.includes(u))){const p=(h=s.value)==null?void 0:h.at(f);p&&a("init-draw-template",p,u)}}),d.length>c.length&&d.forEach((u,f)=>{var p;const h=(p=s.value)==null?void 0:p.at(f);h&&(h.innerHTML="",a("init-draw-template",h,u))})})},{deep:!0}),(c,d)=>{const u=Jo;return t.openBlock(),t.createBlock(t.unref(I.NScrollbar),{style:{width:"auto"},trigger:"none",class:"max-h-[19rem] md:max-h-[40rem] w-auto"},{default:t.withCtx(()=>[t.createElementVNode("div",G1,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.settings.allTemplates,(f,h)=>(t.openBlock(),t.createElementBlock("div",{key:`${f.id}-${h}`,class:"group relative"},[t.createVNode(t.unref(I.NPopover),{trigger:"hover",placement:"right"},{trigger:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["relative h-10 w-24 shrink-0 rounded-md border-2 border-solid border-slate-200",{"!border-green-700":h===n.selectTemplateIndex}]),onClick:p=>a("template:select",h)},[t.createElementVNode("div",Q1,[t.createElementVNode("div",{ref_for:!0,ref:f.isCustom&&f.id!==-1?"drawing-custom-template-containers":"drawing-template-containers",class:"kozyrek-preview h-full"},null,512)])],10,Z1)]),default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(f.label),1)]),_:2},1024),f.isCustom&&!f.isNewRec()?(t.openBlock(),t.createBlock(t.unref(I.NButton),{key:0,size:"tiny",quaternary:"",loading:r.value,disabled:r.value,circle:"",class:"!absolute right-0.5 top-0.5 !hidden group-hover:!flex",onClick:p=>l(h)},{default:t.withCtx(()=>[t.createVNode(u)]),_:1},8,["loading","disabled","onClick"])):t.createCommentVNode("",!0)]))),128))])]),_:1})}}}),Fu=gn(eb,[["__scopeId","data-v-afccb364"]]),tb={class:"flex gap-3 min-w-[20rem] relative"},nb={class:"kozyrek-preview w-fill h-[18rem] grow touch-none overflow-hidden rounded-lg bg-gray-200 p-2"},ib={ref:"drawing-container",class:"size-full"},rb={},Vu=t.defineComponent({...rb,__name:"kozyrek-configurator-preview",props:{settings:{},value:{},selectTemplateIndex:{}},emits:["pointer:move","pointer:up","template:select","remove-custom-template"],setup(n,{emit:e}){const i=n,r=e,o=t.useTemplateRef("drawing-container");let s=[],a=[],l=[],c=null;const d=.75,u=t.computed(()=>i.value.configuratorParams.linesAngles.map((O,A)=>new Vn(i.value.configuratorParams.linesWidths[A],O,`A-${A+1}`))),f=t.computed(()=>i.value.configuratorParams.colorSide==="bottom"),h=t.computed(()=>{var O,A;return i.value.configuratorParams.startTailType&&((O=i.settings.startTailConfigs)!=null&&O[i.value.configuratorParams.startTailType])?(A=i.settings.startTailConfigs)==null?void 0:A[i.value.configuratorParams.startTailType].points:[]}),p=t.computed(()=>{var A;const O=i.value.configuratorParams.endTailType!==void 0&&((A=i.settings.endTailConfigs)==null?void 0:A[i.value.configuratorParams.endTailType]);return!O||!O.points?[]:O.points.map((Y,H)=>Array.isArray(Y)?new Vn(Y[0],Y[1],`A-${H+1}`):new Vn(Y.width,Y.angle,`A-${H+1}`))}),m=(O,A=!1)=>{O[0].start.x=0,O[0].start.y=0;let Y=0;for(let H=0;H<O.length;H++){const T=O[H],D=O[H-1]??new Vn(0,Y);Y+=!A||H>1?D.angle:0;const K=(!A||H>0?T.angle:0)+Y;if(O[H].end.x=T.width*Math.cos(K*Math.PI/180)+O[H].start.x,O[H].end.y=T.width*Math.sin(K*Math.PI/180)+O[H].start.y,H<O.length-1){const J=H+1;O[J].start.x=O[H].end.x,O[J].start.y=O[H].end.y}}return O},g=(O,A,Y,H,T=!1)=>{let D=m([...Y,...H]);A.length>0&&(D=[...m(A),...D]);let K=0,J=0,U=0,q=0;D.forEach(oe=>{K=Math.min(K,oe.start.x,oe.end.x),J=Math.min(J,oe.start.y,oe.end.y),U=Math.max(U,oe.start.x,oe.end.x),q=Math.max(q,oe.start.y,oe.end.y)});let L,le;K===0&&J===0&&U===0&&q===0?(L=1,le=1):(L=O.width/Math.abs(U-K),le=(T?O.height:O.height-Ke.colorSideLabel.size)/Math.abs(q-J));const ue=Math.min(L,le);return K=K<0?-K*ue:0,J=J<0?-J*ue:0,[ue,K,J]},b=O=>{const A=new Ko([O]);return A._size=Ke.anchorPoint.size,A.fill=Ke.anchorPoint.color,A.stroke="transparent",A._linewidth=Ke.anchorPoint.strokeSize,l.push(A),A},y=(O,A)=>{if(l=[],i.settings.allowChangeFirstPoint){const Y=O[0],H=new be(Y.vertices[0].x,Y.vertices[0].y);H.bind(te.Types.change,()=>{Y.vertices[0].copy(H)});const T=b(H);A.add(T)}O.forEach((Y,H)=>{const T=O[H+1],D=new be(Y.vertices[1].x,Y.vertices[1].y);D.bind(te.Types.change,()=>{Y.vertices[1].copy(D),T!==void 0&&T.vertices[0].copy(D)});const K=b(D);A.add(K)})},_=O=>O*(Math.PI/180),x=(O,A,Y)=>{const H=A.vertices.length-1;O.position.x=A.vertices[H].x,O.position.y=A.vertices[H].y;const T=Math.atan2(A.vertices[H].y-A.vertices[0].y,A.vertices[H].x-A.vertices[0].x);O.rotation=_(Y)+T},w=(O,A,Y)=>{if(A.vertices[0]===void 0)return;O.position.x=A.vertices[0].x,O.position.y=A.vertices[0].y;const H=A.vertices.length-1,T=Math.atan2(A.vertices[H].y-A.vertices[0].y,A.vertices[H].x-A.vertices[0].x);O.rotation=_(Y)+T},C=(O,A,Y)=>{const H=new Un;if(O.length===0)return H;const T=[];return[...O].reverse().forEach((D,K)=>{K!==0&&D.angle>0&&(D.angle*=-1),T.push(D)}),O=m(T,!0),w(H,A,O[0].angle),[A.vertices[0],A.vertices[1]].forEach(D=>{D.bind(te.Types.change,()=>{w(H,A,O[0].angle)})}),O.forEach(D=>{const K=D.start.x*Y,J=D.end.x*Y,U=D.start.y*Y,q=D.end.y*Y,L=new Qo(K,U,J,q);L.linewidth=Ke.line.size,L.stroke=Ke.line.color,H.add(L)}),H},N=(O,A,Y)=>{const H=new Un;return O.length===0||(O=m(O,!0),x(H,A,O[0].angle),[A.vertices[0],A.vertices[1]].forEach(T=>{T.bind(te.Types.change,()=>{x(H,A,O[0].angle)})}),O.forEach(T=>{const D=T.start.x*Y,K=T.end.x*Y,J=T.start.y*Y,U=T.end.y*Y,q=new Qo(D,J,K,U);q.linewidth=Ke.line.size,q.stroke=Ke.line.color,H.add(q)})),H},k=(O,A,Y,H)=>{const T=A.vertices[0].x+(A.vertices[1].x-A.vertices[0].x)/2-8*Math.sin(O.angle*Math.PI/180),D=A.vertices[0].y+(A.vertices[1].y-A.vertices[0].y)/2-8*Math.cos(O.angle*Math.PI/180),K=new gr(O.label,T+10,D-10);let J;K.size=Ke.lineLabel.size,K.weight=600,K.fill=Ke.lineLabel.color,K.id+=1,K.rotation=Ke.lineLabel.rotation,H>0&&(J=new gr(`${O.angle}°`,A.vertices[0].x+25,A.vertices[0].y-25),J.size=Ke.angleLabel.size,J.weight=600,J.fill=Ke.angleLabel.color,J.rotation=Ke.angleLabel.rotation,J.id+=H,s.push(J),Y.add(J)),Y.add(K),v(K,A,0,J),v(K,A,1)},$=()=>{const{size:O}=Ke.colorSideLabel,A=0,Y=0,H=f.value?O/2:O/2-O,T=f.value?O/2-O:O/2,D=new Un;if(!c)return D;const K=5,J=Math.atan2(T-H,Y-A),U=[new Ae(A,H,0,0,0,0,En.Commands.move),new Ae(Y,T,0,0,0,0,En.Commands.line),new Ae(Y-K*Math.cos(J-Math.PI/4),T-K*Math.sin(J-Math.PI/4),0,0,0,0,En.Commands.line),new Ae(Y,T,0,0,0,0,En.Commands.move),new Ae(Y-K*Math.cos(J+Math.PI/4),T-K*Math.sin(J+Math.PI/4),0,0,0,0,En.Commands.line)],q=new Oe(U,!1,!1,!0);q.noFill(),q.cap="round",q.join="round",q.linewidth=O/7,q.stroke=Ke.colorSideLabel.color,D.add(q);const L=new gr(f.value?"Цвет снизу":"Цвет сверху",10,0);L.size=O,L.weight=600,L.fill=Ke.colorSideLabel.color,L.alignment="left",D.add(L);const le=D.getBoundingClientRect();return D.position.x=(c.width-le.width)*d+10,D.position.y=f.value?c.height+le.height*2:le.height/2,D},v=(O,A,Y,H)=>{A.vertices[Y].bind(te.Types.change,()=>{const T=A.vertices.length-1,D=Math.atan2(A.vertices[0].y-A.vertices[T].y,A.vertices[0].x-A.vertices[T].x)*180/Math.PI,K=A.vertices[0].x+(A.vertices[T].x-A.vertices[0].x)/2-8*Math.sin(D*Math.PI/180),J=A.vertices[0].y+(A.vertices[T].y-A.vertices[0].y)/2-8*Math.cos(D*Math.PI/180);O.position.x=K+10,O.position.y=J-10,O.rotation=-.5,H&&(H.position.x=A.vertices[0].x+25,H.position.y=A.vertices[0].y-25)})},E=(O,A,Y,H,T=!1)=>{var fe;if(O.clear(),Y.length===0){O.update();return}const D=m(Y),[K,J,U]=g(O,A,D,H,T),q=new Un,L=new Array,le=new Array;T||(s=[],a=[]),D.forEach((ge,_e)=>{const Qe=ge.start.x*K+J,Re=ge.end.x*K+J,Mt=ge.start.y*K+U,vn=ge.end.y*K+U,It=new Qo(Qe,Mt,Re,vn);It.linewidth=T?Ke.previewLine.size:Ke.line.size,It.stroke=T?Ke.previewLine.color:Ke.line.color,a.push(It),L.push(It),q.add(It),!T&&ge.label!==""&&k(ge,It,q,_e)});const ue=L.at(-1);let oe=q.getBoundingClientRect();if(!T){const ge=$();le.push(ge)}if(A.length>0){const ge=C(A,L[0],K);q.add(ge)}if(H.length>0&&ue){const ge=N(H,ue,K);q.add(ge)}if(le.push(q),O.makeGroup(le),oe=q.getBoundingClientRect(),q.position.x=0-oe.left+(O.width-oe.width)/(2*(T?1:d)),q.position.y=0-oe.top+(O.height-oe.height)/(2*(T?1:d)),O.update(),!T){const ge=((fe=i.value.configuratorParams)==null?void 0:fe.colorSide)==="top";q.position.y=q.position.y+Ke.colorSideLabel.size*Number(ge),y(L,q),O.update()}},P=(O,A)=>{if(O&&!A.isNewRec()){const Y=new En({width:O.scrollWidth,height:O.scrollHeight});Y.appendTo(O),E(Y,[],A.points,[],!0)}},F=()=>{c&&E(c,h.value,u.value,p.value,!1)},R=O=>O*(180/Math.PI),M=(O,A)=>{const Y=O[1].x-O[0].x,H=O[1].y-O[0].y,T=A[1].x-A[0].x,D=A[1].y-A[0].y;let K=Math.atan2(Y*D-H*T,Y*T+H*D);return K=R(K),Math.round(K)*-1},X=O=>{const A=a.map((Y,H,T)=>{const D=T[H-1]??{vertices:[{x:-10,y:0},{x:0,y:0}]};let K=Ve.multiplyByStep(Math.ceil(Ve.divideByStep(Y._length/O,i.settings.lineWidthStep)),i.settings.lineWidthStep);const J=s[H-1];K<(T.length>1?i.settings.minLineWidth:i.settings.stripMinWidth)&&(K=T.length>1?i.settings.minLineWidth:i.settings.stripMinWidth),K>i.settings.maxLineWidth&&(K=i.settings.maxLineWidth);const U=M(Y.vertices,D.vertices);return J&&(J.value=`${U}°`),new Vn(K,U,`A-${H+1}`)});r("pointer:move",A)},G=O=>{let A=null,Y;const H=J=>{A=l.find(U=>{const q=U.renderer;return(q==null?void 0:q.elem)===J.target}),[Y]=g(O,h.value,u.value.map(U=>U),p.value)},T=J=>{if(A){const U=A.renderer,q=U==null?void 0:U.elem;if(!q)return;const L=q.getBoundingClientRect();A.vertices[0].x-=L.x-(J instanceof MouseEvent?J.clientX:J.targetTouches[0].clientX)+Ke.anchorPoint.size/2,A.vertices[0].y-=L.y-(J instanceof MouseEvent?J.clientY:J.targetTouches[0].clientY)+Ke.anchorPoint.size/2,X(Y),O.update()}},D=()=>{A&&r("pointer:up",u.value),A=null},K=o.value;K&&(K.addEventListener("touchstart",H,{passive:!0}),K.addEventListener("touchend",D,{passive:!0}),K.addEventListener("mousedown",H),K.addEventListener("mouseup",D),K.addEventListener("mousemove",T),K.addEventListener("touchmove",T,{passive:!0}))},Z=(O,A)=>{r("remove-custom-template",O,A)};return t.onMounted(()=>{o.value&&(c=new En({width:o.value.scrollWidth,height:o.value.scrollHeight,fullscreen:!1}).appendTo(o.value),c.scene.scale=d,c.update(),t.watch(()=>i.value,()=>{F()},{deep:!0,immediate:!0}),G(c))}),t.onBeforeUnmount(()=>{c&&(c.clear(),c=null)}),(O,A)=>(t.openBlock(),t.createElementBlock("div",tb,[t.createVNode(Fu,{"select-template-index":n.selectTemplateIndex,settings:n.settings,"onTemplate:select":A[0]||(A[0]=Y=>r("template:select",Y)),onInitDrawTemplate:P,onRemoveCustomTemplate:Z},null,8,["select-template-index","settings"]),t.createElementVNode("div",nb,[t.createElementVNode("div",ib,null,512)])]))}});class yr extends W.Identity{constructor(i,r){super();B(this,"label","");B(this,"points",[]);B(this,"isCustom",!1);B(this,"id",-1);B(this,"guid","");i?(this.label=i.label,this.points=i.points.map((o,s)=>V.isArray(o)?new Vn(o[0],o[1],`A-${s+1}`):new Vn(o.width,o.angle,`A-${s+1}`)),this.isCustom=i.isCustom):(this.label="-- Новая конфигурация --",this.points=[new Vn(0,0,"A-1")],this.isCustom=!0,this.id=r??this.id)}}class Ia extends yr{constructor(i){super(i);B(this,"isDefault");this.isDefault=i.isDefault??!1}}class Mu{constructor(e){B(this,"minLineWidth");B(this,"maxLineWidth");B(this,"lineWidthStep");B(this,"minLineAngle");B(this,"maxLineAngle");B(this,"lineAngleStep");B(this,"stripMinWidth");B(this,"stripMaxWidth");B(this,"stripMinLength");B(this,"stripMaxLength");B(this,"allowShowTable");B(this,"showOnlyTemplates");B(this,"templates");B(this,"customTemplates",[]);B(this,"startTailConfigs");B(this,"endTailConfigs");B(this,"bendCountForExtended");B(this,"extendedProductCatalog");B(this,"allowChangeFirstPoint");B(this,"allowSaveTemplates");B(this,"userTemplatesPrefix");B(this,"lengthStep");B(this,"canSetDopProdaga");var i,r;this.minLineWidth=e.minLineWidth,this.maxLineWidth=e.maxLineWidth,this.lineWidthStep=e.lineWidthStep,this.minLineAngle=e.minLineAngle,this.maxLineAngle=e.maxLineAngle,this.lineAngleStep=e.lineAngleStep,this.stripMinWidth=e.stripMinWidth,this.stripMaxWidth=e.stripMaxWidth,this.stripMinLength=e.stripMinLength,this.stripMaxLength=e.stripMaxLength,this.allowShowTable=e.allowShowTable,this.showOnlyTemplates=e.showOnlyTemplates,this.templates=e.templates.map(o=>new yr(o)),this.templates.forEach((o,s)=>{o.id=s}),this.startTailConfigs=((i=e.startTailConfigs)==null?void 0:i.map(o=>new Ia(o)))??[],this.endTailConfigs=((r=e.endTailConfigs)==null?void 0:r.map(o=>new Ia(o)))??[],this.bendCountForExtended=e.bendCountForExtended,this.extendedProductCatalog=e.extendedProductCatalog,this.allowChangeFirstPoint=e.allowChangeFirstPoint,this.allowSaveTemplates=e.allowSaveTemplates,this.userTemplatesPrefix=e.userTemplatesPrefix,this.lengthStep=e.lengthStep,this.canSetDopProdaga=e.canSetDopProdaga,this.showOnlyTemplates||(this.customTemplates=e.customTemplates?Object.entries(e.customTemplates).filter(([,o])=>o.id!==-1).map(([o,s])=>{const a=new yr(s);return a.isCustom=!0,a.id=+o,a}):[],this.customTemplates.some(o=>o.isCustom&&o.isNewRec())||this.customTemplates.push(new yr({label:"-- Новая конфигурация --",points:[new Vn(this.stripMinWidth,0,"A-1")],isCustom:!0,id:-1,guid:""})))}get allTemplates(){return[...this.templates,...this.customTemplates]}addCustomTemplate(e){if(!this.allowSaveTemplates)return;const i=this.customTemplates.findLast(o=>!o.isNewRec()),r=new yr(e);r.isCustom=!0,r.id=i?i.id+1:0,this.customTemplates.splice(-1,0,r)}removeCustomTemplate(e){if(!this.allowSaveTemplates)return;const i=this.customTemplates.findIndex(r=>r.id===e);i!==-1&&this.customTemplates.splice(i,1)}}const ob={class:"flex flex-col gap-3"},sb={class:"grid gap-5 md:grid-cols-5"},ab={},Iu=t.defineComponent({...ab,__name:"kozyrek-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showProductInfoButton:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{type:Function},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{type:Function},settings:{},cartItem:{}},emits:["submit","click:view-switch"],setup(n,{emit:e}){const i=n,r=e,o=t.ref(!1),s=t.ref(!1),a=t.ref(!1),l=t.ref(i.cartItem),c=t.ref(new Mu(i.settings)),d=t.ref({linesWidths:[...i.cartItem.configuratorParams.linesWidths],linesAngles:[...i.cartItem.configuratorParams.linesAngles]}),u=t.ref({quantity:{},marker:{},length:{}}),f=t.ref(0),h=t.useTemplateRef("kozyrek-configurator-params-form"),p=(v=0)=>{var P;const E=(P=c.value.allTemplates)==null?void 0:P.at(v);E!==void 0&&(f.value=v,l.value.configuratorParams.linesWidths=E.points.map(F=>V.isArray(F)?F[0]:F.width),l.value.configuratorParams.linesAngles=E.points.map(F=>V.isArray(F)?F[1]:F.angle),x()),y(l.value.configuratorParams)},m=async()=>{const v=prompt("Введите название шаблона:");if(!v)return;a.value=!0;const E={label:v,points:l.value.configuratorParams.linesWidths.map((F,R)=>[F,l.value.configuratorParams.linesAngles[R]])},P=F=>{F&&(c.value.addCustomTemplate(E),f.value=c.value.allTemplates.length-2),a.value=!1};i.eventEmitter.emit("configurator:create-template",{category:i.cartItem.category,template:E,callback:P})},g=async(v,E)=>{var R;const P=(R=c.value.allTemplates)==null?void 0:R.at(v);if(!P||!P.isCustom)return;const F=M=>{M&&(c.value.removeCustomTemplate(P.id),p()),E==null||E()};i.eventEmitter.emit("configurator:remove-template",{category:i.cartItem.category,templateId:P.id,callback:F})},b=()=>{c.value.showOnlyTemplates||c.value.allowSaveTemplates&&(f.value=c.value.allTemplates.length-1)},y=async v=>{var E,P;l.value.product=new W.ClientProduct,(P=(E=h.value)==null?void 0:E.formReference)==null||P.validate(F=>{F||(x(),o.value=!0,i.eventEmitter.emit("configurator:search-product",{category:i.cartItem.category,params:v,validationFieldResultData:u.value,callback:R=>{R?l.value.product=R:u.value.product={showFeedback:!0,feedback:"Не удалось найти товар по указанным параметрам.",validationStatus:"error"},o.value=!1}}))}).catch(V.noop)},_=async()=>{var v,E;(E=(v=h.value)==null?void 0:v.formReference)==null||E.validate(P=>{var F,R;if(!P){s.value=!0;const M=new W.OrderItemBase(l.value);(F=c.value.startTailConfigs)!=null&&F.length||delete M.configuratorParams.startTailType,(R=c.value.endTailConfigs)!=null&&R.length||delete M.configuratorParams.endTailType,r("submit",M,u.value,()=>{s.value=!1,t.nextTick(()=>{var X,G;(G=(X=h.value)==null?void 0:X.formReference)==null||G.restoreValidation()})})}}).catch(V.noop)},x=()=>{const v={quantity:u.value.quantity,marker:u.value.marker};l.value.configuratorParams.linesWidths.forEach((E,P)=>{v[`lines_widths[${P+1}]`]={},v[`lines_angles[${P+1}]`]={}}),u.value=v},w=v=>{d.value.linesWidths=v.map(E=>E.width),d.value.linesAngles=v.map(E=>E.angle)},C=v=>{l.value.configuratorParams.linesWidths=d.value.linesWidths,l.value.configuratorParams.linesAngles=d.value.linesAngles,x(),b(),y(l.value.configuratorParams)},N=(v,E)=>{d.value.linesWidths=v,d.value.linesAngles=E},k=v=>{const E=l.value.configuratorParams.linesWidths.length>1?c.value.minLineWidth:c.value.stripMinWidth,P=0;l.value.configuratorParams.linesWidths.splice(v+1,0,E),l.value.configuratorParams.linesAngles.splice(v+1,0,P),d.value.linesWidths=[...l.value.configuratorParams.linesWidths],d.value.linesAngles=[...l.value.configuratorParams.linesAngles],x(),b(),y(l.value.configuratorParams)},$=v=>{l.value.configuratorParams.linesWidths.length<=1||(l.value.configuratorParams.linesWidths.splice(v,1),l.value.configuratorParams.linesAngles.splice(v,1),d.value.linesWidths=[...l.value.configuratorParams.linesWidths],d.value.linesAngles=[...l.value.configuratorParams.linesAngles],x(),b(),y(l.value.configuratorParams))};return t.onMounted(()=>{i.cartItem.isNewRec()?p():(x(),f.value=-1,y(l.value.configuratorParams))}),t.watch(()=>i.cartItem,v=>{l.value=new W.OrderItemBase(v),v.isNewRec()?p():(x(),f.value=-1,y(l.value.configuratorParams))}),(v,E)=>{const P=I.NButton;return t.openBlock(),t.createElementBlock("div",ob,[n.settings.allowShowTable?(t.openBlock(),t.createBlock(P,{key:0,type:"tertiary",class:"self-end",onClick:E[0]||(E[0]=F=>r("click:view-switch"))},{default:t.withCtx(()=>[...E[3]||(E[3]=[t.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):t.createCommentVNode("",!0),t.createElementVNode("div",sb,[t.createVNode(Vu,{value:l.value,"select-template-index":f.value,settings:c.value,class:"h-fit col-span-3","onPointer:up":C,"onPointer:move":w,"onTemplate:select":p,onRemoveCustomTemplate:g},null,8,["value","select-template-index","settings"]),t.createVNode(mc,{ref:"kozyrek-configurator-params-form",value:l.value,"onUpdate:value":E[1]||(E[1]=F=>l.value=F),"preview-params":d.value,validation:u.value,settings:c.value,"is-submit-processing":s.value,"is-product-searching":o.value,"select-template-index":f.value,class:"col-span-2","onUpdate:params":E[2]||(E[2]=F=>y(F)),"onUpdate:preview":N,onSubmit:_,"onClick:saveTemplate":m,"onClick:addLine":k,"onClick:removeLine":$},null,8,["value","preview-params","validation","settings","is-submit-processing","is-product-searching","select-template-index"])])])}}}),lb={class:"flex flex-col items-center justify-between rounded-xl"},cb={class:"img-preview relative flex justify-center"},db={},ub=t.defineComponent({...db,__name:"mosquito-configurator-preview",props:{configuratorParams:{},settings:{}},emits:["open-instructions"],setup(n,{emit:e}){const i=n,r=t.computed(()=>{const{height:s}=i.configuratorParams;return V.keys(i.settings.crossbarCount).reverse().find(a=>s>=i.settings.crossbarCount[Number(a)])}),o=e;return(s,a)=>{const l=I.NButton;return t.openBlock(),t.createElementBlock("div",lb,[t.createElementVNode("div",cb,[a[1]||(a[1]=t.createElementVNode("div",{class:"window"},null,-1)),t.createElementVNode("div",{class:t.normalizeClass(["net",`net-${n.configuratorParams.netType}`])},null,2),t.createElementVNode("div",{class:t.normalizeClass(["frame",`frame-${n.configuratorParams.color}`])},null,2),r.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["frame-crossbar",`frame-crossbar-${r.value}-${n.configuratorParams.color}`])},null,2)):t.createCommentVNode("",!0),t.createElementVNode("div",{class:t.normalizeClass(["mount",`mount-${n.configuratorParams.mountType}-${n.configuratorParams.color}`])},null,2),t.createElementVNode("div",{class:t.normalizeClass(["cut-preview",`cut-preview-${n.configuratorParams.mountType}-${n.configuratorParams.color}`])},null,2)]),t.createVNode(l,{type:"primary",class:"block justify-self-center",onClick:a[0]||(a[0]=c=>o("open-instructions"))},{default:t.withCtx(()=>[...a[2]||(a[2]=[t.createTextVNode(" Руководство по замеру ",-1)])]),_:1})])}}}),Aa=gn(ub,[["__scopeId","data-v-2a790a20"]]),fb={key:0,class:"flex items-baseline gap-1"},hb={key:0,class:"flex items-baseline gap-1"},mb={key:1},pb={class:"text-lg font-semibold"},gb={key:2,class:"text-red-500 text-sm mb-2"},yb={class:"flex gap-3"},bb={},Au=t.defineComponent({...bb,__name:"mosquito-configurator-form",props:{value:{},settings:{},isProductSearching:{type:Boolean,default:!1},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0}},emits:["update:value","update:params","submit","click:instructions-toggle","click:show-preview-drawer"],setup(n,{expose:e,emit:i}){var k;const r=n,o=i,s=t.computed(()=>Ue.isPhoneDevice()),a=t.useTemplateRef("form-reference"),l=t.useTemplateRef("width-form-item-reference"),c=t.useTemplateRef("height-form-item-reference"),d=t.useTemplateRef("width-input-reference"),u=t.ref(V.cloneDeep(r.value)),f=t.computed(()=>r.settings.widthOverlaps[u.value.configuratorParams.mountType]??0),h=t.computed(()=>r.settings.heightOverlaps[u.value.configuratorParams.mountType]??0),p=t.computed(()=>r.settings.maxWidths[u.value.configuratorParams.netType]),m=t.computed(()=>r.settings.maxHeights[u.value.configuratorParams.netType]),g=t.computed(()=>u.value.configuratorParams.width?u.value.configuratorParams.width+f.value:0),b=t.computed(()=>u.value.configuratorParams.height?u.value.configuratorParams.height+h.value:0),y=t.ref(r.settings.canSetDopProdaga??!1),_=t.computed(()=>({"configuratorParams.width":[ce.required,ce.min(r.settings.minWidth-f.value),ce.max(p.value-f.value),ce.step(1),We.serverValidation(r.validation.width.feedback)],"configuratorParams.height":[ce.required,ce.min(r.settings.minHeight-h.value),ce.max(m.value-h.value),ce.step(1),We.serverValidation(r.validation.height.feedback)],quantity:[ce.required,ce.min(1),ce.step(1),We.serverValidation(r.validation.quantity.feedback)],marker:[We.serverValidation(r.validation.marker.feedback)]})),x=t.computed(()=>{var R;const $=g.value,v=b.value,{quantity:E}=r.value,P=((R=r.value.product)==null?void 0:R.costRub)||0;if(!$||!v||!E||P===0)return null;const F=$*v/1e6;return Ve.formatMoney(P*E*F)}),w=t.computed(()=>{const $=g.value,v=b.value,E=!!($&&$>=r.settings.minWidth&&$<=r.settings.maxWidths[u.value.configuratorParams.netType]),P=!!(v&&v>=r.settings.minHeight&&v<=r.settings.maxHeights[u.value.configuratorParams.netType]),F=!!(r.value.quantity&&r.value.quantity>0);return E&&P&&F}),C=($,v)=>{var F,R;const E=u.value.configuratorParams;$&&$ in E&&(E[$]=v);const P={...E,width:g.value??0,height:b.value??0};$==="width"&&((F=l.value)==null||F.validate().catch(V.noop)),$==="height"&&((R=c.value)==null||R.validate().catch(V.noop)),t.nextTick(()=>{var X,G;!((X=l.value)!=null&&X.validationErrored)&&!((G=c.value)!=null&&G.validationErrored)&&P.height&&P.width&&o("update:params",P),N("configuratorParams",P)})},N=($,v)=>{const E=new W.OrderItemBase(r.value);E[$]=v,$==="configuratorParams"&&(E.product=new W.ClientProduct),o("update:value",E)};return t.watch(()=>r.value,$=>{const v=V.cloneDeep(t.toRaw($)),E=v.configuratorParams.mountType,P=r.settings.widthOverlaps[E]??0,F=r.settings.heightOverlaps[E]??0;v.configuratorParams.width&&v.configuratorParams.width>0&&(v.configuratorParams.width-=P),v.configuratorParams.height&&v.configuratorParams.height>0&&(v.configuratorParams.height-=F),u.value=v},{deep:!0,immediate:!0}),t.onMounted(()=>{var $;($=d.value)==null||$.select()}),e({validate:(k=a.value)==null?void 0:k.validate,formReference:a}),($,v)=>{const E=I.NCheckbox;return t.withDirectives((t.openBlock(),t.createBlock(t.unref(I.NForm),{ref:"form-reference",model:u.value,rules:_.value,class:"flex flex-col gap-2 px-4 md:max-w-96 sc-hide-empty-feedback-message"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NFormItem),{required:!0,"show-feedback":!1,label:"Тип сетки"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NSelect),{value:u.value.configuratorParams.netType,"onUpdate:value":[v[0]||(v[0]=P=>u.value.configuratorParams.netType=P),v[1]||(v[1]=P=>C("netType",P))],options:n.settings.netType.map(P=>({label:n.settings.descriptions.net_type[P],value:P}))},null,8,["value","options"])]),_:1}),t.createVNode(t.unref(I.NFormItem),{required:!0,"show-feedback":!1,label:"Цвет профиля"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NSelect),{value:u.value.configuratorParams.color,"onUpdate:value":[v[2]||(v[2]=P=>u.value.configuratorParams.color=P),v[3]||(v[3]=P=>C("color",P))],options:n.settings.color.map(P=>({label:n.settings.descriptions.color[P],value:P}))},null,8,["value","options"])]),_:1}),t.createVNode(t.unref(I.NFormItem),{required:!0,"show-feedback":!1,label:"Вид крепления"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NSelect),{value:u.value.configuratorParams.mountType,"onUpdate:value":[v[4]||(v[4]=P=>u.value.configuratorParams.mountType=P),v[5]||(v[5]=P=>C("mountType",P))],options:n.settings.mountType.map(P=>({label:n.settings.descriptions.mount_type[P],value:P}))},null,8,["value","options"])]),_:1}),t.createVNode(t.unref(I.NFormItem),{ref:"width-form-item-reference",path:"configuratorParams.width",label:`Ширина светового проёма от ${n.settings.minWidth-f.value} ${p.value?" до "+(p.value-f.value):""} мм.`},{feedback:t.withCtx(()=>[!n.validation.width.showFeedback&&g.value>=n.settings.minWidth&&g.value<=n.settings.maxWidths[u.value.configuratorParams.netType]?(t.openBlock(),t.createElementBlock("div",fb,[t.createVNode(t.unref(I.NText),{type:"success"},{default:t.withCtx(()=>[t.createTextVNode("Ширина готового изделия "+t.toDisplayString(g.value),1)]),_:1}),t.createVNode(t.unref(I.NButton),{quaternary:"",type:"info",size:"tiny",onClick:v[10]||(v[10]=P=>o("click:instructions-toggle"))},{default:t.withCtx(()=>[...v[25]||(v[25]=[t.createElementVNode("span",{class:"text-sm"},"Руководство",-1)])]),_:1})])):t.createCommentVNode("",!0)]),default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{ref:"width-input-reference",value:u.value.configuratorParams.width,"onUpdate:value":[v[6]||(v[6]=P=>u.value.configuratorParams.width=P),v[9]||(v[9]=P=>C("width",P))],parse:t.unref(ht),"show-button":!1,placeholder:"Введите высоту светового проёма",class:"w-full",onKeydown:v[7]||(v[7]=P=>t.unref(ft)(P)),onInput:v[8]||(v[8]=P=>t.unref(dt)(n.validation,"width")),onFocus:t.unref(He)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),t.createVNode(t.unref(I.NFormItem),{ref:"height-form-item-reference",path:"configuratorParams.height",label:`Высота светового проёма от ${n.settings.minHeight-h.value} ${m.value?" до "+(m.value-h.value):""} мм.`},{feedback:t.withCtx(()=>[!n.validation.height.showFeedback&&b.value>=n.settings.minHeight&&b.value<=n.settings.maxHeights[u.value.configuratorParams.netType]?(t.openBlock(),t.createElementBlock("div",hb,[t.createVNode(t.unref(I.NText),{type:"success"},{default:t.withCtx(()=>[t.createTextVNode("Высота готового изделия "+t.toDisplayString(b.value),1)]),_:1}),t.createVNode(t.unref(I.NButton),{quaternary:"",type:"info",size:"tiny",onClick:v[15]||(v[15]=P=>o("click:instructions-toggle"))},{default:t.withCtx(()=>[...v[26]||(v[26]=[t.createElementVNode("span",{class:"text-sm"},"Руководство",-1)])]),_:1})])):t.createCommentVNode("",!0)]),default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:u.value.configuratorParams.height,"onUpdate:value":[v[11]||(v[11]=P=>u.value.configuratorParams.height=P),v[14]||(v[14]=P=>C("height",P))],parse:t.unref(ht),"show-button":!1,placeholder:"Введите высоту светового проёма",class:"w-full",onKeydown:v[12]||(v[12]=P=>t.unref(ft)(P)),onInput:v[13]||(v[13]=P=>t.unref(dt)(n.validation,"height")),onFocus:t.unref(He)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),t.createVNode(t.unref(I.NFormItem),{path:"quantity",label:"Количество"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:u.value.quantity,"onUpdate:value":[v[16]||(v[16]=P=>u.value.quantity=P),v[19]||(v[19]=P=>N("quantity",P??0))],"show-button":!1,placeholder:"Введите количество",class:"w-full",onKeydown:v[17]||(v[17]=P=>t.unref(ft)(P,!1)),onInput:v[18]||(v[18]=P=>t.unref(dt)(n.validation,"quantity")),onFocus:t.unref(He)},null,8,["value","onFocus"])]),_:1}),t.createVNode(t.unref(I.NFormItem),{path:"marker",label:"Маркировка"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInput),{value:u.value.marker??null,placeholder:"Введите маркировку",onInput:v[20]||(v[20]=P=>t.unref(dt)(n.validation,"marker")),"onUpdate:value":v[21]||(v[21]=P=>{u.value.marker=P??null,N("marker",P??null)}),onFocus:t.unref(He)},null,8,["value","onFocus"])]),_:1}),y.value?(t.openBlock(),t.createBlock(E,{key:0,checked:u.value.isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":v[22]||(v[22]=P=>{u.value.isAdditionalSale=P??!1,N("isAdditionalSale",P??!1)})},{default:t.withCtx(()=>[...v[27]||(v[27]=[t.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):t.createCommentVNode("",!0),t.createVNode(Fr,{"is-product-searching":n.isProductSearching,product:u.value.product,validation:n.validation.product},null,8,["is-product-searching","product","validation"]),x.value?(t.openBlock(),t.createElementBlock("div",mb,[v[28]||(v[28]=t.createTextVNode(" ИТОГО: ",-1)),t.createElementVNode("span",pb,t.toDisplayString(x.value)+" ₽",1)])):t.createCommentVNode("",!0),w.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",gb," Пожалуйста, заполните все обязательные поля корректно. ")),t.createElementVNode("div",yb,[t.createVNode(t.unref(I.NButton),{loading:n.isSubmitProcessing,disabled:!w.value||u.value.product.isNewRec(),type:"primary",class:"self-start",onClick:v[23]||(v[23]=P=>o("submit",n.value))},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(n.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["loading","disabled"]),s.value?(t.openBlock(),t.createBlock(t.unref(I.NButton),{key:0,type:"default",onClick:v[24]||(v[24]=P=>o("click:show-preview-drawer"))},{default:t.withCtx(()=>[...v[29]||(v[29]=[t.createTextVNode(" Предварительный просмотр ",-1)])]),_:1})):t.createCommentVNode("",!0)])]),_:1},8,["model","rules"])),[[t.unref(ai),()=>o("submit",u.value)]])}}}),_b="/img/configurators/mosquitto/measurement-instructions/measurement-height.png",wb="/img/configurators/mosquitto/measurement-instructions/measurement-width.png",xb="/img/configurators/mosquitto/measurement-instructions/mount.png",kb="/img/configurators/mosquitto/measurement-instructions/mount-z-plastic.png",Cb="/img/configurators/mosquitto/measurement-instructions/mount-z-metal.png",vb={class:"flex flex-col gap-6"},Sb={class:"flex gap-4"},Bb={class:"flex flex-col gap-2"},Nb={class:"flex gap-4"},Tb={class:"flex flex-col gap-2"},$b={class:"flex gap-4"},Eb={class:"flex flex-col gap-2"},Rb={},Ou=t.defineComponent({...Rb,__name:"mosquito-configurator-measurement-instructions",props:{heightOverlaps:{},widthOverlaps:{},show:{type:Boolean}},emits:["update:show"],setup(n,{emit:e}){const i=Ue.initRefDependingOnDeviceResolution("small","small","medium"),r=Ue.initRefDependingOnDeviceResolution(.98,.95,.8),o=t.computed(()=>window.innerWidth*r.value),s=e;return(a,l)=>{const c=I.NText;return t.openBlock(),t.createBlock(t.unref(I.NModal),{show:n.show,"show-icon":!1,size:t.unref(i),style:t.normalizeStyle(`width: ${o.value}px`),title:"Руководство по замеру","action-class":"grid grid-cols-2 !justify-between",preset:"dialog",onClose:l[0]||(l[0]=d=>s("update:show",!1)),onEsc:l[1]||(l[1]=d=>s("update:show",!1)),onMaskClick:l[2]||(l[2]=d=>s("update:show",!1))},{default:t.withCtx(()=>[t.createElementVNode("div",vb,[t.createVNode(c,{type:"error",class:"text-base font-medium"},{default:t.withCtx(()=>[...l[3]||(l[3]=[t.createTextVNode(" Важно! Для того,что бы произвести замер, необходимо открыть оконную створку. ",-1)])]),_:1}),l[22]||(l[22]=t.createElementVNode("div",{class:"grid gap-6 md:grid-cols-2"},[t.createElementVNode("div",{class:"flex items-start gap-4"},[t.createElementVNode("img",{src:_b,alt:"measurement-height",class:"w-[7.5rem]"}),t.createElementVNode("div",{class:"flex flex-col gap-2"},[t.createElementVNode("span",{class:"text-lg font-bold"},"Замер ширины"),t.createElementVNode("span",null,"Замерить по ширине световой проем оконной рамы. Размер учитывать c точностью до 1 мм")])]),t.createElementVNode("div",{class:"flex items-start gap-4"},[t.createElementVNode("img",{src:wb,alt:"measurement-height",class:"w-[7.5rem]"}),t.createElementVNode("div",{class:"flex flex-col gap-2"},[t.createElementVNode("span",{class:"text-lg font-bold"},"Замер высоты"),t.createElementVNode("span",null,"Замерить по высоте световой проем оконной рамы. Размер учитывать с точностью до 1 мм")])])],-1)),t.createElementVNode("div",Sb,[l[9]||(l[9]=t.createElementVNode("img",{src:xb,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),t.createElementVNode("div",Bb,[l[8]||(l[8]=t.createElementVNode("span",{class:"text-lg font-bold"},"Крепление на раме сетки",-1)),t.createElementVNode("span",null,[l[4]||(l[4]=t.createTextVNode(" Расчетные размеры москитной сетки: ",-1)),l[5]||(l[5]=t.createElementVNode("br",null,null,-1)),t.createTextVNode(" Ширина светового проема +"+t.toDisplayString(n.widthOverlaps.frame)+" мм. Высота светового проема +"+t.toDisplayString(n.heightOverlaps.frame)+" мм. ",1),l[6]||(l[6]=t.createElementVNode("br",null,null,-1)),l[7]||(l[7]=t.createTextVNode(" Крепления находятся на раме сетки. ",-1))])])]),t.createElementVNode("div",Nb,[l[15]||(l[15]=t.createElementVNode("img",{src:kb,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),t.createElementVNode("div",Tb,[l[14]||(l[14]=t.createElementVNode("span",{class:"text-lg font-bold"},"Z-Образное крепление пластик (верх+низ)",-1)),t.createElementVNode("span",null,[l[10]||(l[10]=t.createTextVNode(" Расчетные размеры москитной сетки:",-1)),l[11]||(l[11]=t.createElementVNode("br",null,null,-1)),t.createTextVNode(" Ширина светового проема +"+t.toDisplayString(n.widthOverlaps.external_plastic)+" мм. Высота светового проема +"+t.toDisplayString(n.heightOverlaps.external_plastic)+" мм. ",1),l[12]||(l[12]=t.createElementVNode("br",null,null,-1)),l[13]||(l[13]=t.createTextVNode(" Крепления прикручиваются к раме окна c помощью шурупов. ",-1))])])]),t.createElementVNode("div",$b,[l[21]||(l[21]=t.createElementVNode("img",{src:Cb,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),t.createElementVNode("div",Eb,[l[20]||(l[20]=t.createElementVNode("span",{class:"text-lg font-bold"},"Z-Образное крепление металл (верх+низ)",-1)),t.createElementVNode("span",null,[l[16]||(l[16]=t.createTextVNode(" Расчетные размеры москитной сетки: ",-1)),l[17]||(l[17]=t.createElementVNode("br",null,null,-1)),t.createTextVNode(" Ширина светового проема +"+t.toDisplayString(n.widthOverlaps.external_metal)+" мм. Высота светового проема +"+t.toDisplayString(n.heightOverlaps.external_metal)+" мм. ",1),l[18]||(l[18]=t.createElementVNode("br",null,null,-1)),l[19]||(l[19]=t.createTextVNode(" Крепления прикручиваются к раме окна c помощью шурупов. ",-1))])])])])]),_:1},8,["show","size","style"])}}}),Pb={class:"grid md:grid-cols-2"},Fb={},zu=t.defineComponent({...Fb,__name:"mosquito-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showProductInfoButton:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{type:Function},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{type:Function},settings:{},cartItem:{}},emits:["submit","click:view-switch"],setup(n,{emit:e}){const i=n,r=e,o=t.computed(()=>Ue.isPhoneDevice()),s=t.ref(!1),a=t.ref(!1),l=t.ref(i.cartItem),c=t.useTemplateRef("mosquito-configurator-form"),d=t.ref({width:{},height:{},quantity:{},marker:{}}),u=t.ref(!1),f=t.ref(!1),h=t.computed(()=>t.inject("debounce-input-time",300)),p=V.debounce(async g=>{var b,y;l.value.product=new W.ClientProduct,(y=(b=c.value)==null?void 0:b.formReference)==null||y.validate(_=>{_||(u.value=!0,i.eventEmitter.emit("configurator:search-product",{category:i.cartItem.category,params:g,validationFieldResultData:d.value,callback:x=>{x?l.value.product=x:d.value.product={showFeedback:!0,feedback:"Не удалось найти товар по указанным параметрам.",validationStatus:"error"},u.value=!1}}))}).catch(V.noop)},h.value),m=()=>{f.value=!0,r("submit",l.value,d.value,()=>{f.value=!1})};return t.watch(()=>i.cartItem,g=>{l.value=g},{deep:!0}),(g,b)=>{const y=Jo;return t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createVNode(Ou,{show:a.value,"onUpdate:show":b[0]||(b[0]=_=>a.value=_),"height-overlaps":n.settings.heightOverlaps,"width-overlaps":n.settings.widthOverlaps},null,8,["show","height-overlaps","width-overlaps"]),t.createElementVNode("div",Pb,[o.value?(t.openBlock(),t.createBlock(t.unref(I.NDrawer),{key:1,show:s.value,"onUpdate:show":b[4]||(b[4]=_=>s.value=_),"default-width":375,resizable:""},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NDrawerContent),null,{header:t.withCtx(()=>[t.createVNode(t.unref(I.NButton),{size:"small",type:"primary",class:"block justify-self-end",onClick:b[2]||(b[2]=_=>s.value=!1)},{default:t.withCtx(()=>[t.createVNode(y)]),_:1})]),default:t.withCtx(()=>[t.createVNode(Aa,{"configurator-params":l.value.configuratorParams,settings:n.settings,onOpenInstructions:b[3]||(b[3]=_=>a.value=!0)},null,8,["configurator-params","settings"])]),_:1})]),_:1},8,["show"])):(t.openBlock(),t.createBlock(Aa,{key:0,"configurator-params":l.value.configuratorParams,settings:n.settings,onOpenInstructions:b[1]||(b[1]=_=>a.value=!0)},null,8,["configurator-params","settings"])),t.createVNode(Au,{ref:"mosquito-configurator-form",value:l.value,"onUpdate:value":b[5]||(b[5]=_=>l.value=_),validation:d.value,settings:n.settings,"is-product-searching":u.value,"is-submit-processing":f.value,"onUpdate:params":b[6]||(b[6]=_=>t.unref(p)(_)),onSubmit:b[7]||(b[7]=_=>m()),"onClick:instructionsToggle":b[8]||(b[8]=_=>a.value=!a.value),"onClick:showPreviewDrawer":b[9]||(b[9]=_=>s.value=!0)},null,8,["value","validation","settings","is-product-searching","is-submit-processing"])])],64)}}}),Vb={},Du=t.defineComponent({...Vb,__name:"strip-configurator-line-item",props:{value:{},index:{},path:{},settings:{},product:{default:void 0},addLineButtonDisabled:{type:Boolean,default:!1},removeLineButtonDisabled:{type:Boolean,default:!1},suggestionOption:{default:void 0},autoFocus:{type:Boolean,default:!1},isLastLine:{type:Boolean,default:!1},validation:{}},emits:["update:value","click:add-line","click:remove-line"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.useTemplateRef("width-input-element"),a=t.ref(!1),l=t.ref(r.value),c=t.useTemplateRef("form-item-reference"),d=t.computed(()=>{var p;return!((p=c.value)!=null&&p.validationErrored)}),u=p=>{l.value=p,o("update:value",p,r.index,a)},f=p=>{ft(p),(p.key==="Enter"||p.code==="Enter")&&!r.isLastLine&&(p.preventDefault(),p.stopPropagation())},h=()=>{var p;(p=s.value)==null||p.select()};return t.watch(()=>r.value,p=>{l.value=p}),t.onMounted(()=>{r.autoFocus&&t.nextTick(()=>{h()})}),e({isValid:d,formItemReference:c}),(p,m)=>{const g=hc,b=yo;return t.openBlock(),t.createBlock(t.unref(I.NFormItem),{ref:"form-item-reference",path:n.path,label:`Полоса №${n.index+1}, мм`,class:"sc-hide-empty-feedback-message"},{feedback:t.withCtx(()=>[d.value?(t.openBlock(),t.createBlock(Fr,{key:0,"is-product-searching":a.value,product:n.product,validation:n.validation.product},null,8,["is-product-searching","product","validation"])):t.createCommentVNode("",!0)]),default:t.withCtx(()=>[t.createVNode(t.unref(I.NDropdown),{trigger:"click",options:n.suggestionOption,placement:"bottom-start",size:"large",onSelect:u},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{ref:"width-input-element",value:l.value??null,class:"w-full","show-button":!1,parse:t.unref(ht),placeholder:"Введите ширину",onKeydown:f,onInput:m[0]||(m[0]=y=>t.unref(dt)(n.validation,`linesWidths.${n.index}`)),onFocus:t.unref(He),"onUpdate:value":u},null,8,["value","parse","onFocus"])]),_:1},8,["options"]),t.createVNode(t.unref(I.NButton),{disabled:n.addLineButtonDisabled,size:"medium",class:"ml-2",onClick:m[1]||(m[1]=y=>o("click:add-line",n.index))},{default:t.withCtx(()=>[t.createVNode(g)]),_:1},8,["disabled"]),t.createVNode(t.unref(I.NButton),{disabled:n.removeLineButtonDisabled,size:"medium",class:"ml-2",onClick:m[2]||(m[2]=y=>o("click:remove-line",n.index))},{default:t.withCtx(()=>[t.createVNode(b)]),_:1},8,["disabled"])]),_:1},8,["path","label"])}}}),Mb={class:"my-2 flex w-full flex-col"},Ib={key:1},Ab={class:"text-lg font-semibold"},Ob={class:"flex gap-3"},zb={},Lu=t.defineComponent({...zb,__name:"strip-configurator-form",props:{value:{},settings:{},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0}},emits:["update:value","update:params","submit","click:add-line","click:remove-line"],setup(n,{expose:e,emit:i}){var _;const r=n,o=i,s=t.useTemplateRef("form-reference"),a=t.useTemplateRef("line-items-reference"),l=t.ref(V.cloneDeep(r.value)),c=t.computed(()=>{const x={length:[ce.required,ce.min(r.settings.minLength),ce.max(r.settings.maxLength),ce.step(r.settings.lengthStep),We.serverValidation(r.validation.length.feedback)],quantity:[ce.required,ce.min(1),We.serverValidation(r.validation.quantity.feedback)],marker:[We.serverValidation(r.validation.marker.feedback)]};return V.forEach(l.value,(w,C)=>{var N;x[`configuratorParams.linesWidths.${C}`]=[ce.required,ce.min(r.settings.minLineWidth),ce.step(r.settings.lineWidthStep),We.serverValidation((N=r.validation[`linesWidths.${C}`])==null?void 0:N.feedback)]}),x}),d=t.ref(r.settings.canSetDopProdaga??!1),u=t.computed(()=>r.value[0].configuratorParams.linesWidths.reduce((x,w)=>(x??0)+(w??0),0)),f=t.computed(()=>r.settings.width-u.value),h=t.computed(()=>!r.value.some(({product:x})=>!x||x.isNewRec())),p=t.computed(()=>r.isSubmitProcessing||!h.value||f.value<=0||l.value.length>=r.settings.maxLinesCount||r.value.some(x=>x.product.isNewRec())),m=t.computed(()=>x=>f.value===0?void 0:[{label:`${(f.value>0?"Остаток +":"Излишек ")+f.value} мм.`,key:f.value+x}]),g=t.computed(()=>{const{length:x}=r.value[0];if(!x||u.value!==r.settings.width)return null;const w=V.reduce(r.value,(C,N)=>{var $;const k=(($=N.product)==null?void 0:$.costRub)||0;return C+k},0);return Ve.formatMoney(w*r.value[0].quantity*x)}),b=(x,w,C)=>{var k,$,v;l.value[w].product.id=-1;const{configuratorParams:N}=l.value[w];N.linesWidths[w]=x,y("configuratorParams",N),(v=($=(k=a.value)==null?void 0:k.at(w))==null?void 0:$.formItemReference)==null||v.validate().catch(V.noop),t.nextTick(()=>{var E,P;(P=(E=a.value)==null?void 0:E.at(w))!=null&&P.isValid&&o("update:params",N,w,C)})},y=(x,w)=>{l.value.forEach(C=>{C[x]=w}),o("update:value",l.value)};return t.watch(()=>r.value,x=>{l.value=V.cloneDeep(x)},{deep:!0}),e({validate:(_=s.value)==null?void 0:_.validate,formReference:s}),(x,w)=>{const C=I.NCheckbox;return t.withDirectives((t.openBlock(),t.createBlock(t.unref(I.NForm),{ref:"form-reference",model:l.value[0],rules:c.value,class:"flex flex-col gap-2 sc-hide-empty-feedback-message"},{default:t.withCtx(()=>{var N;return[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.value,(k,$)=>{var v,E,P;return t.openBlock(),t.createBlock(Du,{key:$,ref_for:!0,ref:"line-items-reference",value:((v=k.configuratorParams)==null?void 0:v.linesWidths.at($))??null,"auto-focus":(((E=k.configuratorParams)==null?void 0:E.linesWidths.at($))??0)===0,index:$,path:`configuratorParams.linesWidths.${$}`,product:k.product,settings:n.settings,validation:n.validation,"suggestion-option":m.value(((P=k.configuratorParams)==null?void 0:P.linesWidths.at($))??0),"add-line-button-disabled":f.value<=0||n.value.length>=n.settings.maxLinesCount||n.value.some(F=>F.product.isNewRec()),"remove-line-button-disabled":l.value.length===1,"is-last-line":$===l.value.length-1&&f.value===0,"onUpdate:value":b,"onClick:addLine":w[0]||(w[0]=F=>o("click:add-line",F)),"onClick:removeLine":w[1]||(w[1]=F=>o("click:remove-line",F))},null,8,["value","auto-focus","index","path","product","settings","validation","suggestion-option","add-line-button-disabled","remove-line-button-disabled","is-last-line"])}),128)),t.createElementVNode("div",Mb,[f.value<0?(t.openBlock(),t.createBlock(t.unref(I.NText),{key:0,type:"error"},{default:t.withCtx(()=>[t.createTextVNode(" Сумма ширин всех полос должна быть равна "+t.toDisplayString(n.settings.width),1)]),_:1})):t.createCommentVNode("",!0),h.value&&l.value.length===n.settings.maxLinesCount&&f.value>0?(t.openBlock(),t.createBlock(t.unref(I.NText),{key:1,type:"error"},{default:t.withCtx(()=>[...w[15]||(w[15]=[t.createTextVNode(" Остаток резки должен быть равен 0 ",-1)])]),_:1})):t.createCommentVNode("",!0),t.createElementVNode("div",null,[w[16]||(w[16]=t.createTextVNode(" Остаток для резки: ",-1)),t.createVNode(t.unref(I.NText),{type:f.value>=0?"Success":"error"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(f.value),1)]),_:1},8,["type"]),t.createTextVNode(" из "+t.toDisplayString(n.settings.width)+" мм ",1)])]),t.createVNode(t.unref(I.NButton),{disabled:p.value,type:"primary",class:"self-center",onClick:w[2]||(w[2]=k=>o("click:add-line",l.value.length))},{default:t.withCtx(()=>[...w[17]||(w[17]=[t.createTextVNode(" Добавить полосу ",-1)])]),_:1},8,["disabled"]),t.createVNode(t.unref(I.NFormItem),{path:"length",label:`Метраж ${n.settings.minLength?" от "+n.settings.minLength:""} ${n.settings.maxLength?" до "+n.settings.maxLength:""} м.`},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:l.value[0].length,"onUpdate:value":[w[3]||(w[3]=k=>l.value[0].length=k),w[6]||(w[6]=k=>y("length",k))],parse:t.unref(ht),"show-button":!1,placeholder:"Введите метраж",class:"w-full",onKeydown:w[4]||(w[4]=k=>t.unref(ft)(k,!1)),onInput:w[5]||(w[5]=k=>t.unref(dt)(n.validation,"length")),onFocus:t.unref(He)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),t.createVNode(t.unref(I.NFormItem),{path:"quantity",label:"Количество"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:l.value[0].quantity,"onUpdate:value":[w[7]||(w[7]=k=>l.value[0].quantity=k),w[10]||(w[10]=k=>y("quantity",k))],"show-button":!1,placeholder:"Введите количество",class:"w-full",onKeydown:w[8]||(w[8]=k=>t.unref(ft)(k,!1)),onInput:w[9]||(w[9]=k=>t.unref(dt)(n.validation,"quantity")),onFocus:t.unref(He)},null,8,["value","onFocus"])]),_:1}),t.createVNode(t.unref(I.NFormItem),{path:"marker",label:"Маркировка"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInput),{value:l.value[0].marker??null,placeholder:"Введите маркировку",onInput:w[11]||(w[11]=k=>t.unref(dt)(n.validation,"marker")),"onUpdate:value":w[12]||(w[12]=k=>{l.value[0].marker=k??null,y("marker",k??null)}),onFocus:t.unref(He)},null,8,["value","onFocus"])]),_:1}),d.value?(t.openBlock(),t.createBlock(C,{key:0,checked:l.value[0].isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":w[13]||(w[13]=k=>{l.value[0].isAdditionalSale=k??!1,y("isAdditionalSale",k??!1)})},{default:t.withCtx(()=>[...w[18]||(w[18]=[t.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):t.createCommentVNode("",!0),g.value?(t.openBlock(),t.createElementBlock("div",Ib,[w[19]||(w[19]=t.createTextVNode(" ИТОГО: ",-1)),t.createElementVNode("span",Ab,t.toDisplayString(g.value)+" ₽",1)])):t.createCommentVNode("",!0),t.createElementVNode("div",Ob,[t.createVNode(t.unref(I.NButton),{loading:n.isSubmitProcessing,disabled:!h.value||f.value!=0||!((N=l.value[0])!=null&&N.length)||l.value[0].length>n.settings.maxLength||l.value[0].length<n.settings.minLength||l.value[0].quantity===0,type:"primary",class:"self-start",onClick:w[14]||(w[14]=k=>o("submit",l.value))},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(l.value[0].isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["loading","disabled"])])]}),_:1},8,["model","rules"])),[[t.unref(ai),()=>o("submit",l.value)]])}}}),Db={class:"flex grow flex-col"},Lb=["src"],Hb={class:"w-full"},Wb={},Hu=t.defineComponent({...Wb,__name:"strip-configurator-preview",props:{value:{},settings:{}},setup(n){return(e,i)=>(t.openBlock(),t.createElementBlock("div",Db,[t.createElementVNode("img",{src:"/img/configurators/strip/strip-"+n.value.length+".png",class:"w-full max-w-96 self-center py-5",alt:"Штрипс"},null,8,Lb),t.createElementVNode("div",Hb,[t.createTextVNode(" Число полос можно указать от "+t.toDisplayString(n.settings.minLinesCount)+" до "+t.toDisplayString(n.settings.maxLinesCount)+". ",1),i[0]||(i[0]=t.createElementVNode("br",null,null,-1)),t.createTextVNode(" Минимальная ширина полосы "+t.toDisplayString(n.settings.minLineWidth)+" мм. ",1),i[1]||(i[1]=t.createElementVNode("br",null,null,-1)),t.createTextVNode(" Ширина всех полос "+t.toDisplayString(n.settings.width)+" мм. ",1),i[2]||(i[2]=t.createElementVNode("br",null,null,-1)),t.createTextVNode(" Шаг ширины полосы - "+t.toDisplayString(n.settings.lineWidthStep)+" мм. ",1)])]))}}),jb={class:"flex flex-col gap-2"},qb={class:"flex grow flex-col px-5 md:w-104"},Xb={},Wu=t.defineComponent({...Xb,__name:"strip-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showProductInfoButton:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{type:Function},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{type:Function},settings:{},cartItems:{}},emits:["submit","click:view-switch"],setup(n,{emit:e}){const i=n,r=e,o=t.useTemplateRef("strip-configurator-form"),s=t.ref(i.cartItems),a=t.ref({width:{},length:{},quantity:{},marker:{}}),l=t.ref(!1),c=t.computed(()=>t.inject("debounce-input-time",300)),d=t.computed(()=>{var m;return(m=s.value[0].configuratorParams)==null?void 0:m.linesWidths.reduce((g,b)=>(g??0)+(b??0),0)}),u=m=>{m===void 0&&(m=s.value.length-1);const g=s.value.at(0);if(!g)return;g.configuratorParams.linesWidths=g.configuratorParams.linesWidths.toSpliced(m+1,0,null),s.value.forEach(y=>{y.configuratorParams.linesWidths=g.configuratorParams.linesWidths});const b=new W.OrderItemBase({quantity:(g==null?void 0:g.quantity)??1,category:g==null?void 0:g.category,length:(g==null?void 0:g.length)??i.settings.minLength,marker:g==null?void 0:g.marker,configuratorParams:{linesWidths:g==null?void 0:g.configuratorParams.linesWidths}});s.value=s.value.toSpliced(m+1,0,b)},f=m=>{const g=s.value.at(0);g&&(g.configuratorParams.linesWidths=g.configuratorParams.linesWidths.toSpliced(m,1),s.value.forEach(b=>{b.configuratorParams.linesWidths=g.configuratorParams.linesWidths}),s.value=s.value.toSpliced(m,1),delete a[`linesWidths.${m}`],delete a[`linesWidths.${m}`])},h=V.debounce(async(m,g,b)=>{const y={linesWidths:m.linesWidths.at(g)};b.value=!0,a.value[`linesWidths.${g}`]={},s.value[g].product=new W.ClientProduct,i.eventEmitter.emit("configurator:search-product",{category:s.value[g].category,params:y,validationFieldResultData:a.value,callback:_=>{_?(s.value[g].product=_,g===s.value.length-1&&s.value.length<i.settings.maxLinesCount&&d.value&&d.value<i.settings.width&&u()):(s.value[g].product=new W.ClientProduct,a.value[`linesWidths.${g}`]={showFeedback:!0,feedback:"Не удалось найти товар",validationStatus:"error"},b.value=!1),b.value=!1}})},c.value),p=async()=>{var m,g;(g=(m=o.value)==null?void 0:m.formReference)==null||g.validate(b=>{if(!b){l.value=!0;const y=s.value.at(0);if(!y)return;r("submit",y,a.value,()=>{l.value=!1,t.nextTick(()=>{var _,x;(x=(_=o.value)==null?void 0:_.formReference)==null||x.restoreValidation()})})}}).catch(V.noop)};return t.watch(()=>i.cartItems,m=>{s.value=m.map(g=>new W.OrderItemBase(g))}),(m,g)=>{const b=I.NButton;return t.openBlock(),t.createElementBlock("div",jb,[n.settings.allowShowTable?(t.openBlock(),t.createBlock(b,{key:0,type:"tertiary",class:"self-center",onClick:g[0]||(g[0]=y=>r("click:view-switch"))},{default:t.withCtx(()=>[...g[3]||(g[3]=[t.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):t.createCommentVNode("",!0),t.createElementVNode("div",qb,[t.createVNode(Hu,{value:s.value,"onUpdate:value":g[1]||(g[1]=y=>s.value=y),settings:n.settings},null,8,["value","settings"]),t.createVNode(Lu,{ref:"strip-configurator-form",value:s.value,"onUpdate:value":g[2]||(g[2]=y=>s.value=y),validation:a.value,settings:n.settings,"is-submit-processing":l.value,"onUpdate:params":t.unref(h),onSubmit:p,"onClick:addLine":u,"onClick:removeLine":f},null,8,["value","validation","settings","is-submit-processing","onUpdate:params"])])])}}}),Yb={class:"flex flex-col gap-3"},Ub={},ju=t.defineComponent({...Ub,__name:"metal-for-doors-configurator-form",props:{value:{},settings:{},isProductSearching:{type:Boolean,default:!1},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0}},emits:["update:value","update:params","submit"],setup(n,{expose:e,emit:i}){var p;const r=n,o=i,s=t.useTemplateRef("form-reference"),a=t.useTemplateRef("first-input-element"),l=t.ref(V.cloneDeep(r.value)),c=t.computed(()=>({"configuratorParams.width":[ce.required,ce.min(r.settings.minWidth),...r.settings.maxWidth?[ce.max(r.settings.maxWidth)]:[],ce.step(1),We.serverValidation(r.validation.width.feedback)],"configuratorParams.length":[ce.required,ce.min(r.settings.minLength),ce.max(r.settings.maxLength),ce.step(1),We.serverValidation(r.validation.length.feedback)],quantity:[ce.required,ce.min(1),ce.step(1),We.serverValidation(r.validation.quantity.feedback)],marker:[We.serverValidation(r.validation.marker.feedback)]})),d=t.ref(r.settings.canSetDopProdaga??!1),u=()=>{o("update:params",l.value.configuratorParams),f("configuratorParams",l.value.configuratorParams)},f=(m,g)=>{const b=new W.OrderItemBase(r.value);b[m]=g,m==="configuratorParams"&&(b.product=new W.ClientProduct),o("update:value",b)},h=()=>{var m;(m=a.value)==null||m.select()};return t.watch(()=>r.value,m=>{l.value=V.cloneDeep(m)},{deep:!0}),t.onMounted(()=>{r.value.isNewRec()&&t.nextTick(()=>{h()})}),e({validate:(p=s.value)==null?void 0:p.validate,formReference:s}),(m,g)=>{const b=I.NCheckbox;return t.withDirectives((t.openBlock(),t.createBlock(t.unref(I.NForm),{ref:"form-reference",model:l.value,rules:c.value,disabled:n.isSubmitProcessing,class:"flex flex-col gap-2 sc-hide-empty-feedback-message"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NFormItem),{path:"configuratorParams.width",label:`Ширина, ${n.settings.minWidth?" от "+n.settings.minWidth:""}${n.settings.maxWidth?" до "+n.settings.maxWidth:""} мм`},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{ref:"first-input-element",value:l.value.configuratorParams.width,"onUpdate:value":[g[0]||(g[0]=y=>l.value.configuratorParams.width=y),u],class:"w-full",parse:t.unref(ht),"show-button":!1,placeholder:"Введите ширину",onKeydown:g[1]||(g[1]=y=>t.unref(ft)(y)),onInput:g[2]||(g[2]=y=>t.unref(dt)(n.validation,"width")),onFocus:t.unref(He)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),t.createVNode(t.unref(I.NFormItem),{path:"configuratorParams.length",label:`Длина, ${n.settings.minLength?" от "+n.settings.minLength:""}${n.settings.maxLength?" до "+n.settings.maxLength:""} мм`},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:l.value.configuratorParams.length,"onUpdate:value":[g[3]||(g[3]=y=>l.value.configuratorParams.length=y),u],placeholder:"Введите длину",parse:t.unref(ht),"show-button":!1,class:"w-full",onKeydown:g[4]||(g[4]=y=>t.unref(ft)(y)),onInput:g[5]||(g[5]=y=>t.unref(dt)(n.validation,"length")),onFocus:t.unref(He)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),t.createVNode(t.unref(I.NFormItem),{path:"quantity",label:"Количество"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:n.value.quantity,placeholder:"Введите количество",min:1,"show-button":!1,class:"w-full",onKeydown:g[6]||(g[6]=y=>t.unref(ft)(y,!1)),onInput:g[7]||(g[7]=y=>t.unref(dt)(n.validation,"quantity")),"onUpdate:value":g[8]||(g[8]=y=>f("quantity",y??0)),onFocus:t.unref(He)},null,8,["value","onFocus"])]),_:1}),t.createVNode(t.unref(I.NFormItem),{path:"marker",label:"Маркировка"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInput),{value:n.value.marker??null,placeholder:"Введите маркировку",onInput:g[9]||(g[9]=y=>t.unref(dt)(n.validation,"marker")),"onUpdate:value":g[10]||(g[10]=y=>f("marker",y??null)),onFocus:t.unref(He)},null,8,["value","onFocus"])]),_:1}),d.value?(t.openBlock(),t.createBlock(b,{key:0,checked:l.value.isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":g[11]||(g[11]=y=>{l.value.isAdditionalSale=y??!1,f("isAdditionalSale",y??!1)})},{default:t.withCtx(()=>[...g[13]||(g[13]=[t.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):t.createCommentVNode("",!0),t.createVNode(Fr,{"is-product-searching":n.isProductSearching,product:n.value.product,validation:n.validation.product},null,8,["is-product-searching","product","validation"]),t.createElementVNode("div",Yb,[t.createVNode(t.unref(I.NButton),{disabled:n.value.product.isNewRec()||n.isProductSearching||n.isSubmitProcessing||n.value.length===0||n.value.width===0||n.value.quantity===0,type:"primary",class:"self-start",onClick:g[12]||(g[12]=y=>o("submit",n.value))},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(n.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["disabled"])])]),_:1},8,["model","rules","disabled"])),[[t.unref(ai),()=>o("submit",l.value)]])}}}),Kb={class:"flex flex-col gap-2 w-72"},Gb={},qu=t.defineComponent({...Gb,__name:"metal-for-doors-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showProductInfoButton:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{type:Function},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{type:Function},settings:{},cartItem:{}},emits:["submit","click:view-switch"],setup(n,{emit:e}){const i=n,r=e,o=t.useTemplateRef("metal-for-doors-configurator-form"),s=t.ref(i.cartItem),a=t.ref({width:{},length:{},quantity:{},marker:{}}),l=t.ref(!1),c=t.ref(!1),d=t.computed(()=>t.inject("debounce-input-time",300)),u=V.debounce(async h=>{var p,m;s.value.product=new W.ClientProduct,(m=(p=o.value)==null?void 0:p.formReference)==null||m.validate(g=>{g||(l.value=!0,i.eventEmitter.emit("configurator:search-product",{category:i.cartItem.category,params:h,validationFieldResultData:a.value,callback:b=>{b?s.value.product=b:a.value.product={showFeedback:!0,feedback:"Не удалось найти товар по указанным параметрам.",validationStatus:"error"},l.value=!1}}))}).catch(V.noop)},d.value),f=async()=>{var h,p;(p=(h=o.value)==null?void 0:h.formReference)==null||p.validate(m=>{m||(c.value=!0,r("submit",s.value,a.value,()=>{c.value=!1,t.nextTick(()=>{var g,b;(b=(g=o.value)==null?void 0:g.formReference)==null||b.restoreValidation()})}))}).catch(V.noop)};return t.watch(()=>i.cartItem,h=>{s.value=new W.OrderItemBase(h)},{deep:!0}),(h,p)=>{const m=I.NButton;return t.openBlock(),t.createElementBlock("div",Kb,[n.settings.allowShowTable?(t.openBlock(),t.createBlock(m,{key:0,type:"tertiary",class:"self-center",onClick:p[0]||(p[0]=g=>r("click:view-switch"))},{default:t.withCtx(()=>[...p[4]||(p[4]=[t.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):t.createCommentVNode("",!0),t.createVNode(ju,{ref:"metal-for-doors-configurator-form",value:s.value,"onUpdate:value":p[1]||(p[1]=g=>s.value=g),validation:a.value,settings:n.settings,"is-submit-processing":c.value,"is-product-searching":l.value,"onUpdate:params":p[2]||(p[2]=g=>t.unref(u)(g)),onSubmit:p[3]||(p[3]=g=>f())},null,8,["value","validation","settings","is-submit-processing","is-product-searching"])])}}}),Zb={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Qb(n,e){return t.openBlock(),t.createElementBlock("svg",Zb,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M256 112v288m144-144H112"},null,-1)])])}const Xu=t.markRaw({name:"ion-add",render:Qb}),Jb={key:0,class:"-mt-1 text-sm text-gray-500"},e_={class:"font-bold"},t_={class:"flex flex-col gap-3"},n_={key:0,class:"mt-4 flex flex-col gap-1.5"},i_={class:"flex flex-col gap-1 text-sm text-gray-700"},r_={key:0},o_={key:1},s_={"form-array-name":"items",class:"flex flex-col gap-3"},a_={class:"grid grow grid-cols-1 items-start gap-2 sm:grid-cols-3"},l_={key:0,class:"flex flex-wrap items-end gap-2"},c_={class:"whitespace-nowrap text-xl font-bold"},d_={key:0,class:"whitespace-nowrap text-lg text-gray-500"},u_={class:"font-bold"},f_={class:"font-bold"},h_={class:"flex gap-3"},m_={},Yu=t.defineComponent({...m_,__name:"sandwich-configurator-form",props:{value:{},eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showProductInfoButton:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{},settings:{},isProductSearching:{type:Boolean,default:!1},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0}},emits:["update:value","update:params","submit","add-item","remove-item"],setup(n,{expose:e,emit:i}){var Y;const r=n,o=i,s=t.useTemplateRef("form-reference"),a=t.ref(V.cloneDeep(r.value)),l=t.ref({...r.validation}),c=H=>{var T;delete l.value[H],(T=s.value)==null||T.restoreValidation()};t.watch(()=>r.validation,H=>{l.value={...H},Object.values(H).some(D=>D==null?void 0:D.feedback)&&t.nextTick(()=>{var D;return(D=s.value)==null?void 0:D.validate(V.noop).catch(V.noop)})},{deep:!0});const d=t.computed(()=>r.value.category),u=t.ref(null),f=t.ref(null),h=t.computed(()=>d.value.products??[]),p=t.computed(()=>h.value.map(H=>({label:H.name,value:H.id}))),m=(H,T,D)=>{const K=H!=null&&H>0,J=T!=null&&T>0;return!K&&!J?null:K&&J?`от ${H} ${D} до ${T} ${D}`:K?`от ${H} ${D}`:`до ${T} ${D}`},g=t.computed(()=>{var H,T;return m(r.settings.minWidth,(T=(H=u.value)==null?void 0:H.properties)==null?void 0:T.width,"мм")}),b=t.computed(()=>{var H,T;return m(r.settings.minLength,(T=(H=u.value)==null?void 0:H.properties)==null?void 0:T.length,"мм")}),y=t.ref(null),_=t.ref(!1),x=t.computed(()=>{var T;const H={marker:[We.serverValidation((T=l.value.marker)==null?void 0:T.feedback)]};return a.value.configuratorParams.items.forEach((D,K)=>{var J,U,q,L,le,ue,oe;H[`configuratorParams.items.${K}.width`]=[ce.required,ce.min(r.settings.minWidth),...(U=(J=u.value)==null?void 0:J.properties)!=null&&U.width?[ce.max(u.value.properties.width)]:[],ce.step(1),We.serverValidation((q=l.value[`items.${K}.width`])==null?void 0:q.feedback)],H[`configuratorParams.items.${K}.length`]=[ce.required,ce.min(r.settings.minLength),...(le=(L=u.value)==null?void 0:L.properties)!=null&&le.length?[ce.max(u.value.properties.length)]:[],ce.step(1),We.serverValidation((ue=l.value[`items.${K}.length`])==null?void 0:ue.feedback)],H[`configuratorParams.items.${K}.count`]=[ce.required,ce.min(1),ce.step(1),We.serverValidation((oe=l.value[`items.${K}.count`])==null?void 0:oe.feedback)]}),H}),w=t.ref(r.settings.canSetDopProdaga??!1),C=t.computed(()=>a.value.configuratorParams.items.some(H=>{var T,D;return!u.value||!H.width||H.width<r.settings.minWidth||H.width>(((T=u.value.properties)==null?void 0:T.width)??0)||H.length===0||H.length<r.settings.minLength||H.length>(((D=u.value.properties)==null?void 0:D.length)??0)||!H.count||H.count<1})),N=t.computed(()=>!u.value||C.value||a.value.configuratorParams.items.length===0),k=t.ref(null),$=t.computed(()=>k.value===null?"":Ve.formatMoney(k.value)),v=H=>{if(!H){u.value=null,f.value=null,a.value.product=new W.ClientProduct,y.value=null;return}const T=h.value.find(D=>D.id===H);T&&(u.value=T,f.value=H,a.value.product=T,O("product",a.value.product),a.value.configuratorParams.items.forEach(D=>{var K,J;(K=T.properties)!=null&&K.width&&D.width>T.properties.width&&(D.width=T.properties.width),(J=T.properties)!=null&&J.length&&D.length>T.properties.length&&(D.length=T.properties.length)}),P())};let E=!1;const P=()=>{E=!0,y.value=null,k.value=null,a.value.configuratorParams.calculationId="",a.value.quantity=0},F=async()=>{var H;if(!u.value||a.value.configuratorParams.items.length===0||C.value){P();return}(H=s.value)==null||H.validate(T=>{if(T){P();return}if(_.value=!0,!u.value||!d.value){P(),_.value=!1;return}r.eventEmitter.emit("configurator:calculate",{category:d.value,params:{productId:u.value.id,items:a.value.configuratorParams.items},callback:D=>{D?(y.value=D,a.value.configuratorParams.calculationId=D.id,a.value.quantity=D.quantity,t.nextTick(()=>{O("quantity",D.quantity)})):(a.value.configuratorParams.calculationId="",a.value.quantity=0,P()),O("configuratorParams",a.value.configuratorParams),R(),_.value=!1}})}).catch(()=>{P(),_.value=!1})},R=()=>{var T;if(!((T=u.value)!=null&&T.costRub)||!y.value){k.value=null;return}const H=y.value.quantity*u.value.costRub;k.value=Ve.roundMoney(H)},M=H=>{var D,K;const T=a.value.configuratorParams.items[H];u.value&&((D=u.value.properties)!=null&&D.width&&T.width>u.value.properties.width&&(T.width=u.value.properties.width),(K=u.value.properties)!=null&&K.length&&T.length>u.value.properties.length&&(T.length=u.value.properties.length)),O("configuratorParams",a.value.configuratorParams),P()},X=()=>{a.value.configuratorParams.calculationId="",a.value.configuratorParams.items.push({width:0,length:0,count:1}),O("configuratorParams",a.value.configuratorParams),P(),o("add-item",a.value.configuratorParams.items.length)},G=H=>{a.value.configuratorParams.items.splice(H,1),O("configuratorParams",a.value.configuratorParams),P(),o("remove-item",H)},Z=()=>{if(!(N.value||_.value||r.isSubmitProcessing)){if(!y.value){F();return}o("submit",a.value)}},O=(H,T)=>{const D=new W.OrderItemBase(r.value);D[H]=T,o("update:value",D)};t.watch(()=>r.value,H=>{const T=V.cloneDeep(t.toRaw(H));(!T.configuratorParams.items||T.configuratorParams.items.length===0)&&(T.configuratorParams.items=[{width:0,length:0,count:1}]),a.value=T,r.value.product&&!r.value.product.isNewRec()&&(u.value=r.value.product,f.value=r.value.product.id),r.value.product.isNewRec()&&(u.value=null,f.value=null),E?E=!1:A()},{deep:!0});const A=()=>{const{calculationId:H}=a.value.configuratorParams,T=a.value.quantity??0;H&&T>0&&a.value.product&&!a.value.product.isNewRec()&&(y.value={id:H,quantity:T,sheets:[]},R())};return t.onMounted(()=>{r.value.product&&!r.value.product.isNewRec()&&(u.value=r.value.product,f.value=r.value.product.id),A()}),e({validate:(Y=s.value)==null?void 0:Y.validate,formReference:s}),(H,T)=>{const D=yo,K=Xu;return t.withDirectives((t.openBlock(),t.createBlock(t.unref(I.NForm),{ref:"form-reference",model:a.value,rules:x.value,class:"flex flex-col gap-2 sc-hide-empty-feedback-message"},{default:t.withCtx(()=>{var J;return[t.createVNode(t.unref(I.NFormItem),{required:!0,"show-feedback":!1,label:"Товар"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NSelect),{value:f.value,"onUpdate:value":[T[0]||(T[0]=U=>f.value=U),v],options:p.value,placeholder:"Выберите материал",filterable:""},null,8,["value","options"])]),_:1}),((J=u.value)==null?void 0:J.costRub)!=null?(t.openBlock(),t.createElementBlock("div",Jb,[t.createElementVNode("span",e_,t.toDisplayString(u.value.code),1),t.createTextVNode(" — "+t.toDisplayString(t.unref(Ve).formatMoney(u.value.costRub))+" "+t.toDisplayString(u.value.currency.symbol)+"/шт. ",1)])):t.createCommentVNode("",!0),t.createElementVNode("div",t_,[u.value?(t.openBlock(),t.createElementBlock("div",n_,[T[7]||(T[7]=t.createElementVNode("div",{class:"w-full font-bold"},"Размеры изделий",-1)),t.createElementVNode("div",i_,[g.value?(t.openBlock(),t.createElementBlock("div",r_,"Ширина "+t.toDisplayString(g.value)+".",1)):t.createCommentVNode("",!0),b.value?(t.openBlock(),t.createElementBlock("div",o_,"Длина "+t.toDisplayString(b.value)+".",1)):t.createCommentVNode("",!0)])])):t.createCommentVNode("",!0),t.createElementVNode("div",s_,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value.configuratorParams.items,(U,q)=>(t.openBlock(),t.createElementBlock("div",{key:q,class:"flex grow gap-2"},[t.createElementVNode("div",a_,[t.createVNode(t.unref(I.NFormItem),{path:`configuratorParams.items.${q}.width`,label:"Ширина, мм"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:a.value.configuratorParams.items[q].width,"onUpdate:value":[L=>a.value.configuratorParams.items[q].width=L,L=>M(q)],parse:t.unref(ht),"show-button":!1,disabled:!u.value,placeholder:"Ширина",class:"w-full",onKeydown:T[1]||(T[1]=L=>t.unref(ft)(L)),onInput:L=>c(`items.${q}.width`),onFocus:t.unref(He)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),t.createVNode(t.unref(I.NFormItem),{path:`configuratorParams.items.${q}.length`,label:"Длина, мм"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:a.value.configuratorParams.items[q].length,"onUpdate:value":[L=>a.value.configuratorParams.items[q].length=L,L=>M(q)],parse:t.unref(ht),"show-button":!1,disabled:!u.value,placeholder:"Длина",class:"w-full",onKeydown:T[2]||(T[2]=L=>t.unref(ft)(L)),onInput:L=>c(`items.${q}.length`),onFocus:t.unref(He)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),t.createVNode(t.unref(I.NFormItem),{path:`configuratorParams.items.${q}.count`,label:"Количество, шт"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:a.value.configuratorParams.items[q].count,"onUpdate:value":[L=>a.value.configuratorParams.items[q].count=L,L=>M(q)],parse:t.unref(ht),"show-button":!1,disabled:!u.value,placeholder:"Количество",class:"w-full",onKeydown:T[3]||(T[3]=L=>t.unref(ft)(L,!1)),onInput:L=>c(`items.${q}.count`),onFocus:t.unref(He)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"])]),t.createVNode(t.unref(I.NButton),{disabled:!u.value||a.value.configuratorParams.items.length<=1,type:"error",size:"medium",class:"mt-5",onClick:L=>G(q)},{default:t.withCtx(()=>[t.createVNode(D)]),_:1},8,["disabled","onClick"])]))),128))]),u.value?(t.openBlock(),t.createBlock(t.unref(I.NButton),{key:1,disabled:C.value,type:"default",class:"self-center",onClick:X},{default:t.withCtx(()=>[t.createVNode(K),T[8]||(T[8]=t.createTextVNode(" Добавить изделие ",-1))]),_:1},8,["disabled"])):t.createCommentVNode("",!0)]),t.createVNode(t.unref(I.NFormItem),{path:"marker",label:"Маркировка распила"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInput),{value:a.value.marker??null,disabled:!u.value,placeholder:"Введите маркировку распила",onInput:T[4]||(T[4]=U=>c("marker")),"onUpdate:value":T[5]||(T[5]=U=>O("marker",U??null)),onFocus:t.unref(He)},null,8,["value","disabled","onFocus"])]),_:1}),w.value?(t.openBlock(),t.createBlock(t.unref(I.NCheckbox),{key:1,checked:a.value.isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":T[6]||(T[6]=U=>{a.value.isAdditionalSale=U??!1,O("isAdditionalSale",U??!1)})},{default:t.withCtx(()=>[...T[9]||(T[9]=[t.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):t.createCommentVNode("",!0),t.createVNode(t.unref(I.NSpin),{show:_.value,size:"small",class:"grow"},{default:t.withCtx(()=>[y.value&&u.value&&k.value?(t.openBlock(),t.createElementBlock("div",l_,[t.createElementVNode("div",null,[T[10]||(T[10]=t.createTextVNode(" Итого: ",-1)),t.createElementVNode("span",c_,t.toDisplayString($.value)+" "+t.toDisplayString(u.value.currency.symbol),1)]),y.value.quantity&&u.value?(t.openBlock(),t.createElementBlock("div",d_,[t.createElementVNode("span",u_,"("+t.toDisplayString(y.value.quantity)+" шт.",1),T[11]||(T[11]=t.createTextVNode(" x ",-1)),t.createElementVNode("span",f_,t.toDisplayString(t.unref(Ve).formatMoney(u.value.costRub))+" "+t.toDisplayString(u.value.currency.symbol)+"/шт.)",1)])):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)]),_:1},8,["show"]),t.createElementVNode("div",h_,[y.value&&!_.value?(t.openBlock(),t.createBlock(t.unref(I.NButton),{key:0,loading:n.isSubmitProcessing,disabled:N.value||_.value,type:"primary",class:"self-start",onClick:Z},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(a.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["loading","disabled"])):(t.openBlock(),t.createBlock(t.unref(I.NButton),{key:1,loading:_.value,disabled:N.value||_.value,type:"info",class:"self-start",onClick:F},{default:t.withCtx(()=>[...T[12]||(T[12]=[t.createTextVNode(" Рассчитать ",-1)])]),_:1},8,["loading","disabled"]))])]}),_:1},8,["model","rules"])),[[t.unref(ai),Z]])}}}),p_={class:"flex flex-col gap-2"},g_={class:"w-104 flex grow flex-col px-5"},y_={},Uu=t.defineComponent({...y_,__name:"sandwich-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showProductInfoButton:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{type:Function},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{type:Function},settings:{},cartItem:{}},emits:["submit","click:view-switch"],setup(n,{emit:e}){const i=n,r=e,o=t.useTemplateRef("sandwich-configurator-form"),s=t.ref(i.cartItem),a=t.ref({width:{},length:{},quantity:{},marker:{},product:{}}),l=t.ref(!1),c=async()=>{var f,h;(h=(f=o.value)==null?void 0:f.formReference)==null||h.validate(p=>{if(!p){l.value=!0;const m=V.cloneDeep(s.value);"items"in m.configuratorParams&&delete m.configuratorParams.items,r("submit",m,a.value,()=>{l.value=!1,t.nextTick(()=>{var g,b;(b=(g=o.value)==null?void 0:g.formReference)==null||b.restoreValidation()})})}}).catch(V.noop)},d=f=>{a.value[`items.${f}.width`]={},a.value[`items.${f}.length`]={},a.value[`items.${f}.count`]={}},u=f=>{delete a.value[`items.${f}.width`],delete a.value[`items.${f}.length`],delete a.value[`items.${f}.count`]};return t.onMounted(()=>{i.cartItem.configuratorParams.items.forEach((f,h)=>{a.value[`items.${h}.width`]={},a.value[`items.${h}.length`]={},a.value[`items.${h}.count`]={}})}),t.watch(()=>i.cartItem,f=>{s.value=new W.OrderItemBase(f)},{deep:!0}),(f,h)=>{const p=I.NButton;return t.openBlock(),t.createElementBlock("div",p_,[n.settings.allowShowTable&&s.value.isNewRec()?(t.openBlock(),t.createBlock(p,{key:0,type:"tertiary",class:"self-center",onClick:h[0]||(h[0]=m=>r("click:view-switch"))},{default:t.withCtx(()=>[...h[2]||(h[2]=[t.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):t.createCommentVNode("",!0),t.createElementVNode("div",g_,[t.createVNode(Yu,{ref:"sandwich-configurator-form",value:s.value,"onUpdate:value":h[1]||(h[1]=m=>s.value=m),validation:a.value,settings:n.settings,"event-emitter":n.eventEmitter,"is-submit-processing":l.value,onSubmit:c,onAddItem:d,onRemoveItem:u},null,8,["value","validation","settings","event-emitter","is-submit-processing"])])])}}}),b_={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function __(n,e){return t.openBlock(),t.createElementBlock("svg",b_,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M416 128L192 384l-96-96"},null,-1)])])}const w_=t.markRaw({name:"ion-checkmark",render:__}),x_={key:0,class:"-mt-1 text-sm text-gray-500"},k_={class:"font-bold"},C_={class:"flex flex-col gap-3"},v_={key:0,class:"mt-4 mb-3 flex flex-col gap-1.5"},S_={class:"flex flex-col gap-1 text-sm text-gray-700"},B_={key:0},N_={key:1},T_={"form-array-name":"items",class:"flex flex-col gap-3"},$_={class:"min-w-0 flex-1"},E_={class:"relative flex flex-col gap-3 lg:!flex-row lg:!items-start lg:!gap-6"},R_={class:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:!flex-[2]"},P_={class:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:!grid-cols-[1fr_2fr] lg:!flex-[3]"},F_={key:0,class:"pointer-events-none absolute bottom-2 right-3 flex h-8 w-8 items-center justify-center"},V_={class:"mt-1 flex flex-col gap-y-1 text-sm text-gray-500 lg:!flex-row lg:!gap-6"},M_={key:0,class:"lg:!flex-[2]"},I_={class:"font-bold"},A_={key:1,class:"lg:!flex-[3]"},O_={class:"font-bold"},z_={key:1,class:"min-w-0 flex flex-col items-end gap-1 text-right text-sm text-gray-700 border-t border-gray-200 pt-2"},D_={key:0},L_={class:"font-bold"},H_={key:1},W_={class:"font-bold"},j_={class:"flex flex-wrap items-center gap-3"},q_={},Ku=t.defineComponent({...q_,__name:"sandwich-m2-configurator-form",props:{value:{},eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showProductInfoButton:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{},settings:{},isProductSearching:{type:Boolean,default:!1},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0},itemStates:{default:()=>[]}},emits:["submit","update:value","add-item","remove-item","item-reset"],setup(n,{expose:e,emit:i}){var J;const r=n,o=i,s=t.useTemplateRef("form-reference"),a=t.useTemplateRef("widthInputs"),l=r.value==null?[]:V.cloneDeep(t.toRaw(r.value)),c=t.ref(l.map(U=>new W.OrderItemBase(U))),d=t.computed(()=>({items:c.value})),u=t.ref({...r.validation}),f=U=>{var q;delete u.value[U],(q=s.value)==null||q.restoreValidation()},h=t.ref(null),p=t.ref(null),m=t.computed(()=>{var U,q;return((q=(U=c.value[0])==null?void 0:U.category)==null?void 0:q.products)??[]}),g=t.computed(()=>m.value.map(U=>({label:U.name,value:U.id}))),b=(U,q,L)=>{const le=U!=null&&U>0,ue=q!=null&&q>0;return!le&&!ue?null:le&&ue?`от ${U} ${L} до ${q} ${L}`:le?`от ${U} ${L}`:`до ${q} ${L}`},y=t.computed(()=>{var U,q;return b(r.settings.minWidth,(q=(U=h.value)==null?void 0:U.properties)==null?void 0:q.width,"мм")}),_=t.computed(()=>{var U,q;return b(r.settings.minLength,(q=(U=h.value)==null?void 0:U.properties)==null?void 0:q.length,"мм")}),x=t.computed(()=>{const U={};return c.value.forEach((q,L)=>{var le,ue,oe,fe,ge,_e,Qe,Re;U[`items.${L}.configuratorParams.width`]=[ce.required,ce.min(r.settings.minWidth),...(ue=(le=h.value)==null?void 0:le.properties)!=null&&ue.width?[ce.max(h.value.properties.width)]:[],ce.step(1),We.serverValidation((oe=u.value[`items.${L}.width`])==null?void 0:oe.feedback)],U[`items.${L}.configuratorParams.length`]=[ce.required,ce.min(r.settings.minLength),...(ge=(fe=h.value)==null?void 0:fe.properties)!=null&&ge.length?[ce.max(h.value.properties.length)]:[],ce.step(1),We.serverValidation((_e=u.value[`items.${L}.length`])==null?void 0:_e.feedback)],U[`items.${L}.quantity`]=[ce.required,ce.min(1),ce.step(1),We.serverValidation((Qe=u.value[`items.${L}.quantity`])==null?void 0:Qe.feedback)],U[`items.${L}.marker`]=[We.serverValidation((Re=u.value[`items.${L}.marker`])==null?void 0:Re.feedback)]}),U});t.watch(()=>r.validation,U=>{u.value={...U},Object.values(U).some(L=>L==null?void 0:L.feedback)&&t.nextTick(()=>{var L;return(L=s.value)==null?void 0:L.validate(V.noop).catch(V.noop)})},{deep:!0});const w=t.ref(r.settings.canSetDopProdaga??!1),C=t.computed(()=>{const U=h.value;return U?c.value.some(q=>{var oe,fe;const L=q.configuratorParams,le=(oe=U.properties)==null?void 0:oe.width,ue=(fe=U.properties)==null?void 0:fe.length;return L.width===0||L.width<r.settings.minWidth||le!=null&&L.width>le||L.length===0||L.length<r.settings.minLength||ue!=null&&L.length>ue||q.quantity===0||q.quantity<1}):!0}),N=t.computed(()=>!h.value||C.value||c.value.length===0),k=t.computed(()=>{const U=c.value[0];return U!=null&&!U.isNewRec()}),$=U=>r.itemStates[U]??"idle",v=U=>$(U)==="success",E=U=>$(U)==="loading",P=t.computed(()=>c.value.length===0?!0:c.value.every((U,q)=>{const L=$(q);return L==="success"||L==="loading"})),F=U=>U.width===0||U.length===0?0:U.width*U.length/1e6,R=U=>Ve.formatArea(F(U)),M=U=>{var oe;const q=U.configuratorParams,L=F(q),le=((oe=h.value)==null?void 0:oe.costRub)??0,ue=U.quantity??0;return!L||!ue?0:Ve.roundMoney(L*le*ue)},X=t.computed(()=>V.sum(c.value.map(U=>{const q=U.configuratorParams;return!q.width||q.length===0||!U.quantity?0:q.width*q.length*U.quantity/1e6}))),G=t.computed(()=>Ve.roundMoney(V.sum(c.value.map(U=>M(U))))),Z=()=>{var U,q,L;return new W.OrderItemBase({category:(U=c.value[0])==null?void 0:U.category,configurator:(q=c.value[0])==null?void 0:q.configurator,product:h.value??new W.ClientProduct,quantity:1,isAdditionalSale:(L=c.value[0])==null?void 0:L.isAdditionalSale,configuratorParams:{width:0,length:0}})},O=U=>{if(!U){h.value=null,p.value=null,c.value.forEach(L=>{L.product=new W.ClientProduct}),o("update:value",c.value);return}const q=m.value.find(L=>L.id===U);q&&(h.value=q,p.value=U,c.value.forEach((L,le)=>{var ue,oe;L.product=q,(ue=q.properties)!=null&&ue.width&&L.configuratorParams.width>q.properties.width&&(L.configuratorParams.width=q.properties.width),(oe=q.properties)!=null&&oe.length&&L.configuratorParams.length>q.properties.length&&(L.configuratorParams.length=q.properties.length),o("item-reset",le)}),o("update:value",c.value))},A=U=>{var le,ue;const q=c.value[U],L=h.value;L&&((le=L.properties)!=null&&le.width&&q.configuratorParams.width>L.properties.width&&(q.configuratorParams.width=L.properties.width),(ue=L.properties)!=null&&ue.length&&q.configuratorParams.length>L.properties.length&&(q.configuratorParams.length=L.properties.length)),o("item-reset",U),o("update:value",c.value)},Y=(U,q)=>{c.value[U].marker=q===null||q===""?void 0:q,o("item-reset",U),o("update:value",c.value)},H=U=>{c.value.forEach(q=>{q.isAdditionalSale=U}),o("update:value",c.value)},T=()=>{c.value.push(Z()),o("update:value",c.value),o("add-item",c.value.length),t.nextTick(()=>{var q,L,le,ue;const U=c.value.length-1;(L=(q=a.value)==null?void 0:q[U])==null||L.focus(),(ue=(le=a.value)==null?void 0:le[U])==null||ue.select()})},D=U=>{c.value.splice(U,1),o("update:value",c.value),o("remove-item",U)};t.watch(()=>r.value,U=>{var ue;const L=(U==null?[]:V.cloneDeep(t.toRaw(U))).map(oe=>new W.OrderItemBase(oe));c.value=L.length>0?L:[Z()];const le=(ue=c.value[0])==null?void 0:ue.product;le&&!le.isNewRec()?(h.value=le,p.value=le.id):(h.value=null,p.value=null)},{deep:!0});const K=()=>{var q;if(h.value!==null)return;const U=(q=m.value[0])==null?void 0:q.id;U!=null&&O(U)};return t.watch(m,()=>{K()}),t.onMounted(()=>{var q;c.value.length===0&&(c.value=[Z()]);const U=(q=c.value[0])==null?void 0:q.product;U&&!U.isNewRec()&&(h.value=U,p.value=U.id),K()}),e({validate:(J=s.value)==null?void 0:J.validate,formReference:s}),(U,q)=>{const L=w_,le=yo,ue=Xu;return t.withDirectives((t.openBlock(),t.createBlock(t.unref(I.NForm),{ref:"form-reference",model:d.value,rules:x.value,class:"flex flex-col gap-2 sc-hide-empty-feedback-message"},{default:t.withCtx(()=>{var oe,fe;return[t.createVNode(t.unref(I.NFormItem),{required:!0,"show-feedback":!1,label:"Товар"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NSelect),{value:p.value,"onUpdate:value":[q[0]||(q[0]=ge=>p.value=ge),O],options:g.value,placeholder:"Выберите материал",filterable:""},null,8,["value","options"])]),_:1}),((oe=h.value)==null?void 0:oe.costRub)!=null?(t.openBlock(),t.createElementBlock("div",x_,[t.createElementVNode("span",k_,t.toDisplayString(h.value.code),1),t.createTextVNode(" — "+t.toDisplayString(t.unref(Ve).formatMoney(h.value.costRub))+" "+t.toDisplayString(h.value.currency.symbol)+"/м² ",1)])):t.createCommentVNode("",!0),t.createElementVNode("div",C_,[h.value?(t.openBlock(),t.createElementBlock("div",v_,[q[6]||(q[6]=t.createElementVNode("div",{class:"w-full font-bold"},"Размеры изделий",-1)),t.createElementVNode("div",S_,[y.value?(t.openBlock(),t.createElementBlock("div",B_,"Ширина "+t.toDisplayString(y.value)+".",1)):t.createCommentVNode("",!0),_.value?(t.openBlock(),t.createElementBlock("div",N_,"Длина "+t.toDisplayString(_.value)+".",1)):t.createCommentVNode("",!0)])])):t.createCommentVNode("",!0),t.createElementVNode("div",T_,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.value.items,(ge,_e)=>{var Qe;return t.openBlock(),t.createElementBlock("div",{key:_e,class:t.normalizeClass(["flex min-w-0 items-start gap-2 border-b border-gray-100 last:border-0",v(_e)?"opacity-70":""])},[t.createElementVNode("div",$_,[t.createElementVNode("div",E_,[t.createElementVNode("div",R_,[t.createVNode(t.unref(I.NFormItem),{path:`items.${_e}.configuratorParams.width`,label:"Ширина, мм",class:"min-w-0"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{ref_for:!0,ref:"widthInputs",value:d.value.items[_e].configuratorParams.width,"onUpdate:value":[Re=>d.value.items[_e].configuratorParams.width=Re,Re=>A(_e)],parse:t.unref(ht),"show-button":!1,disabled:!h.value||v(_e)||E(_e),placeholder:"Ширина",class:"w-full",onKeydown:q[1]||(q[1]=Re=>t.unref(ft)(Re)),onInput:Re=>f(`items.${_e}.width`),onFocus:t.unref(He)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),t.createVNode(t.unref(I.NFormItem),{path:`items.${_e}.configuratorParams.length`,label:"Длина, мм",class:"min-w-0"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:d.value.items[_e].configuratorParams.length,"onUpdate:value":[Re=>d.value.items[_e].configuratorParams.length=Re,Re=>A(_e)],parse:t.unref(ht),"show-button":!1,disabled:!h.value||v(_e)||E(_e),placeholder:"Длина",class:"w-full",onKeydown:q[2]||(q[2]=Re=>t.unref(ft)(Re)),onInput:Re=>f(`items.${_e}.length`),onFocus:t.unref(He)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"])]),t.createElementVNode("div",P_,[t.createVNode(t.unref(I.NFormItem),{path:`items.${_e}.quantity`,label:"Количество, шт",class:"min-w-0"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:d.value.items[_e].quantity,"onUpdate:value":[Re=>d.value.items[_e].quantity=Re,Re=>A(_e)],parse:t.unref(ht),"show-button":!1,disabled:!h.value||v(_e)||E(_e),placeholder:"Кол-во",class:"w-full",onKeydown:q[3]||(q[3]=Re=>t.unref(ft)(Re,!1)),onInput:Re=>f(`items.${_e}.quantity`),onFocus:t.unref(He)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),t.createVNode(t.unref(I.NFormItem),{path:`items.${_e}.marker`,label:"Маркировка",class:"min-w-0"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInput),{value:d.value.items[_e].marker??null,disabled:!h.value||v(_e)||E(_e),placeholder:"Маркировка",class:"w-full",onInput:Re=>f(`items.${_e}.marker`),"onUpdate:value":Re=>Y(_e,Re??null),onFocus:t.unref(He)},null,8,["value","disabled","onInput","onUpdate:value","onFocus"])]),_:2},1032,["path"])]),E(_e)||v(_e)?(t.openBlock(),t.createElementBlock("div",F_,[E(_e)?(t.openBlock(),t.createBlock(t.unref(I.NSpin),{key:0,size:14})):v(_e)?(t.openBlock(),t.createBlock(L,{key:1,class:"text-green-600 text-xl"})):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)]),t.createElementVNode("div",V_,[ge.configuratorParams.width>0&&ge.configuratorParams.length>0?(t.openBlock(),t.createElementBlock("div",M_,[q[7]||(q[7]=t.createTextVNode(" Площадь (S) = ",-1)),t.createElementVNode("span",I_,t.toDisplayString(R(ge.configuratorParams))+" м²",1)])):t.createCommentVNode("",!0),M(ge)>0?(t.openBlock(),t.createElementBlock("div",A_,[q[8]||(q[8]=t.createTextVNode(" Итого: ",-1)),t.createElementVNode("span",O_,t.toDisplayString(t.unref(Ve).formatMoney(M(ge)))+" "+t.toDisplayString((Qe=h.value)==null?void 0:Qe.currency.symbol),1)])):t.createCommentVNode("",!0)])]),k.value?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(t.unref(I.NButton),{key:0,disabled:E(_e)||d.value.items.length<=1,type:"error",size:"medium",class:"mt-5 shrink-0 lg:!ml-4",onClick:Re=>D(_e)},{default:t.withCtx(()=>[t.createVNode(le)]),_:1},8,["disabled","onClick"]))],2)}),128))]),h.value?(t.openBlock(),t.createElementBlock("div",z_,[X.value>0?(t.openBlock(),t.createElementBlock("div",D_,[q[9]||(q[9]=t.createTextVNode(" Общая площадь: ",-1)),t.createElementVNode("span",L_,t.toDisplayString(t.unref(Ve).formatArea(X.value))+" м²",1)])):t.createCommentVNode("",!0),G.value>0?(t.openBlock(),t.createElementBlock("div",H_,[q[10]||(q[10]=t.createTextVNode(" Итого: ",-1)),t.createElementVNode("span",W_,t.toDisplayString(t.unref(Ve).formatMoney(G.value))+" "+t.toDisplayString(h.value.currency.symbol),1)])):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)]),w.value?(t.openBlock(),t.createBlock(t.unref(I.NCheckbox),{key:1,checked:((fe=c.value[0])==null?void 0:fe.isAdditionalSale)??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":q[4]||(q[4]=ge=>H(ge??!1))},{default:t.withCtx(()=>[...q[11]||(q[11]=[t.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):t.createCommentVNode("",!0),t.createElementVNode("div",j_,[h.value&&!k.value?(t.openBlock(),t.createBlock(t.unref(I.NButton),{key:0,disabled:C.value,type:"default",onClick:T},{default:t.withCtx(()=>[t.createVNode(ue),q[12]||(q[12]=t.createTextVNode(" Добавить изделие ",-1))]),_:1},8,["disabled"])):t.createCommentVNode("",!0),t.createVNode(t.unref(I.NButton),{loading:n.isSubmitProcessing,disabled:N.value||P.value,type:"primary",class:"ml-auto",onClick:q[5]||(q[5]=ge=>o("submit",c.value))},{default:t.withCtx(()=>{var ge;return[t.createTextVNode(t.toDisplayString((ge=c.value[0])!=null&&ge.isNewRec()?"В корзину":"Изменить"),1)]}),_:1},8,["loading","disabled"])])]}),_:1},8,["model","rules"])),[[t.unref(ai),()=>o("submit",c.value)]])}}}),X_={class:"flex flex-col gap-2"},Y_={class:"min-w-56 max-w-3xl flex grow flex-col px-5"},U_={},Gu=t.defineComponent({...U_,__name:"sandwich-m2-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showProductInfoButton:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{type:Function},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{type:Function},settings:{},cartItems:{}},emits:["click:view-switch","submit"],setup(n,{emit:e}){const i=n,r=e,o=t.useTemplateRef("sandwich-m2-configurator-form"),s=t.ref((i.cartItems??[]).map(x=>new W.OrderItemBase(x))),a=t.ref([]),l=t.ref({width:{},length:{},quantity:{},marker:{}}),c=["width","length","quantity","marker"],d=x=>{c.forEach(w=>{l.value[`items.${x}.${w}`]={}})},u=x=>{c.forEach(w=>{delete l.value[`items.${x}.${w}`]})},f=t.computed(()=>a.value.includes("loading")),h=()=>({width:{},length:{},quantity:{},marker:{}}),p=(x,w)=>{let C=!1;return c.forEach(N=>{var F,R;const k=`items.0.${N}`,$=(F=x[N])==null?void 0:F.feedback,E=((R=x[k])==null?void 0:R.feedback)??$,P=`items.${w}.${N}`;E?(l.value[P]=x[k]??x[N],C=!0):l.value[P]={}}),C},m=(x,w,C)=>new Promise(N=>{const k=h();let $=!1;const v=E=>{if($)return;$=!0;const P=p(k,w),F=(E===void 0?!P:E)&&!P;a.value[w]=F?"success":"error",t.nextTick(()=>{var R,M;(M=(R=o.value)==null?void 0:R.formReference)==null||M.restoreValidation()}),N(F)};a.value[w]="loading",r("submit",[V.cloneDeep(x)],k,v,{isFinalSuccessfulCompletion:C})}),g=async()=>{var C,N;try{await((N=(C=o.value)==null?void 0:C.formReference)==null?void 0:N.validate())}catch{return}const x=s.value.map((k,$)=>$).filter(k=>{const $=a.value[k]??"idle";return $!=="success"&&$!=="loading"});let w=!0;for(let k=0;k<x.length;k+=1){const $=x[k],v=s.value[$];if(!v)break;const P=k===x.length-1&&w;await m(v,$,P)||(w=!1)}},b=x=>{const w=x-1;a.value[w]="idle",d(w)},y=x=>{a.value.splice(x,1),u(x);for(let w=x;w<s.value.length;w+=1)d(w)},_=x=>{const w=a.value[x];(w==="success"||w==="error")&&(a.value[x]="idle")};return t.onMounted(()=>{(i.cartItems??[]).forEach((x,w)=>{a.value[w]="idle",d(w)})}),t.watch(()=>i.cartItems,x=>{const w=(x??[]).map(C=>new W.OrderItemBase(C));s.value=w,a.value=w.map(()=>"idle"),w.forEach((C,N)=>{d(N)})},{deep:!0}),(x,w)=>{var N;const C=I.NButton;return t.openBlock(),t.createElementBlock("div",X_,[n.settings.allowShowTable&&((N=s.value[0])!=null&&N.isNewRec())?(t.openBlock(),t.createBlock(C,{key:0,type:"tertiary",class:"self-center",onClick:w[0]||(w[0]=k=>r("click:view-switch"))},{default:t.withCtx(()=>[...w[2]||(w[2]=[t.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):t.createCommentVNode("",!0),t.createElementVNode("div",Y_,[t.createVNode(Ku,{ref:"sandwich-m2-configurator-form",value:s.value,"onUpdate:value":w[1]||(w[1]=k=>s.value=k),validation:l.value,settings:n.settings,"event-emitter":n.eventEmitter,"is-submit-processing":f.value,"item-states":a.value,onSubmit:g,onAddItem:b,onRemoveItem:y,onItemReset:_},null,8,["value","validation","settings","event-emitter","is-submit-processing","item-states"])])])}}}),K_={key:0,class:"flex justify-center p-4"},G_={key:1,class:"p-4 text-center text-red-500"},Z_={key:2,class:"flex justify-center"},Q_={class:"!bg-white p-4 m-2 rounded-md w-max"},J_={key:3,class:"p-4 text-center text-gray-500"},ew={},Zu=t.defineComponent({...ew,__name:"dynamic-configurator",props:{eventEmitter:{},settings:{},editor:{},cartItem:{},cartItems:{},category:{}},setup(n){const e=n,i=t.ref(!1),r=t.ref(null),o=t.ref(e.cartItem??null),s=t.ref(e.cartItems??null),a=h=>{const p=h.configuratorParams;return[new W.OrderItemBase({...h,quantity:h.quantity??1,marker:h.marker,configuratorParams:{width:(p==null?void 0:p.width)??h.width??0,length:(p==null?void 0:p.length)??h.length??0}})]},l=t.ref(e.editor===W.ConfiguratorsEnum.SandwichM2&&e.cartItem!=null?a(e.cartItem):null),c=()=>{var p,m,g;if(!e.settings){r.value="Настройки конфигуратора не указаны в свойствах категории.";return}const h={category:((p=e.cartItem)==null?void 0:p.category)??e.category,configurator:e.editor,quantity:1};switch(e.editor){case"kozyrek":{const b=e.settings;o.value=new W.OrderItemBase({...h,configuratorParams:{length:b.stripMinLength,linesAngles:[],linesWidths:[],startTailType:V.some(b.startTailConfigs,y=>y.isDefault)?(m=b.startTailConfigs)==null?void 0:m.findIndex(y=>y.isDefault):void 0,endTailType:V.some(b.endTailConfigs,y=>y.isDefault)?(g=b.endTailConfigs)==null?void 0:g.findIndex(y=>y.isDefault):void 0,colorSide:"top"}});break}case"mosquitto":{const b=e.settings;o.value=new W.OrderItemBase({...h,configuratorParams:{width:0,height:0,netType:b.netType[0]||"",color:b.color[0]||"",mountType:b.mountType[0]||""}});break}case"strip":{const b=e.settings;s.value=[new W.OrderItemBase({...h,length:b.minLength,configuratorParams:{linesWidths:[0]}})];break}case"metal_for_doors":{const b=e.settings;o.value=new W.OrderItemBase({...h,configuratorParams:{width:b.minWidth,length:b.minLength}});break}case"sandwich":{o.value=new W.OrderItemBase({...h,configuratorParams:{calculationId:"",items:[{width:0,length:0,count:1}]}});break}case"sandwich_m2":{l.value=[new W.OrderItemBase({...h,configuratorParams:{width:0,length:0}})];break}default:r.value=`Неподдерживаемый тип конфигуратора: ${e.editor}.`}o.value&&(o.value.marker=void 0)},d=(h,p,m)=>{const g=b=>{m==null||m(),b&&c()};e.eventEmitter.emit("configurator:submit",{cartItem:h,callback:g,validation:p})},u=(h,p,m,g)=>{const b=h[0];if(!b){m==null||m();return}const y=(g==null?void 0:g.isFinalSuccessfulCompletion)===!0,_=x=>{m==null||m(x),y&&x&&c()};e.eventEmitter.emit("configurator:submit",{cartItem:b,callback:_,validation:p,additionalParams:g})},f=()=>{e.category&&e.eventEmitter.emit("configurator:click-view-switch",{category:e.category})};return t.onMounted(()=>{!e.cartItem&&!e.cartItems&&c()}),(h,p)=>{const m=I.NSpin;return t.openBlock(),t.createElementBlock(t.Fragment,null,[i.value?(t.openBlock(),t.createElementBlock("div",K_,[t.createVNode(m,{size:"large"})])):r.value?(t.openBlock(),t.createElementBlock("div",G_,t.toDisplayString(r.value),1)):t.createCommentVNode("",!0),n.settings!==null&&(o.value!==null||s.value!==null||l.value!==null)?(t.openBlock(),t.createElementBlock("div",Z_,[t.createElementVNode("div",Q_,[n.editor==="kozyrek"?(t.openBlock(),t.createBlock(Iu,{key:0,"event-emitter":n.eventEmitter,settings:n.settings,"cart-item":o.value,"onClick:viewSwitch":f,onSubmit:d},null,8,["event-emitter","settings","cart-item"])):n.editor==="mosquitto"?(t.openBlock(),t.createBlock(zu,{key:1,"event-emitter":n.eventEmitter,settings:n.settings,"cart-item":o.value,onSubmit:d},null,8,["event-emitter","settings","cart-item"])):n.editor==="strip"?(t.openBlock(),t.createBlock(Wu,{key:2,"event-emitter":n.eventEmitter,settings:n.settings,"cart-items":s.value,"onClick:viewSwitch":f,onSubmit:d},null,8,["event-emitter","settings","cart-items"])):n.editor==="metal_for_doors"?(t.openBlock(),t.createBlock(qu,{key:3,"event-emitter":n.eventEmitter,settings:n.settings,"cart-item":o.value,"onClick:viewSwitch":f,onSubmit:d},null,8,["event-emitter","settings","cart-item"])):n.editor==="sandwich"?(t.openBlock(),t.createBlock(Uu,{key:4,"event-emitter":n.eventEmitter,settings:n.settings,"cart-item":o.value,"onClick:viewSwitch":f,onSubmit:d},null,8,["event-emitter","settings","cart-item"])):n.editor==="sandwich_m2"?(t.openBlock(),t.createBlock(Gu,{key:5,"event-emitter":n.eventEmitter,settings:n.settings,"cart-items":l.value,"onClick:viewSwitch":f,onSubmit:u},null,8,["event-emitter","settings","cart-items"])):t.createCommentVNode("",!0)])])):(t.openBlock(),t.createElementBlock("div",J_,' Конфигуратор "'+t.toDisplayString(n.editor)+'" не поддерживается. ',1))],64)}}});function Qu(n){return Object.values(W.ConfiguratorsEnum).includes(n)}function Ju(n){var e;return((e=n.properties)==null?void 0:e.configurator)!==W.ConfiguratorsEnum.Sandwich?!0:n.properties.configuratorSettings!==void 0&&V.isArray(n.products)&&n.products.length>0}const tw={key:0,class:"pt-0.5"},nw={key:0},iw={key:1},rw={class:"flex flex-row gap-1"},ow={key:0},sw={class:"m-0 list-inside list-disc p-0 pl-1.5 text-xs text-gray-500"},aw={class:"flex flex-col gap-2.5 sm:flex-row"},lw={key:0,class:"header-extra"},cw={class:"inline-flex"},dw={class:"inline-flex"},uw={class:"inline-flex"},fw={class:"mt-2"},hw={key:1,class:"flex flex-col"},mw={},pw=t.defineComponent({...mw,__name:"category-collapse-item",props:{categoryItem:{},filteredItems:{},isCategoryItemSelected:{type:[Boolean,String,Function],default:void 0},showCategoryHideForClientButton:{type:[Boolean,String,Function],default:!1},showCategoryRequiredButton:{type:[Boolean,String,Function],default:!1},showCategoryPinButton:{type:[Boolean,String,Function],default:!1},showCategoryEditButton:{type:[Boolean,String,Function],default:!1},categoryContextButtonsConfig:{type:Function,default:void 0},showConfigurator:{type:[Boolean,Function],default:!1},canShowConfigurator:{type:[Boolean,Function],default:!1},eventEmitter:{},showSlugs:{type:Boolean,default:!1},showProperties:{type:Boolean,default:!1},showProductCosts:{type:[Boolean,Function],default:!1},allowNameClick:{type:[Boolean,Function],default:!1},allowPriceClick:{type:[Boolean,Function],default:!1},showProductInfoButton:{type:[Boolean,Function],default:!1},showPriceHistory:{type:[Boolean,Function],default:!1},showCostDate:{type:[Boolean,Function],default:!1},isProductItemSelected:{type:Function,default:void 0},showProductAddToCartButton:{type:[Boolean,String,Function],default:!1},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function],default:!1},currencyRates:{},productContextButtonsConfig:{type:Function,default:void 0}},setup(n){const e=n,i=t.inject(Rr,"medium"),r=uo(),o=t.computed(()=>{var oe;return(oe=e==null?void 0:e.filteredItems)==null?void 0:oe[e.categoryItem.id]}),s=t.computed(()=>{var oe,fe;return V.isArray((oe=e.categoryItem)==null?void 0:oe.categories)&&((fe=e.categoryItem.categories)==null?void 0:fe.length)>0}),a=t.computed(()=>{var oe;return V.isArray((oe=e.categoryItem)==null?void 0:oe.products)?e.categoryItem.products:[]}),l=t.computed(()=>Object.entries(e.categoryItem.currencyRates??{}).map(([oe,fe])=>`${fe} руб./${O(oe)}`).join(", ")),c=t.computed(()=>V.isUndefined(e.filteredItems)||o.value==="*"?a.value:a.value.filter(oe=>{var ge;const fe=(ge=o.value)==null?void 0:ge.products;return V.isArray(fe)&&fe.includes(oe.id)})),d=t.computed(()=>c.value.length>0),u=t.computed(()=>V.isFunction(e.showCategoryHideForClientButton)?e.showCategoryHideForClientButton(e.categoryItem):e.showCategoryHideForClientButton),f=t.computed(()=>V.isFunction(e.showCategoryPinButton)?e.showCategoryPinButton(e.categoryItem):e.showCategoryPinButton),h=t.computed(()=>V.isFunction(e.showCategoryRequiredButton)?e.showCategoryRequiredButton(e.categoryItem):e.showCategoryRequiredButton),p=t.computed(()=>{var ge,_e;const oe=(ge=w.value)==null?void 0:ge.hidingComment,fe=(_e=w.value)!=null&&_e.isDisabled?`Скрыто для клиента${oe?`. Причина: '${oe}'`:""}`:"Видимо клиенту";return u.value==="disabled"?`${fe}. ${Nr}`:fe}),m=t.computed(()=>{var ge;const oe=(ge=w.value)==null?void 0:ge.manager,fe=oe?`Категория закреплена за "${oe.name??"-"}"`:"Закрепить";return f.value==="disabled"?`${fe}. ${Nr}`:fe}),g=t.computed(()=>h.value==="disabled"?`${$s}. ${Nr}`:$s),b=t.computed(()=>V.isFunction(e.showCategoryEditButton)?e.showCategoryEditButton(e.categoryItem):e.showCategoryEditButton),y=t.computed(()=>{var oe,fe,ge;return((oe=e.categoryItem.properties)==null?void 0:oe.configurator)!==void 0&&Qu((fe=e.categoryItem.properties)==null?void 0:fe.configurator)&&Ju(e.categoryItem)&&((ge=e.categoryItem.properties)==null?void 0:ge.configuratorSettings)!==void 0&&(V.isFunction(e.canShowConfigurator)?e.canShowConfigurator():e.canShowConfigurator)}),_=t.computed(()=>y.value&&(V.isFunction(e.showConfigurator)?e.showConfigurator(e.categoryItem):e.showConfigurator)),x=t.computed(()=>V.isNil(e.categoryContextButtonsConfig)?[]:V.isFunction(e.categoryContextButtonsConfig)?e.categoryContextButtonsConfig(e.categoryItem):e.categoryContextButtonsConfig),w=t.computed(()=>new W.ClientCategory(e.categoryItem)),C=t.ref(!1),N=t.ref(!1),k=t.computed(()=>!V.isUndefined(e.isCategoryItemSelected)),$=t.computed(()=>V.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem):e.isCategoryItemSelected===!0),v=t.computed(()=>V.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem)==="disabled":e.isCategoryItemSelected==="disabled"),E=t.computed(()=>V.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem)==="indeterminate":e.isCategoryItemSelected==="indeterminate"),P=t.computed(()=>L.value&&Ue.getDeviceTypeByResolution()===Xe.laptop?"auto":"fixed"),F=t.useTemplateRef("collapse-item-reference"),R=t.computed(()=>{var oe,fe;return(fe=(oe=e.categoryItem.properties)==null?void 0:oe.templateCost)==null?void 0:fe.priceCoefficient}),M=t.computed(()=>{var oe,fe;return(fe=(oe=e.categoryItem.properties)==null?void 0:oe.templateCost)==null?void 0:fe.increasePercent}),X=t.computed(()=>vi.isM2Category(e.categoryItem)?vi.findReferenceProduct(e.categoryItem):void 0),G=t.computed(()=>X.value?vi.calculateM2Cost(X.value,R.value,M.value):void 0),Z=t.computed(()=>{var oe,fe;return`${((fe=(oe=X.value)==null?void 0:oe.currency)==null?void 0:fe.symbol)??""}/м²`}),O=(oe,fe="ru-RU")=>0 .toLocaleString(fe,{style:"currency",currency:oe,minimumFractionDigits:0,maximumFractionDigits:0}).replaceAll(/\d/g,"").trim(),A=oe=>{e.eventEmitter.emit("category:checked",{category:e.categoryItem,checked:oe,target:F.value})},Y=(oe,fe)=>{e.eventEmitter.emit("category:header-click",{categoryItem:e.categoryItem,expanded:fe,isLoadingState:C,target:F.value})},H=()=>{e.eventEmitter.emit("category:hide",{category:e.categoryItem,target:F.value})},T=()=>{e.eventEmitter.emit("category:required",{category:e.categoryItem,target:F.value})},D=()=>{e.eventEmitter.emit("category:attach",{category:e.categoryItem,target:F.value})},K=()=>{e.eventEmitter.emit("category:detach",{category:e.categoryItem,target:F.value})},J=()=>{e.eventEmitter.emit("category:edit",{category:e.categoryItem,target:F.value})},U=oe=>{e.eventEmitter.emit("category:context-select",{category:e.categoryItem,key:oe,target:F.value})},q=()=>{e.eventEmitter.emit("configurator:click-view-switch",{category:e.categoryItem})},L=t.ref(0),le=t.computed(()=>L.value&&a.value.length>0?sy(a.value,{eventEmitter:e.eventEmitter,showSlugs:e.showSlugs,showProperties:e.showProperties,showProductCosts:e.showProductCosts,allowNameClick:e.allowNameClick,allowPriceClick:e.allowPriceClick,showPriceHistory:e.showPriceHistory,showCostDate:e.showCostDate,showProductInfoButton:e.showProductInfoButton,showProductAddToCartButton:e.showProductAddToCartButton,isProductItemSelected:e.isProductItemSelected,showProductEditButton:e.showProductEditButton,showProductRequiredButton:e.showProductRequiredButton,currencyRates:e.categoryItem.currencyRates,productContextButtonsConfig:e.productContextButtonsConfig}):[]),ue=V.debounce(()=>{L.value=window.innerWidth},20);return t.onUnmounted(()=>{window.removeEventListener("resize",ue),ue.cancel()}),window.addEventListener("resize",ue),ue(),(oe,fe)=>{const ge=I.NCheckbox,_e=_p,Qe=I.NTooltip,Re=gp,Mt=I.NTag,vn=hp,It=dp,en=I.NButton,Ln=ap,mn=rc,_t=ic,ae=nc,de=Is,Ge=I.NDropdown,Ui=I.NDataTable,oi=I.NAlert,si=I.NSpin;return t.openBlock(),t.createBlock(oc,{ref:"collapse-item-reference",name:n.categoryItem.id,"data-id":n.categoryItem.id,"onHeader:click":Y},{"pre-arrow":t.withCtx(()=>{var at,qe;return[k.value?(t.openBlock(),t.createElementBlock("div",tw,[t.createVNode(ge,{checked:$.value,indeterminate:E.value,disabled:v.value,"onUpdate:checked":A},null,8,["checked","indeterminate","disabled"])])):t.createCommentVNode("",!0),!u.value&&((at=w.value)!=null&&at.isDisabled)?(t.openBlock(),t.createBlock(Qe,{key:1,placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>[t.createVNode(_e,{class:"pt-1.5"})]),default:t.withCtx(()=>[fe[1]||(fe[1]=t.createTextVNode(" Категория скрыта для клиента ",-1))]),_:1})):t.createCommentVNode("",!0),((qe=w.value)==null?void 0:qe.isFavorite)??!1?(t.openBlock(),t.createBlock(Qe,{key:2,placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>[t.createVNode(Re,{class:"pt-1.5"})]),default:t.withCtx(()=>[fe[2]||(fe[2]=t.createTextVNode(" Избранная категория ",-1))]),_:1})):t.createCommentVNode("",!0)]}),header:t.withCtx(()=>{var at,qe,on,sn;return[t.createElementVNode("div",{class:t.normalizeClass({"text-base font-semibold uppercase":!0,"text-gray-400 line-through":n.categoryItem.isHidden,"text-gray-400":(at=w.value)==null?void 0:at.isDisabled})},[t.createVNode(Qe,{disabled:!n.categoryItem.isHidden,placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>[t.createElementVNode("span",null,t.toDisplayString(n.categoryItem.name),1)]),default:t.withCtx(()=>[fe[3]||(fe[3]=t.createTextVNode(" Категория скрыта ",-1))]),_:1},8,["disabled"])],2),t.createElementVNode("div",{class:"w-fit",onClick:fe[0]||(fe[0]=t.withModifiers((...lt)=>t.unref(V.noop)&&t.unref(V.noop)(...lt),["prevent","stop"]))},[(qe=n.categoryItem.properties)!=null&&qe.templateCost?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[R.value||M.value||!t.unref(V.isNil)(G.value)?(t.openBlock(),t.createBlock(Mt,{key:0,size:t.unref(i),round:""},{default:t.withCtx(()=>{var lt;return[R.value?(t.openBlock(),t.createElementBlock("span",nw,t.toDisplayString((lt=R.value)==null?void 0:lt.name),1)):t.createCommentVNode("",!0),M.value?(t.openBlock(),t.createElementBlock("span",iw,t.toDisplayString(M.value>0?"+":"")+t.toDisplayString(t.unref(Ve).formatPercent(M.value))+"%",1)):t.createCommentVNode("",!0),t.unref(V.isNil)(G.value)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("span",{key:2,class:t.normalizeClass({"ml-1":R.value||M.value})},t.toDisplayString(G.value.toFixed(2))+" "+t.toDisplayString(Z.value),3))]}),_:1},8,["size"])):t.createCommentVNode("",!0)],64)):(on=n.categoryItem.properties)!=null&&on.m2Price?(t.openBlock(),t.createBlock(Mt,{key:1,size:t.unref(i),round:""},{default:t.withCtx(()=>[t.createTextVNode(" Установленная стоимость: "+t.toDisplayString(n.categoryItem.properties.m2Price)+" руб./м2 ",1)]),_:1},8,["size"])):t.createCommentVNode("",!0),l.value?(t.openBlock(),t.createBlock(Mt,{key:2,size:t.unref(i),round:""},{default:t.withCtx(()=>[t.createTextVNode(" Фиксированный курс: "+t.toDisplayString(l.value),1)]),_:1},8,["size"])):t.createCommentVNode("",!0),f.value&&((sn=w.value)!=null&&sn.manager)?(t.openBlock(),t.createBlock(Mt,{key:3,size:t.unref(i),closable:f.value!=="disabled",round:"",class:"align-bottom",onClose:K},{default:t.withCtx(()=>[t.createVNode(Qe,{placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>{var lt,jt;return[t.createElementVNode("span",rw,[t.createVNode(vn),t.createTextVNode(" "+t.toDisplayString((jt=(lt=w.value)==null?void 0:lt.manager)==null?void 0:jt.name),1)])]}),default:t.withCtx(()=>{var lt,jt;return[t.createTextVNode(' Категория закреплена за "'+t.toDisplayString((jt=(lt=w.value)==null?void 0:lt.manager)==null?void 0:jt.name)+'" ',1)]}),_:1})]),_:1},8,["size","closable"])):t.createCommentVNode("",!0)])]}),"sub-header":t.withCtx(()=>[n.showSlugs||n.showProperties?(t.openBlock(),t.createElementBlock("div",ow,[t.createElementVNode("ul",sw,[n.showSlugs?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList({id:n.categoryItem.id,slug:n.categoryItem.slug},(at,qe)=>(t.openBlock(),t.createElementBlock("li",{key:qe}," ("+t.toDisplayString(qe)+"): "+t.toDisplayString(at),1))),128)):t.createCommentVNode("",!0),n.showProperties?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:1},t.renderList(n.categoryItem.properties,(at,qe)=>(t.openBlock(),t.createElementBlock("li",{key:qe}," ("+t.toDisplayString(qe)+"): "+t.toDisplayString(at),1))),128)):t.createCommentVNode("",!0)])])):t.createCommentVNode("",!0)]),"header-extra":t.withCtx(()=>{var at;return[t.createElementVNode("div",aw,[oe.$slots["header-extra"]?(t.openBlock(),t.createElementBlock("div",lw,[t.renderSlot(oe.$slots,"header-extra",{categoryItem:n.categoryItem},void 0,!0)])):t.createCommentVNode("",!0),u.value?(t.openBlock(),t.createBlock(Qe,{key:1,placement:"bottom",trigger:"hover",disabled:!t.unref(r)&&u.value!=="disabled"},{trigger:t.withCtx(()=>[t.createElementVNode("span",cw,[t.createVNode(en,{ghost:!0,disabled:u.value==="disabled",size:t.unref(i),onClick:H},{default:t.withCtx(()=>{var qe;return[(qe=w.value)!=null&&qe.isDisabled?(t.openBlock(),t.createBlock(_e,{key:1})):(t.openBlock(),t.createBlock(It,{key:0}))]}),_:1},8,["disabled","size"])])]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(p.value),1)]),_:1},8,["disabled"])):t.createCommentVNode("",!0),f.value&&!((at=w.value)!=null&&at.manager)?(t.openBlock(),t.createBlock(Qe,{key:2,placement:"bottom",trigger:"hover",disabled:!t.unref(r)&&f.value!=="disabled"},{trigger:t.withCtx(()=>[t.createElementVNode("span",dw,[t.createVNode(en,{ghost:!0,disabled:f.value==="disabled",size:t.unref(i),onClick:D},{default:t.withCtx(()=>[t.createVNode(Ln)]),_:1},8,["disabled","size"])])]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(m.value),1)]),_:1},8,["disabled"])):t.createCommentVNode("",!0),h.value?(t.openBlock(),t.createBlock(Qe,{key:3,placement:"bottom",trigger:"hover",disabled:!t.unref(r)&&h.value!=="disabled"},{trigger:t.withCtx(()=>[t.createElementVNode("span",uw,[t.createVNode(en,{ghost:!0,disabled:h.value==="disabled",size:t.unref(i),onClick:T},{default:t.withCtx(()=>{var qe;return[(qe=w.value)!=null&&qe.isRequired?(t.openBlock(),t.createBlock(_t,{key:1})):(t.openBlock(),t.createBlock(mn,{key:0}))]}),_:1},8,["disabled","size"])])]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(g.value),1)]),_:1},8,["disabled"])):t.createCommentVNode("",!0),b.value?(t.openBlock(),t.createBlock(Qe,{key:4,placement:"bottom",trigger:"hover",disabled:!t.unref(r)},{trigger:t.withCtx(()=>[t.createVNode(en,{ghost:!0,size:t.unref(i),type:"primary",onClick:J},{default:t.withCtx(()=>[t.createVNode(ae)]),_:1},8,["size"])]),default:t.withCtx(()=>[fe[4]||(fe[4]=t.createTextVNode(" Редактировать ",-1))]),_:1},8,["disabled"])):t.createCommentVNode("",!0),x.value.length>0?(t.openBlock(),t.createBlock(Ge,{key:5,options:x.value,size:t.unref(i),trigger:"click",onSelect:U},{default:t.withCtx(()=>[t.createVNode(en,{ghost:!0,size:t.unref(i),type:"primary"},{default:t.withCtx(()=>[t.createVNode(de)]),_:1},8,["size"])]),_:1},8,["options","size"])):t.createCommentVNode("",!0)])]}),default:t.withCtx(()=>[t.renderSlot(oe.$slots,"default",{},()=>{var at,qe,on;return[t.createElementVNode("div",fw,[s.value?(t.openBlock(),t.createBlock(tf,{key:0,"categories-items":n.categoryItem.categories??[],"has-products":d.value||C.value,"event-emitter":n.eventEmitter,"filtered-items":o.value?((at=o.value)==null?void 0:at.categories)??{}:void 0,"is-category-item-selected":n.isCategoryItemSelected,"show-slugs":n.showSlugs,"show-properties":n.showProperties,"allow-name-click":n.allowNameClick,"allow-price-click":n.allowPriceClick,"show-price-history":n.showPriceHistory,"show-cost-date":n.showCostDate,"show-product-info-button":n.showProductInfoButton,"show-category-required-button":n.showCategoryRequiredButton,"show-category-hide-for-client-button":n.showCategoryHideForClientButton,"show-category-pin-button":n.showCategoryPinButton,"show-category-edit-button":n.showCategoryEditButton,"category-context-buttons-config":n.categoryContextButtonsConfig,"is-product-item-selected":n.isProductItemSelected,"show-product-add-to-cart-button":n.showProductAddToCartButton,"show-product-costs":n.showProductCosts,"show-product-required-button":n.showProductRequiredButton,"show-product-edit-button":n.showProductEditButton,"product-context-buttons-config":n.productContextButtonsConfig,"show-configurator":n.showConfigurator,"can-show-configurator":n.canShowConfigurator},t.createSlots({_:2},[oe.$slots["header-extra"]?{name:"header-extra",fn:t.withCtx(({categoryItem:sn})=>[t.renderSlot(oe.$slots,"header-extra",{categoryItem:sn},void 0,!0)]),key:"0"}:void 0]),1032,["categories-items","has-products","event-emitter","filtered-items","is-category-item-selected","show-slugs","show-properties","allow-name-click","allow-price-click","show-price-history","show-cost-date","show-product-info-button","show-category-required-button","show-category-hide-for-client-button","show-category-pin-button","show-category-edit-button","category-context-buttons-config","is-product-item-selected","show-product-add-to-cart-button","show-product-costs","show-product-required-button","show-product-edit-button","product-context-buttons-config","show-configurator","can-show-configurator"])):t.createCommentVNode("",!0)]),y.value&&_.value?(t.openBlock(),t.createBlock(Zu,{key:0,"event-emitter":n.eventEmitter,settings:(qe=n.categoryItem.properties)==null?void 0:qe.configuratorSettings,editor:(on=n.categoryItem.properties)==null?void 0:on.configurator,category:n.categoryItem},null,8,["event-emitter","settings","editor","category"])):d.value?(t.openBlock(),t.createElementBlock("div",hw,[y.value?(t.openBlock(),t.createBlock(en,{key:0,color:"#bdbdbd",strong:"",class:"self-end p-2",onClick:q},{default:t.withCtx(()=>[...fe[5]||(fe[5]=[t.createTextVNode(" Назад в Конфигуратор ",-1)])]),_:1})):t.createCommentVNode("",!0),t.createVNode(Ui,{columns:le.value,data:c.value,bordered:!0,loading:C.value,remote:!0,"row-key":sn=>sn.id,"table-layout":P.value,class:"mt-2"},null,8,["columns","data","loading","row-key","table-layout"])])):t.createCommentVNode("",!0),!C.value&&!N.value&&!s.value&&!d.value?(t.openBlock(),t.createBlock(oi,{key:2,"show-icon":!0,type:"warning",title:"Категория пуста",class:"mx-10"})):t.createCommentVNode("",!0),N.value?(t.openBlock(),t.createBlock(oi,{key:3,"show-icon":!0,type:"error",title:"При получении данных произошла ошибка",class:"mx-10"})):t.createCommentVNode("",!0),C.value?(t.openBlock(),t.createBlock(si,{key:4,size:t.unref(i),class:"w-full"},{description:t.withCtx(()=>[...fe[6]||(fe[6]=[t.createElementVNode("div",null,"Выполняется загрузка данных ...",-1)])]),_:1},8,["size"])):t.createCommentVNode("",!0)]},!0)]),_:3},8,["name","data-id"])}}}),gw=gn(pw,[["__scopeId","data-v-9ed22ab1"]]),yw={class:"sc-collapse flex w-full flex-col"},bw={},ef=t.defineComponent({...bw,__name:"collapse",props:{defaultExpandedNames:{default:()=>[]},expandedNames:{default:()=>[]}},emits:["on-item-header-click"],setup(n,{emit:e}){const i=n,r=e,o=(s,a)=>{r("on-item-header-click",s,a)};return t.provide("itemHeaderClickHandler",o),t.provide("defaultExpandedNames",i.defaultExpandedNames),t.provide("expandedNames",i.expandedNames),(s,a)=>(t.openBlock(),t.createElementBlock("div",yw,[t.renderSlot(s.$slots,"default")]))}}),_w={},tf=t.defineComponent({..._w,__name:"category-collapse",props:{categoriesItems:{},hasProducts:{type:Boolean},loading:{type:Boolean,default:!1},client:{default:void 0},filteredItems:{default:void 0},isCategoryItemSelected:{type:[Boolean,String,Function],default:void 0},showCategoryHideForClientButton:{type:[Boolean,String,Function]},showCategoryRequiredButton:{type:[Boolean,String,Function]},showCategoryPinButton:{type:[Boolean,String,Function]},showCategoryEditButton:{type:[Boolean,String,Function],default:!1},categoryContextButtonsConfig:{type:Function,default:void 0},showConfigurator:{type:[Boolean,Function]},canShowConfigurator:{type:[Boolean,Function]},eventEmitter:{},showSlugs:{type:Boolean,default:!1},showProperties:{type:Boolean,default:!1},showProductCosts:{type:[Boolean,Function],default:!1},allowNameClick:{type:[Boolean,Function],default:!1},allowPriceClick:{type:[Boolean,Function],default:!1},showProductInfoButton:{type:[Boolean,Function],default:!1},showPriceHistory:{type:[Boolean,Function],default:!1},showCostDate:{type:[Boolean,Function],default:!1},isProductItemSelected:{type:Function,default:void 0},showProductAddToCartButton:{type:[Boolean,String,Function],default:!1},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function],default:!1},currencyRates:{},productContextButtonsConfig:{type:Function,default:void 0}},setup(n){const e=n,i=t.inject(Rr,"medium"),r=t.computed(()=>V.isUndefined(e.filteredItems)?e.categoriesItems:e.categoriesItems.filter(s=>{var a;return!!((a=e.filteredItems)!=null&&a[s.id])})),o=(s,a)=>{if(V.isUndefined(a))return;const l=a[s.id];if(l==="*")return;const c={};return c[s.id]=structuredClone(t.toRaw(l)),c};return(s,a)=>{const l=I.NSpin,c=I.NAlert;return t.openBlock(),t.createElementBlock(t.Fragment,null,[r.value.length>0?(t.openBlock(),t.createBlock(ef,{key:0},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,d=>(t.openBlock(),t.createBlock(gw,{key:d.id,"category-item":d,"event-emitter":n.eventEmitter,"filtered-items":o(d,n.filteredItems),"is-category-item-selected":n.isCategoryItemSelected,"show-slugs":n.showSlugs,"show-properties":n.showProperties,"allow-name-click":n.allowNameClick,"allow-price-click":n.allowPriceClick,"show-price-history":n.showPriceHistory,"show-cost-date":n.showCostDate,"show-product-info-button":n.showProductInfoButton,"show-category-required-button":n.showCategoryRequiredButton,"show-category-hide-for-client-button":n.showCategoryHideForClientButton,"show-category-pin-button":n.showCategoryPinButton,"show-category-edit-button":n.showCategoryEditButton,"category-context-buttons-config":n.categoryContextButtonsConfig,"is-product-item-selected":n.isProductItemSelected,"show-product-add-to-cart-button":n.showProductAddToCartButton,"show-product-costs":n.showProductCosts,"show-product-required-button":n.showProductRequiredButton,"show-product-edit-button":n.showProductEditButton,"product-context-buttons-config":n.productContextButtonsConfig,"show-configurator":n.showConfigurator,"can-show-configurator":n.canShowConfigurator},t.createSlots({_:2},[s.$slots["header-extra"]?{name:"header-extra",fn:t.withCtx(({categoryItem:u})=>[t.renderSlot(s.$slots,"header-extra",{categoryItem:u})]),key:"0"}:void 0]),1032,["category-item","event-emitter","filtered-items","is-category-item-selected","show-slugs","show-properties","allow-name-click","allow-price-click","show-price-history","show-cost-date","show-product-info-button","show-category-required-button","show-category-hide-for-client-button","show-category-pin-button","show-category-edit-button","category-context-buttons-config","is-product-item-selected","show-product-add-to-cart-button","show-product-costs","show-product-required-button","show-product-edit-button","product-context-buttons-config","show-configurator","can-show-configurator"]))),128))]),_:3})):n.loading?(t.openBlock(),t.createBlock(l,{key:1,size:t.unref(i),class:"w-full"},{description:t.withCtx(()=>[...a[0]||(a[0]=[t.createElementVNode("div",null,"Выполняется загрузка данных ...",-1)])]),_:1},8,["size"])):t.createCommentVNode("",!0),!n.hasProducts&&!n.loading&&n.categoriesItems.length>0&&r.value.length===0?(t.openBlock(),t.createBlock(c,{key:2,"show-icon":!0,type:"warning",title:"Товары не найдены",class:"mx-10"})):t.createCommentVNode("",!0)],64)}}}),ww={},nf=t.defineComponent({...ww,__name:"reference-select",props:{value:{default:void 0},clearable:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},consistentMenuWidth:{type:Boolean,default:!0},wrapContent:{type:Boolean,default:!1},referenceList:{default:()=>[]},showEmptyValue:{type:Boolean,default:!1},sortOptionsByLabel:{type:Boolean,default:!1},filterable:{type:Boolean,default:!1},maxTagCount:{default:void 0},disabledItem:{type:Function,default:void 0}},emits:["update:value"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.computed(()=>V.isArray(r.value)),a=new W.Reference,l=t.computed(()=>V.isNil(r.value)?s.value?[]:null:V.isArray(r.value)?r.value.filter(m=>!V.isNil(m)).map(m=>m.id):r.value.id),c=t.computed(()=>wt.convertReferencesToSelectOptionsList(r.referenceList,r.sortOptionsByLabel,!1,r.showEmptyValue,void 0,r.disabledItem)),d=t.computed(()=>c.value.map(m=>({...m,class:r.wrapContent?`${m.class} consistent-menu-width`:m.class}))),u=m=>{var g;if(V.isArray(m)){const b=m.length>0?m.map(y=>{var _;return(_=c.value.find(x=>x.value===y))==null?void 0:_.item}).filter(y=>!V.isNil(y)):[];o("update:value",b)}else{const b=m===a.id||V.isNil(m)||(g=c.value.find(y=>y.value===m))==null?void 0:g.item;o("update:value",b)}},f=t.useTemplateRef("select-component");return e({focus:()=>{var m;return(m=f.value)==null?void 0:m.focus()},blur:()=>{var m;return(m=f.value)==null?void 0:m.blur()}}),(m,g)=>(t.openBlock(),t.createBlock(t.unref(I.NSelect),{ref:"select-component",value:l.value,clearable:r.clearable,"consistent-menu-width":n.consistentMenuWidth,disabled:n.disabled||c.value.length===0,filterable:n.filterable,"max-tag-count":n.maxTagCount,multiple:s.value,options:d.value,placeholder:"",class:"w-full","onUpdate:value":u},null,8,["value","clearable","consistent-menu-width","disabled","filterable","max-tag-count","multiple","options"]))}}),xw={},kw=t.defineComponent({...xw,__name:"set-client-price-form-item",props:{value:{},clearable:{type:Boolean},feedback:{},validationStatus:{},disabled:{type:Boolean},catalogItem:{},calculationType:{},label:{},m2ReferenceProduct:{},disabledCoefficient:{type:Function},visibleCoefficient:{type:Function}},emits:["update:value"],setup(n,{emit:e}){var E,P;const i=n,r=e,o=()=>{const F=W.PriceCoefficient.getRetailPriceCoefficient();return V.unset(F,"isNewRec"),F},s=F=>!F||F.id===o().id,a=t.computed(()=>{var F;return((F=i.catalogItem)==null?void 0:F.type)==="product"}),l=t.computed(()=>!a.value&&!V.isNil(i.m2ReferenceProduct)),c=t.computed(()=>a.value?i.catalogItem:i.m2ReferenceProduct),d=t.computed(()=>!V.isNil(c.value)),u=t.computed(()=>{var F;return`${((F=c.value)==null?void 0:F.currency.symbol)??""}${l.value?"/м²":""}`}),f=F=>l.value&&i.m2ReferenceProduct?vi.toM2Cost(F,i.m2ReferenceProduct):F,h=t.computed(()=>c.value?f(c.value.retailCost??c.value.cost):void 0),p=t.computed(()=>{var F;return(((F=c.value)==null?void 0:F.priceCoefficients)??[]).map(R=>({...R,cost:f(R.cost)}))}),m=F=>{var R;return F.id===o().id?h.value:(R=p.value.find(M=>M.coefficient.id===F.id))==null?void 0:R.cost},g=t.computed(()=>{var M;const R=[...((M=W.useReferencesStore().priceCoefficientsReference)==null?void 0:M.map(X=>structuredClone(t.toRaw(X))))??[],o()].filter(X=>{var G;return((G=i.visibleCoefficient)==null?void 0:G.call(i,X))??!0});return d.value&&R.forEach(X=>{const G=m(X);G?X.name+=` (${V.round(G,2)} ${u.value})`:X.name=""}),R.filter(X=>X.name!=="")}),b=t.ref(i.value.coefficient),y=t.ref(((P=(E=i.value)==null?void 0:E.value)==null?void 0:P.toString())??null),_=t.ref(null),x=t.computed(()=>p.value.find(F=>F.coefficient.slug===W.PriceCoefficientEnum.K0)),w=t.ref(void 0),C=F=>Number.parseFloat((F??"").replaceAll(/[\s\u00A0\u202F]/g,"").replace(",",".")),N=()=>{var R,M;w.value=void 0;let F=C(y.value);if(F=Number.isNaN(F)?void 0:F,d.value)if(b.value||y.value){const X=o(),G=m(b.value??X)??0,Z=G+G*((F??0)/100);_.value=Ve.formatMoney(Z,(R=c.value)==null?void 0:R.currency.precision),Z>(h.value??Z)&&(w.value={validationStatus:"warning",feedback:"Устанавливается цена выше розничной цены"}),x.value&&Z<(((M=x.value)==null?void 0:M.cost)??0)&&(w.value={validationStatus:"warning",feedback:"Устанавливается цена ниже минимальной цены"})}else _.value=null;r("update:value",{value:Number.isNaN(F)?void 0:F,coefficient:s(b.value)?void 0:structuredClone(t.toRaw(b.value))})},k=F=>{V.isArray(F)||V.isNull(F)||(b.value=F,y.value=null,!b.value&&y.value&&(b.value=o()),N())},$=()=>{b.value||(b.value=o()),N()},v=F=>{var M,X;const R=C(F);if(d.value){if(Number.isNaN(R)){b.value=void 0,y.value=null,r("update:value",{value:void 0,coefficient:void 0});return}let G=0;if(R<=0)b.value=void 0,y.value=null;else if(x.value&&R<(((M=x.value)==null?void 0:M.cost)??0))b.value=(X=x.value)==null?void 0:X.coefficient,G=(R-x.value.cost)*100/x.value.cost,w.value={validationStatus:"warning",feedback:"Устанавливается цена ниже минимальной цены"};else if(R>(h.value??R)){b.value=o();const Z=h.value??0;G=(R-Z)*100/Z,w.value={validationStatus:"warning",feedback:"Устанавливается цена выше розничной цены"}}else{const Z=p.value,O=V.sortBy(Z,[H=>H.cost]),Y=O.filter(H=>H.cost<=R).at(-1)??O.at(0);Y&&(b.value=Y.coefficient,G=(R-Y.cost)*100/Y.cost),w.value={validationStatus:void 0,feedback:void 0}}G=Ve.roundPercent(G),y.value=Ve.formatPercent(G,Ve.percentFractionDigits),r("update:value",{value:Number.isNaN(G)?void 0:G,coefficient:s(b.value)?void 0:structuredClone(t.toRaw(b.value))})}else r("update:value",{value:Number.isNaN(R)?void 0:R,coefficient:void 0})};return t.onMounted(()=>{var F,R,M,X;i.calculationType===W.CalculationTypeEnum.m2Cost?_.value=((R=(F=i.value)==null?void 0:F.value)==null?void 0:R.toString())??null:!((M=i.value)!=null&&M.coefficient)&&((X=i.value)!=null&&X.value)&&(b.value=o()),N()}),(F,R)=>{var G,Z,O;const M=I.NInput,X=I.NInputGroup;return t.openBlock(),t.createBlock(t.unref(I.NFormItem),{"show-label":!t.unref(V.isNil)(n.label),label:n.label,"show-feedback":!t.unref(V.isNil)(((G=w.value)==null?void 0:G.feedback)??n.feedback),feedback:((Z=w.value)==null?void 0:Z.feedback)??n.feedback,"validation-status":((O=w.value)==null?void 0:O.validationStatus)??n.validationStatus},{default:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass([{"sm:grid-cols-3":d.value},"grid w-full grid-cols-1 gap-2"])},[n.calculationType!==t.unref(W.CalculationTypeEnum).m2Cost?(t.openBlock(),t.createBlock(X,{key:0,class:t.normalizeClass(["w-full flex-row",{"sm:col-span-2":d.value}])},{default:t.withCtx(()=>[t.createVNode(nf,{class:"w-full min-w-0 flex-1",value:b.value,"reference-list":g.value,clearable:n.clearable,disabled:n.disabled,"consistent-menu-width":!1,"show-empty-value":!0,"disabled-item":n.disabledCoefficient,"onUpdate:value":k},null,8,["value","reference-list","clearable","disabled","disabled-item"]),t.createVNode(M,{value:y.value,"onUpdate:value":[R[0]||(R[0]=A=>y.value=A),$],clearable:n.clearable,disabled:n.disabled,placeholder:"",class:"w-full min-w-0 flex-1"},t.createSlots({suffix:t.withCtx(()=>[R[3]||(R[3]=t.createTextVNode("%",-1))]),_:2},[y.value&&!y.value.startsWith("-")?{name:"prefix",fn:t.withCtx(()=>[R[2]||(R[2]=t.createTextVNode(" + ",-1))]),key:"0"}:void 0]),1032,["value","clearable","disabled"])]),_:1},8,["class"])):t.createCommentVNode("",!0),d.value||n.calculationType===t.unref(W.CalculationTypeEnum).m2Cost?(t.openBlock(),t.createBlock(M,{key:1,value:_.value,"onUpdate:value":[R[1]||(R[1]=A=>_.value=A),v],clearable:n.clearable,disabled:n.disabled,placeholder:l.value?"Стоимость за м²":"Стоимость",class:"w-full"},t.createSlots({_:2},[d.value?{name:"suffix",fn:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(u.value),1)]),key:"0"}:void 0]),1032,["value","clearable","disabled","placeholder"])):t.createCommentVNode("",!0)],2)]),_:1},8,["show-label","label","show-feedback","feedback","validation-status"])}}}),Cw={class:"text-sm"},vw={class:"text-sm"},Sw={},Bw=t.defineComponent({...Sw,__name:"add-product-to-cart-dialog",emits:["submit"],setup(n,{expose:e,emit:i}){const r=t.useTemplateRef("form-reference"),o=t.useTemplateRef("base-dialog-reference"),s=t.ref(!1),a=t.ref(null),l=t.computed(()=>{var R,M,X;return((R=a.value)==null?void 0:R.unit.isLinear)&&((X=(M=a.value)==null?void 0:M.properties)==null?void 0:X.isLengthConfigurator)}),c=t.computed(()=>a.value?W.UnitsHelper.productIsMeasurable(a.value)||l.value?"шт.":a.value.unit.name:"шт."),d=t.ref(void 0),u=t.ref(void 0),f=t.ref(!0),h=t.ref(null),p=t.computed({get:()=>{var R;return((R=h.value)==null?void 0:R.quantity)??null},set:R=>{h.value&&(h.value.quantity=R??0)}}),m=t.computed({get:()=>{var R;return((R=h.value)==null?void 0:R.length)??null},set:R=>{h.value&&(h.value.length=R??void 0)}}),g=R=>{h.value&&(h.value.marker=R??void 0)},b=i,y=()=>({length:{},quantity:{},marker:{}}),_=t.ref(y()),x=t.ref(!1),w=t.computed(()=>{var Z,O,A,Y;if(!a.value)return{};const R=W.UnitsHelper.getProductLengthMultiplicity(a.value),M=W.UnitsHelper.getProductMultiplicity(a.value),X=((O=(Z=a.value)==null?void 0:Z.properties)==null?void 0:O.minLength)||R,G=(Y=(A=a.value)==null?void 0:A.properties)==null?void 0:Y.maxLength;return{length:[ce.required,ce.min(X??.1),ce.max(G),ce.step(R),We.serverValidation(_.value.length.feedback)],quantity:[ce.required,ce.min(M),ce.step(M),We.serverValidation(_.value.quantity.feedback)],marker:[We.serverValidation(_.value.marker.feedback)]}}),C=t.computed(()=>{var R,M,X;return a.value?((R=a.value.properties)==null?void 0:R.lengthStep)??((M=a.value.properties)!=null&&M.ignoreMinCountCheck?0:((X=a.value.properties)==null?void 0:X.minCount)??0):0}),N=t.computed(()=>{var X,G,Z,O,A,Y,H,T,D;if(!a.value)return"";const R=((G=(X=a.value)==null?void 0:X.properties)==null?void 0:G.minLength)??((O=(Z=a.value)==null?void 0:Z.properties)!=null&&O.ignoreMinCountCheck?0:(Y=(A=a.value)==null?void 0:A.properties)==null?void 0:Y.minCount),M=(T=(H=a.value)==null?void 0:H.properties)==null?void 0:T.maxLength;return R||M?`(${R?`от ${R}`:""}${R&&M?" ":""}${M?`до ${M}`:""} ${(D=a.value)==null?void 0:D.unit.name})`:""}),k=R=>{var O,A;if(!((A=(O=a.value)==null?void 0:O.properties)!=null&&A.isLengthConfigurator)||!h.value||V.isNil(R)||C.value===0)return;const M=R/C.value,X=Math.round(M),G=W.UnitsHelper.getProductMultiplicity(a.value),Z=Math.max(X,G);h.value.quantity=Z},$=R=>{var Z,O,A,Y;if(!((O=(Z=a.value)==null?void 0:Z.properties)!=null&&O.isLengthConfigurator)||!h.value||V.isNil(R)||C.value===0)return;const M=Ve.multiplyByStep(R,C.value),X=((A=a.value.properties)==null?void 0:A.minLength)||W.UnitsHelper.getProductLengthMultiplicity(a.value),G=(Y=a.value.properties)==null?void 0:Y.maxLength;X!==void 0&&M<X?h.value.length=X:G!==void 0&&M>G?h.value.length=G:h.value.length=M},v=async R=>{var X;const M=V.cloneDeep(h.value);try{await((X=r.value)==null?void 0:X.validate(G=>{if(!G){if(!a.value||!M)return;W.UnitsHelper.productIsMeasurable(a.value)||delete M.length,l.value&&C.value&&(M.length=C.value),x.value=!0,b("submit",M,_.value,()=>{x.value=!1,R(!1),t.nextTick(()=>{var Z;(Z=r.value)==null||Z.validate(V.noop).catch(V.noop)})})}}))}catch{}},E=()=>{a.value=null,d.value=void 0,h.value=null,_.value=y()},P=()=>{s.value=!1};return e({show:(R,M)=>{var X,G,Z,O,A;if(E(),s.value=!0,a.value=R,d.value=M==null?void 0:M.cartItemData,u.value=M==null?void 0:M.orderId,f.value=(M==null?void 0:M.canSetDopProdaga)??!1,h.value=new W.OrderItemBase((M==null?void 0:M.cartItemData)??new W.OrderItemBase({product:R,quantity:W.UnitsHelper.productIsMeasurable(a.value)?1:((X=R==null?void 0:R.properties)==null?void 0:X.minCount)??1,length:((G=R==null?void 0:R.properties)==null?void 0:G.minLength)||((Z=R==null?void 0:R.properties)!=null&&Z.ignoreMinCountCheck?0:(O=R==null?void 0:R.properties)==null?void 0:O.minCount)||0})),(A=R==null?void 0:R.properties)!=null&&A.isLengthConfigurator&&h.value&&C.value>0){const Y=C.value,H=h.value.quantity||1;h.value.length=Ve.multiplyByStep(H,Y)}},closeDialog:P}),(R,M)=>{var A;const X=I.NFormItem,G=I.NInputGroupLabel,Z=I.NInputGroup,O=I.NCheckbox;return t.openBlock(),t.createBlock(zs,{ref:"base-dialog-reference",show:s.value,title:`${d.value?"Изменение":"Добавление"} товара ${(A=a.value)==null?void 0:A.name} в ${u.value?` заказ №${u.value}`:"корзину"}`,"accept-button":{show:!0,text:d.value?"Изменить":"Добавить"},processing:x.value,"modal-width":500,onAccept:v,onClosing:P},{default:t.withCtx(()=>[a.value&&h.value?t.withDirectives((t.openBlock(),t.createBlock(t.unref(I.NForm),{key:0,ref:"form-reference",model:h.value,rules:w.value,class:"flex flex-col gap-2 sc-hide-empty-feedback-message"},{default:t.withCtx(()=>[t.unref(W.UnitsHelper).productIsMeasurable(a.value)?(t.openBlock(),t.createBlock(X,{key:0,path:"length",label:`Метраж, ${N.value+a.value.unit.name}`},t.createSlots({default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:m.value,"onUpdate:value":[M[0]||(M[0]=Y=>m.value=Y),k],parse:t.unref(ht),step:t.unref(W.UnitsHelper).getProductLengthMultiplicity(a.value),"show-button":!1,placeholder:"Введите метраж",class:"w-full",onKeydown:M[1]||(M[1]=Y=>t.unref(fo)(Y,".",!1)),onInput:M[2]||(M[2]=Y=>t.unref(dt)(_.value,"length")),onFocus:t.unref(He)},null,8,["value","parse","step","onFocus"])]),_:2},[!_.value.length.feedback&&t.unref(W.UnitsHelper).getProductLengthMultiplicity(a.value)!==1?{name:"feedback",fn:t.withCtx(()=>[t.createElementVNode("span",Cw,"Метраж должно быть кратно "+t.toDisplayString(t.unref(W.UnitsHelper).getProductLengthMultiplicity(a.value)),1)]),key:"0"}:void 0]),1032,["label"])):t.createCommentVNode("",!0),t.createVNode(X,{path:"quantity",label:`Количество, ${c.value}`},{default:t.withCtx(()=>[t.createVNode(Z,null,t.createSlots({default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:p.value,"onUpdate:value":[M[3]||(M[3]=Y=>p.value=Y),$],parse:t.unref(ht),step:t.unref(W.UnitsHelper).getProductMultiplicity(a.value),"show-button":t.unref(W.UnitsHelper).getProductMultiplicity(a.value)>1,"button-placement":"both",placeholder:"Введите количество",class:"w-full",onKeydown:M[4]||(M[4]=Y=>t.unref(fo)(Y,".",!1)),onInput:M[5]||(M[5]=Y=>t.unref(dt)(_.value,"quantity")),onFocus:t.unref(He)},null,8,["value","parse","step","show-button","onFocus"]),l.value?(t.openBlock(),t.createBlock(G,{key:0,class:"bg-orange-100 font-bold"},{default:t.withCtx(()=>[t.createTextVNode(" x "+t.toDisplayString(C.value)+" "+t.toDisplayString(a.value.unit.name),1)]),_:1})):t.createCommentVNode("",!0)]),_:2},[!_.value.quantity.feedback&&t.unref(W.UnitsHelper).getProductMultiplicity(a.value)!==1?{name:"feedback",fn:t.withCtx(()=>[t.createElementVNode("span",vw,"Количество должно быть кратно "+t.toDisplayString(t.unref(W.UnitsHelper).getProductMultiplicity(a.value)),1)]),key:"0"}:void 0]),1024)]),_:1},8,["label"]),t.unref(W.UnitsHelper).productIsMeasurable(a.value)?(t.openBlock(),t.createBlock(X,{key:1,path:"marker",label:"Маркировка"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInput),{value:h.value.marker??null,placeholder:"Введите маркировку",onInput:M[6]||(M[6]=Y=>t.unref(dt)(_.value,"marker")),"onUpdate:value":M[7]||(M[7]=Y=>g(Y)),onFocus:t.unref(He)},null,8,["value","onFocus"])]),_:1})):t.createCommentVNode("",!0),f.value?(t.openBlock(),t.createBlock(O,{key:2,checked:h.value.isAdditionalSale,"onUpdate:checked":M[8]||(M[8]=Y=>h.value.isAdditionalSale=Y),"true-value":!0,"false-value":!1},{default:t.withCtx(()=>[...M[9]||(M[9]=[t.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):t.createCommentVNode("",!0)]),_:1},8,["model","rules"])),[[t.unref(ai),()=>{var Y,H;return(H=(Y=o.value)==null?void 0:Y.acceptHandler)==null?void 0:H.call(Y)}]]):t.createCommentVNode("",!0)]),_:1},8,["show","title","accept-button","processing"])}}}),Nw={class:"flex flex-row gap-1"},Tw={class:"sc-client-name flex flex-col gap-1 text-base"},$w=["href"],Ew={key:1,class:"text-sc-grey"},Rw={key:0,class:"text-sc-dark-grey sc-client-city text-sm"},Pw={key:0},Fw={key:1,class:"text-sm"},Vw={},Dr=t.defineComponent({...Vw,__name:"client-name-with-short-info",props:{client:{},nameLink:{default:void 0},popoverPosition:{default:void 0},showCityAndRegion:{type:Boolean,default:!0},showSalesDirection:{type:Boolean,default:!1},showClientInfoIcon:{type:Boolean,default:!1}},emits:["click:client-name","click:client-info"],setup(n,{emit:e}){const i=n,r=e,o=t.computed(()=>i.client.lastLoginAt?Be.format(i.client.lastLoginAt,W.useBaseConfigStateStore().config.dateFormats.uiDateWithTime):""),s=a=>{V.isNil(i.nameLink)&&(a.preventDefault(),a.stopPropagation()),r("click:client-name",i.client,a)};return(a,l)=>{const c=ho,d=I.NButton,u=I.NPopover;return t.openBlock(),t.createElementBlock("div",Nw,[n.showClientInfoIcon?(t.openBlock(),t.createBlock(d,{key:0,quaternary:"",size:"small",onClick:l[0]||(l[0]=f=>a.$emit("click:client-info",n.client))},{default:t.withCtx(()=>[t.createVNode(c)]),_:1})):t.createCommentVNode("",!0),t.createVNode(u,{disabled:t.unref(V.isNil)(n.popoverPosition),placement:n.popoverPosition},{trigger:t.withCtx(()=>[t.createElementVNode("div",Tw,[t.createElementVNode("a",{href:n.nameLink??"#",class:"text-base no-underline",onClick:l[1]||(l[1]=f=>s(f))},[t.createElementVNode("span",{class:t.normalizeClass({"line-through":!n.client.isActive})},t.toDisplayString(n.client.name),3),n.showSalesDirection&&n.client.salesDirection?(t.openBlock(),t.createElementBlock("span",{key:0,class:t.normalizeClass({"line-through":!n.client.isActive})}," ("+t.toDisplayString(n.client.salesDirection.name)+") ",3)):t.createCommentVNode("",!0),n.client.isActive?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("span",Ew," [ Деактивирован ] "))],8,$w),n.showCityAndRegion&&n.client.city?(t.openBlock(),t.createElementBlock("span",Rw," г. "+t.toDisplayString(n.client.city.name)+", "+t.toDisplayString(n.client.city.region.name),1)):t.createCommentVNode("",!0)])]),default:t.withCtx(()=>[n.client.alternativeName?(t.openBlock(),t.createElementBlock("div",Pw,t.toDisplayString(n.client.alternativeName),1)):t.createCommentVNode("",!0),o.value?(t.openBlock(),t.createElementBlock("span",Fw," Последний вход: "+t.toDisplayString(o.value),1)):t.createCommentVNode("",!0),t.renderSlot(a.$slots,"popover-content")]),_:3},8,["disabled","placement"])])}}}),Mw={class:"text-base"},Iw={},rf=t.defineComponent({...Iw,__name:"contragent-with-short-info",props:{contragent:{}},setup(n){const e=n,i=t.computed(()=>li.getFormatEntityName(e.contragent));return(r,o)=>(t.openBlock(),t.createElementBlock("span",Mw,t.toDisplayString(i.value),1))}}),Aw={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Ow(n,e){return t.openBlock(),t.createElementBlock("svg",Aw,[...e[0]||(e[0]=[t.createElementVNode("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[t.createElementVNode("path",{d:"M3 7a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}),t.createElementVNode("path",{d:"m3 7l9 6l9-6"})],-1)])])}const zw=t.markRaw({name:"tabler-mail",render:Ow}),Dw=["href"],Lw={},Hw=t.defineComponent({...Lw,__name:"email",props:{email:{default:""},showEmailIcon:{type:Boolean,default:!1}},setup(n){return(e,i)=>{const r=zw;return t.openBlock(),t.createElementBlock("span",{class:t.normalizeClass({"flex flex-row items-center gap-1":n.showEmailIcon})},[n.showEmailIcon?(t.openBlock(),t.createBlock(r,{key:0})):t.createCommentVNode("",!0),t.createElementVNode("a",{href:`mailto:${n.email}`,class:"no-underline"},t.toDisplayString(n.email),9,Dw)],2)}}}),Ww={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function jw(n,e){return t.openBlock(),t.createElementBlock("svg",Ww,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M444 49.9C431.3 38.2 379.9.9 265.3.4c0 0-135.1-8.1-200.9 52.3C27.8 89.3 14.9 143 13.5 209.5s-3.1 191.1 117 224.9h.1l-.1 51.6s-.8 20.9 13 25.1c16.6 5.2 26.4-10.7 42.3-27.8c8.7-9.4 20.7-23.2 29.8-33.7c82.2 6.9 145.3-8.9 152.5-11.2c16.6-5.4 110.5-17.4 125.7-142c15.8-128.6-7.6-209.8-49.8-246.5M457.9 287c-12.9 104-89 110.6-103 115.1c-6 1.9-61.5 15.7-131.2 11.2c0 0-52 62.7-68.2 79c-5.3 5.3-11.1 4.8-11-5.7c0-6.9.4-85.7.4-85.7q-.15 0 0 0C43.1 372.7 49.1 266.6 50.2 211.1s11.6-101 42.6-131.6c55.7-50.5 170.4-43 170.4-43c96.9.4 143.3 29.6 154.1 39.4c35.7 30.6 53.9 103.8 40.6 211.1m-139-80.8c.4 8.6-12.5 9.2-12.9.6c-1.1-22-11.4-32.7-32.6-33.9c-8.6-.5-7.8-13.4.7-12.9c27.9 1.5 43.4 17.5 44.8 46.2m20.3 11.3c1-42.4-25.5-75.6-75.8-79.3c-8.5-.6-7.6-13.5.9-12.9c58 4.2 88.9 44.1 87.8 92.5c-.1 8.6-13.1 8.2-12.9-.3m47 13.4c.1 8.6-12.9 8.7-12.9.1c-.6-81.5-54.9-125.9-120.8-126.4c-8.5-.1-8.5-12.9 0-12.9c73.7.5 133 51.4 133.7 139.2M374.9 329v.2c-10.8 19-31 40-51.8 33.3l-.2-.3c-21.1-5.9-70.8-31.5-102.2-56.5c-16.2-12.8-31-27.9-42.4-42.4c-10.3-12.9-20.7-28.2-30.8-46.6c-21.3-38.5-26-55.7-26-55.7c-6.7-20.8 14.2-41 33.3-51.8h.2c9.2-4.8 18-3.2 23.9 3.9c0 0 12.4 14.8 17.7 22.1c5 6.8 11.7 17.7 15.2 23.8c6.1 10.9 2.3 22-3.7 26.6l-12 9.6c-6.1 4.9-5.3 14-5.3 14s17.8 67.3 84.3 84.3c0 0 9.1.8 14-5.3l9.6-12c4.6-6 15.7-9.8 26.6-3.7c14.7 8.3 33.4 21.2 45.8 32.9c7 5.7 8.6 14.4 3.8 23.6"},null,-1)])])}const of=t.markRaw({name:"fa6-brands-viber",render:jw}),qw={viewBox:"0 0 256 258",width:"1.2em",height:"1.2em"},Xw=["id"],Yw=["id"],Uw=["fill"],Kw=["fill"];function Gw(n,e){return t.openBlock(),t.createElementBlock("svg",qw,[t.createElementVNode("defs",null,[t.createElementVNode("linearGradient",{id:n.idMap.SVGBRLHCcSy,x1:"50%",x2:"50%",y1:"100%",y2:"0%"},[...e[0]||(e[0]=[t.createElementVNode("stop",{offset:"0%","stop-color":"#1FAF38"},null,-1),t.createElementVNode("stop",{offset:"100%","stop-color":"#60D669"},null,-1)])],8,Xw),t.createElementVNode("linearGradient",{id:n.idMap.SVGHW6lecxh,x1:"50%",x2:"50%",y1:"100%",y2:"0%"},[...e[1]||(e[1]=[t.createElementVNode("stop",{offset:"0%","stop-color":"#F9F9F9"},null,-1),t.createElementVNode("stop",{offset:"100%","stop-color":"#FFF"},null,-1)])],8,Yw)]),t.createElementVNode("path",{fill:"url(#"+n.idMap.SVGBRLHCcSy+")",d:"M5.463 127.456c-.006 21.677 5.658 42.843 16.428 61.499L4.433 252.697l65.232-17.104a123 123 0 0 0 58.8 14.97h.054c67.815 0 123.018-55.183 123.047-123.01c.013-32.867-12.775-63.773-36.009-87.025c-23.23-23.25-54.125-36.061-87.043-36.076c-67.823 0-123.022 55.18-123.05 123.004"},null,8,Uw),t.createElementVNode("path",{fill:"url(#"+n.idMap.SVGHW6lecxh+")",d:"M1.07 127.416c-.007 22.457 5.86 44.38 17.014 63.704L0 257.147l67.571-17.717c18.618 10.151 39.58 15.503 60.91 15.511h.055c70.248 0 127.434-57.168 127.464-127.423c.012-34.048-13.236-66.065-37.3-90.15C194.633 13.286 162.633.014 128.536 0C58.276 0 1.099 57.16 1.071 127.416m40.24 60.376l-2.523-4.005c-10.606-16.864-16.204-36.352-16.196-56.363C22.614 69.029 70.138 21.52 128.576 21.52c28.3.012 54.896 11.044 74.9 31.06c20.003 20.018 31.01 46.628 31.003 74.93c-.026 58.395-47.551 105.91-105.943 105.91h-.042c-19.013-.01-37.66-5.116-53.922-14.765l-3.87-2.295l-40.098 10.513z"},null,8,Kw),e[2]||(e[2]=t.createElementVNode("path",{fill:"#FFF",d:"M96.678 74.148c-2.386-5.303-4.897-5.41-7.166-5.503c-1.858-.08-3.982-.074-6.104-.074c-2.124 0-5.575.799-8.492 3.984c-2.92 3.188-11.148 10.892-11.148 26.561s11.413 30.813 13.004 32.94c1.593 2.123 22.033 35.307 54.405 48.073c26.904 10.609 32.379 8.499 38.218 7.967c5.84-.53 18.844-7.702 21.497-15.139c2.655-7.436 2.655-13.81 1.859-15.142c-.796-1.327-2.92-2.124-6.105-3.716s-18.844-9.298-21.763-10.361c-2.92-1.062-5.043-1.592-7.167 1.597c-2.124 3.184-8.223 10.356-10.082 12.48c-1.857 2.129-3.716 2.394-6.9.801c-3.187-1.598-13.444-4.957-25.613-15.806c-9.468-8.442-15.86-18.867-17.718-22.056c-1.858-3.184-.199-4.91 1.398-6.497c1.431-1.427 3.186-3.719 4.78-5.578c1.588-1.86 2.118-3.187 3.18-5.311c1.063-2.126.531-3.986-.264-5.579c-.798-1.593-6.987-17.343-9.819-23.64"},null,-1))])}const sf=t.markRaw({name:"logos-whatsapp-icon",render:Gw,setup(){const n=()=>Math.random().toString(36).substr(2,10);return{idMap:{SVGBRLHCcSy:"uicons-"+n(),SVGHW6lecxh:"uicons-"+n()}}}}),Zw={viewBox:"0 0 256 256",width:"1.2em",height:"1.2em"},Qw=["id"],Jw=["fill"];function ex(n,e){return t.openBlock(),t.createElementBlock("svg",Zw,[t.createElementVNode("defs",null,[t.createElementVNode("linearGradient",{id:n.idMap.SVGuySfwdaH,x1:"50%",x2:"50%",y1:"0%",y2:"100%"},[...e[0]||(e[0]=[t.createElementVNode("stop",{offset:"0%","stop-color":"#2AABEE"},null,-1),t.createElementVNode("stop",{offset:"100%","stop-color":"#229ED9"},null,-1)])],8,Qw)]),t.createElementVNode("path",{fill:"url(#"+n.idMap.SVGuySfwdaH+")",d:"M128 0C94.06 0 61.48 13.494 37.5 37.49A128.04 128.04 0 0 0 0 128c0 33.934 13.5 66.514 37.5 90.51C61.48 242.506 94.06 256 128 256s66.52-13.494 90.5-37.49c24-23.996 37.5-56.576 37.5-90.51s-13.5-66.514-37.5-90.51C194.52 13.494 161.94 0 128 0"},null,8,Jw),e[1]||(e[1]=t.createElementVNode("path",{fill:"#FFF",d:"M57.94 126.648q55.98-24.384 74.64-32.152c35.56-14.786 42.94-17.354 47.76-17.441c1.06-.017 3.42.245 4.96 1.49c1.28 1.05 1.64 2.47 1.82 3.467c.16.996.38 3.266.2 5.038c-1.92 20.24-10.26 69.356-14.5 92.026c-1.78 9.592-5.32 12.808-8.74 13.122c-7.44.684-13.08-4.912-20.28-9.63c-11.26-7.386-17.62-11.982-28.56-19.188c-12.64-8.328-4.44-12.906 2.76-20.386c1.88-1.958 34.64-31.748 35.26-34.45c.08-.338.16-1.598-.6-2.262c-.74-.666-1.84-.438-2.64-.258c-1.14.256-19.12 12.152-54 35.686c-5.1 3.508-9.72 5.218-13.88 5.128c-4.56-.098-13.36-2.584-19.9-4.708c-8-2.606-14.38-3.984-13.82-8.41c.28-2.304 3.46-4.662 9.52-7.072"},null,-1))])}const af=t.markRaw({name:"logos-telegram",render:ex,setup(){return{idMap:{SVGuySfwdaH:"uicons-"+Math.random().toString(36).substr(2,10)}}}}),tx={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function nx(n,e){return t.openBlock(),t.createElementBlock("svg",tx,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M391 480c-19.52 0-46.94-7.06-88-30c-49.93-28-88.55-53.85-138.21-103.38C116.91 298.77 93.61 267.79 61 208.45c-36.84-67-30.56-102.12-23.54-117.13C45.82 73.38 58.16 62.65 74.11 52a176.3 176.3 0 0 1 28.64-15.2c1-.43 1.93-.84 2.76-1.21c4.95-2.23 12.45-5.6 21.95-2c6.34 2.38 12 7.25 20.86 16c18.17 17.92 43 57.83 52.16 77.43c6.15 13.21 10.22 21.93 10.23 31.71c0 11.45-5.76 20.28-12.75 29.81c-1.31 1.79-2.61 3.5-3.87 5.16c-7.61 10-9.28 12.89-8.18 18.05c2.23 10.37 18.86 41.24 46.19 68.51s57.31 42.85 67.72 45.07c5.38 1.15 8.33-.59 18.65-8.47c1.48-1.13 3-2.3 4.59-3.47c10.66-7.93 19.08-13.54 30.26-13.54h.06c9.73 0 18.06 4.22 31.86 11.18c18 9.08 59.11 33.59 77.14 51.78c8.77 8.84 13.66 14.48 16.05 20.81c3.6 9.53.21 17-2 22c-.37.83-.78 1.74-1.21 2.75a176.5 176.5 0 0 1-15.29 28.58c-10.63 15.9-21.4 28.21-39.38 36.58A67.4 67.4 0 0 1 391 480"},null,-1)])])}const lf=t.markRaw({name:"ion-call",render:nx}),ix={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function rx(n,e){return t.openBlock(),t.createElementBlock("svg",ix,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 4h4l2 5l-2.5 1.5a11 11 0 0 0 5 5L15 13l5 2v4a2 2 0 0 1-2 2A16 16 0 0 1 3 6a2 2 0 0 1 2-2m10 3a2 2 0 0 1 2 2m-2-6a6 6 0 0 1 6 6"},null,-1)])])}const ox=t.markRaw({name:"tabler-phone-call",render:rx}),sx={key:0,class:"absolute left-0 top-0 flex w-full flex-row items-center justify-around text-center backdrop-blur-sm"},ax=["href"],lx=["href"],cx=["href"],dx=["href"],ux={},fx=t.defineComponent({...ux,__name:"phone",props:{defaultCountry:{},phone:{default:""},showPhoneIcon:{type:Boolean,default:!1}},setup(n){const e=n,i=t.computed(()=>{try{return e.phone?Br.parsePhoneNumberWithError(e.phone,e.defaultCountry):void 0}catch{}return e.phone}),r=t.computed(()=>{var l;return V.isString(i.value)?!1:((l=i.value)==null?void 0:l.isValid())??!1}),o=t.computed(()=>{var l;return V.isString(i.value)?i.value:((l=i.value)==null?void 0:l.format("INTERNATIONAL"))??""}),s=t.computed(()=>{var l;return V.isString(i.value)?i.value:((l=i.value)==null?void 0:l.format("E.164"))??""}),a=t.ref(!1);return(l,c)=>{const d=ox,u=lf,f=af,h=sf,p=of;return t.openBlock(),t.createElementBlock("div",null,[t.createElementVNode("div",{class:t.normalizeClass({"border-xl relative inline-flex items-center rounded px-2":r.value&&a.value,"min-w-10":!0}),onClick:c[0]||(c[0]=m=>a.value=!a.value),onFocusout:c[1]||(c[1]=m=>a.value=!1),onMouseleave:c[2]||(c[2]=m=>a.value=!1)},[t.createElementVNode("div",{class:t.normalizeClass({"flex flex-row items-center gap-1":n.showPhoneIcon})},[n.showPhoneIcon?(t.openBlock(),t.createBlock(d,{key:0})):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(o.value),1)],2),r.value&&a.value?(t.openBlock(),t.createElementBlock("div",sx,[r.value?(t.openBlock(),t.createElementBlock("a",{key:0,href:`tel:${s.value}`,class:"text-blue-600 hover:animate-pulse hover:text-blue-600"},[t.createVNode(u)],8,ax)):t.createCommentVNode("",!0),r.value?(t.openBlock(),t.createElementBlock("a",{key:1,href:`https://t.me/${s.value}`,target:"_blank",rel:"noopener noreferrer",class:"hover:animate-pulse"},[t.createVNode(f)],8,lx)):t.createCommentVNode("",!0),r.value?(t.openBlock(),t.createElementBlock("a",{key:2,href:`https://wa.me/${s.value.substring(1)}`,target:"_blank",rel:"noopener noreferrer",class:"hover:animate-pulse"},[t.createVNode(h)],8,cx)):t.createCommentVNode("",!0),r.value?(t.openBlock(),t.createElementBlock("a",{key:3,href:`viber://chat?number=${s.value}`,class:"text-purple-600 hover:animate-pulse hover:text-purple-600"},[t.createVNode(p)],8,dx)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)],34)])}}}),hx={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function mx(n,e){return t.openBlock(),t.createElementBlock("svg",hx,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"m20 8l-8 5l-8-5V6l8 5l8-5m0-2H4c-1.11 0-2 .89-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2"},null,-1)])])}const px=t.markRaw({name:"mdi-envelope",render:mx}),gx={class:"flex flex-col gap-1"},yx={key:0,class:"mb-2 flex flex-col text-base"},bx={key:0,class:"text-sc-dark-grey text-sm"},_x={key:1,class:"whitespace-nowrap text-sm"},wx={key:2,class:"whitespace-nowrap text-sm"},xx={key:3,class:"absolute left-0 top-0 flex size-full items-center justify-around rounded-md text-center text-2xl backdrop-blur-sm"},kx=["href"],Cx=["href"],vx=["href"],Sx=["href"],Bx=["href"],Nx={key:0,class:"flex flex-col text-base"},Tx={key:0,class:"text-sc-dark-grey text-sm"},$x={key:1,class:"mt-2 text-sm"},Ex={key:0,class:"-mt-1"},Rx={},Px=t.defineComponent({...Rx,__name:"person-contacts-block",props:{defaultCountry:{},contact:{},fullView:{type:Boolean,default:!0},classes:{default:""},styles:{default:void 0}},setup(n){const e=n,i=t.computed(()=>li.getFormatEntityName(e.contact)),r=t.computed(()=>{try{return e.contact.phone?Br.parsePhoneNumberWithError(e.contact.phone,e.defaultCountry):void 0}catch{}return e.contact.phone}),o=t.computed(()=>{var d;return V.isString(r.value)?!1:((d=r.value)==null?void 0:d.isValid())??!1}),s=t.computed(()=>{var d;return V.isString(r.value)?r.value:((d=r.value)==null?void 0:d.format("INTERNATIONAL"))??""}),a=t.computed(()=>{var d;return V.isString(r.value)?r.value:((d=r.value)==null?void 0:d.format("E.164"))??""}),l=t.computed(()=>o.value||e.contact.email),c=t.ref(!1);return(d,u)=>{var y,_;const f=lf,h=af,p=sf,m=of,g=px,b=I.NPopover;return t.openBlock(),t.createElementBlock("div",gx,[t.createVNode(b,{disabled:n.fullView,placement:"bottom"},{trigger:t.withCtx(()=>{var x,w,C,N;return[t.createElementVNode("div",{class:t.normalizeClass(`relative contact-btn px-3 py-2 rounded-md items-center inline-flex bg-gray-50 ${(x=n.contact)!=null&&x.isPrimary?"ring-1 ring-inset ring-green-600 hover:ring-gray-200":""} ${n.classes}`),style:t.normalizeStyle(n.styles),onMouseenter:u[0]||(u[0]=k=>c.value=!0),onFocusin:u[1]||(u[1]=k=>c.value=!0),onMouseleave:u[2]||(u[2]=k=>c.value=!1),onFocusout:u[3]||(u[3]=k=>c.value=!1)},[t.createElementVNode("div",null,[n.fullView&&(n.contact.name||(w=n.contact)!=null&&w.position)?(t.openBlock(),t.createElementBlock("div",yx,[t.createTextVNode(t.toDisplayString(i.value)+" ",1),(C=n.contact)!=null&&C.position?(t.openBlock(),t.createElementBlock("span",bx,t.toDisplayString((N=n.contact)==null?void 0:N.position),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),n.contact.phone?(t.openBlock(),t.createElementBlock("div",_x,t.toDisplayString(s.value),1)):t.createCommentVNode("",!0),n.contact.email?(t.openBlock(),t.createElementBlock("div",wx,t.toDisplayString(n.contact.email),1)):t.createCommentVNode("",!0),l.value&&c.value?(t.openBlock(),t.createElementBlock("div",xx,[o.value?(t.openBlock(),t.createElementBlock("a",{key:0,href:`tel:${a.value}`,class:"text-blue-600 hover:text-3xl hover:text-blue-600"},[t.createVNode(f)],8,kx)):t.createCommentVNode("",!0),o.value?(t.openBlock(),t.createElementBlock("a",{key:1,href:`https://t.me/${a.value}`,target:"_blank",rel:"noopener noreferrer",class:"hover:text-3xl"},[t.createVNode(h)],8,Cx)):t.createCommentVNode("",!0),o.value?(t.openBlock(),t.createElementBlock("a",{key:2,href:`https://wa.me/${a.value.substring(1)}`,target:"_blank",rel:"noopener noreferrer",class:"hover:text-3xl"},[t.createVNode(p)],8,vx)):t.createCommentVNode("",!0),o.value?(t.openBlock(),t.createElementBlock("a",{key:3,href:`viber://chat?number=${a.value}`,class:"text-purple-600 hover:text-3xl hover:text-purple-600"},[t.createVNode(m)],8,Sx)):t.createCommentVNode("",!0),n.contact.email?(t.openBlock(),t.createElementBlock("a",{key:4,href:`mailto:${n.contact.email}`,class:"hover:text-3xl"},[t.createVNode(g)],8,Bx)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)])],38)]}),default:t.withCtx(()=>{var x,w,C,N;return[n.contact.name?(t.openBlock(),t.createElementBlock("div",Nx,[t.createTextVNode(t.toDisplayString(i.value)+" ",1),(x=n.contact)!=null&&x.position?(t.openBlock(),t.createElementBlock("span",Tx,t.toDisplayString((w=n.contact)==null?void 0:w.position),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),(C=n.contact)!=null&&C.comment?(t.openBlock(),t.createElementBlock("div",$x,[u[4]||(u[4]=t.createElementVNode("sup",null,"**",-1)),t.createTextVNode(" "+t.toDisplayString((N=n.contact)==null?void 0:N.comment),1)])):t.createCommentVNode("",!0)]}),_:1},8,["disabled"]),n.fullView&&((y=n.contact)!=null&&y.comment)?(t.openBlock(),t.createElementBlock("div",Ex,[u[5]||(u[5]=t.createElementVNode("sup",null,"**",-1)),t.createTextVNode(" "+t.toDisplayString((_=n.contact)==null?void 0:_.comment),1)])):t.createCommentVNode("",!0)])}}});class Fx{constructor(e){B(this,"minHeight");B(this,"maxHeights");B(this,"minWidth");B(this,"maxWidths");B(this,"netType");B(this,"color");B(this,"mountType");B(this,"descriptions");B(this,"crossbarCount");B(this,"heightOverlaps");B(this,"widthOverlaps");B(this,"canSetDopProdaga");this.color=e.color,this.crossbarCount=e.crossbarCount,this.descriptions=Ns.objectToSnake(e.descriptions),this.maxHeights=e.maxHeights,this.maxWidths=e.maxWidths,this.minHeight=e.minHeight,this.minWidth=e.minWidth,this.mountType=e.mountType,this.netType=e.netType,this.heightOverlaps=Ns.objectToSnake(e.heightOverlaps),this.widthOverlaps=Ns.objectToSnake(e.widthOverlaps),this.canSetDopProdaga=e.canSetDopProdaga}}function Vx(n){var e;return((e=n.properties)==null?void 0:e.configurator)!==W.ConfiguratorsEnum.SandwichM2?!0:n.properties.configuratorSettings!==void 0&&V.isArray(n.products)&&n.products.length>0}const Mx={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Ix(n,e){return t.openBlock(),t.createElementBlock("svg",Mx,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M16 12a2 2 0 0 1 2-2a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2m-6 0a2 2 0 0 1 2-2a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2m-6 0a2 2 0 0 1 2-2a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2"},null,-1)])])}const Ax=t.markRaw({name:"mdi-dots-horizontal",render:Ix}),Ox={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function zx(n,e){return t.openBlock(),t.createElementBlock("svg",Ox,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M15.5 14h-.79l-.28-.27A6.47 6.47 0 0 0 16 9.5A6.5 6.5 0 0 0 9.5 3A6.5 6.5 0 0 0 3 9.5A6.5 6.5 0 0 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 5l1.5-1.5zm-6 0C7 14 5 12 5 9.5S7 5 9.5 5S14 7 14 9.5S12 14 9.5 14M7 9h5v1H7z"},null,-1)])])}const Dx=t.markRaw({name:"mdi-magnify-minus-outline",render:zx}),Lx={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Hx(n,e){return t.openBlock(),t.createElementBlock("svg",Lx,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"m15.5 14l5 5l-1.5 1.5l-5-5v-.79l-.27-.28A6.47 6.47 0 0 1 9.5 16A6.5 6.5 0 0 1 3 9.5A6.5 6.5 0 0 1 9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27zm-6 0C12 14 14 12 14 9.5S12 5 9.5 5S5 7 5 9.5S7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2z"},null,-1)])])}const Wx=t.markRaw({name:"mdi-magnify-plus-outline",render:Hx}),jx={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function qx(n,e){return t.openBlock(),t.createElementBlock("svg",jx,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M8.59 16.58L13.17 12L8.59 7.41L10 6l6 6l-6 6z"},null,-1)])])}const cf=t.markRaw({name:"mdi-chevron-right",render:qx}),Xx={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Yx(n,e){return t.openBlock(),t.createElementBlock("svg",Xx,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M15.41 16.58L10.83 12l4.58-4.59L14 6l-6 6l6 6z"},null,-1)])])}const df=t.markRaw({name:"mdi-chevron-left",render:Yx}),Ux={heightMedium:"40px",paddingMedium:"0 16px",borderRadiusMedium:"10px",fontSizeMedium:"14px",iconSizeMedium:"18px",iconMarginMedium:"8px",border:"1px solid #d1d5db",borderHover:"1px solid #9ca3af",borderPressed:"1px solid #9ca3af",borderFocus:"1px solid #9ca3af"},Lr={heightSmall:"36px",paddingSmall:"0 10px",borderRadiusSmall:"8px",iconSizeSmall:"18px",border:"1px solid #d1d5db",borderHover:"1px solid #9ca3af",borderPressed:"1px solid #9ca3af",borderFocus:"1px solid #9ca3af"},uf="date-range.dialog.mode",ff="date-range.dialog.scale",hf="date-range.quick-periods",mf=["thisMonth","lastMonth","thisQuarter","lastQuarter","thisYear","lastYear","fromBeginningOfThisYear"],pf=["Янв","Фев","Мар","Апр","Май","Июн","Июл","Авг","Сен","Окт","Ноя","Дек"],Kx=["Январь","Февраль","Март","Апрель","Май","Июнь","Июль","Август","Сентябрь","Октябрь","Ноябрь","Декабрь"],Gx=["Пн","Вт","Ср","Чт","Пт","Сб","Вс"],gf=new Date(2e3,0,1),Ri=n=>Be.differenceInCalendarDays(n,gf),yf=n=>Be.addDays(gf,n),bf=(n,e,i)=>{let r=n??void 0,o=e??void 0;return r&&o&&r>o&&(i!=null&&i.from?o=r:i!=null&&i.to?r=o:[r,o]=[o,r]),{from:r?Be.startOfDay(r):void 0,to:o?Be.endOfDay(o):void 0}},Oa=n=>Object.entries(n).map(([e,i])=>({value:e,label:i.label,item:i})),_f=(n,e)=>{const i=Object.entries(n).filter(([,r])=>r.group===e);return e!=="other"?[{type:"group",key:e,children:Oa(Object.fromEntries(i))}]:W.STANDARD_PERIOD_SECTIONS.map(r=>{const o=i.filter(([,s])=>s.section===r.key);return{type:"group",key:r.key,label:r.label,children:Oa(Object.fromEntries(o))}}).filter(r=>r.children.length>0)},wf=(n,e)=>{const i=t.ref(null),r=t.ref(null),o=t.ref(!1),s=t.ref(null),a=(g,b)=>g<=b?[g,b]:[b,g],l=t.computed(()=>o.value&&r.value!==null&&s.value!==null?a(r.value,s.value):i.value!==null?s.value===null?[i.value,i.value]:a(i.value,s.value):n.value),c=(g,b)=>{i.value=null,e(...a(g,b))},d=g=>{i.value===null?(i.value=g,e(g,g)):c(i.value,g)},u=()=>{globalThis.removeEventListener("pointerup",u);const g=r.value;if(g!==null){if(r.value=null,o.value){o.value=!1,s.value!==null&&c(g,s.value);return}d(g)}},f=g=>{r.value=g,o.value=!1,globalThis.addEventListener("pointerup",u)},h=g=>{s.value=g,r.value!==null&&g!==r.value&&(o.value=!0)},p=()=>{s.value=null},m=g=>{const b=l.value;return!b||g<b[0]||g>b[1]?null:g===b[0]||g===b[1]?"bound":"in-range"};return t.onBeforeUnmount(()=>{globalThis.removeEventListener("pointerup",u)}),{activeRange:l,cellPosition:m,pointerDownHandler:f,pointerEnterHandler:h,pointerLeaveHandler:p,selectHandler:d}},Zx={class:"flex items-center justify-between gap-2"},Qx={class:"flex items-center gap-2"},Jx={class:"text-center font-semibold"},ek={class:"grid grid-cols-7 gap-0.5 text-center text-xs text-gray-500"},tk={class:"grid grid-cols-7 gap-0.5"},nk=["disabled","onPointerdown","onPointerenter","onKeydown"],ik={},rk=t.defineComponent({...ik,__name:"day-range-grid",props:{from:{},to:{}},emits:["select"],setup(n,{emit:e}){const i=n,r=e,o=42,s=I.useThemeVars(),a=t.computed(()=>({"--sc-primary-color":s.value.primaryColor,"--sc-primary-color-hover":s.value.primaryColorHover,"--sc-primary-color-suppl":s.value.primaryColorSuppl,"--sc-hover-color":s.value.hoverColor})),l=Ue.initRefDependingOnDeviceResolution(1,2,3),c=t.computed(()=>["grid-cols-1","grid-cols-2","grid-cols-3"][l.value-1]),d=y=>Be.subMonths(Be.startOfMonth(y),l.value===3?1:0),u=y=>y&&Be.isValid(y)?y:new Date,f=t.ref(d(u(i.from??i.to))),h=t.computed(()=>{const{from:y,to:_}=i;return!y||!_||!Be.isValid(y)||!Be.isValid(_)?null:[Ri(y),Ri(_)]}),p=wf(h,(y,_)=>{r("select",{from:Be.startOfDay(yf(y)),to:Be.endOfDay(yf(_))})}),m=y=>{const _=Be.subDays(y,(Be.getDay(y)+6)%7);return V.times(o,x=>{const w=Be.addDays(_,x);return{index:Ri(w),day:w.getDate(),isCurrentMonth:Be.isSameMonth(w,y),isToday:Be.isToday(w)}})},g=t.computed(()=>V.times(l.value,y=>{const _=Be.addMonths(f.value,y);return{key:`${_.getFullYear()}-${_.getMonth()}`,title:`${Kx[_.getMonth()]} ${_.getFullYear()}`,cells:m(_)}})),b=y=>{if(!y.isCurrentMonth)return["sc-day--outside"];const _=y.isToday?["sc-day--today"]:[],x=p.cellPosition(y.index);return x&&_.push(`sc-day--${x}`),_};return t.watch(()=>[i.from,i.to],()=>{const y=i.from??i.to;if(!y||!Be.isValid(y))return;const _=`${y.getFullYear()}-${y.getMonth()}`;V.some(g.value,["key",_])||(f.value=d(y))}),(y,_)=>{const x=df,w=I.NButton,C=cf;return t.openBlock(),t.createElementBlock("div",{class:"flex select-none flex-col gap-3",style:t.normalizeStyle(a.value),onPointerleave:_[2]||(_[2]=(...N)=>t.unref(p).pointerLeaveHandler&&t.unref(p).pointerLeaveHandler(...N))},[t.createElementVNode("div",Zx,[t.createVNode(w,{size:"small","aria-label":"Предыдущий месяц","theme-overrides":t.unref(Lr),onClick:_[0]||(_[0]=N=>f.value=t.unref(Be.subMonths)(f.value,1))},{icon:t.withCtx(()=>[t.createVNode(x)]),_:1},8,["theme-overrides"]),_[3]||(_[3]=t.createElementVNode("span",{class:"text-sm text-gray-600"},"Выберите диапазон на календаре",-1)),t.createElementVNode("div",Qx,[t.renderSlot(y.$slots,"actions",{},void 0,!0),t.createVNode(w,{size:"small","aria-label":"Следующий месяц","theme-overrides":t.unref(Lr),onClick:_[1]||(_[1]=N=>f.value=t.unref(Be.addMonths)(f.value,1))},{icon:t.withCtx(()=>[t.createVNode(C)]),_:1},8,["theme-overrides"])])]),t.createElementVNode("div",{class:t.normalizeClass(["grid gap-3",c.value])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(g.value,N=>(t.openBlock(),t.createElementBlock("div",{key:N.key,class:"flex flex-col gap-1"},[t.createElementVNode("div",Jx,t.toDisplayString(N.title),1),t.createElementVNode("div",ek,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Gx),k=>(t.openBlock(),t.createElementBlock("span",{key:k},t.toDisplayString(k),1))),128))]),t.createElementVNode("div",tk,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(N.cells,k=>(t.openBlock(),t.createElementBlock("button",{key:k.index,type:"button",class:t.normalizeClass(["sc-day h-7 rounded border-0 p-0 text-xs",b(k)]),disabled:!k.isCurrentMonth,onPointerdown:t.withModifiers($=>t.unref(p).pointerDownHandler(k.index),["prevent"]),onPointerenter:$=>t.unref(p).pointerEnterHandler(k.index),onKeydown:[t.withKeys(t.withModifiers($=>t.unref(p).selectHandler(k.index),["prevent"]),["enter"]),t.withKeys(t.withModifiers($=>t.unref(p).selectHandler(k.index),["prevent"]),["space"])]},t.toDisplayString(k.day),43,nk))),128))])]))),128))],2),_[4]||(_[4]=t.createStaticVNode('<div class="flex flex-wrap items-center gap-x-6 gap-y-1 text-xs text-gray-700" data-v-a41e813d><span class="flex items-center gap-2" data-v-a41e813d><i class="sc-legend sc-legend--bound" data-v-a41e813d></i>Дата начала</span><span class="flex items-center gap-2" data-v-a41e813d><i class="sc-legend sc-legend--in-range" data-v-a41e813d></i>Выбранный период</span><span class="flex items-center gap-2" data-v-a41e813d><i class="sc-legend sc-legend--bound" data-v-a41e813d></i>Дата окончания</span></div>',1))],36)}}}),ok=gn(rk,[["__scopeId","data-v-a41e813d"]]),sk={class:"flex items-center justify-between gap-2"},ak={class:"flex items-center gap-2"},lk={class:"text-center font-semibold"},ck={class:"grid grid-cols-3 gap-2"},dk=["onPointerdown","onPointerenter","onKeydown"],uk={},fk=t.defineComponent({...uk,__name:"month-range-grid",props:{from:{},to:{}},emits:["select"],setup(n,{emit:e}){const i=n,r=e,o=I.useThemeVars(),s=t.computed(()=>({"--sc-primary-color":o.value.primaryColor,"--sc-primary-color-hover":o.value.primaryColorHover,"--sc-primary-color-suppl":o.value.primaryColorSuppl,"--sc-hover-color":o.value.hoverColor})),a=p=>{const m=new Date().getFullYear();return p&&Be.isValid(p)?p.getFullYear():m},l=t.ref(a(i.from??i.to)),c=Ue.initRefDependingOnDeviceResolution(1,3,3),d=t.computed(()=>c.value===1?[l.value]:[l.value-1,l.value,l.value+1]),u=t.computed(()=>{const{from:p,to:m}=i;return!p||!m||!Be.isValid(p)||!Be.isValid(m)?null:[p.getFullYear()*12+p.getMonth(),m.getFullYear()*12+m.getMonth()]}),f=wf(u,(p,m)=>{r("select",{from:new Date(Math.floor(p/12),p%12,1),to:Be.endOfMonth(new Date(Math.floor(m/12),m%12,1))})}),h=(p,m)=>{const g=f.cellPosition(p*12+m);return g?[`sc-month--${g}`]:[]};return t.watch(()=>[i.from,i.to],()=>{const p=i.from??i.to;if(!p||!Be.isValid(p))return;const m=p.getFullYear();(m<l.value-1||m>l.value+1)&&(l.value=m)}),(p,m)=>{const g=df,b=I.NButton,y=cf;return t.openBlock(),t.createElementBlock("div",{class:"flex select-none flex-col gap-3",style:t.normalizeStyle(s.value),onPointerleave:m[2]||(m[2]=(..._)=>t.unref(f).pointerLeaveHandler&&t.unref(f).pointerLeaveHandler(..._))},[t.createElementVNode("div",sk,[t.createVNode(b,{size:"small","aria-label":"Предыдущий год","theme-overrides":t.unref(Lr),onClick:m[0]||(m[0]=_=>l.value-=1)},{icon:t.withCtx(()=>[t.createVNode(g)]),_:1},8,["theme-overrides"]),m[3]||(m[3]=t.createElementVNode("span",{class:"text-sm text-gray-600"},"Выберите диапазон месяцев",-1)),t.createElementVNode("div",ak,[t.renderSlot(p.$slots,"actions",{},void 0,!0),t.createVNode(b,{size:"small","aria-label":"Следующий год","theme-overrides":t.unref(Lr),onClick:m[1]||(m[1]=_=>l.value+=1)},{icon:t.withCtx(()=>[t.createVNode(y)]),_:1},8,["theme-overrides"])])]),t.createElementVNode("div",{class:t.normalizeClass(["grid gap-4 sm:gap-6",d.value.length===1?"grid-cols-1":"grid-cols-3"])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.value,_=>(t.openBlock(),t.createElementBlock("div",{key:_,class:"flex flex-col gap-2"},[t.createElementVNode("div",lk,t.toDisplayString(_),1),t.createElementVNode("div",ck,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(pf),(x,w)=>(t.openBlock(),t.createElementBlock("button",{key:x,type:"button",class:t.normalizeClass(["sc-month cursor-pointer rounded-lg px-1 py-2.5 text-sm",h(_,w)]),onPointerdown:t.withModifiers(C=>t.unref(f).pointerDownHandler(_*12+w),["prevent"]),onPointerenter:C=>t.unref(f).pointerEnterHandler(_*12+w),onKeydown:[t.withKeys(t.withModifiers(C=>t.unref(f).selectHandler(_*12+w),["prevent"]),["enter"]),t.withKeys(t.withModifiers(C=>t.unref(f).selectHandler(_*12+w),["prevent"]),["space"])]},t.toDisplayString(x),43,dk))),128))])]))),128))],2)],36)}}}),hk=gn(fk,[["__scopeId","data-v-dd09a19d"]]),mk={class:"sc-date-range-sidebar flex flex-col gap-1"},pk={class:"flex items-center justify-center gap-1"},gk={class:"min-w-12 text-center font-semibold"},yk={class:"grid grid-flow-col grid-cols-2 grid-rows-6 gap-1"},bk={},_k=t.defineComponent({...bk,__name:"month-year-sidebar",props:{year:{},month:{}},emits:["update:year","select-month","today"],setup(n,{emit:e}){const i=e;return(r,o)=>{const s=I.NButton;return t.openBlock(),t.createElementBlock("div",mk,[t.createElementVNode("div",pk,[t.createVNode(s,{size:"small",quaternary:"",onClick:o[0]||(o[0]=a=>i("update:year",n.year-1))},{default:t.withCtx(()=>[...o[3]||(o[3]=[t.createTextVNode(" ‹ ",-1)])]),_:1}),t.createElementVNode("span",gk,t.toDisplayString(n.year),1),t.createVNode(s,{size:"small",quaternary:"",onClick:o[1]||(o[1]=a=>i("update:year",n.year+1))},{default:t.withCtx(()=>[...o[4]||(o[4]=[t.createTextVNode(" › ",-1)])]),_:1})]),t.createElementVNode("div",yk,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(pf),(a,l)=>(t.openBlock(),t.createBlock(s,{key:a,size:"small",quaternary:"",type:l===n.month?"primary":"default",onClick:c=>i("select-month",l)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(a),1)]),_:2},1032,["type","onClick"]))),128))]),t.createVNode(s,{size:"small",text:"",type:"info",onClick:o[2]||(o[2]=a=>i("today"))},{default:t.withCtx(()=>[...o[5]||(o[5]=[t.createTextVNode(" Сегодня ",-1)])]),_:1})])}}}),wk={},xf=t.defineComponent({...wk,__name:"date-range-input",props:{clearable:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},placeholder:{default:void 0},value:{default:null},dateFormat:{default:()=>W.useBaseConfigStateStore().config.dateFormats.uiDate}},emits:["update:value"],setup(n,{emit:e}){const i=n,r=e,o=Ue.initRefDependingOnDeviceResolution(!0,!1,!1),s=t.ref(null),a=t.ref(!1),l=t.ref(0),c=t.ref(i.value&&Be.isValid(i.value)?i.value:new Date),d=t.computed(()=>{const x=i.value&&Be.isValid(i.value)?i.value:c.value;return x.getFullYear()===c.value.getFullYear()?x.getMonth():null});let u=0;const f=x=>{var w,C;(C=(w=x.target)==null?void 0:w.closest)!=null&&C.call(w,".n-base-clear__clear")&&(u=performance.now())},h=x=>{x&&performance.now()-u<300||(a.value=x,x&&(c.value=i.value&&Be.isValid(i.value)?i.value:new Date))},p=x=>{r("update:value",x===null?null:new Date(x))},m=(x,w)=>{const C=new Date(x,w,1);if(c.value=C,i.value&&Be.isValid(i.value)){const N=Math.min(Be.getDate(i.value),Be.getDaysInMonth(C));r("update:value",new Date(x,w,N));return}l.value+=1,t.nextTick().then(()=>{var N;return(N=s.value)==null?void 0:N.focus()})},g=(x,w)=>{c.value=Be.addYears(Be.addMonths(c.value,x),w)},b=x=>{m(x,c.value.getMonth())},y=x=>{m(c.value.getFullYear(),x)},_=()=>{a.value=!1,r("update:value",new Date)};return(x,w)=>{const C=I.NButton,N=I.NDatePicker;return t.openBlock(),t.createBlock(N,{ref_key:"pickerReference",ref:s,key:l.value,value:i.value?i.value.getTime():null,show:a.value,clearable:n.clearable,disabled:n.disabled,placeholder:n.placeholder,format:n.dateFormat,actions:[],"default-calendar-start-time":c.value.getTime(),type:"date",class:"w-full min-w-0",onMousedownCapture:f,"onUpdate:show":h,"onUpdate:value":p,onNextMonth:w[0]||(w[0]=k=>g(1,0)),onPrevMonth:w[1]||(w[1]=k=>g(-1,0)),onNextYear:w[2]||(w[2]=k=>g(0,1)),onPrevYear:w[3]||(w[3]=k=>g(0,-1))},{footer:t.withCtx(()=>[t.unref(o)?(t.openBlock(),t.createBlock(C,{key:1,size:"small",text:"",type:"info",onClick:_},{default:t.withCtx(()=>[...w[4]||(w[4]=[t.createTextVNode(" Сегодня ",-1)])]),_:1})):(t.openBlock(),t.createBlock(_k,{key:0,year:c.value.getFullYear(),month:d.value,"onUpdate:year":b,onSelectMonth:y,onToday:_},null,8,["year","month"]))]),_:1},8,["value","show","clearable","disabled","placeholder","format","default-calendar-start-time"])}}}),xk={key:0,class:"text-gray-400"},kk={},kf=t.defineComponent({...kk,__name:"date-range-fields",props:{clearable:{type:Boolean,default:!0},disabled:{default:()=>({from:!1,to:!1})},from:{default:null},to:{default:null},placeholderFrom:{default:"Дата начала"},placeholderTo:{default:"Дата окончания"},dateFormat:{default:void 0}},emits:["update:from","update:to"],setup(n,{emit:e}){const i=Ue.initRefDependingOnDeviceResolution(!0,!1,!1),r=e;return(o,s)=>{var a,l;return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["flex w-full min-w-0 gap-1",t.unref(i)?"flex-col":"flex-row items-center"])},[t.createVNode(xf,{value:n.from,clearable:n.clearable,disabled:(a=n.disabled)==null?void 0:a.from,placeholder:n.placeholderFrom,"date-format":n.dateFormat,class:"min-w-0 flex-1","onUpdate:value":s[0]||(s[0]=c=>r("update:from",c))},null,8,["value","clearable","disabled","placeholder","date-format"]),t.unref(i)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("span",xk," – ")),t.createVNode(xf,{value:n.to,clearable:n.clearable,disabled:(l=n.disabled)==null?void 0:l.to,placeholder:n.placeholderTo,"date-format":n.dateFormat,class:"min-w-0 flex-1","onUpdate:value":s[1]||(s[1]=c=>r("update:to",c))},null,8,["value","clearable","disabled","placeholder","date-format"])],2)}}}),Ck={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function vk(n,e){return t.openBlock(),t.createElementBlock("svg",Ck,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M7 11h2v2H7zm14-6v14c0 1.11-.89 2-2 2H5a2 2 0 0 1-2-2V5c0-1.1.9-2 2-2h1V1h2v2h8V1h2v2h1a2 2 0 0 1 2 2M5 7h14V5H5zm14 12V9H5v10zm-4-6v-2h2v2zm-4 0v-2h2v2zm-4 2h2v2H7zm8 2v-2h2v2zm-4 0v-2h2v2z"},null,-1)])])}const Sk=t.markRaw({name:"mdi-calendar-month-outline",render:vk}),Bk={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Nk(n,e){return t.openBlock(),t.createElementBlock("svg",Bk,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"m16 11.78l4.24-7.33l1.73 1l-5.23 9.05l-6.51-3.75L5.46 19H22v2H2V3h2v14.54L9.5 8z"},null,-1)])])}const Tk=t.markRaw({name:"mdi-chart-line",render:Nk}),$k={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Ek(n,e){return t.openBlock(),t.createElementBlock("svg",$k,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M22 21H2V3h2v16h2v-9h4v9h2V6h4v13h2v-5h4z"},null,-1)])])}const Rk=t.markRaw({name:"mdi-chart-bar",render:Ek}),Pk={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Fk(n,e){return t.openBlock(),t.createElementBlock("svg",Pk,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M5 3h1V1h2v2h8V1h2v2h1c1.11 0 2 .89 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2m0 16h14V9H5zM5 7h14V5H5zm12 4v2H7v-2z"},null,-1)])])}const Vk=t.markRaw({name:"mdi-calendar-week-outline",render:Fk}),Mk={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Ik(n,e){return t.openBlock(),t.createElementBlock("svg",Mk,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M19 3h-1V1h-2v2H8V1H6v2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14c1.11 0 2-.89 2-2V5c0-1.11-.89-2-2-2m0 16H5V9h14zm0-12H5V5h14M7 11h5v5H7"},null,-1)])])}const Ak=t.markRaw({name:"mdi-calendar-today-outline",render:Ik}),Ok={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function zk(n,e){return t.openBlock(),t.createElementBlock("svg",Ok,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M12 8a4 4 0 0 1 4 4a4 4 0 0 1-4 4a4 4 0 0 1-4-4a4 4 0 0 1 4-4m0 2a2 2 0 0 0-2 2a2 2 0 0 0 2 2a2 2 0 0 0 2-2a2 2 0 0 0-2-2m-2 12c-.25 0-.46-.18-.5-.42l-.37-2.65c-.63-.25-1.17-.59-1.69-.99l-2.49 1.01c-.22.08-.49 0-.61-.22l-2-3.46a.493.493 0 0 1 .12-.64l2.11-1.66L4.5 12l.07-1l-2.11-1.63a.493.493 0 0 1-.12-.64l2-3.46c.12-.22.39-.31.61-.22l2.49 1c.52-.39 1.06-.73 1.69-.98l.37-2.65c.04-.24.25-.42.5-.42h4c.25 0 .46.18.5.42l.37 2.65c.63.25 1.17.59 1.69.98l2.49-1c.22-.09.49 0 .61.22l2 3.46c.13.22.07.49-.12.64L19.43 11l.07 1l-.07 1l2.11 1.63c.19.15.25.42.12.64l-2 3.46c-.12.22-.39.31-.61.22l-2.49-1c-.52.39-1.06.73-1.69.98l-.37 2.65c-.04.24-.25.42-.5.42zm1.25-18l-.37 2.61c-1.2.25-2.26.89-3.03 1.78L5.44 7.35l-.75 1.3L6.8 10.2a5.55 5.55 0 0 0 0 3.6l-2.12 1.56l.75 1.3l2.43-1.04c.77.88 1.82 1.52 3.01 1.76l.37 2.62h1.52l.37-2.61c1.19-.25 2.24-.89 3.01-1.77l2.43 1.04l.75-1.3l-2.12-1.55c.4-1.17.4-2.44 0-3.61l2.11-1.55l-.75-1.3l-2.41 1.04a5.42 5.42 0 0 0-3.03-1.77L12.75 4z"},null,-1)])])}const Dk=t.markRaw({name:"mdi-cog-outline",render:zk}),Lk={class:"grid gap-x-6 gap-y-4 pr-3 sm:grid-cols-2"},Hk={class:"font-medium"},Wk={key:0,class:"pt-1 text-xs text-gray-500"},jk={class:"flex flex-col items-stretch justify-between gap-2 sm:flex-row sm:items-center"},qk={class:"flex items-center gap-3"},Xk={class:"text-sm text-gray-600"},Yk={class:"flex gap-2"},Uk={},Kk=t.defineComponent({...Uk,__name:"quick-periods-settings",props:{show:{type:Boolean},selectedKeys:{}},emits:["update:show","save"],setup(n,{emit:e}){const i=n,r=e,o=Ue.initRefDependingOnDeviceResolution("100%","90%","40rem"),s=W.DateTimeProvider.standardPeriods(),a=W.STANDARD_PERIOD_GROUPS.map(u=>({key:u.key,label:u.label,sections:_f(s,u.key)})),l=t.ref([]),c=t.computed(()=>{const u=l.value.length;return`Выбрано: ${u} ${W.pluralize(u,["период","периода","периодов"])}`}),d=()=>{r("save",[...l.value]),r("update:show",!1)};return t.watch(()=>i.show,u=>{u&&(l.value=[...i.selectedKeys])}),(u,f)=>{const h=I.NCheckbox,p=I.NCheckboxGroup,m=I.NScrollbar,g=I.NButton,b=I.NModal;return t.openBlock(),t.createBlock(b,{show:n.show,preset:"card",title:"Настройка быстрого выбора",closable:"",style:t.normalizeStyle({width:t.unref(o),maxWidth:"calc(100vw - 1rem)"}),class:"sc-date-range-dialog","onUpdate:show":f[4]||(f[4]=y=>r("update:show",y))},{footer:t.withCtx(()=>[t.createElementVNode("div",jk,[t.createElementVNode("div",qk,[t.createElementVNode("span",Xk,t.toDisplayString(c.value),1),t.createVNode(g,{text:"",type:"info",onClick:f[1]||(f[1]=y=>l.value=[...t.unref(mf)])},{default:t.withCtx(()=>[...f[5]||(f[5]=[t.createTextVNode(" По умолчанию ",-1)])]),_:1}),t.createVNode(g,{text:"",type:"info",disabled:l.value.length===0,onClick:f[2]||(f[2]=y=>l.value=[])},{default:t.withCtx(()=>[...f[6]||(f[6]=[t.createTextVNode(" Снять все ",-1)])]),_:1},8,["disabled"])]),t.createElementVNode("div",Yk,[t.createVNode(g,{type:"primary",onClick:d},{default:t.withCtx(()=>[...f[7]||(f[7]=[t.createTextVNode(" Сохранить ",-1)])]),_:1}),t.createVNode(g,{onClick:f[3]||(f[3]=y=>r("update:show",!1))},{default:t.withCtx(()=>[...f[8]||(f[8]=[t.createTextVNode("Отмена",-1)])]),_:1})])])]),default:t.withCtx(()=>[t.createVNode(m,{class:"max-h-[60vh]"},{default:t.withCtx(()=>[t.createVNode(p,{value:l.value,"onUpdate:value":f[0]||(f[0]=y=>l.value=y)},{default:t.withCtx(()=>[t.createElementVNode("div",Lk,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(a),y=>(t.openBlock(),t.createElementBlock("div",{key:y.key,class:"flex flex-col gap-1.5"},[t.createElementVNode("div",Hk,t.toDisplayString(y.label),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(y.sections,_=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:_.key},[_.label?(t.openBlock(),t.createElementBlock("div",Wk,t.toDisplayString(_.label),1)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(_.children,x=>(t.openBlock(),t.createBlock(h,{key:x.value,value:x.value,label:x.label},null,8,["value","label"]))),128))],64))),128))]))),128))])]),_:1},8,["value"])]),_:1})]),_:1},8,["show","style"])}}}),Gk={class:"flex flex-col gap-2"},Zk={class:"flex items-center gap-2"},Qk={class:"flex gap-2 px-px pb-4 pt-px"},Jk={key:0,class:"text-sm text-gray-500"},e2={},t2=t.defineComponent({...e2,__name:"quick-periods",props:{from:{},to:{}},emits:["apply","preview"],setup(n,{emit:e}){const i=n,r=e,o=W.DateTimeProvider.standardPeriods(),s=()=>{const f=hf,h=W.PreferencesStorageProvider.getActualDataFromStorage(f);return(V.isArray(h)?h:mf).filter(m=>V.isString(m)&&m in o)},a=t.ref(s()),l=t.ref(!1),c=t.computed(()=>Object.entries(o).filter(([f])=>a.value.includes(f)).map(([f,h])=>({value:f,label:h.label,item:h,group:h.group}))),d=t.computed(()=>{const f=i.from?Ri(i.from):null,h=i.to?Ri(i.to):null;if(f===null||h===null)return null;const p=c.value.find(m=>{const{from:g,to:b}=m.item;return!g||!b?!1:Ri(g)===f&&Ri(b)===h});return p?String(p.value):null}),u=f=>{a.value=f;const h=hf;W.PreferencesStorageProvider.saveActualDataToStorage(h,f,Be.addYears(Be.startOfToday(),1))};return(f,h)=>{const p=Dk,m=I.NButton,g=Ak,b=Vk,y=Rk,_=Tk,x=Sk,w=I.NScrollbar;return t.openBlock(),t.createElementBlock("div",Gk,[t.createElementVNode("div",Zk,[h[3]||(h[3]=t.createElementVNode("span",{class:"text-sm font-medium text-gray-700"},"Быстрый выбор",-1)),t.createVNode(m,{size:"tiny",quaternary:"",circle:"","aria-label":"Настроить быстрый выбор",onClick:h[0]||(h[0]=C=>l.value=!0)},{icon:t.withCtx(()=>[t.createVNode(p)]),_:1})]),t.createVNode(w,{"x-scrollable":""},{default:t.withCtx(()=>[t.createElementVNode("div",Qk,[c.value.length===0?(t.openBlock(),t.createElementBlock("span",Jk," Периоды не выбраны ")):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(c.value,C=>(t.openBlock(),t.createBlock(m,{key:C.value,type:C.value===d.value?"primary":"default",ghost:C.value===d.value,"theme-overrides":t.unref(Ux),class:"shrink-0",onClick:N=>r("apply",C),onMouseenter:N=>r("preview",C),onMouseleave:h[1]||(h[1]=N=>r("preview"))},{icon:t.withCtx(()=>[C.group==="day"?(t.openBlock(),t.createBlock(g,{key:0})):C.group==="week"||C.group==="decade"?(t.openBlock(),t.createBlock(b,{key:1})):C.group==="quarter"||C.group==="halfYear"?(t.openBlock(),t.createBlock(y,{key:2})):C.group==="other"?(t.openBlock(),t.createBlock(_,{key:3})):(t.openBlock(),t.createBlock(x,{key:4}))]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(C.label),1)]),_:2},1032,["type","ghost","theme-overrides","onClick","onMouseenter"]))),128))])]),_:1}),t.createVNode(Kk,{show:l.value,"onUpdate:show":h[2]||(h[2]=C=>l.value=C),"selected-keys":a.value,onSave:u},null,8,["show","selected-keys"])])}}}),n2={class:"flex flex-col items-stretch gap-3 sm:flex-row"},i2={class:"order-2 flex-1 rounded-lg border border-solid border-gray-200 p-2 shadow-sm"},r2={class:"flex flex-col items-stretch pr-3"},o2={key:0,class:"px-2 pb-0.5 pt-2 text-xs text-gray-400"},s2={key:1,class:"order-2 w-44 shrink-0 rounded-lg border border-solid border-gray-200 p-1 shadow-sm"},a2={},l2=t.defineComponent({...a2,__name:"standard-periods",props:{activeKey:{},customPeriods:{}},emits:["apply","preview"],setup(n,{emit:e}){const i=n,r=e,o="custom",s=Ue.initRefDependingOnDeviceResolution(!0,!1,!1),a=W.DateTimeProvider.standardPeriods(),l=t.ref(W.STANDARD_PERIOD_GROUPS[0].key),c=t.computed(()=>{const u=W.STANDARD_PERIOD_GROUPS.map(f=>({key:f.key,value:f.key,label:f.label}));return V.isEmpty(i.customPeriods)||u.push({key:o,value:o,label:"Пользовательские"}),u}),d=t.computed(()=>l.value===o?[{type:"group",key:o,children:Oa(i.customPeriods??{})}]:_f(a,l.value));return(u,f)=>{const h=I.NButton,p=I.NScrollbar,m=I.NSelect,g=I.NMenu;return t.openBlock(),t.createElementBlock("div",n2,[t.createElementVNode("div",i2,[t.createVNode(p,{class:"max-h-96"},{default:t.withCtx(()=>[t.createElementVNode("div",r2,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.value,b=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:b.key},[b.label?(t.openBlock(),t.createElementBlock("div",o2,t.toDisplayString(b.label),1)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(b.children,y=>(t.openBlock(),t.createBlock(h,{key:y.value,size:"small",quaternary:"",type:y.value===n.activeKey?"primary":"default",class:"justify-start",onClick:_=>r("apply",y),onMouseenter:_=>r("preview",y),onMouseleave:f[0]||(f[0]=_=>r("preview"))},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(y.label),1)]),_:2},1032,["type","onClick","onMouseenter"]))),128))],64))),128))])]),_:1})]),t.unref(s)?(t.openBlock(),t.createBlock(m,{key:0,value:l.value,options:c.value,class:"order-1","onUpdate:value":f[1]||(f[1]=b=>l.value=b)},null,8,["value","options"])):(t.openBlock(),t.createElementBlock("div",s2,[t.createVNode(g,{value:l.value,options:c.value,mode:"vertical","onUpdate:value":f[2]||(f[2]=b=>l.value=b)},null,8,["value","options"])]))])}}}),c2={class:"flex flex-col gap-3"},d2={class:"flex flex-col gap-1 sm:flex-row sm:items-center"},u2={key:1,class:"overflow-x-auto rounded-lg border border-solid border-gray-200 p-2 shadow-sm sm:p-3"},f2={class:"flex flex-col items-stretch justify-between gap-2 sm:flex-row sm:items-center"},h2={class:"flex gap-2"},m2={},p2=t.defineComponent({...m2,__name:"date-range-dialog",props:{clearable:{type:Boolean,default:!0},disabled:{default:()=>({from:!1,to:!1})},show:{type:Boolean},dateRange:{default:void 0},customPeriods:{default:void 0},dateFormat:{default:void 0}},emits:["update:show","select"],setup(n,{emit:e}){const i=n,r=e,o=Ue.initRefDependingOnDeviceResolution("100%","90%","48rem"),s=t.ref("custom"),a=t.ref("months"),l=t.computed(()=>a.value==="months"?"Показать по дням":"Показать по месяцам"),c=()=>W.PreferencesStorageProvider.getActualDataFromStorage(uf)==="standard"?"standard":"custom",d=()=>W.PreferencesStorageProvider.getActualDataFromStorage(ff)==="days"?"days":"months",u=(v,E)=>{W.PreferencesStorageProvider.saveActualDataToStorage(v,E,Be.addYears(Be.startOfToday(),1))},f=t.ref({}),h=t.ref(null),p=t.ref(null),m=t.computed(()=>h.value??f.value),g=(v,E)=>{var R,M;const P=(R=i.disabled)!=null&&R.from?f.value.from:v,F=(M=i.disabled)!=null&&M.to?f.value.to:E;h.value=null,f.value=bf(P,F,i.disabled)},b=v=>{p.value=null,g(v,f.value.to)},y=v=>{p.value=null,g(f.value.from,v)},_=()=>{p.value=null,g(null,null)},x=v=>{p.value=null,g(v.from,v.to)},w=v=>{const E=v.item;g(E.from,E.to),p.value=String(v.value)},C=v=>{const E=v==null?void 0:v.item;h.value=E?{from:E.from,to:E.to}:null},N=()=>{h.value=null,s.value=s.value==="custom"?"standard":"custom",u(uf,s.value)},k=()=>{a.value=a.value==="months"?"days":"months",u(ff,a.value)},$=()=>{r("select",f.value),r("update:show",!1)};return t.watch(()=>i.show,v=>{v&&(s.value=c(),a.value=d(),p.value=null,h.value=null,f.value={...i.dateRange})}),(v,E)=>{const P=I.NButton,F=Wx,R=Dx,M=I.NTooltip,X=I.NModal;return t.openBlock(),t.createBlock(X,{show:n.show,preset:"card",title:"Выберите период",closable:"",style:t.normalizeStyle({width:t.unref(o),maxWidth:"calc(100vw - 1rem)"}),class:"sc-date-range-dialog","onUpdate:show":E[1]||(E[1]=G=>r("update:show",G))},{footer:t.withCtx(()=>[t.createElementVNode("div",f2,[t.createVNode(P,{text:"",type:"info",onClick:N},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(s.value==="custom"?"Показать стандартные периоды":"Показать произвольный период"),1)]),_:1}),t.createElementVNode("div",h2,[t.createVNode(P,{type:"primary",onClick:$},{default:t.withCtx(()=>[...E[3]||(E[3]=[t.createTextVNode(" Выбрать ",-1)])]),_:1}),t.createVNode(P,{onClick:E[0]||(E[0]=G=>r("update:show",!1))},{default:t.withCtx(()=>[...E[4]||(E[4]=[t.createTextVNode("Отмена",-1)])]),_:1})])])]),default:t.withCtx(()=>[t.createElementVNode("div",c2,[s.value==="custom"?(t.openBlock(),t.createBlock(t2,{key:0,from:f.value.from,to:f.value.to,onApply:w,onPreview:C},null,8,["from","to"])):t.createCommentVNode("",!0),t.createElementVNode("div",d2,[t.createVNode(kf,{from:m.value.from,to:m.value.to,clearable:n.clearable,disabled:n.disabled,"date-format":n.dateFormat,class:"flex-1","onUpdate:from":b,"onUpdate:to":y},null,8,["from","to","clearable","disabled","date-format"]),n.clearable?(t.openBlock(),t.createBlock(P,{key:0,text:"",type:"info",class:"sm:ml-2",onClick:_},{default:t.withCtx(()=>[...E[2]||(E[2]=[t.createTextVNode(" Очистить период ",-1)])]),_:1})):t.createCommentVNode("",!0)]),s.value==="custom"?(t.openBlock(),t.createElementBlock("div",u2,[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(a.value==="months"?hk:ok),{from:f.value.from,to:f.value.to,onSelect:x},{actions:t.withCtx(()=>[t.createVNode(M,{placement:"top",trigger:"hover"},{trigger:t.withCtx(()=>[t.createVNode(P,{size:"small","aria-label":l.value,"theme-overrides":t.unref(Lr),onClick:k},{icon:t.withCtx(()=>[a.value==="months"?(t.openBlock(),t.createBlock(F,{key:0})):(t.openBlock(),t.createBlock(R,{key:1}))]),_:1},8,["aria-label","theme-overrides"])]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(l.value),1)]),_:1})]),_:1},40,["from","to"]))])):(t.openBlock(),t.createBlock(l2,{key:2,"active-key":p.value,"custom-periods":n.customPeriods,onApply:w,onPreview:C},null,8,["active-key","custom-periods"]))])]),_:1},8,["show","style"])}}}),g2={class:"flex w-full min-w-0 items-center gap-1"},y2={},b2=t.defineComponent({...y2,__name:"date-range",props:{clearable:{type:Boolean,default:!0},disabled:{default:()=>({from:!1,to:!1})},predefinedDateRanges:{default:void 0},dateRange:{default:void 0},useDefaultPredefinedDateRanges:{type:Boolean,default:!1},placeholderFrom:{default:"Дата начала"},placeholderTo:{default:"Дата окончания"},dateFormat:{default:void 0}},emits:["update:date-range"],setup(n,{emit:e}){const i=n,r=e,o=t.ref(!1),s=t.computed(()=>{const u={...i.useDefaultPredefinedDateRanges?W.DateTimeProvider.defaultDateRanges():{},...i.predefinedDateRanges};return V.isEmpty(u)?void 0:u}),a=(u,f)=>{r("update:date-range",bf(u,f,i.disabled))},l=u=>{var f;a(u,(f=i.dateRange)==null?void 0:f.to)},c=u=>{var f;a((f=i.dateRange)==null?void 0:f.from,u)},d=u=>{a(u.from,u.to)};return(u,f)=>{var m,g,b,y;const h=Ax,p=I.NButton;return t.openBlock(),t.createElementBlock("div",g2,[t.createVNode(kf,{from:(m=n.dateRange)==null?void 0:m.from,to:(g=n.dateRange)==null?void 0:g.to,clearable:n.clearable,disabled:n.disabled,"placeholder-from":n.placeholderFrom,"placeholder-to":n.placeholderTo,"date-format":n.dateFormat,class:"min-w-0 flex-1","onUpdate:from":l,"onUpdate:to":c},null,8,["from","to","clearable","disabled","placeholder-from","placeholder-to","date-format"]),t.createVNode(p,{disabled:!!((b=n.disabled)!=null&&b.from&&((y=n.disabled)!=null&&y.to)),title:"Выбрать период","aria-label":"Выбрать период",onClick:f[0]||(f[0]=_=>o.value=!0)},{default:t.withCtx(()=>[t.createVNode(h)]),_:1},8,["disabled"]),t.createVNode(p2,{show:o.value,"onUpdate:show":f[1]||(f[1]=_=>o.value=_),"date-range":n.dateRange,clearable:n.clearable,disabled:n.disabled,"custom-periods":s.value,"date-format":n.dateFormat,onSelect:d},null,8,["show","date-range","clearable","disabled","custom-periods","date-format"])])}}}),_2={class:"sc-lbl-date text-nowrap"},w2={},es=t.defineComponent({...w2,__name:"date-time-label",props:{date:{},isTimeSecondary:{type:Boolean},isTimeOnSecondLine:{type:Boolean},isShowTime:{type:Boolean,default:!0}},setup(n){const e=n,i=t.computed(()=>Be.format(e.date,W.useBaseConfigStateStore().config.dateFormats.uiDate)),r=t.computed(()=>Be.format(e.date,"HH:mm"));return(o,s)=>(t.openBlock(),t.createElementBlock("span",{class:t.normalizeClass({"flex flex-col":n.isTimeOnSecondLine})},[t.createElementVNode("span",_2,t.toDisplayString(i.value),1),n.isShowTime?(t.openBlock(),t.createElementBlock("span",{key:0,class:t.normalizeClass([{"text-sc-grey":n.isTimeSecondary,"ml-1":!n.isTimeOnSecondLine},"sc-lbl-time"])},t.toDisplayString(r.value),3)):t.createCommentVNode("",!0)],2))}}),x2={},k2=t.defineComponent({...x2,__name:"debt",props:{debt:{default:0},showLabel:{type:Boolean,default:!1},wrapAsSmall:{type:Boolean,default:!1}},setup(n){const e=n,i=t.computed(()=>{let r="";return(e.showLabel??!1)&&(e.debt>0?r="Переплата: ":e.debt<0&&(r="Задолженность: ")),r});return(r,o)=>n.debt!==0?(t.openBlock(),t.createElementBlock("span",{key:0,class:t.normalizeClass({"text-sm":n.wrapAsSmall})},[t.createTextVNode(t.toDisplayString(i.value)+" ",1),t.createElementVNode("span",{class:t.normalizeClass({"text-green-700":n.debt>0,"text-red-700":n.debt<0})},t.toDisplayString(n.debt)+" ₽ ",3)],2)):t.createCommentVNode("",!0)}}),C2={class:"flex flex-row gap-2.5"},v2={class:"flex grow basis-0 flex-row flex-wrap justify-start justify-items-start gap-y-1 md:flex-nowrap"},S2={class:"flex min-w-0 flex-col-reverse flex-wrap-reverse justify-end gap-1 sm:flex-row"},B2={class:"mb-0.5 sm:mb-0 sm:ml-3"},N2={},T2=t.defineComponent({...N2,__name:"dialog-header",props:{showCloseButton:{type:Boolean,default:!0}},emits:["close"],setup(n){return(e,i)=>{const r=Jo,o=I.NButton,s=I.NPopover;return t.openBlock(),t.createElementBlock("div",C2,[t.createElementVNode("div",v2,[t.renderSlot(e.$slots,"main")]),t.createElementVNode("div",null,[t.createElementVNode("div",S2,[t.renderSlot(e.$slots,"extra-buttons"),t.createElementVNode("div",B2,[n.showCloseButton?(t.openBlock(),t.createBlock(s,{key:0,placement:"bottom"},{trigger:t.withCtx(()=>[t.createVNode(o,{size:"small",type:"error",onClick:i[0]||(i[0]=a=>e.$emit("close"))},{default:t.withCtx(()=>[t.createVNode(r)]),_:1})]),default:t.withCtx(()=>[i[1]||(i[1]=t.createTextVNode(" Закрыть ",-1))]),_:1})):t.createCommentVNode("",!0)])])])])}}}),$2={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function E2(n,e){return t.openBlock(),t.createElementBlock("svg",$2,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"square","stroke-miterlimit":"10","stroke-width":"44",d:"M465 127L241 384l-92-92m-9 93l-93-93m316-165L236 273"},null,-1)])])}const R2=t.markRaw({name:"ion-checkmark-done-sharp",render:E2}),P2={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function F2(n,e){return t.openBlock(),t.createElementBlock("svg",P2,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M368 128h80m-384 0h240m64 256h80m-384 0h240m-96-128h240m-384 0h80"},null,-1),t.createElementVNode("circle",{cx:"336",cy:"128",r:"32",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),t.createElementVNode("circle",{cx:"176",cy:"256",r:"32",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),t.createElementVNode("circle",{cx:"336",cy:"384",r:"32",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1)])])}const V2=t.markRaw({name:"ion-options-outline",render:F2}),M2={class:"flex flex-row gap-x-2.5 p-0 sm:p-1"},I2={class:"flex-auto"},A2={class:"sticky top-0 flex flex-none flex-col justify-start gap-y-1 sm:flex-row sm:justify-start sm:gap-x-1 sm:gap-y-0"},O2={class:"flex flex-none flex-col-reverse justify-end gap-y-1 sm:flex-row sm:justify-start sm:gap-x-1 sm:gap-y-0"},z2={},za=t.defineComponent({...z2,__name:"inline-view",props:{disabled:{type:Boolean,default:!1},showEditButton:{type:Boolean,default:!1},showApplyButton:{type:Boolean,default:!1},showCancelButton:{type:Boolean,default:!1}},emits:["edit","apply","cancel"],setup(n,{emit:e}){const i=e,r=t.ref(!1),o=()=>{i("edit")},s=()=>{r.value=!1},a=()=>{r.value=!0,i("apply",s)},l=()=>{i("cancel",s)};return(c,d)=>{const u=V2,f=I.NButton,h=I.NPopover,p=R2,m=Jo;return t.openBlock(),t.createElementBlock("div",M2,[t.createElementVNode("div",I2,[t.renderSlot(c.$slots,"default")]),t.createElementVNode("div",null,[t.createElementVNode("div",A2,[t.createElementVNode("div",O2,[n.showEditButton?(t.openBlock(),t.createBlock(h,{key:0,placement:"bottom"},{trigger:t.withCtx(()=>[t.createVNode(f,{disabled:n.disabled||r.value,type:"info",ghost:"",size:"small",onClick:o},{default:t.withCtx(()=>[t.createVNode(u)]),_:1},8,["disabled"])]),default:t.withCtx(()=>[d[0]||(d[0]=t.createTextVNode(" Редактировать данные ",-1))]),_:1})):t.createCommentVNode("",!0),n.showApplyButton?(t.openBlock(),t.createBlock(h,{key:1,disabled:r.value,placement:"bottom"},{trigger:t.withCtx(()=>[t.createVNode(f,{disabled:n.disabled||r.value,type:"primary",size:"small",onClick:a},{default:t.withCtx(()=>[t.createVNode(p)]),_:1},8,["disabled"])]),default:t.withCtx(()=>[d[1]||(d[1]=t.createTextVNode(" Сохранить изменения ",-1))]),_:1},8,["disabled"])):t.createCommentVNode("",!0),n.showCancelButton?(t.openBlock(),t.createBlock(h,{key:2,placement:"bottom"},{trigger:t.withCtx(()=>[t.createVNode(f,{disabled:n.disabled||r.value,type:"error",size:"small",onClick:l},{default:t.withCtx(()=>[t.createVNode(m)]),_:1},8,["disabled"])]),default:t.withCtx(()=>[d[2]||(d[2]=t.createTextVNode(" Отменить изменения ",-1))]),_:1})):t.createCommentVNode("",!0)]),t.renderSlot(c.$slots,"extra-buttons")])])])}}}),D2={},Cf=t.defineComponent({...D2,__name:"inline-editable-item",props:{disabled:{type:Boolean,default:!1},showEditor:{type:Boolean,default:!1},showEditButton:{type:Boolean,default:!0}},emits:["editor:apply","editor:cancel"],setup(n,{emit:e}){const i=n,r=e,o=t.ref(i.showEditor),s=l=>{r("editor:apply",d=>{o.value=!d,l()})},a=l=>{o.value=!1,l(),r("editor:cancel")};return t.onMounted(()=>{t.watch(()=>i.showEditor,l=>{o.value=l})}),(l,c)=>(t.openBlock(),t.createElementBlock("div",null,[o.value?(t.openBlock(),t.createBlock(za,{key:1,disabled:n.disabled,"show-apply-button":!0,"show-cancel-button":!0,onApply:s,onCancel:a},{"extra-buttons":t.withCtx(()=>[t.renderSlot(l.$slots,"extra-editor-buttons")]),default:t.withCtx(()=>[t.renderSlot(l.$slots,"editor")]),_:3},8,["disabled"])):(t.openBlock(),t.createBlock(za,{key:0,disabled:n.disabled,"show-edit-button":n.showEditButton,onEdit:c[0]||(c[0]=d=>o.value=!0)},{"extra-buttons":t.withCtx(()=>[t.renderSlot(l.$slots,"extra-viewer-buttons")]),default:t.withCtx(()=>[t.renderSlot(l.$slots,"viewer")]),_:3},8,["disabled","show-edit-button"]))]))}}),L2={key:0,class:"whitespace-pre-line"},H2={key:1,class:"text-sc-dark-grey"},W2={},j2=t.defineComponent({...W2,__name:"comment-editor",props:{disabled:{type:Boolean,default:!1},comment:{default:""}},emits:["update:comment"],setup(n,{emit:e}){const i=n,r=e,o=t.ref(i.comment);t.watch(()=>o.value,l=>{o.value=l});const s=l=>{r("update:comment",o.value,l)},a=()=>{o.value=i.comment};return(l,c)=>{const d=I.NInput;return t.openBlock(),t.createBlock(Cf,{disabled:n.disabled,"onEditor:apply":s,"onEditor:cancel":a},{viewer:t.withCtx(()=>[t.createElementVNode("div",null,[n.comment?(t.openBlock(),t.createElementBlock("span",L2,t.toDisplayString(n.comment),1)):(t.openBlock(),t.createElementBlock("span",H2," - Комментарий отсутствует - "))])]),editor:t.withCtx(()=>[t.createVNode(d,{value:o.value,"onUpdate:value":c[0]||(c[0]=u=>o.value=u),clearable:!0,type:"textarea"},null,8,["value"])]),_:1},8,["disabled"])}}}),q2={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function X2(n,e){return t.openBlock(),t.createElementBlock("svg",q2,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M336 176h40a40 40 0 0 1 40 40v208a40 40 0 0 1-40 40H136a40 40 0 0 1-40-40V216a40 40 0 0 1 40-40h40"},null,-1),t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"m176 272l80 80l80-80M256 48v288"},null,-1)])])}const Y2=t.markRaw({name:"ion-download-outline",render:X2}),U2={},K2=t.defineComponent({...U2,__name:"single-file-upload-selector",props:{draggedAreaText:{},accept:{},isError:{type:Boolean}},emits:["update:file"],setup(n,{emit:e}){const i=n,r=e,o=t.ref([]),s=t.computed(()=>o.value.map(l=>(l.status=i.isError?"error":"finished",l))),a=l=>{o.value=l;const c={name:"",content:""};if(l.length===0){r("update:file",null);return}const d=l[0];c.name=d.name;const u=new FileReader;u.addEventListener("load",()=>{c.content=u.result??"",r("update:file",c)}),u.readAsDataURL(d.file)};return(l,c)=>{const d=Y2;return t.openBlock(),t.createBlock(t.unref(I.NUpload),{"file-list":s.value,"default-upload":!1,max:1,"show-retry-button":!1,action:"",accept:n.accept,"directory-dnd":"",class:"content-center","onUpdate:fileList":a},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NUploadDragger),null,{default:t.withCtx(()=>[t.renderSlot(l.$slots,"dragged-area",{},()=>[t.createElementVNode("div",null,[t.createVNode(d,{class:"text-2xl"}),t.createElementVNode("div",null,t.toDisplayString(n.draggedAreaText??"Перетащите в эту область файл, который необходимо загрузить."),1)])])]),_:3})]),_:3},8,["file-list","accept"])}}}),G2={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Z2(n,e){return t.openBlock(),t.createElementBlock("svg",G2,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M449.07 399.08L278.64 82.58c-12.08-22.44-44.26-22.44-56.35 0L51.87 399.08A32 32 0 0 0 80 446.25h340.89a32 32 0 0 0 28.18-47.17m-198.6-1.83a20 20 0 1 1 20-20a20 20 0 0 1-20 20m21.72-201.15l-5.74 122a16 16 0 0 1-32 0l-5.74-121.95a21.73 21.73 0 0 1 21.5-22.69h.21a21.74 21.74 0 0 1 21.73 22.7Z"},null,-1)])])}const Q2=t.markRaw({name:"ion-warning",render:Z2}),J2={},eC=t.defineComponent({...J2,__name:"warning-icon",props:{popoverText:{default:""},iconClass:{default:"text-sc-warning"}},setup(n){return(e,i)=>{const r=Q2,o=I.NPopover;return t.openBlock(),t.createBlock(o,{disabled:n.popoverText.length===0,placement:"bottom"},{trigger:t.withCtx(()=>[t.createVNode(r,{class:t.normalizeClass(`ml-0.5 ${n.iconClass}`)},null,8,["class"])]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(n.popoverText),1)]),_:1},8,["disabled"])}}}),tC={},nC=t.defineComponent({...tC,__name:"debounced-input",props:{value:{default:void 0},clearable:{type:Boolean,default:!1},debounceTime:{default:800},placeholder:{default:""}},emits:["update:value"],setup(n,{emit:e}){const i=n,r=e,o=t.ref(i.value),s=t.computed(()=>t.inject("debounce-input-time",i.debounceTime)),a=V.debounce(()=>r("update:value",o.value),s.value),l=c=>{o.value=c,a()};return t.watch(()=>i.value,c=>{o.value=c}),(c,d)=>(t.openBlock(),t.createBlock(t.unref(I.NInput),{value:o.value,"onUpdate:value":[d[0]||(d[0]=u=>o.value=u),l],clearable:n.clearable,placeholder:n.placeholder},{prefix:t.withCtx(()=>[t.renderSlot(c.$slots,"prefix")]),_:3},8,["value","clearable","placeholder"]))}}),iC={},rC=t.defineComponent({...iC,__name:"debounced-input-number",props:{value:{default:void 0},clearable:{type:Boolean,default:!1},debounceTime:{default:500},placeholder:{default:""},min:{default:void 0},max:{default:void 0},step:{default:1},validator:{type:Function,default:void 0},parse:{type:Function,default:void 0},showButton:{type:Boolean,default:!0}},emits:["update:value","keydown","input","focus"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.ref(r.value),a=t.computed(()=>t.inject("debounce-input-time",r.debounceTime)),l=V.debounce(()=>o("update:value",s.value),a.value),c=p=>{s.value=p,l()};t.watch(()=>r.value,p=>{s.value=p});const d=t.ref(null);return e({focus:()=>{var p;return(p=d.value)==null?void 0:p.focus()},blur:()=>{var p;return(p=d.value)==null?void 0:p.blur()},select:()=>{var p;return(p=d.value)==null?void 0:p.select()}}),(p,m)=>(t.openBlock(),t.createBlock(t.unref(I.NInputNumber),{ref_key:"inputReference",ref:d,value:s.value??null,clearable:n.clearable,parse:n.parse,"show-button":n.showButton,placeholder:n.placeholder,min:n.min,max:n.max,step:n.step,validator:n.validator,"onUpdate:value":c,onKeydown:m[0]||(m[0]=g=>o("keydown",g)),onInput:m[1]||(m[1]=g=>o("input",g)),onFocus:m[2]||(m[2]=g=>o("focus",g))},{prefix:t.withCtx(()=>[t.renderSlot(p.$slots,"prefix")]),_:3},8,["value","clearable","parse","show-button","placeholder","min","max","step","validator"]))}}),oC={},sC=t.defineComponent({...oC,__name:"phone-input",props:{value:{},debounceTime:{},disabled:{type:Boolean},placeholder:{},defaultCountry:{},preferredCountries:{},onlyCountries:{}},emits:["update:value"],setup(n,{emit:e}){const i=n,r=e,o=t.ref((i.value??"").replaceAll(/\D*/g,"")),s=V.debounce(c=>r("update:value",c),i.debounceTime??0),a=c=>{let d="";if(V.isString(c))o.value=c,d=c.replaceAll(/(\s|\(|\)|-|_)*/g,"");else if(V.isObject(c)){if(o.value=c.formatted,!c.valid)return;d=c instanceof Br.PhoneNumber?c.format("E.164"):`+${c.countryCallingCode}${c.nationalNumber}`}i.debounceTime?s(d):r("update:value",d)},l=c=>{const d=c.replaceAll(/\D*/g,"");try{const u=Br.parsePhoneNumberWithError(`+${d}`);u.isValid()?o.value=u.format("E.164"):u.getPossibleCountries().length>0&&(o.value=`+${d}`)}catch(u){if(u instanceof Br.ParseError)o.value=d;else throw u}};return t.watch(()=>i.value,c=>{var d;(c==null?void 0:c.replaceAll(/\D*/g,""))!==((d=o.value)==null?void 0:d.replaceAll(/\D*/g,""))&&l(c)},{immediate:!0}),t.onBeforeMount(()=>l(o.value??"")),(c,d)=>(t.openBlock(),t.createBlock(t.unref(Fm.VueTelInput),{modelValue:o.value,"onUpdate:modelValue":[d[0]||(d[0]=u=>o.value=u),a],"auto-default-country":!1,"auto-format":!0,"default-country":n.defaultCountry,disabled:n.disabled,"input-options":{placeholder:n.placeholder},"preferred-countries":n.preferredCountries,"only-countries":n.onlyCountries,mode:"international",class:"tel-input"},null,8,["modelValue","default-country","disabled","input-options","preferred-countries","only-countries"]))}}),aC=gn(sC,[["__scopeId","data-v-751dbb0e"]]),lC={class:"mb-7 grid grid-cols-2 gap-3.5 lg:grid-cols-4"},cC={class:"mb-2 text-[11.5px] font-semibold uppercase text-gray-500"},dC={},uC=t.defineComponent({...dC,__name:"kpi-grid",props:{items:{},isLoading:{type:Boolean}},setup(n){return(e,i)=>(t.openBlock(),t.createElementBlock("div",lC,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.items,r=>(t.openBlock(),t.createElementBlock("div",{key:r.label,class:"rounded-lg border border-solid border-gray-200 px-4 py-4"},[t.createElementVNode("div",cC,t.toDisplayString(r.label),1),t.createElementVNode("div",{class:t.normalizeClass(["text-[25px] font-bold",r.valueClass])},t.toDisplayString(n.isLoading?"…":r.value),3),t.createElementVNode("div",{class:t.normalizeClass(["mt-1.5 text-xs font-medium",r.noteClass])},t.toDisplayString(r.note),3)]))),128))]))}}),fC={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function hC(n,e){return t.openBlock(),t.createElementBlock("svg",fC,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 6H6a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-6m-7 1l9-9m-5 0h5v5"},null,-1)])])}const mC=t.markRaw({name:"tabler-external-link",render:hC}),pC={class:"flex flex-row gap-1 hover:underline hover:decoration-dashed"},gC=["href"],yC={},bC=t.defineComponent({...yC,__name:"external-link",props:{text:{},url:{},description:{}},setup(n){return(e,i)=>{const r=mC,o=I.NTooltip;return t.openBlock(),t.createBlock(o,{disabled:t.unref(V.isUndefined)(n.description),placement:"top-start"},{trigger:t.withCtx(()=>[t.createElementVNode("span",pC,[t.createElementVNode("a",{href:n.url,target:"_blank",class:"no-underline"},t.toDisplayString(n.text),9,gC),t.createVNode(r,{class:"mt-0.5 flex-none"})])]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(n.description),1)]),_:1},8,["disabled"])}}}),_C={key:1,class:"h-24"},wC={key:2,class:"flex flex-col gap-3"},xC={},kC=t.defineComponent({...xC,__name:"compact-card-list",props:{isLoading:{type:Boolean},isEmpty:{type:Boolean},emptyDescription:{},pagination:{}},emits:["update:page","update:pageSize"],setup(n,{emit:e}){const i=e,r=[20,50,100];return(o,s)=>(t.openBlock(),t.createBlock(t.unref(I.NSpin),{show:n.isLoading},{default:t.withCtx(()=>[!n.isLoading&&n.isEmpty?(t.openBlock(),t.createBlock(t.unref(I.NEmpty),{key:0,description:n.emptyDescription},null,8,["description"])):n.isLoading&&n.isEmpty?(t.openBlock(),t.createElementBlock("div",_C)):(t.openBlock(),t.createElementBlock("div",wC,[t.renderSlot(o.$slots,"default")])),n.pagination&&n.pagination.itemCount>0?(t.openBlock(),t.createBlock(t.unref(I.NPagination),{key:3,class:"mt-4 flex-wrap justify-center gap-y-2",size:"small",page:n.pagination.page,"page-size":n.pagination.pageSize,"item-count":n.pagination.itemCount,"page-slot":n.pagination.pageSlot,"page-sizes":r,"show-size-picker":!0,prefix:t.unref(ec),"onUpdate:page":s[0]||(s[0]=a=>i("update:page",a)),"onUpdate:pageSize":s[1]||(s[1]=a=>i("update:pageSize",a))},null,8,["page","page-size","item-count","page-slot","prefix"])):t.createCommentVNode("",!0)]),_:3},8,["show"]))}}),CC={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function vC(n,e){return t.openBlock(),t.createElementBlock("svg",CC,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32",d:"M448 256c0-106-86-192-192-192S64 150 64 256s86 192 192 192s192-86 192-192Z"},null,-1),t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M336 256H176"},null,-1)])])}const SC=t.markRaw({name:"ion-remove-circle-outline",render:vC});let ts=[];const vf=new WeakMap;function BC(){ts.forEach(n=>n(...vf.get(n))),ts=[]}function Sf(n,...e){vf.set(n,e),!ts.includes(n)&&ts.push(n)===1&&requestAnimationFrame(BC)}function Hr(n,e){let{target:i}=n;for(;i;){if(i.dataset&&i.dataset[e]!==void 0)return!0;i=i.parentElement}return!1}function Wr(n){return n.composedPath()[0]||null}function jr(n){return typeof n=="string"?n.endsWith("px")?Number(n.slice(0,n.length-2)):Number(n):n}function qr(n){if(n!=null)return typeof n=="number"?`${n}px`:n.endsWith("px")?n:`${n}px`}function xn(n,e){const i=n.trim().split(/\s+/g),r={top:i[0]};switch(i.length){case 1:r.right=i[0],r.bottom=i[0],r.left=i[0];break;case 2:r.right=i[1],r.left=i[1],r.bottom=i[0];break;case 3:r.right=i[1],r.bottom=i[2],r.left=i[1];break;case 4:r.right=i[1],r.bottom=i[2],r.left=i[3];break;default:throw new Error("[seemly/getMargin]:"+n+" is not a valid value.")}return e===void 0?r:r[e]}const Bf={aliceblue:"#F0F8FF",antiquewhite:"#FAEBD7",aqua:"#0FF",aquamarine:"#7FFFD4",azure:"#F0FFFF",beige:"#F5F5DC",bisque:"#FFE4C4",black:"#000",blanchedalmond:"#FFEBCD",blue:"#00F",blueviolet:"#8A2BE2",brown:"#A52A2A",burlywood:"#DEB887",cadetblue:"#5F9EA0",chartreuse:"#7FFF00",chocolate:"#D2691E",coral:"#FF7F50",cornflowerblue:"#6495ED",cornsilk:"#FFF8DC",crimson:"#DC143C",cyan:"#0FF",darkblue:"#00008B",darkcyan:"#008B8B",darkgoldenrod:"#B8860B",darkgray:"#A9A9A9",darkgrey:"#A9A9A9",darkgreen:"#006400",darkkhaki:"#BDB76B",darkmagenta:"#8B008B",darkolivegreen:"#556B2F",darkorange:"#FF8C00",darkorchid:"#9932CC",darkred:"#8B0000",darksalmon:"#E9967A",darkseagreen:"#8FBC8F",darkslateblue:"#483D8B",darkslategray:"#2F4F4F",darkslategrey:"#2F4F4F",darkturquoise:"#00CED1",darkviolet:"#9400D3",deeppink:"#FF1493",deepskyblue:"#00BFFF",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1E90FF",firebrick:"#B22222",floralwhite:"#FFFAF0",forestgreen:"#228B22",fuchsia:"#F0F",gainsboro:"#DCDCDC",ghostwhite:"#F8F8FF",gold:"#FFD700",goldenrod:"#DAA520",gray:"#808080",grey:"#808080",green:"#008000",greenyellow:"#ADFF2F",honeydew:"#F0FFF0",hotpink:"#FF69B4",indianred:"#CD5C5C",indigo:"#4B0082",ivory:"#FFFFF0",khaki:"#F0E68C",lavender:"#E6E6FA",lavenderblush:"#FFF0F5",lawngreen:"#7CFC00",lemonchiffon:"#FFFACD",lightblue:"#ADD8E6",lightcoral:"#F08080",lightcyan:"#E0FFFF",lightgoldenrodyellow:"#FAFAD2",lightgray:"#D3D3D3",lightgrey:"#D3D3D3",lightgreen:"#90EE90",lightpink:"#FFB6C1",lightsalmon:"#FFA07A",lightseagreen:"#20B2AA",lightskyblue:"#87CEFA",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#B0C4DE",lightyellow:"#FFFFE0",lime:"#0F0",limegreen:"#32CD32",linen:"#FAF0E6",magenta:"#F0F",maroon:"#800000",mediumaquamarine:"#66CDAA",mediumblue:"#0000CD",mediumorchid:"#BA55D3",mediumpurple:"#9370DB",mediumseagreen:"#3CB371",mediumslateblue:"#7B68EE",mediumspringgreen:"#00FA9A",mediumturquoise:"#48D1CC",mediumvioletred:"#C71585",midnightblue:"#191970",mintcream:"#F5FFFA",mistyrose:"#FFE4E1",moccasin:"#FFE4B5",navajowhite:"#FFDEAD",navy:"#000080",oldlace:"#FDF5E6",olive:"#808000",olivedrab:"#6B8E23",orange:"#FFA500",orangered:"#FF4500",orchid:"#DA70D6",palegoldenrod:"#EEE8AA",palegreen:"#98FB98",paleturquoise:"#AFEEEE",palevioletred:"#DB7093",papayawhip:"#FFEFD5",peachpuff:"#FFDAB9",peru:"#CD853F",pink:"#FFC0CB",plum:"#DDA0DD",powderblue:"#B0E0E6",purple:"#800080",rebeccapurple:"#663399",red:"#F00",rosybrown:"#BC8F8F",royalblue:"#4169E1",saddlebrown:"#8B4513",salmon:"#FA8072",sandybrown:"#F4A460",seagreen:"#2E8B57",seashell:"#FFF5EE",sienna:"#A0522D",silver:"#C0C0C0",skyblue:"#87CEEB",slateblue:"#6A5ACD",slategray:"#708090",slategrey:"#708090",snow:"#FFFAFA",springgreen:"#00FF7F",steelblue:"#4682B4",tan:"#D2B48C",teal:"#008080",thistle:"#D8BFD8",tomato:"#FF6347",turquoise:"#40E0D0",violet:"#EE82EE",wheat:"#F5DEB3",white:"#FFF",whitesmoke:"#F5F5F5",yellow:"#FF0",yellowgreen:"#9ACD32",transparent:"#0000"};function NC(n,e,i){e/=100,i/=100;let r=(o,s=(o+n/60)%6)=>i-i*e*Math.max(Math.min(s,4-s,1),0);return[r(5)*255,r(3)*255,r(1)*255]}function TC(n,e,i){e/=100,i/=100;let r=e*Math.min(i,1-i),o=(s,a=(s+n/30)%12)=>i-r*Math.max(Math.min(a-3,9-a,1),-1);return[o(0)*255,o(8)*255,o(4)*255]}const Mn="^\\s*",In="\\s*$",mi="\\s*((\\.\\d+)|(\\d+(\\.\\d*)?))%\\s*",rn="\\s*((\\.\\d+)|(\\d+(\\.\\d*)?))\\s*",Pi="([0-9A-Fa-f])",Fi="([0-9A-Fa-f]{2})",Nf=new RegExp(`${Mn}hsl\\s*\\(${rn},${mi},${mi}\\)${In}`),Tf=new RegExp(`${Mn}hsv\\s*\\(${rn},${mi},${mi}\\)${In}`),$f=new RegExp(`${Mn}hsla\\s*\\(${rn},${mi},${mi},${rn}\\)${In}`),Ef=new RegExp(`${Mn}hsva\\s*\\(${rn},${mi},${mi},${rn}\\)${In}`),$C=new RegExp(`${Mn}rgb\\s*\\(${rn},${rn},${rn}\\)${In}`),EC=new RegExp(`${Mn}rgba\\s*\\(${rn},${rn},${rn},${rn}\\)${In}`),RC=new RegExp(`${Mn}#${Pi}${Pi}${Pi}${In}`),PC=new RegExp(`${Mn}#${Fi}${Fi}${Fi}${In}`),FC=new RegExp(`${Mn}#${Pi}${Pi}${Pi}${Pi}${In}`),VC=new RegExp(`${Mn}#${Fi}${Fi}${Fi}${Fi}${In}`);function Qt(n){return parseInt(n,16)}function MC(n){try{let e;if(e=$f.exec(n))return[is(e[1]),pi(e[5]),pi(e[9]),Mi(e[13])];if(e=Nf.exec(n))return[is(e[1]),pi(e[5]),pi(e[9]),1];throw new Error(`[seemly/hsla]: Invalid color value ${n}.`)}catch(e){throw e}}function IC(n){try{let e;if(e=Ef.exec(n))return[is(e[1]),pi(e[5]),pi(e[9]),Mi(e[13])];if(e=Tf.exec(n))return[is(e[1]),pi(e[5]),pi(e[9]),1];throw new Error(`[seemly/hsva]: Invalid color value ${n}.`)}catch(e){throw e}}function Vi(n){try{let e;if(e=PC.exec(n))return[Qt(e[1]),Qt(e[2]),Qt(e[3]),1];if(e=$C.exec(n))return[$t(e[1]),$t(e[5]),$t(e[9]),1];if(e=EC.exec(n))return[$t(e[1]),$t(e[5]),$t(e[9]),Mi(e[13])];if(e=RC.exec(n))return[Qt(e[1]+e[1]),Qt(e[2]+e[2]),Qt(e[3]+e[3]),1];if(e=VC.exec(n))return[Qt(e[1]),Qt(e[2]),Qt(e[3]),Mi(Qt(e[4])/255)];if(e=FC.exec(n))return[Qt(e[1]+e[1]),Qt(e[2]+e[2]),Qt(e[3]+e[3]),Mi(Qt(e[4]+e[4])/255)];if(n in Bf)return Vi(Bf[n]);if(Nf.test(n)||$f.test(n)){const[i,r,o,s]=MC(n);return[...TC(i,r,o),s]}else if(Tf.test(n)||Ef.test(n)){const[i,r,o,s]=IC(n);return[...NC(i,r,o),s]}throw new Error(`[seemly/rgba]: Invalid color value ${n}.`)}catch(e){throw e}}function AC(n){return n>1?1:n<0?0:n}function Da(n,e,i,r){return`rgba(${$t(n)}, ${$t(e)}, ${$t(i)}, ${AC(r)})`}function La(n,e,i,r,o){return $t((n*e*(1-r)+i*r)/o)}function OC(n,e){Array.isArray(n)||(n=Vi(n)),Array.isArray(e)||(e=Vi(e));const i=n[3],r=e[3],o=Mi(i+r-i*r);return Da(La(n[0],i,e[0],r,o),La(n[1],i,e[1],r,o),La(n[2],i,e[2],r,o),o)}function Le(n,e){const[i,r,o,s=1]=Array.isArray(n)?n:Vi(n);return typeof e.alpha=="number"?Da(i,r,o,e.alpha):Da(i,r,o,s)}function ns(n,e){const[i,r,o,s=1]=Array.isArray(n)?n:Vi(n),{lightness:a=1,alpha:l=1}=e;return zC([i*a,r*a,o*a,s*l])}function Mi(n){const e=Math.round(Number(n)*100)/100;return e>1?1:e<0?0:e}function is(n){const e=Math.round(Number(n));return e>=360||e<0?0:e}function $t(n){const e=Math.round(Number(n));return e>255?255:e<0?0:e}function pi(n){const e=Math.round(Number(n));return e>100?100:e<0?0:e}function zC(n){const[e,i,r]=n;return 3 in n?`rgba(${$t(e)}, ${$t(i)}, ${$t(r)}, ${Mi(n[3])})`:`rgba(${$t(e)}, ${$t(i)}, ${$t(r)}, 1)`}function DC(n=8){return Math.random().toString(16).slice(2,2+n)}function Rf(n){return Array.isArray(n)?n:[n]}const Ha={STOP:"STOP"};function Pf(n,e){const i=e(n);n.children!==void 0&&i!==Ha.STOP&&n.children.forEach(r=>Pf(r,e))}function LC(n,e={}){const{preserveGroup:i=!1}=e,r=[],o=i?a=>{a.isLeaf||(r.push(a.key),s(a.children))}:a=>{a.isLeaf||(a.isGroup||r.push(a.key),s(a.children))};function s(a){a.forEach(o)}return s(n),r}function HC(n,e){const{isLeaf:i}=n;return i!==void 0?i:!e(n)}function WC(n){return n.children}function jC(n){return n.key}function qC(){return!1}function XC(n,e){const{isLeaf:i}=n;return!(i===!1&&!Array.isArray(e(n)))}function YC(n){return n.disabled===!0}function UC(n,e){return n.isLeaf===!1&&!Array.isArray(e(n))}function KC(n,e){if(n.isLeaf===!0){const i=e(n);if(Array.isArray(i)&&i.length>0)return!0}return!1}function Wa(n){var e;return n==null?[]:Array.isArray(n)?n:(e=n.checkedKeys)!==null&&e!==void 0?e:[]}function ja(n){var e;return n==null||Array.isArray(n)?[]:(e=n.indeterminateKeys)!==null&&e!==void 0?e:[]}function GC(n,e){const i=new Set(n);return e.forEach(r=>{i.has(r)||i.add(r)}),Array.from(i)}function ZC(n,e){const i=new Set(n);return e.forEach(r=>{i.has(r)&&i.delete(r)}),Array.from(i)}function QC(n){return(n==null?void 0:n.type)==="group"}function JC(n){const e=new Map;return n.forEach((i,r)=>{e.set(i.key,r)}),i=>{var r;return(r=e.get(i))!==null&&r!==void 0?r:null}}class ev extends Error{constructor(){super(),this.message="SubtreeNotLoadedError: checking a subtree whose required nodes are not fully loaded."}}function tv(n,e,i,r){return rs(e.concat(n),i,r,!1)}function nv(n,e){const i=new Set;return n.forEach(r=>{const o=e.treeNodeMap.get(r);if(o!==void 0){let s=o.parent;for(;s!==null&&!(s.disabled||i.has(s.key));)i.add(s.key),s=s.parent}}),i}function iv(n,e,i,r){const o=rs(e,i,r,!1),s=rs(n,i,r,!0),a=nv(n,i),l=[];return o.forEach(c=>{(s.has(c)||a.has(c))&&l.push(c)}),l.forEach(c=>o.delete(c)),o}function qa(n,e){const{checkedKeys:i,keysToCheck:r,keysToUncheck:o,indeterminateKeys:s,cascade:a,leafOnly:l,checkStrategy:c,allowNotLoaded:d}=n;if(!a)return r!==void 0?{checkedKeys:GC(i,r),indeterminateKeys:Array.from(s)}:o!==void 0?{checkedKeys:ZC(i,o),indeterminateKeys:Array.from(s)}:{checkedKeys:Array.from(i),indeterminateKeys:Array.from(s)};const{levelTreeNodeMap:u}=e;let f;o!==void 0?f=iv(o,i,e,d):r!==void 0?f=tv(r,i,e,d):f=rs(i,e,d,!1);const h=c==="parent",p=c==="child"||l,m=f,g=new Set,b=Math.max.apply(null,Array.from(u.keys()));for(let y=b;y>=0;y-=1){const _=y===0,x=u.get(y);for(const w of x){if(w.isLeaf)continue;const{key:C,shallowLoaded:N}=w;if(p&&N&&w.children.forEach(E=>{!E.disabled&&!E.isLeaf&&E.shallowLoaded&&m.has(E.key)&&m.delete(E.key)}),w.disabled||!N)continue;let k=!0,$=!1,v=!0;for(const E of w.children){const P=E.key;if(!E.disabled){if(v&&(v=!1),m.has(P))$=!0;else if(g.has(P)){$=!0,k=!1;break}else if(k=!1,$)break}}k&&!v?(h&&w.children.forEach(E=>{!E.disabled&&m.has(E.key)&&m.delete(E.key)}),m.add(C)):$&&g.add(C),_&&p&&m.has(C)&&m.delete(C)}}return{checkedKeys:Array.from(m),indeterminateKeys:Array.from(g)}}function rs(n,e,i,r){const{treeNodeMap:o,getChildren:s}=e,a=new Set,l=new Set(n);return n.forEach(c=>{const d=o.get(c);d!==void 0&&Pf(d,u=>{if(u.disabled)return Ha.STOP;const{key:f}=u;if(!a.has(f)&&(a.add(f),l.add(f),UC(u.rawNode,s))){if(r)return Ha.STOP;if(!i)throw new ev}})}),l}function rv(n,{includeGroup:e=!1,includeSelf:i=!0},r){var o;const s=r.treeNodeMap;let a=n==null?null:(o=s.get(n))!==null&&o!==void 0?o:null;const l={keyPath:[],treeNodePath:[],treeNode:a};if(a!=null&&a.ignored)return l.treeNode=null,l;for(;a;)!a.ignored&&(e||!a.isGroup)&&l.treeNodePath.push(a),a=a.parent;return l.treeNodePath.reverse(),i||l.treeNodePath.pop(),l.keyPath=l.treeNodePath.map(c=>c.key),l}function ov(n){if(n.length===0)return null;const e=n[0];return e.isGroup||e.ignored||e.disabled?e.getNext():e}function sv(n,e){const i=n.siblings,r=i.length,{index:o}=n;return e?i[(o+1)%r]:o===i.length-1?null:i[o+1]}function Ff(n,e,{loop:i=!1,includeDisabled:r=!1}={}){const o=e==="prev"?av:sv,s={reverse:e==="prev"};let a=!1,l=null;function c(d){if(d!==null){if(d===n){if(!a)a=!0;else if(!n.disabled&&!n.isGroup){l=n;return}}else if((!d.disabled||r)&&!d.ignored&&!d.isGroup){l=d;return}if(d.isGroup){const u=Xa(d,s);u!==null?l=u:c(o(d,i))}else{const u=o(d,!1);if(u!==null)c(u);else{const f=lv(d);f!=null&&f.isGroup?c(o(f,i)):i&&c(o(d,!0))}}}}return c(n),l}function av(n,e){const i=n.siblings,r=i.length,{index:o}=n;return e?i[(o-1+r)%r]:o===0?null:i[o-1]}function lv(n){return n.parent}function Xa(n,e={}){const{reverse:i=!1}=e,{children:r}=n;if(r){const{length:o}=r,s=i?o-1:0,a=i?-1:o,l=i?-1:1;for(let c=s;c!==a;c+=l){const d=r[c];if(!d.disabled&&!d.ignored)if(d.isGroup){const u=Xa(d,e);if(u!==null)return u}else return d}}return null}const cv={getChild(){return this.ignored?null:Xa(this)},getParent(){const{parent:n}=this;return n!=null&&n.isGroup?n.getParent():n},getNext(n={}){return Ff(this,"next",n)},getPrev(n={}){return Ff(this,"prev",n)}};function dv(n,e){const i=e?new Set(e):void 0,r=[];function o(s){s.forEach(a=>{r.push(a),!(a.isLeaf||!a.children||a.ignored)&&(a.isGroup||i===void 0||i.has(a.key))&&o(a.children)})}return o(n),r}function uv(n,e){const i=n.key;for(;e;){if(e.key===i)return!0;e=e.parent}return!1}var fv={};function Vf(n,e,i,r,o,s=null,a=0){const l=[];return n.forEach((c,d)=>{var u;fv.NODE_ENV!=="production"&&KC(c,o)&&console.error("[treemate]: node",c,"is invalid");const f=Object.create(r);if(f.rawNode=c,f.siblings=l,f.level=a,f.index=d,f.isFirstChild=d===0,f.isLastChild=d+1===n.length,f.parent=s,!f.ignored){const h=o(c);Array.isArray(h)&&(f.children=Vf(h,e,i,r,o,f,a+1))}l.push(f),e.set(f.key,f),i.has(a)||i.set(a,[]),(u=i.get(a))===null||u===void 0||u.push(f)}),l}function hv(n,e={}){var i;const r=new Map,o=new Map,{getDisabled:s=YC,getIgnored:a=qC,getIsGroup:l=QC,getKey:c=jC}=e,d=(i=e.getChildren)!==null&&i!==void 0?i:WC,u=e.ignoreEmptyChildren?w=>{const C=d(w);return Array.isArray(C)?C.length?C:null:C}:d,f=Object.assign({get key(){return c(this.rawNode)},get disabled(){return s(this.rawNode)},get isGroup(){return l(this.rawNode)},get isLeaf(){return HC(this.rawNode,u)},get shallowLoaded(){return XC(this.rawNode,u)},get ignored(){return a(this.rawNode)},contains(w){return uv(this,w)}},cv),h=Vf(n,r,o,f,u);function p(w){if(w==null)return null;const C=r.get(w);return C&&!C.isGroup&&!C.ignored?C:null}function m(w){if(w==null)return null;const C=r.get(w);return C&&!C.ignored?C:null}function g(w,C){const N=m(w);return N?N.getPrev(C):null}function b(w,C){const N=m(w);return N?N.getNext(C):null}function y(w){const C=m(w);return C?C.getParent():null}function _(w){const C=m(w);return C?C.getChild():null}const x={treeNodes:h,treeNodeMap:r,levelTreeNodeMap:o,maxLevel:Math.max(...o.keys()),getChildren:u,getFlattenedNodes(w){return dv(h,w)},getNode:p,getPrev:g,getNext:b,getParent:y,getChild:_,getFirstAvailableNode(){return ov(h)},getPath(w,C={}){return rv(w,C,x)},getCheckedKeys(w,C={}){const{cascade:N=!0,leafOnly:k=!1,checkStrategy:$="all",allowNotLoaded:v=!1}=C;return qa({checkedKeys:Wa(w),indeterminateKeys:ja(w),cascade:N,leafOnly:k,checkStrategy:$,allowNotLoaded:v},x)},check(w,C,N={}){const{cascade:k=!0,leafOnly:$=!1,checkStrategy:v="all",allowNotLoaded:E=!1}=N;return qa({checkedKeys:Wa(C),indeterminateKeys:ja(C),keysToCheck:w==null?[]:Rf(w),cascade:k,leafOnly:$,checkStrategy:v,allowNotLoaded:E},x)},uncheck(w,C,N={}){const{cascade:k=!0,leafOnly:$=!1,checkStrategy:v="all",allowNotLoaded:E=!1}=N;return qa({checkedKeys:Wa(C),indeterminateKeys:ja(C),keysToUncheck:w==null?[]:Rf(w),cascade:k,leafOnly:$,checkStrategy:v,allowNotLoaded:E},x)},getNonLeafKeys(w={}){return LC(h,w)}};return x}function os(n){return n.composedPath()[0]}const mv={mousemoveoutside:new WeakMap,clickoutside:new WeakMap};function pv(n,e,i){if(n==="mousemoveoutside"){const r=o=>{e.contains(os(o))||i(o)};return{mousemove:r,touchstart:r}}else if(n==="clickoutside"){let r=!1;const o=a=>{r=!e.contains(os(a))},s=a=>{r&&(e.contains(os(a))||i(a))};return{mousedown:o,mouseup:s,touchstart:o,touchend:s}}return console.error(`[evtd/create-trap-handler]: name \`${n}\` is invalid. This could be a bug of evtd.`),{}}function Mf(n,e,i){const r=mv[n];let o=r.get(e);o===void 0&&r.set(e,o=new WeakMap);let s=o.get(i);return s===void 0&&o.set(i,s=pv(n,e,i)),s}function gv(n,e,i,r){if(n==="mousemoveoutside"||n==="clickoutside"){const o=Mf(n,e,i);return Object.keys(o).forEach(s=>{Lt(s,document,o[s],r)}),!0}return!1}function yv(n,e,i,r){if(n==="mousemoveoutside"||n==="clickoutside"){const o=Mf(n,e,i);return Object.keys(o).forEach(s=>{yt(s,document,o[s],r)}),!0}return!1}function bv(){if(typeof window>"u")return{on:()=>{},off:()=>{}};const n=new WeakMap,e=new WeakMap;function i(){n.set(this,!0)}function r(){n.set(this,!0),e.set(this,!0)}function o(k,$,v){const E=k[$];return k[$]=function(){return v.apply(k,arguments),E.apply(k,arguments)},k}function s(k,$){k[$]=Event.prototype[$]}const a=new WeakMap,l=Object.getOwnPropertyDescriptor(Event.prototype,"currentTarget");function c(){var k;return(k=a.get(this))!==null&&k!==void 0?k:null}function d(k,$){l!==void 0&&Object.defineProperty(k,"currentTarget",{configurable:!0,enumerable:!0,get:$??l.get})}const u={bubble:{},capture:{}},f={};function h(){const k=function($){const{type:v,eventPhase:E,bubbles:P}=$,F=os($);if(E===2)return;const R=E===1?"capture":"bubble";let M=F;const X=[];for(;M===null&&(M=window),X.push(M),M!==window;)M=M.parentNode||null;const G=u.capture[v],Z=u.bubble[v];if(o($,"stopPropagation",i),o($,"stopImmediatePropagation",r),d($,c),R==="capture"){if(G===void 0)return;for(let O=X.length-1;O>=0&&!n.has($);--O){const A=X[O],Y=G.get(A);if(Y!==void 0){a.set($,A);for(const H of Y){if(e.has($))break;H($)}}if(O===0&&!P&&Z!==void 0){const H=Z.get(A);if(H!==void 0)for(const T of H){if(e.has($))break;T($)}}}}else if(R==="bubble"){if(Z===void 0)return;for(let O=0;O<X.length&&!n.has($);++O){const A=X[O],Y=Z.get(A);if(Y!==void 0){a.set($,A);for(const H of Y){if(e.has($))break;H($)}}}}s($,"stopPropagation"),s($,"stopImmediatePropagation"),d($)};return k.displayName="evtdUnifiedHandler",k}function p(){const k=function($){const{type:v,eventPhase:E}=$;if(E!==2)return;const P=f[v];P!==void 0&&P.forEach(F=>F($))};return k.displayName="evtdUnifiedWindowEventHandler",k}const m=h(),g=p();function b(k,$){const v=u[k];return v[$]===void 0&&(v[$]=new Map,window.addEventListener($,m,k==="capture")),v[$]}function y(k){return f[k]===void 0&&(f[k]=new Set,window.addEventListener(k,g)),f[k]}function _(k,$){let v=k.get($);return v===void 0&&k.set($,v=new Set),v}function x(k,$,v,E){const P=u[$][v];if(P!==void 0){const F=P.get(k);if(F!==void 0&&F.has(E))return!0}return!1}function w(k,$){const v=f[k];return!!(v!==void 0&&v.has($))}function C(k,$,v,E){let P;if(typeof E=="object"&&E.once===!0?P=G=>{N(k,$,P,E),v(G)}:P=v,gv(k,$,P,E))return;const R=E===!0||typeof E=="object"&&E.capture===!0?"capture":"bubble",M=b(R,k),X=_(M,$);if(X.has(P)||X.add(P),$===window){const G=y(k);G.has(P)||G.add(P)}}function N(k,$,v,E){if(yv(k,$,v,E))return;const F=E===!0||typeof E=="object"&&E.capture===!0,R=F?"capture":"bubble",M=b(R,k),X=_(M,$);if($===window&&!x($,F?"bubble":"capture",k,v)&&w(k,v)){const Z=f[k];Z.delete(v),Z.size===0&&(window.removeEventListener(k,g),f[k]=void 0)}X.has(v)&&X.delete(v),X.size===0&&M.delete($),M.size===0&&(window.removeEventListener(k,m,R==="capture"),u[R][k]=void 0)}return{on:C,off:N}}const{on:Lt,off:yt}=bv(),br="@@mmoContext",_v={mounted(n,{value:e}){n[br]={handler:void 0},typeof e=="function"&&(n[br].handler=e,Lt("mousemoveoutside",n,e))},updated(n,{value:e}){const i=n[br];typeof e=="function"?i.handler?i.handler!==e&&(yt("mousemoveoutside",n,i.handler),i.handler=e,Lt("mousemoveoutside",n,e)):(n[br].handler=e,Lt("mousemoveoutside",n,e)):i.handler&&(yt("mousemoveoutside",n,i.handler),i.handler=void 0)},unmounted(n){const{handler:e}=n[br];e&&yt("mousemoveoutside",n,e),n[br].handler=void 0}},_r="@@coContext",ss={mounted(n,{value:e,modifiers:i}){n[_r]={handler:void 0},typeof e=="function"&&(n[_r].handler=e,Lt("clickoutside",n,e,{capture:i.capture}))},updated(n,{value:e,modifiers:i}){const r=n[_r];typeof e=="function"?r.handler?r.handler!==e&&(yt("clickoutside",n,r.handler,{capture:i.capture}),r.handler=e,Lt("clickoutside",n,e,{capture:i.capture})):(n[_r].handler=e,Lt("clickoutside",n,e,{capture:i.capture})):r.handler&&(yt("clickoutside",n,r.handler,{capture:i.capture}),r.handler=void 0)},unmounted(n,{modifiers:e}){const{handler:i}=n[_r];i&&yt("clickoutside",n,i,{capture:e.capture}),n[_r].handler=void 0}};function wv(n,e){console.error(`[vdirs/${n}]: ${e}`)}class xv{constructor(){this.elementZIndex=new Map,this.nextZIndex=2e3}get elementCount(){return this.elementZIndex.size}ensureZIndex(e,i){const{elementZIndex:r}=this;if(i!==void 0){e.style.zIndex=`${i}`,r.delete(e);return}const{nextZIndex:o}=this;r.has(e)&&r.get(e)+1===this.nextZIndex||(e.style.zIndex=`${o}`,r.set(e,o),this.nextZIndex=o+1,this.squashState())}unregister(e,i){const{elementZIndex:r}=this;r.has(e)?r.delete(e):i===void 0&&wv("z-index-manager/unregister-element","Element not found when unregistering."),this.squashState()}squashState(){const{elementCount:e}=this;e||(this.nextZIndex=2e3),this.nextZIndex-e>2500&&this.rearrange()}rearrange(){const e=Array.from(this.elementZIndex.entries());e.sort((i,r)=>i[1]-r[1]),this.nextZIndex=2e3,e.forEach(i=>{const r=i[0],o=this.nextZIndex++;`${o}`!==r.style.zIndex&&(r.style.zIndex=`${o}`)})}}const Ya=new xv,wr="@@ziContext",If={mounted(n,e){const{value:i={}}=e,{zIndex:r,enabled:o}=i;n[wr]={enabled:!!o,initialized:!1},o&&(Ya.ensureZIndex(n,r),n[wr].initialized=!0)},updated(n,e){const{value:i={}}=e,{zIndex:r,enabled:o}=i,s=n[wr].enabled;o&&!s&&(Ya.ensureZIndex(n,r),n[wr].initialized=!0),n[wr].enabled=!!o},unmounted(n,e){if(!n[wr].initialized)return;const{value:i={}}=e,{zIndex:r}=i;Ya.unregister(n,r)}};function kv(n){const e=t.ref(!!n.value);if(e.value)return t.readonly(e);const i=t.watch(n,r=>{r&&(e.value=!0,i())});return t.readonly(e)}function fn(n){const e=t.computed(n),i=t.ref(e.value);return t.watch(e,r=>{i.value=r}),typeof n=="function"?i:{__v_isRef:!0,get value(){return i.value},set value(r){n.set(r)}}}const Cv=typeof window<"u";let xr,Xr;(()=>{var n,e;xr=Cv?(e=(n=document)===null||n===void 0?void 0:n.fonts)===null||e===void 0?void 0:e.ready:void 0,Xr=!1,xr!==void 0?xr.then(()=>{Xr=!0}):Xr=!0})();function vv(n){if(Xr)return;let e=!1;t.onMounted(()=>{Xr||xr==null||xr.then(()=>{e||n()})}),t.onBeforeUnmount(()=>{e=!0})}function Ua(n,e){return t.watch(n,i=>{i!==void 0&&(e.value=i)}),t.computed(()=>n.value===void 0?e.value:n.value)}function as(){const n=t.ref(!1);return t.onMounted(()=>{n.value=!0}),t.readonly(n)}function Af(n,e){return t.computed(()=>{for(const i of e)if(n[i]!==void 0)return n[i];return n[e[e.length-1]]})}const Sv=(typeof window>"u"?!1:/iPad|iPhone|iPod/.test(navigator.platform)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)&&!window.MSStream;function Bv(){return Sv}function Ka(n,e,i="default"){const r=e[i];if(r===void 0)throw new Error(`[vueuc/${n}]: slot[${i}] is empty.`);return r()}function Ga(n,e=!0,i=[]){return n.forEach(r=>{if(r!==null){if(typeof r!="object"){(typeof r=="string"||typeof r=="number")&&i.push(t.createTextVNode(String(r)));return}if(Array.isArray(r)){Ga(r,e,i);return}if(r.type===t.Fragment){if(r.children===null)return;Array.isArray(r.children)&&Ga(r.children,e,i)}else r.type!==t.Comment&&i.push(r)}}),i}function Of(n,e,i="default"){const r=e[i];if(r===void 0)throw new Error(`[vueuc/${n}]: slot[${i}] is empty.`);const o=Ga(r());if(o.length===1)return o[0];throw new Error(`[vueuc/${n}]: slot[${i}] should have exactly one child.`)}let gi=null;function zf(){if(gi===null&&(gi=document.getElementById("v-binder-view-measurer"),gi===null)){gi=document.createElement("div"),gi.id="v-binder-view-measurer";const{style:n}=gi;n.position="fixed",n.left="0",n.right="0",n.top="0",n.bottom="0",n.pointerEvents="none",n.visibility="hidden",document.body.appendChild(gi)}return gi.getBoundingClientRect()}function Nv(n,e){const i=zf();return{top:e,left:n,height:0,width:0,right:i.width-n,bottom:i.height-e}}function Za(n){const e=n.getBoundingClientRect(),i=zf();return{left:e.left-i.left,top:e.top-i.top,bottom:i.height+i.top-e.bottom,right:i.width+i.left-e.right,width:e.width,height:e.height}}function Tv(n){return n.nodeType===9?null:n.parentNode}function Df(n){if(n===null)return null;const e=Tv(n);if(e===null)return null;if(e.nodeType===9)return document;if(e.nodeType===1){const{overflow:i,overflowX:r,overflowY:o}=getComputedStyle(e);if(/(auto|scroll|overlay)/.test(i+o+r))return e}return Df(e)}const Lf=t.defineComponent({name:"Binder",props:{syncTargetWithParent:Boolean,syncTarget:{type:Boolean,default:!0}},setup(n){var e;t.provide("VBinder",(e=t.getCurrentInstance())===null||e===void 0?void 0:e.proxy);const i=t.inject("VBinder",null),r=t.ref(null),o=y=>{r.value=y,i&&n.syncTargetWithParent&&i.setTargetRef(y)};let s=[];const a=()=>{let y=r.value;for(;y=Df(y),y!==null;)s.push(y);for(const _ of s)Lt("scroll",_,f,!0)},l=()=>{for(const y of s)yt("scroll",y,f,!0);s=[]},c=new Set,d=y=>{c.size===0&&a(),c.has(y)||c.add(y)},u=y=>{c.has(y)&&c.delete(y),c.size===0&&l()},f=()=>{Sf(h)},h=()=>{c.forEach(y=>y())},p=new Set,m=y=>{p.size===0&&Lt("resize",window,b),p.has(y)||p.add(y)},g=y=>{p.has(y)&&p.delete(y),p.size===0&&yt("resize",window,b)},b=()=>{p.forEach(y=>y())};return t.onBeforeUnmount(()=>{yt("resize",window,b),l()}),{targetRef:r,setTargetRef:o,addScrollListener:d,removeScrollListener:u,addResizeListener:m,removeResizeListener:g}},render(){return Ka("binder",this.$slots)}}),Hf=t.defineComponent({name:"Target",setup(){const{setTargetRef:n,syncTarget:e}=t.inject("VBinder");return{syncTarget:e,setTargetDirective:{mounted:n,updated:n}}},render(){const{syncTarget:n,setTargetDirective:e}=this;return n?t.withDirectives(Of("follower",this.$slots),[[e]]):Of("follower",this.$slots)}}),$v="@css-render/vue3-ssr";function Ev(n,e){return`<style cssr-id="${n}">
103
+ `}},Ao=Ni.Multiply,L0=[1,0,0,0,1,0,0,0,1],hi=new Bn(9),H0=Tt.Utils,zd=new ie,ba=new Bn([0,0,1,0,0,1,0,1,1,0,1,1]),Se={precision:.9,isHidden:/(undefined|none|transparent)/i,canvas:Je.document?Je.document.createElement("canvas"):{getContext:function(){}},alignments:{left:"start",middle:"center",right:"end"},matrix:new Ni,group:{removeChild:function(n,e){if(n.children)for(let i=0;i<n.children.length;i++)Se.group.removeChild(n.children[i],e);n._renderer.texture&&(e.deleteTexture(n._renderer.texture),delete n._renderer.texture),n._renderer.positionBuffer&&(e.deleteBuffer(n._renderer.positionBuffer),delete n._renderer.positionBuffer)},render:function(n,e){if(!this._visible)return;re.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const i=this.parent,r=i._matrix&&i._matrix.manual||i._flagMatrix,o=this._matrix.manual||this._flagMatrix;if((r||o)&&(this._renderer.matrix||(this._renderer.matrix=new Bn(9)),this._matrix.toTransformArray(!0,hi),Ao(hi,i._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof ie||(this._renderer.scale=new ie),this._scale instanceof ie?(this._renderer.scale.x=this._scale.x,this._renderer.scale.y=this._scale.y):(this._renderer.scale.x=this._scale,this._renderer.scale.y=this._scale),/renderer/i.test(i._renderer.type)||(this._renderer.scale.x*=i._renderer.scale.x,this._renderer.scale.y*=i._renderer.scale.y),r&&(this._flagMatrix=!0)),this._mask){n.clear(n.STENCIL_BUFFER_BIT),n.enable(n.STENCIL_TEST),n.stencilFunc(n.ALWAYS,1,0),n.stencilOp(n.KEEP,n.KEEP,n.REPLACE),n.colorMask(!1,!1,!1,!1);const a=Tt.Utils.getRendererType(this._mask._renderer.type);Se[a].render.call(this._mask,n,e,this),n.stencilFunc(n.EQUAL,1,255),n.stencilOp(n.KEEP,n.KEEP,n.KEEP),n.colorMask(!0,!0,!0,!0)}this._flagOpacity=i._flagOpacity||this._flagOpacity,this._renderer.opacity=this._opacity*(i&&i._renderer?i._renderer.opacity:1);let s;if(this._flagSubtractions)for(s=0;s<this.subtractions.length;s++)Se.group.removeChild(this.subtractions[s],n);for(s=0;s<this.children.length;s++){const a=this.children[s],l=Tt.Utils.getRendererType(a._renderer.type);Se[l].render.call(a,n,e)}return this._mask&&n.disable(n.STENCIL_TEST),re.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},path:{updateCanvas:function(n,e){let i,r,o,s,a,l,c,d,u,f,h,p,m,g;const b=e._renderer.vertices,y=this.canvas,_=this.ctx,x=n.renderer.ratio,w=zd.copy(e._renderer.scale).multiply(x),C=e._stroke,N=e._linewidth,k=e._fill,$=e._renderer.opacity||e._opacity,v=e._cap,E=e._join,P=e._miter,F=e._closed,R=e.dashes,M=b.length,X=M-1;y.width=Math.max(Math.ceil(e._renderer.rect.width*w.x),1),y.height=Math.max(Math.ceil(e._renderer.rect.height*w.y),1);const G=e._renderer.rect.centroid,Z=G.x,O=G.y;if(_.clearRect(0,0,y.width,y.height),k)if(typeof k=="string")_.fillStyle=k;else{const q=Tt.Utils.getRendererType(k._renderer.type);Se[q].render.call(k,_,e),_.fillStyle=k._renderer.effect}if(C){if(typeof C=="string")_.strokeStyle=C;else{const q=Tt.Utils.getRendererType(C._renderer.type);Se[q].render.call(C,_,e),_.strokeStyle=C._renderer.effect}N&&(_.lineWidth=Nn(e)),P&&(_.miterLimit=P),E&&(_.lineJoin=E),!F&&v&&(_.lineCap=v)}typeof $=="number"&&(_.globalAlpha=$),R&&R.length>0&&(_.lineDashOffset=R.offset||0,_.setLineDash(R));let A,Y,H,T,D,K,J,U;_.save(),_.scale(w.x,w.y),_.translate(Z,O),_.beginPath();for(let q=0;q<b.length;q++){const L=b[q];switch(p=L.x,m=L.y,L.command){case ne.close:_.closePath();break;case ne.arc:Y=L.rx,H=L.ry,T=L.xAxisRotation,D=L.largeArcFlag,K=L.sweepFlag,i=F?ut(q-1,M):Math.max(q-1,0),r=b[i],J=r.x,U=r.y,H0.renderSvgArcCommand(_,J,U,Y,H,D,K,T,p,m);break;case ne.curve:i=F?ut(q-1,M):Math.max(q-1,0),r=b[i],d=r.controls&&r.controls.right||ie.zero,u=L.controls&&L.controls.left||ie.zero,r._relative?(l=d.x+r.x,c=d.y+r.y):(l=d.x,c=d.y),L._relative?(s=u.x+L.x,a=u.y+L.y):(s=u.x,a=u.y),_.bezierCurveTo(l,c,s,a,p,m),q>=X&&F&&(o=A,f=L.controls&&L.controls.right||ie.zero,h=o.controls&&o.controls.left||ie.zero,L._relative?(l=f.x+L.x,c=f.y+L.y):(l=f.x,c=f.y),o._relative?(s=h.x+o.x,a=h.y+o.y):(s=h.x,a=h.y),p=o.x,m=o.y,_.bezierCurveTo(l,c,s,a,p,m));break;case ne.line:_.lineTo(p,m);break;case ne.move:A=L,_.moveTo(p,m);break}}F&&_.closePath(),Se.isHidden.test(k)||(g=k._renderer&&k._renderer.offset,g&&(_.save(),_.translate(-k._renderer.offset.x,-k._renderer.offset.y),_.scale(k._renderer.scale.x,k._renderer.scale.y)),_.fill(),g&&_.restore()),Se.isHidden.test(C)||(g=C._renderer&&C._renderer.offset,g&&(_.save(),_.translate(-C._renderer.offset.x,-C._renderer.offset.y),_.scale(C._renderer.scale.x,C._renderer.scale.y),_.lineWidth=N/C._renderer.scale.x),_.stroke(),g&&_.restore()),_.restore()},getBoundingClientRect:function(n,e,i){let r=1/0,o=-1/0,s=1/0,a=-1/0,l,c;n.forEach(function(d){const u=d.x,f=d.y,h=d.controls;let p,m,g,b,y,_;s=Math.min(f,s),r=Math.min(u,r),o=Math.max(u,o),a=Math.max(f,a),d.controls&&(y=h.left,_=h.right,!(!y||!_)&&(p=d._relative?y.x+u:y.x,m=d._relative?y.y+f:y.y,g=d._relative?_.x+u:_.x,b=d._relative?_.y+f:_.y,!(!p||!m||!g||!b)&&(s=Math.min(m,b,s),r=Math.min(p,g,r),o=Math.max(p,g,o),a=Math.max(m,b,a))))}),typeof e=="number"&&(s-=e,r-=e,o+=e,a+=e),l=o-r,c=a-s,i.top=s,i.left=r,i.right=o,i.bottom=a,i.width=l,i.height=c,i.centroid||(i.centroid={}),i.centroid.x=-r,i.centroid.y=-s},render:function(n,e,i){if(!this._visible||!this._opacity)return this;re.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const r=i||this.parent,o=Tt.Utils.getRendererType(this._renderer.type),s=e[o],a=r._matrix.manual||r._flagMatrix,l=this._matrix.manual||this._flagMatrix,c=this._renderer.parent!==r,d=this._flagVertices||this._flagFill||this._fill instanceof et&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof tt&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof De&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof et&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof tt&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof De&&(this._stroke._flagLoaded&&this._stroke.loaded||this._stroke._flagImage||this._stroke._flagVideo||this._stroke._flagRepeat||this._stroke._flagOffset||this._fill._flagScale)||this._flagStroke||this._flagLinewidth||this._flagOpacity||r._flagOpacity||this._flagVisible||this._flagCap||this._flagJoin||this._flagMiter||this._flagScale||this.dashes&&this.dashes.length>0||!this._renderer.texture;if(a||l||c){this._renderer.matrix||(this._renderer.matrix=new Bn(9)),this._matrix.toTransformArray(!0,hi),Ao(hi,r._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof ie||(this._renderer.scale=new ie);let f,h;this._scale instanceof ie?(f=this._scale.x*r._renderer.scale.x,h=this._scale.y*r._renderer.scale.y):(f=this._scale*r._renderer.scale.x,h=this._scale*r._renderer.scale.y),this._renderer.scale.x=f<0?-f:f,this._renderer.scale.y=h<0?-h:h,c&&(this._renderer.parent=r)}if(this._mask){n.clear(n.STENCIL_BUFFER_BIT),n.enable(n.STENCIL_TEST),n.stencilFunc(n.ALWAYS,1,0),n.stencilOp(n.KEEP,n.KEEP,n.REPLACE),n.colorMask(!1,!1,!1,!1);const f=Tt.Utils.getRendererType(this._mask._renderer.type);Se[f].render.call(this._mask,n,e,this),n.stencilFunc(n.EQUAL,1,255),n.stencilOp(n.KEEP,n.KEEP,n.KEEP),n.colorMask(!0,!0,!0,!0)}if(d?(this._renderer.rect||(this._renderer.rect={}),this._renderer.opacity=this._opacity*r._renderer.opacity,Se.path.getBoundingClientRect(this._renderer.vertices,this._linewidth,this._renderer.rect),Se.updateTexture.call(Se,n,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!i||!this._renderer.texture)return this;e.current!==s&&(n.useProgram(s),n.bindBuffer(n.ARRAY_BUFFER,e.buffers.position),n.vertexAttribPointer(s.position,2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(s.position),n.bufferData(n.ARRAY_BUFFER,ba,n.STATIC_DRAW),e.resolution.flagged||n.uniform2f(n.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),e.current=s),e.resolution.flagged&&n.uniform2f(n.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),n.bindTexture(n.TEXTURE_2D,this._renderer.texture);const u=this._renderer.rect;return n.uniformMatrix3fv(s.matrix,!1,this._renderer.matrix),n.uniform4f(s.rect,u.left,u.top,u.right,u.bottom),n.drawArrays(n.TRIANGLES,0,6),this._mask&&n.disable(n.STENCIL_TEST),re.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},points:{updateCanvas:function(n,e){let i;const r=this.canvas,o=this.ctx,s=n.renderer.ratio,a=e._stroke,l=e._linewidth,c=e._fill,d=e._renderer.opacity||e._opacity,u=e.dashes,f=e._size*s;let h=f;Se.isHidden.test(a)||(h+=l),r.width=Sc(h),r.height=r.width;const p=h/r.width,m=r.width/2,g=r.height/2;if(o.clearRect(0,0,r.width,r.height),c)if(typeof c=="string")o.fillStyle=c;else{const b=Tt.Utils.getRendererType(c._renderer.type);Se[b].render.call(c,o,e),o.fillStyle=c._renderer.effect}if(a){if(typeof a=="string")o.strokeStyle=a;else{const b=Tt.Utils.getRendererType(a._renderer.type);Se[b].render.call(a,o,e),o.strokeStyle=a._renderer.effect}l&&(o.lineWidth=Nn(e)/p)}typeof d=="number"&&(o.globalAlpha=d),u&&u.length>0&&(o.lineDashOffset=u.offset||0,o.setLineDash(u)),o.save(),o.translate(m,g),o.scale(Se.precision,Se.precision),o.beginPath(),o.arc(0,0,f/p*.5,0,ot),o.restore(),closed&&o.closePath(),Se.isHidden.test(c)||(i=c._renderer&&c._renderer.offset,i&&(o.save(),o.translate(-c._renderer.offset.x,-c._renderer.offset.y),o.scale(c._renderer.scale.x,c._renderer.scale.y)),o.fill(),i&&o.restore()),Se.isHidden.test(a)||(i=a._renderer&&a._renderer.offset,i&&(o.save(),o.translate(-a._renderer.offset.x,-a._renderer.offset.y),o.scale(a._renderer.scale.x,a._renderer.scale.y),o.lineWidth=l/a._renderer.scale.x),o.stroke(),i&&o.restore())},render:function(n,e,i){if(!this._visible||!this._opacity)return this;re.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();let r=this._size;const o=i||this.parent,s=e[this._renderer.type],a=this._sizeAttenuation,l=this._stroke,c=this._linewidth,d=o._matrix.manual||o._flagMatrix,u=this._matrix.manual||this._flagMatrix,f=this._renderer.parent!==o,h=this._renderer.vertices,p=this._renderer.collection.length,m=this._flagVertices,g=this._flagFill||this._fill instanceof et&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof tt&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof De&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof et&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof tt&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof De&&(this._stroke._flagLoaded&&this._stroke.loaded||this._stroke._flagImage||this._stroke._flagVideo||this._stroke._flagRepeat||this._stroke._flagOffset||this._fill._flagScale)||this._flagStroke||this._flagLinewidth||this._flagOpacity||o._flagOpacity||this._flagVisible||this._flagScale||this.dashes&&this.dashes.length>0||!this._renderer.texture;if(d||u||f){this._renderer.matrix||(this._renderer.matrix=new Bn(9)),this._matrix.toTransformArray(!0,hi),Ao(hi,o._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof ie||(this._renderer.scale=new ie);let b,y;this._scale instanceof ie?(b=this._scale.x*o._renderer.scale.x,y=this._scale.y*o._renderer.scale.y):(b=this._scale*o._renderer.scale.x,y=this._scale*o._renderer.scale.y),this._renderer.scale.x=b<0?-b:b,this._renderer.scale.y=y<0?-y:y,f&&(this._renderer.parent=o)}if(m){const b=this._renderer.positionBuffer;b&&n.deleteBuffer(b),this._renderer.positionBuffer=n.createBuffer(),n.bindBuffer(n.ARRAY_BUFFER,this._renderer.positionBuffer),n.vertexAttribPointer(s.position,2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(s.position),n.bufferData(n.ARRAY_BUFFER,h,n.STATIC_DRAW)}return g?(this._renderer.opacity=this._opacity*o._renderer.opacity,Se.updateTexture.call(Se,n,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!i||!this._renderer.texture?this:(Se.isHidden.test(l)||(r+=c),r/=Se.precision,a&&(r*=Math.max(this._renderer.scale.x,this._renderer.scale.y)),e.current!==s&&(n.useProgram(s),e.resolution.flagged||n.uniform2f(n.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),e.current=s),e.resolution.flagged&&n.uniform2f(n.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),n.bindTexture(n.TEXTURE_2D,this._renderer.texture),n.uniformMatrix3fv(s.matrix,!1,this._renderer.matrix),n.uniform1f(s.size,r*e.resolution.ratio),n.drawArrays(n.POINTS,0,p),re.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset())}},text:{updateCanvas:function(n,e){const i=this.canvas,r=this.ctx,o=n.renderer.ratio,s=zd.copy(e._renderer.scale).multiply(o),a=e._stroke,l=e._linewidth,c=e._fill,d=e._renderer.opacity||e._opacity,u=e.dashes,f=e._decoration,h=e._direction;i.width=Math.max(Math.ceil(e._renderer.rect.width*s.x),1),i.height=Math.max(Math.ceil(e._renderer.rect.height*s.y),1);const p=e._renderer.rect.centroid,m=p.x,g=p.y;let b,y,_,x,w,C,N,k,$,v,E;const P=c._renderer&&c._renderer.offset&&a._renderer&&a._renderer.offset;if(r.clearRect(0,0,i.width,i.height),P||(r.font=[e._style,e._weight,e._size+"px/"+e._leading+"px",e._family].join(" ")),r.textAlign="center",r.textBaseline="middle",r.textDirection=h,c)if(typeof c=="string")r.fillStyle=c;else{const F=Tt.Utils.getRendererType(c._renderer.type);Se[F].render.call(c,r,e),r.fillStyle=c._renderer.effect}if(a){if(typeof a=="string")r.strokeStyle=a;else{const F=Tt.Utils.getRendererType(a._renderer.type);Se[F].render.call(a,r,e),r.strokeStyle=a._renderer.effect}l&&(r.lineWidth=Nn(e))}if(typeof d=="number"&&(r.globalAlpha=d),u&&u.length>0&&(r.lineDashOffset=u.offset||0,r.setLineDash(u)),r.save(),r.scale(s.x,s.y),r.translate(m,g),Se.isHidden.test(c)||(c._renderer&&c._renderer.offset?(C=c._renderer.scale.x,N=c._renderer.scale.y,r.save(),r.translate(-c._renderer.offset.x,-c._renderer.offset.y),r.scale(C,N),b=e._size/c._renderer.scale.y,y=e._leading/c._renderer.scale.y,r.font=[e._style,e._weight,b+"px/",y+"px",e._family].join(" "),_=c._renderer.offset.x/c._renderer.scale.x,x=c._renderer.offset.y/c._renderer.scale.y,r.fillText(e.value,_,x),r.restore()):r.fillText(e.value,0,0)),Se.isHidden.test(a)||(a._renderer&&a._renderer.offset?(C=a._renderer.scale.x,N=a._renderer.scale.y,r.save(),r.translate(-a._renderer.offset.x,-a._renderer.offset.y),r.scale(C,N),b=e._size/a._renderer.scale.y,y=e._leading/a._renderer.scale.y,r.font=[e._style,e._weight,b+"px/",y+"px",e._family].join(" "),_=a._renderer.offset.x/a._renderer.scale.x,x=a._renderer.offset.y/a._renderer.scale.y,w=l/a._renderer.scale.x,r.lineWidth=w,r.strokeText(e.value,_,x),r.restore()):r.strokeText(e.value,0,0)),/(underline|strikethrough)/i.test(f)){const F=r.measureText(e.value);switch(f){case"underline":$=F.actualBoundingBoxDescent,E=F.actualBoundingBoxDescent;break;case"strikethrough":$=0,E=0;break}k=-F.width/2,v=F.width/2,r.lineWidth=Math.max(Math.floor(e._size/15),1),r.strokeStyle=r.fillStyle,r.beginPath(),r.moveTo(k,$),r.lineTo(v,E),r.stroke()}r.restore()},getBoundingClientRect:function(n,e){const i=Se.ctx;i.font=[n._style,n._weight,n._size+"px/"+n._leading+"px",n._family].join(" "),i.textAlign="center",i.textBaseline=Tt.Utils.baselines[n._baseline]||n._baseline;const r=i.measureText(n._value);let o=r.width,s=1.15*(r.actualBoundingBoxAscent+r.actualBoundingBoxDescent);this._linewidth&&!Se.isHidden.test(this._stroke)&&(o+=this._linewidth*2,s+=this._linewidth*2);const a=o/2,l=s/2;switch(Se.alignments[n._alignment]||n._alignment){case Se.alignments.left:n.direction==="ltr"?(e.left=0,e.right=o):(e.left=-o,e.right=0);break;case Se.alignments.right:n.direction==="ltr"?(e.left=-o,e.right=0):(e.left=0,e.right=o);break;default:e.left=-a,e.right=a}switch(n._baseline){case"bottom":e.top=-s,e.bottom=0;break;case"top":e.top=0,e.bottom=s;break;case"baseline":e.top=-l*1.5,e.bottom=l*.5;break;default:e.top=-l,e.bottom=l}e.width=o,e.height=s,e.centroid||(e.centroid={}),e.centroid.x=a,e.centroid.y=l},render:function(n,e,i){if(!this._visible||!this._opacity)return this;re.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const r=i||this.parent,o=e[this._renderer.type],s=r._matrix.manual||r._flagMatrix,a=this._matrix.manual||this._flagMatrix,l=this._renderer.parent!==r,c=this._flagVertices||this._flagFill||this._fill instanceof et&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof tt&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof De&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof et&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof tt&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof De&&(this._stroke._flagLoaded&&this._stroke.loaded||this._stroke._flagImage||this._stroke._flagVideo||this._stroke._flagRepeat||this._stroke._flagOffset||this._fill._flagScale)||this._flagStroke||this._flagLinewidth||this._flagOpacity||r._flagOpacity||this._flagVisible||this._flagScale||this._flagValue||this._flagFamily||this._flagSize||this._flagLeading||this._flagAlignment||this._flagBaseline||this._flagStyle||this._flagWeight||this._flagDecoration||this.dashes&&this.dashes.length>0||!this._renderer.texture;if(s||a||l){this._renderer.matrix||(this._renderer.matrix=new Bn(9)),this._matrix.toTransformArray(!0,hi),Ao(hi,r._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof ie||(this._renderer.scale=new ie);let u,f;this._scale instanceof ie?(u=this._scale.x*r._renderer.scale.x,f=this._scale.y*r._renderer.scale.y):(u=this._scale*r._renderer.scale.x,f=this._scale*r._renderer.scale.y),this._renderer.scale.x=u<0?-u:u,this._renderer.scale.y=f<0?-f:f,l&&(this._renderer.parent=r)}if(this._mask){n.clear(n.STENCIL_BUFFER_BIT),n.enable(n.STENCIL_TEST),n.stencilFunc(n.ALWAYS,1,0),n.stencilOp(n.KEEP,n.KEEP,n.REPLACE),n.colorMask(!1,!1,!1,!1);const u=Tt.Utils.getRendererType(this._mask._renderer.type);Se[u].render.call(this._mask,n,e,this),n.stencilFunc(n.EQUAL,1,255),n.stencilOp(n.KEEP,n.KEEP,n.KEEP),n.colorMask(!0,!0,!0,!0)}if(c?(this._renderer.rect||(this._renderer.rect={}),this._renderer.opacity=this._opacity*r._renderer.opacity,Se.text.getBoundingClientRect(this,this._renderer.rect),Se.updateTexture.call(Se,n,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!i||!this._renderer.texture)return this;e.current!==o&&(n.useProgram(o),n.bindBuffer(n.ARRAY_BUFFER,e.buffers.position),n.vertexAttribPointer(o.position,2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(o.position),n.bufferData(n.ARRAY_BUFFER,ba,n.STATIC_DRAW),e.resolution.flagged||n.uniform2f(n.getUniformLocation(o,"u_resolution"),e.resolution.width,e.resolution.height),e.current=o),e.resolution.flagged&&n.uniform2f(n.getUniformLocation(o,"u_resolution"),e.resolution.width,e.resolution.height),n.bindTexture(n.TEXTURE_2D,this._renderer.texture);const d=this._renderer.rect;return n.uniformMatrix3fv(o.matrix,!1,this._renderer.matrix),n.uniform4f(o.rect,d.left,d.top,d.right,d.bottom),n.drawArrays(n.TRIANGLES,0,6),this._mask&&n.disable(n.STENCIL_TEST),re.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},"linear-gradient":{render:function(n,e){if(!(!n.canvas.getContext("2d")||!e)){if(re.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),!this._renderer.effect||this._flagEndPoints||this._flagStops||this._flagUnits){let i,r=this.left._x,o=this.left._y,s=this.right._x,a=this.right._y;/objectBoundingBox/i.test(this._units)&&(i=e.getBoundingClientRect(!0),r=(r-.5)*i.width,o=(o-.5)*i.height,s=(s-.5)*i.width,a=(a-.5)*i.height),this._renderer.effect=n.createLinearGradient(r,o,s,a);for(let l=0;l<this.stops.length;l++){const c=this.stops[l];this._renderer.effect.addColorStop(c._offset,c._color)}}return re.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},"radial-gradient":{render:function(n,e){if(!(!n.canvas.getContext("2d")||!e)){if(re.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),!this._renderer.effect||this._flagCenter||this._flagFocal||this._flagRadius||this._flagStops||this._flagUnits){let i,r=this.center._x,o=this.center._y,s=this.focal._x,a=this.focal._y,l=this._radius;/objectBoundingBox/i.test(this._units)&&(i=e.getBoundingClientRect(!0),r=(r-.5)*i.width*.5,o=(o-.5)*i.height*.5,s=(s-.5)*i.width*.5,a=(a-.5)*i.height*.5,l*=Math.min(i.width,i.height)),this._renderer.effect=n.createRadialGradient(r,o,0,s,a,l);for(let c=0;c<this.stops.length;c++){const d=this.stops[c];this._renderer.effect.addColorStop(d._offset,d._color)}}return re.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},texture:{render:function(n,e){if(!n.canvas.getContext("2d"))return;re.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const i=this.image;if((this._flagLoaded||this._flagImage||this._flagVideo||this._flagRepeat)&&this.loaded)this._renderer.effect=n.createPattern(i,this._repeat);else if(!this._renderer.effect)return this.flagReset();if((this._flagOffset||this._flagLoaded||this._flagScale)&&(this._renderer.offset instanceof ie||(this._renderer.offset=new ie),this._renderer.offset.x=-this._offset.x,this._renderer.offset.y=-this._offset.y,i&&(this._renderer.offset.x+=i.width/2,this._renderer.offset.y+=i.height/2,this._scale instanceof ie?(this._renderer.offset.x*=this._scale.x,this._renderer.offset.y*=this._scale.y):(this._renderer.offset.x*=this._scale,this._renderer.offset.y*=this._scale))),this._flagScale||this._flagLoaded){this._renderer.scale instanceof ie||(this._renderer.scale=new ie);let r,o;this._scale instanceof ie?(r=this._scale.x,o=this._scale.y):(r=this._scale,o=this._scale),this._renderer.scale.x=r<0?-r:r,this._renderer.scale.y=o<0?-o:o}return re.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},updateTexture:function(n,e){const i=Tt.Utils.getRendererType(e._renderer.type);if(this[i].updateCanvas.call(Se,n,e),this.canvas.width<=0||this.canvas.height<=0){e._renderer.texture&&n.deleteTexture(e._renderer.texture),delete e._renderer.texture;return}e._renderer.texture||(e._renderer.texture=n.createTexture()),n.bindTexture(n.TEXTURE_2D,e._renderer.texture),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,this.canvas),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR)},program:{create:function(n,e){let i,r,o;if(i=n.createProgram(),re.each(e,function(s){n.attachShader(i,s)}),n.linkProgram(i),r=n.getProgramParameter(i,n.LINK_STATUS),!r)throw o=n.getProgramInfoLog(i),n.deleteProgram(i),new Yt("unable to link program: "+o);return i}},extensions:{init:function(n){const e={},i=["EXT_texture_filter_anisotropic","WEBGL_compressed_texture_s3tc","OES_texture_float_linear","WEBGL_multisampled_render_to_texture"];for(let r=0;r<i.length;r++){const o=i[r];e[o]=Se.extensions.get(n,o)}return e},get:function(n,e){return n.getExtension(e)||n.getExtension(`MOZ_${e}`)||n.getExtension(`WEBKIT_${e}`)}},TextureRegistry:new bo};Se.ctx=Se.canvas.getContext("2d");var Dd=class extends ee{constructor(n){super();let e,i,r,o;if(this.domElement=n.domElement||document.createElement("canvas"),typeof n.offscreenElement<"u"&&(Se.canvas=n.offscreenElement,Se.ctx=Se.canvas.getContext("2d")),this.scene=new xt,this.scene.parent=this,this._renderer={type:"renderer",matrix:new Bn(L0),scale:1,opacity:1},this._flagMatrix=!0,n=re.defaults(n||{},{antialias:!1,alpha:!0,premultipliedAlpha:!0,stencil:!0,preserveDrawingBuffer:!0,overdraw:!1}),this.overdraw=n.overdraw,e=this.ctx=this.domElement.getContext("webgl",n)||this.domElement.getContext("experimental-webgl",n),!this.ctx)throw new Yt("unable to create a webgl context. Try using another renderer.");r=fn.create(e,fn.path.vertex,fn.types.vertex),o=fn.create(e,fn.path.fragment,fn.types.fragment),this.programs={current:null,buffers:{position:e.createBuffer()},resolution:{width:0,height:0,ratio:1,flagged:!1}},i=this.programs.path=Se.program.create(e,[r,o]),this.programs.text=this.programs.path,e.extensions=Se.extensions.init(e),e.renderer=this,i.position=e.getAttribLocation(i,"a_position"),i.matrix=e.getUniformLocation(i,"u_matrix"),i.rect=e.getUniformLocation(i,"u_rect");const s=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,s),e.vertexAttribPointer(i.position,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(i.position),e.bufferData(e.ARRAY_BUFFER,ba,e.STATIC_DRAW),r=fn.create(e,fn.points.vertex,fn.types.vertex),o=fn.create(e,fn.points.fragment,fn.types.fragment),i=this.programs.points=Se.program.create(e,[r,o]),i.position=e.getAttribLocation(i,"a_position"),i.matrix=e.getUniformLocation(i,"u_matrix"),i.size=e.getUniformLocation(i,"u_size"),e.enable(e.BLEND),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA)}setSize(n,e,i){let r,o;const s=this.ctx;return this.width=n,this.height=e,this.ratio=typeof i>"u"?Xs(s):i,this.domElement.width=n*this.ratio,this.domElement.height=e*this.ratio,re.isObject(this.domElement.style)&&re.extend(this.domElement.style,{width:n+"px",height:e+"px"}),this._renderer.matrix[0]=this._renderer.matrix[4]=this._renderer.scale=this.ratio,this._flagMatrix=!0,r=n*this.ratio,o=e*this.ratio,s.viewport(0,0,r,o),this.programs.resolution.width=r,this.programs.resolution.height=o,this.programs.resolution.ratio=this.ratio,this.programs.resolution.flagged=!0,this.trigger(ee.Types.resize,n,e,i)}render(){const n=this.ctx;return this.overdraw||n.clear(n.COLOR_BUFFER_BIT),Se.group.render.call(this.scene,n,this.programs),this._flagMatrix=!1,this.programs.resolution.flagged=!0,this}};S(Dd,"Utils",Se);var W0=re.extend({Error:Yt,getRatio:Xs,read:Ze,xhr:Fd},re,At,xc,kc),Te=class ao{constructor(e){S(this,"_events",new ee),S(this,"type",""),S(this,"renderer",null),S(this,"scene",null),S(this,"width",0),S(this,"height",0),S(this,"frameCount",0),S(this,"timeDelta",0),S(this,"playing",!1);const i=re.defaults(e||{},{fullscreen:!1,fitted:!1,width:640,height:480,type:ao.Types.svg,autostart:!1});if(re.each(i,function(r,o){/fullscreen/i.test(o)||/autostart/i.test(o)||(this[o]=r)},this),re.isElement(i.domElement)){const r=i.domElement.tagName.toLowerCase();/^(CanvasRenderer-canvas|WebGLRenderer-canvas|SVGRenderer-svg)$/.test(this.type+"-"+r)||(this.type=ao.Types[r])}this.renderer=new ao[this.type](this),this.setPlaying(i.autostart),this.frameCount=0,i.fullscreen?(this.fit=j0.bind(this),this.fit.domElement=window,this.fit.attached=!0,re.extend(document.body.style,{overflow:"hidden",margin:0,padding:0,top:0,left:0,right:0,bottom:0,position:"fixed"}),re.extend(this.renderer.domElement.style,{display:"block",top:0,left:0,right:0,bottom:0,position:"fixed"}),tn.bind(this.fit.domElement,"resize",this.fit),this.fit()):i.fitted?(this.fit=q0.bind(this),re.extend(this.renderer.domElement.style,{display:"block"})):typeof i.width=="number"&&typeof i.height=="number"&&(this.renderer.setSize(i.width,i.height,this.ratio),this.width=i.width,this.height=i.height),this.renderer.bind(ee.Types.resize,X0.bind(this)),this.scene=this.renderer.scene,ao.Instances.push(this),i.autostart&&Ar.init()}get _bound(){return this._events._bound}set _bound(e){this._events._bound=e}addEventListener(){var e;return(e=this._events.addEventListener)==null?void 0:e.apply(this,arguments)}on(){var e;return(e=this._events.addEventListener)==null?void 0:e.apply(this,arguments)}bind(){var e;return(e=this._events.addEventListener)==null?void 0:e.apply(this,arguments)}removeEventListener(){var e;return(e=this._events.removeEventListener)==null?void 0:e.apply(this,arguments)}off(){var e;return(e=this._events.removeEventListener)==null?void 0:e.apply(this,arguments)}unbind(){var e;return(e=this._events.removeEventListener)==null?void 0:e.apply(this,arguments)}dispatchEvent(){var e;return(e=this._events.dispatchEvent)==null?void 0:e.apply(this,arguments)}trigger(){var e;return(e=this._events.dispatchEvent)==null?void 0:e.apply(this,arguments)}listen(){var e;return(e=this._events.listen)==null?void 0:e.apply(this,arguments)}ignore(){var e;return(e=this._events.ignore)==null?void 0:e.apply(this,arguments)}appendTo(e){return e.appendChild(this.renderer.domElement),this.fit&&(this.fit.domElement!==window&&(this.fit.domElement=e,this.fit.attached=!1),this.update()),this}play(){return this.playing=!0,Ar.init(),this.trigger(ee.Types.play)}pause(){return this.playing=!1,this.trigger(ee.Types.pause)}setPlaying(e){this.playing=e}release(e){let i,r,o;if(typeof e>"u")return this.release(this.scene);if(typeof e.unbind=="function"&&e.unbind(),typeof e.fill=="object"&&typeof e.fill.unbind=="function"&&e.fill.unbind(),typeof e.stroke=="object"&&typeof e.stroke.unbind=="function"&&e.stroke.unbind(),e.vertices){if(typeof e.vertices.unbind=="function")try{e.vertices.unbind()}catch{}for(i=0;i<e.vertices.length;i++)r=e.vertices[i],typeof r.unbind=="function"&&r.unbind(),r.controls&&(r.controls.left&&typeof r.controls.left.unbind=="function"&&r.controls.left.unbind(),r.controls.right&&typeof r.controls.right.unbind=="function"&&r.controls.right.unbind())}if(e.children){for(i=0;i<e.children.length;i++)o=e.children[i],this.release(o);if(typeof e.children.unbind=="function")try{e.children.unbind()}catch{}}if(e._renderer){if(e._renderer.elem&&e._renderer.elem.parentNode&&(e._renderer.elem.parentNode.removeChild(e._renderer.elem),delete e._renderer.elem),this.type==="WebGLRenderer"&&this.renderer.ctx){const s=this.renderer.ctx;e._renderer.texture&&(s.deleteTexture(e._renderer.texture),delete e._renderer.texture),e._renderer.positionBuffer&&(s.deleteBuffer(e._renderer.positionBuffer),delete e._renderer.positionBuffer),e._renderer.effect&&(e._renderer.effect=null)}this.type==="CanvasRenderer"&&e._renderer.context&&delete e._renderer.context}return e}getShapesAtPoint(e,i,r){return this.scene&&typeof this.scene.getShapesAtPoint=="function"?this.scene.getShapesAtPoint(e,i,r):[]}update(){const e=!!this._lastFrame,i=re.performance.now();e&&(this.timeDelta=parseFloat((i-this._lastFrame).toFixed(3))),this._lastFrame=i,this.fit&&this.fit.domElement&&!this.fit.attached&&(tn.bind(this.fit.domElement,"resize",this.fit),this.fit.attached=!0,this.fit());const r=this.width,o=this.height,s=this.renderer;return(r!==s.width||o!==s.height)&&s.setSize(r,o,this.ratio),this.trigger(ee.Types.update,this.frameCount,this.timeDelta),this.render()}render(){return this.renderer.render(),this.trigger(ee.Types.render,this.frameCount++)}add(e){return e instanceof Array||(e=Array.prototype.slice.call(arguments)),this.scene.add(e),this}remove(e){return e instanceof Array||(e=Array.prototype.slice.call(arguments)),this.scene.remove(e),this}clear(){return this.scene.remove(this.scene.children),this}makeLine(e,i,r,o){const s=new Po(e,i,r,o);return this.scene.add(s),s}makeArrow(e,i,r,o,s){const a=typeof s=="number"?s:10,l=Math.atan2(o-i,r-e),c=[new Ee(e,i,void 0,void 0,void 0,void 0,ne.move),new Ee(r,o,void 0,void 0,void 0,void 0,ne.line),new Ee(r-a*Math.cos(l-Math.PI/4),o-a*Math.sin(l-Math.PI/4),void 0,void 0,void 0,void 0,ne.line),new Ee(r,o,void 0,void 0,void 0,void 0,ne.move),new Ee(r-a*Math.cos(l+Math.PI/4),o-a*Math.sin(l+Math.PI/4),void 0,void 0,void 0,void 0,ne.line)],d=new Pe(c,!1,!1,!0);return d.noFill(),d.cap="round",d.join="round",this.scene.add(d),d}makeRectangle(e,i,r,o){const s=new fi(e,i,r,o);return this.scene.add(s),s}makeRoundedRectangle(e,i,r,o,s){const a=new $o(e,i,r,o,s);return this.scene.add(a),a}makeCircle(e,i,r,o){const s=new No(e,i,r,o);return this.scene.add(s),s}makeEllipse(e,i,r,o,s){const a=new To(e,i,r,o,s);return this.scene.add(a),a}makeStar(e,i,r,o,s){const a=new ca(e,i,r,o,s);return this.scene.add(a),a}makeCurve(e){const i=arguments.length;if(!Array.isArray(e)){e=[];for(let a=0;a<i;a+=2){const l=arguments[a];if(typeof l!="number")break;const c=arguments[a+1];e.push(new Ee(l,c))}}const r=arguments[i-1],o=new Pe(e,!(typeof r=="boolean"&&r),!0),s=o.getBoundingClientRect();return o.center().translation.set(s.left+s.width/2,s.top+s.height/2),this.scene.add(o),o}makePolygon(e,i,r,o){const s=new la(e,i,r,o);return this.scene.add(s),s}makeArcSegment(e,i,r,o,s,a,l){const c=new na(e,i,r,o,s,a,l);return this.scene.add(c),c}makePoints(e){const i=arguments.length;let r=e;if(!Array.isArray(e)){r=[];for(let s=0;s<i;s+=2){const a=arguments[s];if(typeof a!="number")break;const l=arguments[s+1];r.push(new ie(a,l))}}const o=new aa(r);return this.scene.add(o),o}makePath(e){const i=arguments.length;let r=e;if(!Array.isArray(e)){r=[];for(let l=0;l<i;l+=2){const c=arguments[l];if(typeof c!="number")break;const d=arguments[l+1];r.push(new Ee(c,d))}}const o=arguments[i-1],s=new Pe(r,!(typeof o=="boolean"&&o)),a=s.getBoundingClientRect();return typeof a.top=="number"&&typeof a.left=="number"&&typeof a.right=="number"&&typeof a.bottom=="number"&&s.center().translation.set(a.left+a.width/2,a.top+a.height/2),this.scene.add(s),s}makeText(e,i,r,o){const s=new Tn(e,i,r,o);return this.add(s),s}makeLinearGradient(e,i,r,o){const s=Array.prototype.slice.call(arguments,4),a=new et(e,i,r,o,s);return this.add(a),a}makeRadialGradient(e,i,r){const o=Array.prototype.slice.call(arguments,3),s=new tt(e,i,r,o);return this.add(s),s}makeSprite(e,i,r,o,s,a,l){const c=new Bo(e,i,r,o,s,a);return l&&c.play(),this.add(c),c}makeImage(e,i,r,o,s,a){const l=new Vd(e,i,r,o,s,a);return this.add(l),l}makeImageSequence(e,i,r,o,s){const a=new ha(e,i,r,o);return s&&a.play(),this.add(a),a}makeTexture(e,i){return new De(e,i)}makeGroup(e){e instanceof Array||(e=Array.prototype.slice.call(arguments));const i=new xt;return this.scene.add(i),i.add(e),i}interpret(e,i,r){const o=e.tagName.toLowerCase();if(r=typeof r<"u"?r:!0,!(o in Ze))return null;const s=Ze[o].call(this,e);return r?this.add(i&&s instanceof xt?s.children:s):s.parent&&s.remove(),s}load(e,i){const r=new xt;let o,s,a;const l=(function(c){for(tn.temp.innerHTML=c,s=0;s<tn.temp.children.length;s++)o=tn.temp.children[s],a=this.interpret(o,!1,!1),a!==null&&r.add(a);if(typeof i=="function"){const d=tn.temp.children.length<=1?tn.temp.children[0]:tn.temp.children;i(r,d)}}).bind(this);return/\.svg$/i.test(e)?(Fd(e,l),r):(l(e),r)}};S(Te,"NextFrameId",Bt.NextFrameId),S(Te,"Types",Bt.Types),S(Te,"Version",Bt.Version),S(Te,"PublishDate",Bt.PublishDate),S(Te,"Identifier",Bt.Identifier),S(Te,"Resolution",Bt.Resolution),S(Te,"AutoCalculateImportedMatrices",Bt.AutoCalculateImportedMatrices),S(Te,"Instances",Bt.Instances),S(Te,"uniqueId",Bt.uniqueId),S(Te,"Anchor",Ee),S(Te,"Collection",di),S(Te,"Events",ee),S(Te,"Group",xt),S(Te,"Matrix",Ni),S(Te,"Path",Pe),S(Te,"Registry",bo),S(Te,"Element",sr),S(Te,"Shape",qn),S(Te,"Text",Tn),S(Te,"Vector",ie),S(Te,"Gradient",pt),S(Te,"Image",Vd),S(Te,"ImageSequence",ha),S(Te,"LinearGradient",et),S(Te,"RadialGradient",tt),S(Te,"Sprite",Bo),S(Te,"Stop",ui),S(Te,"Texture",De),S(Te,"ArcSegment",na),S(Te,"Circle",No),S(Te,"Ellipse",To),S(Te,"Line",Po),S(Te,"Points",aa),S(Te,"Polygon",la),S(Te,"Rectangle",fi),S(Te,"RoundedRectangle",$o),S(Te,"Star",ca),S(Te,"CanvasRenderer",Tt),S(Te,"SVGRenderer",Od),S(Te,"WebGLRenderer",Dd),S(Te,"Commands",ne),S(Te,"Utils",W0);var En=Te;function j0(){const n=document.body.getBoundingClientRect(),e=this.width=n.width,i=this.height=n.height;this.renderer.setSize(e,i,this.ratio)}function q0(){const n=this.renderer.domElement.parentElement;if(!n){console.warn("Two.js: Attempting to fit to parent, but no parent found.");return}const e=n.getBoundingClientRect(),i=this.width=e.width,r=this.height=e.height;this.renderer.setSize(i,r,this.ratio)}function X0(n,e){this.width=n,this.height=e,this.trigger(ee.Types.resize,n,e)}var Ar=tn.getRequestAnimationFrame();function Ld(){for(let n=0;n<En.Instances.length;n++){const e=En.Instances[n];e.playing&&e.update()}En.NextFrameId=Ar(Ld)}Ar.init=function(){Ld(),Ar.init=function(){}};let Rn;typeof window<"u"?Rn=window:typeof global<"u"?Rn=global:typeof self<"u"&&(Rn=self);let Hd;const nn=Math.PI*2,kt=Math.PI*.5;function Y0(n,e,i,r,o,s){let a;return arguments.length<=1?(a=n.a,e=n.b,i=n.c,r=n.d,o=n.e,s=n.f):a=n,{translateX:o,translateY:s,scaleX:Math.sqrt(a*a+e*e),scaleY:Math.sqrt(i*i+r*r),rotation:180*Math.atan2(e,a)/Math.PI}}function U0(n){Hd=n}function K0(n,e){e=e&&e.identity()||new Hd;let i=n;const r=[];for(;i&&i._matrix;)r.push(i._matrix),i=i.parent;r.reverse();for(let o=0;o<r.length;o++){const a=r[o].elements;e.multiply(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8])}return e}function Kt(n,e,i){return i*(e-n)+n}function Gt(n,e){for(;n<0;)n+=e;return n%e}const Wd=Rn.Float32Array||Array,G0=Math.floor;function Pn(n){return G0(n*1e6)/1e6}const me={move:"M",line:"L",curve:"C",arc:"A",close:"Z"};class te{constructor(){B(this,"_events",{});B(this,"_bound",!1)}addEventListener(e,i){return(this._events[e]||(this._events[e]=[])).push(i),this._bound=!0,this}on(){return this.addEventListener.apply(this,arguments)}bind(){return this.addEventListener.apply(this,arguments)}removeEventListener(e,i){if(!this._events)return this;if(!e&&!i)return this._events={},this._bound=!1,this;const r=e?[e]:Object.keys(this._events);for(let o=0,s=r.length;o<s;o++){e=r[o];let a=this._events[e];if(a){let l=[];if(i)for(let c=0,d=a.length;c<d;c++){let u=a[c];u=u.handler?u.handler:u,i!==u&&l.push(u)}this._events[e]=l}}return this}off(){return this.removeEventListener.apply(this,arguments)}unbind(){return this.removeEventListener.apply(this,arguments)}dispatchEvent(e){if(!this._events)return this;const i=Array.prototype.slice.call(arguments,1),r=this._events[e];if(r)for(let o=0;o<r.length;o++)r[o].call(this,...i);return this}trigger(){return this.dispatchEvent.apply(this,arguments)}listen(e,i,r){const o=this;e&&(s.obj=e,s.name=i,s.handler=r,e.on(i,s));function s(){r.apply(o,arguments)}return o}ignore(e,i,r){return e.off(i,r),this}}B(te,"Types",{play:"play",pause:"pause",update:"update",render:"render",resize:"resize",change:"change",remove:"remove",insert:"insert",order:"order",load:"load"}),B(te,"Methods",["addEventListener","on","removeEventListener","off","unbind","dispatchEvent","trigger","listen","ignore"]);const jd={x:{enumerable:!0,get:function(){return this._x},set:function(n){this._x!==n&&(this._x=n,this._bound&&this.dispatchEvent(te.Types.change))}},y:{enumerable:!0,get:function(){return this._y},set:function(n){this._y!==n&&(this._y=n,this._bound&&this.dispatchEvent(te.Types.change))}}},vt=class vt extends te{constructor(i=0,r=0){super();B(this,"_x",0);B(this,"_y",0);for(let o in jd)Object.defineProperty(this,o,jd[o]);this.x=i,this.y=r}static add(i,r){return new vt(i.x+r.x,i.y+r.y)}static sub(i,r){return new vt(i.x-r.x,i.y-r.y)}static subtract(i,r){return vt.sub(i,r)}static ratioBetween(i,r){return(i.x*r.x+i.y*r.y)/(i.length()*r.length())}static angleBetween(i,r){if(arguments.length>=4){const a=arguments[0]-arguments[2],l=arguments[1]-arguments[3];return Math.atan2(l,a)}const o=i.x-r.x,s=i.y-r.y;return Math.atan2(s,o)}static distanceBetween(i,r){return Math.sqrt(vt.distanceBetweenSquared(i,r))}static distanceBetweenSquared(i,r){const o=i.x-r.x,s=i.y-r.y;return o*o+s*s}set(i,r){return this.x=i,this.y=r,this}copy(i){return this.x=i.x,this.y=i.y,this}clear(){return this.x=0,this.y=0,this}clone(){return new vt(this.x,this.y)}add(i,r){return arguments.length<=0?this:(arguments.length<=1?typeof i=="number"?(this.x+=i,this.y+=i):i&&typeof i.x=="number"&&typeof i.y=="number"&&(this.x+=i.x,this.y+=i.y):(this.x+=i,this.y+=r),this)}addSelf(i){return this.add.apply(this,arguments)}sub(i,r){return arguments.length<=0?this:(arguments.length<=1?typeof i=="number"?(this.x-=i,this.y-=i):i&&typeof i.x=="number"&&typeof i.y=="number"&&(this.x-=i.x,this.y-=i.y):(this.x-=i,this.y-=r),this)}subtract(){return this.sub.apply(this,arguments)}subSelf(i){return this.sub.apply(this,arguments)}subtractSelf(i){return this.sub.apply(this,arguments)}multiply(i,r){return arguments.length<=0?this:(arguments.length<=1?typeof i=="number"?(this.x*=i,this.y*=i):i&&typeof i.x=="number"&&typeof i.y=="number"&&(this.x*=i.x,this.y*=i.y):(this.x*=i,this.y*=r),this)}multiplySelf(i){return this.multiply.apply(this,arguments)}multiplyScalar(i){return this.multiply(i)}divide(i,r){return arguments.length<=0?this:(arguments.length<=1?typeof i=="number"?(this.x/=i,this.y/=i):i&&typeof i.x=="number"&&typeof i.y=="number"&&(this.x/=i.x,this.y/=i.y):(this.x/=i,this.y/=r),isNaN(this.x)&&(this.x=0),isNaN(this.y)&&(this.y=0),this)}divideSelf(i){return this.divide.apply(this,arguments)}divideScalar(i){return this.divide(i)}negate(){return this.multiply(-1)}dot(i){return this.x*i.x+this.y*i.y}length(){return Math.sqrt(this.lengthSquared())}lengthSquared(){return this.x*this.x+this.y*this.y}normalize(){return this.divideScalar(this.length())}distanceTo(i){return Math.sqrt(this.distanceToSquared(i))}distanceToSquared(i){const r=this.x-i.x,o=this.y-i.y;return r*r+o*o}setLength(i){return this.normalize().multiplyScalar(i)}equals(i,r){return r=typeof r>"u"?1e-4:r,this.distanceTo(i)<r}lerp(i,r){const o=(i.x-this.x)*r+this.x,s=(i.y-this.y)*r+this.y;return this.set(o,s)}isZero(i){return i=typeof i>"u"?1e-4:i,this.length()<i}toString(){return this.x+", "+this.y}toObject(){return{x:Pn(this.x),y:Pn(this.y)}}rotate(i){const r=this.x,o=this.y,s=Math.cos(i),a=Math.sin(i);return this.x=r*s-o*a,this.y=r*a+o*s,this}};B(vt,"zero",new vt),B(vt,"left",new vt(-1,0)),B(vt,"right",new vt(1,0)),B(vt,"up",new vt(0,-1)),B(vt,"down",new vt(0,1));let be=vt;class Ae extends be{constructor(i=0,r=0,o=0,s=0,a=0,l=0,c=me.move){super(i,r);B(this,"controls",{left:new be,right:new be});B(this,"_command",me.move);B(this,"_relative",!0);B(this,"_rx",0);B(this,"_ry",0);B(this,"_xAxisRotation",0);B(this,"_largeArcFlag",0);B(this,"_sweepFlag",1);for(let u in qd)Object.defineProperty(this,u,qd[u]);this.command=c,this.relative=!0;const d=Ae.makeBroadcast(this);this.controls.left.set(o,s).addEventListener(te.Types.change,d),this.controls.right.set(a,l).addEventListener(te.Types.change,d)}static makeBroadcast(i){return r;function r(){i._bound&&i.dispatchEvent(te.Types.change)}}static fromObject(i){return new Ae().copy(i)}copy(i){return this.x=i.x,this.y=i.y,typeof i.command=="string"&&(this.command=i.command),i.controls&&(i.controls.left&&this.controls.left.copy(i.controls.left),i.controls.right&&this.controls.right.copy(i.controls.right)),typeof i.relative=="boolean"&&(this.relative=i.relative),typeof i.rx=="number"&&(this.rx=i.rx),typeof i.ry=="number"&&(this.ry=i.ry),typeof i.xAxisRotation=="number"&&(this.xAxisRotation=i.xAxisRotation),typeof i.largeArcFlag=="number"&&(this.largeArcFlag=i.largeArcFlag),typeof i.sweepFlag=="number"&&(this.sweepFlag=i.sweepFlag),this}clone(){return new Ae().copy(this)}toObject(){return{x:Pn(this.x),y:Pn(this.y),command:this.command,relative:this.relative,controls:{left:this.controls.left.toObject(),right:this.controls.right.toObject()},rx:Pn(this.rx),ry:Pn(this.ry),xAxisRotation:Pn(this.xAxisRotation),largeArcFlag:Pn(this.largeArcFlag),sweepFlag:Pn(this.sweepFlag)}}toString(){return JSON.stringify(this.toObject())}}const qd={command:{enumerable:!0,get:function(){return this._command},set:function(n){this._command!==n&&(this._command=n,this._bound&&this.dispatchEvent(te.Types.change))}},relative:{enumerable:!0,get:function(){return this._relative},set:function(n){this._relative!==!!n&&(this._relative=!!n,this._bound&&this.dispatchEvent(te.Types.change))}},rx:{enumerable:!0,get:function(){return this._rx},set:function(n){this._rx!==n&&(this._rx=n,this._bound&&this.dispatchEvent(te.Types.change))}},ry:{enumerable:!0,get:function(){return this._ry},set:function(n){this._ry!==n&&(this._ry=n,this._bound&&this.dispatchEvent(te.Types.change))}},xAxisRotation:{enumerable:!0,get:function(){return this._xAxisRotation},set:function(n){this._xAxisRotation!==n&&(this._xAxisRotation=n,this._bound&&this.dispatchEvent(te.Types.change))}},largeArcFlag:{enumerable:!0,get:function(){return this._largeArcFlag},set:function(n){this._largeArcFlag!==n&&(this._largeArcFlag=n,this._bound&&this.dispatchEvent(te.Types.change))}},sweepFlag:{get:function(){return this._sweepFlag},set:function(n){this._sweepFlag!==n&&(this._sweepFlag=n,this._bound&&this.dispatchEvent(te.Types.change))}}};let Z0=0;const Oo={NextFrameId:null,Types:{webgl:"WebGLRenderer",svg:"SVGRenderer",canvas:"CanvasRenderer"},Version:"<%= version %>",PublishDate:"<%= publishDate %>",Identifier:"two-",Resolution:12,AutoCalculateImportedMatrices:!0,Instances:[],uniqueId:function(){return Z0++}},zo={RecursionLimit:16,abscissas:[[.5773502691896],[0,.7745966692415],[.3399810435849,.8611363115941],[0,.5384693101057,.9061798459387],[.2386191860832,.6612093864663,.9324695142032],[0,.4058451513774,.7415311855994,.9491079123428],[.1834346424956,.5255324099163,.7966664774136,.9602898564975],[0,.3242534234038,.6133714327006,.8360311073266,.9681602395076],[.1488743389816,.4333953941292,.679409568299,.865063366689,.9739065285172],[0,.2695431559523,.5190961292068,.730152005574,.8870625997681,.9782286581461],[.1252334085115,.3678314989982,.5873179542866,.7699026741943,.9041172563705,.9815606342467],[0,.2304583159551,.4484927510364,.6423493394403,.8015780907333,.917598399223,.9841830547186],[.1080549487073,.3191123689279,.5152486363582,.6872929048117,.8272013150698,.9284348836636,.9862838086968],[0,.2011940939974,.3941513470776,.5709721726085,.7244177313602,.8482065834104,.9372733924007,.9879925180205],[.0950125098376,.2816035507793,.4580167776572,.6178762444026,.755404408355,.8656312023878,.9445750230732,.9894009349916]],weights:[[1],[.8888888888889,.5555555555556],[.6521451548625,.3478548451375],[.5688888888889,.4786286704994,.2369268850562],[.4679139345727,.3607615730481,.1713244923792],[.4179591836735,.3818300505051,.2797053914893,.1294849661689],[.3626837833784,.3137066458779,.2223810344534,.1012285362904],[.3302393550013,.31234707704,.2606106964029,.1806481606949,.0812743883616],[.2955242247148,.26926671931,.219086362516,.1494513491506,.0666713443087],[.2729250867779,.2628045445102,.233193764592,.1862902109277,.1255803694649,.0556685671162],[.2491470458134,.2334925365384,.2031674267231,.1600783285433,.1069393259953,.0471753363865],[.2325515532309,.2262831802629,.2078160475369,.1781459807619,.1388735102198,.0921214998377,.0404840047653],[.2152638534632,.2051984637213,.1855383974779,.1572031671582,.1215185706879,.0801580871598,.0351194603318],[.2025782419256,.1984314853271,.1861610000156,.166269205817,.1395706779262,.1071592204672,.0703660474881,.0307532419961],[.1894506104551,.1826034150449,.169156519395,.1495959888166,.1246289712555,.0951585116825,.0622535239386,.0271524594118]]};function Do(n,e,i,r,o){const s=1-n;return s*s*s*e+3*s*s*n*i+3*s*n*n*r+n*n*n*o}function Xd(n,e,i,r,o,s,a,l,c){c=c||zo.RecursionLimit;const d=c+1;if(Math.abs(n-a)<.001&&Math.abs(e-l)<.001)return[new Ae(a,l)];const u=[];for(let f=0;f<d;f++){const h=f/d,p=Do(h,n,i,o,a),m=Do(h,e,r,s,l);u.push(new Ae(p,m))}return u}function Q0(n,e,i,r,o,s,a,l,c){if(n===i&&e===r&&o===a&&s===l){const b=a-n,y=l-e;return Math.sqrt(b*b+y*y)}const d=9*(i-o)+3*(a-n),u=6*(n+o)-12*i,f=3*(i-n),h=9*(r-s)+3*(l-e),p=6*(e+s)-12*r,m=3*(r-e);function g(b){const y=(d*b+u)*b+f,_=(h*b+p)*b+m;return Math.sqrt(y*y+_*_)}return e1(g,0,1,c||zo.RecursionLimit)}function J0(n,e,i,r,o,s,a,l){const c=[],d=[[],[]];let u,f,h,p,m,g,b,y;for(let C=0;C<2;++C){if(C===0?(f=6*n-12*i+6*o,u=-3*n+9*i-9*o+3*a,h=3*i-3*n):(f=6*e-12*r+6*s,u=-3*e+9*r-9*s+3*l,h=3*r-3*e),Math.abs(u)<.001){if(Math.abs(f)<.001)continue;p=-h/f,0<p&&p<1&&c.push(p);continue}b=f*f-4*h*u,y=Math.sqrt(b),!(b<0)&&(m=(-f+y)/(2*u),0<m&&m<1&&c.push(m),g=(-f-y)/(2*u),0<g&&g<1&&c.push(g))}let _=c.length,x=_,w;for(;_--;)p=c[_],w=1-p,d[0][_]=w*w*w*n+3*w*w*p*i+3*w*p*p*o+p*p*p*a,d[1][_]=w*w*w*e+3*w*w*p*r+3*w*p*p*s+p*p*p*l;return d[0][x]=n,d[1][x]=e,d[0][x+1]=a,d[1][x+1]=l,d[0].length=d[1].length=x+2,{min:{x:Math.min.apply(0,d[0]),y:Math.min.apply(0,d[1])},max:{x:Math.max.apply(0,d[0]),y:Math.max.apply(0,d[1])}}}function e1(n,e,i,r){let o=zo.abscissas[r-2],s=zo.weights[r-2],a=.5*(i-e),l=a+e,c=0,d=r+1>>1,u=r&1?s[c++]*n(l):0;for(;c<d;){const f=a*o[c];u+=s[c++]*(n(l+f)+n(l-f))}return a*u}function t1(n,e){const i=n.length,r=i-1;for(let o=0;o<i;o++){const s=n[o],a=e?Gt(o-1,i):Math.max(o-1,0),l=e?Gt(o+1,i):Math.min(o+1,r),c=n[a],d=s,u=n[l];n1(c,d,u),d.command=o===0?me.move:me.curve}}function n1(n,e,i){const r=be.angleBetween(n,e),o=be.angleBetween(i,e);let s=be.distanceBetween(n,e),a=be.distanceBetween(i,e),l=(r+o)/2;return s<.001||a<.001?(typeof e.relative=="boolean"&&!e.relative&&(e.controls.left.copy(e),e.controls.right.copy(e)),e):(s*=.33,a*=.33,o<r?l+=kt:l-=kt,e.controls.left.x=Math.cos(l)*s,e.controls.left.y=Math.sin(l)*s,l-=Math.PI,e.controls.right.x=Math.cos(l)*a,e.controls.right.y=Math.sin(l)*a,typeof e.relative=="boolean"&&!e.relative&&(e.controls.left.x+=e.x,e.controls.left.y+=e.y,e.controls.right.x+=e.x,e.controls.right.y+=e.y),e)}let Or=(qi=class extends te{constructor(){super();B(this,"_flagId",!1);B(this,"_flagClassName",!1);B(this,"_renderer",{});B(this,"_id",Oo.Identifier+Oo.uniqueId());B(this,"_className","");B(this,"classList",[]);for(let i in Yd)Object.defineProperty(this,i,Yd[i])}static fromObject(i){const r=new qi().copy(i);return"id"in i&&(r.id=i.id),r}flagReset(){return this._flagId=this._flagClassName=!1,this}copy(i){return i.renderer&&typeof i.renderer.type=="string"&&(this.renderer.type=i.renderer.type),typeof i.className=="string"&&(this.className=i.className),this}toObject(){return{renderer:{type:this.renderer.type},id:this.id,className:this.className}}dispose(){if(typeof this.unbind=="function"&&this.unbind(),this._renderer){if(this._renderer.elem&&this._renderer.elem.parentNode&&(this._renderer.elem.parentNode.removeChild(this._renderer.elem),delete this._renderer.elem),this.type==="WebGLRenderer"&&this.renderer.ctx){const r=this.renderer.ctx;this._renderer.texture&&(r.deleteTexture(this._renderer.texture),delete this._renderer.texture),this._renderer.positionBuffer&&(r.deleteBuffer(this._renderer.positionBuffer),delete this._renderer.positionBuffer),this._renderer.effect&&(this._renderer.effect=null)}this.type==="CanvasRenderer"&&this._renderer.context&&delete this._renderer.context}const i=this._renderer.type;return this._renderer={type:i},this}},B(qi,"Properties",["renderer","id","className"]),qi);const Yd={renderer:{enumerable:!1,get:function(){return this._renderer}},id:{enumerable:!0,get:function(){return this._id},set:function(n){const e=this._id;n!==this._id&&(this._id=n,this._flagId=!0,this.parent&&(delete this.parent.children.ids[e],this.parent.children.ids[this._id]=this))}},className:{enumerable:!0,get:function(){return this._className},set:function(n){this._className!==n&&(this._flagClassName=!0,this.classList=n.split(/\s+?/),this._className=n)}}};class Lo extends Error{constructor(i){super();B(this,"name","Two.js");B(this,"message");this.message=i}}class i1{constructor(){B(this,"map",{})}add(e,i){return this.map[e]=i,this}remove(e){return delete this.map[e],this}get(e){return this.map[e]}contains(e){return e in this.map}}let Ho;const Ud={video:/\.(mp4|webm|ogg)$/i,image:/\.(jpe?g|png|gif|tiff|webp)$/i,effect:/texture|gradient/i};Rn.document&&(Ho=document.createElement("a"));const it=class it extends Or{constructor(i,r){super();B(this,"_flagSrc",!1);B(this,"_flagImage",!1);B(this,"_flagVideo",!1);B(this,"_flagLoaded",!1);B(this,"_flagRepeat",!1);B(this,"_flagOffset",!1);B(this,"_flagScale",!1);B(this,"_src","");B(this,"_image",null);B(this,"_loaded",!1);B(this,"_repeat","no-repeat");B(this,"_scale",1);B(this,"_offset",null);for(let o in Kd)Object.defineProperty(this,o,Kd[o]);if(this._renderer.type="texture",this._renderer.flagOffset=r1.bind(this),this._renderer.flagScale=o1.bind(this),this.loaded=!1,this.repeat="no-repeat",this.offset=new be,typeof r=="function"){const o=(function(){this.unbind(te.Types.load,o),typeof r=="function"&&r()}).bind(this);this.bind(te.Types.load,o)}if(typeof i=="string")this.src=i;else if(typeof i=="object"){const o=Object.prototype.toString.call(i);(o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]"||o==="[object HTMLVideoElement]"||o==="[object Image]")&&(this.image=i)}this._update()}fromObject(i){const r=new it().copy(i);return"id"in i&&(r.id=i.id),r}static getAbsoluteURL(i){return Ho?(Ho.href=i,Ho.href):i}static loadHeadlessBuffer(i,r){i.image.onload=r,i.image.src=i.src}static getTag(i){return i&&i.nodeName&&i.nodeName.toLowerCase()||"img"}static getImage(i){const r=it.getAbsoluteURL(i);if(it.ImageRegistry.contains(r))return it.ImageRegistry.get(r);let o;return Rn.document?Ud.video.test(r)?o=document.createElement("video"):o=document.createElement("img"):console.warn("Two.js: no prototypical image defined for Two.Texture"),o.crossOrigin="anonymous",o.referrerPolicy="no-referrer",o}static load(i,r){let o=i.image,s=it.getTag(o);i._flagImage&&(/canvas/i.test(s)?it.Register.canvas(i,r):(i._src=o.getAttribute("two-src")||o.src,it.Register[s](i,r))),i._flagSrc&&(o||(o=it.getImage(i.src),i.image=o),s=it.getTag(o),it.Register[s](i,r))}clone(){const i=new it(this.src);return i.repeat=this.repeat,i.offset.copy(this.offset),i.scale=this.scale,i}copy(i){return this.src=i.src,this.repeat=i.repeat,this.offset=typeof i.offset=="number"||i.offset instanceof be?i.offset:new be().copy(i.offset),this.scale=typeof i.scale=="number"||i.scale instanceof be?i.scale:new be().copy(i.scale),this}toObject(){const i=super.toObject.call(this);return i.renderer.type="texture",i.src=this.src,i.repeat=this.repeat,i.offset=this.offset.toObject(),i.scale=typeof this.scale=="number"?this.scale:this.scale.toObject(),i}_update(){return(this._flagSrc||this._flagImage)&&(this.trigger(te.Types.change),(this._flagSrc||this._flagImage)&&(this.loaded=!1,it.load(this,(function(){this.loaded=!0,this.trigger(te.Types.change).trigger(te.Types.load)}).bind(this)))),this._image&&this._image.readyState>=4&&(this._flagVideo=!0),this}flagReset(){return this._flagSrc=this._flagImage=this._flagLoaded=this._flagRepeat=this._flagVideo=this._flagScale=this._flagOffset=!1,super.flagReset.call(this),this}dispose(){if(super.dispose(),"elem"in this._renderer){const i=this._renderer.elem;i.parentNode.removeChild(i)}return"effect"in this._renderer&&(this._renderer.effect=null),this}};B(it,"Properties",["src","loaded","repeat","scale","offset","image"]),B(it,"RegularExpressions",Ud),B(it,"ImageRegistry",new i1),B(it,"Register",{canvas:function(i,r){i._src="#"+i.id,it.ImageRegistry.add(i.src,i.image),typeof r=="function"&&r()},img:function(i,r){const o=i.image,s=function(l){o.removeEventListener&&typeof o.removeEventListener=="function"&&(o.removeEventListener("load",s,!1),o.removeEventListener("error",a,!1)),typeof r=="function"&&r()},a=function(l){throw typeof o.removeEventListener=="function"&&(o.removeEventListener("load",s,!1),o.removeEventListener("error",a,!1)),new Lo("unable to load "+i.src)};typeof o.width=="number"&&o.width>0&&typeof o.height=="number"&&o.height>0?s():typeof o.addEventListener=="function"&&(o.addEventListener("load",s,!1),o.addEventListener("error",a,!1)),i._src=it.getAbsoluteURL(i._src),!(o&&o.getAttribute("two-src"))&&(o.setAttribute("two-src",i.src),it.ImageRegistry.add(i.src,o),i.image.src=i.src)},video:function(i,r){const o=function(a){i.image.removeEventListener("canplaythrough",o,!1),i.image.removeEventListener("error",s,!1),i.image.width=i.image.videoWidth,i.image.height=i.image.videoHeight,typeof r=="function"&&r()},s=function(a){throw i.image.removeEventListener("canplaythrough",o,!1),i.image.removeEventListener("error",s,!1),new Lo("unable to load "+i.src)};i._src=it.getAbsoluteURL(i._src),i.image.getAttribute("two-src")||(i.image.setAttribute("two-src",i.src),it.ImageRegistry.add(i.src,i.image)),i.image.readyState>=4?o():(i.image.addEventListener("canplaythrough",o,!1),i.image.addEventListener("error",s,!1),i.image.src=i.src,i.image.load())}});let nt=it;const Kd={src:{enumerable:!0,get:function(){return this._src},set:function(n){this._src=n,this._flagSrc=!0}},loaded:{enumerable:!0,get:function(){return this._loaded},set:function(n){this._loaded=n,this._flagLoaded=!0}},repeat:{enumerable:!0,get:function(){return this._repeat},set:function(n){this._repeat=n,this._flagRepeat=!0}},image:{enumerable:!0,get:function(){return this._image},set:function(n){const e=nt.getTag(n);let i;switch(e){case"canvas":i="#"+n.id;break;default:i=n.src}nt.ImageRegistry.contains(i)?this._image=nt.ImageRegistry.get(n.src):this._image=n,this._flagImage=!0}},offset:{enumerable:!0,get:function(){return this._offset},set:function(n){this._offset&&this._offset.unbind(te.Types.change,this._renderer.flagOffset),this._offset=n,this._offset.bind(te.Types.change,this._renderer.flagOffset),this._flagOffset=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(n){this._scale instanceof be&&this._scale.unbind(te.Types.change,this._renderer.flagScale),this._scale=n,this._scale instanceof be&&this._scale.bind(te.Types.change,this._renderer.flagScale),this._flagScale=!0}}};function r1(){this._flagOffset=!0}function o1(){this._flagScale=!0}class Ti extends Array{constructor(){super();Wl(this,St,new te);arguments[0]&&Array.isArray(arguments[0])?arguments[0].length>0&&this.push.apply(this,arguments[0]):arguments.length>0&&this.push.apply(this,arguments)}get _events(){return qt(this,St)}set _events(i){Em(this,St,i)}get _bound(){return qt(this,St)._bound}set _bound(i){qt(this,St)._bound=i}addEventListener(){var i;return(i=qt(this,St).addEventListener)==null?void 0:i.apply(this,arguments)}on(){var i;return(i=qt(this,St).on)==null?void 0:i.apply(this,arguments)}bind(){var i;return(i=qt(this,St).bind)==null?void 0:i.apply(this,arguments)}removeEventListener(){var i;return(i=qt(this,St).removeEventListener)==null?void 0:i.apply(this,arguments)}off(){var i;return(i=qt(this,St).off)==null?void 0:i.apply(this,arguments)}unbind(){var i;return(i=qt(this,St).unbind)==null?void 0:i.apply(this,arguments)}dispatchEvent(){var i;return(i=qt(this,St).dispatchEvent)==null?void 0:i.apply(this,arguments)}trigger(){var i;return(i=qt(this,St).trigger)==null?void 0:i.apply(this,arguments)}listen(){var i;return(i=qt(this,St).listen)==null?void 0:i.apply(this,arguments)}ignore(){var i;return(i=qt(this,St).ignore)==null?void 0:i.apply(this,arguments)}pop(){const i=super.pop.apply(this,arguments);return this.trigger(te.Types.remove,[i]),i}shift(){const i=super.shift.apply(this,arguments);return this.trigger(te.Types.remove,[i]),i}push(){const i=super.push.apply(this,arguments);return this.trigger(te.Types.insert,arguments),i}unshift(){const i=super.unshift.apply(this,arguments);return this.trigger(te.Types.insert,arguments),i}splice(){const i=super.splice.apply(this,arguments);if(this.trigger(te.Types.remove,i),arguments.length>2){const r=this.slice(arguments[0],arguments[0]+arguments.length-2);this.trigger(te.Types.insert,r),this.trigger(te.Types.order)}return i}sort(){return super.sort.apply(this,arguments),this.trigger(te.Types.order),this}reverse(){return super.reverse.apply(this,arguments),this.trigger(te.Types.order),this}indexOf(){return super.indexOf.apply(this,arguments)}map(i,r){const o=[];for(let s=0;s<this.length;s++){const a=this[s];let l;r?l=i.call(r,a,s):l=i(a,s),o.push(l)}return o}}St=new WeakMap;const Gd=Array.prototype.slice;function s1(n){if(n==null)return!1;const e=n.length;return typeof e=="number"&&e>=0&&e<4294967296}const je={isNaN:function(n){return typeof n=="number"&&n!==+n},isElement:function(n){return!!(n&&n.nodeType===1)},isObject:function(n){const e=typeof n;return e==="function"||e==="object"&&!!n},isFunction:function(n){return typeof n=="function"},extend:function(n){const e=Gd.call(arguments,1);for(let i=0;i<e.length;i++){const r=e[i];for(let o in r)n[o]=r[o]}return n},defaults:function(n){const e=Gd.call(arguments,1);for(let i=0;i<e.length;i++){const r=e[i];for(let o in r)n[o]===void 0&&(n[o]=r[o])}return n},each:function(n,e,i){const r=i||this,o=!s1(n)&&Object.keys(n),s=(o||n).length;for(let a=0;a<s;a++){const l=o?o[a]:a;e.call(r,n[l],l,n)}return n},performance:Rn.performance&&Rn.performance.now?Rn.performance:Date},Jt=class Jt extends Or{constructor(i,r,o){super();B(this,"_flagOffset",!0);B(this,"_flagOpacity",!0);B(this,"_flagColor",!0);B(this,"_offset",0);B(this,"_opacity",1);B(this,"_color","#fff");for(let s in Zd)Object.defineProperty(this,s,Zd[s]);this._renderer.type="stop",this.offset=typeof i=="number"?i:Jt.Index<=0?0:1,this.opacity=typeof o=="number"?o:1,this.color=typeof r=="string"?r:Jt.Index<=0?"#fff":"#000",Jt.Index=(Jt.Index+1)%2}static fromObject(i){const r=new Jt().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<Jt.Properties.length;r++){const o=Jt.Properties[r];o in i&&(this[o]=i[o])}return this}clone(i){const r=new Jt;return je.each(Jt.Properties,function(o){r[o]=this[o]},this),i&&i.stops&&i.stops.push(r),r}toObject(){const i=super.toObject.call(this);return i.renderer.type="stop",je.each(Jt.Properties,r=>{i[r]=this[r]},this),i}flagReset(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,super.flagReset.call(this),this}};B(Jt,"Index",0),B(Jt,"Properties",["offset","opacity","color"]);let $i=Jt;const Zd={offset:{enumerable:!0,get:function(){return this._offset},set:function(n){this._offset=n,this._flagOffset=!0,this.parent&&(this.parent._flagStops=!0)}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(n){this._opacity=n,this._flagOpacity=!0,this.parent&&(this.parent._flagStops=!0)}},color:{enumerable:!0,get:function(){return this._color},set:function(n){this._color=n,this._flagColor=!0,this.parent&&(this.parent._flagStops=!0)}}},On=class On extends Or{constructor(i){super();B(this,"_flagStops",!1);B(this,"_flagSpread",!1);B(this,"_flagUnits",!1);B(this,"_spread","");B(this,"_units","");for(let r in Qd)Object.defineProperty(this,r,Qd[r]);this._renderer.type="gradient",this._renderer.flagStops=a1.bind(this),this._renderer.bindStops=l1.bind(this),this._renderer.unbindStops=c1.bind(this),this.spread="pad",this.units="objectBoundingBox",i&&(this.stops=i)}static fromObject(i){let r=i.stops;r&&r.length>0&&(r=r.map(s=>s instanceof $i?s:new $i().copy(s)));const o=new On(r).copy(i);return"id"in i&&(o.id=i.id),o}clone(i){const r=this.stops.map(s=>s.clone()),o=new On(r);return je.each(On.Properties,s=>{o[s]=this[s]},this),i&&i.add(o),o}copy(i){super.copy.call(this,i);for(let r=0;r<On.Properties.length;r++){const o=On.Properties[r];o in i&&(this[o]=i[o])}return this}toObject(){const i={stops:this.stops.map(r=>r.toObject())};return je.each(On.Properties,r=>{i[r]=this[r]},this),i}_update(){return(this._flagSpread||this._flagStops)&&this.trigger(te.Types.change),this}flagReset(){return this._flagSpread=this._flagUnits=this._flagStops=!1,super.flagReset.call(this),this}dispose(){if("elem"in this._renderer){const i=this._renderer.elem;i.parentNode.removeChild(i)}return"effect"in this._renderer&&(this._renderer.effect=null),this}};B(On,"Stop",$i),B(On,"Properties",["spread","stops","units"]);let gt=On;const Qd={spread:{enumerable:!0,get:function(){return this._spread},set:function(n){this._spread=n,this._flagSpread=!0}},units:{enumerable:!0,get:function(){return this._units},set:function(n){this._units=n,this._flagUnits=!0}},stops:{enumerable:!0,get:function(){return this._stops},set:function(n){const e=this._renderer.bindStops,i=this._renderer.unbindStops;this._stops&&this._stops.unbind(te.Types.insert,e).unbind(te.Types.remove,i),this._stops=new Ti((n||[]).slice(0)),this._stops.bind(te.Types.insert,e).bind(te.Types.remove,i),e(this._stops)}}};function a1(){this._flagStops=!0}function l1(n){let e=n.length;for(;e--;)n[e].bind(te.Types.change,this._renderer.flagStops),n[e].parent=this;this._renderer.flagStops()}function c1(n){let e=n.length;for(;e--;)n[e].unbind(te.Types.change,this._renderer.flagStops),delete n[e].parent;this._renderer.flagStops()}const _i=class _i extends gt{constructor(i,r,o,s,a){super(a);B(this,"_flagEndPoints",!1);B(this,"_left",null);B(this,"_right",null);for(let l in Jd)Object.defineProperty(this,l,Jd[l]);this._renderer.type="linear-gradient",this._renderer.flagEndPoints=d1.bind(this),this.left=new be,this.right=new be,typeof i=="number"&&(this.left.x=i),typeof r=="number"&&(this.left.y=r),typeof o=="number"&&(this.right.x=o),typeof s=="number"&&(this.right.y=s)}static fromObject(i){const r=new _i().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<_i.Properties.length;r++){const o=_i.Properties[r];o in i&&(this[o]=i[o]instanceof be?i[o]:new be().copy(i[o]))}return this}clone(i){const r=this.stops.map(function(s){return s.clone()}),o=new _i(this.left._x,this.left._y,this.right._x,this.right._y,r);return je.each(gt.Properties,function(s){o[s]=this[s]},this),i&&i.add(o),o}toObject(){const i=super.toObject.call(this);return i.left=this.left.toObject(),i.right=this.right.toObject(),i}_update(){return(this._flagEndPoints||this._flagSpread||this._flagStops)&&this.trigger(te.Types.change),this}flagReset(){return this._flagEndPoints=!1,super.flagReset.call(this),this}};B(_i,"Stop",$i),B(_i,"Properties",["left","right"]);let zt=_i;const Jd={left:{enumerable:!0,get:function(){return this._left},set:function(n){this._left instanceof be&&this._left.unbind(te.Types.change,this._renderer.flagEndPoints),this._left=n,this._left.bind(te.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}},right:{enumerable:!0,get:function(){return this._right},set:function(n){this._right instanceof be&&this._right.unbind(te.Types.change,this._renderer.flagEndPoints),this._right=n,this._right.bind(te.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}}};function d1(){this._flagEndPoints=!0}const zn=class zn extends gt{constructor(i,r,o,s,a,l){super(s);B(this,"_flagRadius",!1);B(this,"_flagCenter",!1);B(this,"_flagFocal",!1);B(this,"_radius",0);B(this,"_center",null);B(this,"_focal",null);for(let c in eu)Object.defineProperty(this,c,eu[c]);this._renderer.type="radial-gradient",this._renderer.flagCenter=u1.bind(this),this._renderer.flagFocal=f1.bind(this),this.center=new be,this.radius=typeof o=="number"?o:1,this.focal=new be,typeof i=="number"&&(this.center.x=i),typeof r=="number"&&(this.center.y=r),this.focal.copy(this.center),typeof a=="number"&&(this.focal.x=a),typeof l=="number"&&(this.focal.y=l)}static fromObject(i){const r=new zn().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<zn.Properties.length;r++){const o=zn.Properties[r];o in i&&(/(center|focal)i/.test(o)?this[o]=i[o]instanceof be?i[o]:new be().copy(i[o]):typeof i[o]=="number"&&(this[o]=i[MediaKeySystemAccess]))}return this}clone(i){const r=this.stops.map(function(s){return s.clone()}),o=new zn(this.center._x,this.center._y,this._radius,r,this.focal._x,this.focal._y);return je.each(gt.Properties.concat(zn.Properties),function(s){o[s]=this[s]},this),i&&i.add(o),o}toObject(){const i=super.toObject.call(this);return je.each(zn.Properties,function(r){i[r]=this[r]},this),i.center=this.center.toObject(),i.focal=this.focal.toObject(),i}_update(){return(this._flagRadius||this._flatCenter||this._flagFocal||this._flagSpread||this._flagStops)&&this.trigger(te.Types.change),this}flagReset(){return this._flagRadius=this._flagCenter=this._flagFocal=!1,super.flagReset.call(this),this}};B(zn,"Stop",$i),B(zn,"Properties",["center","radius","focal"]);let Dt=zn;const eu={radius:{enumerable:!0,get:function(){return this._radius},set:function(n){this._radius=n,this._flagRadius=!0}},center:{enumerable:!0,get:function(){return this._center},set:function(n){this._center&&this._center.unbind(te.Types.change,this._renderer.flagCenter),this._center=n,this._center.bind(te.Types.change,this._renderer.flagCenter),this._flagCenter=!0}},focal:{enumerable:!0,get:function(){return this._focal},set:function(n){this._focal&&this._focal.unbind(te.Types.change,this._renderer.flagFocal),this._focal=n,this._focal.bind(te.Types.change,this._renderer.flagFocal),this._flagFocal=!0}}};function u1(){this._flagCenter=!0}function f1(){this._flagFocal=!0}function tu(n,e){if(e===0||e===1)return!0;const r=n._length*e;let o=0;for(let s=0;s<n._lengths.length;s++){const a=n._lengths[s];if(o>=r)return r-o>=0;o+=a}return!1}function Wo(n,e){const i=n._length;if(e<=0)return 0;if(e>=i)return n._lengths.length-1;for(let r=0,o=0;r<n._lengths.length;r++){if(o+n._lengths[r]>=e)return e-=o,Math.max(r-1,0)+e/n._lengths[r];o+=n._lengths[r]}return-1}function nu(n,e,i){let r,o,s,a,l,c,d,u;const f=e.controls&&e.controls.right,h=n.controls&&n.controls.left;return r=e.x,l=e.y,o=(f||e).x,c=(f||e).y,s=(h||n).x,d=(h||n).y,a=n.x,u=n.y,f&&e._relative&&(o+=e.x,c+=e.y),h&&n._relative&&(s+=n.x,d+=n.y),Q0(r,l,o,c,s,d,a,u,i)}function _a(n,e,i){let r,o,s,a,l,c,d,u;const f=e.controls&&e.controls.right,h=n.controls&&n.controls.left;return r=e.x,l=e.y,o=(f||e).x,c=(f||e).y,s=(h||n).x,d=(h||n).y,a=n.x,u=n.y,f&&e._relative&&(o+=e.x,c+=e.y),h&&n._relative&&(s+=n.x,d+=n.y),Xd(r,l,o,c,s,d,a,u,i)}function Ei(n){switch(n.renderer.type){case"texture":return nt.fromObject(n);case"gradient":return gt.fromObject(n);case"linear-gradient":return zt.fromObject(n);case"radial-gradient":return Dt.fromObject(n)}return n}const h1=Math.cos,m1=Math.sin,iu=Math.tan,wa=[],Ht=class Ht extends te{constructor(i,r,o,s,a,l){super();B(this,"elements",new Wd(9));B(this,"manual",!1);let c=i;Array.isArray(c)||(c=Array.prototype.slice.call(arguments)),this.identity(),c.length>0&&this.set(c)}static Multiply(i,r,o){if(r.length<=3){const k=i;let $,v,E;const P=r[0]||0,F=r[1]||0,R=r[2]||0;return $=k[0]*P+k[1]*F+k[2]*R,v=k[3]*P+k[4]*F+k[5]*R,E=k[6]*P+k[7]*F+k[8]*R,[$,v,E]}const s=i[0],a=i[1],l=i[2],c=i[3],d=i[4],u=i[5],f=i[6],h=i[7],p=i[8],m=r[0],g=r[1],b=r[2],y=r[3],_=r[4],x=r[5],w=r[6],C=r[7],N=r[8];return o=o||new Wd(9),o[0]=s*m+a*y+l*w,o[1]=s*g+a*_+l*C,o[2]=s*b+a*x+l*N,o[3]=c*m+d*y+u*w,o[4]=c*g+d*_+u*C,o[5]=c*b+d*x+u*N,o[6]=f*m+h*y+p*w,o[7]=f*g+h*_+p*C,o[8]=f*b+h*x+p*N,o}static fromObject(i){return new Ht().copy(i)}set(i,r,o,s,a,l,c,d,u){if(typeof r>"u"){const f=i;i=f[0],r=f[1],o=f[2],s=f[3],a=f[4],l=f[5],c=f[6],d=f[7],u=f[8]}return this.elements[0]=i,this.elements[1]=r,this.elements[2]=o,this.elements[3]=s,this.elements[4]=a,this.elements[5]=l,this.elements[6]=c,this.elements[7]=d,this.elements[8]=u,this.trigger(te.Types.change)}copy(i){return this.elements[0]=i.elements[0],this.elements[1]=i.elements[1],this.elements[2]=i.elements[2],this.elements[3]=i.elements[3],this.elements[4]=i.elements[4],this.elements[5]=i.elements[5],this.elements[6]=i.elements[6],this.elements[7]=i.elements[7],this.elements[8]=i.elements[8],this.manual=i.manual,this.trigger(te.Types.change)}identity(){return this.elements[0]=Ht.Identity[0],this.elements[1]=Ht.Identity[1],this.elements[2]=Ht.Identity[2],this.elements[3]=Ht.Identity[3],this.elements[4]=Ht.Identity[4],this.elements[5]=Ht.Identity[5],this.elements[6]=Ht.Identity[6],this.elements[7]=Ht.Identity[7],this.elements[8]=Ht.Identity[8],this.trigger(te.Types.change)}multiply(i,r,o,s,a,l,c,d,u){if(typeof r>"u")return this.elements[0]*=i,this.elements[1]*=i,this.elements[2]*=i,this.elements[3]*=i,this.elements[4]*=i,this.elements[5]*=i,this.elements[6]*=i,this.elements[7]*=i,this.elements[8]*=i,this.trigger(te.Types.change);if(typeof o>"u"&&(o=1),typeof s>"u"){i=i||0,r=r||0,o=o||0,a=this.elements;const X=a[0]*i+a[1]*r+a[2]*o,G=a[3]*i+a[4]*r+a[5]*o,Z=a[6]*i+a[7]*r+a[8]*o;return[X,G,Z]}const f=this.elements,h=[i,r,o,s,a,l,c,d,u],p=f[0],m=f[1],g=f[2],b=f[3],y=f[4],_=f[5],x=f[6],w=f[7],C=f[8],N=h[0],k=h[1],$=h[2],v=h[3],E=h[4],P=h[5],F=h[6],R=h[7],M=h[8];return this.elements[0]=p*N+m*v+g*F,this.elements[1]=p*k+m*E+g*R,this.elements[2]=p*$+m*P+g*M,this.elements[3]=b*N+y*v+_*F,this.elements[4]=b*k+y*E+_*R,this.elements[5]=b*$+y*P+_*M,this.elements[6]=x*N+w*v+C*F,this.elements[7]=x*k+w*E+C*R,this.elements[8]=x*$+w*P+C*M,this.trigger(te.Types.change)}inverse(i){const r=this.elements;i=i||new Ht;const o=r[0],s=r[1],a=r[2],l=r[3],c=r[4],d=r[5],u=r[6],f=r[7],h=r[8],p=h*c-d*f,m=-h*l+d*u,g=f*l-c*u;let b=o*p+s*m+a*g;return b?(b=1/b,i.elements[0]=p*b,i.elements[1]=(-h*s+a*f)*b,i.elements[2]=(d*s-a*c)*b,i.elements[3]=m*b,i.elements[4]=(h*o-a*u)*b,i.elements[5]=(-d*o+a*l)*b,i.elements[6]=g*b,i.elements[7]=(-f*o+s*u)*b,i.elements[8]=(c*o-s*l)*b,i):null}scale(i,r){return arguments.length<=1&&(r=i),this.multiply(i,0,0,0,r,0,0,0,1)}rotate(i){const r=h1(i),o=m1(i);return this.multiply(r,-o,0,o,r,0,0,0,1)}translate(i,r){return this.multiply(1,0,i,0,1,r,0,0,1)}skewX(i){const r=iu(i);return this.multiply(1,r,0,0,1,0,0,0,1)}skewY(i){const r=iu(i);return this.multiply(1,0,0,r,1,0,0,0,1)}toString(i){return wa.length=0,this.toTransformArray(i,wa),wa.map(Pn).join(" ")}toTransformArray(i,r){const o=this.elements,s=!!r,a=o[0],l=o[1],c=o[2],d=o[3],u=o[4],f=o[5];if(i){const h=o[6],p=o[7],m=o[8];if(s){r[0]=a,r[1]=d,r[2]=h,r[3]=l,r[4]=u,r[5]=p,r[6]=c,r[7]=f,r[8]=m;return}return[a,d,h,l,u,p,c,f,m]}if(s){r[0]=a,r[1]=d,r[2]=l,r[3]=u,r[4]=c,r[5]=f;return}return[a,d,l,u,c,f]}toArray(i,r){const o=this.elements,s=!!r,a=o[0],l=o[1],c=o[2],d=o[3],u=o[4],f=o[5];if(i){const h=o[6],p=o[7],m=o[8];if(s){r[0]=a,r[1]=l,r[2]=c,r[3]=d,r[4]=u,r[5]=f,r[6]=h,r[7]=p,r[8]=m;return}return[a,l,c,d,u,f,h,p,m]}if(s){r[0]=a,r[1]=l,r[2]=c,r[3]=d,r[4]=u,r[5]=f;return}return[a,l,c,d,u,f]}toObject(){return{renderer:{type:"matrix"},elements:this.toArray(!0),manual:!!this.manual}}clone(){return new Ht().copy(this)}};B(Ht,"Identity",[1,0,0,0,1,0,0,0,1]);let ur=Ht;U0(ur);const io=class io extends Or{constructor(){super();B(this,"_flagMatrix",!0);B(this,"_flagScale",!1);B(this,"_matrix",null);B(this,"_worldMatrix",null);B(this,"_position",null);B(this,"_rotation",0);B(this,"_scale",1);B(this,"_skewX",0);B(this,"_skewY",0);for(let i in jo)Object.defineProperty(this,i,jo[i]);this._renderer.flagMatrix=ru.bind(this),this.isShape=!0,this.matrix=new ur,this.worldMatrix=new ur,this.position=new be,this.rotation=0,this.scale=1,this.skewX=0,this.skewY=0}static fromObject(i){const r=new io().copy(i);return"id"in i&&(r.id=i.id),r}get renderer(){return this._renderer}set renderer(i){this._renderer=i}get translation(){return jo.position.get.apply(this,arguments)}set translation(i){jo.position.set.apply(this,arguments)}addTo(i){return i.add(this),this}remove(){return this.parent?(this.parent.remove(this),this):this}contains(i,r,o){const s=o||{},a=s.ignoreVisibility===!0;if(!a&&"visible"in this&&this.visible===!1||!a&&"opacity"in this&&typeof this.opacity=="number"&&this.opacity<=0||typeof this.getBoundingClientRect!="function")return!1;const l=typeof s.tolerance=="number"?s.tolerance:0;this._update(!0);const c=this.getBoundingClientRect();return c?i>=c.left-l&&i<=c.right+l&&r>=c.top-l&&r<=c.bottom+l:!1}copy(i){return super.copy.call(this,i),"position"in i&&(i.position instanceof be?this.position=i.position:this.position.copy(i.position)),"rotation"in i&&(this.rotation=i.rotation),"scale"in i&&(this.scale=typeof i.scale=="number"||i.scale instanceof be?i.scale:new be(i.scale.x,i.scale.y)),"skewX"in i&&(this.skewX=i.skewX),"skewY"in i&&(this.skewY=i.skewY),"matrix"in i&&i.matrix.manual&&(this.matrix.copy(i.matrix),this.matrix.manual=!0),this}clone(i){const r=new io;return r.position.copy(this.position),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix),i&&i.add(r),r._update()}toObject(){const i=super.toObject.call(this);return i.renderer={type:"shape"},i.isShape=!0,i.translation=this.translation.toObject(),i.rotation=this.translation.rotation,i.scale=this.scale instanceof be?this.scale.toObject():this.scale,i.skewX=this.skewX,i.skewY=this.skewY,i.matrix=this.matrix.toObject(),i}dispose(){super.dispose(),typeof this.translation=="object"&&typeof this.translation.unbind=="function"&&this.translation.unbind(),typeof this.scale=="object"&&typeof this.scale.unbind=="function"&&this.scale.unbind()}_update(i){return!this._matrix.manual&&this._flagMatrix&&(this._matrix.identity().translate(this.position.x,this.position.y),this._matrix.rotate(this.rotation),this._scale instanceof be?this._matrix.scale(this._scale.x,this._scale.y):this._matrix.scale(this._scale),this._matrix.skewX(this.skewX),this._matrix.skewY(this.skewY)),i&&this.parent&&this.parent._update&&this.parent._update(),this}flagReset(){return this._flagMatrix=this._flagScale=!1,super.flagReset.call(this),this}};B(io,"Properties",["position","rotation","scale","skewX","skewY","matrix","worldMatrix"]);let Fn=io;const jo={position:{enumerable:!0,get:function(){return this._position},set:function(n){this._position&&this._position.unbind(te.Types.change,this._renderer.flagMatrix),this._position=n,this._position.bind(te.Types.change,this._renderer.flagMatrix),ru.call(this)}},rotation:{enumerable:!0,get:function(){return this._rotation},set:function(n){this._rotation=n,this._flagMatrix=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(n){this._scale instanceof be&&this._scale.unbind(te.Types.change,this._renderer.flagMatrix),this._scale=n,this._scale instanceof be&&this._scale.bind(te.Types.change,this._renderer.flagMatrix),this._flagMatrix=!0,this._flagScale=!0}},skewX:{enumerable:!0,get:function(){return this._skewX},set:function(n){this._skewX=n,this._flagMatrix=!0}},skewY:{enumerable:!0,get:function(){return this._skewY},set:function(n){this._skewY=n,this._flagMatrix=!0}},matrix:{enumerable:!0,get:function(){return this._matrix},set:function(n){this._matrix=n,this._flagMatrix=!0}},worldMatrix:{enumerable:!0,get:function(){return K0(this,this._worldMatrix),this._worldMatrix},set:function(n){this._worldMatrix=n}}};function ru(){this._flagMatrix=!0}const ou=/^(?:none|transparent)$/i,p1=8,xa=Number.EPSILON;function Yn(n,e){return{x:n,y:e}}function qo(n,e,i=xa){return Math.abs(n.x-e.x)<=i&&Math.abs(n.y-e.y)<=i}function su(n,e,i,r){const o=n*i+e*r,s=Math.sqrt(n*n+e*e)*Math.sqrt(i*i+r*r)||1e-12;let a=Math.acos(Math.max(-1,Math.min(1,o/s)));return n*r-e*i<0&&(a=-a),a}function g1(n,e,i){if(!n)return[Yn(e.x,e.y)];let r=e.rx,o=e.ry;if(!(r&&o))return[Yn(e.x,e.y)];const s=(e.xAxisRotation||0)*Math.PI/180,a=e.largeArcFlag?1:0,l=e.sweepFlag?1:0;r=Math.abs(r),o=Math.abs(o);const c=n.x,d=n.y,u=e.x,f=e.y,h=(c-u)/2,p=(d-f)/2,m=Math.cos(s),g=Math.sin(s);let b=m*h+g*p,y=-g*h+m*p,_=r*r,x=o*o;const w=b*b/_+y*y/x;if(w>1){const A=Math.sqrt(w);r*=A,o*=A,_=r*r,x=o*o}const C=_*y*y+x*b*b,N=C===0?0:(_*x-C)/C;let k=Math.sqrt(Math.max(0,N));a===l&&(k=-k);const $=k*r*y/o,v=-k*o*b/r,E=m*$-g*v+(c+u)/2,P=g*$+m*v+(d+f)/2,F=su(1,0,(b-$)/r,(y-v)/o),R=su((b-$)/r,(y-v)/o,(-b-$)/r,(-y-v)/o)%nn,M=F+R,X=l===0,G=(()=>{const A=M-F,Y=Math.abs(A)<Number.EPSILON;let H=Gt(A,nn);return H<Number.EPSILON&&(H=Y?0:nn),X&&!Y&&(H=H===nn?-nn:H-nn),H})(),Z=Math.max(Oo.Resolution,Math.max(i*2,1)),O=[];for(let A=1;A<=Z;A++){const Y=A/Z,H=F+Y*G;let T=E+r*Math.cos(H),D=P+o*Math.sin(H);if(s!==0){const K=T-E,J=D-P,U=Math.cos(s),q=Math.sin(s);T=K*U-J*q+E,D=K*q+J*U+P}O.push(Yn(T,D))}return O}function y1(n,e=p1){const i=[],r=[],o=n._renderer&&n._renderer.vertices&&n._renderer.vertices.length>0?n._renderer.vertices:n.vertices;if(!o||o.length===0)return{polygons:i,segments:r};const s=Math.max(1,Math.floor(e));let a=null,l=null,c=null,d=null;const u=(h=!1)=>{if(a){if(h&&l&&c&&!qo(l,c)){const p=Yn(l.x,l.y);r.push({a:c,b:p}),a.push(p),c=p}a.length>=3&&l&&c&&qo(l,c)&&i.push(a),a=null,l=null,c=null}},f=h=>{if(!c){c=h,a&&a.push(h);return}qo(c,h)||(r.push({a:c,b:h}),a&&a.push(h),c=h)};for(let h=0;h<o.length;h++){const p=o[h],m=p.command||(h===0?me.move:me.line);if(m===me.move){u(!1);const g=Yn(p.x,p.y);a=[g],l=g,c=g,d=p;continue}if(d||(d=o[Math.max(h-1,0)]),m===me.line)f(Yn(p.x,p.y));else if(m===me.curve){const g=_a(p,d,s);for(let b=1;b<g.length;b++){const y=g[b];f(Yn(y.x,y.y))}f(Yn(p.x,p.y))}else if(m===me.arc){const g=g1(d,p,s);for(let b=0;b<g.length;b++)f(g[b])}else if(m===me.close){u(!0),d=p;continue}else f(Yn(p.x,p.y));d=p}if(a){const h=!!n._closed||!!n.closed||l&&c&&!qo(l,c);u(h)}return{polygons:i,segments:r}}function b1(n,e,i){let r=!1;for(let o=0;o<n.length;o++){const s=n[o];if(!s||s.length<3)continue;let a=s.length-1;for(let l=0;l<s.length;l++){const c=s[a],d=s[l];d.y>i!=c.y>i&&e<(c.x-d.x)*(i-d.y)/(c.y-d.y||1e-12)+d.x&&(r=!r),a=l}}return r}function _1(n,e,i,r){const o=r.x-i.x,s=r.y-i.y;if(Math.abs(o)<xa&&Math.abs(s)<xa){const h=n-i.x,p=e-i.y;return h*h+p*p}const a=((n-i.x)*o+(e-i.y)*s)/(o*o+s*s),l=Math.max(0,Math.min(1,a)),c=i.x+l*o,d=i.y+l*s,u=n-c,f=e-d;return u*u+f*f}function w1(n,e,i){if(!n||n.length===0)return 1/0;let r=1/0;for(let o=0;o<n.length;o++){const s=n[o],a=_1(e,i,s.a,s.b);a<r&&(r=a)}return Math.sqrt(r)}function x1(n,e){if(typeof e=="boolean")return e;const i=n.fill;return!i&&i!==0?!1:typeof i=="string"?!ou.test(i):!0}function k1(n,e){const i=typeof n.linewidth=="number"?n.linewidth:n._linewidth||0;if(typeof e=="boolean")return e&&i>0;if(!(i>0))return!1;const r=n.stroke;return!r&&r!==0?!1:typeof r=="string"?!ou.test(r):!0}function C1(n,e,i,r=0){if(!n)return!1;const o=n.left-r,s=n.right+r,a=n.top-r,l=n.bottom+r;return e>=o&&e<=s&&i>=a&&i<=l}const Xo=Number.EPSILON;function Yo(n){return typeof n.relative!="boolean"||!!n.relative}function wn(n,e,i,r){const o=n.controls;if(!(!o||!o[e])){if(Math.abs(i)<Xo&&Math.abs(r)<Xo){Yo(n)?o[e].clear():o[e].set(n.x,n.y);return}Yo(n)?o[e].set(i,r):o[e].set(n.x+i,n.y+r)}}function Zt(n,e){wn(n,e,0,0)}function v1(n,e){const i=n.controls;return!i||!i[e]?{x:0,y:0}:Yo(n)?{x:i[e].x,y:i[e].y}:{x:i[e].x-n.x,y:i[e].y-n.y}}function fr(n,e){const i=v1(n,e);return Math.abs(i.x)>Xo||Math.abs(i.y)>Xo}function Uo(n){n.command===me.move||n.command===me.close||(n.command=fr(n,"left")||fr(n,"right")?me.curve:me.line)}function au(n,e){typeof e.relative=="boolean"&&(n.relative=e.relative)}function S1(n,e){return fr(e,"right")||fr(n,"left")||fr(n,"right")||fr(e,"left")||n.command===me.curve||e.command===me.curve}function hr(n,e,i){return{x:Kt(n.x,e.x,i),y:Kt(n.y,e.y,i)}}function lu(n,e){const i=n.controls&&n.controls[e];return i?Yo(n)?{x:n.x+i.x,y:n.y+i.y}:{x:i.x,y:i.y}:{x:n.x,y:n.y}}function B1(n,e,i){const r=n.controls&&n.controls.right,o=e.controls&&e.controls.left,s={x:n.x,y:n.y},a=r?lu(n,"right"):{...s},l={x:e.x,y:e.y},c=o?lu(e,"left"):{...l},d=hr(s,a,i),u=hr(a,c,i),f=hr(c,l,i),h=hr(d,u,i),p=hr(u,f,i),m=hr(h,p,i),g=new Ae(m.x,m.y);return au(g,n),wn(g,"left",h.x-m.x,h.y-m.y),wn(g,"right",p.x-m.x,p.y-m.y),g.command=me.curve,{anchor:g,startOut:d,endIn:f}}function N1(n,e,i,r,o,s){const a=n.length,l=i-e+1;let c=l-1,d=o?Math.min(l,4):1,u=d,f=d;if(r||(u=Math.min(1,e),f=Math.min(1,a-i-1)),c+=u+f,c<=1)return;const h=new Array(c+1);for(let k=0,$=e-u;k<=c;k+=1,$+=1){const v=Gt($,a);h[k]=n[v]}let p=h[0].x+2*h[1].x,m=h[0].y+2*h[1].y,g=2;const b=c-1,y=[p],_=[m],x=[g],w=new Array(c+1),C=new Array(c+1);for(let k=1;k<c;k+=1){const $=k<b,v=$||s?1:2,E=$?4:s?2:7,P=$?4:s?3:8,F=$?2:s?0:1,R=v/g;g=x[k]=E-R,p=y[k]=P*h[k].x+F*h[k+1].x-R*p,m=_[k]=P*h[k].y+F*h[k+1].y-R*m}w[b]=y[b]/x[b],C[b]=_[b]/x[b];for(let k=c-2;k>=0;k-=1)w[k]=(y[k]-w[k+1])/x[k],C[k]=(_[k]-C[k+1])/x[k];w[c]=(3*h[c].x-w[b])/2,C[c]=(3*h[c].y-C[b])/2;const N=c-f;for(let k=u,$=e;k<=N;k+=1,$+=1){const v=Gt($,a),E=n[v],P=w[k]-E.x,F=C[k]-E.y;o||k<N?wn(E,"right",P,F):Zt(E,"right"),o||k>u?wn(E,"left",-P,-F):Zt(E,"left"),Uo(E)}}function T1(n,e,i,r,o,s){const a=e||n,l=n,c=i||n,d=be.distanceBetween(a,l),u=be.distanceBetween(l,c),f=r===void 0?.5:r,h=Math.pow(d,f),p=Math.pow(u,f),m=h*h,g=p*p;if(!o&&e){const b=2*g+3*p*h+m,y=3*p*(p+h);if(y!==0){const _=(g*a.x+b*l.x-m*c.x)/y-l.x,x=(g*a.y+b*l.y-m*c.y)/y-l.y;wn(n,"left",_,x)}else Zt(n,"left")}else Zt(n,"left");if(!s&&i){const b=2*m+3*h*p+g,y=3*h*(h+p);if(y!==0){const _=(m*c.x+b*l.x-g*a.x)/y-l.x,x=(m*c.y+b*l.y-g*a.y)/y-l.y;wn(n,"right",_,x)}else Zt(n,"right")}else Zt(n,"right");Uo(n)}function $1(n,e,i,r,o,s){if(!(e&&i)){e||Zt(n,"left"),i||Zt(n,"right"),Uo(n);return}const a=e,l=n,c=i,d=be.distanceBetween(a,l),u=be.distanceBetween(l,c),f=d+u,h=r===void 0?.4:r,p={x:a.x-c.x,y:a.y-c.y};if(!o&&f!==0){const m=h*d/f;wn(n,"left",p.x*m,p.y*m)}else Zt(n,"left");if(!s&&f!==0){const m=h*d/f-h;wn(n,"right",p.x*m,p.y*m)}else Zt(n,"right");Uo(n)}function E1(n,e,i,r,o,s){const a=s.type,l=s.factor,c=n.length;for(let d=e;d<=i;d+=1){const u=Gt(d,c),f=n[u];if(f.command===me.move){Zt(f,"left"),Zt(f,"right");continue}const h=d===e&&!o?null:d-1,p=d===i&&!o?null:d+1,m=h===null?null:n[Gt(h,c)],g=p===null?null:n[Gt(p,c)],b=h===null,y=p===null;a==="geometric"?$1(f,m,g,l,b,y):T1(f,m,g,l,b,y)}}const mr=Math.min,pr=Math.max,R1=Math.ceil,P1=Math.floor,F1=new be,V1=new ur,Cn=class Cn extends Fn{constructor(i,r,o,s){super();B(this,"_flagVertices",!0);B(this,"_flagLength",!0);B(this,"_flagFill",!0);B(this,"_flagStroke",!0);B(this,"_flagLinewidth",!0);B(this,"_flagOpacity",!0);B(this,"_flagVisible",!0);B(this,"_flagCap",!0);B(this,"_flagJoin",!0);B(this,"_flagMiter",!0);B(this,"_flagStrokeAttenuation",!0);B(this,"_flagMask",!1);B(this,"_flagClip",!1);B(this,"_length",0);B(this,"_fill","#fff");B(this,"_stroke","#000");B(this,"_linewidth",1);B(this,"_opacity",1);B(this,"_visible",!0);B(this,"_cap","round");B(this,"_join","round");B(this,"_miter",4);B(this,"_closed",!0);B(this,"_curved",!1);B(this,"_automatic",!0);B(this,"_beginning",0);B(this,"_ending",1);B(this,"_mask",null);B(this,"_clip",!1);B(this,"_dashes",null);B(this,"_strokeAttenuation",!0);for(let a in cu)Object.defineProperty(this,a,cu[a]);this._renderer.type="path",this._renderer.flagVertices=du.bind(this),this._renderer.bindVertices=uu.bind(this),this._renderer.unbindVertices=fu.bind(this),this._renderer.flagFill=hu.bind(this),this._renderer.flagStroke=mu.bind(this),this._renderer.vertices=[],this._renderer.collection=[],this.closed=!!r,this.curved=!!o,this.beginning=0,this.ending=1,this.fill="#fff",this.stroke="#000",this.linewidth=1,this.opacity=1,this.className="",this.visible=!0,this.cap="butt",this.join="miter",this.miter=4,this.vertices=i,this.automatic=!s,this.dashes=[],this.dashes.offset=0}static fromObject(i){const r=typeof i.fill=="string"?i.fill:Ei(i.fill),o=typeof i.stroke=="string"?i.stroke:Ei(i.stroke),s=new Cn().copy({...i,fill:r,stroke:o});return"id"in i&&(s.id=i.id),s}copy(i){if(super.copy.call(this,i),i.vertices){this.vertices=[];for(let r=0;r<i.vertices.length;r++){const o=i.vertices[r];o instanceof Ae?this.vertices.push(i.vertices[r].clone()):this.vertices.push(new Ae().copy(o))}}for(let r=0;r<Cn.Properties.length;r++){const o=Cn.Properties[r];o in i&&(this[o]=i[o])}return this}clone(i){const r=new Cn;for(let o=0;o<this.vertices.length;o++)r.vertices.push(this.vertices[o].clone());for(let o=0;o<Cn.Properties.length;o++){const s=Cn.Properties[o];r[s]=this[s]}return r.className=this.className,r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix),i&&i.add(r),r._update()}toObject(){const i=super.toObject.call(this);return i.renderer.type="path",i.vertices=this.vertices.map(r=>r.toObject()),je.each(Cn.Properties,r=>{typeof this[r]<"u"&&(this[r].toObject?i[r]=this[r].toObject():i[r]=this[r])},this),i}dispose(){if(super.dispose(),this.vertices&&typeof this.vertices.unbind=="function")try{this.vertices.unbind()}catch{}if(this.vertices)for(let i=0;i<this.vertices.length;i++){const r=this.vertices[i];typeof r.unbind=="function"&&r.unbind(),r.controls&&(r.controls.left&&typeof r.controls.left.unbind=="function"&&r.controls.left.unbind(),r.controls.right&&typeof r.controls.right.unbind=="function"&&r.controls.right.unbind())}return typeof this.fill=="object"&&typeof this.fill.dispose=="function"?this.fill.dispose():typeof this.fill=="object"&&typeof this.fill.unbind=="function"&&this.fill.unbind(),typeof this.stroke=="object"&&typeof this.stroke.dispose=="function"?this.stroke.dispose():typeof this.stroke=="object"&&typeof this.stroke.unbind=="function"&&this.stroke.unbind(),this}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}corner(){const i=this.getBoundingClientRect(!0),r=i.width/2,o=i.height/2,s=i.left+i.width/2,a=i.top+i.height/2;for(let l=0;l<this.vertices.length;l++){const c=this.vertices[l];c.x-=s,c.y-=a,c.x+=r,c.y+=o}return this.mask&&(this.mask.translation.x-=s,this.mask.translation.x+=r,this.mask.translation.y-=a,this.mask.translation.y+=o),this}center(){const i=this.getBoundingClientRect(!0),r=i.left+i.width/2-this.translation.x,o=i.top+i.height/2-this.translation.y;for(let s=0;s<this.vertices.length;s++){const a=this.vertices[s];a.x-=r,a.y-=o}return this.mask&&(this.mask.translation.x-=r,this.mask.translation.y-=o),this}getBoundingClientRect(i){let r,o,s,a,l,c,d=1/0,u=-1/0,f=1/0,h=-1/0;if(this._update(!0),r=i?this.matrix:this.worldMatrix,o=(this.linewidth||0)/2,s=this._renderer.vertices.length,this.linewidth>0||this.stroke&&!/(transparent|none)/i.test(this.stroke))if(this.matrix.manual){const{scaleX:p,scaleY:m}=Y0(r.elements[0],r.elements[3],r.elements[1],r.elements[4],r.elements[2],r.elements[5]);typeof p=="number"&&typeof m=="number"&&(o=Math.max(p,m)*(this.linewidth||0)/2)}else o*=typeof this.scale=="number"?this.scale:Math.max(this.scale.x,this.scale.y);if(s<=0)return{width:0,height:0};for(a=0;a<s;a++){c=this._renderer.vertices[a],l=this._renderer.vertices[(a+s-1)%s];const[p,m]=r.multiply(l.x,l.y),[g,b]=r.multiply(c.x,c.y);if(l.controls&&c.controls){let y=l.controls.right.x,_=l.controls.right.y;l.relative&&(y+=l.x,_+=l.y);let[x,w]=r.multiply(y,_),C=c.controls.left.x,N=c.controls.left.y;c.relative&&(C+=c.x,N+=c.y);let[k,$]=r.multiply(C,N);const v=J0(p,m,x,w,k,$,g,b);f=mr(v.min.y-o,f),d=mr(v.min.x-o,d),u=pr(v.max.x+o,u),h=pr(v.max.y+o,h)}else a<=1&&(f=mr(m-o,f),d=mr(p-o,d),u=pr(p+o,u),h=pr(m+o,h)),f=mr(b-o,f),d=mr(g-o,d),u=pr(g+o,u),h=pr(b+o,h)}return{top:f,left:d,right:u,bottom:h,width:u-d,height:h-f}}contains(i,r,o){const s=o||{},a=s.ignoreVisibility===!0;if(!a&&this.visible===!1||!a&&typeof this.opacity=="number"&&this.opacity<=0)return!1;const l=typeof s.tolerance=="number"?s.tolerance:0;this._update(!0);const c=this.getBoundingClientRect();if(!c||i<c.left-l||i>c.right+l||r<c.top-l||r>c.bottom+l)return!1;const d=this.worldMatrix,u=d&&d.inverse(V1);if(!u)return super.contains(i,r,s);const[f,h]=u.multiply(i,r,1),p=typeof s.precision=="number"&&!Number.isNaN(s.precision)?Math.max(1,Math.floor(s.precision)):8,m=x1(this,s.fill),g=k1(this,s.stroke),{polygons:b,segments:y}=y1(this,p);if(m&&b.length>0&&b1(b,f,h))return!0;if(g&&y.length>0){const _=typeof this.linewidth=="number"?this.linewidth:0;if(_>0&&w1(y,f,h)<=_/2+l)return!0}return!m&&!g?super.contains(i,r,s):m&&b.length===0?super.contains(i,r,s):!1}getPointAt(i,r){let o,s,a,l,c,d,u,f,h,p,m,g,b,y,_,x=this.length*Math.min(Math.max(i,0),1);const w=this.vertices.length,C=w-1;let N=null,k=null;for(let O=0,A=this._lengths.length,Y=0;O<A;O++){if(Y+this._lengths[O]>=x){this._closed?(o=Gt(O,w),s=Gt(O-1,w),O===0&&(o=s,s=O)):(o=O,s=Math.min(Math.max(O-1,0),C)),N=this.vertices[o],k=this.vertices[s],x-=Y,this._lengths[O]!==0?i=x/this._lengths[O]:i=0;break}Y+=this._lengths[O]}if(N===null||k===null)return null;if(N){if(!k)return N}else return k;_=k.controls&&k.controls.right,y=N.controls&&N.controls.left,c=k.x,p=k.y,d=(_||k).x,m=(_||k).y,u=(y||N).x,g=(y||N).y,f=N.x,b=N.y,_&&k.relative&&(d+=k.x,m+=k.y),y&&N.relative&&(u+=N.x,g+=N.y),l=Do(i,c,d,u,f),h=Do(i,p,m,g,b);const $=Kt(c,d,i),v=Kt(p,m,i),E=Kt(d,u,i),P=Kt(m,g,i),F=Kt(u,f,i),R=Kt(g,b,i),M=Kt($,E,i),X=Kt(v,P,i),G=Kt(E,F,i),Z=Kt(P,R,i);return je.isObject(r)?(r.x=l,r.y=h,r instanceof Ae&&(r.controls.left.x=M,r.controls.left.y=X,r.controls.right.x=G,r.controls.right.y=Z,(typeof r.relative!="boolean"||r.relative)&&(r.controls.left.x-=l,r.controls.left.y-=h,r.controls.right.x-=l,r.controls.right.y-=h)),r.t=i,r):(a=new Ae(l,h,M-l,X-h,G-l,Z-h,this._curved?me.curve:me.line),a.t=i,a)}plot(){if(this.curved)return t1(this._collection,this.closed),this;for(let i=0;i<this._collection.length;i++)this._collection[i].command=i===0?me.move:me.line;return this}smooth(i){const r=i||{},o=r.type||"continuous",s=this._collection,a=s.length;if(a<2)return this;const l=this._closed||a>0&&s[a-1]&&s[a-1].command===me.close,c=(p,m)=>{if(p==null)return m;if(typeof p=="number"){if(l)return Gt(p,a);let b=p;return b<0&&(b+=a),Math.min(Math.max(b,0),a-1)}const g=s.indexOf(p);return g!==-1?g:m},d=l&&r.from===void 0&&r.to===void 0;let u=c(r.from,0),f=c(r.to,a-1);if(u>f)if(l)u-=a;else{const p=u;u=f,f=p}const h=f-u+1;for(let p=0;p<h;p+=1){const m=Gt(u+p,a),g=s[m],b=!l&&m===0;g.command===me.move&&!b&&(g.command=me.line)}if(o==="continuous"||o==="asymmetric")N1(s,u,f,l,d,o==="asymmetric");else if(o==="catmull-rom"||o==="geometric"){const p={type:o,factor:r.factor};E1(s,u,f,l,d,p)}else throw new Error(`Path.smooth does not support type "${o}". Try 'continuous', 'asymmetric', 'catmull-rom', or 'geometric'.`);return this._automatic=!1,this._flagVertices=!0,this._flagLength=!0,this}subdivide(i){this._update();const r=this.vertices,o=r.length;if(o<2)return this;const s=[];let a=null,l=null;for(let c=0;c<o;c+=1){const d=r[c];if(!a||d.command===me.move){const f=d.clone();s.push(f),a=d,l=d;continue}if(S1(d,a)){const h=_a(d,a,i).length,p=s[s.length-1];let m=p.clone(),g=d.clone(),b=p,y=0;if(h<=1){const _=d.clone();s.push(_)}else{for(let x=1;x<h;x+=1){const w=x/h,C=1-y,N=C<=Number.EPSILON?w:(w-y)/C,k=B1(m,g,N);wn(b,"right",k.startOut.x-b.x,k.startOut.y-b.y);const $=k.anchor;s.push($),b=$,m=$.clone(),y=w,wn(g,"left",k.endIn.x-g.x,k.endIn.y-g.y)}const _=d.clone();_.controls.left.copy(g.controls.left),s.push(_)}}else{const f=_a(d,a,i);for(let p=1;p<f.length;p+=1){const m=f[p];au(m,a),Zt(m,"left"),Zt(m,"right"),m.command=me.line,s.push(m)}const h=d.clone();s.push(h)}a=d,d.command===me.close&&(a=l)}return this._automatic=!1,this._curved=!1,this.vertices=s,this}_updateLength(i,r){r||this._update();const s=this.vertices.length-1;let a=this.vertices[s],l=0;return typeof this._lengths>"u"&&(this._lengths=[]),je.each(this.vertices,function(c,d){if(d<=0||c.command===me.move){a=c,this._lengths[d]=0;return}this._lengths[d]=nu(c,a,i),l+=this._lengths[d],a=c},this),this._length=l,this._flagLength=!1,this}_update(){if(this._flagVertices){this._automatic&&this.plot(),this._flagLength&&this._updateLength(void 0,!0);const i=this._collection.length,r=this._closed,o=Math.min(this._beginning,this._ending),s=Math.max(this._beginning,this._ending),a=Wo(this,o*this._length),l=Wo(this,s*this._length),c=R1(a),d=P1(l);let u,f,h,p,m,g;for(this._renderer.vertices.length=0,g=0;g<i;g++)this._renderer.collection.length<=g&&this._renderer.collection.push(new Ae),g>d&&!f?(m=this._renderer.collection[g].copy(this._collection[g]),this.getPointAt(s,m),m.command=this._renderer.collection[g].command,this._renderer.vertices.push(m),f=m,h=this._collection[g-1],h&&h.controls&&(m.relative?m.controls.right.clear():m.controls.right.copy(m),h.relative?this._renderer.collection[g-1].controls.right.copy(h.controls.right).lerp(be.zero,1-m.t):this._renderer.collection[g-1].controls.right.copy(h.controls.right).lerp(h,1-m.t))):g>=c&&g<=d&&(m=this._renderer.collection[g].copy(this._collection[g]),this._renderer.vertices.push(m),g===d&&tu(this,s)?(f=m,!r&&f.controls&&(f.relative?f.controls.right.clear():f.controls.right.copy(f))):g===c&&tu(this,o)&&(u=m,u.command=me.move,!r&&u.controls&&(u.relative?u.controls.left.clear():u.controls.left.copy(u))));c>0&&!u&&(g=c-1,m=this._renderer.collection[g].copy(this._collection[g]),this.getPointAt(o,m),m.command=me.move,this._renderer.vertices.unshift(m),p=this._collection[g+1],p&&p.controls&&(m.controls.left.clear(),p.relative?this._renderer.collection[g+1].controls.left.copy(p.controls.left).lerp(be.zero,m.t):(F1.copy(p),this._renderer.collection[g+1].controls.left.copy(p.controls.left).lerp(p,m.t))))}return Fn.prototype._update.apply(this,arguments),this}flagReset(){return this._flagVertices=this._flagLength=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagCap=this._flagJoin=this._flagMiter=this._flagClip=this._flagStrokeAttenuation=!1,Fn.prototype.flagReset.call(this),this}};B(Cn,"Properties",["fill","stroke","linewidth","opacity","visible","cap","join","miter","closed","curved","automatic","beginning","ending","dashes","strokeAttenuation"]),B(Cn,"Utils",{getCurveLength:nu});let Oe=Cn;const cu={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(n){this._linewidth=n,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(n){this._opacity=n,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(n){this._visible=n,this._flagVisible=!0}},cap:{enumerable:!0,get:function(){return this._cap},set:function(n){this._cap=n,this._flagCap=!0}},join:{enumerable:!0,get:function(){return this._join},set:function(n){this._join=n,this._flagJoin=!0}},miter:{enumerable:!0,get:function(){return this._miter},set:function(n){this._miter=n,this._flagMiter=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(n){(this._fill instanceof gt||this._fill instanceof zt||this._fill instanceof Dt||this._fill instanceof nt)&&this._fill.unbind(te.Types.change,this._renderer.flagFill),this._fill=n,this._flagFill=!0,(this._fill instanceof gt||this._fill instanceof zt||this._fill instanceof Dt||this._fill instanceof nt)&&this._fill.bind(te.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(n){(this._stroke instanceof gt||this._stroke instanceof zt||this._stroke instanceof Dt||this._stroke instanceof nt)&&this._stroke.unbind(te.Types.change,this._renderer.flagStroke),this._stroke=n,this._flagStroke=!0,(this._stroke instanceof gt||this._stroke instanceof zt||this._stroke instanceof Dt||this._stroke instanceof nt)&&this._stroke.bind(te.Types.change,this._renderer.flagStroke)}},length:{get:function(){return this._flagLength&&this._updateLength(),this._length}},closed:{enumerable:!0,get:function(){return this._closed},set:function(n){this._closed=!!n,this._flagVertices=!0}},curved:{enumerable:!0,get:function(){return this._curved},set:function(n){this._curved=!!n,this._flagVertices=!0}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(n){if(n===this._automatic)return;this._automatic=!!n;const e=this._automatic?"ignore":"listen";je.each(this.vertices,function(i){i[e]()})}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(n){this._beginning=n,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(n){this._ending=n,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(n){const e=this._renderer.bindVertices,i=this._renderer.unbindVertices;this._collection&&this._collection.unbind(te.Types.insert,e).unbind(te.Types.remove,i),n instanceof Ti?this._collection=n:this._collection=new Ti(n||[]),this._collection.bind(te.Types.insert,e).bind(te.Types.remove,i),e(this._collection)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(n){this._mask=n,this._flagMask=!0,je.isObject(n)&&!n.clip&&(n.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(n){this._clip=n,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(n){typeof n.offset!="number"&&(n.offset=this.dashes&&this._dashes.offset||0),this._dashes=n}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(n){this._strokeAttenuation=!!n,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};function du(){this._flagVertices=!0,this._flagLength=!0,this.parent&&(this.parent._flagLength=!0)}function uu(n){let e=n.length;for(;e--;)n[e].bind(te.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function fu(n){let e=n.length;for(;e--;)n[e].unbind(te.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function hu(){this._flagFill=!0}function mu(){this._flagStroke=!0}const M1=Math.ceil,I1=Math.floor,Dn=class Dn extends Fn{constructor(i){super();B(this,"_flagVertices",!0);B(this,"_flagLength",!0);B(this,"_flagFill",!0);B(this,"_flagStroke",!0);B(this,"_flagLinewidth",!0);B(this,"_flagOpacity",!0);B(this,"_flagVisible",!0);B(this,"_flagSize",!0);B(this,"_flagSizeAttenuation",!0);B(this,"_flagStrokeAttenuation",!0);B(this,"_length",0);B(this,"_fill","#fff");B(this,"_stroke","#000");B(this,"_linewidth",1);B(this,"_opacity",1);B(this,"_visible",!0);B(this,"_size",1);B(this,"_sizeAttenuation",!1);B(this,"_beginning",0);B(this,"_ending",1);B(this,"_dashes",null);B(this,"_strokeAttenuation",!0);B(this,"noFill",Oe.prototype.noFill);B(this,"noStroke",Oe.prototype.noStroke);B(this,"corner",Oe.prototype.corner);B(this,"center",Oe.prototype.center);B(this,"getBoundingClientRect",Oe.prototype.getBoundingClientRect);B(this,"_updateLength",Oe.prototype._updateLength);for(let r in pu)Object.defineProperty(this,r,pu[r]);this._renderer.type="points",this._renderer.flagVertices=du.bind(this),this._renderer.bindVertices=uu.bind(this),this._renderer.unbindVertices=fu.bind(this),this._renderer.flagFill=hu.bind(this),this._renderer.flagStroke=mu.bind(this),this._renderer.vertices=null,this._renderer.collection=null,this.size=1,this.sizeAttenuation=!1,this.beginning=0,this.ending=1,this.fill="#fff",this.stroke="#000",this.linewidth=1,this.opacity=1,this.className="",this.visible=!0,this.vertices=i,this.dashes=[],this.dashes.offset=0}static fromObject(i){const r=typeof i.fill=="string"?i.fill:Ei(i.fill),o=typeof i.stroke=="string"?i.stroke:Ei(i.stroke),s=new Dn().copy({...i,fill:r,stroke:o});return"id"in i&&(s.id=i.id),s}copy(i){super.copy.call(this,i);for(let r=0;r<i.vertices.length;r++){const o=i.vertices[r];o instanceof Ae?this.vertices.push(i.vertices[r].clone()):this.vertices.push(new Ae().copy(o))}for(let r=0;r<Dn.Properties.length;r++){const o=Dn.Properties[r];o in i&&(this[o]=i[o])}return this}clone(i){const r=new Dn;for(let o=0;o<this.vertices.length;o++)r.vertices.push(this.vertices[o].clone());for(let o=0;o<Dn.Properties.length;o++){const s=Dn.Properties[o];r[s]=this[s]}return r.className=this.className,r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix),i&&i.add(r),r._update()}toObject(){const i=super.toObject.call(this);return i.renderer.type="points",i.vertices=this.vertices.map(r=>r.toObject()),je.each(Dn.Properties,function(r){typeof this[r]<"u"&&(this[r].toObject?i[r]=this[r].toObject():i[r]=this[r])},this),i}dispose(){if(super.dispose(),this.vertices&&typeof this.vertices.unbind=="function")try{this.vertices.unbind()}catch{}if(this.vertices)for(let i=0;i<this.vertices.length;i++){const r=this.vertices[i];typeof r.unbind=="function"&&r.unbind()}return typeof this.fill=="object"&&typeof this.fill.dispose=="function"?this.fill.dispose():typeof this.fill=="object"&&typeof this.fill.unbind=="function"&&this.fill.unbind(),typeof this.stroke=="object"&&typeof this.stroke.dispose=="function"?this.stroke.dispose():typeof this.stroke=="object"&&typeof this.stroke.unbind=="function"&&this.stroke.unbind(),this}subdivide(i){this._update();let r=[];for(let o=0;o<this.vertices.length;o++){const s=this.vertices[o],a=this.vertices[o-1];if(!a)continue;const l=s.x,c=s.y,d=a.x,u=a.y,f=Xd(l,c,l,c,d,u,d,u,i);r=r.concat(f)}return this.vertices=r,this}_update(){if(this._flagVertices){this._flagLength&&this._updateLength(void 0,!0);const i=Math.min(this._beginning,this._ending),r=Math.max(this._beginning,this._ending),o=Wo(this,i*this._length),s=Wo(this,r*this._length),a=M1(o),l=I1(s);let c=0,d;this._renderer.vertices=[],this._renderer.collection=[];for(let u=0;u<this._collection.length;u++)u>=a&&u<=l&&(d=this._collection[u],this._renderer.collection.push(d),this._renderer.vertices[c*2+0]=d.x,this._renderer.vertices[c*2+1]=d.y,c++)}return super._update.apply(this,arguments),this}flagReset(){return this._flagVertices=this._flagLength=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagSize=this._flagSizeAttenuation=!1,super.flagReset.call(this),this}};B(Dn,"Properties",["fill","stroke","linewidth","opacity","visible","size","sizeAttenuation","beginning","ending","dashes","strokeAttenuation"]);let Ko=Dn;const pu={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(n){this._linewidth=n,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(n){this._opacity=n,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(n){this._visible=n,this._flagVisible=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(n){this._size=n,this._flagSize=!0}},sizeAttenuation:{enumerable:!0,get:function(){return this._sizeAttenuation},set:function(n){this._sizeAttenuation=n,this._flagSizeAttenuation=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(n){(this._fill instanceof gt||this._fill instanceof zt||this._fill instanceof Dt||this._fill instanceof nt)&&this._fill.unbind(te.Types.change,this._renderer.flagFill),this._fill=n,this._flagFill=!0,(this._fill instanceof gt||this._fill instanceof zt||this._fill instanceof Dt||this._fill instanceof nt)&&this._fill.bind(te.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(n){(this._stroke instanceof gt||this._stroke instanceof zt||this._stroke instanceof Dt||this._stroke instanceof nt)&&this._stroke.unbind(te.Types.change,this._renderer.flagStroke),this._stroke=n,this._flagStroke=!0,(this._stroke instanceof gt||this._stroke instanceof zt||this._stroke instanceof Dt||this._stroke instanceof nt)&&this._stroke.bind(te.Types.change,this._renderer.flagStroke)}},length:{get:function(){return this._flagLength&&this._updateLength(),this._length}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(n){this._beginning=n,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(n){this._ending=n,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(n){const e=this._renderer.bindVertices,i=this._renderer.unbindVertices;this._collection&&this._collection.unbind(te.Types.insert,e).unbind(te.Types.remove,i),n instanceof Ti?this._collection=n:this._collection=new Ti(n||[]),this._collection.bind(te.Types.insert,e).bind(te.Types.remove,i),e(this._collection)}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(n){typeof n.offset!="number"&&(n.offset=this.dashes&&this._dashes.offset||0),this._dashes=n}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(n){this._strokeAttenuation=!!n,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};class gu extends Ti{constructor(i){i=Array.isArray(i)?i:Array.prototype.slice.call(arguments);super(i);Wl(this,Cs,{});this.attach(i),this.on(te.Types.insert,this.attach),this.on(te.Types.remove,this.detach)}get ids(){return qt(this,Cs)}attach(i){for(let r=0;r<i.length;r++){const o=i[r];o&&o.id&&(this.ids[o.id]=o)}return this}detach(i){for(let r=0;r<i.length;r++)delete this.ids[i[r].id];return this}}Cs=new WeakMap;const Qn=class Qn extends Oe{constructor(i,r,o,s,a,l,c){const d=c||Oo.Resolution*3,u=[];for(let f=0;f<d;f++)u.push(new Ae);super(u,!0,!1,!0);B(this,"_flagStartAngle",!1);B(this,"_flagEndAngle",!1);B(this,"_flagInnerRadius",!1);B(this,"_flagOuterRadius",!1);B(this,"_startAngle",0);B(this,"_endAngle",nn);B(this,"_innerRadius",0);B(this,"_outerRadius",0);this._renderer.type="arc-segment";for(let f in yu)Object.defineProperty(this,f,yu[f]);typeof o=="number"&&(this.innerRadius=o),typeof s=="number"&&(this.outerRadius=s),typeof a=="number"&&(this.startAngle=a),typeof l=="number"&&(this.endAngle=l),this._update(),typeof i=="number"&&(this.translation.x=i),typeof r=="number"&&(this.translation.y=r)}static fromObject(i){const r=new Qn().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<Qn.Properties.length;r++){const o=Qn.Properties[r];o in i&&typeof i[o]=="number"&&(this[o]=i[o])}return this}_update(){if(this._flagVertices||this._flagStartAngle||this._flagEndAngle||this._flagInnerRadius||this._flagOuterRadius){const i=this._startAngle,r=this._endAngle,o=this._innerRadius,s=this._outerRadius,a=Gt(i,nn)===Gt(r,nn),l=o>0,c=this.vertices;let d=l?c.length/2:c.length,u,f=0,h,p,m,g,b,y,_,x,w;for(a?d--:l||(d-=2),h=0,p=d-1;h<d;h++){switch(m=h/p,g=c[f],b=m*(r-i)+i,y=(r-i)/d,_=s*Math.cos(b),x=s*Math.sin(b),h){case 0:u=me.move;break;default:u=me.curve}g.command=u,g.x=_,g.y=x,g.controls.left.clear(),g.controls.right.clear(),g.command===me.curve&&(w=s*y/Math.PI,g.controls.left.x=w*Math.cos(b-kt),g.controls.left.y=w*Math.sin(b-kt),g.controls.right.x=w*Math.cos(b+kt),g.controls.right.y=w*Math.sin(b+kt),h===1&&g.controls.left.multiplyScalar(2),h===p&&g.controls.right.multiplyScalar(2)),f++}if(l){for(a?(c[f].command=me.close,f++):(d--,p=d-1),h=0;h<d;h++)m=h/p,g=c[f],b=(1-m)*(r-i)+i,y=(r-i)/d,_=o*Math.cos(b),x=o*Math.sin(b),u=me.curve,h<=0&&(u=a?me.move:me.line),g.command=u,g.x=_,g.y=x,g.controls.left.clear(),g.controls.right.clear(),g.command===me.curve&&(w=o*y/Math.PI,g.controls.left.x=w*Math.cos(b+kt),g.controls.left.y=w*Math.sin(b+kt),g.controls.right.x=w*Math.cos(b-kt),g.controls.right.y=w*Math.sin(b-kt),h===1&&g.controls.left.multiplyScalar(2),h===p&&g.controls.right.multiplyScalar(2)),f++;c[f].copy(c[0]),c[f].command=me.line}else a||(c[f].command=me.line,c[f].x=0,c[f].y=0,f++,c[f].copy(c[0]),c[f].command=me.line)}return super._update.call(this),this}flagReset(){return super.flagReset.call(this),this._flagStartAngle=this._flagEndAngle=this._flagInnerRadius=this._flagOuterRadius=!1,this}clone(i){const r=this.innerRadius,o=this.outerRadius,s=this.startAngle,a=this.endAngle,l=this.vertices.length,c=new Qn(0,0,r,o,s,a,l);c.translation.copy(this.translation),c.rotation=this.rotation,c.scale=this.scale,c.skewX=this.skewX,c.skewY=this.skewY,this.matrix.manual&&c.matrix.copy(this.matrix);for(let d=0;d<Oe.Properties.length;d++){const u=Oe.Properties[d];c[u]=this[u]}return i&&i.add(c),c}toObject(){const i=super.toObject.call(this);i.renderer.type="arc-segment";for(let r=0;r<Qn.Properties.length;r++){const o=Qn.Properties[r];i[o]=this[o]}return i}};B(Qn,"Properties",["startAngle","endAngle","innerRadius","outerRadius"]);let ka=Qn;const yu={startAngle:{enumerable:!0,get:function(){return this._startAngle},set:function(n){this._startAngle=n,this._flagStartAngle=!0}},endAngle:{enumerable:!0,get:function(){return this._endAngle},set:function(n){this._endAngle=n,this._flagEndAngle=!0}},innerRadius:{enumerable:!0,get:function(){return this._innerRadius},set:function(n){this._innerRadius=n,this._flagInnerRadius=!0}},outerRadius:{enumerable:!0,get:function(){return this._outerRadius},set:function(n){this._outerRadius=n,this._flagOuterRadius=!0}}},Ca=Math.cos,va=Math.sin,Jn=class Jn extends Oe{constructor(i,r,o,s){const a=s?Math.max(s,2):4,l=[];for(let c=0;c<a;c++)l.push(new Ae(0,0,0,0,0,0));super(l,!0,!0,!0);B(this,"_flagRadius",!1);B(this,"_radius",0);this._renderer.type="circle";for(let c in bu)Object.defineProperty(this,c,bu[c]);typeof o=="number"&&(this.radius=o),this._update(),typeof i=="number"&&(this.translation.x=i),typeof r=="number"&&(this.translation.y=r)}static fromObject(i){const r=new Jn().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<Jn.Properties.length;r++){const o=Jn.Properties[r];o in i&&typeof i[o]=="number"&&(this[o]=i[o])}return this}_update(){if(this._flagVertices||this._flagRadius){let i=this.vertices.length;!this._closed&&i>2&&(i-=1);const r=4/3*Math.tan(Math.PI/(i*2)),o=this._radius,s=o*r;for(let a=0;a<this.vertices.length;a++){const c=a/i*nn,d=o*Ca(c),u=o*va(c),f=s*Ca(c-kt),h=s*va(c-kt),p=s*Ca(c+kt),m=s*va(c+kt),g=this.vertices[a];g.command=a===0?me.move:me.curve,g.set(d,u),g.controls.left.set(f,h),g.controls.right.set(p,m)}}return super._update.call(this),this}flagReset(){return this._flagRadius=!1,super.flagReset.call(this),this}clone(i){const r=new Jn(0,0,this.radius,this.vertices.length);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix);for(let o=0;o<Oe.Properties.length;o++){const s=Oe.Properties[o];r[s]=this[s]}return i&&i.add(r),r}toObject(){const i=super.toObject.call(this);i.renderer.type="circle";for(let r=0;r<Jn.Properties.length;r++){const o=Jn.Properties[r];i[o]=this[o]}return i}};B(Jn,"Properties",["radius"]);let Sa=Jn;const bu={radius:{enumerable:!0,get:function(){return this._radius},set:function(n){this._radius=n,this._flagRadius=!0}}},Ba=Math.cos,Na=Math.sin,ei=class ei extends Oe{constructor(i,r,o,s,a){typeof s!="number"&&typeof o=="number"&&(s=o);const l=a?Math.max(a,2):4,c=[];for(let d=0;d<l;d++)c.push(new Ae);super(c,!0,!0,!0);B(this,"_flagWidth",!1);B(this,"_flagHeight",!1);B(this,"_width",0);B(this,"_height",0);this._renderer.type="ellipse";for(let d in _u)Object.defineProperty(this,d,_u[d]);typeof o=="number"&&(this.width=o*2),typeof s=="number"&&(this.height=s*2),this._update(),typeof i=="number"&&(this.translation.x=i),typeof r=="number"&&(this.translation.y=r)}static fromObject(i){const r=new ei().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<ei.Properties.length;r++){const o=ei.Properties[r];o in i&&typeof i[o]=="number"&&(this[o]=i[o])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){let i=this.vertices.length;!this._closed&&i>2&&(i-=1);const r=4/3*Math.tan(Math.PI/(this.vertices.length*2)),o=this._width/2,s=this._height/2;for(let a=0;a<this.vertices.length;a++){const c=a/i*nn,d=o*Ba(c),u=s*Na(c),f=o*r*Ba(c-kt),h=s*r*Na(c-kt),p=o*r*Ba(c+kt),m=s*r*Na(c+kt),g=this.vertices[a];g.command=a===0?me.move:me.curve,g.set(d,u),g.controls.left.set(f,h),g.controls.right.set(p,m)}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(i){const r=this.width/2,o=this.height/2,s=this.vertices.length,a=new ei(0,0,r,o,s);a.translation.copy(this.translation),a.rotation=this.rotation,a.scale=this.scale,a.skewX=this.skewX,a.skewY=this.skewY,this.matrix.manual&&a.matrix.copy(this.matrix);for(let l=0;l<Oe.Properties.length;l++){const c=Oe.Properties[l];a[c]=this[c]}return i&&i.add(a),a}toObject(){const i=super.toObject.call(this);i.renderer.type="ellipse";for(let r=0;r<ei.Properties.length;r++){const o=ei.Properties[r];i[o]=this[o]}return i}};B(ei,"Properties",["width","height"]);let Ta=ei;const _u={width:{enumerable:!0,get:function(){return this._width},set:function(n){this._width=n,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(n){this._height=n,this._flagHeight=!0}}},A1=Math.cos,O1=Math.sin,ti=class ti extends Oe{constructor(i,r,o,s){s=Math.max(s||0,3);super();B(this,"_flagWidth",!1);B(this,"_flagHeight",!1);B(this,"_flagSides",!1);B(this,"_radius",0);B(this,"_width",0);B(this,"_height",0);B(this,"_sides",0);this._renderer.type="polygon";for(let a in wu)Object.defineProperty(this,a,wu[a]);this.closed=!0,this.automatic=!1,typeof o=="number"&&(this.radius=o),typeof s=="number"&&(this.sides=s),this._update(),typeof i=="number"&&(this.translation.x=i),typeof r=="number"&&(this.translation.y=r)}static fromObject(i){const r=new ti().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<ti.Properties.length;r++){const o=ti.Properties[r];o in i&&typeof i[o]=="number"&&(this[o]=i[o])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagSides){const i=this._sides,r=i+1;let o=this.vertices.length;o>i&&(this.vertices.splice(i-1,o-i),o=i);for(let s=0;s<r;s++){const a=(s+.5)/i,l=nn*a+Math.PI/2,c=this._width*A1(l)/2,d=this._height*O1(l)/2;s>=o?this.vertices.push(new Ae(c,d)):this.vertices[s].set(c,d),this.vertices[s].command=s===0?me.move:me.line}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=this._flagSides=!1,super.flagReset.call(this),this}clone(i){const r=new ti(0,0,0,this.sides);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,r.width=this.width,r.height=this.height,this.matrix.manual&&r.matrix.copy(this.matrix);for(let o=0;o<Oe.Properties.length;o++){const s=Oe.Properties[o];r[s]=this[s]}return i&&i.add(r),r}toObject(){const i=super.toObject.call(this);i.renderer.type="polygon";for(let r=0;r<ti.Properties.length;r++){const o=ti.Properties[r];i[o]=this[o]}return i}};B(ti,"Properties",["width","height","sides"]);let $a=ti;const wu={radius:{enumerable:!0,get:function(){return this._radius},set:function(n){this._radius=n,this.width=n*2,this.height=n*2}},width:{enumerable:!0,get:function(){return this._width},set:function(n){this._width=n,this._flagWidth=!0,this._radius=Math.max(this.width,this.height)/2}},height:{enumerable:!0,get:function(){return this._height},set:function(n){this._height=n,this._flagHeight=!0,this._radius=Math.max(this.width,this.height)/2}},sides:{enumerable:!0,get:function(){return this._sides},set:function(n){this._sides=n,this._flagSides=!0}}},Xi=class Xi extends Oe{constructor(i,r,o,s){const a=[new Ae,new Ae,new Ae,new Ae];super(a,!0,!1,!0);B(this,"_flagWidth",!1);B(this,"_flagHeight",!1);B(this,"_width",0);B(this,"_height",0);B(this,"_origin",null);this._renderer.type="rectangle";for(let l in xu)Object.defineProperty(this,l,xu[l]);this.width=typeof o=="number"?o:1,this.height=typeof s=="number"?s:1,this.origin=new be,typeof i=="number"&&(this.translation.x=i),typeof r=="number"&&(this.translation.y=r),this._update()}static fromObject(i){const r=new Xi().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<Xi.Properties.length;r++){const o=Xi.Properties[r];o in i&&(typeof i[o]=="number"?this[o]=i[o]:this[o]instanceof be&&this[o].copy(i[o]))}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){const i=this._width/2,r=this._height/2;!this._closed&&this.vertices.length===4&&this.vertices.push(new Ae),this.vertices[0].set(-i,-r).sub(this._origin).command=me.move,this.vertices[1].set(i,-r).sub(this._origin).command=me.line,this.vertices[2].set(i,r).sub(this._origin).command=me.line,this.vertices[3].set(-i,r).sub(this._origin).command=me.line,this.vertices[4]&&(this.vertices[4].set(-i,-r).sub(this._origin).command=me.line)}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(i){const r=new Xi(0,0,this.width,this.height);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix);for(let o=0;o<Oe.Properties.length;o++){const s=Oe.Properties[o];r[s]instanceof be?r[s].copy(this[s]):r[s]=this[s]}return i&&i.add(r),r}toObject(){const i=super.toObject.call(this);return i.renderer.type="rectangle",i.width=this.width,i.height=this.height,i.origin=this.origin.toObject(),i}};B(Xi,"Properties",["width","height","origin"]);let zr=Xi;const xu={width:{enumerable:!0,get:function(){return this._width},set:function(n){this._width=n,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(n){this._height=n,this._flagHeight=!0}},origin:{enumerable:!0,get:function(){return this._origin},set:function(n){this._origin&&this._origin.unbind(te.Types.change,this._renderer.flagVertices),this._origin=n,this._origin.bind(te.Types.change,this._renderer.flagVertices),this._renderer.flagVertices()}}},ni=class ni extends Oe{constructor(i,r,o,s,a){typeof a>"u"&&typeof o=="number"&&typeof s=="number"&&(a=Math.floor(Math.min(o,s)/12));const l=[];for(let c=0;c<10;c++)l.push(new Ae(0,0,0,0,0,0,c===0?me.move:me.curve));super(l);B(this,"_flagWidth",!1);B(this,"_flagHeight",!1);B(this,"_flagRadius",!1);B(this,"_width",0);B(this,"_height",0);B(this,"_radius",12);this._renderer.type="rounded-rectangle";for(let c in ku)Object.defineProperty(this,c,ku[c]);this.closed=!0,this.automatic=!1,this._renderer.flagRadius=z1.bind(this),typeof o=="number"&&(this.width=o),typeof s=="number"&&(this.height=s),(typeof a=="number"||a instanceof be)&&(this.radius=a),this._update(),typeof i=="number"&&(this.translation.x=i),typeof r=="number"&&(this.translation.y=r)}static fromObject(i){const r=new ni().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<ni.Properties.length;r++){const o=ni.Properties[r];if(o in i){const s=i[o];/radius/i.test(o)?this[o]=typeof s=="number"||s instanceof be?s:new be().copy(s):typeof s=="number"&&(this[o]=s)}}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagRadius){const i=this._width,r=this._height;let o,s;this._radius instanceof be?(o=this._radius.x,s=this._radius.y):(o=this._radius,s=this._radius);let a,l=i/2,c=r/2;a=this.vertices[0],a.x=-(l-o),a.y=-c,a=this.vertices[1],a.x=l-o,a.y=-c,a.controls.left.clear(),a.controls.right.x=o,a.controls.right.y=0,a=this.vertices[2],a.x=l,a.y=-(c-s),a.controls.right.clear(),a.controls.left.clear(),a=this.vertices[3],a.x=l,a.y=c-s,a.controls.left.clear(),a.controls.right.x=0,a.controls.right.y=s,a=this.vertices[4],a.x=l-o,a.y=c,a.controls.right.clear(),a.controls.left.clear(),a=this.vertices[5],a.x=-(l-o),a.y=c,a.controls.left.clear(),a.controls.right.x=-o,a.controls.right.y=0,a=this.vertices[6],a.x=-l,a.y=c-s,a.controls.left.clear(),a.controls.right.clear(),a=this.vertices[7],a.x=-l,a.y=-(c-s),a.controls.left.clear(),a.controls.right.x=0,a.controls.right.y=-s,a=this.vertices[8],a.x=-(l-o),a.y=-c,a.controls.left.clear(),a.controls.right.clear(),a=this.vertices[9],a.copy(this.vertices[8])}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=this._flagRadius=!1,super.flagReset.call(this),this}clone(i){const r=this.width,o=this.height,s=this.radius,a=new ni(0,0,r,o,s);a.translation.copy(this.translation),a.rotation=this.rotation,a.scale=this.scale,a.skewX=this.skewX,a.skewY=this.skewY,this.matrix.manual&&a.matrix.copy(this.matrix);for(let l=0;l<Oe.Properties.length;l++){const c=Oe.Properties[l];a[c]=this[c]}return i&&i.add(a),a}toObject(){const i=super.toObject.call(this);i.renderer.type="rounded-rectangle";for(let r=0;r<ni.Properties.length;r++){const o=ni.Properties[r];i[o]=this[o]}return i.radius=typeof this.radius=="number"?this.radius:this.radius.toObject(),i}};B(ni,"Properties",["width","height","radius"]);let Ea=ni;const ku={width:{enumerable:!0,get:function(){return this._width},set:function(n){this._width=n,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(n){this._height=n,this._flagHeight=!0}},radius:{enumerable:!0,get:function(){return this._radius},set:function(n){this._radius instanceof be&&this._radius.unbind(te.Types.change,this._renderer.flagRadius),this._radius=n,this._radius instanceof be&&this._radius.bind(te.Types.change,this._renderer.flagRadius),this._flagRadius=!0}}};function z1(){this._flagRadius=!0}const D1=Math.cos,L1=Math.sin,ii=class ii extends Oe{constructor(i,r,o,s,a){arguments.length<=3&&(s=o,o=s/2),(typeof a!="number"||a<=0)&&(a=5);super();B(this,"_flagInnerRadius",!1);B(this,"_flagOuterRadius",!1);B(this,"_flagSides",!1);B(this,"_innerRadius",0);B(this,"_outerRadius",0);B(this,"_sides",0);this._renderer.type="star";for(let l in Cu)Object.defineProperty(this,l,Cu[l]);this.closed=!0,this.automatic=!1,typeof o=="number"&&(this.innerRadius=o),typeof s=="number"&&(this.outerRadius=s),typeof a=="number"&&(this.sides=a),this._update(),typeof i=="number"&&(this.translation.x=i),typeof r=="number"&&(this.translation.y=r)}static fromObject(i){const r=new ii().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<ii.Properties.length;r++){const o=ii.Properties[r];o in i&&typeof i[o]=="number"&&(this[o]=i[o])}return this}_update(){if(this._flagVertices||this._flagInnerRadius||this._flagOuterRadius||this._flagSides){const i=this._sides*2,r=i+1;let o=this.vertices.length;o>i&&(this.vertices.splice(i-1,o-i),o=i);for(let s=0;s<r;s++){const a=(s+.5)/i,l=nn*a,c=(s%2?this._outerRadius:this._innerRadius)/2,d=c*D1(l),u=c*L1(l);s>=o?this.vertices.push(new Ae(d,u)):this.vertices[s].set(d,u),this.vertices[s].command=s===0?me.move:me.line}}return super._update.call(this),this}flagReset(){return this._flagInnerRadius=this._flagOuterRadius=this._flagSides=!1,super.flagReset.call(this),this}clone(i){const r=this.innerRadius,o=this.outerRadius,s=this.sides,a=new ii(0,0,r,o,s);a.translation.copy(this.translation),a.rotation=this.rotation,a.scale=this.scale,a.skewX=this.skewX,a.skewY=this.skewY,this.matrix.manual&&a.matrix.copy(this.matrix);for(let l=0;l<Oe.Properties.length;l++){const c=Oe.Properties[l];a[c]=this[c]}return i&&i.add(a),a}toObject(){const i=super.toObject.call(this);i.renderer.type="star";for(let r=0;r<ii.Properties.length;r++){const o=ii.Properties[r];i[o]=this[o]}return i}};B(ii,"Properties",["innerRadius","outerRadius","sides"]);let Ra=ii;const Cu={innerRadius:{enumerable:!0,get:function(){return this._innerRadius},set:function(n){this._innerRadius=n,this._flagInnerRadius=!0}},outerRadius:{enumerable:!0,get:function(){return this._outerRadius},set:function(n){this._outerRadius=n,this._flagOuterRadius=!0}},sides:{enumerable:!0,get:function(){return this._sides},set:function(n){this._sides=n,this._flagSides=!0}}};let Pa;const vu=Math.min,Su=Math.max;Rn.document&&(Pa=document.createElement("canvas"));const Vt=class Vt extends Fn{constructor(i,r,o,s){super();B(this,"_flagValue",!0);B(this,"_flagFamily",!0);B(this,"_flagSize",!0);B(this,"_flagLeading",!0);B(this,"_flagAlignment",!0);B(this,"_flagBaseline",!0);B(this,"_flagStyle",!0);B(this,"_flagWeight",!0);B(this,"_flagDecoration",!0);B(this,"_flagFill",!0);B(this,"_flagStroke",!0);B(this,"_flagLinewidth",!0);B(this,"_flagOpacity",!0);B(this,"_flagVisible",!0);B(this,"_flagMask",!1);B(this,"_flagClip",!1);B(this,"_flagDirection",!0);B(this,"_flagStrokeAttenuation",!0);B(this,"_value","");B(this,"_family","sans-serif");B(this,"_size",13);B(this,"_leading",17);B(this,"_alignment","center");B(this,"_baseline","middle");B(this,"_style","normal");B(this,"_weight",500);B(this,"_decoration","none");B(this,"_direction","ltr");B(this,"_fill","#000");B(this,"_stroke","none");B(this,"_linewidth",1);B(this,"_opacity",1);B(this,"_visible",!0);B(this,"_mask",null);B(this,"_clip",!1);B(this,"_dashes",null);B(this,"_strokeAttenuation",!0);for(let a in Bu)Object.defineProperty(this,a,Bu[a]);if(this._renderer.type="text",this._renderer.flagFill=H1.bind(this),this._renderer.flagStroke=W1.bind(this),this.value=i,typeof r=="number"&&(this.translation.x=r),typeof o=="number"&&(this.translation.y=o),this.dashes=[],this.dashes.offset=0,!je.isObject(s))return this;for(let a=0;a<Vt.Properties.length;a++){const l=Vt.Properties[a];l in s&&(this[l]=s[l])}}static Measure(i){if(Pa){const r=Pa.getContext("2d");r.font=[i._style,i._weight,`${i._size}px/${i._leading}px`,i._family].join(" ");const o=r.measureText(i.value,0,0),s=o.actualBoundingBoxDescent+o.actualBoundingBoxAscent;return{width:o.width,height:s}}else{const r=this.value.length*this.size*Vt.Ratio,o=this.leading;return console.warn("Two.Text: unable to accurately measure text, so using an approximation."),{width:r,height:o}}}static fromObject(i){const r=typeof i.fill=="string"?i.fill:Ei(i.fill),o=typeof i.stroke=="string"?i.stroke:Ei(i.stroke),s=new Vt().copy({...i,fill:r,stroke:o});return"id"in i&&(s.id=i.id),s}copy(i){super.copy.call(this,i);for(let r=0;r<Vt.Properties.length;r++){const o=Vt.Properties[r];o in i&&(this[o]=i[o])}return this}clone(i){const r=new Vt(this.value);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale;for(let o=0;o<Vt.Properties.length;o++){const s=Vt.Properties[o];r[s]=this[s]}return this.matrix.manual&&r.matrix.copy(this.matrix),i&&i.add(r),r._update()}toObject(){const i=super.toObject.call(this);i.renderer.type="text";for(let r=0;r<Vt.Properties.length;r++){const o=Vt.Properties[r];i[o]=this[o]}return i}dispose(){return super.dispose(),typeof this.fill=="object"&&typeof this.fill.dispose=="function"?this.fill.dispose():typeof this.fill=="object"&&typeof this.fill.unbind=="function"&&this.fill.unbind(),typeof this.stroke=="object"&&typeof this.stroke.dispose=="function"?this.stroke.dispose():typeof this.stroke=="object"&&typeof this.stroke.unbind=="function"&&this.stroke.unbind(),this}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}getBoundingClientRect(i){let r,o,s,a,l;this._update(!0),r=i?this.matrix:this.worldMatrix;const{width:c,height:d}=Vt.Measure(this),u=(this._linewidth||0)/2;switch(this.alignment){case"left":o=-u,s=c+u;break;case"right":o=-(c+u),s=u;break;default:o=-(c/2+u),s=c/2+u}switch(this.baseline){case"middle":a=-(d/2+u),l=d/2+u;break;default:a=-(d+u),l=u}const[f,h]=r.multiply(o,a),[p,m]=r.multiply(o,l),[g,b]=r.multiply(s,a),[y,_]=r.multiply(s,l);return a=vu(h,m,b,_),o=vu(f,p,g,y),s=Su(f,p,g,y),l=Su(h,m,b,_),{top:a,left:o,right:s,bottom:l,width:s-o,height:l-a}}flagReset(){return super.flagReset.call(this),this._flagValue=this._flagFamily=this._flagSize=this._flagLeading=this._flagAlignment=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagClip=this._flagDecoration=this._flagClassName=this._flagBaseline=this._flagWeight=this._flagStyle=this._flagDirection=!1,this}};B(Vt,"Ratio",.6),B(Vt,"Properties",["value","family","size","leading","alignment","linewidth","style","weight","decoration","direction","baseline","opacity","visible","fill","stroke","dashes","strokeAttenuation"]);let gr=Vt;const Bu={value:{enumerable:!0,get:function(){return this._value},set:function(n){this._value=n,this._flagValue=!0}},family:{enumerable:!0,get:function(){return this._family},set:function(n){this._family=n,this._flagFamily=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(n){this._size=n,this._flagSize=!0}},leading:{enumerable:!0,get:function(){return this._leading},set:function(n){this._leading=n,this._flagLeading=!0}},alignment:{enumerable:!0,get:function(){return this._alignment},set:function(n){this._alignment=n,this._flagAlignment=!0}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(n){this._linewidth=n,this._flagLinewidth=!0}},style:{enumerable:!0,get:function(){return this._style},set:function(n){this._style=n,this._flagStyle=!0}},weight:{enumerable:!0,get:function(){return this._weight},set:function(n){this._weight=n,this._flagWeight=!0}},decoration:{enumerable:!0,get:function(){return this._decoration},set:function(n){this._decoration=n,this._flagDecoration=!0}},direction:{enumerable:!0,get:function(){return this._direction},set:function(n){this._direction=n,this._flagDirection=!0}},baseline:{enumerable:!0,get:function(){return this._baseline},set:function(n){this._baseline=n,this._flagBaseline=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(n){this._opacity=n,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(n){this._visible=n,this._flagVisible=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(n){(this._fill instanceof gt||this._fill instanceof zt||this._fill instanceof Dt||this._fill instanceof nt)&&this._fill.unbind(te.Types.change,this._renderer.flagFill),this._fill=n,this._flagFill=!0,(this._fill instanceof gt||this._fill instanceof zt||this._fill instanceof Dt||this._fill instanceof nt)&&this._fill.bind(te.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(n){(this._stroke instanceof gt||this._stroke instanceof zt||this._stroke instanceof Dt||this._stroke instanceof nt)&&this._stroke.unbind(te.Types.change,this._renderer.flagStroke),this._stroke=n,this._flagStroke=!0,(this._stroke instanceof gt||this._stroke instanceof zt||this._stroke instanceof Dt||this._stroke instanceof nt)&&this._stroke.bind(te.Types.change,this._renderer.flagStroke)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(n){this._mask=n,this._flagMask=!0,je.isObject(n)&&!n.clip&&(n.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(n){this._clip=n,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(n){typeof n.offset!="number"&&(n.offset=this.dashes&&this._dashes.offset||0),this._dashes=n}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(n){this._strokeAttenuation=!!n,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};function H1(){this._flagFill=!0}function W1(){this._flagStroke=!0}const ri=class ri extends zr{constructor(i,r,o,s){super(r,o,0,0);B(this,"_flagTextures",!1);B(this,"_flagFrameRate",!1);B(this,"_flagIndex",!1);B(this,"_amount",1);B(this,"_duration",0);B(this,"_index",0);B(this,"_startTime",0);B(this,"_playing",!1);B(this,"_firstFrame",0);B(this,"_lastFrame",0);B(this,"_loop",!0);B(this,"_textures",null);B(this,"_frameRate",0);B(this,"_origin",null);this._renderer.type="image-sequence";for(let a in Nu)Object.defineProperty(this,a,Nu[a]);this._renderer.flagTextures=j1.bind(this),this._renderer.bindTextures=q1.bind(this),this._renderer.unbindTextures=X1.bind(this),this.noStroke(),this.noFill(),Array.isArray(i)?this.textures=i.map(Tu.bind(this)):typeof i=="string"&&(this.textures=[Tu(i)]),this.origin=new be,this._update(),typeof s=="number"?this.frameRate=s:this.frameRate=ri.DefaultFrameRate,this.index=0}static fromObject(i){const r=new ri().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<ri.Properties.length;r++){const o=ri.Properties[r];o in i&&(this[o]=i[o])}return this}play(i,r,o){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=je.performance.now(),typeof i=="number"&&(this._firstFrame=i),typeof r=="number"&&(this._lastFrame=r),typeof o=="function"?this._onLastFrame=o:delete this._onLastFrame,this._index!==this._firstFrame&&(this._startTime-=1e3*Math.abs(this._index-this._firstFrame)/this._frameRate),this}pause(){return this._playing=!1,this}stop(){return this._playing=!1,this._index=this._firstFrame,this}clone(i){const r=new ri(this.textures,this.translation.x,this.translation.y,this.frameRate);return r._loop=this._loop,this._playing&&r.play(),i&&i.add(r),r}toObject(){const i=super.toObject.call(this);return i.renderer.type="image-sequence",i.textures=this.textures.map(function(r){return r.toObject()}),i.frameRate=this.frameRate,i.index=this.index,i.firstFrame=this.firstFrame,i.lastFrame=this.lastFrame,i.loop=this.loop,i}dispose(){if(super.dispose(),this._playing&&(this._playing=!1),this._onLastFrame=null,this.textures&&typeof this.textures.unbind=="function")try{this.textures.unbind()}catch{}if(this.textures)for(let i=0;i<this.textures.length;i++){const r=this.textures[i];typeof r.dispose=="function"?r.dispose():typeof r.unbind=="function"&&r.unbind()}return this}_update(){const i=this._textures;let r,o,s,a,l,c,d,u;return i&&(this._flagTextures&&(this._amount=i.length),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._playing&&this._frameRate>0?(a=this._amount,je.isNaN(this._lastFrame)&&(this._lastFrame=a-1),s=je.performance.now()-this._startTime,u=this._lastFrame+1,l=1e3*(u-this._firstFrame)/this._frameRate,this._loop?s=s%l:s=Math.min(s,l),d=Kt(this._firstFrame,u,s/l),d=Math.floor(d),d!==this._index&&(this._index=d,c=i[this._index],c.loaded&&(r=c.image.width,o=c.image.height,this.width!==r&&(this.width=r),this.height!==o&&(this.height=o),this.fill=c,d>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()))):(this._flagIndex||!(this.fill instanceof nt))&&(c=i[this._index],c.loaded&&(r=c.image.width,o=c.image.height,this.width!==r&&(this.width=r),this.height!==o&&(this.height=o)),this.fill=c)),super._update.call(this),this}flagReset(){return this._flagTextures=this._flagFrameRate=!1,super.flagReset.call(this),this}};B(ri,"Properties",["textures","frameRate","index","firstFrame","lastFrame","loop"]),B(ri,"DefaultFrameRate",30);let Fa=ri;const Nu={frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(n){this._frameRate=n,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(n){this._index=n,this._flagIndex=!0}},textures:{enumerable:!0,get:function(){return this._textures},set:function(n){const e=this._renderer.bindTextures,i=this._renderer.unbindTextures;this._textures&&this._textures.unbind(te.Types.insert,e).unbind(te.Types.remove,i),this._textures=new Ti((n||[]).slice(0)),this._textures.bind(te.Types.insert,e).bind(te.Types.remove,i),e(this._textures)}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(n){this._firstFrame=n}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(n){this._lastFrame=n}},loop:{enumerable:!0,get:function(){return this._loop},set:function(n){this._loop=!!n}}};function j1(){this._flagTextures=!0}function q1(n){let e=n.length;for(;e--;)n[e].bind(te.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function X1(n){let e=n.length;for(;e--;)n[e].unbind(te.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function Tu(n){if(n instanceof nt)return n;if(typeof n=="string")return new nt(n)}const Yi=class Yi extends zr{constructor(i,r,o,s,a,l){super(r,o,0,0);B(this,"_flagTexture",!1);B(this,"_flagColumns",!1);B(this,"_flagRows",!1);B(this,"_flagFrameRate",!1);B(this,"_flagIndex",!1);B(this,"_amount",1);B(this,"_duration",0);B(this,"_startTime",0);B(this,"_playing",!1);B(this,"_firstFrame",0);B(this,"_lastFrame",0);B(this,"_loop",!0);B(this,"_texture",null);B(this,"_columns",1);B(this,"_rows",1);B(this,"_frameRate",0);B(this,"_index",0);B(this,"_origin",null);this._renderer.type="sprite";for(let c in $u)Object.defineProperty(this,c,$u[c]);this.noStroke(),this.noFill(),i instanceof nt?this.texture=i:typeof i=="string"&&(this.texture=new nt(i)),this.origin=new be,this._update(),typeof s=="number"&&(this.columns=s),typeof a=="number"&&(this.rows=a),typeof l=="number"&&(this.frameRate=l),this.index=0}static fromObject(i){const r=new Yi().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<Yi.Properties.length;r++){const o=Yi.Properties[r];o in i&&(this[o]=i[o])}return this}play(i,r,o){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=je.performance.now(),typeof i=="number"&&(this._firstFrame=i),typeof r=="number"&&(this._lastFrame=r),typeof o=="function"?this._onLastFrame=o:delete this._onLastFrame,this._index!==this._firstFrame&&(this._startTime-=1e3*Math.abs(this._index-this._firstFrame)/this._frameRate),this}pause(){return this._playing=!1,this}stop(){return this._playing=!1,this._index=0,this}clone(i){const r=new Yi(this.texture,this.translation.x,this.translation.y,this.columns,this.rows,this.frameRate);return this.playing&&r.play(this._firstFrame,this._lastFrame),r.loop=this.loop,r.firstFrame=this.firstFrame,r.lastFrame=this.lastFrame,i&&i.add(r),r}toObject(){const i=super.toObject.call(this);return i.renderer.type="sprite",i.texture=this.texture.toObject(),i.columns=this.columns,i.rows=this.rows,i.frameRate=this.frameRate,i.index=this.index,i.firstFrame=this.firstFrame,i.lastFrame=this.lastFrame,i.loop=this.loop,i}dispose(){return super.dispose(),this._playing&&(this._playing=!1),this._onLastFrame=null,this._startTime=0,this._texture&&typeof this._texture.dispose=="function"?this._texture.dispose():this._texture&&typeof this._texture.unbind=="function"&&this._texture.unbind(),this}_update(){const i=this._texture,r=this._columns,o=this._rows;let s,a,l,c,d,u,f,h,p;if(i&&((this._flagColumns||this._flagRows)&&(this._amount=this._columns*this._rows),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._flagTexture&&(this.fill=i),i.loaded)){f=i.image.width,h=i.image.height,s=f/r,a=h/o,c=this._amount,this.width!==s&&(this.width=s),this.height!==a&&(this.height=a),this._playing&&this._frameRate>0&&(je.isNaN(this._lastFrame)&&(this._lastFrame=c-1),l=je.performance.now()-this._startTime,p=this._lastFrame+1,d=1e3*(p-this._firstFrame)/this._frameRate,this._loop?l=l%d:l=Math.min(l,d),u=Kt(this._firstFrame,p,l/d),u=Math.floor(u),u!==this._index&&(this._index=u,u>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()));const m=this._index%r,g=Math.floor(this._index/r),b=-s*m+(f-s)/2,y=-a*g+(h-a)/2;b!==i.offset.x&&(i.offset.x=b),y!==i.offset.y&&(i.offset.y=y)}return super._update.call(this),this}flagReset(){return this._flagTexture=this._flagColumns=this._flagRows=this._flagFrameRate=!1,super.flagReset.call(this),this}};B(Yi,"Properties",["texture","columns","rows","frameRate","index","firstFrame","lastFrame","loop"]);let Va=Yi;const $u={texture:{enumerable:!0,get:function(){return this._texture},set:function(n){this._texture=n,this._flagTexture=!0}},columns:{enumerable:!0,get:function(){return this._columns},set:function(n){this._columns=n,this._flagColumns=!0}},rows:{enumerable:!0,get:function(){return this._rows},set:function(n){this._rows=n,this._flagRows=!0}},frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(n){this._frameRate=n,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(n){this._index=n,this._flagIndex=!0}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(n){this._firstFrame=n}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(n){this._lastFrame=n}},loop:{enumerable:!0,get:function(){return this._loop},set:function(n){this._loop=!!n}}},Go=Math.min,Zo=Math.max,Y1={getShapesAtPoint:{results:[],hitOptions:{},context:{x:0,y:0,visibleOnly:!0,results:null},single:[],empty:[]}},Wt=class Wt extends Fn{constructor(i){super();B(this,"_flagAdditions",!1);B(this,"_flagSubtractions",!1);B(this,"_flagOrder",!1);B(this,"_flagOpacity",!0);B(this,"_flagBeginning",!1);B(this,"_flagEnding",!1);B(this,"_flagLength",!1);B(this,"_flagMask",!1);B(this,"_fill","#fff");B(this,"_stroke","#000");B(this,"_linewidth",1);B(this,"_opacity",1);B(this,"_visible",!0);B(this,"_cap","round");B(this,"_join","round");B(this,"_miter",4);B(this,"_closed",!0);B(this,"_curved",!1);B(this,"_automatic",!0);B(this,"_beginning",0);B(this,"_ending",1);B(this,"_length",0);B(this,"_mask",null);B(this,"_strokeAttenuation",!0);for(let r in Eu)Object.defineProperty(this,r,Eu[r]);this._renderer.type="group",this.additions=[],this.subtractions=[],this.children=Array.isArray(i)?i:Array.prototype.slice.call(arguments)}static InsertChildren(i){for(let r=0;r<i.length;r++)Ru.call(this,i[r],this)}static RemoveChildren(i){for(let r=0;r<i.length;r++)Ru.call(this,i[r])}static OrderChildren(i){this._flagOrder=!0}static fromObject(i){const r=new Wt;for(let s=0;s<Wt.Properties.length;s++){const a=Wt.Properties[s];a in i&&(/(fill|stroke)/i.test(a)?r[a]=typeof i[a]=="string"?i[a]:Ei(i[a]):r[a]=i[a])}return"mask"in i&&(r.mask=o(i.mask)),"id"in i&&(r.id=i.id),r.children=i.children.map(o),r;function o(s){if(s&&s.renderer)switch(s.renderer.type){case"arc-segment":return ka.fromObject(s);case"circle":return Sa.fromObject(s);case"element":return Or.fromObject(s);case"ellipse":return Ta.fromObject(s);case"group":return Wt.fromObject(s);case"image":return Image.fromObject(s);case"image-sequence":return Fa.fromObject(s);case"path":return Oe.fromObject(s);case"points":return Ko.fromObject(s);case"polygon":return $a.fromObject(s);case"rectangle":return zr.fromObject(s);case"rounded-rectangle":return Ea.fromObject(s);case"shape":return Fn.fromObject(s);case"sprite":return Va.fromObject(s);case"star":return Ra.fromObject(s);case"text":return gr.fromObject(s)}return s}}static IsVisible(i,r){if(!r)return!0;let o=i;for(;o;){if(typeof o.visible=="boolean"&&!o.visible||typeof o.opacity=="number"&&o.opacity<=0)return!1;o=o.parent}return!0}static VisitForHitTest(i,r,o,s,a,l,c){const d=i&&i.children;if(!d)return!1;const u=r.results;for(let f=d.length-1;f>=0;f--){const h=d[f];if(!h||!Wt.IsVisible(h,r.visibleOnly))continue;const p=typeof h.getBoundingClientRect=="function"?h.getBoundingClientRect():null;if(!(p&&!C1(p,r.x,r.y,l))){if(h instanceof Wt){if(o&&(!s||s(h))&&typeof h.contains=="function"&&h.contains(r.x,r.y,a)&&(u.push(h),c)||Wt.VisitForHitTest(h,r,o,s,a,l,c))return!0;continue}if(h instanceof Fn&&!(s&&!s(h))&&typeof h.contains=="function"&&h.contains(r.x,r.y,a)&&(u.push(h),c))return!0}}return!1}copy(i){super.copy.call(this,i),console.warn("Two.js: attempting to copy group. Two.Group.children copying not supported.");for(let r=0;r<Wt.Properties.length;r++){const o=Wt.Properties[r];o in i&&(this[o]=i[o])}return this}clone(i){const r=new Wt,o=this.children.map(function(s){return s.clone()});return r.add(o),r.opacity=this.opacity,this.mask&&(r.mask=this.mask),r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.className=this.className,this.matrix.manual&&r.matrix.copy(this.matrix),i&&i.add(r),r._update()}toObject(){const i=super.toObject.call(this);return i.renderer.type="group",i.children=[],i.opacity=this.opacity,i.className=this.className,i.mask=this.mask?this.mask.toObject():null,je.each(this.children,(r,o)=>{i.children[o]=r.toObject()},this),i}dispose(){if(super.dispose(),this.children)for(let i=0;i<this.children.length;i++){const r=this.children[i];typeof r.dispose=="function"&&r.dispose()}if(this.children&&typeof this.children.unbind=="function")try{this.children.unbind()}catch{}return this}getShapesAtPoint(i,r,o){const s=o||{},{results:a,hitOptions:l,context:c,single:d,empty:u}=Y1.getShapesAtPoint;a.length=0;const f=s.mode==="deepest"||s.deepest?"deepest":"all",h=s.visibleOnly!==!1,p=!!s.includeGroups,m=typeof s.filter=="function"?s.filter:null,g=typeof s.tolerance=="number"?s.tolerance:0;typeof s.precision=="number"?l.precision=s.precision:delete l.precision,typeof s.fill<"u"?l.fill=s.fill:delete l.fill,typeof s.stroke<"u"?l.stroke=s.stroke:delete l.stroke,l.tolerance=g,l.ignoreVisibility=!h;const b=f==="deepest";if(c.x=i,c.y=r,c.visibleOnly=h,c.results=a,Wt.VisitForHitTest(this,c,p,m,l,g,b),b){if(a.length>0){const _=a[0];return a.length=0,d[0]=_,d.length=1,d}return u.length=0,u}const y=a.slice();return a.length=0,y}corner(){const i=this.getBoundingClientRect(!0);for(let r=0;r<this.children.length;r++){const o=this.children[r];o.translation.x-=i.left,o.translation.y-=i.top}return this.mask&&(this.mask.translation.x-=i.left,this.mask.translation.y-=i.top),this}center(){const i=this.getBoundingClientRect(!0),r=i.left+i.width/2-this.translation.x,o=i.top+i.height/2-this.translation.y;for(let s=0;s<this.children.length;s++){const a=this.children[s];a.isShape&&(a.translation.x-=r,a.translation.y-=o)}return this.mask&&(this.mask.translation.x-=r,this.mask.translation.y-=o),this}getById(i){let r=null;function o(s){if(s.id===i)return s;if(s.children){if(s.children.ids[i])return s.children.ids[i];for(let a=0;a<s.children.length;a++)if(r=o(s.children[a]),r)return r}return null}return o(this)}getByClassName(i){const r=[];function o(s){if(Array.prototype.indexOf.call(s.classList,i)>=0&&r.push(s),s.children)for(let a=0;a<s.children.length;a++){const l=s.children[a];o(l)}return r}return o(this)}getByType(i){const r=[];function o(s){if(s instanceof i&&r.push(s),s.children)for(let a=0;a<s.children.length;a++){const l=s.children[a];o(l)}return r}return o(this)}add(i){i instanceof Array?i=i.slice():i=Array.prototype.slice.call(arguments);for(let r=0;r<i.length;r++){const o=i[r];if(!(o&&o.id))continue;const s=Array.prototype.indexOf.call(this.children,o);s>=0&&this.children.splice(s,1),this.children.push(o)}return this}remove(i){const r=arguments.length,o=this.parent;if(r<=0&&o)return o.remove(this),this;i instanceof Array?i=i.slice():i=Array.prototype.slice.call(arguments);for(let s=0;s<i.length;s++){const a=i[s];if(!a||!this.children.ids[a.id])continue;const l=this.children.indexOf(a);l>=0&&this.children.splice(l,1)}return this}getBoundingClientRect(i){let r,o,s,a,l,c;this._update(!0);let d=1/0,u=-1/0,f=1/0,h=-1/0;const p=/texture|gradient/i;o=i?this.matrix:this.worldMatrix;for(let m=0;m<this.children.length;m++){const g=this.children[m];if(!(!g.visible||p.test(g._renderer.type))&&(r=g.getBoundingClientRect(i),s=typeof r.top!="number"||je.isNaN(r.top)||!isFinite(r.top),a=typeof r.left!="number"||je.isNaN(r.left)||!isFinite(r.left),l=typeof r.right!="number"||je.isNaN(r.right)||!isFinite(r.right),c=typeof r.bottom!="number"||je.isNaN(r.bottom)||!isFinite(r.bottom),!(s||a||l||c)))if(i){const[b,y]=o.multiply(r.left,r.top),[_,x]=o.multiply(r.right,r.top),[w,C]=o.multiply(r.left,r.bottom),[N,k]=o.multiply(r.right,r.bottom);f=Go(y,x,C,k,f),d=Go(b,_,w,N,d),u=Zo(b,_,w,N,u),h=Zo(y,x,C,k,h)}else f=Go(r.top,f),d=Go(r.left,d),u=Zo(r.right,u),h=Zo(r.bottom,h)}return{top:f,left:d,right:u,bottom:h,width:u-d,height:h-f}}noFill(){return this.children.forEach(function(i){i.noFill()}),this}noStroke(){return this.children.forEach(function(i){i.noStroke()}),this}subdivide(){const i=arguments;return this.children.forEach(function(r){r.subdivide.apply(r,i)}),this}_update(){let i,r,o;if(this._flagBeginning||this._flagEnding){const s=Math.min(this._beginning,this._ending),a=Math.max(this._beginning,this._ending),l=this.length;let c=0;const d=s*l,u=a*l;for(i=0;i<this.children.length;i++)o=this.children[i],r=o.length,d>c+r?(o.beginning=1,o.ending=1):u<c?(o.beginning=0,o.ending=0):d>c&&d<c+r?(o.beginning=(d-c)/r,o.ending=1):u>c&&u<c+r?(o.beginning=0,o.ending=(u-c)/r):(o.beginning=0,o.ending=1),c+=r}return super._update.apply(this,arguments)}flagReset(){return this._flagAdditions&&(this.additions.length=0,this._flagAdditions=!1),this._flagSubtractions&&(this.subtractions.length=0,this._flagSubtractions=!1),this._flagOrder=this._flagMask=this._flagOpacity=this._flagBeginning=this._flagEnding=!1,super.flagReset.call(this),this}};B(Wt,"Children",gu),B(Wt,"Properties",["fill","stroke","linewidth","cap","join","miter","closed","curved","automatic"]);let Un=Wt;const Eu={visible:{enumerable:!0,get:function(){return this._visible},set:function(n){this._flagVisible=this._visible!==n||this._flagVisible,this._visible=n}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(n){this._flagOpacity=this._opacity!==n||this._flagOpacity,this._opacity=n}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(n){this._flagBeginning=this._beginning!==n||this._flagBeginning,this._beginning=n}},ending:{enumerable:!0,get:function(){return this._ending},set:function(n){this._flagEnding=this._ending!==n||this._flagEnding,this._ending=n}},length:{enumerable:!0,get:function(){if(this._flagLength||this._length<=0){if(this._length=0,!this.children)return this._length;for(let n=0;n<this.children.length;n++){const e=this.children[n];this._length+=e.length}}return this._length}},fill:{enumerable:!0,get:function(){return this._fill},set:function(n){this._fill=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.fill=n}}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(n){this._stroke=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.stroke=n}}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(n){this._linewidth=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.linewidth=n}}},join:{enumerable:!0,get:function(){return this._join},set:function(n){this._join=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.join=n}}},miter:{enumerable:!0,get:function(){return this._miter},set:function(n){this._miter=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.miter=n}}},cap:{enumerable:!0,get:function(){return this._cap},set:function(n){this._cap=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.cap=n}}},closed:{enumerable:!0,get:function(){return this._closed},set:function(n){this._closed=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.closed=n}}},curved:{enumerable:!0,get:function(){return this._curved},set:function(n){this._curved=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.curved=n}}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(n){this._automatic=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.automatic=n}}},children:{enumerable:!0,get:function(){return this._children},set:function(n){const e=Un.InsertChildren.bind(this),i=Un.RemoveChildren.bind(this),r=Un.OrderChildren.bind(this);this._children&&(this._children.unbind(),this._children.length>0&&i(this._children)),this._children=new gu(n),this._children.bind(te.Types.insert,e),this._children.bind(te.Types.remove,i),this._children.bind(te.Types.order,r),n.length>0&&e(n)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(n){this._mask=n,this._flagMask=!0,je.isObject(n)&&!n.clip&&(n.clip=!0)}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(n){this._strokeAttenuation=!!n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.strokeAttenuation!==void 0&&(i.strokeAttenuation=n)}}}};function Ru(n,e){const i=n.parent;let r;if(i===e){o();return}if(i&&i.children.ids[n.id]&&(r=Array.prototype.indexOf.call(i.children,n),i.children.splice(r,1),s()),e){o();return}s(),i._flagAdditions&&i.additions.length===0&&(i._flagAdditions=!1),i._flagSubtractions&&i.subtractions.length===0&&(i._flagSubtractions=!1),delete n.parent;function o(){e.subtractions.length>0&&(r=Array.prototype.indexOf.call(e.subtractions,n),r>=0&&e.subtractions.splice(r,1)),e.additions.length>0&&(r=Array.prototype.indexOf.call(e.additions,n),r>=0&&e.additions.splice(r,1)),n.parent=e,e.additions.push(n),e._flagAdditions=!0}function s(){r=Array.prototype.indexOf.call(i.additions,n),r>=0&&i.additions.splice(r,1),r=Array.prototype.indexOf.call(i.subtractions,n),r<0&&(i.subtractions.push(n),i._flagSubtractions=!0)}}class Qo extends Oe{constructor(e,i,r,o){const s=[new Ae(e,i),new Ae(r,o)];super(s);for(let a in Pu)Object.defineProperty(this,a,Pu[a]);this.vertices[0].command=me.move,this.vertices[1].command=me.line,this.automatic=!1}}B(Qo,"Properties",["left","right"]);const Pu={left:{enumerable:!0,get:function(){return this.vertices[0]},set:function(n){if(je.isObject(n))this.vertices.splice(0,1,n),this.vertices[0].command=me.move;else{const e=new Lo("Two.Line.left argument is not an object.");console.warn(e.name,e.message)}}},right:{enumerable:!0,get:function(){return this.vertices[1]},set:function(n){if(je.isObject(n))this.vertices.splice(1,1,n),this.vertices[1].command=me.line;else{const e=new Lo("Two.Line.right argument is not an object.");console.warn(e.name,e.message)}}}};class Ma{constructor(e=0,i=0){this.x=e,this.y=i}}class Vn{constructor(e=10,i=0,r="A"){B(this,"start",new Ma);B(this,"end",new Ma);this.width=e,this.angle=i,this.label=r}}const Ke={line:{color:"#000",size:5},previewLine:{color:"#000",size:2},anchorPoint:{color:"#FF8000",size:12,strokeSize:20},lineLabel:{color:"#FF8000",size:22,rotation:-.5},angleLabel:{size:22,color:"#088c00",rotation:-.5},colorSideLabel:{size:20,color:"#439227"}},U1={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function K1(n,e){return t.openBlock(),t.createElementBlock("svg",U1,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"m289.94 256l95-95A24 24 0 0 0 351 127l-95 95l-95-95a24 24 0 0 0-34 34l95 95l-95 95a24 24 0 1 0 34 34l95-95l95 95a24 24 0 0 0 34-34Z"},null,-1)])])}const Jo=t.markRaw({name:"ion-close",render:K1}),G1={class:"mr-3 flex flex-col gap-2"},Z1=["onClick"],Q1={class:"h-full p-2"},J1={},eb=t.defineComponent({...J1,__name:"kozyrek-configurator-templates",props:{settings:{},selectTemplateIndex:{}},emits:["template:select","init-draw-template","remove-custom-template"],setup(n,{emit:e}){const i=n,r=t.ref(!1),o=t.useTemplateRef("drawing-template-containers"),s=t.useTemplateRef("drawing-custom-template-containers"),a=e,l=c=>{r.value=!0,a("remove-custom-template",c,()=>{r.value=!1})};return t.onMounted(()=>{var c,d;(c=i.settings.templates)==null||c.forEach((u,f)=>{var p;const h=(p=o.value)==null?void 0:p.at(f);h&&a("init-draw-template",h,u)}),(d=i.settings.customTemplates)==null||d.forEach((u,f)=>{var p;const h=(p=s.value)==null?void 0:p.at(f);h&&a("init-draw-template",h,u)})}),t.watch(()=>[...i.settings.customTemplates],(c,d)=>{t.nextTick(()=>{c.forEach((u,f)=>{var h;if(!(d!=null&&d.includes(u))){const p=(h=s.value)==null?void 0:h.at(f);p&&a("init-draw-template",p,u)}}),d.length>c.length&&d.forEach((u,f)=>{var p;const h=(p=s.value)==null?void 0:p.at(f);h&&(h.innerHTML="",a("init-draw-template",h,u))})})},{deep:!0}),(c,d)=>{const u=Jo;return t.openBlock(),t.createBlock(t.unref(I.NScrollbar),{style:{width:"auto"},trigger:"none",class:"max-h-[19rem] md:max-h-[40rem] w-auto"},{default:t.withCtx(()=>[t.createElementVNode("div",G1,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.settings.allTemplates,(f,h)=>(t.openBlock(),t.createElementBlock("div",{key:`${f.id}-${h}`,class:"group relative"},[t.createVNode(t.unref(I.NPopover),{trigger:"hover",placement:"right"},{trigger:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["relative h-10 w-24 shrink-0 rounded-md border-2 border-solid border-slate-200",{"!border-green-700":h===n.selectTemplateIndex}]),onClick:p=>a("template:select",h)},[t.createElementVNode("div",Q1,[t.createElementVNode("div",{ref_for:!0,ref:f.isCustom&&f.id!==-1?"drawing-custom-template-containers":"drawing-template-containers",class:"kozyrek-preview h-full"},null,512)])],10,Z1)]),default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(f.label),1)]),_:2},1024),f.isCustom&&!f.isNewRec()?(t.openBlock(),t.createBlock(t.unref(I.NButton),{key:0,size:"tiny",quaternary:"",loading:r.value,disabled:r.value,circle:"",class:"!absolute right-0.5 top-0.5 !hidden group-hover:!flex",onClick:p=>l(h)},{default:t.withCtx(()=>[t.createVNode(u)]),_:1},8,["loading","disabled","onClick"])):t.createCommentVNode("",!0)]))),128))])]),_:1})}}}),Fu=dn(eb,[["__scopeId","data-v-afccb364"]]),tb={class:"flex gap-3 min-w-[20rem] relative"},nb={class:"kozyrek-preview w-fill h-[18rem] grow touch-none overflow-hidden rounded-lg bg-gray-200 p-2"},ib={ref:"drawing-container",class:"size-full"},rb={},Vu=t.defineComponent({...rb,__name:"kozyrek-configurator-preview",props:{settings:{},value:{},selectTemplateIndex:{}},emits:["pointer:move","pointer:up","template:select","remove-custom-template"],setup(n,{emit:e}){const i=n,r=e,o=t.useTemplateRef("drawing-container");let s=[],a=[],l=[],c=null;const d=.75,u=t.computed(()=>i.value.configuratorParams.linesAngles.map((O,A)=>new Vn(i.value.configuratorParams.linesWidths[A],O,`A-${A+1}`))),f=t.computed(()=>i.value.configuratorParams.colorSide==="bottom"),h=t.computed(()=>{var O,A;return i.value.configuratorParams.startTailType&&((O=i.settings.startTailConfigs)!=null&&O[i.value.configuratorParams.startTailType])?(A=i.settings.startTailConfigs)==null?void 0:A[i.value.configuratorParams.startTailType].points:[]}),p=t.computed(()=>{var A;const O=i.value.configuratorParams.endTailType!==void 0&&((A=i.settings.endTailConfigs)==null?void 0:A[i.value.configuratorParams.endTailType]);return!O||!O.points?[]:O.points.map((Y,H)=>Array.isArray(Y)?new Vn(Y[0],Y[1],`A-${H+1}`):new Vn(Y.width,Y.angle,`A-${H+1}`))}),m=(O,A=!1)=>{O[0].start.x=0,O[0].start.y=0;let Y=0;for(let H=0;H<O.length;H++){const T=O[H],D=O[H-1]??new Vn(0,Y);Y+=!A||H>1?D.angle:0;const K=(!A||H>0?T.angle:0)+Y;if(O[H].end.x=T.width*Math.cos(K*Math.PI/180)+O[H].start.x,O[H].end.y=T.width*Math.sin(K*Math.PI/180)+O[H].start.y,H<O.length-1){const J=H+1;O[J].start.x=O[H].end.x,O[J].start.y=O[H].end.y}}return O},g=(O,A,Y,H,T=!1)=>{let D=m([...Y,...H]);A.length>0&&(D=[...m(A),...D]);let K=0,J=0,U=0,q=0;D.forEach(oe=>{K=Math.min(K,oe.start.x,oe.end.x),J=Math.min(J,oe.start.y,oe.end.y),U=Math.max(U,oe.start.x,oe.end.x),q=Math.max(q,oe.start.y,oe.end.y)});let L,le;K===0&&J===0&&U===0&&q===0?(L=1,le=1):(L=O.width/Math.abs(U-K),le=(T?O.height:O.height-Ke.colorSideLabel.size)/Math.abs(q-J));const ue=Math.min(L,le);return K=K<0?-K*ue:0,J=J<0?-J*ue:0,[ue,K,J]},b=O=>{const A=new Ko([O]);return A._size=Ke.anchorPoint.size,A.fill=Ke.anchorPoint.color,A.stroke="transparent",A._linewidth=Ke.anchorPoint.strokeSize,l.push(A),A},y=(O,A)=>{if(l=[],i.settings.allowChangeFirstPoint){const Y=O[0],H=new be(Y.vertices[0].x,Y.vertices[0].y);H.bind(te.Types.change,()=>{Y.vertices[0].copy(H)});const T=b(H);A.add(T)}O.forEach((Y,H)=>{const T=O[H+1],D=new be(Y.vertices[1].x,Y.vertices[1].y);D.bind(te.Types.change,()=>{Y.vertices[1].copy(D),T!==void 0&&T.vertices[0].copy(D)});const K=b(D);A.add(K)})},_=O=>O*(Math.PI/180),x=(O,A,Y)=>{const H=A.vertices.length-1;O.position.x=A.vertices[H].x,O.position.y=A.vertices[H].y;const T=Math.atan2(A.vertices[H].y-A.vertices[0].y,A.vertices[H].x-A.vertices[0].x);O.rotation=_(Y)+T},w=(O,A,Y)=>{if(A.vertices[0]===void 0)return;O.position.x=A.vertices[0].x,O.position.y=A.vertices[0].y;const H=A.vertices.length-1,T=Math.atan2(A.vertices[H].y-A.vertices[0].y,A.vertices[H].x-A.vertices[0].x);O.rotation=_(Y)+T},C=(O,A,Y)=>{const H=new Un;if(O.length===0)return H;const T=[];return[...O].reverse().forEach((D,K)=>{K!==0&&D.angle>0&&(D.angle*=-1),T.push(D)}),O=m(T,!0),w(H,A,O[0].angle),[A.vertices[0],A.vertices[1]].forEach(D=>{D.bind(te.Types.change,()=>{w(H,A,O[0].angle)})}),O.forEach(D=>{const K=D.start.x*Y,J=D.end.x*Y,U=D.start.y*Y,q=D.end.y*Y,L=new Qo(K,U,J,q);L.linewidth=Ke.line.size,L.stroke=Ke.line.color,H.add(L)}),H},N=(O,A,Y)=>{const H=new Un;return O.length===0||(O=m(O,!0),x(H,A,O[0].angle),[A.vertices[0],A.vertices[1]].forEach(T=>{T.bind(te.Types.change,()=>{x(H,A,O[0].angle)})}),O.forEach(T=>{const D=T.start.x*Y,K=T.end.x*Y,J=T.start.y*Y,U=T.end.y*Y,q=new Qo(D,J,K,U);q.linewidth=Ke.line.size,q.stroke=Ke.line.color,H.add(q)})),H},k=(O,A,Y,H)=>{const T=A.vertices[0].x+(A.vertices[1].x-A.vertices[0].x)/2-8*Math.sin(O.angle*Math.PI/180),D=A.vertices[0].y+(A.vertices[1].y-A.vertices[0].y)/2-8*Math.cos(O.angle*Math.PI/180),K=new gr(O.label,T+10,D-10);let J;K.size=Ke.lineLabel.size,K.weight=600,K.fill=Ke.lineLabel.color,K.id+=1,K.rotation=Ke.lineLabel.rotation,H>0&&(J=new gr(`${O.angle}°`,A.vertices[0].x+25,A.vertices[0].y-25),J.size=Ke.angleLabel.size,J.weight=600,J.fill=Ke.angleLabel.color,J.rotation=Ke.angleLabel.rotation,J.id+=H,s.push(J),Y.add(J)),Y.add(K),v(K,A,0,J),v(K,A,1)},$=()=>{const{size:O}=Ke.colorSideLabel,A=0,Y=0,H=f.value?O/2:O/2-O,T=f.value?O/2-O:O/2,D=new Un;if(!c)return D;const K=5,J=Math.atan2(T-H,Y-A),U=[new Ae(A,H,0,0,0,0,En.Commands.move),new Ae(Y,T,0,0,0,0,En.Commands.line),new Ae(Y-K*Math.cos(J-Math.PI/4),T-K*Math.sin(J-Math.PI/4),0,0,0,0,En.Commands.line),new Ae(Y,T,0,0,0,0,En.Commands.move),new Ae(Y-K*Math.cos(J+Math.PI/4),T-K*Math.sin(J+Math.PI/4),0,0,0,0,En.Commands.line)],q=new Oe(U,!1,!1,!0);q.noFill(),q.cap="round",q.join="round",q.linewidth=O/7,q.stroke=Ke.colorSideLabel.color,D.add(q);const L=new gr(f.value?"Цвет снизу":"Цвет сверху",10,0);L.size=O,L.weight=600,L.fill=Ke.colorSideLabel.color,L.alignment="left",D.add(L);const le=D.getBoundingClientRect();return D.position.x=(c.width-le.width)*d+10,D.position.y=f.value?c.height+le.height*2:le.height/2,D},v=(O,A,Y,H)=>{A.vertices[Y].bind(te.Types.change,()=>{const T=A.vertices.length-1,D=Math.atan2(A.vertices[0].y-A.vertices[T].y,A.vertices[0].x-A.vertices[T].x)*180/Math.PI,K=A.vertices[0].x+(A.vertices[T].x-A.vertices[0].x)/2-8*Math.sin(D*Math.PI/180),J=A.vertices[0].y+(A.vertices[T].y-A.vertices[0].y)/2-8*Math.cos(D*Math.PI/180);O.position.x=K+10,O.position.y=J-10,O.rotation=-.5,H&&(H.position.x=A.vertices[0].x+25,H.position.y=A.vertices[0].y-25)})},E=(O,A,Y,H,T=!1)=>{var fe;if(O.clear(),Y.length===0){O.update();return}const D=m(Y),[K,J,U]=g(O,A,D,H,T),q=new Un,L=new Array,le=new Array;T||(s=[],a=[]),D.forEach((ge,_e)=>{const Qe=ge.start.x*K+J,Re=ge.end.x*K+J,Mt=ge.start.y*K+U,vn=ge.end.y*K+U,It=new Qo(Qe,Mt,Re,vn);It.linewidth=T?Ke.previewLine.size:Ke.line.size,It.stroke=T?Ke.previewLine.color:Ke.line.color,a.push(It),L.push(It),q.add(It),!T&&ge.label!==""&&k(ge,It,q,_e)});const ue=L.at(-1);let oe=q.getBoundingClientRect();if(!T){const ge=$();le.push(ge)}if(A.length>0){const ge=C(A,L[0],K);q.add(ge)}if(H.length>0&&ue){const ge=N(H,ue,K);q.add(ge)}if(le.push(q),O.makeGroup(le),oe=q.getBoundingClientRect(),q.position.x=0-oe.left+(O.width-oe.width)/(2*(T?1:d)),q.position.y=0-oe.top+(O.height-oe.height)/(2*(T?1:d)),O.update(),!T){const ge=((fe=i.value.configuratorParams)==null?void 0:fe.colorSide)==="top";q.position.y=q.position.y+Ke.colorSideLabel.size*Number(ge),y(L,q),O.update()}},P=(O,A)=>{if(O&&!A.isNewRec()){const Y=new En({width:O.scrollWidth,height:O.scrollHeight});Y.appendTo(O),E(Y,[],A.points,[],!0)}},F=()=>{c&&E(c,h.value,u.value,p.value,!1)},R=O=>O*(180/Math.PI),M=(O,A)=>{const Y=O[1].x-O[0].x,H=O[1].y-O[0].y,T=A[1].x-A[0].x,D=A[1].y-A[0].y;let K=Math.atan2(Y*D-H*T,Y*T+H*D);return K=R(K),Math.round(K)*-1},X=O=>{const A=a.map((Y,H,T)=>{const D=T[H-1]??{vertices:[{x:-10,y:0},{x:0,y:0}]};let K=Ve.multiplyByStep(Math.ceil(Ve.divideByStep(Y._length/O,i.settings.lineWidthStep)),i.settings.lineWidthStep);const J=s[H-1];K<(T.length>1?i.settings.minLineWidth:i.settings.stripMinWidth)&&(K=T.length>1?i.settings.minLineWidth:i.settings.stripMinWidth),K>i.settings.maxLineWidth&&(K=i.settings.maxLineWidth);const U=M(Y.vertices,D.vertices);return J&&(J.value=`${U}°`),new Vn(K,U,`A-${H+1}`)});r("pointer:move",A)},G=O=>{let A=null,Y;const H=J=>{A=l.find(U=>{const q=U.renderer;return(q==null?void 0:q.elem)===J.target}),[Y]=g(O,h.value,u.value.map(U=>U),p.value)},T=J=>{if(A){const U=A.renderer,q=U==null?void 0:U.elem;if(!q)return;const L=q.getBoundingClientRect();A.vertices[0].x-=L.x-(J instanceof MouseEvent?J.clientX:J.targetTouches[0].clientX)+Ke.anchorPoint.size/2,A.vertices[0].y-=L.y-(J instanceof MouseEvent?J.clientY:J.targetTouches[0].clientY)+Ke.anchorPoint.size/2,X(Y),O.update()}},D=()=>{A&&r("pointer:up",u.value),A=null},K=o.value;K&&(K.addEventListener("touchstart",H,{passive:!0}),K.addEventListener("touchend",D,{passive:!0}),K.addEventListener("mousedown",H),K.addEventListener("mouseup",D),K.addEventListener("mousemove",T),K.addEventListener("touchmove",T,{passive:!0}))},Z=(O,A)=>{r("remove-custom-template",O,A)};return t.onMounted(()=>{o.value&&(c=new En({width:o.value.scrollWidth,height:o.value.scrollHeight,fullscreen:!1}).appendTo(o.value),c.scene.scale=d,c.update(),t.watch(()=>i.value,()=>{F()},{deep:!0,immediate:!0}),G(c))}),t.onBeforeUnmount(()=>{c&&(c.clear(),c=null)}),(O,A)=>(t.openBlock(),t.createElementBlock("div",tb,[t.createVNode(Fu,{"select-template-index":n.selectTemplateIndex,settings:n.settings,"onTemplate:select":A[0]||(A[0]=Y=>r("template:select",Y)),onInitDrawTemplate:P,onRemoveCustomTemplate:Z},null,8,["select-template-index","settings"]),t.createElementVNode("div",nb,[t.createElementVNode("div",ib,null,512)])]))}});class yr extends W.Identity{constructor(i,r){super();B(this,"label","");B(this,"points",[]);B(this,"isCustom",!1);B(this,"id",-1);B(this,"guid","");i?(this.label=i.label,this.points=i.points.map((o,s)=>V.isArray(o)?new Vn(o[0],o[1],`A-${s+1}`):new Vn(o.width,o.angle,`A-${s+1}`)),this.isCustom=i.isCustom):(this.label="-- Новая конфигурация --",this.points=[new Vn(0,0,"A-1")],this.isCustom=!0,this.id=r??this.id)}}class Ia extends yr{constructor(i){super(i);B(this,"isDefault");this.isDefault=i.isDefault??!1}}class Mu{constructor(e){B(this,"minLineWidth");B(this,"maxLineWidth");B(this,"lineWidthStep");B(this,"minLineAngle");B(this,"maxLineAngle");B(this,"lineAngleStep");B(this,"stripMinWidth");B(this,"stripMaxWidth");B(this,"stripMinLength");B(this,"stripMaxLength");B(this,"allowShowTable");B(this,"showOnlyTemplates");B(this,"templates");B(this,"customTemplates",[]);B(this,"startTailConfigs");B(this,"endTailConfigs");B(this,"bendCountForExtended");B(this,"extendedProductCatalog");B(this,"allowChangeFirstPoint");B(this,"allowSaveTemplates");B(this,"userTemplatesPrefix");B(this,"lengthStep");B(this,"canSetDopProdaga");var i,r;this.minLineWidth=e.minLineWidth,this.maxLineWidth=e.maxLineWidth,this.lineWidthStep=e.lineWidthStep,this.minLineAngle=e.minLineAngle,this.maxLineAngle=e.maxLineAngle,this.lineAngleStep=e.lineAngleStep,this.stripMinWidth=e.stripMinWidth,this.stripMaxWidth=e.stripMaxWidth,this.stripMinLength=e.stripMinLength,this.stripMaxLength=e.stripMaxLength,this.allowShowTable=e.allowShowTable,this.showOnlyTemplates=e.showOnlyTemplates,this.templates=e.templates.map(o=>new yr(o)),this.templates.forEach((o,s)=>{o.id=s}),this.startTailConfigs=((i=e.startTailConfigs)==null?void 0:i.map(o=>new Ia(o)))??[],this.endTailConfigs=((r=e.endTailConfigs)==null?void 0:r.map(o=>new Ia(o)))??[],this.bendCountForExtended=e.bendCountForExtended,this.extendedProductCatalog=e.extendedProductCatalog,this.allowChangeFirstPoint=e.allowChangeFirstPoint,this.allowSaveTemplates=e.allowSaveTemplates,this.userTemplatesPrefix=e.userTemplatesPrefix,this.lengthStep=e.lengthStep,this.canSetDopProdaga=e.canSetDopProdaga,this.showOnlyTemplates||(this.customTemplates=e.customTemplates?Object.entries(e.customTemplates).filter(([,o])=>o.id!==-1).map(([o,s])=>{const a=new yr(s);return a.isCustom=!0,a.id=+o,a}):[],this.customTemplates.some(o=>o.isCustom&&o.isNewRec())||this.customTemplates.push(new yr({label:"-- Новая конфигурация --",points:[new Vn(this.stripMinWidth,0,"A-1")],isCustom:!0,id:-1,guid:""})))}get allTemplates(){return[...this.templates,...this.customTemplates]}addCustomTemplate(e){if(!this.allowSaveTemplates)return;const i=this.customTemplates.findLast(o=>!o.isNewRec()),r=new yr(e);r.isCustom=!0,r.id=i?i.id+1:0,this.customTemplates.splice(-1,0,r)}removeCustomTemplate(e){if(!this.allowSaveTemplates)return;const i=this.customTemplates.findIndex(r=>r.id===e);i!==-1&&this.customTemplates.splice(i,1)}}const ob={class:"flex flex-col gap-3"},sb={class:"grid gap-5 md:grid-cols-5"},ab={},Iu=t.defineComponent({...ab,__name:"kozyrek-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showProductInfoButton:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{type:Function},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{type:Function},settings:{},cartItem:{}},emits:["submit","click:view-switch"],setup(n,{emit:e}){const i=n,r=e,o=t.ref(!1),s=t.ref(!1),a=t.ref(!1),l=t.ref(i.cartItem),c=t.ref(new Mu(i.settings)),d=t.ref({linesWidths:[...i.cartItem.configuratorParams.linesWidths],linesAngles:[...i.cartItem.configuratorParams.linesAngles]}),u=t.ref({quantity:{},marker:{},length:{}}),f=t.ref(0),h=t.useTemplateRef("kozyrek-configurator-params-form"),p=(v=0)=>{var P;const E=(P=c.value.allTemplates)==null?void 0:P.at(v);E!==void 0&&(f.value=v,l.value.configuratorParams.linesWidths=E.points.map(F=>V.isArray(F)?F[0]:F.width),l.value.configuratorParams.linesAngles=E.points.map(F=>V.isArray(F)?F[1]:F.angle),x()),y(l.value.configuratorParams)},m=async()=>{const v=prompt("Введите название шаблона:");if(!v)return;a.value=!0;const E={label:v,points:l.value.configuratorParams.linesWidths.map((F,R)=>[F,l.value.configuratorParams.linesAngles[R]])},P=F=>{F&&(c.value.addCustomTemplate(E),f.value=c.value.allTemplates.length-2),a.value=!1};i.eventEmitter.emit("configurator:create-template",{category:i.cartItem.category,template:E,callback:P})},g=async(v,E)=>{var R;const P=(R=c.value.allTemplates)==null?void 0:R.at(v);if(!P||!P.isCustom)return;const F=M=>{M&&(c.value.removeCustomTemplate(P.id),p()),E==null||E()};i.eventEmitter.emit("configurator:remove-template",{category:i.cartItem.category,templateId:P.id,callback:F})},b=()=>{c.value.showOnlyTemplates||c.value.allowSaveTemplates&&(f.value=c.value.allTemplates.length-1)},y=async v=>{var E,P;l.value.product=new W.ClientProduct,(P=(E=h.value)==null?void 0:E.formReference)==null||P.validate(F=>{F||(x(),o.value=!0,i.eventEmitter.emit("configurator:search-product",{category:i.cartItem.category,params:v,validationFieldResultData:u.value,callback:R=>{R?l.value.product=R:u.value.product={showFeedback:!0,feedback:"Не удалось найти товар по указанным параметрам.",validationStatus:"error"},o.value=!1}}))}).catch(V.noop)},_=async()=>{var v,E;(E=(v=h.value)==null?void 0:v.formReference)==null||E.validate(P=>{var F,R;if(!P){s.value=!0;const M=new W.OrderItemBase(l.value);(F=c.value.startTailConfigs)!=null&&F.length||delete M.configuratorParams.startTailType,(R=c.value.endTailConfigs)!=null&&R.length||delete M.configuratorParams.endTailType,r("submit",M,u.value,()=>{s.value=!1,t.nextTick(()=>{var X,G;(G=(X=h.value)==null?void 0:X.formReference)==null||G.restoreValidation()})})}}).catch(V.noop)},x=()=>{const v={quantity:u.value.quantity,marker:u.value.marker};l.value.configuratorParams.linesWidths.forEach((E,P)=>{v[`lines_widths[${P+1}]`]={},v[`lines_angles[${P+1}]`]={}}),u.value=v},w=v=>{d.value.linesWidths=v.map(E=>E.width),d.value.linesAngles=v.map(E=>E.angle)},C=v=>{l.value.configuratorParams.linesWidths=d.value.linesWidths,l.value.configuratorParams.linesAngles=d.value.linesAngles,x(),b(),y(l.value.configuratorParams)},N=(v,E)=>{d.value.linesWidths=v,d.value.linesAngles=E},k=v=>{const E=l.value.configuratorParams.linesWidths.length>1?c.value.minLineWidth:c.value.stripMinWidth,P=0;l.value.configuratorParams.linesWidths.splice(v+1,0,E),l.value.configuratorParams.linesAngles.splice(v+1,0,P),d.value.linesWidths=[...l.value.configuratorParams.linesWidths],d.value.linesAngles=[...l.value.configuratorParams.linesAngles],x(),b(),y(l.value.configuratorParams)},$=v=>{l.value.configuratorParams.linesWidths.length<=1||(l.value.configuratorParams.linesWidths.splice(v,1),l.value.configuratorParams.linesAngles.splice(v,1),d.value.linesWidths=[...l.value.configuratorParams.linesWidths],d.value.linesAngles=[...l.value.configuratorParams.linesAngles],x(),b(),y(l.value.configuratorParams))};return t.onMounted(()=>{i.cartItem.isNewRec()?p():(x(),f.value=-1,y(l.value.configuratorParams))}),t.watch(()=>i.cartItem,v=>{l.value=new W.OrderItemBase(v),v.isNewRec()?p():(x(),f.value=-1,y(l.value.configuratorParams))}),(v,E)=>{const P=I.NButton;return t.openBlock(),t.createElementBlock("div",ob,[n.settings.allowShowTable?(t.openBlock(),t.createBlock(P,{key:0,type:"tertiary",class:"self-end",onClick:E[0]||(E[0]=F=>r("click:view-switch"))},{default:t.withCtx(()=>[...E[3]||(E[3]=[t.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):t.createCommentVNode("",!0),t.createElementVNode("div",sb,[t.createVNode(Vu,{value:l.value,"select-template-index":f.value,settings:c.value,class:"h-fit col-span-3","onPointer:up":C,"onPointer:move":w,"onTemplate:select":p,onRemoveCustomTemplate:g},null,8,["value","select-template-index","settings"]),t.createVNode(mc,{ref:"kozyrek-configurator-params-form",value:l.value,"onUpdate:value":E[1]||(E[1]=F=>l.value=F),"preview-params":d.value,validation:u.value,settings:c.value,"is-submit-processing":s.value,"is-product-searching":o.value,"select-template-index":f.value,class:"col-span-2","onUpdate:params":E[2]||(E[2]=F=>y(F)),"onUpdate:preview":N,onSubmit:_,"onClick:saveTemplate":m,"onClick:addLine":k,"onClick:removeLine":$},null,8,["value","preview-params","validation","settings","is-submit-processing","is-product-searching","select-template-index"])])])}}}),lb={class:"flex flex-col items-center justify-between rounded-xl"},cb={class:"img-preview relative flex justify-center"},db={},ub=t.defineComponent({...db,__name:"mosquito-configurator-preview",props:{configuratorParams:{},settings:{}},emits:["open-instructions"],setup(n,{emit:e}){const i=n,r=t.computed(()=>{const{height:s}=i.configuratorParams;return V.keys(i.settings.crossbarCount).reverse().find(a=>s>=i.settings.crossbarCount[Number(a)])}),o=e;return(s,a)=>{const l=I.NButton;return t.openBlock(),t.createElementBlock("div",lb,[t.createElementVNode("div",cb,[a[1]||(a[1]=t.createElementVNode("div",{class:"window"},null,-1)),t.createElementVNode("div",{class:t.normalizeClass(["net",`net-${n.configuratorParams.netType}`])},null,2),t.createElementVNode("div",{class:t.normalizeClass(["frame",`frame-${n.configuratorParams.color}`])},null,2),r.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["frame-crossbar",`frame-crossbar-${r.value}-${n.configuratorParams.color}`])},null,2)):t.createCommentVNode("",!0),t.createElementVNode("div",{class:t.normalizeClass(["mount",`mount-${n.configuratorParams.mountType}-${n.configuratorParams.color}`])},null,2),t.createElementVNode("div",{class:t.normalizeClass(["cut-preview",`cut-preview-${n.configuratorParams.mountType}-${n.configuratorParams.color}`])},null,2)]),t.createVNode(l,{type:"primary",class:"block justify-self-center",onClick:a[0]||(a[0]=c=>o("open-instructions"))},{default:t.withCtx(()=>[...a[2]||(a[2]=[t.createTextVNode(" Руководство по замеру ",-1)])]),_:1})])}}}),Aa=dn(ub,[["__scopeId","data-v-2a790a20"]]),fb={key:0,class:"flex items-baseline gap-1"},hb={key:0,class:"flex items-baseline gap-1"},mb={key:1},pb={class:"text-lg font-semibold"},gb={key:2,class:"text-red-500 text-sm mb-2"},yb={class:"flex gap-3"},bb={},Au=t.defineComponent({...bb,__name:"mosquito-configurator-form",props:{value:{},settings:{},isProductSearching:{type:Boolean,default:!1},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0}},emits:["update:value","update:params","submit","click:instructions-toggle","click:show-preview-drawer"],setup(n,{expose:e,emit:i}){var k;const r=n,o=i,s=t.computed(()=>Ue.isPhoneDevice()),a=t.useTemplateRef("form-reference"),l=t.useTemplateRef("width-form-item-reference"),c=t.useTemplateRef("height-form-item-reference"),d=t.useTemplateRef("width-input-reference"),u=t.ref(V.cloneDeep(r.value)),f=t.computed(()=>r.settings.widthOverlaps[u.value.configuratorParams.mountType]??0),h=t.computed(()=>r.settings.heightOverlaps[u.value.configuratorParams.mountType]??0),p=t.computed(()=>r.settings.maxWidths[u.value.configuratorParams.netType]),m=t.computed(()=>r.settings.maxHeights[u.value.configuratorParams.netType]),g=t.computed(()=>u.value.configuratorParams.width?u.value.configuratorParams.width+f.value:0),b=t.computed(()=>u.value.configuratorParams.height?u.value.configuratorParams.height+h.value:0),y=t.ref(r.settings.canSetDopProdaga??!1),_=t.computed(()=>({"configuratorParams.width":[ce.required,ce.min(r.settings.minWidth-f.value),ce.max(p.value-f.value),ce.step(1),We.serverValidation(r.validation.width.feedback)],"configuratorParams.height":[ce.required,ce.min(r.settings.minHeight-h.value),ce.max(m.value-h.value),ce.step(1),We.serverValidation(r.validation.height.feedback)],quantity:[ce.required,ce.min(1),ce.step(1),We.serverValidation(r.validation.quantity.feedback)],marker:[We.serverValidation(r.validation.marker.feedback)]})),x=t.computed(()=>{var R;const $=g.value,v=b.value,{quantity:E}=r.value,P=((R=r.value.product)==null?void 0:R.costRub)||0;if(!$||!v||!E||P===0)return null;const F=$*v/1e6;return Ve.formatMoney(P*E*F)}),w=t.computed(()=>{const $=g.value,v=b.value,E=!!($&&$>=r.settings.minWidth&&$<=r.settings.maxWidths[u.value.configuratorParams.netType]),P=!!(v&&v>=r.settings.minHeight&&v<=r.settings.maxHeights[u.value.configuratorParams.netType]),F=!!(r.value.quantity&&r.value.quantity>0);return E&&P&&F}),C=($,v)=>{var F,R;const E=u.value.configuratorParams;$&&$ in E&&(E[$]=v);const P={...E,width:g.value??0,height:b.value??0};$==="width"&&((F=l.value)==null||F.validate().catch(V.noop)),$==="height"&&((R=c.value)==null||R.validate().catch(V.noop)),t.nextTick(()=>{var X,G;!((X=l.value)!=null&&X.validationErrored)&&!((G=c.value)!=null&&G.validationErrored)&&P.height&&P.width&&o("update:params",P),N("configuratorParams",P)})},N=($,v)=>{const E=new W.OrderItemBase(r.value);E[$]=v,$==="configuratorParams"&&(E.product=new W.ClientProduct),o("update:value",E)};return t.watch(()=>r.value,$=>{const v=V.cloneDeep(t.toRaw($)),E=v.configuratorParams.mountType,P=r.settings.widthOverlaps[E]??0,F=r.settings.heightOverlaps[E]??0;v.configuratorParams.width&&v.configuratorParams.width>0&&(v.configuratorParams.width-=P),v.configuratorParams.height&&v.configuratorParams.height>0&&(v.configuratorParams.height-=F),u.value=v},{deep:!0,immediate:!0}),t.onMounted(()=>{var $;($=d.value)==null||$.select()}),e({validate:(k=a.value)==null?void 0:k.validate,formReference:a}),($,v)=>{const E=I.NCheckbox;return t.withDirectives((t.openBlock(),t.createBlock(t.unref(I.NForm),{ref:"form-reference",model:u.value,rules:_.value,class:"flex flex-col gap-2 px-4 md:max-w-96 sc-hide-empty-feedback-message"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NFormItem),{required:!0,"show-feedback":!1,label:"Тип сетки"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NSelect),{value:u.value.configuratorParams.netType,"onUpdate:value":[v[0]||(v[0]=P=>u.value.configuratorParams.netType=P),v[1]||(v[1]=P=>C("netType",P))],options:n.settings.netType.map(P=>({label:n.settings.descriptions.net_type[P],value:P}))},null,8,["value","options"])]),_:1}),t.createVNode(t.unref(I.NFormItem),{required:!0,"show-feedback":!1,label:"Цвет профиля"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NSelect),{value:u.value.configuratorParams.color,"onUpdate:value":[v[2]||(v[2]=P=>u.value.configuratorParams.color=P),v[3]||(v[3]=P=>C("color",P))],options:n.settings.color.map(P=>({label:n.settings.descriptions.color[P],value:P}))},null,8,["value","options"])]),_:1}),t.createVNode(t.unref(I.NFormItem),{required:!0,"show-feedback":!1,label:"Вид крепления"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NSelect),{value:u.value.configuratorParams.mountType,"onUpdate:value":[v[4]||(v[4]=P=>u.value.configuratorParams.mountType=P),v[5]||(v[5]=P=>C("mountType",P))],options:n.settings.mountType.map(P=>({label:n.settings.descriptions.mount_type[P],value:P}))},null,8,["value","options"])]),_:1}),t.createVNode(t.unref(I.NFormItem),{ref:"width-form-item-reference",path:"configuratorParams.width",label:`Ширина светового проёма от ${n.settings.minWidth-f.value} ${p.value?" до "+(p.value-f.value):""} мм.`},{feedback:t.withCtx(()=>[!n.validation.width.showFeedback&&g.value>=n.settings.minWidth&&g.value<=n.settings.maxWidths[u.value.configuratorParams.netType]?(t.openBlock(),t.createElementBlock("div",fb,[t.createVNode(t.unref(I.NText),{type:"success"},{default:t.withCtx(()=>[t.createTextVNode("Ширина готового изделия "+t.toDisplayString(g.value),1)]),_:1}),t.createVNode(t.unref(I.NButton),{quaternary:"",type:"info",size:"tiny",onClick:v[10]||(v[10]=P=>o("click:instructions-toggle"))},{default:t.withCtx(()=>[...v[25]||(v[25]=[t.createElementVNode("span",{class:"text-sm"},"Руководство",-1)])]),_:1})])):t.createCommentVNode("",!0)]),default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{ref:"width-input-reference",value:u.value.configuratorParams.width,"onUpdate:value":[v[6]||(v[6]=P=>u.value.configuratorParams.width=P),v[9]||(v[9]=P=>C("width",P))],parse:t.unref(ht),"show-button":!1,placeholder:"Введите высоту светового проёма",class:"w-full",onKeydown:v[7]||(v[7]=P=>t.unref(ft)(P)),onInput:v[8]||(v[8]=P=>t.unref(dt)(n.validation,"width")),onFocus:t.unref(He)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),t.createVNode(t.unref(I.NFormItem),{ref:"height-form-item-reference",path:"configuratorParams.height",label:`Высота светового проёма от ${n.settings.minHeight-h.value} ${m.value?" до "+(m.value-h.value):""} мм.`},{feedback:t.withCtx(()=>[!n.validation.height.showFeedback&&b.value>=n.settings.minHeight&&b.value<=n.settings.maxHeights[u.value.configuratorParams.netType]?(t.openBlock(),t.createElementBlock("div",hb,[t.createVNode(t.unref(I.NText),{type:"success"},{default:t.withCtx(()=>[t.createTextVNode("Высота готового изделия "+t.toDisplayString(b.value),1)]),_:1}),t.createVNode(t.unref(I.NButton),{quaternary:"",type:"info",size:"tiny",onClick:v[15]||(v[15]=P=>o("click:instructions-toggle"))},{default:t.withCtx(()=>[...v[26]||(v[26]=[t.createElementVNode("span",{class:"text-sm"},"Руководство",-1)])]),_:1})])):t.createCommentVNode("",!0)]),default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:u.value.configuratorParams.height,"onUpdate:value":[v[11]||(v[11]=P=>u.value.configuratorParams.height=P),v[14]||(v[14]=P=>C("height",P))],parse:t.unref(ht),"show-button":!1,placeholder:"Введите высоту светового проёма",class:"w-full",onKeydown:v[12]||(v[12]=P=>t.unref(ft)(P)),onInput:v[13]||(v[13]=P=>t.unref(dt)(n.validation,"height")),onFocus:t.unref(He)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),t.createVNode(t.unref(I.NFormItem),{path:"quantity",label:"Количество"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:u.value.quantity,"onUpdate:value":[v[16]||(v[16]=P=>u.value.quantity=P),v[19]||(v[19]=P=>N("quantity",P??0))],"show-button":!1,placeholder:"Введите количество",class:"w-full",onKeydown:v[17]||(v[17]=P=>t.unref(ft)(P,!1)),onInput:v[18]||(v[18]=P=>t.unref(dt)(n.validation,"quantity")),onFocus:t.unref(He)},null,8,["value","onFocus"])]),_:1}),t.createVNode(t.unref(I.NFormItem),{path:"marker",label:"Маркировка"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInput),{value:u.value.marker??null,placeholder:"Введите маркировку",onInput:v[20]||(v[20]=P=>t.unref(dt)(n.validation,"marker")),"onUpdate:value":v[21]||(v[21]=P=>{u.value.marker=P??null,N("marker",P??null)}),onFocus:t.unref(He)},null,8,["value","onFocus"])]),_:1}),y.value?(t.openBlock(),t.createBlock(E,{key:0,checked:u.value.isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":v[22]||(v[22]=P=>{u.value.isAdditionalSale=P??!1,N("isAdditionalSale",P??!1)})},{default:t.withCtx(()=>[...v[27]||(v[27]=[t.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):t.createCommentVNode("",!0),t.createVNode(Fr,{"is-product-searching":n.isProductSearching,product:u.value.product,validation:n.validation.product},null,8,["is-product-searching","product","validation"]),x.value?(t.openBlock(),t.createElementBlock("div",mb,[v[28]||(v[28]=t.createTextVNode(" ИТОГО: ",-1)),t.createElementVNode("span",pb,t.toDisplayString(x.value)+" ₽",1)])):t.createCommentVNode("",!0),w.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",gb," Пожалуйста, заполните все обязательные поля корректно. ")),t.createElementVNode("div",yb,[t.createVNode(t.unref(I.NButton),{loading:n.isSubmitProcessing,disabled:!w.value||u.value.product.isNewRec(),type:"primary",class:"self-start",onClick:v[23]||(v[23]=P=>o("submit",n.value))},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(n.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["loading","disabled"]),s.value?(t.openBlock(),t.createBlock(t.unref(I.NButton),{key:0,type:"default",onClick:v[24]||(v[24]=P=>o("click:show-preview-drawer"))},{default:t.withCtx(()=>[...v[29]||(v[29]=[t.createTextVNode(" Предварительный просмотр ",-1)])]),_:1})):t.createCommentVNode("",!0)])]),_:1},8,["model","rules"])),[[t.unref(ai),()=>o("submit",u.value)]])}}}),_b="/img/configurators/mosquitto/measurement-instructions/measurement-height.png",wb="/img/configurators/mosquitto/measurement-instructions/measurement-width.png",xb="/img/configurators/mosquitto/measurement-instructions/mount.png",kb="/img/configurators/mosquitto/measurement-instructions/mount-z-plastic.png",Cb="/img/configurators/mosquitto/measurement-instructions/mount-z-metal.png",vb={class:"flex flex-col gap-6"},Sb={class:"flex gap-4"},Bb={class:"flex flex-col gap-2"},Nb={class:"flex gap-4"},Tb={class:"flex flex-col gap-2"},$b={class:"flex gap-4"},Eb={class:"flex flex-col gap-2"},Rb={},Ou=t.defineComponent({...Rb,__name:"mosquito-configurator-measurement-instructions",props:{heightOverlaps:{},widthOverlaps:{},show:{type:Boolean}},emits:["update:show"],setup(n,{emit:e}){const i=Ue.initRefDependingOnDeviceResolution("small","small","medium"),r=Ue.initRefDependingOnDeviceResolution(.98,.95,.8),o=t.computed(()=>window.innerWidth*r.value),s=e;return(a,l)=>{const c=I.NText;return t.openBlock(),t.createBlock(t.unref(I.NModal),{show:n.show,"show-icon":!1,size:t.unref(i),style:t.normalizeStyle(`width: ${o.value}px`),title:"Руководство по замеру","action-class":"grid grid-cols-2 !justify-between",preset:"dialog",onClose:l[0]||(l[0]=d=>s("update:show",!1)),onEsc:l[1]||(l[1]=d=>s("update:show",!1)),onMaskClick:l[2]||(l[2]=d=>s("update:show",!1))},{default:t.withCtx(()=>[t.createElementVNode("div",vb,[t.createVNode(c,{type:"error",class:"text-base font-medium"},{default:t.withCtx(()=>[...l[3]||(l[3]=[t.createTextVNode(" Важно! Для того,что бы произвести замер, необходимо открыть оконную створку. ",-1)])]),_:1}),l[22]||(l[22]=t.createElementVNode("div",{class:"grid gap-6 md:grid-cols-2"},[t.createElementVNode("div",{class:"flex items-start gap-4"},[t.createElementVNode("img",{src:_b,alt:"measurement-height",class:"w-[7.5rem]"}),t.createElementVNode("div",{class:"flex flex-col gap-2"},[t.createElementVNode("span",{class:"text-lg font-bold"},"Замер ширины"),t.createElementVNode("span",null,"Замерить по ширине световой проем оконной рамы. Размер учитывать c точностью до 1 мм")])]),t.createElementVNode("div",{class:"flex items-start gap-4"},[t.createElementVNode("img",{src:wb,alt:"measurement-height",class:"w-[7.5rem]"}),t.createElementVNode("div",{class:"flex flex-col gap-2"},[t.createElementVNode("span",{class:"text-lg font-bold"},"Замер высоты"),t.createElementVNode("span",null,"Замерить по высоте световой проем оконной рамы. Размер учитывать с точностью до 1 мм")])])],-1)),t.createElementVNode("div",Sb,[l[9]||(l[9]=t.createElementVNode("img",{src:xb,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),t.createElementVNode("div",Bb,[l[8]||(l[8]=t.createElementVNode("span",{class:"text-lg font-bold"},"Крепление на раме сетки",-1)),t.createElementVNode("span",null,[l[4]||(l[4]=t.createTextVNode(" Расчетные размеры москитной сетки: ",-1)),l[5]||(l[5]=t.createElementVNode("br",null,null,-1)),t.createTextVNode(" Ширина светового проема +"+t.toDisplayString(n.widthOverlaps.frame)+" мм. Высота светового проема +"+t.toDisplayString(n.heightOverlaps.frame)+" мм. ",1),l[6]||(l[6]=t.createElementVNode("br",null,null,-1)),l[7]||(l[7]=t.createTextVNode(" Крепления находятся на раме сетки. ",-1))])])]),t.createElementVNode("div",Nb,[l[15]||(l[15]=t.createElementVNode("img",{src:kb,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),t.createElementVNode("div",Tb,[l[14]||(l[14]=t.createElementVNode("span",{class:"text-lg font-bold"},"Z-Образное крепление пластик (верх+низ)",-1)),t.createElementVNode("span",null,[l[10]||(l[10]=t.createTextVNode(" Расчетные размеры москитной сетки:",-1)),l[11]||(l[11]=t.createElementVNode("br",null,null,-1)),t.createTextVNode(" Ширина светового проема +"+t.toDisplayString(n.widthOverlaps.external_plastic)+" мм. Высота светового проема +"+t.toDisplayString(n.heightOverlaps.external_plastic)+" мм. ",1),l[12]||(l[12]=t.createElementVNode("br",null,null,-1)),l[13]||(l[13]=t.createTextVNode(" Крепления прикручиваются к раме окна c помощью шурупов. ",-1))])])]),t.createElementVNode("div",$b,[l[21]||(l[21]=t.createElementVNode("img",{src:Cb,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),t.createElementVNode("div",Eb,[l[20]||(l[20]=t.createElementVNode("span",{class:"text-lg font-bold"},"Z-Образное крепление металл (верх+низ)",-1)),t.createElementVNode("span",null,[l[16]||(l[16]=t.createTextVNode(" Расчетные размеры москитной сетки: ",-1)),l[17]||(l[17]=t.createElementVNode("br",null,null,-1)),t.createTextVNode(" Ширина светового проема +"+t.toDisplayString(n.widthOverlaps.external_metal)+" мм. Высота светового проема +"+t.toDisplayString(n.heightOverlaps.external_metal)+" мм. ",1),l[18]||(l[18]=t.createElementVNode("br",null,null,-1)),l[19]||(l[19]=t.createTextVNode(" Крепления прикручиваются к раме окна c помощью шурупов. ",-1))])])])])]),_:1},8,["show","size","style"])}}}),Pb={class:"grid md:grid-cols-2"},Fb={},zu=t.defineComponent({...Fb,__name:"mosquito-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showProductInfoButton:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{type:Function},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{type:Function},settings:{},cartItem:{}},emits:["submit","click:view-switch"],setup(n,{emit:e}){const i=n,r=e,o=t.computed(()=>Ue.isPhoneDevice()),s=t.ref(!1),a=t.ref(!1),l=t.ref(i.cartItem),c=t.useTemplateRef("mosquito-configurator-form"),d=t.ref({width:{},height:{},quantity:{},marker:{}}),u=t.ref(!1),f=t.ref(!1),h=t.computed(()=>t.inject("debounce-input-time",300)),p=V.debounce(async g=>{var b,y;l.value.product=new W.ClientProduct,(y=(b=c.value)==null?void 0:b.formReference)==null||y.validate(_=>{_||(u.value=!0,i.eventEmitter.emit("configurator:search-product",{category:i.cartItem.category,params:g,validationFieldResultData:d.value,callback:x=>{x?l.value.product=x:d.value.product={showFeedback:!0,feedback:"Не удалось найти товар по указанным параметрам.",validationStatus:"error"},u.value=!1}}))}).catch(V.noop)},h.value),m=()=>{f.value=!0,r("submit",l.value,d.value,()=>{f.value=!1})};return t.watch(()=>i.cartItem,g=>{l.value=g},{deep:!0}),(g,b)=>{const y=Jo;return t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createVNode(Ou,{show:a.value,"onUpdate:show":b[0]||(b[0]=_=>a.value=_),"height-overlaps":n.settings.heightOverlaps,"width-overlaps":n.settings.widthOverlaps},null,8,["show","height-overlaps","width-overlaps"]),t.createElementVNode("div",Pb,[o.value?(t.openBlock(),t.createBlock(t.unref(I.NDrawer),{key:1,show:s.value,"onUpdate:show":b[4]||(b[4]=_=>s.value=_),"default-width":375,resizable:""},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NDrawerContent),null,{header:t.withCtx(()=>[t.createVNode(t.unref(I.NButton),{size:"small",type:"primary",class:"block justify-self-end",onClick:b[2]||(b[2]=_=>s.value=!1)},{default:t.withCtx(()=>[t.createVNode(y)]),_:1})]),default:t.withCtx(()=>[t.createVNode(Aa,{"configurator-params":l.value.configuratorParams,settings:n.settings,onOpenInstructions:b[3]||(b[3]=_=>a.value=!0)},null,8,["configurator-params","settings"])]),_:1})]),_:1},8,["show"])):(t.openBlock(),t.createBlock(Aa,{key:0,"configurator-params":l.value.configuratorParams,settings:n.settings,onOpenInstructions:b[1]||(b[1]=_=>a.value=!0)},null,8,["configurator-params","settings"])),t.createVNode(Au,{ref:"mosquito-configurator-form",value:l.value,"onUpdate:value":b[5]||(b[5]=_=>l.value=_),validation:d.value,settings:n.settings,"is-product-searching":u.value,"is-submit-processing":f.value,"onUpdate:params":b[6]||(b[6]=_=>t.unref(p)(_)),onSubmit:b[7]||(b[7]=_=>m()),"onClick:instructionsToggle":b[8]||(b[8]=_=>a.value=!a.value),"onClick:showPreviewDrawer":b[9]||(b[9]=_=>s.value=!0)},null,8,["value","validation","settings","is-product-searching","is-submit-processing"])])],64)}}}),Vb={},Du=t.defineComponent({...Vb,__name:"strip-configurator-line-item",props:{value:{},index:{},path:{},settings:{},product:{default:void 0},addLineButtonDisabled:{type:Boolean,default:!1},removeLineButtonDisabled:{type:Boolean,default:!1},suggestionOption:{default:void 0},autoFocus:{type:Boolean,default:!1},isLastLine:{type:Boolean,default:!1},validation:{}},emits:["update:value","click:add-line","click:remove-line"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.useTemplateRef("width-input-element"),a=t.ref(!1),l=t.ref(r.value),c=t.useTemplateRef("form-item-reference"),d=t.computed(()=>{var p;return!((p=c.value)!=null&&p.validationErrored)}),u=p=>{l.value=p,o("update:value",p,r.index,a)},f=p=>{ft(p),(p.key==="Enter"||p.code==="Enter")&&!r.isLastLine&&(p.preventDefault(),p.stopPropagation())},h=()=>{var p;(p=s.value)==null||p.select()};return t.watch(()=>r.value,p=>{l.value=p}),t.onMounted(()=>{r.autoFocus&&t.nextTick(()=>{h()})}),e({isValid:d,formItemReference:c}),(p,m)=>{const g=hc,b=yo;return t.openBlock(),t.createBlock(t.unref(I.NFormItem),{ref:"form-item-reference",path:n.path,label:`Полоса №${n.index+1}, мм`,class:"sc-hide-empty-feedback-message"},{feedback:t.withCtx(()=>[d.value?(t.openBlock(),t.createBlock(Fr,{key:0,"is-product-searching":a.value,product:n.product,validation:n.validation.product},null,8,["is-product-searching","product","validation"])):t.createCommentVNode("",!0)]),default:t.withCtx(()=>[t.createVNode(t.unref(I.NDropdown),{trigger:"click",options:n.suggestionOption,placement:"bottom-start",size:"large",onSelect:u},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{ref:"width-input-element",value:l.value??null,class:"w-full","show-button":!1,parse:t.unref(ht),placeholder:"Введите ширину",onKeydown:f,onInput:m[0]||(m[0]=y=>t.unref(dt)(n.validation,`linesWidths.${n.index}`)),onFocus:t.unref(He),"onUpdate:value":u},null,8,["value","parse","onFocus"])]),_:1},8,["options"]),t.createVNode(t.unref(I.NButton),{disabled:n.addLineButtonDisabled,size:"medium",class:"ml-2",onClick:m[1]||(m[1]=y=>o("click:add-line",n.index))},{default:t.withCtx(()=>[t.createVNode(g)]),_:1},8,["disabled"]),t.createVNode(t.unref(I.NButton),{disabled:n.removeLineButtonDisabled,size:"medium",class:"ml-2",onClick:m[2]||(m[2]=y=>o("click:remove-line",n.index))},{default:t.withCtx(()=>[t.createVNode(b)]),_:1},8,["disabled"])]),_:1},8,["path","label"])}}}),Mb={class:"my-2 flex w-full flex-col"},Ib={key:1},Ab={class:"text-lg font-semibold"},Ob={class:"flex gap-3"},zb={},Lu=t.defineComponent({...zb,__name:"strip-configurator-form",props:{value:{},settings:{},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0}},emits:["update:value","update:params","submit","click:add-line","click:remove-line"],setup(n,{expose:e,emit:i}){var _;const r=n,o=i,s=t.useTemplateRef("form-reference"),a=t.useTemplateRef("line-items-reference"),l=t.ref(V.cloneDeep(r.value)),c=t.computed(()=>{const x={length:[ce.required,ce.min(r.settings.minLength),ce.max(r.settings.maxLength),ce.step(r.settings.lengthStep),We.serverValidation(r.validation.length.feedback)],quantity:[ce.required,ce.min(1),We.serverValidation(r.validation.quantity.feedback)],marker:[We.serverValidation(r.validation.marker.feedback)]};return V.forEach(l.value,(w,C)=>{var N;x[`configuratorParams.linesWidths.${C}`]=[ce.required,ce.min(r.settings.minLineWidth),ce.step(r.settings.lineWidthStep),We.serverValidation((N=r.validation[`linesWidths.${C}`])==null?void 0:N.feedback)]}),x}),d=t.ref(r.settings.canSetDopProdaga??!1),u=t.computed(()=>r.value[0].configuratorParams.linesWidths.reduce((x,w)=>(x??0)+(w??0),0)),f=t.computed(()=>r.settings.width-u.value),h=t.computed(()=>!r.value.some(({product:x})=>!x||x.isNewRec())),p=t.computed(()=>r.isSubmitProcessing||!h.value||f.value<=0||l.value.length>=r.settings.maxLinesCount||r.value.some(x=>x.product.isNewRec())),m=t.computed(()=>x=>f.value===0?void 0:[{label:`${(f.value>0?"Остаток +":"Излишек ")+f.value} мм.`,key:f.value+x}]),g=t.computed(()=>{const{length:x}=r.value[0];if(!x||u.value!==r.settings.width)return null;const w=V.reduce(r.value,(C,N)=>{var $;const k=(($=N.product)==null?void 0:$.costRub)||0;return C+k},0);return Ve.formatMoney(w*r.value[0].quantity*x)}),b=(x,w,C)=>{var k,$,v;l.value[w].product.id=-1;const{configuratorParams:N}=l.value[w];N.linesWidths[w]=x,y("configuratorParams",N),(v=($=(k=a.value)==null?void 0:k.at(w))==null?void 0:$.formItemReference)==null||v.validate().catch(V.noop),t.nextTick(()=>{var E,P;(P=(E=a.value)==null?void 0:E.at(w))!=null&&P.isValid&&o("update:params",N,w,C)})},y=(x,w)=>{l.value.forEach(C=>{C[x]=w}),o("update:value",l.value)};return t.watch(()=>r.value,x=>{l.value=V.cloneDeep(x)},{deep:!0}),e({validate:(_=s.value)==null?void 0:_.validate,formReference:s}),(x,w)=>{const C=I.NCheckbox;return t.withDirectives((t.openBlock(),t.createBlock(t.unref(I.NForm),{ref:"form-reference",model:l.value[0],rules:c.value,class:"flex flex-col gap-2 sc-hide-empty-feedback-message"},{default:t.withCtx(()=>{var N;return[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.value,(k,$)=>{var v,E,P;return t.openBlock(),t.createBlock(Du,{key:$,ref_for:!0,ref:"line-items-reference",value:((v=k.configuratorParams)==null?void 0:v.linesWidths.at($))??null,"auto-focus":(((E=k.configuratorParams)==null?void 0:E.linesWidths.at($))??0)===0,index:$,path:`configuratorParams.linesWidths.${$}`,product:k.product,settings:n.settings,validation:n.validation,"suggestion-option":m.value(((P=k.configuratorParams)==null?void 0:P.linesWidths.at($))??0),"add-line-button-disabled":f.value<=0||n.value.length>=n.settings.maxLinesCount||n.value.some(F=>F.product.isNewRec()),"remove-line-button-disabled":l.value.length===1,"is-last-line":$===l.value.length-1&&f.value===0,"onUpdate:value":b,"onClick:addLine":w[0]||(w[0]=F=>o("click:add-line",F)),"onClick:removeLine":w[1]||(w[1]=F=>o("click:remove-line",F))},null,8,["value","auto-focus","index","path","product","settings","validation","suggestion-option","add-line-button-disabled","remove-line-button-disabled","is-last-line"])}),128)),t.createElementVNode("div",Mb,[f.value<0?(t.openBlock(),t.createBlock(t.unref(I.NText),{key:0,type:"error"},{default:t.withCtx(()=>[t.createTextVNode(" Сумма ширин всех полос должна быть равна "+t.toDisplayString(n.settings.width),1)]),_:1})):t.createCommentVNode("",!0),h.value&&l.value.length===n.settings.maxLinesCount&&f.value>0?(t.openBlock(),t.createBlock(t.unref(I.NText),{key:1,type:"error"},{default:t.withCtx(()=>[...w[15]||(w[15]=[t.createTextVNode(" Остаток резки должен быть равен 0 ",-1)])]),_:1})):t.createCommentVNode("",!0),t.createElementVNode("div",null,[w[16]||(w[16]=t.createTextVNode(" Остаток для резки: ",-1)),t.createVNode(t.unref(I.NText),{type:f.value>=0?"Success":"error"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(f.value),1)]),_:1},8,["type"]),t.createTextVNode(" из "+t.toDisplayString(n.settings.width)+" мм ",1)])]),t.createVNode(t.unref(I.NButton),{disabled:p.value,type:"primary",class:"self-center",onClick:w[2]||(w[2]=k=>o("click:add-line",l.value.length))},{default:t.withCtx(()=>[...w[17]||(w[17]=[t.createTextVNode(" Добавить полосу ",-1)])]),_:1},8,["disabled"]),t.createVNode(t.unref(I.NFormItem),{path:"length",label:`Метраж ${n.settings.minLength?" от "+n.settings.minLength:""} ${n.settings.maxLength?" до "+n.settings.maxLength:""} м.`},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:l.value[0].length,"onUpdate:value":[w[3]||(w[3]=k=>l.value[0].length=k),w[6]||(w[6]=k=>y("length",k))],parse:t.unref(ht),"show-button":!1,placeholder:"Введите метраж",class:"w-full",onKeydown:w[4]||(w[4]=k=>t.unref(ft)(k,!1)),onInput:w[5]||(w[5]=k=>t.unref(dt)(n.validation,"length")),onFocus:t.unref(He)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),t.createVNode(t.unref(I.NFormItem),{path:"quantity",label:"Количество"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:l.value[0].quantity,"onUpdate:value":[w[7]||(w[7]=k=>l.value[0].quantity=k),w[10]||(w[10]=k=>y("quantity",k))],"show-button":!1,placeholder:"Введите количество",class:"w-full",onKeydown:w[8]||(w[8]=k=>t.unref(ft)(k,!1)),onInput:w[9]||(w[9]=k=>t.unref(dt)(n.validation,"quantity")),onFocus:t.unref(He)},null,8,["value","onFocus"])]),_:1}),t.createVNode(t.unref(I.NFormItem),{path:"marker",label:"Маркировка"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInput),{value:l.value[0].marker??null,placeholder:"Введите маркировку",onInput:w[11]||(w[11]=k=>t.unref(dt)(n.validation,"marker")),"onUpdate:value":w[12]||(w[12]=k=>{l.value[0].marker=k??null,y("marker",k??null)}),onFocus:t.unref(He)},null,8,["value","onFocus"])]),_:1}),d.value?(t.openBlock(),t.createBlock(C,{key:0,checked:l.value[0].isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":w[13]||(w[13]=k=>{l.value[0].isAdditionalSale=k??!1,y("isAdditionalSale",k??!1)})},{default:t.withCtx(()=>[...w[18]||(w[18]=[t.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):t.createCommentVNode("",!0),g.value?(t.openBlock(),t.createElementBlock("div",Ib,[w[19]||(w[19]=t.createTextVNode(" ИТОГО: ",-1)),t.createElementVNode("span",Ab,t.toDisplayString(g.value)+" ₽",1)])):t.createCommentVNode("",!0),t.createElementVNode("div",Ob,[t.createVNode(t.unref(I.NButton),{loading:n.isSubmitProcessing,disabled:!h.value||f.value!=0||!((N=l.value[0])!=null&&N.length)||l.value[0].length>n.settings.maxLength||l.value[0].length<n.settings.minLength||l.value[0].quantity===0,type:"primary",class:"self-start",onClick:w[14]||(w[14]=k=>o("submit",l.value))},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(l.value[0].isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["loading","disabled"])])]}),_:1},8,["model","rules"])),[[t.unref(ai),()=>o("submit",l.value)]])}}}),Db={class:"flex grow flex-col"},Lb=["src"],Hb={class:"w-full"},Wb={},Hu=t.defineComponent({...Wb,__name:"strip-configurator-preview",props:{value:{},settings:{}},setup(n){return(e,i)=>(t.openBlock(),t.createElementBlock("div",Db,[t.createElementVNode("img",{src:"/img/configurators/strip/strip-"+n.value.length+".png",class:"w-full max-w-96 self-center py-5",alt:"Штрипс"},null,8,Lb),t.createElementVNode("div",Hb,[t.createTextVNode(" Число полос можно указать от "+t.toDisplayString(n.settings.minLinesCount)+" до "+t.toDisplayString(n.settings.maxLinesCount)+". ",1),i[0]||(i[0]=t.createElementVNode("br",null,null,-1)),t.createTextVNode(" Минимальная ширина полосы "+t.toDisplayString(n.settings.minLineWidth)+" мм. ",1),i[1]||(i[1]=t.createElementVNode("br",null,null,-1)),t.createTextVNode(" Ширина всех полос "+t.toDisplayString(n.settings.width)+" мм. ",1),i[2]||(i[2]=t.createElementVNode("br",null,null,-1)),t.createTextVNode(" Шаг ширины полосы - "+t.toDisplayString(n.settings.lineWidthStep)+" мм. ",1)])]))}}),jb={class:"flex flex-col gap-2"},qb={class:"flex grow flex-col px-5 md:w-104"},Xb={},Wu=t.defineComponent({...Xb,__name:"strip-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showProductInfoButton:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{type:Function},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{type:Function},settings:{},cartItems:{}},emits:["submit","click:view-switch"],setup(n,{emit:e}){const i=n,r=e,o=t.useTemplateRef("strip-configurator-form"),s=t.ref(i.cartItems),a=t.ref({width:{},length:{},quantity:{},marker:{}}),l=t.ref(!1),c=t.computed(()=>t.inject("debounce-input-time",300)),d=t.computed(()=>{var m;return(m=s.value[0].configuratorParams)==null?void 0:m.linesWidths.reduce((g,b)=>(g??0)+(b??0),0)}),u=m=>{m===void 0&&(m=s.value.length-1);const g=s.value.at(0);if(!g)return;g.configuratorParams.linesWidths=g.configuratorParams.linesWidths.toSpliced(m+1,0,null),s.value.forEach(y=>{y.configuratorParams.linesWidths=g.configuratorParams.linesWidths});const b=new W.OrderItemBase({quantity:(g==null?void 0:g.quantity)??1,category:g==null?void 0:g.category,length:(g==null?void 0:g.length)??i.settings.minLength,marker:g==null?void 0:g.marker,configuratorParams:{linesWidths:g==null?void 0:g.configuratorParams.linesWidths}});s.value=s.value.toSpliced(m+1,0,b)},f=m=>{const g=s.value.at(0);g&&(g.configuratorParams.linesWidths=g.configuratorParams.linesWidths.toSpliced(m,1),s.value.forEach(b=>{b.configuratorParams.linesWidths=g.configuratorParams.linesWidths}),s.value=s.value.toSpliced(m,1),delete a[`linesWidths.${m}`],delete a[`linesWidths.${m}`])},h=V.debounce(async(m,g,b)=>{const y={linesWidths:m.linesWidths.at(g)};b.value=!0,a.value[`linesWidths.${g}`]={},s.value[g].product=new W.ClientProduct,i.eventEmitter.emit("configurator:search-product",{category:s.value[g].category,params:y,validationFieldResultData:a.value,callback:_=>{_?(s.value[g].product=_,g===s.value.length-1&&s.value.length<i.settings.maxLinesCount&&d.value&&d.value<i.settings.width&&u()):(s.value[g].product=new W.ClientProduct,a.value[`linesWidths.${g}`]={showFeedback:!0,feedback:"Не удалось найти товар",validationStatus:"error"},b.value=!1),b.value=!1}})},c.value),p=async()=>{var m,g;(g=(m=o.value)==null?void 0:m.formReference)==null||g.validate(b=>{if(!b){l.value=!0;const y=s.value.at(0);if(!y)return;r("submit",y,a.value,()=>{l.value=!1,t.nextTick(()=>{var _,x;(x=(_=o.value)==null?void 0:_.formReference)==null||x.restoreValidation()})})}}).catch(V.noop)};return t.watch(()=>i.cartItems,m=>{s.value=m.map(g=>new W.OrderItemBase(g))}),(m,g)=>{const b=I.NButton;return t.openBlock(),t.createElementBlock("div",jb,[n.settings.allowShowTable?(t.openBlock(),t.createBlock(b,{key:0,type:"tertiary",class:"self-center",onClick:g[0]||(g[0]=y=>r("click:view-switch"))},{default:t.withCtx(()=>[...g[3]||(g[3]=[t.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):t.createCommentVNode("",!0),t.createElementVNode("div",qb,[t.createVNode(Hu,{value:s.value,"onUpdate:value":g[1]||(g[1]=y=>s.value=y),settings:n.settings},null,8,["value","settings"]),t.createVNode(Lu,{ref:"strip-configurator-form",value:s.value,"onUpdate:value":g[2]||(g[2]=y=>s.value=y),validation:a.value,settings:n.settings,"is-submit-processing":l.value,"onUpdate:params":t.unref(h),onSubmit:p,"onClick:addLine":u,"onClick:removeLine":f},null,8,["value","validation","settings","is-submit-processing","onUpdate:params"])])])}}}),Yb={class:"flex flex-col gap-3"},Ub={},ju=t.defineComponent({...Ub,__name:"metal-for-doors-configurator-form",props:{value:{},settings:{},isProductSearching:{type:Boolean,default:!1},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0}},emits:["update:value","update:params","submit"],setup(n,{expose:e,emit:i}){var p;const r=n,o=i,s=t.useTemplateRef("form-reference"),a=t.useTemplateRef("first-input-element"),l=t.ref(V.cloneDeep(r.value)),c=t.computed(()=>({"configuratorParams.width":[ce.required,ce.min(r.settings.minWidth),...r.settings.maxWidth?[ce.max(r.settings.maxWidth)]:[],ce.step(1),We.serverValidation(r.validation.width.feedback)],"configuratorParams.length":[ce.required,ce.min(r.settings.minLength),ce.max(r.settings.maxLength),ce.step(1),We.serverValidation(r.validation.length.feedback)],quantity:[ce.required,ce.min(1),ce.step(1),We.serverValidation(r.validation.quantity.feedback)],marker:[We.serverValidation(r.validation.marker.feedback)]})),d=t.ref(r.settings.canSetDopProdaga??!1),u=()=>{o("update:params",l.value.configuratorParams),f("configuratorParams",l.value.configuratorParams)},f=(m,g)=>{const b=new W.OrderItemBase(r.value);b[m]=g,m==="configuratorParams"&&(b.product=new W.ClientProduct),o("update:value",b)},h=()=>{var m;(m=a.value)==null||m.select()};return t.watch(()=>r.value,m=>{l.value=V.cloneDeep(m)},{deep:!0}),t.onMounted(()=>{r.value.isNewRec()&&t.nextTick(()=>{h()})}),e({validate:(p=s.value)==null?void 0:p.validate,formReference:s}),(m,g)=>{const b=I.NCheckbox;return t.withDirectives((t.openBlock(),t.createBlock(t.unref(I.NForm),{ref:"form-reference",model:l.value,rules:c.value,disabled:n.isSubmitProcessing,class:"flex flex-col gap-2 sc-hide-empty-feedback-message"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NFormItem),{path:"configuratorParams.width",label:`Ширина, ${n.settings.minWidth?" от "+n.settings.minWidth:""}${n.settings.maxWidth?" до "+n.settings.maxWidth:""} мм`},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{ref:"first-input-element",value:l.value.configuratorParams.width,"onUpdate:value":[g[0]||(g[0]=y=>l.value.configuratorParams.width=y),u],class:"w-full",parse:t.unref(ht),"show-button":!1,placeholder:"Введите ширину",onKeydown:g[1]||(g[1]=y=>t.unref(ft)(y)),onInput:g[2]||(g[2]=y=>t.unref(dt)(n.validation,"width")),onFocus:t.unref(He)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),t.createVNode(t.unref(I.NFormItem),{path:"configuratorParams.length",label:`Длина, ${n.settings.minLength?" от "+n.settings.minLength:""}${n.settings.maxLength?" до "+n.settings.maxLength:""} мм`},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:l.value.configuratorParams.length,"onUpdate:value":[g[3]||(g[3]=y=>l.value.configuratorParams.length=y),u],placeholder:"Введите длину",parse:t.unref(ht),"show-button":!1,class:"w-full",onKeydown:g[4]||(g[4]=y=>t.unref(ft)(y)),onInput:g[5]||(g[5]=y=>t.unref(dt)(n.validation,"length")),onFocus:t.unref(He)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),t.createVNode(t.unref(I.NFormItem),{path:"quantity",label:"Количество"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:n.value.quantity,placeholder:"Введите количество",min:1,"show-button":!1,class:"w-full",onKeydown:g[6]||(g[6]=y=>t.unref(ft)(y,!1)),onInput:g[7]||(g[7]=y=>t.unref(dt)(n.validation,"quantity")),"onUpdate:value":g[8]||(g[8]=y=>f("quantity",y??0)),onFocus:t.unref(He)},null,8,["value","onFocus"])]),_:1}),t.createVNode(t.unref(I.NFormItem),{path:"marker",label:"Маркировка"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInput),{value:n.value.marker??null,placeholder:"Введите маркировку",onInput:g[9]||(g[9]=y=>t.unref(dt)(n.validation,"marker")),"onUpdate:value":g[10]||(g[10]=y=>f("marker",y??null)),onFocus:t.unref(He)},null,8,["value","onFocus"])]),_:1}),d.value?(t.openBlock(),t.createBlock(b,{key:0,checked:l.value.isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":g[11]||(g[11]=y=>{l.value.isAdditionalSale=y??!1,f("isAdditionalSale",y??!1)})},{default:t.withCtx(()=>[...g[13]||(g[13]=[t.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):t.createCommentVNode("",!0),t.createVNode(Fr,{"is-product-searching":n.isProductSearching,product:n.value.product,validation:n.validation.product},null,8,["is-product-searching","product","validation"]),t.createElementVNode("div",Yb,[t.createVNode(t.unref(I.NButton),{disabled:n.value.product.isNewRec()||n.isProductSearching||n.isSubmitProcessing||n.value.length===0||n.value.width===0||n.value.quantity===0,type:"primary",class:"self-start",onClick:g[12]||(g[12]=y=>o("submit",n.value))},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(n.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["disabled"])])]),_:1},8,["model","rules","disabled"])),[[t.unref(ai),()=>o("submit",l.value)]])}}}),Kb={class:"flex flex-col gap-2 w-72"},Gb={},qu=t.defineComponent({...Gb,__name:"metal-for-doors-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showProductInfoButton:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{type:Function},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{type:Function},settings:{},cartItem:{}},emits:["submit","click:view-switch"],setup(n,{emit:e}){const i=n,r=e,o=t.useTemplateRef("metal-for-doors-configurator-form"),s=t.ref(i.cartItem),a=t.ref({width:{},length:{},quantity:{},marker:{}}),l=t.ref(!1),c=t.ref(!1),d=t.computed(()=>t.inject("debounce-input-time",300)),u=V.debounce(async h=>{var p,m;s.value.product=new W.ClientProduct,(m=(p=o.value)==null?void 0:p.formReference)==null||m.validate(g=>{g||(l.value=!0,i.eventEmitter.emit("configurator:search-product",{category:i.cartItem.category,params:h,validationFieldResultData:a.value,callback:b=>{b?s.value.product=b:a.value.product={showFeedback:!0,feedback:"Не удалось найти товар по указанным параметрам.",validationStatus:"error"},l.value=!1}}))}).catch(V.noop)},d.value),f=async()=>{var h,p;(p=(h=o.value)==null?void 0:h.formReference)==null||p.validate(m=>{m||(c.value=!0,r("submit",s.value,a.value,()=>{c.value=!1,t.nextTick(()=>{var g,b;(b=(g=o.value)==null?void 0:g.formReference)==null||b.restoreValidation()})}))}).catch(V.noop)};return t.watch(()=>i.cartItem,h=>{s.value=new W.OrderItemBase(h)},{deep:!0}),(h,p)=>{const m=I.NButton;return t.openBlock(),t.createElementBlock("div",Kb,[n.settings.allowShowTable?(t.openBlock(),t.createBlock(m,{key:0,type:"tertiary",class:"self-center",onClick:p[0]||(p[0]=g=>r("click:view-switch"))},{default:t.withCtx(()=>[...p[4]||(p[4]=[t.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):t.createCommentVNode("",!0),t.createVNode(ju,{ref:"metal-for-doors-configurator-form",value:s.value,"onUpdate:value":p[1]||(p[1]=g=>s.value=g),validation:a.value,settings:n.settings,"is-submit-processing":c.value,"is-product-searching":l.value,"onUpdate:params":p[2]||(p[2]=g=>t.unref(u)(g)),onSubmit:p[3]||(p[3]=g=>f())},null,8,["value","validation","settings","is-submit-processing","is-product-searching"])])}}}),Zb={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Qb(n,e){return t.openBlock(),t.createElementBlock("svg",Zb,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M256 112v288m144-144H112"},null,-1)])])}const Xu=t.markRaw({name:"ion-add",render:Qb}),Jb={key:0,class:"-mt-1 text-sm text-gray-500"},e_={class:"font-bold"},t_={class:"flex flex-col gap-3"},n_={key:0,class:"mt-4 flex flex-col gap-1.5"},i_={class:"flex flex-col gap-1 text-sm text-gray-700"},r_={key:0},o_={key:1},s_={"form-array-name":"items",class:"flex flex-col gap-3"},a_={class:"grid grow grid-cols-1 items-start gap-2 sm:grid-cols-3"},l_={key:0,class:"flex flex-wrap items-end gap-2"},c_={class:"whitespace-nowrap text-xl font-bold"},d_={key:0,class:"whitespace-nowrap text-lg text-gray-500"},u_={class:"font-bold"},f_={class:"font-bold"},h_={class:"flex gap-3"},m_={},Yu=t.defineComponent({...m_,__name:"sandwich-configurator-form",props:{value:{},eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showProductInfoButton:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{},settings:{},isProductSearching:{type:Boolean,default:!1},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0}},emits:["update:value","update:params","submit","add-item","remove-item"],setup(n,{expose:e,emit:i}){var Y;const r=n,o=i,s=t.useTemplateRef("form-reference"),a=t.ref(V.cloneDeep(r.value)),l=t.ref({...r.validation}),c=H=>{var T;delete l.value[H],(T=s.value)==null||T.restoreValidation()};t.watch(()=>r.validation,H=>{l.value={...H},Object.values(H).some(D=>D==null?void 0:D.feedback)&&t.nextTick(()=>{var D;return(D=s.value)==null?void 0:D.validate(V.noop).catch(V.noop)})},{deep:!0});const d=t.computed(()=>r.value.category),u=t.ref(null),f=t.ref(null),h=t.computed(()=>d.value.products??[]),p=t.computed(()=>h.value.map(H=>({label:H.name,value:H.id}))),m=(H,T,D)=>{const K=H!=null&&H>0,J=T!=null&&T>0;return!K&&!J?null:K&&J?`от ${H} ${D} до ${T} ${D}`:K?`от ${H} ${D}`:`до ${T} ${D}`},g=t.computed(()=>{var H,T;return m(r.settings.minWidth,(T=(H=u.value)==null?void 0:H.properties)==null?void 0:T.width,"мм")}),b=t.computed(()=>{var H,T;return m(r.settings.minLength,(T=(H=u.value)==null?void 0:H.properties)==null?void 0:T.length,"мм")}),y=t.ref(null),_=t.ref(!1),x=t.computed(()=>{var T;const H={marker:[We.serverValidation((T=l.value.marker)==null?void 0:T.feedback)]};return a.value.configuratorParams.items.forEach((D,K)=>{var J,U,q,L,le,ue,oe;H[`configuratorParams.items.${K}.width`]=[ce.required,ce.min(r.settings.minWidth),...(U=(J=u.value)==null?void 0:J.properties)!=null&&U.width?[ce.max(u.value.properties.width)]:[],ce.step(1),We.serverValidation((q=l.value[`items.${K}.width`])==null?void 0:q.feedback)],H[`configuratorParams.items.${K}.length`]=[ce.required,ce.min(r.settings.minLength),...(le=(L=u.value)==null?void 0:L.properties)!=null&&le.length?[ce.max(u.value.properties.length)]:[],ce.step(1),We.serverValidation((ue=l.value[`items.${K}.length`])==null?void 0:ue.feedback)],H[`configuratorParams.items.${K}.count`]=[ce.required,ce.min(1),ce.step(1),We.serverValidation((oe=l.value[`items.${K}.count`])==null?void 0:oe.feedback)]}),H}),w=t.ref(r.settings.canSetDopProdaga??!1),C=t.computed(()=>a.value.configuratorParams.items.some(H=>{var T,D;return!u.value||!H.width||H.width<r.settings.minWidth||H.width>(((T=u.value.properties)==null?void 0:T.width)??0)||H.length===0||H.length<r.settings.minLength||H.length>(((D=u.value.properties)==null?void 0:D.length)??0)||!H.count||H.count<1})),N=t.computed(()=>!u.value||C.value||a.value.configuratorParams.items.length===0),k=t.ref(null),$=t.computed(()=>k.value===null?"":Ve.formatMoney(k.value)),v=H=>{if(!H){u.value=null,f.value=null,a.value.product=new W.ClientProduct,y.value=null;return}const T=h.value.find(D=>D.id===H);T&&(u.value=T,f.value=H,a.value.product=T,O("product",a.value.product),a.value.configuratorParams.items.forEach(D=>{var K,J;(K=T.properties)!=null&&K.width&&D.width>T.properties.width&&(D.width=T.properties.width),(J=T.properties)!=null&&J.length&&D.length>T.properties.length&&(D.length=T.properties.length)}),P())};let E=!1;const P=()=>{E=!0,y.value=null,k.value=null,a.value.configuratorParams.calculationId="",a.value.quantity=0},F=async()=>{var H;if(!u.value||a.value.configuratorParams.items.length===0||C.value){P();return}(H=s.value)==null||H.validate(T=>{if(T){P();return}if(_.value=!0,!u.value||!d.value){P(),_.value=!1;return}r.eventEmitter.emit("configurator:calculate",{category:d.value,params:{productId:u.value.id,items:a.value.configuratorParams.items},callback:D=>{D?(y.value=D,a.value.configuratorParams.calculationId=D.id,a.value.quantity=D.quantity,t.nextTick(()=>{O("quantity",D.quantity)})):(a.value.configuratorParams.calculationId="",a.value.quantity=0,P()),O("configuratorParams",a.value.configuratorParams),R(),_.value=!1}})}).catch(()=>{P(),_.value=!1})},R=()=>{var T;if(!((T=u.value)!=null&&T.costRub)||!y.value){k.value=null;return}const H=y.value.quantity*u.value.costRub;k.value=Ve.roundMoney(H)},M=H=>{var D,K;const T=a.value.configuratorParams.items[H];u.value&&((D=u.value.properties)!=null&&D.width&&T.width>u.value.properties.width&&(T.width=u.value.properties.width),(K=u.value.properties)!=null&&K.length&&T.length>u.value.properties.length&&(T.length=u.value.properties.length)),O("configuratorParams",a.value.configuratorParams),P()},X=()=>{a.value.configuratorParams.calculationId="",a.value.configuratorParams.items.push({width:0,length:0,count:1}),O("configuratorParams",a.value.configuratorParams),P(),o("add-item",a.value.configuratorParams.items.length)},G=H=>{a.value.configuratorParams.items.splice(H,1),O("configuratorParams",a.value.configuratorParams),P(),o("remove-item",H)},Z=()=>{if(!(N.value||_.value||r.isSubmitProcessing)){if(!y.value){F();return}o("submit",a.value)}},O=(H,T)=>{const D=new W.OrderItemBase(r.value);D[H]=T,o("update:value",D)};t.watch(()=>r.value,H=>{const T=V.cloneDeep(t.toRaw(H));(!T.configuratorParams.items||T.configuratorParams.items.length===0)&&(T.configuratorParams.items=[{width:0,length:0,count:1}]),a.value=T,r.value.product&&!r.value.product.isNewRec()&&(u.value=r.value.product,f.value=r.value.product.id),r.value.product.isNewRec()&&(u.value=null,f.value=null),E?E=!1:A()},{deep:!0});const A=()=>{const{calculationId:H}=a.value.configuratorParams,T=a.value.quantity??0;H&&T>0&&a.value.product&&!a.value.product.isNewRec()&&(y.value={id:H,quantity:T,sheets:[]},R())};return t.onMounted(()=>{r.value.product&&!r.value.product.isNewRec()&&(u.value=r.value.product,f.value=r.value.product.id),A()}),e({validate:(Y=s.value)==null?void 0:Y.validate,formReference:s}),(H,T)=>{const D=yo,K=Xu;return t.withDirectives((t.openBlock(),t.createBlock(t.unref(I.NForm),{ref:"form-reference",model:a.value,rules:x.value,class:"flex flex-col gap-2 sc-hide-empty-feedback-message"},{default:t.withCtx(()=>{var J;return[t.createVNode(t.unref(I.NFormItem),{required:!0,"show-feedback":!1,label:"Товар"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NSelect),{value:f.value,"onUpdate:value":[T[0]||(T[0]=U=>f.value=U),v],options:p.value,placeholder:"Выберите материал",filterable:""},null,8,["value","options"])]),_:1}),((J=u.value)==null?void 0:J.costRub)!=null?(t.openBlock(),t.createElementBlock("div",Jb,[t.createElementVNode("span",e_,t.toDisplayString(u.value.code),1),t.createTextVNode(" — "+t.toDisplayString(t.unref(Ve).formatMoney(u.value.costRub))+" "+t.toDisplayString(u.value.currency.symbol)+"/шт. ",1)])):t.createCommentVNode("",!0),t.createElementVNode("div",t_,[u.value?(t.openBlock(),t.createElementBlock("div",n_,[T[7]||(T[7]=t.createElementVNode("div",{class:"w-full font-bold"},"Размеры изделий",-1)),t.createElementVNode("div",i_,[g.value?(t.openBlock(),t.createElementBlock("div",r_,"Ширина "+t.toDisplayString(g.value)+".",1)):t.createCommentVNode("",!0),b.value?(t.openBlock(),t.createElementBlock("div",o_,"Длина "+t.toDisplayString(b.value)+".",1)):t.createCommentVNode("",!0)])])):t.createCommentVNode("",!0),t.createElementVNode("div",s_,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value.configuratorParams.items,(U,q)=>(t.openBlock(),t.createElementBlock("div",{key:q,class:"flex grow gap-2"},[t.createElementVNode("div",a_,[t.createVNode(t.unref(I.NFormItem),{path:`configuratorParams.items.${q}.width`,label:"Ширина, мм"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:a.value.configuratorParams.items[q].width,"onUpdate:value":[L=>a.value.configuratorParams.items[q].width=L,L=>M(q)],parse:t.unref(ht),"show-button":!1,disabled:!u.value,placeholder:"Ширина",class:"w-full",onKeydown:T[1]||(T[1]=L=>t.unref(ft)(L)),onInput:L=>c(`items.${q}.width`),onFocus:t.unref(He)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),t.createVNode(t.unref(I.NFormItem),{path:`configuratorParams.items.${q}.length`,label:"Длина, мм"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:a.value.configuratorParams.items[q].length,"onUpdate:value":[L=>a.value.configuratorParams.items[q].length=L,L=>M(q)],parse:t.unref(ht),"show-button":!1,disabled:!u.value,placeholder:"Длина",class:"w-full",onKeydown:T[2]||(T[2]=L=>t.unref(ft)(L)),onInput:L=>c(`items.${q}.length`),onFocus:t.unref(He)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),t.createVNode(t.unref(I.NFormItem),{path:`configuratorParams.items.${q}.count`,label:"Количество, шт"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:a.value.configuratorParams.items[q].count,"onUpdate:value":[L=>a.value.configuratorParams.items[q].count=L,L=>M(q)],parse:t.unref(ht),"show-button":!1,disabled:!u.value,placeholder:"Количество",class:"w-full",onKeydown:T[3]||(T[3]=L=>t.unref(ft)(L,!1)),onInput:L=>c(`items.${q}.count`),onFocus:t.unref(He)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"])]),t.createVNode(t.unref(I.NButton),{disabled:!u.value||a.value.configuratorParams.items.length<=1,type:"error",size:"medium",class:"mt-5",onClick:L=>G(q)},{default:t.withCtx(()=>[t.createVNode(D)]),_:1},8,["disabled","onClick"])]))),128))]),u.value?(t.openBlock(),t.createBlock(t.unref(I.NButton),{key:1,disabled:C.value,type:"default",class:"self-center",onClick:X},{default:t.withCtx(()=>[t.createVNode(K),T[8]||(T[8]=t.createTextVNode(" Добавить изделие ",-1))]),_:1},8,["disabled"])):t.createCommentVNode("",!0)]),t.createVNode(t.unref(I.NFormItem),{path:"marker",label:"Маркировка распила"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInput),{value:a.value.marker??null,disabled:!u.value,placeholder:"Введите маркировку распила",onInput:T[4]||(T[4]=U=>c("marker")),"onUpdate:value":T[5]||(T[5]=U=>O("marker",U??null)),onFocus:t.unref(He)},null,8,["value","disabled","onFocus"])]),_:1}),w.value?(t.openBlock(),t.createBlock(t.unref(I.NCheckbox),{key:1,checked:a.value.isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":T[6]||(T[6]=U=>{a.value.isAdditionalSale=U??!1,O("isAdditionalSale",U??!1)})},{default:t.withCtx(()=>[...T[9]||(T[9]=[t.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):t.createCommentVNode("",!0),t.createVNode(t.unref(I.NSpin),{show:_.value,size:"small",class:"grow"},{default:t.withCtx(()=>[y.value&&u.value&&k.value?(t.openBlock(),t.createElementBlock("div",l_,[t.createElementVNode("div",null,[T[10]||(T[10]=t.createTextVNode(" Итого: ",-1)),t.createElementVNode("span",c_,t.toDisplayString($.value)+" "+t.toDisplayString(u.value.currency.symbol),1)]),y.value.quantity&&u.value?(t.openBlock(),t.createElementBlock("div",d_,[t.createElementVNode("span",u_,"("+t.toDisplayString(y.value.quantity)+" шт.",1),T[11]||(T[11]=t.createTextVNode(" x ",-1)),t.createElementVNode("span",f_,t.toDisplayString(t.unref(Ve).formatMoney(u.value.costRub))+" "+t.toDisplayString(u.value.currency.symbol)+"/шт.)",1)])):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)]),_:1},8,["show"]),t.createElementVNode("div",h_,[y.value&&!_.value?(t.openBlock(),t.createBlock(t.unref(I.NButton),{key:0,loading:n.isSubmitProcessing,disabled:N.value||_.value,type:"primary",class:"self-start",onClick:Z},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(a.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["loading","disabled"])):(t.openBlock(),t.createBlock(t.unref(I.NButton),{key:1,loading:_.value,disabled:N.value||_.value,type:"info",class:"self-start",onClick:F},{default:t.withCtx(()=>[...T[12]||(T[12]=[t.createTextVNode(" Рассчитать ",-1)])]),_:1},8,["loading","disabled"]))])]}),_:1},8,["model","rules"])),[[t.unref(ai),Z]])}}}),p_={class:"flex flex-col gap-2"},g_={class:"w-104 flex grow flex-col px-5"},y_={},Uu=t.defineComponent({...y_,__name:"sandwich-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showProductInfoButton:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{type:Function},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{type:Function},settings:{},cartItem:{}},emits:["submit","click:view-switch"],setup(n,{emit:e}){const i=n,r=e,o=t.useTemplateRef("sandwich-configurator-form"),s=t.ref(i.cartItem),a=t.ref({width:{},length:{},quantity:{},marker:{},product:{}}),l=t.ref(!1),c=async()=>{var f,h;(h=(f=o.value)==null?void 0:f.formReference)==null||h.validate(p=>{if(!p){l.value=!0;const m=V.cloneDeep(s.value);"items"in m.configuratorParams&&delete m.configuratorParams.items,r("submit",m,a.value,()=>{l.value=!1,t.nextTick(()=>{var g,b;(b=(g=o.value)==null?void 0:g.formReference)==null||b.restoreValidation()})})}}).catch(V.noop)},d=f=>{a.value[`items.${f}.width`]={},a.value[`items.${f}.length`]={},a.value[`items.${f}.count`]={}},u=f=>{delete a.value[`items.${f}.width`],delete a.value[`items.${f}.length`],delete a.value[`items.${f}.count`]};return t.onMounted(()=>{i.cartItem.configuratorParams.items.forEach((f,h)=>{a.value[`items.${h}.width`]={},a.value[`items.${h}.length`]={},a.value[`items.${h}.count`]={}})}),t.watch(()=>i.cartItem,f=>{s.value=new W.OrderItemBase(f)},{deep:!0}),(f,h)=>{const p=I.NButton;return t.openBlock(),t.createElementBlock("div",p_,[n.settings.allowShowTable&&s.value.isNewRec()?(t.openBlock(),t.createBlock(p,{key:0,type:"tertiary",class:"self-center",onClick:h[0]||(h[0]=m=>r("click:view-switch"))},{default:t.withCtx(()=>[...h[2]||(h[2]=[t.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):t.createCommentVNode("",!0),t.createElementVNode("div",g_,[t.createVNode(Yu,{ref:"sandwich-configurator-form",value:s.value,"onUpdate:value":h[1]||(h[1]=m=>s.value=m),validation:a.value,settings:n.settings,"event-emitter":n.eventEmitter,"is-submit-processing":l.value,onSubmit:c,onAddItem:d,onRemoveItem:u},null,8,["value","validation","settings","event-emitter","is-submit-processing"])])])}}}),b_={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function __(n,e){return t.openBlock(),t.createElementBlock("svg",b_,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M416 128L192 384l-96-96"},null,-1)])])}const w_=t.markRaw({name:"ion-checkmark",render:__}),x_={key:0,class:"-mt-1 text-sm text-gray-500"},k_={class:"font-bold"},C_={class:"flex flex-col gap-3"},v_={key:0,class:"mt-4 mb-3 flex flex-col gap-1.5"},S_={class:"flex flex-col gap-1 text-sm text-gray-700"},B_={key:0},N_={key:1},T_={"form-array-name":"items",class:"flex flex-col gap-3"},$_={class:"min-w-0 flex-1"},E_={class:"relative flex flex-col gap-3 lg:!flex-row lg:!items-start lg:!gap-6"},R_={class:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:!flex-[2]"},P_={class:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:!grid-cols-[1fr_2fr] lg:!flex-[3]"},F_={key:0,class:"pointer-events-none absolute bottom-2 right-3 flex h-8 w-8 items-center justify-center"},V_={class:"mt-1 flex flex-col gap-y-1 text-sm text-gray-500 lg:!flex-row lg:!gap-6"},M_={key:0,class:"lg:!flex-[2]"},I_={class:"font-bold"},A_={key:1,class:"lg:!flex-[3]"},O_={class:"font-bold"},z_={key:1,class:"min-w-0 flex flex-col items-end gap-1 text-right text-sm text-gray-700 border-t border-gray-200 pt-2"},D_={key:0},L_={class:"font-bold"},H_={key:1},W_={class:"font-bold"},j_={class:"flex flex-wrap items-center gap-3"},q_={},Ku=t.defineComponent({...q_,__name:"sandwich-m2-configurator-form",props:{value:{},eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showProductInfoButton:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{},settings:{},isProductSearching:{type:Boolean,default:!1},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0},itemStates:{default:()=>[]}},emits:["submit","update:value","add-item","remove-item","item-reset"],setup(n,{expose:e,emit:i}){var J;const r=n,o=i,s=t.useTemplateRef("form-reference"),a=t.useTemplateRef("widthInputs"),l=r.value==null?[]:V.cloneDeep(t.toRaw(r.value)),c=t.ref(l.map(U=>new W.OrderItemBase(U))),d=t.computed(()=>({items:c.value})),u=t.ref({...r.validation}),f=U=>{var q;delete u.value[U],(q=s.value)==null||q.restoreValidation()},h=t.ref(null),p=t.ref(null),m=t.computed(()=>{var U,q;return((q=(U=c.value[0])==null?void 0:U.category)==null?void 0:q.products)??[]}),g=t.computed(()=>m.value.map(U=>({label:U.name,value:U.id}))),b=(U,q,L)=>{const le=U!=null&&U>0,ue=q!=null&&q>0;return!le&&!ue?null:le&&ue?`от ${U} ${L} до ${q} ${L}`:le?`от ${U} ${L}`:`до ${q} ${L}`},y=t.computed(()=>{var U,q;return b(r.settings.minWidth,(q=(U=h.value)==null?void 0:U.properties)==null?void 0:q.width,"мм")}),_=t.computed(()=>{var U,q;return b(r.settings.minLength,(q=(U=h.value)==null?void 0:U.properties)==null?void 0:q.length,"мм")}),x=t.computed(()=>{const U={};return c.value.forEach((q,L)=>{var le,ue,oe,fe,ge,_e,Qe,Re;U[`items.${L}.configuratorParams.width`]=[ce.required,ce.min(r.settings.minWidth),...(ue=(le=h.value)==null?void 0:le.properties)!=null&&ue.width?[ce.max(h.value.properties.width)]:[],ce.step(1),We.serverValidation((oe=u.value[`items.${L}.width`])==null?void 0:oe.feedback)],U[`items.${L}.configuratorParams.length`]=[ce.required,ce.min(r.settings.minLength),...(ge=(fe=h.value)==null?void 0:fe.properties)!=null&&ge.length?[ce.max(h.value.properties.length)]:[],ce.step(1),We.serverValidation((_e=u.value[`items.${L}.length`])==null?void 0:_e.feedback)],U[`items.${L}.quantity`]=[ce.required,ce.min(1),ce.step(1),We.serverValidation((Qe=u.value[`items.${L}.quantity`])==null?void 0:Qe.feedback)],U[`items.${L}.marker`]=[We.serverValidation((Re=u.value[`items.${L}.marker`])==null?void 0:Re.feedback)]}),U});t.watch(()=>r.validation,U=>{u.value={...U},Object.values(U).some(L=>L==null?void 0:L.feedback)&&t.nextTick(()=>{var L;return(L=s.value)==null?void 0:L.validate(V.noop).catch(V.noop)})},{deep:!0});const w=t.ref(r.settings.canSetDopProdaga??!1),C=t.computed(()=>{const U=h.value;return U?c.value.some(q=>{var oe,fe;const L=q.configuratorParams,le=(oe=U.properties)==null?void 0:oe.width,ue=(fe=U.properties)==null?void 0:fe.length;return L.width===0||L.width<r.settings.minWidth||le!=null&&L.width>le||L.length===0||L.length<r.settings.minLength||ue!=null&&L.length>ue||q.quantity===0||q.quantity<1}):!0}),N=t.computed(()=>!h.value||C.value||c.value.length===0),k=t.computed(()=>{const U=c.value[0];return U!=null&&!U.isNewRec()}),$=U=>r.itemStates[U]??"idle",v=U=>$(U)==="success",E=U=>$(U)==="loading",P=t.computed(()=>c.value.length===0?!0:c.value.every((U,q)=>{const L=$(q);return L==="success"||L==="loading"})),F=U=>U.width===0||U.length===0?0:U.width*U.length/1e6,R=U=>Ve.formatArea(F(U)),M=U=>{var oe;const q=U.configuratorParams,L=F(q),le=((oe=h.value)==null?void 0:oe.costRub)??0,ue=U.quantity??0;return!L||!ue?0:Ve.roundMoney(L*le*ue)},X=t.computed(()=>V.sum(c.value.map(U=>{const q=U.configuratorParams;return!q.width||q.length===0||!U.quantity?0:q.width*q.length*U.quantity/1e6}))),G=t.computed(()=>Ve.roundMoney(V.sum(c.value.map(U=>M(U))))),Z=()=>{var U,q,L;return new W.OrderItemBase({category:(U=c.value[0])==null?void 0:U.category,configurator:(q=c.value[0])==null?void 0:q.configurator,product:h.value??new W.ClientProduct,quantity:1,isAdditionalSale:(L=c.value[0])==null?void 0:L.isAdditionalSale,configuratorParams:{width:0,length:0}})},O=U=>{if(!U){h.value=null,p.value=null,c.value.forEach(L=>{L.product=new W.ClientProduct}),o("update:value",c.value);return}const q=m.value.find(L=>L.id===U);q&&(h.value=q,p.value=U,c.value.forEach((L,le)=>{var ue,oe;L.product=q,(ue=q.properties)!=null&&ue.width&&L.configuratorParams.width>q.properties.width&&(L.configuratorParams.width=q.properties.width),(oe=q.properties)!=null&&oe.length&&L.configuratorParams.length>q.properties.length&&(L.configuratorParams.length=q.properties.length),o("item-reset",le)}),o("update:value",c.value))},A=U=>{var le,ue;const q=c.value[U],L=h.value;L&&((le=L.properties)!=null&&le.width&&q.configuratorParams.width>L.properties.width&&(q.configuratorParams.width=L.properties.width),(ue=L.properties)!=null&&ue.length&&q.configuratorParams.length>L.properties.length&&(q.configuratorParams.length=L.properties.length)),o("item-reset",U),o("update:value",c.value)},Y=(U,q)=>{c.value[U].marker=q===null||q===""?void 0:q,o("item-reset",U),o("update:value",c.value)},H=U=>{c.value.forEach(q=>{q.isAdditionalSale=U}),o("update:value",c.value)},T=()=>{c.value.push(Z()),o("update:value",c.value),o("add-item",c.value.length),t.nextTick(()=>{var q,L,le,ue;const U=c.value.length-1;(L=(q=a.value)==null?void 0:q[U])==null||L.focus(),(ue=(le=a.value)==null?void 0:le[U])==null||ue.select()})},D=U=>{c.value.splice(U,1),o("update:value",c.value),o("remove-item",U)};t.watch(()=>r.value,U=>{var ue;const L=(U==null?[]:V.cloneDeep(t.toRaw(U))).map(oe=>new W.OrderItemBase(oe));c.value=L.length>0?L:[Z()];const le=(ue=c.value[0])==null?void 0:ue.product;le&&!le.isNewRec()?(h.value=le,p.value=le.id):(h.value=null,p.value=null)},{deep:!0});const K=()=>{var q;if(h.value!==null)return;const U=(q=m.value[0])==null?void 0:q.id;U!=null&&O(U)};return t.watch(m,()=>{K()}),t.onMounted(()=>{var q;c.value.length===0&&(c.value=[Z()]);const U=(q=c.value[0])==null?void 0:q.product;U&&!U.isNewRec()&&(h.value=U,p.value=U.id),K()}),e({validate:(J=s.value)==null?void 0:J.validate,formReference:s}),(U,q)=>{const L=w_,le=yo,ue=Xu;return t.withDirectives((t.openBlock(),t.createBlock(t.unref(I.NForm),{ref:"form-reference",model:d.value,rules:x.value,class:"flex flex-col gap-2 sc-hide-empty-feedback-message"},{default:t.withCtx(()=>{var oe,fe;return[t.createVNode(t.unref(I.NFormItem),{required:!0,"show-feedback":!1,label:"Товар"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NSelect),{value:p.value,"onUpdate:value":[q[0]||(q[0]=ge=>p.value=ge),O],options:g.value,placeholder:"Выберите материал",filterable:""},null,8,["value","options"])]),_:1}),((oe=h.value)==null?void 0:oe.costRub)!=null?(t.openBlock(),t.createElementBlock("div",x_,[t.createElementVNode("span",k_,t.toDisplayString(h.value.code),1),t.createTextVNode(" — "+t.toDisplayString(t.unref(Ve).formatMoney(h.value.costRub))+" "+t.toDisplayString(h.value.currency.symbol)+"/м² ",1)])):t.createCommentVNode("",!0),t.createElementVNode("div",C_,[h.value?(t.openBlock(),t.createElementBlock("div",v_,[q[6]||(q[6]=t.createElementVNode("div",{class:"w-full font-bold"},"Размеры изделий",-1)),t.createElementVNode("div",S_,[y.value?(t.openBlock(),t.createElementBlock("div",B_,"Ширина "+t.toDisplayString(y.value)+".",1)):t.createCommentVNode("",!0),_.value?(t.openBlock(),t.createElementBlock("div",N_,"Длина "+t.toDisplayString(_.value)+".",1)):t.createCommentVNode("",!0)])])):t.createCommentVNode("",!0),t.createElementVNode("div",T_,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.value.items,(ge,_e)=>{var Qe;return t.openBlock(),t.createElementBlock("div",{key:_e,class:t.normalizeClass(["flex min-w-0 items-start gap-2 border-b border-gray-100 last:border-0",v(_e)?"opacity-70":""])},[t.createElementVNode("div",$_,[t.createElementVNode("div",E_,[t.createElementVNode("div",R_,[t.createVNode(t.unref(I.NFormItem),{path:`items.${_e}.configuratorParams.width`,label:"Ширина, мм",class:"min-w-0"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{ref_for:!0,ref:"widthInputs",value:d.value.items[_e].configuratorParams.width,"onUpdate:value":[Re=>d.value.items[_e].configuratorParams.width=Re,Re=>A(_e)],parse:t.unref(ht),"show-button":!1,disabled:!h.value||v(_e)||E(_e),placeholder:"Ширина",class:"w-full",onKeydown:q[1]||(q[1]=Re=>t.unref(ft)(Re)),onInput:Re=>f(`items.${_e}.width`),onFocus:t.unref(He)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),t.createVNode(t.unref(I.NFormItem),{path:`items.${_e}.configuratorParams.length`,label:"Длина, мм",class:"min-w-0"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:d.value.items[_e].configuratorParams.length,"onUpdate:value":[Re=>d.value.items[_e].configuratorParams.length=Re,Re=>A(_e)],parse:t.unref(ht),"show-button":!1,disabled:!h.value||v(_e)||E(_e),placeholder:"Длина",class:"w-full",onKeydown:q[2]||(q[2]=Re=>t.unref(ft)(Re)),onInput:Re=>f(`items.${_e}.length`),onFocus:t.unref(He)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"])]),t.createElementVNode("div",P_,[t.createVNode(t.unref(I.NFormItem),{path:`items.${_e}.quantity`,label:"Количество, шт",class:"min-w-0"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:d.value.items[_e].quantity,"onUpdate:value":[Re=>d.value.items[_e].quantity=Re,Re=>A(_e)],parse:t.unref(ht),"show-button":!1,disabled:!h.value||v(_e)||E(_e),placeholder:"Кол-во",class:"w-full",onKeydown:q[3]||(q[3]=Re=>t.unref(ft)(Re,!1)),onInput:Re=>f(`items.${_e}.quantity`),onFocus:t.unref(He)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),t.createVNode(t.unref(I.NFormItem),{path:`items.${_e}.marker`,label:"Маркировка",class:"min-w-0"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInput),{value:d.value.items[_e].marker??null,disabled:!h.value||v(_e)||E(_e),placeholder:"Маркировка",class:"w-full",onInput:Re=>f(`items.${_e}.marker`),"onUpdate:value":Re=>Y(_e,Re??null),onFocus:t.unref(He)},null,8,["value","disabled","onInput","onUpdate:value","onFocus"])]),_:2},1032,["path"])]),E(_e)||v(_e)?(t.openBlock(),t.createElementBlock("div",F_,[E(_e)?(t.openBlock(),t.createBlock(t.unref(I.NSpin),{key:0,size:14})):v(_e)?(t.openBlock(),t.createBlock(L,{key:1,class:"text-green-600 text-xl"})):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)]),t.createElementVNode("div",V_,[ge.configuratorParams.width>0&&ge.configuratorParams.length>0?(t.openBlock(),t.createElementBlock("div",M_,[q[7]||(q[7]=t.createTextVNode(" Площадь (S) = ",-1)),t.createElementVNode("span",I_,t.toDisplayString(R(ge.configuratorParams))+" м²",1)])):t.createCommentVNode("",!0),M(ge)>0?(t.openBlock(),t.createElementBlock("div",A_,[q[8]||(q[8]=t.createTextVNode(" Итого: ",-1)),t.createElementVNode("span",O_,t.toDisplayString(t.unref(Ve).formatMoney(M(ge)))+" "+t.toDisplayString((Qe=h.value)==null?void 0:Qe.currency.symbol),1)])):t.createCommentVNode("",!0)])]),k.value?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(t.unref(I.NButton),{key:0,disabled:E(_e)||d.value.items.length<=1,type:"error",size:"medium",class:"mt-5 shrink-0 lg:!ml-4",onClick:Re=>D(_e)},{default:t.withCtx(()=>[t.createVNode(le)]),_:1},8,["disabled","onClick"]))],2)}),128))]),h.value?(t.openBlock(),t.createElementBlock("div",z_,[X.value>0?(t.openBlock(),t.createElementBlock("div",D_,[q[9]||(q[9]=t.createTextVNode(" Общая площадь: ",-1)),t.createElementVNode("span",L_,t.toDisplayString(t.unref(Ve).formatArea(X.value))+" м²",1)])):t.createCommentVNode("",!0),G.value>0?(t.openBlock(),t.createElementBlock("div",H_,[q[10]||(q[10]=t.createTextVNode(" Итого: ",-1)),t.createElementVNode("span",W_,t.toDisplayString(t.unref(Ve).formatMoney(G.value))+" "+t.toDisplayString(h.value.currency.symbol),1)])):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)]),w.value?(t.openBlock(),t.createBlock(t.unref(I.NCheckbox),{key:1,checked:((fe=c.value[0])==null?void 0:fe.isAdditionalSale)??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":q[4]||(q[4]=ge=>H(ge??!1))},{default:t.withCtx(()=>[...q[11]||(q[11]=[t.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):t.createCommentVNode("",!0),t.createElementVNode("div",j_,[h.value&&!k.value?(t.openBlock(),t.createBlock(t.unref(I.NButton),{key:0,disabled:C.value,type:"default",onClick:T},{default:t.withCtx(()=>[t.createVNode(ue),q[12]||(q[12]=t.createTextVNode(" Добавить изделие ",-1))]),_:1},8,["disabled"])):t.createCommentVNode("",!0),t.createVNode(t.unref(I.NButton),{loading:n.isSubmitProcessing,disabled:N.value||P.value,type:"primary",class:"ml-auto",onClick:q[5]||(q[5]=ge=>o("submit",c.value))},{default:t.withCtx(()=>{var ge;return[t.createTextVNode(t.toDisplayString((ge=c.value[0])!=null&&ge.isNewRec()?"В корзину":"Изменить"),1)]}),_:1},8,["loading","disabled"])])]}),_:1},8,["model","rules"])),[[t.unref(ai),()=>o("submit",c.value)]])}}}),X_={class:"flex flex-col gap-2"},Y_={class:"min-w-56 max-w-3xl flex grow flex-col px-5"},U_={},Gu=t.defineComponent({...U_,__name:"sandwich-m2-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showProductInfoButton:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{type:Function},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{type:Function},settings:{},cartItems:{}},emits:["click:view-switch","submit"],setup(n,{emit:e}){const i=n,r=e,o=t.useTemplateRef("sandwich-m2-configurator-form"),s=t.ref((i.cartItems??[]).map(x=>new W.OrderItemBase(x))),a=t.ref([]),l=t.ref({width:{},length:{},quantity:{},marker:{}}),c=["width","length","quantity","marker"],d=x=>{c.forEach(w=>{l.value[`items.${x}.${w}`]={}})},u=x=>{c.forEach(w=>{delete l.value[`items.${x}.${w}`]})},f=t.computed(()=>a.value.includes("loading")),h=()=>({width:{},length:{},quantity:{},marker:{}}),p=(x,w)=>{let C=!1;return c.forEach(N=>{var F,R;const k=`items.0.${N}`,$=(F=x[N])==null?void 0:F.feedback,E=((R=x[k])==null?void 0:R.feedback)??$,P=`items.${w}.${N}`;E?(l.value[P]=x[k]??x[N],C=!0):l.value[P]={}}),C},m=(x,w,C)=>new Promise(N=>{const k=h();let $=!1;const v=E=>{if($)return;$=!0;const P=p(k,w),F=(E===void 0?!P:E)&&!P;a.value[w]=F?"success":"error",t.nextTick(()=>{var R,M;(M=(R=o.value)==null?void 0:R.formReference)==null||M.restoreValidation()}),N(F)};a.value[w]="loading",r("submit",[V.cloneDeep(x)],k,v,{isFinalSuccessfulCompletion:C})}),g=async()=>{var C,N;try{await((N=(C=o.value)==null?void 0:C.formReference)==null?void 0:N.validate())}catch{return}const x=s.value.map((k,$)=>$).filter(k=>{const $=a.value[k]??"idle";return $!=="success"&&$!=="loading"});let w=!0;for(let k=0;k<x.length;k+=1){const $=x[k],v=s.value[$];if(!v)break;const P=k===x.length-1&&w;await m(v,$,P)||(w=!1)}},b=x=>{const w=x-1;a.value[w]="idle",d(w)},y=x=>{a.value.splice(x,1),u(x);for(let w=x;w<s.value.length;w+=1)d(w)},_=x=>{const w=a.value[x];(w==="success"||w==="error")&&(a.value[x]="idle")};return t.onMounted(()=>{(i.cartItems??[]).forEach((x,w)=>{a.value[w]="idle",d(w)})}),t.watch(()=>i.cartItems,x=>{const w=(x??[]).map(C=>new W.OrderItemBase(C));s.value=w,a.value=w.map(()=>"idle"),w.forEach((C,N)=>{d(N)})},{deep:!0}),(x,w)=>{var N;const C=I.NButton;return t.openBlock(),t.createElementBlock("div",X_,[n.settings.allowShowTable&&((N=s.value[0])!=null&&N.isNewRec())?(t.openBlock(),t.createBlock(C,{key:0,type:"tertiary",class:"self-center",onClick:w[0]||(w[0]=k=>r("click:view-switch"))},{default:t.withCtx(()=>[...w[2]||(w[2]=[t.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):t.createCommentVNode("",!0),t.createElementVNode("div",Y_,[t.createVNode(Ku,{ref:"sandwich-m2-configurator-form",value:s.value,"onUpdate:value":w[1]||(w[1]=k=>s.value=k),validation:l.value,settings:n.settings,"event-emitter":n.eventEmitter,"is-submit-processing":f.value,"item-states":a.value,onSubmit:g,onAddItem:b,onRemoveItem:y,onItemReset:_},null,8,["value","validation","settings","event-emitter","is-submit-processing","item-states"])])])}}}),K_={key:0,class:"flex justify-center p-4"},G_={key:1,class:"p-4 text-center text-red-500"},Z_={key:2,class:"flex justify-center"},Q_={class:"!bg-white p-4 m-2 rounded-md w-max"},J_={key:3,class:"p-4 text-center text-gray-500"},ew={},Zu=t.defineComponent({...ew,__name:"dynamic-configurator",props:{eventEmitter:{},settings:{},editor:{},cartItem:{},cartItems:{},category:{}},setup(n){const e=n,i=t.ref(!1),r=t.ref(null),o=t.ref(e.cartItem??null),s=t.ref(e.cartItems??null),a=h=>{const p=h.configuratorParams;return[new W.OrderItemBase({...h,quantity:h.quantity??1,marker:h.marker,configuratorParams:{width:(p==null?void 0:p.width)??h.width??0,length:(p==null?void 0:p.length)??h.length??0}})]},l=t.ref(e.editor===W.ConfiguratorsEnum.SandwichM2&&e.cartItem!=null?a(e.cartItem):null),c=()=>{var p,m,g;if(!e.settings){r.value="Настройки конфигуратора не указаны в свойствах категории.";return}const h={category:((p=e.cartItem)==null?void 0:p.category)??e.category,configurator:e.editor,quantity:1};switch(e.editor){case"kozyrek":{const b=e.settings;o.value=new W.OrderItemBase({...h,configuratorParams:{length:b.stripMinLength,linesAngles:[],linesWidths:[],startTailType:V.some(b.startTailConfigs,y=>y.isDefault)?(m=b.startTailConfigs)==null?void 0:m.findIndex(y=>y.isDefault):void 0,endTailType:V.some(b.endTailConfigs,y=>y.isDefault)?(g=b.endTailConfigs)==null?void 0:g.findIndex(y=>y.isDefault):void 0,colorSide:"top"}});break}case"mosquitto":{const b=e.settings;o.value=new W.OrderItemBase({...h,configuratorParams:{width:0,height:0,netType:b.netType[0]||"",color:b.color[0]||"",mountType:b.mountType[0]||""}});break}case"strip":{const b=e.settings;s.value=[new W.OrderItemBase({...h,length:b.minLength,configuratorParams:{linesWidths:[0]}})];break}case"metal_for_doors":{const b=e.settings;o.value=new W.OrderItemBase({...h,configuratorParams:{width:b.minWidth,length:b.minLength}});break}case"sandwich":{o.value=new W.OrderItemBase({...h,configuratorParams:{calculationId:"",items:[{width:0,length:0,count:1}]}});break}case"sandwich_m2":{l.value=[new W.OrderItemBase({...h,configuratorParams:{width:0,length:0}})];break}default:r.value=`Неподдерживаемый тип конфигуратора: ${e.editor}.`}o.value&&(o.value.marker=void 0)},d=(h,p,m)=>{const g=b=>{m==null||m(),b&&c()};e.eventEmitter.emit("configurator:submit",{cartItem:h,callback:g,validation:p})},u=(h,p,m,g)=>{const b=h[0];if(!b){m==null||m();return}const y=(g==null?void 0:g.isFinalSuccessfulCompletion)===!0,_=x=>{m==null||m(x),y&&x&&c()};e.eventEmitter.emit("configurator:submit",{cartItem:b,callback:_,validation:p,additionalParams:g})},f=()=>{e.category&&e.eventEmitter.emit("configurator:click-view-switch",{category:e.category})};return t.onMounted(()=>{!e.cartItem&&!e.cartItems&&c()}),(h,p)=>{const m=I.NSpin;return t.openBlock(),t.createElementBlock(t.Fragment,null,[i.value?(t.openBlock(),t.createElementBlock("div",K_,[t.createVNode(m,{size:"large"})])):r.value?(t.openBlock(),t.createElementBlock("div",G_,t.toDisplayString(r.value),1)):t.createCommentVNode("",!0),n.settings!==null&&(o.value!==null||s.value!==null||l.value!==null)?(t.openBlock(),t.createElementBlock("div",Z_,[t.createElementVNode("div",Q_,[n.editor==="kozyrek"?(t.openBlock(),t.createBlock(Iu,{key:0,"event-emitter":n.eventEmitter,settings:n.settings,"cart-item":o.value,"onClick:viewSwitch":f,onSubmit:d},null,8,["event-emitter","settings","cart-item"])):n.editor==="mosquitto"?(t.openBlock(),t.createBlock(zu,{key:1,"event-emitter":n.eventEmitter,settings:n.settings,"cart-item":o.value,onSubmit:d},null,8,["event-emitter","settings","cart-item"])):n.editor==="strip"?(t.openBlock(),t.createBlock(Wu,{key:2,"event-emitter":n.eventEmitter,settings:n.settings,"cart-items":s.value,"onClick:viewSwitch":f,onSubmit:d},null,8,["event-emitter","settings","cart-items"])):n.editor==="metal_for_doors"?(t.openBlock(),t.createBlock(qu,{key:3,"event-emitter":n.eventEmitter,settings:n.settings,"cart-item":o.value,"onClick:viewSwitch":f,onSubmit:d},null,8,["event-emitter","settings","cart-item"])):n.editor==="sandwich"?(t.openBlock(),t.createBlock(Uu,{key:4,"event-emitter":n.eventEmitter,settings:n.settings,"cart-item":o.value,"onClick:viewSwitch":f,onSubmit:d},null,8,["event-emitter","settings","cart-item"])):n.editor==="sandwich_m2"?(t.openBlock(),t.createBlock(Gu,{key:5,"event-emitter":n.eventEmitter,settings:n.settings,"cart-items":l.value,"onClick:viewSwitch":f,onSubmit:u},null,8,["event-emitter","settings","cart-items"])):t.createCommentVNode("",!0)])])):(t.openBlock(),t.createElementBlock("div",J_,' Конфигуратор "'+t.toDisplayString(n.editor)+'" не поддерживается. ',1))],64)}}});function Qu(n){return Object.values(W.ConfiguratorsEnum).includes(n)}function Ju(n){var e;return((e=n.properties)==null?void 0:e.configurator)!==W.ConfiguratorsEnum.Sandwich?!0:n.properties.configuratorSettings!==void 0&&V.isArray(n.products)&&n.products.length>0}const tw={key:0,class:"pt-0.5"},nw={key:0},iw={key:1},rw={class:"flex flex-row gap-1"},ow={key:0},sw={class:"m-0 list-inside list-disc p-0 pl-1.5 text-xs text-gray-500"},aw={class:"flex flex-col gap-2.5 sm:flex-row"},lw={key:0,class:"header-extra"},cw={class:"inline-flex"},dw={class:"inline-flex"},uw={class:"inline-flex"},fw={class:"mt-2"},hw={key:1,class:"flex flex-col"},mw={},pw=t.defineComponent({...mw,__name:"category-collapse-item",props:{categoryItem:{},filteredItems:{},isCategoryItemSelected:{type:[Boolean,String,Function],default:void 0},showCategoryHideForClientButton:{type:[Boolean,String,Function],default:!1},showCategoryRequiredButton:{type:[Boolean,String,Function],default:!1},showCategoryPinButton:{type:[Boolean,String,Function],default:!1},showCategoryEditButton:{type:[Boolean,String,Function],default:!1},categoryContextButtonsConfig:{type:Function,default:void 0},showConfigurator:{type:[Boolean,Function],default:!1},canShowConfigurator:{type:[Boolean,Function],default:!1},eventEmitter:{},showSlugs:{type:Boolean,default:!1},showProperties:{type:Boolean,default:!1},showProductCosts:{type:[Boolean,Function],default:!1},allowNameClick:{type:[Boolean,Function],default:!1},allowPriceClick:{type:[Boolean,Function],default:!1},showProductInfoButton:{type:[Boolean,Function],default:!1},showPriceHistory:{type:[Boolean,Function],default:!1},showCostDate:{type:[Boolean,Function],default:!1},isProductItemSelected:{type:Function,default:void 0},showProductAddToCartButton:{type:[Boolean,String,Function],default:!1},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function],default:!1},currencyRates:{},productContextButtonsConfig:{type:Function,default:void 0}},setup(n){const e=n,i=t.inject(Rr,"medium"),r=uo(),o=t.computed(()=>{var oe;return(oe=e==null?void 0:e.filteredItems)==null?void 0:oe[e.categoryItem.id]}),s=t.computed(()=>{var oe,fe;return V.isArray((oe=e.categoryItem)==null?void 0:oe.categories)&&((fe=e.categoryItem.categories)==null?void 0:fe.length)>0}),a=t.computed(()=>{var oe;return V.isArray((oe=e.categoryItem)==null?void 0:oe.products)?e.categoryItem.products:[]}),l=t.computed(()=>Object.entries(e.categoryItem.currencyRates??{}).map(([oe,fe])=>`${fe} руб./${O(oe)}`).join(", ")),c=t.computed(()=>V.isUndefined(e.filteredItems)||o.value==="*"?a.value:a.value.filter(oe=>{var ge;const fe=(ge=o.value)==null?void 0:ge.products;return V.isArray(fe)&&fe.includes(oe.id)})),d=t.computed(()=>c.value.length>0),u=t.computed(()=>V.isFunction(e.showCategoryHideForClientButton)?e.showCategoryHideForClientButton(e.categoryItem):e.showCategoryHideForClientButton),f=t.computed(()=>V.isFunction(e.showCategoryPinButton)?e.showCategoryPinButton(e.categoryItem):e.showCategoryPinButton),h=t.computed(()=>V.isFunction(e.showCategoryRequiredButton)?e.showCategoryRequiredButton(e.categoryItem):e.showCategoryRequiredButton),p=t.computed(()=>{var ge,_e;const oe=(ge=w.value)==null?void 0:ge.hidingComment,fe=(_e=w.value)!=null&&_e.isDisabled?`Скрыто для клиента${oe?`. Причина: '${oe}'`:""}`:"Видимо клиенту";return u.value==="disabled"?`${fe}. ${Nr}`:fe}),m=t.computed(()=>{var ge;const oe=(ge=w.value)==null?void 0:ge.manager,fe=oe?`Категория закреплена за "${oe.name??"-"}"`:"Закрепить";return f.value==="disabled"?`${fe}. ${Nr}`:fe}),g=t.computed(()=>h.value==="disabled"?`${$s}. ${Nr}`:$s),b=t.computed(()=>V.isFunction(e.showCategoryEditButton)?e.showCategoryEditButton(e.categoryItem):e.showCategoryEditButton),y=t.computed(()=>{var oe,fe,ge;return((oe=e.categoryItem.properties)==null?void 0:oe.configurator)!==void 0&&Qu((fe=e.categoryItem.properties)==null?void 0:fe.configurator)&&Ju(e.categoryItem)&&((ge=e.categoryItem.properties)==null?void 0:ge.configuratorSettings)!==void 0&&(V.isFunction(e.canShowConfigurator)?e.canShowConfigurator():e.canShowConfigurator)}),_=t.computed(()=>y.value&&(V.isFunction(e.showConfigurator)?e.showConfigurator(e.categoryItem):e.showConfigurator)),x=t.computed(()=>V.isNil(e.categoryContextButtonsConfig)?[]:V.isFunction(e.categoryContextButtonsConfig)?e.categoryContextButtonsConfig(e.categoryItem):e.categoryContextButtonsConfig),w=t.computed(()=>new W.ClientCategory(e.categoryItem)),C=t.ref(!1),N=t.ref(!1),k=t.computed(()=>!V.isUndefined(e.isCategoryItemSelected)),$=t.computed(()=>V.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem):e.isCategoryItemSelected===!0),v=t.computed(()=>V.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem)==="disabled":e.isCategoryItemSelected==="disabled"),E=t.computed(()=>V.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem)==="indeterminate":e.isCategoryItemSelected==="indeterminate"),P=t.computed(()=>L.value&&Ue.getDeviceTypeByResolution()===Xe.laptop?"auto":"fixed"),F=t.useTemplateRef("collapse-item-reference"),R=t.computed(()=>{var oe,fe;return(fe=(oe=e.categoryItem.properties)==null?void 0:oe.templateCost)==null?void 0:fe.priceCoefficient}),M=t.computed(()=>{var oe,fe;return(fe=(oe=e.categoryItem.properties)==null?void 0:oe.templateCost)==null?void 0:fe.increasePercent}),X=t.computed(()=>vi.isM2Category(e.categoryItem)?vi.findReferenceProduct(e.categoryItem):void 0),G=t.computed(()=>X.value?vi.calculateM2Cost(X.value,R.value,M.value):void 0),Z=t.computed(()=>{var oe,fe;return`${((fe=(oe=X.value)==null?void 0:oe.currency)==null?void 0:fe.symbol)??""}/м²`}),O=(oe,fe="ru-RU")=>0 .toLocaleString(fe,{style:"currency",currency:oe,minimumFractionDigits:0,maximumFractionDigits:0}).replaceAll(/\d/g,"").trim(),A=oe=>{e.eventEmitter.emit("category:checked",{category:e.categoryItem,checked:oe,target:F.value})},Y=(oe,fe)=>{e.eventEmitter.emit("category:header-click",{categoryItem:e.categoryItem,expanded:fe,isLoadingState:C,target:F.value})},H=()=>{e.eventEmitter.emit("category:hide",{category:e.categoryItem,target:F.value})},T=()=>{e.eventEmitter.emit("category:required",{category:e.categoryItem,target:F.value})},D=()=>{e.eventEmitter.emit("category:attach",{category:e.categoryItem,target:F.value})},K=()=>{e.eventEmitter.emit("category:detach",{category:e.categoryItem,target:F.value})},J=()=>{e.eventEmitter.emit("category:edit",{category:e.categoryItem,target:F.value})},U=oe=>{e.eventEmitter.emit("category:context-select",{category:e.categoryItem,key:oe,target:F.value})},q=()=>{e.eventEmitter.emit("configurator:click-view-switch",{category:e.categoryItem})},L=t.ref(0),le=t.computed(()=>L.value&&a.value.length>0?sy(a.value,{eventEmitter:e.eventEmitter,showSlugs:e.showSlugs,showProperties:e.showProperties,showProductCosts:e.showProductCosts,allowNameClick:e.allowNameClick,allowPriceClick:e.allowPriceClick,showPriceHistory:e.showPriceHistory,showCostDate:e.showCostDate,showProductInfoButton:e.showProductInfoButton,showProductAddToCartButton:e.showProductAddToCartButton,isProductItemSelected:e.isProductItemSelected,showProductEditButton:e.showProductEditButton,showProductRequiredButton:e.showProductRequiredButton,currencyRates:e.categoryItem.currencyRates,productContextButtonsConfig:e.productContextButtonsConfig}):[]),ue=V.debounce(()=>{L.value=window.innerWidth},20);return t.onUnmounted(()=>{window.removeEventListener("resize",ue),ue.cancel()}),window.addEventListener("resize",ue),ue(),(oe,fe)=>{const ge=I.NCheckbox,_e=_p,Qe=I.NTooltip,Re=gp,Mt=I.NTag,vn=hp,It=dp,en=I.NButton,Ln=ap,pn=rc,_t=ic,ae=nc,de=Is,Ge=I.NDropdown,Ui=I.NDataTable,oi=I.NAlert,si=I.NSpin;return t.openBlock(),t.createBlock(oc,{ref:"collapse-item-reference",name:n.categoryItem.id,"data-id":n.categoryItem.id,"onHeader:click":Y},{"pre-arrow":t.withCtx(()=>{var at,qe;return[k.value?(t.openBlock(),t.createElementBlock("div",tw,[t.createVNode(ge,{checked:$.value,indeterminate:E.value,disabled:v.value,"onUpdate:checked":A},null,8,["checked","indeterminate","disabled"])])):t.createCommentVNode("",!0),!u.value&&((at=w.value)!=null&&at.isDisabled)?(t.openBlock(),t.createBlock(Qe,{key:1,placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>[t.createVNode(_e,{class:"pt-1.5"})]),default:t.withCtx(()=>[fe[1]||(fe[1]=t.createTextVNode(" Категория скрыта для клиента ",-1))]),_:1})):t.createCommentVNode("",!0),((qe=w.value)==null?void 0:qe.isFavorite)??!1?(t.openBlock(),t.createBlock(Qe,{key:2,placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>[t.createVNode(Re,{class:"pt-1.5"})]),default:t.withCtx(()=>[fe[2]||(fe[2]=t.createTextVNode(" Избранная категория ",-1))]),_:1})):t.createCommentVNode("",!0)]}),header:t.withCtx(()=>{var at,qe,on,sn;return[t.createElementVNode("div",{class:t.normalizeClass({"text-base font-semibold uppercase":!0,"text-gray-400 line-through":n.categoryItem.isHidden,"text-gray-400":(at=w.value)==null?void 0:at.isDisabled})},[t.createVNode(Qe,{disabled:!n.categoryItem.isHidden,placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>[t.createElementVNode("span",null,t.toDisplayString(n.categoryItem.name),1)]),default:t.withCtx(()=>[fe[3]||(fe[3]=t.createTextVNode(" Категория скрыта ",-1))]),_:1},8,["disabled"])],2),t.createElementVNode("div",{class:"w-fit",onClick:fe[0]||(fe[0]=t.withModifiers((...lt)=>t.unref(V.noop)&&t.unref(V.noop)(...lt),["prevent","stop"]))},[(qe=n.categoryItem.properties)!=null&&qe.templateCost?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[R.value||M.value||!t.unref(V.isNil)(G.value)?(t.openBlock(),t.createBlock(Mt,{key:0,size:t.unref(i),round:""},{default:t.withCtx(()=>{var lt;return[R.value?(t.openBlock(),t.createElementBlock("span",nw,t.toDisplayString((lt=R.value)==null?void 0:lt.name),1)):t.createCommentVNode("",!0),M.value?(t.openBlock(),t.createElementBlock("span",iw,t.toDisplayString(M.value>0?"+":"")+t.toDisplayString(t.unref(Ve).formatPercent(M.value))+"%",1)):t.createCommentVNode("",!0),t.unref(V.isNil)(G.value)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("span",{key:2,class:t.normalizeClass({"ml-1":R.value||M.value})},t.toDisplayString(G.value.toFixed(2))+" "+t.toDisplayString(Z.value),3))]}),_:1},8,["size"])):t.createCommentVNode("",!0)],64)):(on=n.categoryItem.properties)!=null&&on.m2Price?(t.openBlock(),t.createBlock(Mt,{key:1,size:t.unref(i),round:""},{default:t.withCtx(()=>[t.createTextVNode(" Установленная стоимость: "+t.toDisplayString(n.categoryItem.properties.m2Price)+" руб./м2 ",1)]),_:1},8,["size"])):t.createCommentVNode("",!0),l.value?(t.openBlock(),t.createBlock(Mt,{key:2,size:t.unref(i),round:""},{default:t.withCtx(()=>[t.createTextVNode(" Фиксированный курс: "+t.toDisplayString(l.value),1)]),_:1},8,["size"])):t.createCommentVNode("",!0),f.value&&((sn=w.value)!=null&&sn.manager)?(t.openBlock(),t.createBlock(Mt,{key:3,size:t.unref(i),closable:f.value!=="disabled",round:"",class:"align-bottom",onClose:K},{default:t.withCtx(()=>[t.createVNode(Qe,{placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>{var lt,jt;return[t.createElementVNode("span",rw,[t.createVNode(vn),t.createTextVNode(" "+t.toDisplayString((jt=(lt=w.value)==null?void 0:lt.manager)==null?void 0:jt.name),1)])]}),default:t.withCtx(()=>{var lt,jt;return[t.createTextVNode(' Категория закреплена за "'+t.toDisplayString((jt=(lt=w.value)==null?void 0:lt.manager)==null?void 0:jt.name)+'" ',1)]}),_:1})]),_:1},8,["size","closable"])):t.createCommentVNode("",!0)])]}),"sub-header":t.withCtx(()=>[n.showSlugs||n.showProperties?(t.openBlock(),t.createElementBlock("div",ow,[t.createElementVNode("ul",sw,[n.showSlugs?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList({id:n.categoryItem.id,slug:n.categoryItem.slug},(at,qe)=>(t.openBlock(),t.createElementBlock("li",{key:qe}," ("+t.toDisplayString(qe)+"): "+t.toDisplayString(at),1))),128)):t.createCommentVNode("",!0),n.showProperties?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:1},t.renderList(n.categoryItem.properties,(at,qe)=>(t.openBlock(),t.createElementBlock("li",{key:qe}," ("+t.toDisplayString(qe)+"): "+t.toDisplayString(at),1))),128)):t.createCommentVNode("",!0)])])):t.createCommentVNode("",!0)]),"header-extra":t.withCtx(()=>{var at;return[t.createElementVNode("div",aw,[oe.$slots["header-extra"]?(t.openBlock(),t.createElementBlock("div",lw,[t.renderSlot(oe.$slots,"header-extra",{categoryItem:n.categoryItem},void 0,!0)])):t.createCommentVNode("",!0),u.value?(t.openBlock(),t.createBlock(Qe,{key:1,placement:"bottom",trigger:"hover",disabled:!t.unref(r)&&u.value!=="disabled"},{trigger:t.withCtx(()=>[t.createElementVNode("span",cw,[t.createVNode(en,{ghost:!0,disabled:u.value==="disabled",size:t.unref(i),onClick:H},{default:t.withCtx(()=>{var qe;return[(qe=w.value)!=null&&qe.isDisabled?(t.openBlock(),t.createBlock(_e,{key:1})):(t.openBlock(),t.createBlock(It,{key:0}))]}),_:1},8,["disabled","size"])])]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(p.value),1)]),_:1},8,["disabled"])):t.createCommentVNode("",!0),f.value&&!((at=w.value)!=null&&at.manager)?(t.openBlock(),t.createBlock(Qe,{key:2,placement:"bottom",trigger:"hover",disabled:!t.unref(r)&&f.value!=="disabled"},{trigger:t.withCtx(()=>[t.createElementVNode("span",dw,[t.createVNode(en,{ghost:!0,disabled:f.value==="disabled",size:t.unref(i),onClick:D},{default:t.withCtx(()=>[t.createVNode(Ln)]),_:1},8,["disabled","size"])])]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(m.value),1)]),_:1},8,["disabled"])):t.createCommentVNode("",!0),h.value?(t.openBlock(),t.createBlock(Qe,{key:3,placement:"bottom",trigger:"hover",disabled:!t.unref(r)&&h.value!=="disabled"},{trigger:t.withCtx(()=>[t.createElementVNode("span",uw,[t.createVNode(en,{ghost:!0,disabled:h.value==="disabled",size:t.unref(i),onClick:T},{default:t.withCtx(()=>{var qe;return[(qe=w.value)!=null&&qe.isRequired?(t.openBlock(),t.createBlock(_t,{key:1})):(t.openBlock(),t.createBlock(pn,{key:0}))]}),_:1},8,["disabled","size"])])]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(g.value),1)]),_:1},8,["disabled"])):t.createCommentVNode("",!0),b.value?(t.openBlock(),t.createBlock(Qe,{key:4,placement:"bottom",trigger:"hover",disabled:!t.unref(r)},{trigger:t.withCtx(()=>[t.createVNode(en,{ghost:!0,size:t.unref(i),type:"primary",onClick:J},{default:t.withCtx(()=>[t.createVNode(ae)]),_:1},8,["size"])]),default:t.withCtx(()=>[fe[4]||(fe[4]=t.createTextVNode(" Редактировать ",-1))]),_:1},8,["disabled"])):t.createCommentVNode("",!0),x.value.length>0?(t.openBlock(),t.createBlock(Ge,{key:5,options:x.value,size:t.unref(i),trigger:"click",onSelect:U},{default:t.withCtx(()=>[t.createVNode(en,{ghost:!0,size:t.unref(i),type:"primary"},{default:t.withCtx(()=>[t.createVNode(de)]),_:1},8,["size"])]),_:1},8,["options","size"])):t.createCommentVNode("",!0)])]}),default:t.withCtx(()=>[t.renderSlot(oe.$slots,"default",{},()=>{var at,qe,on;return[t.createElementVNode("div",fw,[s.value?(t.openBlock(),t.createBlock(tf,{key:0,"categories-items":n.categoryItem.categories??[],"has-products":d.value||C.value,"event-emitter":n.eventEmitter,"filtered-items":o.value?((at=o.value)==null?void 0:at.categories)??{}:void 0,"is-category-item-selected":n.isCategoryItemSelected,"show-slugs":n.showSlugs,"show-properties":n.showProperties,"allow-name-click":n.allowNameClick,"allow-price-click":n.allowPriceClick,"show-price-history":n.showPriceHistory,"show-cost-date":n.showCostDate,"show-product-info-button":n.showProductInfoButton,"show-category-required-button":n.showCategoryRequiredButton,"show-category-hide-for-client-button":n.showCategoryHideForClientButton,"show-category-pin-button":n.showCategoryPinButton,"show-category-edit-button":n.showCategoryEditButton,"category-context-buttons-config":n.categoryContextButtonsConfig,"is-product-item-selected":n.isProductItemSelected,"show-product-add-to-cart-button":n.showProductAddToCartButton,"show-product-costs":n.showProductCosts,"show-product-required-button":n.showProductRequiredButton,"show-product-edit-button":n.showProductEditButton,"product-context-buttons-config":n.productContextButtonsConfig,"show-configurator":n.showConfigurator,"can-show-configurator":n.canShowConfigurator},t.createSlots({_:2},[oe.$slots["header-extra"]?{name:"header-extra",fn:t.withCtx(({categoryItem:sn})=>[t.renderSlot(oe.$slots,"header-extra",{categoryItem:sn},void 0,!0)]),key:"0"}:void 0]),1032,["categories-items","has-products","event-emitter","filtered-items","is-category-item-selected","show-slugs","show-properties","allow-name-click","allow-price-click","show-price-history","show-cost-date","show-product-info-button","show-category-required-button","show-category-hide-for-client-button","show-category-pin-button","show-category-edit-button","category-context-buttons-config","is-product-item-selected","show-product-add-to-cart-button","show-product-costs","show-product-required-button","show-product-edit-button","product-context-buttons-config","show-configurator","can-show-configurator"])):t.createCommentVNode("",!0)]),y.value&&_.value?(t.openBlock(),t.createBlock(Zu,{key:0,"event-emitter":n.eventEmitter,settings:(qe=n.categoryItem.properties)==null?void 0:qe.configuratorSettings,editor:(on=n.categoryItem.properties)==null?void 0:on.configurator,category:n.categoryItem},null,8,["event-emitter","settings","editor","category"])):d.value?(t.openBlock(),t.createElementBlock("div",hw,[y.value?(t.openBlock(),t.createBlock(en,{key:0,color:"#bdbdbd",strong:"",class:"self-end p-2",onClick:q},{default:t.withCtx(()=>[...fe[5]||(fe[5]=[t.createTextVNode(" Назад в Конфигуратор ",-1)])]),_:1})):t.createCommentVNode("",!0),t.createVNode(Ui,{columns:le.value,data:c.value,bordered:!0,loading:C.value,remote:!0,"row-key":sn=>sn.id,"table-layout":P.value,class:"mt-2"},null,8,["columns","data","loading","row-key","table-layout"])])):t.createCommentVNode("",!0),!C.value&&!N.value&&!s.value&&!d.value?(t.openBlock(),t.createBlock(oi,{key:2,"show-icon":!0,type:"warning",title:"Категория пуста",class:"mx-10"})):t.createCommentVNode("",!0),N.value?(t.openBlock(),t.createBlock(oi,{key:3,"show-icon":!0,type:"error",title:"При получении данных произошла ошибка",class:"mx-10"})):t.createCommentVNode("",!0),C.value?(t.openBlock(),t.createBlock(si,{key:4,size:t.unref(i),class:"w-full"},{description:t.withCtx(()=>[...fe[6]||(fe[6]=[t.createElementVNode("div",null,"Выполняется загрузка данных ...",-1)])]),_:1},8,["size"])):t.createCommentVNode("",!0)]},!0)]),_:3},8,["name","data-id"])}}}),gw=dn(pw,[["__scopeId","data-v-9ed22ab1"]]),yw={class:"sc-collapse flex w-full flex-col"},bw={},ef=t.defineComponent({...bw,__name:"collapse",props:{defaultExpandedNames:{default:()=>[]},expandedNames:{default:()=>[]}},emits:["on-item-header-click"],setup(n,{emit:e}){const i=n,r=e,o=(s,a)=>{r("on-item-header-click",s,a)};return t.provide("itemHeaderClickHandler",o),t.provide("defaultExpandedNames",i.defaultExpandedNames),t.provide("expandedNames",i.expandedNames),(s,a)=>(t.openBlock(),t.createElementBlock("div",yw,[t.renderSlot(s.$slots,"default")]))}}),_w={},tf=t.defineComponent({..._w,__name:"category-collapse",props:{categoriesItems:{},hasProducts:{type:Boolean},loading:{type:Boolean,default:!1},client:{default:void 0},filteredItems:{default:void 0},isCategoryItemSelected:{type:[Boolean,String,Function],default:void 0},showCategoryHideForClientButton:{type:[Boolean,String,Function]},showCategoryRequiredButton:{type:[Boolean,String,Function]},showCategoryPinButton:{type:[Boolean,String,Function]},showCategoryEditButton:{type:[Boolean,String,Function],default:!1},categoryContextButtonsConfig:{type:Function,default:void 0},showConfigurator:{type:[Boolean,Function]},canShowConfigurator:{type:[Boolean,Function]},eventEmitter:{},showSlugs:{type:Boolean,default:!1},showProperties:{type:Boolean,default:!1},showProductCosts:{type:[Boolean,Function],default:!1},allowNameClick:{type:[Boolean,Function],default:!1},allowPriceClick:{type:[Boolean,Function],default:!1},showProductInfoButton:{type:[Boolean,Function],default:!1},showPriceHistory:{type:[Boolean,Function],default:!1},showCostDate:{type:[Boolean,Function],default:!1},isProductItemSelected:{type:Function,default:void 0},showProductAddToCartButton:{type:[Boolean,String,Function],default:!1},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function],default:!1},currencyRates:{},productContextButtonsConfig:{type:Function,default:void 0}},setup(n){const e=n,i=t.inject(Rr,"medium"),r=t.computed(()=>V.isUndefined(e.filteredItems)?e.categoriesItems:e.categoriesItems.filter(s=>{var a;return!!((a=e.filteredItems)!=null&&a[s.id])})),o=(s,a)=>{if(V.isUndefined(a))return;const l=a[s.id];if(l==="*")return;const c={};return c[s.id]=structuredClone(t.toRaw(l)),c};return(s,a)=>{const l=I.NSpin,c=I.NAlert;return t.openBlock(),t.createElementBlock(t.Fragment,null,[r.value.length>0?(t.openBlock(),t.createBlock(ef,{key:0},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,d=>(t.openBlock(),t.createBlock(gw,{key:d.id,"category-item":d,"event-emitter":n.eventEmitter,"filtered-items":o(d,n.filteredItems),"is-category-item-selected":n.isCategoryItemSelected,"show-slugs":n.showSlugs,"show-properties":n.showProperties,"allow-name-click":n.allowNameClick,"allow-price-click":n.allowPriceClick,"show-price-history":n.showPriceHistory,"show-cost-date":n.showCostDate,"show-product-info-button":n.showProductInfoButton,"show-category-required-button":n.showCategoryRequiredButton,"show-category-hide-for-client-button":n.showCategoryHideForClientButton,"show-category-pin-button":n.showCategoryPinButton,"show-category-edit-button":n.showCategoryEditButton,"category-context-buttons-config":n.categoryContextButtonsConfig,"is-product-item-selected":n.isProductItemSelected,"show-product-add-to-cart-button":n.showProductAddToCartButton,"show-product-costs":n.showProductCosts,"show-product-required-button":n.showProductRequiredButton,"show-product-edit-button":n.showProductEditButton,"product-context-buttons-config":n.productContextButtonsConfig,"show-configurator":n.showConfigurator,"can-show-configurator":n.canShowConfigurator},t.createSlots({_:2},[s.$slots["header-extra"]?{name:"header-extra",fn:t.withCtx(({categoryItem:u})=>[t.renderSlot(s.$slots,"header-extra",{categoryItem:u})]),key:"0"}:void 0]),1032,["category-item","event-emitter","filtered-items","is-category-item-selected","show-slugs","show-properties","allow-name-click","allow-price-click","show-price-history","show-cost-date","show-product-info-button","show-category-required-button","show-category-hide-for-client-button","show-category-pin-button","show-category-edit-button","category-context-buttons-config","is-product-item-selected","show-product-add-to-cart-button","show-product-costs","show-product-required-button","show-product-edit-button","product-context-buttons-config","show-configurator","can-show-configurator"]))),128))]),_:3})):n.loading?(t.openBlock(),t.createBlock(l,{key:1,size:t.unref(i),class:"w-full"},{description:t.withCtx(()=>[...a[0]||(a[0]=[t.createElementVNode("div",null,"Выполняется загрузка данных ...",-1)])]),_:1},8,["size"])):t.createCommentVNode("",!0),!n.hasProducts&&!n.loading&&n.categoriesItems.length>0&&r.value.length===0?(t.openBlock(),t.createBlock(c,{key:2,"show-icon":!0,type:"warning",title:"Товары не найдены",class:"mx-10"})):t.createCommentVNode("",!0)],64)}}}),ww={},nf=t.defineComponent({...ww,__name:"reference-select",props:{value:{default:void 0},clearable:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},consistentMenuWidth:{type:Boolean,default:!0},wrapContent:{type:Boolean,default:!1},referenceList:{default:()=>[]},showEmptyValue:{type:Boolean,default:!1},sortOptionsByLabel:{type:Boolean,default:!1},filterable:{type:Boolean,default:!1},maxTagCount:{default:void 0},disabledItem:{type:Function,default:void 0}},emits:["update:value"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.computed(()=>V.isArray(r.value)),a=new W.Reference,l=t.computed(()=>V.isNil(r.value)?s.value?[]:null:V.isArray(r.value)?r.value.filter(m=>!V.isNil(m)).map(m=>m.id):r.value.id),c=t.computed(()=>wt.convertReferencesToSelectOptionsList(r.referenceList,r.sortOptionsByLabel,!1,r.showEmptyValue,void 0,r.disabledItem)),d=t.computed(()=>c.value.map(m=>({...m,class:r.wrapContent?`${m.class} consistent-menu-width`:m.class}))),u=m=>{var g;if(V.isArray(m)){const b=m.length>0?m.map(y=>{var _;return(_=c.value.find(x=>x.value===y))==null?void 0:_.item}).filter(y=>!V.isNil(y)):[];o("update:value",b)}else{const b=m===a.id||V.isNil(m)||(g=c.value.find(y=>y.value===m))==null?void 0:g.item;o("update:value",b)}},f=t.useTemplateRef("select-component");return e({focus:()=>{var m;return(m=f.value)==null?void 0:m.focus()},blur:()=>{var m;return(m=f.value)==null?void 0:m.blur()}}),(m,g)=>(t.openBlock(),t.createBlock(t.unref(I.NSelect),{ref:"select-component",value:l.value,clearable:r.clearable,"consistent-menu-width":n.consistentMenuWidth,disabled:n.disabled||c.value.length===0,filterable:n.filterable,"max-tag-count":n.maxTagCount,multiple:s.value,options:d.value,placeholder:"",class:"w-full","onUpdate:value":u},null,8,["value","clearable","consistent-menu-width","disabled","filterable","max-tag-count","multiple","options"]))}}),xw={},kw=t.defineComponent({...xw,__name:"set-client-price-form-item",props:{value:{},clearable:{type:Boolean},feedback:{},validationStatus:{},disabled:{type:Boolean},catalogItem:{},calculationType:{},label:{},m2ReferenceProduct:{},disabledCoefficient:{type:Function},visibleCoefficient:{type:Function}},emits:["update:value"],setup(n,{emit:e}){var E,P;const i=n,r=e,o=()=>{const F=W.PriceCoefficient.getRetailPriceCoefficient();return V.unset(F,"isNewRec"),F},s=F=>!F||F.id===o().id,a=t.computed(()=>{var F;return((F=i.catalogItem)==null?void 0:F.type)==="product"}),l=t.computed(()=>!a.value&&!V.isNil(i.m2ReferenceProduct)),c=t.computed(()=>a.value?i.catalogItem:i.m2ReferenceProduct),d=t.computed(()=>!V.isNil(c.value)),u=t.computed(()=>{var F;return`${((F=c.value)==null?void 0:F.currency.symbol)??""}${l.value?"/м²":""}`}),f=F=>l.value&&i.m2ReferenceProduct?vi.toM2Cost(F,i.m2ReferenceProduct):F,h=t.computed(()=>c.value?f(c.value.retailCost??c.value.cost):void 0),p=t.computed(()=>{var F;return(((F=c.value)==null?void 0:F.priceCoefficients)??[]).map(R=>({...R,cost:f(R.cost)}))}),m=F=>{var R;return F.id===o().id?h.value:(R=p.value.find(M=>M.coefficient.id===F.id))==null?void 0:R.cost},g=t.computed(()=>{var M;const R=[...((M=W.useReferencesStore().priceCoefficientsReference)==null?void 0:M.map(X=>structuredClone(t.toRaw(X))))??[],o()].filter(X=>{var G;return((G=i.visibleCoefficient)==null?void 0:G.call(i,X))??!0});return d.value&&R.forEach(X=>{const G=m(X);G?X.name+=` (${V.round(G,2)} ${u.value})`:X.name=""}),R.filter(X=>X.name!=="")}),b=t.ref(i.value.coefficient),y=t.ref(((P=(E=i.value)==null?void 0:E.value)==null?void 0:P.toString())??null),_=t.ref(null),x=t.computed(()=>p.value.find(F=>F.coefficient.slug===W.PriceCoefficientEnum.K0)),w=t.ref(void 0),C=F=>Number.parseFloat((F??"").replaceAll(/[\s\u00A0\u202F]/g,"").replace(",",".")),N=()=>{var R,M;w.value=void 0;let F=C(y.value);if(F=Number.isNaN(F)?void 0:F,d.value)if(b.value||y.value){const X=o(),G=m(b.value??X)??0,Z=G+G*((F??0)/100);_.value=Ve.formatMoney(Z,(R=c.value)==null?void 0:R.currency.precision),Z>(h.value??Z)&&(w.value={validationStatus:"warning",feedback:"Устанавливается цена выше розничной цены"}),x.value&&Z<(((M=x.value)==null?void 0:M.cost)??0)&&(w.value={validationStatus:"warning",feedback:"Устанавливается цена ниже минимальной цены"})}else _.value=null;r("update:value",{value:Number.isNaN(F)?void 0:F,coefficient:s(b.value)?void 0:structuredClone(t.toRaw(b.value))})},k=F=>{V.isArray(F)||V.isNull(F)||(b.value=F,y.value=null,!b.value&&y.value&&(b.value=o()),N())},$=()=>{b.value||(b.value=o()),N()},v=F=>{var M,X;const R=C(F);if(d.value){if(Number.isNaN(R)){b.value=void 0,y.value=null,r("update:value",{value:void 0,coefficient:void 0});return}let G=0;if(R<=0)b.value=void 0,y.value=null;else if(x.value&&R<(((M=x.value)==null?void 0:M.cost)??0))b.value=(X=x.value)==null?void 0:X.coefficient,G=(R-x.value.cost)*100/x.value.cost,w.value={validationStatus:"warning",feedback:"Устанавливается цена ниже минимальной цены"};else if(R>(h.value??R)){b.value=o();const Z=h.value??0;G=(R-Z)*100/Z,w.value={validationStatus:"warning",feedback:"Устанавливается цена выше розничной цены"}}else{const Z=p.value,O=V.sortBy(Z,[H=>H.cost]),Y=O.filter(H=>H.cost<=R).at(-1)??O.at(0);Y&&(b.value=Y.coefficient,G=(R-Y.cost)*100/Y.cost),w.value={validationStatus:void 0,feedback:void 0}}G=Ve.roundPercent(G),y.value=Ve.formatPercent(G,Ve.percentFractionDigits),r("update:value",{value:Number.isNaN(G)?void 0:G,coefficient:s(b.value)?void 0:structuredClone(t.toRaw(b.value))})}else r("update:value",{value:Number.isNaN(R)?void 0:R,coefficient:void 0})};return t.onMounted(()=>{var F,R,M,X;i.calculationType===W.CalculationTypeEnum.m2Cost?_.value=((R=(F=i.value)==null?void 0:F.value)==null?void 0:R.toString())??null:!((M=i.value)!=null&&M.coefficient)&&((X=i.value)!=null&&X.value)&&(b.value=o()),N()}),(F,R)=>{var G,Z,O;const M=I.NInput,X=I.NInputGroup;return t.openBlock(),t.createBlock(t.unref(I.NFormItem),{"show-label":!t.unref(V.isNil)(n.label),label:n.label,"show-feedback":!t.unref(V.isNil)(((G=w.value)==null?void 0:G.feedback)??n.feedback),feedback:((Z=w.value)==null?void 0:Z.feedback)??n.feedback,"validation-status":((O=w.value)==null?void 0:O.validationStatus)??n.validationStatus},{default:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass([{"sm:grid-cols-3":d.value},"grid w-full grid-cols-1 gap-2"])},[n.calculationType!==t.unref(W.CalculationTypeEnum).m2Cost?(t.openBlock(),t.createBlock(X,{key:0,class:t.normalizeClass(["w-full flex-row",{"sm:col-span-2":d.value}])},{default:t.withCtx(()=>[t.createVNode(nf,{class:"w-full min-w-0 flex-1",value:b.value,"reference-list":g.value,clearable:n.clearable,disabled:n.disabled,"consistent-menu-width":!1,"show-empty-value":!0,"disabled-item":n.disabledCoefficient,"onUpdate:value":k},null,8,["value","reference-list","clearable","disabled","disabled-item"]),t.createVNode(M,{value:y.value,"onUpdate:value":[R[0]||(R[0]=A=>y.value=A),$],clearable:n.clearable,disabled:n.disabled,placeholder:"",class:"w-full min-w-0 flex-1"},t.createSlots({suffix:t.withCtx(()=>[R[3]||(R[3]=t.createTextVNode("%",-1))]),_:2},[y.value&&!y.value.startsWith("-")?{name:"prefix",fn:t.withCtx(()=>[R[2]||(R[2]=t.createTextVNode(" + ",-1))]),key:"0"}:void 0]),1032,["value","clearable","disabled"])]),_:1},8,["class"])):t.createCommentVNode("",!0),d.value||n.calculationType===t.unref(W.CalculationTypeEnum).m2Cost?(t.openBlock(),t.createBlock(M,{key:1,value:_.value,"onUpdate:value":[R[1]||(R[1]=A=>_.value=A),v],clearable:n.clearable,disabled:n.disabled,placeholder:l.value?"Стоимость за м²":"Стоимость",class:"w-full"},t.createSlots({_:2},[d.value?{name:"suffix",fn:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(u.value),1)]),key:"0"}:void 0]),1032,["value","clearable","disabled","placeholder"])):t.createCommentVNode("",!0)],2)]),_:1},8,["show-label","label","show-feedback","feedback","validation-status"])}}}),Cw={class:"text-sm"},vw={class:"text-sm"},Sw={},Bw=t.defineComponent({...Sw,__name:"add-product-to-cart-dialog",emits:["submit"],setup(n,{expose:e,emit:i}){const r=t.useTemplateRef("form-reference"),o=t.useTemplateRef("base-dialog-reference"),s=t.ref(!1),a=t.ref(null),l=t.computed(()=>{var R,M,X;return((R=a.value)==null?void 0:R.unit.isLinear)&&((X=(M=a.value)==null?void 0:M.properties)==null?void 0:X.isLengthConfigurator)}),c=t.computed(()=>a.value?W.UnitsHelper.productIsMeasurable(a.value)||l.value?"шт.":a.value.unit.name:"шт."),d=t.ref(void 0),u=t.ref(void 0),f=t.ref(!0),h=t.ref(null),p=t.computed({get:()=>{var R;return((R=h.value)==null?void 0:R.quantity)??null},set:R=>{h.value&&(h.value.quantity=R??0)}}),m=t.computed({get:()=>{var R;return((R=h.value)==null?void 0:R.length)??null},set:R=>{h.value&&(h.value.length=R??void 0)}}),g=R=>{h.value&&(h.value.marker=R??void 0)},b=i,y=()=>({length:{},quantity:{},marker:{}}),_=t.ref(y()),x=t.ref(!1),w=t.computed(()=>{var Z,O,A,Y;if(!a.value)return{};const R=W.UnitsHelper.getProductLengthMultiplicity(a.value),M=W.UnitsHelper.getProductMultiplicity(a.value),X=((O=(Z=a.value)==null?void 0:Z.properties)==null?void 0:O.minLength)||R,G=(Y=(A=a.value)==null?void 0:A.properties)==null?void 0:Y.maxLength;return{length:[ce.required,ce.min(X??.1),ce.max(G),ce.step(R),We.serverValidation(_.value.length.feedback)],quantity:[ce.required,ce.min(M),ce.step(M),We.serverValidation(_.value.quantity.feedback)],marker:[We.serverValidation(_.value.marker.feedback)]}}),C=t.computed(()=>{var R,M,X;return a.value?((R=a.value.properties)==null?void 0:R.lengthStep)??((M=a.value.properties)!=null&&M.ignoreMinCountCheck?0:((X=a.value.properties)==null?void 0:X.minCount)??0):0}),N=t.computed(()=>{var X,G,Z,O,A,Y,H,T,D;if(!a.value)return"";const R=((G=(X=a.value)==null?void 0:X.properties)==null?void 0:G.minLength)??((O=(Z=a.value)==null?void 0:Z.properties)!=null&&O.ignoreMinCountCheck?0:(Y=(A=a.value)==null?void 0:A.properties)==null?void 0:Y.minCount),M=(T=(H=a.value)==null?void 0:H.properties)==null?void 0:T.maxLength;return R||M?`(${R?`от ${R}`:""}${R&&M?" ":""}${M?`до ${M}`:""} ${(D=a.value)==null?void 0:D.unit.name})`:""}),k=R=>{var O,A;if(!((A=(O=a.value)==null?void 0:O.properties)!=null&&A.isLengthConfigurator)||!h.value||V.isNil(R)||C.value===0)return;const M=R/C.value,X=Math.round(M),G=W.UnitsHelper.getProductMultiplicity(a.value),Z=Math.max(X,G);h.value.quantity=Z},$=R=>{var Z,O,A,Y;if(!((O=(Z=a.value)==null?void 0:Z.properties)!=null&&O.isLengthConfigurator)||!h.value||V.isNil(R)||C.value===0)return;const M=Ve.multiplyByStep(R,C.value),X=((A=a.value.properties)==null?void 0:A.minLength)||W.UnitsHelper.getProductLengthMultiplicity(a.value),G=(Y=a.value.properties)==null?void 0:Y.maxLength;X!==void 0&&M<X?h.value.length=X:G!==void 0&&M>G?h.value.length=G:h.value.length=M},v=async R=>{var X;const M=V.cloneDeep(h.value);try{await((X=r.value)==null?void 0:X.validate(G=>{if(!G){if(!a.value||!M)return;W.UnitsHelper.productIsMeasurable(a.value)||delete M.length,l.value&&C.value&&(M.length=C.value),x.value=!0,b("submit",M,_.value,()=>{x.value=!1,R(!1),t.nextTick(()=>{var Z;(Z=r.value)==null||Z.validate(V.noop).catch(V.noop)})})}}))}catch{}},E=()=>{a.value=null,d.value=void 0,h.value=null,_.value=y()},P=()=>{s.value=!1};return e({show:(R,M)=>{var X,G,Z,O,A;if(E(),s.value=!0,a.value=R,d.value=M==null?void 0:M.cartItemData,u.value=M==null?void 0:M.orderId,f.value=(M==null?void 0:M.canSetDopProdaga)??!1,h.value=new W.OrderItemBase((M==null?void 0:M.cartItemData)??new W.OrderItemBase({product:R,quantity:W.UnitsHelper.productIsMeasurable(a.value)?1:((X=R==null?void 0:R.properties)==null?void 0:X.minCount)??1,length:((G=R==null?void 0:R.properties)==null?void 0:G.minLength)||((Z=R==null?void 0:R.properties)!=null&&Z.ignoreMinCountCheck?0:(O=R==null?void 0:R.properties)==null?void 0:O.minCount)||0})),(A=R==null?void 0:R.properties)!=null&&A.isLengthConfigurator&&h.value&&C.value>0){const Y=C.value,H=h.value.quantity||1;h.value.length=Ve.multiplyByStep(H,Y)}},closeDialog:P}),(R,M)=>{var A;const X=I.NFormItem,G=I.NInputGroupLabel,Z=I.NInputGroup,O=I.NCheckbox;return t.openBlock(),t.createBlock(zs,{ref:"base-dialog-reference",show:s.value,title:`${d.value?"Изменение":"Добавление"} товара ${(A=a.value)==null?void 0:A.name} в ${u.value?` заказ №${u.value}`:"корзину"}`,"accept-button":{show:!0,text:d.value?"Изменить":"Добавить"},processing:x.value,"modal-width":500,onAccept:v,onClosing:P},{default:t.withCtx(()=>[a.value&&h.value?t.withDirectives((t.openBlock(),t.createBlock(t.unref(I.NForm),{key:0,ref:"form-reference",model:h.value,rules:w.value,class:"flex flex-col gap-2 sc-hide-empty-feedback-message"},{default:t.withCtx(()=>[t.unref(W.UnitsHelper).productIsMeasurable(a.value)?(t.openBlock(),t.createBlock(X,{key:0,path:"length",label:`Метраж, ${N.value+a.value.unit.name}`},t.createSlots({default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:m.value,"onUpdate:value":[M[0]||(M[0]=Y=>m.value=Y),k],parse:t.unref(ht),step:t.unref(W.UnitsHelper).getProductLengthMultiplicity(a.value),"show-button":!1,placeholder:"Введите метраж",class:"w-full",onKeydown:M[1]||(M[1]=Y=>t.unref(fo)(Y,".",!1)),onInput:M[2]||(M[2]=Y=>t.unref(dt)(_.value,"length")),onFocus:t.unref(He)},null,8,["value","parse","step","onFocus"])]),_:2},[!_.value.length.feedback&&t.unref(W.UnitsHelper).getProductLengthMultiplicity(a.value)!==1?{name:"feedback",fn:t.withCtx(()=>[t.createElementVNode("span",Cw,"Метраж должно быть кратно "+t.toDisplayString(t.unref(W.UnitsHelper).getProductLengthMultiplicity(a.value)),1)]),key:"0"}:void 0]),1032,["label"])):t.createCommentVNode("",!0),t.createVNode(X,{path:"quantity",label:`Количество, ${c.value}`},{default:t.withCtx(()=>[t.createVNode(Z,null,t.createSlots({default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:p.value,"onUpdate:value":[M[3]||(M[3]=Y=>p.value=Y),$],parse:t.unref(ht),step:t.unref(W.UnitsHelper).getProductMultiplicity(a.value),"show-button":t.unref(W.UnitsHelper).getProductMultiplicity(a.value)>1,"button-placement":"both",placeholder:"Введите количество",class:"w-full",onKeydown:M[4]||(M[4]=Y=>t.unref(fo)(Y,".",!1)),onInput:M[5]||(M[5]=Y=>t.unref(dt)(_.value,"quantity")),onFocus:t.unref(He)},null,8,["value","parse","step","show-button","onFocus"]),l.value?(t.openBlock(),t.createBlock(G,{key:0,class:"bg-orange-100 font-bold"},{default:t.withCtx(()=>[t.createTextVNode(" x "+t.toDisplayString(C.value)+" "+t.toDisplayString(a.value.unit.name),1)]),_:1})):t.createCommentVNode("",!0)]),_:2},[!_.value.quantity.feedback&&t.unref(W.UnitsHelper).getProductMultiplicity(a.value)!==1?{name:"feedback",fn:t.withCtx(()=>[t.createElementVNode("span",vw,"Количество должно быть кратно "+t.toDisplayString(t.unref(W.UnitsHelper).getProductMultiplicity(a.value)),1)]),key:"0"}:void 0]),1024)]),_:1},8,["label"]),t.unref(W.UnitsHelper).productIsMeasurable(a.value)?(t.openBlock(),t.createBlock(X,{key:1,path:"marker",label:"Маркировка"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInput),{value:h.value.marker??null,placeholder:"Введите маркировку",onInput:M[6]||(M[6]=Y=>t.unref(dt)(_.value,"marker")),"onUpdate:value":M[7]||(M[7]=Y=>g(Y)),onFocus:t.unref(He)},null,8,["value","onFocus"])]),_:1})):t.createCommentVNode("",!0),f.value?(t.openBlock(),t.createBlock(O,{key:2,checked:h.value.isAdditionalSale,"onUpdate:checked":M[8]||(M[8]=Y=>h.value.isAdditionalSale=Y),"true-value":!0,"false-value":!1},{default:t.withCtx(()=>[...M[9]||(M[9]=[t.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):t.createCommentVNode("",!0)]),_:1},8,["model","rules"])),[[t.unref(ai),()=>{var Y,H;return(H=(Y=o.value)==null?void 0:Y.acceptHandler)==null?void 0:H.call(Y)}]]):t.createCommentVNode("",!0)]),_:1},8,["show","title","accept-button","processing"])}}}),Nw={class:"flex flex-row gap-1"},Tw={class:"sc-client-name flex flex-col gap-1 text-base"},$w=["href"],Ew={key:1,class:"text-sc-grey"},Rw={key:0,class:"text-sc-dark-grey sc-client-city text-sm"},Pw={key:0},Fw={key:1,class:"text-sm"},Vw={},Dr=t.defineComponent({...Vw,__name:"client-name-with-short-info",props:{client:{},nameLink:{default:void 0},popoverPosition:{default:void 0},showCityAndRegion:{type:Boolean,default:!0},showSalesDirection:{type:Boolean,default:!1},showClientInfoIcon:{type:Boolean,default:!1}},emits:["click:client-name","click:client-info"],setup(n,{emit:e}){const i=n,r=e,o=t.computed(()=>i.client.lastLoginAt?Be.format(i.client.lastLoginAt,W.useBaseConfigStateStore().config.dateFormats.uiDateWithTime):""),s=a=>{V.isNil(i.nameLink)&&(a.preventDefault(),a.stopPropagation()),r("click:client-name",i.client,a)};return(a,l)=>{const c=ho,d=I.NButton,u=I.NPopover;return t.openBlock(),t.createElementBlock("div",Nw,[n.showClientInfoIcon?(t.openBlock(),t.createBlock(d,{key:0,quaternary:"",size:"small",onClick:l[0]||(l[0]=f=>a.$emit("click:client-info",n.client))},{default:t.withCtx(()=>[t.createVNode(c)]),_:1})):t.createCommentVNode("",!0),t.createVNode(u,{disabled:t.unref(V.isNil)(n.popoverPosition),placement:n.popoverPosition},{trigger:t.withCtx(()=>[t.createElementVNode("div",Tw,[t.createElementVNode("a",{href:n.nameLink??"#",class:"text-base no-underline",onClick:l[1]||(l[1]=f=>s(f))},[t.createElementVNode("span",{class:t.normalizeClass({"line-through":!n.client.isActive})},t.toDisplayString(n.client.name),3),n.showSalesDirection&&n.client.salesDirection?(t.openBlock(),t.createElementBlock("span",{key:0,class:t.normalizeClass({"line-through":!n.client.isActive})}," ("+t.toDisplayString(n.client.salesDirection.name)+") ",3)):t.createCommentVNode("",!0),n.client.isActive?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("span",Ew," [ Деактивирован ] "))],8,$w),n.showCityAndRegion&&n.client.city?(t.openBlock(),t.createElementBlock("span",Rw," г. "+t.toDisplayString(n.client.city.name)+", "+t.toDisplayString(n.client.city.region.name),1)):t.createCommentVNode("",!0)])]),default:t.withCtx(()=>[n.client.alternativeName?(t.openBlock(),t.createElementBlock("div",Pw,t.toDisplayString(n.client.alternativeName),1)):t.createCommentVNode("",!0),o.value?(t.openBlock(),t.createElementBlock("span",Fw," Последний вход: "+t.toDisplayString(o.value),1)):t.createCommentVNode("",!0),t.renderSlot(a.$slots,"popover-content")]),_:3},8,["disabled","placement"])])}}}),Mw={class:"text-base"},Iw={},rf=t.defineComponent({...Iw,__name:"contragent-with-short-info",props:{contragent:{}},setup(n){const e=n,i=t.computed(()=>li.getFormatEntityName(e.contragent));return(r,o)=>(t.openBlock(),t.createElementBlock("span",Mw,t.toDisplayString(i.value),1))}}),Aw={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Ow(n,e){return t.openBlock(),t.createElementBlock("svg",Aw,[...e[0]||(e[0]=[t.createElementVNode("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[t.createElementVNode("path",{d:"M3 7a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}),t.createElementVNode("path",{d:"m3 7l9 6l9-6"})],-1)])])}const zw=t.markRaw({name:"tabler-mail",render:Ow}),Dw=["href"],Lw={},Hw=t.defineComponent({...Lw,__name:"email",props:{email:{default:""},showEmailIcon:{type:Boolean,default:!1}},setup(n){return(e,i)=>{const r=zw;return t.openBlock(),t.createElementBlock("span",{class:t.normalizeClass({"flex flex-row items-center gap-1":n.showEmailIcon})},[n.showEmailIcon?(t.openBlock(),t.createBlock(r,{key:0})):t.createCommentVNode("",!0),t.createElementVNode("a",{href:`mailto:${n.email}`,class:"no-underline"},t.toDisplayString(n.email),9,Dw)],2)}}}),Ww={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function jw(n,e){return t.openBlock(),t.createElementBlock("svg",Ww,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M444 49.9C431.3 38.2 379.9.9 265.3.4c0 0-135.1-8.1-200.9 52.3C27.8 89.3 14.9 143 13.5 209.5s-3.1 191.1 117 224.9h.1l-.1 51.6s-.8 20.9 13 25.1c16.6 5.2 26.4-10.7 42.3-27.8c8.7-9.4 20.7-23.2 29.8-33.7c82.2 6.9 145.3-8.9 152.5-11.2c16.6-5.4 110.5-17.4 125.7-142c15.8-128.6-7.6-209.8-49.8-246.5M457.9 287c-12.9 104-89 110.6-103 115.1c-6 1.9-61.5 15.7-131.2 11.2c0 0-52 62.7-68.2 79c-5.3 5.3-11.1 4.8-11-5.7c0-6.9.4-85.7.4-85.7q-.15 0 0 0C43.1 372.7 49.1 266.6 50.2 211.1s11.6-101 42.6-131.6c55.7-50.5 170.4-43 170.4-43c96.9.4 143.3 29.6 154.1 39.4c35.7 30.6 53.9 103.8 40.6 211.1m-139-80.8c.4 8.6-12.5 9.2-12.9.6c-1.1-22-11.4-32.7-32.6-33.9c-8.6-.5-7.8-13.4.7-12.9c27.9 1.5 43.4 17.5 44.8 46.2m20.3 11.3c1-42.4-25.5-75.6-75.8-79.3c-8.5-.6-7.6-13.5.9-12.9c58 4.2 88.9 44.1 87.8 92.5c-.1 8.6-13.1 8.2-12.9-.3m47 13.4c.1 8.6-12.9 8.7-12.9.1c-.6-81.5-54.9-125.9-120.8-126.4c-8.5-.1-8.5-12.9 0-12.9c73.7.5 133 51.4 133.7 139.2M374.9 329v.2c-10.8 19-31 40-51.8 33.3l-.2-.3c-21.1-5.9-70.8-31.5-102.2-56.5c-16.2-12.8-31-27.9-42.4-42.4c-10.3-12.9-20.7-28.2-30.8-46.6c-21.3-38.5-26-55.7-26-55.7c-6.7-20.8 14.2-41 33.3-51.8h.2c9.2-4.8 18-3.2 23.9 3.9c0 0 12.4 14.8 17.7 22.1c5 6.8 11.7 17.7 15.2 23.8c6.1 10.9 2.3 22-3.7 26.6l-12 9.6c-6.1 4.9-5.3 14-5.3 14s17.8 67.3 84.3 84.3c0 0 9.1.8 14-5.3l9.6-12c4.6-6 15.7-9.8 26.6-3.7c14.7 8.3 33.4 21.2 45.8 32.9c7 5.7 8.6 14.4 3.8 23.6"},null,-1)])])}const of=t.markRaw({name:"fa6-brands-viber",render:jw}),qw={viewBox:"0 0 256 258",width:"1.2em",height:"1.2em"},Xw=["id"],Yw=["id"],Uw=["fill"],Kw=["fill"];function Gw(n,e){return t.openBlock(),t.createElementBlock("svg",qw,[t.createElementVNode("defs",null,[t.createElementVNode("linearGradient",{id:n.idMap.SVGBRLHCcSy,x1:"50%",x2:"50%",y1:"100%",y2:"0%"},[...e[0]||(e[0]=[t.createElementVNode("stop",{offset:"0%","stop-color":"#1FAF38"},null,-1),t.createElementVNode("stop",{offset:"100%","stop-color":"#60D669"},null,-1)])],8,Xw),t.createElementVNode("linearGradient",{id:n.idMap.SVGHW6lecxh,x1:"50%",x2:"50%",y1:"100%",y2:"0%"},[...e[1]||(e[1]=[t.createElementVNode("stop",{offset:"0%","stop-color":"#F9F9F9"},null,-1),t.createElementVNode("stop",{offset:"100%","stop-color":"#FFF"},null,-1)])],8,Yw)]),t.createElementVNode("path",{fill:"url(#"+n.idMap.SVGBRLHCcSy+")",d:"M5.463 127.456c-.006 21.677 5.658 42.843 16.428 61.499L4.433 252.697l65.232-17.104a123 123 0 0 0 58.8 14.97h.054c67.815 0 123.018-55.183 123.047-123.01c.013-32.867-12.775-63.773-36.009-87.025c-23.23-23.25-54.125-36.061-87.043-36.076c-67.823 0-123.022 55.18-123.05 123.004"},null,8,Uw),t.createElementVNode("path",{fill:"url(#"+n.idMap.SVGHW6lecxh+")",d:"M1.07 127.416c-.007 22.457 5.86 44.38 17.014 63.704L0 257.147l67.571-17.717c18.618 10.151 39.58 15.503 60.91 15.511h.055c70.248 0 127.434-57.168 127.464-127.423c.012-34.048-13.236-66.065-37.3-90.15C194.633 13.286 162.633.014 128.536 0C58.276 0 1.099 57.16 1.071 127.416m40.24 60.376l-2.523-4.005c-10.606-16.864-16.204-36.352-16.196-56.363C22.614 69.029 70.138 21.52 128.576 21.52c28.3.012 54.896 11.044 74.9 31.06c20.003 20.018 31.01 46.628 31.003 74.93c-.026 58.395-47.551 105.91-105.943 105.91h-.042c-19.013-.01-37.66-5.116-53.922-14.765l-3.87-2.295l-40.098 10.513z"},null,8,Kw),e[2]||(e[2]=t.createElementVNode("path",{fill:"#FFF",d:"M96.678 74.148c-2.386-5.303-4.897-5.41-7.166-5.503c-1.858-.08-3.982-.074-6.104-.074c-2.124 0-5.575.799-8.492 3.984c-2.92 3.188-11.148 10.892-11.148 26.561s11.413 30.813 13.004 32.94c1.593 2.123 22.033 35.307 54.405 48.073c26.904 10.609 32.379 8.499 38.218 7.967c5.84-.53 18.844-7.702 21.497-15.139c2.655-7.436 2.655-13.81 1.859-15.142c-.796-1.327-2.92-2.124-6.105-3.716s-18.844-9.298-21.763-10.361c-2.92-1.062-5.043-1.592-7.167 1.597c-2.124 3.184-8.223 10.356-10.082 12.48c-1.857 2.129-3.716 2.394-6.9.801c-3.187-1.598-13.444-4.957-25.613-15.806c-9.468-8.442-15.86-18.867-17.718-22.056c-1.858-3.184-.199-4.91 1.398-6.497c1.431-1.427 3.186-3.719 4.78-5.578c1.588-1.86 2.118-3.187 3.18-5.311c1.063-2.126.531-3.986-.264-5.579c-.798-1.593-6.987-17.343-9.819-23.64"},null,-1))])}const sf=t.markRaw({name:"logos-whatsapp-icon",render:Gw,setup(){const n=()=>Math.random().toString(36).substr(2,10);return{idMap:{SVGBRLHCcSy:"uicons-"+n(),SVGHW6lecxh:"uicons-"+n()}}}}),Zw={viewBox:"0 0 256 256",width:"1.2em",height:"1.2em"},Qw=["id"],Jw=["fill"];function ex(n,e){return t.openBlock(),t.createElementBlock("svg",Zw,[t.createElementVNode("defs",null,[t.createElementVNode("linearGradient",{id:n.idMap.SVGuySfwdaH,x1:"50%",x2:"50%",y1:"0%",y2:"100%"},[...e[0]||(e[0]=[t.createElementVNode("stop",{offset:"0%","stop-color":"#2AABEE"},null,-1),t.createElementVNode("stop",{offset:"100%","stop-color":"#229ED9"},null,-1)])],8,Qw)]),t.createElementVNode("path",{fill:"url(#"+n.idMap.SVGuySfwdaH+")",d:"M128 0C94.06 0 61.48 13.494 37.5 37.49A128.04 128.04 0 0 0 0 128c0 33.934 13.5 66.514 37.5 90.51C61.48 242.506 94.06 256 128 256s66.52-13.494 90.5-37.49c24-23.996 37.5-56.576 37.5-90.51s-13.5-66.514-37.5-90.51C194.52 13.494 161.94 0 128 0"},null,8,Jw),e[1]||(e[1]=t.createElementVNode("path",{fill:"#FFF",d:"M57.94 126.648q55.98-24.384 74.64-32.152c35.56-14.786 42.94-17.354 47.76-17.441c1.06-.017 3.42.245 4.96 1.49c1.28 1.05 1.64 2.47 1.82 3.467c.16.996.38 3.266.2 5.038c-1.92 20.24-10.26 69.356-14.5 92.026c-1.78 9.592-5.32 12.808-8.74 13.122c-7.44.684-13.08-4.912-20.28-9.63c-11.26-7.386-17.62-11.982-28.56-19.188c-12.64-8.328-4.44-12.906 2.76-20.386c1.88-1.958 34.64-31.748 35.26-34.45c.08-.338.16-1.598-.6-2.262c-.74-.666-1.84-.438-2.64-.258c-1.14.256-19.12 12.152-54 35.686c-5.1 3.508-9.72 5.218-13.88 5.128c-4.56-.098-13.36-2.584-19.9-4.708c-8-2.606-14.38-3.984-13.82-8.41c.28-2.304 3.46-4.662 9.52-7.072"},null,-1))])}const af=t.markRaw({name:"logos-telegram",render:ex,setup(){return{idMap:{SVGuySfwdaH:"uicons-"+Math.random().toString(36).substr(2,10)}}}}),tx={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function nx(n,e){return t.openBlock(),t.createElementBlock("svg",tx,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M391 480c-19.52 0-46.94-7.06-88-30c-49.93-28-88.55-53.85-138.21-103.38C116.91 298.77 93.61 267.79 61 208.45c-36.84-67-30.56-102.12-23.54-117.13C45.82 73.38 58.16 62.65 74.11 52a176.3 176.3 0 0 1 28.64-15.2c1-.43 1.93-.84 2.76-1.21c4.95-2.23 12.45-5.6 21.95-2c6.34 2.38 12 7.25 20.86 16c18.17 17.92 43 57.83 52.16 77.43c6.15 13.21 10.22 21.93 10.23 31.71c0 11.45-5.76 20.28-12.75 29.81c-1.31 1.79-2.61 3.5-3.87 5.16c-7.61 10-9.28 12.89-8.18 18.05c2.23 10.37 18.86 41.24 46.19 68.51s57.31 42.85 67.72 45.07c5.38 1.15 8.33-.59 18.65-8.47c1.48-1.13 3-2.3 4.59-3.47c10.66-7.93 19.08-13.54 30.26-13.54h.06c9.73 0 18.06 4.22 31.86 11.18c18 9.08 59.11 33.59 77.14 51.78c8.77 8.84 13.66 14.48 16.05 20.81c3.6 9.53.21 17-2 22c-.37.83-.78 1.74-1.21 2.75a176.5 176.5 0 0 1-15.29 28.58c-10.63 15.9-21.4 28.21-39.38 36.58A67.4 67.4 0 0 1 391 480"},null,-1)])])}const lf=t.markRaw({name:"ion-call",render:nx}),ix={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function rx(n,e){return t.openBlock(),t.createElementBlock("svg",ix,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 4h4l2 5l-2.5 1.5a11 11 0 0 0 5 5L15 13l5 2v4a2 2 0 0 1-2 2A16 16 0 0 1 3 6a2 2 0 0 1 2-2m10 3a2 2 0 0 1 2 2m-2-6a6 6 0 0 1 6 6"},null,-1)])])}const ox=t.markRaw({name:"tabler-phone-call",render:rx}),sx={key:0,class:"absolute left-0 top-0 flex w-full flex-row items-center justify-around text-center backdrop-blur-sm"},ax=["href"],lx=["href"],cx=["href"],dx=["href"],ux={},fx=t.defineComponent({...ux,__name:"phone",props:{defaultCountry:{},phone:{default:""},showPhoneIcon:{type:Boolean,default:!1}},setup(n){const e=n,i=t.computed(()=>{try{return e.phone?Br.parsePhoneNumberWithError(e.phone,e.defaultCountry):void 0}catch{}return e.phone}),r=t.computed(()=>{var l;return V.isString(i.value)?!1:((l=i.value)==null?void 0:l.isValid())??!1}),o=t.computed(()=>{var l;return V.isString(i.value)?i.value:((l=i.value)==null?void 0:l.format("INTERNATIONAL"))??""}),s=t.computed(()=>{var l;return V.isString(i.value)?i.value:((l=i.value)==null?void 0:l.format("E.164"))??""}),a=t.ref(!1);return(l,c)=>{const d=ox,u=lf,f=af,h=sf,p=of;return t.openBlock(),t.createElementBlock("div",null,[t.createElementVNode("div",{class:t.normalizeClass({"border-xl relative inline-flex items-center rounded px-2":r.value&&a.value,"min-w-10":!0}),onClick:c[0]||(c[0]=m=>a.value=!a.value),onFocusout:c[1]||(c[1]=m=>a.value=!1),onMouseleave:c[2]||(c[2]=m=>a.value=!1)},[t.createElementVNode("div",{class:t.normalizeClass({"flex flex-row items-center gap-1":n.showPhoneIcon})},[n.showPhoneIcon?(t.openBlock(),t.createBlock(d,{key:0})):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(o.value),1)],2),r.value&&a.value?(t.openBlock(),t.createElementBlock("div",sx,[r.value?(t.openBlock(),t.createElementBlock("a",{key:0,href:`tel:${s.value}`,class:"text-blue-600 hover:animate-pulse hover:text-blue-600"},[t.createVNode(u)],8,ax)):t.createCommentVNode("",!0),r.value?(t.openBlock(),t.createElementBlock("a",{key:1,href:`https://t.me/${s.value}`,target:"_blank",rel:"noopener noreferrer",class:"hover:animate-pulse"},[t.createVNode(f)],8,lx)):t.createCommentVNode("",!0),r.value?(t.openBlock(),t.createElementBlock("a",{key:2,href:`https://wa.me/${s.value.substring(1)}`,target:"_blank",rel:"noopener noreferrer",class:"hover:animate-pulse"},[t.createVNode(h)],8,cx)):t.createCommentVNode("",!0),r.value?(t.openBlock(),t.createElementBlock("a",{key:3,href:`viber://chat?number=${s.value}`,class:"text-purple-600 hover:animate-pulse hover:text-purple-600"},[t.createVNode(p)],8,dx)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)],34)])}}}),hx={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function mx(n,e){return t.openBlock(),t.createElementBlock("svg",hx,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"m20 8l-8 5l-8-5V6l8 5l8-5m0-2H4c-1.11 0-2 .89-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2"},null,-1)])])}const px=t.markRaw({name:"mdi-envelope",render:mx}),gx={class:"flex flex-col gap-1"},yx={key:0,class:"mb-2 flex flex-col text-base"},bx={key:0,class:"text-sc-dark-grey text-sm"},_x={key:1,class:"whitespace-nowrap text-sm"},wx={key:2,class:"whitespace-nowrap text-sm"},xx={key:3,class:"absolute left-0 top-0 flex size-full items-center justify-around rounded-md text-center text-2xl backdrop-blur-sm"},kx=["href"],Cx=["href"],vx=["href"],Sx=["href"],Bx=["href"],Nx={key:0,class:"flex flex-col text-base"},Tx={key:0,class:"text-sc-dark-grey text-sm"},$x={key:1,class:"mt-2 text-sm"},Ex={key:0,class:"-mt-1"},Rx={},Px=t.defineComponent({...Rx,__name:"person-contacts-block",props:{defaultCountry:{},contact:{},fullView:{type:Boolean,default:!0},classes:{default:""},styles:{default:void 0}},setup(n){const e=n,i=t.computed(()=>li.getFormatEntityName(e.contact)),r=t.computed(()=>{try{return e.contact.phone?Br.parsePhoneNumberWithError(e.contact.phone,e.defaultCountry):void 0}catch{}return e.contact.phone}),o=t.computed(()=>{var d;return V.isString(r.value)?!1:((d=r.value)==null?void 0:d.isValid())??!1}),s=t.computed(()=>{var d;return V.isString(r.value)?r.value:((d=r.value)==null?void 0:d.format("INTERNATIONAL"))??""}),a=t.computed(()=>{var d;return V.isString(r.value)?r.value:((d=r.value)==null?void 0:d.format("E.164"))??""}),l=t.computed(()=>o.value||e.contact.email),c=t.ref(!1);return(d,u)=>{var y,_;const f=lf,h=af,p=sf,m=of,g=px,b=I.NPopover;return t.openBlock(),t.createElementBlock("div",gx,[t.createVNode(b,{disabled:n.fullView,placement:"bottom"},{trigger:t.withCtx(()=>{var x,w,C,N;return[t.createElementVNode("div",{class:t.normalizeClass(`relative contact-btn px-3 py-2 rounded-md items-center inline-flex bg-gray-50 ${(x=n.contact)!=null&&x.isPrimary?"ring-1 ring-inset ring-green-600 hover:ring-gray-200":""} ${n.classes}`),style:t.normalizeStyle(n.styles),onMouseenter:u[0]||(u[0]=k=>c.value=!0),onFocusin:u[1]||(u[1]=k=>c.value=!0),onMouseleave:u[2]||(u[2]=k=>c.value=!1),onFocusout:u[3]||(u[3]=k=>c.value=!1)},[t.createElementVNode("div",null,[n.fullView&&(n.contact.name||(w=n.contact)!=null&&w.position)?(t.openBlock(),t.createElementBlock("div",yx,[t.createTextVNode(t.toDisplayString(i.value)+" ",1),(C=n.contact)!=null&&C.position?(t.openBlock(),t.createElementBlock("span",bx,t.toDisplayString((N=n.contact)==null?void 0:N.position),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),n.contact.phone?(t.openBlock(),t.createElementBlock("div",_x,t.toDisplayString(s.value),1)):t.createCommentVNode("",!0),n.contact.email?(t.openBlock(),t.createElementBlock("div",wx,t.toDisplayString(n.contact.email),1)):t.createCommentVNode("",!0),l.value&&c.value?(t.openBlock(),t.createElementBlock("div",xx,[o.value?(t.openBlock(),t.createElementBlock("a",{key:0,href:`tel:${a.value}`,class:"text-blue-600 hover:text-3xl hover:text-blue-600"},[t.createVNode(f)],8,kx)):t.createCommentVNode("",!0),o.value?(t.openBlock(),t.createElementBlock("a",{key:1,href:`https://t.me/${a.value}`,target:"_blank",rel:"noopener noreferrer",class:"hover:text-3xl"},[t.createVNode(h)],8,Cx)):t.createCommentVNode("",!0),o.value?(t.openBlock(),t.createElementBlock("a",{key:2,href:`https://wa.me/${a.value.substring(1)}`,target:"_blank",rel:"noopener noreferrer",class:"hover:text-3xl"},[t.createVNode(p)],8,vx)):t.createCommentVNode("",!0),o.value?(t.openBlock(),t.createElementBlock("a",{key:3,href:`viber://chat?number=${a.value}`,class:"text-purple-600 hover:text-3xl hover:text-purple-600"},[t.createVNode(m)],8,Sx)):t.createCommentVNode("",!0),n.contact.email?(t.openBlock(),t.createElementBlock("a",{key:4,href:`mailto:${n.contact.email}`,class:"hover:text-3xl"},[t.createVNode(g)],8,Bx)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)])],38)]}),default:t.withCtx(()=>{var x,w,C,N;return[n.contact.name?(t.openBlock(),t.createElementBlock("div",Nx,[t.createTextVNode(t.toDisplayString(i.value)+" ",1),(x=n.contact)!=null&&x.position?(t.openBlock(),t.createElementBlock("span",Tx,t.toDisplayString((w=n.contact)==null?void 0:w.position),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),(C=n.contact)!=null&&C.comment?(t.openBlock(),t.createElementBlock("div",$x,[u[4]||(u[4]=t.createElementVNode("sup",null,"**",-1)),t.createTextVNode(" "+t.toDisplayString((N=n.contact)==null?void 0:N.comment),1)])):t.createCommentVNode("",!0)]}),_:1},8,["disabled"]),n.fullView&&((y=n.contact)!=null&&y.comment)?(t.openBlock(),t.createElementBlock("div",Ex,[u[5]||(u[5]=t.createElementVNode("sup",null,"**",-1)),t.createTextVNode(" "+t.toDisplayString((_=n.contact)==null?void 0:_.comment),1)])):t.createCommentVNode("",!0)])}}});class Fx{constructor(e){B(this,"minHeight");B(this,"maxHeights");B(this,"minWidth");B(this,"maxWidths");B(this,"netType");B(this,"color");B(this,"mountType");B(this,"descriptions");B(this,"crossbarCount");B(this,"heightOverlaps");B(this,"widthOverlaps");B(this,"canSetDopProdaga");this.color=e.color,this.crossbarCount=e.crossbarCount,this.descriptions=Ns.objectToSnake(e.descriptions),this.maxHeights=e.maxHeights,this.maxWidths=e.maxWidths,this.minHeight=e.minHeight,this.minWidth=e.minWidth,this.mountType=e.mountType,this.netType=e.netType,this.heightOverlaps=Ns.objectToSnake(e.heightOverlaps),this.widthOverlaps=Ns.objectToSnake(e.widthOverlaps),this.canSetDopProdaga=e.canSetDopProdaga}}function Vx(n){var e;return((e=n.properties)==null?void 0:e.configurator)!==W.ConfiguratorsEnum.SandwichM2?!0:n.properties.configuratorSettings!==void 0&&V.isArray(n.products)&&n.products.length>0}const Mx={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Ix(n,e){return t.openBlock(),t.createElementBlock("svg",Mx,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M16 12a2 2 0 0 1 2-2a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2m-6 0a2 2 0 0 1 2-2a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2m-6 0a2 2 0 0 1 2-2a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2"},null,-1)])])}const Ax=t.markRaw({name:"mdi-dots-horizontal",render:Ix}),Ox={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function zx(n,e){return t.openBlock(),t.createElementBlock("svg",Ox,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M15.5 14h-.79l-.28-.27A6.47 6.47 0 0 0 16 9.5A6.5 6.5 0 0 0 9.5 3A6.5 6.5 0 0 0 3 9.5A6.5 6.5 0 0 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 5l1.5-1.5zm-6 0C7 14 5 12 5 9.5S7 5 9.5 5S14 7 14 9.5S12 14 9.5 14M7 9h5v1H7z"},null,-1)])])}const Dx=t.markRaw({name:"mdi-magnify-minus-outline",render:zx}),Lx={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Hx(n,e){return t.openBlock(),t.createElementBlock("svg",Lx,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"m15.5 14l5 5l-1.5 1.5l-5-5v-.79l-.27-.28A6.47 6.47 0 0 1 9.5 16A6.5 6.5 0 0 1 3 9.5A6.5 6.5 0 0 1 9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27zm-6 0C12 14 14 12 14 9.5S12 5 9.5 5S5 7 5 9.5S7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2z"},null,-1)])])}const Wx=t.markRaw({name:"mdi-magnify-plus-outline",render:Hx}),jx={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function qx(n,e){return t.openBlock(),t.createElementBlock("svg",jx,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M8.59 16.58L13.17 12L8.59 7.41L10 6l6 6l-6 6z"},null,-1)])])}const cf=t.markRaw({name:"mdi-chevron-right",render:qx}),Xx={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Yx(n,e){return t.openBlock(),t.createElementBlock("svg",Xx,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M15.41 16.58L10.83 12l4.58-4.59L14 6l-6 6l6 6z"},null,-1)])])}const df=t.markRaw({name:"mdi-chevron-left",render:Yx}),Ux={heightMedium:"40px",paddingMedium:"0 16px",borderRadiusMedium:"10px",fontSizeMedium:"14px",iconSizeMedium:"18px",iconMarginMedium:"8px",border:"1px solid #d1d5db",borderHover:"1px solid #9ca3af",borderPressed:"1px solid #9ca3af",borderFocus:"1px solid #9ca3af"},Lr={heightSmall:"36px",paddingSmall:"0 10px",borderRadiusSmall:"8px",iconSizeSmall:"18px",border:"1px solid #d1d5db",borderHover:"1px solid #9ca3af",borderPressed:"1px solid #9ca3af",borderFocus:"1px solid #9ca3af"},uf="date-range.dialog.mode",ff="date-range.dialog.scale",hf="date-range.quick-periods",mf=["thisMonth","lastMonth","thisQuarter","lastQuarter","thisYear","lastYear","fromBeginningOfThisYear"],pf=["Янв","Фев","Мар","Апр","Май","Июн","Июл","Авг","Сен","Окт","Ноя","Дек"],Kx=["Январь","Февраль","Март","Апрель","Май","Июнь","Июль","Август","Сентябрь","Октябрь","Ноябрь","Декабрь"],Gx=["Пн","Вт","Ср","Чт","Пт","Сб","Вс"],gf=new Date(2e3,0,1),Ri=n=>Be.differenceInCalendarDays(n,gf),yf=n=>Be.addDays(gf,n),bf=(n,e,i)=>{let r=n??void 0,o=e??void 0;return r&&o&&r>o&&(i!=null&&i.from?o=r:i!=null&&i.to?r=o:[r,o]=[o,r]),{from:r?Be.startOfDay(r):void 0,to:o?Be.endOfDay(o):void 0}},Oa=n=>Object.entries(n).map(([e,i])=>({value:e,label:i.label,item:i})),_f=(n,e)=>{const i=Object.entries(n).filter(([,r])=>r.group===e);return e!=="other"?[{type:"group",key:e,children:Oa(Object.fromEntries(i))}]:W.STANDARD_PERIOD_SECTIONS.map(r=>{const o=i.filter(([,s])=>s.section===r.key);return{type:"group",key:r.key,label:r.label,children:Oa(Object.fromEntries(o))}}).filter(r=>r.children.length>0)},wf=(n,e)=>{const i=t.ref(null),r=t.ref(null),o=t.ref(!1),s=t.ref(null),a=(g,b)=>g<=b?[g,b]:[b,g],l=t.computed(()=>o.value&&r.value!==null&&s.value!==null?a(r.value,s.value):i.value!==null?s.value===null?[i.value,i.value]:a(i.value,s.value):n.value),c=(g,b)=>{i.value=null,e(...a(g,b))},d=g=>{i.value===null?(i.value=g,e(g,g)):c(i.value,g)},u=()=>{globalThis.removeEventListener("pointerup",u);const g=r.value;if(g!==null){if(r.value=null,o.value){o.value=!1,s.value!==null&&c(g,s.value);return}d(g)}},f=g=>{r.value=g,o.value=!1,globalThis.addEventListener("pointerup",u)},h=g=>{s.value=g,r.value!==null&&g!==r.value&&(o.value=!0)},p=()=>{s.value=null},m=g=>{const b=l.value;return!b||g<b[0]||g>b[1]?null:g===b[0]||g===b[1]?"bound":"in-range"};return t.onBeforeUnmount(()=>{globalThis.removeEventListener("pointerup",u)}),{activeRange:l,cellPosition:m,pointerDownHandler:f,pointerEnterHandler:h,pointerLeaveHandler:p,selectHandler:d}},Zx={class:"flex items-center justify-between gap-2"},Qx={class:"flex items-center gap-2"},Jx={class:"text-center font-semibold"},ek={class:"grid grid-cols-7 gap-0.5 text-center text-xs text-gray-500"},tk={class:"grid grid-cols-7 gap-0.5"},nk=["disabled","onPointerdown","onPointerenter","onKeydown"],ik={},rk=t.defineComponent({...ik,__name:"day-range-grid",props:{from:{},to:{}},emits:["select"],setup(n,{emit:e}){const i=n,r=e,o=42,s=I.useThemeVars(),a=t.computed(()=>({"--sc-primary-color":s.value.primaryColor,"--sc-primary-color-hover":s.value.primaryColorHover,"--sc-primary-color-suppl":s.value.primaryColorSuppl,"--sc-hover-color":s.value.hoverColor})),l=Ue.initRefDependingOnDeviceResolution(1,2,3),c=t.computed(()=>["grid-cols-1","grid-cols-2","grid-cols-3"][l.value-1]),d=y=>Be.subMonths(Be.startOfMonth(y),l.value===3?1:0),u=y=>y&&Be.isValid(y)?y:new Date,f=t.ref(d(u(i.from??i.to))),h=t.computed(()=>{const{from:y,to:_}=i;return!y||!_||!Be.isValid(y)||!Be.isValid(_)?null:[Ri(y),Ri(_)]}),p=wf(h,(y,_)=>{r("select",{from:Be.startOfDay(yf(y)),to:Be.endOfDay(yf(_))})}),m=y=>{const _=Be.subDays(y,(Be.getDay(y)+6)%7);return V.times(o,x=>{const w=Be.addDays(_,x);return{index:Ri(w),day:w.getDate(),isCurrentMonth:Be.isSameMonth(w,y),isToday:Be.isToday(w)}})},g=t.computed(()=>V.times(l.value,y=>{const _=Be.addMonths(f.value,y);return{key:`${_.getFullYear()}-${_.getMonth()}`,title:`${Kx[_.getMonth()]} ${_.getFullYear()}`,cells:m(_)}})),b=y=>{if(!y.isCurrentMonth)return["sc-day--outside"];const _=y.isToday?["sc-day--today"]:[],x=p.cellPosition(y.index);return x&&_.push(`sc-day--${x}`),_};return t.watch(()=>[i.from,i.to],()=>{const y=i.from??i.to;if(!y||!Be.isValid(y))return;const _=`${y.getFullYear()}-${y.getMonth()}`;V.some(g.value,["key",_])||(f.value=d(y))}),(y,_)=>{const x=df,w=I.NButton,C=cf;return t.openBlock(),t.createElementBlock("div",{class:"flex select-none flex-col gap-3",style:t.normalizeStyle(a.value),onPointerleave:_[2]||(_[2]=(...N)=>t.unref(p).pointerLeaveHandler&&t.unref(p).pointerLeaveHandler(...N))},[t.createElementVNode("div",Zx,[t.createVNode(w,{size:"small","aria-label":"Предыдущий месяц","theme-overrides":t.unref(Lr),onClick:_[0]||(_[0]=N=>f.value=t.unref(Be.subMonths)(f.value,1))},{icon:t.withCtx(()=>[t.createVNode(x)]),_:1},8,["theme-overrides"]),_[3]||(_[3]=t.createElementVNode("span",{class:"text-sm text-gray-600"},"Выберите диапазон на календаре",-1)),t.createElementVNode("div",Qx,[t.renderSlot(y.$slots,"actions",{},void 0,!0),t.createVNode(w,{size:"small","aria-label":"Следующий месяц","theme-overrides":t.unref(Lr),onClick:_[1]||(_[1]=N=>f.value=t.unref(Be.addMonths)(f.value,1))},{icon:t.withCtx(()=>[t.createVNode(C)]),_:1},8,["theme-overrides"])])]),t.createElementVNode("div",{class:t.normalizeClass(["grid gap-3",c.value])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(g.value,N=>(t.openBlock(),t.createElementBlock("div",{key:N.key,class:"flex flex-col gap-1"},[t.createElementVNode("div",Jx,t.toDisplayString(N.title),1),t.createElementVNode("div",ek,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Gx),k=>(t.openBlock(),t.createElementBlock("span",{key:k},t.toDisplayString(k),1))),128))]),t.createElementVNode("div",tk,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(N.cells,k=>(t.openBlock(),t.createElementBlock("button",{key:k.index,type:"button",class:t.normalizeClass(["sc-day h-7 rounded border-0 p-0 text-xs",b(k)]),disabled:!k.isCurrentMonth,onPointerdown:t.withModifiers($=>t.unref(p).pointerDownHandler(k.index),["prevent"]),onPointerenter:$=>t.unref(p).pointerEnterHandler(k.index),onKeydown:[t.withKeys(t.withModifiers($=>t.unref(p).selectHandler(k.index),["prevent"]),["enter"]),t.withKeys(t.withModifiers($=>t.unref(p).selectHandler(k.index),["prevent"]),["space"])]},t.toDisplayString(k.day),43,nk))),128))])]))),128))],2),_[4]||(_[4]=t.createStaticVNode('<div class="flex flex-wrap items-center gap-x-6 gap-y-1 text-xs text-gray-700" data-v-a41e813d><span class="flex items-center gap-2" data-v-a41e813d><i class="sc-legend sc-legend--bound" data-v-a41e813d></i>Дата начала</span><span class="flex items-center gap-2" data-v-a41e813d><i class="sc-legend sc-legend--in-range" data-v-a41e813d></i>Выбранный период</span><span class="flex items-center gap-2" data-v-a41e813d><i class="sc-legend sc-legend--bound" data-v-a41e813d></i>Дата окончания</span></div>',1))],36)}}}),ok=dn(rk,[["__scopeId","data-v-a41e813d"]]),sk={class:"flex items-center justify-between gap-2"},ak={class:"flex items-center gap-2"},lk={class:"text-center font-semibold"},ck={class:"grid grid-cols-3 gap-2"},dk=["onPointerdown","onPointerenter","onKeydown"],uk={},fk=t.defineComponent({...uk,__name:"month-range-grid",props:{from:{},to:{}},emits:["select"],setup(n,{emit:e}){const i=n,r=e,o=I.useThemeVars(),s=t.computed(()=>({"--sc-primary-color":o.value.primaryColor,"--sc-primary-color-hover":o.value.primaryColorHover,"--sc-primary-color-suppl":o.value.primaryColorSuppl,"--sc-hover-color":o.value.hoverColor})),a=p=>{const m=new Date().getFullYear();return p&&Be.isValid(p)?p.getFullYear():m},l=t.ref(a(i.from??i.to)),c=Ue.initRefDependingOnDeviceResolution(1,3,3),d=t.computed(()=>c.value===1?[l.value]:[l.value-1,l.value,l.value+1]),u=t.computed(()=>{const{from:p,to:m}=i;return!p||!m||!Be.isValid(p)||!Be.isValid(m)?null:[p.getFullYear()*12+p.getMonth(),m.getFullYear()*12+m.getMonth()]}),f=wf(u,(p,m)=>{r("select",{from:new Date(Math.floor(p/12),p%12,1),to:Be.endOfMonth(new Date(Math.floor(m/12),m%12,1))})}),h=(p,m)=>{const g=f.cellPosition(p*12+m);return g?[`sc-month--${g}`]:[]};return t.watch(()=>[i.from,i.to],()=>{const p=i.from??i.to;if(!p||!Be.isValid(p))return;const m=p.getFullYear();(m<l.value-1||m>l.value+1)&&(l.value=m)}),(p,m)=>{const g=df,b=I.NButton,y=cf;return t.openBlock(),t.createElementBlock("div",{class:"flex select-none flex-col gap-3",style:t.normalizeStyle(s.value),onPointerleave:m[2]||(m[2]=(..._)=>t.unref(f).pointerLeaveHandler&&t.unref(f).pointerLeaveHandler(..._))},[t.createElementVNode("div",sk,[t.createVNode(b,{size:"small","aria-label":"Предыдущий год","theme-overrides":t.unref(Lr),onClick:m[0]||(m[0]=_=>l.value-=1)},{icon:t.withCtx(()=>[t.createVNode(g)]),_:1},8,["theme-overrides"]),m[3]||(m[3]=t.createElementVNode("span",{class:"text-sm text-gray-600"},"Выберите диапазон месяцев",-1)),t.createElementVNode("div",ak,[t.renderSlot(p.$slots,"actions",{},void 0,!0),t.createVNode(b,{size:"small","aria-label":"Следующий год","theme-overrides":t.unref(Lr),onClick:m[1]||(m[1]=_=>l.value+=1)},{icon:t.withCtx(()=>[t.createVNode(y)]),_:1},8,["theme-overrides"])])]),t.createElementVNode("div",{class:t.normalizeClass(["grid gap-4 sm:gap-6",d.value.length===1?"grid-cols-1":"grid-cols-3"])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.value,_=>(t.openBlock(),t.createElementBlock("div",{key:_,class:"flex flex-col gap-2"},[t.createElementVNode("div",lk,t.toDisplayString(_),1),t.createElementVNode("div",ck,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(pf),(x,w)=>(t.openBlock(),t.createElementBlock("button",{key:x,type:"button",class:t.normalizeClass(["sc-month cursor-pointer rounded-lg px-1 py-2.5 text-sm",h(_,w)]),onPointerdown:t.withModifiers(C=>t.unref(f).pointerDownHandler(_*12+w),["prevent"]),onPointerenter:C=>t.unref(f).pointerEnterHandler(_*12+w),onKeydown:[t.withKeys(t.withModifiers(C=>t.unref(f).selectHandler(_*12+w),["prevent"]),["enter"]),t.withKeys(t.withModifiers(C=>t.unref(f).selectHandler(_*12+w),["prevent"]),["space"])]},t.toDisplayString(x),43,dk))),128))])]))),128))],2)],36)}}}),hk=dn(fk,[["__scopeId","data-v-dd09a19d"]]),mk={class:"sc-date-range-sidebar flex flex-col gap-1"},pk={class:"flex items-center justify-center gap-1"},gk={class:"min-w-12 text-center font-semibold"},yk={class:"grid grid-flow-col grid-cols-2 grid-rows-6 gap-1"},bk={},_k=t.defineComponent({...bk,__name:"month-year-sidebar",props:{year:{},month:{}},emits:["update:year","select-month","today"],setup(n,{emit:e}){const i=e;return(r,o)=>{const s=I.NButton;return t.openBlock(),t.createElementBlock("div",mk,[t.createElementVNode("div",pk,[t.createVNode(s,{size:"small",quaternary:"",onClick:o[0]||(o[0]=a=>i("update:year",n.year-1))},{default:t.withCtx(()=>[...o[3]||(o[3]=[t.createTextVNode(" ‹ ",-1)])]),_:1}),t.createElementVNode("span",gk,t.toDisplayString(n.year),1),t.createVNode(s,{size:"small",quaternary:"",onClick:o[1]||(o[1]=a=>i("update:year",n.year+1))},{default:t.withCtx(()=>[...o[4]||(o[4]=[t.createTextVNode(" › ",-1)])]),_:1})]),t.createElementVNode("div",yk,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(pf),(a,l)=>(t.openBlock(),t.createBlock(s,{key:a,size:"small",quaternary:"",type:l===n.month?"primary":"default",onClick:c=>i("select-month",l)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(a),1)]),_:2},1032,["type","onClick"]))),128))]),t.createVNode(s,{size:"small",text:"",type:"info",onClick:o[2]||(o[2]=a=>i("today"))},{default:t.withCtx(()=>[...o[5]||(o[5]=[t.createTextVNode(" Сегодня ",-1)])]),_:1})])}}}),wk={},xf=t.defineComponent({...wk,__name:"date-range-input",props:{clearable:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},placeholder:{default:void 0},value:{default:null},dateFormat:{default:()=>W.useBaseConfigStateStore().config.dateFormats.uiDate}},emits:["update:value"],setup(n,{emit:e}){const i=n,r=e,o=Ue.initRefDependingOnDeviceResolution(!0,!1,!1),s=t.ref(null),a=t.ref(!1),l=t.ref(0),c=t.ref(i.value&&Be.isValid(i.value)?i.value:new Date),d=t.computed(()=>{const x=i.value&&Be.isValid(i.value)?i.value:c.value;return x.getFullYear()===c.value.getFullYear()?x.getMonth():null});let u=0;const f=x=>{var w,C;(C=(w=x.target)==null?void 0:w.closest)!=null&&C.call(w,".n-base-clear__clear")&&(u=performance.now())},h=x=>{x&&performance.now()-u<300||(a.value=x,x&&(c.value=i.value&&Be.isValid(i.value)?i.value:new Date))},p=x=>{r("update:value",x===null?null:new Date(x))},m=(x,w)=>{const C=new Date(x,w,1);if(c.value=C,i.value&&Be.isValid(i.value)){const N=Math.min(Be.getDate(i.value),Be.getDaysInMonth(C));r("update:value",new Date(x,w,N));return}l.value+=1,t.nextTick().then(()=>{var N;return(N=s.value)==null?void 0:N.focus()})},g=(x,w)=>{c.value=Be.addYears(Be.addMonths(c.value,x),w)},b=x=>{m(x,c.value.getMonth())},y=x=>{m(c.value.getFullYear(),x)},_=()=>{a.value=!1,r("update:value",new Date)};return(x,w)=>{const C=I.NButton,N=I.NDatePicker;return t.openBlock(),t.createBlock(N,{ref_key:"pickerReference",ref:s,key:l.value,value:i.value?i.value.getTime():null,show:a.value,clearable:n.clearable,disabled:n.disabled,placeholder:n.placeholder,format:n.dateFormat,actions:[],"default-calendar-start-time":c.value.getTime(),type:"date",class:"w-full min-w-0",onMousedownCapture:f,"onUpdate:show":h,"onUpdate:value":p,onNextMonth:w[0]||(w[0]=k=>g(1,0)),onPrevMonth:w[1]||(w[1]=k=>g(-1,0)),onNextYear:w[2]||(w[2]=k=>g(0,1)),onPrevYear:w[3]||(w[3]=k=>g(0,-1))},{footer:t.withCtx(()=>[t.unref(o)?(t.openBlock(),t.createBlock(C,{key:1,size:"small",text:"",type:"info",onClick:_},{default:t.withCtx(()=>[...w[4]||(w[4]=[t.createTextVNode(" Сегодня ",-1)])]),_:1})):(t.openBlock(),t.createBlock(_k,{key:0,year:c.value.getFullYear(),month:d.value,"onUpdate:year":b,onSelectMonth:y,onToday:_},null,8,["year","month"]))]),_:1},8,["value","show","clearable","disabled","placeholder","format","default-calendar-start-time"])}}}),xk={key:0,class:"text-gray-400"},kk={},kf=t.defineComponent({...kk,__name:"date-range-fields",props:{clearable:{type:Boolean,default:!0},disabled:{default:()=>({from:!1,to:!1})},from:{default:null},to:{default:null},placeholderFrom:{default:"Дата начала"},placeholderTo:{default:"Дата окончания"},dateFormat:{default:void 0}},emits:["update:from","update:to"],setup(n,{emit:e}){const i=Ue.initRefDependingOnDeviceResolution(!0,!1,!1),r=e;return(o,s)=>{var a,l;return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["flex w-full min-w-0 gap-1",t.unref(i)?"flex-col":"flex-row items-center"])},[t.createVNode(xf,{value:n.from,clearable:n.clearable,disabled:(a=n.disabled)==null?void 0:a.from,placeholder:n.placeholderFrom,"date-format":n.dateFormat,class:"min-w-0 flex-1","onUpdate:value":s[0]||(s[0]=c=>r("update:from",c))},null,8,["value","clearable","disabled","placeholder","date-format"]),t.unref(i)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("span",xk," – ")),t.createVNode(xf,{value:n.to,clearable:n.clearable,disabled:(l=n.disabled)==null?void 0:l.to,placeholder:n.placeholderTo,"date-format":n.dateFormat,class:"min-w-0 flex-1","onUpdate:value":s[1]||(s[1]=c=>r("update:to",c))},null,8,["value","clearable","disabled","placeholder","date-format"])],2)}}}),Ck={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function vk(n,e){return t.openBlock(),t.createElementBlock("svg",Ck,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M7 11h2v2H7zm14-6v14c0 1.11-.89 2-2 2H5a2 2 0 0 1-2-2V5c0-1.1.9-2 2-2h1V1h2v2h8V1h2v2h1a2 2 0 0 1 2 2M5 7h14V5H5zm14 12V9H5v10zm-4-6v-2h2v2zm-4 0v-2h2v2zm-4 2h2v2H7zm8 2v-2h2v2zm-4 0v-2h2v2z"},null,-1)])])}const Sk=t.markRaw({name:"mdi-calendar-month-outline",render:vk}),Bk={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Nk(n,e){return t.openBlock(),t.createElementBlock("svg",Bk,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"m16 11.78l4.24-7.33l1.73 1l-5.23 9.05l-6.51-3.75L5.46 19H22v2H2V3h2v14.54L9.5 8z"},null,-1)])])}const Tk=t.markRaw({name:"mdi-chart-line",render:Nk}),$k={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Ek(n,e){return t.openBlock(),t.createElementBlock("svg",$k,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M22 21H2V3h2v16h2v-9h4v9h2V6h4v13h2v-5h4z"},null,-1)])])}const Rk=t.markRaw({name:"mdi-chart-bar",render:Ek}),Pk={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Fk(n,e){return t.openBlock(),t.createElementBlock("svg",Pk,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M5 3h1V1h2v2h8V1h2v2h1c1.11 0 2 .89 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2m0 16h14V9H5zM5 7h14V5H5zm12 4v2H7v-2z"},null,-1)])])}const Vk=t.markRaw({name:"mdi-calendar-week-outline",render:Fk}),Mk={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Ik(n,e){return t.openBlock(),t.createElementBlock("svg",Mk,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M19 3h-1V1h-2v2H8V1H6v2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14c1.11 0 2-.89 2-2V5c0-1.11-.89-2-2-2m0 16H5V9h14zm0-12H5V5h14M7 11h5v5H7"},null,-1)])])}const Ak=t.markRaw({name:"mdi-calendar-today-outline",render:Ik}),Ok={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function zk(n,e){return t.openBlock(),t.createElementBlock("svg",Ok,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M12 8a4 4 0 0 1 4 4a4 4 0 0 1-4 4a4 4 0 0 1-4-4a4 4 0 0 1 4-4m0 2a2 2 0 0 0-2 2a2 2 0 0 0 2 2a2 2 0 0 0 2-2a2 2 0 0 0-2-2m-2 12c-.25 0-.46-.18-.5-.42l-.37-2.65c-.63-.25-1.17-.59-1.69-.99l-2.49 1.01c-.22.08-.49 0-.61-.22l-2-3.46a.493.493 0 0 1 .12-.64l2.11-1.66L4.5 12l.07-1l-2.11-1.63a.493.493 0 0 1-.12-.64l2-3.46c.12-.22.39-.31.61-.22l2.49 1c.52-.39 1.06-.73 1.69-.98l.37-2.65c.04-.24.25-.42.5-.42h4c.25 0 .46.18.5.42l.37 2.65c.63.25 1.17.59 1.69.98l2.49-1c.22-.09.49 0 .61.22l2 3.46c.13.22.07.49-.12.64L19.43 11l.07 1l-.07 1l2.11 1.63c.19.15.25.42.12.64l-2 3.46c-.12.22-.39.31-.61.22l-2.49-1c-.52.39-1.06.73-1.69.98l-.37 2.65c-.04.24-.25.42-.5.42zm1.25-18l-.37 2.61c-1.2.25-2.26.89-3.03 1.78L5.44 7.35l-.75 1.3L6.8 10.2a5.55 5.55 0 0 0 0 3.6l-2.12 1.56l.75 1.3l2.43-1.04c.77.88 1.82 1.52 3.01 1.76l.37 2.62h1.52l.37-2.61c1.19-.25 2.24-.89 3.01-1.77l2.43 1.04l.75-1.3l-2.12-1.55c.4-1.17.4-2.44 0-3.61l2.11-1.55l-.75-1.3l-2.41 1.04a5.42 5.42 0 0 0-3.03-1.77L12.75 4z"},null,-1)])])}const Dk=t.markRaw({name:"mdi-cog-outline",render:zk}),Lk={class:"grid gap-x-6 gap-y-4 pr-3 sm:grid-cols-2"},Hk={class:"font-medium"},Wk={key:0,class:"pt-1 text-xs text-gray-500"},jk={class:"flex flex-col items-stretch justify-between gap-2 sm:flex-row sm:items-center"},qk={class:"flex items-center gap-3"},Xk={class:"text-sm text-gray-600"},Yk={class:"flex gap-2"},Uk={},Kk=t.defineComponent({...Uk,__name:"quick-periods-settings",props:{show:{type:Boolean},selectedKeys:{}},emits:["update:show","save"],setup(n,{emit:e}){const i=n,r=e,o=Ue.initRefDependingOnDeviceResolution("100%","90%","40rem"),s=W.DateTimeProvider.standardPeriods(),a=W.STANDARD_PERIOD_GROUPS.map(u=>({key:u.key,label:u.label,sections:_f(s,u.key)})),l=t.ref([]),c=t.computed(()=>{const u=l.value.length;return`Выбрано: ${u} ${W.pluralize(u,["период","периода","периодов"])}`}),d=()=>{r("save",[...l.value]),r("update:show",!1)};return t.watch(()=>i.show,u=>{u&&(l.value=[...i.selectedKeys])}),(u,f)=>{const h=I.NCheckbox,p=I.NCheckboxGroup,m=I.NScrollbar,g=I.NButton,b=I.NModal;return t.openBlock(),t.createBlock(b,{show:n.show,preset:"card",title:"Настройка быстрого выбора",closable:"",style:t.normalizeStyle({width:t.unref(o),maxWidth:"calc(100vw - 1rem)"}),class:"sc-date-range-dialog","onUpdate:show":f[4]||(f[4]=y=>r("update:show",y))},{footer:t.withCtx(()=>[t.createElementVNode("div",jk,[t.createElementVNode("div",qk,[t.createElementVNode("span",Xk,t.toDisplayString(c.value),1),t.createVNode(g,{text:"",type:"info",onClick:f[1]||(f[1]=y=>l.value=[...t.unref(mf)])},{default:t.withCtx(()=>[...f[5]||(f[5]=[t.createTextVNode(" По умолчанию ",-1)])]),_:1}),t.createVNode(g,{text:"",type:"info",disabled:l.value.length===0,onClick:f[2]||(f[2]=y=>l.value=[])},{default:t.withCtx(()=>[...f[6]||(f[6]=[t.createTextVNode(" Снять все ",-1)])]),_:1},8,["disabled"])]),t.createElementVNode("div",Yk,[t.createVNode(g,{type:"primary",onClick:d},{default:t.withCtx(()=>[...f[7]||(f[7]=[t.createTextVNode(" Сохранить ",-1)])]),_:1}),t.createVNode(g,{onClick:f[3]||(f[3]=y=>r("update:show",!1))},{default:t.withCtx(()=>[...f[8]||(f[8]=[t.createTextVNode("Отмена",-1)])]),_:1})])])]),default:t.withCtx(()=>[t.createVNode(m,{class:"max-h-[60vh]"},{default:t.withCtx(()=>[t.createVNode(p,{value:l.value,"onUpdate:value":f[0]||(f[0]=y=>l.value=y)},{default:t.withCtx(()=>[t.createElementVNode("div",Lk,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(a),y=>(t.openBlock(),t.createElementBlock("div",{key:y.key,class:"flex flex-col gap-1.5"},[t.createElementVNode("div",Hk,t.toDisplayString(y.label),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(y.sections,_=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:_.key},[_.label?(t.openBlock(),t.createElementBlock("div",Wk,t.toDisplayString(_.label),1)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(_.children,x=>(t.openBlock(),t.createBlock(h,{key:x.value,value:x.value,label:x.label},null,8,["value","label"]))),128))],64))),128))]))),128))])]),_:1},8,["value"])]),_:1})]),_:1},8,["show","style"])}}}),Gk={class:"flex flex-col gap-2"},Zk={class:"flex items-center gap-2"},Qk={class:"flex gap-2 px-px pb-4 pt-px"},Jk={key:0,class:"text-sm text-gray-500"},e2={},t2=t.defineComponent({...e2,__name:"quick-periods",props:{from:{},to:{}},emits:["apply","preview"],setup(n,{emit:e}){const i=n,r=e,o=W.DateTimeProvider.standardPeriods(),s=()=>{const f=hf,h=W.PreferencesStorageProvider.getActualDataFromStorage(f);return(V.isArray(h)?h:mf).filter(m=>V.isString(m)&&m in o)},a=t.ref(s()),l=t.ref(!1),c=t.computed(()=>Object.entries(o).filter(([f])=>a.value.includes(f)).map(([f,h])=>({value:f,label:h.label,item:h,group:h.group}))),d=t.computed(()=>{const f=i.from?Ri(i.from):null,h=i.to?Ri(i.to):null;if(f===null||h===null)return null;const p=c.value.find(m=>{const{from:g,to:b}=m.item;return!g||!b?!1:Ri(g)===f&&Ri(b)===h});return p?String(p.value):null}),u=f=>{a.value=f;const h=hf;W.PreferencesStorageProvider.saveActualDataToStorage(h,f,Be.addYears(Be.startOfToday(),1))};return(f,h)=>{const p=Dk,m=I.NButton,g=Ak,b=Vk,y=Rk,_=Tk,x=Sk,w=I.NScrollbar;return t.openBlock(),t.createElementBlock("div",Gk,[t.createElementVNode("div",Zk,[h[3]||(h[3]=t.createElementVNode("span",{class:"text-sm font-medium text-gray-700"},"Быстрый выбор",-1)),t.createVNode(m,{size:"tiny",quaternary:"",circle:"","aria-label":"Настроить быстрый выбор",onClick:h[0]||(h[0]=C=>l.value=!0)},{icon:t.withCtx(()=>[t.createVNode(p)]),_:1})]),t.createVNode(w,{"x-scrollable":""},{default:t.withCtx(()=>[t.createElementVNode("div",Qk,[c.value.length===0?(t.openBlock(),t.createElementBlock("span",Jk," Периоды не выбраны ")):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(c.value,C=>(t.openBlock(),t.createBlock(m,{key:C.value,type:C.value===d.value?"primary":"default",ghost:C.value===d.value,"theme-overrides":t.unref(Ux),class:"shrink-0",onClick:N=>r("apply",C),onMouseenter:N=>r("preview",C),onMouseleave:h[1]||(h[1]=N=>r("preview"))},{icon:t.withCtx(()=>[C.group==="day"?(t.openBlock(),t.createBlock(g,{key:0})):C.group==="week"||C.group==="decade"?(t.openBlock(),t.createBlock(b,{key:1})):C.group==="quarter"||C.group==="halfYear"?(t.openBlock(),t.createBlock(y,{key:2})):C.group==="other"?(t.openBlock(),t.createBlock(_,{key:3})):(t.openBlock(),t.createBlock(x,{key:4}))]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(C.label),1)]),_:2},1032,["type","ghost","theme-overrides","onClick","onMouseenter"]))),128))])]),_:1}),t.createVNode(Kk,{show:l.value,"onUpdate:show":h[2]||(h[2]=C=>l.value=C),"selected-keys":a.value,onSave:u},null,8,["show","selected-keys"])])}}}),n2={class:"flex flex-col items-stretch gap-3 sm:flex-row"},i2={class:"order-2 flex-1 rounded-lg border border-solid border-gray-200 p-2 shadow-sm"},r2={class:"flex flex-col items-stretch pr-3"},o2={key:0,class:"px-2 pb-0.5 pt-2 text-xs text-gray-400"},s2={key:1,class:"order-2 w-44 shrink-0 rounded-lg border border-solid border-gray-200 p-1 shadow-sm"},a2={},l2=t.defineComponent({...a2,__name:"standard-periods",props:{activeKey:{},customPeriods:{}},emits:["apply","preview"],setup(n,{emit:e}){const i=n,r=e,o="custom",s=Ue.initRefDependingOnDeviceResolution(!0,!1,!1),a=W.DateTimeProvider.standardPeriods(),l=t.ref(W.STANDARD_PERIOD_GROUPS[0].key),c=t.computed(()=>{const u=W.STANDARD_PERIOD_GROUPS.map(f=>({key:f.key,value:f.key,label:f.label}));return V.isEmpty(i.customPeriods)||u.push({key:o,value:o,label:"Пользовательские"}),u}),d=t.computed(()=>l.value===o?[{type:"group",key:o,children:Oa(i.customPeriods??{})}]:_f(a,l.value));return(u,f)=>{const h=I.NButton,p=I.NScrollbar,m=I.NSelect,g=I.NMenu;return t.openBlock(),t.createElementBlock("div",n2,[t.createElementVNode("div",i2,[t.createVNode(p,{class:"max-h-96"},{default:t.withCtx(()=>[t.createElementVNode("div",r2,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.value,b=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:b.key},[b.label?(t.openBlock(),t.createElementBlock("div",o2,t.toDisplayString(b.label),1)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(b.children,y=>(t.openBlock(),t.createBlock(h,{key:y.value,size:"small",quaternary:"",type:y.value===n.activeKey?"primary":"default",class:"justify-start",onClick:_=>r("apply",y),onMouseenter:_=>r("preview",y),onMouseleave:f[0]||(f[0]=_=>r("preview"))},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(y.label),1)]),_:2},1032,["type","onClick","onMouseenter"]))),128))],64))),128))])]),_:1})]),t.unref(s)?(t.openBlock(),t.createBlock(m,{key:0,value:l.value,options:c.value,class:"order-1","onUpdate:value":f[1]||(f[1]=b=>l.value=b)},null,8,["value","options"])):(t.openBlock(),t.createElementBlock("div",s2,[t.createVNode(g,{value:l.value,options:c.value,mode:"vertical","onUpdate:value":f[2]||(f[2]=b=>l.value=b)},null,8,["value","options"])]))])}}}),c2={class:"flex flex-col gap-3"},d2={class:"flex flex-col gap-1 sm:flex-row sm:items-center"},u2={key:1,class:"overflow-x-auto rounded-lg border border-solid border-gray-200 p-2 shadow-sm sm:p-3"},f2={class:"flex flex-col items-stretch justify-between gap-2 sm:flex-row sm:items-center"},h2={class:"flex gap-2"},m2={},p2=t.defineComponent({...m2,__name:"date-range-dialog",props:{clearable:{type:Boolean,default:!0},disabled:{default:()=>({from:!1,to:!1})},show:{type:Boolean},dateRange:{default:void 0},customPeriods:{default:void 0},dateFormat:{default:void 0}},emits:["update:show","select"],setup(n,{emit:e}){const i=n,r=e,o=Ue.initRefDependingOnDeviceResolution("100%","90%","48rem"),s=t.ref("custom"),a=t.ref("months"),l=t.computed(()=>a.value==="months"?"Показать по дням":"Показать по месяцам"),c=()=>W.PreferencesStorageProvider.getActualDataFromStorage(uf)==="standard"?"standard":"custom",d=()=>W.PreferencesStorageProvider.getActualDataFromStorage(ff)==="days"?"days":"months",u=(v,E)=>{W.PreferencesStorageProvider.saveActualDataToStorage(v,E,Be.addYears(Be.startOfToday(),1))},f=t.ref({}),h=t.ref(null),p=t.ref(null),m=t.computed(()=>h.value??f.value),g=(v,E)=>{var R,M;const P=(R=i.disabled)!=null&&R.from?f.value.from:v,F=(M=i.disabled)!=null&&M.to?f.value.to:E;h.value=null,f.value=bf(P,F,i.disabled)},b=v=>{p.value=null,g(v,f.value.to)},y=v=>{p.value=null,g(f.value.from,v)},_=()=>{p.value=null,g(null,null)},x=v=>{p.value=null,g(v.from,v.to)},w=v=>{const E=v.item;g(E.from,E.to),p.value=String(v.value)},C=v=>{const E=v==null?void 0:v.item;h.value=E?{from:E.from,to:E.to}:null},N=()=>{h.value=null,s.value=s.value==="custom"?"standard":"custom",u(uf,s.value)},k=()=>{a.value=a.value==="months"?"days":"months",u(ff,a.value)},$=()=>{r("select",f.value),r("update:show",!1)};return t.watch(()=>i.show,v=>{v&&(s.value=c(),a.value=d(),p.value=null,h.value=null,f.value={...i.dateRange})}),(v,E)=>{const P=I.NButton,F=Wx,R=Dx,M=I.NTooltip,X=I.NModal;return t.openBlock(),t.createBlock(X,{show:n.show,preset:"card",title:"Выберите период",closable:"",style:t.normalizeStyle({width:t.unref(o),maxWidth:"calc(100vw - 1rem)"}),class:"sc-date-range-dialog","onUpdate:show":E[1]||(E[1]=G=>r("update:show",G))},{footer:t.withCtx(()=>[t.createElementVNode("div",f2,[t.createVNode(P,{text:"",type:"info",onClick:N},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(s.value==="custom"?"Показать стандартные периоды":"Показать произвольный период"),1)]),_:1}),t.createElementVNode("div",h2,[t.createVNode(P,{type:"primary",onClick:$},{default:t.withCtx(()=>[...E[3]||(E[3]=[t.createTextVNode(" Выбрать ",-1)])]),_:1}),t.createVNode(P,{onClick:E[0]||(E[0]=G=>r("update:show",!1))},{default:t.withCtx(()=>[...E[4]||(E[4]=[t.createTextVNode("Отмена",-1)])]),_:1})])])]),default:t.withCtx(()=>[t.createElementVNode("div",c2,[s.value==="custom"?(t.openBlock(),t.createBlock(t2,{key:0,from:f.value.from,to:f.value.to,onApply:w,onPreview:C},null,8,["from","to"])):t.createCommentVNode("",!0),t.createElementVNode("div",d2,[t.createVNode(kf,{from:m.value.from,to:m.value.to,clearable:n.clearable,disabled:n.disabled,"date-format":n.dateFormat,class:"flex-1","onUpdate:from":b,"onUpdate:to":y},null,8,["from","to","clearable","disabled","date-format"]),n.clearable?(t.openBlock(),t.createBlock(P,{key:0,text:"",type:"info",class:"sm:ml-2",onClick:_},{default:t.withCtx(()=>[...E[2]||(E[2]=[t.createTextVNode(" Очистить период ",-1)])]),_:1})):t.createCommentVNode("",!0)]),s.value==="custom"?(t.openBlock(),t.createElementBlock("div",u2,[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(a.value==="months"?hk:ok),{from:f.value.from,to:f.value.to,onSelect:x},{actions:t.withCtx(()=>[t.createVNode(M,{placement:"top",trigger:"hover"},{trigger:t.withCtx(()=>[t.createVNode(P,{size:"small","aria-label":l.value,"theme-overrides":t.unref(Lr),onClick:k},{icon:t.withCtx(()=>[a.value==="months"?(t.openBlock(),t.createBlock(F,{key:0})):(t.openBlock(),t.createBlock(R,{key:1}))]),_:1},8,["aria-label","theme-overrides"])]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(l.value),1)]),_:1})]),_:1},40,["from","to"]))])):(t.openBlock(),t.createBlock(l2,{key:2,"active-key":p.value,"custom-periods":n.customPeriods,onApply:w,onPreview:C},null,8,["active-key","custom-periods"]))])]),_:1},8,["show","style"])}}}),g2={class:"flex w-full min-w-0 items-center gap-1"},y2={},b2=t.defineComponent({...y2,__name:"date-range",props:{clearable:{type:Boolean,default:!0},disabled:{default:()=>({from:!1,to:!1})},predefinedDateRanges:{default:void 0},dateRange:{default:void 0},useDefaultPredefinedDateRanges:{type:Boolean,default:!1},placeholderFrom:{default:"Дата начала"},placeholderTo:{default:"Дата окончания"},dateFormat:{default:void 0}},emits:["update:date-range"],setup(n,{emit:e}){const i=n,r=e,o=t.ref(!1),s=t.computed(()=>{const u={...i.useDefaultPredefinedDateRanges?W.DateTimeProvider.defaultDateRanges():{},...i.predefinedDateRanges};return V.isEmpty(u)?void 0:u}),a=(u,f)=>{r("update:date-range",bf(u,f,i.disabled))},l=u=>{var f;a(u,(f=i.dateRange)==null?void 0:f.to)},c=u=>{var f;a((f=i.dateRange)==null?void 0:f.from,u)},d=u=>{a(u.from,u.to)};return(u,f)=>{var m,g,b,y;const h=Ax,p=I.NButton;return t.openBlock(),t.createElementBlock("div",g2,[t.createVNode(kf,{from:(m=n.dateRange)==null?void 0:m.from,to:(g=n.dateRange)==null?void 0:g.to,clearable:n.clearable,disabled:n.disabled,"placeholder-from":n.placeholderFrom,"placeholder-to":n.placeholderTo,"date-format":n.dateFormat,class:"min-w-0 flex-1","onUpdate:from":l,"onUpdate:to":c},null,8,["from","to","clearable","disabled","placeholder-from","placeholder-to","date-format"]),t.createVNode(p,{disabled:!!((b=n.disabled)!=null&&b.from&&((y=n.disabled)!=null&&y.to)),title:"Выбрать период","aria-label":"Выбрать период",onClick:f[0]||(f[0]=_=>o.value=!0)},{default:t.withCtx(()=>[t.createVNode(h)]),_:1},8,["disabled"]),t.createVNode(p2,{show:o.value,"onUpdate:show":f[1]||(f[1]=_=>o.value=_),"date-range":n.dateRange,clearable:n.clearable,disabled:n.disabled,"custom-periods":s.value,"date-format":n.dateFormat,onSelect:d},null,8,["show","date-range","clearable","disabled","custom-periods","date-format"])])}}}),_2={class:"sc-lbl-date text-nowrap"},w2={},es=t.defineComponent({...w2,__name:"date-time-label",props:{date:{},isTimeSecondary:{type:Boolean},isTimeOnSecondLine:{type:Boolean},isShowTime:{type:Boolean,default:!0}},setup(n){const e=n,i=t.computed(()=>Be.format(e.date,W.useBaseConfigStateStore().config.dateFormats.uiDate)),r=t.computed(()=>Be.format(e.date,"HH:mm"));return(o,s)=>(t.openBlock(),t.createElementBlock("span",{class:t.normalizeClass({"flex flex-col":n.isTimeOnSecondLine})},[t.createElementVNode("span",_2,t.toDisplayString(i.value),1),n.isShowTime?(t.openBlock(),t.createElementBlock("span",{key:0,class:t.normalizeClass([{"text-sc-grey":n.isTimeSecondary,"ml-1":!n.isTimeOnSecondLine},"sc-lbl-time"])},t.toDisplayString(r.value),3)):t.createCommentVNode("",!0)],2))}}),x2={},k2=t.defineComponent({...x2,__name:"debt",props:{debt:{default:0},showLabel:{type:Boolean,default:!1},wrapAsSmall:{type:Boolean,default:!1}},setup(n){const e=n,i=t.computed(()=>{let r="";return(e.showLabel??!1)&&(e.debt>0?r="Переплата: ":e.debt<0&&(r="Задолженность: ")),r});return(r,o)=>n.debt!==0?(t.openBlock(),t.createElementBlock("span",{key:0,class:t.normalizeClass({"text-sm":n.wrapAsSmall})},[t.createTextVNode(t.toDisplayString(i.value)+" ",1),t.createElementVNode("span",{class:t.normalizeClass({"text-green-700":n.debt>0,"text-red-700":n.debt<0})},t.toDisplayString(n.debt)+" ₽ ",3)],2)):t.createCommentVNode("",!0)}}),C2={class:"flex flex-row gap-2.5"},v2={class:"flex grow basis-0 flex-row flex-wrap justify-start justify-items-start gap-y-1 md:flex-nowrap"},S2={class:"flex min-w-0 flex-col-reverse flex-wrap-reverse justify-end gap-1 sm:flex-row"},B2={class:"mb-0.5 sm:mb-0 sm:ml-3"},N2={},T2=t.defineComponent({...N2,__name:"dialog-header",props:{showCloseButton:{type:Boolean,default:!0}},emits:["close"],setup(n){return(e,i)=>{const r=Jo,o=I.NButton,s=I.NPopover;return t.openBlock(),t.createElementBlock("div",C2,[t.createElementVNode("div",v2,[t.renderSlot(e.$slots,"main")]),t.createElementVNode("div",null,[t.createElementVNode("div",S2,[t.renderSlot(e.$slots,"extra-buttons"),t.createElementVNode("div",B2,[n.showCloseButton?(t.openBlock(),t.createBlock(s,{key:0,placement:"bottom"},{trigger:t.withCtx(()=>[t.createVNode(o,{size:"small",type:"error",onClick:i[0]||(i[0]=a=>e.$emit("close"))},{default:t.withCtx(()=>[t.createVNode(r)]),_:1})]),default:t.withCtx(()=>[i[1]||(i[1]=t.createTextVNode(" Закрыть ",-1))]),_:1})):t.createCommentVNode("",!0)])])])])}}}),$2={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function E2(n,e){return t.openBlock(),t.createElementBlock("svg",$2,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"square","stroke-miterlimit":"10","stroke-width":"44",d:"M465 127L241 384l-92-92m-9 93l-93-93m316-165L236 273"},null,-1)])])}const R2=t.markRaw({name:"ion-checkmark-done-sharp",render:E2}),P2={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function F2(n,e){return t.openBlock(),t.createElementBlock("svg",P2,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M368 128h80m-384 0h240m64 256h80m-384 0h240m-96-128h240m-384 0h80"},null,-1),t.createElementVNode("circle",{cx:"336",cy:"128",r:"32",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),t.createElementVNode("circle",{cx:"176",cy:"256",r:"32",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),t.createElementVNode("circle",{cx:"336",cy:"384",r:"32",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1)])])}const V2=t.markRaw({name:"ion-options-outline",render:F2}),M2={class:"flex flex-row gap-x-2.5 p-0 sm:p-1"},I2={class:"flex-auto"},A2={class:"sticky top-0 flex flex-none flex-col justify-start gap-y-1 sm:flex-row sm:justify-start sm:gap-x-1 sm:gap-y-0"},O2={class:"flex flex-none flex-col-reverse justify-end gap-y-1 sm:flex-row sm:justify-start sm:gap-x-1 sm:gap-y-0"},z2={},za=t.defineComponent({...z2,__name:"inline-view",props:{disabled:{type:Boolean,default:!1},showEditButton:{type:Boolean,default:!1},showApplyButton:{type:Boolean,default:!1},showCancelButton:{type:Boolean,default:!1}},emits:["edit","apply","cancel"],setup(n,{emit:e}){const i=e,r=t.ref(!1),o=()=>{i("edit")},s=()=>{r.value=!1},a=()=>{r.value=!0,i("apply",s)},l=()=>{i("cancel",s)};return(c,d)=>{const u=V2,f=I.NButton,h=I.NPopover,p=R2,m=Jo;return t.openBlock(),t.createElementBlock("div",M2,[t.createElementVNode("div",I2,[t.renderSlot(c.$slots,"default")]),t.createElementVNode("div",null,[t.createElementVNode("div",A2,[t.createElementVNode("div",O2,[n.showEditButton?(t.openBlock(),t.createBlock(h,{key:0,placement:"bottom"},{trigger:t.withCtx(()=>[t.createVNode(f,{disabled:n.disabled||r.value,type:"info",ghost:"",size:"small",onClick:o},{default:t.withCtx(()=>[t.createVNode(u)]),_:1},8,["disabled"])]),default:t.withCtx(()=>[d[0]||(d[0]=t.createTextVNode(" Редактировать данные ",-1))]),_:1})):t.createCommentVNode("",!0),n.showApplyButton?(t.openBlock(),t.createBlock(h,{key:1,disabled:r.value,placement:"bottom"},{trigger:t.withCtx(()=>[t.createVNode(f,{disabled:n.disabled||r.value,type:"primary",size:"small",onClick:a},{default:t.withCtx(()=>[t.createVNode(p)]),_:1},8,["disabled"])]),default:t.withCtx(()=>[d[1]||(d[1]=t.createTextVNode(" Сохранить изменения ",-1))]),_:1},8,["disabled"])):t.createCommentVNode("",!0),n.showCancelButton?(t.openBlock(),t.createBlock(h,{key:2,placement:"bottom"},{trigger:t.withCtx(()=>[t.createVNode(f,{disabled:n.disabled||r.value,type:"error",size:"small",onClick:l},{default:t.withCtx(()=>[t.createVNode(m)]),_:1},8,["disabled"])]),default:t.withCtx(()=>[d[2]||(d[2]=t.createTextVNode(" Отменить изменения ",-1))]),_:1})):t.createCommentVNode("",!0)]),t.renderSlot(c.$slots,"extra-buttons")])])])}}}),D2={},Cf=t.defineComponent({...D2,__name:"inline-editable-item",props:{disabled:{type:Boolean,default:!1},showEditor:{type:Boolean,default:!1},showEditButton:{type:Boolean,default:!0}},emits:["editor:apply","editor:cancel"],setup(n,{emit:e}){const i=n,r=e,o=t.ref(i.showEditor),s=l=>{r("editor:apply",d=>{o.value=!d,l()})},a=l=>{o.value=!1,l(),r("editor:cancel")};return t.onMounted(()=>{t.watch(()=>i.showEditor,l=>{o.value=l})}),(l,c)=>(t.openBlock(),t.createElementBlock("div",null,[o.value?(t.openBlock(),t.createBlock(za,{key:1,disabled:n.disabled,"show-apply-button":!0,"show-cancel-button":!0,onApply:s,onCancel:a},{"extra-buttons":t.withCtx(()=>[t.renderSlot(l.$slots,"extra-editor-buttons")]),default:t.withCtx(()=>[t.renderSlot(l.$slots,"editor")]),_:3},8,["disabled"])):(t.openBlock(),t.createBlock(za,{key:0,disabled:n.disabled,"show-edit-button":n.showEditButton,onEdit:c[0]||(c[0]=d=>o.value=!0)},{"extra-buttons":t.withCtx(()=>[t.renderSlot(l.$slots,"extra-viewer-buttons")]),default:t.withCtx(()=>[t.renderSlot(l.$slots,"viewer")]),_:3},8,["disabled","show-edit-button"]))]))}}),L2={key:0,class:"whitespace-pre-line"},H2={key:1,class:"text-sc-dark-grey"},W2={},j2=t.defineComponent({...W2,__name:"comment-editor",props:{disabled:{type:Boolean,default:!1},comment:{default:""}},emits:["update:comment"],setup(n,{emit:e}){const i=n,r=e,o=t.ref(i.comment);t.watch(()=>o.value,l=>{o.value=l});const s=l=>{r("update:comment",o.value,l)},a=()=>{o.value=i.comment};return(l,c)=>{const d=I.NInput;return t.openBlock(),t.createBlock(Cf,{disabled:n.disabled,"onEditor:apply":s,"onEditor:cancel":a},{viewer:t.withCtx(()=>[t.createElementVNode("div",null,[n.comment?(t.openBlock(),t.createElementBlock("span",L2,t.toDisplayString(n.comment),1)):(t.openBlock(),t.createElementBlock("span",H2," - Комментарий отсутствует - "))])]),editor:t.withCtx(()=>[t.createVNode(d,{value:o.value,"onUpdate:value":c[0]||(c[0]=u=>o.value=u),clearable:!0,type:"textarea"},null,8,["value"])]),_:1},8,["disabled"])}}}),q2={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function X2(n,e){return t.openBlock(),t.createElementBlock("svg",q2,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M336 176h40a40 40 0 0 1 40 40v208a40 40 0 0 1-40 40H136a40 40 0 0 1-40-40V216a40 40 0 0 1 40-40h40"},null,-1),t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"m176 272l80 80l80-80M256 48v288"},null,-1)])])}const Y2=t.markRaw({name:"ion-download-outline",render:X2}),U2={},K2=t.defineComponent({...U2,__name:"single-file-upload-selector",props:{draggedAreaText:{},accept:{},isError:{type:Boolean}},emits:["update:file"],setup(n,{emit:e}){const i=n,r=e,o=t.ref([]),s=t.computed(()=>o.value.map(l=>(l.status=i.isError?"error":"finished",l))),a=l=>{o.value=l;const c={name:"",content:""};if(l.length===0){r("update:file",null);return}const d=l[0];c.name=d.name;const u=new FileReader;u.addEventListener("load",()=>{c.content=u.result??"",r("update:file",c)}),u.readAsDataURL(d.file)};return(l,c)=>{const d=Y2;return t.openBlock(),t.createBlock(t.unref(I.NUpload),{"file-list":s.value,"default-upload":!1,max:1,"show-retry-button":!1,action:"",accept:n.accept,"directory-dnd":"",class:"content-center","onUpdate:fileList":a},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NUploadDragger),null,{default:t.withCtx(()=>[t.renderSlot(l.$slots,"dragged-area",{},()=>[t.createElementVNode("div",null,[t.createVNode(d,{class:"text-2xl"}),t.createElementVNode("div",null,t.toDisplayString(n.draggedAreaText??"Перетащите в эту область файл, который необходимо загрузить."),1)])])]),_:3})]),_:3},8,["file-list","accept"])}}}),G2={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Z2(n,e){return t.openBlock(),t.createElementBlock("svg",G2,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M449.07 399.08L278.64 82.58c-12.08-22.44-44.26-22.44-56.35 0L51.87 399.08A32 32 0 0 0 80 446.25h340.89a32 32 0 0 0 28.18-47.17m-198.6-1.83a20 20 0 1 1 20-20a20 20 0 0 1-20 20m21.72-201.15l-5.74 122a16 16 0 0 1-32 0l-5.74-121.95a21.73 21.73 0 0 1 21.5-22.69h.21a21.74 21.74 0 0 1 21.73 22.7Z"},null,-1)])])}const Q2=t.markRaw({name:"ion-warning",render:Z2}),J2={},eC=t.defineComponent({...J2,__name:"warning-icon",props:{popoverText:{default:""},iconClass:{default:"text-sc-warning"}},setup(n){return(e,i)=>{const r=Q2,o=I.NPopover;return t.openBlock(),t.createBlock(o,{disabled:n.popoverText.length===0,placement:"bottom"},{trigger:t.withCtx(()=>[t.createVNode(r,{class:t.normalizeClass(`ml-0.5 ${n.iconClass}`)},null,8,["class"])]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(n.popoverText),1)]),_:1},8,["disabled"])}}}),tC={},nC=t.defineComponent({...tC,__name:"debounced-input",props:{value:{default:void 0},clearable:{type:Boolean,default:!1},debounceTime:{default:800},placeholder:{default:""}},emits:["update:value"],setup(n,{emit:e}){const i=n,r=e,o=t.ref(i.value),s=t.computed(()=>t.inject("debounce-input-time",i.debounceTime)),a=V.debounce(()=>r("update:value",o.value),s.value),l=c=>{o.value=c,a()};return t.watch(()=>i.value,c=>{o.value=c}),(c,d)=>(t.openBlock(),t.createBlock(t.unref(I.NInput),{value:o.value,"onUpdate:value":[d[0]||(d[0]=u=>o.value=u),l],clearable:n.clearable,placeholder:n.placeholder},{prefix:t.withCtx(()=>[t.renderSlot(c.$slots,"prefix")]),_:3},8,["value","clearable","placeholder"]))}}),iC={},rC=t.defineComponent({...iC,__name:"debounced-input-number",props:{value:{default:void 0},clearable:{type:Boolean,default:!1},debounceTime:{default:500},placeholder:{default:""},min:{default:void 0},max:{default:void 0},step:{default:1},validator:{type:Function,default:void 0},parse:{type:Function,default:void 0},showButton:{type:Boolean,default:!0}},emits:["update:value","keydown","input","focus"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.ref(r.value),a=t.computed(()=>t.inject("debounce-input-time",r.debounceTime)),l=V.debounce(()=>o("update:value",s.value),a.value),c=p=>{s.value=p,l()};t.watch(()=>r.value,p=>{s.value=p});const d=t.ref(null);return e({focus:()=>{var p;return(p=d.value)==null?void 0:p.focus()},blur:()=>{var p;return(p=d.value)==null?void 0:p.blur()},select:()=>{var p;return(p=d.value)==null?void 0:p.select()}}),(p,m)=>(t.openBlock(),t.createBlock(t.unref(I.NInputNumber),{ref_key:"inputReference",ref:d,value:s.value??null,clearable:n.clearable,parse:n.parse,"show-button":n.showButton,placeholder:n.placeholder,min:n.min,max:n.max,step:n.step,validator:n.validator,"onUpdate:value":c,onKeydown:m[0]||(m[0]=g=>o("keydown",g)),onInput:m[1]||(m[1]=g=>o("input",g)),onFocus:m[2]||(m[2]=g=>o("focus",g))},{prefix:t.withCtx(()=>[t.renderSlot(p.$slots,"prefix")]),_:3},8,["value","clearable","parse","show-button","placeholder","min","max","step","validator"]))}}),oC={},sC=t.defineComponent({...oC,__name:"phone-input",props:{value:{},debounceTime:{},disabled:{type:Boolean},placeholder:{},defaultCountry:{},preferredCountries:{},onlyCountries:{}},emits:["update:value"],setup(n,{emit:e}){const i=n,r=e,o=t.ref((i.value??"").replaceAll(/\D*/g,"")),s=V.debounce(c=>r("update:value",c),i.debounceTime??0),a=c=>{let d="";if(V.isString(c))o.value=c,d=c.replaceAll(/(\s|\(|\)|-|_)*/g,"");else if(V.isObject(c)){if(o.value=c.formatted,!c.valid)return;d=c instanceof Br.PhoneNumber?c.format("E.164"):`+${c.countryCallingCode}${c.nationalNumber}`}i.debounceTime?s(d):r("update:value",d)},l=c=>{const d=c.replaceAll(/\D*/g,"");try{const u=Br.parsePhoneNumberWithError(`+${d}`);u.isValid()?o.value=u.format("E.164"):u.getPossibleCountries().length>0&&(o.value=`+${d}`)}catch(u){if(u instanceof Br.ParseError)o.value=d;else throw u}};return t.watch(()=>i.value,c=>{var d;(c==null?void 0:c.replaceAll(/\D*/g,""))!==((d=o.value)==null?void 0:d.replaceAll(/\D*/g,""))&&l(c)},{immediate:!0}),t.onBeforeMount(()=>l(o.value??"")),(c,d)=>(t.openBlock(),t.createBlock(t.unref(Fm.VueTelInput),{modelValue:o.value,"onUpdate:modelValue":[d[0]||(d[0]=u=>o.value=u),a],"auto-default-country":!1,"auto-format":!0,"default-country":n.defaultCountry,disabled:n.disabled,"input-options":{placeholder:n.placeholder},"preferred-countries":n.preferredCountries,"only-countries":n.onlyCountries,mode:"international",class:"tel-input"},null,8,["modelValue","default-country","disabled","input-options","preferred-countries","only-countries"]))}}),aC=dn(sC,[["__scopeId","data-v-751dbb0e"]]),lC={class:"mb-7 grid grid-cols-2 gap-3.5 lg:grid-cols-4"},cC={class:"mb-2 text-[11.5px] font-semibold uppercase text-gray-500"},dC={},uC=t.defineComponent({...dC,__name:"kpi-grid",props:{items:{},isLoading:{type:Boolean}},setup(n){return(e,i)=>(t.openBlock(),t.createElementBlock("div",lC,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.items,r=>(t.openBlock(),t.createElementBlock("div",{key:r.label,class:"rounded-lg border border-solid border-gray-200 px-4 py-4"},[t.createElementVNode("div",cC,t.toDisplayString(r.label),1),t.createElementVNode("div",{class:t.normalizeClass(["text-[25px] font-bold",r.valueClass])},t.toDisplayString(n.isLoading?"…":r.value),3),t.createElementVNode("div",{class:t.normalizeClass(["mt-1.5 text-xs font-medium",r.noteClass])},t.toDisplayString(r.note),3)]))),128))]))}}),fC={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function hC(n,e){return t.openBlock(),t.createElementBlock("svg",fC,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 6H6a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-6m-7 1l9-9m-5 0h5v5"},null,-1)])])}const mC=t.markRaw({name:"tabler-external-link",render:hC}),pC={class:"flex flex-row gap-1 hover:underline hover:decoration-dashed"},gC=["href"],yC={},bC=t.defineComponent({...yC,__name:"external-link",props:{text:{},url:{},description:{}},setup(n){return(e,i)=>{const r=mC,o=I.NTooltip;return t.openBlock(),t.createBlock(o,{disabled:t.unref(V.isUndefined)(n.description),placement:"top-start"},{trigger:t.withCtx(()=>[t.createElementVNode("span",pC,[t.createElementVNode("a",{href:n.url,target:"_blank",class:"no-underline"},t.toDisplayString(n.text),9,gC),t.createVNode(r,{class:"mt-0.5 flex-none"})])]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(n.description),1)]),_:1},8,["disabled"])}}}),_C={key:1,class:"h-24"},wC={key:2,class:"flex flex-col gap-3"},xC={},kC=t.defineComponent({...xC,__name:"compact-card-list",props:{isLoading:{type:Boolean},isEmpty:{type:Boolean},emptyDescription:{},pagination:{}},emits:["update:page","update:pageSize"],setup(n,{emit:e}){const i=e,r=[20,50,100];return(o,s)=>(t.openBlock(),t.createBlock(t.unref(I.NSpin),{show:n.isLoading},{default:t.withCtx(()=>[!n.isLoading&&n.isEmpty?(t.openBlock(),t.createBlock(t.unref(I.NEmpty),{key:0,description:n.emptyDescription},null,8,["description"])):n.isLoading&&n.isEmpty?(t.openBlock(),t.createElementBlock("div",_C)):(t.openBlock(),t.createElementBlock("div",wC,[t.renderSlot(o.$slots,"default")])),n.pagination&&n.pagination.itemCount>0?(t.openBlock(),t.createBlock(t.unref(I.NPagination),{key:3,class:"mt-4 flex-wrap justify-center gap-y-2",size:"small",page:n.pagination.page,"page-size":n.pagination.pageSize,"item-count":n.pagination.itemCount,"page-slot":n.pagination.pageSlot,"page-sizes":r,"show-size-picker":!0,prefix:t.unref(ec),"onUpdate:page":s[0]||(s[0]=a=>i("update:page",a)),"onUpdate:pageSize":s[1]||(s[1]=a=>i("update:pageSize",a))},null,8,["page","page-size","item-count","page-slot","prefix"])):t.createCommentVNode("",!0)]),_:3},8,["show"]))}}),CC={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function vC(n,e){return t.openBlock(),t.createElementBlock("svg",CC,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32",d:"M448 256c0-106-86-192-192-192S64 150 64 256s86 192 192 192s192-86 192-192Z"},null,-1),t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M336 256H176"},null,-1)])])}const SC=t.markRaw({name:"ion-remove-circle-outline",render:vC});let ts=[];const vf=new WeakMap;function BC(){ts.forEach(n=>n(...vf.get(n))),ts=[]}function Sf(n,...e){vf.set(n,e),!ts.includes(n)&&ts.push(n)===1&&requestAnimationFrame(BC)}function Hr(n,e){let{target:i}=n;for(;i;){if(i.dataset&&i.dataset[e]!==void 0)return!0;i=i.parentElement}return!1}function Wr(n){return n.composedPath()[0]||null}function jr(n){return typeof n=="string"?n.endsWith("px")?Number(n.slice(0,n.length-2)):Number(n):n}function qr(n){if(n!=null)return typeof n=="number"?`${n}px`:n.endsWith("px")?n:`${n}px`}function xn(n,e){const i=n.trim().split(/\s+/g),r={top:i[0]};switch(i.length){case 1:r.right=i[0],r.bottom=i[0],r.left=i[0];break;case 2:r.right=i[1],r.left=i[1],r.bottom=i[0];break;case 3:r.right=i[1],r.bottom=i[2],r.left=i[1];break;case 4:r.right=i[1],r.bottom=i[2],r.left=i[3];break;default:throw new Error("[seemly/getMargin]:"+n+" is not a valid value.")}return e===void 0?r:r[e]}const Bf={aliceblue:"#F0F8FF",antiquewhite:"#FAEBD7",aqua:"#0FF",aquamarine:"#7FFFD4",azure:"#F0FFFF",beige:"#F5F5DC",bisque:"#FFE4C4",black:"#000",blanchedalmond:"#FFEBCD",blue:"#00F",blueviolet:"#8A2BE2",brown:"#A52A2A",burlywood:"#DEB887",cadetblue:"#5F9EA0",chartreuse:"#7FFF00",chocolate:"#D2691E",coral:"#FF7F50",cornflowerblue:"#6495ED",cornsilk:"#FFF8DC",crimson:"#DC143C",cyan:"#0FF",darkblue:"#00008B",darkcyan:"#008B8B",darkgoldenrod:"#B8860B",darkgray:"#A9A9A9",darkgrey:"#A9A9A9",darkgreen:"#006400",darkkhaki:"#BDB76B",darkmagenta:"#8B008B",darkolivegreen:"#556B2F",darkorange:"#FF8C00",darkorchid:"#9932CC",darkred:"#8B0000",darksalmon:"#E9967A",darkseagreen:"#8FBC8F",darkslateblue:"#483D8B",darkslategray:"#2F4F4F",darkslategrey:"#2F4F4F",darkturquoise:"#00CED1",darkviolet:"#9400D3",deeppink:"#FF1493",deepskyblue:"#00BFFF",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1E90FF",firebrick:"#B22222",floralwhite:"#FFFAF0",forestgreen:"#228B22",fuchsia:"#F0F",gainsboro:"#DCDCDC",ghostwhite:"#F8F8FF",gold:"#FFD700",goldenrod:"#DAA520",gray:"#808080",grey:"#808080",green:"#008000",greenyellow:"#ADFF2F",honeydew:"#F0FFF0",hotpink:"#FF69B4",indianred:"#CD5C5C",indigo:"#4B0082",ivory:"#FFFFF0",khaki:"#F0E68C",lavender:"#E6E6FA",lavenderblush:"#FFF0F5",lawngreen:"#7CFC00",lemonchiffon:"#FFFACD",lightblue:"#ADD8E6",lightcoral:"#F08080",lightcyan:"#E0FFFF",lightgoldenrodyellow:"#FAFAD2",lightgray:"#D3D3D3",lightgrey:"#D3D3D3",lightgreen:"#90EE90",lightpink:"#FFB6C1",lightsalmon:"#FFA07A",lightseagreen:"#20B2AA",lightskyblue:"#87CEFA",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#B0C4DE",lightyellow:"#FFFFE0",lime:"#0F0",limegreen:"#32CD32",linen:"#FAF0E6",magenta:"#F0F",maroon:"#800000",mediumaquamarine:"#66CDAA",mediumblue:"#0000CD",mediumorchid:"#BA55D3",mediumpurple:"#9370DB",mediumseagreen:"#3CB371",mediumslateblue:"#7B68EE",mediumspringgreen:"#00FA9A",mediumturquoise:"#48D1CC",mediumvioletred:"#C71585",midnightblue:"#191970",mintcream:"#F5FFFA",mistyrose:"#FFE4E1",moccasin:"#FFE4B5",navajowhite:"#FFDEAD",navy:"#000080",oldlace:"#FDF5E6",olive:"#808000",olivedrab:"#6B8E23",orange:"#FFA500",orangered:"#FF4500",orchid:"#DA70D6",palegoldenrod:"#EEE8AA",palegreen:"#98FB98",paleturquoise:"#AFEEEE",palevioletred:"#DB7093",papayawhip:"#FFEFD5",peachpuff:"#FFDAB9",peru:"#CD853F",pink:"#FFC0CB",plum:"#DDA0DD",powderblue:"#B0E0E6",purple:"#800080",rebeccapurple:"#663399",red:"#F00",rosybrown:"#BC8F8F",royalblue:"#4169E1",saddlebrown:"#8B4513",salmon:"#FA8072",sandybrown:"#F4A460",seagreen:"#2E8B57",seashell:"#FFF5EE",sienna:"#A0522D",silver:"#C0C0C0",skyblue:"#87CEEB",slateblue:"#6A5ACD",slategray:"#708090",slategrey:"#708090",snow:"#FFFAFA",springgreen:"#00FF7F",steelblue:"#4682B4",tan:"#D2B48C",teal:"#008080",thistle:"#D8BFD8",tomato:"#FF6347",turquoise:"#40E0D0",violet:"#EE82EE",wheat:"#F5DEB3",white:"#FFF",whitesmoke:"#F5F5F5",yellow:"#FF0",yellowgreen:"#9ACD32",transparent:"#0000"};function NC(n,e,i){e/=100,i/=100;let r=(o,s=(o+n/60)%6)=>i-i*e*Math.max(Math.min(s,4-s,1),0);return[r(5)*255,r(3)*255,r(1)*255]}function TC(n,e,i){e/=100,i/=100;let r=e*Math.min(i,1-i),o=(s,a=(s+n/30)%12)=>i-r*Math.max(Math.min(a-3,9-a,1),-1);return[o(0)*255,o(8)*255,o(4)*255]}const Mn="^\\s*",In="\\s*$",mi="\\s*((\\.\\d+)|(\\d+(\\.\\d*)?))%\\s*",rn="\\s*((\\.\\d+)|(\\d+(\\.\\d*)?))\\s*",Pi="([0-9A-Fa-f])",Fi="([0-9A-Fa-f]{2})",Nf=new RegExp(`${Mn}hsl\\s*\\(${rn},${mi},${mi}\\)${In}`),Tf=new RegExp(`${Mn}hsv\\s*\\(${rn},${mi},${mi}\\)${In}`),$f=new RegExp(`${Mn}hsla\\s*\\(${rn},${mi},${mi},${rn}\\)${In}`),Ef=new RegExp(`${Mn}hsva\\s*\\(${rn},${mi},${mi},${rn}\\)${In}`),$C=new RegExp(`${Mn}rgb\\s*\\(${rn},${rn},${rn}\\)${In}`),EC=new RegExp(`${Mn}rgba\\s*\\(${rn},${rn},${rn},${rn}\\)${In}`),RC=new RegExp(`${Mn}#${Pi}${Pi}${Pi}${In}`),PC=new RegExp(`${Mn}#${Fi}${Fi}${Fi}${In}`),FC=new RegExp(`${Mn}#${Pi}${Pi}${Pi}${Pi}${In}`),VC=new RegExp(`${Mn}#${Fi}${Fi}${Fi}${Fi}${In}`);function Qt(n){return parseInt(n,16)}function MC(n){try{let e;if(e=$f.exec(n))return[is(e[1]),pi(e[5]),pi(e[9]),Mi(e[13])];if(e=Nf.exec(n))return[is(e[1]),pi(e[5]),pi(e[9]),1];throw new Error(`[seemly/hsla]: Invalid color value ${n}.`)}catch(e){throw e}}function IC(n){try{let e;if(e=Ef.exec(n))return[is(e[1]),pi(e[5]),pi(e[9]),Mi(e[13])];if(e=Tf.exec(n))return[is(e[1]),pi(e[5]),pi(e[9]),1];throw new Error(`[seemly/hsva]: Invalid color value ${n}.`)}catch(e){throw e}}function Vi(n){try{let e;if(e=PC.exec(n))return[Qt(e[1]),Qt(e[2]),Qt(e[3]),1];if(e=$C.exec(n))return[$t(e[1]),$t(e[5]),$t(e[9]),1];if(e=EC.exec(n))return[$t(e[1]),$t(e[5]),$t(e[9]),Mi(e[13])];if(e=RC.exec(n))return[Qt(e[1]+e[1]),Qt(e[2]+e[2]),Qt(e[3]+e[3]),1];if(e=VC.exec(n))return[Qt(e[1]),Qt(e[2]),Qt(e[3]),Mi(Qt(e[4])/255)];if(e=FC.exec(n))return[Qt(e[1]+e[1]),Qt(e[2]+e[2]),Qt(e[3]+e[3]),Mi(Qt(e[4]+e[4])/255)];if(n in Bf)return Vi(Bf[n]);if(Nf.test(n)||$f.test(n)){const[i,r,o,s]=MC(n);return[...TC(i,r,o),s]}else if(Tf.test(n)||Ef.test(n)){const[i,r,o,s]=IC(n);return[...NC(i,r,o),s]}throw new Error(`[seemly/rgba]: Invalid color value ${n}.`)}catch(e){throw e}}function AC(n){return n>1?1:n<0?0:n}function Da(n,e,i,r){return`rgba(${$t(n)}, ${$t(e)}, ${$t(i)}, ${AC(r)})`}function La(n,e,i,r,o){return $t((n*e*(1-r)+i*r)/o)}function OC(n,e){Array.isArray(n)||(n=Vi(n)),Array.isArray(e)||(e=Vi(e));const i=n[3],r=e[3],o=Mi(i+r-i*r);return Da(La(n[0],i,e[0],r,o),La(n[1],i,e[1],r,o),La(n[2],i,e[2],r,o),o)}function Le(n,e){const[i,r,o,s=1]=Array.isArray(n)?n:Vi(n);return typeof e.alpha=="number"?Da(i,r,o,e.alpha):Da(i,r,o,s)}function ns(n,e){const[i,r,o,s=1]=Array.isArray(n)?n:Vi(n),{lightness:a=1,alpha:l=1}=e;return zC([i*a,r*a,o*a,s*l])}function Mi(n){const e=Math.round(Number(n)*100)/100;return e>1?1:e<0?0:e}function is(n){const e=Math.round(Number(n));return e>=360||e<0?0:e}function $t(n){const e=Math.round(Number(n));return e>255?255:e<0?0:e}function pi(n){const e=Math.round(Number(n));return e>100?100:e<0?0:e}function zC(n){const[e,i,r]=n;return 3 in n?`rgba(${$t(e)}, ${$t(i)}, ${$t(r)}, ${Mi(n[3])})`:`rgba(${$t(e)}, ${$t(i)}, ${$t(r)}, 1)`}function DC(n=8){return Math.random().toString(16).slice(2,2+n)}function Rf(n){return Array.isArray(n)?n:[n]}const Ha={STOP:"STOP"};function Pf(n,e){const i=e(n);n.children!==void 0&&i!==Ha.STOP&&n.children.forEach(r=>Pf(r,e))}function LC(n,e={}){const{preserveGroup:i=!1}=e,r=[],o=i?a=>{a.isLeaf||(r.push(a.key),s(a.children))}:a=>{a.isLeaf||(a.isGroup||r.push(a.key),s(a.children))};function s(a){a.forEach(o)}return s(n),r}function HC(n,e){const{isLeaf:i}=n;return i!==void 0?i:!e(n)}function WC(n){return n.children}function jC(n){return n.key}function qC(){return!1}function XC(n,e){const{isLeaf:i}=n;return!(i===!1&&!Array.isArray(e(n)))}function YC(n){return n.disabled===!0}function UC(n,e){return n.isLeaf===!1&&!Array.isArray(e(n))}function KC(n,e){if(n.isLeaf===!0){const i=e(n);if(Array.isArray(i)&&i.length>0)return!0}return!1}function Wa(n){var e;return n==null?[]:Array.isArray(n)?n:(e=n.checkedKeys)!==null&&e!==void 0?e:[]}function ja(n){var e;return n==null||Array.isArray(n)?[]:(e=n.indeterminateKeys)!==null&&e!==void 0?e:[]}function GC(n,e){const i=new Set(n);return e.forEach(r=>{i.has(r)||i.add(r)}),Array.from(i)}function ZC(n,e){const i=new Set(n);return e.forEach(r=>{i.has(r)&&i.delete(r)}),Array.from(i)}function QC(n){return(n==null?void 0:n.type)==="group"}function JC(n){const e=new Map;return n.forEach((i,r)=>{e.set(i.key,r)}),i=>{var r;return(r=e.get(i))!==null&&r!==void 0?r:null}}class ev extends Error{constructor(){super(),this.message="SubtreeNotLoadedError: checking a subtree whose required nodes are not fully loaded."}}function tv(n,e,i,r){return rs(e.concat(n),i,r,!1)}function nv(n,e){const i=new Set;return n.forEach(r=>{const o=e.treeNodeMap.get(r);if(o!==void 0){let s=o.parent;for(;s!==null&&!(s.disabled||i.has(s.key));)i.add(s.key),s=s.parent}}),i}function iv(n,e,i,r){const o=rs(e,i,r,!1),s=rs(n,i,r,!0),a=nv(n,i),l=[];return o.forEach(c=>{(s.has(c)||a.has(c))&&l.push(c)}),l.forEach(c=>o.delete(c)),o}function qa(n,e){const{checkedKeys:i,keysToCheck:r,keysToUncheck:o,indeterminateKeys:s,cascade:a,leafOnly:l,checkStrategy:c,allowNotLoaded:d}=n;if(!a)return r!==void 0?{checkedKeys:GC(i,r),indeterminateKeys:Array.from(s)}:o!==void 0?{checkedKeys:ZC(i,o),indeterminateKeys:Array.from(s)}:{checkedKeys:Array.from(i),indeterminateKeys:Array.from(s)};const{levelTreeNodeMap:u}=e;let f;o!==void 0?f=iv(o,i,e,d):r!==void 0?f=tv(r,i,e,d):f=rs(i,e,d,!1);const h=c==="parent",p=c==="child"||l,m=f,g=new Set,b=Math.max.apply(null,Array.from(u.keys()));for(let y=b;y>=0;y-=1){const _=y===0,x=u.get(y);for(const w of x){if(w.isLeaf)continue;const{key:C,shallowLoaded:N}=w;if(p&&N&&w.children.forEach(E=>{!E.disabled&&!E.isLeaf&&E.shallowLoaded&&m.has(E.key)&&m.delete(E.key)}),w.disabled||!N)continue;let k=!0,$=!1,v=!0;for(const E of w.children){const P=E.key;if(!E.disabled){if(v&&(v=!1),m.has(P))$=!0;else if(g.has(P)){$=!0,k=!1;break}else if(k=!1,$)break}}k&&!v?(h&&w.children.forEach(E=>{!E.disabled&&m.has(E.key)&&m.delete(E.key)}),m.add(C)):$&&g.add(C),_&&p&&m.has(C)&&m.delete(C)}}return{checkedKeys:Array.from(m),indeterminateKeys:Array.from(g)}}function rs(n,e,i,r){const{treeNodeMap:o,getChildren:s}=e,a=new Set,l=new Set(n);return n.forEach(c=>{const d=o.get(c);d!==void 0&&Pf(d,u=>{if(u.disabled)return Ha.STOP;const{key:f}=u;if(!a.has(f)&&(a.add(f),l.add(f),UC(u.rawNode,s))){if(r)return Ha.STOP;if(!i)throw new ev}})}),l}function rv(n,{includeGroup:e=!1,includeSelf:i=!0},r){var o;const s=r.treeNodeMap;let a=n==null?null:(o=s.get(n))!==null&&o!==void 0?o:null;const l={keyPath:[],treeNodePath:[],treeNode:a};if(a!=null&&a.ignored)return l.treeNode=null,l;for(;a;)!a.ignored&&(e||!a.isGroup)&&l.treeNodePath.push(a),a=a.parent;return l.treeNodePath.reverse(),i||l.treeNodePath.pop(),l.keyPath=l.treeNodePath.map(c=>c.key),l}function ov(n){if(n.length===0)return null;const e=n[0];return e.isGroup||e.ignored||e.disabled?e.getNext():e}function sv(n,e){const i=n.siblings,r=i.length,{index:o}=n;return e?i[(o+1)%r]:o===i.length-1?null:i[o+1]}function Ff(n,e,{loop:i=!1,includeDisabled:r=!1}={}){const o=e==="prev"?av:sv,s={reverse:e==="prev"};let a=!1,l=null;function c(d){if(d!==null){if(d===n){if(!a)a=!0;else if(!n.disabled&&!n.isGroup){l=n;return}}else if((!d.disabled||r)&&!d.ignored&&!d.isGroup){l=d;return}if(d.isGroup){const u=Xa(d,s);u!==null?l=u:c(o(d,i))}else{const u=o(d,!1);if(u!==null)c(u);else{const f=lv(d);f!=null&&f.isGroup?c(o(f,i)):i&&c(o(d,!0))}}}}return c(n),l}function av(n,e){const i=n.siblings,r=i.length,{index:o}=n;return e?i[(o-1+r)%r]:o===0?null:i[o-1]}function lv(n){return n.parent}function Xa(n,e={}){const{reverse:i=!1}=e,{children:r}=n;if(r){const{length:o}=r,s=i?o-1:0,a=i?-1:o,l=i?-1:1;for(let c=s;c!==a;c+=l){const d=r[c];if(!d.disabled&&!d.ignored)if(d.isGroup){const u=Xa(d,e);if(u!==null)return u}else return d}}return null}const cv={getChild(){return this.ignored?null:Xa(this)},getParent(){const{parent:n}=this;return n!=null&&n.isGroup?n.getParent():n},getNext(n={}){return Ff(this,"next",n)},getPrev(n={}){return Ff(this,"prev",n)}};function dv(n,e){const i=e?new Set(e):void 0,r=[];function o(s){s.forEach(a=>{r.push(a),!(a.isLeaf||!a.children||a.ignored)&&(a.isGroup||i===void 0||i.has(a.key))&&o(a.children)})}return o(n),r}function uv(n,e){const i=n.key;for(;e;){if(e.key===i)return!0;e=e.parent}return!1}var fv={};function Vf(n,e,i,r,o,s=null,a=0){const l=[];return n.forEach((c,d)=>{var u;fv.NODE_ENV!=="production"&&KC(c,o)&&console.error("[treemate]: node",c,"is invalid");const f=Object.create(r);if(f.rawNode=c,f.siblings=l,f.level=a,f.index=d,f.isFirstChild=d===0,f.isLastChild=d+1===n.length,f.parent=s,!f.ignored){const h=o(c);Array.isArray(h)&&(f.children=Vf(h,e,i,r,o,f,a+1))}l.push(f),e.set(f.key,f),i.has(a)||i.set(a,[]),(u=i.get(a))===null||u===void 0||u.push(f)}),l}function hv(n,e={}){var i;const r=new Map,o=new Map,{getDisabled:s=YC,getIgnored:a=qC,getIsGroup:l=QC,getKey:c=jC}=e,d=(i=e.getChildren)!==null&&i!==void 0?i:WC,u=e.ignoreEmptyChildren?w=>{const C=d(w);return Array.isArray(C)?C.length?C:null:C}:d,f=Object.assign({get key(){return c(this.rawNode)},get disabled(){return s(this.rawNode)},get isGroup(){return l(this.rawNode)},get isLeaf(){return HC(this.rawNode,u)},get shallowLoaded(){return XC(this.rawNode,u)},get ignored(){return a(this.rawNode)},contains(w){return uv(this,w)}},cv),h=Vf(n,r,o,f,u);function p(w){if(w==null)return null;const C=r.get(w);return C&&!C.isGroup&&!C.ignored?C:null}function m(w){if(w==null)return null;const C=r.get(w);return C&&!C.ignored?C:null}function g(w,C){const N=m(w);return N?N.getPrev(C):null}function b(w,C){const N=m(w);return N?N.getNext(C):null}function y(w){const C=m(w);return C?C.getParent():null}function _(w){const C=m(w);return C?C.getChild():null}const x={treeNodes:h,treeNodeMap:r,levelTreeNodeMap:o,maxLevel:Math.max(...o.keys()),getChildren:u,getFlattenedNodes(w){return dv(h,w)},getNode:p,getPrev:g,getNext:b,getParent:y,getChild:_,getFirstAvailableNode(){return ov(h)},getPath(w,C={}){return rv(w,C,x)},getCheckedKeys(w,C={}){const{cascade:N=!0,leafOnly:k=!1,checkStrategy:$="all",allowNotLoaded:v=!1}=C;return qa({checkedKeys:Wa(w),indeterminateKeys:ja(w),cascade:N,leafOnly:k,checkStrategy:$,allowNotLoaded:v},x)},check(w,C,N={}){const{cascade:k=!0,leafOnly:$=!1,checkStrategy:v="all",allowNotLoaded:E=!1}=N;return qa({checkedKeys:Wa(C),indeterminateKeys:ja(C),keysToCheck:w==null?[]:Rf(w),cascade:k,leafOnly:$,checkStrategy:v,allowNotLoaded:E},x)},uncheck(w,C,N={}){const{cascade:k=!0,leafOnly:$=!1,checkStrategy:v="all",allowNotLoaded:E=!1}=N;return qa({checkedKeys:Wa(C),indeterminateKeys:ja(C),keysToUncheck:w==null?[]:Rf(w),cascade:k,leafOnly:$,checkStrategy:v,allowNotLoaded:E},x)},getNonLeafKeys(w={}){return LC(h,w)}};return x}function os(n){return n.composedPath()[0]}const mv={mousemoveoutside:new WeakMap,clickoutside:new WeakMap};function pv(n,e,i){if(n==="mousemoveoutside"){const r=o=>{e.contains(os(o))||i(o)};return{mousemove:r,touchstart:r}}else if(n==="clickoutside"){let r=!1;const o=a=>{r=!e.contains(os(a))},s=a=>{r&&(e.contains(os(a))||i(a))};return{mousedown:o,mouseup:s,touchstart:o,touchend:s}}return console.error(`[evtd/create-trap-handler]: name \`${n}\` is invalid. This could be a bug of evtd.`),{}}function Mf(n,e,i){const r=mv[n];let o=r.get(e);o===void 0&&r.set(e,o=new WeakMap);let s=o.get(i);return s===void 0&&o.set(i,s=pv(n,e,i)),s}function gv(n,e,i,r){if(n==="mousemoveoutside"||n==="clickoutside"){const o=Mf(n,e,i);return Object.keys(o).forEach(s=>{Lt(s,document,o[s],r)}),!0}return!1}function yv(n,e,i,r){if(n==="mousemoveoutside"||n==="clickoutside"){const o=Mf(n,e,i);return Object.keys(o).forEach(s=>{yt(s,document,o[s],r)}),!0}return!1}function bv(){if(typeof window>"u")return{on:()=>{},off:()=>{}};const n=new WeakMap,e=new WeakMap;function i(){n.set(this,!0)}function r(){n.set(this,!0),e.set(this,!0)}function o(k,$,v){const E=k[$];return k[$]=function(){return v.apply(k,arguments),E.apply(k,arguments)},k}function s(k,$){k[$]=Event.prototype[$]}const a=new WeakMap,l=Object.getOwnPropertyDescriptor(Event.prototype,"currentTarget");function c(){var k;return(k=a.get(this))!==null&&k!==void 0?k:null}function d(k,$){l!==void 0&&Object.defineProperty(k,"currentTarget",{configurable:!0,enumerable:!0,get:$??l.get})}const u={bubble:{},capture:{}},f={};function h(){const k=function($){const{type:v,eventPhase:E,bubbles:P}=$,F=os($);if(E===2)return;const R=E===1?"capture":"bubble";let M=F;const X=[];for(;M===null&&(M=window),X.push(M),M!==window;)M=M.parentNode||null;const G=u.capture[v],Z=u.bubble[v];if(o($,"stopPropagation",i),o($,"stopImmediatePropagation",r),d($,c),R==="capture"){if(G===void 0)return;for(let O=X.length-1;O>=0&&!n.has($);--O){const A=X[O],Y=G.get(A);if(Y!==void 0){a.set($,A);for(const H of Y){if(e.has($))break;H($)}}if(O===0&&!P&&Z!==void 0){const H=Z.get(A);if(H!==void 0)for(const T of H){if(e.has($))break;T($)}}}}else if(R==="bubble"){if(Z===void 0)return;for(let O=0;O<X.length&&!n.has($);++O){const A=X[O],Y=Z.get(A);if(Y!==void 0){a.set($,A);for(const H of Y){if(e.has($))break;H($)}}}}s($,"stopPropagation"),s($,"stopImmediatePropagation"),d($)};return k.displayName="evtdUnifiedHandler",k}function p(){const k=function($){const{type:v,eventPhase:E}=$;if(E!==2)return;const P=f[v];P!==void 0&&P.forEach(F=>F($))};return k.displayName="evtdUnifiedWindowEventHandler",k}const m=h(),g=p();function b(k,$){const v=u[k];return v[$]===void 0&&(v[$]=new Map,window.addEventListener($,m,k==="capture")),v[$]}function y(k){return f[k]===void 0&&(f[k]=new Set,window.addEventListener(k,g)),f[k]}function _(k,$){let v=k.get($);return v===void 0&&k.set($,v=new Set),v}function x(k,$,v,E){const P=u[$][v];if(P!==void 0){const F=P.get(k);if(F!==void 0&&F.has(E))return!0}return!1}function w(k,$){const v=f[k];return!!(v!==void 0&&v.has($))}function C(k,$,v,E){let P;if(typeof E=="object"&&E.once===!0?P=G=>{N(k,$,P,E),v(G)}:P=v,gv(k,$,P,E))return;const R=E===!0||typeof E=="object"&&E.capture===!0?"capture":"bubble",M=b(R,k),X=_(M,$);if(X.has(P)||X.add(P),$===window){const G=y(k);G.has(P)||G.add(P)}}function N(k,$,v,E){if(yv(k,$,v,E))return;const F=E===!0||typeof E=="object"&&E.capture===!0,R=F?"capture":"bubble",M=b(R,k),X=_(M,$);if($===window&&!x($,F?"bubble":"capture",k,v)&&w(k,v)){const Z=f[k];Z.delete(v),Z.size===0&&(window.removeEventListener(k,g),f[k]=void 0)}X.has(v)&&X.delete(v),X.size===0&&M.delete($),M.size===0&&(window.removeEventListener(k,m,R==="capture"),u[R][k]=void 0)}return{on:C,off:N}}const{on:Lt,off:yt}=bv(),br="@@mmoContext",_v={mounted(n,{value:e}){n[br]={handler:void 0},typeof e=="function"&&(n[br].handler=e,Lt("mousemoveoutside",n,e))},updated(n,{value:e}){const i=n[br];typeof e=="function"?i.handler?i.handler!==e&&(yt("mousemoveoutside",n,i.handler),i.handler=e,Lt("mousemoveoutside",n,e)):(n[br].handler=e,Lt("mousemoveoutside",n,e)):i.handler&&(yt("mousemoveoutside",n,i.handler),i.handler=void 0)},unmounted(n){const{handler:e}=n[br];e&&yt("mousemoveoutside",n,e),n[br].handler=void 0}},_r="@@coContext",ss={mounted(n,{value:e,modifiers:i}){n[_r]={handler:void 0},typeof e=="function"&&(n[_r].handler=e,Lt("clickoutside",n,e,{capture:i.capture}))},updated(n,{value:e,modifiers:i}){const r=n[_r];typeof e=="function"?r.handler?r.handler!==e&&(yt("clickoutside",n,r.handler,{capture:i.capture}),r.handler=e,Lt("clickoutside",n,e,{capture:i.capture})):(n[_r].handler=e,Lt("clickoutside",n,e,{capture:i.capture})):r.handler&&(yt("clickoutside",n,r.handler,{capture:i.capture}),r.handler=void 0)},unmounted(n,{modifiers:e}){const{handler:i}=n[_r];i&&yt("clickoutside",n,i,{capture:e.capture}),n[_r].handler=void 0}};function wv(n,e){console.error(`[vdirs/${n}]: ${e}`)}class xv{constructor(){this.elementZIndex=new Map,this.nextZIndex=2e3}get elementCount(){return this.elementZIndex.size}ensureZIndex(e,i){const{elementZIndex:r}=this;if(i!==void 0){e.style.zIndex=`${i}`,r.delete(e);return}const{nextZIndex:o}=this;r.has(e)&&r.get(e)+1===this.nextZIndex||(e.style.zIndex=`${o}`,r.set(e,o),this.nextZIndex=o+1,this.squashState())}unregister(e,i){const{elementZIndex:r}=this;r.has(e)?r.delete(e):i===void 0&&wv("z-index-manager/unregister-element","Element not found when unregistering."),this.squashState()}squashState(){const{elementCount:e}=this;e||(this.nextZIndex=2e3),this.nextZIndex-e>2500&&this.rearrange()}rearrange(){const e=Array.from(this.elementZIndex.entries());e.sort((i,r)=>i[1]-r[1]),this.nextZIndex=2e3,e.forEach(i=>{const r=i[0],o=this.nextZIndex++;`${o}`!==r.style.zIndex&&(r.style.zIndex=`${o}`)})}}const Ya=new xv,wr="@@ziContext",If={mounted(n,e){const{value:i={}}=e,{zIndex:r,enabled:o}=i;n[wr]={enabled:!!o,initialized:!1},o&&(Ya.ensureZIndex(n,r),n[wr].initialized=!0)},updated(n,e){const{value:i={}}=e,{zIndex:r,enabled:o}=i,s=n[wr].enabled;o&&!s&&(Ya.ensureZIndex(n,r),n[wr].initialized=!0),n[wr].enabled=!!o},unmounted(n,e){if(!n[wr].initialized)return;const{value:i={}}=e,{zIndex:r}=i;Ya.unregister(n,r)}};function kv(n){const e=t.ref(!!n.value);if(e.value)return t.readonly(e);const i=t.watch(n,r=>{r&&(e.value=!0,i())});return t.readonly(e)}function hn(n){const e=t.computed(n),i=t.ref(e.value);return t.watch(e,r=>{i.value=r}),typeof n=="function"?i:{__v_isRef:!0,get value(){return i.value},set value(r){n.set(r)}}}const Cv=typeof window<"u";let xr,Xr;(()=>{var n,e;xr=Cv?(e=(n=document)===null||n===void 0?void 0:n.fonts)===null||e===void 0?void 0:e.ready:void 0,Xr=!1,xr!==void 0?xr.then(()=>{Xr=!0}):Xr=!0})();function vv(n){if(Xr)return;let e=!1;t.onMounted(()=>{Xr||xr==null||xr.then(()=>{e||n()})}),t.onBeforeUnmount(()=>{e=!0})}function Ua(n,e){return t.watch(n,i=>{i!==void 0&&(e.value=i)}),t.computed(()=>n.value===void 0?e.value:n.value)}function as(){const n=t.ref(!1);return t.onMounted(()=>{n.value=!0}),t.readonly(n)}function Af(n,e){return t.computed(()=>{for(const i of e)if(n[i]!==void 0)return n[i];return n[e[e.length-1]]})}const Sv=(typeof window>"u"?!1:/iPad|iPhone|iPod/.test(navigator.platform)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)&&!window.MSStream;function Bv(){return Sv}function Ka(n,e,i="default"){const r=e[i];if(r===void 0)throw new Error(`[vueuc/${n}]: slot[${i}] is empty.`);return r()}function Ga(n,e=!0,i=[]){return n.forEach(r=>{if(r!==null){if(typeof r!="object"){(typeof r=="string"||typeof r=="number")&&i.push(t.createTextVNode(String(r)));return}if(Array.isArray(r)){Ga(r,e,i);return}if(r.type===t.Fragment){if(r.children===null)return;Array.isArray(r.children)&&Ga(r.children,e,i)}else r.type!==t.Comment&&i.push(r)}}),i}function Of(n,e,i="default"){const r=e[i];if(r===void 0)throw new Error(`[vueuc/${n}]: slot[${i}] is empty.`);const o=Ga(r());if(o.length===1)return o[0];throw new Error(`[vueuc/${n}]: slot[${i}] should have exactly one child.`)}let gi=null;function zf(){if(gi===null&&(gi=document.getElementById("v-binder-view-measurer"),gi===null)){gi=document.createElement("div"),gi.id="v-binder-view-measurer";const{style:n}=gi;n.position="fixed",n.left="0",n.right="0",n.top="0",n.bottom="0",n.pointerEvents="none",n.visibility="hidden",document.body.appendChild(gi)}return gi.getBoundingClientRect()}function Nv(n,e){const i=zf();return{top:e,left:n,height:0,width:0,right:i.width-n,bottom:i.height-e}}function Za(n){const e=n.getBoundingClientRect(),i=zf();return{left:e.left-i.left,top:e.top-i.top,bottom:i.height+i.top-e.bottom,right:i.width+i.left-e.right,width:e.width,height:e.height}}function Tv(n){return n.nodeType===9?null:n.parentNode}function Df(n){if(n===null)return null;const e=Tv(n);if(e===null)return null;if(e.nodeType===9)return document;if(e.nodeType===1){const{overflow:i,overflowX:r,overflowY:o}=getComputedStyle(e);if(/(auto|scroll|overlay)/.test(i+o+r))return e}return Df(e)}const Lf=t.defineComponent({name:"Binder",props:{syncTargetWithParent:Boolean,syncTarget:{type:Boolean,default:!0}},setup(n){var e;t.provide("VBinder",(e=t.getCurrentInstance())===null||e===void 0?void 0:e.proxy);const i=t.inject("VBinder",null),r=t.ref(null),o=y=>{r.value=y,i&&n.syncTargetWithParent&&i.setTargetRef(y)};let s=[];const a=()=>{let y=r.value;for(;y=Df(y),y!==null;)s.push(y);for(const _ of s)Lt("scroll",_,f,!0)},l=()=>{for(const y of s)yt("scroll",y,f,!0);s=[]},c=new Set,d=y=>{c.size===0&&a(),c.has(y)||c.add(y)},u=y=>{c.has(y)&&c.delete(y),c.size===0&&l()},f=()=>{Sf(h)},h=()=>{c.forEach(y=>y())},p=new Set,m=y=>{p.size===0&&Lt("resize",window,b),p.has(y)||p.add(y)},g=y=>{p.has(y)&&p.delete(y),p.size===0&&yt("resize",window,b)},b=()=>{p.forEach(y=>y())};return t.onBeforeUnmount(()=>{yt("resize",window,b),l()}),{targetRef:r,setTargetRef:o,addScrollListener:d,removeScrollListener:u,addResizeListener:m,removeResizeListener:g}},render(){return Ka("binder",this.$slots)}}),Hf=t.defineComponent({name:"Target",setup(){const{setTargetRef:n,syncTarget:e}=t.inject("VBinder");return{syncTarget:e,setTargetDirective:{mounted:n,updated:n}}},render(){const{syncTarget:n,setTargetDirective:e}=this;return n?t.withDirectives(Of("follower",this.$slots),[[e]]):Of("follower",this.$slots)}}),$v="@css-render/vue3-ssr";function Ev(n,e){return`<style cssr-id="${n}">
104
104
  ${e}
105
105
  </style>`}function Rv(n,e,i){const{styles:r,ids:o}=i;o.has(n)||r!==null&&(o.add(n),r.push(Ev(n,e)))}const Pv=typeof document<"u";function Ii(){if(Pv)return;const n=t.inject($v,null);if(n!==null)return{adapter:(e,i)=>Rv(e,i,n),context:n}}function Wf(n,e){console.error(`[vueuc/${n}]: ${e}`)}function Fv(n){let e=0;for(let i=0;i<n.length;++i)n[i]==="&"&&++e;return e}const jf=/\s*,(?![^(]*\))\s*/g,Vv=/\s+/g;function Mv(n,e){const i=[];return e.split(jf).forEach(r=>{let o=Fv(r);if(o){if(o===1){n.forEach(a=>{i.push(r.replace("&",a))});return}}else{n.forEach(a=>{i.push((a&&a+" ")+r)});return}let s=[r];for(;o--;){const a=[];s.forEach(l=>{n.forEach(c=>{a.push(l.replace("&",c))})}),s=a}s.forEach(a=>i.push(a))}),i}function Iv(n,e){const i=[];return e.split(jf).forEach(r=>{n.forEach(o=>{i.push((o&&o+" ")+r)})}),i}function Av(n){let e=[""];return n.forEach(i=>{i=i&&i.trim(),i&&(i.includes("&")?e=Mv(e,i):e=Iv(e,i))}),e.join(", ").replace(Vv," ")}function qf(n){if(!n)return;const e=n.parentElement;e&&e.removeChild(n)}function ls(n,e){return(e??document.head).querySelector(`style[cssr-id="${n}"]`)}function Ov(n){const e=document.createElement("style");return e.setAttribute("cssr-id",n),e}function cs(n){return n?/^\s*@(s|m)/.test(n):!1}const zv=/[A-Z]/g;function Xf(n){return n.replace(zv,e=>"-"+e.toLowerCase())}function Dv(n,e=" "){return typeof n=="object"&&n!==null?` {
106
106
  `+Object.entries(n).map(i=>e+` ${Xf(i[0])}: ${i[1]};`).join(`
@@ -113,7 +113,7 @@ ${o}
113
113
  `);return}l=Xf(l),c!=null&&a.push(` ${l}${Dv(c)}`)}),n&&a.push("}"),a.join(`
114
114
  `)}function Qa(n,e,i){n&&n.forEach(r=>{if(Array.isArray(r))Qa(r,e,i);else if(typeof r=="function"){const o=r(e);Array.isArray(o)?Qa(o,e,i):o&&i(o)}else r&&i(r)})}function Uf(n,e,i,r,o){const s=n.$;let a="";if(!s||typeof s=="string")cs(s)?a=s:e.push(s);else if(typeof s=="function"){const d=s({context:r.context,props:o});cs(d)?a=d:e.push(d)}else if(s.before&&s.before(r.context),!s.$||typeof s.$=="string")cs(s.$)?a=s.$:e.push(s.$);else if(s.$){const d=s.$({context:r.context,props:o});cs(d)?a=d:e.push(d)}const l=Av(e),c=Yf(l,n.props,r,o);a?i.push(`${a} {`):c.length&&i.push(c),n.children&&Qa(n.children,{context:r.context,props:o},d=>{if(typeof d=="string"){const u=Yf(l,{raw:d},r,o);i.push(u)}else Uf(d,e,i,r,o)}),e.pop(),a&&i.push("}"),s&&s.after&&s.after(r.context)}function Hv(n,e,i){const r=[];return Uf(n,[],r,e,i),r.join(`
115
115
 
116
- `)}function Ja(n){for(var e=0,i,r=0,o=n.length;o>=4;++r,o-=4)i=n.charCodeAt(r)&255|(n.charCodeAt(++r)&255)<<8|(n.charCodeAt(++r)&255)<<16|(n.charCodeAt(++r)&255)<<24,i=(i&65535)*1540483477+((i>>>16)*59797<<16),i^=i>>>24,e=(i&65535)*1540483477+((i>>>16)*59797<<16)^(e&65535)*1540483477+((e>>>16)*59797<<16);switch(o){case 3:e^=(n.charCodeAt(r+2)&255)<<16;case 2:e^=(n.charCodeAt(r+1)&255)<<8;case 1:e^=n.charCodeAt(r)&255,e=(e&65535)*1540483477+((e>>>16)*59797<<16)}return e^=e>>>13,e=(e&65535)*1540483477+((e>>>16)*59797<<16),((e^e>>>15)>>>0).toString(36)}typeof window<"u"&&(window.__cssrContext={});function Wv(n,e,i,r){const{els:o}=e;if(i===void 0)o.forEach(qf),e.els=[];else{const s=ls(i,r);s&&o.includes(s)&&(qf(s),e.els=o.filter(a=>a!==s))}}function Kf(n,e){n.push(e)}function jv(n,e,i,r,o,s,a,l,c){let d;if(i===void 0&&(d=e.render(r),i=Ja(d)),c){c.adapter(i,d??e.render(r));return}l===void 0&&(l=document.head);const u=ls(i,l);if(u!==null&&!s)return u;const f=u??Ov(i);if(d===void 0&&(d=e.render(r)),f.textContent=d,u!==null)return u;if(a){const h=l.querySelector(`meta[name="${a}"]`);if(h)return l.insertBefore(f,h),Kf(e.els,f),f}return o?l.insertBefore(f,l.querySelector("style, link")):l.appendChild(f),Kf(e.els,f),f}function qv(n){return Hv(this,this.instance,n)}function Xv(n={}){const{id:e,ssr:i,props:r,head:o=!1,force:s=!1,anchorMetaName:a,parent:l}=n;return jv(this.instance,this,e,r,o,s,a,l,i)}function Yv(n={}){const{id:e,parent:i}=n;Wv(this.instance,this,e,i)}const ds=function(n,e,i,r){return{instance:n,$:e,props:i,children:r,els:[],render:qv,mount:Xv,unmount:Yv}},Uv=function(n,e,i,r){return Array.isArray(e)?ds(n,{$:null},null,e):Array.isArray(i)?ds(n,e,null,i):Array.isArray(r)?ds(n,e,i,r):ds(n,e,i,null)};function Gf(n={}){const e={c:((...i)=>Uv(e,...i)),use:(i,...r)=>i.install(e,...r),find:ls,context:{},config:n};return e}function Kv(n,e){if(n===void 0)return!1;if(e){const{context:{ids:i}}=e;return i.has(n)}return ls(n)!==null}const{c:yi}=Gf(),el="vueuc-style";function Zf(n){return n&-n}class Qf{constructor(e,i){this.l=e,this.min=i;const r=new Array(e+1);for(let o=0;o<e+1;++o)r[o]=0;this.ft=r}add(e,i){if(i===0)return;const{l:r,ft:o}=this;for(e+=1;e<=r;)o[e]+=i,e+=Zf(e)}get(e){return this.sum(e+1)-this.sum(e)}sum(e){if(e===void 0&&(e=this.l),e<=0)return 0;const{ft:i,min:r,l:o}=this;if(e>o)throw new Error("[FinweckTree.sum]: `i` is larger than length.");let s=e*r;for(;e>0;)s+=i[e],e-=Zf(e);return s}getBound(e){let i=0,r=this.l;for(;r>i;){const o=Math.floor((i+r)/2),s=this.sum(o);if(s>e){r=o;continue}else if(s<e){if(i===o)return this.sum(i+1)<=e?i+1:o;i=o}else return o}return i}}function Jf(n){return typeof n=="string"?document.querySelector(n):n()||null}const Gv=t.defineComponent({name:"LazyTeleport",props:{to:{type:[String,Object],default:void 0},disabled:Boolean,show:{type:Boolean,required:!0}},setup(n){return{showTeleport:kv(t.toRef(n,"show")),mergedTo:t.computed(()=>{const{to:e}=n;return e??"body"})}},render(){return this.showTeleport?this.disabled?Ka("lazy-teleport",this.$slots):t.h(t.Teleport,{disabled:this.disabled,to:this.mergedTo},Ka("lazy-teleport",this.$slots)):null}}),us={top:"bottom",bottom:"top",left:"right",right:"left"},eh={start:"end",center:"center",end:"start"},tl={top:"height",bottom:"height",left:"width",right:"width"},Zv={"bottom-start":"top left",bottom:"top center","bottom-end":"top right","top-start":"bottom left",top:"bottom center","top-end":"bottom right","right-start":"top left",right:"center left","right-end":"bottom left","left-start":"top right",left:"center right","left-end":"bottom right"},Qv={"bottom-start":"bottom left",bottom:"bottom center","bottom-end":"bottom right","top-start":"top left",top:"top center","top-end":"top right","right-start":"top right",right:"center right","right-end":"bottom right","left-start":"top left",left:"center left","left-end":"bottom left"},Jv={"bottom-start":"right","bottom-end":"left","top-start":"right","top-end":"left","right-start":"bottom","right-end":"top","left-start":"bottom","left-end":"top"},th={top:!0,bottom:!1,left:!0,right:!1},nh={top:"end",bottom:"start",left:"end",right:"start"};function eS(n,e,i,r,o,s){if(!o||s)return{placement:n,top:0,left:0};const[a,l]=n.split("-");let c=l??"center",d={top:0,left:0};const u=(p,m,g)=>{let b=0,y=0;const _=i[p]-e[m]-e[p];return _>0&&r&&(g?y=th[m]?_:-_:b=th[m]?_:-_),{left:b,top:y}},f=a==="left"||a==="right";if(c!=="center"){const p=Jv[n],m=us[p],g=tl[p];if(i[g]>e[g]){if(e[p]+e[g]<i[g]){const b=(i[g]-e[g])/2;e[p]<b||e[m]<b?e[p]<e[m]?(c=eh[l],d=u(g,m,f)):d=u(g,p,f):c="center"}}else i[g]<e[g]&&e[m]<0&&e[p]>e[m]&&(c=eh[l])}else{const p=a==="bottom"||a==="top"?"left":"top",m=us[p],g=tl[p],b=(i[g]-e[g])/2;(e[p]<b||e[m]<b)&&(e[p]>e[m]?(c=nh[p],d=u(g,p,f)):(c=nh[m],d=u(g,m,f)))}let h=a;return e[a]<i[tl[a]]&&e[a]<e[us[a]]&&(h=us[a]),{placement:c!=="center"?`${h}-${c}`:h,left:d.left,top:d.top}}function tS(n,e){return e?Qv[n]:Zv[n]}function nS(n,e,i,r,o,s){if(s)switch(n){case"bottom-start":return{top:`${Math.round(i.top-e.top+i.height)}px`,left:`${Math.round(i.left-e.left)}px`,transform:"translateY(-100%)"};case"bottom-end":return{top:`${Math.round(i.top-e.top+i.height)}px`,left:`${Math.round(i.left-e.left+i.width)}px`,transform:"translateX(-100%) translateY(-100%)"};case"top-start":return{top:`${Math.round(i.top-e.top)}px`,left:`${Math.round(i.left-e.left)}px`,transform:""};case"top-end":return{top:`${Math.round(i.top-e.top)}px`,left:`${Math.round(i.left-e.left+i.width)}px`,transform:"translateX(-100%)"};case"right-start":return{top:`${Math.round(i.top-e.top)}px`,left:`${Math.round(i.left-e.left+i.width)}px`,transform:"translateX(-100%)"};case"right-end":return{top:`${Math.round(i.top-e.top+i.height)}px`,left:`${Math.round(i.left-e.left+i.width)}px`,transform:"translateX(-100%) translateY(-100%)"};case"left-start":return{top:`${Math.round(i.top-e.top)}px`,left:`${Math.round(i.left-e.left)}px`,transform:""};case"left-end":return{top:`${Math.round(i.top-e.top+i.height)}px`,left:`${Math.round(i.left-e.left)}px`,transform:"translateY(-100%)"};case"top":return{top:`${Math.round(i.top-e.top)}px`,left:`${Math.round(i.left-e.left+i.width/2)}px`,transform:"translateX(-50%)"};case"right":return{top:`${Math.round(i.top-e.top+i.height/2)}px`,left:`${Math.round(i.left-e.left+i.width)}px`,transform:"translateX(-100%) translateY(-50%)"};case"left":return{top:`${Math.round(i.top-e.top+i.height/2)}px`,left:`${Math.round(i.left-e.left)}px`,transform:"translateY(-50%)"};case"bottom":default:return{top:`${Math.round(i.top-e.top+i.height)}px`,left:`${Math.round(i.left-e.left+i.width/2)}px`,transform:"translateX(-50%) translateY(-100%)"}}switch(n){case"bottom-start":return{top:`${Math.round(i.top-e.top+i.height+r)}px`,left:`${Math.round(i.left-e.left+o)}px`,transform:""};case"bottom-end":return{top:`${Math.round(i.top-e.top+i.height+r)}px`,left:`${Math.round(i.left-e.left+i.width+o)}px`,transform:"translateX(-100%)"};case"top-start":return{top:`${Math.round(i.top-e.top+r)}px`,left:`${Math.round(i.left-e.left+o)}px`,transform:"translateY(-100%)"};case"top-end":return{top:`${Math.round(i.top-e.top+r)}px`,left:`${Math.round(i.left-e.left+i.width+o)}px`,transform:"translateX(-100%) translateY(-100%)"};case"right-start":return{top:`${Math.round(i.top-e.top+r)}px`,left:`${Math.round(i.left-e.left+i.width+o)}px`,transform:""};case"right-end":return{top:`${Math.round(i.top-e.top+i.height+r)}px`,left:`${Math.round(i.left-e.left+i.width+o)}px`,transform:"translateY(-100%)"};case"left-start":return{top:`${Math.round(i.top-e.top+r)}px`,left:`${Math.round(i.left-e.left+o)}px`,transform:"translateX(-100%)"};case"left-end":return{top:`${Math.round(i.top-e.top+i.height+r)}px`,left:`${Math.round(i.left-e.left+o)}px`,transform:"translateX(-100%) translateY(-100%)"};case"top":return{top:`${Math.round(i.top-e.top+r)}px`,left:`${Math.round(i.left-e.left+i.width/2+o)}px`,transform:"translateY(-100%) translateX(-50%)"};case"right":return{top:`${Math.round(i.top-e.top+i.height/2+r)}px`,left:`${Math.round(i.left-e.left+i.width+o)}px`,transform:"translateY(-50%)"};case"left":return{top:`${Math.round(i.top-e.top+i.height/2+r)}px`,left:`${Math.round(i.left-e.left+o)}px`,transform:"translateY(-50%) translateX(-100%)"};case"bottom":default:return{top:`${Math.round(i.top-e.top+i.height+r)}px`,left:`${Math.round(i.left-e.left+i.width/2+o)}px`,transform:"translateX(-50%)"}}}const iS=yi([yi(".v-binder-follower-container",{position:"absolute",left:"0",right:"0",top:"0",height:"0",pointerEvents:"none",zIndex:"auto"}),yi(".v-binder-follower-content",{position:"absolute",zIndex:"auto"},[yi("> *",{pointerEvents:"all"})])]),ih=t.defineComponent({name:"Follower",inheritAttrs:!1,props:{show:Boolean,enabled:{type:Boolean,default:void 0},placement:{type:String,default:"bottom"},syncTrigger:{type:Array,default:["resize","scroll"]},to:[String,Object],flip:{type:Boolean,default:!0},internalShift:Boolean,x:Number,y:Number,width:String,minWidth:String,containerClass:String,teleportDisabled:Boolean,zindexable:{type:Boolean,default:!0},zIndex:Number,overlap:Boolean},setup(n){const e=t.inject("VBinder"),i=fn(()=>n.enabled!==void 0?n.enabled:n.show),r=t.ref(null),o=t.ref(null),s=()=>{const{syncTrigger:h}=n;h.includes("scroll")&&e.addScrollListener(c),h.includes("resize")&&e.addResizeListener(c)},a=()=>{e.removeScrollListener(c),e.removeResizeListener(c)};t.onMounted(()=>{i.value&&(c(),s())});const l=Ii();iS.mount({id:"vueuc/binder",head:!0,anchorMetaName:el,ssr:l}),t.onBeforeUnmount(()=>{a()}),vv(()=>{i.value&&c()});const c=()=>{if(!i.value)return;const h=r.value;if(h===null)return;const p=e.targetRef,{x:m,y:g,overlap:b}=n,y=m!==void 0&&g!==void 0?Nv(m,g):Za(p);h.style.setProperty("--v-target-width",`${Math.round(y.width)}px`),h.style.setProperty("--v-target-height",`${Math.round(y.height)}px`);const{width:_,minWidth:x,placement:w,internalShift:C,flip:N}=n;h.setAttribute("v-placement",w),b?h.setAttribute("v-overlap",""):h.removeAttribute("v-overlap");const{style:k}=h;_==="target"?k.width=`${y.width}px`:_!==void 0?k.width=_:k.width="",x==="target"?k.minWidth=`${y.width}px`:x!==void 0?k.minWidth=x:k.minWidth="";const $=Za(h),v=Za(o.value),{left:E,top:P,placement:F}=eS(w,y,$,C,N,b),R=tS(F,b),{left:M,top:X,transform:G}=nS(F,v,y,P,E,b);h.setAttribute("v-placement",F),h.style.setProperty("--v-offset-left",`${Math.round(E)}px`),h.style.setProperty("--v-offset-top",`${Math.round(P)}px`),h.style.transform=`translateX(${M}) translateY(${X}) ${G}`,h.style.setProperty("--v-transform-origin",R),h.style.transformOrigin=R};t.watch(i,h=>{h?(s(),d()):a()});const d=()=>{t.nextTick().then(c).catch(h=>console.error(h))};["placement","x","y","internalShift","flip","width","overlap","minWidth"].forEach(h=>{t.watch(t.toRef(n,h),c)}),["teleportDisabled"].forEach(h=>{t.watch(t.toRef(n,h),d)}),t.watch(t.toRef(n,"syncTrigger"),h=>{h.includes("resize")?e.addResizeListener(c):e.removeResizeListener(c),h.includes("scroll")?e.addScrollListener(c):e.removeScrollListener(c)});const u=as(),f=fn(()=>{const{to:h}=n;if(h!==void 0)return h;u.value});return{VBinder:e,mergedEnabled:i,offsetContainerRef:o,followerRef:r,mergedTo:f,syncPosition:c}},render(){return t.h(Gv,{show:this.show,to:this.mergedTo,disabled:this.teleportDisabled},{default:()=>{var n,e;const i=t.h("div",{class:["v-binder-follower-container",this.containerClass],ref:"offsetContainerRef"},[t.h("div",{class:"v-binder-follower-content",ref:"followerRef"},(e=(n=this.$slots).default)===null||e===void 0?void 0:e.call(n))]);return this.zindexable?t.withDirectives(i,[[If,{enabled:this.mergedEnabled,zIndex:this.zIndex}]]):i}})}});var Ai=[],rS=function(){return Ai.some(function(n){return n.activeTargets.length>0})},oS=function(){return Ai.some(function(n){return n.skippedTargets.length>0})},rh="ResizeObserver loop completed with undelivered notifications.",sS=function(){var n;typeof ErrorEvent=="function"?n=new ErrorEvent("error",{message:rh}):(n=document.createEvent("Event"),n.initEvent("error",!1,!1),n.message=rh),window.dispatchEvent(n)},Yr;(function(n){n.BORDER_BOX="border-box",n.CONTENT_BOX="content-box",n.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(Yr||(Yr={}));var Oi=function(n){return Object.freeze(n)},aS=(function(){function n(e,i){this.inlineSize=e,this.blockSize=i,Oi(this)}return n})(),oh=(function(){function n(e,i,r,o){return this.x=e,this.y=i,this.width=r,this.height=o,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,Oi(this)}return n.prototype.toJSON=function(){var e=this,i=e.x,r=e.y,o=e.top,s=e.right,a=e.bottom,l=e.left,c=e.width,d=e.height;return{x:i,y:r,top:o,right:s,bottom:a,left:l,width:c,height:d}},n.fromRect=function(e){return new n(e.x,e.y,e.width,e.height)},n})(),nl=function(n){return n instanceof SVGElement&&"getBBox"in n},sh=function(n){if(nl(n)){var e=n.getBBox(),i=e.width,r=e.height;return!i&&!r}var o=n,s=o.offsetWidth,a=o.offsetHeight;return!(s||a||n.getClientRects().length)},ah=function(n){var e;if(n instanceof Element)return!0;var i=(e=n==null?void 0:n.ownerDocument)===null||e===void 0?void 0:e.defaultView;return!!(i&&n instanceof i.Element)},lS=function(n){switch(n.tagName){case"INPUT":if(n.type!=="image")break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1},Ur=typeof window<"u"?window:{},fs=new WeakMap,lh=/auto|scroll/,cS=/^tb|vertical/,dS=/msie|trident/i.test(Ur.navigator&&Ur.navigator.userAgent),An=function(n){return parseFloat(n||"0")},kr=function(n,e,i){return n===void 0&&(n=0),e===void 0&&(e=0),i===void 0&&(i=!1),new aS((i?e:n)||0,(i?n:e)||0)},ch=Oi({devicePixelContentBoxSize:kr(),borderBoxSize:kr(),contentBoxSize:kr(),contentRect:new oh(0,0,0,0)}),dh=function(n,e){if(e===void 0&&(e=!1),fs.has(n)&&!e)return fs.get(n);if(sh(n))return fs.set(n,ch),ch;var i=getComputedStyle(n),r=nl(n)&&n.ownerSVGElement&&n.getBBox(),o=!dS&&i.boxSizing==="border-box",s=cS.test(i.writingMode||""),a=!r&&lh.test(i.overflowY||""),l=!r&&lh.test(i.overflowX||""),c=r?0:An(i.paddingTop),d=r?0:An(i.paddingRight),u=r?0:An(i.paddingBottom),f=r?0:An(i.paddingLeft),h=r?0:An(i.borderTopWidth),p=r?0:An(i.borderRightWidth),m=r?0:An(i.borderBottomWidth),g=r?0:An(i.borderLeftWidth),b=f+d,y=c+u,_=g+p,x=h+m,w=l?n.offsetHeight-x-n.clientHeight:0,C=a?n.offsetWidth-_-n.clientWidth:0,N=o?b+_:0,k=o?y+x:0,$=r?r.width:An(i.width)-N-C,v=r?r.height:An(i.height)-k-w,E=$+b+C+_,P=v+y+w+x,F=Oi({devicePixelContentBoxSize:kr(Math.round($*devicePixelRatio),Math.round(v*devicePixelRatio),s),borderBoxSize:kr(E,P,s),contentBoxSize:kr($,v,s),contentRect:new oh(f,c,$,v)});return fs.set(n,F),F},uh=function(n,e,i){var r=dh(n,i),o=r.borderBoxSize,s=r.contentBoxSize,a=r.devicePixelContentBoxSize;switch(e){case Yr.DEVICE_PIXEL_CONTENT_BOX:return a;case Yr.BORDER_BOX:return o;default:return s}},uS=(function(){function n(e){var i=dh(e);this.target=e,this.contentRect=i.contentRect,this.borderBoxSize=Oi([i.borderBoxSize]),this.contentBoxSize=Oi([i.contentBoxSize]),this.devicePixelContentBoxSize=Oi([i.devicePixelContentBoxSize])}return n})(),fh=function(n){if(sh(n))return 1/0;for(var e=0,i=n.parentNode;i;)e+=1,i=i.parentNode;return e},fS=function(){var n=1/0,e=[];Ai.forEach(function(a){if(a.activeTargets.length!==0){var l=[];a.activeTargets.forEach(function(d){var u=new uS(d.target),f=fh(d.target);l.push(u),d.lastReportedSize=uh(d.target,d.observedBox),f<n&&(n=f)}),e.push(function(){a.callback.call(a.observer,l,a.observer)}),a.activeTargets.splice(0,a.activeTargets.length)}});for(var i=0,r=e;i<r.length;i++){var o=r[i];o()}return n},hh=function(n){Ai.forEach(function(i){i.activeTargets.splice(0,i.activeTargets.length),i.skippedTargets.splice(0,i.skippedTargets.length),i.observationTargets.forEach(function(o){o.isActive()&&(fh(o.target)>n?i.activeTargets.push(o):i.skippedTargets.push(o))})})},hS=function(){var n=0;for(hh(n);rS();)n=fS(),hh(n);return oS()&&sS(),n>0},il,mh=[],mS=function(){return mh.splice(0).forEach(function(n){return n()})},pS=function(n){if(!il){var e=0,i=document.createTextNode(""),r={characterData:!0};new MutationObserver(function(){return mS()}).observe(i,r),il=function(){i.textContent="".concat(e?e--:e++)}}mh.push(n),il()},gS=function(n){pS(function(){requestAnimationFrame(n)})},hs=0,yS=function(){return!!hs},bS=250,_S={attributes:!0,characterData:!0,childList:!0,subtree:!0},ph=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],gh=function(n){return n===void 0&&(n=0),Date.now()+n},rl=!1,wS=(function(){function n(){var e=this;this.stopped=!0,this.listener=function(){return e.schedule()}}return n.prototype.run=function(e){var i=this;if(e===void 0&&(e=bS),!rl){rl=!0;var r=gh(e);gS(function(){var o=!1;try{o=hS()}finally{if(rl=!1,e=r-gh(),!yS())return;o?i.run(1e3):e>0?i.run(e):i.start()}})}},n.prototype.schedule=function(){this.stop(),this.run()},n.prototype.observe=function(){var e=this,i=function(){return e.observer&&e.observer.observe(document.body,_S)};document.body?i():Ur.addEventListener("DOMContentLoaded",i)},n.prototype.start=function(){var e=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),ph.forEach(function(i){return Ur.addEventListener(i,e.listener,!0)}))},n.prototype.stop=function(){var e=this;this.stopped||(this.observer&&this.observer.disconnect(),ph.forEach(function(i){return Ur.removeEventListener(i,e.listener,!0)}),this.stopped=!0)},n})(),ol=new wS,yh=function(n){!hs&&n>0&&ol.start(),hs+=n,!hs&&ol.stop()},xS=function(n){return!nl(n)&&!lS(n)&&getComputedStyle(n).display==="inline"},kS=(function(){function n(e,i){this.target=e,this.observedBox=i||Yr.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return n.prototype.isActive=function(){var e=uh(this.target,this.observedBox,!0);return xS(this.target)&&(this.lastReportedSize=e),this.lastReportedSize.inlineSize!==e.inlineSize||this.lastReportedSize.blockSize!==e.blockSize},n})(),CS=(function(){function n(e,i){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=e,this.callback=i}return n})(),ms=new WeakMap,bh=function(n,e){for(var i=0;i<n.length;i+=1)if(n[i].target===e)return i;return-1},ps=(function(){function n(){}return n.connect=function(e,i){var r=new CS(e,i);ms.set(e,r)},n.observe=function(e,i,r){var o=ms.get(e),s=o.observationTargets.length===0;bh(o.observationTargets,i)<0&&(s&&Ai.push(o),o.observationTargets.push(new kS(i,r&&r.box)),yh(1),ol.schedule())},n.unobserve=function(e,i){var r=ms.get(e),o=bh(r.observationTargets,i),s=r.observationTargets.length===1;o>=0&&(s&&Ai.splice(Ai.indexOf(r),1),r.observationTargets.splice(o,1),yh(-1))},n.disconnect=function(e){var i=this,r=ms.get(e);r.observationTargets.slice().forEach(function(o){return i.unobserve(e,o.target)}),r.activeTargets.splice(0,r.activeTargets.length)},n})(),vS=(function(){function n(e){if(arguments.length===0)throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");if(typeof e!="function")throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");ps.connect(this,e)}return n.prototype.observe=function(e,i){if(arguments.length===0)throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!ah(e))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");ps.observe(this,e,i)},n.prototype.unobserve=function(e){if(arguments.length===0)throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!ah(e))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");ps.unobserve(this,e)},n.prototype.disconnect=function(){ps.disconnect(this)},n.toString=function(){return"function ResizeObserver () { [polyfill code] }"},n})();class SS{constructor(){this.handleResize=this.handleResize.bind(this),this.observer=new(typeof window<"u"&&window.ResizeObserver||vS)(this.handleResize),this.elHandlersMap=new Map}handleResize(e){for(const i of e){const r=this.elHandlersMap.get(i.target);r!==void 0&&r(i)}}registerHandler(e,i){this.elHandlersMap.set(e,i),this.observer.observe(e)}unregisterHandler(e){this.elHandlersMap.has(e)&&(this.elHandlersMap.delete(e),this.observer.unobserve(e))}}const Kr=new SS,gs=t.defineComponent({name:"ResizeObserver",props:{onResize:Function},setup(n){let e=!1;const i=t.getCurrentInstance().proxy;function r(o){const{onResize:s}=n;s!==void 0&&s(o)}t.onMounted(()=>{const o=i.$el;if(o===void 0){Wf("resize-observer","$el does not exist.");return}if(o.nextElementSibling!==o.nextSibling&&o.nodeType===3&&o.nodeValue!==""){Wf("resize-observer","$el can not be observed (it may be a text node).");return}o.nextElementSibling!==null&&(Kr.registerHandler(o.nextElementSibling,r),e=!0)}),t.onBeforeUnmount(()=>{e&&Kr.unregisterHandler(i.$el.nextElementSibling)})},render(){return t.renderSlot(this.$slots,"default")}});let ys;function BS(){return typeof document>"u"?!1:(ys===void 0&&("matchMedia"in window?ys=window.matchMedia("(pointer:coarse)").matches:ys=!1),ys)}let sl;function _h(){return typeof document>"u"?1:(sl===void 0&&(sl="chrome"in window?window.devicePixelRatio:1),sl)}const wh="VVirtualListXScroll";function NS({columnsRef:n,renderColRef:e,renderItemWithColsRef:i}){const r=t.ref(0),o=t.ref(0),s=t.computed(()=>{const d=n.value;if(d.length===0)return null;const u=new Qf(d.length,0);return d.forEach((f,h)=>{u.add(h,f.width)}),u}),a=fn(()=>{const d=s.value;return d!==null?Math.max(d.getBound(o.value)-1,0):0}),l=d=>{const u=s.value;return u!==null?u.sum(d):0},c=fn(()=>{const d=s.value;return d!==null?Math.min(d.getBound(o.value+r.value)+1,n.value.length-1):0});return t.provide(wh,{startIndexRef:a,endIndexRef:c,columnsRef:n,renderColRef:e,renderItemWithColsRef:i,getLeft:l}),{listWidthRef:r,scrollLeftRef:o}}const xh=t.defineComponent({name:"VirtualListRow",props:{index:{type:Number,required:!0},item:{type:Object,required:!0}},setup(){const{startIndexRef:n,endIndexRef:e,columnsRef:i,getLeft:r,renderColRef:o,renderItemWithColsRef:s}=t.inject(wh);return{startIndex:n,endIndex:e,columns:i,renderCol:o,renderItemWithCols:s,getLeft:r}},render(){const{startIndex:n,endIndex:e,columns:i,renderCol:r,renderItemWithCols:o,getLeft:s,item:a}=this;if(o!=null)return o({itemIndex:this.index,startColIndex:n,endColIndex:e,allColumns:i,item:a,getLeft:s});if(r!=null){const l=[];for(let c=n;c<=e;++c){const d=i[c];l.push(r({column:d,left:s(c),item:a}))}return l}return null}}),TS=yi(".v-vl",{maxHeight:"inherit",height:"100%",overflow:"auto",minWidth:"1px"},[yi("&:not(.v-vl--show-scrollbar)",{scrollbarWidth:"none"},[yi("&::-webkit-scrollbar, &::-webkit-scrollbar-track-piece, &::-webkit-scrollbar-thumb",{width:0,height:0,display:"none"})])]),$S=t.defineComponent({name:"VirtualList",inheritAttrs:!1,props:{showScrollbar:{type:Boolean,default:!0},columns:{type:Array,default:()=>[]},renderCol:Function,renderItemWithCols:Function,items:{type:Array,default:()=>[]},itemSize:{type:Number,required:!0},itemResizable:Boolean,itemsStyle:[String,Object],visibleItemsTag:{type:[String,Object],default:"div"},visibleItemsProps:Object,ignoreItemResize:Boolean,onScroll:Function,onWheel:Function,onResize:Function,defaultScrollKey:[Number,String],defaultScrollIndex:Number,keyField:{type:String,default:"key"},paddingTop:{type:[Number,String],default:0},paddingBottom:{type:[Number,String],default:0}},setup(n){const e=Ii();TS.mount({id:"vueuc/virtual-list",head:!0,anchorMetaName:el,ssr:e}),t.onMounted(()=>{const{defaultScrollIndex:R,defaultScrollKey:M}=n;R!=null?b({index:R}):M!=null&&b({key:M})});let i=!1,r=!1;t.onActivated(()=>{if(i=!1,!r){r=!0;return}b({top:p.value,left:a.value})}),t.onDeactivated(()=>{i=!0,r||(r=!0)});const o=fn(()=>{if(n.renderCol==null&&n.renderItemWithCols==null||n.columns.length===0)return;let R=0;return n.columns.forEach(M=>{R+=M.width}),R}),s=t.computed(()=>{const R=new Map,{keyField:M}=n;return n.items.forEach((X,G)=>{R.set(X[M],G)}),R}),{scrollLeftRef:a,listWidthRef:l}=NS({columnsRef:t.toRef(n,"columns"),renderColRef:t.toRef(n,"renderCol"),renderItemWithColsRef:t.toRef(n,"renderItemWithCols")}),c=t.ref(null),d=t.ref(void 0),u=new Map,f=t.computed(()=>{const{items:R,itemSize:M,keyField:X}=n,G=new Qf(R.length,M);return R.forEach((Z,O)=>{const A=Z[X],Y=u.get(A);Y!==void 0&&G.add(O,Y)}),G}),h=t.ref(0),p=t.ref(0),m=fn(()=>Math.max(f.value.getBound(p.value-jr(n.paddingTop))-1,0)),g=t.computed(()=>{const{value:R}=d;if(R===void 0)return[];const{items:M,itemSize:X}=n,G=m.value,Z=Math.min(G+Math.ceil(R/X+1),M.length-1),O=[];for(let A=G;A<=Z;++A)O.push(M[A]);return O}),b=(R,M)=>{if(typeof R=="number"){w(R,M,"auto");return}const{left:X,top:G,index:Z,key:O,position:A,behavior:Y,debounce:H=!0}=R;if(X!==void 0||G!==void 0)w(X,G,Y);else if(Z!==void 0)x(Z,Y,H);else if(O!==void 0){const T=s.value.get(O);T!==void 0&&x(T,Y,H)}else A==="bottom"?w(0,Number.MAX_SAFE_INTEGER,Y):A==="top"&&w(0,0,Y)};let y,_=null;function x(R,M,X){const{value:G}=f,Z=G.sum(R)+jr(n.paddingTop);if(!X)c.value.scrollTo({left:0,top:Z,behavior:M});else{y=R,_!==null&&window.clearTimeout(_),_=window.setTimeout(()=>{y=void 0,_=null},16);const{scrollTop:O,offsetHeight:A}=c.value;if(Z>O){const Y=G.get(R);Z+Y<=O+A||c.value.scrollTo({left:0,top:Z+Y-A,behavior:M})}else c.value.scrollTo({left:0,top:Z,behavior:M})}}function w(R,M,X){c.value.scrollTo({left:R,top:M,behavior:X})}function C(R,M){var X,G,Z;if(i||n.ignoreItemResize||F(M.target))return;const{value:O}=f,A=s.value.get(R),Y=O.get(A),H=(Z=(G=(X=M.borderBoxSize)===null||X===void 0?void 0:X[0])===null||G===void 0?void 0:G.blockSize)!==null&&Z!==void 0?Z:M.contentRect.height;if(H===Y)return;H-n.itemSize===0?u.delete(R):u.set(R,H-n.itemSize);const D=H-Y;if(D===0)return;O.add(A,D);const K=c.value;if(K!=null){if(y===void 0){const J=O.sum(A);K.scrollTop>J&&K.scrollBy(0,D)}else if(A<y)K.scrollBy(0,D);else if(A===y){const J=O.sum(A);H+J>K.scrollTop+K.offsetHeight&&K.scrollBy(0,D)}P()}h.value++}const N=!BS();let k=!1;function $(R){var M;(M=n.onScroll)===null||M===void 0||M.call(n,R),(!N||!k)&&P()}function v(R){var M;if((M=n.onWheel)===null||M===void 0||M.call(n,R),N){const X=c.value;if(X!=null){if(R.deltaX===0&&(X.scrollTop===0&&R.deltaY<=0||X.scrollTop+X.offsetHeight>=X.scrollHeight&&R.deltaY>=0))return;R.preventDefault(),X.scrollTop+=R.deltaY/_h(),X.scrollLeft+=R.deltaX/_h(),P(),k=!0,Sf(()=>{k=!1})}}}function E(R){if(i||F(R.target))return;if(n.renderCol==null&&n.renderItemWithCols==null){if(R.contentRect.height===d.value)return}else if(R.contentRect.height===d.value&&R.contentRect.width===l.value)return;d.value=R.contentRect.height,l.value=R.contentRect.width;const{onResize:M}=n;M!==void 0&&M(R)}function P(){const{value:R}=c;R!=null&&(p.value=R.scrollTop,a.value=R.scrollLeft)}function F(R){let M=R;for(;M!==null;){if(M.style.display==="none")return!0;M=M.parentElement}return!1}return{listHeight:d,listStyle:{overflow:"auto"},keyToIndex:s,itemsStyle:t.computed(()=>{const{itemResizable:R}=n,M=qr(f.value.sum());return h.value,[n.itemsStyle,{boxSizing:"content-box",width:qr(o.value),height:R?"":M,minHeight:R?M:"",paddingTop:qr(n.paddingTop),paddingBottom:qr(n.paddingBottom)}]}),visibleItemsStyle:t.computed(()=>(h.value,{transform:`translateY(${qr(f.value.sum(m.value))})`})),viewportItems:g,listElRef:c,itemsElRef:t.ref(null),scrollTo:b,handleListResize:E,handleListScroll:$,handleListWheel:v,handleItemResize:C}},render(){const{itemResizable:n,keyField:e,keyToIndex:i,visibleItemsTag:r}=this;return t.h(gs,{onResize:this.handleListResize},{default:()=>{var o,s;return t.h("div",t.mergeProps(this.$attrs,{class:["v-vl",this.showScrollbar&&"v-vl--show-scrollbar"],onScroll:this.handleListScroll,onWheel:this.handleListWheel,ref:"listElRef"}),[this.items.length!==0?t.h("div",{ref:"itemsElRef",class:"v-vl-items",style:this.itemsStyle},[t.h(r,Object.assign({class:"v-vl-visible-items",style:this.visibleItemsStyle},this.visibleItemsProps),{default:()=>{const{renderCol:a,renderItemWithCols:l}=this;return this.viewportItems.map(c=>{const d=c[e],u=i.get(d),f=a!=null?t.h(xh,{index:u,item:c}):void 0,h=l!=null?t.h(xh,{index:u,item:c}):void 0,p=this.$slots.default({item:c,renderedCols:f,renderedItemWithCols:h,index:u})[0];return n?t.h(gs,{key:d,onResize:m=>this.handleItemResize(d,m)},{default:()=>p}):(p.key=d,p)})}})]):(s=(o=this.$slots).empty)===null||s===void 0?void 0:s.call(o)])}})}}),Kn="v-hidden",ES=yi("[v-hidden]",{display:"none!important"}),kh=t.defineComponent({name:"Overflow",props:{getCounter:Function,getTail:Function,updateCounter:Function,onUpdateCount:Function,onUpdateOverflow:Function},setup(n,{slots:e}){const i=t.ref(null),r=t.ref(null);function o(a){const{value:l}=i,{getCounter:c,getTail:d}=n;let u;if(c!==void 0?u=c():u=r.value,!l||!u)return;u.hasAttribute(Kn)&&u.removeAttribute(Kn);const{children:f}=l;if(a.showAllItemsBeforeCalculate)for(const x of f)x.hasAttribute(Kn)&&x.removeAttribute(Kn);const h=l.offsetWidth,p=[],m=e.tail?d==null?void 0:d():null;let g=m?m.offsetWidth:0,b=!1;const y=l.children.length-(e.tail?1:0);for(let x=0;x<y-1;++x){if(x<0)continue;const w=f[x];if(b){w.hasAttribute(Kn)||w.setAttribute(Kn,"");continue}else w.hasAttribute(Kn)&&w.removeAttribute(Kn);const C=w.offsetWidth;if(g+=C,p[x]=C,g>h){const{updateCounter:N}=n;for(let k=x;k>=0;--k){const $=y-1-k;N!==void 0?N($):u.textContent=`${$}`;const v=u.offsetWidth;if(g-=p[k],g+v<=h||k===0){b=!0,x=k-1,m&&(x===-1?(m.style.maxWidth=`${h-v}px`,m.style.boxSizing="border-box"):m.style.maxWidth="");const{onUpdateCount:E}=n;E&&E($);break}}}}const{onUpdateOverflow:_}=n;b?_!==void 0&&_(!0):(_!==void 0&&_(!1),u.setAttribute(Kn,""))}const s=Ii();return ES.mount({id:"vueuc/overflow",head:!0,anchorMetaName:el,ssr:s}),t.onMounted(()=>o({showAllItemsBeforeCalculate:!1})),{selfRef:i,counterRef:r,sync:o}},render(){const{$slots:n}=this;return t.nextTick(()=>this.sync({showAllItemsBeforeCalculate:!1})),t.h("div",{class:"v-overflow",ref:"selfRef"},[t.renderSlot(n,"default"),n.counter?n.counter():t.h("span",{style:{display:"inline-block"},ref:"counterRef"}),n.tail?n.tail():null])}});function Ch(n){return n instanceof HTMLElement}function vh(n){for(let e=0;e<n.childNodes.length;e++){const i=n.childNodes[e];if(Ch(i)&&(Bh(i)||vh(i)))return!0}return!1}function Sh(n){for(let e=n.childNodes.length-1;e>=0;e--){const i=n.childNodes[e];if(Ch(i)&&(Bh(i)||Sh(i)))return!0}return!1}function Bh(n){if(!RS(n))return!1;try{n.focus({preventScroll:!0})}catch{}return document.activeElement===n}function RS(n){if(n.tabIndex>0||n.tabIndex===0&&n.getAttribute("tabIndex")!==null)return!0;if(n.getAttribute("disabled"))return!1;switch(n.nodeName){case"A":return!!n.href&&n.rel!=="ignore";case"INPUT":return n.type!=="hidden"&&n.type!=="file";case"SELECT":case"TEXTAREA":return!0;default:return!1}}let Gr=[];const PS=t.defineComponent({name:"FocusTrap",props:{disabled:Boolean,active:Boolean,autoFocus:{type:Boolean,default:!0},onEsc:Function,initialFocusTo:[String,Function],finalFocusTo:[String,Function],returnFocusOnDeactivated:{type:Boolean,default:!0}},setup(n){const e=DC(),i=t.ref(null),r=t.ref(null);let o=!1,s=!1;const a=typeof document>"u"?null:document.activeElement;function l(){return Gr[Gr.length-1]===e}function c(b){var y;b.code==="Escape"&&l()&&((y=n.onEsc)===null||y===void 0||y.call(n,b))}t.onMounted(()=>{t.watch(()=>n.active,b=>{b?(f(),Lt("keydown",document,c)):(yt("keydown",document,c),o&&h())},{immediate:!0})}),t.onBeforeUnmount(()=>{yt("keydown",document,c),o&&h()});function d(b){if(!s&&l()){const y=u();if(y===null||y.contains(Wr(b)))return;p("first")}}function u(){const b=i.value;if(b===null)return null;let y=b;for(;y=y.nextSibling,!(y===null||y instanceof Element&&y.tagName==="DIV"););return y}function f(){var b;if(!n.disabled){if(Gr.push(e),n.autoFocus){const{initialFocusTo:y}=n;y===void 0?p("first"):(b=Jf(y))===null||b===void 0||b.focus({preventScroll:!0})}o=!0,document.addEventListener("focus",d,!0)}}function h(){var b;if(n.disabled||(document.removeEventListener("focus",d,!0),Gr=Gr.filter(_=>_!==e),l()))return;const{finalFocusTo:y}=n;y!==void 0?(b=Jf(y))===null||b===void 0||b.focus({preventScroll:!0}):n.returnFocusOnDeactivated&&a instanceof HTMLElement&&(s=!0,a.focus({preventScroll:!0}),s=!1)}function p(b){if(l()&&n.active){const y=i.value,_=r.value;if(y!==null&&_!==null){const x=u();if(x==null||x===_){s=!0,y.focus({preventScroll:!0}),s=!1;return}s=!0;const w=b==="first"?vh(x):Sh(x);s=!1,w||(s=!0,y.focus({preventScroll:!0}),s=!1)}}}function m(b){if(s)return;const y=u();y!==null&&(b.relatedTarget!==null&&y.contains(b.relatedTarget)?p("last"):p("first"))}function g(b){s||(b.relatedTarget!==null&&b.relatedTarget===i.value?p("last"):p("first"))}return{focusableStartRef:i,focusableEndRef:r,focusableStyle:"position: absolute; height: 0; width: 0;",handleStartFocus:m,handleEndFocus:g}},render(){const{default:n}=this.$slots;if(n===void 0)return null;if(this.disabled)return n();const{active:e,focusableStyle:i}=this;return t.h(t.Fragment,null,[t.h("div",{"aria-hidden":"true",tabindex:e?"0":"-1",ref:"focusableStartRef",style:i,onFocus:this.handleStartFocus}),n(),t.h("div",{"aria-hidden":"true",style:i,ref:"focusableEndRef",tabindex:e?"0":"-1",onFocus:this.handleEndFocus})])}});function FT(n){return n}const al="n-internal-select-menu",Nh="n-internal-select-menu-body",Th="n-drawer-body",$h="n-modal-body",Eh="n-popover-body",Rh="__disabled__";function Gn(n){const e=t.inject($h,null),i=t.inject(Th,null),r=t.inject(Eh,null),o=t.inject(Nh,null),s=t.ref();if(typeof document<"u"){s.value=document.fullscreenElement;const a=()=>{s.value=document.fullscreenElement};t.onMounted(()=>{Lt("fullscreenchange",document,a)}),t.onBeforeUnmount(()=>{yt("fullscreenchange",document,a)})}return fn(()=>{var a;const{to:l}=n;return l!==void 0?l===!1?Rh:l===!0?s.value||"body":l:e!=null&&e.value?(a=e.value.$el)!==null&&a!==void 0?a:e.value:i!=null&&i.value?i.value:r!=null&&r.value?r.value:o!=null&&o.value?o.value:l??(s.value||"body")})}Gn.tdkey=Rh,Gn.propTo={type:[String,Object,Boolean],default:void 0};function FS(n){const e={isDeactivated:!1};let i=!1;return t.onActivated(()=>{if(e.isDeactivated=!1,!i){i=!0;return}n()}),t.onDeactivated(()=>{e.isDeactivated=!0,i||(i=!0)}),e}function Ph(n,e){e&&(t.onMounted(()=>{const{value:i}=n;i&&Kr.registerHandler(i,e)}),t.watch(n,(i,r)=>{r&&Kr.unregisterHandler(r)},{deep:!1}),t.onBeforeUnmount(()=>{const{value:i}=n;i&&Kr.unregisterHandler(i)}))}function Fh(n){return n.replace(/#|\(|\)|,|\s|\./g,"_")}const VS=/^(\d|\.)+$/,Vh=/(\d|\.)+/;function ll(n,{c:e=1,offset:i=0,attachPx:r=!0}={}){if(typeof n=="number"){const o=(n+i)*e;return o===0?"0":`${o}px`}else if(typeof n=="string")if(VS.test(n)){const o=(Number(n)+i)*e;return r?o===0?"0":`${o}px`:`${o}`}else{const o=Vh.exec(n);return o?n.replace(Vh,String((Number(o[0])+i)*e)):n}return n}function Mh(n){const{left:e,right:i,top:r,bottom:o}=xn(n);return`${r} ${e} ${o} ${i}`}var Ih={};function MS(n){let e=".",i="__",r="--",o;if(n){let m=n.blockPrefix;m&&(e=m),m=n.elementPrefix,m&&(i=m),m=n.modifierPrefix,m&&(r=m)}const s={install(m){o=m.c;const g=m.context;g.bem={},g.bem.b=null,g.bem.els=null}};function a(m){let g,b;return{before(y){g=y.bem.b,b=y.bem.els,y.bem.els=null},after(y){y.bem.b=g,y.bem.els=b},$({context:y,props:_}){return m=typeof m=="string"?m:m({context:y,props:_}),y.bem.b=m,`${(_==null?void 0:_.bPrefix)||e}${y.bem.b}`}}}function l(m){let g;return{before(b){g=b.bem.els},after(b){b.bem.els=g},$({context:b,props:y}){return m=typeof m=="string"?m:m({context:b,props:y}),b.bem.els=m.split(",").map(_=>_.trim()),b.bem.els.map(_=>`${(y==null?void 0:y.bPrefix)||e}${b.bem.b}${i}${_}`).join(", ")}}}function c(m){return{$({context:g,props:b}){m=typeof m=="string"?m:m({context:g,props:b});const y=m.split(",").map(w=>w.trim());function _(w){return y.map(C=>`&${(b==null?void 0:b.bPrefix)||e}${g.bem.b}${w!==void 0?`${i}${w}`:""}${r}${C}`).join(", ")}const x=g.bem.els;if(x!==null){if(Ih.NODE_ENV!=="production"&&x.length>=2)throw Error(`[css-render/plugin-bem]: m(${m}) is invalid, using modifier inside multiple elements is not allowed`);return _(x[0])}else return _()}}}function d(m){return{$({context:g,props:b}){m=typeof m=="string"?m:m({context:g,props:b});const y=g.bem.els;if(Ih.NODE_ENV!=="production"&&y!==null&&y.length>=2)throw Error(`[css-render/plugin-bem]: notM(${m}) is invalid, using modifier inside multiple elements is not allowed`);return`&:not(${(b==null?void 0:b.bPrefix)||e}${g.bem.b}${y!==null&&y.length>0?`${i}${y[0]}`:""}${r}${m})`}}}return Object.assign(s,{cB:((...m)=>o(a(m[0]),m[1],m[2])),cE:((...m)=>o(l(m[0]),m[1],m[2])),cM:((...m)=>o(c(m[0]),m[1],m[2])),cNotM:((...m)=>o(d(m[0]),m[1],m[2]))}),s}const IS=".n-",AS="__",OS="--",Ah=Gf(),Oh=MS({blockPrefix:IS,elementPrefix:AS,modifierPrefix:OS});Ah.use(Oh);const{c:pe,find:MT}=Ah,{cB:ke,cE:ve,cM:Fe,cNotM:kn}=Oh,zS=(...n)=>pe(">",[ke(...n)]);function st(n,e){return n+(e==="default"?"":e.replace(/^[a-z]/,i=>i.toUpperCase()))}let cl;function DS(){return cl===void 0&&(cl=navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom")),cl}const LS=new WeakSet;function HS(n){LS.add(n)}function zh(n){switch(typeof n){case"string":return n||void 0;case"number":return String(n);default:return}}const Dh=new Set;function bi(n,e){const i=`[naive/${n}]: ${e}`;Dh.has(i)||(Dh.add(i),console.error(i))}function Lh(n,e){console.error(`[naive/${n}]: ${e}`)}function Hh(n,e){throw new Error(`[naive/${n}]: ${e}`)}function Et(n,...e){if(Array.isArray(n))n.forEach(i=>Et(i,...e));else return n(...e)}function dl(n,e=!0,i=[]){return n.forEach(r=>{if(r!==null){if(typeof r!="object"){(typeof r=="string"||typeof r=="number")&&i.push(t.createTextVNode(String(r)));return}if(Array.isArray(r)){dl(r,e,i);return}if(r.type===t.Fragment){if(r.children===null)return;Array.isArray(r.children)&&dl(r.children,e,i)}else{if(r.type===t.Comment&&e)return;i.push(r)}}}),i}function WS(n,e="default",i=void 0){const r=n[e];if(!r)return Lh("getFirstSlotVNode",`slot[${e}] is empty`),null;const o=dl(r(i));return o.length===1?o[0]:(Lh("getFirstSlotVNode",`slot[${e}] should have exactly one child`),null)}function jS(n,e=[],i){const r={};return e.forEach(o=>{r[o]=n[o]}),Object.assign(r,i)}function ul(n){const e=n.filter(i=>i!==void 0);if(e.length!==0)return e.length===1?e[0]:i=>{n.forEach(r=>{r&&r(i)})}}function Cr(n,...e){return typeof n=="function"?n(...e):typeof n=="string"?t.createTextVNode(n):typeof n=="number"?t.createTextVNode(String(n)):null}function bs(n){return n.some(e=>t.isVNode(e)?!(e.type===t.Comment||e.type===t.Fragment&&!bs(e.children)):!0)?n:null}function fl(n,e){return n&&bs(n())||e()}function zi(n,e){const i=n&&bs(n());return e(i||null)}function Wh(n){return!(n&&bs(n()))}const hl=t.defineComponent({render(){var n,e;return(e=(n=this.$slots).default)===null||e===void 0?void 0:e.call(n)}}),Di="n-config-provider",qS="n";function Li(n={},e={defaultBordered:!0}){const i=t.inject(Di,null);return{inlineThemeDisabled:i==null?void 0:i.inlineThemeDisabled,mergedRtlRef:i==null?void 0:i.mergedRtlRef,mergedComponentPropsRef:i==null?void 0:i.mergedComponentPropsRef,mergedBreakpointsRef:i==null?void 0:i.mergedBreakpointsRef,mergedBorderedRef:t.computed(()=>{var r,o;const{bordered:s}=n;return s!==void 0?s:(o=(r=i==null?void 0:i.mergedBorderedRef.value)!==null&&r!==void 0?r:e.defaultBordered)!==null&&o!==void 0?o:!0}),mergedClsPrefixRef:i?i.mergedClsPrefixRef:t.shallowRef(qS),namespaceRef:t.computed(()=>i==null?void 0:i.mergedNamespaceRef.value)}}function Hi(n,e,i,r){i||Hh("useThemeClass","cssVarsRef is not passed");const o=t.inject(Di,null),s=o==null?void 0:o.mergedThemeHashRef,a=o==null?void 0:o.styleMountTarget,l=t.ref(""),c=Ii();let d;const u=`__${n}`,f=()=>{let h=u;const p=e?e.value:void 0,m=s==null?void 0:s.value;m&&(h+=`-${m}`),p&&(h+=`-${p}`);const{themeOverrides:g,builtinThemeOverrides:b}=r;g&&(h+=`-${Ja(JSON.stringify(g))}`),b&&(h+=`-${Ja(JSON.stringify(b))}`),l.value=h,d=()=>{const y=i.value;let _="";for(const x in y)_+=`${x}: ${y[x]};`;pe(`.${h}`,_).mount({id:h,ssr:c,parent:a}),d=void 0}};return t.watchEffect(()=>{f()}),{themeClass:l,onRender:()=>{d==null||d()}}}const jh="n-form-item";function XS(n,{defaultSize:e="medium",mergedSize:i,mergedDisabled:r}={}){const o=t.inject(jh,null);t.provide(jh,null);const s=t.computed(i?()=>i(o):()=>{const{size:c}=n;if(c)return c;if(o){const{mergedSize:d}=o;if(d.value!==void 0)return d.value}return e}),a=t.computed(r?()=>r(o):()=>{const{disabled:c}=n;return c!==void 0?c:o?o.disabled.value:!1}),l=t.computed(()=>{const{status:c}=n;return c||(o==null?void 0:o.mergedValidationStatus.value)});return t.onBeforeUnmount(()=>{o&&o.restoreValidation()}),{mergedSizeRef:s,mergedDisabledRef:a,mergedStatusRef:l,nTriggerFormBlur(){o&&o.handleContentBlur()},nTriggerFormChange(){o&&o.handleContentChange()},nTriggerFormFocus(){o&&o.handleContentFocus()},nTriggerFormInput(){o&&o.handleContentInput()}}}const YS={name:"en-US",global:{undo:"Undo",redo:"Redo",confirm:"Confirm",clear:"Clear"},Popconfirm:{positiveText:"Confirm",negativeText:"Cancel"},Cascader:{placeholder:"Please Select",loading:"Loading",loadingRequiredMessage:n=>`Please load all ${n}'s descendants before checking it.`},Time:{dateFormat:"yyyy-MM-dd",dateTimeFormat:"yyyy-MM-dd HH:mm:ss"},DatePicker:{yearFormat:"yyyy",monthFormat:"MMM",dayFormat:"eeeeee",yearTypeFormat:"yyyy",monthTypeFormat:"yyyy-MM",dateFormat:"yyyy-MM-dd",dateTimeFormat:"yyyy-MM-dd HH:mm:ss",quarterFormat:"yyyy-qqq",weekFormat:"YYYY-w",clear:"Clear",now:"Now",confirm:"Confirm",selectTime:"Select Time",selectDate:"Select Date",datePlaceholder:"Select Date",datetimePlaceholder:"Select Date and Time",monthPlaceholder:"Select Month",yearPlaceholder:"Select Year",quarterPlaceholder:"Select Quarter",weekPlaceholder:"Select Week",startDatePlaceholder:"Start Date",endDatePlaceholder:"End Date",startDatetimePlaceholder:"Start Date and Time",endDatetimePlaceholder:"End Date and Time",startMonthPlaceholder:"Start Month",endMonthPlaceholder:"End Month",monthBeforeYear:!0,firstDayOfWeek:6,today:"Today"},DataTable:{checkTableAll:"Select all in the table",uncheckTableAll:"Unselect all in the table",confirm:"Confirm",clear:"Clear"},LegacyTransfer:{sourceTitle:"Source",targetTitle:"Target"},Transfer:{selectAll:"Select all",unselectAll:"Unselect all",clearAll:"Clear",total:n=>`Total ${n} items`,selected:n=>`${n} items selected`},Empty:{description:"No Data"},Select:{placeholder:"Please Select"},TimePicker:{placeholder:"Select Time",positiveText:"OK",negativeText:"Cancel",now:"Now",clear:"Clear"},Pagination:{goto:"Goto",selectionSuffix:"page"},DynamicTags:{add:"Add"},Log:{loading:"Loading"},Input:{placeholder:"Please Input"},InputNumber:{placeholder:"Please Input"},DynamicInput:{create:"Create"},ThemeEditor:{title:"Theme Editor",clearAllVars:"Clear All Variables",clearSearch:"Clear Search",filterCompName:"Filter Component Name",filterVarName:"Filter Variable Name",import:"Import",export:"Export",restore:"Reset to Default"},Image:{tipPrevious:"Previous picture (←)",tipNext:"Next picture (→)",tipCounterclockwise:"Counterclockwise",tipClockwise:"Clockwise",tipZoomOut:"Zoom out",tipZoomIn:"Zoom in",tipDownload:"Download",tipClose:"Close (Esc)",tipOriginalSize:"Zoom to original size"},Heatmap:{less:"less",more:"more",monthFormat:"MMM",weekdayFormat:"eee"}};function ml(n){return(e={})=>{const i=e.width?String(e.width):n.defaultWidth;return n.formats[i]||n.formats[n.defaultWidth]}}function Zr(n){return(e,i)=>{const r=i!=null&&i.context?String(i.context):"standalone";let o;if(r==="formatting"&&n.formattingValues){const a=n.defaultFormattingWidth||n.defaultWidth,l=i!=null&&i.width?String(i.width):a;o=n.formattingValues[l]||n.formattingValues[a]}else{const a=n.defaultWidth,l=i!=null&&i.width?String(i.width):n.defaultWidth;o=n.values[l]||n.values[a]}const s=n.argumentCallback?n.argumentCallback(e):e;return o[s]}}function Qr(n){return(e,i={})=>{const r=i.width,o=r&&n.matchPatterns[r]||n.matchPatterns[n.defaultMatchWidth],s=e.match(o);if(!s)return null;const a=s[0],l=r&&n.parsePatterns[r]||n.parsePatterns[n.defaultParseWidth],c=Array.isArray(l)?KS(l,f=>f.test(a)):US(l,f=>f.test(a));let d;d=n.valueCallback?n.valueCallback(c):c,d=i.valueCallback?i.valueCallback(d):d;const u=e.slice(a.length);return{value:d,rest:u}}}function US(n,e){for(const i in n)if(Object.prototype.hasOwnProperty.call(n,i)&&e(n[i]))return i}function KS(n,e){for(let i=0;i<n.length;i++)if(e(n[i]))return i}function GS(n){return(e,i={})=>{const r=e.match(n.matchPattern);if(!r)return null;const o=r[0],s=e.match(n.parsePattern);if(!s)return null;let a=n.valueCallback?n.valueCallback(s[0]):s[0];a=i.valueCallback?i.valueCallback(a):a;const l=e.slice(o.length);return{value:a,rest:l}}}const ZS={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},QS=(n,e,i)=>{let r;const o=ZS[n];return typeof o=="string"?r=o:e===1?r=o.one:r=o.other.replace("{{count}}",e.toString()),i!=null&&i.addSuffix?i.comparison&&i.comparison>0?"in "+r:r+" ago":r},JS={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},eB=(n,e,i,r)=>JS[n],tB={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},nB={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},iB={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},rB={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},oB={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},sB={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},aB={ordinalNumber:(n,e)=>{const i=Number(n),r=i%100;if(r>20||r<10)switch(r%10){case 1:return i+"st";case 2:return i+"nd";case 3:return i+"rd"}return i+"th"},era:Zr({values:tB,defaultWidth:"wide"}),quarter:Zr({values:nB,defaultWidth:"wide",argumentCallback:n=>n-1}),month:Zr({values:iB,defaultWidth:"wide"}),day:Zr({values:rB,defaultWidth:"wide"}),dayPeriod:Zr({values:oB,defaultWidth:"wide",formattingValues:sB,defaultFormattingWidth:"wide"})},lB=/^(\d+)(th|st|nd|rd)?/i,cB=/\d+/i,dB={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},uB={any:[/^b/i,/^(a|c)/i]},fB={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},hB={any:[/1/i,/2/i,/3/i,/4/i]},mB={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},pB={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},gB={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},yB={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},bB={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},_B={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},wB={ordinalNumber:GS({matchPattern:lB,parsePattern:cB,valueCallback:n=>parseInt(n,10)}),era:Qr({matchPatterns:dB,defaultMatchWidth:"wide",parsePatterns:uB,defaultParseWidth:"any"}),quarter:Qr({matchPatterns:fB,defaultMatchWidth:"wide",parsePatterns:hB,defaultParseWidth:"any",valueCallback:n=>n+1}),month:Qr({matchPatterns:mB,defaultMatchWidth:"wide",parsePatterns:pB,defaultParseWidth:"any"}),day:Qr({matchPatterns:gB,defaultMatchWidth:"wide",parsePatterns:yB,defaultParseWidth:"any"}),dayPeriod:Qr({matchPatterns:bB,defaultMatchWidth:"any",parsePatterns:_B,defaultParseWidth:"any"})},xB={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},kB={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},CB={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},vB={date:ml({formats:xB,defaultWidth:"full"}),time:ml({formats:kB,defaultWidth:"full"}),dateTime:ml({formats:CB,defaultWidth:"full"})},SB={name:"en-US",locale:{code:"en-US",formatDistance:QS,formatLong:vB,formatRelative:eB,localize:aB,match:wB,options:{weekStartsOn:0,firstWeekContainsDate:1}}};function qh(n){const{mergedLocaleRef:e,mergedDateLocaleRef:i}=t.inject(Di,null)||{},r=t.computed(()=>{var s,a;return(a=(s=e==null?void 0:e.value)===null||s===void 0?void 0:s[n])!==null&&a!==void 0?a:YS[n]});return{dateLocaleRef:t.computed(()=>{var s;return(s=i==null?void 0:i.value)!==null&&s!==void 0?s:SB}),localeRef:r}}const Jr="naive-ui-style";function eo(n,e,i){if(!e)return;const r=Ii(),o=t.computed(()=>{const{value:l}=e;if(!l)return;const c=l[n];if(c)return c}),s=t.inject(Di,null),a=()=>{t.watchEffect(()=>{const{value:l}=i,c=`${l}${n}Rtl`;if(Kv(c,r))return;const{value:d}=o;d&&d.style.mount({id:c,head:!0,anchorMetaName:Jr,props:{bPrefix:l?`.${l}-`:void 0},ssr:r,parent:s==null?void 0:s.styleMountTarget})})};return r?a():t.onBeforeMount(a),o}const to={fontFamily:'v-sans, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',fontFamilyMono:"v-mono, SFMono-Regular, Menlo, Consolas, Courier, monospace",fontWeight:"400",fontWeightStrong:"500",cubicBezierEaseInOut:"cubic-bezier(.4, 0, .2, 1)",cubicBezierEaseOut:"cubic-bezier(0, 0, .2, 1)",cubicBezierEaseIn:"cubic-bezier(.4, 0, 1, 1)",borderRadius:"3px",borderRadiusSmall:"2px",fontSize:"14px",fontSizeMini:"12px",fontSizeTiny:"12px",fontSizeSmall:"14px",fontSizeMedium:"14px",fontSizeLarge:"15px",fontSizeHuge:"16px",lineHeight:"1.6",heightMini:"16px",heightTiny:"22px",heightSmall:"28px",heightMedium:"34px",heightLarge:"40px",heightHuge:"46px"},{fontSize:BB,fontFamily:NB,lineHeight:TB}=to,Xh=pe("body",`
116
+ `)}function Ja(n){for(var e=0,i,r=0,o=n.length;o>=4;++r,o-=4)i=n.charCodeAt(r)&255|(n.charCodeAt(++r)&255)<<8|(n.charCodeAt(++r)&255)<<16|(n.charCodeAt(++r)&255)<<24,i=(i&65535)*1540483477+((i>>>16)*59797<<16),i^=i>>>24,e=(i&65535)*1540483477+((i>>>16)*59797<<16)^(e&65535)*1540483477+((e>>>16)*59797<<16);switch(o){case 3:e^=(n.charCodeAt(r+2)&255)<<16;case 2:e^=(n.charCodeAt(r+1)&255)<<8;case 1:e^=n.charCodeAt(r)&255,e=(e&65535)*1540483477+((e>>>16)*59797<<16)}return e^=e>>>13,e=(e&65535)*1540483477+((e>>>16)*59797<<16),((e^e>>>15)>>>0).toString(36)}typeof window<"u"&&(window.__cssrContext={});function Wv(n,e,i,r){const{els:o}=e;if(i===void 0)o.forEach(qf),e.els=[];else{const s=ls(i,r);s&&o.includes(s)&&(qf(s),e.els=o.filter(a=>a!==s))}}function Kf(n,e){n.push(e)}function jv(n,e,i,r,o,s,a,l,c){let d;if(i===void 0&&(d=e.render(r),i=Ja(d)),c){c.adapter(i,d??e.render(r));return}l===void 0&&(l=document.head);const u=ls(i,l);if(u!==null&&!s)return u;const f=u??Ov(i);if(d===void 0&&(d=e.render(r)),f.textContent=d,u!==null)return u;if(a){const h=l.querySelector(`meta[name="${a}"]`);if(h)return l.insertBefore(f,h),Kf(e.els,f),f}return o?l.insertBefore(f,l.querySelector("style, link")):l.appendChild(f),Kf(e.els,f),f}function qv(n){return Hv(this,this.instance,n)}function Xv(n={}){const{id:e,ssr:i,props:r,head:o=!1,force:s=!1,anchorMetaName:a,parent:l}=n;return jv(this.instance,this,e,r,o,s,a,l,i)}function Yv(n={}){const{id:e,parent:i}=n;Wv(this.instance,this,e,i)}const ds=function(n,e,i,r){return{instance:n,$:e,props:i,children:r,els:[],render:qv,mount:Xv,unmount:Yv}},Uv=function(n,e,i,r){return Array.isArray(e)?ds(n,{$:null},null,e):Array.isArray(i)?ds(n,e,null,i):Array.isArray(r)?ds(n,e,i,r):ds(n,e,i,null)};function Gf(n={}){const e={c:((...i)=>Uv(e,...i)),use:(i,...r)=>i.install(e,...r),find:ls,context:{},config:n};return e}function Kv(n,e){if(n===void 0)return!1;if(e){const{context:{ids:i}}=e;return i.has(n)}return ls(n)!==null}const{c:yi}=Gf(),el="vueuc-style";function Zf(n){return n&-n}class Qf{constructor(e,i){this.l=e,this.min=i;const r=new Array(e+1);for(let o=0;o<e+1;++o)r[o]=0;this.ft=r}add(e,i){if(i===0)return;const{l:r,ft:o}=this;for(e+=1;e<=r;)o[e]+=i,e+=Zf(e)}get(e){return this.sum(e+1)-this.sum(e)}sum(e){if(e===void 0&&(e=this.l),e<=0)return 0;const{ft:i,min:r,l:o}=this;if(e>o)throw new Error("[FinweckTree.sum]: `i` is larger than length.");let s=e*r;for(;e>0;)s+=i[e],e-=Zf(e);return s}getBound(e){let i=0,r=this.l;for(;r>i;){const o=Math.floor((i+r)/2),s=this.sum(o);if(s>e){r=o;continue}else if(s<e){if(i===o)return this.sum(i+1)<=e?i+1:o;i=o}else return o}return i}}function Jf(n){return typeof n=="string"?document.querySelector(n):n()||null}const Gv=t.defineComponent({name:"LazyTeleport",props:{to:{type:[String,Object],default:void 0},disabled:Boolean,show:{type:Boolean,required:!0}},setup(n){return{showTeleport:kv(t.toRef(n,"show")),mergedTo:t.computed(()=>{const{to:e}=n;return e??"body"})}},render(){return this.showTeleport?this.disabled?Ka("lazy-teleport",this.$slots):t.h(t.Teleport,{disabled:this.disabled,to:this.mergedTo},Ka("lazy-teleport",this.$slots)):null}}),us={top:"bottom",bottom:"top",left:"right",right:"left"},eh={start:"end",center:"center",end:"start"},tl={top:"height",bottom:"height",left:"width",right:"width"},Zv={"bottom-start":"top left",bottom:"top center","bottom-end":"top right","top-start":"bottom left",top:"bottom center","top-end":"bottom right","right-start":"top left",right:"center left","right-end":"bottom left","left-start":"top right",left:"center right","left-end":"bottom right"},Qv={"bottom-start":"bottom left",bottom:"bottom center","bottom-end":"bottom right","top-start":"top left",top:"top center","top-end":"top right","right-start":"top right",right:"center right","right-end":"bottom right","left-start":"top left",left:"center left","left-end":"bottom left"},Jv={"bottom-start":"right","bottom-end":"left","top-start":"right","top-end":"left","right-start":"bottom","right-end":"top","left-start":"bottom","left-end":"top"},th={top:!0,bottom:!1,left:!0,right:!1},nh={top:"end",bottom:"start",left:"end",right:"start"};function eS(n,e,i,r,o,s){if(!o||s)return{placement:n,top:0,left:0};const[a,l]=n.split("-");let c=l??"center",d={top:0,left:0};const u=(p,m,g)=>{let b=0,y=0;const _=i[p]-e[m]-e[p];return _>0&&r&&(g?y=th[m]?_:-_:b=th[m]?_:-_),{left:b,top:y}},f=a==="left"||a==="right";if(c!=="center"){const p=Jv[n],m=us[p],g=tl[p];if(i[g]>e[g]){if(e[p]+e[g]<i[g]){const b=(i[g]-e[g])/2;e[p]<b||e[m]<b?e[p]<e[m]?(c=eh[l],d=u(g,m,f)):d=u(g,p,f):c="center"}}else i[g]<e[g]&&e[m]<0&&e[p]>e[m]&&(c=eh[l])}else{const p=a==="bottom"||a==="top"?"left":"top",m=us[p],g=tl[p],b=(i[g]-e[g])/2;(e[p]<b||e[m]<b)&&(e[p]>e[m]?(c=nh[p],d=u(g,p,f)):(c=nh[m],d=u(g,m,f)))}let h=a;return e[a]<i[tl[a]]&&e[a]<e[us[a]]&&(h=us[a]),{placement:c!=="center"?`${h}-${c}`:h,left:d.left,top:d.top}}function tS(n,e){return e?Qv[n]:Zv[n]}function nS(n,e,i,r,o,s){if(s)switch(n){case"bottom-start":return{top:`${Math.round(i.top-e.top+i.height)}px`,left:`${Math.round(i.left-e.left)}px`,transform:"translateY(-100%)"};case"bottom-end":return{top:`${Math.round(i.top-e.top+i.height)}px`,left:`${Math.round(i.left-e.left+i.width)}px`,transform:"translateX(-100%) translateY(-100%)"};case"top-start":return{top:`${Math.round(i.top-e.top)}px`,left:`${Math.round(i.left-e.left)}px`,transform:""};case"top-end":return{top:`${Math.round(i.top-e.top)}px`,left:`${Math.round(i.left-e.left+i.width)}px`,transform:"translateX(-100%)"};case"right-start":return{top:`${Math.round(i.top-e.top)}px`,left:`${Math.round(i.left-e.left+i.width)}px`,transform:"translateX(-100%)"};case"right-end":return{top:`${Math.round(i.top-e.top+i.height)}px`,left:`${Math.round(i.left-e.left+i.width)}px`,transform:"translateX(-100%) translateY(-100%)"};case"left-start":return{top:`${Math.round(i.top-e.top)}px`,left:`${Math.round(i.left-e.left)}px`,transform:""};case"left-end":return{top:`${Math.round(i.top-e.top+i.height)}px`,left:`${Math.round(i.left-e.left)}px`,transform:"translateY(-100%)"};case"top":return{top:`${Math.round(i.top-e.top)}px`,left:`${Math.round(i.left-e.left+i.width/2)}px`,transform:"translateX(-50%)"};case"right":return{top:`${Math.round(i.top-e.top+i.height/2)}px`,left:`${Math.round(i.left-e.left+i.width)}px`,transform:"translateX(-100%) translateY(-50%)"};case"left":return{top:`${Math.round(i.top-e.top+i.height/2)}px`,left:`${Math.round(i.left-e.left)}px`,transform:"translateY(-50%)"};case"bottom":default:return{top:`${Math.round(i.top-e.top+i.height)}px`,left:`${Math.round(i.left-e.left+i.width/2)}px`,transform:"translateX(-50%) translateY(-100%)"}}switch(n){case"bottom-start":return{top:`${Math.round(i.top-e.top+i.height+r)}px`,left:`${Math.round(i.left-e.left+o)}px`,transform:""};case"bottom-end":return{top:`${Math.round(i.top-e.top+i.height+r)}px`,left:`${Math.round(i.left-e.left+i.width+o)}px`,transform:"translateX(-100%)"};case"top-start":return{top:`${Math.round(i.top-e.top+r)}px`,left:`${Math.round(i.left-e.left+o)}px`,transform:"translateY(-100%)"};case"top-end":return{top:`${Math.round(i.top-e.top+r)}px`,left:`${Math.round(i.left-e.left+i.width+o)}px`,transform:"translateX(-100%) translateY(-100%)"};case"right-start":return{top:`${Math.round(i.top-e.top+r)}px`,left:`${Math.round(i.left-e.left+i.width+o)}px`,transform:""};case"right-end":return{top:`${Math.round(i.top-e.top+i.height+r)}px`,left:`${Math.round(i.left-e.left+i.width+o)}px`,transform:"translateY(-100%)"};case"left-start":return{top:`${Math.round(i.top-e.top+r)}px`,left:`${Math.round(i.left-e.left+o)}px`,transform:"translateX(-100%)"};case"left-end":return{top:`${Math.round(i.top-e.top+i.height+r)}px`,left:`${Math.round(i.left-e.left+o)}px`,transform:"translateX(-100%) translateY(-100%)"};case"top":return{top:`${Math.round(i.top-e.top+r)}px`,left:`${Math.round(i.left-e.left+i.width/2+o)}px`,transform:"translateY(-100%) translateX(-50%)"};case"right":return{top:`${Math.round(i.top-e.top+i.height/2+r)}px`,left:`${Math.round(i.left-e.left+i.width+o)}px`,transform:"translateY(-50%)"};case"left":return{top:`${Math.round(i.top-e.top+i.height/2+r)}px`,left:`${Math.round(i.left-e.left+o)}px`,transform:"translateY(-50%) translateX(-100%)"};case"bottom":default:return{top:`${Math.round(i.top-e.top+i.height+r)}px`,left:`${Math.round(i.left-e.left+i.width/2+o)}px`,transform:"translateX(-50%)"}}}const iS=yi([yi(".v-binder-follower-container",{position:"absolute",left:"0",right:"0",top:"0",height:"0",pointerEvents:"none",zIndex:"auto"}),yi(".v-binder-follower-content",{position:"absolute",zIndex:"auto"},[yi("> *",{pointerEvents:"all"})])]),ih=t.defineComponent({name:"Follower",inheritAttrs:!1,props:{show:Boolean,enabled:{type:Boolean,default:void 0},placement:{type:String,default:"bottom"},syncTrigger:{type:Array,default:["resize","scroll"]},to:[String,Object],flip:{type:Boolean,default:!0},internalShift:Boolean,x:Number,y:Number,width:String,minWidth:String,containerClass:String,teleportDisabled:Boolean,zindexable:{type:Boolean,default:!0},zIndex:Number,overlap:Boolean},setup(n){const e=t.inject("VBinder"),i=hn(()=>n.enabled!==void 0?n.enabled:n.show),r=t.ref(null),o=t.ref(null),s=()=>{const{syncTrigger:h}=n;h.includes("scroll")&&e.addScrollListener(c),h.includes("resize")&&e.addResizeListener(c)},a=()=>{e.removeScrollListener(c),e.removeResizeListener(c)};t.onMounted(()=>{i.value&&(c(),s())});const l=Ii();iS.mount({id:"vueuc/binder",head:!0,anchorMetaName:el,ssr:l}),t.onBeforeUnmount(()=>{a()}),vv(()=>{i.value&&c()});const c=()=>{if(!i.value)return;const h=r.value;if(h===null)return;const p=e.targetRef,{x:m,y:g,overlap:b}=n,y=m!==void 0&&g!==void 0?Nv(m,g):Za(p);h.style.setProperty("--v-target-width",`${Math.round(y.width)}px`),h.style.setProperty("--v-target-height",`${Math.round(y.height)}px`);const{width:_,minWidth:x,placement:w,internalShift:C,flip:N}=n;h.setAttribute("v-placement",w),b?h.setAttribute("v-overlap",""):h.removeAttribute("v-overlap");const{style:k}=h;_==="target"?k.width=`${y.width}px`:_!==void 0?k.width=_:k.width="",x==="target"?k.minWidth=`${y.width}px`:x!==void 0?k.minWidth=x:k.minWidth="";const $=Za(h),v=Za(o.value),{left:E,top:P,placement:F}=eS(w,y,$,C,N,b),R=tS(F,b),{left:M,top:X,transform:G}=nS(F,v,y,P,E,b);h.setAttribute("v-placement",F),h.style.setProperty("--v-offset-left",`${Math.round(E)}px`),h.style.setProperty("--v-offset-top",`${Math.round(P)}px`),h.style.transform=`translateX(${M}) translateY(${X}) ${G}`,h.style.setProperty("--v-transform-origin",R),h.style.transformOrigin=R};t.watch(i,h=>{h?(s(),d()):a()});const d=()=>{t.nextTick().then(c).catch(h=>console.error(h))};["placement","x","y","internalShift","flip","width","overlap","minWidth"].forEach(h=>{t.watch(t.toRef(n,h),c)}),["teleportDisabled"].forEach(h=>{t.watch(t.toRef(n,h),d)}),t.watch(t.toRef(n,"syncTrigger"),h=>{h.includes("resize")?e.addResizeListener(c):e.removeResizeListener(c),h.includes("scroll")?e.addScrollListener(c):e.removeScrollListener(c)});const u=as(),f=hn(()=>{const{to:h}=n;if(h!==void 0)return h;u.value});return{VBinder:e,mergedEnabled:i,offsetContainerRef:o,followerRef:r,mergedTo:f,syncPosition:c}},render(){return t.h(Gv,{show:this.show,to:this.mergedTo,disabled:this.teleportDisabled},{default:()=>{var n,e;const i=t.h("div",{class:["v-binder-follower-container",this.containerClass],ref:"offsetContainerRef"},[t.h("div",{class:"v-binder-follower-content",ref:"followerRef"},(e=(n=this.$slots).default)===null||e===void 0?void 0:e.call(n))]);return this.zindexable?t.withDirectives(i,[[If,{enabled:this.mergedEnabled,zIndex:this.zIndex}]]):i}})}});var Ai=[],rS=function(){return Ai.some(function(n){return n.activeTargets.length>0})},oS=function(){return Ai.some(function(n){return n.skippedTargets.length>0})},rh="ResizeObserver loop completed with undelivered notifications.",sS=function(){var n;typeof ErrorEvent=="function"?n=new ErrorEvent("error",{message:rh}):(n=document.createEvent("Event"),n.initEvent("error",!1,!1),n.message=rh),window.dispatchEvent(n)},Yr;(function(n){n.BORDER_BOX="border-box",n.CONTENT_BOX="content-box",n.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(Yr||(Yr={}));var Oi=function(n){return Object.freeze(n)},aS=(function(){function n(e,i){this.inlineSize=e,this.blockSize=i,Oi(this)}return n})(),oh=(function(){function n(e,i,r,o){return this.x=e,this.y=i,this.width=r,this.height=o,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,Oi(this)}return n.prototype.toJSON=function(){var e=this,i=e.x,r=e.y,o=e.top,s=e.right,a=e.bottom,l=e.left,c=e.width,d=e.height;return{x:i,y:r,top:o,right:s,bottom:a,left:l,width:c,height:d}},n.fromRect=function(e){return new n(e.x,e.y,e.width,e.height)},n})(),nl=function(n){return n instanceof SVGElement&&"getBBox"in n},sh=function(n){if(nl(n)){var e=n.getBBox(),i=e.width,r=e.height;return!i&&!r}var o=n,s=o.offsetWidth,a=o.offsetHeight;return!(s||a||n.getClientRects().length)},ah=function(n){var e;if(n instanceof Element)return!0;var i=(e=n==null?void 0:n.ownerDocument)===null||e===void 0?void 0:e.defaultView;return!!(i&&n instanceof i.Element)},lS=function(n){switch(n.tagName){case"INPUT":if(n.type!=="image")break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1},Ur=typeof window<"u"?window:{},fs=new WeakMap,lh=/auto|scroll/,cS=/^tb|vertical/,dS=/msie|trident/i.test(Ur.navigator&&Ur.navigator.userAgent),An=function(n){return parseFloat(n||"0")},kr=function(n,e,i){return n===void 0&&(n=0),e===void 0&&(e=0),i===void 0&&(i=!1),new aS((i?e:n)||0,(i?n:e)||0)},ch=Oi({devicePixelContentBoxSize:kr(),borderBoxSize:kr(),contentBoxSize:kr(),contentRect:new oh(0,0,0,0)}),dh=function(n,e){if(e===void 0&&(e=!1),fs.has(n)&&!e)return fs.get(n);if(sh(n))return fs.set(n,ch),ch;var i=getComputedStyle(n),r=nl(n)&&n.ownerSVGElement&&n.getBBox(),o=!dS&&i.boxSizing==="border-box",s=cS.test(i.writingMode||""),a=!r&&lh.test(i.overflowY||""),l=!r&&lh.test(i.overflowX||""),c=r?0:An(i.paddingTop),d=r?0:An(i.paddingRight),u=r?0:An(i.paddingBottom),f=r?0:An(i.paddingLeft),h=r?0:An(i.borderTopWidth),p=r?0:An(i.borderRightWidth),m=r?0:An(i.borderBottomWidth),g=r?0:An(i.borderLeftWidth),b=f+d,y=c+u,_=g+p,x=h+m,w=l?n.offsetHeight-x-n.clientHeight:0,C=a?n.offsetWidth-_-n.clientWidth:0,N=o?b+_:0,k=o?y+x:0,$=r?r.width:An(i.width)-N-C,v=r?r.height:An(i.height)-k-w,E=$+b+C+_,P=v+y+w+x,F=Oi({devicePixelContentBoxSize:kr(Math.round($*devicePixelRatio),Math.round(v*devicePixelRatio),s),borderBoxSize:kr(E,P,s),contentBoxSize:kr($,v,s),contentRect:new oh(f,c,$,v)});return fs.set(n,F),F},uh=function(n,e,i){var r=dh(n,i),o=r.borderBoxSize,s=r.contentBoxSize,a=r.devicePixelContentBoxSize;switch(e){case Yr.DEVICE_PIXEL_CONTENT_BOX:return a;case Yr.BORDER_BOX:return o;default:return s}},uS=(function(){function n(e){var i=dh(e);this.target=e,this.contentRect=i.contentRect,this.borderBoxSize=Oi([i.borderBoxSize]),this.contentBoxSize=Oi([i.contentBoxSize]),this.devicePixelContentBoxSize=Oi([i.devicePixelContentBoxSize])}return n})(),fh=function(n){if(sh(n))return 1/0;for(var e=0,i=n.parentNode;i;)e+=1,i=i.parentNode;return e},fS=function(){var n=1/0,e=[];Ai.forEach(function(a){if(a.activeTargets.length!==0){var l=[];a.activeTargets.forEach(function(d){var u=new uS(d.target),f=fh(d.target);l.push(u),d.lastReportedSize=uh(d.target,d.observedBox),f<n&&(n=f)}),e.push(function(){a.callback.call(a.observer,l,a.observer)}),a.activeTargets.splice(0,a.activeTargets.length)}});for(var i=0,r=e;i<r.length;i++){var o=r[i];o()}return n},hh=function(n){Ai.forEach(function(i){i.activeTargets.splice(0,i.activeTargets.length),i.skippedTargets.splice(0,i.skippedTargets.length),i.observationTargets.forEach(function(o){o.isActive()&&(fh(o.target)>n?i.activeTargets.push(o):i.skippedTargets.push(o))})})},hS=function(){var n=0;for(hh(n);rS();)n=fS(),hh(n);return oS()&&sS(),n>0},il,mh=[],mS=function(){return mh.splice(0).forEach(function(n){return n()})},pS=function(n){if(!il){var e=0,i=document.createTextNode(""),r={characterData:!0};new MutationObserver(function(){return mS()}).observe(i,r),il=function(){i.textContent="".concat(e?e--:e++)}}mh.push(n),il()},gS=function(n){pS(function(){requestAnimationFrame(n)})},hs=0,yS=function(){return!!hs},bS=250,_S={attributes:!0,characterData:!0,childList:!0,subtree:!0},ph=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],gh=function(n){return n===void 0&&(n=0),Date.now()+n},rl=!1,wS=(function(){function n(){var e=this;this.stopped=!0,this.listener=function(){return e.schedule()}}return n.prototype.run=function(e){var i=this;if(e===void 0&&(e=bS),!rl){rl=!0;var r=gh(e);gS(function(){var o=!1;try{o=hS()}finally{if(rl=!1,e=r-gh(),!yS())return;o?i.run(1e3):e>0?i.run(e):i.start()}})}},n.prototype.schedule=function(){this.stop(),this.run()},n.prototype.observe=function(){var e=this,i=function(){return e.observer&&e.observer.observe(document.body,_S)};document.body?i():Ur.addEventListener("DOMContentLoaded",i)},n.prototype.start=function(){var e=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),ph.forEach(function(i){return Ur.addEventListener(i,e.listener,!0)}))},n.prototype.stop=function(){var e=this;this.stopped||(this.observer&&this.observer.disconnect(),ph.forEach(function(i){return Ur.removeEventListener(i,e.listener,!0)}),this.stopped=!0)},n})(),ol=new wS,yh=function(n){!hs&&n>0&&ol.start(),hs+=n,!hs&&ol.stop()},xS=function(n){return!nl(n)&&!lS(n)&&getComputedStyle(n).display==="inline"},kS=(function(){function n(e,i){this.target=e,this.observedBox=i||Yr.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return n.prototype.isActive=function(){var e=uh(this.target,this.observedBox,!0);return xS(this.target)&&(this.lastReportedSize=e),this.lastReportedSize.inlineSize!==e.inlineSize||this.lastReportedSize.blockSize!==e.blockSize},n})(),CS=(function(){function n(e,i){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=e,this.callback=i}return n})(),ms=new WeakMap,bh=function(n,e){for(var i=0;i<n.length;i+=1)if(n[i].target===e)return i;return-1},ps=(function(){function n(){}return n.connect=function(e,i){var r=new CS(e,i);ms.set(e,r)},n.observe=function(e,i,r){var o=ms.get(e),s=o.observationTargets.length===0;bh(o.observationTargets,i)<0&&(s&&Ai.push(o),o.observationTargets.push(new kS(i,r&&r.box)),yh(1),ol.schedule())},n.unobserve=function(e,i){var r=ms.get(e),o=bh(r.observationTargets,i),s=r.observationTargets.length===1;o>=0&&(s&&Ai.splice(Ai.indexOf(r),1),r.observationTargets.splice(o,1),yh(-1))},n.disconnect=function(e){var i=this,r=ms.get(e);r.observationTargets.slice().forEach(function(o){return i.unobserve(e,o.target)}),r.activeTargets.splice(0,r.activeTargets.length)},n})(),vS=(function(){function n(e){if(arguments.length===0)throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");if(typeof e!="function")throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");ps.connect(this,e)}return n.prototype.observe=function(e,i){if(arguments.length===0)throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!ah(e))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");ps.observe(this,e,i)},n.prototype.unobserve=function(e){if(arguments.length===0)throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!ah(e))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");ps.unobserve(this,e)},n.prototype.disconnect=function(){ps.disconnect(this)},n.toString=function(){return"function ResizeObserver () { [polyfill code] }"},n})();class SS{constructor(){this.handleResize=this.handleResize.bind(this),this.observer=new(typeof window<"u"&&window.ResizeObserver||vS)(this.handleResize),this.elHandlersMap=new Map}handleResize(e){for(const i of e){const r=this.elHandlersMap.get(i.target);r!==void 0&&r(i)}}registerHandler(e,i){this.elHandlersMap.set(e,i),this.observer.observe(e)}unregisterHandler(e){this.elHandlersMap.has(e)&&(this.elHandlersMap.delete(e),this.observer.unobserve(e))}}const Kr=new SS,gs=t.defineComponent({name:"ResizeObserver",props:{onResize:Function},setup(n){let e=!1;const i=t.getCurrentInstance().proxy;function r(o){const{onResize:s}=n;s!==void 0&&s(o)}t.onMounted(()=>{const o=i.$el;if(o===void 0){Wf("resize-observer","$el does not exist.");return}if(o.nextElementSibling!==o.nextSibling&&o.nodeType===3&&o.nodeValue!==""){Wf("resize-observer","$el can not be observed (it may be a text node).");return}o.nextElementSibling!==null&&(Kr.registerHandler(o.nextElementSibling,r),e=!0)}),t.onBeforeUnmount(()=>{e&&Kr.unregisterHandler(i.$el.nextElementSibling)})},render(){return t.renderSlot(this.$slots,"default")}});let ys;function BS(){return typeof document>"u"?!1:(ys===void 0&&("matchMedia"in window?ys=window.matchMedia("(pointer:coarse)").matches:ys=!1),ys)}let sl;function _h(){return typeof document>"u"?1:(sl===void 0&&(sl="chrome"in window?window.devicePixelRatio:1),sl)}const wh="VVirtualListXScroll";function NS({columnsRef:n,renderColRef:e,renderItemWithColsRef:i}){const r=t.ref(0),o=t.ref(0),s=t.computed(()=>{const d=n.value;if(d.length===0)return null;const u=new Qf(d.length,0);return d.forEach((f,h)=>{u.add(h,f.width)}),u}),a=hn(()=>{const d=s.value;return d!==null?Math.max(d.getBound(o.value)-1,0):0}),l=d=>{const u=s.value;return u!==null?u.sum(d):0},c=hn(()=>{const d=s.value;return d!==null?Math.min(d.getBound(o.value+r.value)+1,n.value.length-1):0});return t.provide(wh,{startIndexRef:a,endIndexRef:c,columnsRef:n,renderColRef:e,renderItemWithColsRef:i,getLeft:l}),{listWidthRef:r,scrollLeftRef:o}}const xh=t.defineComponent({name:"VirtualListRow",props:{index:{type:Number,required:!0},item:{type:Object,required:!0}},setup(){const{startIndexRef:n,endIndexRef:e,columnsRef:i,getLeft:r,renderColRef:o,renderItemWithColsRef:s}=t.inject(wh);return{startIndex:n,endIndex:e,columns:i,renderCol:o,renderItemWithCols:s,getLeft:r}},render(){const{startIndex:n,endIndex:e,columns:i,renderCol:r,renderItemWithCols:o,getLeft:s,item:a}=this;if(o!=null)return o({itemIndex:this.index,startColIndex:n,endColIndex:e,allColumns:i,item:a,getLeft:s});if(r!=null){const l=[];for(let c=n;c<=e;++c){const d=i[c];l.push(r({column:d,left:s(c),item:a}))}return l}return null}}),TS=yi(".v-vl",{maxHeight:"inherit",height:"100%",overflow:"auto",minWidth:"1px"},[yi("&:not(.v-vl--show-scrollbar)",{scrollbarWidth:"none"},[yi("&::-webkit-scrollbar, &::-webkit-scrollbar-track-piece, &::-webkit-scrollbar-thumb",{width:0,height:0,display:"none"})])]),$S=t.defineComponent({name:"VirtualList",inheritAttrs:!1,props:{showScrollbar:{type:Boolean,default:!0},columns:{type:Array,default:()=>[]},renderCol:Function,renderItemWithCols:Function,items:{type:Array,default:()=>[]},itemSize:{type:Number,required:!0},itemResizable:Boolean,itemsStyle:[String,Object],visibleItemsTag:{type:[String,Object],default:"div"},visibleItemsProps:Object,ignoreItemResize:Boolean,onScroll:Function,onWheel:Function,onResize:Function,defaultScrollKey:[Number,String],defaultScrollIndex:Number,keyField:{type:String,default:"key"},paddingTop:{type:[Number,String],default:0},paddingBottom:{type:[Number,String],default:0}},setup(n){const e=Ii();TS.mount({id:"vueuc/virtual-list",head:!0,anchorMetaName:el,ssr:e}),t.onMounted(()=>{const{defaultScrollIndex:R,defaultScrollKey:M}=n;R!=null?b({index:R}):M!=null&&b({key:M})});let i=!1,r=!1;t.onActivated(()=>{if(i=!1,!r){r=!0;return}b({top:p.value,left:a.value})}),t.onDeactivated(()=>{i=!0,r||(r=!0)});const o=hn(()=>{if(n.renderCol==null&&n.renderItemWithCols==null||n.columns.length===0)return;let R=0;return n.columns.forEach(M=>{R+=M.width}),R}),s=t.computed(()=>{const R=new Map,{keyField:M}=n;return n.items.forEach((X,G)=>{R.set(X[M],G)}),R}),{scrollLeftRef:a,listWidthRef:l}=NS({columnsRef:t.toRef(n,"columns"),renderColRef:t.toRef(n,"renderCol"),renderItemWithColsRef:t.toRef(n,"renderItemWithCols")}),c=t.ref(null),d=t.ref(void 0),u=new Map,f=t.computed(()=>{const{items:R,itemSize:M,keyField:X}=n,G=new Qf(R.length,M);return R.forEach((Z,O)=>{const A=Z[X],Y=u.get(A);Y!==void 0&&G.add(O,Y)}),G}),h=t.ref(0),p=t.ref(0),m=hn(()=>Math.max(f.value.getBound(p.value-jr(n.paddingTop))-1,0)),g=t.computed(()=>{const{value:R}=d;if(R===void 0)return[];const{items:M,itemSize:X}=n,G=m.value,Z=Math.min(G+Math.ceil(R/X+1),M.length-1),O=[];for(let A=G;A<=Z;++A)O.push(M[A]);return O}),b=(R,M)=>{if(typeof R=="number"){w(R,M,"auto");return}const{left:X,top:G,index:Z,key:O,position:A,behavior:Y,debounce:H=!0}=R;if(X!==void 0||G!==void 0)w(X,G,Y);else if(Z!==void 0)x(Z,Y,H);else if(O!==void 0){const T=s.value.get(O);T!==void 0&&x(T,Y,H)}else A==="bottom"?w(0,Number.MAX_SAFE_INTEGER,Y):A==="top"&&w(0,0,Y)};let y,_=null;function x(R,M,X){const{value:G}=f,Z=G.sum(R)+jr(n.paddingTop);if(!X)c.value.scrollTo({left:0,top:Z,behavior:M});else{y=R,_!==null&&window.clearTimeout(_),_=window.setTimeout(()=>{y=void 0,_=null},16);const{scrollTop:O,offsetHeight:A}=c.value;if(Z>O){const Y=G.get(R);Z+Y<=O+A||c.value.scrollTo({left:0,top:Z+Y-A,behavior:M})}else c.value.scrollTo({left:0,top:Z,behavior:M})}}function w(R,M,X){c.value.scrollTo({left:R,top:M,behavior:X})}function C(R,M){var X,G,Z;if(i||n.ignoreItemResize||F(M.target))return;const{value:O}=f,A=s.value.get(R),Y=O.get(A),H=(Z=(G=(X=M.borderBoxSize)===null||X===void 0?void 0:X[0])===null||G===void 0?void 0:G.blockSize)!==null&&Z!==void 0?Z:M.contentRect.height;if(H===Y)return;H-n.itemSize===0?u.delete(R):u.set(R,H-n.itemSize);const D=H-Y;if(D===0)return;O.add(A,D);const K=c.value;if(K!=null){if(y===void 0){const J=O.sum(A);K.scrollTop>J&&K.scrollBy(0,D)}else if(A<y)K.scrollBy(0,D);else if(A===y){const J=O.sum(A);H+J>K.scrollTop+K.offsetHeight&&K.scrollBy(0,D)}P()}h.value++}const N=!BS();let k=!1;function $(R){var M;(M=n.onScroll)===null||M===void 0||M.call(n,R),(!N||!k)&&P()}function v(R){var M;if((M=n.onWheel)===null||M===void 0||M.call(n,R),N){const X=c.value;if(X!=null){if(R.deltaX===0&&(X.scrollTop===0&&R.deltaY<=0||X.scrollTop+X.offsetHeight>=X.scrollHeight&&R.deltaY>=0))return;R.preventDefault(),X.scrollTop+=R.deltaY/_h(),X.scrollLeft+=R.deltaX/_h(),P(),k=!0,Sf(()=>{k=!1})}}}function E(R){if(i||F(R.target))return;if(n.renderCol==null&&n.renderItemWithCols==null){if(R.contentRect.height===d.value)return}else if(R.contentRect.height===d.value&&R.contentRect.width===l.value)return;d.value=R.contentRect.height,l.value=R.contentRect.width;const{onResize:M}=n;M!==void 0&&M(R)}function P(){const{value:R}=c;R!=null&&(p.value=R.scrollTop,a.value=R.scrollLeft)}function F(R){let M=R;for(;M!==null;){if(M.style.display==="none")return!0;M=M.parentElement}return!1}return{listHeight:d,listStyle:{overflow:"auto"},keyToIndex:s,itemsStyle:t.computed(()=>{const{itemResizable:R}=n,M=qr(f.value.sum());return h.value,[n.itemsStyle,{boxSizing:"content-box",width:qr(o.value),height:R?"":M,minHeight:R?M:"",paddingTop:qr(n.paddingTop),paddingBottom:qr(n.paddingBottom)}]}),visibleItemsStyle:t.computed(()=>(h.value,{transform:`translateY(${qr(f.value.sum(m.value))})`})),viewportItems:g,listElRef:c,itemsElRef:t.ref(null),scrollTo:b,handleListResize:E,handleListScroll:$,handleListWheel:v,handleItemResize:C}},render(){const{itemResizable:n,keyField:e,keyToIndex:i,visibleItemsTag:r}=this;return t.h(gs,{onResize:this.handleListResize},{default:()=>{var o,s;return t.h("div",t.mergeProps(this.$attrs,{class:["v-vl",this.showScrollbar&&"v-vl--show-scrollbar"],onScroll:this.handleListScroll,onWheel:this.handleListWheel,ref:"listElRef"}),[this.items.length!==0?t.h("div",{ref:"itemsElRef",class:"v-vl-items",style:this.itemsStyle},[t.h(r,Object.assign({class:"v-vl-visible-items",style:this.visibleItemsStyle},this.visibleItemsProps),{default:()=>{const{renderCol:a,renderItemWithCols:l}=this;return this.viewportItems.map(c=>{const d=c[e],u=i.get(d),f=a!=null?t.h(xh,{index:u,item:c}):void 0,h=l!=null?t.h(xh,{index:u,item:c}):void 0,p=this.$slots.default({item:c,renderedCols:f,renderedItemWithCols:h,index:u})[0];return n?t.h(gs,{key:d,onResize:m=>this.handleItemResize(d,m)},{default:()=>p}):(p.key=d,p)})}})]):(s=(o=this.$slots).empty)===null||s===void 0?void 0:s.call(o)])}})}}),Kn="v-hidden",ES=yi("[v-hidden]",{display:"none!important"}),kh=t.defineComponent({name:"Overflow",props:{getCounter:Function,getTail:Function,updateCounter:Function,onUpdateCount:Function,onUpdateOverflow:Function},setup(n,{slots:e}){const i=t.ref(null),r=t.ref(null);function o(a){const{value:l}=i,{getCounter:c,getTail:d}=n;let u;if(c!==void 0?u=c():u=r.value,!l||!u)return;u.hasAttribute(Kn)&&u.removeAttribute(Kn);const{children:f}=l;if(a.showAllItemsBeforeCalculate)for(const x of f)x.hasAttribute(Kn)&&x.removeAttribute(Kn);const h=l.offsetWidth,p=[],m=e.tail?d==null?void 0:d():null;let g=m?m.offsetWidth:0,b=!1;const y=l.children.length-(e.tail?1:0);for(let x=0;x<y-1;++x){if(x<0)continue;const w=f[x];if(b){w.hasAttribute(Kn)||w.setAttribute(Kn,"");continue}else w.hasAttribute(Kn)&&w.removeAttribute(Kn);const C=w.offsetWidth;if(g+=C,p[x]=C,g>h){const{updateCounter:N}=n;for(let k=x;k>=0;--k){const $=y-1-k;N!==void 0?N($):u.textContent=`${$}`;const v=u.offsetWidth;if(g-=p[k],g+v<=h||k===0){b=!0,x=k-1,m&&(x===-1?(m.style.maxWidth=`${h-v}px`,m.style.boxSizing="border-box"):m.style.maxWidth="");const{onUpdateCount:E}=n;E&&E($);break}}}}const{onUpdateOverflow:_}=n;b?_!==void 0&&_(!0):(_!==void 0&&_(!1),u.setAttribute(Kn,""))}const s=Ii();return ES.mount({id:"vueuc/overflow",head:!0,anchorMetaName:el,ssr:s}),t.onMounted(()=>o({showAllItemsBeforeCalculate:!1})),{selfRef:i,counterRef:r,sync:o}},render(){const{$slots:n}=this;return t.nextTick(()=>this.sync({showAllItemsBeforeCalculate:!1})),t.h("div",{class:"v-overflow",ref:"selfRef"},[t.renderSlot(n,"default"),n.counter?n.counter():t.h("span",{style:{display:"inline-block"},ref:"counterRef"}),n.tail?n.tail():null])}});function Ch(n){return n instanceof HTMLElement}function vh(n){for(let e=0;e<n.childNodes.length;e++){const i=n.childNodes[e];if(Ch(i)&&(Bh(i)||vh(i)))return!0}return!1}function Sh(n){for(let e=n.childNodes.length-1;e>=0;e--){const i=n.childNodes[e];if(Ch(i)&&(Bh(i)||Sh(i)))return!0}return!1}function Bh(n){if(!RS(n))return!1;try{n.focus({preventScroll:!0})}catch{}return document.activeElement===n}function RS(n){if(n.tabIndex>0||n.tabIndex===0&&n.getAttribute("tabIndex")!==null)return!0;if(n.getAttribute("disabled"))return!1;switch(n.nodeName){case"A":return!!n.href&&n.rel!=="ignore";case"INPUT":return n.type!=="hidden"&&n.type!=="file";case"SELECT":case"TEXTAREA":return!0;default:return!1}}let Gr=[];const PS=t.defineComponent({name:"FocusTrap",props:{disabled:Boolean,active:Boolean,autoFocus:{type:Boolean,default:!0},onEsc:Function,initialFocusTo:[String,Function],finalFocusTo:[String,Function],returnFocusOnDeactivated:{type:Boolean,default:!0}},setup(n){const e=DC(),i=t.ref(null),r=t.ref(null);let o=!1,s=!1;const a=typeof document>"u"?null:document.activeElement;function l(){return Gr[Gr.length-1]===e}function c(b){var y;b.code==="Escape"&&l()&&((y=n.onEsc)===null||y===void 0||y.call(n,b))}t.onMounted(()=>{t.watch(()=>n.active,b=>{b?(f(),Lt("keydown",document,c)):(yt("keydown",document,c),o&&h())},{immediate:!0})}),t.onBeforeUnmount(()=>{yt("keydown",document,c),o&&h()});function d(b){if(!s&&l()){const y=u();if(y===null||y.contains(Wr(b)))return;p("first")}}function u(){const b=i.value;if(b===null)return null;let y=b;for(;y=y.nextSibling,!(y===null||y instanceof Element&&y.tagName==="DIV"););return y}function f(){var b;if(!n.disabled){if(Gr.push(e),n.autoFocus){const{initialFocusTo:y}=n;y===void 0?p("first"):(b=Jf(y))===null||b===void 0||b.focus({preventScroll:!0})}o=!0,document.addEventListener("focus",d,!0)}}function h(){var b;if(n.disabled||(document.removeEventListener("focus",d,!0),Gr=Gr.filter(_=>_!==e),l()))return;const{finalFocusTo:y}=n;y!==void 0?(b=Jf(y))===null||b===void 0||b.focus({preventScroll:!0}):n.returnFocusOnDeactivated&&a instanceof HTMLElement&&(s=!0,a.focus({preventScroll:!0}),s=!1)}function p(b){if(l()&&n.active){const y=i.value,_=r.value;if(y!==null&&_!==null){const x=u();if(x==null||x===_){s=!0,y.focus({preventScroll:!0}),s=!1;return}s=!0;const w=b==="first"?vh(x):Sh(x);s=!1,w||(s=!0,y.focus({preventScroll:!0}),s=!1)}}}function m(b){if(s)return;const y=u();y!==null&&(b.relatedTarget!==null&&y.contains(b.relatedTarget)?p("last"):p("first"))}function g(b){s||(b.relatedTarget!==null&&b.relatedTarget===i.value?p("last"):p("first"))}return{focusableStartRef:i,focusableEndRef:r,focusableStyle:"position: absolute; height: 0; width: 0;",handleStartFocus:m,handleEndFocus:g}},render(){const{default:n}=this.$slots;if(n===void 0)return null;if(this.disabled)return n();const{active:e,focusableStyle:i}=this;return t.h(t.Fragment,null,[t.h("div",{"aria-hidden":"true",tabindex:e?"0":"-1",ref:"focusableStartRef",style:i,onFocus:this.handleStartFocus}),n(),t.h("div",{"aria-hidden":"true",style:i,ref:"focusableEndRef",tabindex:e?"0":"-1",onFocus:this.handleEndFocus})])}});function MT(n){return n}const al="n-internal-select-menu",Nh="n-internal-select-menu-body",Th="n-drawer-body",$h="n-modal-body",Eh="n-popover-body",Rh="__disabled__";function Gn(n){const e=t.inject($h,null),i=t.inject(Th,null),r=t.inject(Eh,null),o=t.inject(Nh,null),s=t.ref();if(typeof document<"u"){s.value=document.fullscreenElement;const a=()=>{s.value=document.fullscreenElement};t.onMounted(()=>{Lt("fullscreenchange",document,a)}),t.onBeforeUnmount(()=>{yt("fullscreenchange",document,a)})}return hn(()=>{var a;const{to:l}=n;return l!==void 0?l===!1?Rh:l===!0?s.value||"body":l:e!=null&&e.value?(a=e.value.$el)!==null&&a!==void 0?a:e.value:i!=null&&i.value?i.value:r!=null&&r.value?r.value:o!=null&&o.value?o.value:l??(s.value||"body")})}Gn.tdkey=Rh,Gn.propTo={type:[String,Object,Boolean],default:void 0};function FS(n){const e={isDeactivated:!1};let i=!1;return t.onActivated(()=>{if(e.isDeactivated=!1,!i){i=!0;return}n()}),t.onDeactivated(()=>{e.isDeactivated=!0,i||(i=!0)}),e}function Ph(n,e){e&&(t.onMounted(()=>{const{value:i}=n;i&&Kr.registerHandler(i,e)}),t.watch(n,(i,r)=>{r&&Kr.unregisterHandler(r)},{deep:!1}),t.onBeforeUnmount(()=>{const{value:i}=n;i&&Kr.unregisterHandler(i)}))}function Fh(n){return n.replace(/#|\(|\)|,|\s|\./g,"_")}const VS=/^(\d|\.)+$/,Vh=/(\d|\.)+/;function ll(n,{c:e=1,offset:i=0,attachPx:r=!0}={}){if(typeof n=="number"){const o=(n+i)*e;return o===0?"0":`${o}px`}else if(typeof n=="string")if(VS.test(n)){const o=(Number(n)+i)*e;return r?o===0?"0":`${o}px`:`${o}`}else{const o=Vh.exec(n);return o?n.replace(Vh,String((Number(o[0])+i)*e)):n}return n}function Mh(n){const{left:e,right:i,top:r,bottom:o}=xn(n);return`${r} ${e} ${o} ${i}`}var Ih={};function MS(n){let e=".",i="__",r="--",o;if(n){let m=n.blockPrefix;m&&(e=m),m=n.elementPrefix,m&&(i=m),m=n.modifierPrefix,m&&(r=m)}const s={install(m){o=m.c;const g=m.context;g.bem={},g.bem.b=null,g.bem.els=null}};function a(m){let g,b;return{before(y){g=y.bem.b,b=y.bem.els,y.bem.els=null},after(y){y.bem.b=g,y.bem.els=b},$({context:y,props:_}){return m=typeof m=="string"?m:m({context:y,props:_}),y.bem.b=m,`${(_==null?void 0:_.bPrefix)||e}${y.bem.b}`}}}function l(m){let g;return{before(b){g=b.bem.els},after(b){b.bem.els=g},$({context:b,props:y}){return m=typeof m=="string"?m:m({context:b,props:y}),b.bem.els=m.split(",").map(_=>_.trim()),b.bem.els.map(_=>`${(y==null?void 0:y.bPrefix)||e}${b.bem.b}${i}${_}`).join(", ")}}}function c(m){return{$({context:g,props:b}){m=typeof m=="string"?m:m({context:g,props:b});const y=m.split(",").map(w=>w.trim());function _(w){return y.map(C=>`&${(b==null?void 0:b.bPrefix)||e}${g.bem.b}${w!==void 0?`${i}${w}`:""}${r}${C}`).join(", ")}const x=g.bem.els;if(x!==null){if(Ih.NODE_ENV!=="production"&&x.length>=2)throw Error(`[css-render/plugin-bem]: m(${m}) is invalid, using modifier inside multiple elements is not allowed`);return _(x[0])}else return _()}}}function d(m){return{$({context:g,props:b}){m=typeof m=="string"?m:m({context:g,props:b});const y=g.bem.els;if(Ih.NODE_ENV!=="production"&&y!==null&&y.length>=2)throw Error(`[css-render/plugin-bem]: notM(${m}) is invalid, using modifier inside multiple elements is not allowed`);return`&:not(${(b==null?void 0:b.bPrefix)||e}${g.bem.b}${y!==null&&y.length>0?`${i}${y[0]}`:""}${r}${m})`}}}return Object.assign(s,{cB:((...m)=>o(a(m[0]),m[1],m[2])),cE:((...m)=>o(l(m[0]),m[1],m[2])),cM:((...m)=>o(c(m[0]),m[1],m[2])),cNotM:((...m)=>o(d(m[0]),m[1],m[2]))}),s}const IS=".n-",AS="__",OS="--",Ah=Gf(),Oh=MS({blockPrefix:IS,elementPrefix:AS,modifierPrefix:OS});Ah.use(Oh);const{c:pe,find:AT}=Ah,{cB:ke,cE:ve,cM:Fe,cNotM:kn}=Oh,zS=(...n)=>pe(">",[ke(...n)]);function st(n,e){return n+(e==="default"?"":e.replace(/^[a-z]/,i=>i.toUpperCase()))}let cl;function DS(){return cl===void 0&&(cl=navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom")),cl}const LS=new WeakSet;function HS(n){LS.add(n)}function zh(n){switch(typeof n){case"string":return n||void 0;case"number":return String(n);default:return}}const Dh=new Set;function bi(n,e){const i=`[naive/${n}]: ${e}`;Dh.has(i)||(Dh.add(i),console.error(i))}function Lh(n,e){console.error(`[naive/${n}]: ${e}`)}function Hh(n,e){throw new Error(`[naive/${n}]: ${e}`)}function Et(n,...e){if(Array.isArray(n))n.forEach(i=>Et(i,...e));else return n(...e)}function dl(n,e=!0,i=[]){return n.forEach(r=>{if(r!==null){if(typeof r!="object"){(typeof r=="string"||typeof r=="number")&&i.push(t.createTextVNode(String(r)));return}if(Array.isArray(r)){dl(r,e,i);return}if(r.type===t.Fragment){if(r.children===null)return;Array.isArray(r.children)&&dl(r.children,e,i)}else{if(r.type===t.Comment&&e)return;i.push(r)}}}),i}function WS(n,e="default",i=void 0){const r=n[e];if(!r)return Lh("getFirstSlotVNode",`slot[${e}] is empty`),null;const o=dl(r(i));return o.length===1?o[0]:(Lh("getFirstSlotVNode",`slot[${e}] should have exactly one child`),null)}function jS(n,e=[],i){const r={};return e.forEach(o=>{r[o]=n[o]}),Object.assign(r,i)}function ul(n){const e=n.filter(i=>i!==void 0);if(e.length!==0)return e.length===1?e[0]:i=>{n.forEach(r=>{r&&r(i)})}}function Cr(n,...e){return typeof n=="function"?n(...e):typeof n=="string"?t.createTextVNode(n):typeof n=="number"?t.createTextVNode(String(n)):null}function bs(n){return n.some(e=>t.isVNode(e)?!(e.type===t.Comment||e.type===t.Fragment&&!bs(e.children)):!0)?n:null}function fl(n,e){return n&&bs(n())||e()}function zi(n,e){const i=n&&bs(n());return e(i||null)}function Wh(n){return!(n&&bs(n()))}const hl=t.defineComponent({render(){var n,e;return(e=(n=this.$slots).default)===null||e===void 0?void 0:e.call(n)}}),Di="n-config-provider",qS="n";function Li(n={},e={defaultBordered:!0}){const i=t.inject(Di,null);return{inlineThemeDisabled:i==null?void 0:i.inlineThemeDisabled,mergedRtlRef:i==null?void 0:i.mergedRtlRef,mergedComponentPropsRef:i==null?void 0:i.mergedComponentPropsRef,mergedBreakpointsRef:i==null?void 0:i.mergedBreakpointsRef,mergedBorderedRef:t.computed(()=>{var r,o;const{bordered:s}=n;return s!==void 0?s:(o=(r=i==null?void 0:i.mergedBorderedRef.value)!==null&&r!==void 0?r:e.defaultBordered)!==null&&o!==void 0?o:!0}),mergedClsPrefixRef:i?i.mergedClsPrefixRef:t.shallowRef(qS),namespaceRef:t.computed(()=>i==null?void 0:i.mergedNamespaceRef.value)}}function Hi(n,e,i,r){i||Hh("useThemeClass","cssVarsRef is not passed");const o=t.inject(Di,null),s=o==null?void 0:o.mergedThemeHashRef,a=o==null?void 0:o.styleMountTarget,l=t.ref(""),c=Ii();let d;const u=`__${n}`,f=()=>{let h=u;const p=e?e.value:void 0,m=s==null?void 0:s.value;m&&(h+=`-${m}`),p&&(h+=`-${p}`);const{themeOverrides:g,builtinThemeOverrides:b}=r;g&&(h+=`-${Ja(JSON.stringify(g))}`),b&&(h+=`-${Ja(JSON.stringify(b))}`),l.value=h,d=()=>{const y=i.value;let _="";for(const x in y)_+=`${x}: ${y[x]};`;pe(`.${h}`,_).mount({id:h,ssr:c,parent:a}),d=void 0}};return t.watchEffect(()=>{f()}),{themeClass:l,onRender:()=>{d==null||d()}}}const jh="n-form-item";function XS(n,{defaultSize:e="medium",mergedSize:i,mergedDisabled:r}={}){const o=t.inject(jh,null);t.provide(jh,null);const s=t.computed(i?()=>i(o):()=>{const{size:c}=n;if(c)return c;if(o){const{mergedSize:d}=o;if(d.value!==void 0)return d.value}return e}),a=t.computed(r?()=>r(o):()=>{const{disabled:c}=n;return c!==void 0?c:o?o.disabled.value:!1}),l=t.computed(()=>{const{status:c}=n;return c||(o==null?void 0:o.mergedValidationStatus.value)});return t.onBeforeUnmount(()=>{o&&o.restoreValidation()}),{mergedSizeRef:s,mergedDisabledRef:a,mergedStatusRef:l,nTriggerFormBlur(){o&&o.handleContentBlur()},nTriggerFormChange(){o&&o.handleContentChange()},nTriggerFormFocus(){o&&o.handleContentFocus()},nTriggerFormInput(){o&&o.handleContentInput()}}}const YS={name:"en-US",global:{undo:"Undo",redo:"Redo",confirm:"Confirm",clear:"Clear"},Popconfirm:{positiveText:"Confirm",negativeText:"Cancel"},Cascader:{placeholder:"Please Select",loading:"Loading",loadingRequiredMessage:n=>`Please load all ${n}'s descendants before checking it.`},Time:{dateFormat:"yyyy-MM-dd",dateTimeFormat:"yyyy-MM-dd HH:mm:ss"},DatePicker:{yearFormat:"yyyy",monthFormat:"MMM",dayFormat:"eeeeee",yearTypeFormat:"yyyy",monthTypeFormat:"yyyy-MM",dateFormat:"yyyy-MM-dd",dateTimeFormat:"yyyy-MM-dd HH:mm:ss",quarterFormat:"yyyy-qqq",weekFormat:"YYYY-w",clear:"Clear",now:"Now",confirm:"Confirm",selectTime:"Select Time",selectDate:"Select Date",datePlaceholder:"Select Date",datetimePlaceholder:"Select Date and Time",monthPlaceholder:"Select Month",yearPlaceholder:"Select Year",quarterPlaceholder:"Select Quarter",weekPlaceholder:"Select Week",startDatePlaceholder:"Start Date",endDatePlaceholder:"End Date",startDatetimePlaceholder:"Start Date and Time",endDatetimePlaceholder:"End Date and Time",startMonthPlaceholder:"Start Month",endMonthPlaceholder:"End Month",monthBeforeYear:!0,firstDayOfWeek:6,today:"Today"},DataTable:{checkTableAll:"Select all in the table",uncheckTableAll:"Unselect all in the table",confirm:"Confirm",clear:"Clear"},LegacyTransfer:{sourceTitle:"Source",targetTitle:"Target"},Transfer:{selectAll:"Select all",unselectAll:"Unselect all",clearAll:"Clear",total:n=>`Total ${n} items`,selected:n=>`${n} items selected`},Empty:{description:"No Data"},Select:{placeholder:"Please Select"},TimePicker:{placeholder:"Select Time",positiveText:"OK",negativeText:"Cancel",now:"Now",clear:"Clear"},Pagination:{goto:"Goto",selectionSuffix:"page"},DynamicTags:{add:"Add"},Log:{loading:"Loading"},Input:{placeholder:"Please Input"},InputNumber:{placeholder:"Please Input"},DynamicInput:{create:"Create"},ThemeEditor:{title:"Theme Editor",clearAllVars:"Clear All Variables",clearSearch:"Clear Search",filterCompName:"Filter Component Name",filterVarName:"Filter Variable Name",import:"Import",export:"Export",restore:"Reset to Default"},Image:{tipPrevious:"Previous picture (←)",tipNext:"Next picture (→)",tipCounterclockwise:"Counterclockwise",tipClockwise:"Clockwise",tipZoomOut:"Zoom out",tipZoomIn:"Zoom in",tipDownload:"Download",tipClose:"Close (Esc)",tipOriginalSize:"Zoom to original size"},Heatmap:{less:"less",more:"more",monthFormat:"MMM",weekdayFormat:"eee"}};function ml(n){return(e={})=>{const i=e.width?String(e.width):n.defaultWidth;return n.formats[i]||n.formats[n.defaultWidth]}}function Zr(n){return(e,i)=>{const r=i!=null&&i.context?String(i.context):"standalone";let o;if(r==="formatting"&&n.formattingValues){const a=n.defaultFormattingWidth||n.defaultWidth,l=i!=null&&i.width?String(i.width):a;o=n.formattingValues[l]||n.formattingValues[a]}else{const a=n.defaultWidth,l=i!=null&&i.width?String(i.width):n.defaultWidth;o=n.values[l]||n.values[a]}const s=n.argumentCallback?n.argumentCallback(e):e;return o[s]}}function Qr(n){return(e,i={})=>{const r=i.width,o=r&&n.matchPatterns[r]||n.matchPatterns[n.defaultMatchWidth],s=e.match(o);if(!s)return null;const a=s[0],l=r&&n.parsePatterns[r]||n.parsePatterns[n.defaultParseWidth],c=Array.isArray(l)?KS(l,f=>f.test(a)):US(l,f=>f.test(a));let d;d=n.valueCallback?n.valueCallback(c):c,d=i.valueCallback?i.valueCallback(d):d;const u=e.slice(a.length);return{value:d,rest:u}}}function US(n,e){for(const i in n)if(Object.prototype.hasOwnProperty.call(n,i)&&e(n[i]))return i}function KS(n,e){for(let i=0;i<n.length;i++)if(e(n[i]))return i}function GS(n){return(e,i={})=>{const r=e.match(n.matchPattern);if(!r)return null;const o=r[0],s=e.match(n.parsePattern);if(!s)return null;let a=n.valueCallback?n.valueCallback(s[0]):s[0];a=i.valueCallback?i.valueCallback(a):a;const l=e.slice(o.length);return{value:a,rest:l}}}const ZS={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},QS=(n,e,i)=>{let r;const o=ZS[n];return typeof o=="string"?r=o:e===1?r=o.one:r=o.other.replace("{{count}}",e.toString()),i!=null&&i.addSuffix?i.comparison&&i.comparison>0?"in "+r:r+" ago":r},JS={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},eB=(n,e,i,r)=>JS[n],tB={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},nB={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},iB={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},rB={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},oB={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},sB={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},aB={ordinalNumber:(n,e)=>{const i=Number(n),r=i%100;if(r>20||r<10)switch(r%10){case 1:return i+"st";case 2:return i+"nd";case 3:return i+"rd"}return i+"th"},era:Zr({values:tB,defaultWidth:"wide"}),quarter:Zr({values:nB,defaultWidth:"wide",argumentCallback:n=>n-1}),month:Zr({values:iB,defaultWidth:"wide"}),day:Zr({values:rB,defaultWidth:"wide"}),dayPeriod:Zr({values:oB,defaultWidth:"wide",formattingValues:sB,defaultFormattingWidth:"wide"})},lB=/^(\d+)(th|st|nd|rd)?/i,cB=/\d+/i,dB={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},uB={any:[/^b/i,/^(a|c)/i]},fB={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},hB={any:[/1/i,/2/i,/3/i,/4/i]},mB={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},pB={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},gB={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},yB={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},bB={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},_B={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},wB={ordinalNumber:GS({matchPattern:lB,parsePattern:cB,valueCallback:n=>parseInt(n,10)}),era:Qr({matchPatterns:dB,defaultMatchWidth:"wide",parsePatterns:uB,defaultParseWidth:"any"}),quarter:Qr({matchPatterns:fB,defaultMatchWidth:"wide",parsePatterns:hB,defaultParseWidth:"any",valueCallback:n=>n+1}),month:Qr({matchPatterns:mB,defaultMatchWidth:"wide",parsePatterns:pB,defaultParseWidth:"any"}),day:Qr({matchPatterns:gB,defaultMatchWidth:"wide",parsePatterns:yB,defaultParseWidth:"any"}),dayPeriod:Qr({matchPatterns:bB,defaultMatchWidth:"any",parsePatterns:_B,defaultParseWidth:"any"})},xB={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},kB={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},CB={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},vB={date:ml({formats:xB,defaultWidth:"full"}),time:ml({formats:kB,defaultWidth:"full"}),dateTime:ml({formats:CB,defaultWidth:"full"})},SB={name:"en-US",locale:{code:"en-US",formatDistance:QS,formatLong:vB,formatRelative:eB,localize:aB,match:wB,options:{weekStartsOn:0,firstWeekContainsDate:1}}};function qh(n){const{mergedLocaleRef:e,mergedDateLocaleRef:i}=t.inject(Di,null)||{},r=t.computed(()=>{var s,a;return(a=(s=e==null?void 0:e.value)===null||s===void 0?void 0:s[n])!==null&&a!==void 0?a:YS[n]});return{dateLocaleRef:t.computed(()=>{var s;return(s=i==null?void 0:i.value)!==null&&s!==void 0?s:SB}),localeRef:r}}const Jr="naive-ui-style";function eo(n,e,i){if(!e)return;const r=Ii(),o=t.computed(()=>{const{value:l}=e;if(!l)return;const c=l[n];if(c)return c}),s=t.inject(Di,null),a=()=>{t.watchEffect(()=>{const{value:l}=i,c=`${l}${n}Rtl`;if(Kv(c,r))return;const{value:d}=o;d&&d.style.mount({id:c,head:!0,anchorMetaName:Jr,props:{bPrefix:l?`.${l}-`:void 0},ssr:r,parent:s==null?void 0:s.styleMountTarget})})};return r?a():t.onBeforeMount(a),o}const to={fontFamily:'v-sans, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',fontFamilyMono:"v-mono, SFMono-Regular, Menlo, Consolas, Courier, monospace",fontWeight:"400",fontWeightStrong:"500",cubicBezierEaseInOut:"cubic-bezier(.4, 0, .2, 1)",cubicBezierEaseOut:"cubic-bezier(0, 0, .2, 1)",cubicBezierEaseIn:"cubic-bezier(.4, 0, 1, 1)",borderRadius:"3px",borderRadiusSmall:"2px",fontSize:"14px",fontSizeMini:"12px",fontSizeTiny:"12px",fontSizeSmall:"14px",fontSizeMedium:"14px",fontSizeLarge:"15px",fontSizeHuge:"16px",lineHeight:"1.6",heightMini:"16px",heightTiny:"22px",heightSmall:"28px",heightMedium:"34px",heightLarge:"40px",heightHuge:"46px"},{fontSize:BB,fontFamily:NB,lineHeight:TB}=to,Xh=pe("body",`
117
117
  margin: 0;
118
118
  font-size: ${BB};
119
119
  font-family: ${NB};
@@ -123,7 +123,7 @@ ${o}
123
123
  `,[pe("input",`
124
124
  font-family: inherit;
125
125
  font-size: inherit;
126
- `)]);var $B={};function _s(n,e,i){if(!e){$B.NODE_ENV!=="production"&&Hh("use-style","No style is specified.");return}const r=Ii(),o=t.inject(Di,null),s=()=>{const a=i.value;e.mount({id:a===void 0?n:a+n,head:!0,anchorMetaName:Jr,props:{bPrefix:a?`.${a}-`:void 0},ssr:r,parent:o==null?void 0:o.styleMountTarget}),o!=null&&o.preflightStyleDisabled||Xh.mount({id:"n-global",head:!0,anchorMetaName:Jr,ssr:r,parent:o==null?void 0:o.styleMountTarget})};r?s():t.onBeforeMount(s)}function OT(n){return n}function Rt(n,e,i,r,o,s){const a=Ii(),l=t.inject(Di,null);if(i){const d=()=>{const u=s==null?void 0:s.value;i.mount({id:u===void 0?e:u+e,head:!0,props:{bPrefix:u?`.${u}-`:void 0},anchorMetaName:Jr,ssr:a,parent:l==null?void 0:l.styleMountTarget}),l!=null&&l.preflightStyleDisabled||Xh.mount({id:"n-global",head:!0,anchorMetaName:Jr,ssr:a,parent:l==null?void 0:l.styleMountTarget})};a?d():t.onBeforeMount(d)}return t.computed(()=>{var d;const{theme:{common:u,self:f,peers:h={}}={},themeOverrides:p={},builtinThemeOverrides:m={}}=o,{common:g,peers:b}=p,{common:y=void 0,[n]:{common:_=void 0,self:x=void 0,peers:w={}}={}}=(l==null?void 0:l.mergedThemeRef.value)||{},{common:C=void 0,[n]:N={}}=(l==null?void 0:l.mergedThemeOverridesRef.value)||{},{common:k,peers:$={}}=N,v=V.merge({},u||_||y||r.common,C,k,g),E=V.merge((d=f||x||r.self)===null||d===void 0?void 0:d(v),m,N,p);return{common:v,self:E,peers:V.merge({},r.peers,w,h),peerOverrides:V.merge({},m.peers,$,b)}})}Rt.props={theme:Object,themeOverrides:Object,builtinThemeOverrides:Object};const EB=ke("base-icon",`
126
+ `)]);var $B={};function _s(n,e,i){if(!e){$B.NODE_ENV!=="production"&&Hh("use-style","No style is specified.");return}const r=Ii(),o=t.inject(Di,null),s=()=>{const a=i.value;e.mount({id:a===void 0?n:a+n,head:!0,anchorMetaName:Jr,props:{bPrefix:a?`.${a}-`:void 0},ssr:r,parent:o==null?void 0:o.styleMountTarget}),o!=null&&o.preflightStyleDisabled||Xh.mount({id:"n-global",head:!0,anchorMetaName:Jr,ssr:r,parent:o==null?void 0:o.styleMountTarget})};r?s():t.onBeforeMount(s)}function DT(n){return n}function Rt(n,e,i,r,o,s){const a=Ii(),l=t.inject(Di,null);if(i){const d=()=>{const u=s==null?void 0:s.value;i.mount({id:u===void 0?e:u+e,head:!0,props:{bPrefix:u?`.${u}-`:void 0},anchorMetaName:Jr,ssr:a,parent:l==null?void 0:l.styleMountTarget}),l!=null&&l.preflightStyleDisabled||Xh.mount({id:"n-global",head:!0,anchorMetaName:Jr,ssr:a,parent:l==null?void 0:l.styleMountTarget})};a?d():t.onBeforeMount(d)}return t.computed(()=>{var d;const{theme:{common:u,self:f,peers:h={}}={},themeOverrides:p={},builtinThemeOverrides:m={}}=o,{common:g,peers:b}=p,{common:y=void 0,[n]:{common:_=void 0,self:x=void 0,peers:w={}}={}}=(l==null?void 0:l.mergedThemeRef.value)||{},{common:C=void 0,[n]:N={}}=(l==null?void 0:l.mergedThemeOverridesRef.value)||{},{common:k,peers:$={}}=N,v=V.merge({},u||_||y||r.common,C,k,g),E=V.merge((d=f||x||r.self)===null||d===void 0?void 0:d(v),m,N,p);return{common:v,self:E,peers:V.merge({},r.peers,w,h),peerOverrides:V.merge({},m.peers,$,b)}})}Rt.props={theme:Object,themeOverrides:Object,builtinThemeOverrides:Object};const EB=ke("base-icon",`
127
127
  height: 1em;
128
128
  width: 1em;
129
129
  line-height: 1em;
@@ -294,7 +294,7 @@ ${o}
294
294
  pointer-events: all;
295
295
  background-color: var(--n-scrollbar-color);
296
296
  transition: background-color .2s var(--n-scrollbar-bezier);
297
- `,[jB(),pe("&:hover","background-color: var(--n-scrollbar-color-hover);")])])])])]),GB=Object.assign(Object.assign({},Rt.props),{duration:{type:Number,default:0},scrollable:{type:Boolean,default:!0},xScrollable:Boolean,trigger:{type:String,default:"hover"},useUnifiedContainer:Boolean,triggerDisplayManually:Boolean,container:Function,content:Function,containerClass:String,containerStyle:[String,Object],contentClass:[String,Array],contentStyle:[String,Object],horizontalRailStyle:[String,Object],verticalRailStyle:[String,Object],onScroll:Function,onWheel:Function,onResize:Function,internalOnUpdateScrollLeft:Function,internalHoistYRail:Boolean,yPlacement:{type:String,default:"right"},xPlacement:{type:String,default:"bottom"}}),Jh=t.defineComponent({name:"Scrollbar",props:GB,inheritAttrs:!1,setup(n){const{mergedClsPrefixRef:e,inlineThemeDisabled:i,mergedRtlRef:r}=Li(n),o=eo("Scrollbar",r,e),s=t.ref(null),a=t.ref(null),l=t.ref(null),c=t.ref(null),d=t.ref(null),u=t.ref(null),f=t.ref(null),h=t.ref(null),p=t.ref(null),m=t.ref(null),g=t.ref(null),b=t.ref(0),y=t.ref(0),_=t.ref(!1),x=t.ref(!1);let w=!1,C=!1,N,k,$=0,v=0,E=0,P=0;const F=Bv(),R=Rt("Scrollbar","-scrollbar",KB,yl,n,e),M=t.computed(()=>{const{value:z}=h,{value:Q}=u,{value:se}=m;return z===null||Q===null||se===null?0:Math.min(z,se*z/Q+jr(R.value.self.width)*1.5)}),X=t.computed(()=>`${M.value}px`),G=t.computed(()=>{const{value:z}=p,{value:Q}=f,{value:se}=g;return z===null||Q===null||se===null?0:se*z/Q+jr(R.value.self.height)*1.5}),Z=t.computed(()=>`${G.value}px`),O=t.computed(()=>{const{value:z}=h,{value:Q}=b,{value:se}=u,{value:ye}=m;if(z===null||se===null||ye===null)return 0;{const we=se-z;return we?Q/we*(ye-M.value):0}}),A=t.computed(()=>`${O.value}px`),Y=t.computed(()=>{const{value:z}=p,{value:Q}=y,{value:se}=f,{value:ye}=g;if(z===null||se===null||ye===null)return 0;{const we=se-z;return we?Q/we*(ye-G.value):0}}),H=t.computed(()=>`${Y.value}px`),T=t.computed(()=>{const{value:z}=h,{value:Q}=u;return z!==null&&Q!==null&&Q>z}),D=t.computed(()=>{const{value:z}=p,{value:Q}=f;return z!==null&&Q!==null&&Q>z}),K=t.computed(()=>{const{trigger:z}=n;return z==="none"||_.value}),J=t.computed(()=>{const{trigger:z}=n;return z==="none"||x.value}),U=t.computed(()=>{const{container:z}=n;return z?z():a.value}),q=t.computed(()=>{const{content:z}=n;return z?z():l.value}),L=(z,Q)=>{if(!n.scrollable)return;if(typeof z=="number"){ge(z,Q??0,0,!1,"auto");return}const{left:se,top:ye,index:we,elSize:Ce,position:Ne,behavior:$e,el:rt,debounce:Hn=!0}=z;(se!==void 0||ye!==void 0)&&ge(se??0,ye??0,0,!1,$e),rt!==void 0?ge(0,rt.offsetTop,rt.offsetHeight,Hn,$e):we!==void 0&&Ce!==void 0?ge(0,we*Ce,Ce,Hn,$e):Ne==="bottom"?ge(0,Number.MAX_SAFE_INTEGER,0,!1,$e):Ne==="top"&&ge(0,0,0,!1,$e)},le=FS(()=>{n.container||L({top:b.value,left:y.value})}),ue=()=>{le.isDeactivated||de()},oe=z=>{if(le.isDeactivated)return;const{onResize:Q}=n;Q&&Q(z),de()},fe=(z,Q)=>{if(!n.scrollable)return;const{value:se}=U;se&&(typeof z=="object"?se.scrollBy(z):se.scrollBy(z,Q||0))};function ge(z,Q,se,ye,we){const{value:Ce}=U;if(Ce){if(ye){const{scrollTop:Ne,offsetHeight:$e}=Ce;if(Q>Ne){Q+se<=Ne+$e||Ce.scrollTo({left:z,top:Q+se-$e,behavior:we});return}}Ce.scrollTo({left:z,top:Q,behavior:we})}}function _e(){It(),en(),de()}function Qe(){Re()}function Re(){Mt(),vn()}function Mt(){k!==void 0&&window.clearTimeout(k),k=window.setTimeout(()=>{x.value=!1},n.duration)}function vn(){N!==void 0&&window.clearTimeout(N),N=window.setTimeout(()=>{_.value=!1},n.duration)}function It(){N!==void 0&&window.clearTimeout(N),_.value=!0}function en(){k!==void 0&&window.clearTimeout(k),x.value=!0}function Ln(z){const{onScroll:Q}=n;Q&&Q(z),mn()}function mn(){const{value:z}=U;z&&(b.value=z.scrollTop,y.value=z.scrollLeft*(o!=null&&o.value?-1:1))}function _t(){const{value:z}=q;z&&(u.value=z.offsetHeight,f.value=z.offsetWidth);const{value:Q}=U;Q&&(h.value=Q.offsetHeight,p.value=Q.offsetWidth);const{value:se}=d,{value:ye}=c;se&&(g.value=se.offsetWidth),ye&&(m.value=ye.offsetHeight)}function ae(){const{value:z}=U;z&&(b.value=z.scrollTop,y.value=z.scrollLeft*(o!=null&&o.value?-1:1),h.value=z.offsetHeight,p.value=z.offsetWidth,u.value=z.scrollHeight,f.value=z.scrollWidth);const{value:Q}=d,{value:se}=c;Q&&(g.value=Q.offsetWidth),se&&(m.value=se.offsetHeight)}function de(){n.scrollable&&(n.useUnifiedContainer?ae():(_t(),mn()))}function Ge(z){var Q;return!(!((Q=s.value)===null||Q===void 0)&&Q.contains(Wr(z)))}function Ui(z){z.preventDefault(),z.stopPropagation(),C=!0,Lt("mousemove",window,oi,!0),Lt("mouseup",window,si,!0),v=y.value,E=o!=null&&o.value?window.innerWidth-z.clientX:z.clientX}function oi(z){if(!C)return;N!==void 0&&window.clearTimeout(N),k!==void 0&&window.clearTimeout(k);const{value:Q}=p,{value:se}=f,{value:ye}=G;if(Q===null||se===null)return;const Ce=(o!=null&&o.value?window.innerWidth-z.clientX-E:z.clientX-E)*(se-Q)/(Q-ye),Ne=se-Q;let $e=v+Ce;$e=Math.min(Ne,$e),$e=Math.max($e,0);const{value:rt}=U;if(rt){rt.scrollLeft=$e*(o!=null&&o.value?-1:1);const{internalOnUpdateScrollLeft:Hn}=n;Hn&&Hn($e)}}function si(z){z.preventDefault(),z.stopPropagation(),yt("mousemove",window,oi,!0),yt("mouseup",window,si,!0),C=!1,de(),Ge(z)&&Re()}function at(z){z.preventDefault(),z.stopPropagation(),w=!0,Lt("mousemove",window,qe,!0),Lt("mouseup",window,on,!0),$=b.value,P=z.clientY}function qe(z){if(!w)return;N!==void 0&&window.clearTimeout(N),k!==void 0&&window.clearTimeout(k);const{value:Q}=h,{value:se}=u,{value:ye}=M;if(Q===null||se===null)return;const Ce=(z.clientY-P)*(se-Q)/(Q-ye),Ne=se-Q;let $e=$+Ce;$e=Math.min(Ne,$e),$e=Math.max($e,0);const{value:rt}=U;rt&&(rt.scrollTop=$e)}function on(z){z.preventDefault(),z.stopPropagation(),yt("mousemove",window,qe,!0),yt("mouseup",window,on,!0),w=!1,de(),Ge(z)&&Re()}t.watchEffect(()=>{const{value:z}=D,{value:Q}=T,{value:se}=e,{value:ye}=d,{value:we}=c;ye&&(z?ye.classList.remove(`${se}-scrollbar-rail--disabled`):ye.classList.add(`${se}-scrollbar-rail--disabled`)),we&&(Q?we.classList.remove(`${se}-scrollbar-rail--disabled`):we.classList.add(`${se}-scrollbar-rail--disabled`))}),t.onMounted(()=>{n.container||de()}),t.onBeforeUnmount(()=>{N!==void 0&&window.clearTimeout(N),k!==void 0&&window.clearTimeout(k),yt("mousemove",window,qe,!0),yt("mouseup",window,on,!0)});const sn=t.computed(()=>{const{common:{cubicBezierEaseInOut:z},self:{color:Q,colorHover:se,height:ye,width:we,borderRadius:Ce,railInsetHorizontalTop:Ne,railInsetHorizontalBottom:$e,railInsetVerticalRight:rt,railInsetVerticalLeft:Hn,railColor:Bl}}=R.value,{top:Nl,right:Tl,bottom:$l,left:El}=xn(Ne),{top:Rl,right:Pl,bottom:Fl,left:Vl}=xn($e),{top:Ml,right:Il,bottom:Al,left:Ol}=xn(o!=null&&o.value?Mh(rt):rt),{top:zl,right:Dl,bottom:Ll,left:Hl}=xn(o!=null&&o.value?Mh(Hn):Hn);return{"--n-scrollbar-bezier":z,"--n-scrollbar-color":Q,"--n-scrollbar-color-hover":se,"--n-scrollbar-border-radius":Ce,"--n-scrollbar-width":we,"--n-scrollbar-height":ye,"--n-scrollbar-rail-top-horizontal-top":Nl,"--n-scrollbar-rail-right-horizontal-top":Tl,"--n-scrollbar-rail-bottom-horizontal-top":$l,"--n-scrollbar-rail-left-horizontal-top":El,"--n-scrollbar-rail-top-horizontal-bottom":Rl,"--n-scrollbar-rail-right-horizontal-bottom":Pl,"--n-scrollbar-rail-bottom-horizontal-bottom":Fl,"--n-scrollbar-rail-left-horizontal-bottom":Vl,"--n-scrollbar-rail-top-vertical-right":Ml,"--n-scrollbar-rail-right-vertical-right":Il,"--n-scrollbar-rail-bottom-vertical-right":Al,"--n-scrollbar-rail-left-vertical-right":Ol,"--n-scrollbar-rail-top-vertical-left":zl,"--n-scrollbar-rail-right-vertical-left":Dl,"--n-scrollbar-rail-bottom-vertical-left":Ll,"--n-scrollbar-rail-left-vertical-left":Hl,"--n-scrollbar-rail-color":Bl}}),lt=i?Hi("scrollbar",void 0,sn,n):void 0;return Object.assign(Object.assign({},{scrollTo:L,scrollBy:fe,sync:de,syncUnifiedContainer:ae,handleMouseEnterWrapper:_e,handleMouseLeaveWrapper:Qe}),{mergedClsPrefix:e,rtlEnabled:o,containerScrollTop:b,wrapperRef:s,containerRef:a,contentRef:l,yRailRef:c,xRailRef:d,needYBar:T,needXBar:D,yBarSizePx:X,xBarSizePx:Z,yBarTopPx:A,xBarLeftPx:H,isShowXBar:K,isShowYBar:J,isIos:F,handleScroll:Ln,handleContentResize:ue,handleContainerResize:oe,handleYScrollMouseDown:at,handleXScrollMouseDown:Ui,cssVars:i?void 0:sn,themeClass:lt==null?void 0:lt.themeClass,onRender:lt==null?void 0:lt.onRender})},render(){var n;const{$slots:e,mergedClsPrefix:i,triggerDisplayManually:r,rtlEnabled:o,internalHoistYRail:s,yPlacement:a,xPlacement:l,xScrollable:c}=this;if(!this.scrollable)return(n=e.default)===null||n===void 0?void 0:n.call(e);const d=this.trigger==="none",u=(p,m)=>t.h("div",{ref:"yRailRef",class:[`${i}-scrollbar-rail`,`${i}-scrollbar-rail--vertical`,`${i}-scrollbar-rail--vertical--${a}`,p],"data-scrollbar-rail":!0,style:[m||"",this.verticalRailStyle],"aria-hidden":!0},t.h(d?hl:t.Transition,d?null:{name:"fade-in-transition"},{default:()=>this.needYBar&&this.isShowYBar&&!this.isIos?t.h("div",{class:`${i}-scrollbar-rail__scrollbar`,style:{height:this.yBarSizePx,top:this.yBarTopPx},onMousedown:this.handleYScrollMouseDown}):null})),f=()=>{var p,m;return(p=this.onRender)===null||p===void 0||p.call(this),t.h("div",t.mergeProps(this.$attrs,{role:"none",ref:"wrapperRef",class:[`${i}-scrollbar`,this.themeClass,o&&`${i}-scrollbar--rtl`],style:this.cssVars,onMouseenter:r?void 0:this.handleMouseEnterWrapper,onMouseleave:r?void 0:this.handleMouseLeaveWrapper}),[this.container?(m=e.default)===null||m===void 0?void 0:m.call(e):t.h("div",{role:"none",ref:"containerRef",class:[`${i}-scrollbar-container`,this.containerClass],style:this.containerStyle,onScroll:this.handleScroll,onWheel:this.onWheel},t.h(gs,{onResize:this.handleContentResize},{default:()=>t.h("div",{ref:"contentRef",role:"none",style:[{width:this.xScrollable?"fit-content":null},this.contentStyle],class:[`${i}-scrollbar-content`,this.contentClass]},e)})),s?null:u(void 0,void 0),c&&t.h("div",{ref:"xRailRef",class:[`${i}-scrollbar-rail`,`${i}-scrollbar-rail--horizontal`,`${i}-scrollbar-rail--horizontal--${l}`],style:this.horizontalRailStyle,"data-scrollbar-rail":!0,"aria-hidden":!0},t.h(d?hl:t.Transition,d?null:{name:"fade-in-transition"},{default:()=>this.needXBar&&this.isShowXBar&&!this.isIos?t.h("div",{class:`${i}-scrollbar-rail__scrollbar`,style:{width:this.xBarSizePx,right:o?this.xBarLeftPx:void 0,left:o?void 0:this.xBarLeftPx},onMousedown:this.handleXScrollMouseDown}):null}))])},h=this.container?f():t.h(gs,{onResize:this.handleContainerResize},{default:f});return s?t.h(t.Fragment,null,h,u(this.themeClass,this.cssVars)):h}}),ZB=Jh,QB={iconSizeTiny:"28px",iconSizeSmall:"34px",iconSizeMedium:"40px",iconSizeLarge:"46px",iconSizeHuge:"52px"};function JB(n){const{textColorDisabled:e,iconColor:i,textColor2:r,fontSizeTiny:o,fontSizeSmall:s,fontSizeMedium:a,fontSizeLarge:l,fontSizeHuge:c}=n;return Object.assign(Object.assign({},QB),{fontSizeTiny:o,fontSizeSmall:s,fontSizeMedium:a,fontSizeLarge:l,fontSizeHuge:c,textColor:e,iconColor:i,extraTextColor:r})}const em={name:"Empty",common:Wi,self:JB},e5=ke("empty",`
297
+ `,[jB(),pe("&:hover","background-color: var(--n-scrollbar-color-hover);")])])])])]),GB=Object.assign(Object.assign({},Rt.props),{duration:{type:Number,default:0},scrollable:{type:Boolean,default:!0},xScrollable:Boolean,trigger:{type:String,default:"hover"},useUnifiedContainer:Boolean,triggerDisplayManually:Boolean,container:Function,content:Function,containerClass:String,containerStyle:[String,Object],contentClass:[String,Array],contentStyle:[String,Object],horizontalRailStyle:[String,Object],verticalRailStyle:[String,Object],onScroll:Function,onWheel:Function,onResize:Function,internalOnUpdateScrollLeft:Function,internalHoistYRail:Boolean,yPlacement:{type:String,default:"right"},xPlacement:{type:String,default:"bottom"}}),Jh=t.defineComponent({name:"Scrollbar",props:GB,inheritAttrs:!1,setup(n){const{mergedClsPrefixRef:e,inlineThemeDisabled:i,mergedRtlRef:r}=Li(n),o=eo("Scrollbar",r,e),s=t.ref(null),a=t.ref(null),l=t.ref(null),c=t.ref(null),d=t.ref(null),u=t.ref(null),f=t.ref(null),h=t.ref(null),p=t.ref(null),m=t.ref(null),g=t.ref(null),b=t.ref(0),y=t.ref(0),_=t.ref(!1),x=t.ref(!1);let w=!1,C=!1,N,k,$=0,v=0,E=0,P=0;const F=Bv(),R=Rt("Scrollbar","-scrollbar",KB,yl,n,e),M=t.computed(()=>{const{value:z}=h,{value:Q}=u,{value:se}=m;return z===null||Q===null||se===null?0:Math.min(z,se*z/Q+jr(R.value.self.width)*1.5)}),X=t.computed(()=>`${M.value}px`),G=t.computed(()=>{const{value:z}=p,{value:Q}=f,{value:se}=g;return z===null||Q===null||se===null?0:se*z/Q+jr(R.value.self.height)*1.5}),Z=t.computed(()=>`${G.value}px`),O=t.computed(()=>{const{value:z}=h,{value:Q}=b,{value:se}=u,{value:ye}=m;if(z===null||se===null||ye===null)return 0;{const we=se-z;return we?Q/we*(ye-M.value):0}}),A=t.computed(()=>`${O.value}px`),Y=t.computed(()=>{const{value:z}=p,{value:Q}=y,{value:se}=f,{value:ye}=g;if(z===null||se===null||ye===null)return 0;{const we=se-z;return we?Q/we*(ye-G.value):0}}),H=t.computed(()=>`${Y.value}px`),T=t.computed(()=>{const{value:z}=h,{value:Q}=u;return z!==null&&Q!==null&&Q>z}),D=t.computed(()=>{const{value:z}=p,{value:Q}=f;return z!==null&&Q!==null&&Q>z}),K=t.computed(()=>{const{trigger:z}=n;return z==="none"||_.value}),J=t.computed(()=>{const{trigger:z}=n;return z==="none"||x.value}),U=t.computed(()=>{const{container:z}=n;return z?z():a.value}),q=t.computed(()=>{const{content:z}=n;return z?z():l.value}),L=(z,Q)=>{if(!n.scrollable)return;if(typeof z=="number"){ge(z,Q??0,0,!1,"auto");return}const{left:se,top:ye,index:we,elSize:Ce,position:Ne,behavior:$e,el:rt,debounce:Hn=!0}=z;(se!==void 0||ye!==void 0)&&ge(se??0,ye??0,0,!1,$e),rt!==void 0?ge(0,rt.offsetTop,rt.offsetHeight,Hn,$e):we!==void 0&&Ce!==void 0?ge(0,we*Ce,Ce,Hn,$e):Ne==="bottom"?ge(0,Number.MAX_SAFE_INTEGER,0,!1,$e):Ne==="top"&&ge(0,0,0,!1,$e)},le=FS(()=>{n.container||L({top:b.value,left:y.value})}),ue=()=>{le.isDeactivated||de()},oe=z=>{if(le.isDeactivated)return;const{onResize:Q}=n;Q&&Q(z),de()},fe=(z,Q)=>{if(!n.scrollable)return;const{value:se}=U;se&&(typeof z=="object"?se.scrollBy(z):se.scrollBy(z,Q||0))};function ge(z,Q,se,ye,we){const{value:Ce}=U;if(Ce){if(ye){const{scrollTop:Ne,offsetHeight:$e}=Ce;if(Q>Ne){Q+se<=Ne+$e||Ce.scrollTo({left:z,top:Q+se-$e,behavior:we});return}}Ce.scrollTo({left:z,top:Q,behavior:we})}}function _e(){It(),en(),de()}function Qe(){Re()}function Re(){Mt(),vn()}function Mt(){k!==void 0&&window.clearTimeout(k),k=window.setTimeout(()=>{x.value=!1},n.duration)}function vn(){N!==void 0&&window.clearTimeout(N),N=window.setTimeout(()=>{_.value=!1},n.duration)}function It(){N!==void 0&&window.clearTimeout(N),_.value=!0}function en(){k!==void 0&&window.clearTimeout(k),x.value=!0}function Ln(z){const{onScroll:Q}=n;Q&&Q(z),pn()}function pn(){const{value:z}=U;z&&(b.value=z.scrollTop,y.value=z.scrollLeft*(o!=null&&o.value?-1:1))}function _t(){const{value:z}=q;z&&(u.value=z.offsetHeight,f.value=z.offsetWidth);const{value:Q}=U;Q&&(h.value=Q.offsetHeight,p.value=Q.offsetWidth);const{value:se}=d,{value:ye}=c;se&&(g.value=se.offsetWidth),ye&&(m.value=ye.offsetHeight)}function ae(){const{value:z}=U;z&&(b.value=z.scrollTop,y.value=z.scrollLeft*(o!=null&&o.value?-1:1),h.value=z.offsetHeight,p.value=z.offsetWidth,u.value=z.scrollHeight,f.value=z.scrollWidth);const{value:Q}=d,{value:se}=c;Q&&(g.value=Q.offsetWidth),se&&(m.value=se.offsetHeight)}function de(){n.scrollable&&(n.useUnifiedContainer?ae():(_t(),pn()))}function Ge(z){var Q;return!(!((Q=s.value)===null||Q===void 0)&&Q.contains(Wr(z)))}function Ui(z){z.preventDefault(),z.stopPropagation(),C=!0,Lt("mousemove",window,oi,!0),Lt("mouseup",window,si,!0),v=y.value,E=o!=null&&o.value?window.innerWidth-z.clientX:z.clientX}function oi(z){if(!C)return;N!==void 0&&window.clearTimeout(N),k!==void 0&&window.clearTimeout(k);const{value:Q}=p,{value:se}=f,{value:ye}=G;if(Q===null||se===null)return;const Ce=(o!=null&&o.value?window.innerWidth-z.clientX-E:z.clientX-E)*(se-Q)/(Q-ye),Ne=se-Q;let $e=v+Ce;$e=Math.min(Ne,$e),$e=Math.max($e,0);const{value:rt}=U;if(rt){rt.scrollLeft=$e*(o!=null&&o.value?-1:1);const{internalOnUpdateScrollLeft:Hn}=n;Hn&&Hn($e)}}function si(z){z.preventDefault(),z.stopPropagation(),yt("mousemove",window,oi,!0),yt("mouseup",window,si,!0),C=!1,de(),Ge(z)&&Re()}function at(z){z.preventDefault(),z.stopPropagation(),w=!0,Lt("mousemove",window,qe,!0),Lt("mouseup",window,on,!0),$=b.value,P=z.clientY}function qe(z){if(!w)return;N!==void 0&&window.clearTimeout(N),k!==void 0&&window.clearTimeout(k);const{value:Q}=h,{value:se}=u,{value:ye}=M;if(Q===null||se===null)return;const Ce=(z.clientY-P)*(se-Q)/(Q-ye),Ne=se-Q;let $e=$+Ce;$e=Math.min(Ne,$e),$e=Math.max($e,0);const{value:rt}=U;rt&&(rt.scrollTop=$e)}function on(z){z.preventDefault(),z.stopPropagation(),yt("mousemove",window,qe,!0),yt("mouseup",window,on,!0),w=!1,de(),Ge(z)&&Re()}t.watchEffect(()=>{const{value:z}=D,{value:Q}=T,{value:se}=e,{value:ye}=d,{value:we}=c;ye&&(z?ye.classList.remove(`${se}-scrollbar-rail--disabled`):ye.classList.add(`${se}-scrollbar-rail--disabled`)),we&&(Q?we.classList.remove(`${se}-scrollbar-rail--disabled`):we.classList.add(`${se}-scrollbar-rail--disabled`))}),t.onMounted(()=>{n.container||de()}),t.onBeforeUnmount(()=>{N!==void 0&&window.clearTimeout(N),k!==void 0&&window.clearTimeout(k),yt("mousemove",window,qe,!0),yt("mouseup",window,on,!0)});const sn=t.computed(()=>{const{common:{cubicBezierEaseInOut:z},self:{color:Q,colorHover:se,height:ye,width:we,borderRadius:Ce,railInsetHorizontalTop:Ne,railInsetHorizontalBottom:$e,railInsetVerticalRight:rt,railInsetVerticalLeft:Hn,railColor:Bl}}=R.value,{top:Nl,right:Tl,bottom:$l,left:El}=xn(Ne),{top:Rl,right:Pl,bottom:Fl,left:Vl}=xn($e),{top:Ml,right:Il,bottom:Al,left:Ol}=xn(o!=null&&o.value?Mh(rt):rt),{top:zl,right:Dl,bottom:Ll,left:Hl}=xn(o!=null&&o.value?Mh(Hn):Hn);return{"--n-scrollbar-bezier":z,"--n-scrollbar-color":Q,"--n-scrollbar-color-hover":se,"--n-scrollbar-border-radius":Ce,"--n-scrollbar-width":we,"--n-scrollbar-height":ye,"--n-scrollbar-rail-top-horizontal-top":Nl,"--n-scrollbar-rail-right-horizontal-top":Tl,"--n-scrollbar-rail-bottom-horizontal-top":$l,"--n-scrollbar-rail-left-horizontal-top":El,"--n-scrollbar-rail-top-horizontal-bottom":Rl,"--n-scrollbar-rail-right-horizontal-bottom":Pl,"--n-scrollbar-rail-bottom-horizontal-bottom":Fl,"--n-scrollbar-rail-left-horizontal-bottom":Vl,"--n-scrollbar-rail-top-vertical-right":Ml,"--n-scrollbar-rail-right-vertical-right":Il,"--n-scrollbar-rail-bottom-vertical-right":Al,"--n-scrollbar-rail-left-vertical-right":Ol,"--n-scrollbar-rail-top-vertical-left":zl,"--n-scrollbar-rail-right-vertical-left":Dl,"--n-scrollbar-rail-bottom-vertical-left":Ll,"--n-scrollbar-rail-left-vertical-left":Hl,"--n-scrollbar-rail-color":Bl}}),lt=i?Hi("scrollbar",void 0,sn,n):void 0;return Object.assign(Object.assign({},{scrollTo:L,scrollBy:fe,sync:de,syncUnifiedContainer:ae,handleMouseEnterWrapper:_e,handleMouseLeaveWrapper:Qe}),{mergedClsPrefix:e,rtlEnabled:o,containerScrollTop:b,wrapperRef:s,containerRef:a,contentRef:l,yRailRef:c,xRailRef:d,needYBar:T,needXBar:D,yBarSizePx:X,xBarSizePx:Z,yBarTopPx:A,xBarLeftPx:H,isShowXBar:K,isShowYBar:J,isIos:F,handleScroll:Ln,handleContentResize:ue,handleContainerResize:oe,handleYScrollMouseDown:at,handleXScrollMouseDown:Ui,cssVars:i?void 0:sn,themeClass:lt==null?void 0:lt.themeClass,onRender:lt==null?void 0:lt.onRender})},render(){var n;const{$slots:e,mergedClsPrefix:i,triggerDisplayManually:r,rtlEnabled:o,internalHoistYRail:s,yPlacement:a,xPlacement:l,xScrollable:c}=this;if(!this.scrollable)return(n=e.default)===null||n===void 0?void 0:n.call(e);const d=this.trigger==="none",u=(p,m)=>t.h("div",{ref:"yRailRef",class:[`${i}-scrollbar-rail`,`${i}-scrollbar-rail--vertical`,`${i}-scrollbar-rail--vertical--${a}`,p],"data-scrollbar-rail":!0,style:[m||"",this.verticalRailStyle],"aria-hidden":!0},t.h(d?hl:t.Transition,d?null:{name:"fade-in-transition"},{default:()=>this.needYBar&&this.isShowYBar&&!this.isIos?t.h("div",{class:`${i}-scrollbar-rail__scrollbar`,style:{height:this.yBarSizePx,top:this.yBarTopPx},onMousedown:this.handleYScrollMouseDown}):null})),f=()=>{var p,m;return(p=this.onRender)===null||p===void 0||p.call(this),t.h("div",t.mergeProps(this.$attrs,{role:"none",ref:"wrapperRef",class:[`${i}-scrollbar`,this.themeClass,o&&`${i}-scrollbar--rtl`],style:this.cssVars,onMouseenter:r?void 0:this.handleMouseEnterWrapper,onMouseleave:r?void 0:this.handleMouseLeaveWrapper}),[this.container?(m=e.default)===null||m===void 0?void 0:m.call(e):t.h("div",{role:"none",ref:"containerRef",class:[`${i}-scrollbar-container`,this.containerClass],style:this.containerStyle,onScroll:this.handleScroll,onWheel:this.onWheel},t.h(gs,{onResize:this.handleContentResize},{default:()=>t.h("div",{ref:"contentRef",role:"none",style:[{width:this.xScrollable?"fit-content":null},this.contentStyle],class:[`${i}-scrollbar-content`,this.contentClass]},e)})),s?null:u(void 0,void 0),c&&t.h("div",{ref:"xRailRef",class:[`${i}-scrollbar-rail`,`${i}-scrollbar-rail--horizontal`,`${i}-scrollbar-rail--horizontal--${l}`],style:this.horizontalRailStyle,"data-scrollbar-rail":!0,"aria-hidden":!0},t.h(d?hl:t.Transition,d?null:{name:"fade-in-transition"},{default:()=>this.needXBar&&this.isShowXBar&&!this.isIos?t.h("div",{class:`${i}-scrollbar-rail__scrollbar`,style:{width:this.xBarSizePx,right:o?this.xBarLeftPx:void 0,left:o?void 0:this.xBarLeftPx},onMousedown:this.handleXScrollMouseDown}):null}))])},h=this.container?f():t.h(gs,{onResize:this.handleContainerResize},{default:f});return s?t.h(t.Fragment,null,h,u(this.themeClass,this.cssVars)):h}}),ZB=Jh,QB={iconSizeTiny:"28px",iconSizeSmall:"34px",iconSizeMedium:"40px",iconSizeLarge:"46px",iconSizeHuge:"52px"};function JB(n){const{textColorDisabled:e,iconColor:i,textColor2:r,fontSizeTiny:o,fontSizeSmall:s,fontSizeMedium:a,fontSizeLarge:l,fontSizeHuge:c}=n;return Object.assign(Object.assign({},QB),{fontSizeTiny:o,fontSizeSmall:s,fontSizeMedium:a,fontSizeLarge:l,fontSizeHuge:c,textColor:e,iconColor:i,extraTextColor:r})}const em={name:"Empty",common:Wi,self:JB},e5=ke("empty",`
298
298
  display: flex;
299
299
  flex-direction: column;
300
300
  align-items: center;
@@ -317,7 +317,7 @@ ${o}
317
317
  transition: color .3s var(--n-bezier);
318
318
  margin-top: 12px;
319
319
  color: var(--n-extra-text-color);
320
- `)]),t5=Object.assign(Object.assign({},Rt.props),{description:String,showDescription:{type:Boolean,default:!0},showIcon:{type:Boolean,default:!0},size:{type:String,default:"medium"},renderIcon:Function}),n5=t.defineComponent({name:"Empty",props:t5,slots:Object,setup(n){const{mergedClsPrefixRef:e,inlineThemeDisabled:i,mergedComponentPropsRef:r}=Li(n),o=Rt("Empty","-empty",e5,em,n,e),{localeRef:s}=qh("Empty"),a=t.computed(()=>{var u,f,h;return(u=n.description)!==null&&u!==void 0?u:(h=(f=r==null?void 0:r.value)===null||f===void 0?void 0:f.Empty)===null||h===void 0?void 0:h.description}),l=t.computed(()=>{var u,f;return((f=(u=r==null?void 0:r.value)===null||u===void 0?void 0:u.Empty)===null||f===void 0?void 0:f.renderIcon)||(()=>t.h(MB,null))}),c=t.computed(()=>{const{size:u}=n,{common:{cubicBezierEaseInOut:f},self:{[st("iconSize",u)]:h,[st("fontSize",u)]:p,textColor:m,iconColor:g,extraTextColor:b}}=o.value;return{"--n-icon-size":h,"--n-font-size":p,"--n-bezier":f,"--n-text-color":m,"--n-icon-color":g,"--n-extra-text-color":b}}),d=i?Hi("empty",t.computed(()=>{let u="";const{size:f}=n;return u+=f[0],u}),c,n):void 0;return{mergedClsPrefix:e,mergedRenderIcon:l,localizedDescription:t.computed(()=>a.value||s.value.description),cssVars:i?void 0:c,themeClass:d==null?void 0:d.themeClass,onRender:d==null?void 0:d.onRender}},render(){const{$slots:n,mergedClsPrefix:e,onRender:i}=this;return i==null||i(),t.h("div",{class:[`${e}-empty`,this.themeClass],style:this.cssVars},this.showIcon?t.h("div",{class:`${e}-empty__icon`},n.icon?n.icon():t.h(no,{clsPrefix:e},{default:this.mergedRenderIcon})):null,this.showDescription?t.h("div",{class:`${e}-empty__description`},n.default?n.default():this.localizedDescription):null,n.extra?t.h("div",{class:`${e}-empty__extra`},n.extra()):null)}}),i5={height:"calc(var(--n-option-height) * 7.6)",paddingTiny:"4px 0",paddingSmall:"4px 0",paddingMedium:"4px 0",paddingLarge:"4px 0",paddingHuge:"4px 0",optionPaddingTiny:"0 12px",optionPaddingSmall:"0 12px",optionPaddingMedium:"0 12px",optionPaddingLarge:"0 12px",optionPaddingHuge:"0 12px",loadingSize:"18px"};function r5(n){const{borderRadius:e,popoverColor:i,textColor3:r,dividerColor:o,textColor2:s,primaryColorPressed:a,textColorDisabled:l,primaryColor:c,opacityDisabled:d,hoverColor:u,fontSizeTiny:f,fontSizeSmall:h,fontSizeMedium:p,fontSizeLarge:m,fontSizeHuge:g,heightTiny:b,heightSmall:y,heightMedium:_,heightLarge:x,heightHuge:w}=n;return Object.assign(Object.assign({},i5),{optionFontSizeTiny:f,optionFontSizeSmall:h,optionFontSizeMedium:p,optionFontSizeLarge:m,optionFontSizeHuge:g,optionHeightTiny:b,optionHeightSmall:y,optionHeightMedium:_,optionHeightLarge:x,optionHeightHuge:w,borderRadius:e,color:i,groupHeaderTextColor:r,actionDividerColor:o,optionTextColor:s,optionTextColorPressed:a,optionTextColorDisabled:l,optionTextColorActive:c,optionOpacityDisabled:d,optionCheckColor:c,optionColorPending:u,optionColorActive:"rgba(0, 0, 0, 0)",optionColorActivePending:u,actionTextColor:s,loadingColor:c})}const tm={name:"InternalSelectMenu",common:Wi,peers:{Scrollbar:yl,Empty:em},self:r5},nm=t.defineComponent({name:"NBaseSelectGroupHeader",props:{clsPrefix:{type:String,required:!0},tmNode:{type:Object,required:!0}},setup(){const{renderLabelRef:n,renderOptionRef:e,labelFieldRef:i,nodePropsRef:r}=t.inject(al);return{labelField:i,nodeProps:r,renderLabel:n,renderOption:e}},render(){const{clsPrefix:n,renderLabel:e,renderOption:i,nodeProps:r,tmNode:{rawNode:o}}=this,s=r==null?void 0:r(o),a=e?e(o,!1):Cr(o[this.labelField],o,!1),l=t.h("div",Object.assign({},s,{class:[`${n}-base-select-group-header`,s==null?void 0:s.class]}),a);return o.render?o.render({node:l,option:o}):i?i({node:l,option:o,selected:!1}):l}});function o5(n,e){return t.h(t.Transition,{name:"fade-in-scale-up-transition"},{default:()=>n?t.h(no,{clsPrefix:e,class:`${e}-base-select-option__check`},{default:()=>t.h(RB)}):null})}const im=t.defineComponent({name:"NBaseSelectOption",props:{clsPrefix:{type:String,required:!0},tmNode:{type:Object,required:!0}},setup(n){const{valueRef:e,pendingTmNodeRef:i,multipleRef:r,valueSetRef:o,renderLabelRef:s,renderOptionRef:a,labelFieldRef:l,valueFieldRef:c,showCheckmarkRef:d,nodePropsRef:u,handleOptionClick:f,handleOptionMouseEnter:h}=t.inject(al),p=fn(()=>{const{value:y}=i;return y?n.tmNode.key===y.key:!1});function m(y){const{tmNode:_}=n;_.disabled||f(y,_)}function g(y){const{tmNode:_}=n;_.disabled||h(y,_)}function b(y){const{tmNode:_}=n,{value:x}=p;_.disabled||x||h(y,_)}return{multiple:r,isGrouped:fn(()=>{const{tmNode:y}=n,{parent:_}=y;return _&&_.rawNode.type==="group"}),showCheckmark:d,nodeProps:u,isPending:p,isSelected:fn(()=>{const{value:y}=e,{value:_}=r;if(y===null)return!1;const x=n.tmNode.rawNode[c.value];if(_){const{value:w}=o;return w.has(x)}else return y===x}),labelField:l,renderLabel:s,renderOption:a,handleMouseMove:b,handleMouseEnter:g,handleClick:m}},render(){const{clsPrefix:n,tmNode:{rawNode:e},isSelected:i,isPending:r,isGrouped:o,showCheckmark:s,nodeProps:a,renderOption:l,renderLabel:c,handleClick:d,handleMouseEnter:u,handleMouseMove:f}=this,h=o5(i,n),p=c?[c(e,i),s&&h]:[Cr(e[this.labelField],e,i),s&&h],m=a==null?void 0:a(e),g=t.h("div",Object.assign({},m,{class:[`${n}-base-select-option`,e.class,m==null?void 0:m.class,{[`${n}-base-select-option--disabled`]:e.disabled,[`${n}-base-select-option--selected`]:i,[`${n}-base-select-option--grouped`]:o,[`${n}-base-select-option--pending`]:r,[`${n}-base-select-option--show-checkmark`]:s}],style:[(m==null?void 0:m.style)||"",e.style||""],onClick:ul([d,m==null?void 0:m.onClick]),onMouseenter:ul([u,m==null?void 0:m.onMouseenter]),onMousemove:ul([f,m==null?void 0:m.onMousemove])}),t.h("div",{class:`${n}-base-select-option__content`},p));return e.render?e.render({node:g,option:e,selected:i}):l?l({node:g,option:e,selected:i}):g}}),{cubicBezierEaseIn:rm,cubicBezierEaseOut:om}=to;function sm({transformOrigin:n="inherit",duration:e=".2s",enterScale:i=".9",originalTransform:r="",originalTransition:o=""}={}){return[pe("&.fade-in-scale-up-transition-leave-active",{transformOrigin:n,transition:`opacity ${e} ${rm}, transform ${e} ${rm} ${o&&`,${o}`}`}),pe("&.fade-in-scale-up-transition-enter-active",{transformOrigin:n,transition:`opacity ${e} ${om}, transform ${e} ${om} ${o&&`,${o}`}`}),pe("&.fade-in-scale-up-transition-enter-from, &.fade-in-scale-up-transition-leave-to",{opacity:0,transform:`${r} scale(${i})`}),pe("&.fade-in-scale-up-transition-leave-from, &.fade-in-scale-up-transition-enter-to",{opacity:1,transform:`${r} scale(1)`})]}const s5=ke("base-select-menu",`
320
+ `)]),t5=Object.assign(Object.assign({},Rt.props),{description:String,showDescription:{type:Boolean,default:!0},showIcon:{type:Boolean,default:!0},size:{type:String,default:"medium"},renderIcon:Function}),n5=t.defineComponent({name:"Empty",props:t5,slots:Object,setup(n){const{mergedClsPrefixRef:e,inlineThemeDisabled:i,mergedComponentPropsRef:r}=Li(n),o=Rt("Empty","-empty",e5,em,n,e),{localeRef:s}=qh("Empty"),a=t.computed(()=>{var u,f,h;return(u=n.description)!==null&&u!==void 0?u:(h=(f=r==null?void 0:r.value)===null||f===void 0?void 0:f.Empty)===null||h===void 0?void 0:h.description}),l=t.computed(()=>{var u,f;return((f=(u=r==null?void 0:r.value)===null||u===void 0?void 0:u.Empty)===null||f===void 0?void 0:f.renderIcon)||(()=>t.h(MB,null))}),c=t.computed(()=>{const{size:u}=n,{common:{cubicBezierEaseInOut:f},self:{[st("iconSize",u)]:h,[st("fontSize",u)]:p,textColor:m,iconColor:g,extraTextColor:b}}=o.value;return{"--n-icon-size":h,"--n-font-size":p,"--n-bezier":f,"--n-text-color":m,"--n-icon-color":g,"--n-extra-text-color":b}}),d=i?Hi("empty",t.computed(()=>{let u="";const{size:f}=n;return u+=f[0],u}),c,n):void 0;return{mergedClsPrefix:e,mergedRenderIcon:l,localizedDescription:t.computed(()=>a.value||s.value.description),cssVars:i?void 0:c,themeClass:d==null?void 0:d.themeClass,onRender:d==null?void 0:d.onRender}},render(){const{$slots:n,mergedClsPrefix:e,onRender:i}=this;return i==null||i(),t.h("div",{class:[`${e}-empty`,this.themeClass],style:this.cssVars},this.showIcon?t.h("div",{class:`${e}-empty__icon`},n.icon?n.icon():t.h(no,{clsPrefix:e},{default:this.mergedRenderIcon})):null,this.showDescription?t.h("div",{class:`${e}-empty__description`},n.default?n.default():this.localizedDescription):null,n.extra?t.h("div",{class:`${e}-empty__extra`},n.extra()):null)}}),i5={height:"calc(var(--n-option-height) * 7.6)",paddingTiny:"4px 0",paddingSmall:"4px 0",paddingMedium:"4px 0",paddingLarge:"4px 0",paddingHuge:"4px 0",optionPaddingTiny:"0 12px",optionPaddingSmall:"0 12px",optionPaddingMedium:"0 12px",optionPaddingLarge:"0 12px",optionPaddingHuge:"0 12px",loadingSize:"18px"};function r5(n){const{borderRadius:e,popoverColor:i,textColor3:r,dividerColor:o,textColor2:s,primaryColorPressed:a,textColorDisabled:l,primaryColor:c,opacityDisabled:d,hoverColor:u,fontSizeTiny:f,fontSizeSmall:h,fontSizeMedium:p,fontSizeLarge:m,fontSizeHuge:g,heightTiny:b,heightSmall:y,heightMedium:_,heightLarge:x,heightHuge:w}=n;return Object.assign(Object.assign({},i5),{optionFontSizeTiny:f,optionFontSizeSmall:h,optionFontSizeMedium:p,optionFontSizeLarge:m,optionFontSizeHuge:g,optionHeightTiny:b,optionHeightSmall:y,optionHeightMedium:_,optionHeightLarge:x,optionHeightHuge:w,borderRadius:e,color:i,groupHeaderTextColor:r,actionDividerColor:o,optionTextColor:s,optionTextColorPressed:a,optionTextColorDisabled:l,optionTextColorActive:c,optionOpacityDisabled:d,optionCheckColor:c,optionColorPending:u,optionColorActive:"rgba(0, 0, 0, 0)",optionColorActivePending:u,actionTextColor:s,loadingColor:c})}const tm={name:"InternalSelectMenu",common:Wi,peers:{Scrollbar:yl,Empty:em},self:r5},nm=t.defineComponent({name:"NBaseSelectGroupHeader",props:{clsPrefix:{type:String,required:!0},tmNode:{type:Object,required:!0}},setup(){const{renderLabelRef:n,renderOptionRef:e,labelFieldRef:i,nodePropsRef:r}=t.inject(al);return{labelField:i,nodeProps:r,renderLabel:n,renderOption:e}},render(){const{clsPrefix:n,renderLabel:e,renderOption:i,nodeProps:r,tmNode:{rawNode:o}}=this,s=r==null?void 0:r(o),a=e?e(o,!1):Cr(o[this.labelField],o,!1),l=t.h("div",Object.assign({},s,{class:[`${n}-base-select-group-header`,s==null?void 0:s.class]}),a);return o.render?o.render({node:l,option:o}):i?i({node:l,option:o,selected:!1}):l}});function o5(n,e){return t.h(t.Transition,{name:"fade-in-scale-up-transition"},{default:()=>n?t.h(no,{clsPrefix:e,class:`${e}-base-select-option__check`},{default:()=>t.h(RB)}):null})}const im=t.defineComponent({name:"NBaseSelectOption",props:{clsPrefix:{type:String,required:!0},tmNode:{type:Object,required:!0}},setup(n){const{valueRef:e,pendingTmNodeRef:i,multipleRef:r,valueSetRef:o,renderLabelRef:s,renderOptionRef:a,labelFieldRef:l,valueFieldRef:c,showCheckmarkRef:d,nodePropsRef:u,handleOptionClick:f,handleOptionMouseEnter:h}=t.inject(al),p=hn(()=>{const{value:y}=i;return y?n.tmNode.key===y.key:!1});function m(y){const{tmNode:_}=n;_.disabled||f(y,_)}function g(y){const{tmNode:_}=n;_.disabled||h(y,_)}function b(y){const{tmNode:_}=n,{value:x}=p;_.disabled||x||h(y,_)}return{multiple:r,isGrouped:hn(()=>{const{tmNode:y}=n,{parent:_}=y;return _&&_.rawNode.type==="group"}),showCheckmark:d,nodeProps:u,isPending:p,isSelected:hn(()=>{const{value:y}=e,{value:_}=r;if(y===null)return!1;const x=n.tmNode.rawNode[c.value];if(_){const{value:w}=o;return w.has(x)}else return y===x}),labelField:l,renderLabel:s,renderOption:a,handleMouseMove:b,handleMouseEnter:g,handleClick:m}},render(){const{clsPrefix:n,tmNode:{rawNode:e},isSelected:i,isPending:r,isGrouped:o,showCheckmark:s,nodeProps:a,renderOption:l,renderLabel:c,handleClick:d,handleMouseEnter:u,handleMouseMove:f}=this,h=o5(i,n),p=c?[c(e,i),s&&h]:[Cr(e[this.labelField],e,i),s&&h],m=a==null?void 0:a(e),g=t.h("div",Object.assign({},m,{class:[`${n}-base-select-option`,e.class,m==null?void 0:m.class,{[`${n}-base-select-option--disabled`]:e.disabled,[`${n}-base-select-option--selected`]:i,[`${n}-base-select-option--grouped`]:o,[`${n}-base-select-option--pending`]:r,[`${n}-base-select-option--show-checkmark`]:s}],style:[(m==null?void 0:m.style)||"",e.style||""],onClick:ul([d,m==null?void 0:m.onClick]),onMouseenter:ul([u,m==null?void 0:m.onMouseenter]),onMousemove:ul([f,m==null?void 0:m.onMousemove])}),t.h("div",{class:`${n}-base-select-option__content`},p));return e.render?e.render({node:g,option:e,selected:i}):l?l({node:g,option:e,selected:i}):g}}),{cubicBezierEaseIn:rm,cubicBezierEaseOut:om}=to;function sm({transformOrigin:n="inherit",duration:e=".2s",enterScale:i=".9",originalTransform:r="",originalTransition:o=""}={}){return[pe("&.fade-in-scale-up-transition-leave-active",{transformOrigin:n,transition:`opacity ${e} ${rm}, transform ${e} ${rm} ${o&&`,${o}`}`}),pe("&.fade-in-scale-up-transition-enter-active",{transformOrigin:n,transition:`opacity ${e} ${om}, transform ${e} ${om} ${o&&`,${o}`}`}),pe("&.fade-in-scale-up-transition-enter-from, &.fade-in-scale-up-transition-leave-to",{opacity:0,transform:`${r} scale(${i})`}),pe("&.fade-in-scale-up-transition-leave-from, &.fade-in-scale-up-transition-enter-to",{opacity:1,transform:`${r} scale(1)`})]}const s5=ke("base-select-menu",`
321
321
  line-height: 1.5;
322
322
  outline: none;
323
323
  z-index: 0;
@@ -424,7 +424,7 @@ ${o}
424
424
  top: calc(50% - 7px);
425
425
  color: var(--n-option-check-color);
426
426
  transition: color .3s var(--n-bezier);
427
- `,[sm({enterScale:"0.5"})])])]),a5=t.defineComponent({name:"InternalSelectMenu",props:Object.assign(Object.assign({},Rt.props),{clsPrefix:{type:String,required:!0},scrollable:{type:Boolean,default:!0},treeMate:{type:Object,required:!0},multiple:Boolean,size:{type:String,default:"medium"},value:{type:[String,Number,Array],default:null},autoPending:Boolean,virtualScroll:{type:Boolean,default:!0},show:{type:Boolean,default:!0},labelField:{type:String,default:"label"},valueField:{type:String,default:"value"},loading:Boolean,focusable:Boolean,renderLabel:Function,renderOption:Function,nodeProps:Function,showCheckmark:{type:Boolean,default:!0},onMousedown:Function,onScroll:Function,onFocus:Function,onBlur:Function,onKeyup:Function,onKeydown:Function,onTabOut:Function,onMouseenter:Function,onMouseleave:Function,onResize:Function,resetMenuOnOptionsChange:{type:Boolean,default:!0},inlineThemeDisabled:Boolean,onToggle:Function}),setup(n){const{mergedClsPrefixRef:e,mergedRtlRef:i}=Li(n),r=eo("InternalSelectMenu",i,e),o=Rt("InternalSelectMenu","-internal-select-menu",s5,tm,n,t.toRef(n,"clsPrefix")),s=t.ref(null),a=t.ref(null),l=t.ref(null),c=t.computed(()=>n.treeMate.getFlattenedNodes()),d=t.computed(()=>JC(c.value)),u=t.ref(null);function f(){const{treeMate:T}=n;let D=null;const{value:K}=n;K===null?D=T.getFirstAvailableNode():(n.multiple?D=T.getNode((K||[])[(K||[]).length-1]):D=T.getNode(K),(!D||D.disabled)&&(D=T.getFirstAvailableNode())),M(D||null)}function h(){const{value:T}=u;T&&!n.treeMate.getNode(T.key)&&(u.value=null)}let p;t.watch(()=>n.show,T=>{T?p=t.watch(()=>n.treeMate,()=>{n.resetMenuOnOptionsChange?(n.autoPending?f():h(),t.nextTick(X)):h()},{immediate:!0}):p==null||p()},{immediate:!0}),t.onBeforeUnmount(()=>{p==null||p()});const m=t.computed(()=>jr(o.value.self[st("optionHeight",n.size)])),g=t.computed(()=>xn(o.value.self[st("padding",n.size)])),b=t.computed(()=>n.multiple&&Array.isArray(n.value)?new Set(n.value):new Set),y=t.computed(()=>{const T=c.value;return T&&T.length===0});function _(T){const{onToggle:D}=n;D&&D(T)}function x(T){const{onScroll:D}=n;D&&D(T)}function w(T){var D;(D=l.value)===null||D===void 0||D.sync(),x(T)}function C(){var T;(T=l.value)===null||T===void 0||T.sync()}function N(){const{value:T}=u;return T||null}function k(T,D){D.disabled||M(D,!1)}function $(T,D){D.disabled||_(D)}function v(T){var D;Hr(T,"action")||(D=n.onKeyup)===null||D===void 0||D.call(n,T)}function E(T){var D;Hr(T,"action")||(D=n.onKeydown)===null||D===void 0||D.call(n,T)}function P(T){var D;(D=n.onMousedown)===null||D===void 0||D.call(n,T),!n.focusable&&T.preventDefault()}function F(){const{value:T}=u;T&&M(T.getNext({loop:!0}),!0)}function R(){const{value:T}=u;T&&M(T.getPrev({loop:!0}),!0)}function M(T,D=!1){u.value=T,D&&X()}function X(){var T,D;const K=u.value;if(!K)return;const J=d.value(K.key);J!==null&&(n.virtualScroll?(T=a.value)===null||T===void 0||T.scrollTo({index:J}):(D=l.value)===null||D===void 0||D.scrollTo({index:J,elSize:m.value}))}function G(T){var D,K;!((D=s.value)===null||D===void 0)&&D.contains(T.target)&&((K=n.onFocus)===null||K===void 0||K.call(n,T))}function Z(T){var D,K;!((D=s.value)===null||D===void 0)&&D.contains(T.relatedTarget)||(K=n.onBlur)===null||K===void 0||K.call(n,T)}t.provide(al,{handleOptionMouseEnter:k,handleOptionClick:$,valueSetRef:b,pendingTmNodeRef:u,nodePropsRef:t.toRef(n,"nodeProps"),showCheckmarkRef:t.toRef(n,"showCheckmark"),multipleRef:t.toRef(n,"multiple"),valueRef:t.toRef(n,"value"),renderLabelRef:t.toRef(n,"renderLabel"),renderOptionRef:t.toRef(n,"renderOption"),labelFieldRef:t.toRef(n,"labelField"),valueFieldRef:t.toRef(n,"valueField")}),t.provide(Nh,s),t.onMounted(()=>{const{value:T}=l;T&&T.sync()});const O=t.computed(()=>{const{size:T}=n,{common:{cubicBezierEaseInOut:D},self:{height:K,borderRadius:J,color:U,groupHeaderTextColor:q,actionDividerColor:L,optionTextColorPressed:le,optionTextColor:ue,optionTextColorDisabled:oe,optionTextColorActive:fe,optionOpacityDisabled:ge,optionCheckColor:_e,actionTextColor:Qe,optionColorPending:Re,optionColorActive:Mt,loadingColor:vn,loadingSize:It,optionColorActivePending:en,[st("optionFontSize",T)]:Ln,[st("optionHeight",T)]:mn,[st("optionPadding",T)]:_t}}=o.value;return{"--n-height":K,"--n-action-divider-color":L,"--n-action-text-color":Qe,"--n-bezier":D,"--n-border-radius":J,"--n-color":U,"--n-option-font-size":Ln,"--n-group-header-text-color":q,"--n-option-check-color":_e,"--n-option-color-pending":Re,"--n-option-color-active":Mt,"--n-option-color-active-pending":en,"--n-option-height":mn,"--n-option-opacity-disabled":ge,"--n-option-text-color":ue,"--n-option-text-color-active":fe,"--n-option-text-color-disabled":oe,"--n-option-text-color-pressed":le,"--n-option-padding":_t,"--n-option-padding-left":xn(_t,"left"),"--n-option-padding-right":xn(_t,"right"),"--n-loading-color":vn,"--n-loading-size":It}}),{inlineThemeDisabled:A}=n,Y=A?Hi("internal-select-menu",t.computed(()=>n.size[0]),O,n):void 0,H={selfRef:s,next:F,prev:R,getPendingTmNode:N};return Ph(s,n.onResize),Object.assign({mergedTheme:o,mergedClsPrefix:e,rtlEnabled:r,virtualListRef:a,scrollbarRef:l,itemSize:m,padding:g,flattenedNodes:c,empty:y,virtualListContainer(){const{value:T}=a;return T==null?void 0:T.listElRef},virtualListContent(){const{value:T}=a;return T==null?void 0:T.itemsElRef},doScroll:x,handleFocusin:G,handleFocusout:Z,handleKeyUp:v,handleKeyDown:E,handleMouseDown:P,handleVirtualListResize:C,handleVirtualListScroll:w,cssVars:A?void 0:O,themeClass:Y==null?void 0:Y.themeClass,onRender:Y==null?void 0:Y.onRender},H)},render(){const{$slots:n,virtualScroll:e,clsPrefix:i,mergedTheme:r,themeClass:o,onRender:s}=this;return s==null||s(),t.h("div",{ref:"selfRef",tabindex:this.focusable?0:-1,class:[`${i}-base-select-menu`,this.rtlEnabled&&`${i}-base-select-menu--rtl`,o,this.multiple&&`${i}-base-select-menu--multiple`],style:this.cssVars,onFocusin:this.handleFocusin,onFocusout:this.handleFocusout,onKeyup:this.handleKeyUp,onKeydown:this.handleKeyDown,onMousedown:this.handleMouseDown,onMouseenter:this.onMouseenter,onMouseleave:this.onMouseleave},zi(n.header,a=>a&&t.h("div",{class:`${i}-base-select-menu__header`,"data-header":!0,key:"header"},a)),this.loading?t.h("div",{class:`${i}-base-select-menu__loading`},t.h(Kh,{clsPrefix:i,strokeWidth:20})):this.empty?t.h("div",{class:`${i}-base-select-menu__empty`,"data-empty":!0},fl(n.empty,()=>[t.h(n5,{theme:r.peers.Empty,themeOverrides:r.peerOverrides.Empty,size:this.size})])):t.h(Jh,{ref:"scrollbarRef",theme:r.peers.Scrollbar,themeOverrides:r.peerOverrides.Scrollbar,scrollable:this.scrollable,container:e?this.virtualListContainer:void 0,content:e?this.virtualListContent:void 0,onScroll:e?void 0:this.doScroll},{default:()=>e?t.h($S,{ref:"virtualListRef",class:`${i}-virtual-list`,items:this.flattenedNodes,itemSize:this.itemSize,showScrollbar:!1,paddingTop:this.padding.top,paddingBottom:this.padding.bottom,onResize:this.handleVirtualListResize,onScroll:this.handleVirtualListScroll,itemResizable:!0},{default:({item:a})=>a.isGroup?t.h(nm,{key:a.key,clsPrefix:i,tmNode:a}):a.ignored?null:t.h(im,{clsPrefix:i,key:a.key,tmNode:a})}):t.h("div",{class:`${i}-base-select-menu-option-wrapper`,style:{paddingTop:this.padding.top,paddingBottom:this.padding.bottom}},this.flattenedNodes.map(a=>a.isGroup?t.h(nm,{key:a.key,clsPrefix:i,tmNode:a}):t.h(im,{clsPrefix:i,key:a.key,tmNode:a})))}),zi(n.action,a=>a&&[t.h("div",{class:`${i}-base-select-menu__action`,"data-action":!0,key:"action"},a),t.h(LB,{onFocus:this.onTabOut,key:"focus-detector"})]))}}),l5={space:"6px",spaceArrow:"10px",arrowOffset:"10px",arrowOffsetVertical:"10px",arrowHeight:"6px",padding:"8px 14px"};function c5(n){const{boxShadow2:e,popoverColor:i,textColor2:r,borderRadius:o,fontSize:s,dividerColor:a}=n;return Object.assign(Object.assign({},l5),{fontSize:s,borderRadius:o,color:i,dividerColor:a,textColor:r,boxShadow:e})}const am={name:"Popover",common:Wi,peers:{Scrollbar:yl},self:c5},bl={top:"bottom",bottom:"top",left:"right",right:"left"},bt="var(--n-arrow-height) * 1.414",d5=pe([ke("popover",`
427
+ `,[sm({enterScale:"0.5"})])])]),a5=t.defineComponent({name:"InternalSelectMenu",props:Object.assign(Object.assign({},Rt.props),{clsPrefix:{type:String,required:!0},scrollable:{type:Boolean,default:!0},treeMate:{type:Object,required:!0},multiple:Boolean,size:{type:String,default:"medium"},value:{type:[String,Number,Array],default:null},autoPending:Boolean,virtualScroll:{type:Boolean,default:!0},show:{type:Boolean,default:!0},labelField:{type:String,default:"label"},valueField:{type:String,default:"value"},loading:Boolean,focusable:Boolean,renderLabel:Function,renderOption:Function,nodeProps:Function,showCheckmark:{type:Boolean,default:!0},onMousedown:Function,onScroll:Function,onFocus:Function,onBlur:Function,onKeyup:Function,onKeydown:Function,onTabOut:Function,onMouseenter:Function,onMouseleave:Function,onResize:Function,resetMenuOnOptionsChange:{type:Boolean,default:!0},inlineThemeDisabled:Boolean,onToggle:Function}),setup(n){const{mergedClsPrefixRef:e,mergedRtlRef:i}=Li(n),r=eo("InternalSelectMenu",i,e),o=Rt("InternalSelectMenu","-internal-select-menu",s5,tm,n,t.toRef(n,"clsPrefix")),s=t.ref(null),a=t.ref(null),l=t.ref(null),c=t.computed(()=>n.treeMate.getFlattenedNodes()),d=t.computed(()=>JC(c.value)),u=t.ref(null);function f(){const{treeMate:T}=n;let D=null;const{value:K}=n;K===null?D=T.getFirstAvailableNode():(n.multiple?D=T.getNode((K||[])[(K||[]).length-1]):D=T.getNode(K),(!D||D.disabled)&&(D=T.getFirstAvailableNode())),M(D||null)}function h(){const{value:T}=u;T&&!n.treeMate.getNode(T.key)&&(u.value=null)}let p;t.watch(()=>n.show,T=>{T?p=t.watch(()=>n.treeMate,()=>{n.resetMenuOnOptionsChange?(n.autoPending?f():h(),t.nextTick(X)):h()},{immediate:!0}):p==null||p()},{immediate:!0}),t.onBeforeUnmount(()=>{p==null||p()});const m=t.computed(()=>jr(o.value.self[st("optionHeight",n.size)])),g=t.computed(()=>xn(o.value.self[st("padding",n.size)])),b=t.computed(()=>n.multiple&&Array.isArray(n.value)?new Set(n.value):new Set),y=t.computed(()=>{const T=c.value;return T&&T.length===0});function _(T){const{onToggle:D}=n;D&&D(T)}function x(T){const{onScroll:D}=n;D&&D(T)}function w(T){var D;(D=l.value)===null||D===void 0||D.sync(),x(T)}function C(){var T;(T=l.value)===null||T===void 0||T.sync()}function N(){const{value:T}=u;return T||null}function k(T,D){D.disabled||M(D,!1)}function $(T,D){D.disabled||_(D)}function v(T){var D;Hr(T,"action")||(D=n.onKeyup)===null||D===void 0||D.call(n,T)}function E(T){var D;Hr(T,"action")||(D=n.onKeydown)===null||D===void 0||D.call(n,T)}function P(T){var D;(D=n.onMousedown)===null||D===void 0||D.call(n,T),!n.focusable&&T.preventDefault()}function F(){const{value:T}=u;T&&M(T.getNext({loop:!0}),!0)}function R(){const{value:T}=u;T&&M(T.getPrev({loop:!0}),!0)}function M(T,D=!1){u.value=T,D&&X()}function X(){var T,D;const K=u.value;if(!K)return;const J=d.value(K.key);J!==null&&(n.virtualScroll?(T=a.value)===null||T===void 0||T.scrollTo({index:J}):(D=l.value)===null||D===void 0||D.scrollTo({index:J,elSize:m.value}))}function G(T){var D,K;!((D=s.value)===null||D===void 0)&&D.contains(T.target)&&((K=n.onFocus)===null||K===void 0||K.call(n,T))}function Z(T){var D,K;!((D=s.value)===null||D===void 0)&&D.contains(T.relatedTarget)||(K=n.onBlur)===null||K===void 0||K.call(n,T)}t.provide(al,{handleOptionMouseEnter:k,handleOptionClick:$,valueSetRef:b,pendingTmNodeRef:u,nodePropsRef:t.toRef(n,"nodeProps"),showCheckmarkRef:t.toRef(n,"showCheckmark"),multipleRef:t.toRef(n,"multiple"),valueRef:t.toRef(n,"value"),renderLabelRef:t.toRef(n,"renderLabel"),renderOptionRef:t.toRef(n,"renderOption"),labelFieldRef:t.toRef(n,"labelField"),valueFieldRef:t.toRef(n,"valueField")}),t.provide(Nh,s),t.onMounted(()=>{const{value:T}=l;T&&T.sync()});const O=t.computed(()=>{const{size:T}=n,{common:{cubicBezierEaseInOut:D},self:{height:K,borderRadius:J,color:U,groupHeaderTextColor:q,actionDividerColor:L,optionTextColorPressed:le,optionTextColor:ue,optionTextColorDisabled:oe,optionTextColorActive:fe,optionOpacityDisabled:ge,optionCheckColor:_e,actionTextColor:Qe,optionColorPending:Re,optionColorActive:Mt,loadingColor:vn,loadingSize:It,optionColorActivePending:en,[st("optionFontSize",T)]:Ln,[st("optionHeight",T)]:pn,[st("optionPadding",T)]:_t}}=o.value;return{"--n-height":K,"--n-action-divider-color":L,"--n-action-text-color":Qe,"--n-bezier":D,"--n-border-radius":J,"--n-color":U,"--n-option-font-size":Ln,"--n-group-header-text-color":q,"--n-option-check-color":_e,"--n-option-color-pending":Re,"--n-option-color-active":Mt,"--n-option-color-active-pending":en,"--n-option-height":pn,"--n-option-opacity-disabled":ge,"--n-option-text-color":ue,"--n-option-text-color-active":fe,"--n-option-text-color-disabled":oe,"--n-option-text-color-pressed":le,"--n-option-padding":_t,"--n-option-padding-left":xn(_t,"left"),"--n-option-padding-right":xn(_t,"right"),"--n-loading-color":vn,"--n-loading-size":It}}),{inlineThemeDisabled:A}=n,Y=A?Hi("internal-select-menu",t.computed(()=>n.size[0]),O,n):void 0,H={selfRef:s,next:F,prev:R,getPendingTmNode:N};return Ph(s,n.onResize),Object.assign({mergedTheme:o,mergedClsPrefix:e,rtlEnabled:r,virtualListRef:a,scrollbarRef:l,itemSize:m,padding:g,flattenedNodes:c,empty:y,virtualListContainer(){const{value:T}=a;return T==null?void 0:T.listElRef},virtualListContent(){const{value:T}=a;return T==null?void 0:T.itemsElRef},doScroll:x,handleFocusin:G,handleFocusout:Z,handleKeyUp:v,handleKeyDown:E,handleMouseDown:P,handleVirtualListResize:C,handleVirtualListScroll:w,cssVars:A?void 0:O,themeClass:Y==null?void 0:Y.themeClass,onRender:Y==null?void 0:Y.onRender},H)},render(){const{$slots:n,virtualScroll:e,clsPrefix:i,mergedTheme:r,themeClass:o,onRender:s}=this;return s==null||s(),t.h("div",{ref:"selfRef",tabindex:this.focusable?0:-1,class:[`${i}-base-select-menu`,this.rtlEnabled&&`${i}-base-select-menu--rtl`,o,this.multiple&&`${i}-base-select-menu--multiple`],style:this.cssVars,onFocusin:this.handleFocusin,onFocusout:this.handleFocusout,onKeyup:this.handleKeyUp,onKeydown:this.handleKeyDown,onMousedown:this.handleMouseDown,onMouseenter:this.onMouseenter,onMouseleave:this.onMouseleave},zi(n.header,a=>a&&t.h("div",{class:`${i}-base-select-menu__header`,"data-header":!0,key:"header"},a)),this.loading?t.h("div",{class:`${i}-base-select-menu__loading`},t.h(Kh,{clsPrefix:i,strokeWidth:20})):this.empty?t.h("div",{class:`${i}-base-select-menu__empty`,"data-empty":!0},fl(n.empty,()=>[t.h(n5,{theme:r.peers.Empty,themeOverrides:r.peerOverrides.Empty,size:this.size})])):t.h(Jh,{ref:"scrollbarRef",theme:r.peers.Scrollbar,themeOverrides:r.peerOverrides.Scrollbar,scrollable:this.scrollable,container:e?this.virtualListContainer:void 0,content:e?this.virtualListContent:void 0,onScroll:e?void 0:this.doScroll},{default:()=>e?t.h($S,{ref:"virtualListRef",class:`${i}-virtual-list`,items:this.flattenedNodes,itemSize:this.itemSize,showScrollbar:!1,paddingTop:this.padding.top,paddingBottom:this.padding.bottom,onResize:this.handleVirtualListResize,onScroll:this.handleVirtualListScroll,itemResizable:!0},{default:({item:a})=>a.isGroup?t.h(nm,{key:a.key,clsPrefix:i,tmNode:a}):a.ignored?null:t.h(im,{clsPrefix:i,key:a.key,tmNode:a})}):t.h("div",{class:`${i}-base-select-menu-option-wrapper`,style:{paddingTop:this.padding.top,paddingBottom:this.padding.bottom}},this.flattenedNodes.map(a=>a.isGroup?t.h(nm,{key:a.key,clsPrefix:i,tmNode:a}):t.h(im,{clsPrefix:i,key:a.key,tmNode:a})))}),zi(n.action,a=>a&&[t.h("div",{class:`${i}-base-select-menu__action`,"data-action":!0,key:"action"},a),t.h(LB,{onFocus:this.onTabOut,key:"focus-detector"})]))}}),l5={space:"6px",spaceArrow:"10px",arrowOffset:"10px",arrowOffsetVertical:"10px",arrowHeight:"6px",padding:"8px 14px"};function c5(n){const{boxShadow2:e,popoverColor:i,textColor2:r,borderRadius:o,fontSize:s,dividerColor:a}=n;return Object.assign(Object.assign({},l5),{fontSize:s,borderRadius:o,color:i,dividerColor:a,textColor:r,boxShadow:e})}const am={name:"Popover",common:Wi,peers:{Scrollbar:yl},self:c5},bl={top:"bottom",bottom:"top",left:"right",right:"left"},bt="var(--n-arrow-height) * 1.414",d5=pe([ke("popover",`
428
428
  transition:
429
429
  box-shadow .3s var(--n-bezier),
430
430
  background-color .3s var(--n-bezier),
@@ -486,47 +486,47 @@ ${o}
486
486
  color .3s var(--n-bezier),
487
487
  opacity .15s var(--n-bezier-ease-in),
488
488
  transform .15s var(--n-bezier-ease-in);
489
- `)]),hn("top-start",`
489
+ `)]),mn("top-start",`
490
490
  top: calc(${bt} / -2);
491
491
  left: calc(${Zn("top-start")} - var(--v-offset-left));
492
- `),hn("top",`
492
+ `),mn("top",`
493
493
  top: calc(${bt} / -2);
494
494
  transform: translateX(calc(${bt} / -2)) rotate(45deg);
495
495
  left: 50%;
496
- `),hn("top-end",`
496
+ `),mn("top-end",`
497
497
  top: calc(${bt} / -2);
498
498
  right: calc(${Zn("top-end")} + var(--v-offset-left));
499
- `),hn("bottom-start",`
499
+ `),mn("bottom-start",`
500
500
  bottom: calc(${bt} / -2);
501
501
  left: calc(${Zn("bottom-start")} - var(--v-offset-left));
502
- `),hn("bottom",`
502
+ `),mn("bottom",`
503
503
  bottom: calc(${bt} / -2);
504
504
  transform: translateX(calc(${bt} / -2)) rotate(45deg);
505
505
  left: 50%;
506
- `),hn("bottom-end",`
506
+ `),mn("bottom-end",`
507
507
  bottom: calc(${bt} / -2);
508
508
  right: calc(${Zn("bottom-end")} + var(--v-offset-left));
509
- `),hn("left-start",`
509
+ `),mn("left-start",`
510
510
  left: calc(${bt} / -2);
511
511
  top: calc(${Zn("left-start")} - var(--v-offset-top));
512
- `),hn("left",`
512
+ `),mn("left",`
513
513
  left: calc(${bt} / -2);
514
514
  transform: translateY(calc(${bt} / -2)) rotate(45deg);
515
515
  top: 50%;
516
- `),hn("left-end",`
516
+ `),mn("left-end",`
517
517
  left: calc(${bt} / -2);
518
518
  bottom: calc(${Zn("left-end")} + var(--v-offset-top));
519
- `),hn("right-start",`
519
+ `),mn("right-start",`
520
520
  right: calc(${bt} / -2);
521
521
  top: calc(${Zn("right-start")} - var(--v-offset-top));
522
- `),hn("right",`
522
+ `),mn("right",`
523
523
  right: calc(${bt} / -2);
524
524
  transform: translateY(calc(${bt} / -2)) rotate(45deg);
525
525
  top: 50%;
526
- `),hn("right-end",`
526
+ `),mn("right-end",`
527
527
  right: calc(${bt} / -2);
528
528
  bottom: calc(${Zn("right-end")} + var(--v-offset-top));
529
- `),...V.map({top:["right-start","left-start"],right:["top-end","bottom-end"],bottom:["right-end","left-end"],left:["top-start","bottom-start"]},(n,e)=>{const i=["right","left"].includes(e),r=i?"width":"height";return n.map(o=>{const s=o.split("-")[1]==="end",l=`calc((${`var(--v-target-${r}, 0px)`} - ${bt}) / 2)`,c=Zn(o);return pe(`[v-placement="${o}"] >`,[ke("popover-shared",[Fe("center-arrow",[ke("popover-arrow",`${e}: calc(max(${l}, ${c}) ${s?"+":"-"} var(--v-offset-${i?"left":"top"}));`)])])])})})]);function Zn(n){return["top","bottom"].includes(n.split("-")[0])?"var(--n-arrow-offset)":"var(--n-arrow-offset-vertical)"}function hn(n,e){const i=n.split("-")[0],r=["top","bottom"].includes(i)?"height: var(--n-space-arrow);":"width: var(--n-space-arrow);";return pe(`[v-placement="${n}"] >`,[ke("popover-shared",`
529
+ `),...V.map({top:["right-start","left-start"],right:["top-end","bottom-end"],bottom:["right-end","left-end"],left:["top-start","bottom-start"]},(n,e)=>{const i=["right","left"].includes(e),r=i?"width":"height";return n.map(o=>{const s=o.split("-")[1]==="end",l=`calc((${`var(--v-target-${r}, 0px)`} - ${bt}) / 2)`,c=Zn(o);return pe(`[v-placement="${o}"] >`,[ke("popover-shared",[Fe("center-arrow",[ke("popover-arrow",`${e}: calc(max(${l}, ${c}) ${s?"+":"-"} var(--v-offset-${i?"left":"top"}));`)])])])})})]);function Zn(n){return["top","bottom"].includes(n.split("-")[0])?"var(--n-arrow-offset)":"var(--n-arrow-offset-vertical)"}function mn(n,e){const i=n.split("-")[0],r=["top","bottom"].includes(i)?"height: var(--n-space-arrow);":"width: var(--n-space-arrow);";return pe(`[v-placement="${n}"] >`,[ke("popover-shared",`
530
530
  margin-${bl[i]}: var(--n-space);
531
531
  `,[Fe("show-arrow",`
532
532
  margin-${bl[i]}: var(--n-space-arrow);
@@ -540,7 +540,7 @@ ${o}
540
540
  ${i}: 100%;
541
541
  ${bl[i]}: auto;
542
542
  ${r}
543
- `,[ke("popover-arrow",e)])])])}const lm=Object.assign(Object.assign({},Rt.props),{to:Gn.propTo,show:Boolean,trigger:String,showArrow:Boolean,delay:Number,duration:Number,raw:Boolean,arrowPointToCenter:Boolean,arrowClass:String,arrowStyle:[String,Object],arrowWrapperClass:String,arrowWrapperStyle:[String,Object],displayDirective:String,x:Number,y:Number,flip:Boolean,overlap:Boolean,placement:String,width:[Number,String],keepAliveOnHover:Boolean,scrollable:Boolean,contentClass:String,contentStyle:[Object,String],headerClass:String,headerStyle:[Object,String],footerClass:String,footerStyle:[Object,String],internalDeactivateImmediately:Boolean,animated:Boolean,onClickoutside:Function,internalTrapFocus:Boolean,internalOnAfterLeave:Function,minWidth:Number,maxWidth:Number});function u5({arrowClass:n,arrowStyle:e,arrowWrapperClass:i,arrowWrapperStyle:r,clsPrefix:o}){return t.h("div",{key:"__popover-arrow__",style:r,class:[`${o}-popover-arrow-wrapper`,i]},t.h("div",{class:[`${o}-popover-arrow`,n],style:e}))}const f5=t.defineComponent({name:"PopoverBody",inheritAttrs:!1,props:lm,setup(n,{slots:e,attrs:i}){const{namespaceRef:r,mergedClsPrefixRef:o,inlineThemeDisabled:s,mergedRtlRef:a}=Li(n),l=Rt("Popover","-popover",d5,am,n,o),c=eo("Popover",a,o),d=t.ref(null),u=t.inject("NPopover"),f=t.ref(null),h=t.ref(n.show),p=t.ref(!1);t.watchEffect(()=>{const{show:v}=n;v&&!DS()&&!n.internalDeactivateImmediately&&(p.value=!0)});const m=t.computed(()=>{const{trigger:v,onClickoutside:E}=n,P=[],{positionManuallyRef:{value:F}}=u;return F||(v==="click"&&!E&&P.push([ss,N,void 0,{capture:!0}]),v==="hover"&&P.push([_v,C])),E&&P.push([ss,N,void 0,{capture:!0}]),(n.displayDirective==="show"||n.animated&&p.value)&&P.push([t.vShow,n.show]),P}),g=t.computed(()=>{const{common:{cubicBezierEaseInOut:v,cubicBezierEaseIn:E,cubicBezierEaseOut:P},self:{space:F,spaceArrow:R,padding:M,fontSize:X,textColor:G,dividerColor:Z,color:O,boxShadow:A,borderRadius:Y,arrowHeight:H,arrowOffset:T,arrowOffsetVertical:D}}=l.value;return{"--n-box-shadow":A,"--n-bezier":v,"--n-bezier-ease-in":E,"--n-bezier-ease-out":P,"--n-font-size":X,"--n-text-color":G,"--n-color":O,"--n-divider-color":Z,"--n-border-radius":Y,"--n-arrow-height":H,"--n-arrow-offset":T,"--n-arrow-offset-vertical":D,"--n-padding":M,"--n-space":F,"--n-space-arrow":R}}),b=t.computed(()=>{const v=n.width==="trigger"?void 0:ll(n.width),E=[];v&&E.push({width:v});const{maxWidth:P,minWidth:F}=n;return P&&E.push({maxWidth:ll(P)}),F&&E.push({maxWidth:ll(F)}),s||E.push(g.value),E}),y=s?Hi("popover",void 0,g,n):void 0;u.setBodyInstance({syncPosition:_}),t.onBeforeUnmount(()=>{u.setBodyInstance(null)}),t.watch(t.toRef(n,"show"),v=>{n.animated||(v?h.value=!0:h.value=!1)});function _(){var v;(v=d.value)===null||v===void 0||v.syncPosition()}function x(v){n.trigger==="hover"&&n.keepAliveOnHover&&n.show&&u.handleMouseEnter(v)}function w(v){n.trigger==="hover"&&n.keepAliveOnHover&&u.handleMouseLeave(v)}function C(v){n.trigger==="hover"&&!k().contains(Wr(v))&&u.handleMouseMoveOutside(v)}function N(v){(n.trigger==="click"&&!k().contains(Wr(v))||n.onClickoutside)&&u.handleClickOutside(v)}function k(){return u.getTriggerElement()}t.provide(Eh,f),t.provide(Th,null),t.provide($h,null);function $(){if(y==null||y.onRender(),!(n.displayDirective==="show"||n.show||n.animated&&p.value))return null;let E;const P=u.internalRenderBodyRef.value,{value:F}=o;if(P)E=P([`${F}-popover-shared`,(c==null?void 0:c.value)&&`${F}-popover--rtl`,y==null?void 0:y.themeClass.value,n.overlap&&`${F}-popover-shared--overlap`,n.showArrow&&`${F}-popover-shared--show-arrow`,n.arrowPointToCenter&&`${F}-popover-shared--center-arrow`],f,b.value,x,w);else{const{value:R}=u.extraClassRef,{internalTrapFocus:M}=n,X=!Wh(e.header)||!Wh(e.footer),G=()=>{var Z,O;const A=X?t.h(t.Fragment,null,zi(e.header,T=>T?t.h("div",{class:[`${F}-popover__header`,n.headerClass],style:n.headerStyle},T):null),zi(e.default,T=>T?t.h("div",{class:[`${F}-popover__content`,n.contentClass],style:n.contentStyle},e):null),zi(e.footer,T=>T?t.h("div",{class:[`${F}-popover__footer`,n.footerClass],style:n.footerStyle},T):null)):n.scrollable?(Z=e.default)===null||Z===void 0?void 0:Z.call(e):t.h("div",{class:[`${F}-popover__content`,n.contentClass],style:n.contentStyle},e),Y=n.scrollable?t.h(ZB,{themeOverrides:l.value.peerOverrides.Scrollbar,theme:l.value.peers.Scrollbar,contentClass:X?void 0:`${F}-popover__content ${(O=n.contentClass)!==null&&O!==void 0?O:""}`,contentStyle:X?void 0:n.contentStyle},{default:()=>A}):A,H=n.showArrow?u5({arrowClass:n.arrowClass,arrowStyle:n.arrowStyle,arrowWrapperClass:n.arrowWrapperClass,arrowWrapperStyle:n.arrowWrapperStyle,clsPrefix:F}):null;return[Y,H]};E=t.h("div",t.mergeProps({class:[`${F}-popover`,`${F}-popover-shared`,(c==null?void 0:c.value)&&`${F}-popover--rtl`,y==null?void 0:y.themeClass.value,R.map(Z=>`${F}-${Z}`),{[`${F}-popover--scrollable`]:n.scrollable,[`${F}-popover--show-header-or-footer`]:X,[`${F}-popover--raw`]:n.raw,[`${F}-popover-shared--overlap`]:n.overlap,[`${F}-popover-shared--show-arrow`]:n.showArrow,[`${F}-popover-shared--center-arrow`]:n.arrowPointToCenter}],ref:f,style:b.value,onKeydown:u.handleKeydown,onMouseenter:x,onMouseleave:w},i),M?t.h(PS,{active:n.show,autoFocus:!0},{default:G}):G())}return t.withDirectives(E,m.value)}return{displayed:p,namespace:r,isMounted:u.isMountedRef,zIndex:u.zIndexRef,followerRef:d,adjustedTo:Gn(n),followerEnabled:h,renderContentNode:$}},render(){return t.h(ih,{ref:"followerRef",zIndex:this.zIndex,show:this.show,enabled:this.followerEnabled,to:this.adjustedTo,x:this.x,y:this.y,flip:this.flip,placement:this.placement,containerClass:this.namespace,overlap:this.overlap,width:this.width==="trigger"?"target":void 0,teleportDisabled:this.adjustedTo===Gn.tdkey},{default:()=>this.animated?t.h(t.Transition,{name:"popover-transition",appear:this.isMounted,onEnter:()=>{this.followerEnabled=!0},onAfterLeave:()=>{var n;(n=this.internalOnAfterLeave)===null||n===void 0||n.call(this),this.followerEnabled=!1,this.displayed=!1}},{default:this.renderContentNode}):this.renderContentNode()})}});var h5={};const m5=Object.keys(lm),p5={focus:["onFocus","onBlur"],click:["onClick"],hover:["onMouseenter","onMouseleave"],manual:[],nested:["onFocus","onBlur","onMouseenter","onMouseleave","onClick"]};function g5(n,e,i){p5[e].forEach(r=>{n.props?n.props=Object.assign({},n.props):n.props={};const o=n.props[r],s=i[r];o?n.props[r]=(...a)=>{o(...a),s(...a)}:n.props[r]=s})}const y5={show:{type:Boolean,default:void 0},defaultShow:Boolean,showArrow:{type:Boolean,default:!0},trigger:{type:String,default:"hover"},delay:{type:Number,default:100},duration:{type:Number,default:100},raw:Boolean,placement:{type:String,default:"top"},x:Number,y:Number,arrowPointToCenter:Boolean,disabled:Boolean,getDisabled:Function,displayDirective:{type:String,default:"if"},arrowClass:String,arrowStyle:[String,Object],arrowWrapperClass:String,arrowWrapperStyle:[String,Object],flip:{type:Boolean,default:!0},animated:{type:Boolean,default:!0},width:{type:[Number,String],default:void 0},overlap:Boolean,keepAliveOnHover:{type:Boolean,default:!0},zIndex:Number,to:Gn.propTo,scrollable:Boolean,contentClass:String,contentStyle:[Object,String],headerClass:String,headerStyle:[Object,String],footerClass:String,footerStyle:[Object,String],onClickoutside:Function,"onUpdate:show":[Function,Array],onUpdateShow:[Function,Array],internalDeactivateImmediately:Boolean,internalSyncTargetWithParent:Boolean,internalInheritedEventHandlers:{type:Array,default:()=>[]},internalTrapFocus:Boolean,internalExtraClass:{type:Array,default:()=>[]},onShow:[Function,Array],onHide:[Function,Array],arrow:{type:Boolean,default:void 0},minWidth:Number,maxWidth:Number},b5=Object.assign(Object.assign(Object.assign({},Rt.props),y5),{internalOnAfterLeave:Function,internalRenderBody:Function}),_5=t.defineComponent({name:"Popover",inheritAttrs:!1,props:b5,slots:Object,__popover__:!0,setup(n){h5.NODE_ENV!=="production"&&t.watchEffect(()=>{n.maxWidth!==void 0&&bi("popover","`max-width` is deprecated, please use `style` instead."),n.minWidth!==void 0&&bi("popover","`min-width` is deprecated, please use `style` instead."),n.arrow!==void 0&&bi("popover","`arrow` is deprecated, please use `showArrow` instead."),n.onHide!==void 0&&bi("popover","`on-hide` is deprecated, please use `on-update:show` instead."),n.onShow!==void 0&&bi("popover","`on-show` is deprecated, please use `on-update:show` instead.")});const e=as(),i=t.ref(null),r=t.computed(()=>n.show),o=t.ref(n.defaultShow),s=Ua(r,o),a=fn(()=>n.disabled?!1:s.value),l=()=>{if(n.disabled)return!0;const{getDisabled:X}=n;return!!(X!=null&&X())},c=()=>l()?!1:s.value,d=Af(n,["arrow","showArrow"]),u=t.computed(()=>n.overlap?!1:d.value);let f=null;const h=t.ref(null),p=t.ref(null),m=fn(()=>n.x!==void 0&&n.y!==void 0);function g(X){const{"onUpdate:show":G,onUpdateShow:Z,onShow:O,onHide:A}=n;o.value=X,G&&Et(G,X),Z&&Et(Z,X),X&&O&&Et(O,!0),X&&A&&Et(A,!1)}function b(){f&&f.syncPosition()}function y(){const{value:X}=h;X&&(window.clearTimeout(X),h.value=null)}function _(){const{value:X}=p;X&&(window.clearTimeout(X),p.value=null)}function x(){const X=l();if(n.trigger==="focus"&&!X){if(c())return;g(!0)}}function w(){const X=l();if(n.trigger==="focus"&&!X){if(!c())return;g(!1)}}function C(){const X=l();if(n.trigger==="hover"&&!X){if(_(),h.value!==null||c())return;const G=()=>{g(!0),h.value=null},{delay:Z}=n;Z===0?G():h.value=window.setTimeout(G,Z)}}function N(){const X=l();if(n.trigger==="hover"&&!X){if(y(),p.value!==null||!c())return;const G=()=>{g(!1),p.value=null},{duration:Z}=n;Z===0?G():p.value=window.setTimeout(G,Z)}}function k(){N()}function $(X){var G;c()&&(n.trigger==="click"&&(y(),_(),g(!1)),(G=n.onClickoutside)===null||G===void 0||G.call(n,X))}function v(){if(n.trigger==="click"&&!l()){y(),_();const X=!c();g(X)}}function E(X){n.internalTrapFocus&&X.key==="Escape"&&(y(),_(),g(!1))}function P(X){o.value=X}function F(){var X;return(X=i.value)===null||X===void 0?void 0:X.targetRef}function R(X){f=X}return t.provide("NPopover",{getTriggerElement:F,handleKeydown:E,handleMouseEnter:C,handleMouseLeave:N,handleClickOutside:$,handleMouseMoveOutside:k,setBodyInstance:R,positionManuallyRef:m,isMountedRef:e,zIndexRef:t.toRef(n,"zIndex"),extraClassRef:t.toRef(n,"internalExtraClass"),internalRenderBodyRef:t.toRef(n,"internalRenderBody")}),t.watchEffect(()=>{s.value&&l()&&g(!1)}),{binderInstRef:i,positionManually:m,mergedShowConsideringDisabledProp:a,uncontrolledShow:o,mergedShowArrow:u,getMergedShow:c,setShow:P,handleClick:v,handleMouseEnter:C,handleMouseLeave:N,handleFocus:x,handleBlur:w,syncPosition:b}},render(){var n;const{positionManually:e,$slots:i}=this;let r,o=!1;if(!e&&(r=WS(i,"trigger"),r)){r=t.cloneVNode(r),r=r.type===t.Text?t.h("span",[r]):r;const s={onClick:this.handleClick,onMouseenter:this.handleMouseEnter,onMouseleave:this.handleMouseLeave,onFocus:this.handleFocus,onBlur:this.handleBlur};if(!((n=r.type)===null||n===void 0)&&n.__popover__)o=!0,r.props||(r.props={internalSyncTargetWithParent:!0,internalInheritedEventHandlers:[]}),r.props.internalSyncTargetWithParent=!0,r.props.internalInheritedEventHandlers?r.props.internalInheritedEventHandlers=[s,...r.props.internalInheritedEventHandlers]:r.props.internalInheritedEventHandlers=[s];else{const{internalInheritedEventHandlers:a}=this,l=[s,...a],c={onBlur:d=>{l.forEach(u=>{u.onBlur(d)})},onFocus:d=>{l.forEach(u=>{u.onFocus(d)})},onClick:d=>{l.forEach(u=>{u.onClick(d)})},onMouseenter:d=>{l.forEach(u=>{u.onMouseenter(d)})},onMouseleave:d=>{l.forEach(u=>{u.onMouseleave(d)})}};g5(r,a?"nested":e?"manual":this.trigger,c)}}return t.h(Lf,{ref:"binderInstRef",syncTarget:!o,syncTargetWithParent:this.internalSyncTargetWithParent},{default:()=>{this.mergedShowConsideringDisabledProp;const s=this.getMergedShow();return[this.internalTrapFocus&&s?t.withDirectives(t.h("div",{style:{position:"fixed",top:0,right:0,bottom:0,left:0}}),[[If,{enabled:s,zIndex:this.zIndex}]]):null,e?null:t.h(Hf,null,{default:()=>r}),t.h(f5,jS(this.$props,m5,Object.assign(Object.assign({},this.$attrs),{showArrow:this.mergedShowArrow,show:s})),{default:()=>{var a,l;return(l=(a=this.$slots).default)===null||l===void 0?void 0:l.call(a)},header:()=>{var a,l;return(l=(a=this.$slots).header)===null||l===void 0?void 0:l.call(a)},footer:()=>{var a,l;return(l=(a=this.$slots).footer)===null||l===void 0?void 0:l.call(a)}})]}})}}),w5={closeIconSizeTiny:"12px",closeIconSizeSmall:"12px",closeIconSizeMedium:"14px",closeIconSizeLarge:"14px",closeSizeTiny:"16px",closeSizeSmall:"16px",closeSizeMedium:"18px",closeSizeLarge:"18px",padding:"0 7px",closeMargin:"0 0 0 4px"};function x5(n){const{textColor2:e,primaryColorHover:i,primaryColorPressed:r,primaryColor:o,infoColor:s,successColor:a,warningColor:l,errorColor:c,baseColor:d,borderColor:u,opacityDisabled:f,tagColor:h,closeIconColor:p,closeIconColorHover:m,closeIconColorPressed:g,borderRadiusSmall:b,fontSizeMini:y,fontSizeTiny:_,fontSizeSmall:x,fontSizeMedium:w,heightMini:C,heightTiny:N,heightSmall:k,heightMedium:$,closeColorHover:v,closeColorPressed:E,buttonColor2Hover:P,buttonColor2Pressed:F,fontWeightStrong:R}=n;return Object.assign(Object.assign({},w5),{closeBorderRadius:b,heightTiny:C,heightSmall:N,heightMedium:k,heightLarge:$,borderRadius:b,opacityDisabled:f,fontSizeTiny:y,fontSizeSmall:_,fontSizeMedium:x,fontSizeLarge:w,fontWeightStrong:R,textColorCheckable:e,textColorHoverCheckable:e,textColorPressedCheckable:e,textColorChecked:d,colorCheckable:"#0000",colorHoverCheckable:P,colorPressedCheckable:F,colorChecked:o,colorCheckedHover:i,colorCheckedPressed:r,border:`1px solid ${u}`,textColor:e,color:h,colorBordered:"rgb(250, 250, 252)",closeIconColor:p,closeIconColorHover:m,closeIconColorPressed:g,closeColorHover:v,closeColorPressed:E,borderPrimary:`1px solid ${Le(o,{alpha:.3})}`,textColorPrimary:o,colorPrimary:Le(o,{alpha:.12}),colorBorderedPrimary:Le(o,{alpha:.1}),closeIconColorPrimary:o,closeIconColorHoverPrimary:o,closeIconColorPressedPrimary:o,closeColorHoverPrimary:Le(o,{alpha:.12}),closeColorPressedPrimary:Le(o,{alpha:.18}),borderInfo:`1px solid ${Le(s,{alpha:.3})}`,textColorInfo:s,colorInfo:Le(s,{alpha:.12}),colorBorderedInfo:Le(s,{alpha:.1}),closeIconColorInfo:s,closeIconColorHoverInfo:s,closeIconColorPressedInfo:s,closeColorHoverInfo:Le(s,{alpha:.12}),closeColorPressedInfo:Le(s,{alpha:.18}),borderSuccess:`1px solid ${Le(a,{alpha:.3})}`,textColorSuccess:a,colorSuccess:Le(a,{alpha:.12}),colorBorderedSuccess:Le(a,{alpha:.1}),closeIconColorSuccess:a,closeIconColorHoverSuccess:a,closeIconColorPressedSuccess:a,closeColorHoverSuccess:Le(a,{alpha:.12}),closeColorPressedSuccess:Le(a,{alpha:.18}),borderWarning:`1px solid ${Le(l,{alpha:.35})}`,textColorWarning:l,colorWarning:Le(l,{alpha:.15}),colorBorderedWarning:Le(l,{alpha:.12}),closeIconColorWarning:l,closeIconColorHoverWarning:l,closeIconColorPressedWarning:l,closeColorHoverWarning:Le(l,{alpha:.12}),closeColorPressedWarning:Le(l,{alpha:.18}),borderError:`1px solid ${Le(c,{alpha:.23})}`,textColorError:c,colorError:Le(c,{alpha:.1}),colorBorderedError:Le(c,{alpha:.08}),closeIconColorError:c,closeIconColorHoverError:c,closeIconColorPressedError:c,closeColorHoverError:Le(c,{alpha:.12}),closeColorPressedError:Le(c,{alpha:.18})})}const k5={common:Wi,self:x5},C5={color:Object,type:{type:String,default:"default"},round:Boolean,size:{type:String,default:"medium"},closable:Boolean,disabled:{type:Boolean,default:void 0}},v5=ke("tag",`
543
+ `,[ke("popover-arrow",e)])])])}const lm=Object.assign(Object.assign({},Rt.props),{to:Gn.propTo,show:Boolean,trigger:String,showArrow:Boolean,delay:Number,duration:Number,raw:Boolean,arrowPointToCenter:Boolean,arrowClass:String,arrowStyle:[String,Object],arrowWrapperClass:String,arrowWrapperStyle:[String,Object],displayDirective:String,x:Number,y:Number,flip:Boolean,overlap:Boolean,placement:String,width:[Number,String],keepAliveOnHover:Boolean,scrollable:Boolean,contentClass:String,contentStyle:[Object,String],headerClass:String,headerStyle:[Object,String],footerClass:String,footerStyle:[Object,String],internalDeactivateImmediately:Boolean,animated:Boolean,onClickoutside:Function,internalTrapFocus:Boolean,internalOnAfterLeave:Function,minWidth:Number,maxWidth:Number});function u5({arrowClass:n,arrowStyle:e,arrowWrapperClass:i,arrowWrapperStyle:r,clsPrefix:o}){return t.h("div",{key:"__popover-arrow__",style:r,class:[`${o}-popover-arrow-wrapper`,i]},t.h("div",{class:[`${o}-popover-arrow`,n],style:e}))}const f5=t.defineComponent({name:"PopoverBody",inheritAttrs:!1,props:lm,setup(n,{slots:e,attrs:i}){const{namespaceRef:r,mergedClsPrefixRef:o,inlineThemeDisabled:s,mergedRtlRef:a}=Li(n),l=Rt("Popover","-popover",d5,am,n,o),c=eo("Popover",a,o),d=t.ref(null),u=t.inject("NPopover"),f=t.ref(null),h=t.ref(n.show),p=t.ref(!1);t.watchEffect(()=>{const{show:v}=n;v&&!DS()&&!n.internalDeactivateImmediately&&(p.value=!0)});const m=t.computed(()=>{const{trigger:v,onClickoutside:E}=n,P=[],{positionManuallyRef:{value:F}}=u;return F||(v==="click"&&!E&&P.push([ss,N,void 0,{capture:!0}]),v==="hover"&&P.push([_v,C])),E&&P.push([ss,N,void 0,{capture:!0}]),(n.displayDirective==="show"||n.animated&&p.value)&&P.push([t.vShow,n.show]),P}),g=t.computed(()=>{const{common:{cubicBezierEaseInOut:v,cubicBezierEaseIn:E,cubicBezierEaseOut:P},self:{space:F,spaceArrow:R,padding:M,fontSize:X,textColor:G,dividerColor:Z,color:O,boxShadow:A,borderRadius:Y,arrowHeight:H,arrowOffset:T,arrowOffsetVertical:D}}=l.value;return{"--n-box-shadow":A,"--n-bezier":v,"--n-bezier-ease-in":E,"--n-bezier-ease-out":P,"--n-font-size":X,"--n-text-color":G,"--n-color":O,"--n-divider-color":Z,"--n-border-radius":Y,"--n-arrow-height":H,"--n-arrow-offset":T,"--n-arrow-offset-vertical":D,"--n-padding":M,"--n-space":F,"--n-space-arrow":R}}),b=t.computed(()=>{const v=n.width==="trigger"?void 0:ll(n.width),E=[];v&&E.push({width:v});const{maxWidth:P,minWidth:F}=n;return P&&E.push({maxWidth:ll(P)}),F&&E.push({maxWidth:ll(F)}),s||E.push(g.value),E}),y=s?Hi("popover",void 0,g,n):void 0;u.setBodyInstance({syncPosition:_}),t.onBeforeUnmount(()=>{u.setBodyInstance(null)}),t.watch(t.toRef(n,"show"),v=>{n.animated||(v?h.value=!0:h.value=!1)});function _(){var v;(v=d.value)===null||v===void 0||v.syncPosition()}function x(v){n.trigger==="hover"&&n.keepAliveOnHover&&n.show&&u.handleMouseEnter(v)}function w(v){n.trigger==="hover"&&n.keepAliveOnHover&&u.handleMouseLeave(v)}function C(v){n.trigger==="hover"&&!k().contains(Wr(v))&&u.handleMouseMoveOutside(v)}function N(v){(n.trigger==="click"&&!k().contains(Wr(v))||n.onClickoutside)&&u.handleClickOutside(v)}function k(){return u.getTriggerElement()}t.provide(Eh,f),t.provide(Th,null),t.provide($h,null);function $(){if(y==null||y.onRender(),!(n.displayDirective==="show"||n.show||n.animated&&p.value))return null;let E;const P=u.internalRenderBodyRef.value,{value:F}=o;if(P)E=P([`${F}-popover-shared`,(c==null?void 0:c.value)&&`${F}-popover--rtl`,y==null?void 0:y.themeClass.value,n.overlap&&`${F}-popover-shared--overlap`,n.showArrow&&`${F}-popover-shared--show-arrow`,n.arrowPointToCenter&&`${F}-popover-shared--center-arrow`],f,b.value,x,w);else{const{value:R}=u.extraClassRef,{internalTrapFocus:M}=n,X=!Wh(e.header)||!Wh(e.footer),G=()=>{var Z,O;const A=X?t.h(t.Fragment,null,zi(e.header,T=>T?t.h("div",{class:[`${F}-popover__header`,n.headerClass],style:n.headerStyle},T):null),zi(e.default,T=>T?t.h("div",{class:[`${F}-popover__content`,n.contentClass],style:n.contentStyle},e):null),zi(e.footer,T=>T?t.h("div",{class:[`${F}-popover__footer`,n.footerClass],style:n.footerStyle},T):null)):n.scrollable?(Z=e.default)===null||Z===void 0?void 0:Z.call(e):t.h("div",{class:[`${F}-popover__content`,n.contentClass],style:n.contentStyle},e),Y=n.scrollable?t.h(ZB,{themeOverrides:l.value.peerOverrides.Scrollbar,theme:l.value.peers.Scrollbar,contentClass:X?void 0:`${F}-popover__content ${(O=n.contentClass)!==null&&O!==void 0?O:""}`,contentStyle:X?void 0:n.contentStyle},{default:()=>A}):A,H=n.showArrow?u5({arrowClass:n.arrowClass,arrowStyle:n.arrowStyle,arrowWrapperClass:n.arrowWrapperClass,arrowWrapperStyle:n.arrowWrapperStyle,clsPrefix:F}):null;return[Y,H]};E=t.h("div",t.mergeProps({class:[`${F}-popover`,`${F}-popover-shared`,(c==null?void 0:c.value)&&`${F}-popover--rtl`,y==null?void 0:y.themeClass.value,R.map(Z=>`${F}-${Z}`),{[`${F}-popover--scrollable`]:n.scrollable,[`${F}-popover--show-header-or-footer`]:X,[`${F}-popover--raw`]:n.raw,[`${F}-popover-shared--overlap`]:n.overlap,[`${F}-popover-shared--show-arrow`]:n.showArrow,[`${F}-popover-shared--center-arrow`]:n.arrowPointToCenter}],ref:f,style:b.value,onKeydown:u.handleKeydown,onMouseenter:x,onMouseleave:w},i),M?t.h(PS,{active:n.show,autoFocus:!0},{default:G}):G())}return t.withDirectives(E,m.value)}return{displayed:p,namespace:r,isMounted:u.isMountedRef,zIndex:u.zIndexRef,followerRef:d,adjustedTo:Gn(n),followerEnabled:h,renderContentNode:$}},render(){return t.h(ih,{ref:"followerRef",zIndex:this.zIndex,show:this.show,enabled:this.followerEnabled,to:this.adjustedTo,x:this.x,y:this.y,flip:this.flip,placement:this.placement,containerClass:this.namespace,overlap:this.overlap,width:this.width==="trigger"?"target":void 0,teleportDisabled:this.adjustedTo===Gn.tdkey},{default:()=>this.animated?t.h(t.Transition,{name:"popover-transition",appear:this.isMounted,onEnter:()=>{this.followerEnabled=!0},onAfterLeave:()=>{var n;(n=this.internalOnAfterLeave)===null||n===void 0||n.call(this),this.followerEnabled=!1,this.displayed=!1}},{default:this.renderContentNode}):this.renderContentNode()})}});var h5={};const m5=Object.keys(lm),p5={focus:["onFocus","onBlur"],click:["onClick"],hover:["onMouseenter","onMouseleave"],manual:[],nested:["onFocus","onBlur","onMouseenter","onMouseleave","onClick"]};function g5(n,e,i){p5[e].forEach(r=>{n.props?n.props=Object.assign({},n.props):n.props={};const o=n.props[r],s=i[r];o?n.props[r]=(...a)=>{o(...a),s(...a)}:n.props[r]=s})}const y5={show:{type:Boolean,default:void 0},defaultShow:Boolean,showArrow:{type:Boolean,default:!0},trigger:{type:String,default:"hover"},delay:{type:Number,default:100},duration:{type:Number,default:100},raw:Boolean,placement:{type:String,default:"top"},x:Number,y:Number,arrowPointToCenter:Boolean,disabled:Boolean,getDisabled:Function,displayDirective:{type:String,default:"if"},arrowClass:String,arrowStyle:[String,Object],arrowWrapperClass:String,arrowWrapperStyle:[String,Object],flip:{type:Boolean,default:!0},animated:{type:Boolean,default:!0},width:{type:[Number,String],default:void 0},overlap:Boolean,keepAliveOnHover:{type:Boolean,default:!0},zIndex:Number,to:Gn.propTo,scrollable:Boolean,contentClass:String,contentStyle:[Object,String],headerClass:String,headerStyle:[Object,String],footerClass:String,footerStyle:[Object,String],onClickoutside:Function,"onUpdate:show":[Function,Array],onUpdateShow:[Function,Array],internalDeactivateImmediately:Boolean,internalSyncTargetWithParent:Boolean,internalInheritedEventHandlers:{type:Array,default:()=>[]},internalTrapFocus:Boolean,internalExtraClass:{type:Array,default:()=>[]},onShow:[Function,Array],onHide:[Function,Array],arrow:{type:Boolean,default:void 0},minWidth:Number,maxWidth:Number},b5=Object.assign(Object.assign(Object.assign({},Rt.props),y5),{internalOnAfterLeave:Function,internalRenderBody:Function}),_5=t.defineComponent({name:"Popover",inheritAttrs:!1,props:b5,slots:Object,__popover__:!0,setup(n){h5.NODE_ENV!=="production"&&t.watchEffect(()=>{n.maxWidth!==void 0&&bi("popover","`max-width` is deprecated, please use `style` instead."),n.minWidth!==void 0&&bi("popover","`min-width` is deprecated, please use `style` instead."),n.arrow!==void 0&&bi("popover","`arrow` is deprecated, please use `showArrow` instead."),n.onHide!==void 0&&bi("popover","`on-hide` is deprecated, please use `on-update:show` instead."),n.onShow!==void 0&&bi("popover","`on-show` is deprecated, please use `on-update:show` instead.")});const e=as(),i=t.ref(null),r=t.computed(()=>n.show),o=t.ref(n.defaultShow),s=Ua(r,o),a=hn(()=>n.disabled?!1:s.value),l=()=>{if(n.disabled)return!0;const{getDisabled:X}=n;return!!(X!=null&&X())},c=()=>l()?!1:s.value,d=Af(n,["arrow","showArrow"]),u=t.computed(()=>n.overlap?!1:d.value);let f=null;const h=t.ref(null),p=t.ref(null),m=hn(()=>n.x!==void 0&&n.y!==void 0);function g(X){const{"onUpdate:show":G,onUpdateShow:Z,onShow:O,onHide:A}=n;o.value=X,G&&Et(G,X),Z&&Et(Z,X),X&&O&&Et(O,!0),X&&A&&Et(A,!1)}function b(){f&&f.syncPosition()}function y(){const{value:X}=h;X&&(window.clearTimeout(X),h.value=null)}function _(){const{value:X}=p;X&&(window.clearTimeout(X),p.value=null)}function x(){const X=l();if(n.trigger==="focus"&&!X){if(c())return;g(!0)}}function w(){const X=l();if(n.trigger==="focus"&&!X){if(!c())return;g(!1)}}function C(){const X=l();if(n.trigger==="hover"&&!X){if(_(),h.value!==null||c())return;const G=()=>{g(!0),h.value=null},{delay:Z}=n;Z===0?G():h.value=window.setTimeout(G,Z)}}function N(){const X=l();if(n.trigger==="hover"&&!X){if(y(),p.value!==null||!c())return;const G=()=>{g(!1),p.value=null},{duration:Z}=n;Z===0?G():p.value=window.setTimeout(G,Z)}}function k(){N()}function $(X){var G;c()&&(n.trigger==="click"&&(y(),_(),g(!1)),(G=n.onClickoutside)===null||G===void 0||G.call(n,X))}function v(){if(n.trigger==="click"&&!l()){y(),_();const X=!c();g(X)}}function E(X){n.internalTrapFocus&&X.key==="Escape"&&(y(),_(),g(!1))}function P(X){o.value=X}function F(){var X;return(X=i.value)===null||X===void 0?void 0:X.targetRef}function R(X){f=X}return t.provide("NPopover",{getTriggerElement:F,handleKeydown:E,handleMouseEnter:C,handleMouseLeave:N,handleClickOutside:$,handleMouseMoveOutside:k,setBodyInstance:R,positionManuallyRef:m,isMountedRef:e,zIndexRef:t.toRef(n,"zIndex"),extraClassRef:t.toRef(n,"internalExtraClass"),internalRenderBodyRef:t.toRef(n,"internalRenderBody")}),t.watchEffect(()=>{s.value&&l()&&g(!1)}),{binderInstRef:i,positionManually:m,mergedShowConsideringDisabledProp:a,uncontrolledShow:o,mergedShowArrow:u,getMergedShow:c,setShow:P,handleClick:v,handleMouseEnter:C,handleMouseLeave:N,handleFocus:x,handleBlur:w,syncPosition:b}},render(){var n;const{positionManually:e,$slots:i}=this;let r,o=!1;if(!e&&(r=WS(i,"trigger"),r)){r=t.cloneVNode(r),r=r.type===t.Text?t.h("span",[r]):r;const s={onClick:this.handleClick,onMouseenter:this.handleMouseEnter,onMouseleave:this.handleMouseLeave,onFocus:this.handleFocus,onBlur:this.handleBlur};if(!((n=r.type)===null||n===void 0)&&n.__popover__)o=!0,r.props||(r.props={internalSyncTargetWithParent:!0,internalInheritedEventHandlers:[]}),r.props.internalSyncTargetWithParent=!0,r.props.internalInheritedEventHandlers?r.props.internalInheritedEventHandlers=[s,...r.props.internalInheritedEventHandlers]:r.props.internalInheritedEventHandlers=[s];else{const{internalInheritedEventHandlers:a}=this,l=[s,...a],c={onBlur:d=>{l.forEach(u=>{u.onBlur(d)})},onFocus:d=>{l.forEach(u=>{u.onFocus(d)})},onClick:d=>{l.forEach(u=>{u.onClick(d)})},onMouseenter:d=>{l.forEach(u=>{u.onMouseenter(d)})},onMouseleave:d=>{l.forEach(u=>{u.onMouseleave(d)})}};g5(r,a?"nested":e?"manual":this.trigger,c)}}return t.h(Lf,{ref:"binderInstRef",syncTarget:!o,syncTargetWithParent:this.internalSyncTargetWithParent},{default:()=>{this.mergedShowConsideringDisabledProp;const s=this.getMergedShow();return[this.internalTrapFocus&&s?t.withDirectives(t.h("div",{style:{position:"fixed",top:0,right:0,bottom:0,left:0}}),[[If,{enabled:s,zIndex:this.zIndex}]]):null,e?null:t.h(Hf,null,{default:()=>r}),t.h(f5,jS(this.$props,m5,Object.assign(Object.assign({},this.$attrs),{showArrow:this.mergedShowArrow,show:s})),{default:()=>{var a,l;return(l=(a=this.$slots).default)===null||l===void 0?void 0:l.call(a)},header:()=>{var a,l;return(l=(a=this.$slots).header)===null||l===void 0?void 0:l.call(a)},footer:()=>{var a,l;return(l=(a=this.$slots).footer)===null||l===void 0?void 0:l.call(a)}})]}})}}),w5={closeIconSizeTiny:"12px",closeIconSizeSmall:"12px",closeIconSizeMedium:"14px",closeIconSizeLarge:"14px",closeSizeTiny:"16px",closeSizeSmall:"16px",closeSizeMedium:"18px",closeSizeLarge:"18px",padding:"0 7px",closeMargin:"0 0 0 4px"};function x5(n){const{textColor2:e,primaryColorHover:i,primaryColorPressed:r,primaryColor:o,infoColor:s,successColor:a,warningColor:l,errorColor:c,baseColor:d,borderColor:u,opacityDisabled:f,tagColor:h,closeIconColor:p,closeIconColorHover:m,closeIconColorPressed:g,borderRadiusSmall:b,fontSizeMini:y,fontSizeTiny:_,fontSizeSmall:x,fontSizeMedium:w,heightMini:C,heightTiny:N,heightSmall:k,heightMedium:$,closeColorHover:v,closeColorPressed:E,buttonColor2Hover:P,buttonColor2Pressed:F,fontWeightStrong:R}=n;return Object.assign(Object.assign({},w5),{closeBorderRadius:b,heightTiny:C,heightSmall:N,heightMedium:k,heightLarge:$,borderRadius:b,opacityDisabled:f,fontSizeTiny:y,fontSizeSmall:_,fontSizeMedium:x,fontSizeLarge:w,fontWeightStrong:R,textColorCheckable:e,textColorHoverCheckable:e,textColorPressedCheckable:e,textColorChecked:d,colorCheckable:"#0000",colorHoverCheckable:P,colorPressedCheckable:F,colorChecked:o,colorCheckedHover:i,colorCheckedPressed:r,border:`1px solid ${u}`,textColor:e,color:h,colorBordered:"rgb(250, 250, 252)",closeIconColor:p,closeIconColorHover:m,closeIconColorPressed:g,closeColorHover:v,closeColorPressed:E,borderPrimary:`1px solid ${Le(o,{alpha:.3})}`,textColorPrimary:o,colorPrimary:Le(o,{alpha:.12}),colorBorderedPrimary:Le(o,{alpha:.1}),closeIconColorPrimary:o,closeIconColorHoverPrimary:o,closeIconColorPressedPrimary:o,closeColorHoverPrimary:Le(o,{alpha:.12}),closeColorPressedPrimary:Le(o,{alpha:.18}),borderInfo:`1px solid ${Le(s,{alpha:.3})}`,textColorInfo:s,colorInfo:Le(s,{alpha:.12}),colorBorderedInfo:Le(s,{alpha:.1}),closeIconColorInfo:s,closeIconColorHoverInfo:s,closeIconColorPressedInfo:s,closeColorHoverInfo:Le(s,{alpha:.12}),closeColorPressedInfo:Le(s,{alpha:.18}),borderSuccess:`1px solid ${Le(a,{alpha:.3})}`,textColorSuccess:a,colorSuccess:Le(a,{alpha:.12}),colorBorderedSuccess:Le(a,{alpha:.1}),closeIconColorSuccess:a,closeIconColorHoverSuccess:a,closeIconColorPressedSuccess:a,closeColorHoverSuccess:Le(a,{alpha:.12}),closeColorPressedSuccess:Le(a,{alpha:.18}),borderWarning:`1px solid ${Le(l,{alpha:.35})}`,textColorWarning:l,colorWarning:Le(l,{alpha:.15}),colorBorderedWarning:Le(l,{alpha:.12}),closeIconColorWarning:l,closeIconColorHoverWarning:l,closeIconColorPressedWarning:l,closeColorHoverWarning:Le(l,{alpha:.12}),closeColorPressedWarning:Le(l,{alpha:.18}),borderError:`1px solid ${Le(c,{alpha:.23})}`,textColorError:c,colorError:Le(c,{alpha:.1}),colorBorderedError:Le(c,{alpha:.08}),closeIconColorError:c,closeIconColorHoverError:c,closeIconColorPressedError:c,closeColorHoverError:Le(c,{alpha:.12}),closeColorPressedError:Le(c,{alpha:.18})})}const k5={common:Wi,self:x5},C5={color:Object,type:{type:String,default:"default"},round:Boolean,size:{type:String,default:"medium"},closable:Boolean,disabled:{type:Boolean,default:void 0}},v5=ke("tag",`
544
544
  --n-close-margin: var(--n-close-margin-top) var(--n-close-margin-right) var(--n-close-margin-bottom) var(--n-close-margin-left);
545
545
  white-space: nowrap;
546
546
  position: relative;
@@ -810,7 +810,7 @@ ${o}
810
810
  line-height: 1.25;
811
811
  text-overflow: ellipsis;
812
812
  overflow: hidden;
813
- `)])])]),P5=t.defineComponent({name:"InternalSelection",props:Object.assign(Object.assign({},Rt.props),{clsPrefix:{type:String,required:!0},bordered:{type:Boolean,default:void 0},active:Boolean,pattern:{type:String,default:""},placeholder:String,selectedOption:{type:Object,default:null},selectedOptions:{type:Array,default:null},labelField:{type:String,default:"label"},valueField:{type:String,default:"value"},multiple:Boolean,filterable:Boolean,clearable:Boolean,disabled:Boolean,size:{type:String,default:"medium"},loading:Boolean,autofocus:Boolean,showArrow:{type:Boolean,default:!0},inputProps:Object,focused:Boolean,renderTag:Function,onKeydown:Function,onClick:Function,onBlur:Function,onFocus:Function,onDeleteOption:Function,maxTagCount:[String,Number],ellipsisTagPopoverProps:Object,onClear:Function,onPatternInput:Function,onPatternFocus:Function,onPatternBlur:Function,renderLabel:Function,status:String,inlineThemeDisabled:Boolean,ignoreComposition:{type:Boolean,default:!0},onResize:Function}),setup(n){const{mergedClsPrefixRef:e,mergedRtlRef:i}=Li(n),r=eo("InternalSelection",i,e),o=t.ref(null),s=t.ref(null),a=t.ref(null),l=t.ref(null),c=t.ref(null),d=t.ref(null),u=t.ref(null),f=t.ref(null),h=t.ref(null),p=t.ref(null),m=t.ref(!1),g=t.ref(!1),b=t.ref(!1),y=Rt("InternalSelection","-internal-selection",R5,cm,n,t.toRef(n,"clsPrefix")),_=t.computed(()=>n.clearable&&!n.disabled&&(b.value||n.active)),x=t.computed(()=>n.selectedOption?n.renderTag?n.renderTag({option:n.selectedOption,handleClose:()=>{}}):n.renderLabel?n.renderLabel(n.selectedOption,!0):Cr(n.selectedOption[n.labelField],n.selectedOption,!0):n.placeholder),w=t.computed(()=>{const ae=n.selectedOption;if(ae)return ae[n.labelField]}),C=t.computed(()=>n.multiple?!!(Array.isArray(n.selectedOptions)&&n.selectedOptions.length):n.selectedOption!==null);function N(){var ae;const{value:de}=o;if(de){const{value:Ge}=s;Ge&&(Ge.style.width=`${de.offsetWidth}px`,n.maxTagCount!=="responsive"&&((ae=h.value)===null||ae===void 0||ae.sync({showAllItemsBeforeCalculate:!1})))}}function k(){const{value:ae}=p;ae&&(ae.style.display="none")}function $(){const{value:ae}=p;ae&&(ae.style.display="inline-block")}t.watch(t.toRef(n,"active"),ae=>{ae||k()}),t.watch(t.toRef(n,"pattern"),()=>{n.multiple&&t.nextTick(N)});function v(ae){const{onFocus:de}=n;de&&de(ae)}function E(ae){const{onBlur:de}=n;de&&de(ae)}function P(ae){const{onDeleteOption:de}=n;de&&de(ae)}function F(ae){const{onClear:de}=n;de&&de(ae)}function R(ae){const{onPatternInput:de}=n;de&&de(ae)}function M(ae){var de;(!ae.relatedTarget||!(!((de=a.value)===null||de===void 0)&&de.contains(ae.relatedTarget)))&&v(ae)}function X(ae){var de;!((de=a.value)===null||de===void 0)&&de.contains(ae.relatedTarget)||E(ae)}function G(ae){F(ae)}function Z(){b.value=!0}function O(){b.value=!1}function A(ae){!n.active||!n.filterable||ae.target!==s.value&&ae.preventDefault()}function Y(ae){P(ae)}const H=t.ref(!1);function T(ae){if(ae.key==="Backspace"&&!H.value&&!n.pattern.length){const{selectedOptions:de}=n;de!=null&&de.length&&Y(de[de.length-1])}}let D=null;function K(ae){const{value:de}=o;if(de){const Ge=ae.target.value;de.textContent=Ge,N()}n.ignoreComposition&&H.value?D=ae:R(ae)}function J(){H.value=!0}function U(){H.value=!1,n.ignoreComposition&&R(D),D=null}function q(ae){var de;g.value=!0,(de=n.onPatternFocus)===null||de===void 0||de.call(n,ae)}function L(ae){var de;g.value=!1,(de=n.onPatternBlur)===null||de===void 0||de.call(n,ae)}function le(){var ae,de;if(n.filterable)g.value=!1,(ae=d.value)===null||ae===void 0||ae.blur(),(de=s.value)===null||de===void 0||de.blur();else if(n.multiple){const{value:Ge}=l;Ge==null||Ge.blur()}else{const{value:Ge}=c;Ge==null||Ge.blur()}}function ue(){var ae,de,Ge;n.filterable?(g.value=!1,(ae=d.value)===null||ae===void 0||ae.focus()):n.multiple?(de=l.value)===null||de===void 0||de.focus():(Ge=c.value)===null||Ge===void 0||Ge.focus()}function oe(){const{value:ae}=s;ae&&($(),ae.focus())}function fe(){const{value:ae}=s;ae&&ae.blur()}function ge(ae){const{value:de}=u;de&&de.setTextContent(`+${ae}`)}function _e(){const{value:ae}=f;return ae}function Qe(){return s.value}let Re=null;function Mt(){Re!==null&&window.clearTimeout(Re)}function vn(){n.active||(Mt(),Re=window.setTimeout(()=>{C.value&&(m.value=!0)},100))}function It(){Mt()}function en(ae){ae||(Mt(),m.value=!1)}t.watch(C,ae=>{ae||(m.value=!1)}),t.onMounted(()=>{t.watchEffect(()=>{const ae=d.value;ae&&(n.disabled?ae.removeAttribute("tabindex"):ae.tabIndex=g.value?-1:0)})}),Ph(a,n.onResize);const{inlineThemeDisabled:Ln}=n,mn=t.computed(()=>{const{size:ae}=n,{common:{cubicBezierEaseInOut:de},self:{fontWeight:Ge,borderRadius:Ui,color:oi,placeholderColor:si,textColor:at,paddingSingle:qe,paddingMultiple:on,caretColor:sn,colorDisabled:lt,textColorDisabled:jt,placeholderColorDisabled:z,colorActive:Q,boxShadowFocus:se,boxShadowActive:ye,boxShadowHover:we,border:Ce,borderFocus:Ne,borderHover:$e,borderActive:rt,arrowColor:Hn,arrowColorDisabled:Bl,loadingColor:Nl,colorActiveWarning:Tl,boxShadowFocusWarning:$l,boxShadowActiveWarning:El,boxShadowHoverWarning:Rl,borderWarning:Pl,borderFocusWarning:Fl,borderHoverWarning:Vl,borderActiveWarning:Ml,colorActiveError:Il,boxShadowFocusError:Al,boxShadowActiveError:Ol,boxShadowHoverError:zl,borderError:Dl,borderFocusError:Ll,borderHoverError:Hl,borderActiveError:kT,clearColor:CT,clearColorHover:vT,clearColorPressed:ST,clearSize:BT,arrowSize:NT,[st("height",ae)]:TT,[st("fontSize",ae)]:$T}}=y.value,vs=xn(qe),Ss=xn(on);return{"--n-bezier":de,"--n-border":Ce,"--n-border-active":rt,"--n-border-focus":Ne,"--n-border-hover":$e,"--n-border-radius":Ui,"--n-box-shadow-active":ye,"--n-box-shadow-focus":se,"--n-box-shadow-hover":we,"--n-caret-color":sn,"--n-color":oi,"--n-color-active":Q,"--n-color-disabled":lt,"--n-font-size":$T,"--n-height":TT,"--n-padding-single-top":vs.top,"--n-padding-multiple-top":Ss.top,"--n-padding-single-right":vs.right,"--n-padding-multiple-right":Ss.right,"--n-padding-single-left":vs.left,"--n-padding-multiple-left":Ss.left,"--n-padding-single-bottom":vs.bottom,"--n-padding-multiple-bottom":Ss.bottom,"--n-placeholder-color":si,"--n-placeholder-color-disabled":z,"--n-text-color":at,"--n-text-color-disabled":jt,"--n-arrow-color":Hn,"--n-arrow-color-disabled":Bl,"--n-loading-color":Nl,"--n-color-active-warning":Tl,"--n-box-shadow-focus-warning":$l,"--n-box-shadow-active-warning":El,"--n-box-shadow-hover-warning":Rl,"--n-border-warning":Pl,"--n-border-focus-warning":Fl,"--n-border-hover-warning":Vl,"--n-border-active-warning":Ml,"--n-color-active-error":Il,"--n-box-shadow-focus-error":Al,"--n-box-shadow-active-error":Ol,"--n-box-shadow-hover-error":zl,"--n-border-error":Dl,"--n-border-focus-error":Ll,"--n-border-hover-error":Hl,"--n-border-active-error":kT,"--n-clear-size":BT,"--n-clear-color":CT,"--n-clear-color-hover":vT,"--n-clear-color-pressed":ST,"--n-arrow-size":NT,"--n-font-weight":Ge}}),_t=Ln?Hi("internal-selection",t.computed(()=>n.size[0]),mn,n):void 0;return{mergedTheme:y,mergedClearable:_,mergedClsPrefix:e,rtlEnabled:r,patternInputFocused:g,filterablePlaceholder:x,label:w,selected:C,showTagsPanel:m,isComposing:H,counterRef:u,counterWrapperRef:f,patternInputMirrorRef:o,patternInputRef:s,selfRef:a,multipleElRef:l,singleElRef:c,patternInputWrapperRef:d,overflowRef:h,inputTagElRef:p,handleMouseDown:A,handleFocusin:M,handleClear:G,handleMouseEnter:Z,handleMouseLeave:O,handleDeleteOption:Y,handlePatternKeyDown:T,handlePatternInputInput:K,handlePatternInputBlur:L,handlePatternInputFocus:q,handleMouseEnterCounter:vn,handleMouseLeaveCounter:It,handleFocusout:X,handleCompositionEnd:U,handleCompositionStart:J,onPopoverUpdateShow:en,focus:ue,focusInput:oe,blur:le,blurInput:fe,updateCounter:ge,getCounter:_e,getTail:Qe,renderLabel:n.renderLabel,cssVars:Ln?void 0:mn,themeClass:_t==null?void 0:_t.themeClass,onRender:_t==null?void 0:_t.onRender}},render(){const{status:n,multiple:e,size:i,disabled:r,filterable:o,maxTagCount:s,bordered:a,clsPrefix:l,ellipsisTagPopoverProps:c,onRender:d,renderTag:u,renderLabel:f}=this;d==null||d();const h=s==="responsive",p=typeof s=="number",m=h||p,g=t.h(hl,null,{default:()=>t.h(T5,{clsPrefix:l,loading:this.loading,showArrow:this.showArrow,showClear:this.mergedClearable&&this.selected,onClear:this.handleClear},{default:()=>{var y,_;return(_=(y=this.$slots).arrow)===null||_===void 0?void 0:_.call(y)}})});let b;if(e){const{labelField:y}=this,_=R=>t.h("div",{class:`${l}-base-selection-tag-wrapper`,key:R.value},u?u({option:R,handleClose:()=>{this.handleDeleteOption(R)}}):t.h(_l,{size:i,closable:!R.disabled,disabled:r,onClose:()=>{this.handleDeleteOption(R)},internalCloseIsButtonTag:!1,internalCloseFocusable:!1},{default:()=>f?f(R,!0):Cr(R[y],R,!0)})),x=()=>(p?this.selectedOptions.slice(0,s):this.selectedOptions).map(_),w=o?t.h("div",{class:`${l}-base-selection-input-tag`,ref:"inputTagElRef",key:"__input-tag__"},t.h("input",Object.assign({},this.inputProps,{ref:"patternInputRef",tabindex:-1,disabled:r,value:this.pattern,autofocus:this.autofocus,class:`${l}-base-selection-input-tag__input`,onBlur:this.handlePatternInputBlur,onFocus:this.handlePatternInputFocus,onKeydown:this.handlePatternKeyDown,onInput:this.handlePatternInputInput,onCompositionstart:this.handleCompositionStart,onCompositionend:this.handleCompositionEnd})),t.h("span",{ref:"patternInputMirrorRef",class:`${l}-base-selection-input-tag__mirror`},this.pattern)):null,C=h?()=>t.h("div",{class:`${l}-base-selection-tag-wrapper`,ref:"counterWrapperRef"},t.h(_l,{size:i,ref:"counterRef",onMouseenter:this.handleMouseEnterCounter,onMouseleave:this.handleMouseLeaveCounter,disabled:r})):void 0;let N;if(p){const R=this.selectedOptions.length-s;R>0&&(N=t.h("div",{class:`${l}-base-selection-tag-wrapper`,key:"__counter__"},t.h(_l,{size:i,ref:"counterRef",onMouseenter:this.handleMouseEnterCounter,disabled:r},{default:()=>`+${R}`})))}const k=h?o?t.h(kh,{ref:"overflowRef",updateCounter:this.updateCounter,getCounter:this.getCounter,getTail:this.getTail,style:{width:"100%",display:"flex",overflow:"hidden"}},{default:x,counter:C,tail:()=>w}):t.h(kh,{ref:"overflowRef",updateCounter:this.updateCounter,getCounter:this.getCounter,style:{width:"100%",display:"flex",overflow:"hidden"}},{default:x,counter:C}):p&&N?x().concat(N):x(),$=m?()=>t.h("div",{class:`${l}-base-selection-popover`},h?x():this.selectedOptions.map(_)):void 0,v=m?Object.assign({show:this.showTagsPanel,trigger:"hover",overlap:!0,placement:"top",width:"trigger",onUpdateShow:this.onPopoverUpdateShow,theme:this.mergedTheme.peers.Popover,themeOverrides:this.mergedTheme.peerOverrides.Popover},c):null,P=(this.selected?!1:this.active?!this.pattern&&!this.isComposing:!0)?t.h("div",{class:`${l}-base-selection-placeholder ${l}-base-selection-overlay`},t.h("div",{class:`${l}-base-selection-placeholder__inner`},this.placeholder)):null,F=o?t.h("div",{ref:"patternInputWrapperRef",class:`${l}-base-selection-tags`},k,h?null:w,g):t.h("div",{ref:"multipleElRef",class:`${l}-base-selection-tags`,tabindex:r?void 0:0},k,g);b=t.h(t.Fragment,null,m?t.h(_5,Object.assign({},v,{scrollable:!0,style:"max-height: calc(var(--v-target-height) * 6.6);"}),{trigger:()=>F,default:$}):F,P)}else if(o){const y=this.pattern||this.isComposing,_=this.active?!y:!this.selected,x=this.active?!1:this.selected;b=t.h("div",{ref:"patternInputWrapperRef",class:`${l}-base-selection-label`,title:this.patternInputFocused?void 0:zh(this.label)},t.h("input",Object.assign({},this.inputProps,{ref:"patternInputRef",class:`${l}-base-selection-input`,value:this.active?this.pattern:"",placeholder:"",readonly:r,disabled:r,tabindex:-1,autofocus:this.autofocus,onFocus:this.handlePatternInputFocus,onBlur:this.handlePatternInputBlur,onInput:this.handlePatternInputInput,onCompositionstart:this.handleCompositionStart,onCompositionend:this.handleCompositionEnd})),x?t.h("div",{class:`${l}-base-selection-label__render-label ${l}-base-selection-overlay`,key:"input"},t.h("div",{class:`${l}-base-selection-overlay__wrapper`},u?u({option:this.selectedOption,handleClose:()=>{}}):f?f(this.selectedOption,!0):Cr(this.label,this.selectedOption,!0))):null,_?t.h("div",{class:`${l}-base-selection-placeholder ${l}-base-selection-overlay`,key:"placeholder"},t.h("div",{class:`${l}-base-selection-overlay__wrapper`},this.filterablePlaceholder)):null,g)}else b=t.h("div",{ref:"singleElRef",class:`${l}-base-selection-label`,tabindex:this.disabled?void 0:0},this.label!==void 0?t.h("div",{class:`${l}-base-selection-input`,title:zh(this.label),key:"input"},t.h("div",{class:`${l}-base-selection-input__content`},u?u({option:this.selectedOption,handleClose:()=>{}}):f?f(this.selectedOption,!0):Cr(this.label,this.selectedOption,!0))):t.h("div",{class:`${l}-base-selection-placeholder ${l}-base-selection-overlay`,key:"placeholder"},t.h("div",{class:`${l}-base-selection-placeholder__inner`},this.placeholder)),g);return t.h("div",{ref:"selfRef",class:[`${l}-base-selection`,this.rtlEnabled&&`${l}-base-selection--rtl`,this.themeClass,n&&`${l}-base-selection--${n}-status`,{[`${l}-base-selection--active`]:this.active,[`${l}-base-selection--selected`]:this.selected||this.active&&this.pattern,[`${l}-base-selection--disabled`]:this.disabled,[`${l}-base-selection--multiple`]:this.multiple,[`${l}-base-selection--focus`]:this.focused}],style:this.cssVars,onClick:this.onClick,onMouseenter:this.handleMouseEnter,onMouseleave:this.handleMouseLeave,onKeydown:this.onKeydown,onFocusin:this.handleFocusin,onFocusout:this.handleFocusout,onMousedown:this.handleMouseDown},b,a?t.h("div",{class:`${l}-base-selection__border`}):null,a?t.h("div",{class:`${l}-base-selection__state-border`}):null)}});function F5(n){const{boxShadow2:e}=n;return{menuBoxShadow:e}}const V5={name:"Select",common:Wi,peers:{InternalSelection:cm,InternalSelectMenu:tm},self:F5},M5=pe([ke("select",`
813
+ `)])])]),P5=t.defineComponent({name:"InternalSelection",props:Object.assign(Object.assign({},Rt.props),{clsPrefix:{type:String,required:!0},bordered:{type:Boolean,default:void 0},active:Boolean,pattern:{type:String,default:""},placeholder:String,selectedOption:{type:Object,default:null},selectedOptions:{type:Array,default:null},labelField:{type:String,default:"label"},valueField:{type:String,default:"value"},multiple:Boolean,filterable:Boolean,clearable:Boolean,disabled:Boolean,size:{type:String,default:"medium"},loading:Boolean,autofocus:Boolean,showArrow:{type:Boolean,default:!0},inputProps:Object,focused:Boolean,renderTag:Function,onKeydown:Function,onClick:Function,onBlur:Function,onFocus:Function,onDeleteOption:Function,maxTagCount:[String,Number],ellipsisTagPopoverProps:Object,onClear:Function,onPatternInput:Function,onPatternFocus:Function,onPatternBlur:Function,renderLabel:Function,status:String,inlineThemeDisabled:Boolean,ignoreComposition:{type:Boolean,default:!0},onResize:Function}),setup(n){const{mergedClsPrefixRef:e,mergedRtlRef:i}=Li(n),r=eo("InternalSelection",i,e),o=t.ref(null),s=t.ref(null),a=t.ref(null),l=t.ref(null),c=t.ref(null),d=t.ref(null),u=t.ref(null),f=t.ref(null),h=t.ref(null),p=t.ref(null),m=t.ref(!1),g=t.ref(!1),b=t.ref(!1),y=Rt("InternalSelection","-internal-selection",R5,cm,n,t.toRef(n,"clsPrefix")),_=t.computed(()=>n.clearable&&!n.disabled&&(b.value||n.active)),x=t.computed(()=>n.selectedOption?n.renderTag?n.renderTag({option:n.selectedOption,handleClose:()=>{}}):n.renderLabel?n.renderLabel(n.selectedOption,!0):Cr(n.selectedOption[n.labelField],n.selectedOption,!0):n.placeholder),w=t.computed(()=>{const ae=n.selectedOption;if(ae)return ae[n.labelField]}),C=t.computed(()=>n.multiple?!!(Array.isArray(n.selectedOptions)&&n.selectedOptions.length):n.selectedOption!==null);function N(){var ae;const{value:de}=o;if(de){const{value:Ge}=s;Ge&&(Ge.style.width=`${de.offsetWidth}px`,n.maxTagCount!=="responsive"&&((ae=h.value)===null||ae===void 0||ae.sync({showAllItemsBeforeCalculate:!1})))}}function k(){const{value:ae}=p;ae&&(ae.style.display="none")}function $(){const{value:ae}=p;ae&&(ae.style.display="inline-block")}t.watch(t.toRef(n,"active"),ae=>{ae||k()}),t.watch(t.toRef(n,"pattern"),()=>{n.multiple&&t.nextTick(N)});function v(ae){const{onFocus:de}=n;de&&de(ae)}function E(ae){const{onBlur:de}=n;de&&de(ae)}function P(ae){const{onDeleteOption:de}=n;de&&de(ae)}function F(ae){const{onClear:de}=n;de&&de(ae)}function R(ae){const{onPatternInput:de}=n;de&&de(ae)}function M(ae){var de;(!ae.relatedTarget||!(!((de=a.value)===null||de===void 0)&&de.contains(ae.relatedTarget)))&&v(ae)}function X(ae){var de;!((de=a.value)===null||de===void 0)&&de.contains(ae.relatedTarget)||E(ae)}function G(ae){F(ae)}function Z(){b.value=!0}function O(){b.value=!1}function A(ae){!n.active||!n.filterable||ae.target!==s.value&&ae.preventDefault()}function Y(ae){P(ae)}const H=t.ref(!1);function T(ae){if(ae.key==="Backspace"&&!H.value&&!n.pattern.length){const{selectedOptions:de}=n;de!=null&&de.length&&Y(de[de.length-1])}}let D=null;function K(ae){const{value:de}=o;if(de){const Ge=ae.target.value;de.textContent=Ge,N()}n.ignoreComposition&&H.value?D=ae:R(ae)}function J(){H.value=!0}function U(){H.value=!1,n.ignoreComposition&&R(D),D=null}function q(ae){var de;g.value=!0,(de=n.onPatternFocus)===null||de===void 0||de.call(n,ae)}function L(ae){var de;g.value=!1,(de=n.onPatternBlur)===null||de===void 0||de.call(n,ae)}function le(){var ae,de;if(n.filterable)g.value=!1,(ae=d.value)===null||ae===void 0||ae.blur(),(de=s.value)===null||de===void 0||de.blur();else if(n.multiple){const{value:Ge}=l;Ge==null||Ge.blur()}else{const{value:Ge}=c;Ge==null||Ge.blur()}}function ue(){var ae,de,Ge;n.filterable?(g.value=!1,(ae=d.value)===null||ae===void 0||ae.focus()):n.multiple?(de=l.value)===null||de===void 0||de.focus():(Ge=c.value)===null||Ge===void 0||Ge.focus()}function oe(){const{value:ae}=s;ae&&($(),ae.focus())}function fe(){const{value:ae}=s;ae&&ae.blur()}function ge(ae){const{value:de}=u;de&&de.setTextContent(`+${ae}`)}function _e(){const{value:ae}=f;return ae}function Qe(){return s.value}let Re=null;function Mt(){Re!==null&&window.clearTimeout(Re)}function vn(){n.active||(Mt(),Re=window.setTimeout(()=>{C.value&&(m.value=!0)},100))}function It(){Mt()}function en(ae){ae||(Mt(),m.value=!1)}t.watch(C,ae=>{ae||(m.value=!1)}),t.onMounted(()=>{t.watchEffect(()=>{const ae=d.value;ae&&(n.disabled?ae.removeAttribute("tabindex"):ae.tabIndex=g.value?-1:0)})}),Ph(a,n.onResize);const{inlineThemeDisabled:Ln}=n,pn=t.computed(()=>{const{size:ae}=n,{common:{cubicBezierEaseInOut:de},self:{fontWeight:Ge,borderRadius:Ui,color:oi,placeholderColor:si,textColor:at,paddingSingle:qe,paddingMultiple:on,caretColor:sn,colorDisabled:lt,textColorDisabled:jt,placeholderColorDisabled:z,colorActive:Q,boxShadowFocus:se,boxShadowActive:ye,boxShadowHover:we,border:Ce,borderFocus:Ne,borderHover:$e,borderActive:rt,arrowColor:Hn,arrowColorDisabled:Bl,loadingColor:Nl,colorActiveWarning:Tl,boxShadowFocusWarning:$l,boxShadowActiveWarning:El,boxShadowHoverWarning:Rl,borderWarning:Pl,borderFocusWarning:Fl,borderHoverWarning:Vl,borderActiveWarning:Ml,colorActiveError:Il,boxShadowFocusError:Al,boxShadowActiveError:Ol,boxShadowHoverError:zl,borderError:Dl,borderFocusError:Ll,borderHoverError:Hl,borderActiveError:vT,clearColor:ST,clearColorHover:BT,clearColorPressed:NT,clearSize:TT,arrowSize:$T,[st("height",ae)]:ET,[st("fontSize",ae)]:RT}}=y.value,vs=xn(qe),Ss=xn(on);return{"--n-bezier":de,"--n-border":Ce,"--n-border-active":rt,"--n-border-focus":Ne,"--n-border-hover":$e,"--n-border-radius":Ui,"--n-box-shadow-active":ye,"--n-box-shadow-focus":se,"--n-box-shadow-hover":we,"--n-caret-color":sn,"--n-color":oi,"--n-color-active":Q,"--n-color-disabled":lt,"--n-font-size":RT,"--n-height":ET,"--n-padding-single-top":vs.top,"--n-padding-multiple-top":Ss.top,"--n-padding-single-right":vs.right,"--n-padding-multiple-right":Ss.right,"--n-padding-single-left":vs.left,"--n-padding-multiple-left":Ss.left,"--n-padding-single-bottom":vs.bottom,"--n-padding-multiple-bottom":Ss.bottom,"--n-placeholder-color":si,"--n-placeholder-color-disabled":z,"--n-text-color":at,"--n-text-color-disabled":jt,"--n-arrow-color":Hn,"--n-arrow-color-disabled":Bl,"--n-loading-color":Nl,"--n-color-active-warning":Tl,"--n-box-shadow-focus-warning":$l,"--n-box-shadow-active-warning":El,"--n-box-shadow-hover-warning":Rl,"--n-border-warning":Pl,"--n-border-focus-warning":Fl,"--n-border-hover-warning":Vl,"--n-border-active-warning":Ml,"--n-color-active-error":Il,"--n-box-shadow-focus-error":Al,"--n-box-shadow-active-error":Ol,"--n-box-shadow-hover-error":zl,"--n-border-error":Dl,"--n-border-focus-error":Ll,"--n-border-hover-error":Hl,"--n-border-active-error":vT,"--n-clear-size":TT,"--n-clear-color":ST,"--n-clear-color-hover":BT,"--n-clear-color-pressed":NT,"--n-arrow-size":$T,"--n-font-weight":Ge}}),_t=Ln?Hi("internal-selection",t.computed(()=>n.size[0]),pn,n):void 0;return{mergedTheme:y,mergedClearable:_,mergedClsPrefix:e,rtlEnabled:r,patternInputFocused:g,filterablePlaceholder:x,label:w,selected:C,showTagsPanel:m,isComposing:H,counterRef:u,counterWrapperRef:f,patternInputMirrorRef:o,patternInputRef:s,selfRef:a,multipleElRef:l,singleElRef:c,patternInputWrapperRef:d,overflowRef:h,inputTagElRef:p,handleMouseDown:A,handleFocusin:M,handleClear:G,handleMouseEnter:Z,handleMouseLeave:O,handleDeleteOption:Y,handlePatternKeyDown:T,handlePatternInputInput:K,handlePatternInputBlur:L,handlePatternInputFocus:q,handleMouseEnterCounter:vn,handleMouseLeaveCounter:It,handleFocusout:X,handleCompositionEnd:U,handleCompositionStart:J,onPopoverUpdateShow:en,focus:ue,focusInput:oe,blur:le,blurInput:fe,updateCounter:ge,getCounter:_e,getTail:Qe,renderLabel:n.renderLabel,cssVars:Ln?void 0:pn,themeClass:_t==null?void 0:_t.themeClass,onRender:_t==null?void 0:_t.onRender}},render(){const{status:n,multiple:e,size:i,disabled:r,filterable:o,maxTagCount:s,bordered:a,clsPrefix:l,ellipsisTagPopoverProps:c,onRender:d,renderTag:u,renderLabel:f}=this;d==null||d();const h=s==="responsive",p=typeof s=="number",m=h||p,g=t.h(hl,null,{default:()=>t.h(T5,{clsPrefix:l,loading:this.loading,showArrow:this.showArrow,showClear:this.mergedClearable&&this.selected,onClear:this.handleClear},{default:()=>{var y,_;return(_=(y=this.$slots).arrow)===null||_===void 0?void 0:_.call(y)}})});let b;if(e){const{labelField:y}=this,_=R=>t.h("div",{class:`${l}-base-selection-tag-wrapper`,key:R.value},u?u({option:R,handleClose:()=>{this.handleDeleteOption(R)}}):t.h(_l,{size:i,closable:!R.disabled,disabled:r,onClose:()=>{this.handleDeleteOption(R)},internalCloseIsButtonTag:!1,internalCloseFocusable:!1},{default:()=>f?f(R,!0):Cr(R[y],R,!0)})),x=()=>(p?this.selectedOptions.slice(0,s):this.selectedOptions).map(_),w=o?t.h("div",{class:`${l}-base-selection-input-tag`,ref:"inputTagElRef",key:"__input-tag__"},t.h("input",Object.assign({},this.inputProps,{ref:"patternInputRef",tabindex:-1,disabled:r,value:this.pattern,autofocus:this.autofocus,class:`${l}-base-selection-input-tag__input`,onBlur:this.handlePatternInputBlur,onFocus:this.handlePatternInputFocus,onKeydown:this.handlePatternKeyDown,onInput:this.handlePatternInputInput,onCompositionstart:this.handleCompositionStart,onCompositionend:this.handleCompositionEnd})),t.h("span",{ref:"patternInputMirrorRef",class:`${l}-base-selection-input-tag__mirror`},this.pattern)):null,C=h?()=>t.h("div",{class:`${l}-base-selection-tag-wrapper`,ref:"counterWrapperRef"},t.h(_l,{size:i,ref:"counterRef",onMouseenter:this.handleMouseEnterCounter,onMouseleave:this.handleMouseLeaveCounter,disabled:r})):void 0;let N;if(p){const R=this.selectedOptions.length-s;R>0&&(N=t.h("div",{class:`${l}-base-selection-tag-wrapper`,key:"__counter__"},t.h(_l,{size:i,ref:"counterRef",onMouseenter:this.handleMouseEnterCounter,disabled:r},{default:()=>`+${R}`})))}const k=h?o?t.h(kh,{ref:"overflowRef",updateCounter:this.updateCounter,getCounter:this.getCounter,getTail:this.getTail,style:{width:"100%",display:"flex",overflow:"hidden"}},{default:x,counter:C,tail:()=>w}):t.h(kh,{ref:"overflowRef",updateCounter:this.updateCounter,getCounter:this.getCounter,style:{width:"100%",display:"flex",overflow:"hidden"}},{default:x,counter:C}):p&&N?x().concat(N):x(),$=m?()=>t.h("div",{class:`${l}-base-selection-popover`},h?x():this.selectedOptions.map(_)):void 0,v=m?Object.assign({show:this.showTagsPanel,trigger:"hover",overlap:!0,placement:"top",width:"trigger",onUpdateShow:this.onPopoverUpdateShow,theme:this.mergedTheme.peers.Popover,themeOverrides:this.mergedTheme.peerOverrides.Popover},c):null,P=(this.selected?!1:this.active?!this.pattern&&!this.isComposing:!0)?t.h("div",{class:`${l}-base-selection-placeholder ${l}-base-selection-overlay`},t.h("div",{class:`${l}-base-selection-placeholder__inner`},this.placeholder)):null,F=o?t.h("div",{ref:"patternInputWrapperRef",class:`${l}-base-selection-tags`},k,h?null:w,g):t.h("div",{ref:"multipleElRef",class:`${l}-base-selection-tags`,tabindex:r?void 0:0},k,g);b=t.h(t.Fragment,null,m?t.h(_5,Object.assign({},v,{scrollable:!0,style:"max-height: calc(var(--v-target-height) * 6.6);"}),{trigger:()=>F,default:$}):F,P)}else if(o){const y=this.pattern||this.isComposing,_=this.active?!y:!this.selected,x=this.active?!1:this.selected;b=t.h("div",{ref:"patternInputWrapperRef",class:`${l}-base-selection-label`,title:this.patternInputFocused?void 0:zh(this.label)},t.h("input",Object.assign({},this.inputProps,{ref:"patternInputRef",class:`${l}-base-selection-input`,value:this.active?this.pattern:"",placeholder:"",readonly:r,disabled:r,tabindex:-1,autofocus:this.autofocus,onFocus:this.handlePatternInputFocus,onBlur:this.handlePatternInputBlur,onInput:this.handlePatternInputInput,onCompositionstart:this.handleCompositionStart,onCompositionend:this.handleCompositionEnd})),x?t.h("div",{class:`${l}-base-selection-label__render-label ${l}-base-selection-overlay`,key:"input"},t.h("div",{class:`${l}-base-selection-overlay__wrapper`},u?u({option:this.selectedOption,handleClose:()=>{}}):f?f(this.selectedOption,!0):Cr(this.label,this.selectedOption,!0))):null,_?t.h("div",{class:`${l}-base-selection-placeholder ${l}-base-selection-overlay`,key:"placeholder"},t.h("div",{class:`${l}-base-selection-overlay__wrapper`},this.filterablePlaceholder)):null,g)}else b=t.h("div",{ref:"singleElRef",class:`${l}-base-selection-label`,tabindex:this.disabled?void 0:0},this.label!==void 0?t.h("div",{class:`${l}-base-selection-input`,title:zh(this.label),key:"input"},t.h("div",{class:`${l}-base-selection-input__content`},u?u({option:this.selectedOption,handleClose:()=>{}}):f?f(this.selectedOption,!0):Cr(this.label,this.selectedOption,!0))):t.h("div",{class:`${l}-base-selection-placeholder ${l}-base-selection-overlay`,key:"placeholder"},t.h("div",{class:`${l}-base-selection-placeholder__inner`},this.placeholder)),g);return t.h("div",{ref:"selfRef",class:[`${l}-base-selection`,this.rtlEnabled&&`${l}-base-selection--rtl`,this.themeClass,n&&`${l}-base-selection--${n}-status`,{[`${l}-base-selection--active`]:this.active,[`${l}-base-selection--selected`]:this.selected||this.active&&this.pattern,[`${l}-base-selection--disabled`]:this.disabled,[`${l}-base-selection--multiple`]:this.multiple,[`${l}-base-selection--focus`]:this.focused}],style:this.cssVars,onClick:this.onClick,onMouseenter:this.handleMouseEnter,onMouseleave:this.handleMouseLeave,onKeydown:this.onKeydown,onFocusin:this.handleFocusin,onFocusout:this.handleFocusout,onMousedown:this.handleMouseDown},b,a?t.h("div",{class:`${l}-base-selection__border`}):null,a?t.h("div",{class:`${l}-base-selection__state-border`}):null)}});function F5(n){const{boxShadow2:e}=n;return{menuBoxShadow:e}}const V5={name:"Select",common:Wi,peers:{InternalSelection:cm,InternalSelectMenu:tm},self:F5},M5=pe([ke("select",`
814
814
  z-index: auto;
815
815
  outline: none;
816
816
  width: 100%;
@@ -819,4 +819,4 @@ ${o}
819
819
  `),ke("select-menu",`
820
820
  margin: 4px 0;
821
821
  box-shadow: var(--n-menu-box-shadow);
822
- `,[sm({originalTransition:"background-color .3s var(--n-bezier), box-shadow .3s var(--n-bezier)"})])]);function ws(n){return n.type==="group"}function dm(n){return n.type==="ignored"}function wl(n,e){try{return!!(1+e.toString().toLowerCase().indexOf(n.trim().toLowerCase()))}catch{return!1}}function I5(n,e){return{getIsGroup:ws,getIgnored:dm,getKey(r){return ws(r)?r.name||r.key||"key-required":r[n]},getChildren(r){return r[e]}}}function A5(n,e,i,r){if(!e)return n;function o(s){if(!Array.isArray(s))return[];const a=[];for(const l of s)if(ws(l)){const c=o(l[r]);c.length&&a.push(Object.assign({},l,{[r]:c}))}else{if(dm(l))continue;e(i,l)&&a.push(l)}return a}return o(n)}function O5(n,e,i){const r=new Map;return n.forEach(o=>{ws(o)?o[i].forEach(s=>{r.set(s[e],s)}):r.set(o[e],o)}),r}var z5={};const D5=Object.assign(Object.assign({},Rt.props),{to:Gn.propTo,bordered:{type:Boolean,default:void 0},clearable:Boolean,clearFilterAfterSelect:{type:Boolean,default:!0},options:{type:Array,default:()=>[]},defaultValue:{type:[String,Number,Array],default:null},keyboard:{type:Boolean,default:!0},value:[String,Number,Array],placeholder:String,menuProps:Object,multiple:Boolean,size:String,menuSize:{type:String},filterable:Boolean,disabled:{type:Boolean,default:void 0},remote:Boolean,loading:Boolean,filter:Function,placement:{type:String,default:"bottom-start"},widthMode:{type:String,default:"trigger"},tag:Boolean,onCreate:Function,fallbackOption:{type:[Function,Boolean],default:void 0},show:{type:Boolean,default:void 0},showArrow:{type:Boolean,default:!0},maxTagCount:[Number,String],ellipsisTagPopoverProps:Object,consistentMenuWidth:{type:Boolean,default:!0},virtualScroll:{type:Boolean,default:!0},labelField:{type:String,default:"label"},valueField:{type:String,default:"value"},childrenField:{type:String,default:"children"},renderLabel:Function,renderOption:Function,renderTag:Function,"onUpdate:value":[Function,Array],inputProps:Object,nodeProps:Function,ignoreComposition:{type:Boolean,default:!0},showOnFocus:Boolean,onUpdateValue:[Function,Array],onBlur:[Function,Array],onClear:[Function,Array],onFocus:[Function,Array],onScroll:[Function,Array],onSearch:[Function,Array],onUpdateShow:[Function,Array],"onUpdate:show":[Function,Array],displayDirective:{type:String,default:"show"},resetMenuOnOptionsChange:{type:Boolean,default:!0},status:String,showCheckmark:{type:Boolean,default:!0},onChange:[Function,Array],items:Array}),L5=t.defineComponent({name:"Select",props:D5,slots:Object,setup(n){z5.NODE_ENV!=="production"&&t.watchEffect(()=>{n.items!==void 0&&bi("select","`items` is deprecated, please use `options` instead."),n.onChange!==void 0&&bi("select","`on-change` is deprecated, please use `on-update:value` instead.")});const{mergedClsPrefixRef:e,mergedBorderedRef:i,namespaceRef:r,inlineThemeDisabled:o}=Li(n),s=Rt("Select","-select",M5,V5,n,e),a=t.ref(n.defaultValue),l=t.toRef(n,"value"),c=Ua(l,a),d=t.ref(!1),u=t.ref(""),f=Af(n,["items","options"]),h=t.ref([]),p=t.ref([]),m=t.computed(()=>p.value.concat(h.value).concat(f.value)),g=t.computed(()=>{const{filter:z}=n;if(z)return z;const{labelField:Q,valueField:se}=n;return(ye,we)=>{if(!we)return!1;const Ce=we[Q];if(typeof Ce=="string")return wl(ye,Ce);const Ne=we[se];return typeof Ne=="string"?wl(ye,Ne):typeof Ne=="number"?wl(ye,String(Ne)):!1}}),b=t.computed(()=>{if(n.remote)return f.value;{const{value:z}=m,{value:Q}=u;return!Q.length||!n.filterable?z:A5(z,g.value,Q,n.childrenField)}}),y=t.computed(()=>{const{valueField:z,childrenField:Q}=n,se=I5(z,Q);return hv(b.value,se)}),_=t.computed(()=>O5(m.value,n.valueField,n.childrenField)),x=t.ref(!1),w=Ua(t.toRef(n,"show"),x),C=t.ref(null),N=t.ref(null),k=t.ref(null),{localeRef:$}=qh("Select"),v=t.computed(()=>{var z;return(z=n.placeholder)!==null&&z!==void 0?z:$.value.placeholder}),E=[],P=t.ref(new Map),F=t.computed(()=>{const{fallbackOption:z}=n;if(z===void 0){const{labelField:Q,valueField:se}=n;return ye=>({[Q]:String(ye),[se]:ye})}return z===!1?!1:Q=>Object.assign(z(Q),{value:Q})});function R(z){const Q=n.remote,{value:se}=P,{value:ye}=_,{value:we}=F,Ce=[];return z.forEach(Ne=>{if(ye.has(Ne))Ce.push(ye.get(Ne));else if(Q&&se.has(Ne))Ce.push(se.get(Ne));else if(we){const $e=we(Ne);$e&&Ce.push($e)}}),Ce}const M=t.computed(()=>{if(n.multiple){const{value:z}=c;return Array.isArray(z)?R(z):[]}return null}),X=t.computed(()=>{const{value:z}=c;return!n.multiple&&!Array.isArray(z)?z===null?null:R([z])[0]||null:null}),G=XS(n),{mergedSizeRef:Z,mergedDisabledRef:O,mergedStatusRef:A}=G;function Y(z,Q){const{onChange:se,"onUpdate:value":ye,onUpdateValue:we}=n,{nTriggerFormChange:Ce,nTriggerFormInput:Ne}=G;se&&Et(se,z,Q),we&&Et(we,z,Q),ye&&Et(ye,z,Q),a.value=z,Ce(),Ne()}function H(z){const{onBlur:Q}=n,{nTriggerFormBlur:se}=G;Q&&Et(Q,z),se()}function T(){const{onClear:z}=n;z&&Et(z)}function D(z){const{onFocus:Q,showOnFocus:se}=n,{nTriggerFormFocus:ye}=G;Q&&Et(Q,z),ye(),se&&L()}function K(z){const{onSearch:Q}=n;Q&&Et(Q,z)}function J(z){const{onScroll:Q}=n;Q&&Et(Q,z)}function U(){var z;const{remote:Q,multiple:se}=n;if(Q){const{value:ye}=P;if(se){const{valueField:we}=n;(z=M.value)===null||z===void 0||z.forEach(Ce=>{ye.set(Ce[we],Ce)})}else{const we=X.value;we&&ye.set(we[n.valueField],we)}}}function q(z){const{onUpdateShow:Q,"onUpdate:show":se}=n;Q&&Et(Q,z),se&&Et(se,z),x.value=z}function L(){O.value||(q(!0),x.value=!0,n.filterable&&qe())}function le(){q(!1)}function ue(){u.value="",p.value=E}const oe=t.ref(!1);function fe(){n.filterable&&(oe.value=!0)}function ge(){n.filterable&&(oe.value=!1,w.value||ue())}function _e(){O.value||(w.value?n.filterable?qe():le():L())}function Qe(z){var Q,se;!((se=(Q=k.value)===null||Q===void 0?void 0:Q.selfRef)===null||se===void 0)&&se.contains(z.relatedTarget)||(d.value=!1,H(z),le())}function Re(z){D(z),d.value=!0}function Mt(){d.value=!0}function vn(z){var Q;!((Q=C.value)===null||Q===void 0)&&Q.$el.contains(z.relatedTarget)||(d.value=!1,H(z),le())}function It(){var z;(z=C.value)===null||z===void 0||z.focus(),le()}function en(z){var Q;w.value&&(!((Q=C.value)===null||Q===void 0)&&Q.$el.contains(Wr(z))||le())}function Ln(z){if(!Array.isArray(z))return[];if(F.value)return Array.from(z);{const{remote:Q}=n,{value:se}=_;if(Q){const{value:ye}=P;return z.filter(we=>se.has(we)||ye.has(we))}else return z.filter(ye=>se.has(ye))}}function mn(z){_t(z.rawNode)}function _t(z){if(O.value)return;const{tag:Q,remote:se,clearFilterAfterSelect:ye,valueField:we}=n;if(Q&&!se){const{value:Ce}=p,Ne=Ce[0]||null;if(Ne){const $e=h.value;$e.length?$e.push(Ne):h.value=[Ne],p.value=E}}if(se&&P.value.set(z[we],z),n.multiple){const Ce=Ln(c.value),Ne=Ce.findIndex($e=>$e===z[we]);if(~Ne){if(Ce.splice(Ne,1),Q&&!se){const $e=ae(z[we]);~$e&&(h.value.splice($e,1),ye&&(u.value=""))}}else Ce.push(z[we]),ye&&(u.value="");Y(Ce,R(Ce))}else{if(Q&&!se){const Ce=ae(z[we]);~Ce?h.value=[h.value[Ce]]:h.value=E}at(),le(),Y(z[we],z)}}function ae(z){return h.value.findIndex(se=>se[n.valueField]===z)}function de(z){w.value||L();const{value:Q}=z.target;u.value=Q;const{tag:se,remote:ye}=n;if(K(Q),se&&!ye){if(!Q){p.value=E;return}const{onCreate:we}=n,Ce=we?we(Q):{[n.labelField]:Q,[n.valueField]:Q},{valueField:Ne,labelField:$e}=n;f.value.some(rt=>rt[Ne]===Ce[Ne]||rt[$e]===Ce[$e])||h.value.some(rt=>rt[Ne]===Ce[Ne]||rt[$e]===Ce[$e])?p.value=E:p.value=[Ce]}}function Ge(z){z.stopPropagation();const{multiple:Q}=n;!Q&&n.filterable&&le(),T(),Q?Y([],[]):Y(null,null)}function Ui(z){!Hr(z,"action")&&!Hr(z,"empty")&&!Hr(z,"header")&&z.preventDefault()}function oi(z){J(z)}function si(z){var Q,se,ye,we,Ce;if(!n.keyboard){z.preventDefault();return}switch(z.key){case" ":if(n.filterable)break;z.preventDefault();case"Enter":if(!(!((Q=C.value)===null||Q===void 0)&&Q.isComposing)){if(w.value){const Ne=(se=k.value)===null||se===void 0?void 0:se.getPendingTmNode();Ne?mn(Ne):n.filterable||(le(),at())}else if(L(),n.tag&&oe.value){const Ne=p.value[0];if(Ne){const $e=Ne[n.valueField],{value:rt}=c;n.multiple&&Array.isArray(rt)&&rt.includes($e)||_t(Ne)}}}z.preventDefault();break;case"ArrowUp":if(z.preventDefault(),n.loading)return;w.value&&((ye=k.value)===null||ye===void 0||ye.prev());break;case"ArrowDown":if(z.preventDefault(),n.loading)return;w.value?(we=k.value)===null||we===void 0||we.next():L();break;case"Escape":w.value&&(HS(z),le()),(Ce=C.value)===null||Ce===void 0||Ce.focus();break}}function at(){var z;(z=C.value)===null||z===void 0||z.focus()}function qe(){var z;(z=C.value)===null||z===void 0||z.focusInput()}function on(){var z;w.value&&((z=N.value)===null||z===void 0||z.syncPosition())}U(),t.watch(t.toRef(n,"options"),U);const sn={focus:()=>{var z;(z=C.value)===null||z===void 0||z.focus()},focusInput:()=>{var z;(z=C.value)===null||z===void 0||z.focusInput()},blur:()=>{var z;(z=C.value)===null||z===void 0||z.blur()},blurInput:()=>{var z;(z=C.value)===null||z===void 0||z.blurInput()}},lt=t.computed(()=>{const{self:{menuBoxShadow:z}}=s.value;return{"--n-menu-box-shadow":z}}),jt=o?Hi("select",void 0,lt,n):void 0;return Object.assign(Object.assign({},sn),{mergedStatus:A,mergedClsPrefix:e,mergedBordered:i,namespace:r,treeMate:y,isMounted:as(),triggerRef:C,menuRef:k,pattern:u,uncontrolledShow:x,mergedShow:w,adjustedTo:Gn(n),uncontrolledValue:a,mergedValue:c,followerRef:N,localizedPlaceholder:v,selectedOption:X,selectedOptions:M,mergedSize:Z,mergedDisabled:O,focused:d,activeWithoutMenuOpen:oe,inlineThemeDisabled:o,onTriggerInputFocus:fe,onTriggerInputBlur:ge,handleTriggerOrMenuResize:on,handleMenuFocus:Mt,handleMenuBlur:vn,handleMenuTabOut:It,handleTriggerClick:_e,handleToggle:mn,handleDeleteOption:_t,handlePatternInput:de,handleClear:Ge,handleTriggerBlur:Qe,handleTriggerFocus:Re,handleKeydown:si,handleMenuAfterLeave:ue,handleMenuClickOutside:en,handleMenuScroll:oi,handleMenuKeydown:si,handleMenuMousedown:Ui,mergedTheme:s,cssVars:o?void 0:lt,themeClass:jt==null?void 0:jt.themeClass,onRender:jt==null?void 0:jt.onRender})},render(){return t.h("div",{class:`${this.mergedClsPrefix}-select`},t.h(Lf,null,{default:()=>[t.h(Hf,null,{default:()=>t.h(P5,{ref:"triggerRef",inlineThemeDisabled:this.inlineThemeDisabled,status:this.mergedStatus,inputProps:this.inputProps,clsPrefix:this.mergedClsPrefix,showArrow:this.showArrow,maxTagCount:this.maxTagCount,ellipsisTagPopoverProps:this.ellipsisTagPopoverProps,bordered:this.mergedBordered,active:this.activeWithoutMenuOpen||this.mergedShow,pattern:this.pattern,placeholder:this.localizedPlaceholder,selectedOption:this.selectedOption,selectedOptions:this.selectedOptions,multiple:this.multiple,renderTag:this.renderTag,renderLabel:this.renderLabel,filterable:this.filterable,clearable:this.clearable,disabled:this.mergedDisabled,size:this.mergedSize,theme:this.mergedTheme.peers.InternalSelection,labelField:this.labelField,valueField:this.valueField,themeOverrides:this.mergedTheme.peerOverrides.InternalSelection,loading:this.loading,focused:this.focused,onClick:this.handleTriggerClick,onDeleteOption:this.handleDeleteOption,onPatternInput:this.handlePatternInput,onClear:this.handleClear,onBlur:this.handleTriggerBlur,onFocus:this.handleTriggerFocus,onKeydown:this.handleKeydown,onPatternBlur:this.onTriggerInputBlur,onPatternFocus:this.onTriggerInputFocus,onResize:this.handleTriggerOrMenuResize,ignoreComposition:this.ignoreComposition},{arrow:()=>{var n,e;return[(e=(n=this.$slots).arrow)===null||e===void 0?void 0:e.call(n)]}})}),t.h(ih,{ref:"followerRef",show:this.mergedShow,to:this.adjustedTo,teleportDisabled:this.adjustedTo===Gn.tdkey,containerClass:this.namespace,width:this.consistentMenuWidth?"target":void 0,minWidth:"target",placement:this.placement},{default:()=>t.h(t.Transition,{name:"fade-in-scale-up-transition",appear:this.isMounted,onAfterLeave:this.handleMenuAfterLeave},{default:()=>{var n,e,i;return this.mergedShow||this.displayDirective==="show"?((n=this.onRender)===null||n===void 0||n.call(this),t.withDirectives(t.h(a5,Object.assign({},this.menuProps,{ref:"menuRef",onResize:this.handleTriggerOrMenuResize,inlineThemeDisabled:this.inlineThemeDisabled,virtualScroll:this.consistentMenuWidth&&this.virtualScroll,class:[`${this.mergedClsPrefix}-select-menu`,this.themeClass,(e=this.menuProps)===null||e===void 0?void 0:e.class],clsPrefix:this.mergedClsPrefix,focusable:!0,labelField:this.labelField,valueField:this.valueField,autoPending:!0,nodeProps:this.nodeProps,theme:this.mergedTheme.peers.InternalSelectMenu,themeOverrides:this.mergedTheme.peerOverrides.InternalSelectMenu,treeMate:this.treeMate,multiple:this.multiple,size:this.menuSize,renderOption:this.renderOption,renderLabel:this.renderLabel,value:this.mergedValue,style:[(i=this.menuProps)===null||i===void 0?void 0:i.style,this.cssVars],onToggle:this.handleToggle,onScroll:this.handleMenuScroll,onFocus:this.handleMenuFocus,onBlur:this.handleMenuBlur,onKeydown:this.handleMenuKeydown,onTabOut:this.handleMenuTabOut,onMousedown:this.handleMenuMousedown,show:this.mergedShow,showCheckmark:this.showCheckmark,resetMenuOnOptionsChange:this.resetMenuOnOptionsChange}),{empty:()=>{var r,o;return[(o=(r=this.$slots).empty)===null||o===void 0?void 0:o.call(r)]},header:()=>{var r,o;return[(o=(r=this.$slots).header)===null||o===void 0?void 0:o.call(r)]},action:()=>{var r,o;return[(o=(r=this.$slots).action)===null||o===void 0?void 0:o.call(r)]}}),this.displayDirective==="show"?[[t.vShow,this.mergedShow],[ss,this.handleMenuClickOutside,void 0,{capture:!0}]]:[[ss,this.handleMenuClickOutside,void 0,{capture:!0}]])):null}})})]}))}}),H5={},um=t.defineComponent({...H5,__name:"searchable-reference-select",props:{searchDataHandler:{},optionsListConverter:{},renderLabel:{},renderTag:{},value:{},clearable:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},minTermLength:{default:()=>{var n,e;return((e=(n=W.useBaseConfigStateStore().getConfig())==null?void 0:n.minLength)==null?void 0:e.searchTerm)??3}},consistentMenuWidth:{type:Boolean,default:!1},wrapContent:{type:Boolean,default:!1},placeholder:{default:""}},emits:["update:value"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.computed(()=>V.isArray(r.value)),a=t.computed(()=>s.value?r.value.map(_=>_.id):r.value?r.value.id:null),l=t.ref(s.value?r.optionsListConverter(r.value):r.value?r.optionsListConverter([r.value]):[]);t.watch(()=>r.value,_=>{const w=(V.isArray(_)?_:_?[_]:[]).filter(C=>!l.value.some(N=>N.value===C.id));w.length>0&&(l.value=[...r.optionsListConverter(w),...l.value])},{deep:1});const c=t.computed(()=>l.value.map(_=>({..._,class:r.wrapContent?`${_.class} consistent-menu-width`:_.class}))),d=t.ref(!1),u=t.useTemplateRef("select-component"),f=_=>{_.length<r.minTermLength||(d.value=!0,r.searchDataHandler(_,d).then(x=>{if(V.isEmpty(x))return;const w=s.value?r.value:r.value?[r.value]:[],C=x.filter(N=>!w.some(k=>k.id===N.id));l.value=r.optionsListConverter([...w,...C])}).finally(()=>{d.value=!1}))};let h="";const p=V.debounce(()=>f(h),800),m=_=>{h=_,p()},g=_=>{var x;if(V.isArray(_)){const w=_.length>0?_.map(C=>{var N;return t.toRaw((N=l.value.find(k=>k.value===C))==null?void 0:N.item)}):[];o("update:value",w)}else if(_>0){const w=t.toRaw((x=l.value.find(C=>C.value===_))==null?void 0:x.item);o("update:value",w)}else o("update:value",null)};return e({focus:()=>{var _;return(_=u.value)==null?void 0:_.focusInput()},blur:()=>{var _;return(_=u.value)==null?void 0:_.blurInput()}}),(_,x)=>(t.openBlock(),t.createBlock(t.unref(L5),{ref:"select-component","clear-filter-after-select":!0,clearable:n.clearable,"consistent-menu-width":n.consistentMenuWidth,disabled:n.disabled,filterable:!0,loading:d.value,multiple:s.value,options:c.value,placeholder:n.placeholder,remote:!0,value:a.value,"render-label":n.renderLabel,"render-tag":n.renderTag,onSearch:m,"onUpdate:value":g},null,8,["clearable","consistent-menu-width","disabled","loading","multiple","options","placeholder","value","render-label","render-tag"]))}}),W5={},fm=t.defineComponent({...W5,__name:"searchable-product-select",props:{renderLabel:{},renderTag:{},value:{},clearable:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},minTermLength:{default:()=>{var n,e;return((e=(n=W.useBaseConfigStateStore().getConfig())==null?void 0:n.minLength)==null?void 0:e.searchTerm)??3}},consistentMenuWidth:{type:Boolean,default:!1},wrapContent:{type:Boolean,default:!1},placeholder:{default:""},searchType:{}},emits:["update:value"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.useTemplateRef("select-component"),a=async f=>r.searchType==="categories"?W.HttpRequester.getInstance(W.ProductCategoryDataProvider).publicSimpleSearch(f):r.searchType==="products"?W.HttpRequester.getInstance(W.ProductDataProvider).publicSimpleSearch(f):new Promise(h=>{h([])}),l=f=>r.searchType==="categories"?wt.convertReferencesToSelectOptionsList(f,!0,!1,!1,h=>h!=null&&h.isNewRec()?"-":h.name):r.searchType==="products"?wt.convertReferencesToSelectOptionsList(f,!0,!1,!1,h=>h!=null&&h.isNewRec()?"-":`[${h.code}] ${h.name}`):[],c=(f,h)=>{if(r.renderLabel)return r.renderLabel(f,h);if(r.searchType==="products"){const p=f.item;return t.h("div",{},[t.h("span",{class:"text-sc-grey mr-2.5"},p.code),t.h("span",{},[p.name])])}if(r.searchType==="categories"){const p=f.item;return t.h("div",{},[p.name])}};return e({focus:()=>{var f;return(f=s.value)==null?void 0:f.focus()},blur:()=>{var f;return(f=s.value)==null?void 0:f.blur()}}),(f,h)=>(t.openBlock(),t.createBlock(um,{ref:"select-component",value:n.value,clearable:n.clearable,disabled:n.disabled,placeholder:n.placeholder,"search-data-handler":a,"options-list-converter":l,"consistent-menu-width":n.consistentMenuWidth,"wrap-content":n.wrapContent,"min-term-length":n.minTermLength,"render-label":c,"render-tag":n.renderTag,"onUpdate:value":h[0]||(h[0]=p=>o("update:value",p))},null,8,["value","clearable","disabled","placeholder","consistent-menu-width","wrap-content","min-term-length","render-tag"]))}}),j5={class:"col-span-2 flex flex-row gap-2.5"},q5={class:"flex-1"},X5={class:"text-sc-grey"},Y5={class:"ml-2.5"},U5={key:0,class:"flex-none"},K5={},G5=t.defineComponent({...K5,__name:"products-list",props:{value:{},searchType:{},minTermLength:{default:()=>{var n,e;return((e=(n=W.useBaseConfigStateStore().getConfig())==null?void 0:n.minLength)==null?void 0:e.searchTerm)??3}},disabled:{type:Boolean}},emits:["update:value"],setup(n,{emit:e}){const i=n,r=e,o=t.ref(null),s=()=>structuredClone(t.toRaw(i.value)),a=t.ref(s()),l=()=>{r("update:value",a.value.map(f=>t.toRaw(f)))},c=f=>{f&&(a.value=[...a.value.map(h=>t.toRaw(h)),...(V.isArray(f)?f:[f]).filter(h=>!a.value.some(p=>p.id===h.id))],t.nextTick(()=>{o.value=null}),l())},d=f=>{f&&(a.value=a.value.map(h=>h.id===f.id?f:t.toRaw(h)),l())},u=f=>{a.value=a.value.filter(h=>h.id!==f.id),l()};return t.watch(()=>i.value,()=>{a.value=s()}),(f,h)=>{const p=I.NListItem,m=SC,g=I.NButton,b=I.NList;return t.openBlock(),t.createBlock(b,{"show-divider":!1,hoverable:!0},{header:t.withCtx(()=>[t.renderSlot(f.$slots,"header")]),footer:t.withCtx(()=>[t.createVNode(fm,{value:o.value,"onUpdate:value":[h[0]||(h[0]=y=>o.value=y),c],clearable:!0,disabled:n.disabled,"min-term-length":n.minTermLength,"search-type":n.searchType,placeholder:"Введите название"},null,8,["value","disabled","min-term-length","search-type"])]),default:t.withCtx(()=>[a.value.length===0?(t.openBlock(),t.createBlock(p,{key:0,class:"text-center text-sm text-gray-600"},{default:t.withCtx(()=>[...h[1]||(h[1]=[t.createTextVNode(" --- Список пуст --- ",-1)])]),_:1})):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value,y=>(t.openBlock(),t.createBlock(p,{key:y.id},{suffix:t.withCtx(()=>[t.createVNode(g,{disabled:n.disabled,quaternary:"",type:"error",onClick:_=>u(y)},{default:t.withCtx(()=>[t.createVNode(m)]),_:1},8,["disabled","onClick"])]),default:t.withCtx(()=>[t.createElementVNode("div",j5,[t.createElementVNode("span",q5,[t.createElementVNode("span",X5,t.toDisplayString(y.code),1),t.createElementVNode("span",Y5,t.toDisplayString(y.name),1)]),f.$slots["item-extra"]?(t.openBlock(),t.createElementBlock("div",U5,[t.renderSlot(f.$slots,"item-extra",{item:y,updateItemCallback:d})])):t.createCommentVNode("",!0)])]),_:2},1024))),128))]),_:3})}}}),Z5={class:"flex flex-col"},Q5={class:"flex flex-col gap-1.5 text-base text-nowrap"},J5={class:"font-medium"},e3={class:"flex flex-col text-sc-dark-grey"},t3={key:0},n3={class:"font-medium"},i3={class:"font-medium"},r3={class:"font-medium"},o3={class:"font-medium"},s3={class:"font-medium"},a3={class:"font-medium"},l3={class:"font-medium"},c3={class:"font-medium"},d3={class:"font-medium"},u3={class:"font-medium"},f3={class:"flex flex-col gap-1.5 text-base text-nowrap"},h3={class:"font-medium"},m3={class:"flex flex-col text-sc-dark-grey"},p3={class:"font-medium"},g3={class:"font-medium"},y3={class:"flex flex-col gap-1.5 text-base text-nowrap"},b3={class:"font-medium"},_3={class:"text-sc-dark-grey"},w3={class:"font-medium"},x3={key:1,class:"text-base font-medium text-nowrap"},k3={},xl=t.defineComponent({...k3,__name:"order-item-params",props:{item:{},eventEmitter:{default:void 0},allowEdit:{type:Boolean,default:!1},updateQuantityOnInput:{type:Boolean,default:!0}},setup(n){const e=[W.ConfiguratorsEnum.Kozyrek,W.ConfiguratorsEnum.Mosquitto,W.ConfiguratorsEnum.Strip,W.ConfiguratorsEnum.MetalForDoors,W.ConfiguratorsEnum.Sandwich,W.ConfiguratorsEnum.SandwichM2],i=n,r=t.ref(!1),o=t.computed(()=>i.item),s=t.computed(()=>{var m,g;return((m=i.item.product.unit)==null?void 0:m.isLinear)&&((g=i.item.product.properties)==null?void 0:g.isLengthConfigurator)}),a=t.computed(()=>W.UnitsHelper.getProductLengthMultiplicity(i.item.product)),l=t.computed(()=>Ve.multiplyByStep(i.item.quantity,a.value)),c=t.computed(()=>W.UnitsHelper.getProductMultiplicity(i.item.product)),d=t.computed(()=>c.value>1),u=t.ref({quantity:i.item.quantity});t.watch(()=>i.item,m=>{u.value={quantity:m.quantity}});const f=m=>{var g;m!==null&&(u.value.quantity=m,(g=i.eventEmitter)==null||g.emit("order-item:edit-quantity",{item:o.value,quantity:m,loaderRef:r}))},h=()=>{var m;(m=i.eventEmitter)==null||m.emit("order-item:open-configurator",{item:o.value})},p=()=>{var m;(m=i.eventEmitter)==null||m.emit("order-item:edit",{item:o.value})};return(m,g)=>{const b=I.NInputNumber;return t.openBlock(),t.createElementBlock("div",Z5,[n.item.configurator&&n.item.configuratorParams&&e.includes(n.item.configurator)?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",Q5,[t.createElementVNode("span",null,[g[1]||(g[1]=t.createTextVNode(" Количество: ",-1)),t.createElementVNode("span",J5,t.toDisplayString(n.item.quantity)+" шт.",1)]),t.createElementVNode("div",e3,[n.item.configurator===t.unref(W.ConfiguratorsEnum).Kozyrek?(t.openBlock(),t.createElementBlock("span",t3,[g[2]||(g[2]=t.createTextVNode(" Длина: ",-1)),t.createElementVNode("span",n3,t.toDisplayString(Math.round(n.item.length*1e3))+" мм.",1)])):t.createCommentVNode("",!0),n.item.configurator===t.unref(W.ConfiguratorsEnum).Mosquitto?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("span",null,[g[3]||(g[3]=t.createTextVNode(" Ширина: ",-1)),t.createElementVNode("span",i3,t.toDisplayString(Math.round(n.item.width*1e3))+" мм.",1)]),t.createElementVNode("span",null,[g[4]||(g[4]=t.createTextVNode(" Высота: ",-1)),t.createElementVNode("span",r3,t.toDisplayString(Math.round(n.item.height*1e3))+" мм.",1)])],64)):t.createCommentVNode("",!0),n.item.configurator===t.unref(W.ConfiguratorsEnum).Strip?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.item.configuratorParams.linesWidths,(y,_)=>(t.openBlock(),t.createElementBlock("span",{key:_},[t.createTextVNode(" Полоса №"+t.toDisplayString(Number(_)+1)+": ",1),t.createElementVNode("span",o3,t.toDisplayString(y)+" мм.",1)]))),128)),t.createElementVNode("span",null,[g[5]||(g[5]=t.createTextVNode(" Метраж: ",-1)),t.createElementVNode("span",s3,t.toDisplayString(n.item.length)+" м.",1)])],64)):t.createCommentVNode("",!0),n.item.configurator===t.unref(W.ConfiguratorsEnum).MetalForDoors?(t.openBlock(),t.createElementBlock(t.Fragment,{key:3},[t.createElementVNode("span",null,[g[6]||(g[6]=t.createTextVNode(" Ширина: ",-1)),t.createElementVNode("span",a3,t.toDisplayString(n.item.width)+" мм.",1)]),t.createElementVNode("span",null,[g[7]||(g[7]=t.createTextVNode(" Длина: ",-1)),t.createElementVNode("span",l3,t.toDisplayString(Math.round(n.item.length*1e3))+" мм.",1)])],64)):t.createCommentVNode("",!0),n.item.configurator===t.unref(W.ConfiguratorsEnum).Sandwich?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:4},t.renderList(n.item.configuratorParams.items??[],(y,_)=>(t.openBlock(),t.createElementBlock("span",{key:_},[t.createTextVNode(" Изделие №"+t.toDisplayString(Number(_)+1)+": ",1),t.createElementVNode("span",c3,t.toDisplayString(y.width)+"×"+t.toDisplayString(y.length)+" мм, "+t.toDisplayString(y.count)+" шт.",1)]))),128)):t.createCommentVNode("",!0),n.item.configurator===t.unref(W.ConfiguratorsEnum).SandwichM2?(t.openBlock(),t.createElementBlock(t.Fragment,{key:5},[t.createElementVNode("span",null,[g[8]||(g[8]=t.createTextVNode(" Ширина: ",-1)),t.createElementVNode("span",d3,t.toDisplayString(Math.round(n.item.width*1e3))+" мм.",1)]),t.createElementVNode("span",null,[g[9]||(g[9]=t.createTextVNode(" Длина: ",-1)),t.createElementVNode("span",u3,t.toDisplayString(Math.round(n.item.length*1e3))+" мм.",1)])],64)):t.createCommentVNode("",!0)])]),n.allowEdit?(t.openBlock(),t.createElementBlock("a",{key:0,href:"#",class:"text-xs text-blue-500 hover:text-blue-700 self-start mt-2.5",onClick:t.withModifiers(h,["prevent"])}," Изменить ")):t.createCommentVNode("",!0)],64)):s.value&&a.value>0?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("div",f3,[t.createElementVNode("span",null,[g[10]||(g[10]=t.createTextVNode(" Количество: ",-1)),t.createElementVNode("span",h3,t.toDisplayString(n.item.quantity)+" шт.",1)]),t.createElementVNode("div",m3,[t.createElementVNode("span",null,[g[11]||(g[11]=t.createTextVNode(" Длина: ",-1)),t.createElementVNode("span",p3,t.toDisplayString(a.value)+" "+t.toDisplayString(n.item.product.unit.name),1)]),t.createElementVNode("span",null,[g[12]||(g[12]=t.createTextVNode(" Всего: ",-1)),t.createElementVNode("span",g3,t.toDisplayString(l.value)+" "+t.toDisplayString(n.item.product.unit.name),1)])])]),n.allowEdit?(t.openBlock(),t.createElementBlock("a",{key:0,href:"#",class:"text-xs text-blue-500 hover:text-blue-700 self-start mt-2.5",onClick:t.withModifiers(p,["prevent"])}," Изменить ")):t.createCommentVNode("",!0)],64)):n.item.product.getIsMeasurable()?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("div",y3,[t.createElementVNode("span",null,[g[13]||(g[13]=t.createTextVNode(" Количество: ",-1)),t.createElementVNode("span",b3,t.toDisplayString(n.item.quantity)+" шт.",1)]),t.createElementVNode("span",_3,[g[14]||(g[14]=t.createTextVNode(" Метраж: ",-1)),t.createElementVNode("span",w3,t.toDisplayString(n.item.length??n.item.width)+" "+t.toDisplayString(n.item.product.unit.name),1)])]),n.allowEdit?(t.openBlock(),t.createElementBlock("a",{key:0,href:"#",class:"text-xs text-blue-500 hover:text-blue-700 self-start mt-2.5",onClick:t.withModifiers(p,["prevent"])}," Изменить ")):t.createCommentVNode("",!0)],64)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:3},[n.allowEdit?(t.openBlock(),t.createBlock(b,{key:0,value:u.value.quantity,parse:t.unref(ht),min:c.value,step:c.value,"show-button":d.value,"button-placement":"both","update-value-on-input":n.updateQuantityOnInput,disabled:!!r.value,loading:!!r.value,placeholder:"Кол-во",size:"small",class:"min-w-16 grow",onKeydown:g[0]||(g[0]=y=>t.unref(fo)(y,".",!1)),onFocus:t.unref(He),"onUpdate:value":f},{suffix:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(n.item.product.unit.name),1)]),_:1},8,["value","parse","min","step","show-button","update-value-on-input","disabled","loading","onFocus"])):(t.openBlock(),t.createElementBlock("span",x3,t.toDisplayString(n.item.quantity)+" "+t.toDisplayString(n.item.product.unit.name),1))],64))])}}}),C3={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function v3(n,e){return t.openBlock(),t.createElementBlock("svg",C3,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M13 4a1 1 0 0 1 1 1h4a1 1 0 0 1 .783.378l.074.108l3 5l.055.103l.04.107l.029.109l.016.11L22 11v6a1 1 0 0 1-1 1h-1.171a3.001 3.001 0 0 1-5.658 0H9.829a3.001 3.001 0 0 1-5.658 0H3a1 1 0 0 1-1-1V6a2 2 0 0 1 2-2zM7 16a1 1 0 1 0 0 2a1 1 0 0 0 0-2m10 0a1 1 0 1 0 0 2a1 1 0 0 0 0-2m.434-9H14v3h5.234z"},null,-1)])])}const S3=t.markRaw({name:"tabler-truck-filled",render:v3}),B3={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function N3(n,e){return t.openBlock(),t.createElementBlock("svg",B3,[...e[0]||(e[0]=[t.createElementVNode("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[t.createElementVNode("path",{d:"M5 17a2 2 0 1 0 4 0a2 2 0 1 0-4 0m10 0a2 2 0 1 0 4 0a2 2 0 1 0-4 0"}),t.createElementVNode("path",{d:"M5 17H3v-4M2 5h11v12m-4 0h6m4 0h2v-6h-8m0-5h5l3 5M3 9h4"})],-1)])])}const T3=t.markRaw({name:"tabler-truck-delivery",render:N3}),$3={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function E3(n,e){return t.openBlock(),t.createElementBlock("svg",$3,[...e[0]||(e[0]=[t.createElementVNode("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[t.createElementVNode("path",{d:"M2 3h1a2 2 0 0 1 2 2v10a2 2 0 0 0 2 2h15"}),t.createElementVNode("path",{d:"M9 9a3 3 0 0 1 3-3h4a3 3 0 0 1 3 3v2a3 3 0 0 1-3 3h-4a3 3 0 0 1-3-3zM7 19a2 2 0 1 0 4 0a2 2 0 1 0-4 0m9 0a2 2 0 1 0 4 0a2 2 0 1 0-4 0"})],-1)])])}const R3=t.markRaw({name:"tabler-truck-loading",render:E3}),P3={class:"flex flex-col gap-1"},F3={key:0,class:"flex flex-row gap-1 text-sm text-sc-grey"},V3={key:1,class:"text-base"},M3={class:"text-sc-dark-grey mr-1.5"},I3={key:0},A3={key:1},O3={},xs=t.defineComponent({...O3,__name:"order-delivery-label",props:{delivery:{},showType:{type:Boolean,default:!0},showDetails:{type:Boolean,default:!0}},setup(n){const e=t.computed(()=>{var s;return(s=W.useReferencesStore().deliveryTypeReference)==null?void 0:s.find(a=>a.id===o.delivery.type)}),i=t.computed(()=>Be.format(o.delivery.date,"dd.MM.yyyy")),r=t.computed(()=>{var s;return(s=o.delivery.address)!=null&&s.address?li.getFormatEntityName({name:o.delivery.address.address,deletedAt:o.delivery.address.deletedAt}):""}),o=n;return(s,a)=>{var u,f,h,p,m,g,b,y;const l=R3,c=T3,d=S3;return t.openBlock(),t.createElementBlock("div",P3,[n.showType?(t.openBlock(),t.createElementBlock("span",F3,[((u=e.value)==null?void 0:u.slug)==="self_delivery"?(t.openBlock(),t.createBlock(l,{key:0})):t.createCommentVNode("",!0),((f=e.value)==null?void 0:f.slug)==="delivery"?(t.openBlock(),t.createBlock(c,{key:1})):t.createCommentVNode("",!0),((h=e.value)==null?void 0:h.slug)==="transport_company_delivery"?(t.openBlock(),t.createBlock(d,{key:2})):t.createCommentVNode("",!0),t.createElementVNode("span",null,t.toDisplayString((p=e.value)==null?void 0:p.name),1)])):t.createCommentVNode("",!0),n.showDetails?(t.openBlock(),t.createElementBlock("span",V3,[t.createElementVNode("span",M3,t.toDisplayString(i.value),1),(g=(m=n.delivery)==null?void 0:m.address)!=null&&g.address?(t.openBlock(),t.createElementBlock("span",I3,t.toDisplayString(r.value),1)):t.createCommentVNode("",!0),(y=(b=n.delivery)==null?void 0:b.warehouse)!=null&&y.address?(t.openBlock(),t.createElementBlock("span",A3," со склада "+t.toDisplayString(n.delivery.warehouse.address),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)])}}}),z3={class:"flex flex-col gap-2.5"},D3={class:"text-base"},L3=["href"],H3={key:1,class:"text-sc-grey"},W3={},hm=t.defineComponent({...W3,__name:"order-common-info",props:{order:{},eventEmitter:{},allowEdit:{type:Boolean},fields:{},showAttachedUserColumn:{type:Boolean},orderContextButtonsConfig:{type:Function},onOrderContextSelect:{type:Function},orderUrl:{},highlightSettings:{}},setup(n){const e=n,i=t.computed(()=>e.fields.includes(Ie.Id)?e.order.id:void 0),r=t.computed(()=>{var f,h;return e.fields.includes(Ie.Status)?(h=(f=W.useReferencesStore().orderStatusReference)==null?void 0:f.find(p=>{var m;return p.id===(((m=e.order.status)==null?void 0:m.id)??-1)}))==null?void 0:h.name:void 0}),o=t.computed(()=>{var f;return ki((f=e.order.status)==null?void 0:f.slug)}),s=t.computed(()=>{var h,p;const f=(h=e.order.status)==null?void 0:h.slug;return!!f&&(((p=e.highlightSettings)==null?void 0:p.statuses.includes(f))??!1)}),a=t.computed(()=>Fs(e.order).filter(f=>[ct.OnOrder,ct.NotInStock].includes(f))),l=f=>{var h;return((h=e.highlightSettings)==null?void 0:h.markers.includes(f))??!1},c=t.computed(()=>e.fields.includes(Ie.CreatedAt)),d=t.computed(()=>e.fields.includes(Ie.ClientInfo)||e.fields.includes(Ie.ClientInfoShort)?e.order.client:void 0),u=t.computed(()=>e.fields.includes(Ie.DeliveryInfo)?e.order.delivery:void 0);return(f,h)=>(t.openBlock(),t.createElementBlock("div",z3,[t.createElementVNode("span",D3,[i.value?(t.openBlock(),t.createElementBlock("a",{key:0,href:n.orderUrl.replace(":id",n.order.id.toString()),target:"_blank",class:"text-sc-dark-grey"}," #"+t.toDisplayString(i.value),9,L3)):t.createCommentVNode("",!0),c.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[h[0]||(h[0]=t.createTextVNode(" от ",-1)),t.createVNode(es,{date:n.order.createdAt,"is-time-secondary":!0},null,8,["date"])],64)):t.createCommentVNode("",!0),r.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[h[1]||(h[1]=t.createTextVNode(" - ",-1)),s.value?(t.openBlock(),t.createElementBlock("span",{key:0,class:"font-medium",style:t.normalizeStyle({color:o.value.color})},t.toDisplayString(r.value),5)):(t.openBlock(),t.createElementBlock("span",H3,t.toDisplayString(r.value),1))],64)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value,p=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:p},[h[2]||(h[2]=t.createTextVNode(" - ",-1)),t.createElementVNode("span",{class:t.normalizeClass({"font-medium":l(p),"text-sc-dark-grey":!l(p)}),style:t.normalizeStyle(l(p)?{color:t.unref(Er)(p).color}:void 0)},t.toDisplayString(t.unref(Ps)(p)),7)],64))),128))]),d.value?(t.openBlock(),t.createBlock(Dr,{key:0,client:d.value,class:"ml-3"},null,8,["client"])):t.createCommentVNode("",!0),u.value?(t.openBlock(),t.createBlock(xs,{key:1,delivery:u.value,class:"ml-3"},null,8,["delivery"])):t.createCommentVNode("",!0)]))}}),j3={},kl=t.defineComponent({...j3,__name:"order-payment",props:{payment:{}},setup(n){const e=n,i=t.computed(()=>{var r;return(r=W.useReferencesStore().paymentTypeReference)==null?void 0:r.find(o=>o.id===e.payment.type)});return(r,o)=>{var s;return t.openBlock(),t.createElementBlock("span",null,t.toDisplayString(((s=i.value)==null?void 0:s.name)??"-"),1)}}}),q3={},X3=t.defineComponent({...q3,__name:"order-item-specification",props:{src:{}},setup(n){const e=t.useTemplateRef("image-reference");return(i,r)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("a",{class:"text-blue-500 hover:underline text-sm mt-1 block cursor-pointer",onClick:r[0]||(r[0]=o=>{var s;return(s=e.value)==null?void 0:s.showPreview()})}," Спецификация "),t.withDirectives(t.createVNode(t.unref(I.NImage),{ref:"image-reference",src:n.src,"previewed-img-props":{style:"max-width: 80vw; max-height: 80vh; object-fit: contain; border: 12px solid white;"}},null,8,["src"]),[[t.vShow,!1]])],64))}}),Y3={},ks=t.defineComponent({...Y3,__name:"creator-user-type-tag",props:{userType:{default:void 0},prefixText:{default:"Добавлено"},variant:{default:"info"},changedFields:{default:void 0}},setup(n){const e=n,i={quantity:"количество",length:"длина"},r=t.computed(()=>e.variant==="danger"||e.changedFields?"bg-orange-500":"bg-sky-500"),o=t.computed(()=>{const s={[W.UserTypeEnum.Manager]:"менеджером",[W.UserTypeEnum.Operator]:"оператором",[W.UserTypeEnum.Client]:"клиентом",[W.UserTypeEnum.Admin]:"администратором"};if(e.changedFields){const l=e.changedFields.map(d=>i[d]??d).join(", ");return`Было изменено${e.userType?` ${s[e.userType]??""}`:""}: ${l}`}const a=e.userType?` ${s[e.userType]??""}`:"";return`${e.prefixText}${a}`.trim()});return(s,a)=>(t.openBlock(),t.createElementBlock("small",{class:t.normalizeClass(`inline-block py-[0.0625rem] px-1.5 text-xs font-bold text-center whitespace-nowrap rounded text-white no-underline opacity-100 ${r.value}`)},t.toDisplayString(o.value),3))}}),U3={class:"flex flex-col gap-0.5"},K3={class:"text-gray-600"},G3={},mm=t.defineComponent({...G3,__name:"order-item-name",props:{item:{},showCode:{type:Boolean,default:!1},inactive:{type:Boolean,default:void 0}},setup(n){const e=n,i=t.inject(W.currentOrderInjectionKey,null),r=t.computed(()=>{if(i!=null)return t.toValue(i)??void 0}),o=t.computed(()=>{const{item:d,inactive:u}=e;return u??(!!d.isRemoved||!!d.replacementId)}),s=t.computed(()=>{const{creator:d}=e.item;return!!(d!=null&&d.type)&&(!r.value||r.value.creator.guid!==d.guid)}),a=t.computed(()=>"specificationImgUrl"in e.item?e.item.specificationImgUrl:void 0),l=t.computed(()=>"changedFields"in e.item?e.item.changedFields:[]),c=t.computed(()=>{var d,u;return"replacement"in e.item?(u=(d=e.item.replacement)==null?void 0:d.creator)==null?void 0:u.type:void 0});return(d,u)=>(t.openBlock(),t.createElementBlock("div",U3,[t.createElementVNode("div",{class:t.normalizeClass(o.value?"line-through opacity-50":"")},[t.createVNode(go,{product:n.item.product,"show-additional-sale-icon":n.item.isAdditionalSale??!1,"show-code":n.showCode},null,8,["product","show-additional-sale-icon","show-code"])],2),n.item.marker?(t.openBlock(),t.createElementBlock("span",{key:0,class:t.normalizeClass(o.value?"line-through opacity-50":"")},[u[0]||(u[0]=t.createTextVNode(" Маркировка: ",-1)),t.createElementVNode("span",K3,t.toDisplayString(n.item.marker),1)],2)):t.createCommentVNode("",!0),a.value?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(o.value?"line-through opacity-50":"")},[t.createVNode(X3,{src:a.value},null,8,["src"])],2)):t.createCommentVNode("",!0),s.value&&!o.value?(t.openBlock(),t.createBlock(ks,{key:2,"user-type":n.item.creator.type,class:"mt-1 self-start","prefix-text":"Добавлено"},null,8,["user-type"])):t.createCommentVNode("",!0),n.item.isRemoved&&!n.item.replacementId&&l.value.length===0?(t.openBlock(),t.createBlock(ks,{key:3,class:"mt-1 self-start","prefix-text":"Удалено",variant:"danger"})):t.createCommentVNode("",!0),n.item.replacementId&&l.value.length>0?(t.openBlock(),t.createBlock(ks,{key:4,"user-type":c.value,"changed-fields":l.value,class:"mt-1 self-start"},null,8,["user-type","changed-fields"])):t.createCommentVNode("",!0)]))}}),Z3={class:"flex flex-row gap-1.5"},Q3={class:"flex flex-1 flex-col gap-2.5"},J3={class:"flex items-start gap-1"},e4={},pm=t.defineComponent({...e4,__name:"order-product-info",props:{product:{},index:{},eventEmitter:{default:void 0},allowEdit:{type:Boolean,default:!1},updateQuantityOnInput:{type:Boolean,default:!0},inactive:{type:Boolean,default:!1}},setup(n){const e=n,i=t.computed(()=>e.inactive?"line-through opacity-50":"");return(r,o)=>(t.openBlock(),t.createElementBlock("div",Z3,[t.createElementVNode("span",{class:t.normalizeClass(["flex-none text-nowrap",i.value])},t.toDisplayString(n.index+1)+". ",3),t.createElementVNode("div",Q3,[t.createVNode(mm,{item:n.product,inactive:n.inactive,"show-code":""},null,8,["item","inactive"]),t.createElementVNode("div",J3,[t.createVNode(xl,{item:n.product,"event-emitter":n.eventEmitter,"allow-edit":n.allowEdit,"update-quantity-on-input":n.updateQuantityOnInput,class:t.normalizeClass(["min-w-0 flex-1",i.value])},null,8,["item","event-emitter","allow-edit","update-quantity-on-input","class"]),n.allowEdit?t.renderSlot(r.$slots,"actions",{key:0}):t.createCommentVNode("",!0)]),t.createElementVNode("div",{class:t.normalizeClass(["grid grid-flow-col grid-rows-2 gap-1 text-base",i.value])},[o[0]||(o[0]=t.createElementVNode("span",null,"Цена за ед.",-1)),t.createVNode(ci,{product:n.product,"cost-field-name":"costOneRub"},null,8,["product"]),o[1]||(o[1]=t.createElementVNode("span",null,"Сумма",-1)),t.createVNode(ci,{product:n.product,"cost-field-name":"cost"},null,8,["product"])],2)])]))}}),t4={class:"flex items-center gap-1.5"},n4={key:0,class:"h-1.5 w-1.5 shrink-0 rounded-full bg-current"},i4={key:0,class:"h-1.5 w-1.5 shrink-0 rounded-full bg-current"},r4={},gm=t.defineComponent({...r4,__name:"order-status-tag",props:{status:{},statusDetail:{default:null},variant:{default:"filled"},size:{default:"medium"},showDot:{type:Boolean,default:!0}},setup(n){const e=n,i=t.computed(()=>ki(e.status.slug)),r=t.computed(()=>Gl(e.status.slug)),o=t.computed(()=>e.statusDetail?`${e.status.name} (${e.statusDetail.name})`:e.status.name);return(s,a)=>{const l=I.NTag;return n.variant==="filled"?(t.openBlock(),t.createBlock(l,{key:0,color:r.value,bordered:!1,size:n.size,round:""},{default:t.withCtx(()=>[t.createElementVNode("span",t4,[n.showDot?(t.openBlock(),t.createElementBlock("span",n4)):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(o.value),1)])]),_:1},8,["color","size"])):(t.openBlock(),t.createElementBlock("span",{key:1,class:"inline-flex items-center gap-1.5 font-medium",style:t.normalizeStyle({color:i.value.color})},[n.showDot?(t.openBlock(),t.createElementBlock("span",i4)):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(o.value),1)],4))}}}),o4={},Cl=t.defineComponent({...o4,__name:"order-color-swatch",props:{colors:{}},setup(n){return(e,i)=>(t.openBlock(),t.createElementBlock("span",{class:"inline-flex h-5 min-w-8 shrink-0 items-center justify-center rounded px-1.5 text-xs font-semibold leading-none",style:t.normalizeStyle({backgroundColor:n.colors.backgroundColor,color:n.colors.textOnBackgroundColor,border:`1px solid ${n.colors.color}`})}," Аа ",4))}}),s4={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function a4(n,e){return t.openBlock(),t.createElementBlock("svg",s4,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"m112 112l20 320c.95 18.49 14.4 32 32 32h184c17.67 0 30.87-13.51 32-32l20-320"},null,-1),t.createElementVNode("path",{fill:"currentColor",stroke:"currentColor","stroke-linecap":"round","stroke-miterlimit":"10","stroke-width":"32",d:"M80 112h352"},null,-1),t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M192 112V72h0a23.93 23.93 0 0 1 24-24h80a23.93 23.93 0 0 1 24 24h0v40m-64 64v224m-72-224l8 224m136-224l-8 224"},null,-1)])])}const l4=t.markRaw({name:"ion-trash-outline",render:a4}),c4={key:0,class:"!mb-3 !mt-0 text-base font-semibold"},d4={class:"mb-1 flex flex-wrap items-baseline justify-between gap-2"},u4={class:"flex items-baseline gap-2"},f4={class:"text-base font-bold text-sc-dark-grey"},h4={key:0,class:"text-sm text-sc-grey"},m4={key:0,class:"text-sm text-sc-dark-grey"},p4={},g4=t.defineComponent({...p4,__name:"order-items-list",props:t.mergeModels({products:{},maxHeight:{default:void 0},eventEmitter:{default:void 0},allowEdit:{type:Boolean,default:!1},selectable:{type:Boolean,default:!1},title:{default:"Список позиций"},groups:{default:void 0},extraColumns:{default:void 0},isItemInactive:{type:Function,default:void 0},isItemSelectable:{type:Function,default:void 0},updateQuantityOnInput:{type:Boolean,default:!0}},{selectedRowKeys:{default:()=>[]},selectedRowKeysModifiers:{}}),emits:["update:selectedRowKeys"],setup(n){const e=n,i=t.useModel(n,"selectedRowKeys"),r=b=>V.sortBy(b,"ord"),o=t.computed(()=>r(e.products)),s=b=>e.isItemInactive?e.isItemInactive(b):!!b.isRemoved||!!b.replacementId,a=b=>e.isItemSelectable?e.isItemSelectable(b):!s(b),l=(b,y)=>{y?i.value.includes(b)||(i.value=[...i.value,b]):i.value=i.value.filter(_=>_!==b)},c=b=>e.selectable?{class:i.value.includes(b.id)?void 0:"opacity-60"}:{},d=(b,y)=>{const _=o.value,x=b.logicGroupId;if(!x)return 1;const w=_.at(y-1);if(y&&w&&w.logicGroupId===x)return 0;const C=_.slice(y),N=C.findIndex(k=>k.logicGroupId!==x);return N===-1?C.length:N},u=b=>s(b)?null:t.h(I.NButton,{quaternary:!0,size:"small",type:"error",onClick:()=>{var y;(y=e.eventEmitter)==null||y.emit("order-item:delete",{item:b})}},()=>t.h(l4)),f=t.ref(Ue.getDeviceTypeByResolution()),h=t.ref(window.innerWidth),p=()=>{const b=[{title:"№ п.п.",key:"id",resizable:!0,width:50,render:(_,x)=>t.h("span",{class:`text-base${s(_)?" line-through opacity-50":""}`},[x+1,"."])},{title:"Артикул",key:"codeNumber",resizable:!0,width:h.value>=1536?156:120,render:_=>t.h("span",{class:`text-base${s(_)?" line-through opacity-50":""}`},[_.product.code])},{title:"Наименование",key:"name",resizable:!0,render:_=>t.h(mm,{item:_,inactive:s(_)})},{title:"Кол-во",key:"quantity",resizable:!0,width:180,rowSpan:d,render:_=>t.h(xl,{class:s(_)?"line-through opacity-50":"",item:_,eventEmitter:e.eventEmitter,allowEdit:e.allowEdit&&!s(_),updateQuantityOnInput:e.updateQuantityOnInput})},{title:"Цена за ед.",key:"costOneRub",resizable:!0,width:120,render:_=>t.h("div",{class:s(_)?"line-through opacity-50":""},[t.h(ci,{product:_,costFieldName:"costOne",showQuantityUnit:!0})])},{title:"Сумма",key:"cost",resizable:!0,width:120,render:_=>t.h("div",{class:s(_)?"line-through opacity-50":""},[t.h(ci,{product:_,costFieldName:"cost",showCurrency:!0})])},...e.extraColumns??[],...e.allowEdit?[{title:"",key:"delete",width:44,rowSpan:d,render:_=>u(_)}]:[]],y=e.selectable?[{key:"checkbox",title:"",className:"align-top",width:"32",cellProps:_=>({class:a(_)?"cursor-pointer":void 0,onClick:()=>{a(_)&&l(_.id,!i.value.includes(_.id))}}),render:_=>t.h(I.NCheckbox,{checked:i.value.includes(_.id),disabled:!a(_)})}]:[];switch(f.value){case Xe.phone:case Xe.tablet:return[...y,{title:"",key:"items",resizable:!0,render:(_,x)=>{const w=d(_,x)>0,C=e.allowEdit&&!s(_)&&w;return t.h(pm,{product:_,index:x,eventEmitter:e.eventEmitter,allowEdit:C,updateQuantityOnInput:e.updateQuantityOnInput,inactive:s(_)},{actions:()=>u(_)})}}];case Xe.laptop:return[...y,...b];default:return[...y,...b]}},m=t.computed(()=>p()),g=()=>{f.value=Ue.getDeviceTypeByResolution(),h.value=window.innerWidth};return t.onMounted(()=>{g(),window.addEventListener("resize",g)}),t.onUnmounted(()=>{window.removeEventListener("resize",g)}),(b,y)=>{const _=I.NDataTable;return t.openBlock(),t.createElementBlock(t.Fragment,null,[n.title?(t.openBlock(),t.createElementBlock("h3",c4,t.toDisplayString(n.title),1)):t.createCommentVNode("",!0),n.groups?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:1},t.renderList(n.groups,x=>(t.openBlock(),t.createElementBlock("div",{key:x.name,class:"mb-6 last:mb-0"},[t.createElementVNode("div",d4,[t.createElementVNode("div",u4,[t.createElementVNode("span",f4,t.toDisplayString(x.name),1),x.description?(t.openBlock(),t.createElementBlock("span",h4,t.toDisplayString(x.description),1)):t.createCommentVNode("",!0)]),x.summary?(t.openBlock(),t.createElementBlock("span",m4,t.toDisplayString(x.summary),1)):t.createCommentVNode("",!0)]),t.createVNode(_,{columns:m.value,data:r(x.items),"row-key":w=>w.id,"row-props":c,"bottom-bordered":!1,bordered:!1,"max-height":n.maxHeight},null,8,["columns","data","row-key","max-height"])]))),128)):(t.openBlock(),t.createBlock(_,{key:2,columns:m.value,data:o.value,"row-key":x=>x.id,"row-props":c,"bottom-bordered":!1,bordered:!1,"max-height":n.maxHeight},null,8,["columns","data","row-key","max-height"]))],64)}}}),ym=gn(g4,[["__scopeId","data-v-be7a0384"]]),y4={key:0,class:"text-sc-dark-grey my-2 text-center"},b4={key:1,class:"text-sc-dark-grey my-2"},_4={},bm=t.defineComponent({..._4,__name:"order-status-history",props:{order:{}},setup(n){const e=n,i=t.ref(!1),r=t.ref([]),o=a=>{const{uiDateWithTime:l}=W.useBaseConfigStateStore().config.dateFormats;return Be.format(a,l)},s=(a=!0)=>{a&&(i.value=!0),W.HttpRequester.getInstance(W.OrdersDataProvider).getOrderStatusHistory(e.order.id).then(l=>{r.value=l}).finally(()=>{a&&(i.value=!1)})};return t.watch(()=>e.order,()=>{s(!1)}),t.onMounted(()=>{s()}),(a,l)=>{const c=I.NSpin,d=I.NTimelineItem,u=I.NTimeline;return t.openBlock(),t.createElementBlock("div",null,[l[1]||(l[1]=t.createElementVNode("h3",{class:"!mb-3 !mt-0 text-base font-semibold"},"История статусов",-1)),i.value?(t.openBlock(),t.createElementBlock("div",y4,[t.createVNode(c,{size:"small",class:"mb-1 align-middle"}),l[0]||(l[0]=t.createElementVNode("span",{class:"ml-2"},"Загрузка истории ...",-1))])):r.value.length===0?(t.openBlock(),t.createElementBlock("div",b4," История статусов отсутствует. ")):(t.openBlock(),t.createBlock(u,{key:2},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,(f,h)=>(t.openBlock(),t.createBlock(d,{key:h,color:t.unref(ki)(f.status.slug).color,time:o(f.createdAt),content:f.user.name},{header:t.withCtx(()=>[t.createVNode(gm,{status:f.status,"status-detail":f.statusDetail,variant:h===0?"filled":"text","show-dot":!1,size:"small"},null,8,["status","status-detail","variant"])]),_:2},1032,["color","time","content"]))),128))]),_:1}))])}}}),w4={class:"text-base"},x4={},vl=t.defineComponent({...x4,__name:"user-short-info",props:{user:{},showUserType:{type:Boolean,default:!0},extraInfoOnSecondLine:{type:Boolean,default:!0}},setup(n){return(e,i)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass({"flex flex-col":n.showUserType&&n.extraInfoOnSecondLine})},[t.createElementVNode("span",w4,t.toDisplayString(n.user.name),1),n.showUserType?(t.openBlock(),t.createElementBlock("span",{key:0,class:t.normalizeClass([{"ml-1":!n.extraInfoOnSecondLine},"text-sc-grey"])}," ["+t.toDisplayString(n.user.type)+"] ",3)):t.createCommentVNode("",!0)],2))}}),k4={class:"ml-4 grid grid-cols-3 gap-1.5 text-base"},C4={class:"col-span-2"},v4={class:"col-span-2"},S4={},_m=t.defineComponent({...S4,__name:"order-details",props:{order:{}},emits:["click:client-name"],setup(n,{emit:e}){const i=e;return(r,o)=>(t.openBlock(),t.createElementBlock("div",null,[o[11]||(o[11]=t.createElementVNode("h3",null,"Детали заказа",-1)),t.createElementVNode("div",k4,[n.order.creator.id!==n.order.client.id?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[o[1]||(o[1]=t.createElementVNode("span",null,"Создал",-1)),t.createVNode(vl,{user:n.order.creator,class:"col-span-2"},null,8,["user"])],64)):t.createCommentVNode("",!0),o[10]||(o[10]=t.createElementVNode("span",null,"Клиент",-1)),t.createVNode(Dr,{client:n.order.client,class:"col-span-2","onClick:clientName":o[0]||(o[0]=s=>i("click:client-name",n.order.client,s))},null,8,["client"]),n.order.contragent?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[o[2]||(o[2]=t.createElementVNode("span",null,"Контрагент",-1)),t.createVNode(rf,{contragent:n.order.contragent,class:"col-span-2"},null,8,["contragent"])],64)):t.createCommentVNode("",!0),n.order.image?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[o[3]||(o[3]=t.createElementVNode("span",null,"Графический файл клиента",-1)),o[4]||(o[4]=t.createElementVNode("a",{class:"fancybox col-span-2",href:"{{ order.image }}"}," Посмотреть ",-1))],64)):t.createCommentVNode("",!0),n.order.barcode?(t.openBlock(),t.createElementBlock(t.Fragment,{key:3},[o[5]||(o[5]=t.createElementVNode("span",null,"Штрих-код",-1)),t.createElementVNode("span",C4,t.toDisplayString(n.order.barcode),1)],64)):t.createCommentVNode("",!0),n.order.payment?(t.openBlock(),t.createElementBlock(t.Fragment,{key:4},[o[6]||(o[6]=t.createElementVNode("span",null,"Оплата",-1)),t.createVNode(kl,{payment:n.order.payment,class:"col-span-2"},null,8,["payment"])],64)):t.createCommentVNode("",!0),n.order.delivery?(t.openBlock(),t.createElementBlock(t.Fragment,{key:5},[o[7]||(o[7]=t.createElementVNode("span",null,"Доставка",-1)),t.createVNode(xs,{delivery:n.order.delivery,class:"col-span-2"},null,8,["delivery"])],64)):t.createCommentVNode("",!0),n.order.comment?(t.openBlock(),t.createElementBlock(t.Fragment,{key:6},[o[8]||(o[8]=t.createElementVNode("span",null,"Комментарий",-1)),t.createElementVNode("span",v4,t.toDisplayString(n.order.comment),1)],64)):t.createCommentVNode("",!0),n.order.attachedUser?(t.openBlock(),t.createElementBlock(t.Fragment,{key:7},[o[9]||(o[9]=t.createElementVNode("span",null,"Закреплен за",-1)),t.createVNode(vl,{user:n.order.attachedUser,class:"col-span-2"},null,8,["user"])],64)):t.createCommentVNode("",!0)])]))}}),B4={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function N4(n,e){return t.openBlock(),t.createElementBlock("svg",B4,[...e[0]||(e[0]=[t.createElementVNode("rect",{width:"336",height:"336",x:"128",y:"128",fill:"none",stroke:"currentColor","stroke-linejoin":"round","stroke-width":"32",rx:"57",ry:"57"},null,-1),t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"m383.5 128l.5-24a56.16 56.16 0 0 0-56-56H112a64.19 64.19 0 0 0-64 64v216a56.16 56.16 0 0 0 56 56h24"},null,-1)])])}const T4=t.markRaw({name:"ion-copy-outline",render:N4}),$4={class:"flex flex-col items-stretch gap-1.5 text-base"},E4={},R4=t.defineComponent({...E4,__name:"order-external-links",props:{showErpLink:{type:Boolean,default:!1},order:{}},setup(n){const e=t.computed(()=>{var r,o;const i=(((r=n.order.invoices)==null?void 0:r.length)??0)>0;return n.showErpLink&&!!n.order.erpOrderUrl||i||!!((o=n.order.payment)!=null&&o.onlinePaymentLink)});return(i,r)=>{var a;const o=I.NButton,s=T4;return e.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[r[2]||(r[2]=t.createElementVNode("h3",{class:"!mb-3 !mt-0 text-base font-semibold"},"Внешние ссылки",-1)),t.createElementVNode("div",$4,[n.showErpLink&&n.order.erpOrderUrl?(t.openBlock(),t.createBlock(o,{key:0,tag:"a",href:n.order.erpOrderUrl,target:"_blank",block:"",class:"sc-external-link-button"},{default:t.withCtx(()=>[...r[0]||(r[0]=[t.createTextVNode(" Открыть в ERP ",-1)])]),_:1},8,["href"])):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.order.invoices??[],(l,c)=>(t.openBlock(),t.createBlock(o,{key:c,tag:"a",href:l,block:"",class:"sc-external-link-button"},{default:t.withCtx(()=>[t.createTextVNode(" Скачать счет №"+t.toDisplayString(c+1),1)]),_:2},1032,["href"]))),128)),(a=n.order.payment)!=null&&a.onlinePaymentLink?t.withDirectives((t.openBlock(),t.createBlock(o,{key:1,block:"",class:"sc-external-link-button",title:"Ссылка на оплату копируется в буфер обмена"},{default:t.withCtx(()=>[t.createVNode(s,{class:"mr-1.5"}),r[1]||(r[1]=t.createTextVNode(" Скопировать ссылку на оплату ",-1))]),_:1})),[[t.unref(Xl),n.order.payment.onlinePaymentLink]]):t.createCommentVNode("",!0)])],64)):t.createCommentVNode("",!0)}}}),wm=gn(R4,[["__scopeId","data-v-6a3ae627"]]),P4={key:0},F4={class:"text-sc-dark-grey my-2 text-center"},V4={key:1,class:"text-sc-dark-grey my-2 text-center"},M4={key:2},I4={class:"text-sc-dark-grey mt-4 text-right font-bold"},A4={class:"text-sc-primary"},O4={class:"mb-4 max-w-xs empty:hidden"},z4={},xm=t.defineComponent({...z4,__name:"order-info",props:{order:{},eventEmitter:{default:void 0},allowEdit:{type:Boolean,default:!1}},emits:["click:client-name"],setup(n,{emit:e}){const i=n,r=e,o=t.ref(!1),s=t.ref();t.provide(W.currentOrderInjectionKey,t.computed(()=>s.value??null));const a=(d=!0)=>{if("products"in i.order){s.value=new W.Order(i.order);return}d&&(o.value=!0),W.HttpRequester.getInstance(W.OrdersDataProvider).getOrder(i.order.id).then(u=>{s.value=u}).finally(()=>{d&&(o.value=!1)})},l=t.computed(()=>{var d;return(((d=s.value)==null?void 0:d.products)??[]).filter(u=>!u.isRemoved&&!u.replacementId)}),c=t.computed(()=>Ve.formatMoney(V.sumBy(l.value,"costRub")));return t.watch(()=>i.order,()=>{a(!1)}),t.onMounted(()=>{a()}),(d,u)=>{const f=I.NSpin;return o.value?(t.openBlock(),t.createElementBlock("div",P4,[t.createElementVNode("div",F4,[t.createVNode(f,{size:"small",class:"mb-2.5 align-middle"}),u[1]||(u[1]=t.createElementVNode("div",null,[t.createElementVNode("span",null,"Загрузка данных ...")],-1))])])):!s.value||s.value.products.length===0?(t.openBlock(),t.createElementBlock("div",V4," --- Не удалось загрузить данные о заказе --- ")):(t.openBlock(),t.createElementBlock("div",M4,[t.createVNode(ym,{products:l.value,"event-emitter":n.eventEmitter,"allow-edit":n.allowEdit},null,8,["products","event-emitter","allow-edit"]),t.createElementVNode("div",I4,[u[2]||(u[2]=t.createTextVNode(" ИТОГО: ",-1)),t.createElementVNode("span",A4,t.toDisplayString(c.value)+" ₽",1)]),t.createVNode(_m,{order:s.value,"onClick:clientName":u[0]||(u[0]=h=>r("click:client-name",s.value.client,h))},null,8,["order"]),t.createElementVNode("div",O4,[t.createVNode(wm,{order:s.value,"show-erp-link":""},null,8,["order"])]),t.createVNode(bm,{order:s.value},null,8,["order"])]))}}}),D4={},L4=t.defineComponent({...D4,__name:"order-actions",props:{orderContextButtonsConfig:{type:Function,default:void 0},onOrderContextSelect:{type:Function,default:void 0},order:{}},setup(n){const e=n,i=t.inject(Rr,"small"),r=t.computed(()=>V.isNil(e.orderContextButtonsConfig)?[]:V.isFunction(e.orderContextButtonsConfig)?e.orderContextButtonsConfig(e.order):e.orderContextButtonsConfig),o=s=>{var a;(a=e.onOrderContextSelect)==null||a.call(e,e.order,s)};return(s,a)=>{var u;const l=Is,c=I.NButton,d=I.NDropdown;return((u=r.value)==null?void 0:u.length)>0?(t.openBlock(),t.createBlock(d,{key:0,options:r.value,size:t.unref(i),trigger:"click",onSelect:o},{default:t.withCtx(()=>[t.createVNode(c,{ghost:!0,size:t.unref(i),type:"primary"},{default:t.withCtx(()=>[t.createVNode(l)]),_:1},8,["size"])]),_:1},8,["options","size"])):t.createCommentVNode("",!0)}}}),H4={},W4=t.defineComponent({...H4,__name:"orders-list",props:t.mergeModels({fields:{},showAttachedUserColumn:{type:Boolean,default:!1},orderContextButtonsConfig:{},onOrderContextSelect:{},orderUrl:{},tableMinWidth:{default:1/0},filters:{default:void 0},sort:{default:void 0},pagination:{default:void 0},useCellIndication:{type:Boolean,default:!1},highlightSettings:{default:void 0},enableSorting:{type:Boolean,default:!1},refreshInterval:{default:0},stickyHeaderOnMobile:{type:Boolean,default:!0},selectable:{type:Boolean,default:!1},isRowSelectable:{type:Function,default:void 0}},{checkedRowKeys:{default:()=>[]},checkedRowKeysModifiers:{}}),emits:t.mergeModels(["click:client-name","dblclick:row","update:pagination","update:sort"],["update:checkedRowKeys"]),setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.useModel(n,"checkedRowKeys"),a=(T,D)=>{D?s.value.includes(T)||(s.value=[...s.value,T]):s.value=s.value.filter(K=>K!==T)},l=()=>V.cloneDeep(r.sort??[{field:"id",direction:"desc"}]),c=t.ref(l()),d=t.ref([]),u=t.ref(!1),f=t.ref(700),h=()=>{const T=Ue.getDeviceTypeByResolution(),D=T===Xe.phone||T===Xe.tablet;if(!(!r.stickyHeaderOnMobile&&D))return f.value*(W.useBaseConfigStateStore().config.tableDefaultHeightCoefficient??.6)},p=t.ref(h()),m=t.computed(()=>r.highlightSettings?r.highlightSettings:{statuses:[],markers:r.useCellIndication?[...co]:[]}),g=T=>{const D={onDblclick:()=>o("dblclick:row",T)},K=[];r.selectable&&s.value.length>0&&!s.value.includes(T.id)&&K.push("opacity-60");const J=m.value,U=new Set(Fs(T).filter(ue=>J.markers.includes(ue))),q={},le=[ct.NotInStock,ct.OnOrder,ct.LargeOrder].find(ue=>U.has(ue));if(le){const ue=Er(le);K.push("order-id-marked",le),q["--sc-order-id-bg"]=ue.backgroundColor,q["--sc-order-id-text"]=ue.textOnBackgroundColor}if(U.has(ct.NextDayDelivery)){const ue=Er(ct.NextDayDelivery);K.push("delivery-date-marked"),q["--sc-delivery-date-bg"]=ue.backgroundColor,q["--sc-delivery-date-text"]=ue.textOnBackgroundColor}return T.status.slug&&J.statuses.includes(T.status.slug)&&(K.push("order-status-highlighted",T.status.slug),V.assign(q,Zl(T.status.slug))),V.isEmpty(q)||(D.style=q),K.length>0&&(D.class=K.join(" ")),D},b=()=>{const T=[Ie.CreatedAt,Ie.Id,Ie.ClientInfo,Ie.ClientCity,Ie.DeliveryDate,Ie.PaymentType,Ie.SalesDirections,Ie.Status,...r.showAttachedUserColumn?[Ie.AttachedUser]:[],Ie.actions],D=r.fields.length>0?r.fields:T,K={title:"???",key:"undefined",render:()=>t.h("span",{},["--- unknown ---"])},J={type:"expand",expandable:V.constant(!0),renderExpand:L=>t.h(xm,{order:L,class:"pl-10 pt-3 pb-10","onClick:client-name":()=>{o("click:client-name",L.client,null)}}),width:"30"};let U=[{title:"Дата заказа",key:Ie.CreatedAt,resizable:!0,width:100,render:L=>t.h(es,{date:L.createdAt,isTimeSecondary:!0,isTimeOnSecondLine:!0,class:"text-base"})},{title:"№ заказа",key:Ie.Id,resizable:!0,width:75,className:"order-id",render:L=>t.h("a",{href:r.orderUrl.replace(":id",L.id.toString()),class:"text-base"},L.id)},{title:"Дата доставки / самовывоза",key:Ie.DeliveryDate,resizable:!0,width:120,className:"delivery-date",render:L=>t.h(es,{date:L.delivery.date,isShowTime:!1,class:"text-base"})},{title:"Клиент",key:Ie.ClientInfo,resizable:!0,minWidth:320,render:L=>t.h(Dr,{client:L.client,"onClick:client-name":()=>{o("click:client-name",L.client,null)}})},{title:"Тип доставки",key:Ie.DeliveryInfo,resizable:!0,minWidth:320,render:L=>t.h(xs,{delivery:L.delivery})},{title:"Клиент",key:Ie.ClientInfoShort,resizable:!0,minWidth:320,render:L=>t.h(Dr,{client:L.client,showCityAndRegion:!1,"onClick:client-name":()=>{o("click:client-name",L.client,null)}})},{title:"Город клиента",key:Ie.ClientCity,resizable:!0,minWidth:90,width:120,render:L=>{var le;return t.h("span",{class:"text-base"},((le=L.client)==null?void 0:le.city.name)??"—")}},{title:"Статус",key:Ie.Status,resizable:!0,width:150,minWidth:115,className:"order-status",render:L=>t.h("span",{class:"text-base"},[L.status.name])},{title:"Тип оплаты",key:Ie.PaymentType,resizable:!0,width:115,minWidth:95,render:L=>L.payment?t.h(kl,{payment:L.payment}):t.h("span",{class:"text-base"},"—")},{title:"Напр. продаж",key:Ie.SalesDirections,resizable:!0,width:80,render:L=>{var le;return t.h("span",{class:"text-base"},[((le=L.salesDirection)==null?void 0:le.name)??""])}},...r.showAttachedUserColumn?[{title:"Закреплено за",key:Ie.AttachedUser,resizable:!0,minWidth:120,render:L=>{var le;return t.h("span",{class:"text-base"},[((le=L==null?void 0:L.attachedUser)==null?void 0:le.name)??""])}}]:[]];r.orderContextButtonsConfig&&U.push({key:"actions",title:"",className:"align-top",width:50,render:L=>t.h(L4,{order:L,orderContextButtonsConfig:r.orderContextButtonsConfig,onOrderContextSelect:r.onOrderContextSelect})}),r.enableSorting&&(U=U.map(L=>[Ie.Id,Ie.CreatedAt,Ie.DeliveryDate].includes(L.key)?{...L,sorter:!0,sortOrder:!1,...L.width===void 0?{}:{width:L.width+16}}:L));const q=r.selectable?[{key:"selection",title:"",className:"align-top",width:"32",cellProps:L=>{var ue;const le=((ue=r.isRowSelectable)==null?void 0:ue.call(r,L))??!0;return{class:le?"cursor-pointer":void 0,onClick:()=>{le&&a(L.id,!s.value.includes(L.id))}}},render:L=>{var le;return((le=r.isRowSelectable)==null?void 0:le.call(r,L))??!0?t.h(I.NCheckbox,{checked:s.value.includes(L.id)}):null}}]:[];switch(Ue.getDeviceTypeByResolution()){case Xe.phone:case Xe.tablet:return[...q,J,{key:"order",title:"Заказ",resizable:!0,render:L=>t.h(hm,{order:L,fields:D,orderUrl:r.orderUrl,highlightSettings:m.value})}];case Xe.laptop:{const L=r.showAttachedUserColumn?D:D.filter(le=>le!==Ie.AttachedUser);return[...q,J,...L.map(le=>U.find(ue=>ue.key===le)??K)]}default:return[K]}},y=t.ref(b()),_=t.ref(new W.TableDataPagination(r.pagination??{page:1,pageSize:10,itemCount:0,pageCount:1,pageSlot:5,pageSizes:[10,15,25],showSizePicker:!0})),x=t.computed(()=>({..._.value,prefix({itemCount:T}){return`Всего заказов: ${T}`}})),w=t.ref(null),C=t.ref(null),N=t.ref(null),k=t.ref(null),$=t.ref(null),v=()=>{$.value!==null&&(clearInterval($.value),$.value=null)},E=()=>{v(),r.refreshInterval&&($.value=setInterval(()=>{R()},r.refreshInterval))},P=T=>{_.value.itemCount!==T.meta.total&&(_.value.itemCount=T.meta.total),_.value.page!==T.meta.currentPage&&(_.value.page=T.meta.currentPage),_.value.pageCount!==T.meta.lastPage&&(_.value.pageCount=T.meta.lastPage),_.value.pageSize!==T.meta.perPage&&(_.value.pageSize=T.meta.perPage),d.value=T.data},F=()=>{var T,D,K;r.filters&&((T=C.value)==null||T.abort(),C.value=null,(D=N.value)==null||D.abort(),N.value=null,k.value=null,(K=w.value)==null||K.abort(),w.value=new AbortController,u.value=!0,W.HttpRequester.getInstance(W.OrdersDataProvider).getOrders(r.filters,c.value,{page:_.value.page,pageSize:_.value.pageSize},w.value.signal).then(J=>{P(J),u.value=!1}).catch(J=>{if((J==null?void 0:J.name)!=="CanceledError")throw u.value=!1,J}))},R=()=>{var T;!r.filters||u.value||((T=C.value)==null||T.abort(),C.value=new AbortController,W.HttpRequester.getInstance(W.OrdersDataProvider).getOrders(r.filters,c.value,{page:_.value.page,pageSize:_.value.pageSize},C.value.signal).then(D=>{d.value=d.value.map(K=>D.data.find(U=>U.id===K.id)??K),_.value.itemCount!==D.meta.total&&(_.value.itemCount=D.meta.total),_.value.pageCount!==D.meta.lastPage&&(_.value.pageCount=D.meta.lastPage)}).catch(D=>{if((D==null?void 0:D.name)!=="CanceledError")throw D}))},M=T=>T.meta.total===_.value.itemCount&&V.isEqual(V.map(T.data,"id"),V.map(d.value,"id")),X=async()=>{var D,K;if(!r.filters||u.value)return!1;(D=C.value)==null||D.abort(),C.value=null,(K=N.value)==null||K.abort(),N.value=new AbortController;let T;try{T=await W.HttpRequester.getInstance(W.OrdersDataProvider).getOrders(r.filters,c.value,{page:_.value.page,pageSize:_.value.pageSize},N.value.signal)}catch(J){if((J==null?void 0:J.name)==="CanceledError")return!1;throw J}return M(T)?(d.value=d.value.map(J=>T.data.find(U=>U.id===J.id)??J),k.value=null,!1):(k.value=T,!0)},G=()=>k.value?(P(k.value),k.value=null,!0):!1,Z=()=>{k.value=null},O=T=>{_.value.page=T,F(),o("update:pagination",_.value)},A=T=>{_.value.pageSize=T,_.value.page=1,F(),o("update:pagination",_.value)},Y=T=>{if(V.isNull(T))c.value=l();else{const[D]=c.value;D.field=T.columnKey.toString(),D.direction=T.order==="ascend"?"asc":"desc",c.value=[D]}y.value.forEach(D=>{if(Object.hasOwn(D,"sortOrder")){const K=D;K.sortOrder=K.key===(T==null?void 0:T.columnKey)&&(T!=null&&T.sorter)&&T.order!==!1?T.order:!1}}),F(),o("update:sort",c.value)},H=()=>{y.value=b(),f.value=window.innerHeight,p.value=h()};return t.watch(()=>r.filters,()=>{_.value.page=1,F(),E()}),t.watch(()=>r.sort,()=>{c.value=l(),_.value.page=1,F(),E()}),t.onMounted(()=>{H(),window.addEventListener("resize",H),t.nextTick(()=>{F(),E()})}),t.onUnmounted(()=>{var T,D,K;window.removeEventListener("resize",H),(T=w.value)==null||T.abort(),(D=C.value)==null||D.abort(),(K=N.value)==null||K.abort(),v()}),e({reload:F,checkForUpdates:X,applyPendingUpdate:G,discardPendingUpdate:Z}),(T,D)=>{const K=I.NDataTable;return t.openBlock(),t.createBlock(K,{columns:y.value,data:d.value,"row-key":J=>J.id,"row-props":g,"scroll-x":n.tableMinWidth,pagination:x.value,loading:u.value,remote:!0,bordered:!1,"bottom-bordered":!1,"sticky-expanded-rows":!0,"max-height":p.value,"pagination-behavior-on-filter":"first","onUpdate:page":O,"onUpdate:pageSize":A,"onUpdate:sorter":Y},null,8,["columns","data","row-key","scroll-x","pagination","loading","max-height"])}}}),j4=gn(W4,[["__scopeId","data-v-aff76adb"]]),q4=t.computed(()=>W.useReferencesStore().deliveryTypeReference??[]),X4=t.computed(()=>W.useReferencesStore().managersList??[]),Y4=t.computed(()=>W.useReferencesStore().opfReference??[]),U4=t.computed(()=>W.useReferencesStore().partnerGroupsReference??[]),K4=t.computed(()=>W.useReferencesStore().priceCoefficientsReference??[]),G4=t.computed(()=>W.useReferencesStore().productFilesTypesReference??[]),Z4=t.computed(()=>W.useReferencesStore().resourceTypesReference),Q4=t.computed(()=>W.useReferencesStore().salesDirectionsReference??[]),J4=t.computed(()=>W.useReferencesStore().warehousesReference??[]),eN=t.computed(()=>W.useReferencesStore().paymentTypeReference??[]),km=t.computed(()=>W.useReferencesStore().orderStatusReference??[]),tN=t.computed(()=>W.useReferencesStore().orderStatusDetailReference??[]),nN=t.computed(()=>W.useReferencesStore().operatorReference??[]),iN=t.computed(()=>wt.convertReferencesToSelectOptionsList(W.useReferencesStore().channelPrimaryInterestsReference??[],!0,!1,!0)),rN=t.computed(()=>wt.convertReferencesToSelectOptionsList(W.useReferencesStore().sourcePrimaryInterestsReference??[],!0,!1,!0)),oN=n=>W.HttpRequester.getInstance(W.ReferenceDataProvider).searchCity(n),sN=n=>wt.convertReferencesToSelectOptionsList(n,!0,!1,!1,e=>{var i,r,o;return e!=null&&e.isNewRec()?"-":`${e.name}, ${(i=e==null?void 0:e.region)==null?void 0:i.name}, ${(o=(r=e==null?void 0:e.region)==null?void 0:r.country)==null?void 0:o.name}`},e=>e==null?void 0:e.isNewRec()),aN=async n=>V.map(await W.HttpRequester.getInstance(W.ReferenceDataProvider).searchRegion(n),e=>new W.Region(e)),lN=n=>wt.convertReferencesToSelectOptionsList(n,!0,!1,!1,e=>e.isNewRec()?"-":V.join(V.compact([e.name,e.country.name]),", "),e=>e.isNewRec()),cN=n=>W.HttpRequester.getInstance(W.ClientDataProvider).searchClient(n),dN=n=>wt.convertReferencesToSelectOptionsList(n,!0,!1,!1,e=>e.isNewRec()?"-":[e.name,e.salesDirection.name?`(${e.salesDirection.name})`:void 0,e.city.name?`г. ${e.city.name}${e.city.region.name?`, ${e.city.region.name}`:""}`:void 0,e.isActive?void 0:"[ Деактивирован ]"].filter(Boolean).join(" "),e=>e==null?void 0:e.isNewRec()),uN={class:"flex flex-col gap-4"},fN={class:"flex flex-wrap gap-2"},hN={class:"flex flex-col gap-1.5"},mN={class:"inline-flex items-center gap-2"},pN={class:"flex flex-col gap-1.5"},gN={class:"inline-flex items-center gap-2"},yN={},bN=t.defineComponent({...yN,__name:"order-highlight-settings",props:{settings:{},statuses:{default:void 0}},emits:["update:settings"],setup(n,{emit:e}){const i=n,r=e,o=t.computed(()=>i.statuses??km.value),s=d=>!!d&&i.settings.statuses.includes(d),a=(d,u)=>{if(!d)return;const f=i.settings.statuses.filter(h=>h!==d);r("update:settings",{...i.settings,statuses:u?[...f,d]:f})},l=(d,u)=>{const f=i.settings.markers.filter(h=>h!==d);r("update:settings",{...i.settings,markers:u?[...f,d]:f})},c=d=>{r("update:settings",{statuses:d?o.value.flatMap(u=>u.slug?[u.slug]:[]):[],markers:d?[...co]:[]})};return(d,u)=>{const f=I.NButton,h=I.NCheckbox;return t.openBlock(),t.createElementBlock("div",uN,[t.createElementVNode("div",fN,[t.createVNode(f,{size:"small",onClick:u[0]||(u[0]=p=>c(!0))},{default:t.withCtx(()=>[...u[2]||(u[2]=[t.createTextVNode(" Выделять всё ",-1)])]),_:1}),t.createVNode(f,{size:"small",onClick:u[1]||(u[1]=p=>c(!1))},{default:t.withCtx(()=>[...u[3]||(u[3]=[t.createTextVNode(" Снять всё ",-1)])]),_:1})]),t.createElementVNode("div",hN,[u[4]||(u[4]=t.createElementVNode("div",{class:"text-sm font-semibold"},"Статусы",-1)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.value,p=>(t.openBlock(),t.createBlock(h,{key:p.id,checked:s(p.slug),"onUpdate:checked":m=>a(p.slug,m)},{default:t.withCtx(()=>[t.createElementVNode("span",mN,[t.createVNode(Cl,{colors:t.unref(ki)(p.slug)},null,8,["colors"]),t.createTextVNode(" "+t.toDisplayString(p.name),1)])]),_:2},1032,["checked","onUpdate:checked"]))),128))]),t.createElementVNode("div",pN,[u[5]||(u[5]=t.createElementVNode("div",{class:"text-sm font-semibold"},"Маркеры",-1)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(co),p=>(t.openBlock(),t.createBlock(h,{key:p,checked:n.settings.markers.includes(p),"onUpdate:checked":m=>l(p,m)},{default:t.withCtx(()=>[t.createElementVNode("span",gN,[t.createVNode(Cl,{colors:t.unref(Er)(p)},null,8,["colors"]),t.createTextVNode(" "+t.toDisplayString(t.unref(Ps)(p)),1)])]),_:2},1032,["checked","onUpdate:checked"]))),128))])])}}}),_N=["href"],wN={class:"text-sc-dark-grey"},xN={},kN=t.defineComponent({...xN,__name:"short-text-order-info",props:{order:{},orderLink:{}},emits:["click:order-id"],setup(n,{emit:e}){const i=n,r=e,o=t.computed(()=>Be.format(i.order.createdAt,W.useBaseConfigStateStore().config.dateFormats.uiDateWithTime)),s=a=>{V.isNil(i.orderLink)&&(a.preventDefault(),a.stopPropagation()),r("click:order-id",i.order,a)};return(a,l)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("span",null,[l[1]||(l[1]=t.createTextVNode(" #",-1)),t.createElementVNode("a",{href:n.orderLink??"#",onClick:l[0]||(l[0]=c=>s(c))},t.toDisplayString(n.order.id),9,_N),t.createTextVNode(" от "+t.toDisplayString(o.value),1)]),l[2]||(l[2]=t.createTextVNode(", ",-1)),t.createElementVNode("span",wN,"автор: "+t.toDisplayString(n.order.creator.name)+" ["+t.toDisplayString(n.order.creator.type)+"]",1)],64))}}),CN={class:"sc-page flex flex-col bg-inherit"},vN={class:"my-2 flex flex-row items-end"},SN={class:"sc-title grow"},BN={key:0,class:"sc-title-buttons flex-1 grow-0"},NN={class:"flex flex-col justify-end gap-1 sm:mt-0 sm:flex-row"},TN={key:0,class:"sc-title-extra mt-2 sm:mt-4"},$N={},Cm=t.defineComponent({...$N,__name:"page",props:{title:{default:void 0},stickyHeader:{type:Boolean},stickyTopOffset:{default:0},stickyHeaderOnMobile:{type:Boolean,default:!0}},setup(n){const e=n,i=t.computed(()=>e.stickyHeaderOnMobile?"sticky z-10 bg-inherit":"lg:sticky z-10 bg-inherit");return(r,o)=>{const s=I.NH1;return t.openBlock(),t.createElementBlock("div",CN,[t.createElementVNode("div",{class:t.normalizeClass(n.stickyHeader?i.value:void 0),style:t.normalizeStyle(n.stickyHeader?{top:`${n.stickyTopOffset??0}px`}:void 0)},[t.createElementVNode("div",vN,[t.createElementVNode("div",SN,[t.renderSlot(r.$slots,"title",{},()=>[t.createVNode(s,{class:"m-0 leading-none lg:mb-3 lg:leading-normal"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(n.title??""),1)]),_:1})])]),r.$slots["title-buttons"]?(t.openBlock(),t.createElementBlock("div",BN,[t.createElementVNode("div",NN,[t.renderSlot(r.$slots,"title-buttons")])])):t.createCommentVNode("",!0)]),r.$slots["title-extra"]?(t.openBlock(),t.createElementBlock("div",TN,[t.renderSlot(r.$slots,"title-extra")])):t.createCommentVNode("",!0),t.renderSlot(r.$slots,"sticky-extra")],6),t.renderSlot(r.$slots,"default")])}}}),EN={class:"overflow-hidden transition-all duration-300"},RN={class:"text-lg font-medium leading-none"},PN={},vm=t.defineComponent({...PN,__name:"sliding-content-with-drawer",props:{drawerWidth:{type:[Number,Function],default:void 0},showDrawer:{type:Boolean,default:!1},title:{default:""}},emits:["update:show-drawer"],setup(n,{emit:e}){const i=n,r=e,o=t.ref(0),s=t.ref(i.showDrawer),a=()=>{switch(Ue.getDeviceTypeByResolution()){case Xe.phone:return window.innerWidth*.8;case Xe.tablet:return window.innerWidth*.5;default:return window.innerWidth*.33}},l=()=>{s.value?V.isUndefined(i.drawerWidth)?o.value=a():o.value=V.isFunction(i.drawerWidth)?i.drawerWidth():i.drawerWidth:o.value=0};return t.watch(()=>i.drawerWidth,()=>{l()}),t.watch(()=>s.value,()=>{l(),r("update:show-drawer",s.value)}),t.watch(()=>i.showDrawer,c=>{s.value=c}),t.onUnmounted(()=>{window.removeEventListener("resize",l)}),l(),window.addEventListener("resize",l),(c,d)=>{const u=I.NDrawerContent,f=I.NDrawer;return t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",EN,[t.createElementVNode("div",{style:t.normalizeStyle(`margin-left: ${o.value}px;`),class:"w-full"},[t.renderSlot(c.$slots,"default")],4)]),t.createVNode(f,{show:s.value,"onUpdate:show":d[0]||(d[0]=h=>s.value=h),resizable:!0,width:o.value,placement:"left"},{default:t.withCtx(()=>[t.createVNode(u,{closable:""},{header:t.withCtx(()=>[t.renderSlot(c.$slots,"drawer-header",{},()=>[t.createElementVNode("div",RN,t.toDisplayString(n.title),1)])]),default:t.withCtx(()=>[t.renderSlot(c.$slots,"drawer-content")]),footer:t.withCtx(()=>[t.renderSlot(c.$slots,"drawer-footer")]),_:3})]),_:3},8,["show","width"])],64)}}}),FN={ref:"panel-component-ref",class:"sc-page-panel flex flex-row gap-2.5 bg-inherit sm:gap-8"},VN={key:0},MN={class:"sc-page-preview-panel grow"},IN={key:1,class:"sc-page-preview-panel-extra flex-none"},AN={},ON=t.defineComponent({...AN,__name:"page-with-sliding-panel",props:{title:{},isShowPanelButtonVisible:{type:Boolean,default:!0},showPanelButtonText:{default:""},panelTitle:{default:""},stickyHeader:{type:Boolean,default:!1},stickyTopOffset:{default:0},stickyHeaderOnMobile:{type:Boolean,default:!0}},setup(n,{expose:e}){const i=t.ref(!1),r=()=>{i.value=!0},o=()=>{i.value=!1},s=t.useTemplateRef("panel-component-ref");return e({scrollToTopOfPanel:l=>{var c;(c=s.value)==null||c.scrollIntoView({behavior:"smooth"}),l&&t.nextTick(()=>{var d,u;window.scrollTo({top:(((u=(d=s.value)==null?void 0:d.getBoundingClientRect())==null?void 0:u.top)??0)+window.pageYOffset+l,behavior:"smooth"})})},showPanel:r,closePanel:o}),(l,c)=>{const d=I.NButton;return t.openBlock(),t.createBlock(Cm,{title:n.title,"sticky-header":n.stickyHeader,"sticky-top-offset":n.stickyTopOffset,"sticky-header-on-mobile":n.stickyHeaderOnMobile},t.createSlots({default:t.withCtx(()=>[t.createVNode(vm,{"show-drawer":i.value,"onUpdate:showDrawer":c[1]||(c[1]=u=>i.value=u),title:n.panelTitle},t.createSlots({"drawer-content":t.withCtx(()=>[t.renderSlot(l.$slots,"panel-content")]),default:t.withCtx(()=>[t.renderSlot(l.$slots,"default")]),_:2},[l.$slots["panel-header"]?{name:"drawer-header",fn:t.withCtx(()=>[t.renderSlot(l.$slots,"panel-header")]),key:"0"}:void 0,l.$slots["panel-bottom"]?{name:"drawer-footer",fn:t.withCtx(()=>[t.renderSlot(l.$slots,"panel-bottom")]),key:"1"}:void 0]),1032,["show-drawer","title"])]),_:2},[l.$slots.title?{name:"title",fn:t.withCtx(()=>[t.renderSlot(l.$slots,"title")]),key:"0"}:void 0,l.$slots["title-buttons"]?{name:"title-buttons",fn:t.withCtx(()=>[t.renderSlot(l.$slots,"title-buttons")]),key:"1"}:void 0,l.$slots["title-extra"]?{name:"title-extra",fn:t.withCtx(()=>[t.renderSlot(l.$slots,"title-extra")]),key:"2"}:void 0,l.$slots["preview-panel"]||l.$slots["preview-panel-extra"]||n.isShowPanelButtonVisible?{name:"sticky-extra",fn:t.withCtx(()=>[t.createElementVNode("div",FN,[n.isShowPanelButtonVisible?(t.openBlock(),t.createElementBlock("div",VN,[t.renderSlot(l.$slots,"show-panel-button",{onClickHandler:()=>{i.value=!0}},()=>[t.createVNode(d,{class:"flex-none sm:px-10 sm:py-4",onClick:c[0]||(c[0]=u=>i.value=!0)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(n.showPanelButtonText),1)]),_:1})])])):t.createCommentVNode("",!0),t.createElementVNode("div",MN,[t.renderSlot(l.$slots,"preview-panel")]),l.$slots["preview-panel-extra"]?(t.openBlock(),t.createElementBlock("div",IN,[t.renderSlot(l.$slots,"preview-panel-extra")])):t.createCommentVNode("",!0)],512)]),key:"3"}:void 0]),1032,["title","sticky-header","sticky-top-offset","sticky-header-on-mobile"])}}}),zN={},DN=t.defineComponent({...zN,__name:"curator-select",props:{value:{default:null},clearable:{type:Boolean,default:!1},consistentMenuWidth:{type:Boolean},wrapContent:{type:Boolean},managerReferenceList:{default:()=>[]},showEmptyValue:{type:Boolean,default:!1}},emits:["update:value"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.computed(()=>V.isArray(r.value)),a=t.computed(()=>{var m;return V.isArray(r.value)?r.value.map(g=>g.id):((m=r.value)==null?void 0:m.id)??null}),l=t.computed(()=>{const m=new W.Curator({id:-1,name:"",contacts:{},curatedDirection:new W.CuratedDirection({id:-1,name:"",guid:""}),guid:""}),g=r.showEmptyValue?[m]:[];return r.managerReferenceList.filter(b=>{var y;return(((y=b==null?void 0:b.curatedDirections)==null?void 0:y.length)??0)>0}).forEach(b=>{((b==null?void 0:b.curatedDirections)??[]).forEach(y=>{g.push(new W.Curator({id:b.id,guid:b.guid,name:b.name,photo:b.photo,contacts:b.contacts??{},curatedDirection:y}))})}),g}),c=t.computed(()=>wt.convertReferencesToSelectOptionsList(l.value,!0,{key:"item.curatedDirection.id",label:"item.curatedDirection.name"},!1,m=>{const g=V.some(s.value?r.value:[r.value],["id",m.id])?` (${m.curatedDirection.name}) `:"";return m.curatedDirection.isNewRec()?m.name:`${m.name}${g}`})),d=t.computed(()=>c.value.map(m=>({...m,class:r.wrapContent?`${m.class} consistent-menu-width`:m.class}))),u=t.useTemplateRef("select-component"),f=m=>{if(V.isArray(m)){const g=m.length>0?m.map(b=>l.value.find(y=>y.id===b)).filter(b=>!V.isNil(b)):[];o("update:value",g)}else{const g=m>0?l.value.find(b=>b.id===m):null;o("update:value",g??null)}};return t.watch(()=>r.value,()=>{var m,g;(g=(m=u.value)==null?void 0:m.$forceUpdate)==null||g.call(m)},{deep:!0}),e({focus:()=>{var m;return(m=u.value)==null?void 0:m.focusInput()},blur:()=>{var m;return(m=u.value)==null?void 0:m.blurInput()}}),(m,g)=>(t.openBlock(),t.createBlock(t.unref(I.NSelect),{ref:"select-component",value:a.value,clearable:n.clearable,disabled:c.value.length===0,"consistent-menu-width":n.consistentMenuWidth,multiple:s.value,options:d.value,placeholder:"","onUpdate:value":f},null,8,["value","clearable","disabled","consistent-menu-width","multiple","options"]))}}),LN={},HN=t.defineComponent({...LN,__name:"manager-operator-select",props:{value:{default:null},clearable:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},consistentMenuWidth:{type:Boolean,default:!0},wrapContent:{type:Boolean,default:!1},managerReferenceList:{default:()=>[]},operatorReferenceList:{default:()=>[]},showActualOnly:{type:Boolean,default:!1},groupByEmployeeType:{type:Boolean,default:!1},filterable:{type:Boolean,default:!0},maxTagCount:{default:void 0}},emits:["update:value"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.computed(()=>V.isArray(r.value)),a=t.computed(()=>{var y;return V.isArray(r.value)?r.value.filter(_=>!V.isNil(_)).map(_=>_.id):((y=r.value)==null?void 0:y.id)??null}),l=t.computed(()=>[...r.operatorReferenceList,...r.managerReferenceList]),c=t.computed(()=>{var w;const y=[];r.operatorReferenceList.length>0&&y.push({type:"group",label:"Операторы",key:"operators",children:r.operatorReferenceList.map(C=>({label:C.name,value:C.id,item:C}))});let _=r.managerReferenceList;if(r.showActualOnly){const C=V.isArray(r.value)?r.value.map(N=>N.id):[(w=r.value)==null?void 0:w.id];_=_.filter(N=>N.isActive||C.includes(N.id))}const x=wt.convertReferencesToSelectOptionsList(_,!0,{key:"item.salesDirection.id",label:"item.salesDirection.name"},!1,C=>`${C.name}${C.isActive?"":" [Не активен]"}`);return y.length>0&&x.length>0&&y.push({key:"manager-operator-divider",disabled:!0,render:()=>t.h("div",{class:"sc-manager-operator-select__divider"})}),y.push(...x),y}),d=y=>`${y.name}${"isActive"in y&&!y.isActive?" [Не активен]":""}`,u=t.computed(()=>{var N;const y=V.isArray(r.value)?r.value.map(k=>k.id):[(N=r.value)==null?void 0:N.id],_=k=>r.showActualOnly?k.filter($=>!("isActive"in $)||$.isActive||y.includes($.id)):k,x=[],w=_(r.managerReferenceList);w.length>0&&x.push({type:"group",label:"Менеджеры",key:"managers",children:wt.convertReferencesToSelectOptionsList(w,!0,!1,!1,d)});const C=_(r.operatorReferenceList);return C.length>0&&x.push({type:"group",label:"Операторы",key:"operators",children:wt.convertReferencesToSelectOptionsList(C,!0,!1,!1,d)}),x}),f=t.computed(()=>r.groupByEmployeeType?u.value:c.value),h=t.computed(()=>f.value.map(y=>({...y,class:r.wrapContent?`${y.class??""} consistent-menu-width`:y.class}))),p=t.useTemplateRef("select-component"),m=y=>{if(V.isArray(y)){const _=y.map(x=>l.value.find(w=>w.id===x)).filter(x=>!V.isNil(x));o("update:value",_)}else{const _=V.isNil(y)?null:l.value.find(x=>x.id===y)??null;o("update:value",_)}};return t.watch(()=>r.value,()=>{var y,_;(_=(y=p.value)==null?void 0:y.$forceUpdate)==null||_.call(y)},{deep:!0}),e({focus:()=>{var y;return(y=p.value)==null?void 0:y.focusInput()},blur:()=>{var y;return(y=p.value)==null?void 0:y.blurInput()}}),(y,_)=>(t.openBlock(),t.createBlock(t.unref(I.NSelect),{ref:"select-component",value:a.value,"clear-filter-after-select":!0,clearable:n.clearable,"consistent-menu-width":n.consistentMenuWidth,disabled:n.disabled||f.value.length===0,filterable:n.filterable,"max-tag-count":n.maxTagCount,multiple:s.value,options:h.value,placeholder:"",class:"w-full","onUpdate:value":m},null,8,["value","clearable","consistent-menu-width","disabled","filterable","max-tag-count","multiple","options"]))}}),WN={},jN=t.defineComponent({...WN,__name:"manager-select",props:{value:{default:null},clearable:{type:Boolean,default:!1},consistentMenuWidth:{type:Boolean,default:!0},wrapContent:{type:Boolean,default:!0},managerReferenceList:{default:()=>[]},disabledManagerReferenceList:{default:()=>[]},showActualOnly:{type:Boolean,default:!1},showEmptyValue:{type:Boolean,default:!1},groupBySalesDirection:{type:Boolean,default:!1}},emits:["update:value"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.computed(()=>V.isArray(r.value)),a=t.computed(()=>{var m;return V.isArray(r.value)?r.value.map(g=>g.id):((m=r.value)==null?void 0:m.id)??null}),l=t.computed(()=>r.showEmptyValue?[W.ManagerDataFactory.generateUndefinedManagerInstance(),...r.managerReferenceList]:r.managerReferenceList),c=t.computed(()=>{var b;let m=l.value,g=r.disabledManagerReferenceList.map(y=>y.id);if(r.showActualOnly){const y=V.isArray(r.value)?r.value.map(_=>_.id):[(b=r.value)==null?void 0:b.id];g=V.union(g,l.value.filter(_=>!_.isActive).map(_=>_.id)),m=m.filter(_=>(r.showEmptyValue?W.ManagerDataFactory.isUndefinedManagerInstance(_):!1)||_.isActive||y.includes(_.id))}return wt.convertReferencesToSelectOptionsList(m,!0,r.groupBySalesDirection?{key:"item.salesDirection.id",label:"item.salesDirection.name"}:!1,!1,y=>{const _=!r.groupBySalesDirection||r.groupBySalesDirection&&V.some(s.value?r.value:[r.value],["id",y.id])?` (${y.salesDirection.name}) `:"";return y.salesDirection.isNewRec()?y.name:`${y.name}${_}${y.isActive?"":" [Не активен]"}`},y=>g.includes(y.id)&&y.isActive)}),d=t.computed(()=>c.value.map(m=>({...m,class:r.wrapContent?`${m.class} consistent-menu-width`:m.class}))),u=t.useTemplateRef("select-component"),f=m=>{if(V.isArray(m)){const g=m.length>0?m.filter(b=>!V.some(r.disabledManagerReferenceList,["id",b])).map(b=>l.value.find(y=>y.id===b)).filter(b=>!V.isNil(b)):[];o("update:value",g)}else{const g=m>0&&!V.some(r.disabledManagerReferenceList,["id",m])?l.value.find(b=>b.id===m):new W.Manager;o("update:value",g??new W.Manager)}};return t.watch(()=>r.value,()=>{var m,g;(g=(m=u.value)==null?void 0:m.$forceUpdate)==null||g.call(m)},{deep:!0}),t.watch(()=>r.disabledManagerReferenceList,m=>{if(m.length>0&&r.value)if(s.value){const g=r.value;V.some(g,b=>V.some(m,["id",b.id]))&&o("update:value",g.filter(b=>!V.some(m,["id",b.id])))}else{const g=r.value;V.some(m,["id",g.id])&&o("update:value",new W.Manager)}}),e({focus:()=>{var m;return(m=u.value)==null?void 0:m.focusInput()},blur:()=>{var m;return(m=u.value)==null?void 0:m.blurInput()}}),(m,g)=>(t.openBlock(),t.createBlock(t.unref(I.NSelect),{ref:"select-component",value:a.value,clearable:n.clearable,disabled:c.value.length===0,"consistent-menu-width":n.consistentMenuWidth,multiple:s.value,options:d.value,placeholder:"","onUpdate:value":f},null,8,["value","clearable","disabled","consistent-menu-width","multiple","options"]))}}),qN={class:"m-0.5 flex flex-col p-0.5"},XN={class:"flex flex-row gap-1"},YN={key:0},UN={key:1},KN={key:2},GN={key:3},ZN={class:"flex flex-row gap-1"},QN={key:0},JN={key:1},eT={key:2},tT={key:3},nT={key:0,"data-testid":"address-quality-label",class:"text-sc-warning text-xs"},iT={},Sm=t.defineComponent({...iT,__name:"address-suggestion-label",props:{addr:{},selected:{type:Boolean}},setup(n){const e=n,i=t.computed(()=>Vs.getLabel(e.addr.quality));return(r,o)=>(t.openBlock(),t.createElementBlock("div",qN,[t.createElementVNode("span",XN,[n.addr.postIndex?(t.openBlock(),t.createElementBlock("span",YN,t.toDisplayString(n.addr.postIndex)+", ",1)):t.createCommentVNode("",!0),n.addr.city?(t.openBlock(),t.createElementBlock("span",UN,t.toDisplayString(n.addr.city)+", ",1)):t.createCommentVNode("",!0),n.addr.locality?(t.openBlock(),t.createElementBlock("span",KN,t.toDisplayString(n.addr.locality)+", ",1)):t.createCommentVNode("",!0),n.addr.region?(t.openBlock(),t.createElementBlock("span",GN,t.toDisplayString(n.addr.region)+", ",1)):t.createCommentVNode("",!0)]),t.createElementVNode("span",ZN,[n.addr.street?(t.openBlock(),t.createElementBlock("span",QN,t.toDisplayString(n.addr.street)+", ",1)):t.createCommentVNode("",!0),n.addr.building?(t.openBlock(),t.createElementBlock("span",JN,t.toDisplayString(n.addr.building)+", ",1)):t.createCommentVNode("",!0),n.addr.buildingPart?(t.openBlock(),t.createElementBlock("span",eT,t.toDisplayString(n.addr.buildingPart)+", ",1)):t.createCommentVNode("",!0),n.addr.apartments?(t.openBlock(),t.createElementBlock("span",tT,t.toDisplayString(n.addr.apartments)+", ",1)):t.createCommentVNode("",!0)]),i.value?(t.openBlock(),t.createElementBlock("span",nT,t.toDisplayString(i.value),1)):t.createCommentVNode("",!0)]))}}),Sl={clearable:!1,value:"",field:void 0,disabled:!1},rT={},oT=t.defineComponent({...rT,__name:"address-suggestion",props:t.mergeDefaults({disabled:{type:Boolean},value:{},clearable:{type:Boolean},field:{},minTermLength:{},consistentMenuWidth:{type:Boolean},wrapContent:{type:Boolean},searchDataHandler:{type:Function}},{...Sl,minTermLength:()=>{var n,e;return((e=(n=W.useBaseConfigStateStore().getConfig())==null?void 0:n.minLength)==null?void 0:e.searchTerm)??3},searchDataHandler:void 0,wrapContent:!0}),emits:["select","update:value"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.ref(r.value),a=t.ref(!1),l=t.ref([]),c=t.computed(()=>l.value.map(g=>({label:g[r.field??"addressString"]??"-",value:g.id})));t.watch(()=>r.value,g=>{s.value=g}),t.watch(s,()=>{o("update:value",s.value)});const d=V.debounce(()=>u(),800),u=async()=>{!s.value||s.value.length<r.minTermLength||(a.value=!0,l.value=await(r.searchDataHandler?r.searchDataHandler(s.value,a):W.HttpRequester.getInstance(W.DataSuggestionProvider).searchAddresses(s.value)).finally(()=>{a.value=!1}))},f=(g,b)=>{const y=l.value.find(_=>_.id===g.value)||{};return t.h(Sm,{addr:y,selected:b},{default:V.constant("-")})},h=g=>{d.cancel();const b=l.value.find(y=>y.id===g)||{};o("select",b)},p=t.ref(null);function m(){p.value.focus()}return e({focus:m}),(g,b)=>{const y=I.NAutoComplete;return t.openBlock(),t.createBlock(y,{ref_key:"autoCompleteElement",ref:p,value:s.value,"onUpdate:value":[b[0]||(b[0]=_=>s.value=_),t.unref(d)],class:t.normalizeClass(r.wrapContent?"consistent-menu-width":void 0),clearable:n.clearable,disabled:n.disabled,loading:a.value,options:c.value,"render-label":f,to:r.wrapContent?!1:void 0,placeholder:"",onSelect:h},null,8,["value","class","clearable","disabled","loading","options","to","onUpdate:value"])}}}),sT={class:"m-0.5 flex flex-col p-0.5"},aT={class:"font-medium"},lT={class:"flex flex-row gap-1 text-xs font-light text-blue-800"},cT={key:0},dT={key:1},uT={},Bm=t.defineComponent({...uT,__name:"bank-suggestion-label",props:{bank:{},selected:{type:Boolean}},setup(n){return(e,i)=>(t.openBlock(),t.createElementBlock("div",sT,[t.createElementVNode("span",aT,t.toDisplayString(n.bank.name),1),t.createElementVNode("span",lT,[n.bank.bic?(t.openBlock(),t.createElementBlock("span",cT," БИК: "+t.toDisplayString(n.bank.bic),1)):t.createCommentVNode("",!0),n.bank.inn?(t.openBlock(),t.createElementBlock("span",dT," ИНН: "+t.toDisplayString(n.bank.inn),1)):t.createCommentVNode("",!0)])]))}}),fT={},hT=t.defineComponent({...fT,__name:"bank-suggestion",props:t.mergeDefaults({disabled:{type:Boolean},value:{},clearable:{type:Boolean},field:{},minTermLength:{},consistentMenuWidth:{type:Boolean},wrapContent:{type:Boolean}},{...Sl,minTermLength:()=>{var n,e;return((e=(n=W.useBaseConfigStateStore().getConfig())==null?void 0:n.minLength)==null?void 0:e.searchTerm)??3},wrapContent:!0}),emits:["select","update:value"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.ref(r.value),a=t.ref(!1),l=t.ref([]),c=t.computed(()=>l.value.map(g=>({label:g[r.field??"_"]??"-",value:g.id})));t.watch(()=>r.value,g=>{s.value=g}),t.watch(s,()=>{o("update:value",s.value)});const d=V.debounce(()=>u(),800),u=async()=>{if(!(!s.value||s.value.length<r.minTermLength)){a.value=!0;try{l.value=await W.HttpRequester.getInstance(W.DataSuggestionProvider).searchBank(s.value)}finally{a.value=!1}}},f=(g,b)=>{const y=l.value.find(_=>_.id===g.value)||{};return t.h(Bm,{bank:y,selected:b},{default:V.constant("-")})},h=g=>{d.cancel();const b=l.value.find(y=>y.id===g)||{};o("select",b)},p=t.ref(null);function m(){p.value.focus()}return e({focus:m}),(g,b)=>{const y=I.NAutoComplete;return t.openBlock(),t.createBlock(y,{ref_key:"autoCompleteElement",ref:p,value:s.value,"onUpdate:value":[b[0]||(b[0]=_=>s.value=_),t.unref(d)],class:t.normalizeClass(r.wrapContent?"consistent-menu-width":void 0),clearable:n.clearable,disabled:n.disabled,loading:a.value,options:c.value,"render-label":f,to:r.wrapContent?!1:void 0,placeholder:"",onSelect:h},null,8,["value","class","clearable","disabled","loading","options","to","onUpdate:value"])}}}),mT={class:"font-medium"},pT={key:0,class:"flex flex-row gap-2"},gT={key:0,class:"text-xs font-light text-blue-800"},yT={key:1,class:"text-sc-dark-grey text-xs font-light"},bT={key:1,"data-testid":"address-quality-label",class:"text-sc-warning text-xs"},_T={},Nm=t.defineComponent({..._T,__name:"org-suggestion-label",props:{org:{},selected:{type:Boolean}},setup(n){const e=n,i=t.computed(()=>{var s,a;return((a=(s=e.org.rawData)==null?void 0:s.state)==null?void 0:a.liquidationDate)??!1}),r=t.computed(()=>{var s,a;return((a=(s=e.org.rawData)==null?void 0:s.address)==null?void 0:a.value)??""}),o=t.computed(()=>Vs.getLabel(e.org.legalAddressQuality));return(s,a)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(`m-0.5 flex flex-col p-0.5 ${i.value?"line-through":""}`)},[t.createElementVNode("span",mT,t.toDisplayString(n.org.name),1),n.org.inn||r.value?(t.openBlock(),t.createElementBlock("div",pT,[n.org.inn?(t.openBlock(),t.createElementBlock("span",gT,t.toDisplayString(n.org.inn),1)):t.createCommentVNode("",!0),r.value?(t.openBlock(),t.createElementBlock("span",yT,t.toDisplayString(r.value),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),r.value&&o.value?(t.openBlock(),t.createElementBlock("span",bT,t.toDisplayString(o.value),1)):t.createCommentVNode("",!0)],2))}}),wT={},xT=t.defineComponent({...wT,__name:"org-suggestion",props:t.mergeDefaults({disabled:{type:Boolean},value:{},clearable:{type:Boolean},field:{},minTermLength:{},consistentMenuWidth:{type:Boolean},wrapContent:{type:Boolean},allowSelectTerminated:{type:Boolean}},{...Sl,minTermLength:()=>{var n,e;return((e=(n=W.useBaseConfigStateStore().getConfig())==null?void 0:n.minLength)==null?void 0:e.searchTerm)??3},wrapContent:!0}),emits:["select","update:value"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.ref(r.value),a=t.ref(!1),l=t.ref([]),c=b=>{var y,_;return!!(((_=(y=b.rawData)==null?void 0:y.state)==null?void 0:_.liquidationDate)??!1)},d=t.computed(()=>wt.convertReferencesToSelectOptionsList(l.value,!1,!1,!1,b=>b[r.field??"_"]??"-",b=>!r.allowSelectTerminated&&c(b)));t.watch(()=>r.value,b=>{s.value=b}),t.watch(s,()=>{o("update:value",s.value)});const u=V.debounce(()=>f(),800),f=async()=>{if(!(!s.value||s.value.length<r.minTermLength)){a.value=!0;try{l.value=await W.HttpRequester.getInstance(W.DataSuggestionProvider).searchOrganization(s.value)}finally{a.value=!1}}},h=(b,y)=>{const _=l.value.find(x=>x.id===b.value)||{};return t.h(Nm,{org:_,selected:y},{default:V.constant("-")})},p=b=>{u.cancel();const y=l.value.find(_=>_.id===b)||{};(r.allowSelectTerminated||!c(y))&&o("select",y)},m=t.ref(null);function g(){m.value.focus()}return e({focus:g}),(b,y)=>{const _=I.NAutoComplete;return t.openBlock(),t.createBlock(_,{ref_key:"autoCompleteElement",ref:m,value:s.value,"onUpdate:value":[y[0]||(y[0]=x=>s.value=x),t.unref(u)],class:t.normalizeClass(r.wrapContent?"consistent-menu-width":void 0),clearable:n.clearable,disabled:n.disabled,loading:a.value,options:d.value,"render-label":h,to:r.wrapContent?!1:void 0,placeholder:"",onSelect:p},null,8,["value","class","clearable","disabled","loading","options","to","onUpdate:value"])}}});j.ALL_ORDER_MARKERS=co,j.AddressQualityLabelHelper=Vs,j.CATEGORY_REQUIRED_HINT=$s,j.CommonValidators=jm,j.ConfiguratorSettingsKozyrek=Mu,j.ConfiguratorSettingsMosquito=Fx,j.ContentHelper=Ci,j.CurrencyHelper=ir,j.DEFAULT_ORDER_STATUS_COLORS=Es,j.DateValidators=qm,j.EntityNameHelper=li,j.FileHelper=Wm,j.KozyrekLine=Vn,j.KozyrekTailTemplate=Ia,j.KozyrekTemplate=yr,j.M2PriceHelper=vi,j.MODE_DISABLED_HINT=Nr,j.NumberHelper=Ve,j.NumericValidators=ce,j.ORDER_MARKER_COLORS=Rs,j.ORDER_MARKER_NAMES=Ql,j.ORDER_STATUS_COLORS=Kl,j.OrderMarkerEnum=ct,j.OrdersTableFields=Ie,j.PRODUCT_REQUIRED_HINT=Ts,j.Point=Ma,j.ScAddProductToCartDialog=Bw,j.ScAddressSuggestion=oT,j.ScAddressSuggestionLabel=Sm,j.ScBankSuggestion=hT,j.ScBankSuggestionLabel=Bm,j.ScBaseDialog=zs,j.ScButtonWithConfirmAction=Ym,j.ScCategoryCollapse=tf,j.ScChipGroup=Gm,j.ScClientNameWithShortInfo=Dr,j.ScCollapse=ef,j.ScCollapseItem=oc,j.ScCommentEditor=j2,j.ScCompactCardList=kC,j.ScConfiguratorsProductInfo=Fr,j.ScContragentWithShortInfo=rf,j.ScCreatorUserTypeTag=ks,j.ScCuratorSelect=DN,j.ScDateRange=b2,j.ScDateTimeLabel=es,j.ScDebouncedInput=nC,j.ScDebouncedInputNumber=rC,j.ScDebt=k2,j.ScDialogHeader=T2,j.ScDynamicConfigurator=Zu,j.ScEmail=Hw,j.ScExternalLink=bC,j.ScImageGallery=dc,j.ScInlineEditableItem=Cf,j.ScInlineView=za,j.ScKozyrekConfigurator=Iu,j.ScKozyrekConfiguratorParamsForm=mc,j.ScKozyrekConfiguratorPreview=Vu,j.ScKozyrekConfiguratorTemplates=Fu,j.ScKpiGrid=uC,j.ScLightGallery=cc,j.ScManagerOperatorSelect=HN,j.ScManagerSelect=jN,j.ScMetalForDoorsConfigurator=qu,j.ScMetalForDoorsConfiguratorForm=ju,j.ScMosquitoConfigurator=zu,j.ScMosquitoConfiguratorForm=Au,j.ScMosquitoConfiguratorMeasurementInstructions=Ou,j.ScMosquitoConfiguratorPreview=Aa,j.ScOrderColorSwatch=Cl,j.ScOrderCommonInfo=hm,j.ScOrderDeliveryLabel=xs,j.ScOrderDetails=_m,j.ScOrderExternalLinks=wm,j.ScOrderHighlightSettings=bN,j.ScOrderInfo=xm,j.ScOrderItemParams=xl,j.ScOrderItemsList=ym,j.ScOrderPayment=kl,j.ScOrderProductInfo=pm,j.ScOrderStatusHistory=bm,j.ScOrderStatusTag=gm,j.ScOrdersList=j4,j.ScOrgSuggestion=xT,j.ScOrgSuggestionLabel=Nm,j.ScPage=Cm,j.ScPageWithSlidingPanel=ON,j.ScPersonContactsBlock=Px,j.ScPhone=fx,j.ScPhoneInput=aC,j.ScProductInfoContent=Os,j.ScProductInfoDialog=uc,j.ScProductInfoPopover=fc,j.ScProductName=go,j.ScProductsList=G5,j.ScReferenceSelect=nf,j.ScSandwichConfigurator=Uu,j.ScSandwichConfiguratorForm=Yu,j.ScSandwichM2Configurator=Gu,j.ScSandwichM2ConfiguratorForm=Ku,j.ScSearchableProductSelect=fm,j.ScSearchableReferenceSelect=um,j.ScSetClientPriceFormItem=kw,j.ScShortTextOrderInfo=kN,j.ScSingleFileUploadSelector=K2,j.ScSlidingContentWithDrawer=vm,j.ScStripConfigurator=Wu,j.ScStripConfiguratorForm=Lu,j.ScStripConfiguratorLineItem=Du,j.ScStripConfiguratorPreview=Hu,j.ScUserShortInfo=vl,j.ScWarningIcon=eC,j.SelectOptionHelper=wt,j.UiNotificationProvider=Tr,j.Validators=We,j.WindowResolutionEnum=Xe,j.WindowResolutionProvider=Ue,j.channelPrimaryInterestOptionsList=iN,j.componentSizeInjectionKey=Rr,j.copyToClipboard=ql,j.deliveryTypeReferenceList=q4,j.getOrderMarkerColors=Er,j.getOrderMarkerName=Ps,j.getOrderMarkers=Fs,j.getOrderStatusColors=ki,j.getOrderStatusCssVariables=Zl,j.getOrderStatusTagColor=Gl,j.getProductInfoFiles=Ms,j.handleFloatInput=fo,j.handleIntegerInput=ft,j.hasProductInfo=tc,j.isCanSandwichM2Show=Vx,j.isCanSandwichShow=Ju,j.isConfiguratorType=Qu,j.managersReferenceList=X4,j.naiveUiTheme=Ip,j.operatorReferenceList=nN,j.opfReferenceList=Y4,j.orderStatusDetailReferenceList=tN,j.orderStatusReferenceList=km,j.paginationItemsPrefix=ec,j.parse=ht,j.partnerGroupReferenceList=U4,j.paymentTypeReferenceList=eN,j.priceCoefficientsReferenceList=K4,j.productFilesTypesReferenceList=G4,j.renderConfig=Ke,j.resetInputValidation=dt,j.resourceReferencesList=Z4,j.salesDirectionsReferenceList=Q4,j.searchCityReferenceDataHandler=oN,j.searchCityReferenceLabelRenderer=sN,j.searchClientReferenceDataHandler=cN,j.searchClientReferenceLabelRenderer=dN,j.searchRegionReferenceDataHandler=aN,j.searchRegionReferenceLabelRenderer=lN,j.selectAllTextOnFocus=He,j.showAppVersion=Hm,j.sourcePrimaryInterestOptionsList=rN,j.useCompactLayout=zm,j.useHoverSupport=uo,j.vCopy=Xl,j.vFocusNext=ai,j.warehousesReferenceList=J4,Object.defineProperty(j,Symbol.toStringTag,{value:"Module"})}));
822
+ `,[sm({originalTransition:"background-color .3s var(--n-bezier), box-shadow .3s var(--n-bezier)"})])]);function ws(n){return n.type==="group"}function dm(n){return n.type==="ignored"}function wl(n,e){try{return!!(1+e.toString().toLowerCase().indexOf(n.trim().toLowerCase()))}catch{return!1}}function I5(n,e){return{getIsGroup:ws,getIgnored:dm,getKey(r){return ws(r)?r.name||r.key||"key-required":r[n]},getChildren(r){return r[e]}}}function A5(n,e,i,r){if(!e)return n;function o(s){if(!Array.isArray(s))return[];const a=[];for(const l of s)if(ws(l)){const c=o(l[r]);c.length&&a.push(Object.assign({},l,{[r]:c}))}else{if(dm(l))continue;e(i,l)&&a.push(l)}return a}return o(n)}function O5(n,e,i){const r=new Map;return n.forEach(o=>{ws(o)?o[i].forEach(s=>{r.set(s[e],s)}):r.set(o[e],o)}),r}var z5={};const D5=Object.assign(Object.assign({},Rt.props),{to:Gn.propTo,bordered:{type:Boolean,default:void 0},clearable:Boolean,clearFilterAfterSelect:{type:Boolean,default:!0},options:{type:Array,default:()=>[]},defaultValue:{type:[String,Number,Array],default:null},keyboard:{type:Boolean,default:!0},value:[String,Number,Array],placeholder:String,menuProps:Object,multiple:Boolean,size:String,menuSize:{type:String},filterable:Boolean,disabled:{type:Boolean,default:void 0},remote:Boolean,loading:Boolean,filter:Function,placement:{type:String,default:"bottom-start"},widthMode:{type:String,default:"trigger"},tag:Boolean,onCreate:Function,fallbackOption:{type:[Function,Boolean],default:void 0},show:{type:Boolean,default:void 0},showArrow:{type:Boolean,default:!0},maxTagCount:[Number,String],ellipsisTagPopoverProps:Object,consistentMenuWidth:{type:Boolean,default:!0},virtualScroll:{type:Boolean,default:!0},labelField:{type:String,default:"label"},valueField:{type:String,default:"value"},childrenField:{type:String,default:"children"},renderLabel:Function,renderOption:Function,renderTag:Function,"onUpdate:value":[Function,Array],inputProps:Object,nodeProps:Function,ignoreComposition:{type:Boolean,default:!0},showOnFocus:Boolean,onUpdateValue:[Function,Array],onBlur:[Function,Array],onClear:[Function,Array],onFocus:[Function,Array],onScroll:[Function,Array],onSearch:[Function,Array],onUpdateShow:[Function,Array],"onUpdate:show":[Function,Array],displayDirective:{type:String,default:"show"},resetMenuOnOptionsChange:{type:Boolean,default:!0},status:String,showCheckmark:{type:Boolean,default:!0},onChange:[Function,Array],items:Array}),L5=t.defineComponent({name:"Select",props:D5,slots:Object,setup(n){z5.NODE_ENV!=="production"&&t.watchEffect(()=>{n.items!==void 0&&bi("select","`items` is deprecated, please use `options` instead."),n.onChange!==void 0&&bi("select","`on-change` is deprecated, please use `on-update:value` instead.")});const{mergedClsPrefixRef:e,mergedBorderedRef:i,namespaceRef:r,inlineThemeDisabled:o}=Li(n),s=Rt("Select","-select",M5,V5,n,e),a=t.ref(n.defaultValue),l=t.toRef(n,"value"),c=Ua(l,a),d=t.ref(!1),u=t.ref(""),f=Af(n,["items","options"]),h=t.ref([]),p=t.ref([]),m=t.computed(()=>p.value.concat(h.value).concat(f.value)),g=t.computed(()=>{const{filter:z}=n;if(z)return z;const{labelField:Q,valueField:se}=n;return(ye,we)=>{if(!we)return!1;const Ce=we[Q];if(typeof Ce=="string")return wl(ye,Ce);const Ne=we[se];return typeof Ne=="string"?wl(ye,Ne):typeof Ne=="number"?wl(ye,String(Ne)):!1}}),b=t.computed(()=>{if(n.remote)return f.value;{const{value:z}=m,{value:Q}=u;return!Q.length||!n.filterable?z:A5(z,g.value,Q,n.childrenField)}}),y=t.computed(()=>{const{valueField:z,childrenField:Q}=n,se=I5(z,Q);return hv(b.value,se)}),_=t.computed(()=>O5(m.value,n.valueField,n.childrenField)),x=t.ref(!1),w=Ua(t.toRef(n,"show"),x),C=t.ref(null),N=t.ref(null),k=t.ref(null),{localeRef:$}=qh("Select"),v=t.computed(()=>{var z;return(z=n.placeholder)!==null&&z!==void 0?z:$.value.placeholder}),E=[],P=t.ref(new Map),F=t.computed(()=>{const{fallbackOption:z}=n;if(z===void 0){const{labelField:Q,valueField:se}=n;return ye=>({[Q]:String(ye),[se]:ye})}return z===!1?!1:Q=>Object.assign(z(Q),{value:Q})});function R(z){const Q=n.remote,{value:se}=P,{value:ye}=_,{value:we}=F,Ce=[];return z.forEach(Ne=>{if(ye.has(Ne))Ce.push(ye.get(Ne));else if(Q&&se.has(Ne))Ce.push(se.get(Ne));else if(we){const $e=we(Ne);$e&&Ce.push($e)}}),Ce}const M=t.computed(()=>{if(n.multiple){const{value:z}=c;return Array.isArray(z)?R(z):[]}return null}),X=t.computed(()=>{const{value:z}=c;return!n.multiple&&!Array.isArray(z)?z===null?null:R([z])[0]||null:null}),G=XS(n),{mergedSizeRef:Z,mergedDisabledRef:O,mergedStatusRef:A}=G;function Y(z,Q){const{onChange:se,"onUpdate:value":ye,onUpdateValue:we}=n,{nTriggerFormChange:Ce,nTriggerFormInput:Ne}=G;se&&Et(se,z,Q),we&&Et(we,z,Q),ye&&Et(ye,z,Q),a.value=z,Ce(),Ne()}function H(z){const{onBlur:Q}=n,{nTriggerFormBlur:se}=G;Q&&Et(Q,z),se()}function T(){const{onClear:z}=n;z&&Et(z)}function D(z){const{onFocus:Q,showOnFocus:se}=n,{nTriggerFormFocus:ye}=G;Q&&Et(Q,z),ye(),se&&L()}function K(z){const{onSearch:Q}=n;Q&&Et(Q,z)}function J(z){const{onScroll:Q}=n;Q&&Et(Q,z)}function U(){var z;const{remote:Q,multiple:se}=n;if(Q){const{value:ye}=P;if(se){const{valueField:we}=n;(z=M.value)===null||z===void 0||z.forEach(Ce=>{ye.set(Ce[we],Ce)})}else{const we=X.value;we&&ye.set(we[n.valueField],we)}}}function q(z){const{onUpdateShow:Q,"onUpdate:show":se}=n;Q&&Et(Q,z),se&&Et(se,z),x.value=z}function L(){O.value||(q(!0),x.value=!0,n.filterable&&qe())}function le(){q(!1)}function ue(){u.value="",p.value=E}const oe=t.ref(!1);function fe(){n.filterable&&(oe.value=!0)}function ge(){n.filterable&&(oe.value=!1,w.value||ue())}function _e(){O.value||(w.value?n.filterable?qe():le():L())}function Qe(z){var Q,se;!((se=(Q=k.value)===null||Q===void 0?void 0:Q.selfRef)===null||se===void 0)&&se.contains(z.relatedTarget)||(d.value=!1,H(z),le())}function Re(z){D(z),d.value=!0}function Mt(){d.value=!0}function vn(z){var Q;!((Q=C.value)===null||Q===void 0)&&Q.$el.contains(z.relatedTarget)||(d.value=!1,H(z),le())}function It(){var z;(z=C.value)===null||z===void 0||z.focus(),le()}function en(z){var Q;w.value&&(!((Q=C.value)===null||Q===void 0)&&Q.$el.contains(Wr(z))||le())}function Ln(z){if(!Array.isArray(z))return[];if(F.value)return Array.from(z);{const{remote:Q}=n,{value:se}=_;if(Q){const{value:ye}=P;return z.filter(we=>se.has(we)||ye.has(we))}else return z.filter(ye=>se.has(ye))}}function pn(z){_t(z.rawNode)}function _t(z){if(O.value)return;const{tag:Q,remote:se,clearFilterAfterSelect:ye,valueField:we}=n;if(Q&&!se){const{value:Ce}=p,Ne=Ce[0]||null;if(Ne){const $e=h.value;$e.length?$e.push(Ne):h.value=[Ne],p.value=E}}if(se&&P.value.set(z[we],z),n.multiple){const Ce=Ln(c.value),Ne=Ce.findIndex($e=>$e===z[we]);if(~Ne){if(Ce.splice(Ne,1),Q&&!se){const $e=ae(z[we]);~$e&&(h.value.splice($e,1),ye&&(u.value=""))}}else Ce.push(z[we]),ye&&(u.value="");Y(Ce,R(Ce))}else{if(Q&&!se){const Ce=ae(z[we]);~Ce?h.value=[h.value[Ce]]:h.value=E}at(),le(),Y(z[we],z)}}function ae(z){return h.value.findIndex(se=>se[n.valueField]===z)}function de(z){w.value||L();const{value:Q}=z.target;u.value=Q;const{tag:se,remote:ye}=n;if(K(Q),se&&!ye){if(!Q){p.value=E;return}const{onCreate:we}=n,Ce=we?we(Q):{[n.labelField]:Q,[n.valueField]:Q},{valueField:Ne,labelField:$e}=n;f.value.some(rt=>rt[Ne]===Ce[Ne]||rt[$e]===Ce[$e])||h.value.some(rt=>rt[Ne]===Ce[Ne]||rt[$e]===Ce[$e])?p.value=E:p.value=[Ce]}}function Ge(z){z.stopPropagation();const{multiple:Q}=n;!Q&&n.filterable&&le(),T(),Q?Y([],[]):Y(null,null)}function Ui(z){!Hr(z,"action")&&!Hr(z,"empty")&&!Hr(z,"header")&&z.preventDefault()}function oi(z){J(z)}function si(z){var Q,se,ye,we,Ce;if(!n.keyboard){z.preventDefault();return}switch(z.key){case" ":if(n.filterable)break;z.preventDefault();case"Enter":if(!(!((Q=C.value)===null||Q===void 0)&&Q.isComposing)){if(w.value){const Ne=(se=k.value)===null||se===void 0?void 0:se.getPendingTmNode();Ne?pn(Ne):n.filterable||(le(),at())}else if(L(),n.tag&&oe.value){const Ne=p.value[0];if(Ne){const $e=Ne[n.valueField],{value:rt}=c;n.multiple&&Array.isArray(rt)&&rt.includes($e)||_t(Ne)}}}z.preventDefault();break;case"ArrowUp":if(z.preventDefault(),n.loading)return;w.value&&((ye=k.value)===null||ye===void 0||ye.prev());break;case"ArrowDown":if(z.preventDefault(),n.loading)return;w.value?(we=k.value)===null||we===void 0||we.next():L();break;case"Escape":w.value&&(HS(z),le()),(Ce=C.value)===null||Ce===void 0||Ce.focus();break}}function at(){var z;(z=C.value)===null||z===void 0||z.focus()}function qe(){var z;(z=C.value)===null||z===void 0||z.focusInput()}function on(){var z;w.value&&((z=N.value)===null||z===void 0||z.syncPosition())}U(),t.watch(t.toRef(n,"options"),U);const sn={focus:()=>{var z;(z=C.value)===null||z===void 0||z.focus()},focusInput:()=>{var z;(z=C.value)===null||z===void 0||z.focusInput()},blur:()=>{var z;(z=C.value)===null||z===void 0||z.blur()},blurInput:()=>{var z;(z=C.value)===null||z===void 0||z.blurInput()}},lt=t.computed(()=>{const{self:{menuBoxShadow:z}}=s.value;return{"--n-menu-box-shadow":z}}),jt=o?Hi("select",void 0,lt,n):void 0;return Object.assign(Object.assign({},sn),{mergedStatus:A,mergedClsPrefix:e,mergedBordered:i,namespace:r,treeMate:y,isMounted:as(),triggerRef:C,menuRef:k,pattern:u,uncontrolledShow:x,mergedShow:w,adjustedTo:Gn(n),uncontrolledValue:a,mergedValue:c,followerRef:N,localizedPlaceholder:v,selectedOption:X,selectedOptions:M,mergedSize:Z,mergedDisabled:O,focused:d,activeWithoutMenuOpen:oe,inlineThemeDisabled:o,onTriggerInputFocus:fe,onTriggerInputBlur:ge,handleTriggerOrMenuResize:on,handleMenuFocus:Mt,handleMenuBlur:vn,handleMenuTabOut:It,handleTriggerClick:_e,handleToggle:pn,handleDeleteOption:_t,handlePatternInput:de,handleClear:Ge,handleTriggerBlur:Qe,handleTriggerFocus:Re,handleKeydown:si,handleMenuAfterLeave:ue,handleMenuClickOutside:en,handleMenuScroll:oi,handleMenuKeydown:si,handleMenuMousedown:Ui,mergedTheme:s,cssVars:o?void 0:lt,themeClass:jt==null?void 0:jt.themeClass,onRender:jt==null?void 0:jt.onRender})},render(){return t.h("div",{class:`${this.mergedClsPrefix}-select`},t.h(Lf,null,{default:()=>[t.h(Hf,null,{default:()=>t.h(P5,{ref:"triggerRef",inlineThemeDisabled:this.inlineThemeDisabled,status:this.mergedStatus,inputProps:this.inputProps,clsPrefix:this.mergedClsPrefix,showArrow:this.showArrow,maxTagCount:this.maxTagCount,ellipsisTagPopoverProps:this.ellipsisTagPopoverProps,bordered:this.mergedBordered,active:this.activeWithoutMenuOpen||this.mergedShow,pattern:this.pattern,placeholder:this.localizedPlaceholder,selectedOption:this.selectedOption,selectedOptions:this.selectedOptions,multiple:this.multiple,renderTag:this.renderTag,renderLabel:this.renderLabel,filterable:this.filterable,clearable:this.clearable,disabled:this.mergedDisabled,size:this.mergedSize,theme:this.mergedTheme.peers.InternalSelection,labelField:this.labelField,valueField:this.valueField,themeOverrides:this.mergedTheme.peerOverrides.InternalSelection,loading:this.loading,focused:this.focused,onClick:this.handleTriggerClick,onDeleteOption:this.handleDeleteOption,onPatternInput:this.handlePatternInput,onClear:this.handleClear,onBlur:this.handleTriggerBlur,onFocus:this.handleTriggerFocus,onKeydown:this.handleKeydown,onPatternBlur:this.onTriggerInputBlur,onPatternFocus:this.onTriggerInputFocus,onResize:this.handleTriggerOrMenuResize,ignoreComposition:this.ignoreComposition},{arrow:()=>{var n,e;return[(e=(n=this.$slots).arrow)===null||e===void 0?void 0:e.call(n)]}})}),t.h(ih,{ref:"followerRef",show:this.mergedShow,to:this.adjustedTo,teleportDisabled:this.adjustedTo===Gn.tdkey,containerClass:this.namespace,width:this.consistentMenuWidth?"target":void 0,minWidth:"target",placement:this.placement},{default:()=>t.h(t.Transition,{name:"fade-in-scale-up-transition",appear:this.isMounted,onAfterLeave:this.handleMenuAfterLeave},{default:()=>{var n,e,i;return this.mergedShow||this.displayDirective==="show"?((n=this.onRender)===null||n===void 0||n.call(this),t.withDirectives(t.h(a5,Object.assign({},this.menuProps,{ref:"menuRef",onResize:this.handleTriggerOrMenuResize,inlineThemeDisabled:this.inlineThemeDisabled,virtualScroll:this.consistentMenuWidth&&this.virtualScroll,class:[`${this.mergedClsPrefix}-select-menu`,this.themeClass,(e=this.menuProps)===null||e===void 0?void 0:e.class],clsPrefix:this.mergedClsPrefix,focusable:!0,labelField:this.labelField,valueField:this.valueField,autoPending:!0,nodeProps:this.nodeProps,theme:this.mergedTheme.peers.InternalSelectMenu,themeOverrides:this.mergedTheme.peerOverrides.InternalSelectMenu,treeMate:this.treeMate,multiple:this.multiple,size:this.menuSize,renderOption:this.renderOption,renderLabel:this.renderLabel,value:this.mergedValue,style:[(i=this.menuProps)===null||i===void 0?void 0:i.style,this.cssVars],onToggle:this.handleToggle,onScroll:this.handleMenuScroll,onFocus:this.handleMenuFocus,onBlur:this.handleMenuBlur,onKeydown:this.handleMenuKeydown,onTabOut:this.handleMenuTabOut,onMousedown:this.handleMenuMousedown,show:this.mergedShow,showCheckmark:this.showCheckmark,resetMenuOnOptionsChange:this.resetMenuOnOptionsChange}),{empty:()=>{var r,o;return[(o=(r=this.$slots).empty)===null||o===void 0?void 0:o.call(r)]},header:()=>{var r,o;return[(o=(r=this.$slots).header)===null||o===void 0?void 0:o.call(r)]},action:()=>{var r,o;return[(o=(r=this.$slots).action)===null||o===void 0?void 0:o.call(r)]}}),this.displayDirective==="show"?[[t.vShow,this.mergedShow],[ss,this.handleMenuClickOutside,void 0,{capture:!0}]]:[[ss,this.handleMenuClickOutside,void 0,{capture:!0}]])):null}})})]}))}}),H5={},um=t.defineComponent({...H5,__name:"searchable-reference-select",props:{searchDataHandler:{},optionsListConverter:{},renderLabel:{},renderTag:{},value:{},clearable:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},minTermLength:{default:()=>{var n,e;return((e=(n=W.useBaseConfigStateStore().getConfig())==null?void 0:n.minLength)==null?void 0:e.searchTerm)??3}},consistentMenuWidth:{type:Boolean,default:!1},wrapContent:{type:Boolean,default:!1},placeholder:{default:""}},emits:["update:value"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.computed(()=>V.isArray(r.value)),a=t.computed(()=>s.value?r.value.map(_=>_.id):r.value?r.value.id:null),l=t.ref(s.value?r.optionsListConverter(r.value):r.value?r.optionsListConverter([r.value]):[]);t.watch(()=>r.value,_=>{const w=(V.isArray(_)?_:_?[_]:[]).filter(C=>!l.value.some(N=>N.value===C.id));w.length>0&&(l.value=[...r.optionsListConverter(w),...l.value])},{deep:1});const c=t.computed(()=>l.value.map(_=>({..._,class:r.wrapContent?`${_.class} consistent-menu-width`:_.class}))),d=t.ref(!1),u=t.useTemplateRef("select-component"),f=_=>{_.length<r.minTermLength||(d.value=!0,r.searchDataHandler(_,d).then(x=>{if(V.isEmpty(x))return;const w=s.value?r.value:r.value?[r.value]:[],C=x.filter(N=>!w.some(k=>k.id===N.id));l.value=r.optionsListConverter([...w,...C])}).finally(()=>{d.value=!1}))};let h="";const p=V.debounce(()=>f(h),800),m=_=>{h=_,p()},g=_=>{var x;if(V.isArray(_)){const w=_.length>0?_.map(C=>{var N;return t.toRaw((N=l.value.find(k=>k.value===C))==null?void 0:N.item)}):[];o("update:value",w)}else if(_>0){const w=t.toRaw((x=l.value.find(C=>C.value===_))==null?void 0:x.item);o("update:value",w)}else o("update:value",null)};return e({focus:()=>{var _;return(_=u.value)==null?void 0:_.focusInput()},blur:()=>{var _;return(_=u.value)==null?void 0:_.blurInput()}}),(_,x)=>(t.openBlock(),t.createBlock(t.unref(L5),{ref:"select-component","clear-filter-after-select":!0,clearable:n.clearable,"consistent-menu-width":n.consistentMenuWidth,disabled:n.disabled,filterable:!0,loading:d.value,multiple:s.value,options:c.value,placeholder:n.placeholder,remote:!0,value:a.value,"render-label":n.renderLabel,"render-tag":n.renderTag,onSearch:m,"onUpdate:value":g},null,8,["clearable","consistent-menu-width","disabled","loading","multiple","options","placeholder","value","render-label","render-tag"]))}}),W5={},fm=t.defineComponent({...W5,__name:"searchable-product-select",props:{renderLabel:{},renderTag:{},value:{},clearable:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},minTermLength:{default:()=>{var n,e;return((e=(n=W.useBaseConfigStateStore().getConfig())==null?void 0:n.minLength)==null?void 0:e.searchTerm)??3}},consistentMenuWidth:{type:Boolean,default:!1},wrapContent:{type:Boolean,default:!1},placeholder:{default:""},searchType:{}},emits:["update:value"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.useTemplateRef("select-component"),a=async f=>r.searchType==="categories"?W.HttpRequester.getInstance(W.ProductCategoryDataProvider).publicSimpleSearch(f):r.searchType==="products"?W.HttpRequester.getInstance(W.ProductDataProvider).publicSimpleSearch(f):new Promise(h=>{h([])}),l=f=>r.searchType==="categories"?wt.convertReferencesToSelectOptionsList(f,!0,!1,!1,h=>h!=null&&h.isNewRec()?"-":h.name):r.searchType==="products"?wt.convertReferencesToSelectOptionsList(f,!0,!1,!1,h=>h!=null&&h.isNewRec()?"-":`[${h.code}] ${h.name}`):[],c=(f,h)=>{if(r.renderLabel)return r.renderLabel(f,h);if(r.searchType==="products"){const p=f.item;return t.h("div",{},[t.h("span",{class:"text-sc-grey mr-2.5"},p.code),t.h("span",{},[p.name])])}if(r.searchType==="categories"){const p=f.item;return t.h("div",{},[p.name])}};return e({focus:()=>{var f;return(f=s.value)==null?void 0:f.focus()},blur:()=>{var f;return(f=s.value)==null?void 0:f.blur()}}),(f,h)=>(t.openBlock(),t.createBlock(um,{ref:"select-component",value:n.value,clearable:n.clearable,disabled:n.disabled,placeholder:n.placeholder,"search-data-handler":a,"options-list-converter":l,"consistent-menu-width":n.consistentMenuWidth,"wrap-content":n.wrapContent,"min-term-length":n.minTermLength,"render-label":c,"render-tag":n.renderTag,"onUpdate:value":h[0]||(h[0]=p=>o("update:value",p))},null,8,["value","clearable","disabled","placeholder","consistent-menu-width","wrap-content","min-term-length","render-tag"]))}}),j5={class:"col-span-2 flex flex-row gap-2.5"},q5={class:"flex-1"},X5={class:"text-sc-grey"},Y5={class:"ml-2.5"},U5={key:0,class:"flex-none"},K5={},G5=t.defineComponent({...K5,__name:"products-list",props:{value:{},searchType:{},minTermLength:{default:()=>{var n,e;return((e=(n=W.useBaseConfigStateStore().getConfig())==null?void 0:n.minLength)==null?void 0:e.searchTerm)??3}},disabled:{type:Boolean}},emits:["update:value"],setup(n,{emit:e}){const i=n,r=e,o=t.ref(null),s=()=>structuredClone(t.toRaw(i.value)),a=t.ref(s()),l=()=>{r("update:value",a.value.map(f=>t.toRaw(f)))},c=f=>{f&&(a.value=[...a.value.map(h=>t.toRaw(h)),...(V.isArray(f)?f:[f]).filter(h=>!a.value.some(p=>p.id===h.id))],t.nextTick(()=>{o.value=null}),l())},d=f=>{f&&(a.value=a.value.map(h=>h.id===f.id?f:t.toRaw(h)),l())},u=f=>{a.value=a.value.filter(h=>h.id!==f.id),l()};return t.watch(()=>i.value,()=>{a.value=s()}),(f,h)=>{const p=I.NListItem,m=SC,g=I.NButton,b=I.NList;return t.openBlock(),t.createBlock(b,{"show-divider":!1,hoverable:!0},{header:t.withCtx(()=>[t.renderSlot(f.$slots,"header")]),footer:t.withCtx(()=>[t.createVNode(fm,{value:o.value,"onUpdate:value":[h[0]||(h[0]=y=>o.value=y),c],clearable:!0,disabled:n.disabled,"min-term-length":n.minTermLength,"search-type":n.searchType,placeholder:"Введите название"},null,8,["value","disabled","min-term-length","search-type"])]),default:t.withCtx(()=>[a.value.length===0?(t.openBlock(),t.createBlock(p,{key:0,class:"text-center text-sm text-gray-600"},{default:t.withCtx(()=>[...h[1]||(h[1]=[t.createTextVNode(" --- Список пуст --- ",-1)])]),_:1})):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value,y=>(t.openBlock(),t.createBlock(p,{key:y.id},{suffix:t.withCtx(()=>[t.createVNode(g,{disabled:n.disabled,quaternary:"",type:"error",onClick:_=>u(y)},{default:t.withCtx(()=>[t.createVNode(m)]),_:1},8,["disabled","onClick"])]),default:t.withCtx(()=>[t.createElementVNode("div",j5,[t.createElementVNode("span",q5,[t.createElementVNode("span",X5,t.toDisplayString(y.code),1),t.createElementVNode("span",Y5,t.toDisplayString(y.name),1)]),f.$slots["item-extra"]?(t.openBlock(),t.createElementBlock("div",U5,[t.renderSlot(f.$slots,"item-extra",{item:y,updateItemCallback:d})])):t.createCommentVNode("",!0)])]),_:2},1024))),128))]),_:3})}}}),Z5={class:"flex flex-col"},Q5={class:"flex flex-col gap-1.5 text-base text-nowrap"},J5={class:"font-medium"},e3={class:"flex flex-col text-sc-dark-grey"},t3={key:0},n3={class:"font-medium"},i3={class:"font-medium"},r3={class:"font-medium"},o3={class:"font-medium"},s3={class:"font-medium"},a3={class:"font-medium"},l3={class:"font-medium"},c3={class:"font-medium"},d3={class:"font-medium"},u3={class:"font-medium"},f3={class:"flex flex-col gap-1.5 text-base text-nowrap"},h3={class:"font-medium"},m3={class:"flex flex-col text-sc-dark-grey"},p3={class:"font-medium"},g3={class:"font-medium"},y3={class:"flex flex-col gap-1.5 text-base text-nowrap"},b3={class:"font-medium"},_3={class:"text-sc-dark-grey"},w3={class:"font-medium"},x3={class:"text-xs"},k3={key:1,class:"text-base font-medium text-nowrap"},C3={},v3=t.defineComponent({...C3,__name:"order-item-params",props:{item:{},eventEmitter:{default:void 0},allowEdit:{type:Boolean,default:!1},updateQuantityOnInput:{type:Boolean,default:!0}},setup(n){const e=[W.ConfiguratorsEnum.Kozyrek,W.ConfiguratorsEnum.Mosquitto,W.ConfiguratorsEnum.Strip,W.ConfiguratorsEnum.MetalForDoors,W.ConfiguratorsEnum.Sandwich,W.ConfiguratorsEnum.SandwichM2],i=n,r=t.ref(!1),o=t.computed(()=>i.item),s=t.computed(()=>{var m,g;return((m=i.item.product.unit)==null?void 0:m.isLinear)&&((g=i.item.product.properties)==null?void 0:g.isLengthConfigurator)}),a=t.computed(()=>W.UnitsHelper.getProductLengthMultiplicity(i.item.product)),l=t.computed(()=>Ve.multiplyByStep(i.item.quantity,a.value)),c=t.computed(()=>W.UnitsHelper.getProductMultiplicity(i.item.product)),d=t.computed(()=>c.value>1),u=t.ref({quantity:i.item.quantity});t.watch(()=>i.item,m=>{u.value={quantity:m.quantity}});const f=m=>{var g;m!==null&&(u.value.quantity=m,(g=i.eventEmitter)==null||g.emit("order-item:edit-quantity",{item:o.value,quantity:m,loaderRef:r}))},h=()=>{var m;(m=i.eventEmitter)==null||m.emit("order-item:open-configurator",{item:o.value})},p=()=>{var m;(m=i.eventEmitter)==null||m.emit("order-item:edit",{item:o.value})};return(m,g)=>{const b=I.NInputNumber;return t.openBlock(),t.createElementBlock("div",Z5,[n.item.configurator&&n.item.configuratorParams&&e.includes(n.item.configurator)?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",Q5,[t.createElementVNode("span",null,[g[1]||(g[1]=t.createTextVNode(" Количество: ",-1)),t.createElementVNode("span",J5,t.toDisplayString(n.item.quantity)+" шт.",1)]),t.createElementVNode("div",e3,[n.item.configurator===t.unref(W.ConfiguratorsEnum).Kozyrek?(t.openBlock(),t.createElementBlock("span",t3,[g[2]||(g[2]=t.createTextVNode(" Длина: ",-1)),t.createElementVNode("span",n3,t.toDisplayString(Math.round(n.item.length*1e3))+" мм.",1)])):t.createCommentVNode("",!0),n.item.configurator===t.unref(W.ConfiguratorsEnum).Mosquitto?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("span",null,[g[3]||(g[3]=t.createTextVNode(" Ширина: ",-1)),t.createElementVNode("span",i3,t.toDisplayString(Math.round(n.item.width*1e3))+" мм.",1)]),t.createElementVNode("span",null,[g[4]||(g[4]=t.createTextVNode(" Высота: ",-1)),t.createElementVNode("span",r3,t.toDisplayString(Math.round(n.item.height*1e3))+" мм.",1)])],64)):t.createCommentVNode("",!0),n.item.configurator===t.unref(W.ConfiguratorsEnum).Strip?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.item.configuratorParams.linesWidths,(y,_)=>(t.openBlock(),t.createElementBlock("span",{key:_},[t.createTextVNode(" Полоса №"+t.toDisplayString(Number(_)+1)+": ",1),t.createElementVNode("span",o3,t.toDisplayString(y)+" мм.",1)]))),128)),t.createElementVNode("span",null,[g[5]||(g[5]=t.createTextVNode(" Метраж: ",-1)),t.createElementVNode("span",s3,t.toDisplayString(n.item.length)+" м.",1)])],64)):t.createCommentVNode("",!0),n.item.configurator===t.unref(W.ConfiguratorsEnum).MetalForDoors?(t.openBlock(),t.createElementBlock(t.Fragment,{key:3},[t.createElementVNode("span",null,[g[6]||(g[6]=t.createTextVNode(" Ширина: ",-1)),t.createElementVNode("span",a3,t.toDisplayString(n.item.width)+" мм.",1)]),t.createElementVNode("span",null,[g[7]||(g[7]=t.createTextVNode(" Длина: ",-1)),t.createElementVNode("span",l3,t.toDisplayString(Math.round(n.item.length*1e3))+" мм.",1)])],64)):t.createCommentVNode("",!0),n.item.configurator===t.unref(W.ConfiguratorsEnum).Sandwich?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:4},t.renderList(n.item.configuratorParams.items??[],(y,_)=>(t.openBlock(),t.createElementBlock("span",{key:_},[t.createTextVNode(" Изделие №"+t.toDisplayString(Number(_)+1)+": ",1),t.createElementVNode("span",c3,t.toDisplayString(y.width)+"×"+t.toDisplayString(y.length)+" мм, "+t.toDisplayString(y.count)+" шт.",1)]))),128)):t.createCommentVNode("",!0),n.item.configurator===t.unref(W.ConfiguratorsEnum).SandwichM2?(t.openBlock(),t.createElementBlock(t.Fragment,{key:5},[t.createElementVNode("span",null,[g[8]||(g[8]=t.createTextVNode(" Ширина: ",-1)),t.createElementVNode("span",d3,t.toDisplayString(Math.round(n.item.width*1e3))+" мм.",1)]),t.createElementVNode("span",null,[g[9]||(g[9]=t.createTextVNode(" Длина: ",-1)),t.createElementVNode("span",u3,t.toDisplayString(Math.round(n.item.length*1e3))+" мм.",1)])],64)):t.createCommentVNode("",!0)])]),n.allowEdit?(t.openBlock(),t.createElementBlock("a",{key:0,href:"#",class:"text-xs text-blue-500 hover:text-blue-700 self-start mt-2.5",onClick:t.withModifiers(h,["prevent"])}," Изменить ")):t.createCommentVNode("",!0)],64)):s.value&&a.value>0?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createElementVNode("div",f3,[t.createElementVNode("span",null,[g[10]||(g[10]=t.createTextVNode(" Количество: ",-1)),t.createElementVNode("span",h3,t.toDisplayString(n.item.quantity)+" шт.",1)]),t.createElementVNode("div",m3,[t.createElementVNode("span",null,[g[11]||(g[11]=t.createTextVNode(" Длина: ",-1)),t.createElementVNode("span",p3,t.toDisplayString(a.value)+" "+t.toDisplayString(n.item.product.unit.name),1)]),t.createElementVNode("span",null,[g[12]||(g[12]=t.createTextVNode(" Всего: ",-1)),t.createElementVNode("span",g3,t.toDisplayString(l.value)+" "+t.toDisplayString(n.item.product.unit.name),1)])])]),n.allowEdit?(t.openBlock(),t.createElementBlock("a",{key:0,href:"#",class:"text-xs text-blue-500 hover:text-blue-700 self-start mt-2.5",onClick:t.withModifiers(p,["prevent"])}," Изменить ")):t.createCommentVNode("",!0)],64)):n.item.product.getIsMeasurable()?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("div",y3,[t.createElementVNode("span",null,[g[13]||(g[13]=t.createTextVNode(" Количество: ",-1)),t.createElementVNode("span",b3,t.toDisplayString(n.item.quantity)+" шт.",1)]),t.createElementVNode("span",_3,[g[14]||(g[14]=t.createTextVNode(" Метраж: ",-1)),t.createElementVNode("span",w3,t.toDisplayString(n.item.length??n.item.width)+" "+t.toDisplayString(n.item.product.unit.name),1)])]),n.allowEdit?(t.openBlock(),t.createElementBlock("a",{key:0,href:"#",class:"text-xs text-blue-500 hover:text-blue-700 self-start mt-2.5",onClick:t.withModifiers(p,["prevent"])}," Изменить ")):t.createCommentVNode("",!0)],64)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:3},[n.allowEdit?(t.openBlock(),t.createBlock(b,{key:0,value:u.value.quantity,parse:t.unref(ht),min:c.value,step:c.value,"show-button":d.value,"button-placement":"both","update-value-on-input":n.updateQuantityOnInput,disabled:!!r.value,loading:r.value||void 0,placeholder:"Кол-во",size:"small",class:"min-w-16 grow",onKeydown:g[0]||(g[0]=y=>t.unref(fo)(y,".",!1)),onFocus:t.unref(He),"onUpdate:value":f},{suffix:t.withCtx(()=>[t.createElementVNode("span",x3,t.toDisplayString(n.item.product.unit.name),1)]),_:1},8,["value","parse","min","step","show-button","update-value-on-input","disabled","loading","onFocus"])):(t.openBlock(),t.createElementBlock("span",k3,t.toDisplayString(n.item.quantity)+" "+t.toDisplayString(n.item.product.unit.name),1))],64))])}}}),xl=dn(v3,[["__scopeId","data-v-d3cb409d"]]),S3={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function B3(n,e){return t.openBlock(),t.createElementBlock("svg",S3,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M13 4a1 1 0 0 1 1 1h4a1 1 0 0 1 .783.378l.074.108l3 5l.055.103l.04.107l.029.109l.016.11L22 11v6a1 1 0 0 1-1 1h-1.171a3.001 3.001 0 0 1-5.658 0H9.829a3.001 3.001 0 0 1-5.658 0H3a1 1 0 0 1-1-1V6a2 2 0 0 1 2-2zM7 16a1 1 0 1 0 0 2a1 1 0 0 0 0-2m10 0a1 1 0 1 0 0 2a1 1 0 0 0 0-2m.434-9H14v3h5.234z"},null,-1)])])}const N3=t.markRaw({name:"tabler-truck-filled",render:B3}),T3={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function $3(n,e){return t.openBlock(),t.createElementBlock("svg",T3,[...e[0]||(e[0]=[t.createElementVNode("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[t.createElementVNode("path",{d:"M5 17a2 2 0 1 0 4 0a2 2 0 1 0-4 0m10 0a2 2 0 1 0 4 0a2 2 0 1 0-4 0"}),t.createElementVNode("path",{d:"M5 17H3v-4M2 5h11v12m-4 0h6m4 0h2v-6h-8m0-5h5l3 5M3 9h4"})],-1)])])}const E3=t.markRaw({name:"tabler-truck-delivery",render:$3}),R3={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function P3(n,e){return t.openBlock(),t.createElementBlock("svg",R3,[...e[0]||(e[0]=[t.createElementVNode("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[t.createElementVNode("path",{d:"M2 3h1a2 2 0 0 1 2 2v10a2 2 0 0 0 2 2h15"}),t.createElementVNode("path",{d:"M9 9a3 3 0 0 1 3-3h4a3 3 0 0 1 3 3v2a3 3 0 0 1-3 3h-4a3 3 0 0 1-3-3zM7 19a2 2 0 1 0 4 0a2 2 0 1 0-4 0m9 0a2 2 0 1 0 4 0a2 2 0 1 0-4 0"})],-1)])])}const F3=t.markRaw({name:"tabler-truck-loading",render:P3}),V3={class:"flex flex-col gap-1"},M3={key:0,class:"flex flex-row gap-1 text-sm text-sc-grey"},I3={key:1,class:"text-base"},A3={class:"text-sc-dark-grey mr-1.5"},O3={key:0},z3={key:1},D3={},xs=t.defineComponent({...D3,__name:"order-delivery-label",props:{delivery:{},showType:{type:Boolean,default:!0},showDetails:{type:Boolean,default:!0}},setup(n){const e=t.computed(()=>{var s;return(s=W.useReferencesStore().deliveryTypeReference)==null?void 0:s.find(a=>a.id===o.delivery.type)}),i=t.computed(()=>Be.format(o.delivery.date,"dd.MM.yyyy")),r=t.computed(()=>{var s;return(s=o.delivery.address)!=null&&s.address?li.getFormatEntityName({name:o.delivery.address.address,deletedAt:o.delivery.address.deletedAt}):""}),o=n;return(s,a)=>{var u,f,h,p,m,g,b,y;const l=F3,c=E3,d=N3;return t.openBlock(),t.createElementBlock("div",V3,[n.showType?(t.openBlock(),t.createElementBlock("span",M3,[((u=e.value)==null?void 0:u.slug)==="self_delivery"?(t.openBlock(),t.createBlock(l,{key:0})):t.createCommentVNode("",!0),((f=e.value)==null?void 0:f.slug)==="delivery"?(t.openBlock(),t.createBlock(c,{key:1})):t.createCommentVNode("",!0),((h=e.value)==null?void 0:h.slug)==="transport_company_delivery"?(t.openBlock(),t.createBlock(d,{key:2})):t.createCommentVNode("",!0),t.createElementVNode("span",null,t.toDisplayString((p=e.value)==null?void 0:p.name),1)])):t.createCommentVNode("",!0),n.showDetails?(t.openBlock(),t.createElementBlock("span",I3,[t.createElementVNode("span",A3,t.toDisplayString(i.value),1),(g=(m=n.delivery)==null?void 0:m.address)!=null&&g.address?(t.openBlock(),t.createElementBlock("span",O3,t.toDisplayString(r.value),1)):t.createCommentVNode("",!0),(y=(b=n.delivery)==null?void 0:b.warehouse)!=null&&y.address?(t.openBlock(),t.createElementBlock("span",z3," со склада "+t.toDisplayString(n.delivery.warehouse.address),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)])}}}),L3={class:"flex flex-col gap-2.5"},H3={class:"text-base"},W3=["href"],j3={key:1,class:"text-sc-grey"},q3={},hm=t.defineComponent({...q3,__name:"order-common-info",props:{order:{},eventEmitter:{},allowEdit:{type:Boolean},fields:{},showAttachedUserColumn:{type:Boolean},orderContextButtonsConfig:{type:Function},onOrderContextSelect:{type:Function},orderUrl:{},highlightSettings:{}},setup(n){const e=n,i=t.computed(()=>e.fields.includes(Ie.Id)?e.order.id:void 0),r=t.computed(()=>{var f,h;return e.fields.includes(Ie.Status)?(h=(f=W.useReferencesStore().orderStatusReference)==null?void 0:f.find(p=>{var m;return p.id===(((m=e.order.status)==null?void 0:m.id)??-1)}))==null?void 0:h.name:void 0}),o=t.computed(()=>{var f;return ki((f=e.order.status)==null?void 0:f.slug)}),s=t.computed(()=>{var h,p;const f=(h=e.order.status)==null?void 0:h.slug;return!!f&&(((p=e.highlightSettings)==null?void 0:p.statuses.includes(f))??!1)}),a=t.computed(()=>Fs(e.order).filter(f=>[ct.OnOrder,ct.NotInStock].includes(f))),l=f=>{var h;return((h=e.highlightSettings)==null?void 0:h.markers.includes(f))??!1},c=t.computed(()=>e.fields.includes(Ie.CreatedAt)),d=t.computed(()=>e.fields.includes(Ie.ClientInfo)||e.fields.includes(Ie.ClientInfoShort)?e.order.client:void 0),u=t.computed(()=>e.fields.includes(Ie.DeliveryInfo)?e.order.delivery:void 0);return(f,h)=>(t.openBlock(),t.createElementBlock("div",L3,[t.createElementVNode("span",H3,[i.value?(t.openBlock(),t.createElementBlock("a",{key:0,href:n.orderUrl.replace(":id",n.order.id.toString()),target:"_blank",class:"text-sc-dark-grey"}," #"+t.toDisplayString(i.value),9,W3)):t.createCommentVNode("",!0),c.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[h[0]||(h[0]=t.createTextVNode(" от ",-1)),t.createVNode(es,{date:n.order.createdAt,"is-time-secondary":!0},null,8,["date"])],64)):t.createCommentVNode("",!0),r.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[h[1]||(h[1]=t.createTextVNode(" - ",-1)),s.value?(t.openBlock(),t.createElementBlock("span",{key:0,class:"font-medium",style:t.normalizeStyle({color:o.value.color})},t.toDisplayString(r.value),5)):(t.openBlock(),t.createElementBlock("span",j3,t.toDisplayString(r.value),1))],64)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value,p=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:p},[h[2]||(h[2]=t.createTextVNode(" - ",-1)),t.createElementVNode("span",{class:t.normalizeClass({"font-medium":l(p),"text-sc-dark-grey":!l(p)}),style:t.normalizeStyle(l(p)?{color:t.unref(Er)(p).color}:void 0)},t.toDisplayString(t.unref(Ps)(p)),7)],64))),128))]),d.value?(t.openBlock(),t.createBlock(Dr,{key:0,client:d.value,class:"ml-3"},null,8,["client"])):t.createCommentVNode("",!0),u.value?(t.openBlock(),t.createBlock(xs,{key:1,delivery:u.value,class:"ml-3"},null,8,["delivery"])):t.createCommentVNode("",!0)]))}}),X3={},kl=t.defineComponent({...X3,__name:"order-payment",props:{payment:{}},setup(n){const e=n,i=t.computed(()=>{var r;return(r=W.useReferencesStore().paymentTypeReference)==null?void 0:r.find(o=>o.id===e.payment.type)});return(r,o)=>{var s;return t.openBlock(),t.createElementBlock("span",null,t.toDisplayString(((s=i.value)==null?void 0:s.name)??"-"),1)}}}),Y3={},U3=t.defineComponent({...Y3,__name:"order-item-specification",props:{src:{}},setup(n){const e=t.useTemplateRef("image-reference");return(i,r)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("a",{class:"text-blue-500 hover:underline text-sm mt-1 block cursor-pointer",onClick:r[0]||(r[0]=o=>{var s;return(s=e.value)==null?void 0:s.showPreview()})}," Спецификация "),t.withDirectives(t.createVNode(t.unref(I.NImage),{ref:"image-reference",src:n.src,"previewed-img-props":{style:"max-width: 80vw; max-height: 80vh; object-fit: contain; border: 12px solid white;"}},null,8,["src"]),[[t.vShow,!1]])],64))}}),K3={},ks=t.defineComponent({...K3,__name:"creator-user-type-tag",props:{userType:{default:void 0},prefixText:{default:"Добавлено"},variant:{default:"info"},changedFields:{default:void 0}},setup(n){const e=n,i={quantity:"количество",length:"длина"},r=t.computed(()=>e.variant==="danger"||e.changedFields?"bg-orange-500":"bg-sky-500"),o=t.computed(()=>{const s={[W.UserTypeEnum.Manager]:"менеджером",[W.UserTypeEnum.Operator]:"оператором",[W.UserTypeEnum.Client]:"клиентом",[W.UserTypeEnum.Admin]:"администратором"};if(e.changedFields){const l=e.changedFields.map(d=>i[d]??d).join(", ");return`Было изменено${e.userType?` ${s[e.userType]??""}`:""}: ${l}`}const a=e.userType?` ${s[e.userType]??""}`:"";return`${e.prefixText}${a}`.trim()});return(s,a)=>(t.openBlock(),t.createElementBlock("small",{class:t.normalizeClass(`inline-block py-[0.0625rem] px-1.5 text-xs font-bold text-center whitespace-nowrap rounded text-white no-underline opacity-100 ${r.value}`)},t.toDisplayString(o.value),3))}}),G3={class:"flex flex-col gap-0.5"},Z3={class:"text-gray-600"},Q3={},mm=t.defineComponent({...Q3,__name:"order-item-name",props:{item:{},showCode:{type:Boolean,default:!1},inactive:{type:Boolean,default:void 0}},setup(n){const e=n,i=t.inject(W.currentOrderInjectionKey,null),r=t.computed(()=>{if(i!=null)return t.toValue(i)??void 0}),o=t.computed(()=>{const{item:d,inactive:u}=e;return u??(!!d.isRemoved||!!d.replacementId)}),s=t.computed(()=>{const{creator:d}=e.item;return!!(d!=null&&d.type)&&(!r.value||r.value.creator.guid!==d.guid)}),a=t.computed(()=>"specificationImgUrl"in e.item?e.item.specificationImgUrl:void 0),l=t.computed(()=>"changedFields"in e.item?e.item.changedFields:[]),c=t.computed(()=>{var d,u;return"replacement"in e.item?(u=(d=e.item.replacement)==null?void 0:d.creator)==null?void 0:u.type:void 0});return(d,u)=>(t.openBlock(),t.createElementBlock("div",G3,[t.createElementVNode("div",{class:t.normalizeClass(o.value?"line-through opacity-50":"")},[t.createVNode(go,{product:n.item.product,"show-additional-sale-icon":n.item.isAdditionalSale??!1,"show-code":n.showCode},null,8,["product","show-additional-sale-icon","show-code"])],2),n.item.marker?(t.openBlock(),t.createElementBlock("span",{key:0,class:t.normalizeClass(o.value?"line-through opacity-50":"")},[u[0]||(u[0]=t.createTextVNode(" Маркировка: ",-1)),t.createElementVNode("span",Z3,t.toDisplayString(n.item.marker),1)],2)):t.createCommentVNode("",!0),a.value?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(o.value?"line-through opacity-50":"")},[t.createVNode(U3,{src:a.value},null,8,["src"])],2)):t.createCommentVNode("",!0),s.value&&!o.value?(t.openBlock(),t.createBlock(ks,{key:2,"user-type":n.item.creator.type,class:"mt-1 self-start","prefix-text":"Добавлено"},null,8,["user-type"])):t.createCommentVNode("",!0),n.item.isRemoved&&!n.item.replacementId&&l.value.length===0?(t.openBlock(),t.createBlock(ks,{key:3,class:"mt-1 self-start","prefix-text":"Удалено",variant:"danger"})):t.createCommentVNode("",!0),n.item.replacementId&&l.value.length>0?(t.openBlock(),t.createBlock(ks,{key:4,"user-type":c.value,"changed-fields":l.value,class:"mt-1 self-start"},null,8,["user-type","changed-fields"])):t.createCommentVNode("",!0)]))}}),J3={class:"flex flex-row gap-1.5"},e4={class:"flex flex-1 flex-col gap-2.5"},t4={class:"flex items-start gap-1"},n4={},pm=t.defineComponent({...n4,__name:"order-product-info",props:{product:{},index:{},eventEmitter:{default:void 0},allowEdit:{type:Boolean,default:!1},updateQuantityOnInput:{type:Boolean,default:!0},inactive:{type:Boolean,default:!1}},setup(n){const e=n,i=t.computed(()=>e.inactive?"line-through opacity-50":"");return(r,o)=>(t.openBlock(),t.createElementBlock("div",J3,[t.createElementVNode("span",{class:t.normalizeClass(["flex-none text-nowrap",i.value])},t.toDisplayString(n.index+1)+". ",3),t.createElementVNode("div",e4,[t.createVNode(mm,{item:n.product,inactive:n.inactive,"show-code":""},null,8,["item","inactive"]),t.createElementVNode("div",t4,[t.createVNode(xl,{item:n.product,"event-emitter":n.eventEmitter,"allow-edit":n.allowEdit,"update-quantity-on-input":n.updateQuantityOnInput,class:t.normalizeClass(["min-w-0 flex-1",i.value])},null,8,["item","event-emitter","allow-edit","update-quantity-on-input","class"]),n.allowEdit?t.renderSlot(r.$slots,"actions",{key:0}):t.createCommentVNode("",!0)]),t.createElementVNode("div",{class:t.normalizeClass(["grid grid-flow-col grid-rows-2 gap-1 text-base",i.value])},[o[0]||(o[0]=t.createElementVNode("span",null,"Цена за ед.",-1)),t.createVNode(ci,{product:n.product,"cost-field-name":"costOneRub"},null,8,["product"]),o[1]||(o[1]=t.createElementVNode("span",null,"Сумма",-1)),t.createVNode(ci,{product:n.product,"cost-field-name":"cost"},null,8,["product"])],2)])]))}}),i4={class:"flex items-center gap-1.5"},r4={key:0,class:"h-1.5 w-1.5 shrink-0 rounded-full bg-current"},o4={key:0,class:"h-1.5 w-1.5 shrink-0 rounded-full bg-current"},s4={},gm=t.defineComponent({...s4,__name:"order-status-tag",props:{status:{},statusDetail:{default:null},variant:{default:"filled"},size:{default:"medium"},showDot:{type:Boolean,default:!0}},setup(n){const e=n,i=t.computed(()=>ki(e.status.slug)),r=t.computed(()=>Gl(e.status.slug)),o=t.computed(()=>e.statusDetail?`${e.status.name} (${e.statusDetail.name})`:e.status.name);return(s,a)=>{const l=I.NTag;return n.variant==="filled"?(t.openBlock(),t.createBlock(l,{key:0,color:r.value,bordered:!1,size:n.size,round:""},{default:t.withCtx(()=>[t.createElementVNode("span",i4,[n.showDot?(t.openBlock(),t.createElementBlock("span",r4)):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(o.value),1)])]),_:1},8,["color","size"])):(t.openBlock(),t.createElementBlock("span",{key:1,class:"inline-flex items-center gap-1.5 font-medium",style:t.normalizeStyle({color:i.value.color})},[n.showDot?(t.openBlock(),t.createElementBlock("span",o4)):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(o.value),1)],4))}}}),a4={},Cl=t.defineComponent({...a4,__name:"order-color-swatch",props:{colors:{}},setup(n){return(e,i)=>(t.openBlock(),t.createElementBlock("span",{class:"inline-flex h-5 min-w-8 shrink-0 items-center justify-center rounded px-1.5 text-xs font-semibold leading-none",style:t.normalizeStyle({backgroundColor:n.colors.backgroundColor,color:n.colors.textOnBackgroundColor,border:`1px solid ${n.colors.color}`})}," Аа ",4))}}),l4={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function c4(n,e){return t.openBlock(),t.createElementBlock("svg",l4,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"m112 112l20 320c.95 18.49 14.4 32 32 32h184c17.67 0 30.87-13.51 32-32l20-320"},null,-1),t.createElementVNode("path",{fill:"currentColor",stroke:"currentColor","stroke-linecap":"round","stroke-miterlimit":"10","stroke-width":"32",d:"M80 112h352"},null,-1),t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M192 112V72h0a23.93 23.93 0 0 1 24-24h80a23.93 23.93 0 0 1 24 24h0v40m-64 64v224m-72-224l8 224m136-224l-8 224"},null,-1)])])}const d4=t.markRaw({name:"ion-trash-outline",render:c4}),u4={key:0,class:"!mb-3 !mt-0 text-base font-semibold"},f4={class:"mb-1 flex flex-wrap items-baseline justify-between gap-2"},h4={class:"flex items-baseline gap-2"},m4={class:"text-base font-bold text-sc-dark-grey"},p4={key:0,class:"text-sm text-sc-grey"},g4={key:0,class:"text-sm text-sc-dark-grey"},y4={},b4=t.defineComponent({...y4,__name:"order-items-list",props:t.mergeModels({products:{},maxHeight:{default:void 0},eventEmitter:{default:void 0},allowEdit:{type:Boolean,default:!1},selectable:{type:Boolean,default:!1},title:{default:"Список позиций"},groups:{default:void 0},extraColumns:{default:void 0},isItemInactive:{type:Function,default:void 0},isItemSelectable:{type:Function,default:void 0},updateQuantityOnInput:{type:Boolean,default:!0}},{selectedRowKeys:{default:()=>[]},selectedRowKeysModifiers:{}}),emits:["update:selectedRowKeys"],setup(n){const e=n,i=t.useModel(n,"selectedRowKeys"),r=y=>V.sortBy(y,"ord"),o=t.computed(()=>r(e.products)),s=y=>e.isItemInactive?e.isItemInactive(y):!!y.isRemoved||!!y.replacementId,a=y=>e.isItemSelectable?e.isItemSelectable(y):!s(y),l=(y,_)=>{_?i.value.includes(y)||(i.value=[...i.value,y]):i.value=i.value.filter(x=>x!==y)},c=y=>e.selectable?{class:i.value.includes(y.id)?void 0:"opacity-60"}:{},d=(y,_)=>{const x=o.value,w=y.logicGroupId;if(!w)return 1;const C=x.at(_-1);if(_&&C&&C.logicGroupId===w)return 0;const N=x.slice(_),k=N.findIndex($=>$.logicGroupId!==w);return k===-1?N.length:k},u=y=>s(y)?null:t.h(I.NButton,{quaternary:!0,size:"small",type:"error",onClick:()=>{var _;(_=e.eventEmitter)==null||_.emit("order-item:delete",{item:y})}},()=>t.h(d4)),f=t.ref(Ue.getDeviceTypeByResolution()),h=t.ref(window.innerWidth),p=t.computed(()=>!V.isNil(e.maxHeight)),m=()=>{const y=[{title:"№ п.п.",key:"id",resizable:!0,width:64,render:(x,w)=>t.h("span",{class:`text-base text-nowrap${s(x)?" line-through opacity-50":""}`},[w+1,"."])},{title:"Артикул",key:"codeNumber",resizable:!0,width:h.value>=1536?156:120,render:x=>t.h("span",{class:`text-base${s(x)?" line-through opacity-50":""}`},[x.product.code])},{title:"Наименование",key:"name",resizable:!0,render:x=>t.h(mm,{item:x,inactive:s(x)})},{title:"Кол-во",key:"quantity",resizable:!0,width:180,rowSpan:d,render:x=>t.h(xl,{class:s(x)?"line-through opacity-50":"",item:x,eventEmitter:e.eventEmitter,allowEdit:e.allowEdit&&!s(x),updateQuantityOnInput:e.updateQuantityOnInput})},{title:"Цена за ед.",key:"costOneRub",resizable:!0,width:p.value?170:120,render:x=>t.h("div",{class:s(x)?"line-through opacity-50":""},[t.h(ci,{product:x,costFieldName:"costOne",showQuantityUnit:!0})])},{title:"Сумма",key:"cost",resizable:!0,width:p.value?140:120,render:x=>t.h("div",{class:s(x)?"line-through opacity-50":""},[t.h(ci,{product:x,costFieldName:"cost",showCurrency:!0})])},...e.extraColumns??[],...e.allowEdit?[{title:"",key:"delete",width:44,rowSpan:d,render:x=>u(x)}]:[]],_=e.selectable?[{key:"checkbox",title:"",className:"align-top",width:"32",cellProps:x=>({class:a(x)?"cursor-pointer":void 0,onClick:()=>{a(x)&&l(x.id,!i.value.includes(x.id))}}),render:x=>t.h(I.NCheckbox,{checked:i.value.includes(x.id),disabled:!a(x)})}]:[];switch(f.value){case Xe.phone:case Xe.tablet:return[..._,{title:"",key:"items",resizable:!0,render:(x,w)=>{const C=d(x,w)>0,N=e.allowEdit&&!s(x)&&C;return t.h(pm,{product:x,index:w,eventEmitter:e.eventEmitter,allowEdit:N,updateQuantityOnInput:e.updateQuantityOnInput,inactive:s(x)},{actions:()=>u(x)})}}];case Xe.laptop:return[..._,...y];default:return[..._,...y]}},g=t.computed(()=>m()),b=()=>{f.value=Ue.getDeviceTypeByResolution(),h.value=window.innerWidth};return t.onMounted(()=>{b(),window.addEventListener("resize",b)}),t.onUnmounted(()=>{window.removeEventListener("resize",b)}),(y,_)=>{const x=I.NDataTable;return t.openBlock(),t.createElementBlock(t.Fragment,null,[n.title?(t.openBlock(),t.createElementBlock("h3",u4,t.toDisplayString(n.title),1)):t.createCommentVNode("",!0),n.groups?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:1},t.renderList(n.groups,w=>(t.openBlock(),t.createElementBlock("div",{key:w.name,class:"mb-6 last:mb-0"},[t.createElementVNode("div",f4,[t.createElementVNode("div",h4,[t.createElementVNode("span",m4,t.toDisplayString(w.name),1),w.description?(t.openBlock(),t.createElementBlock("span",p4,t.toDisplayString(w.description),1)):t.createCommentVNode("",!0)]),w.summary?(t.openBlock(),t.createElementBlock("span",g4,t.toDisplayString(w.summary),1)):t.createCommentVNode("",!0)]),t.createVNode(x,{columns:g.value,data:r(w.items),"row-key":C=>C.id,"row-props":c,"bottom-bordered":!1,bordered:!1,"max-height":n.maxHeight},null,8,["columns","data","row-key","max-height"])]))),128)):(t.openBlock(),t.createBlock(x,{key:2,columns:g.value,data:o.value,"row-key":w=>w.id,"row-props":c,"bottom-bordered":!1,bordered:!1,"max-height":n.maxHeight},null,8,["columns","data","row-key","max-height"]))],64)}}}),ym=dn(b4,[["__scopeId","data-v-a24b5175"]]),_4={key:0,class:"text-sc-dark-grey my-2 text-center"},w4={key:1,class:"text-sc-dark-grey my-2"},x4={},bm=t.defineComponent({...x4,__name:"order-status-history",props:{order:{}},setup(n){const e=n,i=t.ref(!1),r=t.ref([]),o=a=>{const{uiDateWithTime:l}=W.useBaseConfigStateStore().config.dateFormats;return Be.format(a,l)},s=(a=!0)=>{a&&(i.value=!0),W.HttpRequester.getInstance(W.OrdersDataProvider).getOrderStatusHistory(e.order.id).then(l=>{r.value=l}).finally(()=>{a&&(i.value=!1)})};return t.watch(()=>e.order,()=>{s(!1)}),t.onMounted(()=>{s()}),(a,l)=>{const c=I.NSpin,d=I.NTimelineItem,u=I.NTimeline;return t.openBlock(),t.createElementBlock("div",null,[l[1]||(l[1]=t.createElementVNode("h3",{class:"!mb-3 !mt-0 text-base font-semibold"},"История статусов",-1)),i.value?(t.openBlock(),t.createElementBlock("div",_4,[t.createVNode(c,{size:"small",class:"mb-1 align-middle"}),l[0]||(l[0]=t.createElementVNode("span",{class:"ml-2"},"Загрузка истории ...",-1))])):r.value.length===0?(t.openBlock(),t.createElementBlock("div",w4," История статусов отсутствует. ")):(t.openBlock(),t.createBlock(u,{key:2},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,(f,h)=>(t.openBlock(),t.createBlock(d,{key:h,color:t.unref(ki)(f.status.slug).color,time:o(f.createdAt),content:f.user.name},{header:t.withCtx(()=>[t.createVNode(gm,{status:f.status,"status-detail":f.statusDetail,variant:h===0?"filled":"text","show-dot":!1,size:"small"},null,8,["status","status-detail","variant"])]),_:2},1032,["color","time","content"]))),128))]),_:1}))])}}}),k4={class:"text-base"},C4={},vl=t.defineComponent({...C4,__name:"user-short-info",props:{user:{},showUserType:{type:Boolean,default:!0},extraInfoOnSecondLine:{type:Boolean,default:!0}},setup(n){return(e,i)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass({"flex flex-col":n.showUserType&&n.extraInfoOnSecondLine})},[t.createElementVNode("span",k4,t.toDisplayString(n.user.name),1),n.showUserType?(t.openBlock(),t.createElementBlock("span",{key:0,class:t.normalizeClass([{"ml-1":!n.extraInfoOnSecondLine},"text-sc-grey"])}," ["+t.toDisplayString(n.user.type)+"] ",3)):t.createCommentVNode("",!0)],2))}}),v4={class:"ml-4 grid grid-cols-3 gap-1.5 text-base"},S4={class:"col-span-2"},B4={class:"col-span-2"},N4={},_m=t.defineComponent({...N4,__name:"order-details",props:{order:{}},emits:["click:client-name"],setup(n,{emit:e}){const i=e;return(r,o)=>(t.openBlock(),t.createElementBlock("div",null,[o[11]||(o[11]=t.createElementVNode("h3",null,"Детали заказа",-1)),t.createElementVNode("div",v4,[n.order.creator.id!==n.order.client.id?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[o[1]||(o[1]=t.createElementVNode("span",null,"Создал",-1)),t.createVNode(vl,{user:n.order.creator,class:"col-span-2"},null,8,["user"])],64)):t.createCommentVNode("",!0),o[10]||(o[10]=t.createElementVNode("span",null,"Клиент",-1)),t.createVNode(Dr,{client:n.order.client,class:"col-span-2","onClick:clientName":o[0]||(o[0]=s=>i("click:client-name",n.order.client,s))},null,8,["client"]),n.order.contragent?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[o[2]||(o[2]=t.createElementVNode("span",null,"Контрагент",-1)),t.createVNode(rf,{contragent:n.order.contragent,class:"col-span-2"},null,8,["contragent"])],64)):t.createCommentVNode("",!0),n.order.image?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[o[3]||(o[3]=t.createElementVNode("span",null,"Графический файл клиента",-1)),o[4]||(o[4]=t.createElementVNode("a",{class:"fancybox col-span-2",href:"{{ order.image }}"}," Посмотреть ",-1))],64)):t.createCommentVNode("",!0),n.order.barcode?(t.openBlock(),t.createElementBlock(t.Fragment,{key:3},[o[5]||(o[5]=t.createElementVNode("span",null,"Штрих-код",-1)),t.createElementVNode("span",S4,t.toDisplayString(n.order.barcode),1)],64)):t.createCommentVNode("",!0),n.order.payment?(t.openBlock(),t.createElementBlock(t.Fragment,{key:4},[o[6]||(o[6]=t.createElementVNode("span",null,"Оплата",-1)),t.createVNode(kl,{payment:n.order.payment,class:"col-span-2"},null,8,["payment"])],64)):t.createCommentVNode("",!0),n.order.delivery?(t.openBlock(),t.createElementBlock(t.Fragment,{key:5},[o[7]||(o[7]=t.createElementVNode("span",null,"Доставка",-1)),t.createVNode(xs,{delivery:n.order.delivery,class:"col-span-2"},null,8,["delivery"])],64)):t.createCommentVNode("",!0),n.order.comment?(t.openBlock(),t.createElementBlock(t.Fragment,{key:6},[o[8]||(o[8]=t.createElementVNode("span",null,"Комментарий",-1)),t.createElementVNode("span",B4,t.toDisplayString(n.order.comment),1)],64)):t.createCommentVNode("",!0),n.order.attachedUser?(t.openBlock(),t.createElementBlock(t.Fragment,{key:7},[o[9]||(o[9]=t.createElementVNode("span",null,"Закреплен за",-1)),t.createVNode(vl,{user:n.order.attachedUser,class:"col-span-2"},null,8,["user"])],64)):t.createCommentVNode("",!0)])]))}}),T4={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function $4(n,e){return t.openBlock(),t.createElementBlock("svg",T4,[...e[0]||(e[0]=[t.createElementVNode("rect",{width:"336",height:"336",x:"128",y:"128",fill:"none",stroke:"currentColor","stroke-linejoin":"round","stroke-width":"32",rx:"57",ry:"57"},null,-1),t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"m383.5 128l.5-24a56.16 56.16 0 0 0-56-56H112a64.19 64.19 0 0 0-64 64v216a56.16 56.16 0 0 0 56 56h24"},null,-1)])])}const E4=t.markRaw({name:"ion-copy-outline",render:$4}),R4={class:"flex flex-col items-stretch gap-1.5 text-base"},P4={},F4=t.defineComponent({...P4,__name:"order-external-links",props:{showErpLink:{type:Boolean,default:!1},order:{}},setup(n){const e=t.computed(()=>{var r,o;const i=(((r=n.order.invoices)==null?void 0:r.length)??0)>0;return n.showErpLink&&!!n.order.erpOrderUrl||i||!!((o=n.order.payment)!=null&&o.onlinePaymentLink)});return(i,r)=>{var a;const o=I.NButton,s=E4;return e.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[r[2]||(r[2]=t.createElementVNode("h3",{class:"!mb-3 !mt-0 text-base font-semibold"},"Внешние ссылки",-1)),t.createElementVNode("div",R4,[n.showErpLink&&n.order.erpOrderUrl?(t.openBlock(),t.createBlock(o,{key:0,tag:"a",href:n.order.erpOrderUrl,target:"_blank",block:"",class:"sc-external-link-button"},{default:t.withCtx(()=>[...r[0]||(r[0]=[t.createTextVNode(" Открыть в ERP ",-1)])]),_:1},8,["href"])):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.order.invoices??[],(l,c)=>(t.openBlock(),t.createBlock(o,{key:c,tag:"a",href:l,block:"",class:"sc-external-link-button"},{default:t.withCtx(()=>[t.createTextVNode(" Скачать счет №"+t.toDisplayString(c+1),1)]),_:2},1032,["href"]))),128)),(a=n.order.payment)!=null&&a.onlinePaymentLink?t.withDirectives((t.openBlock(),t.createBlock(o,{key:1,block:"",class:"sc-external-link-button",title:"Ссылка на оплату копируется в буфер обмена"},{default:t.withCtx(()=>[t.createVNode(s,{class:"mr-1.5"}),r[1]||(r[1]=t.createTextVNode(" Скопировать ссылку на оплату ",-1))]),_:1})),[[t.unref(Xl),n.order.payment.onlinePaymentLink]]):t.createCommentVNode("",!0)])],64)):t.createCommentVNode("",!0)}}}),wm=dn(F4,[["__scopeId","data-v-6a3ae627"]]),V4={key:0},M4={class:"text-sc-dark-grey my-2 text-center"},I4={key:1,class:"text-sc-dark-grey my-2 text-center"},A4={key:2},O4={class:"text-sc-dark-grey mt-4 text-right font-bold"},z4={class:"text-sc-primary"},D4={class:"mb-4 max-w-xs empty:hidden"},L4={},xm=t.defineComponent({...L4,__name:"order-info",props:{order:{},eventEmitter:{default:void 0},allowEdit:{type:Boolean,default:!1}},emits:["click:client-name"],setup(n,{emit:e}){const i=n,r=e,o=t.ref(!1),s=t.ref();t.provide(W.currentOrderInjectionKey,t.computed(()=>s.value??null));const a=(d=!0)=>{if("products"in i.order){s.value=new W.Order(i.order);return}d&&(o.value=!0),W.HttpRequester.getInstance(W.OrdersDataProvider).getOrder(i.order.id).then(u=>{s.value=u}).finally(()=>{d&&(o.value=!1)})},l=t.computed(()=>{var d;return(((d=s.value)==null?void 0:d.products)??[]).filter(u=>!u.isRemoved&&!u.replacementId)}),c=t.computed(()=>Ve.formatMoney(V.sumBy(l.value,"costRub")));return t.watch(()=>i.order,()=>{a(!1)}),t.onMounted(()=>{a()}),(d,u)=>{const f=I.NSpin;return o.value?(t.openBlock(),t.createElementBlock("div",V4,[t.createElementVNode("div",M4,[t.createVNode(f,{size:"small",class:"mb-2.5 align-middle"}),u[1]||(u[1]=t.createElementVNode("div",null,[t.createElementVNode("span",null,"Загрузка данных ...")],-1))])])):!s.value||s.value.products.length===0?(t.openBlock(),t.createElementBlock("div",I4," --- Не удалось загрузить данные о заказе --- ")):(t.openBlock(),t.createElementBlock("div",A4,[t.createVNode(ym,{products:l.value,"event-emitter":n.eventEmitter,"allow-edit":n.allowEdit},null,8,["products","event-emitter","allow-edit"]),t.createElementVNode("div",O4,[u[2]||(u[2]=t.createTextVNode(" ИТОГО: ",-1)),t.createElementVNode("span",z4,t.toDisplayString(c.value)+" ₽",1)]),t.createVNode(_m,{order:s.value,"onClick:clientName":u[0]||(u[0]=h=>r("click:client-name",s.value.client,h))},null,8,["order"]),t.createElementVNode("div",D4,[t.createVNode(wm,{order:s.value,"show-erp-link":""},null,8,["order"])]),t.createVNode(bm,{order:s.value},null,8,["order"])]))}}}),H4={},W4=t.defineComponent({...H4,__name:"order-actions",props:{orderContextButtonsConfig:{type:Function,default:void 0},onOrderContextSelect:{type:Function,default:void 0},order:{}},setup(n){const e=n,i=t.inject(Rr,"small"),r=t.computed(()=>V.isNil(e.orderContextButtonsConfig)?[]:V.isFunction(e.orderContextButtonsConfig)?e.orderContextButtonsConfig(e.order):e.orderContextButtonsConfig),o=s=>{var a;(a=e.onOrderContextSelect)==null||a.call(e,e.order,s)};return(s,a)=>{var u;const l=Is,c=I.NButton,d=I.NDropdown;return((u=r.value)==null?void 0:u.length)>0?(t.openBlock(),t.createBlock(d,{key:0,options:r.value,size:t.unref(i),trigger:"click",onSelect:o},{default:t.withCtx(()=>[t.createVNode(c,{ghost:!0,size:t.unref(i),type:"primary"},{default:t.withCtx(()=>[t.createVNode(l)]),_:1},8,["size"])]),_:1},8,["options","size"])):t.createCommentVNode("",!0)}}}),j4={},q4=t.defineComponent({...j4,__name:"orders-list",props:t.mergeModels({fields:{},showAttachedUserColumn:{type:Boolean,default:!1},orderContextButtonsConfig:{},onOrderContextSelect:{},orderUrl:{},tableMinWidth:{default:1/0},filters:{default:void 0},sort:{default:void 0},pagination:{default:void 0},useCellIndication:{type:Boolean,default:!1},highlightSettings:{default:void 0},enableSorting:{type:Boolean,default:!1},refreshInterval:{default:0},stickyHeaderOnMobile:{type:Boolean,default:!0},selectable:{type:Boolean,default:!1},isRowSelectable:{type:Function,default:void 0}},{checkedRowKeys:{default:()=>[]},checkedRowKeysModifiers:{}}),emits:t.mergeModels(["click:client-name","dblclick:row","update:pagination","update:sort"],["update:checkedRowKeys"]),setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.useModel(n,"checkedRowKeys"),a=(T,D)=>{D?s.value.includes(T)||(s.value=[...s.value,T]):s.value=s.value.filter(K=>K!==T)},l=()=>V.cloneDeep(r.sort??[{field:"id",direction:"desc"}]),c=t.ref(l()),d=t.ref([]),u=t.ref(!1),f=t.ref(700),h=()=>{const T=Ue.getDeviceTypeByResolution(),D=T===Xe.phone||T===Xe.tablet;if(!(!r.stickyHeaderOnMobile&&D))return f.value*(W.useBaseConfigStateStore().config.tableDefaultHeightCoefficient??.6)},p=t.ref(h()),m=t.computed(()=>r.highlightSettings?r.highlightSettings:{statuses:[],markers:r.useCellIndication?[...co]:[]}),g=T=>{const D={onDblclick:()=>o("dblclick:row",T)},K=[];r.selectable&&s.value.length>0&&!s.value.includes(T.id)&&K.push("opacity-60");const J=m.value,U=new Set(Fs(T).filter(ue=>J.markers.includes(ue))),q={},le=[ct.NotInStock,ct.OnOrder,ct.LargeOrder].find(ue=>U.has(ue));if(le){const ue=Er(le);K.push("order-id-marked",le),q["--sc-order-id-bg"]=ue.backgroundColor,q["--sc-order-id-text"]=ue.textOnBackgroundColor}if(U.has(ct.NextDayDelivery)){const ue=Er(ct.NextDayDelivery);K.push("delivery-date-marked"),q["--sc-delivery-date-bg"]=ue.backgroundColor,q["--sc-delivery-date-text"]=ue.textOnBackgroundColor}return T.status.slug&&J.statuses.includes(T.status.slug)&&(K.push("order-status-highlighted",T.status.slug),V.assign(q,Zl(T.status.slug))),V.isEmpty(q)||(D.style=q),K.length>0&&(D.class=K.join(" ")),D},b=()=>{const T=[Ie.CreatedAt,Ie.Id,Ie.ClientInfo,Ie.ClientCity,Ie.DeliveryDate,Ie.PaymentType,Ie.SalesDirections,Ie.Status,...r.showAttachedUserColumn?[Ie.AttachedUser]:[],Ie.actions],D=r.fields.length>0?r.fields:T,K={title:"???",key:"undefined",render:()=>t.h("span",{},["--- unknown ---"])},J={type:"expand",expandable:V.constant(!0),renderExpand:L=>t.h(xm,{order:L,class:"pl-10 pt-3 pb-10","onClick:client-name":()=>{o("click:client-name",L.client,null)}}),width:"30"};let U=[{title:"Дата заказа",key:Ie.CreatedAt,resizable:!0,width:100,render:L=>t.h(es,{date:L.createdAt,isTimeSecondary:!0,isTimeOnSecondLine:!0,class:"text-base"})},{title:"№ заказа",key:Ie.Id,resizable:!0,width:75,className:"order-id",render:L=>t.h("a",{href:r.orderUrl.replace(":id",L.id.toString()),class:"text-base"},L.id)},{title:"Дата доставки / самовывоза",key:Ie.DeliveryDate,resizable:!0,width:120,className:"delivery-date",render:L=>t.h(es,{date:L.delivery.date,isShowTime:!1,class:"text-base"})},{title:"Клиент",key:Ie.ClientInfo,resizable:!0,minWidth:320,render:L=>t.h(Dr,{client:L.client,"onClick:client-name":()=>{o("click:client-name",L.client,null)}})},{title:"Тип доставки",key:Ie.DeliveryInfo,resizable:!0,minWidth:320,render:L=>t.h(xs,{delivery:L.delivery})},{title:"Клиент",key:Ie.ClientInfoShort,resizable:!0,minWidth:320,render:L=>t.h(Dr,{client:L.client,showCityAndRegion:!1,"onClick:client-name":()=>{o("click:client-name",L.client,null)}})},{title:"Город клиента",key:Ie.ClientCity,resizable:!0,minWidth:90,width:120,render:L=>{var le;return t.h("span",{class:"text-base"},((le=L.client)==null?void 0:le.city.name)??"—")}},{title:"Статус",key:Ie.Status,resizable:!0,width:150,minWidth:115,className:"order-status",render:L=>t.h("span",{class:"text-base"},[L.status.name])},{title:"Тип оплаты",key:Ie.PaymentType,resizable:!0,width:115,minWidth:95,render:L=>L.payment?t.h(kl,{payment:L.payment}):t.h("span",{class:"text-base"},"—")},{title:"Напр. продаж",key:Ie.SalesDirections,resizable:!0,width:80,render:L=>{var le;return t.h("span",{class:"text-base"},[((le=L.salesDirection)==null?void 0:le.name)??""])}},...r.showAttachedUserColumn?[{title:"Закреплено за",key:Ie.AttachedUser,resizable:!0,minWidth:120,render:L=>{var le;return t.h("span",{class:"text-base"},[((le=L==null?void 0:L.attachedUser)==null?void 0:le.name)??""])}}]:[]];r.orderContextButtonsConfig&&U.push({key:"actions",title:"",className:"align-top",width:50,render:L=>t.h(W4,{order:L,orderContextButtonsConfig:r.orderContextButtonsConfig,onOrderContextSelect:r.onOrderContextSelect})}),r.enableSorting&&(U=U.map(L=>[Ie.Id,Ie.CreatedAt,Ie.DeliveryDate].includes(L.key)?{...L,sorter:!0,sortOrder:!1,...L.width===void 0?{}:{width:L.width+16}}:L));const q=r.selectable?[{key:"selection",title:"",className:"align-top",width:"32",cellProps:L=>{var ue;const le=((ue=r.isRowSelectable)==null?void 0:ue.call(r,L))??!0;return{class:le?"cursor-pointer":void 0,onClick:()=>{le&&a(L.id,!s.value.includes(L.id))}}},render:L=>{var le;return((le=r.isRowSelectable)==null?void 0:le.call(r,L))??!0?t.h(I.NCheckbox,{checked:s.value.includes(L.id)}):null}}]:[];switch(Ue.getDeviceTypeByResolution()){case Xe.phone:case Xe.tablet:return[...q,J,{key:"order",title:"Заказ",resizable:!0,render:L=>t.h(hm,{order:L,fields:D,orderUrl:r.orderUrl,highlightSettings:m.value})}];case Xe.laptop:{const L=r.showAttachedUserColumn?D:D.filter(le=>le!==Ie.AttachedUser);return[...q,J,...L.map(le=>U.find(ue=>ue.key===le)??K)]}default:return[K]}},y=t.ref(b()),_=t.ref(new W.TableDataPagination(r.pagination??{page:1,pageSize:10,itemCount:0,pageCount:1,pageSlot:5,pageSizes:[10,15,25],showSizePicker:!0})),x=t.computed(()=>({..._.value,prefix({itemCount:T}){return`Всего заказов: ${T}`}})),w=t.ref(null),C=t.ref(null),N=t.ref(null),k=t.ref(null),$=t.ref(null),v=()=>{$.value!==null&&(clearInterval($.value),$.value=null)},E=()=>{v(),r.refreshInterval&&($.value=setInterval(()=>{R()},r.refreshInterval))},P=T=>{_.value.itemCount!==T.meta.total&&(_.value.itemCount=T.meta.total),_.value.page!==T.meta.currentPage&&(_.value.page=T.meta.currentPage),_.value.pageCount!==T.meta.lastPage&&(_.value.pageCount=T.meta.lastPage),_.value.pageSize!==T.meta.perPage&&(_.value.pageSize=T.meta.perPage),d.value=T.data},F=()=>{var T,D,K;r.filters&&((T=C.value)==null||T.abort(),C.value=null,(D=N.value)==null||D.abort(),N.value=null,k.value=null,(K=w.value)==null||K.abort(),w.value=new AbortController,u.value=!0,W.HttpRequester.getInstance(W.OrdersDataProvider).getOrders(r.filters,c.value,{page:_.value.page,pageSize:_.value.pageSize},w.value.signal).then(J=>{P(J),u.value=!1}).catch(J=>{if((J==null?void 0:J.name)!=="CanceledError")throw u.value=!1,J}))},R=()=>{var T;!r.filters||u.value||((T=C.value)==null||T.abort(),C.value=new AbortController,W.HttpRequester.getInstance(W.OrdersDataProvider).getOrders(r.filters,c.value,{page:_.value.page,pageSize:_.value.pageSize},C.value.signal).then(D=>{d.value=d.value.map(K=>D.data.find(U=>U.id===K.id)??K),_.value.itemCount!==D.meta.total&&(_.value.itemCount=D.meta.total),_.value.pageCount!==D.meta.lastPage&&(_.value.pageCount=D.meta.lastPage)}).catch(D=>{if((D==null?void 0:D.name)!=="CanceledError")throw D}))},M=T=>T.meta.total===_.value.itemCount&&V.isEqual(V.map(T.data,"id"),V.map(d.value,"id")),X=async()=>{var D,K;if(!r.filters||u.value)return!1;(D=C.value)==null||D.abort(),C.value=null,(K=N.value)==null||K.abort(),N.value=new AbortController;let T;try{T=await W.HttpRequester.getInstance(W.OrdersDataProvider).getOrders(r.filters,c.value,{page:_.value.page,pageSize:_.value.pageSize},N.value.signal)}catch(J){if((J==null?void 0:J.name)==="CanceledError")return!1;throw J}return M(T)?(d.value=d.value.map(J=>T.data.find(U=>U.id===J.id)??J),k.value=null,!1):(k.value=T,!0)},G=()=>k.value?(P(k.value),k.value=null,!0):!1,Z=()=>{k.value=null},O=T=>{_.value.page=T,F(),o("update:pagination",_.value)},A=T=>{_.value.pageSize=T,_.value.page=1,F(),o("update:pagination",_.value)},Y=T=>{if(V.isNull(T))c.value=l();else{const[D]=c.value;D.field=T.columnKey.toString(),D.direction=T.order==="ascend"?"asc":"desc",c.value=[D]}y.value.forEach(D=>{if(Object.hasOwn(D,"sortOrder")){const K=D;K.sortOrder=K.key===(T==null?void 0:T.columnKey)&&(T!=null&&T.sorter)&&T.order!==!1?T.order:!1}}),F(),o("update:sort",c.value)},H=()=>{y.value=b(),f.value=window.innerHeight,p.value=h()};return t.watch(()=>r.filters,()=>{_.value.page=1,F(),E()}),t.watch(()=>r.sort,()=>{c.value=l(),_.value.page=1,F(),E()}),t.onMounted(()=>{H(),window.addEventListener("resize",H),t.nextTick(()=>{F(),E()})}),t.onUnmounted(()=>{var T,D,K;window.removeEventListener("resize",H),(T=w.value)==null||T.abort(),(D=C.value)==null||D.abort(),(K=N.value)==null||K.abort(),v()}),e({reload:F,checkForUpdates:X,applyPendingUpdate:G,discardPendingUpdate:Z}),(T,D)=>{const K=I.NDataTable;return t.openBlock(),t.createBlock(K,{columns:y.value,data:d.value,"row-key":J=>J.id,"row-props":g,"scroll-x":n.tableMinWidth,pagination:x.value,loading:u.value,remote:!0,bordered:!1,"bottom-bordered":!1,"sticky-expanded-rows":!0,"max-height":p.value,"pagination-behavior-on-filter":"first","onUpdate:page":O,"onUpdate:pageSize":A,"onUpdate:sorter":Y},null,8,["columns","data","row-key","scroll-x","pagination","loading","max-height"])}}}),X4=dn(q4,[["__scopeId","data-v-aff76adb"]]),Y4=t.computed(()=>W.useReferencesStore().deliveryTypeReference??[]),U4=t.computed(()=>W.useReferencesStore().managersList??[]),K4=t.computed(()=>W.useReferencesStore().opfReference??[]),G4=t.computed(()=>W.useReferencesStore().partnerGroupsReference??[]),Z4=t.computed(()=>W.useReferencesStore().priceCoefficientsReference??[]),Q4=t.computed(()=>W.useReferencesStore().productFilesTypesReference??[]),J4=t.computed(()=>W.useReferencesStore().resourceTypesReference),eN=t.computed(()=>W.useReferencesStore().salesDirectionsReference??[]),tN=t.computed(()=>W.useReferencesStore().warehousesReference??[]),nN=t.computed(()=>W.useReferencesStore().paymentTypeReference??[]),km=t.computed(()=>W.useReferencesStore().orderStatusReference??[]),iN=t.computed(()=>W.useReferencesStore().orderStatusDetailReference??[]),rN=t.computed(()=>W.useReferencesStore().operatorReference??[]),oN=t.computed(()=>wt.convertReferencesToSelectOptionsList(W.useReferencesStore().channelPrimaryInterestsReference??[],!0,!1,!0)),sN=t.computed(()=>wt.convertReferencesToSelectOptionsList(W.useReferencesStore().sourcePrimaryInterestsReference??[],!0,!1,!0)),aN=n=>W.HttpRequester.getInstance(W.ReferenceDataProvider).searchCity(n),lN=n=>wt.convertReferencesToSelectOptionsList(n,!0,!1,!1,e=>{var i,r,o;return e!=null&&e.isNewRec()?"-":`${e.name}, ${(i=e==null?void 0:e.region)==null?void 0:i.name}, ${(o=(r=e==null?void 0:e.region)==null?void 0:r.country)==null?void 0:o.name}`},e=>e==null?void 0:e.isNewRec()),cN=async n=>V.map(await W.HttpRequester.getInstance(W.ReferenceDataProvider).searchRegion(n),e=>new W.Region(e)),dN=n=>wt.convertReferencesToSelectOptionsList(n,!0,!1,!1,e=>e.isNewRec()?"-":V.join(V.compact([e.name,e.country.name]),", "),e=>e.isNewRec()),uN=n=>W.HttpRequester.getInstance(W.ClientDataProvider).searchClient(n),fN=n=>wt.convertReferencesToSelectOptionsList(n,!0,!1,!1,e=>e.isNewRec()?"-":[e.name,e.salesDirection.name?`(${e.salesDirection.name})`:void 0,e.city.name?`г. ${e.city.name}${e.city.region.name?`, ${e.city.region.name}`:""}`:void 0,e.isActive?void 0:"[ Деактивирован ]"].filter(Boolean).join(" "),e=>e==null?void 0:e.isNewRec()),hN={class:"flex flex-col gap-4"},mN={class:"flex flex-wrap gap-2"},pN={class:"flex flex-col gap-1.5"},gN={class:"inline-flex items-center gap-2"},yN={class:"flex flex-col gap-1.5"},bN={class:"inline-flex items-center gap-2"},_N={},wN=t.defineComponent({..._N,__name:"order-highlight-settings",props:{settings:{},statuses:{default:void 0}},emits:["update:settings"],setup(n,{emit:e}){const i=n,r=e,o=t.computed(()=>i.statuses??km.value),s=d=>!!d&&i.settings.statuses.includes(d),a=(d,u)=>{if(!d)return;const f=i.settings.statuses.filter(h=>h!==d);r("update:settings",{...i.settings,statuses:u?[...f,d]:f})},l=(d,u)=>{const f=i.settings.markers.filter(h=>h!==d);r("update:settings",{...i.settings,markers:u?[...f,d]:f})},c=d=>{r("update:settings",{statuses:d?o.value.flatMap(u=>u.slug?[u.slug]:[]):[],markers:d?[...co]:[]})};return(d,u)=>{const f=I.NButton,h=I.NCheckbox;return t.openBlock(),t.createElementBlock("div",hN,[t.createElementVNode("div",mN,[t.createVNode(f,{size:"small",onClick:u[0]||(u[0]=p=>c(!0))},{default:t.withCtx(()=>[...u[2]||(u[2]=[t.createTextVNode(" Выделять всё ",-1)])]),_:1}),t.createVNode(f,{size:"small",onClick:u[1]||(u[1]=p=>c(!1))},{default:t.withCtx(()=>[...u[3]||(u[3]=[t.createTextVNode(" Снять всё ",-1)])]),_:1})]),t.createElementVNode("div",pN,[u[4]||(u[4]=t.createElementVNode("div",{class:"text-sm font-semibold"},"Статусы",-1)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.value,p=>(t.openBlock(),t.createBlock(h,{key:p.id,checked:s(p.slug),"onUpdate:checked":m=>a(p.slug,m)},{default:t.withCtx(()=>[t.createElementVNode("span",gN,[t.createVNode(Cl,{colors:t.unref(ki)(p.slug)},null,8,["colors"]),t.createTextVNode(" "+t.toDisplayString(p.name),1)])]),_:2},1032,["checked","onUpdate:checked"]))),128))]),t.createElementVNode("div",yN,[u[5]||(u[5]=t.createElementVNode("div",{class:"text-sm font-semibold"},"Маркеры",-1)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(co),p=>(t.openBlock(),t.createBlock(h,{key:p,checked:n.settings.markers.includes(p),"onUpdate:checked":m=>l(p,m)},{default:t.withCtx(()=>[t.createElementVNode("span",bN,[t.createVNode(Cl,{colors:t.unref(Er)(p)},null,8,["colors"]),t.createTextVNode(" "+t.toDisplayString(t.unref(Ps)(p)),1)])]),_:2},1032,["checked","onUpdate:checked"]))),128))])])}}}),xN=["href"],kN={class:"text-sc-dark-grey"},CN={},vN=t.defineComponent({...CN,__name:"short-text-order-info",props:{order:{},orderLink:{}},emits:["click:order-id"],setup(n,{emit:e}){const i=n,r=e,o=t.computed(()=>Be.format(i.order.createdAt,W.useBaseConfigStateStore().config.dateFormats.uiDateWithTime)),s=a=>{V.isNil(i.orderLink)&&(a.preventDefault(),a.stopPropagation()),r("click:order-id",i.order,a)};return(a,l)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("span",null,[l[1]||(l[1]=t.createTextVNode(" #",-1)),t.createElementVNode("a",{href:n.orderLink??"#",onClick:l[0]||(l[0]=c=>s(c))},t.toDisplayString(n.order.id),9,xN),t.createTextVNode(" от "+t.toDisplayString(o.value),1)]),l[2]||(l[2]=t.createTextVNode(", ",-1)),t.createElementVNode("span",kN,"автор: "+t.toDisplayString(n.order.creator.name)+" ["+t.toDisplayString(n.order.creator.type)+"]",1)],64))}}),SN={class:"sc-page flex flex-col bg-inherit"},BN={class:"my-2 flex flex-row items-end"},NN={class:"sc-title grow"},TN={key:0,class:"sc-title-buttons flex-1 grow-0"},$N={class:"flex flex-col justify-end gap-1 sm:mt-0 sm:flex-row"},EN={key:0,class:"sc-title-extra mt-2 sm:mt-4"},RN={},Cm=t.defineComponent({...RN,__name:"page",props:{title:{default:void 0},stickyHeader:{type:Boolean},stickyTopOffset:{default:0},stickyHeaderOnMobile:{type:Boolean,default:!0}},setup(n){const e=n,i=t.computed(()=>e.stickyHeaderOnMobile?"sticky z-10 bg-inherit":"lg:sticky z-10 bg-inherit");return(r,o)=>{const s=I.NH1;return t.openBlock(),t.createElementBlock("div",SN,[t.createElementVNode("div",{class:t.normalizeClass(n.stickyHeader?i.value:void 0),style:t.normalizeStyle(n.stickyHeader?{top:`${n.stickyTopOffset??0}px`}:void 0)},[t.createElementVNode("div",BN,[t.createElementVNode("div",NN,[t.renderSlot(r.$slots,"title",{},()=>[t.createVNode(s,{class:"m-0 leading-none lg:mb-3 lg:leading-normal"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(n.title??""),1)]),_:1})])]),r.$slots["title-buttons"]?(t.openBlock(),t.createElementBlock("div",TN,[t.createElementVNode("div",$N,[t.renderSlot(r.$slots,"title-buttons")])])):t.createCommentVNode("",!0)]),r.$slots["title-extra"]?(t.openBlock(),t.createElementBlock("div",EN,[t.renderSlot(r.$slots,"title-extra")])):t.createCommentVNode("",!0),t.renderSlot(r.$slots,"sticky-extra")],6),t.renderSlot(r.$slots,"default")])}}}),PN={class:"overflow-hidden transition-all duration-300"},FN={class:"text-lg font-medium leading-none"},VN={},vm=t.defineComponent({...VN,__name:"sliding-content-with-drawer",props:{drawerWidth:{type:[Number,Function],default:void 0},showDrawer:{type:Boolean,default:!1},title:{default:""}},emits:["update:show-drawer"],setup(n,{emit:e}){const i=n,r=e,o=t.ref(0),s=t.ref(i.showDrawer),a=()=>{switch(Ue.getDeviceTypeByResolution()){case Xe.phone:return window.innerWidth*.8;case Xe.tablet:return window.innerWidth*.5;default:return window.innerWidth*.33}},l=()=>{s.value?V.isUndefined(i.drawerWidth)?o.value=a():o.value=V.isFunction(i.drawerWidth)?i.drawerWidth():i.drawerWidth:o.value=0};return t.watch(()=>i.drawerWidth,()=>{l()}),t.watch(()=>s.value,()=>{l(),r("update:show-drawer",s.value)}),t.watch(()=>i.showDrawer,c=>{s.value=c}),t.onUnmounted(()=>{window.removeEventListener("resize",l)}),l(),window.addEventListener("resize",l),(c,d)=>{const u=I.NDrawerContent,f=I.NDrawer;return t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",PN,[t.createElementVNode("div",{style:t.normalizeStyle(`margin-left: ${o.value}px;`),class:"w-full"},[t.renderSlot(c.$slots,"default")],4)]),t.createVNode(f,{show:s.value,"onUpdate:show":d[0]||(d[0]=h=>s.value=h),resizable:!0,width:o.value,placement:"left"},{default:t.withCtx(()=>[t.createVNode(u,{closable:""},{header:t.withCtx(()=>[t.renderSlot(c.$slots,"drawer-header",{},()=>[t.createElementVNode("div",FN,t.toDisplayString(n.title),1)])]),default:t.withCtx(()=>[t.renderSlot(c.$slots,"drawer-content")]),footer:t.withCtx(()=>[t.renderSlot(c.$slots,"drawer-footer")]),_:3})]),_:3},8,["show","width"])],64)}}}),MN={ref:"panel-component-ref",class:"sc-page-panel flex flex-row gap-2.5 bg-inherit sm:gap-8"},IN={key:0},AN={class:"sc-page-preview-panel grow"},ON={key:1,class:"sc-page-preview-panel-extra flex-none"},zN={},DN=t.defineComponent({...zN,__name:"page-with-sliding-panel",props:{title:{},isShowPanelButtonVisible:{type:Boolean,default:!0},showPanelButtonText:{default:""},panelTitle:{default:""},stickyHeader:{type:Boolean,default:!1},stickyTopOffset:{default:0},stickyHeaderOnMobile:{type:Boolean,default:!0}},setup(n,{expose:e}){const i=t.ref(!1),r=()=>{i.value=!0},o=()=>{i.value=!1},s=t.useTemplateRef("panel-component-ref");return e({scrollToTopOfPanel:l=>{var c;(c=s.value)==null||c.scrollIntoView({behavior:"smooth"}),l&&t.nextTick(()=>{var d,u;window.scrollTo({top:(((u=(d=s.value)==null?void 0:d.getBoundingClientRect())==null?void 0:u.top)??0)+window.pageYOffset+l,behavior:"smooth"})})},showPanel:r,closePanel:o}),(l,c)=>{const d=I.NButton;return t.openBlock(),t.createBlock(Cm,{title:n.title,"sticky-header":n.stickyHeader,"sticky-top-offset":n.stickyTopOffset,"sticky-header-on-mobile":n.stickyHeaderOnMobile},t.createSlots({default:t.withCtx(()=>[t.createVNode(vm,{"show-drawer":i.value,"onUpdate:showDrawer":c[1]||(c[1]=u=>i.value=u),title:n.panelTitle},t.createSlots({"drawer-content":t.withCtx(()=>[t.renderSlot(l.$slots,"panel-content")]),default:t.withCtx(()=>[t.renderSlot(l.$slots,"default")]),_:2},[l.$slots["panel-header"]?{name:"drawer-header",fn:t.withCtx(()=>[t.renderSlot(l.$slots,"panel-header")]),key:"0"}:void 0,l.$slots["panel-bottom"]?{name:"drawer-footer",fn:t.withCtx(()=>[t.renderSlot(l.$slots,"panel-bottom")]),key:"1"}:void 0]),1032,["show-drawer","title"])]),_:2},[l.$slots.title?{name:"title",fn:t.withCtx(()=>[t.renderSlot(l.$slots,"title")]),key:"0"}:void 0,l.$slots["title-buttons"]?{name:"title-buttons",fn:t.withCtx(()=>[t.renderSlot(l.$slots,"title-buttons")]),key:"1"}:void 0,l.$slots["title-extra"]?{name:"title-extra",fn:t.withCtx(()=>[t.renderSlot(l.$slots,"title-extra")]),key:"2"}:void 0,l.$slots["preview-panel"]||l.$slots["preview-panel-extra"]||n.isShowPanelButtonVisible?{name:"sticky-extra",fn:t.withCtx(()=>[t.createElementVNode("div",MN,[n.isShowPanelButtonVisible?(t.openBlock(),t.createElementBlock("div",IN,[t.renderSlot(l.$slots,"show-panel-button",{onClickHandler:()=>{i.value=!0}},()=>[t.createVNode(d,{class:"flex-none sm:px-10 sm:py-4",onClick:c[0]||(c[0]=u=>i.value=!0)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(n.showPanelButtonText),1)]),_:1})])])):t.createCommentVNode("",!0),t.createElementVNode("div",AN,[t.renderSlot(l.$slots,"preview-panel")]),l.$slots["preview-panel-extra"]?(t.openBlock(),t.createElementBlock("div",ON,[t.renderSlot(l.$slots,"preview-panel-extra")])):t.createCommentVNode("",!0)],512)]),key:"3"}:void 0]),1032,["title","sticky-header","sticky-top-offset","sticky-header-on-mobile"])}}}),LN={},HN=t.defineComponent({...LN,__name:"curator-select",props:{value:{default:null},clearable:{type:Boolean,default:!1},consistentMenuWidth:{type:Boolean},wrapContent:{type:Boolean},managerReferenceList:{default:()=>[]},showEmptyValue:{type:Boolean,default:!1}},emits:["update:value"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.computed(()=>V.isArray(r.value)),a=t.computed(()=>{var m;return V.isArray(r.value)?r.value.map(g=>g.id):((m=r.value)==null?void 0:m.id)??null}),l=t.computed(()=>{const m=new W.Curator({id:-1,name:"",contacts:{},curatedDirection:new W.CuratedDirection({id:-1,name:"",guid:""}),guid:""}),g=r.showEmptyValue?[m]:[];return r.managerReferenceList.filter(b=>{var y;return(((y=b==null?void 0:b.curatedDirections)==null?void 0:y.length)??0)>0}).forEach(b=>{((b==null?void 0:b.curatedDirections)??[]).forEach(y=>{g.push(new W.Curator({id:b.id,guid:b.guid,name:b.name,photo:b.photo,contacts:b.contacts??{},curatedDirection:y}))})}),g}),c=t.computed(()=>wt.convertReferencesToSelectOptionsList(l.value,!0,{key:"item.curatedDirection.id",label:"item.curatedDirection.name"},!1,m=>{const g=V.some(s.value?r.value:[r.value],["id",m.id])?` (${m.curatedDirection.name}) `:"";return m.curatedDirection.isNewRec()?m.name:`${m.name}${g}`})),d=t.computed(()=>c.value.map(m=>({...m,class:r.wrapContent?`${m.class} consistent-menu-width`:m.class}))),u=t.useTemplateRef("select-component"),f=m=>{if(V.isArray(m)){const g=m.length>0?m.map(b=>l.value.find(y=>y.id===b)).filter(b=>!V.isNil(b)):[];o("update:value",g)}else{const g=m>0?l.value.find(b=>b.id===m):null;o("update:value",g??null)}};return t.watch(()=>r.value,()=>{var m,g;(g=(m=u.value)==null?void 0:m.$forceUpdate)==null||g.call(m)},{deep:!0}),e({focus:()=>{var m;return(m=u.value)==null?void 0:m.focusInput()},blur:()=>{var m;return(m=u.value)==null?void 0:m.blurInput()}}),(m,g)=>(t.openBlock(),t.createBlock(t.unref(I.NSelect),{ref:"select-component",value:a.value,clearable:n.clearable,disabled:c.value.length===0,"consistent-menu-width":n.consistentMenuWidth,multiple:s.value,options:d.value,placeholder:"","onUpdate:value":f},null,8,["value","clearable","disabled","consistent-menu-width","multiple","options"]))}}),WN={},jN=t.defineComponent({...WN,__name:"manager-operator-select",props:{value:{default:null},clearable:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},consistentMenuWidth:{type:Boolean,default:!0},wrapContent:{type:Boolean,default:!1},managerReferenceList:{default:()=>[]},operatorReferenceList:{default:()=>[]},showActualOnly:{type:Boolean,default:!1},groupByEmployeeType:{type:Boolean,default:!1},filterable:{type:Boolean,default:!0},maxTagCount:{default:void 0}},emits:["update:value"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.computed(()=>V.isArray(r.value)),a=t.computed(()=>{var y;return V.isArray(r.value)?r.value.filter(_=>!V.isNil(_)).map(_=>_.id):((y=r.value)==null?void 0:y.id)??null}),l=t.computed(()=>[...r.operatorReferenceList,...r.managerReferenceList]),c=t.computed(()=>{var w;const y=[];r.operatorReferenceList.length>0&&y.push({type:"group",label:"Операторы",key:"operators",children:r.operatorReferenceList.map(C=>({label:C.name,value:C.id,item:C}))});let _=r.managerReferenceList;if(r.showActualOnly){const C=V.isArray(r.value)?r.value.map(N=>N.id):[(w=r.value)==null?void 0:w.id];_=_.filter(N=>N.isActive||C.includes(N.id))}const x=wt.convertReferencesToSelectOptionsList(_,!0,{key:"item.salesDirection.id",label:"item.salesDirection.name"},!1,C=>`${C.name}${C.isActive?"":" [Не активен]"}`);return y.length>0&&x.length>0&&y.push({key:"manager-operator-divider",disabled:!0,render:()=>t.h("div",{class:"sc-manager-operator-select__divider"})}),y.push(...x),y}),d=y=>`${y.name}${"isActive"in y&&!y.isActive?" [Не активен]":""}`,u=t.computed(()=>{var N;const y=V.isArray(r.value)?r.value.map(k=>k.id):[(N=r.value)==null?void 0:N.id],_=k=>r.showActualOnly?k.filter($=>!("isActive"in $)||$.isActive||y.includes($.id)):k,x=[],w=_(r.managerReferenceList);w.length>0&&x.push({type:"group",label:"Менеджеры",key:"managers",children:wt.convertReferencesToSelectOptionsList(w,!0,!1,!1,d)});const C=_(r.operatorReferenceList);return C.length>0&&x.push({type:"group",label:"Операторы",key:"operators",children:wt.convertReferencesToSelectOptionsList(C,!0,!1,!1,d)}),x}),f=t.computed(()=>r.groupByEmployeeType?u.value:c.value),h=t.computed(()=>f.value.map(y=>({...y,class:r.wrapContent?`${y.class??""} consistent-menu-width`:y.class}))),p=t.useTemplateRef("select-component"),m=y=>{if(V.isArray(y)){const _=y.map(x=>l.value.find(w=>w.id===x)).filter(x=>!V.isNil(x));o("update:value",_)}else{const _=V.isNil(y)?null:l.value.find(x=>x.id===y)??null;o("update:value",_)}};return t.watch(()=>r.value,()=>{var y,_;(_=(y=p.value)==null?void 0:y.$forceUpdate)==null||_.call(y)},{deep:!0}),e({focus:()=>{var y;return(y=p.value)==null?void 0:y.focusInput()},blur:()=>{var y;return(y=p.value)==null?void 0:y.blurInput()}}),(y,_)=>(t.openBlock(),t.createBlock(t.unref(I.NSelect),{ref:"select-component",value:a.value,"clear-filter-after-select":!0,clearable:n.clearable,"consistent-menu-width":n.consistentMenuWidth,disabled:n.disabled||f.value.length===0,filterable:n.filterable,"max-tag-count":n.maxTagCount,multiple:s.value,options:h.value,placeholder:"",class:"w-full","onUpdate:value":m},null,8,["value","clearable","consistent-menu-width","disabled","filterable","max-tag-count","multiple","options"]))}}),qN={},XN=t.defineComponent({...qN,__name:"manager-select",props:{value:{default:null},clearable:{type:Boolean,default:!1},consistentMenuWidth:{type:Boolean,default:!0},wrapContent:{type:Boolean,default:!0},managerReferenceList:{default:()=>[]},disabledManagerReferenceList:{default:()=>[]},showActualOnly:{type:Boolean,default:!1},showEmptyValue:{type:Boolean,default:!1},groupBySalesDirection:{type:Boolean,default:!1}},emits:["update:value"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.computed(()=>V.isArray(r.value)),a=t.computed(()=>{var m;return V.isArray(r.value)?r.value.map(g=>g.id):((m=r.value)==null?void 0:m.id)??null}),l=t.computed(()=>r.showEmptyValue?[W.ManagerDataFactory.generateUndefinedManagerInstance(),...r.managerReferenceList]:r.managerReferenceList),c=t.computed(()=>{var b;let m=l.value,g=r.disabledManagerReferenceList.map(y=>y.id);if(r.showActualOnly){const y=V.isArray(r.value)?r.value.map(_=>_.id):[(b=r.value)==null?void 0:b.id];g=V.union(g,l.value.filter(_=>!_.isActive).map(_=>_.id)),m=m.filter(_=>(r.showEmptyValue?W.ManagerDataFactory.isUndefinedManagerInstance(_):!1)||_.isActive||y.includes(_.id))}return wt.convertReferencesToSelectOptionsList(m,!0,r.groupBySalesDirection?{key:"item.salesDirection.id",label:"item.salesDirection.name"}:!1,!1,y=>{const _=!r.groupBySalesDirection||r.groupBySalesDirection&&V.some(s.value?r.value:[r.value],["id",y.id])?` (${y.salesDirection.name}) `:"";return y.salesDirection.isNewRec()?y.name:`${y.name}${_}${y.isActive?"":" [Не активен]"}`},y=>g.includes(y.id)&&y.isActive)}),d=t.computed(()=>c.value.map(m=>({...m,class:r.wrapContent?`${m.class} consistent-menu-width`:m.class}))),u=t.useTemplateRef("select-component"),f=m=>{if(V.isArray(m)){const g=m.length>0?m.filter(b=>!V.some(r.disabledManagerReferenceList,["id",b])).map(b=>l.value.find(y=>y.id===b)).filter(b=>!V.isNil(b)):[];o("update:value",g)}else{const g=m>0&&!V.some(r.disabledManagerReferenceList,["id",m])?l.value.find(b=>b.id===m):new W.Manager;o("update:value",g??new W.Manager)}};return t.watch(()=>r.value,()=>{var m,g;(g=(m=u.value)==null?void 0:m.$forceUpdate)==null||g.call(m)},{deep:!0}),t.watch(()=>r.disabledManagerReferenceList,m=>{if(m.length>0&&r.value)if(s.value){const g=r.value;V.some(g,b=>V.some(m,["id",b.id]))&&o("update:value",g.filter(b=>!V.some(m,["id",b.id])))}else{const g=r.value;V.some(m,["id",g.id])&&o("update:value",new W.Manager)}}),e({focus:()=>{var m;return(m=u.value)==null?void 0:m.focusInput()},blur:()=>{var m;return(m=u.value)==null?void 0:m.blurInput()}}),(m,g)=>(t.openBlock(),t.createBlock(t.unref(I.NSelect),{ref:"select-component",value:a.value,clearable:n.clearable,disabled:c.value.length===0,"consistent-menu-width":n.consistentMenuWidth,multiple:s.value,options:d.value,placeholder:"","onUpdate:value":f},null,8,["value","clearable","disabled","consistent-menu-width","multiple","options"]))}}),YN={class:"m-0.5 flex flex-col p-0.5"},UN={class:"flex flex-row gap-1"},KN={key:0},GN={key:1},ZN={key:2},QN={key:3},JN={class:"flex flex-row gap-1"},eT={key:0},tT={key:1},nT={key:2},iT={key:3},rT={key:0,"data-testid":"address-quality-label",class:"text-sc-warning text-xs"},oT={},Sm=t.defineComponent({...oT,__name:"address-suggestion-label",props:{addr:{},selected:{type:Boolean}},setup(n){const e=n,i=t.computed(()=>Vs.getLabel(e.addr.quality));return(r,o)=>(t.openBlock(),t.createElementBlock("div",YN,[t.createElementVNode("span",UN,[n.addr.postIndex?(t.openBlock(),t.createElementBlock("span",KN,t.toDisplayString(n.addr.postIndex)+", ",1)):t.createCommentVNode("",!0),n.addr.city?(t.openBlock(),t.createElementBlock("span",GN,t.toDisplayString(n.addr.city)+", ",1)):t.createCommentVNode("",!0),n.addr.locality?(t.openBlock(),t.createElementBlock("span",ZN,t.toDisplayString(n.addr.locality)+", ",1)):t.createCommentVNode("",!0),n.addr.region?(t.openBlock(),t.createElementBlock("span",QN,t.toDisplayString(n.addr.region)+", ",1)):t.createCommentVNode("",!0)]),t.createElementVNode("span",JN,[n.addr.street?(t.openBlock(),t.createElementBlock("span",eT,t.toDisplayString(n.addr.street)+", ",1)):t.createCommentVNode("",!0),n.addr.building?(t.openBlock(),t.createElementBlock("span",tT,t.toDisplayString(n.addr.building)+", ",1)):t.createCommentVNode("",!0),n.addr.buildingPart?(t.openBlock(),t.createElementBlock("span",nT,t.toDisplayString(n.addr.buildingPart)+", ",1)):t.createCommentVNode("",!0),n.addr.apartments?(t.openBlock(),t.createElementBlock("span",iT,t.toDisplayString(n.addr.apartments)+", ",1)):t.createCommentVNode("",!0)]),i.value?(t.openBlock(),t.createElementBlock("span",rT,t.toDisplayString(i.value),1)):t.createCommentVNode("",!0)]))}}),Sl={clearable:!1,value:"",field:void 0,disabled:!1},sT={},aT=t.defineComponent({...sT,__name:"address-suggestion",props:t.mergeDefaults({disabled:{type:Boolean},value:{},clearable:{type:Boolean},field:{},minTermLength:{},consistentMenuWidth:{type:Boolean},wrapContent:{type:Boolean},searchDataHandler:{type:Function}},{...Sl,minTermLength:()=>{var n,e;return((e=(n=W.useBaseConfigStateStore().getConfig())==null?void 0:n.minLength)==null?void 0:e.searchTerm)??3},searchDataHandler:void 0,wrapContent:!0}),emits:["select","update:value"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.ref(r.value),a=t.ref(!1),l=t.ref([]),c=t.computed(()=>l.value.map(g=>({label:g[r.field??"addressString"]??"-",value:g.id})));t.watch(()=>r.value,g=>{s.value=g}),t.watch(s,()=>{o("update:value",s.value)});const d=V.debounce(()=>u(),800),u=async()=>{!s.value||s.value.length<r.minTermLength||(a.value=!0,l.value=await(r.searchDataHandler?r.searchDataHandler(s.value,a):W.HttpRequester.getInstance(W.DataSuggestionProvider).searchAddresses(s.value)).finally(()=>{a.value=!1}))},f=(g,b)=>{const y=l.value.find(_=>_.id===g.value)||{};return t.h(Sm,{addr:y,selected:b},{default:V.constant("-")})},h=g=>{d.cancel();const b=l.value.find(y=>y.id===g)||{};o("select",b)},p=t.ref(null);function m(){p.value.focus()}return e({focus:m}),(g,b)=>{const y=I.NAutoComplete;return t.openBlock(),t.createBlock(y,{ref_key:"autoCompleteElement",ref:p,value:s.value,"onUpdate:value":[b[0]||(b[0]=_=>s.value=_),t.unref(d)],class:t.normalizeClass(r.wrapContent?"consistent-menu-width":void 0),clearable:n.clearable,disabled:n.disabled,loading:a.value,options:c.value,"render-label":f,to:r.wrapContent?!1:void 0,placeholder:"",onSelect:h},null,8,["value","class","clearable","disabled","loading","options","to","onUpdate:value"])}}}),lT={class:"m-0.5 flex flex-col p-0.5"},cT={class:"font-medium"},dT={class:"flex flex-row gap-1 text-xs font-light text-blue-800"},uT={key:0},fT={key:1},hT={},Bm=t.defineComponent({...hT,__name:"bank-suggestion-label",props:{bank:{},selected:{type:Boolean}},setup(n){return(e,i)=>(t.openBlock(),t.createElementBlock("div",lT,[t.createElementVNode("span",cT,t.toDisplayString(n.bank.name),1),t.createElementVNode("span",dT,[n.bank.bic?(t.openBlock(),t.createElementBlock("span",uT," БИК: "+t.toDisplayString(n.bank.bic),1)):t.createCommentVNode("",!0),n.bank.inn?(t.openBlock(),t.createElementBlock("span",fT," ИНН: "+t.toDisplayString(n.bank.inn),1)):t.createCommentVNode("",!0)])]))}}),mT={},pT=t.defineComponent({...mT,__name:"bank-suggestion",props:t.mergeDefaults({disabled:{type:Boolean},value:{},clearable:{type:Boolean},field:{},minTermLength:{},consistentMenuWidth:{type:Boolean},wrapContent:{type:Boolean}},{...Sl,minTermLength:()=>{var n,e;return((e=(n=W.useBaseConfigStateStore().getConfig())==null?void 0:n.minLength)==null?void 0:e.searchTerm)??3},wrapContent:!0}),emits:["select","update:value"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.ref(r.value),a=t.ref(!1),l=t.ref([]),c=t.computed(()=>l.value.map(g=>({label:g[r.field??"_"]??"-",value:g.id})));t.watch(()=>r.value,g=>{s.value=g}),t.watch(s,()=>{o("update:value",s.value)});const d=V.debounce(()=>u(),800),u=async()=>{if(!(!s.value||s.value.length<r.minTermLength)){a.value=!0;try{l.value=await W.HttpRequester.getInstance(W.DataSuggestionProvider).searchBank(s.value)}finally{a.value=!1}}},f=(g,b)=>{const y=l.value.find(_=>_.id===g.value)||{};return t.h(Bm,{bank:y,selected:b},{default:V.constant("-")})},h=g=>{d.cancel();const b=l.value.find(y=>y.id===g)||{};o("select",b)},p=t.ref(null);function m(){p.value.focus()}return e({focus:m}),(g,b)=>{const y=I.NAutoComplete;return t.openBlock(),t.createBlock(y,{ref_key:"autoCompleteElement",ref:p,value:s.value,"onUpdate:value":[b[0]||(b[0]=_=>s.value=_),t.unref(d)],class:t.normalizeClass(r.wrapContent?"consistent-menu-width":void 0),clearable:n.clearable,disabled:n.disabled,loading:a.value,options:c.value,"render-label":f,to:r.wrapContent?!1:void 0,placeholder:"",onSelect:h},null,8,["value","class","clearable","disabled","loading","options","to","onUpdate:value"])}}}),gT={class:"font-medium"},yT={key:0,class:"flex flex-row gap-2"},bT={key:0,class:"text-xs font-light text-blue-800"},_T={key:1,class:"text-sc-dark-grey text-xs font-light"},wT={key:1,"data-testid":"address-quality-label",class:"text-sc-warning text-xs"},xT={},Nm=t.defineComponent({...xT,__name:"org-suggestion-label",props:{org:{},selected:{type:Boolean}},setup(n){const e=n,i=t.computed(()=>{var s,a;return((a=(s=e.org.rawData)==null?void 0:s.state)==null?void 0:a.liquidationDate)??!1}),r=t.computed(()=>{var s,a;return((a=(s=e.org.rawData)==null?void 0:s.address)==null?void 0:a.value)??""}),o=t.computed(()=>Vs.getLabel(e.org.legalAddressQuality));return(s,a)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(`m-0.5 flex flex-col p-0.5 ${i.value?"line-through":""}`)},[t.createElementVNode("span",gT,t.toDisplayString(n.org.name),1),n.org.inn||r.value?(t.openBlock(),t.createElementBlock("div",yT,[n.org.inn?(t.openBlock(),t.createElementBlock("span",bT,t.toDisplayString(n.org.inn),1)):t.createCommentVNode("",!0),r.value?(t.openBlock(),t.createElementBlock("span",_T,t.toDisplayString(r.value),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),r.value&&o.value?(t.openBlock(),t.createElementBlock("span",wT,t.toDisplayString(o.value),1)):t.createCommentVNode("",!0)],2))}}),kT={},CT=t.defineComponent({...kT,__name:"org-suggestion",props:t.mergeDefaults({disabled:{type:Boolean},value:{},clearable:{type:Boolean},field:{},minTermLength:{},consistentMenuWidth:{type:Boolean},wrapContent:{type:Boolean},allowSelectTerminated:{type:Boolean}},{...Sl,minTermLength:()=>{var n,e;return((e=(n=W.useBaseConfigStateStore().getConfig())==null?void 0:n.minLength)==null?void 0:e.searchTerm)??3},wrapContent:!0}),emits:["select","update:value"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.ref(r.value),a=t.ref(!1),l=t.ref([]),c=b=>{var y,_;return!!(((_=(y=b.rawData)==null?void 0:y.state)==null?void 0:_.liquidationDate)??!1)},d=t.computed(()=>wt.convertReferencesToSelectOptionsList(l.value,!1,!1,!1,b=>b[r.field??"_"]??"-",b=>!r.allowSelectTerminated&&c(b)));t.watch(()=>r.value,b=>{s.value=b}),t.watch(s,()=>{o("update:value",s.value)});const u=V.debounce(()=>f(),800),f=async()=>{if(!(!s.value||s.value.length<r.minTermLength)){a.value=!0;try{l.value=await W.HttpRequester.getInstance(W.DataSuggestionProvider).searchOrganization(s.value)}finally{a.value=!1}}},h=(b,y)=>{const _=l.value.find(x=>x.id===b.value)||{};return t.h(Nm,{org:_,selected:y},{default:V.constant("-")})},p=b=>{u.cancel();const y=l.value.find(_=>_.id===b)||{};(r.allowSelectTerminated||!c(y))&&o("select",y)},m=t.ref(null);function g(){m.value.focus()}return e({focus:g}),(b,y)=>{const _=I.NAutoComplete;return t.openBlock(),t.createBlock(_,{ref_key:"autoCompleteElement",ref:m,value:s.value,"onUpdate:value":[y[0]||(y[0]=x=>s.value=x),t.unref(u)],class:t.normalizeClass(r.wrapContent?"consistent-menu-width":void 0),clearable:n.clearable,disabled:n.disabled,loading:a.value,options:d.value,"render-label":h,to:r.wrapContent?!1:void 0,placeholder:"",onSelect:p},null,8,["value","class","clearable","disabled","loading","options","to","onUpdate:value"])}}});j.ALL_ORDER_MARKERS=co,j.AddressQualityLabelHelper=Vs,j.CATEGORY_REQUIRED_HINT=$s,j.CommonValidators=jm,j.ConfiguratorSettingsKozyrek=Mu,j.ConfiguratorSettingsMosquito=Fx,j.ContentHelper=Ci,j.CurrencyHelper=ir,j.DEFAULT_ORDER_STATUS_COLORS=Es,j.DateValidators=qm,j.EntityNameHelper=li,j.FileHelper=Wm,j.KozyrekLine=Vn,j.KozyrekTailTemplate=Ia,j.KozyrekTemplate=yr,j.M2PriceHelper=vi,j.MODE_DISABLED_HINT=Nr,j.NumberHelper=Ve,j.NumericValidators=ce,j.ORDER_MARKER_COLORS=Rs,j.ORDER_MARKER_NAMES=Ql,j.ORDER_STATUS_COLORS=Kl,j.OrderMarkerEnum=ct,j.OrdersTableFields=Ie,j.PRODUCT_REQUIRED_HINT=Ts,j.Point=Ma,j.ScAddProductToCartDialog=Bw,j.ScAddressSuggestion=aT,j.ScAddressSuggestionLabel=Sm,j.ScBankSuggestion=pT,j.ScBankSuggestionLabel=Bm,j.ScBaseDialog=zs,j.ScButtonWithConfirmAction=Ym,j.ScCategoryCollapse=tf,j.ScChipGroup=Gm,j.ScClientNameWithShortInfo=Dr,j.ScCollapse=ef,j.ScCollapseItem=oc,j.ScCommentEditor=j2,j.ScCompactCardList=kC,j.ScConfiguratorsProductInfo=Fr,j.ScContragentWithShortInfo=rf,j.ScCreatorUserTypeTag=ks,j.ScCuratorSelect=HN,j.ScDateRange=b2,j.ScDateTimeLabel=es,j.ScDebouncedInput=nC,j.ScDebouncedInputNumber=rC,j.ScDebt=k2,j.ScDialogHeader=T2,j.ScDynamicConfigurator=Zu,j.ScEmail=Hw,j.ScExternalLink=bC,j.ScImageGallery=dc,j.ScInlineEditableItem=Cf,j.ScInlineView=za,j.ScKozyrekConfigurator=Iu,j.ScKozyrekConfiguratorParamsForm=mc,j.ScKozyrekConfiguratorPreview=Vu,j.ScKozyrekConfiguratorTemplates=Fu,j.ScKpiGrid=uC,j.ScLightGallery=cc,j.ScManagerOperatorSelect=jN,j.ScManagerSelect=XN,j.ScMetalForDoorsConfigurator=qu,j.ScMetalForDoorsConfiguratorForm=ju,j.ScMosquitoConfigurator=zu,j.ScMosquitoConfiguratorForm=Au,j.ScMosquitoConfiguratorMeasurementInstructions=Ou,j.ScMosquitoConfiguratorPreview=Aa,j.ScOrderColorSwatch=Cl,j.ScOrderCommonInfo=hm,j.ScOrderDeliveryLabel=xs,j.ScOrderDetails=_m,j.ScOrderExternalLinks=wm,j.ScOrderHighlightSettings=wN,j.ScOrderInfo=xm,j.ScOrderItemParams=xl,j.ScOrderItemsList=ym,j.ScOrderPayment=kl,j.ScOrderProductInfo=pm,j.ScOrderStatusHistory=bm,j.ScOrderStatusTag=gm,j.ScOrdersList=X4,j.ScOrgSuggestion=CT,j.ScOrgSuggestionLabel=Nm,j.ScPage=Cm,j.ScPageWithSlidingPanel=DN,j.ScPersonContactsBlock=Px,j.ScPhone=fx,j.ScPhoneInput=aC,j.ScProductInfoContent=Os,j.ScProductInfoDialog=uc,j.ScProductInfoPopover=fc,j.ScProductName=go,j.ScProductsList=G5,j.ScReferenceSelect=nf,j.ScSandwichConfigurator=Uu,j.ScSandwichConfiguratorForm=Yu,j.ScSandwichM2Configurator=Gu,j.ScSandwichM2ConfiguratorForm=Ku,j.ScSearchableProductSelect=fm,j.ScSearchableReferenceSelect=um,j.ScSetClientPriceFormItem=kw,j.ScShortTextOrderInfo=vN,j.ScSingleFileUploadSelector=K2,j.ScSlidingContentWithDrawer=vm,j.ScStripConfigurator=Wu,j.ScStripConfiguratorForm=Lu,j.ScStripConfiguratorLineItem=Du,j.ScStripConfiguratorPreview=Hu,j.ScUserShortInfo=vl,j.ScWarningIcon=eC,j.SelectOptionHelper=wt,j.UiNotificationProvider=Tr,j.Validators=We,j.WindowResolutionEnum=Xe,j.WindowResolutionProvider=Ue,j.channelPrimaryInterestOptionsList=oN,j.componentSizeInjectionKey=Rr,j.copyToClipboard=ql,j.deliveryTypeReferenceList=Y4,j.getOrderMarkerColors=Er,j.getOrderMarkerName=Ps,j.getOrderMarkers=Fs,j.getOrderStatusColors=ki,j.getOrderStatusCssVariables=Zl,j.getOrderStatusTagColor=Gl,j.getProductInfoFiles=Ms,j.handleFloatInput=fo,j.handleIntegerInput=ft,j.hasProductInfo=tc,j.isCanSandwichM2Show=Vx,j.isCanSandwichShow=Ju,j.isConfiguratorType=Qu,j.managersReferenceList=U4,j.naiveUiTheme=Ip,j.operatorReferenceList=rN,j.opfReferenceList=K4,j.orderStatusDetailReferenceList=iN,j.orderStatusReferenceList=km,j.paginationItemsPrefix=ec,j.parse=ht,j.partnerGroupReferenceList=G4,j.paymentTypeReferenceList=nN,j.priceCoefficientsReferenceList=Z4,j.productFilesTypesReferenceList=Q4,j.renderConfig=Ke,j.resetInputValidation=dt,j.resourceReferencesList=J4,j.salesDirectionsReferenceList=eN,j.searchCityReferenceDataHandler=aN,j.searchCityReferenceLabelRenderer=lN,j.searchClientReferenceDataHandler=uN,j.searchClientReferenceLabelRenderer=fN,j.searchRegionReferenceDataHandler=cN,j.searchRegionReferenceLabelRenderer=dN,j.selectAllTextOnFocus=He,j.showAppVersion=Hm,j.sourcePrimaryInterestOptionsList=sN,j.useCompactLayout=zm,j.useHoverSupport=uo,j.vCopy=Xl,j.vFocusNext=ai,j.warehousesReferenceList=tN,Object.defineProperty(j,Symbol.toStringTag,{value:"Module"})}));