canvasframework 0.5.16 → 0.5.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/dist/canvasframework.js +2 -0
  2. package/dist/canvasframework.js.LICENSE.txt +1 -0
  3. package/package.json +18 -17
  4. package/components/Accordion.js +0 -265
  5. package/components/AndroidDatePickerDialog.js +0 -406
  6. package/components/AppBar.js +0 -398
  7. package/components/AudioPlayer.js +0 -611
  8. package/components/Avatar.js +0 -202
  9. package/components/Banner.js +0 -342
  10. package/components/BottomNavigationBar.js +0 -433
  11. package/components/BottomSheet.js +0 -234
  12. package/components/Button.js +0 -360
  13. package/components/Camera.js +0 -644
  14. package/components/Card.js +0 -193
  15. package/components/Chart.js +0 -700
  16. package/components/Checkbox.js +0 -166
  17. package/components/Chip.js +0 -212
  18. package/components/CircularProgress.js +0 -327
  19. package/components/ContextMenu.js +0 -116
  20. package/components/DatePicker.js +0 -298
  21. package/components/Dialog.js +0 -337
  22. package/components/Divider.js +0 -125
  23. package/components/Drawer.js +0 -276
  24. package/components/FAB.js +0 -270
  25. package/components/FileUpload.js +0 -315
  26. package/components/FloatedCamera.js +0 -644
  27. package/components/IOSDatePickerWheel.js +0 -430
  28. package/components/ImageCarousel.js +0 -219
  29. package/components/ImageComponent.js +0 -223
  30. package/components/Input.js +0 -831
  31. package/components/InputDatalist.js +0 -723
  32. package/components/InputTags.js +0 -624
  33. package/components/List.js +0 -95
  34. package/components/ListItem.js +0 -269
  35. package/components/Modal.js +0 -364
  36. package/components/MorphingFAB.js +0 -428
  37. package/components/MultiSelectDialog.js +0 -206
  38. package/components/NumberInput.js +0 -271
  39. package/components/PasswordInput.js +0 -462
  40. package/components/ProgressBar.js +0 -88
  41. package/components/QRCodeReader.js +0 -539
  42. package/components/RadioButton.js +0 -151
  43. package/components/SearchInput.js +0 -315
  44. package/components/SegmentedControl.js +0 -357
  45. package/components/Select.js +0 -199
  46. package/components/SelectDialog.js +0 -255
  47. package/components/Slider.js +0 -113
  48. package/components/SliverAppBar.js +0 -139
  49. package/components/Snackbar.js +0 -243
  50. package/components/SpeedDialFAB.js +0 -397
  51. package/components/Stepper.js +0 -281
  52. package/components/SwipeableListItem.js +0 -327
  53. package/components/Switch.js +0 -147
  54. package/components/Table.js +0 -492
  55. package/components/Tabs.js +0 -423
  56. package/components/Text.js +0 -141
  57. package/components/TextField.js +0 -151
  58. package/components/TimePicker.js +0 -934
  59. package/components/Toast.js +0 -236
  60. package/components/TreeView.js +0 -420
  61. package/components/Video.js +0 -397
  62. package/components/View.js +0 -140
  63. package/components/VirtualList.js +0 -120
  64. package/core/CanvasFramework.js +0 -3034
  65. package/core/Component.js +0 -243
  66. package/core/ThemeManager.js +0 -358
  67. package/core/UIBuilder.js +0 -267
  68. package/core/WebGLCanvasAdapter.js +0 -782
  69. package/features/Column.js +0 -43
  70. package/features/Grid.js +0 -47
  71. package/features/LayoutComponent.js +0 -43
  72. package/features/OpenStreetMap.js +0 -310
  73. package/features/Positioned.js +0 -33
  74. package/features/PullToRefresh.js +0 -328
  75. package/features/Row.js +0 -40
  76. package/features/SignaturePad.js +0 -257
  77. package/features/Skeleton.js +0 -193
  78. package/features/Stack.js +0 -21
  79. package/index.js +0 -119
  80. package/manager/AccessibilityManager.js +0 -107
  81. package/manager/ErrorHandler.js +0 -59
  82. package/manager/FeatureFlags.js +0 -60
  83. package/manager/MemoryManager.js +0 -107
  84. package/manager/PerformanceMonitor.js +0 -84
  85. package/manager/SecurityManager.js +0 -54
  86. package/utils/AnimationEngine.js +0 -734
  87. package/utils/CryptoManager.js +0 -303
  88. package/utils/DataStore.js +0 -403
  89. package/utils/DevTools.js +0 -1618
  90. package/utils/DevToolsConsole.js +0 -201
  91. package/utils/EventBus.js +0 -407
  92. package/utils/FetchClient.js +0 -74
  93. package/utils/FirebaseAuth.js +0 -653
  94. package/utils/FirebaseCore.js +0 -246
  95. package/utils/FirebaseFirestore.js +0 -581
  96. package/utils/FirebaseFunctions.js +0 -97
  97. package/utils/FirebaseRealtimeDB.js +0 -498
  98. package/utils/FirebaseStorage.js +0 -612
  99. package/utils/FormValidator.js +0 -355
  100. package/utils/GeoLocationService.js +0 -62
  101. package/utils/I18n.js +0 -207
  102. package/utils/IndexedDBManager.js +0 -273
  103. package/utils/InspectionOverlay.js +0 -308
  104. package/utils/NotificationManager.js +0 -60
  105. package/utils/OfflineSyncManager.js +0 -342
  106. package/utils/PayPalPayment.js +0 -678
  107. package/utils/QueryBuilder.js +0 -478
  108. package/utils/SafeArea.js +0 -64
  109. package/utils/SecureStorage.js +0 -289
  110. package/utils/StateManager.js +0 -207
  111. package/utils/StripePayment.js +0 -552
  112. package/utils/WebSocketClient.js +0 -66
@@ -0,0 +1,2 @@
1
+ /*! For license information please see canvasframework.js.LICENSE.txt */
2
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.CanvasFramework=e():t.CanvasFramework=e()}(this,()=>(()=>{"use strict";var t={d:(e,n)=>{for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function r(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function i(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function o(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?i(Object(n),!0).forEach(function(e){a(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function a(t,e,n){return(e=l(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,l(r.key),r)}}function l(t){var e=function(t){if("object"!=n(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==n(e)?e:e+""}t.r(e),t.d(e,{AccessibilityManager:()=>sm,Accordion:()=>ul,AndroidDatePickerDialog:()=>is,AnimationEngine:()=>eo,AppBar:()=>Lt,AudioPlayer:()=>Zc,Avatar:()=>Os,Banner:()=>sr,BottomNavigationBar:()=>it,BottomSheet:()=>re,Button:()=>Wo,Camera:()=>Mr,CanvasFramework:()=>Id,Card:()=>B,Chart:()=>Gc,Checkbox:()=>Pu,Chip:()=>Ys,CircularProgress:()=>Na,Column:()=>Hf,Component:()=>u,ContextMenu:()=>we,CryptoManager:()=>ay,DataStore:()=>Si,DatePicker:()=>bs,DevTools:()=>ao,Dialog:()=>fe,Divider:()=>rc,Drawer:()=>Ot,ErrorHandler:()=>$v,EventBus:()=>Wi,FAB:()=>G,FeatureFlags:()=>km,FetchClient:()=>qp,FileUpload:()=>hc,FirebaseAuth:()=>Dy,FirebaseCore:()=>Ny,FirebaseFirestore:()=>av,FirebaseFunctions:()=>pv,FirebaseRealtimeDB:()=>Ov,FirebaseStorage:()=>Ey,FloatedCamera:()=>ph,FormValidator:()=>li,GeoLocationService:()=>Gp,Grid:()=>kf,I18n:()=>zd,IOSDatePickerWheel:()=>fs,ImageCarousel:()=>Bc,ImageComponent:()=>$a,IndexedDBManager:()=>up,Input:()=>k,InputDatalist:()=>Jn,InputTags:()=>Bn,LayoutComponent:()=>df,List:()=>Vl,ListItem:()=>Al,MemoryManager:()=>pm,Modal:()=>vt,MorphingFAB:()=>Ba,MultiSelectDialog:()=>Ku,NotificationManager:()=>my,NumberInput:()=>Ru,OfflineSyncManager:()=>Ip,OpenStreetMap:()=>bo,PasswordInput:()=>kn,PayPalPayment:()=>_v,PerformanceMonitor:()=>rm,Positioned:()=>Yf,ProgressBar:()=>cu,PullToRefresh:()=>Wh,QRCodeReader:()=>Xr,QueryBuilder:()=>mp,RadioButton:()=>gu,Row:()=>Ff,SafeArea:()=>ti,SearchInput:()=>un,SecureStorage:()=>tp,SecurityManager:()=>gm,SegmentedControl:()=>Xo,Select:()=>Wu,SelectDialog:()=>Ke,SignaturePad:()=>of,Skeleton:()=>Gh,Slider:()=>ea,SliverAppBar:()=>gr,Snackbar:()=>Ms,SpeedDialFAB:()=>Sa,Stack:()=>nd,StateManager:()=>Ad,Stepper:()=>tl,StripePayment:()=>Yv,SwipeableListItem:()=>Pl,Switch:()=>vl,Table:()=>gc,Tabs:()=>Qt,Text:()=>j,TextField:()=>We,TimePicker:()=>jh,Toast:()=>Ie,TreeView:()=>Ic,VERSION:()=>Sm,Video:()=>Hs,View:()=>ca,VirtualList:()=>ru,WebSocketClient:()=>Kp,createRef:()=>ld,ui:()=>cd});const u=function(){return t=function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.framework=e,this.x=n.x||0,this.y=n.y||0,this.width=n.width||100,this.height=n.height||50,this.visible=!1!==n.visible,this.pressed=!1,this.hovered=!1,this.onClick=n.onClick,this.onPress=n.onPress,this._dirty=!0,this._mounted=!1,this._prevProps=o({},n),this._listeners=new Map},e=[{key:"on",value:function(t,e){return this._listeners.has(t)||this._listeners.set(t,[]),this._listeners.get(t).push(e),this}},{key:"off",value:function(t,e){if(!this._listeners.has(t))return this;var n=this._listeners.get(t),r=n.indexOf(e);return r>-1&&n.splice(r,1),this}},{key:"once",value:function(t,e){var n=this,r=function(){e.apply(void 0,arguments),n.off(t,r)};return this.on(t,r)}},{key:"emit",value:function(t){if(!this._listeners.has(t))return this;for(var e=this._listeners.get(t),n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];var a,s=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return r(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,o=function(){};return{s:o,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,l=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){l=!0,a=t},f:function(){try{s||null==n.return||n.return()}finally{if(l)throw a}}}}(e);try{for(s.s();!(a=s.n()).done;){var l=a.value;try{l.apply(void 0,i)}catch(e){console.error("Error in ".concat(t," handler:"),e)}}}catch(t){s.e(t)}finally{s.f()}return this}},{key:"removeAllListeners",value:function(t){return t?this._listeners.delete(t):this._listeners.clear(),this}},{key:"listenerCount",value:function(t){return this._listeners.has(t)?this._listeners.get(t).length:0}},{key:"onMount",value:function(){}},{key:"onUnmount",value:function(){}},{key:"onUpdate",value:function(t){}},{key:"onResize",value:function(t,e){}},{key:"_mount",value:function(){this._mounted||(this._mounted=!0,this.onMount())}},{key:"_unmount",value:function(){this._mounted&&(this.onUnmount(),this._mounted=!1)}},{key:"_update",value:function(t){this.onUpdate(this._prevProps),this._prevProps=o({},t),this.markDirty()}},{key:"_resize",value:function(t,e){this.onResize(t,e),this.markDirty()}},{key:"setProps",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Object.keys(e).some(function(n){return t[n]!==e[n]})&&(Object.assign(this,e),this._update(e))}},{key:"measure",value:function(t){return{width:this.width,height:this.height}}},{key:"markDirty",value:function(){this._dirty=!0,this.framework&&this.framework.markComponentDirty&&this.framework.markComponentDirty(this)}},{key:"markClean",value:function(){this._dirty=!1}},{key:"isDirty",value:function(){return this._dirty}},{key:"isPointInside",value:function(t,e){return t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height}},{key:"draw",value:function(t){}}],e&&s(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function c(t){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},c(t)}function h(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return f(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?f(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function f(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function d(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,w(r.key),r)}}function p(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(p=function(){return!!t})()}function y(t,e,n,r){var i=v(m(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof i?function(t){return i.apply(n,t)}:i}function v(){return v="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=m(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},v.apply(null,arguments)}function m(t){return m=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},m(t)}function g(t,e){return g=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},g(t,e)}function b(t,e,n){return(e=w(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function w(t){var e=function(t){if("object"!=c(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=c(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==c(e)?e:e+""}var x=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=m(e),function(t,e){if(e&&("object"==c(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,p()?Reflect.construct(e,n||[],m(t).constructor):e.apply(t,n))}(this,e,[t,r])).placeholder=r.placeholder||"",n.value=r.value||"",n.label=r.label||"",n.fontSize=r.fontSize||16,n.focused=!1,n.platform=t.platform,n.variant=r.variant||"filled",n.cursorVisible=!0,n.cursorPosition=n.value.length,n.error=r.error||!1,n.errorText=r.errorText||"",n.disabled=r.disabled||!1,n.helperText=r.helperText||"",n.hasLabel=!!n.label,n.leadingIcon=r.leadingIcon||!1,n.trailingIcon=r.trailingIcon||!1,n.backgroundColor=r.backgroundColor||null,n.borderColor=r.borderColor||null,n.focusColor=r.focusColor||null,n.textColor=r.textColor||null,n.placeholderColor=r.placeholderColor||null,n.labelColor=r.labelColor||null,n.paddingLeft=n.leadingIcon?56:16,n.paddingRight=n.trailingIcon?56:16,n.m3Colors={primary:"#6750A4",onSurface:"#1D1B20",onSurfaceVariant:"#49454F",surfaceVariant:"#E7E0EC",surface:"#FEF7FF",error:"#BA1A1A",onError:"#FFFFFF",outline:"#79747E",outlineVariant:"#CAC4D0",disabled:"#1D1B2061",disabledContainer:"#E7E0EC80",defaultBackground:"#F5F5F5",defaultBorder:"#CCCCCC",defaultFocus:"#1976D2"},n.cupertinoColors={blue:"#007AFF",label:"#000000",placeholder:"#999999",background:"#FFFFFF",border:"#C7C7CC",error:"#FF3B30",disabled:"#0000004D"},n.onFocus=n.onFocus.bind(n),n.onBlur=n.onBlur.bind(n),n.onChange=r.onChange||function(){},e.allInputs.add(n),n.cursorInterval=setInterval(function(){n.focused&&!n.disabled&&(n.cursorVisible=!n.cursorVisible)},500),n.setupGlobalClickHandler(),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&g(t,e)}(e,t),n=e,r=[{key:"setupGlobalClickHandler",value:function(){e.globalClickHandler||(e.globalClickHandler=function(t){var n,r=!1,i=h(e.allInputs);try{for(i.s();!(n=i.n()).done;){var o=n.value;if(o.hiddenInput&&t.target===o.hiddenInput){r=!0;break}}}catch(t){i.e(t)}finally{i.f()}r||e.removeAllHiddenInputs()},document.addEventListener("click",e.globalClickHandler,!0),document.addEventListener("touchstart",e.globalClickHandler,!0))}},{key:"setupHiddenInput",value:function(){var t=this;this.hiddenInput||(this.hiddenInput=document.createElement("input"),this.hiddenInput.style.position="fixed",this.hiddenInput.style.opacity="0",this.hiddenInput.style.pointerEvents="none",this.hiddenInput.style.top="-100px",this.hiddenInput.style.zIndex="9999",document.body.appendChild(this.hiddenInput),this.hiddenInput.addEventListener("input",function(e){if(t.focused&&!t.disabled){var n=t.value;t.value=e.target.value,t.cursorPosition=t.value.length,n!==t.value&&t.onChange(t.value)}}),this.hiddenInput.addEventListener("blur",function(){t.focused=!1,t.cursorVisible=!1,setTimeout(function(){t.destroyHiddenInput()},100)}),this.hiddenInput.addEventListener("keydown",function(e){"Enter"!==e.key||e.shiftKey||(e.preventDefault(),t.focused=!1,t.cursorVisible=!1,t.destroyHiddenInput())}))}},{key:"onFocus",value:function(){var t=this;if(!this.disabled&&e.activeInput!==this){e.removeAllHiddenInputs();var n,r=h(e.allInputs);try{for(r.s();!(n=r.n()).done;){var i=n.value;i!==this&&(i.focused=!1,i.cursorVisible=!1)}}catch(t){r.e(t)}finally{r.f()}if(this.focused=!0,this.cursorVisible=!0,e.activeInput=this,this.setupHiddenInput(),this.hiddenInput){this.hiddenInput.value=this.value,this.hiddenInput.disabled=this.disabled;var o=this.y+this.framework.scrollOffset;this.hiddenInput.style.top="".concat(o,"px"),setTimeout(function(){t.hiddenInput&&t.focused&&(t.hiddenInput.focus(),t.hiddenInput.setSelectionRange(t.value.length,t.value.length))},50)}}}},{key:"onBlur",value:function(){this.focused=!1,this.cursorVisible=!1}},{key:"destroyHiddenInput",value:function(){this.hiddenInput&&this.hiddenInput.parentNode&&(this.hiddenInput.parentNode.removeChild(this.hiddenInput),this.hiddenInput=null)}},{key:"onClick",value:function(){this.disabled||this.onFocus()}},{key:"isPointInside",value:function(t,e){return t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height}},{key:"getColor",value:function(t,e){return this.disabled?this.m3Colors.disabled:t||e}},{key:"getFocusColor",value:function(){return this.disabled?this.m3Colors.outlineVariant:this.error&&this.errorText?this.m3Colors.error:this.focusColor||this.m3Colors.defaultFocus}},{key:"getBorderColor",value:function(){return this.disabled?this.m3Colors.outlineVariant:this.error&&this.errorText?this.m3Colors.error:this.focused?this.getFocusColor():this.borderColor||this.m3Colors.defaultBorder}},{key:"getBackgroundColor",value:function(){return this.disabled?this.m3Colors.disabledContainer:this.backgroundColor||this.m3Colors.defaultBackground}},{key:"getTextColor",value:function(){return this.disabled?this.m3Colors.disabled:this.textColor||this.m3Colors.onSurface}},{key:"getPlaceholderColor",value:function(){return this.disabled?this.m3Colors.disabled:this.placeholderColor||this.m3Colors.onSurfaceVariant}},{key:"getLabelColor",value:function(){return this.disabled?this.m3Colors.disabled:this.error&&this.errorText?this.m3Colors.error:this.focused?this.getFocusColor():this.labelColor||this.m3Colors.onSurfaceVariant}},{key:"drawMaterialIcon",value:function(t,e){var n=this.error&&this.errorText;t.save(),t.strokeStyle=this.disabled?this.m3Colors.disabled:n?this.m3Colors.error:this.focused?this.getFocusColor():this.m3Colors.onSurfaceVariant,t.lineWidth=2,t.lineCap="round";var r="leading"===e?this.x+16:this.x+this.width-40,i=this.y+this.height/2-12;if(t.beginPath(),"leading"===e)t.arc(r+12,i+12,8,0,2*Math.PI),t.moveTo(r+18,i+18),t.lineTo(r+22,i+22);else{if(this.error)return t.arc(r+12,i+12,10,0,2*Math.PI),t.stroke(),t.fillStyle=this.m3Colors.error,t.fill(),t.fillStyle=this.m3Colors.onError,t.fillRect(r+11,i+6,2,8),t.fillRect(r+11,i+16,2,2),void t.restore();t.moveTo(r+8,i+8),t.lineTo(r+16,i+16),t.moveTo(r+16,i+8),t.lineTo(r+8,i+16)}t.stroke(),t.restore()}},{key:"drawMaterialFilledInput",value:function(t){var e=this.focused||this.value.length>0,n=this.error&&this.errorText;if(t.fillStyle=this.getBackgroundColor(),t.beginPath(),t.moveTo(this.x+12,this.y),t.lineTo(this.x+this.width-12,this.y),t.quadraticCurveTo(this.x+this.width,this.y,this.x+this.width,this.y+12),t.lineTo(this.x+this.width,this.y+this.height),t.lineTo(this.x,this.y+this.height),t.lineTo(this.x,this.y+12),t.quadraticCurveTo(this.x,this.y,this.x+12,this.y),t.closePath(),t.fill(),t.fillStyle=this.getBorderColor(),this.focused||n?t.fillRect(this.x,this.y+this.height-2,this.width,2):t.fillRect(this.x,this.y+this.height-1,this.width,1),this.leadingIcon&&this.drawMaterialIcon(t,"leading"),this.trailingIcon&&this.drawMaterialIcon(t,"trailing"),this.hasLabel){t.fillStyle=this.getLabelColor(),t.font="".concat(e?12:this.fontSize,"px 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif");var r=this.x+this.paddingLeft,i=this.focused||this.value.length>0?this.y+12:this.y+this.height/2;t.fillText(this.label,r,i)}if(this.value||!this.hasLabel&&!this.focused){var o=this.value||this.placeholder;t.fillStyle=this.value?this.getTextColor():this.getPlaceholderColor(),t.font="".concat(this.fontSize,"px 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif"),t.textAlign="left",t.textBaseline="middle";var a=this.x+this.paddingLeft,s=this.hasLabel&&(this.focused||this.value.length>0)?this.y+this.height/2+8:this.y+this.height/2,l=this.width-this.paddingLeft-this.paddingRight,u=o,c=t.measureText(o).width;if(c>l){for(;c>l&&u.length>0;)u=u.slice(0,-1),c=t.measureText(u+"...").width;u+="..."}t.fillText(u,a,s),this.focused&&this.cursorVisible&&this.value&&(t.fillStyle=this.getFocusColor(),t.fillRect(a+c,s-12,2,24))}if(n||this.helperText){var h=n?this.errorText:this.helperText;t.fillStyle=n?this.m3Colors.error:this.m3Colors.onSurfaceVariant,t.font="12px 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif",t.textAlign="left",t.textBaseline="top",t.fillText(h,this.x+this.paddingLeft,this.y+this.height+4)}}},{key:"drawMaterialOutlinedInput",value:function(t){var e=this.focused||this.value.length>0,n=this.error&&this.errorText;if(t.fillStyle=this.getBackgroundColor(),this.roundRect(t,this.x,this.y,this.width,this.height,4),t.fill(),t.strokeStyle=this.getBorderColor(),t.lineWidth=this.focused?2:1,this.roundRect(t,this.x,this.y,this.width,this.height,4),t.stroke(),this.hasLabel&&(this.focused||this.value.length>0)&&(t.fillStyle=this.getBackgroundColor(),t.fillRect(this.x+12,this.y-6,t.measureText(this.label).width+8,12)),this.leadingIcon&&this.drawMaterialIcon(t,"leading"),this.trailingIcon&&this.drawMaterialIcon(t,"trailing"),this.hasLabel){t.fillStyle=this.getLabelColor(),t.font="".concat(e?12:this.fontSize,"px 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif");var r=this.x+this.paddingLeft,i=this.focused||this.value.length>0?this.y-2:this.y+this.height/2;t.fillText(this.label,r,i)}if(this.value||!this.hasLabel&&!this.focused){var o=this.value||this.placeholder;t.fillStyle=this.value?this.getTextColor():this.getPlaceholderColor(),t.font="".concat(this.fontSize,"px 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif"),t.textAlign="left",t.textBaseline="middle";var a=this.x+this.paddingLeft,s=this.y+this.height/2,l=this.width-this.paddingLeft-this.paddingRight,u=o,c=t.measureText(o).width;if(c>l){for(;c>l&&u.length>0;)u=u.slice(0,-1),c=t.measureText(u+"...").width;u+="..."}t.fillText(u,a,s),this.focused&&this.cursorVisible&&this.value&&(t.fillStyle=this.getFocusColor(),t.fillRect(a+c,s-12,2,24))}if(n||this.helperText){var h=n?this.errorText:this.helperText;t.fillStyle=n?this.m3Colors.error:this.m3Colors.onSurfaceVariant,t.font="12px 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif",t.textAlign="left",t.textBaseline="top",t.fillText(h,this.x+this.paddingLeft,this.y+this.height+4)}}},{key:"drawCupertinoInput",value:function(t){var e=this.error&&this.errorText;if(t.fillStyle=this.backgroundColor||this.cupertinoColors.background,this.roundRect(t,this.x,this.y,this.width,this.height,10),t.fill(),t.strokeStyle=this.disabled?this.cupertinoColors.border+"80":e?this.cupertinoColors.error:this.focused?this.focusColor||this.cupertinoColors.blue:this.borderColor||this.cupertinoColors.border,t.lineWidth=this.focused?2:1,this.roundRect(t,this.x,this.y,this.width,this.height,10),t.stroke(),this.value||this.placeholder){var n=this.value||this.placeholder;t.fillStyle=this.disabled?this.cupertinoColors.disabled:this.value?this.textColor||this.cupertinoColors.label:this.placeholderColor||this.cupertinoColors.placeholder,t.font="".concat(this.fontSize,"px -apple-system, BlinkMacSystemFont, sans-serif"),t.textAlign="left",t.textBaseline="middle";var r=this.width-32,i=n,o=t.measureText(n).width;if(o>r){for(;o>r&&i.length>0;)i=i.slice(0,-1),o=t.measureText(i+"...").width;i+="..."}t.fillText(i,this.x+16,this.y+this.height/2),this.focused&&this.cursorVisible&&this.value&&(t.fillStyle=this.focusColor||this.cupertinoColors.blue,t.fillRect(this.x+16+o,this.y+10,2,this.height-20))}e&&(t.fillStyle=this.cupertinoColors.error,t.font="13px -apple-system, BlinkMacSystemFont, sans-serif",t.textAlign="left",t.textBaseline="top",t.fillText(this.errorText,this.x+16,this.y+this.height+4))}},{key:"draw",value:function(t){t.save(),"material"===this.platform?"outlined"===this.variant?this.drawMaterialOutlinedInput(t):this.drawMaterialFilledInput(t):this.drawCupertinoInput(t),t.restore()}},{key:"roundRect",value:function(t,e,n,r,i,o){t.beginPath(),t.moveTo(e+o,n),t.lineTo(e+r-o,n),t.quadraticCurveTo(e+r,n,e+r,n+o),t.lineTo(e+r,n+i-o),t.quadraticCurveTo(e+r,n+i,e+r-o,n+i),t.lineTo(e+o,n+i),t.quadraticCurveTo(e,n+i,e,n+i-o),t.lineTo(e,n+o),t.quadraticCurveTo(e,n,e+o,n),t.closePath()}},{key:"setValue",value:function(t){var e=this.value;this.value=t,this.cursorPosition=this.value.length,e!==t&&this.onChange(t)}},{key:"setVariant",value:function(t){"filled"!==t&&"outlined"!==t||(this.variant=t)}},{key:"setColors",value:function(t){void 0!==t.backgroundColor&&(this.backgroundColor=t.backgroundColor),void 0!==t.borderColor&&(this.borderColor=t.borderColor),void 0!==t.focusColor&&(this.focusColor=t.focusColor),void 0!==t.textColor&&(this.textColor=t.textColor),void 0!==t.placeholderColor&&(this.placeholderColor=t.placeholderColor),void 0!==t.labelColor&&(this.labelColor=t.labelColor)}},{key:"setError",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";this.error=t,this.errorText=e}},{key:"setDisabled",value:function(t){this.disabled=t,t&&this.focused&&(this.onBlur(),this.destroyHiddenInput())}},{key:"setIcons",value:function(t,e){this.leadingIcon=t,this.trailingIcon=e,this.paddingLeft=t?56:16,this.paddingRight=e?56:16}},{key:"destroy",value:function(){this.destroyHiddenInput(),this.cursorInterval&&clearInterval(this.cursorInterval),e.allInputs.delete(this),0===e.allInputs.size&&e.globalClickHandler&&(document.removeEventListener("click",e.globalClickHandler,!0),document.removeEventListener("touchstart",e.globalClickHandler,!0),e.globalClickHandler=null),y(e,"destroy",this,1)&&y(e,"destroy",this,3)([])}}],i=[{key:"removeAllHiddenInputs",value:function(){var t,n=h(e.allInputs);try{for(n.s();!(t=n.n()).done;){var r=t.value;r.focused=!1,r.cursorVisible=!1,r.hiddenInput&&r.hiddenInput.parentNode&&(r.hiddenInput.parentNode.removeChild(r.hiddenInput),r.hiddenInput=null)}}catch(t){n.e(t)}finally{n.f()}e.activeInput=null}}],r&&d(n.prototype,r),i&&d(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i}(u);b(x,"activeInput",null),b(x,"allInputs",new Set),b(x,"globalClickHandler",null);const k=x;function S(t){return S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},S(t)}function T(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,P(r.key),r)}}function P(t){var e=function(t){if("object"!=S(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=S(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==S(e)?e:e+""}function O(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(O=function(){return!!t})()}function C(t){return C=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},C(t)}function E(t,e){return E=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},E(t,e)}const j=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=C(e),function(t,e){if(e&&("object"==S(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,O()?Reflect.construct(e,n||[],C(t).constructor):e.apply(t,n))}(this,e,[t,r])).text=r.text||"",n.fontSize=r.fontSize||16,n.color=r.color||"#000000",n.align=r.align||"left",n.bold=r.bold||!1,n.maxWidth=r.maxWidth||null,n.wrap=r.wrap||!1,n.lineHeight=r.lineHeight||1.2*n.fontSize,n.wrap&&n.maxWidth&&n.text&&n.calculateWrappedHeight(),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&E(t,e)}(e,t),n=e,(r=[{key:"calculateWrappedHeight",value:function(){this.wrappedLines=null}},{key:"draw",value:function(t){t.save(),t.fillStyle=this.color,t.font="".concat(this.bold?"bold ":"").concat(this.fontSize,"px -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif"),t.textAlign=this.align,t.textBaseline="top";var e=[this.text];if(this.wrap&&this.maxWidth&&this.text)e=this.wrapText(t,this.text,this.maxWidth);else if(this.maxWidth&&this.text){for(var n=this.text;t.measureText(n).width>this.maxWidth&&n.length>3;)n=n.substring(0,n.length-1);n!==this.text&&n.length>3&&(n=n.substring(0,n.length-3)+"..."),e=[n]}for(var r="center"===this.align?this.x+(this.maxWidth||this.width)/2:"right"===this.align?this.x+(this.maxWidth||this.width):this.x,i=0;i<e.length;i++){var o=e[i],a=this.y+i*this.lineHeight;t.fillText(o,r,a)}e.length>1&&(this.height=e.length*this.lineHeight),t.restore()}},{key:"wrapText",value:function(t,e,n){for(var r=e.split(" "),i=[],o=r[0],a=1;a<r.length;a++){var s=r[a];t.measureText(o+" "+s).width<n?o+=" "+s:(i.push(o),o=s)}return i.push(o),i}},{key:"isPointInside",value:function(){return!1}}])&&T(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);function I(t){return I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},I(t)}function F(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function R(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,M(r.key),r)}}function M(t){var e=function(t){if("object"!=I(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=I(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==I(e)?e:e+""}function A(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(A=function(){return!!t})()}function _(t){return _=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_(t)}function D(t,e){return D=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},D(t,e)}const B=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=_(e),function(t,e){if(e&&("object"==I(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,A()?Reflect.construct(e,n||[],_(t).constructor):e.apply(t,n))}(this,e,[t,r])).children=[],n.padding=r.padding||16,n.bgColor=r.bgColor||"#FFFFFF",n.elevation=r.elevation||2,n.borderRadius=r.borderRadius||("material"===t.platform?4:12),n.clipContent=!1!==r.clipContent,n.clickableChildren=!1!==r.clickableChildren,n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&D(t,e)}(e,t),n=e,(r=[{key:"add",value:function(t){return t.x=t.x||0,t.y=t.y||0,this.children.push(t),t.parentCard=this,t}},{key:"draw",value:function(t){t.save(),this.elevation>0&&(t.shadowColor="rgba(0, 0, 0, 0.15)",t.shadowBlur=3*this.elevation,t.shadowOffsetY=this.elevation),t.fillStyle=this.bgColor,t.beginPath(),this.roundRect(t,this.x,this.y,this.width,this.height,this.borderRadius),t.fill(),t.shadowColor="transparent",this.clipContent&&(t.beginPath(),this.roundRect(t,this.x,this.y,this.width,this.height,this.borderRadius),t.clip());var e,n=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return F(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?F(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}(this.children);try{for(n.s();!(e=n.n()).done;){var r=e.value;if(r.visible){var i=r.x,o=r.y;r.x=this.x+this.padding+i,r.y=this.y+this.padding+o,r.draw(t),r.x=i,r.y=o}}}catch(t){n.e(t)}finally{n.f()}t.restore()}},{key:"checkChildClick",value:function(t,e){for(var n=e-this.framework.scrollOffset,r=this.children.length-1;r>=0;r--){var i=this.children[r],o=this.x+this.padding+i.x,a=this.y+this.padding+i.y;if(i.visible&&n>=a&&n<=a+i.height&&t>=o&&t<=o+i.width){if(i.onClick)return i.onClick(),!0;if(i.onPress)return i.onPress(t,n),!0}}return!1}},{key:"roundRect",value:function(t,e,n,r,i,o){t.beginPath(),t.moveTo(e+o,n),t.lineTo(e+r-o,n),t.quadraticCurveTo(e+r,n,e+r,n+o),t.lineTo(e+r,n+i-o),t.quadraticCurveTo(e+r,n+i,e+r-o,n+i),t.lineTo(e+o,n+i),t.quadraticCurveTo(e,n+i,e,n+i-o),t.lineTo(e,n+o),t.quadraticCurveTo(e,n,e+o,n),t.closePath()}},{key:"isPointInside",value:function(t,e){return t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height}},{key:"onClick",value:function(){}}])&&R(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);function L(t){return L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},L(t)}function W(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return H(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?H(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function H(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function z(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,q(r.key),r)}}function q(t){var e=function(t){if("object"!=L(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=L(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==L(e)?e:e+""}function U(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(U=function(){return!!t})()}function N(t){return N=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},N(t)}function V(t,e){return V=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},V(t,e)}const G=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=N(e),function(t,e){if(e&&("object"==L(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,U()?Reflect.construct(e,n||[],N(t).constructor):e.apply(t,n))}(this,e,[t,r])).icon=r.icon||"+",n.extended=r.extended||!1,n.text=r.text||"",n.platform=t.platform,n.variant=r.variant||"medium",n.size=r.size||{small:40,medium:56,large:96}[n.variant]||56,n.bgColor=r.bgColor||("material"===t.platform?"#6750A4":"#007AFF"),n.iconColor=r.iconColor||"#FFFFFF",n.borderRadius={small:12,medium:16,large:28,extended:16}[n.variant]||16,n.x=void 0!==r.x?r.x:t.width-n.size-16,n.y=void 0!==r.y?r.y:t.height-n.size-80,n.extended&&n.text){var i=t.ctx;i.save(),i.font="bold 14px -apple-system, sans-serif";var o=i.measureText(n.text).width;i.restore(),n.width=n.size+o+24,n.borderRadius=16}else n.width=n.size;return n.height=n.size,n.ripples=[],n.onPress=n.handlePress.bind(n),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&V(t,e)}(e,t),n=e,(r=[{key:"handlePress",value:function(t,e){if("material"===this.platform){var n=e-this.framework.scrollOffset;this.ripples.push({x:t-this.x,y:n-this.y,radius:0,maxRadius:1.5*Math.max(this.width,this.height),opacity:1}),this.animateRipple()}}},{key:"animateRipple",value:function(){var t=this,e=function(){var n,r=!1,i=W(t.ripples);try{for(i.s();!(n=i.n()).done;){var o=n.value;o.radius<o.maxRadius&&(o.radius+=o.maxRadius/15,r=!0),o.radius>=.5*o.maxRadius&&(o.opacity-=.05)}}catch(t){i.e(t)}finally{i.f()}t.ripples=t.ripples.filter(function(t){return t.opacity>0}),r&&requestAnimationFrame(e)};e()}},{key:"draw",value:function(t){if(t.save(),this.pressed||(t.shadowColor="rgba(0, 0, 0, 0.3)",t.shadowBlur="material"===this.platform?8:12,t.shadowOffsetY="material"===this.platform?4:6),t.fillStyle=this.pressed?this.darkenColor(this.bgColor):this.bgColor,t.beginPath(),this.roundRect(t,this.x,this.y,this.width,this.height,this.borderRadius),t.fill(),t.shadowColor="transparent",t.shadowBlur=0,t.shadowOffsetY=0,"material"===this.platform){t.save(),t.beginPath(),this.roundRect(t,this.x,this.y,this.width,this.height,this.borderRadius),t.clip();var e,n=W(this.ripples);try{for(n.s();!(e=n.n()).done;){var r=e.value;t.globalAlpha=r.opacity,t.fillStyle="rgba(255, 255, 255, 0.3)",t.beginPath(),t.arc(this.x+r.x,this.y+r.y,r.radius,0,2*Math.PI),t.fill()}}catch(t){n.e(t)}finally{n.f()}t.restore()}this.pressed&&"cupertino"===this.platform&&(t.fillStyle="rgba(0, 0, 0, 0.1)",t.beginPath(),this.roundRect(t,this.x,this.y,this.width,this.height,this.borderRadius),t.fill()),t.fillStyle=this.iconColor;var i="large"===this.variant?36:24;t.font="bold ".concat(i,"px sans-serif"),t.textAlign="center",t.textBaseline="middle",this.extended&&this.text?(t.fillText(this.icon,this.x+this.size/2,this.y+this.size/2),t.font="bold 14px -apple-system, sans-serif",t.fillText(this.text,this.x+this.size+12,this.y+this.size/2)):t.fillText(this.icon,this.x+this.width/2,this.y+this.height/2),t.restore()}},{key:"roundRect",value:function(t,e,n,r,i,o){t.moveTo(e+o,n),t.lineTo(e+r-o,n),t.quadraticCurveTo(e+r,n,e+r,n+o),t.lineTo(e+r,n+i-o),t.quadraticCurveTo(e+r,n+i,e+r-o,n+i),t.lineTo(e+o,n+i),t.quadraticCurveTo(e,n+i,e,n+i-o),t.lineTo(e,n+o),t.quadraticCurveTo(e,n,e+o,n)}},{key:"darkenColor",value:function(t){var e=this.hexToRgb(t);return"rgb(".concat(Math.max(0,e.r-30),", ").concat(Math.max(0,e.g-30),", ").concat(Math.max(0,e.b-30),")")}},{key:"hexToRgb",value:function(t){var e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return e?{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16)}:{r:0,g:0,b:0}}},{key:"isPointInside",value:function(t,e){return t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height}}])&&z(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);function Y(t){return Y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Y(t)}function X(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Q(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function K(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Q(Object(n),!0).forEach(function(e){$(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Q(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function $(t,e,n){return(e=Z(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function J(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Z(r.key),r)}}function Z(t){var e=function(t){if("object"!=Y(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Y(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Y(e)?e:e+""}function tt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(tt=function(){return!!t})()}function et(){return et="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=nt(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},et.apply(null,arguments)}function nt(t){return nt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},nt(t)}function rt(t,e){return rt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},rt(t,e)}const it=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var i=r.height||("material"===t.platform?56:50);return(n=function(t,e,n){return e=nt(e),function(t,e){if(e&&("object"==Y(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,tt()?Reflect.construct(e,n||[],nt(t).constructor):e.apply(t,n))}(this,e,[t,K({x:0,y:t.height-i,width:t.width,height:i},r)])).items=r.items||[],n.selectedIndex=r.selectedIndex||0,n.onChange=r.onChange,n.platform=t.platform,"material"===n.platform?(n.bgColor=r.bgColor||"#FFFFFF",n.selectedColor=r.selectedColor||"#6200EE",n.unselectedColor=r.unselectedColor||"#757575",n.rippleColor="rgba(98, 0, 238, 0.2)"):(n.bgColor=r.bgColor||"rgba(248, 248, 248, 0.95)",n.selectedColor=r.selectedColor||"#007AFF",n.unselectedColor=r.unselectedColor||"#8E8E93"),n.ripples=[],n.animationFrame=null,n.lastAnimationTime=0,n.indicatorX=0,n.targetIndicatorX=0,n.animatingIndicator=!1,n.onPress=n.handlePress.bind(n),n.updateIndicatorPosition(),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&rt(t,e)}(e,t),n=e,r=[{key:"startRippleAnimation",value:function(){var t=this,e=function(n){t.lastAnimationTime||(t.lastAnimationTime=n);var r=n-t.lastAnimationTime;t.lastAnimationTime=n;for(var i=!1,o=t.ripples.length-1;o>=0;o--){var a=t.ripples[o];a.radius<a.maxRadius&&(a.radius+=a.maxRadius/300*r,i=!0),a.radius>=.4*a.maxRadius&&(a.opacity-=.003*r,a.opacity<0&&(a.opacity=0),i=!0),a.opacity<=0&&a.radius>=.95*a.maxRadius&&(t.ripples.splice(o,1),i=!0)}i&&t.requestRender(),t.ripples.length>0?t.animationFrame=requestAnimationFrame(e):(t.animationFrame=null,t.lastAnimationTime=0)};this.ripples.length>0&&!this.animationFrame&&(this.animationFrame=requestAnimationFrame(e))}},{key:"requestRender",value:function(){this.framework&&this.framework.requestRender&&this.framework.requestRender()}},{key:"destroy",value:function(){var t,n,r;this.animationFrame&&(cancelAnimationFrame(this.animationFrame),this.animationFrame=null),(t=e,n=this,"function"==typeof(r=et(nt(1&3?t.prototype:t),"destroy",n))?function(t){return r.apply(n,t)}:r)([])}},{key:"updateIndicatorPosition",value:function(){var t=this.width/this.items.length;this.targetIndicatorX=this.selectedIndex*t,this.animatingIndicator||(this.indicatorX=this.targetIndicatorX)}},{key:"animateIndicator",value:function(){var t=this;this.animatingIndicator=!0;var e=performance.now(),n=this.indicatorX,r=this.targetIndicatorX,i=function(o){var a=o-e,s=Math.min(a/300,1),l=1-Math.pow(1-s,3);t.indicatorX=n+(r-n)*l,s<1?(requestAnimationFrame(i),t.requestRender()):(t.indicatorX=r,t.animatingIndicator=!1,t.requestRender())};requestAnimationFrame(i)}},{key:"draw",value:function(t){t.save(),t.fillStyle=this.bgColor,t.fillRect(this.x,this.y,this.width,this.height),"material"===this.platform?(t.shadowColor="rgba(0, 0, 0, 0.1)",t.shadowBlur=8,t.shadowOffsetY=-2,t.fillRect(this.x,this.y,this.width,1),t.shadowColor="transparent"):(t.strokeStyle="rgba(0, 0, 0, 0.1)",t.lineWidth=.5,t.beginPath(),t.moveTo(this.x,this.y),t.lineTo(this.x+this.width,this.y),t.stroke());for(var e=this.width/this.items.length,n=0;n<this.items.length;n++){var r=this.items[n],i=this.x+n*e,o=n===this.selectedIndex,a=o?this.selectedColor:this.unselectedColor;if("cupertino"===this.platform&&o){t.fillStyle="".concat(this.selectedColor,"15");var s=i+e/2-30,l=this.y+6;t.beginPath(),this.roundRect(t,s,l,60,32,16),t.fill()}var u="material"===this.platform?this.y+12:this.y+8;this.drawIcon(t,r.icon,i+e/2,u,a,o),t.fillStyle=a;var c="material"===this.platform?12:10;t.font="".concat(o&&"material"===this.platform?"bold ":"").concat(c,"px -apple-system, Roboto, sans-serif"),t.textAlign="center",t.textBaseline="top";var h="material"===this.platform?this.y+34:this.y+30;t.fillText(r.label,i+e/2,h)}"material"===this.platform&&this.drawRipples(t),t.restore()}},{key:"drawRipples",value:function(t){t.save(),t.beginPath(),t.rect(this.x,this.y,this.width,this.height),t.clip();var e,n=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return X(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?X(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}(this.ripples);try{for(n.s();!(e=n.n()).done;){var r=e.value;t.globalAlpha=r.opacity,t.fillStyle=this.rippleColor,t.beginPath(),t.arc(r.x,r.y,r.radius,0,2*Math.PI),t.fill()}}catch(t){n.e(t)}finally{n.f()}t.restore()}},{key:"drawIcon",value:function(t,e,n,r,i,o){switch(t.strokeStyle=i,t.fillStyle=i,t.lineWidth=o?2.5:2,t.lineCap="round",t.lineJoin="round",e){case"home":t.beginPath(),t.moveTo(n,r+2),t.lineTo(n-10,r+10),t.lineTo(n-10,r+18),t.lineTo(n+10,r+18),t.lineTo(n+10,r+10),t.closePath(),o?t.fill():t.stroke();break;case"search":t.beginPath(),t.arc(n-2,r+6,7,0,2*Math.PI),t.stroke(),t.beginPath(),t.moveTo(n+4,r+11),t.lineTo(n+9,r+16),t.stroke();break;case"favorite":t.beginPath(),t.moveTo(n,r+3);for(var a=0;a<5;a++){var s=4*a*Math.PI/5-Math.PI/2,l=a%2==0?9:4;t.lineTo(n+Math.cos(s)*l,r+10+Math.sin(s)*l)}t.closePath(),o?t.fill():t.stroke();break;case"person":t.beginPath(),t.arc(n,r+6,5,0,2*Math.PI),t.stroke(),t.beginPath(),t.arc(n,r+20,9,Math.PI,0,!0),t.stroke();break;case"settings":t.beginPath(),t.arc(n,r+10,5,0,2*Math.PI),t.stroke();for(var u=0;u<4;u++){var c=u*Math.PI/2-Math.PI/4;t.beginPath(),t.moveTo(n+7*Math.cos(c),r+10+7*Math.sin(c)),t.lineTo(n+11*Math.cos(c),r+10+11*Math.sin(c)),t.stroke()}}}},{key:"roundRect",value:function(t,e,n,r,i,o){t.moveTo(e+o,n),t.lineTo(e+r-o,n),t.quadraticCurveTo(e+r,n,e+r,n+o),t.lineTo(e+r,n+i-o),t.quadraticCurveTo(e+r,n+i,e+r-o,n+i),t.lineTo(e+o,n+i),t.quadraticCurveTo(e,n+i,e,n+i-o),t.lineTo(e,n+o),t.quadraticCurveTo(e,n,e+o,n)}},{key:"isPointInside",value:function(t,e){return e>=this.y&&e<=this.y+this.height}},{key:"handlePress",value:function(t,e){var n=t-this.x,r=e-this.y;if(r>=0&&r<=this.height){var i=this.width/this.items.length,o=Math.floor(n/i);if(o>=0&&o<this.items.length&&o!==this.selectedIndex){if("material"===this.platform){var a=Math.min(.6*i,.8*this.height);this.ripples.push({x:this.x+(o+.5)*i,y:this.y+this.height/2,radius:0,maxRadius:a,opacity:1,createdAt:performance.now()}),this.animationFrame||this.startRippleAnimation(),this.requestRender()}this.selectedIndex=o,this.updateIndicatorPosition(),"cupertino"===this.platform&&this.animateIndicator(),this.onChange&&this.onChange(o,this.items[o]),this.requestRender()}}}}],r&&J(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);function ot(t){return ot="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ot(t)}function at(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return st(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?st(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function st(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function lt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function ut(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?lt(Object(n),!0).forEach(function(e){ct(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):lt(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function ct(t,e,n){return(e=ft(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ht(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ft(r.key),r)}}function ft(t){var e=function(t){if("object"!=ot(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ot(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ot(e)?e:e+""}function dt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(dt=function(){return!!t})()}function pt(t){return pt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},pt(t)}function yt(t,e){return yt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},yt(t,e)}const vt=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=pt(e),function(t,e){if(e&&("object"==ot(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,dt()?Reflect.construct(e,n||[],pt(t).constructor):e.apply(t,n))}(this,e,[t,ut({x:0,y:0,width:t.width,height:t.height,visible:!1},r)])).title=r.title||"",n.children=[],n.padding=r.padding||20,n.bgColor=r.bgColor||"#FFFFFF",n.overlayColor=r.overlayColor||"rgba(0, 0, 0, 0.7)",n.borderRadius=r.borderRadius||12,n.shadowColor=r.shadowColor||"rgba(0, 0, 0, 0.3)",n.showCloseButton=!1!==r.showCloseButton,n.closeOnOverlayClick=!1!==r.closeOnOverlayClick,n.modalWidth=r.width||Math.min(400,t.width-40),n.modalHeight=r.height||300,n.opacity=0,n.scale=.8,n.isVisible=!1,n.animating=!1,n.closeButtonSize=30,n.closeButtonRect=null,n.onPress=n.handlePress.bind(n),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&yt(t,e)}(e,t),n=e,(r=[{key:"add",value:function(t){return this.children.push(t),t}},{key:"show",value:function(){this.isVisible=!0,this.visible=!0,this.animateIn()}},{key:"hide",value:function(){this.animateOut()}},{key:"animateIn",value:function(){var t=this;if(!this.animating){this.animating=!0;var e=function(){if(t.opacity+=.1,t.scale+=.04,t.opacity>=1)return t.opacity=1,t.scale=1,void(t.animating=!1);requestAnimationFrame(e)};e()}}},{key:"animateOut",value:function(){var t=this;if(!this.animating){this.animating=!0;var e=function(){if(t.opacity-=.1,t.scale-=.04,t.opacity<=0)return t.opacity=0,t.scale=.8,t.isVisible=!1,t.visible=!1,t.animating=!1,void t.framework.remove(t);requestAnimationFrame(e)};e()}}},{key:"draw",value:function(t){if(this.isVisible&&!(this.opacity<=0)){t.save(),t.globalAlpha=this.opacity,t.fillStyle=this.overlayColor,t.fillRect(0,0,this.framework.width,this.framework.height);var e=(this.framework.width-this.modalWidth)/2,n=(this.framework.height-this.modalHeight)/2;if(t.translate(e+this.modalWidth/2,n+this.modalHeight/2),t.scale(this.scale,this.scale),t.translate(-e-this.modalWidth/2,-n-this.modalHeight/2),t.fillStyle=this.bgColor,t.shadowColor=this.shadowColor,t.shadowBlur=20,t.shadowOffsetY=10,t.beginPath(),this.roundRect(t,e,n,this.modalWidth,this.modalHeight,this.borderRadius),t.fill(),t.shadowColor="transparent",this.title&&(t.fillStyle="#000000",t.font="bold 18px -apple-system, sans-serif",t.textAlign="center",t.textBaseline="middle",t.fillText(this.title,e+this.modalWidth/2,n+30)),this.showCloseButton){var r=e+this.modalWidth-this.closeButtonSize-10,i=n+10;this.closeButtonRect={x:r,y:i,width:this.closeButtonSize,height:this.closeButtonSize},t.fillStyle="#F0F0F0",t.beginPath(),t.arc(r+this.closeButtonSize/2,i+this.closeButtonSize/2,this.closeButtonSize/2,0,2*Math.PI),t.fill(),t.strokeStyle="#666666",t.lineWidth=2,t.lineCap="round",t.beginPath(),t.moveTo(r+8,i+8),t.lineTo(r+this.closeButtonSize-8,i+this.closeButtonSize-8),t.stroke(),t.beginPath(),t.moveTo(r+this.closeButtonSize-8,i+8),t.lineTo(r+8,i+this.closeButtonSize-8),t.stroke()}var o=e+this.padding,a=n+(this.title?50:this.padding),s=this.modalWidth-2*this.padding,l=this.modalHeight-a+n-this.padding;t.save(),t.beginPath(),t.rect(o,a,s,l),t.clip();var u,c=at(this.children);try{for(c.s();!(u=c.n()).done;){var h=u.value;if(h.visible){var f=h.x,d=h.y;h.x=o+f,h.y=a+d,h.draw(t),h.x=f,h.y=d}}}catch(t){c.e(t)}finally{c.f()}t.restore(),t.restore()}}},{key:"handlePress",value:function(t,e){var n=e-this.framework.scrollOffset,r=(this.framework.width-this.modalWidth)/2,i=(this.framework.height-this.modalHeight)/2;if(this.showCloseButton&&this.closeButtonRect&&n>=this.closeButtonRect.y&&n<=this.closeButtonRect.y+this.closeButtonRect.height&&t>=this.closeButtonRect.x&&t<=this.closeButtonRect.x+this.closeButtonRect.width)this.hide();else{if(this.closeOnOverlayClick&&!(t>=r&&t<=r+this.modalWidth&&n>=i&&n<=i+this.modalHeight))return void this.hide();var o,a=r+this.padding,s=i+(this.title?50:this.padding),l=at(this.children);try{for(l.s();!(o=l.n()).done;){var u=o.value,c=a+u.x,h=s+u.y;if(n>=h&&n<=h+u.height&&t>=c&&t<=c+u.width){if(u.onClick)return void u.onClick();if(u.onPress)return void u.onPress(t-c,n-h)}}}catch(t){l.e(t)}finally{l.f()}}}},{key:"roundRect",value:function(t,e,n,r,i,o){t.beginPath(),t.moveTo(e+o,n),t.lineTo(e+r-o,n),t.quadraticCurveTo(e+r,n,e+r,n+o),t.lineTo(e+r,n+i-o),t.quadraticCurveTo(e+r,n+i,e+r-o,n+i),t.lineTo(e+o,n+i),t.quadraticCurveTo(e,n+i,e,n+i-o),t.lineTo(e,n+o),t.quadraticCurveTo(e,n,e+o,n),t.closePath()}},{key:"isPointInside",value:function(t,e){return this.isVisible}}])&&ht(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);function mt(t){return mt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},mt(t)}function gt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function bt(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?gt(Object(n),!0).forEach(function(e){wt(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):gt(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function wt(t,e,n){return(e=kt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function xt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,kt(r.key),r)}}function kt(t){var e=function(t){if("object"!=mt(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=mt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==mt(e)?e:e+""}function St(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(St=function(){return!!t})()}function Tt(t){return Tt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Tt(t)}function Pt(t,e){return Pt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Pt(t,e)}const Ot=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=Tt(e),function(t,e){if(e&&("object"==mt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,St()?Reflect.construct(e,n||[],Tt(t).constructor):e.apply(t,n))}(this,e,[t,bt({x:.8*-t.width,y:0,width:.8*t.width,height:t.height,visible:!1},r)])).targetX=-n.width,n.items=r.items||[],n.header=r.header||null,n.onItemClick=r.onItemClick,n.platform=t.platform,n.animating=!1,n.hoveredIndex=-1,n.handlePress=n.handlePress.bind(n),n.handleMove=n.handleMove.bind(n),n.onPress=n.handlePress,n.onMove=n.handleMove,n.bringToFront(),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Pt(t,e)}(e,t),n=e,(r=[{key:"bringToFront",value:function(){var t=this.framework.components.indexOf(this);t>-1&&(this.framework.components.splice(t,1),this.framework.components.push(this))}},{key:"open",value:function(){this.bringToFront(),this.visible=!0,this.targetX=0,this.animate()}},{key:"close",value:function(){this.targetX=-this.width,this.animate()}},{key:"animate",value:function(){var t=this;if(!this.animating){this.animating=!0;var e=function(){var n=t.targetX-t.x;if(Math.abs(n)<1)return t.x=t.targetX,t.animating=!1,void(t.targetX<0&&(t.visible=!1));t.x+=.2*n,requestAnimationFrame(e)};e()}}},{key:"getZoneAtPoint",value:function(t,e){if(!this.visible)return null;if(t>=this.x&&t<=this.x+this.width){var n=this.header?150:0,r=Math.floor((e-n)/56);if(r>=0&&r<this.items.length){var i=n+56*r;if(e>=i&&e<=i+56)return"item"}return"drawer"}return"overlay"}},{key:"handlePress",value:function(t,e){var n=this.getZoneAtPoint(t,e);if("overlay"===n)return this.close(),!0;if("item"===n){var r=this.header?150:0,i=Math.floor((e-r)/56);return i>=0&&i<this.items.length&&(this.onItemClick&&this.onItemClick(i,this.items[i]),this.close()),!0}return!0}},{key:"handleMove",value:function(t,e){if(this.visible)if("item"===this.getZoneAtPoint(t,e)){var n=this.header?150:0,r=Math.floor((e-n)/56);this.hoveredIndex=r}else this.hoveredIndex=-1}},{key:"isPointInside",value:function(t,e){return!!this.visible}},{key:"draw",value:function(t){if(this.visible){t.save();var e=Math.min(.5,(this.x+this.width)/this.width*.5);t.fillStyle="rgba(0, 0, 0, ".concat(e,")"),t.fillRect(0,0,this.framework.width,this.framework.height),t.fillStyle="#FFFFFF",t.fillRect(this.x,this.y,this.width,this.height);var n=t.createLinearGradient(this.x+this.width,0,this.x+this.width+10,0);n.addColorStop(0,"rgba(0, 0, 0, 0.2)"),n.addColorStop(1,"rgba(0, 0, 0, 0)"),t.fillStyle=n,t.fillRect(this.x+this.width,0,10,this.height),this.header&&(t.fillStyle="material"===this.platform?"#6200EE":"#F8F8F8",t.fillRect(this.x,this.y,this.width,150),t.fillStyle="material"===this.platform?"#FFFFFF":"#000000",t.font="bold 24px -apple-system, Roboto, sans-serif",t.textAlign="left",t.textBaseline="bottom",t.fillText(this.header.title||"",this.x+20,this.y+130));for(var r=this.header?150:0,i=0;i<this.items.length;i++){var o=this.items[i],a=this.y+r+56*i;this.hoveredIndex===i&&(t.fillStyle="#F5F5F5",t.fillRect(this.x,a,this.width,56)),o.icon&&(t.fillStyle="#757575",t.font="20px -apple-system, Roboto, sans-serif",t.textAlign="left",t.textBaseline="middle",t.fillText(o.icon,this.x+20,a+28)),t.fillStyle="#000000",t.font="16px -apple-system, Roboto, sans-serif",t.fillText(o.label,this.x+(o.icon?72:20),a+28),o.divider&&(t.strokeStyle="#E0E0E0",t.lineWidth=1,t.beginPath(),t.moveTo(this.x,a+56),t.lineTo(this.x+this.width,a+56),t.stroke())}t.restore()}}}])&&xt(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);function Ct(t){return Ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ct(t)}function Et(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function jt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function It(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?jt(Object(n),!0).forEach(function(e){Ft(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):jt(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function Ft(t,e,n){return(e=Mt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Rt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Mt(r.key),r)}}function Mt(t){var e=function(t){if("object"!=Ct(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ct(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ct(e)?e:e+""}function At(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(At=function(){return!!t})()}function _t(){return _t="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Dt(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},_t.apply(null,arguments)}function Dt(t){return Dt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Dt(t)}function Bt(t,e){return Bt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Bt(t,e)}const Lt=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=Dt(e),function(t,e){if(e&&("object"==Ct(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,At()?Reflect.construct(e,n||[],Dt(t).constructor):e.apply(t,n))}(this,e,[t,It({x:0,y:0,width:t.width,height:r.height||("material"===t.platform?56:44)},r)])).title=r.title||"",n.leftIcon=r.leftIcon||null,n.rightIcon=r.rightIcon||null,n.onLeftClick=r.onLeftClick,n.onRightClick=r.onRightClick,n.platform=t.platform,"material"===n.platform?(n.bgColor=r.bgColor||"#6200EE",n.textColor=r.textColor||"#FFFFFF",n.elevation=void 0!==r.elevation?r.elevation:4):(n.bgColor=r.bgColor||"rgba(248, 248, 248, 0.95)",n.textColor=r.textColor||"#000000",n.elevation=0),n.ripples=[],n.animationFrame=null,n.lastAnimationTime=0,n.leftPressed=!1,n.rightPressed=!1,n.onPress=n.handlePress.bind(n),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Bt(t,e)}(e,t),n=e,r=[{key:"startRippleAnimation",value:function(){var t=this,e=function(n){t.lastAnimationTime||(t.lastAnimationTime=n);var r=n-t.lastAnimationTime;t.lastAnimationTime=n;for(var i=!1,o=t.ripples.length-1;o>=0;o--){var a=t.ripples[o];a.radius<a.maxRadius&&(a.radius+=a.maxRadius/250*r,i=!0),a.radius>=.4*a.maxRadius&&(a.opacity-=.003*r,a.opacity<0&&(a.opacity=0),i=!0),a.opacity<=0&&a.radius>=.95*a.maxRadius&&(t.ripples.splice(o,1),i=!0)}i&&t.requestRender(),t.ripples.length>0?t.animationFrame=requestAnimationFrame(e):(t.animationFrame=null,t.lastAnimationTime=0)};this.ripples.length>0&&!this.animationFrame&&(this.animationFrame=requestAnimationFrame(e))}},{key:"requestRender",value:function(){this.framework&&this.framework.requestRender&&this.framework.requestRender()}},{key:"destroy",value:function(){var t,n,r;this.animationFrame&&(cancelAnimationFrame(this.animationFrame),this.animationFrame=null),(t=e,n=this,"function"==typeof(r=_t(Dt(1&3?t.prototype:t),"destroy",n))?function(t){return r.apply(n,t)}:r)([])}},{key:"draw",value:function(t){t.save(),"material"===this.platform&&this.elevation>0&&(t.shadowColor="rgba(0, 0, 0, 0.2)",t.shadowBlur=2*this.elevation,t.shadowOffsetY=this.elevation/2),t.fillStyle=this.bgColor,t.fillRect(this.x,this.y,this.width,this.height),t.shadowColor="transparent",t.shadowBlur=0,t.shadowOffsetY=0,"cupertino"===this.platform&&(t.strokeStyle="rgba(0, 0, 0, 0.1)",t.lineWidth=.5,t.beginPath(),t.moveTo(this.x,this.y+this.height-.5),t.lineTo(this.x+this.width,this.y+this.height-.5),t.stroke()),"material"===this.platform&&this.drawRipples(t),"cupertino"===this.platform&&(this.leftPressed&&this.leftIcon&&(t.fillStyle="rgba(0, 0, 0, 0.1)",t.beginPath(),t.arc(this.x+28,this.y+this.height/2,20,0,2*Math.PI),t.fill()),this.rightPressed&&this.rightIcon&&(t.fillStyle="rgba(0, 0, 0, 0.1)",t.beginPath(),t.arc(this.x+this.width-28,this.y+this.height/2,20,0,2*Math.PI),t.fill())),t.fillStyle=this.textColor;var e="material"===this.platform&&this.leftIcon?"left":"center",n="left"===e?this.x+72:this.x+this.width/2;if(t.font="".concat("material"===this.platform?"bold ":"","20px -apple-system, Roboto, sans-serif"),t.textAlign=e,t.textBaseline="middle",t.fillText(this.title,n,this.y+this.height/2),this.leftIcon){var r=(this.platform,this.textColor);"menu"===this.leftIcon?this.drawMenuIcon(t,this.x+16,this.y+this.height/2,r):"back"===this.leftIcon&&this.drawBackIcon(t,this.x+16,this.y+this.height/2,r)}if(this.rightIcon){var i="cupertino"===this.platform?"#007AFF":this.textColor;"search"===this.rightIcon?this.drawSearchIcon(t,this.x+this.width-36,this.y+this.height/2,i):"more"===this.rightIcon&&this.drawMoreIcon(t,this.x+this.width-36,this.y+this.height/2,i)}t.restore()}},{key:"drawRipples",value:function(t){var e,n=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Et(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Et(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}(this.ripples);try{for(n.s();!(e=n.n()).done;){var r=e.value;t.save(),t.globalAlpha=r.opacity,t.fillStyle="rgba(255, 255, 255, 0.3)",t.beginPath(),t.arc(r.x,r.y,r.radius,0,2*Math.PI),t.fill(),t.restore()}}catch(t){n.e(t)}finally{n.f()}}},{key:"drawMenuIcon",value:function(t,e,n,r){t.strokeStyle=r,t.lineWidth=2,t.lineCap="round";for(var i=0;i<3;i++)t.beginPath(),t.moveTo(e,n-8+8*i),t.lineTo(e+24,n-8+8*i),t.stroke()}},{key:"drawBackIcon",value:function(t,e,n,r){t.strokeStyle=r,t.lineWidth=2,t.lineCap="round",t.lineJoin="round",t.beginPath(),t.moveTo(e+16,n-10),t.lineTo(e+6,n),t.lineTo(e+16,n+10),t.stroke()}},{key:"drawSearchIcon",value:function(t,e,n,r){t.strokeStyle=r,t.lineWidth=2,t.lineCap="round",t.beginPath(),t.arc(e+8,n-2,8,0,2*Math.PI),t.stroke(),t.beginPath(),t.moveTo(e+14,n+4),t.lineTo(e+20,n+10),t.stroke()}},{key:"drawMoreIcon",value:function(t,e,n,r){t.fillStyle=r;for(var i="material"===this.platform?10:8,o=0;o<3;o++)t.beginPath(),t.arc(e+12,n-i+o*i,2,0,2*Math.PI),t.fill()}},{key:"isPointInside",value:function(t,e){return!!(e>=this.y&&e<=this.y+this.height&&(this.leftIcon&&t>=this.x&&t<=this.x+56||this.rightIcon&&t>=this.x+this.width-56&&t<=this.x+this.width))}},{key:"handlePress",value:function(t,e){var n=this,r=e;if(r>=this.y&&r<=this.y+this.height){if(this.leftIcon&&t>=this.x&&t<=this.x+56)return"material"===this.platform?(this.ripples.push({x:this.x+28,y:this.y+this.height/2,radius:0,maxRadius:28,opacity:1,createdAt:performance.now()}),this.animationFrame||this.startRippleAnimation(),this.requestRender()):(this.leftPressed=!0,setTimeout(function(){n.leftPressed=!1,n.requestRender()},150)),this.onLeftClick&&this.onLeftClick(),this.requestRender(),!0;if(this.rightIcon&&t>=this.x+this.width-56&&t<=this.x+this.width)return"material"===this.platform?(this.ripples.push({x:this.x+this.width-28,y:this.y+this.height/2,radius:0,maxRadius:28,opacity:1,createdAt:performance.now()}),this.animationFrame||this.startRippleAnimation(),this.requestRender()):(this.rightPressed=!0,setTimeout(function(){n.rightPressed=!1,n.requestRender()},150)),this.onRightClick&&this.onRightClick(),this.requestRender(),!0}return!1}}],r&&Rt(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);function Wt(t){return Wt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wt(t)}function Ht(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return zt(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?zt(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function zt(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function qt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ut(r.key),r)}}function Ut(t){var e=function(t){if("object"!=Wt(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Wt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Wt(e)?e:e+""}function Nt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Nt=function(){return!!t})()}function Vt(t,e,n,r){var i=Gt(Yt(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof i?function(t){return i.apply(n,t)}:i}function Gt(){return Gt="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Yt(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},Gt.apply(null,arguments)}function Yt(t){return Yt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Yt(t)}function Xt(t,e){return Xt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Xt(t,e)}const Qt=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=Yt(e),function(t,e){if(e&&("object"==Wt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Nt()?Reflect.construct(e,n||[],Yt(t).constructor):e.apply(t,n))}(this,e,[t,r])).tabs=r.tabs||[],n.selectedIndex=r.selectedIndex||0,n.onChange=r.onChange,n.platform=t.platform,n.height=r.height||56,n.indicatorColor=r.indicatorColor||("material"===n.platform?"#6200EE":"#007AFF"),n.textColor=r.textColor||("material"===n.platform?"#000000":"#8E8E93"),n.selectedTextColor=r.selectedTextColor||n.indicatorColor,n.ripples=[],n.animationFrame=null,n.lastAnimationTime=0,n.pressedTabIndex=-1,n.pressAnimation=0,n.tabChildren=n.tabs.map(function(){return[]}),n.childrenPerTab=r.childrenPerTab||null,n.currentTabIndex=0,n.childAddCount=0,n.onPress=n.handlePress.bind(n),n.position=r.position||("cupertino"===n.platform?"bottom":"top"),"bottom"!==n.position||r.y?"top"!==n.position||r.y||(n.y=r.appbar||0):n.y=t.height-n.height,n.contentY=n.y+n.height,n.contentHeight=t.height-n.height,n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Xt(t,e)}(e,t),n=e,(r=[{key:"setCurrentTab",value:function(t){t>=0&&t<this.tabChildren.length&&(this.currentTabIndex=t)}},{key:"add",value:function(t){t.x=t.x||0,t.y=t.y||0,t.width||(t.width=this.framework.width),t.parentTabs=this;for(var e=this.tabChildren.reduce(function(t,e){return t+e.length},0),n=Math.ceil(e/this.tabs.length),r=0,i=0;i<this.tabChildren.length;i++){if(this.tabChildren[i].length<n){r=i;break}i===this.tabChildren.length-1&&(r=e%this.tabs.length)}return this.tabChildren[r].push(t),t.visible=r===this.selectedIndex,t}},{key:"updateChildrenVisibility",value:function(){var t=this;this.tabChildren.forEach(function(e,n){var r=n===t.selectedIndex;e.forEach(function(t){t.visible=r})})}},{key:"getActiveChildren",value:function(){return this.tabChildren[this.selectedIndex]||[]}},{key:"handlePress",value:function(t,e){var n=this;if(!(e>this.y+this.height&&this.checkChildClick(t,e))&&this.isPointInside(t,e)){var r=this.width/this.tabs.length,i=Math.floor((t-this.x)/r);if(!(i<0||i>=this.tabs.length)){if("material"===this.platform){var o=this.x+i*r+r/2,a=Math.min(.6*r,.8*this.height);this.ripples.push({x:o,y:this.y+this.height/2,radius:0,maxRadius:a,opacity:1}),this.animationFrame||this.startRippleAnimation()}else"cupertino"===this.platform&&(this.pressedTabIndex=i,this.pressAnimation=1,this.requestRender(),setTimeout(function(){return n.animatePressRelease()},100));i!==this.selectedIndex&&(this.selectedIndex=i,this.updateChildrenVisibility(),this.onChange&&this.onChange(i,this.tabs[i])),this.requestRender()}}}},{key:"checkChildClick",value:function(t,e){for(var n=e-(this.framework.scrollOffset||0),r=this.getActiveChildren(),i=r.length-1;i>=0;i--){var o=r[i];if(o.visible){var a=this.x+o.x,s=this.contentY+o.y;if(n>=s&&n<=s+o.height&&t>=a&&t<=a+o.width){if(o.onClick)return o.onClick(),!0;if(o.onPress)return o.onPress(t,n),!0}}}return!1}},{key:"animatePressRelease",value:function(){var t=this,e=null,n=function(r){e||(e=r);var i=Math.min((r-e)/150,1);t.pressAnimation=1-i,t.requestRender(),i<1?requestAnimationFrame(n):(t.pressAnimation=0,t.pressedTabIndex=-1)};requestAnimationFrame(n)}},{key:"isPointInside",value:function(t,e){return t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height}},{key:"startRippleAnimation",value:function(){var t=this,e=function(n){t.lastAnimationTime||(t.lastAnimationTime=n);var r=n-t.lastAnimationTime;t.lastAnimationTime=n;for(var i=!1,o=t.ripples.length-1;o>=0;o--){var a=t.ripples[o];a.radius<a.maxRadius&&(a.radius+=a.maxRadius/300*r),a.radius>=.4*a.maxRadius&&(a.opacity-=.003*r,a.opacity<0&&(a.opacity=0)),a.opacity<=0&&a.radius>=.95*a.maxRadius&&t.ripples.splice(o,1),i=!0}i&&t.requestRender(),t.ripples.length>0?t.animationFrame=requestAnimationFrame(e):t.animationFrame=null};this.ripples.length&&!this.animationFrame&&(this.animationFrame=requestAnimationFrame(e))}},{key:"requestRender",value:function(){this.framework&&this.framework.requestRender&&this.framework.requestRender()}},{key:"draw",value:function(t){t.save(),t.fillStyle="material"===this.platform?"#FFF":"#F2F2F7",t.fillRect(this.x,this.y,this.width,this.height),"material"===this.platform&&(t.strokeStyle="#E0E0E0",t.lineWidth=1,t.beginPath(),t.moveTo(this.x,this.y+this.height),t.lineTo(this.x+this.width,this.y+this.height),t.stroke());var e=this.width/this.tabs.length;"material"===this.platform&&this.drawRipples(t,e);for(var n=0;n<this.tabs.length;n++){var r=this.tabs[n],i=this.x+n*e,o=n===this.selectedIndex;"cupertino"===this.platform&&n===this.pressedTabIndex&&(t.fillStyle="rgba(0,122,255,".concat(.1*this.pressAnimation,")"),t.fillRect(i,this.y,e,this.height)),"cupertino"===this.platform&&o&&(t.fillStyle="#007AFF",t.fillRect(i+e/2-15,this.y+this.height-2,30,2));var a=o?this.selectedTextColor:this.textColor;if(r.icon){t.font="24px -apple-system, sans-serif",t.textAlign="center",t.textBaseline="middle",t.fillStyle=a;var s="material"===this.platform?this.y+18:this.y+20;t.fillText(r.icon,i+e/2,s)}var l="material"===this.platform?14:12,u=o?"600":"400";t.font="".concat(u," ").concat(l,"px -apple-system, Roboto, sans-serif"),t.fillStyle=a,t.textAlign="center",t.textBaseline="middle";var c="material"===this.platform?r.icon?this.y+36:this.y+this.height/2:r.icon?this.y+42:this.y+this.height/2;t.fillText(r.label,i+e/2,c),o&&"material"===this.platform&&(t.fillStyle=this.indicatorColor,t.fillRect(i,this.y+this.height-3,e,3))}t.restore();var h=this.getActiveChildren(),f=this.framework.scrollOffset||0;t.save(),t.beginPath(),t.rect(this.x,this.contentY,this.width,this.contentHeight),t.clip();var d,p=Ht(h);try{for(p.s();!(d=p.n()).done;){var y=d.value;if(y.visible){t.save();var v=y.x,m=y.y;y.x=this.x+v,y.y=this.contentY+m-f,y.draw(t),y.x=v,y.y=m,t.restore()}}}catch(t){p.e(t)}finally{p.f()}t.restore()}},{key:"drawRipples",value:function(t,e){t.save(),t.beginPath(),t.rect(this.x,this.y,this.width,this.height),t.clip();var n,r=Ht(this.ripples);try{for(r.s();!(n=r.n()).done;){var i=n.value;t.globalAlpha=i.opacity,t.fillStyle=this.indicatorColor,t.beginPath(),t.arc(i.x,i.y,i.radius,0,2*Math.PI),t.fill()}}catch(t){r.e(t)}finally{r.f()}t.restore()}},{key:"destroy",value:function(){this.animationFrame&&cancelAnimationFrame(this.animationFrame),Vt(e,"destroy",this,1)&&Vt(e,"destroy",this,3)([])}}])&&qt(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);function Kt(t){return Kt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Kt(t)}function $t(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Jt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Zt(r.key),r)}}function Zt(t){var e=function(t){if("object"!=Kt(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Kt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Kt(e)?e:e+""}function te(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(te=function(){return!!t})()}function ee(t){return ee=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ee(t)}function ne(t,e){return ne=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ne(t,e)}const re=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=ee(e),function(t,e){if(e&&("object"==Kt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,te()?Reflect.construct(e,n||[],ee(t).constructor):e.apply(t,n))}(this,e,[t,{x:0,y:t.height,width:t.width,height:r.height||.6*t.height,visible:!1}])).platform=t.platform,n.children=[],n.dragHandle=!1!==r.dragHandle,n.closeOnOverlayClick=!1!==r.closeOnOverlayClick,"material"===n.platform?(n.bgColor=r.bgColor||"#FFFFFF",n.overlayColor="rgba(0,0,0,0.5)",n.shadowBlur=20,n.shadowOffsetY=-5,n.borderRadius=11):(n.bgColor=r.bgColor||"rgba(255,255,255,0.95)",n.overlayColor="rgba(0,0,0,0.2)",n.shadowBlur=0,n.shadowOffsetY=0,n.borderRadius=r.borderRadius||20),n.targetY=t.height,n.isOpen=!1,n.animating=!1,n.dragging=!1,n.dragStartY=0,n.dragOffset=0,n.lastClickTime=0,n.onPress=n.handlePress.bind(n),n.onMove=n.handleMove.bind(n),n.onRelease=n.handleRelease.bind(n),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ne(t,e)}(e,t),n=e,(r=[{key:"add",value:function(t){return this.children.push(t),t}},{key:"open",value:function(){this.visible=!0,this.isOpen=!0,this.targetY=this.framework.height-this.height,this.animate()}},{key:"close",value:function(){var t=this;this.isOpen=!1,this.targetY=this.framework.height,this.animate(function(){t.visible=!1})}},{key:"animate",value:function(t){var e=this;if(!this.animating){this.animating=!0;var n=function(){var r=e.targetY-e.y;if(Math.abs(r)<1)return e.y=e.targetY,e.animating=!1,void(t&&t());"cupertino"===e.platform?r*=.15:r*=.2,e.y+=r,requestAnimationFrame(n)};n()}}},{key:"handlePress",value:function(t,e){var n=Date.now();if(!(n-this.lastClickTime<300))if(this.lastClickTime=n,e<this.y&&this.closeOnOverlayClick)this.close();else if(this.dragHandle&&e>=this.y&&e<=this.y+40)this.close();else for(var r=this.y+(this.dragHandle?40:16),i=this.children.length-1;i>=0;i--){var o=this.children[i];if(o.visible){var a=this.x+16+o.x,s=r+o.y;if(t>=a&&t<=a+o.width&&e>=s&&e<=s+o.height)return void(o.onClick&&o.onClick())}}}},{key:"handleMove",value:function(t,e){if(this.dragging){this.dragOffset=e-this.dragStartY;var n=this.framework.height-this.height+this.dragOffset;n>=this.framework.height-this.height&&(this.y=n)}}},{key:"handleRelease",value:function(){this.dragging&&(this.dragging=!1,this.framework.activeComponent=null,this.dragOffset>.3*this.height?this.close():(this.targetY=this.framework.height-this.height,this.animate()))}},{key:"draw",value:function(t){if(this.visible){t.save(),t.fillStyle=this.overlayColor,t.fillRect(0,0,this.framework.width,this.framework.height),t.fillStyle=this.bgColor,t.shadowColor="material"===this.platform?"rgba(0,0,0,0.3)":"transparent",t.shadowBlur=this.shadowBlur,t.shadowOffsetY=this.shadowOffsetY,t.beginPath(),this.roundRectTop(t,this.x,this.y,this.width,this.height,this.borderRadius),t.fill(),t.shadowColor="transparent",this.dragHandle&&(t.fillStyle="material"===this.platform?"#CCCCCC":"#E0E0E0",t.beginPath(),this.roundRect(t,this.width/2-20,this.y+12,40,4,2),t.fill());var e=this.y+(this.dragHandle?40:16),n=this.height-(this.dragHandle?40:16);t.save(),t.beginPath(),t.rect(this.x,e,this.width,n),t.clip();var r,i=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return $t(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?$t(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}(this.children);try{for(i.s();!(r=i.n()).done;){var o=r.value;if(o.visible){var a=o.x,s=o.y;o.x=this.x+16+a,o.y=e+s,o.draw(t),o.x=a,o.y=s}}}catch(t){i.e(t)}finally{i.f()}t.restore(),t.restore()}}},{key:"roundRectTop",value:function(t,e,n,r,i,o){t.moveTo(e+o,n),t.lineTo(e+r-o,n),t.quadraticCurveTo(e+r,n,e+r,n+o),t.lineTo(e+r,n+i),t.lineTo(e,n+i),t.lineTo(e,n+o),t.quadraticCurveTo(e,n,e+o,n)}},{key:"roundRect",value:function(t,e,n,r,i,o){if(0===o)return t.rect(e,n,r,i);t.moveTo(e+o,n),t.lineTo(e+r-o,n),t.quadraticCurveTo(e+r,n,e+r,n+o),t.lineTo(e+r,n+i-o),t.quadraticCurveTo(e+r,n+i,e+r-o,n+i),t.lineTo(e+o,n+i),t.quadraticCurveTo(e,n+i,e,n+i-o),t.lineTo(e,n+o),t.quadraticCurveTo(e,n,e+o,n),t.closePath()}},{key:"isPointInside",value:function(t,e){return this.visible}}])&&Jt(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);function ie(t){return ie="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ie(t)}function oe(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return ae(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ae(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function ae(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function se(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,le(r.key),r)}}function le(t){var e=function(t){if("object"!=ie(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ie(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ie(e)?e:e+""}function ue(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ue=function(){return!!t})()}function ce(t){return ce=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ce(t)}function he(t,e){return he=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},he(t,e)}const fe=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=ce(e),function(t,e){if(e&&("object"==ie(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,ue()?Reflect.construct(e,n||[],ce(t).constructor):e.apply(t,n))}(this,e,[t,{x:0,y:0,width:t.width,height:t.height,visible:!1}])).platform=t.platform,n.title=r.title||"",n.message=r.message||"",n.buttons=r.buttons||["OK"],n.onButtonClick=r.onButtonClick,n.dialogWidth=Math.min(320,t.width-40),n.dialogHeight=160,n.opacity=0,n.isVisible=!1,n.buttonRects=[],n.ripples=[],n._animating=!1,n.onPress=n.handlePress.bind(n),n.messageLines=n.wrapText(n.message,n.dialogWidth-48,"16px -apple-system, Roboto, sans-serif"),n.messageLines.length>2&&(n.dialogHeight+=22*(n.messageLines.length-2)),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&he(t,e)}(e,t),n=e,(r=[{key:"draw",value:function(t){!this.isVisible||this.opacity<=0||(t.save(),t.globalAlpha=this.opacity,t.fillStyle="rgba(0,0,0,0.5)",t.fillRect(0,0,this.framework.width,this.framework.height),"material"===this.platform?this.drawMaterial(t):this.drawCupertino(t),t.restore())}},{key:"drawMaterial",value:function(t){var e=(this.framework.width-this.dialogWidth)/2,n=(this.framework.height-this.dialogHeight)/2;t.fillStyle="#FFF",t.shadowColor="rgba(0,0,0,0.25)",t.shadowBlur=12,this.roundRect(t,e,n,this.dialogWidth,this.dialogHeight,6),t.fill(),t.shadowColor="transparent",t.fillStyle="#000",t.font="500 20px Roboto, sans-serif",t.textAlign="left",t.fillText(this.title,e+24,n+36),t.fillStyle="#444",t.font="16px Roboto, sans-serif";for(var r=0;r<this.messageLines.length;r++)t.fillText(this.messageLines[r],e+24,n+70+22*r);this.buttonRects=[];var i=e+this.dialogWidth-16,o=n+this.dialogHeight-28;t.font="500 14px Roboto, sans-serif";for(var a=this.buttons.length-1;a>=0;a--){var s=this.buttons[a],l=t.measureText(s).width+24,u={x:i-=l,y:o-18,width:l,height:36,index:a};this.buttonRects[a]=u,t.save(),t.beginPath(),t.rect(u.x,u.y,u.width,u.height),t.clip();var c,h=oe(this.ripples);try{for(h.s();!(c=h.n()).done;){var f=c.value;f.index===a&&(t.globalAlpha=f.alpha,t.fillStyle="rgba(98,0,238,0.25)",t.beginPath(),t.arc(f.x,f.y,f.radius,0,2*Math.PI),t.fill())}}catch(t){h.e(t)}finally{h.f()}t.restore(),t.fillStyle="#6200EE",t.textAlign="center",t.fillText(s,i+l/2,o),i-=8}}},{key:"drawCupertino",value:function(t){var e=(this.framework.width-this.dialogWidth)/2,n=(this.framework.height-this.dialogHeight)/2;t.fillStyle="#FFF",t.shadowColor="rgba(0,0,0,0.3)",t.shadowBlur=20,this.roundRect(t,e,n,this.dialogWidth,this.dialogHeight,12),t.fill(),t.shadowColor="transparent",t.fillStyle="#000",t.font="600 18px -apple-system, sans-serif",t.textAlign="center",t.fillText(this.title,e+this.dialogWidth/2,n+38),t.fillStyle="#666",t.font="16px -apple-system, sans-serif";for(var r=0;r<this.messageLines.length;r++)t.fillText(this.messageLines[r],e+this.dialogWidth/2,n+72+22*r);var i=n+this.dialogHeight-54;t.strokeStyle="#E5E5EA",t.beginPath(),t.moveTo(e,i),t.lineTo(e+this.dialogWidth,i),t.stroke(),this.buttonRects=[];for(var o=this.dialogWidth/this.buttons.length,a=0;a<this.buttons.length;a++){var s=e+a*o,l=i;this.buttonRects.push({x:s,y:l,width:o,height:54}),t.fillStyle=a===this.buttons.length-1?"#007AFF":"#8E8E93",t.font="600 17px -apple-system, sans-serif",t.textAlign="center",t.fillText(this.buttons[a],s+o/2,l+27),a<this.buttons.length-1&&(t.strokeStyle="#E5E5EA",t.beginPath(),t.moveTo(s+o,l),t.lineTo(s+o,l+54),t.stroke())}}},{key:"handlePress",value:function(t,e){for(var n,r=this,i=function(n){var i=r.buttonRects[n];if(t>=i.x&&t<=i.x+i.width&&e>=i.y&&e<=i.y+i.height){if("material"===r.platform){var o=1.4*Math.max(i.width,i.height);r.ripples.push({index:n,x:t,y:e,radius:0,alpha:.35,max:o}),r.animateRipples()}return setTimeout(function(){var t;null===(t=r.onButtonClick)||void 0===t||t.call(r,n,r.buttons[n]),r.hide()},120),{v:void 0}}},o=0;o<this.buttonRects.length;o++)if(n=i(o))return n.v;this.hide()}},{key:"animateRipples",value:function(){var t=this;if(!this._animating){this._animating=!0;var e=function(){var n,r=!1,i=oe(t.ripples);try{for(i.s();!(n=i.n()).done;){var o=n.value;o.radius+=.12*o.max,o.alpha-=.04,o.alpha>0&&(r=!0)}}catch(t){i.e(t)}finally{i.f()}t.ripples=t.ripples.filter(function(t){return t.alpha>0}),r?requestAnimationFrame(e):t._animating=!1};requestAnimationFrame(e)}}},{key:"show",value:function(){var t=this;this.isVisible=!0,this.visible=!0,this.opacity=0;var e=function(){t.opacity+=.1,t.opacity<1&&requestAnimationFrame(e)};e()}},{key:"hide",value:function(){var t=this,e=function(){t.opacity-=.1,t.opacity>0?requestAnimationFrame(e):(t.isVisible=!1,t.visible=!1,t.framework.remove(t))};e()}},{key:"wrapText",value:function(t,e,n){var r=this.framework.ctx;r.font=n;for(var i=t.split(" "),o=[],a=i[0],s=1;s<i.length;s++){var l=a+" "+i[s];r.measureText(l).width<e?a=l:(o.push(a),a=i[s])}return o.push(a),o}},{key:"roundRect",value:function(t,e,n,r,i,o){t.beginPath(),t.moveTo(e+o,n),t.lineTo(e+r-o,n),t.quadraticCurveTo(e+r,n,e+r,n+o),t.lineTo(e+r,n+i-o),t.quadraticCurveTo(e+r,n+i,e+r-o,n+i),t.lineTo(e+o,n+i),t.quadraticCurveTo(e,n+i,e,n+i-o),t.lineTo(e,n+o),t.quadraticCurveTo(e,n,e+o,n),t.closePath()}},{key:"isPointInside",value:function(){return this.isVisible}}])&&se(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);function de(t){return de="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},de(t)}function pe(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ye(r.key),r)}}function ye(t){var e=function(t){if("object"!=de(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=de(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==de(e)?e:e+""}function ve(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ve=function(){return!!t})()}function me(){return me="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=ge(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},me.apply(null,arguments)}function ge(t){return ge=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ge(t)}function be(t,e){return be=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},be(t,e)}const we=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=ge(e),function(t,e){if(e&&("object"==de(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,ve()?Reflect.construct(e,n||[],ge(t).constructor):e.apply(t,n))}(this,e,[t,r])).options=r.options||[],n.onSelect=r.onSelect,n.itemHeight=48,n.height=n.options.length*n.itemHeight,n.hoveredIndex=-1,n.isOpen=!0,n.onClick=n.handleClick.bind(n),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&be(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t){if(this.isOpen){t.save(),t.fillStyle="#FFFFFF",t.shadowColor="rgba(0, 0, 0, 0.2)",t.shadowBlur=10,t.fillRect(this.x,this.y,this.width,this.height),t.shadowColor="transparent";for(var e=0;e<this.options.length;e++){var n=this.y+e*this.itemHeight;this.hoveredIndex===e&&(t.fillStyle="#F5F5F5",t.fillRect(this.x,n,this.width,this.itemHeight)),t.fillStyle="#000000",t.font="16px -apple-system, sans-serif",t.textAlign="left",t.textBaseline="middle",t.fillText(this.options[e],this.x+16,n+this.itemHeight/2),e<this.options.length-1&&(t.strokeStyle="#E0E0E0",t.lineWidth=1,t.beginPath(),t.moveTo(this.x,n+this.itemHeight),t.lineTo(this.x+this.width,n+this.itemHeight),t.stroke())}t.restore()}}},{key:"isPointInside",value:function(t,n){var r,i,o,a=n-this.framework.scrollOffset,s=(r=e,i=this,"function"==typeof(o=me(ge(1&3?r.prototype:r),"isPointInside",i))?function(t){return o.apply(i,t)}:o)([t,a]);return this.hoveredIndex=s?Math.floor((a-this.y)/this.itemHeight):-1,s}},{key:"handleClick",value:function(){this.hoveredIndex>=0&&this.onSelect&&(this.onSelect(this.hoveredIndex),this.close())}},{key:"close",value:function(){this.isOpen=!1,this.framework.remove(this)}}],r&&pe(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);function xe(t){return xe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xe(t)}function ke(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function Se(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?ke(Object(n),!0).forEach(function(e){Te(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ke(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function Te(t,e,n){return(e=Oe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Pe(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Oe(r.key),r)}}function Oe(t){var e=function(t){if("object"!=xe(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=xe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==xe(e)?e:e+""}function Ce(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ce=function(){return!!t})()}function Ee(t){return Ee=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ee(t)}function je(t,e){return je=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},je(t,e)}const Ie=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=Ee(e),function(t,e){if(e&&("object"==xe(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Ce()?Reflect.construct(e,n||[],Ee(t).constructor):e.apply(t,n))}(this,e,[t,Se({x:0,y:t.height,width:t.width,height:60},r)])).text=r.text||"",n.duration=r.duration||3e3,n.fontSize=16,n.padding=20,n.opacity=0,n.platform=t.platform,n.isVisible=!1,n.targetY=t.height-100,n.minWidth=200,n.maxWidth=Math.min(600,t.width-40),n.animating=!1,n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&je(t,e)}(e,t),n=e,(r=[{key:"show",value:function(){var t=this;this.isVisible=!0,this.visible=!0,this.animateIn(),setTimeout(function(){t.isVisible&&t.hide()},this.duration)}},{key:"hide",value:function(){this.animateOut()}},{key:"animateIn",value:function(){var t=this;if(!this.animating){this.animating=!0;var e=function(){if(t.opacity+=.1,t.y-=.2*(t.y-t.targetY),t.opacity>=1&&Math.abs(t.y-t.targetY)<1)return t.opacity=1,t.y=t.targetY,void(t.animating=!1);requestAnimationFrame(e)};e()}}},{key:"animateOut",value:function(){var t=this;if(!this.animating){this.animating=!0;var e=function(){if(t.opacity-=.1,t.y+=5,t.opacity<=0)return t.opacity=0,t.isVisible=!1,t.visible=!1,t.animating=!1,void t.framework.remove(t);requestAnimationFrame(e)};e()}}},{key:"draw",value:function(t){if(this.isVisible&&!(this.opacity<=0)){t.save(),t.globalAlpha=this.opacity,t.font="".concat(this.fontSize,"px -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif");var e=t.measureText(this.text).width,n=Math.min(this.maxWidth,Math.max(this.minWidth,e+2*this.padding)),r=(this.framework.width-n)/2,i=this.y;"material"===this.platform?(t.fillStyle="#323232",t.shadowColor="rgba(0, 0, 0, 0.3)",t.shadowBlur=15,t.shadowOffsetY=4,t.beginPath(),this.roundRect(t,r,i,n,this.height,8),t.fill()):(t.fillStyle="rgba(0, 0, 0, 0.85)",t.shadowColor="rgba(0, 0, 0, 0.2)",t.shadowBlur=20,t.shadowOffsetY=4,t.beginPath(),this.roundRect(t,r,i,n,this.height,14),t.fill()),t.shadowColor="transparent",t.shadowBlur=0,t.fillStyle="#FFFFFF",t.font="".concat(this.fontSize,"px -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif"),t.textAlign="center",t.textBaseline="middle";var o=this.text;if(e>n-2*this.padding)for(var a=this.text,s=this.text.length;s>0;s--)if(a=this.text.substring(0,s)+"...",t.measureText(a).width<=n-2*this.padding){o=a;break}t.fillText(o,r+n/2,i+this.height/2),t.restore()}}},{key:"roundRect",value:function(t,e,n,r,i,o){t.beginPath(),t.moveTo(e+o,n),t.lineTo(e+r-o,n),t.quadraticCurveTo(e+r,n,e+r,n+o),t.lineTo(e+r,n+i-o),t.quadraticCurveTo(e+r,n+i,e+r-o,n+i),t.lineTo(e+o,n+i),t.quadraticCurveTo(e,n+i,e,n+i-o),t.lineTo(e,n+o),t.quadraticCurveTo(e,n,e+o,n),t.closePath()}},{key:"isPointInside",value:function(){return!1}}])&&Pe(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);function Fe(t){return Fe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Fe(t)}function Re(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Me(r.key),r)}}function Me(t){var e=function(t){if("object"!=Fe(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Fe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Fe(e)?e:e+""}function Ae(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ae=function(){return!!t})()}function _e(t,e,n,r){var i=De(Be(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof i?function(t){return i.apply(n,t)}:i}function De(){return De="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Be(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},De.apply(null,arguments)}function Be(t){return Be=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Be(t)}function Le(t,e){return Le=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Le(t,e)}const We=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=Be(e),function(t,e){if(e&&("object"==Fe(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Ae()?Reflect.construct(e,n||[],Be(t).constructor):e.apply(t,n))}(this,e,[t,r])).label=r.label||"",n.helperText=r.helperText||"",n.errorText=r.errorText||"",n.error=r.error||!1,n.labelRestY=14,n.labelFloatY=4,n.labelY=n.value?n.labelFloatY:n.labelRestY,n.labelFontSize=n.value?12:16,n.labelRestSize=15,n.labelFontSize=n.value?n.labelFloatSize:n.labelRestSize,n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Le(t,e)}(e,t),n=e,(r=[{key:"animateLabel",value:function(){var t=this.focused||this.value;this.labelY=t?this.labelFloatY:this.labelRestY,this.labelFontSize=t?this.labelFloatSize:this.labelRestSize}},{key:"onFocus",value:function(){_e(e,"onFocus",this,3)([]),this.animateLabel()}},{key:"onBlur",value:function(){_e(e,"onBlur",this,3)([]),this.animateLabel()}},{key:"draw",value:function(t){t.save();var e=this.y+28;if("material"===this.platform){t.fillStyle=this.error?"#B00020":this.focused?"#6200EE":"#757575",t.font="".concat(this.labelFontSize,"px Roboto, sans-serif"),t.textBaseline="top",t.fillText(this.label,this.x,this.y+this.labelY),t.strokeStyle=this.error?"#B00020":this.focused?"#6200EE":"#CCCCCC",t.lineWidth=this.focused?2:1,t.beginPath(),t.moveTo(this.x,e+42),t.lineTo(this.x+this.width,e+42),t.stroke();var n=!this.value&&!this.focused;if(t.fillStyle=n?"#9E9E9E":"#000",t.font="".concat(this.fontSize,"px Roboto, sans-serif"),t.textBaseline="middle",t.fillText(n?this.placeholder:this.value,this.x,e+21),this.focused&&this.cursorVisible){var r=t.measureText(this.value).width;t.fillStyle="#6200EE",t.fillRect(this.x+r+2,e+10,2,22)}}else if(t.fillStyle="#6D6D72",t.font="12px -apple-system, sans-serif",t.textBaseline="top",t.fillText(this.label,this.x,this.y),t.strokeStyle=this.error?"#FF3B30":this.focused?"#007AFF":"#C7C7CC",t.lineWidth=1,t.beginPath(),this.roundRect(t,this.x,e,this.width,42,10),t.stroke(),t.fillStyle=this.value?"#000":"#8E8E93",t.font="".concat(this.fontSize,"px -apple-system, sans-serif"),t.textBaseline="middle",t.fillText(this.value||this.placeholder,this.x+12,e+21),this.focused&&this.cursorVisible){var i=t.measureText(this.value).width;t.fillStyle="#007AFF",t.fillRect(this.x+12+i+2,e+10,2,22)}t.restore()}}])&&Re(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(k);function He(t){return He="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},He(t)}function ze(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function qe(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?ze(Object(n),!0).forEach(function(e){Ue(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ze(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function Ue(t,e,n){return(e=Ve(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ne(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ve(r.key),r)}}function Ve(t){var e=function(t){if("object"!=He(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=He(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==He(e)?e:e+""}function Ge(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ge=function(){return!!t})()}function Ye(){return Ye="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Xe(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},Ye.apply(null,arguments)}function Xe(t){return Xe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Xe(t)}function Qe(t,e){return Qe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Qe(t,e)}const Ke=function(t){function e(t){var n,r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var o=(null===(n=i.options)||void 0===n?void 0:n.length)||0,a=Math.min(400,Math.max(200,50*o+100));return(r=function(t,e,n){return e=Xe(e),function(t,e){if(e&&("object"==He(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Ge()?Reflect.construct(e,n||[],Xe(t).constructor):e.apply(t,n))}(this,e,[t,qe({title:i.title||"Sélectionner une option",width:Math.min(350,t.width-40),height:a,showCloseButton:!0,closeOnOverlayClick:!0,padding:0},i)])).options=i.options||[],r.selectedIndex=i.selectedIndex||0,r.onSelect=i.onSelect,r.itemHeight=50,r.hoveredIndex=-1,r.opacity=1,r.scale=1,r.isVisible=!0,r.visible=!0,r.onPress=r.handlePress.bind(r),r.onMove=r.handleMove.bind(r),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Qe(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t){if(this.isVisible){t.save(),t.globalAlpha=this.opacity,t.fillStyle="rgba(0, 0, 0, 0.5)",t.fillRect(0,0,this.framework.width,this.framework.height);var e=(this.framework.width-this.modalWidth)/2,n=(this.framework.height-this.modalHeight)/2;t.fillStyle="#FFFFFF",t.shadowColor="rgba(0, 0, 0, 0.3)",t.shadowBlur=20,t.shadowOffsetY=10,t.beginPath(),this.roundRect(t,e,n,this.modalWidth,this.modalHeight,12),t.fill(),t.shadowColor="transparent",this.title&&(t.fillStyle="#000000",t.font="bold 18px -apple-system, sans-serif",t.textAlign="center",t.textBaseline="middle",t.fillText(this.title,e+this.modalWidth/2,n+30),t.strokeStyle="#E0E0E0",t.lineWidth=1,t.beginPath(),t.moveTo(e,n+50),t.lineTo(e+this.modalWidth,n+50),t.stroke());var r=e,i=n+55,o=this.modalHeight-55;t.save(),t.beginPath(),t.rect(r,i,this.modalWidth,o),t.clip();for(var a=0;a<this.options.length;a++){var s=i+a*this.itemHeight;s+this.itemHeight<i||s>i+o||(a===this.selectedIndex&&(t.fillStyle="material"===this.framework.platform?"rgba(98, 0, 238, 0.1)":"rgba(0, 122, 255, 0.1)",t.fillRect(r,s,this.modalWidth,this.itemHeight)),this.hoveredIndex===a&&(t.fillStyle="#F5F5F5",t.fillRect(r,s,this.modalWidth,this.itemHeight)),t.fillStyle=a===this.selectedIndex?"material"===this.framework.platform?"#6200EE":"#007AFF":"#000000",t.font=a===this.selectedIndex?"bold 16px -apple-system, sans-serif":"16px -apple-system, sans-serif",t.textAlign="left",t.textBaseline="middle",t.fillText(this.options[a],r+20,s+this.itemHeight/2),a<this.options.length-1&&(t.strokeStyle="#E0E0E0",t.lineWidth=1,t.beginPath(),t.moveTo(r+20,s+this.itemHeight),t.lineTo(r+this.modalWidth-20,s+this.itemHeight),t.stroke()))}t.restore(),t.restore()}}},{key:"handlePress",value:function(t,n){for(var r,i,o,a=(this.framework.width-this.modalWidth)/2,s=(this.framework.height-this.modalHeight)/2+55,l=0;l<this.options.length;l++){var u=s+l*this.itemHeight;if(n>=u&&n<=u+this.itemHeight&&t>=a&&t<=a+this.modalWidth)return this.selectedIndex=l,this.onSelect&&this.onSelect(l,this.options[l]),void this.hide()}(r=e,i=this,"function"==typeof(o=Ye(Xe(1&3?r.prototype:r),"handlePress",i))?function(t){return o.apply(i,t)}:o)([t,n])}},{key:"handleMove",value:function(t,e){var n=(this.framework.width-this.modalWidth)/2,r=(this.framework.height-this.modalHeight)/2+55;this.hoveredIndex=-1;for(var i=0;i<this.options.length;i++){var o=r+i*this.itemHeight;if(e>=o&&e<=o+this.itemHeight&&t>=n&&t<=n+this.modalWidth){this.hoveredIndex=i;break}}}},{key:"isPointInside",value:function(t,e){var n=(this.framework.width-this.modalWidth)/2,r=(this.framework.height-this.modalHeight)/2;return t>=n&&t<=n+this.modalWidth&&e>=r&&e<=r+this.modalHeight}},{key:"show",value:function(){this.isVisible=!0,this.visible=!0,this.opacity=1,this.scale=1}}],r&&Ne(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(vt);function $e(t){return $e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$e(t)}function Je(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function Ze(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Je(Object(n),!0).forEach(function(e){tn(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Je(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function tn(t,e,n){return(e=nn(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function en(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,nn(r.key),r)}}function nn(t){var e=function(t){if("object"!=$e(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=$e(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==$e(e)?e:e+""}function rn(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(rn=function(){return!!t})()}function on(t,e,n,r){var i=an(sn(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof i?function(t){return i.apply(n,t)}:i}function an(){return an="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=sn(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},an.apply(null,arguments)}function sn(t){return sn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},sn(t)}function ln(t,e){return ln=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ln(t,e)}const un=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=sn(e),function(t,e){if(e&&("object"==$e(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,rn()?Reflect.construct(e,n||[],sn(t).constructor):e.apply(t,n))}(this,e,[t,Ze({placeholder:r.placeholder||"Rechercher..."},r)])).onSearch=r.onSearch,n.onClear=r.onClear,n.searchIcon=r.searchIcon||"🔍",n.clearIcon="×",n.showClearButton=!1,n.handleKeyDown=n.handleKeyDown.bind(n),n.handleClearClick=n.handleClearClick.bind(n),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ln(t,e)}(e,t),n=e,r=[{key:"setupHiddenInput",value:function(){this.hiddenInput||(on(e,"setupHiddenInput",this,3)([]),this.hiddenInput&&this.hiddenInput.addEventListener("keydown",this.handleKeyDown))}},{key:"handleKeyDown",value:function(t){"Enter"===t.key&&this.onSearch&&this.onSearch(this.value)}},{key:"handleClearClick",value:function(){var t=this.value.length>0;this.value="",this.hiddenInput&&(this.hiddenInput.value=""),t&&this.onClear&&this.onClear(),this.showClearButton=!1,this.onFocus()}},{key:"onInputUpdate",value:function(){var t=this;this.showClearButton=this.value.length>0,this.value.length>0&&this.onSearch&&(clearTimeout(this._searchTimeout),this._searchTimeout=setTimeout(function(){t.onSearch&&t.onSearch(t.value)},300))}},{key:"onClick",value:function(){this.showClearButton&&this.isPointInClearButton(this.lastClickX,this.lastClickY)?this.handleClearClick():on(e,"onFocus",this,3)([])}},{key:"onFocus",value:function(){on(e,"onFocus",this,3)([]),this.showClearButton=this.value.length>0}},{key:"onPress",value:function(t,n){this.lastClickX=t,this.lastClickY=n,on(e,"onPress",this,3)([t,n])}},{key:"isPointInClearButton",value:function(t,e){if(!this.showClearButton)return!1;var n=.6*this.height,r=this.x+this.width-n-10,i=this.y+(this.height-n)/2;return t>=r&&t<=r+n&&e>=i&&e<=i+n}},{key:"draw",value:function(t){t.save(),"material"===this.platform?(t.strokeStyle=this.focused?"#6200EE":"#CCCCCC",t.lineWidth=this.focused?2:1,t.beginPath(),t.moveTo(this.x,this.y+this.height),t.lineTo(this.x+this.width,this.y+this.height),t.stroke()):(t.fillStyle=this.focused?"#FFFFFF":"#F2F2F7",t.strokeStyle=this.focused?"#007AFF":"#C7C7CC",t.lineWidth=1,t.beginPath(),this.roundRect(t,this.x,this.y,this.width,this.height,10),t.fill(),t.stroke()),t.fillStyle="#999999",t.font="".concat(this.fontSize,"px -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif"),t.textAlign="center",t.textBaseline="middle",t.fillText(this.searchIcon,this.x+25,this.y+this.height/2),t.fillStyle=this.value?"#000000":"#999999",t.font="".concat(this.fontSize,"px -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif"),t.textAlign="left",t.textBaseline="middle";var e=this.showClearButton?50:20,n=this.width-50-e,r=this.value||this.placeholder,i=t.measureText(r).width;if(i>n){for(;i>n&&r.length>0;)r=r.substring(0,r.length-1),i=t.measureText(r+"...").width;r.length>0&&(r+="...")}if(this.value||(t.fillStyle="#999999"),t.fillText(r,this.x+50,this.y+this.height/2),this.showClearButton){var o=.6*this.height,a=this.x+this.width-o-15,s=this.y+(this.height-o)/2;t.fillStyle="#E0E0E0",t.beginPath(),t.arc(a+o/2,s+o/2,o/2,0,2*Math.PI),t.fill(),t.fillStyle="#666666",t.font="bold ".concat(.6*o,"px -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif"),t.textAlign="center",t.textBaseline="middle",t.fillText(this.clearIcon,a+o/2,s+o/2)}if(this.focused&&this.cursorVisible&&this.value){var l=t.measureText(this.value).width,u=this.x+50+Math.min(l,n);t.fillStyle="#000000",t.fillRect(u,this.y+10,2,this.height-20)}t.restore()}},{key:"isPointInside",value:function(t,e){var n=t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height,r=this.isPointInClearButton(t,e);return n||r}},{key:"destroy",value:function(){this._searchTimeout&&clearTimeout(this._searchTimeout),this.hiddenInput&&this.hiddenInput.removeEventListener("keydown",this.handleKeyDown),on(e,"destroy",this,3)([])}}],r&&en(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(k);function cn(t){return cn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},cn(t)}function hn(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return fn(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?fn(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function fn(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function dn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,wn(r.key),r)}}function pn(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(pn=function(){return!!t})()}function yn(t,e,n,r){var i=vn(mn(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof i?function(t){return i.apply(n,t)}:i}function vn(){return vn="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=mn(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},vn.apply(null,arguments)}function mn(t){return mn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},mn(t)}function gn(t,e){return gn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},gn(t,e)}function bn(t,e,n){return(e=wn(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function wn(t){var e=function(t){if("object"!=cn(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=cn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==cn(e)?e:e+""}var xn=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=mn(e),function(t,e){if(e&&("object"==cn(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,pn()?Reflect.construct(e,n||[],mn(t).constructor):e.apply(t,n))}(this,e,[t,r])).placeholder=r.placeholder||"Mot de passe",n.value=r.value||"",n.maskChar=r.maskChar||"•",n.showPassword=r.showPassword||!1,n.fontSize=r.fontSize||16,n.focused=!1,n.platform=t.platform,n.cursorVisible=!0,n.cursorPosition=n.value.length,n.displayedValue=n.getDisplayedValue(),n.toggleButtonSize=24,n.toggleButtonPadding=10,n.onFocus=n.onFocus.bind(n),n.onBlur=n.onBlur.bind(n),n.onTogglePassword=n.onTogglePassword.bind(n),e.allInputs.add(n),n.cursorInterval=setInterval(function(){n.focused&&(n.cursorVisible=!n.cursorVisible)},500),n.setupGlobalClickHandler(),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&gn(t,e)}(e,t),n=e,r=[{key:"getDisplayedValue",value:function(){return this.showPassword?this.value:this.maskChar.repeat(this.value.length)}},{key:"onTogglePassword",value:function(){this.showPassword=!this.showPassword,this.displayedValue=this.getDisplayedValue()}},{key:"isPointOnToggleButton",value:function(t,e){var n=this.x+this.width-this.toggleButtonSize-this.toggleButtonPadding,r=this.y+(this.height-this.toggleButtonSize)/2;return t>=n&&t<=n+this.toggleButtonSize&&e>=r&&e<=r+this.toggleButtonSize}},{key:"setupGlobalClickHandler",value:function(){e.globalClickHandler||(e.globalClickHandler=function(t){var n,r=!1,i=hn(e.allInputs);try{for(i.s();!(n=i.n()).done;){var o=n.value;if(o.hiddenInput&&t.target===o.hiddenInput){r=!0;break}}}catch(t){i.e(t)}finally{i.f()}r||e.removeAllHiddenInputs()},document.addEventListener("click",e.globalClickHandler,!0),document.addEventListener("touchstart",e.globalClickHandler,!0))}},{key:"setupHiddenInput",value:function(){var t=this;this.hiddenInput||(this.hiddenInput=document.createElement("input"),this.hiddenInput.style.position="fixed",this.hiddenInput.type=this.showPassword?"text":"password",this.hiddenInput.style.opacity="0",this.hiddenInput.style.pointerEvents="none",this.hiddenInput.style.top="-100px",this.hiddenInput.style.zIndex="9999",document.body.appendChild(this.hiddenInput),this.hiddenInput.addEventListener("input",function(e){t.focused&&(t.value=e.target.value,t.cursorPosition=t.value.length,t.displayedValue=t.getDisplayedValue())}),this.hiddenInput.addEventListener("blur",function(){t.focused=!1,t.cursorVisible=!1,setTimeout(function(){t.destroyHiddenInput()},100)}))}},{key:"onFocus",value:function(){var t=this;if(e.activeInput!==this){e.removeAllHiddenInputs();var n,r=hn(e.allInputs);try{for(r.s();!(n=r.n()).done;){var i=n.value;i!==this&&(i.focused=!1,i.cursorVisible=!1)}}catch(t){r.e(t)}finally{r.f()}if(this.focused=!0,this.cursorVisible=!0,e.activeInput=this,this.setupHiddenInput(),this.hiddenInput){this.hiddenInput.value=this.value,this.hiddenInput.type=this.showPassword?"text":"password";var o=this.y+this.framework.scrollOffset;this.hiddenInput.style.top="".concat(o,"px"),setTimeout(function(){t.hiddenInput&&t.focused&&(t.hiddenInput.focus(),t.hiddenInput.setSelectionRange(t.value.length,t.value.length))},50)}}}},{key:"onBlur",value:function(){this.focused=!1,this.cursorVisible=!1}},{key:"destroyHiddenInput",value:function(){this.hiddenInput&&this.hiddenInput.parentNode&&(this.hiddenInput.parentNode.removeChild(this.hiddenInput),this.hiddenInput=null)}},{key:"onClick",value:function(){this.onFocus()}},{key:"onToggleButtonClick",value:function(){var t=this;this.onTogglePassword(),this.hiddenInput&&(this.hiddenInput.type=this.showPassword?"text":"password",this.focused&&setTimeout(function(){t.hiddenInput&&t.hiddenInput.focus()},10))}},{key:"isPointInside",value:function(t,e){return t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height}},{key:"draw",value:function(t){t.save(),"material"===this.platform?(t.strokeStyle=this.focused?"#6200EE":"#CCCCCC",t.lineWidth=this.focused?2:1,t.beginPath(),t.moveTo(this.x,this.y+this.height),t.lineTo(this.x+this.width,this.y+this.height),t.stroke()):(t.strokeStyle=this.focused?"#007AFF":"#C7C7CC",t.lineWidth=1,t.beginPath(),this.roundRect(t,this.x,this.y,this.width,this.height,8),t.stroke()),t.fillStyle=this.value?"#000000":"#999999",t.font="".concat(this.fontSize,"px -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif"),t.textAlign="left",t.textBaseline="middle";var e=this.displayedValue||this.placeholder,n=this.width-20-this.toggleButtonSize-this.toggleButtonPadding,r=e;if(t.measureText(e).width>n)for(var i=e.length;i>0;i--){var o=e.substring(0,i)+"...";if(t.measureText(o).width<=n){r=o;break}}if(t.fillText(r,this.x+10,this.y+this.height/2),this.focused&&this.cursorVisible&&this.displayedValue){var a=t.measureText(r).width;t.fillStyle="#000000",t.fillRect(this.x+10+a,this.y+10,2,this.height-20)}this.drawToggleButton(t),t.restore()}},{key:"drawToggleButton",value:function(t){var e=this.x+this.width-this.toggleButtonSize-this.toggleButtonPadding,n=this.y+(this.height-this.toggleButtonSize)/2;t.fillStyle="#F0F0F0",t.beginPath(),t.arc(e+this.toggleButtonSize/2,n+this.toggleButtonSize/2,this.toggleButtonSize/2,0,2*Math.PI),t.fill(),t.strokeStyle="#666666",t.lineWidth=2,t.beginPath(),this.showPassword?(t.arc(e+this.toggleButtonSize/2,n+this.toggleButtonSize/2,this.toggleButtonSize/4,0,2*Math.PI),t.stroke(),t.fillStyle="#666666",t.beginPath(),t.arc(e+this.toggleButtonSize/2,n+this.toggleButtonSize/2,this.toggleButtonSize/8,0,2*Math.PI),t.fill(),t.beginPath(),t.moveTo(e+5,n+5),t.lineTo(e+this.toggleButtonSize-5,n+this.toggleButtonSize-5),t.stroke()):(t.arc(e+this.toggleButtonSize/2,n+this.toggleButtonSize/2,this.toggleButtonSize/4,0,2*Math.PI),t.stroke(),t.fillStyle="#666666",t.beginPath(),t.arc(e+this.toggleButtonSize/2,n+this.toggleButtonSize/2,this.toggleButtonSize/8,0,2*Math.PI),t.fill())}},{key:"roundRect",value:function(t,e,n,r,i,o){t.moveTo(e+o,n),t.lineTo(e+r-o,n),t.quadraticCurveTo(e+r,n,e+r,n+o),t.lineTo(e+r,n+i-o),t.quadraticCurveTo(e+r,n+i,e+r-o,n+i),t.lineTo(e+o,n+i),t.quadraticCurveTo(e,n+i,e,n+i-o),t.lineTo(e,n+o),t.quadraticCurveTo(e,n,e+o,n)}},{key:"destroy",value:function(){this.destroyHiddenInput(),this.cursorInterval&&clearInterval(this.cursorInterval),e.allInputs.delete(this),0===e.allInputs.size&&e.globalClickHandler&&(document.removeEventListener("click",e.globalClickHandler,!0),document.removeEventListener("touchstart",e.globalClickHandler,!0),e.globalClickHandler=null),yn(e,"destroy",this,1)&&yn(e,"destroy",this,3)([])}}],i=[{key:"removeAllHiddenInputs",value:function(){var t,n=hn(e.allInputs);try{for(n.s();!(t=n.n()).done;){var r=t.value;r.focused=!1,r.cursorVisible=!1,r.hiddenInput&&r.hiddenInput.parentNode&&(r.hiddenInput.parentNode.removeChild(r.hiddenInput),r.hiddenInput=null)}}catch(t){n.e(t)}finally{n.f()}e.activeInput=null}}],r&&dn(n.prototype,r),i&&dn(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i}(u);bn(xn,"activeInput",null),bn(xn,"allInputs",new Set),bn(xn,"globalClickHandler",null);const kn=xn;function Sn(t){return Sn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Sn(t)}function Tn(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=On(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function Pn(t){return function(t){if(Array.isArray(t))return Cn(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||On(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function On(t,e){if(t){if("string"==typeof t)return Cn(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Cn(t,e):void 0}}function Cn(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function En(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,_n(r.key),r)}}function jn(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(jn=function(){return!!t})()}function In(t,e,n,r){var i=Fn(Rn(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof i?function(t){return i.apply(n,t)}:i}function Fn(){return Fn="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Rn(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},Fn.apply(null,arguments)}function Rn(t){return Rn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Rn(t)}function Mn(t,e){return Mn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Mn(t,e)}function An(t,e,n){return(e=_n(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _n(t){var e=function(t){if("object"!=Sn(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Sn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Sn(e)?e:e+""}var Dn=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=Rn(e),function(t,e){if(e&&("object"==Sn(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,jn()?Reflect.construct(e,n||[],Rn(t).constructor):e.apply(t,n))}(this,e,[t,r])).placeholder=r.placeholder||"Ajouter des tags...",n.value=r.value||"",n.tags=Array.isArray(r.tags)?Pn(r.tags):[],n.fontSize=r.fontSize||16,n.focused=!1,n.platform=t.platform,n.cursorVisible=!0,n.cursorPosition=n.value.length,n.tagPadding=r.tagPadding||8,n.tagSpacing=r.tagSpacing||6,n.tagColor=r.tagColor||"#E0E0E0",n.tagTextColor=r.tagTextColor||"#333333",n.deleteButtonColor=r.deleteButtonColor||"#666666",n.onTagAdd=r.onTagAdd||function(){},n.onTagRemove=r.onTagRemove||function(){},n.tagHeight=n.fontSize+2*n.tagPadding,n.deleteButtonSize=.8*n.fontSize,n.onFocus=n.onFocus.bind(n),n.onBlur=n.onBlur.bind(n),e.allInputs.add(n),n.cursorInterval=setInterval(function(){n.focused&&(n.cursorVisible=!n.cursorVisible)},500),n.setupGlobalClickHandler(),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Mn(t,e)}(e,t),n=e,r=[{key:"setupGlobalClickHandler",value:function(){e.globalClickHandler||(e.globalClickHandler=function(t){var n,r=!1,i=Tn(e.allInputs);try{for(i.s();!(n=i.n()).done;){var o=n.value;if(o.hiddenInput&&t.target===o.hiddenInput){r=!0;break}}}catch(t){i.e(t)}finally{i.f()}r||e.removeAllHiddenInputs()},document.addEventListener("click",e.globalClickHandler,!0),document.addEventListener("touchstart",e.globalClickHandler,!0))}},{key:"setupHiddenInput",value:function(){var t=this;this.hiddenInput||(this.hiddenInput=document.createElement("input"),this.hiddenInput.style.position="fixed",this.hiddenInput.style.opacity="0",this.hiddenInput.style.pointerEvents="none",this.hiddenInput.style.top="-100px",this.hiddenInput.style.zIndex="9999",document.body.appendChild(this.hiddenInput),this.hiddenInput.addEventListener("input",function(e){t.focused&&(t.value=e.target.value,t.cursorPosition=t.value.length)}),this.hiddenInput.addEventListener("keydown",function(e){"Enter"===e.key||","===e.key?(e.preventDefault(),t.addCurrentTag()):"Backspace"===e.key&&""===t.value&&t.tags.length>0&&t.removeLastTag()}),this.hiddenInput.addEventListener("blur",function(){""!==t.value.trim()&&t.addCurrentTag(),t.focused=!1,t.cursorVisible=!1,setTimeout(function(){t.destroyHiddenInput()},100)}))}},{key:"addCurrentTag",value:function(){var t=this.value.trim();""===t||this.tags.includes(t)||(this.tags.push(t),this.value="",this.cursorPosition=0,this.hiddenInput&&(this.hiddenInput.value=""),this.onTagAdd(t,this.tags))}},{key:"addTag",value:function(t){var e=t.trim();""===e||this.tags.includes(e)||(this.tags.push(e),this.onTagAdd(e,this.tags))}},{key:"removeTag",value:function(t){if(t>=0&&t<this.tags.length){var e=this.tags[t];this.tags.splice(t,1),this.onTagRemove(e,this.tags)}}},{key:"removeLastTag",value:function(){this.tags.length>0&&this.removeTag(this.tags.length-1)}},{key:"clearTags",value:function(){var t=this,e=Pn(this.tags);this.tags=[],e.forEach(function(e){return t.onTagRemove(e,t.tags)})}},{key:"getTagIndexAtPoint",value:function(t,e){for(var n=this.x+10,r=this.y+10,i=0;i<this.tags.length;i++){var o=this.tags[i],a=this.measureTagWidth(o);if(t>=n&&t<=n+a&&e>=r&&e<=r+this.tagHeight)return i;n+=a+this.tagSpacing}return null}},{key:"getDeleteButtonIndexAtPoint",value:function(t,e){for(var n=this.x+10,r=this.y+10,i=0;i<this.tags.length;i++){var o=this.tags[i],a=this.measureTagWidth(o),s=n+a-this.deleteButtonSize-this.tagPadding/2,l=r+(this.tagHeight-this.deleteButtonSize)/2;if(t>=s&&t<=s+this.deleteButtonSize&&e>=l&&e<=l+this.deleteButtonSize)return i;n+=a+this.tagSpacing}return null}},{key:"measureTagWidth",value:function(t){return t.length*(.6*this.fontSize)+2*this.tagPadding+this.deleteButtonSize+this.tagPadding/2}},{key:"onFocus",value:function(){var t=this;if(e.activeInput!==this){e.removeAllHiddenInputs();var n,r=Tn(e.allInputs);try{for(r.s();!(n=r.n()).done;){var i=n.value;i!==this&&(i.focused=!1,i.cursorVisible=!1)}}catch(t){r.e(t)}finally{r.f()}if(this.focused=!0,this.cursorVisible=!0,e.activeInput=this,this.setupHiddenInput(),this.hiddenInput){this.hiddenInput.value=this.value;var o=this.y+this.framework.scrollOffset;this.hiddenInput.style.top="".concat(o,"px"),setTimeout(function(){t.hiddenInput&&t.focused&&(t.hiddenInput.focus(),t.hiddenInput.setSelectionRange(t.value.length,t.value.length))},50)}}}},{key:"onBlur",value:function(){this.focused=!1,this.cursorVisible=!1}},{key:"destroyHiddenInput",value:function(){this.hiddenInput&&this.hiddenInput.parentNode&&(this.hiddenInput.parentNode.removeChild(this.hiddenInput),this.hiddenInput=null)}},{key:"onClick",value:function(t,e){var n=this.getDeleteButtonIndexAtPoint(t,e);return null!==n?(this.removeTag(n),!0):!(null===this.getTagIndexAtPoint(t,e)&&!this.isPointInside(t,e)||(this.onFocus(),0))}},{key:"isPointInside",value:function(t,e){return t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height}},{key:"getCursorXPosition",value:function(){var t,e=this.x+10,n=Tn(this.tags);try{for(n.s();!(t=n.n()).done;){var r=t.value;e+=this.measureTagWidth(r)+this.tagSpacing}}catch(t){n.e(t)}finally{n.f()}return e+this.value.length*(.6*this.fontSize)}},{key:"updateHeight",value:function(){for(var t=this.x+this.width-10,e=this.x+10,n=(this.y,1),r=0;r<this.tags.length;r++){var i=this.measureTagWidth(this.tags[r]);e+i>t&&(e=this.x+10,this.tagHeight,this.tagSpacing,n++),e+=i+this.tagSpacing}e+this.value.length*(.6*this.fontSize)>t&&n++,this.height=Math.max(n*(this.tagHeight+this.tagSpacing)+10,40)}},{key:"draw",value:function(t){this.updateHeight(),t.save(),"material"===this.platform?(t.strokeStyle=this.focused?"#6200EE":"#CCCCCC",t.lineWidth=this.focused?2:1,t.beginPath(),t.moveTo(this.x,this.y+this.height),t.lineTo(this.x+this.width,this.y+this.height),t.stroke()):(t.strokeStyle=this.focused?"#007AFF":"#C7C7CC",t.lineWidth=1,t.beginPath(),this.roundRect(t,this.x,this.y,this.width,this.height,8),t.stroke());for(var e=this.x+10,n=this.y+10,r=this.x+this.width-10,i=0;i<this.tags.length;i++){var o=this.measureTagWidth(this.tags[i]);e+o>r&&(e=this.x+10,n+=this.tagHeight+this.tagSpacing),this.drawTag(t,this.tags[i],e,n),e+=o+this.tagSpacing}if(this.value||this.focused&&0===this.tags.length){t.fillStyle=this.value?"#000000":"#999999",t.font="".concat(this.fontSize,"px -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif"),t.textAlign="left",t.textBaseline="middle";var a=this.value||this.placeholder,s=n+this.tagHeight/2;if(t.fillText(a,e,s),this.focused&&this.cursorVisible){var l=t.measureText(this.value).width;t.fillStyle="#000000",t.fillRect(e+l,s-this.fontSize/2,2,this.fontSize)}}t.restore()}},{key:"drawTag",value:function(t,e,n,r){var i=this.measureTagWidth(e);t.fillStyle=this.tagColor,this.roundRect(t,n,r,i,this.tagHeight,this.tagHeight/2),t.fill(),t.fillStyle=this.tagTextColor,t.font="".concat(this.fontSize,"px -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif"),t.textAlign="left",t.textBaseline="middle";var o=n+this.tagPadding,a=r+this.tagHeight/2,s=i-2*this.tagPadding-this.deleteButtonSize-this.tagPadding/2,l=e;if(t.measureText(e).width>s)for(var u=e.length;u>0;u--){var c=e.substring(0,u)+"...";if(t.measureText(c).width<=s){l=c;break}}t.fillText(l,o,a);var h=n+i-this.deleteButtonSize-this.tagPadding/2,f=r+(this.tagHeight-this.deleteButtonSize)/2;t.strokeStyle=this.deleteButtonColor,t.lineWidth=2,t.beginPath();var d=h+this.deleteButtonSize/2,p=f+this.deleteButtonSize/2,y=this.deleteButtonSize/3;t.moveTo(d-y,p-y),t.lineTo(d+y,p+y),t.moveTo(d+y,p-y),t.lineTo(d-y,p+y),t.stroke()}},{key:"roundRect",value:function(t,e,n,r,i,o){t.roundRect?t.roundRect(e,n,r,i,o):(t.beginPath(),t.moveTo(e+o,n),t.lineTo(e+r-o,n),t.quadraticCurveTo(e+r,n,e+r,n+o),t.lineTo(e+r,n+i-o),t.quadraticCurveTo(e+r,n+i,e+r-o,n+i),t.lineTo(e+o,n+i),t.quadraticCurveTo(e,n+i,e,n+i-o),t.lineTo(e,n+o),t.quadraticCurveTo(e,n,e+o,n),t.closePath())}},{key:"destroy",value:function(){this.destroyHiddenInput(),this.cursorInterval&&clearInterval(this.cursorInterval),e.allInputs.delete(this),0===e.allInputs.size&&e.globalClickHandler&&(document.removeEventListener("click",e.globalClickHandler,!0),document.removeEventListener("touchstart",e.globalClickHandler,!0),e.globalClickHandler=null),In(e,"destroy",this,1)&&In(e,"destroy",this,3)([])}}],i=[{key:"removeAllHiddenInputs",value:function(){var t,n=Tn(e.allInputs);try{for(n.s();!(t=n.n()).done;){var r=t.value;r.focused=!1,r.cursorVisible=!1,r.hiddenInput&&r.hiddenInput.parentNode&&(r.hiddenInput.parentNode.removeChild(r.hiddenInput),r.hiddenInput=null)}}catch(t){n.e(t)}finally{n.f()}e.activeInput=null}}],r&&En(n.prototype,r),i&&En(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i}(u);An(Dn,"activeInput",null),An(Dn,"allInputs",new Set),An(Dn,"globalClickHandler",null);const Bn=Dn;function Ln(t){return Ln="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ln(t)}function Wn(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=zn(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function Hn(t){return function(t){if(Array.isArray(t))return qn(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||zn(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function zn(t,e){if(t){if("string"==typeof t)return qn(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?qn(t,e):void 0}}function qn(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Un(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Kn(r.key),r)}}function Nn(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Nn=function(){return!!t})()}function Vn(t,e,n,r){var i=Gn(Yn(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof i?function(t){return i.apply(n,t)}:i}function Gn(){return Gn="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Yn(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},Gn.apply(null,arguments)}function Yn(t){return Yn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Yn(t)}function Xn(t,e){return Xn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Xn(t,e)}function Qn(t,e,n){return(e=Kn(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Kn(t){var e=function(t){if("object"!=Ln(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ln(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ln(e)?e:e+""}var $n=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=Yn(e),function(t,e){if(e&&("object"==Ln(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Nn()?Reflect.construct(e,n||[],Yn(t).constructor):e.apply(t,n))}(this,e,[t,r])).placeholder=r.placeholder||"",n.value=r.value||"",n.options=Array.isArray(r.options)?Hn(r.options):[],n.filteredOptions=[],n.fontSize=r.fontSize||16,n.focused=!1,n.platform=t.platform,n.cursorVisible=!0,n.cursorPosition=n.value.length,n.selectedIndex=-1,n.showDropdown=!1,n.maxDropdownItems=r.maxDropdownItems||5,n.dropdownItemHeight=n.fontSize+16,n.dropdownBackground=r.dropdownBackground||"#FFFFFF",n.hoverBackground=r.hoverBackground||"#F5F5F5",n.borderColor=r.borderColor||"#E0E0E0",n.selectedBackground=r.selectedBackground||"#E3F2FD",n.onSelect=r.onSelect||function(){},n.onInput=r.onInput||function(){},n.onFocus=n.onFocus.bind(n),n.onBlur=n.onBlur.bind(n),n.filterOptions=n.filterOptions.bind(n),e.allInputs.add(n),n.cursorInterval=setInterval(function(){n.focused&&(n.cursorVisible=!n.cursorVisible)},500),n.setupGlobalClickHandler(),n.value&&n.filterOptions(n.value),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Xn(t,e)}(e,t),n=e,r=[{key:"setupGlobalClickHandler",value:function(){e.globalClickHandler||(e.globalClickHandler=function(t){var n,r=!1,i=Wn(e.allInputs);try{for(i.s();!(n=i.n()).done;){var o=n.value;if(o.hiddenInput&&t.target===o.hiddenInput){r=!0;break}}}catch(t){i.e(t)}finally{i.f()}r||e.removeAllHiddenInputs()},document.addEventListener("click",e.globalClickHandler,!0),document.addEventListener("touchstart",e.globalClickHandler,!0))}},{key:"setupHiddenInput",value:function(){var t=this;this.hiddenInput||(this.hiddenInput=document.createElement("input"),this.hiddenInput.style.position="fixed",this.hiddenInput.type="text",this.hiddenInput.style.opacity="0",this.hiddenInput.style.pointerEvents="none",this.hiddenInput.style.top="-100px",this.hiddenInput.style.zIndex="9999",document.body.appendChild(this.hiddenInput),this.hiddenInput.addEventListener("input",function(e){t.focused&&(t.value=e.target.value,t.cursorPosition=t.value.length,t.filterOptions(t.value),t.onInput(t.value))}),this.hiddenInput.addEventListener("keydown",function(e){switch(e.key){case"ArrowDown":e.preventDefault(),t.selectNextOption();break;case"ArrowUp":e.preventDefault(),t.selectPreviousOption();break;case"Enter":e.preventDefault(),t.selectCurrentOption();break;case"Escape":e.preventDefault(),t.hideDropdown(),t.hiddenInput&&setTimeout(function(){return t.hiddenInput.focus()},10);break;case"Tab":t.selectCurrentOption()}}),this.hiddenInput.addEventListener("blur",function(){setTimeout(function(){t.isDropdownActive||(t.focused=!1,t.cursorVisible=!1,t.hideDropdown(),setTimeout(function(){t.destroyHiddenInput()},100))},300)}))}},{key:"isDropdownActive",get:function(){return!1}},{key:"filterOptions",value:function(t){var e=t.toLowerCase();this.filteredOptions=""===t?Hn(this.options):this.options.filter(function(t){return t.toLowerCase().includes(e)}),this.selectedIndex=this.filteredOptions.length>0?0:-1,this.showDropdown=this.filteredOptions.length>0&&this.focused}},{key:"selectNextOption",value:function(){0!==this.filteredOptions.length&&(this.selectedIndex=(this.selectedIndex+1)%this.filteredOptions.length,this.ensureSelectedVisible())}},{key:"selectPreviousOption",value:function(){0!==this.filteredOptions.length&&(this.selectedIndex=this.selectedIndex<=0?this.filteredOptions.length-1:this.selectedIndex-1,this.ensureSelectedVisible())}},{key:"ensureSelectedVisible",value:function(){this.selectedIndex>=this.filteredOptions.length&&(this.selectedIndex=this.filteredOptions.length-1)}},{key:"selectCurrentOption",value:function(){if(this.selectedIndex>=0&&this.selectedIndex<this.filteredOptions.length){var t=this.filteredOptions[this.selectedIndex];this.value=t,this.hiddenInput&&(this.hiddenInput.value=t),this.filterOptions(t),this.onSelect(t),this.hideDropdown()}}},{key:"hideDropdown",value:function(){this.showDropdown=!1,this.selectedIndex=-1}},{key:"addOption",value:function(t){this.options.includes(t)||(this.options.push(t),this.filterOptions(this.value))}},{key:"removeOption",value:function(t){var e=this.options.indexOf(t);e>-1&&(this.options.splice(e,1),this.filterOptions(this.value))}},{key:"setOptions",value:function(t){this.options=Array.isArray(t)?Hn(t):[],this.filterOptions(this.value)}},{key:"onFocus",value:function(){var t=this;if(e.activeInput!==this){e.removeAllHiddenInputs();var n,r=Wn(e.allInputs);try{for(r.s();!(n=r.n()).done;){var i=n.value;i!==this&&(i.focused=!1,i.cursorVisible=!1,i.hideDropdown())}}catch(t){r.e(t)}finally{r.f()}if(this.focused=!0,this.cursorVisible=!0,e.activeInput=this,this.filterOptions(this.value),this.showDropdown=this.filteredOptions.length>0,this.setupHiddenInput(),this.hiddenInput){this.hiddenInput.value=this.value;var o=this.y+this.framework.scrollOffset;this.hiddenInput.style.top="".concat(o,"px"),setTimeout(function(){t.hiddenInput&&t.focused&&(t.hiddenInput.focus(),t.hiddenInput.setSelectionRange(t.value.length,t.value.length))},50)}}}},{key:"onBlur",value:function(){this.focused=!1,this.cursorVisible=!1}},{key:"destroyHiddenInput",value:function(){this.hiddenInput&&this.hiddenInput.parentNode&&(this.hiddenInput.parentNode.removeChild(this.hiddenInput),this.hiddenInput=null)}},{key:"getDropdownOptionAtPoint",value:function(t,e){if(!this.showDropdown||0===this.filteredOptions.length)return null;var n=this.y+this.height,r=Math.min(this.filteredOptions.length,this.maxDropdownItems),i=r*this.dropdownItemHeight;if(t>=this.x&&t<=this.x+this.width&&e>=n&&e<=n+i){var o=e-n,a=Math.floor(o/this.dropdownItemHeight);if(a>=0&&a<r)return a}return null}},{key:"onClick",value:function(t,e){var n=this.getDropdownOptionAtPoint(t,e);return null!==n?(this.selectedIndex=n,this.selectCurrentOption(),!0):this.isPointInside(t,e)?(this.onFocus(),!0):(this.showDropdown&&this.hideDropdown(),!1)}},{key:"isPointInside",value:function(t,e){return t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height}},{key:"draw",value:function(t){t.save(),"material"===this.platform?(t.strokeStyle=this.focused?"#6200EE":"#CCCCCC",t.lineWidth=this.focused?2:1,t.beginPath(),t.moveTo(this.x,this.y+this.height),t.lineTo(this.x+this.width,this.y+this.height),t.stroke()):(t.strokeStyle=this.focused?"#007AFF":"#C7C7CC",t.lineWidth=1,t.beginPath(),this.roundRect(t,this.x,this.y,this.width,this.height,8),t.stroke()),t.fillStyle=this.value?"#000000":"#999999",t.font="".concat(this.fontSize,"px -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif"),t.textAlign="left",t.textBaseline="middle";var e=this.value||this.placeholder,n=this.x+10,r=this.y+this.height/2,i=this.width-30,o=e;if(t.measureText(e).width>i)for(var a=e.length;a>0;a--){var s=e.substring(0,a)+"...";if(t.measureText(s).width<=i){o=s;break}}if(t.fillText(o,n,r),this.focused&&this.cursorVisible&&this.value){var l=t.measureText(o).width;t.fillStyle="#000000",t.fillRect(n+l,this.y+10,2,this.height-20)}this.options.length>0&&this.drawDropdownIcon(t),this.showDropdown&&this.filteredOptions.length>0&&this.drawDropdown(t),t.restore()}},{key:"drawDropdownIcon",value:function(t){var e=this.x+this.width-12-10,n=this.y+this.height/2-6;t.strokeStyle="#666666",t.lineWidth=2,t.beginPath(),t.moveTo(e,n+4),t.lineTo(e+6,n+8),t.lineTo(e+12,n+4),t.stroke()}},{key:"drawDropdown",value:function(t){var e=this.y+this.height,n=Math.min(this.filteredOptions.length,this.maxDropdownItems),r=n*this.dropdownItemHeight;t.save(),t.shadowColor="rgba(0, 0, 0, 0.1)",t.shadowBlur=10,t.shadowOffsetX=0,t.shadowOffsetY=2,t.fillStyle=this.dropdownBackground,this.roundRect(t,this.x,e,this.width,r,4),t.fill(),t.shadowColor="transparent",t.shadowBlur=0,t.shadowOffsetY=0,t.strokeStyle=this.borderColor,t.lineWidth=1,this.roundRect(t,this.x,e,this.width,r,4),t.stroke(),t.font="".concat(this.fontSize,"px -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif"),t.textAlign="left",t.textBaseline="middle";for(var i=0;i<n;i++){var o=e+i*this.dropdownItemHeight,a=this.dropdownItemHeight;i===this.selectedIndex&&(t.fillStyle=this.selectedBackground,t.fillRect(this.x,o,this.width,a)),i>0&&(t.strokeStyle=this.borderColor,t.lineWidth=.5,t.beginPath(),t.moveTo(this.x+10,o),t.lineTo(this.x+this.width-10,o),t.stroke()),t.fillStyle="#000000";var s=this.filteredOptions[i],l=this.x+10,u=o+a/2,c=this.width-20,h=s;if(t.measureText(s).width>c)for(var f=s.length;f>0;f--){var d=s.substring(0,f)+"...";if(t.measureText(d).width<=c){h=d;break}}if(this.value&&this.value.length>0){var p=this.value.toLowerCase(),y=s.toLowerCase().indexOf(p);if(y>=0&&y<h.length){var v=h.substring(0,y),m=Math.min(this.value.length,h.length-y),g=h.substring(y,y+m),b=h.substring(y+m);t.fillStyle="#666666",t.fillText(v,l,u);var w=t.measureText(v).width;t.fillStyle="#000000",t.font="".concat(this.fontSize,"px -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif"),t.fillText(g,l+w,u);var x=t.measureText(g).width;t.fillStyle="#666666",t.fillText(b,l+w+x,u)}else t.fillStyle="#666666",t.fillText(h,l,u)}else t.fillStyle="#666666",t.fillText(h,l,u)}t.restore()}},{key:"roundRect",value:function(t,e,n,r,i,o){t.beginPath(),t.moveTo(e+o,n),t.lineTo(e+r-o,n),t.quadraticCurveTo(e+r,n,e+r,n+o),t.lineTo(e+r,n+i-o),t.quadraticCurveTo(e+r,n+i,e+r-o,n+i),t.lineTo(e+o,n+i),t.quadraticCurveTo(e,n+i,e,n+i-o),t.lineTo(e,n+o),t.quadraticCurveTo(e,n,e+o,n),t.closePath()}},{key:"destroy",value:function(){this.destroyHiddenInput(),this.cursorInterval&&clearInterval(this.cursorInterval),e.allInputs.delete(this),0===e.allInputs.size&&e.globalClickHandler&&(document.removeEventListener("click",e.globalClickHandler,!0),document.removeEventListener("touchstart",e.globalClickHandler,!0),e.globalClickHandler=null),Vn(e,"destroy",this,1)&&Vn(e,"destroy",this,3)([])}}],i=[{key:"removeAllHiddenInputs",value:function(){var t,n=Wn(e.allInputs);try{for(n.s();!(t=n.n()).done;){var r=t.value;r.focused=!1,r.cursorVisible=!1,r.hideDropdown(),r.hiddenInput&&r.hiddenInput.parentNode&&(r.hiddenInput.parentNode.removeChild(r.hiddenInput),r.hiddenInput=null)}}catch(t){n.e(t)}finally{n.f()}e.activeInput=null}}],r&&Un(n.prototype,r),i&&Un(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i}(u);Qn($n,"activeInput",null),Qn($n,"allInputs",new Set),Qn($n,"globalClickHandler",null);const Jn=$n;function Zn(t){return Zn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Zn(t)}function tr(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return er(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?er(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function er(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function nr(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,rr(r.key),r)}}function rr(t){var e=function(t){if("object"!=Zn(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Zn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Zn(e)?e:e+""}function ir(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ir=function(){return!!t})()}function or(t){return or=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},or(t)}function ar(t,e){return ar=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ar(t,e)}var sr=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=or(e),function(t,e){if(e&&("object"==Zn(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,ir()?Reflect.construct(e,n||[],or(t).constructor):e.apply(t,n))}(this,e,[t,r])).text=r.text||"",n.type=r.type||"info",n.actions=r.actions||[],n.dismissible=!0===r.dismissible,n.platform=t.platform||"material",n.width=r.width||t.width||window.innerWidth,n.height=r.height||64,n.x=r.x||0,n.y=r.y||0,n.visible=!1!==r.visible,n.progress=n.visible?1:0,n.animSpeed=.18,n._lastUpdate=performance.now(),n._colors=n._resolveColors(),n._actionBounds=[],n._dismissBounds=null,n.selfManagedClicks=!0,n._setupEventListeners(),r.ref&&(r.ref.current=n),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ar(t,e)}(e,t),n=e,(r=[{key:"_setupEventListeners",value:function(){this._boundHandleClick=this._handleClick.bind(this),this.framework&&this.framework.canvas&&(this.framework.canvas.addEventListener("click",this._boundHandleClick),this.framework.canvas.addEventListener("touchend",this._boundHandleClick))}},{key:"_removeEventListeners",value:function(){this.framework&&this.framework.canvas&&this._boundHandleClick&&(this.framework.canvas.removeEventListener("click",this._boundHandleClick),this.framework.canvas.removeEventListener("touchend",this._boundHandleClick))}},{key:"onMount",value:function(){this._setupEventListeners()}},{key:"onUnmount",value:function(){this._removeEventListeners()}},{key:"_resolveColors",value:function(){if("cupertino"===this.platform)return{bg:"rgba(250,250,250,0.95)",fg:"#000",accent:"#007AFF",divider:"rgba(60,60,67,0.15)"};var t={info:"#E8F0FE",success:"#E6F4EA",warning:"#FEF7E0",error:"#FCE8E6"};return{bg:t[this.type]||t.info,fg:"#1F1F1F",accent:"#1A73E8"}}},{key:"show",value:function(){this.visible=!0,this.markDirty()}},{key:"hide",value:function(){this.visible=!1,this.markDirty()}},{key:"update",value:function(){var t=performance.now(),e=Math.min((t-this._lastUpdate)/16.6,3),n=this.visible?1:0;this.progress+=(n-this.progress)*this.animSpeed*e,this.progress=Math.max(0,Math.min(1,this.progress)),Math.abs(n-this.progress)>.01&&this.markDirty(),this._lastUpdate=t}},{key:"draw",value:function(t){if(this.update(),!(this.progress<=.01)){var e=this.height*this.progress;t.save(),"material"===this.platform&&(t.shadowColor="rgba(0,0,0,0.18)",t.shadowBlur=8,t.shadowOffsetY=2),t.fillStyle=this._colors.bg,t.fillRect(this.x,this.y,this.width,e),t.shadowColor="transparent","cupertino"===this.platform&&(t.strokeStyle=this._colors.divider,t.beginPath(),t.moveTo(this.x,this.y+e),t.lineTo(this.x+this.width,this.y+e),t.stroke()),t.fillStyle=this._colors.fg,t.font="cupertino"===this.platform?"400 15px -apple-system":"400 14px Roboto, sans-serif",t.textBaseline="middle",t.textAlign="left",t.fillText(this.text,this.x+16,this.y+e/2),this._actionBounds=[];for(var n=this.width-16,r=this.actions.length-1;r>=0;r--){var i=this.actions[r],o=t.measureText(i.label).width+20;n-=o,t.fillStyle=this._colors.accent,t.textAlign="center",t.textBaseline="middle",t.fillText(i.label,this.x+n+o/2,this.y+e/2),this._actionBounds.push({action:i,bounds:{x:this.x+n,y:this.y+(e-44)/2,w:o,h:44}}),n-=12}if(this.dismissible){var a=this.width-28,s=this.y+e/2;t.fillStyle="cupertino"===this.platform?"rgba(60,60,67,0.6)":this._colors.fg,t.font="cupertino"===this.platform?"600 16px -apple-system":"500 16px Roboto",t.textAlign="center",t.textBaseline="middle",t.fillText("×",a,s),this._dismissBounds={x:a-22,y:s-22,w:44,h:44}}else this._dismissBounds=null;t.restore(),this.framework&&this.framework.debbug&&this._drawDebugHitboxes(t)}}},{key:"_drawDebugHitboxes",value:function(t){t.save(),t.strokeStyle="red",t.lineWidth=1,t.fillStyle="rgba(255, 0, 0, 0.1)";var e=this.height*this.progress;if(t.strokeRect(this.x,this.y,this.width,e),this._actionBounds&&this._actionBounds.length>0){var n,r=tr(this._actionBounds);try{for(r.s();!(n=r.n()).done;){var i=n.value,o=i.bounds;t.fillRect(o.x,o.y,o.w,o.h),t.strokeRect(o.x,o.y,o.w,o.h),t.fillStyle="red",t.font="10px monospace",t.fillText(i.action.label,o.x+5,o.y+12)}}catch(t){r.e(t)}finally{r.f()}}if(this._dismissBounds){var a=this._dismissBounds;t.fillRect(a.x,a.y,a.w,a.h),t.strokeRect(a.x,a.y,a.w,a.h),t.fillText("X",a.x+5,a.y+12)}t.restore()}},{key:"_handleClick",value:function(t){if(!(this.progress<.95)){var e,n;if("touchend"===t.type){var r=t.changedTouches[0];e=r.clientX,n=r.clientY}else e=t.clientX,n=t.clientY;var i=this.framework.canvas.getBoundingClientRect(),o=e-i.left,a=n-i.top;console.log("Click converted:",{clientX:e,clientY:n,canvasLeft:i.left,canvasTop:i.top,x:o,y:a,bannerX:this.x,bannerY:this.y,bannerWidth:this.width,bannerHeight:this.height*this.progress});var s=this.y+this.height*this.progress;if(o<this.x||o>this.x+this.width||a<this.y||a>s)console.log("Click outside banner");else{if(console.log("Click INSIDE banner!"),t.stopPropagation(),this.dismissible&&this._dismissBounds){var l=this._dismissBounds;if(console.log("Checking dismiss bounds:",l,"click:",{x:o,y:a}),o>=l.x&&o<=l.x+l.w&&a>=l.y&&a<=l.y+l.h)return console.log("Dismiss clicked!"),void this.hide()}if(this._actionBounds&&this._actionBounds.length>0){console.log("Checking",this._actionBounds.length,"action bounds");var u,c=tr(this._actionBounds);try{for(c.s();!(u=c.n()).done;){var h,f,d=u.value,p=d.bounds;if(console.log("Checking action:",d.action.label,"bounds:",p),o>=p.x&&o<=p.x+p.w&&a>=p.y&&a<=p.y+p.h)return console.log("Action clicked:",d.action.label),void(null===(h=(f=d.action).onClick)||void 0===h||h.call(f))}}catch(t){c.e(t)}finally{c.f()}}console.log("Click on banner but not on any button")}}}},{key:"_resize",value:function(t){this.width=t,this.markDirty()}}])&&nr(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);function lr(t){return lr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},lr(t)}function ur(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function cr(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?ur(Object(n),!0).forEach(function(e){hr(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ur(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function hr(t,e,n){return(e=dr(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function fr(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,dr(r.key),r)}}function dr(t){var e=function(t){if("object"!=lr(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=lr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==lr(e)?e:e+""}function pr(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(pr=function(){return!!t})()}function yr(){return yr="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=vr(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},yr.apply(null,arguments)}function vr(t){return vr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},vr(t)}function mr(t,e){return mr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},mr(t,e)}const gr=function(t){function e(t){var n,r,i,o,a,s,l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(s=function(t,e,n){return e=vr(e),function(t,e){if(e&&("object"==lr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,pr()?Reflect.construct(e,n||[],vr(t).constructor):e.apply(t,n))}(this,e,[t,cr(cr({},l),{},{y:0})])).expandedHeight=l.expandedHeight||240,s.collapsedHeight=null!==(n=l.collapsedHeight)&&void 0!==n?n:56,s.stretch=null===(r=l.stretch)||void 0===r||r,s.parallax=null===(i=l.parallax)||void 0===i||i,s.parallaxFactor=null!==(o=l.parallaxFactor)&&void 0!==o?o:.4,s.backgroundImage=l.backgroundImage||null,s.backgroundColor=l.backgroundColor||s.bgColor||"#FFFFFF",s.backgroundOpacity=s._extractOpacity(s.backgroundColor),s.overlayColor=l.overlayColor||"#000000",s.overlayOpacity=null!==(a=l.overlayOpacity)&&void 0!==a?a:0,s.foregroundColor=l.foregroundColor||l.textColor||s.textColor||"#FFFFFF",s.fixed=!1,s}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&mr(t,e)}(e,t),n=e,r=[{key:"_extractOpacity",value:function(t){if("string"==typeof t&&t.startsWith("rgba")){var e=t.match(/rgba?\([^,]+,[^,]+,[^,]+,\s*([\d.]+)\)/);return e?parseFloat(e[1]):1}return 1}},{key:"updateWithScroll",value:function(t){var e=-t,n=this.expandedHeight-this.collapsedHeight,r=Math.min(e,n),i=this.expandedHeight-r;e<0&&this.stretch&&(i=this.expandedHeight-e),this.height=Math.max(i,this.collapsedHeight)}},{key:"draw",value:function(t){var n=this.framework.scrollOffset||0;this.updateWithScroll(n),t.save();var r=Math.min(1,Math.max(0,(this.expandedHeight-this.height)/(this.expandedHeight-this.collapsedHeight)));if(this.backgroundImage&&this.backgroundImage.complete){var i=0;this.parallax&&(i=Math.max(0,-n*this.parallaxFactor)),t.drawImage(this.backgroundImage,this.x,this.y-i,this.width,this.height+i)}t.globalAlpha=this.backgroundOpacity,t.fillStyle=this.backgroundColor,t.fillRect(this.x,this.y,this.width,this.height),t.globalAlpha=1,this.overlayOpacity>0&&(t.globalAlpha=this.overlayOpacity,t.fillStyle=this.overlayColor,t.fillRect(this.x,this.y,this.width,this.height),t.globalAlpha=1),t.globalAlpha=1-r,t.fillStyle=this.foregroundColor,t.font="bold 20px -apple-system, Roboto, sans-serif",t.textAlign="left",t.textBaseline="bottom",t.fillText(this.title,this.x+16,this.y+this.height-16),t.globalAlpha=1;var o,a,s,l=this.bgColor,u=this.textColor,c=this.iconColor,h=this.platform;this.bgColor="rgba(0,0,0,0)",this.textColor=this.foregroundColor,this.iconColor=this.foregroundColor,this.platform="material",(o=e,a=this,"function"==typeof(s=yr(vr(1&3?o.prototype:o),"draw",a))?function(t){return s.apply(a,t)}:s)([t]),this.bgColor=l,this.textColor=u,this.iconColor=c,this.platform=h,t.restore()}}],r&&fr(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(Lt);function br(t){return br="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},br(t)}function wr(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,u=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(t){u=!0,i=t}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return xr(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?xr(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function xr(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function kr(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var l=r&&r.prototype instanceof s?r:s,u=Object.create(l.prototype);return Sr(u,"_invoke",function(n,r,i){var o,s,l,u=0,c=i||[],h=!1,f={p:0,n:0,v:t,a:d,f:d.bind(t,4),d:function(e,n){return o=e,s=0,l=t,f.n=n,a}};function d(n,r){for(s=n,l=r,e=0;!h&&u&&!i&&e<c.length;e++){var i,o=c[e],d=f.p,p=o[2];n>3?(i=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=t):o[0]<=d&&((i=n<2&&d<o[1])?(s=0,f.v=r,f.n=o[1]):d<p&&(i=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(i||n>1)return a;throw h=!0,r}return function(i,c,p){if(u>1)throw TypeError("Generator is already running");for(h&&1===c&&d(c,p),s=c,l=p;(e=s<2?t:l)||!h;){o||(s?s<3?(s>1&&(f.n=-1),d(s,l)):f.n=l:f.v=l);try{if(u=2,o){if(s||(i="next"),e=o[i]){if(!(e=e.call(o,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,s<2&&(s=0)}else 1===s&&(e=o.return)&&e.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+i+"' method"),s=1);o=t}else if((e=(h=f.n<0)?l:n.call(r,f))!==a)break}catch(e){o=t,s=1,l=e}finally{u=1}}return{value:e,done:h}}}(n,i,o),!0),u}var a={};function s(){}function l(){}function u(){}e=Object.getPrototypeOf;var c=[][r]?e(e([][r]())):(Sr(e={},r,function(){return this}),e),h=u.prototype=s.prototype=Object.create(c);function f(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,u):(t.__proto__=u,Sr(t,i,"GeneratorFunction")),t.prototype=Object.create(h),t}return l.prototype=u,Sr(h,"constructor",u),Sr(u,"constructor",l),l.displayName="GeneratorFunction",Sr(u,i,"GeneratorFunction"),Sr(h),Sr(h,i,"Generator"),Sr(h,r,function(){return this}),Sr(h,"toString",function(){return"[object Generator]"}),(kr=function(){return{w:o,m:f}})()}function Sr(t,e,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(t){i=0}Sr=function(t,e,n,r){function o(e,n){Sr(t,e,function(t){return this._invoke(e,n,t)})}e?i?i(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(o("next",0),o("throw",1),o("return",2))},Sr(t,e,n,r)}function Tr(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function Pr(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function a(t){Tr(o,r,i,a,s,"next",t)}function s(t){Tr(o,r,i,a,s,"throw",t)}a(void 0)})}}function Or(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Cr(r.key),r)}}function Cr(t){var e=function(t){if("object"!=br(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=br(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==br(e)?e:e+""}function Er(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Er=function(){return!!t})()}function jr(t,e,n,r){var i=Ir(Fr(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof i?function(t){return i.apply(n,t)}:i}function Ir(){return Ir="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Fr(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},Ir.apply(null,arguments)}function Fr(t){return Fr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Fr(t)}function Rr(t,e){return Rr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Rr(t,e)}const Mr=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=Fr(e),function(t,e){if(e&&("object"==br(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Er()?Reflect.construct(e,n||[],Fr(t).constructor):e.apply(t,n))}(this,e,[t,r])).facingMode=r.facingMode||"environment",n.autoStart=!1!==r.autoStart,n.onPhoto=r.onPhoto||null,n.fitModes=["contain","cover"],n.currentFitModeIndex=0,n.fitMode=n.fitModes[n.currentFitModeIndex],n.stream=null,n.video=null,n.loaded=!1,n.error=null,n.showControls=!0,n.torchSupported=!1,n.torchOn=!1,n.captureButtonRadius=35,n.modeButtonSize=40,n.flashTimer=null,n.previewPhoto=null,n.previewTimeout=null,n.isStarting=!1,n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Rr(t,e)}(e,t),n=e,r=[{key:"_mount",value:(l=Pr(kr().m(function t(){var n;return kr().w(function(t){for(;;)switch(t.n){case 0:if(null===(n=jr(e,"_mount",this,3))||void 0===n||n([]),!this.autoStart||this.stream||this.isStarting){t.n=2;break}return this.isStarting=!0,t.n=1,this.startCamera();case 1:this.isStarting=!1;case 2:this.setupEventListeners();case 3:return t.a(2)}},t,this)})),function(){return l.apply(this,arguments)})},{key:"destroy",value:function(){var t;this.removeEventListeners(),this.stopCamera(),this.flashTimer&&clearTimeout(this.flashTimer),this.previewTimeout&&clearTimeout(this.previewTimeout),null===(t=jr(e,"destroy",this,3))||void 0===t||t([])}},{key:"setupEventListeners",value:function(){this.onTouchStart=this.handleTouchStart.bind(this),this.onTouchMove=this.handleTouchMove.bind(this),this.onTouchEnd=this.handleTouchEnd.bind(this),this.onMouseDown=this.handleMouseDown.bind(this),this.onMouseMove=this.handleMouseMove.bind(this),this.onMouseUp=this.handleMouseUp.bind(this);var t=this.framework.canvas;t.addEventListener("touchstart",this.onTouchStart,{passive:!1}),t.addEventListener("touchmove",this.onTouchMove,{passive:!1}),t.addEventListener("touchend",this.onTouchEnd,{passive:!1}),t.addEventListener("mousedown",this.onMouseDown),t.addEventListener("mousemove",this.onMouseMove),t.addEventListener("mouseup",this.onMouseUp)}},{key:"removeEventListeners",value:function(){var t=this.framework.canvas;t.removeEventListener("touchstart",this.onTouchStart),t.removeEventListener("touchmove",this.onTouchMove),t.removeEventListener("touchend",this.onTouchEnd),t.removeEventListener("mousedown",this.onMouseDown),t.removeEventListener("mousemove",this.onMouseMove),t.removeEventListener("mouseup",this.onMouseUp)}},{key:"getLocalPos",value:function(t,e){var n=this.framework.canvas.getBoundingClientRect(),r=t-n.left,i=e-n.top-this.framework.scrollOffset;return{x:r-this.x,y:i-this.y}}},{key:"handleTouchStart",value:function(t){t.preventDefault();var e=t.touches[0],n=this.getLocalPos(e.clientX,e.clientY);this.handlePress(n.x,n.y)}},{key:"handleTouchMove",value:function(t){t.preventDefault()}},{key:"handleTouchEnd",value:function(t){t.preventDefault()}},{key:"handleMouseDown",value:function(t){var e=this.getLocalPos(t.clientX,t.clientY);this.handlePress(e.x,e.y)}},{key:"handleMouseMove",value:function(t){}},{key:"handleMouseUp",value:function(t){}},{key:"startCamera",value:(s=Pr(kr().m(function t(){var n,r,i,o,a,s,l=this;return kr().w(function(t){for(;;)switch(t.p=t.n){case 0:if(e.cleanupAllCameras(),!this.stream){t.n=1;break}return t.a(2);case 1:return t.p=1,this.stopCamera(),t.n=2,navigator.mediaDevices.getUserMedia({video:{facingMode:this.facingMode,width:{ideal:1280},height:{ideal:720},frameRate:{ideal:30}}});case 2:return this.stream=t.v,r=this.stream.getVideoTracks(),i=wr(r,1),o=i[0],a=(null===(n=o.getCapabilities)||void 0===n?void 0:n.call(o))||{},this.torchSupported=!!a.torch,this.video=document.createElement("video"),this.video.autoplay=!0,this.video.playsInline=!0,this.video.muted=!0,this.video.srcObject=this.stream,this.video.style.position="fixed",this.video.style.left="-9999px",this.video.style.top="-9999px",this.video.style.width="1px",this.video.style.height="1px",document.body.appendChild(this.video),t.n=3,new Promise(function(t){l.video.onloadedmetadata=function(){l.loaded=!0,l.video.play().catch(function(t){return console.warn("Play auto échoué:",t)}),t()},l.video.onerror=function(e){l.error="Erreur vidéo",console.error("Video error:",e),t()}});case 3:this.markDirty(),t.n=5;break;case 4:t.p=4,s=t.v,this.error=s.message||"Accès caméra refusé",console.error("Échec getUserMedia:",s),this.markDirty();case 5:return t.a(2)}},t,this,[[1,4]])})),function(){return s.apply(this,arguments)})},{key:"stopCamera",value:function(){this.stream&&(this.stream.getTracks().forEach(function(t){return t.stop()}),this.stream=null),this.video&&(this.video.parentNode&&this.video.parentNode.removeChild(this.video),this.video.srcObject=null,this.video=null),this.loaded=!1,this.markDirty()}},{key:"switchCamera",value:(a=Pr(kr().m(function t(){return kr().w(function(t){for(;;)switch(t.n){case 0:return this.stopCamera(),this.facingMode="user"===this.facingMode?"environment":"user",t.n=1,this.startCamera();case 1:return t.a(2)}},t,this)})),function(){return a.apply(this,arguments)})},{key:"toggleTorch",value:(o=Pr(kr().m(function t(){var e,n,r,i;return kr().w(function(t){for(;;)switch(t.p=t.n){case 0:if(this.torchSupported&&this.stream){t.n=1;break}return t.a(2);case 1:return e=this.stream.getVideoTracks(),n=wr(e,1),r=n[0],t.p=2,t.n=3,r.applyConstraints({advanced:[{torch:!this.torchOn}]});case 3:this.torchOn=!this.torchOn,this.markDirty(),t.n=5;break;case 4:t.p=4,i=t.v,console.warn("Torch impossible:",i);case 5:return t.a(2)}},t,this,[[2,4]])})),function(){return o.apply(this,arguments)})},{key:"capturePhoto",value:function(){var t=this;if(!this.loaded||!this.video)return console.warn("Capture impossible : caméra pas prête"),null;var e=document.createElement("canvas");e.width=this.video.videoWidth,e.height=this.video.videoHeight,e.getContext("2d").drawImage(this.video,0,0);var n=e.toDataURL("image/jpeg",.92);return this.onPhoto&&this.onPhoto(n),console.log("Photo capturée ! DataURL:",n.substring(0,50)+"..."),this.flashTimer=setTimeout(function(){t.flashTimer=null,t.markDirty()},200),this.previewPhoto=n,this.previewTimeout=setTimeout(function(){t.previewPhoto=null,t.markDirty()},3e3),this.markDirty(),n}},{key:"switchFitMode",value:function(){this.currentFitModeIndex=(this.currentFitModeIndex+1)%this.fitModes.length,this.fitMode=this.fitModes[this.currentFitModeIndex],this.markDirty()}},{key:"handlePress",value:function(t,e){var n=this.width/2,r=this.height-60;if(Math.hypot(t-n,e-r)<this.captureButtonRadius+10)this.capturePhoto();else if(t<60&&e<60)this.switchCamera();else if(this.torchSupported&&t>this.width-60&&e<60)this.toggleTorch();else{var i=this.width-80;t>i&&t<i+this.modeButtonSize&&e>20&&e<20+this.modeButtonSize&&this.switchFitMode()}}},{key:"drawContainIcon",value:function(t,e,n,r){var i=.2*r;t.strokeStyle="#000",t.lineWidth=2,t.strokeRect(e+i,n+i,r-2*i,r-2*i);var o=.15*r;t.fillStyle="#000",t.beginPath(),t.moveTo(e+r/2,n+i-2),t.lineTo(e+r/2-o,n+i+o),t.lineTo(e+r/2+o,n+i+o),t.fill(),t.beginPath(),t.moveTo(e+r/2,n+r-i+2),t.lineTo(e+r/2-o,n+r-i-o),t.lineTo(e+r/2+o,n+r-i-o),t.fill(),t.beginPath(),t.moveTo(e+i-2,n+r/2),t.lineTo(e+i+o,n+r/2-o),t.lineTo(e+i+o,n+r/2+o),t.fill(),t.beginPath(),t.moveTo(e+r-i+2,n+r/2),t.lineTo(e+r-i-o,n+r/2-o),t.lineTo(e+r-i-o,n+r/2+o),t.fill()}},{key:"drawCoverIcon",value:function(t,e,n,r){var i=.2*r;t.strokeStyle="#000",t.lineWidth=2,t.strokeRect(e+i,n+i,r-2*i,r-2*i);var o=.15*r;t.fillStyle="#000",t.beginPath(),t.moveTo(e+r/2,n+2),t.lineTo(e+r/2-o,n+o+2),t.lineTo(e+r/2+o,n+o+2),t.fill(),t.beginPath(),t.moveTo(e+r/2,n+r-2),t.lineTo(e+r/2-o,n+r-o-2),t.lineTo(e+r/2+o,n+r-o-2),t.fill(),t.beginPath(),t.moveTo(e+2,n+r/2),t.lineTo(e+o+2,n+r/2-o),t.lineTo(e+o+2,n+r/2+o),t.fill(),t.beginPath(),t.moveTo(e+r-2,n+r/2),t.lineTo(e+r-o-2,n+r/2-o),t.lineTo(e+r-o-2,n+r/2+o),t.fill()}},{key:"drawSwitchCameraIcon",value:function(t,e,n,r){var i=e+r/2,o=n+r/2,a=.35*r;t.strokeStyle="#ffffff",t.lineWidth=3,t.lineCap="round",t.beginPath(),t.arc(i,o,a,.7*-Math.PI,.7*Math.PI),t.stroke();var s=.15*r,l=.7*Math.PI,u=i+a*Math.cos(l),c=o+a*Math.sin(l);t.fillStyle="#ffffff",t.beginPath(),t.moveTo(u,c),t.lineTo(u-s,c-.5*s),t.lineTo(u-.5*s,c+s),t.fill();var h=.25*r,f=.18*r,d=i-h/2,p=o-f/2;t.fillStyle="#ffffff",t.fillRect(d,p,h,f),t.fillStyle="#000",t.beginPath(),t.arc(i,o,.08*r,0,2*Math.PI),t.fill()}},{key:"draw",value:function(t){if(t.save(),t.fillStyle="#000",t.fillRect(this.x,this.y,this.width,this.height),this.flashTimer&&(t.fillStyle="rgba(255,255,255,0.6)",t.fillRect(this.x,this.y,this.width,this.height)),this.error)t.fillStyle="#ff4444",t.font="16px Arial",t.textAlign="center",t.textBaseline="middle",t.fillText(this.error,this.x+this.width/2,this.y+this.height/2);else if(this.loaded){if(this.video&&this.loaded){var e=this.video.videoWidth/this.video.videoHeight,n=this.width/this.height,r=this.width,i=this.height,o=0,a=0;if("cover"===this.fitMode?e>n?(r=(i=this.height)*e,o=(this.width-r)/2):(i=(r=this.width)/e,a=(this.height-i)/2):"contain"===this.fitMode&&(e>n?(i=(r=this.width)/e,a=(this.height-i)/2):(r=(i=this.height)*e,o=(this.width-r)/2)),t.drawImage(this.video,this.x+o,this.y+a,r,i),this.previewPhoto){var s=80,l=new Image;l.src=this.previewPhoto,t.drawImage(l,this.x+this.width-s-10,this.y+this.height-s-10,s,s),t.strokeStyle="#fff",t.lineWidth=2,t.strokeRect(this.x+this.width-s-10,this.y+this.height-s-10,s,s)}}}else t.fillStyle="#fff",t.font="16px Arial",t.textAlign="center",t.textBaseline="middle",t.fillText("Démarrage caméra...",this.x+this.width/2,this.y+this.height/2);t.fillStyle="rgba(0,0,0,0.5)",t.fillRect(this.x,this.y+this.height-100,this.width,100),t.fillStyle="#ffffff",t.beginPath(),t.arc(this.x+this.width/2,this.y+this.height-50,this.captureButtonRadius,0,2*Math.PI),t.fill(),t.strokeStyle="#ff4444",t.lineWidth=6,t.beginPath(),t.arc(this.x+this.width/2,this.y+this.height-50,this.captureButtonRadius+10,0,2*Math.PI),t.stroke();var u=this.x+20,c=this.y+20;t.fillStyle="rgba(0,0,0,0.5)",t.beginPath(),t.arc(u+25,c+25,25,0,2*Math.PI),t.fill(),this.drawSwitchCameraIcon(t,u,c,50),this.torchSupported&&(t.fillStyle=this.torchOn?"#ffeb3b":"#ffffff",t.fillText("⚡",this.x+this.width-50,this.y+45));var h=this.x+this.width-80,f=this.y+20;t.fillStyle="rgba(255,255,255,0.9)",t.fillRect(h,f,this.modeButtonSize,this.modeButtonSize),t.strokeStyle="#000",t.lineWidth=2,t.strokeRect(h,f,this.modeButtonSize,this.modeButtonSize),"contain"===this.fitMode?this.drawContainIcon(t,h,f,this.modeButtonSize):this.drawCoverIcon(t,h,f,this.modeButtonSize),t.restore()}}],i=[{key:"cleanupAllCameras",value:function(){document.querySelectorAll("video").forEach(function(t){if(t.srcObject){var e=t.srcObject;e&&e.getTracks&&e.getTracks().forEach(function(t){return t.stop()}),t.srcObject=null}t.parentNode&&t.parentNode.removeChild(t)})}}],r&&Or(n.prototype,r),i&&Or(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i,o,a,s,l}(u);function Ar(t){return Ar="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ar(t)}function _r(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,u=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(t){u=!0,i=t}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Dr(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Dr(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Dr(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Br(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var l=r&&r.prototype instanceof s?r:s,u=Object.create(l.prototype);return Lr(u,"_invoke",function(n,r,i){var o,s,l,u=0,c=i||[],h=!1,f={p:0,n:0,v:t,a:d,f:d.bind(t,4),d:function(e,n){return o=e,s=0,l=t,f.n=n,a}};function d(n,r){for(s=n,l=r,e=0;!h&&u&&!i&&e<c.length;e++){var i,o=c[e],d=f.p,p=o[2];n>3?(i=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=t):o[0]<=d&&((i=n<2&&d<o[1])?(s=0,f.v=r,f.n=o[1]):d<p&&(i=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(i||n>1)return a;throw h=!0,r}return function(i,c,p){if(u>1)throw TypeError("Generator is already running");for(h&&1===c&&d(c,p),s=c,l=p;(e=s<2?t:l)||!h;){o||(s?s<3?(s>1&&(f.n=-1),d(s,l)):f.n=l:f.v=l);try{if(u=2,o){if(s||(i="next"),e=o[i]){if(!(e=e.call(o,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,s<2&&(s=0)}else 1===s&&(e=o.return)&&e.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+i+"' method"),s=1);o=t}else if((e=(h=f.n<0)?l:n.call(r,f))!==a)break}catch(e){o=t,s=1,l=e}finally{u=1}}return{value:e,done:h}}}(n,i,o),!0),u}var a={};function s(){}function l(){}function u(){}e=Object.getPrototypeOf;var c=[][r]?e(e([][r]())):(Lr(e={},r,function(){return this}),e),h=u.prototype=s.prototype=Object.create(c);function f(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,u):(t.__proto__=u,Lr(t,i,"GeneratorFunction")),t.prototype=Object.create(h),t}return l.prototype=u,Lr(h,"constructor",u),Lr(u,"constructor",l),l.displayName="GeneratorFunction",Lr(u,i,"GeneratorFunction"),Lr(h),Lr(h,i,"Generator"),Lr(h,r,function(){return this}),Lr(h,"toString",function(){return"[object Generator]"}),(Br=function(){return{w:o,m:f}})()}function Lr(t,e,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(t){i=0}Lr=function(t,e,n,r){function o(e,n){Lr(t,e,function(t){return this._invoke(e,n,t)})}e?i?i(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(o("next",0),o("throw",1),o("return",2))},Lr(t,e,n,r)}function Wr(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function Hr(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function a(t){Wr(o,r,i,a,s,"next",t)}function s(t){Wr(o,r,i,a,s,"throw",t)}a(void 0)})}}function zr(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,qr(r.key),r)}}function qr(t){var e=function(t){if("object"!=Ar(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ar(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ar(e)?e:e+""}function Ur(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ur=function(){return!!t})()}function Nr(t,e,n,r){var i=Vr(Gr(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof i?function(t){return i.apply(n,t)}:i}function Vr(){return Vr="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Gr(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},Vr.apply(null,arguments)}function Gr(t){return Gr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Gr(t)}function Yr(t,e){return Yr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Yr(t,e)}const Xr=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=Gr(e),function(t,e){if(e&&("object"==Ar(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Ur()?Reflect.construct(e,n||[],Gr(t).constructor):e.apply(t,n))}(this,e,[t,r])).facingMode=r.facingMode||"environment",n.autoStart=!1!==r.autoStart,n.onQRCodeDetected=r.onQRCodeDetected||null,n.onError=r.onError||null,n.scanInterval=r.scanInterval||300,n.continuous=!1!==r.continuous,n.vibrateOnDetect=!1!==r.vibrateOnDetect,n.stream=null,n.video=null,n.loaded=!1,n.error=null,n.isScanning=!1,n.scanTimer=null,n.lastScanTime=0,n.currentQRCode=null,n.scanHistory=[],n.showControls=!0,n.showScannerOverlay=!0,n.scannerFrameSize=250,n.scannerFrameColor="#00ff00",n.scannerLineColor="#ff0000",n.scannerLineHeight=2,n.scannerLineSpeed=2,n.scannerLinePosition=0,n.scannerLineDirection=1,n.torchSupported=!1,n.torchOn=!1,n.isStarting=!1,n.loadQRScanner(),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Yr(t,e)}(e,t),n=e,r=[{key:"_mount",value:(s=Hr(Br().m(function t(){var n;return Br().w(function(t){for(;;)switch(t.n){case 0:if(null===(n=Nr(e,"_mount",this,3))||void 0===n||n([]),!this.autoStart||this.stream||this.isStarting){t.n=2;break}return this.isStarting=!0,t.n=1,this.startCamera();case 1:this.isStarting=!1;case 2:this.setupEventListeners();case 3:return t.a(2)}},t,this)})),function(){return s.apply(this,arguments)})},{key:"destroy",value:function(){var t;this.stopScanning(),this.removeEventListeners(),this.stopCamera(),null===(t=Nr(e,"destroy",this,3))||void 0===t||t([])}},{key:"loadQRScanner",value:function(){var t=this;if("undefined"==typeof jsQR){var e=document.createElement("script");e.src="https://cdn.jsdelivr.net/npm/jsqr@1.4.0/dist/jsQR.min.js",e.onload=function(){console.log("jsQR loaded"),t.loaded&&!t.isScanning&&t.startScanning()},e.onerror=function(){console.error("Failed to load jsQR"),t.error="Échec du chargement du scanner QR"},document.head.appendChild(e)}}},{key:"setupEventListeners",value:function(){this.onTouchStart=this.handleTouchStart.bind(this),this.onMouseDown=this.handleMouseDown.bind(this);var t=this.framework.canvas;t.addEventListener("touchstart",this.onTouchStart,{passive:!1}),t.addEventListener("mousedown",this.onMouseDown)}},{key:"removeEventListeners",value:function(){var t=this.framework.canvas;t.removeEventListener("touchstart",this.onTouchStart),t.removeEventListener("mousedown",this.onMouseDown)}},{key:"getLocalPos",value:function(t,e){var n=this.framework.canvas.getBoundingClientRect(),r=t-n.left,i=e-n.top-this.framework.scrollOffset;return{x:r-this.x,y:i-this.y}}},{key:"handleTouchStart",value:function(t){t.preventDefault();var e=t.touches[0],n=this.getLocalPos(e.clientX,e.clientY);this.handlePress(n.x,n.y)}},{key:"handleMouseDown",value:function(t){var e=this.getLocalPos(t.clientX,t.clientY);this.handlePress(e.x,e.y)}},{key:"startCamera",value:(a=Hr(Br().m(function t(){var e,n,r,i,o,a,s=this;return Br().w(function(t){for(;;)switch(t.p=t.n){case 0:if(!this.stream){t.n=1;break}return t.a(2);case 1:return t.p=1,this.stopCamera(),t.n=2,navigator.mediaDevices.getUserMedia({video:{facingMode:this.facingMode,width:{ideal:320},height:{ideal:240},frameRate:{ideal:30}}});case 2:return this.stream=t.v,n=this.stream.getVideoTracks(),r=_r(n,1),i=r[0],o=(null===(e=i.getCapabilities)||void 0===e?void 0:e.call(i))||{},this.torchSupported=!!o.torch,this.video=document.createElement("video"),this.video.autoplay=!0,this.video.playsInline=!0,this.video.muted=!0,this.video.srcObject=this.stream,this.video.style.position="fixed",this.video.style.left="-9999px",this.video.style.top="-9999px",this.video.style.width="1px",this.video.style.height="1px",document.body.appendChild(this.video),t.n=3,new Promise(function(t){s.video.onloadedmetadata=function(){s.loaded=!0,s.video.play().then(function(){"undefined"!=typeof jsQR&&s.startScanning(),t()}).catch(function(e){console.warn("Play auto échoué:",e),t()})},s.video.onerror=function(e){s.error="Erreur vidéo",console.error("Video error:",e),t()}});case 3:this.markDirty(),t.n=5;break;case 4:t.p=4,a=t.v,this.error=a.message||"Accès caméra refusé",console.error("Échec getUserMedia:",a),this.onError&&this.onError(this.error),this.markDirty();case 5:return t.a(2)}},t,this,[[1,4]])})),function(){return a.apply(this,arguments)})},{key:"stopCamera",value:function(){this.stopScanning(),this.stream&&(this.stream.getTracks().forEach(function(t){return t.stop()}),this.stream=null),this.video&&(this.video.parentNode&&this.video.parentNode.removeChild(this.video),this.video.srcObject=null,this.video=null),this.loaded=!1,this.markDirty()}},{key:"startScanning",value:function(){var t=this;!this.isScanning&&this.loaded&&this.video&&(this.isScanning=!0,this.scanTimer=setInterval(function(){t.scanQRCode()},this.scanInterval))}},{key:"stopScanning",value:function(){this.scanTimer&&(clearInterval(this.scanTimer),this.scanTimer=null),this.isScanning=!1}},{key:"switchCamera",value:(o=Hr(Br().m(function t(){return Br().w(function(t){for(;;)switch(t.n){case 0:return this.stopScanning(),this.stopCamera(),this.facingMode="user"===this.facingMode?"environment":"user",t.n=1,this.startCamera();case 1:return t.a(2)}},t,this)})),function(){return o.apply(this,arguments)})},{key:"toggleTorch",value:(i=Hr(Br().m(function t(){var e,n,r,i;return Br().w(function(t){for(;;)switch(t.p=t.n){case 0:if(this.torchSupported&&this.stream){t.n=1;break}return t.a(2);case 1:return e=this.stream.getVideoTracks(),n=_r(e,1),r=n[0],t.p=2,t.n=3,r.applyConstraints({advanced:[{torch:!this.torchOn}]});case 3:this.torchOn=!this.torchOn,this.markDirty(),t.n=5;break;case 4:t.p=4,i=t.v,console.warn("Torch impossible:",i);case 5:return t.a(2)}},t,this,[[2,4]])})),function(){return i.apply(this,arguments)})},{key:"scanQRCode",value:function(){if(this.loaded&&this.video&&"undefined"!=typeof jsQR){var t=document.createElement("canvas"),e=t.getContext("2d"),n=this.video.videoWidth,r=this.video.videoHeight;t.width=n,t.height=r,e.drawImage(this.video,0,0,n,r);var i=e.getImageData(0,0,n,r),o=jsQR(i.data,i.width,i.height,{inversionAttempts:"dontInvert"});o?this.handleQRCodeDetected(o.data,o.location):this.currentQRCode=null,this.markDirty()}}},{key:"handleQRCodeDetected",value:function(t,e){var n=Date.now();if(this.scanHistory.length>0){var r=this.scanHistory[this.scanHistory.length-1];if(r.data===t&&n-r.timestamp<2e3)return}this.currentQRCode={data:t,location:e,timestamp:n},this.scanHistory.push({data:t,timestamp:n}),this.scanHistory.length>10&&this.scanHistory.shift(),this.vibrateOnDetect&&navigator.vibrate&&navigator.vibrate(200),this.onQRCodeDetected&&this.onQRCodeDetected(t),this.continuous||this.stopScanning(),console.log("QR Code détecté:",t)}},{key:"handlePress",value:function(t,e){t<60&&e<60?this.switchCamera():this.torchSupported&&t>this.width-60&&e<60?this.toggleTorch():t>this.width/2-100&&t<this.width/2+100&&e>this.height/2-100&&e<this.height/2+100&&!this.isScanning&&this.loaded&&this.startScanning()}},{key:"drawScannerOverlay",value:function(t){if(this.showScannerOverlay){var e=this.x+this.width/2,n=this.y+this.height/2,r=this.scannerFrameSize,i=r/2;t.fillStyle="rgba(0, 0, 0, 0.7)",t.fillRect(this.x,this.y,this.width,n-this.y-i),t.fillRect(this.x,n+i,this.width,this.y+this.height-(n+i)),t.fillRect(this.x,n-i,e-this.x-i,r),t.fillRect(e+i,n-i,this.x+this.width-(e+i),r),t.strokeStyle=this.scannerFrameColor,t.lineWidth=4,t.strokeRect(e-i,n-i,r,r);var o=20;t.beginPath(),t.moveTo(e-i,n-i+o),t.lineTo(e-i,n-i),t.lineTo(e-i+o,n-i),t.stroke(),t.beginPath(),t.moveTo(e+i-o,n-i),t.lineTo(e+i,n-i),t.lineTo(e+i,n-i+o),t.stroke(),t.beginPath(),t.moveTo(e-i,n+i-o),t.lineTo(e-i,n+i),t.lineTo(e-i+o,n+i),t.stroke(),t.beginPath(),t.moveTo(e+i-o,n+i),t.lineTo(e+i,n+i),t.lineTo(e+i,n+i-o),t.stroke(),this.scannerLinePosition+=this.scannerLineSpeed*this.scannerLineDirection,(this.scannerLinePosition>r||this.scannerLinePosition<0)&&(this.scannerLineDirection*=-1);var a=n-i+this.scannerLinePosition;t.fillStyle=this.scannerLineColor,t.fillRect(e-i,a,r,this.scannerLineHeight)}}},{key:"drawControls",value:function(t){t.fillStyle="rgba(0,0,0,0.5)",t.beginPath(),t.arc(this.x+30,this.y+30,25,0,2*Math.PI),t.fill(),t.fillStyle="#fff",t.font="20px Arial",t.textAlign="center",t.textBaseline="middle",t.fillText("🔄",this.x+30,this.y+30),this.torchSupported&&(t.fillStyle="rgba(0,0,0,0.5)",t.beginPath(),t.arc(this.x+this.width-30,this.y+30,25,0,2*Math.PI),t.fill(),t.fillStyle=this.torchOn?"#ffeb3b":"#fff",t.fillText("⚡",this.x+this.width-30,this.y+30));var e=this.y+this.height-40;if(t.fillStyle=this.isScanning?"#4CAF50":"#FF5722",t.font="14px Arial",t.textAlign="center",t.fillText(this.isScanning?"Scan en cours...":"Scan arrêté",this.x+this.width/2,e),this.currentQRCode){t.fillStyle="rgba(0, 150, 0, 0.8)",t.fillRect(this.x,this.y+this.height-90,this.width,40),t.fillStyle="#fff",t.font="12px Arial",t.textAlign="center";var n=this.currentQRCode.data.length>50?this.currentQRCode.data.substring(0,47)+"...":this.currentQRCode.data;t.fillText("QR Code: ".concat(n),this.x+this.width/2,this.y+this.height-70)}}},{key:"draw",value:function(t){if(t.save(),t.fillStyle="#000",t.fillRect(this.x,this.y,this.width,this.height),this.error)t.fillStyle="#ff4444",t.font="16px Arial",t.textAlign="center",t.textBaseline="middle",t.fillText(this.error,this.x+this.width/2,this.y+this.height/2);else if(this.loaded){if(this.video&&this.loaded){var e=this.video.videoWidth/this.video.videoHeight,n=this.width/this.height,r=this.width,i=this.height,o=0,a=0;e>n?(r=(i=this.height)*e,o=(this.width-r)/2):(i=(r=this.width)/e,a=(this.height-i)/2),t.drawImage(this.video,this.x+o,this.y+a,r,i),this.drawScannerOverlay(t),this.drawControls(t)}}else t.fillStyle="#fff",t.font="16px Arial",t.textAlign="center",t.textBaseline="middle",t.fillText("Démarrage caméra...",this.x+this.width/2,this.y+this.height/2);this.loaded&&!this.currentQRCode&&(t.fillStyle="rgba(255, 255, 255, 0.8)",t.font="16px Arial",t.textAlign="center",t.fillText("Placez un QR code dans le cadre",this.x+this.width/2,this.y+this.height/2+150)),t.restore()}}],r&&zr(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i,o,a,s}(u);function Qr(t){return Qr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qr(t)}function Kr(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Jr(r.key),r)}}function $r(t,e,n){return(e=Jr(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Jr(t){var e=function(t){if("object"!=Qr(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Qr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Qr(e)?e:e+""}var Zr=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)},e=[{key:"detect",value:function(){if(/iPhone/.test(navigator.userAgent)&&window.screen.height>=812&&(window.innerHeight>window.innerWidth?(this.top=44,this.bottom=34):(this.top=0,this.bottom=21,this.left=44,this.right=44)),CSS.supports("padding-top: env(safe-area-inset-top)")){var t=getComputedStyle(document.documentElement);this.top=parseInt(t.getPropertyValue("env(safe-area-inset-top)"))||0,this.bottom=parseInt(t.getPropertyValue("env(safe-area-inset-bottom)"))||0,this.left=parseInt(t.getPropertyValue("env(safe-area-inset-left)"))||0,this.right=parseInt(t.getPropertyValue("env(safe-area-inset-right)"))||0}}},{key:"applyToComponent",value:function(t){t.y+=this.top,t.x+=this.left,t.width-=this.left+this.right,t.height-=this.top+this.bottom}}],null&&Kr(t.prototype,null),e&&Kr(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();$r(Zr,"top",0),$r(Zr,"bottom",0),$r(Zr,"left",0),$r(Zr,"right",0);const ti=Zr;function ei(t){return ei="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ei(t)}function ni(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function ri(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?ni(Object(n),!0).forEach(function(e){ii(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ni(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function ii(t,e,n){return(e=ai(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function oi(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ai(r.key),r)}}function ai(t){var e=function(t){if("object"!=ei(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ei(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ei(e)?e:e+""}var si=function(){return t=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.rules=e,this.customMessages=n,this.errors={},this.defaultMessages={required:"This field is required",email:"Please enter a valid email address",min:"Value must be at least {min}",max:"Value must not exceed {max}",minLength:"Must be at least {minLength} characters",maxLength:"Must not exceed {maxLength} characters",pattern:"Invalid format",url:"Please enter a valid URL",numeric:"Must be a number",integer:"Must be an integer",phone:"Please enter a valid phone number",match:"Fields do not match",custom:"Invalid value"}},e=[{key:"validate",value:function(t){this.errors={};var e=!0;for(var n in this.rules){this.rules[n];var r=t[n],i=this.validateField(n,r,t);i.length>0&&(this.errors[n]=i,e=!1)}return e}},{key:"validateField",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=this.rules[t],i=[];if(!r)return i;if(r.required&&this.isEmpty(e))return i.push(this.getMessage(t,"required")),i;if(this.isEmpty(e)&&!r.required)return i;if(r.email&&!this.isEmail(e)&&i.push(this.getMessage(t,"email")),void 0!==r.min&&Number(e)<r.min&&i.push(this.getMessage(t,"min",{min:r.min})),void 0!==r.max&&Number(e)>r.max&&i.push(this.getMessage(t,"max",{max:r.max})),r.minLength&&String(e).length<r.minLength&&i.push(this.getMessage(t,"minLength",{minLength:r.minLength})),r.maxLength&&String(e).length>r.maxLength&&i.push(this.getMessage(t,"maxLength",{maxLength:r.maxLength})),r.pattern&&!r.pattern.test(e)&&i.push(this.getMessage(t,"pattern")),r.url&&!this.isURL(e)&&i.push(this.getMessage(t,"url")),r.numeric&&!this.isNumeric(e)&&i.push(this.getMessage(t,"numeric")),r.integer&&!this.isInteger(e)&&i.push(this.getMessage(t,"integer")),r.phone&&!this.isPhone(e)&&i.push(this.getMessage(t,"phone")),r.match&&e!==n[r.match]&&i.push(this.getMessage(t,"match")),r.custom&&"function"==typeof r.custom){var o=r.custom(e,n);!0!==o&&i.push("string"==typeof o?o:this.getMessage(t,"custom"))}return i}},{key:"getMessage",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=this.customMessages["".concat(t,".").concat(e)]||this.customMessages[e]||this.defaultMessages[e];for(var i in n)r=r.replace("{".concat(i,"}"),n[i]);return r}},{key:"isEmpty",value:function(t){return null==t||""===t||Array.isArray(t)&&0===t.length}},{key:"isEmail",value:function(t){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)}},{key:"isURL",value:function(t){try{return new URL(t),!0}catch(t){return!1}}},{key:"isNumeric",value:function(t){return!isNaN(parseFloat(t))&&isFinite(t)}},{key:"isInteger",value:function(t){return Number.isInteger(Number(t))}},{key:"isPhone",value:function(t){return/^[\d\s\-\+\(\)]+$/.test(t)&&t.replace(/\D/g,"").length>=10}},{key:"getErrors",value:function(){return this.errors}},{key:"getFieldErrors",value:function(t){return this.errors[t]||[]}},{key:"hasError",value:function(t){return this.errors[t]&&this.errors[t].length>0}},{key:"reset",value:function(){this.errors={}}},{key:"addRule",value:function(t,e){this.rules[t]=ri(ri({},this.rules[t]),e)}},{key:"removeRule",value:function(t){delete this.rules[t]}},{key:"validateAsync",value:function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:300;return this.validateTimer&&clearTimeout(this.validateTimer),new Promise(function(o){n.validateTimer=setTimeout(function(){var i=n.validateField(t,e,r);i.length>0?n.errors[t]=i:delete n.errors[t],o(i)},i)})}}],e&&oi(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();si.presets={login:{email:{required:!0,email:!0},password:{required:!0,minLength:8}},registration:{username:{required:!0,minLength:3,maxLength:20,pattern:/^[a-zA-Z0-9_]+$/},email:{required:!0,email:!0},password:{required:!0,minLength:8,pattern:/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)/},confirmPassword:{required:!0,match:"password"},terms:{required:!0}},contact:{name:{required:!0,minLength:2},email:{required:!0,email:!0},phone:{phone:!0},message:{required:!0,minLength:10,maxLength:500}},payment:{cardNumber:{required:!0,pattern:/^\d{16}$/},cardName:{required:!0,minLength:2},expiryDate:{required:!0,pattern:/^\d{2}\/\d{2}$/},cvv:{required:!0,pattern:/^\d{3,4}$/}}};const li=si;function ui(t){return ui="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ui(t)}function ci(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function hi(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?ci(Object(n),!0).forEach(function(e){fi(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ci(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function fi(t,e,n){return(e=xi(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function di(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,u=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(t){u=!0,i=t}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}(t,e)||yi(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function pi(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=yi(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function yi(t,e){if(t){if("string"==typeof t)return vi(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?vi(t,e):void 0}}function vi(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function mi(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var l=r&&r.prototype instanceof s?r:s,u=Object.create(l.prototype);return gi(u,"_invoke",function(n,r,i){var o,s,l,u=0,c=i||[],h=!1,f={p:0,n:0,v:t,a:d,f:d.bind(t,4),d:function(e,n){return o=e,s=0,l=t,f.n=n,a}};function d(n,r){for(s=n,l=r,e=0;!h&&u&&!i&&e<c.length;e++){var i,o=c[e],d=f.p,p=o[2];n>3?(i=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=t):o[0]<=d&&((i=n<2&&d<o[1])?(s=0,f.v=r,f.n=o[1]):d<p&&(i=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(i||n>1)return a;throw h=!0,r}return function(i,c,p){if(u>1)throw TypeError("Generator is already running");for(h&&1===c&&d(c,p),s=c,l=p;(e=s<2?t:l)||!h;){o||(s?s<3?(s>1&&(f.n=-1),d(s,l)):f.n=l:f.v=l);try{if(u=2,o){if(s||(i="next"),e=o[i]){if(!(e=e.call(o,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,s<2&&(s=0)}else 1===s&&(e=o.return)&&e.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+i+"' method"),s=1);o=t}else if((e=(h=f.n<0)?l:n.call(r,f))!==a)break}catch(e){o=t,s=1,l=e}finally{u=1}}return{value:e,done:h}}}(n,i,o),!0),u}var a={};function s(){}function l(){}function u(){}e=Object.getPrototypeOf;var c=[][r]?e(e([][r]())):(gi(e={},r,function(){return this}),e),h=u.prototype=s.prototype=Object.create(c);function f(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,u):(t.__proto__=u,gi(t,i,"GeneratorFunction")),t.prototype=Object.create(h),t}return l.prototype=u,gi(h,"constructor",u),gi(u,"constructor",l),l.displayName="GeneratorFunction",gi(u,i,"GeneratorFunction"),gi(h),gi(h,i,"Generator"),gi(h,r,function(){return this}),gi(h,"toString",function(){return"[object Generator]"}),(mi=function(){return{w:o,m:f}})()}function gi(t,e,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(t){i=0}gi=function(t,e,n,r){function o(e,n){gi(t,e,function(t){return this._invoke(e,n,t)})}e?i?i(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(o("next",0),o("throw",1),o("return",2))},gi(t,e,n,r)}function bi(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function wi(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,xi(r.key),r)}}function xi(t){var e=function(t){if("object"!=ui(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ui(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ui(e)?e:e+""}var ki=function(){return t=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.store=new Map,this.defaultTTL=e.defaultTTL||36e5,this.maxSize=e.maxSize||100,this.enableStats=!1!==e.enableStats,this.stats={hits:0,misses:0,sets:0,deletes:0,evictions:0},this.startCleanupInterval()},e=[{key:"set",value:function(t,e,n){var r=Date.now()+(n||this.defaultTTL);return this.store.size>=this.maxSize&&!this.store.has(t)&&this.evictOldest(),this.store.set(t,{value:e,expiresAt:r,createdAt:Date.now(),accessCount:0}),this.enableStats&&this.stats.sets++,this}},{key:"get",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=this.store.get(t);return n?Date.now()>n.expiresAt?(this.delete(t),this.enableStats&&this.stats.misses++,e):(n.accessCount++,this.enableStats&&this.stats.hits++,n.value):(this.enableStats&&this.stats.misses++,e)}},{key:"has",value:function(t){var e=this.store.get(t);return!(!e||Date.now()>e.expiresAt&&(this.delete(t),1))}},{key:"delete",value:function(t){var e=this.store.delete(t);return e&&this.enableStats&&this.stats.deletes++,e}},{key:"clear",value:function(){this.store.clear(),this.enableStats&&(this.stats={hits:0,misses:0,sets:0,deletes:0,evictions:0})}},{key:"getOrSet",value:(n=mi().m(function t(e,n,r){var i;return mi().w(function(t){for(;;)switch(t.n){case 0:if(!this.has(e)){t.n=1;break}return t.a(2,this.get(e));case 1:return t.n=2,n();case 2:return i=t.v,this.set(e,i,r),t.a(2,i)}},t,this)}),r=function(){var t=this,e=arguments;return new Promise(function(r,i){var o=n.apply(t,e);function a(t){bi(o,r,i,a,s,"next",t)}function s(t){bi(o,r,i,a,s,"throw",t)}a(void 0)})},function(t,e,n){return r.apply(this,arguments)})},{key:"getMany",value:function(t){var e,n={},r=pi(t);try{for(r.s();!(e=r.n()).done;){var i=e.value,o=this.get(i);null!==o&&(n[i]=o)}}catch(t){r.e(t)}finally{r.f()}return n}},{key:"setMany",value:function(t,e){for(var n in t)this.set(n,t[n],e);return this}},{key:"deleteMany",value:function(t){var e,n=0,r=pi(t);try{for(r.s();!(e=r.n()).done;){var i=e.value;this.delete(i)&&n++}}catch(t){r.e(t)}finally{r.f()}return n}},{key:"touch",value:function(t,e){var n=this.store.get(t);return!!n&&(n.expiresAt=Date.now()+(e||this.defaultTTL),!0)}},{key:"ttl",value:function(t){var e=this.store.get(t);if(!e)return-1;var n=e.expiresAt-Date.now();return n>0?n:-1}},{key:"evictOldest",value:function(){var t,e=null,n=1/0,r=pi(this.store.entries());try{for(r.s();!(t=r.n()).done;){var i=di(t.value,2),o=i[0],a=i[1],s=a.createdAt-1e3*a.accessCount;s<n&&(n=s,e=o)}}catch(t){r.e(t)}finally{r.f()}e&&(this.store.delete(e),this.enableStats&&this.stats.evictions++)}},{key:"cleanup",value:function(){var t,e=Date.now(),n=0,r=pi(this.store.entries());try{for(r.s();!(t=r.n()).done;){var i=di(t.value,2),o=i[0];e>i[1].expiresAt&&(this.store.delete(o),n++)}}catch(t){r.e(t)}finally{r.f()}return n}},{key:"startCleanupInterval",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:6e4;this.cleanupTimer&&clearInterval(this.cleanupTimer),this.cleanupTimer=setInterval(function(){t.cleanup()},e)}},{key:"stopCleanupInterval",value:function(){this.cleanupTimer&&(clearInterval(this.cleanupTimer),this.cleanupTimer=null)}},{key:"keys",value:function(){var t,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=[],r=Date.now(),i=pi(this.store.entries());try{for(i.s();!(t=i.n()).done;){var o=di(t.value,2),a=o[0],s=o[1];(e||r<=s.expiresAt)&&n.push(a)}}catch(t){i.e(t)}finally{i.f()}return n}},{key:"size",value:function(){return this.store.size}},{key:"getStats",value:function(){var t=this.stats.hits+this.stats.misses>0?(this.stats.hits/(this.stats.hits+this.stats.misses)*100).toFixed(2):0;return hi(hi({},this.stats),{},{size:this.store.size,hitRate:"".concat(t,"%"),maxSize:this.maxSize})}},{key:"resetStats",value:function(){this.stats={hits:0,misses:0,sets:0,deletes:0,evictions:0}}},{key:"export",value:function(){var t,e={},n=pi(this.store.entries());try{for(n.s();!(t=n.n()).done;){var r=di(t.value,2),i=r[0],o=r[1];e[i]={value:o.value,expiresAt:o.expiresAt,createdAt:o.createdAt}}}catch(t){n.e(t)}finally{n.f()}return JSON.stringify(e)}},{key:"import",value:function(t){var e=JSON.parse(t),n=Date.now();for(var r in e){var i=e[r];i.expiresAt>n&&this.store.set(r,{value:i.value,expiresAt:i.expiresAt,createdAt:i.createdAt,accessCount:0})}}},{key:"destroy",value:function(){this.stopCleanupInterval(),this.clear()}}],e&&wi(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n,r}();ki.global=new ki;const Si=ki;function Ti(t){return Ti="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ti(t)}function Pi(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var l=r&&r.prototype instanceof s?r:s,u=Object.create(l.prototype);return Oi(u,"_invoke",function(n,r,i){var o,s,l,u=0,c=i||[],h=!1,f={p:0,n:0,v:t,a:d,f:d.bind(t,4),d:function(e,n){return o=e,s=0,l=t,f.n=n,a}};function d(n,r){for(s=n,l=r,e=0;!h&&u&&!i&&e<c.length;e++){var i,o=c[e],d=f.p,p=o[2];n>3?(i=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=t):o[0]<=d&&((i=n<2&&d<o[1])?(s=0,f.v=r,f.n=o[1]):d<p&&(i=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(i||n>1)return a;throw h=!0,r}return function(i,c,p){if(u>1)throw TypeError("Generator is already running");for(h&&1===c&&d(c,p),s=c,l=p;(e=s<2?t:l)||!h;){o||(s?s<3?(s>1&&(f.n=-1),d(s,l)):f.n=l:f.v=l);try{if(u=2,o){if(s||(i="next"),e=o[i]){if(!(e=e.call(o,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,s<2&&(s=0)}else 1===s&&(e=o.return)&&e.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+i+"' method"),s=1);o=t}else if((e=(h=f.n<0)?l:n.call(r,f))!==a)break}catch(e){o=t,s=1,l=e}finally{u=1}}return{value:e,done:h}}}(n,i,o),!0),u}var a={};function s(){}function l(){}function u(){}e=Object.getPrototypeOf;var c=[][r]?e(e([][r]())):(Oi(e={},r,function(){return this}),e),h=u.prototype=s.prototype=Object.create(c);function f(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,u):(t.__proto__=u,Oi(t,i,"GeneratorFunction")),t.prototype=Object.create(h),t}return l.prototype=u,Oi(h,"constructor",u),Oi(u,"constructor",l),l.displayName="GeneratorFunction",Oi(u,i,"GeneratorFunction"),Oi(h),Oi(h,i,"Generator"),Oi(h,r,function(){return this}),Oi(h,"toString",function(){return"[object Generator]"}),(Pi=function(){return{w:o,m:f}})()}function Oi(t,e,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(t){i=0}Oi=function(t,e,n,r){function o(e,n){Oi(t,e,function(t){return this._invoke(e,n,t)})}e?i?i(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(o("next",0),o("throw",1),o("return",2))},Oi(t,e,n,r)}function Ci(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function Ei(t){return function(t){if(Array.isArray(t))return Ri(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Fi(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ji(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,u=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(t){u=!0,i=t}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}(t,e)||Fi(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ii(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=Fi(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function Fi(t,e){if(t){if("string"==typeof t)return Ri(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ri(t,e):void 0}}function Ri(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Mi(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function Ai(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Mi(Object(n),!0).forEach(function(e){_i(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Mi(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function _i(t,e,n){return(e=Bi(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Di(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Bi(r.key),r)}}function Bi(t){var e=function(t){if("object"!=Ti(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ti(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ti(e)?e:e+""}var Li=function(){return t=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.events=new Map,this.history=[],this.enableHistory=e.enableHistory||!1,this.maxHistory=e.maxHistory||100,this.enableWildcard=!1!==e.enableWildcard,this.middlewares=[]},e=[{key:"on",value:function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if("function"!=typeof e)throw new Error("Callback must be a function");this.events.has(t)||this.events.set(t,[]);var i={callback:e,once:r.once||!1,priority:r.priority||0,id:this.generateId()},o=this.events.get(t);return o.push(i),o.sort(function(t,e){return e.priority-t.priority}),function(){return n.off(t,i.id)}}},{key:"once",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.on(t,e,Ai(Ai({},n),{},{once:!0}))}},{key:"off",value:function(t,e){var n=this.events.get(t);if(!n)return!1;if(!e)return this.events.delete(t),!0;var r=n.findIndex(function(t){return t.callback===e||t.id===e});return r>-1&&(n.splice(r,1),0===n.length&&this.events.delete(t),!0)}},{key:"emit",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];this.enableHistory&&this.addToHistory(t,n);var i,o=!0,a=Ii(this.middlewares);try{for(a.s();!(i=a.n()).done;)if(!1===(0,i.value)(t,n)){o=!1;break}}catch(t){a.e(t)}finally{a.f()}if(!o)return 0;var s=0,l=this.events.get(t);return l&&(s+=this.executeListeners(l,t,n)),this.enableWildcard&&(s+=this.emitWildcard(t,n)),s}},{key:"emitWildcard",value:function(t,e){var n,r=0,i=Ii(this.events.entries());try{for(i.s();!(n=i.n()).done;){var o=ji(n.value,2),a=o[0],s=o[1];a.includes("*")&&this.matchWildcard(t,a)&&(r+=this.executeListeners(s,t,e))}}catch(t){i.e(t)}finally{i.f()}return r}},{key:"matchWildcard",value:function(t,e){return new RegExp("^"+e.replace(/\*/g,".*")+"$").test(t)}},{key:"executeListeners",value:function(t,e,n){var r,i=0,o=[],a=Ii(t);try{for(a.s();!(r=a.n()).done;){var s=r.value;try{s.callback.apply(s,Ei(n)),i++,s.once&&o.push(s.id)}catch(t){console.error('Error in event listener for "'.concat(e,'":'),t)}}}catch(t){a.e(t)}finally{a.f()}for(var l=0,u=o;l<u.length;l++){var c=u[l];this.off(e,c)}return i}},{key:"emitAsync",value:(n=Pi().m(function t(e){var n,r,i,o,a,s,l,u,c,h,f=arguments;return Pi().w(function(t){for(;;)switch(t.p=t.n){case 0:for(n=f.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=f[i];if(this.enableHistory&&this.addToHistory(e,r),o=0,!(a=this.events.get(e))){t.n=10;break}s=Ii(a),t.p=1,s.s();case 2:if((l=s.n()).done){t.n=7;break}return u=l.value,t.p=3,t.n=4,u.callback.apply(u,r);case 4:o++,u.once&&this.off(e,u.id),t.n=6;break;case 5:t.p=5,c=t.v,console.error('Error in async event listener for "'.concat(e,'":'),c);case 6:t.n=2;break;case 7:t.n=9;break;case 8:t.p=8,h=t.v,s.e(h);case 9:return t.p=9,s.f(),t.f(9);case 10:return t.a(2,o)}},t,this,[[3,5],[1,8,9,10]])}),r=function(){var t=this,e=arguments;return new Promise(function(r,i){var o=n.apply(t,e);function a(t){Ci(o,r,i,a,s,"next",t)}function s(t){Ci(o,r,i,a,s,"throw",t)}a(void 0)})},function(t){return r.apply(this,arguments)})},{key:"waitFor",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return new Promise(function(r,i){var o,a=e.once(t,function(){o&&clearTimeout(o);for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];r(e)});n>0&&(o=setTimeout(function(){a(),i(new Error('Timeout waiting for event "'.concat(t,'"')))},n))})}},{key:"use",value:function(t){if("function"!=typeof t)throw new Error("Middleware must be a function");this.middlewares.push(t)}},{key:"removeMiddleware",value:function(t){var e=this.middlewares.indexOf(t);e>-1&&this.middlewares.splice(e,1)}},{key:"eventNames",value:function(){return Array.from(this.events.keys())}},{key:"listenerCount",value:function(t){var e=this.events.get(t);return e?e.length:0}},{key:"clear",value:function(){this.events.clear()}},{key:"addToHistory",value:function(t,e){this.history.push({event:t,args:e,timestamp:Date.now()}),this.history.length>this.maxHistory&&this.history.shift()}},{key:"getHistory",value:function(t){return t?this.history.filter(function(e){return e.event===t}):this.history}},{key:"clearHistory",value:function(){this.history=[]}},{key:"replay",value:function(t){var e,n=Ii(this.getHistory(t));try{for(n.s();!(e=n.n()).done;){var r=e.value;this.emit.apply(this,[r.event].concat(Ei(r.args)))}}catch(t){n.e(t)}finally{n.f()}}},{key:"generateId",value:function(){return"".concat(Date.now(),"-").concat(Math.random().toString(36).substr(2,9))}},{key:"debug",value:function(){console.log("EventBus Debug:"),console.log("Events:",this.eventNames());var t,e=Ii(this.events.entries());try{for(e.s();!(t=e.n()).done;){var n=ji(t.value,2),r=n[0],i=n[1];console.log(" ".concat(r,": ").concat(i.length," listener(s)")),i.forEach(function(t,e){console.log(" [".concat(e,"] Priority: ").concat(t.priority,", Once: ").concat(t.once))})}}catch(t){e.e(t)}finally{e.f()}this.enableHistory&&console.log("History:",this.history.length,"events")}}],e&&Di(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n,r}();Li.global=new Li,Li.on=function(){var t;return(t=Li.global).on.apply(t,arguments)},Li.once=function(){var t;return(t=Li.global).once.apply(t,arguments)},Li.off=function(){var t;return(t=Li.global).off.apply(t,arguments)},Li.emit=function(){var t;return(t=Li.global).emit.apply(t,arguments)},Li.emitAsync=function(){var t;return(t=Li.global).emitAsync.apply(t,arguments)},Li.waitFor=function(){var t;return(t=Li.global).waitFor.apply(t,arguments)};const Wi=Li;function Hi(t){return Hi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hi(t)}function zi(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,u=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(t){u=!0,i=t}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}(t,e)||$i(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function qi(t){if(null!=t){var e=t["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],n=0;if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length))return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}}throw new TypeError(Hi(t)+" is not iterable")}function Ui(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var l=r&&r.prototype instanceof s?r:s,u=Object.create(l.prototype);return Ni(u,"_invoke",function(n,r,i){var o,s,l,u=0,c=i||[],h=!1,f={p:0,n:0,v:t,a:d,f:d.bind(t,4),d:function(e,n){return o=e,s=0,l=t,f.n=n,a}};function d(n,r){for(s=n,l=r,e=0;!h&&u&&!i&&e<c.length;e++){var i,o=c[e],d=f.p,p=o[2];n>3?(i=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=t):o[0]<=d&&((i=n<2&&d<o[1])?(s=0,f.v=r,f.n=o[1]):d<p&&(i=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(i||n>1)return a;throw h=!0,r}return function(i,c,p){if(u>1)throw TypeError("Generator is already running");for(h&&1===c&&d(c,p),s=c,l=p;(e=s<2?t:l)||!h;){o||(s?s<3?(s>1&&(f.n=-1),d(s,l)):f.n=l:f.v=l);try{if(u=2,o){if(s||(i="next"),e=o[i]){if(!(e=e.call(o,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,s<2&&(s=0)}else 1===s&&(e=o.return)&&e.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+i+"' method"),s=1);o=t}else if((e=(h=f.n<0)?l:n.call(r,f))!==a)break}catch(e){o=t,s=1,l=e}finally{u=1}}return{value:e,done:h}}}(n,i,o),!0),u}var a={};function s(){}function l(){}function u(){}e=Object.getPrototypeOf;var c=[][r]?e(e([][r]())):(Ni(e={},r,function(){return this}),e),h=u.prototype=s.prototype=Object.create(c);function f(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,u):(t.__proto__=u,Ni(t,i,"GeneratorFunction")),t.prototype=Object.create(h),t}return l.prototype=u,Ni(h,"constructor",u),Ni(u,"constructor",l),l.displayName="GeneratorFunction",Ni(u,i,"GeneratorFunction"),Ni(h),Ni(h,i,"Generator"),Ni(h,r,function(){return this}),Ni(h,"toString",function(){return"[object Generator]"}),(Ui=function(){return{w:o,m:f}})()}function Ni(t,e,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(t){i=0}Ni=function(t,e,n,r){function o(e,n){Ni(t,e,function(t){return this._invoke(e,n,t)})}e?i?i(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(o("next",0),o("throw",1),o("return",2))},Ni(t,e,n,r)}function Vi(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function Gi(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Vi(Object(n),!0).forEach(function(e){Yi(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Vi(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function Yi(t,e,n){return(e=to(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Xi(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function Qi(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function a(t){Xi(o,r,i,a,s,"next",t)}function s(t){Xi(o,r,i,a,s,"throw",t)}a(void 0)})}}function Ki(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=$i(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function $i(t,e){if(t){if("string"==typeof t)return Ji(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ji(t,e):void 0}}function Ji(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Zi(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,to(r.key),r)}}function to(t){var e=function(t){if("object"!=Hi(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Hi(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Hi(e)?e:e+""}const eo=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.animations=new Map,this.isRunning=!1,this.animationFrameId=null,this.batchQueue=[],this.batchScheduled=!1,this.worker=null,this.workerEnabled=!0,this.initWorker(),this.offscreenCache=new Map},e=[{key:"initWorker",value:function(){var t=this;if(!window.Worker)return this.workerEnabled=!1,void console.warn("Web Workers non supportés, fallback sur le thread principal");var e=new Blob(["\n // Fonctions d'easing dans le Worker\n const easings = {\n linear: t => t,\n easeInQuad: t => t * t,\n easeOutQuad: t => t * (2 - t),\n easeInOutQuad: t => t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t,\n easeInCubic: t => t * t * t,\n easeOutCubic: t => (--t) * t * t + 1,\n easeInOutCubic: t => t < 0.5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1,\n easeInQuart: t => t * t * t * t,\n easeOutQuart: t => 1 - (--t) * t * t * t,\n easeInOutQuart: t => t < 0.5 ? 8 * t * t * t * t : 1 - 8 * (--t) * t * t * t,\n easeInElastic: t => {\n const c4 = (2 * Math.PI) / 3;\n return t === 0 ? 0 : t === 1 ? 1 : -Math.pow(2, 10 * t - 10) * Math.sin((t * 10 - 10.75) * c4);\n },\n easeOutElastic: t => {\n const c4 = (2 * Math.PI) / 3;\n return t === 0 ? 0 : t === 1 ? 1 : Math.pow(2, -10 * t) * Math.sin((t * 10 - 0.75) * c4) + 1;\n },\n easeOutBounce: t => {\n const n1 = 7.5625;\n const d1 = 2.75;\n if (t < 1 / d1) return n1 * t * t;\n else if (t < 2 / d1) return n1 * (t -= 1.5 / d1) * t + 0.75;\n else if (t < 2.5 / d1) return n1 * (t -= 2.25 / d1) * t + 0.9375;\n else return n1 * (t -= 2.625 / d1) * t + 0.984375;\n }\n };\n\n // Calculer les valeurs d'animation\n self.onmessage = function(e) {\n const { type, data } = e.data;\n\n if (type === 'CALCULATE_BATCH') {\n const { animations, currentTime } = data;\n const results = [];\n\n for (let anim of animations) {\n // Gérer le délai\n if (anim.isDelaying) {\n if (!anim.delayStartTime) {\n anim.delayStartTime = currentTime;\n }\n \n if (currentTime - anim.delayStartTime >= anim.delay) {\n anim.isDelaying = false;\n anim.startTime = currentTime;\n } else {\n results.push({ id: anim.id, status: 'delaying', animation: anim });\n continue;\n }\n }\n\n // Initialiser le temps de départ\n if (!anim.startTime) {\n anim.startTime = currentTime;\n }\n\n // Calculer la progression\n const elapsed = currentTime - anim.startTime;\n let progress = Math.min(elapsed / anim.duration, 1);\n\n // Appliquer l'easing\n const easingFunc = easings[anim.easing] || easings.linear;\n const easedProgress = easingFunc(progress);\n\n // Inverser si yoyo\n const actualProgress = anim.isReversed ? 1 - easedProgress : easedProgress;\n\n // Calculer les nouvelles valeurs\n const values = {};\n for (let prop in anim.to) {\n const from = anim.from[prop];\n const to = anim.to[prop];\n values[prop] = from + (to - from) * actualProgress;\n }\n\n // Déterminer le statut\n let status = 'running';\n let newState = { ...anim };\n\n if (progress >= 1) {\n if (anim.yoyo && !anim.isReversed) {\n status = 'yoyo';\n newState.isReversed = true;\n newState.startTime = currentTime;\n } else if (anim.loop) {\n status = 'loop';\n newState.startTime = currentTime;\n newState.isReversed = false;\n } else {\n status = 'complete';\n }\n }\n\n results.push({\n id: anim.id,\n status,\n values,\n actualProgress,\n animation: newState\n });\n }\n\n self.postMessage({ type: 'BATCH_RESULT', results });\n }\n };\n "],{type:"application/javascript"}),n=URL.createObjectURL(e);try{this.worker=new Worker(n),this.worker.onmessage=function(e){"BATCH_RESULT"===e.data.type&&t.applyBatchResults(e.data.results)},this.worker.onerror=function(e){console.error("Erreur Worker:",e),t.workerEnabled=!1}}catch(t){console.error("Impossible de créer le Worker:",t),this.workerEnabled=!1}}},{key:"applyBatchResults",value:function(t){var e,n=this,r=[],i=Ki(t);try{for(i.s();!(e=i.n()).done;){var o=e.value,a=this.animations.get(o.id);if(a)if("delaying"!==o.status){if(o.values)for(var s in o.values)a.component[s]=o.values[s];a.onUpdate&&a.onUpdate(o.actualProgress),"yoyo"===o.status||"loop"===o.status?Object.assign(a,o.animation):"complete"===o.status&&(a.onComplete&&a.onComplete(),r.push(o.id))}else Object.assign(a,o.animation)}}catch(t){i.e(t)}finally{i.f()}r.forEach(function(t){return n.stop(t)})}},{key:"createOffscreenCache",value:function(t,e,n,r){if(!window.OffscreenCanvas)return console.warn("OffscreenCanvas non supporté"),null;var i=new OffscreenCanvas(e,n);return r(i.getContext("2d")),this.offscreenCache.set(t,i),i}},{key:"getOffscreenCache",value:function(t){return this.offscreenCache.get(t)}},{key:"clearOffscreenCache",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;t?this.offscreenCache.delete(t):this.offscreenCache.clear()}},{key:"animate",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.generateId(),r={id:n,component:t,from:e.from||{},to:e.to||{},duration:e.duration||300,easing:e.easing||"easeInOutQuad",delay:e.delay||0,onUpdate:e.onUpdate,onComplete:e.onComplete,loop:e.loop||!1,yoyo:e.yoyo||!1,startTime:null,delayStartTime:null,progress:0,isDelaying:e.delay>0,isReversed:!1,originalValues:{}};for(var i in r.to)void 0===r.from[i]&&(r.from[i]=t[i]),r.originalValues[i]=t[i];return this.animations.set(n,r),this.isRunning||this.start(),n}},{key:"animateSequence",value:(r=Qi(Ui().m(function t(e,n){var r,i,o,a,s=this;return Ui().w(function(t){for(;;)switch(t.p=t.n){case 0:r=Ki(n),t.p=1,o=Ui().m(function t(){var n;return Ui().w(function(t){for(;;)switch(t.n){case 0:return n=i.value,t.n=1,new Promise(function(t){s.animate(e,Gi(Gi({},n),{},{onComplete:function(){n.onComplete&&n.onComplete(),t()}}))});case 1:return t.a(2)}},t)}),r.s();case 2:if((i=r.n()).done){t.n=4;break}return t.d(qi(o()),3);case 3:t.n=2;break;case 4:t.n=6;break;case 5:t.p=5,a=t.v,r.e(a);case 6:return t.p=6,r.f(),t.f(6);case 7:return t.a(2)}},t,null,[[1,5,6,7]])})),function(t,e){return r.apply(this,arguments)})},{key:"animateParallel",value:(n=Qi(Ui().m(function t(e){var n,r=this;return Ui().w(function(t){for(;;)if(0===t.n)return n=e.map(function(t){var e=t.component,n=t.options;return new Promise(function(t){r.animate(e,Gi(Gi({},n),{},{onComplete:function(){n.onComplete&&n.onComplete(),t()}}))})}),t.a(2,Promise.all(n))},t)})),function(t){return n.apply(this,arguments)})},{key:"bounce",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.y,r=e.height||50;return this.animate(t,{from:{y:n},to:{y:n-r},duration:e.duration||400,easing:"easeOutQuad",yoyo:!0,onComplete:e.onComplete})}},{key:"shake",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.x,r=e.intensity||10,i=e.shakes||4,o=e.duration||400,a=[],s=0;s<i;s++)a.push({to:{x:n+(s%2==0?r:-r)},duration:o/(2*i),easing:"linear"});return a.push({to:{x:n},duration:o/(2*i),easing:"linear",onComplete:e.onComplete}),this.animateSequence(t,a)}},{key:"pulse",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.width,r=t.height,i=e.scale||1.1;return this.animate(t,{from:{width:n,height:r},to:{width:n*i,height:r*i},duration:e.duration||300,easing:"easeInOutQuad",yoyo:!0,loop:e.loop||!1,onComplete:e.onComplete})}},{key:"fade",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return void 0===t.opacity&&(t.opacity=1),this.animate(t,{from:{opacity:void 0!==e.from?e.from:t.opacity},to:{opacity:void 0!==e.to?e.to:0},duration:e.duration||300,easing:e.easing||"linear",onComplete:e.onComplete})}},{key:"slide",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.animate(t,{from:e.from||{x:t.x,y:t.y},to:e.to||{x:t.x+100,y:t.y},duration:e.duration||400,easing:e.easing||"easeOutQuad",onComplete:e.onComplete})}},{key:"rotate",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return void 0===t.rotation&&(t.rotation=0),this.animate(t,{from:{rotation:void 0!==e.from?e.from:t.rotation},to:{rotation:void 0!==e.to?e.to:360},duration:e.duration||1e3,easing:e.easing||"linear",loop:e.loop||!1,onComplete:e.onComplete})}},{key:"stop",value:function(t){this.animations.delete(t),0===this.animations.size&&(this.isRunning=!1,this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null))}},{key:"stopAll",value:function(t){var e,n=this,r=[],i=Ki(this.animations);try{for(i.s();!(e=i.n()).done;){var o=zi(e.value,2),a=o[0];o[1].component===t&&r.push(a)}}catch(t){i.e(t)}finally{i.f()}r.forEach(function(t){return n.stop(t)})}},{key:"start",value:function(){this.isRunning=!0,this.lastTime=performance.now(),this.update()}},{key:"update",value:function(){var t=this,e=performance.now();this.workerEnabled&&this.worker?this.updateWithWorker(e):this.updateOnMainThread(e),this.animations.size>0?this.animationFrameId=requestAnimationFrame(function(){return t.update()}):this.isRunning=!1}},{key:"updateWithWorker",value:function(t){var e,n=[],r=Ki(this.animations);try{for(r.s();!(e=r.n()).done;){var i=zi(e.value,2),o=(i[0],i[1]);n.push({id:o.id,from:o.from,to:o.to,duration:o.duration,easing:o.easing,delay:o.delay,loop:o.loop,yoyo:o.yoyo,startTime:o.startTime,delayStartTime:o.delayStartTime,isDelaying:o.isDelaying,isReversed:o.isReversed})}}catch(t){r.e(t)}finally{r.f()}n.length>0&&this.worker.postMessage({type:"CALCULATE_BATCH",data:{animations:n,currentTime:t}})}},{key:"updateOnMainThread",value:function(t){var e,n=this,r=[],i=Ki(this.animations);try{for(i.s();!(e=i.n()).done;){var o=zi(e.value,2),a=o[0],s=o[1];if(s.isDelaying)s.delayStartTime||(s.delayStartTime=t),t-s.delayStartTime>=s.delay&&(s.isDelaying=!1,s.startTime=t);else{s.startTime||(s.startTime=t);var l=t-s.startTime,u=Math.min(l/s.duration,1),c=this.applyEasing(u,s.easing),h=s.isReversed?1-c:c;for(var f in s.to){var d=s.from[f],p=d+(s.to[f]-d)*h;s.component[f]=p}s.onUpdate&&s.onUpdate(h),u>=1&&(s.yoyo&&!s.isReversed?(s.isReversed=!0,s.startTime=t):s.loop?(s.startTime=t,s.isReversed=!1):(s.onComplete&&s.onComplete(),r.push(a)))}}}catch(t){i.e(t)}finally{i.f()}r.forEach(function(t){return n.stop(t)})}},{key:"applyEasing",value:function(t,e){var n={linear:function(t){return t},easeInQuad:function(t){return t*t},easeOutQuad:function(t){return t*(2-t)},easeInOutQuad:function(t){return t<.5?2*t*t:(4-2*t)*t-1},easeInCubic:function(t){return t*t*t},easeOutCubic:function(t){return--t*t*t+1},easeInOutCubic:function(t){return t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1},easeInQuart:function(t){return t*t*t*t},easeOutQuart:function(t){return 1- --t*t*t*t},easeInOutQuart:function(t){return t<.5?8*t*t*t*t:1-8*--t*t*t*t},easeInElastic:function(t){var e=2*Math.PI/3;return 0===t?0:1===t?1:-Math.pow(2,10*t-10)*Math.sin((10*t-10.75)*e)},easeOutElastic:function(t){var e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},easeOutBounce:function(t){var e=7.5625,n=2.75;return t<1/n?e*t*t:t<2/n?e*(t-=1.5/n)*t+.75:t<2.5/n?e*(t-=2.25/n)*t+.9375:e*(t-=2.625/n)*t+.984375}};return(n[e]||n.linear)(t)}},{key:"generateId",value:function(){return"anim_".concat(Date.now(),"_").concat(Math.random().toString(36).substr(2,9))}},{key:"clear",value:function(){this.animations.clear(),this.isRunning=!1,this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null),this.clearOffscreenCache()}},{key:"destroy",value:function(){this.clear(),this.worker&&(this.worker.terminate(),this.worker=null)}}],e&&Zi(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n,r}();function no(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function ro(t){return ro="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ro(t)}function io(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,oo(r.key),r)}}function oo(t){var e=function(t){if("object"!=ro(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ro(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ro(e)?e:e+""}const ao=function(){return t=function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.framework=e,this.isOpen=!1,this.currentTab="components",this.panels={},this.hoveredComponent=null,this.selectedComponent=null,this.performanceStats={fps:[],memory:[],drawCalls:[]},this.consoleLogs=[],this.maxConsoleLogs=100,this.consoleFilters={log:!0,warn:!0,error:!0,debug:!0,info:!0},this.setupUI()},e=[{key:"setupUI",value:function(){var t=this;this.container=document.createElement("div"),this.container.style.cssText="\n position: fixed;\n top: 0;\n right: 0;\n width: 400px;\n height: 100vh;\n background: #1e1e1e;\n color: #fff;\n font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;\n font-size: 12px;\n z-index: 9999;\n transform: translateX(100%);\n transition: transform 0.3s ease;\n display: flex;\n flex-direction: column;\n box-shadow: -2px 0 10px rgba(0,0,0,0.5);\n ",this.header=document.createElement("div"),this.header.style.cssText="\n background: #252526;\n padding: 10px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n border-bottom: 1px solid #333;\n user-select: none;\n ",this.title=document.createElement("div"),this.title.textContent="Canvas Framework DevTools",this.title.style.fontWeight="bold",this.closeBtn=document.createElement("button"),this.closeBtn.textContent="×",this.closeBtn.style.cssText="\n background: transparent;\n border: none;\n color: #fff;\n font-size: 20px;\n cursor: pointer;\n padding: 0 8px;\n ",this.closeBtn.onclick=function(){return t.toggle()},this.header.appendChild(this.title),this.header.appendChild(this.closeBtn),this.tabs=document.createElement("div"),this.tabs.style.cssText="\n\t display: flex;\n\t background: #2d2d2d;\n\t border-bottom: 1px solid #333;\n\t overflow-x: auto;\n\t overflow-y: hidden;\n\t scrollbar-width: thin;\n\t scrollbar-color: #555 #2d2d2d;\n\t";var e=document.createElement("style");e.textContent="\n\t #devtools-tabs::-webkit-scrollbar {\n\t\theight: 6px;\n\t }\n\t \n\t #devtools-tabs::-webkit-scrollbar-track {\n\t\tbackground: #2d2d2d;\n\t }\n\t \n\t #devtools-tabs::-webkit-scrollbar-thumb {\n\t\tbackground: #555;\n\t\tborder-radius: 3px;\n\t }\n\t \n\t #devtools-tabs::-webkit-scrollbar-thumb:hover {\n\t\tbackground: #666;\n\t }\n\t",document.head.appendChild(e),this.tabs.id="devtools-tabs",[{id:"components",label:"Composants"},{id:"performance",label:"Performance"},{id:"hierarchy",label:"Hiérarchie"},{id:"properties",label:"Propriétés"},{id:"events",label:"Événements"},{id:"routing",label:"Routing"},{id:"console",label:"Console"}].forEach(function(e){var n=document.createElement("button");n.textContent=e.label,n.dataset.tab=e.id,n.style.cssText="\n flex: 1;\n padding: 8px;\n background: transparent;\n border: none;\n color: #ccc;\n cursor: pointer;\n border-bottom: 2px solid transparent;\n ",n.onclick=function(){return t.switchTab(e.id)},t.tabs.appendChild(n)}),this.content=document.createElement("div"),this.content.style.cssText="\n flex: 1;\n overflow: auto;\n padding: 10px;\n ",this.createComponentsPanel(),this.createPerformancePanel(),this.createHierarchyPanel(),this.createPropertiesPanel(),this.createEventsPanel(),this.createRoutingPanel(),this.createConsolePanel(),this.container.appendChild(this.header),this.container.appendChild(this.tabs),this.container.appendChild(this.content),document.body.appendChild(this.container),this.toggleBtn=document.createElement("button"),this.toggleBtn.textContent="DevTools",this.toggleBtn.style.cssText="\n position: fixed;\n bottom: 20px;\n right: 20px;\n background: #007acc;\n color: white;\n border: none;\n border-radius: 4px;\n padding: 8px 12px;\n font-size: 12px;\n cursor: pointer;\n z-index: 10000;\n box-shadow: 0 2px 5px rgba(0,0,0,0.2);\n ",this.toggleBtn.onclick=function(){return t.toggle()},document.body.appendChild(this.toggleBtn),this.setupHotkeys()}},{key:"createComponentsPanel",value:function(){var t=this,e=document.createElement("div");e.id="components-panel",e.style.display="none";var n=document.createElement("div");n.style.cssText="\n background: #252526;\n padding: 8px;\n border-radius: 4px;\n margin-bottom: 10px;\n ",n.innerHTML='\n <div style="display: flex; justify-content: space-between;">\n <span>Total: <span id="component-count">0</span></span>\n <span>Visibles: <span id="visible-count">0</span></span>\n <span>Dirty: <span id="dirty-count">0</span></span>\n </div>\n ';var r=document.createElement("input");r.type="text",r.placeholder="Filtrer les composants...",r.style.cssText="\n width: 100%;\n padding: 6px;\n margin-bottom: 10px;\n background: #333;\n border: 1px solid #555;\n color: #fff;\n border-radius: 4px;\n ";var i=document.createElement("div");i.id="component-list",i.style.cssText="\n max-height: 400px;\n overflow-y: auto;\n border: 1px solid #333;\n border-radius: 4px;\n ";var o=document.createElement("div");o.style.cssText="\n display: flex;\n gap: 8px;\n margin-top: 10px;\n ";var a=document.createElement("button");a.textContent="Toggle All",a.style.cssText="\n flex: 1;\n padding: 6px;\n background: #555;\n color: #fff;\n border: none;\n border-radius: 4px;\n cursor: pointer;\n ",a.onclick=function(){return t.toggleAllComponents()};var s=document.createElement("button");s.textContent="Refresh",s.style.cssText=a.style.cssText,s.onclick=function(){return t.refreshComponents()},o.appendChild(a),o.appendChild(s),e.appendChild(n),e.appendChild(r),e.appendChild(i),e.appendChild(o),this.content.appendChild(e),this.panels.components=e}},{key:"createPerformancePanel",value:function(){var t=document.createElement("div");t.id="performance-panel",t.style.display="none";var e=document.createElement("div");e.style.marginBottom="20px";var n=document.createElement("h3");n.textContent="FPS",n.style.marginBottom="8px";var r=document.createElement("canvas");r.width=380,r.height=100,r.style.cssText="\n width: 100%;\n height: 100px;\n background: #252526;\n border-radius: 4px;\n ",e.appendChild(n),e.appendChild(r);var i=document.createElement("div");i.style.marginBottom="20px";var o=document.createElement("h3");o.textContent="Mémoire",o.style.marginBottom="8px";var a=document.createElement("div");a.id="memory-info",a.style.cssText="\n background: #252526;\n padding: 8px;\n border-radius: 4px;\n font-family: monospace;\n ",i.appendChild(o),i.appendChild(a);var s=document.createElement("div"),l=document.createElement("h3");l.textContent="Conseils d'optimisation",l.style.marginBottom="8px";var u=document.createElement("ul");u.style.cssText="\n padding-left: 20px;\n color: #aaa;\n ",u.innerHTML="\n <li>Activer l'optimizationEnabled</li>\n <li>Réduire le nombre de composants visibles</li>\n <li>Utiliser VirtualList pour les longues listes</li>\n <li>Éviter les animations sur trop de composants</li>\n ",s.appendChild(l),s.appendChild(u),t.appendChild(e),t.appendChild(i),t.appendChild(s),this.content.appendChild(t),this.panels.performance=t,this.fpsCanvas=r}},{key:"createHierarchyPanel",value:function(){var t=document.createElement("div");t.id="hierarchy-panel",t.style.display="none";var e=document.createElement("div");e.id="component-tree",e.style.cssText="\n font-family: monospace;\n line-height: 1.4;\n ",t.appendChild(e),this.content.appendChild(t),this.panels.hierarchy=t}},{key:"createPropertiesPanel",value:function(){var t=document.createElement("div");t.id="properties-panel",t.style.display="none";var e=document.createElement("div");e.id="no-selection",e.textContent="Sélectionnez un composant pour voir ses propriétés",e.style.color="#888";var n=document.createElement("div");n.id="properties-table",n.style.display="none",t.appendChild(e),t.appendChild(n),this.content.appendChild(t),this.panels.properties=t}},{key:"createEventsPanel",value:function(){var t=this,e=document.createElement("div");e.id="events-panel",e.style.display="none";var n=document.createElement("div");n.id="events-list",n.style.cssText="\n max-height: 400px;\n overflow-y: auto;\n border: 1px solid #333;\n border-radius: 4px;\n padding: 8px;\n ";var r=document.createElement("button");r.textContent="Clear Events",r.style.cssText="\n margin-top: 10px;\n padding: 6px 12px;\n background: #555;\n color: #fff;\n border: none;\n border-radius: 4px;\n cursor: pointer;\n ",r.onclick=function(){return t.clearEvents()},e.appendChild(n),e.appendChild(r),this.content.appendChild(e),this.panels.events=e,this.eventsList=n}},{key:"createRoutingPanel",value:function(){var t=document.createElement("div");t.id="routing-panel",t.style.display="none";var e=document.createElement("div");e.id="route-info",e.style.cssText="\n background: #252526;\n padding: 10px;\n border-radius: 4px;\n margin-bottom: 10px;\n ";var n=document.createElement("div"),r=document.createElement("h3");r.textContent="Historique de navigation",r.style.marginBottom="8px";var i=document.createElement("div");i.id="history-list",i.style.cssText="\n max-height: 200px;\n overflow-y: auto;\n border: 1px solid #333;\n border-radius: 4px;\n padding: 8px;\n ",n.appendChild(r),n.appendChild(i),t.appendChild(e),t.appendChild(n),this.content.appendChild(t),this.panels.routing=t}},{key:"createConsolePanel",value:function(){var t=this,e=document.createElement("div");e.id="console-panel",e.style.display="none";var n=document.createElement("div");n.style.cssText="\n\t\tdisplay: flex;\n\t\tgap: 10px;\n\t\tpadding: 8px;\n\t\tbackground: #252526;\n\t\tborder-radius: 4px;\n\t\tmargin-bottom: 10px;\n\t\tflex-wrap: wrap;\n\t ",[{type:"log",label:"Log",color:"#d4d4d4"},{type:"info",label:"Info",color:"#4ec9b0"},{type:"warn",label:"Warn",color:"#dcdcaa"},{type:"error",label:"Error",color:"#f48771"},{type:"debug",label:"Debug",color:"#569cd6"}].forEach(function(e){var r=e.type,i=e.label,o=e.color,a=document.createElement("button");a.textContent=i,a.dataset.type=r,a.style.cssText="\n\t\t padding: 4px 12px;\n\t\t background: ".concat(t.consoleFilters[r]?o:"#555",";\n\t\t color: ").concat(t.consoleFilters[r]?"#000":"#aaa",";\n\t\t border: none;\n\t\t border-radius: 3px;\n\t\t cursor: pointer;\n\t\t font-size: 11px;\n\t\t font-weight: bold;\n\t\t transition: all 0.2s;\n\t\t"),a.onclick=function(){t.consoleFilters[r]=!t.consoleFilters[r],a.style.background=t.consoleFilters[r]?o:"#555",a.style.color=t.consoleFilters[r]?"#000":"#aaa",t.updateConsolePanel()},n.appendChild(a)});var r=document.createElement("div");r.id="console-list",r.style.cssText="\n\t\tmax-height: 400px;\n\t\toverflow-y: auto;\n\t\tborder: 1px solid #333;\n\t\tborder-radius: 4px;\n\t\tbackground: #1e1e1e;\n\t\tfont-family: 'Consolas', 'Monaco', monospace;\n\t\tfont-size: 11px;\n\t ";var i=document.createElement("div");i.style.cssText="\n\t\tdisplay: flex;\n\t\tgap: 8px;\n\t\tmargin-top: 10px;\n\t ";var o=document.createElement("button");o.textContent="Clear Console",o.style.cssText="\n\t\tflex: 1;\n\t\tpadding: 6px;\n\t\tbackground: #555;\n\t\tcolor: #fff;\n\t\tborder: none;\n\t\tborder-radius: 4px;\n\t\tcursor: pointer;\n\t ",o.onclick=function(){return t.clearConsole()};var a=document.createElement("label");a.style.cssText="\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tgap: 5px;\n\t\tcolor: #ccc;\n\t\tcursor: pointer;\n\t ",a.innerHTML='\n\t\t<input type="checkbox" id="preserve-log">\n\t\t<span>Preserve log</span>\n\t ',i.appendChild(o),i.appendChild(a),e.appendChild(n),e.appendChild(r),e.appendChild(i),this.content.appendChild(e),this.panels.console=e,this.consoleList=r}},{key:"updateConsolePanel",value:function(){var t=this;this.isOpen&&"console"===this.currentTab&&(this.consoleList.innerHTML="",this.consoleLogs.filter(function(e){return t.consoleFilters[e.type]}).forEach(function(e){var n=document.createElement("div");n.style.cssText="\n\t\t\tpadding: 6px 10px;\n\t\t\tborder-bottom: 1px solid #2d2d2d;\n\t\t\tdisplay: flex;\n\t\t\talign-items: flex-start;\n\t\t\tgap: 8px;\n\t\t ";var r={log:"#d4d4d4",info:"#4ec9b0",warn:"#dcdcaa",error:"#f48771",debug:"#569cd6"},i=document.createElement("span");i.textContent=e.timestamp,i.style.cssText="\n\t\t\tcolor: #888;\n\t\t\tfont-size: 10px;\n\t\t\tmin-width: 80px;\n\t\t ";var o=document.createElement("span");o.textContent={log:"○",info:"ℹ",warn:"⚠",error:"✖",debug:"⚙"}[e.type],o.style.cssText="\n\t\t\tcolor: ".concat(r[e.type],";\n\t\t\tmin-width: 20px;\n\t\t\tfont-weight: bold;\n\t\t ");var a=document.createElement("div");if(a.style.cssText="\n\t\t\tflex: 1;\n\t\t\tcolor: ".concat(r[e.type],";\n\t\t\tword-break: break-word;\n\t\t "),"object"===ro(e.args[0]))try{a.innerHTML='<pre style="margin: 0;">'.concat(function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,n=new WeakSet;return JSON.stringify(t,function(t,e){if("framework"===t)return"[CanvasFramework]";if("object"===ro(e)&&null!==e){if(n.has(e))return"[Circular]";if(n.add(e),"components"===t&&Array.isArray(e))return"[Array(".concat(e.length,")]")}return e},e)}(e.args[0]),"</pre>")}catch(t){a.textContent="[Objet complexe non affichable]"}else a.textContent=e.args.map(function(t){if("object"===ro(t)&&null!==t){var e=new WeakSet;try{return JSON.stringify(t,function(t,n){if("framework"===t)return"[Framework]";if("object"===ro(n)&&null!==n){if(e.has(n))return"[Circular]";e.add(n)}return n})}catch(t){return"[Object]"}}return String(t)}).join(" ");if("error"===e.type&&e.stack){var s=document.createElement("div");s.style.cssText="\n\t\t\t margin-top: 5px;\n\t\t\t padding: 5px;\n\t\t\t background: #2d2d2d;\n\t\t\t border-radius: 3px;\n\t\t\t font-size: 10px;\n\t\t\t color: #888;\n\t\t\t max-height: 100px;\n\t\t\t overflow-y: auto;\n\t\t\t",s.textContent=e.stack,a.appendChild(s)}n.appendChild(i),n.appendChild(o),n.appendChild(a),t.consoleList.appendChild(n)}),this.consoleList.scrollTop=this.consoleList.scrollHeight)}},{key:"addConsoleLog",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=(new Date).toLocaleTimeString();this.consoleLogs.push({type:t,args:e,timestamp:r,stack:n}),this.consoleLogs.length>this.maxConsoleLogs&&this.consoleLogs.shift(),this.isOpen&&"console"===this.currentTab&&this.updateConsolePanel()}},{key:"clearConsole",value:function(){var t;(null===(t=document.getElementById("preserve-log"))||void 0===t?void 0:t.checked)||(this.consoleLogs=[],this.updateConsolePanel())}},{key:"interceptConsole",value:function(){var t=this,e={log:console.log,info:console.info,warn:console.warn,error:console.error,debug:console.debug};["log","info","warn","error","debug"].forEach(function(n){console[n]=function(){for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];e[n].apply(console,i);var a="error"===n?(new Error).stack:null;t.addConsoleLog(n,i,a)}}),this.originalConsole=e}},{key:"restoreConsole",value:function(){this.originalConsole&&Object.assign(console,this.originalConsole)}},{key:"setupHotkeys",value:function(){var t=this;document.addEventListener("keydown",function(e){e.ctrlKey&&e.shiftKey&&"D"===e.key&&(e.preventDefault(),t.toggle()),t.framework.canvas.addEventListener("click",function(e){if(e.ctrlKey&&t.isOpen){e.preventDefault();var n=t.framework.canvas.getBoundingClientRect(),r=e.clientX-n.left,i=e.clientY-n.top;t.inspectComponentAt(r,i)}})})}},{key:"toggle",value:function(){this.isOpen=!this.isOpen,this.isOpen?(this.container.style.transform="translateX(0)",this.refreshAll(),this.startMonitoring()):(this.container.style.transform="translateX(100%)",this.stopMonitoring())}},{key:"switchTab",value:function(t){var e=this;this.currentTab=t,this.tabs.querySelectorAll("button").forEach(function(e){e.style.borderBottomColor=e.dataset.tab===t?"#007acc":"transparent",e.style.color=e.dataset.tab===t?"#fff":"#ccc"}),Object.keys(this.panels).forEach(function(n){e.panels[n].style.display=n===t?"block":"none"}),"performance"===t?this.updatePerformancePanel():"hierarchy"===t?this.updateHierarchyPanel():"components"===t?this.updateComponentsPanel():"routing"===t?this.updateRoutingPanel():"console"===t&&this.updateConsolePanel()}},{key:"refreshAll",value:function(){this.updateComponentsPanel(),this.updateHierarchyPanel(),this.updateRoutingPanel()}},{key:"updateComponentsPanel",value:function(){var t=this;if(this.isOpen&&"components"===this.currentTab){var e=this.framework.components,n=e.filter(function(t){return t.visible}).length,r=e.filter(function(t){return t._dirty}).length;document.getElementById("component-count").textContent=e.length,document.getElementById("visible-count").textContent=n,document.getElementById("dirty-count").textContent=r;var i=document.getElementById("component-list");i.innerHTML="",e.forEach(function(e,n){var r=document.createElement("div");r.style.cssText="\n padding: 6px 8px;\n border-bottom: 1px solid #333;\n cursor: pointer;\n display: flex;\n align-items: center;\n background: ".concat(e===t.selectedComponent?"#007acc20":"transparent",";\n ");var o=e.constructor.name,a="[".concat(Math.round(e.x),",").concat(Math.round(e.y)," ").concat(Math.round(e.width),"x").concat(Math.round(e.height),"]");r.innerHTML='\n <div style="display: flex; align-items: center; flex: 1;">\n <input type="checkbox" '.concat(e.visible?"checked":"",' \n style="margin-right: 8px;" \n onchange="event.stopPropagation(); devTools.toggleComponentVisibility(').concat(n,', this.checked)">\n <span style="color: #4ec9b0; min-width: 120px;">').concat(o,'</span>\n <span style="color: #ccc; margin-left: 8px;">').concat(a,"</span>\n ").concat(e._dirty?'<span style="color: orange; margin-left: 8px;">●</span>':"",'\n </div>\n <button onclick="event.stopPropagation(); devTools.highlightComponent(').concat(n,')"\n style="background: transparent; border: 1px solid #555; color: #ccc; padding: 2px 6px; border-radius: 3px; font-size: 10px;">\n ✨\n </button>\n '),r.onclick=function(){return t.selectComponent(e)},i.appendChild(r)})}}},{key:"updatePerformancePanel",value:function(){if(this.isOpen&&"performance"===this.currentTab&&(this.performanceStats.fps.push(this.framework.fps),this.performanceStats.fps.length>100&&this.performanceStats.fps.shift(),this.drawFPSChart(),performance.memory)){var t=performance.memory;document.getElementById("memory-info").innerHTML="\n <div>Used: ".concat(Math.round(t.usedJSHeapSize/1024/1024)," MB</div>\n <div>Total: ").concat(Math.round(t.totalJSHeapSize/1024/1024)," MB</div>\n <div>Limit: ").concat(Math.round(t.jsHeapSizeLimit/1024/1024)," MB</div>\n ")}}},{key:"drawFPSChart",value:function(){if(this.fpsCanvas){var t=this.fpsCanvas.getContext("2d"),e=this.fpsCanvas.width,n=this.fpsCanvas.height;t.fillStyle="#252526",t.fillRect(0,0,e,n),t.strokeStyle="#333",t.lineWidth=1;for(var r=0;r<=60;r+=15){var i=n-r/60*n;t.beginPath(),t.moveTo(0,i),t.lineTo(e,i),t.stroke(),t.fillStyle="#888",t.font="10px monospace",t.fillText("".concat(r),5,i-2)}if(this.performanceStats.fps.length>1){t.strokeStyle="#4ec9b0",t.lineWidth=2,t.beginPath();var o=e/(this.performanceStats.fps.length-1);this.performanceStats.fps.forEach(function(e,r){var i=r*o,a=n-Math.min(e,60)/60*n;0===r?t.moveTo(i,a):t.lineTo(i,a)}),t.stroke();var a=this.performanceStats.fps[this.performanceStats.fps.length-1]||0;t.fillStyle=a<30?"#ff5555":"#4ec9b0",t.font="bold 12px monospace",t.textAlign="right",t.fillText("".concat(a," FPS"),e-5,15)}}}},{key:"updateHierarchyPanel",value:function(){var t=this;if(this.isOpen&&"hierarchy"===this.currentTab){var e=document.getElementById("component-tree");e.innerHTML="";var n=function(r){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=document.createElement("div");o.style.cssText="\n padding-left: ".concat(20*i,"px;\n margin: 2px 0;\n cursor: pointer;\n background: ").concat(r===t.selectedComponent?"#007acc20":"transparent",";\n ");var a=r.constructor.name,s=r.children&&r.children.length>0;o.innerHTML='\n <span style="color: '.concat(r.visible?"#4ec9b0":"#555",'">\n ').concat(s?"▼":"○"," ").concat(a,' \n <span style="color: #888; font-size: 10px;">\n (').concat(r.width,"x").concat(r.height,")\n </span>\n </span>\n "),o.onclick=function(){return t.selectComponent(r)},e.appendChild(o),s&&r.children&&(Array.isArray(r.children)?r.children:[]).forEach(function(t){t&&"object"===ro(t)&&"x"in t&&"y"in t&&"width"in t&&"height"in t&&n(t,i+1)})};this.framework.components.forEach(function(t){n(t)})}}},{key:"updatePropertiesPanel",value:function(){var t=this;if(this.selectedComponent){var e=document.getElementById("properties-table");document.getElementById("no-selection").style.display="none",e.style.display="block",e.innerHTML="";var n=this.selectedComponent,r={};for(var i in n)if(!i.startsWith("_")&&"framework"!==i)try{var o=n[i];if("function"==typeof o)continue;if("parent"===i||"children"===i||"framework"===i){var a;r[i]="[".concat((null==o||null===(a=o.constructor)||void 0===a?void 0:a.name)||"Object","]");continue}r[i]=o}catch(t){r[i]="<error>"}Object.entries(r).forEach(function(r){var i=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,u=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(t){u=!0,i=t}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return no(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?no(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(r,2),o=i[0],a=i[1],s=document.createElement("div");s.style.cssText="\n\t\t display: flex;\n\t\t padding: 4px 0;\n\t\t border-bottom: 1px solid #333;\n\t\t";var l=document.createElement("div");l.textContent=o,l.style.cssText="\n\t\t color: #9cdcfe;\n\t\t min-width: 150px;\n\t\t font-family: monospace;\n\t\t";var u,c,h=document.createElement("div");try{if("object"===ro(a)&&null!==a){if(a===n||a===t.framework)h.textContent="[Circular Reference]";else if(a instanceof HTMLElement)h.textContent="[HTMLElement: ".concat(a.tagName,"]");else if(a instanceof Event)h.textContent="[Event: ".concat(a.type,"]");else if(a instanceof NodeList||a instanceof HTMLCollection)h.textContent="[Collection: ".concat(a.length," items]");else try{h.textContent=(u=a,c=new WeakSet,JSON.stringify(u,function(t,e){if("object"===ro(e)&&null!==e){if(c.has(e))return"[Circular Reference]";c.add(e)}return e},2))}catch(t){var f;h.textContent="[Object: ".concat((null===(f=a.constructor)||void 0===f?void 0:f.name)||"Unknown","]")}h.style.color="#ce9178"}else"boolean"==typeof a?(h.textContent=a.toString(),h.style.color="#569cd6"):"number"==typeof a?(h.textContent=a,h.style.color="#b5cea8"):(h.textContent=String(a),h.style.color="#d4d4d4")}catch(t){h.textContent="[Unserializable]",h.style.color="#ff5555"}h.style.cssText+="\n\t\t font-family: monospace;\n\t\t white-space: pre-wrap;\n\t\t word-break: break-all;\n\t\t flex: 1;\n\t\t",s.appendChild(l),s.appendChild(h),e.appendChild(s)});var s=document.createElement("div");s.style.marginTop="20px";var l=document.createElement("h4");l.textContent="Modifier",l.style.marginBottom="8px";var u=document.createElement("div");u.style.cssText="\n\t\tdisplay: grid;\n\t\tgrid-template-columns: 1fr 1fr;\n\t\tgap: 8px;\n\t\tmargin-bottom: 10px;\n\t ";var c=function(t,e,n){var r=document.createElement("div");r.style.cssText="\n\t\t display: flex;\n\t\t align-items: center;\n\t\t gap: 4px;\n\t\t";var i=document.createElement("span");i.textContent=t,i.style.minWidth="40px";var o=document.createElement("input");return o.type="number",o.value=e,o.style.cssText="\n\t\t width: 60px;\n\t\t padding: 2px 4px;\n\t\t background: #333;\n\t\t border: 1px solid #555;\n\t\t color: #fff;\n\t\t border-radius: 3px;\n\t\t",o.onchange=function(t){return n(parseFloat(t.target.value))},r.appendChild(i),r.appendChild(o),r};u.appendChild(c("X:",n.x,function(t){n.x=t,n.markDirty()})),u.appendChild(c("Y:",n.y,function(t){n.y=t,n.markDirty()})),u.appendChild(c("W:",n.width,function(t){n.width=t,n.markDirty()})),u.appendChild(c("H:",n.height,function(t){n.height=t,n.markDirty()}));var h=document.createElement("div");h.style.cssText="\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tgap: 8px;\n\t\tmargin-top: 10px;\n\t ";var f=document.createElement("span");f.textContent="Visible:";var d=document.createElement("input");d.type="checkbox",d.checked=n.visible,d.onchange=function(){n.visible=d.checked,n.markDirty()},h.appendChild(f),h.appendChild(d),s.appendChild(l),s.appendChild(u),s.appendChild(h),e.appendChild(s)}}},{key:"updateRoutingPanel",value:function(){var t=this;if(this.isOpen&&"routing"===this.currentTab){var e=document.getElementById("route-info"),n=document.getElementById("history-list");e.innerHTML="\n <div><strong>Route actuelle:</strong> ".concat(this.framework.currentRoute,"</div>\n <div><strong>Paramètres:</strong> ").concat(JSON.stringify(this.framework.currentParams),"</div>\n <div><strong>Query:</strong> ").concat(JSON.stringify(this.framework.currentQuery),"</div>\n "),n.innerHTML="",this.framework.history.forEach(function(e,r){var i=document.createElement("div");i.style.cssText="\n padding: 4px 8px;\n margin: 2px 0;\n background: ".concat(r===t.framework.historyIndex?"#007acc20":"transparent",";\n border-radius: 3px;\n cursor: pointer;\n font-family: monospace;\n font-size: 11px;\n "),i.textContent="".concat(r,": ").concat(e.path),i.onclick=function(){t.framework.navigate(e.path,{replace:!0})},n.appendChild(i)})}}},{key:"logEvent",value:function(t,e){if(this.isOpen&&"events"===this.currentTab){var n=document.createElement("div");n.style.cssText="\n padding: 4px 8px;\n margin: 2px 0;\n background: #252526;\n border-left: 3px solid #007acc;\n font-family: monospace;\n font-size: 11px;\n ";var r=(new Date).toLocaleTimeString();n.innerHTML='\n <div style="color: #569cd6;">'.concat(r," - ").concat(t,'</div>\n <div style="color: #888; font-size: 10px;">').concat(JSON.stringify(e),"</div>\n "),this.eventsList.appendChild(n),this.eventsList.scrollTop=this.eventsList.scrollHeight}}},{key:"clearEvents",value:function(){this.eventsList.innerHTML=""}},{key:"selectComponent",value:function(t){this.selectedComponent=t,this.updatePropertiesPanel(),this.updateComponentsPanel(),this.updateHierarchyPanel(),this.highlightComponentDirectly(t)}},{key:"inspectComponentAt",value:function(t,e){for(var n=e-this.framework.scrollOffset,r=this.framework.components.length-1;r>=0;r--){var i=this.framework.components[r];if(i.visible&&i.isPointInside(t,n))return this.selectComponent(i),this.switchTab("properties"),i}return null}},{key:"highlightComponent",value:function(t){if(t>=0&&t<this.framework.components.length){var e=this.framework.components[t];this.highlightComponentDirectly(e);var n=e.opacity,r=0,i=setInterval(function(){e.opacity=r%2==0?.5:n||1,e.markDirty(),++r>5&&(clearInterval(i),e.opacity=n||1,e.markDirty())},200)}}},{key:"highlightComponentDirectly",value:function(t){var e=t.draw;t.draw=function(t){e.call(this,t),t.save(),t.strokeStyle="#ff5555",t.lineWidth=2,t.setLineDash([5,3]),t.strokeRect(this.x-2,this.y-2,this.width+4,this.height+4),t.fillStyle="#ff5555",t.font="10px Arial",t.fillText("".concat(this.constructor.name),this.x,this.y-5),t.restore()},t.markDirty(),setTimeout(function(){t.draw=e,t.markDirty()},2e3)}},{key:"toggleAllComponents",value:function(){var t=this.framework.components.every(function(t){return t.visible});this.framework.components.forEach(function(e){e.visible=!t,e.markDirty()}),this.updateComponentsPanel()}},{key:"toggleComponentVisibility",value:function(t,e){if(t>=0&&t<this.framework.components.length){var n=this.framework.components[t];n.visible=e,n.markDirty(),this.updateComponentsPanel()}}},{key:"refreshComponents",value:function(){this.updateComponentsPanel()}},{key:"startMonitoring",value:function(){var t=this;this.monitorInterval=setInterval(function(){t.updatePerformancePanel()},1e3)}},{key:"stopMonitoring",value:function(){this.monitorInterval&&clearInterval(this.monitorInterval)}},{key:"cleanup",value:function(){this.restoreConsole(),this.framework&&(this.originalNavigate&&(this.framework.navigate=this.originalNavigate,this.originalNavigate=null),this.originalAdd&&(this.framework.add=this.originalAdd,this.originalAdd=null)),window.devTools===this&&delete window.devTools,this.isOpen&&this.toggle(),this.toggleBtn&&(this.toggleBtn.style.display="none"),this.closeBtn&&(this.closeBtn.onclick=null),this.toggleBtn&&(this.toggleBtn.onclick=null),this.tabs.querySelectorAll("button").forEach(function(t){t.onclick=null})}},{key:"attachToFramework",value:function(){var t=this;window.devTools=this,this.interceptConsole(),this.originalNavigate=this.framework.navigate,this.originalAdd=this.framework.add,this.framework.navigate=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return window.devTools&&window.devTools.logEvent("NAVIGATE",{path:n[0]}),t.originalNavigate.apply(t.framework,n)},this.framework.add=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];var i;return window.devTools&&window.devTools.logEvent("ADD_COMPONENT",{type:null===(i=n[0])||void 0===i||null===(i=i.constructor)||void 0===i?void 0:i.name}),t.originalAdd.apply(t.framework,n)}}},{key:"detachFromFramework",value:function(){this.originalNavigate&&this.framework&&(this.framework.navigate=this.originalNavigate),this.originalAdd&&this.framework&&(this.framework.add=this.originalAdd),window.devTools===this&&delete window.devTools,this.isOpen&&this.toggle(),this.toggleBtn&&(this.toggleBtn.style.display="none")}}],e&&io(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function so(t){return so="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},so(t)}function lo(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,uo(r.key),r)}}function uo(t){var e=function(t){if("object"!=so(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=so(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==so(e)?e:e+""}const co=function(){return t=function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.framework=e,this.isEnabled=!1,this.hoveredComp=null,this.selectedComp=null,this.showGrid=!1,this.showBounds=!0,this.showMetrics=!0,this.gridSize=50,this.setup()},e=[{key:"setup",value:function(){this.overlayCanvas=document.createElement("canvas"),this.overlayCanvas.style.cssText="\n position: absolute;\n top: 0;\n left: 0;\n pointer-events: none;\n z-index: 9998;\n ",this.overlayCtx=this.overlayCanvas.getContext("2d"),this.syncWithMainCanvas(),this.framework.canvas.addEventListener("mousemove",this.handleMouseMove.bind(this)),this.framework.canvas.addEventListener("click",this.handleClick.bind(this)),window.addEventListener("resize",this.syncWithMainCanvas.bind(this))}},{key:"syncWithMainCanvas",value:function(){var t=this.framework.canvas.getBoundingClientRect();this.overlayCanvas.width=t.width*(window.devicePixelRatio||1),this.overlayCanvas.height=t.height*(window.devicePixelRatio||1),this.overlayCanvas.style.width=t.width+"px",this.overlayCanvas.style.height=t.height+"px",this.overlayCtx&&this.overlayCtx.scale(window.devicePixelRatio||1,window.devicePixelRatio||1)}},{key:"handleMouseMove",value:function(t){if(this.isEnabled){var e=this.framework.canvas.getBoundingClientRect(),n=t.clientX-e.left,r=t.clientY-e.top;this.hoveredComp=this.findComponentAt(n,r),this.render()}}},{key:"handleClick",value:function(t){this.isEnabled&&this.hoveredComp&&(this.selectedComp=this.hoveredComp,window.devTools&&(window.devTools.selectComponent(this.selectedComp),window.devTools.switchTab("properties")))}},{key:"findComponentAt",value:function(t,e){for(var n=e-this.framework.scrollOffset,r=this.framework.components.length-1;r>=0;r--){var i=this.framework.components[r];if(i.visible&&i.isPointInside(t,n))return i}return null}},{key:"render",value:function(){this.isEnabled&&(this.overlayCtx.clearRect(0,0,this.overlayCanvas.width/(window.devicePixelRatio||1),this.overlayCanvas.height/(window.devicePixelRatio||1)),this.showGrid&&this.drawGrid(),this.showBounds&&this.drawAllComponents(),this.hoveredComp&&this.drawHoveredComponent(),this.selectedComp&&this.drawSelectedComponent(),this.showMetrics&&this.drawMetrics())}},{key:"drawGrid",value:function(){this.overlayCtx.save(),this.overlayCtx.strokeStyle="rgba(100, 100, 100, 0.3)",this.overlayCtx.lineWidth=1;for(var t=0;t<this.overlayCanvas.width;t+=this.gridSize)this.overlayCtx.beginPath(),this.overlayCtx.moveTo(t,0),this.overlayCtx.lineTo(t,this.overlayCanvas.height),this.overlayCtx.stroke();for(var e=0;e<this.overlayCanvas.height;e+=this.gridSize)this.overlayCtx.beginPath(),this.overlayCtx.moveTo(0,e),this.overlayCtx.lineTo(this.overlayCanvas.width,e),this.overlayCtx.stroke();this.overlayCtx.restore()}},{key:"drawAllComponents",value:function(){var t=this;this.framework.components.forEach(function(e){if(e.visible){var n=t.framework.isFixedComponent(e)?e.y:e.y+t.framework.scrollOffset;t.overlayCtx.save(),t.overlayCtx.strokeStyle="rgba(0, 150, 255, 0.2)",t.overlayCtx.lineWidth=1,t.overlayCtx.strokeRect(e.x,n,e.width,e.height),t.overlayCtx.restore()}})}},{key:"drawHoveredComponent",value:function(){var t=this.hoveredComp,e=this.framework.isFixedComponent(t)?t.y:t.y+this.framework.scrollOffset;this.overlayCtx.save(),this.overlayCtx.fillStyle="rgba(100, 200, 255, 0.1)",this.overlayCtx.fillRect(t.x,e,t.width,t.height),this.overlayCtx.strokeStyle="#4ec9b0",this.overlayCtx.lineWidth=2,this.overlayCtx.strokeRect(t.x,e,t.width,t.height),this.overlayCtx.fillStyle="#4ec9b0",this.overlayCtx.font="12px monospace",this.overlayCtx.fillText("".concat(t.constructor.name," (").concat(t.width,"x").concat(t.height,")"),t.x,e-5),this.overlayCtx.restore()}},{key:"drawSelectedComponent",value:function(){var t=this.selectedComp;if(t.visible){var e=this.framework.isFixedComponent(t)?t.y:t.y+this.framework.scrollOffset;this.overlayCtx.save(),this.overlayCtx.strokeStyle="#ff5555",this.overlayCtx.lineWidth=2,this.overlayCtx.setLineDash([5,3]),this.overlayCtx.strokeRect(t.x-2,e-2,t.width+4,t.height+4),this.overlayCtx.strokeStyle="#ff5555",this.overlayCtx.lineWidth=1,this.overlayCtx.beginPath(),this.overlayCtx.moveTo(t.x,e-20),this.overlayCtx.lineTo(t.x+t.width,e-20),this.overlayCtx.moveTo(t.x,e-25),this.overlayCtx.lineTo(t.x,e-15),this.overlayCtx.moveTo(t.x+t.width,e-25),this.overlayCtx.lineTo(t.x+t.width,e-15),this.overlayCtx.stroke(),this.overlayCtx.fillStyle="#ff5555",this.overlayCtx.font="10px monospace",this.overlayCtx.textAlign="center",this.overlayCtx.fillText("".concat(t.width,"px"),t.x+t.width/2,e-25),this.overlayCtx.beginPath(),this.overlayCtx.moveTo(t.x-20,e),this.overlayCtx.lineTo(t.x-20,e+t.height),this.overlayCtx.moveTo(t.x-25,e),this.overlayCtx.lineTo(t.x-15,e),this.overlayCtx.moveTo(t.x-25,e+t.height),this.overlayCtx.lineTo(t.x-15,e+t.height),this.overlayCtx.stroke(),this.overlayCtx.save(),this.overlayCtx.translate(t.x-30,e+t.height/2),this.overlayCtx.rotate(-Math.PI/2),this.overlayCtx.fillText("".concat(t.height,"px"),0,0),this.overlayCtx.restore(),this.overlayCtx.restore()}}},{key:"drawMetrics",value:function(){this.overlayCtx.save(),this.overlayCtx.fillStyle="rgba(0, 0, 0, 0.7)",this.overlayCtx.fillRect(10,10,200,90),this.overlayCtx.fillStyle="#fff",this.overlayCtx.font="12px monospace",this.overlayCtx.textAlign="left",this.overlayCtx.fillText("Composants: ".concat(this.framework.components.length),20,30),this.overlayCtx.fillText("FPS: ".concat(this.framework.fps),20,50),this.overlayCtx.fillText("Scroll: ".concat(Math.round(this.framework.scrollOffset),"px"),20,70),this.overlayCtx.fillText("Route: ".concat(this.framework.currentRoute),20,90),this.hoveredComp&&this.overlayCtx.fillText("Survol: ".concat(this.hoveredComp.constructor.name),20,110),this.overlayCtx.restore()}},{key:"enable",value:function(){this.isEnabled=!0,document.body.appendChild(this.overlayCanvas),this.render()}},{key:"disable",value:function(){this.isEnabled=!1,this.overlayCanvas.parentNode&&this.overlayCanvas.parentNode.removeChild(this.overlayCanvas)}},{key:"toggle",value:function(){this.isEnabled?this.disable():this.enable()}},{key:"setOptions",value:function(t){Object.assign(this,t),this.isEnabled&&this.render()}}],e&&lo(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function ho(t){return ho="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ho(t)}function fo(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function po(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,yo(r.key),r)}}function yo(t){var e=function(t){if("object"!=ho(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ho(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ho(e)?e:e+""}function vo(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(vo=function(){return!!t})()}function mo(t){return mo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},mo(t)}function go(t,e){return go=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},go(t,e)}const bo=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=mo(e),function(t,e){if(e&&("object"==ho(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,vo()?Reflect.construct(e,n||[],mo(t).constructor):e.apply(t,n))}(this,e,[t,r])).x=r.x||0,n.y=r.y||0,n.width=r.width||t.canvas.width,n.height=r.height||t.canvas.height,n.lat=r.lat||0,n.lng=r.lng||0,n.zoom=r.zoom||2,n.tileSize=r.tileSize||256,n.tiles={},n.offsetX=0,n.offsetY=0,n.dragging=!1,n.lastTouch=null,n.velocityX=0,n.velocityY=0,n.friction=.92,n.inertiaThreshold=.1,n.markers=r.markers||[],n.maxZoom=19,n.minZoom=1,n.lastTouchDistance=null,t.canvas.addEventListener("mousedown",n.onMouseDown.bind(n)),t.canvas.addEventListener("mousemove",n.onMouseMove.bind(n)),t.canvas.addEventListener("mouseup",n.onMouseUp.bind(n)),t.canvas.addEventListener("touchstart",n.onTouchStart.bind(n),{passive:!1}),t.canvas.addEventListener("touchmove",n.onTouchMove.bind(n),{passive:!1}),t.canvas.addEventListener("touchend",n.onTouchEnd.bind(n)),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&go(t,e)}(e,t),n=e,r=[{key:"latLngToTileXY",value:function(t,e,n){var r=Math.pow(2,n),i=r*((e+180)/360),o=t*Math.PI/180;return{x:i,y:r*(1-Math.log(Math.tan(o)+1/Math.cos(o))/Math.PI)/2}}},{key:"tileXYToLatLng",value:function(t,e,n){var r=Math.pow(2,n),i=t/r*360-180;return{lat:180*Math.atan(Math.sinh(Math.PI*(1-2*e/r)))/Math.PI,lng:i}}},{key:"loadTile",value:function(t,e,n){var r=this,i="".concat(t,"_").concat(e,"_").concat(n);if(this.tiles[i])return this.tiles[i];var o=new Image;return o.crossOrigin="anonymous",o.src="https://tile.openstreetmap.org/".concat(t,"/").concat(e,"/").concat(n,".png"),this.tiles[i]={img:o,loaded:!1},o.onload=function(){r.tiles[i].loaded=!0,r.framework.markComponentDirty(r)},this.tiles[i]}},{key:"draw",value:function(t){t.save();for(var e=Math.floor(this.zoom),n=this.latLngToTileXY(this.lat,this.lng,e),r=n.x,i=n.y,o=Math.ceil(this.width/this.tileSize)+2,a=Math.ceil(this.height/this.tileSize)+2,s=Math.floor(r-o/2),l=Math.floor(i-a/2),u=0;u<o;u++)for(var c=0;c<a;c++){var h=s+u,f=l+c,d=this.loadTile(e,h,f),p=(h-r)*this.tileSize+this.width/2+this.offsetX,y=(f-i)*this.tileSize+this.height/2+this.offsetY;d.loaded?t.drawImage(d.img,p,y,this.tileSize,this.tileSize):(t.fillStyle="#E0E0E0",t.fillRect(p,y,this.tileSize,this.tileSize))}var v,m=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return fo(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?fo(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}(this.markers);try{for(m.s();!(v=m.n()).done;){var g=v.value,b=this.latLngToTileXY(g.lat,g.lng,e),w=b.x,x=b.y,k=(w-r)*this.tileSize+this.width/2+this.offsetX,S=(x-i)*this.tileSize+this.height/2+this.offsetY;g.icon?t.drawImage(g.icon,k-g.icon.width/2,S-g.icon.height,g.icon.width,g.icon.height):(t.fillStyle="red",t.beginPath(),t.arc(k,S,6,0,2*Math.PI),t.fill())}}catch(t){m.e(t)}finally{m.f()}t.restore(),this.updateInertia()}},{key:"handleDragStart",value:function(t,e){this.dragging=!0,this.lastTouch={x:t,y:e},this.velocityX=0,this.velocityY=0}},{key:"handleDragMove",value:function(t,e){if(this.dragging){var n=t-this.lastTouch.x,r=e-this.lastTouch.y;this.offsetX+=n,this.offsetY+=r,this.velocityX=n,this.velocityY=r,this.lastTouch={x:t,y:e},this.framework.markComponentDirty(this)}}},{key:"handleDragEnd",value:function(){this.dragging=!1}},{key:"updateInertia",value:function(){!this.dragging&&(Math.abs(this.velocityX)>this.inertiaThreshold||Math.abs(this.velocityY)>this.inertiaThreshold)?(this.offsetX+=this.velocityX,this.offsetY+=this.velocityY,this.velocityX*=this.friction,this.velocityY*=this.friction,this.framework.markComponentDirty(this)):(this.velocityX=0,this.velocityY=0)}},{key:"updateCenter",value:function(){var t=this.latLngToTileXY(this.lat,this.lng,this.zoom),e=t.x,n=t.y,r=e-this.offsetX/this.tileSize,i=n-this.offsetY/this.tileSize,o=this.tileXYToLatLng(r,i,this.zoom),a=o.lat,s=o.lng;this.lat=a,this.lng=s,this.offsetX=0,this.offsetY=0}},{key:"onMouseDown",value:function(t){this.handleDragStart(t.clientX,t.clientY)}},{key:"onMouseMove",value:function(t){this.handleDragMove(t.clientX,t.clientY)}},{key:"onMouseUp",value:function(t){this.handleDragEnd(),this.updateCenter()}},{key:"onTouchStart",value:function(t){if(t.preventDefault(),1===t.touches.length){var e=t.touches[0];this.handleDragStart(e.clientX,e.clientY)}else 2===t.touches.length&&(this.lastTouchDistance=this.getTouchDistance(t.touches[0],t.touches[1]))}},{key:"onTouchMove",value:function(t){if(t.preventDefault(),1===t.touches.length){var e=t.touches[0];this.handleDragMove(e.clientX,e.clientY)}else if(2===t.touches.length){var n=this.getTouchDistance(t.touches[0],t.touches[1]);if(this.lastTouchDistance){var r=Math.log2(n/this.lastTouchDistance);this.zoom+=r,this.zoom=Math.min(this.maxZoom,Math.max(this.minZoom,this.zoom)),this.lastTouchDistance=n,this.framework.markComponentDirty(this)}}}},{key:"onTouchEnd",value:function(t){t.preventDefault(),this.handleDragEnd(),this.updateCenter(),this.lastTouchDistance=null}},{key:"getTouchDistance",value:function(t,e){var n=e.clientX-t.clientX,r=e.clientY-t.clientY;return Math.sqrt(n*n+r*r)}},{key:"isPointInside",value:function(t,e){return t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height}},{key:"addMarker",value:function(t){this.markers.push(t),this.framework.markComponentDirty(this)}}],r&&po(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);function wo(t){return wo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},wo(t)}function xo(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function ko(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?xo(Object(n),!0).forEach(function(e){So(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):xo(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function So(t,e,n){return(e=jo(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function To(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,u=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(t){u=!0,i=t}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}(t,e)||Oo(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Po(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=Oo(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function Oo(t,e){if(t){if("string"==typeof t)return Co(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Co(t,e):void 0}}function Co(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Eo(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,jo(r.key),r)}}function jo(t){var e=function(t){if("object"!=wo(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=wo(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==wo(e)?e:e+""}const Io=function(){return t=function t(e){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.canvas=e,this.dpr=r.dpr||window.devicePixelRatio||1,this.ctx=this.canvas.getContext("2d",{alpha:!1!==r.alpha,desynchronized:!0,willReadFrequently:!1}),this.useTextAtlas=!1!==r.useTextAtlas,this.enableCulling=!1!==r.enableCulling,this.enableBatching=!1!==r.enableBatching,this.useOffscreenCanvas=!1!==r.useOffscreenCanvas&&"undefined"!=typeof OffscreenCanvas,this._initWebGLTextRenderer(),this.textCache=new Map,this.charAtlas=new Map,this.maxTextCacheSize=r.maxCacheSize||400,this.lruKeys=[],this.atlases=[this._createAtlas()],this.currentAtlasIndex=0,this.textBatch=[],this.batchMode=!1,this.maxBatchSize=r.maxBatchSize||1e3,this.fontMetricsCache=new Map,this.baselineRatios={alphabetic:.85,top:1,middle:.65,bottom:0,hanging:.9,ideographic:.1},this._currentFont="16px sans-serif",this._currentFillStyle="#000",this._currentTextAlign="start",this._currentTextBaseline="alphabetic",this.objectPool={points:[],rects:[],maxPoolSize:100},this.viewportBounds={left:0,right:this.canvas.width,top:0,bottom:this.canvas.height},this.stats={cacheHits:0,cacheMisses:0,drawCalls:0,culledTexts:0,batchedDraws:0,atlasCount:1},this._cleanupScheduled=!1,this._textCleanupInterval=setInterval(function(){return n._cleanOldCache()},6e4)},e=[{key:"_createAtlas",value:function(){var t=this.useOffscreenCanvas?new OffscreenCanvas(2048,2048):document.createElement("canvas");this.useOffscreenCanvas||(t.width=2048,t.height=2048);var e=t.getContext("2d",{alpha:!0,willReadFrequently:!1});return{canvas:t,ctx:e,x:0,y:0,rowHeight:0,usage:0}}},{key:"_initWebGLTextRenderer",value:function(){if(this.textCanvas=this.useOffscreenCanvas?new OffscreenCanvas(256,256):document.createElement("canvas"),this.useOffscreenCanvas||(this.textCanvas.width=256,this.textCanvas.height=256),this.textCtx=this.textCanvas.getContext("2d",{alpha:!0,willReadFrequently:!1}),this.glCanvas=this.useOffscreenCanvas?new OffscreenCanvas(256,256):document.createElement("canvas"),this.useOffscreenCanvas||(this.glCanvas.width=256,this.glCanvas.height=256),this.gl=this.glCanvas.getContext("webgl",{alpha:!0,premultipliedAlpha:!0,antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance"}),!this.gl)throw new Error("WebGL non disponible");this._setupWebGL()}},{key:"_setupWebGL",value:function(){var t=this.gl,e=this._createShader(t,t.VERTEX_SHADER,"\n attribute vec2 a_position;\n attribute vec2 a_texCoord;\n uniform vec2 u_resolution;\n varying vec2 v_texCoord;\n \n void main() {\n vec2 clipSpace = (a_position / u_resolution) * 2.0 - 1.0;\n gl_Position = vec4(clipSpace * vec2(1, -1), 0, 1);\n v_texCoord = a_texCoord;\n }\n "),n=this._createShader(t,t.FRAGMENT_SHADER,"\n precision mediump float;\n uniform sampler2D u_texture;\n varying vec2 v_texCoord;\n \n void main() {\n gl_FragColor = texture2D(u_texture, v_texCoord);\n }\n ");if(this.program=t.createProgram(),t.attachShader(this.program,e),t.attachShader(this.program,n),t.linkProgram(this.program),!t.getProgramParameter(this.program,t.LINK_STATUS))throw new Error("Erreur de linkage du programme WebGL");this.positionLocation=t.getAttribLocation(this.program,"a_position"),this.texCoordLocation=t.getAttribLocation(this.program,"a_texCoord"),this.resolutionLocation=t.getUniformLocation(this.program,"u_resolution"),this.positionBuffer=t.createBuffer(),this.texCoordBuffer=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,this.texCoordBuffer),t.bufferData(t.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,1,1]),t.STATIC_DRAW),t.enable(t.BLEND),t.blendFunc(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA)}},{key:"_createShader",value:function(t,e,n){var r=t.createShader(e);if(t.shaderSource(r,n),t.compileShader(r),!t.getShaderParameter(r,t.COMPILE_STATUS)){var i=t.getShaderInfoLog(r);throw t.deleteShader(r),new Error("Erreur de compilation shader: "+i)}return r}},{key:"_getFontMetrics",value:function(t){if(this.fontMetricsCache.has(t))return this.fontMetricsCache.get(t);var e=parseFloat(t)||16,n={fontSize:e,lineHeight:1.5*e,padding:4};return this.fontMetricsCache.set(t,n),n}},{key:"_rasterizeChar",value:function(t,e,n){var r="".concat(t,"|").concat(e,"|").concat(n);if(this.charAtlas.has(r))return this.stats.cacheHits++,this.charAtlas.get(r);this.stats.cacheMisses++;var i=this._getFontMetrics(e),o=this.atlases[this.currentAtlasIndex];o.ctx.font=e;var a=o.ctx.measureText(t),s=Math.ceil(a.width)+i.padding,l=Math.ceil(i.lineHeight)+i.padding;if(o.x+s>2048&&(o.x=0,o.y+=o.rowHeight+2,o.rowHeight=0),o.y+l>2048)return this.atlases.length<4?(this.currentAtlasIndex++,this.atlases.push(this._createAtlas()),this.stats.atlasCount++,this._rasterizeChar(t,e,n)):(this.currentAtlasIndex=this._findLeastUsedAtlas(),this._clearAtlas(this.currentAtlasIndex),this._rasterizeChar(t,e,n));o.ctx.font=e,o.ctx.fillStyle=n,o.ctx.textBaseline="alphabetic",o.ctx.fillText(t,o.x+2,o.y+i.fontSize);var u={atlasIndex:this.currentAtlasIndex,x:o.x,y:o.y,width:s,height:l,textWidth:a.width};return this.charAtlas.set(r,u),o.usage++,o.x+=s+2,o.rowHeight=Math.max(o.rowHeight,l),u}},{key:"_findLeastUsedAtlas",value:function(){for(var t=1/0,e=0,n=0;n<this.atlases.length;n++)this.atlases[n].usage<t&&(t=this.atlases[n].usage,e=n);return e}},{key:"_clearAtlas",value:function(t){var e=this.atlases[t];e.ctx.clearRect(0,0,2048,2048),e.x=0,e.y=0,e.rowHeight=0,e.usage=0;var n,r=Po(this.charAtlas.entries());try{for(r.s();!(n=r.n()).done;){var i=To(n.value,2),o=i[0];i[1].atlasIndex===t&&this.charAtlas.delete(o)}}catch(t){r.e(t)}finally{r.f()}}},{key:"_isInViewport",value:function(t,e,n,r){return!this.enableCulling||!(t+n<-50||t>this.viewportBounds.right+50||e+r<-50||e>this.viewportBounds.bottom+50)}},{key:"updateViewport",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.canvas.width,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.canvas.height;this.viewportBounds={left:t,top:e,right:n,bottom:r}}},{key:"beginTextBatch",value:function(){this.batchMode=!0,this.textBatch=[]}},{key:"flushTextBatch",value:function(){if(0!==this.textBatch.length){this.textBatch.sort(function(t,e){var n="".concat(t.font,"|").concat(t.color),r="".concat(e.font,"|").concat(e.color);return n.localeCompare(r)});var t,e="",n="",r=Po(this.textBatch);try{for(r.s();!(t=r.n()).done;){var i=t.value;i.font!==e&&(this._currentFont=i.font,e=i.font),i.color!==n&&(this._currentFillStyle=i.color,n=i.color),this._currentTextAlign=i.align,this._currentTextBaseline=i.baseline,this._drawTextImmediate(i.text,i.x,i.y)}}catch(t){r.e(t)}finally{r.f()}this.stats.batchedDraws+=this.textBatch.length,this.textBatch=[],this.batchMode=!1}else this.batchMode=!1}},{key:"fillText",value:function(t,e,n){if(t){var r=this._currentFont,i=this._currentFillStyle,o=this._currentTextAlign,a=this._currentTextBaseline;if(this.batchMode)return this.textBatch.push({text:t,x:e,y:n,font:r,color:i,align:o,baseline:a}),void(this.textBatch.length>=this.maxBatchSize&&(this.flushTextBatch(),this.beginTextBatch()));this._drawTextImmediate(t,e,n)}}},{key:"_drawTextImmediate",value:function(t,e,n){var r=this._currentFont,i=this._currentFillStyle,o=this._currentTextAlign,a=this._currentTextBaseline,s=this._getFontMetrics(r),l=t.length*s.fontSize*.6;this._isInViewport(e-l/2,n-s.fontSize,l,2*s.fontSize)?(this.useTextAtlas?this._drawTextWithAtlas(t,e,n,r,i,o,a):this._drawTextCached(t,e,n,r,i,o,a),this.stats.drawCalls++):this.stats.culledTexts++}},{key:"_drawTextWithAtlas",value:function(t,e,n,r,i,o,a){for(var s=this._getFontMetrics(r),l=0,u=Array.from(t),c=[],h=0,f=u;h<f.length;h++){var d=f[h],p=this._rasterizeChar(d,r,i);c.push(p),l+=p.textWidth}var y=e;"center"===o?y-=l/2:("right"===o||"end"===o)&&(y-=l);for(var v=s.fontSize*(this.baselineRatios[a]||.85),m=0,g=0;g<u.length;g++){var b=c[g],w=this.atlases[b.atlasIndex];this.ctx.drawImage(w.canvas,b.x,b.y,b.width,b.height,Math.round(y+m),Math.round(n-v),b.width,b.height),m+=b.textWidth}}},{key:"_drawTextCached",value:function(t,e,n,r,i,o,a){var s="".concat(t,"|").concat(r,"|").concat(i,"|").concat(o,"|").concat(a);this._touchLRU(s);var l=this.textCache.get(s);if(!l){var u=this._rasterizeText(t,r,i,o,a);l={texture:this._createWebGLTexture(u.canvas,u.width,u.height),width:u.width,height:u.height,textWidth:u.textWidth,baselineOffset:u.baselineOffset,createdAt:Date.now()},this.textCache.set(s,l),this.textCache.size>this.maxTextCacheSize&&this._scheduleCleanup()}var c=e-8;"center"===o?c-=l.textWidth/2:"right"!==o&&"end"!==o||(c-=l.textWidth);var h=n-8-l.baselineOffset;this._drawTextureToCanvas(l.texture,l.width,l.height,Math.round(c),Math.round(h))}},{key:"_touchLRU",value:function(t){var e=this.lruKeys.indexOf(t);e>-1&&this.lruKeys.splice(e,1),this.lruKeys.push(t)}},{key:"_rasterizeText",value:function(t,e,n,r,i){var o=this._getFontMetrics(e);this.textCtx.font=e;var a=this.textCtx.measureText(t),s=Math.ceil(a.width)+16,l=Math.ceil(o.lineHeight)+16;this.textCanvas.width<s&&(this.textCanvas.width=Math.min(s,4096)),this.textCanvas.height<l&&(this.textCanvas.height=Math.min(l,4096)),this.textCtx.clearRect(0,0,s,l),this.textCtx.font=e,this.textCtx.fillStyle=n,this.textCtx.textAlign="left",this.textCtx.textBaseline="alphabetic";var u=o.fontSize*(this.baselineRatios[i]||.85);return this.textCtx.fillText(t,8,8+u),{canvas:this.textCanvas,width:s,height:l,textWidth:a.width,baselineOffset:u}}},{key:"_createWebGLTexture",value:function(t,e,n){var r=this.gl,i=r.createTexture();return r.bindTexture(r.TEXTURE_2D,i),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,t),i}},{key:"_drawTextureToCanvas",value:function(t,e,n,r,i){var o=this.gl;this.glCanvas.width===e&&this.glCanvas.height===n||(this.glCanvas.width=e,this.glCanvas.height=n),o.viewport(0,0,e,n),o.clearColor(0,0,0,0),o.clear(o.COLOR_BUFFER_BIT),o.useProgram(this.program),o.activeTexture(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,t),o.bindBuffer(o.ARRAY_BUFFER,this.positionBuffer),o.bufferData(o.ARRAY_BUFFER,new Float32Array([0,0,e,0,0,n,e,n]),o.STATIC_DRAW),o.enableVertexAttribArray(this.positionLocation),o.vertexAttribPointer(this.positionLocation,2,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,this.texCoordBuffer),o.enableVertexAttribArray(this.texCoordLocation),o.vertexAttribPointer(this.texCoordLocation,2,o.FLOAT,!1,0,0),o.uniform2f(this.resolutionLocation,e,n),o.drawArrays(o.TRIANGLE_STRIP,0,4),this.ctx.drawImage(this.glCanvas,r,i,e,n)}},{key:"_scheduleCleanup",value:function(){var t=this;this._cleanupScheduled||(this._cleanupScheduled=!0,requestIdleCallback(function(){t._cleanOldCache(),t._cleanupScheduled=!1},{timeout:1e3}))}},{key:"_cleanOldCache",value:function(){var t=this;if(!(this.textCache.size<=this.maxTextCacheSize)){var e=this.gl,n=this.textCache.size-this.maxTextCacheSize;this.lruKeys.splice(0,n).forEach(function(n){var r=t.textCache.get(n);null!=r&&r.texture&&e.deleteTexture(r.texture),t.textCache.delete(n)})}}},{key:"getStats",value:function(){return ko(ko({},this.stats),{},{atlasSize:this.charAtlas.size,cacheSize:this.textCache.size,cacheHitRate:this.stats.cacheHits/(this.stats.cacheHits+this.stats.cacheMisses)||0,atlasCount:this.atlases.length,avgAtlasUsage:this.atlases.reduce(function(t,e){return t+e.usage},0)/this.atlases.length})}},{key:"resetStats",value:function(){this.stats={cacheHits:0,cacheMisses:0,drawCalls:0,culledTexts:0,batchedDraws:0,atlasCount:this.atlases.length}}},{key:"clearCaches",value:function(){var t=this;this.charAtlas.clear(),this.fontMetricsCache.clear();var e=this.gl;this.textCache.forEach(function(t){t.texture&&e.deleteTexture(t.texture)}),this.textCache.clear(),this.lruKeys=[],this.atlases.forEach(function(e,n){return t._clearAtlas(n)}),this.currentAtlasIndex=0}},{key:"measureText",value:function(t){var e=this.ctx.font;this.ctx.font=this._currentFont;var n=this.ctx.measureText(t);return this.ctx.font=e,n}},{key:"font",get:function(){return this._currentFont},set:function(t){this._currentFont=t,this.ctx.font=t}},{key:"fillStyle",get:function(){return this._currentFillStyle},set:function(t){this._currentFillStyle=t,this.ctx.fillStyle=t}},{key:"textAlign",get:function(){return this._currentTextAlign},set:function(t){this._currentTextAlign=t,this.ctx.textAlign=t}},{key:"textBaseline",get:function(){return this._currentTextBaseline},set:function(t){this._currentTextBaseline=t,this.ctx.textBaseline=t}},{key:"clearRect",value:function(){var t;(t=this.ctx).clearRect.apply(t,arguments)}},{key:"fillRect",value:function(){var t;(t=this.ctx).fillRect.apply(t,arguments)}},{key:"strokeRect",value:function(){var t;(t=this.ctx).strokeRect.apply(t,arguments)}},{key:"beginPath",value:function(){this.ctx.beginPath()}},{key:"moveTo",value:function(){var t;(t=this.ctx).moveTo.apply(t,arguments)}},{key:"lineTo",value:function(){var t;(t=this.ctx).lineTo.apply(t,arguments)}},{key:"arc",value:function(){var t;(t=this.ctx).arc.apply(t,arguments)}},{key:"closePath",value:function(){this.ctx.closePath()}},{key:"fill",value:function(){this.ctx.fill()}},{key:"stroke",value:function(){this.ctx.stroke()}},{key:"drawImage",value:function(){var t;(t=this.ctx).drawImage.apply(t,arguments)}},{key:"save",value:function(){this.ctx.save()}},{key:"restore",value:function(){this.ctx.restore()}},{key:"translate",value:function(){var t;(t=this.ctx).translate.apply(t,arguments)}},{key:"rotate",value:function(){var t;(t=this.ctx).rotate.apply(t,arguments)}},{key:"scale",value:function(){var t;(t=this.ctx).scale.apply(t,arguments)}},{key:"createLinearGradient",value:function(){var t;return(t=this.ctx).createLinearGradient.apply(t,arguments)}},{key:"strokeStyle",get:function(){return this.ctx.strokeStyle},set:function(t){this.ctx.strokeStyle=t}},{key:"lineWidth",get:function(){return this.ctx.lineWidth},set:function(t){this.ctx.lineWidth=t}},{key:"globalAlpha",get:function(){return this.ctx.globalAlpha},set:function(t){this.ctx.globalAlpha=t}},{key:"resize",value:function(t,e){this.canvas.width=t*this.dpr,this.canvas.height=e*this.dpr,this.canvas.style.width="".concat(t,"px"),this.canvas.style.height="".concat(e,"px"),this.ctx.scale(this.dpr,this.dpr),this.updateViewport(0,0,t,e)}},{key:"destroy",value:function(){if(this.gl){var t=this.gl;this.textCache.forEach(function(e){e.texture&&t.deleteTexture(e.texture)}),t.deleteBuffer(this.positionBuffer),t.deleteBuffer(this.texCoordBuffer),t.deleteProgram(this.program)}this._textCleanupInterval&&clearInterval(this._textCleanupInterval),this.clearCaches()}}],e&&Eo(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function Fo(t){return Fo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Fo(t)}function Ro(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Mo(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Mo(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function Mo(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Ao(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,_o(r.key),r)}}function _o(t){var e=function(t){if("object"!=Fo(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Fo(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Fo(e)?e:e+""}function Do(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Do=function(){return!!t})()}function Bo(t){return Bo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Bo(t)}function Lo(t,e){return Lo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Lo(t,e)}const Wo=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=Bo(e),function(t,e){if(e&&("object"==Fo(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Do()?Reflect.construct(e,n||[],Bo(t).constructor):e.apply(t,n))}(this,e,[t,r])).text=r.text||"Button",n.fontSize=r.fontSize||16,n.platform=t.platform,n.shape=r.shape||"rounded","material"===n.platform?(n.type=r.type||"filled",n.setupMaterialStyle(r)):(n.type=r.type||"filled",n.setupCupertinoStyle(r)),n.ripples=[],n.onPress=n.handlePress.bind(n),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Lo(t,e)}(e,t),n=e,(r=[{key:"setupMaterialStyle",value:function(t){var e=t.bgColor||"#6200EE";switch(this.elevation=t.elevation||2,this.type){case"filled":this.bgColor=e,this.textColor=t.textColor||"#FFFFFF",this.borderWidth=0,this.rippleColor="rgba(255, 255, 255, 0.3)";break;case"outlined":this.bgColor="transparent",this.textColor=t.textColor||e,this.borderColor=e,this.borderWidth=1,this.rippleColor=this.hexToRgba(e,.2),this.elevation=0;break;case"text":this.bgColor="transparent",this.textColor=t.textColor||e,this.borderWidth=0,this.rippleColor=this.hexToRgba(e,.2),this.elevation=0;break;case"elevated":default:this.bgColor=t.bgColor||"#FFFFFF",this.textColor=t.textColor||e,this.borderWidth=0,this.rippleColor=this.hexToRgba(e,.2),this.elevation=t.elevation||4;break;case"tonal":this.bgColor=this.hexToRgba(e,.3),this.textColor=t.textColor||e,this.borderWidth=0,this.rippleColor=this.hexToRgba(e,.3),this.elevation=0}}},{key:"setupCupertinoStyle",value:function(t){var e=t.bgColor||"#007AFF";switch(this.type){case"filled":this.bgColor=e,this.textColor=t.textColor||"#FFFFFF",this.borderWidth=0;break;case"gray":this.bgColor="rgba(120, 120, 128, 0.16)",this.textColor=t.textColor||e,this.borderWidth=0;break;case"tinted":this.bgColor=this.hexToRgba(e,.2),this.textColor=t.textColor||e,this.borderWidth=0;break;default:this.bgColor="transparent",this.textColor=t.textColor||e,this.borderWidth=0}}},{key:"getBorderRadius",value:function(){return"square"===this.shape?0:"material"===this.platform?4:10}},{key:"handlePress",value:function(t,e){if("material"===this.platform){var n=e-this.framework.scrollOffset;this.ripples.push({x:t-this.x,y:n-this.y,radius:0,maxRadius:1.5*Math.max(this.width,this.height),opacity:1}),this.animateRipple()}}},{key:"animateRipple",value:function(){var t=this,e=function(){var n,r=Ro(t.ripples);try{for(r.s();!(n=r.n()).done;){var i=n.value;i.radius+=i.maxRadius/15,i.opacity-=.05}}catch(t){r.e(t)}finally{r.f()}t.ripples=t.ripples.filter(function(t){return t.opacity>0}),t.framework&&t.framework.redraw&&t.framework.redraw(),t.ripples.length>0&&requestAnimationFrame(e)};e()}},{key:"draw",value:function(t){t.save();var e=this.getBorderRadius();if("material"===this.platform&&this.elevation>0&&!this.pressed&&(t.shadowColor="rgba(0, 0, 0, 0.3)",t.shadowBlur=2*this.elevation,t.shadowOffsetY=this.elevation),"transparent"!==this.bgColor&&(t.fillStyle=this.pressed?this.darkenColor(this.bgColor):this.bgColor,t.beginPath(),this.roundRect(t,this.x,this.y,this.width,this.height,e),t.fill()),t.shadowColor="transparent",t.shadowBlur=0,t.shadowOffsetY=0,this.borderWidth>0&&(t.strokeStyle=this.borderColor,t.lineWidth=this.borderWidth,t.beginPath(),this.roundRect(t,this.x,this.y,this.width,this.height,e),t.stroke()),"material"===this.platform){t.save(),t.beginPath(),this.roundRect(t,this.x,this.y,this.width,this.height,e),t.clip();var n,r=Ro(this.ripples);try{for(r.s();!(n=r.n()).done;){var i=n.value;t.globalAlpha=i.opacity,t.fillStyle=this.rippleColor,t.beginPath(),t.arc(this.x+i.x,this.y+i.y,i.radius,0,2*Math.PI),t.fill()}}catch(t){r.e(t)}finally{r.f()}t.restore()}"cupertino"===this.platform&&this.pressed&&"transparent"!==this.bgColor&&(t.fillStyle="rgba(0, 0, 0, 0.1)",t.beginPath(),this.roundRect(t,this.x,this.y,this.width,this.height,e),t.fill()),t.fillStyle=this.pressed&&"cupertino"===this.platform?this.darkenColor(this.textColor):this.textColor,t.font="".concat(this.fontSize,"px -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif"),t.textAlign="center",t.textBaseline="middle",t.fillText(this.text,this.x+this.width/2,this.y+this.height/2),t.restore()}},{key:"roundRect",value:function(t,e,n,r,i,o){0!==o?(t.moveTo(e+o,n),t.lineTo(e+r-o,n),t.quadraticCurveTo(e+r,n,e+r,n+o),t.lineTo(e+r,n+i-o),t.quadraticCurveTo(e+r,n+i,e+r-o,n+i),t.lineTo(e+o,n+i),t.quadraticCurveTo(e,n+i,e,n+i-o),t.lineTo(e,n+o),t.quadraticCurveTo(e,n,e+o,n)):t.rect(e,n,r,i)}},{key:"darkenColor",value:function(t){if("transparent"===t)return"rgba(0, 0, 0, 0.1)";if(t.startsWith("rgba")||t.startsWith("rgb"))return t.replace(/[\d.]+\)$/g,function(t){var e=parseFloat(t);return"".concat(Math.max(0,e-.1),")")});var e=this.hexToRgb(t);return"rgb(".concat(Math.max(0,e.r-30),", ").concat(Math.max(0,e.g-30),", ").concat(Math.max(0,e.b-30),")")}},{key:"hexToRgb",value:function(t){var e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return e?{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16)}:{r:0,g:0,b:0}}},{key:"hexToRgba",value:function(t,e){var n=this.hexToRgb(t);return"rgba(".concat(n.r,", ").concat(n.g,", ").concat(n.b,", ").concat(e,")")}},{key:"isPointInside",value:function(t,e){return t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height}}])&&Ao(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);function Ho(t){return Ho="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ho(t)}function zo(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return qo(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?qo(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function qo(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Uo(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,No(r.key),r)}}function No(t){var e=function(t){if("object"!=Ho(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ho(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ho(e)?e:e+""}function Vo(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Vo=function(){return!!t})()}function Go(t){return Go=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Go(t)}function Yo(t,e){return Yo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Yo(t,e)}const Xo=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=Go(e),function(t,e){if(e&&("object"==Ho(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Vo()?Reflect.construct(e,n||[],Go(t).constructor):e.apply(t,n))}(this,e,[t,r])).platform=t.platform,n.buttons=r.buttons||[{text:"One"},{text:"Two"},{text:"Three"}],n.selectedIndex=r.selectedIndex||0,n.height=r.height||40,n.spacing=r.spacing||1,n.onPress=n.handlePress.bind(n),n.onRelease=n.handleRelease.bind(n),n.ripples=[],n.pressedIndex=null,n._isAnimating=!1,n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Yo(t,e)}(e,t),n=e,(r=[{key:"handlePress",value:function(t,e){var n=this.getButtonIndexAt(t,e);if(null!==n){if(this.pressedIndex=n,"material"===this.platform){var r=(this.width-this.spacing*(this.buttons.length-1))/this.buttons.length,i=this.x+n*(r+this.spacing);this.ripples.push({x:t-i,y:e-this.y,index:n,radius:0,maxRadius:1.5*Math.max(r,this.height),opacity:.3,startTime:Date.now()}),this._isAnimating||this._animate()}return this.selectedIndex=n,this._requestRedraw(),!0}return!1}},{key:"handleRelease",value:function(t,e){var n=this.getButtonIndexAt(t,e);null!==n&&n===this.pressedIndex&&this.buttons[n].onClick&&this.buttons[n].onClick(n),this.pressedIndex=null,this._requestRedraw()}},{key:"_animate",value:function(){var t=this;this._isAnimating=!0;var e=function(){for(var n=!1,r=Date.now(),i=t.ripples.length-1;i>=0;i--){var o=t.ripples[i],a=r-o.startTime,s=Math.min(a/600,1),l=1-Math.pow(1-s,3);o.radius=o.maxRadius*l,s>.5&&(o.opacity=.3*(1-2*(s-.5))),s>=1?t.ripples.splice(i,1):n=!0}n?(t._requestRedraw(),requestAnimationFrame(e)):t._isAnimating=!1};requestAnimationFrame(e)}},{key:"getButtonIndexAt",value:function(t,e){if(e<this.y||e>this.y+this.height)return null;for(var n=(this.width-this.spacing*(this.buttons.length-1))/this.buttons.length,r=0;r<this.buttons.length;r++){var i=this.x+r*(n+this.spacing);if(t>=i&&t<=i+n)return r}return null}},{key:"_requestRedraw",value:function(){this.framework&&this.framework.markComponentDirty&&this.framework.markComponentDirty(this)}},{key:"draw",value:function(t){t.save();for(var e=(this.width-this.spacing*(this.buttons.length-1))/this.buttons.length,n=this.height/2,r=0;r<this.buttons.length;r++){var i=this.buttons[r],o=this.x+r*(e+this.spacing),a=void 0,s=void 0;if("material"===this.platform?(this.selectedIndex===r?(a="#6200EE",s="#FFFFFF"):(a="#E0E0E0",s="#000000"),this.pressedIndex===r&&this.pressedIndex!==this.selectedIndex&&(a="rgba(98, 0, 238, 0.12)")):(this.selectedIndex===r?(a="#007AFF",s="#FFFFFF"):(a="#F0F0F0",s="#000000"),this.pressedIndex===r&&(a=this.selectedIndex===r?"#0056CC":"#D9D9D9")),t.fillStyle=a,t.beginPath(),0===r&&r===this.buttons.length-1?(t.moveTo(o+n,this.y),t.lineTo(o+e-n,this.y),t.quadraticCurveTo(o+e,this.y,o+e,this.y+n),t.lineTo(o+e,this.y+this.height-n),t.quadraticCurveTo(o+e,this.y+this.height,o+e-n,this.y+this.height),t.lineTo(o+n,this.y+this.height),t.quadraticCurveTo(o,this.y+this.height,o,this.y+this.height-n),t.lineTo(o,this.y+n),t.quadraticCurveTo(o,this.y,o+n,this.y)):0===r?(t.moveTo(o+n,this.y),t.lineTo(o+e,this.y),t.lineTo(o+e,this.y+this.height),t.lineTo(o+n,this.y+this.height),t.quadraticCurveTo(o,this.y+this.height,o,this.y+this.height-n),t.lineTo(o,this.y+n),t.quadraticCurveTo(o,this.y,o+n,this.y)):r===this.buttons.length-1?(t.moveTo(o,this.y),t.lineTo(o+e-n,this.y),t.quadraticCurveTo(o+e,this.y,o+e,this.y+n),t.lineTo(o+e,this.y+this.height-n),t.quadraticCurveTo(o+e,this.y+this.height,o+e-n,this.y+this.height),t.lineTo(o,this.y+this.height)):t.rect(o,this.y,e,this.height),t.closePath(),t.fill(),"material"===this.platform){var l,u=zo(this.ripples);try{for(u.s();!(l=u.n()).done;){var c=l.value;c.index===r&&(t.save(),t.beginPath(),0===r?(t.moveTo(o+n,this.y),t.lineTo(o+e,this.y),t.lineTo(o+e,this.y+this.height),t.lineTo(o+n,this.y+this.height),t.quadraticCurveTo(o,this.y+this.height,o,this.y+this.height-n),t.lineTo(o,this.y+n),t.quadraticCurveTo(o,this.y,o+n,this.y)):r===this.buttons.length-1?(t.moveTo(o,this.y),t.lineTo(o+e-n,this.y),t.quadraticCurveTo(o+e,this.y,o+e,this.y+n),t.lineTo(o+e,this.y+this.height-n),t.quadraticCurveTo(o+e,this.y+this.height,o+e-n,this.y+this.height),t.lineTo(o,this.y+this.height)):t.rect(o,this.y,e,this.height),t.closePath(),t.clip(),t.fillStyle="rgba(255, 255, 255, ".concat(c.opacity,")"),t.beginPath(),t.arc(o+c.x,this.y+c.y,c.radius,0,2*Math.PI),t.fill(),t.restore())}}catch(t){u.e(t)}finally{u.f()}}t.fillStyle=s,t.font="500 ".concat(this.height/2.5,"px -apple-system, Roboto, sans-serif"),t.textAlign="center",t.textBaseline="middle",t.fillText(i.text||"Button ".concat(r+1),o+e/2,this.y+this.height/2)}if("cupertino"===this.platform&&this.buttons.length>1){t.strokeStyle="#C7C7CC",t.lineWidth=1;for(var h=1;h<this.buttons.length;h++){var f=this.x+h*e+(h-1)*this.spacing;t.beginPath(),t.moveTo(f,this.y+8),t.lineTo(f,this.y+this.height-8),t.stroke()}}t.restore()}},{key:"isPointInside",value:function(t,e){return null!==this.getButtonIndexAt(t,e)}}])&&Uo(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);function Qo(t){return Qo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qo(t)}function Ko(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,$o(r.key),r)}}function $o(t){var e=function(t){if("object"!=Qo(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Qo(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Qo(e)?e:e+""}function Jo(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Jo=function(){return!!t})()}function Zo(t){return Zo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Zo(t)}function ta(t,e){return ta=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ta(t,e)}const ea=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=Zo(e),function(t,e){if(e&&("object"==Qo(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Jo()?Reflect.construct(e,n||[],Zo(t).constructor):e.apply(t,n))}(this,e,[t,r])).min=r.min||0,n.max=r.max||100,n.value=r.value||50,n.platform=t.platform,n.onChange=r.onChange,n.dragging=!1,n.thumbScale=1,n.targetScale=1,n.onPress=n.handlePress.bind(n),n.onMove=n.handleMove.bind(n),n.onClick=n.handleClick.bind(n),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ta(t,e)}(e,t),n=e,(r=[{key:"handlePress",value:function(t,e){return this.dragging=!0,this.targetScale=1.5,this.updateValue(t),!0}},{key:"handleMove",value:function(t,e){this.dragging&&this.updateValue(t)}},{key:"handleClick",value:function(){this.dragging=!1,this.targetScale=1}},{key:"updateValue",value:function(t){var e=Math.max(0,Math.min(this.width,t-this.x)),n=this.min+e/this.width*(this.max-this.min);n!==this.value&&(this.value=n,this.onChange&&this.onChange(this.value))}},{key:"draw",value:function(t){t.save(),this.thumbScale+=.2*(this.targetScale-this.thumbScale);var e=(this.value-this.min)/(this.max-this.min),n=this.x+e*this.width;t.strokeStyle="material"===this.platform?"#E0E0E0":"#C7C7CC",t.lineWidth=2,t.beginPath(),t.moveTo(this.x,this.y+this.height/2),t.lineTo(this.x+this.width,this.y+this.height/2),t.stroke();var r="material"===this.platform?"#6200EE":"#007AFF";t.strokeStyle=r,t.lineWidth=2,t.beginPath(),t.moveTo(this.x,this.y+this.height/2),t.lineTo(n,this.y+this.height/2),t.stroke();var i=8*this.thumbScale;this.dragging&&(t.shadowColor=r,t.shadowBlur=10),t.fillStyle=r,t.beginPath(),t.arc(n,this.y+this.height/2,i,0,2*Math.PI),t.fill(),this.dragging&&(t.shadowColor="transparent",t.shadowBlur=0),t.restore()}},{key:"isPointInside",value:function(t,e){var n=(this.value-this.min)/(this.max-this.min),r=this.x+n*this.width,i=this.y+this.height/2;return Math.sqrt(Math.pow(t-r,2)+Math.pow(e-i,2))<=17||t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height}}])&&Ko(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);function na(t){return na="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},na(t)}function ra(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return ia(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ia(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function ia(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function oa(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,aa(r.key),r)}}function aa(t){var e=function(t){if("object"!=na(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=na(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==na(e)?e:e+""}function sa(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(sa=function(){return!!t})()}function la(t){return la=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},la(t)}function ua(t,e){return ua=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ua(t,e)}const ca=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=la(e),function(t,e){if(e&&("object"==na(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,sa()?Reflect.construct(e,n||[],la(t).constructor):e.apply(t,n))}(this,e,[t,r])).children=[],n.padding=r.padding||0,n.gap=r.gap||0,n.direction=r.direction||"column",n.align=r.align||"start",n.bgColor=r.bgColor||"transparent",n.borderRadius=r.borderRadius||0,n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ua(t,e)}(e,t),n=e,(r=[{key:"add",value:function(t){return this.children.push(t),this.layout(),t}},{key:"layout",value:function(){var t,e=this.x+this.padding,n=this.y+this.padding,r=ra(this.children);try{for(r.s();!(t=r.n()).done;){var i=t.value;"column"===this.direction?(i.x=e,i.y=n,"center"===this.align?i.x=this.x+(this.width-i.width)/2:"end"===this.align&&(i.x=this.x+this.width-i.width-this.padding),n+=i.height+this.gap):(i.x=e,i.y=n,"center"===this.align?i.y=this.y+(this.height-i.height)/2:"end"===this.align&&(i.y=this.y+this.height-i.height-this.padding),e+=i.width+this.gap)}}catch(t){r.e(t)}finally{r.f()}}},{key:"draw",value:function(t){t.save(),"transparent"!==this.bgColor&&(t.fillStyle=this.bgColor,this.borderRadius>0?(t.beginPath(),this.roundRect(t,this.x,this.y,this.width,this.height,this.borderRadius),t.fill()):t.fillRect(this.x,this.y,this.width,this.height));var e,n=ra(this.children);try{for(n.s();!(e=n.n()).done;){var r=e.value;r.visible&&r.draw(t)}}catch(t){n.e(t)}finally{n.f()}t.restore()}},{key:"roundRect",value:function(t,e,n,r,i,o){t.moveTo(e+o,n),t.lineTo(e+r-o,n),t.quadraticCurveTo(e+r,n,e+r,n+o),t.lineTo(e+r,n+i-o),t.quadraticCurveTo(e+r,n+i,e+r-o,n+i),t.lineTo(e+o,n+i),t.quadraticCurveTo(e,n+i,e,n+i-o),t.lineTo(e,n+o),t.quadraticCurveTo(e,n,e+o,n)}},{key:"isPointInside",value:function(t,e){return t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height}}])&&oa(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);function ha(t){return ha="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ha(t)}function fa(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function da(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function pa(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?da(Object(n),!0).forEach(function(e){ya(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):da(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function ya(t,e,n){return(e=ma(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function va(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ma(r.key),r)}}function ma(t){var e=function(t){if("object"!=ha(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ha(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ha(e)?e:e+""}function ga(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ga=function(){return!!t})()}function ba(t,e,n,r){var i=wa(xa(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof i?function(t){return i.apply(n,t)}:i}function wa(){return wa="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=xa(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},wa.apply(null,arguments)}function xa(t){return xa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},xa(t)}function ka(t,e){return ka=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ka(t,e)}const Sa=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=xa(e),function(t,e){if(e&&("object"==ha(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,ga()?Reflect.construct(e,n||[],xa(t).constructor):e.apply(t,n))}(this,e,[t,pa(pa({},r),{},{icon:r.icon||"+"})])).actions=r.actions||[],n.isOpen=!1,n.animProgress=0,n.actionSpacing=72,n.justClicked=!1,n.clickStartTime=0,n.clickStartY=0,n.isScrolling=!1,n.scrollThreshold=5,n.miniFabs=n.actions.map(function(t,e){return pa(pa({},t),{},{size:48,x:n.x,y:n.y,targetY:n.y-(e+1)*n.actionSpacing,currentY:n.y,alpha:0,pressed:!1})}),n.showOverlay=!1,n.onPress=n.handlePress.bind(n),n.onMove=n.handleMove.bind(n),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ka(t,e)}(e,t),n=e,(r=[{key:"handlePress",value:function(t,n){var r=this;this.justClicked=!0,this.clickStartTime=Date.now(),this.clickStartY=n,this.isScrolling=!1;var i=n-this.framework.scrollOffset;if(t>=this.x&&t<=this.x+this.width&&i>=this.y&&i<=this.y+this.height)return this.toggle(),ba(e,"handlePress",this,3)([t,n]),void setTimeout(function(){r.justClicked=!1},300);if(this.isOpen)for(var o,a=function(){var e=r.miniFabs[s];if(e.alpha<.5)return 0;var n=r.x+(r.width-e.size)/2,o=e.currentY;return Math.sqrt(Math.pow(t-(n+e.size/2),2)+Math.pow(i-(o+e.size/2),2))<=e.size/2?(e.pressed=!0,setTimeout(function(){e.pressed=!1,e.action&&e.action(),r.close()},150),r.justClicked=!0,setTimeout(function(){r.justClicked=!1},300),{v:void 0}):void 0},s=0;s<this.miniFabs.length;s++)if(0!==(o=a())&&o)return o.v}},{key:"handleMove",value:function(t,e){Math.abs(e-this.clickStartY)>this.scrollThreshold&&(this.isScrolling=!0)}},{key:"open",value:function(){this.isOpen||(this.isOpen=!0,this.showOverlay=!0,this.animate())}},{key:"close",value:function(){this.isOpen&&(this.isOpen=!1,this.animate())}},{key:"toggle",value:function(){this.isOpen?this.close():this.open()}},{key:"animate",value:function(){var t=this,e=Date.now(),n=function(){var r=Date.now()-e,i=Math.min(r/300,1),o=1-Math.pow(1-i,3);t.animProgress=t.isOpen?o:1-o,t.miniFabs.forEach(function(e,n){var r=.05*n,i=Math.max(0,Math.min(1,(t.animProgress-r)/(1-r)));e.currentY=t.y-i*(n+1)*t.actionSpacing,e.alpha=i}),i<1?requestAnimationFrame(n):t.isOpen||(t.showOverlay=!1)};n()}},{key:"draw",value:function(t){if(this.showOverlay?(t.save(),t.fillStyle="rgba(0, 0, 0, ".concat(.5*this.animProgress,")"),t.fillRect(0,0,this.framework.width,this.framework.height),t.restore(),this.overlayActive=!0):this.overlayActive=!1,this.animProgress>0)for(var n=this.miniFabs.length-1;n>=0;n--){var r=this.miniFabs[n];r.alpha>.01&&this.drawMiniFab(t,r)}t.save(),"+"===this.icon&&(t.save(),t.translate(this.x+this.width/2,this.y+this.height/2),t.rotate(45*this.animProgress*Math.PI/180),t.translate(-(this.x+this.width/2),-(this.y+this.height/2))),ba(e,"draw",this,3)([t]),"+"===this.icon&&t.restore(),t.restore()}},{key:"drawMiniFab",value:function(t,e){t.save(),t.globalAlpha=e.alpha;var n=this.x+(this.width-e.size)/2,r=e.currentY;e.pressed||(t.shadowColor="rgba(0, 0, 0, 0.3)",t.shadowBlur=6,t.shadowOffsetY=3);var i=e.bgColor||this.bgColor;if(t.fillStyle=e.pressed?this.darkenColor(i):i,t.beginPath(),t.arc(n+e.size/2,r+e.size/2,e.size/2,0,2*Math.PI),t.fill(),t.shadowColor="transparent",t.shadowBlur=0,t.shadowOffsetY=0,t.fillStyle=e.iconColor||"#FFFFFF",t.font="bold 20px sans-serif",t.textAlign="center",t.textBaseline="middle",t.fillText(e.icon,n+e.size/2,r+e.size/2),e.label&&e.alpha>.5){t.fillStyle="#FFFFFF",t.shadowColor="rgba(0, 0, 0, 0.3)",t.shadowBlur=4,t.font="14px -apple-system, sans-serif";var o=t.measureText(e.label).width+24;t.fillStyle="rgba(0, 0, 0, 0.8)",this.roundRect(t,n-o-8,r+e.size/2-16,o,32,4),t.fill(),t.shadowColor="transparent",t.shadowBlur=0,t.fillStyle="#FFFFFF",t.textAlign="right",t.fillText(e.label,n-16,r+e.size/2)}t.restore()}},{key:"roundRect",value:function(t,e,n,r,i,o){t.beginPath(),t.moveTo(e+o,n),t.lineTo(e+r-o,n),t.quadraticCurveTo(e+r,n,e+r,n+o),t.lineTo(e+r,n+i-o),t.quadraticCurveTo(e+r,n+i,e+r-o,n+i),t.lineTo(e+o,n+i),t.quadraticCurveTo(e,n+i,e,n+i-o),t.lineTo(e,n+o),t.quadraticCurveTo(e,n,e+o,n)}},{key:"isPointInside",value:function(t,e){var n=e-this.framework.scrollOffset;if(t>=this.x&&t<=this.x+this.width&&n>=this.y&&n<=this.y+this.height)return!0;if(this.isOpen){var r,i=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return fa(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?fa(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}(this.miniFabs);try{for(i.s();!(r=i.n()).done;){var o=r.value;if(!(o.alpha<.01)){var a=this.x+(this.width-o.size)/2,s=o.currentY;if(Math.sqrt(Math.pow(t-(a+o.size/2),2)+Math.pow(n-(s+o.size/2),2))<=o.size/2)return!0}}}catch(t){i.e(t)}finally{i.f()}return!0}return!1}},{key:"handleClickOutside",value:function(){}}])&&va(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(G);function Ta(t){return Ta="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ta(t)}function Pa(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Oa(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Oa(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function Oa(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Ca(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function Ea(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Ca(Object(n),!0).forEach(function(e){ja(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Ca(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function ja(t,e,n){return(e=Fa(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ia(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Fa(r.key),r)}}function Fa(t){var e=function(t){if("object"!=Ta(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ta(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ta(e)?e:e+""}function Ra(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ra=function(){return!!t})()}function Ma(t,e,n,r){var i=Aa(_a(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof i?function(t){return i.apply(n,t)}:i}function Aa(){return Aa="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=_a(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},Aa.apply(null,arguments)}function _a(t){return _a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_a(t)}function Da(t,e){return Da=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Da(t,e)}const Ba=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=_a(e),function(t,e){if(e&&("object"==Ta(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Ra()?Reflect.construct(e,n||[],_a(t).constructor):e.apply(t,n))}(this,e,[t,Ea(Ea({},r),{},{icon:r.icon||"+"})])).actions=r.actions||[],n.morphType=r.morphType||"toolbar",n.isMorphed=!1,n.morphProgress=0,n.originalWidth=n.width,n.originalHeight=n.height,n.originalX=n.x,n.originalY=n.y,"searchbar"===n.morphType?(n.targetWidth=Math.min(t.width-32,400),n.targetHeight=56,n.targetX=(t.width-n.targetWidth)/2,n.targetY=16):(n.targetWidth=Math.min(t.width-32,80*n.actions.length+32),n.targetHeight=56,n.targetX=(t.width-n.targetWidth)/2,n.targetY=t.height-80),n.actionButtons=n.actions.map(function(t,e){return Ea(Ea({},t),{},{x:0,y:0,width:60,height:48,alpha:0,pressed:!1})}),n.searchText="",n.searchFocused=!1,"searchbar"===n.morphType&&n.setupHiddenInput(),n.onPress=n.handlePress.bind(n),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Da(t,e)}(e,t),n=e,r=[{key:"setupHiddenInput",value:function(){var t=this;this.hiddenInput=document.createElement("input"),this.hiddenInput.style.position="fixed",this.hiddenInput.style.opacity="0",this.hiddenInput.style.pointerEvents="none",this.hiddenInput.style.top="-100px",document.body.appendChild(this.hiddenInput),this.hiddenInput.addEventListener("input",function(e){t.searchFocused&&(t.searchText=e.target.value)}),this.hiddenInput.addEventListener("blur",function(){t.searchFocused=!1})}},{key:"handlePress",value:function(t,n){var r=n-this.framework.scrollOffset;if(this.isMorphed){if("searchbar"===this.morphType){var i=this.x+48,o=this.width-96;if(t>=i&&t<=i+o&&r>=this.y&&r<=this.y+this.height)return this.searchFocused=!0,void(this.hiddenInput&&(this.hiddenInput.value=this.searchText,this.hiddenInput.style.top="".concat(this.y,"px"),this.hiddenInput.focus()));var a=this.x+this.width-40;if(t>=a&&t<=a+40&&r>=this.y&&r<=this.y+this.height)return this.searchText="",void this.toggle()}else{var s,l=Pa(this.actionButtons);try{var u,c=function(){var e=s.value;if(t>=e.x&&t<=e.x+e.width&&r>=e.y&&r<=e.y+e.height)return e.pressed=!0,setTimeout(function(){e.pressed=!1,e.action&&e.action()},150),{v:void 0}};for(l.s();!(s=l.n()).done;)if(u=c())return u.v}catch(t){l.e(t)}finally{l.f()}}this.isPointInside(t,n)||this.toggle()}else this.toggle(),Ma(e,"handlePress",this,3)([t,n])}},{key:"toggle",value:function(){this.isMorphed=!this.isMorphed,this.isMorphed||"searchbar"!==this.morphType||(this.searchText="",this.searchFocused=!1,this.hiddenInput&&(this.hiddenInput.blur(),this.hiddenInput.remove(),this.hiddenInput=null)),this.isMorphed&&"searchbar"===this.morphType&&!this.hiddenInput&&this.setupHiddenInput(),this.animate()}},{key:"animate",value:function(){var t=this,e=Date.now(),n=function(){var r=Date.now()-e,i=Math.min(r/400,1),o=1-Math.pow(1-i,3);t.morphProgress=t.isMorphed?o:1-o,t.width=t.lerp(t.originalWidth,t.targetWidth,t.morphProgress),t.height=t.lerp(t.originalHeight,t.targetHeight,t.morphProgress),t.x=t.lerp(t.originalX,t.targetX,t.morphProgress),t.y=t.lerp(t.originalY,t.targetY,t.morphProgress),"toolbar"===t.morphType&&t.updateActionPositions(),i<1&&requestAnimationFrame(n)};n()}},{key:"updateActionPositions",value:function(){var t=this,e=this.targetWidth/(this.actionButtons.length+1);this.actionButtons.forEach(function(n,r){n.x=t.x+e*(r+1)-n.width/2,n.y=t.y+(t.height-n.height)/2,n.alpha=t.morphProgress})}},{key:"lerp",value:function(t,e,n){return t+(e-t)*n}},{key:"draw",value:function(t){t.save(),this.isMorphed||this.morphProgress>0?this.drawMorphed(t):Ma(e,"draw",this,3)([t]),t.restore()}},{key:"drawMorphed",value:function(t){t.shadowColor="rgba(0, 0, 0, 0.3)",t.shadowBlur=12,t.shadowOffsetY=4,t.fillStyle=this.bgColor,t.beginPath();var e=this.lerp(this.borderRadius,28,this.morphProgress);this.roundRect(t,this.x,this.y,this.width,this.height,e),t.fill(),t.shadowColor="transparent",t.shadowBlur=0,t.shadowOffsetY=0,"searchbar"===this.morphType?this.drawSearchBar(t):this.drawToolbar(t)}},{key:"drawToolbar",value:function(t){var e,n=Pa(this.actionButtons);try{for(n.s();!(e=n.n()).done;){var r=e.value;r.alpha>.01&&(t.save(),t.globalAlpha=r.alpha,r.pressed&&(t.fillStyle="rgba(255, 255, 255, 0.2)",t.beginPath(),t.arc(r.x+r.width/2,r.y+r.height/2,24,0,2*Math.PI),t.fill()),t.fillStyle=this.iconColor,t.font="bold 20px sans-serif",t.textAlign="center",t.textBaseline="middle",t.fillText(r.icon,r.x+r.width/2,r.y+r.height/2-8),r.label&&(t.font="11px -apple-system, sans-serif",t.fillText(r.label,r.x+r.width/2,r.y+r.height/2+12)),t.restore())}}catch(t){n.e(t)}finally{n.f()}}},{key:"drawSearchBar",value:function(t){t.save(),t.globalAlpha=this.morphProgress,t.fillStyle=this.iconColor,t.font="bold 20px sans-serif",t.textAlign="left",t.textBaseline="middle",t.fillText("🔍",this.x+16,this.y+this.height/2);var e=!1;this.searchFocused&&(e=Math.floor(Date.now()/500)%2==0),t.font="16px -apple-system, sans-serif",t.fillStyle=this.searchText?this.iconColor:"rgba(255, 255, 255, 0.6)";var n=this.searchText||"Search...";if(t.fillText(n,this.x+48,this.y+this.height/2),e&&this.searchText){var r=t.measureText(this.searchText).width;t.fillStyle=this.iconColor,t.fillRect(this.x+48+r+2,this.y+this.height/2-10,2,20)}(this.searchText||this.isMorphed)&&(t.fillStyle="rgba(255, 255, 255, 0.8)",t.font="bold 18px sans-serif",t.textAlign="right",t.fillText("✕",this.x+this.width-16,this.y+this.height/2)),t.restore()}},{key:"roundRect",value:function(t,e,n,r,i,o){t.beginPath(),t.moveTo(e+o,n),t.lineTo(e+r-o,n),t.quadraticCurveTo(e+r,n,e+r,n+o),t.lineTo(e+r,n+i-o),t.quadraticCurveTo(e+r,n+i,e+r-o,n+i),t.lineTo(e+o,n+i),t.quadraticCurveTo(e,n+i,e,n+i-o),t.lineTo(e,n+o),t.quadraticCurveTo(e,n,e+o,n)}},{key:"isPointInside",value:function(t,e){var n=e-this.framework.scrollOffset;return t>=this.x&&t<=this.x+this.width&&n>=this.y&&n<=this.y+this.height}},{key:"addChar",value:function(t){"searchbar"===this.morphType&&this.isMorphed&&(this.searchText+=t)}},{key:"backspace",value:function(){"searchbar"===this.morphType&&this.isMorphed&&(this.searchText=this.searchText.slice(0,-1))}},{key:"clearSearch",value:function(){this.searchText=""}}],r&&Ia(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(G);function La(t){return La="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},La(t)}function Wa(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ha(r.key),r)}}function Ha(t){var e=function(t){if("object"!=La(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=La(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==La(e)?e:e+""}function za(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(za=function(){return!!t})()}function qa(t){return qa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},qa(t)}function Ua(t,e){return Ua=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ua(t,e)}const Na=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=qa(e),function(t,e){if(e&&("object"==La(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,za()?Reflect.construct(e,n||[],qa(t).constructor):e.apply(t,n))}(this,e,[t,r])).size=r.size||40,n.indeterminate=!1!==r.indeterminate,n.progress=r.progress||0,n.platform=t.platform,n.color=r.color||("material"===n.platform?"#6200EE":"#8E8E93"),n.lineWidth=r.lineWidth||("material"===n.platform?4:2.5),n.animationSpeed=r.animationSpeed||("material"===n.platform?.05:.08),n.rotation=0,n.arcStart=0,n.arcEnd=0,n.arcGrowing=!0,n.cupertinoLines=12,n.cupertinoOpacity=Array(n.cupertinoLines).fill(0),n.width=n.size,n.height=n.size,n.indeterminate&&n.startAnimation(),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ua(t,e)}(e,t),n=e,(r=[{key:"startAnimation",value:function(){var t=this,e=performance.now(),n=function(r){if(t.visible&&t.indeterminate){var i=r-e;e=r,"material"===t.platform?t.animateMaterial(i):t.animateCupertino(i),t.markDirty(),requestAnimationFrame(n)}};requestAnimationFrame(n)}},{key:"animateMaterial",value:function(t){this.rotation+=this.animationSpeed,this.rotation>2*Math.PI&&(this.rotation-=2*Math.PI),this.arcGrowing?(this.arcEnd+=.03,this.arcEnd>1.5*Math.PI&&(this.arcGrowing=!1)):(this.arcStart+=.03,this.arcStart>=this.arcEnd&&(this.arcGrowing=!0,this.arcStart=0,this.arcEnd=0))}},{key:"animateCupertino",value:function(t){this.rotation+=this.animationSpeed,this.rotation>2*Math.PI&&(this.rotation-=2*Math.PI);for(var e=Math.floor(this.rotation/(2*Math.PI)*this.cupertinoLines),n=0;n<this.cupertinoLines;n++){var r=Math.abs(n-e),i=Math.min(r,this.cupertinoLines-r);this.cupertinoOpacity[n]=1-i/this.cupertinoLines*.8}}},{key:"drawMaterial",value:function(t,e,n,r){if(this.indeterminate)t.strokeStyle="rgba(98, 0, 238, 0.1)",t.lineWidth=this.lineWidth,t.beginPath(),t.arc(e,n,r,0,2*Math.PI),t.stroke(),t.save(),t.translate(e,n),t.rotate(this.rotation),t.strokeStyle=this.color,t.lineCap="round",t.lineWidth=this.lineWidth,t.beginPath(),t.arc(0,0,r,this.arcStart,this.arcEnd),t.stroke(),t.restore();else{t.strokeStyle="#E0E0E0",t.lineWidth=this.lineWidth,t.beginPath(),t.arc(e,n,r,0,2*Math.PI),t.stroke();var i=this.progress/100*Math.PI*2;t.strokeStyle=this.color,t.lineCap="round",t.beginPath(),t.arc(e,n,r,-Math.PI/2,-Math.PI/2+i),t.stroke(),this.progress>0&&(t.fillStyle=this.color,t.font="bold ".concat(this.size/3,"px -apple-system, sans-serif"),t.textAlign="center",t.textBaseline="middle",t.fillText("".concat(Math.round(this.progress),"%"),e,n))}}},{key:"drawCupertino",value:function(t,e,n,r){if(this.indeterminate){t.lineCap="round",t.lineWidth=this.lineWidth;for(var i=0;i<this.cupertinoLines;i++){var o=i/this.cupertinoLines*Math.PI*2,a=this.cupertinoOpacity[i];t.save(),t.translate(e,n),t.rotate(o);var s=.6*r,l=r;t.strokeStyle=this.hexToRgba(this.color,a),t.beginPath(),t.moveTo(0,-s),t.lineTo(0,-l),t.stroke(),t.restore()}}else{t.strokeStyle="#E5E5EA",t.lineWidth=this.lineWidth,t.beginPath(),t.arc(e,n,r,0,2*Math.PI),t.stroke();var u=this.progress/100*Math.PI*2;t.strokeStyle=this.color,t.lineCap="round",t.beginPath(),t.arc(e,n,r,-Math.PI/2,-Math.PI/2+u),t.stroke()}}},{key:"draw",value:function(t){t.save();var e=this.x+this.size/2,n=this.y+this.size/2,r=(this.size-2*this.lineWidth)/2;"material"===this.platform?this.drawMaterial(t,e,n,r):this.drawCupertino(t,e,n,r),t.restore()}},{key:"hexToRgba",value:function(t,e){if(t.startsWith("rgba"))return t;if(t.startsWith("rgb"))return t.replace("rgb","rgba").replace(")",", ".concat(e,")"));var n=parseInt(t.slice(1,3),16),r=parseInt(t.slice(3,5),16),i=parseInt(t.slice(5,7),16);return"rgba(".concat(n,", ").concat(r,", ").concat(i,", ").concat(e,")")}},{key:"setProgress",value:function(t){this.progress=Math.max(0,Math.min(100,t)),this.indeterminate=!1,this.markDirty()}},{key:"setIndeterminate",value:function(){this.indeterminate=!0,this._animating||this.startAnimation()}},{key:"isPointInside",value:function(){return!1}}])&&Wa(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);function Va(t){return Va="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Va(t)}function Ga(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ya(r.key),r)}}function Ya(t){var e=function(t){if("object"!=Va(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Va(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Va(e)?e:e+""}function Xa(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Xa=function(){return!!t})()}function Qa(t){return Qa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Qa(t)}function Ka(t,e){return Ka=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ka(t,e)}const $a=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=Qa(e),function(t,e){if(e&&("object"==Va(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Xa()?Reflect.construct(e,n||[],Qa(t).constructor):e.apply(t,n))}(this,e,[t,r])).src=r.src||"",n.fit=r.fit||"cover",n.borderRadius=r.borderRadius||0,n.placeholder=r.placeholder||"#E0E0E0",n.loaded=!1,n.loading=!1,n.error=!1,n.img=null,n.src&&n.loadImage(),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ka(t,e)}(e,t),n=e,(r=[{key:"loadImage",value:function(){var t=this;this.loading||(this.loading=!0,this.img=new Image,this.img.crossOrigin="anonymous",this.img.onload=function(){t.loaded=!0,t.loading=!1,t.error=!1},this.img.onerror=function(){t.loaded=!1,t.loading=!1,t.error=!0},this.img.src=this.src)}},{key:"setSrc",value:function(t){this.src=t,this.loaded=!1,this.error=!1,this.loadImage()}},{key:"draw",value:function(t){if(t.save(),this.borderRadius>0&&(t.beginPath(),this.roundRect(t,this.x,this.y,this.width,this.height,this.borderRadius),t.clip()),this.loaded&&this.img){var e,n,r,i,o=this.img.width/this.img.height,a=this.width/this.height;switch(this.fit){case"cover":o>a?(e=(n=this.height)*o,r=this.x-(e-this.width)/2,i=this.y):(n=(e=this.width)/o,r=this.x,i=this.y-(n-this.height)/2);break;case"contain":o>a?(n=(e=this.width)/o,r=this.x,i=this.y+(this.height-n)/2):(e=(n=this.height)*o,r=this.x+(this.width-e)/2,i=this.y);break;case"fill":default:r=this.x,i=this.y,e=this.width,n=this.height;break;case"none":r=this.x+(this.width-this.img.width)/2,i=this.y+(this.height-this.img.height)/2,e=this.img.width,n=this.img.height}t.drawImage(this.img,r,i,e,n)}else if(this.loading){t.fillStyle=this.placeholder,t.fillRect(this.x,this.y,this.width,this.height);var s=this.x+this.width/2,l=this.y+this.height/2,u=Math.min(40,this.width/3,this.height/3);t.strokeStyle="#999999",t.lineWidth=3,t.lineCap="round";var c=Date.now()/10%360*(Math.PI/180);t.beginPath(),t.arc(s,l,u/2,c,c+1.5*Math.PI),t.stroke()}else this.error?(t.fillStyle=this.placeholder,t.fillRect(this.x,this.y,this.width,this.height),t.fillStyle="#999999",t.font="48px sans-serif",t.textAlign="center",t.textBaseline="middle",t.fillText("⚠️",this.x+this.width/2,this.y+this.height/2)):(t.fillStyle=this.placeholder,t.fillRect(this.x,this.y,this.width,this.height));t.restore()}},{key:"roundRect",value:function(t,e,n,r,i,o){t.beginPath(),t.moveTo(e+o,n),t.lineTo(e+r-o,n),t.quadraticCurveTo(e+r,n,e+r,n+o),t.lineTo(e+r,n+i-o),t.quadraticCurveTo(e+r,n+i,e+r-o,n+i),t.lineTo(e+o,n+i),t.quadraticCurveTo(e,n+i,e,n+i-o),t.lineTo(e,n+o),t.quadraticCurveTo(e,n,e+o,n),t.closePath()}},{key:"isPointInside",value:function(){return!1}}])&&Ga(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);function Ja(t){return Ja="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ja(t)}function Za(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ts(r.key),r)}}function ts(t){var e=function(t){if("object"!=Ja(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ja(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ja(e)?e:e+""}function es(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(es=function(){return!!t})()}function ns(t){return ns=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ns(t)}function rs(t,e){return rs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},rs(t,e)}const is=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=ns(e),function(t,e){if(e&&("object"==Ja(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,es()?Reflect.construct(e,n||[],ns(t).constructor):e.apply(t,n))}(this,e,[t,{x:0,y:0,width:t.width,height:t.height,visible:!1}])).selectedDate=r.selectedDate||new Date,n.onChange=r.onChange,n.currentMonth=n.selectedDate.getMonth(),n.currentYear=n.selectedDate.getFullYear(),n.hoveredDay=null,n.headerBgColor=r.headerBgColor||"#6200EE",n.selectedColor=r.selectedColor||"#6200EE",n.buttonColor=r.buttonColor||"#6200EE",n.todayColor=r.todayColor||"#6200EE",n.textColor=r.textColor||"#000000",n.dayNamesColor=r.dayNamesColor||"#666666",n.dialogWidth=Math.min(320,t.width-40),n.dialogHeight=420,n.headerHeight=100,n.daySize=(n.dialogWidth-40)/7,n.opacity=0,n.isVisible=!1,n.onPress=n.handlePress.bind(n),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&rs(t,e)}(e,t),n=e,(r=[{key:"show",value:function(){var t=this;this.isVisible=!0,this.visible=!0;var e=function(){t.opacity+=.1,t.opacity<1&&requestAnimationFrame(e)};e()}},{key:"hide",value:function(){var t=this,e=function(){t.opacity-=.1,t.opacity>0?requestAnimationFrame(e):(t.isVisible=!1,t.visible=!1,t.framework.remove(t))};e()}},{key:"getDaysInMonth",value:function(t,e){return new Date(e,t+1,0).getDate()}},{key:"getFirstDayOfMonth",value:function(t,e){return new Date(e,t,1).getDay()}},{key:"previousMonth",value:function(){this.currentMonth--,this.currentMonth<0&&(this.currentMonth=11,this.currentYear--)}},{key:"nextMonth",value:function(){this.currentMonth++,this.currentMonth>11&&(this.currentMonth=0,this.currentYear++)}},{key:"selectDate",value:function(t){this.selectedDate=new Date(this.currentYear,this.currentMonth,t)}},{key:"draw",value:function(t){if(!(this.opacity<=0)&&this.isVisible){t.save(),t.globalAlpha=this.opacity,t.fillStyle="rgba(0, 0, 0, 0.5)",t.fillRect(0,0,this.framework.width,this.framework.height);var e=(this.framework.width-this.dialogWidth)/2,n=(this.framework.height-this.dialogHeight)/2;t.fillStyle="#FFFFFF",t.shadowColor="rgba(0, 0, 0, 0.3)",t.shadowBlur=20,t.beginPath(),this.roundRect(t,e,n,this.dialogWidth,this.dialogHeight,4),t.fill(),t.shadowColor="transparent",t.fillStyle=this.headerBgColor,t.beginPath(),this.roundRect(t,e,n,this.dialogWidth,this.headerHeight,4),t.rect(e,n+this.headerHeight-4,this.dialogWidth,4),t.fill(),t.fillStyle="rgba(255, 255, 255, 0.7)",t.font="16px Roboto, sans-serif",t.textAlign="left",t.textBaseline="top",t.fillText(this.currentYear.toString(),e+20,n+20);var r=["Dim","Lun","Mar","Mer","Jeu","Ven","Sam"][this.selectedDate.getDay()],i=["Jan","Fév","Mar","Avr","Mai","Juin","Juil","Aoû","Sep","Oct","Nov","Déc"][this.selectedDate.getMonth()],o=this.selectedDate.getDate();t.fillStyle="#ffffff",t.font="bold 32px Roboto, sans-serif",t.textBaseline="middle",t.fillText("".concat(r,", ").concat(i," ").concat(o),e+20,n+this.headerHeight/2+15);var a=n+this.headerHeight+20;t.fillStyle="#666666",t.font="20px sans-serif",t.textAlign="center",t.fillText("◀",e+30,a),t.font="bold 16px Roboto, sans-serif",t.fillText("".concat(["Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre"][this.currentMonth]," ").concat(this.currentYear),e+this.dialogWidth/2,a),t.fillText("▶",e+this.dialogWidth-30,a);var s=["D","L","M","M","J","V","S"];t.fillStyle="#666666",t.font="bold 12px Roboto, sans-serif";for(var l=0;l<7;l++){var u=e+20+l*this.daySize+this.daySize/2,c=a+40;t.fillText(s[l],u,c)}for(var h=this.getDaysInMonth(this.currentMonth,this.currentYear),f=this.getFirstDayOfMonth(this.currentMonth,this.currentYear),d=1,p=a+60,y=0;y<6;y++){for(var v=0;v<7;v++)if(7*y+v>=f&&d<=h){var m=e+20+v*this.daySize,g=p+y*this.daySize,b=this.selectedDate.getDate()===d&&this.selectedDate.getMonth()===this.currentMonth&&this.selectedDate.getFullYear()===this.currentYear,w=new Date,x=d===w.getDate()&&this.currentMonth===w.getMonth()&&this.currentYear===w.getFullYear();b&&(t.fillStyle="#6200EE",t.beginPath(),t.arc(m+this.daySize/2,g+this.daySize/2,this.daySize/2-2,0,2*Math.PI),t.fill()),x&&!b&&(t.strokeStyle="#6200EE",t.lineWidth=2,t.beginPath(),t.arc(m+this.daySize/2,g+this.daySize/2,this.daySize/2-2,0,2*Math.PI),t.stroke()),t.fillStyle=b?"#FFFFFF":"#212121",t.font="14px Roboto, sans-serif",t.textAlign="center",t.textBaseline="middle",t.fillText(d.toString(),m+this.daySize/2,g+this.daySize/2),d++}if(d>h)break}var k=n+this.dialogHeight-30;t.fillStyle="#6200EE",t.font="bold 14px Roboto, sans-serif",t.textAlign="right",t.fillText("ANNULER",e+this.dialogWidth-120,k),t.fillText("OK",e+this.dialogWidth-20,k),t.restore()}}},{key:"handlePress",value:function(t,e){var n=(this.framework.width-this.dialogWidth)/2,r=(this.framework.height-this.dialogHeight)/2,i=r+this.headerHeight+20;if(e>=i-15&&e<=i+15){if(t>=n+10&&t<=n+50)return void this.previousMonth();if(t>=n+this.dialogWidth-50&&t<=n+this.dialogWidth-10)return void this.nextMonth()}for(var o=i+60,a=this.getDaysInMonth(this.currentMonth,this.currentYear),s=this.getFirstDayOfMonth(this.currentMonth,this.currentYear),l=1,u=0;u<6;u++){for(var c=0;c<7;c++)if(7*u+c>=s&&l<=a){var h=n+20+c*this.daySize,f=o+u*this.daySize;if(t>=h&&t<=h+this.daySize&&e>=f&&e<=f+this.daySize)return void this.selectDate(l);l++}if(l>a)break}var d=r+this.dialogHeight-30;if(e>=d-20&&e<=d+20){if(t>=n+this.dialogWidth-180&&t<=n+this.dialogWidth-80)return void this.hide();if(t>=n+this.dialogWidth-70&&t<=n+this.dialogWidth)return this.onChange&&this.onChange(this.selectedDate),void this.hide()}(t<n||t>n+this.dialogWidth||e<r||e>r+this.dialogHeight)&&this.hide()}},{key:"roundRect",value:function(t,e,n,r,i,o){t.beginPath(),t.moveTo(e+o,n),t.lineTo(e+r-o,n),t.quadraticCurveTo(e+r,n,e+r,n+o),t.lineTo(e+r,n+i-o),t.quadraticCurveTo(e+r,n+i,e+r-o,n+i),t.lineTo(e+o,n+i),t.quadraticCurveTo(e,n+i,e,n+i-o),t.lineTo(e,n+o),t.quadraticCurveTo(e,n,e+o,n),t.closePath()}},{key:"isPointInside",value:function(){return this.isVisible}}])&&Za(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);function os(t){return os="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},os(t)}function as(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ss(r.key),r)}}function ss(t){var e=function(t){if("object"!=os(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=os(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==os(e)?e:e+""}function ls(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ls=function(){return!!t})()}function us(){return us="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=cs(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},us.apply(null,arguments)}function cs(t){return cs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},cs(t)}function hs(t,e){return hs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},hs(t,e)}const fs=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=cs(e),function(t,e){if(e&&("object"==os(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,ls()?Reflect.construct(e,n||[],cs(t).constructor):e.apply(t,n))}(this,e,[t,r])).selectedDate=r.selectedDate||new Date,n.onChange=r.onChange,n.monthWheel=n.selectedDate.getMonth(),n.dayWheel=n.selectedDate.getDate(),n.yearWheel=n.selectedDate.getFullYear(),n.wheelHeight=200,n.itemHeight=40,n.visibleItems=5,n.dragging=!1,n.dragStartY=0,n.dragWheel=null,n.lastY=0,n._setupLimits(),n._setupEventHandlers(),r.width||(n.width=t.width-40),r.height||(n.height=n.wheelHeight),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&hs(t,e)}(e,t),n=e,r=[{key:"_setupLimits",value:function(){this.monthMin=0,this.monthMax=11,this.dayMin=1,this.dayMax=31,this.yearMin=1900,this.yearMax=2100,this._updateDayLimits()}},{key:"_updateDayLimits",value:function(){var t=new Date(this.yearWheel,this.monthWheel+1,0).getDate();this.dayMax=t,this.dayWheel>t&&(this.dayWheel=t,this._updateSelectedDate())}},{key:"_setupEventHandlers",value:function(){var t=this;this.onPress=function(e,n){if(!(e>=t.x&&e<=t.x+t.width&&n>=t.y&&n<=t.y+t.wheelHeight))return!1;t.dragging=!0,t.dragStartY=n,t.lastY=n;var r=t.width/3;return e<t.x+r?t.dragWheel=0:e<t.x+2*r?t.dragWheel=1:t.dragWheel=2,t.framework.activeComponent=t,t._addGlobalMoveListener(),t._requestRedraw(),!0},this.onRelease=function(e,n){t.dragging&&(t.dragging=!1,t.dragWheel=null,t._removeGlobalMoveListener(),t.framework.activeComponent===t&&(t.framework.activeComponent=null),t._requestRedraw())},this.onMove=function(t,e){}}},{key:"_addGlobalMoveListener",value:function(){var t=this,e=this.framework.canvas;this._savedMouseMove=e.onmousemove,this._savedTouchMove=e.ontouchmove,e.onmousemove=function(n){if(t.dragging){n.preventDefault(),n.stopPropagation();var r=e.getBoundingClientRect(),i=n.clientX-r.left,o=n.clientY-r.top;return t._handleGlobalMove(i,o),!1}if(t._savedMouseMove)return t._savedMouseMove(n)},e.ontouchmove=function(n){if(t.dragging&&n.touches.length>0){n.preventDefault(),n.stopPropagation();var r=n.touches[0],i=e.getBoundingClientRect(),o=r.clientX-i.left,a=r.clientY-i.top;return t._handleGlobalMove(o,a),!1}if(t._savedTouchMove)return t._savedTouchMove(n)}}},{key:"_removeGlobalMoveListener",value:function(){var t=this.framework.canvas;this._savedMouseMove&&(t.onmousemove=this._savedMouseMove,this._savedMouseMove=null),this._savedTouchMove&&(t.ontouchmove=this._savedTouchMove,this._savedTouchMove=null)}},{key:"_handleGlobalMove",value:function(t,e){if(this.dragging){var n=e-this.lastY;if(this.lastY=e,Math.abs(n)>.5){var r=n>0?1:-1;if(0===this.dragWheel){var i=this.monthWheel-r;i<this.monthMin&&(i=this.monthMax),i>this.monthMax&&(i=this.monthMin),this.monthWheel=i,this._updateDayLimits()}else if(1===this.dragWheel){var o=this.dayWheel-r;o<this.dayMin&&(o=this.dayMax),o>this.dayMax&&(o=this.dayMin),this.dayWheel=o}else if(2===this.dragWheel){var a=this.yearWheel-r;a<this.yearMin&&(a=this.yearMin),a>this.yearMax&&(a=this.yearMax),this.yearWheel=a,this._updateDayLimits()}this._updateSelectedDate(),this._requestRedraw()}}}},{key:"_updateSelectedDate",value:function(){var t=new Date(this.yearWheel,this.monthWheel,this.dayWheel);t.getTime()!==this.selectedDate.getTime()&&(this.selectedDate=t,this.onChange&&this.onChange(this.selectedDate))}},{key:"_requestRedraw",value:function(){this.framework.markComponentDirty&&this.framework.markComponentDirty(this)}},{key:"isPointInside",value:function(t,e){return t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.wheelHeight}},{key:"draw",value:function(t){var e=this;t.save();var n=this.width/3;t.fillStyle="#F9F9F9",t.fillRect(this.x,this.y,this.width,this.wheelHeight);var r=this.y+this.wheelHeight/2-this.itemHeight/2;t.fillStyle="rgba(0, 0, 0, 0.05)",t.fillRect(this.x,r,this.width,this.itemHeight),t.strokeStyle="#C7C7CC",t.lineWidth=.5,t.beginPath(),t.moveTo(this.x,r),t.lineTo(this.x+this.width,r),t.moveTo(this.x,r+this.itemHeight),t.lineTo(this.x+this.width,r+this.itemHeight),t.stroke(),t.beginPath(),t.moveTo(this.x+n,this.y),t.lineTo(this.x+n,this.y+this.wheelHeight),t.moveTo(this.x+2*n,this.y),t.lineTo(this.x+2*n,this.y+this.wheelHeight),t.stroke(),this._drawWheel(t,this.x,["Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre"],this.monthWheel,this.monthMin,this.monthMax);var i=new Date(this.yearWheel,this.monthWheel+1,0).getDate(),o=Array.from({length:i},function(t,e){return(e+1).toString()});this._drawWheel(t,this.x+n,o,this.dayWheel-1,0,i-1);var a=Array.from({length:this.yearMax-this.yearMin+1},function(t,n){return(e.yearMin+n).toString()}),s=this.yearWheel-this.yearMin;this._drawWheel(t,this.x+2*n,a,s,0,a.length-1),t.restore()}},{key:"_drawWheel",value:function(t,e,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:n.length-1,a=this.width/3,s=this.y+this.wheelHeight/2;t.save(),t.beginPath(),t.rect(e,this.y,a,this.wheelHeight),t.clip();for(var l=-2;l<=2;l++){var u=r+l;if(u>=i&&u<=o){var c=s+l*this.itemHeight,h=1-Math.abs(c-s)/this.wheelHeight,f=Math.max(.3,h);t.fillStyle="rgba(0, 0, 0, ".concat(f,")"),t.font="".concat(0===l?"bold ":"").concat(18+2*h,"px -apple-system, sans-serif"),t.textAlign="center",t.textBaseline="middle",t.fillText(n[u-i],e+a/2,c)}}t.restore()}},{key:"_unmount",value:function(){var t,n,r;this._removeGlobalMoveListener(),(t=e,n=this,"function"==typeof(r=us(cs(1&3?t.prototype:t),"_unmount",n))?function(t){return r.apply(n,t)}:r)([])}}],r&&as(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);function ds(t){return ds="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ds(t)}function ps(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ys(r.key),r)}}function ys(t){var e=function(t){if("object"!=ds(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ds(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ds(e)?e:e+""}function vs(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(vs=function(){return!!t})()}function ms(t){return ms=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ms(t)}function gs(t,e){return gs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},gs(t,e)}const bs=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=ms(e),function(t,e){if(e&&("object"==ds(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,vs()?Reflect.construct(e,n||[],ms(t).constructor):e.apply(t,n))}(this,e,[t,r])).selectedDate=r.selectedDate||new Date,n.minDate=r.minDate||null,n.maxDate=r.maxDate||null,n.onChange=r.onChange,n.platform=t.platform,n.label=r.label||"Sélectionner une date",n.headerBgColor=r.headerBgColor||"#6200EE",n.inputBgColor=r.inputBgColor||null,n.inputTextColor=r.inputTextColor||null,n.inputBorderColor=r.inputBorderColor||null,n.labelColor=r.labelColor||null,n.inputHeight=r.inputHeight||50,n.inputRadius=r.inputRadius||("cupertino"===n.platform?10:0),n.fontSize=r.fontSize||null,n.selectedColor=r.selectedColor||"#6200EE",n.buttonColor=r.buttonColor||"#6200EE","cupertino"===n.platform?(n.width=r.width||t.width-40,n.pickerModal=null):n.width=r.width||Math.min(320,t.width-40),n.height=n.inputHeight,n.onClick=n.openPicker.bind(n),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&gs(t,e)}(e,t),n=e,(r=[{key:"openPicker",value:function(){"cupertino"===this.platform?this.openIOSPicker():this.openAndroidDialog()}},{key:"openIOSPicker",value:function(){var t=this,e=new vt(this.framework,{title:"",width:this.framework.width,height:320,showCloseButton:!1,closeOnOverlayClick:!0,bgColor:"#F9F9F9"}),n=new fs(this.framework,{x:0,y:20,width:this.framework.width-40,selectedDate:this.selectedDate,onChange:function(e){t.selectedDate=e,t.onChange&&t.onChange(e)}});e.add(n);var r=new Wo(this.framework,{x:(this.framework.width-200)/2,y:230,width:200,height:44,text:"Valider",bgColor:this.buttonColor,textColor:"#FFFFFF",onClick:function(){return e.hide()}});e.add(r),this.framework.add(e),e.show(),this.pickerModal=e}},{key:"openAndroidDialog",value:function(){var t=this,e=new is(this.framework,{selectedDate:this.selectedDate,onChange:function(e){t.selectedDate=e,t.onChange&&t.onChange(e)},headerBgColor:this.headerBgColor,selectedColor:this.selectedColor,buttonColor:this.buttonColor});this.framework.add(e),e.show()}},{key:"draw",value:function(t){if("cupertino"===this.platform){var e=this.inputBgColor||"#FFFFFF",n=this.inputTextColor||"#000000",r=this.labelColor||"#8E8E93",i=this.inputBorderColor||"#C7C7CC",o=this.fontSize||16;t.save(),t.fillStyle=e,this.roundRect(t,this.x,this.y,this.width,this.height,this.inputRadius),t.fill(),t.strokeStyle=i,t.lineWidth=1,t.stroke(),t.fillStyle=r,t.font="14px -apple-system, sans-serif",t.textAlign="left",t.textBaseline="middle",t.fillText(this.label,this.x+15,this.y+this.height/2-10),t.fillStyle=n,t.font="".concat(o,"px -apple-system, sans-serif"),t.fillText(this.formatDate(this.selectedDate),this.x+15,this.y+this.height/2+10),t.strokeStyle=i,t.lineWidth=2,t.lineCap="round",t.beginPath(),t.moveTo(this.x+this.width-25,this.y+this.height/2-5),t.lineTo(this.x+this.width-20,this.y+this.height/2),t.lineTo(this.x+this.width-15,this.y+this.height/2-5),t.stroke(),t.restore()}else{var a=this.inputBgColor||(this.pressed?"#F5F5F5":"#FFFFFF"),s=this.inputTextColor||"#000000",l=this.labelColor||"#666666",u=this.inputBorderColor||"#E0E0E0",c=this.fontSize||16,h=l;t.save(),t.fillStyle=a,this.inputRadius>0?(this.roundRect(t,this.x,this.y,this.width,this.height,this.inputRadius),t.fill()):t.fillRect(this.x,this.y,this.width,this.height),t.strokeStyle=u,t.lineWidth=1,this.inputRadius>0?(this.roundRect(t,this.x,this.y,this.width,this.height,this.inputRadius),t.stroke()):t.strokeRect(this.x,this.y,this.width,this.height),t.strokeStyle=h,t.lineWidth=2,t.strokeRect(this.x+15,this.y+15,20,20),t.beginPath(),t.moveTo(this.x+18,this.y+12),t.lineTo(this.x+18,this.y+18),t.moveTo(this.x+32,this.y+12),t.lineTo(this.x+32,this.y+18),t.stroke(),t.fillStyle=l,t.font="12px Roboto, sans-serif",t.textAlign="left",t.textBaseline="top",t.fillText(this.label,this.x+45,this.y+8),t.fillStyle=s,t.font="".concat(c,"px Roboto, sans-serif"),t.textBaseline="bottom",t.fillText(this.formatDate(this.selectedDate),this.x+45,this.y+this.height-8),t.restore()}}},{key:"formatDate",value:function(t){var e=t.getDate().toString().padStart(2,"0"),n=(t.getMonth()+1).toString().padStart(2,"0"),r=t.getFullYear();return"".concat(e,"/").concat(n,"/").concat(r)}},{key:"roundRect",value:function(t,e,n,r,i,o){t.beginPath(),t.moveTo(e+o,n),t.lineTo(e+r-o,n),t.quadraticCurveTo(e+r,n,e+r,n+o),t.lineTo(e+r,n+i-o),t.quadraticCurveTo(e+r,n+i,e+r-o,n+i),t.lineTo(e+o,n+i),t.quadraticCurveTo(e,n+i,e,n+i-o),t.lineTo(e,n+o),t.quadraticCurveTo(e,n,e+o,n),t.closePath()}},{key:"isPointInside",value:function(t,e){return t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height}}])&&ps(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);function ws(t){return ws="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ws(t)}function xs(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ks(r.key),r)}}function ks(t){var e=function(t){if("object"!=ws(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ws(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ws(e)?e:e+""}function Ss(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ss=function(){return!!t})()}function Ts(t){return Ts=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ts(t)}function Ps(t,e){return Ps=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ps(t,e)}const Os=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=Ts(e),function(t,e){if(e&&("object"==ws(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Ss()?Reflect.construct(e,n||[],Ts(t).constructor):e.apply(t,n))}(this,e,[t,r])).imageUrl=r.imageUrl||null,n.initials=r.initials||"??",n.size=r.size||48,n.bgColor=r.bgColor||n.generateColor(n.initials),n.textColor=r.textColor||"#FFFFFF",n.borderWidth=r.borderWidth||0,n.borderColor=r.borderColor||"#FFFFFF",n.status=r.status||null,n.width=n.size,n.height=n.size,n.imageComponent=null,n.imageUrl&&(n.imageComponent=new ImageComponent(t,{x:n.x,y:n.y,width:n.size,height:n.size,src:n.imageUrl,fit:"cover",borderRadius:n.size/2})),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ps(t,e)}(e,t),n=e,(r=[{key:"generateColor",value:function(t){for(var e=0,n=0;n<t.length;n++)e=t.charCodeAt(n)+((e<<5)-e);var r=["#E91E63","#9C27B0","#673AB7","#3F51B5","#2196F3","#00BCD4","#009688","#4CAF50","#FF9800","#FF5722","#795548","#607D8B"];return r[Math.abs(e)%r.length]}},{key:"draw",value:function(t){t.save();var e=this.x+this.size/2,n=this.y+this.size/2,r=this.size/2;if(this.borderWidth>0&&(t.fillStyle=this.borderColor,t.beginPath(),t.arc(e,n,r,0,2*Math.PI),t.fill()),t.save(),t.beginPath(),t.arc(e,n,r-this.borderWidth,0,2*Math.PI),t.clip(),this.imageComponent&&this.imageComponent.loaded?(this.imageComponent.x=this.x+this.borderWidth,this.imageComponent.y=this.y+this.borderWidth,this.imageComponent.width=this.size-2*this.borderWidth,this.imageComponent.height=this.size-2*this.borderWidth,this.imageComponent.draw(t)):(t.fillStyle=this.bgColor,t.fillRect(this.x,this.y,this.size,this.size),t.fillStyle=this.textColor,t.font="bold ".concat(this.size/2.5,"px -apple-system, sans-serif"),t.textAlign="center",t.textBaseline="middle",t.fillText(this.initials.toUpperCase(),e,n)),t.restore(),this.status){var i,o=this.size/4,a=this.x+this.size-o,s=this.y+this.size-o;switch(this.status){case"online":i="#4CAF50";break;case"offline":default:i="#9E9E9E";break;case"away":i="#FF9800";break;case"busy":i="#F44336"}t.fillStyle="#FFFFFF",t.beginPath(),t.arc(a,s,o/2+1,0,2*Math.PI),t.fill(),t.fillStyle=i,t.beginPath(),t.arc(a,s,o/2,0,2*Math.PI),t.fill()}t.restore()}},{key:"setImage",value:function(t){this.imageUrl=t,this.imageComponent=t?new ImageComponent(this.framework,{x:this.x,y:this.y,width:this.size,height:this.size,src:t,fit:"cover",borderRadius:this.size/2}):null}},{key:"setStatus",value:function(t){this.status=t}},{key:"isPointInside",value:function(t,e){var n=e-this.framework.scrollOffset,r=t-(this.x+this.size/2),i=n-(this.y+this.size/2);return Math.sqrt(r*r+i*i)<=this.size/2}}])&&xs(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);function Cs(t){return Cs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Cs(t)}function Es(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,js(r.key),r)}}function js(t){var e=function(t){if("object"!=Cs(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Cs(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Cs(e)?e:e+""}function Is(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Is=function(){return!!t})()}function Fs(t){return Fs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Fs(t)}function Rs(t,e){return Rs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Rs(t,e)}const Ms=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=Fs(e),function(t,e){if(e&&("object"==Cs(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Is()?Reflect.construct(e,n||[],Fs(t).constructor):e.apply(t,n))}(this,e,[t,r])).message=r.message||"",n.actionText=r.actionText||null,n.onAction=r.onAction,n.duration=r.duration||4e3,n.platform=t.platform,n.height=48,n.padding=16,n.minWidth=344,n.maxWidth=Math.min(672,t.width-32);var i=t.ctx;i.font="14px -apple-system, Roboto, sans-serif";var o=i.measureText(n.message).width,a=n.actionText?i.measureText(n.actionText).width+40:0;return n.width=Math.min(n.maxWidth,Math.max(n.minWidth,o+a+3*n.padding)),n.x=(t.width-n.width)/2,n.y=t.height,n.targetY=t.height-n.height-37,n.opacity=0,n.isVisible=!1,n.actionRect=null,n.onPress=n.handlePress.bind(n),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Rs(t,e)}(e,t),n=e,(r=[{key:"show",value:function(){var t=this;this.isVisible=!0,this.visible=!0,this.animateIn(),setTimeout(function(){t.isVisible&&t.hide()},this.duration)}},{key:"hide",value:function(){this.animateOut()}},{key:"animateIn",value:function(){var t=this,e=function(){t.y>t.targetY?(t.y-=.2*(t.y-t.targetY),t.opacity=Math.min(1,t.opacity+.1),requestAnimationFrame(e)):(t.y=t.targetY,t.opacity=1)};e()}},{key:"animateOut",value:function(){var t=this,e=function(){t.opacity>0?(t.y+=5,t.opacity-=.1,requestAnimationFrame(e)):(t.isVisible=!1,t.visible=!1,t.framework.remove(t))};e()}},{key:"draw",value:function(t){if(this.isVisible&&!(this.opacity<=0)){if(t.save(),t.globalAlpha=this.opacity,t.fillStyle="material"===this.platform?"#323232":"rgba(0, 0, 0, 0.9)",t.shadowColor="rgba(0, 0, 0, 0.3)",t.shadowBlur=8,t.shadowOffsetY=4,t.beginPath(),this.roundRect(t,this.x,this.y,this.width,this.height,4),t.fill(),t.shadowColor="transparent",t.fillStyle="#FFFFFF",t.font="14px -apple-system, Roboto, sans-serif",t.textAlign="left",t.textBaseline="middle",t.fillText(this.message,this.x+this.padding,this.y+this.height/2),this.actionText){var e=this.framework.ctx;e.font="14px -apple-system, Roboto, sans-serif";var n=e.measureText(this.actionText).width,r=this.x+this.width-n-2*this.padding,i=this.y;this.actionRect={x:r,y:i,width:n+2*this.padding,height:this.height},this.actionHovered&&(t.fillStyle="rgba(255, 255, 255, 0.1)",t.fillRect(r,i,n+2*this.padding,this.height));var o="material"===this.platform?"#BB86FC":"#0A84FF";t.fillStyle=o,t.font="bold 14px -apple-system, Roboto, sans-serif",t.textAlign="center",t.fillText(this.actionText,r+(n+2*this.padding)/2,this.y+this.height/2)}t.restore()}}},{key:"handlePress",value:function(t,e){this.actionRect&&this.actionText&&t>=this.actionRect.x&&t<=this.actionRect.x+this.actionRect.width&&e>=this.actionRect.y&&e<=this.actionRect.y+this.actionRect.height&&(this.onAction&&this.onAction(),this.hide())}},{key:"roundRect",value:function(t,e,n,r,i,o){t.beginPath(),t.moveTo(e+o,n),t.lineTo(e+r-o,n),t.quadraticCurveTo(e+r,n,e+r,n+o),t.lineTo(e+r,n+i-o),t.quadraticCurveTo(e+r,n+i,e+r-o,n+i),t.lineTo(e+o,n+i),t.quadraticCurveTo(e,n+i,e,n+i-o),t.lineTo(e,n+o),t.quadraticCurveTo(e,n,e+o,n),t.closePath()}},{key:"isPointInside",value:function(t,e){return this.isVisible&&t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height}}])&&Es(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);function As(t){return As="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},As(t)}function _s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ds(r.key),r)}}function Ds(t){var e=function(t){if("object"!=As(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=As(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==As(e)?e:e+""}function Bs(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Bs=function(){return!!t})()}function Ls(t){return Ls=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ls(t)}function Ws(t,e){return Ws=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ws(t,e)}const Hs=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=Ls(e),function(t,e){if(e&&("object"==As(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Bs()?Reflect.construct(e,n||[],Ls(t).constructor):e.apply(t,n))}(this,e,[t,r])).src=r.src||"",n.poster=r.poster||"",n.playing=!1,n.platform=t.platform,n.showControls=!0,n.controlsTimeout=null,n.currentTime=0,n.duration=0,n.progress=0,n.volume=1,n.showVolume=!1,n.fullscreen=!1,n.loaded=!1,n.controlsHeight=50,n.volumeHeight=100,n.videoElement=document.createElement("video"),n.videoElement.style.position="fixed",n.videoElement.style.left="-9999px",n.videoElement.style.top="-9999px",n.videoElement.style.width="0",n.videoElement.style.height="0",n.videoElement.src=n.src,n.videoElement.poster=n.poster,n.videoElement.preload="auto",n.videoElement.crossOrigin="anonymous",n.videoElement.controls=!1,document.body.appendChild(n.videoElement),n.videoElement.addEventListener("loadedmetadata",function(){n.duration=n.videoElement.duration,n.loaded=!0}),n.videoElement.addEventListener("timeupdate",function(){n.currentTime=n.videoElement.currentTime,n.progress=n.currentTime/n.duration*100}),n.videoElement.addEventListener("ended",function(){n.playing=!1,n.onEnded&&n.onEnded()}),n.videoElement.addEventListener("play",function(){n.playing=!0,n.onPlay&&n.onPlay()}),n.videoElement.addEventListener("pause",function(){n.playing=!1,n.onPause&&n.onPause()}),n.onPlay=r.onPlay,n.onPause=r.onPause,n.onEnded=r.onEnded,n.onFullscreen=r.onFullscreen,n.onPress=n.handlePress.bind(n),n.onMove=n.handleMove.bind(n),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ws(t,e)}(e,t),n=e,(r=[{key:"play",value:function(){this.videoElement&&(this.videoElement.play(),this.playing=!0,this.showControlsTemporarily())}},{key:"pause",value:function(){this.videoElement&&(this.videoElement.pause(),this.playing=!1,this.showControlsTemporarily())}},{key:"togglePlay",value:function(){this.playing?this.pause():this.play()}},{key:"showControlsTemporarily",value:function(){var t=this;this.showControls=!0,clearTimeout(this.controlsTimeout),this.controlsTimeout=setTimeout(function(){t.playing&&(t.showControls=!1)},3e3)}},{key:"handlePress",value:function(t,e){var n=e-this.framework.scrollOffset;this.showControls=!0,this.showControlsTemporarily();var r=this.x+this.width/2,i=this.y+this.height/2;if(t>=r-30&&t<=r+30&&n>=i-30&&n<=i+30)this.togglePlay();else{if(this.showControls&&this.loaded){var o=this.y+this.height-30;if(n>=o&&n<=o+10){var a=t-this.x;return this.progress=a/this.width*100,this.currentTime=this.duration*this.progress/100,void(this.videoElement&&(this.videoElement.currentTime=this.currentTime))}}var s=this.x+this.width-40,l=this.y+this.height-40;t>=s&&t<=s+30&&n>=l&&n<=l+30&&this.toggleFullscreen()}}},{key:"handleMove",value:function(t,e){}},{key:"toggleFullscreen",value:function(){!document.fullscreenElement&&this.videoElement.requestFullscreen?(this.videoElement.requestFullscreen(),this.fullscreen=!0,this.onFullscreen&&this.onFullscreen(!0)):document.exitFullscreen&&(document.exitFullscreen(),this.fullscreen=!1,this.onFullscreen&&this.onFullscreen(!1))}},{key:"draw",value:function(t){t.save();try{this.loaded&&this.videoElement.readyState>=2?t.drawImage(this.videoElement,this.x,this.y,this.width,this.height):(t.fillStyle="#000000",t.fillRect(this.x,this.y,this.width,this.height),t.fillStyle="#FFFFFF",t.font="16px Arial",t.textAlign="center",t.textBaseline="middle",t.fillText("Chargement de la vidéo...",this.x+this.width/2,this.y+this.height/2))}catch(e){t.fillStyle="#000000",t.fillRect(this.x,this.y,this.width,this.height),t.fillStyle="#FFFFFF",t.font="14px Arial",t.textAlign="center",t.textBaseline="middle",t.fillText("Vidéo: "+this.src.substring(0,30)+"...",this.x+this.width/2,this.y+this.height/2-10),t.fillText("Cliquez pour lire",this.x+this.width/2,this.y+this.height/2+10)}if(this.playing&&!this.showControls||(t.fillStyle="rgba(0, 0, 0, 0.5)",t.fillRect(this.x,this.y,this.width,this.height)),!this.playing||this.showControls){var e=this.x+this.width/2,n=this.y+this.height/2;t.fillStyle="rgba(0, 0, 0, 0.7)",t.beginPath(),t.arc(e,n,30,0,2*Math.PI),t.fill(),t.fillStyle="#FFFFFF",this.playing?(t.fillRect(e-8,n-15,6,30),t.fillRect(e+2,n-15,6,30)):(t.beginPath(),t.moveTo(e-5,n-15),t.lineTo(e-5,n+15),t.lineTo(e+20,n),t.closePath(),t.fill())}if(this.showControls&&this.loaded){t.fillStyle="rgba(0, 0, 0, 0.8)",t.fillRect(this.x,this.y+this.height-this.controlsHeight,this.width,this.controlsHeight);var r=this.x+10,i=this.y+this.height-25,o=this.width-60;t.fillStyle="#555555",t.fillRect(r,i,o,4),t.fillStyle="#FF0000";var a=o*this.progress/100;t.fillRect(r,i,a,4);var s=r+a;t.fillStyle="#FFFFFF",t.beginPath(),t.arc(s,i+2,6,0,2*Math.PI),t.fill();var l=this.formatTime(this.currentTime),u=this.formatTime(this.duration);t.fillStyle="#FFFFFF",t.font="12px Arial",t.textAlign="left",t.fillText(l,this.x+10,this.y+this.height-35),t.textAlign="right",t.fillText(u,this.x+o+10,this.y+this.height-35);var c=this.x+this.width-40,h=this.y+this.height-40;t.strokeStyle="#FFFFFF",t.lineWidth=2,t.strokeRect(c,h,20,20),t.beginPath(),t.moveTo(c+5,h+5),t.lineTo(c+5,h+15),t.lineTo(c+15,h+15),t.lineTo(c+15,h+5),t.stroke()}t.restore()}},{key:"formatTime",value:function(t){var e=Math.floor(t/60),n=Math.floor(t%60);return"".concat(e,":").concat(n<10?"0":"").concat(n)}},{key:"isPointInside",value:function(t,e){return t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height}},{key:"remove",value:function(){this.videoElement&&this.videoElement.parentNode&&this.videoElement.parentNode.removeChild(this.videoElement)}}])&&_s(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);function zs(t){return zs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},zs(t)}function qs(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Us(r.key),r)}}function Us(t){var e=function(t){if("object"!=zs(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=zs(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==zs(e)?e:e+""}function Ns(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ns=function(){return!!t})()}function Vs(t){return Vs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Vs(t)}function Gs(t,e){return Gs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Gs(t,e)}const Ys=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=Vs(e),function(t,e){if(e&&("object"==zs(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Ns()?Reflect.construct(e,n||[],Vs(t).constructor):e.apply(t,n))}(this,e,[t,r])).text=r.text||"",n.icon=r.icon||null,n.closable=!1!==r.closable,n.platform=t.platform,n.bgColor=r.bgColor||("material"===t.platform?"#E0E0E0":"#F0F0F0"),n.textColor=r.textColor||"#000000",n.onClose=r.onClose;var i=t.ctx;i.font="14px -apple-system, sans-serif";var o=i.measureText(n.text).width,a=n.icon?24:0,s=n.closable?24:0;return n.width=a+o+s+24,n.height=r.height||32,n.borderRadius=n.height/2,n.closeButtonRect=null,n.onPress=n.handlePress.bind(n),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Gs(t,e)}(e,t),n=e,(r=[{key:"draw",value:function(t){t.save(),t.fillStyle=this.pressed?this.darkenColor(this.bgColor):this.bgColor,t.beginPath(),this.roundRect(t,this.x,this.y,this.width,this.height,this.borderRadius),t.fill();var e=this.x+12;if(this.icon&&(t.font="16px sans-serif",t.textAlign="left",t.textBaseline="middle",t.fillStyle=this.textColor,t.fillText(this.icon,e,this.y+this.height/2),e+=20),t.font="14px -apple-system, sans-serif",t.fillStyle=this.textColor,t.textAlign="left",t.textBaseline="middle",t.fillText(this.text,e,this.y+this.height/2),this.closable){var n=this.x+this.width-20,r=this.y+this.height/2;this.closeButtonRect={x:n-8,y:r-8,width:16,height:16},t.fillStyle="rgba(0, 0, 0, 0.1)",t.beginPath(),t.arc(n,r,8,0,2*Math.PI),t.fill(),t.strokeStyle=this.textColor,t.lineWidth=1.5,t.lineCap="round",t.beginPath(),t.moveTo(n-4,r-4),t.lineTo(n+4,r+4),t.stroke(),t.beginPath(),t.moveTo(n+4,r-4),t.lineTo(n-4,r+4),t.stroke()}t.restore()}},{key:"handlePress",value:function(t,e){var n=e-this.framework.scrollOffset;this.closable&&this.closeButtonRect&&t>=this.closeButtonRect.x&&t<=this.closeButtonRect.x+this.closeButtonRect.width&&n>=this.closeButtonRect.y&&n<=this.closeButtonRect.y+this.closeButtonRect.height?this.onClose&&this.onClose():this.onClick&&this.onClick()}},{key:"roundRect",value:function(t,e,n,r,i,o){t.beginPath(),t.moveTo(e+o,n),t.lineTo(e+r-o,n),t.quadraticCurveTo(e+r,n,e+r,n+o),t.lineTo(e+r,n+i-o),t.quadraticCurveTo(e+r,n+i,e+r-o,n+i),t.lineTo(e+o,n+i),t.quadraticCurveTo(e,n+i,e,n+i-o),t.lineTo(e,n+o),t.quadraticCurveTo(e,n,e+o,n),t.closePath()}},{key:"darkenColor",value:function(t){if(t.startsWith("#")){var e=this.hexToRgb(t);return"rgb(".concat(Math.max(0,e.r-20),", ").concat(Math.max(0,e.g-20),", ").concat(Math.max(0,e.b-20),")")}return t}},{key:"hexToRgb",value:function(t){var e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return e?{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16)}:{r:0,g:0,b:0}}},{key:"isPointInside",value:function(t,e){var n=e-this.framework.scrollOffset;return t>=this.x&&t<=this.x+this.width&&n>=this.y&&n<=this.y+this.height}}])&&qs(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);function Xs(t){return Xs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xs(t)}function Qs(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ks(r.key),r)}}function Ks(t){var e=function(t){if("object"!=Xs(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Xs(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Xs(e)?e:e+""}function $s(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return($s=function(){return!!t})()}function Js(t){return Js=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Js(t)}function Zs(t,e){return Zs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Zs(t,e)}const tl=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=Js(e),function(t,e){if(e&&("object"==Xs(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,$s()?Reflect.construct(e,n||[],Js(t).constructor):e.apply(t,n))}(this,e,[t,r])).value=r.value||0,n.min=void 0!==r.min?r.min:0,n.max=void 0!==r.max?r.max:100,n.step=r.step||1,n.platform=t.platform,n.onChange=r.onChange,n.width=r.width||120,n.height=r.height||40,n.buttonWidth=n.height,n.decrementPressed=!1,n.incrementPressed=!1,n.onPress=n.handlePress.bind(n),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Zs(t,e)}(e,t),n=e,(r=[{key:"increment",value:function(){this.value+this.step<=this.max&&(this.value+=this.step,this.onChange&&this.onChange(this.value))}},{key:"decrement",value:function(){this.value-this.step>=this.min&&(this.value-=this.step,this.onChange&&this.onChange(this.value))}},{key:"setValue",value:function(t){this.value=Math.max(this.min,Math.min(this.max,t)),this.onChange&&this.onChange(this.value)}},{key:"draw",value:function(t){if(t.save(),"material"===this.platform){var e=this.value>this.min;t.fillStyle=this.decrementPressed?"#E0E0E0":"#F5F5F5",t.strokeStyle=e?"#6200EE":"#CCCCCC",t.lineWidth=2,t.beginPath(),this.roundRect(t,this.x,this.y,this.buttonWidth,this.height,4),t.fill(),t.stroke(),t.strokeStyle=e?"#6200EE":"#CCCCCC",t.lineWidth=2,t.lineCap="round",t.beginPath(),t.moveTo(this.x+this.buttonWidth/2-8,this.y+this.height/2),t.lineTo(this.x+this.buttonWidth/2+8,this.y+this.height/2),t.stroke(),t.fillStyle="#FFFFFF",t.fillRect(this.x+this.buttonWidth,this.y,this.width-2*this.buttonWidth,this.height),t.strokeStyle="#E0E0E0",t.lineWidth=1,t.strokeRect(this.x+this.buttonWidth,this.y,this.width-2*this.buttonWidth,this.height),t.fillStyle="#000000",t.font="bold 16px Roboto, sans-serif",t.textAlign="center",t.textBaseline="middle",t.fillText(this.value.toString(),this.x+this.width/2,this.y+this.height/2);var n=this.value<this.max;t.fillStyle=this.incrementPressed?"#E0E0E0":"#F5F5F5",t.strokeStyle=n?"#6200EE":"#CCCCCC",t.lineWidth=2,t.beginPath(),this.roundRect(t,this.x+this.width-this.buttonWidth,this.y,this.buttonWidth,this.height,4),t.fill(),t.stroke(),t.strokeStyle=n?"#6200EE":"#CCCCCC",t.lineWidth=2,t.lineCap="round";var r=this.x+this.width-this.buttonWidth/2,i=this.y+this.height/2;t.beginPath(),t.moveTo(r-8,i),t.lineTo(r+8,i),t.stroke(),t.beginPath(),t.moveTo(r,i-8),t.lineTo(r,i+8),t.stroke()}else{t.strokeStyle="#C7C7CC",t.lineWidth=1,t.beginPath(),this.roundRect(t,this.x,this.y,this.width,this.height,this.height/2),t.stroke(),t.beginPath(),t.moveTo(this.x+this.width/2,this.y),t.lineTo(this.x+this.width/2,this.y+this.height),t.stroke();var o=this.value>this.min;this.decrementPressed&&(t.fillStyle="rgba(0, 0, 0, 0.1)",t.beginPath(),t.arc(this.x+this.width/4,this.y+this.height/2,this.height/2-2,Math.PI/2,1.5*Math.PI),t.lineTo(this.x+this.width/2,this.y),t.lineTo(this.x+this.width/2,this.y+this.height),t.closePath(),t.fill()),t.strokeStyle=o?"#007AFF":"#C7C7CC",t.lineWidth=2,t.lineCap="round",t.beginPath(),t.moveTo(this.x+this.width/4-10,this.y+this.height/2),t.lineTo(this.x+this.width/4+10,this.y+this.height/2),t.stroke();var a=this.value<this.max;this.incrementPressed&&(t.fillStyle="rgba(0, 0, 0, 0.1)",t.beginPath(),t.arc(this.x+3*this.width/4,this.y+this.height/2,this.height/2-2,1.5*Math.PI,Math.PI/2),t.lineTo(this.x+this.width/2,this.y+this.height),t.lineTo(this.x+this.width/2,this.y),t.closePath(),t.fill()),t.strokeStyle=a?"#007AFF":"#C7C7CC",t.lineWidth=2,t.lineCap="round";var s=this.x+3*this.width/4,l=this.y+this.height/2;t.beginPath(),t.moveTo(s-10,l),t.lineTo(s+10,l),t.stroke(),t.beginPath(),t.moveTo(s,l-10),t.lineTo(s,l+10),t.stroke()}t.restore()}},{key:"handlePress",value:function(t,e){var n=this;this.framework.scrollOffset,t>=this.x&&t<=this.x+this.buttonWidth?(this.decrementPressed=!0,this.decrement(),setTimeout(function(){n.decrementPressed=!1},150)):t>=this.x+this.width-this.buttonWidth&&t<=this.x+this.width&&(this.incrementPressed=!0,this.increment(),setTimeout(function(){n.incrementPressed=!1},150))}},{key:"roundRect",value:function(t,e,n,r,i,o){t.beginPath(),t.moveTo(e+o,n),t.lineTo(e+r-o,n),t.quadraticCurveTo(e+r,n,e+r,n+o),t.lineTo(e+r,n+i-o),t.quadraticCurveTo(e+r,n+i,e+r-o,n+i),t.lineTo(e+o,n+i),t.quadraticCurveTo(e,n+i,e,n+i-o),t.lineTo(e,n+o),t.quadraticCurveTo(e,n,e+o,n),t.closePath()}},{key:"isPointInside",value:function(t,e){return t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height}}])&&Qs(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);function el(t){return el="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},el(t)}function nl(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return rl(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?rl(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function rl(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function il(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ol(r.key),r)}}function ol(t){var e=function(t){if("object"!=el(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=el(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==el(e)?e:e+""}function al(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(al=function(){return!!t})()}function sl(t){return sl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},sl(t)}function ll(t,e){return ll=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ll(t,e)}const ul=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=sl(e),function(t,e){if(e&&("object"==el(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,al()?Reflect.construct(e,n||[],sl(t).constructor):e.apply(t,n))}(this,e,[t,r])).title=r.title||"",n.content=r.content||"",n.icon=r.icon||null,n.expanded=r.expanded||!1,n.platform=t.platform,n.headerHeight=56,n.contentPadding=16,n.bgColor=r.bgColor||"#FFFFFF",n.borderColor=r.borderColor||"#E0E0E0",n.onToggle=r.onToggle,n.animating=!1,n.animProgress=n.expanded?1:0,n.calculateContentHeight(),n.height=n.headerHeight+(n.expanded?n.contentHeight:0),n.ripples=[],n.rippleColor="rgba(1,0,0,0.2)",n.onClick=function(){n.animating||("material"===n.platform&&n.addRipple(),n.toggle())},n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ll(t,e)}(e,t),n=e,(r=[{key:"calculateContentHeight",value:function(){var t=this.framework.ctx;t.save(),t.font="14px -apple-system, sans-serif";var e=this.width-2*this.contentPadding,n=this.wrapText(t,this.content,e);t.restore(),this.contentHeight=20*n.length+2*this.contentPadding}},{key:"wrapText",value:function(t,e,n){for(var r=e.split(" "),i=[],o=r[0]||"",a=1;a<r.length;a++){var s=r[a];t.measureText(o+" "+s).width<n?o+=" "+s:(i.push(o),o=s)}return i.push(o),i}},{key:"toggle",value:function(){this.animating||(this.expanded=!this.expanded,this.onToggle&&this.onToggle(this.expanded),this.animate())}},{key:"animate",value:function(){var t=this;if(!this.animating){this.animating=!0;var e=this.expanded?1:0,n=function(){if(Math.abs(t.animProgress-e)<.01)return t.animProgress=e,t.height=t.headerHeight+t.contentHeight*t.animProgress,void(t.animating=!1);t.animProgress+=t.animProgress<e?.1:-.1,t.height=t.headerHeight+t.contentHeight*t.animProgress,requestAnimationFrame(n)};n()}}},{key:"addRipple",value:function(){var t={x:this.width/2,y:this.headerHeight/2,radius:0,maxRadius:1.5*Math.max(this.width,this.headerHeight),opacity:.3};this.ripples.push(t),this.animateRipples()}},{key:"animateRipples",value:function(){var t=this,e=function(){var n,r=!1,i=nl(t.ripples);try{for(i.s();!(n=i.n()).done;){var o=n.value;o.radius<o.maxRadius&&(o.radius+=o.maxRadius/15,o.opacity-=.03,r=!0)}}catch(t){i.e(t)}finally{i.f()}t.ripples=t.ripples.filter(function(t){return t.opacity>0}),r&&requestAnimationFrame(e)};e()}},{key:"draw",value:function(t){t.save();var e="#FFFFFF",n="#000000",r=this.borderColor,i=0,o=2;if("material"===this.platform?(e="#F5F5F5",n="#212121",i=4,o=3):"cupertino"===this.platform&&(e="#FFFFFF",n="#000000",r="#C7C7CC",o=1.5),i>0&&(t.shadowColor="rgba(0,0,0,0.2)",t.shadowBlur=i,t.shadowOffsetX=0,t.shadowOffsetY=2),t.fillStyle=this.bgColor,t.fillRect(this.x,this.y,this.width,this.height),"cupertino"===this.platform&&(t.strokeStyle=r,t.lineWidth=1,t.strokeRect(this.x,this.y,this.width,this.height)),t.fillStyle=e,t.fillRect(this.x,this.y,this.width,this.headerHeight),"material"===this.platform&&this.ripples.length){t.save(),t.beginPath(),t.rect(this.x,this.y,this.width,this.headerHeight),t.clip();var a,s=nl(this.ripples);try{for(s.s();!(a=s.n()).done;){var l=a.value;t.globalAlpha=l.opacity,t.fillStyle=this.rippleColor,t.beginPath(),t.arc(this.x+l.x,this.y+l.y,l.radius,0,2*Math.PI),t.fill()}}catch(t){s.e(t)}finally{s.f()}t.restore(),t.globalAlpha=1}this.icon&&(t.font="20px sans-serif",t.fillStyle="#666666",t.textAlign="left",t.textBaseline="middle",t.fillText(this.icon,this.x+16,this.y+this.headerHeight/2)),t.fillStyle=n,t.font="material"===this.platform?"bold 16px Roboto, sans-serif":"bold 16px -apple-system, sans-serif",t.textAlign="left",t.textBaseline="middle";var u=this.icon?this.x+56:this.x+16;t.fillText(this.title,u,this.y+this.headerHeight/2);var c=this.x+this.width-30,h=this.y+this.headerHeight/2,f=this.animProgress*Math.PI;if(t.save(),t.translate(c,h),t.rotate(f),t.strokeStyle="#666666",t.lineWidth=o,t.lineCap="round",t.lineJoin="round",t.beginPath(),t.moveTo(-6,-3),t.lineTo(0,3),t.lineTo(6,-3),t.stroke(),t.restore(),this.animProgress>0){t.save(),t.beginPath(),t.rect(this.x,this.y+this.headerHeight,this.width,this.contentHeight*this.animProgress),t.clip(),t.strokeStyle=r,t.lineWidth=1,t.beginPath(),t.moveTo(this.x,this.y+this.headerHeight),t.lineTo(this.x+this.width,this.y+this.headerHeight),t.stroke(),t.fillStyle="#666666",t.font="14px -apple-system, sans-serif",t.textAlign="left",t.textBaseline="top";var d=this.x+this.contentPadding,p=this.y+this.headerHeight+this.contentPadding,y=this.width-2*this.contentPadding;this.wrapText(t,this.content,y).forEach(function(e,n){t.fillText(e,d,p+20*n)}),t.restore()}t.restore()}},{key:"isPointInside",value:function(t,e){return t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.headerHeight}}])&&il(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);function cl(t){return cl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},cl(t)}function hl(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,fl(r.key),r)}}function fl(t){var e=function(t){if("object"!=cl(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=cl(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==cl(e)?e:e+""}function dl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(dl=function(){return!!t})()}function pl(t){return pl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},pl(t)}function yl(t,e){return yl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},yl(t,e)}const vl=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=pl(e),function(t,e){if(e&&("object"==cl(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,dl()?Reflect.construct(e,n||[],pl(t).constructor):e.apply(t,n))}(this,e,[t,r])).checked=r.checked||!1,n.platform=t.platform,n.width=51,n.height=31,n.onChange=r.onChange,n.animProgress=n.checked?1:0,n.isAnimating=!1,n.onClick=n.handleClick.bind(n),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&yl(t,e)}(e,t),n=e,(r=[{key:"handleClick",value:function(){console.log("Switch clicked!"),this.checked=!this.checked,this.onChange&&this.onChange(this.checked),this.animate()}},{key:"animate",value:function(){var t=this;if(!this.isAnimating){this.isAnimating=!0;var e=this.checked?1:0,n=setInterval(function(){Math.abs(t.animProgress-e)<.1?(t.animProgress=e,clearInterval(n),t.isAnimating=!1):t.animProgress+=t.animProgress<e?.1:-.1},16)}}},{key:"draw",value:function(t){t.save();var e=this.y;if("material"===this.platform){var n=this.checked?"rgba(98, 0, 238, 0.5)":"rgba(0, 0, 0, 0.38)",r=this.checked?"#6200EE":"#FAFAFA";t.fillStyle=n,t.beginPath(),t.arc(this.x+15.5,e+15.5,7,Math.PI/2,1.5*Math.PI),t.arc(this.x+35.5,e+15.5,7,1.5*Math.PI,Math.PI/2),t.closePath(),t.fill();var i=this.x+15.5+20*this.animProgress;t.fillStyle=r,t.beginPath(),t.arc(i,e+15.5,10,0,2*Math.PI),t.fill(),this.checked||(t.strokeStyle="rgba(0, 0, 0, 0.12)",t.lineWidth=1,t.stroke())}else{var o=this.checked?"#34C759":"#E9E9EA";t.fillStyle=o,t.beginPath(),t.arc(this.x+15.5,e+15.5,15.5,Math.PI/2,1.5*Math.PI),t.arc(this.x+35.5,e+15.5,15.5,1.5*Math.PI,Math.PI/2),t.closePath(),t.fill();var a=this.x+15.5+20*this.animProgress;t.fillStyle="#FFFFFF",t.shadowColor="rgba(0, 0, 0, 0.3)",t.shadowBlur=4,t.shadowOffsetY=2,t.beginPath(),t.arc(a,e+15.5,13.5,0,2*Math.PI),t.fill(),t.shadowColor="transparent",t.shadowBlur=0,t.shadowOffsetY=0}t.restore()}},{key:"isPointInside",value:function(t,e){return t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height}}])&&hl(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);function ml(t){return ml="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ml(t)}function gl(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,bl(r.key),r)}}function bl(t){var e=function(t){if("object"!=ml(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ml(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ml(e)?e:e+""}function wl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(wl=function(){return!!t})()}function xl(t,e,n,r){var i=kl(Sl(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof i?function(t){return i.apply(n,t)}:i}function kl(){return kl="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Sl(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},kl.apply(null,arguments)}function Sl(t){return Sl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Sl(t)}function Tl(t,e){return Tl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Tl(t,e)}const Pl=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=Sl(e),function(t,e){if(e&&("object"==ml(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,wl()?Reflect.construct(e,n||[],Sl(t).constructor):e.apply(t,n))}(this,e,[t,r])).title=r.title||"",n.subtitle=r.subtitle||"",n.height=r.height||(n.subtitle?72:56),n.width=r.width||t.width,n.bgColor=r.bgColor||"#FFFFFF",n.platform=t.platform,n.leftActions=r.leftActions||[],n.rightActions=r.rightActions||[],n.dragOffset=0,n.dragging=!1,n.startX=0,n.startY=0,n.hasMoved=!1,n.ripples=[],n.animationFrame=null,n.lastAnimationTime=0,n.handleMouseDown=n.handleMouseDown.bind(n),n.handleMouseMove=n.handleMouseMove.bind(n),n.handleMouseUp=n.handleMouseUp.bind(n),n.handleTouchStart=n.handleTouchStart.bind(n),n.handleTouchMove=n.handleTouchMove.bind(n),n.handleTouchEnd=n.handleTouchEnd.bind(n),console.log("🏗️ SwipeableListItem créé",{hasCanvas:!!n.framework.canvas,x:n.x,y:n.y,width:n.width,height:n.height}),n.setupEventListeners(),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Tl(t,e)}(e,t),n=e,(r=[{key:"setupEventListeners",value:function(){if(this.framework.canvas){var t=this.framework.canvas;t.addEventListener("mousedown",this.handleMouseDown),t.addEventListener("mousemove",this.handleMouseMove),t.addEventListener("mouseup",this.handleMouseUp),t.addEventListener("touchstart",this.handleTouchStart,{passive:!1}),t.addEventListener("touchmove",this.handleTouchMove,{passive:!1}),t.addEventListener("touchend",this.handleTouchEnd),console.log("✅ Événements configurés")}else console.error("❌ Pas de canvas trouvé dans le framework")}},{key:"destroy",value:function(){if(this.framework.canvas){var t=this.framework.canvas;t.removeEventListener("mousedown",this.handleMouseDown),t.removeEventListener("mousemove",this.handleMouseMove),t.removeEventListener("mouseup",this.handleMouseUp),t.removeEventListener("touchstart",this.handleTouchStart),t.removeEventListener("touchmove",this.handleTouchMove),t.removeEventListener("touchend",this.handleTouchEnd)}this.animationFrame&&(cancelAnimationFrame(this.animationFrame),this.animationFrame=null),xl(e,"destroy",this,1)&&xl(e,"destroy",this,3)([])}},{key:"getCoordinates",value:function(t){var e=this.framework.canvas.getBoundingClientRect();return t.touches&&t.touches.length>0?{x:t.touches[0].clientX-e.left,y:t.touches[0].clientY-e.top}:{x:t.clientX-e.left,y:t.clientY-e.top}}},{key:"handleMouseDown",value:function(t){var e=this.getCoordinates(t);this.onDragStart(e.x,e.y)}},{key:"handleMouseMove",value:function(t){if(this.dragging){var e=this.getCoordinates(t);this.onDragMove(e.x,e.y),this.requestRender()}}},{key:"handleMouseUp",value:function(t){this.dragging&&(this.onDragEnd(),this.requestRender())}},{key:"handleTouchStart",value:function(t){var e=this.getCoordinates(t);this.isPointInside(e.x,e.y)&&(t.preventDefault(),this.onDragStart(e.x,e.y))}},{key:"handleTouchMove",value:function(t){if(this.dragging){t.preventDefault();var e=this.getCoordinates(t);this.onDragMove(e.x,e.y),this.requestRender()}}},{key:"handleTouchEnd",value:function(t){this.dragging&&(t.preventDefault(),this.onDragEnd(),this.requestRender())}},{key:"requestRender",value:function(){this.framework&&this.framework.requestRender&&this.framework.requestRender()}},{key:"onDragStart",value:function(t,e){this.isPointInside(t,e)?(this.dragging=!0,this.startX=t,this.startY=e,this.hasMoved=!1):console.log("❌ Point en dehors des limites")}},{key:"onDragMove",value:function(t,e){if(this.dragging){var n=t-this.startX;if(Math.abs(e-this.startY),Math.abs(n)>5||this.hasMoved){this.hasMoved=!0,this.dragOffset=n;var r=Math.max(80*this.leftActions.length,80*this.rightActions.length);this.dragOffset=Math.min(Math.max(this.dragOffset,-r),r)}}}},{key:"onDragEnd",value:function(){if(this.dragging){var t,e;if(this.hasMoved)if(this.dragOffset>80&&this.leftActions[0])null===(t=(e=this.leftActions[0]).onClick)||void 0===t||t.call(e);else if(this.dragOffset<-80&&this.rightActions[0]){var n,r;null===(n=(r=this.rightActions[0]).onClick)||void 0===n||n.call(r)}this.dragOffset=0,this.dragging=!1,this.hasMoved=!1}}},{key:"draw",value:function(t){if(t.save(),this.dragOffset>0&&this.leftActions[0])t.fillStyle=this.leftActions[0].color||"#388E3C",t.fillRect(this.x,this.y,this.dragOffset,this.height),t.fillStyle="#FFF",t.font="bold 14px sans-serif",t.textAlign="center",t.textBaseline="middle",t.fillText(this.leftActions[0].text,this.x+this.dragOffset/2,this.y+this.height/2);else if(this.dragOffset<0&&this.rightActions[0]){var e=-this.dragOffset;t.fillStyle=this.rightActions[0].color||"#D32F2F",t.fillRect(this.x+this.width-e,this.y,e,this.height),t.fillStyle="#FFF",t.font="bold 14px sans-serif",t.textAlign="center",t.textBaseline="middle",t.fillText(this.rightActions[0].text,this.x+this.width-e/2,this.y+this.height/2)}t.translate(this.dragOffset,0),t.fillStyle=this.bgColor,t.fillRect(this.x,this.y,this.width,this.height),t.fillStyle="#000",t.font="16px -apple-system, Roboto, sans-serif",t.textAlign="left",t.textBaseline=this.subtitle?"top":"middle";var n=this.subtitle?this.y+16:this.y+this.height/2;t.fillText(this.title,this.x+16,n),this.subtitle&&(t.fillStyle="#757575",t.font="14px -apple-system, Roboto, sans-serif",t.fillText(this.subtitle,this.x+16,this.y+38)),t.strokeStyle="#E0E0E0",t.lineWidth=1,t.beginPath(),t.moveTo(this.x,this.y+this.height),t.lineTo(this.x+this.width,this.y+this.height),t.stroke(),t.restore()}},{key:"isPointInside",value:function(t,e){return t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height}}])&&gl(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);function Ol(t){return Ol="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ol(t)}function Cl(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return El(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?El(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function El(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function jl(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Il(r.key),r)}}function Il(t){var e=function(t){if("object"!=Ol(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ol(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ol(e)?e:e+""}function Fl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Fl=function(){return!!t})()}function Rl(t){return Rl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Rl(t)}function Ml(t,e){return Ml=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ml(t,e)}const Al=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=Rl(e),function(t,e){if(e&&("object"==Ol(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Fl()?Reflect.construct(e,n||[],Rl(t).constructor):e.apply(t,n))}(this,e,[t,r])).title=r.title||"",n.subtitle=r.subtitle||"",n.leftIcon=r.leftIcon||null,n.leftImage=r.leftImage||null,n.rightIcon=r.rightIcon||null,n.rightText=r.rightText||"",n.divider=!1!==r.divider,n.platform=t.platform,n.height=r.height||(n.subtitle?72:56),n.width=r.width||t.width,n.bgColor=r.bgColor||"#FFFFFF",n.ripples=[],n.onPress=n.handlePress.bind(n),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ml(t,e)}(e,t),n=e,r=[{key:"handlePress",value:function(t,e){var n=this;if("material"===this.platform){var r=t-this.x,i=e-this.y;if(r<0||r>this.width||i<0||i>this.height)return;this.ripples.push({x:r,y:i,radius:0,maxRadius:1.5*Math.max(this.width,this.height),opacity:1,startTime:Date.now()}),this.pressed=!0,setTimeout(function(){n.pressed=!1},150),this.animateRipple()}}},{key:"animateRipple",value:function(){var t=this,e=null,n=Date.now(),r=function(){var i,o=Date.now()-n,a=Math.min(o/600,1),s=!1,l=Cl(t.ripples);try{for(l.s();!(i=l.n()).done;){var u=i.value,c=t.easeOutCubic(a);if(u.radius=c*u.maxRadius,a>.5){var h=(a-.5)/.5;u.opacity=1-h}a<1&&(s=!0)}}catch(t){l.e(t)}finally{l.f()}t.ripples=t.ripples.filter(function(t){return t.opacity>0}),s&&t.ripples.length>0?e=requestAnimationFrame(r):(e&&cancelAnimationFrame(e),t.ripples=[])};e=requestAnimationFrame(r)}},{key:"easeOutCubic",value:function(t){return 1-Math.pow(1-t,3)}},{key:"draw",value:function(t){if(t.save(),t.fillStyle=this.pressed?"#F5F5F5":this.bgColor,t.fillRect(this.x,this.y,this.width,this.height),"material"===this.platform&&this.ripples.length>0){t.save(),t.beginPath(),t.rect(this.x,this.y,this.width,this.height),t.clip();var e,n=Cl(this.ripples);try{for(n.s();!(e=n.n()).done;){var r=e.value;t.fillStyle="rgba(0, 0, 0, ".concat(.1*r.opacity,")"),t.beginPath(),t.arc(this.x+r.x,this.y+r.y,r.radius,0,2*Math.PI),t.fill()}}catch(t){n.e(t)}finally{n.f()}t.restore()}this.drawContent(t),t.restore()}},{key:"drawContent",value:function(t){var e=16;this.leftIcon?(t.fillStyle="#757575",t.font="24px sans-serif",t.textAlign="left",t.textBaseline="middle",t.fillText(this.leftIcon,this.x+e,this.y+this.height/2),e+=48):this.leftImage&&(t.fillStyle="#E0E0E0",t.beginPath(),t.arc(this.x+e+20,this.y+this.height/2,20,0,2*Math.PI),t.fill(),t.fillStyle="#757575",t.font="14px sans-serif",t.textAlign="center",t.textBaseline="middle",t.fillText("👤",this.x+e+20,this.y+this.height/2),e+=56);var n=this.x+e,r=this.y+this.height/2;this.subtitle?(t.fillStyle="#000000",t.font="16px -apple-system, Roboto, sans-serif",t.textAlign="left",t.textBaseline="bottom",t.fillText(this.title,n,r-2),t.fillStyle="#757575",t.font="14px -apple-system, Roboto, sans-serif",t.textBaseline="top",t.fillText(this.subtitle,n,r+2)):(t.fillStyle="#000000",t.font="16px -apple-system, Roboto, sans-serif",t.textAlign="left",t.textBaseline="middle",t.fillText(this.title,n,r)),this.rightText?(t.fillStyle="#757575",t.font="14px -apple-system, Roboto, sans-serif",t.textAlign="right",t.textBaseline="middle",t.fillText(this.rightText,this.x+this.width-16,r)):this.rightIcon&&(t.fillStyle="#757575",t.font="20px sans-serif",t.textAlign="right",t.textBaseline="middle",t.fillText(this.rightIcon,this.x+this.width-16,r)),this.divider&&(t.strokeStyle="#E0E0E0",t.lineWidth=1,t.beginPath(),t.moveTo(this.x+e,this.y+this.height),t.lineTo(this.x+this.width,this.y+this.height),t.stroke())}},{key:"isPointInside",value:function(t,e){return t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height}}],r&&jl(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);function _l(t){return _l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_l(t)}function Dl(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Bl(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function Ll(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Bl(Object(n),!0).forEach(function(e){Wl(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Bl(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function Wl(t,e,n){return(e=zl(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Hl(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,zl(r.key),r)}}function zl(t){var e=function(t){if("object"!=_l(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=_l(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==_l(e)?e:e+""}function ql(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ql=function(){return!!t})()}function Ul(t){return Ul=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ul(t)}function Nl(t,e){return Nl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Nl(t,e)}const Vl=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=Ul(e),function(t,e){if(e&&("object"==_l(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,ql()?Reflect.construct(e,n||[],Ul(t).constructor):e.apply(t,n))}(this,e,[t,r])).items=[],n.itemHeight=r.itemHeight||56,n.onItemClick=r.onItemClick,n.y=r.y||0,n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Nl(t,e)}(e,t),n=e,(r=[{key:"addItem",value:function(t){var e,n=this;return t instanceof u?((e=t).x=this.x,e.y=this.y+this.items.length*this.itemHeight,e.width=this.width,e.height=this.itemHeight,console.log("📦 SwipeableListItem positionné à y=".concat(e.y))):e=new Al(this.framework,Ll(Ll({},t),{},{x:this.x,y:this.y+this.items.length*this.itemHeight,width:this.width,height:this.itemHeight,onClick:function(){n.onItemClick&&n.onItemClick(n.items.length,t),t.onClick&&t.onClick()}})),this.items.push(e),this.framework.add(e),this.height=this.items.length*this.itemHeight,e}},{key:"clear",value:function(){var t,e=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Dl(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Dl(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}(this.items);try{for(e.s();!(t=e.n()).done;){var n=t.value;this.framework.remove(n)}}catch(t){e.e(t)}finally{e.f()}this.items=[],this.height=0}},{key:"draw",value:function(t){}},{key:"isPointInside",value:function(){return!1}}])&&Hl(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);function Gl(t){return Gl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Gl(t)}function Yl(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function Xl(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Yl(Object(n),!0).forEach(function(e){Ql(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Yl(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function Ql(t,e,n){return(e=Zl(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Kl(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return $l(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?$l(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function $l(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Jl(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Zl(r.key),r)}}function Zl(t){var e=function(t){if("object"!=Gl(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Gl(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Gl(e)?e:e+""}function tu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(tu=function(){return!!t})()}function eu(t){return eu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},eu(t)}function nu(t,e){return nu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},nu(t,e)}const ru=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=eu(e),function(t,e){if(e&&("object"==Gl(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,tu()?Reflect.construct(e,n||[],eu(t).constructor):e.apply(t,n))}(this,e,[t,r])).allItemsData=[],n.visibleItems=[],n.itemHeight=r.itemHeight||56,n.onItemClick=r.onItemClick,n.y=r.y||0,n.viewportHeight=r.height||t.height,n.scrollOffset=0,n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&nu(t,e)}(e,t),n=e,(r=[{key:"addItem",value:function(t){this.allItemsData.push(t),this.updateVisibleItems()}},{key:"clear",value:function(){var t,e=Kl(this.visibleItems);try{for(e.s();!(t=e.n()).done;){var n=t.value;this.framework.remove(n)}}catch(t){e.e(t)}finally{e.f()}this.allItemsData=[],this.visibleItems=[],this.height=0}},{key:"updateVisibleItems",value:function(){for(var t=this,e=Math.floor(this.scrollOffset/this.itemHeight),n=Math.min(this.allItemsData.length-1,Math.ceil((this.scrollOffset+this.viewportHeight)/this.itemHeight)),r=[],i=function(e){var n=t.visibleItems.find(function(t){return t.__virtualIndex===e});if(n)n.y=t.y+e*t.itemHeight-t.scrollOffset;else{var i=t.allItemsData[e];(n=new Al(t.framework,Xl(Xl({},i),{},{x:t.x,y:t.y+e*t.itemHeight-t.scrollOffset,width:t.width,height:t.itemHeight,onClick:function(){t.onItemClick&&t.onItemClick(e,i),i.onClick&&i.onClick()}}))).__virtualIndex=e,t.framework.add(n)}r.push(n)},o=e;o<=n;o++)i(o);var a,s=Kl(this.visibleItems);try{for(s.s();!(a=s.n()).done;){var l=a.value;r.includes(l)||this.framework.remove(l)}}catch(t){s.e(t)}finally{s.f()}this.visibleItems=r,this.height=this.allItemsData.length*this.itemHeight}},{key:"scroll",value:function(t){this.scrollOffset+=t,this.scrollOffset<0&&(this.scrollOffset=0);var e=Math.max(0,this.height-this.viewportHeight);this.scrollOffset>e&&(this.scrollOffset=e),this.updateVisibleItems()}},{key:"draw",value:function(t){var e,n=Kl(this.visibleItems);try{for(n.s();!(e=n.n()).done;)e.value.draw(t)}catch(t){n.e(t)}finally{n.f()}}},{key:"isPointInside",value:function(){return!1}}])&&Jl(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);function iu(t){return iu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},iu(t)}function ou(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,au(r.key),r)}}function au(t){var e=function(t){if("object"!=iu(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=iu(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==iu(e)?e:e+""}function su(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(su=function(){return!!t})()}function lu(t){return lu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},lu(t)}function uu(t,e){return uu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},uu(t,e)}const cu=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=lu(e),function(t,e){if(e&&("object"==iu(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,su()?Reflect.construct(e,n||[],lu(t).constructor):e.apply(t,n))}(this,e,[t,r])).progress=r.progress||0,n.platform=t.platform,n.height=r.height||4,n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&uu(t,e)}(e,t),n=e,(r=[{key:"draw",value:function(t){t.save(),"material"===this.platform?(t.fillStyle="#E0E0E0",t.fillRect(this.x,this.y,this.width,this.height),t.fillStyle="#6200EE",t.fillRect(this.x,this.y,this.width*this.progress/100,this.height)):(t.fillStyle="#E5E5EA",t.beginPath(),this.roundRect(t,this.x,this.y,this.width,this.height,this.height/2),t.fill(),t.fillStyle="#007AFF",t.beginPath(),this.roundRect(t,this.x,this.y,this.width*this.progress/100,this.height,this.height/2),t.fill()),t.restore()}},{key:"roundRect",value:function(t,e,n,r,i,o){r<2*o&&(r=2*o),t.moveTo(e+o,n),t.lineTo(e+r-o,n),t.quadraticCurveTo(e+r,n,e+r,n+o),t.lineTo(e+r,n+i-o),t.quadraticCurveTo(e+r,n+i,e+r-o,n+i),t.lineTo(e+o,n+i),t.quadraticCurveTo(e,n+i,e,n+i-o),t.lineTo(e,n+o),t.quadraticCurveTo(e,n,e+o,n)}},{key:"isPointInside",value:function(){return!1}}])&&ou(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);function hu(t){return hu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},hu(t)}function fu(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function du(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,pu(r.key),r)}}function pu(t){var e=function(t){if("object"!=hu(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=hu(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==hu(e)?e:e+""}function yu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(yu=function(){return!!t})()}function vu(t){return vu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},vu(t)}function mu(t,e){return mu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},mu(t,e)}const gu=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=vu(e),function(t,e){if(e&&("object"==hu(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,yu()?Reflect.construct(e,n||[],vu(t).constructor):e.apply(t,n))}(this,e,[t,r])).group=r.group||"default",n.checked=r.checked||!1,n.label=r.label||"",n.labelColor=r.labelColor||"#000000",n.platform=t.platform,n.circleSize=24,n.circleRadius=10,n.onChange=r.onChange,n.totalWidth=n.label?n.circleSize+8+n.getTextWidth(n.label):n.circleSize,n.width=n.totalWidth,n.height=n.circleSize,n.onClick=n.handleClick.bind(n),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&mu(t,e)}(e,t),n=e,(r=[{key:"getTextWidth",value:function(t){var e=this.framework.ctx;e.save(),e.font="16px -apple-system, sans-serif";var n=e.measureText(t).width;return e.restore(),n}},{key:"handleClick",value:function(){var t,n=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return fu(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?fu(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}(this.framework.components);try{for(n.s();!(t=n.n()).done;){var r=t.value;r instanceof e&&r.group===this.group&&r!==this&&(r.checked=!1)}}catch(t){n.e(t)}finally{n.f()}this.checked=!0,this.onChange&&this.onChange(this.checked)}},{key:"draw",value:function(t){t.save();var e=this.x+this.circleSize/2,n=this.y+this.circleSize/2;"material"===this.platform?(t.strokeStyle=this.checked?"#6200EE":"#666666",t.lineWidth=2,t.beginPath(),t.arc(e,n,this.circleRadius,0,2*Math.PI),t.stroke(),this.checked&&(t.fillStyle="#6200EE",t.beginPath(),t.arc(e,n,5,0,2*Math.PI),t.fill())):this.checked?(t.fillStyle="#007AFF",t.beginPath(),t.arc(e,n,this.circleRadius,0,2*Math.PI),t.fill(),t.fillStyle="#FFFFFF",t.beginPath(),t.arc(e,n,4,0,2*Math.PI),t.fill()):(t.strokeStyle="#D1D1D6",t.lineWidth=1.5,t.beginPath(),t.arc(e,n,this.circleRadius,0,2*Math.PI),t.stroke()),this.label&&(t.fillStyle=this.labelColor,t.font="16px -apple-system, sans-serif",t.textAlign="left",t.textBaseline="middle",t.fillText(this.label,this.x+this.circleSize+8,n)),t.restore()}},{key:"isPointInside",value:function(t,e){return t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height}}])&&du(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);function bu(t){return bu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},bu(t)}function wu(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,xu(r.key),r)}}function xu(t){var e=function(t){if("object"!=bu(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=bu(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==bu(e)?e:e+""}function ku(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ku=function(){return!!t})()}function Su(t){return Su=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Su(t)}function Tu(t,e){return Tu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Tu(t,e)}const Pu=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=Su(e),function(t,e){if(e&&("object"==bu(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,ku()?Reflect.construct(e,n||[],Su(t).constructor):e.apply(t,n))}(this,e,[t,r])).checked=!!r.checked,n.label=r.label||"",n.platform=t.platform,n.onChange=r.onChange,n.boxSize=22,n.padding=10,n.textWidth=n.label?n.getTextWidth(n.label):0,n.width="material"===n.platform?n.boxSize+n.padding+n.textWidth:n.textWidth+28,n.height=28,n.onClick=function(){var t,e;n.checked=!n.checked,null===(t=(e=n).onChange)||void 0===t||t.call(e,n.checked)},n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Tu(t,e)}(e,t),n=e,(r=[{key:"getTextWidth",value:function(t){var e=this.framework.ctx;e.save(),e.font="16px -apple-system, system-ui, sans-serif";var n=e.measureText(t).width;return e.restore(),n}},{key:"draw",value:function(t){t.save(),t.font="16px -apple-system, system-ui, sans-serif",t.textBaseline="middle";var e=this.y+this.height/2;"material"===this.platform?this.drawMaterial(t,e):this.drawCupertino(t,e),t.restore()}},{key:"drawMaterial",value:function(t,e){var n=this.x,r=e-this.boxSize/2;t.lineWidth=2,t.strokeStyle=this.checked?"#6200EE":"#757575",t.fillStyle=this.checked?"#6200EE":"transparent",this.roundRect(t,n,r,this.boxSize,this.boxSize,3),this.checked&&t.fill(),t.stroke(),this.checked&&(t.strokeStyle="#FFF",t.lineWidth=2.4,t.beginPath(),t.moveTo(n+5,r+12),t.lineTo(n+9,r+16),t.lineTo(n+17,r+7),t.stroke()),t.fillStyle="#000",t.fillText(this.label,n+this.boxSize+this.padding,e)}},{key:"drawCupertino",value:function(t,e){var n=this.x+10,r=e;this.checked?(t.fillStyle="#007AFF",t.beginPath(),t.arc(n,r,10,0,2*Math.PI),t.fill()):(t.strokeStyle="#C7C7CC",t.lineWidth=2,t.beginPath(),t.arc(n,r,10,0,2*Math.PI),t.stroke()),this.checked&&(t.strokeStyle="#FFFFFF",t.lineWidth=2.2,t.lineCap="round",t.lineJoin="round",t.beginPath(),t.moveTo(n-4,r),t.lineTo(n-1,r+3),t.lineTo(n+5,r-4),t.stroke()),t.fillStyle="#000",t.fillText(this.label,this.x+20+this.padding,e)}},{key:"roundRect",value:function(t,e,n,r,i,o){t.beginPath(),t.moveTo(e+o,n),t.lineTo(e+r-o,n),t.quadraticCurveTo(e+r,n,e+r,n+o),t.lineTo(e+r,n+i-o),t.quadraticCurveTo(e+r,n+i,e+r-o,n+i),t.lineTo(e+o,n+i),t.quadraticCurveTo(e,n+i,e,n+i-o),t.lineTo(e,n+o),t.quadraticCurveTo(e,n,e+o,n),t.closePath()}},{key:"isPointInside",value:function(t,e){return t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height}}])&&wu(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);function Ou(t){return Ou="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ou(t)}function Cu(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Eu(r.key),r)}}function Eu(t){var e=function(t){if("object"!=Ou(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ou(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ou(e)?e:e+""}function ju(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ju=function(){return!!t})()}function Iu(t){return Iu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Iu(t)}function Fu(t,e){return Fu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Fu(t,e)}const Ru=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=Iu(e),function(t,e){if(e&&("object"==Ou(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,ju()?Reflect.construct(e,n||[],Iu(t).constructor):e.apply(t,n))}(this,e,[t,r])).value=r.value||0,n.min=r.min,n.max=r.max,n.step=r.step||1,n.placeholder=r.placeholder||"0",n.platform=t.platform,n.focused=!1,n.fontSize=r.fontSize||16,n.onChange=r.onChange,"cupertino"===n.platform&&(n.height=r.height||44),n.onFocus=n.handleFocus.bind(n),n.onBlur=n.handleBlur.bind(n),n.hiddenInputId="hidden-number-input-".concat(Math.random().toString(36).substr(2,9)),n.setupHiddenInput(),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Fu(t,e)}(e,t),n=e,r=[{key:"setupHiddenInput",value:function(){var t=this,e=document.createElement("input");e.id=this.hiddenInputId,e.type="number",e.style.position="absolute",e.style.opacity="0",e.style.width="1px",e.style.height="1px",e.style.left="-9999px",e.style.top="0px",e.style.fontSize="16px",void 0!==this.min&&(e.min=this.min),void 0!==this.max&&(e.max=this.max),this.step&&(e.step=this.step),document.body.appendChild(e),e.addEventListener("input",function(e){if(t.focused){var n=parseFloat(e.target.value);isNaN(n)?n="":(void 0!==t.min&&(n=Math.max(t.min,n)),void 0!==t.max&&(n=Math.min(t.max,n))),t.value=n,t.onChange&&t.onChange(t.value)}}),e.addEventListener("blur",function(){t.handleBlur()}),e.addEventListener("keypress",function(e){"Enter"===e.key&&t.handleBlur()}),this.hiddenInput=e}},{key:"handleFocus",value:function(){var t=this;this.hiddenInput&&(this.focused=!0,this.cursorVisible=!0,this.y,this.framework.scrollOffset,this.hiddenInput.type="number",this.hiddenInput.inputMode="decimal",this.hiddenInput.pattern="[0-9]*",this.hiddenInput.value=null!==this.value&&void 0!==this.value?this.value:"",setTimeout(function(){t.hiddenInput.focus()},50))}},{key:"handleBlur",value:function(){if(this.focused=!1,this.cursorVisible=!1,this.hiddenInput&&""!==this.hiddenInput.value){var t=parseFloat(this.hiddenInput.value);isNaN(t)||(void 0!==this.min&&(t=Math.max(this.min,t)),void 0!==this.max&&(t=Math.min(this.max,t)),this.value=t)}}},{key:"onClick",value:function(){this.handleFocus()}},{key:"draw",value:function(t){t.save();var e=null!==this.value&&void 0!==this.value?this.value.toString():this.placeholder,n=null===this.value||void 0===this.value||""===this.value;if("material"===this.platform?(t.strokeStyle=this.focused?"#6200EE":"#CCCCCC",t.lineWidth=this.focused?2:1,t.beginPath(),t.moveTo(this.x,this.y+this.height),t.lineTo(this.x+this.width,this.y+this.height),t.stroke(),t.fillStyle=n?"#999999":"#000000",t.font="".concat(this.fontSize,"px Roboto, sans-serif"),t.textAlign="left",t.textBaseline="middle",t.fillText(e,this.x+2,this.y+this.height/2)):(t.strokeStyle=this.focused?"#007AFF":"#C7C7CC",t.lineWidth=1,t.beginPath(),this.roundRect(t,this.x,this.y,this.width,this.height,8),t.stroke(),t.fillStyle=n?"#999999":"#000000",t.font="".concat(this.fontSize,"px -apple-system, sans-serif"),t.textAlign="left",t.textBaseline="middle",t.fillText(e,this.x+10,this.y+this.height/2)),this.focused&&this.cursorVisible){var r=t.measureText(e).width;t.fillStyle="material"===this.platform?"#6200EE":"#007AFF",t.fillRect(this.x+("material"===this.platform?2:10)+r+2,this.y+10,2,this.height-20)}t.restore()}},{key:"roundRect",value:function(t,e,n,r,i,o){t.beginPath(),t.moveTo(e+o,n),t.lineTo(e+r-o,n),t.quadraticCurveTo(e+r,n,e+r,n+o),t.lineTo(e+r,n+i-o),t.quadraticCurveTo(e+r,n+i,e+r-o,n+i),t.lineTo(e+o,n+i),t.quadraticCurveTo(e,n+i,e,n+i-o),t.lineTo(e,n+o),t.quadraticCurveTo(e,n,e+o,n),t.closePath()}},{key:"isPointInside",value:function(t,e){return t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height}},{key:"destroy",value:function(){this.hiddenInput&&this.hiddenInput.parentNode&&this.hiddenInput.parentNode.removeChild(this.hiddenInput)}}],r&&Cu(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);function Mu(t){return Mu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Mu(t)}function Au(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,_u(r.key),r)}}function _u(t){var e=function(t){if("object"!=Mu(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Mu(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Mu(e)?e:e+""}function Du(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Du=function(){return!!t})()}function Bu(t){return Bu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Bu(t)}function Lu(t,e){return Lu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Lu(t,e)}const Wu=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=Bu(e),function(t,e){if(e&&("object"==Mu(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Du()?Reflect.construct(e,n||[],Bu(t).constructor):e.apply(t,n))}(this,e,[t,r])).options=r.options||[],n.selectedIndex=r.selectedIndex||0,n.placeholder=r.placeholder||"Select...",n.platform=t.platform,n.fontSize=r.fontSize||16,n.onChange=r.onChange,n.isOpen=!1,n.dialog=null,n.onClick=n.toggleMenu.bind(n),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Lu(t,e)}(e,t),n=e,(r=[{key:"toggleMenu",value:function(){this.isOpen&&this.dialog?this.closeMenu():this.openMenu()}},{key:"openMenu",value:function(){var t=this;this.isOpen||(this.dialog=new Ke(this.framework,{title:this.placeholder,options:this.options,selectedIndex:this.selectedIndex,onSelect:function(e,n){t.selectedIndex=e,t.onChange&&t.onChange(n,e),t.closeMenu()}}),this.framework.add(this.dialog),this.isOpen=!0)}},{key:"closeMenu",value:function(){this.dialog&&(this.dialog.hide(),this.dialog=null),this.isOpen=!1}},{key:"draw",value:function(t){t.save();var e=this.options[this.selectedIndex]||this.placeholder;if("material"===this.platform){t.fillStyle=this.pressed?"#F5F5F5":"#FFFFFF",t.fillRect(this.x,this.y,this.width,this.height),t.strokeStyle=this.isOpen?"#6200EE":"#CCCCCC",t.lineWidth=this.isOpen?2:1,t.strokeRect(this.x,this.y,this.width,this.height),t.fillStyle=e===this.placeholder?"#999999":"#000000",t.font="".concat(this.fontSize,"px Roboto, sans-serif"),t.textAlign="left",t.textBaseline="middle",t.fillText(e,this.x+15,this.y+this.height/2),t.fillStyle="#666666";var n=this.x+this.width-20,r=this.y+this.height/2;t.beginPath(),t.moveTo(n-5,r-3),t.lineTo(n+5,r-3),t.lineTo(n,r+3),t.closePath(),t.fill()}else{t.fillStyle="#FFFFFF",t.beginPath(),this.roundRect(t,this.x,this.y,this.width,this.height,8),t.fill(),t.strokeStyle=this.isOpen?"#007AFF":"#C7C7CC",t.lineWidth=1,t.stroke(),t.fillStyle=e===this.placeholder?"#999999":"#000000",t.font="".concat(this.fontSize,"px -apple-system, sans-serif"),t.textAlign="left",t.textBaseline="middle",t.fillText(e,this.x+15,this.y+this.height/2),t.strokeStyle="#007AFF",t.lineWidth=2;var i=this.x+this.width-20,o=this.y+this.height/2;t.beginPath(),t.moveTo(i-5,o-3),t.lineTo(i,o+2),t.lineTo(i+5,o-3),t.stroke()}t.restore()}},{key:"roundRect",value:function(t,e,n,r,i,o){t.moveTo(e+o,n),t.lineTo(e+r-o,n),t.quadraticCurveTo(e+r,n,e+r,n+o),t.lineTo(e+r,n+i-o),t.quadraticCurveTo(e+r,n+i,e+r-o,n+i),t.lineTo(e+o,n+i),t.quadraticCurveTo(e,n+i,e,n+i-o),t.lineTo(e,n+o),t.quadraticCurveTo(e,n,e+o,n)}},{key:"isPointInside",value:function(t,e){return t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height}}])&&Au(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);function Hu(t){return Hu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hu(t)}function zu(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function qu(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?zu(Object(n),!0).forEach(function(e){Uu(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):zu(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function Uu(t,e,n){return(e=Vu(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Nu(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Vu(r.key),r)}}function Vu(t){var e=function(t){if("object"!=Hu(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Hu(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Hu(e)?e:e+""}function Gu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Gu=function(){return!!t})()}function Yu(){return Yu="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Xu(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},Yu.apply(null,arguments)}function Xu(t){return Xu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Xu(t)}function Qu(t,e){return Qu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Qu(t,e)}const Ku=function(t){function e(t){var n,r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var o=(null===(n=i.options)||void 0===n?void 0:n.length)||0,a=Math.min(400,Math.max(200,50*o+150));return(r=function(t,e,n){return e=Xu(e),function(t,e){if(e&&("object"==Hu(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Gu()?Reflect.construct(e,n||[],Xu(t).constructor):e.apply(t,n))}(this,e,[t,qu({title:i.title||"Sélectionner",width:Math.min(350,t.width-40),height:a,showCloseButton:!0,closeOnOverlayClick:!0,padding:0},i)])).options=i.options||[],r.selectedIndices=i.selectedIndices||[],r.onSelect=i.onSelect,r.itemHeight=50,r.buttons=["Annuler","Valider"],r.onPress=r.handlePress.bind(r),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Qu(t,e)}(e,t),n=e,r=[{key:"draw",value:function(t){if(this.isVisible){t.save(),t.globalAlpha=this.opacity,t.fillStyle="rgba(0, 0, 0, 0.5)",t.fillRect(0,0,this.framework.width,this.framework.height);var e=(this.framework.width-this.modalWidth)/2,n=(this.framework.height-this.modalHeight)/2;t.fillStyle="#FFFFFF",t.shadowColor="rgba(0, 0, 0, 0.3)",t.shadowBlur=20,t.shadowOffsetY=10,t.beginPath(),this.roundRect(t,e,n,this.modalWidth,this.modalHeight,12),t.fill(),t.shadowColor="transparent",this.title&&(t.fillStyle="#000000",t.font="bold 18px -apple-system, sans-serif",t.textAlign="center",t.textBaseline="middle",t.fillText(this.title,e+this.modalWidth/2,n+30));for(var r=e+20,i=n+60,o=0;o<this.options.length;o++){var a=i+o*this.itemHeight,s=this.selectedIndices.includes(o);t.strokeStyle=s?"#6200EE":"#666666",t.lineWidth=2,t.strokeRect(r,a+15,20,20),s&&(t.fillStyle="#6200EE",t.fillRect(r+4,a+19,12,12)),t.fillStyle="#000000",t.font="16px -apple-system, sans-serif",t.textAlign="left",t.textBaseline="middle",t.fillText(this.options[o],r+35,a+25)}var l=n+this.modalHeight-60,u=(this.modalWidth-60)/2;t.fillStyle="#666666",t.font="bold 16px -apple-system, sans-serif",t.textAlign="center",t.textBaseline="middle",t.fillText("Annuler",e+u/2+10,l),t.fillStyle="#007AFF",t.fillText("Valider",e+this.modalWidth-u/2-10,l),t.restore()}}},{key:"handlePress",value:function(t,n){for(var r=this,i=(this.framework.width-this.modalWidth)/2,o=(this.framework.height-this.modalHeight)/2,a=i+20,s=o+60,l=o+this.modalHeight-60,u=(this.modalWidth-60)/2,c=0;c<this.options.length;c++){var h=s+c*this.itemHeight;if(n>=h&&n<=h+this.itemHeight&&t>=a&&t<=i+this.modalWidth-20){var f=this.selectedIndices.indexOf(c);return void(f>-1?this.selectedIndices.splice(f,1):this.selectedIndices.push(c))}}var d,p,y;if(!(n>=l-20&&n<=l+20&&t>=i+10&&t<=i+u+10))return n>=l-20&&n<=l+20&&t>=i+this.modalWidth-u-10&&t<=i+this.modalWidth-10?(this.onSelect&&this.onSelect(this.selectedIndices,this.selectedIndices.map(function(t){return r.options[t]})),void this.hide()):void(d=e,p=this,y=Yu(Xu(d.prototype),"handlePress",p),"function"==typeof y?function(t){return y.apply(p,t)}:y)([t,n]);this.hide()}},{key:"isPointInside",value:function(t,e){var n=(this.framework.width-this.modalWidth)/2,r=(this.framework.height-this.modalHeight)/2;return t>=n&&t<=n+this.modalWidth&&e>=r&&e<=r+this.modalHeight}}],r&&Nu(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(vt);function $u(t){return $u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$u(t)}function Ju(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Zu(r.key),r)}}function Zu(t){var e=function(t){if("object"!=$u(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=$u(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==$u(e)?e:e+""}function tc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(tc=function(){return!!t})()}function ec(t){return ec=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ec(t)}function nc(t,e){return nc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},nc(t,e)}const rc=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=ec(e),function(t,e){if(e&&("object"==$u(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,tc()?Reflect.construct(e,n||[],ec(t).constructor):e.apply(t,n))}(this,e,[t,r])).orientation=r.orientation||"horizontal",n.margin=r.margin||0,n.style=r.style||"solid",n.variant=r.variant||"full",n.insetStart=r.insetStart||16,"material"===t.platform?(n.thickness=r.thickness||1,n.color=r.color||"rgba(0, 0, 0, 0.12)"):(n.thickness=r.thickness||.5,n.color=r.color||"rgba(60, 60, 67, 0.29)"),"horizontal"===n.orientation?n.height=n.thickness+2*n.margin:n.width=n.thickness+2*n.margin,n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&nc(t,e)}(e,t),n=e,(r=[{key:"draw",value:function(t){t.save();var e=this.x,n=this.y,r=this.x,i=this.y;if("horizontal"===this.orientation){if(e=this.x,r=this.x+this.width,n=i=this.y+this.margin+this.thickness/2,"inset"===this.variant)e+=this.insetStart;else if("middle"===this.variant){var o=.1*this.width;e+=o,r-=o}}else if(n=this.y,i=this.y+this.height,e=r=this.x+this.margin+this.thickness/2,"inset"===this.variant)n+=this.insetStart;else if("middle"===this.variant){var a=.1*this.height;n+=a,i-=a}t.strokeStyle=this.color,t.lineWidth=this.thickness,"dashed"===this.style?t.setLineDash([8,4]):"dotted"===this.style&&t.setLineDash([2,4]),t.beginPath(),t.moveTo(e,n),t.lineTo(r,i),t.stroke(),t.setLineDash([]),t.restore()}},{key:"isPointInside",value:function(){return!1}}])&&Ju(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);function ic(t){return ic="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ic(t)}function oc(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function ac(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,sc(r.key),r)}}function sc(t){var e=function(t){if("object"!=ic(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ic(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ic(e)?e:e+""}function lc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(lc=function(){return!!t})()}function uc(t){return uc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},uc(t)}function cc(t,e){return cc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},cc(t,e)}const hc=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=uc(e),function(t,e){if(e&&("object"==ic(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,lc()?Reflect.construct(e,n||[],uc(t).constructor):e.apply(t,n))}(this,e,[t,r])).label=r.label||"Drag & drop files here",n.sublabel=r.sublabel||"or click to browse",n.accept=r.accept||"*",n.multiple=!1!==r.multiple,n.maxSize=r.maxSize||10485760,n.files=[],n.isDragOver=!1,"material"===t.platform?(n.borderColor="#6200EE",n.bgColor="rgba(98, 0, 238, 0.05)",n.iconColor="#6200EE",n.borderRadius=4,n.borderWidth=2):(n.borderColor="#007AFF",n.bgColor="rgba(0, 122, 255, 0.05)",n.iconColor="#007AFF",n.borderRadius=12,n.borderWidth=2),n.onFilesSelected=r.onFilesSelected||null,n.onError=r.onError||null,n.createFileInput(),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&cc(t,e)}(e,t),n=e,r=[{key:"createFileInput",value:function(){var t=this;this.fileInput=document.createElement("input"),this.fileInput.type="file",this.fileInput.accept=this.accept,this.fileInput.multiple=this.multiple,this.fileInput.style.display="none",document.body.appendChild(this.fileInput),this.fileInput.addEventListener("change",function(e){t.handleFiles(Array.from(e.target.files))})}},{key:"handleFiles",value:function(t){var e,n=this,r=[],i=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return oc(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?oc(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}(t);try{var o=function(){var t=e.value;if(t.size>n.maxSize)return n.onError&&n.onError({type:"size",message:"".concat(t.name," exceeds max size of ").concat(n.formatBytes(n.maxSize)),file:t}),0;if("*"!==n.accept){var i=n.accept.split(",").map(function(t){return t.trim()}),o=t.type,a="."+t.name.split(".").pop();if(!i.some(function(t){return t.startsWith(".")?a===t:t.endsWith("/*")?o.startsWith(t.replace("/*","")):o===t}))return n.onError&&n.onError({type:"type",message:"".concat(t.name," is not an accepted file type"),file:t}),0}r.push(t)};for(i.s();!(e=i.n()).done;)o()}catch(t){i.e(t)}finally{i.f()}r.length>0&&(this.files=r,this.onFilesSelected&&this.onFilesSelected(r)),this.fileInput.value=""}},{key:"formatBytes",value:function(t){if(0===t)return"0 Bytes";var e=Math.floor(Math.log(t)/Math.log(1024));return Math.round(t/Math.pow(1024,e)*100)/100+" "+["Bytes","KB","MB","GB"][e]}},{key:"draw",value:function(t){t.save(),t.fillStyle=this.isDragOver||this.pressed?this.lightenColor(this.bgColor):this.bgColor,t.beginPath(),this.roundRect(t,this.x,this.y,this.width,this.height,this.borderRadius),t.fill(),t.strokeStyle=this.borderColor,t.lineWidth=this.borderWidth,t.setLineDash([8,8]),t.beginPath(),this.roundRect(t,this.x,this.y,this.width,this.height,this.borderRadius),t.stroke(),t.setLineDash([]);var e=this.x+this.width/2-20,n=this.y+this.height/2-40;t.strokeStyle=this.iconColor,t.lineWidth=3,t.beginPath(),t.moveTo(e,n),t.lineTo(e+28,n),t.lineTo(e+40,n+12),t.lineTo(e+40,n+40),t.lineTo(e,n+40),t.closePath(),t.stroke(),t.beginPath(),t.moveTo(e+28,n),t.lineTo(e+28,n+12),t.lineTo(e+40,n+12),t.stroke();var r=e+20,i=n+20;if(t.beginPath(),t.moveTo(r,i-12),t.lineTo(r,i+12),t.stroke(),t.beginPath(),t.moveTo(r-6,i-6),t.lineTo(r,i-12),t.lineTo(r+6,i-6),t.stroke(),t.fillStyle="#000000",t.font="16px -apple-system, BlinkMacSystemFont, Roboto, sans-serif",t.textAlign="center",t.textBaseline="middle",t.fillText(this.label,this.x+this.width/2,this.y+this.height/2+30),t.fillStyle="#666666",t.font="14px -apple-system, BlinkMacSystemFont, Roboto, sans-serif",t.fillText(this.sublabel,this.x+this.width/2,this.y+this.height/2+52),this.files.length>0){t.fillStyle=this.borderColor,t.font="12px -apple-system, BlinkMacSystemFont, Roboto, sans-serif";var o=1===this.files.length?this.files[0].name:"".concat(this.files.length," files selected");t.fillText(o,this.x+this.width/2,this.y+this.height-20)}t.restore()}},{key:"roundRect",value:function(t,e,n,r,i,o){t.moveTo(e+o,n),t.lineTo(e+r-o,n),t.quadraticCurveTo(e+r,n,e+r,n+o),t.lineTo(e+r,n+i-o),t.quadraticCurveTo(e+r,n+i,e+r-o,n+i),t.lineTo(e+o,n+i),t.quadraticCurveTo(e,n+i,e,n+i-o),t.lineTo(e,n+o),t.quadraticCurveTo(e,n,e+o,n)}},{key:"lightenColor",value:function(t){return t.startsWith("rgba")?t.replace(/[\d.]+\)$/g,"0.15)"):t}},{key:"isPointInside",value:function(t,e){return t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height}},{key:"onClick",value:function(){this.fileInput.click()}},{key:"destroy",value:function(){this.fileInput&&this.fileInput.parentNode&&this.fileInput.parentNode.removeChild(this.fileInput)}}],r&&ac(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);function fc(t){return fc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},fc(t)}function dc(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,pc(r.key),r)}}function pc(t){var e=function(t){if("object"!=fc(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=fc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==fc(e)?e:e+""}function yc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(yc=function(){return!!t})()}function vc(t){return vc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},vc(t)}function mc(t,e){return mc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},mc(t,e)}const gc=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=vc(e),function(t,e){if(e&&("object"==fc(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,yc()?Reflect.construct(e,n||[],vc(t).constructor):e.apply(t,n))}(this,e,[t,r])).columns=r.columns||[],n.data=r.data||[],n.sortable=!1!==r.sortable,n.paginated=r.paginated||!1,n.rowsPerPage=r.rowsPerPage||10,n.currentPage=0,n.sortColumn=null,n.sortDirection="asc",n.selectedRows=new Set,n.selectable=r.selectable||!1,n.headerHeight=r.headerHeight||48,n.rowHeight=r.rowHeight||48,n.onRowClick=r.onRowClick||null,n.onSelectionChange=r.onSelectionChange||null,"material"===t.platform?(n.headerBg="#FAFAFA",n.rowBg="#FFFFFF",n.rowAltBg="#F5F5F5",n.borderColor="rgba(0, 0, 0, 0.12)",n.textColor="#000000",n.headerTextColor="#616161",n.selectedBg="rgba(98, 0, 238, 0.08)",n.hoverBg="rgba(0, 0, 0, 0.04)"):(n.headerBg="#F2F2F7",n.rowBg="#FFFFFF",n.rowAltBg="#F9F9F9",n.borderColor="rgba(60, 60, 67, 0.29)",n.textColor="#000000",n.headerTextColor="#6C6C70",n.selectedBg="rgba(0, 122, 255, 0.1)",n.hoverBg="rgba(0, 0, 0, 0.03)"),n.calculateColumnWidths(),n.updateHeight(),n.hoveredRow=-1,n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&mc(t,e)}(e,t),n=e,(r=[{key:"calculateColumnWidths",value:function(){var t=this.width-(this.selectable?48:0),e=this.columns.reduce(function(t,e){return t+(e.width||0)},0),n=this.columns.filter(function(t){return!t.width}).length,r=n>0?(t-e)/n:0;this.columns.forEach(function(t){t.width||(t.width=r)})}},{key:"updateHeight",value:function(){var t=this.paginated?Math.min(this.rowsPerPage,this.data.length):this.data.length;this.height=this.headerHeight+t*this.rowHeight+(this.paginated?48:0)}},{key:"sortData",value:function(t){var e=this;this.sortColumn===t?this.sortDirection="asc"===this.sortDirection?"desc":"asc":(this.sortColumn=t,this.sortDirection="asc"),this.data.sort(function(n,r){var i=n[t],o=r[t];if("number"==typeof i&&"number"==typeof o)return"asc"===e.sortDirection?i-o:o-i;var a=String(i).toLowerCase(),s=String(o).toLowerCase();return"asc"===e.sortDirection?a.localeCompare(s):s.localeCompare(a)})}},{key:"changePage",value:function(t){var e=Math.ceil(this.data.length/this.rowsPerPage)-1;this.currentPage=Math.max(0,Math.min(t,e))}},{key:"getVisibleRows",value:function(){if(!this.paginated)return this.data;var t=this.currentPage*this.rowsPerPage;return this.data.slice(t,t+this.rowsPerPage)}},{key:"draw",value:function(t){var e=this;t.save(),t.strokeStyle=this.borderColor,t.lineWidth=1,t.strokeRect(this.x,this.y,this.width,this.height),this.drawHeader(t),this.getVisibleRows().forEach(function(n,r){e.drawRow(t,n,r)}),this.paginated&&this.drawPagination(t),t.restore()}},{key:"drawHeader",value:function(t){var e=this;t.fillStyle=this.headerBg,t.fillRect(this.x,this.y,this.width,this.headerHeight),t.strokeStyle=this.borderColor,t.lineWidth=1,t.beginPath(),t.moveTo(this.x,this.y+this.headerHeight),t.lineTo(this.x+this.width,this.y+this.headerHeight),t.stroke();var n=this.x;if(this.selectable){var r=n+14,i=this.y+this.headerHeight/2-10,o=this.data.length>0&&this.selectedRows.size===this.data.length;t.strokeStyle=this.borderColor,t.lineWidth=2,t.strokeRect(r,i,20,20),o&&(t.fillStyle="#6200EE",t.fillRect(r,i,20,20),t.strokeStyle="#FFFFFF",t.lineWidth=2,t.beginPath(),t.moveTo(r+5,i+10),t.lineTo(r+8,i+13),t.lineTo(r+15,i+6),t.stroke()),n+=48}t.fillStyle=this.headerTextColor,t.font="bold 14px -apple-system, BlinkMacSystemFont, Roboto, sans-serif",t.textAlign="left",t.textBaseline="middle",this.columns.forEach(function(r,i){if(t.fillText(r.label,n+16,e.y+e.headerHeight/2),e.sortable&&!1!==r.sortable&&e.sortColumn===r.key){var o=n+t.measureText(r.label).width+24,a=e.y+e.headerHeight/2;t.beginPath(),"asc"===e.sortDirection?(t.moveTo(o,a+3),t.lineTo(o+4,a-3),t.lineTo(o+8,a+3)):(t.moveTo(o,a-3),t.lineTo(o+4,a+3),t.lineTo(o+8,a-3)),t.stroke()}i<e.columns.length-1&&(t.strokeStyle=e.borderColor,t.beginPath(),t.moveTo(n+r.width,e.y),t.lineTo(n+r.width,e.y+e.headerHeight),t.stroke()),n+=r.width})}},{key:"drawRow",value:function(t,e,n){var r=this,i=this.y+this.headerHeight+n*this.rowHeight,o=this.selectedRows.has(e),a=this.hoveredRow===n,s=this.rowBg;o?s=this.selectedBg:a?s=this.hoverBg:n%2==1&&(s=this.rowAltBg),t.fillStyle=s,t.fillRect(this.x,i,this.width,this.rowHeight),t.strokeStyle=this.borderColor,t.lineWidth=1,t.beginPath(),t.moveTo(this.x,i+this.rowHeight),t.lineTo(this.x+this.width,i+this.rowHeight),t.stroke();var l=this.x;if(this.selectable){var u=l+14,c=i+this.rowHeight/2-10;t.strokeStyle=this.borderColor,t.lineWidth=2,t.strokeRect(u,c,20,20),o&&(t.fillStyle="#6200EE",t.fillRect(u,c,20,20),t.strokeStyle="#FFFFFF",t.lineWidth=2,t.beginPath(),t.moveTo(u+5,c+10),t.lineTo(u+8,c+13),t.lineTo(u+15,c+6),t.stroke()),l+=48}t.fillStyle=this.textColor,t.font="14px -apple-system, BlinkMacSystemFont, Roboto, sans-serif",t.textAlign="left",t.textBaseline="middle",this.columns.forEach(function(n,o){var a=String(e[n.key]||""),s=n.width-32,u=a;if(t.measureText(u).width>s){for(;t.measureText(u+"...").width>s&&u.length>0;)u=u.slice(0,-1);u+="..."}t.fillText(u,l+16,i+r.rowHeight/2),o<r.columns.length-1&&(t.strokeStyle=r.borderColor,t.beginPath(),t.moveTo(l+n.width,i),t.lineTo(l+n.width,i+r.rowHeight),t.stroke()),l+=n.width})}},{key:"drawPagination",value:function(t){var e=this.y+this.height-48,n=Math.ceil(this.data.length/this.rowsPerPage);t.fillStyle=this.headerBg,t.fillRect(this.x,e,this.width,48),t.strokeStyle=this.borderColor,t.lineWidth=1,t.beginPath(),t.moveTo(this.x,e),t.lineTo(this.x+this.width,e),t.stroke(),t.fillStyle=this.textColor,t.font="14px -apple-system, BlinkMacSystemFont, Roboto, sans-serif",t.textAlign="center",t.textBaseline="middle";var r=this.currentPage*this.rowsPerPage+1,i=Math.min((this.currentPage+1)*this.rowsPerPage,this.data.length),o="".concat(r,"-").concat(i," of ").concat(this.data.length);t.fillText(o,this.x+this.width/2,e+24);var a=this.x+this.width-100,s=this.x+this.width-50,l=e+24;t.strokeStyle=this.currentPage>0?this.textColor:this.borderColor,t.lineWidth=2,t.beginPath(),t.moveTo(a+8,l-6),t.lineTo(a,l),t.lineTo(a+8,l+6),t.stroke(),t.strokeStyle=this.currentPage<n-1?this.textColor:this.borderColor,t.beginPath(),t.moveTo(s-8,l-6),t.lineTo(s,l),t.lineTo(s-8,l+6),t.stroke()}},{key:"isPointInside",value:function(t,e){return t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height}},{key:"onClick",value:function(){}},{key:"onMove",value:function(t,e){var n=e-this.y-this.headerHeight,r=Math.floor(n/this.rowHeight),i=this.getVisibleRows();r>=0&&r<i.length?this.hoveredRow=r:this.hoveredRow=-1}}])&&dc(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);function bc(t){return bc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},bc(t)}function wc(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function xc(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?wc(Object(n),!0).forEach(function(e){kc(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):wc(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function kc(t,e,n){return(e=Oc(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Sc(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Tc(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Tc(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function Tc(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Pc(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Oc(r.key),r)}}function Oc(t){var e=function(t){if("object"!=bc(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=bc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==bc(e)?e:e+""}function Cc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Cc=function(){return!!t})()}function Ec(t){return Ec=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ec(t)}function jc(t,e){return jc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},jc(t,e)}const Ic=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=Ec(e),function(t,e){if(e&&("object"==bc(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Cc()?Reflect.construct(e,n||[],Ec(t).constructor):e.apply(t,n))}(this,e,[t,r])).nodes=r.nodes||[],n.expandedNodes=new Set(r.defaultExpanded||[]),n.selectedNode=null,n.indentSize=r.indentSize||24,n.nodeHeight=r.nodeHeight||40,n.showIcons=!1!==r.showIcons,n.onNodeClick=r.onNodeClick||null,n.onNodeExpand=r.onNodeExpand||null,"material"===t.platform?(n.bgColor="#FFFFFF",n.hoverBg="rgba(0, 0, 0, 0.04)",n.selectedBg="rgba(98, 0, 238, 0.08)",n.textColor="#000000",n.iconColor="#666666",n.borderColor="rgba(0, 0, 0, 0.12)"):(n.bgColor="#FFFFFF",n.hoverBg="rgba(0, 0, 0, 0.03)",n.selectedBg="rgba(0, 122, 255, 0.1)",n.textColor="#000000",n.iconColor="#6C6C70",n.borderColor="rgba(60, 60, 67, 0.29)"),n.updateHeight(),n.hoveredNode=null,n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&jc(t,e)}(e,t),n=e,r=[{key:"updateHeight",value:function(){var t=this.getFlattenedNodes();this.height=t.length*this.nodeHeight}},{key:"getFlattenedNodes",value:function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.nodes,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=[],i=Sc(e);try{for(i.s();!(t=i.n()).done;){var o=t.value;r.push(xc(xc({},o),{},{level:n})),o.children&&o.children.length>0&&this.expandedNodes.has(o.id)&&(r=r.concat(this.getFlattenedNodes(o.children,n+1)))}}catch(t){i.e(t)}finally{i.f()}return r}},{key:"toggleNode",value:function(t){this.expandedNodes.has(t.id)?this.expandedNodes.delete(t.id):(this.expandedNodes.add(t.id),this.onNodeExpand&&this.onNodeExpand(t)),this.updateHeight()}},{key:"selectNode",value:function(t){this.selectedNode=t,this.onNodeClick&&this.onNodeClick(t)}},{key:"draw",value:function(t){var e=this;t.save(),t.fillStyle=this.bgColor,t.fillRect(this.x,this.y,this.width,this.height),t.strokeStyle=this.borderColor,t.lineWidth=1,t.strokeRect(this.x,this.y,this.width,this.height),this.getFlattenedNodes().forEach(function(n,r){e.drawNode(t,n,r)}),t.restore()}},{key:"drawNode",value:function(t,e,n){var r=this.y+n*this.nodeHeight,i=e.level*this.indentSize,o=e.children&&e.children.length>0,a=this.expandedNodes.has(e.id),s=this.selectedNode&&this.selectedNode.id===e.id,l=this.hoveredNode&&this.hoveredNode.id===e.id;s?(t.fillStyle=this.selectedBg,t.fillRect(this.x,r,this.width,this.nodeHeight)):l&&(t.fillStyle=this.hoverBg,t.fillRect(this.x,r,this.width,this.nodeHeight)),t.strokeStyle=this.borderColor,t.lineWidth=1,t.beginPath(),t.moveTo(this.x,r+this.nodeHeight),t.lineTo(this.x+this.width,r+this.nodeHeight),t.stroke();var u=this.x+16+i;if(o){var c=u,h=r+this.nodeHeight/2;t.strokeStyle=this.iconColor,t.lineWidth=2,t.lineCap="round",a?(t.beginPath(),t.moveTo(c,h-4),t.lineTo(c+8,h+2),t.lineTo(c+16,h-4),t.stroke()):(t.beginPath(),t.moveTo(c+2,h-8),t.lineTo(c+8,h),t.lineTo(c+2,h+8),t.stroke()),u+=24}else u+=24;if(this.showIcons&&e.icon){var f=r+this.nodeHeight/2-10;t.fillStyle=e.icon,t.fillRect(u,f,20,20),u+=28}else if(this.showIcons){var d=20,p=r+this.nodeHeight/2-10;t.strokeStyle=this.iconColor,t.lineWidth=2,o?(t.beginPath(),t.moveTo(u,p+4),t.lineTo(u,p+d),t.lineTo(u+d,p+d),t.lineTo(u+d,p+4),t.lineTo(u+12,p+4),t.lineTo(u+10,p),t.lineTo(u,p),t.closePath(),t.stroke()):(t.beginPath(),t.moveTo(u,p),t.lineTo(u+14,p),t.lineTo(u+d,p+6),t.lineTo(u+d,p+d),t.lineTo(u,p+d),t.closePath(),t.stroke(),t.beginPath(),t.moveTo(u+14,p),t.lineTo(u+14,p+6),t.lineTo(u+d,p+6),t.stroke()),u+=28}t.fillStyle=this.textColor,t.font="14px -apple-system, BlinkMacSystemFont, Roboto, sans-serif",t.textAlign="left",t.textBaseline="middle";var y=this.width-(u-this.x)-16,v=e.label;if(t.measureText(v).width>y){for(;t.measureText(v+"...").width>y&&v.length>0;)v=v.slice(0,-1);v+="..."}t.fillText(v,u,r+this.nodeHeight/2)}},{key:"getNodeAtPosition",value:function(t,e){var n=e-this.y,r=Math.floor(n/this.nodeHeight),i=this.getFlattenedNodes();return r>=0&&r<i.length?i[r]:null}},{key:"isClickOnExpand",value:function(t,e){var n=e.level*this.indentSize,r=this.x+16+n;return t>=r&&t<=r+16}},{key:"isPointInside",value:function(t,e){return t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height}},{key:"onClick",value:function(){}},{key:"onPress",value:function(t,e){var n=this.getNodeAtPosition(t,e);n&&(n.children&&n.children.length>0&&this.isClickOnExpand(t,n)?this.toggleNode(n):this.selectNode(n))}},{key:"onMove",value:function(t,e){this.hoveredNode=this.getNodeAtPosition(t,e)}},{key:"expandAll",value:function(){var t=this,e=function(n){var r,i=Sc(n);try{for(i.s();!(r=i.n()).done;){var o=r.value;o.children&&o.children.length>0&&(t.expandedNodes.add(o.id),e(o.children))}}catch(t){i.e(t)}finally{i.f()}};e(this.nodes),this.updateHeight()}},{key:"collapseAll",value:function(){this.expandedNodes.clear(),this.updateHeight()}},{key:"findNodeById",value:function(t){var e,n=Sc(arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.nodes);try{for(n.s();!(e=n.n()).done;){var r=e.value;if(r.id===t)return r;if(r.children){var i=this.findNodeById(t,r.children);if(i)return i}}}catch(t){n.e(t)}finally{n.f()}return null}}],r&&Pc(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);function Fc(t){return Fc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Fc(t)}function Rc(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Mc(r.key),r)}}function Mc(t){var e=function(t){if("object"!=Fc(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Fc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Fc(e)?e:e+""}function Ac(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ac=function(){return!!t})()}function _c(t){return _c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_c(t)}function Dc(t,e){return Dc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Dc(t,e)}const Bc=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=_c(e),function(t,e){if(e&&("object"==Fc(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Ac()?Reflect.construct(e,n||[],_c(t).constructor):e.apply(t,n))}(this,e,[t,r])).images=r.images||[],n.currentIndex=0,n.scrollX=0,n.height=r.height||200,n.spacing=r.spacing||16,n.borderRadius=r.borderRadius||8,n.pageIndicatorSize=r.pageIndicatorSize||8,n.pageIndicatorColor=r.pageIndicatorColor||"#6200EE",n.platform=t.platform,n.isDragging=!1,n.lastX=0,n.velocity=0,n.onSwipeEnd=r.onSwipeEnd||null,n.onImageClick=r.onImageClick||null,n.loadedImages=Array(n.images.length).fill(null),n._setupEventHandlers(),n.animateScroll(),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Dc(t,e)}(e,t),n=e,r=[{key:"_setupEventHandlers",value:function(){var t=this,e=this.framework.canvas;e.addEventListener("touchstart",function(e){1===e.touches.length&&t.isPointInsideTouch(e.touches[0])&&(t.isDragging=!0,t.lastX=e.touches[0].clientX,t.velocity=0,e.preventDefault())}),e.addEventListener("touchmove",function(e){if(t.isDragging&&1===e.touches.length){var n=e.touches[0].clientX-t.lastX;t.scrollX+=n,t.velocity=n,t.lastX=e.touches[0].clientX,t._clampScroll(),t._requestRedraw(),e.preventDefault()}}),e.addEventListener("touchend",function(){return t._endDrag()}),e.addEventListener("mousedown",function(e){t.isPointInside(e)&&(t.isDragging=!0,t.lastX=e.clientX,t.velocity=0,e.preventDefault())}),e.addEventListener("mousemove",function(e){if(t.isDragging){var n=e.clientX-t.lastX;t.scrollX+=n,t.velocity=n,t.lastX=e.clientX,t._clampScroll(),t._requestRedraw()}}),e.addEventListener("mouseup",function(){return t._endDrag()}),e.addEventListener("mouseleave",function(){return t._endDrag()})}},{key:"_endDrag",value:function(){if(this.isDragging){this.isDragging=!1;var t=Math.round(-this.scrollX/(this.width+this.spacing));this.currentIndex=Math.min(Math.max(t,0),this.images.length-1),this.scrollX=-this.currentIndex*(this.width+this.spacing),this.onSwipeEnd&&this.onSwipeEnd(this.currentIndex)}}},{key:"_clampScroll",value:function(){var t=-(this.images.length-1)*(this.width+this.spacing);this.scrollX>0&&(this.scrollX=0),this.scrollX<t&&(this.scrollX=t)}},{key:"isPointInsideTouch",value:function(t){var e=this.framework.canvas.getBoundingClientRect(),n=t.clientX-e.left,r=t.clientY-e.top;return this.isPointInside(n,r)}},{key:"isPointInside",value:function(t,e){return t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height}},{key:"_requestRedraw",value:function(){this.framework.markComponentDirty&&this.framework.markComponentDirty(this)}},{key:"animateScroll",value:function(){var t=this,e=function(){if(!t.isDragging)if(Math.abs(t.velocity)>.1)t.scrollX+=t.velocity,t.velocity*=.95,t._clampScroll();else{var n=-t.currentIndex*(t.width+t.spacing);t.scrollX+=.2*(n-t.scrollX)}requestAnimationFrame(e)};e()}},{key:"draw",value:function(t){var e=this;t.save();for(var n=this.x+this.scrollX+this.spacing/2,r=function(r){var i=n+r*(e.width+e.spacing);if(!e.loadedImages[r]){var o=new Image;o.src=e.images[r],o.onload=function(){e.loadedImages[r]=o,e._requestRedraw()}}t.save(),t.beginPath(),e.roundRect(t,i,e.y,e.width,e.height,e.borderRadius),t.clip(),e.loadedImages[r]?t.drawImage(e.loadedImages[r],i,e.y,e.width,e.height):(t.fillStyle="#E0E0E0",t.fillRect(i,e.y,e.width,e.height),t.fillStyle="#BDBDBD",t.font="20px sans-serif",t.textAlign="center",t.textBaseline="middle",t.fillText("🖼",i+e.width/2,e.y+e.height/2)),t.restore()},i=0;i<this.images.length;i++)r(i);if("material"===this.platform)for(var o=this.y+this.height+12,a=this.images.length*this.pageIndicatorSize*2,s=this.x+(this.width-a)/2,l=0;l<this.images.length;l++)t.beginPath(),t.arc(s+l*this.pageIndicatorSize*2,o,this.pageIndicatorSize/2,0,2*Math.PI),t.fillStyle=l===this.currentIndex?this.pageIndicatorColor:"#E0E0E0",t.fill();t.restore()}},{key:"roundRect",value:function(t,e,n,r,i,o){t.moveTo(e+o,n),t.lineTo(e+r-o,n),t.quadraticCurveTo(e+r,n,e+r,n+o),t.lineTo(e+r,n+i-o),t.quadraticCurveTo(e+r,n+i,e+r-o,n+i),t.lineTo(e+o,n+i),t.quadraticCurveTo(e,n+i,e,n+i-o),t.lineTo(e,n+o),t.quadraticCurveTo(e,n,e+o,n)}}],r&&Rc(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);function Lc(t){return Lc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Lc(t)}function Wc(t){return function(t){if(Array.isArray(t))return Hc(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Hc(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Hc(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Hc(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function zc(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,qc(r.key),r)}}function qc(t){var e=function(t){if("object"!=Lc(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Lc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Lc(e)?e:e+""}function Uc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Uc=function(){return!!t})()}function Nc(t){return Nc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Nc(t)}function Vc(t,e){return Vc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Vc(t,e)}const Gc=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=Nc(e),function(t,e){if(e&&("object"==Lc(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Uc()?Reflect.construct(e,n||[],Nc(t).constructor):e.apply(t,n))}(this,e,[t,r])).type=r.type||"line",n.data=r.data||{labels:[],datasets:[]},n.title=r.title||"",n.showLegend=!1!==r.showLegend,n.showGrid=!1!==r.showGrid,n.showValues=r.showValues||!1,n.animated=!1!==r.animated,n.colors=r.colors||n.getDefaultColors(),n.padding=r.padding||40,n.legendHeight=n.showLegend?60:0,n.titleHeight=n.title?40:0,n.chartArea={x:n.padding,y:n.padding+n.titleHeight,width:n.width-2*n.padding,height:n.height-2*n.padding-n.legendHeight-n.titleHeight},n.animationProgress=n.animated?0:1,n.animationDuration=1e3,n.animationStartTime=null,n.hoveredIndex=-1,n.hoveredDatasetIndex=-1,n.lineOptions={tension:r.tension||.4,pointRadius:r.pointRadius||4,lineWidth:r.lineWidth||2,fill:r.fill||!1},n.barOptions={barWidth:r.barWidth||null,groupGap:r.groupGap||10,barGap:r.barGap||4},n.pieOptions={innerRadius:r.innerRadius||0,startAngle:r.startAngle||-Math.PI/2,labelDistance:r.labelDistance||1.3},n.calculateScales(),n.animated&&n.startAnimation(),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Vc(t,e)}(e,t),n=e,r=[{key:"getDefaultColors",value:function(){return["#6200EE","#03DAC6","#FF6F00","#E91E63","#2196F3","#4CAF50","#FFC107","#9C27B0","#00BCD4","#FF5722","#795548","#607D8B"]}},{key:"calculateScales",value:function(){if("pie"!==this.type&&"doughnut"!==this.type){var t=[];this.data.datasets.forEach(function(e){t=t.concat(e.data)}),this.minValue=Math.min.apply(Math,[0].concat(Wc(t))),this.maxValue=Math.max.apply(Math,Wc(t));var e=this.maxValue-this.minValue;this.minValue-=.1*e,this.maxValue+=.1*e}else{var n;this.totalValue=(null===(n=this.data.datasets[0])||void 0===n?void 0:n.data.reduce(function(t,e){return t+e},0))||0}}},{key:"startAnimation",value:function(){var t=this;this.animationStartTime=Date.now(),this.animationProgress=0;var e=function(){var n=Date.now()-t.animationStartTime;t.animationProgress=Math.min(n/t.animationDuration,1),t.animationProgress=t.easeOutCubic(t.animationProgress),t.requestRender(),t.animationProgress<1&&requestAnimationFrame(e)};requestAnimationFrame(e)}},{key:"easeOutCubic",value:function(t){return 1-Math.pow(1-t,3)}},{key:"valueToY",value:function(t){var e=this.maxValue-this.minValue,n=(t-this.minValue)/e;return this.chartArea.y+this.chartArea.height-n*this.chartArea.height}},{key:"indexToX",value:function(t,e){var n=this.chartArea.width/(e-1||1);return this.chartArea.x+t*n}},{key:"drawTitle",value:function(t){this.title&&(t.save(),t.fillStyle=(this.platform,"#000000"),t.font="bold 18px -apple-system, Roboto, sans-serif",t.textAlign="center",t.textBaseline="middle",t.fillText(this.title,this.x+this.width/2,this.y+this.titleHeight/2),t.restore())}},{key:"drawGrid",value:function(t){if(this.showGrid&&"pie"!==this.type&&"doughnut"!==this.type){t.save(),t.strokeStyle="rgba(0, 0, 0, 0.1)",t.lineWidth=1;for(var e=0;e<=5;e++){var n=this.y+this.chartArea.y+this.chartArea.height/5*e;t.beginPath(),t.moveTo(this.x+this.chartArea.x,n),t.lineTo(this.x+this.chartArea.x+this.chartArea.width,n),t.stroke();var r=this.maxValue-(this.maxValue-this.minValue)*(e/5);t.fillStyle="rgba(0, 0, 0, 0.6)",t.font="12px -apple-system, Roboto, sans-serif",t.textAlign="right",t.textBaseline="middle",t.fillText(r.toFixed(1),this.x+this.chartArea.x-5,n)}t.restore()}}},{key:"drawLineChart",value:function(t){var e=this,n=this.data.labels.length;this.data.datasets.forEach(function(r,i){var o=r.color||e.colors[i%e.colors.length];t.save(),(e.lineOptions.fill||"area"===e.type)&&(t.beginPath(),t.moveTo(e.x+e.indexToX(0,n),e.y+e.valueToY(0)),r.data.forEach(function(i,o){var a=e.x+e.indexToX(o,n),s=e.y+e.valueToY(i*e.animationProgress);if(0===o)t.lineTo(a,s);else{var l=e.x+e.indexToX(o-1,n),u=e.y+e.valueToY(r.data[o-1]*e.animationProgress),c=l+(a-l)*e.lineOptions.tension;t.bezierCurveTo(c,u,c,s,a,s)}}),t.lineTo(e.x+e.indexToX(n-1,n),e.y+e.valueToY(0)),t.closePath(),t.fillStyle=o+"33",t.fill()),t.beginPath(),r.data.forEach(function(i,o){var a=e.x+e.indexToX(o,n),s=e.y+e.valueToY(i*e.animationProgress);if(0===o)t.moveTo(a,s);else{var l=e.x+e.indexToX(o-1,n),u=e.y+e.valueToY(r.data[o-1]*e.animationProgress),c=l+(a-l)*e.lineOptions.tension;t.bezierCurveTo(c,u,c,s,a,s)}}),t.strokeStyle=o,t.lineWidth=e.lineOptions.lineWidth,t.stroke(),r.data.forEach(function(r,a){var s=e.x+e.indexToX(a,n),l=e.y+e.valueToY(r*e.animationProgress),u=e.hoveredIndex===a&&e.hoveredDatasetIndex===i,c=u?1.5*e.lineOptions.pointRadius:e.lineOptions.pointRadius;t.beginPath(),t.arc(s,l,c,0,2*Math.PI),t.fillStyle="#FFFFFF",t.fill(),t.strokeStyle=o,t.lineWidth=2,t.stroke(),u&&e.showValues&&(t.fillStyle=o,t.font="bold 12px -apple-system, Roboto, sans-serif",t.textAlign="center",t.fillText(r.toFixed(1),s,l-15))}),t.restore()}),this.drawXLabels(t)}},{key:"drawBarChart",value:function(t){var e=this,n=this.data.labels.length,r=this.data.datasets.length,i=this.chartArea.width/n,o=this.barOptions.barWidth||(i-2*this.barOptions.groupGap)/r-this.barOptions.barGap;this.data.datasets.forEach(function(n,r){var a=n.color||e.colors[r%e.colors.length];n.data.forEach(function(n,s){var l=e.x+e.chartArea.x+s*i+e.barOptions.groupGap+r*(o+e.barOptions.barGap),u=Math.abs(e.valueToY(n)-e.valueToY(0))*e.animationProgress,c=e.y+e.valueToY(n*e.animationProgress),h=e.hoveredIndex===s&&e.hoveredDatasetIndex===r;t.fillStyle=h?e.adjustColor(a,20):a,t.fillRect(l,c,o,u),"material"===e.platform&&(t.strokeStyle=e.adjustColor(a,-20),t.lineWidth=1,t.strokeRect(l,c,o,u)),(e.showValues||h)&&(t.fillStyle="#000000",t.font="11px -apple-system, Roboto, sans-serif",t.textAlign="center",t.fillText(n.toFixed(1),l+o/2,c-5))})}),this.drawXLabels(t)}},{key:"drawPieChart",value:function(t){var e=this,n=this.x+this.width/2,r=this.y+this.chartArea.y+this.chartArea.height/2,i=Math.min(this.chartArea.width,this.chartArea.height)/2-20,o="doughnut"===this.type?this.pieOptions.innerRadius||.5*i:0,a=this.pieOptions.startAngle,s=this.data.datasets[0];s.data.forEach(function(l,u){var c,h=l/e.totalValue*Math.PI*2*e.animationProgress,f=(null===(c=s.colors)||void 0===c?void 0:c[u])||e.colors[u%e.colors.length],d=e.hoveredIndex===u?i+10:i;if(t.save(),t.beginPath(),t.arc(n,r,d,a,a+h),t.arc(n,r,o,a+h,a,!0),t.closePath(),t.fillStyle=f,t.fill(),t.strokeStyle="#FFFFFF",t.lineWidth=2,t.stroke(),t.restore(),e.animationProgress>.8){var p=a+h/2,y=d*e.pieOptions.labelDistance,v=n+Math.cos(p)*y,m=r+Math.sin(p)*y;t.fillStyle="#000000",t.font="12px -apple-system, Roboto, sans-serif",t.textAlign="center",t.textBaseline="middle";var g=(l/e.totalValue*100).toFixed(1);t.fillText("".concat(g,"%"),v,m),e.data.labels[u]&&(t.font="bold 11px -apple-system, Roboto, sans-serif",t.fillText(e.data.labels[u],v,m+15))}a+=h}),"doughnut"===this.type&&this.animationProgress>.8&&(t.fillStyle="#000000",t.font="bold 24px -apple-system, Roboto, sans-serif",t.textAlign="center",t.textBaseline="middle",t.fillText(this.totalValue.toFixed(0),n,r))}},{key:"drawXLabels",value:function(t){var e=this;t.save(),t.fillStyle="rgba(0, 0, 0, 0.7)",t.font="12px -apple-system, Roboto, sans-serif",t.textAlign="center",t.textBaseline="top",this.data.labels.forEach(function(n,r){var i=e.x+e.indexToX(r,e.data.labels.length),o=e.y+e.chartArea.y+e.chartArea.height+10;t.fillText(n,i,o)}),t.restore()}},{key:"drawLegend",value:function(t){var e=this;if(this.showLegend){var n=this.y+this.height-this.legendHeight+10,r=Math.floor(this.width/120);t.save(),this.data.datasets.forEach(function(i,o){var a=i.color||e.colors[o%e.colors.length],s=Math.floor(o/r),l=o%r,u=e.x+120*l+20,c=n+25*s;t.fillStyle=a,t.fillRect(u,c,12,12),t.fillStyle="#000000",t.font="12px -apple-system, Roboto, sans-serif",t.textAlign="left",t.textBaseline="middle",t.fillText(i.label||"Dataset ".concat(o+1),u+18,c+6)}),t.restore()}}},{key:"adjustColor",value:function(t,e){var n=parseInt(t.replace("#",""),16),r=Math.min(255,Math.max(0,(n>>16)+e)),i=Math.min(255,Math.max(0,(n>>8&255)+e)),o=Math.min(255,Math.max(0,(255&n)+e));return"#".concat((r<<16|i<<8|o).toString(16).padStart(6,"0"))}},{key:"handleHover",value:function(t,e){var n=t-this.x,r=e-this.y;"pie"===this.type||"doughnut"===this.type?this.handlePieHover(n,r):"line"===this.type||"area"===this.type?this.handleLineHover(n,r):"bar"===this.type&&this.handleBarHover(n,r)}},{key:"handlePieHover",value:function(t,e){var n=t-this.width/2,r=e-(this.chartArea.y+this.chartArea.height/2),i=Math.sqrt(n*n+r*r),o=Math.atan2(r,n),a=Math.min(this.chartArea.width,this.chartArea.height)/2-20;if(i>=("doughnut"===this.type?this.pieOptions.innerRadius||.5*a:0)&&i<=a)for(var s=this.pieOptions.startAngle,l=this.data.datasets[0],u=0;u<l.data.length;u++){var c=l.data[u]/this.totalValue*Math.PI*2,h=o-this.pieOptions.startAngle;if(h<0&&(h+=2*Math.PI),h>=s-this.pieOptions.startAngle&&h<=s-this.pieOptions.startAngle+c)return this.hoveredIndex=u,void this.requestRender();s+=c}this.hoveredIndex=-1,this.requestRender()}},{key:"handleLineHover",value:function(t,e){var n=this,r=-1,i=-1,o=1/0;this.data.datasets.forEach(function(a,s){a.data.forEach(function(a,l){var u=n.indexToX(l,n.data.labels.length),c=n.valueToY(a),h=t-u,f=e-c,d=Math.sqrt(h*h+f*f);d<o&&d<20&&(o=d,r=l,i=s)})}),this.hoveredIndex===r&&this.hoveredDatasetIndex===i||(this.hoveredIndex=r,this.hoveredDatasetIndex=i,this.requestRender())}},{key:"handleBarHover",value:function(t,e){var n=this,r=this.data.labels.length,i=this.data.datasets.length,o=this.chartArea.width/r,a=this.barOptions.barWidth||(o-2*this.barOptions.groupGap)/i-this.barOptions.barGap,s=!1;this.data.datasets.forEach(function(r,i){r.data.forEach(function(r,l){var u=n.chartArea.x+l*o+n.barOptions.groupGap+i*(a+n.barOptions.barGap),c=n.valueToY(r),h=Math.abs(n.valueToY(r)-n.valueToY(0));t>=u&&t<=u+a&&e>=c&&e<=c+h&&(n.hoveredIndex=l,n.hoveredDatasetIndex=i,s=!0)})}),s||(this.hoveredIndex=-1,this.hoveredDatasetIndex=-1),this.requestRender()}},{key:"isPointInside",value:function(t,e){return t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height}},{key:"onMove",value:function(t,e){this.handleHover(t,e)}},{key:"requestRender",value:function(){this.framework&&this.framework.requestRender&&this.framework.requestRender()}},{key:"updateData",value:function(t){this.data=t,this.calculateScales(),this.animated?this.startAnimation():this.requestRender()}},{key:"draw",value:function(t){switch(t.save(),t.fillStyle="#FFFFFF",t.fillRect(this.x,this.y,this.width,this.height),"material"===this.platform&&(t.strokeStyle="#E0E0E0",t.lineWidth=1,t.strokeRect(this.x,this.y,this.width,this.height)),this.drawTitle(t),this.drawGrid(t),this.type){case"line":case"area":this.drawLineChart(t);break;case"bar":this.drawBarChart(t);break;case"pie":case"doughnut":this.drawPieChart(t)}this.drawLegend(t),t.restore()}}],r&&zc(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);function Yc(t){return Yc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Yc(t)}function Xc(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Qc(r.key),r)}}function Qc(t){var e=function(t){if("object"!=Yc(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Yc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Yc(e)?e:e+""}function Kc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Kc=function(){return!!t})()}function $c(t){return $c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},$c(t)}function Jc(t,e){return Jc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Jc(t,e)}const Zc=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=$c(e),function(t,e){if(e&&("object"==Yc(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Kc()?Reflect.construct(e,n||[],$c(t).constructor):e.apply(t,n))}(this,e,[t,r])).src=r.src||"",n.playing=!1,n.platform=t.platform,n.showControls=!0,n.controlsTimeout=null,n.currentTime=0,n.duration=0,n.progress=0,n.volume=1,n.showVolume=!1,n.loaded=!1,n.isLoading=!1,n.userInteracted=!1,n.audioElement=null,n.canvas=t.canvas,n.isMouseDownOnPlayer=!1,n.clickStartTime=0,n.clickThreshold=200,n.controlsHeight=50,n.onPlay=r.onPlay,n.onPause=r.onPause,n.onEnded=r.onEnded,n.onPress=null,n.onMove=null,n.onRelease=null,n.setupDirectEventListeners(),n.initAudio(),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Jc(t,e)}(e,t),n=e,r=[{key:"setupDirectEventListeners",value:function(){this.originalListeners={mousedown:this.canvas.onmousedown,mouseup:this.canvas.onmouseup,mousemove:this.canvas.onmousemove,touchstart:this.canvas.ontouchstart,touchend:this.canvas.ontouchend,touchmove:this.canvas.ontouchmove},this.canvas.addEventListener("mousedown",this.handleCanvasMouseDown.bind(this)),this.canvas.addEventListener("mouseup",this.handleCanvasMouseUp.bind(this)),this.canvas.addEventListener("mousemove",this.handleCanvasMouseMove.bind(this)),this.canvas.addEventListener("touchstart",this.handleCanvasTouchStart.bind(this)),this.canvas.addEventListener("touchend",this.handleCanvasTouchEnd.bind(this)),this.canvas.addEventListener("touchmove",this.handleCanvasTouchMove.bind(this))}},{key:"removeDirectEventListeners",value:function(){var t=this;this.canvas.removeEventListener("mousedown",this.handleCanvasMouseDown),this.canvas.removeEventListener("mouseup",this.handleCanvasMouseUp),this.canvas.removeEventListener("mousemove",this.handleCanvasMouseMove),this.canvas.removeEventListener("touchstart",this.handleCanvasTouchStart),this.canvas.removeEventListener("touchend",this.handleCanvasTouchEnd),this.canvas.removeEventListener("touchmove",this.handleCanvasTouchMove),Object.keys(this.originalListeners).forEach(function(e){t.originalListeners[e]&&(t.canvas["on".concat(e)]=t.originalListeners[e])})}},{key:"handleCanvasMouseDown",value:function(t){var e=this.canvas.getBoundingClientRect(),n=t.clientX-e.left,r=t.clientY-e.top;if(this.isPointInside(n,r))return t.stopPropagation(),this.isMouseDownOnPlayer=!0,this.clickStartTime=Date.now(),this.handleInteraction(n,r,"start"),!0}},{key:"handleCanvasMouseUp",value:function(t){if(this.isMouseDownOnPlayer){var e=this.canvas.getBoundingClientRect(),n=t.clientX-e.left,r=t.clientY-e.top;return Date.now()-this.clickStartTime<this.clickThreshold&&this.isPointInside(n,r)&&(t.stopPropagation(),this.handleInteraction(n,r,"end")),this.isMouseDownOnPlayer=!1,!0}}},{key:"handleCanvasMouseMove",value:function(t){if(this.isMouseDownOnPlayer){var e=this.canvas.getBoundingClientRect(),n=t.clientX-e.left,r=t.clientY-e.top;return this.isPointInside(n,r)?(t.stopPropagation(),this.handleInteraction(n,r,"move"),!0):void 0}}},{key:"handleCanvasTouchStart",value:function(t){var e=t.touches[0],n=this.canvas.getBoundingClientRect(),r=e.clientX-n.left,i=e.clientY-n.top;if(this.isPointInside(r,i))return t.stopPropagation(),t.preventDefault(),this.isMouseDownOnPlayer=!0,this.clickStartTime=Date.now(),this.handleInteraction(r,i,"start"),!0}},{key:"handleCanvasTouchEnd",value:function(t){if(this.isMouseDownOnPlayer){var e=t.changedTouches[0],n=this.canvas.getBoundingClientRect(),r=e.clientX-n.left,i=e.clientY-n.top;return Date.now()-this.clickStartTime<this.clickThreshold&&this.isPointInside(r,i)&&(t.stopPropagation(),t.preventDefault(),this.handleInteraction(r,i,"end")),this.isMouseDownOnPlayer=!1,!0}}},{key:"handleCanvasTouchMove",value:function(t){if(this.isMouseDownOnPlayer){var e=t.touches[0],n=this.canvas.getBoundingClientRect(),r=e.clientX-n.left,i=e.clientY-n.top;return this.isPointInside(r,i)?(t.stopPropagation(),t.preventDefault(),this.handleInteraction(r,i,"move"),!0):void 0}}},{key:"handleInteraction",value:function(t,e,n){var r=e-this.framework.scrollOffset;this.showControls=!0,this.showControlsTemporarily(),this.userInteracted||(this.userInteracted=!0,this.showInteractionMessage=!1);var i=t-this.x,o=r-this.y,a=this.width/2,s=this.height/2,l=i>=a-40&&i<=a+40&&o>=s-40&&o<=s+40,u=this.height-30,c=this.showControls&&this.loaded&&o>=u&&o<=u+15;switch(n){case"start":break;case"move":if(c){var h=Math.max(0,Math.min(100,i/this.width*100));this.seekTo(this.duration*h/100)}break;case"end":l&&(console.log("AudioPlayer: Bouton cliqué (gestion directe)"),this.loaded||this.isLoading?this.loaded&&this.togglePlay():this.initAudio())}}},{key:"initAudio",value:function(){var t=this;if(this.src){console.log("AudioPlayer: Initialisation de l'audio:",this.src),this.isLoading=!0;try{this.audioElement=document.createElement("audio"),this.audioElement.src=this.src,this.audioElement.preload="auto",this.audioElement.crossOrigin="anonymous",this.audioElement.style.display="none",this.audioElement.style.position="absolute",this.audioElement.style.left="-9999px",this.audioElement.autoplay=!1,this.audioElement.controls=!1,document.body.appendChild(this.audioElement),this.audioElement.addEventListener("loadedmetadata",function(){console.log("AudioPlayer: Métadonnées chargées"),t.duration=t.audioElement.duration,t.loaded=!0,t.isLoading=!1}),this.audioElement.addEventListener("timeupdate",function(){t.currentTime=t.audioElement.currentTime,t.progress=t.currentTime/t.duration*100}),this.audioElement.addEventListener("ended",function(){console.log("AudioPlayer: Audio terminé"),t.playing=!1,t.onEnded&&t.onEnded()}),this.audioElement.addEventListener("play",function(){console.log("AudioPlayer: Lecture démarrée"),t.playing=!0,t.onPlay&&t.onPlay()}),this.audioElement.addEventListener("pause",function(){console.log("AudioPlayer: Lecture en pause"),t.playing=!1,t.onPause&&t.onPause()}),this.audioElement.addEventListener("error",function(e){console.error("AudioPlayer: Erreur audio:",e),t.isLoading=!1,t.loaded=!1}),this.audioElement.addEventListener("canplaythrough",function(){console.log("AudioPlayer: Prêt à jouer"),t.loaded=!0,t.isLoading=!1}),this.audioElement.load()}catch(t){console.error("AudioPlayer: Erreur d'initialisation:",t),this.isLoading=!1,this.loaded=!1}}else console.warn("AudioPlayer: Pas de source audio fournie")}},{key:"play",value:function(){var t=this;if(this.loaded&&this.audioElement){if(!this.userInteracted)return console.log("AudioPlayer: Attente interaction utilisateur..."),this.showInteractionMessage=!0,void setTimeout(function(){t.showInteractionMessage=!1},2e3);console.log("AudioPlayer: Lancement de la lecture");var e=this.audioElement.play();void 0!==e&&e.then(function(){console.log("AudioPlayer: Lecture réussie"),t.playing=!0,t.showControlsTemporarily()}).catch(function(e){console.error("AudioPlayer: Erreur de lecture:",e),t.playing=!1,"NotAllowedError"===e.name&&(console.log("AudioPlayer: Interaction nécessaire"),t.userInteracted=!1)})}else console.log("AudioPlayer: Impossible de jouer - pas chargé")}},{key:"pause",value:function(){this.playing&&this.audioElement&&(console.log("AudioPlayer: Mise en pause"),this.audioElement.pause(),this.playing=!1,this.showControlsTemporarily())}},{key:"stop",value:function(){this.audioElement&&(this.audioElement.pause(),this.audioElement.currentTime=0),this.playing=!1,this.currentTime=0,this.progress=0}},{key:"togglePlay",value:function(){if(console.log("AudioPlayer: togglePlay - état actuel:",this.playing),!this.loaded)return console.log("AudioPlayer: Pas encore chargé"),void(this.isLoading||this.initAudio());this.userInteracted||(console.log("AudioPlayer: Interaction utilisateur déclenchée"),this.userInteracted=!0,this.showInteractionMessage=!1),this.playing?this.pause():this.play()}},{key:"seekTo",value:function(t){if(this.loaded&&this.audioElement){var e=this.playing;e&&this.audioElement.pause();var n=Math.max(0,Math.min(t,this.duration));this.audioElement.currentTime=n,this.currentTime=n,this.progress=this.currentTime/this.duration*100,e&&this.audioElement.play().catch(function(t){console.error("AudioPlayer: Erreur reprise après seek:",t)})}}},{key:"setVolume",value:function(t){this.volume=Math.max(0,Math.min(1,t)),this.audioElement&&(this.audioElement.volume=this.volume)}},{key:"showControlsTemporarily",value:function(){var t=this;this.showControls=!0,clearTimeout(this.controlsTimeout),this.controlsTimeout=setTimeout(function(){t.playing&&(t.showControls=!1)},3e3)}},{key:"update",value:function(t){}},{key:"draw",value:function(t){if(t.save(),t.fillStyle="#111111",t.fillRect(this.x,this.y,this.width,this.height),this.showInteractionMessage)return t.fillStyle="rgba(255, 255, 255, 0.9)",t.font="bold 14px Arial",t.textAlign="center",t.textBaseline="middle",t.fillText("Cliquez pour activer l'audio",this.x+this.width/2,this.y+this.height/2),void t.restore();if(this.isLoading)return t.fillStyle="#FFFFFF",t.font="14px Arial",t.textAlign="center",t.textBaseline="middle",t.fillText("Chargement...",this.x+this.width/2,this.y+this.height/2),void t.restore();if(!this.loaded&&!this.isLoading)return t.fillStyle="#FFFFFF",t.font="14px Arial",t.textAlign="center",t.textBaseline="middle",t.fillText("Audio non disponible",this.x+this.width/2,this.y+this.height/2),void t.restore();var e=this.x+this.width/2,n=this.y+this.height/2;if(this.playing&&!this.showControls||(t.fillStyle="rgba(0, 0, 0, 0.6)",t.beginPath(),t.arc(e,n,40,0,2*Math.PI),t.fill(),t.fillStyle="#FFFFFF",this.playing?(t.fillRect(e-8-2.5,n-15,8,30),t.fillRect(e+2.5,n-15,8,30)):(t.beginPath(),t.moveTo(e-12.5,n-25),t.lineTo(e-12.5,n+25),t.lineTo(e+25,n),t.closePath(),t.fill())),this.showControls&&this.loaded){t.fillStyle="rgba(0, 0, 0, 0.8)",t.fillRect(this.x,this.y+this.height-this.controlsHeight,this.width,this.controlsHeight);var r=this.x+15,i=this.y+this.height-25,o=this.width-30;t.fillStyle="#555555",t.fillRect(r,i,o,6),t.fillStyle="#333333",t.fillRect(r,i,o,2),t.fillStyle="#FF4444";var a=o*this.progress/100;if(t.fillRect(r,i,a,6),t.fillStyle="#FF0000",t.fillRect(r,i,a,2),a>0){var s=r+a;t.fillStyle="#FFFFFF",t.beginPath(),t.arc(s,i+3,8,0,2*Math.PI),t.fill(),t.strokeStyle="#000000",t.lineWidth=2,t.stroke()}var l=this.formatTime(this.currentTime),u=this.formatTime(this.duration);t.fillStyle="#FFFFFF",t.font="bold 12px Arial",t.textAlign="left",t.fillText(l,this.x+15,this.y+this.height-35),t.textAlign="right",t.fillText(u,this.x+this.width-15,this.y+this.height-35)}t.restore()}},{key:"formatTime",value:function(t){if(isNaN(t)||t===1/0)return"0:00";var e=Math.floor(t/60),n=Math.floor(t%60);return"".concat(e,":").concat(n<10?"0":"").concat(n)}},{key:"isPointInside",value:function(t,e){var n=e-this.framework.scrollOffset;return t>=this.x&&t<=this.x+this.width&&n>=this.y&&n<=this.y+this.height}},{key:"remove",value:function(){this.stop(),this.removeDirectEventListeners(),this.audioElement&&this.audioElement.parentNode&&(this.audioElement.pause(),this.audioElement.src="",this.audioElement.load(),this.audioElement.parentNode.removeChild(this.audioElement),this.audioElement=null),clearTimeout(this.controlsTimeout),console.log("AudioPlayer: Nettoyé et supprimé")}}],r&&Xc(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);function th(t){return th="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},th(t)}function eh(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,u=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(t){u=!0,i=t}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return nh(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?nh(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function nh(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function rh(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var l=r&&r.prototype instanceof s?r:s,u=Object.create(l.prototype);return ih(u,"_invoke",function(n,r,i){var o,s,l,u=0,c=i||[],h=!1,f={p:0,n:0,v:t,a:d,f:d.bind(t,4),d:function(e,n){return o=e,s=0,l=t,f.n=n,a}};function d(n,r){for(s=n,l=r,e=0;!h&&u&&!i&&e<c.length;e++){var i,o=c[e],d=f.p,p=o[2];n>3?(i=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=t):o[0]<=d&&((i=n<2&&d<o[1])?(s=0,f.v=r,f.n=o[1]):d<p&&(i=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(i||n>1)return a;throw h=!0,r}return function(i,c,p){if(u>1)throw TypeError("Generator is already running");for(h&&1===c&&d(c,p),s=c,l=p;(e=s<2?t:l)||!h;){o||(s?s<3?(s>1&&(f.n=-1),d(s,l)):f.n=l:f.v=l);try{if(u=2,o){if(s||(i="next"),e=o[i]){if(!(e=e.call(o,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,s<2&&(s=0)}else 1===s&&(e=o.return)&&e.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+i+"' method"),s=1);o=t}else if((e=(h=f.n<0)?l:n.call(r,f))!==a)break}catch(e){o=t,s=1,l=e}finally{u=1}}return{value:e,done:h}}}(n,i,o),!0),u}var a={};function s(){}function l(){}function u(){}e=Object.getPrototypeOf;var c=[][r]?e(e([][r]())):(ih(e={},r,function(){return this}),e),h=u.prototype=s.prototype=Object.create(c);function f(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,u):(t.__proto__=u,ih(t,i,"GeneratorFunction")),t.prototype=Object.create(h),t}return l.prototype=u,ih(h,"constructor",u),ih(u,"constructor",l),l.displayName="GeneratorFunction",ih(u,i,"GeneratorFunction"),ih(h),ih(h,i,"Generator"),ih(h,r,function(){return this}),ih(h,"toString",function(){return"[object Generator]"}),(rh=function(){return{w:o,m:f}})()}function ih(t,e,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(t){i=0}ih=function(t,e,n,r){function o(e,n){ih(t,e,function(t){return this._invoke(e,n,t)})}e?i?i(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(o("next",0),o("throw",1),o("return",2))},ih(t,e,n,r)}function oh(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function ah(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function a(t){oh(o,r,i,a,s,"next",t)}function s(t){oh(o,r,i,a,s,"throw",t)}a(void 0)})}}function sh(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,lh(r.key),r)}}function lh(t){var e=function(t){if("object"!=th(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=th(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==th(e)?e:e+""}function uh(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(uh=function(){return!!t})()}function ch(t,e,n,r){var i=hh(fh(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof i?function(t){return i.apply(n,t)}:i}function hh(){return hh="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=fh(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},hh.apply(null,arguments)}function fh(t){return fh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},fh(t)}function dh(t,e){return dh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},dh(t,e)}const ph=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=fh(e),function(t,e){if(e&&("object"==th(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,uh()?Reflect.construct(e,n||[],fh(t).constructor):e.apply(t,n))}(this,e,[t,r])).facingMode=r.facingMode||"environment",n.autoStart=!1!==r.autoStart,n.onPhoto=r.onPhoto||null,n.fitModes=["contain","cover"],n.currentFitModeIndex=0,n.fitMode=n.fitModes[n.currentFitModeIndex],n.stream=null,n.video=null,n.loaded=!1,n.error=null,n.showControls=!0,n.torchSupported=!1,n.torchOn=!1,n.captureButtonRadius=35,n.modeButtonSize=40,n.flashTimer=null,n.previewPhoto=null,n.previewTimeout=null,n.isStarting=!1,n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&dh(t,e)}(e,t),n=e,r=[{key:"_mount",value:(l=ah(rh().m(function t(){var n;return rh().w(function(t){for(;;)switch(t.n){case 0:if(null===(n=ch(e,"_mount",this,3))||void 0===n||n([]),!this.autoStart||this.stream||this.isStarting){t.n=2;break}return this.isStarting=!0,t.n=1,this.startCamera();case 1:this.isStarting=!1;case 2:this.setupEventListeners();case 3:return t.a(2)}},t,this)})),function(){return l.apply(this,arguments)})},{key:"destroy",value:function(){var t;this.removeEventListeners(),this.stopCamera(),this.flashTimer&&clearTimeout(this.flashTimer),this.previewTimeout&&clearTimeout(this.previewTimeout),null===(t=ch(e,"destroy",this,3))||void 0===t||t([])}},{key:"setupEventListeners",value:function(){this.onTouchStart=this.handleTouchStart.bind(this),this.onTouchMove=this.handleTouchMove.bind(this),this.onTouchEnd=this.handleTouchEnd.bind(this),this.onMouseDown=this.handleMouseDown.bind(this),this.onMouseMove=this.handleMouseMove.bind(this),this.onMouseUp=this.handleMouseUp.bind(this);var t=this.framework.canvas;t.addEventListener("touchstart",this.onTouchStart,{passive:!1}),t.addEventListener("touchmove",this.onTouchMove,{passive:!1}),t.addEventListener("touchend",this.onTouchEnd,{passive:!1}),t.addEventListener("mousedown",this.onMouseDown),t.addEventListener("mousemove",this.onMouseMove),t.addEventListener("mouseup",this.onMouseUp)}},{key:"removeEventListeners",value:function(){var t=this.framework.canvas;t.removeEventListener("touchstart",this.onTouchStart),t.removeEventListener("touchmove",this.onTouchMove),t.removeEventListener("touchend",this.onTouchEnd),t.removeEventListener("mousedown",this.onMouseDown),t.removeEventListener("mousemove",this.onMouseMove),t.removeEventListener("mouseup",this.onMouseUp)}},{key:"getLocalPos",value:function(t,e){var n=this.framework.canvas.getBoundingClientRect(),r=t-n.left,i=e-n.top-this.framework.scrollOffset;return{x:r-this.x,y:i-this.y}}},{key:"handleTouchStart",value:function(t){t.preventDefault();var e=t.touches[0],n=this.getLocalPos(e.clientX,e.clientY);this.handlePress(n.x,n.y)}},{key:"handleTouchMove",value:function(t){t.preventDefault()}},{key:"handleTouchEnd",value:function(t){t.preventDefault()}},{key:"handleMouseDown",value:function(t){var e=this.getLocalPos(t.clientX,t.clientY);this.handlePress(e.x,e.y)}},{key:"handleMouseMove",value:function(t){}},{key:"handleMouseUp",value:function(t){}},{key:"startCamera",value:(s=ah(rh().m(function t(){var n,r,i,o,a,s,l=this;return rh().w(function(t){for(;;)switch(t.p=t.n){case 0:if(e.cleanupAllCameras(),!this.stream){t.n=1;break}return t.a(2);case 1:return t.p=1,this.stopCamera(),t.n=2,navigator.mediaDevices.getUserMedia({video:{facingMode:this.facingMode,width:{ideal:1280},height:{ideal:720},frameRate:{ideal:30}}});case 2:return this.stream=t.v,r=this.stream.getVideoTracks(),i=eh(r,1),o=i[0],a=(null===(n=o.getCapabilities)||void 0===n?void 0:n.call(o))||{},this.torchSupported=!!a.torch,this.video=document.createElement("video"),this.video.autoplay=!0,this.video.playsInline=!0,this.video.muted=!0,this.video.srcObject=this.stream,this.video.style.position="fixed",this.video.style.left="-9999px",this.video.style.top="-9999px",this.video.style.width="1px",this.video.style.height="1px",document.body.appendChild(this.video),t.n=3,new Promise(function(t){l.video.onloadedmetadata=function(){l.loaded=!0,l.video.play().catch(function(t){return console.warn("Play auto échoué:",t)}),t()},l.video.onerror=function(e){l.error="Erreur vidéo",console.error("Video error:",e),t()}});case 3:this.markDirty(),t.n=5;break;case 4:t.p=4,s=t.v,this.error=s.message||"Accès caméra refusé",console.error("Échec getUserMedia:",s),this.markDirty();case 5:return t.a(2)}},t,this,[[1,4]])})),function(){return s.apply(this,arguments)})},{key:"stopCamera",value:function(){this.stream&&(this.stream.getTracks().forEach(function(t){return t.stop()}),this.stream=null),this.video&&(this.video.parentNode&&this.video.parentNode.removeChild(this.video),this.video.srcObject=null,this.video=null),this.loaded=!1,this.markDirty()}},{key:"switchCamera",value:(a=ah(rh().m(function t(){return rh().w(function(t){for(;;)switch(t.n){case 0:return this.stopCamera(),this.facingMode="user"===this.facingMode?"environment":"user",t.n=1,this.startCamera();case 1:return t.a(2)}},t,this)})),function(){return a.apply(this,arguments)})},{key:"toggleTorch",value:(o=ah(rh().m(function t(){var e,n,r,i;return rh().w(function(t){for(;;)switch(t.p=t.n){case 0:if(this.torchSupported&&this.stream){t.n=1;break}return t.a(2);case 1:return e=this.stream.getVideoTracks(),n=eh(e,1),r=n[0],t.p=2,t.n=3,r.applyConstraints({advanced:[{torch:!this.torchOn}]});case 3:this.torchOn=!this.torchOn,this.markDirty(),t.n=5;break;case 4:t.p=4,i=t.v,console.warn("Torch impossible:",i);case 5:return t.a(2)}},t,this,[[2,4]])})),function(){return o.apply(this,arguments)})},{key:"capturePhoto",value:function(){var t=this;if(!this.loaded||!this.video)return console.warn("Capture impossible : caméra pas prête"),null;var e=document.createElement("canvas");e.width=this.video.videoWidth,e.height=this.video.videoHeight,e.getContext("2d").drawImage(this.video,0,0);var n=e.toDataURL("image/jpeg",.92);return this.onPhoto&&this.onPhoto(n),console.log("Photo capturée ! DataURL:",n.substring(0,50)+"..."),this.flashTimer=setTimeout(function(){t.flashTimer=null,t.markDirty()},200),this.previewPhoto=n,this.previewTimeout=setTimeout(function(){t.previewPhoto=null,t.markDirty()},3e3),this.markDirty(),n}},{key:"switchFitMode",value:function(){this.currentFitModeIndex=(this.currentFitModeIndex+1)%this.fitModes.length,this.fitMode=this.fitModes[this.currentFitModeIndex],this.markDirty()}},{key:"handlePress",value:function(t,e){var n=this.width/2,r=this.height-60;if(Math.hypot(t-n,e-r)<this.captureButtonRadius+10)this.capturePhoto();else if(t<60&&e<60)this.switchCamera();else if(this.torchSupported&&t>this.width-60&&e<60)this.toggleTorch();else{var i=this.width-80;t>i&&t<i+this.modeButtonSize&&e>20&&e<20+this.modeButtonSize&&this.switchFitMode()}}},{key:"drawContainIcon",value:function(t,e,n,r){var i=.2*r;t.strokeStyle="#000",t.lineWidth=2,t.strokeRect(e+i,n+i,r-2*i,r-2*i);var o=.15*r;t.fillStyle="#000",t.beginPath(),t.moveTo(e+r/2,n+i-2),t.lineTo(e+r/2-o,n+i+o),t.lineTo(e+r/2+o,n+i+o),t.fill(),t.beginPath(),t.moveTo(e+r/2,n+r-i+2),t.lineTo(e+r/2-o,n+r-i-o),t.lineTo(e+r/2+o,n+r-i-o),t.fill(),t.beginPath(),t.moveTo(e+i-2,n+r/2),t.lineTo(e+i+o,n+r/2-o),t.lineTo(e+i+o,n+r/2+o),t.fill(),t.beginPath(),t.moveTo(e+r-i+2,n+r/2),t.lineTo(e+r-i-o,n+r/2-o),t.lineTo(e+r-i-o,n+r/2+o),t.fill()}},{key:"drawCoverIcon",value:function(t,e,n,r){var i=.2*r;t.strokeStyle="#000",t.lineWidth=2,t.strokeRect(e+i,n+i,r-2*i,r-2*i);var o=.15*r;t.fillStyle="#000",t.beginPath(),t.moveTo(e+r/2,n+2),t.lineTo(e+r/2-o,n+o+2),t.lineTo(e+r/2+o,n+o+2),t.fill(),t.beginPath(),t.moveTo(e+r/2,n+r-2),t.lineTo(e+r/2-o,n+r-o-2),t.lineTo(e+r/2+o,n+r-o-2),t.fill(),t.beginPath(),t.moveTo(e+2,n+r/2),t.lineTo(e+o+2,n+r/2-o),t.lineTo(e+o+2,n+r/2+o),t.fill(),t.beginPath(),t.moveTo(e+r-2,n+r/2),t.lineTo(e+r-o-2,n+r/2-o),t.lineTo(e+r-o-2,n+r/2+o),t.fill()}},{key:"drawSwitchCameraIcon",value:function(t,e,n,r){var i=e+r/2,o=n+r/2,a=.35*r;t.strokeStyle="#ffffff",t.lineWidth=3,t.lineCap="round",t.beginPath(),t.arc(i,o,a,.7*-Math.PI,.7*Math.PI),t.stroke();var s=.15*r,l=.7*Math.PI,u=i+a*Math.cos(l),c=o+a*Math.sin(l);t.fillStyle="#ffffff",t.beginPath(),t.moveTo(u,c),t.lineTo(u-s,c-.5*s),t.lineTo(u-.5*s,c+s),t.fill();var h=.25*r,f=.18*r,d=i-h/2,p=o-f/2;t.fillStyle="#ffffff",t.fillRect(d,p,h,f),t.fillStyle="#000",t.beginPath(),t.arc(i,o,.08*r,0,2*Math.PI),t.fill()}},{key:"draw",value:function(t){if(t.save(),t.fillStyle="#000",t.fillRect(this.x,this.y,this.width,this.height),this.flashTimer&&(t.fillStyle="rgba(255,255,255,0.6)",t.fillRect(this.x,this.y,this.width,this.height)),this.error)t.fillStyle="#ff4444",t.font="16px Arial",t.textAlign="center",t.textBaseline="middle",t.fillText(this.error,this.x+this.width/2,this.y+this.height/2);else if(this.loaded){if(this.video&&this.loaded){var e=this.video.videoWidth/this.video.videoHeight,n=this.width/this.height,r=this.width,i=this.height,o=0,a=0;if("cover"===this.fitMode?e>n?(r=(i=this.height)*e,o=(this.width-r)/2):(i=(r=this.width)/e,a=(this.height-i)/2):"contain"===this.fitMode&&(e>n?(i=(r=this.width)/e,a=(this.height-i)/2):(r=(i=this.height)*e,o=(this.width-r)/2)),t.drawImage(this.video,this.x+o,this.y+a,r,i),this.previewPhoto){var s=80,l=new Image;l.src=this.previewPhoto,t.drawImage(l,this.x+this.width-s-10,this.y+this.height-s-10,s,s),t.strokeStyle="#fff",t.lineWidth=2,t.strokeRect(this.x+this.width-s-10,this.y+this.height-s-10,s,s)}}}else t.fillStyle="#fff",t.font="16px Arial",t.textAlign="center",t.textBaseline="middle",t.fillText("Démarrage caméra...",this.x+this.width/2,this.y+this.height/2);t.fillStyle="rgba(0,0,0,0.5)",t.fillRect(this.x,this.y+this.height-100,this.width,100),t.fillStyle="#ffffff",t.beginPath(),t.arc(this.x+this.width/2,this.y+this.height-50,this.captureButtonRadius,0,2*Math.PI),t.fill(),t.strokeStyle="#ff4444",t.lineWidth=6,t.beginPath(),t.arc(this.x+this.width/2,this.y+this.height-50,this.captureButtonRadius+10,0,2*Math.PI),t.stroke();var u=this.x+20,c=this.y+20;t.fillStyle="rgba(0,0,0,0.5)",t.beginPath(),t.arc(u+25,c+25,25,0,2*Math.PI),t.fill(),this.drawSwitchCameraIcon(t,u,c,50),this.torchSupported&&(t.fillStyle=this.torchOn?"#ffeb3b":"#ffffff",t.fillText("⚡",this.x+this.width-50,this.y+45));var h=this.x+this.width-80,f=this.y+20;t.fillStyle="rgba(255,255,255,0.9)",t.fillRect(h,f,this.modeButtonSize,this.modeButtonSize),t.strokeStyle="#000",t.lineWidth=2,t.strokeRect(h,f,this.modeButtonSize,this.modeButtonSize),"contain"===this.fitMode?this.drawContainIcon(t,h,f,this.modeButtonSize):this.drawCoverIcon(t,h,f,this.modeButtonSize),t.restore()}}],i=[{key:"cleanupAllCameras",value:function(){document.querySelectorAll("video").forEach(function(t){if(t.srcObject){var e=t.srcObject;e&&e.getTracks&&e.getTracks().forEach(function(t){return t.stop()}),t.srcObject=null}t.parentNode&&t.parentNode.removeChild(t)})}}],r&&sh(n.prototype,r),i&&sh(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i,o,a,s,l}(u);function yh(t){return yh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yh(t)}function vh(){return vh="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Sh(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},vh.apply(null,arguments)}function mh(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function gh(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,wh(r.key),r)}}function bh(t,e,n){return e&&gh(t.prototype,e),n&&gh(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function wh(t){var e=function(t){if("object"!=yh(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=yh(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==yh(e)?e:e+""}function xh(t,e,n){return e=Sh(e),function(t,e){if(e&&("object"==yh(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,kh()?Reflect.construct(e,n||[],Sh(t).constructor):e.apply(t,n))}function kh(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(kh=function(){return!!t})()}function Sh(t){return Sh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Sh(t)}function Th(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ph(t,e)}function Ph(t,e){return Ph=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ph(t,e)}var Oh=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return mh(this,e),(n=xh(this,e,[t,r])).selectedTime=r.selectedTime||new Date,n.selectedTime.setSeconds(0,0),n.minTime=r.minTime||null,n.maxTime=r.maxTime||null,n.onChange=r.onChange,n.label=r.label||"Sélectionner une heure",n.platform=t.platform,n.headerBgColor=r.headerBgColor||"#6200EE",n.inputBgColor=r.inputBgColor||null,n.inputTextColor=r.inputTextColor||null,n.inputBorderColor=r.inputBorderColor||null,n.labelColor=r.labelColor||null,n.inputHeight=r.inputHeight||56,n.inputRadius=r.inputRadius||("cupertino"===n.platform?10:0),n.fontSize=r.fontSize||null,n.width=r.width||Math.min(320,t.width-40),n.height=n.inputHeight,n.onPress=function(t,e){return!!n.isPointInside(t,e)&&(n.openPicker(),!0)},n}return Th(e,t),bh(e,[{key:"openPicker",value:function(){"cupertino"===this.platform?this.openCupertinoTimePicker():this.openMaterialTimePicker()}},{key:"openCupertinoTimePicker",value:function(){var t=this,e=new vt(this.framework,{title:"",width:this.framework.width,height:340,showCloseButton:!1,closeOnOverlayClick:!0,bgColor:"#F9F9F9"}),n=new Ch(this.framework,{x:20,y:20,width:this.framework.width-40,selectedTime:new Date(this.selectedTime),onChange:function(e){t.selectedTime=e,t.onChange&&t.onChange(e)},minTime:this.minTime,maxTime:this.maxTime});e.add(n);var r=new Wo(this.framework,{x:(this.framework.width-200)/2,y:250,width:200,height:44,text:"Valider",onClick:function(){return e.hide()}});e.add(r),this.framework.add(e),e.show()}},{key:"openMaterialTimePicker",value:function(){var t=this,e=new Eh(this.framework,{selectedTime:new Date(this.selectedTime),onChange:function(e){t.selectedTime=e,t.onChange&&t.onChange(e)},minTime:this.minTime,maxTime:this.maxTime,headerBgColor:this.headerBgColor});this.framework.add(e),e.show()}},{key:"draw",value:function(t){t.save();var e,n,r,i,o,a=this.formatTime(this.selectedTime);if("cupertino"===this.platform)e=this.inputBgColor||"#FFFFFF",n=this.inputTextColor||"#000000",r=this.labelColor||"#8E8E93",i=this.inputBorderColor||"#C7C7CC",o=this.fontSize||17,t.fillStyle=e,this.roundRect(t,this.x,this.y,this.width,this.height,this.inputRadius),t.fill(),t.strokeStyle=i,t.lineWidth=1,t.stroke(),t.fillStyle=r,t.font="14px -apple-system, sans-serif",t.textAlign="left",t.textBaseline="middle",t.fillText(this.label,this.x+16,this.y+18),t.fillStyle=n,t.font="".concat(o,"px -apple-system, sans-serif"),t.fillText(a,this.x+16,this.y+this.height-18),t.strokeStyle="#C7C7CC",t.lineWidth=2,t.beginPath(),t.moveTo(this.x+this.width-28,this.y+this.height/2-6),t.lineTo(this.x+this.width-22,this.y+this.height/2),t.lineTo(this.x+this.width-16,this.y+this.height/2-6),t.stroke();else{e=this.inputBgColor||(this.pressed?"#EEEEEE":"#FFFFFF"),n=this.inputTextColor||"#000000",r=this.labelColor||"#757575",i=this.inputBorderColor||"#E0E0E0",o=this.fontSize||16,t.fillStyle=e,this.inputRadius>0?(this.roundRect(t,this.x,this.y,this.width,this.height,this.inputRadius),t.fill()):t.fillRect(this.x,this.y,this.width,this.height),t.strokeStyle=i,t.lineWidth=1,this.inputRadius>0?(this.roundRect(t,this.x,this.y,this.width,this.height,this.inputRadius),t.stroke()):t.strokeRect(this.x,this.y,this.width,this.height);var s=this.x+16+12,l=this.y+this.height/2;t.strokeStyle=r,t.lineWidth=2,t.beginPath(),t.arc(s,l,11,0,2*Math.PI),t.moveTo(s,l-8),t.lineTo(s,l),t.lineTo(s+7,l),t.stroke(),t.fillStyle=r,t.font="14px Roboto, sans-serif",t.textAlign="left",t.fillText(this.label,this.x+48,this.y+18),t.fillStyle=n,t.font="".concat(o,"px Roboto, sans-serif"),t.fillText(a,this.x+48,this.y+this.height-10)}t.restore()}},{key:"formatTime",value:function(t){var e=t.getHours().toString().padStart(2,"0"),n=t.getMinutes().toString().padStart(2,"0");return"".concat(e,":").concat(n)}},{key:"roundRect",value:function(t,e,n,r,i,o){t.beginPath(),t.moveTo(e+o,n),t.lineTo(e+r-o,n),t.quadraticCurveTo(e+r,n,e+r,n+o),t.lineTo(e+r,n+i-o),t.quadraticCurveTo(e+r,n+i,e+r-o,n+i),t.lineTo(e+o,n+i),t.quadraticCurveTo(e,n+i,e,n+i-o),t.lineTo(e,n+o),t.quadraticCurveTo(e,n,e+o,n),t.closePath()}},{key:"isPointInside",value:function(t,e){return t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height}}])}(u),Ch=function(t){function e(t,n){var r;return mh(this,e),(r=xh(this,e,[t,n])).selectedTime=n.selectedTime||new Date,r.onChange=n.onChange,r.hourWheel=r.selectedTime.getHours(),r.minuteWheel=r.selectedTime.getMinutes(),r.minTime=n.minTime,r.maxTime=n.maxTime,r.wheelHeight=216,r.itemHeight=44,r.dragging=!1,r.dragStartY=0,r.dragWheel=null,r.lastY=0,r._setupEventHandlers(),n.width||(r.width=t.width-40),n.height||(r.height=r.wheelHeight),r}return Th(e,t),bh(e,[{key:"_setupEventHandlers",value:function(){var t=this;this.onPress=function(e,n){if(!(e>=t.x&&e<=t.x+t.width&&n>=t.y&&n<=t.y+t.wheelHeight))return!1;t.dragging=!0,t.dragStartY=n,t.lastY=n;var r=t.width/2;return t.dragWheel=e<t.x+r?0:1,t.framework.activeComponent=t,t._addGlobalMoveListener(),t._requestRedraw(),!0},this.onRelease=function(e,n){t.dragging&&(t.dragging=!1,t.dragWheel=null,t._removeGlobalMoveListener(),t.framework.activeComponent===t&&(t.framework.activeComponent=null),t._requestRedraw())},this.onMove=function(t,e){}}},{key:"_addGlobalMoveListener",value:function(){var t=this,e=this.framework.canvas;this._savedMouseMove=e.onmousemove,this._savedTouchMove=e.ontouchmove,e.onmousemove=function(n){if(t.dragging){n.preventDefault(),n.stopPropagation();var r=e.getBoundingClientRect(),i=n.clientX-r.left,o=n.clientY-r.top;return t._handleGlobalMove(i,o),!1}if(t._savedMouseMove)return t._savedMouseMove(n)},e.ontouchmove=function(n){if(t.dragging&&n.touches.length>0){n.preventDefault(),n.stopPropagation();var r=n.touches[0],i=e.getBoundingClientRect(),o=r.clientX-i.left,a=r.clientY-i.top;return t._handleGlobalMove(o,a),!1}if(t._savedTouchMove)return t._savedTouchMove(n)}}},{key:"_removeGlobalMoveListener",value:function(){var t=this.framework.canvas;this._savedMouseMove&&(t.onmousemove=this._savedMouseMove,this._savedMouseMove=null),this._savedTouchMove&&(t.ontouchmove=this._savedTouchMove,this._savedTouchMove=null)}},{key:"_handleGlobalMove",value:function(t,e){if(this.dragging){var n=e-this.lastY;if(this.lastY=e,Math.abs(n)>.5){var r=n>0?1:-1;if(0===this.dragWheel){var i=this.hourWheel-r;i<0&&(i=23),i>23&&(i=0),this.hourWheel=i}else if(1===this.dragWheel){var o=this.minuteWheel-r;o<0&&(o=59),o>59&&(o=0),this.minuteWheel=o}this._updateSelectedTime(),this._requestRedraw()}}}},{key:"_updateSelectedTime",value:function(){var t=new Date;t.setHours(this.hourWheel,this.minuteWheel,0,0),this.minTime&&t<this.minTime&&(this.hourWheel=this.minTime.getHours(),this.minuteWheel=this.minTime.getMinutes(),t.setHours(this.hourWheel,this.minuteWheel,0,0)),this.maxTime&&t>this.maxTime&&(this.hourWheel=this.maxTime.getHours(),this.minuteWheel=this.maxTime.getMinutes(),t.setHours(this.hourWheel,this.minuteWheel,0,0)),t.getTime()!==this.selectedTime.getTime()&&(this.selectedTime=t,this.onChange&&this.onChange(this.selectedTime))}},{key:"_requestRedraw",value:function(){this.framework.markComponentDirty&&this.framework.markComponentDirty(this)}},{key:"draw",value:function(t){t.save();var e=this.width/2;t.fillStyle="#F9F9F9",t.fillRect(this.x,this.y,this.width,this.wheelHeight);var n=this.y+this.wheelHeight/2-this.itemHeight/2;t.fillStyle="rgba(0, 0, 0, 0.05)",t.fillRect(this.x,n,this.width,this.itemHeight),t.strokeStyle="#C7C7CC",t.lineWidth=.5,t.beginPath(),t.moveTo(this.x,n),t.lineTo(this.x+this.width,n),t.moveTo(this.x,n+this.itemHeight),t.lineTo(this.x+this.width,n+this.itemHeight),t.stroke(),t.beginPath(),t.moveTo(this.x+e,this.y),t.lineTo(this.x+e,this.y+this.wheelHeight),t.stroke();var r=Array.from({length:24},function(t,e){return e.toString().padStart(2,"0")});this._drawWheel(t,this.x,r,this.hourWheel,0,23);var i=Array.from({length:60},function(t,e){return e.toString().padStart(2,"0")});this._drawWheel(t,this.x+e,i,this.minuteWheel,0,59),t.restore()}},{key:"_drawWheel",value:function(t,e,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:n.length-1,a=this.width/2,s=this.y+this.wheelHeight/2;t.save(),t.beginPath(),t.rect(e,this.y,a,this.wheelHeight),t.clip();for(var l=-2;l<=2;l++){var u=r+l;if(u>=i&&u<=o){var c=s+l*this.itemHeight,h=1-Math.abs(c-s)/this.wheelHeight,f=Math.max(.3,h);t.fillStyle="rgba(0, 0, 0, ".concat(f,")"),t.font="".concat(0===l?"bold ":"").concat(18+2*h,"px -apple-system, sans-serif"),t.textAlign="center",t.textBaseline="middle",t.fillText(n[u],e+a/2,c)}}t.restore()}},{key:"isPointInside",value:function(t,e){return t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.wheelHeight}},{key:"_unmount",value:function(){var t,n,r;this._removeGlobalMoveListener(),(t=e,n=this,"function"==typeof(r=vh(Sh(1&3?t.prototype:t),"_unmount",n))?function(t){return r.apply(n,t)}:r)([])}}])}(u),Eh=function(t){function e(t,n){var r;return mh(this,e),(r=xh(this,e,[t,{x:0,y:0,width:t.width,height:t.height,visible:!1,captureEvents:!0}])).selectedTime=n.selectedTime||new Date,r.hour=r.selectedTime.getHours()%12||12,r.minute=r.selectedTime.getMinutes(),r.isPM=r.selectedTime.getHours()>=12,r.onChange=n.onChange,r.opacity=0,r.isVisible=!1,r.headerBgColor=n.headerBgColor||"#6200EE",r.clockBgColor=n.clockBgColor||"#F8F8F8",r.selectedColor=n.selectedColor||"#6200EE",r.clockHandColor=n.clockHandColor||"#6200EE",r.buttonColor=n.buttonColor||"#6200EE",r.selectedTextColor=n.selectedTextColor||"#FFFFFF",r.unselectedTextColor=n.unselectedTextColor||"#424242",r.dialogWidth=Math.min(340,t.width-48),r.dialogHeight=520,r.mode="hours",r.dragging=!1,r._setupEventHandlers(),r}return Th(e,t),bh(e,[{key:"_setupEventHandlers",value:function(){var t=this;this.onPress=function(e,n){return t.handlePress(e,n)},this.onMove=function(e,n){return t.handleMove(e,n)},this.onRelease=function(e,n){return t.handleRelease(e,n)}}},{key:"show",value:function(){var t=this;this.isVisible=!0,this.visible=!0,this.opacity=0,this.framework.requestRedraw&&this.framework.requestRedraw();var e=function(){t.opacity+=.1,t.opacity<1&&requestAnimationFrame(e),t.framework.requestRedraw&&t.framework.requestRedraw()};e()}},{key:"hide",value:function(){var t=this,e=function(){t.opacity-=.1,t.opacity>0?(requestAnimationFrame(e),t.framework.requestRedraw&&t.framework.requestRedraw()):(t.isVisible=!1,t.visible=!1,t.framework.remove(t))};e()}},{key:"handlePress",value:function(t,e){if(!this.isVisible||this.opacity<=0)return!1;var n=(this.framework.width-this.dialogWidth)/2,r=(this.framework.height-this.dialogHeight)/2;if(e>r+20&&e<r+80&&t>n+40&&t<n+this.dialogWidth-60)return t<n+this.dialogWidth/2?(this.mode="hours",this._requestRedraw(),!0):(this.mode="minutes",this._requestRedraw(),!0);var i=r+30;if(t>n+this.dialogWidth-60&&t<n+this.dialogWidth-20){if(e>i-10&&e<i+10)return this.isPM=!1,this._updateTime(),!0;if(e>i+15&&e<i+35)return this.isPM=!0,this._updateTime(),!0}var o=n+this.dialogWidth/2,a=r+280,s=t-o,l=e-a;if(Math.sqrt(s*s+l*l)<140)return this._handleClockClick(t,e,o,a),this.dragging=!0,!0;var u=r+this.dialogHeight-40;if(Math.abs(e-u)<20){if(t>n+this.dialogWidth-200&&t<n+this.dialogWidth-100)return this.hide(),!0;if(t>n+this.dialogWidth-80)return this._updateTime(),this.hide(),!0}return!(t<n||t>n+this.dialogWidth||e<r||e>r+this.dialogHeight)||(this.hide(),!0)}},{key:"handleMove",value:function(t,e){if(!this.dragging||!this.isVisible)return!1;var n=(this.framework.width-this.dialogWidth)/2,r=(this.framework.height-this.dialogHeight)/2,i=n+this.dialogWidth/2,o=r+280;return this._handleClockClick(t,e,i,o),!0}},{key:"handleRelease",value:function(t,e){return!!this.dragging&&(this.dragging=!1,"hours"===this.mode&&(this.mode="minutes",this._requestRedraw()),!0)}},{key:"_handleClockClick",value:function(t,e,n,r){var i=Math.atan2(e-r,t-n);if((i+=Math.PI/2)<0&&(i+=2*Math.PI),"hours"===this.mode){var o=Math.round(i/(2*Math.PI/12));0===o&&(o=12),o>12&&(o%=12),this.hour=o}else{var a=5*Math.round(i/(2*Math.PI/12));a>=60&&(a=0),this.minute=a}this._updateTime()}},{key:"_updateTime",value:function(){var t=this.hour;this.isPM&&12!==t&&(t+=12),this.isPM||12!==t||(t=0),this.selectedTime.setHours(t,this.minute,0,0),this.onChange&&this.onChange(this.selectedTime),this._requestRedraw()}},{key:"_requestRedraw",value:function(){this.framework.requestRedraw&&this.framework.requestRedraw()}},{key:"draw",value:function(t){if(this.isVisible&&!(this.opacity<=0)){t.save(),t.globalAlpha=this.opacity,t.fillStyle="rgba(0,0,0,0.5)",t.fillRect(0,0,this.framework.width,this.framework.height);var e=(this.framework.width-this.dialogWidth)/2,n=(this.framework.height-this.dialogHeight)/2;t.shadowColor="rgba(0,0,0,0.3)",t.shadowBlur=16,t.shadowOffsetY=8,t.fillStyle="#FFFFFF",this.roundRect(t,e,n,this.dialogWidth,this.dialogHeight,8),t.fill(),t.shadowBlur=0,t.shadowOffsetY=0,t.fillStyle=this.headerBgColor,this.roundRect(t,e,n,this.dialogWidth,100,8),t.fill(),t.textAlign="center",t.textBaseline="middle";var r=n+50;t.fillStyle="hours"===this.mode?"#FFFFFF":"rgba(255,255,255,0.6)",t.font="bold 48px Roboto,sans-serif",t.fillText(this.hour.toString().padStart(2,"0"),e+this.dialogWidth/2-40,r),t.fillStyle="#FFFFFF",t.fillText(":",e+this.dialogWidth/2,r),t.fillStyle="minutes"===this.mode?"#FFFFFF":"rgba(255,255,255,0.6)",t.fillText(this.minute.toString().padStart(2,"0"),e+this.dialogWidth/2+40,r);var i=n+30;t.font="bold 14px Roboto,sans-serif",t.fillStyle=this.isPM?"rgba(255,255,255,0.6)":"#FFFFFF",t.fillText("AM",e+this.dialogWidth-40,i),t.fillStyle=this.isPM?"#FFFFFF":"rgba(255,255,255,0.6)",t.fillText("PM",e+this.dialogWidth-40,i+25);var o=e+this.dialogWidth/2,a=n+280,s=120;t.fillStyle="#F8F8F8",t.beginPath(),t.arc(o,a,s,0,2*Math.PI),t.fill(),"hours"===this.mode?this._drawClockNumbers(t,o,a,s,12,this.hour):this._drawClockMinutes(t,o,a,s,this.minute),this._drawClockHand(t,o,a,s);var l=n+this.dialogHeight-40;t.fillStyle="#6200EE",t.font="bold 14px Roboto,sans-serif",t.textAlign="right",t.fillText("ANNULER",e+this.dialogWidth-140,l),t.fillText("OK",e+this.dialogWidth-30,l),t.restore()}}},{key:"_drawClockNumbers",value:function(t,e,n,r,i,o){for(var a=1;a<=i;a++){var s=(a-3)*(2*Math.PI/i),l=e+Math.cos(s)*(r-30),u=n+Math.sin(s)*(r-30);a===o?(t.fillStyle="#6200EE",t.beginPath(),t.arc(l,u,20,0,2*Math.PI),t.fill(),t.fillStyle="#FFFFFF"):t.fillStyle="#424242",t.font="bold 16px Roboto,sans-serif",t.textAlign="center",t.textBaseline="middle",t.fillText(a.toString(),l,u)}}},{key:"_drawClockMinutes",value:function(t,e,n,r,i){for(var o=0;o<60;o+=5){var a=(o/5-3)*(2*Math.PI/12),s=e+Math.cos(a)*(r-30),l=n+Math.sin(a)*(r-30);o===i?(t.fillStyle="#6200EE",t.beginPath(),t.arc(s,l,20,0,2*Math.PI),t.fill(),t.fillStyle="#FFFFFF"):t.fillStyle="#424242",t.font="bold 16px Roboto,sans-serif",t.textAlign="center",t.textBaseline="middle",t.fillText(o.toString().padStart(2,"0"),s,l)}}},{key:"_drawClockHand",value:function(t,e,n,r){var i="hours"===this.mode?this.hour:this.minute/5,o=(this.mode,12),a=(i-3)*(2*Math.PI/o),s=r-50,l=e+Math.cos(a)*s,u=n+Math.sin(a)*s;t.strokeStyle="#6200EE",t.lineWidth=2,t.beginPath(),t.moveTo(e,n),t.lineTo(l,u),t.stroke(),t.fillStyle="#6200EE",t.beginPath(),t.arc(e,n,6,0,2*Math.PI),t.fill(),t.beginPath(),t.arc(l,u,4,0,2*Math.PI),t.fill()}},{key:"isPointInside",value:function(t,e){return this.isVisible&&this.opacity>0}},{key:"roundRect",value:function(t,e,n,r,i,o){t.beginPath(),t.moveTo(e+o,n),t.lineTo(e+r-o,n),t.quadraticCurveTo(e+r,n,e+r,n+o),t.lineTo(e+r,n+i-o),t.quadraticCurveTo(e+r,n+i,e+r-o,n+i),t.lineTo(e+o,n+i),t.quadraticCurveTo(e,n+i,e,n+i-o),t.lineTo(e,n+o),t.quadraticCurveTo(e,n,e+o,n),t.closePath()}}])}(u);const jh=Oh;function Ih(t){return Ih="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ih(t)}function Fh(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var l=r&&r.prototype instanceof s?r:s,u=Object.create(l.prototype);return Rh(u,"_invoke",function(n,r,i){var o,s,l,u=0,c=i||[],h=!1,f={p:0,n:0,v:t,a:d,f:d.bind(t,4),d:function(e,n){return o=e,s=0,l=t,f.n=n,a}};function d(n,r){for(s=n,l=r,e=0;!h&&u&&!i&&e<c.length;e++){var i,o=c[e],d=f.p,p=o[2];n>3?(i=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=t):o[0]<=d&&((i=n<2&&d<o[1])?(s=0,f.v=r,f.n=o[1]):d<p&&(i=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(i||n>1)return a;throw h=!0,r}return function(i,c,p){if(u>1)throw TypeError("Generator is already running");for(h&&1===c&&d(c,p),s=c,l=p;(e=s<2?t:l)||!h;){o||(s?s<3?(s>1&&(f.n=-1),d(s,l)):f.n=l:f.v=l);try{if(u=2,o){if(s||(i="next"),e=o[i]){if(!(e=e.call(o,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,s<2&&(s=0)}else 1===s&&(e=o.return)&&e.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+i+"' method"),s=1);o=t}else if((e=(h=f.n<0)?l:n.call(r,f))!==a)break}catch(e){o=t,s=1,l=e}finally{u=1}}return{value:e,done:h}}}(n,i,o),!0),u}var a={};function s(){}function l(){}function u(){}e=Object.getPrototypeOf;var c=[][r]?e(e([][r]())):(Rh(e={},r,function(){return this}),e),h=u.prototype=s.prototype=Object.create(c);function f(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,u):(t.__proto__=u,Rh(t,i,"GeneratorFunction")),t.prototype=Object.create(h),t}return l.prototype=u,Rh(h,"constructor",u),Rh(u,"constructor",l),l.displayName="GeneratorFunction",Rh(u,i,"GeneratorFunction"),Rh(h),Rh(h,i,"Generator"),Rh(h,r,function(){return this}),Rh(h,"toString",function(){return"[object Generator]"}),(Fh=function(){return{w:o,m:f}})()}function Rh(t,e,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(t){i=0}Rh=function(t,e,n,r){function o(e,n){Rh(t,e,function(t){return this._invoke(e,n,t)})}e?i?i(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(o("next",0),o("throw",1),o("return",2))},Rh(t,e,n,r)}function Mh(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function Ah(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,_h(r.key),r)}}function _h(t){var e=function(t){if("object"!=Ih(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ih(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ih(e)?e:e+""}function Dh(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Dh=function(){return!!t})()}function Bh(t){return Bh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Bh(t)}function Lh(t,e){return Lh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Lh(t,e)}const Wh=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=Bh(e),function(t,e){if(e&&("object"==Ih(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Dh()?Reflect.construct(e,n||[],Bh(t).constructor):e.apply(t,n))}(this,e,[t,{x:0,y:-100,width:t.width,height:100}])).framework=t,n.onRefresh=r.onRefresh,n.state="idle",n.pullDistance=0,n.refreshThreshold=r.refreshThreshold||80,n.isRefreshing=!1,n.myIsDragging=!1,n.startY=0,n.currentY=0,n.canPull=!1,n.setupOwnEventListeners(),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Lh(t,e)}(e,t),n=e,r=[{key:"setupOwnEventListeners",value:function(){var t=this.framework.canvas;this.handleTouchStartBound=this.handleOwnTouchStart.bind(this),this.handleTouchMoveBound=this.handleOwnTouchMove.bind(this),this.handleTouchEndBound=this.handleOwnTouchEnd.bind(this),t.addEventListener("touchstart",this.handleTouchStartBound,{passive:!1}),t.addEventListener("touchmove",this.handleTouchMoveBound,{passive:!1}),t.addEventListener("touchend",this.handleTouchEndBound,{passive:!1}),this.handleMouseDownBound=this.handleOwnMouseDown.bind(this),this.handleMouseMoveBound=this.handleOwnMouseMove.bind(this),this.handleMouseUpBound=this.handleOwnMouseUp.bind(this),t.addEventListener("mousedown",this.handleMouseDownBound),t.addEventListener("mousemove",this.handleMouseMoveBound),t.addEventListener("mouseup",this.handleMouseUpBound)}},{key:"handleOwnTouchStart",value:function(t){var e=this.framework.scrollOffset||0;if(Math.abs(e)<1){this.canPull=!0;var n=t.touches[0];this.startY=n.clientY,this.currentY=n.clientY,this.myIsDragging=!1}else this.canPull=!1}},{key:"handleOwnTouchMove",value:function(t){if(this.canPull){var e=t.touches[0];this.currentY=e.clientY;var n=this.currentY-this.startY;n>10&&(this.myIsDragging=!0,this.state="pulling",this.pullDistance=Math.min(.5*n,1.5*this.refreshThreshold),n>20&&(t.preventDefault(),t.stopPropagation()))}}},{key:"handleOwnTouchEnd",value:function(t){this.canPull&&(this.myIsDragging&&"pulling"===this.state&&(this.pullDistance>=this.refreshThreshold?this.triggerRefresh():this.reset()),this.myIsDragging=!1,this.canPull=!1)}},{key:"handleOwnMouseDown",value:function(t){var e=this.framework.scrollOffset||0;Math.abs(e)<1?(this.canPull=!0,this.startY=t.clientY,this.currentY=t.clientY,this.myIsDragging=!1):this.canPull=!1}},{key:"handleOwnMouseMove",value:function(t){if(this.canPull){this.currentY=t.clientY;var e=this.currentY-this.startY;e>10&&(this.myIsDragging=!0,this.state="pulling",this.pullDistance=Math.min(.5*e,1.5*this.refreshThreshold),e>20&&(t.preventDefault(),t.stopPropagation()))}}},{key:"handleOwnMouseUp",value:function(t){this.canPull&&(this.myIsDragging&&"pulling"===this.state&&(this.pullDistance>=this.refreshThreshold?this.triggerRefresh():this.reset()),this.myIsDragging=!1,this.canPull=!1)}},{key:"triggerRefresh",value:(i=Fh().m(function t(){var e,n=this;return Fh().w(function(t){for(;;)switch(t.p=t.n){case 0:if(!this.isRefreshing){t.n=1;break}return t.a(2);case 1:if(console.log("🔄 Refresh déclenché!"),this.state="refreshing",this.isRefreshing=!0,this.pullDistance=60,!this.onRefresh){t.n=5;break}return t.p=2,t.n=3,this.onRefresh();case 3:t.n=5;break;case 4:t.p=4,e=t.v,console.error("Erreur refresh:",e);case 5:setTimeout(function(){n.reset()},300);case 6:return t.a(2)}},t,this,[[2,4]])}),o=function(){var t=this,e=arguments;return new Promise(function(n,r){var o=i.apply(t,e);function a(t){Mh(o,n,r,a,s,"next",t)}function s(t){Mh(o,n,r,a,s,"throw",t)}a(void 0)})},function(){return o.apply(this,arguments)})},{key:"reset",value:function(){var t=this;console.log("🔄 Reset PullToRefresh");var e=function(){t.pullDistance>0?(t.pullDistance*=.8,t.pullDistance<1&&(t.pullDistance=0,t.state="idle",t.isRefreshing=!1),requestAnimationFrame(e)):(t.state="idle",t.isRefreshing=!1)};e()}},{key:"destroy",value:function(){var t=this.framework.canvas;t.removeEventListener("touchstart",this.handleTouchStartBound),t.removeEventListener("touchmove",this.handleTouchMoveBound),t.removeEventListener("touchend",this.handleTouchEndBound),t.removeEventListener("mousedown",this.handleMouseDownBound),t.removeEventListener("mousemove",this.handleMouseMoveBound),t.removeEventListener("mouseup",this.handleMouseUpBound)}},{key:"draw",value:function(t){if(!(this.pullDistance<=0)){t.save();var e=Math.min(1,this.pullDistance/this.refreshThreshold),n=Math.min(this.pullDistance,230);t.fillStyle="rgba(255, 255, 255, 0.95)",t.fillRect(0,0,this.width,n),t.strokeStyle="rgba(0, 0, 0, 0.1)",t.lineWidth=1,t.beginPath(),t.moveTo(0,n),t.lineTo(this.width,n),t.stroke();var r=this.width/2,i=Math.min(n/.6,90);if("refreshing"===this.state||this.isRefreshing){var o=Date.now()/1e3*Math.PI*2;t.strokeStyle="#6200EE",t.lineWidth=3,t.lineCap="round",t.beginPath(),t.arc(r,i,16,o,o+1.5*Math.PI),t.stroke(),n>35&&(t.fillStyle="#666666",t.font="14px -apple-system, sans-serif",t.textAlign="center",t.textBaseline="middle",t.fillText("Actualisation...",r,i+28))}else"pulling"===this.state&&(t.strokeStyle=e>=1?"#6200EE":"#CCCCCC",t.lineWidth=3,t.lineCap="round",t.beginPath(),t.arc(r,i,16,-Math.PI/2,-Math.PI/2+2*Math.PI*e),t.stroke(),t.save(),t.translate(r,i),t.rotate(e>=1?Math.PI:0),t.beginPath(),t.moveTo(0,-8),t.lineTo(-5,-3),t.lineTo(5,-3),t.closePath(),t.fillStyle=e>=1?"#6200EE":"#999999",t.fill(),t.restore(),n>35&&(t.fillStyle="#666666",t.font="14px -apple-system, sans-serif",t.textAlign="center",t.textBaseline="middle",e>=1?t.fillText("Relâchez pour actualiser",r,i+28):t.fillText("Tirez pour actualiser",r,i+28)));t.restore()}}}],r&&Ah(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i,o}(u);function Hh(t){return Hh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hh(t)}function zh(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,qh(r.key),r)}}function qh(t){var e=function(t){if("object"!=Hh(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Hh(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Hh(e)?e:e+""}function Uh(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Uh=function(){return!!t})()}function Nh(t){return Nh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Nh(t)}function Vh(t,e){return Vh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Vh(t,e)}const Gh=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=Nh(e),function(t,e){if(e&&("object"==Hh(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Uh()?Reflect.construct(e,n||[],Nh(t).constructor):e.apply(t,n))}(this,e,[t,r])).type=r.type||"text",n.animationDuration=1e3*(r.animationDuration||1.5),n.startTime=Date.now(),n.borderRadius=r.borderRadius||4,n.startAnimation(),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Vh(t,e)}(e,t),n=e,(r=[{key:"startAnimation",value:function(){var t=this,e=function(){t.visible,requestAnimationFrame(e)};e()}},{key:"getAnimationProgress",value:function(){return(Date.now()-this.startTime)%this.animationDuration/this.animationDuration}},{key:"createShimmerGradient",value:function(t,e,n,r,i){var o=this.getAnimationProgress(),a=Math.sqrt(r*r+i*i),s=2*a*o-a,l=Math.PI/4,u=Math.cos(l),c=Math.sin(l),h=t.createLinearGradient(e+s*u,n+s*c,e+(s+a)*u,n+(s+a)*c);return h.addColorStop(0,"rgba(255, 255, 255, 0)"),h.addColorStop(.5,"rgba(255, 255, 255, 0.4)"),h.addColorStop(1,"rgba(255, 255, 255, 0)"),h}},{key:"roundRect",value:function(t,e,n,r,i,o){r<2*o&&(o=r/2),i<2*o&&(o=i/2),t.beginPath(),t.moveTo(e+o,n),t.arcTo(e+r,n,e+r,n+i,o),t.arcTo(e+r,n+i,e,n+i,o),t.arcTo(e,n+i,e,n,o),t.arcTo(e,n,e+r,n,o),t.closePath()}},{key:"draw",value:function(t){t.save();var e="#e0e0e0";switch(this.type){case"circle":t.fillStyle=e,t.beginPath(),t.arc(this.x+this.width/2,this.y+this.height/2,this.width/2,0,2*Math.PI),t.fill(),t.beginPath(),t.arc(this.x+this.width/2,this.y+this.height/2,this.width/2,0,2*Math.PI),t.clip(),t.fillStyle=this.createShimmerGradient(t,this.x,this.y,this.width,this.height),t.fillRect(this.x,this.y,this.width,this.height);break;case"text":for(var n=Math.floor(this.height/26),r=0;r<n;r++){var i=r===n-1?.6*this.width:this.width,o=this.y+26*r;t.fillStyle=e,this.roundRect(t,this.x,o,i,16,this.borderRadius),t.fill(),t.save(),this.roundRect(t,this.x,o,i,16,this.borderRadius),t.clip(),t.fillStyle=this.createShimmerGradient(t,this.x,o,i,16),t.fillRect(this.x-100,o-100,i+200,216),t.restore()}break;default:t.fillStyle=e,this.roundRect(t,this.x,this.y,this.width,this.height,this.borderRadius),t.fill(),t.save(),this.roundRect(t,this.x,this.y,this.width,this.height,this.borderRadius),t.clip(),t.fillStyle=this.createShimmerGradient(t,this.x,this.y,this.width,this.height),t.fillRect(this.x-100,this.y-100,this.width+200,this.height+200),t.restore()}t.restore()}}])&&zh(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);function Yh(t){return Yh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Yh(t)}function Xh(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function Qh(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Xh(Object(n),!0).forEach(function(e){Kh(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Xh(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function Kh(t,e,n){return(e=Jh(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function $h(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Jh(r.key),r)}}function Jh(t){var e=function(t){if("object"!=Yh(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Yh(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Yh(e)?e:e+""}function Zh(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Zh=function(){return!!t})()}function tf(t,e,n,r){var i=ef(nf(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof i?function(t){return i.apply(n,t)}:i}function ef(){return ef="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=nf(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},ef.apply(null,arguments)}function nf(t){return nf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},nf(t)}function rf(t,e){return rf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},rf(t,e)}const of=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=nf(e),function(t,e){if(e&&("object"==Yh(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Zh()?Reflect.construct(e,n||[],nf(t).constructor):e.apply(t,n))}(this,e,[t,Qh({width:r.width||300,height:r.height||200},r)])).points=[],n.isDrawing=!1,n.strokeColor=r.strokeColor||"#000000",n.strokeWidth=r.strokeWidth||3,n.backgroundColor=r.backgroundColor||"#FFFFFF",n.onSignatureChange=r.onSignatureChange,n.lastPoint=null,n.signatureCanvas=document.createElement("canvas"),n.signatureCanvas.width=n.width,n.signatureCanvas.height=n.height,n.signatureCtx=n.signatureCanvas.getContext("2d"),n.signatureCtx.strokeStyle=n.strokeColor,n.signatureCtx.fillStyle=n.strokeColor,n.signatureCtx.lineWidth=n.strokeWidth,n.signatureCtx.lineCap="round",n.signatureCtx.lineJoin="round",n.clearSignature(),n.handlePress=n.handlePress.bind(n),n.handleMove=n.handleMove.bind(n),n.handleRelease=n.handleRelease.bind(n),n.onPress=n.handlePress,n.onMove=n.handleMove,n.onRelease=n.handleRelease,n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&rf(t,e)}(e,t),n=e,r=[{key:"handlePress",value:function(t,e){if(!this.isPointInside(t,e))return!1;this.isDrawing=!0;var n=t-this.x,r=e-this.framework.scrollOffset-this.y;return this.lastPoint={x:n,y:r},this.points.push([{x:n,y:r}]),this.signatureCtx.fillStyle=this.strokeColor,this.signatureCtx.beginPath(),this.signatureCtx.arc(n,r,this.strokeWidth/2,0,2*Math.PI),this.signatureCtx.fill(),!0}},{key:"handleMove",value:function(t,e){if(!this.isDrawing)return!1;var n=t-this.x,r=e-this.framework.scrollOffset-this.y;return!(n<0||n>this.width||r<0||r>this.height||(this.signatureCtx.beginPath(),this.signatureCtx.moveTo(this.lastPoint.x,this.lastPoint.y),this.signatureCtx.lineTo(n,r),this.signatureCtx.stroke(),this.points.length>0&&this.points[this.points.length-1].push({x:n,y:r}),this.lastPoint={x:n,y:r},0))}},{key:"handleRelease",value:function(t,e){return!!this.isDrawing&&(this.isDrawing=!1,this.lastPoint=null,this.onSignatureChange&&this.onSignatureChange(this.points),!0)}},{key:"clear",value:function(){this.points=[],this.clearSignature(),this.onSignatureChange&&this.onSignatureChange([])}},{key:"clearSignature",value:function(){this.signatureCtx.fillStyle=this.backgroundColor,this.signatureCtx.fillRect(0,0,this.width,this.height),this.signatureCtx.strokeStyle=this.strokeColor,this.signatureCtx.fillStyle=this.strokeColor,this.signatureCtx.lineWidth=this.strokeWidth,this.signatureCtx.lineCap="round",this.signatureCtx.lineJoin="round"}},{key:"getSignatureAsDataURL",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this.signatureCanvas.toDataURL(t,e)}},{key:"getSignatureAsBlob",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"image/png",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;this.signatureCanvas.toBlob(t,e,n)}},{key:"isEmpty",value:function(){return 0===this.points.length||this.points.every(function(t){return 0===t.length})}},{key:"draw",value:function(t){t.save(),t.fillStyle=this.backgroundColor,t.strokeStyle="#2196F3",t.lineWidth=2,t.fillRect(this.x,this.y,this.width,this.height),t.strokeRect(this.x,this.y,this.width,this.height),t.strokeStyle="#DDDDDD",t.lineWidth=1,t.setLineDash([5,5]),t.beginPath(),t.moveTo(this.x+20,this.y+this.height-40),t.lineTo(this.x+this.width-20,this.y+this.height-40),t.stroke(),t.setLineDash([]),this.isEmpty()&&(t.fillStyle="#999999",t.font="16px Arial",t.textAlign="center",t.textBaseline="middle",t.fillText("Signez ici",this.x+this.width/2,this.y+this.height/2)),t.drawImage(this.signatureCanvas,this.x,this.y),this.isDrawing&&this.lastPoint&&(t.fillStyle="rgba(33, 150, 243, 0.3)",t.beginPath(),t.arc(this.x+this.lastPoint.x,this.y+this.lastPoint.y,3*this.strokeWidth,0,2*Math.PI),t.fill()),t.fillStyle="#666666",t.font="10px Arial",t.textAlign="left",t.fillText("x:".concat(this.x," y:").concat(this.y," ").concat(this.width,"x").concat(this.height),this.x+5,this.y+15),t.restore()}},{key:"isPointInside",value:function(t,e){var n=e-this.framework.scrollOffset;return t>=this.x&&t<=this.x+this.width&&n>=this.y&&n<=this.y+this.height}},{key:"destroy",value:function(){this.signatureCanvas.width=0,this.signatureCanvas.height=0,tf(e,"destroy",this,1)&&tf(e,"destroy",this,3)([])}}],r&&$h(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);function af(t){return af="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},af(t)}function sf(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function lf(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,uf(r.key),r)}}function uf(t){var e=function(t){if("object"!=af(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=af(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==af(e)?e:e+""}function cf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(cf=function(){return!!t})()}function hf(t){return hf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},hf(t)}function ff(t,e){return ff=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ff(t,e)}const df=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=hf(e),function(t,e){if(e&&("object"==af(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,cf()?Reflect.construct(e,n||[],hf(t).constructor):e.apply(t,n))}(this,e,[t,r])).children=r.children||[],n.spacing=r.spacing||0,n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ff(t,e)}(e,t),n=e,(r=[{key:"add",value:function(t){return this.children.push(t),t}},{key:"layout",value:function(){}},{key:"layoutRecursive",value:function(){this.layout();var t,e=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return sf(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?sf(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}(this.children);try{for(e.s();!(t=e.n()).done;){var n=t.value;"function"==typeof n.layoutRecursive&&n.layoutRecursive()}}catch(t){e.e(t)}finally{e.f()}}},{key:"draw",value:function(t){}}])&&lf(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);function pf(t){return pf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pf(t)}function yf(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return vf(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?vf(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function vf(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function mf(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,gf(r.key),r)}}function gf(t){var e=function(t){if("object"!=pf(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=pf(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==pf(e)?e:e+""}function bf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(bf=function(){return!!t})()}function wf(t){return wf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},wf(t)}function xf(t,e){return xf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},xf(t,e)}const kf=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=wf(e),function(t,e){if(e&&("object"==pf(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,bf()?Reflect.construct(e,n||[],wf(t).constructor):e.apply(t,n))}(this,e,[t,r])).columns=r.columns||2,n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&xf(t,e)}(e,t),n=e,(r=[{key:"layout",value:function(){var t,e=(this.width-this.spacing*(this.columns-1))/this.columns,n=this.x,r=this.y,i=0,o=0,a=yf(this.children);try{for(a.s();!(t=a.n()).done;){var s=t.value;s.x=n,s.y=r,s.width=e,o=Math.max(o,s.height),++i===this.columns?(i=0,n=this.x,r+=o+this.spacing,o=0):n+=e+this.spacing}}catch(t){a.e(t)}finally{a.f()}this.height=r-this.y+o;var l,u=yf(this.children);try{for(u.s();!(l=u.n()).done;){var c=l.value;"function"==typeof c.layoutRecursive&&c.layoutRecursive()}}catch(t){u.e(t)}finally{u.f()}}}])&&mf(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(df);function Sf(t){return Sf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Sf(t)}function Tf(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Pf(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Pf(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function Pf(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Of(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Cf(r.key),r)}}function Cf(t){var e=function(t){if("object"!=Sf(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Sf(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Sf(e)?e:e+""}function Ef(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ef=function(){return!!t})()}function jf(t){return jf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},jf(t)}function If(t,e){return If=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},If(t,e)}const Ff=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=jf(e),function(t,e){if(e&&("object"==Sf(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Ef()?Reflect.construct(e,n||[],jf(t).constructor):e.apply(t,n))}(this,e,[t,r])).align=r.align||"start",n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&If(t,e)}(e,t),n=e,(r=[{key:"layout",value:function(){var t,e=this.x,n=0,r=Tf(this.children);try{for(r.s();!(t=r.n()).done;){var i=t.value;i.x=e,"center"===this.align?i.y=this.y+(this.height-i.height)/2:"end"===this.align?i.y=this.y+this.height-i.height:i.y=this.y,e+=i.width+this.spacing,n=Math.max(n,i.height)}}catch(t){r.e(t)}finally{r.f()}this.width=e-this.x-this.spacing,this.height||(this.height=n);var o,a=Tf(this.children);try{for(a.s();!(o=a.n()).done;){var s=o.value;"function"==typeof s.layoutRecursive&&s.layoutRecursive()}}catch(t){a.e(t)}finally{a.f()}}}])&&Of(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(df);function Rf(t){return Rf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Rf(t)}function Mf(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Af(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Af(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function Af(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function _f(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Df(r.key),r)}}function Df(t){var e=function(t){if("object"!=Rf(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Rf(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Rf(e)?e:e+""}function Bf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Bf=function(){return!!t})()}function Lf(t){return Lf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Lf(t)}function Wf(t,e){return Wf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Wf(t,e)}const Hf=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=Lf(e),function(t,e){if(e&&("object"==Rf(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Bf()?Reflect.construct(e,n||[],Lf(t).constructor):e.apply(t,n))}(this,e,[t,r])).align=r.align||"start",n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Wf(t,e)}(e,t),n=e,(r=[{key:"layout",value:function(){var t,e=this.y,n=0,r=Mf(this.children);try{for(r.s();!(t=r.n()).done;){var i=t.value;i.y=e,"center"===this.align?i.x=this.x+(this.width-i.width)/2:"end"===this.align?i.x=this.x+this.width-i.width:"stretch"===this.align?(i.x=this.x,i.width=this.width):i.x=this.x,e+=i.height+this.spacing,n=Math.max(n,i.width)}}catch(t){r.e(t)}finally{r.f()}this.height=e-this.y-this.spacing,this.width||(this.width=n);var o,a=Mf(this.children);try{for(a.s();!(o=a.n()).done;){var s=o.value;"function"==typeof s.layoutRecursive&&s.layoutRecursive()}}catch(t){a.e(t)}finally{a.f()}}}])&&_f(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(df);function zf(t){return zf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},zf(t)}function qf(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Uf(r.key),r)}}function Uf(t){var e=function(t){if("object"!=zf(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=zf(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==zf(e)?e:e+""}function Nf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Nf=function(){return!!t})()}function Vf(t){return Vf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Vf(t)}function Gf(t,e){return Gf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Gf(t,e)}const Yf=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=function(t,e,n){return e=Vf(e),function(t,e){if(e&&("object"==zf(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Nf()?Reflect.construct(e,n||[],Vf(t).constructor):e.apply(t,n))}(this,e,[t,r])).child=r.child,n.left=r.left,n.top=r.top,n.right=r.right,n.bottom=r.bottom,n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Gf(t,e)}(e,t),n=e,(r=[{key:"layout",value:function(){this.child&&(void 0!==this.left?this.child.x=this.left:void 0!==this.right?this.child.x=this.width-this.child.width-this.right:this.child.x=0,void 0!==this.top?this.child.y=this.top:void 0!==this.bottom?this.child.y=this.height-this.child.height-this.bottom:this.child.y=0,this.child.layout&&this.child.layout())}},{key:"draw",value:function(t){this.child&&this.child.draw(t)}}])&&qf(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);function Xf(t){return Xf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xf(t)}function Qf(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Kf(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Kf(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function Kf(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function $f(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Jf(r.key),r)}}function Jf(t){var e=function(t){if("object"!=Xf(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Xf(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Xf(e)?e:e+""}function Zf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Zf=function(){return!!t})()}function td(t){return td=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},td(t)}function ed(t,e){return ed=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ed(t,e)}const nd=function(t){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e,n){return e=td(e),function(t,e){if(e&&("object"==Xf(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Zf()?Reflect.construct(e,n||[],td(t).constructor):e.apply(t,n))}(this,e,[t,n])}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ed(t,e)}(e,t),n=e,(r=[{key:"layoutRecursive",value:function(){var t,e=Qf(this.children);try{for(e.s();!(t=e.n()).done;){var n,r=t.value;r.layoutRecursive?r.layoutRecursive():null===(n=r.layout)||void 0===n||n.call(r)}}catch(t){e.e(t)}finally{e.f()}}},{key:"draw",value:function(t){var e,n=Qf(this.children);try{for(n.s();!(e=n.n()).done;)e.value.draw(t)}catch(t){n.e(t)}finally{n.f()}}}])&&$f(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(df);var rd=["ref"];function id(t){return id="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},id(t)}function od(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ad(r.key),r)}}function ad(t){var e=function(t){if("object"!=id(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=id(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==id(e)?e:e+""}var sd={Button:Wo,SegmentedControl:Xo,Input:k,Slider:ea,Text:j,View:ca,Card:B,FAB:G,SpeedDialFAB:Sa,MorphingFAB:Ba,CircularProgress:Na,ImageComponent:$a,DatePicker:bs,IOSDatePickerWheel:fs,AndroidDatePickerDialog:is,Avatar:Os,Snackbar:Ms,BottomNavigationBar:it,Video:Hs,Modal:vt,Drawer:Ot,AppBar:Lt,SliverAppBar:gr,Chip:Ys,Camera:Mr,Stepper:tl,Accordion:ul,Tabs:Qt,Switch:vl,SwipeableListItem:Pl,ListItem:Al,List:Vl,QRCodeReader:Xr,VirtualList:ru,BottomSheet:re,ProgressBar:cu,RadioButton:gu,Dialog:fe,TimePicker:jh,ContextMenu:we,Checkbox:Pu,Toast:Ie,FloatedCamera:ph,NumberInput:Ru,TextField:We,SelectDialog:Ke,Select:Wu,MultiSelectDialog:Ku,Divider:rc,FileUpload:hc,Table:gc,AudioPlayer:Zc,TreeView:Ic,SearchInput:un,ImageCarousel:Bc,PasswordInput:kn,InputTags:Bn,InputDatalist:Jn,PullToRefresh:Wh,Skeleton:Gh,SignaturePad:of,OpenStreetMap:bo,LayoutComponent:df,Grid:kf,Row:Ff,Column:Hf,Positioned:Yf,Banner:sr,Chart:Gc,Stack:nd};function ld(){return{current:null}}var ud=new(function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._tree=null},e=[{key:"_create",value:function(t){return{type:t,props:arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},children:arguments.length>2&&void 0!==arguments[2]?arguments[2]:[]}}},{key:"mount",value:function(t){this._tree&&this._mountNode(t,this._tree,null)}},{key:"_mountNode",value:function(t,e){var n,r=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(!e)return null;var o=sd[e.type];if(!o)return console.warn('UIBuilder: composant inconnu "'.concat(e.type,'"')),null;var a=e.props,s=a.ref,l=function(t,e){if(null==t)return{};var n,r,i=function(t,e){if(null==t)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==e.indexOf(r))continue;n[r]=t[r]}return n}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(r=0;r<o.length;r++)n=o[r],-1===e.indexOf(n)&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}(a,rd),u=new o(t,l);return s&&"object"===id(s)&&"current"in s&&(s.current=u),i&&"Card"===(null===(n=i.constructor)||void 0===n?void 0:n.name)||t.add(u),i&&"function"==typeof i.add&&i.add(u),e.children&&e.children.length>0&&e.children.forEach(function(e){return r._mountNode(t,e,u)}),u}},{key:"app",value:function(t){return this._tree=t,this}}],e&&od(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}());Object.keys(sd).forEach(function(t){var e=t.charAt(0).toLowerCase()+t.slice(1),n=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=Array.isArray(n)?n:n?[n]:[];return ud._create(t,e,r)};ud[e]=n,ud[t]=n}),ud.column=ud.column||function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return ud._create("Column",t,Array.isArray(e)?e:[e])},ud.row=ud.row||function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return ud._create("Row",t,Array.isArray(e)?e:[e])},ud.stack=ud.stack||function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return ud._create("Stack",t,Array.isArray(e)?e:[e])},ud.grid=ud.grid||function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return ud._create("Grid",t,Array.isArray(e)?e:[e])};const cd=ud;function hd(t){return hd="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},hd(t)}function fd(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,dd(r.key),r)}}function dd(t){var e=function(t){if("object"!=hd(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=hd(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==hd(e)?e:e+""}const pd=function(){return t=function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.framework=e,this.themes={light:n.lightTheme||{background:"#FFFFFF",surface:"#F5F5F5",surfaceVariant:"#E7E0EC",text:"#1C1B1F",textSecondary:"#49454F",textDisabled:"#79747E",primary:"#6750A4",onPrimary:"#FFFFFF",primaryContainer:"#EADDFF",onPrimaryContainer:"#21005D",secondary:"#625B71",onSecondary:"#FFFFFF",secondaryContainer:"#E8DEF8",onSecondaryContainer:"#1D192B",tertiary:"#7D5260",onTertiary:"#FFFFFF",tertiaryContainer:"#FFD8E4",onTertiaryContainer:"#31111D",error:"#B3261E",onError:"#FFFFFF",errorContainer:"#F9DEDC",onErrorContainer:"#410E0B",border:"#CAC4D0",divider:"#E0E0E0",outline:"#79747E",outlineVariant:"#CAC4D0",hover:"rgba(103, 80, 164, 0.08)",pressed:"rgba(103, 80, 164, 0.12)",focus:"rgba(103, 80, 164, 0.12)",disabled:"rgba(28, 27, 31, 0.12)",shadow:"rgba(0, 0, 0, 0.2)",elevation1:"rgba(0, 0, 0, 0.05)",elevation2:"rgba(0, 0, 0, 0.08)",elevation3:"rgba(0, 0, 0, 0.12)"},dark:n.darkTheme||{background:"#1C1B1F",surface:"#2B2930",surfaceVariant:"#49454F",text:"#E6E1E5",textSecondary:"#CAC4D0",textDisabled:"#938F99",primary:"#D0BCFF",onPrimary:"#381E72",primaryContainer:"#4F378B",onPrimaryContainer:"#EADDFF",secondary:"#CCC2DC",onSecondary:"#332D41",secondaryContainer:"#4A4458",onSecondaryContainer:"#E8DEF8",tertiary:"#EFB8C8",onTertiary:"#492532",tertiaryContainer:"#633B48",onTertiaryContainer:"#FFD8E4",error:"#F2B8B5",onError:"#601410",errorContainer:"#8C1D18",onErrorContainer:"#F9DEDC",border:"#938F99",divider:"#3D3D3D",outline:"#938F99",outlineVariant:"#49454F",hover:"rgba(208, 188, 255, 0.08)",pressed:"rgba(208, 188, 255, 0.12)",focus:"rgba(208, 188, 255, 0.12)",disabled:"rgba(230, 225, 229, 0.12)",shadow:"rgba(0, 0, 0, 0.8)",elevation1:"rgba(0, 0, 0, 0.3)",elevation2:"rgba(0, 0, 0, 0.4)",elevation3:"rgba(0, 0, 0, 0.5)"}},this.currentMode=null,this.currentTheme=null,this.listeners=[],this.storageKey=n.storageKey||"app-theme-mode",this.init()},e=[{key:"init",value:function(){var t=this.loadPreference();this.setupSystemListener(),t?this.setMode(t,!1):this.setMode("system",!1)}},{key:"loadPreference",value:function(){try{var t=localStorage.getItem(this.storageKey);if(t&&["light","dark","system"].includes(t))return t}catch(t){console.warn("Impossible de charger les préférences de thème:",t)}return null}},{key:"savePreference",value:function(t){try{localStorage.setItem(this.storageKey,t)}catch(t){console.warn("Impossible de sauvegarder les préférences de thème:",t)}}},{key:"setupSystemListener",value:function(){var t=this,e=window.matchMedia("(prefers-color-scheme: dark)"),n=function(e){"system"===t.currentMode&&t.applySystemTheme()};e.addEventListener?e.addEventListener("change",n):e.addListener(n),this.systemMediaQuery=e,this.systemChangeHandler=n}},{key:"applySystemTheme",value:function(){var t=window.matchMedia("(prefers-color-scheme: dark)").matches?this.themes.dark:this.themes.light;this.applyTheme(t)}},{key:"setMode",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(["light","dark","system"].includes(t))if(this.currentMode=t,e&&this.savePreference(t),"system"===t)this.applySystemTheme();else{var n=this.themes[t];this.applyTheme(n)}else console.warn("Mode invalide: ".concat(t,". Utilisez 'light', 'dark' ou 'system'."))}},{key:"applyTheme",value:function(t){this.currentTheme=t,this.framework&&(this.framework.theme=t,this.framework.components&&this.framework.components.forEach(function(t){t.markDirty&&t.markDirty()})),this.notifyListeners(t)}},{key:"getMode",value:function(){return this.currentMode}},{key:"getTheme",value:function(){return this.currentTheme}},{key:"getColor",value:function(t){var e;return(null===(e=this.currentTheme)||void 0===e?void 0:e[t])||"#000000"}},{key:"toggle",value:function(){if("system"===this.currentMode){var t=window.matchMedia("(prefers-color-scheme: dark)").matches;this.setMode(t?"light":"dark")}else this.setMode("light"===this.currentMode?"dark":"light")}},{key:"addListener",value:function(t){"function"==typeof t&&(this.listeners.push(t),t(this.currentTheme))}},{key:"removeListener",value:function(t){var e=this.listeners.indexOf(t);e>-1&&this.listeners.splice(e,1)}},{key:"notifyListeners",value:function(t){this.listeners.forEach(function(e){try{e(t)}catch(t){console.error("Erreur dans un listener de thème:",t)}})}},{key:"setCustomTheme",value:function(t,e){this.themes[t]=e}},{key:"destroy",value:function(){this.systemMediaQuery&&this.systemChangeHandler&&(this.systemMediaQuery.removeEventListener?this.systemMediaQuery.removeEventListener("change",this.systemChangeHandler):this.systemMediaQuery.removeListener(this.systemChangeHandler)),this.listeners=[]}}],e&&fd(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function yd(t){return yd="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yd(t)}function vd(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var l=r&&r.prototype instanceof s?r:s,u=Object.create(l.prototype);return md(u,"_invoke",function(n,r,i){var o,s,l,u=0,c=i||[],h=!1,f={p:0,n:0,v:t,a:d,f:d.bind(t,4),d:function(e,n){return o=e,s=0,l=t,f.n=n,a}};function d(n,r){for(s=n,l=r,e=0;!h&&u&&!i&&e<c.length;e++){var i,o=c[e],d=f.p,p=o[2];n>3?(i=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=t):o[0]<=d&&((i=n<2&&d<o[1])?(s=0,f.v=r,f.n=o[1]):d<p&&(i=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(i||n>1)return a;throw h=!0,r}return function(i,c,p){if(u>1)throw TypeError("Generator is already running");for(h&&1===c&&d(c,p),s=c,l=p;(e=s<2?t:l)||!h;){o||(s?s<3?(s>1&&(f.n=-1),d(s,l)):f.n=l:f.v=l);try{if(u=2,o){if(s||(i="next"),e=o[i]){if(!(e=e.call(o,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,s<2&&(s=0)}else 1===s&&(e=o.return)&&e.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+i+"' method"),s=1);o=t}else if((e=(h=f.n<0)?l:n.call(r,f))!==a)break}catch(e){o=t,s=1,l=e}finally{u=1}}return{value:e,done:h}}}(n,i,o),!0),u}var a={};function s(){}function l(){}function u(){}e=Object.getPrototypeOf;var c=[][r]?e(e([][r]())):(md(e={},r,function(){return this}),e),h=u.prototype=s.prototype=Object.create(c);function f(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,u):(t.__proto__=u,md(t,i,"GeneratorFunction")),t.prototype=Object.create(h),t}return l.prototype=u,md(h,"constructor",u),md(u,"constructor",l),l.displayName="GeneratorFunction",md(u,i,"GeneratorFunction"),md(h),md(h,i,"Generator"),md(h,r,function(){return this}),md(h,"toString",function(){return"[object Generator]"}),(vd=function(){return{w:o,m:f}})()}function md(t,e,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(t){i=0}md=function(t,e,n,r){function o(e,n){md(t,e,function(t){return this._invoke(e,n,t)})}e?i?i(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(o("next",0),o("throw",1),o("return",2))},md(t,e,n,r)}function gd(t){return function(t){if(Array.isArray(t))return Od(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Pd(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function bd(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function wd(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function xd(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?wd(Object(n),!0).forEach(function(e){kd(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):wd(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function kd(t,e,n){return(e=Ed(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Sd(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=Pd(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function Td(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,u=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(t){u=!0,i=t}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}(t,e)||Pd(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Pd(t,e){if(t){if("string"==typeof t)return Od(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Od(t,e):void 0}}function Od(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Cd(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ed(r.key),r)}}function Ed(t){var e=function(t){if("object"!=yd(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=yd(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==yd(e)?e:e+""}var jd=new Set([Lt,it,Ot,fe,vt,Qt,G,Ie,Mr,Xr,sr,gr,re,we,bo,Ke]);const Id=function(){return t=function t(e){var n,r,i,o,a,s,l,u,c,h,f,d,p,y,v,m,g,b=this,w=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t);var x=performance.now();if(this.metrics={initTime:0,firstRenderTime:null,firstInteractionTime:null,totalStartupTime:null},this._firstRenderDone=!1,this._startupStartTime=x,this.canvas=document.createElement("canvas"),this.canvas.id=e||"canvas-".concat(Date.now()),this.canvas.style.display="block",this.canvas.style.touchAction="none",this.canvas.style.userSelect="none",document.body.appendChild(this.canvas),this.useWebGL=null!==(n=w.useWebGL)&&void 0!==n&&n,this.useWebGL)try{this.ctx=new Io(this.canvas,{dpr:this.dpr,alpha:!1})}catch(t){console.warn("Échec de l’initialisation WebGLCanvasAdapter → fallback Canvas 2D",t),this.ctx=this.canvas.getContext("2d",{alpha:!1,desynchronized:!0,willReadFrequently:!1}),this.useWebGL=!1}else this.ctx=this.canvas.getContext("2d",{alpha:!1,desynchronized:!0,willReadFrequently:!1});this.backgroundColor=w.backgroundColor||"#f5f5f5",this.width=window.innerWidth,this.height=window.innerHeight,this.dpr=window.devicePixelRatio||1,this.optimizations={enabled:!1!==w.optimizations,useDoubleBuffering:!0,useCaching:!0,useBatchDrawing:!0,useSpatialPartitioning:!1,useImageDataOptimization:!0},this._stateCache={fillStyle:null,strokeStyle:null,font:null,textAlign:null,textBaseline:null,lineWidth:null,globalAlpha:1},this.imageCache=new Map,this.textCache=new Map,this._doubleBuffer=null,this._bufferCtx=null,this.optimizations.useDoubleBuffering&&this._initDoubleBuffer(),this.scrollWorker=this.createScrollWorker(),this.scrollWorker.onmessage=this.handleScrollWorkerMessage.bind(this),this.splashOptions={enabled:!0===(null===(r=w.splash)||void 0===r?void 0:r.enabled),duration:(null===(i=w.splash)||void 0===i?void 0:i.duration)||700,fadeOutDuration:(null===(o=w.splash)||void 0===o?void 0:o.fadeOutDuration)||500,backgroundColor:(null===(a=w.splash)||void 0===a?void 0:a.backgroundColor)||["#667eea","#764ba2"],spinnerColor:(null===(s=w.splash)||void 0===s?void 0:s.spinnerColor)||"white",spinnerBackground:(null===(l=w.splash)||void 0===l?void 0:l.spinnerBackground)||"rgba(255, 255, 255, 0.3)",textColor:(null===(u=w.splash)||void 0===u?void 0:u.textColor)||"white",text:(null===(c=w.splash)||void 0===c?void 0:c.text)||"Chargement...",textSize:(null===(h=w.splash)||void 0===h?void 0:h.textSize)||20,textFont:(null===(f=w.splash)||void 0===f?void 0:f.textFont)||"Arial",progressBarColor:(null===(d=w.splash)||void 0===d?void 0:d.progressBarColor)||"white",progressBarBackground:(null===(p=w.splash)||void 0===p?void 0:p.progressBarBackground)||"rgba(255, 255, 255, 0.3)",showProgressBar:!1!==(null===(y=w.splash)||void 0===y?void 0:y.showProgressBar),logo:(null===(v=w.splash)||void 0===v?void 0:v.logo)||null,logoWidth:(null===(m=w.splash)||void 0===m?void 0:m.logoWidth)||100,logoHeight:(null===(g=w.splash)||void 0===g?void 0:g.logoHeight)||100},this.splashOptions.enabled?this.showSplashScreen():this._splashFinished=!0,this.platform=this.detectPlatform(),setTimeout(function(){b.initScrollWorker()},100),this.themeMode=w.themeMode||"system",this.userThemeOverride=null,this.setupSystemThemeListener();var k=localStorage.getItem("themeOverride");k&&["light","dark"].includes(k)&&(this.userThemeOverride=k,this.themeMode=k),this.components=[],this._cachedMaxScroll=0,this._maxScrollDirty=!0,this.resizeTimeout=null,this.state={},this.fps=0,this._frames=0,this._lastFpsTime=performance.now(),this.showFps=w.showFps||!1,this.debbug=w.debug||!1,this.worker=this.createCanvasWorker(),this.worker.onmessage=this.handleWorkerMessage.bind(this),this.worker.postMessage({type:"INIT",payload:{components:[]}}),this.logicWorker=this.createLogicWorker(),this.logicWorker.onmessage=this.handleLogicWorkerMessage.bind(this),this.logicWorkerState={},this.logicWorker.postMessage({type:"SET_STATE",payload:this.state}),this.logicWorker.postMessage({type:"SET_STATE",payload:this.state}),this.isDragging=!1,this.lastTouchY=0,this.scrollOffset=0,this.scrollVelocity=0,this.scrollFriction=.95,this.dirtyComponents=new Set,this.optimizationEnabled=this.optimizations.enabled,this.animator=new eo,this.routes=new Map,this.currentRoute="/",this.currentParams={},this.currentQuery={},this.history=[],this.historyIndex=-1,this.transitionState={isTransitioning:!1,progress:0,duration:300,type:"slide",direction:"forward",oldComponents:[],newComponents:[]},this.setupCanvas(),this._disableImageSmoothing(),this.setupEventListeners(),this.setupHistoryListener(),this.startRenderLoop(),this.devTools=new ao(this),this.inspectionOverlay=new co(this),!0===w.enableDevTools&&(this.enableDevTools(),console.log("DevTools enabled. Press Ctrl+Shift+D to toggle.")),this.themeManager=new pd(this,{lightTheme:w.lightTheme,darkTheme:w.darkTheme,storageKey:w.themeStorageKey||"app-theme-mode"}),this.theme=this.themeManager.getTheme();var S=performance.now()-x;this.metrics={initTime:S,firstRenderTime:null,firstInteractionTime:null,totalStartupTime:null},(w.debug||w.showMetrics)&&console.log("⚡ Framework initialisé en ".concat(S.toFixed(2),"ms")),this._firstRenderDone=!1,this._startupStartTime=x,this.optimizations.useSpatialPartitioning&&this._initSpatialPartitioning()},e=[{key:"createTemporaryDomElement",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},o=document.createElement(t);Object.assign(o,e),Object.entries(i).forEach(function(t){var e=Td(t,2),n=e[0],r=e[1];"className"===n?o.className=r:o.setAttribute(n,r)}),o.style.position="absolute",o.style.opacity="0",o.style.zIndex="9999",r&&Object.assign(o.style,{left:"".concat(r.left,"px"),top:"".concat(r.top,"px"),width:"".concat(r.width,"px"),height:"".concat(r.height,"px")}),document.body.appendChild(o);var a=function(){o.remove(),document.removeEventListener("focusout",a)};return o.addEventListener("change",function(t){n(t.target),a()}),o.addEventListener("blur",a),["input","select","textarea"].includes(t.toLowerCase())&&o.focus(),o}},{key:"createScrollWorker",value:function(){var t=new Blob(["\n\t\t\tlet state = {\n\t\t\t\tscrollOffset: 0,\n\t\t\t\tscrollVelocity: 0,\n\t\t\t\tscrollFriction: 0.95,\n\t\t\t\tisDragging: false,\n\t\t\t\tmaxScroll: 0,\n\t\t\t\theight: 0,\n\t\t\t\tlastTouchY: 0,\n\t\t\t\tcomponents: []\n\t\t\t};\n\n\t\t\tconst FIXED_COMPONENT_TYPES = [\n\t\t\t\t'AppBar', 'BottomNavigationBar', 'Drawer', 'Dialog', 'Modal', \n\t\t\t\t'Tabs', 'FAB', 'Toast', 'Camera', 'QRCodeReader', 'Banner', \n\t\t\t\t'SliverAppBar', 'BottomSheet', 'ContextMenu', 'OpenStreetMap', 'SelectDialog'\n\t\t\t];\n\n\t\t\tconst calculateMaxScroll = () => {\n\t\t\t\tlet maxY = 0;\n\t\t\t\t\n\t\t\t\tfor (const comp of state.components) {\n\t\t\t\t\tif (FIXED_COMPONENT_TYPES.includes(comp.type) || !comp.visible) continue;\n\t\t\t\t\tconst bottom = comp.y + comp.height;\n\t\t\t\t\tif (bottom > maxY) maxY = bottom;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\treturn Math.max(0, maxY - state.height + 50);\n\t\t\t};\n\n\t\t\tconst updateInertia = () => {\n\t\t\t\tif (Math.abs(state.scrollVelocity) > 0.1 && !state.isDragging) {\n\t\t\t\t\tstate.scrollOffset += state.scrollVelocity;\n\t\t\t\t\tstate.maxScroll = calculateMaxScroll();\n\t\t\t\t\tstate.scrollOffset = Math.max(Math.min(state.scrollOffset, 0), -state.maxScroll);\n\t\t\t\t\tstate.scrollVelocity *= state.scrollFriction;\n\t\t\t\t} else {\n\t\t\t\t\tstate.scrollVelocity = 0;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\treturn {\n\t\t\t\t\tscrollOffset: state.scrollOffset,\n\t\t\t\t\tscrollVelocity: state.scrollVelocity,\n\t\t\t\t\tmaxScroll: state.maxScroll\n\t\t\t\t};\n\t\t\t};\n\n\t\t\tconst handleTouchMove = (deltaY) => {\n\t\t\t\tif (state.isDragging) {\n\t\t\t\t\tstate.scrollOffset += deltaY;\n\t\t\t\t\tstate.maxScroll = calculateMaxScroll();\n\t\t\t\t\tstate.scrollOffset = Math.max(Math.min(state.scrollOffset, 0), -state.maxScroll);\n\t\t\t\t\tstate.scrollVelocity = deltaY;\n\t\t\t\t\treturn {\n\t\t\t\t\t\tscrollOffset: state.scrollOffset,\n\t\t\t\t\t\tscrollVelocity: state.scrollVelocity,\n\t\t\t\t\t\tmaxScroll: state.maxScroll\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\treturn null;\n\t\t\t};\n\n\t\t\tself.onmessage = (e) => {\n\t\t\t\tconst { type, payload } = e.data;\n\n\t\t\t\tswitch (type) {\n\t\t\t\t\tcase 'INIT':\n\t\t\t\t\t\tstate = {\n\t\t\t\t\t\t\t...state,\n\t\t\t\t\t\t\t...payload\n\t\t\t\t\t\t};\n\t\t\t\t\t\tstate.maxScroll = calculateMaxScroll();\n\t\t\t\t\t\tself.postMessage({ \n\t\t\t\t\t\t\ttype: 'INITIALIZED', \n\t\t\t\t\t\t\tpayload: { \n\t\t\t\t\t\t\t\tscrollOffset: state.scrollOffset,\n\t\t\t\t\t\t\t\tmaxScroll: state.maxScroll \n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'UPDATE_COMPONENTS':\n\t\t\t\t\t\tstate.components = payload.components;\n\t\t\t\t\t\tstate.maxScroll = calculateMaxScroll();\n\t\t\t\t\t\tself.postMessage({ \n\t\t\t\t\t\t\ttype: 'MAX_SCROLL_UPDATED', \n\t\t\t\t\t\t\tpayload: { maxScroll: state.maxScroll }\n\t\t\t\t\t\t});\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'UPDATE_DIMENSIONS':\n\t\t\t\t\t\tstate.height = payload.height;\n\t\t\t\t\t\tstate.maxScroll = calculateMaxScroll();\n\t\t\t\t\t\tself.postMessage({ \n\t\t\t\t\t\t\ttype: 'MAX_SCROLL_UPDATED', \n\t\t\t\t\t\t\tpayload: { maxScroll: state.maxScroll }\n\t\t\t\t\t\t});\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'SET_DRAGGING':\n\t\t\t\t\t\tstate.isDragging = payload.isDragging;\n\t\t\t\t\t\tif (!payload.isDragging) {\n\t\t\t\t\t\t\tstate.scrollVelocity = payload.lastVelocity || 0;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tstate.lastTouchY = payload.lastTouchY || 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'HANDLE_TOUCH_MOVE':\n\t\t\t\t\t\tconst result = handleTouchMove(payload.deltaY);\n\t\t\t\t\t\tif (result) {\n\t\t\t\t\t\t\tself.postMessage({ \n\t\t\t\t\t\t\t\ttype: 'SCROLL_UPDATED', \n\t\t\t\t\t\t\t\tpayload: result \n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'UPDATE_INERTIA':\n\t\t\t\t\t\tconst inertiaResult = updateInertia();\n\t\t\t\t\t\tself.postMessage({ \n\t\t\t\t\t\t\ttype: 'SCROLL_UPDATED', \n\t\t\t\t\t\t\tpayload: inertiaResult \n\t\t\t\t\t\t});\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'SET_SCROLL_OFFSET':\n\t\t\t\t\t\tstate.scrollOffset = payload.scrollOffset;\n\t\t\t\t\t\tstate.maxScroll = calculateMaxScroll();\n\t\t\t\t\t\tstate.scrollOffset = Math.max(Math.min(state.scrollOffset, 0), -state.maxScroll);\n\t\t\t\t\t\tself.postMessage({ \n\t\t\t\t\t\t\ttype: 'SCROLL_UPDATED', \n\t\t\t\t\t\t\tpayload: { \n\t\t\t\t\t\t\t\tscrollOffset: state.scrollOffset,\n\t\t\t\t\t\t\t\tmaxScroll: state.maxScroll \n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'GET_STATE':\n\t\t\t\t\t\tself.postMessage({ \n\t\t\t\t\t\t\ttype: 'STATE', \n\t\t\t\t\t\t\tpayload: { \n\t\t\t\t\t\t\t\tscrollOffset: state.scrollOffset,\n\t\t\t\t\t\t\t\tscrollVelocity: state.scrollVelocity,\n\t\t\t\t\t\t\t\tmaxScroll: state.maxScroll,\n\t\t\t\t\t\t\t\tisDragging: state.isDragging\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t};\n\t\t"],{type:"application/javascript"});return new Worker(URL.createObjectURL(t))}},{key:"handleScrollWorkerMessage",value:function(t){var e=this,n=t.data,r=n.type,i=n.payload;switch(r){case"SCROLL_UPDATED":this.scrollOffset=i.scrollOffset,this.scrollVelocity=i.scrollVelocity,Math.abs(i.scrollVelocity)>.5&&this.dirtyComponents.clear(),this._cachedMaxScroll=i.maxScroll,this._maxScrollDirty=!1,Math.abs(i.scrollVelocity)>0&&this.components.forEach(function(t){e.isFixedComponent(t)||e.markComponentDirty(t)});break;case"MAX_SCROLL_UPDATED":this._cachedMaxScroll=i.maxScroll,this._maxScrollDirty=!1;break;case"INITIALIZED":this.scrollOffset=i.scrollOffset,this._cachedMaxScroll=i.maxScroll,this._maxScrollDirty=!1;break;case"STATE":this.scrollOffset=i.scrollOffset,this.scrollVelocity=i.scrollVelocity,this.isDragging=i.isDragging,this._cachedMaxScroll=i.maxScroll,this._maxScrollDirty=!1}}},{key:"initScrollWorker",value:function(){var t=this.components.map(function(t){return{type:t.constructor.name,y:t.y,height:t.height,visible:t.visible}});this.scrollWorker.postMessage({type:"INIT",payload:{scrollOffset:this.scrollOffset,scrollVelocity:this.scrollVelocity,scrollFriction:this.scrollFriction,isDragging:this.isDragging,height:this.height,components:t}})}},{key:"updateScrollWorkerComponents",value:function(){var t=this.components.map(function(t){return{type:t.constructor.name,y:t.y,height:t.height,visible:t.visible}});this.scrollWorker.postMessage({type:"UPDATE_COMPONENTS",payload:{components:t}})}},{key:"_initDoubleBuffer",value:function(){this._doubleBuffer=document.createElement("canvas"),this._bufferCtx=this._doubleBuffer.getContext("2d",{alpha:!1,desynchronized:!0}),this._doubleBuffer.width=this.width*this.dpr,this._doubleBuffer.height=this.height*this.dpr,this._doubleBuffer.style.width=this.width+"px",this._doubleBuffer.style.height=this.height+"px",this._bufferCtx.scale(this.dpr,this.dpr),this._disableImageSmoothing(this._bufferCtx),this._bufferCtx.fillStyle=this.backgroundColor||"#ffffff",this._bufferCtx.fillRect(0,0,this.width,this.height)}},{key:"_disableImageSmoothing",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.ctx;t.imageSmoothingEnabled=!1,t.msImageSmoothingEnabled=!1,t.webkitImageSmoothingEnabled=!1,t.mozImageSmoothingEnabled=!1}},{key:"_initSpatialPartitioning",value:function(){var t=this;this._spatialGrid={cellSize:100,grid:new Map,update:function(e){t._spatialGrid.grid.clear(),e.forEach(function(e){if(e.visible){var n=Math.floor(e.x/t._spatialGrid.cellSize),r=Math.floor(e.y/t._spatialGrid.cellSize),i="".concat(n,",").concat(r);t._spatialGrid.grid.has(i)||t._spatialGrid.grid.set(i,[]),t._spatialGrid.grid.get(i).push(e)}})},getVisible:function(e){var n=[],r=e-200,i=e+t.height+200;return t._spatialGrid.grid.forEach(function(t,e){t.forEach(function(t){t.y+t.height>=r&&t.y<=i&&n.push(t)})}),n}}}},{key:"fillRectOptimized",value:function(t,e,n,r,i){this._stateCache.fillStyle!==i&&(this.ctx.fillStyle=i,this._stateCache.fillStyle=i),this.ctx.fillRect(t,e,n,r)}},{key:"fillTextCached",value:function(t,e,n,r,i){var o="".concat(t,"_").concat(r,"_").concat(i);if(!this.textCache.has(o)){var a=document.createElement("canvas"),s=a.getContext("2d",{alpha:!1});s.font=r;var l=s.measureText(t);a.width=Math.ceil(l.width),a.height=Math.ceil(1.2*parseInt(r)),s.font=r,s.fillStyle=i,s.textBaseline="top",s.fillText(t,0,0),this.textCache.set(o,{canvas:a,width:a.width,height:a.height,baseline:parseInt(r)})}var u=this.textCache.get(o);this.ctx.drawImage(u.canvas,e,n-u.baseline)}},{key:"batchRect",value:function(t){var e=this;if(t&&0!==t.length){var n=new Map;t.forEach(function(t){n.has(t.color)||n.set(t.color,[]),n.get(t.color).push(t)}),n.forEach(function(t,n){e.ctx.fillStyle=n,e.ctx.beginPath(),t.forEach(function(t){e.ctx.rect(t.x,t.y,t.width,t.height)}),e.ctx.fill()})}}},{key:"updateRegion",value:function(t,e,n,r,i){var o=this.ctx.getImageData(t,e,n,r);i(o.data,n,r),this.ctx.putImageData(o,t,e)}},{key:"flush",value:function(){this.optimizations.useDoubleBuffering&&this._bufferCtx&&(this.ctx.drawImage(this._doubleBuffer,0,0,this.width,this.height),this._bufferCtx.fillStyle=this.backgroundColor||"#ffffff",this._bufferCtx.fillRect(0,0,this.width,this.height))}},{key:"_renderOptimized",value:function(){var t=this.optimizations.useDoubleBuffering?this._bufferCtx:this.ctx;if(t){t.clearRect(0,0,this.width,this.height);var e,n=[],r=[],i=Sd(this.components);try{for(i.s();!(e=i.n()).done;){var o=e.value;this.isFixedComponent(o)?r.push(o):n.push(o)}}catch(t){i.e(t)}finally{i.f()}if(t.save(),t.translate(0,this.scrollOffset),this.optimizations.useSpatialPartitioning&&this._spatialGrid){var a,s=Sd(this._spatialGrid.getVisible(-this.scrollOffset));try{for(s.s();!(a=s.n()).done;){var l=a.value;l.visible&&l.draw(t)}}catch(t){s.e(t)}finally{s.f()}}else{var u,c=Sd(n);try{for(c.s();!(u=c.n()).done;){var h=u.value;if(h.visible){var f=h.y+this.scrollOffset;f+h.height>=-100&&f<=this.height+100&&h.draw(t)}}}catch(t){c.e(t)}finally{c.f()}}t.restore();for(var d=0,p=r;d<p.length;d++){var y=p[d];y.visible&&y.draw(t)}this.optimizations.useDoubleBuffering&&this.flush()}}},{key:"_renderDirtyComponents",value:function(){var t=this,e=this.optimizations.useDoubleBuffering?this._bufferCtx:this.ctx;if(e&&0!==this.dirtyComponents.size){var n=Array.from(this.dirtyComponents);this.dirtyComponents.clear();var r=[],i=[];if(n.forEach(function(e){e.visible&&(t.isFixedComponent(e)?r.push(e):i.push(e))}),i.length>0){e.save(),e.translate(0,this.scrollOffset);var o,a=Sd(i);try{for(a.s();!(o=a.n()).done;){var s=o.value;s.draw&&s.draw(e),s.markClean&&s.markClean()}}catch(t){a.e(t)}finally{a.f()}e.restore()}for(var l=0,u=r;l<u.length;l++){var c=u[l];c.draw&&c.draw(e),c.markClean&&c.markClean()}this.optimizations.useDoubleBuffering&&this.flush()}}},{key:"setOptimization",value:function(t,e){var n=this;if(this.optimizations.hasOwnProperty(t)){switch(this.optimizations[t]=e,t){case"useDoubleBuffering":e&&!this._bufferCtx&&this._initDoubleBuffer();break;case"useSpatialPartitioning":e&&!this._spatialGrid&&this._initSpatialPartitioning()}this.components.forEach(function(t){return n.markComponentDirty(t)})}}},{key:"getOptimizations",value:function(){return xd({},this.optimizations)}},{key:"showSplashScreen",value:function(){var t=this,e=performance.now(),n=this.splashOptions,r=null;n.logo&&((r=new Image).src=n.logo);var i=function(){var o=performance.now()-e,a=Math.min(o/n.duration,1);if(t.ctx.clearRect(0,0,t.width,t.height),Array.isArray(n.backgroundColor)&&n.backgroundColor.length>=2){var s=t.ctx.createLinearGradient(0,0,t.width,t.height);s.addColorStop(0,n.backgroundColor[0]),s.addColorStop(1,n.backgroundColor[1]),t.ctx.fillStyle=s}else t.ctx.fillStyle=n.backgroundColor;t.ctx.fillRect(0,0,t.width,t.height);var l=t.width/2,u=t.height/2;if(r&&r.complete){var c=l-n.logoWidth/2,h=u-n.logoHeight-80;t.ctx.drawImage(r,c,h,n.logoWidth,n.logoHeight)}var f=o/1e3*Math.PI*2;if(t.ctx.beginPath(),t.ctx.arc(l,u,40,0,2*Math.PI),t.ctx.strokeStyle=n.spinnerBackground,t.ctx.lineWidth=4,t.ctx.stroke(),t.ctx.beginPath(),t.ctx.arc(l,u,40,f,f+1.5*Math.PI),t.ctx.strokeStyle=n.spinnerColor,t.ctx.lineWidth=4,t.ctx.lineCap="round",t.ctx.stroke(),t.ctx.fillStyle=n.textColor,t.ctx.font="".concat(n.textSize,"px ").concat(n.textFont),t.ctx.textAlign="center",t.ctx.fillText(n.text,l,u+40+40),n.showProgressBar){var d=l-100,p=u+40+70;t.ctx.fillStyle=n.progressBarBackground,t.ctx.fillRect(d,p,200,4),t.ctx.fillStyle=n.progressBarColor,t.ctx.fillRect(d,p,200*a,4)}a<1?requestAnimationFrame(i):t.fadeOutSplash()};i()}},{key:"fadeOutSplash",value:function(){var t=this,e=this.splashOptions,n=e.fadeOutDuration,r=performance.now(),i=function(){var o=(performance.now()-r)/n,a=1-Math.min(o,1);if(a>0){if(t.ctx.clearRect(0,0,t.width,t.height),t.ctx.globalAlpha=a,Array.isArray(e.backgroundColor)&&e.backgroundColor.length>=2){var s=t.ctx.createLinearGradient(0,0,t.width,t.height);s.addColorStop(0,e.backgroundColor[0]),s.addColorStop(1,e.backgroundColor[1]),t.ctx.fillStyle=s}else t.ctx.fillStyle=e.backgroundColor;t.ctx.fillRect(0,0,t.width,t.height);var l=t.width/2,u=t.height/2;t.ctx.beginPath(),t.ctx.arc(l,u,40,0,2*Math.PI),t.ctx.strokeStyle=e.spinnerBackground,t.ctx.lineWidth=4,t.ctx.stroke(),t.ctx.globalAlpha=1,requestAnimationFrame(i)}else t._splashFinished=!0,t.ctx.clearRect(0,0,t.width,t.height),t.ctx.globalAlpha=1,t.ctx.textAlign="start",t.ctx.textBaseline="alphabetic",t.ctx.font="10px sans-serif",t.ctx.fillStyle="#000000",t.ctx.strokeStyle="#000000",t.ctx.lineWidth=1,t.ctx.lineCap="butt",t.ctx.lineJoin="miter"};i()}},{key:"_markFirstRender",value:function(){if(!this._firstRenderDone){this._firstRenderDone=!0;var t=performance.now()-this._startupStartTime-this.metrics.initTime;this.metrics.firstRenderTime=t,this.metrics.totalStartupTime=performance.now()-this._startupStartTime,this.showMetrics&&(console.log("🎨 Premier rendu en ".concat(t.toFixed(2),"ms")),console.log("🚀 Temps total de démarrage: ".concat(this.metrics.totalStartupTime.toFixed(2),"ms")),this.displayMetrics())}}},{key:"setupSystemThemeListener",value:function(){var t=this,e=window.matchMedia("(prefers-color-scheme: dark)");e.addEventListener?e.addEventListener("change",function(e){"system"===t.themeMode&&t.applyThemeFromSystem()}):e.addListener(function(e){"system"===t.themeMode&&t.applyThemeFromSystem()})}},{key:"setThemeMode",value:function(t){this.themeManager.setMode(t),this.theme=this.themeManager.getTheme()}},{key:"getColor",value:function(t){return this.themeManager.getColor(t)}},{key:"onThemeChange",value:function(t){var e=this;this.themeManager.addListener(function(n){e.theme=n,t(n)})}},{key:"toggleTheme",value:function(){this.themeManager.toggle(),this.theme=this.themeManager.getTheme()}},{key:"enableDevTools",value:function(){arguments.length>0&&void 0!==arguments[0]&&!arguments[0]?this.devTools&&(this.devTools.detachFromFramework?this.devTools.detachFromFramework():this.devTools.cleanup&&this.devTools.cleanup(),this.devTools.container&&this.devTools.container.parentNode&&this.devTools.container.parentNode.removeChild(this.devTools.container),this.devTools.toggleBtn&&this.devTools.toggleBtn.parentNode&&this.devTools.toggleBtn.parentNode.removeChild(this.devTools.toggleBtn),this.devTools._isAttached=!1):(this.devTools||(this.devTools=new ao(this)),this.devTools._isAttached||(this.devTools.attachToFramework(),this.devTools._isAttached=!0),this.devTools.toggleBtn&&(this.devTools.toggleBtn.style.display="block"))}},{key:"toggleInspection",value:function(){this.inspectionOverlay.toggle()}},{key:"devToolsCommand",value:function(t){switch(t){case"inspect":this.inspectionOverlay.enable();break;case"performance":this.devTools.switchTab("performance"),this.devTools.toggle();break;case"components":this.devTools.switchTab("components"),this.devTools.toggle();break;case"highlight":(arguments.length<=1?void 0:arguments[1])&&this.devTools.highlightComponent(arguments.length<=1?void 0:arguments[1]);break;case"reflow":this.components.forEach(function(t){return t.markDirty()})}}},{key:"wrapContext",value:function(t,e){var n=Object.getOwnPropertyDescriptor(CanvasRenderingContext2D.prototype,"fillStyle");Object.defineProperty(t,"fillStyle",{set:function(e){n.set.call(t,e)},get:function(){return n.get.call(t)}})}},{key:"createCanvasWorker",value:function(){var t=new Blob(["\n let components = [];\n \n self.onmessage = function(e) {\n const { type, payload } = e.data;\n \n switch(type) {\n case 'INIT':\n components = payload.components;\n self.postMessage({ type: 'READY' });\n break;\n \n case 'UPDATE_LAYOUT':\n const updated = components.map(comp => {\n if (comp.dynamicHeight && comp.calculateHeight) {\n comp.height = comp.calculateHeight();\n }\n return { id: comp.id, height: comp.height };\n });\n self.postMessage({ type: 'LAYOUT_DONE', payload: updated });\n break;\n \n case 'SCROLL_INERTIA':\n let { offset, velocity, friction, maxScroll } = payload;\n offset += velocity;\n offset = Math.max(Math.min(offset, 0), -maxScroll);\n velocity *= friction;\n self.postMessage({ type: 'SCROLL_UPDATED', payload: { offset, velocity } });\n break;\n }\n };\n "],{type:"application/javascript"});return new Worker(URL.createObjectURL(t))}},{key:"createLogicWorker",value:function(){var t=new Blob(["\n let state = {};\n \n self.onmessage = async function(e) {\n const { type, payload } = e.data;\n \n switch(type) {\n case 'SET_STATE':\n state = payload;\n self.postMessage({ type: 'STATE_UPDATED', payload: state });\n break;\n \n case 'EXECUTE':\n try {\n const fn = new Function('state', 'args', payload.fnString);\n const result = await fn(state, payload.args);\n self.postMessage({ type: 'EXECUTION_RESULT', payload: result });\n } catch (err) {\n self.postMessage({ type: 'EXECUTION_ERROR', payload: err.message });\n }\n break;\n }\n };\n "],{type:"application/javascript"});return new Worker(URL.createObjectURL(t))}},{key:"setTheme",value:function(t){this.theme=t,this.useWebGL||this.wrapContext(this.ctx,t),this.components&&Array.isArray(this.components)?this.components.forEach(function(t){return t.markDirty()}):console.warn("[setTheme] components pas encore initialisé")}},{key:"toggleDarkMode",value:function(){this.theme===lightTheme?this.setTheme(darkTheme):this.setTheme(lightTheme)}},{key:"enableFpsDisplay",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.showFps=t}},{key:"animate",value:function(t,e){return this.animator.animate(t,e)}},{key:"handleWorkerMessage",value:function(t){var e=this,n=t.data,r=n.type,i=n.payload;switch(r){case"LAYOUT_DONE":var o,a=Sd(i);try{var s=function(){var t=o.value,n=e.components.find(function(e){return e.id===t.id});n&&(n.height=t.height)};for(a.s();!(o=a.n()).done;)s()}catch(t){a.e(t)}finally{a.f()}break;case"SCROLL_UPDATED":this.scrollOffset=i.offset,this.scrollVelocity=i.velocity}}},{key:"updateLayoutAsync",value:function(){this.worker.postMessage({type:"UPDATE_LAYOUT"})}},{key:"updateScrollInertia",value:function(){var t=this.getMaxScroll();this.worker.postMessage({type:"SCROLL_INERTIA",payload:{offset:this.scrollOffset,velocity:this.scrollVelocity,friction:this.scrollFriction,maxScroll:t}})}},{key:"handleLogicWorkerMessage",value:function(t){var e=t.data,n=e.type,r=e.payload;switch(n){case"STATE_UPDATED":this.logicWorkerState=r;break;case"EXECUTION_RESULT":this.onWorkerResult&&this.onWorkerResult(r);break;case"EXECUTION_ERROR":console.error("Logic Worker Error:",r)}}},{key:"runLogicTask",value:function(t,e){this.logicWorker.postMessage({type:"EXECUTE_TASK",payload:{taskName:t,taskData:e}})}},{key:"updateLogicWorkerState",value:function(t){this.logicWorkerState=xd(xd({},this.logicWorkerState),t),this.logicWorker.postMessage({type:"SET_STATE",payload:this.logicWorkerState})}},{key:"detectPlatform",value:function(){var t=navigator.userAgent.toLowerCase();return/android/.test(t)?"material":/iphone|ipad|ipod/.test(t)?"cupertino":"material"}},{key:"setupCanvas",value:function(){this.canvas.width=this.width*this.dpr,this.canvas.height=this.height*this.dpr,this.canvas.style.width=this.width+"px",this.canvas.style.height=this.height+"px",this.canvas.style.backgroundColor=this.backgroundColor,this.ctx.scale(this.dpr,this.dpr)}},{key:"setupEventListeners",value:function(){this.canvas.addEventListener("touchstart",this.handleTouchStart.bind(this)),this.canvas.addEventListener("touchmove",this.handleTouchMove.bind(this)),this.canvas.addEventListener("touchend",this.handleTouchEnd.bind(this)),this.canvas.addEventListener("mousedown",this.handleMouseDown.bind(this)),this.canvas.addEventListener("mousemove",this.handleMouseMove.bind(this)),this.canvas.addEventListener("mouseup",this.handleMouseUp.bind(this)),window.addEventListener("resize",this.handleResize.bind(this))}},{key:"setupHistoryListener",value:function(){var t=this;window.addEventListener("popstate",function(e){e.state&&e.state.route&&t.navigateTo(e.state.route,{replace:!0,animate:!0,direction:"back"})})}},{key:"route",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r={pattern:t,component:e,regex:this.patternToRegex(t),paramNames:this.extractParamNames(t),beforeEnter:n.beforeEnter,afterEnter:n.afterEnter,beforeLeave:n.beforeLeave,afterLeave:n.afterLeave,onEnter:n.onEnter,onLeave:n.onLeave,transition:n.transition||"slide"};return this.routes.set(t,r),this}},{key:"patternToRegex",value:function(t){var e=t.replace(/\//g,"\\/").replace(/:([^\/]+)/g,"([^\\/]+)");return new RegExp("^".concat(e,"$"))}},{key:"extractParamNames",value:function(t){var e=t.match(/:([^\/]+)/g);return e?e.map(function(t){return t.slice(1)}):[]}},{key:"matchRoute",value:function(t){var e,n=this,r=Td(t.split("?"),2),i=r[0],o=r[1],a=Sd(this.routes);try{var s,l=function(){var t=Td(e.value,2),r=(t[0],t[1]),a=i.match(r.regex);if(a){var s={};r.paramNames.forEach(function(t,e){s[t]=a[e+1]});var l=n.parseQueryString(o);return{v:{route:r,params:s,query:l,pathname:i}}}};for(a.s();!(e=a.n()).done;)if(s=l())return s.v}catch(t){a.e(t)}finally{a.f()}return null}},{key:"parseQueryString",value:function(t){if(!t)return{};var e={};return t.split("&").forEach(function(t){var n=Td(t.split("="),2),r=n[0],i=n[1];e[decodeURIComponent(r)]=decodeURIComponent(i||"")}),e}},{key:"navigate",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.navigateTo(t,e)}},{key:"navigateTo",value:(n=vd().m(function t(e){var n,r,i,o,a,s,l,u,c,h,f,d,p,y,v,m,g,b,w,x,k,S=this,T=arguments;return vd().w(function(t){for(;;)switch(t.n){case 0:if(r=(n=T.length>1&&void 0!==T[1]?T[1]:{}).replace,i=void 0!==r&&r,o=n.animate,a=void 0===o||o,s=n.direction,l=void 0===s?"forward":s,u=n.transition,c=void 0===u?null:u,h=n.state,f=void 0===h?{}:h,d=this.matchRoute(e)){t.n=1;break}return console.warn("Route not found: ".concat(e)),t.a(2);case 1:if(p=d.route,y=d.params,v=d.query,m=d.pathname,null==(g=this.routes.get(this.currentRoute))||!g.beforeLeave){t.n=3;break}return t.n=2,g.beforeLeave(this.currentParams,this.currentQuery,this);case 2:if(!1!==t.v){t.n=3;break}return console.log("Navigation cancelled by beforeLeave hook"),t.a(2);case 3:if(null==g||!g.onLeave){t.n=4;break}return t.n=4,g.onLeave(this.currentParams,this.currentQuery,this);case 4:if(!p.beforeEnter){t.n=6;break}return t.n=5,p.beforeEnter(y,v,this);case 5:if(!1!==t.v){t.n=6;break}return console.log("Navigation cancelled by beforeEnter hook"),t.a(2);case 6:if(!p.onEnter){t.n=7;break}return t.n=7,p.onEnter(y,v,this);case 7:b=gd(this.components),this.currentRoute,w=xd({},this.currentParams),x=xd({},this.currentQuery),b.forEach(function(t){"FloatedCamera"!==t.constructor.name&&"Camera"!==t.constructor.name&&"Video"!==t.constructor.name&&"QRCodeReader"!==t.constructor.name||(t.stopCamera&&"function"==typeof t.stopCamera&&t.stopCamera(),t.destroy&&"function"==typeof t.destroy&&t.destroy())}),document.querySelectorAll("video").forEach(function(t){return t.remove()}),this.currentRoute=m,this.currentParams=y,this.currentQuery=v,i?(this.history[this.historyIndex]={path:e,params:y,query:v,state:f},window.history.replaceState({route:e,params:y,query:v,state:f},"",e)):(this.historyIndex++,this.history=this.history.slice(0,this.historyIndex),this.history.push({path:e,params:y,query:v,state:f}),window.history.pushState({route:e,params:y,query:v,state:f},"",e)),this.components=[],"function"==typeof p.component&&p.component(this,y,v),a&&!this.transitionState.isTransitioning&&(k=c||p.transition||"slide",this.startTransition(b,this.components,k,l)),p.afterEnter&&p.afterEnter(y,v,this),null!=g&&g.afterLeave&&(a&&this.transitionState.isTransitioning?setTimeout(function(){g.afterLeave(w,x,S)},this.transitionState.duration||300):g.afterLeave(w,x,this)),this._maxScrollDirty=!0;case 8:return t.a(2)}},t,this)}),r=function(){var t=this,e=arguments;return new Promise(function(r,i){var o=n.apply(t,e);function a(t){bd(o,r,i,a,s,"next",t)}function s(t){bd(o,r,i,a,s,"throw",t)}a(void 0)})},function(t){return r.apply(this,arguments)})},{key:"startTransition",value:function(t,e,n,r){this.transitionState={isTransitioning:!0,progress:0,duration:300,type:n,direction:r,oldComponents:gd(t),newComponents:gd(e),startTime:Date.now()}}},{key:"updateTransition",value:function(){var t=this;if(this.transitionState.isTransitioning){var e=Date.now()-this.transitionState.startTime;this.transitionState.progress=Math.min(e/this.transitionState.duration,1),this.transitionState.progress>=1&&(this.transitionState.isTransitioning=!1,this.transitionState.newComponents.forEach(function(e){t.markComponentDirty(e)}))}}},{key:"applyTransitionTransform",value:function(t){var e=this.transitionState,n=e.type,r=e.direction,i=e.oldComponents,o=e.newComponents,a="forward"===r?1:-1;switch(n){case"slide":this.ctx.save(),this.ctx.translate(-this.width*t*a,0),this.ctx.globalAlpha=1-.3*t;var s,l=Sd(i);try{for(l.s();!(s=l.n()).done;){var u=s.value;u.visible&&u.draw(this.ctx)}}catch(t){l.e(t)}finally{l.f()}this.ctx.restore(),this.ctx.save(),this.ctx.translate(this.width*(1-t)*a,0);var c,h=Sd(o);try{for(h.s();!(c=h.n()).done;){var f=c.value;f.visible&&f.draw(this.ctx)}}catch(t){h.e(t)}finally{h.f()}this.ctx.restore();break;case"fade":this.ctx.save(),this.ctx.globalAlpha=1-t;var d,p=Sd(i);try{for(p.s();!(d=p.n()).done;){var y=d.value;y.visible&&y.draw(this.ctx)}}catch(t){p.e(t)}finally{p.f()}this.ctx.restore(),this.ctx.save(),this.ctx.globalAlpha=t;var v,m=Sd(o);try{for(m.s();!(v=m.n()).done;){var g=v.value;g.visible&&g.draw(this.ctx)}}catch(t){m.e(t)}finally{m.f()}this.ctx.restore();break;case"none":var b,w=Sd(o);try{for(w.s();!(b=w.n()).done;){var x=b.value;x.visible&&x.draw(this.ctx)}}catch(t){w.e(t)}finally{w.f()}}}},{key:"easeInOutCubic",value:function(t){return t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2}},{key:"goBack",value:function(){if(this.historyIndex>0){this.historyIndex--;var t=this.history[this.historyIndex];this.navigateTo(t.path,{replace:!0,animate:!0,direction:"back"}),window.history.back()}}},{key:"goForward",value:function(){if(this.historyIndex<this.history.length-1){this.historyIndex++;var t=this.history[this.historyIndex];this.navigateTo(t.path,{replace:!0,animate:!0,direction:"forward"}),window.history.forward()}}},{key:"getParams",value:function(){return xd({},this.currentParams)}},{key:"getQuery",value:function(){return xd({},this.currentQuery)}},{key:"getParam",value:function(t){return this.currentParams[t]}},{key:"getQueryParam",value:function(t){return this.currentQuery[t]}},{key:"handleTouchStart",value:function(t){t.preventDefault(),this.isDragging=!1;var e=t.touches[0],n=this.getTouchPos(e);this.lastTouchY=n.y,this.scrollWorker.postMessage({type:"SET_DRAGGING",payload:{isDragging:!1,lastTouchY:this.lastTouchY}}),this.checkComponentsAtPosition(n.x,n.y,"start")}},{key:"handleTouchMove",value:function(t){t.preventDefault();var e=t.touches[0],n=this.getTouchPos(e);if(this.isDragging||Math.abs(n.y-this.lastTouchY)>5&&(this.isDragging=!0,this.scrollWorker.postMessage({type:"SET_DRAGGING",payload:{isDragging:!0,lastTouchY:this.lastTouchY}})),this.isDragging){var r=n.y-this.lastTouchY;this.scrollWorker.postMessage({type:"HANDLE_TOUCH_MOVE",payload:{deltaY:r}}),this.lastTouchY=n.y}else this.checkComponentsAtPosition(n.x,n.y,"move")}},{key:"handleTouchEnd",value:function(t){t.preventDefault();var e=t.changedTouches[0],n=this.getTouchPos(e);this.isDragging?(this.isDragging=!1,this.scrollWorker.postMessage({type:"SET_DRAGGING",payload:{isDragging:!1,lastVelocity:this.scrollVelocity}})):this.checkComponentsAtPosition(n.x,n.y,"end")}},{key:"handleMouseDown",value:function(t){this.isDragging=!1,this.lastTouchY=t.clientY,this.scrollWorker.postMessage({type:"SET_DRAGGING",payload:{isDragging:!1,lastTouchY:this.lastTouchY}}),this.checkComponentsAtPosition(t.clientX,t.clientY,"start")}},{key:"handleMouseMove",value:function(t){if(this.isDragging||Math.abs(t.clientY-this.lastTouchY)>5&&(this.isDragging=!0,this.scrollWorker.postMessage({type:"SET_DRAGGING",payload:{isDragging:!0,lastTouchY:this.lastTouchY}})),this.isDragging){var e=t.clientY-this.lastTouchY;this.scrollWorker.postMessage({type:"HANDLE_TOUCH_MOVE",payload:{deltaY:e}}),this.lastTouchY=t.clientY}else this.checkComponentsAtPosition(t.clientX,t.clientY,"move")}},{key:"handleMouseUp",value:function(t){this.isDragging?(this.isDragging=!1,this.scrollWorker.postMessage({type:"SET_DRAGGING",payload:{isDragging:!1,lastVelocity:this.scrollVelocity}})):this.checkComponentsAtPosition(t.clientX,t.clientY,"end")}},{key:"getTouchPos",value:function(t){var e=this.canvas.getBoundingClientRect();return{x:t.clientX-e.left,y:t.clientY-e.top}}},{key:"checkComponentsAtPosition",value:function(t,e,n){for(var r,i,o=function(t){return jd.has(t.constructor)},a=this.components.length-1;a>=0;a--){var s=this.components[a];if(s.visible){var l=o(s)?e:e-this.scrollOffset;if(s instanceof B&&s.clickableChildren&&s.children&&s.children.length>0&&s.isPointInside(t,l))for(var u=l-s.y-s.padding,c=t-s.x-s.padding,h=s.children.length-1;h>=0;h--){var f=s.children[h];if(f.visible&&u>=f.y&&u<=f.y+f.height&&c>=f.x&&c<=f.x+f.width){var d=c-f.x,p=u-f.y;switch(n){case"start":f.pressed=!0,f.onPress&&(null===(r=f.onPress)||void 0===r||r.call(f,d,p));break;case"move":f.hovered||(f.hovered=!0,f.onHover&&f.onHover()),f.onMove&&(null===(i=f.onMove)||void 0===i||i.call(f,d,p));break;case"end":if(f.pressed)if(f.pressed=!1,f instanceof k||f instanceof kn||f instanceof Bn||f instanceof Jn){var y,v=Sd(this.components);try{for(v.s();!(y=v.n()).done;){var m,g=y.value;(g instanceof k||g instanceof kn||g instanceof Bn||g instanceof Jn)&&g!==f&&g.focused&&(g.focused=!1,g.cursorVisible=!1,null===(m=g.onBlur)||void 0===m||m.call(g))}}catch(t){v.e(t)}finally{v.f()}f.focused=!0,f.cursorVisible=!0,f.onFocus&&f.onFocus()}else if(f.onClick)f.onClick();else if(f.onPress){var b;null===(b=f.onPress)||void 0===b||b.call(f,d,p)}}return}}if(s.isPointInside(t,l)){switch(n){case"start":s.pressed=!0,s.onPress&&s.onPress(t,l);break;case"move":s.hovered||(s.hovered=!0,s.onHover&&s.onHover()),s.onMove&&s.onMove(t,l);break;case"end":if(s.pressed)if(s.pressed=!1,s instanceof k||s instanceof kn||s instanceof Bn||s instanceof Jn){var w,x=Sd(this.components);try{for(x.s();!(w=x.n()).done;){var S,T=w.value;(T instanceof k||T instanceof kn||T instanceof Bn||T instanceof Jn)&&T!==s&&T.focused&&(T.focused=!1,T.cursorVisible=!1,null===(S=T.onBlur)||void 0===S||S.call(T))}}catch(t){x.e(t)}finally{x.f()}s.focused=!0,s.cursorVisible=!0,s.onFocus&&s.onFocus()}else s.onClick?s.onClick():s.onPress&&s.onPress(t,l)}return}s.hovered=!1}}}},{key:"getMaxScroll",value:function(){if(!this._maxScrollDirty&&void 0!==this._cachedMaxScroll)return this._cachedMaxScroll;var t,e=0,n=Sd(this.components);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(!this.isFixedComponent(r)&&r.visible){var i=r.y+r.height;i>e&&(e=i)}}}catch(t){n.e(t)}finally{n.f()}return Math.max(0,e-this.height+50)}},{key:"handleResize",value:function(){var t=this;this.resizeTimeout&&clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(function(){var e=window.innerWidth,n=window.innerHeight;Math.abs(e-t.width)<=8?console.log("[resize] Largeur identique → probablement clavier (open/close) → ignoré"):(console.log("[resize] Largeur changée → vrai resize"),t.width=e,t.height=n,t.setupCanvas(),t._maxScrollDirty=!0,t.scrollWorker&&t.scrollWorker.postMessage({type:"UPDATE_DIMENSIONS",payload:{height:t.height}}),t.components.forEach(function(e){var n;return null===(n=e.onResize)||void 0===n?void 0:n.call(e,t.width,t.height)}))},100)}},{key:"add",value:function(t){return this.components.push(t),t._mount(),this.updateScrollWorkerComponents(),t}},{key:"remove",value:function(t){var e=this.components.indexOf(t);e>-1&&(t._unmount(),this.components.splice(e,1),this.updateScrollWorkerComponents())}},{key:"markComponentDirty",value:function(t){t&&t.visible&&(this.optimizationEnabled&&this.dirtyComponents.add(t),void 0!==t._dirty&&(t._dirty=!0))}},{key:"enableOptimization",value:function(){this.optimizationEnabled=!0}},{key:"drawOverflowIndicators",value:function(){var t,e=this.ctx,n=Sd(this.components);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(r.visible){var i=this.isFixedComponent(r)?r.y:r.y+this.scrollOffset,o=r.x,a=r.width,s=r.height;if(r instanceof j&&r.text&&e.measureText)try{e.save(),r.fontSize&&(e.font="".concat(r.fontSize,"px ").concat(r.fontFamily||"Arial")),a=e.measureText(r.text).width+2*(r.padding||0),s=(r.fontSize||16)+2*(r.padding||0),e.restore()}catch(t){}var l=o,u=o+a,c=i,h=i+s,f={left:l<0,right:u>this.width,top:c<0,bottom:h>this.height};if(f.left||f.right||f.top||f.bottom){var d;if(this.debbug&&console.table({type:null===(d=r.constructor)||void 0===d?void 0:d.name,x:r.x,y:r.y,declaredSize:"".concat(r.width,"x").concat(r.height),actualSize:"".concat(a,"x").concat(s),screenPos:"(".concat(o,", ").concat(i,")"),overflow:f}),e.save(),e.strokeStyle="red",e.lineWidth=2,e.fillStyle="rgba(255, 0, 0, 0.2)",f.left){var p=Math.min(a,-l);e.fillRect(l,c,p,s),e.strokeRect(l,c,p,s)}if(f.right){Math.max(0,this.width-l);var y=Math.min(a,u-this.width);e.fillRect(this.width-y,c,y,s),e.strokeRect(this.width-y,c,y,s)}if(f.top){var v=Math.min(s,-c);e.fillRect(l,c,a,v),e.strokeRect(l,c,a,v)}if(f.bottom){Math.max(0,this.height-c);var m=Math.min(s,h-this.height);e.fillRect(l,this.height-m,a,m),e.strokeRect(l,this.height-m,a,m)}if(e.fillStyle="red",(f.left||f.top)&&e.fillRect(l,c,6,6),(f.right||f.top)&&e.fillRect(u-6,c,6,6),(f.left||f.bottom)&&e.fillRect(l,h-6,6,6),(f.right||f.bottom)&&e.fillRect(u-6,h-6,6,6),this.debbug&&r.text){e.fillStyle="red",e.font="10px monospace",e.textAlign="left";var g=[];f.left&&g.push("←"),f.right&&g.push("→"),f.top&&g.push("↑"),f.bottom&&g.push("↓"),g.length>0&&e.fillText('"'.concat(r.text.substring(0,10)).concat(r.text.length>10?"...":"",'" ').concat(g.join("")),l+5,c-5)}e.restore()}}}}catch(t){n.e(t)}finally{n.f()}}},{key:"startRenderLoop",value:function(){var t=this,e=(this.scrollOffset,function(){if(t._splashFinished){if(t.ctx.fillStyle=t.backgroundColor||"#ffffff",t.ctx.fillRect(0,0,t.width,t.height),t.transitionState.isTransitioning){var n=Date.now()-t.transitionState.startTime;t.transitionState.progress=Math.min(n/t.transitionState.duration,1),t.renderSimpleTransition(),t.transitionState.progress>=1&&(t.transitionState.isTransitioning=!1,t.transitionState.oldComponents=[])}else t.renderFull();t._frames++;var r=performance.now(),i=r-t._lastFpsTime;i>=1e3&&(t.fps=Math.round(1e3*t._frames/i),t._frames=0,t._lastFpsTime=r),t.showFps&&(t.ctx.save(),t.ctx.fillStyle="rgba(0, 0, 0, 0.7)",t.ctx.fillRect(10,10,100,40),t.ctx.fillStyle="#00ff00",t.ctx.font="bold 20px monospace",t.ctx.textAlign="left",t.ctx.textBaseline="top",t.ctx.fillText("FPS: ".concat(t.fps),20,20),t.ctx.restore()),Math.abs(t.scrollVelocity)>.1&&!t.isDragging&&t.scrollWorker.postMessage({type:"UPDATE_INERTIA"}),requestAnimationFrame(e)}else requestAnimationFrame(e)});e()}},{key:"renderSimpleTransition",value:function(){var t=this.transitionState,e=t.progress,n=t.type,r=t.direction,i=t.oldComponents,o=t.newComponents,a=this.easeInOutCubic(e),s="forward"===r?1:-1;if("slide"===n){this.ctx.save();var l=-this.width*a*s;this.ctx.translate(l,0),this.ctx.globalAlpha=1-.3*a;var u,c=Sd(i);try{for(c.s();!(u=c.n()).done;){var h=u.value;h&&h.visible&&(this.isFixedComponent(h)?h.draw(this.ctx):(this.ctx.save(),this.ctx.translate(0,0),h.draw(this.ctx),this.ctx.restore()))}}catch(t){c.e(t)}finally{c.f()}this.ctx.restore(),this.ctx.save();var f=this.width*(1-a)*s;this.ctx.translate(f,0);var d,p=Sd(o);try{for(p.s();!(d=p.n()).done;){var y=d.value;y&&y.visible&&(this.isFixedComponent(y)?y.draw(this.ctx):(this.ctx.save(),this.ctx.translate(0,0),y.draw(this.ctx),this.ctx.restore()))}}catch(t){p.e(t)}finally{p.f()}this.ctx.restore()}else if("fade"===n){this.ctx.save(),this.ctx.globalAlpha=1-a;var v,m=Sd(i);try{for(m.s();!(v=m.n()).done;){var g=v.value;g&&g.visible&&(this.isFixedComponent(g)?g.draw(this.ctx):(this.ctx.save(),this.ctx.translate(0,0),g.draw(this.ctx),this.ctx.restore()))}}catch(t){m.e(t)}finally{m.f()}this.ctx.restore(),this.ctx.save(),this.ctx.globalAlpha=a;var b,w=Sd(o);try{for(w.s();!(b=w.n()).done;){var x=b.value;x&&x.visible&&(this.isFixedComponent(x)?x.draw(this.ctx):(this.ctx.save(),this.ctx.translate(0,0),x.draw(this.ctx),this.ctx.restore()))}}catch(t){w.e(t)}finally{w.f()}this.ctx.restore()}else this.renderFull()}},{key:"renderFull",value:function(){this.ctx.save();var t,e=[],n=[],r=Sd(this.components);try{for(r.s();!(t=r.n()).done;){var i=t.value;this.isFixedComponent(i)?n.push(i):e.push(i)}}catch(t){r.e(t)}finally{r.f()}if(e.length>0){this.ctx.save(),this.ctx.translate(0,this.scrollOffset);var o,a=Sd(e);try{for(a.s();!(o=a.n()).done;){var s=o.value;if(s.visible){var l=s.y+this.scrollOffset;l+s.height>=-100&&l<=this.height+100&&s.draw(this.ctx)}}}catch(t){a.e(t)}finally{a.f()}this.ctx.restore()}for(var u=0,c=n;u<c.length;u++){var h=c[u];h.visible&&h.draw(this.ctx)}this.ctx.restore()}},{key:"scrollTo",value:function(t){var e=this;if(arguments.length>1&&void 0!==arguments[1]&&!arguments[1])this.scrollWorker.postMessage({type:"SET_SCROLL_OFFSET",payload:{scrollOffset:t}});else{var n=this.scrollOffset,r=t-n,i=performance.now(),o=function(t){var a=t-i,s=Math.min(a/300,1),l=e.easeOutCubic(s),u=n+r*l;e.scrollWorker.postMessage({type:"SET_SCROLL_OFFSET",payload:{scrollOffset:u}}),s<1&&requestAnimationFrame(o)};requestAnimationFrame(o)}}},{key:"easeOutCubic",value:function(t){return 1-Math.pow(1-t,3)}},{key:"destroy",value:function(){this.scrollWorker&&this.scrollWorker.terminate(),this.worker&&this.worker.terminate(),this.logicWorker&&this.logicWorker.terminate(),this.ctx&&"function"==typeof this.ctx.destroy&&this.ctx.destroy(),this.canvas.removeEventListener("touchstart",this.handleTouchStart),this.canvas.removeEventListener("touchmove",this.handleTouchMove),this.canvas.removeEventListener("touchend",this.handleTouchEnd),this.canvas.removeEventListener("mousedown",this.handleMouseDown),this.canvas.removeEventListener("mousemove",this.handleMouseMove),this.canvas.removeEventListener("mouseup",this.handleMouseUp),window.removeEventListener("resize",this.handleResize)}},{key:"displayMetrics",value:function(){var t=this.metrics;console.table({"⚙️ Initialisation Framework":"".concat(t.initTime.toFixed(2),"ms"),"🎨 Premier Rendu":"".concat(t.firstRenderTime.toFixed(2),"ms"),"🚀 Temps Total Startup":"".concat(t.totalStartupTime.toFixed(2),"ms"),"📊 FPS Actuel":this.fps})}},{key:"getMetrics",value:function(){return xd(xd({},this.metrics),{},{currentFPS:this.fps,componentsCount:this.components.length})}},{key:"isFixedComponent",value:function(t){return jd.has(t.constructor)}},{key:"showToast",value:function(t){var e=new Ie(this,{text:t,duration:arguments.length>1&&void 0!==arguments[1]?arguments[1]:3e3,x:this.width/2,y:this.height-100});this.add(e),e.show()}}],e&&Cd(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n,r}();function Fd(t){return Fd="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Fd(t)}function Rd(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Md(r.key),r)}}function Md(t){var e=function(t){if("object"!=Fd(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Fd(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Fd(e)?e:e+""}const Ad=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.state={},this.listeners=new Map,this.history=[],this.historyIndex=-1,this.maxHistory=50},e=[{key:"set",value:function(t,e){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=this.state[t];n&&r!==e&&this.addToHistory(t,r,e),this.state[t]=e,this.notify(t,e,r)}},{key:"get",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this.state.hasOwnProperty(t)?this.state[t]:e}},{key:"update",value:function(t){var e=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];Object.keys(t).forEach(function(r){e.set(r,t[r],n)})}},{key:"delete",value:function(t){var e=this.state[t];delete this.state[t],this.notify(t,void 0,e)}},{key:"subscribe",value:function(t,e){var n=this;return this.listeners.has(t)||this.listeners.set(t,[]),this.listeners.get(t).push(e),function(){var r=n.listeners.get(t),i=r.indexOf(e);i>-1&&r.splice(i,1)}}},{key:"notify",value:function(t,e,n){this.listeners.has(t)&&this.listeners.get(t).forEach(function(t){t(e,n)}),this.listeners.has("*")&&this.listeners.get("*").forEach(function(r){r(t,e,n)})}},{key:"addToHistory",value:function(t,e,n){this.history=this.history.slice(0,this.historyIndex+1),this.history.push({key:t,oldValue:e,newValue:n,timestamp:Date.now()}),this.history.length>this.maxHistory?this.history.shift():this.historyIndex++}},{key:"undo",value:function(){if(this.historyIndex>=0){var t=this.history[this.historyIndex],e=t.key,n=t.oldValue;return this.set(e,n,!1),this.historyIndex--,!0}return!1}},{key:"redo",value:function(){if(this.historyIndex<this.history.length-1){this.historyIndex++;var t=this.history[this.historyIndex],e=t.key,n=t.newValue;return this.set(e,n,!1),!0}return!1}},{key:"reset",value:function(){var t=this,e=Object.keys(this.state);this.state={},e.forEach(function(e){return t.notify(e,void 0)}),this.history=[],this.historyIndex=-1}},{key:"export",value:function(){return JSON.stringify(this.state)}},{key:"import",value:function(t){var e=this;try{var n=JSON.parse(t);return Object.keys(n).forEach(function(t){e.set(t,n[t],!1)}),!0}catch(t){return console.error("Error importing state:",t),!1}}}],e&&Rd(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function _d(t){return _d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_d(t)}function Dd(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function Bd(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Dd(Object(n),!0).forEach(function(e){Ld(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Dd(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function Ld(t,e,n){return(e=Hd(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Wd(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Hd(r.key),r)}}function Hd(t){var e=function(t){if("object"!=_d(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=_d(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==_d(e)?e:e+""}const zd=function(){return t=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"en";!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.locale=e,this.fallbackLocale="en",this.translations={},this.listeners=[]},e=[{key:"setLocale",value:function(t){return this.translations[t]?(this.locale=t,this.notifyListeners(),!0):(console.warn("Locale ".concat(t," not found")),!1)}},{key:"getLocale",value:function(){return this.locale}},{key:"addTranslations",value:function(t,e){this.translations[t]||(this.translations[t]={}),this.translations[t]=Bd(Bd({},this.translations[t]),e)}},{key:"t",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:null)||this.locale,r=this.getNestedValue(this.translations[n],t);return r||n===this.fallbackLocale||(r=this.getNestedValue(this.translations[this.fallbackLocale],t)),r?this.interpolate(r,e):(console.warn("Translation not found for key: ".concat(t)),t)}},{key:"getNestedValue",value:function(t,e){return e.split(".").reduce(function(t,e){return t?t[e]:void 0},t)}},{key:"interpolate",value:function(t,e){return t.replace(/\{\{(\w+)\}\}/g,function(t,n){return e.hasOwnProperty(n)?e[n]:t})}},{key:"plural",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r="".concat(t,1===e?".one":".other");return this.t(r,Bd(Bd({},n),{},{count:e}))}},{key:"formatDate",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"long",n={short:{year:"numeric",month:"2-digit",day:"2-digit"},long:{year:"numeric",month:"long",day:"numeric"},full:{weekday:"long",year:"numeric",month:"long",day:"numeric"}};return new Intl.DateTimeFormat(this.locale,n[e]||n.long).format(t)}},{key:"formatNumber",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Intl.NumberFormat(this.locale,e).format(t)}},{key:"formatCurrency",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"USD";return new Intl.NumberFormat(this.locale,{style:"currency",currency:e}).format(t)}},{key:"subscribe",value:function(t){var e=this;return this.listeners.push(t),function(){var n=e.listeners.indexOf(t);n>-1&&e.listeners.splice(n,1)}}},{key:"notifyListeners",value:function(){var t=this;this.listeners.forEach(function(e){return e(t.locale)})}},{key:"getAvailableLocales",value:function(){return Object.keys(this.translations)}}],e&&Wd(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function qd(t){return qd="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qd(t)}function Ud(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,u=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(t){u=!0,i=t}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}(t,e)||Gd(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Nd(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=Gd(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function Vd(t){return function(t){if(Array.isArray(t))return Yd(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Gd(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Gd(t,e){if(t){if("string"==typeof t)return Yd(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Yd(t,e):void 0}}function Yd(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Xd(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var l=r&&r.prototype instanceof s?r:s,u=Object.create(l.prototype);return Qd(u,"_invoke",function(n,r,i){var o,s,l,u=0,c=i||[],h=!1,f={p:0,n:0,v:t,a:d,f:d.bind(t,4),d:function(e,n){return o=e,s=0,l=t,f.n=n,a}};function d(n,r){for(s=n,l=r,e=0;!h&&u&&!i&&e<c.length;e++){var i,o=c[e],d=f.p,p=o[2];n>3?(i=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=t):o[0]<=d&&((i=n<2&&d<o[1])?(s=0,f.v=r,f.n=o[1]):d<p&&(i=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(i||n>1)return a;throw h=!0,r}return function(i,c,p){if(u>1)throw TypeError("Generator is already running");for(h&&1===c&&d(c,p),s=c,l=p;(e=s<2?t:l)||!h;){o||(s?s<3?(s>1&&(f.n=-1),d(s,l)):f.n=l:f.v=l);try{if(u=2,o){if(s||(i="next"),e=o[i]){if(!(e=e.call(o,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,s<2&&(s=0)}else 1===s&&(e=o.return)&&e.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+i+"' method"),s=1);o=t}else if((e=(h=f.n<0)?l:n.call(r,f))!==a)break}catch(e){o=t,s=1,l=e}finally{u=1}}return{value:e,done:h}}}(n,i,o),!0),u}var a={};function s(){}function l(){}function u(){}e=Object.getPrototypeOf;var c=[][r]?e(e([][r]())):(Qd(e={},r,function(){return this}),e),h=u.prototype=s.prototype=Object.create(c);function f(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,u):(t.__proto__=u,Qd(t,i,"GeneratorFunction")),t.prototype=Object.create(h),t}return l.prototype=u,Qd(h,"constructor",u),Qd(u,"constructor",l),l.displayName="GeneratorFunction",Qd(u,i,"GeneratorFunction"),Qd(h),Qd(h,i,"Generator"),Qd(h,r,function(){return this}),Qd(h,"toString",function(){return"[object Generator]"}),(Xd=function(){return{w:o,m:f}})()}function Qd(t,e,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(t){i=0}Qd=function(t,e,n,r){function o(e,n){Qd(t,e,function(t){return this._invoke(e,n,t)})}e?i?i(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(o("next",0),o("throw",1),o("return",2))},Qd(t,e,n,r)}function Kd(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function $d(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function a(t){Kd(o,r,i,a,s,"next",t)}function s(t){Kd(o,r,i,a,s,"throw",t)}a(void 0)})}}function Jd(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Zd(r.key),r)}}function Zd(t){var e=function(t){if("object"!=qd(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=qd(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==qd(e)?e:e+""}const tp=function(){return t=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"app_";!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.prefix=e,this.encryptionKey=null,this.memoryCache=new Map},e=[{key:"init",value:(l=$d(Xd().m(function t(e){var n,r,i,o;return Xd().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,n=new TextEncoder,r=n.encode(e),t.n=1,crypto.subtle.digest("SHA-256",r);case 1:return i=t.v,t.n=2,crypto.subtle.importKey("raw",i,{name:"AES-GCM"},!1,["encrypt","decrypt"]);case 2:return this.encryptionKey=t.v,t.a(2,!0);case 3:return t.p=3,o=t.v,console.error("Failed to initialize SecureStorage:",o),t.a(2,!1)}},t,this,[[0,3]])})),function(t){return l.apply(this,arguments)})},{key:"encrypt",value:(s=$d(Xd().m(function t(e){var n,r,i,o,a,s;return Xd().w(function(t){for(;;)switch(t.p=t.n){case 0:if(this.encryptionKey){t.n=1;break}throw new Error("SecureStorage not initialized. Call init() first.");case 1:return t.p=1,n=new TextEncoder,r=n.encode(JSON.stringify(e)),i=crypto.getRandomValues(new Uint8Array(12)),t.n=2,crypto.subtle.encrypt({name:"AES-GCM",iv:i},this.encryptionKey,r);case 2:return o=t.v,(a=new Uint8Array(i.length+o.byteLength)).set(i),a.set(new Uint8Array(o),i.length),t.a(2,btoa(String.fromCharCode.apply(String,Vd(a))));case 3:throw t.p=3,s=t.v,console.error("Encryption failed:",s),s;case 4:return t.a(2)}},t,this,[[1,3]])})),function(t){return s.apply(this,arguments)})},{key:"decrypt",value:(a=$d(Xd().m(function t(e){var n,r,i,o,a,s;return Xd().w(function(t){for(;;)switch(t.p=t.n){case 0:if(this.encryptionKey){t.n=1;break}throw new Error("SecureStorage not initialized. Call init() first.");case 1:return t.p=1,n=new Uint8Array(atob(e).split("").map(function(t){return t.charCodeAt(0)})),r=n.slice(0,12),i=n.slice(12),t.n=2,crypto.subtle.decrypt({name:"AES-GCM",iv:r},this.encryptionKey,i);case 2:return o=t.v,a=new TextDecoder,t.a(2,JSON.parse(a.decode(o)));case 3:throw t.p=3,s=t.v,console.error("Decryption failed:",s),s;case 4:return t.a(2)}},t,this,[[1,3]])})),function(t){return a.apply(this,arguments)})},{key:"setSecure",value:(o=$d(Xd().m(function t(e,n){var r,i;return Xd().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.encrypt(n);case 1:return r=t.v,localStorage.setItem(this.prefix+e,r),this.memoryCache.set(e,n),t.a(2,!0);case 2:return t.p=2,i=t.v,console.error("Failed to save secure data:",i),t.a(2,!1)}},t,this,[[0,2]])})),function(t,e){return o.apply(this,arguments)})},{key:"getSecure",value:(i=$d(Xd().m(function t(e){var n,r,i,o,a=arguments;return Xd().w(function(t){for(;;)switch(t.p=t.n){case 0:if(n=a.length>1&&void 0!==a[1]?a[1]:null,t.p=1,!this.memoryCache.has(e)){t.n=2;break}return t.a(2,this.memoryCache.get(e));case 2:if(r=localStorage.getItem(this.prefix+e)){t.n=3;break}return t.a(2,n);case 3:return t.n=4,this.decrypt(r);case 4:return i=t.v,this.memoryCache.set(e,i),t.a(2,i);case 5:return t.p=5,o=t.v,console.error("Failed to get secure data:",o),t.a(2,n)}},t,this,[[1,5]])})),function(t){return i.apply(this,arguments)})},{key:"set",value:function(t,e){try{return localStorage.setItem(this.prefix+t,JSON.stringify(e)),!0}catch(t){return console.error("Failed to save data:",t),!1}}},{key:"get",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;try{var n=localStorage.getItem(this.prefix+t);return n?JSON.parse(n):e}catch(t){return console.error("Failed to get data:",t),e}}},{key:"remove",value:function(t){localStorage.removeItem(this.prefix+t),this.memoryCache.delete(t)}},{key:"has",value:function(t){return null!==localStorage.getItem(this.prefix+t)}},{key:"clearCache",value:function(){this.memoryCache.clear()}},{key:"clear",value:function(){var t=this;Object.keys(localStorage).forEach(function(e){e.startsWith(t.prefix)&&localStorage.removeItem(e)}),this.clearCache()}},{key:"keys",value:function(){var t=this;return Object.keys(localStorage).filter(function(e){return e.startsWith(t.prefix)}).map(function(e){return e.substring(t.prefix.length)})}},{key:"exportSecure",value:(r=$d(Xd().m(function t(){var e,n,r,i,o,a;return Xd().w(function(t){for(;;)switch(t.p=t.n){case 0:e={},n=this.keys(),r=Nd(n),t.p=1,r.s();case 2:if((i=r.n()).done){t.n=5;break}return o=i.value,t.n=3,this.getSecure(o);case 3:e[o]=t.v;case 4:t.n=2;break;case 5:t.n=7;break;case 6:t.p=6,a=t.v,r.e(a);case 7:return t.p=7,r.f(),t.f(7);case 8:return t.n=9,this.encrypt(e);case 9:return t.a(2,t.v)}},t,this,[[1,6,7,8]])})),function(){return r.apply(this,arguments)})},{key:"importSecure",value:(n=$d(Xd().m(function t(e){var n,r,i,o,a,s,l;return Xd().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.decrypt(e);case 1:n=t.v,r=0,i=Object.entries(n);case 2:if(!(r<i.length)){t.n=4;break}return o=Ud(i[r],2),a=o[0],s=o[1],t.n=3,this.setSecure(a,s);case 3:r++,t.n=2;break;case 4:return t.a(2,!0);case 5:return t.p=5,l=t.v,console.error("Failed to import data:",l),t.a(2,!1)}},t,this,[[0,5]])})),function(t){return n.apply(this,arguments)})}],e&&Jd(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n,r,i,o,a,s,l}();function ep(t){return ep="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ep(t)}function np(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var l=r&&r.prototype instanceof s?r:s,u=Object.create(l.prototype);return rp(u,"_invoke",function(n,r,i){var o,s,l,u=0,c=i||[],h=!1,f={p:0,n:0,v:t,a:d,f:d.bind(t,4),d:function(e,n){return o=e,s=0,l=t,f.n=n,a}};function d(n,r){for(s=n,l=r,e=0;!h&&u&&!i&&e<c.length;e++){var i,o=c[e],d=f.p,p=o[2];n>3?(i=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=t):o[0]<=d&&((i=n<2&&d<o[1])?(s=0,f.v=r,f.n=o[1]):d<p&&(i=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(i||n>1)return a;throw h=!0,r}return function(i,c,p){if(u>1)throw TypeError("Generator is already running");for(h&&1===c&&d(c,p),s=c,l=p;(e=s<2?t:l)||!h;){o||(s?s<3?(s>1&&(f.n=-1),d(s,l)):f.n=l:f.v=l);try{if(u=2,o){if(s||(i="next"),e=o[i]){if(!(e=e.call(o,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,s<2&&(s=0)}else 1===s&&(e=o.return)&&e.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+i+"' method"),s=1);o=t}else if((e=(h=f.n<0)?l:n.call(r,f))!==a)break}catch(e){o=t,s=1,l=e}finally{u=1}}return{value:e,done:h}}}(n,i,o),!0),u}var a={};function s(){}function l(){}function u(){}e=Object.getPrototypeOf;var c=[][r]?e(e([][r]())):(rp(e={},r,function(){return this}),e),h=u.prototype=s.prototype=Object.create(c);function f(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,u):(t.__proto__=u,rp(t,i,"GeneratorFunction")),t.prototype=Object.create(h),t}return l.prototype=u,rp(h,"constructor",u),rp(u,"constructor",l),l.displayName="GeneratorFunction",rp(u,i,"GeneratorFunction"),rp(h),rp(h,i,"Generator"),rp(h,r,function(){return this}),rp(h,"toString",function(){return"[object Generator]"}),(np=function(){return{w:o,m:f}})()}function rp(t,e,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(t){i=0}rp=function(t,e,n,r){function o(e,n){rp(t,e,function(t){return this._invoke(e,n,t)})}e?i?i(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(o("next",0),o("throw",1),o("return",2))},rp(t,e,n,r)}function ip(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function op(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function a(t){ip(o,r,i,a,s,"next",t)}function s(t){ip(o,r,i,a,s,"throw",t)}a(void 0)})}}function ap(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,sp(r.key),r)}}function sp(t){var e=function(t){if("object"!=ep(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ep(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ep(e)?e:e+""}var lp=function(){return t=function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.dbName=e,this.version=n,this.db=null,this.stores=new Map},e=[{key:"init",value:(d=op(np().m(function t(e){var n=this;return np().w(function(t){for(;;)if(0===t.n)return t.a(2,new Promise(function(t,r){var i=indexedDB.open(n.dbName,n.version);i.onerror=function(){return r(i.error)},i.onsuccess=function(){n.db=i.result,t(n)},i.onupgradeneeded=function(t){var n=t.target.result;for(var r in e){var i=e[r];if(!n.objectStoreNames.contains(r)){var o=n.createObjectStore(r,{keyPath:i.keyPath||"id",autoIncrement:i.autoIncrement||!1});if(i.indexes)for(var a in i.indexes){var s=i.indexes[a];o.createIndex(a,s.keyPath||a,{unique:s.unique||!1})}}}}}))},t)})),function(t){return d.apply(this,arguments)})},{key:"add",value:(f=op(np().m(function t(e,n){var r=this;return np().w(function(t){for(;;)if(0===t.n)return t.a(2,new Promise(function(t,i){var o=r.db.transaction([e],"readwrite").objectStore(e).add(n);o.onsuccess=function(){return t(o.result)},o.onerror=function(){return i(o.error)}}))},t)})),function(t,e){return f.apply(this,arguments)})},{key:"put",value:(h=op(np().m(function t(e,n){var r=this;return np().w(function(t){for(;;)if(0===t.n)return t.a(2,new Promise(function(t,i){var o=r.db.transaction([e],"readwrite").objectStore(e).put(n);o.onsuccess=function(){return t(o.result)},o.onerror=function(){return i(o.error)}}))},t)})),function(t,e){return h.apply(this,arguments)})},{key:"get",value:function(){var t=op(np().m(function t(e,n){var r=this;return np().w(function(t){for(;;)if(0===t.n)return t.a(2,new Promise(function(t,i){var o=r.db.transaction([e],"readonly").objectStore(e).get(n);o.onsuccess=function(){return t(o.result)},o.onerror=function(){return i(o.error)}}))},t)}));return function(e,n){return t.apply(this,arguments)}}()},{key:"getAll",value:(c=op(np().m(function t(e){var n=this;return np().w(function(t){for(;;)if(0===t.n)return t.a(2,new Promise(function(t,r){var i=n.db.transaction([e],"readonly").objectStore(e).getAll();i.onsuccess=function(){return t(i.result)},i.onerror=function(){return r(i.error)}}))},t)})),function(t){return c.apply(this,arguments)})},{key:"getByIndex",value:(u=op(np().m(function t(e,n,r){var i=this;return np().w(function(t){for(;;)if(0===t.n)return t.a(2,new Promise(function(t,o){var a=i.db.transaction([e],"readonly").objectStore(e).index(n).getAll(r);a.onsuccess=function(){return t(a.result)},a.onerror=function(){return o(a.error)}}))},t)})),function(t,e,n){return u.apply(this,arguments)})},{key:"query",value:(l=op(np().m(function t(e,n){var r;return np().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this.getAll(e);case 1:return r=t.v,t.a(2,r.filter(n))}},t,this)})),function(t,e){return l.apply(this,arguments)})},{key:"delete",value:(s=op(np().m(function t(e,n){var r=this;return np().w(function(t){for(;;)if(0===t.n)return t.a(2,new Promise(function(t,i){var o=r.db.transaction([e],"readwrite").objectStore(e).delete(n);o.onsuccess=function(){return t()},o.onerror=function(){return i(o.error)}}))},t)})),function(t,e){return s.apply(this,arguments)})},{key:"clear",value:(a=op(np().m(function t(e){var n=this;return np().w(function(t){for(;;)if(0===t.n)return t.a(2,new Promise(function(t,r){var i=n.db.transaction([e],"readwrite").objectStore(e).clear();i.onsuccess=function(){return t()},i.onerror=function(){return r(i.error)}}))},t)})),function(t){return a.apply(this,arguments)})},{key:"count",value:(o=op(np().m(function t(e){var n=this;return np().w(function(t){for(;;)if(0===t.n)return t.a(2,new Promise(function(t,r){var i=n.db.transaction([e],"readonly").objectStore(e).count();i.onsuccess=function(){return t(i.result)},i.onerror=function(){return r(i.error)}}))},t)})),function(t){return o.apply(this,arguments)})},{key:"bulkAdd",value:(i=op(np().m(function t(e,n){var r=this;return np().w(function(t){for(;;)if(0===t.n)return t.a(2,new Promise(function(t,i){var o=r.db.transaction([e],"readwrite"),a=o.objectStore(e);n.forEach(function(t){return a.add(t)}),o.oncomplete=function(){return t()},o.onerror=function(){return i(o.error)}}))},t)})),function(t,e){return i.apply(this,arguments)})},{key:"bulkDelete",value:(r=op(np().m(function t(e,n){var r=this;return np().w(function(t){for(;;)if(0===t.n)return t.a(2,new Promise(function(t,i){var o=r.db.transaction([e],"readwrite"),a=o.objectStore(e);n.forEach(function(t){return a.delete(t)}),o.oncomplete=function(){return t()},o.onerror=function(){return i(o.error)}}))},t)})),function(t,e){return r.apply(this,arguments)})},{key:"close",value:function(){this.db&&(this.db.close(),this.db=null)}},{key:"destroy",value:(n=op(np().m(function t(){var e=this;return np().w(function(t){for(;;)if(0===t.n)return this.close(),t.a(2,new Promise(function(t,n){var r=indexedDB.deleteDatabase(e.dbName);r.onsuccess=function(){return t()},r.onerror=function(){return n(r.error)}}))},t,this)})),function(){return n.apply(this,arguments)})}],e&&ap(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n,r,i,o,a,s,l,u,c,h,f,d}();const up=lp;function cp(t){return cp="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},cp(t)}function hp(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=dp(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function fp(t){return function(t){if(Array.isArray(t))return pp(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||dp(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function dp(t,e){if(t){if("string"==typeof t)return pp(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?pp(t,e):void 0}}function pp(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function yp(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,vp(r.key),r)}}function vp(t){var e=function(t){if("object"!=cp(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=cp(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==cp(e)?e:e+""}const mp=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.data=e,this.filters=[],this.sorts=[],this.offset=0,this.limit=null,this.grouped=null}return e=t,n=[{key:"where",value:function(t,e){return this.filters.push({type:"equals",field:t,value:e}),this}},{key:"whereNot",value:function(t,e){return this.filters.push({type:"not",field:t,value:e}),this}},{key:"whereOperator",value:function(t,e,n){return this.filters.push({type:"operator",field:t,operator:e,value:n}),this}},{key:"whereIn",value:function(t,e){return this.filters.push({type:"in",field:t,values:e}),this}},{key:"whereNotIn",value:function(t,e){return this.filters.push({type:"notIn",field:t,values:e}),this}},{key:"whereCustom",value:function(t){return this.filters.push({type:"custom",predicate:t}),this}},{key:"whereNull",value:function(t){return this.filters.push({type:"null",field:t}),this}},{key:"whereNotNull",value:function(t){return this.filters.push({type:"notNull",field:t}),this}},{key:"search",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.filters.push({type:"search",field:t,search:e,caseSensitive:n}),this}},{key:"orderBy",value:function(t){return this.sorts.push({field:t,direction:"asc"}),this}},{key:"orderByDesc",value:function(t){return this.sorts.push({field:t,direction:"desc"}),this}},{key:"orderByCustom",value:function(t){return this.sorts.push({type:"custom",compareFn:t}),this}},{key:"take",value:function(t){return this.limit=t,this}},{key:"skip",value:function(t){return this.offset=t,this}},{key:"paginate",value:function(t,e){return this.offset=(t-1)*e,this.limit=e,this}},{key:"groupBy",value:function(t){return this.grouped=t,this}},{key:"applyFilters",value:function(t){var e,n=this,r=fp(t),i=hp(this.filters);try{var o=function(){var t=e.value;r=r.filter(function(e){switch(t.type){case"equals":return e[t.field]===t.value;case"not":return e[t.field]!==t.value;case"operator":return n.applyOperator(e[t.field],t.operator,t.value);case"in":return t.values.includes(e[t.field]);case"notIn":return!t.values.includes(e[t.field]);case"null":return null==e[t.field];case"notNull":return null!=e[t.field];case"search":var r=String(e[t.field]),i=t.search;return t.caseSensitive?r.includes(i):r.toLowerCase().includes(i.toLowerCase());case"custom":return t.predicate(e);default:return!0}})};for(i.s();!(e=i.n()).done;)o()}catch(t){i.e(t)}finally{i.f()}return r}},{key:"applyOperator",value:function(t,e,n){switch(e){case">":return t>n;case"<":return t<n;case">=":return t>=n;case"<=":return t<=n;case"contains":return String(t).includes(n);case"startsWith":return String(t).startsWith(n);case"endsWith":return String(t).endsWith(n);default:return!1}}},{key:"applySorts",value:function(t){var e=this;return 0===this.sorts.length?t:fp(t).sort(function(t,n){var r,i=hp(e.sorts);try{for(i.s();!(r=i.n()).done;){var o=r.value;if("custom"===o.type)return o.compareFn(t,n);var a=t[o.field],s=n[o.field],l=0;if(null!=a||null!=s){if(null==a)return 1;if(null==s)return-1;if(0!==(l="number"==typeof a&&"number"==typeof s?a-s:String(a).localeCompare(String(s))))return"asc"===o.direction?l:-l}}}catch(t){i.e(t)}finally{i.f()}return 0})}},{key:"applyPagination",value:function(t){var e=this.offset,n=this.limit?e+this.limit:t.length;return t.slice(e,n)}},{key:"applyGrouping",value:function(t){var e,n={},r=hp(t);try{for(r.s();!(e=r.n()).done;){var i=e.value,o=i[this.grouped];n[o]||(n[o]=[]),n[o].push(i)}}catch(t){r.e(t)}finally{r.f()}return n}},{key:"get",value:function(){var t=this.applyFilters(this.data);return t=this.applySorts(t),this.grouped?this.applyGrouping(t):t=this.applyPagination(t)}},{key:"first",value:function(){var t=this.take(1).get();return t.length>0?t[0]:null}},{key:"count",value:function(){return this.applyFilters(this.data).length}},{key:"exists",value:function(){return this.count()>0}},{key:"pluck",value:function(t){return this.get().map(function(e){return e[t]})}},{key:"unique",value:function(t){return fp(new Set(this.pluck(t)))}},{key:"sum",value:function(t){return this.get().reduce(function(e,n){return e+(Number(n[t])||0)},0)}},{key:"avg",value:function(t){var e=this.get();return e.length>0?this.sum(t)/e.length:0}},{key:"min",value:function(t){var e=this.pluck(t).filter(function(t){return null!=t});return e.length>0?Math.min.apply(Math,fp(e)):null}},{key:"max",value:function(t){var e=this.pluck(t).filter(function(t){return null!=t});return e.length>0?Math.max.apply(Math,fp(e)):null}},{key:"clone",value:function(){var e=new t(this.data);return e.filters=fp(this.filters),e.sorts=fp(this.sorts),e.offset=this.offset,e.limit=this.limit,e.grouped=this.grouped,e}},{key:"reset",value:function(){return this.filters=[],this.sorts=[],this.offset=0,this.limit=null,this.grouped=null,this}}],r=[{key:"from",value:function(e){return new t(e)}}],n&&yp(e.prototype,n),r&&yp(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,r}();function gp(t){return gp="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gp(t)}function bp(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return wp(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?wp(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function wp(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function xp(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var l=r&&r.prototype instanceof s?r:s,u=Object.create(l.prototype);return kp(u,"_invoke",function(n,r,i){var o,s,l,u=0,c=i||[],h=!1,f={p:0,n:0,v:t,a:d,f:d.bind(t,4),d:function(e,n){return o=e,s=0,l=t,f.n=n,a}};function d(n,r){for(s=n,l=r,e=0;!h&&u&&!i&&e<c.length;e++){var i,o=c[e],d=f.p,p=o[2];n>3?(i=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=t):o[0]<=d&&((i=n<2&&d<o[1])?(s=0,f.v=r,f.n=o[1]):d<p&&(i=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(i||n>1)return a;throw h=!0,r}return function(i,c,p){if(u>1)throw TypeError("Generator is already running");for(h&&1===c&&d(c,p),s=c,l=p;(e=s<2?t:l)||!h;){o||(s?s<3?(s>1&&(f.n=-1),d(s,l)):f.n=l:f.v=l);try{if(u=2,o){if(s||(i="next"),e=o[i]){if(!(e=e.call(o,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,s<2&&(s=0)}else 1===s&&(e=o.return)&&e.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+i+"' method"),s=1);o=t}else if((e=(h=f.n<0)?l:n.call(r,f))!==a)break}catch(e){o=t,s=1,l=e}finally{u=1}}return{value:e,done:h}}}(n,i,o),!0),u}var a={};function s(){}function l(){}function u(){}e=Object.getPrototypeOf;var c=[][r]?e(e([][r]())):(kp(e={},r,function(){return this}),e),h=u.prototype=s.prototype=Object.create(c);function f(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,u):(t.__proto__=u,kp(t,i,"GeneratorFunction")),t.prototype=Object.create(h),t}return l.prototype=u,kp(h,"constructor",u),kp(u,"constructor",l),l.displayName="GeneratorFunction",kp(u,i,"GeneratorFunction"),kp(h),kp(h,i,"Generator"),kp(h,r,function(){return this}),kp(h,"toString",function(){return"[object Generator]"}),(xp=function(){return{w:o,m:f}})()}function kp(t,e,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(t){i=0}kp=function(t,e,n,r){function o(e,n){kp(t,e,function(t){return this._invoke(e,n,t)})}e?i?i(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(o("next",0),o("throw",1),o("return",2))},kp(t,e,n,r)}function Sp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function Tp(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Sp(Object(n),!0).forEach(function(e){Pp(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Sp(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function Pp(t,e,n){return(e=jp(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Op(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function Cp(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function a(t){Op(o,r,i,a,s,"next",t)}function s(t){Op(o,r,i,a,s,"throw",t)}a(void 0)})}}function Ep(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,jp(r.key),r)}}function jp(t){var e=function(t){if("object"!=gp(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=gp(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==gp(e)?e:e+""}const Ip=function(){return t=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.storageKey=e.storageKey||"offline_queue",this.retryDelay=e.retryDelay||5e3,this.maxRetries=e.maxRetries||3,this.queue=[],this.isOnline=navigator.onLine,this.syncHandlers=new Map,this.isSyncing=!1,this.loadQueue(),this.setupConnectionListeners()},e=[{key:"setupConnectionListeners",value:function(){var t=this;window.addEventListener("online",function(){console.log("🟢 Connection restored"),t.isOnline=!0,t.syncAll()}),window.addEventListener("offline",function(){console.log("🔴 Connection lost"),t.isOnline=!1})}},{key:"registerSyncHandler",value:function(t,e){this.syncHandlers.set(t,e)}},{key:"queue",value:(o=Cp(xp().m(function t(e,n){var r,i,o,a,s=arguments;return xp().w(function(t){for(;;)switch(t.p=t.n){case 0:if(r=s.length>2&&void 0!==s[2]?s[2]:{},i=Tp({id:this.generateId(),type:e,data:n,timestamp:Date.now(),retries:0,status:"pending"},r),!this.isOnline||r.forceQueue){t.n=4;break}return t.p=1,t.n=2,this.executeOperation(i);case 2:return o=t.v,t.a(2,o);case 3:t.p=3,a=t.v,console.warn("Failed to execute immediately, queuing...",a);case 4:return this.queue.push(i),this.saveQueue(),console.log("📋 Operation queued: ".concat(e),i.id),this.isOnline&&this.syncAll(),t.a(2,i)}},t,this,[[1,3]])})),function(t,e){return o.apply(this,arguments)})},{key:"executeOperation",value:(i=Cp(xp().m(function t(e){var n;return xp().w(function(t){for(;;)switch(t.n){case 0:if(n=this.syncHandlers.get(e.type)){t.n=1;break}throw new Error("No sync handler for type: ".concat(e.type));case 1:return t.n=2,n(e.data);case 2:return t.a(2,t.v)}},t,this)})),function(t){return i.apply(this,arguments)})},{key:"syncAll",value:(r=Cp(xp().m(function t(){var e,n,r,i,o,a=this;return xp().w(function(t){for(;;)switch(t.p=t.n){case 0:if(!this.isSyncing&&this.isOnline){t.n=1;break}return t.a(2);case 1:this.isSyncing=!0,console.log("🔄 Starting sync...",this.queue.length,"operations"),e={success:[],failed:[],skipped:[]},this.queue.sort(function(t,e){return t.timestamp-e.timestamp}),n=0;case 2:if(!(n<this.queue.length)){t.n=7;break}if("success"!==(r=this.queue[n]).status){t.n=3;break}return e.skipped.push(r),t.a(3,6);case 3:return t.p=3,console.log("⏳ Syncing: ".concat(r.type),r.id),t.n=4,this.executeOperation(r);case 4:i=t.v,r.status="success",r.result=i,r.syncedAt=Date.now(),e.success.push(r),console.log("✅ Synced: ".concat(r.type),r.id),t.n=6;break;case 5:t.p=5,o=t.v,r.retries++,r.lastError=o.message,r.retries>=this.maxRetries?(r.status="failed",e.failed.push(r),console.error("❌ Failed permanently: ".concat(r.type),r.id)):(r.status="pending",console.warn("⚠️ Retry ".concat(r.retries,"/").concat(this.maxRetries,":"),r.type));case 6:n++,t.n=2;break;case 7:return this.queue=this.queue.filter(function(t){return"success"!==t.status}),this.saveQueue(),this.isSyncing=!1,console.log("✅ Sync complete:",e),(e.failed.length>0||this.queue.length>0)&&setTimeout(function(){return a.syncAll()},this.retryDelay),t.a(2,e)}},t,this,[[3,5]])})),function(){return r.apply(this,arguments)})},{key:"syncType",value:(n=Cp(xp().m(function t(e){var n,r,i,o,a,s,l,u;return xp().w(function(t){for(;;)switch(t.p=t.n){case 0:n=this.queue.filter(function(t){return t.type===e&&"success"!==t.status}),r={success:[],failed:[]},i=bp(n),t.p=1,i.s();case 2:if((o=i.n()).done){t.n=7;break}return a=o.value,t.p=3,t.n=4,this.executeOperation(a);case 4:s=t.v,a.status="success",a.result=s,r.success.push(a),t.n=6;break;case 5:t.p=5,l=t.v,a.retries++,a.lastError=l.message,a.retries>=this.maxRetries&&(a.status="failed",r.failed.push(a));case 6:t.n=2;break;case 7:t.n=9;break;case 8:t.p=8,u=t.v,i.e(u);case 9:return t.p=9,i.f(),t.f(9);case 10:return this.queue=this.queue.filter(function(t){return"success"!==t.status}),this.saveQueue(),t.a(2,r)}},t,this,[[3,5],[1,8,9,10]])})),function(t){return n.apply(this,arguments)})},{key:"getPending",value:function(t){return t?this.queue.filter(function(e){return e.type===t&&"pending"===e.status}):this.queue.filter(function(t){return"pending"===t.status})}},{key:"getFailed",value:function(){return this.queue.filter(function(t){return"failed"===t.status})}},{key:"remove",value:function(t){var e=this.queue.findIndex(function(e){return e.id===t});return e>-1&&(this.queue.splice(e,1),this.saveQueue(),!0)}},{key:"retry",value:function(t){var e=this.queue.find(function(e){return e.id===t});e&&(e.status="pending",e.retries=0,e.lastError=null,this.saveQueue(),this.isOnline&&this.syncAll())}},{key:"clear",value:function(){this.queue=[],this.saveQueue()}},{key:"saveQueue",value:function(){try{localStorage.setItem(this.storageKey,JSON.stringify(this.queue))}catch(t){console.error("Failed to save queue:",t)}}},{key:"loadQueue",value:function(){try{var t=localStorage.getItem(this.storageKey);t&&(this.queue=JSON.parse(t),console.log("📋 Loaded queue:",this.queue.length,"operations"))}catch(t){console.error("Failed to load queue:",t),this.queue=[]}}},{key:"generateId",value:function(){return"".concat(Date.now(),"-").concat(Math.random().toString(36).substr(2,9))}},{key:"getStats",value:function(){return{total:this.queue.length,pending:this.queue.filter(function(t){return"pending"===t.status}).length,failed:this.queue.filter(function(t){return"failed"===t.status}).length,isOnline:this.isOnline,isSyncing:this.isSyncing}}}],e&&Ep(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n,r,i,o}();function Fp(t){return Fp="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Fp(t)}function Rp(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function Mp(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Rp(Object(n),!0).forEach(function(e){Ap(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Rp(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function Ap(t,e,n){return(e=Hp(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _p(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var l=r&&r.prototype instanceof s?r:s,u=Object.create(l.prototype);return Dp(u,"_invoke",function(n,r,i){var o,s,l,u=0,c=i||[],h=!1,f={p:0,n:0,v:t,a:d,f:d.bind(t,4),d:function(e,n){return o=e,s=0,l=t,f.n=n,a}};function d(n,r){for(s=n,l=r,e=0;!h&&u&&!i&&e<c.length;e++){var i,o=c[e],d=f.p,p=o[2];n>3?(i=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=t):o[0]<=d&&((i=n<2&&d<o[1])?(s=0,f.v=r,f.n=o[1]):d<p&&(i=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(i||n>1)return a;throw h=!0,r}return function(i,c,p){if(u>1)throw TypeError("Generator is already running");for(h&&1===c&&d(c,p),s=c,l=p;(e=s<2?t:l)||!h;){o||(s?s<3?(s>1&&(f.n=-1),d(s,l)):f.n=l:f.v=l);try{if(u=2,o){if(s||(i="next"),e=o[i]){if(!(e=e.call(o,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,s<2&&(s=0)}else 1===s&&(e=o.return)&&e.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+i+"' method"),s=1);o=t}else if((e=(h=f.n<0)?l:n.call(r,f))!==a)break}catch(e){o=t,s=1,l=e}finally{u=1}}return{value:e,done:h}}}(n,i,o),!0),u}var a={};function s(){}function l(){}function u(){}e=Object.getPrototypeOf;var c=[][r]?e(e([][r]())):(Dp(e={},r,function(){return this}),e),h=u.prototype=s.prototype=Object.create(c);function f(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,u):(t.__proto__=u,Dp(t,i,"GeneratorFunction")),t.prototype=Object.create(h),t}return l.prototype=u,Dp(h,"constructor",u),Dp(u,"constructor",l),l.displayName="GeneratorFunction",Dp(u,i,"GeneratorFunction"),Dp(h),Dp(h,i,"Generator"),Dp(h,r,function(){return this}),Dp(h,"toString",function(){return"[object Generator]"}),(_p=function(){return{w:o,m:f}})()}function Dp(t,e,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(t){i=0}Dp=function(t,e,n,r){function o(e,n){Dp(t,e,function(t){return this._invoke(e,n,t)})}e?i?i(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(o("next",0),o("throw",1),o("return",2))},Dp(t,e,n,r)}function Bp(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function Lp(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function a(t){Bp(o,r,i,a,s,"next",t)}function s(t){Bp(o,r,i,a,s,"throw",t)}a(void 0)})}}function Wp(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Hp(r.key),r)}}function Hp(t){var e=function(t){if("object"!=Fp(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Fp(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Fp(e)?e:e+""}var zp=function(){return t=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.defaultHeaders=e.defaultHeaders||{"Content-Type":"application/json"},this.defaultTTL=e.defaultTTL||0,this.cache=new Map},e=[{key:"get",value:function(){var t=Lp(_p().m(function t(e){var n,r,i,o,a,s=arguments;return _p().w(function(t){for(;;)switch(t.n){case 0:if(r=null!==(n=(s.length>1&&void 0!==s[1]?s[1]:{}).ttl)&&void 0!==n?n:this.defaultTTL,!(i=this.cache.get(e))||!(0===r||i.expiresAt>Date.now())){t.n=1;break}return t.a(2,i.data);case 1:return t.n=2,fetch(e,{method:"GET",headers:this.defaultHeaders});case 2:if((o=t.v).ok){t.n=3;break}throw new Error("Fetch error ".concat(o.status,": ").concat(o.statusText));case 3:return t.n=4,o.json();case 4:return a=t.v,r>0&&this.cache.set(e,{data:a,expiresAt:Date.now()+r}),t.a(2,a)}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"post",value:(n=Lp(_p().m(function t(e,n){var r,i,o=arguments;return _p().w(function(t){for(;;)switch(t.n){case 0:return r=o.length>2&&void 0!==o[2]?o[2]:{},t.n=1,fetch(e,{method:"POST",headers:Mp(Mp({},this.defaultHeaders),r.headers||{}),body:JSON.stringify(n)});case 1:if((i=t.v).ok){t.n=2;break}throw new Error("Fetch error ".concat(i.status,": ").concat(i.statusText));case 2:return t.a(2,i.json())}},t,this)})),function(t,e){return n.apply(this,arguments)})},{key:"clearCache",value:function(){this.cache.clear()}}],e&&Wp(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();const qp=zp;function Up(t){return Up="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Up(t)}function Np(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Vp(r.key),r)}}function Vp(t){var e=function(t){if("object"!=Up(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Up(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Up(e)?e:e+""}const Gp=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.watchId=null},e=[{key:"getCurrentPosition",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Promise(function(e,n){if(!navigator.geolocation)return n(new Error("Geolocation not supported"));navigator.geolocation.getCurrentPosition(function(t){return e({latitude:t.coords.latitude,longitude:t.coords.longitude,accuracy:t.coords.accuracy})},n,t)})}},{key:"watchPosition",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};navigator.geolocation&&(this.watchId=navigator.geolocation.watchPosition(function(e){return t({latitude:e.coords.latitude,longitude:e.coords.longitude,accuracy:e.coords.accuracy})},function(t){return console.error("Geolocation error:",t)},e))}},{key:"clearWatch",value:function(){null!==this.watchId&&(navigator.geolocation.clearWatch(this.watchId),this.watchId=null)}}],e&&Np(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function Yp(t){return Yp="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Yp(t)}function Xp(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Qp(r.key),r)}}function Qp(t){var e=function(t){if("object"!=Yp(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Yp(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Yp(e)?e:e+""}const Kp=function(){return t=function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.url=e,this.ws=null,this.listeners={open:[],message:[],close:[],error:[]}},e=[{key:"connect",value:function(){var t=this;this.ws=new WebSocket(this.url),this.ws.onopen=function(e){return t.listeners.open.forEach(function(t){return t(e)})},this.ws.onmessage=function(e){try{var n=JSON.parse(e.data);t.listeners.message.forEach(function(t){return t(n)})}catch(n){t.listeners.message.forEach(function(t){return t(e.data)})}},this.ws.onclose=function(e){return t.listeners.close.forEach(function(t){return t(e)})},this.ws.onerror=function(e){return t.listeners.error.forEach(function(t){return t(e)})}}},{key:"send",value:function(t){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)throw new Error("WebSocket not connected");this.ws.send(JSON.stringify(t))}},{key:"on",value:function(t,e){this.listeners[t]&&this.listeners[t].push(e)}},{key:"disconnect",value:function(){this.ws&&this.ws.close()}}],e&&Xp(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function $p(t){return $p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$p(t)}function Jp(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,u=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(t){u=!0,i=t}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Zp(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Zp(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Zp(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function ty(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var l=r&&r.prototype instanceof s?r:s,u=Object.create(l.prototype);return ey(u,"_invoke",function(n,r,i){var o,s,l,u=0,c=i||[],h=!1,f={p:0,n:0,v:t,a:d,f:d.bind(t,4),d:function(e,n){return o=e,s=0,l=t,f.n=n,a}};function d(n,r){for(s=n,l=r,e=0;!h&&u&&!i&&e<c.length;e++){var i,o=c[e],d=f.p,p=o[2];n>3?(i=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=t):o[0]<=d&&((i=n<2&&d<o[1])?(s=0,f.v=r,f.n=o[1]):d<p&&(i=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(i||n>1)return a;throw h=!0,r}return function(i,c,p){if(u>1)throw TypeError("Generator is already running");for(h&&1===c&&d(c,p),s=c,l=p;(e=s<2?t:l)||!h;){o||(s?s<3?(s>1&&(f.n=-1),d(s,l)):f.n=l:f.v=l);try{if(u=2,o){if(s||(i="next"),e=o[i]){if(!(e=e.call(o,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,s<2&&(s=0)}else 1===s&&(e=o.return)&&e.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+i+"' method"),s=1);o=t}else if((e=(h=f.n<0)?l:n.call(r,f))!==a)break}catch(e){o=t,s=1,l=e}finally{u=1}}return{value:e,done:h}}}(n,i,o),!0),u}var a={};function s(){}function l(){}function u(){}e=Object.getPrototypeOf;var c=[][r]?e(e([][r]())):(ey(e={},r,function(){return this}),e),h=u.prototype=s.prototype=Object.create(c);function f(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,u):(t.__proto__=u,ey(t,i,"GeneratorFunction")),t.prototype=Object.create(h),t}return l.prototype=u,ey(h,"constructor",u),ey(u,"constructor",l),l.displayName="GeneratorFunction",ey(u,i,"GeneratorFunction"),ey(h),ey(h,i,"Generator"),ey(h,r,function(){return this}),ey(h,"toString",function(){return"[object Generator]"}),(ty=function(){return{w:o,m:f}})()}function ey(t,e,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(t){i=0}ey=function(t,e,n,r){function o(e,n){ey(t,e,function(t){return this._invoke(e,n,t)})}e?i?i(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(o("next",0),o("throw",1),o("return",2))},ey(t,e,n,r)}function ny(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function ry(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function a(t){ny(o,r,i,a,s,"next",t)}function s(t){ny(o,r,i,a,s,"throw",t)}a(void 0)})}}function iy(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,oy(r.key),r)}}function oy(t){var e=function(t){if("object"!=$p(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=$p(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==$p(e)?e:e+""}const ay=function(){return t=function t(){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!window.crypto||!window.crypto.subtle)throw new Error("Web Crypto API is not available in this browser");this.crypto=window.crypto.subtle,this.algorithm={name:"AES-GCM",length:256},this._keys=new Map},e=[{key:"generateKey",value:(c=ry(ty().m(function t(){var e,n,r=arguments;return ty().w(function(t){for(;;)switch(t.n){case 0:return e=r.length>0&&void 0!==r[0]?r[0]:"default",t.n=1,this.crypto.generateKey({name:this.algorithm.name,length:this.algorithm.length},!0,["encrypt","decrypt"]);case 1:return n=t.v,this._keys.set(e,n),t.a(2,n)}},t,this)})),function(){return c.apply(this,arguments)})},{key:"importKey",value:(u=ry(ty().m(function t(e){var n,r,i,o=arguments;return ty().w(function(t){for(;;)switch(t.n){case 0:return n=o.length>1&&void 0!==o[1]?o[1]:"default",r=this._base64ToBuffer(e),t.n=1,this.crypto.importKey("raw",r,{name:this.algorithm.name},!0,["encrypt","decrypt"]);case 1:return i=t.v,this._keys.set(n,i),t.a(2,i)}},t,this)})),function(t){return u.apply(this,arguments)})},{key:"exportKey",value:(l=ry(ty().m(function t(){var e,n,r,i=arguments;return ty().w(function(t){for(;;)switch(t.n){case 0:if(e=i.length>0&&void 0!==i[0]?i[0]:"default",n=this._keys.get(e)){t.n=1;break}throw new Error('Key "'.concat(e,'" not found'));case 1:return t.n=2,this.crypto.exportKey("raw",n);case 2:return r=t.v,t.a(2,this._bufferToBase64(r))}},t,this)})),function(){return l.apply(this,arguments)})},{key:"deriveKeyFromPassword",value:(s=ry(ty().m(function t(e){var n,r,i,o,a,s,l,u=arguments;return ty().w(function(t){for(;;)switch(t.n){case 0:return n=u.length>1&&void 0!==u[1]?u[1]:"default",i=(r=u.length>2&&void 0!==u[2]?u[2]:null)?this._base64ToBuffer(r):window.crypto.getRandomValues(new Uint8Array(16)),o=new TextEncoder,a=o.encode(e),t.n=1,this.crypto.importKey("raw",a,{name:"PBKDF2"},!1,["deriveBits","deriveKey"]);case 1:return s=t.v,t.n=2,this.crypto.deriveKey({name:"PBKDF2",salt:i,iterations:1e5,hash:"SHA-256"},s,{name:this.algorithm.name,length:this.algorithm.length},!0,["encrypt","decrypt"]);case 2:return l=t.v,this._keys.set(n,l),t.a(2,{key:l,salt:this._bufferToBase64(i)})}},t,this)})),function(t){return s.apply(this,arguments)})},{key:"encrypt",value:(a=ry(ty().m(function t(e){var n,r,i,o,a,s,l,u=arguments;return ty().w(function(t){for(;;)switch(t.n){case 0:if(n=u.length>1&&void 0!==u[1]?u[1]:"default",r=this._keys.get(n)){t.n=1;break}throw new Error('Key "'.concat(n,'" not found. Generate or import a key first.'));case 1:return i="string"==typeof e?e:JSON.stringify(e),o=new TextEncoder,a=o.encode(i),s=window.crypto.getRandomValues(new Uint8Array(12)),t.n=2,this.crypto.encrypt({name:this.algorithm.name,iv:s},r,a);case 2:return l=t.v,t.a(2,{encrypted:this._bufferToBase64(l),iv:this._bufferToBase64(s)})}},t,this)})),function(t){return a.apply(this,arguments)})},{key:"decrypt",value:(o=ry(ty().m(function t(e,n){var r,i,o,a,s,l,u,c,h=arguments;return ty().w(function(t){for(;;)switch(t.p=t.n){case 0:if(r=h.length>2&&void 0!==h[2]?h[2]:"default",i=!(h.length>3&&void 0!==h[3])||h[3],o=this._keys.get(r)){t.n=1;break}throw new Error('Key "'.concat(r,'" not found. Generate or import a key first.'));case 1:return a=this._base64ToBuffer(e),s=this._base64ToBuffer(n),t.n=2,this.crypto.decrypt({name:this.algorithm.name,iv:s},o,a);case 2:if(l=t.v,u=new TextDecoder,c=u.decode(l),!i){t.n=5;break}return t.p=3,t.a(2,JSON.parse(c));case 4:return t.p=4,t.v,t.a(2,c);case 5:return t.a(2,c)}},t,this,[[3,4]])})),function(t,e){return o.apply(this,arguments)})},{key:"encryptToString",value:(i=ry(ty().m(function t(e){var n,r,i,o,a=arguments;return ty().w(function(t){for(;;)switch(t.n){case 0:return n=a.length>1&&void 0!==a[1]?a[1]:"default",t.n=1,this.encrypt(e,n);case 1:return r=t.v,i=r.encrypted,o=r.iv,t.a(2,"".concat(i,".").concat(o))}},t,this)})),function(t){return i.apply(this,arguments)})},{key:"decryptFromString",value:(r=ry(ty().m(function t(e){var n,r,i,o,a,s,l=arguments;return ty().w(function(t){for(;;)switch(t.n){case 0:if(n=l.length>1&&void 0!==l[1]?l[1]:"default",r=!(l.length>2&&void 0!==l[2])||l[2],i=e.split("."),o=Jp(i,2),a=o[0],s=o[1],a&&s){t.n=1;break}throw new Error("Invalid encrypted string format");case 1:return t.a(2,this.decrypt(a,s,n,r))}},t,this)})),function(t){return r.apply(this,arguments)})},{key:"hash",value:(n=ry(ty().m(function t(e){var n,r,i,o,a=arguments;return ty().w(function(t){for(;;)switch(t.n){case 0:return n=a.length>1&&void 0!==a[1]?a[1]:"SHA-256",r=new TextEncoder,i=r.encode(e),t.n=1,this.crypto.digest(n,i);case 1:return o=t.v,t.a(2,this._bufferToBase64(o))}},t,this)})),function(t){return n.apply(this,arguments)})},{key:"generateToken",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:32,e=window.crypto.getRandomValues(new Uint8Array(t));return this._bufferToBase64(e)}},{key:"deleteKey",value:function(t){this._keys.delete(t)}},{key:"deleteAllKeys",value:function(){this._keys.clear()}},{key:"listKeys",value:function(){return Array.from(this._keys.keys())}},{key:"_bufferToBase64",value:function(t){for(var e=new Uint8Array(t),n="",r=0;r<e.length;r++)n+=String.fromCharCode(e[r]);return btoa(n)}},{key:"_base64ToBuffer",value:function(t){for(var e=atob(t),n=new Uint8Array(e.length),r=0;r<e.length;r++)n[r]=e.charCodeAt(r);return n.buffer}}],e&&iy(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n,r,i,o,a,s,l,u,c}();function sy(t){return sy="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},sy(t)}function ly(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function uy(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?ly(Object(n),!0).forEach(function(e){cy(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ly(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function cy(t,e,n){return(e=vy(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function hy(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var l=r&&r.prototype instanceof s?r:s,u=Object.create(l.prototype);return fy(u,"_invoke",function(n,r,i){var o,s,l,u=0,c=i||[],h=!1,f={p:0,n:0,v:t,a:d,f:d.bind(t,4),d:function(e,n){return o=e,s=0,l=t,f.n=n,a}};function d(n,r){for(s=n,l=r,e=0;!h&&u&&!i&&e<c.length;e++){var i,o=c[e],d=f.p,p=o[2];n>3?(i=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=t):o[0]<=d&&((i=n<2&&d<o[1])?(s=0,f.v=r,f.n=o[1]):d<p&&(i=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(i||n>1)return a;throw h=!0,r}return function(i,c,p){if(u>1)throw TypeError("Generator is already running");for(h&&1===c&&d(c,p),s=c,l=p;(e=s<2?t:l)||!h;){o||(s?s<3?(s>1&&(f.n=-1),d(s,l)):f.n=l:f.v=l);try{if(u=2,o){if(s||(i="next"),e=o[i]){if(!(e=e.call(o,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,s<2&&(s=0)}else 1===s&&(e=o.return)&&e.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+i+"' method"),s=1);o=t}else if((e=(h=f.n<0)?l:n.call(r,f))!==a)break}catch(e){o=t,s=1,l=e}finally{u=1}}return{value:e,done:h}}}(n,i,o),!0),u}var a={};function s(){}function l(){}function u(){}e=Object.getPrototypeOf;var c=[][r]?e(e([][r]())):(fy(e={},r,function(){return this}),e),h=u.prototype=s.prototype=Object.create(c);function f(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,u):(t.__proto__=u,fy(t,i,"GeneratorFunction")),t.prototype=Object.create(h),t}return l.prototype=u,fy(h,"constructor",u),fy(u,"constructor",l),l.displayName="GeneratorFunction",fy(u,i,"GeneratorFunction"),fy(h),fy(h,i,"Generator"),fy(h,r,function(){return this}),fy(h,"toString",function(){return"[object Generator]"}),(hy=function(){return{w:o,m:f}})()}function fy(t,e,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(t){i=0}fy=function(t,e,n,r){function o(e,n){fy(t,e,function(t){return this._invoke(e,n,t)})}e?i?i(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(o("next",0),o("throw",1),o("return",2))},fy(t,e,n,r)}function dy(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function py(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function a(t){dy(o,r,i,a,s,"next",t)}function s(t){dy(o,r,i,a,s,"throw",t)}a(void 0)})}}function yy(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,vy(r.key),r)}}function vy(t){var e=function(t){if("object"!=sy(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=sy(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==sy(e)?e:e+""}var my=function(){return t=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.defaults={icon:e.icon||null,silent:e.silent||!1,requireInteraction:e.requireInteraction||!1},this.isSupported="Notification"in window},e=[{key:"requestPermission",value:(r=py(hy().m(function t(){var e;return hy().w(function(t){for(;;)switch(t.n){case 0:if(this.isSupported){t.n=1;break}return t.a(2,!1);case 1:if("granted"!==Notification.permission){t.n=2;break}return t.a(2,!0);case 2:if("denied"===Notification.permission){t.n=4;break}return t.n=3,Notification.requestPermission();case 3:return e=t.v,t.a(2,"granted"===e);case 4:return t.a(2,!1)}},t,this)})),function(){return r.apply(this,arguments)})},{key:"notify",value:(n=py(hy().m(function t(e){var n,r,i,o=arguments;return hy().w(function(t){for(;;)switch(t.n){case 0:if(n=o.length>1&&void 0!==o[1]?o[1]:{},this.isSupported){t.n=1;break}return console.warn("Notifications API non supportée"),t.a(2,null);case 1:return t.n=2,this.requestPermission();case 2:if(t.v){t.n=3;break}return t.a(2,null);case 3:return r=uy(uy({},this.defaults),n),i=new Notification(e,r),n.onClick&&(i.onclick=n.onClick),n.onClose&&(i.onclose=n.onClose),n.duration&&n.duration>0&&setTimeout(function(){i.close()},n.duration),t.a(2,i)}},t,this)})),function(t){return n.apply(this,arguments)})}],e&&yy(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n,r}();function gy(t){return gy="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gy(t)}function by(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var l=r&&r.prototype instanceof s?r:s,u=Object.create(l.prototype);return wy(u,"_invoke",function(n,r,i){var o,s,l,u=0,c=i||[],h=!1,f={p:0,n:0,v:t,a:d,f:d.bind(t,4),d:function(e,n){return o=e,s=0,l=t,f.n=n,a}};function d(n,r){for(s=n,l=r,e=0;!h&&u&&!i&&e<c.length;e++){var i,o=c[e],d=f.p,p=o[2];n>3?(i=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=t):o[0]<=d&&((i=n<2&&d<o[1])?(s=0,f.v=r,f.n=o[1]):d<p&&(i=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(i||n>1)return a;throw h=!0,r}return function(i,c,p){if(u>1)throw TypeError("Generator is already running");for(h&&1===c&&d(c,p),s=c,l=p;(e=s<2?t:l)||!h;){o||(s?s<3?(s>1&&(f.n=-1),d(s,l)):f.n=l:f.v=l);try{if(u=2,o){if(s||(i="next"),e=o[i]){if(!(e=e.call(o,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,s<2&&(s=0)}else 1===s&&(e=o.return)&&e.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+i+"' method"),s=1);o=t}else if((e=(h=f.n<0)?l:n.call(r,f))!==a)break}catch(e){o=t,s=1,l=e}finally{u=1}}return{value:e,done:h}}}(n,i,o),!0),u}var a={};function s(){}function l(){}function u(){}e=Object.getPrototypeOf;var c=[][r]?e(e([][r]())):(wy(e={},r,function(){return this}),e),h=u.prototype=s.prototype=Object.create(c);function f(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,u):(t.__proto__=u,wy(t,i,"GeneratorFunction")),t.prototype=Object.create(h),t}return l.prototype=u,wy(h,"constructor",u),wy(u,"constructor",l),l.displayName="GeneratorFunction",wy(u,i,"GeneratorFunction"),wy(h),wy(h,i,"Generator"),wy(h,r,function(){return this}),wy(h,"toString",function(){return"[object Generator]"}),(by=function(){return{w:o,m:f}})()}function wy(t,e,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(t){i=0}wy=function(t,e,n,r){function o(e,n){wy(t,e,function(t){return this._invoke(e,n,t)})}e?i?i(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(o("next",0),o("throw",1),o("return",2))},wy(t,e,n,r)}function xy(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function ky(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?xy(Object(n),!0).forEach(function(e){Sy(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):xy(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function Sy(t,e,n){return(e=Cy(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ty(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function Py(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function a(t){Ty(o,r,i,a,s,"next",t)}function s(t){Ty(o,r,i,a,s,"throw",t)}a(void 0)})}}function Oy(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Cy(r.key),r)}}function Cy(t){var e=function(t){if("object"!=gy(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=gy(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==gy(e)?e:e+""}const Ey=function(){return t=function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.core=e,this.storage=null,this.uploadTasks=new Map},e=[{key:"initialize",value:function(){return this.storage||(this.storage=this.core.getStorage()),this.storage}},{key:"ref",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return this.storage||this.initialize(),this.storage.ref(t)}},{key:"uploadFile",value:(g=Py(by().m(function t(e,n){var r,i,o,a,s,l,u,c=arguments;return by().w(function(t){for(;;)switch(t.p=t.n){case 0:return r=c.length>2&&void 0!==c[2]?c[2]:{},i=c.length>3&&void 0!==c[3]?c[3]:null,t.p=1,o=this.ref(e),a=o.put(n,ky({contentType:n.type},r)),this.uploadTasks.set(e,a),i&&a.on("state_changed",function(t){var e=t.bytesTransferred/t.totalBytes*100;i({progress:e,bytesTransferred:t.bytesTransferred,totalBytes:t.totalBytes,state:t.state})}),t.n=2,a;case 2:return s=t.v,t.n=3,s.ref.getDownloadURL();case 3:return l=t.v,this.uploadTasks.delete(e),t.a(2,{success:!0,url:l,fullPath:s.ref.fullPath,name:s.ref.name,size:s.metadata.size,contentType:s.metadata.contentType,timeCreated:s.metadata.timeCreated,metadata:s.metadata});case 4:throw t.p=4,u=t.v,console.error("❌ Erreur uploadFile ".concat(e,":"),u),this.uploadTasks.delete(e),u;case 5:return t.a(2)}},t,this,[[1,4]])})),function(t,e){return g.apply(this,arguments)})},{key:"uploadBlob",value:(m=Py(by().m(function t(e,n){var r,i,o=arguments;return by().w(function(t){for(;;)if(0===t.n)return r=o.length>2&&void 0!==o[2]?o[2]:{},i=o.length>3&&void 0!==o[3]?o[3]:null,t.a(2,this.uploadFile(e,n,r,i))},t,this)})),function(t,e){return m.apply(this,arguments)})},{key:"uploadDataURL",value:(v=Py(by().m(function t(e,n){var r,i,o,a,s,l,u,c=arguments;return by().w(function(t){for(;;)switch(t.p=t.n){case 0:return r=c.length>2&&void 0!==c[2]?c[2]:{},i=c.length>3&&void 0!==c[3]?c[3]:null,t.p=1,o=this.ref(e),a=o.putString(n,"data_url",r),this.uploadTasks.set(e,a),i&&a.on("state_changed",function(t){var e=t.bytesTransferred/t.totalBytes*100;i({progress:e,bytesTransferred:t.bytesTransferred,totalBytes:t.totalBytes,state:t.state})}),t.n=2,a;case 2:return s=t.v,t.n=3,s.ref.getDownloadURL();case 3:return l=t.v,this.uploadTasks.delete(e),t.a(2,{success:!0,url:l,fullPath:s.ref.fullPath,name:s.ref.name,metadata:s.metadata});case 4:throw t.p=4,u=t.v,console.error("❌ Erreur uploadDataURL ".concat(e,":"),u),this.uploadTasks.delete(e),u;case 5:return t.a(2)}},t,this,[[1,4]])})),function(t,e){return v.apply(this,arguments)})},{key:"uploadImageCompressed",value:(y=Py(by().m(function t(e,n){var r,i,o,a,s,l,u,c,h,f,d,p,y=arguments;return by().w(function(t){for(;;)switch(t.p=t.n){case 0:return r=y.length>2&&void 0!==y[2]?y[2]:{},i=y.length>3&&void 0!==y[3]?y[3]:null,t.p=1,o=r.maxWidth,a=void 0===o?1920:o,s=r.maxHeight,l=void 0===s?1080:s,u=r.quality,c=void 0===u?.8:u,h=r.outputFormat,f=void 0===h?"image/jpeg":h,t.n=2,this.compressImage(n,a,l,c,f);case 2:return d=t.v,t.n=3,this.uploadBlob(e,d,{contentType:f},i);case 3:return t.a(2,t.v);case 4:throw t.p=4,p=t.v,console.error("❌ Erreur uploadImageCompressed ".concat(e,":"),p),p;case 5:return t.a(2)}},t,this,[[1,4]])})),function(t,e){return y.apply(this,arguments)})},{key:"uploadMultiple",value:(p=Py(by().m(function t(e){var n,r,i,o,a,s=this,l=arguments;return by().w(function(t){for(;;)switch(t.p=t.n){case 0:return n=l.length>1&&void 0!==l[1]?l[1]:"",r=l.length>2&&void 0!==l[2]?l[2]:null,t.p=1,i=e.map(function(t,e){var i="".concat(n,"/").concat(t.name);return s.uploadFile(i,t,{},function(n){r&&r(ky({fileIndex:e,fileName:t.name},n))})}),t.n=2,Promise.all(i);case 2:return o=t.v,t.a(2,{success:!0,files:o});case 3:throw t.p=3,a=t.v,console.error("❌ Erreur uploadMultiple:",a),a;case 4:return t.a(2)}},t,null,[[1,3]])})),function(t){return p.apply(this,arguments)})},{key:"getDownloadURL",value:(d=Py(by().m(function t(e){var n,r;return by().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.ref(e).getDownloadURL();case 1:return n=t.v,t.a(2,n);case 2:throw t.p=2,r=t.v,console.error("❌ Erreur getDownloadURL ".concat(e,":"),r),r;case 3:return t.a(2)}},t,this,[[0,2]])})),function(t){return d.apply(this,arguments)})},{key:"downloadAsBlob",value:(f=Py(by().m(function t(e){var n,r,i,o=arguments;return by().w(function(t){for(;;)switch(t.p=t.n){case 0:return n=o.length>1&&void 0!==o[1]?o[1]:10485760,t.p=1,t.n=2,this.ref(e).getBytes(n);case 2:return r=t.v,t.a(2,new Blob([r]));case 3:throw t.p=3,i=t.v,console.error("❌ Erreur downloadAsBlob ".concat(e,":"),i),i;case 4:return t.a(2)}},t,this,[[1,3]])})),function(t){return f.apply(this,arguments)})},{key:"downloadAsDataURL",value:(h=Py(by().m(function t(e){var n,r,i,o;return by().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.ref(e).getDownloadURL();case 1:return n=t.v,t.n=2,fetch(n);case 2:return r=t.v,t.n=3,r.blob();case 3:return i=t.v,t.a(2,new Promise(function(t,e){var n=new FileReader;n.onloadend=function(){return t(n.result)},n.onerror=e,n.readAsDataURL(i)}));case 4:throw t.p=4,o=t.v,console.error("❌ Erreur downloadAsDataURL ".concat(e,":"),o),o;case 5:return t.a(2)}},t,this,[[0,4]])})),function(t){return h.apply(this,arguments)})},{key:"deleteFile",value:(c=Py(by().m(function t(e){var n;return by().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.ref(e).delete();case 1:return t.a(2,{success:!0});case 2:throw t.p=2,n=t.v,console.error("❌ Erreur deleteFile ".concat(e,":"),n),n;case 3:return t.a(2)}},t,this,[[0,2]])})),function(t){return c.apply(this,arguments)})},{key:"deleteMultiple",value:(u=Py(by().m(function t(e){var n,r,i=this;return by().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,n=e.map(function(t){return i.deleteFile(t)}),t.n=1,Promise.all(n);case 1:return t.a(2,{success:!0});case 2:throw t.p=2,r=t.v,console.error("❌ Erreur deleteMultiple:",r),r;case 3:return t.a(2)}},t,null,[[0,2]])})),function(t){return u.apply(this,arguments)})},{key:"getMetadata",value:(l=Py(by().m(function t(e){var n,r;return by().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.ref(e).getMetadata();case 1:return n=t.v,t.a(2,n);case 2:throw t.p=2,r=t.v,console.error("❌ Erreur getMetadata ".concat(e,":"),r),r;case 3:return t.a(2)}},t,this,[[0,2]])})),function(t){return l.apply(this,arguments)})},{key:"updateMetadata",value:(s=Py(by().m(function t(e,n){var r,i;return by().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.ref(e).updateMetadata(n);case 1:return r=t.v,t.a(2,r);case 2:throw t.p=2,i=t.v,console.error("❌ Erreur updateMetadata ".concat(e,":"),i),i;case 3:return t.a(2)}},t,this,[[0,2]])})),function(t,e){return s.apply(this,arguments)})},{key:"listFiles",value:(a=Py(by().m(function t(e){var n,r,i,o,a,s,l,u,c,h=arguments;return by().w(function(t){for(;;)switch(t.p=t.n){case 0:return n=h.length>1&&void 0!==h[1]?h[1]:{},t.p=1,r=n.maxResults,i=void 0===r?100:r,o=n.pageToken,a=void 0===o?null:o,t.n=2,this.ref(e).list({maxResults:i,pageToken:a});case 2:return s=t.v,l=s.items.map(function(t){return{name:t.name,fullPath:t.fullPath,bucket:t.bucket}}),u=s.prefixes.map(function(t){return{name:t.name,fullPath:t.fullPath}}),t.a(2,{items:l,prefixes:u,nextPageToken:s.nextPageToken||null});case 3:throw t.p=3,c=t.v,console.error("❌ Erreur listFiles ".concat(e,":"),c),c;case 4:return t.a(2)}},t,this,[[1,3]])})),function(t){return a.apply(this,arguments)})},{key:"listAllFiles",value:(o=Py(by().m(function t(e){var n,r,i,o;return by().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.ref(e).listAll();case 1:return n=t.v,r=n.items.map(function(t){return{name:t.name,fullPath:t.fullPath,bucket:t.bucket}}),i=n.prefixes.map(function(t){return{name:t.name,fullPath:t.fullPath}}),t.a(2,{items:r,prefixes:i});case 2:throw t.p=2,o=t.v,console.error("❌ Erreur listAllFiles ".concat(e,":"),o),o;case 3:return t.a(2)}},t,this,[[0,2]])})),function(t){return o.apply(this,arguments)})},{key:"pauseUpload",value:function(t){var e=this.uploadTasks.get(t);return!!e&&(e.pause(),!0)}},{key:"resumeUpload",value:function(t){var e=this.uploadTasks.get(t);return!!e&&(e.resume(),!0)}},{key:"cancelUpload",value:function(t){var e=this.uploadTasks.get(t);return!!e&&(e.cancel(),this.uploadTasks.delete(t),!0)}},{key:"getUploadState",value:function(t){var e=this.uploadTasks.get(t);return e?e.snapshot.state:null}},{key:"compressImage",value:function(t,e,n,r,i){return new Promise(function(o,a){var s=new FileReader;s.onload=function(t){var s=new Image;s.onload=function(){var t=document.createElement("canvas"),l=t.getContext("2d"),u=s.width,c=s.height;u>e&&(c=c*e/u,u=e),c>n&&(u=u*n/c,c=n),t.width=u,t.height=c,l.drawImage(s,0,0,u,c),t.toBlob(function(t){t?o(t):a(new Error("Erreur compression image"))},i,r)},s.onerror=function(){return a(new Error("Erreur chargement image"))},s.src=t.target.result},s.onerror=function(){return a(new Error("Erreur lecture fichier"))},s.readAsDataURL(t)})}},{key:"getFileExtension",value:function(t){return t.split(".").pop().toLowerCase()}},{key:"generateUniqueFilename",value:function(t){var e=Date.now(),n=Math.random().toString(36).substring(2,8),r=this.getFileExtension(t),i=t.replace(".".concat(r),"");return"".concat(i,"_").concat(e,"_").concat(n,".").concat(r)}},{key:"validateFileType",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(0===e.length)return!0;var n=t.type,r=this.getFileExtension(t.name);return e.some(function(t){if(t.includes("*")){var e=t.split("/")[0];return n.startsWith(e)}return t.startsWith(".")?r===t.substring(1):n===t})}},{key:"validateFileSize",value:function(t,e){var n=1024*e*1024;return t.size<=n}},{key:"formatFileSize",value:function(t){if(0===t)return"0 Bytes";var e=Math.floor(Math.log(t)/Math.log(1024));return Math.round(t/Math.pow(1024,e)*100)/100+" "+["Bytes","KB","MB","GB"][e]}},{key:"fileExists",value:(i=Py(by().m(function t(e){var n;return by().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.ref(e).getMetadata();case 1:return t.a(2,!0);case 2:if(t.p=2,"storage/object-not-found"!==(n=t.v).code){t.n=3;break}return t.a(2,!1);case 3:throw n;case 4:return t.a(2)}},t,this,[[0,2]])})),function(t){return i.apply(this,arguments)})},{key:"copyFile",value:(r=Py(by().m(function t(e,n){var r,i,o;return by().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.downloadAsBlob(e);case 1:return r=t.v,t.n=2,this.uploadBlob(n,r);case 2:return i=t.v,t.a(2,i);case 3:throw t.p=3,o=t.v,console.error("❌ Erreur copyFile:",o),o;case 4:return t.a(2)}},t,this,[[0,3]])})),function(t,e){return r.apply(this,arguments)})},{key:"moveFile",value:(n=Py(by().m(function t(e,n){var r;return by().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.copyFile(e,n);case 1:return t.n=2,this.deleteFile(e);case 2:return t.a(2,{success:!0});case 3:throw t.p=3,r=t.v,console.error("❌ Erreur moveFile:",r),r;case 4:return t.a(2)}},t,this,[[0,3]])})),function(t,e){return n.apply(this,arguments)})},{key:"destroy",value:function(){this.uploadTasks.forEach(function(t,e){t.cancel()}),this.uploadTasks.clear(),this.storage=null}}],e&&Oy(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n,r,i,o,a,s,l,u,c,h,f,d,p,y,v,m,g}();function jy(t){return jy="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},jy(t)}function Iy(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var l=r&&r.prototype instanceof s?r:s,u=Object.create(l.prototype);return Fy(u,"_invoke",function(n,r,i){var o,s,l,u=0,c=i||[],h=!1,f={p:0,n:0,v:t,a:d,f:d.bind(t,4),d:function(e,n){return o=e,s=0,l=t,f.n=n,a}};function d(n,r){for(s=n,l=r,e=0;!h&&u&&!i&&e<c.length;e++){var i,o=c[e],d=f.p,p=o[2];n>3?(i=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=t):o[0]<=d&&((i=n<2&&d<o[1])?(s=0,f.v=r,f.n=o[1]):d<p&&(i=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(i||n>1)return a;throw h=!0,r}return function(i,c,p){if(u>1)throw TypeError("Generator is already running");for(h&&1===c&&d(c,p),s=c,l=p;(e=s<2?t:l)||!h;){o||(s?s<3?(s>1&&(f.n=-1),d(s,l)):f.n=l:f.v=l);try{if(u=2,o){if(s||(i="next"),e=o[i]){if(!(e=e.call(o,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,s<2&&(s=0)}else 1===s&&(e=o.return)&&e.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+i+"' method"),s=1);o=t}else if((e=(h=f.n<0)?l:n.call(r,f))!==a)break}catch(e){o=t,s=1,l=e}finally{u=1}}return{value:e,done:h}}}(n,i,o),!0),u}var a={};function s(){}function l(){}function u(){}e=Object.getPrototypeOf;var c=[][r]?e(e([][r]())):(Fy(e={},r,function(){return this}),e),h=u.prototype=s.prototype=Object.create(c);function f(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,u):(t.__proto__=u,Fy(t,i,"GeneratorFunction")),t.prototype=Object.create(h),t}return l.prototype=u,Fy(h,"constructor",u),Fy(u,"constructor",l),l.displayName="GeneratorFunction",Fy(u,i,"GeneratorFunction"),Fy(h),Fy(h,i,"Generator"),Fy(h,r,function(){return this}),Fy(h,"toString",function(){return"[object Generator]"}),(Iy=function(){return{w:o,m:f}})()}function Fy(t,e,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(t){i=0}Fy=function(t,e,n,r){function o(e,n){Fy(t,e,function(t){return this._invoke(e,n,t)})}e?i?i(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(o("next",0),o("throw",1),o("return",2))},Fy(t,e,n,r)}function Ry(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function My(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function a(t){Ry(o,r,i,a,s,"next",t)}function s(t){Ry(o,r,i,a,s,"throw",t)}a(void 0)})}}function Ay(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,_y(r.key),r)}}function _y(t){var e=function(t){if("object"!=jy(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=jy(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==jy(e)?e:e+""}const Dy=function(){return t=function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.core=e,this.auth=null,this.currentUser=null,this.authStateListeners=[]},e=[{key:"initialize",value:function(){return this.auth||(this.auth=this.core.getAuth()),this.auth}},{key:"signUpWithEmail",value:(C=My(Iy().m(function t(e,n){var r,i,o,a=arguments;return Iy().w(function(t){for(;;)switch(t.p=t.n){case 0:return r=a.length>2&&void 0!==a[2]?a[2]:null,t.p=1,this.auth||this.initialize(),t.n=2,this.auth.createUserWithEmailAndPassword(e,n);case 2:if(i=t.v,!r||!i.user){t.n=3;break}return t.n=3,i.user.updateProfile({displayName:r});case 3:return t.n=4,i.user.sendEmailVerification();case 4:return this.currentUser=i.user,t.a(2,{success:!0,user:this.formatUser(i.user)});case 5:throw t.p=5,o=t.v,console.error("❌ Erreur signUpWithEmail:",o),this.formatError(o);case 6:return t.a(2)}},t,this,[[1,5]])})),function(t,e){return C.apply(this,arguments)})},{key:"signInWithEmail",value:(O=My(Iy().m(function t(e,n){var r,i;return Iy().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,this.auth||this.initialize(),t.n=1,this.auth.signInWithEmailAndPassword(e,n);case 1:return r=t.v,this.currentUser=r.user,t.a(2,{success:!0,user:this.formatUser(r.user)});case 2:throw t.p=2,i=t.v,console.error("❌ Erreur signInWithEmail:",i),this.formatError(i);case 3:return t.a(2)}},t,this,[[0,2]])})),function(t,e){return O.apply(this,arguments)})},{key:"signInAnonymously",value:(P=My(Iy().m(function t(){var e,n;return Iy().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,this.auth||this.initialize(),t.n=1,this.auth.signInAnonymously();case 1:return e=t.v,this.currentUser=e.user,t.a(2,{success:!0,user:this.formatUser(e.user)});case 2:throw t.p=2,n=t.v,console.error("❌ Erreur signInAnonymously:",n),this.formatError(n);case 3:return t.a(2)}},t,this,[[0,2]])})),function(){return P.apply(this,arguments)})},{key:"signInWithGoogle",value:(T=My(Iy().m(function t(){var e,n,r;return Iy().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,this.auth||this.initialize(),(e=new firebase.auth.GoogleAuthProvider).addScope("profile"),e.addScope("email"),t.n=1,this.auth.signInWithPopup(e);case 1:return n=t.v,this.currentUser=n.user,t.a(2,{success:!0,user:this.formatUser(n.user),credential:n.credential});case 2:throw t.p=2,r=t.v,console.error("❌ Erreur signInWithGoogle:",r),this.formatError(r);case 3:return t.a(2)}},t,this,[[0,2]])})),function(){return T.apply(this,arguments)})},{key:"signInWithFacebook",value:(S=My(Iy().m(function t(){var e,n,r;return Iy().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,this.auth||this.initialize(),(e=new firebase.auth.FacebookAuthProvider).addScope("email"),e.addScope("public_profile"),t.n=1,this.auth.signInWithPopup(e);case 1:return n=t.v,this.currentUser=n.user,t.a(2,{success:!0,user:this.formatUser(n.user),credential:n.credential});case 2:throw t.p=2,r=t.v,console.error("❌ Erreur signInWithFacebook:",r),this.formatError(r);case 3:return t.a(2)}},t,this,[[0,2]])})),function(){return S.apply(this,arguments)})},{key:"signInWithTwitter",value:(k=My(Iy().m(function t(){var e,n,r;return Iy().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,this.auth||this.initialize(),e=new firebase.auth.TwitterAuthProvider,t.n=1,this.auth.signInWithPopup(e);case 1:return n=t.v,this.currentUser=n.user,t.a(2,{success:!0,user:this.formatUser(n.user),credential:n.credential});case 2:throw t.p=2,r=t.v,console.error("❌ Erreur signInWithTwitter:",r),this.formatError(r);case 3:return t.a(2)}},t,this,[[0,2]])})),function(){return k.apply(this,arguments)})},{key:"signInWithGithub",value:(x=My(Iy().m(function t(){var e,n,r;return Iy().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,this.auth||this.initialize(),(e=new firebase.auth.GithubAuthProvider).addScope("user"),t.n=1,this.auth.signInWithPopup(e);case 1:return n=t.v,this.currentUser=n.user,t.a(2,{success:!0,user:this.formatUser(n.user),credential:n.credential});case 2:throw t.p=2,r=t.v,console.error("❌ Erreur signInWithGithub:",r),this.formatError(r);case 3:return t.a(2)}},t,this,[[0,2]])})),function(){return x.apply(this,arguments)})},{key:"signInWithMicrosoft",value:(w=My(Iy().m(function t(){var e,n,r;return Iy().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,this.auth||this.initialize(),e=new firebase.auth.OAuthProvider("microsoft.com"),t.n=1,this.auth.signInWithPopup(e);case 1:return n=t.v,this.currentUser=n.user,t.a(2,{success:!0,user:this.formatUser(n.user),credential:n.credential});case 2:throw t.p=2,r=t.v,console.error("❌ Erreur signInWithMicrosoft:",r),this.formatError(r);case 3:return t.a(2)}},t,this,[[0,2]])})),function(){return w.apply(this,arguments)})},{key:"signInWithApple",value:(b=My(Iy().m(function t(){var e,n,r;return Iy().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,this.auth||this.initialize(),(e=new firebase.auth.OAuthProvider("apple.com")).addScope("email"),e.addScope("name"),t.n=1,this.auth.signInWithPopup(e);case 1:return n=t.v,this.currentUser=n.user,t.a(2,{success:!0,user:this.formatUser(n.user),credential:n.credential});case 2:throw t.p=2,r=t.v,console.error("❌ Erreur signInWithApple:",r),this.formatError(r);case 3:return t.a(2)}},t,this,[[0,2]])})),function(){return b.apply(this,arguments)})},{key:"sendPhoneVerification",value:(g=My(Iy().m(function t(e,n){var r,i;return Iy().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,this.auth||this.initialize(),window.recaptchaVerifier=new firebase.auth.RecaptchaVerifier(n,{size:"invisible",callback:function(){console.log("✅ reCAPTCHA résolu")}}),t.n=1,this.auth.signInWithPhoneNumber(e,window.recaptchaVerifier);case 1:return r=t.v,t.a(2,{success:!0,confirmationResult:r});case 2:throw t.p=2,i=t.v,console.error("❌ Erreur sendPhoneVerification:",i),this.formatError(i);case 3:return t.a(2)}},t,this,[[0,2]])})),function(t,e){return g.apply(this,arguments)})},{key:"verifyPhoneCode",value:(m=My(Iy().m(function t(e,n){var r,i;return Iy().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,e.confirm(n);case 1:return r=t.v,this.currentUser=r.user,t.a(2,{success:!0,user:this.formatUser(r.user)});case 2:throw t.p=2,i=t.v,console.error("❌ Erreur verifyPhoneCode:",i),this.formatError(i);case 3:return t.a(2)}},t,this,[[0,2]])})),function(t,e){return m.apply(this,arguments)})},{key:"signInWithCustomToken",value:(v=My(Iy().m(function t(e){var n,r;return Iy().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,this.auth||this.initialize(),t.n=1,this.auth.signInWithCustomToken(e);case 1:return n=t.v,this.currentUser=n.user,t.a(2,{success:!0,user:this.formatUser(n.user)});case 2:throw t.p=2,r=t.v,console.error("❌ Erreur signInWithCustomToken:",r),this.formatError(r);case 3:return t.a(2)}},t,this,[[0,2]])})),function(t){return v.apply(this,arguments)})},{key:"sendPasswordResetEmail",value:(y=My(Iy().m(function t(e){var n;return Iy().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,this.auth||this.initialize(),t.n=1,this.auth.sendPasswordResetEmail(e);case 1:return t.a(2,{success:!0});case 2:throw t.p=2,n=t.v,console.error("❌ Erreur sendPasswordResetEmail:",n),this.formatError(n);case 3:return t.a(2)}},t,this,[[0,2]])})),function(t){return y.apply(this,arguments)})},{key:"confirmPasswordReset",value:(p=My(Iy().m(function t(e,n){var r;return Iy().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,this.auth||this.initialize(),t.n=1,this.auth.confirmPasswordReset(e,n);case 1:return t.a(2,{success:!0});case 2:throw t.p=2,r=t.v,console.error("❌ Erreur confirmPasswordReset:",r),this.formatError(r);case 3:return t.a(2)}},t,this,[[0,2]])})),function(t,e){return p.apply(this,arguments)})},{key:"updatePassword",value:(d=My(Iy().m(function t(e){var n,r;return Iy().w(function(t){for(;;)switch(t.p=t.n){case 0:if(t.p=0,n=this.getCurrentUser()){t.n=1;break}throw new Error("Utilisateur non connecté");case 1:return t.n=2,n.updatePassword(e);case 2:return t.a(2,{success:!0});case 3:throw t.p=3,r=t.v,console.error("❌ Erreur updatePassword:",r),this.formatError(r);case 4:return t.a(2)}},t,this,[[0,3]])})),function(t){return d.apply(this,arguments)})},{key:"sendEmailVerification",value:(f=My(Iy().m(function t(){var e,n;return Iy().w(function(t){for(;;)switch(t.p=t.n){case 0:if(t.p=0,e=this.getCurrentUser()){t.n=1;break}throw new Error("Utilisateur non connecté");case 1:return t.n=2,e.sendEmailVerification();case 2:return t.a(2,{success:!0});case 3:throw t.p=3,n=t.v,console.error("❌ Erreur sendEmailVerification:",n),this.formatError(n);case 4:return t.a(2)}},t,this,[[0,3]])})),function(){return f.apply(this,arguments)})},{key:"applyActionCode",value:(h=My(Iy().m(function t(e){var n;return Iy().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,this.auth||this.initialize(),t.n=1,this.auth.applyActionCode(e);case 1:return t.a(2,{success:!0});case 2:throw t.p=2,n=t.v,console.error("❌ Erreur applyActionCode:",n),this.formatError(n);case 3:return t.a(2)}},t,this,[[0,2]])})),function(t){return h.apply(this,arguments)})},{key:"updateEmail",value:(c=My(Iy().m(function t(e){var n,r;return Iy().w(function(t){for(;;)switch(t.p=t.n){case 0:if(t.p=0,n=this.getCurrentUser()){t.n=1;break}throw new Error("Utilisateur non connecté");case 1:return t.n=2,n.updateEmail(e);case 2:return t.a(2,{success:!0});case 3:throw t.p=3,r=t.v,console.error("❌ Erreur updateEmail:",r),this.formatError(r);case 4:return t.a(2)}},t,this,[[0,3]])})),function(t){return c.apply(this,arguments)})},{key:"updateProfile",value:(u=My(Iy().m(function t(e){var n,r;return Iy().w(function(t){for(;;)switch(t.p=t.n){case 0:if(t.p=0,n=this.getCurrentUser()){t.n=1;break}throw new Error("Utilisateur non connecté");case 1:return t.n=2,n.updateProfile(e);case 2:return t.a(2,{success:!0});case 3:throw t.p=3,r=t.v,console.error("❌ Erreur updateProfile:",r),this.formatError(r);case 4:return t.a(2)}},t,this,[[0,3]])})),function(t){return u.apply(this,arguments)})},{key:"deleteAccount",value:(l=My(Iy().m(function t(){var e,n;return Iy().w(function(t){for(;;)switch(t.p=t.n){case 0:if(t.p=0,e=this.getCurrentUser()){t.n=1;break}throw new Error("Utilisateur non connecté");case 1:return t.n=2,e.delete();case 2:return this.currentUser=null,t.a(2,{success:!0});case 3:throw t.p=3,n=t.v,console.error("❌ Erreur deleteAccount:",n),this.formatError(n);case 4:return t.a(2)}},t,this,[[0,3]])})),function(){return l.apply(this,arguments)})},{key:"reauthenticateWithEmail",value:(s=My(Iy().m(function t(e,n){var r,i,o;return Iy().w(function(t){for(;;)switch(t.p=t.n){case 0:if(t.p=0,r=this.getCurrentUser()){t.n=1;break}throw new Error("Utilisateur non connecté");case 1:return i=firebase.auth.EmailAuthProvider.credential(e,n),t.n=2,r.reauthenticateWithCredential(i);case 2:return t.a(2,{success:!0});case 3:throw t.p=3,o=t.v,console.error("❌ Erreur reauthenticateWithEmail:",o),this.formatError(o);case 4:return t.a(2)}},t,this,[[0,3]])})),function(t,e){return s.apply(this,arguments)})},{key:"getIdToken",value:(a=My(Iy().m(function t(){var e,n,r,i,o=arguments;return Iy().w(function(t){for(;;)switch(t.p=t.n){case 0:if(e=o.length>0&&void 0!==o[0]&&o[0],t.p=1,n=this.getCurrentUser()){t.n=2;break}throw new Error("Utilisateur non connecté");case 2:return t.n=3,n.getIdToken(e);case 3:return r=t.v,t.a(2,r);case 4:throw t.p=4,i=t.v,console.error("❌ Erreur getIdToken:",i),this.formatError(i);case 5:return t.a(2)}},t,this,[[1,4]])})),function(){return a.apply(this,arguments)})},{key:"refreshToken",value:(o=My(Iy().m(function t(){return Iy().w(function(t){for(;;)if(0===t.n)return t.a(2,this.getIdToken(!0))},t,this)})),function(){return o.apply(this,arguments)})},{key:"onAuthStateChanged",value:function(t){var e=this;this.auth||this.initialize();var n=this.auth.onAuthStateChanged(function(n){e.currentUser=n,t(n?e.formatUser(n):null)});return this.authStateListeners.push(n),n}},{key:"signOut",value:(i=My(Iy().m(function t(){var e;return Iy().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,this.auth||this.initialize(),t.n=1,this.auth.signOut();case 1:return this.currentUser=null,t.a(2,{success:!0});case 2:throw t.p=2,e=t.v,console.error("❌ Erreur signOut:",e),this.formatError(e);case 3:return t.a(2)}},t,this,[[0,2]])})),function(){return i.apply(this,arguments)})},{key:"getCurrentUser",value:function(){return this.auth||this.initialize(),this.auth.currentUser}},{key:"isSignedIn",value:function(){return null!==this.getCurrentUser()}},{key:"linkWithEmail",value:(r=My(Iy().m(function t(e,n){var r,i,o,a;return Iy().w(function(t){for(;;)switch(t.p=t.n){case 0:if(t.p=0,r=this.getCurrentUser()){t.n=1;break}throw new Error("Utilisateur non connecté");case 1:return i=firebase.auth.EmailAuthProvider.credential(e,n),t.n=2,r.linkWithCredential(i);case 2:return o=t.v,t.a(2,{success:!0,user:this.formatUser(o.user)});case 3:throw t.p=3,a=t.v,console.error("❌ Erreur linkWithEmail:",a),this.formatError(a);case 4:return t.a(2)}},t,this,[[0,3]])})),function(t,e){return r.apply(this,arguments)})},{key:"unlinkProvider",value:(n=My(Iy().m(function t(e){var n,r;return Iy().w(function(t){for(;;)switch(t.p=t.n){case 0:if(t.p=0,n=this.getCurrentUser()){t.n=1;break}throw new Error("Utilisateur non connecté");case 1:return t.n=2,n.unlink(e);case 2:return t.a(2,{success:!0});case 3:throw t.p=3,r=t.v,console.error("❌ Erreur unlinkProvider:",r),this.formatError(r);case 4:return t.a(2)}},t,this,[[0,3]])})),function(t){return n.apply(this,arguments)})},{key:"formatUser",value:function(t){return t?{uid:t.uid,email:t.email,displayName:t.displayName,photoURL:t.photoURL,phoneNumber:t.phoneNumber,emailVerified:t.emailVerified,isAnonymous:t.isAnonymous,metadata:{creationTime:t.metadata.creationTime,lastSignInTime:t.metadata.lastSignInTime},providerId:t.providerId,providerData:t.providerData}:null}},{key:"formatError",value:function(t){return{code:t.code,message:{"auth/email-already-in-use":"Cet email est déjà utilisé","auth/invalid-email":"Email invalide","auth/operation-not-allowed":"Opération non autorisée","auth/weak-password":"Mot de passe trop faible","auth/user-disabled":"Compte désactivé","auth/user-not-found":"Utilisateur introuvable","auth/wrong-password":"Mot de passe incorrect","auth/too-many-requests":"Trop de tentatives, réessayez plus tard","auth/network-request-failed":"Erreur réseau","auth/popup-closed-by-user":"Popup fermée par l'utilisateur","auth/account-exists-with-different-credential":"Un compte existe déjà avec cet email","auth/requires-recent-login":"Ré-authentification requise"}[t.code]||t.message,originalError:t}}},{key:"destroy",value:function(){this.authStateListeners.forEach(function(t){return t()}),this.authStateListeners=[],this.auth=null,this.currentUser=null}}],e&&Ay(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n,r,i,o,a,s,l,u,c,h,f,d,p,y,v,m,g,b,w,x,k,S,T,P,O,C}();function By(t){return By="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},By(t)}function Ly(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var l=r&&r.prototype instanceof s?r:s,u=Object.create(l.prototype);return Wy(u,"_invoke",function(n,r,i){var o,s,l,u=0,c=i||[],h=!1,f={p:0,n:0,v:t,a:d,f:d.bind(t,4),d:function(e,n){return o=e,s=0,l=t,f.n=n,a}};function d(n,r){for(s=n,l=r,e=0;!h&&u&&!i&&e<c.length;e++){var i,o=c[e],d=f.p,p=o[2];n>3?(i=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=t):o[0]<=d&&((i=n<2&&d<o[1])?(s=0,f.v=r,f.n=o[1]):d<p&&(i=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(i||n>1)return a;throw h=!0,r}return function(i,c,p){if(u>1)throw TypeError("Generator is already running");for(h&&1===c&&d(c,p),s=c,l=p;(e=s<2?t:l)||!h;){o||(s?s<3?(s>1&&(f.n=-1),d(s,l)):f.n=l:f.v=l);try{if(u=2,o){if(s||(i="next"),e=o[i]){if(!(e=e.call(o,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,s<2&&(s=0)}else 1===s&&(e=o.return)&&e.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+i+"' method"),s=1);o=t}else if((e=(h=f.n<0)?l:n.call(r,f))!==a)break}catch(e){o=t,s=1,l=e}finally{u=1}}return{value:e,done:h}}}(n,i,o),!0),u}var a={};function s(){}function l(){}function u(){}e=Object.getPrototypeOf;var c=[][r]?e(e([][r]())):(Wy(e={},r,function(){return this}),e),h=u.prototype=s.prototype=Object.create(c);function f(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,u):(t.__proto__=u,Wy(t,i,"GeneratorFunction")),t.prototype=Object.create(h),t}return l.prototype=u,Wy(h,"constructor",u),Wy(u,"constructor",l),l.displayName="GeneratorFunction",Wy(u,i,"GeneratorFunction"),Wy(h),Wy(h,i,"Generator"),Wy(h,r,function(){return this}),Wy(h,"toString",function(){return"[object Generator]"}),(Ly=function(){return{w:o,m:f}})()}function Wy(t,e,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(t){i=0}Wy=function(t,e,n,r){function o(e,n){Wy(t,e,function(t){return this._invoke(e,n,t)})}e?i?i(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(o("next",0),o("throw",1),o("return",2))},Wy(t,e,n,r)}function Hy(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function zy(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function a(t){Hy(o,r,i,a,s,"next",t)}function s(t){Hy(o,r,i,a,s,"throw",t)}a(void 0)})}}function qy(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Uy(r.key),r)}}function Uy(t){var e=function(t){if("object"!=By(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=By(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==By(e)?e:e+""}const Ny=function(){return t=function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.config=e,this.app=null,this.isInitialized=!1,this.enablePersistence=!1!==e.enablePersistence,this.enableAnalytics=!1!==e.enableAnalytics,this.auth=null,this.db=null,this.storage=null,this.functions=null,this.messaging=null,this.analytics=null},e=[{key:"initialize",value:(r=zy(Ly().m(function t(){var e;return Ly().w(function(t){for(;;)switch(t.p=t.n){case 0:if(!this.isInitialized){t.n=1;break}return t.a(2,this.app);case 1:return t.p=1,t.n=2,this.loadFirebaseScripts();case 2:return this.app=firebase.initializeApp(this.config),this.enableAnalytics&&firebase.analytics&&(this.analytics=firebase.analytics()),this.isInitialized=!0,t.a(2,this.app);case 3:throw t.p=3,e=t.v,console.error("❌ Erreur initialisation Firebase:",e),e;case 4:return t.a(2)}},t,this,[[1,3]])})),function(){return r.apply(this,arguments)})},{key:"loadFirebaseScripts",value:(n=zy(Ly().m(function t(){var e,n,r=this;return Ly().w(function(t){for(;;)switch(t.n){case 0:return n=["https://www.gstatic.com/firebasejs/".concat(e="9.23.0","/firebase-app-compat.js"),"https://www.gstatic.com/firebasejs/".concat(e,"/firebase-auth-compat.js"),"https://www.gstatic.com/firebasejs/".concat(e,"/firebase-database-compat.js"),"https://www.gstatic.com/firebasejs/".concat(e,"/firebase-firestore-compat.js"),"https://www.gstatic.com/firebasejs/".concat(e,"/firebase-storage-compat.js"),"https://www.gstatic.com/firebasejs/".concat(e,"/firebase-functions-compat.js"),"https://www.gstatic.com/firebasejs/".concat(e,"/firebase-messaging-compat.js"),"https://www.gstatic.com/firebasejs/".concat(e,"/firebase-analytics-compat.js")],t.n=1,Promise.all(n.map(function(t){return r.loadScript(t)}));case 1:return t.a(2)}},t)})),function(){return n.apply(this,arguments)})},{key:"loadScript",value:function(t){return new Promise(function(e,n){if(document.querySelector('script[src="'.concat(t,'"]')))e();else{var r=document.createElement("script");r.src=t,r.async=!0,r.onload=e,r.onerror=function(){return n(new Error("Échec du chargement: ".concat(t)))},document.head.appendChild(r)}})}},{key:"getApp",value:function(){if(!this.isInitialized)throw new Error("Firebase non initialisé. Appelez initialize() d'abord.");return this.app}},{key:"getAuth",value:function(){return this.auth||(this.auth=firebase.auth()),this.auth}},{key:"getDatabase",value:function(){return this.db||(this.db=firebase.database()),this.db}},{key:"getFirestore",value:function(){return this.firestore||(this.firestore=firebase.firestore(),this.enablePersistence&&this.firestore.enablePersistence({synchronizeTabs:!0}).catch(function(t){"failed-precondition"===t.code?console.warn("⚠️ Persistance: plusieurs onglets ouverts"):"unimplemented"===t.code&&console.warn("⚠️ Persistance non supportée par ce navigateur")})),this.firestore}},{key:"getStorage",value:function(){return this.storage||(this.storage=firebase.storage()),this.storage}},{key:"getFunctions",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"us-central1";return this.functions||(this.functions=firebase.functions(t)),this.functions}},{key:"getMessaging",value:function(){return this.messaging||(this.messaging=firebase.messaging()),this.messaging}},{key:"getAnalytics",value:function(){return this.analytics||(this.analytics=firebase.analytics()),this.analytics}},{key:"getServerTimestamp",value:function(){return firebase.database.ServerValue.TIMESTAMP}},{key:"getFirestoreServerTimestamp",value:function(){return firebase.firestore.FieldValue.serverTimestamp()}},{key:"logEvent",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.analytics&&this.analytics.logEvent(t,e)}},{key:"setUserId",value:function(t){this.analytics&&this.analytics.setUserId(t)}},{key:"setUserProperty",value:function(t,e){var n,r,i;this.analytics&&this.analytics.setUserProperties((n={},i=e,(r=Uy(r=t))in n?Object.defineProperty(n,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[r]=i,n))}},{key:"isReady",value:function(){return this.isInitialized}},{key:"destroy",value:function(){this.app&&(this.app.delete(),this.app=null),this.auth=null,this.db=null,this.storage=null,this.functions=null,this.messaging=null,this.analytics=null,this.isInitialized=!1}}],e&&qy(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n,r}();function Vy(t){return Vy="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Vy(t)}function Gy(t){return function(t){if(Array.isArray(t))return Qy(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Xy(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Yy(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,u=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(t){u=!0,i=t}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}(t,e)||Xy(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Xy(t,e){if(t){if("string"==typeof t)return Qy(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Qy(t,e):void 0}}function Qy(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Ky(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var l=r&&r.prototype instanceof s?r:s,u=Object.create(l.prototype);return $y(u,"_invoke",function(n,r,i){var o,s,l,u=0,c=i||[],h=!1,f={p:0,n:0,v:t,a:d,f:d.bind(t,4),d:function(e,n){return o=e,s=0,l=t,f.n=n,a}};function d(n,r){for(s=n,l=r,e=0;!h&&u&&!i&&e<c.length;e++){var i,o=c[e],d=f.p,p=o[2];n>3?(i=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=t):o[0]<=d&&((i=n<2&&d<o[1])?(s=0,f.v=r,f.n=o[1]):d<p&&(i=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(i||n>1)return a;throw h=!0,r}return function(i,c,p){if(u>1)throw TypeError("Generator is already running");for(h&&1===c&&d(c,p),s=c,l=p;(e=s<2?t:l)||!h;){o||(s?s<3?(s>1&&(f.n=-1),d(s,l)):f.n=l:f.v=l);try{if(u=2,o){if(s||(i="next"),e=o[i]){if(!(e=e.call(o,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,s<2&&(s=0)}else 1===s&&(e=o.return)&&e.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+i+"' method"),s=1);o=t}else if((e=(h=f.n<0)?l:n.call(r,f))!==a)break}catch(e){o=t,s=1,l=e}finally{u=1}}return{value:e,done:h}}}(n,i,o),!0),u}var a={};function s(){}function l(){}function u(){}e=Object.getPrototypeOf;var c=[][r]?e(e([][r]())):($y(e={},r,function(){return this}),e),h=u.prototype=s.prototype=Object.create(c);function f(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,u):(t.__proto__=u,$y(t,i,"GeneratorFunction")),t.prototype=Object.create(h),t}return l.prototype=u,$y(h,"constructor",u),$y(u,"constructor",l),l.displayName="GeneratorFunction",$y(u,i,"GeneratorFunction"),$y(h),$y(h,i,"Generator"),$y(h,r,function(){return this}),$y(h,"toString",function(){return"[object Generator]"}),(Ky=function(){return{w:o,m:f}})()}function $y(t,e,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(t){i=0}$y=function(t,e,n,r){function o(e,n){$y(t,e,function(t){return this._invoke(e,n,t)})}e?i?i(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(o("next",0),o("throw",1),o("return",2))},$y(t,e,n,r)}function Jy(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function Zy(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Jy(Object(n),!0).forEach(function(e){tv(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Jy(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function tv(t,e,n){return(e=iv(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ev(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function nv(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function a(t){ev(o,r,i,a,s,"next",t)}function s(t){ev(o,r,i,a,s,"throw",t)}a(void 0)})}}function rv(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,iv(r.key),r)}}function iv(t){var e=function(t){if("object"!=Vy(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Vy(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Vy(e)?e:e+""}var ov=function(){return t=function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.core=e,this.db=null,this.listeners=new Map},e=[{key:"initialize",value:function(){return this.db||(this.db=this.core.getFirestore()),this.db}},{key:"collection",value:function(t){return this.db||this.initialize(),this.db.collection(t)}},{key:"doc",value:function(t){return this.db||this.initialize(),this.db.doc(t)}},{key:"add",value:(w=nv(Ky().m(function t(e,n){var r,i;return Ky().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.collection(e).add(Zy(Zy({},n),{},{createdAt:firebase.firestore.FieldValue.serverTimestamp(),updatedAt:firebase.firestore.FieldValue.serverTimestamp()}));case 1:return r=t.v,t.a(2,{success:!0,id:r.id,ref:r});case 2:throw t.p=2,i=t.v,console.error("❌ Erreur add ".concat(e,":"),i),i;case 3:return t.a(2)}},t,this,[[0,2]])})),function(t,e){return w.apply(this,arguments)})},{key:"set",value:(b=nv(Ky().m(function t(e,n){var r,i,o=arguments;return Ky().w(function(t){for(;;)switch(t.p=t.n){case 0:return r=o.length>2&&void 0!==o[2]?o[2]:{},t.p=1,t.n=2,this.doc(e).set(Zy(Zy({},n),{},{createdAt:firebase.firestore.FieldValue.serverTimestamp(),updatedAt:firebase.firestore.FieldValue.serverTimestamp()}),r);case 2:return t.a(2,{success:!0});case 3:throw t.p=3,i=t.v,console.error("❌ Erreur set ".concat(e,":"),i),i;case 4:return t.a(2)}},t,this,[[1,3]])})),function(t,e){return b.apply(this,arguments)})},{key:"update",value:(g=nv(Ky().m(function t(e,n){var r;return Ky().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.doc(e).update(Zy(Zy({},n),{},{updatedAt:firebase.firestore.FieldValue.serverTimestamp()}));case 1:return t.a(2,{success:!0});case 2:throw t.p=2,r=t.v,console.error("❌ Erreur update ".concat(e,":"),r),r;case 3:return t.a(2)}},t,this,[[0,2]])})),function(t,e){return g.apply(this,arguments)})},{key:"get",value:function(){var t=nv(Ky().m(function t(e){var n,r;return Ky().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.doc(e).get();case 1:if(!(n=t.v).exists){t.n=2;break}return t.a(2,Zy(Zy({id:n.id},n.data()),{},{ref:n.ref}));case 2:return t.a(2,null);case 3:t.n=5;break;case 4:throw t.p=4,r=t.v,console.error("❌ Erreur get ".concat(e,":"),r),r;case 5:return t.a(2)}},t,this,[[0,4]])}));return function(e){return t.apply(this,arguments)}}()},{key:"getCollection",value:(m=nv(Ky().m(function t(e){var n,r,i,o,a,s,l,u,c,h,f=arguments;return Ky().w(function(t){for(;;)switch(t.p=t.n){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},t.p=1,r=this.collection(e),n.where&&n.where.forEach(function(t){var e=Yy(t,3),n=e[0],i=e[1],o=e[2];r=r.where(n,i,o)}),n.orderBy&&(i=Array.isArray(n.orderBy)?n.orderBy:[n.orderBy],o=Yy(i,2),a=o[0],s=o[1],l=void 0===s?"asc":s,r=r.orderBy(a,l)),n.limit&&(r=r.limit(n.limit)),n.startAfter&&(r=r.startAfter(n.startAfter)),n.startAt&&(r=r.startAt(n.startAt)),n.endBefore&&(r=r.endBefore(n.endBefore)),n.endAt&&(r=r.endAt(n.endAt)),t.n=2,r.get();case 2:return u=t.v,c=u.docs.map(function(t){return Zy(Zy({id:t.id},t.data()),{},{ref:t.ref})}),t.a(2,{docs:c,size:u.size,empty:u.empty,lastDoc:u.docs[u.docs.length-1]});case 3:throw t.p=3,h=t.v,console.error("❌ Erreur getCollection ".concat(e,":"),h),h;case 4:return t.a(2)}},t,this,[[1,3]])})),function(t){return m.apply(this,arguments)})},{key:"delete",value:(v=nv(Ky().m(function t(e){var n;return Ky().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.doc(e).delete();case 1:return t.a(2,{success:!0});case 2:throw t.p=2,n=t.v,console.error("❌ Erreur delete ".concat(e,":"),n),n;case 3:return t.a(2)}},t,this,[[0,2]])})),function(t){return v.apply(this,arguments)})},{key:"listenDocument",value:function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i="doc_".concat(t,"_").concat(Date.now()),o=this.doc(t).onSnapshot(function(t){t.exists?e(Zy(Zy({id:t.id},t.data()),{},{ref:t.ref}),null):e(null,null)},function(e){console.error("❌ Erreur listener ".concat(t,":"),e),r&&r(e)});return this.listeners.set(i,o),function(){return n.unlisten(i)}}},{key:"listenCollection",value:function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o="col_".concat(t,"_").concat(Date.now()),a=this.collection(t);if(r.where&&r.where.forEach(function(t){var e=Yy(t,3),n=e[0],r=e[1],i=e[2];a=a.where(n,r,i)}),r.orderBy){var s=Yy(Array.isArray(r.orderBy)?r.orderBy:[r.orderBy],2),l=s[0],u=s[1],c=void 0===u?"asc":u;a=a.orderBy(l,c)}r.limit&&(a=a.limit(r.limit));var h=a.onSnapshot(function(t){var n=t.docs.map(function(t){return Zy(Zy({id:t.id},t.data()),{},{ref:t.ref})}),r=t.docChanges().map(function(t){return{type:t.type,doc:Zy({id:t.doc.id},t.doc.data()),oldIndex:t.oldIndex,newIndex:t.newIndex}});e({docs:n,changes:r,size:t.size,empty:t.empty},null)},function(e){console.error("❌ Erreur listener ".concat(t,":"),e),i&&i(e)});return this.listeners.set(o,h),function(){return n.unlisten(o)}}},{key:"unlisten",value:function(t){var e=this.listeners.get(t);e&&(e(),this.listeners.delete(t))}},{key:"unlistenAll",value:function(){this.listeners.forEach(function(t){t()}),this.listeners.clear()}},{key:"query",value:(y=nv(Ky().m(function t(e,n,r,i){var o,a=arguments;return Ky().w(function(t){for(;;)if(0===t.n)return o=a.length>4&&void 0!==a[4]?a[4]:{},t.a(2,this.getCollection(e,Zy({where:[[n,r,i]]},o)))},t,this)})),function(t,e,n,r){return y.apply(this,arguments)})},{key:"queryMultiple",value:(p=nv(Ky().m(function t(e,n){var r,i=arguments;return Ky().w(function(t){for(;;)if(0===t.n)return r=i.length>2&&void 0!==i[2]?i[2]:{},t.a(2,this.getCollection(e,Zy({where:n},r)))},t,this)})),function(t,e){return p.apply(this,arguments)})},{key:"searchByPrefix",value:(d=nv(Ky().m(function t(e,n,r){var i,o,a=arguments;return Ky().w(function(t){for(;;)if(0===t.n)return i=a.length>3&&void 0!==a[3]?a[3]:{},o=r.replace(/.$/,function(t){return String.fromCharCode(t.charCodeAt(0)+1)}),t.a(2,this.getCollection(e,Zy({where:[[n,">=",r],[n,"<",o]]},i)))},t,this)})),function(t,e,n){return d.apply(this,arguments)})},{key:"getNextPage",value:(f=nv(Ky().m(function t(e,n){var r,i,o=arguments;return Ky().w(function(t){for(;;)if(0===t.n)return r=o.length>2&&void 0!==o[2]?o[2]:10,i=o.length>3&&void 0!==o[3]?o[3]:{},t.a(2,this.getCollection(e,Zy(Zy({},i),{},{limit:r,startAfter:n})))},t,this)})),function(t,e){return f.apply(this,arguments)})},{key:"batch",value:function(){return this.db||this.initialize(),this.db.batch()}},{key:"batchWrite",value:(h=nv(Ky().m(function t(e){var n,r,i=this;return Ky().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,n=this.batch(),e.forEach(function(t){var e=t.type,r=t.path,o=t.data,a=i.doc(r);switch(e){case"set":n.set(a,Zy(Zy({},o),{},{updatedAt:firebase.firestore.FieldValue.serverTimestamp()}));break;case"update":n.update(a,Zy(Zy({},o),{},{updatedAt:firebase.firestore.FieldValue.serverTimestamp()}));break;case"delete":n.delete(a)}}),t.n=1,n.commit();case 1:return t.a(2,{success:!0});case 2:throw t.p=2,r=t.v,console.error("❌ Erreur batch write:",r),r;case 3:return t.a(2)}},t,this,[[0,2]])})),function(t){return h.apply(this,arguments)})},{key:"transaction",value:(c=nv(Ky().m(function t(e){var n,r;return Ky().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,this.db||this.initialize(),t.n=1,this.db.runTransaction(e);case 1:return n=t.v,t.a(2,n);case 2:throw t.p=2,r=t.v,console.error("❌ Erreur transaction:",r),r;case 3:return t.a(2)}},t,this,[[0,2]])})),function(t){return c.apply(this,arguments)})},{key:"increment",value:(u=nv(Ky().m(function t(e,n){var r,i,o=arguments;return Ky().w(function(t){for(;;)switch(t.p=t.n){case 0:return r=o.length>2&&void 0!==o[2]?o[2]:1,t.p=1,t.n=2,this.update(e,tv({},n,firebase.firestore.FieldValue.increment(r)));case 2:return t.a(2,{success:!0});case 3:throw t.p=3,i=t.v,console.error("❌ Erreur increment ".concat(e,":"),i),i;case 4:return t.a(2)}},t,this,[[1,3]])})),function(t,e){return u.apply(this,arguments)})},{key:"arrayUnion",value:(l=nv(Ky().m(function t(e,n,r){var i,o;return Ky().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.update(e,tv({},n,(i=firebase.firestore.FieldValue).arrayUnion.apply(i,Gy(r))));case 1:return t.a(2,{success:!0});case 2:throw t.p=2,o=t.v,console.error("❌ Erreur arrayUnion ".concat(e,":"),o),o;case 3:return t.a(2)}},t,this,[[0,2]])})),function(t,e,n){return l.apply(this,arguments)})},{key:"arrayRemove",value:(s=nv(Ky().m(function t(e,n,r){var i,o;return Ky().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.update(e,tv({},n,(i=firebase.firestore.FieldValue).arrayRemove.apply(i,Gy(r))));case 1:return t.a(2,{success:!0});case 2:throw t.p=2,o=t.v,console.error("❌ Erreur arrayRemove ".concat(e,":"),o),o;case 3:return t.a(2)}},t,this,[[0,2]])})),function(t,e,n){return s.apply(this,arguments)})},{key:"generateId",value:function(){return this.db||this.initialize(),this.db.collection("_").doc().id}},{key:"getServerTimestamp",value:function(){return firebase.firestore.FieldValue.serverTimestamp()}},{key:"getDeleteField",value:function(){return firebase.firestore.FieldValue.delete()}},{key:"exists",value:(a=nv(Ky().m(function t(e){var n;return Ky().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this.doc(e).get();case 1:return n=t.v,t.a(2,n.exists)}},t,this)})),function(t){return a.apply(this,arguments)})},{key:"count",value:(o=nv(Ky().m(function t(e){var n,r,i=arguments;return Ky().w(function(t){for(;;)switch(t.n){case 0:return n=i.length>1&&void 0!==i[1]?i[1]:{},t.n=1,this.getCollection(e,n);case 1:return r=t.v,t.a(2,r.size)}},t,this)})),function(t){return o.apply(this,arguments)})},{key:"logCompositeIndexUrl",value:function(t,e){console.log("📋 Index composé recommandé pour ".concat(t,":")),console.log("Champs: ".concat(e.join(", "))),console.log("Créez cet index dans la console Firebase Firestore")}},{key:"enablePersistence",value:(i=nv(Ky().m(function t(){var e,n,r=arguments;return Ky().w(function(t){for(;;)switch(t.p=t.n){case 0:return e=r.length>0&&void 0!==r[0]?r[0]:{},t.p=1,this.db||this.initialize(),t.n=2,this.db.enablePersistence({synchronizeTabs:!1!==e.synchronizeTabs});case 2:return t.a(2,{success:!0});case 3:throw t.p=3,"failed-precondition"===(n=t.v).code?console.warn("⚠️ Persistance: plusieurs onglets ouverts"):"unimplemented"===n.code&&console.warn("⚠️ Persistance non supportée"),n;case 4:return t.a(2)}},t,this,[[1,3]])})),function(){return i.apply(this,arguments)})},{key:"disableNetwork",value:(r=nv(Ky().m(function t(){var e;return Ky().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,this.db||this.initialize(),t.n=1,this.db.disableNetwork();case 1:return t.a(2,{success:!0});case 2:throw t.p=2,e=t.v,console.error("❌ Erreur disableNetwork:",e),e;case 3:return t.a(2)}},t,this,[[0,2]])})),function(){return r.apply(this,arguments)})},{key:"enableNetwork",value:(n=nv(Ky().m(function t(){var e;return Ky().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,this.db||this.initialize(),t.n=1,this.db.enableNetwork();case 1:return t.a(2,{success:!0});case 2:throw t.p=2,e=t.v,console.error("❌ Erreur enableNetwork:",e),e;case 3:return t.a(2)}},t,this,[[0,2]])})),function(){return n.apply(this,arguments)})},{key:"destroy",value:function(){this.unlistenAll(),this.db=null}}],e&&rv(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n,r,i,o,a,s,l,u,c,h,f,d,p,y,v,m,g,b,w}();const av=ov;function sv(t){return sv="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},sv(t)}function lv(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var l=r&&r.prototype instanceof s?r:s,u=Object.create(l.prototype);return uv(u,"_invoke",function(n,r,i){var o,s,l,u=0,c=i||[],h=!1,f={p:0,n:0,v:t,a:d,f:d.bind(t,4),d:function(e,n){return o=e,s=0,l=t,f.n=n,a}};function d(n,r){for(s=n,l=r,e=0;!h&&u&&!i&&e<c.length;e++){var i,o=c[e],d=f.p,p=o[2];n>3?(i=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=t):o[0]<=d&&((i=n<2&&d<o[1])?(s=0,f.v=r,f.n=o[1]):d<p&&(i=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(i||n>1)return a;throw h=!0,r}return function(i,c,p){if(u>1)throw TypeError("Generator is already running");for(h&&1===c&&d(c,p),s=c,l=p;(e=s<2?t:l)||!h;){o||(s?s<3?(s>1&&(f.n=-1),d(s,l)):f.n=l:f.v=l);try{if(u=2,o){if(s||(i="next"),e=o[i]){if(!(e=e.call(o,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,s<2&&(s=0)}else 1===s&&(e=o.return)&&e.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+i+"' method"),s=1);o=t}else if((e=(h=f.n<0)?l:n.call(r,f))!==a)break}catch(e){o=t,s=1,l=e}finally{u=1}}return{value:e,done:h}}}(n,i,o),!0),u}var a={};function s(){}function l(){}function u(){}e=Object.getPrototypeOf;var c=[][r]?e(e([][r]())):(uv(e={},r,function(){return this}),e),h=u.prototype=s.prototype=Object.create(c);function f(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,u):(t.__proto__=u,uv(t,i,"GeneratorFunction")),t.prototype=Object.create(h),t}return l.prototype=u,uv(h,"constructor",u),uv(u,"constructor",l),l.displayName="GeneratorFunction",uv(u,i,"GeneratorFunction"),uv(h),uv(h,i,"Generator"),uv(h,r,function(){return this}),uv(h,"toString",function(){return"[object Generator]"}),(lv=function(){return{w:o,m:f}})()}function uv(t,e,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(t){i=0}uv=function(t,e,n,r){function o(e,n){uv(t,e,function(t){return this._invoke(e,n,t)})}e?i?i(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(o("next",0),o("throw",1),o("return",2))},uv(t,e,n,r)}function cv(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function hv(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function a(t){cv(o,r,i,a,s,"next",t)}function s(t){cv(o,r,i,a,s,"throw",t)}a(void 0)})}}function fv(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,dv(r.key),r)}}function dv(t){var e=function(t){if("object"!=sv(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=sv(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==sv(e)?e:e+""}const pv=function(){return t=function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"us-central1";!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.core=e,this.region=n,this.functions=null},e=[{key:"initialize",value:function(){return this.functions||(this.functions=this.core.getFunctions(this.region)),this.functions}},{key:"call",value:(r=hv(lv().m(function t(e){var n,r,i,o,a=arguments;return lv().w(function(t){for(;;)switch(t.p=t.n){case 0:return n=a.length>1&&void 0!==a[1]?a[1]:{},t.p=1,this.functions||this.initialize(),r=this.functions.httpsCallable(e),t.n=2,r(n);case 2:return i=t.v,t.a(2,{success:!0,data:i.data});case 3:throw t.p=3,o=t.v,console.error("❌ Erreur call ".concat(e,":"),o),this.formatError(o);case 4:return t.a(2)}},t,this,[[1,3]])})),function(t){return r.apply(this,arguments)})},{key:"callWithTimeout",value:(n=hv(lv().m(function t(e){var n,r,i,o,a,s=arguments;return lv().w(function(t){for(;;)switch(t.p=t.n){case 0:return n=s.length>1&&void 0!==s[1]?s[1]:{},r=s.length>2&&void 0!==s[2]?s[2]:6e4,t.p=1,this.functions||this.initialize(),i=this.functions.httpsCallable(e,{timeout:r}),t.n=2,i(n);case 2:return o=t.v,t.a(2,{success:!0,data:o.data});case 3:throw t.p=3,a=t.v,console.error("❌ Erreur callWithTimeout ".concat(e,":"),a),this.formatError(a);case 4:return t.a(2)}},t,this,[[1,3]])})),function(t){return n.apply(this,arguments)})},{key:"formatError",value:function(t){return{code:t.code,message:t.message,details:t.details,originalError:t}}},{key:"useEmulator",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"localhost",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5001;this.functions||this.initialize(),this.functions.useEmulator(t,e)}},{key:"destroy",value:function(){this.functions=null}}],e&&fv(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n,r}();function yv(t){return yv="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yv(t)}function vv(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function mv(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?vv(Object(n),!0).forEach(function(e){gv(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):vv(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function gv(t,e,n){return(e=Tv(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function bv(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var l=r&&r.prototype instanceof s?r:s,u=Object.create(l.prototype);return wv(u,"_invoke",function(n,r,i){var o,s,l,u=0,c=i||[],h=!1,f={p:0,n:0,v:t,a:d,f:d.bind(t,4),d:function(e,n){return o=e,s=0,l=t,f.n=n,a}};function d(n,r){for(s=n,l=r,e=0;!h&&u&&!i&&e<c.length;e++){var i,o=c[e],d=f.p,p=o[2];n>3?(i=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=t):o[0]<=d&&((i=n<2&&d<o[1])?(s=0,f.v=r,f.n=o[1]):d<p&&(i=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(i||n>1)return a;throw h=!0,r}return function(i,c,p){if(u>1)throw TypeError("Generator is already running");for(h&&1===c&&d(c,p),s=c,l=p;(e=s<2?t:l)||!h;){o||(s?s<3?(s>1&&(f.n=-1),d(s,l)):f.n=l:f.v=l);try{if(u=2,o){if(s||(i="next"),e=o[i]){if(!(e=e.call(o,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,s<2&&(s=0)}else 1===s&&(e=o.return)&&e.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+i+"' method"),s=1);o=t}else if((e=(h=f.n<0)?l:n.call(r,f))!==a)break}catch(e){o=t,s=1,l=e}finally{u=1}}return{value:e,done:h}}}(n,i,o),!0),u}var a={};function s(){}function l(){}function u(){}e=Object.getPrototypeOf;var c=[][r]?e(e([][r]())):(wv(e={},r,function(){return this}),e),h=u.prototype=s.prototype=Object.create(c);function f(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,u):(t.__proto__=u,wv(t,i,"GeneratorFunction")),t.prototype=Object.create(h),t}return l.prototype=u,wv(h,"constructor",u),wv(u,"constructor",l),l.displayName="GeneratorFunction",wv(u,i,"GeneratorFunction"),wv(h),wv(h,i,"Generator"),wv(h,r,function(){return this}),wv(h,"toString",function(){return"[object Generator]"}),(bv=function(){return{w:o,m:f}})()}function wv(t,e,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(t){i=0}wv=function(t,e,n,r){function o(e,n){wv(t,e,function(t){return this._invoke(e,n,t)})}e?i?i(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(o("next",0),o("throw",1),o("return",2))},wv(t,e,n,r)}function xv(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function kv(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function a(t){xv(o,r,i,a,s,"next",t)}function s(t){xv(o,r,i,a,s,"throw",t)}a(void 0)})}}function Sv(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Tv(r.key),r)}}function Tv(t){var e=function(t){if("object"!=yv(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=yv(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==yv(e)?e:e+""}var Pv=function(){return t=function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.core=e,this.db=null,this.listeners=new Map},e=[{key:"initialize",value:function(){return this.db||(this.db=this.core.getDatabase()),this.db}},{key:"ref",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return this.db||this.initialize(),this.db.ref(t)}},{key:"set",value:(w=kv(bv().m(function t(e,n){var r;return bv().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.ref(e).set(n);case 1:return t.a(2,{success:!0});case 2:throw t.p=2,r=t.v,console.error("❌ Erreur set ".concat(e,":"),r),r;case 3:return t.a(2)}},t,this,[[0,2]])})),function(t,e){return w.apply(this,arguments)})},{key:"update",value:(b=kv(bv().m(function t(e,n){var r;return bv().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.ref(e).update(n);case 1:return t.a(2,{success:!0});case 2:throw t.p=2,r=t.v,console.error("❌ Erreur update ".concat(e,":"),r),r;case 3:return t.a(2)}},t,this,[[0,2]])})),function(t,e){return b.apply(this,arguments)})},{key:"push",value:(g=kv(bv().m(function t(e,n){var r,i;return bv().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,r=this.ref(e).push(),t.n=1,r.set(n);case 1:return t.a(2,{success:!0,key:r.key,ref:r});case 2:throw t.p=2,i=t.v,console.error("❌ Erreur push ".concat(e,":"),i),i;case 3:return t.a(2)}},t,this,[[0,2]])})),function(t,e){return g.apply(this,arguments)})},{key:"get",value:function(){var t=kv(bv().m(function t(e){var n,r;return bv().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.ref(e).once("value");case 1:return n=t.v,t.a(2,n.val());case 2:throw t.p=2,r=t.v,console.error("❌ Erreur get ".concat(e,":"),r),r;case 3:return t.a(2)}},t,this,[[0,2]])}));return function(e){return t.apply(this,arguments)}}()},{key:"remove",value:(m=kv(bv().m(function t(e){var n;return bv().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.ref(e).remove();case 1:return t.a(2,{success:!0});case 2:throw t.p=2,n=t.v,console.error("❌ Erreur remove ".concat(e,":"),n),n;case 3:return t.a(2)}},t,this,[[0,2]])})),function(t){return m.apply(this,arguments)})},{key:"listen",value:function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"value",i=this.ref(t),o="".concat(t,"_").concat(r,"_").concat(Date.now()),a=i.on(r,function(t){e(t,null)},function(n){console.error("❌ Erreur listener ".concat(t,":"),n),e(null,n)});return this.listeners.set(o,{ref:i,eventType:r,listener:a}),function(){return n.unlisten(o)}}},{key:"listenChildAdded",value:function(t,e){return this.listen(t,e,"child_added")}},{key:"listenChildChanged",value:function(t,e){return this.listen(t,e,"child_changed")}},{key:"listenChildRemoved",value:function(t,e){return this.listen(t,e,"child_removed")}},{key:"unlisten",value:function(t){var e=this.listeners.get(t);e&&(e.ref.off(e.eventType,e.listener),this.listeners.delete(t))}},{key:"unlistenAll",value:function(){this.listeners.forEach(function(t,e){t.ref.off(t.eventType,t.listener)}),this.listeners.clear()}},{key:"queryLimit",value:(v=kv(bv().m(function t(e,n){var r,i,o,a,s=arguments;return bv().w(function(t){for(;;)switch(t.p=t.n){case 0:return r=s.length>2&&void 0!==s[2]?s[2]:"first",t.p=1,i="first"===r?this.ref(e).limitToFirst(n):this.ref(e).limitToLast(n),t.n=2,i.once("value");case 2:return o=t.v,t.a(2,this.snapshotToArray(o));case 3:throw t.p=3,a=t.v,console.error("❌ Erreur queryLimit ".concat(e,":"),a),a;case 4:return t.a(2)}},t,this,[[1,3]])})),function(t,e){return v.apply(this,arguments)})},{key:"queryOrderBy",value:(y=kv(bv().m(function t(e,n){var r,i,o,a,s=arguments;return bv().w(function(t){for(;;)switch(t.p=t.n){case 0:return r=s.length>2&&void 0!==s[2]?s[2]:{},t.p=1,i=this.ref(e).orderByChild(n),void 0!==r.equalTo&&(i=i.equalTo(r.equalTo)),void 0!==r.startAt&&(i=i.startAt(r.startAt)),void 0!==r.endAt&&(i=i.endAt(r.endAt)),r.limitToFirst&&(i=i.limitToFirst(r.limitToFirst)),r.limitToLast&&(i=i.limitToLast(r.limitToLast)),t.n=2,i.once("value");case 2:return o=t.v,t.a(2,this.snapshotToArray(o));case 3:throw t.p=3,a=t.v,console.error("❌ Erreur queryOrderBy ".concat(e,":"),a),a;case 4:return t.a(2)}},t,this,[[1,3]])})),function(t,e){return y.apply(this,arguments)})},{key:"queryOrderByKey",value:(p=kv(bv().m(function t(e){var n,r,i,o,a=arguments;return bv().w(function(t){for(;;)switch(t.p=t.n){case 0:return n=a.length>1&&void 0!==a[1]?a[1]:{},t.p=1,r=this.ref(e).orderByKey(),n.startAt&&(r=r.startAt(n.startAt)),n.endAt&&(r=r.endAt(n.endAt)),n.limitToFirst&&(r=r.limitToFirst(n.limitToFirst)),n.limitToLast&&(r=r.limitToLast(n.limitToLast)),t.n=2,r.once("value");case 2:return i=t.v,t.a(2,this.snapshotToArray(i));case 3:throw t.p=3,o=t.v,console.error("❌ Erreur queryOrderByKey ".concat(e,":"),o),o;case 4:return t.a(2)}},t,this,[[1,3]])})),function(t){return p.apply(this,arguments)})},{key:"queryOrderByValue",value:(d=kv(bv().m(function t(e){var n,r,i,o,a=arguments;return bv().w(function(t){for(;;)switch(t.p=t.n){case 0:return n=a.length>1&&void 0!==a[1]?a[1]:{},t.p=1,r=this.ref(e).orderByValue(),n.startAt&&(r=r.startAt(n.startAt)),n.endAt&&(r=r.endAt(n.endAt)),n.limitToFirst&&(r=r.limitToFirst(n.limitToFirst)),n.limitToLast&&(r=r.limitToLast(n.limitToLast)),t.n=2,r.once("value");case 2:return i=t.v,t.a(2,this.snapshotToArray(i));case 3:throw t.p=3,o=t.v,console.error("❌ Erreur queryOrderByValue ".concat(e,":"),o),o;case 4:return t.a(2)}},t,this,[[1,3]])})),function(t){return d.apply(this,arguments)})},{key:"transaction",value:(f=kv(bv().m(function t(e,n){var r,i;return bv().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.ref(e).transaction(n);case 1:if(!(r=t.v).committed){t.n=2;break}return t.a(2,{committed:!0,snapshot:r.snapshot,value:r.snapshot.val()});case 2:return t.a(2,{committed:!1,snapshot:r.snapshot});case 3:t.n=5;break;case 4:throw t.p=4,i=t.v,console.error("❌ Erreur transaction ".concat(e,":"),i),i;case 5:return t.a(2)}},t,this,[[0,4]])})),function(t,e){return f.apply(this,arguments)})},{key:"increment",value:(h=kv(bv().m(function t(e){var n,r=arguments;return bv().w(function(t){for(;;)if(0===t.n)return n=r.length>1&&void 0!==r[1]?r[1]:1,t.a(2,this.transaction(e,function(t){return(t||0)+n}))},t,this)})),function(t){return h.apply(this,arguments)})},{key:"decrement",value:(c=kv(bv().m(function t(e){var n,r=arguments;return bv().w(function(t){for(;;)if(0===t.n)return n=r.length>1&&void 0!==r[1]?r[1]:1,t.a(2,this.increment(e,-n))},t,this)})),function(t){return c.apply(this,arguments)})},{key:"batchUpdate",value:(u=kv(bv().m(function t(e){var n;return bv().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.ref().update(e);case 1:return t.a(2,{success:!0});case 2:throw t.p=2,n=t.v,console.error("❌ Erreur batch update:",n),n;case 3:return t.a(2)}},t,this,[[0,2]])})),function(t){return u.apply(this,arguments)})},{key:"batchRemove",value:(l=kv(bv().m(function t(e){var n;return bv().w(function(t){for(;;)if(0===t.n)return n={},e.forEach(function(t){n[t]=null}),t.a(2,this.batchUpdate(n))},t,this)})),function(t){return l.apply(this,arguments)})},{key:"setupPresence",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.ref("status/".concat(t)),r=this.ref(".info/connected");return r.on("value",function(t){!0===t.val()&&(n.onDisconnect().set({state:"offline",last_changed:firebase.database.ServerValue.TIMESTAMP}),n.set(mv({state:"online",last_changed:firebase.database.ServerValue.TIMESTAMP},e)))}),function(){n.set({state:"offline",last_changed:firebase.database.ServerValue.TIMESTAMP}),r.off()}}},{key:"snapshotToArray",value:function(t){var e=[];return t.forEach(function(t){e.push(mv({key:t.key},t.val()))}),e}},{key:"snapshotToObject",value:function(t){var e={};return t.forEach(function(t){e[t.key]=t.val()}),e}},{key:"generateKey",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return this.ref(t).push().key}},{key:"getServerTimestamp",value:function(){return firebase.database.ServerValue.TIMESTAMP}},{key:"exists",value:(s=kv(bv().m(function t(e){var n;return bv().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this.ref(e).once("value");case 1:return n=t.v,t.a(2,n.exists())}},t,this)})),function(t){return s.apply(this,arguments)})},{key:"count",value:(a=kv(bv().m(function t(e){var n;return bv().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this.ref(e).once("value");case 1:return n=t.v,t.a(2,n.numChildren())}},t,this)})),function(t){return a.apply(this,arguments)})},{key:"getPriority",value:(o=kv(bv().m(function t(e){var n;return bv().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this.ref(e).once("value");case 1:return n=t.v,t.a(2,n.getPriority())}},t,this)})),function(t){return o.apply(this,arguments)})},{key:"setPriority",value:(i=kv(bv().m(function t(e,n){var r;return bv().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.ref(e).setPriority(n);case 1:return t.a(2,{success:!0});case 2:throw t.p=2,r=t.v,console.error("❌ Erreur setPriority ".concat(e,":"),r),r;case 3:return t.a(2)}},t,this,[[0,2]])})),function(t,e){return i.apply(this,arguments)})},{key:"signInAnonymously",value:(r=kv(bv().m(function t(){var e,n;return bv().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,e=this.core.getAuth(),t.n=1,e.signInAnonymously();case 1:return t.a(2,{success:!0});case 2:throw t.p=2,n=t.v,console.error("❌ Erreur connexion anonyme:",n),n;case 3:return t.a(2)}},t,this,[[0,2]])})),function(){return r.apply(this,arguments)})},{key:"getCurrentUser",value:function(){return this.core.getAuth().currentUser}},{key:"signOut",value:(n=kv(bv().m(function t(){var e;return bv().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.core.getAuth().signOut();case 1:return t.a(2,{success:!0});case 2:throw t.p=2,e=t.v,console.error("❌ Erreur déconnexion:",e),e;case 3:return t.a(2)}},t,this,[[0,2]])})),function(){return n.apply(this,arguments)})},{key:"destroy",value:function(){this.unlistenAll(),this.db=null}}],e&&Sv(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n,r,i,o,a,s,l,u,c,h,f,d,p,y,v,m,g,b,w}();const Ov=Pv;function Cv(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var l=r&&r.prototype instanceof s?r:s,u=Object.create(l.prototype);return Ev(u,"_invoke",function(n,r,i){var o,s,l,u=0,c=i||[],h=!1,f={p:0,n:0,v:t,a:d,f:d.bind(t,4),d:function(e,n){return o=e,s=0,l=t,f.n=n,a}};function d(n,r){for(s=n,l=r,e=0;!h&&u&&!i&&e<c.length;e++){var i,o=c[e],d=f.p,p=o[2];n>3?(i=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=t):o[0]<=d&&((i=n<2&&d<o[1])?(s=0,f.v=r,f.n=o[1]):d<p&&(i=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(i||n>1)return a;throw h=!0,r}return function(i,c,p){if(u>1)throw TypeError("Generator is already running");for(h&&1===c&&d(c,p),s=c,l=p;(e=s<2?t:l)||!h;){o||(s?s<3?(s>1&&(f.n=-1),d(s,l)):f.n=l:f.v=l);try{if(u=2,o){if(s||(i="next"),e=o[i]){if(!(e=e.call(o,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,s<2&&(s=0)}else 1===s&&(e=o.return)&&e.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+i+"' method"),s=1);o=t}else if((e=(h=f.n<0)?l:n.call(r,f))!==a)break}catch(e){o=t,s=1,l=e}finally{u=1}}return{value:e,done:h}}}(n,i,o),!0),u}var a={};function s(){}function l(){}function u(){}e=Object.getPrototypeOf;var c=[][r]?e(e([][r]())):(Ev(e={},r,function(){return this}),e),h=u.prototype=s.prototype=Object.create(c);function f(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,u):(t.__proto__=u,Ev(t,i,"GeneratorFunction")),t.prototype=Object.create(h),t}return l.prototype=u,Ev(h,"constructor",u),Ev(u,"constructor",l),l.displayName="GeneratorFunction",Ev(u,i,"GeneratorFunction"),Ev(h),Ev(h,i,"Generator"),Ev(h,r,function(){return this}),Ev(h,"toString",function(){return"[object Generator]"}),(Cv=function(){return{w:o,m:f}})()}function Ev(t,e,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(t){i=0}Ev=function(t,e,n,r){function o(e,n){Ev(t,e,function(t){return this._invoke(e,n,t)})}e?i?i(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(o("next",0),o("throw",1),o("return",2))},Ev(t,e,n,r)}function jv(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function Iv(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function a(t){jv(o,r,i,a,s,"next",t)}function s(t){jv(o,r,i,a,s,"throw",t)}a(void 0)})}}function Fv(t){return Fv="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Fv(t)}function Rv(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Mv(r.key),r)}}function Mv(t){var e=function(t){if("object"!=Fv(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Fv(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Fv(e)?e:e+""}var Av=function(){return t=function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.clientId=e,this.currency=n.currency||"EUR",this.locale=n.locale||"fr_FR",this.intent=n.intent||"capture",this.environment=n.environment||"sandbox",this.onPaymentSuccess=n.onPaymentSuccess||null,this.onPaymentError=n.onPaymentError||null,this.onPaymentCancel=n.onPaymentCancel||null,this.onPaymentProcessing=n.onPaymentProcessing||null,this.temporaryElements={script:null,container:null,buttonContainer:null,overlay:null},this.isInitialized=!1,this.buttons=[]},e=[{key:"createTemporaryElement",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:document.body;if("undefined"==typeof document)throw new Error("DOM non disponible");var r=document.createElement(t);return Object.keys(e).forEach(function(t){"style"===t&&"object"===Fv(e[t])?Object.assign(r.style,e[t]):"textContent"===t?r.textContent=e[t]:"innerHTML"===t?r.innerHTML=e[t]:t.startsWith("on")?r[t]=e[t]:r.setAttribute(t,e[t])}),n&&n.appendChild(r),r}},{key:"removeTemporaryElement",value:function(t){t&&t.parentNode&&t.parentNode.removeChild(t)}},{key:"cleanupTemporaryElements",value:function(){var t=this;Object.keys(this.temporaryElements).forEach(function(e){t.temporaryElements[e]&&(t.removeTemporaryElement(t.temporaryElements[e]),t.temporaryElements[e]=null)}),this.buttons.forEach(function(t){if(t&&"function"==typeof t.close)try{t.close()}catch(t){}}),this.buttons=[]}},{key:"createOverlay",value:function(){var t=this;return this.temporaryElements.overlay||(this.temporaryElements.overlay=this.createTemporaryElement("div",{id:"paypal-overlay-"+Date.now(),style:{position:"fixed",top:"0",left:"0",width:"100%",height:"100%",backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:"9998",display:"flex",justifyContent:"center",alignItems:"center",opacity:"0",transition:"opacity 0.3s ease"}},document.body),setTimeout(function(){t.temporaryElements.overlay&&(t.temporaryElements.overlay.style.opacity="1")},10)),this.temporaryElements.overlay}},{key:"createTemporaryModal",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.temporaryElements.container||(this.createOverlay(),this.temporaryElements.container=this.createTemporaryElement("div",{id:"paypal-modal-"+Date.now(),style:{position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",backgroundColor:"#fff",borderRadius:"12px",padding:"30px",width:"400px",maxWidth:"90%",maxHeight:"90%",overflow:"auto",zIndex:"9999",boxShadow:"0 10px 30px rgba(0, 0, 0, 0.3)",opacity:"0",transition:"opacity 0.3s ease, transform 0.3s ease"}},document.body),this.createTemporaryElement("button",{style:{position:"absolute",top:"15px",right:"15px",background:"none",border:"none",fontSize:"24px",color:"#666",cursor:"pointer",width:"30px",height:"30px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",transition:"background-color 0.2s"},textContent:"×",onmouseover:function(){this.style.backgroundColor="#f0f0f0"},onmouseout:function(){this.style.backgroundColor="transparent"},onclick:function(){return t.destroyTemporaryModal()}},this.temporaryElements.container),e.title&&this.createTemporaryElement("h2",{style:{margin:"0 0 20px 0",color:"#333",fontSize:"24px",textAlign:"center"},textContent:e.title},this.temporaryElements.container),setTimeout(function(){t.temporaryElements.container&&(t.temporaryElements.container.style.opacity="1",t.temporaryElements.container.style.transform="translate(-50%, -50%)")},10)),this.temporaryElements.container}},{key:"destroyTemporaryModal",value:function(){var t=this;this.temporaryElements.container&&(this.temporaryElements.container.style.opacity="0",this.temporaryElements.container.style.transform="translate(-50%, -60%)",setTimeout(function(){t.removeTemporaryElement(t.temporaryElements.container),t.temporaryElements.container=null},300)),this.temporaryElements.overlay&&(this.temporaryElements.overlay.style.opacity="0",setTimeout(function(){t.removeTemporaryElement(t.temporaryElements.overlay),t.temporaryElements.overlay=null},300))}},{key:"loadPayPalScript",value:function(){var t=this;return new Promise(function(e,n){if("undefined"==typeof paypal){var r=document.querySelector('script[src*="paypal.com/sdk/js"]');if(r){t.temporaryElements.script=r;var i=function(){"undefined"!=typeof paypal?e():setTimeout(i,100)};i()}else try{var o="https://www.paypal.com/sdk/js?client-id=".concat(t.clientId,"&currency=").concat(t.currency,"&locale=").concat(t.locale,"&intent=").concat(t.intent);t.temporaryElements.script=t.createTemporaryElement("script",{src:o,async:!0,onload:function(){"undefined"!=typeof paypal?e():n(new Error("SDK PayPal chargé mais non défini"))},onerror:function(){n(new Error("Échec du chargement du SDK PayPal")),t.cleanupTemporaryElements()}},document.head)}catch(t){n(t)}}else e()})}},{key:"initialize",value:(a=Iv(Cv().m(function t(){var e;return Cv().w(function(t){for(;;)switch(t.p=t.n){case 0:if(!this.isInitialized){t.n=1;break}return t.a(2);case 1:return t.p=1,t.n=2,this.loadPayPalScript();case 2:this.isInitialized=!0,console.log("✅ PayPal initialisé"),t.n=4;break;case 3:throw t.p=3,e=t.v,console.error("❌ Erreur initialisation PayPal:",e),this.cleanupTemporaryElements(),e;case 4:return t.a(2)}},t,this,[[1,3]])})),function(){return a.apply(this,arguments)})},{key:"createTemporaryButton",value:(o=Iv(Cv().m(function t(e){var n,r,i,o=this;return Cv().w(function(t){for(;;)switch(t.p=t.n){case 0:if(this.isInitialized){t.n=1;break}return t.n=1,this.initialize();case 1:if(t.p=1,n=this.createTemporaryModal({title:e.title||"Paiement sécurisé"}),this.temporaryElements.buttonContainer=this.createTemporaryElement("div",{id:"paypal-button-container-"+Date.now(),style:{margin:"20px 0",minHeight:"50px"}},n),r=paypal.Buttons({style:e.style||{layout:"vertical",color:"gold",shape:"rect",label:"paypal",height:45},createOrder:function(){var t=Iv(Cv().m(function t(n,r){var i,a,s;return Cv().w(function(t){for(;;)switch(t.p=t.n){case 0:if(o.onPaymentProcessing&&o.onPaymentProcessing(),t.p=1,!e.serverUrl){t.n=4;break}return t.n=2,fetch(e.serverUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({amount:e.amount,currency:e.currency||o.currency,description:e.description||"",items:e.items||[]})});case 2:return i=t.v,t.n=3,i.json();case 3:return a=t.v,t.a(2,a.orderID);case 4:return t.a(2,r.order.create({purchase_units:[{amount:{currency_code:e.currency||o.currency,value:e.amount,breakdown:e.breakdown||void 0},description:e.description||"",items:e.items||void 0,shipping:e.shipping||void 0}],application_context:{brand_name:e.brandName||"",shipping_preference:e.shippingPreference||"NO_SHIPPING"}}));case 5:throw t.p=5,s=t.v,console.error("❌ Erreur createOrder:",s),o.onPaymentError&&o.onPaymentError(s),s;case 6:return t.a(2)}},t,null,[[1,5]])}));return function(e,n){return t.apply(this,arguments)}}(),onApprove:function(){var t=Iv(Cv().m(function t(n,r){var i,a;return Cv().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,r.order.capture();case 1:if(i=t.v,console.log("✅ Paiement PayPal réussi:",i),o.onPaymentSuccess&&o.onPaymentSuccess(i),setTimeout(function(){o.destroyTemporaryModal()},1e3),!e.onApproveUrl){t.n=2;break}return t.n=2,fetch(e.onApproveUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({orderID:n.orderID,details:i})});case 2:return t.a(2,i);case 3:throw t.p=3,a=t.v,console.error("❌ Erreur onApprove:",a),o.onPaymentError&&o.onPaymentError(a),a;case 4:return t.a(2)}},t,null,[[0,3]])}));return function(e,n){return t.apply(this,arguments)}}(),onCancel:function(t){console.log("⚠️ Paiement annulé:",t),o.onPaymentCancel&&o.onPaymentCancel(t)},onError:function(t){console.error("❌ Erreur PayPal:",t),o.onPaymentError&&o.onPaymentError(t)}}),!r.isEligible()){t.n=3;break}return t.n=2,r.render("#".concat(this.temporaryElements.buttonContainer.id));case 2:return this.buttons.push(r),this.createTemporaryElement("p",{style:{textAlign:"center",color:"#666",fontSize:"14px",marginTop:"20px"},textContent:"Paiement 100% sécurisé par PayPal"},n),console.log("✅ Bouton PayPal créé dans modal temporaire"),t.a(2,r);case 3:throw new Error("Bouton PayPal non éligible");case 4:t.n=6;break;case 5:throw t.p=5,i=t.v,console.error("❌ Erreur création bouton:",i),this.cleanupTemporaryElements(),i;case 6:return t.a(2)}},t,this,[[1,5]])})),function(t){return o.apply(this,arguments)})},{key:"createAlternativePaymentForm",value:(i=Iv(Cv().m(function t(e){var n,r,i,o=this;return Cv().w(function(t){for(;;)switch(t.p=t.n){case 0:if(this.isInitialized){t.n=1;break}return t.n=1,this.initialize();case 1:return t.p=1,n=this.createTemporaryModal({title:"Paiement par carte bancaire"}),this.temporaryElements.buttonContainer=this.createTemporaryElement("div",{id:"paypal-cards-container-"+Date.now(),style:{margin:"20px 0"}},n),r=paypal.Buttons({fundingSource:void 0,style:e.style||{layout:"vertical",color:"black",shape:"rect",label:"checkout",height:45},createOrder:function(){var t=Iv(Cv().m(function t(n,r){return Cv().w(function(t){for(;;)if(0===t.n)return t.a(2,o.createOrder(e))},t)}));return function(e,n){return t.apply(this,arguments)}}(),onApprove:function(){var t=Iv(Cv().m(function t(e,n){var r;return Cv().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,n.order.capture();case 1:return r=t.v,o.onPaymentSuccess&&o.onPaymentSuccess(r),setTimeout(function(){o.destroyTemporaryModal()},1e3),t.a(2,r)}},t)}));return function(e,n){return t.apply(this,arguments)}}(),onCancel:function(t){o.onPaymentCancel&&o.onPaymentCancel(t)},onError:function(t){o.onPaymentError&&o.onPaymentError(t)}}),t.n=2,r.render("#".concat(this.temporaryElements.buttonContainer.id));case 2:return this.buttons.push(r),console.log("✅ Formulaire de paiement alternatif créé"),t.a(2,r);case 3:throw t.p=3,i=t.v,console.error("❌ Erreur création formulaire:",i),this.cleanupTemporaryElements(),i;case 4:return t.a(2)}},t,this,[[1,3]])})),function(t){return i.apply(this,arguments)})},{key:"createOrder",value:(r=Iv(Cv().m(function t(e){var n,r;return Cv().w(function(t){for(;;)switch(t.n){case 0:if(this.onPaymentProcessing&&this.onPaymentProcessing(),!e.serverUrl){t.n=3;break}return t.n=1,fetch(e.serverUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({amount:e.amount,currency:e.currency||this.currency,description:e.description||"",items:e.items||[]})});case 1:return n=t.v,t.n=2,n.json();case 2:return r=t.v,t.a(2,r.orderID);case 3:return t.a(2,paypal.rest.payment.create({transactions:[{amount:{total:e.amount,currency:e.currency||this.currency}}]}))}},t,this)})),function(t){return r.apply(this,arguments)})},{key:"startPaymentFlow",value:(n=Iv(Cv().m(function t(e){var n;return Cv().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.initialize();case 1:return t.n=2,this.createTemporaryButton(e);case 2:return t.a(2,{success:!0,message:"Interface de paiement PayPal prête"});case 3:throw t.p=3,n=t.v,console.error("❌ Erreur démarrage paiement:",n),this.cleanupTemporaryElements(),n;case 4:return t.a(2)}},t,this,[[0,3]])})),function(t){return n.apply(this,arguments)})},{key:"closePaymentFlow",value:function(){this.destroyTemporaryModal()}},{key:"destroy",value:function(){this.destroyTemporaryModal(),this.cleanupTemporaryElements(),this.isInitialized=!1,console.log("✅ PayPalPayment détruit proprement")}},{key:"destroyWithCallback",value:function(t){this.destroy(),"function"==typeof t&&t()}}],e&&Rv(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n,r,i,o,a}();Av.isPayPalSupported=function(){return"undefined"!=typeof window&&"undefined"!=typeof document&&"undefined"!=typeof paypal},Av.getSupportedFundingSources=function(){return"undefined"==typeof paypal?[]:paypal.getFundingSources?paypal.getFundingSources().map(function(t){return{source:t,eligible:!paypal.isFundingEligible||paypal.isFundingEligible(t)}}):[]};const _v=Av;function Dv(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function Bv(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Dv(Object(n),!0).forEach(function(e){Lv(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Dv(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function Lv(t,e,n){return(e=Vv(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Wv(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var l=r&&r.prototype instanceof s?r:s,u=Object.create(l.prototype);return Hv(u,"_invoke",function(n,r,i){var o,s,l,u=0,c=i||[],h=!1,f={p:0,n:0,v:t,a:d,f:d.bind(t,4),d:function(e,n){return o=e,s=0,l=t,f.n=n,a}};function d(n,r){for(s=n,l=r,e=0;!h&&u&&!i&&e<c.length;e++){var i,o=c[e],d=f.p,p=o[2];n>3?(i=p===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=t):o[0]<=d&&((i=n<2&&d<o[1])?(s=0,f.v=r,f.n=o[1]):d<p&&(i=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,f.n=p,s=0))}if(i||n>1)return a;throw h=!0,r}return function(i,c,p){if(u>1)throw TypeError("Generator is already running");for(h&&1===c&&d(c,p),s=c,l=p;(e=s<2?t:l)||!h;){o||(s?s<3?(s>1&&(f.n=-1),d(s,l)):f.n=l:f.v=l);try{if(u=2,o){if(s||(i="next"),e=o[i]){if(!(e=e.call(o,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,s<2&&(s=0)}else 1===s&&(e=o.return)&&e.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+i+"' method"),s=1);o=t}else if((e=(h=f.n<0)?l:n.call(r,f))!==a)break}catch(e){o=t,s=1,l=e}finally{u=1}}return{value:e,done:h}}}(n,i,o),!0),u}var a={};function s(){}function l(){}function u(){}e=Object.getPrototypeOf;var c=[][r]?e(e([][r]())):(Hv(e={},r,function(){return this}),e),h=u.prototype=s.prototype=Object.create(c);function f(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,u):(t.__proto__=u,Hv(t,i,"GeneratorFunction")),t.prototype=Object.create(h),t}return l.prototype=u,Hv(h,"constructor",u),Hv(u,"constructor",l),l.displayName="GeneratorFunction",Hv(u,i,"GeneratorFunction"),Hv(h),Hv(h,i,"Generator"),Hv(h,r,function(){return this}),Hv(h,"toString",function(){return"[object Generator]"}),(Wv=function(){return{w:o,m:f}})()}function Hv(t,e,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(t){i=0}Hv=function(t,e,n,r){function o(e,n){Hv(t,e,function(t){return this._invoke(e,n,t)})}e?i?i(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(o("next",0),o("throw",1),o("return",2))},Hv(t,e,n,r)}function zv(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function qv(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function a(t){zv(o,r,i,a,s,"next",t)}function s(t){zv(o,r,i,a,s,"throw",t)}a(void 0)})}}function Uv(t){return Uv="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Uv(t)}function Nv(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Vv(r.key),r)}}function Vv(t){var e=function(t){if("object"!=Uv(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Uv(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Uv(e)?e:e+""}var Gv=function(){return t=function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.publishableKey=e,this.stripe=null,this.elements=null,this.cardElement=null,this.canvasContainer=n.canvasContainer||null,this.canvasContext=n.canvasContext||null,this.onElementReady=n.onElementReady||null,this.onErrorDisplay=n.onErrorDisplay||null,this.locale=n.locale||"fr",this.appearance=n.appearance||{theme:"stripe",variables:{colorPrimary:"#0570de",colorBackground:"#ffffff",colorText:"#30313d",colorDanger:"#df1b41",fontFamily:"system-ui, sans-serif",spacingUnit:"4px",borderRadius:"8px"}},this.onPaymentSuccess=n.onPaymentSuccess||null,this.onPaymentError=n.onPaymentError||null,this.onPaymentProcessing=n.onPaymentProcessing||null,this.temporaryElements={script:null,container:null,iframeContainer:null},this.isInitialized=!1,this.isProcessing=!1,this.paymentFormData={cardNumber:"",expiry:"",cvc:"",postalCode:""}},e=[{key:"createTemporaryElement",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:document.body;if("undefined"==typeof document)throw new Error("DOM non disponible");var r=document.createElement(t);return Object.keys(e).forEach(function(t){"style"===t&&"object"===Uv(e[t])?Object.assign(r.style,e[t]):"textContent"===t?r.textContent=e[t]:"innerHTML"===t?r.innerHTML=e[t]:r.setAttribute(t,e[t])}),n&&n.appendChild(r),r}},{key:"removeTemporaryElement",value:function(t){t&&t.parentNode&&t.parentNode.removeChild(t)}},{key:"cleanupTemporaryElements",value:function(){var t=this;Object.keys(this.temporaryElements).forEach(function(e){t.temporaryElements[e]&&(t.removeTemporaryElement(t.temporaryElements[e]),t.temporaryElements[e]=null)})}},{key:"initialize",value:(s=qv(Wv().m(function t(){var e;return Wv().w(function(t){for(;;)switch(t.p=t.n){case 0:if(!this.isInitialized){t.n=1;break}return t.a(2);case 1:return t.p=1,t.n=2,this.loadStripeScript();case 2:this.stripe=window.Stripe(this.publishableKey,{locale:this.locale,betas:["elements_enable_deferred_intent_beta_1"]}),this.isInitialized=!0,t.n=4;break;case 3:throw t.p=3,e=t.v,console.error("❌ Erreur initialisation Stripe:",e),this.cleanupTemporaryElements(),e;case 4:return t.a(2)}},t,this,[[1,3]])})),function(){return s.apply(this,arguments)})},{key:"loadStripeScript",value:function(){var t=this;return new Promise(function(e,n){if(void 0===window.Stripe){var r=document.querySelector('script[src="https://js.stripe.com/v3/"]');if(r)return t.temporaryElements.script=r,void e();try{t.temporaryElements.script=t.createTemporaryElement("script",{src:"https://js.stripe.com/v3/",async:!0,onload:function(){void 0!==window.Stripe?e():n(new Error("Stripe.js chargé mais non défini"))},onerror:function(){n(new Error("Échec du chargement de Stripe.js")),t.cleanupTemporaryElements()}},document.head)}catch(t){n(t)}}else e()})}},{key:"createTemporaryContainer",value:function(){var t=this;return this.temporaryElements.container?this.temporaryElements.container:(this.temporaryElements.container=this.createTemporaryElement("div",{id:"stripe-payment-container-"+Date.now(),style:{position:"fixed",top:"0",left:"0",width:"100%",height:"100%",zIndex:"9999",backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",justifyContent:"center",alignItems:"center"}},document.body),this.createTemporaryElement("button",{style:{position:"absolute",top:"20px",right:"20px",background:"none",border:"none",fontSize:"24px",color:"#fff",cursor:"pointer",zIndex:"10000"},textContent:"×",onclick:function(){return t.destroyTemporaryContainer()}},this.temporaryElements.container),this.createTemporaryElement("div",{style:{backgroundColor:"#fff",padding:"30px",borderRadius:"12px",width:"400px",maxWidth:"90%",maxHeight:"90%",overflow:"auto",position:"relative"}},this.temporaryElements.container))}},{key:"destroyTemporaryContainer",value:function(){this.temporaryElements.container&&(this.removeTemporaryElement(this.temporaryElements.container),this.temporaryElements.container=null)}},{key:"createCardElementInTemporaryContainer",value:(a=qv(Wv().m(function t(){var e,n,r,i=this;return Wv().w(function(t){for(;;)switch(t.p=t.n){case 0:if(this.isInitialized){t.n=1;break}throw new Error("Stripe non initialisé");case 1:return t.p=1,e=this.createTemporaryContainer(),n=this.createTemporaryElement("div",{id:"stripe-card-element-"+Date.now(),style:{margin:"20px 0"}},e),this.elements=this.stripe.elements({appearance:this.appearance,locale:this.locale}),this.cardElement=this.elements.create("card",{style:{base:{fontSize:"16px",color:"#32325d",fontFamily:"system-ui, sans-serif","::placeholder":{color:"#aab7c4"}},invalid:{color:"#fa755a",iconColor:"#fa755a"}},hidePostalCode:!1}),this.cardElement.mount(n),this.createTemporaryElement("button",{style:{backgroundColor:"#5469d4",color:"#fff",border:"none",padding:"12px 24px",borderRadius:"6px",fontSize:"16px",cursor:"pointer",width:"100%",marginTop:"20px"},textContent:"Payer",onclick:function(){return i.processPaymentWithTemporaryElement()}},e),this.setupElementListeners(),t.a(2,this.cardElement);case 2:throw t.p=2,r=t.v,console.error("❌ Erreur création élément:",r),this.cleanupTemporaryElements(),r;case 3:return t.a(2)}},t,this,[[1,2]])})),function(){return a.apply(this,arguments)})},{key:"setupElementListeners",value:function(){var t=this;this.cardElement&&this.cardElement.on("change",function(e){e.error&&t.onErrorDisplay&&t.onErrorDisplay(e.error.message),e.value&&(t.paymentFormData=Bv(Bv({},t.paymentFormData),e.value))})}},{key:"processPaymentWithTemporaryElement",value:(o=qv(Wv().m(function t(e){var n,r,i,o,a;return Wv().w(function(t){for(;;)switch(t.p=t.n){case 0:if(this.cardElement&&!this.isProcessing){t.n=1;break}return t.a(2);case 1:return this.isProcessing=!0,t.p=2,t.n=3,this.createPaymentIntent(e);case 3:return n=t.v,t.n=4,this.stripe.confirmCardPayment(n,{payment_method:{card:this.cardElement},billing_details:e.billingDetails||{}});case 4:if(r=t.v,i=r.error,o=r.paymentIntent,!i){t.n=5;break}throw i;case 5:return this.onPaymentSuccess&&this.onPaymentSuccess(o),this.destroyTemporaryContainer(),t.a(2,{success:!0,paymentIntent:o});case 6:return t.p=6,a=t.v,console.error("❌ Erreur paiement:",a),this.onPaymentError&&this.onPaymentError(a),t.a(2,{success:!1,error:a.message});case 7:return t.p=7,this.isProcessing=!1,t.f(7);case 8:return t.a(2)}},t,this,[[2,6,7,8]])})),function(t){return o.apply(this,arguments)})},{key:"createPaymentIntent",value:(i=qv(Wv().m(function t(e){var n,r,i,o,a,s,l,u,c,h,f,d;return Wv().w(function(t){for(;;)switch(t.p=t.n){case 0:return n=e.amount,r=e.currency,i=void 0===r?"eur":r,o=e.description,a=void 0===o?"":o,s=e.metadata,l=void 0===s?{}:s,u=e.serverUrl,c=void 0===u?"/api/create-payment-intent":u,t.p=1,t.n=2,fetch(c,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({amount:n,currency:i,description:a,metadata:l})});case 2:if((h=t.v).ok){t.n=3;break}throw new Error("Erreur création PaymentIntent");case 3:return t.n=4,h.json();case 4:return f=t.v,t.a(2,f.clientSecret);case 5:throw t.p=5,d=t.v,console.error("❌ Erreur createPaymentIntent:",d),d;case 6:return t.a(2)}},t,null,[[1,5]])})),function(t){return i.apply(this,arguments)})},{key:"startPaymentFlow",value:(r=qv(Wv().m(function t(e){var n;return Wv().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.initialize();case 1:return t.n=2,this.createCardElementInTemporaryContainer();case 2:return this.currentPaymentData=e,t.a(2,{success:!0,message:"Interface de paiement prête"});case 3:throw t.p=3,n=t.v,console.error("❌ Erreur démarrage paiement:",n),this.cleanupTemporaryElements(),n;case 4:return t.a(2)}},t,this,[[0,3]])})),function(t){return r.apply(this,arguments)})},{key:"redirectToCheckout",value:(n=qv(Wv().m(function t(e){var n,r,i,o;return Wv().w(function(t){for(;;)switch(t.p=t.n){case 0:if(this.isInitialized){t.n=1;break}return t.n=1,this.initialize();case 1:return t.p=1,t.n=2,fetch("/api/create-checkout-session",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({amount:e.amount,currency:e.currency||"eur",successUrl:e.successUrl||"".concat(window.location.origin,"/success"),cancelUrl:e.cancelUrl||"".concat(window.location.origin,"/cancel"),metadata:e.metadata||{}})});case 2:return n=t.v,t.n=3,n.json();case 3:return r=t.v,t.n=4,this.stripe.redirectToCheckout({sessionId:r.id});case 4:if(!(i=t.v).error){t.n=5;break}throw i.error;case 5:t.n=7;break;case 6:throw t.p=6,o=t.v,console.error("❌ Erreur Checkout:",o),o;case 7:return t.a(2)}},t,this,[[1,6]])})),function(t){return n.apply(this,arguments)})},{key:"destroy",value:function(){if(this.cardElement){try{this.cardElement.destroy()}catch(t){}this.cardElement=null}this.elements&&(this.elements=null),this.stripe=null,this.isInitialized=!1,this.isProcessing=!1,this.cleanupTemporaryElements()}},{key:"destroyWithCallback",value:function(t){this.destroy(),"function"==typeof t&&t()}}],e&&Nv(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n,r,i,o,a,s}();Gv.isStripeSupported=function(){return"undefined"!=typeof window&&"undefined"!=typeof document&&void 0!==window.Stripe},Gv.createHiddenInput=function(t,e){var n=document.createElement("input");return n.type="hidden",n.name=t,n.value=e,n};const Yv=Gv;function Xv(t){return Xv="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xv(t)}function Qv(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Kv(r.key),r)}}function Kv(t){var e=function(t){if("object"!=Xv(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Xv(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Xv(e)?e:e+""}const $v=function(){return t=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.sentryDsn=e.sentryDsn,this.environment=e.environment||"production",this.logLevel=e.logLevel||"error",this.errors=[]},e=[{key:"captureError",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n={message:t.message,stack:t.stack,context:e,timestamp:Date.now(),userAgent:navigator.userAgent,url:window.location.href};return this.errors.push(n),"development"===this.environment&&console.error("🚨 Error captured:",n),this.sentryDsn&&"production"===this.environment&&this.sendToSentry(n),n}},{key:"sendToSentry",value:function(t){window.Sentry&&window.Sentry.captureException(new Error(t.message),{extra:t.context})}},{key:"wrap",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return function(){for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];try{return t.apply(void 0,i)}catch(t){throw e.captureError(t,{context:n,args:i}),t}}}}],e&&Qv(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function Jv(t){return Jv="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Jv(t)}function Zv(t){return function(t){if(Array.isArray(t))return tm(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return tm(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?tm(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function tm(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function em(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,nm(r.key),r)}}function nm(t){var e=function(t){if("object"!=Jv(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Jv(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Jv(e)?e:e+""}const rm=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.metrics={fps:60,frameTime:0,memoryUsage:0,renderTime:0,componentCount:0},this.fpsHistory=[],this.frameCount=0,this.lastTime=performance.now(),this.isMonitoring=!1},(e=[{key:"startMonitoring",value:function(){this.isMonitoring=!0,this.updateMetrics()}},{key:"stopMonitoring",value:function(){this.isMonitoring=!1}},{key:"updateMetrics",value:function(){var t=this;if(this.isMonitoring){var e=performance.now(),n=e-this.lastTime;this.frameCount++,n>=1e3&&(this.metrics.fps=Math.round(1e3*this.frameCount/n),this.fpsHistory.push(this.metrics.fps),this.fpsHistory.length>60&&this.fpsHistory.shift(),this.frameCount=0,this.lastTime=e,this.metrics.fps<30&&console.warn("⚠️ Low FPS detected:",this.metrics.fps)),performance.memory&&(this.metrics.memoryUsage=Math.round(performance.memory.usedJSHeapSize/1048576)),requestAnimationFrame(function(){return t.updateMetrics()})}}},{key:"measureRender",value:function(t){var e=performance.now();t();var n=performance.now();return this.metrics.renderTime=n-e,this.metrics.renderTime}},{key:"getReport",value:function(){return{current:this.metrics,averageFPS:this.fpsHistory.reduce(function(t,e){return t+e},0)/this.fpsHistory.length,minFPS:Math.min.apply(Math,Zv(this.fpsHistory)),maxFPS:Math.max.apply(Math,Zv(this.fpsHistory))}}}])&&em(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function im(t){return im="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},im(t)}function om(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,am(r.key),r)}}function am(t){var e=function(t){if("object"!=im(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=im(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==im(e)?e:e+""}const sm=function(){return t=function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.framework=e,this.focusedComponent=null,this.ariaLiveRegion=null,this.setupAccessibility()},e=[{key:"setupAccessibility",value:function(){this.ariaLiveRegion=document.createElement("div"),this.ariaLiveRegion.setAttribute("role","status"),this.ariaLiveRegion.setAttribute("aria-live","polite"),this.ariaLiveRegion.setAttribute("aria-atomic","true"),this.ariaLiveRegion.style.position="absolute",this.ariaLiveRegion.style.left="-10000px",this.ariaLiveRegion.style.width="1px",this.ariaLiveRegion.style.height="1px",this.ariaLiveRegion.style.overflow="hidden",document.body.appendChild(this.ariaLiveRegion),this.framework.canvas.setAttribute("tabindex","0"),this.framework.canvas.setAttribute("role","application"),this.framework.canvas.setAttribute("aria-label","Interactive canvas application"),this.framework.canvas.addEventListener("keydown",this.handleKeyDown.bind(this))}},{key:"announce",value:function(t){var e=this;this.ariaLiveRegion.textContent=t,setTimeout(function(){e.ariaLiveRegion.textContent=""},100)}},{key:"handleKeyDown",value:function(t){var e=this.framework.components.filter(function(t){return t.visible}),n=e.indexOf(this.focusedComponent);switch(t.key){case"Tab":t.preventDefault();var r=t.shiftKey?(n-1+e.length)%e.length:(n+1)%e.length;this.focusComponent(e[r]);break;case"Enter":case" ":t.preventDefault(),this.focusedComponent&&this.focusedComponent.onClick&&(this.focusedComponent.onClick(),this.announce("Activated: ".concat(this.getComponentLabel(this.focusedComponent))));break;case"Escape":t.preventDefault(),this.blur()}}},{key:"focusComponent",value:function(t){this.focusedComponent&&(this.focusedComponent.focused=!1),this.focusedComponent=t,t.focused=!0,this.announce("Focused: ".concat(this.getComponentLabel(t)))}},{key:"blur",value:function(){this.focusedComponent&&(this.focusedComponent.focused=!1,this.focusedComponent=null)}},{key:"getComponentLabel",value:function(t){return t.text||t.label||t.ariaLabel||t.constructor.name}},{key:"destroy",value:function(){this.ariaLiveRegion&&this.ariaLiveRegion.remove()}}],e&&om(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function lm(t){return lm="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},lm(t)}function um(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,u=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(t){u=!0,i=t}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}(t,e)||cm(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function cm(t,e){if(t){if("string"==typeof t)return hm(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?hm(t,e):void 0}}function hm(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function fm(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,dm(r.key),r)}}function dm(t){var e=function(t){if("object"!=lm(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=lm(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==lm(e)?e:e+""}const pm=function(){return t=function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.framework=e,this.imageCache=new Map,this.maxCacheSize=52428800,this.currentCacheSize=0,this.componentRegistry=new WeakMap},e=[{key:"cacheImage",value:function(t,e){var n=this.estimateImageSize(e);this.currentCacheSize+n>this.maxCacheSize&&this.evictOldest(),this.imageCache.set(t,{image:e,size:n,lastAccessed:Date.now(),accessCount:0}),this.currentCacheSize+=n}},{key:"getImage",value:function(t){var e=this.imageCache.get(t);return e?(e.lastAccessed=Date.now(),e.accessCount++,e.image):null}},{key:"evictOldest",value:function(){var t,e=null,n=1/0,r=function(t){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=cm(t))){e&&(t=e);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,a=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return o=t.done,t},e:function(t){a=!0,i=t},f:function(){try{o||null==e.return||e.return()}finally{if(a)throw i}}}}(this.imageCache);try{for(r.s();!(t=r.n()).done;){var i=um(t.value,2),o=i[0],a=i[1];a.lastAccessed<n&&(n=a.lastAccessed,e=o)}}catch(t){r.e(t)}finally{r.f()}if(e){var s=this.imageCache.get(e);this.currentCacheSize-=s.size,this.imageCache.delete(e)}}},{key:"estimateImageSize",value:function(t){return t.width*t.height*4}},{key:"registerComponent",value:function(t){this.componentRegistry.set(t,{created:Date.now(),listeners:[]})}},{key:"unregisterComponent",value:function(t){var e=this.componentRegistry.get(t);e&&e.listeners.forEach(function(t){var e=t.element,n=t.event,r=t.handler;e.removeEventListener(n,r)}),this.componentRegistry.delete(t)}},{key:"trackListener",value:function(t,e,n,r){var i=this.componentRegistry.get(t);i&&i.listeners.push({element:e,event:n,handler:r})}},{key:"clearAll",value:function(){this.imageCache.clear(),this.currentCacheSize=0}},{key:"getMemoryReport",value:function(){return{imageCacheSize:"".concat((this.currentCacheSize/1024/1024).toFixed(2)," MB"),imageCacheCount:this.imageCache.size,componentCount:this.framework.components.length,heapSize:performance.memory?"".concat((performance.memory.usedJSHeapSize/1024/1024).toFixed(2)," MB"):"N/A"}}}],e&&fm(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function ym(t){return ym="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ym(t)}function vm(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,mm(r.key),r)}}function mm(t){var e=function(t){if("object"!=ym(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ym(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ym(e)?e:e+""}const gm=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)},e=[{key:"sanitizeInput",value:function(t){return"string"!=typeof t?t:t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;").replace(/\//g,"&#x2F;")}},{key:"validateUrl",value:function(t){try{var e=new URL(t);if(!["http:","https:"].includes(e.protocol))throw new Error("Invalid protocol");return!0}catch(t){return!1}}},{key:"rateLimit",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3,r=[];return function(){for(var i=Date.now();r.length&&r[0]<i-n;)r.shift();if(r.length>=e)return console.warn("⚠️ Rate limit exceeded"),null;r.push(i);for(var o=arguments.length,a=new Array(o),s=0;s<o;s++)a[s]=arguments[s];return t.apply(this,a)}}}],null&&vm(t.prototype,null),e&&vm(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function bm(t){return bm="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},bm(t)}function wm(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,xm(r.key),r)}}function xm(t){var e=function(t){if("object"!=bm(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=bm(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==bm(e)?e:e+""}const km=function(){return t=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.flags=e.flags||{},this.userId=e.userId,this.experiments={}},(e=[{key:"isEnabled",value:function(t){var e=this.flags[t];if("boolean"==typeof e)return e;if("object"===bm(e)){if(e.percentage&&this.userId)return this.hashUserId(this.userId)<e.percentage;if(e.variants)return this.getVariant(t,e.variants)}return!1}},{key:"getVariant",value:function(t,e){if(!this.userId)return e[0];var n=this.hashUserId(this.userId+t)%e.length;return this.experiments[t]=e[n],e[n]}},{key:"hashUserId",value:function(t){for(var e=0,n=0;n<t.length;n++)e=(e<<5)-e+t.charCodeAt(n),e&=e;return Math.abs(e)%100}},{key:"trackExperiment",value:function(t){console.log("Experiment:",t,this.experiments[t])}}])&&wm(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();var Sm="0.5.17";return e})());